Skip to contentSkip to conversation

OMAP3: Add some additional improvements and fixes

PATCH Superseded Dirk Behme 5 participants 26 messages Feb 2, 2009 – Feb 12, 2009 MMC, SD and SDIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Dirk Behme

author
#0 lore raw

cover OMAP3: Add some additional improvements and fixes

OMAP3 support recently merged is version from mid december 2008. This patch series adds some additional clean up, fixes and improvements done since then. It brings U-Boot mainline in sync with U-Boot tree of OMAP3 developers ("omap3-dev").

This patch series is against U-Boot mainline, commit 6c6e042ab3bbfb5428e4cdeb38fa27728c63afdd "Merge branch 'master' of git://git.denx.de/u-boot-arm"

Best regards

Dirk

author
#1 lore raw

PATCH 1/7 OMAP3: Overo: Clean up pin mux and GPIO configuration

* Make Overo GPIO114 an input for touchscreen PENDOWN
* Make Overo GPIO144-147 readable
* Make Overo EHCI pinmux match beagle rev c setup
* Adjust pinmux for SMSC911X network chip support
* Remove unnecessary GPIO setup
* Fix merge error in Makefile

---
 board/omap3/overo/Makefile |    1 +
 board/omap3/overo/overo.c  |   13 -------------
 board/omap3/overo/overo.h  |   18 ++++++++++--------
 3 files changed, 11 insertions(+), 21 deletions(-)
board/omap3/overo/overo.h +10 -8
Index: u-boot-main/board/omap3/overo/overo.h
===================================================================
@@ -130,7 +130,8 @@ const omap3_sysinfo sysinfo = {
  MUX_VAL(CP(GPMC_NWP),		(IEN  | PTD | DIS | M0)) /*GPMC_nWP*/\
  MUX_VAL(CP(GPMC_WAIT0),	(IEN  | PTU | EN  | M0)) /*GPMC_WAIT0*/\
  MUX_VAL(CP(GPMC_WAIT1),	(IEN  | PTU | EN  | M0)) /*GPMC_WAIT1*/\
- MUX_VAL(CP(GPMC_WAIT2),	(IEN  | PTU | EN  | M0)) /*GPMC_nCS3*/\
+ MUX_VAL(CP(GPMC_WAIT2),	(IEN  | PTU | DIS | M4)) /*GPIO_64*/\
+							/* - SMSC911X_NRES*/\
  MUX_VAL(CP(GPMC_WAIT3),	(IEN  | PTU | EN  | M0)) /*GPMC_nCS3*/\
  /*DSS*/\
  MUX_VAL(CP(DSS_PCLK),		(IDIS | PTD | DIS | M0)) /*DSS_PCLK*/\
@@ -184,7 +185,7 @@ const omap3_sysinfo sysinfo = {
  MUX_VAL(CP(CAM_STROBE),	(IDIS | PTD | DIS | M0)) /*CAM_STROBE*/\
  MUX_VAL(CP(CSI2_DX0),		(IEN  | PTD | DIS | M0)) /*CSI2_DX0*/\
  MUX_VAL(CP(CSI2_DY0),		(IEN  | PTD | DIS | M0)) /*CSI2_DY0*/\
- MUX_VAL(CP(CSI2_DX1),		(IEN  | PTD | DIS | M0)) /*CSI2_DX1*/\
+ MUX_VAL(CP(CSI2_DX1),		(IEN  | PTD | EN  | M4)) /*GPIO_114*/\
  MUX_VAL(CP(CSI2_DY1),		(IEN  | PTU | EN  | M4)) /*GPIO_115*/\
  /*Audio Interface */\
  MUX_VAL(CP(MCBSP2_FSX),	(IEN  | PTD | DIS | M0)) /*McBSP2_FSX*/\
@@ -218,10 +219,10 @@ const omap3_sysinfo sysinfo = {
  MUX_VAL(CP(MCBSP3_DR),		(IDIS | PTD | DIS | M1)) /*UART2_RTS*/\
  MUX_VAL(CP(MCBSP3_CLKX),	(IDIS | PTD | DIS | M1)) /*UART2_TX*/\
  MUX_VAL(CP(MCBSP3_FSX),	(IEN  | PTD | DIS | M1)) /*UART2_RX*/\
- MUX_VAL(CP(UART2_CTS),		(IDIS | PTD | DIS | M4)) /*GPIO_144 - LCD_EN*/\
- MUX_VAL(CP(UART2_RTS),		(IDIS | PTD | DIS | M4)) /*GPIO_145*/\
- MUX_VAL(CP(UART2_TX),		(IDIS | PTD | DIS | M4)) /*GPIO_146*/\
- MUX_VAL(CP(UART2_RX),		(IDIS | PTD | DIS | M4)) /*GPIO_147*/\
+ MUX_VAL(CP(UART2_CTS),		(IEN  | PTD | DIS | M4)) /*GPIO_144 - LCD_EN*/\
+ MUX_VAL(CP(UART2_RTS),		(IEN  | PTD | DIS | M4)) /*GPIO_145*/\
+ MUX_VAL(CP(UART2_TX),		(IEN  | PTD | DIS | M4)) /*GPIO_146*/\
+ MUX_VAL(CP(UART2_RX),		(IEN  | PTD | DIS | M4)) /*GPIO_147*/\
  MUX_VAL(CP(UART1_TX),		(IDIS | PTD | DIS | M0)) /*UART1_TX*/\
  MUX_VAL(CP(UART1_RTS),		(IEN  | PTU | DIS | M4)) /*GPIO_149*/ \
  MUX_VAL(CP(UART1_CTS),		(IEN  | PTU | DIS | M4)) /*GPIO_150-MMC3_WP*/\
@@ -271,7 +272,8 @@ const omap3_sysinfo sysinfo = {
  MUX_VAL(CP(MCSPI1_SOMI),	(IEN  | PTD | DIS | M0)) /*McSPI1_SOMI */\
  MUX_VAL(CP(MCSPI1_CS0),	(IEN  | PTD | EN  | M0)) /*McSPI1_CS0*/\
  MUX_VAL(CP(MCSPI1_CS1),	(IDIS | PTD | EN  | M0)) /*McSPI1_CS1*/\
- MUX_VAL(CP(MCSPI1_CS2),	(IDIS | PTD | DIS | M4)) /*GPIO_176*/\
+ MUX_VAL(CP(MCSPI1_CS2),	(IEN  | PTD | DIS | M4)) /*GPIO_176*/\
+							/* - SMSC911X_IRQ*/\
  MUX_VAL(CP(MCSPI1_CS3),	(IEN  | PTD | DIS | M3)) /*HSUSB2_DATA2*/\
  MUX_VAL(CP(MCSPI2_CLK),	(IEN  | PTD | DIS | M3)) /*HSUSB2_DATA7*/\
  MUX_VAL(CP(MCSPI2_SIMO),	(IEN  | PTD | DIS | M3)) /*HSUSB2_DATA4*/\
@@ -306,7 +308,7 @@ const omap3_sysinfo sysinfo = {
  MUX_VAL(CP(ETK_D8_ES2),	(IEN  | PTU | EN  | M2)) /*MMC3_DAT6*/\
  MUX_VAL(CP(ETK_D9_ES2),	(IEN  | PTU | EN  | M2)) /*MMC3_DAT5*/\
  MUX_VAL(CP(ETK_D10_ES2),	(IDIS | PTD | DIS | M3)) /*HSUSB2_CLK*/\
- MUX_VAL(CP(ETK_D11_ES2),	(IDIS | PTU | EN  | M3)) /*HSUSB2_STP*/\
+ MUX_VAL(CP(ETK_D11_ES2),	(IDIS | PTD | DIS | M3)) /*HSUSB2_STP*/\
  MUX_VAL(CP(ETK_D12_ES2),	(IEN  | PTD | DIS | M3)) /*HSUSB2_DIR*/\
  MUX_VAL(CP(ETK_D13_ES2),	(IEN  | PTD | DIS | M3)) /*HSUSB2_NXT*/\
  MUX_VAL(CP(ETK_D14_ES2),	(IEN  | PTD | DIS | M3)) /*HSUSB2_DATA0*/\
board/omap3/overo/overo.c +0 -13
Index: u-boot-main/board/omap3/overo/overo.c
===================================================================
@@ -58,21 +58,8 @@ int board_init(void)
  *****************************************************************************/
 int misc_init_r(void)
 {
-	gpio_t *gpio5_base = (gpio_t *)OMAP34XX_GPIO5_BASE;
-	gpio_t *gpio6_base = (gpio_t *)OMAP34XX_GPIO6_BASE;
-
 	power_init_r();
 
-	/* Configure GPIOs to output */
-	writel(~((GPIO10) | GPIO9 | GPIO3 | GPIO2), &gpio6_base->oe);
-	writel(~(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
-		GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);
-
-	/* Set GPIOs */
-	writel(GPIO10 | GPIO9 | GPIO3 | GPIO2, &gpio6_base->setdataout);
-	writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
-		GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
-
 	return 0;
 }
 
board/omap3/overo/Makefile +1 -0
Index: u-boot-main/board/omap3/overo/Makefile
===================================================================
@@ -46,3 +46,4 @@ include $(SRCTREE)/rules.mk
 
 sinclude $(obj).depend
 
+#########################################################################
author
#2 lore raw

PATCH 2/7 OMAP3: Beagle: Add board revision detection

With BeagleBoard revision C some HW changes are introduced (e.g. PinMUX) which might need different software handling. For this, GPIO pin 171 (GPIO module 6, offset 11) can be used to check for board revision. If this pin is low, we have a rev C board. Else it must be a revision Ax or Bx board.

Global variable beagle_revision_c can be used later to handle board differences. E.g.

if (beagle_revision_c) {

/* do special revision C stuff here */

}

---
 board/omap3/beagle/beagle.c        |   28 ++++++++++++++++++++++++++++
 board/omap3/beagle/beagle.h        |    4 ++++
 include/asm-arm/arch-omap3/omap3.h |    3 ++-
 3 files changed, 34 insertions(+), 1 deletion(-)
board/omap3/beagle/beagle.c +28 -0
Index: u-boot-main/board/omap3/beagle/beagle.c
===================================================================
@@ -54,6 +54,32 @@ int board_init(void)
 }
 
 /******************************************************************************
+ * Routine: board_identify
+ * Description: Detect if we are running on a Beagle revision Ax/Bx or
+ *              Cx. This can be done by GPIO_171. If this is low, we are
+ *              running on a revision C board.
+ *****************************************************************************/
+void board_identify(void)
+{
+	gpio_t *gpio6_base = (gpio_t *)OMAP34XX_GPIO6_BASE;
+
+	/* Configure GPIO 171 as input */
+	writel(readl(&gpio6_base->oe) | GPIO11, &gpio6_base->oe);
+
+	/* Get value of GPIO 171 */
+	beagle_revision_c = readl(&gpio6_base->datain) & BOARD_REVISION_MASK;
+
+	printf("Board revision ");
+	if (beagle_revision_c) {
+		printf("Ax/Bx\n");
+		beagle_revision_c = 0;
+	} else {
+		printf("C\n");
+		beagle_revision_c = 1;
+	}
+}
+
+/******************************************************************************
  * Routine: misc_init_r
  * Description: Configure board specific parts
  *****************************************************************************/
@@ -75,6 +101,8 @@ int misc_init_r(void)
 	writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
 		GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
 
+	board_identify();
+
 	return 0;
 }
 
board/omap3/beagle/beagle.h +4 -0
Index: u-boot-main/board/omap3/beagle/beagle.h
===================================================================
@@ -36,6 +36,10 @@ const omap3_sysinfo sysinfo = {
 #endif
 };
 
+#define BOARD_REVISION_MASK	(0x1 << 11)
+
+unsigned int beagle_revision_c;
+
 /*
  * IEN  - Input Enable
  * IDIS - Input Disable
include/asm-arm/arch-omap3/omap3.h +2 -1
Index: u-boot-main/include/asm-arm/arch-omap3/omap3.h
===================================================================
@@ -97,7 +97,8 @@ typedef struct s32ktimer {
 typedef struct gpio {
 	unsigned char res1[0x34];
 	unsigned int oe;		/* 0x34 */
-	unsigned char res2[0x58];
+	unsigned int datain;		/* 0x38 */
+	unsigned char res2[0x54];
 	unsigned int cleardataout;	/* 0x90 */
 	unsigned int setdataout;	/* 0x94 */
 } gpio_t;
author
#3 lore raw

PATCH 3/7 OMAP3: Add OMAP3 auto detection

This patch adds OMAP3 cpu type auto detection based on OMAP3 register and removes hardcoded values.

---
 board/omap3/beagle/beagle.h            |    1 -
 board/omap3/evm/evm.h                  |    1 -
 board/omap3/overo/overo.h              |    1 -
 board/omap3/pandora/pandora.h          |    1 -
 board/omap3/zoom1/zoom1.h              |    1 -
 cpu/arm_cortexa8/omap3/sys_info.c      |   31 +++++++++++++++++++++++++++++--
 include/asm-arm/arch-omap3/cpu.h       |   20 ++++++++++++++++++++
 include/asm-arm/arch-omap3/sys_proto.h |    1 -
 8 files changed, 49 insertions(+), 8 deletions(-)
include/asm-arm/arch-omap3/cpu.h +20 -0
Index: u-boot-main/include/asm-arm/arch-omap3/cpu.h
===================================================================
@@ -35,11 +35,31 @@ typedef struct ctrl {
 	unsigned short gpmc_nwe;	/* 0xC4 */
 	unsigned char res2[0x22A];
 	unsigned int status;		/* 0x2F0 */
+	unsigned int gpstatus;		/* 0x2F4 */
+	unsigned char res3[0x08];
+	unsigned int rpubkey_0;		/* 0x300 */
+	unsigned int rpubkey_1;		/* 0x304 */
+	unsigned int rpubkey_2;		/* 0x308 */
+	unsigned int rpubkey_3;		/* 0x30C */
+	unsigned int rpubkey_4;		/* 0x310 */
+	unsigned char res4[0x04];
+	unsigned int randkey_0;		/* 0x318 */
+	unsigned int randkey_1;		/* 0x31C */
+	unsigned int randkey_2;		/* 0x320 */
+	unsigned int randkey_3;		/* 0x324 */
+	unsigned char res5[0x124];
+	unsigned int ctrl_omap_stat;	/* 0x44C */
 } ctrl_t;
 #else /* __ASSEMBLY__ */
 #define CONTROL_STATUS		0x2F0
 #endif /* __ASSEMBLY__ */
 
+/* cpu type */
+#define OMAP3503		0x5c00
+#define OMAP3515		0x1c00
+#define OMAP3525		0x4c00
+#define OMAP3530		0x0c00
+
 /* device type */
 #define DEVICE_MASK		(0x7 << 8)
 #define SYSBOOT_MASK		0x1F
cpu/arm_cortexa8/omap3/sys_info.c +29 -2
Index: u-boot-main/cpu/arm_cortexa8/omap3/sys_info.c
===================================================================
@@ -37,6 +37,14 @@ static sdrc_t *sdrc_base = (sdrc_t *)OMA
 static ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
 
 /******************************************
+ * get_cpu_type(void) - extract cpu info
+ ******************************************/
+u32 get_cpu_type(void)
+{
+	return readl(&ctrl_base->ctrl_omap_stat);
+}
+
+/******************************************
  * get_cpu_rev(void) - extract version info
  ******************************************/
 u32 get_cpu_rev(void)
@@ -156,7 +164,25 @@ u32 get_board_rev(void)
  *********************************************************************/
 void display_board_info(u32 btype)
 {
-	char *mem_s, *sec_s;
+	char *cpu_s, *mem_s, *sec_s;
+
+	switch (get_cpu_type()) {
+	case OMAP3503:
+		cpu_s = "3503";
+		break;
+	case OMAP3515:
+		cpu_s = "3515";
+		break;
+	case OMAP3525:
+		cpu_s = "3525";
+		break;
+	case OMAP3530:
+		cpu_s = "3530";
+		break;
+	default:
+		cpu_s = "35XX";
+		break;
+	}
 
 	if (is_mem_sdr())
 		mem_s = "mSDR";
@@ -180,7 +206,8 @@ void display_board_info(u32 btype)
 		sec_s = "?";
 	}
 
-	printf("OMAP%s-%s rev %d, CPU-OPP2 L3-165MHz\n", sysinfo.cpu_string,
+
+	printf("OMAP%s-%s rev %d, CPU-OPP2 L3-165MHz\n", cpu_s,
 	       sec_s, get_cpu_rev());
 	printf("%s + %s/%s\n", sysinfo.board_string,
 	       mem_s, sysinfo.nand_string);
board/omap3/beagle/beagle.h +0 -1
Index: u-boot-main/board/omap3/beagle/beagle.h
===================================================================
@@ -27,7 +27,6 @@ const omap3_sysinfo sysinfo = {
 	SDP_3430_V1,
 	SDP_3430_V2,
 	DDR_STACKED,
-	"3530",
 	"OMAP3 Beagle board",
 #if defined(CONFIG_ENV_IS_IN_ONENAND)
 	"OneNAND",
board/omap3/evm/evm.h +0 -1
Index: u-boot-main/board/omap3/evm/evm.h
===================================================================
@@ -27,7 +27,6 @@ const omap3_sysinfo sysinfo = {
 	OMAP3EVM_V1,
 	OMAP3EVM_V2,
 	DDR_DISCRETE,
-	"35X-Family",
 	"OMAP3 EVM board",
 #if defined(CONFIG_ENV_IS_IN_ONENAND)
 	"OneNAND",
board/omap3/overo/overo.h +0 -1
Index: u-boot-main/board/omap3/overo/overo.h
===================================================================
@@ -27,7 +27,6 @@ const omap3_sysinfo sysinfo = {
 	SDP_3430_V1,
 	SDP_3430_V2,
 	DDR_STACKED,
-	"3503",
 	"Gumstix Overo board",
 #if defined(CONFIG_ENV_IS_IN_ONENAND)
 	"OneNAND",
board/omap3/pandora/pandora.h +0 -1
Index: u-boot-main/board/omap3/pandora/pandora.h
===================================================================
@@ -27,7 +27,6 @@ const omap3_sysinfo sysinfo = {
 	SDP_3430_V1,
 	SDP_3430_V2,
 	DDR_STACKED,
-	"3530",
 	"OMAP3 Pandora",
 	"NAND",
 };
board/omap3/zoom1/zoom1.h +0 -1
Index: u-boot-main/board/omap3/zoom1/zoom1.h
===================================================================
@@ -31,7 +31,6 @@ const omap3_sysinfo sysinfo = {
 	SDP_3430_V1,
 	SDP_3430_V2,
 	DDR_STACKED,
-	"3430",
 	"OMAP3 Zoom MDK Rev 1",
 	"NAND",
 };
include/asm-arm/arch-omap3/sys_proto.h +0 -1
Index: u-boot-main/include/asm-arm/arch-omap3/sys_proto.h
===================================================================
@@ -25,7 +25,6 @@ typedef struct {
 	u32 board_type_v1;
 	u32 board_type_v2;
 	u32 mtype;
-	char *cpu_string;
 	char *board_string;
 	char *nand_string;
 } omap3_sysinfo;
author
#4 lore raw

PATCH 4/7 OMAP3: Pandora: Update pin mux

Update Pandora pin mux.

---
 board/omap3/pandora/pandora.h |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
board/omap3/pandora/pandora.h +6 -6
Index: u-boot-main/board/omap3/pandora/pandora.h
===================================================================
@@ -199,12 +199,12 @@ const omap3_sysinfo sysinfo = {
  MUX_VAL(CP(MMC2_DAT7),		(IEN  | PTU | EN  | M1)) /*MMC2_CLKIN*/\
  MUX_VAL(CP(MMC1_DAT5),		(IEN  | PTD | DIS | M4)) /*GPIO_127 - MMC2_WP*/\
  /*SDIO Interface to WIFI Module*/\
- MUX_VAL(CP(ETK_CLK_ES2),	(IDIS | PTU | EN  | M2)) /*MMC3_CLK*/\
- MUX_VAL(CP(ETK_CTL_ES2),	(IEN  | PTD | DIS | M2)) /*MMC3_CMD*/\
- MUX_VAL(CP(ETK_D4_ES2),	(IEN  | PTD | DIS | M2)) /*MMC3_DAT0*/\
- MUX_VAL(CP(ETK_D5_ES2),	(IEN  | PTD | DIS | M2)) /*MMC3_DAT1*/\
- MUX_VAL(CP(ETK_D6_ES2),	(IEN  | PTD | DIS | M2)) /*MMC3_DAT2*/\
- MUX_VAL(CP(ETK_D3_ES2),	(IEN  | PTD | DIS | M2)) /*MMC3_DAT3*/\
+ MUX_VAL(CP(ETK_CLK_ES2),	(IEN  | PTD | DIS | M2)) /*MMC3_CLK*/\
+ MUX_VAL(CP(ETK_CTL_ES2),	(IEN  | PTU | EN  | M2)) /*MMC3_CMD*/\
+ MUX_VAL(CP(ETK_D4_ES2),	(IEN  | PTU | EN  | M2)) /*MMC3_DAT0*/\
+ MUX_VAL(CP(ETK_D5_ES2),	(IEN  | PTU | EN  | M2)) /*MMC3_DAT1*/\
+ MUX_VAL(CP(ETK_D6_ES2),	(IEN  | PTU | EN  | M2)) /*MMC3_DAT2*/\
+ MUX_VAL(CP(ETK_D3_ES2),	(IEN  | PTU | EN  | M2)) /*MMC3_DAT3*/\
  /*Audio Interface To Bluetooth chip*/\
  MUX_VAL(CP(MCBSP3_DX),		(IDIS | PTD | DIS | M0)) /*McBSP3_DX*/\
  MUX_VAL(CP(MCBSP3_DR),		(IEN  | PTD | DIS | M0)) /*McBSP3_DR*/\
author
#5 lore raw

PATCH 5/7 OMAP3: Add serial number based on die ID

Add serial number based on OMAP3 die ID.

---
 board/omap3/beagle/beagle.c            |    2 ++
 board/omap3/evm/evm.c                  |    2 ++
 board/omap3/overo/overo.c              |    2 ++
 board/omap3/pandora/pandora.c          |    2 ++
 board/omap3/zoom1/zoom1.c              |    1 +
 cpu/arm_cortexa8/omap3/sys_info.c      |   27 +++++++++++++++++++++++++++
 include/asm-arm/arch-omap3/cpu.h       |   13 +++++++++++++
 include/asm-arm/arch-omap3/omap3.h     |    1 +
 include/asm-arm/arch-omap3/sys_proto.h |    1 +
 9 files changed, 51 insertions(+)
cpu/arm_cortexa8/omap3/sys_info.c +27 -0
Index: u-boot-main/cpu/arm_cortexa8/omap3/sys_info.c
===================================================================
@@ -36,6 +36,33 @@ static gpmc_csx_t *gpmc_cs_base = (gpmc_
 static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
 static ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
 
+/*****************************************************************
+ * serial_num_r(void) - read and set serial number based on DIE ID
+ *****************************************************************/
+void serial_num_r(void)
+{
+	ctrl_id_t *id_base = (ctrl_id_t *)OMAP34XX_ID_L4_IO_BASE;
+	char *uid_s, die_id[34];
+	u32 id[4];
+
+	memset(die_id, 0, sizeof(die_id));
+
+	uid_s = getenv("serial");
+
+	if (uid_s == NULL) {
+		id[3] = readl(&id_base->die_id_0);
+		id[2] = readl(&id_base->die_id_1);
+		id[1] = readl(&id_base->die_id_2);
+		id[0] = readl(&id_base->die_id_3);
+		sprintf(die_id, "%08x%08x%08x%08x", id[0], id[1], id[2], id[3]);
+		setenv("serial", die_id);
+	} else {
+		strncpy(die_id, uid_s, 34);
+	}
+
+	printf("Serial #%s\n", die_id);
+}
+
 /******************************************
  * get_cpu_type(void) - extract cpu info
  ******************************************/
include/asm-arm/arch-omap3/cpu.h +13 -0
Index: u-boot-main/include/asm-arm/arch-omap3/cpu.h
===================================================================
@@ -60,6 +60,19 @@ typedef struct ctrl {
 #define OMAP3525		0x4c00
 #define OMAP3530		0x0c00
 
+#ifndef __ASSEMBLY__
+typedef struct ctrl_id {
+	unsigned char res1[0x4];
+	unsigned int idcode;		/* 0x04 */
+	unsigned int prod_id;		/* 0x08 */
+	unsigned char res2[0x0C];
+	unsigned int die_id_0;		/* 0x18 */
+	unsigned int die_id_1;		/* 0x1C */
+	unsigned int die_id_2;		/* 0x20 */
+	unsigned int die_id_3;		/* 0x24 */
+} ctrl_id_t;
+#endif /* __ASSEMBLY__ */
+
 /* device type */
 #define DEVICE_MASK		(0x7 << 8)
 #define SYSBOOT_MASK		0x1F
include/asm-arm/arch-omap3/omap3.h +1 -0
Index: u-boot-main/include/asm-arm/arch-omap3/omap3.h
===================================================================
@@ -43,6 +43,7 @@
  */
 #define OMAP34XX_CORE_L4_IO_BASE	0x48000000
 #define OMAP34XX_WAKEUP_L4_IO_BASE	0x48300000
+#define OMAP34XX_ID_L4_IO_BASE		0x4830A200
 #define OMAP34XX_L4_PER			0x49000000
 #define OMAP34XX_L4_IO_BASE		OMAP34XX_CORE_L4_IO_BASE
 
board/omap3/overo/overo.c +2 -0
Index: u-boot-main/board/omap3/overo/overo.c
===================================================================
@@ -60,6 +60,8 @@ int misc_init_r(void)
 {
 	power_init_r();
 
+	serial_num_r();
+
 	return 0;
 }
 
board/omap3/beagle/beagle.c +2 -0
Index: u-boot-main/board/omap3/beagle/beagle.c
===================================================================
@@ -103,6 +103,8 @@ int misc_init_r(void)
 
 	board_identify();
 
+	serial_num_r();
+
 	return 0;
 }
 
board/omap3/evm/evm.c +2 -0
Index: u-boot-main/board/omap3/evm/evm.c
===================================================================
@@ -68,6 +68,8 @@ int misc_init_r(void)
 	setup_net_chip();
 #endif
 
+	serial_num_r();
+
 	return 0;
 }
 
include/asm-arm/arch-omap3/sys_proto.h +1 -0
Index: u-boot-main/include/asm-arm/arch-omap3/sys_proto.h
===================================================================
@@ -66,5 +66,6 @@ void sdelay(unsigned long);
 void make_cs1_contiguous(void);
 void omap_nand_switch_ecc(int);
 void power_init_r(void);
+void serial_num_r(void);
 
 #endif
board/omap3/pandora/pandora.c +2 -0
Index: u-boot-main/board/omap3/pandora/pandora.c
===================================================================
@@ -77,6 +77,8 @@ int misc_init_r(void)
 	writel(GPIO28, &gpio5_base->setdataout);
 	writel(GPIO4, &gpio6_base->setdataout);
 
+	serial_num_r();
+
 	return 0;
 }
 
board/omap3/zoom1/zoom1.c +1 -0
Index: u-boot-main/board/omap3/zoom1/zoom1.c
===================================================================
@@ -61,6 +61,7 @@ int board_init(void)
 int misc_init_r(void)
 {
 	power_init_r();
+	serial_num_r();
 	return 0;
 }
 
author
#6 lore raw

PATCH 6/7 OMAP3: Add OMAP3 core changes for MUSB

OMAp3 core changes necessary for MUSB

---
Note: OMAP3 USb code will be sent later to USB maintainer, so
CONFIG_MUSB isn't used anywhere yet. This will avoid USB maintainer to change OMAP3 core files.

 cpu/arm_cortexa8/omap3/clock.c     |    5 +++++
 include/asm-arm/arch-omap3/cpu.h   |    2 ++
 include/asm-arm/arch-omap3/omap3.h |   11 +++++++++++
 3 files changed, 18 insertions(+)
cpu/arm_cortexa8/omap3/clock.c +5 -0
Index: u-boot-main/cpu/arm_cortexa8/omap3/clock.c
===================================================================
@@ -377,5 +377,10 @@ void per_clocks_enable(void)
 	sr32(&prcm_base->fclken_per, 0, 32, FCK_PER_ON);
 	sr32(&prcm_base->iclken_per, 0, 32, ICK_PER_ON);
 
+#ifdef CONFIG_MUSB
+	/* Enable the MUSB interface clock */
+	sr32(&prcm_base->iclken1_core, 4, 1, 0x1);
+#endif
+
 	sdelay(1000);
 }
include/asm-arm/arch-omap3/cpu.h +2 -0
Index: u-boot-main/include/asm-arm/arch-omap3/cpu.h
===================================================================
@@ -432,4 +432,6 @@ typedef struct pm {
 #define I2C_BASE2		(OMAP34XX_CORE_L4_IO_BASE + 0x72000)
 #define I2C_BASE3		(OMAP34XX_CORE_L4_IO_BASE + 0x60000)
 
+#define UDC_BASE		(OMAP34XX_CORE_L4_IO_BASE + 0xAB000)
+
 #endif /* _CPU_H */
include/asm-arm/arch-omap3/omap3.h +11 -0
Index: u-boot-main/include/asm-arm/arch-omap3/omap3.h
===================================================================
@@ -3,6 +3,7 @@
  * Texas Instruments, <www.ti.com>
  * Richard Woodruff <[email protected]>
  * Syed Mohammed Khasim <[email protected]>
+ * Atin Malaviya <[email protected]>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -200,6 +201,7 @@ typedef struct gpio {
 #define LEDBPWM			(0x1 << 5)
 
 /* I2C ID4 (slave4) register */
+#define PROTECT_KEY		0x44
 #define VAUX2_DEV_GRP		0x76
 #define VAUX2_DEDICATED		0x79
 #define VAUX3_DEV_GRP		0x7A
@@ -209,6 +211,15 @@ typedef struct gpio {
 #define VDAC_DEV_GRP		0x96
 #define VDAC_DEDICATED		0x99
 
+#define VUSB1V5_DEV_GRP		0xCC
+#define VUSB1V5_TYPE		0xCD
+#define VUSB1V8_DEV_GRP		0xCF
+#define VUSB1V8_TYPE		0xD0
+#define VUSB3V1_DEV_GRP		0xD2
+#define VUSB3V1_TYPE		0xD3
+#define VUSB_DEDICATED1		0xD8
+#define VUSB_DEDICATED2		0xD9
+
 #define DEV_GRP_P1		0x20
 #define DEV_GRP_ALL		0xE0
 
author
#7 lore raw

PATCH 7/7 OMAP3: Clean up MMC code

Clean up OMAP3 MMC code:

* Convert register access to struct & readx/writex style
* Replace hardcode values by macros
* Remove macro defined twice

---
 drivers/mmc/omap3_mmc.c                   |  145 +++++++++++++++---------------
 include/asm-arm/arch-omap3/mmc_host_def.h |   64 ++++++++-----
 include/asm-arm/arch-omap3/omap3.h        |    3 
 3 files changed, 118 insertions(+), 94 deletions(-)
include/asm-arm/arch-omap3/mmc_host_def.h +41 -23
Index: u-boot-main/include/asm-arm/arch-omap3/mmc_host_def.h
===================================================================
@@ -25,30 +25,50 @@
 #ifndef MMC_HOST_DEF_H
 #define MMC_HOST_DEF_H
 
+/* T2 Register definitions */
+#define T2_BASE			0x48002000
+
+typedef struct t2 {
+	unsigned char res1[0x274];
+	unsigned int devconf0;		/* 0x274 */
+	unsigned char res2[0x2A8];
+	unsigned int pbias_lite;	/* 0x520 */
+} t2_t;
+
+#define MMCSDIO1ADPCLKISEL		(1 << 24)
+
+#define PBIASLITEPWRDNZ0		(1 << 1)
+#define PBIASSPEEDCTRL0			(1 << 2)
+#define PBIASLITEPWRDNZ1		(1 << 9)
+
 /*
  * OMAP HSMMC register definitions
  */
-#define OMAP_HSMMC_SYSCONFIG		(*(unsigned int *) 0x4809C010)
-#define OMAP_HSMMC_SYSSTATUS		(*(unsigned int *) 0x4809C014)
-#define OMAP_HSMMC_CON			(*(unsigned int *) 0x4809C02C)
-#define OMAP_HSMMC_BLK			(*(unsigned int *) 0x4809C104)
-#define OMAP_HSMMC_ARG			(*(unsigned int *) 0x4809C108)
-#define OMAP_HSMMC_CMD			(*(unsigned int *) 0x4809C10C)
-#define OMAP_HSMMC_RSP10		(*(unsigned int *) 0x4809C110)
-#define OMAP_HSMMC_RSP32		(*(unsigned int *) 0x4809C114)
-#define OMAP_HSMMC_RSP54		(*(unsigned int *) 0x4809C118)
-#define OMAP_HSMMC_RSP76		(*(unsigned int *) 0x4809C11C)
-#define OMAP_HSMMC_DATA			(*(unsigned int *) 0x4809C120)
-#define OMAP_HSMMC_PSTATE		(*(unsigned int *) 0x4809C124)
-#define OMAP_HSMMC_HCTL			(*(unsigned int *) 0x4809C128)
-#define OMAP_HSMMC_SYSCTL		(*(unsigned int *) 0x4809C12C)
-#define OMAP_HSMMC_STAT			(*(unsigned int *) 0x4809C130)
-#define OMAP_HSMMC_IE			(*(unsigned int *) 0x4809C134)
-#define OMAP_HSMMC_CAPA			(*(unsigned int *) 0x4809C140)
+#define OMAP_HSMMC_BASE		0x4809C000
 
-/* T2 Register definitions */
-#define CONTROL_DEV_CONF0		(*(unsigned int *) 0x48002274)
-#define CONTROL_PBIAS_LITE		(*(unsigned int *) 0x48002520)
+typedef struct hsmmc {
+	unsigned char res1[0x10];
+	unsigned int sysconfig;		/* 0x10 */
+	unsigned int sysstatus;		/* 0x14 */
+	unsigned char res2[0x14];
+	unsigned int con;		/* 0x2C */
+	unsigned char res3[0xD4];
+	unsigned int blk;		/* 0x104 */
+	unsigned int arg;		/* 0x108 */
+	unsigned int cmd;		/* 0x10C */
+	unsigned int rsp10;		/* 0x110 */
+	unsigned int rsp32;		/* 0x114 */
+	unsigned int rsp54;		/* 0x118 */
+	unsigned int rsp76;		/* 0x11C */
+	unsigned int data;		/* 0x120 */
+	unsigned int pstate;		/* 0x124 */
+	unsigned int hctl;		/* 0x128 */
+	unsigned int sysctl;		/* 0x12C */
+	unsigned int stat;		/* 0x130 */
+	unsigned int ie;		/* 0x134 */
+	unsigned char res4[0x8];
+	unsigned int capa;		/* 0x140 */
+} hsmmc_t;
 
 /*
  * OMAP HS MMC Bit definitions
@@ -159,8 +179,6 @@ typedef struct {
 } mmc_card_data;
 
 #define mmc_reg_out(addr, mask, val)\
-	(addr) = (((addr)) & (~(mask))) | ((val) & (mask));
-#define mmc_reg_out(addr, mask, val)\
-	(addr) = (((addr)) & (~(mask))) | ((val) & (mask));
+	writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr))
 
 #endif /* MMC_HOST_DEF_H */
drivers/mmc/omap3_mmc.c +74 -71

268 lines not on this page · raw message

include/asm-arm/arch-omap3/omap3.h +3 -0
Index: u-boot-main/include/asm-arm/arch-omap3/omap3.h
===================================================================
@@ -206,6 +206,8 @@ typedef struct gpio {
 #define VAUX2_DEDICATED		0x79
 #define VAUX3_DEV_GRP		0x7A
 #define VAUX3_DEDICATED		0x7D
+#define VMMC1_DEV_GRP		0x82
+#define VMMC1_DEDICATED		0x85
 #define VPLL2_DEV_GRP		0x8E
 #define VPLL2_DEDICATED		0x91
 #define VDAC_DEV_GRP		0x96
@@ -227,5 +229,6 @@ typedef struct gpio {
 #define VAUX3_VSEL_28		0x03
 #define VPLL2_VSEL_18		0x05
 #define VDAC_VSEL_18		0x03
+#define VMMC1_VSEL_30		0x02
 
 #endif
#8 lore raw

PATCH 6/7 OMAP3: Add OMAP3 core changes for MUSB

In reply to Dirk Behme
Quoted 19 lines · Dirk Behme

OMAp3 core changes necessary for MUSB

---
Note: OMAP3 USb code will be sent later to USB maintainer, so
CONFIG_MUSB isn't used anywhere yet. This will avoid USB maintainer to change OMAP3 core files.

 cpu/arm_cortexa8/omap3/clock.c     |    5 +++++
 include/asm-arm/arch-omap3/cpu.h   |    2 ++
 include/asm-arm/arch-omap3/omap3.h |   11 +++++++++++
 3 files changed, 18 insertions(+)

Index: u-boot-main/cpu/arm_cortexa8/omap3/clock.c
===================================================================

cpu/arm_cortexa8/omap3/clock.c void per_clocks_enable(void) · line 384

Quoted 8 lines
cpu/arm_cortexa8/omap3/clock.c +5 -0
@@ -377,5 +377,10 @@ void per_clocks_enable(void)
 	sr32(&prcm_base->fclken_per, 0, 32, FCK_PER_ON);
 	sr32(&prcm_base->iclken_per, 0, 32, ICK_PER_ON);
 
+#ifdef CONFIG_MUSB
+	/* Enable the MUSB interface clock */
+	sr32(&prcm_base->iclken1_core, 4, 1, 0x1);
+#endif
+

why do you enable the clock every time if you do not use it u-boot please do no enable it as done for the ethernet as example

Best Regards,
J.

author
#9 lore raw

PATCH 6/7 OMAP3: Add OMAP3 core changes for MUSB

Dear Jean-Christophe,

Quoted 23 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 22 lines · Dirk Behme

OMAp3 core changes necessary for MUSB

---
Note: OMAP3 USb code will be sent later to USB maintainer, so
CONFIG_MUSB isn't used anywhere yet. This will avoid USB maintainer to change OMAP3 core files.

 cpu/arm_cortexa8/omap3/clock.c     |    5 +++++
 include/asm-arm/arch-omap3/cpu.h   |    2 ++
 include/asm-arm/arch-omap3/omap3.h |   11 +++++++++++
 3 files changed, 18 insertions(+)

Index: u-boot-main/cpu/arm_cortexa8/omap3/clock.c
===================================================================

cpu/arm_cortexa8/omap3/clock.c +0 -0
@@ -377,5 +377,10 @@ void per_clocks_enable(void)
 	sr32(&prcm_base->fclken_per, 0, 32, FCK_PER_ON);
 	sr32(&prcm_base->iclken_per, 0, 32, ICK_PER_ON);
 
Quoted 7 lines

cpu/arm_cortexa8/omap3/clock.c void per_clocks_enable(void) · line 384

Quoted 5 lines
cpu/arm_cortexa8/omap3/clock.c +5 -0
+#ifdef CONFIG_MUSB
+	/* Enable the MUSB interface clock */
+	sr32(&prcm_base->iclken1_core, 4, 1, 0x1);
+#endif
+

why do you enable the clock every time if you do not use it u-boot please do no enable it as done for the ethernet as example

Hmmh, sorry if I missed something?

But my understanding and implementation goal is to have MUSB clock enabled only if CONFIG_MUSB is enabled (and not every time). As mentioned above, this will be done later with an USB patch to be sent to USB maintainer. I.e. MUSB clock will be enabled only if it is really needed because CONFIG_MUSB is enabled (by patch to be sent later).

Dirk

#10 lore raw

PATCH 5/7 OMAP3: Add serial number based on die ID

In reply to Dirk Behme
Quoted 26 lines · Dirk Behme

Add serial number based on OMAP3 die ID.

---
 board/omap3/beagle/beagle.c            |    2 ++
 board/omap3/evm/evm.c                  |    2 ++
 board/omap3/overo/overo.c              |    2 ++
 board/omap3/pandora/pandora.c          |    2 ++
 board/omap3/zoom1/zoom1.c              |    1 +
 cpu/arm_cortexa8/omap3/sys_info.c      |   27 +++++++++++++++++++++++++++
 include/asm-arm/arch-omap3/cpu.h       |   13 +++++++++++++
 include/asm-arm/arch-omap3/omap3.h     |    1 +
 include/asm-arm/arch-omap3/sys_proto.h |    1 +
 9 files changed, 51 insertions(+)

Index: u-boot-main/cpu/arm_cortexa8/omap3/sys_info.c
===================================================================

cpu/arm_cortexa8/omap3/sys_info.c +2 -0
@@ -36,6 +36,33 @@ static gpmc_csx_t *gpmc_cs_base = (gpmc_
 static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
 static ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
 
+/*****************************************************************
+ * serial_num_r(void) - read and set serial number based on DIE ID

cpu/arm_cortexa8/omap3/sys_info.c static gpmc_csx_t *gpmc_cs_base = (gpmc_ · line 50

Quoted 10 lines
cpu/arm_cortexa8/omap3/sys_info.c +10 -0
+ *****************************************************************/
+void serial_num_r(void)
+{
+	ctrl_id_t *id_base = (ctrl_id_t *)OMAP34XX_ID_L4_IO_BASE;
+	char *uid_s, die_id[34];
+	u32 id[4];
+
+	memset(die_id, 0, sizeof(die_id));
+
+	uid_s = getenv("serial");

why not call a cat a cat?
IMHO why don't you report the die id?

cpu/arm_cortexa8/omap3/sys_info.c static gpmc_csx_t *gpmc_cs_base = (gpmc_ · line 60

Quoted 10 lines
cpu/arm_cortexa8/omap3/sys_info.c +10 -0
+
+	if (uid_s == NULL) {
+		id[3] = readl(&id_base->die_id_0);
+		id[2] = readl(&id_base->die_id_1);
+		id[1] = readl(&id_base->die_id_2);
+		id[0] = readl(&id_base->die_id_3);
+		sprintf(die_id, "%08x%08x%08x%08x", id[0], id[1], id[2], id[3]);
+		setenv("serial", die_id);
+	} else {
+		strncpy(die_id, uid_s, 34);

why copy it? why not simply print it

Quoted 9 lines
cpu/arm_cortexa8/omap3/sys_info.c +5 -0
+	}
+
+	printf("Serial #%s\n", die_id);
+}
+
 /******************************************
  * get_cpu_type(void) - extract cpu info
  ******************************************/

Index: u-boot-main/include/asm-arm/arch-omap3/cpu.h

Best Regards,
J.

author
#11 lore raw

PATCH 5/7 OMAP3: Add serial number based on die ID

Dear Jean-Christophe,

Quoted 25 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 24 lines · Dirk Behme

Add serial number based on OMAP3 die ID.

---
 board/omap3/beagle/beagle.c            |    2 ++
 board/omap3/evm/evm.c                  |    2 ++
 board/omap3/overo/overo.c              |    2 ++
 board/omap3/pandora/pandora.c          |    2 ++
 board/omap3/zoom1/zoom1.c              |    1 +
 cpu/arm_cortexa8/omap3/sys_info.c      |   27 +++++++++++++++++++++++++++
 include/asm-arm/arch-omap3/cpu.h       |   13 +++++++++++++
 include/asm-arm/arch-omap3/omap3.h     |    1 +
 include/asm-arm/arch-omap3/sys_proto.h |    1 +
 9 files changed, 51 insertions(+)

Index: u-boot-main/cpu/arm_cortexa8/omap3/sys_info.c
===================================================================

cpu/arm_cortexa8/omap3/sys_info.c +0 -0
@@ -36,6 +36,33 @@ static gpmc_csx_t *gpmc_cs_base = (gpmc_
 static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
 static ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
 
Quoted 13 lines

cpu/arm_cortexa8/omap3/sys_info.c static gpmc_csx_t *gpmc_cs_base = (gpmc_ · line 50

Quoted 12 lines
cpu/arm_cortexa8/omap3/sys_info.c +12 -0
+/*****************************************************************
+ * serial_num_r(void) - read and set serial number based on DIE ID
+ *****************************************************************/
+void serial_num_r(void)
+{
+	ctrl_id_t *id_base = (ctrl_id_t *)OMAP34XX_ID_L4_IO_BASE;
+	char *uid_s, die_id[34];
+	u32 id[4];
+
+	memset(die_id, 0, sizeof(die_id));
+
+	uid_s = getenv("serial");

why not call a cat a cat?

Why not give the cat a fitting name?

The user gets a serial number, so we name it serial. How and where we get it from is hidden from user. It wouldn't help to name it "die ID" for user, nobody would know what this is. But serial number is clear to every body.

Quoted 12 lines

IMHO why don't you report the die id?

cpu/arm_cortexa8/omap3/sys_info.c static gpmc_csx_t *gpmc_cs_base = (gpmc_ · line 60

Quoted 10 lines
cpu/arm_cortexa8/omap3/sys_info.c +10 -0
+
+	if (uid_s == NULL) {
+		id[3] = readl(&id_base->die_id_0);
+		id[2] = readl(&id_base->die_id_1);
+		id[1] = readl(&id_base->die_id_2);
+		id[0] = readl(&id_base->die_id_3);
+		sprintf(die_id, "%08x%08x%08x%08x", id[0], id[1], id[2], id[3]);
+		setenv("serial", die_id);
+	} else {
+		strncpy(die_id, uid_s, 34);

why copy it? why not simply print it

Same concept as in beagle revision patch: Touch hardware only once if not done already, store the value and deal with value read from HW instead of touching HW again and again.

Then we use one central output location for the printf below, not repeating same printf at different lines.

Quoted 4 lines

cpu/arm_cortexa8/omap3/sys_info.c static gpmc_csx_t *gpmc_cs_base = (gpmc_ · line 64

Quoted 4 lines
cpu/arm_cortexa8/omap3/sys_info.c +4 -0
+	}
+
+	printf("Serial #%s\n", die_id);
+}

Dirk

Btw.: I hope that the other OMAP3 patch sent independently

http://lists.denx.de/pipermail/u-boot/2009-February/046691.html

will not be forgotten?

#12 lore raw

PATCH 5/7 OMAP3: Add serial number based on die ID

Quoted 41 lines · Dirk Behme

Dear Jean-Christophe,

Quoted 29 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 28 lines · Dirk Behme

Add serial number based on OMAP3 die ID.

---
 board/omap3/beagle/beagle.c            |    2 ++
 board/omap3/evm/evm.c                  |    2 ++
 board/omap3/overo/overo.c              |    2 ++
 board/omap3/pandora/pandora.c          |    2 ++
 board/omap3/zoom1/zoom1.c              |    1 +
 cpu/arm_cortexa8/omap3/sys_info.c      |   27 +++++++++++++++++++++++++++
 include/asm-arm/arch-omap3/cpu.h       |   13 +++++++++++++
 include/asm-arm/arch-omap3/omap3.h     |    1 +
 include/asm-arm/arch-omap3/sys_proto.h |    1 +
 9 files changed, 51 insertions(+)

Index: u-boot-main/cpu/arm_cortexa8/omap3/sys_info.c
===================================================================

cpu/arm_cortexa8/omap3/sys_info.c +4 -0
@@ -36,6 +36,33 @@ static gpmc_csx_t *gpmc_cs_base = (gpmc_
 static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
 static ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
 +/*****************************************************************
+ * serial_num_r(void) - read and set serial number based on DIE ID
+ *****************************************************************/
+void serial_num_r(void)
+{
Quoted 8 lines

cpu/arm_cortexa8/omap3/sys_info.c static gpmc_csx_t *gpmc_cs_base = (gpmc_ · line 50

Quoted 7 lines
cpu/arm_cortexa8/omap3/sys_info.c +7 -0
+	ctrl_id_t *id_base = (ctrl_id_t *)OMAP34XX_ID_L4_IO_BASE;
+	char *uid_s, die_id[34];
+	u32 id[4];
+
+	memset(die_id, 0, sizeof(die_id));
+
+	uid_s = getenv("serial");

why not call a cat a cat?

Quoted 6 lines

Why not give the cat a fitting name?

The user gets a serial number, so we name it serial. How and where we get it from is hidden from user. It wouldn't help to name it "die ID" for user, nobody would know what this is. But serial number is clear to every body.

serial number is board specific not CPU specific

when you product board and need to track then, you need to have a serial number that can not change even if you when the cpu.

Quoted 13 lines
Quoted 13 lines

IMHO why don't you report the die id?

cpu/arm_cortexa8/omap3/sys_info.c static gpmc_csx_t *gpmc_cs_base = (gpmc_ · line 60

Quoted 10 lines
cpu/arm_cortexa8/omap3/sys_info.c +10 -0
+
+	if (uid_s == NULL) {
+		id[3] = readl(&id_base->die_id_0);
+		id[2] = readl(&id_base->die_id_1);
+		id[1] = readl(&id_base->die_id_2);
+		id[0] = readl(&id_base->die_id_3);
+		sprintf(die_id, "%08x%08x%08x%08x", id[0], id[1], id[2], id[3]);
+		setenv("serial", die_id);
+	} else {
+		strncpy(die_id, uid_s, 34);

why copy it? why not simply print it

why do copy from a memory to an other instead of just update the pointer?

Best Regards,
J.

author
#13 lore raw

PATCH 5/7 OMAP3: Add serial number based on die ID

Dear Jean-Christophe,

Quoted 43 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 42 lines · Dirk Behme

Dear Jean-Christophe,

Quoted 29 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 28 lines · Dirk Behme

Add serial number based on OMAP3 die ID.

---
 board/omap3/beagle/beagle.c            |    2 ++
 board/omap3/evm/evm.c                  |    2 ++
 board/omap3/overo/overo.c              |    2 ++
 board/omap3/pandora/pandora.c          |    2 ++
 board/omap3/zoom1/zoom1.c              |    1 +
 cpu/arm_cortexa8/omap3/sys_info.c      |   27 +++++++++++++++++++++++++++
 include/asm-arm/arch-omap3/cpu.h       |   13 +++++++++++++
 include/asm-arm/arch-omap3/omap3.h     |    1 +
 include/asm-arm/arch-omap3/sys_proto.h |    1 +
 9 files changed, 51 insertions(+)

Index: u-boot-main/cpu/arm_cortexa8/omap3/sys_info.c
===================================================================

cpu/arm_cortexa8/omap3/sys_info.c +4 -0
@@ -36,6 +36,33 @@ static gpmc_csx_t *gpmc_cs_base = (gpmc_
 static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
 static ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
 +/*****************************************************************
+ * serial_num_r(void) - read and set serial number based on DIE ID
+ *****************************************************************/
+void serial_num_r(void)
+{
Quoted 8 lines

cpu/arm_cortexa8/omap3/sys_info.c static gpmc_csx_t *gpmc_cs_base = (gpmc_ · line 50

Quoted 7 lines
cpu/arm_cortexa8/omap3/sys_info.c +7 -0
+	ctrl_id_t *id_base = (ctrl_id_t *)OMAP34XX_ID_L4_IO_BASE;
+	char *uid_s, die_id[34];
+	u32 id[4];
+
+	memset(die_id, 0, sizeof(die_id));
+
+	uid_s = getenv("serial");

why not call a cat a cat?

Why not give the cat a fitting name?

Quoted 8 lines
Quoted 4 lines

The user gets a serial number, so we name it serial. How and where we get it from is hidden from user. It wouldn't help to name it "die ID" for user, nobody would know what this is. But serial number is clear to every body.

serial number is board specific not CPU specific

when you product board and need to track then, you need to have a serial number that can not change even if you when the cpu.

Hmmh. With OMAP3 SoC we have a (serial) number we can easily access and report independent of board similar on all OMAP3 based boards. Yes, you are right, this is no board serial number. But as OMAP3 is something like 515-pin PBGA with .4mm/.65mm pitch, board and cpu (SoC) will most probably never be split/exchanged by 'normal' user. I really hope that for OMAP3 you can accept that we report OMAP3 serial number and not (maybe even not existing) board serial number?

Thanks

Dirk

#14 lore raw

PATCH 5/7 OMAP3: Add serial number based on die ID

In reply to Dirk Behme

Dear Dirk Behme,

Quoted 1 line · In message <[email protected]> you…

Add serial number based on OMAP3 die ID.

Sorry for the late response, but...

cpu/arm_cortexa8/omap3/sys_info.c static gpmc_csx_t *gpmc_cs_base = (gpmc_ · line 58

Quoted 1 line
cpu/arm_cortexa8/omap3/sys_info.c +1 -0
+		setenv("serial", die_id);

U-Boot uses "serial#" - please stick to the standard name, too.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Only a fool fights in a burning house.
	-- Kank the Klingon, "Day of the Dove", stardate unknown
author
#16 lore raw

PATCH 4/7 OMAP3: Pandora: Update pin mux

Dear Jean-Christophe,

Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line · Dirk Behme

Update Pandora pin mux.

for what and why?

Well, this is a very good example of why it is good to "use macros instead of hard coded values" :)

Looking at the changes done in this patch, thanks to the macros used, it is obvious that here pulls are enabled for MMC data/cmd lines, and disabled for clock line. In case you are familiar with MMC hardware configuration, you should know why this is necessary.

Dirk

#17 lore raw

PATCH 4/7 OMAP3: Pandora: Update pin mux

Quoted 7 lines · Dirk Behme

Dear Jean-Christophe,

Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line · Dirk Behme

Update Pandora pin mux.

for what and why?

Quoted 7 lines

Well, this is a very good example of why it is good to "use macros instead of hard coded values" :)

Looking at the changes done in this patch, thanks to the macros used, it is obvious that here pulls are enabled for MMC data/cmd lines, and disabled for clock line. In case you are familiar with MMC hardware configuration, you should know why this is necessary.

so please update the commit message to explain it

Best Regards,
J.

author
#18 lore raw

PATCH 4/7 OMAP3: Pandora: Update pin mux

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Dirk Behme

Dear Jean-Christophe,

Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line · Dirk Behme

Update Pandora pin mux.

for what and why?

Quoted 8 lines
Quoted 7 lines

Well, this is a very good example of why it is good to "use macros instead of hard coded values" :)

Looking at the changes done in this patch, thanks to the macros used, it is obvious that here pulls are enabled for MMC data/cmd lines, and disabled for clock line. In case you are familiar with MMC hardware configuration, you should know why this is necessary.

so please update the commit message to explain it

Sorry of being unclear: I meant that every necessary explanation is already there if you look carefully.

Dirk

#19 lore raw

PATCH 4/7 OMAP3: Pandora: Update pin mux

Here is a patch with better commit message. Hope it helps.

#20 lore raw

PATCH 2/7 OMAP3: Beagle: Add board revision detection

In reply to Dirk Behme

board/omap3/beagle/beagle.c int board_init(void) · line 66

Quoted 12 lines

/******************************************************************************
+ * Routine: board_identify
+ * Description: Detect if we are running on a Beagle revision Ax/Bx or
+ * Cx. This can be done by GPIO_171. If this is low, we are
+ * running on a revision C board.
+ *****************************************************************************/

board/omap3/beagle/beagle.c +5 -0
+void board_identify(void)
+{
+	gpio_t *gpio6_base = (gpio_t *)OMAP34XX_GPIO6_BASE;
+
+	/* Configure GPIO 171 as input */

we may need to start to think about merge to the gpiolib to simplify it

board/omap3/beagle/beagle.c int board_init(void) · line 73

Quoted 7 lines
board/omap3/beagle/beagle.c +7 -0
+	writel(readl(&gpio6_base->oe) | GPIO11, &gpio6_base->oe);
+
+	/* Get value of GPIO 171 */
+	beagle_revision_c = readl(&gpio6_base->datain) & BOARD_REVISION_MASK;
+
+	printf("Board revision ");
+	if (beagle_revision_c) {

???
I'm not a fan of glabal var please create a function that will return if it's a rev c or not

Best Regards,
J.

author
#21 lore raw

PATCH 2/7 OMAP3: Beagle: Add board revision detection

Dear Jean-Christophe,

Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD

board/omap3/beagle/beagle.c int board_init(void) · line 66

Quoted 12 lines

/******************************************************************************
+ * Routine: board_identify
+ * Description: Detect if we are running on a Beagle revision Ax/Bx or
+ * Cx. This can be done by GPIO_171. If this is low, we are
+ * running on a revision C board.
+ *****************************************************************************/

board/omap3/beagle/beagle.c +5 -0
+void board_identify(void)
+{
+	gpio_t *gpio6_base = (gpio_t *)OMAP34XX_GPIO6_BASE;
+
+	/* Configure GPIO 171 as input */

we may need to start to think about merge to the gpiolib to simplify it

Quoted 9 lines

board/omap3/beagle/beagle.c int board_init(void) · line 73

Quoted 7 lines
board/omap3/beagle/beagle.c +7 -0
+	writel(readl(&gpio6_base->oe) | GPIO11, &gpio6_base->oe);
+
+	/* Get value of GPIO 171 */
+	beagle_revision_c = readl(&gpio6_base->datain) & BOARD_REVISION_MASK;
+
+	printf("Board revision ");
+	if (beagle_revision_c) {

???
I'm not a fan of glabal var

And I'm not a fan of bad weather. But I'm not sure if it really matters here what we are fans of? ;)

Quoted 2 lines

please create a function that will return if it's
a rev c or not

And where should this function you propose get the info from which board revision it is?

Note that we follow here (and in the serial number patch) the concept of "touch hardware only once, remember the value and then deal with the remembered value. Don't touch hardware again if done already". I.e. it's the concept behind this to not have a function to read HW (and do masking etc) again and again if revision value is needed.

Dirk

#22 lore raw

PATCH 2/7 OMAP3: Beagle: Add board revision detection

Quoted 26 lines · Dirk Behme

Dear Jean-Christophe,

Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD

board/omap3/beagle/beagle.c int board_init(void) · line 66

Quoted 12 lines

/******************************************************************************
+ * Routine: board_identify
+ * Description: Detect if we are running on a Beagle revision Ax/Bx or
+ * Cx. This can be done by GPIO_171. If this is low, we are
+ * running on a revision C board.
+ *****************************************************************************/

board/omap3/beagle/beagle.c +5 -0
+void board_identify(void)
+{
+	gpio_t *gpio6_base = (gpio_t *)OMAP34XX_GPIO6_BASE;
+
+	/* Configure GPIO 171 as input */

we may need to start to think about merge to the gpiolib to simplify it

Quoted 9 lines

board/omap3/beagle/beagle.c int board_init(void) · line 73

Quoted 7 lines
board/omap3/beagle/beagle.c +7 -0
+	writel(readl(&gpio6_base->oe) | GPIO11, &gpio6_base->oe);
+
+	/* Get value of GPIO 171 */
+	beagle_revision_c = readl(&gpio6_base->datain) & BOARD_REVISION_MASK;
+
+	printf("Board revision ");
+	if (beagle_revision_c) {

???
I'm not a fan of glabal var

Quoted 2 lines

And I'm not a fan of bad weather. But I'm not sure if it really matters here what we are fans of? ;)

global var NACK specialy when other code is not supposed to change it's value

you have other clean way to do it as static var with a function to return it

please change to this

Best Regards,
J.

#23 lore raw

PATCH 1/7 OMAP3: Overo: Clean up pin mux and GPIO configuration

In reply to Dirk Behme
Quoted 6 lines · Dirk Behme

* Make Overo GPIO114 an input for touchscreen PENDOWN
* Make Overo GPIO144-147 readable
* Make Overo EHCI pinmux match beagle rev c setup
* Adjust pinmux for SMSC911X network chip support
* Remove unnecessary GPIO setup
* Fix merge error in Makefile

maybe we could split it a few more
because it's not so easy to folow which modification fix what?

Best Regards,
J.

author
#24 lore raw

PATCH 1/7 OMAP3: Overo: Clean up pin mux and GPIO configuration

Dear Jean-Christophe,

Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Dirk Behme

* Make Overo GPIO114 an input for touchscreen PENDOWN
* Make Overo GPIO144-147 readable
* Make Overo EHCI pinmux match beagle rev c setup
* Adjust pinmux for SMSC911X network chip support
* Remove unnecessary GPIO setup
* Fix merge error in Makefile

maybe we could split it a few more

Yes, we could. But no, we don't want to split ~20 changed lines into even smaller parts to

a) avoid spamming the list

b) avoid polluting the git history

Quoted 1 line

because it's not so easy to folow which modification fix what?

Well, looking at the patch, I would say that it is obvious that

* Make Overo GPIO114 an input for touchscreen PENDOWN

refers to the change which is commented with /*GPIO_114*/\

and

* Make Overo GPIO144-147 readable

refers to the change with the comments GPIO_144, GPIO_145, GPIO_146 and GPIO_147

and

* Make Overo EHCI pinmux match beagle rev c setup

refers to the change with USB comment

and

* Adjust pinmux for SMSC911X network chip support

refers to the change with SMSC911X comment

and

* Remove unnecessary GPIO setup

refers to the changes which remove GPIO stuff commented e.g. with "/* Set GPIOs */"

and

* Fix merge error in Makefile

refers to the change in Makefile
+++ u-boot-main/board/omap3/overo/Makefile

Dirk

#25 lore raw

cover OMAP3: Add some additional improvements and fixes

In reply to Dirk Behme
Quoted 8 lines · Dirk Behme

OMAP3 support recently merged is version from mid december 2008. This patch series adds some additional clean up, fixes and improvements done since then. It brings U-Boot mainline in sync with U-Boot tree of OMAP3 developers ("omap3-dev").

This patch series is against U-Boot mainline, commit 6c6e042ab3bbfb5428e4cdeb38fa27728c63afdd "Merge branch 'master' of git://git.denx.de/u-boot-arm"

I've reviewed these patches and have been using them for a couple of days now. No issues. Thanks.