mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] omap: move scale_vcores to omap4_generic
@ 2012-03-05 10:19 Jan Weitzel
  2012-03-05 10:19 ` [PATCH 2/2] omap: move do_set_mux " Jan Weitzel
  2012-03-05 17:11 ` [PATCH 1/2] omap: move scale_vcores " Sascha Hauer
  0 siblings, 2 replies; 7+ messages in thread
From: Jan Weitzel @ 2012-03-05 10:19 UTC (permalink / raw)
  To: barebox

scale_vcores is used by two boards.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
 arch/arm/boards/panda/lowlevel.c                |   31 -----------------------
 arch/arm/boards/pcm049/lowlevel.c               |   31 -----------------------
 arch/arm/mach-omap/include/mach/omap4-silicon.h |    1 +
 arch/arm/mach-omap/omap4_generic.c              |   31 +++++++++++++++++++++++
 4 files changed, 32 insertions(+), 62 deletions(-)

diff --git a/arch/arm/boards/panda/lowlevel.c b/arch/arm/boards/panda/lowlevel.c
index 45ea221..e73e2cf 100644
--- a/arch/arm/boards/panda/lowlevel.c
+++ b/arch/arm/boards/panda/lowlevel.c
@@ -44,37 +44,6 @@ static const struct ddr_regs ddr_regs_400_mhz_2cs = {
 	.mr2		= 0x4
 };
 
-#define I2C_SLAVE 0x12
-
-static int noinline scale_vcores(void)
-{
-	unsigned int rev = omap4_revision();
-
-	/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
-	 * VCOREx_CFG_VOLTAGE  changes can be discarded
-	 */
-	writel(0, OMAP44XX_PRM_VC_CFG_I2C_MODE);
-	writel(0x6026, OMAP44XX_PRM_VC_CFG_I2C_CLK);
-
-	/* set VCORE1 force VSEL */
-	omap4_power_i2c_send((0x3A55 << 8) | I2C_SLAVE);
-
-	/* FIXME: set VCORE2 force VSEL, Check the reset value */
-	omap4_power_i2c_send((0x295B << 8) | I2C_SLAVE);
-
-	/* set VCORE3 force VSEL */
-	switch (rev) {
-	case OMAP4430_ES2_0:
-		omap4_power_i2c_send((0x2961 << 8) | I2C_SLAVE);
-		break;
-	case OMAP4430_ES2_1:
-		omap4_power_i2c_send((0x2A61 << 8) | I2C_SLAVE);
-		break;
-	}
-
-	return 0;
-}
-
 static void noinline panda_init_lowlevel(void)
 {
 	struct dpll_param core = OMAP4_CORE_DPLL_PARAM_38M4_DDR400;
diff --git a/arch/arm/boards/pcm049/lowlevel.c b/arch/arm/boards/pcm049/lowlevel.c
index bea895e..2b6e91f 100644
--- a/arch/arm/boards/pcm049/lowlevel.c
+++ b/arch/arm/boards/pcm049/lowlevel.c
@@ -44,37 +44,6 @@ static const struct ddr_regs ddr_regs_mt42L64M64_3_200_mhz = {
 	.mr2		= 0x1	      /* from elpida 200MHz! */
 };
 
-#define I2C_SLAVE 0x12
-
-static int noinline scale_vcores(void)
-{
-	unsigned int rev = omap4_revision();
-
-	/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
-	 * VCOREx_CFG_VOLTAGE  changes can be discarded
-	 */
-	writel(0, OMAP44XX_PRM_VC_CFG_I2C_MODE);
-	writel(0x6026, OMAP44XX_PRM_VC_CFG_I2C_CLK);
-
-	/* set VCORE1 force VSEL */
-	omap4_power_i2c_send((0x3A55 << 8) | I2C_SLAVE);
-
-	/* FIXME: set VCORE2 force VSEL, Check the reset value */
-	omap4_power_i2c_send((0x295B << 8) | I2C_SLAVE);
-
-	/* set VCORE3 force VSEL */
-	switch (rev) {
-	case OMAP4430_ES2_0:
-		omap4_power_i2c_send((0x2961 << 8) | I2C_SLAVE);
-		break;
-	case OMAP4430_ES2_1:
-		omap4_power_i2c_send((0x2A61 << 8) | I2C_SLAVE);
-		break;
-	}
-
-	return 0;
-}
-
 static void noinline pcm049_init_lowlevel(void)
 {
 	struct dpll_param core = OMAP4_CORE_DPLL_PARAM_19M2_DDR200;
diff --git a/arch/arm/mach-omap/include/mach/omap4-silicon.h b/arch/arm/mach-omap/include/mach/omap4-silicon.h
index db0dfdf..12ab9a5 100644
--- a/arch/arm/mach-omap/include/mach/omap4-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap4-silicon.h
@@ -175,5 +175,6 @@ struct dpll_param;
 void omap4_ddr_init(const struct ddr_regs *, const struct dpll_param *);
 void omap4_power_i2c_send(u32);
 unsigned int omap4_revision(void);
+noinline int scale_vcores(void);
 
 #endif
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index c6e46e6..76cf2f5 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -419,3 +419,34 @@ enum omap_boot_src omap4_bootsrc(void)
 		return OMAP_BOOTSRC_NAND;
 	return OMAP_BOOTSRC_UNKNOWN;
 }
+
+#define I2C_SLAVE 0x12
+
+noinline int scale_vcores(void)
+{
+	unsigned int rev = omap4_revision();
+
+	/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
+	 * VCOREx_CFG_VOLTAGE  changes can be discarded
+	 */
+	writel(0, OMAP44XX_PRM_VC_CFG_I2C_MODE);
+	writel(0x6026, OMAP44XX_PRM_VC_CFG_I2C_CLK);
+
+	/* set VCORE1 force VSEL */
+	omap4_power_i2c_send((0x3A55 << 8) | I2C_SLAVE);
+
+	/* FIXME: set VCORE2 force VSEL, Check the reset value */
+	omap4_power_i2c_send((0x295B << 8) | I2C_SLAVE);
+
+	/* set VCORE3 force VSEL */
+	switch (rev) {
+	case OMAP4430_ES2_0:
+		omap4_power_i2c_send((0x2961 << 8) | I2C_SLAVE);
+		break;
+	case OMAP4430_ES2_1:
+		omap4_power_i2c_send((0x2A61 << 8) | I2C_SLAVE);
+		break;
+	}
+
+	return 0;
+}
-- 
1.7.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] omap: move do_set_mux to omap4_generic
  2012-03-05 10:19 [PATCH 1/2] omap: move scale_vcores to omap4_generic Jan Weitzel
@ 2012-03-05 10:19 ` Jan Weitzel
  2012-03-05 17:12   ` Sascha Hauer
  2012-03-05 17:11 ` [PATCH 1/2] omap: move scale_vcores " Sascha Hauer
  1 sibling, 1 reply; 7+ messages in thread
From: Jan Weitzel @ 2012-03-05 10:19 UTC (permalink / raw)
  To: barebox

do_set_mux is used by two boards.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
 arch/arm/boards/panda/mux.c                 |    9 ---------
 arch/arm/boards/pcm049/mux.c                |    9 ---------
 arch/arm/mach-omap/include/mach/omap4-mux.h |    2 ++
 arch/arm/mach-omap/omap4_generic.c          |   10 ++++++++++
 4 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/arch/arm/boards/panda/mux.c b/arch/arm/boards/panda/mux.c
index 7586e86..5a5c155 100644
--- a/arch/arm/boards/panda/mux.c
+++ b/arch/arm/boards/panda/mux.c
@@ -238,15 +238,6 @@ static const struct pad_conf_entry wkup_padconf_array[] = {
 	{ PAD0_FREF_CLK4_OUT, M3 /* gpio_wk8 */ },
 };
 
-static void do_set_mux(u32 base, struct pad_conf_entry const *array, int size)
-{
-	int i;
-	struct pad_conf_entry *pad = (struct pad_conf_entry *) array;
-
-	for (i = 0; i < size; i++, pad++)
-		writew(pad->val, base + pad->offset);
-}
-
 void set_muxconf_regs(void)
 {
 	do_set_mux(OMAP44XX_CONTROL_PADCONF_CORE, core_padconf_array,
diff --git a/arch/arm/boards/pcm049/mux.c b/arch/arm/boards/pcm049/mux.c
index 9911b62..f8a23d8 100644
--- a/arch/arm/boards/pcm049/mux.c
+++ b/arch/arm/boards/pcm049/mux.c
@@ -235,15 +235,6 @@ static const struct pad_conf_entry wkup_padconf_array[] = {
 	{PAD1_SYS_BOOT7, (IEN | M3)},					/* gpio_wk10 */
 };
 
-static void do_set_mux(u32 base, struct pad_conf_entry const *array, int size)
-{
-	int i;
-	struct pad_conf_entry *pad = (struct pad_conf_entry *) array;
-
-	for (i = 0; i < size; i++, pad++)
-		writew(pad->val, base + pad->offset);
-}
-
 void set_muxconf_regs(void)
 {
 	do_set_mux(OMAP44XX_CONTROL_PADCONF_CORE, core_padconf_array,
diff --git a/arch/arm/mach-omap/include/mach/omap4-mux.h b/arch/arm/mach-omap/include/mach/omap4-mux.h
index 019574b..dfecfd5 100644
--- a/arch/arm/mach-omap/include/mach/omap4-mux.h
+++ b/arch/arm/mach-omap/include/mach/omap4-mux.h
@@ -341,4 +341,6 @@ struct pad_conf_entry {
 #define CONTROL_SPARE_R		0x0618
 #define CONTROL_SPARE_R_C0		0x061C
 
+void do_set_mux(u32 base, struct pad_conf_entry const *array, int size);
+
 #endif /* _MUX_OMAP4_H_ */
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index 76cf2f5..9c0dbf6 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -3,6 +3,7 @@
 #include <mach/silicon.h>
 #include <io.h>
 #include <mach/omap4-silicon.h>
+#include <mach/omap4-mux.h>
 #include <mach/omap4-clock.h>
 #include <mach/syslib.h>
 #include <mach/xload.h>
@@ -450,3 +451,12 @@ noinline int scale_vcores(void)
 
 	return 0;
 }
+
+void do_set_mux(u32 base, struct pad_conf_entry const *array, int size)
+{
+	int i;
+	struct pad_conf_entry *pad = (struct pad_conf_entry *) array;
+
+	for (i = 0; i < size; i++, pad++)
+		writew(pad->val, base + pad->offset);
+}
-- 
1.7.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] omap: move scale_vcores to omap4_generic
  2012-03-05 10:19 [PATCH 1/2] omap: move scale_vcores to omap4_generic Jan Weitzel
  2012-03-05 10:19 ` [PATCH 2/2] omap: move do_set_mux " Jan Weitzel
@ 2012-03-05 17:11 ` Sascha Hauer
  1 sibling, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2012-03-05 17:11 UTC (permalink / raw)
  To: Jan Weitzel; +Cc: barebox

Hi Jan,

On Mon, Mar 05, 2012 at 11:19:43AM +0100, Jan Weitzel wrote:
> index c6e46e6..76cf2f5 100644
> --- a/arch/arm/mach-omap/omap4_generic.c
> +++ b/arch/arm/mach-omap/omap4_generic.c
> @@ -419,3 +419,34 @@ enum omap_boot_src omap4_bootsrc(void)
>  		return OMAP_BOOTSRC_NAND;
>  	return OMAP_BOOTSRC_UNKNOWN;
>  }
> +
> +#define I2C_SLAVE 0x12
> +
> +noinline int scale_vcores(void)

As this is no static function anymore scale_vcores is a bit generic. Can
you add a omap4_ prefix?

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] omap: move do_set_mux to omap4_generic
  2012-03-05 10:19 ` [PATCH 2/2] omap: move do_set_mux " Jan Weitzel
@ 2012-03-05 17:12   ` Sascha Hauer
  2012-03-06 14:26     ` [PATCH 1/2 v2] omap: move scale_vcores " Jan Weitzel
  2012-03-06 14:26     ` [PATCH 2/2 v2] omap: move do_set_mux " Jan Weitzel
  0 siblings, 2 replies; 7+ messages in thread
From: Sascha Hauer @ 2012-03-05 17:12 UTC (permalink / raw)
  To: Jan Weitzel; +Cc: barebox

On Mon, Mar 05, 2012 at 11:19:44AM +0100, Jan Weitzel wrote:
> do_set_mux is used by two boards.
>  	return 0;
>  }
> +
> +void do_set_mux(u32 base, struct pad_conf_entry const *array, int size)
> +{
> +	int i;
> +	struct pad_conf_entry *pad = (struct pad_conf_entry *) array;
> +
> +	for (i = 0; i < size; i++, pad++)
> +		writew(pad->val, base + pad->offset);
> +}

Same here.


Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2 v2] omap: move scale_vcores to omap4_generic
  2012-03-05 17:12   ` Sascha Hauer
@ 2012-03-06 14:26     ` Jan Weitzel
  2012-03-07  8:56       ` Sascha Hauer
  2012-03-06 14:26     ` [PATCH 2/2 v2] omap: move do_set_mux " Jan Weitzel
  1 sibling, 1 reply; 7+ messages in thread
From: Jan Weitzel @ 2012-03-06 14:26 UTC (permalink / raw)
  To: barebox

scale_vcores is used by two boards.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
v2: add omap4_ prefix

 arch/arm/boards/panda/lowlevel.c                |   33 +----------------------
 arch/arm/boards/pcm049/lowlevel.c               |   33 +----------------------
 arch/arm/mach-omap/include/mach/omap4-silicon.h |    1 +
 arch/arm/mach-omap/omap4_generic.c              |   31 +++++++++++++++++++++
 4 files changed, 34 insertions(+), 64 deletions(-)

diff --git a/arch/arm/boards/panda/lowlevel.c b/arch/arm/boards/panda/lowlevel.c
index 45ea221..8591fff 100644
--- a/arch/arm/boards/panda/lowlevel.c
+++ b/arch/arm/boards/panda/lowlevel.c
@@ -44,37 +44,6 @@ static const struct ddr_regs ddr_regs_400_mhz_2cs = {
 	.mr2		= 0x4
 };
 
-#define I2C_SLAVE 0x12
-
-static int noinline scale_vcores(void)
-{
-	unsigned int rev = omap4_revision();
-
-	/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
-	 * VCOREx_CFG_VOLTAGE  changes can be discarded
-	 */
-	writel(0, OMAP44XX_PRM_VC_CFG_I2C_MODE);
-	writel(0x6026, OMAP44XX_PRM_VC_CFG_I2C_CLK);
-
-	/* set VCORE1 force VSEL */
-	omap4_power_i2c_send((0x3A55 << 8) | I2C_SLAVE);
-
-	/* FIXME: set VCORE2 force VSEL, Check the reset value */
-	omap4_power_i2c_send((0x295B << 8) | I2C_SLAVE);
-
-	/* set VCORE3 force VSEL */
-	switch (rev) {
-	case OMAP4430_ES2_0:
-		omap4_power_i2c_send((0x2961 << 8) | I2C_SLAVE);
-		break;
-	case OMAP4430_ES2_1:
-		omap4_power_i2c_send((0x2A61 << 8) | I2C_SLAVE);
-		break;
-	}
-
-	return 0;
-}
-
 static void noinline panda_init_lowlevel(void)
 {
 	struct dpll_param core = OMAP4_CORE_DPLL_PARAM_38M4_DDR400;
@@ -101,7 +70,7 @@ static void noinline panda_init_lowlevel(void)
 	omap4_ddr_init(&ddr_regs_400_mhz_2cs, &core);
 
 	/* Set VCORE1 = 1.3 V, VCORE2 = VCORE3 = 1.21V */
-	scale_vcores();
+	omap4_scale_vcores();
 
 	board_init_lowlevel_return();
 }
diff --git a/arch/arm/boards/pcm049/lowlevel.c b/arch/arm/boards/pcm049/lowlevel.c
index bea895e..444a394 100644
--- a/arch/arm/boards/pcm049/lowlevel.c
+++ b/arch/arm/boards/pcm049/lowlevel.c
@@ -44,37 +44,6 @@ static const struct ddr_regs ddr_regs_mt42L64M64_3_200_mhz = {
 	.mr2		= 0x1	      /* from elpida 200MHz! */
 };
 
-#define I2C_SLAVE 0x12
-
-static int noinline scale_vcores(void)
-{
-	unsigned int rev = omap4_revision();
-
-	/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
-	 * VCOREx_CFG_VOLTAGE  changes can be discarded
-	 */
-	writel(0, OMAP44XX_PRM_VC_CFG_I2C_MODE);
-	writel(0x6026, OMAP44XX_PRM_VC_CFG_I2C_CLK);
-
-	/* set VCORE1 force VSEL */
-	omap4_power_i2c_send((0x3A55 << 8) | I2C_SLAVE);
-
-	/* FIXME: set VCORE2 force VSEL, Check the reset value */
-	omap4_power_i2c_send((0x295B << 8) | I2C_SLAVE);
-
-	/* set VCORE3 force VSEL */
-	switch (rev) {
-	case OMAP4430_ES2_0:
-		omap4_power_i2c_send((0x2961 << 8) | I2C_SLAVE);
-		break;
-	case OMAP4430_ES2_1:
-		omap4_power_i2c_send((0x2A61 << 8) | I2C_SLAVE);
-		break;
-	}
-
-	return 0;
-}
-
 static void noinline pcm049_init_lowlevel(void)
 {
 	struct dpll_param core = OMAP4_CORE_DPLL_PARAM_19M2_DDR200;
@@ -89,7 +58,7 @@ static void noinline pcm049_init_lowlevel(void)
 	omap4_ddr_init(&ddr_regs_mt42L64M64_3_200_mhz, &core);
 
 	/* Set VCORE1 = 1.3 V, VCORE2 = VCORE3 = 1.21V */
-	scale_vcores();
+	omap4_scale_vcores();
 
 	writel(CM_SYS_CLKSEL_19M2, CM_SYS_CLKSEL);
 
diff --git a/arch/arm/mach-omap/include/mach/omap4-silicon.h b/arch/arm/mach-omap/include/mach/omap4-silicon.h
index db0dfdf..f8d3396 100644
--- a/arch/arm/mach-omap/include/mach/omap4-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap4-silicon.h
@@ -175,5 +175,6 @@ struct dpll_param;
 void omap4_ddr_init(const struct ddr_regs *, const struct dpll_param *);
 void omap4_power_i2c_send(u32);
 unsigned int omap4_revision(void);
+noinline int omap4_scale_vcores(void);
 
 #endif
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index c6e46e6..8352470 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -419,3 +419,34 @@ enum omap_boot_src omap4_bootsrc(void)
 		return OMAP_BOOTSRC_NAND;
 	return OMAP_BOOTSRC_UNKNOWN;
 }
+
+#define I2C_SLAVE 0x12
+
+noinline int omap4_scale_vcores(void)
+{
+	unsigned int rev = omap4_revision();
+
+	/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
+	 * VCOREx_CFG_VOLTAGE  changes can be discarded
+	 */
+	writel(0, OMAP44XX_PRM_VC_CFG_I2C_MODE);
+	writel(0x6026, OMAP44XX_PRM_VC_CFG_I2C_CLK);
+
+	/* set VCORE1 force VSEL */
+	omap4_power_i2c_send((0x3A55 << 8) | I2C_SLAVE);
+
+	/* FIXME: set VCORE2 force VSEL, Check the reset value */
+	omap4_power_i2c_send((0x295B << 8) | I2C_SLAVE);
+
+	/* set VCORE3 force VSEL */
+	switch (rev) {
+	case OMAP4430_ES2_0:
+		omap4_power_i2c_send((0x2961 << 8) | I2C_SLAVE);
+		break;
+	case OMAP4430_ES2_1:
+		omap4_power_i2c_send((0x2A61 << 8) | I2C_SLAVE);
+		break;
+	}
+
+	return 0;
+}
-- 
1.7.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2 v2] omap: move do_set_mux to omap4_generic
  2012-03-05 17:12   ` Sascha Hauer
  2012-03-06 14:26     ` [PATCH 1/2 v2] omap: move scale_vcores " Jan Weitzel
@ 2012-03-06 14:26     ` Jan Weitzel
  1 sibling, 0 replies; 7+ messages in thread
From: Jan Weitzel @ 2012-03-06 14:26 UTC (permalink / raw)
  To: barebox

do_set_mux is used by two boards.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
v2: add omap4_ prefix

 arch/arm/boards/panda/mux.c                 |   13 ++-----------
 arch/arm/boards/pcm049/mux.c                |   13 ++-----------
 arch/arm/mach-omap/include/mach/omap4-mux.h |    2 ++
 arch/arm/mach-omap/omap4_generic.c          |   10 ++++++++++
 4 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/arch/arm/boards/panda/mux.c b/arch/arm/boards/panda/mux.c
index 7586e86..310e433 100644
--- a/arch/arm/boards/panda/mux.c
+++ b/arch/arm/boards/panda/mux.c
@@ -238,20 +238,11 @@ static const struct pad_conf_entry wkup_padconf_array[] = {
 	{ PAD0_FREF_CLK4_OUT, M3 /* gpio_wk8 */ },
 };
 
-static void do_set_mux(u32 base, struct pad_conf_entry const *array, int size)
-{
-	int i;
-	struct pad_conf_entry *pad = (struct pad_conf_entry *) array;
-
-	for (i = 0; i < size; i++, pad++)
-		writew(pad->val, base + pad->offset);
-}
-
 void set_muxconf_regs(void)
 {
-	do_set_mux(OMAP44XX_CONTROL_PADCONF_CORE, core_padconf_array,
+	omap4_do_set_mux(OMAP44XX_CONTROL_PADCONF_CORE, core_padconf_array,
 			ARRAY_SIZE(core_padconf_array));
 
-	do_set_mux(OMAP44XX_CONTROL_PADCONF_WKUP, wkup_padconf_array,
+	omap4_do_set_mux(OMAP44XX_CONTROL_PADCONF_WKUP, wkup_padconf_array,
 			ARRAY_SIZE(wkup_padconf_array));
 }
diff --git a/arch/arm/boards/pcm049/mux.c b/arch/arm/boards/pcm049/mux.c
index 9911b62..0e7adea 100644
--- a/arch/arm/boards/pcm049/mux.c
+++ b/arch/arm/boards/pcm049/mux.c
@@ -235,20 +235,11 @@ static const struct pad_conf_entry wkup_padconf_array[] = {
 	{PAD1_SYS_BOOT7, (IEN | M3)},					/* gpio_wk10 */
 };
 
-static void do_set_mux(u32 base, struct pad_conf_entry const *array, int size)
-{
-	int i;
-	struct pad_conf_entry *pad = (struct pad_conf_entry *) array;
-
-	for (i = 0; i < size; i++, pad++)
-		writew(pad->val, base + pad->offset);
-}
-
 void set_muxconf_regs(void)
 {
-	do_set_mux(OMAP44XX_CONTROL_PADCONF_CORE, core_padconf_array,
+	omap4_do_set_mux(OMAP44XX_CONTROL_PADCONF_CORE, core_padconf_array,
 			ARRAY_SIZE(core_padconf_array));
 
-	do_set_mux(OMAP44XX_CONTROL_PADCONF_WKUP, wkup_padconf_array,
+	omap4_do_set_mux(OMAP44XX_CONTROL_PADCONF_WKUP, wkup_padconf_array,
 			ARRAY_SIZE(wkup_padconf_array));
 }
diff --git a/arch/arm/mach-omap/include/mach/omap4-mux.h b/arch/arm/mach-omap/include/mach/omap4-mux.h
index 019574b..d06beaa 100644
--- a/arch/arm/mach-omap/include/mach/omap4-mux.h
+++ b/arch/arm/mach-omap/include/mach/omap4-mux.h
@@ -341,4 +341,6 @@ struct pad_conf_entry {
 #define CONTROL_SPARE_R		0x0618
 #define CONTROL_SPARE_R_C0		0x061C
 
+void omap4_do_set_mux(u32 base, struct pad_conf_entry const *array, int size);
+
 #endif /* _MUX_OMAP4_H_ */
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index 8352470..baa138d 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -3,6 +3,7 @@
 #include <mach/silicon.h>
 #include <io.h>
 #include <mach/omap4-silicon.h>
+#include <mach/omap4-mux.h>
 #include <mach/omap4-clock.h>
 #include <mach/syslib.h>
 #include <mach/xload.h>
@@ -450,3 +451,12 @@ noinline int omap4_scale_vcores(void)
 
 	return 0;
 }
+
+void omap4_do_set_mux(u32 base, struct pad_conf_entry const *array, int size)
+{
+	int i;
+	struct pad_conf_entry *pad = (struct pad_conf_entry *) array;
+
+	for (i = 0; i < size; i++, pad++)
+		writew(pad->val, base + pad->offset);
+}
-- 
1.7.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2 v2] omap: move scale_vcores to omap4_generic
  2012-03-06 14:26     ` [PATCH 1/2 v2] omap: move scale_vcores " Jan Weitzel
@ 2012-03-07  8:56       ` Sascha Hauer
  0 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2012-03-07  8:56 UTC (permalink / raw)
  To: Jan Weitzel; +Cc: barebox

On Tue, Mar 06, 2012 at 03:26:28PM +0100, Jan Weitzel wrote:
> scale_vcores is used by two boards.
> 
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> ---
> v2: add omap4_ prefix

Applied both. Thanks


 Sascha
> 
>  arch/arm/boards/panda/lowlevel.c                |   33 +----------------------
>  arch/arm/boards/pcm049/lowlevel.c               |   33 +----------------------
>  arch/arm/mach-omap/include/mach/omap4-silicon.h |    1 +
>  arch/arm/mach-omap/omap4_generic.c              |   31 +++++++++++++++++++++
>  4 files changed, 34 insertions(+), 64 deletions(-)
> 
> diff --git a/arch/arm/boards/panda/lowlevel.c b/arch/arm/boards/panda/lowlevel.c
> index 45ea221..8591fff 100644
> --- a/arch/arm/boards/panda/lowlevel.c
> +++ b/arch/arm/boards/panda/lowlevel.c
> @@ -44,37 +44,6 @@ static const struct ddr_regs ddr_regs_400_mhz_2cs = {
>  	.mr2		= 0x4
>  };
>  
> -#define I2C_SLAVE 0x12
> -
> -static int noinline scale_vcores(void)
> -{
> -	unsigned int rev = omap4_revision();
> -
> -	/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
> -	 * VCOREx_CFG_VOLTAGE  changes can be discarded
> -	 */
> -	writel(0, OMAP44XX_PRM_VC_CFG_I2C_MODE);
> -	writel(0x6026, OMAP44XX_PRM_VC_CFG_I2C_CLK);
> -
> -	/* set VCORE1 force VSEL */
> -	omap4_power_i2c_send((0x3A55 << 8) | I2C_SLAVE);
> -
> -	/* FIXME: set VCORE2 force VSEL, Check the reset value */
> -	omap4_power_i2c_send((0x295B << 8) | I2C_SLAVE);
> -
> -	/* set VCORE3 force VSEL */
> -	switch (rev) {
> -	case OMAP4430_ES2_0:
> -		omap4_power_i2c_send((0x2961 << 8) | I2C_SLAVE);
> -		break;
> -	case OMAP4430_ES2_1:
> -		omap4_power_i2c_send((0x2A61 << 8) | I2C_SLAVE);
> -		break;
> -	}
> -
> -	return 0;
> -}
> -
>  static void noinline panda_init_lowlevel(void)
>  {
>  	struct dpll_param core = OMAP4_CORE_DPLL_PARAM_38M4_DDR400;
> @@ -101,7 +70,7 @@ static void noinline panda_init_lowlevel(void)
>  	omap4_ddr_init(&ddr_regs_400_mhz_2cs, &core);
>  
>  	/* Set VCORE1 = 1.3 V, VCORE2 = VCORE3 = 1.21V */
> -	scale_vcores();
> +	omap4_scale_vcores();
>  
>  	board_init_lowlevel_return();
>  }
> diff --git a/arch/arm/boards/pcm049/lowlevel.c b/arch/arm/boards/pcm049/lowlevel.c
> index bea895e..444a394 100644
> --- a/arch/arm/boards/pcm049/lowlevel.c
> +++ b/arch/arm/boards/pcm049/lowlevel.c
> @@ -44,37 +44,6 @@ static const struct ddr_regs ddr_regs_mt42L64M64_3_200_mhz = {
>  	.mr2		= 0x1	      /* from elpida 200MHz! */
>  };
>  
> -#define I2C_SLAVE 0x12
> -
> -static int noinline scale_vcores(void)
> -{
> -	unsigned int rev = omap4_revision();
> -
> -	/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
> -	 * VCOREx_CFG_VOLTAGE  changes can be discarded
> -	 */
> -	writel(0, OMAP44XX_PRM_VC_CFG_I2C_MODE);
> -	writel(0x6026, OMAP44XX_PRM_VC_CFG_I2C_CLK);
> -
> -	/* set VCORE1 force VSEL */
> -	omap4_power_i2c_send((0x3A55 << 8) | I2C_SLAVE);
> -
> -	/* FIXME: set VCORE2 force VSEL, Check the reset value */
> -	omap4_power_i2c_send((0x295B << 8) | I2C_SLAVE);
> -
> -	/* set VCORE3 force VSEL */
> -	switch (rev) {
> -	case OMAP4430_ES2_0:
> -		omap4_power_i2c_send((0x2961 << 8) | I2C_SLAVE);
> -		break;
> -	case OMAP4430_ES2_1:
> -		omap4_power_i2c_send((0x2A61 << 8) | I2C_SLAVE);
> -		break;
> -	}
> -
> -	return 0;
> -}
> -
>  static void noinline pcm049_init_lowlevel(void)
>  {
>  	struct dpll_param core = OMAP4_CORE_DPLL_PARAM_19M2_DDR200;
> @@ -89,7 +58,7 @@ static void noinline pcm049_init_lowlevel(void)
>  	omap4_ddr_init(&ddr_regs_mt42L64M64_3_200_mhz, &core);
>  
>  	/* Set VCORE1 = 1.3 V, VCORE2 = VCORE3 = 1.21V */
> -	scale_vcores();
> +	omap4_scale_vcores();
>  
>  	writel(CM_SYS_CLKSEL_19M2, CM_SYS_CLKSEL);
>  
> diff --git a/arch/arm/mach-omap/include/mach/omap4-silicon.h b/arch/arm/mach-omap/include/mach/omap4-silicon.h
> index db0dfdf..f8d3396 100644
> --- a/arch/arm/mach-omap/include/mach/omap4-silicon.h
> +++ b/arch/arm/mach-omap/include/mach/omap4-silicon.h
> @@ -175,5 +175,6 @@ struct dpll_param;
>  void omap4_ddr_init(const struct ddr_regs *, const struct dpll_param *);
>  void omap4_power_i2c_send(u32);
>  unsigned int omap4_revision(void);
> +noinline int omap4_scale_vcores(void);
>  
>  #endif
> diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
> index c6e46e6..8352470 100644
> --- a/arch/arm/mach-omap/omap4_generic.c
> +++ b/arch/arm/mach-omap/omap4_generic.c
> @@ -419,3 +419,34 @@ enum omap_boot_src omap4_bootsrc(void)
>  		return OMAP_BOOTSRC_NAND;
>  	return OMAP_BOOTSRC_UNKNOWN;
>  }
> +
> +#define I2C_SLAVE 0x12
> +
> +noinline int omap4_scale_vcores(void)
> +{
> +	unsigned int rev = omap4_revision();
> +
> +	/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
> +	 * VCOREx_CFG_VOLTAGE  changes can be discarded
> +	 */
> +	writel(0, OMAP44XX_PRM_VC_CFG_I2C_MODE);
> +	writel(0x6026, OMAP44XX_PRM_VC_CFG_I2C_CLK);
> +
> +	/* set VCORE1 force VSEL */
> +	omap4_power_i2c_send((0x3A55 << 8) | I2C_SLAVE);
> +
> +	/* FIXME: set VCORE2 force VSEL, Check the reset value */
> +	omap4_power_i2c_send((0x295B << 8) | I2C_SLAVE);
> +
> +	/* set VCORE3 force VSEL */
> +	switch (rev) {
> +	case OMAP4430_ES2_0:
> +		omap4_power_i2c_send((0x2961 << 8) | I2C_SLAVE);
> +		break;
> +	case OMAP4430_ES2_1:
> +		omap4_power_i2c_send((0x2A61 << 8) | I2C_SLAVE);
> +		break;
> +	}
> +
> +	return 0;
> +}
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-07  8:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-05 10:19 [PATCH 1/2] omap: move scale_vcores to omap4_generic Jan Weitzel
2012-03-05 10:19 ` [PATCH 2/2] omap: move do_set_mux " Jan Weitzel
2012-03-05 17:12   ` Sascha Hauer
2012-03-06 14:26     ` [PATCH 1/2 v2] omap: move scale_vcores " Jan Weitzel
2012-03-07  8:56       ` Sascha Hauer
2012-03-06 14:26     ` [PATCH 2/2 v2] omap: move do_set_mux " Jan Weitzel
2012-03-05 17:11 ` [PATCH 1/2] omap: move scale_vcores " Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox