adm5120: add 3.3 support
[openwrt/staging/wigyori.git] / target / linux / adm5120 / patches-3.3 / a12-adm5120sw-3.3-fixes.patch
1 --- a/drivers/net/adm5120sw.c
2 +++ b/drivers/net/adm5120sw.c
3 @@ -38,6 +38,7 @@
4 #include <asm/mach-adm5120/adm5120_switch.h>
5
6 #include "adm5120sw.h"
7 +#include <linux/dma-mapping.h>
8
9 #define DRV_NAME "adm5120-switch"
10 #define DRV_DESC "ADM5120 built-in ethernet switch driver"
11 @@ -153,7 +154,7 @@ static unsigned int cur_txl, dirty_txl;
12
13 static unsigned int sw_used;
14
15 -static spinlock_t tx_lock = SPIN_LOCK_UNLOCKED;
16 +static DEFINE_SPINLOCK(tx_lock);
17
18 /* ------------------------------------------------------------------------ */
19
20 @@ -216,6 +217,7 @@ static inline int desc_ipcsum_fail(struc
21
22 /* ------------------------------------------------------------------------ */
23
24 +#ifdef CONFIG_ADM5120_SWITCH_DEBUG
25 static void sw_dump_desc(char *label, struct dma_desc *desc, int tx)
26 {
27 u32 t;
28 @@ -336,6 +338,11 @@ static void sw_dump_regs(void)
29 t = sw_read_reg(SWITCH_REG_RLDA);
30 SW_DBG("rlda: %08X\n", t);
31 }
32 +#else
33 +static inline void sw_dump_desc(char *label, struct dma_desc *desc, int tx) {}
34 +static void sw_dump_intr_mask(char *label, u32 mask) {}
35 +static inline void sw_dump_regs(void) {}
36 +#endif /* CONFIG_ADM5120_SWITCH_DEBUG */
37
38 /* ------------------------------------------------------------------------ */
39
40 @@ -502,7 +509,7 @@ static int adm5120_if_poll(struct napi_s
41 {
42 struct adm5120_if_priv *priv = container_of(napi,
43 struct adm5120_if_priv, napi);
44 - struct net_device *dev = priv->dev;
45 + struct net_device *dev __maybe_unused = priv->dev;
46 int done;
47 u32 status;
48
49 @@ -920,7 +927,7 @@ static void adm5120_if_tx_timeout(struct
50 SW_INFO("TX timeout on %s\n", dev->name);
51 }
52
53 -static void adm5120_if_set_multicast_list(struct net_device *dev)
54 +static void adm5120_if_set_rx_mode(struct net_device *dev)
55 {
56 struct adm5120_if_priv *priv = netdev_priv(dev);
57 u32 ports;
58 @@ -937,7 +944,7 @@ static void adm5120_if_set_multicast_lis
59 t |= (ports << CPUP_CONF_DUNP_SHIFT);
60
61 if (dev->flags & IFF_PROMISC || dev->flags & IFF_ALLMULTI ||
62 - dev->mc_count)
63 + netdev_mc_count(dev))
64 /* enable multicast packets */
65 t &= ~(ports << CPUP_CONF_DMCP_SHIFT);
66 else
67 @@ -1024,7 +1031,7 @@ static const struct net_device_ops adm51
68 .ndo_open = adm5120_if_open,
69 .ndo_stop = adm5120_if_stop,
70 .ndo_start_xmit = adm5120_if_hard_start_xmit,
71 - .ndo_set_multicast_list = adm5120_if_set_multicast_list,
72 + .ndo_set_rx_mode = adm5120_if_set_rx_mode,
73 .ndo_do_ioctl = adm5120_if_do_ioctl,
74 .ndo_tx_timeout = adm5120_if_tx_timeout,
75 .ndo_validate_addr = eth_validate_addr,
76 @@ -1076,7 +1083,7 @@ static void adm5120_switch_cleanup(void)
77 adm5120_switch_rx_ring_free();
78 }
79
80 -static int __init adm5120_switch_probe(struct platform_device *pdev)
81 +static int __devinit adm5120_switch_probe(struct platform_device *pdev)
82 {
83 u32 t;
84 int i, err;