Commit 73d73969 authored by Maciej W. Rozycki's avatar Maciej W. Rozycki Committed by David S. Miller

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: default avatarMaciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent ac1d49f8
...@@ -140,17 +140,17 @@ MODULE_PARM_DESC(int_timeout_rx, "RX timeout value"); ...@@ -140,17 +140,17 @@ MODULE_PARM_DESC(int_timeout_rx, "RX timeout value");
********************************************************************* */ ********************************************************************* */
typedef enum { sbmac_speed_auto, sbmac_speed_10, enum sbmac_speed { sbmac_speed_auto, sbmac_speed_10,
sbmac_speed_100, sbmac_speed_1000 } sbmac_speed_t; sbmac_speed_100, sbmac_speed_1000 };
typedef enum { sbmac_duplex_auto, sbmac_duplex_half, enum sbmac_duplex { sbmac_duplex_auto, sbmac_duplex_half,
sbmac_duplex_full } sbmac_duplex_t; sbmac_duplex_full };
typedef enum { sbmac_fc_auto, sbmac_fc_disabled, sbmac_fc_frame, enum sbmac_fc { sbmac_fc_auto, sbmac_fc_disabled, sbmac_fc_frame,
sbmac_fc_collision, sbmac_fc_carrier } sbmac_fc_t; sbmac_fc_collision, sbmac_fc_carrier } sbmac_fc_t;
typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on, enum sbmac_state { sbmac_state_uninit, sbmac_state_off, sbmac_state_on,
sbmac_state_broken } sbmac_state_t; sbmac_state_broken };
/********************************************************************** /**********************************************************************
...@@ -176,55 +176,61 @@ typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on, ...@@ -176,55 +176,61 @@ typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on,
* DMA Descriptor structure * DMA Descriptor structure
********************************************************************* */ ********************************************************************* */
typedef struct sbdmadscr_s { struct sbdmadscr {
uint64_t dscr_a; uint64_t dscr_a;
uint64_t dscr_b; uint64_t dscr_b;
} sbdmadscr_t; };
typedef unsigned long paddr_t;
/********************************************************************** /**********************************************************************
* DMA Controller structure * DMA Controller structure
********************************************************************* */ ********************************************************************* */
typedef struct sbmacdma_s { struct sbmacdma {
/* /*
* This stuff is used to identify the channel and the registers * This stuff is used to identify the channel and the registers
* associated with it. * associated with it.
*/ */
struct sbmac_softc *sbdma_eth; /* back pointer to associated
struct sbmac_softc *sbdma_eth; /* back pointer to associated MAC */ MAC */
int sbdma_channel; /* channel number */ int sbdma_channel; /* channel number */
int sbdma_txdir; /* direction (1=transmit) */ int sbdma_txdir; /* direction (1=transmit) */
int sbdma_maxdescr; /* total # of descriptors in ring */ int sbdma_maxdescr; /* total # of descriptors
in ring */
#ifdef CONFIG_SBMAC_COALESCE #ifdef CONFIG_SBMAC_COALESCE
int sbdma_int_pktcnt; /* # descriptors rx/tx before interrupt*/ int sbdma_int_pktcnt;
int sbdma_int_timeout; /* # usec rx/tx interrupt */ /* # descriptors rx/tx
before interrupt */
int sbdma_int_timeout;
/* # usec rx/tx interrupt */
#endif #endif
void __iomem *sbdma_config0; /* DMA config register 0 */
volatile void __iomem *sbdma_config0; /* DMA config register 0 */ void __iomem *sbdma_config1; /* DMA config register 1 */
volatile void __iomem *sbdma_config1; /* DMA config register 1 */ void __iomem *sbdma_dscrbase;
volatile void __iomem *sbdma_dscrbase; /* Descriptor base address */ /* descriptor base address */
volatile void __iomem *sbdma_dscrcnt; /* Descriptor count register */ void __iomem *sbdma_dscrcnt; /* descriptor count register */
volatile void __iomem *sbdma_curdscr; /* current descriptor address */ void __iomem *sbdma_curdscr; /* current descriptor
volatile void __iomem *sbdma_oodpktlost;/* pkt drop (rx only) */ address */
void __iomem *sbdma_oodpktlost;
/* pkt drop (rx only) */
/* /*
* This stuff is for maintenance of the ring * This stuff is for maintenance of the ring
*/ */
void *sbdma_dscrtable_unaligned;
sbdmadscr_t *sbdma_dscrtable_unaligned; struct sbdmadscr *sbdma_dscrtable;
sbdmadscr_t *sbdma_dscrtable; /* base of descriptor table */ /* base of descriptor table */
sbdmadscr_t *sbdma_dscrtable_end; /* end of descriptor table */ struct sbdmadscr *sbdma_dscrtable_end;
/* end of descriptor table */
struct sk_buff **sbdma_ctxtable; /* context table, one per descr */ struct sk_buff **sbdma_ctxtable;
/* context table, one
paddr_t sbdma_dscrtable_phys; /* and also the phys addr */ per descr */
sbdmadscr_t *sbdma_addptr; /* next dscr for sw to add */ dma_addr_t sbdma_dscrtable_phys;
sbdmadscr_t *sbdma_remptr; /* next dscr for sw to remove */ /* and also the phys addr */
} sbmacdma_t; struct sbdmadscr *sbdma_addptr; /* next dscr for sw to add */
struct sbdmadscr *sbdma_remptr; /* next dscr for sw
to remove */
};
/********************************************************************** /**********************************************************************
...@@ -236,47 +242,45 @@ struct sbmac_softc { ...@@ -236,47 +242,45 @@ struct sbmac_softc {
/* /*
* Linux-specific things * Linux-specific things
*/ */
struct net_device *sbm_dev; /* pointer to linux device */
struct napi_struct napi;
spinlock_t sbm_lock; /* spin lock */
struct timer_list sbm_timer; /* for monitoring MII */
int sbm_devflags; /* current device flags */
struct net_device *sbm_dev; /* pointer to linux device */ int sbm_phy_oldbmsr;
struct napi_struct napi; int sbm_phy_oldanlpar;
spinlock_t sbm_lock; /* spin lock */ int sbm_phy_oldk1stsr;
struct timer_list sbm_timer; /* for monitoring MII */ int sbm_phy_oldlinkstat;
int sbm_devflags; /* current device flags */ int sbm_buffersize;
int sbm_phy_oldbmsr;
int sbm_phy_oldanlpar;
int sbm_phy_oldk1stsr;
int sbm_phy_oldlinkstat;
int sbm_buffersize;
unsigned char sbm_phys[2]; unsigned char sbm_phys[2];
/* /*
* Controller-specific things * Controller-specific things
*/ */
void __iomem *sbm_base; /* MAC's base address */
enum sbmac_state sbm_state; /* current state */
void __iomem *sbm_base; /* MAC's base address */ void __iomem *sbm_macenable; /* MAC Enable Register */
sbmac_state_t sbm_state; /* current state */ void __iomem *sbm_maccfg; /* MAC Config Register */
void __iomem *sbm_fifocfg; /* FIFO Config Register */
void __iomem *sbm_framecfg; /* Frame Config Register */
void __iomem *sbm_rxfilter; /* Receive Filter Register */
void __iomem *sbm_isr; /* Interrupt Status Register */
void __iomem *sbm_imr; /* Interrupt Mask Register */
void __iomem *sbm_mdio; /* MDIO Register */
volatile void __iomem *sbm_macenable; /* MAC Enable Register */ enum sbmac_speed sbm_speed; /* current speed */
volatile void __iomem *sbm_maccfg; /* MAC Configuration Register */ enum sbmac_duplex sbm_duplex; /* current duplex */
volatile void __iomem *sbm_fifocfg; /* FIFO configuration register */ enum sbmac_fc sbm_fc; /* cur. flow control setting */
volatile void __iomem *sbm_framecfg; /* Frame configuration register */
volatile void __iomem *sbm_rxfilter; /* receive filter register */
volatile void __iomem *sbm_isr; /* Interrupt status register */
volatile void __iomem *sbm_imr; /* Interrupt mask register */
volatile void __iomem *sbm_mdio; /* MDIO register */
sbmac_speed_t sbm_speed; /* current speed */ unsigned char sbm_hwaddr[ETHER_ADDR_LEN];
sbmac_duplex_t sbm_duplex; /* current duplex */
sbmac_fc_t sbm_fc; /* current flow control setting */
unsigned char sbm_hwaddr[ETHER_ADDR_LEN]; struct sbmacdma sbm_txdma; /* only channel 0 for now */
struct sbmacdma sbm_rxdma;
sbmacdma_t sbm_txdma; /* for now, only use channel 0 */ int rx_hw_checksum;
sbmacdma_t sbm_rxdma; int sbe_idx;
int rx_hw_checksum;
int sbe_idx;
}; };
...@@ -288,30 +292,31 @@ struct sbmac_softc { ...@@ -288,30 +292,31 @@ struct sbmac_softc {
* Prototypes * Prototypes
********************************************************************* */ ********************************************************************* */
static void sbdma_initctx(sbmacdma_t *d, static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan,
struct sbmac_softc *s, int txrx, int maxdescr);
int chan, static void sbdma_channel_start(struct sbmacdma *d, int rxtx);
int txrx, static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *m);
int maxdescr); static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *m);
static void sbdma_channel_start(sbmacdma_t *d, int rxtx); static void sbdma_emptyring(struct sbmacdma *d);
static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *m); static void sbdma_fillring(struct sbmacdma *d);
static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *m); static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d,
static void sbdma_emptyring(sbmacdma_t *d); int work_to_do, int poll);
static void sbdma_fillring(sbmacdma_t *d); static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d,
static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, int work_to_do, int poll); int poll);
static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll);
static int sbmac_initctx(struct sbmac_softc *s); static int sbmac_initctx(struct sbmac_softc *s);
static void sbmac_channel_start(struct sbmac_softc *s); static void sbmac_channel_start(struct sbmac_softc *s);
static void sbmac_channel_stop(struct sbmac_softc *s); static void sbmac_channel_stop(struct sbmac_softc *s);
static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *,sbmac_state_t); static enum sbmac_state sbmac_set_channel_state(struct sbmac_softc *,
static void sbmac_promiscuous_mode(struct sbmac_softc *sc,int onoff); enum sbmac_state);
static void sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff);
static uint64_t sbmac_addr2reg(unsigned char *ptr); static uint64_t sbmac_addr2reg(unsigned char *ptr);
static irqreturn_t sbmac_intr(int irq,void *dev_instance); static irqreturn_t sbmac_intr(int irq, void *dev_instance);
static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev); static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev);
static void sbmac_setmulti(struct sbmac_softc *sc); static void sbmac_setmulti(struct sbmac_softc *sc);
static int sbmac_init(struct net_device *dev, int idx); static int sbmac_init(struct net_device *dev, int idx);
static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed); static int sbmac_set_speed(struct sbmac_softc *s, enum sbmac_speed speed);
static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc_t fc); static int sbmac_set_duplex(struct sbmac_softc *s, enum sbmac_duplex duplex,
enum sbmac_fc fc);
static int sbmac_open(struct net_device *dev); static int sbmac_open(struct net_device *dev);
static void sbmac_timer(unsigned long data); static void sbmac_timer(unsigned long data);
...@@ -321,13 +326,15 @@ static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); ...@@ -321,13 +326,15 @@ static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static int sbmac_close(struct net_device *dev); static int sbmac_close(struct net_device *dev);
static int sbmac_poll(struct napi_struct *napi, int budget); static int sbmac_poll(struct napi_struct *napi, int budget);
static int sbmac_mii_poll(struct sbmac_softc *s,int noisy); static int sbmac_mii_poll(struct sbmac_softc *s, int noisy);
static int sbmac_mii_probe(struct net_device *dev); static int sbmac_mii_probe(struct net_device *dev);
static void sbmac_mii_sync(struct sbmac_softc *s); static void sbmac_mii_sync(struct sbmac_softc *s);
static void sbmac_mii_senddata(struct sbmac_softc *s,unsigned int data, int bitcnt); static void sbmac_mii_senddata(struct sbmac_softc *s, unsigned int data,
static unsigned int sbmac_mii_read(struct sbmac_softc *s,int phyaddr,int regidx); int bitcnt);
static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx, static unsigned int sbmac_mii_read(struct sbmac_softc *s, int phyaddr,
int regidx);
static void sbmac_mii_write(struct sbmac_softc *s, int phyaddr, int regidx,
unsigned int regval); unsigned int regval);
...@@ -676,8 +683,8 @@ static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx, ...@@ -676,8 +683,8 @@ static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx,
* way. * way.
* *
* Input parameters: * Input parameters:
* d - sbmacdma_t structure (DMA channel context) * d - struct sbmacdma (DMA channel context)
* s - sbmac_softc structure (pointer to a MAC) * s - struct sbmac_softc (pointer to a MAC)
* chan - channel number (0..1 right now) * chan - channel number (0..1 right now)
* txrx - Identifies DMA_TX or DMA_RX for channel direction * txrx - Identifies DMA_TX or DMA_RX for channel direction
* maxdescr - number of descriptors * maxdescr - number of descriptors
...@@ -686,11 +693,8 @@ static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx, ...@@ -686,11 +693,8 @@ static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx,
* nothing * nothing
********************************************************************* */ ********************************************************************* */
static void sbdma_initctx(sbmacdma_t *d, static void sbdma_initctx(struct sbmacdma *d, struct sbmac_softc *s, int chan,
struct sbmac_softc *s, int txrx, int maxdescr)
int chan,
int txrx,
int maxdescr)
{ {
#ifdef CONFIG_SBMAC_COALESCE #ifdef CONFIG_SBMAC_COALESCE
int int_pktcnt, int_timeout; int int_pktcnt, int_timeout;
...@@ -757,18 +761,17 @@ static void sbdma_initctx(sbmacdma_t *d, ...@@ -757,18 +761,17 @@ static void sbdma_initctx(sbmacdma_t *d,
d->sbdma_maxdescr = maxdescr; d->sbdma_maxdescr = maxdescr;
d->sbdma_dscrtable_unaligned = d->sbdma_dscrtable_unaligned = kcalloc(d->sbdma_maxdescr + 1,
d->sbdma_dscrtable = (sbdmadscr_t *) sizeof(*d->sbdma_dscrtable),
kmalloc((d->sbdma_maxdescr+1)*sizeof(sbdmadscr_t), GFP_KERNEL); GFP_KERNEL);
/* /*
* The descriptor table must be aligned to at least 16 bytes or the * The descriptor table must be aligned to at least 16 bytes or the
* MAC will corrupt it. * MAC will corrupt it.
*/ */
d->sbdma_dscrtable = (sbdmadscr_t *) d->sbdma_dscrtable = (struct sbdmadscr *)
ALIGN((unsigned long)d->sbdma_dscrtable, sizeof(sbdmadscr_t)); ALIGN((unsigned long)d->sbdma_dscrtable_unaligned,
sizeof(*d->sbdma_dscrtable));
memset(d->sbdma_dscrtable,0,d->sbdma_maxdescr*sizeof(sbdmadscr_t));
d->sbdma_dscrtable_end = d->sbdma_dscrtable + d->sbdma_maxdescr; d->sbdma_dscrtable_end = d->sbdma_dscrtable + d->sbdma_maxdescr;
...@@ -779,7 +782,7 @@ static void sbdma_initctx(sbmacdma_t *d, ...@@ -779,7 +782,7 @@ static void sbdma_initctx(sbmacdma_t *d,
*/ */
d->sbdma_ctxtable = kcalloc(d->sbdma_maxdescr, d->sbdma_ctxtable = kcalloc(d->sbdma_maxdescr,
sizeof(struct sk_buff *), GFP_KERNEL); sizeof(*d->sbdma_ctxtable), GFP_KERNEL);
#ifdef CONFIG_SBMAC_COALESCE #ifdef CONFIG_SBMAC_COALESCE
/* /*
...@@ -816,7 +819,7 @@ static void sbdma_initctx(sbmacdma_t *d, ...@@ -816,7 +819,7 @@ static void sbdma_initctx(sbmacdma_t *d,
* nothing * nothing
********************************************************************* */ ********************************************************************* */
static void sbdma_channel_start(sbmacdma_t *d, int rxtx ) static void sbdma_channel_start(struct sbmacdma *d, int rxtx)
{ {
/* /*
* Turn on the DMA channel * Turn on the DMA channel
...@@ -857,7 +860,7 @@ static void sbdma_channel_start(sbmacdma_t *d, int rxtx ) ...@@ -857,7 +860,7 @@ static void sbdma_channel_start(sbmacdma_t *d, int rxtx )
* nothing * nothing
********************************************************************* */ ********************************************************************* */
static void sbdma_channel_stop(sbmacdma_t *d) static void sbdma_channel_stop(struct sbmacdma *d)
{ {
/* /*
* Turn off the DMA channel * Turn off the DMA channel
...@@ -906,10 +909,10 @@ static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset) ...@@ -906,10 +909,10 @@ static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset)
********************************************************************* */ ********************************************************************* */
static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb) static int sbdma_add_rcvbuffer(struct sbmacdma *d, struct sk_buff *sb)
{ {
sbdmadscr_t *dsc; struct sbdmadscr *dsc;
sbdmadscr_t *nextdsc; struct sbdmadscr *nextdsc;
struct sk_buff *sb_new = NULL; struct sk_buff *sb_new = NULL;
int pktsize = ENET_PACKET_SIZE; int pktsize = ENET_PACKET_SIZE;
...@@ -1021,10 +1024,10 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb) ...@@ -1021,10 +1024,10 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb)
********************************************************************* */ ********************************************************************* */
static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *sb) static int sbdma_add_txbuffer(struct sbmacdma *d, struct sk_buff *sb)
{ {
sbdmadscr_t *dsc; struct sbdmadscr *dsc;
sbdmadscr_t *nextdsc; struct sbdmadscr *nextdsc;
uint64_t phys; uint64_t phys;
uint64_t ncb; uint64_t ncb;
int length; int length;
...@@ -1110,7 +1113,7 @@ static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *sb) ...@@ -1110,7 +1113,7 @@ static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *sb)
* nothing * nothing
********************************************************************* */ ********************************************************************* */
static void sbdma_emptyring(sbmacdma_t *d) static void sbdma_emptyring(struct sbmacdma *d)
{ {
int idx; int idx;
struct sk_buff *sb; struct sk_buff *sb;
...@@ -1138,7 +1141,7 @@ static void sbdma_emptyring(sbmacdma_t *d) ...@@ -1138,7 +1141,7 @@ static void sbdma_emptyring(sbmacdma_t *d)
* nothing * nothing
********************************************************************* */ ********************************************************************* */
static void sbdma_fillring(sbmacdma_t *d) static void sbdma_fillring(struct sbmacdma *d)
{ {
int idx; int idx;
...@@ -1185,13 +1188,13 @@ static void sbmac_netpoll(struct net_device *netdev) ...@@ -1185,13 +1188,13 @@ static void sbmac_netpoll(struct net_device *netdev)
* nothing * nothing
********************************************************************* */ ********************************************************************* */
static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d,
int work_to_do, int poll) int work_to_do, int poll)
{ {
struct net_device *dev = sc->sbm_dev; struct net_device *dev = sc->sbm_dev;
int curidx; int curidx;
int hwidx; int hwidx;
sbdmadscr_t *dsc; struct sbdmadscr *dsc;
struct sk_buff *sb; struct sk_buff *sb;
int len; int len;
int work_done = 0; int work_done = 0;
...@@ -1223,8 +1226,9 @@ static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, ...@@ -1223,8 +1226,9 @@ static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d,
prefetch(dsc); prefetch(dsc);
prefetch(&d->sbdma_ctxtable[curidx]); prefetch(&d->sbdma_ctxtable[curidx]);
hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - hwidx = ((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -
d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); d->sbdma_dscrtable_phys) /
sizeof(*d->sbdma_dscrtable);
/* /*
* If they're the same, that means we've processed all * If they're the same, that means we've processed all
...@@ -1348,12 +1352,13 @@ static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d, ...@@ -1348,12 +1352,13 @@ static int sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d,
* nothing * nothing
********************************************************************* */ ********************************************************************* */
static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll) static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d,
int poll)
{ {
struct net_device *dev = sc->sbm_dev; struct net_device *dev = sc->sbm_dev;
int curidx; int curidx;
int hwidx; int hwidx;
sbdmadscr_t *dsc; struct sbdmadscr *dsc;
struct sk_buff *sb; struct sk_buff *sb;
unsigned long flags; unsigned long flags;
int packets_handled = 0; int packets_handled = 0;
...@@ -1363,8 +1368,8 @@ static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll) ...@@ -1363,8 +1368,8 @@ static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d, int poll)
if (d->sbdma_remptr == d->sbdma_addptr) if (d->sbdma_remptr == d->sbdma_addptr)
goto end_unlock; goto end_unlock;
hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - hwidx = ((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -
d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); d->sbdma_dscrtable_phys) / sizeof(*d->sbdma_dscrtable);
for (;;) { for (;;) {
/* /*
...@@ -1501,7 +1506,7 @@ static int sbmac_initctx(struct sbmac_softc *s) ...@@ -1501,7 +1506,7 @@ static int sbmac_initctx(struct sbmac_softc *s)
} }
static void sbdma_uninitctx(struct sbmacdma_s *d) static void sbdma_uninitctx(struct sbmacdma *d)
{ {
if (d->sbdma_dscrtable_unaligned) { if (d->sbdma_dscrtable_unaligned) {
kfree(d->sbdma_dscrtable_unaligned); kfree(d->sbdma_dscrtable_unaligned);
...@@ -1537,7 +1542,7 @@ static void sbmac_uninitctx(struct sbmac_softc *sc) ...@@ -1537,7 +1542,7 @@ static void sbmac_uninitctx(struct sbmac_softc *sc)
static void sbmac_channel_start(struct sbmac_softc *s) static void sbmac_channel_start(struct sbmac_softc *s)
{ {
uint64_t reg; uint64_t reg;
volatile void __iomem *port; void __iomem *port;
uint64_t cfg,fifo,framecfg; uint64_t cfg,fifo,framecfg;
int idx, th_value; int idx, th_value;
...@@ -1800,10 +1805,10 @@ static void sbmac_channel_stop(struct sbmac_softc *s) ...@@ -1800,10 +1805,10 @@ static void sbmac_channel_stop(struct sbmac_softc *s)
* Return value: * Return value:
* old state * old state
********************************************************************* */ ********************************************************************* */
static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *sc, static enum sbmac_state sbmac_set_channel_state(struct sbmac_softc *sc,
sbmac_state_t state) enum sbmac_state state)
{ {
sbmac_state_t oldstate = sc->sbm_state; enum sbmac_state oldstate = sc->sbm_state;
/* /*
* If same as previous state, return * If same as previous state, return
...@@ -1938,14 +1943,14 @@ static uint64_t sbmac_addr2reg(unsigned char *ptr) ...@@ -1938,14 +1943,14 @@ static uint64_t sbmac_addr2reg(unsigned char *ptr)
* *
* Input parameters: * Input parameters:
* s - sbmac structure * s - sbmac structure
* speed - speed to set MAC to (see sbmac_speed_t enum) * speed - speed to set MAC to (see enum sbmac_speed)
* *
* Return value: * Return value:
* 1 if successful * 1 if successful
* 0 indicates invalid parameters * 0 indicates invalid parameters
********************************************************************* */ ********************************************************************* */
static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed) static int sbmac_set_speed(struct sbmac_softc *s, enum sbmac_speed speed)
{ {
uint64_t cfg; uint64_t cfg;
uint64_t framecfg; uint64_t framecfg;
...@@ -2027,15 +2032,16 @@ static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed) ...@@ -2027,15 +2032,16 @@ static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed)
* *
* Input parameters: * Input parameters:
* s - sbmac structure * s - sbmac structure
* duplex - duplex setting (see sbmac_duplex_t) * duplex - duplex setting (see enum sbmac_duplex)
* fc - flow control setting (see sbmac_fc_t) * fc - flow control setting (see enum sbmac_fc)
* *
* Return value: * Return value:
* 1 if ok * 1 if ok
* 0 if an invalid parameter combination was specified * 0 if an invalid parameter combination was specified
********************************************************************* */ ********************************************************************* */
static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc_t fc) static int sbmac_set_duplex(struct sbmac_softc *s, enum sbmac_duplex duplex,
enum sbmac_fc fc)
{ {
uint64_t cfg; uint64_t cfg;
...@@ -2228,7 +2234,7 @@ static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -2228,7 +2234,7 @@ static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev)
static void sbmac_setmulti(struct sbmac_softc *sc) static void sbmac_setmulti(struct sbmac_softc *sc)
{ {
uint64_t reg; uint64_t reg;
volatile void __iomem *port; void __iomem *port;
int idx; int idx;
struct dev_mc_list *mclist; struct dev_mc_list *mclist;
struct net_device *dev = sc->sbm_dev; struct net_device *dev = sc->sbm_dev;
......
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