diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c index 337039ee51e623acf3c8c940639886757e76ca12..7d3b09b7d5449244683e97ab0b6539b9072a345c 100644 --- a/arch/powerpc/sysdev/tsi108_dev.c +++ b/arch/powerpc/sysdev/tsi108_dev.c @@ -107,8 +107,9 @@ static int __init tsi108_eth_of_init(void) goto err; } - mac_addr = of_get_property(np, "address", NULL); - memcpy(tsi_eth_data.mac_addr, mac_addr, 6); + mac_addr = of_get_mac_address(np); + if (mac_addr) + memcpy(tsi_eth_data.mac_addr, mac_addr, 6); ph = of_get_property(np, "phy-handle", NULL); phy = of_find_node_by_phandle(*ph); @@ -129,6 +130,8 @@ static int __init tsi108_eth_of_init(void) tsi_eth_data.phyregs = res.start; tsi_eth_data.phy = *phy_id; tsi_eth_data.irq_num = irq_of_parse_and_map(np, 0); + if (of_device_is_compatible(phy, "bcm54xx")) + tsi_eth_data.phy_type = TSI108_PHY_BCM54XX; of_node_put(phy); ret = platform_device_add_data(tsi_eth_dev, &tsi_eth_data, diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index 0bfc2c9c1c083223820102cad66f1e747c3b3e05..1aabc91f6458e3d5c3a2b880127002a05d45ee01 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c @@ -82,6 +82,7 @@ struct tsi108_prv_data { unsigned int phy; /* Index of PHY for this interface */ unsigned int irq_num; unsigned int id; + unsigned int phy_type; struct timer_list timer;/* Timer that triggers the check phy function */ unsigned int rxtail; /* Next entry in rxring to read */ @@ -1256,11 +1257,11 @@ static void tsi108_init_phy(struct net_device *dev) if (i == 0) printk(KERN_ERR "%s function time out \n", __FUNCTION__); -#if (TSI108_PHY_TYPE == PHY_BCM54XX) /* Broadcom BCM54xx PHY */ - tsi108_write_mii(data, 0x09, 0x0300); - tsi108_write_mii(data, 0x10, 0x1020); - tsi108_write_mii(data, 0x1c, 0x8c00); -#endif + if (data->phy_type == TSI108_PHY_BCM54XX) { + tsi108_write_mii(data, 0x09, 0x0300); + tsi108_write_mii(data, 0x10, 0x1020); + tsi108_write_mii(data, 0x1c, 0x8c00); + } tsi108_write_mii(data, MII_BMCR, @@ -1587,6 +1588,7 @@ tsi108_init_one(struct platform_device *pdev) data->mii_if.supports_gmii = mii_check_gmii_support(&data->mii_if); data->phy = einfo->phy; + data->phy_type = einfo->phy_type; data->irq_num = einfo->irq_num; data->id = pdev->id; dev->open = tsi108_open; diff --git a/drivers/net/tsi108_eth.h b/drivers/net/tsi108_eth.h index 77a769df228ab9c40388b6071ee3a77fe0a533b1..5a77ae6c5f36d07200c7527b61a62ba51b7daff3 100644 --- a/drivers/net/tsi108_eth.h +++ b/drivers/net/tsi108_eth.h @@ -42,15 +42,6 @@ #define TSI_READ_PHY(offset) \ in_be32((data->phyregs + (offset))) -/* - * PHY Configuration Options - * - * NOTE: Enable set of definitions corresponding to your board type - */ -#define PHY_MV88E 1 /* Marvel 88Exxxx PHY */ -#define PHY_BCM54XX 2 /* Broardcom BCM54xx PHY */ -#define TSI108_PHY_TYPE PHY_MV88E - /* * TSI108 GIGE port registers */ diff --git a/include/asm-powerpc/tsi108.h b/include/asm-powerpc/tsi108.h index 4e95d153be8445b4ec1f379d712a402422add1ff..20cb072d45aea548cc7721d3ceacb4fedf691544 100644 --- a/include/asm-powerpc/tsi108.h +++ b/include/asm-powerpc/tsi108.h @@ -70,6 +70,16 @@ #define TSI108_PCI_CFG_BASE_PHYS (0xfb000000) #define TSI108_PCI_CFG_SIZE (0x01000000) + +/* + * PHY Configuration Options + * + * Specify "bcm54xx" in the compatible property of your device tree phy + * nodes if your board uses the Broadcom PHYs + */ +#define TSI108_PHY_MV88E 0 /* Marvel 88Exxxx PHY */ +#define TSI108_PHY_BCM54XX 1 /* Broardcom BCM54xx PHY */ + /* Global variables */ extern u32 tsi108_pci_cfg_base; @@ -93,6 +103,7 @@ typedef struct { u16 phy; /* phy address */ u16 irq_num; /* irq number */ u8 mac_addr[6]; /* phy mac address */ + u16 phy_type; /* type of phy on board */ } hw_info; extern u32 get_vir_csrbase(void);