All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support
@ 2011-07-16 16:25 Aneesh V
  2011-07-16 16:25 ` [U-Boot] [PATCH v 1/5] omap4: add omap4460 revision detection Aneesh V
                   ` (12 more replies)
  0 siblings, 13 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-16 16:25 UTC (permalink / raw)
  To: u-boot

OMAP4460 is the latest addition to the OMAP4 family.
OMAP4460 has dual core Cortex-A9 CPUs that can be clocked upto
1.5 GHz

The memory architecture has been improved to provide better
performance and there several other minor improvements in various
modules.

Aneesh V (5):
  omap4: add omap4460 revision detection
  omap4: sdram init changes for omap4460
  omap: reuse omap3 gpio support in omap4
  omap4: support TPS programming
  omap4: clock init support for omap4460

 arch/arm/cpu/armv7/omap-common/Makefile          |    1 +
 arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c |   41 +++----
 arch/arm/cpu/armv7/omap3/Makefile                |    1 -
 arch/arm/cpu/armv7/omap3/board.c                 |   12 ++
 arch/arm/cpu/armv7/omap4/board.c                 |   19 +++
 arch/arm/cpu/armv7/omap4/clocks.c                |  128 +++++++++++++++++++---
 arch/arm/cpu/armv7/omap4/emif.c                  |   39 ++++---
 arch/arm/include/asm/arch-omap3/cpu.h            |   26 +++++
 arch/arm/include/asm/arch-omap3/gpio.h           |   86 ---------------
 arch/arm/include/asm/arch-omap4/clocks.h         |   28 +++++-
 arch/arm/include/asm/arch-omap4/cpu.h            |   26 +++++
 arch/arm/include/asm/arch-omap4/emif.h           |   10 ++-
 arch/arm/include/asm/arch-omap4/mux_omap4.h      |    1 +
 arch/arm/include/asm/arch-omap4/omap4.h          |    9 ++
 arch/arm/include/asm/armv7.h                     |    1 +
 15 files changed, 281 insertions(+), 147 deletions(-)
 rename arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c (76%)
 delete mode 100644 arch/arm/include/asm/arch-omap3/gpio.h

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

* [U-Boot] [PATCH v 1/5] omap4: add omap4460 revision detection
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
@ 2011-07-16 16:25 ` Aneesh V
  2011-07-16 16:25 ` [U-Boot] [PATCH v 2/5] omap4: sdram init changes for omap4460 Aneesh V
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-16 16:25 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Aneesh V <aneesh@ti.com>
---
 arch/arm/cpu/armv7/omap4/board.c        |    3 +++
 arch/arm/include/asm/arch-omap4/omap4.h |    1 +
 arch/arm/include/asm/armv7.h            |    1 +
 3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index 2e5739a..17e731a 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -140,6 +140,9 @@ static void init_omap4_revision(void)
 	case MIDR_CORTEX_A9_R1P3:
 		*omap4_revision = OMAP4430_ES2_3;
 		break;
+	case MIDR_CORTEX_A9_R2P10:
+		*omap4_revision = OMAP4460_ES1_0;
+		break;
 	default:
 		*omap4_revision = OMAP4430_SILICON_ID_INVALID;
 		break;
diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h
index 563544f..7ff46d7 100644
--- a/arch/arm/include/asm/arch-omap4/omap4.h
+++ b/arch/arm/include/asm/arch-omap4/omap4.h
@@ -143,6 +143,7 @@ struct s32ktimer {
 #define OMAP4430_ES2_1	0x44300210
 #define OMAP4430_ES2_2	0x44300220
 #define OMAP4430_ES2_3	0x44300230
+#define OMAP4460_ES1_0	0x44600100
 
 /* ROM code defines */
 /* Boot device */
diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h
index b5784d8..9adc563 100644
--- a/arch/arm/include/asm/armv7.h
+++ b/arch/arm/include/asm/armv7.h
@@ -29,6 +29,7 @@
 #define MIDR_CORTEX_A9_R0P1	0x410FC091
 #define MIDR_CORTEX_A9_R1P2	0x411FC092
 #define MIDR_CORTEX_A9_R1P3	0x411FC093
+#define MIDR_CORTEX_A9_R2P10	0x412FC09A
 
 /* CCSIDR */
 #define CCSIDR_LINE_SIZE_OFFSET		0
-- 
1.7.0.4

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

* [U-Boot] [PATCH v 2/5] omap4: sdram init changes for omap4460
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
  2011-07-16 16:25 ` [U-Boot] [PATCH v 1/5] omap4: add omap4460 revision detection Aneesh V
@ 2011-07-16 16:25 ` Aneesh V
  2011-07-16 16:25 ` [U-Boot] [PATCH v 3/5] omap: reuse omap3 gpio support in omap4 Aneesh V
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-16 16:25 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Aneesh V <aneesh@ti.com>
---
 arch/arm/cpu/armv7/omap4/emif.c        |   39 ++++++++++++++++++--------------
 arch/arm/include/asm/arch-omap4/emif.h |   10 ++++++-
 2 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap4/emif.c b/arch/arm/cpu/armv7/omap4/emif.c
index 1234a7e..487ec42 100644
--- a/arch/arm/cpu/armv7/omap4/emif.c
+++ b/arch/arm/cpu/armv7/omap4/emif.c
@@ -151,22 +151,13 @@ static void emif_update_timings(u32 base, const struct emif_regs *regs)
 	writel(regs->zq_config, &emif->emif_zq_config);
 	writel(regs->temp_alert_config, &emif->emif_temp_alert_config);
 	writel(regs->emif_ddr_phy_ctlr_1, &emif->emif_ddr_phy_ctrl_1_shdw);
-	/*
-	 * Workaround:
-	 * In a specific situation, the OCP interface between the DMM and
-	 * EMIF may hang.
-	 * 1. A TILER port is used to perform 2D burst writes of
-	 *       width 1 and height 8
-	 * 2. ELLAn port is used to perform reads
-	 * 3. All accesses are routed to the same EMIF controller
-	 *
-	 * Work around to avoid this issue REG_SYS_THRESH_MAX value should
-	 * be kept higher than default 0x7. As per recommondation 0x0A will
-	 * be used for better performance with REG_LL_THRESH_MAX = 0x00
-	 */
-	if (omap_revision() == OMAP4430_ES1_0) {
-		writel(EMIF_L3_CONFIG_VAL_SYS_THRESH_0A_LL_THRESH_00,
-		       &emif->emif_l3_config);
+
+	if (omap_revision() >= OMAP4460_ES1_0) {
+		writel(EMIF_L3_CONFIG_VAL_SYS_10_MPU_3_LL_0,
+			&emif->emif_l3_config);
+	} else {
+		writel(EMIF_L3_CONFIG_VAL_SYS_10_LL_0,
+			&emif->emif_l3_config);
 	}
 }
 
@@ -504,7 +495,7 @@ static u32 get_read_idle_ctrl_reg(u8 volt_ramp)
 {
 	u32 idle = 0, val = 0;
 	if (volt_ramp)
-		val = ns_2_cycles(READ_IDLE_INTERVAL_DVFS) / 64 + 1;
+		val = ns_2_cycles(READ_IDLE_INTERVAL_DVFS) / 64 - 1;
 	else
 		/*Maximum value in normal conditions - suggested by hw team */
 		val = 0x1FF;
@@ -1237,6 +1228,20 @@ static void dmm_init(u32 base)
 		&hw_lisa_map_regs->dmm_lisa_map_1);
 	writel(lisa_map_regs->dmm_lisa_map_0,
 		&hw_lisa_map_regs->dmm_lisa_map_0);
+
+	if (omap_revision() >= OMAP4460_ES1_0) {
+		hw_lisa_map_regs =
+		    (struct dmm_lisa_map_regs *)OMAP44XX_MA_LISA_MAP_BASE;
+
+		writel(lisa_map_regs->dmm_lisa_map_3,
+			&hw_lisa_map_regs->dmm_lisa_map_3);
+		writel(lisa_map_regs->dmm_lisa_map_2,
+			&hw_lisa_map_regs->dmm_lisa_map_2);
+		writel(lisa_map_regs->dmm_lisa_map_1,
+			&hw_lisa_map_regs->dmm_lisa_map_1);
+		writel(lisa_map_regs->dmm_lisa_map_0,
+			&hw_lisa_map_regs->dmm_lisa_map_0);
+	}
 }
 
 /*
diff --git a/arch/arm/include/asm/arch-omap4/emif.h b/arch/arm/include/asm/arch-omap4/emif.h
index a167508..37ad1fd 100644
--- a/arch/arm/include/asm/arch-omap4/emif.h
+++ b/arch/arm/include/asm/arch-omap4/emif.h
@@ -248,6 +248,8 @@
 /* OCP_CONFIG */
 #define OMAP44XX_REG_SYS_THRESH_MAX_SHIFT		24
 #define OMAP44XX_REG_SYS_THRESH_MAX_MASK		(0xf << 24)
+#define OMAP44XX_REG_MPU_THRESH_MAX_SHIFT		20
+#define OMAP44XX_REG_MPU_THRESH_MAX_MASK		(0xf << 20)
 #define OMAP44XX_REG_LL_THRESH_MAX_SHIFT		16
 #define OMAP44XX_REG_LL_THRESH_MAX_MASK			(0xf << 16)
 #define OMAP44XX_REG_PR_OLD_COUNT_SHIFT			0
@@ -472,6 +474,9 @@
 /* DMM */
 #define OMAP44XX_DMM_LISA_MAP_BASE	0x4E000040
 
+/* Memory Adapter (4460 onwards) */
+#define OMAP44XX_MA_LISA_MAP_BASE		0x482AF040
+
 /* DMM_LISA_MAP */
 #define OMAP44XX_SYS_ADDR_SHIFT		24
 #define OMAP44XX_SYS_ADDR_MASK		(0xff << 24)
@@ -774,8 +779,9 @@ struct control_lpddr2io_regs {
 	((REG_PD_TIM << OMAP44XX_REG_PD_TIM_SHDW_SHIFT)\
 			& OMAP44XX_REG_PD_TIM_SHDW_MASK))
 
-/* EMIF_L3_CONFIG register value for ES1*/
-#define EMIF_L3_CONFIG_VAL_SYS_THRESH_0A_LL_THRESH_00	0x0A0000FF
+/* EMIF_L3_CONFIG register value */
+#define EMIF_L3_CONFIG_VAL_SYS_10_LL_0	0x0A0000FF
+#define EMIF_L3_CONFIG_VAL_SYS_10_MPU_3_LL_0	0x0A300000
 /*
  * Value of bits 12:31 of DDR_PHY_CTRL_1 register:
  * All these fields have magic values dependent on frequency and
-- 
1.7.0.4

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

* [U-Boot] [PATCH v 3/5] omap: reuse omap3 gpio support in omap4
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
  2011-07-16 16:25 ` [U-Boot] [PATCH v 1/5] omap4: add omap4460 revision detection Aneesh V
  2011-07-16 16:25 ` [U-Boot] [PATCH v 2/5] omap4: sdram init changes for omap4460 Aneesh V
@ 2011-07-16 16:25 ` Aneesh V
  2011-07-16 16:25 ` [U-Boot] [PATCH v 4/5] omap4: support TPS programming Aneesh V
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-16 16:25 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Aneesh V <aneesh@ti.com>
---
 arch/arm/cpu/armv7/omap-common/Makefile          |    1 +
 arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c |   41 ++++------
 arch/arm/cpu/armv7/omap3/Makefile                |    1 -
 arch/arm/cpu/armv7/omap3/board.c                 |   12 +++
 arch/arm/cpu/armv7/omap4/board.c                 |   12 +++
 arch/arm/cpu/armv7/omap4/clocks.c                |    2 +-
 arch/arm/include/asm/arch-omap3/cpu.h            |   26 +++++++
 arch/arm/include/asm/arch-omap3/gpio.h           |   86 ----------------------
 arch/arm/include/asm/arch-omap4/cpu.h            |   26 +++++++
 arch/arm/include/asm/arch-omap4/omap4.h          |    8 ++
 10 files changed, 102 insertions(+), 113 deletions(-)
 rename arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c (76%)
 delete mode 100644 arch/arm/include/asm/arch-omap3/gpio.h

diff --git a/arch/arm/cpu/armv7/omap-common/Makefile b/arch/arm/cpu/armv7/omap-common/Makefile
index 0708796..ea9f8ec 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -29,6 +29,7 @@ SOBJS	:= reset.o
 
 COBJS	:= timer.o
 COBJS	+= utils.o
+COBJS	+= gpio.o
 
 ifdef CONFIG_SPL_BUILD
 COBJS	+= spl.o
diff --git a/arch/arm/cpu/armv7/omap3/gpio.c b/arch/arm/cpu/armv7/omap-common/gpio.c
similarity index 76%
rename from arch/arm/cpu/armv7/omap3/gpio.c
rename to arch/arm/cpu/armv7/omap-common/gpio.c
index aeb6066..f4c3479 100644
--- a/arch/arm/cpu/armv7/omap3/gpio.c
+++ b/arch/arm/cpu/armv7/omap-common/gpio.c
@@ -36,24 +36,13 @@
  * published by the Free Software Foundation.
  */
 #include <common.h>
-#include <asm/arch/gpio.h>
+#include <asm/omap_gpio.h>
 #include <asm/io.h>
 #include <asm/errno.h>
 
-static struct gpio_bank gpio_bank_34xx[6] = {
-	{ (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX },
-};
-
-static struct gpio_bank *gpio_bank = &gpio_bank_34xx[0];
-
-static inline struct gpio_bank *get_gpio_bank(int gpio)
+static inline const struct gpio_bank *get_gpio_bank(int gpio)
 {
-	return &gpio_bank[gpio >> 5];
+	return &omap_gpio_bank[gpio >> 5];
 }
 
 static inline int get_gpio_index(int gpio)
@@ -79,14 +68,15 @@ static int check_gpio(int gpio)
 	return 0;
 }
 
-static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
+static void _set_gpio_direction(const struct gpio_bank *bank, int gpio,
+				int is_input)
 {
 	void *reg = bank->base;
 	u32 l;
 
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
-		reg += OMAP24XX_GPIO_OE;
+		reg += OMAP_GPIO_OE;
 		break;
 	default:
 		return;
@@ -101,7 +91,7 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
 
 void omap_set_gpio_direction(int gpio, int is_input)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
@@ -109,7 +99,8 @@ void omap_set_gpio_direction(int gpio, int is_input)
 	_set_gpio_direction(bank, get_gpio_index(gpio), is_input);
 }
 
-static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
+static void _set_gpio_dataout(const struct gpio_bank *bank, int gpio,
+				int enable)
 {
 	void *reg = bank->base;
 	u32 l = 0;
@@ -117,9 +108,9 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
 		if (enable)
-			reg += OMAP24XX_GPIO_SETDATAOUT;
+			reg += OMAP_GPIO_SETDATAOUT;
 		else
-			reg += OMAP24XX_GPIO_CLEARDATAOUT;
+			reg += OMAP_GPIO_CLEARDATAOUT;
 		l = 1 << gpio;
 		break;
 	default:
@@ -132,7 +123,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
 
 void omap_set_gpio_dataout(int gpio, int enable)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
@@ -142,7 +133,7 @@ void omap_set_gpio_dataout(int gpio, int enable)
 
 int omap_get_gpio_datain(int gpio)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 	void *reg;
 
 	if (check_gpio(gpio) < 0)
@@ -151,7 +142,7 @@ int omap_get_gpio_datain(int gpio)
 	reg = bank->base;
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
-		reg += OMAP24XX_GPIO_DATAIN;
+		reg += OMAP_GPIO_DATAIN;
 		break;
 	default:
 		return -EINVAL;
@@ -160,7 +151,7 @@ int omap_get_gpio_datain(int gpio)
 			& (1 << get_gpio_index(gpio))) != 0;
 }
 
-static void _reset_gpio(struct gpio_bank *bank, int gpio)
+static void _reset_gpio(const struct gpio_bank *bank, int gpio)
 {
 	_set_gpio_direction(bank, get_gpio_index(gpio), 1);
 }
@@ -175,7 +166,7 @@ int omap_request_gpio(int gpio)
 
 void omap_free_gpio(int gpio)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
diff --git a/arch/arm/cpu/armv7/omap3/Makefile b/arch/arm/cpu/armv7/omap3/Makefile
index 522bcd2..8e85891 100644
--- a/arch/arm/cpu/armv7/omap3/Makefile
+++ b/arch/arm/cpu/armv7/omap3/Makefile
@@ -29,7 +29,6 @@ SOBJS	:= lowlevel_init.o
 
 COBJS	+= board.o
 COBJS	+= clock.o
-COBJS	+= gpio.o
 COBJS	+= mem.o
 COBJS	+= sys_info.o
 
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 98519a9..4aaf97b 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -38,12 +38,24 @@
 #include <asm/arch/mem.h>
 #include <asm/cache.h>
 #include <asm/armv7.h>
+#include <asm/omap_gpio.h>
 
 /* Declarations */
 extern omap3_sysinfo sysinfo;
 static void omap3_setup_aux_cr(void);
 static void omap3_invalidate_l2_cache_secure(void);
 
+static const struct gpio_bank gpio_bank_34xx[6] = {
+	{ (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX },
+};
+
+const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;
+
 /******************************************************************************
  * Routine: delay
  * Description: spinning delay to use before udelay works
diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index 17e731a..3c61b1c 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -33,12 +33,24 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/sizes.h>
 #include <asm/arch/emif.h>
+#include <asm/omap_gpio.h>
 #include "omap4_mux_data.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 u32 *const omap4_revision = (u32 *)OMAP4_SRAM_SCRATCH_OMAP4_REV;
 
+static const struct gpio_bank gpio_bank_44xx[6] = {
+	{ (void *)OMAP44XX_GPIO1_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO2_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO3_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO4_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO5_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO6_BASE, METHOD_GPIO_24XX },
+};
+
+const struct gpio_bank *const omap_gpio_bank = gpio_bank_44xx;
+
 #ifdef CONFIG_SPL_BUILD
 /*
  * We use static variables because global data is not ready yet.
diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c
index f1e233a..660b329 100644
--- a/arch/arm/cpu/armv7/omap4/clocks.c
+++ b/arch/arm/cpu/armv7/omap4/clocks.c
@@ -830,9 +830,9 @@ void prcm_init(void)
 	case OMAP_INIT_CONTEXT_SPL:
 	case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR:
 	case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH:
+		enable_basic_clocks();
 		scale_vcores();
 		setup_dplls();
-		enable_basic_clocks();
 		setup_non_essential_dplls();
 		enable_non_essential_clocks();
 		break;
diff --git a/arch/arm/include/asm/arch-omap3/cpu.h b/arch/arm/include/asm/arch-omap3/cpu.h
index e944de7..08a725d 100644
--- a/arch/arm/include/asm/arch-omap3/cpu.h
+++ b/arch/arm/include/asm/arch-omap3/cpu.h
@@ -498,4 +498,30 @@ struct pm {
 /* MUSB base */
 #define MUSB_BASE		(OMAP34XX_CORE_L4_IO_BASE + 0xAB000)
 
+/* OMAP3 GPIO registers */
+#define OMAP_GPIO_REVISION		0x0000
+#define OMAP_GPIO_SYSCONFIG		0x0010
+#define OMAP_GPIO_SYSSTATUS		0x0014
+#define OMAP_GPIO_IRQSTATUS1		0x0018
+#define OMAP_GPIO_IRQSTATUS2		0x0028
+#define OMAP_GPIO_IRQENABLE2		0x002c
+#define OMAP_GPIO_IRQENABLE1		0x001c
+#define OMAP_GPIO_WAKE_EN		0x0020
+#define OMAP_GPIO_CTRL			0x0030
+#define OMAP_GPIO_OE			0x0034
+#define OMAP_GPIO_DATAIN		0x0038
+#define OMAP_GPIO_DATAOUT		0x003c
+#define OMAP_GPIO_LEVELDETECT0		0x0040
+#define OMAP_GPIO_LEVELDETECT1		0x0044
+#define OMAP_GPIO_RISINGDETECT		0x0048
+#define OMAP_GPIO_FALLINGDETECT		0x004c
+#define OMAP_GPIO_DEBOUNCE_EN		0x0050
+#define OMAP_GPIO_DEBOUNCE_VAL		0x0054
+#define OMAP_GPIO_CLEARIRQENABLE1	0x0060
+#define OMAP_GPIO_SETIRQENABLE1		0x0064
+#define OMAP_GPIO_CLEARWKUENA		0x0080
+#define OMAP_GPIO_SETWKUENA		0x0084
+#define OMAP_GPIO_CLEARDATAOUT		0x0090
+#define OMAP_GPIO_SETDATAOUT		0x0094
+
 #endif /* _CPU_H */
diff --git a/arch/arm/include/asm/arch-omap3/gpio.h b/arch/arm/include/asm/arch-omap3/gpio.h
deleted file mode 100644
index 30f633c..0000000
--- a/arch/arm/include/asm/arch-omap3/gpio.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2009 Wind River Systems, Inc.
- * Tom Rix <Tom.Rix@windriver.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- * This work is derived from the linux 2.6.27 kernel source
- * To fetch, use the kernel repository
- * git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
- * Use the v2.6.27 tag.
- *
- * Below is the original's header including its copyright
- *
- *  linux/arch/arm/plat-omap/gpio.c
- *
- * Support functions for OMAP GPIO
- *
- * Copyright (C) 2003-2005 Nokia Corporation
- * Written by Juha Yrj??l?? <juha.yrjola@nokia.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef _GPIO_H
-#define _GPIO_H
-
-#define OMAP24XX_GPIO_REVISION		0x0000
-#define OMAP24XX_GPIO_SYSCONFIG		0x0010
-#define OMAP24XX_GPIO_SYSSTATUS		0x0014
-#define OMAP24XX_GPIO_IRQSTATUS1	0x0018
-#define OMAP24XX_GPIO_IRQSTATUS2	0x0028
-#define OMAP24XX_GPIO_IRQENABLE2	0x002c
-#define OMAP24XX_GPIO_IRQENABLE1	0x001c
-#define OMAP24XX_GPIO_WAKE_EN		0x0020
-#define OMAP24XX_GPIO_CTRL		0x0030
-#define OMAP24XX_GPIO_OE		0x0034
-#define OMAP24XX_GPIO_DATAIN		0x0038
-#define OMAP24XX_GPIO_DATAOUT		0x003c
-#define OMAP24XX_GPIO_LEVELDETECT0	0x0040
-#define OMAP24XX_GPIO_LEVELDETECT1	0x0044
-#define OMAP24XX_GPIO_RISINGDETECT	0x0048
-#define OMAP24XX_GPIO_FALLINGDETECT	0x004c
-#define OMAP24XX_GPIO_DEBOUNCE_EN	0x0050
-#define OMAP24XX_GPIO_DEBOUNCE_VAL	0x0054
-#define OMAP24XX_GPIO_CLEARIRQENABLE1	0x0060
-#define OMAP24XX_GPIO_SETIRQENABLE1	0x0064
-#define OMAP24XX_GPIO_CLEARWKUENA	0x0080
-#define OMAP24XX_GPIO_SETWKUENA		0x0084
-#define OMAP24XX_GPIO_CLEARDATAOUT	0x0090
-#define OMAP24XX_GPIO_SETDATAOUT	0x0094
-
-struct gpio_bank {
-	void *base;
-	int method;
-};
-
-#define METHOD_GPIO_24XX	4
-
-/* This is the interface */
-
-/* Request a gpio before using it */
-int omap_request_gpio(int gpio);
-/* Reset and free a gpio after using it */
-void omap_free_gpio(int gpio);
-/* Sets the gpio as input or output */
-void omap_set_gpio_direction(int gpio, int is_input);
-/* Set or clear a gpio output */
-void omap_set_gpio_dataout(int gpio, int enable);
-/* Get the value of a gpio input */
-int omap_get_gpio_datain(int gpio);
-
-#endif /* _GPIO_H_ */
diff --git a/arch/arm/include/asm/arch-omap4/cpu.h b/arch/arm/include/asm/arch-omap4/cpu.h
index 7d5748a..08b9c99 100644
--- a/arch/arm/include/asm/arch-omap4/cpu.h
+++ b/arch/arm/include/asm/arch-omap4/cpu.h
@@ -142,4 +142,30 @@ struct watchdog {
 /* MUSB base */
 #define MUSB_BASE		(OMAP44XX_L4_CORE_BASE + 0xAB000)
 
+/* OMAP4 GPIO registers */
+#define OMAP_GPIO_REVISION		0x0000
+#define OMAP_GPIO_SYSCONFIG		0x0010
+#define OMAP_GPIO_SYSSTATUS		0x0114
+#define OMAP_GPIO_IRQSTATUS1		0x0118
+#define OMAP_GPIO_IRQSTATUS2		0x0128
+#define OMAP_GPIO_IRQENABLE2		0x012c
+#define OMAP_GPIO_IRQENABLE1		0x011c
+#define OMAP_GPIO_WAKE_EN		0x0120
+#define OMAP_GPIO_CTRL			0x0130
+#define OMAP_GPIO_OE			0x0134
+#define OMAP_GPIO_DATAIN		0x0138
+#define OMAP_GPIO_DATAOUT		0x013c
+#define OMAP_GPIO_LEVELDETECT0		0x0140
+#define OMAP_GPIO_LEVELDETECT1		0x0144
+#define OMAP_GPIO_RISINGDETECT		0x0148
+#define OMAP_GPIO_FALLINGDETECT		0x014c
+#define OMAP_GPIO_DEBOUNCE_EN		0x0150
+#define OMAP_GPIO_DEBOUNCE_VAL		0x0154
+#define OMAP_GPIO_CLEARIRQENABLE1	0x0160
+#define OMAP_GPIO_SETIRQENABLE1		0x0164
+#define OMAP_GPIO_CLEARWKUENA		0x0180
+#define OMAP_GPIO_SETWKUENA		0x0184
+#define OMAP_GPIO_CLEARDATAOUT		0x0190
+#define OMAP_GPIO_SETDATAOUT		0x0194
+
 #endif /* _CPU_H */
diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h
index 7ff46d7..9aad0e6 100644
--- a/arch/arm/include/asm/arch-omap4/omap4.h
+++ b/arch/arm/include/asm/arch-omap4/omap4.h
@@ -153,4 +153,12 @@ struct s32ktimer {
 #define DEV_DATA_PTR_OFFSET	0x18
 #define BOOT_MODE_OFFSET	0x8
 
+/* GPIO */
+#define OMAP44XX_GPIO1_BASE		0x4A310000
+#define OMAP44XX_GPIO2_BASE		0x48055000
+#define OMAP44XX_GPIO3_BASE		0x48057000
+#define OMAP44XX_GPIO4_BASE		0x48059000
+#define OMAP44XX_GPIO5_BASE		0x4805B000
+#define OMAP44XX_GPIO6_BASE		0x4805D000
+
 #endif
-- 
1.7.0.4

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

* [U-Boot] [PATCH v 4/5] omap4: support TPS programming
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
                   ` (2 preceding siblings ...)
  2011-07-16 16:25 ` [U-Boot] [PATCH v 3/5] omap: reuse omap3 gpio support in omap4 Aneesh V
@ 2011-07-16 16:25 ` Aneesh V
  2011-07-16 16:25 ` [U-Boot] [PATCH v 5/5] omap4: clock init support for omap4460 Aneesh V
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-16 16:25 UTC (permalink / raw)
  To: u-boot

TPS62361 is the new power supply used in OMAP4460 that
supplies vdd_mpu.

VCORE1 from Phoenix supplies vdd_core and VCORE2 supplies
vdd_iva. VCORE3 is not used in OMAP4460.

Signed-off-by: Aneesh V <aneesh@ti.com>
---
 arch/arm/cpu/armv7/omap4/board.c            |    4 ++
 arch/arm/cpu/armv7/omap4/clocks.c           |   65 ++++++++++++++++++++++++---
 arch/arm/include/asm/arch-omap4/clocks.h    |   16 +++++++
 arch/arm/include/asm/arch-omap4/mux_omap4.h |    1 +
 4 files changed, 79 insertions(+), 7 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index 3c61b1c..5943d61 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -90,6 +90,10 @@ static void set_muxconf_regs_essential(void)
 	do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_essential,
 		   sizeof(wkup_padconf_array_essential) /
 		   sizeof(struct pad_conf_entry));
+
+	/* gpio_wk7 is used for controlling TPS on 4460 */
+	if (omap_revision() >= OMAP4460_ES1_0)
+		writew(M3, CONTROL_WKUP_PAD1_FREF_CLK4_REQ);
 }
 
 static void set_mux_conf_regs(void)
diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c
index 660b329..0db9d18 100644
--- a/arch/arm/cpu/armv7/omap4/clocks.c
+++ b/arch/arm/cpu/armv7/omap4/clocks.c
@@ -34,6 +34,7 @@
 #include <asm/arch/clocks.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/utils.h>
+#include <asm/omap_gpio.h>
 
 #ifndef CONFIG_SPL_BUILD
 /*
@@ -421,6 +422,34 @@ static void setup_non_essential_dplls(void)
 	do_setup_dpll(&prcm->cm_clkmode_dpll_abe, params, DPLL_LOCK);
 }
 
+static void do_scale_tps62361(u32 reg, u32 volt_mv)
+{
+	u32 temp, step;
+
+	step = volt_mv - TPS62361_BASE_VOLT_MV;
+	step /= 10;
+
+	/*
+	 * Select SET1 in TPS62361:
+	 * VSEL1 is grounded on board. So the following selects
+	 * VSEL1 = 0 and VSEL0 = 1
+	 */
+	omap_set_gpio_direction(TPS62361_VSEL0_GPIO, 0);
+	omap_set_gpio_dataout(TPS62361_VSEL0_GPIO, 1);
+
+	temp = TPS62361_I2C_SLAVE_ADDR |
+	    (reg << PRM_VC_VAL_BYPASS_REGADDR_SHIFT) |
+	    (step << PRM_VC_VAL_BYPASS_DATA_SHIFT) |
+	    PRM_VC_VAL_BYPASS_VALID_BIT;
+	debug("do_scale_tps62361: volt - %d step - 0x%x\n", volt_mv, step);
+
+	writel(temp, &prcm->prm_vc_val_bypass);
+	if (!wait_on_value(PRM_VC_VAL_BYPASS_VALID_BIT, 0,
+				&prcm->prm_vc_val_bypass, LDELAY)) {
+		puts("Scaling voltage failed for vdd_mpu from TPS\n");
+	}
+}
+
 static void do_scale_vcore(u32 vcore_reg, u32 volt_mv)
 {
 	u32 temp, offset_code;
@@ -461,7 +490,7 @@ static void do_scale_vcore(u32 vcore_reg, u32 volt_mv)
  */
 static void scale_vcores(void)
 {
-	u32 volt, sys_clk_khz, cycles_hi, cycles_low, temp;
+	u32 volt, sys_clk_khz, cycles_hi, cycles_low, temp, omap4_rev;
 
 	sys_clk_khz = get_sys_clk_freq() / 1000;
 
@@ -481,23 +510,45 @@ static void scale_vcores(void)
 	/* Disable high speed mode and all advanced features */
 	writel(0x0, &prcm->prm_vc_cfg_i2c_mode);
 
+	omap4_rev = omap_revision();
+	/* TPS - supplies vdd_mpu on 4460 */
+	if (omap4_rev >= OMAP4460_ES1_0) {
+		volt = 1430;
+		do_scale_tps62361(TPS62361_REG_ADDR_SET1, volt);
+	}
+
 	/*
-	 * VCORE 1 - 4430 : supplies vdd_mpu
+	 * VCORE 1
+	 *
+	 * 4430 : supplies vdd_mpu
 	 * Setting a high voltage for Nitro mode as smart reflex is not enabled.
 	 * We use the maximum possible value in the AVS range because the next
 	 * higher voltage in the discrete range (code >= 0b111010) is way too
 	 * high
+	 *
+	 * 4460 : supplies vdd_core
 	 */
-	volt = 1417;
-	do_scale_vcore(SMPS_REG_ADDR_VCORE1, volt);
+	if (omap4_rev < OMAP4460_ES1_0) {
+		volt = 1417;
+		do_scale_vcore(SMPS_REG_ADDR_VCORE1, volt);
+	} else {
+		volt = 1200;
+		do_scale_vcore(SMPS_REG_ADDR_VCORE1, volt);
+	}
 
 	/* VCORE 2 - supplies vdd_iva */
 	volt = 1200;
 	do_scale_vcore(SMPS_REG_ADDR_VCORE2, volt);
 
-	/* VCORE 3 - supplies vdd_core */
-	volt = 1200;
-	do_scale_vcore(SMPS_REG_ADDR_VCORE3, volt);
+	/*
+	 * VCORE 3
+	 * 4430 : supplies vdd_core
+	 * 4460 : not connected
+	 */
+	if (omap4_rev < OMAP4460_ES1_0) {
+		volt = 1200;
+		do_scale_vcore(SMPS_REG_ADDR_VCORE3, volt);
+	}
 }
 
 static inline void enable_clock_domain(u32 *const clkctrl_reg, u32 enable_mode)
diff --git a/arch/arm/include/asm/arch-omap4/clocks.h b/arch/arm/include/asm/arch-omap4/clocks.h
index 37bdcee..5d9cb50 100644
--- a/arch/arm/include/asm/arch-omap4/clocks.h
+++ b/arch/arm/include/asm/arch-omap4/clocks.h
@@ -618,6 +618,7 @@ struct omap4_prcm_regs {
 #define PRM_VC_VAL_BYPASS_DATA_SHIFT		16
 #define PRM_VC_VAL_BYPASS_DATA_MASK		0xFF
 
+/* SMPS */
 #define SMPS_I2C_SLAVE_ADDR	0x12
 #define SMPS_REG_ADDR_VCORE1	0x55
 #define SMPS_REG_ADDR_VCORE2	0x5B
@@ -626,6 +627,21 @@ struct omap4_prcm_regs {
 #define PHOENIX_SMPS_BASE_VOLT_STD_MODE_UV		607700
 #define PHOENIX_SMPS_BASE_VOLT_STD_MODE_WITH_OFFSET_UV	709000
 
+/* TPS */
+#define TPS62361_I2C_SLAVE_ADDR		0x60
+#define TPS62361_REG_ADDR_SET0		0x0
+#define TPS62361_REG_ADDR_SET1		0x1
+#define TPS62361_REG_ADDR_SET2		0x2
+#define TPS62361_REG_ADDR_SET3		0x3
+#define TPS62361_REG_ADDR_CTRL		0x4
+#define TPS62361_REG_ADDR_TEMP		0x5
+#define TPS62361_REG_ADDR_RMP_CTRL	0x6
+#define TPS62361_REG_ADDR_CHIP_ID	0x8
+#define TPS62361_REG_ADDR_CHIP_ID_2	0x9
+
+#define TPS62361_BASE_VOLT_MV	500
+#define TPS62361_VSEL0_GPIO	7
+
 /* Defines for DPLL setup */
 #define DPLL_LOCKED_FREQ_TOLERANCE_0		0
 #define DPLL_LOCKED_FREQ_TOLERANCE_500_KHZ	500
diff --git a/arch/arm/include/asm/arch-omap4/mux_omap4.h b/arch/arm/include/asm/arch-omap4/mux_omap4.h
index 019574b..30bfad7 100644
--- a/arch/arm/include/asm/arch-omap4/mux_omap4.h
+++ b/arch/arm/include/asm/arch-omap4/mux_omap4.h
@@ -341,4 +341,5 @@ struct pad_conf_entry {
 #define CONTROL_SPARE_R		0x0618
 #define CONTROL_SPARE_R_C0		0x061C
 
+#define CONTROL_WKUP_PAD1_FREF_CLK4_REQ	0x4A31E05A
 #endif /* _MUX_OMAP4_H_ */
-- 
1.7.0.4

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

* [U-Boot] [PATCH v 5/5] omap4: clock init support for omap4460
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
                   ` (3 preceding siblings ...)
  2011-07-16 16:25 ` [U-Boot] [PATCH v 4/5] omap4: support TPS programming Aneesh V
@ 2011-07-16 16:25 ` Aneesh V
  2011-07-17  9:05 ` [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Albert ARIBAUD
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-16 16:25 UTC (permalink / raw)
  To: u-boot

---
 arch/arm/cpu/armv7/omap4/clocks.c        |   61 ++++++++++++++++++++++++++---
 arch/arm/include/asm/arch-omap4/clocks.h |   12 +++++-
 2 files changed, 65 insertions(+), 8 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c
index 0db9d18..eda960c 100644
--- a/arch/arm/cpu/armv7/omap4/clocks.c
+++ b/arch/arm/cpu/armv7/omap4/clocks.c
@@ -66,7 +66,18 @@ static const u32 sys_clk_array[8] = {
  * Please use this tool for creating the table for any new frequency.
  */
 
-/* dpll locked at 1584 MHz - MPU clk at 792 MHz(OPP Turbo) */
+/* dpll locked at 1840 MHz MPU clk at 920 MHz(OPP Turbo 4460) - DCC OFF */
+static const struct dpll_params mpu_dpll_params_1840mhz[NUM_SYS_CLKS] = {
+	{230, 2, 1, -1, -1, -1, -1, -1},	/* 12 MHz   */
+	{920, 12, 1, -1, -1, -1, -1, -1},	/* 13 MHz   */
+	{219, 3, 1, -1, -1, -1, -1, -1},	/* 16.8 MHz */
+	{575, 11, 1, -1, -1, -1, -1, -1},	/* 19.2 MHz */
+	{460, 12, 1, -1, -1, -1, -1, -1},	/* 26 MHz   */
+	{920, 26, 1, -1, -1, -1, -1, -1},	/* 27 MHz   */
+	{575, 23, 1, -1, -1, -1, -1, -1}	/* 38.4 MHz */
+};
+
+/* dpll locked at 1584 MHz - MPU clk at 792 MHz(OPP Turbo 4430) */
 static const struct dpll_params mpu_dpll_params_1584mhz[NUM_SYS_CLKS] = {
 	{66, 0, 1, -1, -1, -1, -1, -1},		/* 12 MHz   */
 	{792, 12, 1, -1, -1, -1, -1, -1},	/* 13 MHz   */
@@ -320,6 +331,47 @@ u32 omap4_ddr_clk(void)
 	return ddr_clk;
 }
 
+/*
+ * Lock MPU dpll
+ *
+ * Resulting MPU frequencies:
+ * 4430 ES1.0	: 600 MHz
+ * 4430 ES2.x	: 792 MHz (OPP Turbo)
+ * 4460		: 920 MHz (OPP Turbo) - DCC disabled
+ */
+void configure_mpu_dpll(void)
+{
+	const struct dpll_params *params;
+	struct dpll_regs *mpu_dpll_regs;
+	u32 omap4_rev, sysclk_ind;
+
+	omap4_rev = omap_revision();
+	sysclk_ind = get_sys_clk_index();
+
+	if (omap4_rev == OMAP4430_ES1_0)
+		params = &mpu_dpll_params_1200mhz[sysclk_ind];
+	else if (omap4_rev < OMAP4460_ES1_0)
+		params = &mpu_dpll_params_1584mhz[sysclk_ind];
+	else
+		params = &mpu_dpll_params_1840mhz[sysclk_ind];
+
+	/* DCC and clock divider settings for 4460 */
+	if (omap4_rev >= OMAP4460_ES1_0) {
+		mpu_dpll_regs =
+			(struct dpll_regs *)&prcm->cm_clkmode_dpll_mpu;
+		bypass_dpll(&prcm->cm_clkmode_dpll_mpu);
+		clrbits_le32(&prcm->cm_mpu_mpu_clkctrl,
+			MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK);
+		setbits_le32(&prcm->cm_mpu_mpu_clkctrl,
+			MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_MASK);
+		clrbits_le32(&mpu_dpll_regs->cm_clksel_dpll,
+			CM_CLKSEL_DCC_EN_MASK);
+	}
+
+	do_setup_dpll(&prcm->cm_clkmode_dpll_mpu, params, DPLL_LOCK);
+	debug("MPU DPLL locked\n");
+}
+
 static void setup_dplls(void)
 {
 	u32 sysclk_ind, temp;
@@ -349,12 +401,7 @@ static void setup_dplls(void)
 	debug("PER DPLL locked\n");
 
 	/* MPU dpll */
-	if (omap_revision() == OMAP4430_ES1_0)
-		params = &mpu_dpll_params_1200mhz[sysclk_ind];
-	else
-		params = &mpu_dpll_params_1584mhz[sysclk_ind];
-	do_setup_dpll(&prcm->cm_clkmode_dpll_mpu, params, DPLL_LOCK);
-	debug("MPU DPLL locked\n");
+	configure_mpu_dpll();
 }
 
 static void setup_non_essential_dplls(void)
diff --git a/arch/arm/include/asm/arch-omap4/clocks.h b/arch/arm/include/asm/arch-omap4/clocks.h
index 5d9cb50..374e064 100644
--- a/arch/arm/include/asm/arch-omap4/clocks.h
+++ b/arch/arm/include/asm/arch-omap4/clocks.h
@@ -105,9 +105,11 @@ struct omap4_prcm_regs {
 	u32 cm_ssc_deltamstep_dpll_ddrphy;
 	u32 pad014[5];
 	u32 cm_shadow_freq_config1;
+	u32 pad0141[47];
+	u32 cm_mpu_mpu_clkctrl;
 
 	/* cm1.dsp */
-	u32 pad015[103];
+	u32 pad015[55];
 	u32 cm_dsp_clkstctrl;
 	u32 pad016[7];
 	u32 cm_dsp_dsp_clkctrl;
@@ -515,6 +517,8 @@ struct omap4_prcm_regs {
 #define CM_CLKSEL_DPLL_M_MASK			(0x7FF << 8)
 #define CM_CLKSEL_DPLL_N_SHIFT			0
 #define CM_CLKSEL_DPLL_N_MASK			0x7F
+#define CM_CLKSEL_DCC_EN_SHIFT			22
+#define CM_CLKSEL_DCC_EN_MASK			(1 << 22)
 
 #define OMAP4_DPLL_MAX_N	127
 
@@ -596,6 +600,12 @@ struct omap4_prcm_regs {
 /* CM_L3INIT_USBPHY_CLKCTRL */
 #define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK	8
 
+/* CM_MPU_MPU_CLKCTRL */
+#define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_SHIFT	24
+#define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK	(1 << 24)
+#define MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_SHIFT	25
+#define MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_MASK	(1 << 25)
+
 /* Clock frequencies */
 #define OMAP_SYS_CLK_FREQ_38_4_MHZ	38400000
 #define OMAP_SYS_CLK_IND_38_4_MHZ	6
-- 
1.7.0.4

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

* [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
                   ` (4 preceding siblings ...)
  2011-07-16 16:25 ` [U-Boot] [PATCH v 5/5] omap4: clock init support for omap4460 Aneesh V
@ 2011-07-17  9:05 ` Albert ARIBAUD
  2011-07-18  9:21   ` Aneesh V
  2011-07-18 13:32 ` Aneesh V
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 26+ messages in thread
From: Albert ARIBAUD @ 2011-07-17  9:05 UTC (permalink / raw)
  To: u-boot

Hi Aneesh,

Le 16/07/2011 18:25, Aneesh V a ?crit :
> OMAP4460 is the latest addition to the OMAP4 family.
> OMAP4460 has dual core Cortex-A9 CPUs that can be clocked upto
> 1.5 GHz
>
> The memory architecture has been improved to provide better
> performance and there several other minor improvements in various
> modules.

Hmm... What's this 'v' doing in the patch subjects?

Amicalement,
-- 
Albert.

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

* [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support
  2011-07-17  9:05 ` [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Albert ARIBAUD
@ 2011-07-18  9:21   ` Aneesh V
  0 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-18  9:21 UTC (permalink / raw)
  To: u-boot

Hi Albert,

On Sun, Jul 17, 2011 at 2:35 PM, Albert ARIBAUD 
<albert.u.boot@aribaud.net> wrote:
> Hi Aneesh,
>
> Le 16/07/2011 18:25, Aneesh V a ?crit :
>>
>> OMAP4460 is the latest addition to the OMAP4 family.
>> OMAP4460 has dual core Cortex-A9 CPUs that can be clocked upto
>> 1.5 GHz
>>
>> The memory architecture has been improved to provide better
>> performance and there several other minor improvements in various
>> modules.
>
> Hmm... What's this 'v' doing in the patch subjects?

Oops! That is a script mishap. I have a couple of convenience scripts
(wrappers over git format-patch). Used the wrong one here. I didn't
notice it until now.

best regards,
Aneesh

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

* [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
                   ` (5 preceding siblings ...)
  2011-07-17  9:05 ` [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Albert ARIBAUD
@ 2011-07-18 13:32 ` Aneesh V
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 " Aneesh V
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-18 13:32 UTC (permalink / raw)
  To: u-boot

On Saturday 16 July 2011 09:55 PM, Aneesh V wrote:
> OMAP4460 is the latest addition to the OMAP4 family.
> OMAP4460 has dual core Cortex-A9 CPUs that can be clocked upto
> 1.5 GHz
>
> The memory architecture has been improved to provide better
> performance and there several other minor improvements in various
> modules.

Forgot to mention that this series depends on the OMAP4 spl series [1]
and the SPL framework series [2]

[1] http://marc.info/?l=u-boot&m=131082102506002&w=2
[2] http://marc.info/?l=u-boot&m=131056990001719&w=2

br,
Aneesh

>
> Aneesh V (5):
>    omap4: add omap4460 revision detection
>    omap4: sdram init changes for omap4460
>    omap: reuse omap3 gpio support in omap4
>    omap4: support TPS programming
>    omap4: clock init support for omap4460
>
>   arch/arm/cpu/armv7/omap-common/Makefile          |    1 +
>   arch/arm/cpu/armv7/{omap3 =>  omap-common}/gpio.c |   41 +++----
>   arch/arm/cpu/armv7/omap3/Makefile                |    1 -
>   arch/arm/cpu/armv7/omap3/board.c                 |   12 ++
>   arch/arm/cpu/armv7/omap4/board.c                 |   19 +++
>   arch/arm/cpu/armv7/omap4/clocks.c                |  128 +++++++++++++++++++---
>   arch/arm/cpu/armv7/omap4/emif.c                  |   39 ++++---
>   arch/arm/include/asm/arch-omap3/cpu.h            |   26 +++++
>   arch/arm/include/asm/arch-omap3/gpio.h           |   86 ---------------
>   arch/arm/include/asm/arch-omap4/clocks.h         |   28 +++++-
>   arch/arm/include/asm/arch-omap4/cpu.h            |   26 +++++
>   arch/arm/include/asm/arch-omap4/emif.h           |   10 ++-
>   arch/arm/include/asm/arch-omap4/mux_omap4.h      |    1 +
>   arch/arm/include/asm/arch-omap4/omap4.h          |    9 ++
>   arch/arm/include/asm/armv7.h                     |    1 +
>   15 files changed, 281 insertions(+), 147 deletions(-)
>   rename arch/arm/cpu/armv7/{omap3 =>  omap-common}/gpio.c (76%)
>   delete mode 100644 arch/arm/include/asm/arch-omap3/gpio.h
>

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

* [U-Boot] [PATCH v2 0/5] arm: omap4: omap4460 support
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
                   ` (6 preceding siblings ...)
  2011-07-18 13:32 ` Aneesh V
@ 2011-07-20 10:55 ` Aneesh V
  2011-07-20 15:43   ` Paulraj, Sandeep
  2011-07-20 20:58   ` Paulraj, Sandeep
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 1/5] omap4: add omap4460 revision detection Aneesh V
                   ` (4 subsequent siblings)
  12 siblings, 2 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-20 10:55 UTC (permalink / raw)
  To: u-boot

OMAP4460 is the latest addition to the OMAP4 family.
OMAP4460 has dual core Cortex-A9 CPUs that can be clocked upto
1.5 GHz

The memory architecture has been improved to provide better
performance and there several other minor improvements in various
modules.

This series depends on the OMAP4 spl series [1] and the SPL framework
series [2]

[1] http://marc.info/?l=u-boot&m=131082102506002&w=2
[2] http://marc.info/?l=u-boot&m=131056990001719&w=2

Changes in V2:
* Added missing file in the patch 3/5
* Corrected subject lines of patches

Aneesh V (5):
  omap4: add omap4460 revision detection
  omap4: sdram init changes for omap4460
  omap: reuse omap3 gpio support in omap4
  omap4: support TPS programming
  omap4: clock init support for omap4460

 arch/arm/cpu/armv7/omap-common/Makefile            |    1 +
 arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c   |   41 +++----
 arch/arm/cpu/armv7/omap3/Makefile                  |    1 -
 arch/arm/cpu/armv7/omap3/board.c                   |   12 ++
 arch/arm/cpu/armv7/omap4/board.c                   |   19 +++
 arch/arm/cpu/armv7/omap4/clocks.c                  |  128 +++++++++++++++++---
 arch/arm/cpu/armv7/omap4/emif.c                    |   39 ++++---
 arch/arm/include/asm/arch-omap3/cpu.h              |   26 ++++
 arch/arm/include/asm/arch-omap4/clocks.h           |   28 ++++-
 arch/arm/include/asm/arch-omap4/cpu.h              |   26 ++++
 arch/arm/include/asm/arch-omap4/emif.h             |   10 ++-
 arch/arm/include/asm/arch-omap4/mux_omap4.h        |    1 +
 arch/arm/include/asm/arch-omap4/omap4.h            |    9 ++
 arch/arm/include/asm/armv7.h                       |    1 +
 .../include/asm/{arch-omap3/gpio.h => omap_gpio.h} |   27 +----
 15 files changed, 284 insertions(+), 85 deletions(-)
 rename arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c (76%)
 rename arch/arm/include/asm/{arch-omap3/gpio.h => omap_gpio.h} (67%)

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

* [U-Boot] [PATCH v2 1/5] omap4: add omap4460 revision detection
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
                   ` (7 preceding siblings ...)
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 " Aneesh V
@ 2011-07-20 10:55 ` Aneesh V
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 2/5] omap4: sdram init changes for omap4460 Aneesh V
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-20 10:55 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Aneesh V <aneesh@ti.com>
---
 arch/arm/cpu/armv7/omap4/board.c        |    3 +++
 arch/arm/include/asm/arch-omap4/omap4.h |    1 +
 arch/arm/include/asm/armv7.h            |    1 +
 3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index 2e5739a..17e731a 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -140,6 +140,9 @@ static void init_omap4_revision(void)
 	case MIDR_CORTEX_A9_R1P3:
 		*omap4_revision = OMAP4430_ES2_3;
 		break;
+	case MIDR_CORTEX_A9_R2P10:
+		*omap4_revision = OMAP4460_ES1_0;
+		break;
 	default:
 		*omap4_revision = OMAP4430_SILICON_ID_INVALID;
 		break;
diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h
index 563544f..7ff46d7 100644
--- a/arch/arm/include/asm/arch-omap4/omap4.h
+++ b/arch/arm/include/asm/arch-omap4/omap4.h
@@ -143,6 +143,7 @@ struct s32ktimer {
 #define OMAP4430_ES2_1	0x44300210
 #define OMAP4430_ES2_2	0x44300220
 #define OMAP4430_ES2_3	0x44300230
+#define OMAP4460_ES1_0	0x44600100
 
 /* ROM code defines */
 /* Boot device */
diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h
index b5784d8..9adc563 100644
--- a/arch/arm/include/asm/armv7.h
+++ b/arch/arm/include/asm/armv7.h
@@ -29,6 +29,7 @@
 #define MIDR_CORTEX_A9_R0P1	0x410FC091
 #define MIDR_CORTEX_A9_R1P2	0x411FC092
 #define MIDR_CORTEX_A9_R1P3	0x411FC093
+#define MIDR_CORTEX_A9_R2P10	0x412FC09A
 
 /* CCSIDR */
 #define CCSIDR_LINE_SIZE_OFFSET		0
-- 
1.7.0.4

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

* [U-Boot] [PATCH v2 2/5] omap4: sdram init changes for omap4460
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
                   ` (8 preceding siblings ...)
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 1/5] omap4: add omap4460 revision detection Aneesh V
@ 2011-07-20 10:55 ` Aneesh V
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 3/5] omap: reuse omap3 gpio support in omap4 Aneesh V
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-20 10:55 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Aneesh V <aneesh@ti.com>
---
 arch/arm/cpu/armv7/omap4/emif.c        |   39 ++++++++++++++++++--------------
 arch/arm/include/asm/arch-omap4/emif.h |   10 ++++++-
 2 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap4/emif.c b/arch/arm/cpu/armv7/omap4/emif.c
index 1234a7e..487ec42 100644
--- a/arch/arm/cpu/armv7/omap4/emif.c
+++ b/arch/arm/cpu/armv7/omap4/emif.c
@@ -151,22 +151,13 @@ static void emif_update_timings(u32 base, const struct emif_regs *regs)
 	writel(regs->zq_config, &emif->emif_zq_config);
 	writel(regs->temp_alert_config, &emif->emif_temp_alert_config);
 	writel(regs->emif_ddr_phy_ctlr_1, &emif->emif_ddr_phy_ctrl_1_shdw);
-	/*
-	 * Workaround:
-	 * In a specific situation, the OCP interface between the DMM and
-	 * EMIF may hang.
-	 * 1. A TILER port is used to perform 2D burst writes of
-	 *       width 1 and height 8
-	 * 2. ELLAn port is used to perform reads
-	 * 3. All accesses are routed to the same EMIF controller
-	 *
-	 * Work around to avoid this issue REG_SYS_THRESH_MAX value should
-	 * be kept higher than default 0x7. As per recommondation 0x0A will
-	 * be used for better performance with REG_LL_THRESH_MAX = 0x00
-	 */
-	if (omap_revision() == OMAP4430_ES1_0) {
-		writel(EMIF_L3_CONFIG_VAL_SYS_THRESH_0A_LL_THRESH_00,
-		       &emif->emif_l3_config);
+
+	if (omap_revision() >= OMAP4460_ES1_0) {
+		writel(EMIF_L3_CONFIG_VAL_SYS_10_MPU_3_LL_0,
+			&emif->emif_l3_config);
+	} else {
+		writel(EMIF_L3_CONFIG_VAL_SYS_10_LL_0,
+			&emif->emif_l3_config);
 	}
 }
 
@@ -504,7 +495,7 @@ static u32 get_read_idle_ctrl_reg(u8 volt_ramp)
 {
 	u32 idle = 0, val = 0;
 	if (volt_ramp)
-		val = ns_2_cycles(READ_IDLE_INTERVAL_DVFS) / 64 + 1;
+		val = ns_2_cycles(READ_IDLE_INTERVAL_DVFS) / 64 - 1;
 	else
 		/*Maximum value in normal conditions - suggested by hw team */
 		val = 0x1FF;
@@ -1237,6 +1228,20 @@ static void dmm_init(u32 base)
 		&hw_lisa_map_regs->dmm_lisa_map_1);
 	writel(lisa_map_regs->dmm_lisa_map_0,
 		&hw_lisa_map_regs->dmm_lisa_map_0);
+
+	if (omap_revision() >= OMAP4460_ES1_0) {
+		hw_lisa_map_regs =
+		    (struct dmm_lisa_map_regs *)OMAP44XX_MA_LISA_MAP_BASE;
+
+		writel(lisa_map_regs->dmm_lisa_map_3,
+			&hw_lisa_map_regs->dmm_lisa_map_3);
+		writel(lisa_map_regs->dmm_lisa_map_2,
+			&hw_lisa_map_regs->dmm_lisa_map_2);
+		writel(lisa_map_regs->dmm_lisa_map_1,
+			&hw_lisa_map_regs->dmm_lisa_map_1);
+		writel(lisa_map_regs->dmm_lisa_map_0,
+			&hw_lisa_map_regs->dmm_lisa_map_0);
+	}
 }
 
 /*
diff --git a/arch/arm/include/asm/arch-omap4/emif.h b/arch/arm/include/asm/arch-omap4/emif.h
index a167508..37ad1fd 100644
--- a/arch/arm/include/asm/arch-omap4/emif.h
+++ b/arch/arm/include/asm/arch-omap4/emif.h
@@ -248,6 +248,8 @@
 /* OCP_CONFIG */
 #define OMAP44XX_REG_SYS_THRESH_MAX_SHIFT		24
 #define OMAP44XX_REG_SYS_THRESH_MAX_MASK		(0xf << 24)
+#define OMAP44XX_REG_MPU_THRESH_MAX_SHIFT		20
+#define OMAP44XX_REG_MPU_THRESH_MAX_MASK		(0xf << 20)
 #define OMAP44XX_REG_LL_THRESH_MAX_SHIFT		16
 #define OMAP44XX_REG_LL_THRESH_MAX_MASK			(0xf << 16)
 #define OMAP44XX_REG_PR_OLD_COUNT_SHIFT			0
@@ -472,6 +474,9 @@
 /* DMM */
 #define OMAP44XX_DMM_LISA_MAP_BASE	0x4E000040
 
+/* Memory Adapter (4460 onwards) */
+#define OMAP44XX_MA_LISA_MAP_BASE		0x482AF040
+
 /* DMM_LISA_MAP */
 #define OMAP44XX_SYS_ADDR_SHIFT		24
 #define OMAP44XX_SYS_ADDR_MASK		(0xff << 24)
@@ -774,8 +779,9 @@ struct control_lpddr2io_regs {
 	((REG_PD_TIM << OMAP44XX_REG_PD_TIM_SHDW_SHIFT)\
 			& OMAP44XX_REG_PD_TIM_SHDW_MASK))
 
-/* EMIF_L3_CONFIG register value for ES1*/
-#define EMIF_L3_CONFIG_VAL_SYS_THRESH_0A_LL_THRESH_00	0x0A0000FF
+/* EMIF_L3_CONFIG register value */
+#define EMIF_L3_CONFIG_VAL_SYS_10_LL_0	0x0A0000FF
+#define EMIF_L3_CONFIG_VAL_SYS_10_MPU_3_LL_0	0x0A300000
 /*
  * Value of bits 12:31 of DDR_PHY_CTRL_1 register:
  * All these fields have magic values dependent on frequency and
-- 
1.7.0.4

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

* [U-Boot] [PATCH v2 3/5] omap: reuse omap3 gpio support in omap4
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
                   ` (9 preceding siblings ...)
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 2/5] omap4: sdram init changes for omap4460 Aneesh V
@ 2011-07-20 10:55 ` Aneesh V
  2011-07-29 16:40   ` Aneesh V
  2011-07-29 17:03   ` [U-Boot] [PATCH " Aneesh V
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 4/5] omap4: support TPS programming Aneesh V
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 5/5] omap4: clock init support for omap4460 Aneesh V
  12 siblings, 2 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-20 10:55 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Aneesh V <aneesh@ti.com>
---
V2:
* Added a new file that was accidentally missing in v1
---
 arch/arm/cpu/armv7/omap-common/Makefile            |    1 +
 arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c   |   41 ++++++++------------
 arch/arm/cpu/armv7/omap3/Makefile                  |    1 -
 arch/arm/cpu/armv7/omap3/board.c                   |   12 ++++++
 arch/arm/cpu/armv7/omap4/board.c                   |   12 ++++++
 arch/arm/cpu/armv7/omap4/clocks.c                  |    2 +-
 arch/arm/include/asm/arch-omap3/cpu.h              |   26 ++++++++++++
 arch/arm/include/asm/arch-omap4/cpu.h              |   26 ++++++++++++
 arch/arm/include/asm/arch-omap4/omap4.h            |    8 ++++
 .../include/asm/{arch-omap3/gpio.h => omap_gpio.h} |   27 +-----------
 10 files changed, 105 insertions(+), 51 deletions(-)
 rename arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c (76%)
 rename arch/arm/include/asm/{arch-omap3/gpio.h => omap_gpio.h} (67%)

diff --git a/arch/arm/cpu/armv7/omap-common/Makefile b/arch/arm/cpu/armv7/omap-common/Makefile
index 0708796..ea9f8ec 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -29,6 +29,7 @@ SOBJS	:= reset.o
 
 COBJS	:= timer.o
 COBJS	+= utils.o
+COBJS	+= gpio.o
 
 ifdef CONFIG_SPL_BUILD
 COBJS	+= spl.o
diff --git a/arch/arm/cpu/armv7/omap3/gpio.c b/arch/arm/cpu/armv7/omap-common/gpio.c
similarity index 76%
rename from arch/arm/cpu/armv7/omap3/gpio.c
rename to arch/arm/cpu/armv7/omap-common/gpio.c
index aeb6066..f4c3479 100644
--- a/arch/arm/cpu/armv7/omap3/gpio.c
+++ b/arch/arm/cpu/armv7/omap-common/gpio.c
@@ -36,24 +36,13 @@
  * published by the Free Software Foundation.
  */
 #include <common.h>
-#include <asm/arch/gpio.h>
+#include <asm/omap_gpio.h>
 #include <asm/io.h>
 #include <asm/errno.h>
 
-static struct gpio_bank gpio_bank_34xx[6] = {
-	{ (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX },
-};
-
-static struct gpio_bank *gpio_bank = &gpio_bank_34xx[0];
-
-static inline struct gpio_bank *get_gpio_bank(int gpio)
+static inline const struct gpio_bank *get_gpio_bank(int gpio)
 {
-	return &gpio_bank[gpio >> 5];
+	return &omap_gpio_bank[gpio >> 5];
 }
 
 static inline int get_gpio_index(int gpio)
@@ -79,14 +68,15 @@ static int check_gpio(int gpio)
 	return 0;
 }
 
-static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
+static void _set_gpio_direction(const struct gpio_bank *bank, int gpio,
+				int is_input)
 {
 	void *reg = bank->base;
 	u32 l;
 
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
-		reg += OMAP24XX_GPIO_OE;
+		reg += OMAP_GPIO_OE;
 		break;
 	default:
 		return;
@@ -101,7 +91,7 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
 
 void omap_set_gpio_direction(int gpio, int is_input)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
@@ -109,7 +99,8 @@ void omap_set_gpio_direction(int gpio, int is_input)
 	_set_gpio_direction(bank, get_gpio_index(gpio), is_input);
 }
 
-static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
+static void _set_gpio_dataout(const struct gpio_bank *bank, int gpio,
+				int enable)
 {
 	void *reg = bank->base;
 	u32 l = 0;
@@ -117,9 +108,9 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
 		if (enable)
-			reg += OMAP24XX_GPIO_SETDATAOUT;
+			reg += OMAP_GPIO_SETDATAOUT;
 		else
-			reg += OMAP24XX_GPIO_CLEARDATAOUT;
+			reg += OMAP_GPIO_CLEARDATAOUT;
 		l = 1 << gpio;
 		break;
 	default:
@@ -132,7 +123,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
 
 void omap_set_gpio_dataout(int gpio, int enable)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
@@ -142,7 +133,7 @@ void omap_set_gpio_dataout(int gpio, int enable)
 
 int omap_get_gpio_datain(int gpio)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 	void *reg;
 
 	if (check_gpio(gpio) < 0)
@@ -151,7 +142,7 @@ int omap_get_gpio_datain(int gpio)
 	reg = bank->base;
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
-		reg += OMAP24XX_GPIO_DATAIN;
+		reg += OMAP_GPIO_DATAIN;
 		break;
 	default:
 		return -EINVAL;
@@ -160,7 +151,7 @@ int omap_get_gpio_datain(int gpio)
 			& (1 << get_gpio_index(gpio))) != 0;
 }
 
-static void _reset_gpio(struct gpio_bank *bank, int gpio)
+static void _reset_gpio(const struct gpio_bank *bank, int gpio)
 {
 	_set_gpio_direction(bank, get_gpio_index(gpio), 1);
 }
@@ -175,7 +166,7 @@ int omap_request_gpio(int gpio)
 
 void omap_free_gpio(int gpio)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
diff --git a/arch/arm/cpu/armv7/omap3/Makefile b/arch/arm/cpu/armv7/omap3/Makefile
index 522bcd2..8e85891 100644
--- a/arch/arm/cpu/armv7/omap3/Makefile
+++ b/arch/arm/cpu/armv7/omap3/Makefile
@@ -29,7 +29,6 @@ SOBJS	:= lowlevel_init.o
 
 COBJS	+= board.o
 COBJS	+= clock.o
-COBJS	+= gpio.o
 COBJS	+= mem.o
 COBJS	+= sys_info.o
 
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 98519a9..4aaf97b 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -38,12 +38,24 @@
 #include <asm/arch/mem.h>
 #include <asm/cache.h>
 #include <asm/armv7.h>
+#include <asm/omap_gpio.h>
 
 /* Declarations */
 extern omap3_sysinfo sysinfo;
 static void omap3_setup_aux_cr(void);
 static void omap3_invalidate_l2_cache_secure(void);
 
+static const struct gpio_bank gpio_bank_34xx[6] = {
+	{ (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX },
+};
+
+const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;
+
 /******************************************************************************
  * Routine: delay
  * Description: spinning delay to use before udelay works
diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index 17e731a..3c61b1c 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -33,12 +33,24 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/sizes.h>
 #include <asm/arch/emif.h>
+#include <asm/omap_gpio.h>
 #include "omap4_mux_data.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 u32 *const omap4_revision = (u32 *)OMAP4_SRAM_SCRATCH_OMAP4_REV;
 
+static const struct gpio_bank gpio_bank_44xx[6] = {
+	{ (void *)OMAP44XX_GPIO1_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO2_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO3_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO4_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO5_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO6_BASE, METHOD_GPIO_24XX },
+};
+
+const struct gpio_bank *const omap_gpio_bank = gpio_bank_44xx;
+
 #ifdef CONFIG_SPL_BUILD
 /*
  * We use static variables because global data is not ready yet.
diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c
index f1e233a..660b329 100644
--- a/arch/arm/cpu/armv7/omap4/clocks.c
+++ b/arch/arm/cpu/armv7/omap4/clocks.c
@@ -830,9 +830,9 @@ void prcm_init(void)
 	case OMAP_INIT_CONTEXT_SPL:
 	case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR:
 	case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH:
+		enable_basic_clocks();
 		scale_vcores();
 		setup_dplls();
-		enable_basic_clocks();
 		setup_non_essential_dplls();
 		enable_non_essential_clocks();
 		break;
diff --git a/arch/arm/include/asm/arch-omap3/cpu.h b/arch/arm/include/asm/arch-omap3/cpu.h
index e944de7..08a725d 100644
--- a/arch/arm/include/asm/arch-omap3/cpu.h
+++ b/arch/arm/include/asm/arch-omap3/cpu.h
@@ -498,4 +498,30 @@ struct pm {
 /* MUSB base */
 #define MUSB_BASE		(OMAP34XX_CORE_L4_IO_BASE + 0xAB000)
 
+/* OMAP3 GPIO registers */
+#define OMAP_GPIO_REVISION		0x0000
+#define OMAP_GPIO_SYSCONFIG		0x0010
+#define OMAP_GPIO_SYSSTATUS		0x0014
+#define OMAP_GPIO_IRQSTATUS1		0x0018
+#define OMAP_GPIO_IRQSTATUS2		0x0028
+#define OMAP_GPIO_IRQENABLE2		0x002c
+#define OMAP_GPIO_IRQENABLE1		0x001c
+#define OMAP_GPIO_WAKE_EN		0x0020
+#define OMAP_GPIO_CTRL			0x0030
+#define OMAP_GPIO_OE			0x0034
+#define OMAP_GPIO_DATAIN		0x0038
+#define OMAP_GPIO_DATAOUT		0x003c
+#define OMAP_GPIO_LEVELDETECT0		0x0040
+#define OMAP_GPIO_LEVELDETECT1		0x0044
+#define OMAP_GPIO_RISINGDETECT		0x0048
+#define OMAP_GPIO_FALLINGDETECT		0x004c
+#define OMAP_GPIO_DEBOUNCE_EN		0x0050
+#define OMAP_GPIO_DEBOUNCE_VAL		0x0054
+#define OMAP_GPIO_CLEARIRQENABLE1	0x0060
+#define OMAP_GPIO_SETIRQENABLE1		0x0064
+#define OMAP_GPIO_CLEARWKUENA		0x0080
+#define OMAP_GPIO_SETWKUENA		0x0084
+#define OMAP_GPIO_CLEARDATAOUT		0x0090
+#define OMAP_GPIO_SETDATAOUT		0x0094
+
 #endif /* _CPU_H */
diff --git a/arch/arm/include/asm/arch-omap4/cpu.h b/arch/arm/include/asm/arch-omap4/cpu.h
index 7d5748a..08b9c99 100644
--- a/arch/arm/include/asm/arch-omap4/cpu.h
+++ b/arch/arm/include/asm/arch-omap4/cpu.h
@@ -142,4 +142,30 @@ struct watchdog {
 /* MUSB base */
 #define MUSB_BASE		(OMAP44XX_L4_CORE_BASE + 0xAB000)
 
+/* OMAP4 GPIO registers */
+#define OMAP_GPIO_REVISION		0x0000
+#define OMAP_GPIO_SYSCONFIG		0x0010
+#define OMAP_GPIO_SYSSTATUS		0x0114
+#define OMAP_GPIO_IRQSTATUS1		0x0118
+#define OMAP_GPIO_IRQSTATUS2		0x0128
+#define OMAP_GPIO_IRQENABLE2		0x012c
+#define OMAP_GPIO_IRQENABLE1		0x011c
+#define OMAP_GPIO_WAKE_EN		0x0120
+#define OMAP_GPIO_CTRL			0x0130
+#define OMAP_GPIO_OE			0x0134
+#define OMAP_GPIO_DATAIN		0x0138
+#define OMAP_GPIO_DATAOUT		0x013c
+#define OMAP_GPIO_LEVELDETECT0		0x0140
+#define OMAP_GPIO_LEVELDETECT1		0x0144
+#define OMAP_GPIO_RISINGDETECT		0x0148
+#define OMAP_GPIO_FALLINGDETECT		0x014c
+#define OMAP_GPIO_DEBOUNCE_EN		0x0150
+#define OMAP_GPIO_DEBOUNCE_VAL		0x0154
+#define OMAP_GPIO_CLEARIRQENABLE1	0x0160
+#define OMAP_GPIO_SETIRQENABLE1		0x0164
+#define OMAP_GPIO_CLEARWKUENA		0x0180
+#define OMAP_GPIO_SETWKUENA		0x0184
+#define OMAP_GPIO_CLEARDATAOUT		0x0190
+#define OMAP_GPIO_SETDATAOUT		0x0194
+
 #endif /* _CPU_H */
diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h
index 7ff46d7..9aad0e6 100644
--- a/arch/arm/include/asm/arch-omap4/omap4.h
+++ b/arch/arm/include/asm/arch-omap4/omap4.h
@@ -153,4 +153,12 @@ struct s32ktimer {
 #define DEV_DATA_PTR_OFFSET	0x18
 #define BOOT_MODE_OFFSET	0x8
 
+/* GPIO */
+#define OMAP44XX_GPIO1_BASE		0x4A310000
+#define OMAP44XX_GPIO2_BASE		0x48055000
+#define OMAP44XX_GPIO3_BASE		0x48057000
+#define OMAP44XX_GPIO4_BASE		0x48059000
+#define OMAP44XX_GPIO5_BASE		0x4805B000
+#define OMAP44XX_GPIO6_BASE		0x4805D000
+
 #endif
diff --git a/arch/arm/include/asm/arch-omap3/gpio.h b/arch/arm/include/asm/omap_gpio.h
similarity index 67%
rename from arch/arm/include/asm/arch-omap3/gpio.h
rename to arch/arm/include/asm/omap_gpio.h
index 30f633c..3089e1c 100644
--- a/arch/arm/include/asm/arch-omap3/gpio.h
+++ b/arch/arm/include/asm/omap_gpio.h
@@ -38,36 +38,15 @@
 #ifndef _GPIO_H
 #define _GPIO_H
 
-#define OMAP24XX_GPIO_REVISION		0x0000
-#define OMAP24XX_GPIO_SYSCONFIG		0x0010
-#define OMAP24XX_GPIO_SYSSTATUS		0x0014
-#define OMAP24XX_GPIO_IRQSTATUS1	0x0018
-#define OMAP24XX_GPIO_IRQSTATUS2	0x0028
-#define OMAP24XX_GPIO_IRQENABLE2	0x002c
-#define OMAP24XX_GPIO_IRQENABLE1	0x001c
-#define OMAP24XX_GPIO_WAKE_EN		0x0020
-#define OMAP24XX_GPIO_CTRL		0x0030
-#define OMAP24XX_GPIO_OE		0x0034
-#define OMAP24XX_GPIO_DATAIN		0x0038
-#define OMAP24XX_GPIO_DATAOUT		0x003c
-#define OMAP24XX_GPIO_LEVELDETECT0	0x0040
-#define OMAP24XX_GPIO_LEVELDETECT1	0x0044
-#define OMAP24XX_GPIO_RISINGDETECT	0x0048
-#define OMAP24XX_GPIO_FALLINGDETECT	0x004c
-#define OMAP24XX_GPIO_DEBOUNCE_EN	0x0050
-#define OMAP24XX_GPIO_DEBOUNCE_VAL	0x0054
-#define OMAP24XX_GPIO_CLEARIRQENABLE1	0x0060
-#define OMAP24XX_GPIO_SETIRQENABLE1	0x0064
-#define OMAP24XX_GPIO_CLEARWKUENA	0x0080
-#define OMAP24XX_GPIO_SETWKUENA		0x0084
-#define OMAP24XX_GPIO_CLEARDATAOUT	0x0090
-#define OMAP24XX_GPIO_SETDATAOUT	0x0094
+#include <asm/arch/cpu.h>
 
 struct gpio_bank {
 	void *base;
 	int method;
 };
 
+extern const struct gpio_bank *const omap_gpio_bank;
+
 #define METHOD_GPIO_24XX	4
 
 /* This is the interface */
-- 
1.7.0.4

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

* [U-Boot] [PATCH v2 4/5] omap4: support TPS programming
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
                   ` (10 preceding siblings ...)
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 3/5] omap: reuse omap3 gpio support in omap4 Aneesh V
@ 2011-07-20 10:55 ` Aneesh V
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 5/5] omap4: clock init support for omap4460 Aneesh V
  12 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-20 10:55 UTC (permalink / raw)
  To: u-boot

TPS62361 is the new power supply used in OMAP4460 that
supplies vdd_mpu.

VCORE1 from Phoenix supplies vdd_core and VCORE2 supplies
vdd_iva. VCORE3 is not used in OMAP4460.

Signed-off-by: Aneesh V <aneesh@ti.com>
---
 arch/arm/cpu/armv7/omap4/board.c            |    4 ++
 arch/arm/cpu/armv7/omap4/clocks.c           |   65 ++++++++++++++++++++++++---
 arch/arm/include/asm/arch-omap4/clocks.h    |   16 +++++++
 arch/arm/include/asm/arch-omap4/mux_omap4.h |    1 +
 4 files changed, 79 insertions(+), 7 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index 3c61b1c..5943d61 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -90,6 +90,10 @@ static void set_muxconf_regs_essential(void)
 	do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_essential,
 		   sizeof(wkup_padconf_array_essential) /
 		   sizeof(struct pad_conf_entry));
+
+	/* gpio_wk7 is used for controlling TPS on 4460 */
+	if (omap_revision() >= OMAP4460_ES1_0)
+		writew(M3, CONTROL_WKUP_PAD1_FREF_CLK4_REQ);
 }
 
 static void set_mux_conf_regs(void)
diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c
index 660b329..0db9d18 100644
--- a/arch/arm/cpu/armv7/omap4/clocks.c
+++ b/arch/arm/cpu/armv7/omap4/clocks.c
@@ -34,6 +34,7 @@
 #include <asm/arch/clocks.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/utils.h>
+#include <asm/omap_gpio.h>
 
 #ifndef CONFIG_SPL_BUILD
 /*
@@ -421,6 +422,34 @@ static void setup_non_essential_dplls(void)
 	do_setup_dpll(&prcm->cm_clkmode_dpll_abe, params, DPLL_LOCK);
 }
 
+static void do_scale_tps62361(u32 reg, u32 volt_mv)
+{
+	u32 temp, step;
+
+	step = volt_mv - TPS62361_BASE_VOLT_MV;
+	step /= 10;
+
+	/*
+	 * Select SET1 in TPS62361:
+	 * VSEL1 is grounded on board. So the following selects
+	 * VSEL1 = 0 and VSEL0 = 1
+	 */
+	omap_set_gpio_direction(TPS62361_VSEL0_GPIO, 0);
+	omap_set_gpio_dataout(TPS62361_VSEL0_GPIO, 1);
+
+	temp = TPS62361_I2C_SLAVE_ADDR |
+	    (reg << PRM_VC_VAL_BYPASS_REGADDR_SHIFT) |
+	    (step << PRM_VC_VAL_BYPASS_DATA_SHIFT) |
+	    PRM_VC_VAL_BYPASS_VALID_BIT;
+	debug("do_scale_tps62361: volt - %d step - 0x%x\n", volt_mv, step);
+
+	writel(temp, &prcm->prm_vc_val_bypass);
+	if (!wait_on_value(PRM_VC_VAL_BYPASS_VALID_BIT, 0,
+				&prcm->prm_vc_val_bypass, LDELAY)) {
+		puts("Scaling voltage failed for vdd_mpu from TPS\n");
+	}
+}
+
 static void do_scale_vcore(u32 vcore_reg, u32 volt_mv)
 {
 	u32 temp, offset_code;
@@ -461,7 +490,7 @@ static void do_scale_vcore(u32 vcore_reg, u32 volt_mv)
  */
 static void scale_vcores(void)
 {
-	u32 volt, sys_clk_khz, cycles_hi, cycles_low, temp;
+	u32 volt, sys_clk_khz, cycles_hi, cycles_low, temp, omap4_rev;
 
 	sys_clk_khz = get_sys_clk_freq() / 1000;
 
@@ -481,23 +510,45 @@ static void scale_vcores(void)
 	/* Disable high speed mode and all advanced features */
 	writel(0x0, &prcm->prm_vc_cfg_i2c_mode);
 
+	omap4_rev = omap_revision();
+	/* TPS - supplies vdd_mpu on 4460 */
+	if (omap4_rev >= OMAP4460_ES1_0) {
+		volt = 1430;
+		do_scale_tps62361(TPS62361_REG_ADDR_SET1, volt);
+	}
+
 	/*
-	 * VCORE 1 - 4430 : supplies vdd_mpu
+	 * VCORE 1
+	 *
+	 * 4430 : supplies vdd_mpu
 	 * Setting a high voltage for Nitro mode as smart reflex is not enabled.
 	 * We use the maximum possible value in the AVS range because the next
 	 * higher voltage in the discrete range (code >= 0b111010) is way too
 	 * high
+	 *
+	 * 4460 : supplies vdd_core
 	 */
-	volt = 1417;
-	do_scale_vcore(SMPS_REG_ADDR_VCORE1, volt);
+	if (omap4_rev < OMAP4460_ES1_0) {
+		volt = 1417;
+		do_scale_vcore(SMPS_REG_ADDR_VCORE1, volt);
+	} else {
+		volt = 1200;
+		do_scale_vcore(SMPS_REG_ADDR_VCORE1, volt);
+	}
 
 	/* VCORE 2 - supplies vdd_iva */
 	volt = 1200;
 	do_scale_vcore(SMPS_REG_ADDR_VCORE2, volt);
 
-	/* VCORE 3 - supplies vdd_core */
-	volt = 1200;
-	do_scale_vcore(SMPS_REG_ADDR_VCORE3, volt);
+	/*
+	 * VCORE 3
+	 * 4430 : supplies vdd_core
+	 * 4460 : not connected
+	 */
+	if (omap4_rev < OMAP4460_ES1_0) {
+		volt = 1200;
+		do_scale_vcore(SMPS_REG_ADDR_VCORE3, volt);
+	}
 }
 
 static inline void enable_clock_domain(u32 *const clkctrl_reg, u32 enable_mode)
diff --git a/arch/arm/include/asm/arch-omap4/clocks.h b/arch/arm/include/asm/arch-omap4/clocks.h
index 37bdcee..5d9cb50 100644
--- a/arch/arm/include/asm/arch-omap4/clocks.h
+++ b/arch/arm/include/asm/arch-omap4/clocks.h
@@ -618,6 +618,7 @@ struct omap4_prcm_regs {
 #define PRM_VC_VAL_BYPASS_DATA_SHIFT		16
 #define PRM_VC_VAL_BYPASS_DATA_MASK		0xFF
 
+/* SMPS */
 #define SMPS_I2C_SLAVE_ADDR	0x12
 #define SMPS_REG_ADDR_VCORE1	0x55
 #define SMPS_REG_ADDR_VCORE2	0x5B
@@ -626,6 +627,21 @@ struct omap4_prcm_regs {
 #define PHOENIX_SMPS_BASE_VOLT_STD_MODE_UV		607700
 #define PHOENIX_SMPS_BASE_VOLT_STD_MODE_WITH_OFFSET_UV	709000
 
+/* TPS */
+#define TPS62361_I2C_SLAVE_ADDR		0x60
+#define TPS62361_REG_ADDR_SET0		0x0
+#define TPS62361_REG_ADDR_SET1		0x1
+#define TPS62361_REG_ADDR_SET2		0x2
+#define TPS62361_REG_ADDR_SET3		0x3
+#define TPS62361_REG_ADDR_CTRL		0x4
+#define TPS62361_REG_ADDR_TEMP		0x5
+#define TPS62361_REG_ADDR_RMP_CTRL	0x6
+#define TPS62361_REG_ADDR_CHIP_ID	0x8
+#define TPS62361_REG_ADDR_CHIP_ID_2	0x9
+
+#define TPS62361_BASE_VOLT_MV	500
+#define TPS62361_VSEL0_GPIO	7
+
 /* Defines for DPLL setup */
 #define DPLL_LOCKED_FREQ_TOLERANCE_0		0
 #define DPLL_LOCKED_FREQ_TOLERANCE_500_KHZ	500
diff --git a/arch/arm/include/asm/arch-omap4/mux_omap4.h b/arch/arm/include/asm/arch-omap4/mux_omap4.h
index 019574b..30bfad7 100644
--- a/arch/arm/include/asm/arch-omap4/mux_omap4.h
+++ b/arch/arm/include/asm/arch-omap4/mux_omap4.h
@@ -341,4 +341,5 @@ struct pad_conf_entry {
 #define CONTROL_SPARE_R		0x0618
 #define CONTROL_SPARE_R_C0		0x061C
 
+#define CONTROL_WKUP_PAD1_FREF_CLK4_REQ	0x4A31E05A
 #endif /* _MUX_OMAP4_H_ */
-- 
1.7.0.4

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

* [U-Boot] [PATCH v2 5/5] omap4: clock init support for omap4460
  2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
                   ` (11 preceding siblings ...)
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 4/5] omap4: support TPS programming Aneesh V
@ 2011-07-20 10:55 ` Aneesh V
  12 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-20 10:55 UTC (permalink / raw)
  To: u-boot

---
 arch/arm/cpu/armv7/omap4/clocks.c        |   61 ++++++++++++++++++++++++++---
 arch/arm/include/asm/arch-omap4/clocks.h |   12 +++++-
 2 files changed, 65 insertions(+), 8 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c
index 0db9d18..eda960c 100644
--- a/arch/arm/cpu/armv7/omap4/clocks.c
+++ b/arch/arm/cpu/armv7/omap4/clocks.c
@@ -66,7 +66,18 @@ static const u32 sys_clk_array[8] = {
  * Please use this tool for creating the table for any new frequency.
  */
 
-/* dpll locked at 1584 MHz - MPU clk at 792 MHz(OPP Turbo) */
+/* dpll locked at 1840 MHz MPU clk at 920 MHz(OPP Turbo 4460) - DCC OFF */
+static const struct dpll_params mpu_dpll_params_1840mhz[NUM_SYS_CLKS] = {
+	{230, 2, 1, -1, -1, -1, -1, -1},	/* 12 MHz   */
+	{920, 12, 1, -1, -1, -1, -1, -1},	/* 13 MHz   */
+	{219, 3, 1, -1, -1, -1, -1, -1},	/* 16.8 MHz */
+	{575, 11, 1, -1, -1, -1, -1, -1},	/* 19.2 MHz */
+	{460, 12, 1, -1, -1, -1, -1, -1},	/* 26 MHz   */
+	{920, 26, 1, -1, -1, -1, -1, -1},	/* 27 MHz   */
+	{575, 23, 1, -1, -1, -1, -1, -1}	/* 38.4 MHz */
+};
+
+/* dpll locked at 1584 MHz - MPU clk at 792 MHz(OPP Turbo 4430) */
 static const struct dpll_params mpu_dpll_params_1584mhz[NUM_SYS_CLKS] = {
 	{66, 0, 1, -1, -1, -1, -1, -1},		/* 12 MHz   */
 	{792, 12, 1, -1, -1, -1, -1, -1},	/* 13 MHz   */
@@ -320,6 +331,47 @@ u32 omap4_ddr_clk(void)
 	return ddr_clk;
 }
 
+/*
+ * Lock MPU dpll
+ *
+ * Resulting MPU frequencies:
+ * 4430 ES1.0	: 600 MHz
+ * 4430 ES2.x	: 792 MHz (OPP Turbo)
+ * 4460		: 920 MHz (OPP Turbo) - DCC disabled
+ */
+void configure_mpu_dpll(void)
+{
+	const struct dpll_params *params;
+	struct dpll_regs *mpu_dpll_regs;
+	u32 omap4_rev, sysclk_ind;
+
+	omap4_rev = omap_revision();
+	sysclk_ind = get_sys_clk_index();
+
+	if (omap4_rev == OMAP4430_ES1_0)
+		params = &mpu_dpll_params_1200mhz[sysclk_ind];
+	else if (omap4_rev < OMAP4460_ES1_0)
+		params = &mpu_dpll_params_1584mhz[sysclk_ind];
+	else
+		params = &mpu_dpll_params_1840mhz[sysclk_ind];
+
+	/* DCC and clock divider settings for 4460 */
+	if (omap4_rev >= OMAP4460_ES1_0) {
+		mpu_dpll_regs =
+			(struct dpll_regs *)&prcm->cm_clkmode_dpll_mpu;
+		bypass_dpll(&prcm->cm_clkmode_dpll_mpu);
+		clrbits_le32(&prcm->cm_mpu_mpu_clkctrl,
+			MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK);
+		setbits_le32(&prcm->cm_mpu_mpu_clkctrl,
+			MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_MASK);
+		clrbits_le32(&mpu_dpll_regs->cm_clksel_dpll,
+			CM_CLKSEL_DCC_EN_MASK);
+	}
+
+	do_setup_dpll(&prcm->cm_clkmode_dpll_mpu, params, DPLL_LOCK);
+	debug("MPU DPLL locked\n");
+}
+
 static void setup_dplls(void)
 {
 	u32 sysclk_ind, temp;
@@ -349,12 +401,7 @@ static void setup_dplls(void)
 	debug("PER DPLL locked\n");
 
 	/* MPU dpll */
-	if (omap_revision() == OMAP4430_ES1_0)
-		params = &mpu_dpll_params_1200mhz[sysclk_ind];
-	else
-		params = &mpu_dpll_params_1584mhz[sysclk_ind];
-	do_setup_dpll(&prcm->cm_clkmode_dpll_mpu, params, DPLL_LOCK);
-	debug("MPU DPLL locked\n");
+	configure_mpu_dpll();
 }
 
 static void setup_non_essential_dplls(void)
diff --git a/arch/arm/include/asm/arch-omap4/clocks.h b/arch/arm/include/asm/arch-omap4/clocks.h
index 5d9cb50..374e064 100644
--- a/arch/arm/include/asm/arch-omap4/clocks.h
+++ b/arch/arm/include/asm/arch-omap4/clocks.h
@@ -105,9 +105,11 @@ struct omap4_prcm_regs {
 	u32 cm_ssc_deltamstep_dpll_ddrphy;
 	u32 pad014[5];
 	u32 cm_shadow_freq_config1;
+	u32 pad0141[47];
+	u32 cm_mpu_mpu_clkctrl;
 
 	/* cm1.dsp */
-	u32 pad015[103];
+	u32 pad015[55];
 	u32 cm_dsp_clkstctrl;
 	u32 pad016[7];
 	u32 cm_dsp_dsp_clkctrl;
@@ -515,6 +517,8 @@ struct omap4_prcm_regs {
 #define CM_CLKSEL_DPLL_M_MASK			(0x7FF << 8)
 #define CM_CLKSEL_DPLL_N_SHIFT			0
 #define CM_CLKSEL_DPLL_N_MASK			0x7F
+#define CM_CLKSEL_DCC_EN_SHIFT			22
+#define CM_CLKSEL_DCC_EN_MASK			(1 << 22)
 
 #define OMAP4_DPLL_MAX_N	127
 
@@ -596,6 +600,12 @@ struct omap4_prcm_regs {
 /* CM_L3INIT_USBPHY_CLKCTRL */
 #define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK	8
 
+/* CM_MPU_MPU_CLKCTRL */
+#define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_SHIFT	24
+#define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK	(1 << 24)
+#define MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_SHIFT	25
+#define MPU_CLKCTRL_CLKSEL_ABE_DIV_MODE_MASK	(1 << 25)
+
 /* Clock frequencies */
 #define OMAP_SYS_CLK_FREQ_38_4_MHZ	38400000
 #define OMAP_SYS_CLK_IND_38_4_MHZ	6
-- 
1.7.0.4

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

* [U-Boot] [PATCH v2 0/5] arm: omap4: omap4460 support
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 " Aneesh V
@ 2011-07-20 15:43   ` Paulraj, Sandeep
  2011-07-20 19:49     ` Wolfgang Denk
  2011-07-20 20:58   ` Paulraj, Sandeep
  1 sibling, 1 reply; 26+ messages in thread
From: Paulraj, Sandeep @ 2011-07-20 15:43 UTC (permalink / raw)
  To: u-boot



> 
> OMAP4460 is the latest addition to the OMAP4 family.
> OMAP4460 has dual core Cortex-A9 CPUs that can be clocked upto
> 1.5 GHz
> 
> The memory architecture has been improved to provide better
> performance and there several other minor improvements in various
> modules.
> 
> This series depends on the OMAP4 spl series [1] and the SPL framework
> series [2]
> 
> [1] http://marc.info/?l=u-boot&m=131082102506002&w=2
> [2] http://marc.info/?l=u-boot&m=131056990001719&w=2

Wolfgang, Albert,

If it is OK with you I'd like to pull in all the 3 patch sets into u-boot-ti.

This would also include the patch set to update the SPL framework.


Regards,
Sandeep

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

* [U-Boot] [PATCH v2 0/5] arm: omap4: omap4460 support
  2011-07-20 15:43   ` Paulraj, Sandeep
@ 2011-07-20 19:49     ` Wolfgang Denk
  2011-07-20 20:44       ` Paulraj, Sandeep
  0 siblings, 1 reply; 26+ messages in thread
From: Wolfgang Denk @ 2011-07-20 19:49 UTC (permalink / raw)
  To: u-boot

Dear "Paulraj, Sandeep",

In message <BE04C0A3BEC7354A8BCE3DB869F4D493023722@DFLE35.ent.ti.com> you wrote:
> 
> > This series depends on the OMAP4 spl series [1] and the SPL framework
> > series [2]
> > 
> > [1] http://marc.info/?l=u-boot&m=131082102506002&w=2
> > [2] http://marc.info/?l=u-boot&m=131056990001719&w=2
> 
> Wolfgang, Albert,
> 
> If it is OK with you I'd like to pull in all the 3 patch sets into u-boot-ti.
> 
> This would also include the patch set to update the SPL framework.

I can only comment on the SPL series hier.

For this you have my:

Acked-by: Wolfgang Denk <wd@denx.de>

[I have it on my list, too, but a short glace at my desk tells me
that you will most probably be much faster than me, so please go
ahead. And thanks!]

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Brain off-line, please wait.

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

* [U-Boot] [PATCH v2 0/5] arm: omap4: omap4460 support
  2011-07-20 19:49     ` Wolfgang Denk
@ 2011-07-20 20:44       ` Paulraj, Sandeep
  0 siblings, 0 replies; 26+ messages in thread
From: Paulraj, Sandeep @ 2011-07-20 20:44 UTC (permalink / raw)
  To: u-boot



> 
> Dear "Paulraj, Sandeep",
> 
> In message <BE04C0A3BEC7354A8BCE3DB869F4D493023722@DFLE35.ent.ti.com> you
> wrote:
> >
> > > This series depends on the OMAP4 spl series [1] and the SPL framework
> > > series [2]
> > >
> > > [1] http://marc.info/?l=u-boot&m=131082102506002&w=2
> > > [2] http://marc.info/?l=u-boot&m=131056990001719&w=2
> >
> > Wolfgang, Albert,
> >
> > If it is OK with you I'd like to pull in all the 3 patch sets into u-
> boot-ti.
> >
> > This would also include the patch set to update the SPL framework.
> 
> I can only comment on the SPL series hier.
> 
> For this you have my:
> 
> Acked-by: Wolfgang Denk <wd@denx.de>
> 
Thanks,

I'll send in a pull request tomorrow morning

Regards,
Sandeep

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

* [U-Boot] [PATCH v2 0/5] arm: omap4: omap4460 support
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 " Aneesh V
  2011-07-20 15:43   ` Paulraj, Sandeep
@ 2011-07-20 20:58   ` Paulraj, Sandeep
  1 sibling, 0 replies; 26+ messages in thread
From: Paulraj, Sandeep @ 2011-07-20 20:58 UTC (permalink / raw)
  To: u-boot



> 
> OMAP4460 is the latest addition to the OMAP4 family.
> OMAP4460 has dual core Cortex-A9 CPUs that can be clocked upto
> 1.5 GHz
> 
> The memory architecture has been improved to provide better
> performance and there several other minor improvements in various
> modules.
> 
> This series depends on the OMAP4 spl series [1] and the SPL framework
> series [2]
> 
> [1] http://marc.info/?l=u-boot&m=131082102506002&w=2
> [2] http://marc.info/?l=u-boot&m=131056990001719&w=2


There is a v3 version of the SPL framework series.
You are pointing to the RFC series.

I hope your patches are based on the v3 patch series of the SPL framework.

--Sandeep

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

* [U-Boot] [PATCH v2 3/5] omap: reuse omap3 gpio support in omap4
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 3/5] omap: reuse omap3 gpio support in omap4 Aneesh V
@ 2011-07-29 16:40   ` Aneesh V
  2011-07-29 17:03   ` [U-Boot] [PATCH " Aneesh V
  1 sibling, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-29 16:40 UTC (permalink / raw)
  To: u-boot

Hi All,

On Wednesday 20 July 2011 04:25 PM, Aneesh V wrote:
> Signed-off-by: Aneesh V<aneesh@ti.com>
> ---
> V2:
> * Added a new file that was accidentally missing in v1
> ---

[snip ..]

>   .../include/asm/{arch-omap3/gpio.h =>  omap_gpio.h} |   27 +-----------

I just realized that this change in header file name was breaking some
omap3 boards. I had tested only omap3_sdp3430. But some other boards
used GPIO functions in the board layer, which I didn't notice.

I will send out a patch shortly to fix this.

br,
Aneesh

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

* [U-Boot] [PATCH 3/5] omap: reuse omap3 gpio support in omap4
  2011-07-20 10:55 ` [U-Boot] [PATCH v2 3/5] omap: reuse omap3 gpio support in omap4 Aneesh V
  2011-07-29 16:40   ` Aneesh V
@ 2011-07-29 17:03   ` Aneesh V
  2011-07-29 17:09     ` [U-Boot] [PATCH v3 " Aneesh V
  2011-08-01  6:30     ` [U-Boot] [PATCH] omap: fix gpio related build breaks Aneesh V
  1 sibling, 2 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-29 17:03 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Aneesh V <aneesh@ti.com>
---
V2:
* Added a new file that was accidentally missing in v1

V3:
* Fix build break for other boards by restoring the
  old header files <asm/arch/gpio.h>
---
 arch/arm/cpu/armv7/omap-common/Makefile            |    1 +
 arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c   |   39 +++++--------
 arch/arm/cpu/armv7/omap3/Makefile                  |    1 -
 arch/arm/cpu/armv7/omap3/board.c                   |   12 ++++
 arch/arm/cpu/armv7/omap4/board.c                   |   12 ++++
 arch/arm/cpu/armv7/omap4/clocks.c                  |    2 +-
 arch/arm/include/asm/arch-omap3/cpu.h              |   26 +++++++++
 arch/arm/include/asm/arch-omap3/gpio.h             |   56 ++++----------------
 arch/arm/include/asm/arch-omap3/omap3.h            |    8 ---
 arch/arm/include/asm/arch-omap4/cpu.h              |   26 +++++++++
 arch/arm/include/asm/arch-omap4/gpio.h             |   50 +++++++++++++++++
 .../include/asm/{arch-omap3/gpio.h => omap_gpio.h} |   27 +--------
 board/pandora/pandora.c                            |    1 +
 13 files changed, 157 insertions(+), 104 deletions(-)
 rename arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c (77%)
 create mode 100644 arch/arm/include/asm/arch-omap4/gpio.h
 copy arch/arm/include/asm/{arch-omap3/gpio.h => omap_gpio.h} (67%)

diff --git a/arch/arm/cpu/armv7/omap-common/Makefile b/arch/arm/cpu/armv7/omap-common/Makefile
index 0708796..ea9f8ec 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -29,6 +29,7 @@ SOBJS	:= reset.o
 
 COBJS	:= timer.o
 COBJS	+= utils.o
+COBJS	+= gpio.o
 
 ifdef CONFIG_SPL_BUILD
 COBJS	+= spl.o
diff --git a/arch/arm/cpu/armv7/omap3/gpio.c b/arch/arm/cpu/armv7/omap-common/gpio.c
similarity index 77%
rename from arch/arm/cpu/armv7/omap3/gpio.c
rename to arch/arm/cpu/armv7/omap-common/gpio.c
index aeb6066..2fcaf5a 100644
--- a/arch/arm/cpu/armv7/omap3/gpio.c
+++ b/arch/arm/cpu/armv7/omap-common/gpio.c
@@ -40,20 +40,9 @@
 #include <asm/io.h>
 #include <asm/errno.h>
 
-static struct gpio_bank gpio_bank_34xx[6] = {
-	{ (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX },
-};
-
-static struct gpio_bank *gpio_bank = &gpio_bank_34xx[0];
-
-static inline struct gpio_bank *get_gpio_bank(int gpio)
+static inline const struct gpio_bank *get_gpio_bank(int gpio)
 {
-	return &gpio_bank[gpio >> 5];
+	return &omap_gpio_bank[gpio >> 5];
 }
 
 static inline int get_gpio_index(int gpio)
@@ -79,14 +68,15 @@ static int check_gpio(int gpio)
 	return 0;
 }
 
-static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
+static void _set_gpio_direction(const struct gpio_bank *bank, int gpio,
+				int is_input)
 {
 	void *reg = bank->base;
 	u32 l;
 
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
-		reg += OMAP24XX_GPIO_OE;
+		reg += OMAP_GPIO_OE;
 		break;
 	default:
 		return;
@@ -101,7 +91,7 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
 
 void omap_set_gpio_direction(int gpio, int is_input)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
@@ -109,7 +99,8 @@ void omap_set_gpio_direction(int gpio, int is_input)
 	_set_gpio_direction(bank, get_gpio_index(gpio), is_input);
 }
 
-static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
+static void _set_gpio_dataout(const struct gpio_bank *bank, int gpio,
+				int enable)
 {
 	void *reg = bank->base;
 	u32 l = 0;
@@ -117,9 +108,9 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
 		if (enable)
-			reg += OMAP24XX_GPIO_SETDATAOUT;
+			reg += OMAP_GPIO_SETDATAOUT;
 		else
-			reg += OMAP24XX_GPIO_CLEARDATAOUT;
+			reg += OMAP_GPIO_CLEARDATAOUT;
 		l = 1 << gpio;
 		break;
 	default:
@@ -132,7 +123,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
 
 void omap_set_gpio_dataout(int gpio, int enable)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
@@ -142,7 +133,7 @@ void omap_set_gpio_dataout(int gpio, int enable)
 
 int omap_get_gpio_datain(int gpio)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 	void *reg;
 
 	if (check_gpio(gpio) < 0)
@@ -151,7 +142,7 @@ int omap_get_gpio_datain(int gpio)
 	reg = bank->base;
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
-		reg += OMAP24XX_GPIO_DATAIN;
+		reg += OMAP_GPIO_DATAIN;
 		break;
 	default:
 		return -EINVAL;
@@ -160,7 +151,7 @@ int omap_get_gpio_datain(int gpio)
 			& (1 << get_gpio_index(gpio))) != 0;
 }
 
-static void _reset_gpio(struct gpio_bank *bank, int gpio)
+static void _reset_gpio(const struct gpio_bank *bank, int gpio)
 {
 	_set_gpio_direction(bank, get_gpio_index(gpio), 1);
 }
@@ -175,7 +166,7 @@ int omap_request_gpio(int gpio)
 
 void omap_free_gpio(int gpio)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
diff --git a/arch/arm/cpu/armv7/omap3/Makefile b/arch/arm/cpu/armv7/omap3/Makefile
index 522bcd2..8e85891 100644
--- a/arch/arm/cpu/armv7/omap3/Makefile
+++ b/arch/arm/cpu/armv7/omap3/Makefile
@@ -29,7 +29,6 @@ SOBJS	:= lowlevel_init.o
 
 COBJS	+= board.o
 COBJS	+= clock.o
-COBJS	+= gpio.o
 COBJS	+= mem.o
 COBJS	+= sys_info.o
 
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 98519a9..bce3ee6 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -38,12 +38,24 @@
 #include <asm/arch/mem.h>
 #include <asm/cache.h>
 #include <asm/armv7.h>
+#include <asm/arch/gpio.h>
 
 /* Declarations */
 extern omap3_sysinfo sysinfo;
 static void omap3_setup_aux_cr(void);
 static void omap3_invalidate_l2_cache_secure(void);
 
+static const struct gpio_bank gpio_bank_34xx[6] = {
+	{ (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX },
+};
+
+const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;
+
 /******************************************************************************
  * Routine: delay
  * Description: spinning delay to use before udelay works
diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index 17e731a..08fc949 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -33,12 +33,24 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/sizes.h>
 #include <asm/arch/emif.h>
+#include <asm/arch/gpio.h>
 #include "omap4_mux_data.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 u32 *const omap4_revision = (u32 *)OMAP4_SRAM_SCRATCH_OMAP4_REV;
 
+static const struct gpio_bank gpio_bank_44xx[6] = {
+	{ (void *)OMAP44XX_GPIO1_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO2_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO3_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO4_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO5_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO6_BASE, METHOD_GPIO_24XX },
+};
+
+const struct gpio_bank *const omap_gpio_bank = gpio_bank_44xx;
+
 #ifdef CONFIG_SPL_BUILD
 /*
  * We use static variables because global data is not ready yet.
diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c
index f1e233a..660b329 100644
--- a/arch/arm/cpu/armv7/omap4/clocks.c
+++ b/arch/arm/cpu/armv7/omap4/clocks.c
@@ -830,9 +830,9 @@ void prcm_init(void)
 	case OMAP_INIT_CONTEXT_SPL:
 	case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR:
 	case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH:
+		enable_basic_clocks();
 		scale_vcores();
 		setup_dplls();
-		enable_basic_clocks();
 		setup_non_essential_dplls();
 		enable_non_essential_clocks();
 		break;
diff --git a/arch/arm/include/asm/arch-omap3/cpu.h b/arch/arm/include/asm/arch-omap3/cpu.h
index e944de7..08a725d 100644
--- a/arch/arm/include/asm/arch-omap3/cpu.h
+++ b/arch/arm/include/asm/arch-omap3/cpu.h
@@ -498,4 +498,30 @@ struct pm {
 /* MUSB base */
 #define MUSB_BASE		(OMAP34XX_CORE_L4_IO_BASE + 0xAB000)
 
+/* OMAP3 GPIO registers */
+#define OMAP_GPIO_REVISION		0x0000
+#define OMAP_GPIO_SYSCONFIG		0x0010
+#define OMAP_GPIO_SYSSTATUS		0x0014
+#define OMAP_GPIO_IRQSTATUS1		0x0018
+#define OMAP_GPIO_IRQSTATUS2		0x0028
+#define OMAP_GPIO_IRQENABLE2		0x002c
+#define OMAP_GPIO_IRQENABLE1		0x001c
+#define OMAP_GPIO_WAKE_EN		0x0020
+#define OMAP_GPIO_CTRL			0x0030
+#define OMAP_GPIO_OE			0x0034
+#define OMAP_GPIO_DATAIN		0x0038
+#define OMAP_GPIO_DATAOUT		0x003c
+#define OMAP_GPIO_LEVELDETECT0		0x0040
+#define OMAP_GPIO_LEVELDETECT1		0x0044
+#define OMAP_GPIO_RISINGDETECT		0x0048
+#define OMAP_GPIO_FALLINGDETECT		0x004c
+#define OMAP_GPIO_DEBOUNCE_EN		0x0050
+#define OMAP_GPIO_DEBOUNCE_VAL		0x0054
+#define OMAP_GPIO_CLEARIRQENABLE1	0x0060
+#define OMAP_GPIO_SETIRQENABLE1		0x0064
+#define OMAP_GPIO_CLEARWKUENA		0x0080
+#define OMAP_GPIO_SETWKUENA		0x0084
+#define OMAP_GPIO_CLEARDATAOUT		0x0090
+#define OMAP_GPIO_SETDATAOUT		0x0094
+
 #endif /* _CPU_H */
diff --git a/arch/arm/include/asm/arch-omap3/gpio.h b/arch/arm/include/asm/arch-omap3/gpio.h
index 30f633c..8bba3b0 100644
--- a/arch/arm/include/asm/arch-omap3/gpio.h
+++ b/arch/arm/include/asm/arch-omap3/gpio.h
@@ -35,52 +35,16 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#ifndef _GPIO_H
-#define _GPIO_H
+#ifndef _GPIO_OMAP3_H
+#define _GPIO_OMAP3_H
 
-#define OMAP24XX_GPIO_REVISION		0x0000
-#define OMAP24XX_GPIO_SYSCONFIG		0x0010
-#define OMAP24XX_GPIO_SYSSTATUS		0x0014
-#define OMAP24XX_GPIO_IRQSTATUS1	0x0018
-#define OMAP24XX_GPIO_IRQSTATUS2	0x0028
-#define OMAP24XX_GPIO_IRQENABLE2	0x002c
-#define OMAP24XX_GPIO_IRQENABLE1	0x001c
-#define OMAP24XX_GPIO_WAKE_EN		0x0020
-#define OMAP24XX_GPIO_CTRL		0x0030
-#define OMAP24XX_GPIO_OE		0x0034
-#define OMAP24XX_GPIO_DATAIN		0x0038
-#define OMAP24XX_GPIO_DATAOUT		0x003c
-#define OMAP24XX_GPIO_LEVELDETECT0	0x0040
-#define OMAP24XX_GPIO_LEVELDETECT1	0x0044
-#define OMAP24XX_GPIO_RISINGDETECT	0x0048
-#define OMAP24XX_GPIO_FALLINGDETECT	0x004c
-#define OMAP24XX_GPIO_DEBOUNCE_EN	0x0050
-#define OMAP24XX_GPIO_DEBOUNCE_VAL	0x0054
-#define OMAP24XX_GPIO_CLEARIRQENABLE1	0x0060
-#define OMAP24XX_GPIO_SETIRQENABLE1	0x0064
-#define OMAP24XX_GPIO_CLEARWKUENA	0x0080
-#define OMAP24XX_GPIO_SETWKUENA		0x0084
-#define OMAP24XX_GPIO_CLEARDATAOUT	0x0090
-#define OMAP24XX_GPIO_SETDATAOUT	0x0094
+#include <asm/omap_gpio.h>
 
-struct gpio_bank {
-	void *base;
-	int method;
-};
+#define OMAP34XX_GPIO1_BASE		0x48310000
+#define OMAP34XX_GPIO2_BASE		0x49050000
+#define OMAP34XX_GPIO3_BASE		0x49052000
+#define OMAP34XX_GPIO4_BASE		0x49054000
+#define OMAP34XX_GPIO5_BASE		0x49056000
+#define OMAP34XX_GPIO6_BASE		0x49058000
 
-#define METHOD_GPIO_24XX	4
-
-/* This is the interface */
-
-/* Request a gpio before using it */
-int omap_request_gpio(int gpio);
-/* Reset and free a gpio after using it */
-void omap_free_gpio(int gpio);
-/* Sets the gpio as input or output */
-void omap_set_gpio_direction(int gpio, int is_input);
-/* Set or clear a gpio output */
-void omap_set_gpio_dataout(int gpio, int enable);
-/* Get the value of a gpio input */
-int omap_get_gpio_datain(int gpio);
-
-#endif /* _GPIO_H_ */
+#endif /* _GPIO_OMAP3_H */
diff --git a/arch/arm/include/asm/arch-omap3/omap3.h b/arch/arm/include/asm/arch-omap3/omap3.h
index d9d49da..230eaad 100644
--- a/arch/arm/include/asm/arch-omap3/omap3.h
+++ b/arch/arm/include/asm/arch-omap3/omap3.h
@@ -100,14 +100,6 @@ struct s32ktimer {
 
 #endif /* __ASSEMBLY__ */
 
-/* OMAP3 GPIO registers */
-#define OMAP34XX_GPIO1_BASE		0x48310000
-#define OMAP34XX_GPIO2_BASE		0x49050000
-#define OMAP34XX_GPIO3_BASE		0x49052000
-#define OMAP34XX_GPIO4_BASE		0x49054000
-#define OMAP34XX_GPIO5_BASE		0x49056000
-#define OMAP34XX_GPIO6_BASE		0x49058000
-
 #ifndef __ASSEMBLY__
 struct gpio {
 	unsigned char res1[0x34];
diff --git a/arch/arm/include/asm/arch-omap4/cpu.h b/arch/arm/include/asm/arch-omap4/cpu.h
index 7d5748a..08b9c99 100644
--- a/arch/arm/include/asm/arch-omap4/cpu.h
+++ b/arch/arm/include/asm/arch-omap4/cpu.h
@@ -142,4 +142,30 @@ struct watchdog {
 /* MUSB base */
 #define MUSB_BASE		(OMAP44XX_L4_CORE_BASE + 0xAB000)
 
+/* OMAP4 GPIO registers */
+#define OMAP_GPIO_REVISION		0x0000
+#define OMAP_GPIO_SYSCONFIG		0x0010
+#define OMAP_GPIO_SYSSTATUS		0x0114
+#define OMAP_GPIO_IRQSTATUS1		0x0118
+#define OMAP_GPIO_IRQSTATUS2		0x0128
+#define OMAP_GPIO_IRQENABLE2		0x012c
+#define OMAP_GPIO_IRQENABLE1		0x011c
+#define OMAP_GPIO_WAKE_EN		0x0120
+#define OMAP_GPIO_CTRL			0x0130
+#define OMAP_GPIO_OE			0x0134
+#define OMAP_GPIO_DATAIN		0x0138
+#define OMAP_GPIO_DATAOUT		0x013c
+#define OMAP_GPIO_LEVELDETECT0		0x0140
+#define OMAP_GPIO_LEVELDETECT1		0x0144
+#define OMAP_GPIO_RISINGDETECT		0x0148
+#define OMAP_GPIO_FALLINGDETECT		0x014c
+#define OMAP_GPIO_DEBOUNCE_EN		0x0150
+#define OMAP_GPIO_DEBOUNCE_VAL		0x0154
+#define OMAP_GPIO_CLEARIRQENABLE1	0x0160
+#define OMAP_GPIO_SETIRQENABLE1		0x0164
+#define OMAP_GPIO_CLEARWKUENA		0x0180
+#define OMAP_GPIO_SETWKUENA		0x0184
+#define OMAP_GPIO_CLEARDATAOUT		0x0190
+#define OMAP_GPIO_SETDATAOUT		0x0194
+
 #endif /* _CPU_H */
diff --git a/arch/arm/include/asm/arch-omap4/gpio.h b/arch/arm/include/asm/arch-omap4/gpio.h
new file mode 100644
index 0000000..26f19d1
--- /dev/null
+++ b/arch/arm/include/asm/arch-omap4/gpio.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2009 Wind River Systems, Inc.
+ * Tom Rix <Tom.Rix@windriver.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * This work is derived from the linux 2.6.27 kernel source
+ * To fetch, use the kernel repository
+ * git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
+ * Use the v2.6.27 tag.
+ *
+ * Below is the original's header including its copyright
+ *
+ *  linux/arch/arm/plat-omap/gpio.c
+ *
+ * Support functions for OMAP GPIO
+ *
+ * Copyright (C) 2003-2005 Nokia Corporation
+ * Written by Juha Yrj??l?? <juha.yrjola@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef _GPIO_OMAP4_H
+#define _GPIO_OMAP4_H
+
+#include <asm/omap_gpio.h>
+
+#define OMAP44XX_GPIO1_BASE		0x4A310000
+#define OMAP44XX_GPIO2_BASE		0x48055000
+#define OMAP44XX_GPIO3_BASE		0x48057000
+#define OMAP44XX_GPIO4_BASE		0x48059000
+#define OMAP44XX_GPIO5_BASE		0x4805B000
+#define OMAP44XX_GPIO6_BASE		0x4805D000
+
+#endif /* _GPIO_OMAP4_H */
diff --git a/arch/arm/include/asm/arch-omap3/gpio.h b/arch/arm/include/asm/omap_gpio.h
similarity index 67%
copy from arch/arm/include/asm/arch-omap3/gpio.h
copy to arch/arm/include/asm/omap_gpio.h
index 30f633c..3089e1c 100644
--- a/arch/arm/include/asm/arch-omap3/gpio.h
+++ b/arch/arm/include/asm/omap_gpio.h
@@ -38,36 +38,15 @@
 #ifndef _GPIO_H
 #define _GPIO_H
 
-#define OMAP24XX_GPIO_REVISION		0x0000
-#define OMAP24XX_GPIO_SYSCONFIG		0x0010
-#define OMAP24XX_GPIO_SYSSTATUS		0x0014
-#define OMAP24XX_GPIO_IRQSTATUS1	0x0018
-#define OMAP24XX_GPIO_IRQSTATUS2	0x0028
-#define OMAP24XX_GPIO_IRQENABLE2	0x002c
-#define OMAP24XX_GPIO_IRQENABLE1	0x001c
-#define OMAP24XX_GPIO_WAKE_EN		0x0020
-#define OMAP24XX_GPIO_CTRL		0x0030
-#define OMAP24XX_GPIO_OE		0x0034
-#define OMAP24XX_GPIO_DATAIN		0x0038
-#define OMAP24XX_GPIO_DATAOUT		0x003c
-#define OMAP24XX_GPIO_LEVELDETECT0	0x0040
-#define OMAP24XX_GPIO_LEVELDETECT1	0x0044
-#define OMAP24XX_GPIO_RISINGDETECT	0x0048
-#define OMAP24XX_GPIO_FALLINGDETECT	0x004c
-#define OMAP24XX_GPIO_DEBOUNCE_EN	0x0050
-#define OMAP24XX_GPIO_DEBOUNCE_VAL	0x0054
-#define OMAP24XX_GPIO_CLEARIRQENABLE1	0x0060
-#define OMAP24XX_GPIO_SETIRQENABLE1	0x0064
-#define OMAP24XX_GPIO_CLEARWKUENA	0x0080
-#define OMAP24XX_GPIO_SETWKUENA		0x0084
-#define OMAP24XX_GPIO_CLEARDATAOUT	0x0090
-#define OMAP24XX_GPIO_SETDATAOUT	0x0094
+#include <asm/arch/cpu.h>
 
 struct gpio_bank {
 	void *base;
 	int method;
 };
 
+extern const struct gpio_bank *const omap_gpio_bank;
+
 #define METHOD_GPIO_24XX	4
 
 /* This is the interface */
diff --git a/board/pandora/pandora.c b/board/pandora/pandora.c
index 992e9f7..fe363b2 100644
--- a/board/pandora/pandora.c
+++ b/board/pandora/pandora.c
@@ -34,6 +34,7 @@
 #include <asm/io.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/arch/gpio.h>
 #include <asm/mach-types.h>
 #include "pandora.h"
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH v3 3/5] omap: reuse omap3 gpio support in omap4
  2011-07-29 17:03   ` [U-Boot] [PATCH " Aneesh V
@ 2011-07-29 17:09     ` Aneesh V
  2011-08-01  6:30     ` [U-Boot] [PATCH] omap: fix gpio related build breaks Aneesh V
  1 sibling, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-07-29 17:09 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Aneesh V <aneesh@ti.com>
---
V2:
* Added a new file that was accidentally missing in v1

V3:
* Fix build break for other boards by restoring the
  old header files <asm/arch/gpio.h>

Resending with v3 TAG in the subject line.
---
 arch/arm/cpu/armv7/omap-common/Makefile            |    1 +
 arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c   |   39 +++++--------
 arch/arm/cpu/armv7/omap3/Makefile                  |    1 -
 arch/arm/cpu/armv7/omap3/board.c                   |   12 ++++
 arch/arm/cpu/armv7/omap4/board.c                   |   12 ++++
 arch/arm/cpu/armv7/omap4/clocks.c                  |    2 +-
 arch/arm/include/asm/arch-omap3/cpu.h              |   26 +++++++++
 arch/arm/include/asm/arch-omap3/gpio.h             |   56 ++++----------------
 arch/arm/include/asm/arch-omap3/omap3.h            |    8 ---
 arch/arm/include/asm/arch-omap4/cpu.h              |   26 +++++++++
 arch/arm/include/asm/arch-omap4/gpio.h             |   50 +++++++++++++++++
 .../include/asm/{arch-omap3/gpio.h => omap_gpio.h} |   27 +--------
 board/pandora/pandora.c                            |    1 +
 13 files changed, 157 insertions(+), 104 deletions(-)
 rename arch/arm/cpu/armv7/{omap3 => omap-common}/gpio.c (77%)
 create mode 100644 arch/arm/include/asm/arch-omap4/gpio.h
 copy arch/arm/include/asm/{arch-omap3/gpio.h => omap_gpio.h} (67%)

diff --git a/arch/arm/cpu/armv7/omap-common/Makefile b/arch/arm/cpu/armv7/omap-common/Makefile
index 0708796..ea9f8ec 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -29,6 +29,7 @@ SOBJS	:= reset.o
 
 COBJS	:= timer.o
 COBJS	+= utils.o
+COBJS	+= gpio.o
 
 ifdef CONFIG_SPL_BUILD
 COBJS	+= spl.o
diff --git a/arch/arm/cpu/armv7/omap3/gpio.c b/arch/arm/cpu/armv7/omap-common/gpio.c
similarity index 77%
rename from arch/arm/cpu/armv7/omap3/gpio.c
rename to arch/arm/cpu/armv7/omap-common/gpio.c
index aeb6066..2fcaf5a 100644
--- a/arch/arm/cpu/armv7/omap3/gpio.c
+++ b/arch/arm/cpu/armv7/omap-common/gpio.c
@@ -40,20 +40,9 @@
 #include <asm/io.h>
 #include <asm/errno.h>
 
-static struct gpio_bank gpio_bank_34xx[6] = {
-	{ (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX },
-	{ (void *)OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX },
-};
-
-static struct gpio_bank *gpio_bank = &gpio_bank_34xx[0];
-
-static inline struct gpio_bank *get_gpio_bank(int gpio)
+static inline const struct gpio_bank *get_gpio_bank(int gpio)
 {
-	return &gpio_bank[gpio >> 5];
+	return &omap_gpio_bank[gpio >> 5];
 }
 
 static inline int get_gpio_index(int gpio)
@@ -79,14 +68,15 @@ static int check_gpio(int gpio)
 	return 0;
 }
 
-static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
+static void _set_gpio_direction(const struct gpio_bank *bank, int gpio,
+				int is_input)
 {
 	void *reg = bank->base;
 	u32 l;
 
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
-		reg += OMAP24XX_GPIO_OE;
+		reg += OMAP_GPIO_OE;
 		break;
 	default:
 		return;
@@ -101,7 +91,7 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
 
 void omap_set_gpio_direction(int gpio, int is_input)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
@@ -109,7 +99,8 @@ void omap_set_gpio_direction(int gpio, int is_input)
 	_set_gpio_direction(bank, get_gpio_index(gpio), is_input);
 }
 
-static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
+static void _set_gpio_dataout(const struct gpio_bank *bank, int gpio,
+				int enable)
 {
 	void *reg = bank->base;
 	u32 l = 0;
@@ -117,9 +108,9 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
 		if (enable)
-			reg += OMAP24XX_GPIO_SETDATAOUT;
+			reg += OMAP_GPIO_SETDATAOUT;
 		else
-			reg += OMAP24XX_GPIO_CLEARDATAOUT;
+			reg += OMAP_GPIO_CLEARDATAOUT;
 		l = 1 << gpio;
 		break;
 	default:
@@ -132,7 +123,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
 
 void omap_set_gpio_dataout(int gpio, int enable)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
@@ -142,7 +133,7 @@ void omap_set_gpio_dataout(int gpio, int enable)
 
 int omap_get_gpio_datain(int gpio)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 	void *reg;
 
 	if (check_gpio(gpio) < 0)
@@ -151,7 +142,7 @@ int omap_get_gpio_datain(int gpio)
 	reg = bank->base;
 	switch (bank->method) {
 	case METHOD_GPIO_24XX:
-		reg += OMAP24XX_GPIO_DATAIN;
+		reg += OMAP_GPIO_DATAIN;
 		break;
 	default:
 		return -EINVAL;
@@ -160,7 +151,7 @@ int omap_get_gpio_datain(int gpio)
 			& (1 << get_gpio_index(gpio))) != 0;
 }
 
-static void _reset_gpio(struct gpio_bank *bank, int gpio)
+static void _reset_gpio(const struct gpio_bank *bank, int gpio)
 {
 	_set_gpio_direction(bank, get_gpio_index(gpio), 1);
 }
@@ -175,7 +166,7 @@ int omap_request_gpio(int gpio)
 
 void omap_free_gpio(int gpio)
 {
-	struct gpio_bank *bank;
+	const struct gpio_bank *bank;
 
 	if (check_gpio(gpio) < 0)
 		return;
diff --git a/arch/arm/cpu/armv7/omap3/Makefile b/arch/arm/cpu/armv7/omap3/Makefile
index 522bcd2..8e85891 100644
--- a/arch/arm/cpu/armv7/omap3/Makefile
+++ b/arch/arm/cpu/armv7/omap3/Makefile
@@ -29,7 +29,6 @@ SOBJS	:= lowlevel_init.o
 
 COBJS	+= board.o
 COBJS	+= clock.o
-COBJS	+= gpio.o
 COBJS	+= mem.o
 COBJS	+= sys_info.o
 
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 98519a9..bce3ee6 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -38,12 +38,24 @@
 #include <asm/arch/mem.h>
 #include <asm/cache.h>
 #include <asm/armv7.h>
+#include <asm/arch/gpio.h>
 
 /* Declarations */
 extern omap3_sysinfo sysinfo;
 static void omap3_setup_aux_cr(void);
 static void omap3_invalidate_l2_cache_secure(void);
 
+static const struct gpio_bank gpio_bank_34xx[6] = {
+	{ (void *)OMAP34XX_GPIO1_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO2_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO3_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO4_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO5_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP34XX_GPIO6_BASE, METHOD_GPIO_24XX },
+};
+
+const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;
+
 /******************************************************************************
  * Routine: delay
  * Description: spinning delay to use before udelay works
diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index 17e731a..08fc949 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -33,12 +33,24 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/sizes.h>
 #include <asm/arch/emif.h>
+#include <asm/arch/gpio.h>
 #include "omap4_mux_data.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 u32 *const omap4_revision = (u32 *)OMAP4_SRAM_SCRATCH_OMAP4_REV;
 
+static const struct gpio_bank gpio_bank_44xx[6] = {
+	{ (void *)OMAP44XX_GPIO1_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO2_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO3_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO4_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO5_BASE, METHOD_GPIO_24XX },
+	{ (void *)OMAP44XX_GPIO6_BASE, METHOD_GPIO_24XX },
+};
+
+const struct gpio_bank *const omap_gpio_bank = gpio_bank_44xx;
+
 #ifdef CONFIG_SPL_BUILD
 /*
  * We use static variables because global data is not ready yet.
diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c
index f1e233a..660b329 100644
--- a/arch/arm/cpu/armv7/omap4/clocks.c
+++ b/arch/arm/cpu/armv7/omap4/clocks.c
@@ -830,9 +830,9 @@ void prcm_init(void)
 	case OMAP_INIT_CONTEXT_SPL:
 	case OMAP_INIT_CONTEXT_UBOOT_FROM_NOR:
 	case OMAP_INIT_CONTEXT_UBOOT_AFTER_CH:
+		enable_basic_clocks();
 		scale_vcores();
 		setup_dplls();
-		enable_basic_clocks();
 		setup_non_essential_dplls();
 		enable_non_essential_clocks();
 		break;
diff --git a/arch/arm/include/asm/arch-omap3/cpu.h b/arch/arm/include/asm/arch-omap3/cpu.h
index e944de7..08a725d 100644
--- a/arch/arm/include/asm/arch-omap3/cpu.h
+++ b/arch/arm/include/asm/arch-omap3/cpu.h
@@ -498,4 +498,30 @@ struct pm {
 /* MUSB base */
 #define MUSB_BASE		(OMAP34XX_CORE_L4_IO_BASE + 0xAB000)
 
+/* OMAP3 GPIO registers */
+#define OMAP_GPIO_REVISION		0x0000
+#define OMAP_GPIO_SYSCONFIG		0x0010
+#define OMAP_GPIO_SYSSTATUS		0x0014
+#define OMAP_GPIO_IRQSTATUS1		0x0018
+#define OMAP_GPIO_IRQSTATUS2		0x0028
+#define OMAP_GPIO_IRQENABLE2		0x002c
+#define OMAP_GPIO_IRQENABLE1		0x001c
+#define OMAP_GPIO_WAKE_EN		0x0020
+#define OMAP_GPIO_CTRL			0x0030
+#define OMAP_GPIO_OE			0x0034
+#define OMAP_GPIO_DATAIN		0x0038
+#define OMAP_GPIO_DATAOUT		0x003c
+#define OMAP_GPIO_LEVELDETECT0		0x0040
+#define OMAP_GPIO_LEVELDETECT1		0x0044
+#define OMAP_GPIO_RISINGDETECT		0x0048
+#define OMAP_GPIO_FALLINGDETECT		0x004c
+#define OMAP_GPIO_DEBOUNCE_EN		0x0050
+#define OMAP_GPIO_DEBOUNCE_VAL		0x0054
+#define OMAP_GPIO_CLEARIRQENABLE1	0x0060
+#define OMAP_GPIO_SETIRQENABLE1		0x0064
+#define OMAP_GPIO_CLEARWKUENA		0x0080
+#define OMAP_GPIO_SETWKUENA		0x0084
+#define OMAP_GPIO_CLEARDATAOUT		0x0090
+#define OMAP_GPIO_SETDATAOUT		0x0094
+
 #endif /* _CPU_H */
diff --git a/arch/arm/include/asm/arch-omap3/gpio.h b/arch/arm/include/asm/arch-omap3/gpio.h
index 30f633c..8bba3b0 100644
--- a/arch/arm/include/asm/arch-omap3/gpio.h
+++ b/arch/arm/include/asm/arch-omap3/gpio.h
@@ -35,52 +35,16 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#ifndef _GPIO_H
-#define _GPIO_H
+#ifndef _GPIO_OMAP3_H
+#define _GPIO_OMAP3_H
 
-#define OMAP24XX_GPIO_REVISION		0x0000
-#define OMAP24XX_GPIO_SYSCONFIG		0x0010
-#define OMAP24XX_GPIO_SYSSTATUS		0x0014
-#define OMAP24XX_GPIO_IRQSTATUS1	0x0018
-#define OMAP24XX_GPIO_IRQSTATUS2	0x0028
-#define OMAP24XX_GPIO_IRQENABLE2	0x002c
-#define OMAP24XX_GPIO_IRQENABLE1	0x001c
-#define OMAP24XX_GPIO_WAKE_EN		0x0020
-#define OMAP24XX_GPIO_CTRL		0x0030
-#define OMAP24XX_GPIO_OE		0x0034
-#define OMAP24XX_GPIO_DATAIN		0x0038
-#define OMAP24XX_GPIO_DATAOUT		0x003c
-#define OMAP24XX_GPIO_LEVELDETECT0	0x0040
-#define OMAP24XX_GPIO_LEVELDETECT1	0x0044
-#define OMAP24XX_GPIO_RISINGDETECT	0x0048
-#define OMAP24XX_GPIO_FALLINGDETECT	0x004c
-#define OMAP24XX_GPIO_DEBOUNCE_EN	0x0050
-#define OMAP24XX_GPIO_DEBOUNCE_VAL	0x0054
-#define OMAP24XX_GPIO_CLEARIRQENABLE1	0x0060
-#define OMAP24XX_GPIO_SETIRQENABLE1	0x0064
-#define OMAP24XX_GPIO_CLEARWKUENA	0x0080
-#define OMAP24XX_GPIO_SETWKUENA		0x0084
-#define OMAP24XX_GPIO_CLEARDATAOUT	0x0090
-#define OMAP24XX_GPIO_SETDATAOUT	0x0094
+#include <asm/omap_gpio.h>
 
-struct gpio_bank {
-	void *base;
-	int method;
-};
+#define OMAP34XX_GPIO1_BASE		0x48310000
+#define OMAP34XX_GPIO2_BASE		0x49050000
+#define OMAP34XX_GPIO3_BASE		0x49052000
+#define OMAP34XX_GPIO4_BASE		0x49054000
+#define OMAP34XX_GPIO5_BASE		0x49056000
+#define OMAP34XX_GPIO6_BASE		0x49058000
 
-#define METHOD_GPIO_24XX	4
-
-/* This is the interface */
-
-/* Request a gpio before using it */
-int omap_request_gpio(int gpio);
-/* Reset and free a gpio after using it */
-void omap_free_gpio(int gpio);
-/* Sets the gpio as input or output */
-void omap_set_gpio_direction(int gpio, int is_input);
-/* Set or clear a gpio output */
-void omap_set_gpio_dataout(int gpio, int enable);
-/* Get the value of a gpio input */
-int omap_get_gpio_datain(int gpio);
-
-#endif /* _GPIO_H_ */
+#endif /* _GPIO_OMAP3_H */
diff --git a/arch/arm/include/asm/arch-omap3/omap3.h b/arch/arm/include/asm/arch-omap3/omap3.h
index d9d49da..230eaad 100644
--- a/arch/arm/include/asm/arch-omap3/omap3.h
+++ b/arch/arm/include/asm/arch-omap3/omap3.h
@@ -100,14 +100,6 @@ struct s32ktimer {
 
 #endif /* __ASSEMBLY__ */
 
-/* OMAP3 GPIO registers */
-#define OMAP34XX_GPIO1_BASE		0x48310000
-#define OMAP34XX_GPIO2_BASE		0x49050000
-#define OMAP34XX_GPIO3_BASE		0x49052000
-#define OMAP34XX_GPIO4_BASE		0x49054000
-#define OMAP34XX_GPIO5_BASE		0x49056000
-#define OMAP34XX_GPIO6_BASE		0x49058000
-
 #ifndef __ASSEMBLY__
 struct gpio {
 	unsigned char res1[0x34];
diff --git a/arch/arm/include/asm/arch-omap4/cpu.h b/arch/arm/include/asm/arch-omap4/cpu.h
index 7d5748a..08b9c99 100644
--- a/arch/arm/include/asm/arch-omap4/cpu.h
+++ b/arch/arm/include/asm/arch-omap4/cpu.h
@@ -142,4 +142,30 @@ struct watchdog {
 /* MUSB base */
 #define MUSB_BASE		(OMAP44XX_L4_CORE_BASE + 0xAB000)
 
+/* OMAP4 GPIO registers */
+#define OMAP_GPIO_REVISION		0x0000
+#define OMAP_GPIO_SYSCONFIG		0x0010
+#define OMAP_GPIO_SYSSTATUS		0x0114
+#define OMAP_GPIO_IRQSTATUS1		0x0118
+#define OMAP_GPIO_IRQSTATUS2		0x0128
+#define OMAP_GPIO_IRQENABLE2		0x012c
+#define OMAP_GPIO_IRQENABLE1		0x011c
+#define OMAP_GPIO_WAKE_EN		0x0120
+#define OMAP_GPIO_CTRL			0x0130
+#define OMAP_GPIO_OE			0x0134
+#define OMAP_GPIO_DATAIN		0x0138
+#define OMAP_GPIO_DATAOUT		0x013c
+#define OMAP_GPIO_LEVELDETECT0		0x0140
+#define OMAP_GPIO_LEVELDETECT1		0x0144
+#define OMAP_GPIO_RISINGDETECT		0x0148
+#define OMAP_GPIO_FALLINGDETECT		0x014c
+#define OMAP_GPIO_DEBOUNCE_EN		0x0150
+#define OMAP_GPIO_DEBOUNCE_VAL		0x0154
+#define OMAP_GPIO_CLEARIRQENABLE1	0x0160
+#define OMAP_GPIO_SETIRQENABLE1		0x0164
+#define OMAP_GPIO_CLEARWKUENA		0x0180
+#define OMAP_GPIO_SETWKUENA		0x0184
+#define OMAP_GPIO_CLEARDATAOUT		0x0190
+#define OMAP_GPIO_SETDATAOUT		0x0194
+
 #endif /* _CPU_H */
diff --git a/arch/arm/include/asm/arch-omap4/gpio.h b/arch/arm/include/asm/arch-omap4/gpio.h
new file mode 100644
index 0000000..26f19d1
--- /dev/null
+++ b/arch/arm/include/asm/arch-omap4/gpio.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2009 Wind River Systems, Inc.
+ * Tom Rix <Tom.Rix@windriver.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * This work is derived from the linux 2.6.27 kernel source
+ * To fetch, use the kernel repository
+ * git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
+ * Use the v2.6.27 tag.
+ *
+ * Below is the original's header including its copyright
+ *
+ *  linux/arch/arm/plat-omap/gpio.c
+ *
+ * Support functions for OMAP GPIO
+ *
+ * Copyright (C) 2003-2005 Nokia Corporation
+ * Written by Juha Yrj??l?? <juha.yrjola@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef _GPIO_OMAP4_H
+#define _GPIO_OMAP4_H
+
+#include <asm/omap_gpio.h>
+
+#define OMAP44XX_GPIO1_BASE		0x4A310000
+#define OMAP44XX_GPIO2_BASE		0x48055000
+#define OMAP44XX_GPIO3_BASE		0x48057000
+#define OMAP44XX_GPIO4_BASE		0x48059000
+#define OMAP44XX_GPIO5_BASE		0x4805B000
+#define OMAP44XX_GPIO6_BASE		0x4805D000
+
+#endif /* _GPIO_OMAP4_H */
diff --git a/arch/arm/include/asm/arch-omap3/gpio.h b/arch/arm/include/asm/omap_gpio.h
similarity index 67%
copy from arch/arm/include/asm/arch-omap3/gpio.h
copy to arch/arm/include/asm/omap_gpio.h
index 30f633c..3089e1c 100644
--- a/arch/arm/include/asm/arch-omap3/gpio.h
+++ b/arch/arm/include/asm/omap_gpio.h
@@ -38,36 +38,15 @@
 #ifndef _GPIO_H
 #define _GPIO_H
 
-#define OMAP24XX_GPIO_REVISION		0x0000
-#define OMAP24XX_GPIO_SYSCONFIG		0x0010
-#define OMAP24XX_GPIO_SYSSTATUS		0x0014
-#define OMAP24XX_GPIO_IRQSTATUS1	0x0018
-#define OMAP24XX_GPIO_IRQSTATUS2	0x0028
-#define OMAP24XX_GPIO_IRQENABLE2	0x002c
-#define OMAP24XX_GPIO_IRQENABLE1	0x001c
-#define OMAP24XX_GPIO_WAKE_EN		0x0020
-#define OMAP24XX_GPIO_CTRL		0x0030
-#define OMAP24XX_GPIO_OE		0x0034
-#define OMAP24XX_GPIO_DATAIN		0x0038
-#define OMAP24XX_GPIO_DATAOUT		0x003c
-#define OMAP24XX_GPIO_LEVELDETECT0	0x0040
-#define OMAP24XX_GPIO_LEVELDETECT1	0x0044
-#define OMAP24XX_GPIO_RISINGDETECT	0x0048
-#define OMAP24XX_GPIO_FALLINGDETECT	0x004c
-#define OMAP24XX_GPIO_DEBOUNCE_EN	0x0050
-#define OMAP24XX_GPIO_DEBOUNCE_VAL	0x0054
-#define OMAP24XX_GPIO_CLEARIRQENABLE1	0x0060
-#define OMAP24XX_GPIO_SETIRQENABLE1	0x0064
-#define OMAP24XX_GPIO_CLEARWKUENA	0x0080
-#define OMAP24XX_GPIO_SETWKUENA		0x0084
-#define OMAP24XX_GPIO_CLEARDATAOUT	0x0090
-#define OMAP24XX_GPIO_SETDATAOUT	0x0094
+#include <asm/arch/cpu.h>
 
 struct gpio_bank {
 	void *base;
 	int method;
 };
 
+extern const struct gpio_bank *const omap_gpio_bank;
+
 #define METHOD_GPIO_24XX	4
 
 /* This is the interface */
diff --git a/board/pandora/pandora.c b/board/pandora/pandora.c
index 992e9f7..fe363b2 100644
--- a/board/pandora/pandora.c
+++ b/board/pandora/pandora.c
@@ -34,6 +34,7 @@
 #include <asm/io.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/arch/gpio.h>
 #include <asm/mach-types.h>
 #include "pandora.h"
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH] omap: fix gpio related build breaks
  2011-07-29 17:03   ` [U-Boot] [PATCH " Aneesh V
  2011-07-29 17:09     ` [U-Boot] [PATCH v3 " Aneesh V
@ 2011-08-01  6:30     ` Aneesh V
  2011-08-05  6:43       ` Aneesh V
                         ` (2 more replies)
  1 sibling, 3 replies; 26+ messages in thread
From: Aneesh V @ 2011-08-01  6:30 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Aneesh V <aneesh@ti.com>
---
Hi Sandeep,
This is an incremental patch to fix the build issues created
by "[PATCH 3/5] omap: reuse omap3 gpio support in omap4"
in the omap4460 series.
---
 arch/arm/cpu/armv7/omap-common/gpio.c   |    2 +-
 arch/arm/cpu/armv7/omap3/board.c        |    2 +-
 arch/arm/cpu/armv7/omap4/board.c        |    2 +-
 arch/arm/include/asm/arch-omap3/gpio.h  |   50 +++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-omap3/omap3.h |    8 -----
 arch/arm/include/asm/arch-omap4/gpio.h  |   50 +++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-omap4/omap4.h |    8 -----
 board/pandora/pandora.c                 |    1 +
 8 files changed, 104 insertions(+), 19 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-omap3/gpio.h
 create mode 100644 arch/arm/include/asm/arch-omap4/gpio.h

diff --git a/arch/arm/cpu/armv7/omap-common/gpio.c b/arch/arm/cpu/armv7/omap-common/gpio.c
index f4c3479..2fcaf5a 100644
--- a/arch/arm/cpu/armv7/omap-common/gpio.c
+++ b/arch/arm/cpu/armv7/omap-common/gpio.c
@@ -36,7 +36,7 @@
  * published by the Free Software Foundation.
  */
 #include <common.h>
-#include <asm/omap_gpio.h>
+#include <asm/arch/gpio.h>
 #include <asm/io.h>
 #include <asm/errno.h>
 
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 4aaf97b..bce3ee6 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -38,7 +38,7 @@
 #include <asm/arch/mem.h>
 #include <asm/cache.h>
 #include <asm/armv7.h>
-#include <asm/omap_gpio.h>
+#include <asm/arch/gpio.h>
 
 /* Declarations */
 extern omap3_sysinfo sysinfo;
diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index 5943d61..8e90545 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -33,7 +33,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/sizes.h>
 #include <asm/arch/emif.h>
-#include <asm/omap_gpio.h>
+#include <asm/arch/gpio.h>
 #include "omap4_mux_data.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/include/asm/arch-omap3/gpio.h b/arch/arm/include/asm/arch-omap3/gpio.h
new file mode 100644
index 0000000..8bba3b0
--- /dev/null
+++ b/arch/arm/include/asm/arch-omap3/gpio.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2009 Wind River Systems, Inc.
+ * Tom Rix <Tom.Rix@windriver.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * This work is derived from the linux 2.6.27 kernel source
+ * To fetch, use the kernel repository
+ * git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
+ * Use the v2.6.27 tag.
+ *
+ * Below is the original's header including its copyright
+ *
+ *  linux/arch/arm/plat-omap/gpio.c
+ *
+ * Support functions for OMAP GPIO
+ *
+ * Copyright (C) 2003-2005 Nokia Corporation
+ * Written by Juha Yrj??l?? <juha.yrjola@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef _GPIO_OMAP3_H
+#define _GPIO_OMAP3_H
+
+#include <asm/omap_gpio.h>
+
+#define OMAP34XX_GPIO1_BASE		0x48310000
+#define OMAP34XX_GPIO2_BASE		0x49050000
+#define OMAP34XX_GPIO3_BASE		0x49052000
+#define OMAP34XX_GPIO4_BASE		0x49054000
+#define OMAP34XX_GPIO5_BASE		0x49056000
+#define OMAP34XX_GPIO6_BASE		0x49058000
+
+#endif /* _GPIO_OMAP3_H */
diff --git a/arch/arm/include/asm/arch-omap3/omap3.h b/arch/arm/include/asm/arch-omap3/omap3.h
index d9d49da..230eaad 100644
--- a/arch/arm/include/asm/arch-omap3/omap3.h
+++ b/arch/arm/include/asm/arch-omap3/omap3.h
@@ -100,14 +100,6 @@ struct s32ktimer {
 
 #endif /* __ASSEMBLY__ */
 
-/* OMAP3 GPIO registers */
-#define OMAP34XX_GPIO1_BASE		0x48310000
-#define OMAP34XX_GPIO2_BASE		0x49050000
-#define OMAP34XX_GPIO3_BASE		0x49052000
-#define OMAP34XX_GPIO4_BASE		0x49054000
-#define OMAP34XX_GPIO5_BASE		0x49056000
-#define OMAP34XX_GPIO6_BASE		0x49058000
-
 #ifndef __ASSEMBLY__
 struct gpio {
 	unsigned char res1[0x34];
diff --git a/arch/arm/include/asm/arch-omap4/gpio.h b/arch/arm/include/asm/arch-omap4/gpio.h
new file mode 100644
index 0000000..26f19d1
--- /dev/null
+++ b/arch/arm/include/asm/arch-omap4/gpio.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2009 Wind River Systems, Inc.
+ * Tom Rix <Tom.Rix@windriver.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * This work is derived from the linux 2.6.27 kernel source
+ * To fetch, use the kernel repository
+ * git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
+ * Use the v2.6.27 tag.
+ *
+ * Below is the original's header including its copyright
+ *
+ *  linux/arch/arm/plat-omap/gpio.c
+ *
+ * Support functions for OMAP GPIO
+ *
+ * Copyright (C) 2003-2005 Nokia Corporation
+ * Written by Juha Yrj??l?? <juha.yrjola@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef _GPIO_OMAP4_H
+#define _GPIO_OMAP4_H
+
+#include <asm/omap_gpio.h>
+
+#define OMAP44XX_GPIO1_BASE		0x4A310000
+#define OMAP44XX_GPIO2_BASE		0x48055000
+#define OMAP44XX_GPIO3_BASE		0x48057000
+#define OMAP44XX_GPIO4_BASE		0x48059000
+#define OMAP44XX_GPIO5_BASE		0x4805B000
+#define OMAP44XX_GPIO6_BASE		0x4805D000
+
+#endif /* _GPIO_OMAP4_H */
diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h
index 9aad0e6..7ff46d7 100644
--- a/arch/arm/include/asm/arch-omap4/omap4.h
+++ b/arch/arm/include/asm/arch-omap4/omap4.h
@@ -153,12 +153,4 @@ struct s32ktimer {
 #define DEV_DATA_PTR_OFFSET	0x18
 #define BOOT_MODE_OFFSET	0x8
 
-/* GPIO */
-#define OMAP44XX_GPIO1_BASE		0x4A310000
-#define OMAP44XX_GPIO2_BASE		0x48055000
-#define OMAP44XX_GPIO3_BASE		0x48057000
-#define OMAP44XX_GPIO4_BASE		0x48059000
-#define OMAP44XX_GPIO5_BASE		0x4805B000
-#define OMAP44XX_GPIO6_BASE		0x4805D000
-
 #endif
diff --git a/board/pandora/pandora.c b/board/pandora/pandora.c
index 992e9f7..0df4570 100644
--- a/board/pandora/pandora.c
+++ b/board/pandora/pandora.c
@@ -33,6 +33,7 @@
 #include <twl4030.h>
 #include <asm/io.h>
 #include <asm/arch/mux.h>
+#include <asm/arch/gpio.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-types.h>
 #include "pandora.h"
-- 
1.7.0.4

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

* [U-Boot] [PATCH] omap: fix gpio related build breaks
  2011-08-01  6:30     ` [U-Boot] [PATCH] omap: fix gpio related build breaks Aneesh V
@ 2011-08-05  6:43       ` Aneesh V
  2011-08-08 14:54       ` Dirk Behme
  2011-08-20 15:30       ` Albert ARIBAUD
  2 siblings, 0 replies; 26+ messages in thread
From: Aneesh V @ 2011-08-05  6:43 UTC (permalink / raw)
  To: u-boot

Hi Sandeep, Albert, Wolfgang,

On Monday 01 August 2011 12:00 PM, Aneesh V wrote:
> Signed-off-by: Aneesh V<aneesh@ti.com>
> ---
> Hi Sandeep,
> This is an incremental patch to fix the build issues created
> by "[PATCH 3/5] omap: reuse omap3 gpio support in omap4"
> in the omap4460 series.

You will need this patch to prevent build break for some OMAP3 boards.
Will you please pull this too if it looks ok?

br,
Aneesh

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

* [U-Boot] [PATCH] omap: fix gpio related build breaks
  2011-08-01  6:30     ` [U-Boot] [PATCH] omap: fix gpio related build breaks Aneesh V
  2011-08-05  6:43       ` Aneesh V
@ 2011-08-08 14:54       ` Dirk Behme
  2011-08-20 15:30       ` Albert ARIBAUD
  2 siblings, 0 replies; 26+ messages in thread
From: Dirk Behme @ 2011-08-08 14:54 UTC (permalink / raw)
  To: u-boot

On 01.08.2011 08:30, Aneesh V wrote:
> Signed-off-by: Aneesh V<aneesh@ti.com>

Acked-by: Dirk Behme <dirk.behme@googlemail.com>

> ---
> Hi Sandeep,
> This is an incremental patch to fix the build issues created
> by "[PATCH 3/5] omap: reuse omap3 gpio support in omap4"
> in the omap4460 series.
> ---
>   arch/arm/cpu/armv7/omap-common/gpio.c   |    2 +-
>   arch/arm/cpu/armv7/omap3/board.c        |    2 +-
>   arch/arm/cpu/armv7/omap4/board.c        |    2 +-
>   arch/arm/include/asm/arch-omap3/gpio.h  |   50 +++++++++++++++++++++++++++++++
>   arch/arm/include/asm/arch-omap3/omap3.h |    8 -----
>   arch/arm/include/asm/arch-omap4/gpio.h  |   50 +++++++++++++++++++++++++++++++
>   arch/arm/include/asm/arch-omap4/omap4.h |    8 -----
>   board/pandora/pandora.c                 |    1 +
>   8 files changed, 104 insertions(+), 19 deletions(-)
>   create mode 100644 arch/arm/include/asm/arch-omap3/gpio.h
>   create mode 100644 arch/arm/include/asm/arch-omap4/gpio.h
>
> diff --git a/arch/arm/cpu/armv7/omap-common/gpio.c b/arch/arm/cpu/armv7/omap-common/gpio.c
> index f4c3479..2fcaf5a 100644
> --- a/arch/arm/cpu/armv7/omap-common/gpio.c
> +++ b/arch/arm/cpu/armv7/omap-common/gpio.c
> @@ -36,7 +36,7 @@
>    * published by the Free Software Foundation.
>    */
>   #include<common.h>
> -#include<asm/omap_gpio.h>
> +#include<asm/arch/gpio.h>
>   #include<asm/io.h>
>   #include<asm/errno.h>
>
> diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
> index 4aaf97b..bce3ee6 100644
> --- a/arch/arm/cpu/armv7/omap3/board.c
> +++ b/arch/arm/cpu/armv7/omap3/board.c
> @@ -38,7 +38,7 @@
>   #include<asm/arch/mem.h>
>   #include<asm/cache.h>
>   #include<asm/armv7.h>
> -#include<asm/omap_gpio.h>
> +#include<asm/arch/gpio.h>
>
>   /* Declarations */
>   extern omap3_sysinfo sysinfo;
> diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
> index 5943d61..8e90545 100644
> --- a/arch/arm/cpu/armv7/omap4/board.c
> +++ b/arch/arm/cpu/armv7/omap4/board.c
> @@ -33,7 +33,7 @@
>   #include<asm/arch/sys_proto.h>
>   #include<asm/sizes.h>
>   #include<asm/arch/emif.h>
> -#include<asm/omap_gpio.h>
> +#include<asm/arch/gpio.h>
>   #include "omap4_mux_data.h"
>
>   DECLARE_GLOBAL_DATA_PTR;
> diff --git a/arch/arm/include/asm/arch-omap3/gpio.h b/arch/arm/include/asm/arch-omap3/gpio.h
> new file mode 100644
> index 0000000..8bba3b0
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-omap3/gpio.h
> @@ -0,0 +1,50 @@
> +/*
> + * Copyright (c) 2009 Wind River Systems, Inc.
> + * Tom Rix<Tom.Rix@windriver.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + *
> + * This work is derived from the linux 2.6.27 kernel source
> + * To fetch, use the kernel repository
> + * git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> + * Use the v2.6.27 tag.
> + *
> + * Below is the original's header including its copyright
> + *
> + *  linux/arch/arm/plat-omap/gpio.c
> + *
> + * Support functions for OMAP GPIO
> + *
> + * Copyright (C) 2003-2005 Nokia Corporation
> + * Written by Juha Yrj??l??<juha.yrjola@nokia.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#ifndef _GPIO_OMAP3_H
> +#define _GPIO_OMAP3_H
> +
> +#include<asm/omap_gpio.h>
> +
> +#define OMAP34XX_GPIO1_BASE		0x48310000
> +#define OMAP34XX_GPIO2_BASE		0x49050000
> +#define OMAP34XX_GPIO3_BASE		0x49052000
> +#define OMAP34XX_GPIO4_BASE		0x49054000
> +#define OMAP34XX_GPIO5_BASE		0x49056000
> +#define OMAP34XX_GPIO6_BASE		0x49058000
> +
> +#endif /* _GPIO_OMAP3_H */
> diff --git a/arch/arm/include/asm/arch-omap3/omap3.h b/arch/arm/include/asm/arch-omap3/omap3.h
> index d9d49da..230eaad 100644
> --- a/arch/arm/include/asm/arch-omap3/omap3.h
> +++ b/arch/arm/include/asm/arch-omap3/omap3.h
> @@ -100,14 +100,6 @@ struct s32ktimer {
>
>   #endif /* __ASSEMBLY__ */
>
> -/* OMAP3 GPIO registers */
> -#define OMAP34XX_GPIO1_BASE		0x48310000
> -#define OMAP34XX_GPIO2_BASE		0x49050000
> -#define OMAP34XX_GPIO3_BASE		0x49052000
> -#define OMAP34XX_GPIO4_BASE		0x49054000
> -#define OMAP34XX_GPIO5_BASE		0x49056000
> -#define OMAP34XX_GPIO6_BASE		0x49058000
> -
>   #ifndef __ASSEMBLY__
>   struct gpio {
>   	unsigned char res1[0x34];
> diff --git a/arch/arm/include/asm/arch-omap4/gpio.h b/arch/arm/include/asm/arch-omap4/gpio.h
> new file mode 100644
> index 0000000..26f19d1
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-omap4/gpio.h
> @@ -0,0 +1,50 @@
> +/*
> + * Copyright (c) 2009 Wind River Systems, Inc.
> + * Tom Rix<Tom.Rix@windriver.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + *
> + * This work is derived from the linux 2.6.27 kernel source
> + * To fetch, use the kernel repository
> + * git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> + * Use the v2.6.27 tag.
> + *
> + * Below is the original's header including its copyright
> + *
> + *  linux/arch/arm/plat-omap/gpio.c
> + *
> + * Support functions for OMAP GPIO
> + *
> + * Copyright (C) 2003-2005 Nokia Corporation
> + * Written by Juha Yrj??l??<juha.yrjola@nokia.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#ifndef _GPIO_OMAP4_H
> +#define _GPIO_OMAP4_H
> +
> +#include<asm/omap_gpio.h>
> +
> +#define OMAP44XX_GPIO1_BASE		0x4A310000
> +#define OMAP44XX_GPIO2_BASE		0x48055000
> +#define OMAP44XX_GPIO3_BASE		0x48057000
> +#define OMAP44XX_GPIO4_BASE		0x48059000
> +#define OMAP44XX_GPIO5_BASE		0x4805B000
> +#define OMAP44XX_GPIO6_BASE		0x4805D000
> +
> +#endif /* _GPIO_OMAP4_H */
> diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h
> index 9aad0e6..7ff46d7 100644
> --- a/arch/arm/include/asm/arch-omap4/omap4.h
> +++ b/arch/arm/include/asm/arch-omap4/omap4.h
> @@ -153,12 +153,4 @@ struct s32ktimer {
>   #define DEV_DATA_PTR_OFFSET	0x18
>   #define BOOT_MODE_OFFSET	0x8
>
> -/* GPIO */
> -#define OMAP44XX_GPIO1_BASE		0x4A310000
> -#define OMAP44XX_GPIO2_BASE		0x48055000
> -#define OMAP44XX_GPIO3_BASE		0x48057000
> -#define OMAP44XX_GPIO4_BASE		0x48059000
> -#define OMAP44XX_GPIO5_BASE		0x4805B000
> -#define OMAP44XX_GPIO6_BASE		0x4805D000
> -
>   #endif
> diff --git a/board/pandora/pandora.c b/board/pandora/pandora.c
> index 992e9f7..0df4570 100644
> --- a/board/pandora/pandora.c
> +++ b/board/pandora/pandora.c
> @@ -33,6 +33,7 @@
>   #include<twl4030.h>
>   #include<asm/io.h>
>   #include<asm/arch/mux.h>
> +#include<asm/arch/gpio.h>
>   #include<asm/arch/sys_proto.h>
>   #include<asm/mach-types.h>
>   #include "pandora.h"
>
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

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

* [U-Boot] [PATCH] omap: fix gpio related build breaks
  2011-08-01  6:30     ` [U-Boot] [PATCH] omap: fix gpio related build breaks Aneesh V
  2011-08-05  6:43       ` Aneesh V
  2011-08-08 14:54       ` Dirk Behme
@ 2011-08-20 15:30       ` Albert ARIBAUD
  2 siblings, 0 replies; 26+ messages in thread
From: Albert ARIBAUD @ 2011-08-20 15:30 UTC (permalink / raw)
  To: u-boot

Hi Aneesh,

Le 01/08/2011 08:30, Aneesh V a ?crit :
> Signed-off-by: Aneesh V<aneesh@ti.com>
> ---
> Hi Sandeep,
> This is an incremental patch to fix the build issues created
> by "[PATCH 3/5] omap: reuse omap3 gpio support in omap4"
> in the omap4460 series.
> ---
>   arch/arm/cpu/armv7/omap-common/gpio.c   |    2 +-
>   arch/arm/cpu/armv7/omap3/board.c        |    2 +-
>   arch/arm/cpu/armv7/omap4/board.c        |    2 +-
>   arch/arm/include/asm/arch-omap3/gpio.h  |   50 +++++++++++++++++++++++++++++++
>   arch/arm/include/asm/arch-omap3/omap3.h |    8 -----
>   arch/arm/include/asm/arch-omap4/gpio.h  |   50 +++++++++++++++++++++++++++++++
>   arch/arm/include/asm/arch-omap4/omap4.h |    8 -----
>   board/pandora/pandora.c                 |    1 +
>   8 files changed, 104 insertions(+), 19 deletions(-)
>   create mode 100644 arch/arm/include/asm/arch-omap3/gpio.h
>   create mode 100644 arch/arm/include/asm/arch-omap4/gpio.h

Applied to u-boot-arm/master with Sandeep's agreement, thanks!

Amicalement,
-- 
Albert.

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

end of thread, other threads:[~2011-08-20 15:30 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-16 16:25 [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Aneesh V
2011-07-16 16:25 ` [U-Boot] [PATCH v 1/5] omap4: add omap4460 revision detection Aneesh V
2011-07-16 16:25 ` [U-Boot] [PATCH v 2/5] omap4: sdram init changes for omap4460 Aneesh V
2011-07-16 16:25 ` [U-Boot] [PATCH v 3/5] omap: reuse omap3 gpio support in omap4 Aneesh V
2011-07-16 16:25 ` [U-Boot] [PATCH v 4/5] omap4: support TPS programming Aneesh V
2011-07-16 16:25 ` [U-Boot] [PATCH v 5/5] omap4: clock init support for omap4460 Aneesh V
2011-07-17  9:05 ` [U-Boot] [PATCH v 0/5] arm: omap4: omap4460 support Albert ARIBAUD
2011-07-18  9:21   ` Aneesh V
2011-07-18 13:32 ` Aneesh V
2011-07-20 10:55 ` [U-Boot] [PATCH v2 " Aneesh V
2011-07-20 15:43   ` Paulraj, Sandeep
2011-07-20 19:49     ` Wolfgang Denk
2011-07-20 20:44       ` Paulraj, Sandeep
2011-07-20 20:58   ` Paulraj, Sandeep
2011-07-20 10:55 ` [U-Boot] [PATCH v2 1/5] omap4: add omap4460 revision detection Aneesh V
2011-07-20 10:55 ` [U-Boot] [PATCH v2 2/5] omap4: sdram init changes for omap4460 Aneesh V
2011-07-20 10:55 ` [U-Boot] [PATCH v2 3/5] omap: reuse omap3 gpio support in omap4 Aneesh V
2011-07-29 16:40   ` Aneesh V
2011-07-29 17:03   ` [U-Boot] [PATCH " Aneesh V
2011-07-29 17:09     ` [U-Boot] [PATCH v3 " Aneesh V
2011-08-01  6:30     ` [U-Boot] [PATCH] omap: fix gpio related build breaks Aneesh V
2011-08-05  6:43       ` Aneesh V
2011-08-08 14:54       ` Dirk Behme
2011-08-20 15:30       ` Albert ARIBAUD
2011-07-20 10:55 ` [U-Boot] [PATCH v2 4/5] omap4: support TPS programming Aneesh V
2011-07-20 10:55 ` [U-Boot] [PATCH v2 5/5] omap4: clock init support for omap4460 Aneesh V

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.