da850: add board specific functions
cover da850: add board specific functions
From: Nagabhushana Netagunte <[email protected]>
There are two boards AM18xx and L138 both of which are based on da850 SOC. AM18xx boards have mac address stored in I2C EEPROM and they have spi flash manufactured by WINBOND. L138 boards store mac address in SPI flash and they have SPI flash manufactured by ST Microelectronics.Due to these differences, instead of one config file, two config files are introduced to manage configs specific to board types.
Nagabhushana Netagunte (6):
da850: add new config file for AM18xx
da850: rename config file to represent OMAP-L138
da850: pass board revision info to kernel
da850: revert cache disable patch
da850: add support to read mac address from spi flash
da850: read MAC address from I2C EEPROM on AM18xx EVM
board/davinci/da8xxevm/da850evm.c | 76 +++++++++++- boards.cfg | 3 +- include/configs/da850_am18xxevm.h | 253 +++++++++++++++++++++++++++++++++++++ include/configs/da850_l138evm.h | 246 ++++++++++++++++++++++++++++++++++++ include/configs/da850evm.h | 249 ------------------------------------ 5 files changed, 576 insertions(+), 251 deletions(-) create mode 100644 include/configs/da850_am18xxevm.h create mode 100644 include/configs/da850_l138evm.h delete mode 100644 include/configs/da850evm.h
PATCH 1/6 da850: add new config file for AM18xx
From: Nagabhushana Netagunte <[email protected]>
add new configuration file da850_am18xxevm.h for AM18xx boards which are based on da850 SOC. AM18xx has WINBOND spi flash which is indicated in the config file. And make appropriate changes in board.cfg for building.
--- boards.cfg | 1 + include/configs/da850_am18xxevm.h | 245 +++++++++++++++++++++++++++++++++++++ 2 files changed, 246 insertions(+), 0 deletions(-) create mode 100644 include/configs/da850_am18xxevm.h
boards.cfg +1 -0
@@ -116,6 +116,7 @@ pm9263 arm arm926ejs pm9263 ronetix pm9g45 arm arm926ejs pm9g45 ronetix at91 pm9g45:AT91SAM9G45 da830evm arm arm926ejs da8xxevm davinci davinci da850evm arm arm926ejs da8xxevm davinci davinci +da850_am18xxevm arm arm926ejs da8xxevm davinci davinci hawkboard arm arm926ejs da8xxevm davinci davinci hawkboard_nand arm arm926ejs da8xxevm davinci davinci hawkboard:NAND_U_BOOT hawkboard_uart arm arm926ejs da8xxevm davinci davinci hawkboard:UART_U_BOOT
include/configs/da850_am18xxevm.h new file +245 -0
245 lines not on this page · raw message
Signature · 1 line
1.6.2.4
PATCH 2/6 da850: rename config file to represent OMAP-L138
In reply to nagabhushana.netagunte at ti.comFrom: Nagabhushana Netagunte <[email protected]>
rename config file da850evm.h as da850_l138evm.h to represent omap l138 board based on da850 SOC. L138 boards dont have WINBOND SPI flash, corresponding config is removed. Appropriate changes are made in boards.cfg for building.
--- boards.cfg | 2 +- include/configs/da850_l138evm.h | 248 ++++++++++++++++++++++++++++++++++++++ include/configs/da850evm.h | 249 --------------------------------------- 3 files changed, 249 insertions(+), 250 deletions(-) create mode 100644 include/configs/da850_l138evm.h delete mode 100644 include/configs/da850evm.h
boards.cfg +1 -1
@@ -115,7 +115,7 @@ pm9261 arm arm926ejs pm9261 ronetix pm9263 arm arm926ejs pm9263 ronetix at91 pm9263:AT91SAM9263 pm9g45 arm arm926ejs pm9g45 ronetix at91 pm9g45:AT91SAM9G45 da830evm arm arm926ejs da8xxevm davinci davinci -da850evm arm arm926ejs da8xxevm davinci davinci +da850_l138evm arm arm926ejs da8xxevm davinci davinci da850_am18xxevm arm arm926ejs da8xxevm davinci davinci hawkboard arm arm926ejs da8xxevm davinci davinci hawkboard_nand arm arm926ejs da8xxevm davinci davinci hawkboard:NAND_U_BOOT
include/configs/da850_l138evm.h new file +248 -0
248 lines not on this page · raw message
include/configs/da850evm.h deleted +0 -249
249 lines not on this page · raw message
Signature · 1 line
1.6.2.4
PATCH 3/6 da850: pass board revision info to kernel
In reply to nagabhushana.netagunte at ti.comFrom: Nagabhushana Netagunte <[email protected]>
there are two boards based on da850 SOC - OMAP-L138 and AM18xx. In order to differentiate between these two boards, revision id is passed to kernel via second byte of ATAG_REVISION.
--- board/davinci/da8xxevm/da850evm.c | 6 +++++- include/configs/da850_am18xxevm.h | 1 + 2 files changed, 6 insertions(+), 1 deletions(-)
board/davinci/da8xxevm/da850evm.c +5 -1
@@ -249,6 +249,8 @@ static const struct lpsc_resource lpsc[] = {#define CONFIG_DA850_EVM_MAX_CPU_CLK 300000000#endif +#define REV_AM18XX_EVM 0x100 +/* * get_board_rev() - setup to pass kernel board revision information * Returns:
@@ -274,7 +276,9 @@ u32 get_board_rev(void) rev =2 ; else if (maxcpuclk >= 372000000) rev =1 ; - +#ifdef CONFIG_DA850_AM18XX_EVM + rev |=REV_AM18XX_EVM ; +#endif return rev; }
include/configs/da850_am18xxevm.h +1 -0
@@ -43,6 +43,7 @@#define CONFIG_SYS_HZ 1000#define CONFIG_SKIP_LOWLEVEL_INIT #define CONFIG_SYS_TEXT_BASE 0xc1080000 +#define CONFIG_DA850_AM18XX_EVM /* * Memory Info
Signature · 1 line
1.6.2.4
PATCH 4/6 da850: revert cache disable patch
In reply to nagabhushana.netagunte at ti.comFrom: Nagabhushana Netagunte <[email protected]>
revert commit bd65d006a6088bcb857e079447d7549e2cd7054d as cache disabling is no more needed. Subsequent patches to new cache management framework has fixed EMAC issue with cache coherency.
--- include/configs/da850_l138evm.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
include/configs/da850_l138evm.h +0 -3
@@ -43,9 +43,6 @@#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
PATCH 4/6 da850: revert cache disable patch
Quoted 16 lines · nagabhushana.netagunte at ti.com
From: Nagabhushana Netagunte <[email protected]>
revert commit
bd65d006a6088bcb857e079447d7549e2cd7054das cache disabling is no more needed. Subsequent patches to new cache management framework has fixed EMAC issue with cache coherency.Signed-off-by Nagabhushana Netagunte <[email protected]>--- include/configs/da850_l138evm.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)include/configs/da850_l138evm.h +0
-0
include/configs/da850_l138evm.h line 48
Quoted 9 lines
include/configs/da850_l138evm.h +0
-3@@ -43,9 +43,6 @@#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
Am I correct in thinking that what you mean is that caches are now disabled by default, and therefore you don't need to explicitly disable them? I guess so, since I couldn't find any posted patches to fix the EMAC driver (though I would be very glad if I was wrong about this!).
If so, we haven't actually "fixed EMAC issue with cache coherency" - the driver is still broken if caches are enabled, and the commit message should reflect that. The same would apply to the dm644X and dm36x cache disable patches.
Bye for now,
Signature · 3 lines
Laurence Withers, <[email protected]> http://www.guralp.com/ Direct tel:+447753988197 or tel:+443333408643 Software Engineer General support queries: <[email protected]> CMG-DCM CMG-EAM CMG-NAM
Netagunte
PATCH 4/6 da850: revert cache disable patch
Hi Laurence,
Quoted 24 lines · Laurence Withers
Quoted 23 lines · nagabhushana.netagunte at ti.com
From: Nagabhushana Netagunte <[email protected]>
revert commit
bd65d006a6088bcb857e079447d7549e2cd7054das cache disabling is no more needed. Subsequent patches to new cache management framework has fixed EMAC issue with cache coherency.Signed-off-by Nagabhushana Netagunte <[email protected]>--- include/configs/da850_l138evm.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/include/configs/da850_l138evm.hindex 347893c..0bd630f 100644include/configs/da850_l138evm.h +0
-3@@ -43,9 +43,6 @@#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
Quoted 4 lines
include/configs/da850_l138evm.h line 48
Quoted 2 lines
include/configs/da850_l138evm.h +0
-0/* * Memory Info Am I correct in thinking that what you mean is that caches are now disabled by default, and therefore you don't need to explicitly disable them? I guess so, since I couldn't find any posted patches to fix the EMAC driver (though I would be very glad if I was wrong about this!).
That is right. We will definitely come back to fixing EMAC after come time.
Quoted 2 lines
If so, we haven't actually "fixed EMAC issue with cache coherency" - the driver is still broken if caches are enabled, and the commit message should reflect that. The same would apply to the dm644X and dm36x cache disable patches.
Sure. Will correct that.
Thx,
Nag
Quoted 7 lines
Bye for now,
Signature · 3 lines
Laurence Withers, <[email protected]> http://www.guralp.com/ Direct tel:+447753988197 or tel:+443333408643 Software Engineer General support queries: <[email protected]> CMG-DCM CMG-EAM CMG-NAM
PATCH 5/6 da850: add support to read mac address from spi flash
In reply to nagabhushana.netagunte at ti.comFrom: Nagabhushana Netagunte <[email protected]>
add support to read mac address from spi flash if env variable is not set. This is supported only on L138 boards based on da850 SOC. Introduced a macro CONFIG_MAC_ADDR_IN_SPIFLASH indicating where to look mac address for.
--- board/davinci/da8xxevm/da850evm.c | 63 +++++++++++++++++++++++++++++++++++++ include/configs/da850_l138evm.h | 1 + 2 files changed, 64 insertions(+), 0 deletions(-)
board/davinci/da8xxevm/da850evm.c +63 -0
@@ -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> #include <hwconfig.h>
@@ -166,6 +169,44 @@ const struct pinmux_config nor_pins[] = {#endif #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) + +#ifdef CONFIG_MAC_ADDR_IN_SPIFLASH +static int get_mac_addr (u8 *addr) +{ +struct spi_flash *flash; +int ret; + + + 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; +} +#endif +void dsp_lpsc_on (unsigned domain,unsigned int id) {dv_reg_p mdstat, mdctl, ptstat, ptcmd;
@@ -220,7 +261,29 @@ static void dspwake(void)int misc_init_r (void ) { +uint8_t enetaddr[8 ]; +uchar buff[8 ]; +int ret; +dspwake (); + +#ifdef CONFIG_MAC_ADDR_IN_SPIFLASH +if (!eth_getenv_enetaddr ("ethaddr" , buff)) { + ret =get_mac_addr (buff); +if (ret !=0 ) +return -EINVAL ; + +if (is_multicast_ether_addr (buff) || +is_zero_ether_addr (buff)) { +printf ("Invalid MAC address read.\n" ); +return -EINVAL ; + } + +sprintf ((char *)enetaddr,"%pM" , buff); + +eth_setenv_enetaddr ("ethaddr" , enetaddr); + } +#endif return 0 ; }
include/configs/da850_l138evm.h +1 -0
@@ -172,6 +172,7 @@#define CONFIG_SYS_LONGHELP #define CONFIG_CRC32_VERIFY #define CONFIG_MX_CYCLIC +#define CONFIG_MAC_ADDR_IN_SPIFLASH /* * Linux Information
Signature · 1 line
1.6.2.4
Mike Frysinger
NAKPATCH 5/6 da850: add support to read mac address from spi flash
board/davinci/da8xxevm/da850evm.c static void dspwake(void) · line 277
Quoted 2 lines · On Friday, September 30, 2011 07:24:26 nagabhushana.netagunte at ti.com wrote:
board/davinci/da8xxevm/da850evm.c +2
-0+if (is_multicast_ether_addr (buff) || +is_zero_ether_addr (buff)) {
NAK: use is_valid_ether_addr()
board/davinci/da8xxevm/da850evm.c static void dspwake(void) · line 284
Quoted 3 lines
board/davinci/da8xxevm/da850evm.c +3
-0+sprintf ((char *)enetaddr,"%pM" , buff); + +eth_setenv_enetaddr ("ethaddr" , enetaddr);
NAK: eth_setenv_enetaddr() does the sprintf for you -mike
Hadli
PATCH 5/6 da850: add support to read mac address from spi flash
Mike,
Quoted 5 lines · Mike Frysinger
board/davinci/da8xxevm/da850evm.c static void dspwake(void) · line 277
Quoted 2 lines · On Friday, September 30, 2011 07:24:26 nagabhushana.netagunte at ti.com wrote:
board/davinci/da8xxevm/da850evm.c +2
-0+if (is_multicast_ether_addr (buff) || +is_zero_ether_addr (buff)) {NAK: use
is_valid_ether_addr()
Thanks. Changed this.
Quoted 6 lines
board/davinci/da8xxevm/da850evm.c static void dspwake(void) · line 284
Quoted 4 lines
board/davinci/da8xxevm/da850evm.c +3
-0+sprintf ((char *)enetaddr,"%pM" , buff); + +eth_setenv_enetaddr ("ethaddr" , enetaddr);NAK:
eth_setenv_enetaddr()does the sprintf for you -mike
Thanks Mike. I have removed the sprintf.
Quoted 1 line
Also,
I will be taking care of the patch set from now. I will resubmit the patches with the changes.
Thx,
-Manju
PATCH 6/6 da850: read MAC address from I2C EEPROM on AM18xx EVM
In reply to nagabhushana.netagunte at ti.comFrom: Nagabhushana Netagunte <[email protected]>
The AM18xx EVM contains MAC address in I2C EEPROM. Introduced a new macro CONFIG_MAC_ADDR_IN_EEPROM to where to look for mac address. This patch reads MAC address from I2C EEPROM and updates environment variable.
--- board/davinci/da8xxevm/da850evm.c | 9 ++++++++- include/configs/da850_am18xxevm.h | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletions(-)
board/davinci/da8xxevm/da850evm.c +8 -1
@@ -267,8 +267,9 @@ int misc_init_r(void)dspwake (); -#ifdef CONFIG_MAC_ADDR_IN_SPIFLASH +#if defined(CONFIG_MAC_ADDR_IN_SPIFLASH ) || defined(CONFIG_MAC_ADDR_IN_EEPROM )if (!eth_getenv_enetaddr ("ethaddr" , buff)) { +#ifdef CONFIG_MAC_ADDR_IN_SPIFLASH ret =get_mac_addr (buff);if (ret !=0 )return -EINVAL ;
@@ -282,6 +283,12 @@ int misc_init_r(void)sprintf ((char *)enetaddr,"%pM" , buff);eth_setenv_enetaddr ("ethaddr" , enetaddr); +#else +/* Read Ethernet MAC address from EEPROM */ +if (dvevm_read_mac_address (enetaddr)) +/* Set Ethernet MAC address from EEPROM */ +davinci_sync_env_enetaddr (enetaddr); +#endif }#endif return 0 ;
include/configs/da850_am18xxevm.h +7 -0
@@ -93,6 +93,12 @@#define CONFIG_SYS_I2C_EXPANDER_ADDR 0x20/* +* I2C EEPROM definitions EEPROM chip +*/ +#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 +#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 + +/* * Flash & Environment */ #ifdef CONFIG_USE_NAND
@@ -173,6 +179,7 @@#define CONFIG_SYS_LONGHELP #define CONFIG_CRC32_VERIFY #define CONFIG_MX_CYCLIC +#define CONFIG_MAC_ADDR_IN_EEPROM /* * Linux Information
Signature · 1 line
1.6.2.4