diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-08-09 15:49:51 +0800 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-09-25 08:18:58 +0200 |
commit | 2263e27814f1db83745a9e65c373c957307c36a0 (patch) | |
tree | e0ce1c1acaef410531018e0d390854194ef91478 /arch/arm/boards/freescale-mx6-arm2 | |
parent | 26eab97b41da45353300d447870fe1c7fbfe7542 (diff) | |
download | barebox-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-arm2')
-rw-r--r-- | arch/arm/boards/freescale-mx6-arm2/board.c | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/arch/arm/boards/freescale-mx6-arm2/board.c b/arch/arm/boards/freescale-mx6-arm2/board.c index e4a9a49b55..0e853a6926 100644 --- a/arch/arm/boards/freescale-mx6-arm2/board.c +++ b/arch/arm/boards/freescale-mx6-arm2/board.c @@ -26,7 +26,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> @@ -104,50 +104,39 @@ static int arm2_mem_init(void) } mem_initcall(arm2_mem_init); -static struct fec_platform_data fec_info = { - .xcv_type = RGMII, - .phy_addr = 0, -}; - -static int mx6_rgmii_rework(void) +static void mx6_rgmii_rework(struct phy_device *dev) { - struct mii_device *mdev; u16 val; - mdev = mii_open("phy0"); - if (!mdev) { - printf("unable to open phy0\n"); - return -ENODEV; - } - /* To enable AR8031 ouput a 125MHz clk from CLK_25M */ - mii_write(mdev, mdev->address, 0xd, 0x7); - mii_write(mdev, mdev->address, 0xe, 0x8016); - mii_write(mdev, mdev->address, 0xd, 0x4007); + phy_write(dev, 0xd, 0x7); + phy_write(dev, 0xe, 0x8016); + phy_write(dev, 0xd, 0x4007); - val = mii_read(mdev, mdev->address, 0xe); + val = phy_read(dev, 0xe); val &= 0xffe3; val |= 0x18; - mii_write(mdev, mdev->address, 0xe, val); + phy_write(dev, 0xe, val); /* introduce tx clock delay */ - mii_write(mdev, mdev->address, 0x1d, 0x5); + phy_write(dev, 0x1d, 0x5); - val = mii_read(mdev, mdev->address, 0x1e); + val = phy_read(dev, 0x1e); val |= 0x0100; - mii_write(mdev, mdev->address, 0x1e, val); - - mii_close(mdev); - - return 0; + phy_write(dev, 0x1e, val); } +static struct fec_platform_data fec_info = { + .xcv_type = RGMII, + .phy_init = mx6_rgmii_rework, + .phy_addr = 0, +}; + static int arm2_devices_init(void) { imx6_add_mmc3(NULL); imx6_add_fec(&fec_info); - mx6_rgmii_rework(); armlinux_set_bootparams((void *)0x10000100); armlinux_set_architecture(3837); |