diff options
author | David S. Miller <davem@davemloft.net> | 2008-07-18 05:39:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-18 05:39:39 -0400 |
commit | 49997d75152b3d23c53b0fa730599f2f74c92c65 (patch) | |
tree | 46e93126170d02cfec9505172e545732c1b69656 /drivers/net/ibm_newemac | |
parent | a0c80b80e0fb48129e4e9d6a9ede914f9ff1850d (diff) | |
parent | 5b664cb235e97afbf34db9c4d77f08ebd725335e (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
Documentation/powerpc/booting-without-of.txt
drivers/atm/Makefile
drivers/net/fs_enet/fs_enet-main.c
drivers/pci/pci-acpi.c
net/8021q/vlan.c
net/iucv/iucv.c
Diffstat (limited to 'drivers/net/ibm_newemac')
-rw-r--r-- | drivers/net/ibm_newemac/core.c | 61 | ||||
-rw-r--r-- | drivers/net/ibm_newemac/core.h | 85 | ||||
-rw-r--r-- | drivers/net/ibm_newemac/debug.c | 52 | ||||
-rw-r--r-- | drivers/net/ibm_newemac/emac.h | 101 | ||||
-rw-r--r-- | drivers/net/ibm_newemac/rgmii.c | 6 |
5 files changed, 239 insertions, 66 deletions
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index 9ca57d365599..2e720f26ca83 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -367,25 +367,31 @@ static int emac_reset(struct emac_instance *dev) | |||
367 | 367 | ||
368 | static void emac_hash_mc(struct emac_instance *dev) | 368 | static void emac_hash_mc(struct emac_instance *dev) |
369 | { | 369 | { |
370 | struct emac_regs __iomem *p = dev->emacp; | 370 | const int regs = EMAC_XAHT_REGS(dev); |
371 | u16 gaht[4] = { 0 }; | 371 | u32 *gaht_base = emac_gaht_base(dev); |
372 | u32 gaht_temp[regs]; | ||
372 | struct dev_mc_list *dmi; | 373 | struct dev_mc_list *dmi; |
374 | int i; | ||
373 | 375 | ||
374 | DBG(dev, "hash_mc %d" NL, dev->ndev->mc_count); | 376 | DBG(dev, "hash_mc %d" NL, dev->ndev->mc_count); |
375 | 377 | ||
378 | memset(gaht_temp, 0, sizeof (gaht_temp)); | ||
379 | |||
376 | for (dmi = dev->ndev->mc_list; dmi; dmi = dmi->next) { | 380 | for (dmi = dev->ndev->mc_list; dmi; dmi = dmi->next) { |
377 | int bit; | 381 | int slot, reg, mask; |
378 | DBG2(dev, "mc %02x:%02x:%02x:%02x:%02x:%02x" NL, | 382 | DBG2(dev, "mc %02x:%02x:%02x:%02x:%02x:%02x" NL, |
379 | dmi->dmi_addr[0], dmi->dmi_addr[1], dmi->dmi_addr[2], | 383 | dmi->dmi_addr[0], dmi->dmi_addr[1], dmi->dmi_addr[2], |
380 | dmi->dmi_addr[3], dmi->dmi_addr[4], dmi->dmi_addr[5]); | 384 | dmi->dmi_addr[3], dmi->dmi_addr[4], dmi->dmi_addr[5]); |
381 | 385 | ||
382 | bit = 63 - (ether_crc(ETH_ALEN, dmi->dmi_addr) >> 26); | 386 | slot = EMAC_XAHT_CRC_TO_SLOT(dev, ether_crc(ETH_ALEN, dmi->dmi_addr)); |
383 | gaht[bit >> 4] |= 0x8000 >> (bit & 0x0f); | 387 | reg = EMAC_XAHT_SLOT_TO_REG(dev, slot); |
388 | mask = EMAC_XAHT_SLOT_TO_MASK(dev, slot); | ||
389 | |||
390 | gaht_temp[reg] |= mask; | ||
384 | } | 391 | } |
385 | out_be32(&p->gaht1, gaht[0]); | 392 | |
386 | out_be32(&p->gaht2, gaht[1]); | 393 | for (i = 0; i < regs; i++) |
387 | out_be32(&p->gaht3, gaht[2]); | 394 | out_be32(gaht_base + i, gaht_temp[i]); |
388 | out_be32(&p->gaht4, gaht[3]); | ||
389 | } | 395 | } |
390 | 396 | ||
391 | static inline u32 emac_iff2rmr(struct net_device *ndev) | 397 | static inline u32 emac_iff2rmr(struct net_device *ndev) |
@@ -402,7 +408,8 @@ static inline u32 emac_iff2rmr(struct net_device *ndev) | |||
402 | 408 | ||
403 | if (ndev->flags & IFF_PROMISC) | 409 | if (ndev->flags & IFF_PROMISC) |
404 | r |= EMAC_RMR_PME; | 410 | r |= EMAC_RMR_PME; |
405 | else if (ndev->flags & IFF_ALLMULTI || ndev->mc_count > 32) | 411 | else if (ndev->flags & IFF_ALLMULTI || |
412 | (ndev->mc_count > EMAC_XAHT_SLOTS(dev))) | ||
406 | r |= EMAC_RMR_PMME; | 413 | r |= EMAC_RMR_PMME; |
407 | else if (ndev->mc_count > 0) | 414 | else if (ndev->mc_count > 0) |
408 | r |= EMAC_RMR_MAE; | 415 | r |= EMAC_RMR_MAE; |
@@ -546,7 +553,7 @@ static int emac_configure(struct emac_instance *dev) | |||
546 | /* Put some arbitrary OUI, Manuf & Rev IDs so we can | 553 | /* Put some arbitrary OUI, Manuf & Rev IDs so we can |
547 | * identify this GPCS PHY later. | 554 | * identify this GPCS PHY later. |
548 | */ | 555 | */ |
549 | out_be32(&p->ipcr, 0xdeadbeef); | 556 | out_be32(&p->u1.emac4.ipcr, 0xdeadbeef); |
550 | } else | 557 | } else |
551 | mr1 |= EMAC_MR1_MF_1000; | 558 | mr1 |= EMAC_MR1_MF_1000; |
552 | 559 | ||
@@ -2025,10 +2032,10 @@ static int emac_get_regs_len(struct emac_instance *dev) | |||
2025 | { | 2032 | { |
2026 | if (emac_has_feature(dev, EMAC_FTR_EMAC4)) | 2033 | if (emac_has_feature(dev, EMAC_FTR_EMAC4)) |
2027 | return sizeof(struct emac_ethtool_regs_subhdr) + | 2034 | return sizeof(struct emac_ethtool_regs_subhdr) + |
2028 | EMAC4_ETHTOOL_REGS_SIZE; | 2035 | EMAC4_ETHTOOL_REGS_SIZE(dev); |
2029 | else | 2036 | else |
2030 | return sizeof(struct emac_ethtool_regs_subhdr) + | 2037 | return sizeof(struct emac_ethtool_regs_subhdr) + |
2031 | EMAC_ETHTOOL_REGS_SIZE; | 2038 | EMAC_ETHTOOL_REGS_SIZE(dev); |
2032 | } | 2039 | } |
2033 | 2040 | ||
2034 | static int emac_ethtool_get_regs_len(struct net_device *ndev) | 2041 | static int emac_ethtool_get_regs_len(struct net_device *ndev) |
@@ -2055,12 +2062,12 @@ static void *emac_dump_regs(struct emac_instance *dev, void *buf) | |||
2055 | hdr->index = dev->cell_index; | 2062 | hdr->index = dev->cell_index; |
2056 | if (emac_has_feature(dev, EMAC_FTR_EMAC4)) { | 2063 | if (emac_has_feature(dev, EMAC_FTR_EMAC4)) { |
2057 | hdr->version = EMAC4_ETHTOOL_REGS_VER; | 2064 | hdr->version = EMAC4_ETHTOOL_REGS_VER; |
2058 | memcpy_fromio(hdr + 1, dev->emacp, EMAC4_ETHTOOL_REGS_SIZE); | 2065 | memcpy_fromio(hdr + 1, dev->emacp, EMAC4_ETHTOOL_REGS_SIZE(dev)); |
2059 | return ((void *)(hdr + 1) + EMAC4_ETHTOOL_REGS_SIZE); | 2066 | return ((void *)(hdr + 1) + EMAC4_ETHTOOL_REGS_SIZE(dev)); |
2060 | } else { | 2067 | } else { |
2061 | hdr->version = EMAC_ETHTOOL_REGS_VER; | 2068 | hdr->version = EMAC_ETHTOOL_REGS_VER; |
2062 | memcpy_fromio(hdr + 1, dev->emacp, EMAC_ETHTOOL_REGS_SIZE); | 2069 | memcpy_fromio(hdr + 1, dev->emacp, EMAC_ETHTOOL_REGS_SIZE(dev)); |
2063 | return ((void *)(hdr + 1) + EMAC_ETHTOOL_REGS_SIZE); | 2070 | return ((void *)(hdr + 1) + EMAC_ETHTOOL_REGS_SIZE(dev)); |
2064 | } | 2071 | } |
2065 | } | 2072 | } |
2066 | 2073 | ||
@@ -2550,7 +2557,9 @@ static int __devinit emac_init_config(struct emac_instance *dev) | |||
2550 | } | 2557 | } |
2551 | 2558 | ||
2552 | /* Check EMAC version */ | 2559 | /* Check EMAC version */ |
2553 | if (of_device_is_compatible(np, "ibm,emac4")) { | 2560 | if (of_device_is_compatible(np, "ibm,emac4sync")) { |
2561 | dev->features |= (EMAC_FTR_EMAC4 | EMAC_FTR_EMAC4SYNC); | ||
2562 | } else if (of_device_is_compatible(np, "ibm,emac4")) { | ||
2554 | dev->features |= EMAC_FTR_EMAC4; | 2563 | dev->features |= EMAC_FTR_EMAC4; |
2555 | if (of_device_is_compatible(np, "ibm,emac-440gx")) | 2564 | if (of_device_is_compatible(np, "ibm,emac-440gx")) |
2556 | dev->features |= EMAC_FTR_440GX_PHY_CLK_FIX; | 2565 | dev->features |= EMAC_FTR_440GX_PHY_CLK_FIX; |
@@ -2611,6 +2620,15 @@ static int __devinit emac_init_config(struct emac_instance *dev) | |||
2611 | } | 2620 | } |
2612 | memcpy(dev->ndev->dev_addr, p, 6); | 2621 | memcpy(dev->ndev->dev_addr, p, 6); |
2613 | 2622 | ||
2623 | /* IAHT and GAHT filter parameterization */ | ||
2624 | if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) { | ||
2625 | dev->xaht_slots_shift = EMAC4SYNC_XAHT_SLOTS_SHIFT; | ||
2626 | dev->xaht_width_shift = EMAC4SYNC_XAHT_WIDTH_SHIFT; | ||
2627 | } else { | ||
2628 | dev->xaht_slots_shift = EMAC4_XAHT_SLOTS_SHIFT; | ||
2629 | dev->xaht_width_shift = EMAC4_XAHT_WIDTH_SHIFT; | ||
2630 | } | ||
2631 | |||
2614 | DBG(dev, "features : 0x%08x / 0x%08x\n", dev->features, EMAC_FTRS_POSSIBLE); | 2632 | DBG(dev, "features : 0x%08x / 0x%08x\n", dev->features, EMAC_FTRS_POSSIBLE); |
2615 | DBG(dev, "tx_fifo_size : %d (%d gige)\n", dev->tx_fifo_size, dev->tx_fifo_size_gige); | 2633 | DBG(dev, "tx_fifo_size : %d (%d gige)\n", dev->tx_fifo_size, dev->tx_fifo_size_gige); |
2616 | DBG(dev, "rx_fifo_size : %d (%d gige)\n", dev->rx_fifo_size, dev->rx_fifo_size_gige); | 2634 | DBG(dev, "rx_fifo_size : %d (%d gige)\n", dev->rx_fifo_size, dev->rx_fifo_size_gige); |
@@ -2682,7 +2700,8 @@ static int __devinit emac_probe(struct of_device *ofdev, | |||
2682 | goto err_irq_unmap; | 2700 | goto err_irq_unmap; |
2683 | } | 2701 | } |
2684 | // TODO : request_mem_region | 2702 | // TODO : request_mem_region |
2685 | dev->emacp = ioremap(dev->rsrc_regs.start, sizeof(struct emac_regs)); | 2703 | dev->emacp = ioremap(dev->rsrc_regs.start, |
2704 | dev->rsrc_regs.end - dev->rsrc_regs.start + 1); | ||
2686 | if (dev->emacp == NULL) { | 2705 | if (dev->emacp == NULL) { |
2687 | printk(KERN_ERR "%s: Can't map device registers!\n", | 2706 | printk(KERN_ERR "%s: Can't map device registers!\n", |
2688 | np->full_name); | 2707 | np->full_name); |
@@ -2896,6 +2915,10 @@ static struct of_device_id emac_match[] = | |||
2896 | .type = "network", | 2915 | .type = "network", |
2897 | .compatible = "ibm,emac4", | 2916 | .compatible = "ibm,emac4", |
2898 | }, | 2917 | }, |
2918 | { | ||
2919 | .type = "network", | ||
2920 | .compatible = "ibm,emac4sync", | ||
2921 | }, | ||
2899 | {}, | 2922 | {}, |
2900 | }; | 2923 | }; |
2901 | 2924 | ||
diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h index 1683db9870a4..6545e69d12c3 100644 --- a/drivers/net/ibm_newemac/core.h +++ b/drivers/net/ibm_newemac/core.h | |||
@@ -33,8 +33,8 @@ | |||
33 | #include <linux/netdevice.h> | 33 | #include <linux/netdevice.h> |
34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
35 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
36 | #include <linux/of_platform.h> | ||
36 | 37 | ||
37 | #include <asm/of_platform.h> | ||
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | #include <asm/dcr.h> | 39 | #include <asm/dcr.h> |
40 | 40 | ||
@@ -235,6 +235,10 @@ struct emac_instance { | |||
235 | u32 fifo_entry_size; | 235 | u32 fifo_entry_size; |
236 | u32 mal_burst_size; /* move to MAL ? */ | 236 | u32 mal_burst_size; /* move to MAL ? */ |
237 | 237 | ||
238 | /* IAHT and GAHT filter parameterization */ | ||
239 | u32 xaht_slots_shift; | ||
240 | u32 xaht_width_shift; | ||
241 | |||
238 | /* Descriptor management | 242 | /* Descriptor management |
239 | */ | 243 | */ |
240 | struct mal_descriptor *tx_desc; | 244 | struct mal_descriptor *tx_desc; |
@@ -309,6 +313,10 @@ struct emac_instance { | |||
309 | * Set if we need phy clock workaround for 440ep or 440gr | 313 | * Set if we need phy clock workaround for 440ep or 440gr |
310 | */ | 314 | */ |
311 | #define EMAC_FTR_440EP_PHY_CLK_FIX 0x00000100 | 315 | #define EMAC_FTR_440EP_PHY_CLK_FIX 0x00000100 |
316 | /* | ||
317 | * The 405EX and 460EX contain the EMAC4SYNC core | ||
318 | */ | ||
319 | #define EMAC_FTR_EMAC4SYNC 0x00000200 | ||
312 | 320 | ||
313 | 321 | ||
314 | /* Right now, we don't quite handle the always/possible masks on the | 322 | /* Right now, we don't quite handle the always/possible masks on the |
@@ -320,7 +328,8 @@ enum { | |||
320 | 328 | ||
321 | EMAC_FTRS_POSSIBLE = | 329 | EMAC_FTRS_POSSIBLE = |
322 | #ifdef CONFIG_IBM_NEW_EMAC_EMAC4 | 330 | #ifdef CONFIG_IBM_NEW_EMAC_EMAC4 |
323 | EMAC_FTR_EMAC4 | EMAC_FTR_HAS_NEW_STACR | | 331 | EMAC_FTR_EMAC4 | EMAC_FTR_EMAC4SYNC | |
332 | EMAC_FTR_HAS_NEW_STACR | | ||
324 | EMAC_FTR_STACR_OC_INVERT | EMAC_FTR_440GX_PHY_CLK_FIX | | 333 | EMAC_FTR_STACR_OC_INVERT | EMAC_FTR_440GX_PHY_CLK_FIX | |
325 | #endif | 334 | #endif |
326 | #ifdef CONFIG_IBM_NEW_EMAC_TAH | 335 | #ifdef CONFIG_IBM_NEW_EMAC_TAH |
@@ -342,6 +351,71 @@ static inline int emac_has_feature(struct emac_instance *dev, | |||
342 | (EMAC_FTRS_POSSIBLE & dev->features & feature); | 351 | (EMAC_FTRS_POSSIBLE & dev->features & feature); |
343 | } | 352 | } |
344 | 353 | ||
354 | /* | ||
355 | * Various instances of the EMAC core have varying 1) number of | ||
356 | * address match slots, 2) width of the registers for handling address | ||
357 | * match slots, 3) number of registers for handling address match | ||
358 | * slots and 4) base offset for those registers. | ||
359 | * | ||
360 | * These macros and inlines handle these differences based on | ||
361 | * parameters supplied by the device structure which are, in turn, | ||
362 | * initialized based on the "compatible" entry in the device tree. | ||
363 | */ | ||
364 | |||
365 | #define EMAC4_XAHT_SLOTS_SHIFT 6 | ||
366 | #define EMAC4_XAHT_WIDTH_SHIFT 4 | ||
367 | |||
368 | #define EMAC4SYNC_XAHT_SLOTS_SHIFT 8 | ||
369 | #define EMAC4SYNC_XAHT_WIDTH_SHIFT 5 | ||
370 | |||
371 | #define EMAC_XAHT_SLOTS(dev) (1 << (dev)->xaht_slots_shift) | ||
372 | #define EMAC_XAHT_WIDTH(dev) (1 << (dev)->xaht_width_shift) | ||
373 | #define EMAC_XAHT_REGS(dev) (1 << ((dev)->xaht_slots_shift - \ | ||
374 | (dev)->xaht_width_shift)) | ||
375 | |||
376 | #define EMAC_XAHT_CRC_TO_SLOT(dev, crc) \ | ||
377 | ((EMAC_XAHT_SLOTS(dev) - 1) - \ | ||
378 | ((crc) >> ((sizeof (u32) * BITS_PER_BYTE) - \ | ||
379 | (dev)->xaht_slots_shift))) | ||
380 | |||
381 | #define EMAC_XAHT_SLOT_TO_REG(dev, slot) \ | ||
382 | ((slot) >> (dev)->xaht_width_shift) | ||
383 | |||
384 | #define EMAC_XAHT_SLOT_TO_MASK(dev, slot) \ | ||
385 | ((u32)(1 << (EMAC_XAHT_WIDTH(dev) - 1)) >> \ | ||
386 | ((slot) & (u32)(EMAC_XAHT_WIDTH(dev) - 1))) | ||
387 | |||
388 | static inline u32 *emac_xaht_base(struct emac_instance *dev) | ||
389 | { | ||
390 | struct emac_regs __iomem *p = dev->emacp; | ||
391 | int offset; | ||
392 | |||
393 | /* The first IAHT entry always is the base of the block of | ||
394 | * IAHT and GAHT registers. | ||
395 | */ | ||
396 | if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) | ||
397 | offset = offsetof(struct emac_regs, u1.emac4sync.iaht1); | ||
398 | else | ||
399 | offset = offsetof(struct emac_regs, u0.emac4.iaht1); | ||
400 | |||
401 | return ((u32 *)((ptrdiff_t)p + offset)); | ||
402 | } | ||
403 | |||
404 | static inline u32 *emac_gaht_base(struct emac_instance *dev) | ||
405 | { | ||
406 | /* GAHT registers always come after an identical number of | ||
407 | * IAHT registers. | ||
408 | */ | ||
409 | return (emac_xaht_base(dev) + EMAC_XAHT_REGS(dev)); | ||
410 | } | ||
411 | |||
412 | static inline u32 *emac_iaht_base(struct emac_instance *dev) | ||
413 | { | ||
414 | /* IAHT registers always come before an identical number of | ||
415 | * GAHT registers. | ||
416 | */ | ||
417 | return (emac_xaht_base(dev)); | ||
418 | } | ||
345 | 419 | ||
346 | /* Ethtool get_regs complex data. | 420 | /* Ethtool get_regs complex data. |
347 | * We want to get not just EMAC registers, but also MAL, ZMII, RGMII, TAH | 421 | * We want to get not just EMAC registers, but also MAL, ZMII, RGMII, TAH |
@@ -366,4 +440,11 @@ struct emac_ethtool_regs_subhdr { | |||
366 | u32 index; | 440 | u32 index; |
367 | }; | 441 | }; |
368 | 442 | ||
443 | #define EMAC_ETHTOOL_REGS_VER 0 | ||
444 | #define EMAC_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \ | ||
445 | (dev)->rsrc_regs.start + 1) | ||
446 | #define EMAC4_ETHTOOL_REGS_VER 1 | ||
447 | #define EMAC4_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \ | ||
448 | (dev)->rsrc_regs.start + 1) | ||
449 | |||
369 | #endif /* __IBM_NEWEMAC_CORE_H */ | 450 | #endif /* __IBM_NEWEMAC_CORE_H */ |
diff --git a/drivers/net/ibm_newemac/debug.c b/drivers/net/ibm_newemac/debug.c index 86b756a30784..775c850a425a 100644 --- a/drivers/net/ibm_newemac/debug.c +++ b/drivers/net/ibm_newemac/debug.c | |||
@@ -67,29 +67,55 @@ static void emac_desc_dump(struct emac_instance *p) | |||
67 | static void emac_mac_dump(struct emac_instance *dev) | 67 | static void emac_mac_dump(struct emac_instance *dev) |
68 | { | 68 | { |
69 | struct emac_regs __iomem *p = dev->emacp; | 69 | struct emac_regs __iomem *p = dev->emacp; |
70 | const int xaht_regs = EMAC_XAHT_REGS(dev); | ||
71 | u32 *gaht_base = emac_gaht_base(dev); | ||
72 | u32 *iaht_base = emac_iaht_base(dev); | ||
73 | int emac4sync = emac_has_feature(dev, EMAC_FTR_EMAC4SYNC); | ||
74 | int n; | ||
70 | 75 | ||
71 | printk("** EMAC %s registers **\n" | 76 | printk("** EMAC %s registers **\n" |
72 | "MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n" | 77 | "MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n" |
73 | "RMR = 0x%08x ISR = 0x%08x ISER = 0x%08x\n" | 78 | "RMR = 0x%08x ISR = 0x%08x ISER = 0x%08x\n" |
74 | "IAR = %04x%08x VTPID = 0x%04x VTCI = 0x%04x\n" | 79 | "IAR = %04x%08x VTPID = 0x%04x VTCI = 0x%04x\n", |
75 | "IAHT: 0x%04x 0x%04x 0x%04x 0x%04x " | ||
76 | "GAHT: 0x%04x 0x%04x 0x%04x 0x%04x\n" | ||
77 | "LSA = %04x%08x IPGVR = 0x%04x\n" | ||
78 | "STACR = 0x%08x TRTR = 0x%08x RWMR = 0x%08x\n" | ||
79 | "OCTX = 0x%08x OCRX = 0x%08x IPCR = 0x%08x\n", | ||
80 | dev->ofdev->node->full_name, in_be32(&p->mr0), in_be32(&p->mr1), | 80 | dev->ofdev->node->full_name, in_be32(&p->mr0), in_be32(&p->mr1), |
81 | in_be32(&p->tmr0), in_be32(&p->tmr1), | 81 | in_be32(&p->tmr0), in_be32(&p->tmr1), |
82 | in_be32(&p->rmr), in_be32(&p->isr), in_be32(&p->iser), | 82 | in_be32(&p->rmr), in_be32(&p->isr), in_be32(&p->iser), |
83 | in_be32(&p->iahr), in_be32(&p->ialr), in_be32(&p->vtpid), | 83 | in_be32(&p->iahr), in_be32(&p->ialr), in_be32(&p->vtpid), |
84 | in_be32(&p->vtci), | 84 | in_be32(&p->vtci) |
85 | in_be32(&p->iaht1), in_be32(&p->iaht2), in_be32(&p->iaht3), | 85 | ); |
86 | in_be32(&p->iaht4), | 86 | |
87 | in_be32(&p->gaht1), in_be32(&p->gaht2), in_be32(&p->gaht3), | 87 | if (emac4sync) |
88 | in_be32(&p->gaht4), | 88 | printk("MAR = %04x%08x MMAR = %04x%08x\n", |
89 | in_be32(&p->u0.emac4sync.mahr), | ||
90 | in_be32(&p->u0.emac4sync.malr), | ||
91 | in_be32(&p->u0.emac4sync.mmahr), | ||
92 | in_be32(&p->u0.emac4sync.mmalr) | ||
93 | ); | ||
94 | |||
95 | for (n = 0; n < xaht_regs; n++) | ||
96 | printk("IAHT%02d = 0x%08x\n", n + 1, in_be32(iaht_base + n)); | ||
97 | |||
98 | for (n = 0; n < xaht_regs; n++) | ||
99 | printk("GAHT%02d = 0x%08x\n", n + 1, in_be32(gaht_base + n)); | ||
100 | |||
101 | printk("LSA = %04x%08x IPGVR = 0x%04x\n" | ||
102 | "STACR = 0x%08x TRTR = 0x%08x RWMR = 0x%08x\n" | ||
103 | "OCTX = 0x%08x OCRX = 0x%08x\n", | ||
89 | in_be32(&p->lsah), in_be32(&p->lsal), in_be32(&p->ipgvr), | 104 | in_be32(&p->lsah), in_be32(&p->lsal), in_be32(&p->ipgvr), |
90 | in_be32(&p->stacr), in_be32(&p->trtr), in_be32(&p->rwmr), | 105 | in_be32(&p->stacr), in_be32(&p->trtr), in_be32(&p->rwmr), |
91 | in_be32(&p->octx), in_be32(&p->ocrx), in_be32(&p->ipcr) | 106 | in_be32(&p->octx), in_be32(&p->ocrx) |
92 | ); | 107 | ); |
108 | |||
109 | if (!emac4sync) { | ||
110 | printk("IPCR = 0x%08x\n", | ||
111 | in_be32(&p->u1.emac4.ipcr) | ||
112 | ); | ||
113 | } else { | ||
114 | printk("REVID = 0x%08x TPC = 0x%08x\n", | ||
115 | in_be32(&p->u1.emac4sync.revid), | ||
116 | in_be32(&p->u1.emac4sync.tpc) | ||
117 | ); | ||
118 | } | ||
93 | 119 | ||
94 | emac_desc_dump(dev); | 120 | emac_desc_dump(dev); |
95 | } | 121 | } |
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h index 91cb096ab405..0afc2cf5c52b 100644 --- a/drivers/net/ibm_newemac/emac.h +++ b/drivers/net/ibm_newemac/emac.h | |||
@@ -27,37 +27,80 @@ | |||
27 | 27 | ||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | 29 | ||
30 | /* EMAC registers Write Access rules */ | 30 | /* EMAC registers Write Access rules */ |
31 | struct emac_regs { | 31 | struct emac_regs { |
32 | u32 mr0; /* special */ | 32 | /* Common registers across all EMAC implementations. */ |
33 | u32 mr1; /* Reset */ | 33 | u32 mr0; /* Special */ |
34 | u32 tmr0; /* special */ | 34 | u32 mr1; /* Reset */ |
35 | u32 tmr1; /* special */ | 35 | u32 tmr0; /* Special */ |
36 | u32 rmr; /* Reset */ | 36 | u32 tmr1; /* Special */ |
37 | u32 isr; /* Always */ | 37 | u32 rmr; /* Reset */ |
38 | u32 iser; /* Reset */ | 38 | u32 isr; /* Always */ |
39 | u32 iahr; /* Reset, R, T */ | 39 | u32 iser; /* Reset */ |
40 | u32 ialr; /* Reset, R, T */ | 40 | u32 iahr; /* Reset, R, T */ |
41 | u32 vtpid; /* Reset, R, T */ | 41 | u32 ialr; /* Reset, R, T */ |
42 | u32 vtci; /* Reset, R, T */ | 42 | u32 vtpid; /* Reset, R, T */ |
43 | u32 ptr; /* Reset, T */ | 43 | u32 vtci; /* Reset, R, T */ |
44 | u32 iaht1; /* Reset, R */ | 44 | u32 ptr; /* Reset, T */ |
45 | u32 iaht2; /* Reset, R */ | 45 | union { |
46 | u32 iaht3; /* Reset, R */ | 46 | /* Registers unique to EMAC4 implementations */ |
47 | u32 iaht4; /* Reset, R */ | 47 | struct { |
48 | u32 gaht1; /* Reset, R */ | 48 | u32 iaht1; /* Reset, R */ |
49 | u32 gaht2; /* Reset, R */ | 49 | u32 iaht2; /* Reset, R */ |
50 | u32 gaht3; /* Reset, R */ | 50 | u32 iaht3; /* Reset, R */ |
51 | u32 gaht4; /* Reset, R */ | 51 | u32 iaht4; /* Reset, R */ |
52 | u32 gaht1; /* Reset, R */ | ||
53 | u32 gaht2; /* Reset, R */ | ||
54 | u32 gaht3; /* Reset, R */ | ||
55 | u32 gaht4; /* Reset, R */ | ||
56 | } emac4; | ||
57 | /* Registers unique to EMAC4SYNC implementations */ | ||
58 | struct { | ||
59 | u32 mahr; /* Reset, R, T */ | ||
60 | u32 malr; /* Reset, R, T */ | ||
61 | u32 mmahr; /* Reset, R, T */ | ||
62 | u32 mmalr; /* Reset, R, T */ | ||
63 | u32 rsvd0[4]; | ||
64 | } emac4sync; | ||
65 | } u0; | ||
66 | /* Common registers across all EMAC implementations. */ | ||
52 | u32 lsah; | 67 | u32 lsah; |
53 | u32 lsal; | 68 | u32 lsal; |
54 | u32 ipgvr; /* Reset, T */ | 69 | u32 ipgvr; /* Reset, T */ |
55 | u32 stacr; /* special */ | 70 | u32 stacr; /* Special */ |
56 | u32 trtr; /* special */ | 71 | u32 trtr; /* Special */ |
57 | u32 rwmr; /* Reset */ | 72 | u32 rwmr; /* Reset */ |
58 | u32 octx; | 73 | u32 octx; |
59 | u32 ocrx; | 74 | u32 ocrx; |
60 | u32 ipcr; | 75 | union { |
76 | /* Registers unique to EMAC4 implementations */ | ||
77 | struct { | ||
78 | u32 ipcr; | ||
79 | } emac4; | ||
80 | /* Registers unique to EMAC4SYNC implementations */ | ||
81 | struct { | ||
82 | u32 rsvd1; | ||
83 | u32 revid; | ||
84 | u32 rsvd2[2]; | ||
85 | u32 iaht1; /* Reset, R */ | ||
86 | u32 iaht2; /* Reset, R */ | ||
87 | u32 iaht3; /* Reset, R */ | ||
88 | u32 iaht4; /* Reset, R */ | ||
89 | u32 iaht5; /* Reset, R */ | ||
90 | u32 iaht6; /* Reset, R */ | ||
91 | u32 iaht7; /* Reset, R */ | ||
92 | u32 iaht8; /* Reset, R */ | ||
93 | u32 gaht1; /* Reset, R */ | ||
94 | u32 gaht2; /* Reset, R */ | ||
95 | u32 gaht3; /* Reset, R */ | ||
96 | u32 gaht4; /* Reset, R */ | ||
97 | u32 gaht5; /* Reset, R */ | ||
98 | u32 gaht6; /* Reset, R */ | ||
99 | u32 gaht7; /* Reset, R */ | ||
100 | u32 gaht8; /* Reset, R */ | ||
101 | u32 tpc; /* Reset, T */ | ||
102 | } emac4sync; | ||
103 | } u1; | ||
61 | }; | 104 | }; |
62 | 105 | ||
63 | /* | 106 | /* |
@@ -73,12 +116,6 @@ struct emac_regs { | |||
73 | #define PHY_MODE_RTBI 7 | 116 | #define PHY_MODE_RTBI 7 |
74 | #define PHY_MODE_SGMII 8 | 117 | #define PHY_MODE_SGMII 8 |
75 | 118 | ||
76 | |||
77 | #define EMAC_ETHTOOL_REGS_VER 0 | ||
78 | #define EMAC_ETHTOOL_REGS_SIZE (sizeof(struct emac_regs) - sizeof(u32)) | ||
79 | #define EMAC4_ETHTOOL_REGS_VER 1 | ||
80 | #define EMAC4_ETHTOOL_REGS_SIZE sizeof(struct emac_regs) | ||
81 | |||
82 | /* EMACx_MR0 */ | 119 | /* EMACx_MR0 */ |
83 | #define EMAC_MR0_RXI 0x80000000 | 120 | #define EMAC_MR0_RXI 0x80000000 |
84 | #define EMAC_MR0_TXI 0x40000000 | 121 | #define EMAC_MR0_TXI 0x40000000 |
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c index e32da3de2695..1d5379de6900 100644 --- a/drivers/net/ibm_newemac/rgmii.c +++ b/drivers/net/ibm_newemac/rgmii.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #define RGMII_FER_RGMII(idx) (0x5 << ((idx) * 4)) | 39 | #define RGMII_FER_RGMII(idx) (0x5 << ((idx) * 4)) |
40 | #define RGMII_FER_TBI(idx) (0x6 << ((idx) * 4)) | 40 | #define RGMII_FER_TBI(idx) (0x6 << ((idx) * 4)) |
41 | #define RGMII_FER_GMII(idx) (0x7 << ((idx) * 4)) | 41 | #define RGMII_FER_GMII(idx) (0x7 << ((idx) * 4)) |
42 | #define RGMII_FER_MII(idx) RGMII_FER_GMII(idx) | ||
42 | 43 | ||
43 | /* RGMIIx_SSR */ | 44 | /* RGMIIx_SSR */ |
44 | #define RGMII_SSR_MASK(idx) (0x7 << ((idx) * 8)) | 45 | #define RGMII_SSR_MASK(idx) (0x7 << ((idx) * 8)) |
@@ -49,6 +50,7 @@ | |||
49 | static inline int rgmii_valid_mode(int phy_mode) | 50 | static inline int rgmii_valid_mode(int phy_mode) |
50 | { | 51 | { |
51 | return phy_mode == PHY_MODE_GMII || | 52 | return phy_mode == PHY_MODE_GMII || |
53 | phy_mode == PHY_MODE_MII || | ||
52 | phy_mode == PHY_MODE_RGMII || | 54 | phy_mode == PHY_MODE_RGMII || |
53 | phy_mode == PHY_MODE_TBI || | 55 | phy_mode == PHY_MODE_TBI || |
54 | phy_mode == PHY_MODE_RTBI; | 56 | phy_mode == PHY_MODE_RTBI; |
@@ -63,6 +65,8 @@ static inline const char *rgmii_mode_name(int mode) | |||
63 | return "TBI"; | 65 | return "TBI"; |
64 | case PHY_MODE_GMII: | 66 | case PHY_MODE_GMII: |
65 | return "GMII"; | 67 | return "GMII"; |
68 | case PHY_MODE_MII: | ||
69 | return "MII"; | ||
66 | case PHY_MODE_RTBI: | 70 | case PHY_MODE_RTBI: |
67 | return "RTBI"; | 71 | return "RTBI"; |
68 | default: | 72 | default: |
@@ -79,6 +83,8 @@ static inline u32 rgmii_mode_mask(int mode, int input) | |||
79 | return RGMII_FER_TBI(input); | 83 | return RGMII_FER_TBI(input); |
80 | case PHY_MODE_GMII: | 84 | case PHY_MODE_GMII: |
81 | return RGMII_FER_GMII(input); | 85 | return RGMII_FER_GMII(input); |
86 | case PHY_MODE_MII: | ||
87 | return RGMII_FER_MII(input); | ||
82 | case PHY_MODE_RTBI: | 88 | case PHY_MODE_RTBI: |
83 | return RGMII_FER_RTBI(input); | 89 | return RGMII_FER_RTBI(input); |
84 | default: | 90 | default: |