aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sb1250-mac.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2007-09-20 14:14:01 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:53:47 -0400
commit73d7396980176a5f4515be2f6e39ee417d2369ba (patch)
treee6866fa31193e3fd841f8e3a50208b973882f4aa /drivers/net/sb1250-mac.c
parentac1d49f8431bef861c7dd63e78be25e4c262eb52 (diff)
sb1250-mac.c: De-typedef, de-volatile, de-etc...
Remove typedefs, volatiles and convert kmalloc()/memset() pairs to kcalloc(). Also reformat the surrounding clutter. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/sb1250-mac.c')
-rw-r--r--drivers/net/sb1250-mac.c278
1 files changed, 142 insertions, 136 deletions
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index 6001ab47fba0..0cffd46724df 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -140,17 +140,17 @@ MODULE_PARM_DESC(int_timeout_rx, "RX timeout value");
140 ********************************************************************* */ 140 ********************************************************************* */
141 141
142 142
143typedef enum { sbmac_speed_auto, sbmac_speed_10, 143enum sbmac_speed { sbmac_speed_auto, sbmac_speed_10,
144 sbmac_speed_100, sbmac_speed_1000 } sbmac_speed_t; 144 sbmac_speed_100, sbmac_speed_1000 };
145 145
146typedef enum { sbmac_duplex_auto, sbmac_duplex_half, 146enum sbmac_duplex { sbmac_duplex_auto, sbmac_duplex_half,
147 sbmac_duplex_full } sbmac_duplex_t; 147 sbmac_duplex_full };
148 148
149typedef enum { sbmac_fc_auto, sbmac_fc_disabled, sbmac_fc_frame, 149enum sbmac_fc { sbmac_fc_auto, sbmac_fc_disabled, sbmac_fc_frame,
150 sbmac_fc_collision, sbmac_fc_carrier } sbmac_fc_t; 150 sbmac_fc_collision, sbmac_fc_carrier } sbmac_fc_t;
151 151
152typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on, 152enum sbmac_state { sbmac_state_uninit, sbmac_state_off, sbmac_state_on,
153 sbmac_state_broken } sbmac_state_t; 153 sbmac_state_broken };
154 154
155 155
156/********************************************************************** 156/**********************************************************************
@@ -176,55 +176,61 @@ typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on,
176 * DMA Descriptor structure 176 * DMA Descriptor structure
177 ********************************************************************* */ 177 ********************************************************************* */
178 178
179typedef struct sbdmadscr_s { 179struct sbdmadscr {
180 uint64_t dscr_a; 180 uint64_t dscr_a;
181 uint64_t dscr_b; 181 uint64_t dscr_b;
182} sbdmadscr_t; 182};
183
184typedef unsigned long paddr_t;
185 183
186/********************************************************************** 184/**********************************************************************
187 * DMA Controller structure 185 * DMA Controller structure
188 ********************************************************************* */ 186 ********************************************************************* */
189 187
190typedef struct sbmacdma_s { 188struct sbmacdma {
191 189
192 /* 190 /*
193 * This stuff is used to identify the channel and the registers 191 * This stuff is used to identify the channel and the registers
194 * associated with it. 192 * associated with it.
195 */ 193 */
196 194 struct sbmac_softc *sbdma_eth; /* back pointer to associated
197 struct sbmac_softc *sbdma_eth; /* back pointer to associated MAC */ 195 MAC */
198 int sbdma_channel; /* channel number */ 196 int sbdma_channel; /* channel number */
199 int sbdma_txdir; /* direction (1=transmit) */ 197 int sbdma_txdir; /* direction (1=transmit) */
200 int sbdma_maxdescr; /* total # of descriptors in ring */ 198 int sbdma_maxdescr; /* total # of descriptors
199 in ring */
201#ifdef CONFIG_SBMAC_COALESCE 200#ifdef CONFIG_SBMAC_COALESCE
202 int sbdma_int_pktcnt; /* # descriptors rx/tx before interrupt*/ 201 int sbdma_int_pktcnt;
203 int sbdma_int_timeout; /* # usec rx/tx interrupt */ 202 /* # descriptors rx/tx
203 before interrupt */
204 int sbdma_int_timeout;
205 /* # usec rx/tx interrupt */
204#endif 206#endif
205 207 void __iomem *sbdma_config0; /* DMA config register 0 */
206 volatile void __iomem *sbdma_config0; /* DMA config register 0 */ 208 void __iomem *sbdma_config1; /* DMA config register 1 */
207 volatile void __iomem *sbdma_config1; /* DMA config register 1 */ 209 void __iomem *sbdma_dscrbase;
208 volatile void __iomem *sbdma_dscrbase; /* Descriptor base address */ 210 /* descriptor base address */
209 volatile void __iomem *sbdma_dscrcnt; /* Descriptor count register */ 211 void __iomem *sbdma_dscrcnt; /* descriptor count register */
210 volatile void __iomem *sbdma_curdscr; /* current descriptor address */ 212 void __iomem *sbdma_curdscr; /* current descriptor
211 volatile void __iomem *sbdma_oodpktlost;/* pkt drop (rx only) */ 213 address */
212 214 void __iomem *sbdma_oodpktlost;
215 /* pkt drop (rx only) */
213 216
214 /* 217 /*
215 * This stuff is for maintenance of the ring 218 * This stuff is for maintenance of the ring
216 */ 219 */
217 220 void *sbdma_dscrtable_unaligned;
218 sbdmadscr_t *sbdma_dscrtable_unaligned; 221 struct sbdmadscr *sbdma_dscrtable;
219 sbdmadscr_t *sbdma_dscrtable; /* base of descriptor table */ 222 /* base of descriptor table */
220 sbdmadscr_t *sbdma_dscrtable_end; /* end of descriptor table */ 223 struct sbdmadscr *sbdma_dscrtable_end;
221 224 /* end of descriptor table */
222 struct sk_buff **sbdma_ctxtable; /* context table, one per descr */ 225 struct sk_buff **sbdma_ctxtable;
223 226 /* context table, one
224 paddr_t sbdma_dscrtable_phys; /* and also the phys addr */ 227 per descr */
225 sbdmadscr_t *sbdma_addptr; /* next dscr for sw to add */ 228 dma_addr_t sbdma_dscrtable_phys;
226 sbdmadscr_t *sbdma_remptr; /* next dscr for sw to remove */ 229 /* and also the phys addr */
227} sbmacdma_t; 230 struct sbdmadscr *sbdma_addptr; /* next dscr for sw to add */
231 struct sbdmadscr *sbdma_remptr; /* next dscr for sw
232 to remove */
233};
228 234
229 235
230/********************************************************************** 236/**********************************************************************
@@ -236,47 +242,45 @@ struct sbmac_softc {
236 /* 242 /*
237 * Linux-specific things 243 * Linux-specific things
238 */ 244 */
245 struct net_device *sbm_dev; /* pointer to linux device */
246 struct napi_struct napi;
247 spinlock_t sbm_lock; /* spin lock */
248 struct timer_list sbm_timer; /* for monitoring MII */
249 int sbm_devflags; /* current device flags */
239 250
240 struct net_device *sbm_dev; /* pointer to linux device */ 251 int sbm_phy_oldbmsr;
241 struct napi_struct napi; 252 int sbm_phy_oldanlpar;
242 spinlock_t sbm_lock; /* spin lock */ 253 int sbm_phy_oldk1stsr;
243 struct timer_list sbm_timer; /* for monitoring MII */ 254 int sbm_phy_oldlinkstat;
244 int sbm_devflags; /* current device flags */ 255 int sbm_buffersize;
245
246 int sbm_phy_oldbmsr;
247 int sbm_phy_oldanlpar;
248 int sbm_phy_oldk1stsr;
249 int sbm_phy_oldlinkstat;
250 int sbm_buffersize;
251 256
252 unsigned char sbm_phys[2]; 257 unsigned char sbm_phys[2];
253 258
254 /* 259 /*
255 * Controller-specific things 260 * Controller-specific things
256 */ 261 */
262 void __iomem *sbm_base; /* MAC's base address */
263 enum sbmac_state sbm_state; /* current state */
257 264
258 void __iomem *sbm_base; /* MAC's base address */ 265 void __iomem *sbm_macenable; /* MAC Enable Register */
259 sbmac_state_t sbm_state; /* current state */ 266 void __iomem *sbm_maccfg; /* MAC Config Register */
267 void __iomem *sbm_fifocfg; /* FIFO Config Register */
268 void __iomem *sbm_framecfg; /* Frame Config Register */
269 void __iomem *sbm_rxfilter; /* Receive Filter Register */
270 void __iomem *sbm_isr; /* Interrupt Status Register */
271 void __iomem *sbm_imr; /* Interrupt Mask Register */
272 void __iomem *sbm_mdio; /* MDIO Register */
260 273
261 volatile void __iomem *sbm_macenable; /* MAC Enable Register */ 274 enum sbmac_speed sbm_speed; /* current speed */
262 volatile void __iomem *sbm_maccfg; /* MAC Configuration Register */ 275 enum sbmac_duplex sbm_duplex; /* current duplex */
263 volatile void __iomem *sbm_fifocfg; /* FIFO configuration register */ 276 enum sbmac_fc sbm_fc; /* cur. flow control setting */
264 volatile void __iomem *sbm_framecfg; /* Frame configuration register */
265 volatile void __iomem *sbm_rxfilter; /* receive filter register */
266 volatile void __iomem *sbm_isr; /* Interrupt status register */
267 volatile void __iomem *sbm_imr; /* Interrupt mask register */
268 volatile void __iomem *sbm_mdio; /* MDIO register */
269 277
270 sbmac_speed_t sbm_speed; /* current speed */ 278 unsigned char sbm_hwaddr[ETHER_ADDR_LEN];
271 sbmac_duplex_t sbm_duplex; /* current duplex */
272 sbmac_fc_t sbm_fc; /* current flow control setting */
273 279
274 unsigned char sbm_hwaddr[ETHER_ADDR_LEN]; 280 struct sbmacdma sbm_txdma; /* only channel 0 for now */
275 281 struct sbmacdma sbm_rxdma;
276 sbmacdma_t sbm_txdma; /* for now, only use channel 0 */ 282 int rx_hw_checksum;
277 sbmacdma_t sbm_rxdma; 283 int sbe_idx;
278 int rx_hw_checksum;
279 int sbe_idx;
280}; 284};
281 285
282 286
@@ -288,30 +292,31 @@ struct sbmac_softc {
288 * Prototypes 292 * Prototypes
289 ********************************************************************* */ 293 ********************************************************************* */
290 294
291static void sbdma_initctx(sbmacdma_t *d, 295static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan,
292 struct sbmac_softc *s, 296 int txrx, int maxdescr);
293 int chan, 297static void sbdma_channel_start(struct sbmacdma *d, int rxtx);
294 int txrx, 298static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *m);
295 int maxdescr); 299static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *m);
296static void sbdma_channel_start(sbmacdma_t *d, int rxtx); 300static void sbdma_emptyring(struct sbmacdma *d);
297static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *m); 301static void sbdma_fillring(struct sbmacdma *d);
298static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *m); 302static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d,
299static void sbdma_emptyring(sbmacdma_t *d); 303 int work_to_do, int poll);
300static void sbdma_fillring(sbmacdma_t *d); 304static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d,
301static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, int work_to_do, int poll); 305 int poll);
302static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll);
303static int sbmac_initctx(struct sbmac_softc *s); 306static int sbmac_initctx(struct sbmac_softc *s);
304static void sbmac_channel_start(struct sbmac_softc *s); 307static void sbmac_channel_start(struct sbmac_softc *s);
305static void sbmac_channel_stop(struct sbmac_softc *s); 308static void sbmac_channel_stop(struct sbmac_softc *s);
306static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *,sbmac_state_t); 309static enum sbmac_state sbmac_set_channel_state(struct sbmac_softc *,
307static void sbmac_promiscuous_mode(struct sbmac_softc *sc,int onoff); 310 enum sbmac_state);
311static void sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff);
308static uint64_t sbmac_addr2reg(unsigned char *ptr); 312static uint64_t sbmac_addr2reg(unsigned char *ptr);
309static irqreturn_t sbmac_intr(int irq,void *dev_instance); 313static irqreturn_t sbmac_intr(int irq, void *dev_instance);
310static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev); 314static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev);
311static void sbmac_setmulti(struct sbmac_softc *sc); 315static void sbmac_setmulti(struct sbmac_softc *sc);
312static int sbmac_init(struct net_device *dev, int idx); 316static int sbmac_init(struct net_device *dev, int idx);
313static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed); 317static int sbmac_set_speed(struct sbmac_softc *s, enum sbmac_speed speed);
314static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc_t fc); 318static int sbmac_set_duplex(struct sbmac_softc *s, enum sbmac_duplex duplex,
319 enum sbmac_fc fc);
315 320
316static int sbmac_open(struct net_device *dev); 321static int sbmac_open(struct net_device *dev);
317static void sbmac_timer(unsigned long data); 322static void sbmac_timer(unsigned long data);
@@ -321,13 +326,15 @@ static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
321static int sbmac_close(struct net_device *dev); 326static int sbmac_close(struct net_device *dev);
322static int sbmac_poll(struct napi_struct *napi, int budget); 327static int sbmac_poll(struct napi_struct *napi, int budget);
323 328
324static int sbmac_mii_poll(struct sbmac_softc *s,int noisy); 329static int sbmac_mii_poll(struct sbmac_softc *s, int noisy);
325static int sbmac_mii_probe(struct net_device *dev); 330static int sbmac_mii_probe(struct net_device *dev);
326 331
327static void sbmac_mii_sync(struct sbmac_softc *s); 332static void sbmac_mii_sync(struct sbmac_softc *s);
328static void sbmac_mii_senddata(struct sbmac_softc *s,unsigned int data, int bitcnt); 333static void sbmac_mii_senddata(struct sbmac_softc *s, unsigned int data,
329static unsigned int sbmac_mii_read(struct sbmac_softc *s,int phyaddr,int regidx); 334 int bitcnt);
330static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx, 335static unsigned int sbmac_mii_read(struct sbmac_softc *s, int phyaddr,
336 int regidx);
337static void sbmac_mii_write(struct sbmac_softc *s, int phyaddr, int regidx,
331 unsigned int regval); 338 unsigned int regval);
332 339
333 340
@@ -676,8 +683,8 @@ static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx,
676 * way. 683 * way.
677 * 684 *
678 * Input parameters: 685 * Input parameters:
679 * d - sbmacdma_t structure (DMA channel context) 686 * d - struct sbmacdma (DMA channel context)
680 * s - sbmac_softc structure (pointer to a MAC) 687 * s - struct sbmac_softc (pointer to a MAC)
681 * chan - channel number (0..1 right now) 688 * chan - channel number (0..1 right now)
682 * txrx - Identifies DMA_TX or DMA_RX for channel direction 689 * txrx - Identifies DMA_TX or DMA_RX for channel direction
683 * maxdescr - number of descriptors 690 * maxdescr - number of descriptors
@@ -686,11 +693,8 @@ static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx,
686 * nothing 693 * nothing
687 ********************************************************************* */ 694 ********************************************************************* */
688 695
689static void sbdma_initctx(sbmacdma_t *d, 696static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan,
690 struct sbmac_softc *s, 697 int txrx, int maxdescr)
691 int chan,
692 int txrx,
693 int maxdescr)
694{ 698{
695#ifdef CONFIG_SBMAC_COALESCE 699#ifdef CONFIG_SBMAC_COALESCE
696 int int_pktcnt, int_timeout; 700 int int_pktcnt, int_timeout;
@@ -757,18 +761,17 @@ static void sbdma_initctx(sbmacdma_t *d,
757 761
758 d->sbdma_maxdescr = maxdescr; 762 d->sbdma_maxdescr = maxdescr;
759 763
760 d->sbdma_dscrtable_unaligned = 764 d->sbdma_dscrtable_unaligned = kcalloc(d->sbdma_maxdescr + 1,
761 d->sbdma_dscrtable = (sbdmadscr_t *) 765 sizeof(*d->sbdma_dscrtable),
762 kmalloc((d->sbdma_maxdescr+1)*sizeof(sbdmadscr_t), GFP_KERNEL); 766 GFP_KERNEL);
763 767
764 /* 768 /*
765 * The descriptor table must be aligned to at least 16 bytes or the 769 * The descriptor table must be aligned to at least 16 bytes or the
766 * MAC will corrupt it. 770 * MAC will corrupt it.
767 */ 771 */
768 d->sbdma_dscrtable = (sbdmadscr_t *) 772 d->sbdma_dscrtable = (struct sbdmadscr *)
769 ALIGN((unsigned long)d->sbdma_dscrtable, sizeof(sbdmadscr_t)); 773 ALIGN((unsigned long)d->sbdma_dscrtable_unaligned,
770 774 sizeof(*d->sbdma_dscrtable));
771 memset(d->sbdma_dscrtable,0,d->sbdma_maxdescr*sizeof(sbdmadscr_t));
772 775
773 d->sbdma_dscrtable_end = d->sbdma_dscrtable + d->sbdma_maxdescr; 776 d->sbdma_dscrtable_end = d->sbdma_dscrtable + d->sbdma_maxdescr;
774 777
@@ -779,7 +782,7 @@ static void sbdma_initctx(sbmacdma_t *d,
779 */ 782 */
780 783
781 d->sbdma_ctxtable = kcalloc(d->sbdma_maxdescr, 784 d->sbdma_ctxtable = kcalloc(d->sbdma_maxdescr,
782 sizeof(struct sk_buff *), GFP_KERNEL); 785 sizeof(*d->sbdma_ctxtable), GFP_KERNEL);
783 786
784#ifdef CONFIG_SBMAC_COALESCE 787#ifdef CONFIG_SBMAC_COALESCE
785 /* 788 /*
@@ -816,7 +819,7 @@ static void sbdma_initctx(sbmacdma_t *d,
816 * nothing 819 * nothing
817 ********************************************************************* */ 820 ********************************************************************* */
818 821
819static void sbdma_channel_start(sbmacdma_t *d, int rxtx ) 822static void sbdma_channel_start(struct sbmacdma *d, int rxtx)
820{ 823{
821 /* 824 /*
822 * Turn on the DMA channel 825 * Turn on the DMA channel
@@ -857,7 +860,7 @@ static void sbdma_channel_start(sbmacdma_t *d, int rxtx )
857 * nothing 860 * nothing
858 ********************************************************************* */ 861 ********************************************************************* */
859 862
860static void sbdma_channel_stop(sbmacdma_t *d) 863static void sbdma_channel_stop(struct sbmacdma *d)
861{ 864{
862 /* 865 /*
863 * Turn off the DMA channel 866 * Turn off the DMA channel
@@ -906,10 +909,10 @@ static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset)
906 ********************************************************************* */ 909 ********************************************************************* */
907 910
908 911
909static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb) 912static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *sb)
910{ 913{
911 sbdmadscr_t *dsc; 914 struct sbdmadscr *dsc;
912 sbdmadscr_t *nextdsc; 915 struct sbdmadscr *nextdsc;
913 struct sk_buff *sb_new = NULL; 916 struct sk_buff *sb_new = NULL;
914 int pktsize = ENET_PACKET_SIZE; 917 int pktsize = ENET_PACKET_SIZE;
915 918
@@ -1021,10 +1024,10 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb)
1021 ********************************************************************* */ 1024 ********************************************************************* */
1022 1025
1023 1026
1024static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *sb) 1027static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *sb)
1025{ 1028{
1026 sbdmadscr_t *dsc; 1029 struct sbdmadscr *dsc;
1027 sbdmadscr_t *nextdsc; 1030 struct sbdmadscr *nextdsc;
1028 uint64_t phys; 1031 uint64_t phys;
1029 uint64_t ncb; 1032 uint64_t ncb;
1030 int length; 1033 int length;
@@ -1110,7 +1113,7 @@ static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *sb)
1110 * nothing 1113 * nothing
1111 ********************************************************************* */ 1114 ********************************************************************* */
1112 1115
1113static void sbdma_emptyring(sbmacdma_t *d) 1116static void sbdma_emptyring(struct sbmacdma *d)
1114{ 1117{
1115 int idx; 1118 int idx;
1116 struct sk_buff *sb; 1119 struct sk_buff *sb;
@@ -1138,7 +1141,7 @@ static void sbdma_emptyring(sbmacdma_t *d)
1138 * nothing 1141 * nothing
1139 ********************************************************************* */ 1142 ********************************************************************* */
1140 1143
1141static void sbdma_fillring(sbmacdma_t *d) 1144static void sbdma_fillring(struct sbmacdma *d)
1142{ 1145{
1143 int idx; 1146 int idx;
1144 1147
@@ -1185,13 +1188,13 @@ static void sbmac_netpoll(struct net_device *netdev)
1185 * nothing 1188 * nothing
1186 ********************************************************************* */ 1189 ********************************************************************* */
1187 1190
1188static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, 1191static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d,
1189 int work_to_do, int poll) 1192 int work_to_do, int poll)
1190{ 1193{
1191 struct net_device *dev = sc->sbm_dev; 1194 struct net_device *dev = sc->sbm_dev;
1192 int curidx; 1195 int curidx;
1193 int hwidx; 1196 int hwidx;
1194 sbdmadscr_t *dsc; 1197 struct sbdmadscr *dsc;
1195 struct sk_buff *sb; 1198 struct sk_buff *sb;
1196 int len; 1199 int len;
1197 int work_done = 0; 1200 int work_done = 0;
@@ -1223,8 +1226,9 @@ again:
1223 prefetch(dsc); 1226 prefetch(dsc);
1224 prefetch(&d->sbdma_ctxtable[curidx]); 1227 prefetch(&d->sbdma_ctxtable[curidx]);
1225 1228
1226 hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - 1229 hwidx = ((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -
1227 d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); 1230 d->sbdma_dscrtable_phys) /
1231 sizeof(*d->sbdma_dscrtable);
1228 1232
1229 /* 1233 /*
1230 * If they're the same, that means we've processed all 1234 * If they're the same, that means we've processed all
@@ -1348,12 +1352,13 @@ done:
1348 * nothing 1352 * nothing
1349 ********************************************************************* */ 1353 ********************************************************************* */
1350 1354
1351static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll) 1355static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d,
1356 int poll)
1352{ 1357{
1353 struct net_device *dev = sc->sbm_dev; 1358 struct net_device *dev = sc->sbm_dev;
1354 int curidx; 1359 int curidx;
1355 int hwidx; 1360 int hwidx;
1356 sbdmadscr_t *dsc; 1361 struct sbdmadscr *dsc;
1357 struct sk_buff *sb; 1362 struct sk_buff *sb;
1358 unsigned long flags; 1363 unsigned long flags;
1359 int packets_handled = 0; 1364 int packets_handled = 0;
@@ -1363,8 +1368,8 @@ static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll)
1363 if (d->sbdma_remptr == d->sbdma_addptr) 1368 if (d->sbdma_remptr == d->sbdma_addptr)
1364 goto end_unlock; 1369 goto end_unlock;
1365 1370
1366 hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - 1371 hwidx = ((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -
1367 d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); 1372 d->sbdma_dscrtable_phys) / sizeof(*d->sbdma_dscrtable);
1368 1373
1369 for (;;) { 1374 for (;;) {
1370 /* 1375 /*
@@ -1501,7 +1506,7 @@ static int sbmac_initctx(struct sbmac_softc *s)
1501} 1506}
1502 1507
1503 1508
1504static void sbdma_uninitctx(struct sbmacdma_s *d) 1509static void sbdma_uninitctx(struct sbmacdma *d)
1505{ 1510{
1506 if (d->sbdma_dscrtable_unaligned) { 1511 if (d->sbdma_dscrtable_unaligned) {
1507 kfree(d->sbdma_dscrtable_unaligned); 1512 kfree(d->sbdma_dscrtable_unaligned);
@@ -1537,7 +1542,7 @@ static void sbmac_uninitctx(struct sbmac_softc *sc)
1537static void sbmac_channel_start(struct sbmac_softc *s) 1542static void sbmac_channel_start(struct sbmac_softc *s)
1538{ 1543{
1539 uint64_t reg; 1544 uint64_t reg;
1540 volatile void __iomem *port; 1545 void __iomem *port;
1541 uint64_t cfg,fifo,framecfg; 1546 uint64_t cfg,fifo,framecfg;
1542 int idx, th_value; 1547 int idx, th_value;
1543 1548
@@ -1800,10 +1805,10 @@ static void sbmac_channel_stop(struct sbmac_softc *s)
1800 * Return value: 1805 * Return value:
1801 * old state 1806 * old state
1802 ********************************************************************* */ 1807 ********************************************************************* */
1803static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *sc, 1808static enum sbmac_state sbmac_set_channel_state(struct sbmac_softc *sc,
1804 sbmac_state_t state) 1809 enum sbmac_state state)
1805{ 1810{
1806 sbmac_state_t oldstate = sc->sbm_state; 1811 enum sbmac_state oldstate = sc->sbm_state;
1807 1812
1808 /* 1813 /*
1809 * If same as previous state, return 1814 * If same as previous state, return
@@ -1938,14 +1943,14 @@ static uint64_t sbmac_addr2reg(unsigned char *ptr)
1938 * 1943 *
1939 * Input parameters: 1944 * Input parameters:
1940 * s - sbmac structure 1945 * s - sbmac structure
1941 * speed - speed to set MAC to (see sbmac_speed_t enum) 1946 * speed - speed to set MAC to (see enum sbmac_speed)
1942 * 1947 *
1943 * Return value: 1948 * Return value:
1944 * 1 if successful 1949 * 1 if successful
1945 * 0 indicates invalid parameters 1950 * 0 indicates invalid parameters
1946 ********************************************************************* */ 1951 ********************************************************************* */
1947 1952
1948static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed) 1953static int sbmac_set_speed(struct sbmac_softc *s, enum sbmac_speed speed)
1949{ 1954{
1950 uint64_t cfg; 1955 uint64_t cfg;
1951 uint64_t framecfg; 1956 uint64_t framecfg;
@@ -2027,15 +2032,16 @@ static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed)
2027 * 2032 *
2028 * Input parameters: 2033 * Input parameters:
2029 * s - sbmac structure 2034 * s - sbmac structure
2030 * duplex - duplex setting (see sbmac_duplex_t) 2035 * duplex - duplex setting (see enum sbmac_duplex)
2031 * fc - flow control setting (see sbmac_fc_t) 2036 * fc - flow control setting (see enum sbmac_fc)
2032 * 2037 *
2033 * Return value: 2038 * Return value:
2034 * 1 if ok 2039 * 1 if ok
2035 * 0 if an invalid parameter combination was specified 2040 * 0 if an invalid parameter combination was specified
2036 ********************************************************************* */ 2041 ********************************************************************* */
2037 2042
2038static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc_t fc) 2043static int sbmac_set_duplex(struct sbmac_softc *s, enum sbmac_duplex duplex,
2044 enum sbmac_fc fc)
2039{ 2045{
2040 uint64_t cfg; 2046 uint64_t cfg;
2041 2047
@@ -2228,7 +2234,7 @@ static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev)
2228static void sbmac_setmulti(struct sbmac_softc *sc) 2234static void sbmac_setmulti(struct sbmac_softc *sc)
2229{ 2235{
2230 uint64_t reg; 2236 uint64_t reg;
2231 volatile void __iomem *port; 2237 void __iomem *port;
2232 int idx; 2238 int idx;
2233 struct dev_mc_list *mclist; 2239 struct dev_mc_list *mclist;
2234 struct net_device *dev = sc->sbm_dev; 2240 struct net_device *dev = sc->sbm_dev;