Message ID | 1320928830-16221-4-git-send-email-chandan.nath@ti.com |
---|---|
State | Rejected |
Headers | show |
Please ignore this patch which went by mistake. > -----Original Message----- > From: Kumar Nath, Chandan > Sent: Thursday, November 10, 2011 6:11 PM > To: u-boot@lists.denx.de > Cc: Kumar Nath, Chandan > Subject: [PATCH v2 2/2] ARM:AM33XX:Added cpsw support for AM335x EVM > > #ifdef CONFIG_ARCH_EBSA110 > # ifdef machine_arch_type > @@ -42913,6 +42915,19 @@ extern unsigned int __machine_arch_type; > # define machine_is_goflexhome() (0) > #endif > > +#ifdef CONFIG_MACH_TIAM335EVM > +# ifdef machine_arch_type > +# undef machine_arch_type > +# define machine_arch_type __machine_arch_type > +# else > +# define machine_arch_type MACH_TYPE_TIAM335EVM > +# endif > +# define machine_is_tiam335evm() (machine_arch_type == > MACH_TYPE_TIAM335EVM) > +#else > +# define machine_is_tiam335evm() (0) > +#endif > + > + > /* > * These have not yet been registered > */ > diff --git a/board/ti/am335x/evm.c b/board/ti/am335x/evm.c > index 4530a76..993d2a1 100644 > --- a/board/ti/am335x/evm.c > +++ b/board/ti/am335x/evm.c > @@ -57,6 +57,15 @@ int board_init(void) > } > > #ifdef CONFIG_DRIVER_TI_CPSW > +/* Atheros PHY report 1000baseX speed incorrectly and so this function > + * is define to overcome this issue. The original code is kept as > + * _miiphy_is_1000base_x as an weak alias to this function. > + */ > +int miiphy_is_1000base_x(const char *devname, unsigned char addr) > +{ > + return 0; > +} > + > /* TODO : Check for the board specific PHY */ > static void evm_phy_init(char *name, int addr) > { > @@ -159,7 +168,6 @@ int board_eth_init(bd_t *bis) > { > uint8_t mac_addr[6]; > uint32_t mac_hi, mac_lo; > - char mac_buf[32]; > > if (!eth_getenv_enetaddr("ethaddr", mac_addr)) { > debug("<ethaddr> not set. Reading from E-fuse\n"); > @@ -174,18 +182,11 @@ int board_eth_init(bd_t *bis) > mac_addr[5] = (mac_lo & 0xFF00) >> 8; > > if (is_valid_ether_addr(mac_addr)) { > - sprintf(mac_buf, "%02x:%02x:%02x:%02x:%02x:%02x", > - mac_addr[0], mac_addr[1], mac_addr[2], > - mac_addr[3], mac_addr[4], mac_addr[5]); > - > - printf("ENET MAC address: %s\n", mac_buf); > - setenv("ethaddr", (char *)mac_buf); > + eth_setenv_enetaddr("ethaddr", mac_addr); > } else { > printf("Caution: Using hardcoded mac address. " > "Set <ethaddr> variable to overcome this.\n"); > } > - > - cpsw_eth_set_mac_addr(mac_addr); > } > > /* set mii mode to rgmii in in device configure register */ > diff --git a/common/miiphyutil.c b/common/miiphyutil.c > index 4551240..dd56fda 100644 > --- a/common/miiphyutil.c > +++ b/common/miiphyutil.c > @@ -548,7 +548,7 @@ miiphy_read_failed: > * Return 1 if PHY supports 1000BASE-X, 0 if PHY supports 10BASE- > T/100BASE-TX/ > * 1000BASE-T, or on error. > */ > -int miiphy_is_1000base_x(const char *devname, unsigned char addr) > +static int __miiphy_is_1000base_x(const char *devname, unsigned char > addr) > { > #if defined(CONFIG_PHY_GIGE) > u16 exsr; > @@ -558,12 +558,15 @@ int miiphy_is_1000base_x(const char *devname, > unsigned char addr) > "1000BASE-X\n"); > return 0; > } > - return 0; > + return 0 != (exsr & (ESTATUS_1000XF | ESTATUS_1000XH)); > #else > return 0; > #endif > } > > +int miiphy_is_1000base_x(const char *devname, unsigned char addr) > + __attribute__((weak, alias("__miiphy_is_1000base_x"))); > + > #ifdef CONFIG_SYS_FAULT_ECHO_LINK_DOWN > > /********************************************************************** > ******* > * > diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c > index c41eeaf..3167509 100644 > --- a/drivers/net/cpsw.c > +++ b/drivers/net/cpsw.c > @@ -512,20 +512,6 @@ static inline void soft_reset(void *reg) > ; > } > > -static u_int8_t cpsw_eth_mac_addr[] = { 0x00, 0x11, 0x22, 0x33, 0x44, > 0x66 }; > - > -/* > - * This function must be called before cpsw_init() if you want to > override > - * the default mac address. > - */ > -void cpsw_eth_set_mac_addr(const u_int8_t *addr) > -{ > - int i; > - > - for (i = 0; i < sizeof(cpsw_eth_mac_addr); i++) > - cpsw_eth_mac_addr[i] = addr[i]; > -} > - > #define mac_hi(mac) (((mac)[0] << 0) | ((mac)[1] << 8) | \ > ((mac)[2] << 16) | ((mac)[3] << 24)) > #define mac_lo(mac) (((mac)[4] << 0) | ((mac)[5] << 8)) > @@ -732,7 +718,7 @@ static int cpsw_init(struct eth_device *dev, bd_t > *bis) > __raw_writel(BIT(priv->host_port), &priv->regs->stat_port_en); > > cpsw_ale_port_state(priv, priv->host_port, > ALE_PORT_STATE_FORWARD); > - memcpy(priv->dev->enetaddr, cpsw_eth_mac_addr, 6); > + > cpsw_ale_add_ucast(priv, priv->dev->enetaddr, priv->host_port, > ALE_SECURE); > cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << priv->host_port);
diff --git a/board/ti/am335x/evm.c b/board/ti/am335x/evm.c index 4530a76..993d2a1 100644 --- a/board/ti/am335x/evm.c +++ b/board/ti/am335x/evm.c @@ -57,6 +57,15 @@ int board_init(void) } #ifdef CONFIG_DRIVER_TI_CPSW +/* Atheros PHY report 1000baseX speed incorrectly and so this function + * is define to overcome this issue. The original code is kept as + * _miiphy_is_1000base_x as an weak alias to this function. + */ +int miiphy_is_1000base_x(const char *devname, unsigned char addr) +{ + return 0; +} + /* TODO : Check for the board specific PHY */ static void evm_phy_init(char *name, int addr) { @@ -159,7 +168,6 @@ int board_eth_init(bd_t *bis) { uint8_t mac_addr[6]; uint32_t mac_hi, mac_lo; - char mac_buf[32]; if (!eth_getenv_enetaddr("ethaddr", mac_addr)) { debug("<ethaddr> not set. Reading from E-fuse\n"); @@ -174,18 +182,11 @@ int board_eth_init(bd_t *bis) mac_addr[5] = (mac_lo & 0xFF00) >> 8; if (is_valid_ether_addr(mac_addr)) { - sprintf(mac_buf, "%02x:%02x:%02x:%02x:%02x:%02x", - mac_addr[0], mac_addr[1], mac_addr[2], - mac_addr[3], mac_addr[4], mac_addr[5]); - - printf("ENET MAC address: %s\n", mac_buf); - setenv("ethaddr", (char *)mac_buf); + eth_setenv_enetaddr("ethaddr", mac_addr); } else { printf("Caution: Using hardcoded mac address. " "Set <ethaddr> variable to overcome this.\n"); } - - cpsw_eth_set_mac_addr(mac_addr); } /* set mii mode to rgmii in in device configure register */ diff --git a/common/miiphyutil.c b/common/miiphyutil.c index 4551240..dd56fda 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -548,7 +548,7 @@ miiphy_read_failed: * Return 1 if PHY supports 1000BASE-X, 0 if PHY supports 10BASE-T/100BASE-TX/ * 1000BASE-T, or on error. */ -int miiphy_is_1000base_x(const char *devname, unsigned char addr) +static int __miiphy_is_1000base_x(const char *devname, unsigned char addr) { #if defined(CONFIG_PHY_GIGE) u16 exsr; @@ -558,12 +558,15 @@ int miiphy_is_1000base_x(const char *devname, unsigned char addr) "1000BASE-X\n"); return 0; } - return 0; + return 0 != (exsr & (ESTATUS_1000XF | ESTATUS_1000XH)); #else return 0; #endif } +int miiphy_is_1000base_x(const char *devname, unsigned char addr) + __attribute__((weak, alias("__miiphy_is_1000base_x"))); + #ifdef CONFIG_SYS_FAULT_ECHO_LINK_DOWN /***************************************************************************** * diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index c41eeaf..3167509 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -512,20 +512,6 @@ static inline void soft_reset(void *reg) ; } -static u_int8_t cpsw_eth_mac_addr[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x66 }; - -/* - * This function must be called before cpsw_init() if you want to override - * the default mac address. - */ -void cpsw_eth_set_mac_addr(const u_int8_t *addr) -{ - int i; - - for (i = 0; i < sizeof(cpsw_eth_mac_addr); i++) - cpsw_eth_mac_addr[i] = addr[i]; -} - #define mac_hi(mac) (((mac)[0] << 0) | ((mac)[1] << 8) | \ ((mac)[2] << 16) | ((mac)[3] << 24)) #define mac_lo(mac) (((mac)[4] << 0) | ((mac)[5] << 8)) @@ -732,7 +718,7 @@ static int cpsw_init(struct eth_device *dev, bd_t *bis) __raw_writel(BIT(priv->host_port), &priv->regs->stat_port_en); cpsw_ale_port_state(priv, priv->host_port, ALE_PORT_STATE_FORWARD); - memcpy(priv->dev->enetaddr, cpsw_eth_mac_addr, 6); + cpsw_ale_add_ucast(priv, priv->dev->enetaddr, priv->host_port, ALE_SECURE); cpsw_ale_add_mcast(priv, NetBcastAddr, 1 << priv->host_port);