64
64
#include <asm/mach-rc32434/eth.h>
65
65
#include <asm/mach-rc32434/dma_v.h>
66
66
67
- #define DRV_NAME "korina"
68
- #define DRV_VERSION "0.10"
69
- #define DRV_RELDATE "04Mar2008"
67
+ #define DRV_NAME "korina"
68
+ #define DRV_VERSION "0.10"
69
+ #define DRV_RELDATE "04Mar2008"
70
70
71
71
#define STATION_ADDRESS_HIGH (dev ) (((dev)->dev_addr[0] << 8) | \
72
72
((dev)->dev_addr[1]))
75
75
((dev)->dev_addr[4] << 8) | \
76
76
((dev)->dev_addr[5]))
77
77
78
- #define MII_CLOCK 1250000 /* no more than 2.5MHz */
78
+ #define MII_CLOCK 1250000 /* no more than 2.5MHz */
79
79
80
80
/* the following must be powers of two */
81
81
#define KORINA_NUM_RDS 64 /* number of receive descriptors */
87
87
#define KORINA_RBSIZE 1536 /* size of one resource buffer = Ether MTU */
88
88
#define KORINA_RDS_MASK (KORINA_NUM_RDS - 1)
89
89
#define KORINA_TDS_MASK (KORINA_NUM_TDS - 1)
90
- #define RD_RING_SIZE (KORINA_NUM_RDS * sizeof(struct dma_desc))
90
+ #define RD_RING_SIZE (KORINA_NUM_RDS * sizeof(struct dma_desc))
91
91
#define TD_RING_SIZE (KORINA_NUM_TDS * sizeof(struct dma_desc))
92
92
93
- #define TX_TIMEOUT (6000 * HZ / 1000)
93
+ #define TX_TIMEOUT (6000 * HZ / 1000)
94
94
95
- enum chain_status { desc_filled , desc_empty };
96
- #define IS_DMA_FINISHED (X ) (((X) & (DMA_DESC_FINI)) != 0)
97
- #define IS_DMA_DONE (X ) (((X) & (DMA_DESC_DONE)) != 0)
98
- #define RCVPKT_LENGTH (X ) (((X) & ETH_RX_LEN) >> ETH_RX_LEN_BIT)
95
+ enum chain_status {
96
+ desc_filled ,
97
+ desc_empty
98
+ };
99
+
100
+ #define IS_DMA_FINISHED (X ) (((X) & (DMA_DESC_FINI)) != 0)
101
+ #define IS_DMA_DONE (X ) (((X) & (DMA_DESC_DONE)) != 0)
102
+ #define RCVPKT_LENGTH (X ) (((X) & ETH_RX_LEN) >> ETH_RX_LEN_BIT)
99
103
100
104
/* Information that need to be kept for each board. */
101
105
struct korina_private {
@@ -123,7 +127,7 @@ struct korina_private {
123
127
int rx_irq ;
124
128
int tx_irq ;
125
129
126
- spinlock_t lock ; /* NIC xmit lock */
130
+ spinlock_t lock ; /* NIC xmit lock */
127
131
128
132
int dma_halt_cnt ;
129
133
int dma_run_cnt ;
@@ -146,17 +150,17 @@ static inline void korina_start_dma(struct dma_reg *ch, u32 dma_addr)
146
150
static inline void korina_abort_dma (struct net_device * dev ,
147
151
struct dma_reg * ch )
148
152
{
149
- if (readl (& ch -> dmac ) & DMA_CHAN_RUN_BIT ) {
150
- writel (0x10 , & ch -> dmac );
153
+ if (readl (& ch -> dmac ) & DMA_CHAN_RUN_BIT ) {
154
+ writel (0x10 , & ch -> dmac );
151
155
152
- while (!(readl (& ch -> dmas ) & DMA_STAT_HALT ))
153
- netif_trans_update (dev );
156
+ while (!(readl (& ch -> dmas ) & DMA_STAT_HALT ))
157
+ netif_trans_update (dev );
154
158
155
- writel (0 , & ch -> dmas );
156
- }
159
+ writel (0 , & ch -> dmas );
160
+ }
157
161
158
- writel (0 , & ch -> dmadptr );
159
- writel (0 , & ch -> dmandptr );
162
+ writel (0 , & ch -> dmadptr );
163
+ writel (0 , & ch -> dmandptr );
160
164
}
161
165
162
166
static inline void korina_chain_dma (struct dma_reg * ch , u32 dma_addr )
@@ -685,7 +689,7 @@ static int korina_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
685
689
686
690
/* ethtool helpers */
687
691
static void netdev_get_drvinfo (struct net_device * dev ,
688
- struct ethtool_drvinfo * info )
692
+ struct ethtool_drvinfo * info )
689
693
{
690
694
struct korina_private * lp = netdev_priv (dev );
691
695
@@ -728,10 +732,10 @@ static u32 netdev_get_link(struct net_device *dev)
728
732
}
729
733
730
734
static const struct ethtool_ops netdev_ethtool_ops = {
731
- .get_drvinfo = netdev_get_drvinfo ,
732
- .get_link = netdev_get_link ,
733
- .get_link_ksettings = netdev_get_link_ksettings ,
734
- .set_link_ksettings = netdev_set_link_ksettings ,
735
+ .get_drvinfo = netdev_get_drvinfo ,
736
+ .get_link = netdev_get_link ,
737
+ .get_link_ksettings = netdev_get_link_ksettings ,
738
+ .set_link_ksettings = netdev_set_link_ksettings ,
735
739
};
736
740
737
741
static int korina_alloc_ring (struct net_device * dev )
@@ -863,7 +867,7 @@ static int korina_init(struct net_device *dev)
863
867
/* Management Clock Prescaler Divisor
864
868
* Clock independent setting */
865
869
writel (((idt_cpu_freq ) / MII_CLOCK + 1 ) & ~1 ,
866
- & lp -> eth_regs -> ethmcp );
870
+ & lp -> eth_regs -> ethmcp );
867
871
868
872
/* don't transmit until fifo contains 48b */
869
873
writel (48 , & lp -> eth_regs -> ethfifott );
@@ -946,14 +950,14 @@ static int korina_open(struct net_device *dev)
946
950
0 , "Korina ethernet Rx" , dev );
947
951
if (ret < 0 ) {
948
952
printk (KERN_ERR "%s: unable to get Rx DMA IRQ %d\n" ,
949
- dev -> name , lp -> rx_irq );
953
+ dev -> name , lp -> rx_irq );
950
954
goto err_release ;
951
955
}
952
956
ret = request_irq (lp -> tx_irq , korina_tx_dma_interrupt ,
953
957
0 , "Korina ethernet Tx" , dev );
954
958
if (ret < 0 ) {
955
959
printk (KERN_ERR "%s: unable to get Tx DMA IRQ %d\n" ,
956
- dev -> name , lp -> tx_irq );
960
+ dev -> name , lp -> tx_irq );
957
961
goto err_free_rx_irq ;
958
962
}
959
963
0 commit comments