Skip to content

Commit 6bdaa5e

Browse files
Nicolas Ferredavem330
authored andcommitted
net: macb: fix default configuration for GMAC on AT91
On AT91 SoCs, the User Register (USRIO) exposes a switch to configure the "Reduced" or "Traditional" version of the Media Independent Interface (RMII vs. MII or RGMII vs. GMII). As on the older EMAC version, on GMAC, this switch is set by default to the non-reduced type of interface, so use the existing capability and extend it to GMII as well. We then keep the current logic in the macb_init() function. The capabilities of sama5d2, sama5d4 and sama5d3 GEM interface are updated in the macb_config structure to be able to properly enable them with a traditional interface (GMII or MII). Reported-by: Romain HENRIET <romain.henriet@l-acoustics.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 470c382 commit 6bdaa5e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

drivers/net/ethernet/cadence/macb.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,9 +2440,9 @@ static int macb_init(struct platform_device *pdev)
24402440
if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII)
24412441
val = GEM_BIT(RGMII);
24422442
else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII &&
2443-
(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII))
2443+
(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII))
24442444
val = MACB_BIT(RMII);
2445-
else if (!(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII))
2445+
else if (!(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII))
24462446
val = MACB_BIT(MII);
24472447

24482448
if (bp->caps & MACB_CAPS_USRIO_HAS_CLKEN)
@@ -2774,7 +2774,7 @@ static int at91ether_init(struct platform_device *pdev)
27742774
}
27752775

27762776
static const struct macb_config at91sam9260_config = {
2777-
.caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII,
2777+
.caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
27782778
.clk_init = macb_clk_init,
27792779
.init = macb_init,
27802780
};
@@ -2787,21 +2787,22 @@ static const struct macb_config pc302gem_config = {
27872787
};
27882788

27892789
static const struct macb_config sama5d2_config = {
2790-
.caps = 0,
2790+
.caps = MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
27912791
.dma_burst_length = 16,
27922792
.clk_init = macb_clk_init,
27932793
.init = macb_init,
27942794
};
27952795

27962796
static const struct macb_config sama5d3_config = {
2797-
.caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE,
2797+
.caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE
2798+
| MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
27982799
.dma_burst_length = 16,
27992800
.clk_init = macb_clk_init,
28002801
.init = macb_init,
28012802
};
28022803

28032804
static const struct macb_config sama5d4_config = {
2804-
.caps = 0,
2805+
.caps = MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
28052806
.dma_burst_length = 4,
28062807
.clk_init = macb_clk_init,
28072808
.init = macb_init,

drivers/net/ethernet/cadence/macb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@
400400
/* Capability mask bits */
401401
#define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001
402402
#define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002
403-
#define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004
403+
#define MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII 0x00000004
404404
#define MACB_CAPS_NO_GIGABIT_HALF 0x00000008
405405
#define MACB_CAPS_USRIO_DISABLED 0x00000010
406406
#define MACB_CAPS_FIFO_MODE 0x10000000

0 commit comments

Comments
 (0)