Commit 48e07fbe authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by David S. Miller

bgmac: add support for new BGMAC_CMDCFG_SR position on core rev >= 4

The BGMAC_CMDCFG_SR register is at a different position on core rev >= 4
We do not know where this register is on a rev 5 or higher core, I have
newer seen such a core.
Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
Acked-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 56ceecde
...@@ -768,13 +768,13 @@ static void bgmac_cmdcfg_maskset(struct bgmac *bgmac, u32 mask, u32 set, ...@@ -768,13 +768,13 @@ static void bgmac_cmdcfg_maskset(struct bgmac *bgmac, u32 mask, u32 set,
u32 cmdcfg = bgmac_read(bgmac, BGMAC_CMDCFG); u32 cmdcfg = bgmac_read(bgmac, BGMAC_CMDCFG);
u32 new_val = (cmdcfg & mask) | set; u32 new_val = (cmdcfg & mask) | set;
bgmac_set(bgmac, BGMAC_CMDCFG, BGMAC_CMDCFG_SR); bgmac_set(bgmac, BGMAC_CMDCFG, BGMAC_CMDCFG_SR(bgmac->core->id.rev));
udelay(2); udelay(2);
if (new_val != cmdcfg || force) if (new_val != cmdcfg || force)
bgmac_write(bgmac, BGMAC_CMDCFG, new_val); bgmac_write(bgmac, BGMAC_CMDCFG, new_val);
bgmac_mask(bgmac, BGMAC_CMDCFG, ~BGMAC_CMDCFG_SR); bgmac_mask(bgmac, BGMAC_CMDCFG, ~BGMAC_CMDCFG_SR(bgmac->core->id.rev));
udelay(2); udelay(2);
} }
...@@ -977,7 +977,7 @@ static void bgmac_chip_reset(struct bgmac *bgmac) ...@@ -977,7 +977,7 @@ static void bgmac_chip_reset(struct bgmac *bgmac)
BGMAC_CMDCFG_PROM | BGMAC_CMDCFG_PROM |
BGMAC_CMDCFG_NLC | BGMAC_CMDCFG_NLC |
BGMAC_CMDCFG_CFE | BGMAC_CMDCFG_CFE |
BGMAC_CMDCFG_SR, BGMAC_CMDCFG_SR(core->id.rev),
false); false);
bgmac->mac_speed = SPEED_UNKNOWN; bgmac->mac_speed = SPEED_UNKNOWN;
bgmac->mac_duplex = DUPLEX_UNKNOWN; bgmac->mac_duplex = DUPLEX_UNKNOWN;
...@@ -1020,7 +1020,7 @@ static void bgmac_enable(struct bgmac *bgmac) ...@@ -1020,7 +1020,7 @@ static void bgmac_enable(struct bgmac *bgmac)
cmdcfg = bgmac_read(bgmac, BGMAC_CMDCFG); cmdcfg = bgmac_read(bgmac, BGMAC_CMDCFG);
bgmac_cmdcfg_maskset(bgmac, ~(BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE), bgmac_cmdcfg_maskset(bgmac, ~(BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE),
BGMAC_CMDCFG_SR, true); BGMAC_CMDCFG_SR(bgmac->core->id.rev), true);
udelay(2); udelay(2);
cmdcfg |= BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE; cmdcfg |= BGMAC_CMDCFG_TE | BGMAC_CMDCFG_RE;
bgmac_write(bgmac, BGMAC_CMDCFG, cmdcfg); bgmac_write(bgmac, BGMAC_CMDCFG, cmdcfg);
......
...@@ -197,7 +197,9 @@ ...@@ -197,7 +197,9 @@
#define BGMAC_CMDCFG_TAI 0x00000200 #define BGMAC_CMDCFG_TAI 0x00000200
#define BGMAC_CMDCFG_HD 0x00000400 /* Set if in half duplex mode */ #define BGMAC_CMDCFG_HD 0x00000400 /* Set if in half duplex mode */
#define BGMAC_CMDCFG_HD_SHIFT 10 #define BGMAC_CMDCFG_HD_SHIFT 10
#define BGMAC_CMDCFG_SR 0x00000800 /* Set to reset mode */ #define BGMAC_CMDCFG_SR_REV0 0x00000800 /* Set to reset mode, for other revs */
#define BGMAC_CMDCFG_SR_REV4 0x00002000 /* Set to reset mode, only for core rev 4 */
#define BGMAC_CMDCFG_SR(rev) ((rev == 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
#define BGMAC_CMDCFG_ML 0x00008000 /* Set to activate mac loopback mode */ #define BGMAC_CMDCFG_ML 0x00008000 /* Set to activate mac loopback mode */
#define BGMAC_CMDCFG_AE 0x00400000 #define BGMAC_CMDCFG_AE 0x00400000
#define BGMAC_CMDCFG_CFE 0x00800000 #define BGMAC_CMDCFG_CFE 0x00800000
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment