diff options
Diffstat (limited to 'drivers')
115 files changed, 3574 insertions, 600 deletions
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 95650f83ce2e..bc46de3d967f 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c | |||
@@ -116,9 +116,6 @@ int acpi_pci_bind(struct acpi_device *device) | |||
116 | struct acpi_pci_data *pdata; | 116 | struct acpi_pci_data *pdata; |
117 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 117 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
118 | acpi_handle handle; | 118 | acpi_handle handle; |
119 | struct pci_dev *dev; | ||
120 | struct pci_bus *bus; | ||
121 | |||
122 | 119 | ||
123 | if (!device || !device->parent) | 120 | if (!device || !device->parent) |
124 | return -EINVAL; | 121 | return -EINVAL; |
@@ -176,20 +173,9 @@ int acpi_pci_bind(struct acpi_device *device) | |||
176 | * Locate matching device in PCI namespace. If it doesn't exist | 173 | * Locate matching device in PCI namespace. If it doesn't exist |
177 | * this typically means that the device isn't currently inserted | 174 | * this typically means that the device isn't currently inserted |
178 | * (e.g. docking station, port replicator, etc.). | 175 | * (e.g. docking station, port replicator, etc.). |
179 | * We cannot simply search the global pci device list, since | ||
180 | * PCI devices are added to the global pci list when the root | ||
181 | * bridge start ops are run, which may not have happened yet. | ||
182 | */ | 176 | */ |
183 | bus = pci_find_bus(data->id.segment, data->id.bus); | 177 | data->dev = pci_get_slot(pdata->bus, |
184 | if (bus) { | 178 | PCI_DEVFN(data->id.device, data->id.function)); |
185 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
186 | if (dev->devfn == PCI_DEVFN(data->id.device, | ||
187 | data->id.function)) { | ||
188 | data->dev = dev; | ||
189 | break; | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | if (!data->dev) { | 179 | if (!data->dev) { |
194 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 180 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
195 | "Device %04x:%02x:%02x.%d not present in PCI namespace\n", | 181 | "Device %04x:%02x:%02x.%d not present in PCI namespace\n", |
@@ -259,9 +245,10 @@ int acpi_pci_bind(struct acpi_device *device) | |||
259 | 245 | ||
260 | end: | 246 | end: |
261 | kfree(buffer.pointer); | 247 | kfree(buffer.pointer); |
262 | if (result) | 248 | if (result) { |
249 | pci_dev_put(data->dev); | ||
263 | kfree(data); | 250 | kfree(data); |
264 | 251 | } | |
265 | return result; | 252 | return result; |
266 | } | 253 | } |
267 | 254 | ||
@@ -303,6 +290,7 @@ static int acpi_pci_unbind(struct acpi_device *device) | |||
303 | if (data->dev->subordinate) { | 290 | if (data->dev->subordinate) { |
304 | acpi_pci_irq_del_prt(data->id.segment, data->bus->number); | 291 | acpi_pci_irq_del_prt(data->id.segment, data->bus->number); |
305 | } | 292 | } |
293 | pci_dev_put(data->dev); | ||
306 | kfree(data); | 294 | kfree(data); |
307 | 295 | ||
308 | end: | 296 | end: |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 72069ba5f1ed..10a2d913635a 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -148,6 +148,9 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr, | |||
148 | if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT)) | 148 | if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT)) |
149 | return; | 149 | return; |
150 | 150 | ||
151 | if (boot_cpu_has(X86_FEATURE_AMDC1E)) | ||
152 | type = ACPI_STATE_C1; | ||
153 | |||
151 | /* | 154 | /* |
152 | * Check, if one of the previous states already marked the lapic | 155 | * Check, if one of the previous states already marked the lapic |
153 | * unstable | 156 | * unstable |
@@ -611,6 +614,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
611 | switch (cx->type) { | 614 | switch (cx->type) { |
612 | case ACPI_STATE_C1: | 615 | case ACPI_STATE_C1: |
613 | cx->valid = 1; | 616 | cx->valid = 1; |
617 | acpi_timer_check_state(i, pr, cx); | ||
614 | break; | 618 | break; |
615 | 619 | ||
616 | case ACPI_STATE_C2: | 620 | case ACPI_STATE_C2: |
@@ -830,11 +834,12 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
830 | 834 | ||
831 | /* Do not access any ACPI IO ports in suspend path */ | 835 | /* Do not access any ACPI IO ports in suspend path */ |
832 | if (acpi_idle_suspend) { | 836 | if (acpi_idle_suspend) { |
833 | acpi_safe_halt(); | ||
834 | local_irq_enable(); | 837 | local_irq_enable(); |
838 | cpu_relax(); | ||
835 | return 0; | 839 | return 0; |
836 | } | 840 | } |
837 | 841 | ||
842 | acpi_state_timer_broadcast(pr, cx, 1); | ||
838 | kt1 = ktime_get_real(); | 843 | kt1 = ktime_get_real(); |
839 | acpi_idle_do_entry(cx); | 844 | acpi_idle_do_entry(cx); |
840 | kt2 = ktime_get_real(); | 845 | kt2 = ktime_get_real(); |
@@ -842,6 +847,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
842 | 847 | ||
843 | local_irq_enable(); | 848 | local_irq_enable(); |
844 | cx->usage++; | 849 | cx->usage++; |
850 | acpi_state_timer_broadcast(pr, cx, 0); | ||
845 | 851 | ||
846 | return idle_time; | 852 | return idle_time; |
847 | } | 853 | } |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index cafb41000f6b..60e543d3234e 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -309,9 +309,15 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) | |||
309 | (u32) px->bus_master_latency, | 309 | (u32) px->bus_master_latency, |
310 | (u32) px->control, (u32) px->status)); | 310 | (u32) px->control, (u32) px->status)); |
311 | 311 | ||
312 | if (!px->core_frequency) { | 312 | /* |
313 | printk(KERN_ERR PREFIX | 313 | * Check that ACPI's u64 MHz will be valid as u32 KHz in cpufreq |
314 | "Invalid _PSS data: freq is zero\n"); | 314 | */ |
315 | if (!px->core_frequency || | ||
316 | ((u32)(px->core_frequency * 1000) != | ||
317 | (px->core_frequency * 1000))) { | ||
318 | printk(KERN_ERR FW_BUG PREFIX | ||
319 | "Invalid BIOS _PSS frequency: 0x%llx MHz\n", | ||
320 | px->core_frequency); | ||
315 | result = -EFAULT; | 321 | result = -EFAULT; |
316 | kfree(pr->performance->states); | 322 | kfree(pr->performance->states); |
317 | goto end; | 323 | goto end; |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 7f16f5f8e7d3..227543789ba9 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -840,7 +840,7 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | |||
840 | state = acpi_get_throttling_state(pr, value); | 840 | state = acpi_get_throttling_state(pr, value); |
841 | if (state == -1) { | 841 | if (state == -1) { |
842 | ACPI_WARNING((AE_INFO, | 842 | ACPI_WARNING((AE_INFO, |
843 | "Invalid throttling state, reset\n")); | 843 | "Invalid throttling state, reset")); |
844 | state = 0; | 844 | state = 0; |
845 | ret = acpi_processor_set_throttling(pr, state); | 845 | ret = acpi_processor_set_throttling(pr, state); |
846 | if (ret) | 846 | if (ret) |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 810cca90ca7f..1bdfb37377e3 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -570,6 +570,22 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
570 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710Z"), | 570 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710Z"), |
571 | }, | 571 | }, |
572 | }, | 572 | }, |
573 | { | ||
574 | .callback = video_set_bqc_offset, | ||
575 | .ident = "eMachines E510", | ||
576 | .matches = { | ||
577 | DMI_MATCH(DMI_BOARD_VENDOR, "EMACHINES"), | ||
578 | DMI_MATCH(DMI_PRODUCT_NAME, "eMachines E510"), | ||
579 | }, | ||
580 | }, | ||
581 | { | ||
582 | .callback = video_set_bqc_offset, | ||
583 | .ident = "Acer Aspire 5315", | ||
584 | .matches = { | ||
585 | DMI_MATCH(DMI_BOARD_VENDOR, "Acer"), | ||
586 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5315"), | ||
587 | }, | ||
588 | }, | ||
573 | {} | 589 | {} |
574 | }; | 590 | }; |
575 | 591 | ||
@@ -2334,7 +2350,7 @@ static int __init acpi_video_init(void) | |||
2334 | return acpi_video_register(); | 2350 | return acpi_video_register(); |
2335 | } | 2351 | } |
2336 | 2352 | ||
2337 | void __exit acpi_video_exit(void) | 2353 | void acpi_video_exit(void) |
2338 | { | 2354 | { |
2339 | 2355 | ||
2340 | acpi_bus_unregister_driver(&acpi_video_bus); | 2356 | acpi_bus_unregister_driver(&acpi_video_bus); |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 9120717c0701..2aa1908e5ce0 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -535,6 +535,15 @@ config PATA_OPTIDMA | |||
535 | 535 | ||
536 | If unsure, say N. | 536 | If unsure, say N. |
537 | 537 | ||
538 | config PATA_PALMLD | ||
539 | tristate "Palm LifeDrive PATA support" | ||
540 | depends on MACH_PALMLD | ||
541 | help | ||
542 | This option enables support for Palm LifeDrive's internal ATA | ||
543 | port via the new ATA layer. | ||
544 | |||
545 | If unsure, say N. | ||
546 | |||
538 | config PATA_PCMCIA | 547 | config PATA_PCMCIA |
539 | tristate "PCMCIA PATA support" | 548 | tristate "PCMCIA PATA support" |
540 | depends on PCMCIA | 549 | depends on PCMCIA |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 7f1ecf99528c..1558059874f0 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -50,6 +50,7 @@ obj-$(CONFIG_PATA_MPC52xx) += pata_mpc52xx.o | |||
50 | obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o | 50 | obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o |
51 | obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o | 51 | obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o |
52 | obj-$(CONFIG_PATA_OLDPIIX) += pata_oldpiix.o | 52 | obj-$(CONFIG_PATA_OLDPIIX) += pata_oldpiix.o |
53 | obj-$(CONFIG_PATA_PALMLD) += pata_palmld.o | ||
53 | obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia.o | 54 | obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia.o |
54 | obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o | 55 | obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o |
55 | obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o | 56 | obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o |
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c index bdb236957cb9..9a698097134b 100644 --- a/drivers/ata/pata_netcell.c +++ b/drivers/ata/pata_netcell.c | |||
@@ -20,13 +20,24 @@ | |||
20 | 20 | ||
21 | /* No PIO or DMA methods needed for this device */ | 21 | /* No PIO or DMA methods needed for this device */ |
22 | 22 | ||
23 | static unsigned int netcell_read_id(struct ata_device *adev, | ||
24 | struct ata_taskfile *tf, u16 *id) | ||
25 | { | ||
26 | unsigned int err_mask = ata_do_dev_read_id(adev, tf, id); | ||
27 | /* Firmware forgets to mark words 85-87 valid */ | ||
28 | if (err_mask == 0) | ||
29 | id[ATA_ID_CSF_DEFAULT] |= 0x0400; | ||
30 | return err_mask; | ||
31 | } | ||
32 | |||
23 | static struct scsi_host_template netcell_sht = { | 33 | static struct scsi_host_template netcell_sht = { |
24 | ATA_BMDMA_SHT(DRV_NAME), | 34 | ATA_BMDMA_SHT(DRV_NAME), |
25 | }; | 35 | }; |
26 | 36 | ||
27 | static struct ata_port_operations netcell_ops = { | 37 | static struct ata_port_operations netcell_ops = { |
28 | .inherits = &ata_bmdma_port_ops, | 38 | .inherits = &ata_bmdma_port_ops, |
29 | .cable_detect = ata_cable_80wire, | 39 | .cable_detect = ata_cable_80wire, |
40 | .read_id = netcell_read_id, | ||
30 | }; | 41 | }; |
31 | 42 | ||
32 | 43 | ||
diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c new file mode 100644 index 000000000000..11fb4ccc74b4 --- /dev/null +++ b/drivers/ata/pata_palmld.c | |||
@@ -0,0 +1,150 @@ | |||
1 | /* | ||
2 | * drivers/ata/pata_palmld.c | ||
3 | * | ||
4 | * Driver for IDE channel in Palm LifeDrive | ||
5 | * | ||
6 | * Based on research of: | ||
7 | * Alex Osborne <ato@meshy.org> | ||
8 | * | ||
9 | * Rewrite for mainline: | ||
10 | * Marek Vasut <marek.vasut@gmail.com> | ||
11 | * | ||
12 | * Rewritten version based on pata_ixp4xx_cf.c: | ||
13 | * ixp4xx PATA/Compact Flash driver | ||
14 | * Copyright (C) 2006-07 Tower Technologies | ||
15 | * Author: Alessandro Zummo <a.zummo@towertech.it> | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or modify | ||
18 | * it under the terms of the GNU General Public License version 2 as | ||
19 | * published by the Free Software Foundation. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/libata.h> | ||
26 | #include <linux/irq.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/gpio.h> | ||
30 | |||
31 | #include <scsi/scsi_host.h> | ||
32 | #include <mach/palmld.h> | ||
33 | |||
34 | #define DRV_NAME "pata_palmld" | ||
35 | |||
36 | static struct scsi_host_template palmld_sht = { | ||
37 | ATA_PIO_SHT(DRV_NAME), | ||
38 | }; | ||
39 | |||
40 | static struct ata_port_operations palmld_port_ops = { | ||
41 | .inherits = &ata_sff_port_ops, | ||
42 | .sff_data_xfer = ata_sff_data_xfer_noirq, | ||
43 | .cable_detect = ata_cable_40wire, | ||
44 | }; | ||
45 | |||
46 | static __devinit int palmld_pata_probe(struct platform_device *pdev) | ||
47 | { | ||
48 | struct ata_host *host; | ||
49 | struct ata_port *ap; | ||
50 | void __iomem *mem; | ||
51 | int ret; | ||
52 | |||
53 | /* allocate host */ | ||
54 | host = ata_host_alloc(&pdev->dev, 1); | ||
55 | if (!host) | ||
56 | return -ENOMEM; | ||
57 | |||
58 | /* remap drive's physical memory address */ | ||
59 | mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000); | ||
60 | if (!mem) | ||
61 | return -ENOMEM; | ||
62 | |||
63 | /* request and activate power GPIO, IRQ GPIO */ | ||
64 | ret = gpio_request(GPIO_NR_PALMLD_IDE_PWEN, "HDD PWR"); | ||
65 | if (ret) | ||
66 | goto err1; | ||
67 | ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_PWEN, 1); | ||
68 | if (ret) | ||
69 | goto err2; | ||
70 | |||
71 | ret = gpio_request(GPIO_NR_PALMLD_IDE_RESET, "HDD RST"); | ||
72 | if (ret) | ||
73 | goto err2; | ||
74 | ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_RESET, 0); | ||
75 | if (ret) | ||
76 | goto err3; | ||
77 | |||
78 | /* reset the drive */ | ||
79 | gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0); | ||
80 | msleep(30); | ||
81 | gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 1); | ||
82 | msleep(30); | ||
83 | |||
84 | /* setup the ata port */ | ||
85 | ap = host->ports[0]; | ||
86 | ap->ops = &palmld_port_ops; | ||
87 | ap->pio_mask = ATA_PIO4; | ||
88 | ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_PIO_POLLING; | ||
89 | |||
90 | /* memory mapping voodoo */ | ||
91 | ap->ioaddr.cmd_addr = mem + 0x10; | ||
92 | ap->ioaddr.altstatus_addr = mem + 0xe; | ||
93 | ap->ioaddr.ctl_addr = mem + 0xe; | ||
94 | |||
95 | /* start the port */ | ||
96 | ata_sff_std_ports(&ap->ioaddr); | ||
97 | |||
98 | /* activate host */ | ||
99 | return ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING, | ||
100 | &palmld_sht); | ||
101 | |||
102 | err3: | ||
103 | gpio_free(GPIO_NR_PALMLD_IDE_RESET); | ||
104 | err2: | ||
105 | gpio_free(GPIO_NR_PALMLD_IDE_PWEN); | ||
106 | err1: | ||
107 | return ret; | ||
108 | } | ||
109 | |||
110 | static __devexit int palmld_pata_remove(struct platform_device *dev) | ||
111 | { | ||
112 | struct ata_host *host = platform_get_drvdata(dev); | ||
113 | |||
114 | ata_host_detach(host); | ||
115 | |||
116 | /* power down the HDD */ | ||
117 | gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0); | ||
118 | |||
119 | gpio_free(GPIO_NR_PALMLD_IDE_RESET); | ||
120 | gpio_free(GPIO_NR_PALMLD_IDE_PWEN); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static struct platform_driver palmld_pata_platform_driver = { | ||
126 | .driver = { | ||
127 | .name = DRV_NAME, | ||
128 | .owner = THIS_MODULE, | ||
129 | }, | ||
130 | .probe = palmld_pata_probe, | ||
131 | .remove = __devexit_p(palmld_pata_remove), | ||
132 | }; | ||
133 | |||
134 | static int __init palmld_pata_init(void) | ||
135 | { | ||
136 | return platform_driver_register(&palmld_pata_platform_driver); | ||
137 | } | ||
138 | |||
139 | static void __exit palmld_pata_exit(void) | ||
140 | { | ||
141 | platform_driver_unregister(&palmld_pata_platform_driver); | ||
142 | } | ||
143 | |||
144 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); | ||
145 | MODULE_DESCRIPTION("PalmLD PATA driver"); | ||
146 | MODULE_LICENSE("GPL"); | ||
147 | MODULE_ALIAS("platform:" DRV_NAME); | ||
148 | |||
149 | module_init(palmld_pata_init); | ||
150 | module_exit(palmld_pata_exit); | ||
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index dc030f1f00f1..c6599618523e 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -700,8 +700,10 @@ int bus_add_driver(struct device_driver *drv) | |||
700 | } | 700 | } |
701 | 701 | ||
702 | kobject_uevent(&priv->kobj, KOBJ_ADD); | 702 | kobject_uevent(&priv->kobj, KOBJ_ADD); |
703 | return error; | 703 | return 0; |
704 | out_unregister: | 704 | out_unregister: |
705 | kfree(drv->p); | ||
706 | drv->p = NULL; | ||
705 | kobject_put(&priv->kobj); | 707 | kobject_put(&priv->kobj); |
706 | out_put_bus: | 708 | out_put_bus: |
707 | bus_put(bus); | 709 | bus_put(bus); |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 4aa527b8a913..1977d4beb89e 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -879,7 +879,7 @@ int device_add(struct device *dev) | |||
879 | } | 879 | } |
880 | 880 | ||
881 | if (!dev_name(dev)) | 881 | if (!dev_name(dev)) |
882 | goto done; | 882 | goto name_error; |
883 | 883 | ||
884 | pr_debug("device: '%s': %s\n", dev_name(dev), __func__); | 884 | pr_debug("device: '%s': %s\n", dev_name(dev), __func__); |
885 | 885 | ||
@@ -978,6 +978,9 @@ done: | |||
978 | cleanup_device_parent(dev); | 978 | cleanup_device_parent(dev); |
979 | if (parent) | 979 | if (parent) |
980 | put_device(parent); | 980 | put_device(parent); |
981 | name_error: | ||
982 | kfree(dev->p); | ||
983 | dev->p = NULL; | ||
981 | goto done; | 984 | goto done; |
982 | } | 985 | } |
983 | 986 | ||
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index c51f11bb29ae..8ae0f63602e0 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -257,6 +257,10 @@ EXPORT_SYMBOL_GPL(driver_register); | |||
257 | */ | 257 | */ |
258 | void driver_unregister(struct device_driver *drv) | 258 | void driver_unregister(struct device_driver *drv) |
259 | { | 259 | { |
260 | if (!drv || !drv->p) { | ||
261 | WARN(1, "Unexpected driver unregister!\n"); | ||
262 | return; | ||
263 | } | ||
260 | driver_remove_groups(drv, drv->groups); | 264 | driver_remove_groups(drv, drv->groups); |
261 | bus_remove_driver(drv); | 265 | bus_remove_driver(drv); |
262 | } | 266 | } |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 69b4ddb7de3b..3e4bc699bc0f 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -357,6 +357,7 @@ static void dpm_power_up(pm_message_t state) | |||
357 | { | 357 | { |
358 | struct device *dev; | 358 | struct device *dev; |
359 | 359 | ||
360 | mutex_lock(&dpm_list_mtx); | ||
360 | list_for_each_entry(dev, &dpm_list, power.entry) | 361 | list_for_each_entry(dev, &dpm_list, power.entry) |
361 | if (dev->power.status > DPM_OFF) { | 362 | if (dev->power.status > DPM_OFF) { |
362 | int error; | 363 | int error; |
@@ -366,6 +367,7 @@ static void dpm_power_up(pm_message_t state) | |||
366 | if (error) | 367 | if (error) |
367 | pm_dev_err(dev, state, " early", error); | 368 | pm_dev_err(dev, state, " early", error); |
368 | } | 369 | } |
370 | mutex_unlock(&dpm_list_mtx); | ||
369 | } | 371 | } |
370 | 372 | ||
371 | /** | 373 | /** |
@@ -614,6 +616,7 @@ int device_power_down(pm_message_t state) | |||
614 | int error = 0; | 616 | int error = 0; |
615 | 617 | ||
616 | suspend_device_irqs(); | 618 | suspend_device_irqs(); |
619 | mutex_lock(&dpm_list_mtx); | ||
617 | list_for_each_entry_reverse(dev, &dpm_list, power.entry) { | 620 | list_for_each_entry_reverse(dev, &dpm_list, power.entry) { |
618 | error = suspend_device_noirq(dev, state); | 621 | error = suspend_device_noirq(dev, state); |
619 | if (error) { | 622 | if (error) { |
@@ -622,6 +625,7 @@ int device_power_down(pm_message_t state) | |||
622 | } | 625 | } |
623 | dev->power.status = DPM_OFF_IRQ; | 626 | dev->power.status = DPM_OFF_IRQ; |
624 | } | 627 | } |
628 | mutex_unlock(&dpm_list_mtx); | ||
625 | if (error) | 629 | if (error) |
626 | device_power_up(resume_event(state)); | 630 | device_power_up(resume_event(state)); |
627 | return error; | 631 | return error; |
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 5fab6470f4b2..26c93c75e62d 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig | |||
@@ -148,3 +148,15 @@ config HW_RANDOM_VIRTIO | |||
148 | 148 | ||
149 | To compile this driver as a module, choose M here: the | 149 | To compile this driver as a module, choose M here: the |
150 | module will be called virtio-rng. If unsure, say N. | 150 | module will be called virtio-rng. If unsure, say N. |
151 | |||
152 | config HW_RANDOM_MXC_RNGA | ||
153 | tristate "Freescale i.MX RNGA Random Number Generator" | ||
154 | depends on HW_RANDOM && ARCH_HAS_RNGA | ||
155 | ---help--- | ||
156 | This driver provides kernel-side support for the Random Number | ||
157 | Generator hardware found on Freescale i.MX processors. | ||
158 | |||
159 | To compile this driver as a module, choose M here: the | ||
160 | module will be called mxc-rnga. | ||
161 | |||
162 | If unsure, say Y. | ||
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile index e81d21a5f28f..fd1ecd2f6731 100644 --- a/drivers/char/hw_random/Makefile +++ b/drivers/char/hw_random/Makefile | |||
@@ -15,3 +15,4 @@ obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o | |||
15 | obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o | 15 | obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o |
16 | obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o | 16 | obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o |
17 | obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o | 17 | obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o |
18 | obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o | ||
diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c new file mode 100644 index 000000000000..187c6be80f43 --- /dev/null +++ b/drivers/char/hw_random/mxc-rnga.c | |||
@@ -0,0 +1,247 @@ | |||
1 | /* | ||
2 | * RNG driver for Freescale RNGA | ||
3 | * | ||
4 | * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved. | ||
5 | * Author: Alan Carvalho de Assis <acassis@gmail.com> | ||
6 | */ | ||
7 | |||
8 | /* | ||
9 | * The code contained herein is licensed under the GNU General Public | ||
10 | * License. You may obtain a copy of the GNU General Public License | ||
11 | * Version 2 or later at the following locations: | ||
12 | * | ||
13 | * http://www.opensource.org/licenses/gpl-license.html | ||
14 | * http://www.gnu.org/copyleft/gpl.html | ||
15 | * | ||
16 | * This driver is based on other RNG drivers. | ||
17 | */ | ||
18 | |||
19 | #include <linux/module.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/clk.h> | ||
23 | #include <linux/err.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/hw_random.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | /* RNGA Registers */ | ||
30 | #define RNGA_CONTROL 0x00 | ||
31 | #define RNGA_STATUS 0x04 | ||
32 | #define RNGA_ENTROPY 0x08 | ||
33 | #define RNGA_OUTPUT_FIFO 0x0c | ||
34 | #define RNGA_MODE 0x10 | ||
35 | #define RNGA_VERIFICATION_CONTROL 0x14 | ||
36 | #define RNGA_OSC_CONTROL_COUNTER 0x18 | ||
37 | #define RNGA_OSC1_COUNTER 0x1c | ||
38 | #define RNGA_OSC2_COUNTER 0x20 | ||
39 | #define RNGA_OSC_COUNTER_STATUS 0x24 | ||
40 | |||
41 | /* RNGA Registers Range */ | ||
42 | #define RNG_ADDR_RANGE 0x28 | ||
43 | |||
44 | /* RNGA Control Register */ | ||
45 | #define RNGA_CONTROL_SLEEP 0x00000010 | ||
46 | #define RNGA_CONTROL_CLEAR_INT 0x00000008 | ||
47 | #define RNGA_CONTROL_MASK_INTS 0x00000004 | ||
48 | #define RNGA_CONTROL_HIGH_ASSURANCE 0x00000002 | ||
49 | #define RNGA_CONTROL_GO 0x00000001 | ||
50 | |||
51 | #define RNGA_STATUS_LEVEL_MASK 0x0000ff00 | ||
52 | |||
53 | /* RNGA Status Register */ | ||
54 | #define RNGA_STATUS_OSC_DEAD 0x80000000 | ||
55 | #define RNGA_STATUS_SLEEP 0x00000010 | ||
56 | #define RNGA_STATUS_ERROR_INT 0x00000008 | ||
57 | #define RNGA_STATUS_FIFO_UNDERFLOW 0x00000004 | ||
58 | #define RNGA_STATUS_LAST_READ_STATUS 0x00000002 | ||
59 | #define RNGA_STATUS_SECURITY_VIOLATION 0x00000001 | ||
60 | |||
61 | static struct platform_device *rng_dev; | ||
62 | |||
63 | static int mxc_rnga_data_present(struct hwrng *rng) | ||
64 | { | ||
65 | int level; | ||
66 | void __iomem *rng_base = (void __iomem *)rng->priv; | ||
67 | |||
68 | /* how many random numbers is in FIFO? [0-16] */ | ||
69 | level = ((__raw_readl(rng_base + RNGA_STATUS) & | ||
70 | RNGA_STATUS_LEVEL_MASK) >> 8); | ||
71 | |||
72 | return level > 0 ? 1 : 0; | ||
73 | } | ||
74 | |||
75 | static int mxc_rnga_data_read(struct hwrng *rng, u32 * data) | ||
76 | { | ||
77 | int err; | ||
78 | u32 ctrl; | ||
79 | void __iomem *rng_base = (void __iomem *)rng->priv; | ||
80 | |||
81 | /* retrieve a random number from FIFO */ | ||
82 | *data = __raw_readl(rng_base + RNGA_OUTPUT_FIFO); | ||
83 | |||
84 | /* some error while reading this random number? */ | ||
85 | err = __raw_readl(rng_base + RNGA_STATUS) & RNGA_STATUS_ERROR_INT; | ||
86 | |||
87 | /* if error: clear error interrupt, but doesn't return random number */ | ||
88 | if (err) { | ||
89 | dev_dbg(&rng_dev->dev, "Error while reading random number!\n"); | ||
90 | ctrl = __raw_readl(rng_base + RNGA_CONTROL); | ||
91 | __raw_writel(ctrl | RNGA_CONTROL_CLEAR_INT, | ||
92 | rng_base + RNGA_CONTROL); | ||
93 | return 0; | ||
94 | } else | ||
95 | return 4; | ||
96 | } | ||
97 | |||
98 | static int mxc_rnga_init(struct hwrng *rng) | ||
99 | { | ||
100 | u32 ctrl, osc; | ||
101 | void __iomem *rng_base = (void __iomem *)rng->priv; | ||
102 | |||
103 | /* wake up */ | ||
104 | ctrl = __raw_readl(rng_base + RNGA_CONTROL); | ||
105 | __raw_writel(ctrl & ~RNGA_CONTROL_SLEEP, rng_base + RNGA_CONTROL); | ||
106 | |||
107 | /* verify if oscillator is working */ | ||
108 | osc = __raw_readl(rng_base + RNGA_STATUS); | ||
109 | if (osc & RNGA_STATUS_OSC_DEAD) { | ||
110 | dev_err(&rng_dev->dev, "RNGA Oscillator is dead!\n"); | ||
111 | return -ENODEV; | ||
112 | } | ||
113 | |||
114 | /* go running */ | ||
115 | ctrl = __raw_readl(rng_base + RNGA_CONTROL); | ||
116 | __raw_writel(ctrl | RNGA_CONTROL_GO, rng_base + RNGA_CONTROL); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static void mxc_rnga_cleanup(struct hwrng *rng) | ||
122 | { | ||
123 | u32 ctrl; | ||
124 | void __iomem *rng_base = (void __iomem *)rng->priv; | ||
125 | |||
126 | ctrl = __raw_readl(rng_base + RNGA_CONTROL); | ||
127 | |||
128 | /* stop rnga */ | ||
129 | __raw_writel(ctrl & ~RNGA_CONTROL_GO, rng_base + RNGA_CONTROL); | ||
130 | } | ||
131 | |||
132 | static struct hwrng mxc_rnga = { | ||
133 | .name = "mxc-rnga", | ||
134 | .init = mxc_rnga_init, | ||
135 | .cleanup = mxc_rnga_cleanup, | ||
136 | .data_present = mxc_rnga_data_present, | ||
137 | .data_read = mxc_rnga_data_read | ||
138 | }; | ||
139 | |||
140 | static int __init mxc_rnga_probe(struct platform_device *pdev) | ||
141 | { | ||
142 | int err = -ENODEV; | ||
143 | struct clk *clk; | ||
144 | struct resource *res, *mem; | ||
145 | void __iomem *rng_base = NULL; | ||
146 | |||
147 | if (rng_dev) | ||
148 | return -EBUSY; | ||
149 | |||
150 | clk = clk_get(&pdev->dev, "rng"); | ||
151 | if (IS_ERR(clk)) { | ||
152 | dev_err(&pdev->dev, "Could not get rng_clk!\n"); | ||
153 | err = PTR_ERR(clk); | ||
154 | goto out; | ||
155 | } | ||
156 | |||
157 | clk_enable(clk); | ||
158 | |||
159 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
160 | if (!res) { | ||
161 | err = -ENOENT; | ||
162 | goto err_region; | ||
163 | } | ||
164 | |||
165 | mem = request_mem_region(res->start, resource_size(res), pdev->name); | ||
166 | if (mem == NULL) { | ||
167 | err = -EBUSY; | ||
168 | goto err_region; | ||
169 | } | ||
170 | |||
171 | rng_base = ioremap(res->start, resource_size(res)); | ||
172 | if (!rng_base) { | ||
173 | err = -ENOMEM; | ||
174 | goto err_ioremap; | ||
175 | } | ||
176 | |||
177 | mxc_rnga.priv = (unsigned long)rng_base; | ||
178 | |||
179 | err = hwrng_register(&mxc_rnga); | ||
180 | if (err) { | ||
181 | dev_err(&pdev->dev, "MXC RNGA registering failed (%d)\n", err); | ||
182 | goto err_register; | ||
183 | } | ||
184 | |||
185 | rng_dev = pdev; | ||
186 | |||
187 | dev_info(&pdev->dev, "MXC RNGA Registered.\n"); | ||
188 | |||
189 | return 0; | ||
190 | |||
191 | err_register: | ||
192 | iounmap(rng_base); | ||
193 | rng_base = NULL; | ||
194 | |||
195 | err_ioremap: | ||
196 | release_mem_region(res->start, resource_size(res)); | ||
197 | |||
198 | err_region: | ||
199 | clk_disable(clk); | ||
200 | clk_put(clk); | ||
201 | |||
202 | out: | ||
203 | return err; | ||
204 | } | ||
205 | |||
206 | static int __exit mxc_rnga_remove(struct platform_device *pdev) | ||
207 | { | ||
208 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
209 | void __iomem *rng_base = (void __iomem *)mxc_rnga.priv; | ||
210 | struct clk *clk = clk_get(&pdev->dev, "rng"); | ||
211 | |||
212 | hwrng_unregister(&mxc_rnga); | ||
213 | |||
214 | iounmap(rng_base); | ||
215 | |||
216 | release_mem_region(res->start, resource_size(res)); | ||
217 | |||
218 | clk_disable(clk); | ||
219 | clk_put(clk); | ||
220 | |||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | static struct platform_driver mxc_rnga_driver = { | ||
225 | .driver = { | ||
226 | .name = "mxc_rnga", | ||
227 | .owner = THIS_MODULE, | ||
228 | }, | ||
229 | .remove = __exit_p(mxc_rnga_remove), | ||
230 | }; | ||
231 | |||
232 | static int __init mod_init(void) | ||
233 | { | ||
234 | return platform_driver_probe(&mxc_rnga_driver, mxc_rnga_probe); | ||
235 | } | ||
236 | |||
237 | static void __exit mod_exit(void) | ||
238 | { | ||
239 | platform_driver_unregister(&mxc_rnga_driver); | ||
240 | } | ||
241 | |||
242 | module_init(mod_init); | ||
243 | module_exit(mod_exit); | ||
244 | |||
245 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); | ||
246 | MODULE_DESCRIPTION("H/W RNGA driver for i.MX"); | ||
247 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d270e8eb3e67..47d2ad0ae079 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1070,11 +1070,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
1070 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1070 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1071 | #endif | 1071 | #endif |
1072 | 1072 | ||
1073 | unlock_policy_rwsem_write(cpu); | ||
1074 | |||
1073 | if (cpufreq_driver->target) | 1075 | if (cpufreq_driver->target) |
1074 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); | 1076 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); |
1075 | 1077 | ||
1076 | unlock_policy_rwsem_write(cpu); | ||
1077 | |||
1078 | kobject_put(&data->kobj); | 1078 | kobject_put(&data->kobj); |
1079 | 1079 | ||
1080 | /* we need to make sure that the underlying kobj is actually | 1080 | /* we need to make sure that the underlying kobj is actually |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 2ecd95e4ab1a..7a74d175287b 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -91,6 +91,9 @@ static unsigned int dbs_enable; /* number of CPUs using this policy */ | |||
91 | * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then | 91 | * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then |
92 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock | 92 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock |
93 | * is recursive for the same process. -Venki | 93 | * is recursive for the same process. -Venki |
94 | * DEADLOCK ALERT! (2) : do_dbs_timer() must not take the dbs_mutex, because it | ||
95 | * would deadlock with cancel_delayed_work_sync(), which is needed for proper | ||
96 | * raceless workqueue teardown. | ||
94 | */ | 97 | */ |
95 | static DEFINE_MUTEX(dbs_mutex); | 98 | static DEFINE_MUTEX(dbs_mutex); |
96 | 99 | ||
@@ -542,7 +545,7 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | |||
542 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) | 545 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) |
543 | { | 546 | { |
544 | dbs_info->enable = 0; | 547 | dbs_info->enable = 0; |
545 | cancel_delayed_work(&dbs_info->work); | 548 | cancel_delayed_work_sync(&dbs_info->work); |
546 | } | 549 | } |
547 | 550 | ||
548 | static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | 551 | static int cpufreq_governor_dbs(struct cpufreq_policy *policy, |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 338f428a15b7..e741c339df76 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -98,6 +98,9 @@ static unsigned int dbs_enable; /* number of CPUs using this policy */ | |||
98 | * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then | 98 | * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then |
99 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock | 99 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock |
100 | * is recursive for the same process. -Venki | 100 | * is recursive for the same process. -Venki |
101 | * DEADLOCK ALERT! (2) : do_dbs_timer() must not take the dbs_mutex, because it | ||
102 | * would deadlock with cancel_delayed_work_sync(), which is needed for proper | ||
103 | * raceless workqueue teardown. | ||
101 | */ | 104 | */ |
102 | static DEFINE_MUTEX(dbs_mutex); | 105 | static DEFINE_MUTEX(dbs_mutex); |
103 | 106 | ||
@@ -562,7 +565,7 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | |||
562 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) | 565 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) |
563 | { | 566 | { |
564 | dbs_info->enable = 0; | 567 | dbs_info->enable = 0; |
565 | cancel_delayed_work(&dbs_info->work); | 568 | cancel_delayed_work_sync(&dbs_info->work); |
566 | } | 569 | } |
567 | 570 | ||
568 | static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | 571 | static int cpufreq_governor_dbs(struct cpufreq_policy *policy, |
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index da8a8ed9e411..f18d1bde0439 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c | |||
@@ -179,9 +179,14 @@ static void dma_halt(struct fsl_dma_chan *fsl_chan) | |||
179 | static void set_ld_eol(struct fsl_dma_chan *fsl_chan, | 179 | static void set_ld_eol(struct fsl_dma_chan *fsl_chan, |
180 | struct fsl_desc_sw *desc) | 180 | struct fsl_desc_sw *desc) |
181 | { | 181 | { |
182 | u64 snoop_bits; | ||
183 | |||
184 | snoop_bits = ((fsl_chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_83XX) | ||
185 | ? FSL_DMA_SNEN : 0; | ||
186 | |||
182 | desc->hw.next_ln_addr = CPU_TO_DMA(fsl_chan, | 187 | desc->hw.next_ln_addr = CPU_TO_DMA(fsl_chan, |
183 | DMA_TO_CPU(fsl_chan, desc->hw.next_ln_addr, 64) | FSL_DMA_EOL, | 188 | DMA_TO_CPU(fsl_chan, desc->hw.next_ln_addr, 64) | FSL_DMA_EOL |
184 | 64); | 189 | | snoop_bits, 64); |
185 | } | 190 | } |
186 | 191 | ||
187 | static void append_ld_queue(struct fsl_dma_chan *fsl_chan, | 192 | static void append_ld_queue(struct fsl_dma_chan *fsl_chan, |
@@ -313,8 +318,8 @@ static void fsl_chan_toggle_ext_start(struct fsl_dma_chan *fsl_chan, int enable) | |||
313 | 318 | ||
314 | static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) | 319 | static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) |
315 | { | 320 | { |
316 | struct fsl_desc_sw *desc = tx_to_fsl_desc(tx); | ||
317 | struct fsl_dma_chan *fsl_chan = to_fsl_chan(tx->chan); | 321 | struct fsl_dma_chan *fsl_chan = to_fsl_chan(tx->chan); |
322 | struct fsl_desc_sw *desc; | ||
318 | unsigned long flags; | 323 | unsigned long flags; |
319 | dma_cookie_t cookie; | 324 | dma_cookie_t cookie; |
320 | 325 | ||
@@ -322,14 +327,17 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) | |||
322 | spin_lock_irqsave(&fsl_chan->desc_lock, flags); | 327 | spin_lock_irqsave(&fsl_chan->desc_lock, flags); |
323 | 328 | ||
324 | cookie = fsl_chan->common.cookie; | 329 | cookie = fsl_chan->common.cookie; |
325 | cookie++; | 330 | list_for_each_entry(desc, &tx->tx_list, node) { |
326 | if (cookie < 0) | 331 | cookie++; |
327 | cookie = 1; | 332 | if (cookie < 0) |
328 | desc->async_tx.cookie = cookie; | 333 | cookie = 1; |
329 | fsl_chan->common.cookie = desc->async_tx.cookie; | ||
330 | 334 | ||
331 | append_ld_queue(fsl_chan, desc); | 335 | desc->async_tx.cookie = cookie; |
332 | list_splice_init(&desc->async_tx.tx_list, fsl_chan->ld_queue.prev); | 336 | } |
337 | |||
338 | fsl_chan->common.cookie = cookie; | ||
339 | append_ld_queue(fsl_chan, tx_to_fsl_desc(tx)); | ||
340 | list_splice_init(&tx->tx_list, fsl_chan->ld_queue.prev); | ||
333 | 341 | ||
334 | spin_unlock_irqrestore(&fsl_chan->desc_lock, flags); | 342 | spin_unlock_irqrestore(&fsl_chan->desc_lock, flags); |
335 | 343 | ||
@@ -454,8 +462,8 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( | |||
454 | { | 462 | { |
455 | struct fsl_dma_chan *fsl_chan; | 463 | struct fsl_dma_chan *fsl_chan; |
456 | struct fsl_desc_sw *first = NULL, *prev = NULL, *new; | 464 | struct fsl_desc_sw *first = NULL, *prev = NULL, *new; |
465 | struct list_head *list; | ||
457 | size_t copy; | 466 | size_t copy; |
458 | LIST_HEAD(link_chain); | ||
459 | 467 | ||
460 | if (!chan) | 468 | if (!chan) |
461 | return NULL; | 469 | return NULL; |
@@ -472,7 +480,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( | |||
472 | if (!new) { | 480 | if (!new) { |
473 | dev_err(fsl_chan->dev, | 481 | dev_err(fsl_chan->dev, |
474 | "No free memory for link descriptor\n"); | 482 | "No free memory for link descriptor\n"); |
475 | return NULL; | 483 | goto fail; |
476 | } | 484 | } |
477 | #ifdef FSL_DMA_LD_DEBUG | 485 | #ifdef FSL_DMA_LD_DEBUG |
478 | dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new); | 486 | dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new); |
@@ -507,7 +515,19 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( | |||
507 | /* Set End-of-link to the last link descriptor of new list*/ | 515 | /* Set End-of-link to the last link descriptor of new list*/ |
508 | set_ld_eol(fsl_chan, new); | 516 | set_ld_eol(fsl_chan, new); |
509 | 517 | ||
510 | return first ? &first->async_tx : NULL; | 518 | return &first->async_tx; |
519 | |||
520 | fail: | ||
521 | if (!first) | ||
522 | return NULL; | ||
523 | |||
524 | list = &first->async_tx.tx_list; | ||
525 | list_for_each_entry_safe_reverse(new, prev, list, node) { | ||
526 | list_del(&new->node); | ||
527 | dma_pool_free(fsl_chan->desc_pool, new, new->async_tx.phys); | ||
528 | } | ||
529 | |||
530 | return NULL; | ||
511 | } | 531 | } |
512 | 532 | ||
513 | /** | 533 | /** |
@@ -598,15 +618,16 @@ static void fsl_chan_xfer_ld_queue(struct fsl_dma_chan *fsl_chan) | |||
598 | dma_addr_t next_dest_addr; | 618 | dma_addr_t next_dest_addr; |
599 | unsigned long flags; | 619 | unsigned long flags; |
600 | 620 | ||
621 | spin_lock_irqsave(&fsl_chan->desc_lock, flags); | ||
622 | |||
601 | if (!dma_is_idle(fsl_chan)) | 623 | if (!dma_is_idle(fsl_chan)) |
602 | return; | 624 | goto out_unlock; |
603 | 625 | ||
604 | dma_halt(fsl_chan); | 626 | dma_halt(fsl_chan); |
605 | 627 | ||
606 | /* If there are some link descriptors | 628 | /* If there are some link descriptors |
607 | * not transfered in queue. We need to start it. | 629 | * not transfered in queue. We need to start it. |
608 | */ | 630 | */ |
609 | spin_lock_irqsave(&fsl_chan->desc_lock, flags); | ||
610 | 631 | ||
611 | /* Find the first un-transfer desciptor */ | 632 | /* Find the first un-transfer desciptor */ |
612 | for (ld_node = fsl_chan->ld_queue.next; | 633 | for (ld_node = fsl_chan->ld_queue.next; |
@@ -617,19 +638,20 @@ static void fsl_chan_xfer_ld_queue(struct fsl_dma_chan *fsl_chan) | |||
617 | fsl_chan->common.cookie) == DMA_SUCCESS); | 638 | fsl_chan->common.cookie) == DMA_SUCCESS); |
618 | ld_node = ld_node->next); | 639 | ld_node = ld_node->next); |
619 | 640 | ||
620 | spin_unlock_irqrestore(&fsl_chan->desc_lock, flags); | ||
621 | |||
622 | if (ld_node != &fsl_chan->ld_queue) { | 641 | if (ld_node != &fsl_chan->ld_queue) { |
623 | /* Get the ld start address from ld_queue */ | 642 | /* Get the ld start address from ld_queue */ |
624 | next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys; | 643 | next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys; |
625 | dev_dbg(fsl_chan->dev, "xfer LDs staring from %p\n", | 644 | dev_dbg(fsl_chan->dev, "xfer LDs staring from 0x%llx\n", |
626 | (void *)next_dest_addr); | 645 | (unsigned long long)next_dest_addr); |
627 | set_cdar(fsl_chan, next_dest_addr); | 646 | set_cdar(fsl_chan, next_dest_addr); |
628 | dma_start(fsl_chan); | 647 | dma_start(fsl_chan); |
629 | } else { | 648 | } else { |
630 | set_cdar(fsl_chan, 0); | 649 | set_cdar(fsl_chan, 0); |
631 | set_ndar(fsl_chan, 0); | 650 | set_ndar(fsl_chan, 0); |
632 | } | 651 | } |
652 | |||
653 | out_unlock: | ||
654 | spin_unlock_irqrestore(&fsl_chan->desc_lock, flags); | ||
633 | } | 655 | } |
634 | 656 | ||
635 | /** | 657 | /** |
@@ -734,8 +756,9 @@ static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) | |||
734 | */ | 756 | */ |
735 | if (stat & FSL_DMA_SR_EOSI) { | 757 | if (stat & FSL_DMA_SR_EOSI) { |
736 | dev_dbg(fsl_chan->dev, "event: End-of-segments INT\n"); | 758 | dev_dbg(fsl_chan->dev, "event: End-of-segments INT\n"); |
737 | dev_dbg(fsl_chan->dev, "event: clndar %p, nlndar %p\n", | 759 | dev_dbg(fsl_chan->dev, "event: clndar 0x%llx, nlndar 0x%llx\n", |
738 | (void *)get_cdar(fsl_chan), (void *)get_ndar(fsl_chan)); | 760 | (unsigned long long)get_cdar(fsl_chan), |
761 | (unsigned long long)get_ndar(fsl_chan)); | ||
739 | stat &= ~FSL_DMA_SR_EOSI; | 762 | stat &= ~FSL_DMA_SR_EOSI; |
740 | update_cookie = 1; | 763 | update_cookie = 1; |
741 | } | 764 | } |
@@ -830,7 +853,7 @@ static int __devinit fsl_dma_chan_probe(struct fsl_dma_device *fdev, | |||
830 | new_fsl_chan->reg.end - new_fsl_chan->reg.start + 1); | 853 | new_fsl_chan->reg.end - new_fsl_chan->reg.start + 1); |
831 | 854 | ||
832 | new_fsl_chan->id = ((new_fsl_chan->reg.start - 0x100) & 0xfff) >> 7; | 855 | new_fsl_chan->id = ((new_fsl_chan->reg.start - 0x100) & 0xfff) >> 7; |
833 | if (new_fsl_chan->id > FSL_DMA_MAX_CHANS_PER_DEVICE) { | 856 | if (new_fsl_chan->id >= FSL_DMA_MAX_CHANS_PER_DEVICE) { |
834 | dev_err(fdev->dev, "There is no %d channel!\n", | 857 | dev_err(fdev->dev, "There is no %d channel!\n", |
835 | new_fsl_chan->id); | 858 | new_fsl_chan->id); |
836 | err = -EINVAL; | 859 | err = -EINVAL; |
@@ -925,8 +948,8 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev, | |||
925 | } | 948 | } |
926 | 949 | ||
927 | dev_info(&dev->dev, "Probe the Freescale DMA driver for %s " | 950 | dev_info(&dev->dev, "Probe the Freescale DMA driver for %s " |
928 | "controller at %p...\n", | 951 | "controller at 0x%llx...\n", |
929 | match->compatible, (void *)fdev->reg.start); | 952 | match->compatible, (unsigned long long)fdev->reg.start); |
930 | fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end | 953 | fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end |
931 | - fdev->reg.start + 1); | 954 | - fdev->reg.start + 1); |
932 | 955 | ||
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 1955ee8d6d20..a600fc0f7962 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c | |||
@@ -173,7 +173,7 @@ static int ioat_dma_enumerate_channels(struct ioatdma_device *device) | |||
173 | xfercap = (xfercap_scale == 0 ? -1 : (1UL << xfercap_scale)); | 173 | xfercap = (xfercap_scale == 0 ? -1 : (1UL << xfercap_scale)); |
174 | 174 | ||
175 | #ifdef CONFIG_I7300_IDLE_IOAT_CHANNEL | 175 | #ifdef CONFIG_I7300_IDLE_IOAT_CHANNEL |
176 | if (i7300_idle_platform_probe(NULL, NULL) == 0) { | 176 | if (i7300_idle_platform_probe(NULL, NULL, 1) == 0) { |
177 | device->common.chancnt--; | 177 | device->common.chancnt--; |
178 | } | 178 | } |
179 | #endif | 179 | #endif |
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig index e5f5c5a8ba6c..956982f8739b 100644 --- a/drivers/edac/Kconfig +++ b/drivers/edac/Kconfig | |||
@@ -192,16 +192,20 @@ config EDAC_PPC4XX | |||
192 | 192 | ||
193 | config EDAC_AMD8131 | 193 | config EDAC_AMD8131 |
194 | tristate "AMD8131 HyperTransport PCI-X Tunnel" | 194 | tristate "AMD8131 HyperTransport PCI-X Tunnel" |
195 | depends on EDAC_MM_EDAC && PCI | 195 | depends on EDAC_MM_EDAC && PCI && PPC_MAPLE |
196 | help | 196 | help |
197 | Support for error detection and correction on the | 197 | Support for error detection and correction on the |
198 | AMD8131 HyperTransport PCI-X Tunnel chip. | 198 | AMD8131 HyperTransport PCI-X Tunnel chip. |
199 | Note, add more Kconfig dependency if it's adopted | ||
200 | on some machine other than Maple. | ||
199 | 201 | ||
200 | config EDAC_AMD8111 | 202 | config EDAC_AMD8111 |
201 | tristate "AMD8111 HyperTransport I/O Hub" | 203 | tristate "AMD8111 HyperTransport I/O Hub" |
202 | depends on EDAC_MM_EDAC && PCI | 204 | depends on EDAC_MM_EDAC && PCI && PPC_MAPLE |
203 | help | 205 | help |
204 | Support for error detection and correction on the | 206 | Support for error detection and correction on the |
205 | AMD8111 HyperTransport I/O Hub chip. | 207 | AMD8111 HyperTransport I/O Hub chip. |
208 | Note, add more Kconfig dependency if it's adopted | ||
209 | on some machine other than Maple. | ||
206 | 210 | ||
207 | endif # EDAC | 211 | endif # EDAC |
diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile index a5fdcf02f591..59076819135d 100644 --- a/drivers/edac/Makefile +++ b/drivers/edac/Makefile | |||
@@ -35,3 +35,5 @@ obj-$(CONFIG_EDAC_MPC85XX) += mpc85xx_edac.o | |||
35 | obj-$(CONFIG_EDAC_MV64X60) += mv64x60_edac.o | 35 | obj-$(CONFIG_EDAC_MV64X60) += mv64x60_edac.o |
36 | obj-$(CONFIG_EDAC_CELL) += cell_edac.o | 36 | obj-$(CONFIG_EDAC_CELL) += cell_edac.o |
37 | obj-$(CONFIG_EDAC_PPC4XX) += ppc4xx_edac.o | 37 | obj-$(CONFIG_EDAC_PPC4XX) += ppc4xx_edac.o |
38 | obj-$(CONFIG_EDAC_AMD8111) += amd8111_edac.o | ||
39 | obj-$(CONFIG_EDAC_AMD8131) += amd8131_edac.o | ||
diff --git a/drivers/edac/amd8111_edac.c b/drivers/edac/amd8111_edac.c index 614692181120..2cb58ef743e0 100644 --- a/drivers/edac/amd8111_edac.c +++ b/drivers/edac/amd8111_edac.c | |||
@@ -389,7 +389,7 @@ static int amd8111_dev_probe(struct pci_dev *dev, | |||
389 | dev_info->edac_dev->dev = &dev_info->dev->dev; | 389 | dev_info->edac_dev->dev = &dev_info->dev->dev; |
390 | dev_info->edac_dev->mod_name = AMD8111_EDAC_MOD_STR; | 390 | dev_info->edac_dev->mod_name = AMD8111_EDAC_MOD_STR; |
391 | dev_info->edac_dev->ctl_name = dev_info->ctl_name; | 391 | dev_info->edac_dev->ctl_name = dev_info->ctl_name; |
392 | dev_info->edac_dev->dev_name = dev_info->dev->dev.bus_id; | 392 | dev_info->edac_dev->dev_name = dev_name(&dev_info->dev->dev); |
393 | 393 | ||
394 | if (edac_op_state == EDAC_OPSTATE_POLL) | 394 | if (edac_op_state == EDAC_OPSTATE_POLL) |
395 | dev_info->edac_dev->edac_check = dev_info->check; | 395 | dev_info->edac_dev->edac_check = dev_info->check; |
@@ -473,7 +473,7 @@ static int amd8111_pci_probe(struct pci_dev *dev, | |||
473 | pci_info->edac_dev->dev = &pci_info->dev->dev; | 473 | pci_info->edac_dev->dev = &pci_info->dev->dev; |
474 | pci_info->edac_dev->mod_name = AMD8111_EDAC_MOD_STR; | 474 | pci_info->edac_dev->mod_name = AMD8111_EDAC_MOD_STR; |
475 | pci_info->edac_dev->ctl_name = pci_info->ctl_name; | 475 | pci_info->edac_dev->ctl_name = pci_info->ctl_name; |
476 | pci_info->edac_dev->dev_name = pci_info->dev->dev.bus_id; | 476 | pci_info->edac_dev->dev_name = dev_name(&pci_info->dev->dev); |
477 | 477 | ||
478 | if (edac_op_state == EDAC_OPSTATE_POLL) | 478 | if (edac_op_state == EDAC_OPSTATE_POLL) |
479 | pci_info->edac_dev->edac_check = pci_info->check; | 479 | pci_info->edac_dev->edac_check = pci_info->check; |
diff --git a/drivers/edac/amd8131_edac.c b/drivers/edac/amd8131_edac.c index c083b31cac5a..b432d60c622a 100644 --- a/drivers/edac/amd8131_edac.c +++ b/drivers/edac/amd8131_edac.c | |||
@@ -287,7 +287,7 @@ static int amd8131_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
287 | dev_info->edac_dev->dev = &dev_info->dev->dev; | 287 | dev_info->edac_dev->dev = &dev_info->dev->dev; |
288 | dev_info->edac_dev->mod_name = AMD8131_EDAC_MOD_STR; | 288 | dev_info->edac_dev->mod_name = AMD8131_EDAC_MOD_STR; |
289 | dev_info->edac_dev->ctl_name = dev_info->ctl_name; | 289 | dev_info->edac_dev->ctl_name = dev_info->ctl_name; |
290 | dev_info->edac_dev->dev_name = dev_info->dev->dev.bus_id; | 290 | dev_info->edac_dev->dev_name = dev_name(&dev_info->dev->dev); |
291 | 291 | ||
292 | if (edac_op_state == EDAC_OPSTATE_POLL) | 292 | if (edac_op_state == EDAC_OPSTATE_POLL) |
293 | dev_info->edac_dev->edac_check = amd8131_chipset.check; | 293 | dev_info->edac_dev->edac_check = amd8131_chipset.check; |
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 4cd35d8fd799..f5d46e7199d4 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -67,12 +67,18 @@ config DRM_I830 | |||
67 | will load the correct one. | 67 | will load the correct one. |
68 | 68 | ||
69 | config DRM_I915 | 69 | config DRM_I915 |
70 | tristate "i915 driver" | ||
70 | select FB_CFB_FILLRECT | 71 | select FB_CFB_FILLRECT |
71 | select FB_CFB_COPYAREA | 72 | select FB_CFB_COPYAREA |
72 | select FB_CFB_IMAGEBLIT | 73 | select FB_CFB_IMAGEBLIT |
73 | select FB | 74 | select FB |
74 | select FRAMEBUFFER_CONSOLE if !EMBEDDED | 75 | select FRAMEBUFFER_CONSOLE if !EMBEDDED |
75 | tristate "i915 driver" | 76 | # i915 depends on ACPI_VIDEO when ACPI is enabled |
77 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick | ||
78 | select VIDEO_OUTPUT_CONTROL if ACPI | ||
79 | select BACKLIGHT_CLASS_DEVICE if ACPI | ||
80 | select INPUT if ACPI | ||
81 | select ACPI_VIDEO if ACPI | ||
76 | help | 82 | help |
77 | Choose this option if you have a system that has Intel 830M, 845G, | 83 | Choose this option if you have a system that has Intel 830M, 845G, |
78 | 852GM, 855GM 865G or 915G integrated graphics. If M is selected, the | 84 | 852GM, 855GM 865G or 915G integrated graphics. If M is selected, the |
@@ -84,12 +90,6 @@ config DRM_I915 | |||
84 | config DRM_I915_KMS | 90 | config DRM_I915_KMS |
85 | bool "Enable modesetting on intel by default" | 91 | bool "Enable modesetting on intel by default" |
86 | depends on DRM_I915 | 92 | depends on DRM_I915 |
87 | # i915 KMS depends on ACPI_VIDEO when ACPI is enabled | ||
88 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick | ||
89 | select VIDEO_OUTPUT_CONTROL if ACPI | ||
90 | select BACKLIGHT_CLASS_DEVICE if ACPI | ||
91 | select INPUT if ACPI | ||
92 | select ACPI_VIDEO if ACPI | ||
93 | help | 93 | help |
94 | Choose this option if you want kernel modesetting enabled by default, | 94 | Choose this option if you want kernel modesetting enabled by default, |
95 | and you have a new enough userspace to support this. Running old | 95 | and you have a new enough userspace to support this. Running old |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 9b149fe824c3..c431fa54bbb5 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -180,7 +180,8 @@ typedef struct drm_i915_private { | |||
180 | int backlight_duty_cycle; /* restore backlight to this value */ | 180 | int backlight_duty_cycle; /* restore backlight to this value */ |
181 | bool panel_wants_dither; | 181 | bool panel_wants_dither; |
182 | struct drm_display_mode *panel_fixed_mode; | 182 | struct drm_display_mode *panel_fixed_mode; |
183 | struct drm_display_mode *vbt_mode; /* if any */ | 183 | struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */ |
184 | struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */ | ||
184 | 185 | ||
185 | /* Feature bits from the VBIOS */ | 186 | /* Feature bits from the VBIOS */ |
186 | unsigned int int_tv_support:1; | 187 | unsigned int int_tv_support:1; |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index b189b49c7602..670d12881468 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -349,7 +349,7 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, struct drm_gem_object *obj, | |||
349 | last_data_page = (data_ptr + args->size - 1) / PAGE_SIZE; | 349 | last_data_page = (data_ptr + args->size - 1) / PAGE_SIZE; |
350 | num_pages = last_data_page - first_data_page + 1; | 350 | num_pages = last_data_page - first_data_page + 1; |
351 | 351 | ||
352 | user_pages = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL); | 352 | user_pages = drm_calloc_large(num_pages, sizeof(struct page *)); |
353 | if (user_pages == NULL) | 353 | if (user_pages == NULL) |
354 | return -ENOMEM; | 354 | return -ENOMEM; |
355 | 355 | ||
@@ -429,7 +429,7 @@ fail_put_user_pages: | |||
429 | SetPageDirty(user_pages[i]); | 429 | SetPageDirty(user_pages[i]); |
430 | page_cache_release(user_pages[i]); | 430 | page_cache_release(user_pages[i]); |
431 | } | 431 | } |
432 | kfree(user_pages); | 432 | drm_free_large(user_pages); |
433 | 433 | ||
434 | return ret; | 434 | return ret; |
435 | } | 435 | } |
@@ -649,7 +649,7 @@ i915_gem_gtt_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj, | |||
649 | last_data_page = (data_ptr + args->size - 1) / PAGE_SIZE; | 649 | last_data_page = (data_ptr + args->size - 1) / PAGE_SIZE; |
650 | num_pages = last_data_page - first_data_page + 1; | 650 | num_pages = last_data_page - first_data_page + 1; |
651 | 651 | ||
652 | user_pages = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL); | 652 | user_pages = drm_calloc_large(num_pages, sizeof(struct page *)); |
653 | if (user_pages == NULL) | 653 | if (user_pages == NULL) |
654 | return -ENOMEM; | 654 | return -ENOMEM; |
655 | 655 | ||
@@ -719,7 +719,7 @@ out_unlock: | |||
719 | out_unpin_pages: | 719 | out_unpin_pages: |
720 | for (i = 0; i < pinned_pages; i++) | 720 | for (i = 0; i < pinned_pages; i++) |
721 | page_cache_release(user_pages[i]); | 721 | page_cache_release(user_pages[i]); |
722 | kfree(user_pages); | 722 | drm_free_large(user_pages); |
723 | 723 | ||
724 | return ret; | 724 | return ret; |
725 | } | 725 | } |
@@ -824,7 +824,7 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj, | |||
824 | last_data_page = (data_ptr + args->size - 1) / PAGE_SIZE; | 824 | last_data_page = (data_ptr + args->size - 1) / PAGE_SIZE; |
825 | num_pages = last_data_page - first_data_page + 1; | 825 | num_pages = last_data_page - first_data_page + 1; |
826 | 826 | ||
827 | user_pages = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL); | 827 | user_pages = drm_calloc_large(num_pages, sizeof(struct page *)); |
828 | if (user_pages == NULL) | 828 | if (user_pages == NULL) |
829 | return -ENOMEM; | 829 | return -ENOMEM; |
830 | 830 | ||
@@ -902,7 +902,7 @@ fail_unlock: | |||
902 | fail_put_user_pages: | 902 | fail_put_user_pages: |
903 | for (i = 0; i < pinned_pages; i++) | 903 | for (i = 0; i < pinned_pages; i++) |
904 | page_cache_release(user_pages[i]); | 904 | page_cache_release(user_pages[i]); |
905 | kfree(user_pages); | 905 | drm_free_large(user_pages); |
906 | 906 | ||
907 | return ret; | 907 | return ret; |
908 | } | 908 | } |
@@ -1145,7 +1145,14 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
1145 | mutex_unlock(&dev->struct_mutex); | 1145 | mutex_unlock(&dev->struct_mutex); |
1146 | return VM_FAULT_SIGBUS; | 1146 | return VM_FAULT_SIGBUS; |
1147 | } | 1147 | } |
1148 | list_add(&obj_priv->list, &dev_priv->mm.inactive_list); | 1148 | |
1149 | ret = i915_gem_object_set_to_gtt_domain(obj, write); | ||
1150 | if (ret) { | ||
1151 | mutex_unlock(&dev->struct_mutex); | ||
1152 | return VM_FAULT_SIGBUS; | ||
1153 | } | ||
1154 | |||
1155 | list_add_tail(&obj_priv->list, &dev_priv->mm.inactive_list); | ||
1149 | } | 1156 | } |
1150 | 1157 | ||
1151 | /* Need a new fence register? */ | 1158 | /* Need a new fence register? */ |
@@ -1375,7 +1382,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, | |||
1375 | mutex_unlock(&dev->struct_mutex); | 1382 | mutex_unlock(&dev->struct_mutex); |
1376 | return ret; | 1383 | return ret; |
1377 | } | 1384 | } |
1378 | list_add(&obj_priv->list, &dev_priv->mm.inactive_list); | 1385 | list_add_tail(&obj_priv->list, &dev_priv->mm.inactive_list); |
1379 | } | 1386 | } |
1380 | 1387 | ||
1381 | drm_gem_object_unreference(obj); | 1388 | drm_gem_object_unreference(obj); |
@@ -1408,9 +1415,7 @@ i915_gem_object_put_pages(struct drm_gem_object *obj) | |||
1408 | } | 1415 | } |
1409 | obj_priv->dirty = 0; | 1416 | obj_priv->dirty = 0; |
1410 | 1417 | ||
1411 | drm_free(obj_priv->pages, | 1418 | drm_free_large(obj_priv->pages); |
1412 | page_count * sizeof(struct page *), | ||
1413 | DRM_MEM_DRIVER); | ||
1414 | obj_priv->pages = NULL; | 1419 | obj_priv->pages = NULL; |
1415 | } | 1420 | } |
1416 | 1421 | ||
@@ -2024,8 +2029,7 @@ i915_gem_object_get_pages(struct drm_gem_object *obj) | |||
2024 | */ | 2029 | */ |
2025 | page_count = obj->size / PAGE_SIZE; | 2030 | page_count = obj->size / PAGE_SIZE; |
2026 | BUG_ON(obj_priv->pages != NULL); | 2031 | BUG_ON(obj_priv->pages != NULL); |
2027 | obj_priv->pages = drm_calloc(page_count, sizeof(struct page *), | 2032 | obj_priv->pages = drm_calloc_large(page_count, sizeof(struct page *)); |
2028 | DRM_MEM_DRIVER); | ||
2029 | if (obj_priv->pages == NULL) { | 2033 | if (obj_priv->pages == NULL) { |
2030 | DRM_ERROR("Faled to allocate page list\n"); | 2034 | DRM_ERROR("Faled to allocate page list\n"); |
2031 | obj_priv->pages_refcount--; | 2035 | obj_priv->pages_refcount--; |
@@ -2131,8 +2135,10 @@ static void i830_write_fence_reg(struct drm_i915_fence_reg *reg) | |||
2131 | return; | 2135 | return; |
2132 | } | 2136 | } |
2133 | 2137 | ||
2134 | pitch_val = (obj_priv->stride / 128) - 1; | 2138 | pitch_val = obj_priv->stride / 128; |
2135 | WARN_ON(pitch_val & ~0x0000000f); | 2139 | pitch_val = ffs(pitch_val) - 1; |
2140 | WARN_ON(pitch_val > I830_FENCE_MAX_PITCH_VAL); | ||
2141 | |||
2136 | val = obj_priv->gtt_offset; | 2142 | val = obj_priv->gtt_offset; |
2137 | if (obj_priv->tiling_mode == I915_TILING_Y) | 2143 | if (obj_priv->tiling_mode == I915_TILING_Y) |
2138 | val |= 1 << I830_FENCE_TILING_Y_SHIFT; | 2144 | val |= 1 << I830_FENCE_TILING_Y_SHIFT; |
@@ -2424,6 +2430,16 @@ i915_gem_clflush_object(struct drm_gem_object *obj) | |||
2424 | if (obj_priv->pages == NULL) | 2430 | if (obj_priv->pages == NULL) |
2425 | return; | 2431 | return; |
2426 | 2432 | ||
2433 | /* XXX: The 865 in particular appears to be weird in how it handles | ||
2434 | * cache flushing. We haven't figured it out, but the | ||
2435 | * clflush+agp_chipset_flush doesn't appear to successfully get the | ||
2436 | * data visible to the PGU, while wbinvd + agp_chipset_flush does. | ||
2437 | */ | ||
2438 | if (IS_I865G(obj->dev)) { | ||
2439 | wbinvd(); | ||
2440 | return; | ||
2441 | } | ||
2442 | |||
2427 | drm_clflush_pages(obj_priv->pages, obj->size / PAGE_SIZE); | 2443 | drm_clflush_pages(obj_priv->pages, obj->size / PAGE_SIZE); |
2428 | } | 2444 | } |
2429 | 2445 | ||
@@ -3111,7 +3127,7 @@ i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list, | |||
3111 | reloc_count += exec_list[i].relocation_count; | 3127 | reloc_count += exec_list[i].relocation_count; |
3112 | } | 3128 | } |
3113 | 3129 | ||
3114 | *relocs = drm_calloc(reloc_count, sizeof(**relocs), DRM_MEM_DRIVER); | 3130 | *relocs = drm_calloc_large(reloc_count, sizeof(**relocs)); |
3115 | if (*relocs == NULL) | 3131 | if (*relocs == NULL) |
3116 | return -ENOMEM; | 3132 | return -ENOMEM; |
3117 | 3133 | ||
@@ -3125,8 +3141,7 @@ i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list, | |||
3125 | exec_list[i].relocation_count * | 3141 | exec_list[i].relocation_count * |
3126 | sizeof(**relocs)); | 3142 | sizeof(**relocs)); |
3127 | if (ret != 0) { | 3143 | if (ret != 0) { |
3128 | drm_free(*relocs, reloc_count * sizeof(**relocs), | 3144 | drm_free_large(*relocs); |
3129 | DRM_MEM_DRIVER); | ||
3130 | *relocs = NULL; | 3145 | *relocs = NULL; |
3131 | return -EFAULT; | 3146 | return -EFAULT; |
3132 | } | 3147 | } |
@@ -3165,7 +3180,7 @@ i915_gem_put_relocs_to_user(struct drm_i915_gem_exec_object *exec_list, | |||
3165 | } | 3180 | } |
3166 | 3181 | ||
3167 | err: | 3182 | err: |
3168 | drm_free(relocs, reloc_count * sizeof(*relocs), DRM_MEM_DRIVER); | 3183 | drm_free_large(relocs); |
3169 | 3184 | ||
3170 | return ret; | 3185 | return ret; |
3171 | } | 3186 | } |
@@ -3198,10 +3213,8 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, | |||
3198 | return -EINVAL; | 3213 | return -EINVAL; |
3199 | } | 3214 | } |
3200 | /* Copy in the exec list from userland */ | 3215 | /* Copy in the exec list from userland */ |
3201 | exec_list = drm_calloc(sizeof(*exec_list), args->buffer_count, | 3216 | exec_list = drm_calloc_large(sizeof(*exec_list), args->buffer_count); |
3202 | DRM_MEM_DRIVER); | 3217 | object_list = drm_calloc_large(sizeof(*object_list), args->buffer_count); |
3203 | object_list = drm_calloc(sizeof(*object_list), args->buffer_count, | ||
3204 | DRM_MEM_DRIVER); | ||
3205 | if (exec_list == NULL || object_list == NULL) { | 3218 | if (exec_list == NULL || object_list == NULL) { |
3206 | DRM_ERROR("Failed to allocate exec or object list " | 3219 | DRM_ERROR("Failed to allocate exec or object list " |
3207 | "for %d buffers\n", | 3220 | "for %d buffers\n", |
@@ -3462,10 +3475,8 @@ err: | |||
3462 | } | 3475 | } |
3463 | 3476 | ||
3464 | pre_mutex_err: | 3477 | pre_mutex_err: |
3465 | drm_free(object_list, sizeof(*object_list) * args->buffer_count, | 3478 | drm_free_large(object_list); |
3466 | DRM_MEM_DRIVER); | 3479 | drm_free_large(exec_list); |
3467 | drm_free(exec_list, sizeof(*exec_list) * args->buffer_count, | ||
3468 | DRM_MEM_DRIVER); | ||
3469 | drm_free(cliprects, sizeof(*cliprects) * args->num_cliprects, | 3480 | drm_free(cliprects, sizeof(*cliprects) * args->num_cliprects, |
3470 | DRM_MEM_DRIVER); | 3481 | DRM_MEM_DRIVER); |
3471 | 3482 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 52a059354e83..540dd336e6ec 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -213,7 +213,8 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | |||
213 | if (tiling_mode == I915_TILING_NONE) | 213 | if (tiling_mode == I915_TILING_NONE) |
214 | return true; | 214 | return true; |
215 | 215 | ||
216 | if (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev)) | 216 | if (!IS_I9XX(dev) || |
217 | (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))) | ||
217 | tile_width = 128; | 218 | tile_width = 128; |
218 | else | 219 | else |
219 | tile_width = 512; | 220 | tile_width = 512; |
@@ -225,11 +226,18 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | |||
225 | if (stride / 128 > I965_FENCE_MAX_PITCH_VAL) | 226 | if (stride / 128 > I965_FENCE_MAX_PITCH_VAL) |
226 | return false; | 227 | return false; |
227 | } else if (IS_I9XX(dev)) { | 228 | } else if (IS_I9XX(dev)) { |
228 | if (stride / tile_width > I830_FENCE_MAX_PITCH_VAL || | 229 | uint32_t pitch_val = ffs(stride / tile_width) - 1; |
230 | |||
231 | /* XXX: For Y tiling, FENCE_MAX_PITCH_VAL is actually 6 (8KB) | ||
232 | * instead of 4 (2KB) on 945s. | ||
233 | */ | ||
234 | if (pitch_val > I915_FENCE_MAX_PITCH_VAL || | ||
229 | size > (I830_FENCE_MAX_SIZE_VAL << 20)) | 235 | size > (I830_FENCE_MAX_SIZE_VAL << 20)) |
230 | return false; | 236 | return false; |
231 | } else { | 237 | } else { |
232 | if (stride / 128 > I830_FENCE_MAX_PITCH_VAL || | 238 | uint32_t pitch_val = ffs(stride / tile_width) - 1; |
239 | |||
240 | if (pitch_val > I830_FENCE_MAX_PITCH_VAL || | ||
233 | size > (I830_FENCE_MAX_SIZE_VAL << 19)) | 241 | size > (I830_FENCE_MAX_SIZE_VAL << 19)) |
234 | return false; | 242 | return false; |
235 | } | 243 | } |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 15da44cf21b1..375569d01d01 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -190,7 +190,8 @@ | |||
190 | #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8) | 190 | #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8) |
191 | #define I830_FENCE_PITCH_SHIFT 4 | 191 | #define I830_FENCE_PITCH_SHIFT 4 |
192 | #define I830_FENCE_REG_VALID (1<<0) | 192 | #define I830_FENCE_REG_VALID (1<<0) |
193 | #define I830_FENCE_MAX_PITCH_VAL 0x10 | 193 | #define I915_FENCE_MAX_PITCH_VAL 0x10 |
194 | #define I830_FENCE_MAX_PITCH_VAL 6 | ||
194 | #define I830_FENCE_MAX_SIZE_VAL (1<<8) | 195 | #define I830_FENCE_MAX_SIZE_VAL (1<<8) |
195 | 196 | ||
196 | #define I915_FENCE_START_MASK 0x0ff00000 | 197 | #define I915_FENCE_START_MASK 0x0ff00000 |
@@ -1410,9 +1411,25 @@ | |||
1410 | 1411 | ||
1411 | /* Cursor A & B regs */ | 1412 | /* Cursor A & B regs */ |
1412 | #define CURACNTR 0x70080 | 1413 | #define CURACNTR 0x70080 |
1414 | /* Old style CUR*CNTR flags (desktop 8xx) */ | ||
1415 | #define CURSOR_ENABLE 0x80000000 | ||
1416 | #define CURSOR_GAMMA_ENABLE 0x40000000 | ||
1417 | #define CURSOR_STRIDE_MASK 0x30000000 | ||
1418 | #define CURSOR_FORMAT_SHIFT 24 | ||
1419 | #define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT) | ||
1420 | #define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT) | ||
1421 | #define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT) | ||
1422 | #define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT) | ||
1423 | #define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT) | ||
1424 | #define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT) | ||
1425 | /* New style CUR*CNTR flags */ | ||
1426 | #define CURSOR_MODE 0x27 | ||
1413 | #define CURSOR_MODE_DISABLE 0x00 | 1427 | #define CURSOR_MODE_DISABLE 0x00 |
1414 | #define CURSOR_MODE_64_32B_AX 0x07 | 1428 | #define CURSOR_MODE_64_32B_AX 0x07 |
1415 | #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX) | 1429 | #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX) |
1430 | #define MCURSOR_PIPE_SELECT (1 << 28) | ||
1431 | #define MCURSOR_PIPE_A 0x00 | ||
1432 | #define MCURSOR_PIPE_B (1 << 28) | ||
1416 | #define MCURSOR_GAMMA_ENABLE (1 << 26) | 1433 | #define MCURSOR_GAMMA_ENABLE (1 << 26) |
1417 | #define CURABASE 0x70084 | 1434 | #define CURABASE 0x70084 |
1418 | #define CURAPOS 0x70088 | 1435 | #define CURAPOS 0x70088 |
@@ -1420,6 +1437,7 @@ | |||
1420 | #define CURSOR_POS_SIGN 0x8000 | 1437 | #define CURSOR_POS_SIGN 0x8000 |
1421 | #define CURSOR_X_SHIFT 0 | 1438 | #define CURSOR_X_SHIFT 0 |
1422 | #define CURSOR_Y_SHIFT 16 | 1439 | #define CURSOR_Y_SHIFT 16 |
1440 | #define CURSIZE 0x700a0 | ||
1423 | #define CURBCNTR 0x700c0 | 1441 | #define CURBCNTR 0x700c0 |
1424 | #define CURBBASE 0x700c4 | 1442 | #define CURBBASE 0x700c4 |
1425 | #define CURBPOS 0x700c8 | 1443 | #define CURBPOS 0x700c8 |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index fc28e2bbd542..9d78cff33b24 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -57,9 +57,43 @@ find_section(struct bdb_header *bdb, int section_id) | |||
57 | return NULL; | 57 | return NULL; |
58 | } | 58 | } |
59 | 59 | ||
60 | /* Try to find panel data */ | ||
61 | static void | 60 | static void |
62 | parse_panel_data(struct drm_i915_private *dev_priv, struct bdb_header *bdb) | 61 | fill_detail_timing_data(struct drm_display_mode *panel_fixed_mode, |
62 | struct lvds_dvo_timing *dvo_timing) | ||
63 | { | ||
64 | panel_fixed_mode->hdisplay = (dvo_timing->hactive_hi << 8) | | ||
65 | dvo_timing->hactive_lo; | ||
66 | panel_fixed_mode->hsync_start = panel_fixed_mode->hdisplay + | ||
67 | ((dvo_timing->hsync_off_hi << 8) | dvo_timing->hsync_off_lo); | ||
68 | panel_fixed_mode->hsync_end = panel_fixed_mode->hsync_start + | ||
69 | dvo_timing->hsync_pulse_width; | ||
70 | panel_fixed_mode->htotal = panel_fixed_mode->hdisplay + | ||
71 | ((dvo_timing->hblank_hi << 8) | dvo_timing->hblank_lo); | ||
72 | |||
73 | panel_fixed_mode->vdisplay = (dvo_timing->vactive_hi << 8) | | ||
74 | dvo_timing->vactive_lo; | ||
75 | panel_fixed_mode->vsync_start = panel_fixed_mode->vdisplay + | ||
76 | dvo_timing->vsync_off; | ||
77 | panel_fixed_mode->vsync_end = panel_fixed_mode->vsync_start + | ||
78 | dvo_timing->vsync_pulse_width; | ||
79 | panel_fixed_mode->vtotal = panel_fixed_mode->vdisplay + | ||
80 | ((dvo_timing->vblank_hi << 8) | dvo_timing->vblank_lo); | ||
81 | panel_fixed_mode->clock = dvo_timing->clock * 10; | ||
82 | panel_fixed_mode->type = DRM_MODE_TYPE_PREFERRED; | ||
83 | |||
84 | /* Some VBTs have bogus h/vtotal values */ | ||
85 | if (panel_fixed_mode->hsync_end > panel_fixed_mode->htotal) | ||
86 | panel_fixed_mode->htotal = panel_fixed_mode->hsync_end + 1; | ||
87 | if (panel_fixed_mode->vsync_end > panel_fixed_mode->vtotal) | ||
88 | panel_fixed_mode->vtotal = panel_fixed_mode->vsync_end + 1; | ||
89 | |||
90 | drm_mode_set_name(panel_fixed_mode); | ||
91 | } | ||
92 | |||
93 | /* Try to find integrated panel data */ | ||
94 | static void | ||
95 | parse_lfp_panel_data(struct drm_i915_private *dev_priv, | ||
96 | struct bdb_header *bdb) | ||
63 | { | 97 | { |
64 | struct bdb_lvds_options *lvds_options; | 98 | struct bdb_lvds_options *lvds_options; |
65 | struct bdb_lvds_lfp_data *lvds_lfp_data; | 99 | struct bdb_lvds_lfp_data *lvds_lfp_data; |
@@ -91,38 +125,45 @@ parse_panel_data(struct drm_i915_private *dev_priv, struct bdb_header *bdb) | |||
91 | panel_fixed_mode = drm_calloc(1, sizeof(*panel_fixed_mode), | 125 | panel_fixed_mode = drm_calloc(1, sizeof(*panel_fixed_mode), |
92 | DRM_MEM_DRIVER); | 126 | DRM_MEM_DRIVER); |
93 | 127 | ||
94 | panel_fixed_mode->hdisplay = (dvo_timing->hactive_hi << 8) | | 128 | fill_detail_timing_data(panel_fixed_mode, dvo_timing); |
95 | dvo_timing->hactive_lo; | ||
96 | panel_fixed_mode->hsync_start = panel_fixed_mode->hdisplay + | ||
97 | ((dvo_timing->hsync_off_hi << 8) | dvo_timing->hsync_off_lo); | ||
98 | panel_fixed_mode->hsync_end = panel_fixed_mode->hsync_start + | ||
99 | dvo_timing->hsync_pulse_width; | ||
100 | panel_fixed_mode->htotal = panel_fixed_mode->hdisplay + | ||
101 | ((dvo_timing->hblank_hi << 8) | dvo_timing->hblank_lo); | ||
102 | 129 | ||
103 | panel_fixed_mode->vdisplay = (dvo_timing->vactive_hi << 8) | | 130 | dev_priv->lfp_lvds_vbt_mode = panel_fixed_mode; |
104 | dvo_timing->vactive_lo; | ||
105 | panel_fixed_mode->vsync_start = panel_fixed_mode->vdisplay + | ||
106 | dvo_timing->vsync_off; | ||
107 | panel_fixed_mode->vsync_end = panel_fixed_mode->vsync_start + | ||
108 | dvo_timing->vsync_pulse_width; | ||
109 | panel_fixed_mode->vtotal = panel_fixed_mode->vdisplay + | ||
110 | ((dvo_timing->vblank_hi << 8) | dvo_timing->vblank_lo); | ||
111 | panel_fixed_mode->clock = dvo_timing->clock * 10; | ||
112 | panel_fixed_mode->type = DRM_MODE_TYPE_PREFERRED; | ||
113 | 131 | ||
114 | /* Some VBTs have bogus h/vtotal values */ | 132 | DRM_DEBUG("Found panel mode in BIOS VBT tables:\n"); |
115 | if (panel_fixed_mode->hsync_end > panel_fixed_mode->htotal) | 133 | drm_mode_debug_printmodeline(panel_fixed_mode); |
116 | panel_fixed_mode->htotal = panel_fixed_mode->hsync_end + 1; | ||
117 | if (panel_fixed_mode->vsync_end > panel_fixed_mode->vtotal) | ||
118 | panel_fixed_mode->vtotal = panel_fixed_mode->vsync_end + 1; | ||
119 | 134 | ||
120 | drm_mode_set_name(panel_fixed_mode); | 135 | return; |
136 | } | ||
137 | |||
138 | /* Try to find sdvo panel data */ | ||
139 | static void | ||
140 | parse_sdvo_panel_data(struct drm_i915_private *dev_priv, | ||
141 | struct bdb_header *bdb) | ||
142 | { | ||
143 | struct bdb_sdvo_lvds_options *sdvo_lvds_options; | ||
144 | struct lvds_dvo_timing *dvo_timing; | ||
145 | struct drm_display_mode *panel_fixed_mode; | ||
121 | 146 | ||
122 | dev_priv->vbt_mode = panel_fixed_mode; | 147 | dev_priv->sdvo_lvds_vbt_mode = NULL; |
123 | 148 | ||
124 | DRM_DEBUG("Found panel mode in BIOS VBT tables:\n"); | 149 | sdvo_lvds_options = find_section(bdb, BDB_SDVO_LVDS_OPTIONS); |
125 | drm_mode_debug_printmodeline(panel_fixed_mode); | 150 | if (!sdvo_lvds_options) |
151 | return; | ||
152 | |||
153 | dvo_timing = find_section(bdb, BDB_SDVO_PANEL_DTDS); | ||
154 | if (!dvo_timing) | ||
155 | return; | ||
156 | |||
157 | panel_fixed_mode = drm_calloc(1, sizeof(*panel_fixed_mode), | ||
158 | DRM_MEM_DRIVER); | ||
159 | |||
160 | if (!panel_fixed_mode) | ||
161 | return; | ||
162 | |||
163 | fill_detail_timing_data(panel_fixed_mode, | ||
164 | dvo_timing + sdvo_lvds_options->panel_type); | ||
165 | |||
166 | dev_priv->sdvo_lvds_vbt_mode = panel_fixed_mode; | ||
126 | 167 | ||
127 | return; | 168 | return; |
128 | } | 169 | } |
@@ -199,7 +240,8 @@ intel_init_bios(struct drm_device *dev) | |||
199 | 240 | ||
200 | /* Grab useful general definitions */ | 241 | /* Grab useful general definitions */ |
201 | parse_general_features(dev_priv, bdb); | 242 | parse_general_features(dev_priv, bdb); |
202 | parse_panel_data(dev_priv, bdb); | 243 | parse_lfp_panel_data(dev_priv, bdb); |
244 | parse_sdvo_panel_data(dev_priv, bdb); | ||
203 | 245 | ||
204 | pci_unmap_rom(pdev, bios); | 246 | pci_unmap_rom(pdev, bios); |
205 | 247 | ||
diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h index de621aad85b5..8ca2cde15804 100644 --- a/drivers/gpu/drm/i915/intel_bios.h +++ b/drivers/gpu/drm/i915/intel_bios.h | |||
@@ -279,6 +279,23 @@ struct vch_bdb_22 { | |||
279 | struct vch_panel_data panels[16]; | 279 | struct vch_panel_data panels[16]; |
280 | } __attribute__((packed)); | 280 | } __attribute__((packed)); |
281 | 281 | ||
282 | struct bdb_sdvo_lvds_options { | ||
283 | u8 panel_backlight; | ||
284 | u8 h40_set_panel_type; | ||
285 | u8 panel_type; | ||
286 | u8 ssc_clk_freq; | ||
287 | u16 als_low_trip; | ||
288 | u16 als_high_trip; | ||
289 | u8 sclalarcoeff_tab_row_num; | ||
290 | u8 sclalarcoeff_tab_row_size; | ||
291 | u8 coefficient[8]; | ||
292 | u8 panel_misc_bits_1; | ||
293 | u8 panel_misc_bits_2; | ||
294 | u8 panel_misc_bits_3; | ||
295 | u8 panel_misc_bits_4; | ||
296 | } __attribute__((packed)); | ||
297 | |||
298 | |||
282 | bool intel_init_bios(struct drm_device *dev); | 299 | bool intel_init_bios(struct drm_device *dev); |
283 | 300 | ||
284 | /* | 301 | /* |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 19148c3df637..640f5158effc 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -198,9 +198,142 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) | |||
198 | return intel_ddc_probe(intel_output); | 198 | return intel_ddc_probe(intel_output); |
199 | } | 199 | } |
200 | 200 | ||
201 | static enum drm_connector_status | ||
202 | intel_crt_load_detect(struct drm_crtc *crtc, struct intel_output *intel_output) | ||
203 | { | ||
204 | struct drm_encoder *encoder = &intel_output->enc; | ||
205 | struct drm_device *dev = encoder->dev; | ||
206 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
207 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
208 | uint32_t pipe = intel_crtc->pipe; | ||
209 | uint32_t save_bclrpat; | ||
210 | uint32_t save_vtotal; | ||
211 | uint32_t vtotal, vactive; | ||
212 | uint32_t vsample; | ||
213 | uint32_t vblank, vblank_start, vblank_end; | ||
214 | uint32_t dsl; | ||
215 | uint32_t bclrpat_reg; | ||
216 | uint32_t vtotal_reg; | ||
217 | uint32_t vblank_reg; | ||
218 | uint32_t vsync_reg; | ||
219 | uint32_t pipeconf_reg; | ||
220 | uint32_t pipe_dsl_reg; | ||
221 | uint8_t st00; | ||
222 | enum drm_connector_status status; | ||
223 | |||
224 | if (pipe == 0) { | ||
225 | bclrpat_reg = BCLRPAT_A; | ||
226 | vtotal_reg = VTOTAL_A; | ||
227 | vblank_reg = VBLANK_A; | ||
228 | vsync_reg = VSYNC_A; | ||
229 | pipeconf_reg = PIPEACONF; | ||
230 | pipe_dsl_reg = PIPEADSL; | ||
231 | } else { | ||
232 | bclrpat_reg = BCLRPAT_B; | ||
233 | vtotal_reg = VTOTAL_B; | ||
234 | vblank_reg = VBLANK_B; | ||
235 | vsync_reg = VSYNC_B; | ||
236 | pipeconf_reg = PIPEBCONF; | ||
237 | pipe_dsl_reg = PIPEBDSL; | ||
238 | } | ||
239 | |||
240 | save_bclrpat = I915_READ(bclrpat_reg); | ||
241 | save_vtotal = I915_READ(vtotal_reg); | ||
242 | vblank = I915_READ(vblank_reg); | ||
243 | |||
244 | vtotal = ((save_vtotal >> 16) & 0xfff) + 1; | ||
245 | vactive = (save_vtotal & 0x7ff) + 1; | ||
246 | |||
247 | vblank_start = (vblank & 0xfff) + 1; | ||
248 | vblank_end = ((vblank >> 16) & 0xfff) + 1; | ||
249 | |||
250 | /* Set the border color to purple. */ | ||
251 | I915_WRITE(bclrpat_reg, 0x500050); | ||
252 | |||
253 | if (IS_I9XX(dev)) { | ||
254 | uint32_t pipeconf = I915_READ(pipeconf_reg); | ||
255 | I915_WRITE(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER); | ||
256 | /* Wait for next Vblank to substitue | ||
257 | * border color for Color info */ | ||
258 | intel_wait_for_vblank(dev); | ||
259 | st00 = I915_READ8(VGA_MSR_WRITE); | ||
260 | status = ((st00 & (1 << 4)) != 0) ? | ||
261 | connector_status_connected : | ||
262 | connector_status_disconnected; | ||
263 | |||
264 | I915_WRITE(pipeconf_reg, pipeconf); | ||
265 | } else { | ||
266 | bool restore_vblank = false; | ||
267 | int count, detect; | ||
268 | |||
269 | /* | ||
270 | * If there isn't any border, add some. | ||
271 | * Yes, this will flicker | ||
272 | */ | ||
273 | if (vblank_start <= vactive && vblank_end >= vtotal) { | ||
274 | uint32_t vsync = I915_READ(vsync_reg); | ||
275 | uint32_t vsync_start = (vsync & 0xffff) + 1; | ||
276 | |||
277 | vblank_start = vsync_start; | ||
278 | I915_WRITE(vblank_reg, | ||
279 | (vblank_start - 1) | | ||
280 | ((vblank_end - 1) << 16)); | ||
281 | restore_vblank = true; | ||
282 | } | ||
283 | /* sample in the vertical border, selecting the larger one */ | ||
284 | if (vblank_start - vactive >= vtotal - vblank_end) | ||
285 | vsample = (vblank_start + vactive) >> 1; | ||
286 | else | ||
287 | vsample = (vtotal + vblank_end) >> 1; | ||
288 | |||
289 | /* | ||
290 | * Wait for the border to be displayed | ||
291 | */ | ||
292 | while (I915_READ(pipe_dsl_reg) >= vactive) | ||
293 | ; | ||
294 | while ((dsl = I915_READ(pipe_dsl_reg)) <= vsample) | ||
295 | ; | ||
296 | /* | ||
297 | * Watch ST00 for an entire scanline | ||
298 | */ | ||
299 | detect = 0; | ||
300 | count = 0; | ||
301 | do { | ||
302 | count++; | ||
303 | /* Read the ST00 VGA status register */ | ||
304 | st00 = I915_READ8(VGA_MSR_WRITE); | ||
305 | if (st00 & (1 << 4)) | ||
306 | detect++; | ||
307 | } while ((I915_READ(pipe_dsl_reg) == dsl)); | ||
308 | |||
309 | /* restore vblank if necessary */ | ||
310 | if (restore_vblank) | ||
311 | I915_WRITE(vblank_reg, vblank); | ||
312 | /* | ||
313 | * If more than 3/4 of the scanline detected a monitor, | ||
314 | * then it is assumed to be present. This works even on i830, | ||
315 | * where there isn't any way to force the border color across | ||
316 | * the screen | ||
317 | */ | ||
318 | status = detect * 4 > count * 3 ? | ||
319 | connector_status_connected : | ||
320 | connector_status_disconnected; | ||
321 | } | ||
322 | |||
323 | /* Restore previous settings */ | ||
324 | I915_WRITE(bclrpat_reg, save_bclrpat); | ||
325 | |||
326 | return status; | ||
327 | } | ||
328 | |||
201 | static enum drm_connector_status intel_crt_detect(struct drm_connector *connector) | 329 | static enum drm_connector_status intel_crt_detect(struct drm_connector *connector) |
202 | { | 330 | { |
203 | struct drm_device *dev = connector->dev; | 331 | struct drm_device *dev = connector->dev; |
332 | struct intel_output *intel_output = to_intel_output(connector); | ||
333 | struct drm_encoder *encoder = &intel_output->enc; | ||
334 | struct drm_crtc *crtc; | ||
335 | int dpms_mode; | ||
336 | enum drm_connector_status status; | ||
204 | 337 | ||
205 | if (IS_I9XX(dev) && !IS_I915G(dev) && !IS_I915GM(dev)) { | 338 | if (IS_I9XX(dev) && !IS_I915G(dev) && !IS_I915GM(dev)) { |
206 | if (intel_crt_detect_hotplug(connector)) | 339 | if (intel_crt_detect_hotplug(connector)) |
@@ -212,8 +345,20 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto | |||
212 | if (intel_crt_detect_ddc(connector)) | 345 | if (intel_crt_detect_ddc(connector)) |
213 | return connector_status_connected; | 346 | return connector_status_connected; |
214 | 347 | ||
215 | /* TODO use load detect */ | 348 | /* for pre-945g platforms use load detect */ |
216 | return connector_status_unknown; | 349 | if (encoder->crtc && encoder->crtc->enabled) { |
350 | status = intel_crt_load_detect(encoder->crtc, intel_output); | ||
351 | } else { | ||
352 | crtc = intel_get_load_detect_pipe(intel_output, | ||
353 | NULL, &dpms_mode); | ||
354 | if (crtc) { | ||
355 | status = intel_crt_load_detect(crtc, intel_output); | ||
356 | intel_release_load_detect_pipe(intel_output, dpms_mode); | ||
357 | } else | ||
358 | status = connector_status_unknown; | ||
359 | } | ||
360 | |||
361 | return status; | ||
217 | } | 362 | } |
218 | 363 | ||
219 | static void intel_crt_destroy(struct drm_connector *connector) | 364 | static void intel_crt_destroy(struct drm_connector *connector) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3387cf32f385..c9d6f10ba92e 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1357,7 +1357,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1357 | int pipe = intel_crtc->pipe; | 1357 | int pipe = intel_crtc->pipe; |
1358 | uint32_t control = (pipe == 0) ? CURACNTR : CURBCNTR; | 1358 | uint32_t control = (pipe == 0) ? CURACNTR : CURBCNTR; |
1359 | uint32_t base = (pipe == 0) ? CURABASE : CURBBASE; | 1359 | uint32_t base = (pipe == 0) ? CURABASE : CURBBASE; |
1360 | uint32_t temp; | 1360 | uint32_t temp = I915_READ(control); |
1361 | size_t addr; | 1361 | size_t addr; |
1362 | int ret; | 1362 | int ret; |
1363 | 1363 | ||
@@ -1366,7 +1366,12 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1366 | /* if we want to turn off the cursor ignore width and height */ | 1366 | /* if we want to turn off the cursor ignore width and height */ |
1367 | if (!handle) { | 1367 | if (!handle) { |
1368 | DRM_DEBUG("cursor off\n"); | 1368 | DRM_DEBUG("cursor off\n"); |
1369 | temp = CURSOR_MODE_DISABLE; | 1369 | if (IS_MOBILE(dev) || IS_I9XX(dev)) { |
1370 | temp &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE); | ||
1371 | temp |= CURSOR_MODE_DISABLE; | ||
1372 | } else { | ||
1373 | temp &= ~(CURSOR_ENABLE | CURSOR_GAMMA_ENABLE); | ||
1374 | } | ||
1370 | addr = 0; | 1375 | addr = 0; |
1371 | bo = NULL; | 1376 | bo = NULL; |
1372 | mutex_lock(&dev->struct_mutex); | 1377 | mutex_lock(&dev->struct_mutex); |
@@ -1409,10 +1414,19 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1409 | addr = obj_priv->phys_obj->handle->busaddr; | 1414 | addr = obj_priv->phys_obj->handle->busaddr; |
1410 | } | 1415 | } |
1411 | 1416 | ||
1412 | temp = 0; | 1417 | if (!IS_I9XX(dev)) |
1413 | /* set the pipe for the cursor */ | 1418 | I915_WRITE(CURSIZE, (height << 12) | width); |
1414 | temp |= (pipe << 28); | 1419 | |
1415 | temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE; | 1420 | /* Hooray for CUR*CNTR differences */ |
1421 | if (IS_MOBILE(dev) || IS_I9XX(dev)) { | ||
1422 | temp &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT); | ||
1423 | temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE; | ||
1424 | temp |= (pipe << 28); /* Connect to correct pipe */ | ||
1425 | } else { | ||
1426 | temp &= ~(CURSOR_FORMAT_MASK); | ||
1427 | temp |= CURSOR_ENABLE; | ||
1428 | temp |= CURSOR_FORMAT_ARGB | CURSOR_GAMMA_ENABLE; | ||
1429 | } | ||
1416 | 1430 | ||
1417 | finish: | 1431 | finish: |
1418 | I915_WRITE(control, temp); | 1432 | I915_WRITE(control, temp); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 439a86514993..53731f0ffcb5 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -511,10 +511,10 @@ void intel_lvds_init(struct drm_device *dev) | |||
511 | } | 511 | } |
512 | 512 | ||
513 | /* Failed to get EDID, what about VBT? */ | 513 | /* Failed to get EDID, what about VBT? */ |
514 | if (dev_priv->vbt_mode) { | 514 | if (dev_priv->lfp_lvds_vbt_mode) { |
515 | mutex_lock(&dev->mode_config.mutex); | 515 | mutex_lock(&dev->mode_config.mutex); |
516 | dev_priv->panel_fixed_mode = | 516 | dev_priv->panel_fixed_mode = |
517 | drm_mode_duplicate(dev, dev_priv->vbt_mode); | 517 | drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode); |
518 | mutex_unlock(&dev->mode_config.mutex); | 518 | mutex_unlock(&dev->mode_config.mutex); |
519 | if (dev_priv->panel_fixed_mode) { | 519 | if (dev_priv->panel_fixed_mode) { |
520 | dev_priv->panel_fixed_mode->type |= | 520 | dev_priv->panel_fixed_mode->type |= |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 9913651c1e17..f3ef6bfd8ffc 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -69,6 +69,10 @@ struct intel_sdvo_priv { | |||
69 | * This is set if we treat the device as HDMI, instead of DVI. | 69 | * This is set if we treat the device as HDMI, instead of DVI. |
70 | */ | 70 | */ |
71 | bool is_hdmi; | 71 | bool is_hdmi; |
72 | /** | ||
73 | * This is set if we detect output of sdvo device as LVDS. | ||
74 | */ | ||
75 | bool is_lvds; | ||
72 | 76 | ||
73 | /** | 77 | /** |
74 | * Returned SDTV resolutions allowed for the current format, if the | 78 | * Returned SDTV resolutions allowed for the current format, if the |
@@ -1398,10 +1402,8 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect | |||
1398 | static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) | 1402 | static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) |
1399 | { | 1403 | { |
1400 | struct intel_output *intel_output = to_intel_output(connector); | 1404 | struct intel_output *intel_output = to_intel_output(connector); |
1401 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1402 | 1405 | ||
1403 | /* set the bus switch and get the modes */ | 1406 | /* set the bus switch and get the modes */ |
1404 | intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus); | ||
1405 | intel_ddc_get_modes(intel_output); | 1407 | intel_ddc_get_modes(intel_output); |
1406 | 1408 | ||
1407 | #if 0 | 1409 | #if 0 |
@@ -1543,6 +1545,37 @@ static void intel_sdvo_get_tv_modes(struct drm_connector *connector) | |||
1543 | } | 1545 | } |
1544 | } | 1546 | } |
1545 | 1547 | ||
1548 | static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | ||
1549 | { | ||
1550 | struct intel_output *intel_output = to_intel_output(connector); | ||
1551 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1552 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | ||
1553 | |||
1554 | /* | ||
1555 | * Attempt to get the mode list from DDC. | ||
1556 | * Assume that the preferred modes are | ||
1557 | * arranged in priority order. | ||
1558 | */ | ||
1559 | /* set the bus switch and get the modes */ | ||
1560 | intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus); | ||
1561 | intel_ddc_get_modes(intel_output); | ||
1562 | if (list_empty(&connector->probed_modes) == false) | ||
1563 | return; | ||
1564 | |||
1565 | /* Fetch modes from VBT */ | ||
1566 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { | ||
1567 | struct drm_display_mode *newmode; | ||
1568 | newmode = drm_mode_duplicate(connector->dev, | ||
1569 | dev_priv->sdvo_lvds_vbt_mode); | ||
1570 | if (newmode != NULL) { | ||
1571 | /* Guarantee the mode is preferred */ | ||
1572 | newmode->type = (DRM_MODE_TYPE_PREFERRED | | ||
1573 | DRM_MODE_TYPE_DRIVER); | ||
1574 | drm_mode_probed_add(connector, newmode); | ||
1575 | } | ||
1576 | } | ||
1577 | } | ||
1578 | |||
1546 | static int intel_sdvo_get_modes(struct drm_connector *connector) | 1579 | static int intel_sdvo_get_modes(struct drm_connector *connector) |
1547 | { | 1580 | { |
1548 | struct intel_output *output = to_intel_output(connector); | 1581 | struct intel_output *output = to_intel_output(connector); |
@@ -1550,6 +1583,8 @@ static int intel_sdvo_get_modes(struct drm_connector *connector) | |||
1550 | 1583 | ||
1551 | if (sdvo_priv->is_tv) | 1584 | if (sdvo_priv->is_tv) |
1552 | intel_sdvo_get_tv_modes(connector); | 1585 | intel_sdvo_get_tv_modes(connector); |
1586 | else if (sdvo_priv->is_lvds == true) | ||
1587 | intel_sdvo_get_lvds_modes(connector); | ||
1553 | else | 1588 | else |
1554 | intel_sdvo_get_ddc_modes(connector); | 1589 | intel_sdvo_get_ddc_modes(connector); |
1555 | 1590 | ||
@@ -1564,6 +1599,9 @@ static void intel_sdvo_destroy(struct drm_connector *connector) | |||
1564 | 1599 | ||
1565 | if (intel_output->i2c_bus) | 1600 | if (intel_output->i2c_bus) |
1566 | intel_i2c_destroy(intel_output->i2c_bus); | 1601 | intel_i2c_destroy(intel_output->i2c_bus); |
1602 | if (intel_output->ddc_bus) | ||
1603 | intel_i2c_destroy(intel_output->ddc_bus); | ||
1604 | |||
1567 | drm_sysfs_connector_remove(connector); | 1605 | drm_sysfs_connector_remove(connector); |
1568 | drm_connector_cleanup(connector); | 1606 | drm_connector_cleanup(connector); |
1569 | kfree(intel_output); | 1607 | kfree(intel_output); |
@@ -1660,12 +1698,56 @@ intel_sdvo_get_digital_encoding_mode(struct intel_output *output) | |||
1660 | return true; | 1698 | return true; |
1661 | } | 1699 | } |
1662 | 1700 | ||
1701 | static struct intel_output * | ||
1702 | intel_sdvo_chan_to_intel_output(struct intel_i2c_chan *chan) | ||
1703 | { | ||
1704 | struct drm_device *dev = chan->drm_dev; | ||
1705 | struct drm_connector *connector; | ||
1706 | struct intel_output *intel_output = NULL; | ||
1707 | |||
1708 | list_for_each_entry(connector, | ||
1709 | &dev->mode_config.connector_list, head) { | ||
1710 | if (to_intel_output(connector)->ddc_bus == chan) { | ||
1711 | intel_output = to_intel_output(connector); | ||
1712 | break; | ||
1713 | } | ||
1714 | } | ||
1715 | return intel_output; | ||
1716 | } | ||
1717 | |||
1718 | static int intel_sdvo_master_xfer(struct i2c_adapter *i2c_adap, | ||
1719 | struct i2c_msg msgs[], int num) | ||
1720 | { | ||
1721 | struct intel_output *intel_output; | ||
1722 | struct intel_sdvo_priv *sdvo_priv; | ||
1723 | struct i2c_algo_bit_data *algo_data; | ||
1724 | struct i2c_algorithm *algo; | ||
1725 | |||
1726 | algo_data = (struct i2c_algo_bit_data *)i2c_adap->algo_data; | ||
1727 | intel_output = | ||
1728 | intel_sdvo_chan_to_intel_output( | ||
1729 | (struct intel_i2c_chan *)(algo_data->data)); | ||
1730 | if (intel_output == NULL) | ||
1731 | return -EINVAL; | ||
1732 | |||
1733 | sdvo_priv = intel_output->dev_priv; | ||
1734 | algo = (struct i2c_algorithm *)intel_output->i2c_bus->adapter.algo; | ||
1735 | |||
1736 | intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus); | ||
1737 | return algo->master_xfer(i2c_adap, msgs, num); | ||
1738 | } | ||
1739 | |||
1740 | static struct i2c_algorithm intel_sdvo_i2c_bit_algo = { | ||
1741 | .master_xfer = intel_sdvo_master_xfer, | ||
1742 | }; | ||
1743 | |||
1663 | bool intel_sdvo_init(struct drm_device *dev, int output_device) | 1744 | bool intel_sdvo_init(struct drm_device *dev, int output_device) |
1664 | { | 1745 | { |
1665 | struct drm_connector *connector; | 1746 | struct drm_connector *connector; |
1666 | struct intel_output *intel_output; | 1747 | struct intel_output *intel_output; |
1667 | struct intel_sdvo_priv *sdvo_priv; | 1748 | struct intel_sdvo_priv *sdvo_priv; |
1668 | struct intel_i2c_chan *i2cbus = NULL; | 1749 | struct intel_i2c_chan *i2cbus = NULL; |
1750 | struct intel_i2c_chan *ddcbus = NULL; | ||
1669 | int connector_type; | 1751 | int connector_type; |
1670 | u8 ch[0x40]; | 1752 | u8 ch[0x40]; |
1671 | int i; | 1753 | int i; |
@@ -1676,17 +1758,9 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1676 | return false; | 1758 | return false; |
1677 | } | 1759 | } |
1678 | 1760 | ||
1679 | connector = &intel_output->base; | ||
1680 | |||
1681 | drm_connector_init(dev, connector, &intel_sdvo_connector_funcs, | ||
1682 | DRM_MODE_CONNECTOR_Unknown); | ||
1683 | drm_connector_helper_add(connector, &intel_sdvo_connector_helper_funcs); | ||
1684 | sdvo_priv = (struct intel_sdvo_priv *)(intel_output + 1); | 1761 | sdvo_priv = (struct intel_sdvo_priv *)(intel_output + 1); |
1685 | intel_output->type = INTEL_OUTPUT_SDVO; | 1762 | intel_output->type = INTEL_OUTPUT_SDVO; |
1686 | 1763 | ||
1687 | connector->interlace_allowed = 0; | ||
1688 | connector->doublescan_allowed = 0; | ||
1689 | |||
1690 | /* setup the DDC bus. */ | 1764 | /* setup the DDC bus. */ |
1691 | if (output_device == SDVOB) | 1765 | if (output_device == SDVOB) |
1692 | i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOB"); | 1766 | i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOB"); |
@@ -1694,7 +1768,7 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1694 | i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOC"); | 1768 | i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOC"); |
1695 | 1769 | ||
1696 | if (!i2cbus) | 1770 | if (!i2cbus) |
1697 | goto err_connector; | 1771 | goto err_inteloutput; |
1698 | 1772 | ||
1699 | sdvo_priv->i2c_bus = i2cbus; | 1773 | sdvo_priv->i2c_bus = i2cbus; |
1700 | 1774 | ||
@@ -1710,7 +1784,6 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1710 | intel_output->i2c_bus = i2cbus; | 1784 | intel_output->i2c_bus = i2cbus; |
1711 | intel_output->dev_priv = sdvo_priv; | 1785 | intel_output->dev_priv = sdvo_priv; |
1712 | 1786 | ||
1713 | |||
1714 | /* Read the regs to test if we can talk to the device */ | 1787 | /* Read the regs to test if we can talk to the device */ |
1715 | for (i = 0; i < 0x40; i++) { | 1788 | for (i = 0; i < 0x40; i++) { |
1716 | if (!intel_sdvo_read_byte(intel_output, i, &ch[i])) { | 1789 | if (!intel_sdvo_read_byte(intel_output, i, &ch[i])) { |
@@ -1720,6 +1793,22 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1720 | } | 1793 | } |
1721 | } | 1794 | } |
1722 | 1795 | ||
1796 | /* setup the DDC bus. */ | ||
1797 | if (output_device == SDVOB) | ||
1798 | ddcbus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS"); | ||
1799 | else | ||
1800 | ddcbus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS"); | ||
1801 | |||
1802 | if (ddcbus == NULL) | ||
1803 | goto err_i2c; | ||
1804 | |||
1805 | intel_sdvo_i2c_bit_algo.functionality = | ||
1806 | intel_output->i2c_bus->adapter.algo->functionality; | ||
1807 | ddcbus->adapter.algo = &intel_sdvo_i2c_bit_algo; | ||
1808 | intel_output->ddc_bus = ddcbus; | ||
1809 | |||
1810 | /* In defaut case sdvo lvds is false */ | ||
1811 | sdvo_priv->is_lvds = false; | ||
1723 | intel_sdvo_get_capabilities(intel_output, &sdvo_priv->caps); | 1812 | intel_sdvo_get_capabilities(intel_output, &sdvo_priv->caps); |
1724 | 1813 | ||
1725 | if (sdvo_priv->caps.output_flags & | 1814 | if (sdvo_priv->caps.output_flags & |
@@ -1729,7 +1818,6 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1729 | else | 1818 | else |
1730 | sdvo_priv->controlled_output = SDVO_OUTPUT_TMDS1; | 1819 | sdvo_priv->controlled_output = SDVO_OUTPUT_TMDS1; |
1731 | 1820 | ||
1732 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; | ||
1733 | encoder_type = DRM_MODE_ENCODER_TMDS; | 1821 | encoder_type = DRM_MODE_ENCODER_TMDS; |
1734 | connector_type = DRM_MODE_CONNECTOR_DVID; | 1822 | connector_type = DRM_MODE_CONNECTOR_DVID; |
1735 | 1823 | ||
@@ -1747,7 +1835,6 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1747 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_SVID0) | 1835 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_SVID0) |
1748 | { | 1836 | { |
1749 | sdvo_priv->controlled_output = SDVO_OUTPUT_SVID0; | 1837 | sdvo_priv->controlled_output = SDVO_OUTPUT_SVID0; |
1750 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; | ||
1751 | encoder_type = DRM_MODE_ENCODER_TVDAC; | 1838 | encoder_type = DRM_MODE_ENCODER_TVDAC; |
1752 | connector_type = DRM_MODE_CONNECTOR_SVIDEO; | 1839 | connector_type = DRM_MODE_CONNECTOR_SVIDEO; |
1753 | sdvo_priv->is_tv = true; | 1840 | sdvo_priv->is_tv = true; |
@@ -1756,30 +1843,28 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1756 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB0) | 1843 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB0) |
1757 | { | 1844 | { |
1758 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0; | 1845 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0; |
1759 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; | ||
1760 | encoder_type = DRM_MODE_ENCODER_DAC; | 1846 | encoder_type = DRM_MODE_ENCODER_DAC; |
1761 | connector_type = DRM_MODE_CONNECTOR_VGA; | 1847 | connector_type = DRM_MODE_CONNECTOR_VGA; |
1762 | } | 1848 | } |
1763 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB1) | 1849 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB1) |
1764 | { | 1850 | { |
1765 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1; | 1851 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1; |
1766 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; | ||
1767 | encoder_type = DRM_MODE_ENCODER_DAC; | 1852 | encoder_type = DRM_MODE_ENCODER_DAC; |
1768 | connector_type = DRM_MODE_CONNECTOR_VGA; | 1853 | connector_type = DRM_MODE_CONNECTOR_VGA; |
1769 | } | 1854 | } |
1770 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS0) | 1855 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS0) |
1771 | { | 1856 | { |
1772 | sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS0; | 1857 | sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS0; |
1773 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; | ||
1774 | encoder_type = DRM_MODE_ENCODER_LVDS; | 1858 | encoder_type = DRM_MODE_ENCODER_LVDS; |
1775 | connector_type = DRM_MODE_CONNECTOR_LVDS; | 1859 | connector_type = DRM_MODE_CONNECTOR_LVDS; |
1860 | sdvo_priv->is_lvds = true; | ||
1776 | } | 1861 | } |
1777 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS1) | 1862 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS1) |
1778 | { | 1863 | { |
1779 | sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS1; | 1864 | sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS1; |
1780 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; | ||
1781 | encoder_type = DRM_MODE_ENCODER_LVDS; | 1865 | encoder_type = DRM_MODE_ENCODER_LVDS; |
1782 | connector_type = DRM_MODE_CONNECTOR_LVDS; | 1866 | connector_type = DRM_MODE_CONNECTOR_LVDS; |
1867 | sdvo_priv->is_lvds = true; | ||
1783 | } | 1868 | } |
1784 | else | 1869 | else |
1785 | { | 1870 | { |
@@ -1795,9 +1880,16 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1795 | goto err_i2c; | 1880 | goto err_i2c; |
1796 | } | 1881 | } |
1797 | 1882 | ||
1883 | connector = &intel_output->base; | ||
1884 | drm_connector_init(dev, connector, &intel_sdvo_connector_funcs, | ||
1885 | connector_type); | ||
1886 | drm_connector_helper_add(connector, &intel_sdvo_connector_helper_funcs); | ||
1887 | connector->interlace_allowed = 0; | ||
1888 | connector->doublescan_allowed = 0; | ||
1889 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; | ||
1890 | |||
1798 | drm_encoder_init(dev, &intel_output->enc, &intel_sdvo_enc_funcs, encoder_type); | 1891 | drm_encoder_init(dev, &intel_output->enc, &intel_sdvo_enc_funcs, encoder_type); |
1799 | drm_encoder_helper_add(&intel_output->enc, &intel_sdvo_helper_funcs); | 1892 | drm_encoder_helper_add(&intel_output->enc, &intel_sdvo_helper_funcs); |
1800 | connector->connector_type = connector_type; | ||
1801 | 1893 | ||
1802 | drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); | 1894 | drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); |
1803 | drm_sysfs_connector_add(connector); | 1895 | drm_sysfs_connector_add(connector); |
@@ -1829,14 +1921,13 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1829 | sdvo_priv->caps.output_flags & | 1921 | sdvo_priv->caps.output_flags & |
1830 | (SDVO_OUTPUT_TMDS1 | SDVO_OUTPUT_RGB1) ? 'Y' : 'N'); | 1922 | (SDVO_OUTPUT_TMDS1 | SDVO_OUTPUT_RGB1) ? 'Y' : 'N'); |
1831 | 1923 | ||
1832 | intel_output->ddc_bus = i2cbus; | ||
1833 | |||
1834 | return true; | 1924 | return true; |
1835 | 1925 | ||
1836 | err_i2c: | 1926 | err_i2c: |
1927 | if (ddcbus != NULL) | ||
1928 | intel_i2c_destroy(intel_output->ddc_bus); | ||
1837 | intel_i2c_destroy(intel_output->i2c_bus); | 1929 | intel_i2c_destroy(intel_output->i2c_bus); |
1838 | err_connector: | 1930 | err_inteloutput: |
1839 | drm_connector_cleanup(connector); | ||
1840 | kfree(intel_output); | 1931 | kfree(intel_output); |
1841 | 1932 | ||
1842 | return false; | 1933 | return false; |
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index b5e3b2851698..a1787fdf5b9f 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -182,7 +182,7 @@ static struct platform_driver lm78_isa_driver = { | |||
182 | .name = "lm78", | 182 | .name = "lm78", |
183 | }, | 183 | }, |
184 | .probe = lm78_isa_probe, | 184 | .probe = lm78_isa_probe, |
185 | .remove = lm78_isa_remove, | 185 | .remove = __devexit_p(lm78_isa_remove), |
186 | }; | 186 | }; |
187 | 187 | ||
188 | 188 | ||
diff --git a/drivers/ide/ide-pci-generic.c b/drivers/ide/ide-pci-generic.c index 61111fd27130..39d4e01f5c9c 100644 --- a/drivers/ide/ide-pci-generic.c +++ b/drivers/ide/ide-pci-generic.c | |||
@@ -33,6 +33,16 @@ static int ide_generic_all; /* Set to claim all devices */ | |||
33 | module_param_named(all_generic_ide, ide_generic_all, bool, 0444); | 33 | module_param_named(all_generic_ide, ide_generic_all, bool, 0444); |
34 | MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); | 34 | MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); |
35 | 35 | ||
36 | static void netcell_quirkproc(ide_drive_t *drive) | ||
37 | { | ||
38 | /* mark words 85-87 as valid */ | ||
39 | drive->id[ATA_ID_CSF_DEFAULT] |= 0x4000; | ||
40 | } | ||
41 | |||
42 | static const struct ide_port_ops netcell_port_ops = { | ||
43 | .quirkproc = netcell_quirkproc, | ||
44 | }; | ||
45 | |||
36 | #define DECLARE_GENERIC_PCI_DEV(extra_flags) \ | 46 | #define DECLARE_GENERIC_PCI_DEV(extra_flags) \ |
37 | { \ | 47 | { \ |
38 | .name = DRV_NAME, \ | 48 | .name = DRV_NAME, \ |
@@ -74,6 +84,7 @@ static const struct ide_port_info generic_chipsets[] __devinitdata = { | |||
74 | 84 | ||
75 | { /* 6: Revolution */ | 85 | { /* 6: Revolution */ |
76 | .name = DRV_NAME, | 86 | .name = DRV_NAME, |
87 | .port_ops = &netcell_port_ops, | ||
77 | .host_flags = IDE_HFLAG_CLEAR_SIMPLEX | | 88 | .host_flags = IDE_HFLAG_CLEAR_SIMPLEX | |
78 | IDE_HFLAG_TRUST_BIOS_FOR_DMA | | 89 | IDE_HFLAG_TRUST_BIOS_FOR_DMA | |
79 | IDE_HFLAG_OFF_BOARD, | 90 | IDE_HFLAG_OFF_BOARD, |
diff --git a/drivers/idle/i7300_idle.c b/drivers/idle/i7300_idle.c index bf740394d704..949c97ff57e3 100644 --- a/drivers/idle/i7300_idle.c +++ b/drivers/idle/i7300_idle.c | |||
@@ -41,6 +41,10 @@ static int debug; | |||
41 | module_param_named(debug, debug, uint, 0644); | 41 | module_param_named(debug, debug, uint, 0644); |
42 | MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); | 42 | MODULE_PARM_DESC(debug, "Enable debug printks in this driver"); |
43 | 43 | ||
44 | static int forceload; | ||
45 | module_param_named(forceload, forceload, uint, 0644); | ||
46 | MODULE_PARM_DESC(debug, "Enable driver testing on unvalidated i5000"); | ||
47 | |||
44 | #define dprintk(fmt, arg...) \ | 48 | #define dprintk(fmt, arg...) \ |
45 | do { if (debug) printk(KERN_INFO I7300_PRINT fmt, ##arg); } while (0) | 49 | do { if (debug) printk(KERN_INFO I7300_PRINT fmt, ##arg); } while (0) |
46 | 50 | ||
@@ -552,7 +556,7 @@ static int __init i7300_idle_init(void) | |||
552 | cpus_clear(idle_cpumask); | 556 | cpus_clear(idle_cpumask); |
553 | total_us = 0; | 557 | total_us = 0; |
554 | 558 | ||
555 | if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev)) | 559 | if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev, forceload)) |
556 | return -ENODEV; | 560 | return -ENODEV; |
557 | 561 | ||
558 | if (i7300_idle_thrt_save()) | 562 | if (i7300_idle_thrt_save()) |
diff --git a/drivers/input/input.c b/drivers/input/input.c index e54e002665b0..5d445f48789b 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -42,6 +42,7 @@ static unsigned int input_abs_bypass_init_data[] __initdata = { | |||
42 | ABS_MT_POSITION_Y, | 42 | ABS_MT_POSITION_Y, |
43 | ABS_MT_TOOL_TYPE, | 43 | ABS_MT_TOOL_TYPE, |
44 | ABS_MT_BLOB_ID, | 44 | ABS_MT_BLOB_ID, |
45 | ABS_MT_TRACKING_ID, | ||
45 | 0 | 46 | 0 |
46 | }; | 47 | }; |
47 | static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)]; | 48 | static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)]; |
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index 67248c31e19a..be5bbbb8ae4e 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c | |||
@@ -210,7 +210,7 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
210 | timeout = wait_event_timeout(ps2dev->wait, | 210 | timeout = wait_event_timeout(ps2dev->wait, |
211 | !(ps2dev->flags & PS2_FLAG_CMD1), timeout); | 211 | !(ps2dev->flags & PS2_FLAG_CMD1), timeout); |
212 | 212 | ||
213 | if (ps2dev->cmdcnt && timeout > 0) { | 213 | if (ps2dev->cmdcnt && !(ps2dev->flags & PS2_FLAG_CMD1)) { |
214 | 214 | ||
215 | timeout = ps2_adjust_timeout(ps2dev, command, timeout); | 215 | timeout = ps2_adjust_timeout(ps2dev, command, timeout); |
216 | wait_event_timeout(ps2dev->wait, | 216 | wait_event_timeout(ps2dev->wait, |
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index f100c7f4c1db..6954f5500108 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c | |||
@@ -419,7 +419,7 @@ static int ucb1400_ts_remove(struct platform_device *dev) | |||
419 | #ifdef CONFIG_PM | 419 | #ifdef CONFIG_PM |
420 | static int ucb1400_ts_resume(struct platform_device *dev) | 420 | static int ucb1400_ts_resume(struct platform_device *dev) |
421 | { | 421 | { |
422 | struct ucb1400_ts *ucb = platform_get_drvdata(dev); | 422 | struct ucb1400_ts *ucb = dev->dev.platform_data; |
423 | 423 | ||
424 | if (ucb->ts_task) { | 424 | if (ucb->ts_task) { |
425 | /* | 425 | /* |
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index b171e75cb52e..29808c4fb1cb 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
@@ -175,7 +175,7 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size) | |||
175 | return -EINVAL; | 175 | return -EINVAL; |
176 | } | 176 | } |
177 | src = iwb->read; | 177 | src = iwb->read; |
178 | if (unlikely(limit > BAS_OUTBUFSIZE + BAS_OUTBUFPAD || | 178 | if (unlikely(limit >= BAS_OUTBUFSIZE + BAS_OUTBUFPAD || |
179 | (read < src && limit >= src))) { | 179 | (read < src && limit >= src))) { |
180 | pr_err("isoc write buffer frame reservation violated\n"); | 180 | pr_err("isoc write buffer frame reservation violated\n"); |
181 | return -EFAULT; | 181 | return -EFAULT; |
diff --git a/drivers/leds/leds-h1940.c b/drivers/leds/leds-h1940.c index 1aa46a390a0d..173d104d9ff2 100644 --- a/drivers/leds/leds-h1940.c +++ b/drivers/leds/leds-h1940.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/ctype.h> | 17 | #include <linux/ctype.h> |
18 | #include <linux/leds.h> | 18 | #include <linux/leds.h> |
19 | #include <linux/gpio.h> | ||
20 | |||
19 | #include <mach/regs-gpio.h> | 21 | #include <mach/regs-gpio.h> |
20 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
21 | #include <mach/h1940-latch.h> | 23 | #include <mach/h1940-latch.h> |
diff --git a/drivers/leds/leds-s3c24xx.c b/drivers/leds/leds-s3c24xx.c index aa2e7ae0cdae..aa7acf3b9224 100644 --- a/drivers/leds/leds-s3c24xx.c +++ b/drivers/leds/leds-s3c24xx.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/leds.h> | 17 | #include <linux/leds.h> |
18 | #include <linux/gpio.h> | ||
18 | 19 | ||
19 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
20 | #include <mach/regs-gpio.h> | 21 | #include <mach/regs-gpio.h> |
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c index 1a83910f674f..eaf722fe309a 100644 --- a/drivers/lguest/x86/core.c +++ b/drivers/lguest/x86/core.c | |||
@@ -358,6 +358,16 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu) | |||
358 | if (emulate_insn(cpu)) | 358 | if (emulate_insn(cpu)) |
359 | return; | 359 | return; |
360 | } | 360 | } |
361 | /* If KVM is active, the vmcall instruction triggers a | ||
362 | * General Protection Fault. Normally it triggers an | ||
363 | * invalid opcode fault (6): */ | ||
364 | case 6: | ||
365 | /* We need to check if ring == GUEST_PL and | ||
366 | * faulting instruction == vmcall. */ | ||
367 | if (is_hypercall(cpu)) { | ||
368 | rewrite_hypercall(cpu); | ||
369 | return; | ||
370 | } | ||
361 | break; | 371 | break; |
362 | case 14: /* We've intercepted a Page Fault. */ | 372 | case 14: /* We've intercepted a Page Fault. */ |
363 | /* The Guest accessed a virtual address that wasn't mapped. | 373 | /* The Guest accessed a virtual address that wasn't mapped. |
@@ -403,15 +413,6 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu) | |||
403 | * up the pointer now to indicate a hypercall is pending. */ | 413 | * up the pointer now to indicate a hypercall is pending. */ |
404 | cpu->hcall = (struct hcall_args *)cpu->regs; | 414 | cpu->hcall = (struct hcall_args *)cpu->regs; |
405 | return; | 415 | return; |
406 | case 6: | ||
407 | /* kvm hypercalls trigger an invalid opcode fault (6). | ||
408 | * We need to check if ring == GUEST_PL and | ||
409 | * faulting instruction == vmcall. */ | ||
410 | if (is_hypercall(cpu)) { | ||
411 | rewrite_hypercall(cpu); | ||
412 | return; | ||
413 | } | ||
414 | break; | ||
415 | } | 416 | } |
416 | 417 | ||
417 | /* We didn't handle the trap, so it needs to go to the Guest. */ | 418 | /* We didn't handle the trap, so it needs to go to the Guest. */ |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 47c68bc75a17..56df1cee8fb3 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1097,14 +1097,12 @@ void bitmap_daemon_work(struct bitmap *bitmap) | |||
1097 | } | 1097 | } |
1098 | bitmap->allclean = 1; | 1098 | bitmap->allclean = 1; |
1099 | 1099 | ||
1100 | spin_lock_irqsave(&bitmap->lock, flags); | ||
1100 | for (j = 0; j < bitmap->chunks; j++) { | 1101 | for (j = 0; j < bitmap->chunks; j++) { |
1101 | bitmap_counter_t *bmc; | 1102 | bitmap_counter_t *bmc; |
1102 | spin_lock_irqsave(&bitmap->lock, flags); | 1103 | if (!bitmap->filemap) |
1103 | if (!bitmap->filemap) { | ||
1104 | /* error or shutdown */ | 1104 | /* error or shutdown */ |
1105 | spin_unlock_irqrestore(&bitmap->lock, flags); | ||
1106 | break; | 1105 | break; |
1107 | } | ||
1108 | 1106 | ||
1109 | page = filemap_get_page(bitmap, j); | 1107 | page = filemap_get_page(bitmap, j); |
1110 | 1108 | ||
@@ -1121,6 +1119,8 @@ void bitmap_daemon_work(struct bitmap *bitmap) | |||
1121 | write_page(bitmap, page, 0); | 1119 | write_page(bitmap, page, 0); |
1122 | bitmap->allclean = 0; | 1120 | bitmap->allclean = 0; |
1123 | } | 1121 | } |
1122 | spin_lock_irqsave(&bitmap->lock, flags); | ||
1123 | j |= (PAGE_BITS - 1); | ||
1124 | continue; | 1124 | continue; |
1125 | } | 1125 | } |
1126 | 1126 | ||
@@ -1181,9 +1181,10 @@ void bitmap_daemon_work(struct bitmap *bitmap) | |||
1181 | ext2_clear_bit(file_page_offset(j), paddr); | 1181 | ext2_clear_bit(file_page_offset(j), paddr); |
1182 | kunmap_atomic(paddr, KM_USER0); | 1182 | kunmap_atomic(paddr, KM_USER0); |
1183 | } | 1183 | } |
1184 | } | 1184 | } else |
1185 | spin_unlock_irqrestore(&bitmap->lock, flags); | 1185 | j |= PAGE_COUNTER_MASK; |
1186 | } | 1186 | } |
1187 | spin_unlock_irqrestore(&bitmap->lock, flags); | ||
1187 | 1188 | ||
1188 | /* now sync the final page */ | 1189 | /* now sync the final page */ |
1189 | if (lastpage != NULL) { | 1190 | if (lastpage != NULL) { |
diff --git a/drivers/md/md.c b/drivers/md/md.c index fccc8343a250..641b211fe3fe 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1375,6 +1375,9 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1375 | 1375 | ||
1376 | sb->raid_disks = cpu_to_le32(mddev->raid_disks); | 1376 | sb->raid_disks = cpu_to_le32(mddev->raid_disks); |
1377 | sb->size = cpu_to_le64(mddev->dev_sectors); | 1377 | sb->size = cpu_to_le64(mddev->dev_sectors); |
1378 | sb->chunksize = cpu_to_le32(mddev->chunk_size >> 9); | ||
1379 | sb->level = cpu_to_le32(mddev->level); | ||
1380 | sb->layout = cpu_to_le32(mddev->layout); | ||
1378 | 1381 | ||
1379 | if (mddev->bitmap && mddev->bitmap_file == NULL) { | 1382 | if (mddev->bitmap && mddev->bitmap_file == NULL) { |
1380 | sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset); | 1383 | sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset); |
@@ -3303,7 +3306,9 @@ static ssize_t | |||
3303 | action_show(mddev_t *mddev, char *page) | 3306 | action_show(mddev_t *mddev, char *page) |
3304 | { | 3307 | { |
3305 | char *type = "idle"; | 3308 | char *type = "idle"; |
3306 | if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || | 3309 | if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) |
3310 | type = "frozen"; | ||
3311 | else if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || | ||
3307 | (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) { | 3312 | (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) { |
3308 | if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) | 3313 | if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) |
3309 | type = "reshape"; | 3314 | type = "reshape"; |
@@ -3326,7 +3331,12 @@ action_store(mddev_t *mddev, const char *page, size_t len) | |||
3326 | if (!mddev->pers || !mddev->pers->sync_request) | 3331 | if (!mddev->pers || !mddev->pers->sync_request) |
3327 | return -EINVAL; | 3332 | return -EINVAL; |
3328 | 3333 | ||
3329 | if (cmd_match(page, "idle")) { | 3334 | if (cmd_match(page, "frozen")) |
3335 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
3336 | else | ||
3337 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
3338 | |||
3339 | if (cmd_match(page, "idle") || cmd_match(page, "frozen")) { | ||
3330 | if (mddev->sync_thread) { | 3340 | if (mddev->sync_thread) { |
3331 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 3341 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
3332 | md_unregister_thread(mddev->sync_thread); | 3342 | md_unregister_thread(mddev->sync_thread); |
@@ -3680,7 +3690,7 @@ array_size_store(mddev_t *mddev, const char *buf, size_t len) | |||
3680 | if (strict_blocks_to_sectors(buf, §ors) < 0) | 3690 | if (strict_blocks_to_sectors(buf, §ors) < 0) |
3681 | return -EINVAL; | 3691 | return -EINVAL; |
3682 | if (mddev->pers && mddev->pers->size(mddev, 0, 0) < sectors) | 3692 | if (mddev->pers && mddev->pers->size(mddev, 0, 0) < sectors) |
3683 | return -EINVAL; | 3693 | return -E2BIG; |
3684 | 3694 | ||
3685 | mddev->external_size = 1; | 3695 | mddev->external_size = 1; |
3686 | } | 3696 | } |
@@ -5557,7 +5567,7 @@ static struct block_device_operations md_fops = | |||
5557 | .owner = THIS_MODULE, | 5567 | .owner = THIS_MODULE, |
5558 | .open = md_open, | 5568 | .open = md_open, |
5559 | .release = md_release, | 5569 | .release = md_release, |
5560 | .locked_ioctl = md_ioctl, | 5570 | .ioctl = md_ioctl, |
5561 | .getgeo = md_getgeo, | 5571 | .getgeo = md_getgeo, |
5562 | .media_changed = md_media_changed, | 5572 | .media_changed = md_media_changed, |
5563 | .revalidate_disk= md_revalidate, | 5573 | .revalidate_disk= md_revalidate, |
@@ -6352,12 +6362,13 @@ void md_do_sync(mddev_t *mddev) | |||
6352 | 6362 | ||
6353 | skipped = 0; | 6363 | skipped = 0; |
6354 | 6364 | ||
6355 | if ((mddev->curr_resync > mddev->curr_resync_completed && | 6365 | if (!test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) && |
6356 | (mddev->curr_resync - mddev->curr_resync_completed) | 6366 | ((mddev->curr_resync > mddev->curr_resync_completed && |
6357 | > (max_sectors >> 4)) || | 6367 | (mddev->curr_resync - mddev->curr_resync_completed) |
6358 | (j - mddev->curr_resync_completed)*2 | 6368 | > (max_sectors >> 4)) || |
6359 | >= mddev->resync_max - mddev->curr_resync_completed | 6369 | (j - mddev->curr_resync_completed)*2 |
6360 | ) { | 6370 | >= mddev->resync_max - mddev->curr_resync_completed |
6371 | )) { | ||
6361 | /* time to update curr_resync_completed */ | 6372 | /* time to update curr_resync_completed */ |
6362 | blk_unplug(mddev->queue); | 6373 | blk_unplug(mddev->queue); |
6363 | wait_event(mddev->recovery_wait, | 6374 | wait_event(mddev->recovery_wait, |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 4616bc3a6e71..5d400aef8d9b 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3811,13 +3811,13 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
3811 | safepos = conf->reshape_safe; | 3811 | safepos = conf->reshape_safe; |
3812 | sector_div(safepos, data_disks); | 3812 | sector_div(safepos, data_disks); |
3813 | if (mddev->delta_disks < 0) { | 3813 | if (mddev->delta_disks < 0) { |
3814 | writepos -= reshape_sectors; | 3814 | writepos -= min_t(sector_t, reshape_sectors, writepos); |
3815 | readpos += reshape_sectors; | 3815 | readpos += reshape_sectors; |
3816 | safepos += reshape_sectors; | 3816 | safepos += reshape_sectors; |
3817 | } else { | 3817 | } else { |
3818 | writepos += reshape_sectors; | 3818 | writepos += reshape_sectors; |
3819 | readpos -= reshape_sectors; | 3819 | readpos -= min_t(sector_t, reshape_sectors, readpos); |
3820 | safepos -= reshape_sectors; | 3820 | safepos -= min_t(sector_t, reshape_sectors, safepos); |
3821 | } | 3821 | } |
3822 | 3822 | ||
3823 | /* 'writepos' is the most advanced device address we might write. | 3823 | /* 'writepos' is the most advanced device address we might write. |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 9d48da2fb013..57835f5715fc 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -758,10 +758,14 @@ config VIDEO_MX1 | |||
758 | ---help--- | 758 | ---help--- |
759 | This is a v4l2 driver for the i.MX1/i.MXL CMOS Sensor Interface | 759 | This is a v4l2 driver for the i.MX1/i.MXL CMOS Sensor Interface |
760 | 760 | ||
761 | config MX3_VIDEO | ||
762 | bool | ||
763 | |||
761 | config VIDEO_MX3 | 764 | config VIDEO_MX3 |
762 | tristate "i.MX3x Camera Sensor Interface driver" | 765 | tristate "i.MX3x Camera Sensor Interface driver" |
763 | depends on VIDEO_DEV && MX3_IPU && SOC_CAMERA | 766 | depends on VIDEO_DEV && MX3_IPU && SOC_CAMERA |
764 | select VIDEOBUF_DMA_CONTIG | 767 | select VIDEOBUF_DMA_CONTIG |
768 | select MX3_VIDEO | ||
765 | ---help--- | 769 | ---help--- |
766 | This is a v4l2 driver for the i.MX3x Camera Sensor Interface | 770 | This is a v4l2 driver for the i.MX3x Camera Sensor Interface |
767 | 771 | ||
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index b4cf691f3f64..3eb87bda14f3 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
@@ -155,7 +155,7 @@ config MMC_ATMELMCI_DMA | |||
155 | 155 | ||
156 | config MMC_IMX | 156 | config MMC_IMX |
157 | tristate "Motorola i.MX Multimedia Card Interface support" | 157 | tristate "Motorola i.MX Multimedia Card Interface support" |
158 | depends on ARCH_IMX | 158 | depends on ARCH_MX1 |
159 | help | 159 | help |
160 | This selects the Motorola i.MX Multimedia card Interface. | 160 | This selects the Motorola i.MX Multimedia card Interface. |
161 | If you have a i.MX platform with a Multimedia Card slot, | 161 | If you have a i.MX platform with a Multimedia Card slot, |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index e62a22a7f00c..2f19c635bc6e 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -1073,7 +1073,6 @@ static int __init omap_mmc_probe(struct platform_device *pdev) | |||
1073 | mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; | 1073 | mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; |
1074 | mmc->max_seg_size = mmc->max_req_size; | 1074 | mmc->max_seg_size = mmc->max_req_size; |
1075 | 1075 | ||
1076 | mmc->ocr_avail = mmc_slot(host).ocr_mask; | ||
1077 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED; | 1076 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED; |
1078 | 1077 | ||
1079 | if (pdata->slots[host->slot_id].wires >= 8) | 1078 | if (pdata->slots[host->slot_id].wires >= 8) |
@@ -1110,13 +1109,14 @@ static int __init omap_mmc_probe(struct platform_device *pdev) | |||
1110 | goto err_irq; | 1109 | goto err_irq; |
1111 | } | 1110 | } |
1112 | 1111 | ||
1112 | /* initialize power supplies, gpios, etc */ | ||
1113 | if (pdata->init != NULL) { | 1113 | if (pdata->init != NULL) { |
1114 | if (pdata->init(&pdev->dev) != 0) { | 1114 | if (pdata->init(&pdev->dev) != 0) { |
1115 | dev_dbg(mmc_dev(host->mmc), | 1115 | dev_dbg(mmc_dev(host->mmc), "late init error\n"); |
1116 | "Unable to configure MMC IRQs\n"); | ||
1117 | goto err_irq_cd_init; | 1116 | goto err_irq_cd_init; |
1118 | } | 1117 | } |
1119 | } | 1118 | } |
1119 | mmc->ocr_avail = mmc_slot(host).ocr_mask; | ||
1120 | 1120 | ||
1121 | /* Request IRQ for card detect */ | 1121 | /* Request IRQ for card detect */ |
1122 | if ((mmc_slot(host).card_detect_irq)) { | 1122 | if ((mmc_slot(host).card_detect_irq)) { |
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 2db166b7096f..4eb4f37544ab 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/mmc/host.h> | 17 | #include <linux/mmc/host.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/cpufreq.h> | 19 | #include <linux/cpufreq.h> |
20 | #include <linux/gpio.h> | ||
20 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
21 | #include <linux/io.h> | 22 | #include <linux/io.h> |
22 | 23 | ||
@@ -789,7 +790,7 @@ static void s3cmci_dma_setup(struct s3cmci_host *host, | |||
789 | 790 | ||
790 | last_source = source; | 791 | last_source = source; |
791 | 792 | ||
792 | s3c2410_dma_devconfig(host->dma, source, 3, | 793 | s3c2410_dma_devconfig(host->dma, source, |
793 | host->mem->start + host->sdidata); | 794 | host->mem->start + host->sdidata); |
794 | 795 | ||
795 | if (!setup_ok) { | 796 | if (!setup_ok) { |
@@ -1121,7 +1122,7 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1121 | case MMC_POWER_OFF: | 1122 | case MMC_POWER_OFF: |
1122 | default: | 1123 | default: |
1123 | s3c2410_gpio_setpin(S3C2410_GPE5, 0); | 1124 | s3c2410_gpio_setpin(S3C2410_GPE5, 0); |
1124 | s3c2410_gpio_cfgpin(S3C2410_GPE5, S3C2410_GPE5_OUTP); | 1125 | s3c2410_gpio_cfgpin(S3C2410_GPE5, S3C2410_GPIO_OUTPUT); |
1125 | 1126 | ||
1126 | if (host->is2440) | 1127 | if (host->is2440) |
1127 | mci_con |= S3C2440_SDICON_SDRESET; | 1128 | mci_con |= S3C2440_SDICON_SDRESET; |
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index f3548d048014..40c26080ecda 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -831,6 +831,7 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, | |||
831 | break; | 831 | break; |
832 | 832 | ||
833 | case NAND_CMD_READID: | 833 | case NAND_CMD_READID: |
834 | host->col_addr = 0; | ||
834 | send_read_id(host); | 835 | send_read_id(host); |
835 | break; | 836 | break; |
836 | 837 | ||
@@ -867,6 +868,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
867 | mtd->priv = this; | 868 | mtd->priv = this; |
868 | mtd->owner = THIS_MODULE; | 869 | mtd->owner = THIS_MODULE; |
869 | mtd->dev.parent = &pdev->dev; | 870 | mtd->dev.parent = &pdev->dev; |
871 | mtd->name = "mxc_nand"; | ||
870 | 872 | ||
871 | /* 50 us command delay time */ | 873 | /* 50 us command delay time */ |
872 | this->chip_delay = 5; | 874 | this->chip_delay = 5; |
@@ -882,8 +884,10 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
882 | this->verify_buf = mxc_nand_verify_buf; | 884 | this->verify_buf = mxc_nand_verify_buf; |
883 | 885 | ||
884 | host->clk = clk_get(&pdev->dev, "nfc"); | 886 | host->clk = clk_get(&pdev->dev, "nfc"); |
885 | if (IS_ERR(host->clk)) | 887 | if (IS_ERR(host->clk)) { |
888 | err = PTR_ERR(host->clk); | ||
886 | goto eclk; | 889 | goto eclk; |
890 | } | ||
887 | 891 | ||
888 | clk_enable(host->clk); | 892 | clk_enable(host->clk); |
889 | host->clk_act = 1; | 893 | host->clk_act = 1; |
@@ -896,7 +900,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
896 | 900 | ||
897 | host->regs = ioremap(res->start, res->end - res->start + 1); | 901 | host->regs = ioremap(res->start, res->end - res->start + 1); |
898 | if (!host->regs) { | 902 | if (!host->regs) { |
899 | err = -EIO; | 903 | err = -ENOMEM; |
900 | goto eres; | 904 | goto eres; |
901 | } | 905 | } |
902 | 906 | ||
@@ -1011,30 +1015,35 @@ static int __devexit mxcnd_remove(struct platform_device *pdev) | |||
1011 | #ifdef CONFIG_PM | 1015 | #ifdef CONFIG_PM |
1012 | static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state) | 1016 | static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state) |
1013 | { | 1017 | { |
1014 | struct mtd_info *info = platform_get_drvdata(pdev); | 1018 | struct mtd_info *mtd = platform_get_drvdata(pdev); |
1019 | struct nand_chip *nand_chip = mtd->priv; | ||
1020 | struct mxc_nand_host *host = nand_chip->priv; | ||
1015 | int ret = 0; | 1021 | int ret = 0; |
1016 | 1022 | ||
1017 | DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n"); | 1023 | DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n"); |
1018 | if (info) | 1024 | if (mtd) { |
1019 | ret = info->suspend(info); | 1025 | ret = mtd->suspend(mtd); |
1020 | 1026 | /* Disable the NFC clock */ | |
1021 | /* Disable the NFC clock */ | 1027 | clk_disable(host->clk); |
1022 | clk_disable(nfc_clk); /* FIXME */ | 1028 | } |
1023 | 1029 | ||
1024 | return ret; | 1030 | return ret; |
1025 | } | 1031 | } |
1026 | 1032 | ||
1027 | static int mxcnd_resume(struct platform_device *pdev) | 1033 | static int mxcnd_resume(struct platform_device *pdev) |
1028 | { | 1034 | { |
1029 | struct mtd_info *info = platform_get_drvdata(pdev); | 1035 | struct mtd_info *mtd = platform_get_drvdata(pdev); |
1036 | struct nand_chip *nand_chip = mtd->priv; | ||
1037 | struct mxc_nand_host *host = nand_chip->priv; | ||
1030 | int ret = 0; | 1038 | int ret = 0; |
1031 | 1039 | ||
1032 | DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n"); | 1040 | DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n"); |
1033 | /* Enable the NFC clock */ | ||
1034 | clk_enable(nfc_clk); /* FIXME */ | ||
1035 | 1041 | ||
1036 | if (info) | 1042 | if (mtd) { |
1037 | info->resume(info); | 1043 | /* Enable the NFC clock */ |
1044 | clk_enable(host->clk); | ||
1045 | mtd->resume(mtd); | ||
1046 | } | ||
1038 | 1047 | ||
1039 | return ret; | 1048 | return ret; |
1040 | } | 1049 | } |
@@ -1055,13 +1064,7 @@ static struct platform_driver mxcnd_driver = { | |||
1055 | 1064 | ||
1056 | static int __init mxc_nd_init(void) | 1065 | static int __init mxc_nd_init(void) |
1057 | { | 1066 | { |
1058 | /* Register the device driver structure. */ | 1067 | return platform_driver_probe(&mxcnd_driver, mxcnd_probe); |
1059 | pr_info("MXC MTD nand Driver\n"); | ||
1060 | if (platform_driver_probe(&mxcnd_driver, mxcnd_probe) != 0) { | ||
1061 | printk(KERN_ERR "Driver register failed for mxcnd_driver\n"); | ||
1062 | return -ENODEV; | ||
1063 | } | ||
1064 | return 0; | ||
1065 | } | 1068 | } |
1066 | 1069 | ||
1067 | static void __exit mxc_nd_cleanup(void) | 1070 | static void __exit mxc_nd_cleanup(void) |
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index f2e9de1414df..6391e3dc8002 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <mach/gpmc.h> | 39 | #include <mach/gpmc.h> |
40 | #include <mach/onenand.h> | 40 | #include <mach/onenand.h> |
41 | #include <mach/gpio.h> | 41 | #include <mach/gpio.h> |
42 | #include <mach/pm.h> | ||
43 | 42 | ||
44 | #include <mach/dma.h> | 43 | #include <mach/dma.h> |
45 | 44 | ||
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index fbb371921991..682aad897081 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c | |||
@@ -480,9 +480,13 @@ static int pnp_registered; | |||
480 | 480 | ||
481 | #ifdef CONFIG_EISA | 481 | #ifdef CONFIG_EISA |
482 | static struct eisa_device_id el3_eisa_ids[] = { | 482 | static struct eisa_device_id el3_eisa_ids[] = { |
483 | { "TCM5090" }, | ||
484 | { "TCM5091" }, | ||
483 | { "TCM5092" }, | 485 | { "TCM5092" }, |
484 | { "TCM5093" }, | 486 | { "TCM5093" }, |
487 | { "TCM5094" }, | ||
485 | { "TCM5095" }, | 488 | { "TCM5095" }, |
489 | { "TCM5098" }, | ||
486 | { "" } | 490 | { "" } |
487 | }; | 491 | }; |
488 | MODULE_DEVICE_TABLE(eisa, el3_eisa_ids); | 492 | MODULE_DEVICE_TABLE(eisa, el3_eisa_ids); |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 1fc4602a6ff2..a1c25cb4669f 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -102,7 +102,7 @@ obj-$(CONFIG_HAMACHI) += hamachi.o | |||
102 | obj-$(CONFIG_NET) += Space.o loopback.o | 102 | obj-$(CONFIG_NET) += Space.o loopback.o |
103 | obj-$(CONFIG_SEEQ8005) += seeq8005.o | 103 | obj-$(CONFIG_SEEQ8005) += seeq8005.o |
104 | obj-$(CONFIG_NET_SB1000) += sb1000.o | 104 | obj-$(CONFIG_NET_SB1000) += sb1000.o |
105 | obj-$(CONFIG_MAC8390) += mac8390.o 8390.o | 105 | obj-$(CONFIG_MAC8390) += mac8390.o |
106 | obj-$(CONFIG_APNE) += apne.o 8390.o | 106 | obj-$(CONFIG_APNE) += apne.o 8390.o |
107 | obj-$(CONFIG_PCMCIA_PCNET) += 8390.o | 107 | obj-$(CONFIG_PCMCIA_PCNET) += 8390.o |
108 | obj-$(CONFIG_HP100) += hp100.o | 108 | obj-$(CONFIG_HP100) += hp100.o |
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c index a740053d3af3..b6d188115caf 100644 --- a/drivers/net/arm/ixp4xx_eth.c +++ b/drivers/net/arm/ixp4xx_eth.c | |||
@@ -456,7 +456,8 @@ static inline void queue_put_desc(unsigned int queue, u32 phys, | |||
456 | debug_desc(phys, desc); | 456 | debug_desc(phys, desc); |
457 | BUG_ON(phys & 0x1F); | 457 | BUG_ON(phys & 0x1F); |
458 | qmgr_put_entry(queue, phys); | 458 | qmgr_put_entry(queue, phys); |
459 | BUG_ON(qmgr_stat_overflow(queue)); | 459 | /* Don't check for queue overflow here, we've allocated sufficient |
460 | length and queues >= 32 don't support this check anyway. */ | ||
460 | } | 461 | } |
461 | 462 | ||
462 | 463 | ||
@@ -512,8 +513,8 @@ static int eth_poll(struct napi_struct *napi, int budget) | |||
512 | #endif | 513 | #endif |
513 | napi_complete(napi); | 514 | napi_complete(napi); |
514 | qmgr_enable_irq(rxq); | 515 | qmgr_enable_irq(rxq); |
515 | if (!qmgr_stat_empty(rxq) && | 516 | if (!qmgr_stat_below_low_watermark(rxq) && |
516 | napi_reschedule(napi)) { | 517 | napi_reschedule(napi)) { /* not empty again */ |
517 | #if DEBUG_RX | 518 | #if DEBUG_RX |
518 | printk(KERN_DEBUG "%s: eth_poll" | 519 | printk(KERN_DEBUG "%s: eth_poll" |
519 | " napi_reschedule successed\n", | 520 | " napi_reschedule successed\n", |
@@ -630,9 +631,9 @@ static void eth_txdone_irq(void *unused) | |||
630 | port->tx_buff_tab[n_desc] = NULL; | 631 | port->tx_buff_tab[n_desc] = NULL; |
631 | } | 632 | } |
632 | 633 | ||
633 | start = qmgr_stat_empty(port->plat->txreadyq); | 634 | start = qmgr_stat_below_low_watermark(port->plat->txreadyq); |
634 | queue_put_desc(port->plat->txreadyq, phys, desc); | 635 | queue_put_desc(port->plat->txreadyq, phys, desc); |
635 | if (start) { | 636 | if (start) { /* TX-ready queue was empty */ |
636 | #if DEBUG_TX | 637 | #if DEBUG_TX |
637 | printk(KERN_DEBUG "%s: eth_txdone_irq xmit ready\n", | 638 | printk(KERN_DEBUG "%s: eth_txdone_irq xmit ready\n", |
638 | port->netdev->name); | 639 | port->netdev->name); |
@@ -708,13 +709,14 @@ static int eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
708 | queue_put_desc(TX_QUEUE(port->id), tx_desc_phys(port, n), desc); | 709 | queue_put_desc(TX_QUEUE(port->id), tx_desc_phys(port, n), desc); |
709 | dev->trans_start = jiffies; | 710 | dev->trans_start = jiffies; |
710 | 711 | ||
711 | if (qmgr_stat_empty(txreadyq)) { | 712 | if (qmgr_stat_below_low_watermark(txreadyq)) { /* empty */ |
712 | #if DEBUG_TX | 713 | #if DEBUG_TX |
713 | printk(KERN_DEBUG "%s: eth_xmit queue full\n", dev->name); | 714 | printk(KERN_DEBUG "%s: eth_xmit queue full\n", dev->name); |
714 | #endif | 715 | #endif |
715 | netif_stop_queue(dev); | 716 | netif_stop_queue(dev); |
716 | /* we could miss TX ready interrupt */ | 717 | /* we could miss TX ready interrupt */ |
717 | if (!qmgr_stat_empty(txreadyq)) { | 718 | /* really empty in fact */ |
719 | if (!qmgr_stat_below_low_watermark(txreadyq)) { | ||
718 | #if DEBUG_TX | 720 | #if DEBUG_TX |
719 | printk(KERN_DEBUG "%s: eth_xmit ready again\n", | 721 | printk(KERN_DEBUG "%s: eth_xmit ready again\n", |
720 | dev->name); | 722 | dev->name); |
@@ -814,29 +816,29 @@ static int request_queues(struct port *port) | |||
814 | int err; | 816 | int err; |
815 | 817 | ||
816 | err = qmgr_request_queue(RXFREE_QUEUE(port->id), RX_DESCS, 0, 0, | 818 | err = qmgr_request_queue(RXFREE_QUEUE(port->id), RX_DESCS, 0, 0, |
817 | "%s:RX-free", port->netdev->name); | 819 | "%s:RX-free", port->netdev->name); |
818 | if (err) | 820 | if (err) |
819 | return err; | 821 | return err; |
820 | 822 | ||
821 | err = qmgr_request_queue(port->plat->rxq, RX_DESCS, 0, 0, | 823 | err = qmgr_request_queue(port->plat->rxq, RX_DESCS, 0, 0, |
822 | "%s:RX", port->netdev->name); | 824 | "%s:RX", port->netdev->name); |
823 | if (err) | 825 | if (err) |
824 | goto rel_rxfree; | 826 | goto rel_rxfree; |
825 | 827 | ||
826 | err = qmgr_request_queue(TX_QUEUE(port->id), TX_DESCS, 0, 0, | 828 | err = qmgr_request_queue(TX_QUEUE(port->id), TX_DESCS, 0, 0, |
827 | "%s:TX", port->netdev->name); | 829 | "%s:TX", port->netdev->name); |
828 | if (err) | 830 | if (err) |
829 | goto rel_rx; | 831 | goto rel_rx; |
830 | 832 | ||
831 | err = qmgr_request_queue(port->plat->txreadyq, TX_DESCS, 0, 0, | 833 | err = qmgr_request_queue(port->plat->txreadyq, TX_DESCS, 0, 0, |
832 | "%s:TX-ready", port->netdev->name); | 834 | "%s:TX-ready", port->netdev->name); |
833 | if (err) | 835 | if (err) |
834 | goto rel_tx; | 836 | goto rel_tx; |
835 | 837 | ||
836 | /* TX-done queue handles skbs sent out by the NPEs */ | 838 | /* TX-done queue handles skbs sent out by the NPEs */ |
837 | if (!ports_open) { | 839 | if (!ports_open) { |
838 | err = qmgr_request_queue(TXDONE_QUEUE, TXDONE_QUEUE_LEN, 0, 0, | 840 | err = qmgr_request_queue(TXDONE_QUEUE, TXDONE_QUEUE_LEN, 0, 0, |
839 | "%s:TX-done", DRV_NAME); | 841 | "%s:TX-done", DRV_NAME); |
840 | if (err) | 842 | if (err) |
841 | goto rel_txready; | 843 | goto rel_txready; |
842 | } | 844 | } |
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c index fb57b750866b..1342418fb209 100644 --- a/drivers/net/atl1e/atl1e_main.c +++ b/drivers/net/atl1e/atl1e_main.c | |||
@@ -37,6 +37,7 @@ char atl1e_driver_version[] = DRV_VERSION; | |||
37 | */ | 37 | */ |
38 | static struct pci_device_id atl1e_pci_tbl[] = { | 38 | static struct pci_device_id atl1e_pci_tbl[] = { |
39 | {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1E)}, | 39 | {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L1E)}, |
40 | {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, 0x1066)}, | ||
40 | /* required last entry */ | 41 | /* required last entry */ |
41 | { 0 } | 42 | { 0 } |
42 | }; | 43 | }; |
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 0ab22540bf59..4e817126e280 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -82,6 +82,12 @@ | |||
82 | 82 | ||
83 | #include "atl1.h" | 83 | #include "atl1.h" |
84 | 84 | ||
85 | #define ATLX_DRIVER_VERSION "2.1.3" | ||
86 | MODULE_AUTHOR("Xiong Huang <xiong.huang@atheros.com>, \ | ||
87 | Chris Snook <csnook@redhat.com>, Jay Cliburn <jcliburn@gmail.com>"); | ||
88 | MODULE_LICENSE("GPL"); | ||
89 | MODULE_VERSION(ATLX_DRIVER_VERSION); | ||
90 | |||
85 | /* Temporary hack for merging atl1 and atl2 */ | 91 | /* Temporary hack for merging atl1 and atl2 */ |
86 | #include "atlx.c" | 92 | #include "atlx.c" |
87 | 93 | ||
diff --git a/drivers/net/atlx/atlx.h b/drivers/net/atlx/atlx.h index 297a03da6b7f..14054b75aa62 100644 --- a/drivers/net/atlx/atlx.h +++ b/drivers/net/atlx/atlx.h | |||
@@ -29,12 +29,6 @@ | |||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | 31 | ||
32 | #define ATLX_DRIVER_VERSION "2.1.3" | ||
33 | MODULE_AUTHOR("Xiong Huang <xiong.huang@atheros.com>, \ | ||
34 | Chris Snook <csnook@redhat.com>, Jay Cliburn <jcliburn@gmail.com>"); | ||
35 | MODULE_LICENSE("GPL"); | ||
36 | MODULE_VERSION(ATLX_DRIVER_VERSION); | ||
37 | |||
38 | #define ATLX_ERR_PHY 2 | 32 | #define ATLX_ERR_PHY 2 |
39 | #define ATLX_ERR_PHY_SPEED 7 | 33 | #define ATLX_ERR_PHY_SPEED 7 |
40 | #define ATLX_ERR_PHY_RES 8 | 34 | #define ATLX_ERR_PHY_RES 8 |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 9f971ed6b58d..b4da18213324 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -979,22 +979,7 @@ static int bfin_mac_open(struct net_device *dev) | |||
979 | return 0; | 979 | return 0; |
980 | } | 980 | } |
981 | 981 | ||
982 | static const struct net_device_ops bfin_mac_netdev_ops = { | ||
983 | .ndo_open = bfin_mac_open, | ||
984 | .ndo_stop = bfin_mac_close, | ||
985 | .ndo_start_xmit = bfin_mac_hard_start_xmit, | ||
986 | .ndo_set_mac_address = bfin_mac_set_mac_address, | ||
987 | .ndo_tx_timeout = bfin_mac_timeout, | ||
988 | .ndo_set_multicast_list = bfin_mac_set_multicast_list, | ||
989 | .ndo_validate_addr = eth_validate_addr, | ||
990 | .ndo_change_mtu = eth_change_mtu, | ||
991 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
992 | .ndo_poll_controller = bfin_mac_poll, | ||
993 | #endif | ||
994 | }; | ||
995 | |||
996 | /* | 982 | /* |
997 | * | ||
998 | * this makes the board clean up everything that it can | 983 | * this makes the board clean up everything that it can |
999 | * and not talk to the outside world. Caused by | 984 | * and not talk to the outside world. Caused by |
1000 | * an 'ifconfig ethX down' | 985 | * an 'ifconfig ethX down' |
@@ -1019,6 +1004,20 @@ static int bfin_mac_close(struct net_device *dev) | |||
1019 | return 0; | 1004 | return 0; |
1020 | } | 1005 | } |
1021 | 1006 | ||
1007 | static const struct net_device_ops bfin_mac_netdev_ops = { | ||
1008 | .ndo_open = bfin_mac_open, | ||
1009 | .ndo_stop = bfin_mac_close, | ||
1010 | .ndo_start_xmit = bfin_mac_hard_start_xmit, | ||
1011 | .ndo_set_mac_address = bfin_mac_set_mac_address, | ||
1012 | .ndo_tx_timeout = bfin_mac_timeout, | ||
1013 | .ndo_set_multicast_list = bfin_mac_set_multicast_list, | ||
1014 | .ndo_validate_addr = eth_validate_addr, | ||
1015 | .ndo_change_mtu = eth_change_mtu, | ||
1016 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
1017 | .ndo_poll_controller = bfin_mac_poll, | ||
1018 | #endif | ||
1019 | }; | ||
1020 | |||
1022 | static int __devinit bfin_mac_probe(struct platform_device *pdev) | 1021 | static int __devinit bfin_mac_probe(struct platform_device *pdev) |
1023 | { | 1022 | { |
1024 | struct net_device *ndev; | 1023 | struct net_device *ndev; |
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h index 714df2b675e6..c888e97c9671 100644 --- a/drivers/net/cxgb3/adapter.h +++ b/drivers/net/cxgb3/adapter.h | |||
@@ -85,8 +85,8 @@ struct fl_pg_chunk { | |||
85 | struct page *page; | 85 | struct page *page; |
86 | void *va; | 86 | void *va; |
87 | unsigned int offset; | 87 | unsigned int offset; |
88 | u64 *p_cnt; | 88 | unsigned long *p_cnt; |
89 | DECLARE_PCI_UNMAP_ADDR(mapping); | 89 | dma_addr_t mapping; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | struct rx_desc; | 92 | struct rx_desc; |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 7ea48414c6cb..17858b9a5830 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -2496,14 +2496,16 @@ static void check_link_status(struct adapter *adapter) | |||
2496 | for_each_port(adapter, i) { | 2496 | for_each_port(adapter, i) { |
2497 | struct net_device *dev = adapter->port[i]; | 2497 | struct net_device *dev = adapter->port[i]; |
2498 | struct port_info *p = netdev_priv(dev); | 2498 | struct port_info *p = netdev_priv(dev); |
2499 | int link_fault; | ||
2499 | 2500 | ||
2500 | spin_lock_irq(&adapter->work_lock); | 2501 | spin_lock_irq(&adapter->work_lock); |
2501 | if (p->link_fault) { | 2502 | link_fault = p->link_fault; |
2503 | spin_unlock_irq(&adapter->work_lock); | ||
2504 | |||
2505 | if (link_fault) { | ||
2502 | t3_link_fault(adapter, i); | 2506 | t3_link_fault(adapter, i); |
2503 | spin_unlock_irq(&adapter->work_lock); | ||
2504 | continue; | 2507 | continue; |
2505 | } | 2508 | } |
2506 | spin_unlock_irq(&adapter->work_lock); | ||
2507 | 2509 | ||
2508 | if (!(p->phy.caps & SUPPORTED_IRQ) && netif_running(dev)) { | 2510 | if (!(p->phy.caps & SUPPORTED_IRQ) && netif_running(dev)) { |
2509 | t3_xgm_intr_disable(adapter, i); | 2511 | t3_xgm_intr_disable(adapter, i); |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 26d3587f3399..b3ee2bc1a005 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -355,7 +355,7 @@ static void clear_rx_desc(struct pci_dev *pdev, const struct sge_fl *q, | |||
355 | (*d->pg_chunk.p_cnt)--; | 355 | (*d->pg_chunk.p_cnt)--; |
356 | if (!*d->pg_chunk.p_cnt) | 356 | if (!*d->pg_chunk.p_cnt) |
357 | pci_unmap_page(pdev, | 357 | pci_unmap_page(pdev, |
358 | pci_unmap_addr(&d->pg_chunk, mapping), | 358 | d->pg_chunk.mapping, |
359 | q->alloc_size, PCI_DMA_FROMDEVICE); | 359 | q->alloc_size, PCI_DMA_FROMDEVICE); |
360 | 360 | ||
361 | put_page(d->pg_chunk.page); | 361 | put_page(d->pg_chunk.page); |
@@ -454,7 +454,7 @@ static int alloc_pg_chunk(struct adapter *adapter, struct sge_fl *q, | |||
454 | q->pg_chunk.offset = 0; | 454 | q->pg_chunk.offset = 0; |
455 | mapping = pci_map_page(adapter->pdev, q->pg_chunk.page, | 455 | mapping = pci_map_page(adapter->pdev, q->pg_chunk.page, |
456 | 0, q->alloc_size, PCI_DMA_FROMDEVICE); | 456 | 0, q->alloc_size, PCI_DMA_FROMDEVICE); |
457 | pci_unmap_addr_set(&q->pg_chunk, mapping, mapping); | 457 | q->pg_chunk.mapping = mapping; |
458 | } | 458 | } |
459 | sd->pg_chunk = q->pg_chunk; | 459 | sd->pg_chunk = q->pg_chunk; |
460 | 460 | ||
@@ -511,8 +511,7 @@ static int refill_fl(struct adapter *adap, struct sge_fl *q, int n, gfp_t gfp) | |||
511 | nomem: q->alloc_failed++; | 511 | nomem: q->alloc_failed++; |
512 | break; | 512 | break; |
513 | } | 513 | } |
514 | mapping = pci_unmap_addr(&sd->pg_chunk, mapping) + | 514 | mapping = sd->pg_chunk.mapping + sd->pg_chunk.offset; |
515 | sd->pg_chunk.offset; | ||
516 | pci_unmap_addr_set(sd, dma_addr, mapping); | 515 | pci_unmap_addr_set(sd, dma_addr, mapping); |
517 | 516 | ||
518 | add_one_rx_chunk(mapping, d, q->gen); | 517 | add_one_rx_chunk(mapping, d, q->gen); |
@@ -881,7 +880,7 @@ recycle: | |||
881 | (*sd->pg_chunk.p_cnt)--; | 880 | (*sd->pg_chunk.p_cnt)--; |
882 | if (!*sd->pg_chunk.p_cnt) | 881 | if (!*sd->pg_chunk.p_cnt) |
883 | pci_unmap_page(adap->pdev, | 882 | pci_unmap_page(adap->pdev, |
884 | pci_unmap_addr(&sd->pg_chunk, mapping), | 883 | sd->pg_chunk.mapping, |
885 | fl->alloc_size, | 884 | fl->alloc_size, |
886 | PCI_DMA_FROMDEVICE); | 885 | PCI_DMA_FROMDEVICE); |
887 | if (!skb) { | 886 | if (!skb) { |
@@ -2096,7 +2095,7 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs, | |||
2096 | (*sd->pg_chunk.p_cnt)--; | 2095 | (*sd->pg_chunk.p_cnt)--; |
2097 | if (!*sd->pg_chunk.p_cnt) | 2096 | if (!*sd->pg_chunk.p_cnt) |
2098 | pci_unmap_page(adap->pdev, | 2097 | pci_unmap_page(adap->pdev, |
2099 | pci_unmap_addr(&sd->pg_chunk, mapping), | 2098 | sd->pg_chunk.mapping, |
2100 | fl->alloc_size, | 2099 | fl->alloc_size, |
2101 | PCI_DMA_FROMDEVICE); | 2100 | PCI_DMA_FROMDEVICE); |
2102 | 2101 | ||
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index 4f68aeb2679a..4950d5d789ae 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -1274,6 +1274,11 @@ void t3_link_fault(struct adapter *adapter, int port_id) | |||
1274 | A_XGM_INT_STATUS + mac->offset); | 1274 | A_XGM_INT_STATUS + mac->offset); |
1275 | link_fault &= F_LINKFAULTCHANGE; | 1275 | link_fault &= F_LINKFAULTCHANGE; |
1276 | 1276 | ||
1277 | link_ok = lc->link_ok; | ||
1278 | speed = lc->speed; | ||
1279 | duplex = lc->duplex; | ||
1280 | fc = lc->fc; | ||
1281 | |||
1277 | phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc); | 1282 | phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc); |
1278 | 1283 | ||
1279 | if (link_fault) { | 1284 | if (link_fault) { |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index b1419e21b46b..fffb006b7d95 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -4027,8 +4027,9 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
4027 | PCI_DMA_FROMDEVICE); | 4027 | PCI_DMA_FROMDEVICE); |
4028 | 4028 | ||
4029 | length = le16_to_cpu(rx_desc->length); | 4029 | length = le16_to_cpu(rx_desc->length); |
4030 | 4030 | /* !EOP means multiple descriptors were used to store a single | |
4031 | if (unlikely(!(status & E1000_RXD_STAT_EOP))) { | 4031 | * packet, also make sure the frame isn't just CRC only */ |
4032 | if (unlikely(!(status & E1000_RXD_STAT_EOP) || (length <= 4))) { | ||
4032 | /* All receives must fit into a single buffer */ | 4033 | /* All receives must fit into a single buffer */ |
4033 | E1000_DBG("%s: Receive packet consumed multiple" | 4034 | E1000_DBG("%s: Receive packet consumed multiple" |
4034 | " buffers\n", netdev->name); | 4035 | " buffers\n", netdev->name); |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index f9a846b1b92f..9f6a68fb7b45 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -897,6 +897,12 @@ enum { | |||
897 | }; | 897 | }; |
898 | static int phy_cross = NV_CROSSOVER_DETECTION_DISABLED; | 898 | static int phy_cross = NV_CROSSOVER_DETECTION_DISABLED; |
899 | 899 | ||
900 | /* | ||
901 | * Power down phy when interface is down (persists through reboot; | ||
902 | * older Linux and other OSes may not power it up again) | ||
903 | */ | ||
904 | static int phy_power_down = 0; | ||
905 | |||
900 | static inline struct fe_priv *get_nvpriv(struct net_device *dev) | 906 | static inline struct fe_priv *get_nvpriv(struct net_device *dev) |
901 | { | 907 | { |
902 | return netdev_priv(dev); | 908 | return netdev_priv(dev); |
@@ -1485,7 +1491,10 @@ static int phy_init(struct net_device *dev) | |||
1485 | 1491 | ||
1486 | /* restart auto negotiation, power down phy */ | 1492 | /* restart auto negotiation, power down phy */ |
1487 | mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); | 1493 | mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); |
1488 | mii_control |= (BMCR_ANRESTART | BMCR_ANENABLE | BMCR_PDOWN); | 1494 | mii_control |= (BMCR_ANRESTART | BMCR_ANENABLE); |
1495 | if (phy_power_down) { | ||
1496 | mii_control |= BMCR_PDOWN; | ||
1497 | } | ||
1489 | if (mii_rw(dev, np->phyaddr, MII_BMCR, mii_control)) { | 1498 | if (mii_rw(dev, np->phyaddr, MII_BMCR, mii_control)) { |
1490 | return PHY_ERROR; | 1499 | return PHY_ERROR; |
1491 | } | 1500 | } |
@@ -5513,7 +5522,7 @@ static int nv_close(struct net_device *dev) | |||
5513 | 5522 | ||
5514 | nv_drain_rxtx(dev); | 5523 | nv_drain_rxtx(dev); |
5515 | 5524 | ||
5516 | if (np->wolenabled) { | 5525 | if (np->wolenabled || !phy_power_down) { |
5517 | writel(NVREG_PFF_ALWAYS|NVREG_PFF_MYADDR, base + NvRegPacketFilterFlags); | 5526 | writel(NVREG_PFF_ALWAYS|NVREG_PFF_MYADDR, base + NvRegPacketFilterFlags); |
5518 | nv_start_rx(dev); | 5527 | nv_start_rx(dev); |
5519 | } else { | 5528 | } else { |
@@ -6367,6 +6376,8 @@ module_param(dma_64bit, int, 0); | |||
6367 | MODULE_PARM_DESC(dma_64bit, "High DMA is enabled by setting to 1 and disabled by setting to 0."); | 6376 | MODULE_PARM_DESC(dma_64bit, "High DMA is enabled by setting to 1 and disabled by setting to 0."); |
6368 | module_param(phy_cross, int, 0); | 6377 | module_param(phy_cross, int, 0); |
6369 | MODULE_PARM_DESC(phy_cross, "Phy crossover detection for Realtek 8201 phy is enabled by setting to 1 and disabled by setting to 0."); | 6378 | MODULE_PARM_DESC(phy_cross, "Phy crossover detection for Realtek 8201 phy is enabled by setting to 1 and disabled by setting to 0."); |
6379 | module_param(phy_power_down, int, 0); | ||
6380 | MODULE_PARM_DESC(phy_power_down, "Power down phy and disable link when interface is down (1), or leave phy powered up (0)."); | ||
6370 | 6381 | ||
6371 | MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); | 6382 | MODULE_AUTHOR("Manfred Spraul <manfred@colorfullife.com>"); |
6372 | MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); | 6383 | MODULE_DESCRIPTION("Reverse Engineered nForce ethernet driver"); |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index b2c49679bba7..a0519184e54e 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -1885,8 +1885,17 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit) | |||
1885 | 1885 | ||
1886 | if (unlikely(!newskb)) | 1886 | if (unlikely(!newskb)) |
1887 | newskb = skb; | 1887 | newskb = skb; |
1888 | else if (skb) | 1888 | else if (skb) { |
1889 | /* | ||
1890 | * We need to reset ->data to what it | ||
1891 | * was before gfar_new_skb() re-aligned | ||
1892 | * it to an RXBUF_ALIGNMENT boundary | ||
1893 | * before we put the skb back on the | ||
1894 | * recycle list. | ||
1895 | */ | ||
1896 | skb->data = skb->head + NET_SKB_PAD; | ||
1889 | __skb_queue_head(&priv->rx_recycle, skb); | 1897 | __skb_queue_head(&priv->rx_recycle, skb); |
1898 | } | ||
1890 | } else { | 1899 | } else { |
1891 | /* Increment the number of packets */ | 1900 | /* Increment the number of packets */ |
1892 | dev->stats.rx_packets++; | 1901 | dev->stats.rx_packets++; |
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index 0642d52aef5c..cf352961ae9b 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -259,7 +259,7 @@ extern const char gfar_driver_version[]; | |||
259 | (IEVENT_RXC | IEVENT_BSY | IEVENT_EBERR | IEVENT_MSRO | \ | 259 | (IEVENT_RXC | IEVENT_BSY | IEVENT_EBERR | IEVENT_MSRO | \ |
260 | IEVENT_BABT | IEVENT_TXC | IEVENT_TXE | IEVENT_LC \ | 260 | IEVENT_BABT | IEVENT_TXC | IEVENT_TXE | IEVENT_LC \ |
261 | | IEVENT_CRL | IEVENT_XFUN | IEVENT_DPE | IEVENT_PERR \ | 261 | | IEVENT_CRL | IEVENT_XFUN | IEVENT_DPE | IEVENT_PERR \ |
262 | | IEVENT_MAG) | 262 | | IEVENT_MAG | IEVENT_BABR) |
263 | 263 | ||
264 | #define IMASK_INIT_CLEAR 0x00000000 | 264 | #define IMASK_INIT_CLEAR 0x00000000 |
265 | #define IMASK_BABR 0x80000000 | 265 | #define IMASK_BABR 0x80000000 |
diff --git a/drivers/net/mac8390.c b/drivers/net/mac8390.c index 8e884869a05b..22e74a0e0361 100644 --- a/drivers/net/mac8390.c +++ b/drivers/net/mac8390.c | |||
@@ -304,7 +304,7 @@ struct net_device * __init mac8390_probe(int unit) | |||
304 | if (!MACH_IS_MAC) | 304 | if (!MACH_IS_MAC) |
305 | return ERR_PTR(-ENODEV); | 305 | return ERR_PTR(-ENODEV); |
306 | 306 | ||
307 | dev = alloc_ei_netdev(); | 307 | dev = ____alloc_ei_netdev(0); |
308 | if (!dev) | 308 | if (!dev) |
309 | return ERR_PTR(-ENOMEM); | 309 | return ERR_PTR(-ENOMEM); |
310 | 310 | ||
@@ -481,15 +481,15 @@ void cleanup_module(void) | |||
481 | static const struct net_device_ops mac8390_netdev_ops = { | 481 | static const struct net_device_ops mac8390_netdev_ops = { |
482 | .ndo_open = mac8390_open, | 482 | .ndo_open = mac8390_open, |
483 | .ndo_stop = mac8390_close, | 483 | .ndo_stop = mac8390_close, |
484 | .ndo_start_xmit = ei_start_xmit, | 484 | .ndo_start_xmit = __ei_start_xmit, |
485 | .ndo_tx_timeout = ei_tx_timeout, | 485 | .ndo_tx_timeout = __ei_tx_timeout, |
486 | .ndo_get_stats = ei_get_stats, | 486 | .ndo_get_stats = __ei_get_stats, |
487 | .ndo_set_multicast_list = ei_set_multicast_list, | 487 | .ndo_set_multicast_list = __ei_set_multicast_list, |
488 | .ndo_validate_addr = eth_validate_addr, | 488 | .ndo_validate_addr = eth_validate_addr, |
489 | .ndo_set_mac_address = eth_mac_addr, | 489 | .ndo_set_mac_address = eth_mac_addr, |
490 | .ndo_change_mtu = eth_change_mtu, | 490 | .ndo_change_mtu = eth_change_mtu, |
491 | #ifdef CONFIG_NET_POLL_CONTROLLER | 491 | #ifdef CONFIG_NET_POLL_CONTROLLER |
492 | .ndo_poll_controller = ei_poll, | 492 | .ndo_poll_controller = __ei_poll, |
493 | #endif | 493 | #endif |
494 | }; | 494 | }; |
495 | 495 | ||
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c index ac6fc499b280..e5c98a98ad37 100644 --- a/drivers/net/mlx4/en_tx.c +++ b/drivers/net/mlx4/en_tx.c | |||
@@ -426,7 +426,7 @@ void mlx4_en_poll_tx_cq(unsigned long data) | |||
426 | 426 | ||
427 | INC_PERF_COUNTER(priv->pstats.tx_poll); | 427 | INC_PERF_COUNTER(priv->pstats.tx_poll); |
428 | 428 | ||
429 | if (!spin_trylock(&ring->comp_lock)) { | 429 | if (!spin_trylock_irq(&ring->comp_lock)) { |
430 | mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT); | 430 | mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT); |
431 | return; | 431 | return; |
432 | } | 432 | } |
@@ -439,7 +439,7 @@ void mlx4_en_poll_tx_cq(unsigned long data) | |||
439 | if (inflight && priv->port_up) | 439 | if (inflight && priv->port_up) |
440 | mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT); | 440 | mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT); |
441 | 441 | ||
442 | spin_unlock(&ring->comp_lock); | 442 | spin_unlock_irq(&ring->comp_lock); |
443 | } | 443 | } |
444 | 444 | ||
445 | static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, | 445 | static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, |
@@ -482,9 +482,9 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind) | |||
482 | 482 | ||
483 | /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ | 483 | /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ |
484 | if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0) | 484 | if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0) |
485 | if (spin_trylock(&ring->comp_lock)) { | 485 | if (spin_trylock_irq(&ring->comp_lock)) { |
486 | mlx4_en_process_tx_cq(priv->dev, cq); | 486 | mlx4_en_process_tx_cq(priv->dev, cq); |
487 | spin_unlock(&ring->comp_lock); | 487 | spin_unlock_irq(&ring->comp_lock); |
488 | } | 488 | } |
489 | } | 489 | } |
490 | 490 | ||
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 0b6e8c896835..8247a945a1d9 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -3554,54 +3554,64 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
3554 | int handled = 0; | 3554 | int handled = 0; |
3555 | int status; | 3555 | int status; |
3556 | 3556 | ||
3557 | /* loop handling interrupts until we have no new ones or | ||
3558 | * we hit a invalid/hotplug case. | ||
3559 | */ | ||
3557 | status = RTL_R16(IntrStatus); | 3560 | status = RTL_R16(IntrStatus); |
3561 | while (status && status != 0xffff) { | ||
3562 | handled = 1; | ||
3558 | 3563 | ||
3559 | /* hotplug/major error/no more work/shared irq */ | 3564 | /* Handle all of the error cases first. These will reset |
3560 | if ((status == 0xffff) || !status) | 3565 | * the chip, so just exit the loop. |
3561 | goto out; | 3566 | */ |
3562 | 3567 | if (unlikely(!netif_running(dev))) { | |
3563 | handled = 1; | 3568 | rtl8169_asic_down(ioaddr); |
3569 | break; | ||
3570 | } | ||
3564 | 3571 | ||
3565 | if (unlikely(!netif_running(dev))) { | 3572 | /* Work around for rx fifo overflow */ |
3566 | rtl8169_asic_down(ioaddr); | 3573 | if (unlikely(status & RxFIFOOver) && |
3567 | goto out; | 3574 | (tp->mac_version == RTL_GIGA_MAC_VER_11)) { |
3568 | } | 3575 | netif_stop_queue(dev); |
3576 | rtl8169_tx_timeout(dev); | ||
3577 | break; | ||
3578 | } | ||
3569 | 3579 | ||
3570 | status &= tp->intr_mask; | 3580 | if (unlikely(status & SYSErr)) { |
3571 | RTL_W16(IntrStatus, | 3581 | rtl8169_pcierr_interrupt(dev); |
3572 | (status & RxFIFOOver) ? (status | RxOverflow) : status); | 3582 | break; |
3583 | } | ||
3573 | 3584 | ||
3574 | if (!(status & tp->intr_event)) | 3585 | if (status & LinkChg) |
3575 | goto out; | 3586 | rtl8169_check_link_status(dev, tp, ioaddr); |
3576 | 3587 | ||
3577 | /* Work around for rx fifo overflow */ | 3588 | /* We need to see the lastest version of tp->intr_mask to |
3578 | if (unlikely(status & RxFIFOOver) && | 3589 | * avoid ignoring an MSI interrupt and having to wait for |
3579 | (tp->mac_version == RTL_GIGA_MAC_VER_11)) { | 3590 | * another event which may never come. |
3580 | netif_stop_queue(dev); | 3591 | */ |
3581 | rtl8169_tx_timeout(dev); | 3592 | smp_rmb(); |
3582 | goto out; | 3593 | if (status & tp->intr_mask & tp->napi_event) { |
3583 | } | 3594 | RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event); |
3595 | tp->intr_mask = ~tp->napi_event; | ||
3596 | |||
3597 | if (likely(napi_schedule_prep(&tp->napi))) | ||
3598 | __napi_schedule(&tp->napi); | ||
3599 | else if (netif_msg_intr(tp)) { | ||
3600 | printk(KERN_INFO "%s: interrupt %04x in poll\n", | ||
3601 | dev->name, status); | ||
3602 | } | ||
3603 | } | ||
3584 | 3604 | ||
3585 | if (unlikely(status & SYSErr)) { | 3605 | /* We only get a new MSI interrupt when all active irq |
3586 | rtl8169_pcierr_interrupt(dev); | 3606 | * sources on the chip have been acknowledged. So, ack |
3587 | goto out; | 3607 | * everything we've seen and check if new sources have become |
3608 | * active to avoid blocking all interrupts from the chip. | ||
3609 | */ | ||
3610 | RTL_W16(IntrStatus, | ||
3611 | (status & RxFIFOOver) ? (status | RxOverflow) : status); | ||
3612 | status = RTL_R16(IntrStatus); | ||
3588 | } | 3613 | } |
3589 | 3614 | ||
3590 | if (status & LinkChg) | ||
3591 | rtl8169_check_link_status(dev, tp, ioaddr); | ||
3592 | |||
3593 | if (status & tp->napi_event) { | ||
3594 | RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event); | ||
3595 | tp->intr_mask = ~tp->napi_event; | ||
3596 | |||
3597 | if (likely(napi_schedule_prep(&tp->napi))) | ||
3598 | __napi_schedule(&tp->napi); | ||
3599 | else if (netif_msg_intr(tp)) { | ||
3600 | printk(KERN_INFO "%s: interrupt %04x in poll\n", | ||
3601 | dev->name, status); | ||
3602 | } | ||
3603 | } | ||
3604 | out: | ||
3605 | return IRQ_RETVAL(handled); | 3615 | return IRQ_RETVAL(handled); |
3606 | } | 3616 | } |
3607 | 3617 | ||
@@ -3617,13 +3627,15 @@ static int rtl8169_poll(struct napi_struct *napi, int budget) | |||
3617 | 3627 | ||
3618 | if (work_done < budget) { | 3628 | if (work_done < budget) { |
3619 | napi_complete(napi); | 3629 | napi_complete(napi); |
3620 | tp->intr_mask = 0xffff; | 3630 | |
3621 | /* | 3631 | /* We need for force the visibility of tp->intr_mask |
3622 | * 20040426: the barrier is not strictly required but the | 3632 | * for other CPUs, as we can loose an MSI interrupt |
3623 | * behavior of the irq handler could be less predictable | 3633 | * and potentially wait for a retransmit timeout if we don't. |
3624 | * without it. Btw, the lack of flush for the posted pci | 3634 | * The posted write to IntrMask is safe, as it will |
3625 | * write is safe - FR | 3635 | * eventually make it to the chip and we won't loose anything |
3636 | * until it does. | ||
3626 | */ | 3637 | */ |
3638 | tp->intr_mask = 0xffff; | ||
3627 | smp_wmb(); | 3639 | smp_wmb(); |
3628 | RTL_W16(IntrMask, tp->intr_event); | 3640 | RTL_W16(IntrMask, tp->intr_event); |
3629 | } | 3641 | } |
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c index 765a7f5d6aa4..a6dc317083d3 100644 --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c | |||
@@ -579,7 +579,8 @@ static inline void queue_put_desc(unsigned int queue, u32 phys, | |||
579 | debug_desc(phys, desc); | 579 | debug_desc(phys, desc); |
580 | BUG_ON(phys & 0x1F); | 580 | BUG_ON(phys & 0x1F); |
581 | qmgr_put_entry(queue, phys); | 581 | qmgr_put_entry(queue, phys); |
582 | BUG_ON(qmgr_stat_overflow(queue)); | 582 | /* Don't check for queue overflow here, we've allocated sufficient |
583 | length and queues >= 32 don't support this check anyway. */ | ||
583 | } | 584 | } |
584 | 585 | ||
585 | 586 | ||
@@ -789,10 +790,10 @@ static void hss_hdlc_txdone_irq(void *pdev) | |||
789 | free_buffer_irq(port->tx_buff_tab[n_desc]); | 790 | free_buffer_irq(port->tx_buff_tab[n_desc]); |
790 | port->tx_buff_tab[n_desc] = NULL; | 791 | port->tx_buff_tab[n_desc] = NULL; |
791 | 792 | ||
792 | start = qmgr_stat_empty(port->plat->txreadyq); | 793 | start = qmgr_stat_below_low_watermark(port->plat->txreadyq); |
793 | queue_put_desc(port->plat->txreadyq, | 794 | queue_put_desc(port->plat->txreadyq, |
794 | tx_desc_phys(port, n_desc), desc); | 795 | tx_desc_phys(port, n_desc), desc); |
795 | if (start) { | 796 | if (start) { /* TX-ready queue was empty */ |
796 | #if DEBUG_TX | 797 | #if DEBUG_TX |
797 | printk(KERN_DEBUG "%s: hss_hdlc_txdone_irq xmit" | 798 | printk(KERN_DEBUG "%s: hss_hdlc_txdone_irq xmit" |
798 | " ready\n", dev->name); | 799 | " ready\n", dev->name); |
@@ -867,13 +868,13 @@ static int hss_hdlc_xmit(struct sk_buff *skb, struct net_device *dev) | |||
867 | queue_put_desc(queue_ids[port->id].tx, tx_desc_phys(port, n), desc); | 868 | queue_put_desc(queue_ids[port->id].tx, tx_desc_phys(port, n), desc); |
868 | dev->trans_start = jiffies; | 869 | dev->trans_start = jiffies; |
869 | 870 | ||
870 | if (qmgr_stat_empty(txreadyq)) { | 871 | if (qmgr_stat_below_low_watermark(txreadyq)) { /* empty */ |
871 | #if DEBUG_TX | 872 | #if DEBUG_TX |
872 | printk(KERN_DEBUG "%s: hss_hdlc_xmit queue full\n", dev->name); | 873 | printk(KERN_DEBUG "%s: hss_hdlc_xmit queue full\n", dev->name); |
873 | #endif | 874 | #endif |
874 | netif_stop_queue(dev); | 875 | netif_stop_queue(dev); |
875 | /* we could miss TX ready interrupt */ | 876 | /* we could miss TX ready interrupt */ |
876 | if (!qmgr_stat_empty(txreadyq)) { | 877 | if (!qmgr_stat_below_low_watermark(txreadyq)) { |
877 | #if DEBUG_TX | 878 | #if DEBUG_TX |
878 | printk(KERN_DEBUG "%s: hss_hdlc_xmit ready again\n", | 879 | printk(KERN_DEBUG "%s: hss_hdlc_xmit ready again\n", |
879 | dev->name); | 880 | dev->name); |
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c index ca4151a9e222..17851321b7fd 100644 --- a/drivers/net/wimax/i2400m/usb.c +++ b/drivers/net/wimax/i2400m/usb.c | |||
@@ -505,27 +505,52 @@ int i2400mu_suspend(struct usb_interface *iface, pm_message_t pm_msg) | |||
505 | #ifdef CONFIG_PM | 505 | #ifdef CONFIG_PM |
506 | struct usb_device *usb_dev = i2400mu->usb_dev; | 506 | struct usb_device *usb_dev = i2400mu->usb_dev; |
507 | #endif | 507 | #endif |
508 | unsigned is_autosuspend = 0; | ||
508 | struct i2400m *i2400m = &i2400mu->i2400m; | 509 | struct i2400m *i2400m = &i2400mu->i2400m; |
509 | 510 | ||
511 | #ifdef CONFIG_PM | ||
512 | if (usb_dev->auto_pm > 0) | ||
513 | is_autosuspend = 1; | ||
514 | #endif | ||
515 | |||
510 | d_fnstart(3, dev, "(iface %p pm_msg %u)\n", iface, pm_msg.event); | 516 | d_fnstart(3, dev, "(iface %p pm_msg %u)\n", iface, pm_msg.event); |
511 | if (i2400m->updown == 0) | 517 | if (i2400m->updown == 0) |
512 | goto no_firmware; | 518 | goto no_firmware; |
513 | d_printf(1, dev, "fw up, requesting standby\n"); | 519 | if (i2400m->state == I2400M_SS_DATA_PATH_CONNECTED && is_autosuspend) { |
520 | /* ugh -- the device is connected and this suspend | ||
521 | * request is an autosuspend one (not a system standby | ||
522 | * / hibernate). | ||
523 | * | ||
524 | * The only way the device can go to standby is if the | ||
525 | * link with the base station is in IDLE mode; that | ||
526 | * were the case, we'd be in status | ||
527 | * I2400M_SS_CONNECTED_IDLE. But we are not. | ||
528 | * | ||
529 | * If we *tell* him to go power save now, it'll reset | ||
530 | * as a precautionary measure, so if this is an | ||
531 | * autosuspend thing, say no and it'll come back | ||
532 | * later, when the link is IDLE | ||
533 | */ | ||
534 | result = -EBADF; | ||
535 | d_printf(1, dev, "fw up, link up, not-idle, autosuspend: " | ||
536 | "not entering powersave\n"); | ||
537 | goto error_not_now; | ||
538 | } | ||
539 | d_printf(1, dev, "fw up: entering powersave\n"); | ||
514 | atomic_dec(&i2400mu->do_autopm); | 540 | atomic_dec(&i2400mu->do_autopm); |
515 | result = i2400m_cmd_enter_powersave(i2400m); | 541 | result = i2400m_cmd_enter_powersave(i2400m); |
516 | atomic_inc(&i2400mu->do_autopm); | 542 | atomic_inc(&i2400mu->do_autopm); |
517 | #ifdef CONFIG_PM | 543 | if (result < 0 && !is_autosuspend) { |
518 | if (result < 0 && usb_dev->auto_pm == 0) { | ||
519 | /* System suspend, can't fail */ | 544 | /* System suspend, can't fail */ |
520 | dev_err(dev, "failed to suspend, will reset on resume\n"); | 545 | dev_err(dev, "failed to suspend, will reset on resume\n"); |
521 | result = 0; | 546 | result = 0; |
522 | } | 547 | } |
523 | #endif | ||
524 | if (result < 0) | 548 | if (result < 0) |
525 | goto error_enter_powersave; | 549 | goto error_enter_powersave; |
526 | i2400mu_notification_release(i2400mu); | 550 | i2400mu_notification_release(i2400mu); |
527 | d_printf(1, dev, "fw up, got standby\n"); | 551 | d_printf(1, dev, "powersave requested\n"); |
528 | error_enter_powersave: | 552 | error_enter_powersave: |
553 | error_not_now: | ||
529 | no_firmware: | 554 | no_firmware: |
530 | d_fnend(3, dev, "(iface %p pm_msg %u) = %d\n", | 555 | d_fnend(3, dev, "(iface %p pm_msg %u) = %d\n", |
531 | iface, pm_msg.event, result); | 556 | iface, pm_msg.event, result); |
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 8a0823588c51..3d94e7dfea69 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -430,6 +430,7 @@ config RTL8187 | |||
430 | ASUS P5B Deluxe | 430 | ASUS P5B Deluxe |
431 | Toshiba Satellite Pro series of laptops | 431 | Toshiba Satellite Pro series of laptops |
432 | Asus Wireless Link | 432 | Asus Wireless Link |
433 | Linksys WUSB54GC-EU | ||
433 | 434 | ||
434 | Thanks to Realtek for their support! | 435 | Thanks to Realtek for their support! |
435 | 436 | ||
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index d73475739127..9eabf4d1f2e7 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -6467,6 +6467,7 @@ static int airo_get_encode(struct net_device *dev, | |||
6467 | { | 6467 | { |
6468 | struct airo_info *local = dev->ml_priv; | 6468 | struct airo_info *local = dev->ml_priv; |
6469 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; | 6469 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; |
6470 | int wep_key_len; | ||
6470 | u8 buf[16]; | 6471 | u8 buf[16]; |
6471 | 6472 | ||
6472 | if (!local->wep_capable) | 6473 | if (!local->wep_capable) |
@@ -6500,11 +6501,13 @@ static int airo_get_encode(struct net_device *dev, | |||
6500 | dwrq->flags |= index + 1; | 6501 | dwrq->flags |= index + 1; |
6501 | 6502 | ||
6502 | /* Copy the key to the user buffer */ | 6503 | /* Copy the key to the user buffer */ |
6503 | dwrq->length = get_wep_key(local, index, &buf[0], sizeof(buf)); | 6504 | wep_key_len = get_wep_key(local, index, &buf[0], sizeof(buf)); |
6504 | if (dwrq->length != -1) | 6505 | if (wep_key_len < 0) { |
6505 | memcpy(extra, buf, dwrq->length); | ||
6506 | else | ||
6507 | dwrq->length = 0; | 6506 | dwrq->length = 0; |
6507 | } else { | ||
6508 | dwrq->length = wep_key_len; | ||
6509 | memcpy(extra, buf, dwrq->length); | ||
6510 | } | ||
6508 | 6511 | ||
6509 | return 0; | 6512 | return 0; |
6510 | } | 6513 | } |
@@ -6617,7 +6620,7 @@ static int airo_get_encodeext(struct net_device *dev, | |||
6617 | struct airo_info *local = dev->ml_priv; | 6620 | struct airo_info *local = dev->ml_priv; |
6618 | struct iw_point *encoding = &wrqu->encoding; | 6621 | struct iw_point *encoding = &wrqu->encoding; |
6619 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | 6622 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; |
6620 | int idx, max_key_len; | 6623 | int idx, max_key_len, wep_key_len; |
6621 | u8 buf[16]; | 6624 | u8 buf[16]; |
6622 | 6625 | ||
6623 | if (!local->wep_capable) | 6626 | if (!local->wep_capable) |
@@ -6661,11 +6664,13 @@ static int airo_get_encodeext(struct net_device *dev, | |||
6661 | memset(extra, 0, 16); | 6664 | memset(extra, 0, 16); |
6662 | 6665 | ||
6663 | /* Copy the key to the user buffer */ | 6666 | /* Copy the key to the user buffer */ |
6664 | ext->key_len = get_wep_key(local, idx, &buf[0], sizeof(buf)); | 6667 | wep_key_len = get_wep_key(local, idx, &buf[0], sizeof(buf)); |
6665 | if (ext->key_len != -1) | 6668 | if (wep_key_len < 0) { |
6666 | memcpy(extra, buf, ext->key_len); | ||
6667 | else | ||
6668 | ext->key_len = 0; | 6669 | ext->key_len = 0; |
6670 | } else { | ||
6671 | ext->key_len = wep_key_len; | ||
6672 | memcpy(extra, buf, ext->key_len); | ||
6673 | } | ||
6669 | 6674 | ||
6670 | return 0; | 6675 | return 0; |
6671 | } | 6676 | } |
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index 744f4f4dd3d1..8d93ca4651b9 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -1873,18 +1873,18 @@ static void at76_dwork_hw_scan(struct work_struct *work) | |||
1873 | if (ret != CMD_STATUS_COMPLETE) { | 1873 | if (ret != CMD_STATUS_COMPLETE) { |
1874 | queue_delayed_work(priv->hw->workqueue, &priv->dwork_hw_scan, | 1874 | queue_delayed_work(priv->hw->workqueue, &priv->dwork_hw_scan, |
1875 | SCAN_POLL_INTERVAL); | 1875 | SCAN_POLL_INTERVAL); |
1876 | goto exit; | 1876 | mutex_unlock(&priv->mtx); |
1877 | return; | ||
1877 | } | 1878 | } |
1878 | 1879 | ||
1879 | ieee80211_scan_completed(priv->hw, false); | ||
1880 | |||
1881 | if (is_valid_ether_addr(priv->bssid)) | 1880 | if (is_valid_ether_addr(priv->bssid)) |
1882 | at76_join(priv); | 1881 | at76_join(priv); |
1883 | 1882 | ||
1884 | ieee80211_wake_queues(priv->hw); | ||
1885 | |||
1886 | exit: | ||
1887 | mutex_unlock(&priv->mtx); | 1883 | mutex_unlock(&priv->mtx); |
1884 | |||
1885 | ieee80211_scan_completed(priv->hw, false); | ||
1886 | |||
1887 | ieee80211_wake_queues(priv->hw); | ||
1888 | } | 1888 | } |
1889 | 1889 | ||
1890 | static int at76_hw_scan(struct ieee80211_hw *hw, | 1890 | static int at76_hw_scan(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/ath5k/phy.c b/drivers/net/wireless/ath5k/phy.c index 9e2faae5ae94..b48b29dca3d2 100644 --- a/drivers/net/wireless/ath5k/phy.c +++ b/drivers/net/wireless/ath5k/phy.c | |||
@@ -1487,28 +1487,35 @@ ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR, | |||
1487 | { | 1487 | { |
1488 | s8 tmp; | 1488 | s8 tmp; |
1489 | s16 min_pwrL, min_pwrR; | 1489 | s16 min_pwrL, min_pwrR; |
1490 | s16 pwr_i = pwrL[0]; | 1490 | s16 pwr_i; |
1491 | 1491 | ||
1492 | do { | 1492 | if (pwrL[0] == pwrL[1]) |
1493 | pwr_i--; | 1493 | min_pwrL = pwrL[0]; |
1494 | tmp = (s8) ath5k_get_interpolated_value(pwr_i, | 1494 | else { |
1495 | pwrL[0], pwrL[1], | 1495 | pwr_i = pwrL[0]; |
1496 | stepL[0], stepL[1]); | 1496 | do { |
1497 | 1497 | pwr_i--; | |
1498 | } while (tmp > 1); | 1498 | tmp = (s8) ath5k_get_interpolated_value(pwr_i, |
1499 | 1499 | pwrL[0], pwrL[1], | |
1500 | min_pwrL = pwr_i; | 1500 | stepL[0], stepL[1]); |
1501 | 1501 | } while (tmp > 1); | |
1502 | pwr_i = pwrR[0]; | 1502 | |
1503 | do { | 1503 | min_pwrL = pwr_i; |
1504 | pwr_i--; | 1504 | } |
1505 | tmp = (s8) ath5k_get_interpolated_value(pwr_i, | ||
1506 | pwrR[0], pwrR[1], | ||
1507 | stepR[0], stepR[1]); | ||
1508 | |||
1509 | } while (tmp > 1); | ||
1510 | 1505 | ||
1511 | min_pwrR = pwr_i; | 1506 | if (pwrR[0] == pwrR[1]) |
1507 | min_pwrR = pwrR[0]; | ||
1508 | else { | ||
1509 | pwr_i = pwrR[0]; | ||
1510 | do { | ||
1511 | pwr_i--; | ||
1512 | tmp = (s8) ath5k_get_interpolated_value(pwr_i, | ||
1513 | pwrR[0], pwrR[1], | ||
1514 | stepR[0], stepR[1]); | ||
1515 | } while (tmp > 1); | ||
1516 | |||
1517 | min_pwrR = pwr_i; | ||
1518 | } | ||
1512 | 1519 | ||
1513 | /* Keep the right boundary so that it works for both curves */ | 1520 | /* Keep the right boundary so that it works for both curves */ |
1514 | return max(min_pwrL, min_pwrR); | 1521 | return max(min_pwrL, min_pwrR); |
diff --git a/drivers/net/wireless/ath5k/reset.c b/drivers/net/wireless/ath5k/reset.c index 7a17d31b2fd9..5f72c111c2e8 100644 --- a/drivers/net/wireless/ath5k/reset.c +++ b/drivers/net/wireless/ath5k/reset.c | |||
@@ -26,7 +26,7 @@ | |||
26 | \*****************************/ | 26 | \*****************************/ |
27 | 27 | ||
28 | #include <linux/pci.h> /* To determine if a card is pci-e */ | 28 | #include <linux/pci.h> /* To determine if a card is pci-e */ |
29 | #include <linux/bitops.h> /* For get_bitmask_order */ | 29 | #include <linux/log2.h> |
30 | #include "ath5k.h" | 30 | #include "ath5k.h" |
31 | #include "reg.h" | 31 | #include "reg.h" |
32 | #include "base.h" | 32 | #include "base.h" |
@@ -69,10 +69,10 @@ static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, | |||
69 | 69 | ||
70 | /* Get exponent | 70 | /* Get exponent |
71 | * ALGO: coef_exp = 14 - highest set bit position */ | 71 | * ALGO: coef_exp = 14 - highest set bit position */ |
72 | coef_exp = get_bitmask_order(coef_scaled); | 72 | coef_exp = ilog2(coef_scaled); |
73 | 73 | ||
74 | /* Doesn't make sense if it's zero*/ | 74 | /* Doesn't make sense if it's zero*/ |
75 | if (!coef_exp) | 75 | if (!coef_scaled || !coef_exp) |
76 | return -EINVAL; | 76 | return -EINVAL; |
77 | 77 | ||
78 | /* Note: we've shifted coef_scaled by 24 */ | 78 | /* Note: we've shifted coef_scaled by 24 */ |
@@ -359,7 +359,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) | |||
359 | mode |= AR5K_PHY_MODE_FREQ_5GHZ; | 359 | mode |= AR5K_PHY_MODE_FREQ_5GHZ; |
360 | 360 | ||
361 | if (ah->ah_radio == AR5K_RF5413) | 361 | if (ah->ah_radio == AR5K_RF5413) |
362 | clock |= AR5K_PHY_PLL_40MHZ_5413; | 362 | clock = AR5K_PHY_PLL_40MHZ_5413; |
363 | else | 363 | else |
364 | clock |= AR5K_PHY_PLL_40MHZ; | 364 | clock |= AR5K_PHY_PLL_40MHZ; |
365 | 365 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index e5ca2511a81a..9452461ce864 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "iwl-6000-hw.h" | 46 | #include "iwl-6000-hw.h" |
47 | 47 | ||
48 | /* Highest firmware API version supported */ | 48 | /* Highest firmware API version supported */ |
49 | #define IWL5000_UCODE_API_MAX 1 | 49 | #define IWL5000_UCODE_API_MAX 2 |
50 | #define IWL5150_UCODE_API_MAX 2 | 50 | #define IWL5150_UCODE_API_MAX 2 |
51 | 51 | ||
52 | /* Lowest firmware API version supported */ | 52 | /* Lowest firmware API version supported */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 3bb28db4a40f..f46ba2475776 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -669,13 +669,6 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode) | |||
669 | if (!iwl_is_ready_rf(priv)) | 669 | if (!iwl_is_ready_rf(priv)) |
670 | return -EAGAIN; | 670 | return -EAGAIN; |
671 | 671 | ||
672 | cancel_delayed_work(&priv->scan_check); | ||
673 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
674 | IWL_WARN(priv, "Aborted scan still in progress after 100ms\n"); | ||
675 | IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); | ||
676 | return -EAGAIN; | ||
677 | } | ||
678 | |||
679 | iwl_commit_rxon(priv); | 672 | iwl_commit_rxon(priv); |
680 | 673 | ||
681 | return 0; | 674 | return 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index e7c65c4f741b..6330b91e37ce 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -227,9 +227,6 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, | |||
227 | /* The HW is no longer scanning */ | 227 | /* The HW is no longer scanning */ |
228 | clear_bit(STATUS_SCAN_HW, &priv->status); | 228 | clear_bit(STATUS_SCAN_HW, &priv->status); |
229 | 229 | ||
230 | /* The scan completion notification came in, so kill that timer... */ | ||
231 | cancel_delayed_work(&priv->scan_check); | ||
232 | |||
233 | IWL_DEBUG_INFO(priv, "Scan pass on %sGHz took %dms\n", | 230 | IWL_DEBUG_INFO(priv, "Scan pass on %sGHz took %dms\n", |
234 | (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ? | 231 | (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ? |
235 | "2.4" : "5.2", | 232 | "2.4" : "5.2", |
@@ -712,6 +709,8 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
712 | 709 | ||
713 | mutex_lock(&priv->mutex); | 710 | mutex_lock(&priv->mutex); |
714 | 711 | ||
712 | cancel_delayed_work(&priv->scan_check); | ||
713 | |||
715 | if (!iwl_is_ready(priv)) { | 714 | if (!iwl_is_ready(priv)) { |
716 | IWL_WARN(priv, "request scan called when driver not ready.\n"); | 715 | IWL_WARN(priv, "request scan called when driver not ready.\n"); |
717 | goto done; | 716 | goto done; |
@@ -925,6 +924,8 @@ void iwl_bg_scan_completed(struct work_struct *work) | |||
925 | 924 | ||
926 | IWL_DEBUG_SCAN(priv, "SCAN complete scan\n"); | 925 | IWL_DEBUG_SCAN(priv, "SCAN complete scan\n"); |
927 | 926 | ||
927 | cancel_delayed_work(&priv->scan_check); | ||
928 | |||
928 | ieee80211_scan_completed(priv->hw, false); | 929 | ieee80211_scan_completed(priv->hw, false); |
929 | 930 | ||
930 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 931 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 4cce66133500..ff4d0e41d7c4 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -782,13 +782,6 @@ static int iwl3945_set_mode(struct iwl_priv *priv, int mode) | |||
782 | if (!iwl_is_ready_rf(priv)) | 782 | if (!iwl_is_ready_rf(priv)) |
783 | return -EAGAIN; | 783 | return -EAGAIN; |
784 | 784 | ||
785 | cancel_delayed_work(&priv->scan_check); | ||
786 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
787 | IWL_WARN(priv, "Aborted scan still in progress after 100ms\n"); | ||
788 | IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); | ||
789 | return -EAGAIN; | ||
790 | } | ||
791 | |||
792 | iwl3945_commit_rxon(priv); | 785 | iwl3945_commit_rxon(priv); |
793 | 786 | ||
794 | return 0; | 787 | return 0; |
@@ -3298,6 +3291,8 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
3298 | 3291 | ||
3299 | mutex_lock(&priv->mutex); | 3292 | mutex_lock(&priv->mutex); |
3300 | 3293 | ||
3294 | cancel_delayed_work(&priv->scan_check); | ||
3295 | |||
3301 | if (!iwl_is_ready(priv)) { | 3296 | if (!iwl_is_ready(priv)) { |
3302 | IWL_WARN(priv, "request scan called when driver not ready.\n"); | 3297 | IWL_WARN(priv, "request scan called when driver not ready.\n"); |
3303 | goto done; | 3298 | goto done; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index 07d378ef0b46..7b3ee8c2eaef 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c | |||
@@ -138,7 +138,7 @@ void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev, | |||
138 | 138 | ||
139 | if (cipher == CIPHER_TKIP_NO_MIC) | 139 | if (cipher == CIPHER_TKIP_NO_MIC) |
140 | cipher = CIPHER_TKIP; | 140 | cipher = CIPHER_TKIP; |
141 | if (cipher == CIPHER_NONE || cipher > CIPHER_MAX) | 141 | if (cipher == CIPHER_NONE || cipher >= CIPHER_MAX) |
142 | return; | 142 | return; |
143 | 143 | ||
144 | /* Remove CIPHER_NONE index */ | 144 | /* Remove CIPHER_NONE index */ |
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c index bac6cfba6abd..d51ba0a88c23 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c | |||
@@ -71,6 +71,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = { | |||
71 | {USB_DEVICE(0x18E8, 0x6232), .driver_info = DEVICE_RTL8187}, | 71 | {USB_DEVICE(0x18E8, 0x6232), .driver_info = DEVICE_RTL8187}, |
72 | /* AirLive */ | 72 | /* AirLive */ |
73 | {USB_DEVICE(0x1b75, 0x8187), .driver_info = DEVICE_RTL8187}, | 73 | {USB_DEVICE(0x1b75, 0x8187), .driver_info = DEVICE_RTL8187}, |
74 | /* Linksys */ | ||
75 | {USB_DEVICE(0x1737, 0x0073), .driver_info = DEVICE_RTL8187B}, | ||
74 | {} | 76 | {} |
75 | }; | 77 | }; |
76 | 78 | ||
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c index f0e99d4c066b..242257b19441 100644 --- a/drivers/oprofile/cpu_buffer.c +++ b/drivers/oprofile/cpu_buffer.c | |||
@@ -78,16 +78,20 @@ void free_cpu_buffers(void) | |||
78 | op_ring_buffer_write = NULL; | 78 | op_ring_buffer_write = NULL; |
79 | } | 79 | } |
80 | 80 | ||
81 | #define RB_EVENT_HDR_SIZE 4 | ||
82 | |||
81 | int alloc_cpu_buffers(void) | 83 | int alloc_cpu_buffers(void) |
82 | { | 84 | { |
83 | int i; | 85 | int i; |
84 | 86 | ||
85 | unsigned long buffer_size = oprofile_cpu_buffer_size; | 87 | unsigned long buffer_size = oprofile_cpu_buffer_size; |
88 | unsigned long byte_size = buffer_size * (sizeof(struct op_sample) + | ||
89 | RB_EVENT_HDR_SIZE); | ||
86 | 90 | ||
87 | op_ring_buffer_read = ring_buffer_alloc(buffer_size, OP_BUFFER_FLAGS); | 91 | op_ring_buffer_read = ring_buffer_alloc(byte_size, OP_BUFFER_FLAGS); |
88 | if (!op_ring_buffer_read) | 92 | if (!op_ring_buffer_read) |
89 | goto fail; | 93 | goto fail; |
90 | op_ring_buffer_write = ring_buffer_alloc(buffer_size, OP_BUFFER_FLAGS); | 94 | op_ring_buffer_write = ring_buffer_alloc(byte_size, OP_BUFFER_FLAGS); |
91 | if (!op_ring_buffer_write) | 95 | if (!op_ring_buffer_write) |
92 | goto fail; | 96 | goto fail; |
93 | 97 | ||
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c index e6a7e847ee80..ea31a452b153 100644 --- a/drivers/parport/parport_gsc.c +++ b/drivers/parport/parport_gsc.c | |||
@@ -352,8 +352,8 @@ static int __devinit parport_init_chip(struct parisc_device *dev) | |||
352 | unsigned long port; | 352 | unsigned long port; |
353 | 353 | ||
354 | if (!dev->irq) { | 354 | if (!dev->irq) { |
355 | printk(KERN_WARNING "IRQ not found for parallel device at 0x%lx\n", | 355 | printk(KERN_WARNING "IRQ not found for parallel device at 0x%llx\n", |
356 | dev->hpa.start); | 356 | (unsigned long long)dev->hpa.start); |
357 | return -ENODEV; | 357 | return -ENODEV; |
358 | } | 358 | } |
359 | 359 | ||
diff --git a/drivers/parport/share.c b/drivers/parport/share.c index 0ebca450ed29..dffa5d4fb298 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c | |||
@@ -614,7 +614,10 @@ parport_register_device(struct parport *port, const char *name, | |||
614 | * pardevice fields. -arca | 614 | * pardevice fields. -arca |
615 | */ | 615 | */ |
616 | port->ops->init_state(tmp, tmp->state); | 616 | port->ops->init_state(tmp, tmp->state); |
617 | parport_device_proc_register(tmp); | 617 | if (!test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) { |
618 | port->proc_device = tmp; | ||
619 | parport_device_proc_register(tmp); | ||
620 | } | ||
618 | return tmp; | 621 | return tmp; |
619 | 622 | ||
620 | out_free_all: | 623 | out_free_all: |
@@ -646,10 +649,14 @@ void parport_unregister_device(struct pardevice *dev) | |||
646 | } | 649 | } |
647 | #endif | 650 | #endif |
648 | 651 | ||
649 | parport_device_proc_unregister(dev); | ||
650 | |||
651 | port = dev->port->physport; | 652 | port = dev->port->physport; |
652 | 653 | ||
654 | if (port->proc_device == dev) { | ||
655 | port->proc_device = NULL; | ||
656 | clear_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags); | ||
657 | parport_device_proc_unregister(dev); | ||
658 | } | ||
659 | |||
653 | if (port->cad == dev) { | 660 | if (port->cad == dev) { |
654 | printk(KERN_DEBUG "%s: %s forgot to release port\n", | 661 | printk(KERN_DEBUG "%s: %s forgot to release port\n", |
655 | port->name, dev->name); | 662 | port->name, dev->name); |
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index 4fc168b70095..e68d5f20ffb3 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
@@ -129,7 +129,6 @@ struct acpiphp_func { | |||
129 | struct acpiphp_bridge *bridge; /* Ejectable PCI-to-PCI bridge */ | 129 | struct acpiphp_bridge *bridge; /* Ejectable PCI-to-PCI bridge */ |
130 | 130 | ||
131 | struct list_head sibling; | 131 | struct list_head sibling; |
132 | struct pci_dev *pci_dev; | ||
133 | struct notifier_block nb; | 132 | struct notifier_block nb; |
134 | acpi_handle handle; | 133 | acpi_handle handle; |
135 | 134 | ||
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index a33794d9e0dc..3a6064bce561 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -32,9 +32,6 @@ | |||
32 | 32 | ||
33 | /* | 33 | /* |
34 | * Lifetime rules for pci_dev: | 34 | * Lifetime rules for pci_dev: |
35 | * - The one in acpiphp_func has its refcount elevated by pci_get_slot() | ||
36 | * when the driver is loaded or when an insertion event occurs. It loses | ||
37 | * a refcount when its ejected or the driver unloads. | ||
38 | * - The one in acpiphp_bridge has its refcount elevated by pci_get_slot() | 35 | * - The one in acpiphp_bridge has its refcount elevated by pci_get_slot() |
39 | * when the bridge is scanned and it loses a refcount when the bridge | 36 | * when the bridge is scanned and it loses a refcount when the bridge |
40 | * is removed. | 37 | * is removed. |
@@ -130,6 +127,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
130 | unsigned long long adr, sun; | 127 | unsigned long long adr, sun; |
131 | int device, function, retval; | 128 | int device, function, retval; |
132 | struct pci_bus *pbus = bridge->pci_bus; | 129 | struct pci_bus *pbus = bridge->pci_bus; |
130 | struct pci_dev *pdev; | ||
133 | 131 | ||
134 | if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle)) | 132 | if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle)) |
135 | return AE_OK; | 133 | return AE_OK; |
@@ -213,10 +211,10 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
213 | newfunc->slot = slot; | 211 | newfunc->slot = slot; |
214 | list_add_tail(&newfunc->sibling, &slot->funcs); | 212 | list_add_tail(&newfunc->sibling, &slot->funcs); |
215 | 213 | ||
216 | /* associate corresponding pci_dev */ | 214 | pdev = pci_get_slot(pbus, PCI_DEVFN(device, function)); |
217 | newfunc->pci_dev = pci_get_slot(pbus, PCI_DEVFN(device, function)); | 215 | if (pdev) { |
218 | if (newfunc->pci_dev) { | ||
219 | slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); | 216 | slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); |
217 | pci_dev_put(pdev); | ||
220 | } | 218 | } |
221 | 219 | ||
222 | if (is_dock_device(handle)) { | 220 | if (is_dock_device(handle)) { |
@@ -617,7 +615,6 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge) | |||
617 | if (ACPI_FAILURE(status)) | 615 | if (ACPI_FAILURE(status)) |
618 | err("failed to remove notify handler\n"); | 616 | err("failed to remove notify handler\n"); |
619 | } | 617 | } |
620 | pci_dev_put(func->pci_dev); | ||
621 | list_del(list); | 618 | list_del(list); |
622 | kfree(func); | 619 | kfree(func); |
623 | } | 620 | } |
@@ -1101,22 +1098,24 @@ static int __ref enable_device(struct acpiphp_slot *slot) | |||
1101 | pci_enable_bridges(bus); | 1098 | pci_enable_bridges(bus); |
1102 | pci_bus_add_devices(bus); | 1099 | pci_bus_add_devices(bus); |
1103 | 1100 | ||
1104 | /* associate pci_dev to our representation */ | ||
1105 | list_for_each (l, &slot->funcs) { | 1101 | list_for_each (l, &slot->funcs) { |
1106 | func = list_entry(l, struct acpiphp_func, sibling); | 1102 | func = list_entry(l, struct acpiphp_func, sibling); |
1107 | func->pci_dev = pci_get_slot(bus, PCI_DEVFN(slot->device, | 1103 | dev = pci_get_slot(bus, PCI_DEVFN(slot->device, |
1108 | func->function)); | 1104 | func->function)); |
1109 | if (!func->pci_dev) | 1105 | if (!dev) |
1110 | continue; | 1106 | continue; |
1111 | 1107 | ||
1112 | if (func->pci_dev->hdr_type != PCI_HEADER_TYPE_BRIDGE && | 1108 | if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE && |
1113 | func->pci_dev->hdr_type != PCI_HEADER_TYPE_CARDBUS) | 1109 | dev->hdr_type != PCI_HEADER_TYPE_CARDBUS) { |
1110 | pci_dev_put(dev); | ||
1114 | continue; | 1111 | continue; |
1112 | } | ||
1115 | 1113 | ||
1116 | status = find_p2p_bridge(func->handle, (u32)1, bus, NULL); | 1114 | status = find_p2p_bridge(func->handle, (u32)1, bus, NULL); |
1117 | if (ACPI_FAILURE(status)) | 1115 | if (ACPI_FAILURE(status)) |
1118 | warn("find_p2p_bridge failed (error code = 0x%x)\n", | 1116 | warn("find_p2p_bridge failed (error code = 0x%x)\n", |
1119 | status); | 1117 | status); |
1118 | pci_dev_put(dev); | ||
1120 | } | 1119 | } |
1121 | 1120 | ||
1122 | slot->flags |= SLOT_ENABLED; | 1121 | slot->flags |= SLOT_ENABLED; |
@@ -1142,17 +1141,14 @@ static void disable_bridges(struct pci_bus *bus) | |||
1142 | */ | 1141 | */ |
1143 | static int disable_device(struct acpiphp_slot *slot) | 1142 | static int disable_device(struct acpiphp_slot *slot) |
1144 | { | 1143 | { |
1145 | int retval = 0; | ||
1146 | struct acpiphp_func *func; | 1144 | struct acpiphp_func *func; |
1147 | struct list_head *l; | 1145 | struct pci_dev *pdev; |
1148 | 1146 | ||
1149 | /* is this slot already disabled? */ | 1147 | /* is this slot already disabled? */ |
1150 | if (!(slot->flags & SLOT_ENABLED)) | 1148 | if (!(slot->flags & SLOT_ENABLED)) |
1151 | goto err_exit; | 1149 | goto err_exit; |
1152 | 1150 | ||
1153 | list_for_each (l, &slot->funcs) { | 1151 | list_for_each_entry(func, &slot->funcs, sibling) { |
1154 | func = list_entry(l, struct acpiphp_func, sibling); | ||
1155 | |||
1156 | if (func->bridge) { | 1152 | if (func->bridge) { |
1157 | /* cleanup p2p bridges under this P2P bridge */ | 1153 | /* cleanup p2p bridges under this P2P bridge */ |
1158 | cleanup_p2p_bridge(func->bridge->handle, | 1154 | cleanup_p2p_bridge(func->bridge->handle, |
@@ -1160,35 +1156,28 @@ static int disable_device(struct acpiphp_slot *slot) | |||
1160 | func->bridge = NULL; | 1156 | func->bridge = NULL; |
1161 | } | 1157 | } |
1162 | 1158 | ||
1163 | if (func->pci_dev) { | 1159 | pdev = pci_get_slot(slot->bridge->pci_bus, |
1164 | pci_stop_bus_device(func->pci_dev); | 1160 | PCI_DEVFN(slot->device, func->function)); |
1165 | if (func->pci_dev->subordinate) { | 1161 | if (pdev) { |
1166 | disable_bridges(func->pci_dev->subordinate); | 1162 | pci_stop_bus_device(pdev); |
1167 | pci_disable_device(func->pci_dev); | 1163 | if (pdev->subordinate) { |
1164 | disable_bridges(pdev->subordinate); | ||
1165 | pci_disable_device(pdev); | ||
1168 | } | 1166 | } |
1167 | pci_remove_bus_device(pdev); | ||
1168 | pci_dev_put(pdev); | ||
1169 | } | 1169 | } |
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | list_for_each (l, &slot->funcs) { | 1172 | list_for_each_entry(func, &slot->funcs, sibling) { |
1173 | func = list_entry(l, struct acpiphp_func, sibling); | ||
1174 | |||
1175 | acpiphp_unconfigure_ioapics(func->handle); | 1173 | acpiphp_unconfigure_ioapics(func->handle); |
1176 | acpiphp_bus_trim(func->handle); | 1174 | acpiphp_bus_trim(func->handle); |
1177 | /* try to remove anyway. | ||
1178 | * acpiphp_bus_add might have been failed */ | ||
1179 | |||
1180 | if (!func->pci_dev) | ||
1181 | continue; | ||
1182 | |||
1183 | pci_remove_bus_device(func->pci_dev); | ||
1184 | pci_dev_put(func->pci_dev); | ||
1185 | func->pci_dev = NULL; | ||
1186 | } | 1175 | } |
1187 | 1176 | ||
1188 | slot->flags &= (~SLOT_ENABLED); | 1177 | slot->flags &= (~SLOT_ENABLED); |
1189 | 1178 | ||
1190 | err_exit: | 1179 | err_exit: |
1191 | return retval; | 1180 | return 0; |
1192 | } | 1181 | } |
1193 | 1182 | ||
1194 | 1183 | ||
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c index f7a3283dd029..551332e4ed02 100644 --- a/drivers/rtc/rtc-ep93xx.c +++ b/drivers/rtc/rtc-ep93xx.c | |||
@@ -12,32 +12,56 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/rtc.h> | 13 | #include <linux/rtc.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <mach/hardware.h> | 15 | #include <linux/io.h> |
16 | |||
17 | #define EP93XX_RTC_DATA 0x000 | ||
18 | #define EP93XX_RTC_MATCH 0x004 | ||
19 | #define EP93XX_RTC_STATUS 0x008 | ||
20 | #define EP93XX_RTC_STATUS_INTR (1<<0) | ||
21 | #define EP93XX_RTC_LOAD 0x00C | ||
22 | #define EP93XX_RTC_CONTROL 0x010 | ||
23 | #define EP93XX_RTC_CONTROL_MIE (1<<0) | ||
24 | #define EP93XX_RTC_SWCOMP 0x108 | ||
25 | #define EP93XX_RTC_SWCOMP_DEL_MASK 0x001f0000 | ||
26 | #define EP93XX_RTC_SWCOMP_DEL_SHIFT 16 | ||
27 | #define EP93XX_RTC_SWCOMP_INT_MASK 0x0000ffff | ||
28 | #define EP93XX_RTC_SWCOMP_INT_SHIFT 0 | ||
29 | |||
30 | #define DRV_VERSION "0.3" | ||
16 | 31 | ||
17 | #define EP93XX_RTC_REG(x) (EP93XX_RTC_BASE + (x)) | 32 | /* |
18 | #define EP93XX_RTC_DATA EP93XX_RTC_REG(0x0000) | 33 | * struct device dev.platform_data is used to store our private data |
19 | #define EP93XX_RTC_LOAD EP93XX_RTC_REG(0x000C) | 34 | * because struct rtc_device does not have a variable to hold it. |
20 | #define EP93XX_RTC_SWCOMP EP93XX_RTC_REG(0x0108) | 35 | */ |
21 | 36 | struct ep93xx_rtc { | |
22 | #define DRV_VERSION "0.2" | 37 | void __iomem *mmio_base; |
38 | }; | ||
23 | 39 | ||
24 | static int ep93xx_get_swcomp(struct device *dev, unsigned short *preload, | 40 | static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload, |
25 | unsigned short *delete) | 41 | unsigned short *delete) |
26 | { | 42 | { |
27 | unsigned short comp = __raw_readl(EP93XX_RTC_SWCOMP); | 43 | struct ep93xx_rtc *ep93xx_rtc = dev->platform_data; |
44 | unsigned long comp; | ||
45 | |||
46 | comp = __raw_readl(ep93xx_rtc->mmio_base + EP93XX_RTC_SWCOMP); | ||
28 | 47 | ||
29 | if (preload) | 48 | if (preload) |
30 | *preload = comp & 0xffff; | 49 | *preload = (comp & EP93XX_RTC_SWCOMP_INT_MASK) |
50 | >> EP93XX_RTC_SWCOMP_INT_SHIFT; | ||
31 | 51 | ||
32 | if (delete) | 52 | if (delete) |
33 | *delete = (comp >> 16) & 0x1f; | 53 | *delete = (comp & EP93XX_RTC_SWCOMP_DEL_MASK) |
54 | >> EP93XX_RTC_SWCOMP_DEL_SHIFT; | ||
34 | 55 | ||
35 | return 0; | 56 | return 0; |
36 | } | 57 | } |
37 | 58 | ||
38 | static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm) | 59 | static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm) |
39 | { | 60 | { |
40 | unsigned long time = __raw_readl(EP93XX_RTC_DATA); | 61 | struct ep93xx_rtc *ep93xx_rtc = dev->platform_data; |
62 | unsigned long time; | ||
63 | |||
64 | time = __raw_readl(ep93xx_rtc->mmio_base + EP93XX_RTC_DATA); | ||
41 | 65 | ||
42 | rtc_time_to_tm(time, tm); | 66 | rtc_time_to_tm(time, tm); |
43 | return 0; | 67 | return 0; |
@@ -45,7 +69,9 @@ static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
45 | 69 | ||
46 | static int ep93xx_rtc_set_mmss(struct device *dev, unsigned long secs) | 70 | static int ep93xx_rtc_set_mmss(struct device *dev, unsigned long secs) |
47 | { | 71 | { |
48 | __raw_writel(secs + 1, EP93XX_RTC_LOAD); | 72 | struct ep93xx_rtc *ep93xx_rtc = dev->platform_data; |
73 | |||
74 | __raw_writel(secs + 1, ep93xx_rtc->mmio_base + EP93XX_RTC_LOAD); | ||
49 | return 0; | 75 | return 0; |
50 | } | 76 | } |
51 | 77 | ||
@@ -53,7 +79,7 @@ static int ep93xx_rtc_proc(struct device *dev, struct seq_file *seq) | |||
53 | { | 79 | { |
54 | unsigned short preload, delete; | 80 | unsigned short preload, delete; |
55 | 81 | ||
56 | ep93xx_get_swcomp(dev, &preload, &delete); | 82 | ep93xx_rtc_get_swcomp(dev, &preload, &delete); |
57 | 83 | ||
58 | seq_printf(seq, "preload\t\t: %d\n", preload); | 84 | seq_printf(seq, "preload\t\t: %d\n", preload); |
59 | seq_printf(seq, "delete\t\t: %d\n", delete); | 85 | seq_printf(seq, "delete\t\t: %d\n", delete); |
@@ -67,54 +93,104 @@ static const struct rtc_class_ops ep93xx_rtc_ops = { | |||
67 | .proc = ep93xx_rtc_proc, | 93 | .proc = ep93xx_rtc_proc, |
68 | }; | 94 | }; |
69 | 95 | ||
70 | static ssize_t ep93xx_sysfs_show_comp_preload(struct device *dev, | 96 | static ssize_t ep93xx_rtc_show_comp_preload(struct device *dev, |
71 | struct device_attribute *attr, char *buf) | 97 | struct device_attribute *attr, char *buf) |
72 | { | 98 | { |
73 | unsigned short preload; | 99 | unsigned short preload; |
74 | 100 | ||
75 | ep93xx_get_swcomp(dev, &preload, NULL); | 101 | ep93xx_rtc_get_swcomp(dev, &preload, NULL); |
76 | 102 | ||
77 | return sprintf(buf, "%d\n", preload); | 103 | return sprintf(buf, "%d\n", preload); |
78 | } | 104 | } |
79 | static DEVICE_ATTR(comp_preload, S_IRUGO, ep93xx_sysfs_show_comp_preload, NULL); | 105 | static DEVICE_ATTR(comp_preload, S_IRUGO, ep93xx_rtc_show_comp_preload, NULL); |
80 | 106 | ||
81 | static ssize_t ep93xx_sysfs_show_comp_delete(struct device *dev, | 107 | static ssize_t ep93xx_rtc_show_comp_delete(struct device *dev, |
82 | struct device_attribute *attr, char *buf) | 108 | struct device_attribute *attr, char *buf) |
83 | { | 109 | { |
84 | unsigned short delete; | 110 | unsigned short delete; |
85 | 111 | ||
86 | ep93xx_get_swcomp(dev, NULL, &delete); | 112 | ep93xx_rtc_get_swcomp(dev, NULL, &delete); |
87 | 113 | ||
88 | return sprintf(buf, "%d\n", delete); | 114 | return sprintf(buf, "%d\n", delete); |
89 | } | 115 | } |
90 | static DEVICE_ATTR(comp_delete, S_IRUGO, ep93xx_sysfs_show_comp_delete, NULL); | 116 | static DEVICE_ATTR(comp_delete, S_IRUGO, ep93xx_rtc_show_comp_delete, NULL); |
91 | 117 | ||
92 | 118 | ||
93 | static int __devinit ep93xx_rtc_probe(struct platform_device *dev) | 119 | static int __init ep93xx_rtc_probe(struct platform_device *pdev) |
94 | { | 120 | { |
95 | struct rtc_device *rtc = rtc_device_register("ep93xx", | 121 | struct ep93xx_rtc *ep93xx_rtc; |
96 | &dev->dev, &ep93xx_rtc_ops, THIS_MODULE); | 122 | struct resource *res; |
123 | struct rtc_device *rtc; | ||
124 | int err; | ||
125 | |||
126 | ep93xx_rtc = kzalloc(sizeof(struct ep93xx_rtc), GFP_KERNEL); | ||
127 | if (ep93xx_rtc == NULL) | ||
128 | return -ENOMEM; | ||
129 | |||
130 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
131 | if (res == NULL) | ||
132 | return -ENXIO; | ||
133 | |||
134 | res = request_mem_region(res->start, resource_size(res), pdev->name); | ||
135 | if (res == NULL) | ||
136 | return -EBUSY; | ||
137 | |||
138 | ep93xx_rtc->mmio_base = ioremap(res->start, resource_size(res)); | ||
139 | if (ep93xx_rtc->mmio_base == NULL) { | ||
140 | err = -ENXIO; | ||
141 | goto fail; | ||
142 | } | ||
97 | 143 | ||
144 | pdev->dev.platform_data = ep93xx_rtc; | ||
145 | |||
146 | rtc = rtc_device_register(pdev->name, | ||
147 | &pdev->dev, &ep93xx_rtc_ops, THIS_MODULE); | ||
98 | if (IS_ERR(rtc)) { | 148 | if (IS_ERR(rtc)) { |
99 | return PTR_ERR(rtc); | 149 | err = PTR_ERR(rtc); |
150 | goto fail; | ||
100 | } | 151 | } |
101 | 152 | ||
102 | platform_set_drvdata(dev, rtc); | 153 | platform_set_drvdata(pdev, rtc); |
103 | 154 | ||
104 | device_create_file(&dev->dev, &dev_attr_comp_preload); | 155 | err = device_create_file(&pdev->dev, &dev_attr_comp_preload); |
105 | device_create_file(&dev->dev, &dev_attr_comp_delete); | 156 | if (err) |
157 | goto fail; | ||
158 | err = device_create_file(&pdev->dev, &dev_attr_comp_delete); | ||
159 | if (err) { | ||
160 | device_remove_file(&pdev->dev, &dev_attr_comp_preload); | ||
161 | goto fail; | ||
162 | } | ||
106 | 163 | ||
107 | return 0; | 164 | return 0; |
165 | |||
166 | fail: | ||
167 | if (ep93xx_rtc->mmio_base) { | ||
168 | iounmap(ep93xx_rtc->mmio_base); | ||
169 | pdev->dev.platform_data = NULL; | ||
170 | } | ||
171 | release_mem_region(res->start, resource_size(res)); | ||
172 | return err; | ||
108 | } | 173 | } |
109 | 174 | ||
110 | static int __devexit ep93xx_rtc_remove(struct platform_device *dev) | 175 | static int __exit ep93xx_rtc_remove(struct platform_device *pdev) |
111 | { | 176 | { |
112 | struct rtc_device *rtc = platform_get_drvdata(dev); | 177 | struct rtc_device *rtc = platform_get_drvdata(pdev); |
178 | struct ep93xx_rtc *ep93xx_rtc = pdev->dev.platform_data; | ||
179 | struct resource *res; | ||
180 | |||
181 | /* cleanup sysfs */ | ||
182 | device_remove_file(&pdev->dev, &dev_attr_comp_delete); | ||
183 | device_remove_file(&pdev->dev, &dev_attr_comp_preload); | ||
184 | |||
185 | rtc_device_unregister(rtc); | ||
186 | |||
187 | iounmap(ep93xx_rtc->mmio_base); | ||
188 | pdev->dev.platform_data = NULL; | ||
113 | 189 | ||
114 | if (rtc) | 190 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
115 | rtc_device_unregister(rtc); | 191 | release_mem_region(res->start, resource_size(res)); |
116 | 192 | ||
117 | platform_set_drvdata(dev, NULL); | 193 | platform_set_drvdata(pdev, NULL); |
118 | 194 | ||
119 | return 0; | 195 | return 0; |
120 | } | 196 | } |
@@ -122,23 +198,22 @@ static int __devexit ep93xx_rtc_remove(struct platform_device *dev) | |||
122 | /* work with hotplug and coldplug */ | 198 | /* work with hotplug and coldplug */ |
123 | MODULE_ALIAS("platform:ep93xx-rtc"); | 199 | MODULE_ALIAS("platform:ep93xx-rtc"); |
124 | 200 | ||
125 | static struct platform_driver ep93xx_rtc_platform_driver = { | 201 | static struct platform_driver ep93xx_rtc_driver = { |
126 | .driver = { | 202 | .driver = { |
127 | .name = "ep93xx-rtc", | 203 | .name = "ep93xx-rtc", |
128 | .owner = THIS_MODULE, | 204 | .owner = THIS_MODULE, |
129 | }, | 205 | }, |
130 | .probe = ep93xx_rtc_probe, | 206 | .remove = __exit_p(ep93xx_rtc_remove), |
131 | .remove = __devexit_p(ep93xx_rtc_remove), | ||
132 | }; | 207 | }; |
133 | 208 | ||
134 | static int __init ep93xx_rtc_init(void) | 209 | static int __init ep93xx_rtc_init(void) |
135 | { | 210 | { |
136 | return platform_driver_register(&ep93xx_rtc_platform_driver); | 211 | return platform_driver_probe(&ep93xx_rtc_driver, ep93xx_rtc_probe); |
137 | } | 212 | } |
138 | 213 | ||
139 | static void __exit ep93xx_rtc_exit(void) | 214 | static void __exit ep93xx_rtc_exit(void) |
140 | { | 215 | { |
141 | platform_driver_unregister(&ep93xx_rtc_platform_driver); | 216 | platform_driver_unregister(&ep93xx_rtc_driver); |
142 | } | 217 | } |
143 | 218 | ||
144 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | 219 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index b4b39811b445..a0127e93ade0 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -137,6 +137,7 @@ struct uart_8250_port { | |||
137 | unsigned char mcr; | 137 | unsigned char mcr; |
138 | unsigned char mcr_mask; /* mask of user bits */ | 138 | unsigned char mcr_mask; /* mask of user bits */ |
139 | unsigned char mcr_force; /* mask of forced bits */ | 139 | unsigned char mcr_force; /* mask of forced bits */ |
140 | unsigned char cur_iotype; /* Running I/O type */ | ||
140 | 141 | ||
141 | /* | 142 | /* |
142 | * Some bits in registers are cleared on a read, so they must | 143 | * Some bits in registers are cleared on a read, so they must |
@@ -471,6 +472,7 @@ static void io_serial_out(struct uart_port *p, int offset, int value) | |||
471 | 472 | ||
472 | static void set_io_from_upio(struct uart_port *p) | 473 | static void set_io_from_upio(struct uart_port *p) |
473 | { | 474 | { |
475 | struct uart_8250_port *up = (struct uart_8250_port *)p; | ||
474 | switch (p->iotype) { | 476 | switch (p->iotype) { |
475 | case UPIO_HUB6: | 477 | case UPIO_HUB6: |
476 | p->serial_in = hub6_serial_in; | 478 | p->serial_in = hub6_serial_in; |
@@ -509,6 +511,8 @@ static void set_io_from_upio(struct uart_port *p) | |||
509 | p->serial_out = io_serial_out; | 511 | p->serial_out = io_serial_out; |
510 | break; | 512 | break; |
511 | } | 513 | } |
514 | /* Remember loaded iotype */ | ||
515 | up->cur_iotype = p->iotype; | ||
512 | } | 516 | } |
513 | 517 | ||
514 | static void | 518 | static void |
@@ -1937,6 +1941,9 @@ static int serial8250_startup(struct uart_port *port) | |||
1937 | up->capabilities = uart_config[up->port.type].flags; | 1941 | up->capabilities = uart_config[up->port.type].flags; |
1938 | up->mcr = 0; | 1942 | up->mcr = 0; |
1939 | 1943 | ||
1944 | if (up->port.iotype != up->cur_iotype) | ||
1945 | set_io_from_upio(port); | ||
1946 | |||
1940 | if (up->port.type == PORT_16C950) { | 1947 | if (up->port.type == PORT_16C950) { |
1941 | /* Wake up and initialize UART */ | 1948 | /* Wake up and initialize UART */ |
1942 | up->acr = 0; | 1949 | up->acr = 0; |
@@ -2563,6 +2570,9 @@ static void serial8250_config_port(struct uart_port *port, int flags) | |||
2563 | if (ret < 0) | 2570 | if (ret < 0) |
2564 | probeflags &= ~PROBE_RSA; | 2571 | probeflags &= ~PROBE_RSA; |
2565 | 2572 | ||
2573 | if (up->port.iotype != up->cur_iotype) | ||
2574 | set_io_from_upio(port); | ||
2575 | |||
2566 | if (flags & UART_CONFIG_TYPE) | 2576 | if (flags & UART_CONFIG_TYPE) |
2567 | autoconfig(up, probeflags); | 2577 | autoconfig(up, probeflags); |
2568 | if (up->port.type != PORT_UNKNOWN && flags & UART_CONFIG_IRQ) | 2578 | if (up->port.type != PORT_UNKNOWN && flags & UART_CONFIG_IRQ) |
@@ -2671,6 +2681,11 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev) | |||
2671 | { | 2681 | { |
2672 | int i; | 2682 | int i; |
2673 | 2683 | ||
2684 | for (i = 0; i < nr_uarts; i++) { | ||
2685 | struct uart_8250_port *up = &serial8250_ports[i]; | ||
2686 | up->cur_iotype = 0xFF; | ||
2687 | } | ||
2688 | |||
2674 | serial8250_isa_init_ports(); | 2689 | serial8250_isa_init_ports(); |
2675 | 2690 | ||
2676 | for (i = 0; i < nr_uarts; i++) { | 2691 | for (i = 0; i < nr_uarts; i++) { |
diff --git a/drivers/serial/8250_gsc.c b/drivers/serial/8250_gsc.c index 418b4fe9a0a1..33149d982e82 100644 --- a/drivers/serial/8250_gsc.c +++ b/drivers/serial/8250_gsc.c | |||
@@ -39,9 +39,9 @@ static int __init serial_init_chip(struct parisc_device *dev) | |||
39 | */ | 39 | */ |
40 | if (parisc_parent(dev)->id.hw_type != HPHW_IOA) | 40 | if (parisc_parent(dev)->id.hw_type != HPHW_IOA) |
41 | printk(KERN_INFO | 41 | printk(KERN_INFO |
42 | "Serial: device 0x%lx not configured.\n" | 42 | "Serial: device 0x%llx not configured.\n" |
43 | "Enable support for Wax, Lasi, Asp or Dino.\n", | 43 | "Enable support for Wax, Lasi, Asp or Dino.\n", |
44 | dev->hpa.start); | 44 | (unsigned long long)dev->hpa.start); |
45 | return -ENODEV; | 45 | return -ENODEV; |
46 | } | 46 | } |
47 | 47 | ||
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 88fdac51b6c5..8c5bda27736c 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
@@ -70,6 +70,23 @@ struct uart_amba_port { | |||
70 | struct clk *clk; | 70 | struct clk *clk; |
71 | unsigned int im; /* interrupt mask */ | 71 | unsigned int im; /* interrupt mask */ |
72 | unsigned int old_status; | 72 | unsigned int old_status; |
73 | unsigned int ifls; /* vendor-specific */ | ||
74 | }; | ||
75 | |||
76 | /* There is by now at least one vendor with differing details, so handle it */ | ||
77 | struct vendor_data { | ||
78 | unsigned int ifls; | ||
79 | unsigned int fifosize; | ||
80 | }; | ||
81 | |||
82 | static struct vendor_data vendor_arm = { | ||
83 | .ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, | ||
84 | .fifosize = 16, | ||
85 | }; | ||
86 | |||
87 | static struct vendor_data vendor_st = { | ||
88 | .ifls = UART011_IFLS_RX_HALF|UART011_IFLS_TX_HALF, | ||
89 | .fifosize = 64, | ||
73 | }; | 90 | }; |
74 | 91 | ||
75 | static void pl011_stop_tx(struct uart_port *port) | 92 | static void pl011_stop_tx(struct uart_port *port) |
@@ -360,8 +377,7 @@ static int pl011_startup(struct uart_port *port) | |||
360 | if (retval) | 377 | if (retval) |
361 | goto clk_dis; | 378 | goto clk_dis; |
362 | 379 | ||
363 | writew(UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, | 380 | writew(uap->ifls, uap->port.membase + UART011_IFLS); |
364 | uap->port.membase + UART011_IFLS); | ||
365 | 381 | ||
366 | /* | 382 | /* |
367 | * Provoke TX FIFO interrupt into asserting. | 383 | * Provoke TX FIFO interrupt into asserting. |
@@ -732,6 +748,7 @@ static struct uart_driver amba_reg = { | |||
732 | static int pl011_probe(struct amba_device *dev, struct amba_id *id) | 748 | static int pl011_probe(struct amba_device *dev, struct amba_id *id) |
733 | { | 749 | { |
734 | struct uart_amba_port *uap; | 750 | struct uart_amba_port *uap; |
751 | struct vendor_data *vendor = id->data; | ||
735 | void __iomem *base; | 752 | void __iomem *base; |
736 | int i, ret; | 753 | int i, ret; |
737 | 754 | ||
@@ -762,12 +779,13 @@ static int pl011_probe(struct amba_device *dev, struct amba_id *id) | |||
762 | goto unmap; | 779 | goto unmap; |
763 | } | 780 | } |
764 | 781 | ||
782 | uap->ifls = vendor->ifls; | ||
765 | uap->port.dev = &dev->dev; | 783 | uap->port.dev = &dev->dev; |
766 | uap->port.mapbase = dev->res.start; | 784 | uap->port.mapbase = dev->res.start; |
767 | uap->port.membase = base; | 785 | uap->port.membase = base; |
768 | uap->port.iotype = UPIO_MEM; | 786 | uap->port.iotype = UPIO_MEM; |
769 | uap->port.irq = dev->irq[0]; | 787 | uap->port.irq = dev->irq[0]; |
770 | uap->port.fifosize = 16; | 788 | uap->port.fifosize = vendor->fifosize; |
771 | uap->port.ops = &amba_pl011_pops; | 789 | uap->port.ops = &amba_pl011_pops; |
772 | uap->port.flags = UPF_BOOT_AUTOCONF; | 790 | uap->port.flags = UPF_BOOT_AUTOCONF; |
773 | uap->port.line = i; | 791 | uap->port.line = i; |
@@ -812,6 +830,12 @@ static struct amba_id pl011_ids[] __initdata = { | |||
812 | { | 830 | { |
813 | .id = 0x00041011, | 831 | .id = 0x00041011, |
814 | .mask = 0x000fffff, | 832 | .mask = 0x000fffff, |
833 | .data = &vendor_arm, | ||
834 | }, | ||
835 | { | ||
836 | .id = 0x00380802, | ||
837 | .mask = 0x00ffffff, | ||
838 | .data = &vendor_st, | ||
815 | }, | 839 | }, |
816 | { 0, 0 }, | 840 | { 0, 0 }, |
817 | }; | 841 | }; |
@@ -845,7 +869,11 @@ static void __exit pl011_exit(void) | |||
845 | uart_unregister_driver(&amba_reg); | 869 | uart_unregister_driver(&amba_reg); |
846 | } | 870 | } |
847 | 871 | ||
848 | module_init(pl011_init); | 872 | /* |
873 | * While this can be a module, if builtin it's most likely the console | ||
874 | * So let's leave module_exit but move module_init to an earlier place | ||
875 | */ | ||
876 | arch_initcall(pl011_init); | ||
849 | module_exit(pl011_exit); | 877 | module_exit(pl011_exit); |
850 | 878 | ||
851 | MODULE_AUTHOR("ARM Ltd/Deep Blue Solutions Ltd"); | 879 | MODULE_AUTHOR("ARM Ltd/Deep Blue Solutions Ltd"); |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 9f460b175c50..738c8a5f64f2 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -66,7 +66,7 @@ | |||
66 | #define ONEMS 0xb0 /* One Millisecond register */ | 66 | #define ONEMS 0xb0 /* One Millisecond register */ |
67 | #define UTS 0xb4 /* UART Test Register */ | 67 | #define UTS 0xb4 /* UART Test Register */ |
68 | #endif | 68 | #endif |
69 | #if defined(CONFIG_ARCH_IMX) || defined(CONFIG_ARCH_MX1) | 69 | #ifdef CONFIG_ARCH_MX1 |
70 | #define BIPR1 0xb0 /* Incremental Preset Register 1 */ | 70 | #define BIPR1 0xb0 /* Incremental Preset Register 1 */ |
71 | #define BIPR2 0xb4 /* Incremental Preset Register 2 */ | 71 | #define BIPR2 0xb4 /* Incremental Preset Register 2 */ |
72 | #define BIPR3 0xb8 /* Incremental Preset Register 3 */ | 72 | #define BIPR3 0xb8 /* Incremental Preset Register 3 */ |
@@ -96,7 +96,7 @@ | |||
96 | #define UCR1_RTSDEN (1<<5) /* RTS delta interrupt enable */ | 96 | #define UCR1_RTSDEN (1<<5) /* RTS delta interrupt enable */ |
97 | #define UCR1_SNDBRK (1<<4) /* Send break */ | 97 | #define UCR1_SNDBRK (1<<4) /* Send break */ |
98 | #define UCR1_TDMAEN (1<<3) /* Transmitter ready DMA enable */ | 98 | #define UCR1_TDMAEN (1<<3) /* Transmitter ready DMA enable */ |
99 | #if defined(CONFIG_ARCH_IMX) || defined(CONFIG_ARCH_MX1) | 99 | #ifdef CONFIG_ARCH_MX1 |
100 | #define UCR1_UARTCLKEN (1<<2) /* UART clock enabled */ | 100 | #define UCR1_UARTCLKEN (1<<2) /* UART clock enabled */ |
101 | #endif | 101 | #endif |
102 | #if defined CONFIG_ARCH_MX3 || defined CONFIG_ARCH_MX2 | 102 | #if defined CONFIG_ARCH_MX3 || defined CONFIG_ARCH_MX2 |
@@ -127,7 +127,7 @@ | |||
127 | #define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ | 127 | #define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ |
128 | #define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ | 128 | #define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ |
129 | #define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ | 129 | #define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ |
130 | #ifdef CONFIG_ARCH_IMX | 130 | #ifdef CONFIG_ARCH_MX1 |
131 | #define UCR3_REF25 (1<<3) /* Ref freq 25 MHz, only on mx1 */ | 131 | #define UCR3_REF25 (1<<3) /* Ref freq 25 MHz, only on mx1 */ |
132 | #define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz, only on mx1 */ | 132 | #define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz, only on mx1 */ |
133 | #endif | 133 | #endif |
@@ -180,13 +180,6 @@ | |||
180 | #define UTS_SOFTRST (1<<0) /* Software reset */ | 180 | #define UTS_SOFTRST (1<<0) /* Software reset */ |
181 | 181 | ||
182 | /* We've been assigned a range on the "Low-density serial ports" major */ | 182 | /* We've been assigned a range on the "Low-density serial ports" major */ |
183 | #ifdef CONFIG_ARCH_IMX | ||
184 | #define SERIAL_IMX_MAJOR 204 | ||
185 | #define MINOR_START 41 | ||
186 | #define DEV_NAME "ttySMX" | ||
187 | #define MAX_INTERNAL_IRQ IMX_IRQS | ||
188 | #endif | ||
189 | |||
190 | #ifdef CONFIG_ARCH_MXC | 183 | #ifdef CONFIG_ARCH_MXC |
191 | #define SERIAL_IMX_MAJOR 207 | 184 | #define SERIAL_IMX_MAJOR 207 |
192 | #define MINOR_START 16 | 185 | #define MINOR_START 16 |
@@ -1031,6 +1024,8 @@ imx_console_setup(struct console *co, char *options) | |||
1031 | if (co->index == -1 || co->index >= ARRAY_SIZE(imx_ports)) | 1024 | if (co->index == -1 || co->index >= ARRAY_SIZE(imx_ports)) |
1032 | co->index = 0; | 1025 | co->index = 0; |
1033 | sport = imx_ports[co->index]; | 1026 | sport = imx_ports[co->index]; |
1027 | if(sport == NULL) | ||
1028 | return -ENODEV; | ||
1034 | 1029 | ||
1035 | if (options) | 1030 | if (options) |
1036 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 1031 | uart_parse_options(options, &baud, &parity, &bits, &flow); |
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 7f72f8ceaa6f..b3feb6198d57 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -988,7 +988,7 @@ mpc52xx_console_setup(struct console *co, char *options) | |||
988 | pr_debug("mpc52xx_console_setup co=%p, co->index=%i, options=%s\n", | 988 | pr_debug("mpc52xx_console_setup co=%p, co->index=%i, options=%s\n", |
989 | co, co->index, options); | 989 | co, co->index, options); |
990 | 990 | ||
991 | if ((co->index < 0) || (co->index > MPC52xx_PSC_MAXNUM)) { | 991 | if ((co->index < 0) || (co->index >= MPC52xx_PSC_MAXNUM)) { |
992 | pr_debug("PSC%x out of range\n", co->index); | 992 | pr_debug("PSC%x out of range\n", co->index); |
993 | return -EINVAL; | 993 | return -EINVAL; |
994 | } | 994 | } |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 83a185d52961..8e7c17e4461f 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -118,7 +118,7 @@ config SPI_GPIO | |||
118 | 118 | ||
119 | config SPI_IMX | 119 | config SPI_IMX |
120 | tristate "Freescale iMX SPI controller" | 120 | tristate "Freescale iMX SPI controller" |
121 | depends on ARCH_IMX && EXPERIMENTAL | 121 | depends on ARCH_MX1 && EXPERIMENTAL |
122 | help | 122 | help |
123 | This enables using the Freescale iMX SPI controller in master | 123 | This enables using the Freescale iMX SPI controller in master |
124 | mode. | 124 | mode. |
@@ -171,6 +171,15 @@ config SPI_ORION | |||
171 | help | 171 | help |
172 | This enables using the SPI master controller on the Orion chips. | 172 | This enables using the SPI master controller on the Orion chips. |
173 | 173 | ||
174 | config SPI_PL022 | ||
175 | tristate "ARM AMBA PL022 SSP controller (EXPERIMENTAL)" | ||
176 | depends on ARM_AMBA && EXPERIMENTAL | ||
177 | default y if MACH_U300 | ||
178 | help | ||
179 | This selects the ARM(R) AMBA(R) PrimeCell PL022 SSP | ||
180 | controller. If you have an embedded system with an AMBA(R) | ||
181 | bus and a PL022 controller, say Y or M here. | ||
182 | |||
174 | config SPI_PXA2XX | 183 | config SPI_PXA2XX |
175 | tristate "PXA2xx SSP SPI master" | 184 | tristate "PXA2xx SSP SPI master" |
176 | depends on ARCH_PXA && EXPERIMENTAL | 185 | depends on ARCH_PXA && EXPERIMENTAL |
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 5d0451936d86..ecfadb180482 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
@@ -23,6 +23,7 @@ obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o | |||
23 | obj-$(CONFIG_SPI_OMAP_UWIRE) += omap_uwire.o | 23 | obj-$(CONFIG_SPI_OMAP_UWIRE) += omap_uwire.o |
24 | obj-$(CONFIG_SPI_OMAP24XX) += omap2_mcspi.o | 24 | obj-$(CONFIG_SPI_OMAP24XX) += omap2_mcspi.o |
25 | obj-$(CONFIG_SPI_ORION) += orion_spi.o | 25 | obj-$(CONFIG_SPI_ORION) += orion_spi.o |
26 | obj-$(CONFIG_SPI_PL022) += amba-pl022.o | ||
26 | obj-$(CONFIG_SPI_MPC52xx_PSC) += mpc52xx_psc_spi.o | 27 | obj-$(CONFIG_SPI_MPC52xx_PSC) += mpc52xx_psc_spi.o |
27 | obj-$(CONFIG_SPI_MPC83xx) += spi_mpc83xx.o | 28 | obj-$(CONFIG_SPI_MPC83xx) += spi_mpc83xx.o |
28 | obj-$(CONFIG_SPI_S3C24XX_GPIO) += spi_s3c24xx_gpio.o | 29 | obj-$(CONFIG_SPI_S3C24XX_GPIO) += spi_s3c24xx_gpio.o |
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c new file mode 100644 index 000000000000..da76797ce8b9 --- /dev/null +++ b/drivers/spi/amba-pl022.c | |||
@@ -0,0 +1,1866 @@ | |||
1 | /* | ||
2 | * drivers/spi/amba-pl022.c | ||
3 | * | ||
4 | * A driver for the ARM PL022 PrimeCell SSP/SPI bus master. | ||
5 | * | ||
6 | * Copyright (C) 2008-2009 ST-Ericsson AB | ||
7 | * Copyright (C) 2006 STMicroelectronics Pvt. Ltd. | ||
8 | * | ||
9 | * Author: Linus Walleij <linus.walleij@stericsson.com> | ||
10 | * | ||
11 | * Initial version inspired by: | ||
12 | * linux-2.6.17-rc3-mm1/drivers/spi/pxa2xx_spi.c | ||
13 | * Initial adoption to PL022 by: | ||
14 | * Sachin Verma <sachin.verma@st.com> | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of the GNU General Public License as published by | ||
18 | * the Free Software Foundation; either version 2 of the License, or | ||
19 | * (at your option) any later version. | ||
20 | * | ||
21 | * This program is distributed in the hope that it will be useful, | ||
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
24 | * GNU General Public License for more details. | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * TODO: | ||
29 | * - add timeout on polled transfers | ||
30 | * - add generic DMA framework support | ||
31 | */ | ||
32 | |||
33 | #include <linux/init.h> | ||
34 | #include <linux/module.h> | ||
35 | #include <linux/device.h> | ||
36 | #include <linux/ioport.h> | ||
37 | #include <linux/errno.h> | ||
38 | #include <linux/interrupt.h> | ||
39 | #include <linux/spi/spi.h> | ||
40 | #include <linux/workqueue.h> | ||
41 | #include <linux/errno.h> | ||
42 | #include <linux/delay.h> | ||
43 | #include <linux/clk.h> | ||
44 | #include <linux/err.h> | ||
45 | #include <linux/amba/bus.h> | ||
46 | #include <linux/amba/pl022.h> | ||
47 | #include <linux/io.h> | ||
48 | #include <linux/delay.h> | ||
49 | |||
50 | /* | ||
51 | * This macro is used to define some register default values. | ||
52 | * reg is masked with mask, the OR:ed with an (again masked) | ||
53 | * val shifted sb steps to the left. | ||
54 | */ | ||
55 | #define SSP_WRITE_BITS(reg, val, mask, sb) \ | ||
56 | ((reg) = (((reg) & ~(mask)) | (((val)<<(sb)) & (mask)))) | ||
57 | |||
58 | /* | ||
59 | * This macro is also used to define some default values. | ||
60 | * It will just shift val by sb steps to the left and mask | ||
61 | * the result with mask. | ||
62 | */ | ||
63 | #define GEN_MASK_BITS(val, mask, sb) \ | ||
64 | (((val)<<(sb)) & (mask)) | ||
65 | |||
66 | #define DRIVE_TX 0 | ||
67 | #define DO_NOT_DRIVE_TX 1 | ||
68 | |||
69 | #define DO_NOT_QUEUE_DMA 0 | ||
70 | #define QUEUE_DMA 1 | ||
71 | |||
72 | #define RX_TRANSFER 1 | ||
73 | #define TX_TRANSFER 2 | ||
74 | |||
75 | /* | ||
76 | * Macros to access SSP Registers with their offsets | ||
77 | */ | ||
78 | #define SSP_CR0(r) (r + 0x000) | ||
79 | #define SSP_CR1(r) (r + 0x004) | ||
80 | #define SSP_DR(r) (r + 0x008) | ||
81 | #define SSP_SR(r) (r + 0x00C) | ||
82 | #define SSP_CPSR(r) (r + 0x010) | ||
83 | #define SSP_IMSC(r) (r + 0x014) | ||
84 | #define SSP_RIS(r) (r + 0x018) | ||
85 | #define SSP_MIS(r) (r + 0x01C) | ||
86 | #define SSP_ICR(r) (r + 0x020) | ||
87 | #define SSP_DMACR(r) (r + 0x024) | ||
88 | #define SSP_ITCR(r) (r + 0x080) | ||
89 | #define SSP_ITIP(r) (r + 0x084) | ||
90 | #define SSP_ITOP(r) (r + 0x088) | ||
91 | #define SSP_TDR(r) (r + 0x08C) | ||
92 | |||
93 | #define SSP_PID0(r) (r + 0xFE0) | ||
94 | #define SSP_PID1(r) (r + 0xFE4) | ||
95 | #define SSP_PID2(r) (r + 0xFE8) | ||
96 | #define SSP_PID3(r) (r + 0xFEC) | ||
97 | |||
98 | #define SSP_CID0(r) (r + 0xFF0) | ||
99 | #define SSP_CID1(r) (r + 0xFF4) | ||
100 | #define SSP_CID2(r) (r + 0xFF8) | ||
101 | #define SSP_CID3(r) (r + 0xFFC) | ||
102 | |||
103 | /* | ||
104 | * SSP Control Register 0 - SSP_CR0 | ||
105 | */ | ||
106 | #define SSP_CR0_MASK_DSS (0x1FUL << 0) | ||
107 | #define SSP_CR0_MASK_HALFDUP (0x1UL << 5) | ||
108 | #define SSP_CR0_MASK_SPO (0x1UL << 6) | ||
109 | #define SSP_CR0_MASK_SPH (0x1UL << 7) | ||
110 | #define SSP_CR0_MASK_SCR (0xFFUL << 8) | ||
111 | #define SSP_CR0_MASK_CSS (0x1FUL << 16) | ||
112 | #define SSP_CR0_MASK_FRF (0x3UL << 21) | ||
113 | |||
114 | /* | ||
115 | * SSP Control Register 0 - SSP_CR1 | ||
116 | */ | ||
117 | #define SSP_CR1_MASK_LBM (0x1UL << 0) | ||
118 | #define SSP_CR1_MASK_SSE (0x1UL << 1) | ||
119 | #define SSP_CR1_MASK_MS (0x1UL << 2) | ||
120 | #define SSP_CR1_MASK_SOD (0x1UL << 3) | ||
121 | #define SSP_CR1_MASK_RENDN (0x1UL << 4) | ||
122 | #define SSP_CR1_MASK_TENDN (0x1UL << 5) | ||
123 | #define SSP_CR1_MASK_MWAIT (0x1UL << 6) | ||
124 | #define SSP_CR1_MASK_RXIFLSEL (0x7UL << 7) | ||
125 | #define SSP_CR1_MASK_TXIFLSEL (0x7UL << 10) | ||
126 | |||
127 | /* | ||
128 | * SSP Data Register - SSP_DR | ||
129 | */ | ||
130 | #define SSP_DR_MASK_DATA 0xFFFFFFFF | ||
131 | |||
132 | /* | ||
133 | * SSP Status Register - SSP_SR | ||
134 | */ | ||
135 | #define SSP_SR_MASK_TFE (0x1UL << 0) /* Transmit FIFO empty */ | ||
136 | #define SSP_SR_MASK_TNF (0x1UL << 1) /* Transmit FIFO not full */ | ||
137 | #define SSP_SR_MASK_RNE (0x1UL << 2) /* Receive FIFO not empty */ | ||
138 | #define SSP_SR_MASK_RFF (0x1UL << 3) /* Receive FIFO full */ | ||
139 | #define SSP_SR_MASK_BSY (0x1UL << 4) /* Busy Flag */ | ||
140 | |||
141 | /* | ||
142 | * SSP Clock Prescale Register - SSP_CPSR | ||
143 | */ | ||
144 | #define SSP_CPSR_MASK_CPSDVSR (0xFFUL << 0) | ||
145 | |||
146 | /* | ||
147 | * SSP Interrupt Mask Set/Clear Register - SSP_IMSC | ||
148 | */ | ||
149 | #define SSP_IMSC_MASK_RORIM (0x1UL << 0) /* Receive Overrun Interrupt mask */ | ||
150 | #define SSP_IMSC_MASK_RTIM (0x1UL << 1) /* Receive timeout Interrupt mask */ | ||
151 | #define SSP_IMSC_MASK_RXIM (0x1UL << 2) /* Receive FIFO Interrupt mask */ | ||
152 | #define SSP_IMSC_MASK_TXIM (0x1UL << 3) /* Transmit FIFO Interrupt mask */ | ||
153 | |||
154 | /* | ||
155 | * SSP Raw Interrupt Status Register - SSP_RIS | ||
156 | */ | ||
157 | /* Receive Overrun Raw Interrupt status */ | ||
158 | #define SSP_RIS_MASK_RORRIS (0x1UL << 0) | ||
159 | /* Receive Timeout Raw Interrupt status */ | ||
160 | #define SSP_RIS_MASK_RTRIS (0x1UL << 1) | ||
161 | /* Receive FIFO Raw Interrupt status */ | ||
162 | #define SSP_RIS_MASK_RXRIS (0x1UL << 2) | ||
163 | /* Transmit FIFO Raw Interrupt status */ | ||
164 | #define SSP_RIS_MASK_TXRIS (0x1UL << 3) | ||
165 | |||
166 | /* | ||
167 | * SSP Masked Interrupt Status Register - SSP_MIS | ||
168 | */ | ||
169 | /* Receive Overrun Masked Interrupt status */ | ||
170 | #define SSP_MIS_MASK_RORMIS (0x1UL << 0) | ||
171 | /* Receive Timeout Masked Interrupt status */ | ||
172 | #define SSP_MIS_MASK_RTMIS (0x1UL << 1) | ||
173 | /* Receive FIFO Masked Interrupt status */ | ||
174 | #define SSP_MIS_MASK_RXMIS (0x1UL << 2) | ||
175 | /* Transmit FIFO Masked Interrupt status */ | ||
176 | #define SSP_MIS_MASK_TXMIS (0x1UL << 3) | ||
177 | |||
178 | /* | ||
179 | * SSP Interrupt Clear Register - SSP_ICR | ||
180 | */ | ||
181 | /* Receive Overrun Raw Clear Interrupt bit */ | ||
182 | #define SSP_ICR_MASK_RORIC (0x1UL << 0) | ||
183 | /* Receive Timeout Clear Interrupt bit */ | ||
184 | #define SSP_ICR_MASK_RTIC (0x1UL << 1) | ||
185 | |||
186 | /* | ||
187 | * SSP DMA Control Register - SSP_DMACR | ||
188 | */ | ||
189 | /* Receive DMA Enable bit */ | ||
190 | #define SSP_DMACR_MASK_RXDMAE (0x1UL << 0) | ||
191 | /* Transmit DMA Enable bit */ | ||
192 | #define SSP_DMACR_MASK_TXDMAE (0x1UL << 1) | ||
193 | |||
194 | /* | ||
195 | * SSP Integration Test control Register - SSP_ITCR | ||
196 | */ | ||
197 | #define SSP_ITCR_MASK_ITEN (0x1UL << 0) | ||
198 | #define SSP_ITCR_MASK_TESTFIFO (0x1UL << 1) | ||
199 | |||
200 | /* | ||
201 | * SSP Integration Test Input Register - SSP_ITIP | ||
202 | */ | ||
203 | #define ITIP_MASK_SSPRXD (0x1UL << 0) | ||
204 | #define ITIP_MASK_SSPFSSIN (0x1UL << 1) | ||
205 | #define ITIP_MASK_SSPCLKIN (0x1UL << 2) | ||
206 | #define ITIP_MASK_RXDMAC (0x1UL << 3) | ||
207 | #define ITIP_MASK_TXDMAC (0x1UL << 4) | ||
208 | #define ITIP_MASK_SSPTXDIN (0x1UL << 5) | ||
209 | |||
210 | /* | ||
211 | * SSP Integration Test output Register - SSP_ITOP | ||
212 | */ | ||
213 | #define ITOP_MASK_SSPTXD (0x1UL << 0) | ||
214 | #define ITOP_MASK_SSPFSSOUT (0x1UL << 1) | ||
215 | #define ITOP_MASK_SSPCLKOUT (0x1UL << 2) | ||
216 | #define ITOP_MASK_SSPOEn (0x1UL << 3) | ||
217 | #define ITOP_MASK_SSPCTLOEn (0x1UL << 4) | ||
218 | #define ITOP_MASK_RORINTR (0x1UL << 5) | ||
219 | #define ITOP_MASK_RTINTR (0x1UL << 6) | ||
220 | #define ITOP_MASK_RXINTR (0x1UL << 7) | ||
221 | #define ITOP_MASK_TXINTR (0x1UL << 8) | ||
222 | #define ITOP_MASK_INTR (0x1UL << 9) | ||
223 | #define ITOP_MASK_RXDMABREQ (0x1UL << 10) | ||
224 | #define ITOP_MASK_RXDMASREQ (0x1UL << 11) | ||
225 | #define ITOP_MASK_TXDMABREQ (0x1UL << 12) | ||
226 | #define ITOP_MASK_TXDMASREQ (0x1UL << 13) | ||
227 | |||
228 | /* | ||
229 | * SSP Test Data Register - SSP_TDR | ||
230 | */ | ||
231 | #define TDR_MASK_TESTDATA (0xFFFFFFFF) | ||
232 | |||
233 | /* | ||
234 | * Message State | ||
235 | * we use the spi_message.state (void *) pointer to | ||
236 | * hold a single state value, that's why all this | ||
237 | * (void *) casting is done here. | ||
238 | */ | ||
239 | #define STATE_START ((void *) 0) | ||
240 | #define STATE_RUNNING ((void *) 1) | ||
241 | #define STATE_DONE ((void *) 2) | ||
242 | #define STATE_ERROR ((void *) -1) | ||
243 | |||
244 | /* | ||
245 | * Queue State | ||
246 | */ | ||
247 | #define QUEUE_RUNNING (0) | ||
248 | #define QUEUE_STOPPED (1) | ||
249 | /* | ||
250 | * SSP State - Whether Enabled or Disabled | ||
251 | */ | ||
252 | #define SSP_DISABLED (0) | ||
253 | #define SSP_ENABLED (1) | ||
254 | |||
255 | /* | ||
256 | * SSP DMA State - Whether DMA Enabled or Disabled | ||
257 | */ | ||
258 | #define SSP_DMA_DISABLED (0) | ||
259 | #define SSP_DMA_ENABLED (1) | ||
260 | |||
261 | /* | ||
262 | * SSP Clock Defaults | ||
263 | */ | ||
264 | #define NMDK_SSP_DEFAULT_CLKRATE 0x2 | ||
265 | #define NMDK_SSP_DEFAULT_PRESCALE 0x40 | ||
266 | |||
267 | /* | ||
268 | * SSP Clock Parameter ranges | ||
269 | */ | ||
270 | #define CPSDVR_MIN 0x02 | ||
271 | #define CPSDVR_MAX 0xFE | ||
272 | #define SCR_MIN 0x00 | ||
273 | #define SCR_MAX 0xFF | ||
274 | |||
275 | /* | ||
276 | * SSP Interrupt related Macros | ||
277 | */ | ||
278 | #define DEFAULT_SSP_REG_IMSC 0x0UL | ||
279 | #define DISABLE_ALL_INTERRUPTS DEFAULT_SSP_REG_IMSC | ||
280 | #define ENABLE_ALL_INTERRUPTS (~DEFAULT_SSP_REG_IMSC) | ||
281 | |||
282 | #define CLEAR_ALL_INTERRUPTS 0x3 | ||
283 | |||
284 | |||
285 | /* | ||
286 | * The type of reading going on on this chip | ||
287 | */ | ||
288 | enum ssp_reading { | ||
289 | READING_NULL, | ||
290 | READING_U8, | ||
291 | READING_U16, | ||
292 | READING_U32 | ||
293 | }; | ||
294 | |||
295 | /** | ||
296 | * The type of writing going on on this chip | ||
297 | */ | ||
298 | enum ssp_writing { | ||
299 | WRITING_NULL, | ||
300 | WRITING_U8, | ||
301 | WRITING_U16, | ||
302 | WRITING_U32 | ||
303 | }; | ||
304 | |||
305 | /** | ||
306 | * struct vendor_data - vendor-specific config parameters | ||
307 | * for PL022 derivates | ||
308 | * @fifodepth: depth of FIFOs (both) | ||
309 | * @max_bpw: maximum number of bits per word | ||
310 | * @unidir: supports unidirection transfers | ||
311 | */ | ||
312 | struct vendor_data { | ||
313 | int fifodepth; | ||
314 | int max_bpw; | ||
315 | bool unidir; | ||
316 | }; | ||
317 | |||
318 | /** | ||
319 | * struct pl022 - This is the private SSP driver data structure | ||
320 | * @adev: AMBA device model hookup | ||
321 | * @phybase: The physical memory where the SSP device resides | ||
322 | * @virtbase: The virtual memory where the SSP is mapped | ||
323 | * @master: SPI framework hookup | ||
324 | * @master_info: controller-specific data from machine setup | ||
325 | * @regs: SSP controller register's virtual address | ||
326 | * @pump_messages: Work struct for scheduling work to the workqueue | ||
327 | * @lock: spinlock to syncronise access to driver data | ||
328 | * @workqueue: a workqueue on which any spi_message request is queued | ||
329 | * @busy: workqueue is busy | ||
330 | * @run: workqueue is running | ||
331 | * @pump_transfers: Tasklet used in Interrupt Transfer mode | ||
332 | * @cur_msg: Pointer to current spi_message being processed | ||
333 | * @cur_transfer: Pointer to current spi_transfer | ||
334 | * @cur_chip: pointer to current clients chip(assigned from controller_state) | ||
335 | * @tx: current position in TX buffer to be read | ||
336 | * @tx_end: end position in TX buffer to be read | ||
337 | * @rx: current position in RX buffer to be written | ||
338 | * @rx_end: end position in RX buffer to be written | ||
339 | * @readingtype: the type of read currently going on | ||
340 | * @writingtype: the type or write currently going on | ||
341 | */ | ||
342 | struct pl022 { | ||
343 | struct amba_device *adev; | ||
344 | struct vendor_data *vendor; | ||
345 | resource_size_t phybase; | ||
346 | void __iomem *virtbase; | ||
347 | struct clk *clk; | ||
348 | struct spi_master *master; | ||
349 | struct pl022_ssp_controller *master_info; | ||
350 | /* Driver message queue */ | ||
351 | struct workqueue_struct *workqueue; | ||
352 | struct work_struct pump_messages; | ||
353 | spinlock_t queue_lock; | ||
354 | struct list_head queue; | ||
355 | int busy; | ||
356 | int run; | ||
357 | /* Message transfer pump */ | ||
358 | struct tasklet_struct pump_transfers; | ||
359 | struct spi_message *cur_msg; | ||
360 | struct spi_transfer *cur_transfer; | ||
361 | struct chip_data *cur_chip; | ||
362 | void *tx; | ||
363 | void *tx_end; | ||
364 | void *rx; | ||
365 | void *rx_end; | ||
366 | enum ssp_reading read; | ||
367 | enum ssp_writing write; | ||
368 | }; | ||
369 | |||
370 | /** | ||
371 | * struct chip_data - To maintain runtime state of SSP for each client chip | ||
372 | * @cr0: Value of control register CR0 of SSP | ||
373 | * @cr1: Value of control register CR1 of SSP | ||
374 | * @dmacr: Value of DMA control Register of SSP | ||
375 | * @cpsr: Value of Clock prescale register | ||
376 | * @n_bytes: how many bytes(power of 2) reqd for a given data width of client | ||
377 | * @enable_dma: Whether to enable DMA or not | ||
378 | * @write: function ptr to be used to write when doing xfer for this chip | ||
379 | * @read: function ptr to be used to read when doing xfer for this chip | ||
380 | * @cs_control: chip select callback provided by chip | ||
381 | * @xfer_type: polling/interrupt/DMA | ||
382 | * | ||
383 | * Runtime state of the SSP controller, maintained per chip, | ||
384 | * This would be set according to the current message that would be served | ||
385 | */ | ||
386 | struct chip_data { | ||
387 | u16 cr0; | ||
388 | u16 cr1; | ||
389 | u16 dmacr; | ||
390 | u16 cpsr; | ||
391 | u8 n_bytes; | ||
392 | u8 enable_dma:1; | ||
393 | enum ssp_reading read; | ||
394 | enum ssp_writing write; | ||
395 | void (*cs_control) (u32 command); | ||
396 | int xfer_type; | ||
397 | }; | ||
398 | |||
399 | /** | ||
400 | * null_cs_control - Dummy chip select function | ||
401 | * @command: select/delect the chip | ||
402 | * | ||
403 | * If no chip select function is provided by client this is used as dummy | ||
404 | * chip select | ||
405 | */ | ||
406 | static void null_cs_control(u32 command) | ||
407 | { | ||
408 | pr_debug("pl022: dummy chip select control, CS=0x%x\n", command); | ||
409 | } | ||
410 | |||
411 | /** | ||
412 | * giveback - current spi_message is over, schedule next message and call | ||
413 | * callback of this message. Assumes that caller already | ||
414 | * set message->status; dma and pio irqs are blocked | ||
415 | * @pl022: SSP driver private data structure | ||
416 | */ | ||
417 | static void giveback(struct pl022 *pl022) | ||
418 | { | ||
419 | struct spi_transfer *last_transfer; | ||
420 | unsigned long flags; | ||
421 | struct spi_message *msg; | ||
422 | void (*curr_cs_control) (u32 command); | ||
423 | |||
424 | /* | ||
425 | * This local reference to the chip select function | ||
426 | * is needed because we set curr_chip to NULL | ||
427 | * as a step toward termininating the message. | ||
428 | */ | ||
429 | curr_cs_control = pl022->cur_chip->cs_control; | ||
430 | spin_lock_irqsave(&pl022->queue_lock, flags); | ||
431 | msg = pl022->cur_msg; | ||
432 | pl022->cur_msg = NULL; | ||
433 | pl022->cur_transfer = NULL; | ||
434 | pl022->cur_chip = NULL; | ||
435 | queue_work(pl022->workqueue, &pl022->pump_messages); | ||
436 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
437 | |||
438 | last_transfer = list_entry(msg->transfers.prev, | ||
439 | struct spi_transfer, | ||
440 | transfer_list); | ||
441 | |||
442 | /* Delay if requested before any change in chip select */ | ||
443 | if (last_transfer->delay_usecs) | ||
444 | /* | ||
445 | * FIXME: This runs in interrupt context. | ||
446 | * Is this really smart? | ||
447 | */ | ||
448 | udelay(last_transfer->delay_usecs); | ||
449 | |||
450 | /* | ||
451 | * Drop chip select UNLESS cs_change is true or we are returning | ||
452 | * a message with an error, or next message is for another chip | ||
453 | */ | ||
454 | if (!last_transfer->cs_change) | ||
455 | curr_cs_control(SSP_CHIP_DESELECT); | ||
456 | else { | ||
457 | struct spi_message *next_msg; | ||
458 | |||
459 | /* Holding of cs was hinted, but we need to make sure | ||
460 | * the next message is for the same chip. Don't waste | ||
461 | * time with the following tests unless this was hinted. | ||
462 | * | ||
463 | * We cannot postpone this until pump_messages, because | ||
464 | * after calling msg->complete (below) the driver that | ||
465 | * sent the current message could be unloaded, which | ||
466 | * could invalidate the cs_control() callback... | ||
467 | */ | ||
468 | |||
469 | /* get a pointer to the next message, if any */ | ||
470 | spin_lock_irqsave(&pl022->queue_lock, flags); | ||
471 | if (list_empty(&pl022->queue)) | ||
472 | next_msg = NULL; | ||
473 | else | ||
474 | next_msg = list_entry(pl022->queue.next, | ||
475 | struct spi_message, queue); | ||
476 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
477 | |||
478 | /* see if the next and current messages point | ||
479 | * to the same chip | ||
480 | */ | ||
481 | if (next_msg && next_msg->spi != msg->spi) | ||
482 | next_msg = NULL; | ||
483 | if (!next_msg || msg->state == STATE_ERROR) | ||
484 | curr_cs_control(SSP_CHIP_DESELECT); | ||
485 | } | ||
486 | msg->state = NULL; | ||
487 | if (msg->complete) | ||
488 | msg->complete(msg->context); | ||
489 | /* This message is completed, so let's turn off the clock! */ | ||
490 | clk_disable(pl022->clk); | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * flush - flush the FIFO to reach a clean state | ||
495 | * @pl022: SSP driver private data structure | ||
496 | */ | ||
497 | static int flush(struct pl022 *pl022) | ||
498 | { | ||
499 | unsigned long limit = loops_per_jiffy << 1; | ||
500 | |||
501 | dev_dbg(&pl022->adev->dev, "flush\n"); | ||
502 | do { | ||
503 | while (readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_RNE) | ||
504 | readw(SSP_DR(pl022->virtbase)); | ||
505 | } while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_BSY) && limit--); | ||
506 | return limit; | ||
507 | } | ||
508 | |||
509 | /** | ||
510 | * restore_state - Load configuration of current chip | ||
511 | * @pl022: SSP driver private data structure | ||
512 | */ | ||
513 | static void restore_state(struct pl022 *pl022) | ||
514 | { | ||
515 | struct chip_data *chip = pl022->cur_chip; | ||
516 | |||
517 | writew(chip->cr0, SSP_CR0(pl022->virtbase)); | ||
518 | writew(chip->cr1, SSP_CR1(pl022->virtbase)); | ||
519 | writew(chip->dmacr, SSP_DMACR(pl022->virtbase)); | ||
520 | writew(chip->cpsr, SSP_CPSR(pl022->virtbase)); | ||
521 | writew(DISABLE_ALL_INTERRUPTS, SSP_IMSC(pl022->virtbase)); | ||
522 | writew(CLEAR_ALL_INTERRUPTS, SSP_ICR(pl022->virtbase)); | ||
523 | } | ||
524 | |||
525 | /** | ||
526 | * load_ssp_default_config - Load default configuration for SSP | ||
527 | * @pl022: SSP driver private data structure | ||
528 | */ | ||
529 | |||
530 | /* | ||
531 | * Default SSP Register Values | ||
532 | */ | ||
533 | #define DEFAULT_SSP_REG_CR0 ( \ | ||
534 | GEN_MASK_BITS(SSP_DATA_BITS_12, SSP_CR0_MASK_DSS, 0) | \ | ||
535 | GEN_MASK_BITS(SSP_MICROWIRE_CHANNEL_FULL_DUPLEX, SSP_CR0_MASK_HALFDUP, 5) | \ | ||
536 | GEN_MASK_BITS(SSP_CLK_POL_IDLE_LOW, SSP_CR0_MASK_SPO, 6) | \ | ||
537 | GEN_MASK_BITS(SSP_CLK_FALLING_EDGE, SSP_CR0_MASK_SPH, 7) | \ | ||
538 | GEN_MASK_BITS(NMDK_SSP_DEFAULT_CLKRATE, SSP_CR0_MASK_SCR, 8) | \ | ||
539 | GEN_MASK_BITS(SSP_BITS_8, SSP_CR0_MASK_CSS, 16) | \ | ||
540 | GEN_MASK_BITS(SSP_INTERFACE_MOTOROLA_SPI, SSP_CR0_MASK_FRF, 21) \ | ||
541 | ) | ||
542 | |||
543 | #define DEFAULT_SSP_REG_CR1 ( \ | ||
544 | GEN_MASK_BITS(LOOPBACK_DISABLED, SSP_CR1_MASK_LBM, 0) | \ | ||
545 | GEN_MASK_BITS(SSP_DISABLED, SSP_CR1_MASK_SSE, 1) | \ | ||
546 | GEN_MASK_BITS(SSP_MASTER, SSP_CR1_MASK_MS, 2) | \ | ||
547 | GEN_MASK_BITS(DO_NOT_DRIVE_TX, SSP_CR1_MASK_SOD, 3) | \ | ||
548 | GEN_MASK_BITS(SSP_RX_MSB, SSP_CR1_MASK_RENDN, 4) | \ | ||
549 | GEN_MASK_BITS(SSP_TX_MSB, SSP_CR1_MASK_TENDN, 5) | \ | ||
550 | GEN_MASK_BITS(SSP_MWIRE_WAIT_ZERO, SSP_CR1_MASK_MWAIT, 6) |\ | ||
551 | GEN_MASK_BITS(SSP_RX_1_OR_MORE_ELEM, SSP_CR1_MASK_RXIFLSEL, 7) | \ | ||
552 | GEN_MASK_BITS(SSP_TX_1_OR_MORE_EMPTY_LOC, SSP_CR1_MASK_TXIFLSEL, 10) \ | ||
553 | ) | ||
554 | |||
555 | #define DEFAULT_SSP_REG_CPSR ( \ | ||
556 | GEN_MASK_BITS(NMDK_SSP_DEFAULT_PRESCALE, SSP_CPSR_MASK_CPSDVSR, 0) \ | ||
557 | ) | ||
558 | |||
559 | #define DEFAULT_SSP_REG_DMACR (\ | ||
560 | GEN_MASK_BITS(SSP_DMA_DISABLED, SSP_DMACR_MASK_RXDMAE, 0) | \ | ||
561 | GEN_MASK_BITS(SSP_DMA_DISABLED, SSP_DMACR_MASK_TXDMAE, 1) \ | ||
562 | ) | ||
563 | |||
564 | |||
565 | static void load_ssp_default_config(struct pl022 *pl022) | ||
566 | { | ||
567 | writew(DEFAULT_SSP_REG_CR0, SSP_CR0(pl022->virtbase)); | ||
568 | writew(DEFAULT_SSP_REG_CR1, SSP_CR1(pl022->virtbase)); | ||
569 | writew(DEFAULT_SSP_REG_DMACR, SSP_DMACR(pl022->virtbase)); | ||
570 | writew(DEFAULT_SSP_REG_CPSR, SSP_CPSR(pl022->virtbase)); | ||
571 | writew(DISABLE_ALL_INTERRUPTS, SSP_IMSC(pl022->virtbase)); | ||
572 | writew(CLEAR_ALL_INTERRUPTS, SSP_ICR(pl022->virtbase)); | ||
573 | } | ||
574 | |||
575 | /** | ||
576 | * This will write to TX and read from RX according to the parameters | ||
577 | * set in pl022. | ||
578 | */ | ||
579 | static void readwriter(struct pl022 *pl022) | ||
580 | { | ||
581 | |||
582 | /* | ||
583 | * The FIFO depth is different inbetween primecell variants. | ||
584 | * I believe filling in too much in the FIFO might cause | ||
585 | * errons in 8bit wide transfers on ARM variants (just 8 words | ||
586 | * FIFO, means only 8x8 = 64 bits in FIFO) at least. | ||
587 | * | ||
588 | * FIXME: currently we have no logic to account for this. | ||
589 | * perhaps there is even something broken in HW regarding | ||
590 | * 8bit transfers (it doesn't fail on 16bit) so this needs | ||
591 | * more investigation... | ||
592 | */ | ||
593 | dev_dbg(&pl022->adev->dev, | ||
594 | "%s, rx: %p, rxend: %p, tx: %p, txend: %p\n", | ||
595 | __func__, pl022->rx, pl022->rx_end, pl022->tx, pl022->tx_end); | ||
596 | |||
597 | /* Read as much as you can */ | ||
598 | while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_RNE) | ||
599 | && (pl022->rx < pl022->rx_end)) { | ||
600 | switch (pl022->read) { | ||
601 | case READING_NULL: | ||
602 | readw(SSP_DR(pl022->virtbase)); | ||
603 | break; | ||
604 | case READING_U8: | ||
605 | *(u8 *) (pl022->rx) = | ||
606 | readw(SSP_DR(pl022->virtbase)) & 0xFFU; | ||
607 | break; | ||
608 | case READING_U16: | ||
609 | *(u16 *) (pl022->rx) = | ||
610 | (u16) readw(SSP_DR(pl022->virtbase)); | ||
611 | break; | ||
612 | case READING_U32: | ||
613 | *(u32 *) (pl022->rx) = | ||
614 | readl(SSP_DR(pl022->virtbase)); | ||
615 | break; | ||
616 | } | ||
617 | pl022->rx += (pl022->cur_chip->n_bytes); | ||
618 | } | ||
619 | /* | ||
620 | * Write as much as you can, while keeping an eye on the RX FIFO! | ||
621 | */ | ||
622 | while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_TNF) | ||
623 | && (pl022->tx < pl022->tx_end)) { | ||
624 | switch (pl022->write) { | ||
625 | case WRITING_NULL: | ||
626 | writew(0x0, SSP_DR(pl022->virtbase)); | ||
627 | break; | ||
628 | case WRITING_U8: | ||
629 | writew(*(u8 *) (pl022->tx), SSP_DR(pl022->virtbase)); | ||
630 | break; | ||
631 | case WRITING_U16: | ||
632 | writew((*(u16 *) (pl022->tx)), SSP_DR(pl022->virtbase)); | ||
633 | break; | ||
634 | case WRITING_U32: | ||
635 | writel(*(u32 *) (pl022->tx), SSP_DR(pl022->virtbase)); | ||
636 | break; | ||
637 | } | ||
638 | pl022->tx += (pl022->cur_chip->n_bytes); | ||
639 | /* | ||
640 | * This inner reader takes care of things appearing in the RX | ||
641 | * FIFO as we're transmitting. This will happen a lot since the | ||
642 | * clock starts running when you put things into the TX FIFO, | ||
643 | * and then things are continously clocked into the RX FIFO. | ||
644 | */ | ||
645 | while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_RNE) | ||
646 | && (pl022->rx < pl022->rx_end)) { | ||
647 | switch (pl022->read) { | ||
648 | case READING_NULL: | ||
649 | readw(SSP_DR(pl022->virtbase)); | ||
650 | break; | ||
651 | case READING_U8: | ||
652 | *(u8 *) (pl022->rx) = | ||
653 | readw(SSP_DR(pl022->virtbase)) & 0xFFU; | ||
654 | break; | ||
655 | case READING_U16: | ||
656 | *(u16 *) (pl022->rx) = | ||
657 | (u16) readw(SSP_DR(pl022->virtbase)); | ||
658 | break; | ||
659 | case READING_U32: | ||
660 | *(u32 *) (pl022->rx) = | ||
661 | readl(SSP_DR(pl022->virtbase)); | ||
662 | break; | ||
663 | } | ||
664 | pl022->rx += (pl022->cur_chip->n_bytes); | ||
665 | } | ||
666 | } | ||
667 | /* | ||
668 | * When we exit here the TX FIFO should be full and the RX FIFO | ||
669 | * should be empty | ||
670 | */ | ||
671 | } | ||
672 | |||
673 | |||
674 | /** | ||
675 | * next_transfer - Move to the Next transfer in the current spi message | ||
676 | * @pl022: SSP driver private data structure | ||
677 | * | ||
678 | * This function moves though the linked list of spi transfers in the | ||
679 | * current spi message and returns with the state of current spi | ||
680 | * message i.e whether its last transfer is done(STATE_DONE) or | ||
681 | * Next transfer is ready(STATE_RUNNING) | ||
682 | */ | ||
683 | static void *next_transfer(struct pl022 *pl022) | ||
684 | { | ||
685 | struct spi_message *msg = pl022->cur_msg; | ||
686 | struct spi_transfer *trans = pl022->cur_transfer; | ||
687 | |||
688 | /* Move to next transfer */ | ||
689 | if (trans->transfer_list.next != &msg->transfers) { | ||
690 | pl022->cur_transfer = | ||
691 | list_entry(trans->transfer_list.next, | ||
692 | struct spi_transfer, transfer_list); | ||
693 | return STATE_RUNNING; | ||
694 | } | ||
695 | return STATE_DONE; | ||
696 | } | ||
697 | /** | ||
698 | * pl022_interrupt_handler - Interrupt handler for SSP controller | ||
699 | * | ||
700 | * This function handles interrupts generated for an interrupt based transfer. | ||
701 | * If a receive overrun (ROR) interrupt is there then we disable SSP, flag the | ||
702 | * current message's state as STATE_ERROR and schedule the tasklet | ||
703 | * pump_transfers which will do the postprocessing of the current message by | ||
704 | * calling giveback(). Otherwise it reads data from RX FIFO till there is no | ||
705 | * more data, and writes data in TX FIFO till it is not full. If we complete | ||
706 | * the transfer we move to the next transfer and schedule the tasklet. | ||
707 | */ | ||
708 | static irqreturn_t pl022_interrupt_handler(int irq, void *dev_id) | ||
709 | { | ||
710 | struct pl022 *pl022 = dev_id; | ||
711 | struct spi_message *msg = pl022->cur_msg; | ||
712 | u16 irq_status = 0; | ||
713 | u16 flag = 0; | ||
714 | |||
715 | if (unlikely(!msg)) { | ||
716 | dev_err(&pl022->adev->dev, | ||
717 | "bad message state in interrupt handler"); | ||
718 | /* Never fail */ | ||
719 | return IRQ_HANDLED; | ||
720 | } | ||
721 | |||
722 | /* Read the Interrupt Status Register */ | ||
723 | irq_status = readw(SSP_MIS(pl022->virtbase)); | ||
724 | |||
725 | if (unlikely(!irq_status)) | ||
726 | return IRQ_NONE; | ||
727 | |||
728 | /* This handles the error code interrupts */ | ||
729 | if (unlikely(irq_status & SSP_MIS_MASK_RORMIS)) { | ||
730 | /* | ||
731 | * Overrun interrupt - bail out since our Data has been | ||
732 | * corrupted | ||
733 | */ | ||
734 | dev_err(&pl022->adev->dev, | ||
735 | "FIFO overrun\n"); | ||
736 | if (readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_RFF) | ||
737 | dev_err(&pl022->adev->dev, | ||
738 | "RXFIFO is full\n"); | ||
739 | if (readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_TNF) | ||
740 | dev_err(&pl022->adev->dev, | ||
741 | "TXFIFO is full\n"); | ||
742 | |||
743 | /* | ||
744 | * Disable and clear interrupts, disable SSP, | ||
745 | * mark message with bad status so it can be | ||
746 | * retried. | ||
747 | */ | ||
748 | writew(DISABLE_ALL_INTERRUPTS, | ||
749 | SSP_IMSC(pl022->virtbase)); | ||
750 | writew(CLEAR_ALL_INTERRUPTS, SSP_ICR(pl022->virtbase)); | ||
751 | writew((readw(SSP_CR1(pl022->virtbase)) & | ||
752 | (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); | ||
753 | msg->state = STATE_ERROR; | ||
754 | |||
755 | /* Schedule message queue handler */ | ||
756 | tasklet_schedule(&pl022->pump_transfers); | ||
757 | return IRQ_HANDLED; | ||
758 | } | ||
759 | |||
760 | readwriter(pl022); | ||
761 | |||
762 | if ((pl022->tx == pl022->tx_end) && (flag == 0)) { | ||
763 | flag = 1; | ||
764 | /* Disable Transmit interrupt */ | ||
765 | writew(readw(SSP_IMSC(pl022->virtbase)) & | ||
766 | (~SSP_IMSC_MASK_TXIM), | ||
767 | SSP_IMSC(pl022->virtbase)); | ||
768 | } | ||
769 | |||
770 | /* | ||
771 | * Since all transactions must write as much as shall be read, | ||
772 | * we can conclude the entire transaction once RX is complete. | ||
773 | * At this point, all TX will always be finished. | ||
774 | */ | ||
775 | if (pl022->rx >= pl022->rx_end) { | ||
776 | writew(DISABLE_ALL_INTERRUPTS, | ||
777 | SSP_IMSC(pl022->virtbase)); | ||
778 | writew(CLEAR_ALL_INTERRUPTS, SSP_ICR(pl022->virtbase)); | ||
779 | if (unlikely(pl022->rx > pl022->rx_end)) { | ||
780 | dev_warn(&pl022->adev->dev, "read %u surplus " | ||
781 | "bytes (did you request an odd " | ||
782 | "number of bytes on a 16bit bus?)\n", | ||
783 | (u32) (pl022->rx - pl022->rx_end)); | ||
784 | } | ||
785 | /* Update total bytes transfered */ | ||
786 | msg->actual_length += pl022->cur_transfer->len; | ||
787 | if (pl022->cur_transfer->cs_change) | ||
788 | pl022->cur_chip-> | ||
789 | cs_control(SSP_CHIP_DESELECT); | ||
790 | /* Move to next transfer */ | ||
791 | msg->state = next_transfer(pl022); | ||
792 | tasklet_schedule(&pl022->pump_transfers); | ||
793 | return IRQ_HANDLED; | ||
794 | } | ||
795 | |||
796 | return IRQ_HANDLED; | ||
797 | } | ||
798 | |||
799 | /** | ||
800 | * This sets up the pointers to memory for the next message to | ||
801 | * send out on the SPI bus. | ||
802 | */ | ||
803 | static int set_up_next_transfer(struct pl022 *pl022, | ||
804 | struct spi_transfer *transfer) | ||
805 | { | ||
806 | int residue; | ||
807 | |||
808 | /* Sanity check the message for this bus width */ | ||
809 | residue = pl022->cur_transfer->len % pl022->cur_chip->n_bytes; | ||
810 | if (unlikely(residue != 0)) { | ||
811 | dev_err(&pl022->adev->dev, | ||
812 | "message of %u bytes to transmit but the current " | ||
813 | "chip bus has a data width of %u bytes!\n", | ||
814 | pl022->cur_transfer->len, | ||
815 | pl022->cur_chip->n_bytes); | ||
816 | dev_err(&pl022->adev->dev, "skipping this message\n"); | ||
817 | return -EIO; | ||
818 | } | ||
819 | pl022->tx = (void *)transfer->tx_buf; | ||
820 | pl022->tx_end = pl022->tx + pl022->cur_transfer->len; | ||
821 | pl022->rx = (void *)transfer->rx_buf; | ||
822 | pl022->rx_end = pl022->rx + pl022->cur_transfer->len; | ||
823 | pl022->write = | ||
824 | pl022->tx ? pl022->cur_chip->write : WRITING_NULL; | ||
825 | pl022->read = pl022->rx ? pl022->cur_chip->read : READING_NULL; | ||
826 | return 0; | ||
827 | } | ||
828 | |||
829 | /** | ||
830 | * pump_transfers - Tasklet function which schedules next interrupt transfer | ||
831 | * when running in interrupt transfer mode. | ||
832 | * @data: SSP driver private data structure | ||
833 | * | ||
834 | */ | ||
835 | static void pump_transfers(unsigned long data) | ||
836 | { | ||
837 | struct pl022 *pl022 = (struct pl022 *) data; | ||
838 | struct spi_message *message = NULL; | ||
839 | struct spi_transfer *transfer = NULL; | ||
840 | struct spi_transfer *previous = NULL; | ||
841 | |||
842 | /* Get current state information */ | ||
843 | message = pl022->cur_msg; | ||
844 | transfer = pl022->cur_transfer; | ||
845 | |||
846 | /* Handle for abort */ | ||
847 | if (message->state == STATE_ERROR) { | ||
848 | message->status = -EIO; | ||
849 | giveback(pl022); | ||
850 | return; | ||
851 | } | ||
852 | |||
853 | /* Handle end of message */ | ||
854 | if (message->state == STATE_DONE) { | ||
855 | message->status = 0; | ||
856 | giveback(pl022); | ||
857 | return; | ||
858 | } | ||
859 | |||
860 | /* Delay if requested at end of transfer before CS change */ | ||
861 | if (message->state == STATE_RUNNING) { | ||
862 | previous = list_entry(transfer->transfer_list.prev, | ||
863 | struct spi_transfer, | ||
864 | transfer_list); | ||
865 | if (previous->delay_usecs) | ||
866 | /* | ||
867 | * FIXME: This runs in interrupt context. | ||
868 | * Is this really smart? | ||
869 | */ | ||
870 | udelay(previous->delay_usecs); | ||
871 | |||
872 | /* Drop chip select only if cs_change is requested */ | ||
873 | if (previous->cs_change) | ||
874 | pl022->cur_chip->cs_control(SSP_CHIP_SELECT); | ||
875 | } else { | ||
876 | /* STATE_START */ | ||
877 | message->state = STATE_RUNNING; | ||
878 | } | ||
879 | |||
880 | if (set_up_next_transfer(pl022, transfer)) { | ||
881 | message->state = STATE_ERROR; | ||
882 | message->status = -EIO; | ||
883 | giveback(pl022); | ||
884 | return; | ||
885 | } | ||
886 | /* Flush the FIFOs and let's go! */ | ||
887 | flush(pl022); | ||
888 | writew(ENABLE_ALL_INTERRUPTS, SSP_IMSC(pl022->virtbase)); | ||
889 | } | ||
890 | |||
891 | /** | ||
892 | * NOT IMPLEMENTED | ||
893 | * configure_dma - It configures the DMA pipes for DMA transfers | ||
894 | * @data: SSP driver's private data structure | ||
895 | * | ||
896 | */ | ||
897 | static int configure_dma(void *data) | ||
898 | { | ||
899 | struct pl022 *pl022 = data; | ||
900 | dev_dbg(&pl022->adev->dev, "configure DMA\n"); | ||
901 | return -ENOTSUPP; | ||
902 | } | ||
903 | |||
904 | /** | ||
905 | * do_dma_transfer - It handles transfers of the current message | ||
906 | * if it is DMA xfer. | ||
907 | * NOT FULLY IMPLEMENTED | ||
908 | * @data: SSP driver's private data structure | ||
909 | */ | ||
910 | static void do_dma_transfer(void *data) | ||
911 | { | ||
912 | struct pl022 *pl022 = data; | ||
913 | |||
914 | if (configure_dma(data)) { | ||
915 | dev_dbg(&pl022->adev->dev, "configuration of DMA Failed!\n"); | ||
916 | goto err_config_dma; | ||
917 | } | ||
918 | |||
919 | /* TODO: Implememt DMA setup of pipes here */ | ||
920 | |||
921 | /* Enable target chip, set up transfer */ | ||
922 | pl022->cur_chip->cs_control(SSP_CHIP_SELECT); | ||
923 | if (set_up_next_transfer(pl022, pl022->cur_transfer)) { | ||
924 | /* Error path */ | ||
925 | pl022->cur_msg->state = STATE_ERROR; | ||
926 | pl022->cur_msg->status = -EIO; | ||
927 | giveback(pl022); | ||
928 | return; | ||
929 | } | ||
930 | /* Enable SSP */ | ||
931 | writew((readw(SSP_CR1(pl022->virtbase)) | SSP_CR1_MASK_SSE), | ||
932 | SSP_CR1(pl022->virtbase)); | ||
933 | |||
934 | /* TODO: Enable the DMA transfer here */ | ||
935 | return; | ||
936 | |||
937 | err_config_dma: | ||
938 | pl022->cur_msg->state = STATE_ERROR; | ||
939 | pl022->cur_msg->status = -EIO; | ||
940 | giveback(pl022); | ||
941 | return; | ||
942 | } | ||
943 | |||
944 | static void do_interrupt_transfer(void *data) | ||
945 | { | ||
946 | struct pl022 *pl022 = data; | ||
947 | |||
948 | /* Enable target chip */ | ||
949 | pl022->cur_chip->cs_control(SSP_CHIP_SELECT); | ||
950 | if (set_up_next_transfer(pl022, pl022->cur_transfer)) { | ||
951 | /* Error path */ | ||
952 | pl022->cur_msg->state = STATE_ERROR; | ||
953 | pl022->cur_msg->status = -EIO; | ||
954 | giveback(pl022); | ||
955 | return; | ||
956 | } | ||
957 | /* Enable SSP, turn on interrupts */ | ||
958 | writew((readw(SSP_CR1(pl022->virtbase)) | SSP_CR1_MASK_SSE), | ||
959 | SSP_CR1(pl022->virtbase)); | ||
960 | writew(ENABLE_ALL_INTERRUPTS, SSP_IMSC(pl022->virtbase)); | ||
961 | } | ||
962 | |||
963 | static void do_polling_transfer(void *data) | ||
964 | { | ||
965 | struct pl022 *pl022 = data; | ||
966 | struct spi_message *message = NULL; | ||
967 | struct spi_transfer *transfer = NULL; | ||
968 | struct spi_transfer *previous = NULL; | ||
969 | struct chip_data *chip; | ||
970 | |||
971 | chip = pl022->cur_chip; | ||
972 | message = pl022->cur_msg; | ||
973 | |||
974 | while (message->state != STATE_DONE) { | ||
975 | /* Handle for abort */ | ||
976 | if (message->state == STATE_ERROR) | ||
977 | break; | ||
978 | transfer = pl022->cur_transfer; | ||
979 | |||
980 | /* Delay if requested at end of transfer */ | ||
981 | if (message->state == STATE_RUNNING) { | ||
982 | previous = | ||
983 | list_entry(transfer->transfer_list.prev, | ||
984 | struct spi_transfer, transfer_list); | ||
985 | if (previous->delay_usecs) | ||
986 | udelay(previous->delay_usecs); | ||
987 | if (previous->cs_change) | ||
988 | pl022->cur_chip->cs_control(SSP_CHIP_SELECT); | ||
989 | } else { | ||
990 | /* STATE_START */ | ||
991 | message->state = STATE_RUNNING; | ||
992 | pl022->cur_chip->cs_control(SSP_CHIP_SELECT); | ||
993 | } | ||
994 | |||
995 | /* Configuration Changing Per Transfer */ | ||
996 | if (set_up_next_transfer(pl022, transfer)) { | ||
997 | /* Error path */ | ||
998 | message->state = STATE_ERROR; | ||
999 | break; | ||
1000 | } | ||
1001 | /* Flush FIFOs and enable SSP */ | ||
1002 | flush(pl022); | ||
1003 | writew((readw(SSP_CR1(pl022->virtbase)) | SSP_CR1_MASK_SSE), | ||
1004 | SSP_CR1(pl022->virtbase)); | ||
1005 | |||
1006 | dev_dbg(&pl022->adev->dev, "POLLING TRANSFER ONGOING ... \n"); | ||
1007 | /* FIXME: insert a timeout so we don't hang here indefinately */ | ||
1008 | while (pl022->tx < pl022->tx_end || pl022->rx < pl022->rx_end) | ||
1009 | readwriter(pl022); | ||
1010 | |||
1011 | /* Update total byte transfered */ | ||
1012 | message->actual_length += pl022->cur_transfer->len; | ||
1013 | if (pl022->cur_transfer->cs_change) | ||
1014 | pl022->cur_chip->cs_control(SSP_CHIP_DESELECT); | ||
1015 | /* Move to next transfer */ | ||
1016 | message->state = next_transfer(pl022); | ||
1017 | } | ||
1018 | |||
1019 | /* Handle end of message */ | ||
1020 | if (message->state == STATE_DONE) | ||
1021 | message->status = 0; | ||
1022 | else | ||
1023 | message->status = -EIO; | ||
1024 | |||
1025 | giveback(pl022); | ||
1026 | return; | ||
1027 | } | ||
1028 | |||
1029 | /** | ||
1030 | * pump_messages - Workqueue function which processes spi message queue | ||
1031 | * @data: pointer to private data of SSP driver | ||
1032 | * | ||
1033 | * This function checks if there is any spi message in the queue that | ||
1034 | * needs processing and delegate control to appropriate function | ||
1035 | * do_polling_transfer()/do_interrupt_transfer()/do_dma_transfer() | ||
1036 | * based on the kind of the transfer | ||
1037 | * | ||
1038 | */ | ||
1039 | static void pump_messages(struct work_struct *work) | ||
1040 | { | ||
1041 | struct pl022 *pl022 = | ||
1042 | container_of(work, struct pl022, pump_messages); | ||
1043 | unsigned long flags; | ||
1044 | |||
1045 | /* Lock queue and check for queue work */ | ||
1046 | spin_lock_irqsave(&pl022->queue_lock, flags); | ||
1047 | if (list_empty(&pl022->queue) || pl022->run == QUEUE_STOPPED) { | ||
1048 | pl022->busy = 0; | ||
1049 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
1050 | return; | ||
1051 | } | ||
1052 | /* Make sure we are not already running a message */ | ||
1053 | if (pl022->cur_msg) { | ||
1054 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
1055 | return; | ||
1056 | } | ||
1057 | /* Extract head of queue */ | ||
1058 | pl022->cur_msg = | ||
1059 | list_entry(pl022->queue.next, struct spi_message, queue); | ||
1060 | |||
1061 | list_del_init(&pl022->cur_msg->queue); | ||
1062 | pl022->busy = 1; | ||
1063 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
1064 | |||
1065 | /* Initial message state */ | ||
1066 | pl022->cur_msg->state = STATE_START; | ||
1067 | pl022->cur_transfer = list_entry(pl022->cur_msg->transfers.next, | ||
1068 | struct spi_transfer, | ||
1069 | transfer_list); | ||
1070 | |||
1071 | /* Setup the SPI using the per chip configuration */ | ||
1072 | pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi); | ||
1073 | /* | ||
1074 | * We enable the clock here, then the clock will be disabled when | ||
1075 | * giveback() is called in each method (poll/interrupt/DMA) | ||
1076 | */ | ||
1077 | clk_enable(pl022->clk); | ||
1078 | restore_state(pl022); | ||
1079 | flush(pl022); | ||
1080 | |||
1081 | if (pl022->cur_chip->xfer_type == POLLING_TRANSFER) | ||
1082 | do_polling_transfer(pl022); | ||
1083 | else if (pl022->cur_chip->xfer_type == INTERRUPT_TRANSFER) | ||
1084 | do_interrupt_transfer(pl022); | ||
1085 | else | ||
1086 | do_dma_transfer(pl022); | ||
1087 | } | ||
1088 | |||
1089 | |||
1090 | static int __init init_queue(struct pl022 *pl022) | ||
1091 | { | ||
1092 | INIT_LIST_HEAD(&pl022->queue); | ||
1093 | spin_lock_init(&pl022->queue_lock); | ||
1094 | |||
1095 | pl022->run = QUEUE_STOPPED; | ||
1096 | pl022->busy = 0; | ||
1097 | |||
1098 | tasklet_init(&pl022->pump_transfers, | ||
1099 | pump_transfers, (unsigned long)pl022); | ||
1100 | |||
1101 | INIT_WORK(&pl022->pump_messages, pump_messages); | ||
1102 | pl022->workqueue = create_singlethread_workqueue( | ||
1103 | dev_name(pl022->master->dev.parent)); | ||
1104 | if (pl022->workqueue == NULL) | ||
1105 | return -EBUSY; | ||
1106 | |||
1107 | return 0; | ||
1108 | } | ||
1109 | |||
1110 | |||
1111 | static int start_queue(struct pl022 *pl022) | ||
1112 | { | ||
1113 | unsigned long flags; | ||
1114 | |||
1115 | spin_lock_irqsave(&pl022->queue_lock, flags); | ||
1116 | |||
1117 | if (pl022->run == QUEUE_RUNNING || pl022->busy) { | ||
1118 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
1119 | return -EBUSY; | ||
1120 | } | ||
1121 | |||
1122 | pl022->run = QUEUE_RUNNING; | ||
1123 | pl022->cur_msg = NULL; | ||
1124 | pl022->cur_transfer = NULL; | ||
1125 | pl022->cur_chip = NULL; | ||
1126 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
1127 | |||
1128 | queue_work(pl022->workqueue, &pl022->pump_messages); | ||
1129 | |||
1130 | return 0; | ||
1131 | } | ||
1132 | |||
1133 | |||
1134 | static int stop_queue(struct pl022 *pl022) | ||
1135 | { | ||
1136 | unsigned long flags; | ||
1137 | unsigned limit = 500; | ||
1138 | int status = 0; | ||
1139 | |||
1140 | spin_lock_irqsave(&pl022->queue_lock, flags); | ||
1141 | |||
1142 | /* This is a bit lame, but is optimized for the common execution path. | ||
1143 | * A wait_queue on the pl022->busy could be used, but then the common | ||
1144 | * execution path (pump_messages) would be required to call wake_up or | ||
1145 | * friends on every SPI message. Do this instead */ | ||
1146 | pl022->run = QUEUE_STOPPED; | ||
1147 | while (!list_empty(&pl022->queue) && pl022->busy && limit--) { | ||
1148 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
1149 | msleep(10); | ||
1150 | spin_lock_irqsave(&pl022->queue_lock, flags); | ||
1151 | } | ||
1152 | |||
1153 | if (!list_empty(&pl022->queue) || pl022->busy) | ||
1154 | status = -EBUSY; | ||
1155 | |||
1156 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
1157 | |||
1158 | return status; | ||
1159 | } | ||
1160 | |||
1161 | static int destroy_queue(struct pl022 *pl022) | ||
1162 | { | ||
1163 | int status; | ||
1164 | |||
1165 | status = stop_queue(pl022); | ||
1166 | /* we are unloading the module or failing to load (only two calls | ||
1167 | * to this routine), and neither call can handle a return value. | ||
1168 | * However, destroy_workqueue calls flush_workqueue, and that will | ||
1169 | * block until all work is done. If the reason that stop_queue | ||
1170 | * timed out is that the work will never finish, then it does no | ||
1171 | * good to call destroy_workqueue, so return anyway. */ | ||
1172 | if (status != 0) | ||
1173 | return status; | ||
1174 | |||
1175 | destroy_workqueue(pl022->workqueue); | ||
1176 | |||
1177 | return 0; | ||
1178 | } | ||
1179 | |||
1180 | static int verify_controller_parameters(struct pl022 *pl022, | ||
1181 | struct pl022_config_chip *chip_info) | ||
1182 | { | ||
1183 | if ((chip_info->lbm != LOOPBACK_ENABLED) | ||
1184 | && (chip_info->lbm != LOOPBACK_DISABLED)) { | ||
1185 | dev_err(chip_info->dev, | ||
1186 | "loopback Mode is configured incorrectly\n"); | ||
1187 | return -EINVAL; | ||
1188 | } | ||
1189 | if ((chip_info->iface < SSP_INTERFACE_MOTOROLA_SPI) | ||
1190 | || (chip_info->iface > SSP_INTERFACE_UNIDIRECTIONAL)) { | ||
1191 | dev_err(chip_info->dev, | ||
1192 | "interface is configured incorrectly\n"); | ||
1193 | return -EINVAL; | ||
1194 | } | ||
1195 | if ((chip_info->iface == SSP_INTERFACE_UNIDIRECTIONAL) && | ||
1196 | (!pl022->vendor->unidir)) { | ||
1197 | dev_err(chip_info->dev, | ||
1198 | "unidirectional mode not supported in this " | ||
1199 | "hardware version\n"); | ||
1200 | return -EINVAL; | ||
1201 | } | ||
1202 | if ((chip_info->hierarchy != SSP_MASTER) | ||
1203 | && (chip_info->hierarchy != SSP_SLAVE)) { | ||
1204 | dev_err(chip_info->dev, | ||
1205 | "hierarchy is configured incorrectly\n"); | ||
1206 | return -EINVAL; | ||
1207 | } | ||
1208 | if (((chip_info->clk_freq).cpsdvsr < CPSDVR_MIN) | ||
1209 | || ((chip_info->clk_freq).cpsdvsr > CPSDVR_MAX)) { | ||
1210 | dev_err(chip_info->dev, | ||
1211 | "cpsdvsr is configured incorrectly\n"); | ||
1212 | return -EINVAL; | ||
1213 | } | ||
1214 | if ((chip_info->endian_rx != SSP_RX_MSB) | ||
1215 | && (chip_info->endian_rx != SSP_RX_LSB)) { | ||
1216 | dev_err(chip_info->dev, | ||
1217 | "RX FIFO endianess is configured incorrectly\n"); | ||
1218 | return -EINVAL; | ||
1219 | } | ||
1220 | if ((chip_info->endian_tx != SSP_TX_MSB) | ||
1221 | && (chip_info->endian_tx != SSP_TX_LSB)) { | ||
1222 | dev_err(chip_info->dev, | ||
1223 | "TX FIFO endianess is configured incorrectly\n"); | ||
1224 | return -EINVAL; | ||
1225 | } | ||
1226 | if ((chip_info->data_size < SSP_DATA_BITS_4) | ||
1227 | || (chip_info->data_size > SSP_DATA_BITS_32)) { | ||
1228 | dev_err(chip_info->dev, | ||
1229 | "DATA Size is configured incorrectly\n"); | ||
1230 | return -EINVAL; | ||
1231 | } | ||
1232 | if ((chip_info->com_mode != INTERRUPT_TRANSFER) | ||
1233 | && (chip_info->com_mode != DMA_TRANSFER) | ||
1234 | && (chip_info->com_mode != POLLING_TRANSFER)) { | ||
1235 | dev_err(chip_info->dev, | ||
1236 | "Communication mode is configured incorrectly\n"); | ||
1237 | return -EINVAL; | ||
1238 | } | ||
1239 | if ((chip_info->rx_lev_trig < SSP_RX_1_OR_MORE_ELEM) | ||
1240 | || (chip_info->rx_lev_trig > SSP_RX_32_OR_MORE_ELEM)) { | ||
1241 | dev_err(chip_info->dev, | ||
1242 | "RX FIFO Trigger Level is configured incorrectly\n"); | ||
1243 | return -EINVAL; | ||
1244 | } | ||
1245 | if ((chip_info->tx_lev_trig < SSP_TX_1_OR_MORE_EMPTY_LOC) | ||
1246 | || (chip_info->tx_lev_trig > SSP_TX_32_OR_MORE_EMPTY_LOC)) { | ||
1247 | dev_err(chip_info->dev, | ||
1248 | "TX FIFO Trigger Level is configured incorrectly\n"); | ||
1249 | return -EINVAL; | ||
1250 | } | ||
1251 | if (chip_info->iface == SSP_INTERFACE_MOTOROLA_SPI) { | ||
1252 | if ((chip_info->clk_phase != SSP_CLK_RISING_EDGE) | ||
1253 | && (chip_info->clk_phase != SSP_CLK_FALLING_EDGE)) { | ||
1254 | dev_err(chip_info->dev, | ||
1255 | "Clock Phase is configured incorrectly\n"); | ||
1256 | return -EINVAL; | ||
1257 | } | ||
1258 | if ((chip_info->clk_pol != SSP_CLK_POL_IDLE_LOW) | ||
1259 | && (chip_info->clk_pol != SSP_CLK_POL_IDLE_HIGH)) { | ||
1260 | dev_err(chip_info->dev, | ||
1261 | "Clock Polarity is configured incorrectly\n"); | ||
1262 | return -EINVAL; | ||
1263 | } | ||
1264 | } | ||
1265 | if (chip_info->iface == SSP_INTERFACE_NATIONAL_MICROWIRE) { | ||
1266 | if ((chip_info->ctrl_len < SSP_BITS_4) | ||
1267 | || (chip_info->ctrl_len > SSP_BITS_32)) { | ||
1268 | dev_err(chip_info->dev, | ||
1269 | "CTRL LEN is configured incorrectly\n"); | ||
1270 | return -EINVAL; | ||
1271 | } | ||
1272 | if ((chip_info->wait_state != SSP_MWIRE_WAIT_ZERO) | ||
1273 | && (chip_info->wait_state != SSP_MWIRE_WAIT_ONE)) { | ||
1274 | dev_err(chip_info->dev, | ||
1275 | "Wait State is configured incorrectly\n"); | ||
1276 | return -EINVAL; | ||
1277 | } | ||
1278 | if ((chip_info->duplex != SSP_MICROWIRE_CHANNEL_FULL_DUPLEX) | ||
1279 | && (chip_info->duplex != | ||
1280 | SSP_MICROWIRE_CHANNEL_HALF_DUPLEX)) { | ||
1281 | dev_err(chip_info->dev, | ||
1282 | "DUPLEX is configured incorrectly\n"); | ||
1283 | return -EINVAL; | ||
1284 | } | ||
1285 | } | ||
1286 | if (chip_info->cs_control == NULL) { | ||
1287 | dev_warn(chip_info->dev, | ||
1288 | "Chip Select Function is NULL for this chip\n"); | ||
1289 | chip_info->cs_control = null_cs_control; | ||
1290 | } | ||
1291 | return 0; | ||
1292 | } | ||
1293 | |||
1294 | /** | ||
1295 | * pl022_transfer - transfer function registered to SPI master framework | ||
1296 | * @spi: spi device which is requesting transfer | ||
1297 | * @msg: spi message which is to handled is queued to driver queue | ||
1298 | * | ||
1299 | * This function is registered to the SPI framework for this SPI master | ||
1300 | * controller. It will queue the spi_message in the queue of driver if | ||
1301 | * the queue is not stopped and return. | ||
1302 | */ | ||
1303 | static int pl022_transfer(struct spi_device *spi, struct spi_message *msg) | ||
1304 | { | ||
1305 | struct pl022 *pl022 = spi_master_get_devdata(spi->master); | ||
1306 | unsigned long flags; | ||
1307 | |||
1308 | spin_lock_irqsave(&pl022->queue_lock, flags); | ||
1309 | |||
1310 | if (pl022->run == QUEUE_STOPPED) { | ||
1311 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
1312 | return -ESHUTDOWN; | ||
1313 | } | ||
1314 | msg->actual_length = 0; | ||
1315 | msg->status = -EINPROGRESS; | ||
1316 | msg->state = STATE_START; | ||
1317 | |||
1318 | list_add_tail(&msg->queue, &pl022->queue); | ||
1319 | if (pl022->run == QUEUE_RUNNING && !pl022->busy) | ||
1320 | queue_work(pl022->workqueue, &pl022->pump_messages); | ||
1321 | |||
1322 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | ||
1323 | return 0; | ||
1324 | } | ||
1325 | |||
1326 | static int calculate_effective_freq(struct pl022 *pl022, | ||
1327 | int freq, | ||
1328 | struct ssp_clock_params *clk_freq) | ||
1329 | { | ||
1330 | /* Lets calculate the frequency parameters */ | ||
1331 | u16 cpsdvsr = 2; | ||
1332 | u16 scr = 0; | ||
1333 | bool freq_found = false; | ||
1334 | u32 rate; | ||
1335 | u32 max_tclk; | ||
1336 | u32 min_tclk; | ||
1337 | |||
1338 | rate = clk_get_rate(pl022->clk); | ||
1339 | /* cpsdvscr = 2 & scr 0 */ | ||
1340 | max_tclk = (rate / (CPSDVR_MIN * (1 + SCR_MIN))); | ||
1341 | /* cpsdvsr = 254 & scr = 255 */ | ||
1342 | min_tclk = (rate / (CPSDVR_MAX * (1 + SCR_MAX))); | ||
1343 | |||
1344 | if ((freq <= max_tclk) && (freq >= min_tclk)) { | ||
1345 | while (cpsdvsr <= CPSDVR_MAX && !freq_found) { | ||
1346 | while (scr <= SCR_MAX && !freq_found) { | ||
1347 | if ((rate / | ||
1348 | (cpsdvsr * (1 + scr))) > freq) | ||
1349 | scr += 1; | ||
1350 | else { | ||
1351 | /* | ||
1352 | * This bool is made true when | ||
1353 | * effective frequency >= | ||
1354 | * target frequency is found | ||
1355 | */ | ||
1356 | freq_found = true; | ||
1357 | if ((rate / | ||
1358 | (cpsdvsr * (1 + scr))) != freq) { | ||
1359 | if (scr == SCR_MIN) { | ||
1360 | cpsdvsr -= 2; | ||
1361 | scr = SCR_MAX; | ||
1362 | } else | ||
1363 | scr -= 1; | ||
1364 | } | ||
1365 | } | ||
1366 | } | ||
1367 | if (!freq_found) { | ||
1368 | cpsdvsr += 2; | ||
1369 | scr = SCR_MIN; | ||
1370 | } | ||
1371 | } | ||
1372 | if (cpsdvsr != 0) { | ||
1373 | dev_dbg(&pl022->adev->dev, | ||
1374 | "SSP Effective Frequency is %u\n", | ||
1375 | (rate / (cpsdvsr * (1 + scr)))); | ||
1376 | clk_freq->cpsdvsr = (u8) (cpsdvsr & 0xFF); | ||
1377 | clk_freq->scr = (u8) (scr & 0xFF); | ||
1378 | dev_dbg(&pl022->adev->dev, | ||
1379 | "SSP cpsdvsr = %d, scr = %d\n", | ||
1380 | clk_freq->cpsdvsr, clk_freq->scr); | ||
1381 | } | ||
1382 | } else { | ||
1383 | dev_err(&pl022->adev->dev, | ||
1384 | "controller data is incorrect: out of range frequency"); | ||
1385 | return -EINVAL; | ||
1386 | } | ||
1387 | return 0; | ||
1388 | } | ||
1389 | |||
1390 | /** | ||
1391 | * NOT IMPLEMENTED | ||
1392 | * process_dma_info - Processes the DMA info provided by client drivers | ||
1393 | * @chip_info: chip info provided by client device | ||
1394 | * @chip: Runtime state maintained by the SSP controller for each spi device | ||
1395 | * | ||
1396 | * This function processes and stores DMA config provided by client driver | ||
1397 | * into the runtime state maintained by the SSP controller driver | ||
1398 | */ | ||
1399 | static int process_dma_info(struct pl022_config_chip *chip_info, | ||
1400 | struct chip_data *chip) | ||
1401 | { | ||
1402 | dev_err(chip_info->dev, | ||
1403 | "cannot process DMA info, DMA not implemented!\n"); | ||
1404 | return -ENOTSUPP; | ||
1405 | } | ||
1406 | |||
1407 | /** | ||
1408 | * pl022_setup - setup function registered to SPI master framework | ||
1409 | * @spi: spi device which is requesting setup | ||
1410 | * | ||
1411 | * This function is registered to the SPI framework for this SPI master | ||
1412 | * controller. If it is the first time when setup is called by this device, | ||
1413 | * this function will initialize the runtime state for this chip and save | ||
1414 | * the same in the device structure. Else it will update the runtime info | ||
1415 | * with the updated chip info. Nothing is really being written to the | ||
1416 | * controller hardware here, that is not done until the actual transfer | ||
1417 | * commence. | ||
1418 | */ | ||
1419 | |||
1420 | /* FIXME: JUST GUESSING the spi->mode bits understood by this driver */ | ||
1421 | #define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \ | ||
1422 | | SPI_LSB_FIRST | SPI_LOOP) | ||
1423 | |||
1424 | static int pl022_setup(struct spi_device *spi) | ||
1425 | { | ||
1426 | struct pl022_config_chip *chip_info; | ||
1427 | struct chip_data *chip; | ||
1428 | int status = 0; | ||
1429 | struct pl022 *pl022 = spi_master_get_devdata(spi->master); | ||
1430 | |||
1431 | if (spi->mode & ~MODEBITS) { | ||
1432 | dev_dbg(&spi->dev, "unsupported mode bits %x\n", | ||
1433 | spi->mode & ~MODEBITS); | ||
1434 | return -EINVAL; | ||
1435 | } | ||
1436 | |||
1437 | if (!spi->max_speed_hz) | ||
1438 | return -EINVAL; | ||
1439 | |||
1440 | /* Get controller_state if one is supplied */ | ||
1441 | chip = spi_get_ctldata(spi); | ||
1442 | |||
1443 | if (chip == NULL) { | ||
1444 | chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); | ||
1445 | if (!chip) { | ||
1446 | dev_err(&spi->dev, | ||
1447 | "cannot allocate controller state\n"); | ||
1448 | return -ENOMEM; | ||
1449 | } | ||
1450 | dev_dbg(&spi->dev, | ||
1451 | "allocated memory for controller's runtime state\n"); | ||
1452 | } | ||
1453 | |||
1454 | /* Get controller data if one is supplied */ | ||
1455 | chip_info = spi->controller_data; | ||
1456 | |||
1457 | if (chip_info == NULL) { | ||
1458 | /* spi_board_info.controller_data not is supplied */ | ||
1459 | dev_dbg(&spi->dev, | ||
1460 | "using default controller_data settings\n"); | ||
1461 | |||
1462 | chip_info = | ||
1463 | kzalloc(sizeof(struct pl022_config_chip), GFP_KERNEL); | ||
1464 | |||
1465 | if (!chip_info) { | ||
1466 | dev_err(&spi->dev, | ||
1467 | "cannot allocate controller data\n"); | ||
1468 | status = -ENOMEM; | ||
1469 | goto err_first_setup; | ||
1470 | } | ||
1471 | |||
1472 | dev_dbg(&spi->dev, "allocated memory for controller data\n"); | ||
1473 | |||
1474 | /* Pointer back to the SPI device */ | ||
1475 | chip_info->dev = &spi->dev; | ||
1476 | /* | ||
1477 | * Set controller data default values: | ||
1478 | * Polling is supported by default | ||
1479 | */ | ||
1480 | chip_info->lbm = LOOPBACK_DISABLED; | ||
1481 | chip_info->com_mode = POLLING_TRANSFER; | ||
1482 | chip_info->iface = SSP_INTERFACE_MOTOROLA_SPI; | ||
1483 | chip_info->hierarchy = SSP_SLAVE; | ||
1484 | chip_info->slave_tx_disable = DO_NOT_DRIVE_TX; | ||
1485 | chip_info->endian_tx = SSP_TX_LSB; | ||
1486 | chip_info->endian_rx = SSP_RX_LSB; | ||
1487 | chip_info->data_size = SSP_DATA_BITS_12; | ||
1488 | chip_info->rx_lev_trig = SSP_RX_1_OR_MORE_ELEM; | ||
1489 | chip_info->tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC; | ||
1490 | chip_info->clk_phase = SSP_CLK_FALLING_EDGE; | ||
1491 | chip_info->clk_pol = SSP_CLK_POL_IDLE_LOW; | ||
1492 | chip_info->ctrl_len = SSP_BITS_8; | ||
1493 | chip_info->wait_state = SSP_MWIRE_WAIT_ZERO; | ||
1494 | chip_info->duplex = SSP_MICROWIRE_CHANNEL_FULL_DUPLEX; | ||
1495 | chip_info->cs_control = null_cs_control; | ||
1496 | } else { | ||
1497 | dev_dbg(&spi->dev, | ||
1498 | "using user supplied controller_data settings\n"); | ||
1499 | } | ||
1500 | |||
1501 | /* | ||
1502 | * We can override with custom divisors, else we use the board | ||
1503 | * frequency setting | ||
1504 | */ | ||
1505 | if ((0 == chip_info->clk_freq.cpsdvsr) | ||
1506 | && (0 == chip_info->clk_freq.scr)) { | ||
1507 | status = calculate_effective_freq(pl022, | ||
1508 | spi->max_speed_hz, | ||
1509 | &chip_info->clk_freq); | ||
1510 | if (status < 0) | ||
1511 | goto err_config_params; | ||
1512 | } else { | ||
1513 | if ((chip_info->clk_freq.cpsdvsr % 2) != 0) | ||
1514 | chip_info->clk_freq.cpsdvsr = | ||
1515 | chip_info->clk_freq.cpsdvsr - 1; | ||
1516 | } | ||
1517 | status = verify_controller_parameters(pl022, chip_info); | ||
1518 | if (status) { | ||
1519 | dev_err(&spi->dev, "controller data is incorrect"); | ||
1520 | goto err_config_params; | ||
1521 | } | ||
1522 | /* Now set controller state based on controller data */ | ||
1523 | chip->xfer_type = chip_info->com_mode; | ||
1524 | chip->cs_control = chip_info->cs_control; | ||
1525 | |||
1526 | if (chip_info->data_size <= 8) { | ||
1527 | dev_dbg(&spi->dev, "1 <= n <=8 bits per word\n"); | ||
1528 | chip->n_bytes = 1; | ||
1529 | chip->read = READING_U8; | ||
1530 | chip->write = WRITING_U8; | ||
1531 | } else if (chip_info->data_size <= 16) { | ||
1532 | dev_dbg(&spi->dev, "9 <= n <= 16 bits per word\n"); | ||
1533 | chip->n_bytes = 2; | ||
1534 | chip->read = READING_U16; | ||
1535 | chip->write = WRITING_U16; | ||
1536 | } else { | ||
1537 | if (pl022->vendor->max_bpw >= 32) { | ||
1538 | dev_dbg(&spi->dev, "17 <= n <= 32 bits per word\n"); | ||
1539 | chip->n_bytes = 4; | ||
1540 | chip->read = READING_U32; | ||
1541 | chip->write = WRITING_U32; | ||
1542 | } else { | ||
1543 | dev_err(&spi->dev, | ||
1544 | "illegal data size for this controller!\n"); | ||
1545 | dev_err(&spi->dev, | ||
1546 | "a standard pl022 can only handle " | ||
1547 | "1 <= n <= 16 bit words\n"); | ||
1548 | goto err_config_params; | ||
1549 | } | ||
1550 | } | ||
1551 | |||
1552 | /* Now Initialize all register settings required for this chip */ | ||
1553 | chip->cr0 = 0; | ||
1554 | chip->cr1 = 0; | ||
1555 | chip->dmacr = 0; | ||
1556 | chip->cpsr = 0; | ||
1557 | if ((chip_info->com_mode == DMA_TRANSFER) | ||
1558 | && ((pl022->master_info)->enable_dma)) { | ||
1559 | chip->enable_dma = 1; | ||
1560 | dev_dbg(&spi->dev, "DMA mode set in controller state\n"); | ||
1561 | status = process_dma_info(chip_info, chip); | ||
1562 | if (status < 0) | ||
1563 | goto err_config_params; | ||
1564 | SSP_WRITE_BITS(chip->dmacr, SSP_DMA_ENABLED, | ||
1565 | SSP_DMACR_MASK_RXDMAE, 0); | ||
1566 | SSP_WRITE_BITS(chip->dmacr, SSP_DMA_ENABLED, | ||
1567 | SSP_DMACR_MASK_TXDMAE, 1); | ||
1568 | } else { | ||
1569 | chip->enable_dma = 0; | ||
1570 | dev_dbg(&spi->dev, "DMA mode NOT set in controller state\n"); | ||
1571 | SSP_WRITE_BITS(chip->dmacr, SSP_DMA_DISABLED, | ||
1572 | SSP_DMACR_MASK_RXDMAE, 0); | ||
1573 | SSP_WRITE_BITS(chip->dmacr, SSP_DMA_DISABLED, | ||
1574 | SSP_DMACR_MASK_TXDMAE, 1); | ||
1575 | } | ||
1576 | |||
1577 | chip->cpsr = chip_info->clk_freq.cpsdvsr; | ||
1578 | |||
1579 | SSP_WRITE_BITS(chip->cr0, chip_info->data_size, SSP_CR0_MASK_DSS, 0); | ||
1580 | SSP_WRITE_BITS(chip->cr0, chip_info->duplex, SSP_CR0_MASK_HALFDUP, 5); | ||
1581 | SSP_WRITE_BITS(chip->cr0, chip_info->clk_pol, SSP_CR0_MASK_SPO, 6); | ||
1582 | SSP_WRITE_BITS(chip->cr0, chip_info->clk_phase, SSP_CR0_MASK_SPH, 7); | ||
1583 | SSP_WRITE_BITS(chip->cr0, chip_info->clk_freq.scr, SSP_CR0_MASK_SCR, 8); | ||
1584 | SSP_WRITE_BITS(chip->cr0, chip_info->ctrl_len, SSP_CR0_MASK_CSS, 16); | ||
1585 | SSP_WRITE_BITS(chip->cr0, chip_info->iface, SSP_CR0_MASK_FRF, 21); | ||
1586 | SSP_WRITE_BITS(chip->cr1, chip_info->lbm, SSP_CR1_MASK_LBM, 0); | ||
1587 | SSP_WRITE_BITS(chip->cr1, SSP_DISABLED, SSP_CR1_MASK_SSE, 1); | ||
1588 | SSP_WRITE_BITS(chip->cr1, chip_info->hierarchy, SSP_CR1_MASK_MS, 2); | ||
1589 | SSP_WRITE_BITS(chip->cr1, chip_info->slave_tx_disable, SSP_CR1_MASK_SOD, 3); | ||
1590 | SSP_WRITE_BITS(chip->cr1, chip_info->endian_rx, SSP_CR1_MASK_RENDN, 4); | ||
1591 | SSP_WRITE_BITS(chip->cr1, chip_info->endian_tx, SSP_CR1_MASK_TENDN, 5); | ||
1592 | SSP_WRITE_BITS(chip->cr1, chip_info->wait_state, SSP_CR1_MASK_MWAIT, 6); | ||
1593 | SSP_WRITE_BITS(chip->cr1, chip_info->rx_lev_trig, SSP_CR1_MASK_RXIFLSEL, 7); | ||
1594 | SSP_WRITE_BITS(chip->cr1, chip_info->tx_lev_trig, SSP_CR1_MASK_TXIFLSEL, 10); | ||
1595 | |||
1596 | /* Save controller_state */ | ||
1597 | spi_set_ctldata(spi, chip); | ||
1598 | return status; | ||
1599 | err_config_params: | ||
1600 | err_first_setup: | ||
1601 | kfree(chip); | ||
1602 | return status; | ||
1603 | } | ||
1604 | |||
1605 | /** | ||
1606 | * pl022_cleanup - cleanup function registered to SPI master framework | ||
1607 | * @spi: spi device which is requesting cleanup | ||
1608 | * | ||
1609 | * This function is registered to the SPI framework for this SPI master | ||
1610 | * controller. It will free the runtime state of chip. | ||
1611 | */ | ||
1612 | static void pl022_cleanup(struct spi_device *spi) | ||
1613 | { | ||
1614 | struct chip_data *chip = spi_get_ctldata(spi); | ||
1615 | |||
1616 | spi_set_ctldata(spi, NULL); | ||
1617 | kfree(chip); | ||
1618 | } | ||
1619 | |||
1620 | |||
1621 | static int __init | ||
1622 | pl022_probe(struct amba_device *adev, struct amba_id *id) | ||
1623 | { | ||
1624 | struct device *dev = &adev->dev; | ||
1625 | struct pl022_ssp_controller *platform_info = adev->dev.platform_data; | ||
1626 | struct spi_master *master; | ||
1627 | struct pl022 *pl022 = NULL; /*Data for this driver */ | ||
1628 | int status = 0; | ||
1629 | |||
1630 | dev_info(&adev->dev, | ||
1631 | "ARM PL022 driver, device ID: 0x%08x\n", adev->periphid); | ||
1632 | if (platform_info == NULL) { | ||
1633 | dev_err(&adev->dev, "probe - no platform data supplied\n"); | ||
1634 | status = -ENODEV; | ||
1635 | goto err_no_pdata; | ||
1636 | } | ||
1637 | |||
1638 | /* Allocate master with space for data */ | ||
1639 | master = spi_alloc_master(dev, sizeof(struct pl022)); | ||
1640 | if (master == NULL) { | ||
1641 | dev_err(&adev->dev, "probe - cannot alloc SPI master\n"); | ||
1642 | status = -ENOMEM; | ||
1643 | goto err_no_master; | ||
1644 | } | ||
1645 | |||
1646 | pl022 = spi_master_get_devdata(master); | ||
1647 | pl022->master = master; | ||
1648 | pl022->master_info = platform_info; | ||
1649 | pl022->adev = adev; | ||
1650 | pl022->vendor = id->data; | ||
1651 | |||
1652 | /* | ||
1653 | * Bus Number Which has been Assigned to this SSP controller | ||
1654 | * on this board | ||
1655 | */ | ||
1656 | master->bus_num = platform_info->bus_id; | ||
1657 | master->num_chipselect = platform_info->num_chipselect; | ||
1658 | master->cleanup = pl022_cleanup; | ||
1659 | master->setup = pl022_setup; | ||
1660 | master->transfer = pl022_transfer; | ||
1661 | |||
1662 | dev_dbg(&adev->dev, "BUSNO: %d\n", master->bus_num); | ||
1663 | |||
1664 | status = amba_request_regions(adev, NULL); | ||
1665 | if (status) | ||
1666 | goto err_no_ioregion; | ||
1667 | |||
1668 | pl022->virtbase = ioremap(adev->res.start, resource_size(&adev->res)); | ||
1669 | if (pl022->virtbase == NULL) { | ||
1670 | status = -ENOMEM; | ||
1671 | goto err_no_ioremap; | ||
1672 | } | ||
1673 | printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", | ||
1674 | adev->res.start, pl022->virtbase); | ||
1675 | |||
1676 | pl022->clk = clk_get(&adev->dev, NULL); | ||
1677 | if (IS_ERR(pl022->clk)) { | ||
1678 | status = PTR_ERR(pl022->clk); | ||
1679 | dev_err(&adev->dev, "could not retrieve SSP/SPI bus clock\n"); | ||
1680 | goto err_no_clk; | ||
1681 | } | ||
1682 | |||
1683 | /* Disable SSP */ | ||
1684 | clk_enable(pl022->clk); | ||
1685 | writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), | ||
1686 | SSP_CR1(pl022->virtbase)); | ||
1687 | load_ssp_default_config(pl022); | ||
1688 | clk_disable(pl022->clk); | ||
1689 | |||
1690 | status = request_irq(adev->irq[0], pl022_interrupt_handler, 0, "pl022", | ||
1691 | pl022); | ||
1692 | if (status < 0) { | ||
1693 | dev_err(&adev->dev, "probe - cannot get IRQ (%d)\n", status); | ||
1694 | goto err_no_irq; | ||
1695 | } | ||
1696 | /* Initialize and start queue */ | ||
1697 | status = init_queue(pl022); | ||
1698 | if (status != 0) { | ||
1699 | dev_err(&adev->dev, "probe - problem initializing queue\n"); | ||
1700 | goto err_init_queue; | ||
1701 | } | ||
1702 | status = start_queue(pl022); | ||
1703 | if (status != 0) { | ||
1704 | dev_err(&adev->dev, "probe - problem starting queue\n"); | ||
1705 | goto err_start_queue; | ||
1706 | } | ||
1707 | /* Register with the SPI framework */ | ||
1708 | amba_set_drvdata(adev, pl022); | ||
1709 | status = spi_register_master(master); | ||
1710 | if (status != 0) { | ||
1711 | dev_err(&adev->dev, | ||
1712 | "probe - problem registering spi master\n"); | ||
1713 | goto err_spi_register; | ||
1714 | } | ||
1715 | dev_dbg(dev, "probe succeded\n"); | ||
1716 | return 0; | ||
1717 | |||
1718 | err_spi_register: | ||
1719 | err_start_queue: | ||
1720 | err_init_queue: | ||
1721 | destroy_queue(pl022); | ||
1722 | free_irq(adev->irq[0], pl022); | ||
1723 | err_no_irq: | ||
1724 | clk_put(pl022->clk); | ||
1725 | err_no_clk: | ||
1726 | iounmap(pl022->virtbase); | ||
1727 | err_no_ioremap: | ||
1728 | amba_release_regions(adev); | ||
1729 | err_no_ioregion: | ||
1730 | spi_master_put(master); | ||
1731 | err_no_master: | ||
1732 | err_no_pdata: | ||
1733 | return status; | ||
1734 | } | ||
1735 | |||
1736 | static int __exit | ||
1737 | pl022_remove(struct amba_device *adev) | ||
1738 | { | ||
1739 | struct pl022 *pl022 = amba_get_drvdata(adev); | ||
1740 | int status = 0; | ||
1741 | if (!pl022) | ||
1742 | return 0; | ||
1743 | |||
1744 | /* Remove the queue */ | ||
1745 | status = destroy_queue(pl022); | ||
1746 | if (status != 0) { | ||
1747 | dev_err(&adev->dev, | ||
1748 | "queue remove failed (%d)\n", status); | ||
1749 | return status; | ||
1750 | } | ||
1751 | load_ssp_default_config(pl022); | ||
1752 | free_irq(adev->irq[0], pl022); | ||
1753 | clk_disable(pl022->clk); | ||
1754 | clk_put(pl022->clk); | ||
1755 | iounmap(pl022->virtbase); | ||
1756 | amba_release_regions(adev); | ||
1757 | tasklet_disable(&pl022->pump_transfers); | ||
1758 | spi_unregister_master(pl022->master); | ||
1759 | spi_master_put(pl022->master); | ||
1760 | amba_set_drvdata(adev, NULL); | ||
1761 | dev_dbg(&adev->dev, "remove succeded\n"); | ||
1762 | return 0; | ||
1763 | } | ||
1764 | |||
1765 | #ifdef CONFIG_PM | ||
1766 | static int pl022_suspend(struct amba_device *adev, pm_message_t state) | ||
1767 | { | ||
1768 | struct pl022 *pl022 = amba_get_drvdata(adev); | ||
1769 | int status = 0; | ||
1770 | |||
1771 | status = stop_queue(pl022); | ||
1772 | if (status) { | ||
1773 | dev_warn(&adev->dev, "suspend cannot stop queue\n"); | ||
1774 | return status; | ||
1775 | } | ||
1776 | |||
1777 | clk_enable(pl022->clk); | ||
1778 | load_ssp_default_config(pl022); | ||
1779 | clk_disable(pl022->clk); | ||
1780 | dev_dbg(&adev->dev, "suspended\n"); | ||
1781 | return 0; | ||
1782 | } | ||
1783 | |||
1784 | static int pl022_resume(struct amba_device *adev) | ||
1785 | { | ||
1786 | struct pl022 *pl022 = amba_get_drvdata(adev); | ||
1787 | int status = 0; | ||
1788 | |||
1789 | /* Start the queue running */ | ||
1790 | status = start_queue(pl022); | ||
1791 | if (status) | ||
1792 | dev_err(&adev->dev, "problem starting queue (%d)\n", status); | ||
1793 | else | ||
1794 | dev_dbg(&adev->dev, "resumed\n"); | ||
1795 | |||
1796 | return status; | ||
1797 | } | ||
1798 | #else | ||
1799 | #define pl022_suspend NULL | ||
1800 | #define pl022_resume NULL | ||
1801 | #endif /* CONFIG_PM */ | ||
1802 | |||
1803 | static struct vendor_data vendor_arm = { | ||
1804 | .fifodepth = 8, | ||
1805 | .max_bpw = 16, | ||
1806 | .unidir = false, | ||
1807 | }; | ||
1808 | |||
1809 | |||
1810 | static struct vendor_data vendor_st = { | ||
1811 | .fifodepth = 32, | ||
1812 | .max_bpw = 32, | ||
1813 | .unidir = false, | ||
1814 | }; | ||
1815 | |||
1816 | static struct amba_id pl022_ids[] = { | ||
1817 | { | ||
1818 | /* | ||
1819 | * ARM PL022 variant, this has a 16bit wide | ||
1820 | * and 8 locations deep TX/RX FIFO | ||
1821 | */ | ||
1822 | .id = 0x00041022, | ||
1823 | .mask = 0x000fffff, | ||
1824 | .data = &vendor_arm, | ||
1825 | }, | ||
1826 | { | ||
1827 | /* | ||
1828 | * ST Micro derivative, this has 32bit wide | ||
1829 | * and 32 locations deep TX/RX FIFO | ||
1830 | */ | ||
1831 | .id = 0x00108022, | ||
1832 | .mask = 0xffffffff, | ||
1833 | .data = &vendor_st, | ||
1834 | }, | ||
1835 | { 0, 0 }, | ||
1836 | }; | ||
1837 | |||
1838 | static struct amba_driver pl022_driver = { | ||
1839 | .drv = { | ||
1840 | .name = "ssp-pl022", | ||
1841 | }, | ||
1842 | .id_table = pl022_ids, | ||
1843 | .probe = pl022_probe, | ||
1844 | .remove = __exit_p(pl022_remove), | ||
1845 | .suspend = pl022_suspend, | ||
1846 | .resume = pl022_resume, | ||
1847 | }; | ||
1848 | |||
1849 | |||
1850 | static int __init pl022_init(void) | ||
1851 | { | ||
1852 | return amba_driver_register(&pl022_driver); | ||
1853 | } | ||
1854 | |||
1855 | module_init(pl022_init); | ||
1856 | |||
1857 | static void __exit pl022_exit(void) | ||
1858 | { | ||
1859 | amba_driver_unregister(&pl022_driver); | ||
1860 | } | ||
1861 | |||
1862 | module_exit(pl022_exit); | ||
1863 | |||
1864 | MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>"); | ||
1865 | MODULE_DESCRIPTION("PL022 SSP Controller Driver"); | ||
1866 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c index f2447a5476bb..bbf9371cd284 100644 --- a/drivers/spi/spi_s3c24xx_gpio.c +++ b/drivers/spi/spi_s3c24xx_gpio.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
18 | #include <linux/workqueue.h> | 18 | #include <linux/workqueue.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/gpio.h> | ||
20 | 21 | ||
21 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
22 | #include <linux/spi/spi_bitbang.h> | 23 | #include <linux/spi/spi_bitbang.h> |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index 0716cdb44cd8..0a3dc5ece634 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -11,7 +11,6 @@ obj-$(CONFIG_USB_MON) += mon/ | |||
11 | obj-$(CONFIG_PCI) += host/ | 11 | obj-$(CONFIG_PCI) += host/ |
12 | obj-$(CONFIG_USB_EHCI_HCD) += host/ | 12 | obj-$(CONFIG_USB_EHCI_HCD) += host/ |
13 | obj-$(CONFIG_USB_ISP116X_HCD) += host/ | 13 | obj-$(CONFIG_USB_ISP116X_HCD) += host/ |
14 | obj-$(CONFIG_USB_ISP1760_HCD) += host/ | ||
15 | obj-$(CONFIG_USB_OHCI_HCD) += host/ | 14 | obj-$(CONFIG_USB_OHCI_HCD) += host/ |
16 | obj-$(CONFIG_USB_UHCI_HCD) += host/ | 15 | obj-$(CONFIG_USB_UHCI_HCD) += host/ |
17 | obj-$(CONFIG_USB_FHCI_HCD) += host/ | 16 | obj-$(CONFIG_USB_FHCI_HCD) += host/ |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 0a69c0977e3f..7a1164dd1d37 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1375,6 +1375,9 @@ static struct usb_device_id acm_ids[] = { | |||
1375 | { USB_DEVICE(0x0572, 0x1324), /* Conexant USB MODEM RD02-D400 */ | 1375 | { USB_DEVICE(0x0572, 0x1324), /* Conexant USB MODEM RD02-D400 */ |
1376 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | 1376 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
1377 | }, | 1377 | }, |
1378 | { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ | ||
1379 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | ||
1380 | }, | ||
1378 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ | 1381 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ |
1379 | }, | 1382 | }, |
1380 | { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ | 1383 | { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ |
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 563d57275448..05c913cc3658 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -794,7 +794,8 @@ usba_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
794 | if (ep->desc) { | 794 | if (ep->desc) { |
795 | list_add_tail(&req->queue, &ep->queue); | 795 | list_add_tail(&req->queue, &ep->queue); |
796 | 796 | ||
797 | if (ep->is_in || (ep_is_control(ep) | 797 | if ((!ep_is_control(ep) && ep->is_in) || |
798 | (ep_is_control(ep) | ||
798 | && (ep->state == DATA_STAGE_IN | 799 | && (ep->state == DATA_STAGE_IN |
799 | || ep->state == STATUS_STAGE_IN))) | 800 | || ep->state == STATUS_STAGE_IN))) |
800 | usba_ep_writel(ep, CTL_ENB, USBA_TX_PK_RDY); | 801 | usba_ep_writel(ep, CTL_ENB, USBA_TX_PK_RDY); |
@@ -1940,7 +1941,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
1940 | usba_writel(udc, CTRL, USBA_DISABLE_MASK); | 1941 | usba_writel(udc, CTRL, USBA_DISABLE_MASK); |
1941 | clk_disable(pclk); | 1942 | clk_disable(pclk); |
1942 | 1943 | ||
1943 | usba_ep = kmalloc(sizeof(struct usba_ep) * pdata->num_ep, | 1944 | usba_ep = kzalloc(sizeof(struct usba_ep) * pdata->num_ep, |
1944 | GFP_KERNEL); | 1945 | GFP_KERNEL); |
1945 | if (!usba_ep) | 1946 | if (!usba_ep) |
1946 | goto err_alloc_ep; | 1947 | goto err_alloc_ep; |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index cd07ea3f0c63..15438469f21a 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -1658,6 +1658,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, | |||
1658 | u32 reg_base, or_reg, skip_reg; | 1658 | u32 reg_base, or_reg, skip_reg; |
1659 | unsigned long flags; | 1659 | unsigned long flags; |
1660 | struct ptd ptd; | 1660 | struct ptd ptd; |
1661 | packet_enqueue *pe; | ||
1661 | 1662 | ||
1662 | switch (usb_pipetype(urb->pipe)) { | 1663 | switch (usb_pipetype(urb->pipe)) { |
1663 | case PIPE_ISOCHRONOUS: | 1664 | case PIPE_ISOCHRONOUS: |
@@ -1669,6 +1670,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, | |||
1669 | reg_base = INT_REGS_OFFSET; | 1670 | reg_base = INT_REGS_OFFSET; |
1670 | or_reg = HC_INT_IRQ_MASK_OR_REG; | 1671 | or_reg = HC_INT_IRQ_MASK_OR_REG; |
1671 | skip_reg = HC_INT_PTD_SKIPMAP_REG; | 1672 | skip_reg = HC_INT_PTD_SKIPMAP_REG; |
1673 | pe = enqueue_an_INT_packet; | ||
1672 | break; | 1674 | break; |
1673 | 1675 | ||
1674 | default: | 1676 | default: |
@@ -1676,6 +1678,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, | |||
1676 | reg_base = ATL_REGS_OFFSET; | 1678 | reg_base = ATL_REGS_OFFSET; |
1677 | or_reg = HC_ATL_IRQ_MASK_OR_REG; | 1679 | or_reg = HC_ATL_IRQ_MASK_OR_REG; |
1678 | skip_reg = HC_ATL_PTD_SKIPMAP_REG; | 1680 | skip_reg = HC_ATL_PTD_SKIPMAP_REG; |
1681 | pe = enqueue_an_ATL_packet; | ||
1679 | break; | 1682 | break; |
1680 | } | 1683 | } |
1681 | 1684 | ||
@@ -1687,6 +1690,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, | |||
1687 | u32 skip_map; | 1690 | u32 skip_map; |
1688 | u32 or_map; | 1691 | u32 or_map; |
1689 | struct isp1760_qtd *qtd; | 1692 | struct isp1760_qtd *qtd; |
1693 | struct isp1760_qh *qh = ints->qh; | ||
1690 | 1694 | ||
1691 | skip_map = isp1760_readl(hcd->regs + skip_reg); | 1695 | skip_map = isp1760_readl(hcd->regs + skip_reg); |
1692 | skip_map |= 1 << i; | 1696 | skip_map |= 1 << i; |
@@ -1699,8 +1703,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, | |||
1699 | priv_write_copy(priv, (u32 *)&ptd, hcd->regs + reg_base | 1703 | priv_write_copy(priv, (u32 *)&ptd, hcd->regs + reg_base |
1700 | + i * sizeof(ptd), sizeof(ptd)); | 1704 | + i * sizeof(ptd), sizeof(ptd)); |
1701 | qtd = ints->qtd; | 1705 | qtd = ints->qtd; |
1702 | 1706 | qtd = clean_up_qtdlist(qtd); | |
1703 | clean_up_qtdlist(qtd); | ||
1704 | 1707 | ||
1705 | free_mem(priv, ints->payload); | 1708 | free_mem(priv, ints->payload); |
1706 | 1709 | ||
@@ -1711,7 +1714,24 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, | |||
1711 | ints->payload = 0; | 1714 | ints->payload = 0; |
1712 | 1715 | ||
1713 | isp1760_urb_done(priv, urb, status); | 1716 | isp1760_urb_done(priv, urb, status); |
1717 | if (qtd) | ||
1718 | pe(hcd, qh, qtd); | ||
1714 | break; | 1719 | break; |
1720 | |||
1721 | } else if (ints->qtd) { | ||
1722 | struct isp1760_qtd *qtd, *prev_qtd = ints->qtd; | ||
1723 | |||
1724 | for (qtd = ints->qtd->hw_next; qtd; qtd = qtd->hw_next) { | ||
1725 | if (qtd->urb == urb) { | ||
1726 | prev_qtd->hw_next = clean_up_qtdlist(qtd); | ||
1727 | isp1760_urb_done(priv, urb, status); | ||
1728 | break; | ||
1729 | } | ||
1730 | prev_qtd = qtd; | ||
1731 | } | ||
1732 | /* we found the urb before the end of the list */ | ||
1733 | if (qtd) | ||
1734 | break; | ||
1715 | } | 1735 | } |
1716 | ints++; | 1736 | ints++; |
1717 | } | 1737 | } |
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index 7cf74f8c2db1..b0dbf4157d29 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c | |||
@@ -47,7 +47,7 @@ static int usb_hcd_ep93xx_probe(const struct hc_driver *driver, | |||
47 | struct usb_hcd *hcd; | 47 | struct usb_hcd *hcd; |
48 | 48 | ||
49 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { | 49 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { |
50 | pr_debug("resource[1] is not IORESOURCE_IRQ"); | 50 | dbg("resource[1] is not IORESOURCE_IRQ"); |
51 | return -ENOMEM; | 51 | return -ENOMEM; |
52 | } | 52 | } |
53 | 53 | ||
@@ -65,12 +65,18 @@ static int usb_hcd_ep93xx_probe(const struct hc_driver *driver, | |||
65 | 65 | ||
66 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | 66 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); |
67 | if (hcd->regs == NULL) { | 67 | if (hcd->regs == NULL) { |
68 | pr_debug("ioremap failed"); | 68 | dbg("ioremap failed"); |
69 | retval = -ENOMEM; | 69 | retval = -ENOMEM; |
70 | goto err2; | 70 | goto err2; |
71 | } | 71 | } |
72 | 72 | ||
73 | usb_host_clock = clk_get(&pdev->dev, "usb_host"); | 73 | usb_host_clock = clk_get(&pdev->dev, NULL); |
74 | if (IS_ERR(usb_host_clock)) { | ||
75 | dbg("clk_get failed"); | ||
76 | retval = PTR_ERR(usb_host_clock); | ||
77 | goto err3; | ||
78 | } | ||
79 | |||
74 | ep93xx_start_hc(&pdev->dev); | 80 | ep93xx_start_hc(&pdev->dev); |
75 | 81 | ||
76 | ohci_hcd_init(hcd_to_ohci(hcd)); | 82 | ohci_hcd_init(hcd_to_ohci(hcd)); |
@@ -80,6 +86,7 @@ static int usb_hcd_ep93xx_probe(const struct hc_driver *driver, | |||
80 | return retval; | 86 | return retval; |
81 | 87 | ||
82 | ep93xx_stop_hc(&pdev->dev); | 88 | ep93xx_stop_hc(&pdev->dev); |
89 | err3: | ||
83 | iounmap(hcd->regs); | 90 | iounmap(hcd->regs); |
84 | err2: | 91 | err2: |
85 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 92 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 0a566eea49c0..f331e2bde88a 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -974,6 +974,7 @@ int usb_serial_probe(struct usb_interface *interface, | |||
974 | if (retval > 0) { | 974 | if (retval > 0) { |
975 | /* quietly accept this device, but don't bind to a | 975 | /* quietly accept this device, but don't bind to a |
976 | serial port as it's about to disappear */ | 976 | serial port as it's about to disappear */ |
977 | serial->num_ports = 0; | ||
977 | goto exit; | 978 | goto exit; |
978 | } | 979 | } |
979 | } | 980 | } |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 0048f1185a60..8083d862ebc5 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -397,7 +397,7 @@ config FB_SA1100 | |||
397 | 397 | ||
398 | config FB_IMX | 398 | config FB_IMX |
399 | tristate "Motorola i.MX LCD support" | 399 | tristate "Motorola i.MX LCD support" |
400 | depends on FB && (ARCH_IMX || ARCH_MX2) | 400 | depends on FB && (ARCH_MX1 || ARCH_MX2) |
401 | select FB_CFB_FILLRECT | 401 | select FB_CFB_FILLRECT |
402 | select FB_CFB_COPYAREA | 402 | select FB_CFB_COPYAREA |
403 | select FB_CFB_IMAGEBLIT | 403 | select FB_CFB_IMAGEBLIT |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 9a577a800db5..2fb63f6ea2f1 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -29,14 +29,8 @@ | |||
29 | 29 | ||
30 | /* configurable parameters */ | 30 | /* configurable parameters */ |
31 | #define ATMEL_LCDC_CVAL_DEFAULT 0xc8 | 31 | #define ATMEL_LCDC_CVAL_DEFAULT 0xc8 |
32 | #define ATMEL_LCDC_DMA_BURST_LEN 8 | 32 | #define ATMEL_LCDC_DMA_BURST_LEN 8 /* words */ |
33 | 33 | #define ATMEL_LCDC_FIFO_SIZE 512 /* words */ | |
34 | #if defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91CAP9) || \ | ||
35 | defined(CONFIG_ARCH_AT91SAM9RL) | ||
36 | #define ATMEL_LCDC_FIFO_SIZE 2048 | ||
37 | #else | ||
38 | #define ATMEL_LCDC_FIFO_SIZE 512 | ||
39 | #endif | ||
40 | 34 | ||
41 | #if defined(CONFIG_ARCH_AT91) | 35 | #if defined(CONFIG_ARCH_AT91) |
42 | #define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \ | 36 | #define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \ |
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c index 9894de1c9b9f..b7af5256e887 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/mx3fb.c | |||
@@ -706,7 +706,7 @@ static void mx3fb_dma_done(void *arg) | |||
706 | dev_dbg(mx3fb->dev, "irq %d callback\n", ichannel->eof_irq); | 706 | dev_dbg(mx3fb->dev, "irq %d callback\n", ichannel->eof_irq); |
707 | 707 | ||
708 | /* We only need one interrupt, it will be re-enabled as needed */ | 708 | /* We only need one interrupt, it will be re-enabled as needed */ |
709 | disable_irq(ichannel->eof_irq); | 709 | disable_irq_nosync(ichannel->eof_irq); |
710 | 710 | ||
711 | complete(&mx3_fbi->flip_cmpl); | 711 | complete(&mx3_fbi->flip_cmpl); |
712 | } | 712 | } |
@@ -1366,7 +1366,7 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan) | |||
1366 | 1366 | ||
1367 | mx3fb_blank(FB_BLANK_UNBLANK, fbi); | 1367 | mx3fb_blank(FB_BLANK_UNBLANK, fbi); |
1368 | 1368 | ||
1369 | dev_info(dev, "mx3fb: fb registered, using mode %s\n", fb_mode); | 1369 | dev_info(dev, "registered, using mode %s\n", fb_mode); |
1370 | 1370 | ||
1371 | ret = register_framebuffer(fbi); | 1371 | ret = register_framebuffer(fbi); |
1372 | if (ret < 0) | 1372 | if (ret < 0) |
diff --git a/drivers/video/omap/hwa742.c b/drivers/video/omap/hwa742.c index 8aa6e47202b9..5d4f34887a22 100644 --- a/drivers/video/omap/hwa742.c +++ b/drivers/video/omap/hwa742.c | |||
@@ -133,8 +133,7 @@ struct { | |||
133 | struct lcd_ctrl_extif *extif; | 133 | struct lcd_ctrl_extif *extif; |
134 | struct lcd_ctrl *int_ctrl; | 134 | struct lcd_ctrl *int_ctrl; |
135 | 135 | ||
136 | void (*power_up)(struct device *dev); | 136 | struct clk *sys_ck; |
137 | void (*power_down)(struct device *dev); | ||
138 | } hwa742; | 137 | } hwa742; |
139 | 138 | ||
140 | struct lcd_ctrl hwa742_ctrl; | 139 | struct lcd_ctrl hwa742_ctrl; |
@@ -915,14 +914,13 @@ static void hwa742_suspend(void) | |||
915 | hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED); | 914 | hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED); |
916 | /* Enable sleep mode */ | 915 | /* Enable sleep mode */ |
917 | hwa742_write_reg(HWA742_POWER_SAVE, 1 << 1); | 916 | hwa742_write_reg(HWA742_POWER_SAVE, 1 << 1); |
918 | if (hwa742.power_down != NULL) | 917 | clk_disable(hwa742.sys_ck); |
919 | hwa742.power_down(hwa742.fbdev->dev); | ||
920 | } | 918 | } |
921 | 919 | ||
922 | static void hwa742_resume(void) | 920 | static void hwa742_resume(void) |
923 | { | 921 | { |
924 | if (hwa742.power_up != NULL) | 922 | clk_enable(hwa742.sys_ck); |
925 | hwa742.power_up(hwa742.fbdev->dev); | 923 | |
926 | /* Disable sleep mode */ | 924 | /* Disable sleep mode */ |
927 | hwa742_write_reg(HWA742_POWER_SAVE, 0); | 925 | hwa742_write_reg(HWA742_POWER_SAVE, 0); |
928 | while (1) { | 926 | while (1) { |
@@ -955,14 +953,13 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode, | |||
955 | omapfb_conf = fbdev->dev->platform_data; | 953 | omapfb_conf = fbdev->dev->platform_data; |
956 | ctrl_conf = omapfb_conf->ctrl_platform_data; | 954 | ctrl_conf = omapfb_conf->ctrl_platform_data; |
957 | 955 | ||
958 | if (ctrl_conf == NULL || ctrl_conf->get_clock_rate == NULL) { | 956 | if (ctrl_conf == NULL) { |
959 | dev_err(fbdev->dev, "HWA742: missing platform data\n"); | 957 | dev_err(fbdev->dev, "HWA742: missing platform data\n"); |
960 | r = -ENOENT; | 958 | r = -ENOENT; |
961 | goto err1; | 959 | goto err1; |
962 | } | 960 | } |
963 | 961 | ||
964 | hwa742.power_down = ctrl_conf->power_down; | 962 | hwa742.sys_ck = clk_get(NULL, "hwa_sys_ck"); |
965 | hwa742.power_up = ctrl_conf->power_up; | ||
966 | 963 | ||
967 | spin_lock_init(&hwa742.req_lock); | 964 | spin_lock_init(&hwa742.req_lock); |
968 | 965 | ||
@@ -972,12 +969,11 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode, | |||
972 | if ((r = hwa742.extif->init(fbdev)) < 0) | 969 | if ((r = hwa742.extif->init(fbdev)) < 0) |
973 | goto err2; | 970 | goto err2; |
974 | 971 | ||
975 | ext_clk = ctrl_conf->get_clock_rate(fbdev->dev); | 972 | ext_clk = clk_get_rate(hwa742.sys_ck); |
976 | if ((r = calc_extif_timings(ext_clk, &extif_mem_div)) < 0) | 973 | if ((r = calc_extif_timings(ext_clk, &extif_mem_div)) < 0) |
977 | goto err3; | 974 | goto err3; |
978 | hwa742.extif->set_timings(&hwa742.reg_timings); | 975 | hwa742.extif->set_timings(&hwa742.reg_timings); |
979 | if (hwa742.power_up != NULL) | 976 | clk_enable(hwa742.sys_ck); |
980 | hwa742.power_up(fbdev->dev); | ||
981 | 977 | ||
982 | calc_hwa742_clk_rates(ext_clk, &sys_clk, &pix_clk); | 978 | calc_hwa742_clk_rates(ext_clk, &sys_clk, &pix_clk); |
983 | if ((r = calc_extif_timings(sys_clk, &extif_mem_div)) < 0) | 979 | if ((r = calc_extif_timings(sys_clk, &extif_mem_div)) < 0) |
@@ -1040,8 +1036,7 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode, | |||
1040 | 1036 | ||
1041 | return 0; | 1037 | return 0; |
1042 | err4: | 1038 | err4: |
1043 | if (hwa742.power_down != NULL) | 1039 | clk_disable(hwa742.sys_ck); |
1044 | hwa742.power_down(fbdev->dev); | ||
1045 | err3: | 1040 | err3: |
1046 | hwa742.extif->cleanup(); | 1041 | hwa742.extif->cleanup(); |
1047 | err2: | 1042 | err2: |
@@ -1055,8 +1050,7 @@ static void hwa742_cleanup(void) | |||
1055 | hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED); | 1050 | hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED); |
1056 | hwa742.extif->cleanup(); | 1051 | hwa742.extif->cleanup(); |
1057 | hwa742.int_ctrl->cleanup(); | 1052 | hwa742.int_ctrl->cleanup(); |
1058 | if (hwa742.power_down != NULL) | 1053 | clk_disable(hwa742.sys_ck); |
1059 | hwa742.power_down(hwa742.fbdev->dev); | ||
1060 | } | 1054 | } |
1061 | 1055 | ||
1062 | struct lcd_ctrl hwa742_ctrl = { | 1056 | struct lcd_ctrl hwa742_ctrl = { |
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 5e9c6302433b..d3a568e6b169 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
@@ -947,7 +947,8 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev) | |||
947 | int win; | 947 | int win; |
948 | 948 | ||
949 | for (win = 0; win <= S3C_FB_MAX_WIN; win++) | 949 | for (win = 0; win <= S3C_FB_MAX_WIN; win++) |
950 | s3c_fb_release_win(sfb, sfb->windows[win]); | 950 | if (sfb->windows[win]) |
951 | s3c_fb_release_win(sfb, sfb->windows[win]); | ||
951 | 952 | ||
952 | iounmap(sfb->regs); | 953 | iounmap(sfb->regs); |
953 | 954 | ||
@@ -985,11 +986,20 @@ static int s3c_fb_suspend(struct platform_device *pdev, pm_message_t state) | |||
985 | static int s3c_fb_resume(struct platform_device *pdev) | 986 | static int s3c_fb_resume(struct platform_device *pdev) |
986 | { | 987 | { |
987 | struct s3c_fb *sfb = platform_get_drvdata(pdev); | 988 | struct s3c_fb *sfb = platform_get_drvdata(pdev); |
989 | struct s3c_fb_platdata *pd = sfb->pdata; | ||
988 | struct s3c_fb_win *win; | 990 | struct s3c_fb_win *win; |
989 | int win_no; | 991 | int win_no; |
990 | 992 | ||
991 | clk_enable(sfb->bus_clk); | 993 | clk_enable(sfb->bus_clk); |
992 | 994 | ||
995 | /* setup registers */ | ||
996 | writel(pd->vidcon1, sfb->regs + VIDCON1); | ||
997 | |||
998 | /* zero all windows before we do anything */ | ||
999 | for (win_no = 0; win_no < S3C_FB_MAX_WIN; win_no++) | ||
1000 | s3c_fb_clear_win(sfb, win_no); | ||
1001 | |||
1002 | /* restore framebuffers */ | ||
993 | for (win_no = 0; win_no < S3C_FB_MAX_WIN; win_no++) { | 1003 | for (win_no = 0; win_no < S3C_FB_MAX_WIN; win_no++) { |
994 | win = sfb->windows[win_no]; | 1004 | win = sfb->windows[win_no]; |
995 | if (!win) | 1005 | if (!win) |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 5eb8f21da82e..5744cac4864b 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -231,14 +231,14 @@ config DAVINCI_WATCHDOG | |||
231 | NOTE: once enabled, this timer cannot be disabled. | 231 | NOTE: once enabled, this timer cannot be disabled. |
232 | Say N if you are unsure. | 232 | Say N if you are unsure. |
233 | 233 | ||
234 | config ORION5X_WATCHDOG | 234 | config ORION_WATCHDOG |
235 | tristate "Orion5x watchdog" | 235 | tristate "Orion watchdog" |
236 | depends on ARCH_ORION5X | 236 | depends on ARCH_ORION5X || ARCH_KIRKWOOD |
237 | help | 237 | help |
238 | Say Y here if to include support for the watchdog timer | 238 | Say Y here if to include support for the watchdog timer |
239 | in the Orion5x ARM SoCs. | 239 | in the Marvell Orion5x and Kirkwood ARM SoCs. |
240 | To compile this driver as a module, choose M here: the | 240 | To compile this driver as a module, choose M here: the |
241 | module will be called orion5x_wdt. | 241 | module will be called orion_wdt. |
242 | 242 | ||
243 | # AVR32 Architecture | 243 | # AVR32 Architecture |
244 | 244 | ||
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 7f8c56b14f58..c3afa14d5be1 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -40,7 +40,7 @@ obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o | |||
40 | obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o | 40 | obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o |
41 | obj-$(CONFIG_IOP_WATCHDOG) += iop_wdt.o | 41 | obj-$(CONFIG_IOP_WATCHDOG) += iop_wdt.o |
42 | obj-$(CONFIG_DAVINCI_WATCHDOG) += davinci_wdt.o | 42 | obj-$(CONFIG_DAVINCI_WATCHDOG) += davinci_wdt.o |
43 | obj-$(CONFIG_ORION5X_WATCHDOG) += orion5x_wdt.o | 43 | obj-$(CONFIG_ORION_WATCHDOG) += orion_wdt.o |
44 | 44 | ||
45 | # AVR32 Architecture | 45 | # AVR32 Architecture |
46 | obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o | 46 | obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o |
diff --git a/drivers/watchdog/orion5x_wdt.c b/drivers/watchdog/orion_wdt.c index 2cde568e4fb0..2d9fb96a9ee9 100644 --- a/drivers/watchdog/orion5x_wdt.c +++ b/drivers/watchdog/orion_wdt.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/watchdog/orion5x_wdt.c | 2 | * drivers/watchdog/orion_wdt.c |
3 | * | 3 | * |
4 | * Watchdog driver for Orion5x processors | 4 | * Watchdog driver for Orion/Kirkwood processors |
5 | * | 5 | * |
6 | * Author: Sylver Bruneau <sylver.bruneau@googlemail.com> | 6 | * Author: Sylver Bruneau <sylver.bruneau@googlemail.com> |
7 | * | 7 | * |
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
25 | #include <mach/bridge-regs.h> | 25 | #include <mach/bridge-regs.h> |
26 | #include <plat/orion5x_wdt.h> | 26 | #include <plat/orion_wdt.h> |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * Watchdog timer block registers. | 29 | * Watchdog timer block registers. |
@@ -43,7 +43,7 @@ static unsigned int wdt_tclk; | |||
43 | static unsigned long wdt_status; | 43 | static unsigned long wdt_status; |
44 | static spinlock_t wdt_lock; | 44 | static spinlock_t wdt_lock; |
45 | 45 | ||
46 | static void orion5x_wdt_ping(void) | 46 | static void orion_wdt_ping(void) |
47 | { | 47 | { |
48 | spin_lock(&wdt_lock); | 48 | spin_lock(&wdt_lock); |
49 | 49 | ||
@@ -53,7 +53,7 @@ static void orion5x_wdt_ping(void) | |||
53 | spin_unlock(&wdt_lock); | 53 | spin_unlock(&wdt_lock); |
54 | } | 54 | } |
55 | 55 | ||
56 | static void orion5x_wdt_enable(void) | 56 | static void orion_wdt_enable(void) |
57 | { | 57 | { |
58 | u32 reg; | 58 | u32 reg; |
59 | 59 | ||
@@ -73,23 +73,23 @@ static void orion5x_wdt_enable(void) | |||
73 | writel(reg, TIMER_CTRL); | 73 | writel(reg, TIMER_CTRL); |
74 | 74 | ||
75 | /* Enable reset on watchdog */ | 75 | /* Enable reset on watchdog */ |
76 | reg = readl(CPU_RESET_MASK); | 76 | reg = readl(RSTOUTn_MASK); |
77 | reg |= WDT_RESET; | 77 | reg |= WDT_RESET_OUT_EN; |
78 | writel(reg, CPU_RESET_MASK); | 78 | writel(reg, RSTOUTn_MASK); |
79 | 79 | ||
80 | spin_unlock(&wdt_lock); | 80 | spin_unlock(&wdt_lock); |
81 | } | 81 | } |
82 | 82 | ||
83 | static void orion5x_wdt_disable(void) | 83 | static void orion_wdt_disable(void) |
84 | { | 84 | { |
85 | u32 reg; | 85 | u32 reg; |
86 | 86 | ||
87 | spin_lock(&wdt_lock); | 87 | spin_lock(&wdt_lock); |
88 | 88 | ||
89 | /* Disable reset on watchdog */ | 89 | /* Disable reset on watchdog */ |
90 | reg = readl(CPU_RESET_MASK); | 90 | reg = readl(RSTOUTn_MASK); |
91 | reg &= ~WDT_RESET; | 91 | reg &= ~WDT_RESET_OUT_EN; |
92 | writel(reg, CPU_RESET_MASK); | 92 | writel(reg, RSTOUTn_MASK); |
93 | 93 | ||
94 | /* Disable watchdog timer */ | 94 | /* Disable watchdog timer */ |
95 | reg = readl(TIMER_CTRL); | 95 | reg = readl(TIMER_CTRL); |
@@ -99,7 +99,7 @@ static void orion5x_wdt_disable(void) | |||
99 | spin_unlock(&wdt_lock); | 99 | spin_unlock(&wdt_lock); |
100 | } | 100 | } |
101 | 101 | ||
102 | static int orion5x_wdt_get_timeleft(int *time_left) | 102 | static int orion_wdt_get_timeleft(int *time_left) |
103 | { | 103 | { |
104 | spin_lock(&wdt_lock); | 104 | spin_lock(&wdt_lock); |
105 | *time_left = readl(WDT_VAL) / wdt_tclk; | 105 | *time_left = readl(WDT_VAL) / wdt_tclk; |
@@ -107,16 +107,16 @@ static int orion5x_wdt_get_timeleft(int *time_left) | |||
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | static int orion5x_wdt_open(struct inode *inode, struct file *file) | 110 | static int orion_wdt_open(struct inode *inode, struct file *file) |
111 | { | 111 | { |
112 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | 112 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) |
113 | return -EBUSY; | 113 | return -EBUSY; |
114 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | 114 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); |
115 | orion5x_wdt_enable(); | 115 | orion_wdt_enable(); |
116 | return nonseekable_open(inode, file); | 116 | return nonseekable_open(inode, file); |
117 | } | 117 | } |
118 | 118 | ||
119 | static ssize_t orion5x_wdt_write(struct file *file, const char *data, | 119 | static ssize_t orion_wdt_write(struct file *file, const char *data, |
120 | size_t len, loff_t *ppos) | 120 | size_t len, loff_t *ppos) |
121 | { | 121 | { |
122 | if (len) { | 122 | if (len) { |
@@ -133,18 +133,18 @@ static ssize_t orion5x_wdt_write(struct file *file, const char *data, | |||
133 | set_bit(WDT_OK_TO_CLOSE, &wdt_status); | 133 | set_bit(WDT_OK_TO_CLOSE, &wdt_status); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | orion5x_wdt_ping(); | 136 | orion_wdt_ping(); |
137 | } | 137 | } |
138 | return len; | 138 | return len; |
139 | } | 139 | } |
140 | 140 | ||
141 | static int orion5x_wdt_settimeout(int new_time) | 141 | static int orion_wdt_settimeout(int new_time) |
142 | { | 142 | { |
143 | if ((new_time <= 0) || (new_time > wdt_max_duration)) | 143 | if ((new_time <= 0) || (new_time > wdt_max_duration)) |
144 | return -EINVAL; | 144 | return -EINVAL; |
145 | 145 | ||
146 | /* Set new watchdog time to be used when | 146 | /* Set new watchdog time to be used when |
147 | * orion5x_wdt_enable() or orion5x_wdt_ping() is called. */ | 147 | * orion_wdt_enable() or orion_wdt_ping() is called. */ |
148 | heartbeat = new_time; | 148 | heartbeat = new_time; |
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
@@ -152,10 +152,10 @@ static int orion5x_wdt_settimeout(int new_time) | |||
152 | static const struct watchdog_info ident = { | 152 | static const struct watchdog_info ident = { |
153 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | | 153 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | |
154 | WDIOF_KEEPALIVEPING, | 154 | WDIOF_KEEPALIVEPING, |
155 | .identity = "Orion5x Watchdog", | 155 | .identity = "Orion Watchdog", |
156 | }; | 156 | }; |
157 | 157 | ||
158 | static long orion5x_wdt_ioctl(struct file *file, unsigned int cmd, | 158 | static long orion_wdt_ioctl(struct file *file, unsigned int cmd, |
159 | unsigned long arg) | 159 | unsigned long arg) |
160 | { | 160 | { |
161 | int ret = -ENOTTY; | 161 | int ret = -ENOTTY; |
@@ -173,7 +173,7 @@ static long orion5x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
173 | break; | 173 | break; |
174 | 174 | ||
175 | case WDIOC_KEEPALIVE: | 175 | case WDIOC_KEEPALIVE: |
176 | orion5x_wdt_ping(); | 176 | orion_wdt_ping(); |
177 | ret = 0; | 177 | ret = 0; |
178 | break; | 178 | break; |
179 | 179 | ||
@@ -182,11 +182,11 @@ static long orion5x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
182 | if (ret) | 182 | if (ret) |
183 | break; | 183 | break; |
184 | 184 | ||
185 | if (orion5x_wdt_settimeout(time)) { | 185 | if (orion_wdt_settimeout(time)) { |
186 | ret = -EINVAL; | 186 | ret = -EINVAL; |
187 | break; | 187 | break; |
188 | } | 188 | } |
189 | orion5x_wdt_ping(); | 189 | orion_wdt_ping(); |
190 | /* Fall through */ | 190 | /* Fall through */ |
191 | 191 | ||
192 | case WDIOC_GETTIMEOUT: | 192 | case WDIOC_GETTIMEOUT: |
@@ -194,7 +194,7 @@ static long orion5x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
194 | break; | 194 | break; |
195 | 195 | ||
196 | case WDIOC_GETTIMELEFT: | 196 | case WDIOC_GETTIMELEFT: |
197 | if (orion5x_wdt_get_timeleft(&time)) { | 197 | if (orion_wdt_get_timeleft(&time)) { |
198 | ret = -EINVAL; | 198 | ret = -EINVAL; |
199 | break; | 199 | break; |
200 | } | 200 | } |
@@ -204,10 +204,10 @@ static long orion5x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
204 | return ret; | 204 | return ret; |
205 | } | 205 | } |
206 | 206 | ||
207 | static int orion5x_wdt_release(struct inode *inode, struct file *file) | 207 | static int orion_wdt_release(struct inode *inode, struct file *file) |
208 | { | 208 | { |
209 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | 209 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) |
210 | orion5x_wdt_disable(); | 210 | orion_wdt_disable(); |
211 | else | 211 | else |
212 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - " | 212 | printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - " |
213 | "timer will not stop\n"); | 213 | "timer will not stop\n"); |
@@ -218,98 +218,98 @@ static int orion5x_wdt_release(struct inode *inode, struct file *file) | |||
218 | } | 218 | } |
219 | 219 | ||
220 | 220 | ||
221 | static const struct file_operations orion5x_wdt_fops = { | 221 | static const struct file_operations orion_wdt_fops = { |
222 | .owner = THIS_MODULE, | 222 | .owner = THIS_MODULE, |
223 | .llseek = no_llseek, | 223 | .llseek = no_llseek, |
224 | .write = orion5x_wdt_write, | 224 | .write = orion_wdt_write, |
225 | .unlocked_ioctl = orion5x_wdt_ioctl, | 225 | .unlocked_ioctl = orion_wdt_ioctl, |
226 | .open = orion5x_wdt_open, | 226 | .open = orion_wdt_open, |
227 | .release = orion5x_wdt_release, | 227 | .release = orion_wdt_release, |
228 | }; | 228 | }; |
229 | 229 | ||
230 | static struct miscdevice orion5x_wdt_miscdev = { | 230 | static struct miscdevice orion_wdt_miscdev = { |
231 | .minor = WATCHDOG_MINOR, | 231 | .minor = WATCHDOG_MINOR, |
232 | .name = "watchdog", | 232 | .name = "watchdog", |
233 | .fops = &orion5x_wdt_fops, | 233 | .fops = &orion_wdt_fops, |
234 | }; | 234 | }; |
235 | 235 | ||
236 | static int __devinit orion5x_wdt_probe(struct platform_device *pdev) | 236 | static int __devinit orion_wdt_probe(struct platform_device *pdev) |
237 | { | 237 | { |
238 | struct orion5x_wdt_platform_data *pdata = pdev->dev.platform_data; | 238 | struct orion_wdt_platform_data *pdata = pdev->dev.platform_data; |
239 | int ret; | 239 | int ret; |
240 | 240 | ||
241 | if (pdata) { | 241 | if (pdata) { |
242 | wdt_tclk = pdata->tclk; | 242 | wdt_tclk = pdata->tclk; |
243 | } else { | 243 | } else { |
244 | printk(KERN_ERR "Orion5x Watchdog misses platform data\n"); | 244 | printk(KERN_ERR "Orion Watchdog misses platform data\n"); |
245 | return -ENODEV; | 245 | return -ENODEV; |
246 | } | 246 | } |
247 | 247 | ||
248 | if (orion5x_wdt_miscdev.parent) | 248 | if (orion_wdt_miscdev.parent) |
249 | return -EBUSY; | 249 | return -EBUSY; |
250 | orion5x_wdt_miscdev.parent = &pdev->dev; | 250 | orion_wdt_miscdev.parent = &pdev->dev; |
251 | 251 | ||
252 | wdt_max_duration = WDT_MAX_CYCLE_COUNT / wdt_tclk; | 252 | wdt_max_duration = WDT_MAX_CYCLE_COUNT / wdt_tclk; |
253 | if (orion5x_wdt_settimeout(heartbeat)) | 253 | if (orion_wdt_settimeout(heartbeat)) |
254 | heartbeat = wdt_max_duration; | 254 | heartbeat = wdt_max_duration; |
255 | 255 | ||
256 | ret = misc_register(&orion5x_wdt_miscdev); | 256 | ret = misc_register(&orion_wdt_miscdev); |
257 | if (ret) | 257 | if (ret) |
258 | return ret; | 258 | return ret; |
259 | 259 | ||
260 | printk(KERN_INFO "Orion5x Watchdog Timer: Initial timeout %d sec%s\n", | 260 | printk(KERN_INFO "Orion Watchdog Timer: Initial timeout %d sec%s\n", |
261 | heartbeat, nowayout ? ", nowayout" : ""); | 261 | heartbeat, nowayout ? ", nowayout" : ""); |
262 | return 0; | 262 | return 0; |
263 | } | 263 | } |
264 | 264 | ||
265 | static int __devexit orion5x_wdt_remove(struct platform_device *pdev) | 265 | static int __devexit orion_wdt_remove(struct platform_device *pdev) |
266 | { | 266 | { |
267 | int ret; | 267 | int ret; |
268 | 268 | ||
269 | if (test_bit(WDT_IN_USE, &wdt_status)) { | 269 | if (test_bit(WDT_IN_USE, &wdt_status)) { |
270 | orion5x_wdt_disable(); | 270 | orion_wdt_disable(); |
271 | clear_bit(WDT_IN_USE, &wdt_status); | 271 | clear_bit(WDT_IN_USE, &wdt_status); |
272 | } | 272 | } |
273 | 273 | ||
274 | ret = misc_deregister(&orion5x_wdt_miscdev); | 274 | ret = misc_deregister(&orion_wdt_miscdev); |
275 | if (!ret) | 275 | if (!ret) |
276 | orion5x_wdt_miscdev.parent = NULL; | 276 | orion_wdt_miscdev.parent = NULL; |
277 | 277 | ||
278 | return ret; | 278 | return ret; |
279 | } | 279 | } |
280 | 280 | ||
281 | static void orion5x_wdt_shutdown(struct platform_device *pdev) | 281 | static void orion_wdt_shutdown(struct platform_device *pdev) |
282 | { | 282 | { |
283 | if (test_bit(WDT_IN_USE, &wdt_status)) | 283 | if (test_bit(WDT_IN_USE, &wdt_status)) |
284 | orion5x_wdt_disable(); | 284 | orion_wdt_disable(); |
285 | } | 285 | } |
286 | 286 | ||
287 | static struct platform_driver orion5x_wdt_driver = { | 287 | static struct platform_driver orion_wdt_driver = { |
288 | .probe = orion5x_wdt_probe, | 288 | .probe = orion_wdt_probe, |
289 | .remove = __devexit_p(orion5x_wdt_remove), | 289 | .remove = __devexit_p(orion_wdt_remove), |
290 | .shutdown = orion5x_wdt_shutdown, | 290 | .shutdown = orion_wdt_shutdown, |
291 | .driver = { | 291 | .driver = { |
292 | .owner = THIS_MODULE, | 292 | .owner = THIS_MODULE, |
293 | .name = "orion5x_wdt", | 293 | .name = "orion_wdt", |
294 | }, | 294 | }, |
295 | }; | 295 | }; |
296 | 296 | ||
297 | static int __init orion5x_wdt_init(void) | 297 | static int __init orion_wdt_init(void) |
298 | { | 298 | { |
299 | spin_lock_init(&wdt_lock); | 299 | spin_lock_init(&wdt_lock); |
300 | return platform_driver_register(&orion5x_wdt_driver); | 300 | return platform_driver_register(&orion_wdt_driver); |
301 | } | 301 | } |
302 | 302 | ||
303 | static void __exit orion5x_wdt_exit(void) | 303 | static void __exit orion_wdt_exit(void) |
304 | { | 304 | { |
305 | platform_driver_unregister(&orion5x_wdt_driver); | 305 | platform_driver_unregister(&orion_wdt_driver); |
306 | } | 306 | } |
307 | 307 | ||
308 | module_init(orion5x_wdt_init); | 308 | module_init(orion_wdt_init); |
309 | module_exit(orion5x_wdt_exit); | 309 | module_exit(orion_wdt_exit); |
310 | 310 | ||
311 | MODULE_AUTHOR("Sylver Bruneau <sylver.bruneau@googlemail.com>"); | 311 | MODULE_AUTHOR("Sylver Bruneau <sylver.bruneau@googlemail.com>"); |
312 | MODULE_DESCRIPTION("Orion5x Processor Watchdog"); | 312 | MODULE_DESCRIPTION("Orion Processor Watchdog"); |
313 | 313 | ||
314 | module_param(heartbeat, int, 0); | 314 | module_param(heartbeat, int, 0); |
315 | MODULE_PARM_DESC(heartbeat, "Initial watchdog heartbeat in seconds"); | 315 | MODULE_PARM_DESC(heartbeat, "Initial watchdog heartbeat in seconds"); |