net: fec: use standard phy type defines
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
31865e8a7f
commit
e9e5919dd3
|
@ -81,7 +81,7 @@ struct imx_nand_platform_data nand_info = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
.phy_addr = 7,
|
.phy_addr = 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include <asm/barebox-arm-head.h>
|
#include <asm/barebox-arm-head.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RMII,
|
.xcv_type = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include <mach/devices-imx27.h>
|
#include <mach/devices-imx27.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
.phy_addr = 1,
|
.phy_addr = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#include <mach/devices-imx35.h>
|
#include <mach/devices-imx35.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include <mach/devices-imx51.h>
|
#include <mach/devices-imx51.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct imx_nand_platform_data nand_info = {
|
struct imx_nand_platform_data nand_info = {
|
||||||
|
|
|
@ -104,7 +104,7 @@ struct imx_flash_header __flash_header_section flash_header = {
|
||||||
unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
|
unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE;
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RMII,
|
.xcv_type = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 1,
|
.phy_addr = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ static void __init mx28_evk_fec_reset(void)
|
||||||
|
|
||||||
/* PhyAD[0..2]=0, RMIISEL=1 */
|
/* PhyAD[0..2]=0, RMIISEL=1 */
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RMII,
|
.xcv_type = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
#define MX35PDK_BOARD_REV_2 1
|
#define MX35PDK_BOARD_REV_2 1
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
.phy_addr = 0x1F,
|
.phy_addr = 0x1F,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#include <mach/imx-flash-header.h>
|
#include <mach/imx-flash-header.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
};
|
};
|
||||||
|
|
||||||
static iomux_v3_cfg_t f3s_pads[] = {
|
static iomux_v3_cfg_t f3s_pads[] = {
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include <asm/mmu.h>
|
#include <asm/mmu.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RMII,
|
.xcv_type = PHY_INTERFACE_MODE_RMII,
|
||||||
};
|
};
|
||||||
|
|
||||||
static iomux_v3_cfg_t loco_pads[] = {
|
static iomux_v3_cfg_t loco_pads[] = {
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <asm/mmu.h>
|
#include <asm/mmu.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RMII,
|
.xcv_type = PHY_INTERFACE_MODE_RMII,
|
||||||
};
|
};
|
||||||
|
|
||||||
static iomux_v3_cfg_t smd_pads[] = {
|
static iomux_v3_cfg_t smd_pads[] = {
|
||||||
|
|
|
@ -122,7 +122,7 @@ static void mx6_rgmii_rework(struct phy_device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RGMII,
|
.xcv_type = PHY_INTERFACE_MODE_RGMII,
|
||||||
.phy_init = mx6_rgmii_rework,
|
.phy_init = mx6_rgmii_rework,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
|
@ -147,7 +147,7 @@ static void mx6_rgmii_rework(struct phy_device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RGMII,
|
.xcv_type = PHY_INTERFACE_MODE_RGMII,
|
||||||
.phy_init = mx6_rgmii_rework,
|
.phy_init = mx6_rgmii_rework,
|
||||||
.phy_addr = 6,
|
.phy_addr = 6,
|
||||||
};
|
};
|
||||||
|
|
|
@ -159,7 +159,7 @@ static int ar8031_phy_fixup(struct phy_device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RGMII,
|
.xcv_type = PHY_INTERFACE_MODE_RGMII,
|
||||||
.phy_addr = 1,
|
.phy_addr = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#include <mach/devices-imx35.h>
|
#include <mach/devices-imx35.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct imx_nand_platform_data nand_info = {
|
struct imx_nand_platform_data nand_info = {
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
#define BACKLIGHT_POWER_GPIO (GPIO_PORTE + 5)
|
#define BACKLIGHT_POWER_GPIO (GPIO_PORTE + 5)
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
.phy_addr = 31,
|
.phy_addr = 31,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include <asm/mmu.h>
|
#include <asm/mmu.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RMII,
|
.xcv_type = PHY_INTERFACE_MODE_RMII,
|
||||||
};
|
};
|
||||||
|
|
||||||
static iomux_v3_cfg_t vincell_pads[] = {
|
static iomux_v3_cfg_t vincell_pads[] = {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <mach/devices-imx27.h>
|
#include <mach/devices-imx27.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
.phy_addr = 1,
|
.phy_addr = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <asm/mmu.h>
|
#include <asm/mmu.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RMII,
|
.xcv_type = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0x1f,
|
.phy_addr = 0x1f,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ static struct mxs_mci_platform_data mci_pdata = {
|
||||||
|
|
||||||
/* PhyAD[0..2]=0, RMIISEL=1 */
|
/* PhyAD[0..2]=0, RMIISEL=1 */
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RMII,
|
.xcv_type = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
IOMUX_PAD(0x6c0, 0x2c0, 4, 0x098c, 1, 0)
|
IOMUX_PAD(0x6c0, 0x2c0, 4, 0x098c, 1, 0)
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct imx_nand_platform_data nand_info = {
|
struct imx_nand_platform_data nand_info = {
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <asm/mmu.h>
|
#include <asm/mmu.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RMII,
|
.xcv_type = PHY_INTERFACE_MODE_RMII,
|
||||||
};
|
};
|
||||||
|
|
||||||
static iomux_v3_cfg_t tx53_pads[] = {
|
static iomux_v3_cfg_t tx53_pads[] = {
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#include "pll.h"
|
#include "pll.h"
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
.phy_addr = 1,
|
.phy_addr = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#include <mach/generic.h>
|
#include <mach/generic.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct imx_nand_platform_data nand_info = {
|
struct imx_nand_platform_data nand_info = {
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include <mach/devices-imx27.h>
|
#include <mach/devices-imx27.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
.phy_addr = 1,
|
.phy_addr = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include <mach/imx5.h>
|
#include <mach/imx5.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = RMII,
|
.xcv_type = PHY_INTERFACE_MODE_RMII,
|
||||||
};
|
};
|
||||||
|
|
||||||
static iomux_v3_cfg_t tqma53_pads[] = {
|
static iomux_v3_cfg_t tqma53_pads[] = {
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
|
|
||||||
static struct fec_platform_data fec_info = {
|
static struct fec_platform_data fec_info = {
|
||||||
.xcv_type = MII100,
|
.xcv_type = PHY_INTERFACE_MODE_MII,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int devices_init (void)
|
static int devices_init (void)
|
||||||
|
|
|
@ -307,7 +307,7 @@ static int fec_init(struct eth_device *dev)
|
||||||
writel(((fec_clk_get_rate(fec) >> 20) / 5) << 1,
|
writel(((fec_clk_get_rate(fec) >> 20) / 5) << 1,
|
||||||
fec->regs + FEC_MII_SPEED);
|
fec->regs + FEC_MII_SPEED);
|
||||||
|
|
||||||
if (fec->xcv_type == RMII) {
|
if (fec->interface == PHY_INTERFACE_MODE_RMII) {
|
||||||
if (fec_is_imx28(fec) || fec_is_imx6(fec)) {
|
if (fec_is_imx28(fec) || fec_is_imx6(fec)) {
|
||||||
rcntl |= FEC_R_CNTRL_RMII_MODE | FEC_R_CNTRL_FCE |
|
rcntl |= FEC_R_CNTRL_RMII_MODE | FEC_R_CNTRL_FCE |
|
||||||
FEC_R_CNTRL_NO_LGTH_CHECK;
|
FEC_R_CNTRL_NO_LGTH_CHECK;
|
||||||
|
@ -325,7 +325,7 @@ static int fec_init(struct eth_device *dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fec->xcv_type == RGMII)
|
if (fec->interface == PHY_INTERFACE_MODE_RGMII)
|
||||||
rcntl |= 1 << 6;
|
rcntl |= 1 << 6;
|
||||||
|
|
||||||
writel(rcntl, fec->regs + FEC_R_CNTRL);
|
writel(rcntl, fec->regs + FEC_R_CNTRL);
|
||||||
|
@ -686,11 +686,11 @@ static int fec_probe(struct device_d *dev)
|
||||||
fec_alloc_receive_packets(fec, FEC_RBD_NUM, FEC_MAX_PKT_SIZE);
|
fec_alloc_receive_packets(fec, FEC_RBD_NUM, FEC_MAX_PKT_SIZE);
|
||||||
|
|
||||||
if (pdata) {
|
if (pdata) {
|
||||||
fec->xcv_type = pdata->xcv_type;
|
fec->interface = pdata->xcv_type;
|
||||||
fec->phy_init = pdata->phy_init;
|
fec->phy_init = pdata->phy_init;
|
||||||
fec->phy_addr = pdata->phy_addr;
|
fec->phy_addr = pdata->phy_addr;
|
||||||
} else {
|
} else {
|
||||||
fec->xcv_type = MII100;
|
fec->interface = PHY_INTERFACE_MODE_MII;
|
||||||
fec->phy_addr = -1;
|
fec->phy_addr = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,19 +698,6 @@ static int fec_probe(struct device_d *dev)
|
||||||
|
|
||||||
fec->miibus.read = fec_miibus_read;
|
fec->miibus.read = fec_miibus_read;
|
||||||
fec->miibus.write = fec_miibus_write;
|
fec->miibus.write = fec_miibus_write;
|
||||||
switch (fec->xcv_type) {
|
|
||||||
case RMII:
|
|
||||||
fec->interface = PHY_INTERFACE_MODE_RMII;
|
|
||||||
break;
|
|
||||||
case RGMII:
|
|
||||||
fec->interface = PHY_INTERFACE_MODE_RGMII;
|
|
||||||
break;
|
|
||||||
case MII10:
|
|
||||||
fec->phy_flags = PHYLIB_FORCE_10;
|
|
||||||
case MII100:
|
|
||||||
fec->interface = PHY_INTERFACE_MODE_MII;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
fec->miibus.priv = fec;
|
fec->miibus.priv = fec;
|
||||||
fec->miibus.parent = dev;
|
fec->miibus.parent = dev;
|
||||||
|
|
|
@ -135,7 +135,6 @@ enum fec_type {
|
||||||
struct fec_priv {
|
struct fec_priv {
|
||||||
struct eth_device edev;
|
struct eth_device edev;
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
xceiver_type xcv_type; /* transceiver type */
|
|
||||||
struct buffer_descriptor __iomem *rbd_base; /* RBD ring */
|
struct buffer_descriptor __iomem *rbd_base; /* RBD ring */
|
||||||
int rbd_index; /* next receive BD to read */
|
int rbd_index; /* next receive BD to read */
|
||||||
struct buffer_descriptor __iomem *tbd_base; /* TBD ring */
|
struct buffer_descriptor __iomem *tbd_base; /* TBD ring */
|
||||||
|
|
|
@ -658,25 +658,12 @@ int mpc5xxx_fec_probe(struct device_d *dev)
|
||||||
fec->tbdBase = (FEC_TBD *)FEC_BD_BASE;
|
fec->tbdBase = (FEC_TBD *)FEC_BD_BASE;
|
||||||
fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD));
|
fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD));
|
||||||
|
|
||||||
fec->xcv_type = pdata->xcv_type;
|
fec->interface = pdata->xcv_type;
|
||||||
|
|
||||||
loadtask(0, 2);
|
loadtask(0, 2);
|
||||||
|
|
||||||
fec->miibus.read = fec5xxx_miibus_read;
|
fec->miibus.read = fec5xxx_miibus_read;
|
||||||
fec->miibus.write = fec5xxx_miibus_write;
|
fec->miibus.write = fec5xxx_miibus_write;
|
||||||
switch (pdata->xcv_type) {
|
|
||||||
case RMII:
|
|
||||||
fec->interface = PHY_INTERFACE_MODE_RMII;
|
|
||||||
break;
|
|
||||||
case RGMII:
|
|
||||||
fec->interface = PHY_INTERFACE_MODE_RGMII;
|
|
||||||
break;
|
|
||||||
case MII10:
|
|
||||||
fec->phy_flags = PHYLIB_FORCE_10;
|
|
||||||
case MII100:
|
|
||||||
fec->interface = PHY_INTERFACE_MODE_MII;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
fec->miibus.priv = fec;
|
fec->miibus.priv = fec;
|
||||||
fec->miibus.parent = dev;
|
fec->miibus.parent = dev;
|
||||||
|
|
|
@ -252,7 +252,6 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ethernet_regs *eth;
|
ethernet_regs *eth;
|
||||||
xceiver_type xcv_type; /* transceiver type */
|
|
||||||
FEC_RBD *rbdBase; /* RBD ring */
|
FEC_RBD *rbdBase; /* RBD ring */
|
||||||
FEC_TBD *tbdBase; /* TBD ring */
|
FEC_TBD *tbdBase; /* TBD ring */
|
||||||
uint16_t rbdIndex; /* next receive BD to read */
|
uint16_t rbdIndex; /* next receive BD to read */
|
||||||
|
|
|
@ -23,22 +23,12 @@
|
||||||
|
|
||||||
#include <linux/phy.h>
|
#include <linux/phy.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* Supported phy types on this platform
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
MII10,
|
|
||||||
MII100,
|
|
||||||
RMII,
|
|
||||||
RGMII,
|
|
||||||
} xceiver_type;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define the phy connected externally for FEC drivers
|
* Define the phy connected externally for FEC drivers
|
||||||
* (like MPC52xx and i.MX27)
|
* (like MPC52xx and i.MX27)
|
||||||
*/
|
*/
|
||||||
struct fec_platform_data {
|
struct fec_platform_data {
|
||||||
xceiver_type xcv_type;
|
phy_interface_t xcv_type;
|
||||||
int phy_addr;
|
int phy_addr;
|
||||||
void (*phy_init)(struct phy_device *dev);
|
void (*phy_init)(struct phy_device *dev);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue