*/
#include <common.h>
+#include <miiphy.h>
#include <netdev.h>
#include <nand.h>
#include <asm/io.h>
int board_eth_init(bd_t *bis)
{
+ int ret = 0;
+
#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
-#else
- return -1;
+ u32 interface = PHY_INTERFACE_MODE_MII;
+ if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY,
+ interface) >= 0)
+ ret++;
#endif
+ return ret;
}
*/
#include <common.h>
+#include <miiphy.h>
#include <netdev.h>
#include <nand.h>
#include <asm/io.h>
int ret = 0;
#if defined(CONFIG_DESIGNWARE_ETH)
- if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) < 0)
- ret += -1;
+ u32 interface = PHY_INTERFACE_MODE_MII;
+ if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY,
+ interface) >= 0)
+ ret++;
#endif
#if defined(CONFIG_MACB)
if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE,
- CONFIG_MACB0_PHY) < 0)
- ret += -1;
+ CONFIG_MACB0_PHY) >= 0)
+ ret++;
if (macb_eth_initialize(1, (void *)CONFIG_SYS_MACB1_BASE,
- CONFIG_MACB1_PHY) < 0)
- ret += -1;
+ CONFIG_MACB1_PHY) >= 0)
+ ret++;
if (macb_eth_initialize(2, (void *)CONFIG_SYS_MACB2_BASE,
- CONFIG_MACB2_PHY) < 0)
- ret += -1;
+ CONFIG_MACB2_PHY) >= 0)
+ ret++;
if (macb_eth_initialize(3, (void *)CONFIG_SYS_MACB3_BASE,
- CONFIG_MACB3_PHY) < 0)
- ret += -1;
+ CONFIG_MACB3_PHY) >= 0)
+ ret++;
#endif
return ret;
}
*/
#include <common.h>
+#include <miiphy.h>
#include <netdev.h>
#include <nand.h>
#include <asm/io.h>
#include <asm/arch/spr_defs.h>
#include <asm/arch/spr_misc.h>
+#define PLGPIO_SEL_36 0xb3000028
+#define PLGPIO_IO_36 0xb3000038
+
static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE];
+static void spear_phy_reset(void)
+{
+ writel(0x10, PLGPIO_IO_36);
+ writel(0x10, PLGPIO_SEL_36);
+}
+
int board_init(void)
{
+ spear_phy_reset();
return spear_board_init(MACH_TYPE_SPEAR320);
}
int board_eth_init(bd_t *bis)
{
int ret = 0;
+
#if defined(CONFIG_DESIGNWARE_ETH)
- if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) < 0)
- ret += -1;
+ u32 interface = PHY_INTERFACE_MODE_MII;
+ if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY,
+ interface) >= 0)
+ ret++;
#endif
#if defined(CONFIG_MACB)
if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE,
- CONFIG_MACB0_PHY) < 0)
- ret += -1;
+ CONFIG_MACB0_PHY) >= 0)
+ ret++;
#endif
return ret;
}
*/
#include <common.h>
+#include <miiphy.h>
#include <netdev.h>
#include <nand.h>
#include <asm/io.h>
int board_eth_init(bd_t *bis)
{
+ int ret = 0;
+
#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
-#else
- return -1;
+ u32 interface = PHY_INTERFACE_MODE_MII;
+#if defined(CONFIG_DW_AUTONEG)
+ interface = PHY_INTERFACE_MODE_GMII;
+#endif
+ if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY,
+ interface) >= 0)
+ ret++;
#endif
+ return ret;
}
if (priv->speed != SPEED_1000M)
conf |= MII_PORTSELECT;
+ if ((priv->interface != PHY_INTERFACE_MODE_MII) &&
+ (priv->interface != PHY_INTERFACE_MODE_GMII)) {
+
+ if (priv->speed == SPEED_100M)
+ conf |= FES_100;
+ }
+
if (priv->duplex == FULL_DUPLEX)
conf |= FULLDPLXMODE;
}
#endif
-int designware_initialize(u32 id, ulong base_addr, u32 phy_addr)
+int designware_initialize(u32 id, ulong base_addr, u32 phy_addr, u32 interface)
{
struct eth_device *dev;
struct dw_eth_dev *priv;
DW_DMA_BASE_OFFSET);
priv->address = phy_addr;
priv->phy_configured = 0;
+ priv->interface = interface;
if (mac_reset(dev) < 0)
return -1;
struct dw_eth_dev {
u32 address;
+ u32 interface;
u32 speed;
u32 duplex;
u32 tx_currdescnum;
int cs8900_initialize(u8 dev_num, int base_addr);
int davinci_emac_initialize(void);
int dc21x4x_initialize(bd_t *bis);
-int designware_initialize(u32 id, ulong base_addr, u32 phy_addr);
+int designware_initialize(u32 id, ulong base_addr, u32 phy_addr, u32 interface);
int dm9000_initialize(bd_t *bis);
int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr);
int e1000_initialize(bd_t *bis);