summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/freescale-mx6-sabrelite
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-08-09 15:49:51 +0800
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-25 08:18:58 +0200
commit2263e27814f1db83745a9e65c373c957307c36a0 (patch)
treee0ce1c1acaef410531018e0d390854194ef91478 /arch/arm/boards/freescale-mx6-sabrelite
parent26eab97b41da45353300d447870fe1c7fbfe7542 (diff)
downloadbarebox-2263e27814f1db83745a9e65c373c957307c36a0.tar.gz
barebox-2263e27814f1db83745a9e65c373c957307c36a0.tar.xz
net: introduce phylib
Adapt phylib from linux switch all the driver to it reimplement mii bus This will allow to have - phy drivers - to only connect the phy at then opening of the device - if the phy is not ready or not up fail on open Same behaviour as in linux and will allow to share code and simplify porting. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'arch/arm/boards/freescale-mx6-sabrelite')
-rw-r--r--arch/arm/boards/freescale-mx6-sabrelite/board.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/arch/arm/boards/freescale-mx6-sabrelite/board.c b/arch/arm/boards/freescale-mx6-sabrelite/board.c
index c5bcf8bee4..6070e2e167 100644
--- a/arch/arm/boards/freescale-mx6-sabrelite/board.c
+++ b/arch/arm/boards/freescale-mx6-sabrelite/board.c
@@ -28,7 +28,7 @@
#include <asm/armlinux.h>
#include <generated/mach-types.h>
#include <partition.h>
-#include <miidev.h>
+#include <linux/phy.h>
#include <asm/io.h>
#include <asm/mmu.h>
#include <mach/generic.h>
@@ -136,38 +136,27 @@ static int sabrelite_mem_init(void)
}
mem_initcall(sabrelite_mem_init);
-static struct fec_platform_data fec_info = {
- .xcv_type = RGMII,
- .phy_addr = 6,
-};
-
-int mx6_rgmii_rework(void)
+static void mx6_rgmii_rework(struct phy_device *dev)
{
- struct mii_device *mdev;
-
- mdev = mii_open("phy0");
- if (!mdev) {
- printf("unable to open phy0\n");
- return -ENODEV;
- }
-
- mii_write(mdev, mdev->address, 0x09, 0x0f00);
+ phy_write(dev, 0x09, 0x0f00);
/* do same as linux kernel */
/* min rx data delay */
- mii_write(mdev, mdev->address, 0x0b, 0x8105);
- mii_write(mdev, mdev->address, 0x0c, 0x0000);
+ phy_write(dev, 0x0b, 0x8105);
+ phy_write(dev, 0x0c, 0x0000);
/* max rx/tx clock delay, min rx/tx control delay */
- mii_write(mdev, mdev->address, 0x0b, 0x8104);
- mii_write(mdev, mdev->address, 0x0c, 0xf0f0);
- mii_write(mdev, mdev->address, 0x0b, 0x104);
-
- mii_close(mdev);
-
- return 0;
+ phy_write(dev, 0x0b, 0x8104);
+ phy_write(dev, 0x0c, 0xf0f0);
+ phy_write(dev, 0x0b, 0x104);
}
+static struct fec_platform_data fec_info = {
+ .xcv_type = RGMII,
+ .phy_init = mx6_rgmii_rework,
+ .phy_addr = 6,
+};
+
static int sabrelite_ksz9021rn_setup(void)
{
mxc_iomux_v3_setup_multiple_pads(sabrelite_enet_pads, ARRAY_SIZE(sabrelite_enet_pads));
@@ -266,7 +255,6 @@ static int sabrelite_devices_init(void)
sabrelite_ksz9021rn_setup();
imx6_iim_register_fec_ethaddr();
imx6_add_fec(&fec_info);
- mx6_rgmii_rework();
sabrelite_ehci_init();