diff options
author | Vitaly Bordug <vbordug@ru.mvista.com> | 2006-08-15 02:00:30 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-08-19 17:44:31 -0400 |
commit | 5b4b8454344a0391bb0f69fda0f4ec8e1f0d2fed (patch) | |
tree | a5e662cdc03d319e56a277281dcde754150276f4 /drivers/net/fs_enet/mac-fcc.c | |
parent | 11b0bacd717c285c94dbb56505a28434b34f0639 (diff) |
[PATCH] FS_ENET: use PAL for mii management
This patch should update the fs_enet infrastructure to utilize Phy Abstraction
Layer subsystem. Along with the above, there are apparent bugfixes, overhaul
and improvements.
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/fs_enet/mac-fcc.c')
-rw-r--r-- | drivers/net/fs_enet/mac-fcc.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index 64e20982c1fe..1ff2597b8495 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/bitops.h> | 34 | #include <linux/bitops.h> |
35 | #include <linux/fs.h> | 35 | #include <linux/fs.h> |
36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
37 | #include <linux/phy.h> | ||
37 | 38 | ||
38 | #include <asm/immap_cpm2.h> | 39 | #include <asm/immap_cpm2.h> |
39 | #include <asm/mpc8260.h> | 40 | #include <asm/mpc8260.h> |
@@ -122,22 +123,32 @@ static int do_pd_setup(struct fs_enet_private *fep) | |||
122 | 123 | ||
123 | /* Attach the memory for the FCC Parameter RAM */ | 124 | /* Attach the memory for the FCC Parameter RAM */ |
124 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram"); | 125 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram"); |
125 | fep->fcc.ep = (void *)r->start; | 126 | fep->fcc.ep = (void *)ioremap(r->start, r->end - r->start + 1); |
126 | |||
127 | if (fep->fcc.ep == NULL) | 127 | if (fep->fcc.ep == NULL) |
128 | return -EINVAL; | 128 | return -EINVAL; |
129 | 129 | ||
130 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_regs"); | 130 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_regs"); |
131 | fep->fcc.fccp = (void *)r->start; | 131 | fep->fcc.fccp = (void *)ioremap(r->start, r->end - r->start + 1); |
132 | |||
133 | if (fep->fcc.fccp == NULL) | 132 | if (fep->fcc.fccp == NULL) |
134 | return -EINVAL; | 133 | return -EINVAL; |
135 | 134 | ||
136 | fep->fcc.fcccp = (void *)fep->fpi->fcc_regs_c; | 135 | if (fep->fpi->fcc_regs_c) { |
136 | |||
137 | fep->fcc.fcccp = (void *)fep->fpi->fcc_regs_c; | ||
138 | } else { | ||
139 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, | ||
140 | "fcc_regs_c"); | ||
141 | fep->fcc.fcccp = (void *)ioremap(r->start, | ||
142 | r->end - r->start + 1); | ||
143 | } | ||
137 | 144 | ||
138 | if (fep->fcc.fcccp == NULL) | 145 | if (fep->fcc.fcccp == NULL) |
139 | return -EINVAL; | 146 | return -EINVAL; |
140 | 147 | ||
148 | fep->fcc.mem = (void *)fep->fpi->mem_offset; | ||
149 | if (fep->fcc.mem == NULL) | ||
150 | return -EINVAL; | ||
151 | |||
141 | return 0; | 152 | return 0; |
142 | } | 153 | } |
143 | 154 | ||
@@ -155,8 +166,6 @@ static int setup_data(struct net_device *dev) | |||
155 | if ((unsigned int)fep->fcc.idx >= 3) /* max 3 FCCs */ | 166 | if ((unsigned int)fep->fcc.idx >= 3) /* max 3 FCCs */ |
156 | return -EINVAL; | 167 | return -EINVAL; |
157 | 168 | ||
158 | fep->fcc.mem = (void *)fpi->mem_offset; | ||
159 | |||
160 | if (do_pd_setup(fep) != 0) | 169 | if (do_pd_setup(fep) != 0) |
161 | return -EINVAL; | 170 | return -EINVAL; |
162 | 171 | ||
@@ -394,7 +403,7 @@ static void restart(struct net_device *dev) | |||
394 | 403 | ||
395 | /* adjust to speed (for RMII mode) */ | 404 | /* adjust to speed (for RMII mode) */ |
396 | if (fpi->use_rmii) { | 405 | if (fpi->use_rmii) { |
397 | if (fep->speed == 100) | 406 | if (fep->phydev->speed == 100) |
398 | C8(fcccp, fcc_gfemr, 0x20); | 407 | C8(fcccp, fcc_gfemr, 0x20); |
399 | else | 408 | else |
400 | S8(fcccp, fcc_gfemr, 0x20); | 409 | S8(fcccp, fcc_gfemr, 0x20); |
@@ -420,7 +429,7 @@ static void restart(struct net_device *dev) | |||
420 | S32(fccp, fcc_fpsmr, FCC_PSMR_RMII); | 429 | S32(fccp, fcc_fpsmr, FCC_PSMR_RMII); |
421 | 430 | ||
422 | /* adjust to duplex mode */ | 431 | /* adjust to duplex mode */ |
423 | if (fep->duplex) | 432 | if (fep->phydev->duplex) |
424 | S32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); | 433 | S32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); |
425 | else | 434 | else |
426 | C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); | 435 | C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); |
@@ -486,7 +495,10 @@ static void rx_bd_done(struct net_device *dev) | |||
486 | 495 | ||
487 | static void tx_kickstart(struct net_device *dev) | 496 | static void tx_kickstart(struct net_device *dev) |
488 | { | 497 | { |
489 | /* nothing */ | 498 | struct fs_enet_private *fep = netdev_priv(dev); |
499 | fcc_t *fccp = fep->fcc.fccp; | ||
500 | |||
501 | S32(fccp, fcc_ftodr, 0x80); | ||
490 | } | 502 | } |
491 | 503 | ||
492 | static u32 get_int_events(struct net_device *dev) | 504 | static u32 get_int_events(struct net_device *dev) |