Skip to contentSkip to conversation

da850: add NOR boot mode support

PATCH New nagabhushana.netagunte at ti.com 5 participants 28 messages Jul 28, 2011 – Aug 1, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 da850: add NOR boot mode support

From: Nagabhushana Netagunte <[email protected]>

Add an option to use NOR boot mode in configuration file and correspanding pin-mux support in board file.

---
 board/davinci/da8xxevm/da850evm.c |   50 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |   21 ++++++++++++++-
 2 files changed, 70 insertions(+), 1 deletions(-)
board/davinci/da8xxevm/da850evm.c +50 -0
index 73eaa48..a77e438 100644
@@ -105,6 +105,54 @@ const struct pinmux_config nand_pins[] = {
 	{ pinmux(12), 1, 5 },
 	{ pinmux(12), 1, 6 }
 };
+#elif defined(CONFIG_SYS_USE_NOR)
+const struct pinmux_config nor_pins[] = {
+	{ pinmux(5), 1, 6 },
+	{ pinmux(6), 1, 6 },
+	{ pinmux(7), 1, 0 },
+	{ pinmux(7), 1, 4 },
+	{ pinmux(7), 1, 5 },
+	{ pinmux(8), 1, 0 },
+	{ pinmux(8), 1, 1 },
+	{ pinmux(8), 1, 2 },
+	{ pinmux(8), 1, 3 },
+	{ pinmux(8), 1, 4 },
+	{ pinmux(8), 1, 5 },
+	{ pinmux(8), 1, 6 },
+	{ pinmux(8), 1, 7 },
+	{ pinmux(9), 1, 0 },
+	{ pinmux(9), 1, 1 },
+	{ pinmux(9), 1, 2 },
+	{ pinmux(9), 1, 3 },
+	{ pinmux(9), 1, 4 },
+	{ pinmux(9), 1, 5 },
+	{ pinmux(9), 1, 6 },
+	{ pinmux(9), 1, 7 },
+	{ pinmux(10), 1, 0 },
+	{ pinmux(10), 1, 1 },
+	{ pinmux(10), 1, 2 },
+	{ pinmux(10), 1, 3 },
+	{ pinmux(10), 1, 4 },
+	{ pinmux(10), 1, 5 },
+	{ pinmux(10), 1, 6 },
+	{ pinmux(10), 1, 7 },
+	{ pinmux(11), 1, 0 },
+	{ pinmux(11), 1, 1 },
+	{ pinmux(11), 1, 2 },
+	{ pinmux(11), 1, 3 },
+	{ pinmux(11), 1, 4 },
+	{ pinmux(11), 1, 5 },
+	{ pinmux(11), 1, 6 },
+	{ pinmux(11), 1, 7 },
+	{ pinmux(12), 1, 0 },
+	{ pinmux(12), 1, 1 },
+	{ pinmux(12), 1, 2 },
+	{ pinmux(12), 1, 3 },
+	{ pinmux(12), 1, 4 },
+	{ pinmux(12), 1, 5 },
+	{ pinmux(12), 1, 6 },
+	{ pinmux(12), 1, 7 }
+};
 #endif
 
 #ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII
@@ -122,6 +170,8 @@ static const struct pinmux_resource pinmuxes[] = {
 	PINMUX_ITEM(i2c_pins),
 #ifdef CONFIG_NAND_DAVINCI
 	PINMUX_ITEM(nand_pins),
+#elif defined(CONFIG_USE_NOR)
+	PINMUX_ITEM(nor_pins),
 #endif
 };
 
include/configs/da850evm.h +20 -1
index fdcc6e3..f0015e4 100644
@@ -28,6 +28,8 @@
  */
 #define CONFIG_DRIVER_TI_EMAC
 #define CONFIG_USE_SPIFLASH
+#undef CONFIG_USE_NAND
+#undef CONFIG_SYS_USE_NOR
 
 /*
  * SoC Configuration
@@ -129,6 +131,23 @@
 #define CONFIG_NET_MULTI
 #endif
 
+#ifdef CONFIG_SYS_USE_NOR
+#define CONFIG_ENV_IS_IN_FLASH
+#undef CONFIG_SYS_NO_FLASH
+#define CONFIG_FLASH_CFI_DRIVER
+#define CONFIG_SYS_FLASH_CFI
+#define CONFIG_SYS_FLASH_PROTECTION
+#define CONFIG_SYS_MAX_FLASH_BANKS	1 /* max number of flash banks */
+#define CONFIG_SYS_FLASH_SECT_SZ	(128 << 10) /* 128KB */
+#define CONFIG_ENV_OFFSET		(CONFIG_SYS_FLASH_SECT_SZ * 3)
+#define CONFIG_ENV_SIZE			(128 << 10)
+#define CONFIG_SYS_FLASH_BASE		DAVINCI_ASYNC_EMIF_DATA_CE2_BASE
+#define PHYS_FLASH_SIZE			(8 << 20) /* Flash size 8MB */
+#define CONFIG_SYS_MAX_FLASH_SECT ((PHYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ)\
+	       + 3)
+#define CONFIG_ENV_SECT_SIZE		CONFIG_SYS_FLASH_SECT_SZ
+#endif
+
 #ifdef CONFIG_USE_SPIFLASH
 #undef CONFIG_ENV_IS_IN_FLASH
 #undef CONFIG_ENV_IS_IN_NAND
@@ -212,7 +231,7 @@
 #endif
 
 #if !defined(CONFIG_USE_NAND) && \
-	!defined(CONFIG_USE_NOR) && \
+	!defined(CONFIG_SYS_USE_NOR) && \
 	!defined(CONFIG_USE_SPIFLASH)
 #define CONFIG_ENV_IS_NOWHERE
 #define CONFIG_SYS_NO_FLASH
Signature · 1 line
1.6.2.4
#1 lore raw

PATCH 1/1 da850: add cache management support in config file

From: Nagabhushana Netagunte <[email protected]>

add support for cache management in config file. This is needed as per new cache management framework. da850 doesnt support I-CACHE, D-CACHE or L2-CACHE usage which is indicated by following definitions,

1. CONFIG_SYS_ICACHE_OFF
2. CONFIG_SYS_DCACHE_OFF
3. CONFIG_SYS_L2CACHE_OFF

---
 include/configs/da850evm.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/configs/da850evm.h +3 -0
index bbb5a9b..fdcc6e3 100644
@@ -42,6 +42,9 @@
 #define CONFIG_SYS_HZ			1000
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SYS_TEXT_BASE		0xc1080000
+#define CONFIG_SYS_ICACHE_OFF
+#define CONFIG_SYS_DCACHE_OFF
+#define CONFIG_SYS_L2CACHE_OFF
 
 /*
  * Memory Info
Signature · 1 line
1.6.2.4
#2 lore raw

PATCH 1/1 da850: add cache management support in config file

Hi,

Quoted 10 lines

From: Nagabhushana Netagunte <[email protected]>

add support for cache management in config file. This is needed as per new cache management framework. da850 doesnt support I-CACHE, D-CACHE or L2-CACHE usage which is indicated by following definitions,

1. CONFIG_SYS_ICACHE_OFF
2. CONFIG_SYS_DCACHE_OFF
3. CONFIG_SYS_L2CACHE_OFF

This commit message makes no sense for me. You "add support" for something which essentially is "not supported" as you say. If you are trying to fix compile problems, then please say so.

Cheers
Detlev

Signature · 9 lines
... that every year or so they're going to give you a new release full
of 50 000  additional lines of code all  written  by monkeys.  Because
they generally follow  the  ``million monkeys typing,   and eventually
they'll come up with something useful'' school of system development.
	                                    -- Richard M. Stallman
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#3 lore raw

PATCH 1/1 da850: add cache management support in config file

Detlev,
Thanks for your comments, I will make appropriate changes to 'commit' message. -Nag

Quoted 27 lines · Detlev Zundel

Hi,

Quoted 9 lines

From: Nagabhushana Netagunte <[email protected]>

add support for cache management in config file. This is needed as per new cache management framework. da850 doesnt support I-CACHE, D-CACHE or L2-CACHE usage which is indicated by following definitions,

1. CONFIG_SYS_ICACHE_OFF
2. CONFIG_SYS_DCACHE_OFF
3. CONFIG_SYS_L2CACHE_OFF

This commit message makes no sense for me. You "add support" for something which essentially is "not supported" as you say. If you are trying to fix compile problems, then please say so.

Cheers
Detlev

--
... that every year or so they're going to give you a new release full of 50 000 additional lines of code all written by monkeys. Because
they generally follow the ``million monkeys typing, and eventually
they'll come up with something useful'' school of system development.
-- Richard M. Stallman
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

#4 lore raw

PATCH 1/1 da850: add provision to use RMII for EMAC

In reply to nagabhushana.netagunte at ti.com

From: Nagabhushana Netagunte <[email protected]>

Add provision to enable RMII support in configuration file.

---
 include/configs/da850evm.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/da850evm.h +1 -0
index f7bf6be..92bab82 100644
@@ -123,6 +123,7 @@
 #ifdef CONFIG_DRIVER_TI_EMAC
 #define CONFIG_EMAC_MDIO_PHY_NUM	0
 #define CONFIG_MII
+#undef CONFIG_DRIVER_TI_EMAC_USE_RMII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
 #define CONFIG_BOOTP_DNS2
Signature · 1 line
1.6.2.4
#5 lore raw

PATCH 1/1 da850: add provision to use RMII for EMAC

Hi,

Quoted 3 lines

From: Nagabhushana Netagunte <[email protected]>

Add provision to enable RMII support in configuration file.

What is that supposed to mean? You are actually adding an "undef", so nothing changes. What are you trying to achieve?

Quoted 11 lines
---
 include/configs/da850evm.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/da850evm.h +0 -0
index f7bf6be..92bab82 100644

include/configs/da850evm.h line 129

Quoted 7 lines
include/configs/da850evm.h +1 -0
@@ -123,6 +123,7 @@
 #ifdef CONFIG_DRIVER_TI_EMAC
 #define CONFIG_EMAC_MDIO_PHY_NUM	0
 #define CONFIG_MII
+#undef CONFIG_DRIVER_TI_EMAC_USE_RMII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
 #define CONFIG_BOOTP_DNS2

Cheers
Detlev

Signature · 7 lines
Ich hoffe, Sie verzeihen mir meine Leidenschaft.  Ich h?tte Ihnen Ihre
auch gerne verziehen.
                                     -- Dieter Hildebrandt
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#6 lore raw

PATCH 1/1 da850: add provision to use RMII for EMAC

Hi Detlev,
Thanks for your comments. I will remove this patch as this patch doesn't make sense. -Nag

Quoted 38 lines · Detlev Zundel

Hi,

Quoted 3 lines

From: Nagabhushana Netagunte <[email protected]>

Add provision to enable RMII support in configuration file.

What is that supposed to mean? You are actually adding an "undef", so nothing changes. What are you trying to achieve?

Quoted 11 lines
---
 include/configs/da850evm.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/da850evm.h +0 -0
index f7bf6be..92bab82 100644

include/configs/da850evm.h line 129

Quoted 7 lines
include/configs/da850evm.h +1 -0
@@ -123,6 +123,7 @@
 #ifdef CONFIG_DRIVER_TI_EMAC
 #define CONFIG_EMAC_MDIO_PHY_NUM	0
 #define CONFIG_MII
+#undef CONFIG_DRIVER_TI_EMAC_USE_RMII
 #define CONFIG_BOOTP_DEFAULT
 #define CONFIG_BOOTP_DNS
 #define CONFIG_BOOTP_DNS2

Cheers
Detlev

--
Ich hoffe, Sie verzeihen mir meine Leidenschaft. Ich h?tte Ihnen Ihre auch gerne verziehen.
-- Dieter Hildebrandt
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

#7 lore raw

PATCH 1/1 da850: add support for Spectrum Digital AM18xx EVM

In reply to nagabhushana.netagunte at ti.com

From: Manjunathappa, Prakash <[email protected]>

The AM18xx EVM contains winbond SPI flash instead of ST SPI flash in comparison with logic PD da850/omap-l138 EVM. So enable configuration to look for winbond flash.

---
 include/configs/da850evm.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/da850evm.h +1 -0
index 92bab82..2a61e06 100644
@@ -80,6 +80,7 @@
 #define CONFIG_SPI
 #define CONFIG_SPI_FLASH
 #define CONFIG_SPI_FLASH_STMICRO
+#define CONFIG_SPI_FLASH_WINBOND
 #define CONFIG_DAVINCI_SPI
 #define CONFIG_SYS_SPI_BASE		DAVINCI_SPI1_BASE
 #define CONFIG_SYS_SPI_CLK		clk_get(DAVINCI_SPI1_CLKID)
Signature · 1 line
1.6.2.4
#8 lore raw

PATCH 1/1 da850: add support to read mac address from spi flash

In reply to nagabhushana.netagunte at ti.com

From: Nagabhushana Netagunte <[email protected]>

add misc_int_r function to read the mac address from SPI flash if env variable ethaddr is not set.

---
 board/davinci/da8xxevm/da850evm.c |   65 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |    1 +
 2 files changed, 66 insertions(+), 0 deletions(-)
board/davinci/da8xxevm/da850evm.c +65 -0
index a77e438..8d09bb9 100644
@@ -25,10 +25,13 @@
 #include <i2c.h>
 #include <net.h>
 #include <netdev.h>
+#include <spi.h>
+#include <spi_flash.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/emif_defs.h>
 #include <asm/arch/emac_defs.h>
 #include <asm/io.h>
+#include <asm/errno.h>
 #include <asm/arch/davinci_misc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -383,4 +386,66 @@ int board_eth_init(bd_t *bis)
 
 	return 0;
 }
+
 #endif /* CONFIG_DRIVER_TI_EMAC */
+
+#define CFG_MAC_ADDR_SPI_BUS	0
+#define CFG_MAC_ADDR_SPI_CS	0
+#define CFG_MAC_ADDR_SPI_MAX_HZ	CONFIG_SF_DEFAULT_SPEED
+#define CFG_MAC_ADDR_SPI_MODE	SPI_MODE_3
+
+#define CFG_MAC_ADDR_OFFSET	(flash->size - SZ_64K)
+
+static int get_mac_addr(u8 *addr)
+{
+	int ret;
+	struct spi_flash *flash;
+
+	flash = spi_flash_probe(CFG_MAC_ADDR_SPI_BUS, CFG_MAC_ADDR_SPI_CS,
+			CFG_MAC_ADDR_SPI_MAX_HZ, CFG_MAC_ADDR_SPI_MODE);
+	if (!flash) {
+		printf(" Error - unable to probe SPI flash.\n");
+		ret = -1;
+		goto err_probe;
+	}
+
+	ret = spi_flash_read(flash, CFG_MAC_ADDR_OFFSET, 6, addr);
+	if (ret) {
+		printf("Error - unable to read MAC address from SPI flash.\n");
+		goto err_read;
+	}
+
+err_read:
+	/* cannot call free currently since the free function calls free() for
+	 * spi_flash structure though it is not directly allocated through
+	 * malloc()
+	 */
+err_probe:
+	return ret;
+}
+
+int misc_init_r(void)
+{
+	uint8_t tmp[20], addr[10];
+	int ret;
+
+	printf("ARM Clock : %d Hz\n", clk_get(DAVINCI_ARM_CLKID));
+
+	if (getenv("ethaddr") == NULL) {
+		/* Set Ethernet MAC address from EEPROM */
+		ret = get_mac_addr(addr);
+		if (ret != 0)
+			return -EINVAL;
+
+		if (is_multicast_ether_addr(addr) || is_zero_ether_addr(addr)) {
+			printf("Invalid MAC address read.\n");
+			return -EINVAL;
+		}
+		sprintf((char *)tmp, "%02x:%02x:%02x:%02x:%02x:%02x", addr[0],
+				addr[1], addr[2], addr[3], addr[4], addr[5]);
+
+		setenv("ethaddr", (char *)tmp);
+	}
+
+	return 0;
+}
include/configs/da850evm.h +1 -0
index 21d8fe3..f7bf6be 100644
@@ -161,6 +161,7 @@
 /*
  * U-Boot general configuration
  */
+#define CONFIG_MISC_INIT_R
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
 #define CONFIG_SYS_PROMPT	"U-Boot > " /* Command Prompt */
 #define CONFIG_SYS_CBSIZE	1024 /* Console I/O Buffer Size	*/
Signature · 1 line
1.6.2.4
#9 lore raw

PATCH 1/1 da850: add support to wake up DSP during board init

In reply to nagabhushana.netagunte at ti.com

From: Nagabhushana Netagunte <[email protected]>

Add support for DSP wake-up by default on DA850/OMAP-L138 during board initialization. To prevent DSP from being woken up, set the environment variable dspwake to 'no'.

---
 arch/arm/include/asm/arch-davinci/hardware.h |    5 +++
 board/davinci/da8xxevm/da850evm.c            |   51 ++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-davinci/hardware.h +5 -0
index d2b2989..c41d756 100644
@@ -151,7 +151,12 @@ typedef volatile unsigned int *	dv_reg_p;
 #define DAVINCI_DDR_EMIF_DATA_BASE		0xc0000000
 #define DAVINCI_INTC_BASE			0xfffee000
 #define DAVINCI_BOOTCFG_BASE			0x01c14000
+#define DAVINCI_L3CBARAM_BASE			0x80000000
 #define JTAG_ID_REG                            (DAVINCI_BOOTCFG_BASE + 0x18)
+#define CHIP_REV_ID_REG				(DAVINCI_BOOTCFG_BASE + 0x24)
+#define HOST1CFG				(DAVINCI_BOOTCFG_BASE + 0x44)
+#define PSC0_MDCTL				(DAVINCI_PSC0_BASE + 0xa00)
+
 
 #define GPIO_BANK2_REG_DIR_ADDR			(DAVINCI_GPIO_BASE + 0x38)
 #define GPIO_BANK2_REG_OPDATA_ADDR		(DAVINCI_GPIO_BASE + 0x3c)
board/davinci/da8xxevm/da850evm.c +51 -0

62 lines not on this page · raw message

Signature · 1 line
1.6.2.4
#10 lore raw

PATCH 1/1 da850: fix the channel number for EMAC teardown init

In reply to nagabhushana.netagunte at ti.com

From: Nagabhushana Netagunte <[email protected]>

TX and RX channel numbers programmed as '1' during EMAC teardown initialization is wrong. This patch fixes the same by setting channel number to '0' which is used by U-boot.

---
 drivers/net/davinci_emac.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/davinci_emac.c +2 -2
index 66c0d13..c0b8929 100644
@@ -457,7 +457,7 @@ static void davinci_eth_ch_teardown(int ch)
 
 	if (ch == EMAC_CH_TX) {
 		/* Init TX channel teardown */
-		writel(1, &adap_emac->TXTEARDOWN);
+		writel(0, &adap_emac->TXTEARDOWN);
 		do {
 			/*
 			 * Wait here for Tx teardown completion interrupt to
@@ -476,7 +476,7 @@ static void davinci_eth_ch_teardown(int ch)
 		writel(0, &adap_emac->TX0HDP);
 	} else {
 		/* Init RX channel teardown */
-		writel(1, &adap_emac->RXTEARDOWN);
+		writel(0, &adap_emac->RXTEARDOWN);
 		do {
 			/*
 			 * Wait here for Rx teardown completion interrupt to
Signature · 1 line
1.6.2.4
#11 lore raw

PATCH 1/1 da850: fix the channel number for EMAC teardown init

Dear nagabhushana.netagunte at ti.com,

Quoted 5 lines · In message <[email protected]>…

From: Nagabhushana Netagunte <[email protected]>

TX and RX channel numbers programmed as '1' during EMAC teardown initialization is wrong. This patch fixes the same by setting channel number to '0' which is used by U-boot.

Is this set of patches in any specific order? It appaers so, as it seems I cannot apply them in random order.

But then, you don't provide any numbering in the Subject: or elsewhere, so how should we know?

NAK for the whole set of patches. Please resubmit with proper numbering.

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
As in certain cults it is possible to kill a process if you know  its
true name.                      -- Ken Thompson and Dennis M. Ritchie
#12 lore raw

PATCH 1/1 da850: fix the channel number for EMAC teardown init

Thanks Denk for the comments.

Even though all the patches are separate w.r.t features, they have inter-dependency w.r.t applying. To make it easy for applying, I will send it as Single series with a cover letter as they are all related to da850. I hope
That is OK with you.

Thanks,
Nagabhushana

Quoted 26 lines · Wolfgang Denk

Dear nagabhushana.netagunte at ti.com,

Quoted 5 lines · In message <[email protected]>…

From: Nagabhushana Netagunte <[email protected]>

TX and RX channel numbers programmed as '1' during EMAC teardown initialization is wrong. This patch fixes the same by setting channel number to '0' which is used by U-boot.

Is this set of patches in any specific order? It appaers so, as it seems I cannot apply them in random order.

But then, you don't provide any numbering in the Subject: or elsewhere, so how should we know?

NAK for the whole set of patches. Please resubmit with proper numbering.

Best regards,

Wolfgang Denk

Signature · 4 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 As in certain cults it is possible to kill a process if you know  its
true name.                      -- Ken Thompson and Dennis M. Ritchie
#13 lore raw

PATCH 1/1 da850: modifications for Logic PD Rev.3 AM18xx EVM

In reply to nagabhushana.netagunte at ti.com

From: Nagabhushana Netagunte <[email protected]>

AHCLKR/UART1_RTS/GP0[11] pin needs to be configured for NOR to work on Rev.3 EVM. When GP0[11] is low, the SD0 interface will not work, but NOR flash will.

---
 arch/arm/include/asm/arch-davinci/hardware.h |    5 ++++-
 board/davinci/da8xxevm/da850evm.c            |   15 +++++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)
arch/arm/include/asm/arch-davinci/hardware.h +4 -1
index c41d756..3d6cb88 100644
@@ -157,7 +157,10 @@ typedef volatile unsigned int *	dv_reg_p;
 #define HOST1CFG				(DAVINCI_BOOTCFG_BASE + 0x44)
 #define PSC0_MDCTL				(DAVINCI_PSC0_BASE + 0xa00)
 
-
+#define GPIO_BANK0_REG_DIR_ADDR			(DAVINCI_GPIO_BASE + 0x10)
+#define GPIO_BANK0_REG_OPDATA_ADDR		(DAVINCI_GPIO_BASE + 0x14)
+#define GPIO_BANK0_REG_SET_ADDR			(DAVINCI_GPIO_BASE + 0x18)
+#define GPIO_BANK0_REG_CLR_ADDR			(DAVINCI_GPIO_BASE + 0x1c)
 #define GPIO_BANK2_REG_DIR_ADDR			(DAVINCI_GPIO_BASE + 0x38)
 #define GPIO_BANK2_REG_OPDATA_ADDR		(DAVINCI_GPIO_BASE + 0x3c)
 #define GPIO_BANK2_REG_SET_ADDR			(DAVINCI_GPIO_BASE + 0x40)
board/davinci/da8xxevm/da850evm.c +15 -0
index fd05703..a077368 100644
@@ -110,6 +110,8 @@ const struct pinmux_config nand_pins[] = {
 };
 #elif defined(CONFIG_SYS_USE_NOR)
 const struct pinmux_config nor_pins[] = {
+	/* GP0[11] is required for SD to work on Rev 3 EVMs */
+	{ pinmux(0), 8, 4 },	/* GP0[11] */
 	{ pinmux(5), 1, 6 },
 	{ pinmux(6), 1, 6 },
 	{ pinmux(7), 1, 0 },
@@ -229,6 +231,7 @@ u32 get_board_rev(void)
 
 int board_init(void)
 {
+	unsigned int val;
 #ifndef CONFIG_USE_IRQ
 	irq_init();
 #endif
@@ -276,6 +279,18 @@ int board_init(void)
 	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
 		return 1;
 
+#ifdef CONFIG_SYS_USE_NOR
+	/* Set the GPIO direction as output */
+	val = REG(GPIO_BANK0_REG_DIR_ADDR);
+	val &= ~(0x01 << 11);
+	REG(GPIO_BANK0_REG_DIR_ADDR) = val;
+
+	/* Set the output as low */
+	val = REG(GPIO_BANK0_REG_SET_ADDR);
+	val |= (0x01 << 11);
+	REG(GPIO_BANK0_REG_CLR_ADDR) = val;
+#endif
+
 #ifdef CONFIG_DRIVER_TI_EMAC
 	if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
 		return 1;
Signature · 1 line
1.6.2.4
#14 lore raw

PATCH 1/1 da850: modify default bootargs and bootcmd

In reply to nagabhushana.netagunte at ti.com

From: Nagabhushana Netagunte <[email protected]>

Starting from kernel 2.6.24 'rootwait' can be used to wait for the rootdevice to become ready, this is preferred over choosing a random delay.

In the case of da8xx/omap-l1xx the delay is dependant on the MMC card present and can take more than 10 seconds in some cases.

---
 include/configs/da850evm.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/configs/da850evm.h +3 -1
index 70d250e..21d8fe3 100644
@@ -185,7 +185,9 @@
 #define CONFIG_REVISION_TAG
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_BOOTARGS		\
-	"mem=32M console=ttyS2,115200n8 root=/dev/mtdblock2 rw noinitrd ip=dhcp"
+	"mem=32M console=ttyS2,115200n8 root=/dev/mmcblk0p1 rw rootwait ip=off"
+#define CONFIG_BOOTCMD		\
+	"sf probe 0;sf read 0xc0700000 0x80000 0x220000;bootm 0xc0700000"
 #define CONFIG_BOOTDELAY	3
 
 /*
Signature · 1 line
1.6.2.4
#15 lore raw

PATCH 1/1 da850: modify the U-Boot prompt string

In reply to nagabhushana.netagunte at ti.com

From: Nagabhushana Netagunte <[email protected]>

Modify U-Boot prompt string from "DA850-evm >" to "U-Boot >".

---
 include/configs/da850evm.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/configs/da850evm.h +1 -1
index f0015e4..70d250e 100644
@@ -162,7 +162,7 @@
  * U-Boot general configuration
  */
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
-#define CONFIG_SYS_PROMPT	"DA850-evm > " /* Command Prompt */
+#define CONFIG_SYS_PROMPT	"U-Boot > " /* Command Prompt */
 #define CONFIG_SYS_CBSIZE	1024 /* Console I/O Buffer Size	*/
 #define CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
 #define CONFIG_SYS_MAXARGS	16 /* max number of command args */
Signature · 1 line
1.6.2.4
#16 lore raw

PATCH 1/1 da850: pass board revision info to kernel

In reply to nagabhushana.netagunte at ti.com

From: Manjunathappa, Prakash <[email protected]>

The Spectrum Digital AM18xx EVM contains I2C EEPROM compared da850/omap-l138 Logic PD EVMs. This information is used to differentiate the EVMs and is passed to kernel via second byte of ATAG_REVISION.

---
 board/davinci/da8xxevm/da850evm.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
board/davinci/da8xxevm/da850evm.c +8 -0
index f7754fe..d99f1a0 100644
@@ -216,6 +216,14 @@ u32 get_board_rev(void)
 	else if (maxcpuclk >= 372000000)
 		rev = 1;
 
+	/* Spectrum Digital AM18xx EVM contains I2C EEPROM compared
+	   da850/omap-l138 Logic PD EVMs. This information is used to
+	   differentiate the EVMs and is passed to kernel via second
+	   byte of ATAG_REVISION. */
+
+	if (i2c_probe(0x50) == 0)
+		rev |= 0x100;
+
 	return rev;
 }
 
Signature · 1 line
1.6.2.4
#17 lore raw

PATCH 1/1 da850: print DDR frequency from u-boot

In reply to nagabhushana.netagunte at ti.com

From: Nagabhushana Netagunte <[email protected]>

Print DDR frequency when u-boot is coming up. Function is added in hardware.h to find which PLL clock used.

---
 arch/arm/include/asm/arch-davinci/hardware.h |   12 ++++++++++++
 board/davinci/da8xxevm/da850evm.c            |    1 +
 2 files changed, 13 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-davinci/hardware.h +12 -0
index 3d6cb88..514b359 100644
@@ -380,8 +380,14 @@ struct davinci_pllc_regs {
 #define DAVINCI_PLLC_DIV_MASK	0x1f
 
 #define ASYNC3          get_async3_src()
+#define EMIFB		get_emifb_src()
+
+#define PLL1_PLLM		((1 << 16) | DAVINCI_PLLM_CLKID)
+#define PLL1_SYSCLK1		((1 << 16) | 0x1)
 #define PLL1_SYSCLK2		((1 << 16) | 0x2)
 #define DAVINCI_SPI1_CLKID  (cpu_is_da830() ? 2 : ASYNC3)
+#define DAVINCI_DDR_CLKID	EMIFB
+
 /* Clock IDs */
 enum davinci_clk_ids {
 	DAVINCI_SPI0_CLKID = 2,
@@ -485,6 +491,12 @@ static inline int get_async3_src(void)
 			PLL1_SYSCLK2 : 2;
 }
 
+static inline int get_emifb_src(void)
+{
+	return (REG(&davinci_syscfg_regs->cfgchip3) & 0x80) ?
+			PLL1_PLLM : PLL1_SYSCLK1;
+}
+
 #endif /* CONFIG_SOC_DA8XX */
 
 #endif /* __ASM_ARCH_HARDWARE_H */
board/davinci/da8xxevm/da850evm.c +1 -0
index a077368..55c5a22 100644
@@ -502,6 +502,7 @@ int misc_init_r(void)
 	int ret;
 
 	printf("ARM Clock : %d Hz\n", clk_get(DAVINCI_ARM_CLKID));
+	printf("DDR Clock : %d Hz\n", clk_get(DAVINCI_DDR_CLKID)/2);
 
 	if (getenv("ethaddr") == NULL) {
 		/* Read Ethernet MAC address from EEPROM */
Signature · 1 line
1.6.2.4
#18 lore raw

PATCH 1/1 da850: read MAC address from I2C EEPROM on AM18xx EVM

In reply to nagabhushana.netagunte at ti.com

From: Nagabhushana Netagunte <[email protected]>

The AM18xx EVM contains MAC address in I2C EEPROM compared da850/omap-l138 Logic PD EVM which maintains in SPI flash. So this patch tries to read MAC address from I2C EEPROM, in failure case reads from SPI flash assuming board to be da850/omap-l138 Logic PDS EVM.

---
 board/davinci/da8xxevm/da850evm.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
board/davinci/da8xxevm/da850evm.c +10 -4
index d99f1a0..fd05703 100644
@@ -489,10 +489,16 @@ int misc_init_r(void)
 	printf("ARM Clock : %d Hz\n", clk_get(DAVINCI_ARM_CLKID));
 
 	if (getenv("ethaddr") == NULL) {
-		/* Set Ethernet MAC address from EEPROM */
-		ret = get_mac_addr(addr);
-		if (ret != 0)
-			return -EINVAL;
+		/* Read Ethernet MAC address from EEPROM */
+		if (dvevm_read_mac_address(addr)) {
+			/* Set Ethernet MAC address from EEPROM */
+			davinci_sync_env_enetaddr(addr);
+		} else {
+			/* Set Ethernet MAC address from SPI flash */
+			ret = get_mac_addr(addr);
+			if (ret != 0)
+				return -EINVAL;
+		}
 
 		if (is_multicast_ether_addr(addr) || is_zero_ether_addr(addr)) {
 			printf("Invalid MAC address read.\n");
Signature · 1 line
1.6.2.4
#19 lore raw

PATCH 1/1 da850: read MAC address from I2C EEPROM on AM18xx EVM

Quoted 1 line · On Thu, Jul 28, 2011 at 09:25, <nagabhushana.netagunte@wrote:

? ? ? ?if (getenv("ethaddr") == NULL) {

this should get fixed to use the eth helper instead of poking the env yourself. see board/bf537-stamp/bf537-stamp.c as an example. -mike

#20 lore raw

PATCH 1/1 da850: read MAC address from I2C EEPROM on AM18xx EVM

Quoted 5 lines · Mike Frysinger
Quoted 1 line · On Thu, Jul 28, 2011 at 09:25, ?<nagabhushana.netagunte@wrote:

? ? ? ?if (getenv("ethaddr") == NULL) {

this should get fixed to use the eth helper instead of poking the env yourself. ?see board/bf537-stamp/bf537-stamp.c as an example.

actually, it looks like this patch is simply a fix for another patch you just sent out. please dont post buggy patches ... just squash the two together.

also, if you're posting patch series, you need to have [#/#] markers in the summary so that people can clearly see the order required for merging.
-mike

#21 lore raw

PATCH 1/1 da850: read MAC address from I2C EEPROM on AM18xx EVM

Hi Mike,
Thanks for your comments.

Since the earlier patch is about reading env variable value in SPI flash and
This patch concentrates on reading the same from I2C EEPROM, it will be better to have 2 different patches. Second patch is not to fix the first patch.

If you want them to sent after squashing, I can do that as well.

Regards,
Nag

Quoted 12 lines · Mike Frysinger
Quoted 5 lines · Mike Frysinger
Quoted 1 line · On Thu, Jul 28, 2011 at 09:25, ?<nagabhushana.netagunte@wrote:

? ? ? ?if (getenv("ethaddr") == NULL) {

this should get fixed to use the eth helper instead of poking the env yourself. ?see board/bf537-stamp/bf537-stamp.c as an example.

actually, it looks like this patch is simply a fix for another patch you just sent out. please dont post buggy patches ... just squash the two together.

also, if you're posting patch series, you need to have [#/#] markers in the summary so that people can clearly see the order required for merging. -mike

#22 lore raw

PATCH 1/1 da850: read MAC address from I2C EEPROM on AM18xx EVM

In reply to Mike Frysinger

Mike,
Thanks for your valuable comments; I will use the helper function you suggested.

-Nag

Quoted 6 lines · Mike Frysinger
Quoted 1 line · On Thu, Jul 28, 2011 at 09:25, <nagabhushana.netagunte@wrote:

? ? ? ?if (getenv("ethaddr") == NULL) {

this should get fixed to use the eth helper instead of poking the env yourself. see board/bf537-stamp/bf537-stamp.c as an example. -mike

#23 lore raw

PATCH 1/1 da8xx: add support for multiple PLL controllers

In reply to nagabhushana.netagunte at ti.com

From: Sudhakar Rajashekhara <[email protected]>

Add support for multiple PLL controllers and in the process, modify the clk_get() to work for multiple PLL controllers.

---
 arch/arm/cpu/arm926ejs/davinci/cpu.c         |   27 +++++++++++++++----------
 arch/arm/include/asm/arch-davinci/hardware.h |    1 +
 2 files changed, 17 insertions(+), 11 deletions(-)
arch/arm/cpu/arm926ejs/davinci/cpu.c +16 -11
index 8b57205..3ab56c7 100644
@@ -37,6 +37,7 @@
 #define PLLC_PLLDIV4	0x160
 #define PLLC_PLLDIV5	0x164
 #define PLLC_PLLDIV6	0x168
+#define PLLC_PLLDIV7	0x16c
 #define PLLC_PLLDIV8	0x170
 #define PLLC_PLLDIV9	0x174
 
@@ -61,11 +62,9 @@
 #endif
 
 #ifdef CONFIG_SOC_DA8XX
-const dv_reg * const sysdiv[7] = {
-	&davinci_pllc_regs->plldiv1, &davinci_pllc_regs->plldiv2,
-	&davinci_pllc_regs->plldiv3, &davinci_pllc_regs->plldiv4,
-	&davinci_pllc_regs->plldiv5, &davinci_pllc_regs->plldiv6,
-	&davinci_pllc_regs->plldiv7
+unsigned int sysdiv[9] = {
+	PLLC_PLLDIV1, PLLC_PLLDIV2, PLLC_PLLDIV3, PLLC_PLLDIV4, PLLC_PLLDIV5,
+	PLLC_PLLDIV6, PLLC_PLLDIV7, PLLC_PLLDIV8, PLLC_PLLDIV9
 };
 
 int clk_get(enum davinci_clk_ids id)
@@ -74,19 +73,26 @@ int clk_get(enum davinci_clk_ids id)
 	int pllm;
 	int post_div;
 	int pll_out;
+	volatile unsigned int pll_base;
 
 	pll_out = CONFIG_SYS_OSCIN_FREQ;
 
 	if (id == DAVINCI_AUXCLK_CLKID)
 		goto out;
 
+	if ((id >> 16) == 1)
+		pll_base = DAVINCI_PLL_CNTRL1_BASE;
+	else
+		pll_base = DAVINCI_PLL_CNTRL0_BASE;
+
+	id &= 0xFFFF;
+
 	/*
 	 * Lets keep this simple. Combining operations can result in
 	 * unexpected approximations
 	 */
-	pre_div = (readl(&davinci_pllc_regs->prediv) &
-		   DAVINCI_PLLC_DIV_MASK) + 1;
-	pllm = readl(&davinci_pllc_regs->pllm) + 1;
+	pre_div = (REG(pll_base + PLLC_PREDIV) & 0xff) + 1;
+	pllm = REG(pll_base + PLLC_PLLM) + 1;
 
 	pll_out /= pre_div;
 	pll_out *= pllm;
@@ -94,15 +100,14 @@ int clk_get(enum davinci_clk_ids id)
 	if (id == DAVINCI_PLLM_CLKID)
 		goto out;
 
-	post_div = (readl(&davinci_pllc_regs->postdiv) &
-		    DAVINCI_PLLC_DIV_MASK) + 1;
+	post_div = (REG(pll_base + PLLC_POSTDIV) & 0xff) + 1;
 
 	pll_out /= post_div;
 
 	if (id == DAVINCI_PLLC_CLKID)
 		goto out;
 
-	pll_out /= (readl(sysdiv[id - 1]) & DAVINCI_PLLC_DIV_MASK) + 1;
+	pll_out /= (REG(pll_base + sysdiv[id - 1]) & 0xff) + 1;
 
 out:
 	return pll_out;
arch/arm/include/asm/arch-davinci/hardware.h +1 -0
index df3f549..d2b2989 100644
@@ -129,6 +129,7 @@ typedef volatile unsigned int *	dv_reg_p;
 #define DAVINCI_TIMER1_BASE			0x01c21000
 #define DAVINCI_WDOG_BASE			0x01c21000
 #define DAVINCI_PLL_CNTRL0_BASE			0x01c11000
+#define DAVINCI_PLL_CNTRL1_BASE			0x01e1a000
 #define DAVINCI_PSC0_BASE			0x01c10000
 #define DAVINCI_PSC1_BASE			0x01e27000
 #define DAVINCI_SPI0_BASE			0x01c41000
Signature · 1 line
1.6.2.4
#24 lore raw

PATCH 1/1 da8xx: add support for multiple PLL controllers

Hi,

[...]

arch/arm/cpu/arm926ejs/davinci/cpu.c int clk_get(enum davinci_clk_ids id) · line 95

Quoted 5 lines
arch/arm/cpu/arm926ejs/davinci/cpu.c +2 -3
-	pre_div = (readl(&davinci_pllc_regs->prediv) &
-		   DAVINCI_PLLC_DIV_MASK) + 1;
-	pllm = readl(&davinci_pllc_regs->pllm) + 1;
+	pre_div = (REG(pll_base + PLLC_PREDIV) & 0xff) + 1;
+	pllm = REG(pll_base + PLLC_PLLM) + 1;

Nack - do not change "common" accessors into local macros. We should really strive to have a common base here. See also

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/104428

Cheers
Detlev

Signature · 5 lines
He thinks he's really smooth, but he's only C^1.
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#25 lore raw

PATCH 1/1 da8xx: add support for multiple PLL controllers

Detlev,
Thanks for your comments.
I will make appropriate changes to the patch.

-Nag

Quoted 24 lines · Detlev Zundel

Hi,

[...]

arch/arm/cpu/arm926ejs/davinci/cpu.c int clk_get(enum davinci_clk_ids id) · line 95

Quoted 5 lines
arch/arm/cpu/arm926ejs/davinci/cpu.c +2 -3
-	pre_div = (readl(&davinci_pllc_regs->prediv) &
-		   DAVINCI_PLLC_DIV_MASK) + 1;
-	pllm = readl(&davinci_pllc_regs->pllm) + 1;
+	pre_div = (REG(pll_base + PLLC_PREDIV) & 0xff) + 1;
+	pllm = REG(pll_base + PLLC_PLLM) + 1;

Nack - do not change "common" accessors into local macros. We should really strive to have a common base here. See also

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/104428

Cheers
Detlev

--
He thinks he's really smooth, but he's only C^1.
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

#26 lore raw

PATCH 1/1 da850: add NOR boot mode support

In reply to nagabhushana.netagunte at ti.com

Hi,

Quoted 17 lines

From: Nagabhushana Netagunte <[email protected]>

Add an option to use NOR boot mode in configuration file and correspanding pin-mux support in board file.

---
 board/davinci/da8xxevm/da850evm.c |   50 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |   21 ++++++++++++++-
 2 files changed, 70 insertions(+), 1 deletions(-)
board/davinci/da8xxevm/da850evm.c +0 -0
index 73eaa48..a77e438 100644

board/davinci/da8xxevm/da850evm.c const struct pinmux_config nand_pins[] = { · line 108

Quoted 4 lines
board/davinci/da8xxevm/da850evm.c +1 -0
@@ -105,6 +105,54 @@ const struct pinmux_config nand_pins[] = {
 	{ pinmux(12), 1, 5 },
 	{ pinmux(12), 1, 6 }
 };
+#elif defined(CONFIG_SYS_USE_NOR)

Can we have at least a little comment explaining what this long magic list does? I for one don't have the slightest clue to why it has to be like this.

Quoted 97 lines
board/davinci/da8xxevm/da850evm.c +49 -0
+const struct pinmux_config nor_pins[] = {
+	{ pinmux(5), 1, 6 },
+	{ pinmux(6), 1, 6 },
+	{ pinmux(7), 1, 0 },
+	{ pinmux(7), 1, 4 },
+	{ pinmux(7), 1, 5 },
+	{ pinmux(8), 1, 0 },
+	{ pinmux(8), 1, 1 },
+	{ pinmux(8), 1, 2 },
+	{ pinmux(8), 1, 3 },
+	{ pinmux(8), 1, 4 },
+	{ pinmux(8), 1, 5 },
+	{ pinmux(8), 1, 6 },
+	{ pinmux(8), 1, 7 },
+	{ pinmux(9), 1, 0 },
+	{ pinmux(9), 1, 1 },
+	{ pinmux(9), 1, 2 },
+	{ pinmux(9), 1, 3 },
+	{ pinmux(9), 1, 4 },
+	{ pinmux(9), 1, 5 },
+	{ pinmux(9), 1, 6 },
+	{ pinmux(9), 1, 7 },
+	{ pinmux(10), 1, 0 },
+	{ pinmux(10), 1, 1 },
+	{ pinmux(10), 1, 2 },
+	{ pinmux(10), 1, 3 },
+	{ pinmux(10), 1, 4 },
+	{ pinmux(10), 1, 5 },
+	{ pinmux(10), 1, 6 },
+	{ pinmux(10), 1, 7 },
+	{ pinmux(11), 1, 0 },
+	{ pinmux(11), 1, 1 },
+	{ pinmux(11), 1, 2 },
+	{ pinmux(11), 1, 3 },
+	{ pinmux(11), 1, 4 },
+	{ pinmux(11), 1, 5 },
+	{ pinmux(11), 1, 6 },
+	{ pinmux(11), 1, 7 },
+	{ pinmux(12), 1, 0 },
+	{ pinmux(12), 1, 1 },
+	{ pinmux(12), 1, 2 },
+	{ pinmux(12), 1, 3 },
+	{ pinmux(12), 1, 4 },
+	{ pinmux(12), 1, 5 },
+	{ pinmux(12), 1, 6 },
+	{ pinmux(12), 1, 7 }
+};
 #endif
 
 #ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII
@@ -122,6 +170,8 @@ static const struct pinmux_resource pinmuxes[] = {
 	PINMUX_ITEM(i2c_pins),
 #ifdef CONFIG_NAND_DAVINCI
 	PINMUX_ITEM(nand_pins),
+#elif defined(CONFIG_USE_NOR)
+	PINMUX_ITEM(nor_pins),
 #endif
 };
 
include/configs/da850evm.h +19 -0
index fdcc6e3..f0015e4 100644
@@ -28,6 +28,8 @@
  */
 #define CONFIG_DRIVER_TI_EMAC
 #define CONFIG_USE_SPIFLASH
+#undef CONFIG_USE_NAND
+#undef CONFIG_SYS_USE_NOR
 
 /*
  * SoC Configuration
@@ -129,6 +131,23 @@
 #define CONFIG_NET_MULTI
 #endif
 
+#ifdef CONFIG_SYS_USE_NOR
+#define CONFIG_ENV_IS_IN_FLASH
+#undef CONFIG_SYS_NO_FLASH
+#define CONFIG_FLASH_CFI_DRIVER
+#define CONFIG_SYS_FLASH_CFI
+#define CONFIG_SYS_FLASH_PROTECTION
+#define CONFIG_SYS_MAX_FLASH_BANKS	1 /* max number of flash banks */
+#define CONFIG_SYS_FLASH_SECT_SZ	(128 << 10) /* 128KB */
+#define CONFIG_ENV_OFFSET		(CONFIG_SYS_FLASH_SECT_SZ * 3)
+#define CONFIG_ENV_SIZE			(128 << 10)
+#define CONFIG_SYS_FLASH_BASE		DAVINCI_ASYNC_EMIF_DATA_CE2_BASE
+#define PHYS_FLASH_SIZE			(8 << 20) /* Flash size 8MB */
+#define CONFIG_SYS_MAX_FLASH_SECT ((PHYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ)\
+	       + 3)
+#define CONFIG_ENV_SECT_SIZE		CONFIG_SYS_FLASH_SECT_SZ
+#endif
+
 #ifdef CONFIG_USE_SPIFLASH
 #undef CONFIG_ENV_IS_IN_FLASH
 #undef CONFIG_ENV_IS_IN_NAND

include/configs/da850evm.h line 237

Quoted 8 lines
include/configs/da850evm.h +1 -1
@@ -212,7 +231,7 @@
 #endif
 
 #if !defined(CONFIG_USE_NAND) && \
-	!defined(CONFIG_USE_NOR) && \
+	!defined(CONFIG_SYS_USE_NOR) && \
 	!defined(CONFIG_USE_SPIFLASH)
 #define CONFIG_ENV_IS_NOWHERE
 #define CONFIG_SYS_NO_FLASH

Also I am somewhat sceptical about the names of the defines in this board config - there is for example the new CONFIG_SYS_USE_NOR and the "old" CONFIG_USE_NAND and CONFIG_USE_SPIFLASH. Looking into the README, I see this:

,----[ README ]

| There are two classes of configuration variables:
| 
| * Configuration _OPTIONS_:
|   These are selectable by the user and have names beginning with
|   "CONFIG_".
| 
| * Configuration _SETTINGS_:
|   These depend on the hardware etc. and should not be meddled with if
|   you don't know what you're doing; they have names beginning with
|   "CONFIG_SYS_".

`----

If the names are chosen correctly, then CONFIG_SYS_USE_NOR is coupled to the actual hardware, so either the hardware _has_ NOR flash, then it must be set, or it _doesn't_ have NOR flash, then we don't set it. But it seems the options are there to give the user a choice what medium he wants to use (for e.g. the environment). So if this is correct, then please strip the _SYS_ in them.

Cheers
Detlev

Signature · 6 lines
14474011154664524427946373126085988481573677491474835889066354349131199152128
If you know why this number is perfect - you're probably a mathematician...
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#27 lore raw

PATCH 1/1 da850: add NOR boot mode support

Zundel,
Thanks for your valuable comments. My reply inline.

-Nag

Quoted 14 lines · Detlev Zundel

Hi,

Quoted 12 lines

From: Nagabhushana Netagunte <[email protected]>

Add an option to use NOR boot mode in configuration file and correspanding pin-mux support in board file.

---
 board/davinci/da8xxevm/da850evm.c |   50 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |   21 ++++++++++++++-
 2 files changed, 70 insertions(+), 1 deletions(-)
Quoted 13 lines

board/davinci/da8xxevm/da850evm.c const struct pinmux_config nand_pins[] = { · line 108

Quoted 10 lines
board/davinci/da8xxevm/da850evm.c +1 -0
index 73eaa48..a77e438 100644
@@ -105,6 +105,54 @@ const struct pinmux_config nand_pins[] = {
 	{ pinmux(12), 1, 5 },
 	{ pinmux(12), 1, 6 }
 };
+#elif defined(CONFIG_SYS_USE_NOR)

Can we have at least a little comment explaining what this long magic list does? I for one don't have the slightest clue to why it has to be like this.

Will add comments.

Quoted 119 lines
Quoted 97 lines
board/davinci/da8xxevm/da850evm.c +47 -0
+const struct pinmux_config nor_pins[] = {
+	{ pinmux(5), 1, 6 },
+	{ pinmux(6), 1, 6 },
+	{ pinmux(7), 1, 0 },
+	{ pinmux(7), 1, 4 },
+	{ pinmux(7), 1, 5 },
+	{ pinmux(8), 1, 0 },
+	{ pinmux(8), 1, 1 },
+	{ pinmux(8), 1, 2 },
+	{ pinmux(8), 1, 3 },
+	{ pinmux(8), 1, 4 },
+	{ pinmux(8), 1, 5 },
+	{ pinmux(8), 1, 6 },
+	{ pinmux(8), 1, 7 },
+	{ pinmux(9), 1, 0 },
+	{ pinmux(9), 1, 1 },
+	{ pinmux(9), 1, 2 },
+	{ pinmux(9), 1, 3 },
+	{ pinmux(9), 1, 4 },
+	{ pinmux(9), 1, 5 },
+	{ pinmux(9), 1, 6 },
+	{ pinmux(9), 1, 7 },
+	{ pinmux(10), 1, 0 },
+	{ pinmux(10), 1, 1 },
+	{ pinmux(10), 1, 2 },
+	{ pinmux(10), 1, 3 },
+	{ pinmux(10), 1, 4 },
+	{ pinmux(10), 1, 5 },
+	{ pinmux(10), 1, 6 },
+	{ pinmux(10), 1, 7 },
+	{ pinmux(11), 1, 0 },
+	{ pinmux(11), 1, 1 },
+	{ pinmux(11), 1, 2 },
+	{ pinmux(11), 1, 3 },
+	{ pinmux(11), 1, 4 },
+	{ pinmux(11), 1, 5 },
+	{ pinmux(11), 1, 6 },
+	{ pinmux(11), 1, 7 },
+	{ pinmux(12), 1, 0 },
+	{ pinmux(12), 1, 1 },
+	{ pinmux(12), 1, 2 },
+	{ pinmux(12), 1, 3 },
+	{ pinmux(12), 1, 4 },
+	{ pinmux(12), 1, 5 },
+	{ pinmux(12), 1, 6 },
+	{ pinmux(12), 1, 7 }
+};
 #endif
 
 #ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII @@ -122,6 +170,8 @@ static 

const struct pinmux_resource pinmuxes[] = {

board/davinci/da8xxevm/da850evm.c +2 -0
 	PINMUX_ITEM(i2c_pins),
 #ifdef CONFIG_NAND_DAVINCI
 	PINMUX_ITEM(nand_pins),
+#elif defined(CONFIG_USE_NOR)
+	PINMUX_ITEM(nor_pins),
 #endif
 };
include/configs/da850evm.h +19 -0
index fdcc6e3..f0015e4 100644
@@ -28,6 +28,8 @@
  */
 #define CONFIG_DRIVER_TI_EMAC
 #define CONFIG_USE_SPIFLASH
+#undef CONFIG_USE_NAND
+#undef CONFIG_SYS_USE_NOR
 
 /*
  * SoC Configuration
@@ -129,6 +131,23 @@
 #define CONFIG_NET_MULTI
 #endif
 
+#ifdef CONFIG_SYS_USE_NOR
+#define CONFIG_ENV_IS_IN_FLASH
+#undef CONFIG_SYS_NO_FLASH
+#define CONFIG_FLASH_CFI_DRIVER
+#define CONFIG_SYS_FLASH_CFI
+#define CONFIG_SYS_FLASH_PROTECTION
+#define CONFIG_SYS_MAX_FLASH_BANKS	1 /* max number of flash banks */
+#define CONFIG_SYS_FLASH_SECT_SZ	(128 << 10) /* 128KB */
+#define CONFIG_ENV_OFFSET		(CONFIG_SYS_FLASH_SECT_SZ * 3)
+#define CONFIG_ENV_SIZE			(128 << 10)
+#define CONFIG_SYS_FLASH_BASE		DAVINCI_ASYNC_EMIF_DATA_CE2_BASE
+#define PHYS_FLASH_SIZE			(8 << 20) /* Flash size 8MB */
+#define CONFIG_SYS_MAX_FLASH_SECT ((PHYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ)\
+	       + 3)
+#define CONFIG_ENV_SECT_SIZE		CONFIG_SYS_FLASH_SECT_SZ
+#endif
+
 #ifdef CONFIG_USE_SPIFLASH
 #undef CONFIG_ENV_IS_IN_FLASH
 #undef CONFIG_ENV_IS_IN_NAND

include/configs/da850evm.h line 237

Quoted 8 lines
include/configs/da850evm.h +1 -1
@@ -212,7 +231,7 @@
 #endif
 
 #if !defined(CONFIG_USE_NAND) && \
-	!defined(CONFIG_USE_NOR) && \
+	!defined(CONFIG_SYS_USE_NOR) && \
 	!defined(CONFIG_USE_SPIFLASH)
 #define CONFIG_ENV_IS_NOWHERE
 #define CONFIG_SYS_NO_FLASH

Also I am somewhat sceptical about the names of the defines in this board config - there is for example the new CONFIG_SYS_USE_NOR and the "old" CONFIG_USE_NAND and CONFIG_USE_SPIFLASH. Looking into the README, I see this:

,----[ README ]

| There are two classes of configuration variables:
| 
| * Configuration _OPTIONS_:
|   These are selectable by the user and have names beginning with
|   "CONFIG_".
| 
| * Configuration _SETTINGS_:
|   These depend on the hardware etc. and should not be meddled with if
|   you don't know what you're doing; they have names beginning with
|   "CONFIG_SYS_".
Quoted 7 lines

`----

If the names are chosen correctly, then CONFIG_SYS_USE_NOR is coupled to the actual hardware, so either the hardware _has_ NOR flash, then it must be set, or it _doesn't_ have NOR flash, then we don't set it. But it seems the options are there to give the user a choice what medium he wants to use (for e.g. the environment). So if this is correct, then please strip the _SYS_ in them.

Cheers
Detlev

Will take care CONFIG name.

Quoted 8 lines

-- 14474011154664524427946373126085988481573677491474835889066354349131199152128 If you know why this number is perfect - you're probably a mathematician... --
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de