diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/Space.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/cirrus/Kconfig | 19 | ||||
-rw-r--r-- | drivers/net/ethernet/cirrus/cs89x0.c | 148 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/gianfar.c | 39 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/gianfar.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/smsc/smc91x.c | 2 | ||||
-rw-r--r-- | drivers/net/irda/Kconfig | 2 | ||||
-rw-r--r-- | drivers/net/irda/sa1100_ir.c | 953 | ||||
-rw-r--r-- | drivers/net/usb/cdc-phonet.c | 6 | ||||
-rw-r--r-- | drivers/net/usb/qmi_wwan.c | 36 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/3945.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/4965-mac.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 2 |
15 files changed, 726 insertions, 499 deletions
diff --git a/drivers/net/Space.c b/drivers/net/Space.c index 068c3563e00f..88bbd8ffa7fe 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c | |||
@@ -190,8 +190,10 @@ static struct devprobe2 isa_probes[] __initdata = { | |||
190 | {seeq8005_probe, 0}, | 190 | {seeq8005_probe, 0}, |
191 | #endif | 191 | #endif |
192 | #ifdef CONFIG_CS89x0 | 192 | #ifdef CONFIG_CS89x0 |
193 | #ifndef CONFIG_CS89x0_PLATFORM | ||
193 | {cs89x0_probe, 0}, | 194 | {cs89x0_probe, 0}, |
194 | #endif | 195 | #endif |
196 | #endif | ||
195 | #ifdef CONFIG_AT1700 | 197 | #ifdef CONFIG_AT1700 |
196 | {at1700_probe, 0}, | 198 | {at1700_probe, 0}, |
197 | #endif | 199 | #endif |
diff --git a/drivers/net/ethernet/cirrus/Kconfig b/drivers/net/ethernet/cirrus/Kconfig index 1f8648f099c7..8388e36cf08f 100644 --- a/drivers/net/ethernet/cirrus/Kconfig +++ b/drivers/net/ethernet/cirrus/Kconfig | |||
@@ -5,8 +5,7 @@ | |||
5 | config NET_VENDOR_CIRRUS | 5 | config NET_VENDOR_CIRRUS |
6 | bool "Cirrus devices" | 6 | bool "Cirrus devices" |
7 | default y | 7 | default y |
8 | depends on ISA || EISA || MACH_IXDP2351 || ARCH_IXDP2X01 \ | 8 | depends on ISA || EISA || ARM || MAC |
9 | || MACH_MX31ADS || MACH_QQ2440 || (ARM && ARCH_EP93XX) || MAC | ||
10 | ---help--- | 9 | ---help--- |
11 | If you have a network (Ethernet) card belonging to this class, say Y | 10 | If you have a network (Ethernet) card belonging to this class, say Y |
12 | and read the Ethernet-HOWTO, available from | 11 | and read the Ethernet-HOWTO, available from |
@@ -21,8 +20,7 @@ if NET_VENDOR_CIRRUS | |||
21 | 20 | ||
22 | config CS89x0 | 21 | config CS89x0 |
23 | tristate "CS89x0 support" | 22 | tristate "CS89x0 support" |
24 | depends on (ISA || EISA || MACH_IXDP2351 \ | 23 | depends on ISA || EISA || ARM |
25 | || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440) | ||
26 | ---help--- | 24 | ---help--- |
27 | Support for CS89x0 chipset based Ethernet cards. If you have a | 25 | Support for CS89x0 chipset based Ethernet cards. If you have a |
28 | network (Ethernet) card of this type, say Y and read the | 26 | network (Ethernet) card of this type, say Y and read the |
@@ -33,10 +31,15 @@ config CS89x0 | |||
33 | To compile this driver as a module, choose M here. The module | 31 | To compile this driver as a module, choose M here. The module |
34 | will be called cs89x0. | 32 | will be called cs89x0. |
35 | 33 | ||
36 | config CS89x0_NONISA_IRQ | 34 | config CS89x0_PLATFORM |
37 | def_bool y | 35 | bool "CS89x0 platform driver support" |
38 | depends on CS89x0 != n | 36 | depends on CS89x0 |
39 | depends on MACH_IXDP2351 || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440 | 37 | help |
38 | Say Y to compile the cs89x0 driver as a platform driver. This | ||
39 | makes this driver suitable for use on certain evaluation boards | ||
40 | such as the iMX21ADS. | ||
41 | |||
42 | If you are unsure, say N. | ||
40 | 43 | ||
41 | config EP93XX_ETH | 44 | config EP93XX_ETH |
42 | tristate "EP93xx Ethernet support" | 45 | tristate "EP93xx Ethernet support" |
diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c index d5ff93653e4c..30fee428c489 100644 --- a/drivers/net/ethernet/cirrus/cs89x0.c +++ b/drivers/net/ethernet/cirrus/cs89x0.c | |||
@@ -100,9 +100,6 @@ | |||
100 | 100 | ||
101 | */ | 101 | */ |
102 | 102 | ||
103 | /* Always include 'config.h' first in case the user wants to turn on | ||
104 | or override something. */ | ||
105 | #include <linux/module.h> | ||
106 | 103 | ||
107 | /* | 104 | /* |
108 | * Set this to zero to disable DMA code | 105 | * Set this to zero to disable DMA code |
@@ -131,9 +128,12 @@ | |||
131 | 128 | ||
132 | */ | 129 | */ |
133 | 130 | ||
131 | #include <linux/module.h> | ||
132 | #include <linux/printk.h> | ||
134 | #include <linux/errno.h> | 133 | #include <linux/errno.h> |
135 | #include <linux/netdevice.h> | 134 | #include <linux/netdevice.h> |
136 | #include <linux/etherdevice.h> | 135 | #include <linux/etherdevice.h> |
136 | #include <linux/platform_device.h> | ||
137 | #include <linux/kernel.h> | 137 | #include <linux/kernel.h> |
138 | #include <linux/types.h> | 138 | #include <linux/types.h> |
139 | #include <linux/fcntl.h> | 139 | #include <linux/fcntl.h> |
@@ -151,6 +151,7 @@ | |||
151 | #include <asm/system.h> | 151 | #include <asm/system.h> |
152 | #include <asm/io.h> | 152 | #include <asm/io.h> |
153 | #include <asm/irq.h> | 153 | #include <asm/irq.h> |
154 | #include <linux/atomic.h> | ||
154 | #if ALLOW_DMA | 155 | #if ALLOW_DMA |
155 | #include <asm/dma.h> | 156 | #include <asm/dma.h> |
156 | #endif | 157 | #endif |
@@ -174,26 +175,20 @@ static char version[] __initdata = | |||
174 | them to system IRQ numbers. This mapping is card specific and is set to | 175 | them to system IRQ numbers. This mapping is card specific and is set to |
175 | the configuration of the Cirrus Eval board for this chip. */ | 176 | the configuration of the Cirrus Eval board for this chip. */ |
176 | #if defined(CONFIG_MACH_IXDP2351) | 177 | #if defined(CONFIG_MACH_IXDP2351) |
178 | #define CS89x0_NONISA_IRQ | ||
177 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; | 179 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; |
178 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; | 180 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; |
179 | #elif defined(CONFIG_ARCH_IXDP2X01) | 181 | #elif defined(CONFIG_ARCH_IXDP2X01) |
182 | #define CS89x0_NONISA_IRQ | ||
180 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; | 183 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; |
181 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; | 184 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; |
182 | #elif defined(CONFIG_MACH_QQ2440) | ||
183 | #include <mach/qq2440.h> | ||
184 | static unsigned int netcard_portlist[] __used __initdata = { QQ2440_CS8900_VIRT_BASE + 0x300, 0 }; | ||
185 | static unsigned int cs8900_irq_map[] = { QQ2440_CS8900_IRQ, 0, 0, 0 }; | ||
186 | #elif defined(CONFIG_MACH_MX31ADS) | ||
187 | #include <mach/board-mx31ads.h> | ||
188 | static unsigned int netcard_portlist[] __used __initdata = { | ||
189 | PBC_BASE_ADDRESS + PBC_CS8900A_IOBASE + 0x300, 0 | ||
190 | }; | ||
191 | static unsigned cs8900_irq_map[] = {EXPIO_INT_ENET_INT, 0, 0, 0}; | ||
192 | #else | 185 | #else |
186 | #ifndef CONFIG_CS89x0_PLATFORM | ||
193 | static unsigned int netcard_portlist[] __used __initdata = | 187 | static unsigned int netcard_portlist[] __used __initdata = |
194 | { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; | 188 | { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; |
195 | static unsigned int cs8900_irq_map[] = {10,11,12,5}; | 189 | static unsigned int cs8900_irq_map[] = {10,11,12,5}; |
196 | #endif | 190 | #endif |
191 | #endif | ||
197 | 192 | ||
198 | #if DEBUGGING | 193 | #if DEBUGGING |
199 | static unsigned int net_debug = DEBUGGING; | 194 | static unsigned int net_debug = DEBUGGING; |
@@ -236,11 +231,16 @@ struct net_local { | |||
236 | unsigned char *end_dma_buff; /* points to the end of the buffer */ | 231 | unsigned char *end_dma_buff; /* points to the end of the buffer */ |
237 | unsigned char *rx_dma_ptr; /* points to the next packet */ | 232 | unsigned char *rx_dma_ptr; /* points to the next packet */ |
238 | #endif | 233 | #endif |
234 | #ifdef CONFIG_CS89x0_PLATFORM | ||
235 | void __iomem *virt_addr;/* Virtual address for accessing the CS89x0. */ | ||
236 | unsigned long phys_addr;/* Physical address for accessing the CS89x0. */ | ||
237 | unsigned long size; /* Length of CS89x0 memory region. */ | ||
238 | #endif | ||
239 | }; | 239 | }; |
240 | 240 | ||
241 | /* Index to functions, as function prototypes. */ | 241 | /* Index to functions, as function prototypes. */ |
242 | 242 | ||
243 | static int cs89x0_probe1(struct net_device *dev, int ioaddr, int modular); | 243 | static int cs89x0_probe1(struct net_device *dev, unsigned long ioaddr, int modular); |
244 | static int net_open(struct net_device *dev); | 244 | static int net_open(struct net_device *dev); |
245 | static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev); | 245 | static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev); |
246 | static irqreturn_t net_interrupt(int irq, void *dev_id); | 246 | static irqreturn_t net_interrupt(int irq, void *dev_id); |
@@ -294,6 +294,7 @@ static int __init media_fn(char *str) | |||
294 | __setup("cs89x0_media=", media_fn); | 294 | __setup("cs89x0_media=", media_fn); |
295 | 295 | ||
296 | 296 | ||
297 | #ifndef CONFIG_CS89x0_PLATFORM | ||
297 | /* Check for a network adaptor of this type, and return '0' iff one exists. | 298 | /* Check for a network adaptor of this type, and return '0' iff one exists. |
298 | If dev->base_addr == 0, probe all likely locations. | 299 | If dev->base_addr == 0, probe all likely locations. |
299 | If dev->base_addr == 1, always return failure. | 300 | If dev->base_addr == 1, always return failure. |
@@ -343,6 +344,7 @@ out: | |||
343 | return ERR_PTR(err); | 344 | return ERR_PTR(err); |
344 | } | 345 | } |
345 | #endif | 346 | #endif |
347 | #endif | ||
346 | 348 | ||
347 | #if defined(CONFIG_MACH_IXDP2351) | 349 | #if defined(CONFIG_MACH_IXDP2351) |
348 | static u16 | 350 | static u16 |
@@ -504,7 +506,7 @@ static const struct net_device_ops net_ops = { | |||
504 | */ | 506 | */ |
505 | 507 | ||
506 | static int __init | 508 | static int __init |
507 | cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | 509 | cs89x0_probe1(struct net_device *dev, unsigned long ioaddr, int modular) |
508 | { | 510 | { |
509 | struct net_local *lp = netdev_priv(dev); | 511 | struct net_local *lp = netdev_priv(dev); |
510 | static unsigned version_printed; | 512 | static unsigned version_printed; |
@@ -529,15 +531,12 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
529 | lp->force = g_cs89x0_media__force; | 531 | lp->force = g_cs89x0_media__force; |
530 | #endif | 532 | #endif |
531 | 533 | ||
532 | #if defined(CONFIG_MACH_QQ2440) | ||
533 | lp->force |= FORCE_RJ45 | FORCE_FULL; | ||
534 | #endif | ||
535 | } | 534 | } |
536 | 535 | ||
537 | /* Grab the region so we can find another board if autoIRQ fails. */ | 536 | /* Grab the region so we can find another board if autoIRQ fails. */ |
538 | /* WTF is going on here? */ | 537 | /* WTF is going on here? */ |
539 | if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { | 538 | if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { |
540 | printk(KERN_ERR "%s: request_region(0x%x, 0x%x) failed\n", | 539 | printk(KERN_ERR "%s: request_region(0x%lx, 0x%x) failed\n", |
541 | DRV_NAME, ioaddr, NETCARD_IO_EXTENT); | 540 | DRV_NAME, ioaddr, NETCARD_IO_EXTENT); |
542 | retval = -EBUSY; | 541 | retval = -EBUSY; |
543 | goto out1; | 542 | goto out1; |
@@ -549,7 +548,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
549 | will skip the test for the ADD_PORT. */ | 548 | will skip the test for the ADD_PORT. */ |
550 | if (ioaddr & 1) { | 549 | if (ioaddr & 1) { |
551 | if (net_debug > 1) | 550 | if (net_debug > 1) |
552 | printk(KERN_INFO "%s: odd ioaddr 0x%x\n", dev->name, ioaddr); | 551 | printk(KERN_INFO "%s: odd ioaddr 0x%lx\n", dev->name, ioaddr); |
553 | if ((ioaddr & 2) != 2) | 552 | if ((ioaddr & 2) != 2) |
554 | if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { | 553 | if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { |
555 | printk(KERN_ERR "%s: bad signature 0x%x\n", | 554 | printk(KERN_ERR "%s: bad signature 0x%x\n", |
@@ -560,13 +559,13 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
560 | } | 559 | } |
561 | 560 | ||
562 | ioaddr &= ~3; | 561 | ioaddr &= ~3; |
563 | printk(KERN_DEBUG "PP_addr at %x[%x]: 0x%x\n", | 562 | printk(KERN_DEBUG "PP_addr at %lx[%x]: 0x%x\n", |
564 | ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); | 563 | ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); |
565 | writeword(ioaddr, ADD_PORT, PP_ChipID); | 564 | writeword(ioaddr, ADD_PORT, PP_ChipID); |
566 | 565 | ||
567 | tmp = readword(ioaddr, DATA_PORT); | 566 | tmp = readword(ioaddr, DATA_PORT); |
568 | if (tmp != CHIP_EISA_ID_SIG) { | 567 | if (tmp != CHIP_EISA_ID_SIG) { |
569 | printk(KERN_DEBUG "%s: incorrect signature at %x[%x]: 0x%x!=" | 568 | printk(KERN_DEBUG "%s: incorrect signature at %lx[%x]: 0x%x!=" |
570 | CHIP_EISA_ID_SIG_STR "\n", | 569 | CHIP_EISA_ID_SIG_STR "\n", |
571 | dev->name, ioaddr, DATA_PORT, tmp); | 570 | dev->name, ioaddr, DATA_PORT, tmp); |
572 | retval = -ENODEV; | 571 | retval = -ENODEV; |
@@ -736,8 +735,9 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
736 | dev->irq = i; | 735 | dev->irq = i; |
737 | } else { | 736 | } else { |
738 | i = lp->isa_config & INT_NO_MASK; | 737 | i = lp->isa_config & INT_NO_MASK; |
738 | #ifndef CONFIG_CS89x0_PLATFORM | ||
739 | if (lp->chip_type == CS8900) { | 739 | if (lp->chip_type == CS8900) { |
740 | #ifdef CONFIG_CS89x0_NONISA_IRQ | 740 | #ifdef CS89x0_NONISA_IRQ |
741 | i = cs8900_irq_map[0]; | 741 | i = cs8900_irq_map[0]; |
742 | #else | 742 | #else |
743 | /* Translate the IRQ using the IRQ mapping table. */ | 743 | /* Translate the IRQ using the IRQ mapping table. */ |
@@ -758,6 +758,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
758 | } | 758 | } |
759 | #endif | 759 | #endif |
760 | } | 760 | } |
761 | #endif | ||
761 | if (!dev->irq) | 762 | if (!dev->irq) |
762 | dev->irq = i; | 763 | dev->irq = i; |
763 | } | 764 | } |
@@ -1168,6 +1169,7 @@ write_irq(struct net_device *dev, int chip_type, int irq) | |||
1168 | int i; | 1169 | int i; |
1169 | 1170 | ||
1170 | if (chip_type == CS8900) { | 1171 | if (chip_type == CS8900) { |
1172 | #ifndef CONFIG_CS89x0_PLATFORM | ||
1171 | /* Search the mapping table for the corresponding IRQ pin. */ | 1173 | /* Search the mapping table for the corresponding IRQ pin. */ |
1172 | for (i = 0; i != ARRAY_SIZE(cs8900_irq_map); i++) | 1174 | for (i = 0; i != ARRAY_SIZE(cs8900_irq_map); i++) |
1173 | if (cs8900_irq_map[i] == irq) | 1175 | if (cs8900_irq_map[i] == irq) |
@@ -1175,6 +1177,10 @@ write_irq(struct net_device *dev, int chip_type, int irq) | |||
1175 | /* Not found */ | 1177 | /* Not found */ |
1176 | if (i == ARRAY_SIZE(cs8900_irq_map)) | 1178 | if (i == ARRAY_SIZE(cs8900_irq_map)) |
1177 | i = 3; | 1179 | i = 3; |
1180 | #else | ||
1181 | /* INTRQ0 pin is used for interrupt generation. */ | ||
1182 | i = 0; | ||
1183 | #endif | ||
1178 | writereg(dev, PP_CS8900_ISAINT, i); | 1184 | writereg(dev, PP_CS8900_ISAINT, i); |
1179 | } else { | 1185 | } else { |
1180 | writereg(dev, PP_CS8920_ISAINT, irq); | 1186 | writereg(dev, PP_CS8920_ISAINT, irq); |
@@ -1228,7 +1234,7 @@ net_open(struct net_device *dev) | |||
1228 | } | 1234 | } |
1229 | else | 1235 | else |
1230 | { | 1236 | { |
1231 | #ifndef CONFIG_CS89x0_NONISA_IRQ | 1237 | #if !defined(CS89x0_NONISA_IRQ) && !defined(CONFIG_CS89x0_PLATFORM) |
1232 | if (((1 << dev->irq) & lp->irq_map) == 0) { | 1238 | if (((1 << dev->irq) & lp->irq_map) == 0) { |
1233 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", | 1239 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", |
1234 | dev->name, dev->irq, lp->irq_map); | 1240 | dev->name, dev->irq, lp->irq_map); |
@@ -1746,7 +1752,7 @@ static int set_mac_address(struct net_device *dev, void *p) | |||
1746 | return 0; | 1752 | return 0; |
1747 | } | 1753 | } |
1748 | 1754 | ||
1749 | #ifdef MODULE | 1755 | #if defined(MODULE) && !defined(CONFIG_CS89x0_PLATFORM) |
1750 | 1756 | ||
1751 | static struct net_device *dev_cs89x0; | 1757 | static struct net_device *dev_cs89x0; |
1752 | 1758 | ||
@@ -1900,7 +1906,97 @@ cleanup_module(void) | |||
1900 | release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); | 1906 | release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); |
1901 | free_netdev(dev_cs89x0); | 1907 | free_netdev(dev_cs89x0); |
1902 | } | 1908 | } |
1903 | #endif /* MODULE */ | 1909 | #endif /* MODULE && !CONFIG_CS89x0_PLATFORM */ |
1910 | |||
1911 | #ifdef CONFIG_CS89x0_PLATFORM | ||
1912 | static int __init cs89x0_platform_probe(struct platform_device *pdev) | ||
1913 | { | ||
1914 | struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); | ||
1915 | struct net_local *lp; | ||
1916 | struct resource *mem_res; | ||
1917 | int err; | ||
1918 | |||
1919 | if (!dev) | ||
1920 | return -ENOMEM; | ||
1921 | |||
1922 | lp = netdev_priv(dev); | ||
1923 | |||
1924 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1925 | dev->irq = platform_get_irq(pdev, 0); | ||
1926 | if (mem_res == NULL || dev->irq <= 0) { | ||
1927 | dev_warn(&dev->dev, "memory/interrupt resource missing.\n"); | ||
1928 | err = -ENXIO; | ||
1929 | goto free; | ||
1930 | } | ||
1931 | |||
1932 | lp->phys_addr = mem_res->start; | ||
1933 | lp->size = resource_size(mem_res); | ||
1934 | if (!request_mem_region(lp->phys_addr, lp->size, DRV_NAME)) { | ||
1935 | dev_warn(&dev->dev, "request_mem_region() failed.\n"); | ||
1936 | err = -EBUSY; | ||
1937 | goto free; | ||
1938 | } | ||
1939 | |||
1940 | lp->virt_addr = ioremap(lp->phys_addr, lp->size); | ||
1941 | if (!lp->virt_addr) { | ||
1942 | dev_warn(&dev->dev, "ioremap() failed.\n"); | ||
1943 | err = -ENOMEM; | ||
1944 | goto release; | ||
1945 | } | ||
1946 | |||
1947 | err = cs89x0_probe1(dev, (unsigned long)lp->virt_addr, 0); | ||
1948 | if (err) { | ||
1949 | dev_warn(&dev->dev, "no cs8900 or cs8920 detected.\n"); | ||
1950 | goto unmap; | ||
1951 | } | ||
1952 | |||
1953 | platform_set_drvdata(pdev, dev); | ||
1954 | return 0; | ||
1955 | |||
1956 | unmap: | ||
1957 | iounmap(lp->virt_addr); | ||
1958 | release: | ||
1959 | release_mem_region(lp->phys_addr, lp->size); | ||
1960 | free: | ||
1961 | free_netdev(dev); | ||
1962 | return err; | ||
1963 | } | ||
1964 | |||
1965 | static int cs89x0_platform_remove(struct platform_device *pdev) | ||
1966 | { | ||
1967 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1968 | struct net_local *lp = netdev_priv(dev); | ||
1969 | |||
1970 | unregister_netdev(dev); | ||
1971 | iounmap(lp->virt_addr); | ||
1972 | release_mem_region(lp->phys_addr, lp->size); | ||
1973 | free_netdev(dev); | ||
1974 | return 0; | ||
1975 | } | ||
1976 | |||
1977 | static struct platform_driver cs89x0_driver = { | ||
1978 | .driver = { | ||
1979 | .name = DRV_NAME, | ||
1980 | .owner = THIS_MODULE, | ||
1981 | }, | ||
1982 | .remove = cs89x0_platform_remove, | ||
1983 | }; | ||
1984 | |||
1985 | static int __init cs89x0_init(void) | ||
1986 | { | ||
1987 | return platform_driver_probe(&cs89x0_driver, cs89x0_platform_probe); | ||
1988 | } | ||
1989 | |||
1990 | module_init(cs89x0_init); | ||
1991 | |||
1992 | static void __exit cs89x0_cleanup(void) | ||
1993 | { | ||
1994 | platform_driver_unregister(&cs89x0_driver); | ||
1995 | } | ||
1996 | |||
1997 | module_exit(cs89x0_cleanup); | ||
1998 | |||
1999 | #endif /* CONFIG_CS89x0_PLATFORM */ | ||
1904 | 2000 | ||
1905 | /* | 2001 | /* |
1906 | * Local variables: | 2002 | * Local variables: |
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index d9428f0e738a..e7bed5303997 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -968,7 +968,6 @@ static int gfar_probe(struct platform_device *ofdev) | |||
968 | struct gfar_private *priv = NULL; | 968 | struct gfar_private *priv = NULL; |
969 | struct gfar __iomem *regs = NULL; | 969 | struct gfar __iomem *regs = NULL; |
970 | int err = 0, i, grp_idx = 0; | 970 | int err = 0, i, grp_idx = 0; |
971 | int len_devname; | ||
972 | u32 rstat = 0, tstat = 0, rqueue = 0, tqueue = 0; | 971 | u32 rstat = 0, tstat = 0, rqueue = 0, tqueue = 0; |
973 | u32 isrg = 0; | 972 | u32 isrg = 0; |
974 | u32 __iomem *baddr; | 973 | u32 __iomem *baddr; |
@@ -1169,40 +1168,16 @@ static int gfar_probe(struct platform_device *ofdev) | |||
1169 | priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET); | 1168 | priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET); |
1170 | 1169 | ||
1171 | /* fill out IRQ number and name fields */ | 1170 | /* fill out IRQ number and name fields */ |
1172 | len_devname = strlen(dev->name); | ||
1173 | for (i = 0; i < priv->num_grps; i++) { | 1171 | for (i = 0; i < priv->num_grps; i++) { |
1174 | strncpy(&priv->gfargrp[i].int_name_tx[0], dev->name, | ||
1175 | len_devname); | ||
1176 | if (priv->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) { | 1172 | if (priv->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) { |
1177 | strncpy(&priv->gfargrp[i].int_name_tx[len_devname], | 1173 | sprintf(priv->gfargrp[i].int_name_tx, "%s%s%c%s", |
1178 | "_g", sizeof("_g")); | 1174 | dev->name, "_g", '0' + i, "_tx"); |
1179 | priv->gfargrp[i].int_name_tx[ | 1175 | sprintf(priv->gfargrp[i].int_name_rx, "%s%s%c%s", |
1180 | strlen(priv->gfargrp[i].int_name_tx)] = i+48; | 1176 | dev->name, "_g", '0' + i, "_rx"); |
1181 | strncpy(&priv->gfargrp[i].int_name_tx[strlen( | 1177 | sprintf(priv->gfargrp[i].int_name_er, "%s%s%c%s", |
1182 | priv->gfargrp[i].int_name_tx)], | 1178 | dev->name, "_g", '0' + i, "_er"); |
1183 | "_tx", sizeof("_tx") + 1); | ||
1184 | |||
1185 | strncpy(&priv->gfargrp[i].int_name_rx[0], dev->name, | ||
1186 | len_devname); | ||
1187 | strncpy(&priv->gfargrp[i].int_name_rx[len_devname], | ||
1188 | "_g", sizeof("_g")); | ||
1189 | priv->gfargrp[i].int_name_rx[ | ||
1190 | strlen(priv->gfargrp[i].int_name_rx)] = i+48; | ||
1191 | strncpy(&priv->gfargrp[i].int_name_rx[strlen( | ||
1192 | priv->gfargrp[i].int_name_rx)], | ||
1193 | "_rx", sizeof("_rx") + 1); | ||
1194 | |||
1195 | strncpy(&priv->gfargrp[i].int_name_er[0], dev->name, | ||
1196 | len_devname); | ||
1197 | strncpy(&priv->gfargrp[i].int_name_er[len_devname], | ||
1198 | "_g", sizeof("_g")); | ||
1199 | priv->gfargrp[i].int_name_er[strlen( | ||
1200 | priv->gfargrp[i].int_name_er)] = i+48; | ||
1201 | strncpy(&priv->gfargrp[i].int_name_er[strlen(\ | ||
1202 | priv->gfargrp[i].int_name_er)], | ||
1203 | "_er", sizeof("_er") + 1); | ||
1204 | } else | 1179 | } else |
1205 | priv->gfargrp[i].int_name_tx[len_devname] = '\0'; | 1180 | strcpy(priv->gfargrp[i].int_name_tx, dev->name); |
1206 | } | 1181 | } |
1207 | 1182 | ||
1208 | /* Initialize the filer table */ | 1183 | /* Initialize the filer table */ |
diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h index fc2488adca36..4c9f8d487dbb 100644 --- a/drivers/net/ethernet/freescale/gianfar.h +++ b/drivers/net/ethernet/freescale/gianfar.h | |||
@@ -517,7 +517,7 @@ extern const char gfar_driver_version[]; | |||
517 | #define RXFCB_PERR_MASK 0x000c | 517 | #define RXFCB_PERR_MASK 0x000c |
518 | #define RXFCB_PERR_BADL3 0x0008 | 518 | #define RXFCB_PERR_BADL3 0x0008 |
519 | 519 | ||
520 | #define GFAR_INT_NAME_MAX IFNAMSIZ + 4 | 520 | #define GFAR_INT_NAME_MAX (IFNAMSIZ + 6) /* '_g#_xx' */ |
521 | 521 | ||
522 | struct txbd8 | 522 | struct txbd8 |
523 | { | 523 | { |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 2b5af22419a5..385a4d5c7c25 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -36,8 +36,8 @@ | |||
36 | 36 | ||
37 | #define _QLCNIC_LINUX_MAJOR 5 | 37 | #define _QLCNIC_LINUX_MAJOR 5 |
38 | #define _QLCNIC_LINUX_MINOR 0 | 38 | #define _QLCNIC_LINUX_MINOR 0 |
39 | #define _QLCNIC_LINUX_SUBVERSION 25 | 39 | #define _QLCNIC_LINUX_SUBVERSION 27 |
40 | #define QLCNIC_LINUX_VERSIONID "5.0.26" | 40 | #define QLCNIC_LINUX_VERSIONID "5.0.27" |
41 | #define QLCNIC_DRV_IDC_VER 0x01 | 41 | #define QLCNIC_DRV_IDC_VER 0x01 |
42 | #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ | 42 | #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ |
43 | (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) | 43 | (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 81bb1a69e69f..75c32e875fef 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -1458,8 +1458,10 @@ qlcnic_reset_context(struct qlcnic_adapter *adapter) | |||
1458 | 1458 | ||
1459 | if (netif_running(netdev)) { | 1459 | if (netif_running(netdev)) { |
1460 | err = qlcnic_attach(adapter); | 1460 | err = qlcnic_attach(adapter); |
1461 | if (!err) | 1461 | if (!err) { |
1462 | __qlcnic_up(adapter, netdev); | 1462 | __qlcnic_up(adapter, netdev); |
1463 | qlcnic_restore_indev_addr(netdev, NETDEV_UP); | ||
1464 | } | ||
1463 | } | 1465 | } |
1464 | 1466 | ||
1465 | netif_device_attach(netdev); | 1467 | netif_device_attach(netdev); |
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 1dc4fad593e7..fee449355014 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c | |||
@@ -2280,7 +2280,7 @@ static int __devinit smc_drv_probe(struct platform_device *pdev) | |||
2280 | if (ret) | 2280 | if (ret) |
2281 | goto out_release_io; | 2281 | goto out_release_io; |
2282 | #if defined(CONFIG_SA1100_ASSABET) | 2282 | #if defined(CONFIG_SA1100_ASSABET) |
2283 | NCR_0 |= NCR_ENET_OSC_EN; | 2283 | neponset_ncr_set(NCR_ENET_OSC_EN); |
2284 | #endif | 2284 | #endif |
2285 | platform_set_drvdata(pdev, ndev); | 2285 | platform_set_drvdata(pdev, ndev); |
2286 | ret = smc_enable_device(pdev); | 2286 | ret = smc_enable_device(pdev); |
diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig index e535137eb2d0..468047866c8c 100644 --- a/drivers/net/irda/Kconfig +++ b/drivers/net/irda/Kconfig | |||
@@ -356,7 +356,7 @@ config VLSI_FIR | |||
356 | 356 | ||
357 | config SA1100_FIR | 357 | config SA1100_FIR |
358 | tristate "SA1100 Internal IR" | 358 | tristate "SA1100 Internal IR" |
359 | depends on ARCH_SA1100 && IRDA | 359 | depends on ARCH_SA1100 && IRDA && DMA_SA11X0 |
360 | 360 | ||
361 | config VIA_FIR | 361 | config VIA_FIR |
362 | tristate "VIA VT8231/VT1211 SIR/MIR/FIR" | 362 | tristate "VIA VT8231/VT1211 SIR/MIR/FIR" |
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index da2705061a60..a0d1913a58d3 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * This driver takes one kernel command line parameter, sa1100ir=, with | 15 | * This driver takes one kernel command line parameter, sa1100ir=, with |
16 | * the following options: | 16 | * the following options: |
17 | * max_rate:baudrate - set the maximum baud rate | 17 | * max_rate:baudrate - set the maximum baud rate |
18 | * power_leve:level - set the transmitter power level | 18 | * power_level:level - set the transmitter power level |
19 | * tx_lpm:0|1 - set transmit low power mode | 19 | * tx_lpm:0|1 - set transmit low power mode |
20 | */ | 20 | */ |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
@@ -30,13 +30,13 @@ | |||
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
32 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
33 | #include <linux/dmaengine.h> | ||
34 | #include <linux/sa11x0-dma.h> | ||
33 | 35 | ||
34 | #include <net/irda/irda.h> | 36 | #include <net/irda/irda.h> |
35 | #include <net/irda/wrapper.h> | 37 | #include <net/irda/wrapper.h> |
36 | #include <net/irda/irda_device.h> | 38 | #include <net/irda/irda_device.h> |
37 | 39 | ||
38 | #include <asm/irq.h> | ||
39 | #include <mach/dma.h> | ||
40 | #include <mach/hardware.h> | 40 | #include <mach/hardware.h> |
41 | #include <asm/mach/irda.h> | 41 | #include <asm/mach/irda.h> |
42 | 42 | ||
@@ -44,8 +44,15 @@ static int power_level = 3; | |||
44 | static int tx_lpm; | 44 | static int tx_lpm; |
45 | static int max_rate = 4000000; | 45 | static int max_rate = 4000000; |
46 | 46 | ||
47 | struct sa1100_buf { | ||
48 | struct device *dev; | ||
49 | struct sk_buff *skb; | ||
50 | struct scatterlist sg; | ||
51 | struct dma_chan *chan; | ||
52 | dma_cookie_t cookie; | ||
53 | }; | ||
54 | |||
47 | struct sa1100_irda { | 55 | struct sa1100_irda { |
48 | unsigned char hscr0; | ||
49 | unsigned char utcr4; | 56 | unsigned char utcr4; |
50 | unsigned char power; | 57 | unsigned char power; |
51 | unsigned char open; | 58 | unsigned char open; |
@@ -53,12 +60,8 @@ struct sa1100_irda { | |||
53 | int speed; | 60 | int speed; |
54 | int newspeed; | 61 | int newspeed; |
55 | 62 | ||
56 | struct sk_buff *txskb; | 63 | struct sa1100_buf dma_rx; |
57 | struct sk_buff *rxskb; | 64 | struct sa1100_buf dma_tx; |
58 | dma_addr_t txbuf_dma; | ||
59 | dma_addr_t rxbuf_dma; | ||
60 | dma_regs_t *txdma; | ||
61 | dma_regs_t *rxdma; | ||
62 | 65 | ||
63 | struct device *dev; | 66 | struct device *dev; |
64 | struct irda_platform_data *pdata; | 67 | struct irda_platform_data *pdata; |
@@ -67,23 +70,103 @@ struct sa1100_irda { | |||
67 | 70 | ||
68 | iobuff_t tx_buff; | 71 | iobuff_t tx_buff; |
69 | iobuff_t rx_buff; | 72 | iobuff_t rx_buff; |
73 | |||
74 | int (*tx_start)(struct sk_buff *, struct net_device *, struct sa1100_irda *); | ||
75 | irqreturn_t (*irq)(struct net_device *, struct sa1100_irda *); | ||
70 | }; | 76 | }; |
71 | 77 | ||
78 | static int sa1100_irda_set_speed(struct sa1100_irda *, int); | ||
79 | |||
72 | #define IS_FIR(si) ((si)->speed >= 4000000) | 80 | #define IS_FIR(si) ((si)->speed >= 4000000) |
73 | 81 | ||
74 | #define HPSIR_MAX_RXLEN 2047 | 82 | #define HPSIR_MAX_RXLEN 2047 |
75 | 83 | ||
84 | static struct dma_slave_config sa1100_irda_sir_tx = { | ||
85 | .direction = DMA_TO_DEVICE, | ||
86 | .dst_addr = __PREG(Ser2UTDR), | ||
87 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, | ||
88 | .dst_maxburst = 4, | ||
89 | }; | ||
90 | |||
91 | static struct dma_slave_config sa1100_irda_fir_rx = { | ||
92 | .direction = DMA_FROM_DEVICE, | ||
93 | .src_addr = __PREG(Ser2HSDR), | ||
94 | .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, | ||
95 | .src_maxburst = 8, | ||
96 | }; | ||
97 | |||
98 | static struct dma_slave_config sa1100_irda_fir_tx = { | ||
99 | .direction = DMA_TO_DEVICE, | ||
100 | .dst_addr = __PREG(Ser2HSDR), | ||
101 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, | ||
102 | .dst_maxburst = 8, | ||
103 | }; | ||
104 | |||
105 | static unsigned sa1100_irda_dma_xferred(struct sa1100_buf *buf) | ||
106 | { | ||
107 | struct dma_chan *chan = buf->chan; | ||
108 | struct dma_tx_state state; | ||
109 | enum dma_status status; | ||
110 | |||
111 | status = chan->device->device_tx_status(chan, buf->cookie, &state); | ||
112 | if (status != DMA_PAUSED) | ||
113 | return 0; | ||
114 | |||
115 | return sg_dma_len(&buf->sg) - state.residue; | ||
116 | } | ||
117 | |||
118 | static int sa1100_irda_dma_request(struct device *dev, struct sa1100_buf *buf, | ||
119 | const char *name, struct dma_slave_config *cfg) | ||
120 | { | ||
121 | dma_cap_mask_t m; | ||
122 | int ret; | ||
123 | |||
124 | dma_cap_zero(m); | ||
125 | dma_cap_set(DMA_SLAVE, m); | ||
126 | |||
127 | buf->chan = dma_request_channel(m, sa11x0_dma_filter_fn, (void *)name); | ||
128 | if (!buf->chan) { | ||
129 | dev_err(dev, "unable to request DMA channel for %s\n", | ||
130 | name); | ||
131 | return -ENOENT; | ||
132 | } | ||
133 | |||
134 | ret = dmaengine_slave_config(buf->chan, cfg); | ||
135 | if (ret) | ||
136 | dev_warn(dev, "DMA slave_config for %s returned %d\n", | ||
137 | name, ret); | ||
138 | |||
139 | buf->dev = buf->chan->device->dev; | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | static void sa1100_irda_dma_start(struct sa1100_buf *buf, | ||
145 | enum dma_transfer_direction dir, dma_async_tx_callback cb, void *cb_p) | ||
146 | { | ||
147 | struct dma_async_tx_descriptor *desc; | ||
148 | struct dma_chan *chan = buf->chan; | ||
149 | |||
150 | desc = chan->device->device_prep_slave_sg(chan, &buf->sg, 1, dir, | ||
151 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | ||
152 | if (desc) { | ||
153 | desc->callback = cb; | ||
154 | desc->callback_param = cb_p; | ||
155 | buf->cookie = dmaengine_submit(desc); | ||
156 | dma_async_issue_pending(chan); | ||
157 | } | ||
158 | } | ||
159 | |||
76 | /* | 160 | /* |
77 | * Allocate and map the receive buffer, unless it is already allocated. | 161 | * Allocate and map the receive buffer, unless it is already allocated. |
78 | */ | 162 | */ |
79 | static int sa1100_irda_rx_alloc(struct sa1100_irda *si) | 163 | static int sa1100_irda_rx_alloc(struct sa1100_irda *si) |
80 | { | 164 | { |
81 | if (si->rxskb) | 165 | if (si->dma_rx.skb) |
82 | return 0; | 166 | return 0; |
83 | 167 | ||
84 | si->rxskb = alloc_skb(HPSIR_MAX_RXLEN + 1, GFP_ATOMIC); | 168 | si->dma_rx.skb = alloc_skb(HPSIR_MAX_RXLEN + 1, GFP_ATOMIC); |
85 | 169 | if (!si->dma_rx.skb) { | |
86 | if (!si->rxskb) { | ||
87 | printk(KERN_ERR "sa1100_ir: out of memory for RX SKB\n"); | 170 | printk(KERN_ERR "sa1100_ir: out of memory for RX SKB\n"); |
88 | return -ENOMEM; | 171 | return -ENOMEM; |
89 | } | 172 | } |
@@ -92,11 +175,14 @@ static int sa1100_irda_rx_alloc(struct sa1100_irda *si) | |||
92 | * Align any IP headers that may be contained | 175 | * Align any IP headers that may be contained |
93 | * within the frame. | 176 | * within the frame. |
94 | */ | 177 | */ |
95 | skb_reserve(si->rxskb, 1); | 178 | skb_reserve(si->dma_rx.skb, 1); |
179 | |||
180 | sg_set_buf(&si->dma_rx.sg, si->dma_rx.skb->data, HPSIR_MAX_RXLEN); | ||
181 | if (dma_map_sg(si->dma_rx.dev, &si->dma_rx.sg, 1, DMA_FROM_DEVICE) == 0) { | ||
182 | dev_kfree_skb_any(si->dma_rx.skb); | ||
183 | return -ENOMEM; | ||
184 | } | ||
96 | 185 | ||
97 | si->rxbuf_dma = dma_map_single(si->dev, si->rxskb->data, | ||
98 | HPSIR_MAX_RXLEN, | ||
99 | DMA_FROM_DEVICE); | ||
100 | return 0; | 186 | return 0; |
101 | } | 187 | } |
102 | 188 | ||
@@ -106,7 +192,7 @@ static int sa1100_irda_rx_alloc(struct sa1100_irda *si) | |||
106 | */ | 192 | */ |
107 | static void sa1100_irda_rx_dma_start(struct sa1100_irda *si) | 193 | static void sa1100_irda_rx_dma_start(struct sa1100_irda *si) |
108 | { | 194 | { |
109 | if (!si->rxskb) { | 195 | if (!si->dma_rx.skb) { |
110 | printk(KERN_ERR "sa1100_ir: rx buffer went missing\n"); | 196 | printk(KERN_ERR "sa1100_ir: rx buffer went missing\n"); |
111 | return; | 197 | return; |
112 | } | 198 | } |
@@ -114,254 +200,87 @@ static void sa1100_irda_rx_dma_start(struct sa1100_irda *si) | |||
114 | /* | 200 | /* |
115 | * First empty receive FIFO | 201 | * First empty receive FIFO |
116 | */ | 202 | */ |
117 | Ser2HSCR0 = si->hscr0 | HSCR0_HSSP; | 203 | Ser2HSCR0 = HSCR0_HSSP; |
118 | 204 | ||
119 | /* | 205 | /* |
120 | * Enable the DMA, receiver and receive interrupt. | 206 | * Enable the DMA, receiver and receive interrupt. |
121 | */ | 207 | */ |
122 | sa1100_clear_dma(si->rxdma); | 208 | dmaengine_terminate_all(si->dma_rx.chan); |
123 | sa1100_start_dma(si->rxdma, si->rxbuf_dma, HPSIR_MAX_RXLEN); | 209 | sa1100_irda_dma_start(&si->dma_rx, DMA_DEV_TO_MEM, NULL, NULL); |
124 | Ser2HSCR0 = si->hscr0 | HSCR0_HSSP | HSCR0_RXE; | 210 | |
211 | Ser2HSCR0 = HSCR0_HSSP | HSCR0_RXE; | ||
125 | } | 212 | } |
126 | 213 | ||
127 | /* | 214 | static void sa1100_irda_check_speed(struct sa1100_irda *si) |
128 | * Set the IrDA communications speed. | ||
129 | */ | ||
130 | static int sa1100_irda_set_speed(struct sa1100_irda *si, int speed) | ||
131 | { | 215 | { |
132 | unsigned long flags; | 216 | if (si->newspeed) { |
133 | int brd, ret = -EINVAL; | 217 | sa1100_irda_set_speed(si, si->newspeed); |
134 | 218 | si->newspeed = 0; | |
135 | switch (speed) { | ||
136 | case 9600: case 19200: case 38400: | ||
137 | case 57600: case 115200: | ||
138 | brd = 3686400 / (16 * speed) - 1; | ||
139 | |||
140 | /* | ||
141 | * Stop the receive DMA. | ||
142 | */ | ||
143 | if (IS_FIR(si)) | ||
144 | sa1100_stop_dma(si->rxdma); | ||
145 | |||
146 | local_irq_save(flags); | ||
147 | |||
148 | Ser2UTCR3 = 0; | ||
149 | Ser2HSCR0 = HSCR0_UART; | ||
150 | |||
151 | Ser2UTCR1 = brd >> 8; | ||
152 | Ser2UTCR2 = brd; | ||
153 | |||
154 | /* | ||
155 | * Clear status register | ||
156 | */ | ||
157 | Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; | ||
158 | Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE; | ||
159 | |||
160 | if (si->pdata->set_speed) | ||
161 | si->pdata->set_speed(si->dev, speed); | ||
162 | |||
163 | si->speed = speed; | ||
164 | |||
165 | local_irq_restore(flags); | ||
166 | ret = 0; | ||
167 | break; | ||
168 | |||
169 | case 4000000: | ||
170 | local_irq_save(flags); | ||
171 | |||
172 | si->hscr0 = 0; | ||
173 | |||
174 | Ser2HSSR0 = 0xff; | ||
175 | Ser2HSCR0 = si->hscr0 | HSCR0_HSSP; | ||
176 | Ser2UTCR3 = 0; | ||
177 | |||
178 | si->speed = speed; | ||
179 | |||
180 | if (si->pdata->set_speed) | ||
181 | si->pdata->set_speed(si->dev, speed); | ||
182 | |||
183 | sa1100_irda_rx_alloc(si); | ||
184 | sa1100_irda_rx_dma_start(si); | ||
185 | |||
186 | local_irq_restore(flags); | ||
187 | |||
188 | break; | ||
189 | |||
190 | default: | ||
191 | break; | ||
192 | } | 219 | } |
193 | |||
194 | return ret; | ||
195 | } | 220 | } |
196 | 221 | ||
197 | /* | 222 | /* |
198 | * Control the power state of the IrDA transmitter. | 223 | * HP-SIR format support. |
199 | * State: | ||
200 | * 0 - off | ||
201 | * 1 - short range, lowest power | ||
202 | * 2 - medium range, medium power | ||
203 | * 3 - maximum range, high power | ||
204 | * | ||
205 | * Currently, only assabet is known to support this. | ||
206 | */ | 224 | */ |
207 | static int | 225 | static void sa1100_irda_sirtxdma_irq(void *id) |
208 | __sa1100_irda_set_power(struct sa1100_irda *si, unsigned int state) | ||
209 | { | 226 | { |
210 | int ret = 0; | 227 | struct net_device *dev = id; |
211 | if (si->pdata->set_power) | 228 | struct sa1100_irda *si = netdev_priv(dev); |
212 | ret = si->pdata->set_power(si->dev, state); | ||
213 | return ret; | ||
214 | } | ||
215 | |||
216 | static inline int | ||
217 | sa1100_set_power(struct sa1100_irda *si, unsigned int state) | ||
218 | { | ||
219 | int ret; | ||
220 | |||
221 | ret = __sa1100_irda_set_power(si, state); | ||
222 | if (ret == 0) | ||
223 | si->power = state; | ||
224 | 229 | ||
225 | return ret; | 230 | dma_unmap_sg(si->dma_tx.dev, &si->dma_tx.sg, 1, DMA_TO_DEVICE); |
226 | } | 231 | dev_kfree_skb(si->dma_tx.skb); |
232 | si->dma_tx.skb = NULL; | ||
227 | 233 | ||
228 | static int sa1100_irda_startup(struct sa1100_irda *si) | 234 | dev->stats.tx_packets++; |
229 | { | 235 | dev->stats.tx_bytes += sg_dma_len(&si->dma_tx.sg); |
230 | int ret; | ||
231 | 236 | ||
232 | /* | 237 | /* We need to ensure that the transmitter has finished. */ |
233 | * Ensure that the ports for this device are setup correctly. | 238 | do |
234 | */ | 239 | rmb(); |
235 | if (si->pdata->startup) { | 240 | while (Ser2UTSR1 & UTSR1_TBY); |
236 | ret = si->pdata->startup(si->dev); | ||
237 | if (ret) | ||
238 | return ret; | ||
239 | } | ||
240 | |||
241 | /* | ||
242 | * Configure PPC for IRDA - we want to drive TXD2 low. | ||
243 | * We also want to drive this pin low during sleep. | ||
244 | */ | ||
245 | PPSR &= ~PPC_TXD2; | ||
246 | PSDR &= ~PPC_TXD2; | ||
247 | PPDR |= PPC_TXD2; | ||
248 | |||
249 | /* | ||
250 | * Enable HP-SIR modulation, and ensure that the port is disabled. | ||
251 | */ | ||
252 | Ser2UTCR3 = 0; | ||
253 | Ser2HSCR0 = HSCR0_UART; | ||
254 | Ser2UTCR4 = si->utcr4; | ||
255 | Ser2UTCR0 = UTCR0_8BitData; | ||
256 | Ser2HSCR2 = HSCR2_TrDataH | HSCR2_RcDataL; | ||
257 | 241 | ||
258 | /* | 242 | /* |
259 | * Clear status register | 243 | * Ok, we've finished transmitting. Now enable the receiver. |
244 | * Sometimes we get a receive IRQ immediately after a transmit... | ||
260 | */ | 245 | */ |
261 | Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; | 246 | Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; |
247 | Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE; | ||
262 | 248 | ||
263 | ret = sa1100_irda_set_speed(si, si->speed = 9600); | 249 | sa1100_irda_check_speed(si); |
264 | if (ret) { | ||
265 | Ser2UTCR3 = 0; | ||
266 | Ser2HSCR0 = 0; | ||
267 | |||
268 | if (si->pdata->shutdown) | ||
269 | si->pdata->shutdown(si->dev); | ||
270 | } | ||
271 | |||
272 | return ret; | ||
273 | } | ||
274 | |||
275 | static void sa1100_irda_shutdown(struct sa1100_irda *si) | ||
276 | { | ||
277 | /* | ||
278 | * Stop all DMA activity. | ||
279 | */ | ||
280 | sa1100_stop_dma(si->rxdma); | ||
281 | sa1100_stop_dma(si->txdma); | ||
282 | |||
283 | /* Disable the port. */ | ||
284 | Ser2UTCR3 = 0; | ||
285 | Ser2HSCR0 = 0; | ||
286 | 250 | ||
287 | if (si->pdata->shutdown) | 251 | /* I'm hungry! */ |
288 | si->pdata->shutdown(si->dev); | 252 | netif_wake_queue(dev); |
289 | } | 253 | } |
290 | 254 | ||
291 | #ifdef CONFIG_PM | 255 | static int sa1100_irda_sir_tx_start(struct sk_buff *skb, struct net_device *dev, |
292 | /* | 256 | struct sa1100_irda *si) |
293 | * Suspend the IrDA interface. | ||
294 | */ | ||
295 | static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state) | ||
296 | { | 257 | { |
297 | struct net_device *dev = platform_get_drvdata(pdev); | 258 | si->tx_buff.data = si->tx_buff.head; |
298 | struct sa1100_irda *si; | 259 | si->tx_buff.len = async_wrap_skb(skb, si->tx_buff.data, |
299 | 260 | si->tx_buff.truesize); | |
300 | if (!dev) | 261 | |
301 | return 0; | 262 | si->dma_tx.skb = skb; |
302 | 263 | sg_set_buf(&si->dma_tx.sg, si->tx_buff.data, si->tx_buff.len); | |
303 | si = netdev_priv(dev); | 264 | if (dma_map_sg(si->dma_tx.dev, &si->dma_tx.sg, 1, DMA_TO_DEVICE) == 0) { |
304 | if (si->open) { | 265 | si->dma_tx.skb = NULL; |
305 | /* | 266 | netif_wake_queue(dev); |
306 | * Stop the transmit queue | 267 | dev->stats.tx_dropped++; |
307 | */ | 268 | return NETDEV_TX_OK; |
308 | netif_device_detach(dev); | ||
309 | disable_irq(dev->irq); | ||
310 | sa1100_irda_shutdown(si); | ||
311 | __sa1100_irda_set_power(si, 0); | ||
312 | } | 269 | } |
313 | 270 | ||
314 | return 0; | 271 | sa1100_irda_dma_start(&si->dma_tx, DMA_MEM_TO_DEV, sa1100_irda_sirtxdma_irq, dev); |
315 | } | ||
316 | |||
317 | /* | ||
318 | * Resume the IrDA interface. | ||
319 | */ | ||
320 | static int sa1100_irda_resume(struct platform_device *pdev) | ||
321 | { | ||
322 | struct net_device *dev = platform_get_drvdata(pdev); | ||
323 | struct sa1100_irda *si; | ||
324 | |||
325 | if (!dev) | ||
326 | return 0; | ||
327 | 272 | ||
328 | si = netdev_priv(dev); | 273 | /* |
329 | if (si->open) { | 274 | * The mean turn-around time is enforced by XBOF padding, |
330 | /* | 275 | * so we don't have to do anything special here. |
331 | * If we missed a speed change, initialise at the new speed | 276 | */ |
332 | * directly. It is debatable whether this is actually | 277 | Ser2UTCR3 = UTCR3_TXE; |
333 | * required, but in the interests of continuing from where | ||
334 | * we left off it is desirable. The converse argument is | ||
335 | * that we should re-negotiate at 9600 baud again. | ||
336 | */ | ||
337 | if (si->newspeed) { | ||
338 | si->speed = si->newspeed; | ||
339 | si->newspeed = 0; | ||
340 | } | ||
341 | |||
342 | sa1100_irda_startup(si); | ||
343 | __sa1100_irda_set_power(si, si->power); | ||
344 | enable_irq(dev->irq); | ||
345 | |||
346 | /* | ||
347 | * This automatically wakes up the queue | ||
348 | */ | ||
349 | netif_device_attach(dev); | ||
350 | } | ||
351 | 278 | ||
352 | return 0; | 279 | return NETDEV_TX_OK; |
353 | } | 280 | } |
354 | #else | ||
355 | #define sa1100_irda_suspend NULL | ||
356 | #define sa1100_irda_resume NULL | ||
357 | #endif | ||
358 | 281 | ||
359 | /* | 282 | static irqreturn_t sa1100_irda_sir_irq(struct net_device *dev, struct sa1100_irda *si) |
360 | * HP-SIR format interrupt service routines. | ||
361 | */ | ||
362 | static void sa1100_irda_hpsir_irq(struct net_device *dev) | ||
363 | { | 283 | { |
364 | struct sa1100_irda *si = netdev_priv(dev); | ||
365 | int status; | 284 | int status; |
366 | 285 | ||
367 | status = Ser2UTSR0; | 286 | status = Ser2UTSR0; |
@@ -414,51 +333,96 @@ static void sa1100_irda_hpsir_irq(struct net_device *dev) | |||
414 | 333 | ||
415 | } | 334 | } |
416 | 335 | ||
417 | if (status & UTSR0_TFS && si->tx_buff.len) { | 336 | return IRQ_HANDLED; |
418 | /* | 337 | } |
419 | * Transmitter FIFO is not full | ||
420 | */ | ||
421 | do { | ||
422 | Ser2UTDR = *si->tx_buff.data++; | ||
423 | si->tx_buff.len -= 1; | ||
424 | } while (Ser2UTSR1 & UTSR1_TNF && si->tx_buff.len); | ||
425 | 338 | ||
426 | if (si->tx_buff.len == 0) { | 339 | /* |
427 | dev->stats.tx_packets++; | 340 | * FIR format support. |
428 | dev->stats.tx_bytes += si->tx_buff.data - | 341 | */ |
429 | si->tx_buff.head; | 342 | static void sa1100_irda_firtxdma_irq(void *id) |
343 | { | ||
344 | struct net_device *dev = id; | ||
345 | struct sa1100_irda *si = netdev_priv(dev); | ||
346 | struct sk_buff *skb; | ||
430 | 347 | ||
431 | /* | 348 | /* |
432 | * We need to ensure that the transmitter has | 349 | * Wait for the transmission to complete. Unfortunately, |
433 | * finished. | 350 | * the hardware doesn't give us an interrupt to indicate |
434 | */ | 351 | * "end of frame". |
435 | do | 352 | */ |
436 | rmb(); | 353 | do |
437 | while (Ser2UTSR1 & UTSR1_TBY); | 354 | rmb(); |
355 | while (!(Ser2HSSR0 & HSSR0_TUR) || Ser2HSSR1 & HSSR1_TBY); | ||
438 | 356 | ||
439 | /* | 357 | /* |
440 | * Ok, we've finished transmitting. Now enable | 358 | * Clear the transmit underrun bit. |
441 | * the receiver. Sometimes we get a receive IRQ | 359 | */ |
442 | * immediately after a transmit... | 360 | Ser2HSSR0 = HSSR0_TUR; |
443 | */ | ||
444 | Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; | ||
445 | Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE; | ||
446 | 361 | ||
447 | if (si->newspeed) { | 362 | /* |
448 | sa1100_irda_set_speed(si, si->newspeed); | 363 | * Do we need to change speed? Note that we're lazy |
449 | si->newspeed = 0; | 364 | * here - we don't free the old dma_rx.skb. We don't need |
450 | } | 365 | * to allocate a buffer either. |
366 | */ | ||
367 | sa1100_irda_check_speed(si); | ||
451 | 368 | ||
452 | /* I'm hungry! */ | 369 | /* |
453 | netif_wake_queue(dev); | 370 | * Start reception. This disables the transmitter for |
454 | } | 371 | * us. This will be using the existing RX buffer. |
372 | */ | ||
373 | sa1100_irda_rx_dma_start(si); | ||
374 | |||
375 | /* Account and free the packet. */ | ||
376 | skb = si->dma_tx.skb; | ||
377 | if (skb) { | ||
378 | dma_unmap_sg(si->dma_tx.dev, &si->dma_tx.sg, 1, | ||
379 | DMA_TO_DEVICE); | ||
380 | dev->stats.tx_packets ++; | ||
381 | dev->stats.tx_bytes += skb->len; | ||
382 | dev_kfree_skb_irq(skb); | ||
383 | si->dma_tx.skb = NULL; | ||
455 | } | 384 | } |
385 | |||
386 | /* | ||
387 | * Make sure that the TX queue is available for sending | ||
388 | * (for retries). TX has priority over RX at all times. | ||
389 | */ | ||
390 | netif_wake_queue(dev); | ||
391 | } | ||
392 | |||
393 | static int sa1100_irda_fir_tx_start(struct sk_buff *skb, struct net_device *dev, | ||
394 | struct sa1100_irda *si) | ||
395 | { | ||
396 | int mtt = irda_get_mtt(skb); | ||
397 | |||
398 | si->dma_tx.skb = skb; | ||
399 | sg_set_buf(&si->dma_tx.sg, skb->data, skb->len); | ||
400 | if (dma_map_sg(si->dma_tx.dev, &si->dma_tx.sg, 1, DMA_TO_DEVICE) == 0) { | ||
401 | si->dma_tx.skb = NULL; | ||
402 | netif_wake_queue(dev); | ||
403 | dev->stats.tx_dropped++; | ||
404 | dev_kfree_skb(skb); | ||
405 | return NETDEV_TX_OK; | ||
406 | } | ||
407 | |||
408 | sa1100_irda_dma_start(&si->dma_tx, DMA_MEM_TO_DEV, sa1100_irda_firtxdma_irq, dev); | ||
409 | |||
410 | /* | ||
411 | * If we have a mean turn-around time, impose the specified | ||
412 | * specified delay. We could shorten this by timing from | ||
413 | * the point we received the packet. | ||
414 | */ | ||
415 | if (mtt) | ||
416 | udelay(mtt); | ||
417 | |||
418 | Ser2HSCR0 = HSCR0_HSSP | HSCR0_TXE; | ||
419 | |||
420 | return NETDEV_TX_OK; | ||
456 | } | 421 | } |
457 | 422 | ||
458 | static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev) | 423 | static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev) |
459 | { | 424 | { |
460 | struct sk_buff *skb = si->rxskb; | 425 | struct sk_buff *skb = si->dma_rx.skb; |
461 | dma_addr_t dma_addr; | ||
462 | unsigned int len, stat, data; | 426 | unsigned int len, stat, data; |
463 | 427 | ||
464 | if (!skb) { | 428 | if (!skb) { |
@@ -469,11 +433,10 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev | |||
469 | /* | 433 | /* |
470 | * Get the current data position. | 434 | * Get the current data position. |
471 | */ | 435 | */ |
472 | dma_addr = sa1100_get_dma_pos(si->rxdma); | 436 | len = sa1100_irda_dma_xferred(&si->dma_rx); |
473 | len = dma_addr - si->rxbuf_dma; | ||
474 | if (len > HPSIR_MAX_RXLEN) | 437 | if (len > HPSIR_MAX_RXLEN) |
475 | len = HPSIR_MAX_RXLEN; | 438 | len = HPSIR_MAX_RXLEN; |
476 | dma_unmap_single(si->dev, si->rxbuf_dma, len, DMA_FROM_DEVICE); | 439 | dma_unmap_sg(si->dma_rx.dev, &si->dma_rx.sg, 1, DMA_FROM_DEVICE); |
477 | 440 | ||
478 | do { | 441 | do { |
479 | /* | 442 | /* |
@@ -501,7 +464,7 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev | |||
501 | } while (Ser2HSSR0 & HSSR0_EIF); | 464 | } while (Ser2HSSR0 & HSSR0_EIF); |
502 | 465 | ||
503 | if (stat & HSSR1_EOF) { | 466 | if (stat & HSSR1_EOF) { |
504 | si->rxskb = NULL; | 467 | si->dma_rx.skb = NULL; |
505 | 468 | ||
506 | skb_put(skb, len); | 469 | skb_put(skb, len); |
507 | skb->dev = dev; | 470 | skb->dev = dev; |
@@ -518,28 +481,23 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev | |||
518 | netif_rx(skb); | 481 | netif_rx(skb); |
519 | } else { | 482 | } else { |
520 | /* | 483 | /* |
521 | * Remap the buffer. | 484 | * Remap the buffer - it was previously mapped, and we |
485 | * hope that this succeeds. | ||
522 | */ | 486 | */ |
523 | si->rxbuf_dma = dma_map_single(si->dev, si->rxskb->data, | 487 | dma_map_sg(si->dma_rx.dev, &si->dma_rx.sg, 1, DMA_FROM_DEVICE); |
524 | HPSIR_MAX_RXLEN, | ||
525 | DMA_FROM_DEVICE); | ||
526 | } | 488 | } |
527 | } | 489 | } |
528 | 490 | ||
529 | /* | 491 | /* |
530 | * FIR format interrupt service routine. We only have to | 492 | * We only have to handle RX events here; transmit events go via the TX |
531 | * handle RX events; transmit events go via the TX DMA handler. | 493 | * DMA handler. We disable RX, process, and the restart RX. |
532 | * | ||
533 | * No matter what, we disable RX, process, and the restart RX. | ||
534 | */ | 494 | */ |
535 | static void sa1100_irda_fir_irq(struct net_device *dev) | 495 | static irqreturn_t sa1100_irda_fir_irq(struct net_device *dev, struct sa1100_irda *si) |
536 | { | 496 | { |
537 | struct sa1100_irda *si = netdev_priv(dev); | ||
538 | |||
539 | /* | 497 | /* |
540 | * Stop RX DMA | 498 | * Stop RX DMA |
541 | */ | 499 | */ |
542 | sa1100_stop_dma(si->rxdma); | 500 | dmaengine_pause(si->dma_rx.chan); |
543 | 501 | ||
544 | /* | 502 | /* |
545 | * Framing error - we throw away the packet completely. | 503 | * Framing error - we throw away the packet completely. |
@@ -555,7 +513,7 @@ static void sa1100_irda_fir_irq(struct net_device *dev) | |||
555 | /* | 513 | /* |
556 | * Clear out the DMA... | 514 | * Clear out the DMA... |
557 | */ | 515 | */ |
558 | Ser2HSCR0 = si->hscr0 | HSCR0_HSSP; | 516 | Ser2HSCR0 = HSCR0_HSSP; |
559 | 517 | ||
560 | /* | 518 | /* |
561 | * Clear selected status bits now, so we | 519 | * Clear selected status bits now, so we |
@@ -577,74 +535,124 @@ static void sa1100_irda_fir_irq(struct net_device *dev) | |||
577 | * No matter what happens, we must restart reception. | 535 | * No matter what happens, we must restart reception. |
578 | */ | 536 | */ |
579 | sa1100_irda_rx_dma_start(si); | 537 | sa1100_irda_rx_dma_start(si); |
580 | } | ||
581 | 538 | ||
582 | static irqreturn_t sa1100_irda_irq(int irq, void *dev_id) | ||
583 | { | ||
584 | struct net_device *dev = dev_id; | ||
585 | if (IS_FIR(((struct sa1100_irda *)netdev_priv(dev)))) | ||
586 | sa1100_irda_fir_irq(dev); | ||
587 | else | ||
588 | sa1100_irda_hpsir_irq(dev); | ||
589 | return IRQ_HANDLED; | 539 | return IRQ_HANDLED; |
590 | } | 540 | } |
591 | 541 | ||
592 | /* | 542 | /* |
593 | * TX DMA completion handler. | 543 | * Set the IrDA communications speed. |
594 | */ | 544 | */ |
595 | static void sa1100_irda_txdma_irq(void *id) | 545 | static int sa1100_irda_set_speed(struct sa1100_irda *si, int speed) |
596 | { | 546 | { |
597 | struct net_device *dev = id; | 547 | unsigned long flags; |
598 | struct sa1100_irda *si = netdev_priv(dev); | 548 | int brd, ret = -EINVAL; |
599 | struct sk_buff *skb = si->txskb; | ||
600 | 549 | ||
601 | si->txskb = NULL; | 550 | switch (speed) { |
551 | case 9600: case 19200: case 38400: | ||
552 | case 57600: case 115200: | ||
553 | brd = 3686400 / (16 * speed) - 1; | ||
602 | 554 | ||
603 | /* | 555 | /* Stop the receive DMA, and configure transmit. */ |
604 | * Wait for the transmission to complete. Unfortunately, | 556 | if (IS_FIR(si)) { |
605 | * the hardware doesn't give us an interrupt to indicate | 557 | dmaengine_terminate_all(si->dma_rx.chan); |
606 | * "end of frame". | 558 | dmaengine_slave_config(si->dma_tx.chan, |
607 | */ | 559 | &sa1100_irda_sir_tx); |
608 | do | 560 | } |
609 | rmb(); | ||
610 | while (!(Ser2HSSR0 & HSSR0_TUR) || Ser2HSSR1 & HSSR1_TBY); | ||
611 | 561 | ||
612 | /* | 562 | local_irq_save(flags); |
613 | * Clear the transmit underrun bit. | ||
614 | */ | ||
615 | Ser2HSSR0 = HSSR0_TUR; | ||
616 | 563 | ||
617 | /* | 564 | Ser2UTCR3 = 0; |
618 | * Do we need to change speed? Note that we're lazy | 565 | Ser2HSCR0 = HSCR0_UART; |
619 | * here - we don't free the old rxskb. We don't need | ||
620 | * to allocate a buffer either. | ||
621 | */ | ||
622 | if (si->newspeed) { | ||
623 | sa1100_irda_set_speed(si, si->newspeed); | ||
624 | si->newspeed = 0; | ||
625 | } | ||
626 | 566 | ||
627 | /* | 567 | Ser2UTCR1 = brd >> 8; |
628 | * Start reception. This disables the transmitter for | 568 | Ser2UTCR2 = brd; |
629 | * us. This will be using the existing RX buffer. | ||
630 | */ | ||
631 | sa1100_irda_rx_dma_start(si); | ||
632 | 569 | ||
633 | /* | 570 | /* |
634 | * Account and free the packet. | 571 | * Clear status register |
635 | */ | 572 | */ |
636 | if (skb) { | 573 | Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; |
637 | dma_unmap_single(si->dev, si->txbuf_dma, skb->len, DMA_TO_DEVICE); | 574 | Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE; |
638 | dev->stats.tx_packets ++; | 575 | |
639 | dev->stats.tx_bytes += skb->len; | 576 | if (si->pdata->set_speed) |
640 | dev_kfree_skb_irq(skb); | 577 | si->pdata->set_speed(si->dev, speed); |
578 | |||
579 | si->speed = speed; | ||
580 | si->tx_start = sa1100_irda_sir_tx_start; | ||
581 | si->irq = sa1100_irda_sir_irq; | ||
582 | |||
583 | local_irq_restore(flags); | ||
584 | ret = 0; | ||
585 | break; | ||
586 | |||
587 | case 4000000: | ||
588 | if (!IS_FIR(si)) | ||
589 | dmaengine_slave_config(si->dma_tx.chan, | ||
590 | &sa1100_irda_fir_tx); | ||
591 | |||
592 | local_irq_save(flags); | ||
593 | |||
594 | Ser2HSSR0 = 0xff; | ||
595 | Ser2HSCR0 = HSCR0_HSSP; | ||
596 | Ser2UTCR3 = 0; | ||
597 | |||
598 | si->speed = speed; | ||
599 | si->tx_start = sa1100_irda_fir_tx_start; | ||
600 | si->irq = sa1100_irda_fir_irq; | ||
601 | |||
602 | if (si->pdata->set_speed) | ||
603 | si->pdata->set_speed(si->dev, speed); | ||
604 | |||
605 | sa1100_irda_rx_alloc(si); | ||
606 | sa1100_irda_rx_dma_start(si); | ||
607 | |||
608 | local_irq_restore(flags); | ||
609 | |||
610 | break; | ||
611 | |||
612 | default: | ||
613 | break; | ||
641 | } | 614 | } |
642 | 615 | ||
643 | /* | 616 | return ret; |
644 | * Make sure that the TX queue is available for sending | 617 | } |
645 | * (for retries). TX has priority over RX at all times. | 618 | |
646 | */ | 619 | /* |
647 | netif_wake_queue(dev); | 620 | * Control the power state of the IrDA transmitter. |
621 | * State: | ||
622 | * 0 - off | ||
623 | * 1 - short range, lowest power | ||
624 | * 2 - medium range, medium power | ||
625 | * 3 - maximum range, high power | ||
626 | * | ||
627 | * Currently, only assabet is known to support this. | ||
628 | */ | ||
629 | static int | ||
630 | __sa1100_irda_set_power(struct sa1100_irda *si, unsigned int state) | ||
631 | { | ||
632 | int ret = 0; | ||
633 | if (si->pdata->set_power) | ||
634 | ret = si->pdata->set_power(si->dev, state); | ||
635 | return ret; | ||
636 | } | ||
637 | |||
638 | static inline int | ||
639 | sa1100_set_power(struct sa1100_irda *si, unsigned int state) | ||
640 | { | ||
641 | int ret; | ||
642 | |||
643 | ret = __sa1100_irda_set_power(si, state); | ||
644 | if (ret == 0) | ||
645 | si->power = state; | ||
646 | |||
647 | return ret; | ||
648 | } | ||
649 | |||
650 | static irqreturn_t sa1100_irda_irq(int irq, void *dev_id) | ||
651 | { | ||
652 | struct net_device *dev = dev_id; | ||
653 | struct sa1100_irda *si = netdev_priv(dev); | ||
654 | |||
655 | return si->irq(dev, si); | ||
648 | } | 656 | } |
649 | 657 | ||
650 | static int sa1100_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) | 658 | static int sa1100_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) |
@@ -660,62 +668,19 @@ static int sa1100_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) | |||
660 | if (speed != si->speed && speed != -1) | 668 | if (speed != si->speed && speed != -1) |
661 | si->newspeed = speed; | 669 | si->newspeed = speed; |
662 | 670 | ||
663 | /* | 671 | /* If this is an empty frame, we can bypass a lot. */ |
664 | * If this is an empty frame, we can bypass a lot. | ||
665 | */ | ||
666 | if (skb->len == 0) { | 672 | if (skb->len == 0) { |
667 | if (si->newspeed) { | 673 | sa1100_irda_check_speed(si); |
668 | si->newspeed = 0; | ||
669 | sa1100_irda_set_speed(si, speed); | ||
670 | } | ||
671 | dev_kfree_skb(skb); | 674 | dev_kfree_skb(skb); |
672 | return NETDEV_TX_OK; | 675 | return NETDEV_TX_OK; |
673 | } | 676 | } |
674 | 677 | ||
675 | if (!IS_FIR(si)) { | 678 | netif_stop_queue(dev); |
676 | netif_stop_queue(dev); | ||
677 | |||
678 | si->tx_buff.data = si->tx_buff.head; | ||
679 | si->tx_buff.len = async_wrap_skb(skb, si->tx_buff.data, | ||
680 | si->tx_buff.truesize); | ||
681 | |||
682 | /* | ||
683 | * Set the transmit interrupt enable. This will fire | ||
684 | * off an interrupt immediately. Note that we disable | ||
685 | * the receiver so we won't get spurious characteres | ||
686 | * received. | ||
687 | */ | ||
688 | Ser2UTCR3 = UTCR3_TIE | UTCR3_TXE; | ||
689 | |||
690 | dev_kfree_skb(skb); | ||
691 | } else { | ||
692 | int mtt = irda_get_mtt(skb); | ||
693 | |||
694 | /* | ||
695 | * We must not be transmitting... | ||
696 | */ | ||
697 | BUG_ON(si->txskb); | ||
698 | |||
699 | netif_stop_queue(dev); | ||
700 | |||
701 | si->txskb = skb; | ||
702 | si->txbuf_dma = dma_map_single(si->dev, skb->data, | ||
703 | skb->len, DMA_TO_DEVICE); | ||
704 | |||
705 | sa1100_start_dma(si->txdma, si->txbuf_dma, skb->len); | ||
706 | |||
707 | /* | ||
708 | * If we have a mean turn-around time, impose the specified | ||
709 | * specified delay. We could shorten this by timing from | ||
710 | * the point we received the packet. | ||
711 | */ | ||
712 | if (mtt) | ||
713 | udelay(mtt); | ||
714 | 679 | ||
715 | Ser2HSCR0 = si->hscr0 | HSCR0_HSSP | HSCR0_TXE; | 680 | /* We must not already have a skb to transmit... */ |
716 | } | 681 | BUG_ON(si->dma_tx.skb); |
717 | 682 | ||
718 | return NETDEV_TX_OK; | 683 | return si->tx_start(skb, dev, si); |
719 | } | 684 | } |
720 | 685 | ||
721 | static int | 686 | static int |
@@ -762,6 +727,69 @@ sa1100_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd) | |||
762 | return ret; | 727 | return ret; |
763 | } | 728 | } |
764 | 729 | ||
730 | static int sa1100_irda_startup(struct sa1100_irda *si) | ||
731 | { | ||
732 | int ret; | ||
733 | |||
734 | /* | ||
735 | * Ensure that the ports for this device are setup correctly. | ||
736 | */ | ||
737 | if (si->pdata->startup) { | ||
738 | ret = si->pdata->startup(si->dev); | ||
739 | if (ret) | ||
740 | return ret; | ||
741 | } | ||
742 | |||
743 | /* | ||
744 | * Configure PPC for IRDA - we want to drive TXD2 low. | ||
745 | * We also want to drive this pin low during sleep. | ||
746 | */ | ||
747 | PPSR &= ~PPC_TXD2; | ||
748 | PSDR &= ~PPC_TXD2; | ||
749 | PPDR |= PPC_TXD2; | ||
750 | |||
751 | /* | ||
752 | * Enable HP-SIR modulation, and ensure that the port is disabled. | ||
753 | */ | ||
754 | Ser2UTCR3 = 0; | ||
755 | Ser2HSCR0 = HSCR0_UART; | ||
756 | Ser2UTCR4 = si->utcr4; | ||
757 | Ser2UTCR0 = UTCR0_8BitData; | ||
758 | Ser2HSCR2 = HSCR2_TrDataH | HSCR2_RcDataL; | ||
759 | |||
760 | /* | ||
761 | * Clear status register | ||
762 | */ | ||
763 | Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; | ||
764 | |||
765 | ret = sa1100_irda_set_speed(si, si->speed = 9600); | ||
766 | if (ret) { | ||
767 | Ser2UTCR3 = 0; | ||
768 | Ser2HSCR0 = 0; | ||
769 | |||
770 | if (si->pdata->shutdown) | ||
771 | si->pdata->shutdown(si->dev); | ||
772 | } | ||
773 | |||
774 | return ret; | ||
775 | } | ||
776 | |||
777 | static void sa1100_irda_shutdown(struct sa1100_irda *si) | ||
778 | { | ||
779 | /* | ||
780 | * Stop all DMA activity. | ||
781 | */ | ||
782 | dmaengine_terminate_all(si->dma_rx.chan); | ||
783 | dmaengine_terminate_all(si->dma_tx.chan); | ||
784 | |||
785 | /* Disable the port. */ | ||
786 | Ser2UTCR3 = 0; | ||
787 | Ser2HSCR0 = 0; | ||
788 | |||
789 | if (si->pdata->shutdown) | ||
790 | si->pdata->shutdown(si->dev); | ||
791 | } | ||
792 | |||
765 | static int sa1100_irda_start(struct net_device *dev) | 793 | static int sa1100_irda_start(struct net_device *dev) |
766 | { | 794 | { |
767 | struct sa1100_irda *si = netdev_priv(dev); | 795 | struct sa1100_irda *si = netdev_priv(dev); |
@@ -769,26 +797,17 @@ static int sa1100_irda_start(struct net_device *dev) | |||
769 | 797 | ||
770 | si->speed = 9600; | 798 | si->speed = 9600; |
771 | 799 | ||
772 | err = request_irq(dev->irq, sa1100_irda_irq, 0, dev->name, dev); | 800 | err = sa1100_irda_dma_request(si->dev, &si->dma_rx, "Ser2ICPRc", |
773 | if (err) | 801 | &sa1100_irda_fir_rx); |
774 | goto err_irq; | ||
775 | |||
776 | err = sa1100_request_dma(DMA_Ser2HSSPRd, "IrDA receive", | ||
777 | NULL, NULL, &si->rxdma); | ||
778 | if (err) | 802 | if (err) |
779 | goto err_rx_dma; | 803 | goto err_rx_dma; |
780 | 804 | ||
781 | err = sa1100_request_dma(DMA_Ser2HSSPWr, "IrDA transmit", | 805 | err = sa1100_irda_dma_request(si->dev, &si->dma_tx, "Ser2ICPTr", |
782 | sa1100_irda_txdma_irq, dev, &si->txdma); | 806 | &sa1100_irda_sir_tx); |
783 | if (err) | 807 | if (err) |
784 | goto err_tx_dma; | 808 | goto err_tx_dma; |
785 | 809 | ||
786 | /* | 810 | /* |
787 | * The interrupt must remain disabled for now. | ||
788 | */ | ||
789 | disable_irq(dev->irq); | ||
790 | |||
791 | /* | ||
792 | * Setup the serial port for the specified speed. | 811 | * Setup the serial port for the specified speed. |
793 | */ | 812 | */ |
794 | err = sa1100_irda_startup(si); | 813 | err = sa1100_irda_startup(si); |
@@ -803,44 +822,60 @@ static int sa1100_irda_start(struct net_device *dev) | |||
803 | if (!si->irlap) | 822 | if (!si->irlap) |
804 | goto err_irlap; | 823 | goto err_irlap; |
805 | 824 | ||
825 | err = request_irq(dev->irq, sa1100_irda_irq, 0, dev->name, dev); | ||
826 | if (err) | ||
827 | goto err_irq; | ||
828 | |||
806 | /* | 829 | /* |
807 | * Now enable the interrupt and start the queue | 830 | * Now enable the interrupt and start the queue |
808 | */ | 831 | */ |
809 | si->open = 1; | 832 | si->open = 1; |
810 | sa1100_set_power(si, power_level); /* low power mode */ | 833 | sa1100_set_power(si, power_level); /* low power mode */ |
811 | enable_irq(dev->irq); | 834 | |
812 | netif_start_queue(dev); | 835 | netif_start_queue(dev); |
813 | return 0; | 836 | return 0; |
814 | 837 | ||
838 | err_irq: | ||
839 | irlap_close(si->irlap); | ||
815 | err_irlap: | 840 | err_irlap: |
816 | si->open = 0; | 841 | si->open = 0; |
817 | sa1100_irda_shutdown(si); | 842 | sa1100_irda_shutdown(si); |
818 | err_startup: | 843 | err_startup: |
819 | sa1100_free_dma(si->txdma); | 844 | dma_release_channel(si->dma_tx.chan); |
820 | err_tx_dma: | 845 | err_tx_dma: |
821 | sa1100_free_dma(si->rxdma); | 846 | dma_release_channel(si->dma_rx.chan); |
822 | err_rx_dma: | 847 | err_rx_dma: |
823 | free_irq(dev->irq, dev); | ||
824 | err_irq: | ||
825 | return err; | 848 | return err; |
826 | } | 849 | } |
827 | 850 | ||
828 | static int sa1100_irda_stop(struct net_device *dev) | 851 | static int sa1100_irda_stop(struct net_device *dev) |
829 | { | 852 | { |
830 | struct sa1100_irda *si = netdev_priv(dev); | 853 | struct sa1100_irda *si = netdev_priv(dev); |
854 | struct sk_buff *skb; | ||
855 | |||
856 | netif_stop_queue(dev); | ||
831 | 857 | ||
832 | disable_irq(dev->irq); | 858 | si->open = 0; |
833 | sa1100_irda_shutdown(si); | 859 | sa1100_irda_shutdown(si); |
834 | 860 | ||
835 | /* | 861 | /* |
836 | * If we have been doing DMA receive, make sure we | 862 | * If we have been doing any DMA activity, make sure we |
837 | * tidy that up cleanly. | 863 | * tidy that up cleanly. |
838 | */ | 864 | */ |
839 | if (si->rxskb) { | 865 | skb = si->dma_rx.skb; |
840 | dma_unmap_single(si->dev, si->rxbuf_dma, HPSIR_MAX_RXLEN, | 866 | if (skb) { |
841 | DMA_FROM_DEVICE); | 867 | dma_unmap_sg(si->dma_rx.dev, &si->dma_rx.sg, 1, |
842 | dev_kfree_skb(si->rxskb); | 868 | DMA_FROM_DEVICE); |
843 | si->rxskb = NULL; | 869 | dev_kfree_skb(skb); |
870 | si->dma_rx.skb = NULL; | ||
871 | } | ||
872 | |||
873 | skb = si->dma_tx.skb; | ||
874 | if (skb) { | ||
875 | dma_unmap_sg(si->dma_tx.dev, &si->dma_tx.sg, 1, | ||
876 | DMA_TO_DEVICE); | ||
877 | dev_kfree_skb(skb); | ||
878 | si->dma_tx.skb = NULL; | ||
844 | } | 879 | } |
845 | 880 | ||
846 | /* Stop IrLAP */ | 881 | /* Stop IrLAP */ |
@@ -849,14 +884,11 @@ static int sa1100_irda_stop(struct net_device *dev) | |||
849 | si->irlap = NULL; | 884 | si->irlap = NULL; |
850 | } | 885 | } |
851 | 886 | ||
852 | netif_stop_queue(dev); | ||
853 | si->open = 0; | ||
854 | |||
855 | /* | 887 | /* |
856 | * Free resources | 888 | * Free resources |
857 | */ | 889 | */ |
858 | sa1100_free_dma(si->txdma); | 890 | dma_release_channel(si->dma_tx.chan); |
859 | sa1100_free_dma(si->rxdma); | 891 | dma_release_channel(si->dma_rx.chan); |
860 | free_irq(dev->irq, dev); | 892 | free_irq(dev->irq, dev); |
861 | 893 | ||
862 | sa1100_set_power(si, 0); | 894 | sa1100_set_power(si, 0); |
@@ -888,11 +920,15 @@ static int sa1100_irda_probe(struct platform_device *pdev) | |||
888 | struct net_device *dev; | 920 | struct net_device *dev; |
889 | struct sa1100_irda *si; | 921 | struct sa1100_irda *si; |
890 | unsigned int baudrate_mask; | 922 | unsigned int baudrate_mask; |
891 | int err; | 923 | int err, irq; |
892 | 924 | ||
893 | if (!pdev->dev.platform_data) | 925 | if (!pdev->dev.platform_data) |
894 | return -EINVAL; | 926 | return -EINVAL; |
895 | 927 | ||
928 | irq = platform_get_irq(pdev, 0); | ||
929 | if (irq <= 0) | ||
930 | return irq < 0 ? irq : -ENXIO; | ||
931 | |||
896 | err = request_mem_region(__PREG(Ser2UTCR0), 0x24, "IrDA") ? 0 : -EBUSY; | 932 | err = request_mem_region(__PREG(Ser2UTCR0), 0x24, "IrDA") ? 0 : -EBUSY; |
897 | if (err) | 933 | if (err) |
898 | goto err_mem_1; | 934 | goto err_mem_1; |
@@ -907,22 +943,27 @@ static int sa1100_irda_probe(struct platform_device *pdev) | |||
907 | if (!dev) | 943 | if (!dev) |
908 | goto err_mem_4; | 944 | goto err_mem_4; |
909 | 945 | ||
946 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
947 | |||
910 | si = netdev_priv(dev); | 948 | si = netdev_priv(dev); |
911 | si->dev = &pdev->dev; | 949 | si->dev = &pdev->dev; |
912 | si->pdata = pdev->dev.platform_data; | 950 | si->pdata = pdev->dev.platform_data; |
913 | 951 | ||
952 | sg_init_table(&si->dma_rx.sg, 1); | ||
953 | sg_init_table(&si->dma_tx.sg, 1); | ||
954 | |||
914 | /* | 955 | /* |
915 | * Initialise the HP-SIR buffers | 956 | * Initialise the HP-SIR buffers |
916 | */ | 957 | */ |
917 | err = sa1100_irda_init_iobuf(&si->rx_buff, 14384); | 958 | err = sa1100_irda_init_iobuf(&si->rx_buff, 14384); |
918 | if (err) | 959 | if (err) |
919 | goto err_mem_5; | 960 | goto err_mem_5; |
920 | err = sa1100_irda_init_iobuf(&si->tx_buff, 4000); | 961 | err = sa1100_irda_init_iobuf(&si->tx_buff, IRDA_SIR_MAX_FRAME); |
921 | if (err) | 962 | if (err) |
922 | goto err_mem_5; | 963 | goto err_mem_5; |
923 | 964 | ||
924 | dev->netdev_ops = &sa1100_irda_netdev_ops; | 965 | dev->netdev_ops = &sa1100_irda_netdev_ops; |
925 | dev->irq = IRQ_Ser2ICP; | 966 | dev->irq = irq; |
926 | 967 | ||
927 | irda_init_max_qos_capabilies(&si->qos); | 968 | irda_init_max_qos_capabilies(&si->qos); |
928 | 969 | ||
@@ -996,6 +1037,74 @@ static int sa1100_irda_remove(struct platform_device *pdev) | |||
996 | return 0; | 1037 | return 0; |
997 | } | 1038 | } |
998 | 1039 | ||
1040 | #ifdef CONFIG_PM | ||
1041 | /* | ||
1042 | * Suspend the IrDA interface. | ||
1043 | */ | ||
1044 | static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state) | ||
1045 | { | ||
1046 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1047 | struct sa1100_irda *si; | ||
1048 | |||
1049 | if (!dev) | ||
1050 | return 0; | ||
1051 | |||
1052 | si = netdev_priv(dev); | ||
1053 | if (si->open) { | ||
1054 | /* | ||
1055 | * Stop the transmit queue | ||
1056 | */ | ||
1057 | netif_device_detach(dev); | ||
1058 | disable_irq(dev->irq); | ||
1059 | sa1100_irda_shutdown(si); | ||
1060 | __sa1100_irda_set_power(si, 0); | ||
1061 | } | ||
1062 | |||
1063 | return 0; | ||
1064 | } | ||
1065 | |||
1066 | /* | ||
1067 | * Resume the IrDA interface. | ||
1068 | */ | ||
1069 | static int sa1100_irda_resume(struct platform_device *pdev) | ||
1070 | { | ||
1071 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1072 | struct sa1100_irda *si; | ||
1073 | |||
1074 | if (!dev) | ||
1075 | return 0; | ||
1076 | |||
1077 | si = netdev_priv(dev); | ||
1078 | if (si->open) { | ||
1079 | /* | ||
1080 | * If we missed a speed change, initialise at the new speed | ||
1081 | * directly. It is debatable whether this is actually | ||
1082 | * required, but in the interests of continuing from where | ||
1083 | * we left off it is desirable. The converse argument is | ||
1084 | * that we should re-negotiate at 9600 baud again. | ||
1085 | */ | ||
1086 | if (si->newspeed) { | ||
1087 | si->speed = si->newspeed; | ||
1088 | si->newspeed = 0; | ||
1089 | } | ||
1090 | |||
1091 | sa1100_irda_startup(si); | ||
1092 | __sa1100_irda_set_power(si, si->power); | ||
1093 | enable_irq(dev->irq); | ||
1094 | |||
1095 | /* | ||
1096 | * This automatically wakes up the queue | ||
1097 | */ | ||
1098 | netif_device_attach(dev); | ||
1099 | } | ||
1100 | |||
1101 | return 0; | ||
1102 | } | ||
1103 | #else | ||
1104 | #define sa1100_irda_suspend NULL | ||
1105 | #define sa1100_irda_resume NULL | ||
1106 | #endif | ||
1107 | |||
999 | static struct platform_driver sa1100ir_driver = { | 1108 | static struct platform_driver sa1100ir_driver = { |
1000 | .probe = sa1100_irda_probe, | 1109 | .probe = sa1100_irda_probe, |
1001 | .remove = sa1100_irda_remove, | 1110 | .remove = sa1100_irda_remove, |
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index 790cbdea7392..3886b30ed373 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c | |||
@@ -164,12 +164,14 @@ static void rx_complete(struct urb *req) | |||
164 | /* Can't use pskb_pull() on page in IRQ */ | 164 | /* Can't use pskb_pull() on page in IRQ */ |
165 | memcpy(skb_put(skb, 1), page_address(page), 1); | 165 | memcpy(skb_put(skb, 1), page_address(page), 1); |
166 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, | 166 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
167 | page, 1, req->actual_length); | 167 | page, 1, req->actual_length, |
168 | req->actual_length); | ||
168 | page = NULL; | 169 | page = NULL; |
169 | } | 170 | } |
170 | } else { | 171 | } else { |
171 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, | 172 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
172 | page, 0, req->actual_length); | 173 | page, 0, req->actual_length, |
174 | req->actual_length); | ||
173 | page = NULL; | 175 | page = NULL; |
174 | } | 176 | } |
175 | if (req->actual_length < PAGE_SIZE) | 177 | if (req->actual_length < PAGE_SIZE) |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index aac68f5195c0..552d24bf862e 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -409,6 +409,42 @@ static const struct usb_device_id products[] = { | |||
409 | .bInterfaceProtocol = 0xff, | 409 | .bInterfaceProtocol = 0xff, |
410 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | 410 | .driver_info = (unsigned long)&qmi_wwan_force_int4, |
411 | }, | 411 | }, |
412 | { /* ZTE (Vodafone) K3565-Z */ | ||
413 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | ||
414 | .idVendor = 0x19d2, | ||
415 | .idProduct = 0x0063, | ||
416 | .bInterfaceClass = 0xff, | ||
417 | .bInterfaceSubClass = 0xff, | ||
418 | .bInterfaceProtocol = 0xff, | ||
419 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | ||
420 | }, | ||
421 | { /* ZTE (Vodafone) K3570-Z */ | ||
422 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | ||
423 | .idVendor = 0x19d2, | ||
424 | .idProduct = 0x1008, | ||
425 | .bInterfaceClass = 0xff, | ||
426 | .bInterfaceSubClass = 0xff, | ||
427 | .bInterfaceProtocol = 0xff, | ||
428 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | ||
429 | }, | ||
430 | { /* ZTE (Vodafone) K3571-Z */ | ||
431 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | ||
432 | .idVendor = 0x19d2, | ||
433 | .idProduct = 0x1010, | ||
434 | .bInterfaceClass = 0xff, | ||
435 | .bInterfaceSubClass = 0xff, | ||
436 | .bInterfaceProtocol = 0xff, | ||
437 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | ||
438 | }, | ||
439 | { /* ZTE (Vodafone) K4505-Z */ | ||
440 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | ||
441 | .idVendor = 0x19d2, | ||
442 | .idProduct = 0x0104, | ||
443 | .bInterfaceClass = 0xff, | ||
444 | .bInterfaceSubClass = 0xff, | ||
445 | .bInterfaceProtocol = 0xff, | ||
446 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | ||
447 | }, | ||
412 | {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 448 | {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
413 | {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ | 449 | {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ |
414 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ | 450 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ |
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c index c5b1d199e0bc..b25c01be0d90 100644 --- a/drivers/net/wireless/iwlegacy/3945.c +++ b/drivers/net/wireless/iwlegacy/3945.c | |||
@@ -499,7 +499,8 @@ il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb, | |||
499 | le32_to_cpu(rx_end->status), stats); | 499 | le32_to_cpu(rx_end->status), stats); |
500 | 500 | ||
501 | skb_add_rx_frag(skb, 0, rxb->page, | 501 | skb_add_rx_frag(skb, 0, rxb->page, |
502 | (void *)rx_hdr->payload - (void *)pkt, len); | 502 | (void *)rx_hdr->payload - (void *)pkt, len, |
503 | len); | ||
503 | 504 | ||
504 | il_update_stats(il, false, fc, len); | 505 | il_update_stats(il, false, fc, len); |
505 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | 506 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 7b54dbb338be..17f1c6853182 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -596,7 +596,8 @@ il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr, | |||
596 | return; | 596 | return; |
597 | } | 597 | } |
598 | 598 | ||
599 | skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len); | 599 | skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len, |
600 | len); | ||
600 | 601 | ||
601 | il_update_stats(il, false, fc, len); | 602 | il_update_stats(il, false, fc, len); |
602 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | 603 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c index 44c6f712b77d..f4b84d1596e3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c | |||
@@ -796,7 +796,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
796 | 796 | ||
797 | offset = (void *)hdr - rxb_addr(rxb); | 797 | offset = (void *)hdr - rxb_addr(rxb); |
798 | p = rxb_steal_page(rxb); | 798 | p = rxb_steal_page(rxb); |
799 | skb_add_rx_frag(skb, 0, p, offset, len); | 799 | skb_add_rx_frag(skb, 0, p, offset, len, len); |
800 | 800 | ||
801 | iwl_update_stats(priv, false, fc, len); | 801 | iwl_update_stats(priv, false, fc, len); |
802 | 802 | ||