macb: allow to pass the phy interface
as we will add later the GMAC IP verion support (GEM) Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
f0aa3cdf8d
commit
f7e3126619
|
@ -33,7 +33,7 @@
|
||||||
#include <spi/spi.h>
|
#include <spi/spi.h>
|
||||||
|
|
||||||
static struct at91_ether_platform_data ether_pdata = {
|
static struct at91_ether_platform_data ether_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ static void ek_add_device_nand(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct at91_ether_platform_data macb_pdata = {
|
static struct at91_ether_platform_data macb_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ static void ek_add_device_nand(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct at91_ether_platform_data macb_pdata = {
|
static struct at91_ether_platform_data macb_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ static void ek_add_device_nand(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct at91_ether_platform_data macb_pdata = {
|
static struct at91_ether_platform_data macb_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ static void ek_add_device_nand(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct at91_ether_platform_data macb_pdata = {
|
static struct at91_ether_platform_data macb_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ static void ek_add_device_nand(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct at91_ether_platform_data macb_pdata = {
|
static struct at91_ether_platform_data macb_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ static void pm_add_device_nand(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct at91_ether_platform_data macb_pdata = {
|
static struct at91_ether_platform_data macb_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ static void __init pm9g45_add_device_usbh(void) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct at91_ether_platform_data macb_pdata = {
|
static struct at91_ether_platform_data macb_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = 0,
|
.phy_addr = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ static void qil_a9260_add_device_mci(void) {}
|
||||||
|
|
||||||
#ifdef CONFIG_CALAO_MB_QIL_A9260
|
#ifdef CONFIG_CALAO_MB_QIL_A9260
|
||||||
static struct at91_ether_platform_data macb_pdata = {
|
static struct at91_ether_platform_data macb_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = -1,
|
.phy_addr = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ static void tny_a9260_add_device_nand(void)
|
||||||
|
|
||||||
#ifdef CONFIG_DRIVER_NET_MACB
|
#ifdef CONFIG_DRIVER_NET_MACB
|
||||||
static struct at91_ether_platform_data macb_pdata = {
|
static struct at91_ether_platform_data macb_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = -1,
|
.phy_addr = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ static void usb_a9260_add_device_nand(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct at91_ether_platform_data macb_pdata = {
|
static struct at91_ether_platform_data macb_pdata = {
|
||||||
.is_rmii = 1,
|
.phy_interface = PHY_INTERFACE_MODE_RMII,
|
||||||
.phy_addr = -1,
|
.phy_addr = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ void __init at91_add_device_eth(int id, struct at91_ether_platform_data *data)
|
||||||
at91_set_A_periph(AT91_PIN_PA8, 0); /* ETXEN */
|
at91_set_A_periph(AT91_PIN_PA8, 0); /* ETXEN */
|
||||||
at91_set_A_periph(AT91_PIN_PA7, 0); /* ETXCK_EREFCK */
|
at91_set_A_periph(AT91_PIN_PA7, 0); /* ETXCK_EREFCK */
|
||||||
|
|
||||||
if (!data->is_rmii) {
|
if (data->phy_interface != PHY_INTERFACE_MODE_RMII) {
|
||||||
at91_set_B_periph(AT91_PIN_PB19, 0); /* ERXCK */
|
at91_set_B_periph(AT91_PIN_PB19, 0); /* ERXCK */
|
||||||
at91_set_B_periph(AT91_PIN_PB18, 0); /* ECOL */
|
at91_set_B_periph(AT91_PIN_PB18, 0); /* ECOL */
|
||||||
at91_set_B_periph(AT91_PIN_PB17, 0); /* ERXDV */
|
at91_set_B_periph(AT91_PIN_PB17, 0); /* ERXDV */
|
||||||
|
|
|
@ -98,7 +98,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)
|
||||||
at91_set_A_periph(AT91_PIN_PA21, 0); /* EMDIO */
|
at91_set_A_periph(AT91_PIN_PA21, 0); /* EMDIO */
|
||||||
at91_set_A_periph(AT91_PIN_PA20, 0); /* EMDC */
|
at91_set_A_periph(AT91_PIN_PA20, 0); /* EMDC */
|
||||||
|
|
||||||
if (!data->is_rmii) {
|
if (data->phy_interface != PHY_INTERFACE_MODE_RMII) {
|
||||||
at91_set_B_periph(AT91_PIN_PA28, 0); /* ECRS */
|
at91_set_B_periph(AT91_PIN_PA28, 0); /* ECRS */
|
||||||
at91_set_B_periph(AT91_PIN_PA29, 0); /* ECOL */
|
at91_set_B_periph(AT91_PIN_PA29, 0); /* ECOL */
|
||||||
at91_set_B_periph(AT91_PIN_PA25, 0); /* ERX2 */
|
at91_set_B_periph(AT91_PIN_PA25, 0); /* ERX2 */
|
||||||
|
|
|
@ -97,7 +97,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)
|
||||||
at91_set_A_periph(AT91_PIN_PE30, 0); /* EMDIO */
|
at91_set_A_periph(AT91_PIN_PE30, 0); /* EMDIO */
|
||||||
at91_set_A_periph(AT91_PIN_PE29, 0); /* EMDC */
|
at91_set_A_periph(AT91_PIN_PE29, 0); /* EMDC */
|
||||||
|
|
||||||
if (!data->is_rmii) {
|
if (data->phy_interface != PHY_INTERFACE_MODE_RMII) {
|
||||||
at91_set_A_periph(AT91_PIN_PE22, 0); /* ECRS */
|
at91_set_A_periph(AT91_PIN_PE22, 0); /* ECRS */
|
||||||
at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */
|
at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */
|
||||||
at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */
|
at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */
|
||||||
|
|
|
@ -99,7 +99,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)
|
||||||
at91_set_A_periph(AT91_PIN_PA19, 0); /* EMDIO */
|
at91_set_A_periph(AT91_PIN_PA19, 0); /* EMDIO */
|
||||||
at91_set_A_periph(AT91_PIN_PA18, 0); /* EMDC */
|
at91_set_A_periph(AT91_PIN_PA18, 0); /* EMDC */
|
||||||
|
|
||||||
if (!data->is_rmii) {
|
if (data->phy_interface != PHY_INTERFACE_MODE_RMII) {
|
||||||
at91_set_B_periph(AT91_PIN_PA29, 0); /* ECRS */
|
at91_set_B_periph(AT91_PIN_PA29, 0); /* ECRS */
|
||||||
at91_set_B_periph(AT91_PIN_PA30, 0); /* ECOL */
|
at91_set_B_periph(AT91_PIN_PA30, 0); /* ECOL */
|
||||||
at91_set_B_periph(AT91_PIN_PA8, 0); /* ERX2 */
|
at91_set_B_periph(AT91_PIN_PA8, 0); /* ERX2 */
|
||||||
|
|
|
@ -111,7 +111,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)
|
||||||
at91_set_A_periph(AT91_PIN_PB5, 0); /* EMDIO */
|
at91_set_A_periph(AT91_PIN_PB5, 0); /* EMDIO */
|
||||||
at91_set_A_periph(AT91_PIN_PB6, 0); /* EMDC */
|
at91_set_A_periph(AT91_PIN_PB6, 0); /* EMDC */
|
||||||
|
|
||||||
if (!data->is_rmii) {
|
if (data->phy_interface != PHY_INTERFACE_MODE_RMII) {
|
||||||
at91_set_A_periph(AT91_PIN_PB16, 0); /* ECRS */
|
at91_set_A_periph(AT91_PIN_PB16, 0); /* ECRS */
|
||||||
at91_set_A_periph(AT91_PIN_PB17, 0); /* ECOL */
|
at91_set_A_periph(AT91_PIN_PB17, 0); /* ECOL */
|
||||||
at91_set_A_periph(AT91_PIN_PB13, 0); /* ERX2 */
|
at91_set_A_periph(AT91_PIN_PB13, 0); /* ERX2 */
|
||||||
|
@ -124,7 +124,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
start = AT91SAM9X5_BASE_EMAC1;
|
start = AT91SAM9X5_BASE_EMAC1;
|
||||||
if (!data->is_rmii)
|
if (data->phy_interface != PHY_INTERFACE_MODE_RMII)
|
||||||
pr_warn("AT91: Only RMII available on interface macb%d.\n", id);
|
pr_warn("AT91: Only RMII available on interface macb%d.\n", id);
|
||||||
|
|
||||||
/* Pins used for RMII */
|
/* Pins used for RMII */
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <linux/mtd/mtd.h>
|
#include <linux/mtd/mtd.h>
|
||||||
#include <fb.h>
|
#include <fb.h>
|
||||||
#include <video/atmel_lcdc.h>
|
#include <video/atmel_lcdc.h>
|
||||||
|
#include <linux/phy.h>
|
||||||
|
|
||||||
/* USB Host */
|
/* USB Host */
|
||||||
struct at91_usbh_data {
|
struct at91_usbh_data {
|
||||||
|
@ -74,7 +75,7 @@ struct at91_ether_platform_data {
|
||||||
unsigned int phy_flags;
|
unsigned int phy_flags;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
int phy_addr;
|
int phy_addr;
|
||||||
int is_rmii;
|
phy_interface_t phy_interface;
|
||||||
int (*get_ethaddr)(struct eth_device*, unsigned char *adr);
|
int (*get_ethaddr)(struct eth_device*, unsigned char *adr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -342,7 +342,7 @@ static int at91_ether_probe(struct device_d *dev)
|
||||||
|
|
||||||
mac_cfg |= AT91_EMAC_CLK_DIV32 | AT91_EMAC_BIG;
|
mac_cfg |= AT91_EMAC_CLK_DIV32 | AT91_EMAC_BIG;
|
||||||
|
|
||||||
if (pdata->is_rmii) {
|
if (pdata->phy_interface == PHY_INTERFACE_MODE_RMII) {
|
||||||
ether_dev->interface = PHY_INTERFACE_MODE_RGMII;
|
ether_dev->interface = PHY_INTERFACE_MODE_RGMII;
|
||||||
mac_cfg |= AT91_EMAC_RMII;
|
mac_cfg |= AT91_EMAC_RMII;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -436,10 +436,10 @@ static int macb_probe(struct device_d *dev)
|
||||||
macb->miibus.priv = macb;
|
macb->miibus.priv = macb;
|
||||||
macb->miibus.parent = dev;
|
macb->miibus.parent = dev;
|
||||||
|
|
||||||
if (pdata->is_rmii)
|
if (pdata->phy_interface == PHY_INTERFACE_MODE_NA)
|
||||||
macb->interface = PHY_INTERFACE_MODE_RMII;
|
|
||||||
else
|
|
||||||
macb->interface = PHY_INTERFACE_MODE_MII;
|
macb->interface = PHY_INTERFACE_MODE_MII;
|
||||||
|
else
|
||||||
|
macb->interface = pdata->phy_interface;
|
||||||
|
|
||||||
macb->phy_flags = pdata->phy_flags;
|
macb->phy_flags = pdata->phy_flags;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue