macb/ether: split flags for drivers and phylib
as in the kernel use is_rmii flags for pinctrl phy_flags for phylib flags 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
d1662f9db3
commit
c811546712
|
@ -33,7 +33,7 @@
|
|||
#include <spi/spi.h>
|
||||
|
||||
static struct at91_ether_platform_data ether_pdata = {
|
||||
.flags = AT91SAM_ETHER_RMII,
|
||||
.is_rmii = 1,
|
||||
.phy_addr = 0,
|
||||
};
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ static void ek_add_device_nand(void)
|
|||
}
|
||||
|
||||
static struct at91_ether_platform_data macb_pdata = {
|
||||
.flags = AT91SAM_ETHER_RMII,
|
||||
.is_rmii = 1,
|
||||
.phy_addr = 0,
|
||||
};
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ static void ek_add_device_nand(void)
|
|||
}
|
||||
|
||||
static struct at91_ether_platform_data macb_pdata = {
|
||||
.flags = AT91SAM_ETHER_RMII,
|
||||
.is_rmii = 1,
|
||||
.phy_addr = 0,
|
||||
};
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ static void ek_add_device_nand(void)
|
|||
}
|
||||
|
||||
static struct at91_ether_platform_data macb_pdata = {
|
||||
.flags = AT91SAM_ETHER_RMII,
|
||||
.is_rmii = 1,
|
||||
.phy_addr = 0,
|
||||
};
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ static void ek_add_device_nand(void)
|
|||
}
|
||||
|
||||
static struct at91_ether_platform_data macb_pdata = {
|
||||
.flags = AT91SAM_ETHER_RMII,
|
||||
.is_rmii = 1,
|
||||
.phy_addr = 0,
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <mach/io.h>
|
||||
|
||||
static struct at91_ether_platform_data macb_pdata = {
|
||||
.flags = AT91SAM_ETHER_MII | AT91SAM_ETHER_FORCE_LINK,
|
||||
.phy_flags = PHYLIB_FORCE_LINK,
|
||||
.phy_addr = 4,
|
||||
};
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ static void pm_add_device_nand(void)
|
|||
}
|
||||
|
||||
static struct at91_ether_platform_data macb_pdata = {
|
||||
.flags = AT91SAM_ETHER_RMII,
|
||||
.is_rmii = 1,
|
||||
.phy_addr = 0,
|
||||
};
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ static void __init pm9g45_add_device_usbh(void) {}
|
|||
#endif
|
||||
|
||||
static struct at91_ether_platform_data macb_pdata = {
|
||||
.flags = AT91SAM_ETHER_RMII,
|
||||
.is_rmii = 1,
|
||||
.phy_addr = 0,
|
||||
};
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ static void qil_a9260_add_device_mci(void) {}
|
|||
|
||||
#ifdef CONFIG_CALAO_MB_QIL_A9260
|
||||
static struct at91_ether_platform_data macb_pdata = {
|
||||
.flags = AT91SAM_ETHER_RMII,
|
||||
.is_rmii = 1,
|
||||
.phy_addr = -1,
|
||||
};
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ static void tny_a9260_add_device_nand(void)
|
|||
|
||||
#ifdef CONFIG_DRIVER_NET_MACB
|
||||
static struct at91_ether_platform_data macb_pdata = {
|
||||
.flags = AT91SAM_ETHER_RMII,
|
||||
.is_rmii = 1,
|
||||
.phy_addr = -1,
|
||||
};
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ static void usb_a9260_add_device_nand(void)
|
|||
}
|
||||
|
||||
static struct at91_ether_platform_data macb_pdata = {
|
||||
.flags = AT91SAM_ETHER_RMII,
|
||||
.is_rmii = 1,
|
||||
.phy_addr = -1,
|
||||
};
|
||||
|
||||
|
|
|
@ -91,7 +91,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_PA7, 0); /* ETXCK_EREFCK */
|
||||
|
||||
if (!(data->flags & AT91SAM_ETHER_RMII)) {
|
||||
if (!data->is_rmii) {
|
||||
at91_set_B_periph(AT91_PIN_PB19, 0); /* ERXCK */
|
||||
at91_set_B_periph(AT91_PIN_PB18, 0); /* ECOL */
|
||||
at91_set_B_periph(AT91_PIN_PB17, 0); /* ERXDV */
|
||||
|
|
|
@ -89,7 +89,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_PA20, 0); /* EMDC */
|
||||
|
||||
if (!(data->flags & AT91SAM_ETHER_RMII)) {
|
||||
if (!data->is_rmii) {
|
||||
at91_set_B_periph(AT91_PIN_PA28, 0); /* ECRS */
|
||||
at91_set_B_periph(AT91_PIN_PA29, 0); /* ECOL */
|
||||
at91_set_B_periph(AT91_PIN_PA25, 0); /* ERX2 */
|
||||
|
|
|
@ -96,7 +96,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_PE29, 0); /* EMDC */
|
||||
|
||||
if (!(data->flags & AT91SAM_ETHER_RMII)) {
|
||||
if (!data->is_rmii) {
|
||||
at91_set_A_periph(AT91_PIN_PE22, 0); /* ECRS */
|
||||
at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */
|
||||
at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */
|
||||
|
|
|
@ -72,7 +72,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_PA18, 0); /* EMDC */
|
||||
|
||||
if (!(data->flags & AT91SAM_ETHER_RMII)) {
|
||||
if (!data->is_rmii) {
|
||||
at91_set_B_periph(AT91_PIN_PA29, 0); /* ECRS */
|
||||
at91_set_B_periph(AT91_PIN_PA30, 0); /* ECOL */
|
||||
at91_set_B_periph(AT91_PIN_PA8, 0); /* ERX2 */
|
||||
|
|
|
@ -84,7 +84,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_PB6, 0); /* EMDC */
|
||||
|
||||
if (!(data->flags & AT91SAM_ETHER_RMII)) {
|
||||
if (!data->is_rmii) {
|
||||
at91_set_A_periph(AT91_PIN_PB16, 0); /* ECRS */
|
||||
at91_set_A_periph(AT91_PIN_PB17, 0); /* ECOL */
|
||||
at91_set_A_periph(AT91_PIN_PB13, 0); /* ERX2 */
|
||||
|
@ -97,7 +97,7 @@ void at91_add_device_eth(int id, struct at91_ether_platform_data *data)
|
|||
break;
|
||||
case 1:
|
||||
start = AT91SAM9X5_BASE_EMAC1;
|
||||
if (!(data->flags & AT91SAM_ETHER_RMII))
|
||||
if (!data->is_rmii)
|
||||
pr_warn("AT91: Only RMII available on interface macb%d.\n", id);
|
||||
|
||||
/* Pins used for RMII */
|
||||
|
|
|
@ -63,14 +63,13 @@ struct atmel_nand_data {
|
|||
void at91_add_device_nand(struct atmel_nand_data *data);
|
||||
|
||||
/* Ethernet (EMAC & MACB) */
|
||||
#define AT91SAM_ETHER_MII (0 << 0)
|
||||
#define AT91SAM_ETHER_RMII (1 << 0)
|
||||
#define AT91SAM_ETHER_FORCE_LINK (1 << 1)
|
||||
#define AT91SAM_ETX2_ETX3_ALTERNATIVE (1 << 2)
|
||||
#define AT91SAM_ETX2_ETX3_ALTERNATIVE (1 << 0)
|
||||
|
||||
struct at91_ether_platform_data {
|
||||
unsigned int phy_flags;
|
||||
unsigned int flags;
|
||||
int phy_addr;
|
||||
int is_rmii;
|
||||
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;
|
||||
|
||||
if (pdata->flags & AT91SAM_ETHER_RMII) {
|
||||
if (pdata->is_rmii) {
|
||||
ether_dev->interface = PHY_INTERFACE_MODE_RGMII;
|
||||
mac_cfg |= AT91_EMAC_RMII;
|
||||
} else {
|
||||
|
|
|
@ -439,13 +439,12 @@ static int macb_probe(struct device_d *dev)
|
|||
macb->miibus.priv = macb;
|
||||
macb->miibus.parent = dev;
|
||||
|
||||
if (pdata->flags & AT91SAM_ETHER_RMII)
|
||||
if (pdata->is_rmii)
|
||||
macb->interface = PHY_INTERFACE_MODE_RMII;
|
||||
else
|
||||
macb->interface = PHY_INTERFACE_MODE_MII;
|
||||
|
||||
macb->phy_flags = pdata->flags & AT91SAM_ETHER_FORCE_LINK ?
|
||||
PHYLIB_FORCE_LINK : 0;
|
||||
macb->phy_flags = pdata->phy_flags;
|
||||
|
||||
macb->rx_buffer = dma_alloc_coherent(CFG_MACB_RX_BUFFER_SIZE);
|
||||
macb->rx_ring = dma_alloc_coherent(CFG_MACB_RX_RING_SIZE * sizeof(struct macb_dma_desc));
|
||||
|
|
Loading…
Reference in New Issue