diff options
Diffstat (limited to 'drivers/net/fs_enet/mac-fcc.c')
-rw-r--r-- | drivers/net/fs_enet/mac-fcc.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index 95e2bb8dd7b4..1ff2597b8495 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * kind, whether express or implied. | 12 | * kind, whether express or implied. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
18 | #include <linux/types.h> | 17 | #include <linux/types.h> |
@@ -35,6 +34,7 @@ | |||
35 | #include <linux/bitops.h> | 34 | #include <linux/bitops.h> |
36 | #include <linux/fs.h> | 35 | #include <linux/fs.h> |
37 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
37 | #include <linux/phy.h> | ||
38 | 38 | ||
39 | #include <asm/immap_cpm2.h> | 39 | #include <asm/immap_cpm2.h> |
40 | #include <asm/mpc8260.h> | 40 | #include <asm/mpc8260.h> |
@@ -123,22 +123,32 @@ static int do_pd_setup(struct fs_enet_private *fep) | |||
123 | 123 | ||
124 | /* Attach the memory for the FCC Parameter RAM */ | 124 | /* Attach the memory for the FCC Parameter RAM */ |
125 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram"); | 125 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram"); |
126 | fep->fcc.ep = (void *)r->start; | 126 | fep->fcc.ep = (void *)ioremap(r->start, r->end - r->start + 1); |
127 | |||
128 | if (fep->fcc.ep == NULL) | 127 | if (fep->fcc.ep == NULL) |
129 | return -EINVAL; | 128 | return -EINVAL; |
130 | 129 | ||
131 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_regs"); | 130 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_regs"); |
132 | fep->fcc.fccp = (void *)r->start; | 131 | fep->fcc.fccp = (void *)ioremap(r->start, r->end - r->start + 1); |
133 | |||
134 | if (fep->fcc.fccp == NULL) | 132 | if (fep->fcc.fccp == NULL) |
135 | return -EINVAL; | 133 | return -EINVAL; |
136 | 134 | ||
137 | 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 | } | ||
138 | 144 | ||
139 | if (fep->fcc.fcccp == NULL) | 145 | if (fep->fcc.fcccp == NULL) |
140 | return -EINVAL; | 146 | return -EINVAL; |
141 | 147 | ||
148 | fep->fcc.mem = (void *)fep->fpi->mem_offset; | ||
149 | if (fep->fcc.mem == NULL) | ||
150 | return -EINVAL; | ||
151 | |||
142 | return 0; | 152 | return 0; |
143 | } | 153 | } |
144 | 154 | ||
@@ -156,8 +166,6 @@ static int setup_data(struct net_device *dev) | |||
156 | if ((unsigned int)fep->fcc.idx >= 3) /* max 3 FCCs */ | 166 | if ((unsigned int)fep->fcc.idx >= 3) /* max 3 FCCs */ |
157 | return -EINVAL; | 167 | return -EINVAL; |
158 | 168 | ||
159 | fep->fcc.mem = (void *)fpi->mem_offset; | ||
160 | |||
161 | if (do_pd_setup(fep) != 0) | 169 | if (do_pd_setup(fep) != 0) |
162 | return -EINVAL; | 170 | return -EINVAL; |
163 | 171 | ||
@@ -395,7 +403,7 @@ static void restart(struct net_device *dev) | |||
395 | 403 | ||
396 | /* adjust to speed (for RMII mode) */ | 404 | /* adjust to speed (for RMII mode) */ |
397 | if (fpi->use_rmii) { | 405 | if (fpi->use_rmii) { |
398 | if (fep->speed == 100) | 406 | if (fep->phydev->speed == 100) |
399 | C8(fcccp, fcc_gfemr, 0x20); | 407 | C8(fcccp, fcc_gfemr, 0x20); |
400 | else | 408 | else |
401 | S8(fcccp, fcc_gfemr, 0x20); | 409 | S8(fcccp, fcc_gfemr, 0x20); |
@@ -421,7 +429,7 @@ static void restart(struct net_device *dev) | |||
421 | S32(fccp, fcc_fpsmr, FCC_PSMR_RMII); | 429 | S32(fccp, fcc_fpsmr, FCC_PSMR_RMII); |
422 | 430 | ||
423 | /* adjust to duplex mode */ | 431 | /* adjust to duplex mode */ |
424 | if (fep->duplex) | 432 | if (fep->phydev->duplex) |
425 | S32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); | 433 | S32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); |
426 | else | 434 | else |
427 | C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); | 435 | C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); |
@@ -487,7 +495,10 @@ static void rx_bd_done(struct net_device *dev) | |||
487 | 495 | ||
488 | static void tx_kickstart(struct net_device *dev) | 496 | static void tx_kickstart(struct net_device *dev) |
489 | { | 497 | { |
490 | /* nothing */ | 498 | struct fs_enet_private *fep = netdev_priv(dev); |
499 | fcc_t *fccp = fep->fcc.fccp; | ||
500 | |||
501 | S32(fccp, fcc_ftodr, 0x80); | ||
491 | } | 502 | } |
492 | 503 | ||
493 | static u32 get_int_events(struct net_device *dev) | 504 | static u32 get_int_events(struct net_device *dev) |