diff options
author | Jens Axboe <axboe@kernel.dk> | 2013-07-02 02:31:48 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-07-02 02:31:48 -0400 |
commit | 5f0e5afa0de4522abb3ea7d1369039b94e740ec5 (patch) | |
tree | 6a5be3db9ecfed8ef2150c6146f6d1e0d658ac8b /drivers | |
parent | d752b2696072ed52fd5afab08b601e2220a3b87e (diff) | |
parent | 9e895ace5d82df8929b16f58e9f515f6d54ab82d (diff) |
Merge tag 'v3.10-rc7' into for-3.11/drivers
Linux 3.10-rc7
Pull this in early to avoid doing it with the bcache merge,
since there are a number of changes to bcache between my old
base (3.10-rc1) and the new pull request.
Diffstat (limited to 'drivers')
748 files changed, 8659 insertions, 5107 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index ecb743bf05a5..536562c626a2 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -24,7 +24,7 @@ acpi-y += nvs.o | |||
24 | # Power management related files | 24 | # Power management related files |
25 | acpi-y += wakeup.o | 25 | acpi-y += wakeup.o |
26 | acpi-y += sleep.o | 26 | acpi-y += sleep.o |
27 | acpi-$(CONFIG_PM) += device_pm.o | 27 | acpi-y += device_pm.o |
28 | acpi-$(CONFIG_ACPI_SLEEP) += proc.o | 28 | acpi-$(CONFIG_ACPI_SLEEP) += proc.o |
29 | 29 | ||
30 | 30 | ||
@@ -38,7 +38,6 @@ acpi-y += processor_core.o | |||
38 | acpi-y += ec.o | 38 | acpi-y += ec.o |
39 | acpi-$(CONFIG_ACPI_DOCK) += dock.o | 39 | acpi-$(CONFIG_ACPI_DOCK) += dock.o |
40 | acpi-y += pci_root.o pci_link.o pci_irq.o | 40 | acpi-y += pci_root.o pci_link.o pci_irq.o |
41 | acpi-y += csrt.o | ||
42 | acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o | 41 | acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o |
43 | acpi-y += acpi_platform.o | 42 | acpi-y += acpi_platform.o |
44 | acpi-y += power.o | 43 | acpi-y += power.o |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 00d2efd674df..4f4e741d34b2 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/dmi.h> | ||
32 | #include <linux/delay.h> | ||
31 | #ifdef CONFIG_ACPI_PROCFS_POWER | 33 | #ifdef CONFIG_ACPI_PROCFS_POWER |
32 | #include <linux/proc_fs.h> | 34 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 35 | #include <linux/seq_file.h> |
@@ -74,6 +76,8 @@ static int acpi_ac_resume(struct device *dev); | |||
74 | #endif | 76 | #endif |
75 | static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); | 77 | static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); |
76 | 78 | ||
79 | static int ac_sleep_before_get_state_ms; | ||
80 | |||
77 | static struct acpi_driver acpi_ac_driver = { | 81 | static struct acpi_driver acpi_ac_driver = { |
78 | .name = "ac", | 82 | .name = "ac", |
79 | .class = ACPI_AC_CLASS, | 83 | .class = ACPI_AC_CLASS, |
@@ -252,6 +256,16 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) | |||
252 | case ACPI_AC_NOTIFY_STATUS: | 256 | case ACPI_AC_NOTIFY_STATUS: |
253 | case ACPI_NOTIFY_BUS_CHECK: | 257 | case ACPI_NOTIFY_BUS_CHECK: |
254 | case ACPI_NOTIFY_DEVICE_CHECK: | 258 | case ACPI_NOTIFY_DEVICE_CHECK: |
259 | /* | ||
260 | * A buggy BIOS may notify AC first and then sleep for | ||
261 | * a specific time before doing actual operations in the | ||
262 | * EC event handler (_Qxx). This will cause the AC state | ||
263 | * reported by the ACPI event to be incorrect, so wait for a | ||
264 | * specific time for the EC event handler to make progress. | ||
265 | */ | ||
266 | if (ac_sleep_before_get_state_ms > 0) | ||
267 | msleep(ac_sleep_before_get_state_ms); | ||
268 | |||
255 | acpi_ac_get_state(ac); | 269 | acpi_ac_get_state(ac); |
256 | acpi_bus_generate_proc_event(device, event, (u32) ac->state); | 270 | acpi_bus_generate_proc_event(device, event, (u32) ac->state); |
257 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 271 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
@@ -264,6 +278,24 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) | |||
264 | return; | 278 | return; |
265 | } | 279 | } |
266 | 280 | ||
281 | static int thinkpad_e530_quirk(const struct dmi_system_id *d) | ||
282 | { | ||
283 | ac_sleep_before_get_state_ms = 1000; | ||
284 | return 0; | ||
285 | } | ||
286 | |||
287 | static struct dmi_system_id ac_dmi_table[] = { | ||
288 | { | ||
289 | .callback = thinkpad_e530_quirk, | ||
290 | .ident = "thinkpad e530", | ||
291 | .matches = { | ||
292 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
293 | DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"), | ||
294 | }, | ||
295 | }, | ||
296 | {}, | ||
297 | }; | ||
298 | |||
267 | static int acpi_ac_add(struct acpi_device *device) | 299 | static int acpi_ac_add(struct acpi_device *device) |
268 | { | 300 | { |
269 | int result = 0; | 301 | int result = 0; |
@@ -312,6 +344,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
312 | kfree(ac); | 344 | kfree(ac); |
313 | } | 345 | } |
314 | 346 | ||
347 | dmi_check_system(ac_dmi_table); | ||
315 | return result; | 348 | return result; |
316 | } | 349 | } |
317 | 350 | ||
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index b1c95422ce74..cab13f2fc28e 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -35,11 +35,16 @@ ACPI_MODULE_NAME("acpi_lpss"); | |||
35 | 35 | ||
36 | struct lpss_device_desc { | 36 | struct lpss_device_desc { |
37 | bool clk_required; | 37 | bool clk_required; |
38 | const char *clk_parent; | 38 | const char *clkdev_name; |
39 | bool ltr_required; | 39 | bool ltr_required; |
40 | unsigned int prv_offset; | 40 | unsigned int prv_offset; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static struct lpss_device_desc lpss_dma_desc = { | ||
44 | .clk_required = true, | ||
45 | .clkdev_name = "hclk", | ||
46 | }; | ||
47 | |||
43 | struct lpss_private_data { | 48 | struct lpss_private_data { |
44 | void __iomem *mmio_base; | 49 | void __iomem *mmio_base; |
45 | resource_size_t mmio_size; | 50 | resource_size_t mmio_size; |
@@ -49,7 +54,6 @@ struct lpss_private_data { | |||
49 | 54 | ||
50 | static struct lpss_device_desc lpt_dev_desc = { | 55 | static struct lpss_device_desc lpt_dev_desc = { |
51 | .clk_required = true, | 56 | .clk_required = true, |
52 | .clk_parent = "lpss_clk", | ||
53 | .prv_offset = 0x800, | 57 | .prv_offset = 0x800, |
54 | .ltr_required = true, | 58 | .ltr_required = true, |
55 | }; | 59 | }; |
@@ -60,6 +64,9 @@ static struct lpss_device_desc lpt_sdio_dev_desc = { | |||
60 | }; | 64 | }; |
61 | 65 | ||
62 | static const struct acpi_device_id acpi_lpss_device_ids[] = { | 66 | static const struct acpi_device_id acpi_lpss_device_ids[] = { |
67 | /* Generic LPSS devices */ | ||
68 | { "INTL9C60", (unsigned long)&lpss_dma_desc }, | ||
69 | |||
63 | /* Lynxpoint LPSS devices */ | 70 | /* Lynxpoint LPSS devices */ |
64 | { "INT33C0", (unsigned long)&lpt_dev_desc }, | 71 | { "INT33C0", (unsigned long)&lpt_dev_desc }, |
65 | { "INT33C1", (unsigned long)&lpt_dev_desc }, | 72 | { "INT33C1", (unsigned long)&lpt_dev_desc }, |
@@ -91,16 +98,27 @@ static int register_device_clock(struct acpi_device *adev, | |||
91 | struct lpss_private_data *pdata) | 98 | struct lpss_private_data *pdata) |
92 | { | 99 | { |
93 | const struct lpss_device_desc *dev_desc = pdata->dev_desc; | 100 | const struct lpss_device_desc *dev_desc = pdata->dev_desc; |
101 | struct lpss_clk_data *clk_data; | ||
94 | 102 | ||
95 | if (!lpss_clk_dev) | 103 | if (!lpss_clk_dev) |
96 | lpt_register_clock_device(); | 104 | lpt_register_clock_device(); |
97 | 105 | ||
98 | if (!dev_desc->clk_parent || !pdata->mmio_base | 106 | clk_data = platform_get_drvdata(lpss_clk_dev); |
107 | if (!clk_data) | ||
108 | return -ENODEV; | ||
109 | |||
110 | if (dev_desc->clkdev_name) { | ||
111 | clk_register_clkdev(clk_data->clk, dev_desc->clkdev_name, | ||
112 | dev_name(&adev->dev)); | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | if (!pdata->mmio_base | ||
99 | || pdata->mmio_size < dev_desc->prv_offset + LPSS_CLK_SIZE) | 117 | || pdata->mmio_size < dev_desc->prv_offset + LPSS_CLK_SIZE) |
100 | return -ENODATA; | 118 | return -ENODATA; |
101 | 119 | ||
102 | pdata->clk = clk_register_gate(NULL, dev_name(&adev->dev), | 120 | pdata->clk = clk_register_gate(NULL, dev_name(&adev->dev), |
103 | dev_desc->clk_parent, 0, | 121 | clk_data->name, 0, |
104 | pdata->mmio_base + dev_desc->prv_offset, | 122 | pdata->mmio_base + dev_desc->prv_offset, |
105 | 0, 0, NULL); | 123 | 0, 0, NULL); |
106 | if (IS_ERR(pdata->clk)) | 124 | if (IS_ERR(pdata->clk)) |
@@ -146,15 +164,24 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
146 | if (dev_desc->clk_required) { | 164 | if (dev_desc->clk_required) { |
147 | ret = register_device_clock(adev, pdata); | 165 | ret = register_device_clock(adev, pdata); |
148 | if (ret) { | 166 | if (ret) { |
149 | /* | 167 | /* Skip the device, but continue the namespace scan. */ |
150 | * Skip the device, but don't terminate the namespace | 168 | ret = 0; |
151 | * scan. | 169 | goto err_out; |
152 | */ | ||
153 | kfree(pdata); | ||
154 | return 0; | ||
155 | } | 170 | } |
156 | } | 171 | } |
157 | 172 | ||
173 | /* | ||
174 | * This works around a known issue in ACPI tables where LPSS devices | ||
175 | * have _PS0 and _PS3 without _PSC (and no power resources), so | ||
176 | * acpi_bus_init_power() will assume that the BIOS has put them into D0. | ||
177 | */ | ||
178 | ret = acpi_device_fix_up_power(adev); | ||
179 | if (ret) { | ||
180 | /* Skip the device, but continue the namespace scan. */ | ||
181 | ret = 0; | ||
182 | goto err_out; | ||
183 | } | ||
184 | |||
158 | adev->driver_data = pdata; | 185 | adev->driver_data = pdata; |
159 | ret = acpi_create_platform_device(adev, id); | 186 | ret = acpi_create_platform_device(adev, id); |
160 | if (ret > 0) | 187 | if (ret > 0) |
diff --git a/drivers/acpi/apei/cper.c b/drivers/acpi/apei/cper.c index fefc2ca7cc3e..33dc6a004802 100644 --- a/drivers/acpi/apei/cper.c +++ b/drivers/acpi/apei/cper.c | |||
@@ -250,10 +250,6 @@ static const char *cper_pcie_port_type_strs[] = { | |||
250 | static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie, | 250 | static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie, |
251 | const struct acpi_hest_generic_data *gdata) | 251 | const struct acpi_hest_generic_data *gdata) |
252 | { | 252 | { |
253 | #ifdef CONFIG_ACPI_APEI_PCIEAER | ||
254 | struct pci_dev *dev; | ||
255 | #endif | ||
256 | |||
257 | if (pcie->validation_bits & CPER_PCIE_VALID_PORT_TYPE) | 253 | if (pcie->validation_bits & CPER_PCIE_VALID_PORT_TYPE) |
258 | printk("%s""port_type: %d, %s\n", pfx, pcie->port_type, | 254 | printk("%s""port_type: %d, %s\n", pfx, pcie->port_type, |
259 | pcie->port_type < ARRAY_SIZE(cper_pcie_port_type_strs) ? | 255 | pcie->port_type < ARRAY_SIZE(cper_pcie_port_type_strs) ? |
@@ -285,20 +281,6 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie, | |||
285 | printk( | 281 | printk( |
286 | "%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n", | 282 | "%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n", |
287 | pfx, pcie->bridge.secondary_status, pcie->bridge.control); | 283 | pfx, pcie->bridge.secondary_status, pcie->bridge.control); |
288 | #ifdef CONFIG_ACPI_APEI_PCIEAER | ||
289 | dev = pci_get_domain_bus_and_slot(pcie->device_id.segment, | ||
290 | pcie->device_id.bus, pcie->device_id.function); | ||
291 | if (!dev) { | ||
292 | pr_err("PCI AER Cannot get PCI device %04x:%02x:%02x.%d\n", | ||
293 | pcie->device_id.segment, pcie->device_id.bus, | ||
294 | pcie->device_id.slot, pcie->device_id.function); | ||
295 | return; | ||
296 | } | ||
297 | if (pcie->validation_bits & CPER_PCIE_VALID_AER_INFO) | ||
298 | cper_print_aer(pfx, dev, gdata->error_severity, | ||
299 | (struct aer_capability_regs *) pcie->aer_info); | ||
300 | pci_dev_put(dev); | ||
301 | #endif | ||
302 | } | 284 | } |
303 | 285 | ||
304 | static const char *apei_estatus_section_flag_strs[] = { | 286 | static const char *apei_estatus_section_flag_strs[] = { |
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index d668a8ae602b..fcd7d91cec34 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
@@ -454,7 +454,9 @@ static void ghes_do_proc(struct ghes *ghes, | |||
454 | aer_severity = cper_severity_to_aer(sev); | 454 | aer_severity = cper_severity_to_aer(sev); |
455 | aer_recover_queue(pcie_err->device_id.segment, | 455 | aer_recover_queue(pcie_err->device_id.segment, |
456 | pcie_err->device_id.bus, | 456 | pcie_err->device_id.bus, |
457 | devfn, aer_severity); | 457 | devfn, aer_severity, |
458 | (struct aer_capability_regs *) | ||
459 | pcie_err->aer_info); | ||
458 | } | 460 | } |
459 | 461 | ||
460 | } | 462 | } |
@@ -917,13 +919,14 @@ static int ghes_probe(struct platform_device *ghes_dev) | |||
917 | break; | 919 | break; |
918 | case ACPI_HEST_NOTIFY_EXTERNAL: | 920 | case ACPI_HEST_NOTIFY_EXTERNAL: |
919 | /* External interrupt vector is GSI */ | 921 | /* External interrupt vector is GSI */ |
920 | if (acpi_gsi_to_irq(generic->notify.vector, &ghes->irq)) { | 922 | rc = acpi_gsi_to_irq(generic->notify.vector, &ghes->irq); |
923 | if (rc) { | ||
921 | pr_err(GHES_PFX "Failed to map GSI to IRQ for generic hardware error source: %d\n", | 924 | pr_err(GHES_PFX "Failed to map GSI to IRQ for generic hardware error source: %d\n", |
922 | generic->header.source_id); | 925 | generic->header.source_id); |
923 | goto err_edac_unreg; | 926 | goto err_edac_unreg; |
924 | } | 927 | } |
925 | if (request_irq(ghes->irq, ghes_irq_func, | 928 | rc = request_irq(ghes->irq, ghes_irq_func, 0, "GHES IRQ", ghes); |
926 | 0, "GHES IRQ", ghes)) { | 929 | if (rc) { |
927 | pr_err(GHES_PFX "Failed to register IRQ for generic hardware error source: %d\n", | 930 | pr_err(GHES_PFX "Failed to register IRQ for generic hardware error source: %d\n", |
928 | generic->header.source_id); | 931 | generic->header.source_id); |
929 | goto err_edac_unreg; | 932 | goto err_edac_unreg; |
diff --git a/drivers/acpi/csrt.c b/drivers/acpi/csrt.c deleted file mode 100644 index 5c15a91faf0b..000000000000 --- a/drivers/acpi/csrt.c +++ /dev/null | |||
@@ -1,159 +0,0 @@ | |||
1 | /* | ||
2 | * Support for Core System Resources Table (CSRT) | ||
3 | * | ||
4 | * Copyright (C) 2013, Intel Corporation | ||
5 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> | ||
6 | * Andy Shevchenko <andriy.shevchenko@linux.intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #define pr_fmt(fmt) "ACPI: CSRT: " fmt | ||
14 | |||
15 | #include <linux/acpi.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/sizes.h> | ||
21 | |||
22 | ACPI_MODULE_NAME("CSRT"); | ||
23 | |||
24 | static int __init acpi_csrt_parse_shared_info(struct platform_device *pdev, | ||
25 | const struct acpi_csrt_group *grp) | ||
26 | { | ||
27 | const struct acpi_csrt_shared_info *si; | ||
28 | struct resource res[3]; | ||
29 | size_t nres; | ||
30 | int ret; | ||
31 | |||
32 | memset(res, 0, sizeof(res)); | ||
33 | nres = 0; | ||
34 | |||
35 | si = (const struct acpi_csrt_shared_info *)&grp[1]; | ||
36 | /* | ||
37 | * The peripherals that are listed on CSRT typically support only | ||
38 | * 32-bit addresses so we only use the low part of MMIO base for | ||
39 | * now. | ||
40 | */ | ||
41 | if (!si->mmio_base_high && si->mmio_base_low) { | ||
42 | /* | ||
43 | * There is no size of the memory resource in shared_info | ||
44 | * so we assume that it is 4k here. | ||
45 | */ | ||
46 | res[nres].start = si->mmio_base_low; | ||
47 | res[nres].end = res[0].start + SZ_4K - 1; | ||
48 | res[nres++].flags = IORESOURCE_MEM; | ||
49 | } | ||
50 | |||
51 | if (si->gsi_interrupt) { | ||
52 | int irq = acpi_register_gsi(NULL, si->gsi_interrupt, | ||
53 | si->interrupt_mode, | ||
54 | si->interrupt_polarity); | ||
55 | res[nres].start = irq; | ||
56 | res[nres].end = irq; | ||
57 | res[nres++].flags = IORESOURCE_IRQ; | ||
58 | } | ||
59 | |||
60 | if (si->base_request_line || si->num_handshake_signals) { | ||
61 | /* | ||
62 | * We pass the driver a DMA resource describing the range | ||
63 | * of request lines the device supports. | ||
64 | */ | ||
65 | res[nres].start = si->base_request_line; | ||
66 | res[nres].end = res[nres].start + si->num_handshake_signals - 1; | ||
67 | res[nres++].flags = IORESOURCE_DMA; | ||
68 | } | ||
69 | |||
70 | ret = platform_device_add_resources(pdev, res, nres); | ||
71 | if (ret) { | ||
72 | if (si->gsi_interrupt) | ||
73 | acpi_unregister_gsi(si->gsi_interrupt); | ||
74 | return ret; | ||
75 | } | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static int __init | ||
81 | acpi_csrt_parse_resource_group(const struct acpi_csrt_group *grp) | ||
82 | { | ||
83 | struct platform_device *pdev; | ||
84 | char vendor[5], name[16]; | ||
85 | int ret, i; | ||
86 | |||
87 | vendor[0] = grp->vendor_id; | ||
88 | vendor[1] = grp->vendor_id >> 8; | ||
89 | vendor[2] = grp->vendor_id >> 16; | ||
90 | vendor[3] = grp->vendor_id >> 24; | ||
91 | vendor[4] = '\0'; | ||
92 | |||
93 | if (grp->shared_info_length != sizeof(struct acpi_csrt_shared_info)) | ||
94 | return -ENODEV; | ||
95 | |||
96 | snprintf(name, sizeof(name), "%s%04X", vendor, grp->device_id); | ||
97 | pdev = platform_device_alloc(name, PLATFORM_DEVID_AUTO); | ||
98 | if (!pdev) | ||
99 | return -ENOMEM; | ||
100 | |||
101 | /* Add resources based on the shared info */ | ||
102 | ret = acpi_csrt_parse_shared_info(pdev, grp); | ||
103 | if (ret) | ||
104 | goto fail; | ||
105 | |||
106 | ret = platform_device_add(pdev); | ||
107 | if (ret) | ||
108 | goto fail; | ||
109 | |||
110 | for (i = 0; i < pdev->num_resources; i++) | ||
111 | dev_dbg(&pdev->dev, "%pR\n", &pdev->resource[i]); | ||
112 | |||
113 | return 0; | ||
114 | |||
115 | fail: | ||
116 | platform_device_put(pdev); | ||
117 | return ret; | ||
118 | } | ||
119 | |||
120 | /* | ||
121 | * CSRT or Core System Resources Table is a proprietary ACPI table | ||
122 | * introduced by Microsoft. This table can contain devices that are not in | ||
123 | * the system DSDT table. In particular DMA controllers might be described | ||
124 | * here. | ||
125 | * | ||
126 | * We present these devices as normal platform devices that don't have ACPI | ||
127 | * IDs or handle. The platform device name will be something like | ||
128 | * <VENDOR><DEVID>.<n>.auto for example: INTL9C06.0.auto. | ||
129 | */ | ||
130 | void __init acpi_csrt_init(void) | ||
131 | { | ||
132 | struct acpi_csrt_group *grp, *end; | ||
133 | struct acpi_table_csrt *csrt; | ||
134 | acpi_status status; | ||
135 | int ret; | ||
136 | |||
137 | status = acpi_get_table(ACPI_SIG_CSRT, 0, | ||
138 | (struct acpi_table_header **)&csrt); | ||
139 | if (ACPI_FAILURE(status)) { | ||
140 | if (status != AE_NOT_FOUND) | ||
141 | pr_warn("failed to get the CSRT table\n"); | ||
142 | return; | ||
143 | } | ||
144 | |||
145 | pr_debug("parsing CSRT table for devices\n"); | ||
146 | |||
147 | grp = (struct acpi_csrt_group *)(csrt + 1); | ||
148 | end = (struct acpi_csrt_group *)((void *)csrt + csrt->header.length); | ||
149 | |||
150 | while (grp < end) { | ||
151 | ret = acpi_csrt_parse_resource_group(grp); | ||
152 | if (ret) { | ||
153 | pr_warn("error in parsing resource group: %d\n", ret); | ||
154 | return; | ||
155 | } | ||
156 | |||
157 | grp = (struct acpi_csrt_group *)((void *)grp + grp->length); | ||
158 | } | ||
159 | } | ||
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 96de787e6104..31c217a42839 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -37,68 +37,6 @@ | |||
37 | #define _COMPONENT ACPI_POWER_COMPONENT | 37 | #define _COMPONENT ACPI_POWER_COMPONENT |
38 | ACPI_MODULE_NAME("device_pm"); | 38 | ACPI_MODULE_NAME("device_pm"); |
39 | 39 | ||
40 | static DEFINE_MUTEX(acpi_pm_notifier_lock); | ||
41 | |||
42 | /** | ||
43 | * acpi_add_pm_notifier - Register PM notifier for given ACPI device. | ||
44 | * @adev: ACPI device to add the notifier for. | ||
45 | * @context: Context information to pass to the notifier routine. | ||
46 | * | ||
47 | * NOTE: @adev need not be a run-wake or wakeup device to be a valid source of | ||
48 | * PM wakeup events. For example, wakeup events may be generated for bridges | ||
49 | * if one of the devices below the bridge is signaling wakeup, even if the | ||
50 | * bridge itself doesn't have a wakeup GPE associated with it. | ||
51 | */ | ||
52 | acpi_status acpi_add_pm_notifier(struct acpi_device *adev, | ||
53 | acpi_notify_handler handler, void *context) | ||
54 | { | ||
55 | acpi_status status = AE_ALREADY_EXISTS; | ||
56 | |||
57 | mutex_lock(&acpi_pm_notifier_lock); | ||
58 | |||
59 | if (adev->wakeup.flags.notifier_present) | ||
60 | goto out; | ||
61 | |||
62 | status = acpi_install_notify_handler(adev->handle, | ||
63 | ACPI_SYSTEM_NOTIFY, | ||
64 | handler, context); | ||
65 | if (ACPI_FAILURE(status)) | ||
66 | goto out; | ||
67 | |||
68 | adev->wakeup.flags.notifier_present = true; | ||
69 | |||
70 | out: | ||
71 | mutex_unlock(&acpi_pm_notifier_lock); | ||
72 | return status; | ||
73 | } | ||
74 | |||
75 | /** | ||
76 | * acpi_remove_pm_notifier - Unregister PM notifier from given ACPI device. | ||
77 | * @adev: ACPI device to remove the notifier from. | ||
78 | */ | ||
79 | acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | ||
80 | acpi_notify_handler handler) | ||
81 | { | ||
82 | acpi_status status = AE_BAD_PARAMETER; | ||
83 | |||
84 | mutex_lock(&acpi_pm_notifier_lock); | ||
85 | |||
86 | if (!adev->wakeup.flags.notifier_present) | ||
87 | goto out; | ||
88 | |||
89 | status = acpi_remove_notify_handler(adev->handle, | ||
90 | ACPI_SYSTEM_NOTIFY, | ||
91 | handler); | ||
92 | if (ACPI_FAILURE(status)) | ||
93 | goto out; | ||
94 | |||
95 | adev->wakeup.flags.notifier_present = false; | ||
96 | |||
97 | out: | ||
98 | mutex_unlock(&acpi_pm_notifier_lock); | ||
99 | return status; | ||
100 | } | ||
101 | |||
102 | /** | 40 | /** |
103 | * acpi_power_state_string - String representation of ACPI device power state. | 41 | * acpi_power_state_string - String representation of ACPI device power state. |
104 | * @state: ACPI device power state to return the string representation of. | 42 | * @state: ACPI device power state to return the string representation of. |
@@ -340,16 +278,38 @@ int acpi_bus_init_power(struct acpi_device *device) | |||
340 | if (result) | 278 | if (result) |
341 | return result; | 279 | return result; |
342 | } else if (state == ACPI_STATE_UNKNOWN) { | 280 | } else if (state == ACPI_STATE_UNKNOWN) { |
343 | /* No power resources and missing _PSC? Try to force D0. */ | 281 | /* |
282 | * No power resources and missing _PSC? Cross fingers and make | ||
283 | * it D0 in hope that this is what the BIOS put the device into. | ||
284 | * [We tried to force D0 here by executing _PS0, but that broke | ||
285 | * Toshiba P870-303 in a nasty way.] | ||
286 | */ | ||
344 | state = ACPI_STATE_D0; | 287 | state = ACPI_STATE_D0; |
345 | result = acpi_dev_pm_explicit_set(device, state); | ||
346 | if (result) | ||
347 | return result; | ||
348 | } | 288 | } |
349 | device->power.state = state; | 289 | device->power.state = state; |
350 | return 0; | 290 | return 0; |
351 | } | 291 | } |
352 | 292 | ||
293 | /** | ||
294 | * acpi_device_fix_up_power - Force device with missing _PSC into D0. | ||
295 | * @device: Device object whose power state is to be fixed up. | ||
296 | * | ||
297 | * Devices without power resources and _PSC, but having _PS0 and _PS3 defined, | ||
298 | * are assumed to be put into D0 by the BIOS. However, in some cases that may | ||
299 | * not be the case and this function should be used then. | ||
300 | */ | ||
301 | int acpi_device_fix_up_power(struct acpi_device *device) | ||
302 | { | ||
303 | int ret = 0; | ||
304 | |||
305 | if (!device->power.flags.power_resources | ||
306 | && !device->power.flags.explicit_get | ||
307 | && device->power.state == ACPI_STATE_D0) | ||
308 | ret = acpi_dev_pm_explicit_set(device, ACPI_STATE_D0); | ||
309 | |||
310 | return ret; | ||
311 | } | ||
312 | |||
353 | int acpi_bus_update_power(acpi_handle handle, int *state_p) | 313 | int acpi_bus_update_power(acpi_handle handle, int *state_p) |
354 | { | 314 | { |
355 | struct acpi_device *device; | 315 | struct acpi_device *device; |
@@ -385,6 +345,69 @@ bool acpi_bus_power_manageable(acpi_handle handle) | |||
385 | } | 345 | } |
386 | EXPORT_SYMBOL(acpi_bus_power_manageable); | 346 | EXPORT_SYMBOL(acpi_bus_power_manageable); |
387 | 347 | ||
348 | #ifdef CONFIG_PM | ||
349 | static DEFINE_MUTEX(acpi_pm_notifier_lock); | ||
350 | |||
351 | /** | ||
352 | * acpi_add_pm_notifier - Register PM notifier for given ACPI device. | ||
353 | * @adev: ACPI device to add the notifier for. | ||
354 | * @context: Context information to pass to the notifier routine. | ||
355 | * | ||
356 | * NOTE: @adev need not be a run-wake or wakeup device to be a valid source of | ||
357 | * PM wakeup events. For example, wakeup events may be generated for bridges | ||
358 | * if one of the devices below the bridge is signaling wakeup, even if the | ||
359 | * bridge itself doesn't have a wakeup GPE associated with it. | ||
360 | */ | ||
361 | acpi_status acpi_add_pm_notifier(struct acpi_device *adev, | ||
362 | acpi_notify_handler handler, void *context) | ||
363 | { | ||
364 | acpi_status status = AE_ALREADY_EXISTS; | ||
365 | |||
366 | mutex_lock(&acpi_pm_notifier_lock); | ||
367 | |||
368 | if (adev->wakeup.flags.notifier_present) | ||
369 | goto out; | ||
370 | |||
371 | status = acpi_install_notify_handler(adev->handle, | ||
372 | ACPI_SYSTEM_NOTIFY, | ||
373 | handler, context); | ||
374 | if (ACPI_FAILURE(status)) | ||
375 | goto out; | ||
376 | |||
377 | adev->wakeup.flags.notifier_present = true; | ||
378 | |||
379 | out: | ||
380 | mutex_unlock(&acpi_pm_notifier_lock); | ||
381 | return status; | ||
382 | } | ||
383 | |||
384 | /** | ||
385 | * acpi_remove_pm_notifier - Unregister PM notifier from given ACPI device. | ||
386 | * @adev: ACPI device to remove the notifier from. | ||
387 | */ | ||
388 | acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | ||
389 | acpi_notify_handler handler) | ||
390 | { | ||
391 | acpi_status status = AE_BAD_PARAMETER; | ||
392 | |||
393 | mutex_lock(&acpi_pm_notifier_lock); | ||
394 | |||
395 | if (!adev->wakeup.flags.notifier_present) | ||
396 | goto out; | ||
397 | |||
398 | status = acpi_remove_notify_handler(adev->handle, | ||
399 | ACPI_SYSTEM_NOTIFY, | ||
400 | handler); | ||
401 | if (ACPI_FAILURE(status)) | ||
402 | goto out; | ||
403 | |||
404 | adev->wakeup.flags.notifier_present = false; | ||
405 | |||
406 | out: | ||
407 | mutex_unlock(&acpi_pm_notifier_lock); | ||
408 | return status; | ||
409 | } | ||
410 | |||
388 | bool acpi_bus_can_wakeup(acpi_handle handle) | 411 | bool acpi_bus_can_wakeup(acpi_handle handle) |
389 | { | 412 | { |
390 | struct acpi_device *device; | 413 | struct acpi_device *device; |
@@ -1023,3 +1046,4 @@ void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev) | |||
1023 | mutex_unlock(&adev->physical_node_lock); | 1046 | mutex_unlock(&adev->physical_node_lock); |
1024 | } | 1047 | } |
1025 | EXPORT_SYMBOL_GPL(acpi_dev_pm_remove_dependent); | 1048 | EXPORT_SYMBOL_GPL(acpi_dev_pm_remove_dependent); |
1049 | #endif /* CONFIG_PM */ | ||
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 4fdea381ef21..ec117c6c996c 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -868,8 +868,10 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr, | |||
868 | if (!count) | 868 | if (!count) |
869 | return -EINVAL; | 869 | return -EINVAL; |
870 | 870 | ||
871 | acpi_scan_lock_acquire(); | ||
871 | begin_undock(dock_station); | 872 | begin_undock(dock_station); |
872 | ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); | 873 | ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); |
874 | acpi_scan_lock_release(); | ||
873 | return ret ? ret: count; | 875 | return ret ? ret: count; |
874 | } | 876 | } |
875 | static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock); | 877 | static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d45b2871d33b..edc00818c803 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -223,7 +223,7 @@ static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) | |||
223 | static int ec_poll(struct acpi_ec *ec) | 223 | static int ec_poll(struct acpi_ec *ec) |
224 | { | 224 | { |
225 | unsigned long flags; | 225 | unsigned long flags; |
226 | int repeat = 2; /* number of command restarts */ | 226 | int repeat = 5; /* number of command restarts */ |
227 | while (repeat--) { | 227 | while (repeat--) { |
228 | unsigned long delay = jiffies + | 228 | unsigned long delay = jiffies + |
229 | msecs_to_jiffies(ec_delay); | 229 | msecs_to_jiffies(ec_delay); |
@@ -241,8 +241,6 @@ static int ec_poll(struct acpi_ec *ec) | |||
241 | } | 241 | } |
242 | advance_transaction(ec, acpi_ec_read_status(ec)); | 242 | advance_transaction(ec, acpi_ec_read_status(ec)); |
243 | } while (time_before(jiffies, delay)); | 243 | } while (time_before(jiffies, delay)); |
244 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) | ||
245 | break; | ||
246 | pr_debug(PREFIX "controller reset, restart transaction\n"); | 244 | pr_debug(PREFIX "controller reset, restart transaction\n"); |
247 | spin_lock_irqsave(&ec->lock, flags); | 245 | spin_lock_irqsave(&ec->lock, flags); |
248 | start_transaction(ec); | 246 | start_transaction(ec); |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 6f1afd9118c8..297cbf456f86 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -35,7 +35,6 @@ void acpi_pci_link_init(void); | |||
35 | void acpi_pci_root_hp_init(void); | 35 | void acpi_pci_root_hp_init(void); |
36 | void acpi_platform_init(void); | 36 | void acpi_platform_init(void); |
37 | int acpi_sysfs_init(void); | 37 | int acpi_sysfs_init(void); |
38 | void acpi_csrt_init(void); | ||
39 | #ifdef CONFIG_ACPI_CONTAINER | 38 | #ifdef CONFIG_ACPI_CONTAINER |
40 | void acpi_container_init(void); | 39 | void acpi_container_init(void); |
41 | #else | 40 | #else |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 1dd6f6c85874..e427dc516c76 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -641,7 +641,9 @@ static void _handle_hotplug_event_root(struct work_struct *work) | |||
641 | /* bus enumerate */ | 641 | /* bus enumerate */ |
642 | printk(KERN_DEBUG "%s: Bus check notify on %s\n", __func__, | 642 | printk(KERN_DEBUG "%s: Bus check notify on %s\n", __func__, |
643 | (char *)buffer.pointer); | 643 | (char *)buffer.pointer); |
644 | if (!root) | 644 | if (root) |
645 | acpiphp_check_host_bridge(handle); | ||
646 | else | ||
645 | handle_root_bridge_insertion(handle); | 647 | handle_root_bridge_insertion(handle); |
646 | 648 | ||
647 | break; | 649 | break; |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index f962047c6c85..288bb270f8ed 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -885,6 +885,7 @@ int acpi_add_power_resource(acpi_handle handle) | |||
885 | ACPI_STA_DEFAULT); | 885 | ACPI_STA_DEFAULT); |
886 | mutex_init(&resource->resource_lock); | 886 | mutex_init(&resource->resource_lock); |
887 | INIT_LIST_HEAD(&resource->dependent); | 887 | INIT_LIST_HEAD(&resource->dependent); |
888 | INIT_LIST_HEAD(&resource->list_node); | ||
888 | resource->name = device->pnp.bus_id; | 889 | resource->name = device->pnp.bus_id; |
889 | strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); | 890 | strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); |
890 | strcpy(acpi_device_class(device), ACPI_POWER_CLASS); | 891 | strcpy(acpi_device_class(device), ACPI_POWER_CLASS); |
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index bec717ffd25f..c266cdc11784 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -95,9 +95,6 @@ static const struct acpi_device_id processor_device_ids[] = { | |||
95 | }; | 95 | }; |
96 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); | 96 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); |
97 | 97 | ||
98 | static SIMPLE_DEV_PM_OPS(acpi_processor_pm, | ||
99 | acpi_processor_suspend, acpi_processor_resume); | ||
100 | |||
101 | static struct acpi_driver acpi_processor_driver = { | 98 | static struct acpi_driver acpi_processor_driver = { |
102 | .name = "processor", | 99 | .name = "processor", |
103 | .class = ACPI_PROCESSOR_CLASS, | 100 | .class = ACPI_PROCESSOR_CLASS, |
@@ -107,7 +104,6 @@ static struct acpi_driver acpi_processor_driver = { | |||
107 | .remove = acpi_processor_remove, | 104 | .remove = acpi_processor_remove, |
108 | .notify = acpi_processor_notify, | 105 | .notify = acpi_processor_notify, |
109 | }, | 106 | }, |
110 | .drv.pm = &acpi_processor_pm, | ||
111 | }; | 107 | }; |
112 | 108 | ||
113 | #define INSTALL_NOTIFY_HANDLER 1 | 109 | #define INSTALL_NOTIFY_HANDLER 1 |
@@ -934,6 +930,8 @@ static int __init acpi_processor_init(void) | |||
934 | if (result < 0) | 930 | if (result < 0) |
935 | return result; | 931 | return result; |
936 | 932 | ||
933 | acpi_processor_syscore_init(); | ||
934 | |||
937 | acpi_processor_install_hotplug_notify(); | 935 | acpi_processor_install_hotplug_notify(); |
938 | 936 | ||
939 | acpi_thermal_cpufreq_init(); | 937 | acpi_thermal_cpufreq_init(); |
@@ -956,6 +954,8 @@ static void __exit acpi_processor_exit(void) | |||
956 | 954 | ||
957 | acpi_processor_uninstall_hotplug_notify(); | 955 | acpi_processor_uninstall_hotplug_notify(); |
958 | 956 | ||
957 | acpi_processor_syscore_exit(); | ||
958 | |||
959 | acpi_bus_unregister_driver(&acpi_processor_driver); | 959 | acpi_bus_unregister_driver(&acpi_processor_driver); |
960 | 960 | ||
961 | return; | 961 | return; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f0df2c9434d2..eb133c77aadb 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/sched.h> /* need_resched() */ | 34 | #include <linux/sched.h> /* need_resched() */ |
35 | #include <linux/clockchips.h> | 35 | #include <linux/clockchips.h> |
36 | #include <linux/cpuidle.h> | 36 | #include <linux/cpuidle.h> |
37 | #include <linux/syscore_ops.h> | ||
37 | 38 | ||
38 | /* | 39 | /* |
39 | * Include the apic definitions for x86 to have the APIC timer related defines | 40 | * Include the apic definitions for x86 to have the APIC timer related defines |
@@ -210,33 +211,41 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, | |||
210 | 211 | ||
211 | #endif | 212 | #endif |
212 | 213 | ||
214 | #ifdef CONFIG_PM_SLEEP | ||
213 | static u32 saved_bm_rld; | 215 | static u32 saved_bm_rld; |
214 | 216 | ||
215 | static void acpi_idle_bm_rld_save(void) | 217 | int acpi_processor_suspend(void) |
216 | { | 218 | { |
217 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); | 219 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); |
220 | return 0; | ||
218 | } | 221 | } |
219 | static void acpi_idle_bm_rld_restore(void) | 222 | |
223 | void acpi_processor_resume(void) | ||
220 | { | 224 | { |
221 | u32 resumed_bm_rld; | 225 | u32 resumed_bm_rld; |
222 | 226 | ||
223 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); | 227 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); |
228 | if (resumed_bm_rld == saved_bm_rld) | ||
229 | return; | ||
224 | 230 | ||
225 | if (resumed_bm_rld != saved_bm_rld) | 231 | acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); |
226 | acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); | ||
227 | } | 232 | } |
228 | 233 | ||
229 | int acpi_processor_suspend(struct device *dev) | 234 | static struct syscore_ops acpi_processor_syscore_ops = { |
235 | .suspend = acpi_processor_suspend, | ||
236 | .resume = acpi_processor_resume, | ||
237 | }; | ||
238 | |||
239 | void acpi_processor_syscore_init(void) | ||
230 | { | 240 | { |
231 | acpi_idle_bm_rld_save(); | 241 | register_syscore_ops(&acpi_processor_syscore_ops); |
232 | return 0; | ||
233 | } | 242 | } |
234 | 243 | ||
235 | int acpi_processor_resume(struct device *dev) | 244 | void acpi_processor_syscore_exit(void) |
236 | { | 245 | { |
237 | acpi_idle_bm_rld_restore(); | 246 | unregister_syscore_ops(&acpi_processor_syscore_ops); |
238 | return 0; | ||
239 | } | 247 | } |
248 | #endif /* CONFIG_PM_SLEEP */ | ||
240 | 249 | ||
241 | #if defined(CONFIG_X86) | 250 | #if defined(CONFIG_X86) |
242 | static void tsc_check_state(int state) | 251 | static void tsc_check_state(int state) |
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index a3868f6c222a..3322b47ab7ca 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c | |||
@@ -304,7 +304,8 @@ static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi) | |||
304 | } | 304 | } |
305 | 305 | ||
306 | static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, | 306 | static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, |
307 | u8 triggering, u8 polarity, u8 shareable) | 307 | u8 triggering, u8 polarity, u8 shareable, |
308 | bool legacy) | ||
308 | { | 309 | { |
309 | int irq, p, t; | 310 | int irq, p, t; |
310 | 311 | ||
@@ -317,14 +318,19 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, | |||
317 | * In IO-APIC mode, use overrided attribute. Two reasons: | 318 | * In IO-APIC mode, use overrided attribute. Two reasons: |
318 | * 1. BIOS bug in DSDT | 319 | * 1. BIOS bug in DSDT |
319 | * 2. BIOS uses IO-APIC mode Interrupt Source Override | 320 | * 2. BIOS uses IO-APIC mode Interrupt Source Override |
321 | * | ||
322 | * We do this only if we are dealing with IRQ() or IRQNoFlags() | ||
323 | * resource (the legacy ISA resources). With modern ACPI 5 devices | ||
324 | * using extended IRQ descriptors we take the IRQ configuration | ||
325 | * from _CRS directly. | ||
320 | */ | 326 | */ |
321 | if (!acpi_get_override_irq(gsi, &t, &p)) { | 327 | if (legacy && !acpi_get_override_irq(gsi, &t, &p)) { |
322 | u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; | 328 | u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; |
323 | u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; | 329 | u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; |
324 | 330 | ||
325 | if (triggering != trig || polarity != pol) { | 331 | if (triggering != trig || polarity != pol) { |
326 | pr_warning("ACPI: IRQ %d override to %s, %s\n", gsi, | 332 | pr_warning("ACPI: IRQ %d override to %s, %s\n", gsi, |
327 | t ? "edge" : "level", p ? "low" : "high"); | 333 | t ? "level" : "edge", p ? "low" : "high"); |
328 | triggering = trig; | 334 | triggering = trig; |
329 | polarity = pol; | 335 | polarity = pol; |
330 | } | 336 | } |
@@ -373,7 +379,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, | |||
373 | } | 379 | } |
374 | acpi_dev_get_irqresource(res, irq->interrupts[index], | 380 | acpi_dev_get_irqresource(res, irq->interrupts[index], |
375 | irq->triggering, irq->polarity, | 381 | irq->triggering, irq->polarity, |
376 | irq->sharable); | 382 | irq->sharable, true); |
377 | break; | 383 | break; |
378 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 384 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
379 | ext_irq = &ares->data.extended_irq; | 385 | ext_irq = &ares->data.extended_irq; |
@@ -383,7 +389,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, | |||
383 | } | 389 | } |
384 | acpi_dev_get_irqresource(res, ext_irq->interrupts[index], | 390 | acpi_dev_get_irqresource(res, ext_irq->interrupts[index], |
385 | ext_irq->triggering, ext_irq->polarity, | 391 | ext_irq->triggering, ext_irq->polarity, |
386 | ext_irq->sharable); | 392 | ext_irq->sharable, false); |
387 | break; | 393 | break; |
388 | default: | 394 | default: |
389 | return false; | 395 | return false; |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index fe158fd4f1df..b14ac46948c9 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1017,11 +1017,8 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) | |||
1017 | return -ENOSYS; | 1017 | return -ENOSYS; |
1018 | 1018 | ||
1019 | result = driver->ops.add(device); | 1019 | result = driver->ops.add(device); |
1020 | if (result) { | 1020 | if (result) |
1021 | device->driver = NULL; | ||
1022 | device->driver_data = NULL; | ||
1023 | return result; | 1021 | return result; |
1024 | } | ||
1025 | 1022 | ||
1026 | device->driver = driver; | 1023 | device->driver = driver; |
1027 | 1024 | ||
@@ -1785,7 +1782,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type) | |||
1785 | acpi_set_pnp_ids(handle, &pnp, type); | 1782 | acpi_set_pnp_ids(handle, &pnp, type); |
1786 | 1783 | ||
1787 | if (!pnp.type.hardware_id) | 1784 | if (!pnp.type.hardware_id) |
1788 | return; | 1785 | goto out; |
1789 | 1786 | ||
1790 | /* | 1787 | /* |
1791 | * This relies on the fact that acpi_install_notify_handler() will not | 1788 | * This relies on the fact that acpi_install_notify_handler() will not |
@@ -1800,6 +1797,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type) | |||
1800 | } | 1797 | } |
1801 | } | 1798 | } |
1802 | 1799 | ||
1800 | out: | ||
1803 | acpi_free_pnp_ids(&pnp); | 1801 | acpi_free_pnp_ids(&pnp); |
1804 | } | 1802 | } |
1805 | 1803 | ||
@@ -2042,7 +2040,6 @@ int __init acpi_scan_init(void) | |||
2042 | acpi_pci_link_init(); | 2040 | acpi_pci_link_init(); |
2043 | acpi_platform_init(); | 2041 | acpi_platform_init(); |
2044 | acpi_lpss_init(); | 2042 | acpi_lpss_init(); |
2045 | acpi_csrt_init(); | ||
2046 | acpi_container_init(); | 2043 | acpi_container_init(); |
2047 | acpi_memory_hotplug_init(); | 2044 | acpi_memory_hotplug_init(); |
2048 | 2045 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index c3932d0876e0..440eadf2d32c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -456,6 +456,30 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
456 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"), | 456 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"), |
457 | }, | 457 | }, |
458 | }, | 458 | }, |
459 | { | ||
460 | .callback = video_ignore_initial_backlight, | ||
461 | .ident = "HP Pavilion g6 Notebook PC", | ||
462 | .matches = { | ||
463 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
464 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion g6 Notebook PC"), | ||
465 | }, | ||
466 | }, | ||
467 | { | ||
468 | .callback = video_ignore_initial_backlight, | ||
469 | .ident = "HP 1000 Notebook PC", | ||
470 | .matches = { | ||
471 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
472 | DMI_MATCH(DMI_PRODUCT_NAME, "HP 1000 Notebook PC"), | ||
473 | }, | ||
474 | }, | ||
475 | { | ||
476 | .callback = video_ignore_initial_backlight, | ||
477 | .ident = "HP Pavilion m4", | ||
478 | .matches = { | ||
479 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
480 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion m4 Notebook PC"), | ||
481 | }, | ||
482 | }, | ||
459 | {} | 483 | {} |
460 | }; | 484 | }; |
461 | 485 | ||
@@ -1698,6 +1722,9 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1698 | int error; | 1722 | int error; |
1699 | acpi_status status; | 1723 | acpi_status status; |
1700 | 1724 | ||
1725 | if (device->handler) | ||
1726 | return -EINVAL; | ||
1727 | |||
1701 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, | 1728 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, |
1702 | device->parent->handle, 1, | 1729 | device->parent->handle, 1, |
1703 | acpi_video_bus_match, NULL, | 1730 | acpi_video_bus_match, NULL, |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 66f67626f02e..e6bd910bc6ed 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -161,6 +161,14 @@ static struct dmi_system_id video_detect_dmi_table[] = { | |||
161 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"), | 161 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"), |
162 | }, | 162 | }, |
163 | }, | 163 | }, |
164 | { | ||
165 | .callback = video_detect_force_vendor, | ||
166 | .ident = "Asus UL30A", | ||
167 | .matches = { | ||
168 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
169 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), | ||
170 | }, | ||
171 | }, | ||
164 | { }, | 172 | { }, |
165 | }; | 173 | }; |
166 | 174 | ||
diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c index 4e94ba29cb8d..9d0cf019ce59 100644 --- a/drivers/ata/acard-ahci.c +++ b/drivers/ata/acard-ahci.c | |||
@@ -2,7 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * acard-ahci.c - ACard AHCI SATA support | 3 | * acard-ahci.c - ACard AHCI SATA support |
4 | * | 4 | * |
5 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 5 | * Maintained by: Tejun Heo <tj@kernel.org> |
6 | * Please ALWAYS copy linux-ide@vger.kernel.org | 6 | * Please ALWAYS copy linux-ide@vger.kernel.org |
7 | * on emails. | 7 | * on emails. |
8 | * | 8 | * |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 251e57d38942..2b50dfdf1cfc 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ahci.c - AHCI SATA support | 2 | * ahci.c - AHCI SATA support |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
@@ -423,6 +423,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
423 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ | 423 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ |
424 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a), | 424 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a), |
425 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ | 425 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ |
426 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9172), | ||
427 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ | ||
426 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192), | 428 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192), |
427 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ | 429 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ |
428 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3), | 430 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3), |
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index b830e6c9fe49..10b14d45cfd2 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ahci.h - Common AHCI SATA definitions and declarations | 2 | * ahci.h - Common AHCI SATA definitions and declarations |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 2f48123d74c4..9a8a674e8fac 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ata_piix.c - Intel PATA/SATA controllers | 2 | * ata_piix.c - Intel PATA/SATA controllers |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
@@ -151,6 +151,7 @@ enum piix_controller_ids { | |||
151 | piix_pata_vmw, /* PIIX4 for VMware, spurious DMA_ERR */ | 151 | piix_pata_vmw, /* PIIX4 for VMware, spurious DMA_ERR */ |
152 | ich8_sata_snb, | 152 | ich8_sata_snb, |
153 | ich8_2port_sata_snb, | 153 | ich8_2port_sata_snb, |
154 | ich8_2port_sata_byt, | ||
154 | }; | 155 | }; |
155 | 156 | ||
156 | struct piix_map_db { | 157 | struct piix_map_db { |
@@ -334,6 +335,9 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
334 | { 0x8086, 0x8d60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, | 335 | { 0x8086, 0x8d60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, |
335 | /* SATA Controller IDE (Wellsburg) */ | 336 | /* SATA Controller IDE (Wellsburg) */ |
336 | { 0x8086, 0x8d68, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 337 | { 0x8086, 0x8d68, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
338 | /* SATA Controller IDE (BayTrail) */ | ||
339 | { 0x8086, 0x0F20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt }, | ||
340 | { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt }, | ||
337 | 341 | ||
338 | { } /* terminate list */ | 342 | { } /* terminate list */ |
339 | }; | 343 | }; |
@@ -441,6 +445,7 @@ static const struct piix_map_db *piix_map_db_table[] = { | |||
441 | [tolapai_sata] = &tolapai_map_db, | 445 | [tolapai_sata] = &tolapai_map_db, |
442 | [ich8_sata_snb] = &ich8_map_db, | 446 | [ich8_sata_snb] = &ich8_map_db, |
443 | [ich8_2port_sata_snb] = &ich8_2port_map_db, | 447 | [ich8_2port_sata_snb] = &ich8_2port_map_db, |
448 | [ich8_2port_sata_byt] = &ich8_2port_map_db, | ||
444 | }; | 449 | }; |
445 | 450 | ||
446 | static struct pci_bits piix_enable_bits[] = { | 451 | static struct pci_bits piix_enable_bits[] = { |
@@ -1254,6 +1259,16 @@ static struct ata_port_info piix_port_info[] = { | |||
1254 | .udma_mask = ATA_UDMA6, | 1259 | .udma_mask = ATA_UDMA6, |
1255 | .port_ops = &piix_sata_ops, | 1260 | .port_ops = &piix_sata_ops, |
1256 | }, | 1261 | }, |
1262 | |||
1263 | [ich8_2port_sata_byt] = | ||
1264 | { | ||
1265 | .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR | PIIX_FLAG_PIO16, | ||
1266 | .pio_mask = ATA_PIO4, | ||
1267 | .mwdma_mask = ATA_MWDMA2, | ||
1268 | .udma_mask = ATA_UDMA6, | ||
1269 | .port_ops = &piix_sata_ops, | ||
1270 | }, | ||
1271 | |||
1257 | }; | 1272 | }; |
1258 | 1273 | ||
1259 | #define AHCI_PCI_BAR 5 | 1274 | #define AHCI_PCI_BAR 5 |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 34c82167b962..a70ff154f586 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * libahci.c - Common AHCI SATA low-level routines | 2 | * libahci.c - Common AHCI SATA low-level routines |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 63c743baf920..f2184276539d 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * libata-core.c - helper library for ATA | 2 | * libata-core.c - helper library for ATA |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
@@ -1602,6 +1602,12 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
1602 | qc->tf = *tf; | 1602 | qc->tf = *tf; |
1603 | if (cdb) | 1603 | if (cdb) |
1604 | memcpy(qc->cdb, cdb, ATAPI_CDB_LEN); | 1604 | memcpy(qc->cdb, cdb, ATAPI_CDB_LEN); |
1605 | |||
1606 | /* some SATA bridges need us to indicate data xfer direction */ | ||
1607 | if (tf->protocol == ATAPI_PROT_DMA && (dev->flags & ATA_DFLAG_DMADIR) && | ||
1608 | dma_dir == DMA_FROM_DEVICE) | ||
1609 | qc->tf.feature |= ATAPI_DMADIR; | ||
1610 | |||
1605 | qc->flags |= ATA_QCFLAG_RESULT_TF; | 1611 | qc->flags |= ATA_QCFLAG_RESULT_TF; |
1606 | qc->dma_dir = dma_dir; | 1612 | qc->dma_dir = dma_dir; |
1607 | if (dma_dir != DMA_NONE) { | 1613 | if (dma_dir != DMA_NONE) { |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index f9476fb3ac43..c69fcce505c0 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * libata-eh.c - libata error handling | 2 | * libata-eh.c - libata error handling |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index dd310b27b24c..0101af541436 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * libata-scsi.c - helper library for ATA | 2 | * libata-scsi.c - helper library for ATA |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index d8af325a6bda..b603720b877d 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * libata-sff.c - helper library for PCI IDE BMDMA | 2 | * libata-sff.c - helper library for PCI IDE BMDMA |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c index c1bfaf43d109..980b88e109fc 100644 --- a/drivers/ata/pata_ep93xx.c +++ b/drivers/ata/pata_ep93xx.c | |||
@@ -933,11 +933,6 @@ static int ep93xx_pata_probe(struct platform_device *pdev) | |||
933 | } | 933 | } |
934 | 934 | ||
935 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 935 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
936 | if (!mem_res) { | ||
937 | err = -ENXIO; | ||
938 | goto err_rel_gpio; | ||
939 | } | ||
940 | |||
941 | ide_base = devm_ioremap_resource(&pdev->dev, mem_res); | 936 | ide_base = devm_ioremap_resource(&pdev->dev, mem_res); |
942 | if (IS_ERR(ide_base)) { | 937 | if (IS_ERR(ide_base)) { |
943 | err = PTR_ERR(ide_base); | 938 | err = PTR_ERR(ide_base); |
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c index 505333340ad5..8ea6e6afd041 100644 --- a/drivers/ata/pdc_adma.c +++ b/drivers/ata/pdc_adma.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pdc_adma.c - Pacific Digital Corporation ADMA | 2 | * pdc_adma.c - Pacific Digital Corporation ADMA |
3 | * | 3 | * |
4 | * Maintained by: Mark Lord <mlord@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * | 5 | * |
6 | * Copyright 2005 Mark Lord | 6 | * Copyright 2005 Mark Lord |
7 | * | 7 | * |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index fb0dd87f8893..958ba2a420c3 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * sata_promise.c - Promise SATA | 2 | * sata_promise.c - Promise SATA |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Mikael Pettersson <mikpe@it.uu.se> | 5 | * Mikael Pettersson <mikpe@it.uu.se> |
6 | * Please ALWAYS copy linux-ide@vger.kernel.org | 6 | * Please ALWAYS copy linux-ide@vger.kernel.org |
7 | * on emails. | 7 | * on emails. |
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c index 4799868bd733..249c8a289bfd 100644 --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c | |||
@@ -549,6 +549,7 @@ static void sata_rcar_bmdma_start(struct ata_queued_cmd *qc) | |||
549 | 549 | ||
550 | /* start host DMA transaction */ | 550 | /* start host DMA transaction */ |
551 | dmactl = ioread32(priv->base + ATAPI_CONTROL1_REG); | 551 | dmactl = ioread32(priv->base + ATAPI_CONTROL1_REG); |
552 | dmactl &= ~ATAPI_CONTROL1_STOP; | ||
552 | dmactl |= ATAPI_CONTROL1_START; | 553 | dmactl |= ATAPI_CONTROL1_START; |
553 | iowrite32(dmactl, priv->base + ATAPI_CONTROL1_REG); | 554 | iowrite32(dmactl, priv->base + ATAPI_CONTROL1_REG); |
554 | } | 555 | } |
@@ -618,17 +619,16 @@ static struct ata_port_operations sata_rcar_port_ops = { | |||
618 | .bmdma_status = sata_rcar_bmdma_status, | 619 | .bmdma_status = sata_rcar_bmdma_status, |
619 | }; | 620 | }; |
620 | 621 | ||
621 | static int sata_rcar_serr_interrupt(struct ata_port *ap) | 622 | static void sata_rcar_serr_interrupt(struct ata_port *ap) |
622 | { | 623 | { |
623 | struct sata_rcar_priv *priv = ap->host->private_data; | 624 | struct sata_rcar_priv *priv = ap->host->private_data; |
624 | struct ata_eh_info *ehi = &ap->link.eh_info; | 625 | struct ata_eh_info *ehi = &ap->link.eh_info; |
625 | int freeze = 0; | 626 | int freeze = 0; |
626 | int handled = 0; | ||
627 | u32 serror; | 627 | u32 serror; |
628 | 628 | ||
629 | serror = ioread32(priv->base + SCRSERR_REG); | 629 | serror = ioread32(priv->base + SCRSERR_REG); |
630 | if (!serror) | 630 | if (!serror) |
631 | return 0; | 631 | return; |
632 | 632 | ||
633 | DPRINTK("SError @host_intr: 0x%x\n", serror); | 633 | DPRINTK("SError @host_intr: 0x%x\n", serror); |
634 | 634 | ||
@@ -641,7 +641,6 @@ static int sata_rcar_serr_interrupt(struct ata_port *ap) | |||
641 | ata_ehi_push_desc(ehi, "%s", "hotplug"); | 641 | ata_ehi_push_desc(ehi, "%s", "hotplug"); |
642 | 642 | ||
643 | freeze = serror & SERR_COMM_WAKE ? 0 : 1; | 643 | freeze = serror & SERR_COMM_WAKE ? 0 : 1; |
644 | handled = 1; | ||
645 | } | 644 | } |
646 | 645 | ||
647 | /* freeze or abort */ | 646 | /* freeze or abort */ |
@@ -649,11 +648,9 @@ static int sata_rcar_serr_interrupt(struct ata_port *ap) | |||
649 | ata_port_freeze(ap); | 648 | ata_port_freeze(ap); |
650 | else | 649 | else |
651 | ata_port_abort(ap); | 650 | ata_port_abort(ap); |
652 | |||
653 | return handled; | ||
654 | } | 651 | } |
655 | 652 | ||
656 | static int sata_rcar_ata_interrupt(struct ata_port *ap) | 653 | static void sata_rcar_ata_interrupt(struct ata_port *ap) |
657 | { | 654 | { |
658 | struct ata_queued_cmd *qc; | 655 | struct ata_queued_cmd *qc; |
659 | int handled = 0; | 656 | int handled = 0; |
@@ -662,7 +659,9 @@ static int sata_rcar_ata_interrupt(struct ata_port *ap) | |||
662 | if (qc) | 659 | if (qc) |
663 | handled |= ata_bmdma_port_intr(ap, qc); | 660 | handled |= ata_bmdma_port_intr(ap, qc); |
664 | 661 | ||
665 | return handled; | 662 | /* be sure to clear ATA interrupt */ |
663 | if (!handled) | ||
664 | sata_rcar_check_status(ap); | ||
666 | } | 665 | } |
667 | 666 | ||
668 | static irqreturn_t sata_rcar_interrupt(int irq, void *dev_instance) | 667 | static irqreturn_t sata_rcar_interrupt(int irq, void *dev_instance) |
@@ -677,20 +676,21 @@ static irqreturn_t sata_rcar_interrupt(int irq, void *dev_instance) | |||
677 | spin_lock_irqsave(&host->lock, flags); | 676 | spin_lock_irqsave(&host->lock, flags); |
678 | 677 | ||
679 | sataintstat = ioread32(priv->base + SATAINTSTAT_REG); | 678 | sataintstat = ioread32(priv->base + SATAINTSTAT_REG); |
679 | sataintstat &= SATA_RCAR_INT_MASK; | ||
680 | if (!sataintstat) | 680 | if (!sataintstat) |
681 | goto done; | 681 | goto done; |
682 | /* ack */ | 682 | /* ack */ |
683 | iowrite32(sataintstat & ~SATA_RCAR_INT_MASK, | 683 | iowrite32(~sataintstat & 0x7ff, priv->base + SATAINTSTAT_REG); |
684 | priv->base + SATAINTSTAT_REG); | ||
685 | 684 | ||
686 | ap = host->ports[0]; | 685 | ap = host->ports[0]; |
687 | 686 | ||
688 | if (sataintstat & SATAINTSTAT_ATA) | 687 | if (sataintstat & SATAINTSTAT_ATA) |
689 | handled |= sata_rcar_ata_interrupt(ap); | 688 | sata_rcar_ata_interrupt(ap); |
690 | 689 | ||
691 | if (sataintstat & SATAINTSTAT_SERR) | 690 | if (sataintstat & SATAINTSTAT_SERR) |
692 | handled |= sata_rcar_serr_interrupt(ap); | 691 | sata_rcar_serr_interrupt(ap); |
693 | 692 | ||
693 | handled = 1; | ||
694 | done: | 694 | done: |
695 | spin_unlock_irqrestore(&host->lock, flags); | 695 | spin_unlock_irqrestore(&host->lock, flags); |
696 | 696 | ||
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index a7b31672c4b7..0ae3ca4bf5c0 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * sata_sil.c - Silicon Image SATA | 2 | * sata_sil.c - Silicon Image SATA |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index 7b7127a58f51..9947010afc0f 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * sata_sx4.c - Promise SATA | 2 | * sata_sx4.c - Promise SATA |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 5913ea9d57b2..87f056e54a9d 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * sata_via.c - VIA Serial ATA controllers | 2 | * sata_via.c - VIA Serial ATA controllers |
3 | * | 3 | * |
4 | * Maintained by: Jeff Garzik <jgarzik@pobox.com> | 4 | * Maintained by: Tejun Heo <tj@kernel.org> |
5 | * Please ALWAYS copy linux-ide@vger.kernel.org | 5 | * Please ALWAYS copy linux-ide@vger.kernel.org |
6 | * on emails. | 6 | * on emails. |
7 | * | 7 | * |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 1a68f947ded8..d414331b480e 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -1295,6 +1295,7 @@ int subsys_virtual_register(struct bus_type *subsys, | |||
1295 | 1295 | ||
1296 | return subsys_register(subsys, groups, virtual_dir); | 1296 | return subsys_register(subsys, groups, virtual_dir); |
1297 | } | 1297 | } |
1298 | EXPORT_SYMBOL_GPL(subsys_virtual_register); | ||
1298 | 1299 | ||
1299 | int __init buses_init(void) | 1300 | int __init buses_init(void) |
1300 | { | 1301 | { |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 016312437577..2499cefdcdf2 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -572,9 +572,11 @@ int device_create_file(struct device *dev, | |||
572 | 572 | ||
573 | if (dev) { | 573 | if (dev) { |
574 | WARN(((attr->attr.mode & S_IWUGO) && !attr->store), | 574 | WARN(((attr->attr.mode & S_IWUGO) && !attr->store), |
575 | "Write permission without 'store'\n"); | 575 | "Attribute %s: write permission without 'store'\n", |
576 | attr->attr.name); | ||
576 | WARN(((attr->attr.mode & S_IRUGO) && !attr->show), | 577 | WARN(((attr->attr.mode & S_IRUGO) && !attr->show), |
577 | "Read permission without 'show'\n"); | 578 | "Attribute %s: read permission without 'show'\n", |
579 | attr->attr.name); | ||
578 | error = sysfs_create_file(&dev->kobj, &attr->attr); | 580 | error = sysfs_create_file(&dev->kobj, &attr->attr); |
579 | } | 581 | } |
580 | 582 | ||
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 4b1f9265887f..01e21037d8fe 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -450,8 +450,18 @@ static void fw_load_abort(struct firmware_priv *fw_priv) | |||
450 | { | 450 | { |
451 | struct firmware_buf *buf = fw_priv->buf; | 451 | struct firmware_buf *buf = fw_priv->buf; |
452 | 452 | ||
453 | /* | ||
454 | * There is a small window in which user can write to 'loading' | ||
455 | * between loading done and disappearance of 'loading' | ||
456 | */ | ||
457 | if (test_bit(FW_STATUS_DONE, &buf->status)) | ||
458 | return; | ||
459 | |||
453 | set_bit(FW_STATUS_ABORT, &buf->status); | 460 | set_bit(FW_STATUS_ABORT, &buf->status); |
454 | complete_all(&buf->completion); | 461 | complete_all(&buf->completion); |
462 | |||
463 | /* avoid user action after loading abort */ | ||
464 | fw_priv->buf = NULL; | ||
455 | } | 465 | } |
456 | 466 | ||
457 | #define is_fw_load_aborted(buf) \ | 467 | #define is_fw_load_aborted(buf) \ |
@@ -528,7 +538,12 @@ static ssize_t firmware_loading_show(struct device *dev, | |||
528 | struct device_attribute *attr, char *buf) | 538 | struct device_attribute *attr, char *buf) |
529 | { | 539 | { |
530 | struct firmware_priv *fw_priv = to_firmware_priv(dev); | 540 | struct firmware_priv *fw_priv = to_firmware_priv(dev); |
531 | int loading = test_bit(FW_STATUS_LOADING, &fw_priv->buf->status); | 541 | int loading = 0; |
542 | |||
543 | mutex_lock(&fw_lock); | ||
544 | if (fw_priv->buf) | ||
545 | loading = test_bit(FW_STATUS_LOADING, &fw_priv->buf->status); | ||
546 | mutex_unlock(&fw_lock); | ||
532 | 547 | ||
533 | return sprintf(buf, "%d\n", loading); | 548 | return sprintf(buf, "%d\n", loading); |
534 | } | 549 | } |
@@ -570,12 +585,12 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
570 | const char *buf, size_t count) | 585 | const char *buf, size_t count) |
571 | { | 586 | { |
572 | struct firmware_priv *fw_priv = to_firmware_priv(dev); | 587 | struct firmware_priv *fw_priv = to_firmware_priv(dev); |
573 | struct firmware_buf *fw_buf = fw_priv->buf; | 588 | struct firmware_buf *fw_buf; |
574 | int loading = simple_strtol(buf, NULL, 10); | 589 | int loading = simple_strtol(buf, NULL, 10); |
575 | int i; | 590 | int i; |
576 | 591 | ||
577 | mutex_lock(&fw_lock); | 592 | mutex_lock(&fw_lock); |
578 | 593 | fw_buf = fw_priv->buf; | |
579 | if (!fw_buf) | 594 | if (!fw_buf) |
580 | goto out; | 595 | goto out; |
581 | 596 | ||
@@ -777,10 +792,6 @@ static void firmware_class_timeout_work(struct work_struct *work) | |||
777 | struct firmware_priv, timeout_work.work); | 792 | struct firmware_priv, timeout_work.work); |
778 | 793 | ||
779 | mutex_lock(&fw_lock); | 794 | mutex_lock(&fw_lock); |
780 | if (test_bit(FW_STATUS_DONE, &(fw_priv->buf->status))) { | ||
781 | mutex_unlock(&fw_lock); | ||
782 | return; | ||
783 | } | ||
784 | fw_load_abort(fw_priv); | 795 | fw_load_abort(fw_priv); |
785 | mutex_unlock(&fw_lock); | 796 | mutex_unlock(&fw_lock); |
786 | } | 797 | } |
@@ -861,8 +872,6 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
861 | 872 | ||
862 | cancel_delayed_work_sync(&fw_priv->timeout_work); | 873 | cancel_delayed_work_sync(&fw_priv->timeout_work); |
863 | 874 | ||
864 | fw_priv->buf = NULL; | ||
865 | |||
866 | device_remove_file(f_dev, &dev_attr_loading); | 875 | device_remove_file(f_dev, &dev_attr_loading); |
867 | err_del_bin_attr: | 876 | err_del_bin_attr: |
868 | device_remove_bin_file(f_dev, &firmware_attr_data); | 877 | device_remove_bin_file(f_dev, &firmware_attr_data); |
diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c index 39c32529b833..5da914041305 100644 --- a/drivers/base/power/common.c +++ b/drivers/base/power/common.c | |||
@@ -61,24 +61,24 @@ EXPORT_SYMBOL_GPL(dev_pm_get_subsys_data); | |||
61 | int dev_pm_put_subsys_data(struct device *dev) | 61 | int dev_pm_put_subsys_data(struct device *dev) |
62 | { | 62 | { |
63 | struct pm_subsys_data *psd; | 63 | struct pm_subsys_data *psd; |
64 | int ret = 0; | 64 | int ret = 1; |
65 | 65 | ||
66 | spin_lock_irq(&dev->power.lock); | 66 | spin_lock_irq(&dev->power.lock); |
67 | 67 | ||
68 | psd = dev_to_psd(dev); | 68 | psd = dev_to_psd(dev); |
69 | if (!psd) { | 69 | if (!psd) |
70 | ret = -EINVAL; | ||
71 | goto out; | 70 | goto out; |
72 | } | ||
73 | 71 | ||
74 | if (--psd->refcount == 0) { | 72 | if (--psd->refcount == 0) { |
75 | dev->power.subsys_data = NULL; | 73 | dev->power.subsys_data = NULL; |
76 | kfree(psd); | 74 | } else { |
77 | ret = 1; | 75 | psd = NULL; |
76 | ret = 0; | ||
78 | } | 77 | } |
79 | 78 | ||
80 | out: | 79 | out: |
81 | spin_unlock_irq(&dev->power.lock); | 80 | spin_unlock_irq(&dev->power.lock); |
81 | kfree(psd); | ||
82 | 82 | ||
83 | return ret; | 83 | return ret; |
84 | } | 84 | } |
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index aa0875f6f1b7..02f490bad30f 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
@@ -143,7 +143,7 @@ static int rbtree_show(struct seq_file *s, void *ignored) | |||
143 | int registers = 0; | 143 | int registers = 0; |
144 | int this_registers, average; | 144 | int this_registers, average; |
145 | 145 | ||
146 | map->lock(map); | 146 | map->lock(map->lock_arg); |
147 | 147 | ||
148 | mem_size = sizeof(*rbtree_ctx); | 148 | mem_size = sizeof(*rbtree_ctx); |
149 | mem_size += BITS_TO_LONGS(map->cache_present_nbits) * sizeof(long); | 149 | mem_size += BITS_TO_LONGS(map->cache_present_nbits) * sizeof(long); |
@@ -170,7 +170,7 @@ static int rbtree_show(struct seq_file *s, void *ignored) | |||
170 | seq_printf(s, "%d nodes, %d registers, average %d registers, used %zu bytes\n", | 170 | seq_printf(s, "%d nodes, %d registers, average %d registers, used %zu bytes\n", |
171 | nodes, registers, average, mem_size); | 171 | nodes, registers, average, mem_size); |
172 | 172 | ||
173 | map->unlock(map); | 173 | map->unlock(map->lock_arg); |
174 | 174 | ||
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
@@ -391,8 +391,6 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min, | |||
391 | for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) { | 391 | for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) { |
392 | rbnode = rb_entry(node, struct regcache_rbtree_node, node); | 392 | rbnode = rb_entry(node, struct regcache_rbtree_node, node); |
393 | 393 | ||
394 | if (rbnode->base_reg < min) | ||
395 | continue; | ||
396 | if (rbnode->base_reg > max) | 394 | if (rbnode->base_reg > max) |
397 | break; | 395 | break; |
398 | if (rbnode->base_reg + rbnode->blklen < min) | 396 | if (rbnode->base_reg + rbnode->blklen < min) |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 75923f2396bd..507ee2da0f6e 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -270,7 +270,7 @@ int regcache_sync(struct regmap *map) | |||
270 | 270 | ||
271 | BUG_ON(!map->cache_ops || !map->cache_ops->sync); | 271 | BUG_ON(!map->cache_ops || !map->cache_ops->sync); |
272 | 272 | ||
273 | map->lock(map); | 273 | map->lock(map->lock_arg); |
274 | /* Remember the initial bypass state */ | 274 | /* Remember the initial bypass state */ |
275 | bypass = map->cache_bypass; | 275 | bypass = map->cache_bypass; |
276 | dev_dbg(map->dev, "Syncing %s cache\n", | 276 | dev_dbg(map->dev, "Syncing %s cache\n", |
@@ -306,7 +306,7 @@ out: | |||
306 | trace_regcache_sync(map->dev, name, "stop"); | 306 | trace_regcache_sync(map->dev, name, "stop"); |
307 | /* Restore the bypass state */ | 307 | /* Restore the bypass state */ |
308 | map->cache_bypass = bypass; | 308 | map->cache_bypass = bypass; |
309 | map->unlock(map); | 309 | map->unlock(map->lock_arg); |
310 | 310 | ||
311 | return ret; | 311 | return ret; |
312 | } | 312 | } |
@@ -333,7 +333,7 @@ int regcache_sync_region(struct regmap *map, unsigned int min, | |||
333 | 333 | ||
334 | BUG_ON(!map->cache_ops || !map->cache_ops->sync); | 334 | BUG_ON(!map->cache_ops || !map->cache_ops->sync); |
335 | 335 | ||
336 | map->lock(map); | 336 | map->lock(map->lock_arg); |
337 | 337 | ||
338 | /* Remember the initial bypass state */ | 338 | /* Remember the initial bypass state */ |
339 | bypass = map->cache_bypass; | 339 | bypass = map->cache_bypass; |
@@ -352,7 +352,7 @@ out: | |||
352 | trace_regcache_sync(map->dev, name, "stop region"); | 352 | trace_regcache_sync(map->dev, name, "stop region"); |
353 | /* Restore the bypass state */ | 353 | /* Restore the bypass state */ |
354 | map->cache_bypass = bypass; | 354 | map->cache_bypass = bypass; |
355 | map->unlock(map); | 355 | map->unlock(map->lock_arg); |
356 | 356 | ||
357 | return ret; | 357 | return ret; |
358 | } | 358 | } |
@@ -372,11 +372,11 @@ EXPORT_SYMBOL_GPL(regcache_sync_region); | |||
372 | */ | 372 | */ |
373 | void regcache_cache_only(struct regmap *map, bool enable) | 373 | void regcache_cache_only(struct regmap *map, bool enable) |
374 | { | 374 | { |
375 | map->lock(map); | 375 | map->lock(map->lock_arg); |
376 | WARN_ON(map->cache_bypass && enable); | 376 | WARN_ON(map->cache_bypass && enable); |
377 | map->cache_only = enable; | 377 | map->cache_only = enable; |
378 | trace_regmap_cache_only(map->dev, enable); | 378 | trace_regmap_cache_only(map->dev, enable); |
379 | map->unlock(map); | 379 | map->unlock(map->lock_arg); |
380 | } | 380 | } |
381 | EXPORT_SYMBOL_GPL(regcache_cache_only); | 381 | EXPORT_SYMBOL_GPL(regcache_cache_only); |
382 | 382 | ||
@@ -391,9 +391,9 @@ EXPORT_SYMBOL_GPL(regcache_cache_only); | |||
391 | */ | 391 | */ |
392 | void regcache_mark_dirty(struct regmap *map) | 392 | void regcache_mark_dirty(struct regmap *map) |
393 | { | 393 | { |
394 | map->lock(map); | 394 | map->lock(map->lock_arg); |
395 | map->cache_dirty = true; | 395 | map->cache_dirty = true; |
396 | map->unlock(map); | 396 | map->unlock(map->lock_arg); |
397 | } | 397 | } |
398 | EXPORT_SYMBOL_GPL(regcache_mark_dirty); | 398 | EXPORT_SYMBOL_GPL(regcache_mark_dirty); |
399 | 399 | ||
@@ -410,11 +410,11 @@ EXPORT_SYMBOL_GPL(regcache_mark_dirty); | |||
410 | */ | 410 | */ |
411 | void regcache_cache_bypass(struct regmap *map, bool enable) | 411 | void regcache_cache_bypass(struct regmap *map, bool enable) |
412 | { | 412 | { |
413 | map->lock(map); | 413 | map->lock(map->lock_arg); |
414 | WARN_ON(map->cache_only && enable); | 414 | WARN_ON(map->cache_only && enable); |
415 | map->cache_bypass = enable; | 415 | map->cache_bypass = enable; |
416 | trace_regmap_cache_bypass(map->dev, enable); | 416 | trace_regmap_cache_bypass(map->dev, enable); |
417 | map->unlock(map); | 417 | map->unlock(map->lock_arg); |
418 | } | 418 | } |
419 | EXPORT_SYMBOL_GPL(regcache_cache_bypass); | 419 | EXPORT_SYMBOL_GPL(regcache_cache_bypass); |
420 | 420 | ||
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 23b701f5fd2f..975719bc3450 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
@@ -265,6 +265,7 @@ static ssize_t regmap_map_write_file(struct file *file, | |||
265 | char *start = buf; | 265 | char *start = buf; |
266 | unsigned long reg, value; | 266 | unsigned long reg, value; |
267 | struct regmap *map = file->private_data; | 267 | struct regmap *map = file->private_data; |
268 | int ret; | ||
268 | 269 | ||
269 | buf_size = min(count, (sizeof(buf)-1)); | 270 | buf_size = min(count, (sizeof(buf)-1)); |
270 | if (copy_from_user(buf, user_buf, buf_size)) | 271 | if (copy_from_user(buf, user_buf, buf_size)) |
@@ -282,7 +283,9 @@ static ssize_t regmap_map_write_file(struct file *file, | |||
282 | /* Userspace has been fiddling around behind the kernel's back */ | 283 | /* Userspace has been fiddling around behind the kernel's back */ |
283 | add_taint(TAINT_USER, LOCKDEP_NOW_UNRELIABLE); | 284 | add_taint(TAINT_USER, LOCKDEP_NOW_UNRELIABLE); |
284 | 285 | ||
285 | regmap_write(map, reg, value); | 286 | ret = regmap_write(map, reg, value); |
287 | if (ret < 0) | ||
288 | return ret; | ||
286 | return buf_size; | 289 | return buf_size; |
287 | } | 290 | } |
288 | #else | 291 | #else |
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c index bca9c80056fe..8bffa5c9818c 100644 --- a/drivers/bcma/scan.c +++ b/drivers/bcma/scan.c | |||
@@ -84,6 +84,8 @@ static const struct bcma_device_id_name bcma_bcm_device_names[] = { | |||
84 | { BCMA_CORE_I2S, "I2S" }, | 84 | { BCMA_CORE_I2S, "I2S" }, |
85 | { BCMA_CORE_SDR_DDR1_MEM_CTL, "SDR/DDR1 Memory Controller" }, | 85 | { BCMA_CORE_SDR_DDR1_MEM_CTL, "SDR/DDR1 Memory Controller" }, |
86 | { BCMA_CORE_SHIM, "SHIM" }, | 86 | { BCMA_CORE_SHIM, "SHIM" }, |
87 | { BCMA_CORE_PCIE2, "PCIe Gen2" }, | ||
88 | { BCMA_CORE_ARM_CR4, "ARM CR4" }, | ||
87 | { BCMA_CORE_DEFAULT, "Default" }, | 89 | { BCMA_CORE_DEFAULT, "Default" }, |
88 | }; | 90 | }; |
89 | 91 | ||
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index f1a29f8e9d33..9bf4371755f2 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
@@ -117,13 +117,13 @@ static struct page *brd_insert_page(struct brd_device *brd, sector_t sector) | |||
117 | 117 | ||
118 | spin_lock(&brd->brd_lock); | 118 | spin_lock(&brd->brd_lock); |
119 | idx = sector >> PAGE_SECTORS_SHIFT; | 119 | idx = sector >> PAGE_SECTORS_SHIFT; |
120 | page->index = idx; | ||
120 | if (radix_tree_insert(&brd->brd_pages, idx, page)) { | 121 | if (radix_tree_insert(&brd->brd_pages, idx, page)) { |
121 | __free_page(page); | 122 | __free_page(page); |
122 | page = radix_tree_lookup(&brd->brd_pages, idx); | 123 | page = radix_tree_lookup(&brd->brd_pages, idx); |
123 | BUG_ON(!page); | 124 | BUG_ON(!page); |
124 | BUG_ON(page->index != idx); | 125 | BUG_ON(page->index != idx); |
125 | } else | 126 | } |
126 | page->index = idx; | ||
127 | spin_unlock(&brd->brd_lock); | 127 | spin_unlock(&brd->brd_lock); |
128 | 128 | ||
129 | radix_tree_preload_end(); | 129 | radix_tree_preload_end(); |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 6374dc103521..62b6c2cc80b5 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -168,8 +168,6 @@ static irqreturn_t do_cciss_msix_intr(int irq, void *dev_id); | |||
168 | static int cciss_open(struct block_device *bdev, fmode_t mode); | 168 | static int cciss_open(struct block_device *bdev, fmode_t mode); |
169 | static int cciss_unlocked_open(struct block_device *bdev, fmode_t mode); | 169 | static int cciss_unlocked_open(struct block_device *bdev, fmode_t mode); |
170 | static void cciss_release(struct gendisk *disk, fmode_t mode); | 170 | static void cciss_release(struct gendisk *disk, fmode_t mode); |
171 | static int do_ioctl(struct block_device *bdev, fmode_t mode, | ||
172 | unsigned int cmd, unsigned long arg); | ||
173 | static int cciss_ioctl(struct block_device *bdev, fmode_t mode, | 171 | static int cciss_ioctl(struct block_device *bdev, fmode_t mode, |
174 | unsigned int cmd, unsigned long arg); | 172 | unsigned int cmd, unsigned long arg); |
175 | static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); | 173 | static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); |
@@ -235,7 +233,7 @@ static const struct block_device_operations cciss_fops = { | |||
235 | .owner = THIS_MODULE, | 233 | .owner = THIS_MODULE, |
236 | .open = cciss_unlocked_open, | 234 | .open = cciss_unlocked_open, |
237 | .release = cciss_release, | 235 | .release = cciss_release, |
238 | .ioctl = do_ioctl, | 236 | .ioctl = cciss_ioctl, |
239 | .getgeo = cciss_getgeo, | 237 | .getgeo = cciss_getgeo, |
240 | #ifdef CONFIG_COMPAT | 238 | #ifdef CONFIG_COMPAT |
241 | .compat_ioctl = cciss_compat_ioctl, | 239 | .compat_ioctl = cciss_compat_ioctl, |
@@ -1143,16 +1141,6 @@ static void cciss_release(struct gendisk *disk, fmode_t mode) | |||
1143 | mutex_unlock(&cciss_mutex); | 1141 | mutex_unlock(&cciss_mutex); |
1144 | } | 1142 | } |
1145 | 1143 | ||
1146 | static int do_ioctl(struct block_device *bdev, fmode_t mode, | ||
1147 | unsigned cmd, unsigned long arg) | ||
1148 | { | ||
1149 | int ret; | ||
1150 | mutex_lock(&cciss_mutex); | ||
1151 | ret = cciss_ioctl(bdev, mode, cmd, arg); | ||
1152 | mutex_unlock(&cciss_mutex); | ||
1153 | return ret; | ||
1154 | } | ||
1155 | |||
1156 | #ifdef CONFIG_COMPAT | 1144 | #ifdef CONFIG_COMPAT |
1157 | 1145 | ||
1158 | static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode, | 1146 | static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode, |
@@ -1179,7 +1167,7 @@ static int cciss_compat_ioctl(struct block_device *bdev, fmode_t mode, | |||
1179 | case CCISS_REGNEWD: | 1167 | case CCISS_REGNEWD: |
1180 | case CCISS_RESCANDISK: | 1168 | case CCISS_RESCANDISK: |
1181 | case CCISS_GETLUNINFO: | 1169 | case CCISS_GETLUNINFO: |
1182 | return do_ioctl(bdev, mode, cmd, arg); | 1170 | return cciss_ioctl(bdev, mode, cmd, arg); |
1183 | 1171 | ||
1184 | case CCISS_PASSTHRU32: | 1172 | case CCISS_PASSTHRU32: |
1185 | return cciss_ioctl32_passthru(bdev, mode, cmd, arg); | 1173 | return cciss_ioctl32_passthru(bdev, mode, cmd, arg); |
@@ -1219,7 +1207,7 @@ static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode, | |||
1219 | if (err) | 1207 | if (err) |
1220 | return -EFAULT; | 1208 | return -EFAULT; |
1221 | 1209 | ||
1222 | err = do_ioctl(bdev, mode, CCISS_PASSTHRU, (unsigned long)p); | 1210 | err = cciss_ioctl(bdev, mode, CCISS_PASSTHRU, (unsigned long)p); |
1223 | if (err) | 1211 | if (err) |
1224 | return err; | 1212 | return err; |
1225 | err |= | 1213 | err |= |
@@ -1261,7 +1249,7 @@ static int cciss_ioctl32_big_passthru(struct block_device *bdev, fmode_t mode, | |||
1261 | if (err) | 1249 | if (err) |
1262 | return -EFAULT; | 1250 | return -EFAULT; |
1263 | 1251 | ||
1264 | err = do_ioctl(bdev, mode, CCISS_BIG_PASSTHRU, (unsigned long)p); | 1252 | err = cciss_ioctl(bdev, mode, CCISS_BIG_PASSTHRU, (unsigned long)p); |
1265 | if (err) | 1253 | if (err) |
1266 | return err; | 1254 | return err; |
1267 | err |= | 1255 | err |= |
@@ -1311,11 +1299,14 @@ static int cciss_getpciinfo(ctlr_info_t *h, void __user *argp) | |||
1311 | static int cciss_getintinfo(ctlr_info_t *h, void __user *argp) | 1299 | static int cciss_getintinfo(ctlr_info_t *h, void __user *argp) |
1312 | { | 1300 | { |
1313 | cciss_coalint_struct intinfo; | 1301 | cciss_coalint_struct intinfo; |
1302 | unsigned long flags; | ||
1314 | 1303 | ||
1315 | if (!argp) | 1304 | if (!argp) |
1316 | return -EINVAL; | 1305 | return -EINVAL; |
1306 | spin_lock_irqsave(&h->lock, flags); | ||
1317 | intinfo.delay = readl(&h->cfgtable->HostWrite.CoalIntDelay); | 1307 | intinfo.delay = readl(&h->cfgtable->HostWrite.CoalIntDelay); |
1318 | intinfo.count = readl(&h->cfgtable->HostWrite.CoalIntCount); | 1308 | intinfo.count = readl(&h->cfgtable->HostWrite.CoalIntCount); |
1309 | spin_unlock_irqrestore(&h->lock, flags); | ||
1319 | if (copy_to_user | 1310 | if (copy_to_user |
1320 | (argp, &intinfo, sizeof(cciss_coalint_struct))) | 1311 | (argp, &intinfo, sizeof(cciss_coalint_struct))) |
1321 | return -EFAULT; | 1312 | return -EFAULT; |
@@ -1356,12 +1347,15 @@ static int cciss_setintinfo(ctlr_info_t *h, void __user *argp) | |||
1356 | static int cciss_getnodename(ctlr_info_t *h, void __user *argp) | 1347 | static int cciss_getnodename(ctlr_info_t *h, void __user *argp) |
1357 | { | 1348 | { |
1358 | NodeName_type NodeName; | 1349 | NodeName_type NodeName; |
1350 | unsigned long flags; | ||
1359 | int i; | 1351 | int i; |
1360 | 1352 | ||
1361 | if (!argp) | 1353 | if (!argp) |
1362 | return -EINVAL; | 1354 | return -EINVAL; |
1355 | spin_lock_irqsave(&h->lock, flags); | ||
1363 | for (i = 0; i < 16; i++) | 1356 | for (i = 0; i < 16; i++) |
1364 | NodeName[i] = readb(&h->cfgtable->ServerName[i]); | 1357 | NodeName[i] = readb(&h->cfgtable->ServerName[i]); |
1358 | spin_unlock_irqrestore(&h->lock, flags); | ||
1365 | if (copy_to_user(argp, NodeName, sizeof(NodeName_type))) | 1359 | if (copy_to_user(argp, NodeName, sizeof(NodeName_type))) |
1366 | return -EFAULT; | 1360 | return -EFAULT; |
1367 | return 0; | 1361 | return 0; |
@@ -1398,10 +1392,13 @@ static int cciss_setnodename(ctlr_info_t *h, void __user *argp) | |||
1398 | static int cciss_getheartbeat(ctlr_info_t *h, void __user *argp) | 1392 | static int cciss_getheartbeat(ctlr_info_t *h, void __user *argp) |
1399 | { | 1393 | { |
1400 | Heartbeat_type heartbeat; | 1394 | Heartbeat_type heartbeat; |
1395 | unsigned long flags; | ||
1401 | 1396 | ||
1402 | if (!argp) | 1397 | if (!argp) |
1403 | return -EINVAL; | 1398 | return -EINVAL; |
1399 | spin_lock_irqsave(&h->lock, flags); | ||
1404 | heartbeat = readl(&h->cfgtable->HeartBeat); | 1400 | heartbeat = readl(&h->cfgtable->HeartBeat); |
1401 | spin_unlock_irqrestore(&h->lock, flags); | ||
1405 | if (copy_to_user(argp, &heartbeat, sizeof(Heartbeat_type))) | 1402 | if (copy_to_user(argp, &heartbeat, sizeof(Heartbeat_type))) |
1406 | return -EFAULT; | 1403 | return -EFAULT; |
1407 | return 0; | 1404 | return 0; |
@@ -1410,10 +1407,13 @@ static int cciss_getheartbeat(ctlr_info_t *h, void __user *argp) | |||
1410 | static int cciss_getbustypes(ctlr_info_t *h, void __user *argp) | 1407 | static int cciss_getbustypes(ctlr_info_t *h, void __user *argp) |
1411 | { | 1408 | { |
1412 | BusTypes_type BusTypes; | 1409 | BusTypes_type BusTypes; |
1410 | unsigned long flags; | ||
1413 | 1411 | ||
1414 | if (!argp) | 1412 | if (!argp) |
1415 | return -EINVAL; | 1413 | return -EINVAL; |
1414 | spin_lock_irqsave(&h->lock, flags); | ||
1416 | BusTypes = readl(&h->cfgtable->BusTypes); | 1415 | BusTypes = readl(&h->cfgtable->BusTypes); |
1416 | spin_unlock_irqrestore(&h->lock, flags); | ||
1417 | if (copy_to_user(argp, &BusTypes, sizeof(BusTypes_type))) | 1417 | if (copy_to_user(argp, &BusTypes, sizeof(BusTypes_type))) |
1418 | return -EFAULT; | 1418 | return -EFAULT; |
1419 | return 0; | 1419 | return 0; |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 847107ef0cce..20dd52a2f92f 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -3002,7 +3002,8 @@ static int mtip_hw_debugfs_init(struct driver_data *dd) | |||
3002 | 3002 | ||
3003 | static void mtip_hw_debugfs_exit(struct driver_data *dd) | 3003 | static void mtip_hw_debugfs_exit(struct driver_data *dd) |
3004 | { | 3004 | { |
3005 | debugfs_remove_recursive(dd->dfs_node); | 3005 | if (dd->dfs_node) |
3006 | debugfs_remove_recursive(dd->dfs_node); | ||
3006 | } | 3007 | } |
3007 | 3008 | ||
3008 | 3009 | ||
@@ -3863,7 +3864,7 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) | |||
3863 | struct driver_data *dd = queue->queuedata; | 3864 | struct driver_data *dd = queue->queuedata; |
3864 | struct scatterlist *sg; | 3865 | struct scatterlist *sg; |
3865 | struct bio_vec *bvec; | 3866 | struct bio_vec *bvec; |
3866 | int nents = 0; | 3867 | int i, nents = 0; |
3867 | int tag = 0, unaligned = 0; | 3868 | int tag = 0, unaligned = 0; |
3868 | 3869 | ||
3869 | if (unlikely(dd->dd_flag & MTIP_DDF_STOP_IO)) { | 3870 | if (unlikely(dd->dd_flag & MTIP_DDF_STOP_IO)) { |
@@ -3921,11 +3922,12 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) | |||
3921 | } | 3922 | } |
3922 | 3923 | ||
3923 | /* Create the scatter list for this bio. */ | 3924 | /* Create the scatter list for this bio. */ |
3924 | bio_for_each_segment(bvec, bio, nents) { | 3925 | bio_for_each_segment(bvec, bio, i) { |
3925 | sg_set_page(&sg[nents], | 3926 | sg_set_page(&sg[nents], |
3926 | bvec->bv_page, | 3927 | bvec->bv_page, |
3927 | bvec->bv_len, | 3928 | bvec->bv_len, |
3928 | bvec->bv_offset); | 3929 | bvec->bv_offset); |
3930 | nents++; | ||
3929 | } | 3931 | } |
3930 | 3932 | ||
3931 | /* Issue the read/write. */ | 3933 | /* Issue the read/write. */ |
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 8efdfaa44a59..ce79a590b45b 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -629,7 +629,7 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns, | |||
629 | struct nvme_command *cmnd; | 629 | struct nvme_command *cmnd; |
630 | struct nvme_iod *iod; | 630 | struct nvme_iod *iod; |
631 | enum dma_data_direction dma_dir; | 631 | enum dma_data_direction dma_dir; |
632 | int cmdid, length, result = -ENOMEM; | 632 | int cmdid, length, result; |
633 | u16 control; | 633 | u16 control; |
634 | u32 dsmgmt; | 634 | u32 dsmgmt; |
635 | int psegs = bio_phys_segments(ns->queue, bio); | 635 | int psegs = bio_phys_segments(ns->queue, bio); |
@@ -640,6 +640,7 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns, | |||
640 | return result; | 640 | return result; |
641 | } | 641 | } |
642 | 642 | ||
643 | result = -ENOMEM; | ||
643 | iod = nvme_alloc_iod(psegs, bio->bi_size, GFP_ATOMIC); | 644 | iod = nvme_alloc_iod(psegs, bio->bi_size, GFP_ATOMIC); |
644 | if (!iod) | 645 | if (!iod) |
645 | goto nomem; | 646 | goto nomem; |
@@ -977,6 +978,8 @@ static void nvme_cancel_ios(struct nvme_queue *nvmeq, bool timeout) | |||
977 | 978 | ||
978 | if (timeout && !time_after(now, info[cmdid].timeout)) | 979 | if (timeout && !time_after(now, info[cmdid].timeout)) |
979 | continue; | 980 | continue; |
981 | if (info[cmdid].ctx == CMD_CTX_CANCELLED) | ||
982 | continue; | ||
980 | dev_warn(nvmeq->q_dmadev, "Cancelling I/O %d\n", cmdid); | 983 | dev_warn(nvmeq->q_dmadev, "Cancelling I/O %d\n", cmdid); |
981 | ctx = cancel_cmdid(nvmeq, cmdid, &fn); | 984 | ctx = cancel_cmdid(nvmeq, cmdid, &fn); |
982 | fn(nvmeq->dev, ctx, &cqe); | 985 | fn(nvmeq->dev, ctx, &cqe); |
@@ -1206,7 +1209,7 @@ struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, | |||
1206 | 1209 | ||
1207 | if (addr & 3) | 1210 | if (addr & 3) |
1208 | return ERR_PTR(-EINVAL); | 1211 | return ERR_PTR(-EINVAL); |
1209 | if (!length) | 1212 | if (!length || length > INT_MAX - PAGE_SIZE) |
1210 | return ERR_PTR(-EINVAL); | 1213 | return ERR_PTR(-EINVAL); |
1211 | 1214 | ||
1212 | offset = offset_in_page(addr); | 1215 | offset = offset_in_page(addr); |
@@ -1227,7 +1230,8 @@ struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, | |||
1227 | sg_init_table(sg, count); | 1230 | sg_init_table(sg, count); |
1228 | for (i = 0; i < count; i++) { | 1231 | for (i = 0; i < count; i++) { |
1229 | sg_set_page(&sg[i], pages[i], | 1232 | sg_set_page(&sg[i], pages[i], |
1230 | min_t(int, length, PAGE_SIZE - offset), offset); | 1233 | min_t(unsigned, length, PAGE_SIZE - offset), |
1234 | offset); | ||
1231 | length -= (PAGE_SIZE - offset); | 1235 | length -= (PAGE_SIZE - offset); |
1232 | offset = 0; | 1236 | offset = 0; |
1233 | } | 1237 | } |
@@ -1435,7 +1439,7 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev, | |||
1435 | nvme_free_iod(dev, iod); | 1439 | nvme_free_iod(dev, iod); |
1436 | } | 1440 | } |
1437 | 1441 | ||
1438 | if (!status && copy_to_user(&ucmd->result, &cmd.result, | 1442 | if ((status >= 0) && copy_to_user(&ucmd->result, &cmd.result, |
1439 | sizeof(cmd.result))) | 1443 | sizeof(cmd.result))) |
1440 | status = -EFAULT; | 1444 | status = -EFAULT; |
1441 | 1445 | ||
@@ -1633,7 +1637,8 @@ static int set_queue_count(struct nvme_dev *dev, int count) | |||
1633 | 1637 | ||
1634 | static int nvme_setup_io_queues(struct nvme_dev *dev) | 1638 | static int nvme_setup_io_queues(struct nvme_dev *dev) |
1635 | { | 1639 | { |
1636 | int result, cpu, i, nr_io_queues, db_bar_size, q_depth; | 1640 | struct pci_dev *pdev = dev->pci_dev; |
1641 | int result, cpu, i, nr_io_queues, db_bar_size, q_depth, q_count; | ||
1637 | 1642 | ||
1638 | nr_io_queues = num_online_cpus(); | 1643 | nr_io_queues = num_online_cpus(); |
1639 | result = set_queue_count(dev, nr_io_queues); | 1644 | result = set_queue_count(dev, nr_io_queues); |
@@ -1642,14 +1647,14 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) | |||
1642 | if (result < nr_io_queues) | 1647 | if (result < nr_io_queues) |
1643 | nr_io_queues = result; | 1648 | nr_io_queues = result; |
1644 | 1649 | ||
1650 | q_count = nr_io_queues; | ||
1645 | /* Deregister the admin queue's interrupt */ | 1651 | /* Deregister the admin queue's interrupt */ |
1646 | free_irq(dev->entry[0].vector, dev->queues[0]); | 1652 | free_irq(dev->entry[0].vector, dev->queues[0]); |
1647 | 1653 | ||
1648 | db_bar_size = 4096 + ((nr_io_queues + 1) << (dev->db_stride + 3)); | 1654 | db_bar_size = 4096 + ((nr_io_queues + 1) << (dev->db_stride + 3)); |
1649 | if (db_bar_size > 8192) { | 1655 | if (db_bar_size > 8192) { |
1650 | iounmap(dev->bar); | 1656 | iounmap(dev->bar); |
1651 | dev->bar = ioremap(pci_resource_start(dev->pci_dev, 0), | 1657 | dev->bar = ioremap(pci_resource_start(pdev, 0), db_bar_size); |
1652 | db_bar_size); | ||
1653 | dev->dbs = ((void __iomem *)dev->bar) + 4096; | 1658 | dev->dbs = ((void __iomem *)dev->bar) + 4096; |
1654 | dev->queues[0]->q_db = dev->dbs; | 1659 | dev->queues[0]->q_db = dev->dbs; |
1655 | } | 1660 | } |
@@ -1657,19 +1662,36 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) | |||
1657 | for (i = 0; i < nr_io_queues; i++) | 1662 | for (i = 0; i < nr_io_queues; i++) |
1658 | dev->entry[i].entry = i; | 1663 | dev->entry[i].entry = i; |
1659 | for (;;) { | 1664 | for (;;) { |
1660 | result = pci_enable_msix(dev->pci_dev, dev->entry, | 1665 | result = pci_enable_msix(pdev, dev->entry, nr_io_queues); |
1661 | nr_io_queues); | ||
1662 | if (result == 0) { | 1666 | if (result == 0) { |
1663 | break; | 1667 | break; |
1664 | } else if (result > 0) { | 1668 | } else if (result > 0) { |
1665 | nr_io_queues = result; | 1669 | nr_io_queues = result; |
1666 | continue; | 1670 | continue; |
1667 | } else { | 1671 | } else { |
1668 | nr_io_queues = 1; | 1672 | nr_io_queues = 0; |
1669 | break; | 1673 | break; |
1670 | } | 1674 | } |
1671 | } | 1675 | } |
1672 | 1676 | ||
1677 | if (nr_io_queues == 0) { | ||
1678 | nr_io_queues = q_count; | ||
1679 | for (;;) { | ||
1680 | result = pci_enable_msi_block(pdev, nr_io_queues); | ||
1681 | if (result == 0) { | ||
1682 | for (i = 0; i < nr_io_queues; i++) | ||
1683 | dev->entry[i].vector = i + pdev->irq; | ||
1684 | break; | ||
1685 | } else if (result > 0) { | ||
1686 | nr_io_queues = result; | ||
1687 | continue; | ||
1688 | } else { | ||
1689 | nr_io_queues = 1; | ||
1690 | break; | ||
1691 | } | ||
1692 | } | ||
1693 | } | ||
1694 | |||
1673 | result = queue_request_irq(dev, dev->queues[0], "nvme admin"); | 1695 | result = queue_request_irq(dev, dev->queues[0], "nvme admin"); |
1674 | /* XXX: handle failure here */ | 1696 | /* XXX: handle failure here */ |
1675 | 1697 | ||
@@ -1850,7 +1872,10 @@ static void nvme_free_dev(struct kref *kref) | |||
1850 | { | 1872 | { |
1851 | struct nvme_dev *dev = container_of(kref, struct nvme_dev, kref); | 1873 | struct nvme_dev *dev = container_of(kref, struct nvme_dev, kref); |
1852 | nvme_dev_remove(dev); | 1874 | nvme_dev_remove(dev); |
1853 | pci_disable_msix(dev->pci_dev); | 1875 | if (dev->pci_dev->msi_enabled) |
1876 | pci_disable_msi(dev->pci_dev); | ||
1877 | else if (dev->pci_dev->msix_enabled) | ||
1878 | pci_disable_msix(dev->pci_dev); | ||
1854 | iounmap(dev->bar); | 1879 | iounmap(dev->bar); |
1855 | nvme_release_instance(dev); | 1880 | nvme_release_instance(dev); |
1856 | nvme_release_prp_pools(dev); | 1881 | nvme_release_prp_pools(dev); |
@@ -1923,8 +1948,14 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1923 | INIT_LIST_HEAD(&dev->namespaces); | 1948 | INIT_LIST_HEAD(&dev->namespaces); |
1924 | dev->pci_dev = pdev; | 1949 | dev->pci_dev = pdev; |
1925 | pci_set_drvdata(pdev, dev); | 1950 | pci_set_drvdata(pdev, dev); |
1926 | dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); | 1951 | |
1927 | dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); | 1952 | if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) |
1953 | dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); | ||
1954 | else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) | ||
1955 | dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | ||
1956 | else | ||
1957 | goto disable; | ||
1958 | |||
1928 | result = nvme_set_instance(dev); | 1959 | result = nvme_set_instance(dev); |
1929 | if (result) | 1960 | if (result) |
1930 | goto disable; | 1961 | goto disable; |
@@ -1977,7 +2008,10 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1977 | unmap: | 2008 | unmap: |
1978 | iounmap(dev->bar); | 2009 | iounmap(dev->bar); |
1979 | disable_msix: | 2010 | disable_msix: |
1980 | pci_disable_msix(pdev); | 2011 | if (dev->pci_dev->msi_enabled) |
2012 | pci_disable_msi(dev->pci_dev); | ||
2013 | else if (dev->pci_dev->msix_enabled) | ||
2014 | pci_disable_msix(dev->pci_dev); | ||
1981 | nvme_release_instance(dev); | 2015 | nvme_release_instance(dev); |
1982 | nvme_release_prp_pools(dev); | 2016 | nvme_release_prp_pools(dev); |
1983 | disable: | 2017 | disable: |
diff --git a/drivers/block/nvme-scsi.c b/drivers/block/nvme-scsi.c index fed54b039893..102de2f52b5c 100644 --- a/drivers/block/nvme-scsi.c +++ b/drivers/block/nvme-scsi.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/sched.h> | 44 | #include <linux/sched.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/types.h> | 46 | #include <linux/types.h> |
47 | #include <linux/version.h> | ||
48 | #include <scsi/sg.h> | 47 | #include <scsi/sg.h> |
49 | #include <scsi/scsi.h> | 48 | #include <scsi/scsi.h> |
50 | 49 | ||
@@ -1654,7 +1653,7 @@ static void nvme_trans_modesel_save_bd(struct nvme_ns *ns, u8 *parm_list, | |||
1654 | } | 1653 | } |
1655 | } | 1654 | } |
1656 | 1655 | ||
1657 | static u16 nvme_trans_modesel_get_mp(struct nvme_ns *ns, struct sg_io_hdr *hdr, | 1656 | static int nvme_trans_modesel_get_mp(struct nvme_ns *ns, struct sg_io_hdr *hdr, |
1658 | u8 *mode_page, u8 page_code) | 1657 | u8 *mode_page, u8 page_code) |
1659 | { | 1658 | { |
1660 | int res = SNTI_TRANSLATION_SUCCESS; | 1659 | int res = SNTI_TRANSLATION_SUCCESS; |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 3c08983e600a..f5d0ea11d9fd 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -83,7 +83,8 @@ | |||
83 | 83 | ||
84 | #define MAX_SPEED 0xffff | 84 | #define MAX_SPEED 0xffff |
85 | 85 | ||
86 | #define ZONE(sector, pd) (((sector) + (pd)->offset) & ~((pd)->settings.size - 1)) | 86 | #define ZONE(sector, pd) (((sector) + (pd)->offset) & \ |
87 | ~(sector_t)((pd)->settings.size - 1)) | ||
87 | 88 | ||
88 | static DEFINE_MUTEX(pktcdvd_mutex); | 89 | static DEFINE_MUTEX(pktcdvd_mutex); |
89 | static struct pktcdvd_device *pkt_devs[MAX_WRITERS]; | 90 | static struct pktcdvd_device *pkt_devs[MAX_WRITERS]; |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index ca63104136e0..49394e3f31bc 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -55,6 +55,39 @@ | |||
55 | #define SECTOR_SHIFT 9 | 55 | #define SECTOR_SHIFT 9 |
56 | #define SECTOR_SIZE (1ULL << SECTOR_SHIFT) | 56 | #define SECTOR_SIZE (1ULL << SECTOR_SHIFT) |
57 | 57 | ||
58 | /* | ||
59 | * Increment the given counter and return its updated value. | ||
60 | * If the counter is already 0 it will not be incremented. | ||
61 | * If the counter is already at its maximum value returns | ||
62 | * -EINVAL without updating it. | ||
63 | */ | ||
64 | static int atomic_inc_return_safe(atomic_t *v) | ||
65 | { | ||
66 | unsigned int counter; | ||
67 | |||
68 | counter = (unsigned int)__atomic_add_unless(v, 1, 0); | ||
69 | if (counter <= (unsigned int)INT_MAX) | ||
70 | return (int)counter; | ||
71 | |||
72 | atomic_dec(v); | ||
73 | |||
74 | return -EINVAL; | ||
75 | } | ||
76 | |||
77 | /* Decrement the counter. Return the resulting value, or -EINVAL */ | ||
78 | static int atomic_dec_return_safe(atomic_t *v) | ||
79 | { | ||
80 | int counter; | ||
81 | |||
82 | counter = atomic_dec_return(v); | ||
83 | if (counter >= 0) | ||
84 | return counter; | ||
85 | |||
86 | atomic_inc(v); | ||
87 | |||
88 | return -EINVAL; | ||
89 | } | ||
90 | |||
58 | #define RBD_DRV_NAME "rbd" | 91 | #define RBD_DRV_NAME "rbd" |
59 | #define RBD_DRV_NAME_LONG "rbd (rados block device)" | 92 | #define RBD_DRV_NAME_LONG "rbd (rados block device)" |
60 | 93 | ||
@@ -100,21 +133,20 @@ | |||
100 | * block device image metadata (in-memory version) | 133 | * block device image metadata (in-memory version) |
101 | */ | 134 | */ |
102 | struct rbd_image_header { | 135 | struct rbd_image_header { |
103 | /* These four fields never change for a given rbd image */ | 136 | /* These six fields never change for a given rbd image */ |
104 | char *object_prefix; | 137 | char *object_prefix; |
105 | u64 features; | ||
106 | __u8 obj_order; | 138 | __u8 obj_order; |
107 | __u8 crypt_type; | 139 | __u8 crypt_type; |
108 | __u8 comp_type; | 140 | __u8 comp_type; |
141 | u64 stripe_unit; | ||
142 | u64 stripe_count; | ||
143 | u64 features; /* Might be changeable someday? */ | ||
109 | 144 | ||
110 | /* The remaining fields need to be updated occasionally */ | 145 | /* The remaining fields need to be updated occasionally */ |
111 | u64 image_size; | 146 | u64 image_size; |
112 | struct ceph_snap_context *snapc; | 147 | struct ceph_snap_context *snapc; |
113 | char *snap_names; | 148 | char *snap_names; /* format 1 only */ |
114 | u64 *snap_sizes; | 149 | u64 *snap_sizes; /* format 1 only */ |
115 | |||
116 | u64 stripe_unit; | ||
117 | u64 stripe_count; | ||
118 | }; | 150 | }; |
119 | 151 | ||
120 | /* | 152 | /* |
@@ -225,6 +257,7 @@ struct rbd_obj_request { | |||
225 | }; | 257 | }; |
226 | }; | 258 | }; |
227 | struct page **copyup_pages; | 259 | struct page **copyup_pages; |
260 | u32 copyup_page_count; | ||
228 | 261 | ||
229 | struct ceph_osd_request *osd_req; | 262 | struct ceph_osd_request *osd_req; |
230 | 263 | ||
@@ -257,6 +290,7 @@ struct rbd_img_request { | |||
257 | struct rbd_obj_request *obj_request; /* obj req initiator */ | 290 | struct rbd_obj_request *obj_request; /* obj req initiator */ |
258 | }; | 291 | }; |
259 | struct page **copyup_pages; | 292 | struct page **copyup_pages; |
293 | u32 copyup_page_count; | ||
260 | spinlock_t completion_lock;/* protects next_completion */ | 294 | spinlock_t completion_lock;/* protects next_completion */ |
261 | u32 next_completion; | 295 | u32 next_completion; |
262 | rbd_img_callback_t callback; | 296 | rbd_img_callback_t callback; |
@@ -311,6 +345,7 @@ struct rbd_device { | |||
311 | 345 | ||
312 | struct rbd_spec *parent_spec; | 346 | struct rbd_spec *parent_spec; |
313 | u64 parent_overlap; | 347 | u64 parent_overlap; |
348 | atomic_t parent_ref; | ||
314 | struct rbd_device *parent; | 349 | struct rbd_device *parent; |
315 | 350 | ||
316 | /* protects updating the header */ | 351 | /* protects updating the header */ |
@@ -359,7 +394,8 @@ static ssize_t rbd_add(struct bus_type *bus, const char *buf, | |||
359 | size_t count); | 394 | size_t count); |
360 | static ssize_t rbd_remove(struct bus_type *bus, const char *buf, | 395 | static ssize_t rbd_remove(struct bus_type *bus, const char *buf, |
361 | size_t count); | 396 | size_t count); |
362 | static int rbd_dev_image_probe(struct rbd_device *rbd_dev); | 397 | static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping); |
398 | static void rbd_spec_put(struct rbd_spec *spec); | ||
363 | 399 | ||
364 | static struct bus_attribute rbd_bus_attrs[] = { | 400 | static struct bus_attribute rbd_bus_attrs[] = { |
365 | __ATTR(add, S_IWUSR, NULL, rbd_add), | 401 | __ATTR(add, S_IWUSR, NULL, rbd_add), |
@@ -426,7 +462,8 @@ static void rbd_img_parent_read(struct rbd_obj_request *obj_request); | |||
426 | static void rbd_dev_remove_parent(struct rbd_device *rbd_dev); | 462 | static void rbd_dev_remove_parent(struct rbd_device *rbd_dev); |
427 | 463 | ||
428 | static int rbd_dev_refresh(struct rbd_device *rbd_dev); | 464 | static int rbd_dev_refresh(struct rbd_device *rbd_dev); |
429 | static int rbd_dev_v2_refresh(struct rbd_device *rbd_dev); | 465 | static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev); |
466 | static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev); | ||
430 | static const char *rbd_dev_v2_snap_name(struct rbd_device *rbd_dev, | 467 | static const char *rbd_dev_v2_snap_name(struct rbd_device *rbd_dev, |
431 | u64 snap_id); | 468 | u64 snap_id); |
432 | static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id, | 469 | static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id, |
@@ -482,8 +519,8 @@ static const struct block_device_operations rbd_bd_ops = { | |||
482 | }; | 519 | }; |
483 | 520 | ||
484 | /* | 521 | /* |
485 | * Initialize an rbd client instance. | 522 | * Initialize an rbd client instance. Success or not, this function |
486 | * We own *ceph_opts. | 523 | * consumes ceph_opts. |
487 | */ | 524 | */ |
488 | static struct rbd_client *rbd_client_create(struct ceph_options *ceph_opts) | 525 | static struct rbd_client *rbd_client_create(struct ceph_options *ceph_opts) |
489 | { | 526 | { |
@@ -638,7 +675,8 @@ static int parse_rbd_opts_token(char *c, void *private) | |||
638 | 675 | ||
639 | /* | 676 | /* |
640 | * Get a ceph client with specific addr and configuration, if one does | 677 | * Get a ceph client with specific addr and configuration, if one does |
641 | * not exist create it. | 678 | * not exist create it. Either way, ceph_opts is consumed by this |
679 | * function. | ||
642 | */ | 680 | */ |
643 | static struct rbd_client *rbd_get_client(struct ceph_options *ceph_opts) | 681 | static struct rbd_client *rbd_get_client(struct ceph_options *ceph_opts) |
644 | { | 682 | { |
@@ -726,88 +764,123 @@ static bool rbd_dev_ondisk_valid(struct rbd_image_header_ondisk *ondisk) | |||
726 | } | 764 | } |
727 | 765 | ||
728 | /* | 766 | /* |
729 | * Create a new header structure, translate header format from the on-disk | 767 | * Fill an rbd image header with information from the given format 1 |
730 | * header. | 768 | * on-disk header. |
731 | */ | 769 | */ |
732 | static int rbd_header_from_disk(struct rbd_image_header *header, | 770 | static int rbd_header_from_disk(struct rbd_device *rbd_dev, |
733 | struct rbd_image_header_ondisk *ondisk) | 771 | struct rbd_image_header_ondisk *ondisk) |
734 | { | 772 | { |
773 | struct rbd_image_header *header = &rbd_dev->header; | ||
774 | bool first_time = header->object_prefix == NULL; | ||
775 | struct ceph_snap_context *snapc; | ||
776 | char *object_prefix = NULL; | ||
777 | char *snap_names = NULL; | ||
778 | u64 *snap_sizes = NULL; | ||
735 | u32 snap_count; | 779 | u32 snap_count; |
736 | size_t len; | ||
737 | size_t size; | 780 | size_t size; |
781 | int ret = -ENOMEM; | ||
738 | u32 i; | 782 | u32 i; |
739 | 783 | ||
740 | memset(header, 0, sizeof (*header)); | 784 | /* Allocate this now to avoid having to handle failure below */ |
741 | 785 | ||
742 | snap_count = le32_to_cpu(ondisk->snap_count); | 786 | if (first_time) { |
787 | size_t len; | ||
743 | 788 | ||
744 | len = strnlen(ondisk->object_prefix, sizeof (ondisk->object_prefix)); | 789 | len = strnlen(ondisk->object_prefix, |
745 | header->object_prefix = kmalloc(len + 1, GFP_KERNEL); | 790 | sizeof (ondisk->object_prefix)); |
746 | if (!header->object_prefix) | 791 | object_prefix = kmalloc(len + 1, GFP_KERNEL); |
747 | return -ENOMEM; | 792 | if (!object_prefix) |
748 | memcpy(header->object_prefix, ondisk->object_prefix, len); | 793 | return -ENOMEM; |
749 | header->object_prefix[len] = '\0'; | 794 | memcpy(object_prefix, ondisk->object_prefix, len); |
795 | object_prefix[len] = '\0'; | ||
796 | } | ||
797 | |||
798 | /* Allocate the snapshot context and fill it in */ | ||
750 | 799 | ||
800 | snap_count = le32_to_cpu(ondisk->snap_count); | ||
801 | snapc = ceph_create_snap_context(snap_count, GFP_KERNEL); | ||
802 | if (!snapc) | ||
803 | goto out_err; | ||
804 | snapc->seq = le64_to_cpu(ondisk->snap_seq); | ||
751 | if (snap_count) { | 805 | if (snap_count) { |
806 | struct rbd_image_snap_ondisk *snaps; | ||
752 | u64 snap_names_len = le64_to_cpu(ondisk->snap_names_len); | 807 | u64 snap_names_len = le64_to_cpu(ondisk->snap_names_len); |
753 | 808 | ||
754 | /* Save a copy of the snapshot names */ | 809 | /* We'll keep a copy of the snapshot names... */ |
755 | 810 | ||
756 | if (snap_names_len > (u64) SIZE_MAX) | 811 | if (snap_names_len > (u64)SIZE_MAX) |
757 | return -EIO; | 812 | goto out_2big; |
758 | header->snap_names = kmalloc(snap_names_len, GFP_KERNEL); | 813 | snap_names = kmalloc(snap_names_len, GFP_KERNEL); |
759 | if (!header->snap_names) | 814 | if (!snap_names) |
815 | goto out_err; | ||
816 | |||
817 | /* ...as well as the array of their sizes. */ | ||
818 | |||
819 | size = snap_count * sizeof (*header->snap_sizes); | ||
820 | snap_sizes = kmalloc(size, GFP_KERNEL); | ||
821 | if (!snap_sizes) | ||
760 | goto out_err; | 822 | goto out_err; |
823 | |||
761 | /* | 824 | /* |
762 | * Note that rbd_dev_v1_header_read() guarantees | 825 | * Copy the names, and fill in each snapshot's id |
763 | * the ondisk buffer we're working with has | 826 | * and size. |
827 | * | ||
828 | * Note that rbd_dev_v1_header_info() guarantees the | ||
829 | * ondisk buffer we're working with has | ||
764 | * snap_names_len bytes beyond the end of the | 830 | * snap_names_len bytes beyond the end of the |
765 | * snapshot id array, this memcpy() is safe. | 831 | * snapshot id array, this memcpy() is safe. |
766 | */ | 832 | */ |
767 | memcpy(header->snap_names, &ondisk->snaps[snap_count], | 833 | memcpy(snap_names, &ondisk->snaps[snap_count], snap_names_len); |
768 | snap_names_len); | 834 | snaps = ondisk->snaps; |
835 | for (i = 0; i < snap_count; i++) { | ||
836 | snapc->snaps[i] = le64_to_cpu(snaps[i].id); | ||
837 | snap_sizes[i] = le64_to_cpu(snaps[i].image_size); | ||
838 | } | ||
839 | } | ||
769 | 840 | ||
770 | /* Record each snapshot's size */ | 841 | /* We won't fail any more, fill in the header */ |
771 | 842 | ||
772 | size = snap_count * sizeof (*header->snap_sizes); | 843 | down_write(&rbd_dev->header_rwsem); |
773 | header->snap_sizes = kmalloc(size, GFP_KERNEL); | 844 | if (first_time) { |
774 | if (!header->snap_sizes) | 845 | header->object_prefix = object_prefix; |
775 | goto out_err; | 846 | header->obj_order = ondisk->options.order; |
776 | for (i = 0; i < snap_count; i++) | 847 | header->crypt_type = ondisk->options.crypt_type; |
777 | header->snap_sizes[i] = | 848 | header->comp_type = ondisk->options.comp_type; |
778 | le64_to_cpu(ondisk->snaps[i].image_size); | 849 | /* The rest aren't used for format 1 images */ |
850 | header->stripe_unit = 0; | ||
851 | header->stripe_count = 0; | ||
852 | header->features = 0; | ||
779 | } else { | 853 | } else { |
780 | header->snap_names = NULL; | 854 | ceph_put_snap_context(header->snapc); |
781 | header->snap_sizes = NULL; | 855 | kfree(header->snap_names); |
856 | kfree(header->snap_sizes); | ||
782 | } | 857 | } |
783 | 858 | ||
784 | header->features = 0; /* No features support in v1 images */ | 859 | /* The remaining fields always get updated (when we refresh) */ |
785 | header->obj_order = ondisk->options.order; | ||
786 | header->crypt_type = ondisk->options.crypt_type; | ||
787 | header->comp_type = ondisk->options.comp_type; | ||
788 | |||
789 | /* Allocate and fill in the snapshot context */ | ||
790 | 860 | ||
791 | header->image_size = le64_to_cpu(ondisk->image_size); | 861 | header->image_size = le64_to_cpu(ondisk->image_size); |
862 | header->snapc = snapc; | ||
863 | header->snap_names = snap_names; | ||
864 | header->snap_sizes = snap_sizes; | ||
792 | 865 | ||
793 | header->snapc = ceph_create_snap_context(snap_count, GFP_KERNEL); | 866 | /* Make sure mapping size is consistent with header info */ |
794 | if (!header->snapc) | ||
795 | goto out_err; | ||
796 | header->snapc->seq = le64_to_cpu(ondisk->snap_seq); | ||
797 | for (i = 0; i < snap_count; i++) | ||
798 | header->snapc->snaps[i] = le64_to_cpu(ondisk->snaps[i].id); | ||
799 | 867 | ||
800 | return 0; | 868 | if (rbd_dev->spec->snap_id == CEPH_NOSNAP || first_time) |
869 | if (rbd_dev->mapping.size != header->image_size) | ||
870 | rbd_dev->mapping.size = header->image_size; | ||
801 | 871 | ||
872 | up_write(&rbd_dev->header_rwsem); | ||
873 | |||
874 | return 0; | ||
875 | out_2big: | ||
876 | ret = -EIO; | ||
802 | out_err: | 877 | out_err: |
803 | kfree(header->snap_sizes); | 878 | kfree(snap_sizes); |
804 | header->snap_sizes = NULL; | 879 | kfree(snap_names); |
805 | kfree(header->snap_names); | 880 | ceph_put_snap_context(snapc); |
806 | header->snap_names = NULL; | 881 | kfree(object_prefix); |
807 | kfree(header->object_prefix); | ||
808 | header->object_prefix = NULL; | ||
809 | 882 | ||
810 | return -ENOMEM; | 883 | return ret; |
811 | } | 884 | } |
812 | 885 | ||
813 | static const char *_rbd_dev_v1_snap_name(struct rbd_device *rbd_dev, u32 which) | 886 | static const char *_rbd_dev_v1_snap_name(struct rbd_device *rbd_dev, u32 which) |
@@ -934,20 +1007,11 @@ static int rbd_snap_features(struct rbd_device *rbd_dev, u64 snap_id, | |||
934 | 1007 | ||
935 | static int rbd_dev_mapping_set(struct rbd_device *rbd_dev) | 1008 | static int rbd_dev_mapping_set(struct rbd_device *rbd_dev) |
936 | { | 1009 | { |
937 | const char *snap_name = rbd_dev->spec->snap_name; | 1010 | u64 snap_id = rbd_dev->spec->snap_id; |
938 | u64 snap_id; | ||
939 | u64 size = 0; | 1011 | u64 size = 0; |
940 | u64 features = 0; | 1012 | u64 features = 0; |
941 | int ret; | 1013 | int ret; |
942 | 1014 | ||
943 | if (strcmp(snap_name, RBD_SNAP_HEAD_NAME)) { | ||
944 | snap_id = rbd_snap_id_by_name(rbd_dev, snap_name); | ||
945 | if (snap_id == CEPH_NOSNAP) | ||
946 | return -ENOENT; | ||
947 | } else { | ||
948 | snap_id = CEPH_NOSNAP; | ||
949 | } | ||
950 | |||
951 | ret = rbd_snap_size(rbd_dev, snap_id, &size); | 1015 | ret = rbd_snap_size(rbd_dev, snap_id, &size); |
952 | if (ret) | 1016 | if (ret) |
953 | return ret; | 1017 | return ret; |
@@ -958,11 +1022,6 @@ static int rbd_dev_mapping_set(struct rbd_device *rbd_dev) | |||
958 | rbd_dev->mapping.size = size; | 1022 | rbd_dev->mapping.size = size; |
959 | rbd_dev->mapping.features = features; | 1023 | rbd_dev->mapping.features = features; |
960 | 1024 | ||
961 | /* If we are mapping a snapshot it must be marked read-only */ | ||
962 | |||
963 | if (snap_id != CEPH_NOSNAP) | ||
964 | rbd_dev->mapping.read_only = true; | ||
965 | |||
966 | return 0; | 1025 | return 0; |
967 | } | 1026 | } |
968 | 1027 | ||
@@ -970,14 +1029,6 @@ static void rbd_dev_mapping_clear(struct rbd_device *rbd_dev) | |||
970 | { | 1029 | { |
971 | rbd_dev->mapping.size = 0; | 1030 | rbd_dev->mapping.size = 0; |
972 | rbd_dev->mapping.features = 0; | 1031 | rbd_dev->mapping.features = 0; |
973 | rbd_dev->mapping.read_only = true; | ||
974 | } | ||
975 | |||
976 | static void rbd_dev_clear_mapping(struct rbd_device *rbd_dev) | ||
977 | { | ||
978 | rbd_dev->mapping.size = 0; | ||
979 | rbd_dev->mapping.features = 0; | ||
980 | rbd_dev->mapping.read_only = true; | ||
981 | } | 1032 | } |
982 | 1033 | ||
983 | static const char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset) | 1034 | static const char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset) |
@@ -985,12 +1036,16 @@ static const char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset) | |||
985 | char *name; | 1036 | char *name; |
986 | u64 segment; | 1037 | u64 segment; |
987 | int ret; | 1038 | int ret; |
1039 | char *name_format; | ||
988 | 1040 | ||
989 | name = kmem_cache_alloc(rbd_segment_name_cache, GFP_NOIO); | 1041 | name = kmem_cache_alloc(rbd_segment_name_cache, GFP_NOIO); |
990 | if (!name) | 1042 | if (!name) |
991 | return NULL; | 1043 | return NULL; |
992 | segment = offset >> rbd_dev->header.obj_order; | 1044 | segment = offset >> rbd_dev->header.obj_order; |
993 | ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, "%s.%012llx", | 1045 | name_format = "%s.%012llx"; |
1046 | if (rbd_dev->image_format == 2) | ||
1047 | name_format = "%s.%016llx"; | ||
1048 | ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, name_format, | ||
994 | rbd_dev->header.object_prefix, segment); | 1049 | rbd_dev->header.object_prefix, segment); |
995 | if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) { | 1050 | if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) { |
996 | pr_err("error formatting segment name for #%llu (%d)\n", | 1051 | pr_err("error formatting segment name for #%llu (%d)\n", |
@@ -1342,20 +1397,18 @@ static void rbd_obj_request_put(struct rbd_obj_request *obj_request) | |||
1342 | kref_put(&obj_request->kref, rbd_obj_request_destroy); | 1397 | kref_put(&obj_request->kref, rbd_obj_request_destroy); |
1343 | } | 1398 | } |
1344 | 1399 | ||
1345 | static void rbd_img_request_get(struct rbd_img_request *img_request) | 1400 | static bool img_request_child_test(struct rbd_img_request *img_request); |
1346 | { | 1401 | static void rbd_parent_request_destroy(struct kref *kref); |
1347 | dout("%s: img %p (was %d)\n", __func__, img_request, | ||
1348 | atomic_read(&img_request->kref.refcount)); | ||
1349 | kref_get(&img_request->kref); | ||
1350 | } | ||
1351 | |||
1352 | static void rbd_img_request_destroy(struct kref *kref); | 1402 | static void rbd_img_request_destroy(struct kref *kref); |
1353 | static void rbd_img_request_put(struct rbd_img_request *img_request) | 1403 | static void rbd_img_request_put(struct rbd_img_request *img_request) |
1354 | { | 1404 | { |
1355 | rbd_assert(img_request != NULL); | 1405 | rbd_assert(img_request != NULL); |
1356 | dout("%s: img %p (was %d)\n", __func__, img_request, | 1406 | dout("%s: img %p (was %d)\n", __func__, img_request, |
1357 | atomic_read(&img_request->kref.refcount)); | 1407 | atomic_read(&img_request->kref.refcount)); |
1358 | kref_put(&img_request->kref, rbd_img_request_destroy); | 1408 | if (img_request_child_test(img_request)) |
1409 | kref_put(&img_request->kref, rbd_parent_request_destroy); | ||
1410 | else | ||
1411 | kref_put(&img_request->kref, rbd_img_request_destroy); | ||
1359 | } | 1412 | } |
1360 | 1413 | ||
1361 | static inline void rbd_img_obj_request_add(struct rbd_img_request *img_request, | 1414 | static inline void rbd_img_obj_request_add(struct rbd_img_request *img_request, |
@@ -1472,6 +1525,12 @@ static void img_request_child_set(struct rbd_img_request *img_request) | |||
1472 | smp_mb(); | 1525 | smp_mb(); |
1473 | } | 1526 | } |
1474 | 1527 | ||
1528 | static void img_request_child_clear(struct rbd_img_request *img_request) | ||
1529 | { | ||
1530 | clear_bit(IMG_REQ_CHILD, &img_request->flags); | ||
1531 | smp_mb(); | ||
1532 | } | ||
1533 | |||
1475 | static bool img_request_child_test(struct rbd_img_request *img_request) | 1534 | static bool img_request_child_test(struct rbd_img_request *img_request) |
1476 | { | 1535 | { |
1477 | smp_mb(); | 1536 | smp_mb(); |
@@ -1484,6 +1543,12 @@ static void img_request_layered_set(struct rbd_img_request *img_request) | |||
1484 | smp_mb(); | 1543 | smp_mb(); |
1485 | } | 1544 | } |
1486 | 1545 | ||
1546 | static void img_request_layered_clear(struct rbd_img_request *img_request) | ||
1547 | { | ||
1548 | clear_bit(IMG_REQ_LAYERED, &img_request->flags); | ||
1549 | smp_mb(); | ||
1550 | } | ||
1551 | |||
1487 | static bool img_request_layered_test(struct rbd_img_request *img_request) | 1552 | static bool img_request_layered_test(struct rbd_img_request *img_request) |
1488 | { | 1553 | { |
1489 | smp_mb(); | 1554 | smp_mb(); |
@@ -1827,6 +1892,74 @@ static void rbd_obj_request_destroy(struct kref *kref) | |||
1827 | kmem_cache_free(rbd_obj_request_cache, obj_request); | 1892 | kmem_cache_free(rbd_obj_request_cache, obj_request); |
1828 | } | 1893 | } |
1829 | 1894 | ||
1895 | /* It's OK to call this for a device with no parent */ | ||
1896 | |||
1897 | static void rbd_spec_put(struct rbd_spec *spec); | ||
1898 | static void rbd_dev_unparent(struct rbd_device *rbd_dev) | ||
1899 | { | ||
1900 | rbd_dev_remove_parent(rbd_dev); | ||
1901 | rbd_spec_put(rbd_dev->parent_spec); | ||
1902 | rbd_dev->parent_spec = NULL; | ||
1903 | rbd_dev->parent_overlap = 0; | ||
1904 | } | ||
1905 | |||
1906 | /* | ||
1907 | * Parent image reference counting is used to determine when an | ||
1908 | * image's parent fields can be safely torn down--after there are no | ||
1909 | * more in-flight requests to the parent image. When the last | ||
1910 | * reference is dropped, cleaning them up is safe. | ||
1911 | */ | ||
1912 | static void rbd_dev_parent_put(struct rbd_device *rbd_dev) | ||
1913 | { | ||
1914 | int counter; | ||
1915 | |||
1916 | if (!rbd_dev->parent_spec) | ||
1917 | return; | ||
1918 | |||
1919 | counter = atomic_dec_return_safe(&rbd_dev->parent_ref); | ||
1920 | if (counter > 0) | ||
1921 | return; | ||
1922 | |||
1923 | /* Last reference; clean up parent data structures */ | ||
1924 | |||
1925 | if (!counter) | ||
1926 | rbd_dev_unparent(rbd_dev); | ||
1927 | else | ||
1928 | rbd_warn(rbd_dev, "parent reference underflow\n"); | ||
1929 | } | ||
1930 | |||
1931 | /* | ||
1932 | * If an image has a non-zero parent overlap, get a reference to its | ||
1933 | * parent. | ||
1934 | * | ||
1935 | * We must get the reference before checking for the overlap to | ||
1936 | * coordinate properly with zeroing the parent overlap in | ||
1937 | * rbd_dev_v2_parent_info() when an image gets flattened. We | ||
1938 | * drop it again if there is no overlap. | ||
1939 | * | ||
1940 | * Returns true if the rbd device has a parent with a non-zero | ||
1941 | * overlap and a reference for it was successfully taken, or | ||
1942 | * false otherwise. | ||
1943 | */ | ||
1944 | static bool rbd_dev_parent_get(struct rbd_device *rbd_dev) | ||
1945 | { | ||
1946 | int counter; | ||
1947 | |||
1948 | if (!rbd_dev->parent_spec) | ||
1949 | return false; | ||
1950 | |||
1951 | counter = atomic_inc_return_safe(&rbd_dev->parent_ref); | ||
1952 | if (counter > 0 && rbd_dev->parent_overlap) | ||
1953 | return true; | ||
1954 | |||
1955 | /* Image was flattened, but parent is not yet torn down */ | ||
1956 | |||
1957 | if (counter < 0) | ||
1958 | rbd_warn(rbd_dev, "parent reference overflow\n"); | ||
1959 | |||
1960 | return false; | ||
1961 | } | ||
1962 | |||
1830 | /* | 1963 | /* |
1831 | * Caller is responsible for filling in the list of object requests | 1964 | * Caller is responsible for filling in the list of object requests |
1832 | * that comprises the image request, and the Linux request pointer | 1965 | * that comprises the image request, and the Linux request pointer |
@@ -1835,8 +1968,7 @@ static void rbd_obj_request_destroy(struct kref *kref) | |||
1835 | static struct rbd_img_request *rbd_img_request_create( | 1968 | static struct rbd_img_request *rbd_img_request_create( |
1836 | struct rbd_device *rbd_dev, | 1969 | struct rbd_device *rbd_dev, |
1837 | u64 offset, u64 length, | 1970 | u64 offset, u64 length, |
1838 | bool write_request, | 1971 | bool write_request) |
1839 | bool child_request) | ||
1840 | { | 1972 | { |
1841 | struct rbd_img_request *img_request; | 1973 | struct rbd_img_request *img_request; |
1842 | 1974 | ||
@@ -1861,9 +1993,7 @@ static struct rbd_img_request *rbd_img_request_create( | |||
1861 | } else { | 1993 | } else { |
1862 | img_request->snap_id = rbd_dev->spec->snap_id; | 1994 | img_request->snap_id = rbd_dev->spec->snap_id; |
1863 | } | 1995 | } |
1864 | if (child_request) | 1996 | if (rbd_dev_parent_get(rbd_dev)) |
1865 | img_request_child_set(img_request); | ||
1866 | if (rbd_dev->parent_spec) | ||
1867 | img_request_layered_set(img_request); | 1997 | img_request_layered_set(img_request); |
1868 | spin_lock_init(&img_request->completion_lock); | 1998 | spin_lock_init(&img_request->completion_lock); |
1869 | img_request->next_completion = 0; | 1999 | img_request->next_completion = 0; |
@@ -1873,9 +2003,6 @@ static struct rbd_img_request *rbd_img_request_create( | |||
1873 | INIT_LIST_HEAD(&img_request->obj_requests); | 2003 | INIT_LIST_HEAD(&img_request->obj_requests); |
1874 | kref_init(&img_request->kref); | 2004 | kref_init(&img_request->kref); |
1875 | 2005 | ||
1876 | rbd_img_request_get(img_request); /* Avoid a warning */ | ||
1877 | rbd_img_request_put(img_request); /* TEMPORARY */ | ||
1878 | |||
1879 | dout("%s: rbd_dev %p %s %llu/%llu -> img %p\n", __func__, rbd_dev, | 2006 | dout("%s: rbd_dev %p %s %llu/%llu -> img %p\n", __func__, rbd_dev, |
1880 | write_request ? "write" : "read", offset, length, | 2007 | write_request ? "write" : "read", offset, length, |
1881 | img_request); | 2008 | img_request); |
@@ -1897,15 +2024,54 @@ static void rbd_img_request_destroy(struct kref *kref) | |||
1897 | rbd_img_obj_request_del(img_request, obj_request); | 2024 | rbd_img_obj_request_del(img_request, obj_request); |
1898 | rbd_assert(img_request->obj_request_count == 0); | 2025 | rbd_assert(img_request->obj_request_count == 0); |
1899 | 2026 | ||
2027 | if (img_request_layered_test(img_request)) { | ||
2028 | img_request_layered_clear(img_request); | ||
2029 | rbd_dev_parent_put(img_request->rbd_dev); | ||
2030 | } | ||
2031 | |||
1900 | if (img_request_write_test(img_request)) | 2032 | if (img_request_write_test(img_request)) |
1901 | ceph_put_snap_context(img_request->snapc); | 2033 | ceph_put_snap_context(img_request->snapc); |
1902 | 2034 | ||
1903 | if (img_request_child_test(img_request)) | ||
1904 | rbd_obj_request_put(img_request->obj_request); | ||
1905 | |||
1906 | kmem_cache_free(rbd_img_request_cache, img_request); | 2035 | kmem_cache_free(rbd_img_request_cache, img_request); |
1907 | } | 2036 | } |
1908 | 2037 | ||
2038 | static struct rbd_img_request *rbd_parent_request_create( | ||
2039 | struct rbd_obj_request *obj_request, | ||
2040 | u64 img_offset, u64 length) | ||
2041 | { | ||
2042 | struct rbd_img_request *parent_request; | ||
2043 | struct rbd_device *rbd_dev; | ||
2044 | |||
2045 | rbd_assert(obj_request->img_request); | ||
2046 | rbd_dev = obj_request->img_request->rbd_dev; | ||
2047 | |||
2048 | parent_request = rbd_img_request_create(rbd_dev->parent, | ||
2049 | img_offset, length, false); | ||
2050 | if (!parent_request) | ||
2051 | return NULL; | ||
2052 | |||
2053 | img_request_child_set(parent_request); | ||
2054 | rbd_obj_request_get(obj_request); | ||
2055 | parent_request->obj_request = obj_request; | ||
2056 | |||
2057 | return parent_request; | ||
2058 | } | ||
2059 | |||
2060 | static void rbd_parent_request_destroy(struct kref *kref) | ||
2061 | { | ||
2062 | struct rbd_img_request *parent_request; | ||
2063 | struct rbd_obj_request *orig_request; | ||
2064 | |||
2065 | parent_request = container_of(kref, struct rbd_img_request, kref); | ||
2066 | orig_request = parent_request->obj_request; | ||
2067 | |||
2068 | parent_request->obj_request = NULL; | ||
2069 | rbd_obj_request_put(orig_request); | ||
2070 | img_request_child_clear(parent_request); | ||
2071 | |||
2072 | rbd_img_request_destroy(kref); | ||
2073 | } | ||
2074 | |||
1909 | static bool rbd_img_obj_end_request(struct rbd_obj_request *obj_request) | 2075 | static bool rbd_img_obj_end_request(struct rbd_obj_request *obj_request) |
1910 | { | 2076 | { |
1911 | struct rbd_img_request *img_request; | 2077 | struct rbd_img_request *img_request; |
@@ -2114,7 +2280,7 @@ rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request) | |||
2114 | { | 2280 | { |
2115 | struct rbd_img_request *img_request; | 2281 | struct rbd_img_request *img_request; |
2116 | struct rbd_device *rbd_dev; | 2282 | struct rbd_device *rbd_dev; |
2117 | u64 length; | 2283 | struct page **pages; |
2118 | u32 page_count; | 2284 | u32 page_count; |
2119 | 2285 | ||
2120 | rbd_assert(obj_request->type == OBJ_REQUEST_BIO); | 2286 | rbd_assert(obj_request->type == OBJ_REQUEST_BIO); |
@@ -2124,12 +2290,14 @@ rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request) | |||
2124 | 2290 | ||
2125 | rbd_dev = img_request->rbd_dev; | 2291 | rbd_dev = img_request->rbd_dev; |
2126 | rbd_assert(rbd_dev); | 2292 | rbd_assert(rbd_dev); |
2127 | length = (u64)1 << rbd_dev->header.obj_order; | ||
2128 | page_count = (u32)calc_pages_for(0, length); | ||
2129 | 2293 | ||
2130 | rbd_assert(obj_request->copyup_pages); | 2294 | pages = obj_request->copyup_pages; |
2131 | ceph_release_page_vector(obj_request->copyup_pages, page_count); | 2295 | rbd_assert(pages != NULL); |
2132 | obj_request->copyup_pages = NULL; | 2296 | obj_request->copyup_pages = NULL; |
2297 | page_count = obj_request->copyup_page_count; | ||
2298 | rbd_assert(page_count); | ||
2299 | obj_request->copyup_page_count = 0; | ||
2300 | ceph_release_page_vector(pages, page_count); | ||
2133 | 2301 | ||
2134 | /* | 2302 | /* |
2135 | * We want the transfer count to reflect the size of the | 2303 | * We want the transfer count to reflect the size of the |
@@ -2153,9 +2321,11 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) | |||
2153 | struct ceph_osd_client *osdc; | 2321 | struct ceph_osd_client *osdc; |
2154 | struct rbd_device *rbd_dev; | 2322 | struct rbd_device *rbd_dev; |
2155 | struct page **pages; | 2323 | struct page **pages; |
2156 | int result; | 2324 | u32 page_count; |
2157 | u64 obj_size; | 2325 | int img_result; |
2158 | u64 xferred; | 2326 | u64 parent_length; |
2327 | u64 offset; | ||
2328 | u64 length; | ||
2159 | 2329 | ||
2160 | rbd_assert(img_request_child_test(img_request)); | 2330 | rbd_assert(img_request_child_test(img_request)); |
2161 | 2331 | ||
@@ -2164,46 +2334,74 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) | |||
2164 | pages = img_request->copyup_pages; | 2334 | pages = img_request->copyup_pages; |
2165 | rbd_assert(pages != NULL); | 2335 | rbd_assert(pages != NULL); |
2166 | img_request->copyup_pages = NULL; | 2336 | img_request->copyup_pages = NULL; |
2337 | page_count = img_request->copyup_page_count; | ||
2338 | rbd_assert(page_count); | ||
2339 | img_request->copyup_page_count = 0; | ||
2167 | 2340 | ||
2168 | orig_request = img_request->obj_request; | 2341 | orig_request = img_request->obj_request; |
2169 | rbd_assert(orig_request != NULL); | 2342 | rbd_assert(orig_request != NULL); |
2170 | rbd_assert(orig_request->type == OBJ_REQUEST_BIO); | 2343 | rbd_assert(obj_request_type_valid(orig_request->type)); |
2171 | result = img_request->result; | 2344 | img_result = img_request->result; |
2172 | obj_size = img_request->length; | 2345 | parent_length = img_request->length; |
2173 | xferred = img_request->xferred; | 2346 | rbd_assert(parent_length == img_request->xferred); |
2347 | rbd_img_request_put(img_request); | ||
2174 | 2348 | ||
2175 | rbd_dev = img_request->rbd_dev; | 2349 | rbd_assert(orig_request->img_request); |
2350 | rbd_dev = orig_request->img_request->rbd_dev; | ||
2176 | rbd_assert(rbd_dev); | 2351 | rbd_assert(rbd_dev); |
2177 | rbd_assert(obj_size == (u64)1 << rbd_dev->header.obj_order); | ||
2178 | 2352 | ||
2179 | rbd_img_request_put(img_request); | 2353 | /* |
2354 | * If the overlap has become 0 (most likely because the | ||
2355 | * image has been flattened) we need to free the pages | ||
2356 | * and re-submit the original write request. | ||
2357 | */ | ||
2358 | if (!rbd_dev->parent_overlap) { | ||
2359 | struct ceph_osd_client *osdc; | ||
2180 | 2360 | ||
2181 | if (result) | 2361 | ceph_release_page_vector(pages, page_count); |
2182 | goto out_err; | 2362 | osdc = &rbd_dev->rbd_client->client->osdc; |
2363 | img_result = rbd_obj_request_submit(osdc, orig_request); | ||
2364 | if (!img_result) | ||
2365 | return; | ||
2366 | } | ||
2183 | 2367 | ||
2184 | /* Allocate the new copyup osd request for the original request */ | 2368 | if (img_result) |
2369 | goto out_err; | ||
2185 | 2370 | ||
2186 | result = -ENOMEM; | 2371 | /* |
2187 | rbd_assert(!orig_request->osd_req); | 2372 | * The original osd request is of no use to use any more. |
2373 | * We need a new one that can hold the two ops in a copyup | ||
2374 | * request. Allocate the new copyup osd request for the | ||
2375 | * original request, and release the old one. | ||
2376 | */ | ||
2377 | img_result = -ENOMEM; | ||
2188 | osd_req = rbd_osd_req_create_copyup(orig_request); | 2378 | osd_req = rbd_osd_req_create_copyup(orig_request); |
2189 | if (!osd_req) | 2379 | if (!osd_req) |
2190 | goto out_err; | 2380 | goto out_err; |
2381 | rbd_osd_req_destroy(orig_request->osd_req); | ||
2191 | orig_request->osd_req = osd_req; | 2382 | orig_request->osd_req = osd_req; |
2192 | orig_request->copyup_pages = pages; | 2383 | orig_request->copyup_pages = pages; |
2384 | orig_request->copyup_page_count = page_count; | ||
2193 | 2385 | ||
2194 | /* Initialize the copyup op */ | 2386 | /* Initialize the copyup op */ |
2195 | 2387 | ||
2196 | osd_req_op_cls_init(osd_req, 0, CEPH_OSD_OP_CALL, "rbd", "copyup"); | 2388 | osd_req_op_cls_init(osd_req, 0, CEPH_OSD_OP_CALL, "rbd", "copyup"); |
2197 | osd_req_op_cls_request_data_pages(osd_req, 0, pages, obj_size, 0, | 2389 | osd_req_op_cls_request_data_pages(osd_req, 0, pages, parent_length, 0, |
2198 | false, false); | 2390 | false, false); |
2199 | 2391 | ||
2200 | /* Then the original write request op */ | 2392 | /* Then the original write request op */ |
2201 | 2393 | ||
2394 | offset = orig_request->offset; | ||
2395 | length = orig_request->length; | ||
2202 | osd_req_op_extent_init(osd_req, 1, CEPH_OSD_OP_WRITE, | 2396 | osd_req_op_extent_init(osd_req, 1, CEPH_OSD_OP_WRITE, |
2203 | orig_request->offset, | 2397 | offset, length, 0, 0); |
2204 | orig_request->length, 0, 0); | 2398 | if (orig_request->type == OBJ_REQUEST_BIO) |
2205 | osd_req_op_extent_osd_data_bio(osd_req, 1, orig_request->bio_list, | 2399 | osd_req_op_extent_osd_data_bio(osd_req, 1, |
2206 | orig_request->length); | 2400 | orig_request->bio_list, length); |
2401 | else | ||
2402 | osd_req_op_extent_osd_data_pages(osd_req, 1, | ||
2403 | orig_request->pages, length, | ||
2404 | offset & ~PAGE_MASK, false, false); | ||
2207 | 2405 | ||
2208 | rbd_osd_req_format_write(orig_request); | 2406 | rbd_osd_req_format_write(orig_request); |
2209 | 2407 | ||
@@ -2211,13 +2409,13 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) | |||
2211 | 2409 | ||
2212 | orig_request->callback = rbd_img_obj_copyup_callback; | 2410 | orig_request->callback = rbd_img_obj_copyup_callback; |
2213 | osdc = &rbd_dev->rbd_client->client->osdc; | 2411 | osdc = &rbd_dev->rbd_client->client->osdc; |
2214 | result = rbd_obj_request_submit(osdc, orig_request); | 2412 | img_result = rbd_obj_request_submit(osdc, orig_request); |
2215 | if (!result) | 2413 | if (!img_result) |
2216 | return; | 2414 | return; |
2217 | out_err: | 2415 | out_err: |
2218 | /* Record the error code and complete the request */ | 2416 | /* Record the error code and complete the request */ |
2219 | 2417 | ||
2220 | orig_request->result = result; | 2418 | orig_request->result = img_result; |
2221 | orig_request->xferred = 0; | 2419 | orig_request->xferred = 0; |
2222 | obj_request_done_set(orig_request); | 2420 | obj_request_done_set(orig_request); |
2223 | rbd_obj_request_complete(orig_request); | 2421 | rbd_obj_request_complete(orig_request); |
@@ -2249,7 +2447,7 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request) | |||
2249 | int result; | 2447 | int result; |
2250 | 2448 | ||
2251 | rbd_assert(obj_request_img_data_test(obj_request)); | 2449 | rbd_assert(obj_request_img_data_test(obj_request)); |
2252 | rbd_assert(obj_request->type == OBJ_REQUEST_BIO); | 2450 | rbd_assert(obj_request_type_valid(obj_request->type)); |
2253 | 2451 | ||
2254 | img_request = obj_request->img_request; | 2452 | img_request = obj_request->img_request; |
2255 | rbd_assert(img_request != NULL); | 2453 | rbd_assert(img_request != NULL); |
@@ -2257,15 +2455,6 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request) | |||
2257 | rbd_assert(rbd_dev->parent != NULL); | 2455 | rbd_assert(rbd_dev->parent != NULL); |
2258 | 2456 | ||
2259 | /* | 2457 | /* |
2260 | * First things first. The original osd request is of no | ||
2261 | * use to use any more, we'll need a new one that can hold | ||
2262 | * the two ops in a copyup request. We'll get that later, | ||
2263 | * but for now we can release the old one. | ||
2264 | */ | ||
2265 | rbd_osd_req_destroy(obj_request->osd_req); | ||
2266 | obj_request->osd_req = NULL; | ||
2267 | |||
2268 | /* | ||
2269 | * Determine the byte range covered by the object in the | 2458 | * Determine the byte range covered by the object in the |
2270 | * child image to which the original request was to be sent. | 2459 | * child image to which the original request was to be sent. |
2271 | */ | 2460 | */ |
@@ -2295,18 +2484,16 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request) | |||
2295 | } | 2484 | } |
2296 | 2485 | ||
2297 | result = -ENOMEM; | 2486 | result = -ENOMEM; |
2298 | parent_request = rbd_img_request_create(rbd_dev->parent, | 2487 | parent_request = rbd_parent_request_create(obj_request, |
2299 | img_offset, length, | 2488 | img_offset, length); |
2300 | false, true); | ||
2301 | if (!parent_request) | 2489 | if (!parent_request) |
2302 | goto out_err; | 2490 | goto out_err; |
2303 | rbd_obj_request_get(obj_request); | ||
2304 | parent_request->obj_request = obj_request; | ||
2305 | 2491 | ||
2306 | result = rbd_img_request_fill(parent_request, OBJ_REQUEST_PAGES, pages); | 2492 | result = rbd_img_request_fill(parent_request, OBJ_REQUEST_PAGES, pages); |
2307 | if (result) | 2493 | if (result) |
2308 | goto out_err; | 2494 | goto out_err; |
2309 | parent_request->copyup_pages = pages; | 2495 | parent_request->copyup_pages = pages; |
2496 | parent_request->copyup_page_count = page_count; | ||
2310 | 2497 | ||
2311 | parent_request->callback = rbd_img_obj_parent_read_full_callback; | 2498 | parent_request->callback = rbd_img_obj_parent_read_full_callback; |
2312 | result = rbd_img_request_submit(parent_request); | 2499 | result = rbd_img_request_submit(parent_request); |
@@ -2314,6 +2501,7 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request) | |||
2314 | return 0; | 2501 | return 0; |
2315 | 2502 | ||
2316 | parent_request->copyup_pages = NULL; | 2503 | parent_request->copyup_pages = NULL; |
2504 | parent_request->copyup_page_count = 0; | ||
2317 | parent_request->obj_request = NULL; | 2505 | parent_request->obj_request = NULL; |
2318 | rbd_obj_request_put(obj_request); | 2506 | rbd_obj_request_put(obj_request); |
2319 | out_err: | 2507 | out_err: |
@@ -2331,6 +2519,7 @@ out_err: | |||
2331 | static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) | 2519 | static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) |
2332 | { | 2520 | { |
2333 | struct rbd_obj_request *orig_request; | 2521 | struct rbd_obj_request *orig_request; |
2522 | struct rbd_device *rbd_dev; | ||
2334 | int result; | 2523 | int result; |
2335 | 2524 | ||
2336 | rbd_assert(!obj_request_img_data_test(obj_request)); | 2525 | rbd_assert(!obj_request_img_data_test(obj_request)); |
@@ -2353,8 +2542,21 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) | |||
2353 | obj_request->xferred, obj_request->length); | 2542 | obj_request->xferred, obj_request->length); |
2354 | rbd_obj_request_put(obj_request); | 2543 | rbd_obj_request_put(obj_request); |
2355 | 2544 | ||
2356 | rbd_assert(orig_request); | 2545 | /* |
2357 | rbd_assert(orig_request->img_request); | 2546 | * If the overlap has become 0 (most likely because the |
2547 | * image has been flattened) we need to free the pages | ||
2548 | * and re-submit the original write request. | ||
2549 | */ | ||
2550 | rbd_dev = orig_request->img_request->rbd_dev; | ||
2551 | if (!rbd_dev->parent_overlap) { | ||
2552 | struct ceph_osd_client *osdc; | ||
2553 | |||
2554 | rbd_obj_request_put(orig_request); | ||
2555 | osdc = &rbd_dev->rbd_client->client->osdc; | ||
2556 | result = rbd_obj_request_submit(osdc, orig_request); | ||
2557 | if (!result) | ||
2558 | return; | ||
2559 | } | ||
2358 | 2560 | ||
2359 | /* | 2561 | /* |
2360 | * Our only purpose here is to determine whether the object | 2562 | * Our only purpose here is to determine whether the object |
@@ -2512,14 +2714,36 @@ static void rbd_img_parent_read_callback(struct rbd_img_request *img_request) | |||
2512 | struct rbd_obj_request *obj_request; | 2714 | struct rbd_obj_request *obj_request; |
2513 | struct rbd_device *rbd_dev; | 2715 | struct rbd_device *rbd_dev; |
2514 | u64 obj_end; | 2716 | u64 obj_end; |
2717 | u64 img_xferred; | ||
2718 | int img_result; | ||
2515 | 2719 | ||
2516 | rbd_assert(img_request_child_test(img_request)); | 2720 | rbd_assert(img_request_child_test(img_request)); |
2517 | 2721 | ||
2722 | /* First get what we need from the image request and release it */ | ||
2723 | |||
2518 | obj_request = img_request->obj_request; | 2724 | obj_request = img_request->obj_request; |
2725 | img_xferred = img_request->xferred; | ||
2726 | img_result = img_request->result; | ||
2727 | rbd_img_request_put(img_request); | ||
2728 | |||
2729 | /* | ||
2730 | * If the overlap has become 0 (most likely because the | ||
2731 | * image has been flattened) we need to re-submit the | ||
2732 | * original request. | ||
2733 | */ | ||
2519 | rbd_assert(obj_request); | 2734 | rbd_assert(obj_request); |
2520 | rbd_assert(obj_request->img_request); | 2735 | rbd_assert(obj_request->img_request); |
2736 | rbd_dev = obj_request->img_request->rbd_dev; | ||
2737 | if (!rbd_dev->parent_overlap) { | ||
2738 | struct ceph_osd_client *osdc; | ||
2521 | 2739 | ||
2522 | obj_request->result = img_request->result; | 2740 | osdc = &rbd_dev->rbd_client->client->osdc; |
2741 | img_result = rbd_obj_request_submit(osdc, obj_request); | ||
2742 | if (!img_result) | ||
2743 | return; | ||
2744 | } | ||
2745 | |||
2746 | obj_request->result = img_result; | ||
2523 | if (obj_request->result) | 2747 | if (obj_request->result) |
2524 | goto out; | 2748 | goto out; |
2525 | 2749 | ||
@@ -2532,7 +2756,6 @@ static void rbd_img_parent_read_callback(struct rbd_img_request *img_request) | |||
2532 | */ | 2756 | */ |
2533 | rbd_assert(obj_request->img_offset < U64_MAX - obj_request->length); | 2757 | rbd_assert(obj_request->img_offset < U64_MAX - obj_request->length); |
2534 | obj_end = obj_request->img_offset + obj_request->length; | 2758 | obj_end = obj_request->img_offset + obj_request->length; |
2535 | rbd_dev = obj_request->img_request->rbd_dev; | ||
2536 | if (obj_end > rbd_dev->parent_overlap) { | 2759 | if (obj_end > rbd_dev->parent_overlap) { |
2537 | u64 xferred = 0; | 2760 | u64 xferred = 0; |
2538 | 2761 | ||
@@ -2540,43 +2763,39 @@ static void rbd_img_parent_read_callback(struct rbd_img_request *img_request) | |||
2540 | xferred = rbd_dev->parent_overlap - | 2763 | xferred = rbd_dev->parent_overlap - |
2541 | obj_request->img_offset; | 2764 | obj_request->img_offset; |
2542 | 2765 | ||
2543 | obj_request->xferred = min(img_request->xferred, xferred); | 2766 | obj_request->xferred = min(img_xferred, xferred); |
2544 | } else { | 2767 | } else { |
2545 | obj_request->xferred = img_request->xferred; | 2768 | obj_request->xferred = img_xferred; |
2546 | } | 2769 | } |
2547 | out: | 2770 | out: |
2548 | rbd_img_request_put(img_request); | ||
2549 | rbd_img_obj_request_read_callback(obj_request); | 2771 | rbd_img_obj_request_read_callback(obj_request); |
2550 | rbd_obj_request_complete(obj_request); | 2772 | rbd_obj_request_complete(obj_request); |
2551 | } | 2773 | } |
2552 | 2774 | ||
2553 | static void rbd_img_parent_read(struct rbd_obj_request *obj_request) | 2775 | static void rbd_img_parent_read(struct rbd_obj_request *obj_request) |
2554 | { | 2776 | { |
2555 | struct rbd_device *rbd_dev; | ||
2556 | struct rbd_img_request *img_request; | 2777 | struct rbd_img_request *img_request; |
2557 | int result; | 2778 | int result; |
2558 | 2779 | ||
2559 | rbd_assert(obj_request_img_data_test(obj_request)); | 2780 | rbd_assert(obj_request_img_data_test(obj_request)); |
2560 | rbd_assert(obj_request->img_request != NULL); | 2781 | rbd_assert(obj_request->img_request != NULL); |
2561 | rbd_assert(obj_request->result == (s32) -ENOENT); | 2782 | rbd_assert(obj_request->result == (s32) -ENOENT); |
2562 | rbd_assert(obj_request->type == OBJ_REQUEST_BIO); | 2783 | rbd_assert(obj_request_type_valid(obj_request->type)); |
2563 | 2784 | ||
2564 | rbd_dev = obj_request->img_request->rbd_dev; | ||
2565 | rbd_assert(rbd_dev->parent != NULL); | ||
2566 | /* rbd_read_finish(obj_request, obj_request->length); */ | 2785 | /* rbd_read_finish(obj_request, obj_request->length); */ |
2567 | img_request = rbd_img_request_create(rbd_dev->parent, | 2786 | img_request = rbd_parent_request_create(obj_request, |
2568 | obj_request->img_offset, | 2787 | obj_request->img_offset, |
2569 | obj_request->length, | 2788 | obj_request->length); |
2570 | false, true); | ||
2571 | result = -ENOMEM; | 2789 | result = -ENOMEM; |
2572 | if (!img_request) | 2790 | if (!img_request) |
2573 | goto out_err; | 2791 | goto out_err; |
2574 | 2792 | ||
2575 | rbd_obj_request_get(obj_request); | 2793 | if (obj_request->type == OBJ_REQUEST_BIO) |
2576 | img_request->obj_request = obj_request; | 2794 | result = rbd_img_request_fill(img_request, OBJ_REQUEST_BIO, |
2577 | 2795 | obj_request->bio_list); | |
2578 | result = rbd_img_request_fill(img_request, OBJ_REQUEST_BIO, | 2796 | else |
2579 | obj_request->bio_list); | 2797 | result = rbd_img_request_fill(img_request, OBJ_REQUEST_PAGES, |
2798 | obj_request->pages); | ||
2580 | if (result) | 2799 | if (result) |
2581 | goto out_err; | 2800 | goto out_err; |
2582 | 2801 | ||
@@ -2626,6 +2845,7 @@ out: | |||
2626 | static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) | 2845 | static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) |
2627 | { | 2846 | { |
2628 | struct rbd_device *rbd_dev = (struct rbd_device *)data; | 2847 | struct rbd_device *rbd_dev = (struct rbd_device *)data; |
2848 | int ret; | ||
2629 | 2849 | ||
2630 | if (!rbd_dev) | 2850 | if (!rbd_dev) |
2631 | return; | 2851 | return; |
@@ -2633,7 +2853,9 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) | |||
2633 | dout("%s: \"%s\" notify_id %llu opcode %u\n", __func__, | 2853 | dout("%s: \"%s\" notify_id %llu opcode %u\n", __func__, |
2634 | rbd_dev->header_name, (unsigned long long)notify_id, | 2854 | rbd_dev->header_name, (unsigned long long)notify_id, |
2635 | (unsigned int)opcode); | 2855 | (unsigned int)opcode); |
2636 | (void)rbd_dev_refresh(rbd_dev); | 2856 | ret = rbd_dev_refresh(rbd_dev); |
2857 | if (ret) | ||
2858 | rbd_warn(rbd_dev, ": header refresh error (%d)\n", ret); | ||
2637 | 2859 | ||
2638 | rbd_obj_notify_ack(rbd_dev, notify_id); | 2860 | rbd_obj_notify_ack(rbd_dev, notify_id); |
2639 | } | 2861 | } |
@@ -2642,7 +2864,7 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) | |||
2642 | * Request sync osd watch/unwatch. The value of "start" determines | 2864 | * Request sync osd watch/unwatch. The value of "start" determines |
2643 | * whether a watch request is being initiated or torn down. | 2865 | * whether a watch request is being initiated or torn down. |
2644 | */ | 2866 | */ |
2645 | static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, int start) | 2867 | static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, bool start) |
2646 | { | 2868 | { |
2647 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; | 2869 | struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc; |
2648 | struct rbd_obj_request *obj_request; | 2870 | struct rbd_obj_request *obj_request; |
@@ -2676,7 +2898,7 @@ static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev, int start) | |||
2676 | rbd_dev->watch_request->osd_req); | 2898 | rbd_dev->watch_request->osd_req); |
2677 | 2899 | ||
2678 | osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_WATCH, | 2900 | osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_WATCH, |
2679 | rbd_dev->watch_event->cookie, 0, start); | 2901 | rbd_dev->watch_event->cookie, 0, start ? 1 : 0); |
2680 | rbd_osd_req_format_write(obj_request); | 2902 | rbd_osd_req_format_write(obj_request); |
2681 | 2903 | ||
2682 | ret = rbd_obj_request_submit(osdc, obj_request); | 2904 | ret = rbd_obj_request_submit(osdc, obj_request); |
@@ -2869,9 +3091,16 @@ static void rbd_request_fn(struct request_queue *q) | |||
2869 | goto end_request; /* Shouldn't happen */ | 3091 | goto end_request; /* Shouldn't happen */ |
2870 | } | 3092 | } |
2871 | 3093 | ||
3094 | result = -EIO; | ||
3095 | if (offset + length > rbd_dev->mapping.size) { | ||
3096 | rbd_warn(rbd_dev, "beyond EOD (%llu~%llu > %llu)\n", | ||
3097 | offset, length, rbd_dev->mapping.size); | ||
3098 | goto end_request; | ||
3099 | } | ||
3100 | |||
2872 | result = -ENOMEM; | 3101 | result = -ENOMEM; |
2873 | img_request = rbd_img_request_create(rbd_dev, offset, length, | 3102 | img_request = rbd_img_request_create(rbd_dev, offset, length, |
2874 | write_request, false); | 3103 | write_request); |
2875 | if (!img_request) | 3104 | if (!img_request) |
2876 | goto end_request; | 3105 | goto end_request; |
2877 | 3106 | ||
@@ -3022,17 +3251,11 @@ out: | |||
3022 | } | 3251 | } |
3023 | 3252 | ||
3024 | /* | 3253 | /* |
3025 | * Read the complete header for the given rbd device. | 3254 | * Read the complete header for the given rbd device. On successful |
3026 | * | 3255 | * return, the rbd_dev->header field will contain up-to-date |
3027 | * Returns a pointer to a dynamically-allocated buffer containing | 3256 | * information about the image. |
3028 | * the complete and validated header. Caller can pass the address | ||
3029 | * of a variable that will be filled in with the version of the | ||
3030 | * header object at the time it was read. | ||
3031 | * | ||
3032 | * Returns a pointer-coded errno if a failure occurs. | ||
3033 | */ | 3257 | */ |
3034 | static struct rbd_image_header_ondisk * | 3258 | static int rbd_dev_v1_header_info(struct rbd_device *rbd_dev) |
3035 | rbd_dev_v1_header_read(struct rbd_device *rbd_dev) | ||
3036 | { | 3259 | { |
3037 | struct rbd_image_header_ondisk *ondisk = NULL; | 3260 | struct rbd_image_header_ondisk *ondisk = NULL; |
3038 | u32 snap_count = 0; | 3261 | u32 snap_count = 0; |
@@ -3057,22 +3280,22 @@ rbd_dev_v1_header_read(struct rbd_device *rbd_dev) | |||
3057 | size += names_size; | 3280 | size += names_size; |
3058 | ondisk = kmalloc(size, GFP_KERNEL); | 3281 | ondisk = kmalloc(size, GFP_KERNEL); |
3059 | if (!ondisk) | 3282 | if (!ondisk) |
3060 | return ERR_PTR(-ENOMEM); | 3283 | return -ENOMEM; |
3061 | 3284 | ||
3062 | ret = rbd_obj_read_sync(rbd_dev, rbd_dev->header_name, | 3285 | ret = rbd_obj_read_sync(rbd_dev, rbd_dev->header_name, |
3063 | 0, size, ondisk); | 3286 | 0, size, ondisk); |
3064 | if (ret < 0) | 3287 | if (ret < 0) |
3065 | goto out_err; | 3288 | goto out; |
3066 | if ((size_t)ret < size) { | 3289 | if ((size_t)ret < size) { |
3067 | ret = -ENXIO; | 3290 | ret = -ENXIO; |
3068 | rbd_warn(rbd_dev, "short header read (want %zd got %d)", | 3291 | rbd_warn(rbd_dev, "short header read (want %zd got %d)", |
3069 | size, ret); | 3292 | size, ret); |
3070 | goto out_err; | 3293 | goto out; |
3071 | } | 3294 | } |
3072 | if (!rbd_dev_ondisk_valid(ondisk)) { | 3295 | if (!rbd_dev_ondisk_valid(ondisk)) { |
3073 | ret = -ENXIO; | 3296 | ret = -ENXIO; |
3074 | rbd_warn(rbd_dev, "invalid header"); | 3297 | rbd_warn(rbd_dev, "invalid header"); |
3075 | goto out_err; | 3298 | goto out; |
3076 | } | 3299 | } |
3077 | 3300 | ||
3078 | names_size = le64_to_cpu(ondisk->snap_names_len); | 3301 | names_size = le64_to_cpu(ondisk->snap_names_len); |
@@ -3080,85 +3303,13 @@ rbd_dev_v1_header_read(struct rbd_device *rbd_dev) | |||
3080 | snap_count = le32_to_cpu(ondisk->snap_count); | 3303 | snap_count = le32_to_cpu(ondisk->snap_count); |
3081 | } while (snap_count != want_count); | 3304 | } while (snap_count != want_count); |
3082 | 3305 | ||
3083 | return ondisk; | 3306 | ret = rbd_header_from_disk(rbd_dev, ondisk); |
3084 | 3307 | out: | |
3085 | out_err: | ||
3086 | kfree(ondisk); | ||
3087 | |||
3088 | return ERR_PTR(ret); | ||
3089 | } | ||
3090 | |||
3091 | /* | ||
3092 | * reload the ondisk the header | ||
3093 | */ | ||
3094 | static int rbd_read_header(struct rbd_device *rbd_dev, | ||
3095 | struct rbd_image_header *header) | ||
3096 | { | ||
3097 | struct rbd_image_header_ondisk *ondisk; | ||
3098 | int ret; | ||
3099 | |||
3100 | ondisk = rbd_dev_v1_header_read(rbd_dev); | ||
3101 | if (IS_ERR(ondisk)) | ||
3102 | return PTR_ERR(ondisk); | ||
3103 | ret = rbd_header_from_disk(header, ondisk); | ||
3104 | kfree(ondisk); | 3308 | kfree(ondisk); |
3105 | 3309 | ||
3106 | return ret; | 3310 | return ret; |
3107 | } | 3311 | } |
3108 | 3312 | ||
3109 | static void rbd_update_mapping_size(struct rbd_device *rbd_dev) | ||
3110 | { | ||
3111 | if (rbd_dev->spec->snap_id != CEPH_NOSNAP) | ||
3112 | return; | ||
3113 | |||
3114 | if (rbd_dev->mapping.size != rbd_dev->header.image_size) { | ||
3115 | sector_t size; | ||
3116 | |||
3117 | rbd_dev->mapping.size = rbd_dev->header.image_size; | ||
3118 | size = (sector_t)rbd_dev->mapping.size / SECTOR_SIZE; | ||
3119 | dout("setting size to %llu sectors", (unsigned long long)size); | ||
3120 | set_capacity(rbd_dev->disk, size); | ||
3121 | } | ||
3122 | } | ||
3123 | |||
3124 | /* | ||
3125 | * only read the first part of the ondisk header, without the snaps info | ||
3126 | */ | ||
3127 | static int rbd_dev_v1_refresh(struct rbd_device *rbd_dev) | ||
3128 | { | ||
3129 | int ret; | ||
3130 | struct rbd_image_header h; | ||
3131 | |||
3132 | ret = rbd_read_header(rbd_dev, &h); | ||
3133 | if (ret < 0) | ||
3134 | return ret; | ||
3135 | |||
3136 | down_write(&rbd_dev->header_rwsem); | ||
3137 | |||
3138 | /* Update image size, and check for resize of mapped image */ | ||
3139 | rbd_dev->header.image_size = h.image_size; | ||
3140 | rbd_update_mapping_size(rbd_dev); | ||
3141 | |||
3142 | /* rbd_dev->header.object_prefix shouldn't change */ | ||
3143 | kfree(rbd_dev->header.snap_sizes); | ||
3144 | kfree(rbd_dev->header.snap_names); | ||
3145 | /* osd requests may still refer to snapc */ | ||
3146 | ceph_put_snap_context(rbd_dev->header.snapc); | ||
3147 | |||
3148 | rbd_dev->header.image_size = h.image_size; | ||
3149 | rbd_dev->header.snapc = h.snapc; | ||
3150 | rbd_dev->header.snap_names = h.snap_names; | ||
3151 | rbd_dev->header.snap_sizes = h.snap_sizes; | ||
3152 | /* Free the extra copy of the object prefix */ | ||
3153 | if (strcmp(rbd_dev->header.object_prefix, h.object_prefix)) | ||
3154 | rbd_warn(rbd_dev, "object prefix changed (ignoring)"); | ||
3155 | kfree(h.object_prefix); | ||
3156 | |||
3157 | up_write(&rbd_dev->header_rwsem); | ||
3158 | |||
3159 | return ret; | ||
3160 | } | ||
3161 | |||
3162 | /* | 3313 | /* |
3163 | * Clear the rbd device's EXISTS flag if the snapshot it's mapped to | 3314 | * Clear the rbd device's EXISTS flag if the snapshot it's mapped to |
3164 | * has disappeared from the (just updated) snapshot context. | 3315 | * has disappeared from the (just updated) snapshot context. |
@@ -3180,26 +3331,29 @@ static void rbd_exists_validate(struct rbd_device *rbd_dev) | |||
3180 | 3331 | ||
3181 | static int rbd_dev_refresh(struct rbd_device *rbd_dev) | 3332 | static int rbd_dev_refresh(struct rbd_device *rbd_dev) |
3182 | { | 3333 | { |
3183 | u64 image_size; | 3334 | u64 mapping_size; |
3184 | int ret; | 3335 | int ret; |
3185 | 3336 | ||
3186 | rbd_assert(rbd_image_format_valid(rbd_dev->image_format)); | 3337 | rbd_assert(rbd_image_format_valid(rbd_dev->image_format)); |
3187 | image_size = rbd_dev->header.image_size; | 3338 | mapping_size = rbd_dev->mapping.size; |
3188 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | 3339 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
3189 | if (rbd_dev->image_format == 1) | 3340 | if (rbd_dev->image_format == 1) |
3190 | ret = rbd_dev_v1_refresh(rbd_dev); | 3341 | ret = rbd_dev_v1_header_info(rbd_dev); |
3191 | else | 3342 | else |
3192 | ret = rbd_dev_v2_refresh(rbd_dev); | 3343 | ret = rbd_dev_v2_header_info(rbd_dev); |
3193 | 3344 | ||
3194 | /* If it's a mapped snapshot, validate its EXISTS flag */ | 3345 | /* If it's a mapped snapshot, validate its EXISTS flag */ |
3195 | 3346 | ||
3196 | rbd_exists_validate(rbd_dev); | 3347 | rbd_exists_validate(rbd_dev); |
3197 | mutex_unlock(&ctl_mutex); | 3348 | mutex_unlock(&ctl_mutex); |
3198 | if (ret) | 3349 | if (mapping_size != rbd_dev->mapping.size) { |
3199 | rbd_warn(rbd_dev, "got notification but failed to " | 3350 | sector_t size; |
3200 | " update snaps: %d\n", ret); | 3351 | |
3201 | if (image_size != rbd_dev->header.image_size) | 3352 | size = (sector_t)rbd_dev->mapping.size / SECTOR_SIZE; |
3353 | dout("setting size to %llu sectors", (unsigned long long)size); | ||
3354 | set_capacity(rbd_dev->disk, size); | ||
3202 | revalidate_disk(rbd_dev->disk); | 3355 | revalidate_disk(rbd_dev->disk); |
3356 | } | ||
3203 | 3357 | ||
3204 | return ret; | 3358 | return ret; |
3205 | } | 3359 | } |
@@ -3403,6 +3557,8 @@ static ssize_t rbd_image_refresh(struct device *dev, | |||
3403 | int ret; | 3557 | int ret; |
3404 | 3558 | ||
3405 | ret = rbd_dev_refresh(rbd_dev); | 3559 | ret = rbd_dev_refresh(rbd_dev); |
3560 | if (ret) | ||
3561 | rbd_warn(rbd_dev, ": manual header refresh error (%d)\n", ret); | ||
3406 | 3562 | ||
3407 | return ret < 0 ? ret : size; | 3563 | return ret < 0 ? ret : size; |
3408 | } | 3564 | } |
@@ -3501,6 +3657,7 @@ static struct rbd_device *rbd_dev_create(struct rbd_client *rbdc, | |||
3501 | 3657 | ||
3502 | spin_lock_init(&rbd_dev->lock); | 3658 | spin_lock_init(&rbd_dev->lock); |
3503 | rbd_dev->flags = 0; | 3659 | rbd_dev->flags = 0; |
3660 | atomic_set(&rbd_dev->parent_ref, 0); | ||
3504 | INIT_LIST_HEAD(&rbd_dev->node); | 3661 | INIT_LIST_HEAD(&rbd_dev->node); |
3505 | init_rwsem(&rbd_dev->header_rwsem); | 3662 | init_rwsem(&rbd_dev->header_rwsem); |
3506 | 3663 | ||
@@ -3650,6 +3807,7 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) | |||
3650 | __le64 snapid; | 3807 | __le64 snapid; |
3651 | void *p; | 3808 | void *p; |
3652 | void *end; | 3809 | void *end; |
3810 | u64 pool_id; | ||
3653 | char *image_id; | 3811 | char *image_id; |
3654 | u64 overlap; | 3812 | u64 overlap; |
3655 | int ret; | 3813 | int ret; |
@@ -3680,18 +3838,37 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) | |||
3680 | p = reply_buf; | 3838 | p = reply_buf; |
3681 | end = reply_buf + ret; | 3839 | end = reply_buf + ret; |
3682 | ret = -ERANGE; | 3840 | ret = -ERANGE; |
3683 | ceph_decode_64_safe(&p, end, parent_spec->pool_id, out_err); | 3841 | ceph_decode_64_safe(&p, end, pool_id, out_err); |
3684 | if (parent_spec->pool_id == CEPH_NOPOOL) | 3842 | if (pool_id == CEPH_NOPOOL) { |
3843 | /* | ||
3844 | * Either the parent never existed, or we have | ||
3845 | * record of it but the image got flattened so it no | ||
3846 | * longer has a parent. When the parent of a | ||
3847 | * layered image disappears we immediately set the | ||
3848 | * overlap to 0. The effect of this is that all new | ||
3849 | * requests will be treated as if the image had no | ||
3850 | * parent. | ||
3851 | */ | ||
3852 | if (rbd_dev->parent_overlap) { | ||
3853 | rbd_dev->parent_overlap = 0; | ||
3854 | smp_mb(); | ||
3855 | rbd_dev_parent_put(rbd_dev); | ||
3856 | pr_info("%s: clone image has been flattened\n", | ||
3857 | rbd_dev->disk->disk_name); | ||
3858 | } | ||
3859 | |||
3685 | goto out; /* No parent? No problem. */ | 3860 | goto out; /* No parent? No problem. */ |
3861 | } | ||
3686 | 3862 | ||
3687 | /* The ceph file layout needs to fit pool id in 32 bits */ | 3863 | /* The ceph file layout needs to fit pool id in 32 bits */ |
3688 | 3864 | ||
3689 | ret = -EIO; | 3865 | ret = -EIO; |
3690 | if (parent_spec->pool_id > (u64)U32_MAX) { | 3866 | if (pool_id > (u64)U32_MAX) { |
3691 | rbd_warn(NULL, "parent pool id too large (%llu > %u)\n", | 3867 | rbd_warn(NULL, "parent pool id too large (%llu > %u)\n", |
3692 | (unsigned long long)parent_spec->pool_id, U32_MAX); | 3868 | (unsigned long long)pool_id, U32_MAX); |
3693 | goto out_err; | 3869 | goto out_err; |
3694 | } | 3870 | } |
3871 | parent_spec->pool_id = pool_id; | ||
3695 | 3872 | ||
3696 | image_id = ceph_extract_encoded_string(&p, end, NULL, GFP_KERNEL); | 3873 | image_id = ceph_extract_encoded_string(&p, end, NULL, GFP_KERNEL); |
3697 | if (IS_ERR(image_id)) { | 3874 | if (IS_ERR(image_id)) { |
@@ -3702,9 +3879,14 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) | |||
3702 | ceph_decode_64_safe(&p, end, parent_spec->snap_id, out_err); | 3879 | ceph_decode_64_safe(&p, end, parent_spec->snap_id, out_err); |
3703 | ceph_decode_64_safe(&p, end, overlap, out_err); | 3880 | ceph_decode_64_safe(&p, end, overlap, out_err); |
3704 | 3881 | ||
3705 | rbd_dev->parent_overlap = overlap; | 3882 | if (overlap) { |
3706 | rbd_dev->parent_spec = parent_spec; | 3883 | rbd_spec_put(rbd_dev->parent_spec); |
3707 | parent_spec = NULL; /* rbd_dev now owns this */ | 3884 | rbd_dev->parent_spec = parent_spec; |
3885 | parent_spec = NULL; /* rbd_dev now owns this */ | ||
3886 | rbd_dev->parent_overlap = overlap; | ||
3887 | } else { | ||
3888 | rbd_warn(rbd_dev, "ignoring parent of clone with overlap 0\n"); | ||
3889 | } | ||
3708 | out: | 3890 | out: |
3709 | ret = 0; | 3891 | ret = 0; |
3710 | out_err: | 3892 | out_err: |
@@ -4002,6 +4184,7 @@ static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev) | |||
4002 | for (i = 0; i < snap_count; i++) | 4184 | for (i = 0; i < snap_count; i++) |
4003 | snapc->snaps[i] = ceph_decode_64(&p); | 4185 | snapc->snaps[i] = ceph_decode_64(&p); |
4004 | 4186 | ||
4187 | ceph_put_snap_context(rbd_dev->header.snapc); | ||
4005 | rbd_dev->header.snapc = snapc; | 4188 | rbd_dev->header.snapc = snapc; |
4006 | 4189 | ||
4007 | dout(" snap context seq = %llu, snap_count = %u\n", | 4190 | dout(" snap context seq = %llu, snap_count = %u\n", |
@@ -4053,21 +4236,56 @@ out: | |||
4053 | return snap_name; | 4236 | return snap_name; |
4054 | } | 4237 | } |
4055 | 4238 | ||
4056 | static int rbd_dev_v2_refresh(struct rbd_device *rbd_dev) | 4239 | static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev) |
4057 | { | 4240 | { |
4241 | bool first_time = rbd_dev->header.object_prefix == NULL; | ||
4058 | int ret; | 4242 | int ret; |
4059 | 4243 | ||
4060 | down_write(&rbd_dev->header_rwsem); | 4244 | down_write(&rbd_dev->header_rwsem); |
4061 | 4245 | ||
4246 | if (first_time) { | ||
4247 | ret = rbd_dev_v2_header_onetime(rbd_dev); | ||
4248 | if (ret) | ||
4249 | goto out; | ||
4250 | } | ||
4251 | |||
4252 | /* | ||
4253 | * If the image supports layering, get the parent info. We | ||
4254 | * need to probe the first time regardless. Thereafter we | ||
4255 | * only need to if there's a parent, to see if it has | ||
4256 | * disappeared due to the mapped image getting flattened. | ||
4257 | */ | ||
4258 | if (rbd_dev->header.features & RBD_FEATURE_LAYERING && | ||
4259 | (first_time || rbd_dev->parent_spec)) { | ||
4260 | bool warn; | ||
4261 | |||
4262 | ret = rbd_dev_v2_parent_info(rbd_dev); | ||
4263 | if (ret) | ||
4264 | goto out; | ||
4265 | |||
4266 | /* | ||
4267 | * Print a warning if this is the initial probe and | ||
4268 | * the image has a parent. Don't print it if the | ||
4269 | * image now being probed is itself a parent. We | ||
4270 | * can tell at this point because we won't know its | ||
4271 | * pool name yet (just its pool id). | ||
4272 | */ | ||
4273 | warn = rbd_dev->parent_spec && rbd_dev->spec->pool_name; | ||
4274 | if (first_time && warn) | ||
4275 | rbd_warn(rbd_dev, "WARNING: kernel layering " | ||
4276 | "is EXPERIMENTAL!"); | ||
4277 | } | ||
4278 | |||
4062 | ret = rbd_dev_v2_image_size(rbd_dev); | 4279 | ret = rbd_dev_v2_image_size(rbd_dev); |
4063 | if (ret) | 4280 | if (ret) |
4064 | goto out; | 4281 | goto out; |
4065 | rbd_update_mapping_size(rbd_dev); | 4282 | |
4283 | if (rbd_dev->spec->snap_id == CEPH_NOSNAP) | ||
4284 | if (rbd_dev->mapping.size != rbd_dev->header.image_size) | ||
4285 | rbd_dev->mapping.size = rbd_dev->header.image_size; | ||
4066 | 4286 | ||
4067 | ret = rbd_dev_v2_snap_context(rbd_dev); | 4287 | ret = rbd_dev_v2_snap_context(rbd_dev); |
4068 | dout("rbd_dev_v2_snap_context returned %d\n", ret); | 4288 | dout("rbd_dev_v2_snap_context returned %d\n", ret); |
4069 | if (ret) | ||
4070 | goto out; | ||
4071 | out: | 4289 | out: |
4072 | up_write(&rbd_dev->header_rwsem); | 4290 | up_write(&rbd_dev->header_rwsem); |
4073 | 4291 | ||
@@ -4484,16 +4702,18 @@ out: | |||
4484 | return ret; | 4702 | return ret; |
4485 | } | 4703 | } |
4486 | 4704 | ||
4487 | /* Undo whatever state changes are made by v1 or v2 image probe */ | 4705 | /* |
4488 | 4706 | * Undo whatever state changes are made by v1 or v2 header info | |
4707 | * call. | ||
4708 | */ | ||
4489 | static void rbd_dev_unprobe(struct rbd_device *rbd_dev) | 4709 | static void rbd_dev_unprobe(struct rbd_device *rbd_dev) |
4490 | { | 4710 | { |
4491 | struct rbd_image_header *header; | 4711 | struct rbd_image_header *header; |
4492 | 4712 | ||
4493 | rbd_dev_remove_parent(rbd_dev); | 4713 | /* Drop parent reference unless it's already been done (or none) */ |
4494 | rbd_spec_put(rbd_dev->parent_spec); | 4714 | |
4495 | rbd_dev->parent_spec = NULL; | 4715 | if (rbd_dev->parent_overlap) |
4496 | rbd_dev->parent_overlap = 0; | 4716 | rbd_dev_parent_put(rbd_dev); |
4497 | 4717 | ||
4498 | /* Free dynamic fields from the header, then zero it out */ | 4718 | /* Free dynamic fields from the header, then zero it out */ |
4499 | 4719 | ||
@@ -4505,72 +4725,22 @@ static void rbd_dev_unprobe(struct rbd_device *rbd_dev) | |||
4505 | memset(header, 0, sizeof (*header)); | 4725 | memset(header, 0, sizeof (*header)); |
4506 | } | 4726 | } |
4507 | 4727 | ||
4508 | static int rbd_dev_v1_probe(struct rbd_device *rbd_dev) | 4728 | static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev) |
4509 | { | 4729 | { |
4510 | int ret; | 4730 | int ret; |
4511 | 4731 | ||
4512 | /* Populate rbd image metadata */ | ||
4513 | |||
4514 | ret = rbd_read_header(rbd_dev, &rbd_dev->header); | ||
4515 | if (ret < 0) | ||
4516 | goto out_err; | ||
4517 | |||
4518 | /* Version 1 images have no parent (no layering) */ | ||
4519 | |||
4520 | rbd_dev->parent_spec = NULL; | ||
4521 | rbd_dev->parent_overlap = 0; | ||
4522 | |||
4523 | dout("discovered version 1 image, header name is %s\n", | ||
4524 | rbd_dev->header_name); | ||
4525 | |||
4526 | return 0; | ||
4527 | |||
4528 | out_err: | ||
4529 | kfree(rbd_dev->header_name); | ||
4530 | rbd_dev->header_name = NULL; | ||
4531 | kfree(rbd_dev->spec->image_id); | ||
4532 | rbd_dev->spec->image_id = NULL; | ||
4533 | |||
4534 | return ret; | ||
4535 | } | ||
4536 | |||
4537 | static int rbd_dev_v2_probe(struct rbd_device *rbd_dev) | ||
4538 | { | ||
4539 | int ret; | ||
4540 | |||
4541 | ret = rbd_dev_v2_image_size(rbd_dev); | ||
4542 | if (ret) | ||
4543 | goto out_err; | ||
4544 | |||
4545 | /* Get the object prefix (a.k.a. block_name) for the image */ | ||
4546 | |||
4547 | ret = rbd_dev_v2_object_prefix(rbd_dev); | 4732 | ret = rbd_dev_v2_object_prefix(rbd_dev); |
4548 | if (ret) | 4733 | if (ret) |
4549 | goto out_err; | 4734 | goto out_err; |
4550 | 4735 | ||
4551 | /* Get the and check features for the image */ | 4736 | /* |
4552 | 4737 | * Get the and check features for the image. Currently the | |
4738 | * features are assumed to never change. | ||
4739 | */ | ||
4553 | ret = rbd_dev_v2_features(rbd_dev); | 4740 | ret = rbd_dev_v2_features(rbd_dev); |
4554 | if (ret) | 4741 | if (ret) |
4555 | goto out_err; | 4742 | goto out_err; |
4556 | 4743 | ||
4557 | /* If the image supports layering, get the parent info */ | ||
4558 | |||
4559 | if (rbd_dev->header.features & RBD_FEATURE_LAYERING) { | ||
4560 | ret = rbd_dev_v2_parent_info(rbd_dev); | ||
4561 | if (ret) | ||
4562 | goto out_err; | ||
4563 | |||
4564 | /* | ||
4565 | * Don't print a warning for parent images. We can | ||
4566 | * tell this point because we won't know its pool | ||
4567 | * name yet (just its pool id). | ||
4568 | */ | ||
4569 | if (rbd_dev->spec->pool_name) | ||
4570 | rbd_warn(rbd_dev, "WARNING: kernel layering " | ||
4571 | "is EXPERIMENTAL!"); | ||
4572 | } | ||
4573 | |||
4574 | /* If the image supports fancy striping, get its parameters */ | 4744 | /* If the image supports fancy striping, get its parameters */ |
4575 | 4745 | ||
4576 | if (rbd_dev->header.features & RBD_FEATURE_STRIPINGV2) { | 4746 | if (rbd_dev->header.features & RBD_FEATURE_STRIPINGV2) { |
@@ -4578,28 +4748,11 @@ static int rbd_dev_v2_probe(struct rbd_device *rbd_dev) | |||
4578 | if (ret < 0) | 4748 | if (ret < 0) |
4579 | goto out_err; | 4749 | goto out_err; |
4580 | } | 4750 | } |
4581 | 4751 | /* No support for crypto and compression type format 2 images */ | |
4582 | /* crypto and compression type aren't (yet) supported for v2 images */ | ||
4583 | |||
4584 | rbd_dev->header.crypt_type = 0; | ||
4585 | rbd_dev->header.comp_type = 0; | ||
4586 | |||
4587 | /* Get the snapshot context, plus the header version */ | ||
4588 | |||
4589 | ret = rbd_dev_v2_snap_context(rbd_dev); | ||
4590 | if (ret) | ||
4591 | goto out_err; | ||
4592 | |||
4593 | dout("discovered version 2 image, header name is %s\n", | ||
4594 | rbd_dev->header_name); | ||
4595 | 4752 | ||
4596 | return 0; | 4753 | return 0; |
4597 | out_err: | 4754 | out_err: |
4598 | rbd_dev->parent_overlap = 0; | 4755 | rbd_dev->header.features = 0; |
4599 | rbd_spec_put(rbd_dev->parent_spec); | ||
4600 | rbd_dev->parent_spec = NULL; | ||
4601 | kfree(rbd_dev->header_name); | ||
4602 | rbd_dev->header_name = NULL; | ||
4603 | kfree(rbd_dev->header.object_prefix); | 4756 | kfree(rbd_dev->header.object_prefix); |
4604 | rbd_dev->header.object_prefix = NULL; | 4757 | rbd_dev->header.object_prefix = NULL; |
4605 | 4758 | ||
@@ -4628,15 +4781,16 @@ static int rbd_dev_probe_parent(struct rbd_device *rbd_dev) | |||
4628 | if (!parent) | 4781 | if (!parent) |
4629 | goto out_err; | 4782 | goto out_err; |
4630 | 4783 | ||
4631 | ret = rbd_dev_image_probe(parent); | 4784 | ret = rbd_dev_image_probe(parent, false); |
4632 | if (ret < 0) | 4785 | if (ret < 0) |
4633 | goto out_err; | 4786 | goto out_err; |
4634 | rbd_dev->parent = parent; | 4787 | rbd_dev->parent = parent; |
4788 | atomic_set(&rbd_dev->parent_ref, 1); | ||
4635 | 4789 | ||
4636 | return 0; | 4790 | return 0; |
4637 | out_err: | 4791 | out_err: |
4638 | if (parent) { | 4792 | if (parent) { |
4639 | rbd_spec_put(rbd_dev->parent_spec); | 4793 | rbd_dev_unparent(rbd_dev); |
4640 | kfree(rbd_dev->header_name); | 4794 | kfree(rbd_dev->header_name); |
4641 | rbd_dev_destroy(parent); | 4795 | rbd_dev_destroy(parent); |
4642 | } else { | 4796 | } else { |
@@ -4651,10 +4805,6 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev) | |||
4651 | { | 4805 | { |
4652 | int ret; | 4806 | int ret; |
4653 | 4807 | ||
4654 | ret = rbd_dev_mapping_set(rbd_dev); | ||
4655 | if (ret) | ||
4656 | return ret; | ||
4657 | |||
4658 | /* generate unique id: find highest unique id, add one */ | 4808 | /* generate unique id: find highest unique id, add one */ |
4659 | rbd_dev_id_get(rbd_dev); | 4809 | rbd_dev_id_get(rbd_dev); |
4660 | 4810 | ||
@@ -4676,13 +4826,17 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev) | |||
4676 | if (ret) | 4826 | if (ret) |
4677 | goto err_out_blkdev; | 4827 | goto err_out_blkdev; |
4678 | 4828 | ||
4679 | ret = rbd_bus_add_dev(rbd_dev); | 4829 | ret = rbd_dev_mapping_set(rbd_dev); |
4680 | if (ret) | 4830 | if (ret) |
4681 | goto err_out_disk; | 4831 | goto err_out_disk; |
4832 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); | ||
4833 | |||
4834 | ret = rbd_bus_add_dev(rbd_dev); | ||
4835 | if (ret) | ||
4836 | goto err_out_mapping; | ||
4682 | 4837 | ||
4683 | /* Everything's ready. Announce the disk to the world. */ | 4838 | /* Everything's ready. Announce the disk to the world. */ |
4684 | 4839 | ||
4685 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); | ||
4686 | set_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); | 4840 | set_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); |
4687 | add_disk(rbd_dev->disk); | 4841 | add_disk(rbd_dev->disk); |
4688 | 4842 | ||
@@ -4691,6 +4845,8 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev) | |||
4691 | 4845 | ||
4692 | return ret; | 4846 | return ret; |
4693 | 4847 | ||
4848 | err_out_mapping: | ||
4849 | rbd_dev_mapping_clear(rbd_dev); | ||
4694 | err_out_disk: | 4850 | err_out_disk: |
4695 | rbd_free_disk(rbd_dev); | 4851 | rbd_free_disk(rbd_dev); |
4696 | err_out_blkdev: | 4852 | err_out_blkdev: |
@@ -4731,12 +4887,7 @@ static int rbd_dev_header_name(struct rbd_device *rbd_dev) | |||
4731 | 4887 | ||
4732 | static void rbd_dev_image_release(struct rbd_device *rbd_dev) | 4888 | static void rbd_dev_image_release(struct rbd_device *rbd_dev) |
4733 | { | 4889 | { |
4734 | int ret; | ||
4735 | |||
4736 | rbd_dev_unprobe(rbd_dev); | 4890 | rbd_dev_unprobe(rbd_dev); |
4737 | ret = rbd_dev_header_watch_sync(rbd_dev, 0); | ||
4738 | if (ret) | ||
4739 | rbd_warn(rbd_dev, "failed to cancel watch event (%d)\n", ret); | ||
4740 | kfree(rbd_dev->header_name); | 4891 | kfree(rbd_dev->header_name); |
4741 | rbd_dev->header_name = NULL; | 4892 | rbd_dev->header_name = NULL; |
4742 | rbd_dev->image_format = 0; | 4893 | rbd_dev->image_format = 0; |
@@ -4748,18 +4899,20 @@ static void rbd_dev_image_release(struct rbd_device *rbd_dev) | |||
4748 | 4899 | ||
4749 | /* | 4900 | /* |
4750 | * Probe for the existence of the header object for the given rbd | 4901 | * Probe for the existence of the header object for the given rbd |
4751 | * device. For format 2 images this includes determining the image | 4902 | * device. If this image is the one being mapped (i.e., not a |
4752 | * id. | 4903 | * parent), initiate a watch on its header object before using that |
4904 | * object to get detailed information about the rbd image. | ||
4753 | */ | 4905 | */ |
4754 | static int rbd_dev_image_probe(struct rbd_device *rbd_dev) | 4906 | static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping) |
4755 | { | 4907 | { |
4756 | int ret; | 4908 | int ret; |
4757 | int tmp; | 4909 | int tmp; |
4758 | 4910 | ||
4759 | /* | 4911 | /* |
4760 | * Get the id from the image id object. If it's not a | 4912 | * Get the id from the image id object. Unless there's an |
4761 | * format 2 image, we'll get ENOENT back, and we'll assume | 4913 | * error, rbd_dev->spec->image_id will be filled in with |
4762 | * it's a format 1 image. | 4914 | * a dynamically-allocated string, and rbd_dev->image_format |
4915 | * will be set to either 1 or 2. | ||
4763 | */ | 4916 | */ |
4764 | ret = rbd_dev_image_id(rbd_dev); | 4917 | ret = rbd_dev_image_id(rbd_dev); |
4765 | if (ret) | 4918 | if (ret) |
@@ -4771,14 +4924,16 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev) | |||
4771 | if (ret) | 4924 | if (ret) |
4772 | goto err_out_format; | 4925 | goto err_out_format; |
4773 | 4926 | ||
4774 | ret = rbd_dev_header_watch_sync(rbd_dev, 1); | 4927 | if (mapping) { |
4775 | if (ret) | 4928 | ret = rbd_dev_header_watch_sync(rbd_dev, true); |
4776 | goto out_header_name; | 4929 | if (ret) |
4930 | goto out_header_name; | ||
4931 | } | ||
4777 | 4932 | ||
4778 | if (rbd_dev->image_format == 1) | 4933 | if (rbd_dev->image_format == 1) |
4779 | ret = rbd_dev_v1_probe(rbd_dev); | 4934 | ret = rbd_dev_v1_header_info(rbd_dev); |
4780 | else | 4935 | else |
4781 | ret = rbd_dev_v2_probe(rbd_dev); | 4936 | ret = rbd_dev_v2_header_info(rbd_dev); |
4782 | if (ret) | 4937 | if (ret) |
4783 | goto err_out_watch; | 4938 | goto err_out_watch; |
4784 | 4939 | ||
@@ -4787,15 +4942,22 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev) | |||
4787 | goto err_out_probe; | 4942 | goto err_out_probe; |
4788 | 4943 | ||
4789 | ret = rbd_dev_probe_parent(rbd_dev); | 4944 | ret = rbd_dev_probe_parent(rbd_dev); |
4790 | if (!ret) | 4945 | if (ret) |
4791 | return 0; | 4946 | goto err_out_probe; |
4947 | |||
4948 | dout("discovered format %u image, header name is %s\n", | ||
4949 | rbd_dev->image_format, rbd_dev->header_name); | ||
4792 | 4950 | ||
4951 | return 0; | ||
4793 | err_out_probe: | 4952 | err_out_probe: |
4794 | rbd_dev_unprobe(rbd_dev); | 4953 | rbd_dev_unprobe(rbd_dev); |
4795 | err_out_watch: | 4954 | err_out_watch: |
4796 | tmp = rbd_dev_header_watch_sync(rbd_dev, 0); | 4955 | if (mapping) { |
4797 | if (tmp) | 4956 | tmp = rbd_dev_header_watch_sync(rbd_dev, false); |
4798 | rbd_warn(rbd_dev, "unable to tear down watch request\n"); | 4957 | if (tmp) |
4958 | rbd_warn(rbd_dev, "unable to tear down " | ||
4959 | "watch request (%d)\n", tmp); | ||
4960 | } | ||
4799 | out_header_name: | 4961 | out_header_name: |
4800 | kfree(rbd_dev->header_name); | 4962 | kfree(rbd_dev->header_name); |
4801 | rbd_dev->header_name = NULL; | 4963 | rbd_dev->header_name = NULL; |
@@ -4819,6 +4981,7 @@ static ssize_t rbd_add(struct bus_type *bus, | |||
4819 | struct rbd_spec *spec = NULL; | 4981 | struct rbd_spec *spec = NULL; |
4820 | struct rbd_client *rbdc; | 4982 | struct rbd_client *rbdc; |
4821 | struct ceph_osd_client *osdc; | 4983 | struct ceph_osd_client *osdc; |
4984 | bool read_only; | ||
4822 | int rc = -ENOMEM; | 4985 | int rc = -ENOMEM; |
4823 | 4986 | ||
4824 | if (!try_module_get(THIS_MODULE)) | 4987 | if (!try_module_get(THIS_MODULE)) |
@@ -4828,13 +4991,15 @@ static ssize_t rbd_add(struct bus_type *bus, | |||
4828 | rc = rbd_add_parse_args(buf, &ceph_opts, &rbd_opts, &spec); | 4991 | rc = rbd_add_parse_args(buf, &ceph_opts, &rbd_opts, &spec); |
4829 | if (rc < 0) | 4992 | if (rc < 0) |
4830 | goto err_out_module; | 4993 | goto err_out_module; |
4994 | read_only = rbd_opts->read_only; | ||
4995 | kfree(rbd_opts); | ||
4996 | rbd_opts = NULL; /* done with this */ | ||
4831 | 4997 | ||
4832 | rbdc = rbd_get_client(ceph_opts); | 4998 | rbdc = rbd_get_client(ceph_opts); |
4833 | if (IS_ERR(rbdc)) { | 4999 | if (IS_ERR(rbdc)) { |
4834 | rc = PTR_ERR(rbdc); | 5000 | rc = PTR_ERR(rbdc); |
4835 | goto err_out_args; | 5001 | goto err_out_args; |
4836 | } | 5002 | } |
4837 | ceph_opts = NULL; /* rbd_dev client now owns this */ | ||
4838 | 5003 | ||
4839 | /* pick the pool */ | 5004 | /* pick the pool */ |
4840 | osdc = &rbdc->client->osdc; | 5005 | osdc = &rbdc->client->osdc; |
@@ -4858,27 +5023,29 @@ static ssize_t rbd_add(struct bus_type *bus, | |||
4858 | rbdc = NULL; /* rbd_dev now owns this */ | 5023 | rbdc = NULL; /* rbd_dev now owns this */ |
4859 | spec = NULL; /* rbd_dev now owns this */ | 5024 | spec = NULL; /* rbd_dev now owns this */ |
4860 | 5025 | ||
4861 | rbd_dev->mapping.read_only = rbd_opts->read_only; | 5026 | rc = rbd_dev_image_probe(rbd_dev, true); |
4862 | kfree(rbd_opts); | ||
4863 | rbd_opts = NULL; /* done with this */ | ||
4864 | |||
4865 | rc = rbd_dev_image_probe(rbd_dev); | ||
4866 | if (rc < 0) | 5027 | if (rc < 0) |
4867 | goto err_out_rbd_dev; | 5028 | goto err_out_rbd_dev; |
4868 | 5029 | ||
5030 | /* If we are mapping a snapshot it must be marked read-only */ | ||
5031 | |||
5032 | if (rbd_dev->spec->snap_id != CEPH_NOSNAP) | ||
5033 | read_only = true; | ||
5034 | rbd_dev->mapping.read_only = read_only; | ||
5035 | |||
4869 | rc = rbd_dev_device_setup(rbd_dev); | 5036 | rc = rbd_dev_device_setup(rbd_dev); |
4870 | if (!rc) | 5037 | if (rc) { |
4871 | return count; | 5038 | rbd_dev_image_release(rbd_dev); |
5039 | goto err_out_module; | ||
5040 | } | ||
5041 | |||
5042 | return count; | ||
4872 | 5043 | ||
4873 | rbd_dev_image_release(rbd_dev); | ||
4874 | err_out_rbd_dev: | 5044 | err_out_rbd_dev: |
4875 | rbd_dev_destroy(rbd_dev); | 5045 | rbd_dev_destroy(rbd_dev); |
4876 | err_out_client: | 5046 | err_out_client: |
4877 | rbd_put_client(rbdc); | 5047 | rbd_put_client(rbdc); |
4878 | err_out_args: | 5048 | err_out_args: |
4879 | if (ceph_opts) | ||
4880 | ceph_destroy_options(ceph_opts); | ||
4881 | kfree(rbd_opts); | ||
4882 | rbd_spec_put(spec); | 5049 | rbd_spec_put(spec); |
4883 | err_out_module: | 5050 | err_out_module: |
4884 | module_put(THIS_MODULE); | 5051 | module_put(THIS_MODULE); |
@@ -4911,7 +5078,7 @@ static void rbd_dev_device_release(struct device *dev) | |||
4911 | 5078 | ||
4912 | rbd_free_disk(rbd_dev); | 5079 | rbd_free_disk(rbd_dev); |
4913 | clear_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); | 5080 | clear_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); |
4914 | rbd_dev_clear_mapping(rbd_dev); | 5081 | rbd_dev_mapping_clear(rbd_dev); |
4915 | unregister_blkdev(rbd_dev->major, rbd_dev->name); | 5082 | unregister_blkdev(rbd_dev->major, rbd_dev->name); |
4916 | rbd_dev->major = 0; | 5083 | rbd_dev->major = 0; |
4917 | rbd_dev_id_put(rbd_dev); | 5084 | rbd_dev_id_put(rbd_dev); |
@@ -4978,10 +5145,13 @@ static ssize_t rbd_remove(struct bus_type *bus, | |||
4978 | spin_unlock_irq(&rbd_dev->lock); | 5145 | spin_unlock_irq(&rbd_dev->lock); |
4979 | if (ret < 0) | 5146 | if (ret < 0) |
4980 | goto done; | 5147 | goto done; |
4981 | ret = count; | ||
4982 | rbd_bus_del_dev(rbd_dev); | 5148 | rbd_bus_del_dev(rbd_dev); |
5149 | ret = rbd_dev_header_watch_sync(rbd_dev, false); | ||
5150 | if (ret) | ||
5151 | rbd_warn(rbd_dev, "failed to cancel watch event (%d)\n", ret); | ||
4983 | rbd_dev_image_release(rbd_dev); | 5152 | rbd_dev_image_release(rbd_dev); |
4984 | module_put(THIS_MODULE); | 5153 | module_put(THIS_MODULE); |
5154 | ret = count; | ||
4985 | done: | 5155 | done: |
4986 | mutex_unlock(&ctl_mutex); | 5156 | mutex_unlock(&ctl_mutex); |
4987 | 5157 | ||
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index f8ef15f37c5e..3fd130fdfbc1 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -1160,8 +1160,7 @@ static int ace_probe(struct platform_device *dev) | |||
1160 | dev_dbg(&dev->dev, "ace_probe(%p)\n", dev); | 1160 | dev_dbg(&dev->dev, "ace_probe(%p)\n", dev); |
1161 | 1161 | ||
1162 | /* device id and bus width */ | 1162 | /* device id and bus width */ |
1163 | of_property_read_u32(dev->dev.of_node, "port-number", &id); | 1163 | if (of_property_read_u32(dev->dev.of_node, "port-number", &id)) |
1164 | if (id < 0) | ||
1165 | id = 0; | 1164 | id = 0; |
1166 | if (of_find_property(dev->dev.of_node, "8-bit", NULL)) | 1165 | if (of_find_property(dev->dev.of_node, "8-bit", NULL)) |
1167 | bus_width = ACE_BUS_WIDTH_8; | 1166 | bus_width = ACE_BUS_WIDTH_8; |
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index fdfd61a2d523..11a6104a1e4f 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig | |||
@@ -201,7 +201,7 @@ config BT_MRVL | |||
201 | The core driver to support Marvell Bluetooth devices. | 201 | The core driver to support Marvell Bluetooth devices. |
202 | 202 | ||
203 | This driver is required if you want to support | 203 | This driver is required if you want to support |
204 | Marvell Bluetooth devices, such as 8688/8787/8797. | 204 | Marvell Bluetooth devices, such as 8688/8787/8797/8897. |
205 | 205 | ||
206 | Say Y here to compile Marvell Bluetooth driver | 206 | Say Y here to compile Marvell Bluetooth driver |
207 | into the kernel or say M to compile it as module. | 207 | into the kernel or say M to compile it as module. |
@@ -214,7 +214,7 @@ config BT_MRVL_SDIO | |||
214 | The driver for Marvell Bluetooth chipsets with SDIO interface. | 214 | The driver for Marvell Bluetooth chipsets with SDIO interface. |
215 | 215 | ||
216 | This driver is required if you want to use Marvell Bluetooth | 216 | This driver is required if you want to use Marvell Bluetooth |
217 | devices with SDIO interface. Currently SD8688/SD8787/SD8797 | 217 | devices with SDIO interface. Currently SD8688/SD8787/SD8797/SD8897 |
218 | chipsets are supported. | 218 | chipsets are supported. |
219 | 219 | ||
220 | Say Y here to compile support for Marvell BT-over-SDIO driver | 220 | Say Y here to compile support for Marvell BT-over-SDIO driver |
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index c63488c54f4a..13693b7a0d5c 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c | |||
@@ -82,6 +82,23 @@ static const struct btmrvl_sdio_card_reg btmrvl_reg_87xx = { | |||
82 | .io_port_2 = 0x7a, | 82 | .io_port_2 = 0x7a, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static const struct btmrvl_sdio_card_reg btmrvl_reg_88xx = { | ||
86 | .cfg = 0x00, | ||
87 | .host_int_mask = 0x02, | ||
88 | .host_intstatus = 0x03, | ||
89 | .card_status = 0x50, | ||
90 | .sq_read_base_addr_a0 = 0x60, | ||
91 | .sq_read_base_addr_a1 = 0x61, | ||
92 | .card_revision = 0xbc, | ||
93 | .card_fw_status0 = 0xc0, | ||
94 | .card_fw_status1 = 0xc1, | ||
95 | .card_rx_len = 0xc2, | ||
96 | .card_rx_unit = 0xc3, | ||
97 | .io_port_0 = 0xd8, | ||
98 | .io_port_1 = 0xd9, | ||
99 | .io_port_2 = 0xda, | ||
100 | }; | ||
101 | |||
85 | static const struct btmrvl_sdio_device btmrvl_sdio_sd8688 = { | 102 | static const struct btmrvl_sdio_device btmrvl_sdio_sd8688 = { |
86 | .helper = "mrvl/sd8688_helper.bin", | 103 | .helper = "mrvl/sd8688_helper.bin", |
87 | .firmware = "mrvl/sd8688.bin", | 104 | .firmware = "mrvl/sd8688.bin", |
@@ -103,6 +120,13 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8797 = { | |||
103 | .sd_blksz_fw_dl = 256, | 120 | .sd_blksz_fw_dl = 256, |
104 | }; | 121 | }; |
105 | 122 | ||
123 | static const struct btmrvl_sdio_device btmrvl_sdio_sd8897 = { | ||
124 | .helper = NULL, | ||
125 | .firmware = "mrvl/sd8897_uapsta.bin", | ||
126 | .reg = &btmrvl_reg_88xx, | ||
127 | .sd_blksz_fw_dl = 256, | ||
128 | }; | ||
129 | |||
106 | static const struct sdio_device_id btmrvl_sdio_ids[] = { | 130 | static const struct sdio_device_id btmrvl_sdio_ids[] = { |
107 | /* Marvell SD8688 Bluetooth device */ | 131 | /* Marvell SD8688 Bluetooth device */ |
108 | { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, 0x9105), | 132 | { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, 0x9105), |
@@ -116,6 +140,9 @@ static const struct sdio_device_id btmrvl_sdio_ids[] = { | |||
116 | /* Marvell SD8797 Bluetooth device */ | 140 | /* Marvell SD8797 Bluetooth device */ |
117 | { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, 0x912A), | 141 | { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, 0x912A), |
118 | .driver_data = (unsigned long) &btmrvl_sdio_sd8797 }, | 142 | .driver_data = (unsigned long) &btmrvl_sdio_sd8797 }, |
143 | /* Marvell SD8897 Bluetooth device */ | ||
144 | { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, 0x912E), | ||
145 | .driver_data = (unsigned long) &btmrvl_sdio_sd8897 }, | ||
119 | 146 | ||
120 | { } /* Terminating entry */ | 147 | { } /* Terminating entry */ |
121 | }; | 148 | }; |
@@ -1194,3 +1221,4 @@ MODULE_FIRMWARE("mrvl/sd8688_helper.bin"); | |||
1194 | MODULE_FIRMWARE("mrvl/sd8688.bin"); | 1221 | MODULE_FIRMWARE("mrvl/sd8688.bin"); |
1195 | MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin"); | 1222 | MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin"); |
1196 | MODULE_FIRMWARE("mrvl/sd8797_uapsta.bin"); | 1223 | MODULE_FIRMWARE("mrvl/sd8797_uapsta.bin"); |
1224 | MODULE_FIRMWARE("mrvl/sd8897_uapsta.bin"); | ||
diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c index 4ca35e8a5d8c..19a12ac64a9e 100644 --- a/drivers/char/hw_random/mxc-rnga.c +++ b/drivers/char/hw_random/mxc-rnga.c | |||
@@ -167,11 +167,6 @@ static int __init mxc_rnga_probe(struct platform_device *pdev) | |||
167 | clk_prepare_enable(mxc_rng->clk); | 167 | clk_prepare_enable(mxc_rng->clk); |
168 | 168 | ||
169 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 169 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
170 | if (!res) { | ||
171 | err = -ENOENT; | ||
172 | goto err_region; | ||
173 | } | ||
174 | |||
175 | mxc_rng->mem = devm_ioremap_resource(&pdev->dev, res); | 170 | mxc_rng->mem = devm_ioremap_resource(&pdev->dev, res); |
176 | if (IS_ERR(mxc_rng->mem)) { | 171 | if (IS_ERR(mxc_rng->mem)) { |
177 | err = PTR_ERR(mxc_rng->mem); | 172 | err = PTR_ERR(mxc_rng->mem); |
@@ -189,7 +184,6 @@ static int __init mxc_rnga_probe(struct platform_device *pdev) | |||
189 | return 0; | 184 | return 0; |
190 | 185 | ||
191 | err_ioremap: | 186 | err_ioremap: |
192 | err_region: | ||
193 | clk_disable_unprepare(mxc_rng->clk); | 187 | clk_disable_unprepare(mxc_rng->clk); |
194 | 188 | ||
195 | out: | 189 | out: |
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index 749dc16ca2cc..d2903e772270 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c | |||
@@ -119,11 +119,6 @@ static int omap_rng_probe(struct platform_device *pdev) | |||
119 | dev_set_drvdata(&pdev->dev, priv); | 119 | dev_set_drvdata(&pdev->dev, priv); |
120 | 120 | ||
121 | priv->mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 121 | priv->mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
122 | if (!priv->mem_res) { | ||
123 | ret = -ENOENT; | ||
124 | goto err_ioremap; | ||
125 | } | ||
126 | |||
127 | priv->base = devm_ioremap_resource(&pdev->dev, priv->mem_res); | 122 | priv->base = devm_ioremap_resource(&pdev->dev, priv->mem_res); |
128 | if (IS_ERR(priv->base)) { | 123 | if (IS_ERR(priv->base)) { |
129 | ret = PTR_ERR(priv->base); | 124 | ret = PTR_ERR(priv->base); |
diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c index cdd4c09fda96..a22a7a502740 100644 --- a/drivers/char/ipmi/ipmi_bt_sm.c +++ b/drivers/char/ipmi/ipmi_bt_sm.c | |||
@@ -95,9 +95,9 @@ struct si_sm_data { | |||
95 | enum bt_states state; | 95 | enum bt_states state; |
96 | unsigned char seq; /* BT sequence number */ | 96 | unsigned char seq; /* BT sequence number */ |
97 | struct si_sm_io *io; | 97 | struct si_sm_io *io; |
98 | unsigned char write_data[IPMI_MAX_MSG_LENGTH]; | 98 | unsigned char write_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */ |
99 | int write_count; | 99 | int write_count; |
100 | unsigned char read_data[IPMI_MAX_MSG_LENGTH]; | 100 | unsigned char read_data[IPMI_MAX_MSG_LENGTH + 2]; /* +2 for memcpy */ |
101 | int read_count; | 101 | int read_count; |
102 | int truncated; | 102 | int truncated; |
103 | long timeout; /* microseconds countdown */ | 103 | long timeout; /* microseconds countdown */ |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index 9eb360ff8cab..d5a5f020810a 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -837,13 +837,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd, | |||
837 | return ipmi_ioctl(filep, cmd, arg); | 837 | return ipmi_ioctl(filep, cmd, arg); |
838 | } | 838 | } |
839 | } | 839 | } |
840 | |||
841 | static long unlocked_compat_ipmi_ioctl(struct file *filep, unsigned int cmd, | ||
842 | unsigned long arg) | ||
843 | { | ||
844 | int ret; | ||
845 | |||
846 | mutex_lock(&ipmi_mutex); | ||
847 | ret = compat_ipmi_ioctl(filep, cmd, arg); | ||
848 | mutex_unlock(&ipmi_mutex); | ||
849 | |||
850 | return ret; | ||
851 | } | ||
840 | #endif | 852 | #endif |
841 | 853 | ||
842 | static const struct file_operations ipmi_fops = { | 854 | static const struct file_operations ipmi_fops = { |
843 | .owner = THIS_MODULE, | 855 | .owner = THIS_MODULE, |
844 | .unlocked_ioctl = ipmi_unlocked_ioctl, | 856 | .unlocked_ioctl = ipmi_unlocked_ioctl, |
845 | #ifdef CONFIG_COMPAT | 857 | #ifdef CONFIG_COMPAT |
846 | .compat_ioctl = compat_ipmi_ioctl, | 858 | .compat_ioctl = unlocked_compat_ipmi_ioctl, |
847 | #endif | 859 | #endif |
848 | .open = ipmi_open, | 860 | .open = ipmi_open, |
849 | .release = ipmi_release, | 861 | .release = ipmi_release, |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 4d439d2fcfd6..4445fa164a2d 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -2037,12 +2037,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, | |||
2037 | entry = kmalloc(sizeof(*entry), GFP_KERNEL); | 2037 | entry = kmalloc(sizeof(*entry), GFP_KERNEL); |
2038 | if (!entry) | 2038 | if (!entry) |
2039 | return -ENOMEM; | 2039 | return -ENOMEM; |
2040 | entry->name = kmalloc(strlen(name)+1, GFP_KERNEL); | 2040 | entry->name = kstrdup(name, GFP_KERNEL); |
2041 | if (!entry->name) { | 2041 | if (!entry->name) { |
2042 | kfree(entry); | 2042 | kfree(entry); |
2043 | return -ENOMEM; | 2043 | return -ENOMEM; |
2044 | } | 2044 | } |
2045 | strcpy(entry->name, name); | ||
2046 | 2045 | ||
2047 | file = proc_create_data(name, 0, smi->proc_dir, proc_ops, data); | 2046 | file = proc_create_data(name, 0, smi->proc_dir, proc_ops, data); |
2048 | if (!file) { | 2047 | if (!file) { |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 313538abe63c..af4b23ffc5a6 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -663,8 +663,10 @@ static void handle_transaction_done(struct smi_info *smi_info) | |||
663 | /* We got the flags from the SMI, now handle them. */ | 663 | /* We got the flags from the SMI, now handle them. */ |
664 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); | 664 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); |
665 | if (msg[2] != 0) { | 665 | if (msg[2] != 0) { |
666 | dev_warn(smi_info->dev, "Could not enable interrupts" | 666 | dev_warn(smi_info->dev, |
667 | ", failed get, using polled mode.\n"); | 667 | "Couldn't get irq info: %x.\n", msg[2]); |
668 | dev_warn(smi_info->dev, | ||
669 | "Maybe ok, but ipmi might run very slowly.\n"); | ||
668 | smi_info->si_state = SI_NORMAL; | 670 | smi_info->si_state = SI_NORMAL; |
669 | } else { | 671 | } else { |
670 | msg[0] = (IPMI_NETFN_APP_REQUEST << 2); | 672 | msg[0] = (IPMI_NETFN_APP_REQUEST << 2); |
@@ -685,10 +687,12 @@ static void handle_transaction_done(struct smi_info *smi_info) | |||
685 | 687 | ||
686 | /* We got the flags from the SMI, now handle them. */ | 688 | /* We got the flags from the SMI, now handle them. */ |
687 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); | 689 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); |
688 | if (msg[2] != 0) | 690 | if (msg[2] != 0) { |
689 | dev_warn(smi_info->dev, "Could not enable interrupts" | 691 | dev_warn(smi_info->dev, |
690 | ", failed set, using polled mode.\n"); | 692 | "Couldn't set irq info: %x.\n", msg[2]); |
691 | else | 693 | dev_warn(smi_info->dev, |
694 | "Maybe ok, but ipmi might run very slowly.\n"); | ||
695 | } else | ||
692 | smi_info->interrupt_disabled = 0; | 696 | smi_info->interrupt_disabled = 0; |
693 | smi_info->si_state = SI_NORMAL; | 697 | smi_info->si_state = SI_NORMAL; |
694 | break; | 698 | break; |
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index dafd9ac6428f..0913d79424d3 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -622,9 +622,12 @@ static int lp_do_ioctl(unsigned int minor, unsigned int cmd, | |||
622 | return -EFAULT; | 622 | return -EFAULT; |
623 | break; | 623 | break; |
624 | case LPGETSTATUS: | 624 | case LPGETSTATUS: |
625 | if (mutex_lock_interruptible(&lp_table[minor].port_mutex)) | ||
626 | return -EINTR; | ||
625 | lp_claim_parport_or_block (&lp_table[minor]); | 627 | lp_claim_parport_or_block (&lp_table[minor]); |
626 | status = r_str(minor); | 628 | status = r_str(minor); |
627 | lp_release_parport (&lp_table[minor]); | 629 | lp_release_parport (&lp_table[minor]); |
630 | mutex_unlock(&lp_table[minor].port_mutex); | ||
628 | 631 | ||
629 | if (copy_to_user(argp, &status, sizeof(int))) | 632 | if (copy_to_user(argp, &status, sizeof(int))) |
630 | return -EFAULT; | 633 | return -EFAULT; |
diff --git a/drivers/char/random.c b/drivers/char/random.c index cd9a6211dcad..35487e8ded59 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -865,16 +865,24 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | |||
865 | if (r->entropy_count / 8 < min + reserved) { | 865 | if (r->entropy_count / 8 < min + reserved) { |
866 | nbytes = 0; | 866 | nbytes = 0; |
867 | } else { | 867 | } else { |
868 | int entropy_count, orig; | ||
869 | retry: | ||
870 | entropy_count = orig = ACCESS_ONCE(r->entropy_count); | ||
868 | /* If limited, never pull more than available */ | 871 | /* If limited, never pull more than available */ |
869 | if (r->limit && nbytes + reserved >= r->entropy_count / 8) | 872 | if (r->limit && nbytes + reserved >= entropy_count / 8) |
870 | nbytes = r->entropy_count/8 - reserved; | 873 | nbytes = entropy_count/8 - reserved; |
871 | 874 | ||
872 | if (r->entropy_count / 8 >= nbytes + reserved) | 875 | if (entropy_count / 8 >= nbytes + reserved) { |
873 | r->entropy_count -= nbytes*8; | 876 | entropy_count -= nbytes*8; |
874 | else | 877 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) |
875 | r->entropy_count = reserved; | 878 | goto retry; |
879 | } else { | ||
880 | entropy_count = reserved; | ||
881 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) | ||
882 | goto retry; | ||
883 | } | ||
876 | 884 | ||
877 | if (r->entropy_count < random_write_wakeup_thresh) | 885 | if (entropy_count < random_write_wakeup_thresh) |
878 | wakeup_write = 1; | 886 | wakeup_write = 1; |
879 | } | 887 | } |
880 | 888 | ||
@@ -957,10 +965,23 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf, | |||
957 | { | 965 | { |
958 | ssize_t ret = 0, i; | 966 | ssize_t ret = 0, i; |
959 | __u8 tmp[EXTRACT_SIZE]; | 967 | __u8 tmp[EXTRACT_SIZE]; |
968 | unsigned long flags; | ||
960 | 969 | ||
961 | /* if last_data isn't primed, we need EXTRACT_SIZE extra bytes */ | 970 | /* if last_data isn't primed, we need EXTRACT_SIZE extra bytes */ |
962 | if (fips_enabled && !r->last_data_init) | 971 | if (fips_enabled) { |
963 | nbytes += EXTRACT_SIZE; | 972 | spin_lock_irqsave(&r->lock, flags); |
973 | if (!r->last_data_init) { | ||
974 | r->last_data_init = true; | ||
975 | spin_unlock_irqrestore(&r->lock, flags); | ||
976 | trace_extract_entropy(r->name, EXTRACT_SIZE, | ||
977 | r->entropy_count, _RET_IP_); | ||
978 | xfer_secondary_pool(r, EXTRACT_SIZE); | ||
979 | extract_buf(r, tmp); | ||
980 | spin_lock_irqsave(&r->lock, flags); | ||
981 | memcpy(r->last_data, tmp, EXTRACT_SIZE); | ||
982 | } | ||
983 | spin_unlock_irqrestore(&r->lock, flags); | ||
984 | } | ||
964 | 985 | ||
965 | trace_extract_entropy(r->name, nbytes, r->entropy_count, _RET_IP_); | 986 | trace_extract_entropy(r->name, nbytes, r->entropy_count, _RET_IP_); |
966 | xfer_secondary_pool(r, nbytes); | 987 | xfer_secondary_pool(r, nbytes); |
@@ -970,19 +991,6 @@ static ssize_t extract_entropy(struct entropy_store *r, void *buf, | |||
970 | extract_buf(r, tmp); | 991 | extract_buf(r, tmp); |
971 | 992 | ||
972 | if (fips_enabled) { | 993 | if (fips_enabled) { |
973 | unsigned long flags; | ||
974 | |||
975 | |||
976 | /* prime last_data value if need be, per fips 140-2 */ | ||
977 | if (!r->last_data_init) { | ||
978 | spin_lock_irqsave(&r->lock, flags); | ||
979 | memcpy(r->last_data, tmp, EXTRACT_SIZE); | ||
980 | r->last_data_init = true; | ||
981 | nbytes -= EXTRACT_SIZE; | ||
982 | spin_unlock_irqrestore(&r->lock, flags); | ||
983 | extract_buf(r, tmp); | ||
984 | } | ||
985 | |||
986 | spin_lock_irqsave(&r->lock, flags); | 994 | spin_lock_irqsave(&r->lock, flags); |
987 | if (!memcmp(tmp, r->last_data, EXTRACT_SIZE)) | 995 | if (!memcmp(tmp, r->last_data, EXTRACT_SIZE)) |
988 | panic("Hardware RNG duplicated output!\n"); | 996 | panic("Hardware RNG duplicated output!\n"); |
diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c index 4945bd3d18d0..d5d2e4a985aa 100644 --- a/drivers/char/ttyprintk.c +++ b/drivers/char/ttyprintk.c | |||
@@ -179,7 +179,6 @@ static int __init ttyprintk_init(void) | |||
179 | { | 179 | { |
180 | int ret = -ENOMEM; | 180 | int ret = -ENOMEM; |
181 | 181 | ||
182 | tpk_port.port.ops = &null_ops; | ||
183 | mutex_init(&tpk_port.port_write_mutex); | 182 | mutex_init(&tpk_port.port_write_mutex); |
184 | 183 | ||
185 | ttyprintk_driver = tty_alloc_driver(1, | 184 | ttyprintk_driver = tty_alloc_driver(1, |
@@ -190,6 +189,7 @@ static int __init ttyprintk_init(void) | |||
190 | return PTR_ERR(ttyprintk_driver); | 189 | return PTR_ERR(ttyprintk_driver); |
191 | 190 | ||
192 | tty_port_init(&tpk_port.port); | 191 | tty_port_init(&tpk_port.port); |
192 | tpk_port.port.ops = &null_ops; | ||
193 | 193 | ||
194 | ttyprintk_driver->driver_name = "ttyprintk"; | 194 | ttyprintk_driver->driver_name = "ttyprintk"; |
195 | ttyprintk_driver->name = "ttyprintk"; | 195 | ttyprintk_driver->name = "ttyprintk"; |
diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c index 892728412e9d..24f553673b72 100644 --- a/drivers/clk/clk-si5351.c +++ b/drivers/clk/clk-si5351.c | |||
@@ -932,7 +932,7 @@ static unsigned long si5351_clkout_recalc_rate(struct clk_hw *hw, | |||
932 | unsigned char reg; | 932 | unsigned char reg; |
933 | unsigned char rdiv; | 933 | unsigned char rdiv; |
934 | 934 | ||
935 | if (hwdata->num > 5) | 935 | if (hwdata->num <= 5) |
936 | reg = si5351_msynth_params_address(hwdata->num) + 2; | 936 | reg = si5351_msynth_params_address(hwdata->num) + 2; |
937 | else | 937 | else |
938 | reg = SI5351_CLK6_7_OUTPUT_DIVIDER; | 938 | reg = SI5351_CLK6_7_OUTPUT_DIVIDER; |
@@ -1477,6 +1477,16 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1477 | return -EINVAL; | 1477 | return -EINVAL; |
1478 | } | 1478 | } |
1479 | drvdata->onecell.clks[n] = clk; | 1479 | drvdata->onecell.clks[n] = clk; |
1480 | |||
1481 | /* set initial clkout rate */ | ||
1482 | if (pdata->clkout[n].rate != 0) { | ||
1483 | int ret; | ||
1484 | ret = clk_set_rate(clk, pdata->clkout[n].rate); | ||
1485 | if (ret != 0) { | ||
1486 | dev_err(&client->dev, "Cannot set rate : %d\n", | ||
1487 | ret); | ||
1488 | } | ||
1489 | } | ||
1480 | } | 1490 | } |
1481 | 1491 | ||
1482 | ret = of_clk_add_provider(client->dev.of_node, of_clk_src_onecell_get, | 1492 | ret = of_clk_add_provider(client->dev.of_node, of_clk_src_onecell_get, |
diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index debf688afa8e..553ac35bcc91 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c | |||
@@ -183,7 +183,7 @@ static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate, | |||
183 | writel(divisor, cdev->div_reg); | 183 | writel(divisor, cdev->div_reg); |
184 | vt8500_pmc_wait_busy(); | 184 | vt8500_pmc_wait_busy(); |
185 | 185 | ||
186 | spin_lock_irqsave(cdev->lock, flags); | 186 | spin_unlock_irqrestore(cdev->lock, flags); |
187 | 187 | ||
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 934cfd18f72d..1144e8c7579d 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1955,6 +1955,7 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) | |||
1955 | /* XXX the notifier code should handle this better */ | 1955 | /* XXX the notifier code should handle this better */ |
1956 | if (!cn->notifier_head.head) { | 1956 | if (!cn->notifier_head.head) { |
1957 | srcu_cleanup_notifier_head(&cn->notifier_head); | 1957 | srcu_cleanup_notifier_head(&cn->notifier_head); |
1958 | list_del(&cn->node); | ||
1958 | kfree(cn); | 1959 | kfree(cn); |
1959 | } | 1960 | } |
1960 | 1961 | ||
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c index d0e5eed146de..4faf0afc44cd 100644 --- a/drivers/clk/mxs/clk-imx28.c +++ b/drivers/clk/mxs/clk-imx28.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/clk.h> | 12 | #include <linux/clk.h> |
13 | #include <linux/clk/mxs.h> | ||
13 | #include <linux/clkdev.h> | 14 | #include <linux/clkdev.h> |
14 | #include <linux/err.h> | 15 | #include <linux/err.h> |
15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c index d0940e69d034..3c1f88868f29 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c | |||
@@ -791,7 +791,8 @@ struct samsung_gate_clock exynos4210_gate_clks[] __initdata = { | |||
791 | GATE(smmu_pcie, "smmu_pcie", "aclk133", GATE_IP_FSYS, 18, 0, 0), | 791 | GATE(smmu_pcie, "smmu_pcie", "aclk133", GATE_IP_FSYS, 18, 0, 0), |
792 | GATE(modemif, "modemif", "aclk100", GATE_IP_PERIL, 28, 0, 0), | 792 | GATE(modemif, "modemif", "aclk100", GATE_IP_PERIL, 28, 0, 0), |
793 | GATE(chipid, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0), | 793 | GATE(chipid, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0), |
794 | GATE(sysreg, "sysreg", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0), | 794 | GATE(sysreg, "sysreg", "aclk100", E4210_GATE_IP_PERIR, 0, |
795 | CLK_IGNORE_UNUSED, 0), | ||
795 | GATE(hdmi_cec, "hdmi_cec", "aclk100", E4210_GATE_IP_PERIR, 11, 0, 0), | 796 | GATE(hdmi_cec, "hdmi_cec", "aclk100", E4210_GATE_IP_PERIR, 11, 0, 0), |
796 | GATE(smmu_rotator, "smmu_rotator", "aclk200", | 797 | GATE(smmu_rotator, "smmu_rotator", "aclk200", |
797 | E4210_GATE_IP_IMAGE, 4, 0, 0), | 798 | E4210_GATE_IP_IMAGE, 4, 0, 0), |
@@ -819,7 +820,8 @@ struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = { | |||
819 | GATE(smmu_mdma, "smmu_mdma", "aclk200", E4X12_GATE_IP_IMAGE, 5, 0, 0), | 820 | GATE(smmu_mdma, "smmu_mdma", "aclk200", E4X12_GATE_IP_IMAGE, 5, 0, 0), |
820 | GATE(mipi_hsi, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0), | 821 | GATE(mipi_hsi, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0), |
821 | GATE(chipid, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0), | 822 | GATE(chipid, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0), |
822 | GATE(sysreg, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1, 0, 0), | 823 | GATE(sysreg, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1, |
824 | CLK_IGNORE_UNUSED, 0), | ||
823 | GATE(hdmi_cec, "hdmi_cec", "aclk100", E4X12_GATE_IP_PERIR, 11, 0, 0), | 825 | GATE(hdmi_cec, "hdmi_cec", "aclk100", E4X12_GATE_IP_PERIR, 11, 0, 0), |
824 | GATE(sclk_mdnie0, "sclk_mdnie0", "div_mdnie0", | 826 | GATE(sclk_mdnie0, "sclk_mdnie0", "div_mdnie0", |
825 | SRC_MASK_LCD0, 4, CLK_SET_RATE_PARENT, 0), | 827 | SRC_MASK_LCD0, 4, CLK_SET_RATE_PARENT, 0), |
diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index 5c97e75924a8..22d7699e7ced 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c | |||
@@ -155,7 +155,7 @@ static __initdata unsigned long exynos5250_clk_regs[] = { | |||
155 | 155 | ||
156 | /* list of all parent clock list */ | 156 | /* list of all parent clock list */ |
157 | PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; | 157 | PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; |
158 | PNAME(mout_cpu_p) = { "mout_apll", "mout_mpll", }; | 158 | PNAME(mout_cpu_p) = { "mout_apll", "sclk_mpll", }; |
159 | PNAME(mout_mpll_fout_p) = { "fout_mplldiv2", "fout_mpll" }; | 159 | PNAME(mout_mpll_fout_p) = { "fout_mplldiv2", "fout_mpll" }; |
160 | PNAME(mout_mpll_p) = { "fin_pll", "mout_mpll_fout" }; | 160 | PNAME(mout_mpll_p) = { "fin_pll", "mout_mpll_fout" }; |
161 | PNAME(mout_bpll_fout_p) = { "fout_bplldiv2", "fout_bpll" }; | 161 | PNAME(mout_bpll_fout_p) = { "fout_bplldiv2", "fout_bpll" }; |
@@ -208,10 +208,10 @@ struct samsung_fixed_factor_clock exynos5250_fixed_factor_clks[] __initdata = { | |||
208 | }; | 208 | }; |
209 | 209 | ||
210 | struct samsung_mux_clock exynos5250_mux_clks[] __initdata = { | 210 | struct samsung_mux_clock exynos5250_mux_clks[] __initdata = { |
211 | MUX(none, "mout_apll", mout_apll_p, SRC_CPU, 0, 1), | 211 | MUX_A(none, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, "mout_apll"), |
212 | MUX(none, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1), | 212 | MUX_A(none, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1, "mout_cpu"), |
213 | MUX(none, "mout_mpll_fout", mout_mpll_fout_p, PLL_DIV2_SEL, 4, 1), | 213 | MUX(none, "mout_mpll_fout", mout_mpll_fout_p, PLL_DIV2_SEL, 4, 1), |
214 | MUX(none, "sclk_mpll", mout_mpll_p, SRC_CORE1, 8, 1), | 214 | MUX_A(none, "sclk_mpll", mout_mpll_p, SRC_CORE1, 8, 1, "mout_mpll"), |
215 | MUX(none, "mout_bpll_fout", mout_bpll_fout_p, PLL_DIV2_SEL, 0, 1), | 215 | MUX(none, "mout_bpll_fout", mout_bpll_fout_p, PLL_DIV2_SEL, 0, 1), |
216 | MUX(none, "sclk_bpll", mout_bpll_p, SRC_CDREX, 0, 1), | 216 | MUX(none, "sclk_bpll", mout_bpll_p, SRC_CDREX, 0, 1), |
217 | MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1), | 217 | MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1), |
@@ -378,7 +378,7 @@ struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { | |||
378 | GATE(hsi2c3, "hsi2c3", "aclk66", GATE_IP_PERIC, 31, 0, 0), | 378 | GATE(hsi2c3, "hsi2c3", "aclk66", GATE_IP_PERIC, 31, 0, 0), |
379 | GATE(chipid, "chipid", "aclk66", GATE_IP_PERIS, 0, 0, 0), | 379 | GATE(chipid, "chipid", "aclk66", GATE_IP_PERIS, 0, 0, 0), |
380 | GATE(sysreg, "sysreg", "aclk66", GATE_IP_PERIS, 1, 0, 0), | 380 | GATE(sysreg, "sysreg", "aclk66", GATE_IP_PERIS, 1, 0, 0), |
381 | GATE(pmu, "pmu", "aclk66", GATE_IP_PERIS, 2, 0, 0), | 381 | GATE(pmu, "pmu", "aclk66", GATE_IP_PERIS, 2, CLK_IGNORE_UNUSED, 0), |
382 | GATE(tzpc0, "tzpc0", "aclk66", GATE_IP_PERIS, 6, 0, 0), | 382 | GATE(tzpc0, "tzpc0", "aclk66", GATE_IP_PERIS, 6, 0, 0), |
383 | GATE(tzpc1, "tzpc1", "aclk66", GATE_IP_PERIS, 7, 0, 0), | 383 | GATE(tzpc1, "tzpc1", "aclk66", GATE_IP_PERIS, 7, 0, 0), |
384 | GATE(tzpc2, "tzpc2", "aclk66", GATE_IP_PERIS, 8, 0, 0), | 384 | GATE(tzpc2, "tzpc2", "aclk66", GATE_IP_PERIS, 8, 0, 0), |
diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c index 89135f6be116..362f12dcd944 100644 --- a/drivers/clk/samsung/clk-pll.c +++ b/drivers/clk/samsung/clk-pll.c | |||
@@ -111,7 +111,8 @@ static unsigned long samsung_pll36xx_recalc_rate(struct clk_hw *hw, | |||
111 | unsigned long parent_rate) | 111 | unsigned long parent_rate) |
112 | { | 112 | { |
113 | struct samsung_clk_pll36xx *pll = to_clk_pll36xx(hw); | 113 | struct samsung_clk_pll36xx *pll = to_clk_pll36xx(hw); |
114 | u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1; | 114 | u32 mdiv, pdiv, sdiv, pll_con0, pll_con1; |
115 | s16 kdiv; | ||
115 | u64 fvco = parent_rate; | 116 | u64 fvco = parent_rate; |
116 | 117 | ||
117 | pll_con0 = __raw_readl(pll->con_reg); | 118 | pll_con0 = __raw_readl(pll->con_reg); |
@@ -119,7 +120,7 @@ static unsigned long samsung_pll36xx_recalc_rate(struct clk_hw *hw, | |||
119 | mdiv = (pll_con0 >> PLL36XX_MDIV_SHIFT) & PLL36XX_MDIV_MASK; | 120 | mdiv = (pll_con0 >> PLL36XX_MDIV_SHIFT) & PLL36XX_MDIV_MASK; |
120 | pdiv = (pll_con0 >> PLL36XX_PDIV_SHIFT) & PLL36XX_PDIV_MASK; | 121 | pdiv = (pll_con0 >> PLL36XX_PDIV_SHIFT) & PLL36XX_PDIV_MASK; |
121 | sdiv = (pll_con0 >> PLL36XX_SDIV_SHIFT) & PLL36XX_SDIV_MASK; | 122 | sdiv = (pll_con0 >> PLL36XX_SDIV_SHIFT) & PLL36XX_SDIV_MASK; |
122 | kdiv = pll_con1 & PLL36XX_KDIV_MASK; | 123 | kdiv = (s16)(pll_con1 & PLL36XX_KDIV_MASK); |
123 | 124 | ||
124 | fvco *= (mdiv << 16) + kdiv; | 125 | fvco *= (mdiv << 16) + kdiv; |
125 | do_div(fvco, (pdiv << sdiv)); | 126 | do_div(fvco, (pdiv << sdiv)); |
diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c index f9ec43fd1320..080c3c5e33f6 100644 --- a/drivers/clk/spear/spear3xx_clock.c +++ b/drivers/clk/spear/spear3xx_clock.c | |||
@@ -369,7 +369,7 @@ static void __init spear320_clk_init(void __iomem *soc_config_base) | |||
369 | clk_register_clkdev(clk, NULL, "60100000.serial"); | 369 | clk_register_clkdev(clk, NULL, "60100000.serial"); |
370 | } | 370 | } |
371 | #else | 371 | #else |
372 | static inline void spear320_clk_init(void) { } | 372 | static inline void spear320_clk_init(void __iomem *soc_config_base) { } |
373 | #endif | 373 | #endif |
374 | 374 | ||
375 | void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_base) | 375 | void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_base) |
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c index 8292a00c3de9..075db0c99edb 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c | |||
@@ -872,6 +872,14 @@ static void __init tegra20_periph_clk_init(void) | |||
872 | struct clk *clk; | 872 | struct clk *clk; |
873 | int i; | 873 | int i; |
874 | 874 | ||
875 | /* ac97 */ | ||
876 | clk = tegra_clk_register_periph_gate("ac97", "pll_a_out0", | ||
877 | TEGRA_PERIPH_ON_APB, | ||
878 | clk_base, 0, 3, &periph_l_regs, | ||
879 | periph_clk_enb_refcnt); | ||
880 | clk_register_clkdev(clk, NULL, "tegra20-ac97"); | ||
881 | clks[ac97] = clk; | ||
882 | |||
875 | /* apbdma */ | 883 | /* apbdma */ |
876 | clk = tegra_clk_register_periph_gate("apbdma", "pclk", 0, clk_base, | 884 | clk = tegra_clk_register_periph_gate("apbdma", "pclk", 0, clk_base, |
877 | 0, 34, &periph_h_regs, | 885 | 0, 34, &periph_h_regs, |
@@ -1234,9 +1242,6 @@ static __initdata struct tegra_clk_init_table init_table[] = { | |||
1234 | {uartc, pll_p, 0, 0}, | 1242 | {uartc, pll_p, 0, 0}, |
1235 | {uartd, pll_p, 0, 0}, | 1243 | {uartd, pll_p, 0, 0}, |
1236 | {uarte, pll_p, 0, 0}, | 1244 | {uarte, pll_p, 0, 0}, |
1237 | {usbd, clk_max, 12000000, 0}, | ||
1238 | {usb2, clk_max, 12000000, 0}, | ||
1239 | {usb3, clk_max, 12000000, 0}, | ||
1240 | {pll_a, clk_max, 56448000, 1}, | 1245 | {pll_a, clk_max, 56448000, 1}, |
1241 | {pll_a_out0, clk_max, 11289600, 1}, | 1246 | {pll_a_out0, clk_max, 11289600, 1}, |
1242 | {cdev1, clk_max, 0, 1}, | 1247 | {cdev1, clk_max, 0, 1}, |
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c index c6921f538e28..ba99e3844106 100644 --- a/drivers/clk/tegra/clk-tegra30.c +++ b/drivers/clk/tegra/clk-tegra30.c | |||
@@ -1598,6 +1598,12 @@ static void __init tegra30_periph_clk_init(void) | |||
1598 | clk_register_clkdev(clk, "afi", "tegra-pcie"); | 1598 | clk_register_clkdev(clk, "afi", "tegra-pcie"); |
1599 | clks[afi] = clk; | 1599 | clks[afi] = clk; |
1600 | 1600 | ||
1601 | /* pciex */ | ||
1602 | clk = tegra_clk_register_periph_gate("pciex", "pll_e", 0, clk_base, 0, | ||
1603 | 74, &periph_u_regs, periph_clk_enb_refcnt); | ||
1604 | clk_register_clkdev(clk, "pciex", "tegra-pcie"); | ||
1605 | clks[pciex] = clk; | ||
1606 | |||
1601 | /* kfuse */ | 1607 | /* kfuse */ |
1602 | clk = tegra_clk_register_periph_gate("kfuse", "clk_m", | 1608 | clk = tegra_clk_register_periph_gate("kfuse", "clk_m", |
1603 | TEGRA_PERIPH_ON_APB, | 1609 | TEGRA_PERIPH_ON_APB, |
@@ -1716,11 +1722,6 @@ static void __init tegra30_fixed_clk_init(void) | |||
1716 | 1, 0, &cml_lock); | 1722 | 1, 0, &cml_lock); |
1717 | clk_register_clkdev(clk, "cml1", NULL); | 1723 | clk_register_clkdev(clk, "cml1", NULL); |
1718 | clks[cml1] = clk; | 1724 | clks[cml1] = clk; |
1719 | |||
1720 | /* pciex */ | ||
1721 | clk = clk_register_fixed_rate(NULL, "pciex", "pll_e", 0, 100000000); | ||
1722 | clk_register_clkdev(clk, "pciex", NULL); | ||
1723 | clks[pciex] = clk; | ||
1724 | } | 1725 | } |
1725 | 1726 | ||
1726 | static void __init tegra30_osc_clk_init(void) | 1727 | static void __init tegra30_osc_clk_init(void) |
diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c index bc7e9bde792b..e364c9d4aa60 100644 --- a/drivers/clk/ux500/clk-sysctrl.c +++ b/drivers/clk/ux500/clk-sysctrl.c | |||
@@ -145,7 +145,13 @@ static struct clk *clk_reg_sysctrl(struct device *dev, | |||
145 | return ERR_PTR(-ENOMEM); | 145 | return ERR_PTR(-ENOMEM); |
146 | } | 146 | } |
147 | 147 | ||
148 | for (i = 0; i < num_parents; i++) { | 148 | /* set main clock registers */ |
149 | clk->reg_sel[0] = reg_sel[0]; | ||
150 | clk->reg_bits[0] = reg_bits[0]; | ||
151 | clk->reg_mask[0] = reg_mask[0]; | ||
152 | |||
153 | /* handle clocks with more than one parent */ | ||
154 | for (i = 1; i < num_parents; i++) { | ||
149 | clk->reg_sel[i] = reg_sel[i]; | 155 | clk->reg_sel[i] = reg_sel[i]; |
150 | clk->reg_bits[i] = reg_bits[i]; | 156 | clk->reg_bits[i] = reg_bits[i]; |
151 | clk->reg_mask[i] = reg_mask[i]; | 157 | clk->reg_mask[i] = reg_mask[i]; |
diff --git a/drivers/clk/ux500/u8500_clk.c b/drivers/clk/ux500/u8500_clk.c index 0b4f35a5ffc2..80069c370a47 100644 --- a/drivers/clk/ux500/u8500_clk.c +++ b/drivers/clk/ux500/u8500_clk.c | |||
@@ -325,7 +325,7 @@ void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, | |||
325 | clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", clkrst3_base, | 325 | clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", clkrst3_base, |
326 | BIT(0), 0); | 326 | BIT(0), 0); |
327 | clk_register_clkdev(clk, "fsmc", NULL); | 327 | clk_register_clkdev(clk, "fsmc", NULL); |
328 | clk_register_clkdev(clk, NULL, "smsc911x"); | 328 | clk_register_clkdev(clk, NULL, "smsc911x.0"); |
329 | 329 | ||
330 | clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", clkrst3_base, | 330 | clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", clkrst3_base, |
331 | BIT(1), 0); | 331 | BIT(1), 0); |
diff --git a/drivers/clk/x86/clk-lpt.c b/drivers/clk/x86/clk-lpt.c index 5cf4f4686406..4f45eee9e33b 100644 --- a/drivers/clk/x86/clk-lpt.c +++ b/drivers/clk/x86/clk-lpt.c | |||
@@ -15,22 +15,29 @@ | |||
15 | #include <linux/clk-provider.h> | 15 | #include <linux/clk-provider.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/platform_data/clk-lpss.h> | ||
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | 20 | ||
20 | #define PRV_CLOCK_PARAMS 0x800 | 21 | #define PRV_CLOCK_PARAMS 0x800 |
21 | 22 | ||
22 | static int lpt_clk_probe(struct platform_device *pdev) | 23 | static int lpt_clk_probe(struct platform_device *pdev) |
23 | { | 24 | { |
25 | struct lpss_clk_data *drvdata; | ||
24 | struct clk *clk; | 26 | struct clk *clk; |
25 | 27 | ||
28 | drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); | ||
29 | if (!drvdata) | ||
30 | return -ENOMEM; | ||
31 | |||
26 | /* LPSS free running clock */ | 32 | /* LPSS free running clock */ |
27 | clk = clk_register_fixed_rate(&pdev->dev, "lpss_clk", NULL, CLK_IS_ROOT, | 33 | drvdata->name = "lpss_clk"; |
28 | 100000000); | 34 | clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL, |
35 | CLK_IS_ROOT, 100000000); | ||
29 | if (IS_ERR(clk)) | 36 | if (IS_ERR(clk)) |
30 | return PTR_ERR(clk); | 37 | return PTR_ERR(clk); |
31 | 38 | ||
32 | /* Shared DMA clock */ | 39 | drvdata->clk = clk; |
33 | clk_register_clkdev(clk, "hclk", "INTL9C60.0.auto"); | 40 | platform_set_drvdata(pdev, drvdata); |
34 | return 0; | 41 | return 0; |
35 | } | 42 | } |
36 | 43 | ||
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index a1488f58f6ca..534fcb825153 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig | |||
@@ -47,7 +47,7 @@ config CPU_FREQ_STAT_DETAILS | |||
47 | 47 | ||
48 | choice | 48 | choice |
49 | prompt "Default CPUFreq governor" | 49 | prompt "Default CPUFreq governor" |
50 | default CPU_FREQ_DEFAULT_GOV_USERSPACE if CPU_FREQ_SA1100 || CPU_FREQ_SA1110 | 50 | default CPU_FREQ_DEFAULT_GOV_USERSPACE if ARM_SA1100_CPUFREQ || ARM_SA1110_CPUFREQ |
51 | default CPU_FREQ_DEFAULT_GOV_PERFORMANCE | 51 | default CPU_FREQ_DEFAULT_GOV_PERFORMANCE |
52 | help | 52 | help |
53 | This option sets which CPUFreq governor shall be loaded at | 53 | This option sets which CPUFreq governor shall be loaded at |
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index f3af18b9acc5..6e57543fe0b9 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
@@ -3,16 +3,17 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | config ARM_BIG_LITTLE_CPUFREQ | 5 | config ARM_BIG_LITTLE_CPUFREQ |
6 | tristate | 6 | tristate "Generic ARM big LITTLE CPUfreq driver" |
7 | depends on ARM_CPU_TOPOLOGY | 7 | depends on ARM_CPU_TOPOLOGY && PM_OPP && HAVE_CLK |
8 | help | ||
9 | This enables the Generic CPUfreq driver for ARM big.LITTLE platforms. | ||
8 | 10 | ||
9 | config ARM_DT_BL_CPUFREQ | 11 | config ARM_DT_BL_CPUFREQ |
10 | tristate "Generic ARM big LITTLE CPUfreq driver probed via DT" | 12 | tristate "Generic probing via DT for ARM big LITTLE CPUfreq driver" |
11 | select ARM_BIG_LITTLE_CPUFREQ | 13 | depends on ARM_BIG_LITTLE_CPUFREQ && OF |
12 | depends on OF && HAVE_CLK | ||
13 | help | 14 | help |
14 | This enables the Generic CPUfreq driver for ARM big.LITTLE platform. | 15 | This enables probing via DT for Generic CPUfreq driver for ARM |
15 | This gets frequency tables from DT. | 16 | big.LITTLE platform. This gets frequency tables from DT. |
16 | 17 | ||
17 | config ARM_EXYNOS_CPUFREQ | 18 | config ARM_EXYNOS_CPUFREQ |
18 | bool "SAMSUNG EXYNOS SoCs" | 19 | bool "SAMSUNG EXYNOS SoCs" |
diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86 index 2b8a8c374548..6bd63d63d356 100644 --- a/drivers/cpufreq/Kconfig.x86 +++ b/drivers/cpufreq/Kconfig.x86 | |||
@@ -272,7 +272,7 @@ config X86_LONGHAUL | |||
272 | config X86_E_POWERSAVER | 272 | config X86_E_POWERSAVER |
273 | tristate "VIA C7 Enhanced PowerSaver (DANGEROUS)" | 273 | tristate "VIA C7 Enhanced PowerSaver (DANGEROUS)" |
274 | select CPU_FREQ_TABLE | 274 | select CPU_FREQ_TABLE |
275 | depends on X86_32 | 275 | depends on X86_32 && ACPI_PROCESSOR |
276 | help | 276 | help |
277 | This adds the CPUFreq driver for VIA C7 processors. However, this driver | 277 | This adds the CPUFreq driver for VIA C7 processors. However, this driver |
278 | does not have any safeguards to prevent operating the CPU out of spec | 278 | does not have any safeguards to prevent operating the CPU out of spec |
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 11b8b4b54ceb..edc089e9d0c4 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c | |||
@@ -347,11 +347,11 @@ static u32 get_cur_val(const struct cpumask *mask) | |||
347 | switch (per_cpu(acfreq_data, cpumask_first(mask))->cpu_feature) { | 347 | switch (per_cpu(acfreq_data, cpumask_first(mask))->cpu_feature) { |
348 | case SYSTEM_INTEL_MSR_CAPABLE: | 348 | case SYSTEM_INTEL_MSR_CAPABLE: |
349 | cmd.type = SYSTEM_INTEL_MSR_CAPABLE; | 349 | cmd.type = SYSTEM_INTEL_MSR_CAPABLE; |
350 | cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; | 350 | cmd.addr.msr.reg = MSR_IA32_PERF_CTL; |
351 | break; | 351 | break; |
352 | case SYSTEM_AMD_MSR_CAPABLE: | 352 | case SYSTEM_AMD_MSR_CAPABLE: |
353 | cmd.type = SYSTEM_AMD_MSR_CAPABLE; | 353 | cmd.type = SYSTEM_AMD_MSR_CAPABLE; |
354 | cmd.addr.msr.reg = MSR_AMD_PERF_STATUS; | 354 | cmd.addr.msr.reg = MSR_AMD_PERF_CTL; |
355 | break; | 355 | break; |
356 | case SYSTEM_IO_CAPABLE: | 356 | case SYSTEM_IO_CAPABLE: |
357 | cmd.type = SYSTEM_IO_CAPABLE; | 357 | cmd.type = SYSTEM_IO_CAPABLE; |
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index dbdf677d2f36..5d7f53fcd6f5 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c | |||
@@ -40,11 +40,6 @@ static struct clk *clk[MAX_CLUSTERS]; | |||
40 | static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS]; | 40 | static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS]; |
41 | static atomic_t cluster_usage[MAX_CLUSTERS] = {ATOMIC_INIT(0), ATOMIC_INIT(0)}; | 41 | static atomic_t cluster_usage[MAX_CLUSTERS] = {ATOMIC_INIT(0), ATOMIC_INIT(0)}; |
42 | 42 | ||
43 | static int cpu_to_cluster(int cpu) | ||
44 | { | ||
45 | return topology_physical_package_id(cpu); | ||
46 | } | ||
47 | |||
48 | static unsigned int bL_cpufreq_get(unsigned int cpu) | 43 | static unsigned int bL_cpufreq_get(unsigned int cpu) |
49 | { | 44 | { |
50 | u32 cur_cluster = cpu_to_cluster(cpu); | 45 | u32 cur_cluster = cpu_to_cluster(cpu); |
@@ -192,7 +187,7 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy) | |||
192 | 187 | ||
193 | cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu)); | 188 | cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu)); |
194 | 189 | ||
195 | dev_info(cpu_dev, "CPU %d initialized\n", policy->cpu); | 190 | dev_info(cpu_dev, "%s: CPU %d initialized\n", __func__, policy->cpu); |
196 | return 0; | 191 | return 0; |
197 | } | 192 | } |
198 | 193 | ||
diff --git a/drivers/cpufreq/arm_big_little.h b/drivers/cpufreq/arm_big_little.h index 70f18fc12d4a..79b2ce17884d 100644 --- a/drivers/cpufreq/arm_big_little.h +++ b/drivers/cpufreq/arm_big_little.h | |||
@@ -34,6 +34,11 @@ struct cpufreq_arm_bL_ops { | |||
34 | int (*init_opp_table)(struct device *cpu_dev); | 34 | int (*init_opp_table)(struct device *cpu_dev); |
35 | }; | 35 | }; |
36 | 36 | ||
37 | static inline int cpu_to_cluster(int cpu) | ||
38 | { | ||
39 | return topology_physical_package_id(cpu); | ||
40 | } | ||
41 | |||
37 | int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops); | 42 | int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops); |
38 | void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops); | 43 | void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops); |
39 | 44 | ||
diff --git a/drivers/cpufreq/arm_big_little_dt.c b/drivers/cpufreq/arm_big_little_dt.c index 44be3115375c..fd9e3ea6a480 100644 --- a/drivers/cpufreq/arm_big_little_dt.c +++ b/drivers/cpufreq/arm_big_little_dt.c | |||
@@ -19,69 +19,75 @@ | |||
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
21 | 21 | ||
22 | #include <linux/cpu.h> | ||
22 | #include <linux/cpufreq.h> | 23 | #include <linux/cpufreq.h> |
23 | #include <linux/device.h> | 24 | #include <linux/device.h> |
24 | #include <linux/export.h> | 25 | #include <linux/export.h> |
25 | #include <linux/module.h> | 26 | #include <linux/module.h> |
26 | #include <linux/of.h> | 27 | #include <linux/of.h> |
27 | #include <linux/opp.h> | 28 | #include <linux/opp.h> |
29 | #include <linux/platform_device.h> | ||
28 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
29 | #include <linux/types.h> | 31 | #include <linux/types.h> |
30 | #include "arm_big_little.h" | 32 | #include "arm_big_little.h" |
31 | 33 | ||
32 | static int dt_init_opp_table(struct device *cpu_dev) | 34 | /* get cpu node with valid operating-points */ |
35 | static struct device_node *get_cpu_node_with_valid_op(int cpu) | ||
33 | { | 36 | { |
34 | struct device_node *np, *parent; | 37 | struct device_node *np = NULL, *parent; |
35 | int count = 0, ret; | 38 | int count = 0; |
36 | 39 | ||
37 | parent = of_find_node_by_path("/cpus"); | 40 | parent = of_find_node_by_path("/cpus"); |
38 | if (!parent) { | 41 | if (!parent) { |
39 | pr_err("failed to find OF /cpus\n"); | 42 | pr_err("failed to find OF /cpus\n"); |
40 | return -ENOENT; | 43 | return NULL; |
41 | } | 44 | } |
42 | 45 | ||
43 | for_each_child_of_node(parent, np) { | 46 | for_each_child_of_node(parent, np) { |
44 | if (count++ != cpu_dev->id) | 47 | if (count++ != cpu) |
45 | continue; | 48 | continue; |
46 | if (!of_get_property(np, "operating-points", NULL)) { | 49 | if (!of_get_property(np, "operating-points", NULL)) { |
47 | ret = -ENODATA; | 50 | of_node_put(np); |
48 | } else { | 51 | np = NULL; |
49 | cpu_dev->of_node = np; | ||
50 | ret = of_init_opp_table(cpu_dev); | ||
51 | } | 52 | } |
52 | of_node_put(np); | ||
53 | of_node_put(parent); | ||
54 | 53 | ||
55 | return ret; | 54 | break; |
56 | } | 55 | } |
57 | 56 | ||
58 | return -ENODEV; | 57 | of_node_put(parent); |
58 | return np; | ||
59 | } | 59 | } |
60 | 60 | ||
61 | static int dt_get_transition_latency(struct device *cpu_dev) | 61 | static int dt_init_opp_table(struct device *cpu_dev) |
62 | { | 62 | { |
63 | struct device_node *np, *parent; | 63 | struct device_node *np; |
64 | u32 transition_latency = CPUFREQ_ETERNAL; | 64 | int ret; |
65 | int count = 0; | ||
66 | 65 | ||
67 | parent = of_find_node_by_path("/cpus"); | 66 | np = get_cpu_node_with_valid_op(cpu_dev->id); |
68 | if (!parent) { | 67 | if (!np) |
69 | pr_err("failed to find OF /cpus\n"); | 68 | return -ENODATA; |
70 | return -ENOENT; | ||
71 | } | ||
72 | 69 | ||
73 | for_each_child_of_node(parent, np) { | 70 | cpu_dev->of_node = np; |
74 | if (count++ != cpu_dev->id) | 71 | ret = of_init_opp_table(cpu_dev); |
75 | continue; | 72 | of_node_put(np); |
76 | 73 | ||
77 | of_property_read_u32(np, "clock-latency", &transition_latency); | 74 | return ret; |
78 | of_node_put(np); | 75 | } |
79 | of_node_put(parent); | ||
80 | 76 | ||
81 | return 0; | 77 | static int dt_get_transition_latency(struct device *cpu_dev) |
82 | } | 78 | { |
79 | struct device_node *np; | ||
80 | u32 transition_latency = CPUFREQ_ETERNAL; | ||
81 | |||
82 | np = get_cpu_node_with_valid_op(cpu_dev->id); | ||
83 | if (!np) | ||
84 | return CPUFREQ_ETERNAL; | ||
83 | 85 | ||
84 | return -ENODEV; | 86 | of_property_read_u32(np, "clock-latency", &transition_latency); |
87 | of_node_put(np); | ||
88 | |||
89 | pr_debug("%s: clock-latency: %d\n", __func__, transition_latency); | ||
90 | return transition_latency; | ||
85 | } | 91 | } |
86 | 92 | ||
87 | static struct cpufreq_arm_bL_ops dt_bL_ops = { | 93 | static struct cpufreq_arm_bL_ops dt_bL_ops = { |
@@ -90,17 +96,33 @@ static struct cpufreq_arm_bL_ops dt_bL_ops = { | |||
90 | .init_opp_table = dt_init_opp_table, | 96 | .init_opp_table = dt_init_opp_table, |
91 | }; | 97 | }; |
92 | 98 | ||
93 | static int generic_bL_init(void) | 99 | static int generic_bL_probe(struct platform_device *pdev) |
94 | { | 100 | { |
101 | struct device_node *np; | ||
102 | |||
103 | np = get_cpu_node_with_valid_op(0); | ||
104 | if (!np) | ||
105 | return -ENODEV; | ||
106 | |||
107 | of_node_put(np); | ||
95 | return bL_cpufreq_register(&dt_bL_ops); | 108 | return bL_cpufreq_register(&dt_bL_ops); |
96 | } | 109 | } |
97 | module_init(generic_bL_init); | ||
98 | 110 | ||
99 | static void generic_bL_exit(void) | 111 | static int generic_bL_remove(struct platform_device *pdev) |
100 | { | 112 | { |
101 | return bL_cpufreq_unregister(&dt_bL_ops); | 113 | bL_cpufreq_unregister(&dt_bL_ops); |
114 | return 0; | ||
102 | } | 115 | } |
103 | module_exit(generic_bL_exit); | 116 | |
117 | static struct platform_driver generic_bL_platdrv = { | ||
118 | .driver = { | ||
119 | .name = "arm-bL-cpufreq-dt", | ||
120 | .owner = THIS_MODULE, | ||
121 | }, | ||
122 | .probe = generic_bL_probe, | ||
123 | .remove = generic_bL_remove, | ||
124 | }; | ||
125 | module_platform_driver(generic_bL_platdrv); | ||
104 | 126 | ||
105 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@linaro.org>"); | 127 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@linaro.org>"); |
106 | MODULE_DESCRIPTION("Generic ARM big LITTLE cpufreq driver via DT"); | 128 | MODULE_DESCRIPTION("Generic ARM big LITTLE cpufreq driver via DT"); |
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 3ab8294eab04..ad1fde277661 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
@@ -45,7 +45,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, | |||
45 | struct cpufreq_freqs freqs; | 45 | struct cpufreq_freqs freqs; |
46 | struct opp *opp; | 46 | struct opp *opp; |
47 | unsigned long volt = 0, volt_old = 0, tol = 0; | 47 | unsigned long volt = 0, volt_old = 0, tol = 0; |
48 | long freq_Hz; | 48 | long freq_Hz, freq_exact; |
49 | unsigned int index; | 49 | unsigned int index; |
50 | int ret; | 50 | int ret; |
51 | 51 | ||
@@ -60,6 +60,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, | |||
60 | freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000); | 60 | freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000); |
61 | if (freq_Hz < 0) | 61 | if (freq_Hz < 0) |
62 | freq_Hz = freq_table[index].frequency * 1000; | 62 | freq_Hz = freq_table[index].frequency * 1000; |
63 | freq_exact = freq_Hz; | ||
63 | freqs.new = freq_Hz / 1000; | 64 | freqs.new = freq_Hz / 1000; |
64 | freqs.old = clk_get_rate(cpu_clk) / 1000; | 65 | freqs.old = clk_get_rate(cpu_clk) / 1000; |
65 | 66 | ||
@@ -98,7 +99,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, | |||
98 | } | 99 | } |
99 | } | 100 | } |
100 | 101 | ||
101 | ret = clk_set_rate(cpu_clk, freqs.new * 1000); | 102 | ret = clk_set_rate(cpu_clk, freq_exact); |
102 | if (ret) { | 103 | if (ret) { |
103 | pr_err("failed to set clock rate: %d\n", ret); | 104 | pr_err("failed to set clock rate: %d\n", ret); |
104 | if (cpu_reg) | 105 | if (cpu_reg) |
@@ -189,12 +190,29 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | |||
189 | 190 | ||
190 | if (!np) { | 191 | if (!np) { |
191 | pr_err("failed to find cpu0 node\n"); | 192 | pr_err("failed to find cpu0 node\n"); |
192 | return -ENOENT; | 193 | ret = -ENOENT; |
194 | goto out_put_parent; | ||
193 | } | 195 | } |
194 | 196 | ||
195 | cpu_dev = &pdev->dev; | 197 | cpu_dev = &pdev->dev; |
196 | cpu_dev->of_node = np; | 198 | cpu_dev->of_node = np; |
197 | 199 | ||
200 | cpu_reg = devm_regulator_get(cpu_dev, "cpu0"); | ||
201 | if (IS_ERR(cpu_reg)) { | ||
202 | /* | ||
203 | * If cpu0 regulator supply node is present, but regulator is | ||
204 | * not yet registered, we should try defering probe. | ||
205 | */ | ||
206 | if (PTR_ERR(cpu_reg) == -EPROBE_DEFER) { | ||
207 | dev_err(cpu_dev, "cpu0 regulator not ready, retry\n"); | ||
208 | ret = -EPROBE_DEFER; | ||
209 | goto out_put_node; | ||
210 | } | ||
211 | pr_warn("failed to get cpu0 regulator: %ld\n", | ||
212 | PTR_ERR(cpu_reg)); | ||
213 | cpu_reg = NULL; | ||
214 | } | ||
215 | |||
198 | cpu_clk = devm_clk_get(cpu_dev, NULL); | 216 | cpu_clk = devm_clk_get(cpu_dev, NULL); |
199 | if (IS_ERR(cpu_clk)) { | 217 | if (IS_ERR(cpu_clk)) { |
200 | ret = PTR_ERR(cpu_clk); | 218 | ret = PTR_ERR(cpu_clk); |
@@ -202,12 +220,6 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | |||
202 | goto out_put_node; | 220 | goto out_put_node; |
203 | } | 221 | } |
204 | 222 | ||
205 | cpu_reg = devm_regulator_get(cpu_dev, "cpu0"); | ||
206 | if (IS_ERR(cpu_reg)) { | ||
207 | pr_warn("failed to get cpu0 regulator\n"); | ||
208 | cpu_reg = NULL; | ||
209 | } | ||
210 | |||
211 | ret = of_init_opp_table(cpu_dev); | 223 | ret = of_init_opp_table(cpu_dev); |
212 | if (ret) { | 224 | if (ret) { |
213 | pr_err("failed to init OPP table: %d\n", ret); | 225 | pr_err("failed to init OPP table: %d\n", ret); |
@@ -264,6 +276,8 @@ out_free_table: | |||
264 | opp_free_cpufreq_table(cpu_dev, &freq_table); | 276 | opp_free_cpufreq_table(cpu_dev, &freq_table); |
265 | out_put_node: | 277 | out_put_node: |
266 | of_node_put(np); | 278 | of_node_put(np); |
279 | out_put_parent: | ||
280 | of_node_put(parent); | ||
267 | return ret; | 281 | return ret; |
268 | } | 282 | } |
269 | 283 | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1b8a48eaf90f..2d53f47d1747 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1075,14 +1075,14 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif | |||
1075 | __func__, cpu_dev->id, cpu); | 1075 | __func__, cpu_dev->id, cpu); |
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | if ((cpus == 1) && (cpufreq_driver->target)) | ||
1079 | __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); | ||
1080 | |||
1078 | pr_debug("%s: removing link, cpu: %d\n", __func__, cpu); | 1081 | pr_debug("%s: removing link, cpu: %d\n", __func__, cpu); |
1079 | cpufreq_cpu_put(data); | 1082 | cpufreq_cpu_put(data); |
1080 | 1083 | ||
1081 | /* If cpu is last user of policy, free policy */ | 1084 | /* If cpu is last user of policy, free policy */ |
1082 | if (cpus == 1) { | 1085 | if (cpus == 1) { |
1083 | if (cpufreq_driver->target) | ||
1084 | __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); | ||
1085 | |||
1086 | lock_policy_rwsem_read(cpu); | 1086 | lock_policy_rwsem_read(cpu); |
1087 | kobj = &data->kobj; | 1087 | kobj = &data->kobj; |
1088 | cmp = &data->kobj_unregister; | 1088 | cmp = &data->kobj_unregister; |
@@ -1729,18 +1729,23 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, | |||
1729 | /* end old governor */ | 1729 | /* end old governor */ |
1730 | if (data->governor) { | 1730 | if (data->governor) { |
1731 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); | 1731 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); |
1732 | unlock_policy_rwsem_write(policy->cpu); | ||
1732 | __cpufreq_governor(data, | 1733 | __cpufreq_governor(data, |
1733 | CPUFREQ_GOV_POLICY_EXIT); | 1734 | CPUFREQ_GOV_POLICY_EXIT); |
1735 | lock_policy_rwsem_write(policy->cpu); | ||
1734 | } | 1736 | } |
1735 | 1737 | ||
1736 | /* start new governor */ | 1738 | /* start new governor */ |
1737 | data->governor = policy->governor; | 1739 | data->governor = policy->governor; |
1738 | if (!__cpufreq_governor(data, CPUFREQ_GOV_POLICY_INIT)) { | 1740 | if (!__cpufreq_governor(data, CPUFREQ_GOV_POLICY_INIT)) { |
1739 | if (!__cpufreq_governor(data, CPUFREQ_GOV_START)) | 1741 | if (!__cpufreq_governor(data, CPUFREQ_GOV_START)) { |
1740 | failed = 0; | 1742 | failed = 0; |
1741 | else | 1743 | } else { |
1744 | unlock_policy_rwsem_write(policy->cpu); | ||
1742 | __cpufreq_governor(data, | 1745 | __cpufreq_governor(data, |
1743 | CPUFREQ_GOV_POLICY_EXIT); | 1746 | CPUFREQ_GOV_POLICY_EXIT); |
1747 | lock_policy_rwsem_write(policy->cpu); | ||
1748 | } | ||
1744 | } | 1749 | } |
1745 | 1750 | ||
1746 | if (failed) { | 1751 | if (failed) { |
@@ -1832,15 +1837,13 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, | |||
1832 | if (dev) { | 1837 | if (dev) { |
1833 | switch (action) { | 1838 | switch (action) { |
1834 | case CPU_ONLINE: | 1839 | case CPU_ONLINE: |
1835 | case CPU_ONLINE_FROZEN: | ||
1836 | cpufreq_add_dev(dev, NULL); | 1840 | cpufreq_add_dev(dev, NULL); |
1837 | break; | 1841 | break; |
1838 | case CPU_DOWN_PREPARE: | 1842 | case CPU_DOWN_PREPARE: |
1839 | case CPU_DOWN_PREPARE_FROZEN: | 1843 | case CPU_UP_CANCELED_FROZEN: |
1840 | __cpufreq_remove_dev(dev, NULL); | 1844 | __cpufreq_remove_dev(dev, NULL); |
1841 | break; | 1845 | break; |
1842 | case CPU_DOWN_FAILED: | 1846 | case CPU_DOWN_FAILED: |
1843 | case CPU_DOWN_FAILED_FROZEN: | ||
1844 | cpufreq_add_dev(dev, NULL); | 1847 | cpufreq_add_dev(dev, NULL); |
1845 | break; | 1848 | break; |
1846 | } | 1849 | } |
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 443442df113b..dc9b72e25c1a 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/tick.h> | 26 | #include <linux/tick.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/workqueue.h> | 28 | #include <linux/workqueue.h> |
29 | #include <linux/cpu.h> | ||
29 | 30 | ||
30 | #include "cpufreq_governor.h" | 31 | #include "cpufreq_governor.h" |
31 | 32 | ||
@@ -180,8 +181,10 @@ void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy, | |||
180 | if (!all_cpus) { | 181 | if (!all_cpus) { |
181 | __gov_queue_work(smp_processor_id(), dbs_data, delay); | 182 | __gov_queue_work(smp_processor_id(), dbs_data, delay); |
182 | } else { | 183 | } else { |
184 | get_online_cpus(); | ||
183 | for_each_cpu(i, policy->cpus) | 185 | for_each_cpu(i, policy->cpus) |
184 | __gov_queue_work(i, dbs_data, delay); | 186 | __gov_queue_work(i, dbs_data, delay); |
187 | put_online_cpus(); | ||
185 | } | 188 | } |
186 | } | 189 | } |
187 | EXPORT_SYMBOL_GPL(gov_queue_work); | 190 | EXPORT_SYMBOL_GPL(gov_queue_work); |
@@ -255,6 +258,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
255 | if (have_governor_per_policy()) { | 258 | if (have_governor_per_policy()) { |
256 | WARN_ON(dbs_data); | 259 | WARN_ON(dbs_data); |
257 | } else if (dbs_data) { | 260 | } else if (dbs_data) { |
261 | dbs_data->usage_count++; | ||
258 | policy->governor_data = dbs_data; | 262 | policy->governor_data = dbs_data; |
259 | return 0; | 263 | return 0; |
260 | } | 264 | } |
@@ -266,6 +270,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
266 | } | 270 | } |
267 | 271 | ||
268 | dbs_data->cdata = cdata; | 272 | dbs_data->cdata = cdata; |
273 | dbs_data->usage_count = 1; | ||
269 | rc = cdata->init(dbs_data); | 274 | rc = cdata->init(dbs_data); |
270 | if (rc) { | 275 | if (rc) { |
271 | pr_err("%s: POLICY_INIT: init() failed\n", __func__); | 276 | pr_err("%s: POLICY_INIT: init() failed\n", __func__); |
@@ -294,7 +299,8 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
294 | set_sampling_rate(dbs_data, max(dbs_data->min_sampling_rate, | 299 | set_sampling_rate(dbs_data, max(dbs_data->min_sampling_rate, |
295 | latency * LATENCY_MULTIPLIER)); | 300 | latency * LATENCY_MULTIPLIER)); |
296 | 301 | ||
297 | if (dbs_data->cdata->governor == GOV_CONSERVATIVE) { | 302 | if ((cdata->governor == GOV_CONSERVATIVE) && |
303 | (!policy->governor->initialized)) { | ||
298 | struct cs_ops *cs_ops = dbs_data->cdata->gov_ops; | 304 | struct cs_ops *cs_ops = dbs_data->cdata->gov_ops; |
299 | 305 | ||
300 | cpufreq_register_notifier(cs_ops->notifier_block, | 306 | cpufreq_register_notifier(cs_ops->notifier_block, |
@@ -306,12 +312,12 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
306 | 312 | ||
307 | return 0; | 313 | return 0; |
308 | case CPUFREQ_GOV_POLICY_EXIT: | 314 | case CPUFREQ_GOV_POLICY_EXIT: |
309 | if ((policy->governor->initialized == 1) || | 315 | if (!--dbs_data->usage_count) { |
310 | have_governor_per_policy()) { | ||
311 | sysfs_remove_group(get_governor_parent_kobj(policy), | 316 | sysfs_remove_group(get_governor_parent_kobj(policy), |
312 | get_sysfs_attr(dbs_data)); | 317 | get_sysfs_attr(dbs_data)); |
313 | 318 | ||
314 | if (dbs_data->cdata->governor == GOV_CONSERVATIVE) { | 319 | if ((dbs_data->cdata->governor == GOV_CONSERVATIVE) && |
320 | (policy->governor->initialized == 1)) { | ||
315 | struct cs_ops *cs_ops = dbs_data->cdata->gov_ops; | 321 | struct cs_ops *cs_ops = dbs_data->cdata->gov_ops; |
316 | 322 | ||
317 | cpufreq_unregister_notifier(cs_ops->notifier_block, | 323 | cpufreq_unregister_notifier(cs_ops->notifier_block, |
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 8ac33538d0bd..e16a96130cb3 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h | |||
@@ -211,6 +211,7 @@ struct common_dbs_data { | |||
211 | struct dbs_data { | 211 | struct dbs_data { |
212 | struct common_dbs_data *cdata; | 212 | struct common_dbs_data *cdata; |
213 | unsigned int min_sampling_rate; | 213 | unsigned int min_sampling_rate; |
214 | int usage_count; | ||
214 | void *tuners; | 215 | void *tuners; |
215 | 216 | ||
216 | /* dbs_mutex protects dbs_enable in governor start/stop */ | 217 | /* dbs_mutex protects dbs_enable in governor start/stop */ |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index b0ffef96bf77..4b9bb5def6f1 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -547,7 +547,6 @@ static int od_init(struct dbs_data *dbs_data) | |||
547 | tuners->io_is_busy = should_io_be_busy(); | 547 | tuners->io_is_busy = should_io_be_busy(); |
548 | 548 | ||
549 | dbs_data->tuners = tuners; | 549 | dbs_data->tuners = tuners; |
550 | pr_info("%s: tuners %p\n", __func__, tuners); | ||
551 | mutex_init(&dbs_data->mutex); | 550 | mutex_init(&dbs_data->mutex); |
552 | return 0; | 551 | return 0; |
553 | } | 552 | } |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index bfd6273fd873..fb65decffa28 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -349,15 +349,16 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb, | |||
349 | 349 | ||
350 | switch (action) { | 350 | switch (action) { |
351 | case CPU_ONLINE: | 351 | case CPU_ONLINE: |
352 | case CPU_ONLINE_FROZEN: | ||
353 | cpufreq_update_policy(cpu); | 352 | cpufreq_update_policy(cpu); |
354 | break; | 353 | break; |
355 | case CPU_DOWN_PREPARE: | 354 | case CPU_DOWN_PREPARE: |
356 | case CPU_DOWN_PREPARE_FROZEN: | ||
357 | cpufreq_stats_free_sysfs(cpu); | 355 | cpufreq_stats_free_sysfs(cpu); |
358 | break; | 356 | break; |
359 | case CPU_DEAD: | 357 | case CPU_DEAD: |
360 | case CPU_DEAD_FROZEN: | 358 | cpufreq_stats_free_table(cpu); |
359 | break; | ||
360 | case CPU_UP_CANCELED_FROZEN: | ||
361 | cpufreq_stats_free_sysfs(cpu); | ||
361 | cpufreq_stats_free_table(cpu); | 362 | cpufreq_stats_free_table(cpu); |
362 | break; | 363 | break; |
363 | } | 364 | } |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index cc3a8e6c92be..07f2840ad805 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -48,12 +48,7 @@ static inline int32_t div_fp(int32_t x, int32_t y) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | struct sample { | 50 | struct sample { |
51 | ktime_t start_time; | ||
52 | ktime_t end_time; | ||
53 | int core_pct_busy; | 51 | int core_pct_busy; |
54 | int pstate_pct_busy; | ||
55 | u64 duration_us; | ||
56 | u64 idletime_us; | ||
57 | u64 aperf; | 52 | u64 aperf; |
58 | u64 mperf; | 53 | u64 mperf; |
59 | int freq; | 54 | int freq; |
@@ -86,13 +81,9 @@ struct cpudata { | |||
86 | struct pstate_adjust_policy *pstate_policy; | 81 | struct pstate_adjust_policy *pstate_policy; |
87 | struct pstate_data pstate; | 82 | struct pstate_data pstate; |
88 | struct _pid pid; | 83 | struct _pid pid; |
89 | struct _pid idle_pid; | ||
90 | 84 | ||
91 | int min_pstate_count; | 85 | int min_pstate_count; |
92 | int idle_mode; | ||
93 | 86 | ||
94 | ktime_t prev_sample; | ||
95 | u64 prev_idle_time_us; | ||
96 | u64 prev_aperf; | 87 | u64 prev_aperf; |
97 | u64 prev_mperf; | 88 | u64 prev_mperf; |
98 | int sample_ptr; | 89 | int sample_ptr; |
@@ -124,6 +115,8 @@ struct perf_limits { | |||
124 | int min_perf_pct; | 115 | int min_perf_pct; |
125 | int32_t max_perf; | 116 | int32_t max_perf; |
126 | int32_t min_perf; | 117 | int32_t min_perf; |
118 | int max_policy_pct; | ||
119 | int max_sysfs_pct; | ||
127 | }; | 120 | }; |
128 | 121 | ||
129 | static struct perf_limits limits = { | 122 | static struct perf_limits limits = { |
@@ -132,6 +125,8 @@ static struct perf_limits limits = { | |||
132 | .max_perf = int_tofp(1), | 125 | .max_perf = int_tofp(1), |
133 | .min_perf_pct = 0, | 126 | .min_perf_pct = 0, |
134 | .min_perf = 0, | 127 | .min_perf = 0, |
128 | .max_policy_pct = 100, | ||
129 | .max_sysfs_pct = 100, | ||
135 | }; | 130 | }; |
136 | 131 | ||
137 | static inline void pid_reset(struct _pid *pid, int setpoint, int busy, | 132 | static inline void pid_reset(struct _pid *pid, int setpoint, int busy, |
@@ -202,19 +197,6 @@ static inline void intel_pstate_busy_pid_reset(struct cpudata *cpu) | |||
202 | 0); | 197 | 0); |
203 | } | 198 | } |
204 | 199 | ||
205 | static inline void intel_pstate_idle_pid_reset(struct cpudata *cpu) | ||
206 | { | ||
207 | pid_p_gain_set(&cpu->idle_pid, cpu->pstate_policy->p_gain_pct); | ||
208 | pid_d_gain_set(&cpu->idle_pid, cpu->pstate_policy->d_gain_pct); | ||
209 | pid_i_gain_set(&cpu->idle_pid, cpu->pstate_policy->i_gain_pct); | ||
210 | |||
211 | pid_reset(&cpu->idle_pid, | ||
212 | 75, | ||
213 | 50, | ||
214 | cpu->pstate_policy->deadband, | ||
215 | 0); | ||
216 | } | ||
217 | |||
218 | static inline void intel_pstate_reset_all_pid(void) | 200 | static inline void intel_pstate_reset_all_pid(void) |
219 | { | 201 | { |
220 | unsigned int cpu; | 202 | unsigned int cpu; |
@@ -302,7 +284,8 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, | |||
302 | if (ret != 1) | 284 | if (ret != 1) |
303 | return -EINVAL; | 285 | return -EINVAL; |
304 | 286 | ||
305 | limits.max_perf_pct = clamp_t(int, input, 0 , 100); | 287 | limits.max_sysfs_pct = clamp_t(int, input, 0 , 100); |
288 | limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct); | ||
306 | limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100)); | 289 | limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100)); |
307 | return count; | 290 | return count; |
308 | } | 291 | } |
@@ -408,9 +391,8 @@ static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) | |||
408 | if (pstate == cpu->pstate.current_pstate) | 391 | if (pstate == cpu->pstate.current_pstate) |
409 | return; | 392 | return; |
410 | 393 | ||
411 | #ifndef MODULE | ||
412 | trace_cpu_frequency(pstate * 100000, cpu->cpu); | 394 | trace_cpu_frequency(pstate * 100000, cpu->cpu); |
413 | #endif | 395 | |
414 | cpu->pstate.current_pstate = pstate; | 396 | cpu->pstate.current_pstate = pstate; |
415 | wrmsrl(MSR_IA32_PERF_CTL, pstate << 8); | 397 | wrmsrl(MSR_IA32_PERF_CTL, pstate << 8); |
416 | 398 | ||
@@ -450,48 +432,26 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu, | |||
450 | struct sample *sample) | 432 | struct sample *sample) |
451 | { | 433 | { |
452 | u64 core_pct; | 434 | u64 core_pct; |
453 | sample->pstate_pct_busy = 100 - div64_u64( | ||
454 | sample->idletime_us * 100, | ||
455 | sample->duration_us); | ||
456 | core_pct = div64_u64(sample->aperf * 100, sample->mperf); | 435 | core_pct = div64_u64(sample->aperf * 100, sample->mperf); |
457 | sample->freq = cpu->pstate.max_pstate * core_pct * 1000; | 436 | sample->freq = cpu->pstate.max_pstate * core_pct * 1000; |
458 | 437 | ||
459 | sample->core_pct_busy = div_s64((sample->pstate_pct_busy * core_pct), | 438 | sample->core_pct_busy = core_pct; |
460 | 100); | ||
461 | } | 439 | } |
462 | 440 | ||
463 | static inline void intel_pstate_sample(struct cpudata *cpu) | 441 | static inline void intel_pstate_sample(struct cpudata *cpu) |
464 | { | 442 | { |
465 | ktime_t now; | ||
466 | u64 idle_time_us; | ||
467 | u64 aperf, mperf; | 443 | u64 aperf, mperf; |
468 | 444 | ||
469 | now = ktime_get(); | ||
470 | idle_time_us = get_cpu_idle_time_us(cpu->cpu, NULL); | ||
471 | |||
472 | rdmsrl(MSR_IA32_APERF, aperf); | 445 | rdmsrl(MSR_IA32_APERF, aperf); |
473 | rdmsrl(MSR_IA32_MPERF, mperf); | 446 | rdmsrl(MSR_IA32_MPERF, mperf); |
474 | /* for the first sample, don't actually record a sample, just | 447 | cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; |
475 | * set the baseline */ | 448 | cpu->samples[cpu->sample_ptr].aperf = aperf; |
476 | if (cpu->prev_idle_time_us > 0) { | 449 | cpu->samples[cpu->sample_ptr].mperf = mperf; |
477 | cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; | 450 | cpu->samples[cpu->sample_ptr].aperf -= cpu->prev_aperf; |
478 | cpu->samples[cpu->sample_ptr].start_time = cpu->prev_sample; | 451 | cpu->samples[cpu->sample_ptr].mperf -= cpu->prev_mperf; |
479 | cpu->samples[cpu->sample_ptr].end_time = now; | 452 | |
480 | cpu->samples[cpu->sample_ptr].duration_us = | 453 | intel_pstate_calc_busy(cpu, &cpu->samples[cpu->sample_ptr]); |
481 | ktime_us_delta(now, cpu->prev_sample); | ||
482 | cpu->samples[cpu->sample_ptr].idletime_us = | ||
483 | idle_time_us - cpu->prev_idle_time_us; | ||
484 | |||
485 | cpu->samples[cpu->sample_ptr].aperf = aperf; | ||
486 | cpu->samples[cpu->sample_ptr].mperf = mperf; | ||
487 | cpu->samples[cpu->sample_ptr].aperf -= cpu->prev_aperf; | ||
488 | cpu->samples[cpu->sample_ptr].mperf -= cpu->prev_mperf; | ||
489 | |||
490 | intel_pstate_calc_busy(cpu, &cpu->samples[cpu->sample_ptr]); | ||
491 | } | ||
492 | 454 | ||
493 | cpu->prev_sample = now; | ||
494 | cpu->prev_idle_time_us = idle_time_us; | ||
495 | cpu->prev_aperf = aperf; | 455 | cpu->prev_aperf = aperf; |
496 | cpu->prev_mperf = mperf; | 456 | cpu->prev_mperf = mperf; |
497 | } | 457 | } |
@@ -505,16 +465,6 @@ static inline void intel_pstate_set_sample_time(struct cpudata *cpu) | |||
505 | mod_timer_pinned(&cpu->timer, jiffies + delay); | 465 | mod_timer_pinned(&cpu->timer, jiffies + delay); |
506 | } | 466 | } |
507 | 467 | ||
508 | static inline void intel_pstate_idle_mode(struct cpudata *cpu) | ||
509 | { | ||
510 | cpu->idle_mode = 1; | ||
511 | } | ||
512 | |||
513 | static inline void intel_pstate_normal_mode(struct cpudata *cpu) | ||
514 | { | ||
515 | cpu->idle_mode = 0; | ||
516 | } | ||
517 | |||
518 | static inline int intel_pstate_get_scaled_busy(struct cpudata *cpu) | 468 | static inline int intel_pstate_get_scaled_busy(struct cpudata *cpu) |
519 | { | 469 | { |
520 | int32_t busy_scaled; | 470 | int32_t busy_scaled; |
@@ -547,50 +497,21 @@ static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) | |||
547 | intel_pstate_pstate_decrease(cpu, steps); | 497 | intel_pstate_pstate_decrease(cpu, steps); |
548 | } | 498 | } |
549 | 499 | ||
550 | static inline void intel_pstate_adjust_idle_pstate(struct cpudata *cpu) | ||
551 | { | ||
552 | int busy_scaled; | ||
553 | struct _pid *pid; | ||
554 | int ctl = 0; | ||
555 | int steps; | ||
556 | |||
557 | pid = &cpu->idle_pid; | ||
558 | |||
559 | busy_scaled = intel_pstate_get_scaled_busy(cpu); | ||
560 | |||
561 | ctl = pid_calc(pid, 100 - busy_scaled); | ||
562 | |||
563 | steps = abs(ctl); | ||
564 | if (ctl < 0) | ||
565 | intel_pstate_pstate_decrease(cpu, steps); | ||
566 | else | ||
567 | intel_pstate_pstate_increase(cpu, steps); | ||
568 | |||
569 | if (cpu->pstate.current_pstate == cpu->pstate.min_pstate) | ||
570 | intel_pstate_normal_mode(cpu); | ||
571 | } | ||
572 | |||
573 | static void intel_pstate_timer_func(unsigned long __data) | 500 | static void intel_pstate_timer_func(unsigned long __data) |
574 | { | 501 | { |
575 | struct cpudata *cpu = (struct cpudata *) __data; | 502 | struct cpudata *cpu = (struct cpudata *) __data; |
576 | 503 | ||
577 | intel_pstate_sample(cpu); | 504 | intel_pstate_sample(cpu); |
505 | intel_pstate_adjust_busy_pstate(cpu); | ||
578 | 506 | ||
579 | if (!cpu->idle_mode) | ||
580 | intel_pstate_adjust_busy_pstate(cpu); | ||
581 | else | ||
582 | intel_pstate_adjust_idle_pstate(cpu); | ||
583 | |||
584 | #if defined(XPERF_FIX) | ||
585 | if (cpu->pstate.current_pstate == cpu->pstate.min_pstate) { | 507 | if (cpu->pstate.current_pstate == cpu->pstate.min_pstate) { |
586 | cpu->min_pstate_count++; | 508 | cpu->min_pstate_count++; |
587 | if (!(cpu->min_pstate_count % 5)) { | 509 | if (!(cpu->min_pstate_count % 5)) { |
588 | intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate); | 510 | intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate); |
589 | intel_pstate_idle_mode(cpu); | ||
590 | } | 511 | } |
591 | } else | 512 | } else |
592 | cpu->min_pstate_count = 0; | 513 | cpu->min_pstate_count = 0; |
593 | #endif | 514 | |
594 | intel_pstate_set_sample_time(cpu); | 515 | intel_pstate_set_sample_time(cpu); |
595 | } | 516 | } |
596 | 517 | ||
@@ -600,6 +521,7 @@ static void intel_pstate_timer_func(unsigned long __data) | |||
600 | static const struct x86_cpu_id intel_pstate_cpu_ids[] = { | 521 | static const struct x86_cpu_id intel_pstate_cpu_ids[] = { |
601 | ICPU(0x2a, default_policy), | 522 | ICPU(0x2a, default_policy), |
602 | ICPU(0x2d, default_policy), | 523 | ICPU(0x2d, default_policy), |
524 | ICPU(0x3a, default_policy), | ||
603 | {} | 525 | {} |
604 | }; | 526 | }; |
605 | MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids); | 527 | MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids); |
@@ -631,7 +553,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum) | |||
631 | (unsigned long)cpu; | 553 | (unsigned long)cpu; |
632 | cpu->timer.expires = jiffies + HZ/100; | 554 | cpu->timer.expires = jiffies + HZ/100; |
633 | intel_pstate_busy_pid_reset(cpu); | 555 | intel_pstate_busy_pid_reset(cpu); |
634 | intel_pstate_idle_pid_reset(cpu); | ||
635 | intel_pstate_sample(cpu); | 556 | intel_pstate_sample(cpu); |
636 | intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate); | 557 | intel_pstate_set_pstate(cpu, cpu->pstate.max_pstate); |
637 | 558 | ||
@@ -675,8 +596,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) | |||
675 | limits.min_perf_pct = clamp_t(int, limits.min_perf_pct, 0 , 100); | 596 | limits.min_perf_pct = clamp_t(int, limits.min_perf_pct, 0 , 100); |
676 | limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100)); | 597 | limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100)); |
677 | 598 | ||
678 | limits.max_perf_pct = policy->max * 100 / policy->cpuinfo.max_freq; | 599 | limits.max_policy_pct = policy->max * 100 / policy->cpuinfo.max_freq; |
679 | limits.max_perf_pct = clamp_t(int, limits.max_perf_pct, 0 , 100); | 600 | limits.max_policy_pct = clamp_t(int, limits.max_policy_pct, 0 , 100); |
601 | limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct); | ||
680 | limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100)); | 602 | limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100)); |
681 | 603 | ||
682 | return 0; | 604 | return 0; |
@@ -788,10 +710,9 @@ static int __init intel_pstate_init(void) | |||
788 | 710 | ||
789 | pr_info("Intel P-state driver initializing.\n"); | 711 | pr_info("Intel P-state driver initializing.\n"); |
790 | 712 | ||
791 | all_cpu_data = vmalloc(sizeof(void *) * num_possible_cpus()); | 713 | all_cpu_data = vzalloc(sizeof(void *) * num_possible_cpus()); |
792 | if (!all_cpu_data) | 714 | if (!all_cpu_data) |
793 | return -ENOMEM; | 715 | return -ENOMEM; |
794 | memset(all_cpu_data, 0, sizeof(void *) * num_possible_cpus()); | ||
795 | 716 | ||
796 | rc = cpufreq_register_driver(&intel_pstate_driver); | 717 | rc = cpufreq_register_driver(&intel_pstate_driver); |
797 | if (rc) | 718 | if (rc) |
diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c index d36ea8dc96eb..b2644af985ec 100644 --- a/drivers/cpufreq/kirkwood-cpufreq.c +++ b/drivers/cpufreq/kirkwood-cpufreq.c | |||
@@ -171,10 +171,6 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev) | |||
171 | priv.dev = &pdev->dev; | 171 | priv.dev = &pdev->dev; |
172 | 172 | ||
173 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 173 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
174 | if (!res) { | ||
175 | dev_err(&pdev->dev, "Cannot get memory resource\n"); | ||
176 | return -ENODEV; | ||
177 | } | ||
178 | priv.base = devm_ioremap_resource(&pdev->dev, res); | 174 | priv.base = devm_ioremap_resource(&pdev->dev, res); |
179 | if (IS_ERR(priv.base)) | 175 | if (IS_ERR(priv.base)) |
180 | return PTR_ERR(priv.base); | 176 | return PTR_ERR(priv.base); |
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index 84889573b566..d53912768946 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | 19 | ||
20 | #include <asm/clock.h> | 20 | #include <asm/clock.h> |
21 | #include <asm/idle.h> | ||
21 | 22 | ||
22 | #include <asm/mach-loongson/loongson.h> | 23 | #include <asm/mach-loongson/loongson.h> |
23 | 24 | ||
@@ -200,6 +201,7 @@ static void loongson2_cpu_wait(void) | |||
200 | LOONGSON_CHIPCFG0 &= ~0x7; /* Put CPU into wait mode */ | 201 | LOONGSON_CHIPCFG0 &= ~0x7; /* Put CPU into wait mode */ |
201 | LOONGSON_CHIPCFG0 = cpu_freq; /* Restore CPU state */ | 202 | LOONGSON_CHIPCFG0 = cpu_freq; /* Restore CPU state */ |
202 | spin_unlock_irqrestore(&loongson2_wait_lock, flags); | 203 | spin_unlock_irqrestore(&loongson2_wait_lock, flags); |
204 | local_irq_enable(); | ||
203 | } | 205 | } |
204 | 206 | ||
205 | static int __init cpufreq_init(void) | 207 | static int __init cpufreq_init(void) |
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 765fdf5ce579..bf416a8391a7 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
@@ -1154,7 +1154,7 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req, | |||
1154 | dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained); | 1154 | dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained); |
1155 | 1155 | ||
1156 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, | 1156 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, |
1157 | DMA_BIDIRECTIONAL, assoc_chained); | 1157 | DMA_TO_DEVICE, assoc_chained); |
1158 | if (likely(req->src == req->dst)) { | 1158 | if (likely(req->src == req->dst)) { |
1159 | sgc = dma_map_sg_chained(jrdev, req->src, src_nents ? : 1, | 1159 | sgc = dma_map_sg_chained(jrdev, req->src, src_nents ? : 1, |
1160 | DMA_BIDIRECTIONAL, src_chained); | 1160 | DMA_BIDIRECTIONAL, src_chained); |
@@ -1336,7 +1336,7 @@ static struct aead_edesc *aead_giv_edesc_alloc(struct aead_givcrypt_request | |||
1336 | dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained); | 1336 | dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained); |
1337 | 1337 | ||
1338 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, | 1338 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, |
1339 | DMA_BIDIRECTIONAL, assoc_chained); | 1339 | DMA_TO_DEVICE, assoc_chained); |
1340 | if (likely(req->src == req->dst)) { | 1340 | if (likely(req->src == req->dst)) { |
1341 | sgc = dma_map_sg_chained(jrdev, req->src, src_nents ? : 1, | 1341 | sgc = dma_map_sg_chained(jrdev, req->src, src_nents ? : 1, |
1342 | DMA_BIDIRECTIONAL, src_chained); | 1342 | DMA_BIDIRECTIONAL, src_chained); |
diff --git a/drivers/crypto/nx/nx-aes-cbc.c b/drivers/crypto/nx/nx-aes-cbc.c index a76d4c4f29f5..35d483f8db66 100644 --- a/drivers/crypto/nx/nx-aes-cbc.c +++ b/drivers/crypto/nx/nx-aes-cbc.c | |||
@@ -126,6 +126,7 @@ struct crypto_alg nx_cbc_aes_alg = { | |||
126 | .cra_blocksize = AES_BLOCK_SIZE, | 126 | .cra_blocksize = AES_BLOCK_SIZE, |
127 | .cra_ctxsize = sizeof(struct nx_crypto_ctx), | 127 | .cra_ctxsize = sizeof(struct nx_crypto_ctx), |
128 | .cra_type = &crypto_blkcipher_type, | 128 | .cra_type = &crypto_blkcipher_type, |
129 | .cra_alignmask = 0xf, | ||
129 | .cra_module = THIS_MODULE, | 130 | .cra_module = THIS_MODULE, |
130 | .cra_init = nx_crypto_ctx_aes_cbc_init, | 131 | .cra_init = nx_crypto_ctx_aes_cbc_init, |
131 | .cra_exit = nx_crypto_ctx_exit, | 132 | .cra_exit = nx_crypto_ctx_exit, |
diff --git a/drivers/crypto/nx/nx-aes-ecb.c b/drivers/crypto/nx/nx-aes-ecb.c index ba5f1611336f..7bbc9a81da21 100644 --- a/drivers/crypto/nx/nx-aes-ecb.c +++ b/drivers/crypto/nx/nx-aes-ecb.c | |||
@@ -123,6 +123,7 @@ struct crypto_alg nx_ecb_aes_alg = { | |||
123 | .cra_priority = 300, | 123 | .cra_priority = 300, |
124 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, | 124 | .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, |
125 | .cra_blocksize = AES_BLOCK_SIZE, | 125 | .cra_blocksize = AES_BLOCK_SIZE, |
126 | .cra_alignmask = 0xf, | ||
126 | .cra_ctxsize = sizeof(struct nx_crypto_ctx), | 127 | .cra_ctxsize = sizeof(struct nx_crypto_ctx), |
127 | .cra_type = &crypto_blkcipher_type, | 128 | .cra_type = &crypto_blkcipher_type, |
128 | .cra_module = THIS_MODULE, | 129 | .cra_module = THIS_MODULE, |
diff --git a/drivers/crypto/nx/nx-aes-gcm.c b/drivers/crypto/nx/nx-aes-gcm.c index c8109edc5cfb..6cca6c392b00 100644 --- a/drivers/crypto/nx/nx-aes-gcm.c +++ b/drivers/crypto/nx/nx-aes-gcm.c | |||
@@ -219,7 +219,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc) | |||
219 | if (enc) | 219 | if (enc) |
220 | NX_CPB_FDM(csbcpb) |= NX_FDM_ENDE_ENCRYPT; | 220 | NX_CPB_FDM(csbcpb) |= NX_FDM_ENDE_ENCRYPT; |
221 | else | 221 | else |
222 | nbytes -= AES_BLOCK_SIZE; | 222 | nbytes -= crypto_aead_authsize(crypto_aead_reqtfm(req)); |
223 | 223 | ||
224 | csbcpb->cpb.aes_gcm.bit_length_data = nbytes * 8; | 224 | csbcpb->cpb.aes_gcm.bit_length_data = nbytes * 8; |
225 | 225 | ||
diff --git a/drivers/crypto/nx/nx-sha256.c b/drivers/crypto/nx/nx-sha256.c index 9767315f8c0b..67024f2f0b78 100644 --- a/drivers/crypto/nx/nx-sha256.c +++ b/drivers/crypto/nx/nx-sha256.c | |||
@@ -69,7 +69,7 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data, | |||
69 | * 1: <= SHA256_BLOCK_SIZE: copy into state, return 0 | 69 | * 1: <= SHA256_BLOCK_SIZE: copy into state, return 0 |
70 | * 2: > SHA256_BLOCK_SIZE: process X blocks, copy in leftover | 70 | * 2: > SHA256_BLOCK_SIZE: process X blocks, copy in leftover |
71 | */ | 71 | */ |
72 | if (len + sctx->count <= SHA256_BLOCK_SIZE) { | 72 | if (len + sctx->count < SHA256_BLOCK_SIZE) { |
73 | memcpy(sctx->buf + sctx->count, data, len); | 73 | memcpy(sctx->buf + sctx->count, data, len); |
74 | sctx->count += len; | 74 | sctx->count += len; |
75 | goto out; | 75 | goto out; |
@@ -110,7 +110,8 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data, | |||
110 | atomic_inc(&(nx_ctx->stats->sha256_ops)); | 110 | atomic_inc(&(nx_ctx->stats->sha256_ops)); |
111 | 111 | ||
112 | /* copy the leftover back into the state struct */ | 112 | /* copy the leftover back into the state struct */ |
113 | memcpy(sctx->buf, data + len - leftover, leftover); | 113 | if (leftover) |
114 | memcpy(sctx->buf, data + len - leftover, leftover); | ||
114 | sctx->count = leftover; | 115 | sctx->count = leftover; |
115 | 116 | ||
116 | csbcpb->cpb.sha256.message_bit_length += (u64) | 117 | csbcpb->cpb.sha256.message_bit_length += (u64) |
@@ -130,6 +131,7 @@ static int nx_sha256_final(struct shash_desc *desc, u8 *out) | |||
130 | struct nx_sg *in_sg, *out_sg; | 131 | struct nx_sg *in_sg, *out_sg; |
131 | int rc; | 132 | int rc; |
132 | 133 | ||
134 | |||
133 | if (NX_CPB_FDM(csbcpb) & NX_FDM_CONTINUATION) { | 135 | if (NX_CPB_FDM(csbcpb) & NX_FDM_CONTINUATION) { |
134 | /* we've hit the nx chip previously, now we're finalizing, | 136 | /* we've hit the nx chip previously, now we're finalizing, |
135 | * so copy over the partial digest */ | 137 | * so copy over the partial digest */ |
@@ -162,7 +164,7 @@ static int nx_sha256_final(struct shash_desc *desc, u8 *out) | |||
162 | 164 | ||
163 | atomic_inc(&(nx_ctx->stats->sha256_ops)); | 165 | atomic_inc(&(nx_ctx->stats->sha256_ops)); |
164 | 166 | ||
165 | atomic64_add(csbcpb->cpb.sha256.message_bit_length, | 167 | atomic64_add(csbcpb->cpb.sha256.message_bit_length / 8, |
166 | &(nx_ctx->stats->sha256_bytes)); | 168 | &(nx_ctx->stats->sha256_bytes)); |
167 | memcpy(out, csbcpb->cpb.sha256.message_digest, SHA256_DIGEST_SIZE); | 169 | memcpy(out, csbcpb->cpb.sha256.message_digest, SHA256_DIGEST_SIZE); |
168 | out: | 170 | out: |
diff --git a/drivers/crypto/nx/nx-sha512.c b/drivers/crypto/nx/nx-sha512.c index 3177b8c3d5f1..08eee1122349 100644 --- a/drivers/crypto/nx/nx-sha512.c +++ b/drivers/crypto/nx/nx-sha512.c | |||
@@ -69,7 +69,7 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
69 | * 1: <= SHA512_BLOCK_SIZE: copy into state, return 0 | 69 | * 1: <= SHA512_BLOCK_SIZE: copy into state, return 0 |
70 | * 2: > SHA512_BLOCK_SIZE: process X blocks, copy in leftover | 70 | * 2: > SHA512_BLOCK_SIZE: process X blocks, copy in leftover |
71 | */ | 71 | */ |
72 | if ((u64)len + sctx->count[0] <= SHA512_BLOCK_SIZE) { | 72 | if ((u64)len + sctx->count[0] < SHA512_BLOCK_SIZE) { |
73 | memcpy(sctx->buf + sctx->count[0], data, len); | 73 | memcpy(sctx->buf + sctx->count[0], data, len); |
74 | sctx->count[0] += len; | 74 | sctx->count[0] += len; |
75 | goto out; | 75 | goto out; |
@@ -110,7 +110,8 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
110 | atomic_inc(&(nx_ctx->stats->sha512_ops)); | 110 | atomic_inc(&(nx_ctx->stats->sha512_ops)); |
111 | 111 | ||
112 | /* copy the leftover back into the state struct */ | 112 | /* copy the leftover back into the state struct */ |
113 | memcpy(sctx->buf, data + len - leftover, leftover); | 113 | if (leftover) |
114 | memcpy(sctx->buf, data + len - leftover, leftover); | ||
114 | sctx->count[0] = leftover; | 115 | sctx->count[0] = leftover; |
115 | 116 | ||
116 | spbc_bits = csbcpb->cpb.sha512.spbc * 8; | 117 | spbc_bits = csbcpb->cpb.sha512.spbc * 8; |
@@ -168,7 +169,7 @@ static int nx_sha512_final(struct shash_desc *desc, u8 *out) | |||
168 | goto out; | 169 | goto out; |
169 | 170 | ||
170 | atomic_inc(&(nx_ctx->stats->sha512_ops)); | 171 | atomic_inc(&(nx_ctx->stats->sha512_ops)); |
171 | atomic64_add(csbcpb->cpb.sha512.message_bit_length_lo, | 172 | atomic64_add(csbcpb->cpb.sha512.message_bit_length_lo / 8, |
172 | &(nx_ctx->stats->sha512_bytes)); | 173 | &(nx_ctx->stats->sha512_bytes)); |
173 | 174 | ||
174 | memcpy(out, csbcpb->cpb.sha512.message_digest, SHA512_DIGEST_SIZE); | 175 | memcpy(out, csbcpb->cpb.sha512.message_digest, SHA512_DIGEST_SIZE); |
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c index c767f232e693..bbdab6e5ccf0 100644 --- a/drivers/crypto/nx/nx.c +++ b/drivers/crypto/nx/nx.c | |||
@@ -211,44 +211,20 @@ int nx_build_sg_lists(struct nx_crypto_ctx *nx_ctx, | |||
211 | { | 211 | { |
212 | struct nx_sg *nx_insg = nx_ctx->in_sg; | 212 | struct nx_sg *nx_insg = nx_ctx->in_sg; |
213 | struct nx_sg *nx_outsg = nx_ctx->out_sg; | 213 | struct nx_sg *nx_outsg = nx_ctx->out_sg; |
214 | struct blkcipher_walk walk; | ||
215 | int rc; | ||
216 | |||
217 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
218 | rc = blkcipher_walk_virt_block(desc, &walk, AES_BLOCK_SIZE); | ||
219 | if (rc) | ||
220 | goto out; | ||
221 | 214 | ||
222 | if (iv) | 215 | if (iv) |
223 | memcpy(iv, walk.iv, AES_BLOCK_SIZE); | 216 | memcpy(iv, desc->info, AES_BLOCK_SIZE); |
224 | 217 | ||
225 | while (walk.nbytes) { | 218 | nx_insg = nx_walk_and_build(nx_insg, nx_ctx->ap->sglen, src, 0, nbytes); |
226 | nx_insg = nx_build_sg_list(nx_insg, walk.src.virt.addr, | 219 | nx_outsg = nx_walk_and_build(nx_outsg, nx_ctx->ap->sglen, dst, 0, nbytes); |
227 | walk.nbytes, nx_ctx->ap->sglen); | ||
228 | nx_outsg = nx_build_sg_list(nx_outsg, walk.dst.virt.addr, | ||
229 | walk.nbytes, nx_ctx->ap->sglen); | ||
230 | |||
231 | rc = blkcipher_walk_done(desc, &walk, 0); | ||
232 | if (rc) | ||
233 | break; | ||
234 | } | ||
235 | |||
236 | if (walk.nbytes) { | ||
237 | nx_insg = nx_build_sg_list(nx_insg, walk.src.virt.addr, | ||
238 | walk.nbytes, nx_ctx->ap->sglen); | ||
239 | nx_outsg = nx_build_sg_list(nx_outsg, walk.dst.virt.addr, | ||
240 | walk.nbytes, nx_ctx->ap->sglen); | ||
241 | |||
242 | rc = 0; | ||
243 | } | ||
244 | 220 | ||
245 | /* these lengths should be negative, which will indicate to phyp that | 221 | /* these lengths should be negative, which will indicate to phyp that |
246 | * the input and output parameters are scatterlists, not linear | 222 | * the input and output parameters are scatterlists, not linear |
247 | * buffers */ | 223 | * buffers */ |
248 | nx_ctx->op.inlen = (nx_ctx->in_sg - nx_insg) * sizeof(struct nx_sg); | 224 | nx_ctx->op.inlen = (nx_ctx->in_sg - nx_insg) * sizeof(struct nx_sg); |
249 | nx_ctx->op.outlen = (nx_ctx->out_sg - nx_outsg) * sizeof(struct nx_sg); | 225 | nx_ctx->op.outlen = (nx_ctx->out_sg - nx_outsg) * sizeof(struct nx_sg); |
250 | out: | 226 | |
251 | return rc; | 227 | return 0; |
252 | } | 228 | } |
253 | 229 | ||
254 | /** | 230 | /** |
@@ -454,6 +430,8 @@ static int nx_register_algs(void) | |||
454 | if (rc) | 430 | if (rc) |
455 | goto out; | 431 | goto out; |
456 | 432 | ||
433 | nx_driver.of.status = NX_OKAY; | ||
434 | |||
457 | rc = crypto_register_alg(&nx_ecb_aes_alg); | 435 | rc = crypto_register_alg(&nx_ecb_aes_alg); |
458 | if (rc) | 436 | if (rc) |
459 | goto out; | 437 | goto out; |
@@ -498,8 +476,6 @@ static int nx_register_algs(void) | |||
498 | if (rc) | 476 | if (rc) |
499 | goto out_unreg_s512; | 477 | goto out_unreg_s512; |
500 | 478 | ||
501 | nx_driver.of.status = NX_OKAY; | ||
502 | |||
503 | goto out; | 479 | goto out; |
504 | 480 | ||
505 | out_unreg_s512: | 481 | out_unreg_s512: |
diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index a97bb6c1596c..c3dc1c04a5df 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c | |||
@@ -863,7 +863,7 @@ static struct of_device_id sahara_dt_ids[] = { | |||
863 | { .compatible = "fsl,imx27-sahara" }, | 863 | { .compatible = "fsl,imx27-sahara" }, |
864 | { /* sentinel */ } | 864 | { /* sentinel */ } |
865 | }; | 865 | }; |
866 | MODULE_DEVICE_TABLE(platform, sahara_dt_ids); | 866 | MODULE_DEVICE_TABLE(of, sahara_dt_ids); |
867 | 867 | ||
868 | static int sahara_probe(struct platform_device *pdev) | 868 | static int sahara_probe(struct platform_device *pdev) |
869 | { | 869 | { |
diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c index ba6fc62e9651..5a18f82f732a 100644 --- a/drivers/dma/acpi-dma.c +++ b/drivers/dma/acpi-dma.c | |||
@@ -4,7 +4,8 @@ | |||
4 | * Based on of-dma.c | 4 | * Based on of-dma.c |
5 | * | 5 | * |
6 | * Copyright (C) 2013, Intel Corporation | 6 | * Copyright (C) 2013, Intel Corporation |
7 | * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 7 | * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
8 | * Mika Westerberg <mika.westerberg@linux.intel.com> | ||
8 | * | 9 | * |
9 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
@@ -16,6 +17,7 @@ | |||
16 | #include <linux/list.h> | 17 | #include <linux/list.h> |
17 | #include <linux/mutex.h> | 18 | #include <linux/mutex.h> |
18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/ioport.h> | ||
19 | #include <linux/acpi.h> | 21 | #include <linux/acpi.h> |
20 | #include <linux/acpi_dma.h> | 22 | #include <linux/acpi_dma.h> |
21 | 23 | ||
@@ -23,6 +25,117 @@ static LIST_HEAD(acpi_dma_list); | |||
23 | static DEFINE_MUTEX(acpi_dma_lock); | 25 | static DEFINE_MUTEX(acpi_dma_lock); |
24 | 26 | ||
25 | /** | 27 | /** |
28 | * acpi_dma_parse_resource_group - match device and parse resource group | ||
29 | * @grp: CSRT resource group | ||
30 | * @adev: ACPI device to match with | ||
31 | * @adma: struct acpi_dma of the given DMA controller | ||
32 | * | ||
33 | * Returns 1 on success, 0 when no information is available, or appropriate | ||
34 | * errno value on error. | ||
35 | * | ||
36 | * In order to match a device from DSDT table to the corresponding CSRT device | ||
37 | * we use MMIO address and IRQ. | ||
38 | */ | ||
39 | static int acpi_dma_parse_resource_group(const struct acpi_csrt_group *grp, | ||
40 | struct acpi_device *adev, struct acpi_dma *adma) | ||
41 | { | ||
42 | const struct acpi_csrt_shared_info *si; | ||
43 | struct list_head resource_list; | ||
44 | struct resource_list_entry *rentry; | ||
45 | resource_size_t mem = 0, irq = 0; | ||
46 | u32 vendor_id; | ||
47 | int ret; | ||
48 | |||
49 | if (grp->shared_info_length != sizeof(struct acpi_csrt_shared_info)) | ||
50 | return -ENODEV; | ||
51 | |||
52 | INIT_LIST_HEAD(&resource_list); | ||
53 | ret = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); | ||
54 | if (ret <= 0) | ||
55 | return 0; | ||
56 | |||
57 | list_for_each_entry(rentry, &resource_list, node) { | ||
58 | if (resource_type(&rentry->res) == IORESOURCE_MEM) | ||
59 | mem = rentry->res.start; | ||
60 | else if (resource_type(&rentry->res) == IORESOURCE_IRQ) | ||
61 | irq = rentry->res.start; | ||
62 | } | ||
63 | |||
64 | acpi_dev_free_resource_list(&resource_list); | ||
65 | |||
66 | /* Consider initial zero values as resource not found */ | ||
67 | if (mem == 0 && irq == 0) | ||
68 | return 0; | ||
69 | |||
70 | si = (const struct acpi_csrt_shared_info *)&grp[1]; | ||
71 | |||
72 | /* Match device by MMIO and IRQ */ | ||
73 | if (si->mmio_base_low != mem || si->gsi_interrupt != irq) | ||
74 | return 0; | ||
75 | |||
76 | vendor_id = le32_to_cpu(grp->vendor_id); | ||
77 | dev_dbg(&adev->dev, "matches with %.4s%04X (rev %u)\n", | ||
78 | (char *)&vendor_id, grp->device_id, grp->revision); | ||
79 | |||
80 | /* Check if the request line range is available */ | ||
81 | if (si->base_request_line == 0 && si->num_handshake_signals == 0) | ||
82 | return 0; | ||
83 | |||
84 | adma->base_request_line = si->base_request_line; | ||
85 | adma->end_request_line = si->base_request_line + | ||
86 | si->num_handshake_signals - 1; | ||
87 | |||
88 | dev_dbg(&adev->dev, "request line base: 0x%04x end: 0x%04x\n", | ||
89 | adma->base_request_line, adma->end_request_line); | ||
90 | |||
91 | return 1; | ||
92 | } | ||
93 | |||
94 | /** | ||
95 | * acpi_dma_parse_csrt - parse CSRT to exctract additional DMA resources | ||
96 | * @adev: ACPI device to match with | ||
97 | * @adma: struct acpi_dma of the given DMA controller | ||
98 | * | ||
99 | * CSRT or Core System Resources Table is a proprietary ACPI table | ||
100 | * introduced by Microsoft. This table can contain devices that are not in | ||
101 | * the system DSDT table. In particular DMA controllers might be described | ||
102 | * here. | ||
103 | * | ||
104 | * We are using this table to get the request line range of the specific DMA | ||
105 | * controller to be used later. | ||
106 | * | ||
107 | */ | ||
108 | static void acpi_dma_parse_csrt(struct acpi_device *adev, struct acpi_dma *adma) | ||
109 | { | ||
110 | struct acpi_csrt_group *grp, *end; | ||
111 | struct acpi_table_csrt *csrt; | ||
112 | acpi_status status; | ||
113 | int ret; | ||
114 | |||
115 | status = acpi_get_table(ACPI_SIG_CSRT, 0, | ||
116 | (struct acpi_table_header **)&csrt); | ||
117 | if (ACPI_FAILURE(status)) { | ||
118 | if (status != AE_NOT_FOUND) | ||
119 | dev_warn(&adev->dev, "failed to get the CSRT table\n"); | ||
120 | return; | ||
121 | } | ||
122 | |||
123 | grp = (struct acpi_csrt_group *)(csrt + 1); | ||
124 | end = (struct acpi_csrt_group *)((void *)csrt + csrt->header.length); | ||
125 | |||
126 | while (grp < end) { | ||
127 | ret = acpi_dma_parse_resource_group(grp, adev, adma); | ||
128 | if (ret < 0) { | ||
129 | dev_warn(&adev->dev, | ||
130 | "error in parsing resource group\n"); | ||
131 | return; | ||
132 | } | ||
133 | |||
134 | grp = (struct acpi_csrt_group *)((void *)grp + grp->length); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | /** | ||
26 | * acpi_dma_controller_register - Register a DMA controller to ACPI DMA helpers | 139 | * acpi_dma_controller_register - Register a DMA controller to ACPI DMA helpers |
27 | * @dev: struct device of DMA controller | 140 | * @dev: struct device of DMA controller |
28 | * @acpi_dma_xlate: translation function which converts a dma specifier | 141 | * @acpi_dma_xlate: translation function which converts a dma specifier |
@@ -61,6 +174,8 @@ int acpi_dma_controller_register(struct device *dev, | |||
61 | adma->acpi_dma_xlate = acpi_dma_xlate; | 174 | adma->acpi_dma_xlate = acpi_dma_xlate; |
62 | adma->data = data; | 175 | adma->data = data; |
63 | 176 | ||
177 | acpi_dma_parse_csrt(adev, adma); | ||
178 | |||
64 | /* Now queue acpi_dma controller structure in list */ | 179 | /* Now queue acpi_dma controller structure in list */ |
65 | mutex_lock(&acpi_dma_lock); | 180 | mutex_lock(&acpi_dma_lock); |
66 | list_add_tail(&adma->dma_controllers, &acpi_dma_list); | 181 | list_add_tail(&adma->dma_controllers, &acpi_dma_list); |
@@ -149,6 +264,45 @@ void devm_acpi_dma_controller_free(struct device *dev) | |||
149 | } | 264 | } |
150 | EXPORT_SYMBOL_GPL(devm_acpi_dma_controller_free); | 265 | EXPORT_SYMBOL_GPL(devm_acpi_dma_controller_free); |
151 | 266 | ||
267 | /** | ||
268 | * acpi_dma_update_dma_spec - prepare dma specifier to pass to translation function | ||
269 | * @adma: struct acpi_dma of DMA controller | ||
270 | * @dma_spec: dma specifier to update | ||
271 | * | ||
272 | * Returns 0, if no information is avaiable, -1 on mismatch, and 1 otherwise. | ||
273 | * | ||
274 | * Accordingly to ACPI 5.0 Specification Table 6-170 "Fixed DMA Resource | ||
275 | * Descriptor": | ||
276 | * DMA Request Line bits is a platform-relative number uniquely | ||
277 | * identifying the request line assigned. Request line-to-Controller | ||
278 | * mapping is done in a controller-specific OS driver. | ||
279 | * That's why we can safely adjust slave_id when the appropriate controller is | ||
280 | * found. | ||
281 | */ | ||
282 | static int acpi_dma_update_dma_spec(struct acpi_dma *adma, | ||
283 | struct acpi_dma_spec *dma_spec) | ||
284 | { | ||
285 | /* Set link to the DMA controller device */ | ||
286 | dma_spec->dev = adma->dev; | ||
287 | |||
288 | /* Check if the request line range is available */ | ||
289 | if (adma->base_request_line == 0 && adma->end_request_line == 0) | ||
290 | return 0; | ||
291 | |||
292 | /* Check if slave_id falls to the range */ | ||
293 | if (dma_spec->slave_id < adma->base_request_line || | ||
294 | dma_spec->slave_id > adma->end_request_line) | ||
295 | return -1; | ||
296 | |||
297 | /* | ||
298 | * Here we adjust slave_id. It should be a relative number to the base | ||
299 | * request line. | ||
300 | */ | ||
301 | dma_spec->slave_id -= adma->base_request_line; | ||
302 | |||
303 | return 1; | ||
304 | } | ||
305 | |||
152 | struct acpi_dma_parser_data { | 306 | struct acpi_dma_parser_data { |
153 | struct acpi_dma_spec dma_spec; | 307 | struct acpi_dma_spec dma_spec; |
154 | size_t index; | 308 | size_t index; |
@@ -193,6 +347,7 @@ struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev, | |||
193 | struct acpi_device *adev; | 347 | struct acpi_device *adev; |
194 | struct acpi_dma *adma; | 348 | struct acpi_dma *adma; |
195 | struct dma_chan *chan = NULL; | 349 | struct dma_chan *chan = NULL; |
350 | int found; | ||
196 | 351 | ||
197 | /* Check if the device was enumerated by ACPI */ | 352 | /* Check if the device was enumerated by ACPI */ |
198 | if (!dev || !ACPI_HANDLE(dev)) | 353 | if (!dev || !ACPI_HANDLE(dev)) |
@@ -219,9 +374,20 @@ struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev, | |||
219 | mutex_lock(&acpi_dma_lock); | 374 | mutex_lock(&acpi_dma_lock); |
220 | 375 | ||
221 | list_for_each_entry(adma, &acpi_dma_list, dma_controllers) { | 376 | list_for_each_entry(adma, &acpi_dma_list, dma_controllers) { |
222 | dma_spec->dev = adma->dev; | 377 | /* |
378 | * We are not going to call translation function if slave_id | ||
379 | * doesn't fall to the request range. | ||
380 | */ | ||
381 | found = acpi_dma_update_dma_spec(adma, dma_spec); | ||
382 | if (found < 0) | ||
383 | continue; | ||
223 | chan = adma->acpi_dma_xlate(dma_spec, adma); | 384 | chan = adma->acpi_dma_xlate(dma_spec, adma); |
224 | if (chan) | 385 | /* |
386 | * Try to get a channel only from the DMA controller that | ||
387 | * matches the slave_id. See acpi_dma_update_dma_spec() | ||
388 | * description for the details. | ||
389 | */ | ||
390 | if (found > 0 || chan) | ||
225 | break; | 391 | break; |
226 | } | 392 | } |
227 | 393 | ||
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index d8ce4ecfef18..e88ded2c8d2f 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
@@ -716,8 +716,7 @@ static int dmatest_func(void *data) | |||
716 | } | 716 | } |
717 | dma_async_issue_pending(chan); | 717 | dma_async_issue_pending(chan); |
718 | 718 | ||
719 | wait_event_freezable_timeout(done_wait, | 719 | wait_event_freezable_timeout(done_wait, done.done, |
720 | done.done || kthread_should_stop(), | ||
721 | msecs_to_jiffies(params->timeout)); | 720 | msecs_to_jiffies(params->timeout)); |
722 | 721 | ||
723 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); | 722 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); |
@@ -997,7 +996,6 @@ static void stop_threaded_test(struct dmatest_info *info) | |||
997 | static int __restart_threaded_test(struct dmatest_info *info, bool run) | 996 | static int __restart_threaded_test(struct dmatest_info *info, bool run) |
998 | { | 997 | { |
999 | struct dmatest_params *params = &info->params; | 998 | struct dmatest_params *params = &info->params; |
1000 | int ret; | ||
1001 | 999 | ||
1002 | /* Stop any running test first */ | 1000 | /* Stop any running test first */ |
1003 | __stop_threaded_test(info); | 1001 | __stop_threaded_test(info); |
@@ -1012,13 +1010,23 @@ static int __restart_threaded_test(struct dmatest_info *info, bool run) | |||
1012 | memcpy(params, &info->dbgfs_params, sizeof(*params)); | 1010 | memcpy(params, &info->dbgfs_params, sizeof(*params)); |
1013 | 1011 | ||
1014 | /* Run test with new parameters */ | 1012 | /* Run test with new parameters */ |
1015 | ret = __run_threaded_test(info); | 1013 | return __run_threaded_test(info); |
1016 | if (ret) { | 1014 | } |
1017 | __stop_threaded_test(info); | 1015 | |
1018 | pr_err("dmatest: Can't run test\n"); | 1016 | static bool __is_threaded_test_run(struct dmatest_info *info) |
1017 | { | ||
1018 | struct dmatest_chan *dtc; | ||
1019 | |||
1020 | list_for_each_entry(dtc, &info->channels, node) { | ||
1021 | struct dmatest_thread *thread; | ||
1022 | |||
1023 | list_for_each_entry(thread, &dtc->threads, node) { | ||
1024 | if (!thread->done) | ||
1025 | return true; | ||
1026 | } | ||
1019 | } | 1027 | } |
1020 | 1028 | ||
1021 | return ret; | 1029 | return false; |
1022 | } | 1030 | } |
1023 | 1031 | ||
1024 | static ssize_t dtf_write_string(void *to, size_t available, loff_t *ppos, | 1032 | static ssize_t dtf_write_string(void *to, size_t available, loff_t *ppos, |
@@ -1091,22 +1099,10 @@ static ssize_t dtf_read_run(struct file *file, char __user *user_buf, | |||
1091 | { | 1099 | { |
1092 | struct dmatest_info *info = file->private_data; | 1100 | struct dmatest_info *info = file->private_data; |
1093 | char buf[3]; | 1101 | char buf[3]; |
1094 | struct dmatest_chan *dtc; | ||
1095 | bool alive = false; | ||
1096 | 1102 | ||
1097 | mutex_lock(&info->lock); | 1103 | mutex_lock(&info->lock); |
1098 | list_for_each_entry(dtc, &info->channels, node) { | ||
1099 | struct dmatest_thread *thread; | ||
1100 | |||
1101 | list_for_each_entry(thread, &dtc->threads, node) { | ||
1102 | if (!thread->done) { | ||
1103 | alive = true; | ||
1104 | break; | ||
1105 | } | ||
1106 | } | ||
1107 | } | ||
1108 | 1104 | ||
1109 | if (alive) { | 1105 | if (__is_threaded_test_run(info)) { |
1110 | buf[0] = 'Y'; | 1106 | buf[0] = 'Y'; |
1111 | } else { | 1107 | } else { |
1112 | __stop_threaded_test(info); | 1108 | __stop_threaded_test(info); |
@@ -1132,7 +1128,12 @@ static ssize_t dtf_write_run(struct file *file, const char __user *user_buf, | |||
1132 | 1128 | ||
1133 | if (strtobool(buf, &bv) == 0) { | 1129 | if (strtobool(buf, &bv) == 0) { |
1134 | mutex_lock(&info->lock); | 1130 | mutex_lock(&info->lock); |
1135 | ret = __restart_threaded_test(info, bv); | 1131 | |
1132 | if (__is_threaded_test_run(info)) | ||
1133 | ret = -EBUSY; | ||
1134 | else | ||
1135 | ret = __restart_threaded_test(info, bv); | ||
1136 | |||
1136 | mutex_unlock(&info->lock); | 1137 | mutex_unlock(&info->lock); |
1137 | } | 1138 | } |
1138 | 1139 | ||
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 1734feec47b1..71bf4ec300ea 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -1566,10 +1566,12 @@ static void dma_tc_handle(struct d40_chan *d40c) | |||
1566 | return; | 1566 | return; |
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | if (d40_queue_start(d40c) == NULL) | 1569 | if (d40_queue_start(d40c) == NULL) { |
1570 | d40c->busy = false; | 1570 | d40c->busy = false; |
1571 | pm_runtime_mark_last_busy(d40c->base->dev); | 1571 | |
1572 | pm_runtime_put_autosuspend(d40c->base->dev); | 1572 | pm_runtime_mark_last_busy(d40c->base->dev); |
1573 | pm_runtime_put_autosuspend(d40c->base->dev); | ||
1574 | } | ||
1573 | 1575 | ||
1574 | d40_desc_remove(d40d); | 1576 | d40_desc_remove(d40d); |
1575 | d40_desc_done(d40c, d40d); | 1577 | d40_desc_done(d40c, d40d); |
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c index ce193409ebd3..33f59ecd256e 100644 --- a/drivers/dma/tegra20-apb-dma.c +++ b/drivers/dma/tegra20-apb-dma.c | |||
@@ -1273,11 +1273,6 @@ static int tegra_dma_probe(struct platform_device *pdev) | |||
1273 | platform_set_drvdata(pdev, tdma); | 1273 | platform_set_drvdata(pdev, tdma); |
1274 | 1274 | ||
1275 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1275 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1276 | if (!res) { | ||
1277 | dev_err(&pdev->dev, "No mem resource for DMA\n"); | ||
1278 | return -EINVAL; | ||
1279 | } | ||
1280 | |||
1281 | tdma->base_addr = devm_ioremap_resource(&pdev->dev, res); | 1276 | tdma->base_addr = devm_ioremap_resource(&pdev->dev, res); |
1282 | if (IS_ERR(tdma->base_addr)) | 1277 | if (IS_ERR(tdma->base_addr)) |
1283 | return PTR_ERR(tdma->base_addr); | 1278 | return PTR_ERR(tdma->base_addr); |
diff --git a/drivers/edac/amd64_edac_inj.c b/drivers/edac/amd64_edac_inj.c index 8c171fa1cb9b..845f04786c2d 100644 --- a/drivers/edac/amd64_edac_inj.c +++ b/drivers/edac/amd64_edac_inj.c | |||
@@ -202,9 +202,9 @@ static DEVICE_ATTR(inject_word, S_IRUGO | S_IWUSR, | |||
202 | amd64_inject_word_show, amd64_inject_word_store); | 202 | amd64_inject_word_show, amd64_inject_word_store); |
203 | static DEVICE_ATTR(inject_ecc_vector, S_IRUGO | S_IWUSR, | 203 | static DEVICE_ATTR(inject_ecc_vector, S_IRUGO | S_IWUSR, |
204 | amd64_inject_ecc_vector_show, amd64_inject_ecc_vector_store); | 204 | amd64_inject_ecc_vector_show, amd64_inject_ecc_vector_store); |
205 | static DEVICE_ATTR(inject_write, S_IRUGO | S_IWUSR, | 205 | static DEVICE_ATTR(inject_write, S_IWUSR, |
206 | NULL, amd64_inject_write_store); | 206 | NULL, amd64_inject_write_store); |
207 | static DEVICE_ATTR(inject_read, S_IRUGO | S_IWUSR, | 207 | static DEVICE_ATTR(inject_read, S_IWUSR, |
208 | NULL, amd64_inject_read_store); | 208 | NULL, amd64_inject_read_store); |
209 | 209 | ||
210 | 210 | ||
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c index b623c599e572..8bd1bb6dbe47 100644 --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c | |||
@@ -523,13 +523,11 @@ static void efivar_update_sysfs_entries(struct work_struct *work) | |||
523 | struct efivar_entry *entry; | 523 | struct efivar_entry *entry; |
524 | int err; | 524 | int err; |
525 | 525 | ||
526 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | ||
527 | if (!entry) | ||
528 | return; | ||
529 | |||
530 | /* Add new sysfs entries */ | 526 | /* Add new sysfs entries */ |
531 | while (1) { | 527 | while (1) { |
532 | memset(entry, 0, sizeof(*entry)); | 528 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
529 | if (!entry) | ||
530 | return; | ||
533 | 531 | ||
534 | err = efivar_init(efivar_update_sysfs_entry, entry, | 532 | err = efivar_init(efivar_update_sysfs_entry, entry, |
535 | true, false, &efivar_sysfs_list); | 533 | true, false, &efivar_sysfs_list); |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 87d567089f13..573c449c49b9 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -636,7 +636,7 @@ config GPIO_MAX7301 | |||
636 | 636 | ||
637 | config GPIO_MCP23S08 | 637 | config GPIO_MCP23S08 |
638 | tristate "Microchip MCP23xxx I/O expander" | 638 | tristate "Microchip MCP23xxx I/O expander" |
639 | depends on SPI_MASTER || I2C | 639 | depends on (SPI_MASTER && !I2C) || I2C |
640 | help | 640 | help |
641 | SPI/I2C driver for Microchip MCP23S08/MCP23S17/MCP23008/MCP23017 | 641 | SPI/I2C driver for Microchip MCP23S08/MCP23S17/MCP23008/MCP23017 |
642 | I/O expanders. | 642 | I/O expanders. |
diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c index 634c3d37f7b5..62ef10a641c4 100644 --- a/drivers/gpio/gpio-langwell.c +++ b/drivers/gpio/gpio-langwell.c | |||
@@ -324,6 +324,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev, | |||
324 | resource_size_t start, len; | 324 | resource_size_t start, len; |
325 | struct lnw_gpio *lnw; | 325 | struct lnw_gpio *lnw; |
326 | u32 gpio_base; | 326 | u32 gpio_base; |
327 | u32 irq_base; | ||
327 | int retval; | 328 | int retval; |
328 | int ngpio = id->driver_data; | 329 | int ngpio = id->driver_data; |
329 | 330 | ||
@@ -345,6 +346,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev, | |||
345 | retval = -EFAULT; | 346 | retval = -EFAULT; |
346 | goto err_ioremap; | 347 | goto err_ioremap; |
347 | } | 348 | } |
349 | irq_base = *(u32 *)base; | ||
348 | gpio_base = *((u32 *)base + 1); | 350 | gpio_base = *((u32 *)base + 1); |
349 | /* release the IO mapping, since we already get the info from bar1 */ | 351 | /* release the IO mapping, since we already get the info from bar1 */ |
350 | iounmap(base); | 352 | iounmap(base); |
@@ -365,13 +367,6 @@ static int lnw_gpio_probe(struct pci_dev *pdev, | |||
365 | goto err_ioremap; | 367 | goto err_ioremap; |
366 | } | 368 | } |
367 | 369 | ||
368 | lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio, | ||
369 | &lnw_gpio_irq_ops, lnw); | ||
370 | if (!lnw->domain) { | ||
371 | retval = -ENOMEM; | ||
372 | goto err_ioremap; | ||
373 | } | ||
374 | |||
375 | lnw->reg_base = base; | 370 | lnw->reg_base = base; |
376 | lnw->chip.label = dev_name(&pdev->dev); | 371 | lnw->chip.label = dev_name(&pdev->dev); |
377 | lnw->chip.request = lnw_gpio_request; | 372 | lnw->chip.request = lnw_gpio_request; |
@@ -384,6 +379,14 @@ static int lnw_gpio_probe(struct pci_dev *pdev, | |||
384 | lnw->chip.ngpio = ngpio; | 379 | lnw->chip.ngpio = ngpio; |
385 | lnw->chip.can_sleep = 0; | 380 | lnw->chip.can_sleep = 0; |
386 | lnw->pdev = pdev; | 381 | lnw->pdev = pdev; |
382 | |||
383 | lnw->domain = irq_domain_add_simple(pdev->dev.of_node, ngpio, irq_base, | ||
384 | &lnw_gpio_irq_ops, lnw); | ||
385 | if (!lnw->domain) { | ||
386 | retval = -ENOMEM; | ||
387 | goto err_ioremap; | ||
388 | } | ||
389 | |||
387 | pci_set_drvdata(pdev, lnw); | 390 | pci_set_drvdata(pdev, lnw); |
388 | retval = gpiochip_add(&lnw->chip); | 391 | retval = gpiochip_add(&lnw->chip); |
389 | if (retval) { | 392 | if (retval) { |
diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c index b73366523fae..0966f2637ad2 100644 --- a/drivers/gpio/gpio-ml-ioh.c +++ b/drivers/gpio/gpio-ml-ioh.c | |||
@@ -496,8 +496,7 @@ err_irq_alloc_descs: | |||
496 | err_gpiochip_add: | 496 | err_gpiochip_add: |
497 | while (--i >= 0) { | 497 | while (--i >= 0) { |
498 | chip--; | 498 | chip--; |
499 | ret = gpiochip_remove(&chip->gpio); | 499 | if (gpiochip_remove(&chip->gpio)) |
500 | if (ret) | ||
501 | dev_err(&pdev->dev, "Failed gpiochip_remove(%d)\n", i); | 500 | dev_err(&pdev->dev, "Failed gpiochip_remove(%d)\n", i); |
502 | } | 501 | } |
503 | kfree(chip_save); | 502 | kfree(chip_save); |
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index bf69a7eff370..3a4816adc137 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c | |||
@@ -619,11 +619,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev) | |||
619 | * per-CPU registers */ | 619 | * per-CPU registers */ |
620 | if (soc_variant == MVEBU_GPIO_SOC_VARIANT_ARMADAXP) { | 620 | if (soc_variant == MVEBU_GPIO_SOC_VARIANT_ARMADAXP) { |
621 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 621 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
622 | if (!res) { | ||
623 | dev_err(&pdev->dev, "Cannot get memory resource\n"); | ||
624 | return -ENODEV; | ||
625 | } | ||
626 | |||
627 | mvchip->percpu_membase = devm_ioremap_resource(&pdev->dev, | 622 | mvchip->percpu_membase = devm_ioremap_resource(&pdev->dev, |
628 | res); | 623 | res); |
629 | if (IS_ERR(mvchip->percpu_membase)) | 624 | if (IS_ERR(mvchip->percpu_membase)) |
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c index 25000b0f8453..f8e6af20dfbf 100644 --- a/drivers/gpio/gpio-mxs.c +++ b/drivers/gpio/gpio-mxs.c | |||
@@ -326,7 +326,8 @@ static int mxs_gpio_probe(struct platform_device *pdev) | |||
326 | 326 | ||
327 | err = bgpio_init(&port->bgc, &pdev->dev, 4, | 327 | err = bgpio_init(&port->bgc, &pdev->dev, 4, |
328 | port->base + PINCTRL_DIN(port), | 328 | port->base + PINCTRL_DIN(port), |
329 | port->base + PINCTRL_DOUT(port), NULL, | 329 | port->base + PINCTRL_DOUT(port) + MXS_SET, |
330 | port->base + PINCTRL_DOUT(port) + MXS_CLR, | ||
330 | port->base + PINCTRL_DOE(port), NULL, 0); | 331 | port->base + PINCTRL_DOE(port), NULL, 0); |
331 | if (err) | 332 | if (err) |
332 | goto out_irqdesc_free; | 333 | goto out_irqdesc_free; |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 2050891d9c65..d3f7d2db870f 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -69,6 +69,7 @@ struct gpio_bank { | |||
69 | bool is_mpuio; | 69 | bool is_mpuio; |
70 | bool dbck_flag; | 70 | bool dbck_flag; |
71 | bool loses_context; | 71 | bool loses_context; |
72 | bool context_valid; | ||
72 | int stride; | 73 | int stride; |
73 | u32 width; | 74 | u32 width; |
74 | int context_loss_count; | 75 | int context_loss_count; |
@@ -1128,6 +1129,10 @@ static int omap_gpio_probe(struct platform_device *pdev) | |||
1128 | bank->loses_context = true; | 1129 | bank->loses_context = true; |
1129 | } else { | 1130 | } else { |
1130 | bank->loses_context = pdata->loses_context; | 1131 | bank->loses_context = pdata->loses_context; |
1132 | |||
1133 | if (bank->loses_context) | ||
1134 | bank->get_context_loss_count = | ||
1135 | pdata->get_context_loss_count; | ||
1131 | } | 1136 | } |
1132 | 1137 | ||
1133 | 1138 | ||
@@ -1178,9 +1183,6 @@ static int omap_gpio_probe(struct platform_device *pdev) | |||
1178 | omap_gpio_chip_init(bank); | 1183 | omap_gpio_chip_init(bank); |
1179 | omap_gpio_show_rev(bank); | 1184 | omap_gpio_show_rev(bank); |
1180 | 1185 | ||
1181 | if (bank->loses_context) | ||
1182 | bank->get_context_loss_count = pdata->get_context_loss_count; | ||
1183 | |||
1184 | pm_runtime_put(bank->dev); | 1186 | pm_runtime_put(bank->dev); |
1185 | 1187 | ||
1186 | list_add_tail(&bank->node, &omap_gpio_list); | 1188 | list_add_tail(&bank->node, &omap_gpio_list); |
@@ -1259,6 +1261,8 @@ update_gpio_context_count: | |||
1259 | return 0; | 1261 | return 0; |
1260 | } | 1262 | } |
1261 | 1263 | ||
1264 | static void omap_gpio_init_context(struct gpio_bank *p); | ||
1265 | |||
1262 | static int omap_gpio_runtime_resume(struct device *dev) | 1266 | static int omap_gpio_runtime_resume(struct device *dev) |
1263 | { | 1267 | { |
1264 | struct platform_device *pdev = to_platform_device(dev); | 1268 | struct platform_device *pdev = to_platform_device(dev); |
@@ -1268,6 +1272,20 @@ static int omap_gpio_runtime_resume(struct device *dev) | |||
1268 | int c; | 1272 | int c; |
1269 | 1273 | ||
1270 | spin_lock_irqsave(&bank->lock, flags); | 1274 | spin_lock_irqsave(&bank->lock, flags); |
1275 | |||
1276 | /* | ||
1277 | * On the first resume during the probe, the context has not | ||
1278 | * been initialised and so initialise it now. Also initialise | ||
1279 | * the context loss count. | ||
1280 | */ | ||
1281 | if (bank->loses_context && !bank->context_valid) { | ||
1282 | omap_gpio_init_context(bank); | ||
1283 | |||
1284 | if (bank->get_context_loss_count) | ||
1285 | bank->context_loss_count = | ||
1286 | bank->get_context_loss_count(bank->dev); | ||
1287 | } | ||
1288 | |||
1271 | _gpio_dbck_enable(bank); | 1289 | _gpio_dbck_enable(bank); |
1272 | 1290 | ||
1273 | /* | 1291 | /* |
@@ -1384,6 +1402,29 @@ void omap2_gpio_resume_after_idle(void) | |||
1384 | } | 1402 | } |
1385 | 1403 | ||
1386 | #if defined(CONFIG_PM_RUNTIME) | 1404 | #if defined(CONFIG_PM_RUNTIME) |
1405 | static void omap_gpio_init_context(struct gpio_bank *p) | ||
1406 | { | ||
1407 | struct omap_gpio_reg_offs *regs = p->regs; | ||
1408 | void __iomem *base = p->base; | ||
1409 | |||
1410 | p->context.ctrl = __raw_readl(base + regs->ctrl); | ||
1411 | p->context.oe = __raw_readl(base + regs->direction); | ||
1412 | p->context.wake_en = __raw_readl(base + regs->wkup_en); | ||
1413 | p->context.leveldetect0 = __raw_readl(base + regs->leveldetect0); | ||
1414 | p->context.leveldetect1 = __raw_readl(base + regs->leveldetect1); | ||
1415 | p->context.risingdetect = __raw_readl(base + regs->risingdetect); | ||
1416 | p->context.fallingdetect = __raw_readl(base + regs->fallingdetect); | ||
1417 | p->context.irqenable1 = __raw_readl(base + regs->irqenable); | ||
1418 | p->context.irqenable2 = __raw_readl(base + regs->irqenable2); | ||
1419 | |||
1420 | if (regs->set_dataout && p->regs->clr_dataout) | ||
1421 | p->context.dataout = __raw_readl(base + regs->set_dataout); | ||
1422 | else | ||
1423 | p->context.dataout = __raw_readl(base + regs->dataout); | ||
1424 | |||
1425 | p->context_valid = true; | ||
1426 | } | ||
1427 | |||
1387 | static void omap_gpio_restore_context(struct gpio_bank *bank) | 1428 | static void omap_gpio_restore_context(struct gpio_bank *bank) |
1388 | { | 1429 | { |
1389 | __raw_writel(bank->context.wake_en, | 1430 | __raw_writel(bank->context.wake_en, |
@@ -1421,6 +1462,7 @@ static void omap_gpio_restore_context(struct gpio_bank *bank) | |||
1421 | #else | 1462 | #else |
1422 | #define omap_gpio_runtime_suspend NULL | 1463 | #define omap_gpio_runtime_suspend NULL |
1423 | #define omap_gpio_runtime_resume NULL | 1464 | #define omap_gpio_runtime_resume NULL |
1465 | static void omap_gpio_init_context(struct gpio_bank *p) {} | ||
1424 | #endif | 1466 | #endif |
1425 | 1467 | ||
1426 | static const struct dev_pm_ops gpio_pm_ops = { | 1468 | static const struct dev_pm_ops gpio_pm_ops = { |
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index cdf599687cf7..0fec097e838d 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c | |||
@@ -424,8 +424,7 @@ end: | |||
424 | err_request_irq: | 424 | err_request_irq: |
425 | irq_free_descs(irq_base, gpio_pins[chip->ioh]); | 425 | irq_free_descs(irq_base, gpio_pins[chip->ioh]); |
426 | 426 | ||
427 | ret = gpiochip_remove(&chip->gpio); | 427 | if (gpiochip_remove(&chip->gpio)) |
428 | if (ret) | ||
429 | dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__); | 428 | dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__); |
430 | 429 | ||
431 | err_gpiochip_add: | 430 | err_gpiochip_add: |
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c index 1e4de16ceb41..5af65719b95d 100644 --- a/drivers/gpio/gpio-sch.c +++ b/drivers/gpio/gpio-sch.c | |||
@@ -272,10 +272,8 @@ static int sch_gpio_probe(struct platform_device *pdev) | |||
272 | return 0; | 272 | return 0; |
273 | 273 | ||
274 | err_sch_gpio_resume: | 274 | err_sch_gpio_resume: |
275 | err = gpiochip_remove(&sch_gpio_core); | 275 | if (gpiochip_remove(&sch_gpio_core)) |
276 | if (err) | 276 | dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__); |
277 | dev_err(&pdev->dev, "%s failed, %d\n", | ||
278 | "gpiochip_remove()", err); | ||
279 | 277 | ||
280 | err_sch_gpio_core: | 278 | err_sch_gpio_core: |
281 | release_region(res->start, resource_size(res)); | 279 | release_region(res->start, resource_size(res)); |
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index da4cb5b0cb87..9a62672f1bed 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
@@ -463,11 +463,6 @@ static int tegra_gpio_probe(struct platform_device *pdev) | |||
463 | } | 463 | } |
464 | 464 | ||
465 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 465 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
466 | if (!res) { | ||
467 | dev_err(&pdev->dev, "Missing MEM resource\n"); | ||
468 | return -ENODEV; | ||
469 | } | ||
470 | |||
471 | regs = devm_ioremap_resource(&pdev->dev, res); | 466 | regs = devm_ioremap_resource(&pdev->dev, res); |
472 | if (IS_ERR(regs)) | 467 | if (IS_ERR(regs)) |
473 | return PTR_ERR(regs); | 468 | return PTR_ERR(regs); |
diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c index 095ab14cea4d..5ac2919197fe 100644 --- a/drivers/gpio/gpio-viperboard.c +++ b/drivers/gpio/gpio-viperboard.c | |||
@@ -446,7 +446,8 @@ static int vprbrd_gpio_probe(struct platform_device *pdev) | |||
446 | return ret; | 446 | return ret; |
447 | 447 | ||
448 | err_gpiob: | 448 | err_gpiob: |
449 | ret = gpiochip_remove(&vb_gpio->gpioa); | 449 | if (gpiochip_remove(&vb_gpio->gpioa)) |
450 | dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__); | ||
450 | 451 | ||
451 | err_gpioa: | 452 | err_gpioa: |
452 | return ret; | 453 | return ret; |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 3a8f7e6db295..e7e92429d10f 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -78,6 +78,10 @@ void drm_warn_on_modeset_not_all_locked(struct drm_device *dev) | |||
78 | { | 78 | { |
79 | struct drm_crtc *crtc; | 79 | struct drm_crtc *crtc; |
80 | 80 | ||
81 | /* Locking is currently fubar in the panic handler. */ | ||
82 | if (oops_in_progress) | ||
83 | return; | ||
84 | |||
81 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | 85 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
82 | WARN_ON(!mutex_is_locked(&crtc->mutex)); | 86 | WARN_ON(!mutex_is_locked(&crtc->mutex)); |
83 | 87 | ||
@@ -246,6 +250,7 @@ char *drm_get_connector_status_name(enum drm_connector_status status) | |||
246 | else | 250 | else |
247 | return "unknown"; | 251 | return "unknown"; |
248 | } | 252 | } |
253 | EXPORT_SYMBOL(drm_get_connector_status_name); | ||
249 | 254 | ||
250 | /** | 255 | /** |
251 | * drm_mode_object_get - allocate a new modeset identifier | 256 | * drm_mode_object_get - allocate a new modeset identifier |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index e974f9309b72..ed1334e27c33 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -121,6 +121,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, | |||
121 | connector->helper_private; | 121 | connector->helper_private; |
122 | int count = 0; | 122 | int count = 0; |
123 | int mode_flags = 0; | 123 | int mode_flags = 0; |
124 | bool verbose_prune = true; | ||
124 | 125 | ||
125 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, | 126 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, |
126 | drm_get_connector_name(connector)); | 127 | drm_get_connector_name(connector)); |
@@ -149,6 +150,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, | |||
149 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n", | 150 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n", |
150 | connector->base.id, drm_get_connector_name(connector)); | 151 | connector->base.id, drm_get_connector_name(connector)); |
151 | drm_mode_connector_update_edid_property(connector, NULL); | 152 | drm_mode_connector_update_edid_property(connector, NULL); |
153 | verbose_prune = false; | ||
152 | goto prune; | 154 | goto prune; |
153 | } | 155 | } |
154 | 156 | ||
@@ -182,7 +184,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, | |||
182 | } | 184 | } |
183 | 185 | ||
184 | prune: | 186 | prune: |
185 | drm_mode_prune_invalid(dev, &connector->modes, true); | 187 | drm_mode_prune_invalid(dev, &connector->modes, verbose_prune); |
186 | 188 | ||
187 | if (list_empty(&connector->modes)) | 189 | if (list_empty(&connector->modes)) |
188 | return 0; | 190 | return 0; |
@@ -1005,12 +1007,20 @@ static void output_poll_execute(struct work_struct *work) | |||
1005 | continue; | 1007 | continue; |
1006 | 1008 | ||
1007 | connector->status = connector->funcs->detect(connector, false); | 1009 | connector->status = connector->funcs->detect(connector, false); |
1008 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n", | 1010 | if (old_status != connector->status) { |
1009 | connector->base.id, | 1011 | const char *old, *new; |
1010 | drm_get_connector_name(connector), | 1012 | |
1011 | old_status, connector->status); | 1013 | old = drm_get_connector_status_name(old_status); |
1012 | if (old_status != connector->status) | 1014 | new = drm_get_connector_status_name(connector->status); |
1015 | |||
1016 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] " | ||
1017 | "status updated from %s to %s\n", | ||
1018 | connector->base.id, | ||
1019 | drm_get_connector_name(connector), | ||
1020 | old, new); | ||
1021 | |||
1013 | changed = true; | 1022 | changed = true; |
1023 | } | ||
1014 | } | 1024 | } |
1015 | 1025 | ||
1016 | mutex_unlock(&dev->mode_config.mutex); | 1026 | mutex_unlock(&dev->mode_config.mutex); |
@@ -1083,10 +1093,11 @@ void drm_helper_hpd_irq_event(struct drm_device *dev) | |||
1083 | old_status = connector->status; | 1093 | old_status = connector->status; |
1084 | 1094 | ||
1085 | connector->status = connector->funcs->detect(connector, false); | 1095 | connector->status = connector->funcs->detect(connector, false); |
1086 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n", | 1096 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n", |
1087 | connector->base.id, | 1097 | connector->base.id, |
1088 | drm_get_connector_name(connector), | 1098 | drm_get_connector_name(connector), |
1089 | old_status, connector->status); | 1099 | drm_get_connector_status_name(old_status), |
1100 | drm_get_connector_status_name(connector->status)); | ||
1090 | if (old_status != connector->status) | 1101 | if (old_status != connector->status) |
1091 | changed = true; | 1102 | changed = true; |
1092 | } | 1103 | } |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 8d4f29075af5..9cc247f55502 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -57,7 +57,7 @@ static int drm_version(struct drm_device *dev, void *data, | |||
57 | struct drm_file *file_priv); | 57 | struct drm_file *file_priv); |
58 | 58 | ||
59 | #define DRM_IOCTL_DEF(ioctl, _func, _flags) \ | 59 | #define DRM_IOCTL_DEF(ioctl, _func, _flags) \ |
60 | [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0} | 60 | [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0, .name = #ioctl} |
61 | 61 | ||
62 | /** Ioctl table */ | 62 | /** Ioctl table */ |
63 | static const struct drm_ioctl_desc drm_ioctls[] = { | 63 | static const struct drm_ioctl_desc drm_ioctls[] = { |
@@ -375,7 +375,7 @@ long drm_ioctl(struct file *filp, | |||
375 | { | 375 | { |
376 | struct drm_file *file_priv = filp->private_data; | 376 | struct drm_file *file_priv = filp->private_data; |
377 | struct drm_device *dev; | 377 | struct drm_device *dev; |
378 | const struct drm_ioctl_desc *ioctl; | 378 | const struct drm_ioctl_desc *ioctl = NULL; |
379 | drm_ioctl_t *func; | 379 | drm_ioctl_t *func; |
380 | unsigned int nr = DRM_IOCTL_NR(cmd); | 380 | unsigned int nr = DRM_IOCTL_NR(cmd); |
381 | int retcode = -EINVAL; | 381 | int retcode = -EINVAL; |
@@ -392,11 +392,6 @@ long drm_ioctl(struct file *filp, | |||
392 | atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]); | 392 | atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]); |
393 | ++file_priv->ioctl_count; | 393 | ++file_priv->ioctl_count; |
394 | 394 | ||
395 | DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", | ||
396 | task_pid_nr(current), cmd, nr, | ||
397 | (long)old_encode_dev(file_priv->minor->device), | ||
398 | file_priv->authenticated); | ||
399 | |||
400 | if ((nr >= DRM_CORE_IOCTL_COUNT) && | 395 | if ((nr >= DRM_CORE_IOCTL_COUNT) && |
401 | ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END))) | 396 | ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END))) |
402 | goto err_i1; | 397 | goto err_i1; |
@@ -417,6 +412,11 @@ long drm_ioctl(struct file *filp, | |||
417 | } else | 412 | } else |
418 | goto err_i1; | 413 | goto err_i1; |
419 | 414 | ||
415 | DRM_DEBUG("pid=%d, dev=0x%lx, auth=%d, %s\n", | ||
416 | task_pid_nr(current), | ||
417 | (long)old_encode_dev(file_priv->minor->device), | ||
418 | file_priv->authenticated, ioctl->name); | ||
419 | |||
420 | /* Do not trust userspace, use our own definition */ | 420 | /* Do not trust userspace, use our own definition */ |
421 | func = ioctl->func; | 421 | func = ioctl->func; |
422 | /* is there a local override? */ | 422 | /* is there a local override? */ |
@@ -471,6 +471,12 @@ long drm_ioctl(struct file *filp, | |||
471 | } | 471 | } |
472 | 472 | ||
473 | err_i1: | 473 | err_i1: |
474 | if (!ioctl) | ||
475 | DRM_DEBUG("invalid iotcl: pid=%d, dev=0x%lx, auth=%d, cmd=0x%02x, nr=0x%02x\n", | ||
476 | task_pid_nr(current), | ||
477 | (long)old_encode_dev(file_priv->minor->device), | ||
478 | file_priv->authenticated, cmd, nr); | ||
479 | |||
474 | if (kdata != stack_kdata) | 480 | if (kdata != stack_kdata) |
475 | kfree(kdata); | 481 | kfree(kdata); |
476 | atomic_dec(&dev->ioctl_count); | 482 | atomic_dec(&dev->ioctl_count); |
diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c index 48c52f7df4e6..0cfb60f54766 100644 --- a/drivers/gpu/drm/drm_encoder_slave.c +++ b/drivers/gpu/drm/drm_encoder_slave.c | |||
@@ -54,16 +54,12 @@ int drm_i2c_encoder_init(struct drm_device *dev, | |||
54 | struct i2c_adapter *adap, | 54 | struct i2c_adapter *adap, |
55 | const struct i2c_board_info *info) | 55 | const struct i2c_board_info *info) |
56 | { | 56 | { |
57 | char modalias[sizeof(I2C_MODULE_PREFIX) | ||
58 | + I2C_NAME_SIZE]; | ||
59 | struct module *module = NULL; | 57 | struct module *module = NULL; |
60 | struct i2c_client *client; | 58 | struct i2c_client *client; |
61 | struct drm_i2c_encoder_driver *encoder_drv; | 59 | struct drm_i2c_encoder_driver *encoder_drv; |
62 | int err = 0; | 60 | int err = 0; |
63 | 61 | ||
64 | snprintf(modalias, sizeof(modalias), | 62 | request_module("%s%s", I2C_MODULE_PREFIX, info->type); |
65 | "%s%s", I2C_MODULE_PREFIX, info->type); | ||
66 | request_module(modalias); | ||
67 | 63 | ||
68 | client = i2c_new_device(adap, info); | 64 | client = i2c_new_device(adap, info); |
69 | if (!client) { | 65 | if (!client) { |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index a6a8643a6a77..8bcce7866d36 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -1054,7 +1054,7 @@ EXPORT_SYMBOL(drm_vblank_off); | |||
1054 | */ | 1054 | */ |
1055 | void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) | 1055 | void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) |
1056 | { | 1056 | { |
1057 | /* vblank is not initialized (IRQ not installed ?) */ | 1057 | /* vblank is not initialized (IRQ not installed ?), or has been freed */ |
1058 | if (!dev->num_crtcs) | 1058 | if (!dev->num_crtcs) |
1059 | return; | 1059 | return; |
1060 | /* | 1060 | /* |
@@ -1076,6 +1076,10 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc) | |||
1076 | { | 1076 | { |
1077 | unsigned long irqflags; | 1077 | unsigned long irqflags; |
1078 | 1078 | ||
1079 | /* vblank is not initialized (IRQ not installed ?), or has been freed */ | ||
1080 | if (!dev->num_crtcs) | ||
1081 | return; | ||
1082 | |||
1079 | if (dev->vblank_inmodeset[crtc]) { | 1083 | if (dev->vblank_inmodeset[crtc]) { |
1080 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | 1084 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
1081 | dev->vblank_disable_allowed = 1; | 1085 | dev->vblank_disable_allowed = 1; |
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index db1e2d6f90d7..07cf99cc8862 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
@@ -755,33 +755,35 @@ void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) | |||
755 | EXPORT_SYMBOL(drm_mm_debug_table); | 755 | EXPORT_SYMBOL(drm_mm_debug_table); |
756 | 756 | ||
757 | #if defined(CONFIG_DEBUG_FS) | 757 | #if defined(CONFIG_DEBUG_FS) |
758 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm) | 758 | static unsigned long drm_mm_dump_hole(struct seq_file *m, struct drm_mm_node *entry) |
759 | { | 759 | { |
760 | struct drm_mm_node *entry; | ||
761 | unsigned long total_used = 0, total_free = 0, total = 0; | ||
762 | unsigned long hole_start, hole_end, hole_size; | 760 | unsigned long hole_start, hole_end, hole_size; |
763 | 761 | ||
764 | hole_start = drm_mm_hole_node_start(&mm->head_node); | 762 | if (entry->hole_follows) { |
765 | hole_end = drm_mm_hole_node_end(&mm->head_node); | 763 | hole_start = drm_mm_hole_node_start(entry); |
766 | hole_size = hole_end - hole_start; | 764 | hole_end = drm_mm_hole_node_end(entry); |
767 | if (hole_size) | 765 | hole_size = hole_end - hole_start; |
768 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", | 766 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", |
769 | hole_start, hole_end, hole_size); | 767 | hole_start, hole_end, hole_size); |
770 | total_free += hole_size; | 768 | return hole_size; |
769 | } | ||
770 | |||
771 | return 0; | ||
772 | } | ||
773 | |||
774 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm) | ||
775 | { | ||
776 | struct drm_mm_node *entry; | ||
777 | unsigned long total_used = 0, total_free = 0, total = 0; | ||
778 | |||
779 | total_free += drm_mm_dump_hole(m, &mm->head_node); | ||
771 | 780 | ||
772 | drm_mm_for_each_node(entry, mm) { | 781 | drm_mm_for_each_node(entry, mm) { |
773 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: used\n", | 782 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: used\n", |
774 | entry->start, entry->start + entry->size, | 783 | entry->start, entry->start + entry->size, |
775 | entry->size); | 784 | entry->size); |
776 | total_used += entry->size; | 785 | total_used += entry->size; |
777 | if (entry->hole_follows) { | 786 | total_free += drm_mm_dump_hole(m, entry); |
778 | hole_start = drm_mm_hole_node_start(entry); | ||
779 | hole_end = drm_mm_hole_node_end(entry); | ||
780 | hole_size = hole_end - hole_start; | ||
781 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", | ||
782 | hole_start, hole_end, hole_size); | ||
783 | total_free += hole_size; | ||
784 | } | ||
785 | } | 787 | } |
786 | total = total_free + total_used; | 788 | total = total_free + total_used; |
787 | 789 | ||
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index faa79df02648..a371ff865a88 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c | |||
@@ -1143,6 +1143,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, | |||
1143 | was_digit = false; | 1143 | was_digit = false; |
1144 | } else | 1144 | } else |
1145 | goto done; | 1145 | goto done; |
1146 | break; | ||
1146 | case '0' ... '9': | 1147 | case '0' ... '9': |
1147 | was_digit = true; | 1148 | was_digit = true; |
1148 | break; | 1149 | break; |
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index dcde35231e25..5b7b9110254b 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c | |||
@@ -190,8 +190,7 @@ struct dma_buf *drm_gem_prime_export(struct drm_device *dev, | |||
190 | if (ret) | 190 | if (ret) |
191 | return ERR_PTR(ret); | 191 | return ERR_PTR(ret); |
192 | } | 192 | } |
193 | return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size, | 193 | return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size, flags); |
194 | 0600); | ||
195 | } | 194 | } |
196 | EXPORT_SYMBOL(drm_gem_prime_export); | 195 | EXPORT_SYMBOL(drm_gem_prime_export); |
197 | 196 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index e8894bc9e6d5..c200e4d71e3d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
@@ -48,6 +48,8 @@ struct exynos_drm_crtc { | |||
48 | unsigned int pipe; | 48 | unsigned int pipe; |
49 | unsigned int dpms; | 49 | unsigned int dpms; |
50 | enum exynos_crtc_mode mode; | 50 | enum exynos_crtc_mode mode; |
51 | wait_queue_head_t pending_flip_queue; | ||
52 | atomic_t pending_flip; | ||
51 | }; | 53 | }; |
52 | 54 | ||
53 | static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) | 55 | static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) |
@@ -61,6 +63,13 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
61 | return; | 63 | return; |
62 | } | 64 | } |
63 | 65 | ||
66 | if (mode > DRM_MODE_DPMS_ON) { | ||
67 | /* wait for the completion of page flip. */ | ||
68 | wait_event(exynos_crtc->pending_flip_queue, | ||
69 | atomic_read(&exynos_crtc->pending_flip) == 0); | ||
70 | drm_vblank_off(crtc->dev, exynos_crtc->pipe); | ||
71 | } | ||
72 | |||
64 | exynos_drm_fn_encoder(crtc, &mode, exynos_drm_encoder_crtc_dpms); | 73 | exynos_drm_fn_encoder(crtc, &mode, exynos_drm_encoder_crtc_dpms); |
65 | exynos_crtc->dpms = mode; | 74 | exynos_crtc->dpms = mode; |
66 | } | 75 | } |
@@ -217,7 +226,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, | |||
217 | ret = drm_vblank_get(dev, exynos_crtc->pipe); | 226 | ret = drm_vblank_get(dev, exynos_crtc->pipe); |
218 | if (ret) { | 227 | if (ret) { |
219 | DRM_DEBUG("failed to acquire vblank counter\n"); | 228 | DRM_DEBUG("failed to acquire vblank counter\n"); |
220 | list_del(&event->base.link); | ||
221 | 229 | ||
222 | goto out; | 230 | goto out; |
223 | } | 231 | } |
@@ -225,6 +233,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, | |||
225 | spin_lock_irq(&dev->event_lock); | 233 | spin_lock_irq(&dev->event_lock); |
226 | list_add_tail(&event->base.link, | 234 | list_add_tail(&event->base.link, |
227 | &dev_priv->pageflip_event_list); | 235 | &dev_priv->pageflip_event_list); |
236 | atomic_set(&exynos_crtc->pending_flip, 1); | ||
228 | spin_unlock_irq(&dev->event_lock); | 237 | spin_unlock_irq(&dev->event_lock); |
229 | 238 | ||
230 | crtc->fb = fb; | 239 | crtc->fb = fb; |
@@ -344,6 +353,8 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr) | |||
344 | 353 | ||
345 | exynos_crtc->pipe = nr; | 354 | exynos_crtc->pipe = nr; |
346 | exynos_crtc->dpms = DRM_MODE_DPMS_OFF; | 355 | exynos_crtc->dpms = DRM_MODE_DPMS_OFF; |
356 | init_waitqueue_head(&exynos_crtc->pending_flip_queue); | ||
357 | atomic_set(&exynos_crtc->pending_flip, 0); | ||
347 | exynos_crtc->plane = exynos_plane_init(dev, 1 << nr, true); | 358 | exynos_crtc->plane = exynos_plane_init(dev, 1 << nr, true); |
348 | if (!exynos_crtc->plane) { | 359 | if (!exynos_crtc->plane) { |
349 | kfree(exynos_crtc); | 360 | kfree(exynos_crtc); |
@@ -398,7 +409,8 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc) | |||
398 | { | 409 | { |
399 | struct exynos_drm_private *dev_priv = dev->dev_private; | 410 | struct exynos_drm_private *dev_priv = dev->dev_private; |
400 | struct drm_pending_vblank_event *e, *t; | 411 | struct drm_pending_vblank_event *e, *t; |
401 | struct timeval now; | 412 | struct drm_crtc *drm_crtc = dev_priv->crtc[crtc]; |
413 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(drm_crtc); | ||
402 | unsigned long flags; | 414 | unsigned long flags; |
403 | 415 | ||
404 | DRM_DEBUG_KMS("%s\n", __FILE__); | 416 | DRM_DEBUG_KMS("%s\n", __FILE__); |
@@ -411,14 +423,11 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc) | |||
411 | if (crtc != e->pipe) | 423 | if (crtc != e->pipe) |
412 | continue; | 424 | continue; |
413 | 425 | ||
414 | do_gettimeofday(&now); | 426 | list_del(&e->base.link); |
415 | e->event.sequence = 0; | 427 | drm_send_vblank_event(dev, -1, e); |
416 | e->event.tv_sec = now.tv_sec; | ||
417 | e->event.tv_usec = now.tv_usec; | ||
418 | |||
419 | list_move_tail(&e->base.link, &e->base.file_priv->event_list); | ||
420 | wake_up_interruptible(&e->base.file_priv->event_wait); | ||
421 | drm_vblank_put(dev, crtc); | 428 | drm_vblank_put(dev, crtc); |
429 | atomic_set(&exynos_crtc->pending_flip, 0); | ||
430 | wake_up(&exynos_crtc->pending_flip_queue); | ||
422 | } | 431 | } |
423 | 432 | ||
424 | spin_unlock_irqrestore(&dev->event_lock, flags); | 433 | spin_unlock_irqrestore(&dev->event_lock, flags); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 68f0045f86b8..8f007aaeffc3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c | |||
@@ -182,7 +182,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, | |||
182 | 182 | ||
183 | helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd, | 183 | helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd, |
184 | &exynos_gem_obj->base); | 184 | &exynos_gem_obj->base); |
185 | if (IS_ERR_OR_NULL(helper->fb)) { | 185 | if (IS_ERR(helper->fb)) { |
186 | DRM_ERROR("failed to create drm framebuffer.\n"); | 186 | DRM_ERROR("failed to create drm framebuffer.\n"); |
187 | ret = PTR_ERR(helper->fb); | 187 | ret = PTR_ERR(helper->fb); |
188 | goto err_destroy_gem; | 188 | goto err_destroy_gem; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 773f583fa964..4a1616a18ab7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c | |||
@@ -12,9 +12,9 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/mfd/syscon.h> | ||
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/mfd/syscon.h> | ||
18 | #include <linux/regmap.h> | 18 | #include <linux/regmap.h> |
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/pm_runtime.h> | 20 | #include <linux/pm_runtime.h> |
@@ -1845,7 +1845,7 @@ static int fimc_probe(struct platform_device *pdev) | |||
1845 | } | 1845 | } |
1846 | 1846 | ||
1847 | ctx->irq = res->start; | 1847 | ctx->irq = res->start; |
1848 | ret = request_threaded_irq(ctx->irq, NULL, fimc_irq_handler, | 1848 | ret = devm_request_threaded_irq(dev, ctx->irq, NULL, fimc_irq_handler, |
1849 | IRQF_ONESHOT, "drm_fimc", ctx); | 1849 | IRQF_ONESHOT, "drm_fimc", ctx); |
1850 | if (ret < 0) { | 1850 | if (ret < 0) { |
1851 | dev_err(dev, "failed to request irq.\n"); | 1851 | dev_err(dev, "failed to request irq.\n"); |
@@ -1854,7 +1854,7 @@ static int fimc_probe(struct platform_device *pdev) | |||
1854 | 1854 | ||
1855 | ret = fimc_setup_clocks(ctx); | 1855 | ret = fimc_setup_clocks(ctx); |
1856 | if (ret < 0) | 1856 | if (ret < 0) |
1857 | goto err_free_irq; | 1857 | return ret; |
1858 | 1858 | ||
1859 | ippdrv = &ctx->ippdrv; | 1859 | ippdrv = &ctx->ippdrv; |
1860 | ippdrv->ops[EXYNOS_DRM_OPS_SRC] = &fimc_src_ops; | 1860 | ippdrv->ops[EXYNOS_DRM_OPS_SRC] = &fimc_src_ops; |
@@ -1884,7 +1884,7 @@ static int fimc_probe(struct platform_device *pdev) | |||
1884 | goto err_pm_dis; | 1884 | goto err_pm_dis; |
1885 | } | 1885 | } |
1886 | 1886 | ||
1887 | dev_info(&pdev->dev, "drm fimc registered successfully.\n"); | 1887 | dev_info(dev, "drm fimc registered successfully.\n"); |
1888 | 1888 | ||
1889 | return 0; | 1889 | return 0; |
1890 | 1890 | ||
@@ -1892,8 +1892,6 @@ err_pm_dis: | |||
1892 | pm_runtime_disable(dev); | 1892 | pm_runtime_disable(dev); |
1893 | err_put_clk: | 1893 | err_put_clk: |
1894 | fimc_put_clocks(ctx); | 1894 | fimc_put_clocks(ctx); |
1895 | err_free_irq: | ||
1896 | free_irq(ctx->irq, ctx); | ||
1897 | 1895 | ||
1898 | return ret; | 1896 | return ret; |
1899 | } | 1897 | } |
@@ -1911,8 +1909,6 @@ static int fimc_remove(struct platform_device *pdev) | |||
1911 | pm_runtime_set_suspended(dev); | 1909 | pm_runtime_set_suspended(dev); |
1912 | pm_runtime_disable(dev); | 1910 | pm_runtime_disable(dev); |
1913 | 1911 | ||
1914 | free_irq(ctx->irq, ctx); | ||
1915 | |||
1916 | return 0; | 1912 | return 0; |
1917 | } | 1913 | } |
1918 | 1914 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 746b282b343a..97c61dbffd82 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -885,7 +885,7 @@ static int fimd_probe(struct platform_device *pdev) | |||
885 | 885 | ||
886 | DRM_DEBUG_KMS("%s\n", __FILE__); | 886 | DRM_DEBUG_KMS("%s\n", __FILE__); |
887 | 887 | ||
888 | if (pdev->dev.of_node) { | 888 | if (dev->of_node) { |
889 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | 889 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); |
890 | if (!pdata) { | 890 | if (!pdata) { |
891 | DRM_ERROR("memory allocation for pdata failed\n"); | 891 | DRM_ERROR("memory allocation for pdata failed\n"); |
@@ -899,7 +899,7 @@ static int fimd_probe(struct platform_device *pdev) | |||
899 | return ret; | 899 | return ret; |
900 | } | 900 | } |
901 | } else { | 901 | } else { |
902 | pdata = pdev->dev.platform_data; | 902 | pdata = dev->platform_data; |
903 | if (!pdata) { | 903 | if (!pdata) { |
904 | DRM_ERROR("no platform data specified\n"); | 904 | DRM_ERROR("no platform data specified\n"); |
905 | return -EINVAL; | 905 | return -EINVAL; |
@@ -912,7 +912,7 @@ static int fimd_probe(struct platform_device *pdev) | |||
912 | return -EINVAL; | 912 | return -EINVAL; |
913 | } | 913 | } |
914 | 914 | ||
915 | ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); | 915 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); |
916 | if (!ctx) | 916 | if (!ctx) |
917 | return -ENOMEM; | 917 | return -ENOMEM; |
918 | 918 | ||
@@ -930,7 +930,7 @@ static int fimd_probe(struct platform_device *pdev) | |||
930 | 930 | ||
931 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 931 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
932 | 932 | ||
933 | ctx->regs = devm_ioremap_resource(&pdev->dev, res); | 933 | ctx->regs = devm_ioremap_resource(dev, res); |
934 | if (IS_ERR(ctx->regs)) | 934 | if (IS_ERR(ctx->regs)) |
935 | return PTR_ERR(ctx->regs); | 935 | return PTR_ERR(ctx->regs); |
936 | 936 | ||
@@ -942,7 +942,7 @@ static int fimd_probe(struct platform_device *pdev) | |||
942 | 942 | ||
943 | ctx->irq = res->start; | 943 | ctx->irq = res->start; |
944 | 944 | ||
945 | ret = devm_request_irq(&pdev->dev, ctx->irq, fimd_irq_handler, | 945 | ret = devm_request_irq(dev, ctx->irq, fimd_irq_handler, |
946 | 0, "drm_fimd", ctx); | 946 | 0, "drm_fimd", ctx); |
947 | if (ret) { | 947 | if (ret) { |
948 | dev_err(dev, "irq request failed.\n"); | 948 | dev_err(dev, "irq request failed.\n"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 47a493c8a71f..af75434ee4d7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
@@ -1379,7 +1379,7 @@ static int g2d_probe(struct platform_device *pdev) | |||
1379 | struct exynos_drm_subdrv *subdrv; | 1379 | struct exynos_drm_subdrv *subdrv; |
1380 | int ret; | 1380 | int ret; |
1381 | 1381 | ||
1382 | g2d = devm_kzalloc(&pdev->dev, sizeof(*g2d), GFP_KERNEL); | 1382 | g2d = devm_kzalloc(dev, sizeof(*g2d), GFP_KERNEL); |
1383 | if (!g2d) { | 1383 | if (!g2d) { |
1384 | dev_err(dev, "failed to allocate driver data\n"); | 1384 | dev_err(dev, "failed to allocate driver data\n"); |
1385 | return -ENOMEM; | 1385 | return -ENOMEM; |
@@ -1417,7 +1417,7 @@ static int g2d_probe(struct platform_device *pdev) | |||
1417 | 1417 | ||
1418 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1418 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1419 | 1419 | ||
1420 | g2d->regs = devm_ioremap_resource(&pdev->dev, res); | 1420 | g2d->regs = devm_ioremap_resource(dev, res); |
1421 | if (IS_ERR(g2d->regs)) { | 1421 | if (IS_ERR(g2d->regs)) { |
1422 | ret = PTR_ERR(g2d->regs); | 1422 | ret = PTR_ERR(g2d->regs); |
1423 | goto err_put_clk; | 1423 | goto err_put_clk; |
@@ -1430,7 +1430,7 @@ static int g2d_probe(struct platform_device *pdev) | |||
1430 | goto err_put_clk; | 1430 | goto err_put_clk; |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | ret = devm_request_irq(&pdev->dev, g2d->irq, g2d_irq_handler, 0, | 1433 | ret = devm_request_irq(dev, g2d->irq, g2d_irq_handler, 0, |
1434 | "drm_g2d", g2d); | 1434 | "drm_g2d", g2d); |
1435 | if (ret < 0) { | 1435 | if (ret < 0) { |
1436 | dev_err(dev, "irq request failed\n"); | 1436 | dev_err(dev, "irq request failed\n"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 7841c3b8a20e..762f40d548b7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c | |||
@@ -1704,7 +1704,7 @@ static int gsc_probe(struct platform_device *pdev) | |||
1704 | } | 1704 | } |
1705 | 1705 | ||
1706 | ctx->irq = res->start; | 1706 | ctx->irq = res->start; |
1707 | ret = request_threaded_irq(ctx->irq, NULL, gsc_irq_handler, | 1707 | ret = devm_request_threaded_irq(dev, ctx->irq, NULL, gsc_irq_handler, |
1708 | IRQF_ONESHOT, "drm_gsc", ctx); | 1708 | IRQF_ONESHOT, "drm_gsc", ctx); |
1709 | if (ret < 0) { | 1709 | if (ret < 0) { |
1710 | dev_err(dev, "failed to request irq.\n"); | 1710 | dev_err(dev, "failed to request irq.\n"); |
@@ -1725,7 +1725,7 @@ static int gsc_probe(struct platform_device *pdev) | |||
1725 | ret = gsc_init_prop_list(ippdrv); | 1725 | ret = gsc_init_prop_list(ippdrv); |
1726 | if (ret < 0) { | 1726 | if (ret < 0) { |
1727 | dev_err(dev, "failed to init property list.\n"); | 1727 | dev_err(dev, "failed to init property list.\n"); |
1728 | goto err_get_irq; | 1728 | return ret; |
1729 | } | 1729 | } |
1730 | 1730 | ||
1731 | DRM_DEBUG_KMS("%s:id[%d]ippdrv[0x%x]\n", __func__, ctx->id, | 1731 | DRM_DEBUG_KMS("%s:id[%d]ippdrv[0x%x]\n", __func__, ctx->id, |
@@ -1743,15 +1743,12 @@ static int gsc_probe(struct platform_device *pdev) | |||
1743 | goto err_ippdrv_register; | 1743 | goto err_ippdrv_register; |
1744 | } | 1744 | } |
1745 | 1745 | ||
1746 | dev_info(&pdev->dev, "drm gsc registered successfully.\n"); | 1746 | dev_info(dev, "drm gsc registered successfully.\n"); |
1747 | 1747 | ||
1748 | return 0; | 1748 | return 0; |
1749 | 1749 | ||
1750 | err_ippdrv_register: | 1750 | err_ippdrv_register: |
1751 | devm_kfree(dev, ippdrv->prop_list); | ||
1752 | pm_runtime_disable(dev); | 1751 | pm_runtime_disable(dev); |
1753 | err_get_irq: | ||
1754 | free_irq(ctx->irq, ctx); | ||
1755 | return ret; | 1752 | return ret; |
1756 | } | 1753 | } |
1757 | 1754 | ||
@@ -1761,15 +1758,12 @@ static int gsc_remove(struct platform_device *pdev) | |||
1761 | struct gsc_context *ctx = get_gsc_context(dev); | 1758 | struct gsc_context *ctx = get_gsc_context(dev); |
1762 | struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; | 1759 | struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; |
1763 | 1760 | ||
1764 | devm_kfree(dev, ippdrv->prop_list); | ||
1765 | exynos_drm_ippdrv_unregister(ippdrv); | 1761 | exynos_drm_ippdrv_unregister(ippdrv); |
1766 | mutex_destroy(&ctx->lock); | 1762 | mutex_destroy(&ctx->lock); |
1767 | 1763 | ||
1768 | pm_runtime_set_suspended(dev); | 1764 | pm_runtime_set_suspended(dev); |
1769 | pm_runtime_disable(dev); | 1765 | pm_runtime_disable(dev); |
1770 | 1766 | ||
1771 | free_irq(ctx->irq, ctx); | ||
1772 | |||
1773 | return 0; | 1767 | return 0; |
1774 | } | 1768 | } |
1775 | 1769 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index ba2f0f1aa05f..437fb947e46d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
@@ -442,7 +442,7 @@ static int exynos_drm_hdmi_probe(struct platform_device *pdev) | |||
442 | 442 | ||
443 | DRM_DEBUG_KMS("%s\n", __FILE__); | 443 | DRM_DEBUG_KMS("%s\n", __FILE__); |
444 | 444 | ||
445 | ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); | 445 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); |
446 | if (!ctx) { | 446 | if (!ctx) { |
447 | DRM_LOG_KMS("failed to alloc common hdmi context.\n"); | 447 | DRM_LOG_KMS("failed to alloc common hdmi context.\n"); |
448 | return -ENOMEM; | 448 | return -ENOMEM; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 29d2ad314490..be1e88463466 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c | |||
@@ -222,7 +222,7 @@ static struct exynos_drm_ippdrv *ipp_find_driver(struct ipp_context *ctx, | |||
222 | /* find ipp driver using idr */ | 222 | /* find ipp driver using idr */ |
223 | ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock, | 223 | ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock, |
224 | ipp_id); | 224 | ipp_id); |
225 | if (IS_ERR_OR_NULL(ippdrv)) { | 225 | if (IS_ERR(ippdrv)) { |
226 | DRM_ERROR("not found ipp%d driver.\n", ipp_id); | 226 | DRM_ERROR("not found ipp%d driver.\n", ipp_id); |
227 | return ippdrv; | 227 | return ippdrv; |
228 | } | 228 | } |
@@ -388,7 +388,7 @@ static int ipp_find_and_set_property(struct drm_exynos_ipp_property *property) | |||
388 | DRM_DEBUG_KMS("%s:prop_id[%d]\n", __func__, prop_id); | 388 | DRM_DEBUG_KMS("%s:prop_id[%d]\n", __func__, prop_id); |
389 | 389 | ||
390 | ippdrv = ipp_find_drv_by_handle(prop_id); | 390 | ippdrv = ipp_find_drv_by_handle(prop_id); |
391 | if (IS_ERR_OR_NULL(ippdrv)) { | 391 | if (IS_ERR(ippdrv)) { |
392 | DRM_ERROR("failed to get ipp driver.\n"); | 392 | DRM_ERROR("failed to get ipp driver.\n"); |
393 | return -EINVAL; | 393 | return -EINVAL; |
394 | } | 394 | } |
@@ -492,7 +492,7 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data, | |||
492 | 492 | ||
493 | /* find ipp driver using ipp id */ | 493 | /* find ipp driver using ipp id */ |
494 | ippdrv = ipp_find_driver(ctx, property); | 494 | ippdrv = ipp_find_driver(ctx, property); |
495 | if (IS_ERR_OR_NULL(ippdrv)) { | 495 | if (IS_ERR(ippdrv)) { |
496 | DRM_ERROR("failed to get ipp driver.\n"); | 496 | DRM_ERROR("failed to get ipp driver.\n"); |
497 | return -EINVAL; | 497 | return -EINVAL; |
498 | } | 498 | } |
@@ -521,19 +521,19 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data, | |||
521 | c_node->state = IPP_STATE_IDLE; | 521 | c_node->state = IPP_STATE_IDLE; |
522 | 522 | ||
523 | c_node->start_work = ipp_create_cmd_work(); | 523 | c_node->start_work = ipp_create_cmd_work(); |
524 | if (IS_ERR_OR_NULL(c_node->start_work)) { | 524 | if (IS_ERR(c_node->start_work)) { |
525 | DRM_ERROR("failed to create start work.\n"); | 525 | DRM_ERROR("failed to create start work.\n"); |
526 | goto err_clear; | 526 | goto err_clear; |
527 | } | 527 | } |
528 | 528 | ||
529 | c_node->stop_work = ipp_create_cmd_work(); | 529 | c_node->stop_work = ipp_create_cmd_work(); |
530 | if (IS_ERR_OR_NULL(c_node->stop_work)) { | 530 | if (IS_ERR(c_node->stop_work)) { |
531 | DRM_ERROR("failed to create stop work.\n"); | 531 | DRM_ERROR("failed to create stop work.\n"); |
532 | goto err_free_start; | 532 | goto err_free_start; |
533 | } | 533 | } |
534 | 534 | ||
535 | c_node->event_work = ipp_create_event_work(); | 535 | c_node->event_work = ipp_create_event_work(); |
536 | if (IS_ERR_OR_NULL(c_node->event_work)) { | 536 | if (IS_ERR(c_node->event_work)) { |
537 | DRM_ERROR("failed to create event work.\n"); | 537 | DRM_ERROR("failed to create event work.\n"); |
538 | goto err_free_stop; | 538 | goto err_free_stop; |
539 | } | 539 | } |
@@ -915,7 +915,7 @@ static int ipp_queue_buf_with_run(struct device *dev, | |||
915 | DRM_DEBUG_KMS("%s\n", __func__); | 915 | DRM_DEBUG_KMS("%s\n", __func__); |
916 | 916 | ||
917 | ippdrv = ipp_find_drv_by_handle(qbuf->prop_id); | 917 | ippdrv = ipp_find_drv_by_handle(qbuf->prop_id); |
918 | if (IS_ERR_OR_NULL(ippdrv)) { | 918 | if (IS_ERR(ippdrv)) { |
919 | DRM_ERROR("failed to get ipp driver.\n"); | 919 | DRM_ERROR("failed to get ipp driver.\n"); |
920 | return -EFAULT; | 920 | return -EFAULT; |
921 | } | 921 | } |
@@ -1909,7 +1909,7 @@ static int ipp_probe(struct platform_device *pdev) | |||
1909 | struct exynos_drm_subdrv *subdrv; | 1909 | struct exynos_drm_subdrv *subdrv; |
1910 | int ret; | 1910 | int ret; |
1911 | 1911 | ||
1912 | ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); | 1912 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); |
1913 | if (!ctx) | 1913 | if (!ctx) |
1914 | return -ENOMEM; | 1914 | return -ENOMEM; |
1915 | 1915 | ||
@@ -1963,7 +1963,7 @@ static int ipp_probe(struct platform_device *pdev) | |||
1963 | goto err_cmd_workq; | 1963 | goto err_cmd_workq; |
1964 | } | 1964 | } |
1965 | 1965 | ||
1966 | dev_info(&pdev->dev, "drm ipp registered successfully.\n"); | 1966 | dev_info(dev, "drm ipp registered successfully.\n"); |
1967 | 1967 | ||
1968 | return 0; | 1968 | return 0; |
1969 | 1969 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index 947f09f15ad1..9b6c70964d71 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c | |||
@@ -666,8 +666,8 @@ static int rotator_probe(struct platform_device *pdev) | |||
666 | return rot->irq; | 666 | return rot->irq; |
667 | } | 667 | } |
668 | 668 | ||
669 | ret = request_threaded_irq(rot->irq, NULL, rotator_irq_handler, | 669 | ret = devm_request_threaded_irq(dev, rot->irq, NULL, |
670 | IRQF_ONESHOT, "drm_rotator", rot); | 670 | rotator_irq_handler, IRQF_ONESHOT, "drm_rotator", rot); |
671 | if (ret < 0) { | 671 | if (ret < 0) { |
672 | dev_err(dev, "failed to request irq\n"); | 672 | dev_err(dev, "failed to request irq\n"); |
673 | return ret; | 673 | return ret; |
@@ -676,8 +676,7 @@ static int rotator_probe(struct platform_device *pdev) | |||
676 | rot->clock = devm_clk_get(dev, "rotator"); | 676 | rot->clock = devm_clk_get(dev, "rotator"); |
677 | if (IS_ERR(rot->clock)) { | 677 | if (IS_ERR(rot->clock)) { |
678 | dev_err(dev, "failed to get clock\n"); | 678 | dev_err(dev, "failed to get clock\n"); |
679 | ret = PTR_ERR(rot->clock); | 679 | return PTR_ERR(rot->clock); |
680 | goto err_clk_get; | ||
681 | } | 680 | } |
682 | 681 | ||
683 | pm_runtime_enable(dev); | 682 | pm_runtime_enable(dev); |
@@ -709,10 +708,7 @@ static int rotator_probe(struct platform_device *pdev) | |||
709 | return 0; | 708 | return 0; |
710 | 709 | ||
711 | err_ippdrv_register: | 710 | err_ippdrv_register: |
712 | devm_kfree(dev, ippdrv->prop_list); | ||
713 | pm_runtime_disable(dev); | 711 | pm_runtime_disable(dev); |
714 | err_clk_get: | ||
715 | free_irq(rot->irq, rot); | ||
716 | return ret; | 712 | return ret; |
717 | } | 713 | } |
718 | 714 | ||
@@ -722,13 +718,10 @@ static int rotator_remove(struct platform_device *pdev) | |||
722 | struct rot_context *rot = dev_get_drvdata(dev); | 718 | struct rot_context *rot = dev_get_drvdata(dev); |
723 | struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv; | 719 | struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv; |
724 | 720 | ||
725 | devm_kfree(dev, ippdrv->prop_list); | ||
726 | exynos_drm_ippdrv_unregister(ippdrv); | 721 | exynos_drm_ippdrv_unregister(ippdrv); |
727 | 722 | ||
728 | pm_runtime_disable(dev); | 723 | pm_runtime_disable(dev); |
729 | 724 | ||
730 | free_irq(rot->irq, rot); | ||
731 | |||
732 | return 0; | 725 | return 0; |
733 | } | 726 | } |
734 | 727 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 9504b0cd825a..24376c194a5e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -594,7 +594,7 @@ static int vidi_probe(struct platform_device *pdev) | |||
594 | 594 | ||
595 | DRM_DEBUG_KMS("%s\n", __FILE__); | 595 | DRM_DEBUG_KMS("%s\n", __FILE__); |
596 | 596 | ||
597 | ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); | 597 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); |
598 | if (!ctx) | 598 | if (!ctx) |
599 | return -ENOMEM; | 599 | return -ENOMEM; |
600 | 600 | ||
@@ -612,7 +612,7 @@ static int vidi_probe(struct platform_device *pdev) | |||
612 | 612 | ||
613 | platform_set_drvdata(pdev, ctx); | 613 | platform_set_drvdata(pdev, ctx); |
614 | 614 | ||
615 | ret = device_create_file(&pdev->dev, &dev_attr_connection); | 615 | ret = device_create_file(dev, &dev_attr_connection); |
616 | if (ret < 0) | 616 | if (ret < 0) |
617 | DRM_INFO("failed to create connection sysfs.\n"); | 617 | DRM_INFO("failed to create connection sysfs.\n"); |
618 | 618 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index bbfc3840080c..fd1426dca882 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -1946,14 +1946,14 @@ static int hdmi_probe(struct platform_device *pdev) | |||
1946 | 1946 | ||
1947 | DRM_DEBUG_KMS("[%d]\n", __LINE__); | 1947 | DRM_DEBUG_KMS("[%d]\n", __LINE__); |
1948 | 1948 | ||
1949 | if (pdev->dev.of_node) { | 1949 | if (dev->of_node) { |
1950 | pdata = drm_hdmi_dt_parse_pdata(dev); | 1950 | pdata = drm_hdmi_dt_parse_pdata(dev); |
1951 | if (IS_ERR(pdata)) { | 1951 | if (IS_ERR(pdata)) { |
1952 | DRM_ERROR("failed to parse dt\n"); | 1952 | DRM_ERROR("failed to parse dt\n"); |
1953 | return PTR_ERR(pdata); | 1953 | return PTR_ERR(pdata); |
1954 | } | 1954 | } |
1955 | } else { | 1955 | } else { |
1956 | pdata = pdev->dev.platform_data; | 1956 | pdata = dev->platform_data; |
1957 | } | 1957 | } |
1958 | 1958 | ||
1959 | if (!pdata) { | 1959 | if (!pdata) { |
@@ -1961,14 +1961,14 @@ static int hdmi_probe(struct platform_device *pdev) | |||
1961 | return -EINVAL; | 1961 | return -EINVAL; |
1962 | } | 1962 | } |
1963 | 1963 | ||
1964 | drm_hdmi_ctx = devm_kzalloc(&pdev->dev, sizeof(*drm_hdmi_ctx), | 1964 | drm_hdmi_ctx = devm_kzalloc(dev, sizeof(*drm_hdmi_ctx), |
1965 | GFP_KERNEL); | 1965 | GFP_KERNEL); |
1966 | if (!drm_hdmi_ctx) { | 1966 | if (!drm_hdmi_ctx) { |
1967 | DRM_ERROR("failed to allocate common hdmi context.\n"); | 1967 | DRM_ERROR("failed to allocate common hdmi context.\n"); |
1968 | return -ENOMEM; | 1968 | return -ENOMEM; |
1969 | } | 1969 | } |
1970 | 1970 | ||
1971 | hdata = devm_kzalloc(&pdev->dev, sizeof(struct hdmi_context), | 1971 | hdata = devm_kzalloc(dev, sizeof(struct hdmi_context), |
1972 | GFP_KERNEL); | 1972 | GFP_KERNEL); |
1973 | if (!hdata) { | 1973 | if (!hdata) { |
1974 | DRM_ERROR("out of memory\n"); | 1974 | DRM_ERROR("out of memory\n"); |
@@ -1985,7 +1985,7 @@ static int hdmi_probe(struct platform_device *pdev) | |||
1985 | if (dev->of_node) { | 1985 | if (dev->of_node) { |
1986 | const struct of_device_id *match; | 1986 | const struct of_device_id *match; |
1987 | match = of_match_node(of_match_ptr(hdmi_match_types), | 1987 | match = of_match_node(of_match_ptr(hdmi_match_types), |
1988 | pdev->dev.of_node); | 1988 | dev->of_node); |
1989 | if (match == NULL) | 1989 | if (match == NULL) |
1990 | return -ENODEV; | 1990 | return -ENODEV; |
1991 | hdata->type = (enum hdmi_type)match->data; | 1991 | hdata->type = (enum hdmi_type)match->data; |
@@ -2005,16 +2005,11 @@ static int hdmi_probe(struct platform_device *pdev) | |||
2005 | } | 2005 | } |
2006 | 2006 | ||
2007 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2007 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2008 | if (!res) { | 2008 | hdata->regs = devm_ioremap_resource(dev, res); |
2009 | DRM_ERROR("failed to find registers\n"); | ||
2010 | return -ENOENT; | ||
2011 | } | ||
2012 | |||
2013 | hdata->regs = devm_ioremap_resource(&pdev->dev, res); | ||
2014 | if (IS_ERR(hdata->regs)) | 2009 | if (IS_ERR(hdata->regs)) |
2015 | return PTR_ERR(hdata->regs); | 2010 | return PTR_ERR(hdata->regs); |
2016 | 2011 | ||
2017 | ret = devm_gpio_request(&pdev->dev, hdata->hpd_gpio, "HPD"); | 2012 | ret = devm_gpio_request(dev, hdata->hpd_gpio, "HPD"); |
2018 | if (ret) { | 2013 | if (ret) { |
2019 | DRM_ERROR("failed to request HPD gpio\n"); | 2014 | DRM_ERROR("failed to request HPD gpio\n"); |
2020 | return ret; | 2015 | return ret; |
@@ -2046,7 +2041,7 @@ static int hdmi_probe(struct platform_device *pdev) | |||
2046 | 2041 | ||
2047 | hdata->hpd = gpio_get_value(hdata->hpd_gpio); | 2042 | hdata->hpd = gpio_get_value(hdata->hpd_gpio); |
2048 | 2043 | ||
2049 | ret = request_threaded_irq(hdata->irq, NULL, | 2044 | ret = devm_request_threaded_irq(dev, hdata->irq, NULL, |
2050 | hdmi_irq_thread, IRQF_TRIGGER_RISING | | 2045 | hdmi_irq_thread, IRQF_TRIGGER_RISING | |
2051 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 2046 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
2052 | "hdmi", drm_hdmi_ctx); | 2047 | "hdmi", drm_hdmi_ctx); |
@@ -2075,16 +2070,11 @@ err_ddc: | |||
2075 | static int hdmi_remove(struct platform_device *pdev) | 2070 | static int hdmi_remove(struct platform_device *pdev) |
2076 | { | 2071 | { |
2077 | struct device *dev = &pdev->dev; | 2072 | struct device *dev = &pdev->dev; |
2078 | struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev); | ||
2079 | struct hdmi_context *hdata = ctx->ctx; | ||
2080 | 2073 | ||
2081 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 2074 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
2082 | 2075 | ||
2083 | pm_runtime_disable(dev); | 2076 | pm_runtime_disable(dev); |
2084 | 2077 | ||
2085 | free_irq(hdata->irq, hdata); | ||
2086 | |||
2087 | |||
2088 | /* hdmiphy i2c driver */ | 2078 | /* hdmiphy i2c driver */ |
2089 | i2c_del_driver(&hdmiphy_driver); | 2079 | i2c_del_driver(&hdmiphy_driver); |
2090 | /* DDC i2c driver */ | 2080 | /* DDC i2c driver */ |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index ec3e376b7e01..7c197d3820c5 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -1061,7 +1061,7 @@ static int mixer_resources_init(struct exynos_drm_hdmi_context *ctx, | |||
1061 | return -ENXIO; | 1061 | return -ENXIO; |
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | mixer_res->mixer_regs = devm_ioremap(&pdev->dev, res->start, | 1064 | mixer_res->mixer_regs = devm_ioremap(dev, res->start, |
1065 | resource_size(res)); | 1065 | resource_size(res)); |
1066 | if (mixer_res->mixer_regs == NULL) { | 1066 | if (mixer_res->mixer_regs == NULL) { |
1067 | dev_err(dev, "register mapping failed.\n"); | 1067 | dev_err(dev, "register mapping failed.\n"); |
@@ -1074,7 +1074,7 @@ static int mixer_resources_init(struct exynos_drm_hdmi_context *ctx, | |||
1074 | return -ENXIO; | 1074 | return -ENXIO; |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | ret = devm_request_irq(&pdev->dev, res->start, mixer_irq_handler, | 1077 | ret = devm_request_irq(dev, res->start, mixer_irq_handler, |
1078 | 0, "drm_mixer", ctx); | 1078 | 0, "drm_mixer", ctx); |
1079 | if (ret) { | 1079 | if (ret) { |
1080 | dev_err(dev, "request interrupt failed.\n"); | 1080 | dev_err(dev, "request interrupt failed.\n"); |
@@ -1118,7 +1118,7 @@ static int vp_resources_init(struct exynos_drm_hdmi_context *ctx, | |||
1118 | return -ENXIO; | 1118 | return -ENXIO; |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | mixer_res->vp_regs = devm_ioremap(&pdev->dev, res->start, | 1121 | mixer_res->vp_regs = devm_ioremap(dev, res->start, |
1122 | resource_size(res)); | 1122 | resource_size(res)); |
1123 | if (mixer_res->vp_regs == NULL) { | 1123 | if (mixer_res->vp_regs == NULL) { |
1124 | dev_err(dev, "register mapping failed.\n"); | 1124 | dev_err(dev, "register mapping failed.\n"); |
@@ -1169,14 +1169,14 @@ static int mixer_probe(struct platform_device *pdev) | |||
1169 | 1169 | ||
1170 | dev_info(dev, "probe start\n"); | 1170 | dev_info(dev, "probe start\n"); |
1171 | 1171 | ||
1172 | drm_hdmi_ctx = devm_kzalloc(&pdev->dev, sizeof(*drm_hdmi_ctx), | 1172 | drm_hdmi_ctx = devm_kzalloc(dev, sizeof(*drm_hdmi_ctx), |
1173 | GFP_KERNEL); | 1173 | GFP_KERNEL); |
1174 | if (!drm_hdmi_ctx) { | 1174 | if (!drm_hdmi_ctx) { |
1175 | DRM_ERROR("failed to allocate common hdmi context.\n"); | 1175 | DRM_ERROR("failed to allocate common hdmi context.\n"); |
1176 | return -ENOMEM; | 1176 | return -ENOMEM; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); | 1179 | ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); |
1180 | if (!ctx) { | 1180 | if (!ctx) { |
1181 | DRM_ERROR("failed to alloc mixer context.\n"); | 1181 | DRM_ERROR("failed to alloc mixer context.\n"); |
1182 | return -ENOMEM; | 1182 | return -ENOMEM; |
@@ -1187,14 +1187,14 @@ static int mixer_probe(struct platform_device *pdev) | |||
1187 | if (dev->of_node) { | 1187 | if (dev->of_node) { |
1188 | const struct of_device_id *match; | 1188 | const struct of_device_id *match; |
1189 | match = of_match_node(of_match_ptr(mixer_match_types), | 1189 | match = of_match_node(of_match_ptr(mixer_match_types), |
1190 | pdev->dev.of_node); | 1190 | dev->of_node); |
1191 | drv = (struct mixer_drv_data *)match->data; | 1191 | drv = (struct mixer_drv_data *)match->data; |
1192 | } else { | 1192 | } else { |
1193 | drv = (struct mixer_drv_data *) | 1193 | drv = (struct mixer_drv_data *) |
1194 | platform_get_device_id(pdev)->driver_data; | 1194 | platform_get_device_id(pdev)->driver_data; |
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | ctx->dev = &pdev->dev; | 1197 | ctx->dev = dev; |
1198 | ctx->parent_ctx = (void *)drm_hdmi_ctx; | 1198 | ctx->parent_ctx = (void *)drm_hdmi_ctx; |
1199 | drm_hdmi_ctx->ctx = (void *)ctx; | 1199 | drm_hdmi_ctx->ctx = (void *)ctx; |
1200 | ctx->vp_enabled = drv->is_vp_enabled; | 1200 | ctx->vp_enabled = drv->is_vp_enabled; |
diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c index 3cfd0931fbfb..82430ad8ba62 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_display.c +++ b/drivers/gpu/drm/gma500/cdv_intel_display.c | |||
@@ -1462,7 +1462,7 @@ static int cdv_intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1462 | size_t addr = 0; | 1462 | size_t addr = 0; |
1463 | struct gtt_range *gt; | 1463 | struct gtt_range *gt; |
1464 | struct drm_gem_object *obj; | 1464 | struct drm_gem_object *obj; |
1465 | int ret; | 1465 | int ret = 0; |
1466 | 1466 | ||
1467 | /* if we want to turn of the cursor ignore width and height */ | 1467 | /* if we want to turn of the cursor ignore width and height */ |
1468 | if (!handle) { | 1468 | if (!handle) { |
@@ -1499,7 +1499,8 @@ static int cdv_intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1499 | 1499 | ||
1500 | if (obj->size < width * height * 4) { | 1500 | if (obj->size < width * height * 4) { |
1501 | dev_dbg(dev->dev, "buffer is to small\n"); | 1501 | dev_dbg(dev->dev, "buffer is to small\n"); |
1502 | return -ENOMEM; | 1502 | ret = -ENOMEM; |
1503 | goto unref_cursor; | ||
1503 | } | 1504 | } |
1504 | 1505 | ||
1505 | gt = container_of(obj, struct gtt_range, gem); | 1506 | gt = container_of(obj, struct gtt_range, gem); |
@@ -1508,7 +1509,7 @@ static int cdv_intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1508 | ret = psb_gtt_pin(gt); | 1509 | ret = psb_gtt_pin(gt); |
1509 | if (ret) { | 1510 | if (ret) { |
1510 | dev_err(dev->dev, "Can not pin down handle 0x%x\n", handle); | 1511 | dev_err(dev->dev, "Can not pin down handle 0x%x\n", handle); |
1511 | return ret; | 1512 | goto unref_cursor; |
1512 | } | 1513 | } |
1513 | 1514 | ||
1514 | addr = gt->offset; /* Or resource.start ??? */ | 1515 | addr = gt->offset; /* Or resource.start ??? */ |
@@ -1532,9 +1533,14 @@ static int cdv_intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1532 | struct gtt_range, gem); | 1533 | struct gtt_range, gem); |
1533 | psb_gtt_unpin(gt); | 1534 | psb_gtt_unpin(gt); |
1534 | drm_gem_object_unreference(psb_intel_crtc->cursor_obj); | 1535 | drm_gem_object_unreference(psb_intel_crtc->cursor_obj); |
1535 | psb_intel_crtc->cursor_obj = obj; | ||
1536 | } | 1536 | } |
1537 | return 0; | 1537 | |
1538 | psb_intel_crtc->cursor_obj = obj; | ||
1539 | return ret; | ||
1540 | |||
1541 | unref_cursor: | ||
1542 | drm_gem_object_unreference(obj); | ||
1543 | return ret; | ||
1538 | } | 1544 | } |
1539 | 1545 | ||
1540 | static int cdv_intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) | 1546 | static int cdv_intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) |
@@ -1750,6 +1756,19 @@ static void cdv_intel_crtc_destroy(struct drm_crtc *crtc) | |||
1750 | kfree(psb_intel_crtc); | 1756 | kfree(psb_intel_crtc); |
1751 | } | 1757 | } |
1752 | 1758 | ||
1759 | static void cdv_intel_crtc_disable(struct drm_crtc *crtc) | ||
1760 | { | ||
1761 | struct gtt_range *gt; | ||
1762 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; | ||
1763 | |||
1764 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); | ||
1765 | |||
1766 | if (crtc->fb) { | ||
1767 | gt = to_psb_fb(crtc->fb)->gtt; | ||
1768 | psb_gtt_unpin(gt); | ||
1769 | } | ||
1770 | } | ||
1771 | |||
1753 | const struct drm_crtc_helper_funcs cdv_intel_helper_funcs = { | 1772 | const struct drm_crtc_helper_funcs cdv_intel_helper_funcs = { |
1754 | .dpms = cdv_intel_crtc_dpms, | 1773 | .dpms = cdv_intel_crtc_dpms, |
1755 | .mode_fixup = cdv_intel_crtc_mode_fixup, | 1774 | .mode_fixup = cdv_intel_crtc_mode_fixup, |
@@ -1757,6 +1776,7 @@ const struct drm_crtc_helper_funcs cdv_intel_helper_funcs = { | |||
1757 | .mode_set_base = cdv_intel_pipe_set_base, | 1776 | .mode_set_base = cdv_intel_pipe_set_base, |
1758 | .prepare = cdv_intel_crtc_prepare, | 1777 | .prepare = cdv_intel_crtc_prepare, |
1759 | .commit = cdv_intel_crtc_commit, | 1778 | .commit = cdv_intel_crtc_commit, |
1779 | .disable = cdv_intel_crtc_disable, | ||
1760 | }; | 1780 | }; |
1761 | 1781 | ||
1762 | const struct drm_crtc_funcs cdv_intel_crtc_funcs = { | 1782 | const struct drm_crtc_funcs cdv_intel_crtc_funcs = { |
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c index 1534e220097a..8b1b6d923abe 100644 --- a/drivers/gpu/drm/gma500/framebuffer.c +++ b/drivers/gpu/drm/gma500/framebuffer.c | |||
@@ -121,8 +121,8 @@ static int psbfb_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
121 | unsigned long address; | 121 | unsigned long address; |
122 | int ret; | 122 | int ret; |
123 | unsigned long pfn; | 123 | unsigned long pfn; |
124 | /* FIXME: assumes fb at stolen base which may not be true */ | 124 | unsigned long phys_addr = (unsigned long)dev_priv->stolen_base + |
125 | unsigned long phys_addr = (unsigned long)dev_priv->stolen_base; | 125 | psbfb->gtt->offset; |
126 | 126 | ||
127 | page_num = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 127 | page_num = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
128 | address = (unsigned long)vmf->virtual_address - (vmf->pgoff << PAGE_SHIFT); | 128 | address = (unsigned long)vmf->virtual_address - (vmf->pgoff << PAGE_SHIFT); |
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c index 6e8f42b61ff6..6666493789d1 100644 --- a/drivers/gpu/drm/gma500/psb_intel_display.c +++ b/drivers/gpu/drm/gma500/psb_intel_display.c | |||
@@ -843,7 +843,7 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
843 | struct gtt_range *cursor_gt = psb_intel_crtc->cursor_gt; | 843 | struct gtt_range *cursor_gt = psb_intel_crtc->cursor_gt; |
844 | struct drm_gem_object *obj; | 844 | struct drm_gem_object *obj; |
845 | void *tmp_dst, *tmp_src; | 845 | void *tmp_dst, *tmp_src; |
846 | int ret, i, cursor_pages; | 846 | int ret = 0, i, cursor_pages; |
847 | 847 | ||
848 | /* if we want to turn of the cursor ignore width and height */ | 848 | /* if we want to turn of the cursor ignore width and height */ |
849 | if (!handle) { | 849 | if (!handle) { |
@@ -880,7 +880,8 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
880 | 880 | ||
881 | if (obj->size < width * height * 4) { | 881 | if (obj->size < width * height * 4) { |
882 | dev_dbg(dev->dev, "buffer is to small\n"); | 882 | dev_dbg(dev->dev, "buffer is to small\n"); |
883 | return -ENOMEM; | 883 | ret = -ENOMEM; |
884 | goto unref_cursor; | ||
884 | } | 885 | } |
885 | 886 | ||
886 | gt = container_of(obj, struct gtt_range, gem); | 887 | gt = container_of(obj, struct gtt_range, gem); |
@@ -889,13 +890,14 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
889 | ret = psb_gtt_pin(gt); | 890 | ret = psb_gtt_pin(gt); |
890 | if (ret) { | 891 | if (ret) { |
891 | dev_err(dev->dev, "Can not pin down handle 0x%x\n", handle); | 892 | dev_err(dev->dev, "Can not pin down handle 0x%x\n", handle); |
892 | return ret; | 893 | goto unref_cursor; |
893 | } | 894 | } |
894 | 895 | ||
895 | if (dev_priv->ops->cursor_needs_phys) { | 896 | if (dev_priv->ops->cursor_needs_phys) { |
896 | if (cursor_gt == NULL) { | 897 | if (cursor_gt == NULL) { |
897 | dev_err(dev->dev, "No hardware cursor mem available"); | 898 | dev_err(dev->dev, "No hardware cursor mem available"); |
898 | return -ENOMEM; | 899 | ret = -ENOMEM; |
900 | goto unref_cursor; | ||
899 | } | 901 | } |
900 | 902 | ||
901 | /* Prevent overflow */ | 903 | /* Prevent overflow */ |
@@ -936,9 +938,14 @@ static int psb_intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
936 | struct gtt_range, gem); | 938 | struct gtt_range, gem); |
937 | psb_gtt_unpin(gt); | 939 | psb_gtt_unpin(gt); |
938 | drm_gem_object_unreference(psb_intel_crtc->cursor_obj); | 940 | drm_gem_object_unreference(psb_intel_crtc->cursor_obj); |
939 | psb_intel_crtc->cursor_obj = obj; | ||
940 | } | 941 | } |
941 | return 0; | 942 | |
943 | psb_intel_crtc->cursor_obj = obj; | ||
944 | return ret; | ||
945 | |||
946 | unref_cursor: | ||
947 | drm_gem_object_unreference(obj); | ||
948 | return ret; | ||
942 | } | 949 | } |
943 | 950 | ||
944 | static int psb_intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) | 951 | static int psb_intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) |
@@ -1150,6 +1157,19 @@ static void psb_intel_crtc_destroy(struct drm_crtc *crtc) | |||
1150 | kfree(psb_intel_crtc); | 1157 | kfree(psb_intel_crtc); |
1151 | } | 1158 | } |
1152 | 1159 | ||
1160 | static void psb_intel_crtc_disable(struct drm_crtc *crtc) | ||
1161 | { | ||
1162 | struct gtt_range *gt; | ||
1163 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; | ||
1164 | |||
1165 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); | ||
1166 | |||
1167 | if (crtc->fb) { | ||
1168 | gt = to_psb_fb(crtc->fb)->gtt; | ||
1169 | psb_gtt_unpin(gt); | ||
1170 | } | ||
1171 | } | ||
1172 | |||
1153 | const struct drm_crtc_helper_funcs psb_intel_helper_funcs = { | 1173 | const struct drm_crtc_helper_funcs psb_intel_helper_funcs = { |
1154 | .dpms = psb_intel_crtc_dpms, | 1174 | .dpms = psb_intel_crtc_dpms, |
1155 | .mode_fixup = psb_intel_crtc_mode_fixup, | 1175 | .mode_fixup = psb_intel_crtc_mode_fixup, |
@@ -1157,6 +1177,7 @@ const struct drm_crtc_helper_funcs psb_intel_helper_funcs = { | |||
1157 | .mode_set_base = psb_intel_pipe_set_base, | 1177 | .mode_set_base = psb_intel_pipe_set_base, |
1158 | .prepare = psb_intel_crtc_prepare, | 1178 | .prepare = psb_intel_crtc_prepare, |
1159 | .commit = psb_intel_crtc_commit, | 1179 | .commit = psb_intel_crtc_commit, |
1180 | .disable = psb_intel_crtc_disable, | ||
1160 | }; | 1181 | }; |
1161 | 1182 | ||
1162 | const struct drm_crtc_funcs psb_intel_crtc_funcs = { | 1183 | const struct drm_crtc_funcs psb_intel_crtc_funcs = { |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 9ebe895c17d6..a2e4953b8e8d 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -364,40 +364,64 @@ static const struct pci_device_id pciidlist[] = { /* aka */ | |||
364 | INTEL_VGA_DEVICE(0x016a, &intel_ivybridge_d_info), /* GT2 server */ | 364 | INTEL_VGA_DEVICE(0x016a, &intel_ivybridge_d_info), /* GT2 server */ |
365 | INTEL_VGA_DEVICE(0x0402, &intel_haswell_d_info), /* GT1 desktop */ | 365 | INTEL_VGA_DEVICE(0x0402, &intel_haswell_d_info), /* GT1 desktop */ |
366 | INTEL_VGA_DEVICE(0x0412, &intel_haswell_d_info), /* GT2 desktop */ | 366 | INTEL_VGA_DEVICE(0x0412, &intel_haswell_d_info), /* GT2 desktop */ |
367 | INTEL_VGA_DEVICE(0x0422, &intel_haswell_d_info), /* GT2 desktop */ | 367 | INTEL_VGA_DEVICE(0x0422, &intel_haswell_d_info), /* GT3 desktop */ |
368 | INTEL_VGA_DEVICE(0x040a, &intel_haswell_d_info), /* GT1 server */ | 368 | INTEL_VGA_DEVICE(0x040a, &intel_haswell_d_info), /* GT1 server */ |
369 | INTEL_VGA_DEVICE(0x041a, &intel_haswell_d_info), /* GT2 server */ | 369 | INTEL_VGA_DEVICE(0x041a, &intel_haswell_d_info), /* GT2 server */ |
370 | INTEL_VGA_DEVICE(0x042a, &intel_haswell_d_info), /* GT2 server */ | 370 | INTEL_VGA_DEVICE(0x042a, &intel_haswell_d_info), /* GT3 server */ |
371 | INTEL_VGA_DEVICE(0x0406, &intel_haswell_m_info), /* GT1 mobile */ | 371 | INTEL_VGA_DEVICE(0x0406, &intel_haswell_m_info), /* GT1 mobile */ |
372 | INTEL_VGA_DEVICE(0x0416, &intel_haswell_m_info), /* GT2 mobile */ | 372 | INTEL_VGA_DEVICE(0x0416, &intel_haswell_m_info), /* GT2 mobile */ |
373 | INTEL_VGA_DEVICE(0x0426, &intel_haswell_m_info), /* GT2 mobile */ | 373 | INTEL_VGA_DEVICE(0x0426, &intel_haswell_m_info), /* GT2 mobile */ |
374 | INTEL_VGA_DEVICE(0x040B, &intel_haswell_d_info), /* GT1 reserved */ | ||
375 | INTEL_VGA_DEVICE(0x041B, &intel_haswell_d_info), /* GT2 reserved */ | ||
376 | INTEL_VGA_DEVICE(0x042B, &intel_haswell_d_info), /* GT3 reserved */ | ||
377 | INTEL_VGA_DEVICE(0x040E, &intel_haswell_d_info), /* GT1 reserved */ | ||
378 | INTEL_VGA_DEVICE(0x041E, &intel_haswell_d_info), /* GT2 reserved */ | ||
379 | INTEL_VGA_DEVICE(0x042E, &intel_haswell_d_info), /* GT3 reserved */ | ||
374 | INTEL_VGA_DEVICE(0x0C02, &intel_haswell_d_info), /* SDV GT1 desktop */ | 380 | INTEL_VGA_DEVICE(0x0C02, &intel_haswell_d_info), /* SDV GT1 desktop */ |
375 | INTEL_VGA_DEVICE(0x0C12, &intel_haswell_d_info), /* SDV GT2 desktop */ | 381 | INTEL_VGA_DEVICE(0x0C12, &intel_haswell_d_info), /* SDV GT2 desktop */ |
376 | INTEL_VGA_DEVICE(0x0C22, &intel_haswell_d_info), /* SDV GT2 desktop */ | 382 | INTEL_VGA_DEVICE(0x0C22, &intel_haswell_d_info), /* SDV GT3 desktop */ |
377 | INTEL_VGA_DEVICE(0x0C0A, &intel_haswell_d_info), /* SDV GT1 server */ | 383 | INTEL_VGA_DEVICE(0x0C0A, &intel_haswell_d_info), /* SDV GT1 server */ |
378 | INTEL_VGA_DEVICE(0x0C1A, &intel_haswell_d_info), /* SDV GT2 server */ | 384 | INTEL_VGA_DEVICE(0x0C1A, &intel_haswell_d_info), /* SDV GT2 server */ |
379 | INTEL_VGA_DEVICE(0x0C2A, &intel_haswell_d_info), /* SDV GT2 server */ | 385 | INTEL_VGA_DEVICE(0x0C2A, &intel_haswell_d_info), /* SDV GT3 server */ |
380 | INTEL_VGA_DEVICE(0x0C06, &intel_haswell_m_info), /* SDV GT1 mobile */ | 386 | INTEL_VGA_DEVICE(0x0C06, &intel_haswell_m_info), /* SDV GT1 mobile */ |
381 | INTEL_VGA_DEVICE(0x0C16, &intel_haswell_m_info), /* SDV GT2 mobile */ | 387 | INTEL_VGA_DEVICE(0x0C16, &intel_haswell_m_info), /* SDV GT2 mobile */ |
382 | INTEL_VGA_DEVICE(0x0C26, &intel_haswell_m_info), /* SDV GT2 mobile */ | 388 | INTEL_VGA_DEVICE(0x0C26, &intel_haswell_m_info), /* SDV GT3 mobile */ |
389 | INTEL_VGA_DEVICE(0x0C0B, &intel_haswell_d_info), /* SDV GT1 reserved */ | ||
390 | INTEL_VGA_DEVICE(0x0C1B, &intel_haswell_d_info), /* SDV GT2 reserved */ | ||
391 | INTEL_VGA_DEVICE(0x0C2B, &intel_haswell_d_info), /* SDV GT3 reserved */ | ||
392 | INTEL_VGA_DEVICE(0x0C0E, &intel_haswell_d_info), /* SDV GT1 reserved */ | ||
393 | INTEL_VGA_DEVICE(0x0C1E, &intel_haswell_d_info), /* SDV GT2 reserved */ | ||
394 | INTEL_VGA_DEVICE(0x0C2E, &intel_haswell_d_info), /* SDV GT3 reserved */ | ||
383 | INTEL_VGA_DEVICE(0x0A02, &intel_haswell_d_info), /* ULT GT1 desktop */ | 395 | INTEL_VGA_DEVICE(0x0A02, &intel_haswell_d_info), /* ULT GT1 desktop */ |
384 | INTEL_VGA_DEVICE(0x0A12, &intel_haswell_d_info), /* ULT GT2 desktop */ | 396 | INTEL_VGA_DEVICE(0x0A12, &intel_haswell_d_info), /* ULT GT2 desktop */ |
385 | INTEL_VGA_DEVICE(0x0A22, &intel_haswell_d_info), /* ULT GT2 desktop */ | 397 | INTEL_VGA_DEVICE(0x0A22, &intel_haswell_d_info), /* ULT GT3 desktop */ |
386 | INTEL_VGA_DEVICE(0x0A0A, &intel_haswell_d_info), /* ULT GT1 server */ | 398 | INTEL_VGA_DEVICE(0x0A0A, &intel_haswell_d_info), /* ULT GT1 server */ |
387 | INTEL_VGA_DEVICE(0x0A1A, &intel_haswell_d_info), /* ULT GT2 server */ | 399 | INTEL_VGA_DEVICE(0x0A1A, &intel_haswell_d_info), /* ULT GT2 server */ |
388 | INTEL_VGA_DEVICE(0x0A2A, &intel_haswell_d_info), /* ULT GT2 server */ | 400 | INTEL_VGA_DEVICE(0x0A2A, &intel_haswell_d_info), /* ULT GT3 server */ |
389 | INTEL_VGA_DEVICE(0x0A06, &intel_haswell_m_info), /* ULT GT1 mobile */ | 401 | INTEL_VGA_DEVICE(0x0A06, &intel_haswell_m_info), /* ULT GT1 mobile */ |
390 | INTEL_VGA_DEVICE(0x0A16, &intel_haswell_m_info), /* ULT GT2 mobile */ | 402 | INTEL_VGA_DEVICE(0x0A16, &intel_haswell_m_info), /* ULT GT2 mobile */ |
391 | INTEL_VGA_DEVICE(0x0A26, &intel_haswell_m_info), /* ULT GT2 mobile */ | 403 | INTEL_VGA_DEVICE(0x0A26, &intel_haswell_m_info), /* ULT GT3 mobile */ |
404 | INTEL_VGA_DEVICE(0x0A0B, &intel_haswell_d_info), /* ULT GT1 reserved */ | ||
405 | INTEL_VGA_DEVICE(0x0A1B, &intel_haswell_d_info), /* ULT GT2 reserved */ | ||
406 | INTEL_VGA_DEVICE(0x0A2B, &intel_haswell_d_info), /* ULT GT3 reserved */ | ||
407 | INTEL_VGA_DEVICE(0x0A0E, &intel_haswell_m_info), /* ULT GT1 reserved */ | ||
408 | INTEL_VGA_DEVICE(0x0A1E, &intel_haswell_m_info), /* ULT GT2 reserved */ | ||
409 | INTEL_VGA_DEVICE(0x0A2E, &intel_haswell_m_info), /* ULT GT3 reserved */ | ||
392 | INTEL_VGA_DEVICE(0x0D02, &intel_haswell_d_info), /* CRW GT1 desktop */ | 410 | INTEL_VGA_DEVICE(0x0D02, &intel_haswell_d_info), /* CRW GT1 desktop */ |
393 | INTEL_VGA_DEVICE(0x0D12, &intel_haswell_d_info), /* CRW GT2 desktop */ | 411 | INTEL_VGA_DEVICE(0x0D12, &intel_haswell_d_info), /* CRW GT2 desktop */ |
394 | INTEL_VGA_DEVICE(0x0D22, &intel_haswell_d_info), /* CRW GT2 desktop */ | 412 | INTEL_VGA_DEVICE(0x0D22, &intel_haswell_d_info), /* CRW GT3 desktop */ |
395 | INTEL_VGA_DEVICE(0x0D0A, &intel_haswell_d_info), /* CRW GT1 server */ | 413 | INTEL_VGA_DEVICE(0x0D0A, &intel_haswell_d_info), /* CRW GT1 server */ |
396 | INTEL_VGA_DEVICE(0x0D1A, &intel_haswell_d_info), /* CRW GT2 server */ | 414 | INTEL_VGA_DEVICE(0x0D1A, &intel_haswell_d_info), /* CRW GT2 server */ |
397 | INTEL_VGA_DEVICE(0x0D2A, &intel_haswell_d_info), /* CRW GT2 server */ | 415 | INTEL_VGA_DEVICE(0x0D2A, &intel_haswell_d_info), /* CRW GT3 server */ |
398 | INTEL_VGA_DEVICE(0x0D06, &intel_haswell_m_info), /* CRW GT1 mobile */ | 416 | INTEL_VGA_DEVICE(0x0D06, &intel_haswell_m_info), /* CRW GT1 mobile */ |
399 | INTEL_VGA_DEVICE(0x0D16, &intel_haswell_m_info), /* CRW GT2 mobile */ | 417 | INTEL_VGA_DEVICE(0x0D16, &intel_haswell_m_info), /* CRW GT2 mobile */ |
400 | INTEL_VGA_DEVICE(0x0D26, &intel_haswell_m_info), /* CRW GT2 mobile */ | 418 | INTEL_VGA_DEVICE(0x0D26, &intel_haswell_m_info), /* CRW GT3 mobile */ |
419 | INTEL_VGA_DEVICE(0x0D0B, &intel_haswell_d_info), /* CRW GT1 reserved */ | ||
420 | INTEL_VGA_DEVICE(0x0D1B, &intel_haswell_d_info), /* CRW GT2 reserved */ | ||
421 | INTEL_VGA_DEVICE(0x0D2B, &intel_haswell_d_info), /* CRW GT3 reserved */ | ||
422 | INTEL_VGA_DEVICE(0x0D0E, &intel_haswell_d_info), /* CRW GT1 reserved */ | ||
423 | INTEL_VGA_DEVICE(0x0D1E, &intel_haswell_d_info), /* CRW GT2 reserved */ | ||
424 | INTEL_VGA_DEVICE(0x0D2E, &intel_haswell_d_info), /* CRW GT3 reserved */ | ||
401 | INTEL_VGA_DEVICE(0x0f30, &intel_valleyview_m_info), | 425 | INTEL_VGA_DEVICE(0x0f30, &intel_valleyview_m_info), |
402 | INTEL_VGA_DEVICE(0x0f31, &intel_valleyview_m_info), | 426 | INTEL_VGA_DEVICE(0x0f31, &intel_valleyview_m_info), |
403 | INTEL_VGA_DEVICE(0x0f32, &intel_valleyview_m_info), | 427 | INTEL_VGA_DEVICE(0x0f32, &intel_valleyview_m_info), |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index d5dcf7fe1ee9..b9d00dcf9a2d 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1943,4 +1943,19 @@ static inline void __user *to_user_ptr(u64 address) | |||
1943 | return (void __user *)(uintptr_t)address; | 1943 | return (void __user *)(uintptr_t)address; |
1944 | } | 1944 | } |
1945 | 1945 | ||
1946 | static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m) | ||
1947 | { | ||
1948 | unsigned long j = msecs_to_jiffies(m); | ||
1949 | |||
1950 | return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); | ||
1951 | } | ||
1952 | |||
1953 | static inline unsigned long | ||
1954 | timespec_to_jiffies_timeout(const struct timespec *value) | ||
1955 | { | ||
1956 | unsigned long j = timespec_to_jiffies(value); | ||
1957 | |||
1958 | return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); | ||
1959 | } | ||
1960 | |||
1946 | #endif | 1961 | #endif |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 6be940effefd..970ad17c99ab 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -91,14 +91,11 @@ i915_gem_wait_for_error(struct i915_gpu_error *error) | |||
91 | { | 91 | { |
92 | int ret; | 92 | int ret; |
93 | 93 | ||
94 | #define EXIT_COND (!i915_reset_in_progress(error)) | 94 | #define EXIT_COND (!i915_reset_in_progress(error) || \ |
95 | i915_terminally_wedged(error)) | ||
95 | if (EXIT_COND) | 96 | if (EXIT_COND) |
96 | return 0; | 97 | return 0; |
97 | 98 | ||
98 | /* GPU is already declared terminally dead, give up. */ | ||
99 | if (i915_terminally_wedged(error)) | ||
100 | return -EIO; | ||
101 | |||
102 | /* | 99 | /* |
103 | * Only wait 10 seconds for the gpu reset to complete to avoid hanging | 100 | * Only wait 10 seconds for the gpu reset to complete to avoid hanging |
104 | * userspace. If it takes that long something really bad is going on and | 101 | * userspace. If it takes that long something really bad is going on and |
@@ -1003,7 +1000,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno, | |||
1003 | wait_forever = false; | 1000 | wait_forever = false; |
1004 | } | 1001 | } |
1005 | 1002 | ||
1006 | timeout_jiffies = timespec_to_jiffies(&wait_time); | 1003 | timeout_jiffies = timespec_to_jiffies_timeout(&wait_time); |
1007 | 1004 | ||
1008 | if (WARN_ON(!ring->irq_get(ring))) | 1005 | if (WARN_ON(!ring->irq_get(ring))) |
1009 | return -ENODEV; | 1006 | return -ENODEV; |
@@ -1045,6 +1042,8 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno, | |||
1045 | if (timeout) { | 1042 | if (timeout) { |
1046 | struct timespec sleep_time = timespec_sub(now, before); | 1043 | struct timespec sleep_time = timespec_sub(now, before); |
1047 | *timeout = timespec_sub(*timeout, sleep_time); | 1044 | *timeout = timespec_sub(*timeout, sleep_time); |
1045 | if (!timespec_valid(timeout)) /* i.e. negative time remains */ | ||
1046 | set_normalized_timespec(timeout, 0, 0); | ||
1048 | } | 1047 | } |
1049 | 1048 | ||
1050 | switch (end) { | 1049 | switch (end) { |
@@ -1053,8 +1052,6 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno, | |||
1053 | case -ERESTARTSYS: /* Signal */ | 1052 | case -ERESTARTSYS: /* Signal */ |
1054 | return (int)end; | 1053 | return (int)end; |
1055 | case 0: /* Timeout */ | 1054 | case 0: /* Timeout */ |
1056 | if (timeout) | ||
1057 | set_normalized_timespec(timeout, 0, 0); | ||
1058 | return -ETIME; | 1055 | return -ETIME; |
1059 | default: /* Completed */ | 1056 | default: /* Completed */ |
1060 | WARN_ON(end < 0); /* We're not aware of other errors */ | 1057 | WARN_ON(end < 0); /* We're not aware of other errors */ |
@@ -2377,10 +2374,8 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
2377 | mutex_unlock(&dev->struct_mutex); | 2374 | mutex_unlock(&dev->struct_mutex); |
2378 | 2375 | ||
2379 | ret = __wait_seqno(ring, seqno, reset_counter, true, timeout); | 2376 | ret = __wait_seqno(ring, seqno, reset_counter, true, timeout); |
2380 | if (timeout) { | 2377 | if (timeout) |
2381 | WARN_ON(!timespec_valid(timeout)); | ||
2382 | args->timeout_ns = timespec_to_ns(timeout); | 2378 | args->timeout_ns = timespec_to_ns(timeout); |
2383 | } | ||
2384 | return ret; | 2379 | return ret; |
2385 | 2380 | ||
2386 | out: | 2381 | out: |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index dca614de71b6..bdb0d7717bc7 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -709,15 +709,6 @@ static inline size_t gen6_get_stolen_size(u16 snb_gmch_ctl) | |||
709 | return snb_gmch_ctl << 25; /* 32 MB units */ | 709 | return snb_gmch_ctl << 25; /* 32 MB units */ |
710 | } | 710 | } |
711 | 711 | ||
712 | static inline size_t gen7_get_stolen_size(u16 snb_gmch_ctl) | ||
713 | { | ||
714 | static const int stolen_decoder[] = { | ||
715 | 0, 0, 0, 0, 0, 32, 48, 64, 128, 256, 96, 160, 224, 352}; | ||
716 | snb_gmch_ctl >>= IVB_GMCH_GMS_SHIFT; | ||
717 | snb_gmch_ctl &= IVB_GMCH_GMS_MASK; | ||
718 | return stolen_decoder[snb_gmch_ctl] << 20; | ||
719 | } | ||
720 | |||
721 | static int gen6_gmch_probe(struct drm_device *dev, | 712 | static int gen6_gmch_probe(struct drm_device *dev, |
722 | size_t *gtt_total, | 713 | size_t *gtt_total, |
723 | size_t *stolen, | 714 | size_t *stolen, |
@@ -747,11 +738,7 @@ static int gen6_gmch_probe(struct drm_device *dev, | |||
747 | pci_read_config_word(dev->pdev, SNB_GMCH_CTRL, &snb_gmch_ctl); | 738 | pci_read_config_word(dev->pdev, SNB_GMCH_CTRL, &snb_gmch_ctl); |
748 | gtt_size = gen6_get_total_gtt_size(snb_gmch_ctl); | 739 | gtt_size = gen6_get_total_gtt_size(snb_gmch_ctl); |
749 | 740 | ||
750 | if (IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) | 741 | *stolen = gen6_get_stolen_size(snb_gmch_ctl); |
751 | *stolen = gen7_get_stolen_size(snb_gmch_ctl); | ||
752 | else | ||
753 | *stolen = gen6_get_stolen_size(snb_gmch_ctl); | ||
754 | |||
755 | *gtt_total = (gtt_size / sizeof(gen6_gtt_pte_t)) << PAGE_SHIFT; | 742 | *gtt_total = (gtt_size / sizeof(gen6_gtt_pte_t)) << PAGE_SHIFT; |
756 | 743 | ||
757 | /* For Modern GENs the PTEs and register space are split in the BAR */ | 744 | /* For Modern GENs the PTEs and register space are split in the BAR */ |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 83f9c26e1adb..2d6b62e42daf 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -46,8 +46,6 @@ | |||
46 | #define SNB_GMCH_GGMS_MASK 0x3 | 46 | #define SNB_GMCH_GGMS_MASK 0x3 |
47 | #define SNB_GMCH_GMS_SHIFT 3 /* Graphics Mode Select */ | 47 | #define SNB_GMCH_GMS_SHIFT 3 /* Graphics Mode Select */ |
48 | #define SNB_GMCH_GMS_MASK 0x1f | 48 | #define SNB_GMCH_GMS_MASK 0x1f |
49 | #define IVB_GMCH_GMS_SHIFT 4 | ||
50 | #define IVB_GMCH_GMS_MASK 0xf | ||
51 | 49 | ||
52 | 50 | ||
53 | /* PCI config space */ | 51 | /* PCI config space */ |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 26a0a570f92e..fb961bb81903 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -1265,6 +1265,8 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder) | |||
1265 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); | 1265 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); |
1266 | intel_dp_start_link_train(intel_dp); | 1266 | intel_dp_start_link_train(intel_dp); |
1267 | intel_dp_complete_link_train(intel_dp); | 1267 | intel_dp_complete_link_train(intel_dp); |
1268 | if (port != PORT_A) | ||
1269 | intel_dp_stop_link_train(intel_dp); | ||
1268 | } | 1270 | } |
1269 | } | 1271 | } |
1270 | 1272 | ||
@@ -1326,6 +1328,9 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder) | |||
1326 | } else if (type == INTEL_OUTPUT_EDP) { | 1328 | } else if (type == INTEL_OUTPUT_EDP) { |
1327 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 1329 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
1328 | 1330 | ||
1331 | if (port == PORT_A) | ||
1332 | intel_dp_stop_link_train(intel_dp); | ||
1333 | |||
1329 | ironlake_edp_backlight_on(intel_dp); | 1334 | ironlake_edp_backlight_on(intel_dp); |
1330 | } | 1335 | } |
1331 | 1336 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index efe829919755..56746dcac40f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -7937,6 +7937,11 @@ intel_modeset_check_state(struct drm_device *dev) | |||
7937 | memset(&pipe_config, 0, sizeof(pipe_config)); | 7937 | memset(&pipe_config, 0, sizeof(pipe_config)); |
7938 | active = dev_priv->display.get_pipe_config(crtc, | 7938 | active = dev_priv->display.get_pipe_config(crtc, |
7939 | &pipe_config); | 7939 | &pipe_config); |
7940 | |||
7941 | /* hw state is inconsistent with the pipe A quirk */ | ||
7942 | if (crtc->pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE) | ||
7943 | active = crtc->active; | ||
7944 | |||
7940 | WARN(crtc->active != active, | 7945 | WARN(crtc->active != active, |
7941 | "crtc active state doesn't match with hw state " | 7946 | "crtc active state doesn't match with hw state " |
7942 | "(expected %i, found %i)\n", crtc->active, active); | 7947 | "(expected %i, found %i)\n", crtc->active, active); |
@@ -8140,6 +8145,21 @@ static void intel_set_config_restore_state(struct drm_device *dev, | |||
8140 | } | 8145 | } |
8141 | } | 8146 | } |
8142 | 8147 | ||
8148 | static bool | ||
8149 | is_crtc_connector_off(struct drm_crtc *crtc, struct drm_connector *connectors, | ||
8150 | int num_connectors) | ||
8151 | { | ||
8152 | int i; | ||
8153 | |||
8154 | for (i = 0; i < num_connectors; i++) | ||
8155 | if (connectors[i].encoder && | ||
8156 | connectors[i].encoder->crtc == crtc && | ||
8157 | connectors[i].dpms != DRM_MODE_DPMS_ON) | ||
8158 | return true; | ||
8159 | |||
8160 | return false; | ||
8161 | } | ||
8162 | |||
8143 | static void | 8163 | static void |
8144 | intel_set_config_compute_mode_changes(struct drm_mode_set *set, | 8164 | intel_set_config_compute_mode_changes(struct drm_mode_set *set, |
8145 | struct intel_set_config *config) | 8165 | struct intel_set_config *config) |
@@ -8147,7 +8167,11 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set, | |||
8147 | 8167 | ||
8148 | /* We should be able to check here if the fb has the same properties | 8168 | /* We should be able to check here if the fb has the same properties |
8149 | * and then just flip_or_move it */ | 8169 | * and then just flip_or_move it */ |
8150 | if (set->crtc->fb != set->fb) { | 8170 | if (set->connectors != NULL && |
8171 | is_crtc_connector_off(set->crtc, *set->connectors, | ||
8172 | set->num_connectors)) { | ||
8173 | config->mode_changed = true; | ||
8174 | } else if (set->crtc->fb != set->fb) { | ||
8151 | /* If we have no fb then treat it as a full mode set */ | 8175 | /* If we have no fb then treat it as a full mode set */ |
8152 | if (set->crtc->fb == NULL) { | 8176 | if (set->crtc->fb == NULL) { |
8153 | DRM_DEBUG_KMS("crtc has no fb, full mode set\n"); | 8177 | DRM_DEBUG_KMS("crtc has no fb, full mode set\n"); |
@@ -8157,8 +8181,9 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set, | |||
8157 | } else if (set->fb->pixel_format != | 8181 | } else if (set->fb->pixel_format != |
8158 | set->crtc->fb->pixel_format) { | 8182 | set->crtc->fb->pixel_format) { |
8159 | config->mode_changed = true; | 8183 | config->mode_changed = true; |
8160 | } else | 8184 | } else { |
8161 | config->fb_changed = true; | 8185 | config->fb_changed = true; |
8186 | } | ||
8162 | } | 8187 | } |
8163 | 8188 | ||
8164 | if (set->fb && (set->x != set->crtc->x || set->y != set->crtc->y)) | 8189 | if (set->fb && (set->x != set->crtc->x || set->y != set->crtc->y)) |
@@ -8332,11 +8357,6 @@ static int intel_crtc_set_config(struct drm_mode_set *set) | |||
8332 | 8357 | ||
8333 | ret = intel_set_mode(set->crtc, set->mode, | 8358 | ret = intel_set_mode(set->crtc, set->mode, |
8334 | set->x, set->y, set->fb); | 8359 | set->x, set->y, set->fb); |
8335 | if (ret) { | ||
8336 | DRM_ERROR("failed to set mode on [CRTC:%d], err = %d\n", | ||
8337 | set->crtc->base.id, ret); | ||
8338 | goto fail; | ||
8339 | } | ||
8340 | } else if (config->fb_changed) { | 8360 | } else if (config->fb_changed) { |
8341 | intel_crtc_wait_for_pending_flips(set->crtc); | 8361 | intel_crtc_wait_for_pending_flips(set->crtc); |
8342 | 8362 | ||
@@ -8344,18 +8364,18 @@ static int intel_crtc_set_config(struct drm_mode_set *set) | |||
8344 | set->x, set->y, set->fb); | 8364 | set->x, set->y, set->fb); |
8345 | } | 8365 | } |
8346 | 8366 | ||
8347 | intel_set_config_free(config); | 8367 | if (ret) { |
8348 | 8368 | DRM_ERROR("failed to set mode on [CRTC:%d], err = %d\n", | |
8349 | return 0; | 8369 | set->crtc->base.id, ret); |
8350 | |||
8351 | fail: | 8370 | fail: |
8352 | intel_set_config_restore_state(dev, config); | 8371 | intel_set_config_restore_state(dev, config); |
8353 | 8372 | ||
8354 | /* Try to restore the config */ | 8373 | /* Try to restore the config */ |
8355 | if (config->mode_changed && | 8374 | if (config->mode_changed && |
8356 | intel_set_mode(save_set.crtc, save_set.mode, | 8375 | intel_set_mode(save_set.crtc, save_set.mode, |
8357 | save_set.x, save_set.y, save_set.fb)) | 8376 | save_set.x, save_set.y, save_set.fb)) |
8358 | DRM_ERROR("failed to restore config after modeset failure\n"); | 8377 | DRM_ERROR("failed to restore config after modeset failure\n"); |
8378 | } | ||
8359 | 8379 | ||
8360 | out_config: | 8380 | out_config: |
8361 | intel_set_config_free(config); | 8381 | intel_set_config_free(config); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index fb2fbc1e08b9..70789b1b5642 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -303,7 +303,7 @@ intel_dp_aux_wait_done(struct intel_dp *intel_dp, bool has_aux_irq) | |||
303 | #define C (((status = I915_READ_NOTRACE(ch_ctl)) & DP_AUX_CH_CTL_SEND_BUSY) == 0) | 303 | #define C (((status = I915_READ_NOTRACE(ch_ctl)) & DP_AUX_CH_CTL_SEND_BUSY) == 0) |
304 | if (has_aux_irq) | 304 | if (has_aux_irq) |
305 | done = wait_event_timeout(dev_priv->gmbus_wait_queue, C, | 305 | done = wait_event_timeout(dev_priv->gmbus_wait_queue, C, |
306 | msecs_to_jiffies(10)); | 306 | msecs_to_jiffies_timeout(10)); |
307 | else | 307 | else |
308 | done = wait_for_atomic(C, 10) == 0; | 308 | done = wait_for_atomic(C, 10) == 0; |
309 | if (!done) | 309 | if (!done) |
@@ -702,6 +702,9 @@ intel_dp_compute_config(struct intel_encoder *encoder, | |||
702 | /* Walk through all bpp values. Luckily they're all nicely spaced with 2 | 702 | /* Walk through all bpp values. Luckily they're all nicely spaced with 2 |
703 | * bpc in between. */ | 703 | * bpc in between. */ |
704 | bpp = min_t(int, 8*3, pipe_config->pipe_bpp); | 704 | bpp = min_t(int, 8*3, pipe_config->pipe_bpp); |
705 | if (is_edp(intel_dp) && dev_priv->edp.bpp) | ||
706 | bpp = min_t(int, bpp, dev_priv->edp.bpp); | ||
707 | |||
705 | for (; bpp >= 6*3; bpp -= 2*3) { | 708 | for (; bpp >= 6*3; bpp -= 2*3) { |
706 | mode_rate = intel_dp_link_required(target_clock, bpp); | 709 | mode_rate = intel_dp_link_required(target_clock, bpp); |
707 | 710 | ||
@@ -739,6 +742,7 @@ found: | |||
739 | intel_dp->link_bw = bws[clock]; | 742 | intel_dp->link_bw = bws[clock]; |
740 | intel_dp->lane_count = lane_count; | 743 | intel_dp->lane_count = lane_count; |
741 | adjusted_mode->clock = drm_dp_bw_code_to_link_rate(intel_dp->link_bw); | 744 | adjusted_mode->clock = drm_dp_bw_code_to_link_rate(intel_dp->link_bw); |
745 | pipe_config->pipe_bpp = bpp; | ||
742 | pipe_config->pixel_target_clock = target_clock; | 746 | pipe_config->pixel_target_clock = target_clock; |
743 | 747 | ||
744 | DRM_DEBUG_KMS("DP link bw %02x lane count %d clock %d bpp %d\n", | 748 | DRM_DEBUG_KMS("DP link bw %02x lane count %d clock %d bpp %d\n", |
@@ -751,20 +755,6 @@ found: | |||
751 | target_clock, adjusted_mode->clock, | 755 | target_clock, adjusted_mode->clock, |
752 | &pipe_config->dp_m_n); | 756 | &pipe_config->dp_m_n); |
753 | 757 | ||
754 | /* | ||
755 | * XXX: We have a strange regression where using the vbt edp bpp value | ||
756 | * for the link bw computation results in black screens, the panel only | ||
757 | * works when we do the computation at the usual 24bpp (but still | ||
758 | * requires us to use 18bpp). Until that's fully debugged, stay | ||
759 | * bug-for-bug compatible with the old code. | ||
760 | */ | ||
761 | if (is_edp(intel_dp) && dev_priv->edp.bpp) { | ||
762 | DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", | ||
763 | bpp, dev_priv->edp.bpp); | ||
764 | bpp = min_t(int, bpp, dev_priv->edp.bpp); | ||
765 | } | ||
766 | pipe_config->pipe_bpp = bpp; | ||
767 | |||
768 | return true; | 758 | return true; |
769 | } | 759 | } |
770 | 760 | ||
@@ -1389,6 +1379,7 @@ static void intel_enable_dp(struct intel_encoder *encoder) | |||
1389 | ironlake_edp_panel_on(intel_dp); | 1379 | ironlake_edp_panel_on(intel_dp); |
1390 | ironlake_edp_panel_vdd_off(intel_dp, true); | 1380 | ironlake_edp_panel_vdd_off(intel_dp, true); |
1391 | intel_dp_complete_link_train(intel_dp); | 1381 | intel_dp_complete_link_train(intel_dp); |
1382 | intel_dp_stop_link_train(intel_dp); | ||
1392 | ironlake_edp_backlight_on(intel_dp); | 1383 | ironlake_edp_backlight_on(intel_dp); |
1393 | } | 1384 | } |
1394 | 1385 | ||
@@ -1711,10 +1702,9 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, | |||
1711 | struct drm_i915_private *dev_priv = dev->dev_private; | 1702 | struct drm_i915_private *dev_priv = dev->dev_private; |
1712 | enum port port = intel_dig_port->port; | 1703 | enum port port = intel_dig_port->port; |
1713 | int ret; | 1704 | int ret; |
1714 | uint32_t temp; | ||
1715 | 1705 | ||
1716 | if (HAS_DDI(dev)) { | 1706 | if (HAS_DDI(dev)) { |
1717 | temp = I915_READ(DP_TP_CTL(port)); | 1707 | uint32_t temp = I915_READ(DP_TP_CTL(port)); |
1718 | 1708 | ||
1719 | if (dp_train_pat & DP_LINK_SCRAMBLING_DISABLE) | 1709 | if (dp_train_pat & DP_LINK_SCRAMBLING_DISABLE) |
1720 | temp |= DP_TP_CTL_SCRAMBLE_DISABLE; | 1710 | temp |= DP_TP_CTL_SCRAMBLE_DISABLE; |
@@ -1724,18 +1714,6 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, | |||
1724 | temp &= ~DP_TP_CTL_LINK_TRAIN_MASK; | 1714 | temp &= ~DP_TP_CTL_LINK_TRAIN_MASK; |
1725 | switch (dp_train_pat & DP_TRAINING_PATTERN_MASK) { | 1715 | switch (dp_train_pat & DP_TRAINING_PATTERN_MASK) { |
1726 | case DP_TRAINING_PATTERN_DISABLE: | 1716 | case DP_TRAINING_PATTERN_DISABLE: |
1727 | |||
1728 | if (port != PORT_A) { | ||
1729 | temp |= DP_TP_CTL_LINK_TRAIN_IDLE; | ||
1730 | I915_WRITE(DP_TP_CTL(port), temp); | ||
1731 | |||
1732 | if (wait_for((I915_READ(DP_TP_STATUS(port)) & | ||
1733 | DP_TP_STATUS_IDLE_DONE), 1)) | ||
1734 | DRM_ERROR("Timed out waiting for DP idle patterns\n"); | ||
1735 | |||
1736 | temp &= ~DP_TP_CTL_LINK_TRAIN_MASK; | ||
1737 | } | ||
1738 | |||
1739 | temp |= DP_TP_CTL_LINK_TRAIN_NORMAL; | 1717 | temp |= DP_TP_CTL_LINK_TRAIN_NORMAL; |
1740 | 1718 | ||
1741 | break; | 1719 | break; |
@@ -1811,6 +1789,37 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, | |||
1811 | return true; | 1789 | return true; |
1812 | } | 1790 | } |
1813 | 1791 | ||
1792 | static void intel_dp_set_idle_link_train(struct intel_dp *intel_dp) | ||
1793 | { | ||
1794 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
1795 | struct drm_device *dev = intel_dig_port->base.base.dev; | ||
1796 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1797 | enum port port = intel_dig_port->port; | ||
1798 | uint32_t val; | ||
1799 | |||
1800 | if (!HAS_DDI(dev)) | ||
1801 | return; | ||
1802 | |||
1803 | val = I915_READ(DP_TP_CTL(port)); | ||
1804 | val &= ~DP_TP_CTL_LINK_TRAIN_MASK; | ||
1805 | val |= DP_TP_CTL_LINK_TRAIN_IDLE; | ||
1806 | I915_WRITE(DP_TP_CTL(port), val); | ||
1807 | |||
1808 | /* | ||
1809 | * On PORT_A we can have only eDP in SST mode. There the only reason | ||
1810 | * we need to set idle transmission mode is to work around a HW issue | ||
1811 | * where we enable the pipe while not in idle link-training mode. | ||
1812 | * In this case there is requirement to wait for a minimum number of | ||
1813 | * idle patterns to be sent. | ||
1814 | */ | ||
1815 | if (port == PORT_A) | ||
1816 | return; | ||
1817 | |||
1818 | if (wait_for((I915_READ(DP_TP_STATUS(port)) & DP_TP_STATUS_IDLE_DONE), | ||
1819 | 1)) | ||
1820 | DRM_ERROR("Timed out waiting for DP idle patterns\n"); | ||
1821 | } | ||
1822 | |||
1814 | /* Enable corresponding port and start training pattern 1 */ | 1823 | /* Enable corresponding port and start training pattern 1 */ |
1815 | void | 1824 | void |
1816 | intel_dp_start_link_train(struct intel_dp *intel_dp) | 1825 | intel_dp_start_link_train(struct intel_dp *intel_dp) |
@@ -1953,10 +1962,19 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1953 | ++tries; | 1962 | ++tries; |
1954 | } | 1963 | } |
1955 | 1964 | ||
1965 | intel_dp_set_idle_link_train(intel_dp); | ||
1966 | |||
1967 | intel_dp->DP = DP; | ||
1968 | |||
1956 | if (channel_eq) | 1969 | if (channel_eq) |
1957 | DRM_DEBUG_KMS("Channel EQ done. DP Training successful\n"); | 1970 | DRM_DEBUG_KMS("Channel EQ done. DP Training successful\n"); |
1958 | 1971 | ||
1959 | intel_dp_set_link_train(intel_dp, DP, DP_TRAINING_PATTERN_DISABLE); | 1972 | } |
1973 | |||
1974 | void intel_dp_stop_link_train(struct intel_dp *intel_dp) | ||
1975 | { | ||
1976 | intel_dp_set_link_train(intel_dp, intel_dp->DP, | ||
1977 | DP_TRAINING_PATTERN_DISABLE); | ||
1960 | } | 1978 | } |
1961 | 1979 | ||
1962 | static void | 1980 | static void |
@@ -2164,6 +2182,7 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) | |||
2164 | drm_get_encoder_name(&intel_encoder->base)); | 2182 | drm_get_encoder_name(&intel_encoder->base)); |
2165 | intel_dp_start_link_train(intel_dp); | 2183 | intel_dp_start_link_train(intel_dp); |
2166 | intel_dp_complete_link_train(intel_dp); | 2184 | intel_dp_complete_link_train(intel_dp); |
2185 | intel_dp_stop_link_train(intel_dp); | ||
2167 | } | 2186 | } |
2168 | } | 2187 | } |
2169 | 2188 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index b5b6d19e6dd3..624a9e6b8d71 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -499,6 +499,7 @@ extern void intel_dp_init_connector(struct intel_digital_port *intel_dig_port, | |||
499 | extern void intel_dp_init_link_config(struct intel_dp *intel_dp); | 499 | extern void intel_dp_init_link_config(struct intel_dp *intel_dp); |
500 | extern void intel_dp_start_link_train(struct intel_dp *intel_dp); | 500 | extern void intel_dp_start_link_train(struct intel_dp *intel_dp); |
501 | extern void intel_dp_complete_link_train(struct intel_dp *intel_dp); | 501 | extern void intel_dp_complete_link_train(struct intel_dp *intel_dp); |
502 | extern void intel_dp_stop_link_train(struct intel_dp *intel_dp); | ||
502 | extern void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode); | 503 | extern void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode); |
503 | extern void intel_dp_encoder_destroy(struct drm_encoder *encoder); | 504 | extern void intel_dp_encoder_destroy(struct drm_encoder *encoder); |
504 | extern void intel_dp_check_link_status(struct intel_dp *intel_dp); | 505 | extern void intel_dp_check_link_status(struct intel_dp *intel_dp); |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 0e19e575a1b4..6b7c3ca2c035 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -262,10 +262,22 @@ void intel_fbdev_fini(struct drm_device *dev) | |||
262 | void intel_fbdev_set_suspend(struct drm_device *dev, int state) | 262 | void intel_fbdev_set_suspend(struct drm_device *dev, int state) |
263 | { | 263 | { |
264 | drm_i915_private_t *dev_priv = dev->dev_private; | 264 | drm_i915_private_t *dev_priv = dev->dev_private; |
265 | if (!dev_priv->fbdev) | 265 | struct intel_fbdev *ifbdev = dev_priv->fbdev; |
266 | struct fb_info *info; | ||
267 | |||
268 | if (!ifbdev) | ||
266 | return; | 269 | return; |
267 | 270 | ||
268 | fb_set_suspend(dev_priv->fbdev->helper.fbdev, state); | 271 | info = ifbdev->helper.fbdev; |
272 | |||
273 | /* On resume from hibernation: If the object is shmemfs backed, it has | ||
274 | * been restored from swap. If the object is stolen however, it will be | ||
275 | * full of whatever garbage was left in there. | ||
276 | */ | ||
277 | if (!state && ifbdev->ifb.obj->stolen) | ||
278 | memset_io(info->screen_base, 0, info->screen_size); | ||
279 | |||
280 | fb_set_suspend(info, state); | ||
269 | } | 281 | } |
270 | 282 | ||
271 | MODULE_LICENSE("GPL and additional rights"); | 283 | MODULE_LICENSE("GPL and additional rights"); |
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index 5d245031e391..639fe192997c 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
@@ -228,7 +228,7 @@ gmbus_wait_hw_status(struct drm_i915_private *dev_priv, | |||
228 | * need to wake up periodically and check that ourselves. */ | 228 | * need to wake up periodically and check that ourselves. */ |
229 | I915_WRITE(GMBUS4 + reg_offset, gmbus4_irq_en); | 229 | I915_WRITE(GMBUS4 + reg_offset, gmbus4_irq_en); |
230 | 230 | ||
231 | for (i = 0; i < msecs_to_jiffies(50) + 1; i++) { | 231 | for (i = 0; i < msecs_to_jiffies_timeout(50); i++) { |
232 | prepare_to_wait(&dev_priv->gmbus_wait_queue, &wait, | 232 | prepare_to_wait(&dev_priv->gmbus_wait_queue, &wait, |
233 | TASK_UNINTERRUPTIBLE); | 233 | TASK_UNINTERRUPTIBLE); |
234 | 234 | ||
@@ -263,7 +263,8 @@ gmbus_wait_idle(struct drm_i915_private *dev_priv) | |||
263 | /* Important: The hw handles only the first bit, so set only one! */ | 263 | /* Important: The hw handles only the first bit, so set only one! */ |
264 | I915_WRITE(GMBUS4 + reg_offset, GMBUS_IDLE_EN); | 264 | I915_WRITE(GMBUS4 + reg_offset, GMBUS_IDLE_EN); |
265 | 265 | ||
266 | ret = wait_event_timeout(dev_priv->gmbus_wait_queue, C, 10); | 266 | ret = wait_event_timeout(dev_priv->gmbus_wait_queue, C, |
267 | msecs_to_jiffies_timeout(10)); | ||
267 | 268 | ||
268 | I915_WRITE(GMBUS4 + reg_offset, 0); | 269 | I915_WRITE(GMBUS4 + reg_offset, 0); |
269 | 270 | ||
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index f36f1baabd5a..29412cc89c7a 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -815,10 +815,10 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
815 | }, | 815 | }, |
816 | { | 816 | { |
817 | .callback = intel_no_lvds_dmi_callback, | 817 | .callback = intel_no_lvds_dmi_callback, |
818 | .ident = "Hewlett-Packard HP t5740e Thin Client", | 818 | .ident = "Hewlett-Packard HP t5740", |
819 | .matches = { | 819 | .matches = { |
820 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 820 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
821 | DMI_MATCH(DMI_PRODUCT_NAME, "HP t5740e Thin Client"), | 821 | DMI_MATCH(DMI_PRODUCT_NAME, " t5740"), |
822 | }, | 822 | }, |
823 | }, | 823 | }, |
824 | { | 824 | { |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index de3b0dc5658b..aa01128ff192 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -1301,17 +1301,17 @@ static void valleyview_update_wm(struct drm_device *dev) | |||
1301 | 1301 | ||
1302 | vlv_update_drain_latency(dev); | 1302 | vlv_update_drain_latency(dev); |
1303 | 1303 | ||
1304 | if (g4x_compute_wm0(dev, 0, | 1304 | if (g4x_compute_wm0(dev, PIPE_A, |
1305 | &valleyview_wm_info, latency_ns, | 1305 | &valleyview_wm_info, latency_ns, |
1306 | &valleyview_cursor_wm_info, latency_ns, | 1306 | &valleyview_cursor_wm_info, latency_ns, |
1307 | &planea_wm, &cursora_wm)) | 1307 | &planea_wm, &cursora_wm)) |
1308 | enabled |= 1; | 1308 | enabled |= 1 << PIPE_A; |
1309 | 1309 | ||
1310 | if (g4x_compute_wm0(dev, 1, | 1310 | if (g4x_compute_wm0(dev, PIPE_B, |
1311 | &valleyview_wm_info, latency_ns, | 1311 | &valleyview_wm_info, latency_ns, |
1312 | &valleyview_cursor_wm_info, latency_ns, | 1312 | &valleyview_cursor_wm_info, latency_ns, |
1313 | &planeb_wm, &cursorb_wm)) | 1313 | &planeb_wm, &cursorb_wm)) |
1314 | enabled |= 2; | 1314 | enabled |= 1 << PIPE_B; |
1315 | 1315 | ||
1316 | if (single_plane_enabled(enabled) && | 1316 | if (single_plane_enabled(enabled) && |
1317 | g4x_compute_srwm(dev, ffs(enabled) - 1, | 1317 | g4x_compute_srwm(dev, ffs(enabled) - 1, |
@@ -1357,17 +1357,17 @@ static void g4x_update_wm(struct drm_device *dev) | |||
1357 | int plane_sr, cursor_sr; | 1357 | int plane_sr, cursor_sr; |
1358 | unsigned int enabled = 0; | 1358 | unsigned int enabled = 0; |
1359 | 1359 | ||
1360 | if (g4x_compute_wm0(dev, 0, | 1360 | if (g4x_compute_wm0(dev, PIPE_A, |
1361 | &g4x_wm_info, latency_ns, | 1361 | &g4x_wm_info, latency_ns, |
1362 | &g4x_cursor_wm_info, latency_ns, | 1362 | &g4x_cursor_wm_info, latency_ns, |
1363 | &planea_wm, &cursora_wm)) | 1363 | &planea_wm, &cursora_wm)) |
1364 | enabled |= 1; | 1364 | enabled |= 1 << PIPE_A; |
1365 | 1365 | ||
1366 | if (g4x_compute_wm0(dev, 1, | 1366 | if (g4x_compute_wm0(dev, PIPE_B, |
1367 | &g4x_wm_info, latency_ns, | 1367 | &g4x_wm_info, latency_ns, |
1368 | &g4x_cursor_wm_info, latency_ns, | 1368 | &g4x_cursor_wm_info, latency_ns, |
1369 | &planeb_wm, &cursorb_wm)) | 1369 | &planeb_wm, &cursorb_wm)) |
1370 | enabled |= 2; | 1370 | enabled |= 1 << PIPE_B; |
1371 | 1371 | ||
1372 | if (single_plane_enabled(enabled) && | 1372 | if (single_plane_enabled(enabled) && |
1373 | g4x_compute_srwm(dev, ffs(enabled) - 1, | 1373 | g4x_compute_srwm(dev, ffs(enabled) - 1, |
@@ -1716,7 +1716,7 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
1716 | unsigned int enabled; | 1716 | unsigned int enabled; |
1717 | 1717 | ||
1718 | enabled = 0; | 1718 | enabled = 0; |
1719 | if (g4x_compute_wm0(dev, 0, | 1719 | if (g4x_compute_wm0(dev, PIPE_A, |
1720 | &ironlake_display_wm_info, | 1720 | &ironlake_display_wm_info, |
1721 | ILK_LP0_PLANE_LATENCY, | 1721 | ILK_LP0_PLANE_LATENCY, |
1722 | &ironlake_cursor_wm_info, | 1722 | &ironlake_cursor_wm_info, |
@@ -1727,10 +1727,10 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
1727 | DRM_DEBUG_KMS("FIFO watermarks For pipe A -" | 1727 | DRM_DEBUG_KMS("FIFO watermarks For pipe A -" |
1728 | " plane %d, " "cursor: %d\n", | 1728 | " plane %d, " "cursor: %d\n", |
1729 | plane_wm, cursor_wm); | 1729 | plane_wm, cursor_wm); |
1730 | enabled |= 1; | 1730 | enabled |= 1 << PIPE_A; |
1731 | } | 1731 | } |
1732 | 1732 | ||
1733 | if (g4x_compute_wm0(dev, 1, | 1733 | if (g4x_compute_wm0(dev, PIPE_B, |
1734 | &ironlake_display_wm_info, | 1734 | &ironlake_display_wm_info, |
1735 | ILK_LP0_PLANE_LATENCY, | 1735 | ILK_LP0_PLANE_LATENCY, |
1736 | &ironlake_cursor_wm_info, | 1736 | &ironlake_cursor_wm_info, |
@@ -1741,7 +1741,7 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
1741 | DRM_DEBUG_KMS("FIFO watermarks For pipe B -" | 1741 | DRM_DEBUG_KMS("FIFO watermarks For pipe B -" |
1742 | " plane %d, cursor: %d\n", | 1742 | " plane %d, cursor: %d\n", |
1743 | plane_wm, cursor_wm); | 1743 | plane_wm, cursor_wm); |
1744 | enabled |= 2; | 1744 | enabled |= 1 << PIPE_B; |
1745 | } | 1745 | } |
1746 | 1746 | ||
1747 | /* | 1747 | /* |
@@ -1801,7 +1801,7 @@ static void sandybridge_update_wm(struct drm_device *dev) | |||
1801 | unsigned int enabled; | 1801 | unsigned int enabled; |
1802 | 1802 | ||
1803 | enabled = 0; | 1803 | enabled = 0; |
1804 | if (g4x_compute_wm0(dev, 0, | 1804 | if (g4x_compute_wm0(dev, PIPE_A, |
1805 | &sandybridge_display_wm_info, latency, | 1805 | &sandybridge_display_wm_info, latency, |
1806 | &sandybridge_cursor_wm_info, latency, | 1806 | &sandybridge_cursor_wm_info, latency, |
1807 | &plane_wm, &cursor_wm)) { | 1807 | &plane_wm, &cursor_wm)) { |
@@ -1812,10 +1812,10 @@ static void sandybridge_update_wm(struct drm_device *dev) | |||
1812 | DRM_DEBUG_KMS("FIFO watermarks For pipe A -" | 1812 | DRM_DEBUG_KMS("FIFO watermarks For pipe A -" |
1813 | " plane %d, " "cursor: %d\n", | 1813 | " plane %d, " "cursor: %d\n", |
1814 | plane_wm, cursor_wm); | 1814 | plane_wm, cursor_wm); |
1815 | enabled |= 1; | 1815 | enabled |= 1 << PIPE_A; |
1816 | } | 1816 | } |
1817 | 1817 | ||
1818 | if (g4x_compute_wm0(dev, 1, | 1818 | if (g4x_compute_wm0(dev, PIPE_B, |
1819 | &sandybridge_display_wm_info, latency, | 1819 | &sandybridge_display_wm_info, latency, |
1820 | &sandybridge_cursor_wm_info, latency, | 1820 | &sandybridge_cursor_wm_info, latency, |
1821 | &plane_wm, &cursor_wm)) { | 1821 | &plane_wm, &cursor_wm)) { |
@@ -1826,7 +1826,7 @@ static void sandybridge_update_wm(struct drm_device *dev) | |||
1826 | DRM_DEBUG_KMS("FIFO watermarks For pipe B -" | 1826 | DRM_DEBUG_KMS("FIFO watermarks For pipe B -" |
1827 | " plane %d, cursor: %d\n", | 1827 | " plane %d, cursor: %d\n", |
1828 | plane_wm, cursor_wm); | 1828 | plane_wm, cursor_wm); |
1829 | enabled |= 2; | 1829 | enabled |= 1 << PIPE_B; |
1830 | } | 1830 | } |
1831 | 1831 | ||
1832 | /* | 1832 | /* |
@@ -1904,7 +1904,7 @@ static void ivybridge_update_wm(struct drm_device *dev) | |||
1904 | unsigned int enabled; | 1904 | unsigned int enabled; |
1905 | 1905 | ||
1906 | enabled = 0; | 1906 | enabled = 0; |
1907 | if (g4x_compute_wm0(dev, 0, | 1907 | if (g4x_compute_wm0(dev, PIPE_A, |
1908 | &sandybridge_display_wm_info, latency, | 1908 | &sandybridge_display_wm_info, latency, |
1909 | &sandybridge_cursor_wm_info, latency, | 1909 | &sandybridge_cursor_wm_info, latency, |
1910 | &plane_wm, &cursor_wm)) { | 1910 | &plane_wm, &cursor_wm)) { |
@@ -1915,10 +1915,10 @@ static void ivybridge_update_wm(struct drm_device *dev) | |||
1915 | DRM_DEBUG_KMS("FIFO watermarks For pipe A -" | 1915 | DRM_DEBUG_KMS("FIFO watermarks For pipe A -" |
1916 | " plane %d, " "cursor: %d\n", | 1916 | " plane %d, " "cursor: %d\n", |
1917 | plane_wm, cursor_wm); | 1917 | plane_wm, cursor_wm); |
1918 | enabled |= 1; | 1918 | enabled |= 1 << PIPE_A; |
1919 | } | 1919 | } |
1920 | 1920 | ||
1921 | if (g4x_compute_wm0(dev, 1, | 1921 | if (g4x_compute_wm0(dev, PIPE_B, |
1922 | &sandybridge_display_wm_info, latency, | 1922 | &sandybridge_display_wm_info, latency, |
1923 | &sandybridge_cursor_wm_info, latency, | 1923 | &sandybridge_cursor_wm_info, latency, |
1924 | &plane_wm, &cursor_wm)) { | 1924 | &plane_wm, &cursor_wm)) { |
@@ -1929,10 +1929,10 @@ static void ivybridge_update_wm(struct drm_device *dev) | |||
1929 | DRM_DEBUG_KMS("FIFO watermarks For pipe B -" | 1929 | DRM_DEBUG_KMS("FIFO watermarks For pipe B -" |
1930 | " plane %d, cursor: %d\n", | 1930 | " plane %d, cursor: %d\n", |
1931 | plane_wm, cursor_wm); | 1931 | plane_wm, cursor_wm); |
1932 | enabled |= 2; | 1932 | enabled |= 1 << PIPE_B; |
1933 | } | 1933 | } |
1934 | 1934 | ||
1935 | if (g4x_compute_wm0(dev, 2, | 1935 | if (g4x_compute_wm0(dev, PIPE_C, |
1936 | &sandybridge_display_wm_info, latency, | 1936 | &sandybridge_display_wm_info, latency, |
1937 | &sandybridge_cursor_wm_info, latency, | 1937 | &sandybridge_cursor_wm_info, latency, |
1938 | &plane_wm, &cursor_wm)) { | 1938 | &plane_wm, &cursor_wm)) { |
@@ -1943,7 +1943,7 @@ static void ivybridge_update_wm(struct drm_device *dev) | |||
1943 | DRM_DEBUG_KMS("FIFO watermarks For pipe C -" | 1943 | DRM_DEBUG_KMS("FIFO watermarks For pipe C -" |
1944 | " plane %d, cursor: %d\n", | 1944 | " plane %d, cursor: %d\n", |
1945 | plane_wm, cursor_wm); | 1945 | plane_wm, cursor_wm); |
1946 | enabled |= 3; | 1946 | enabled |= 1 << PIPE_C; |
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | /* | 1949 | /* |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index d15428404b9a..d4ea6c265ce1 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -1776,11 +1776,14 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1776 | * Assume that the preferred modes are | 1776 | * Assume that the preferred modes are |
1777 | * arranged in priority order. | 1777 | * arranged in priority order. |
1778 | */ | 1778 | */ |
1779 | intel_ddc_get_modes(connector, intel_sdvo->i2c); | 1779 | intel_ddc_get_modes(connector, &intel_sdvo->ddc); |
1780 | if (list_empty(&connector->probed_modes) == false) | ||
1781 | goto end; | ||
1782 | 1780 | ||
1783 | /* Fetch modes from VBT */ | 1781 | /* |
1782 | * Fetch modes from VBT. For SDVO prefer the VBT mode since some | ||
1783 | * SDVO->LVDS transcoders can't cope with the EDID mode. Since | ||
1784 | * drm_mode_probed_add adds the mode at the head of the list we add it | ||
1785 | * last. | ||
1786 | */ | ||
1784 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { | 1787 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { |
1785 | newmode = drm_mode_duplicate(connector->dev, | 1788 | newmode = drm_mode_duplicate(connector->dev, |
1786 | dev_priv->sdvo_lvds_vbt_mode); | 1789 | dev_priv->sdvo_lvds_vbt_mode); |
@@ -1792,7 +1795,6 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1792 | } | 1795 | } |
1793 | } | 1796 | } |
1794 | 1797 | ||
1795 | end: | ||
1796 | list_for_each_entry(newmode, &connector->probed_modes, head) { | 1798 | list_for_each_entry(newmode, &connector->probed_modes, head) { |
1797 | if (newmode->type & DRM_MODE_TYPE_PREFERRED) { | 1799 | if (newmode->type & DRM_MODE_TYPE_PREFERRED) { |
1798 | intel_sdvo->sdvo_lvds_fixed_mode = | 1800 | intel_sdvo->sdvo_lvds_fixed_mode = |
@@ -2790,12 +2792,6 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) | |||
2790 | SDVOB_HOTPLUG_INT_STATUS_I915 : SDVOC_HOTPLUG_INT_STATUS_I915; | 2792 | SDVOB_HOTPLUG_INT_STATUS_I915 : SDVOC_HOTPLUG_INT_STATUS_I915; |
2791 | } | 2793 | } |
2792 | 2794 | ||
2793 | /* Only enable the hotplug irq if we need it, to work around noisy | ||
2794 | * hotplug lines. | ||
2795 | */ | ||
2796 | if (intel_sdvo->hotplug_active) | ||
2797 | intel_encoder->hpd_pin = HPD_SDVO_B ? HPD_SDVO_B : HPD_SDVO_C; | ||
2798 | |||
2799 | intel_encoder->compute_config = intel_sdvo_compute_config; | 2795 | intel_encoder->compute_config = intel_sdvo_compute_config; |
2800 | intel_encoder->disable = intel_disable_sdvo; | 2796 | intel_encoder->disable = intel_disable_sdvo; |
2801 | intel_encoder->mode_set = intel_sdvo_mode_set; | 2797 | intel_encoder->mode_set = intel_sdvo_mode_set; |
@@ -2814,6 +2810,14 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) | |||
2814 | goto err_output; | 2810 | goto err_output; |
2815 | } | 2811 | } |
2816 | 2812 | ||
2813 | /* Only enable the hotplug irq if we need it, to work around noisy | ||
2814 | * hotplug lines. | ||
2815 | */ | ||
2816 | if (intel_sdvo->hotplug_active) { | ||
2817 | intel_encoder->hpd_pin = | ||
2818 | intel_sdvo->is_sdvob ? HPD_SDVO_B : HPD_SDVO_C; | ||
2819 | } | ||
2820 | |||
2817 | /* | 2821 | /* |
2818 | * Cloning SDVO with anything is often impossible, since the SDVO | 2822 | * Cloning SDVO with anything is often impossible, since the SDVO |
2819 | * encoder can request a special input timing mode. And even if that's | 2823 | * encoder can request a special input timing mode. And even if that's |
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index f9889658329b..ee66badc8bb6 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c | |||
@@ -46,29 +46,26 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc) | |||
46 | 46 | ||
47 | static inline void mga_wait_vsync(struct mga_device *mdev) | 47 | static inline void mga_wait_vsync(struct mga_device *mdev) |
48 | { | 48 | { |
49 | unsigned int count = 0; | 49 | unsigned long timeout = jiffies + HZ/10; |
50 | unsigned int status = 0; | 50 | unsigned int status = 0; |
51 | 51 | ||
52 | do { | 52 | do { |
53 | status = RREG32(MGAREG_Status); | 53 | status = RREG32(MGAREG_Status); |
54 | count++; | 54 | } while ((status & 0x08) && time_before(jiffies, timeout)); |
55 | } while ((status & 0x08) && (count < 250000)); | 55 | timeout = jiffies + HZ/10; |
56 | count = 0; | ||
57 | status = 0; | 56 | status = 0; |
58 | do { | 57 | do { |
59 | status = RREG32(MGAREG_Status); | 58 | status = RREG32(MGAREG_Status); |
60 | count++; | 59 | } while (!(status & 0x08) && time_before(jiffies, timeout)); |
61 | } while (!(status & 0x08) && (count < 250000)); | ||
62 | } | 60 | } |
63 | 61 | ||
64 | static inline void mga_wait_busy(struct mga_device *mdev) | 62 | static inline void mga_wait_busy(struct mga_device *mdev) |
65 | { | 63 | { |
66 | unsigned int count = 0; | 64 | unsigned long timeout = jiffies + HZ; |
67 | unsigned int status = 0; | 65 | unsigned int status = 0; |
68 | do { | 66 | do { |
69 | status = RREG8(MGAREG_Status + 2); | 67 | status = RREG8(MGAREG_Status + 2); |
70 | count++; | 68 | } while ((status & 0x01) && time_before(jiffies, timeout)); |
71 | } while ((status & 0x01) && (count < 500000)); | ||
72 | } | 69 | } |
73 | 70 | ||
74 | /* | 71 | /* |
@@ -189,12 +186,12 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) | |||
189 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 186 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
190 | tmp = RREG8(DAC_DATA); | 187 | tmp = RREG8(DAC_DATA); |
191 | tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; | 188 | tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; |
192 | WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp); | 189 | WREG8(DAC_DATA, tmp); |
193 | 190 | ||
194 | WREG8(DAC_INDEX, MGA1064_REMHEADCTL); | 191 | WREG8(DAC_INDEX, MGA1064_REMHEADCTL); |
195 | tmp = RREG8(DAC_DATA); | 192 | tmp = RREG8(DAC_DATA); |
196 | tmp |= MGA1064_REMHEADCTL_CLKDIS; | 193 | tmp |= MGA1064_REMHEADCTL_CLKDIS; |
197 | WREG_DAC(MGA1064_REMHEADCTL, tmp); | 194 | WREG8(DAC_DATA, tmp); |
198 | 195 | ||
199 | /* select PLL Set C */ | 196 | /* select PLL Set C */ |
200 | tmp = RREG8(MGAREG_MEM_MISC_READ); | 197 | tmp = RREG8(MGAREG_MEM_MISC_READ); |
@@ -204,7 +201,7 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) | |||
204 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 201 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
205 | tmp = RREG8(DAC_DATA); | 202 | tmp = RREG8(DAC_DATA); |
206 | tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN | 0x80; | 203 | tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN | 0x80; |
207 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 204 | WREG8(DAC_DATA, tmp); |
208 | 205 | ||
209 | udelay(500); | 206 | udelay(500); |
210 | 207 | ||
@@ -212,7 +209,7 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) | |||
212 | WREG8(DAC_INDEX, MGA1064_VREF_CTL); | 209 | WREG8(DAC_INDEX, MGA1064_VREF_CTL); |
213 | tmp = RREG8(DAC_DATA); | 210 | tmp = RREG8(DAC_DATA); |
214 | tmp &= ~0x04; | 211 | tmp &= ~0x04; |
215 | WREG_DAC(MGA1064_VREF_CTL, tmp); | 212 | WREG8(DAC_DATA, tmp); |
216 | 213 | ||
217 | udelay(50); | 214 | udelay(50); |
218 | 215 | ||
@@ -236,13 +233,13 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) | |||
236 | tmp = RREG8(DAC_DATA); | 233 | tmp = RREG8(DAC_DATA); |
237 | tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK; | 234 | tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK; |
238 | tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL; | 235 | tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL; |
239 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 236 | WREG8(DAC_DATA, tmp); |
240 | 237 | ||
241 | WREG8(DAC_INDEX, MGA1064_REMHEADCTL); | 238 | WREG8(DAC_INDEX, MGA1064_REMHEADCTL); |
242 | tmp = RREG8(DAC_DATA); | 239 | tmp = RREG8(DAC_DATA); |
243 | tmp &= ~MGA1064_REMHEADCTL_CLKSL_MSK; | 240 | tmp &= ~MGA1064_REMHEADCTL_CLKSL_MSK; |
244 | tmp |= MGA1064_REMHEADCTL_CLKSL_PLL; | 241 | tmp |= MGA1064_REMHEADCTL_CLKSL_PLL; |
245 | WREG_DAC(MGA1064_REMHEADCTL, tmp); | 242 | WREG8(DAC_DATA, tmp); |
246 | 243 | ||
247 | /* reset dotclock rate bit */ | 244 | /* reset dotclock rate bit */ |
248 | WREG8(MGAREG_SEQ_INDEX, 1); | 245 | WREG8(MGAREG_SEQ_INDEX, 1); |
@@ -253,7 +250,7 @@ static int mga_g200wb_set_plls(struct mga_device *mdev, long clock) | |||
253 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 250 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
254 | tmp = RREG8(DAC_DATA); | 251 | tmp = RREG8(DAC_DATA); |
255 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; | 252 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; |
256 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 253 | WREG8(DAC_DATA, tmp); |
257 | 254 | ||
258 | vcount = RREG8(MGAREG_VCOUNT); | 255 | vcount = RREG8(MGAREG_VCOUNT); |
259 | 256 | ||
@@ -318,7 +315,7 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) | |||
318 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 315 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
319 | tmp = RREG8(DAC_DATA); | 316 | tmp = RREG8(DAC_DATA); |
320 | tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; | 317 | tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; |
321 | WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp); | 318 | WREG8(DAC_DATA, tmp); |
322 | 319 | ||
323 | tmp = RREG8(MGAREG_MEM_MISC_READ); | 320 | tmp = RREG8(MGAREG_MEM_MISC_READ); |
324 | tmp |= 0x3 << 2; | 321 | tmp |= 0x3 << 2; |
@@ -326,12 +323,12 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) | |||
326 | 323 | ||
327 | WREG8(DAC_INDEX, MGA1064_PIX_PLL_STAT); | 324 | WREG8(DAC_INDEX, MGA1064_PIX_PLL_STAT); |
328 | tmp = RREG8(DAC_DATA); | 325 | tmp = RREG8(DAC_DATA); |
329 | WREG_DAC(MGA1064_PIX_PLL_STAT, tmp & ~0x40); | 326 | WREG8(DAC_DATA, tmp & ~0x40); |
330 | 327 | ||
331 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 328 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
332 | tmp = RREG8(DAC_DATA); | 329 | tmp = RREG8(DAC_DATA); |
333 | tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; | 330 | tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; |
334 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 331 | WREG8(DAC_DATA, tmp); |
335 | 332 | ||
336 | WREG_DAC(MGA1064_EV_PIX_PLLC_M, m); | 333 | WREG_DAC(MGA1064_EV_PIX_PLLC_M, m); |
337 | WREG_DAC(MGA1064_EV_PIX_PLLC_N, n); | 334 | WREG_DAC(MGA1064_EV_PIX_PLLC_N, n); |
@@ -342,7 +339,7 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) | |||
342 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 339 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
343 | tmp = RREG8(DAC_DATA); | 340 | tmp = RREG8(DAC_DATA); |
344 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; | 341 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; |
345 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 342 | WREG8(DAC_DATA, tmp); |
346 | 343 | ||
347 | udelay(500); | 344 | udelay(500); |
348 | 345 | ||
@@ -350,11 +347,11 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) | |||
350 | tmp = RREG8(DAC_DATA); | 347 | tmp = RREG8(DAC_DATA); |
351 | tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK; | 348 | tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK; |
352 | tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL; | 349 | tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL; |
353 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 350 | WREG8(DAC_DATA, tmp); |
354 | 351 | ||
355 | WREG8(DAC_INDEX, MGA1064_PIX_PLL_STAT); | 352 | WREG8(DAC_INDEX, MGA1064_PIX_PLL_STAT); |
356 | tmp = RREG8(DAC_DATA); | 353 | tmp = RREG8(DAC_DATA); |
357 | WREG_DAC(MGA1064_PIX_PLL_STAT, tmp | 0x40); | 354 | WREG8(DAC_DATA, tmp | 0x40); |
358 | 355 | ||
359 | tmp = RREG8(MGAREG_MEM_MISC_READ); | 356 | tmp = RREG8(MGAREG_MEM_MISC_READ); |
360 | tmp |= (0x3 << 2); | 357 | tmp |= (0x3 << 2); |
@@ -363,7 +360,7 @@ static int mga_g200ev_set_plls(struct mga_device *mdev, long clock) | |||
363 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 360 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
364 | tmp = RREG8(DAC_DATA); | 361 | tmp = RREG8(DAC_DATA); |
365 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; | 362 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; |
366 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 363 | WREG8(DAC_DATA, tmp); |
367 | 364 | ||
368 | return 0; | 365 | return 0; |
369 | } | 366 | } |
@@ -416,7 +413,7 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) | |||
416 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 413 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
417 | tmp = RREG8(DAC_DATA); | 414 | tmp = RREG8(DAC_DATA); |
418 | tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; | 415 | tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; |
419 | WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp); | 416 | WREG8(DAC_DATA, tmp); |
420 | 417 | ||
421 | tmp = RREG8(MGAREG_MEM_MISC_READ); | 418 | tmp = RREG8(MGAREG_MEM_MISC_READ); |
422 | tmp |= 0x3 << 2; | 419 | tmp |= 0x3 << 2; |
@@ -425,7 +422,7 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) | |||
425 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 422 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
426 | tmp = RREG8(DAC_DATA); | 423 | tmp = RREG8(DAC_DATA); |
427 | tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; | 424 | tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; |
428 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 425 | WREG8(DAC_DATA, tmp); |
429 | 426 | ||
430 | udelay(500); | 427 | udelay(500); |
431 | 428 | ||
@@ -439,13 +436,13 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) | |||
439 | tmp = RREG8(DAC_DATA); | 436 | tmp = RREG8(DAC_DATA); |
440 | tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK; | 437 | tmp &= ~MGA1064_PIX_CLK_CTL_SEL_MSK; |
441 | tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL; | 438 | tmp |= MGA1064_PIX_CLK_CTL_SEL_PLL; |
442 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 439 | WREG8(DAC_DATA, tmp); |
443 | 440 | ||
444 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 441 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
445 | tmp = RREG8(DAC_DATA); | 442 | tmp = RREG8(DAC_DATA); |
446 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; | 443 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; |
447 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; | 444 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; |
448 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 445 | WREG8(DAC_DATA, tmp); |
449 | 446 | ||
450 | vcount = RREG8(MGAREG_VCOUNT); | 447 | vcount = RREG8(MGAREG_VCOUNT); |
451 | 448 | ||
@@ -515,12 +512,12 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock) | |||
515 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); | 512 | WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); |
516 | tmp = RREG8(DAC_DATA); | 513 | tmp = RREG8(DAC_DATA); |
517 | tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; | 514 | tmp |= MGA1064_PIX_CLK_CTL_CLK_DIS; |
518 | WREG_DAC(MGA1064_PIX_CLK_CTL_CLK_DIS, tmp); | 515 | WREG8(DAC_DATA, tmp); |
519 | 516 | ||
520 | WREG8(DAC_INDEX, MGA1064_REMHEADCTL); | 517 | WREG8(DAC_INDEX, MGA1064_REMHEADCTL); |
521 | tmp = RREG8(DAC_DATA); | 518 | tmp = RREG8(DAC_DATA); |
522 | tmp |= MGA1064_REMHEADCTL_CLKDIS; | 519 | tmp |= MGA1064_REMHEADCTL_CLKDIS; |
523 | WREG_DAC(MGA1064_REMHEADCTL, tmp); | 520 | WREG8(DAC_DATA, tmp); |
524 | 521 | ||
525 | tmp = RREG8(MGAREG_MEM_MISC_READ); | 522 | tmp = RREG8(MGAREG_MEM_MISC_READ); |
526 | tmp |= (0x3<<2) | 0xc0; | 523 | tmp |= (0x3<<2) | 0xc0; |
@@ -530,7 +527,7 @@ static int mga_g200er_set_plls(struct mga_device *mdev, long clock) | |||
530 | tmp = RREG8(DAC_DATA); | 527 | tmp = RREG8(DAC_DATA); |
531 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; | 528 | tmp &= ~MGA1064_PIX_CLK_CTL_CLK_DIS; |
532 | tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; | 529 | tmp |= MGA1064_PIX_CLK_CTL_CLK_POW_DOWN; |
533 | WREG_DAC(MGA1064_PIX_CLK_CTL, tmp); | 530 | WREG8(DAC_DATA, tmp); |
534 | 531 | ||
535 | udelay(500); | 532 | udelay(500); |
536 | 533 | ||
@@ -657,12 +654,26 @@ static void mga_g200wb_commit(struct drm_crtc *crtc) | |||
657 | WREG_DAC(MGA1064_GEN_IO_DATA, tmp); | 654 | WREG_DAC(MGA1064_GEN_IO_DATA, tmp); |
658 | } | 655 | } |
659 | 656 | ||
660 | 657 | /* | |
658 | This is how the framebuffer base address is stored in g200 cards: | ||
659 | * Assume @offset is the gpu_addr variable of the framebuffer object | ||
660 | * Then addr is the number of _pixels_ (not bytes) from the start of | ||
661 | VRAM to the first pixel we want to display. (divided by 2 for 32bit | ||
662 | framebuffers) | ||
663 | * addr is stored in the CRTCEXT0, CRTCC and CRTCD registers | ||
664 | addr<20> -> CRTCEXT0<6> | ||
665 | addr<19-16> -> CRTCEXT0<3-0> | ||
666 | addr<15-8> -> CRTCC<7-0> | ||
667 | addr<7-0> -> CRTCD<7-0> | ||
668 | CRTCEXT0 has to be programmed last to trigger an update and make the | ||
669 | new addr variable take effect. | ||
670 | */ | ||
661 | void mga_set_start_address(struct drm_crtc *crtc, unsigned offset) | 671 | void mga_set_start_address(struct drm_crtc *crtc, unsigned offset) |
662 | { | 672 | { |
663 | struct mga_device *mdev = crtc->dev->dev_private; | 673 | struct mga_device *mdev = crtc->dev->dev_private; |
664 | u32 addr; | 674 | u32 addr; |
665 | int count; | 675 | int count; |
676 | u8 crtcext0; | ||
666 | 677 | ||
667 | while (RREG8(0x1fda) & 0x08); | 678 | while (RREG8(0x1fda) & 0x08); |
668 | while (!(RREG8(0x1fda) & 0x08)); | 679 | while (!(RREG8(0x1fda) & 0x08)); |
@@ -670,10 +681,17 @@ void mga_set_start_address(struct drm_crtc *crtc, unsigned offset) | |||
670 | count = RREG8(MGAREG_VCOUNT) + 2; | 681 | count = RREG8(MGAREG_VCOUNT) + 2; |
671 | while (RREG8(MGAREG_VCOUNT) < count); | 682 | while (RREG8(MGAREG_VCOUNT) < count); |
672 | 683 | ||
673 | addr = offset >> 2; | 684 | WREG8(MGAREG_CRTCEXT_INDEX, 0); |
685 | crtcext0 = RREG8(MGAREG_CRTCEXT_DATA); | ||
686 | crtcext0 &= 0xB0; | ||
687 | addr = offset / 8; | ||
688 | /* Can't store addresses any higher than that... | ||
689 | but we also don't have more than 16MB of memory, so it should be fine. */ | ||
690 | WARN_ON(addr > 0x1fffff); | ||
691 | crtcext0 |= (!!(addr & (1<<20)))<<6; | ||
674 | WREG_CRT(0x0d, (u8)(addr & 0xff)); | 692 | WREG_CRT(0x0d, (u8)(addr & 0xff)); |
675 | WREG_CRT(0x0c, (u8)(addr >> 8) & 0xff); | 693 | WREG_CRT(0x0c, (u8)(addr >> 8) & 0xff); |
676 | WREG_CRT(0xaf, (u8)(addr >> 16) & 0xf); | 694 | WREG_ECRT(0x0, ((u8)(addr >> 16) & 0xf) | crtcext0); |
677 | } | 695 | } |
678 | 696 | ||
679 | 697 | ||
@@ -829,11 +847,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, | |||
829 | 847 | ||
830 | 848 | ||
831 | for (i = 0; i < sizeof(dacvalue); i++) { | 849 | for (i = 0; i < sizeof(dacvalue); i++) { |
832 | if ((i <= 0x03) || | 850 | if ((i <= 0x17) || |
833 | (i == 0x07) || | ||
834 | (i == 0x0b) || | ||
835 | (i == 0x0f) || | ||
836 | ((i >= 0x13) && (i <= 0x17)) || | ||
837 | (i == 0x1b) || | 851 | (i == 0x1b) || |
838 | (i == 0x1c) || | 852 | (i == 0x1c) || |
839 | ((i >= 0x1f) && (i <= 0x29)) || | 853 | ((i >= 0x1f) && (i <= 0x29)) || |
@@ -1020,13 +1034,14 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, | |||
1020 | else | 1034 | else |
1021 | hi_pri_lvl = 5; | 1035 | hi_pri_lvl = 5; |
1022 | 1036 | ||
1023 | WREG8(0x1fde, 0x06); | 1037 | WREG8(MGAREG_CRTCEXT_INDEX, 0x06); |
1024 | WREG8(0x1fdf, hi_pri_lvl); | 1038 | WREG8(MGAREG_CRTCEXT_DATA, hi_pri_lvl); |
1025 | } else { | 1039 | } else { |
1040 | WREG8(MGAREG_CRTCEXT_INDEX, 0x06); | ||
1026 | if (mdev->reg_1e24 >= 0x01) | 1041 | if (mdev->reg_1e24 >= 0x01) |
1027 | WREG8(0x1fdf, 0x03); | 1042 | WREG8(MGAREG_CRTCEXT_DATA, 0x03); |
1028 | else | 1043 | else |
1029 | WREG8(0x1fdf, 0x04); | 1044 | WREG8(MGAREG_CRTCEXT_DATA, 0x04); |
1030 | } | 1045 | } |
1031 | } | 1046 | } |
1032 | return 0; | 1047 | return 0; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c index 955af122c3a6..a36e64e98ef3 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c | |||
@@ -138,7 +138,6 @@ nvc0_identify(struct nouveau_device *device) | |||
138 | device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; | 138 | device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; |
139 | device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; | 139 | device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; |
140 | device->oclass[NVDEV_ENGINE_COPY0 ] = &nvc0_copy0_oclass; | 140 | device->oclass[NVDEV_ENGINE_COPY0 ] = &nvc0_copy0_oclass; |
141 | device->oclass[NVDEV_ENGINE_COPY1 ] = &nvc0_copy1_oclass; | ||
142 | device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass; | 141 | device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass; |
143 | break; | 142 | break; |
144 | case 0xce: | 143 | case 0xce: |
@@ -225,7 +224,6 @@ nvc0_identify(struct nouveau_device *device) | |||
225 | device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; | 224 | device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; |
226 | device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; | 225 | device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; |
227 | device->oclass[NVDEV_ENGINE_COPY0 ] = &nvc0_copy0_oclass; | 226 | device->oclass[NVDEV_ENGINE_COPY0 ] = &nvc0_copy0_oclass; |
228 | device->oclass[NVDEV_ENGINE_COPY1 ] = &nvc0_copy1_oclass; | ||
229 | device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass; | 227 | device->oclass[NVDEV_ENGINE_DISP ] = &nva3_disp_oclass; |
230 | break; | 228 | break; |
231 | case 0xc8: | 229 | case 0xc8: |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c index d0817d94454c..f02fd9f443ff 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c | |||
@@ -50,11 +50,16 @@ nv50_dac_sense(struct nv50_disp_priv *priv, int or, u32 loadval) | |||
50 | { | 50 | { |
51 | const u32 doff = (or * 0x800); | 51 | const u32 doff = (or * 0x800); |
52 | int load = -EINVAL; | 52 | int load = -EINVAL; |
53 | nv_mask(priv, 0x61a004 + doff, 0x807f0000, 0x80150000); | ||
54 | nv_wait(priv, 0x61a004 + doff, 0x80000000, 0x00000000); | ||
53 | nv_wr32(priv, 0x61a00c + doff, 0x00100000 | loadval); | 55 | nv_wr32(priv, 0x61a00c + doff, 0x00100000 | loadval); |
54 | udelay(9500); | 56 | mdelay(9); |
57 | udelay(500); | ||
55 | nv_wr32(priv, 0x61a00c + doff, 0x80000000); | 58 | nv_wr32(priv, 0x61a00c + doff, 0x80000000); |
56 | load = (nv_rd32(priv, 0x61a00c + doff) & 0x38000000) >> 27; | 59 | load = (nv_rd32(priv, 0x61a00c + doff) & 0x38000000) >> 27; |
57 | nv_wr32(priv, 0x61a00c + doff, 0x00000000); | 60 | nv_wr32(priv, 0x61a00c + doff, 0x00000000); |
61 | nv_mask(priv, 0x61a004 + doff, 0x807f0000, 0x80550000); | ||
62 | nv_wait(priv, 0x61a004 + doff, 0x80000000, 0x00000000); | ||
58 | return load; | 63 | return load; |
59 | } | 64 | } |
60 | 65 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdminv84.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdminv84.c index 0d36bdc51417..7fdade6e604d 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/hdminv84.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdminv84.c | |||
@@ -55,6 +55,10 @@ nv84_hdmi_ctrl(struct nv50_disp_priv *priv, int head, int or, u32 data) | |||
55 | nv_wr32(priv, 0x616510 + hoff, 0x00000000); | 55 | nv_wr32(priv, 0x616510 + hoff, 0x00000000); |
56 | nv_mask(priv, 0x616500 + hoff, 0x00000001, 0x00000001); | 56 | nv_mask(priv, 0x616500 + hoff, 0x00000001, 0x00000001); |
57 | 57 | ||
58 | nv_mask(priv, 0x6165d0 + hoff, 0x00070001, 0x00010001); /* SPARE, HW_CTS */ | ||
59 | nv_mask(priv, 0x616568 + hoff, 0x00010101, 0x00000000); /* ACR_CTRL, ?? */ | ||
60 | nv_mask(priv, 0x616578 + hoff, 0x80000000, 0x80000000); /* ACR_0441_ENABLE */ | ||
61 | |||
58 | /* ??? */ | 62 | /* ??? */ |
59 | nv_mask(priv, 0x61733c, 0x00100000, 0x00100000); /* RESETF */ | 63 | nv_mask(priv, 0x61733c, 0x00100000, 0x00100000); /* RESETF */ |
60 | nv_mask(priv, 0x61733c, 0x10000000, 0x10000000); /* LOOKUP_EN */ | 64 | nv_mask(priv, 0x61733c, 0x10000000, 0x10000000); /* LOOKUP_EN */ |
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c index ddaeb5572903..e9b8217d0075 100644 --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c | |||
@@ -40,8 +40,8 @@ | |||
40 | * FIFO channel objects | 40 | * FIFO channel objects |
41 | ******************************************************************************/ | 41 | ******************************************************************************/ |
42 | 42 | ||
43 | void | 43 | static void |
44 | nv50_fifo_playlist_update(struct nv50_fifo_priv *priv) | 44 | nv50_fifo_playlist_update_locked(struct nv50_fifo_priv *priv) |
45 | { | 45 | { |
46 | struct nouveau_bar *bar = nouveau_bar(priv); | 46 | struct nouveau_bar *bar = nouveau_bar(priv); |
47 | struct nouveau_gpuobj *cur; | 47 | struct nouveau_gpuobj *cur; |
@@ -62,6 +62,14 @@ nv50_fifo_playlist_update(struct nv50_fifo_priv *priv) | |||
62 | nv_wr32(priv, 0x002500, 0x00000101); | 62 | nv_wr32(priv, 0x002500, 0x00000101); |
63 | } | 63 | } |
64 | 64 | ||
65 | void | ||
66 | nv50_fifo_playlist_update(struct nv50_fifo_priv *priv) | ||
67 | { | ||
68 | mutex_lock(&nv_subdev(priv)->mutex); | ||
69 | nv50_fifo_playlist_update_locked(priv); | ||
70 | mutex_unlock(&nv_subdev(priv)->mutex); | ||
71 | } | ||
72 | |||
65 | static int | 73 | static int |
66 | nv50_fifo_context_attach(struct nouveau_object *parent, | 74 | nv50_fifo_context_attach(struct nouveau_object *parent, |
67 | struct nouveau_object *object) | 75 | struct nouveau_object *object) |
@@ -487,7 +495,7 @@ nv50_fifo_init(struct nouveau_object *object) | |||
487 | 495 | ||
488 | for (i = 0; i < 128; i++) | 496 | for (i = 0; i < 128; i++) |
489 | nv_wr32(priv, 0x002600 + (i * 4), 0x00000000); | 497 | nv_wr32(priv, 0x002600 + (i * 4), 0x00000000); |
490 | nv50_fifo_playlist_update(priv); | 498 | nv50_fifo_playlist_update_locked(priv); |
491 | 499 | ||
492 | nv_wr32(priv, 0x003200, 0x00000001); | 500 | nv_wr32(priv, 0x003200, 0x00000001); |
493 | nv_wr32(priv, 0x003250, 0x00000001); | 501 | nv_wr32(priv, 0x003250, 0x00000001); |
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c index 4d4a6b905370..46dfa68c47bb 100644 --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c | |||
@@ -71,6 +71,7 @@ nvc0_fifo_playlist_update(struct nvc0_fifo_priv *priv) | |||
71 | struct nouveau_gpuobj *cur; | 71 | struct nouveau_gpuobj *cur; |
72 | int i, p; | 72 | int i, p; |
73 | 73 | ||
74 | mutex_lock(&nv_subdev(priv)->mutex); | ||
74 | cur = priv->playlist[priv->cur_playlist]; | 75 | cur = priv->playlist[priv->cur_playlist]; |
75 | priv->cur_playlist = !priv->cur_playlist; | 76 | priv->cur_playlist = !priv->cur_playlist; |
76 | 77 | ||
@@ -87,6 +88,7 @@ nvc0_fifo_playlist_update(struct nvc0_fifo_priv *priv) | |||
87 | nv_wr32(priv, 0x002274, 0x01f00000 | (p >> 3)); | 88 | nv_wr32(priv, 0x002274, 0x01f00000 | (p >> 3)); |
88 | if (!nv_wait(priv, 0x00227c, 0x00100000, 0x00000000)) | 89 | if (!nv_wait(priv, 0x00227c, 0x00100000, 0x00000000)) |
89 | nv_error(priv, "playlist update failed\n"); | 90 | nv_error(priv, "playlist update failed\n"); |
91 | mutex_unlock(&nv_subdev(priv)->mutex); | ||
90 | } | 92 | } |
91 | 93 | ||
92 | static int | 94 | static int |
@@ -248,9 +250,17 @@ nvc0_fifo_chan_fini(struct nouveau_object *object, bool suspend) | |||
248 | struct nvc0_fifo_priv *priv = (void *)object->engine; | 250 | struct nvc0_fifo_priv *priv = (void *)object->engine; |
249 | struct nvc0_fifo_chan *chan = (void *)object; | 251 | struct nvc0_fifo_chan *chan = (void *)object; |
250 | u32 chid = chan->base.chid; | 252 | u32 chid = chan->base.chid; |
253 | u32 mask, engine; | ||
251 | 254 | ||
252 | nv_mask(priv, 0x003004 + (chid * 8), 0x00000001, 0x00000000); | 255 | nv_mask(priv, 0x003004 + (chid * 8), 0x00000001, 0x00000000); |
253 | nvc0_fifo_playlist_update(priv); | 256 | nvc0_fifo_playlist_update(priv); |
257 | mask = nv_rd32(priv, 0x0025a4); | ||
258 | for (engine = 0; mask && engine < 16; engine++) { | ||
259 | if (!(mask & (1 << engine))) | ||
260 | continue; | ||
261 | nv_mask(priv, 0x0025a8 + (engine * 4), 0x00000000, 0x00000000); | ||
262 | mask &= ~(1 << engine); | ||
263 | } | ||
254 | nv_wr32(priv, 0x003000 + (chid * 8), 0x00000000); | 264 | nv_wr32(priv, 0x003000 + (chid * 8), 0x00000000); |
255 | 265 | ||
256 | return nouveau_fifo_channel_fini(&chan->base, suspend); | 266 | return nouveau_fifo_channel_fini(&chan->base, suspend); |
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c index 9151919fb831..56192a7242ae 100644 --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c | |||
@@ -94,11 +94,13 @@ nve0_fifo_playlist_update(struct nve0_fifo_priv *priv, u32 engine) | |||
94 | u32 match = (engine << 16) | 0x00000001; | 94 | u32 match = (engine << 16) | 0x00000001; |
95 | int i, p; | 95 | int i, p; |
96 | 96 | ||
97 | mutex_lock(&nv_subdev(priv)->mutex); | ||
97 | cur = engn->playlist[engn->cur_playlist]; | 98 | cur = engn->playlist[engn->cur_playlist]; |
98 | if (unlikely(cur == NULL)) { | 99 | if (unlikely(cur == NULL)) { |
99 | int ret = nouveau_gpuobj_new(nv_object(priv), NULL, | 100 | int ret = nouveau_gpuobj_new(nv_object(priv), NULL, |
100 | 0x8000, 0x1000, 0, &cur); | 101 | 0x8000, 0x1000, 0, &cur); |
101 | if (ret) { | 102 | if (ret) { |
103 | mutex_unlock(&nv_subdev(priv)->mutex); | ||
102 | nv_error(priv, "playlist alloc failed\n"); | 104 | nv_error(priv, "playlist alloc failed\n"); |
103 | return; | 105 | return; |
104 | } | 106 | } |
@@ -122,6 +124,7 @@ nve0_fifo_playlist_update(struct nve0_fifo_priv *priv, u32 engine) | |||
122 | nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3)); | 124 | nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3)); |
123 | if (!nv_wait(priv, 0x002284 + (engine * 4), 0x00100000, 0x00000000)) | 125 | if (!nv_wait(priv, 0x002284 + (engine * 4), 0x00100000, 0x00000000)) |
124 | nv_error(priv, "playlist %d update timeout\n", engine); | 126 | nv_error(priv, "playlist %d update timeout\n", engine); |
127 | mutex_unlock(&nv_subdev(priv)->mutex); | ||
125 | } | 128 | } |
126 | 129 | ||
127 | static int | 130 | static int |
diff --git a/drivers/gpu/drm/nouveau/core/include/core/class.h b/drivers/gpu/drm/nouveau/core/include/core/class.h index 0a393f7f055f..5a5961b6a6a3 100644 --- a/drivers/gpu/drm/nouveau/core/include/core/class.h +++ b/drivers/gpu/drm/nouveau/core/include/core/class.h | |||
@@ -218,7 +218,7 @@ struct nv04_display_class { | |||
218 | #define NV50_DISP_DAC_PWR_STATE 0x00000040 | 218 | #define NV50_DISP_DAC_PWR_STATE 0x00000040 |
219 | #define NV50_DISP_DAC_PWR_STATE_ON 0x00000000 | 219 | #define NV50_DISP_DAC_PWR_STATE_ON 0x00000000 |
220 | #define NV50_DISP_DAC_PWR_STATE_OFF 0x00000040 | 220 | #define NV50_DISP_DAC_PWR_STATE_OFF 0x00000040 |
221 | #define NV50_DISP_DAC_LOAD 0x0002000c | 221 | #define NV50_DISP_DAC_LOAD 0x00020100 |
222 | #define NV50_DISP_DAC_LOAD_VALUE 0x00000007 | 222 | #define NV50_DISP_DAC_LOAD_VALUE 0x00000007 |
223 | 223 | ||
224 | #define NV50_DISP_PIOR_MTHD 0x00030000 | 224 | #define NV50_DISP_PIOR_MTHD 0x00030000 |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c index c300b5e7b670..c434d398d16f 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c | |||
@@ -1940,8 +1940,8 @@ init_zm_mask_add(struct nvbios_init *init) | |||
1940 | trace("ZM_MASK_ADD\tR[0x%06x] &= 0x%08x += 0x%08x\n", addr, mask, add); | 1940 | trace("ZM_MASK_ADD\tR[0x%06x] &= 0x%08x += 0x%08x\n", addr, mask, add); |
1941 | init->offset += 13; | 1941 | init->offset += 13; |
1942 | 1942 | ||
1943 | data = init_rd32(init, addr) & mask; | 1943 | data = init_rd32(init, addr); |
1944 | data |= ((data + add) & ~mask); | 1944 | data = (data & mask) | ((data + add) & ~mask); |
1945 | init_wr32(init, addr, data); | 1945 | init_wr32(init, addr, data); |
1946 | } | 1946 | } |
1947 | 1947 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c index e4940fb166e8..fb794e997fbc 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c | |||
@@ -29,7 +29,6 @@ | |||
29 | struct nvc0_ltcg_priv { | 29 | struct nvc0_ltcg_priv { |
30 | struct nouveau_ltcg base; | 30 | struct nouveau_ltcg base; |
31 | u32 part_nr; | 31 | u32 part_nr; |
32 | u32 part_mask; | ||
33 | u32 subp_nr; | 32 | u32 subp_nr; |
34 | struct nouveau_mm tags; | 33 | struct nouveau_mm tags; |
35 | u32 num_tags; | 34 | u32 num_tags; |
@@ -105,8 +104,6 @@ nvc0_ltcg_tags_clear(struct nouveau_ltcg *ltcg, u32 first, u32 count) | |||
105 | 104 | ||
106 | /* wait until it's finished with clearing */ | 105 | /* wait until it's finished with clearing */ |
107 | for (p = 0; p < priv->part_nr; ++p) { | 106 | for (p = 0; p < priv->part_nr; ++p) { |
108 | if (!(priv->part_mask & (1 << p))) | ||
109 | continue; | ||
110 | for (i = 0; i < priv->subp_nr; ++i) | 107 | for (i = 0; i < priv->subp_nr; ++i) |
111 | nv_wait(priv, 0x1410c8 + p * 0x2000 + i * 0x400, ~0, 0); | 108 | nv_wait(priv, 0x1410c8 + p * 0x2000 + i * 0x400, ~0, 0); |
112 | } | 109 | } |
@@ -121,6 +118,8 @@ nvc0_ltcg_init_tag_ram(struct nouveau_fb *pfb, struct nvc0_ltcg_priv *priv) | |||
121 | int ret; | 118 | int ret; |
122 | 119 | ||
123 | nv_wr32(priv, 0x17e8d8, priv->part_nr); | 120 | nv_wr32(priv, 0x17e8d8, priv->part_nr); |
121 | if (nv_device(pfb)->card_type >= NV_E0) | ||
122 | nv_wr32(priv, 0x17e000, priv->part_nr); | ||
124 | 123 | ||
125 | /* tags for 1/4 of VRAM should be enough (8192/4 per GiB of VRAM) */ | 124 | /* tags for 1/4 of VRAM should be enough (8192/4 per GiB of VRAM) */ |
126 | priv->num_tags = (pfb->ram.size >> 17) / 4; | 125 | priv->num_tags = (pfb->ram.size >> 17) / 4; |
@@ -167,16 +166,20 @@ nvc0_ltcg_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
167 | { | 166 | { |
168 | struct nvc0_ltcg_priv *priv; | 167 | struct nvc0_ltcg_priv *priv; |
169 | struct nouveau_fb *pfb = nouveau_fb(parent); | 168 | struct nouveau_fb *pfb = nouveau_fb(parent); |
170 | int ret; | 169 | u32 parts, mask; |
170 | int ret, i; | ||
171 | 171 | ||
172 | ret = nouveau_ltcg_create(parent, engine, oclass, &priv); | 172 | ret = nouveau_ltcg_create(parent, engine, oclass, &priv); |
173 | *pobject = nv_object(priv); | 173 | *pobject = nv_object(priv); |
174 | if (ret) | 174 | if (ret) |
175 | return ret; | 175 | return ret; |
176 | 176 | ||
177 | priv->part_nr = nv_rd32(priv, 0x022438); | 177 | parts = nv_rd32(priv, 0x022438); |
178 | priv->part_mask = nv_rd32(priv, 0x022554); | 178 | mask = nv_rd32(priv, 0x022554); |
179 | 179 | for (i = 0; i < parts; i++) { | |
180 | if (!(mask & (1 << i))) | ||
181 | priv->part_nr++; | ||
182 | } | ||
180 | priv->subp_nr = nv_rd32(priv, 0x17e8dc) >> 28; | 183 | priv->subp_nr = nv_rd32(priv, 0x17e8dc) >> 28; |
181 | 184 | ||
182 | nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ | 185 | nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 7bf22d4a3d96..f17dc2ab03ec 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -638,17 +638,8 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, | |||
638 | } | 638 | } |
639 | 639 | ||
640 | s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head); | 640 | s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head); |
641 | if (s->event) { | 641 | if (s->event) |
642 | struct drm_pending_vblank_event *e = s->event; | 642 | drm_send_vblank_event(dev, -1, s->event); |
643 | struct timeval now; | ||
644 | |||
645 | do_gettimeofday(&now); | ||
646 | e->event.sequence = 0; | ||
647 | e->event.tv_sec = now.tv_sec; | ||
648 | e->event.tv_usec = now.tv_usec; | ||
649 | list_add_tail(&e->base.link, &e->base.file_priv->event_list); | ||
650 | wake_up_interruptible(&e->base.file_priv->event_wait); | ||
651 | } | ||
652 | 643 | ||
653 | list_del(&s->head); | 644 | list_del(&s->head); |
654 | if (ps) | 645 | if (ps) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 46c152ff0a80..383f4e6ea9d1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -453,18 +453,32 @@ nouveau_do_suspend(struct drm_device *dev) | |||
453 | NV_INFO(drm, "evicting buffers...\n"); | 453 | NV_INFO(drm, "evicting buffers...\n"); |
454 | ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); | 454 | ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); |
455 | 455 | ||
456 | NV_INFO(drm, "waiting for kernel channels to go idle...\n"); | ||
457 | if (drm->cechan) { | ||
458 | ret = nouveau_channel_idle(drm->cechan); | ||
459 | if (ret) | ||
460 | return ret; | ||
461 | } | ||
462 | |||
463 | if (drm->channel) { | ||
464 | ret = nouveau_channel_idle(drm->channel); | ||
465 | if (ret) | ||
466 | return ret; | ||
467 | } | ||
468 | |||
469 | NV_INFO(drm, "suspending client object trees...\n"); | ||
456 | if (drm->fence && nouveau_fence(drm)->suspend) { | 470 | if (drm->fence && nouveau_fence(drm)->suspend) { |
457 | if (!nouveau_fence(drm)->suspend(drm)) | 471 | if (!nouveau_fence(drm)->suspend(drm)) |
458 | return -ENOMEM; | 472 | return -ENOMEM; |
459 | } | 473 | } |
460 | 474 | ||
461 | NV_INFO(drm, "suspending client object trees...\n"); | ||
462 | list_for_each_entry(cli, &drm->clients, head) { | 475 | list_for_each_entry(cli, &drm->clients, head) { |
463 | ret = nouveau_client_fini(&cli->base, true); | 476 | ret = nouveau_client_fini(&cli->base, true); |
464 | if (ret) | 477 | if (ret) |
465 | goto fail_client; | 478 | goto fail_client; |
466 | } | 479 | } |
467 | 480 | ||
481 | NV_INFO(drm, "suspending kernel object tree...\n"); | ||
468 | ret = nouveau_client_fini(&drm->client.base, true); | 482 | ret = nouveau_client_fini(&drm->client.base, true); |
469 | if (ret) | 483 | if (ret) |
470 | goto fail_client; | 484 | goto fail_client; |
@@ -514,17 +528,18 @@ nouveau_do_resume(struct drm_device *dev) | |||
514 | 528 | ||
515 | nouveau_agp_reset(drm); | 529 | nouveau_agp_reset(drm); |
516 | 530 | ||
517 | NV_INFO(drm, "resuming client object trees...\n"); | 531 | NV_INFO(drm, "resuming kernel object tree...\n"); |
518 | nouveau_client_init(&drm->client.base); | 532 | nouveau_client_init(&drm->client.base); |
519 | nouveau_agp_init(drm); | 533 | nouveau_agp_init(drm); |
520 | 534 | ||
535 | NV_INFO(drm, "resuming client object trees...\n"); | ||
536 | if (drm->fence && nouveau_fence(drm)->resume) | ||
537 | nouveau_fence(drm)->resume(drm); | ||
538 | |||
521 | list_for_each_entry(cli, &drm->clients, head) { | 539 | list_for_each_entry(cli, &drm->clients, head) { |
522 | nouveau_client_init(&cli->base); | 540 | nouveau_client_init(&cli->base); |
523 | } | 541 | } |
524 | 542 | ||
525 | if (drm->fence && nouveau_fence(drm)->resume) | ||
526 | nouveau_fence(drm)->resume(drm); | ||
527 | |||
528 | nouveau_run_vbios_init(dev); | 543 | nouveau_run_vbios_init(dev); |
529 | nouveau_pm_resume(dev); | 544 | nouveau_pm_resume(dev); |
530 | 545 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index ebf0a683305e..dd5e01f89f28 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -1554,7 +1554,9 @@ nv50_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) | |||
1554 | { | 1554 | { |
1555 | struct nv50_disp *disp = nv50_disp(encoder->dev); | 1555 | struct nv50_disp *disp = nv50_disp(encoder->dev); |
1556 | int ret, or = nouveau_encoder(encoder)->or; | 1556 | int ret, or = nouveau_encoder(encoder)->or; |
1557 | u32 load = 0; | 1557 | u32 load = nouveau_drm(encoder->dev)->vbios.dactestval; |
1558 | if (load == 0) | ||
1559 | load = 340; | ||
1558 | 1560 | ||
1559 | ret = nv_exec(disp->core, NV50_DISP_DAC_LOAD + or, &load, sizeof(load)); | 1561 | ret = nv_exec(disp->core, NV50_DISP_DAC_LOAD + or, &load, sizeof(load)); |
1560 | if (ret || load != 7) | 1562 | if (ret || load != 7) |
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 9c53c25e5201..826586ffbe83 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c | |||
@@ -649,6 +649,9 @@ static void pdev_shutdown(struct platform_device *device) | |||
649 | 649 | ||
650 | static int pdev_probe(struct platform_device *device) | 650 | static int pdev_probe(struct platform_device *device) |
651 | { | 651 | { |
652 | if (omapdss_is_initialized() == false) | ||
653 | return -EPROBE_DEFER; | ||
654 | |||
652 | DBG("%s", device->name); | 655 | DBG("%s", device->name); |
653 | return drm_platform_init(&omap_drm_driver, device); | 656 | return drm_platform_init(&omap_drm_driver, device); |
654 | } | 657 | } |
diff --git a/drivers/gpu/drm/qxl/Kconfig b/drivers/gpu/drm/qxl/Kconfig index 2f1a57e11140..d6c12796023c 100644 --- a/drivers/gpu/drm/qxl/Kconfig +++ b/drivers/gpu/drm/qxl/Kconfig | |||
@@ -4,6 +4,7 @@ config DRM_QXL | |||
4 | select FB_SYS_FILLRECT | 4 | select FB_SYS_FILLRECT |
5 | select FB_SYS_COPYAREA | 5 | select FB_SYS_COPYAREA |
6 | select FB_SYS_IMAGEBLIT | 6 | select FB_SYS_IMAGEBLIT |
7 | select FB_DEFERRED_IO | ||
7 | select DRM_KMS_HELPER | 8 | select DRM_KMS_HELPER |
8 | select DRM_TTM | 9 | select DRM_TTM |
9 | help | 10 | help |
diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c index 08b0823c93d5..f86771481317 100644 --- a/drivers/gpu/drm/qxl/qxl_cmd.c +++ b/drivers/gpu/drm/qxl/qxl_cmd.c | |||
@@ -277,7 +277,7 @@ out_unref: | |||
277 | return 0; | 277 | return 0; |
278 | } | 278 | } |
279 | 279 | ||
280 | static int wait_for_io_cmd_user(struct qxl_device *qdev, uint8_t val, long port) | 280 | static int wait_for_io_cmd_user(struct qxl_device *qdev, uint8_t val, long port, bool intr) |
281 | { | 281 | { |
282 | int irq_num; | 282 | int irq_num; |
283 | long addr = qdev->io_base + port; | 283 | long addr = qdev->io_base + port; |
@@ -285,20 +285,29 @@ static int wait_for_io_cmd_user(struct qxl_device *qdev, uint8_t val, long port) | |||
285 | 285 | ||
286 | mutex_lock(&qdev->async_io_mutex); | 286 | mutex_lock(&qdev->async_io_mutex); |
287 | irq_num = atomic_read(&qdev->irq_received_io_cmd); | 287 | irq_num = atomic_read(&qdev->irq_received_io_cmd); |
288 | |||
289 | |||
290 | if (qdev->last_sent_io_cmd > irq_num) { | 288 | if (qdev->last_sent_io_cmd > irq_num) { |
291 | ret = wait_event_interruptible(qdev->io_cmd_event, | 289 | if (intr) |
292 | atomic_read(&qdev->irq_received_io_cmd) > irq_num); | 290 | ret = wait_event_interruptible_timeout(qdev->io_cmd_event, |
293 | if (ret) | 291 | atomic_read(&qdev->irq_received_io_cmd) > irq_num, 5*HZ); |
292 | else | ||
293 | ret = wait_event_timeout(qdev->io_cmd_event, | ||
294 | atomic_read(&qdev->irq_received_io_cmd) > irq_num, 5*HZ); | ||
295 | /* 0 is timeout, just bail the "hw" has gone away */ | ||
296 | if (ret <= 0) | ||
294 | goto out; | 297 | goto out; |
295 | irq_num = atomic_read(&qdev->irq_received_io_cmd); | 298 | irq_num = atomic_read(&qdev->irq_received_io_cmd); |
296 | } | 299 | } |
297 | outb(val, addr); | 300 | outb(val, addr); |
298 | qdev->last_sent_io_cmd = irq_num + 1; | 301 | qdev->last_sent_io_cmd = irq_num + 1; |
299 | ret = wait_event_interruptible(qdev->io_cmd_event, | 302 | if (intr) |
300 | atomic_read(&qdev->irq_received_io_cmd) > irq_num); | 303 | ret = wait_event_interruptible_timeout(qdev->io_cmd_event, |
304 | atomic_read(&qdev->irq_received_io_cmd) > irq_num, 5*HZ); | ||
305 | else | ||
306 | ret = wait_event_timeout(qdev->io_cmd_event, | ||
307 | atomic_read(&qdev->irq_received_io_cmd) > irq_num, 5*HZ); | ||
301 | out: | 308 | out: |
309 | if (ret > 0) | ||
310 | ret = 0; | ||
302 | mutex_unlock(&qdev->async_io_mutex); | 311 | mutex_unlock(&qdev->async_io_mutex); |
303 | return ret; | 312 | return ret; |
304 | } | 313 | } |
@@ -308,7 +317,7 @@ static void wait_for_io_cmd(struct qxl_device *qdev, uint8_t val, long port) | |||
308 | int ret; | 317 | int ret; |
309 | 318 | ||
310 | restart: | 319 | restart: |
311 | ret = wait_for_io_cmd_user(qdev, val, port); | 320 | ret = wait_for_io_cmd_user(qdev, val, port, false); |
312 | if (ret == -ERESTARTSYS) | 321 | if (ret == -ERESTARTSYS) |
313 | goto restart; | 322 | goto restart; |
314 | } | 323 | } |
@@ -340,7 +349,7 @@ int qxl_io_update_area(struct qxl_device *qdev, struct qxl_bo *surf, | |||
340 | mutex_lock(&qdev->update_area_mutex); | 349 | mutex_lock(&qdev->update_area_mutex); |
341 | qdev->ram_header->update_area = *area; | 350 | qdev->ram_header->update_area = *area; |
342 | qdev->ram_header->update_surface = surface_id; | 351 | qdev->ram_header->update_surface = surface_id; |
343 | ret = wait_for_io_cmd_user(qdev, 0, QXL_IO_UPDATE_AREA_ASYNC); | 352 | ret = wait_for_io_cmd_user(qdev, 0, QXL_IO_UPDATE_AREA_ASYNC, true); |
344 | mutex_unlock(&qdev->update_area_mutex); | 353 | mutex_unlock(&qdev->update_area_mutex); |
345 | return ret; | 354 | return ret; |
346 | } | 355 | } |
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index fcfd4436ceed..823d29e926ec 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c | |||
@@ -428,10 +428,10 @@ static int qxl_framebuffer_surface_dirty(struct drm_framebuffer *fb, | |||
428 | int inc = 1; | 428 | int inc = 1; |
429 | 429 | ||
430 | qobj = gem_to_qxl_bo(qxl_fb->obj); | 430 | qobj = gem_to_qxl_bo(qxl_fb->obj); |
431 | if (qxl_fb != qdev->active_user_framebuffer) { | 431 | /* if we aren't primary surface ignore this */ |
432 | DRM_INFO("%s: qxl_fb 0x%p != qdev->active_user_framebuffer 0x%p\n", | 432 | if (!qobj->is_primary) |
433 | __func__, qxl_fb, qdev->active_user_framebuffer); | 433 | return 0; |
434 | } | 434 | |
435 | if (!num_clips) { | 435 | if (!num_clips) { |
436 | num_clips = 1; | 436 | num_clips = 1; |
437 | clips = &norect; | 437 | clips = &norect; |
@@ -604,7 +604,6 @@ static int qxl_crtc_mode_set(struct drm_crtc *crtc, | |||
604 | mode->hdisplay, | 604 | mode->hdisplay, |
605 | mode->vdisplay); | 605 | mode->vdisplay); |
606 | } | 606 | } |
607 | qdev->mode_set = true; | ||
608 | return 0; | 607 | return 0; |
609 | } | 608 | } |
610 | 609 | ||
@@ -893,7 +892,6 @@ qxl_user_framebuffer_create(struct drm_device *dev, | |||
893 | { | 892 | { |
894 | struct drm_gem_object *obj; | 893 | struct drm_gem_object *obj; |
895 | struct qxl_framebuffer *qxl_fb; | 894 | struct qxl_framebuffer *qxl_fb; |
896 | struct qxl_device *qdev = dev->dev_private; | ||
897 | int ret; | 895 | int ret; |
898 | 896 | ||
899 | obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); | 897 | obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); |
@@ -909,13 +907,6 @@ qxl_user_framebuffer_create(struct drm_device *dev, | |||
909 | return NULL; | 907 | return NULL; |
910 | } | 908 | } |
911 | 909 | ||
912 | if (qdev->active_user_framebuffer) { | ||
913 | DRM_INFO("%s: active_user_framebuffer %p -> %p\n", | ||
914 | __func__, | ||
915 | qdev->active_user_framebuffer, qxl_fb); | ||
916 | } | ||
917 | qdev->active_user_framebuffer = qxl_fb; | ||
918 | |||
919 | return &qxl_fb->base; | 910 | return &qxl_fb->base; |
920 | } | 911 | } |
921 | 912 | ||
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 52b582c211da..43d06ab28a21 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h | |||
@@ -255,12 +255,6 @@ struct qxl_device { | |||
255 | struct qxl_gem gem; | 255 | struct qxl_gem gem; |
256 | struct qxl_mode_info mode_info; | 256 | struct qxl_mode_info mode_info; |
257 | 257 | ||
258 | /* | ||
259 | * last created framebuffer with fb_create | ||
260 | * only used by debugfs dumbppm | ||
261 | */ | ||
262 | struct qxl_framebuffer *active_user_framebuffer; | ||
263 | |||
264 | struct fb_info *fbdev_info; | 258 | struct fb_info *fbdev_info; |
265 | struct qxl_framebuffer *fbdev_qfb; | 259 | struct qxl_framebuffer *fbdev_qfb; |
266 | void *ram_physical; | 260 | void *ram_physical; |
@@ -270,7 +264,6 @@ struct qxl_device { | |||
270 | struct qxl_ring *cursor_ring; | 264 | struct qxl_ring *cursor_ring; |
271 | 265 | ||
272 | struct qxl_ram_header *ram_header; | 266 | struct qxl_ram_header *ram_header; |
273 | bool mode_set; | ||
274 | 267 | ||
275 | bool primary_created; | 268 | bool primary_created; |
276 | 269 | ||
diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c index 04b64f9cbfdb..a4b71b25fa53 100644 --- a/drivers/gpu/drm/qxl/qxl_ioctl.c +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c | |||
@@ -151,7 +151,7 @@ static int qxl_execbuffer_ioctl(struct drm_device *dev, void *data, | |||
151 | struct qxl_bo *cmd_bo; | 151 | struct qxl_bo *cmd_bo; |
152 | int release_type; | 152 | int release_type; |
153 | struct drm_qxl_command *commands = | 153 | struct drm_qxl_command *commands = |
154 | (struct drm_qxl_command *)execbuffer->commands; | 154 | (struct drm_qxl_command *)(uintptr_t)execbuffer->commands; |
155 | 155 | ||
156 | if (DRM_COPY_FROM_USER(&user_cmd, &commands[cmd_num], | 156 | if (DRM_COPY_FROM_USER(&user_cmd, &commands[cmd_num], |
157 | sizeof(user_cmd))) | 157 | sizeof(user_cmd))) |
@@ -193,7 +193,7 @@ static int qxl_execbuffer_ioctl(struct drm_device *dev, void *data, | |||
193 | 193 | ||
194 | for (i = 0 ; i < user_cmd.relocs_num; ++i) { | 194 | for (i = 0 ; i < user_cmd.relocs_num; ++i) { |
195 | if (DRM_COPY_FROM_USER(&reloc, | 195 | if (DRM_COPY_FROM_USER(&reloc, |
196 | &((struct drm_qxl_reloc *)user_cmd.relocs)[i], | 196 | &((struct drm_qxl_reloc *)(uintptr_t)user_cmd.relocs)[i], |
197 | sizeof(reloc))) { | 197 | sizeof(reloc))) { |
198 | qxl_bo_list_unreserve(&reloc_list, true); | 198 | qxl_bo_list_unreserve(&reloc_list, true); |
199 | qxl_release_unreserve(qdev, release); | 199 | qxl_release_unreserve(qdev, release); |
@@ -294,6 +294,7 @@ static int qxl_update_area_ioctl(struct drm_device *dev, void *data, | |||
294 | goto out; | 294 | goto out; |
295 | 295 | ||
296 | if (!qobj->pin_count) { | 296 | if (!qobj->pin_count) { |
297 | qxl_ttm_placement_from_domain(qobj, qobj->type); | ||
297 | ret = ttm_bo_validate(&qobj->tbo, &qobj->placement, | 298 | ret = ttm_bo_validate(&qobj->tbo, &qobj->placement, |
298 | true, false); | 299 | true, false); |
299 | if (unlikely(ret)) | 300 | if (unlikely(ret)) |
diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c index 85127ed24cfd..e27ce2a907cf 100644 --- a/drivers/gpu/drm/qxl/qxl_kms.c +++ b/drivers/gpu/drm/qxl/qxl_kms.c | |||
@@ -128,12 +128,13 @@ int qxl_device_init(struct qxl_device *qdev, | |||
128 | 128 | ||
129 | qdev->vram_mapping = io_mapping_create_wc(qdev->vram_base, pci_resource_len(pdev, 0)); | 129 | qdev->vram_mapping = io_mapping_create_wc(qdev->vram_base, pci_resource_len(pdev, 0)); |
130 | qdev->surface_mapping = io_mapping_create_wc(qdev->surfaceram_base, qdev->surfaceram_size); | 130 | qdev->surface_mapping = io_mapping_create_wc(qdev->surfaceram_base, qdev->surfaceram_size); |
131 | DRM_DEBUG_KMS("qxl: vram %p-%p(%dM %dk), surface %p-%p(%dM %dk)\n", | 131 | DRM_DEBUG_KMS("qxl: vram %llx-%llx(%dM %dk), surface %llx-%llx(%dM %dk)\n", |
132 | (void *)qdev->vram_base, (void *)pci_resource_end(pdev, 0), | 132 | (unsigned long long)qdev->vram_base, |
133 | (unsigned long long)pci_resource_end(pdev, 0), | ||
133 | (int)pci_resource_len(pdev, 0) / 1024 / 1024, | 134 | (int)pci_resource_len(pdev, 0) / 1024 / 1024, |
134 | (int)pci_resource_len(pdev, 0) / 1024, | 135 | (int)pci_resource_len(pdev, 0) / 1024, |
135 | (void *)qdev->surfaceram_base, | 136 | (unsigned long long)qdev->surfaceram_base, |
136 | (void *)pci_resource_end(pdev, 1), | 137 | (unsigned long long)pci_resource_end(pdev, 1), |
137 | (int)qdev->surfaceram_size / 1024 / 1024, | 138 | (int)qdev->surfaceram_size / 1024 / 1024, |
138 | (int)qdev->surfaceram_size / 1024); | 139 | (int)qdev->surfaceram_size / 1024); |
139 | 140 | ||
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 6d6fdb3ba0d0..d5df8fd10217 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1811,12 +1811,9 @@ static bool atombios_crtc_mode_fixup(struct drm_crtc *crtc, | |||
1811 | 1811 | ||
1812 | static void atombios_crtc_prepare(struct drm_crtc *crtc) | 1812 | static void atombios_crtc_prepare(struct drm_crtc *crtc) |
1813 | { | 1813 | { |
1814 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
1815 | struct drm_device *dev = crtc->dev; | 1814 | struct drm_device *dev = crtc->dev; |
1816 | struct radeon_device *rdev = dev->dev_private; | 1815 | struct radeon_device *rdev = dev->dev_private; |
1817 | 1816 | ||
1818 | radeon_crtc->in_mode_set = true; | ||
1819 | |||
1820 | /* disable crtc pair power gating before programming */ | 1817 | /* disable crtc pair power gating before programming */ |
1821 | if (ASIC_IS_DCE6(rdev)) | 1818 | if (ASIC_IS_DCE6(rdev)) |
1822 | atombios_powergate_crtc(crtc, ATOM_DISABLE); | 1819 | atombios_powergate_crtc(crtc, ATOM_DISABLE); |
@@ -1827,11 +1824,8 @@ static void atombios_crtc_prepare(struct drm_crtc *crtc) | |||
1827 | 1824 | ||
1828 | static void atombios_crtc_commit(struct drm_crtc *crtc) | 1825 | static void atombios_crtc_commit(struct drm_crtc *crtc) |
1829 | { | 1826 | { |
1830 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
1831 | |||
1832 | atombios_crtc_dpms(crtc, DRM_MODE_DPMS_ON); | 1827 | atombios_crtc_dpms(crtc, DRM_MODE_DPMS_ON); |
1833 | atombios_lock_crtc(crtc, ATOM_DISABLE); | 1828 | atombios_lock_crtc(crtc, ATOM_DISABLE); |
1834 | radeon_crtc->in_mode_set = false; | ||
1835 | } | 1829 | } |
1836 | 1830 | ||
1837 | static void atombios_crtc_disable(struct drm_crtc *crtc) | 1831 | static void atombios_crtc_disable(struct drm_crtc *crtc) |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 44a7da66e081..8406c8251fbf 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -667,6 +667,8 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) | |||
667 | int | 667 | int |
668 | atombios_get_encoder_mode(struct drm_encoder *encoder) | 668 | atombios_get_encoder_mode(struct drm_encoder *encoder) |
669 | { | 669 | { |
670 | struct drm_device *dev = encoder->dev; | ||
671 | struct radeon_device *rdev = dev->dev_private; | ||
670 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 672 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
671 | struct drm_connector *connector; | 673 | struct drm_connector *connector; |
672 | struct radeon_connector *radeon_connector; | 674 | struct radeon_connector *radeon_connector; |
@@ -693,7 +695,8 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
693 | case DRM_MODE_CONNECTOR_DVII: | 695 | case DRM_MODE_CONNECTOR_DVII: |
694 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ | 696 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ |
695 | if (drm_detect_hdmi_monitor(radeon_connector->edid) && | 697 | if (drm_detect_hdmi_monitor(radeon_connector->edid) && |
696 | radeon_audio) | 698 | radeon_audio && |
699 | !ASIC_IS_DCE6(rdev)) /* remove once we support DCE6 */ | ||
697 | return ATOM_ENCODER_MODE_HDMI; | 700 | return ATOM_ENCODER_MODE_HDMI; |
698 | else if (radeon_connector->use_digital) | 701 | else if (radeon_connector->use_digital) |
699 | return ATOM_ENCODER_MODE_DVI; | 702 | return ATOM_ENCODER_MODE_DVI; |
@@ -704,7 +707,8 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
704 | case DRM_MODE_CONNECTOR_HDMIA: | 707 | case DRM_MODE_CONNECTOR_HDMIA: |
705 | default: | 708 | default: |
706 | if (drm_detect_hdmi_monitor(radeon_connector->edid) && | 709 | if (drm_detect_hdmi_monitor(radeon_connector->edid) && |
707 | radeon_audio) | 710 | radeon_audio && |
711 | !ASIC_IS_DCE6(rdev)) /* remove once we support DCE6 */ | ||
708 | return ATOM_ENCODER_MODE_HDMI; | 712 | return ATOM_ENCODER_MODE_HDMI; |
709 | else | 713 | else |
710 | return ATOM_ENCODER_MODE_DVI; | 714 | return ATOM_ENCODER_MODE_DVI; |
@@ -718,7 +722,8 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
718 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) | 722 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) |
719 | return ATOM_ENCODER_MODE_DP; | 723 | return ATOM_ENCODER_MODE_DP; |
720 | else if (drm_detect_hdmi_monitor(radeon_connector->edid) && | 724 | else if (drm_detect_hdmi_monitor(radeon_connector->edid) && |
721 | radeon_audio) | 725 | radeon_audio && |
726 | !ASIC_IS_DCE6(rdev)) /* remove once we support DCE6 */ | ||
722 | return ATOM_ENCODER_MODE_HDMI; | 727 | return ATOM_ENCODER_MODE_HDMI; |
723 | else | 728 | else |
724 | return ATOM_ENCODER_MODE_DVI; | 729 | return ATOM_ENCODER_MODE_DVI; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 105bafb6c29d..0f89ce3d02b9 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -2343,11 +2343,13 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav | |||
2343 | u32 crtc_enabled, tmp, frame_count, blackout; | 2343 | u32 crtc_enabled, tmp, frame_count, blackout; |
2344 | int i, j; | 2344 | int i, j; |
2345 | 2345 | ||
2346 | save->vga_render_control = RREG32(VGA_RENDER_CONTROL); | 2346 | if (!ASIC_IS_NODCE(rdev)) { |
2347 | save->vga_hdp_control = RREG32(VGA_HDP_CONTROL); | 2347 | save->vga_render_control = RREG32(VGA_RENDER_CONTROL); |
2348 | save->vga_hdp_control = RREG32(VGA_HDP_CONTROL); | ||
2348 | 2349 | ||
2349 | /* disable VGA render */ | 2350 | /* disable VGA render */ |
2350 | WREG32(VGA_RENDER_CONTROL, 0); | 2351 | WREG32(VGA_RENDER_CONTROL, 0); |
2352 | } | ||
2351 | /* blank the display controllers */ | 2353 | /* blank the display controllers */ |
2352 | for (i = 0; i < rdev->num_crtc; i++) { | 2354 | for (i = 0; i < rdev->num_crtc; i++) { |
2353 | crtc_enabled = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]) & EVERGREEN_CRTC_MASTER_EN; | 2355 | crtc_enabled = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]) & EVERGREEN_CRTC_MASTER_EN; |
@@ -2438,8 +2440,11 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s | |||
2438 | WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + crtc_offsets[i], | 2440 | WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + crtc_offsets[i], |
2439 | (u32)rdev->mc.vram_start); | 2441 | (u32)rdev->mc.vram_start); |
2440 | } | 2442 | } |
2441 | WREG32(EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH, upper_32_bits(rdev->mc.vram_start)); | 2443 | |
2442 | WREG32(EVERGREEN_VGA_MEMORY_BASE_ADDRESS, (u32)rdev->mc.vram_start); | 2444 | if (!ASIC_IS_NODCE(rdev)) { |
2445 | WREG32(EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH, upper_32_bits(rdev->mc.vram_start)); | ||
2446 | WREG32(EVERGREEN_VGA_MEMORY_BASE_ADDRESS, (u32)rdev->mc.vram_start); | ||
2447 | } | ||
2443 | 2448 | ||
2444 | /* unlock regs and wait for update */ | 2449 | /* unlock regs and wait for update */ |
2445 | for (i = 0; i < rdev->num_crtc; i++) { | 2450 | for (i = 0; i < rdev->num_crtc; i++) { |
@@ -2499,10 +2504,12 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s | |||
2499 | } | 2504 | } |
2500 | } | 2505 | } |
2501 | } | 2506 | } |
2502 | /* Unlock vga access */ | 2507 | if (!ASIC_IS_NODCE(rdev)) { |
2503 | WREG32(VGA_HDP_CONTROL, save->vga_hdp_control); | 2508 | /* Unlock vga access */ |
2504 | mdelay(1); | 2509 | WREG32(VGA_HDP_CONTROL, save->vga_hdp_control); |
2505 | WREG32(VGA_RENDER_CONTROL, save->vga_render_control); | 2510 | mdelay(1); |
2511 | WREG32(VGA_RENDER_CONTROL, save->vga_render_control); | ||
2512 | } | ||
2506 | } | 2513 | } |
2507 | 2514 | ||
2508 | void evergreen_mc_program(struct radeon_device *rdev) | 2515 | void evergreen_mc_program(struct radeon_device *rdev) |
@@ -3405,8 +3412,8 @@ int evergreen_mc_init(struct radeon_device *rdev) | |||
3405 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); | 3412 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); |
3406 | } else { | 3413 | } else { |
3407 | /* size in MB on evergreen/cayman/tn */ | 3414 | /* size in MB on evergreen/cayman/tn */ |
3408 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 3415 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL; |
3409 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 3416 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL; |
3410 | } | 3417 | } |
3411 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 3418 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
3412 | r700_vram_gtt_location(rdev, &rdev->mc); | 3419 | r700_vram_gtt_location(rdev, &rdev->mc); |
@@ -4747,6 +4754,12 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
4747 | rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size = 0; | 4754 | rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size = 0; |
4748 | 4755 | ||
4749 | /* Enable IRQ */ | 4756 | /* Enable IRQ */ |
4757 | if (!rdev->irq.installed) { | ||
4758 | r = radeon_irq_kms_init(rdev); | ||
4759 | if (r) | ||
4760 | return r; | ||
4761 | } | ||
4762 | |||
4750 | r = r600_irq_init(rdev); | 4763 | r = r600_irq_init(rdev); |
4751 | if (r) { | 4764 | if (r) { |
4752 | DRM_ERROR("radeon: IH init failed (%d).\n", r); | 4765 | DRM_ERROR("radeon: IH init failed (%d).\n", r); |
@@ -4916,10 +4929,6 @@ int evergreen_init(struct radeon_device *rdev) | |||
4916 | if (r) | 4929 | if (r) |
4917 | return r; | 4930 | return r; |
4918 | 4931 | ||
4919 | r = radeon_irq_kms_init(rdev); | ||
4920 | if (r) | ||
4921 | return r; | ||
4922 | |||
4923 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL; | 4932 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL; |
4924 | r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024); | 4933 | r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024); |
4925 | 4934 | ||
@@ -4992,8 +5001,7 @@ void evergreen_fini(struct radeon_device *rdev) | |||
4992 | 5001 | ||
4993 | void evergreen_pcie_gen2_enable(struct radeon_device *rdev) | 5002 | void evergreen_pcie_gen2_enable(struct radeon_device *rdev) |
4994 | { | 5003 | { |
4995 | u32 link_width_cntl, speed_cntl, mask; | 5004 | u32 link_width_cntl, speed_cntl; |
4996 | int ret; | ||
4997 | 5005 | ||
4998 | if (radeon_pcie_gen2 == 0) | 5006 | if (radeon_pcie_gen2 == 0) |
4999 | return; | 5007 | return; |
@@ -5008,11 +5016,8 @@ void evergreen_pcie_gen2_enable(struct radeon_device *rdev) | |||
5008 | if (ASIC_IS_X2(rdev)) | 5016 | if (ASIC_IS_X2(rdev)) |
5009 | return; | 5017 | return; |
5010 | 5018 | ||
5011 | ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); | 5019 | if ((rdev->pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) && |
5012 | if (ret != 0) | 5020 | (rdev->pdev->bus->max_bus_speed != PCIE_SPEED_8_0GT)) |
5013 | return; | ||
5014 | |||
5015 | if (!(mask & DRM_PCIE_SPEED_50)) | ||
5016 | return; | 5021 | return; |
5017 | 5022 | ||
5018 | speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); | 5023 | speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index b4ab8ceb1654..ed7c8a768092 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -154,19 +154,18 @@ static void evergreen_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
154 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 154 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
155 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 155 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
156 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); | 156 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); |
157 | u32 base_rate = 48000; | 157 | u32 base_rate = 24000; |
158 | 158 | ||
159 | if (!dig || !dig->afmt) | 159 | if (!dig || !dig->afmt) |
160 | return; | 160 | return; |
161 | 161 | ||
162 | /* XXX: properly calculate this */ | ||
163 | /* XXX two dtos; generally use dto0 for hdmi */ | 162 | /* XXX two dtos; generally use dto0 for hdmi */ |
164 | /* Express [24MHz / target pixel clock] as an exact rational | 163 | /* Express [24MHz / target pixel clock] as an exact rational |
165 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE | 164 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE |
166 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator | 165 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator |
167 | */ | 166 | */ |
168 | WREG32(DCCG_AUDIO_DTO0_PHASE, (base_rate*50) & 0xffffff); | 167 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); |
169 | WREG32(DCCG_AUDIO_DTO0_MODULE, (clock*100) & 0xffffff); | 168 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); |
170 | WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); | 169 | WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); |
171 | } | 170 | } |
172 | 171 | ||
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 7969c0c8ec20..84583302b081 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -2025,6 +2025,12 @@ static int cayman_startup(struct radeon_device *rdev) | |||
2025 | } | 2025 | } |
2026 | 2026 | ||
2027 | /* Enable IRQ */ | 2027 | /* Enable IRQ */ |
2028 | if (!rdev->irq.installed) { | ||
2029 | r = radeon_irq_kms_init(rdev); | ||
2030 | if (r) | ||
2031 | return r; | ||
2032 | } | ||
2033 | |||
2028 | r = r600_irq_init(rdev); | 2034 | r = r600_irq_init(rdev); |
2029 | if (r) { | 2035 | if (r) { |
2030 | DRM_ERROR("radeon: IH init failed (%d).\n", r); | 2036 | DRM_ERROR("radeon: IH init failed (%d).\n", r); |
@@ -2190,10 +2196,6 @@ int cayman_init(struct radeon_device *rdev) | |||
2190 | if (r) | 2196 | if (r) |
2191 | return r; | 2197 | return r; |
2192 | 2198 | ||
2193 | r = radeon_irq_kms_init(rdev); | ||
2194 | if (r) | ||
2195 | return r; | ||
2196 | |||
2197 | ring->ring_obj = NULL; | 2199 | ring->ring_obj = NULL; |
2198 | r600_ring_init(rdev, ring, 1024 * 1024); | 2200 | r600_ring_init(rdev, ring, 1024 * 1024); |
2199 | 2201 | ||
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 4973bff37fec..d0314ecbd7c1 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -3869,6 +3869,12 @@ static int r100_startup(struct radeon_device *rdev) | |||
3869 | } | 3869 | } |
3870 | 3870 | ||
3871 | /* Enable IRQ */ | 3871 | /* Enable IRQ */ |
3872 | if (!rdev->irq.installed) { | ||
3873 | r = radeon_irq_kms_init(rdev); | ||
3874 | if (r) | ||
3875 | return r; | ||
3876 | } | ||
3877 | |||
3872 | r100_irq_set(rdev); | 3878 | r100_irq_set(rdev); |
3873 | rdev->config.r100.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | 3879 | rdev->config.r100.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
3874 | /* 1M ring buffer */ | 3880 | /* 1M ring buffer */ |
@@ -4024,9 +4030,6 @@ int r100_init(struct radeon_device *rdev) | |||
4024 | r = radeon_fence_driver_init(rdev); | 4030 | r = radeon_fence_driver_init(rdev); |
4025 | if (r) | 4031 | if (r) |
4026 | return r; | 4032 | return r; |
4027 | r = radeon_irq_kms_init(rdev); | ||
4028 | if (r) | ||
4029 | return r; | ||
4030 | /* Memory manager */ | 4033 | /* Memory manager */ |
4031 | r = radeon_bo_init(rdev); | 4034 | r = radeon_bo_init(rdev); |
4032 | if (r) | 4035 | if (r) |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index c60350e6872d..b9b776f1e582 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -1382,6 +1382,12 @@ static int r300_startup(struct radeon_device *rdev) | |||
1382 | } | 1382 | } |
1383 | 1383 | ||
1384 | /* Enable IRQ */ | 1384 | /* Enable IRQ */ |
1385 | if (!rdev->irq.installed) { | ||
1386 | r = radeon_irq_kms_init(rdev); | ||
1387 | if (r) | ||
1388 | return r; | ||
1389 | } | ||
1390 | |||
1385 | r100_irq_set(rdev); | 1391 | r100_irq_set(rdev); |
1386 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | 1392 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
1387 | /* 1M ring buffer */ | 1393 | /* 1M ring buffer */ |
@@ -1516,9 +1522,6 @@ int r300_init(struct radeon_device *rdev) | |||
1516 | r = radeon_fence_driver_init(rdev); | 1522 | r = radeon_fence_driver_init(rdev); |
1517 | if (r) | 1523 | if (r) |
1518 | return r; | 1524 | return r; |
1519 | r = radeon_irq_kms_init(rdev); | ||
1520 | if (r) | ||
1521 | return r; | ||
1522 | /* Memory manager */ | 1525 | /* Memory manager */ |
1523 | r = radeon_bo_init(rdev); | 1526 | r = radeon_bo_init(rdev); |
1524 | if (r) | 1527 | if (r) |
diff --git a/drivers/gpu/drm/radeon/r300_cmdbuf.c b/drivers/gpu/drm/radeon/r300_cmdbuf.c index 865e2c9980db..60170ea5e3a2 100644 --- a/drivers/gpu/drm/radeon/r300_cmdbuf.c +++ b/drivers/gpu/drm/radeon/r300_cmdbuf.c | |||
@@ -75,7 +75,7 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, | |||
75 | OUT_RING(CP_PACKET0(R300_RE_CLIPRECT_TL_0, nr * 2 - 1)); | 75 | OUT_RING(CP_PACKET0(R300_RE_CLIPRECT_TL_0, nr * 2 - 1)); |
76 | 76 | ||
77 | for (i = 0; i < nr; ++i) { | 77 | for (i = 0; i < nr; ++i) { |
78 | if (DRM_COPY_FROM_USER_UNCHECKED | 78 | if (DRM_COPY_FROM_USER |
79 | (&box, &cmdbuf->boxes[n + i], sizeof(box))) { | 79 | (&box, &cmdbuf->boxes[n + i], sizeof(box))) { |
80 | DRM_ERROR("copy cliprect faulted\n"); | 80 | DRM_ERROR("copy cliprect faulted\n"); |
81 | return -EFAULT; | 81 | return -EFAULT; |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 6fce2eb4dd16..4e796ecf9ea4 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -265,6 +265,12 @@ static int r420_startup(struct radeon_device *rdev) | |||
265 | } | 265 | } |
266 | 266 | ||
267 | /* Enable IRQ */ | 267 | /* Enable IRQ */ |
268 | if (!rdev->irq.installed) { | ||
269 | r = radeon_irq_kms_init(rdev); | ||
270 | if (r) | ||
271 | return r; | ||
272 | } | ||
273 | |||
268 | r100_irq_set(rdev); | 274 | r100_irq_set(rdev); |
269 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | 275 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
270 | /* 1M ring buffer */ | 276 | /* 1M ring buffer */ |
@@ -411,10 +417,6 @@ int r420_init(struct radeon_device *rdev) | |||
411 | if (r) { | 417 | if (r) { |
412 | return r; | 418 | return r; |
413 | } | 419 | } |
414 | r = radeon_irq_kms_init(rdev); | ||
415 | if (r) { | ||
416 | return r; | ||
417 | } | ||
418 | /* Memory manager */ | 420 | /* Memory manager */ |
419 | r = radeon_bo_init(rdev); | 421 | r = radeon_bo_init(rdev); |
420 | if (r) { | 422 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index f795a4e092cb..e1aece73b370 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
@@ -194,6 +194,12 @@ static int r520_startup(struct radeon_device *rdev) | |||
194 | } | 194 | } |
195 | 195 | ||
196 | /* Enable IRQ */ | 196 | /* Enable IRQ */ |
197 | if (!rdev->irq.installed) { | ||
198 | r = radeon_irq_kms_init(rdev); | ||
199 | if (r) | ||
200 | return r; | ||
201 | } | ||
202 | |||
197 | rs600_irq_set(rdev); | 203 | rs600_irq_set(rdev); |
198 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | 204 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
199 | /* 1M ring buffer */ | 205 | /* 1M ring buffer */ |
@@ -297,9 +303,6 @@ int r520_init(struct radeon_device *rdev) | |||
297 | r = radeon_fence_driver_init(rdev); | 303 | r = radeon_fence_driver_init(rdev); |
298 | if (r) | 304 | if (r) |
299 | return r; | 305 | return r; |
300 | r = radeon_irq_kms_init(rdev); | ||
301 | if (r) | ||
302 | return r; | ||
303 | /* Memory manager */ | 306 | /* Memory manager */ |
304 | r = radeon_bo_init(rdev); | 307 | r = radeon_bo_init(rdev); |
305 | if (r) | 308 | if (r) |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 1a08008c978b..6948eb88c2b7 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1046,6 +1046,24 @@ int r600_mc_wait_for_idle(struct radeon_device *rdev) | |||
1046 | return -1; | 1046 | return -1; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | uint32_t rs780_mc_rreg(struct radeon_device *rdev, uint32_t reg) | ||
1050 | { | ||
1051 | uint32_t r; | ||
1052 | |||
1053 | WREG32(R_0028F8_MC_INDEX, S_0028F8_MC_IND_ADDR(reg)); | ||
1054 | r = RREG32(R_0028FC_MC_DATA); | ||
1055 | WREG32(R_0028F8_MC_INDEX, ~C_0028F8_MC_IND_ADDR); | ||
1056 | return r; | ||
1057 | } | ||
1058 | |||
1059 | void rs780_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | ||
1060 | { | ||
1061 | WREG32(R_0028F8_MC_INDEX, S_0028F8_MC_IND_ADDR(reg) | | ||
1062 | S_0028F8_MC_IND_WR_EN(1)); | ||
1063 | WREG32(R_0028FC_MC_DATA, v); | ||
1064 | WREG32(R_0028F8_MC_INDEX, 0x7F); | ||
1065 | } | ||
1066 | |||
1049 | static void r600_mc_program(struct radeon_device *rdev) | 1067 | static void r600_mc_program(struct radeon_device *rdev) |
1050 | { | 1068 | { |
1051 | struct rv515_mc_save save; | 1069 | struct rv515_mc_save save; |
@@ -1181,6 +1199,8 @@ static int r600_mc_init(struct radeon_device *rdev) | |||
1181 | { | 1199 | { |
1182 | u32 tmp; | 1200 | u32 tmp; |
1183 | int chansize, numchan; | 1201 | int chansize, numchan; |
1202 | uint32_t h_addr, l_addr; | ||
1203 | unsigned long long k8_addr; | ||
1184 | 1204 | ||
1185 | /* Get VRAM informations */ | 1205 | /* Get VRAM informations */ |
1186 | rdev->mc.vram_is_ddr = true; | 1206 | rdev->mc.vram_is_ddr = true; |
@@ -1221,7 +1241,30 @@ static int r600_mc_init(struct radeon_device *rdev) | |||
1221 | if (rdev->flags & RADEON_IS_IGP) { | 1241 | if (rdev->flags & RADEON_IS_IGP) { |
1222 | rs690_pm_info(rdev); | 1242 | rs690_pm_info(rdev); |
1223 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | 1243 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); |
1244 | |||
1245 | if (rdev->family == CHIP_RS780 || rdev->family == CHIP_RS880) { | ||
1246 | /* Use K8 direct mapping for fast fb access. */ | ||
1247 | rdev->fastfb_working = false; | ||
1248 | h_addr = G_000012_K8_ADDR_EXT(RREG32_MC(R_000012_MC_MISC_UMA_CNTL)); | ||
1249 | l_addr = RREG32_MC(R_000011_K8_FB_LOCATION); | ||
1250 | k8_addr = ((unsigned long long)h_addr) << 32 | l_addr; | ||
1251 | #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE) | ||
1252 | if (k8_addr + rdev->mc.visible_vram_size < 0x100000000ULL) | ||
1253 | #endif | ||
1254 | { | ||
1255 | /* FastFB shall be used with UMA memory. Here it is simply disabled when sideport | ||
1256 | * memory is present. | ||
1257 | */ | ||
1258 | if (rdev->mc.igp_sideport_enabled == false && radeon_fastfb == 1) { | ||
1259 | DRM_INFO("Direct mapping: aper base at 0x%llx, replaced by direct mapping base 0x%llx.\n", | ||
1260 | (unsigned long long)rdev->mc.aper_base, k8_addr); | ||
1261 | rdev->mc.aper_base = (resource_size_t)k8_addr; | ||
1262 | rdev->fastfb_working = true; | ||
1263 | } | ||
1264 | } | ||
1265 | } | ||
1224 | } | 1266 | } |
1267 | |||
1225 | radeon_update_bandwidth_info(rdev); | 1268 | radeon_update_bandwidth_info(rdev); |
1226 | return 0; | 1269 | return 0; |
1227 | } | 1270 | } |
@@ -2644,6 +2687,9 @@ void r600_uvd_rbc_stop(struct radeon_device *rdev) | |||
2644 | int r600_uvd_init(struct radeon_device *rdev) | 2687 | int r600_uvd_init(struct radeon_device *rdev) |
2645 | { | 2688 | { |
2646 | int i, j, r; | 2689 | int i, j, r; |
2690 | /* disable byte swapping */ | ||
2691 | u32 lmi_swap_cntl = 0; | ||
2692 | u32 mp_swap_cntl = 0; | ||
2647 | 2693 | ||
2648 | /* raise clocks while booting up the VCPU */ | 2694 | /* raise clocks while booting up the VCPU */ |
2649 | radeon_set_uvd_clocks(rdev, 53300, 40000); | 2695 | radeon_set_uvd_clocks(rdev, 53300, 40000); |
@@ -2668,9 +2714,13 @@ int r600_uvd_init(struct radeon_device *rdev) | |||
2668 | WREG32(UVD_LMI_CTRL, 0x40 | (1 << 8) | (1 << 13) | | 2714 | WREG32(UVD_LMI_CTRL, 0x40 | (1 << 8) | (1 << 13) | |
2669 | (1 << 21) | (1 << 9) | (1 << 20)); | 2715 | (1 << 21) | (1 << 9) | (1 << 20)); |
2670 | 2716 | ||
2671 | /* disable byte swapping */ | 2717 | #ifdef __BIG_ENDIAN |
2672 | WREG32(UVD_LMI_SWAP_CNTL, 0); | 2718 | /* swap (8 in 32) RB and IB */ |
2673 | WREG32(UVD_MP_SWAP_CNTL, 0); | 2719 | lmi_swap_cntl = 0xa; |
2720 | mp_swap_cntl = 0; | ||
2721 | #endif | ||
2722 | WREG32(UVD_LMI_SWAP_CNTL, lmi_swap_cntl); | ||
2723 | WREG32(UVD_MP_SWAP_CNTL, mp_swap_cntl); | ||
2674 | 2724 | ||
2675 | WREG32(UVD_MPC_SET_MUXA0, 0x40c2040); | 2725 | WREG32(UVD_MPC_SET_MUXA0, 0x40c2040); |
2676 | WREG32(UVD_MPC_SET_MUXA1, 0x0); | 2726 | WREG32(UVD_MPC_SET_MUXA1, 0x0); |
@@ -3202,6 +3252,12 @@ static int r600_startup(struct radeon_device *rdev) | |||
3202 | } | 3252 | } |
3203 | 3253 | ||
3204 | /* Enable IRQ */ | 3254 | /* Enable IRQ */ |
3255 | if (!rdev->irq.installed) { | ||
3256 | r = radeon_irq_kms_init(rdev); | ||
3257 | if (r) | ||
3258 | return r; | ||
3259 | } | ||
3260 | |||
3205 | r = r600_irq_init(rdev); | 3261 | r = r600_irq_init(rdev); |
3206 | if (r) { | 3262 | if (r) { |
3207 | DRM_ERROR("radeon: IH init failed (%d).\n", r); | 3263 | DRM_ERROR("radeon: IH init failed (%d).\n", r); |
@@ -3356,10 +3412,6 @@ int r600_init(struct radeon_device *rdev) | |||
3356 | if (r) | 3412 | if (r) |
3357 | return r; | 3413 | return r; |
3358 | 3414 | ||
3359 | r = radeon_irq_kms_init(rdev); | ||
3360 | if (r) | ||
3361 | return r; | ||
3362 | |||
3363 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL; | 3415 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL; |
3364 | r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024); | 3416 | r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024); |
3365 | 3417 | ||
@@ -4631,8 +4683,6 @@ static void r600_pcie_gen2_enable(struct radeon_device *rdev) | |||
4631 | { | 4683 | { |
4632 | u32 link_width_cntl, lanes, speed_cntl, training_cntl, tmp; | 4684 | u32 link_width_cntl, lanes, speed_cntl, training_cntl, tmp; |
4633 | u16 link_cntl2; | 4685 | u16 link_cntl2; |
4634 | u32 mask; | ||
4635 | int ret; | ||
4636 | 4686 | ||
4637 | if (radeon_pcie_gen2 == 0) | 4687 | if (radeon_pcie_gen2 == 0) |
4638 | return; | 4688 | return; |
@@ -4651,11 +4701,8 @@ static void r600_pcie_gen2_enable(struct radeon_device *rdev) | |||
4651 | if (rdev->family <= CHIP_R600) | 4701 | if (rdev->family <= CHIP_R600) |
4652 | return; | 4702 | return; |
4653 | 4703 | ||
4654 | ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); | 4704 | if ((rdev->pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) && |
4655 | if (ret != 0) | 4705 | (rdev->pdev->bus->max_bus_speed != PCIE_SPEED_8_0GT)) |
4656 | return; | ||
4657 | |||
4658 | if (!(mask & DRM_PCIE_SPEED_50)) | ||
4659 | return; | 4706 | return; |
4660 | 4707 | ||
4661 | speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); | 4708 | speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 47f180a79352..456750a0daa5 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -232,7 +232,7 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
232 | struct radeon_device *rdev = dev->dev_private; | 232 | struct radeon_device *rdev = dev->dev_private; |
233 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 233 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
234 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 234 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
235 | u32 base_rate = 48000; | 235 | u32 base_rate = 24000; |
236 | 236 | ||
237 | if (!dig || !dig->afmt) | 237 | if (!dig || !dig->afmt) |
238 | return; | 238 | return; |
@@ -240,7 +240,6 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
240 | /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. | 240 | /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. |
241 | * doesn't matter which one you use. Just use the first one. | 241 | * doesn't matter which one you use. Just use the first one. |
242 | */ | 242 | */ |
243 | /* XXX: properly calculate this */ | ||
244 | /* XXX two dtos; generally use dto0 for hdmi */ | 243 | /* XXX two dtos; generally use dto0 for hdmi */ |
245 | /* Express [24MHz / target pixel clock] as an exact rational | 244 | /* Express [24MHz / target pixel clock] as an exact rational |
246 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE | 245 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE |
@@ -250,13 +249,13 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
250 | /* according to the reg specs, this should DCE3.2 only, but in | 249 | /* according to the reg specs, this should DCE3.2 only, but in |
251 | * practice it seems to cover DCE3.0 as well. | 250 | * practice it seems to cover DCE3.0 as well. |
252 | */ | 251 | */ |
253 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 50); | 252 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); |
254 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); | 253 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); |
255 | WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ | 254 | WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ |
256 | } else { | 255 | } else { |
257 | /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ | 256 | /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ |
258 | WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate * 50) | | 257 | WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) | |
259 | AUDIO_DTO_MODULE(clock * 100)); | 258 | AUDIO_DTO_MODULE(clock / 10)); |
260 | } | 259 | } |
261 | } | 260 | } |
262 | 261 | ||
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index acb146c06973..79df558f8c40 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -1342,6 +1342,14 @@ | |||
1342 | #define PACKET3_STRMOUT_BASE_UPDATE 0x72 /* r7xx */ | 1342 | #define PACKET3_STRMOUT_BASE_UPDATE 0x72 /* r7xx */ |
1343 | #define PACKET3_SURFACE_BASE_UPDATE 0x73 | 1343 | #define PACKET3_SURFACE_BASE_UPDATE 0x73 |
1344 | 1344 | ||
1345 | #define R_000011_K8_FB_LOCATION 0x11 | ||
1346 | #define R_000012_MC_MISC_UMA_CNTL 0x12 | ||
1347 | #define G_000012_K8_ADDR_EXT(x) (((x) >> 0) & 0xFF) | ||
1348 | #define R_0028F8_MC_INDEX 0x28F8 | ||
1349 | #define S_0028F8_MC_IND_ADDR(x) (((x) & 0x1FF) << 0) | ||
1350 | #define C_0028F8_MC_IND_ADDR 0xFFFFFE00 | ||
1351 | #define S_0028F8_MC_IND_WR_EN(x) (((x) & 0x1) << 9) | ||
1352 | #define R_0028FC_MC_DATA 0x28FC | ||
1345 | 1353 | ||
1346 | #define R_008020_GRBM_SOFT_RESET 0x8020 | 1354 | #define R_008020_GRBM_SOFT_RESET 0x8020 |
1347 | #define S_008020_SOFT_RESET_CP(x) (((x) & 1) << 0) | 1355 | #define S_008020_SOFT_RESET_CP(x) (((x) & 1) << 0) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 1442ce765d48..142ce6cc69f5 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1694,6 +1694,7 @@ struct radeon_device { | |||
1694 | int num_crtc; /* number of crtcs */ | 1694 | int num_crtc; /* number of crtcs */ |
1695 | struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */ | 1695 | struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */ |
1696 | bool audio_enabled; | 1696 | bool audio_enabled; |
1697 | bool has_uvd; | ||
1697 | struct r600_audio audio_status; /* audio stuff */ | 1698 | struct r600_audio audio_status; /* audio stuff */ |
1698 | struct notifier_block acpi_nb; | 1699 | struct notifier_block acpi_nb; |
1699 | /* only one userspace can use Hyperz features or CMASK at a time */ | 1700 | /* only one userspace can use Hyperz features or CMASK at a time */ |
@@ -1838,6 +1839,7 @@ void r100_pll_errata_after_index(struct radeon_device *rdev); | |||
1838 | #define ASIC_IS_DCE61(rdev) ((rdev->family >= CHIP_ARUBA) && \ | 1839 | #define ASIC_IS_DCE61(rdev) ((rdev->family >= CHIP_ARUBA) && \ |
1839 | (rdev->flags & RADEON_IS_IGP)) | 1840 | (rdev->flags & RADEON_IS_IGP)) |
1840 | #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND)) | 1841 | #define ASIC_IS_DCE64(rdev) ((rdev->family == CHIP_OLAND)) |
1842 | #define ASIC_IS_NODCE(rdev) ((rdev->family == CHIP_HAINAN)) | ||
1841 | 1843 | ||
1842 | /* | 1844 | /* |
1843 | * BIOS helpers. | 1845 | * BIOS helpers. |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index 6417132c50cf..a2802b47ee95 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -122,6 +122,10 @@ static void radeon_register_accessor_init(struct radeon_device *rdev) | |||
122 | rdev->mc_rreg = &rs600_mc_rreg; | 122 | rdev->mc_rreg = &rs600_mc_rreg; |
123 | rdev->mc_wreg = &rs600_mc_wreg; | 123 | rdev->mc_wreg = &rs600_mc_wreg; |
124 | } | 124 | } |
125 | if (rdev->family == CHIP_RS780 || rdev->family == CHIP_RS880) { | ||
126 | rdev->mc_rreg = &rs780_mc_rreg; | ||
127 | rdev->mc_wreg = &rs780_mc_wreg; | ||
128 | } | ||
125 | if (rdev->family >= CHIP_R600) { | 129 | if (rdev->family >= CHIP_R600) { |
126 | rdev->pciep_rreg = &r600_pciep_rreg; | 130 | rdev->pciep_rreg = &r600_pciep_rreg; |
127 | rdev->pciep_wreg = &r600_pciep_wreg; | 131 | rdev->pciep_wreg = &r600_pciep_wreg; |
@@ -1935,6 +1939,8 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
1935 | else | 1939 | else |
1936 | rdev->num_crtc = 2; | 1940 | rdev->num_crtc = 2; |
1937 | 1941 | ||
1942 | rdev->has_uvd = false; | ||
1943 | |||
1938 | switch (rdev->family) { | 1944 | switch (rdev->family) { |
1939 | case CHIP_R100: | 1945 | case CHIP_R100: |
1940 | case CHIP_RV100: | 1946 | case CHIP_RV100: |
@@ -1999,16 +2005,22 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
1999 | case CHIP_RV635: | 2005 | case CHIP_RV635: |
2000 | case CHIP_RV670: | 2006 | case CHIP_RV670: |
2001 | rdev->asic = &r600_asic; | 2007 | rdev->asic = &r600_asic; |
2008 | if (rdev->family == CHIP_R600) | ||
2009 | rdev->has_uvd = false; | ||
2010 | else | ||
2011 | rdev->has_uvd = true; | ||
2002 | break; | 2012 | break; |
2003 | case CHIP_RS780: | 2013 | case CHIP_RS780: |
2004 | case CHIP_RS880: | 2014 | case CHIP_RS880: |
2005 | rdev->asic = &rs780_asic; | 2015 | rdev->asic = &rs780_asic; |
2016 | rdev->has_uvd = true; | ||
2006 | break; | 2017 | break; |
2007 | case CHIP_RV770: | 2018 | case CHIP_RV770: |
2008 | case CHIP_RV730: | 2019 | case CHIP_RV730: |
2009 | case CHIP_RV710: | 2020 | case CHIP_RV710: |
2010 | case CHIP_RV740: | 2021 | case CHIP_RV740: |
2011 | rdev->asic = &rv770_asic; | 2022 | rdev->asic = &rv770_asic; |
2023 | rdev->has_uvd = true; | ||
2012 | break; | 2024 | break; |
2013 | case CHIP_CEDAR: | 2025 | case CHIP_CEDAR: |
2014 | case CHIP_REDWOOD: | 2026 | case CHIP_REDWOOD: |
@@ -2021,11 +2033,13 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
2021 | else | 2033 | else |
2022 | rdev->num_crtc = 6; | 2034 | rdev->num_crtc = 6; |
2023 | rdev->asic = &evergreen_asic; | 2035 | rdev->asic = &evergreen_asic; |
2036 | rdev->has_uvd = true; | ||
2024 | break; | 2037 | break; |
2025 | case CHIP_PALM: | 2038 | case CHIP_PALM: |
2026 | case CHIP_SUMO: | 2039 | case CHIP_SUMO: |
2027 | case CHIP_SUMO2: | 2040 | case CHIP_SUMO2: |
2028 | rdev->asic = &sumo_asic; | 2041 | rdev->asic = &sumo_asic; |
2042 | rdev->has_uvd = true; | ||
2029 | break; | 2043 | break; |
2030 | case CHIP_BARTS: | 2044 | case CHIP_BARTS: |
2031 | case CHIP_TURKS: | 2045 | case CHIP_TURKS: |
@@ -2036,27 +2050,37 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
2036 | else | 2050 | else |
2037 | rdev->num_crtc = 6; | 2051 | rdev->num_crtc = 6; |
2038 | rdev->asic = &btc_asic; | 2052 | rdev->asic = &btc_asic; |
2053 | rdev->has_uvd = true; | ||
2039 | break; | 2054 | break; |
2040 | case CHIP_CAYMAN: | 2055 | case CHIP_CAYMAN: |
2041 | rdev->asic = &cayman_asic; | 2056 | rdev->asic = &cayman_asic; |
2042 | /* set num crtcs */ | 2057 | /* set num crtcs */ |
2043 | rdev->num_crtc = 6; | 2058 | rdev->num_crtc = 6; |
2059 | rdev->has_uvd = true; | ||
2044 | break; | 2060 | break; |
2045 | case CHIP_ARUBA: | 2061 | case CHIP_ARUBA: |
2046 | rdev->asic = &trinity_asic; | 2062 | rdev->asic = &trinity_asic; |
2047 | /* set num crtcs */ | 2063 | /* set num crtcs */ |
2048 | rdev->num_crtc = 4; | 2064 | rdev->num_crtc = 4; |
2065 | rdev->has_uvd = true; | ||
2049 | break; | 2066 | break; |
2050 | case CHIP_TAHITI: | 2067 | case CHIP_TAHITI: |
2051 | case CHIP_PITCAIRN: | 2068 | case CHIP_PITCAIRN: |
2052 | case CHIP_VERDE: | 2069 | case CHIP_VERDE: |
2053 | case CHIP_OLAND: | 2070 | case CHIP_OLAND: |
2071 | case CHIP_HAINAN: | ||
2054 | rdev->asic = &si_asic; | 2072 | rdev->asic = &si_asic; |
2055 | /* set num crtcs */ | 2073 | /* set num crtcs */ |
2056 | if (rdev->family == CHIP_OLAND) | 2074 | if (rdev->family == CHIP_HAINAN) |
2075 | rdev->num_crtc = 0; | ||
2076 | else if (rdev->family == CHIP_OLAND) | ||
2057 | rdev->num_crtc = 2; | 2077 | rdev->num_crtc = 2; |
2058 | else | 2078 | else |
2059 | rdev->num_crtc = 6; | 2079 | rdev->num_crtc = 6; |
2080 | if (rdev->family == CHIP_HAINAN) | ||
2081 | rdev->has_uvd = false; | ||
2082 | else | ||
2083 | rdev->has_uvd = true; | ||
2060 | break; | 2084 | break; |
2061 | default: | 2085 | default: |
2062 | /* FIXME: not supported yet */ | 2086 | /* FIXME: not supported yet */ |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 2c87365d345f..a72759ede753 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -347,6 +347,8 @@ extern bool r600_gui_idle(struct radeon_device *rdev); | |||
347 | extern void r600_pm_misc(struct radeon_device *rdev); | 347 | extern void r600_pm_misc(struct radeon_device *rdev); |
348 | extern void r600_pm_init_profile(struct radeon_device *rdev); | 348 | extern void r600_pm_init_profile(struct radeon_device *rdev); |
349 | extern void rs780_pm_init_profile(struct radeon_device *rdev); | 349 | extern void rs780_pm_init_profile(struct radeon_device *rdev); |
350 | extern uint32_t rs780_mc_rreg(struct radeon_device *rdev, uint32_t reg); | ||
351 | extern void rs780_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v); | ||
350 | extern void r600_pm_get_dynpm_state(struct radeon_device *rdev); | 352 | extern void r600_pm_get_dynpm_state(struct radeon_device *rdev); |
351 | extern void r600_set_pcie_lanes(struct radeon_device *rdev, int lanes); | 353 | extern void r600_set_pcie_lanes(struct radeon_device *rdev, int lanes); |
352 | extern int r600_get_pcie_lanes(struct radeon_device *rdev); | 354 | extern int r600_get_pcie_lanes(struct radeon_device *rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index fa3c56fba294..061b227dae0c 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c | |||
@@ -244,24 +244,28 @@ static bool ni_read_disabled_bios(struct radeon_device *rdev) | |||
244 | 244 | ||
245 | /* enable the rom */ | 245 | /* enable the rom */ |
246 | WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); | 246 | WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); |
247 | /* Disable VGA mode */ | 247 | if (!ASIC_IS_NODCE(rdev)) { |
248 | WREG32(AVIVO_D1VGA_CONTROL, | 248 | /* Disable VGA mode */ |
249 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | | 249 | WREG32(AVIVO_D1VGA_CONTROL, |
250 | AVIVO_DVGA_CONTROL_TIMING_SELECT))); | 250 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | |
251 | WREG32(AVIVO_D2VGA_CONTROL, | 251 | AVIVO_DVGA_CONTROL_TIMING_SELECT))); |
252 | (d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | | 252 | WREG32(AVIVO_D2VGA_CONTROL, |
253 | AVIVO_DVGA_CONTROL_TIMING_SELECT))); | 253 | (d2vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | |
254 | WREG32(AVIVO_VGA_RENDER_CONTROL, | 254 | AVIVO_DVGA_CONTROL_TIMING_SELECT))); |
255 | (vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK)); | 255 | WREG32(AVIVO_VGA_RENDER_CONTROL, |
256 | (vga_render_control & ~AVIVO_VGA_VSTATUS_CNTL_MASK)); | ||
257 | } | ||
256 | WREG32(R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE); | 258 | WREG32(R600_ROM_CNTL, rom_cntl | R600_SCK_OVERWRITE); |
257 | 259 | ||
258 | r = radeon_read_bios(rdev); | 260 | r = radeon_read_bios(rdev); |
259 | 261 | ||
260 | /* restore regs */ | 262 | /* restore regs */ |
261 | WREG32(R600_BUS_CNTL, bus_cntl); | 263 | WREG32(R600_BUS_CNTL, bus_cntl); |
262 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); | 264 | if (!ASIC_IS_NODCE(rdev)) { |
263 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); | 265 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); |
264 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); | 266 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); |
267 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); | ||
268 | } | ||
265 | WREG32(R600_ROM_CNTL, rom_cntl); | 269 | WREG32(R600_ROM_CNTL, rom_cntl); |
266 | return r; | 270 | return r; |
267 | } | 271 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index a8f608903989..b0dc0b6cb4e0 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -94,6 +94,7 @@ static const char radeon_family_name[][16] = { | |||
94 | "PITCAIRN", | 94 | "PITCAIRN", |
95 | "VERDE", | 95 | "VERDE", |
96 | "OLAND", | 96 | "OLAND", |
97 | "HAINAN", | ||
97 | "LAST", | 98 | "LAST", |
98 | }; | 99 | }; |
99 | 100 | ||
@@ -243,16 +244,6 @@ void radeon_scratch_free(struct radeon_device *rdev, uint32_t reg) | |||
243 | */ | 244 | */ |
244 | void radeon_wb_disable(struct radeon_device *rdev) | 245 | void radeon_wb_disable(struct radeon_device *rdev) |
245 | { | 246 | { |
246 | int r; | ||
247 | |||
248 | if (rdev->wb.wb_obj) { | ||
249 | r = radeon_bo_reserve(rdev->wb.wb_obj, false); | ||
250 | if (unlikely(r != 0)) | ||
251 | return; | ||
252 | radeon_bo_kunmap(rdev->wb.wb_obj); | ||
253 | radeon_bo_unpin(rdev->wb.wb_obj); | ||
254 | radeon_bo_unreserve(rdev->wb.wb_obj); | ||
255 | } | ||
256 | rdev->wb.enabled = false; | 247 | rdev->wb.enabled = false; |
257 | } | 248 | } |
258 | 249 | ||
@@ -268,6 +259,11 @@ void radeon_wb_fini(struct radeon_device *rdev) | |||
268 | { | 259 | { |
269 | radeon_wb_disable(rdev); | 260 | radeon_wb_disable(rdev); |
270 | if (rdev->wb.wb_obj) { | 261 | if (rdev->wb.wb_obj) { |
262 | if (!radeon_bo_reserve(rdev->wb.wb_obj, false)) { | ||
263 | radeon_bo_kunmap(rdev->wb.wb_obj); | ||
264 | radeon_bo_unpin(rdev->wb.wb_obj); | ||
265 | radeon_bo_unreserve(rdev->wb.wb_obj); | ||
266 | } | ||
271 | radeon_bo_unref(&rdev->wb.wb_obj); | 267 | radeon_bo_unref(&rdev->wb.wb_obj); |
272 | rdev->wb.wb = NULL; | 268 | rdev->wb.wb = NULL; |
273 | rdev->wb.wb_obj = NULL; | 269 | rdev->wb.wb_obj = NULL; |
@@ -294,26 +290,26 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
294 | dev_warn(rdev->dev, "(%d) create WB bo failed\n", r); | 290 | dev_warn(rdev->dev, "(%d) create WB bo failed\n", r); |
295 | return r; | 291 | return r; |
296 | } | 292 | } |
297 | } | 293 | r = radeon_bo_reserve(rdev->wb.wb_obj, false); |
298 | r = radeon_bo_reserve(rdev->wb.wb_obj, false); | 294 | if (unlikely(r != 0)) { |
299 | if (unlikely(r != 0)) { | 295 | radeon_wb_fini(rdev); |
300 | radeon_wb_fini(rdev); | 296 | return r; |
301 | return r; | 297 | } |
302 | } | 298 | r = radeon_bo_pin(rdev->wb.wb_obj, RADEON_GEM_DOMAIN_GTT, |
303 | r = radeon_bo_pin(rdev->wb.wb_obj, RADEON_GEM_DOMAIN_GTT, | 299 | &rdev->wb.gpu_addr); |
304 | &rdev->wb.gpu_addr); | 300 | if (r) { |
305 | if (r) { | 301 | radeon_bo_unreserve(rdev->wb.wb_obj); |
302 | dev_warn(rdev->dev, "(%d) pin WB bo failed\n", r); | ||
303 | radeon_wb_fini(rdev); | ||
304 | return r; | ||
305 | } | ||
306 | r = radeon_bo_kmap(rdev->wb.wb_obj, (void **)&rdev->wb.wb); | ||
306 | radeon_bo_unreserve(rdev->wb.wb_obj); | 307 | radeon_bo_unreserve(rdev->wb.wb_obj); |
307 | dev_warn(rdev->dev, "(%d) pin WB bo failed\n", r); | 308 | if (r) { |
308 | radeon_wb_fini(rdev); | 309 | dev_warn(rdev->dev, "(%d) map WB bo failed\n", r); |
309 | return r; | 310 | radeon_wb_fini(rdev); |
310 | } | 311 | return r; |
311 | r = radeon_bo_kmap(rdev->wb.wb_obj, (void **)&rdev->wb.wb); | 312 | } |
312 | radeon_bo_unreserve(rdev->wb.wb_obj); | ||
313 | if (r) { | ||
314 | dev_warn(rdev->dev, "(%d) map WB bo failed\n", r); | ||
315 | radeon_wb_fini(rdev); | ||
316 | return r; | ||
317 | } | 313 | } |
318 | 314 | ||
319 | /* clear wb memory */ | 315 | /* clear wb memory */ |
@@ -466,23 +462,27 @@ bool radeon_card_posted(struct radeon_device *rdev) | |||
466 | { | 462 | { |
467 | uint32_t reg; | 463 | uint32_t reg; |
468 | 464 | ||
465 | /* required for EFI mode on macbook2,1 which uses an r5xx asic */ | ||
469 | if (efi_enabled(EFI_BOOT) && | 466 | if (efi_enabled(EFI_BOOT) && |
470 | rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) | 467 | (rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && |
468 | (rdev->family < CHIP_R600)) | ||
471 | return false; | 469 | return false; |
472 | 470 | ||
471 | if (ASIC_IS_NODCE(rdev)) | ||
472 | goto check_memsize; | ||
473 | |||
473 | /* first check CRTCs */ | 474 | /* first check CRTCs */ |
474 | if (ASIC_IS_DCE41(rdev)) { | 475 | if (ASIC_IS_DCE4(rdev)) { |
475 | reg = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET) | | 476 | reg = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET) | |
476 | RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET); | 477 | RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET); |
477 | if (reg & EVERGREEN_CRTC_MASTER_EN) | 478 | if (rdev->num_crtc >= 4) { |
478 | return true; | 479 | reg |= RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET) | |
479 | } else if (ASIC_IS_DCE4(rdev)) { | 480 | RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET); |
480 | reg = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET) | | 481 | } |
481 | RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET) | | 482 | if (rdev->num_crtc >= 6) { |
482 | RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET) | | 483 | reg |= RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET) | |
483 | RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET) | | 484 | RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET); |
484 | RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET) | | 485 | } |
485 | RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET); | ||
486 | if (reg & EVERGREEN_CRTC_MASTER_EN) | 486 | if (reg & EVERGREEN_CRTC_MASTER_EN) |
487 | return true; | 487 | return true; |
488 | } else if (ASIC_IS_AVIVO(rdev)) { | 488 | } else if (ASIC_IS_AVIVO(rdev)) { |
@@ -499,6 +499,7 @@ bool radeon_card_posted(struct radeon_device *rdev) | |||
499 | } | 499 | } |
500 | } | 500 | } |
501 | 501 | ||
502 | check_memsize: | ||
502 | /* then check MEM_SIZE, in case the crtcs are off */ | 503 | /* then check MEM_SIZE, in case the crtcs are off */ |
503 | if (rdev->family >= CHIP_R600) | 504 | if (rdev->family >= CHIP_R600) |
504 | reg = RREG32(R600_CONFIG_MEMSIZE); | 505 | reg = RREG32(R600_CONFIG_MEMSIZE); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index e38fd559f1ab..eb18bb7af1cc 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -271,8 +271,6 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) | |||
271 | { | 271 | { |
272 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 272 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
273 | struct radeon_unpin_work *work; | 273 | struct radeon_unpin_work *work; |
274 | struct drm_pending_vblank_event *e; | ||
275 | struct timeval now; | ||
276 | unsigned long flags; | 274 | unsigned long flags; |
277 | u32 update_pending; | 275 | u32 update_pending; |
278 | int vpos, hpos; | 276 | int vpos, hpos; |
@@ -328,14 +326,9 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) | |||
328 | radeon_crtc->unpin_work = NULL; | 326 | radeon_crtc->unpin_work = NULL; |
329 | 327 | ||
330 | /* wakeup userspace */ | 328 | /* wakeup userspace */ |
331 | if (work->event) { | 329 | if (work->event) |
332 | e = work->event; | 330 | drm_send_vblank_event(rdev->ddev, crtc_id, work->event); |
333 | e->event.sequence = drm_vblank_count_and_time(rdev->ddev, crtc_id, &now); | 331 | |
334 | e->event.tv_sec = now.tv_sec; | ||
335 | e->event.tv_usec = now.tv_usec; | ||
336 | list_add_tail(&e->base.link, &e->base.file_priv->event_list); | ||
337 | wake_up_interruptible(&e->base.file_priv->event_wait); | ||
338 | } | ||
339 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 332 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
340 | 333 | ||
341 | drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id); | 334 | drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id); |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index d33f484ace48..094e7e5ea39e 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -147,7 +147,7 @@ static inline void radeon_unregister_atpx_handler(void) {} | |||
147 | #endif | 147 | #endif |
148 | 148 | ||
149 | int radeon_no_wb; | 149 | int radeon_no_wb; |
150 | int radeon_modeset = 1; | 150 | int radeon_modeset = -1; |
151 | int radeon_dynclks = -1; | 151 | int radeon_dynclks = -1; |
152 | int radeon_r4xx_atom = 0; | 152 | int radeon_r4xx_atom = 0; |
153 | int radeon_agpmode = 0; | 153 | int radeon_agpmode = 0; |
@@ -456,6 +456,16 @@ static struct pci_driver radeon_kms_pci_driver = { | |||
456 | 456 | ||
457 | static int __init radeon_init(void) | 457 | static int __init radeon_init(void) |
458 | { | 458 | { |
459 | #ifdef CONFIG_VGA_CONSOLE | ||
460 | if (vgacon_text_force() && radeon_modeset == -1) { | ||
461 | DRM_INFO("VGACON disable radeon kernel modesetting.\n"); | ||
462 | radeon_modeset = 0; | ||
463 | } | ||
464 | #endif | ||
465 | /* set to modesetting by default if not nomodeset */ | ||
466 | if (radeon_modeset == -1) | ||
467 | radeon_modeset = 1; | ||
468 | |||
459 | if (radeon_modeset == 1) { | 469 | if (radeon_modeset == 1) { |
460 | DRM_INFO("radeon kernel modesetting enabled.\n"); | 470 | DRM_INFO("radeon kernel modesetting enabled.\n"); |
461 | driver = &kms_driver; | 471 | driver = &kms_driver; |
diff --git a/drivers/gpu/drm/radeon/radeon_family.h b/drivers/gpu/drm/radeon/radeon_family.h index 2d91123f2759..36e9803b077d 100644 --- a/drivers/gpu/drm/radeon/radeon_family.h +++ b/drivers/gpu/drm/radeon/radeon_family.h | |||
@@ -92,6 +92,7 @@ enum radeon_family { | |||
92 | CHIP_PITCAIRN, | 92 | CHIP_PITCAIRN, |
93 | CHIP_VERDE, | 93 | CHIP_VERDE, |
94 | CHIP_OLAND, | 94 | CHIP_OLAND, |
95 | CHIP_HAINAN, | ||
95 | CHIP_LAST, | 96 | CHIP_LAST, |
96 | }; | 97 | }; |
97 | 98 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 5b937dfe6f65..ddb8f8e04eb5 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -63,7 +63,9 @@ static void radeon_fence_write(struct radeon_device *rdev, u32 seq, int ring) | |||
63 | { | 63 | { |
64 | struct radeon_fence_driver *drv = &rdev->fence_drv[ring]; | 64 | struct radeon_fence_driver *drv = &rdev->fence_drv[ring]; |
65 | if (likely(rdev->wb.enabled || !drv->scratch_reg)) { | 65 | if (likely(rdev->wb.enabled || !drv->scratch_reg)) { |
66 | *drv->cpu_addr = cpu_to_le32(seq); | 66 | if (drv->cpu_addr) { |
67 | *drv->cpu_addr = cpu_to_le32(seq); | ||
68 | } | ||
67 | } else { | 69 | } else { |
68 | WREG32(drv->scratch_reg, seq); | 70 | WREG32(drv->scratch_reg, seq); |
69 | } | 71 | } |
@@ -84,7 +86,11 @@ static u32 radeon_fence_read(struct radeon_device *rdev, int ring) | |||
84 | u32 seq = 0; | 86 | u32 seq = 0; |
85 | 87 | ||
86 | if (likely(rdev->wb.enabled || !drv->scratch_reg)) { | 88 | if (likely(rdev->wb.enabled || !drv->scratch_reg)) { |
87 | seq = le32_to_cpu(*drv->cpu_addr); | 89 | if (drv->cpu_addr) { |
90 | seq = le32_to_cpu(*drv->cpu_addr); | ||
91 | } else { | ||
92 | seq = lower_32_bits(atomic64_read(&drv->last_seq)); | ||
93 | } | ||
88 | } else { | 94 | } else { |
89 | seq = RREG32(drv->scratch_reg); | 95 | seq = RREG32(drv->scratch_reg); |
90 | } | 96 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 2c1341f63dc5..43ec4a401f07 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -1197,11 +1197,13 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, | |||
1197 | int radeon_vm_bo_rmv(struct radeon_device *rdev, | 1197 | int radeon_vm_bo_rmv(struct radeon_device *rdev, |
1198 | struct radeon_bo_va *bo_va) | 1198 | struct radeon_bo_va *bo_va) |
1199 | { | 1199 | { |
1200 | int r; | 1200 | int r = 0; |
1201 | 1201 | ||
1202 | mutex_lock(&rdev->vm_manager.lock); | 1202 | mutex_lock(&rdev->vm_manager.lock); |
1203 | mutex_lock(&bo_va->vm->mutex); | 1203 | mutex_lock(&bo_va->vm->mutex); |
1204 | r = radeon_vm_bo_update_pte(rdev, bo_va->vm, bo_va->bo, NULL); | 1204 | if (bo_va->soffset) { |
1205 | r = radeon_vm_bo_update_pte(rdev, bo_va->vm, bo_va->bo, NULL); | ||
1206 | } | ||
1205 | mutex_unlock(&rdev->vm_manager.lock); | 1207 | mutex_unlock(&rdev->vm_manager.lock); |
1206 | list_del(&bo_va->vm_list); | 1208 | list_del(&bo_va->vm_list); |
1207 | mutex_unlock(&bo_va->vm->mutex); | 1209 | mutex_unlock(&bo_va->vm->mutex); |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index 6857cb4efb76..7cb178a34a0f 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
@@ -1031,11 +1031,9 @@ static int radeon_crtc_mode_set(struct drm_crtc *crtc, | |||
1031 | 1031 | ||
1032 | static void radeon_crtc_prepare(struct drm_crtc *crtc) | 1032 | static void radeon_crtc_prepare(struct drm_crtc *crtc) |
1033 | { | 1033 | { |
1034 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
1035 | struct drm_device *dev = crtc->dev; | 1034 | struct drm_device *dev = crtc->dev; |
1036 | struct drm_crtc *crtci; | 1035 | struct drm_crtc *crtci; |
1037 | 1036 | ||
1038 | radeon_crtc->in_mode_set = true; | ||
1039 | /* | 1037 | /* |
1040 | * The hardware wedges sometimes if you reconfigure one CRTC | 1038 | * The hardware wedges sometimes if you reconfigure one CRTC |
1041 | * whilst another is running (see fdo bug #24611). | 1039 | * whilst another is running (see fdo bug #24611). |
@@ -1046,7 +1044,6 @@ static void radeon_crtc_prepare(struct drm_crtc *crtc) | |||
1046 | 1044 | ||
1047 | static void radeon_crtc_commit(struct drm_crtc *crtc) | 1045 | static void radeon_crtc_commit(struct drm_crtc *crtc) |
1048 | { | 1046 | { |
1049 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
1050 | struct drm_device *dev = crtc->dev; | 1047 | struct drm_device *dev = crtc->dev; |
1051 | struct drm_crtc *crtci; | 1048 | struct drm_crtc *crtci; |
1052 | 1049 | ||
@@ -1057,7 +1054,6 @@ static void radeon_crtc_commit(struct drm_crtc *crtc) | |||
1057 | if (crtci->enabled) | 1054 | if (crtci->enabled) |
1058 | radeon_crtc_dpms(crtci, DRM_MODE_DPMS_ON); | 1055 | radeon_crtc_dpms(crtci, DRM_MODE_DPMS_ON); |
1059 | } | 1056 | } |
1060 | radeon_crtc->in_mode_set = false; | ||
1061 | } | 1057 | } |
1062 | 1058 | ||
1063 | static const struct drm_crtc_helper_funcs legacy_helper_funcs = { | 1059 | static const struct drm_crtc_helper_funcs legacy_helper_funcs = { |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 44e579e75fd0..69ad4fe224c1 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -302,7 +302,6 @@ struct radeon_crtc { | |||
302 | u16 lut_r[256], lut_g[256], lut_b[256]; | 302 | u16 lut_r[256], lut_g[256], lut_b[256]; |
303 | bool enabled; | 303 | bool enabled; |
304 | bool can_tile; | 304 | bool can_tile; |
305 | bool in_mode_set; | ||
306 | uint32_t crtc_offset; | 305 | uint32_t crtc_offset; |
307 | struct drm_gem_object *cursor_bo; | 306 | struct drm_gem_object *cursor_bo; |
308 | uint64_t cursor_addr; | 307 | uint64_t cursor_addr; |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index e17faa7cf732..82434018cbe8 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -402,6 +402,13 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi | |||
402 | return -ENOMEM; | 402 | return -ENOMEM; |
403 | /* Align requested size with padding so unlock_commit can | 403 | /* Align requested size with padding so unlock_commit can |
404 | * pad safely */ | 404 | * pad safely */ |
405 | radeon_ring_free_size(rdev, ring); | ||
406 | if (ring->ring_free_dw == (ring->ring_size / 4)) { | ||
407 | /* This is an empty ring update lockup info to avoid | ||
408 | * false positive. | ||
409 | */ | ||
410 | radeon_ring_lockup_update(ring); | ||
411 | } | ||
405 | ndw = (ndw + ring->align_mask) & ~ring->align_mask; | 412 | ndw = (ndw + ring->align_mask) & ~ring->align_mask; |
406 | while (ndw > (ring->ring_free_dw - 1)) { | 413 | while (ndw > (ring->ring_free_dw - 1)) { |
407 | radeon_ring_free_size(rdev, ring); | 414 | radeon_ring_free_size(rdev, ring); |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 93f760e27a92..6c0ce8915fac 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -726,7 +726,7 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
726 | return r; | 726 | return r; |
727 | } | 727 | } |
728 | DRM_INFO("radeon: %uM of VRAM memory ready\n", | 728 | DRM_INFO("radeon: %uM of VRAM memory ready\n", |
729 | (unsigned)rdev->mc.real_vram_size / (1024 * 1024)); | 729 | (unsigned) (rdev->mc.real_vram_size / (1024 * 1024))); |
730 | r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_TT, | 730 | r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_TT, |
731 | rdev->mc.gtt_size >> PAGE_SHIFT); | 731 | rdev->mc.gtt_size >> PAGE_SHIFT); |
732 | if (r) { | 732 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 906e5c0ca3b9..cad735dd02c6 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -159,7 +159,17 @@ int radeon_uvd_suspend(struct radeon_device *rdev) | |||
159 | if (!r) { | 159 | if (!r) { |
160 | radeon_bo_kunmap(rdev->uvd.vcpu_bo); | 160 | radeon_bo_kunmap(rdev->uvd.vcpu_bo); |
161 | radeon_bo_unpin(rdev->uvd.vcpu_bo); | 161 | radeon_bo_unpin(rdev->uvd.vcpu_bo); |
162 | rdev->uvd.cpu_addr = NULL; | ||
163 | if (!radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_CPU, NULL)) { | ||
164 | radeon_bo_kmap(rdev->uvd.vcpu_bo, &rdev->uvd.cpu_addr); | ||
165 | } | ||
162 | radeon_bo_unreserve(rdev->uvd.vcpu_bo); | 166 | radeon_bo_unreserve(rdev->uvd.vcpu_bo); |
167 | |||
168 | if (rdev->uvd.cpu_addr) { | ||
169 | radeon_fence_driver_start_ring(rdev, R600_RING_TYPE_UVD_INDEX); | ||
170 | } else { | ||
171 | rdev->fence_drv[R600_RING_TYPE_UVD_INDEX].cpu_addr = NULL; | ||
172 | } | ||
163 | } | 173 | } |
164 | return r; | 174 | return r; |
165 | } | 175 | } |
@@ -178,6 +188,10 @@ int radeon_uvd_resume(struct radeon_device *rdev) | |||
178 | return r; | 188 | return r; |
179 | } | 189 | } |
180 | 190 | ||
191 | /* Have been pin in cpu unmap unpin */ | ||
192 | radeon_bo_kunmap(rdev->uvd.vcpu_bo); | ||
193 | radeon_bo_unpin(rdev->uvd.vcpu_bo); | ||
194 | |||
181 | r = radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_VRAM, | 195 | r = radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_VRAM, |
182 | &rdev->uvd.gpu_addr); | 196 | &rdev->uvd.gpu_addr); |
183 | if (r) { | 197 | if (r) { |
@@ -613,19 +627,19 @@ int radeon_uvd_get_create_msg(struct radeon_device *rdev, int ring, | |||
613 | } | 627 | } |
614 | 628 | ||
615 | /* stitch together an UVD create msg */ | 629 | /* stitch together an UVD create msg */ |
616 | msg[0] = 0x00000de4; | 630 | msg[0] = cpu_to_le32(0x00000de4); |
617 | msg[1] = 0x00000000; | 631 | msg[1] = cpu_to_le32(0x00000000); |
618 | msg[2] = handle; | 632 | msg[2] = cpu_to_le32(handle); |
619 | msg[3] = 0x00000000; | 633 | msg[3] = cpu_to_le32(0x00000000); |
620 | msg[4] = 0x00000000; | 634 | msg[4] = cpu_to_le32(0x00000000); |
621 | msg[5] = 0x00000000; | 635 | msg[5] = cpu_to_le32(0x00000000); |
622 | msg[6] = 0x00000000; | 636 | msg[6] = cpu_to_le32(0x00000000); |
623 | msg[7] = 0x00000780; | 637 | msg[7] = cpu_to_le32(0x00000780); |
624 | msg[8] = 0x00000440; | 638 | msg[8] = cpu_to_le32(0x00000440); |
625 | msg[9] = 0x00000000; | 639 | msg[9] = cpu_to_le32(0x00000000); |
626 | msg[10] = 0x01b37000; | 640 | msg[10] = cpu_to_le32(0x01b37000); |
627 | for (i = 11; i < 1024; ++i) | 641 | for (i = 11; i < 1024; ++i) |
628 | msg[i] = 0x0; | 642 | msg[i] = cpu_to_le32(0x0); |
629 | 643 | ||
630 | radeon_bo_kunmap(bo); | 644 | radeon_bo_kunmap(bo); |
631 | radeon_bo_unreserve(bo); | 645 | radeon_bo_unreserve(bo); |
@@ -659,12 +673,12 @@ int radeon_uvd_get_destroy_msg(struct radeon_device *rdev, int ring, | |||
659 | } | 673 | } |
660 | 674 | ||
661 | /* stitch together an UVD destroy msg */ | 675 | /* stitch together an UVD destroy msg */ |
662 | msg[0] = 0x00000de4; | 676 | msg[0] = cpu_to_le32(0x00000de4); |
663 | msg[1] = 0x00000002; | 677 | msg[1] = cpu_to_le32(0x00000002); |
664 | msg[2] = handle; | 678 | msg[2] = cpu_to_le32(handle); |
665 | msg[3] = 0x00000000; | 679 | msg[3] = cpu_to_le32(0x00000000); |
666 | for (i = 4; i < 1024; ++i) | 680 | for (i = 4; i < 1024; ++i) |
667 | msg[i] = 0x0; | 681 | msg[i] = cpu_to_le32(0x0); |
668 | 682 | ||
669 | radeon_bo_kunmap(bo); | 683 | radeon_bo_kunmap(bo); |
670 | radeon_bo_unreserve(bo); | 684 | radeon_bo_unreserve(bo); |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 73051ce3121e..233a9b9fa1f7 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -417,6 +417,12 @@ static int rs400_startup(struct radeon_device *rdev) | |||
417 | } | 417 | } |
418 | 418 | ||
419 | /* Enable IRQ */ | 419 | /* Enable IRQ */ |
420 | if (!rdev->irq.installed) { | ||
421 | r = radeon_irq_kms_init(rdev); | ||
422 | if (r) | ||
423 | return r; | ||
424 | } | ||
425 | |||
420 | r100_irq_set(rdev); | 426 | r100_irq_set(rdev); |
421 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | 427 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
422 | /* 1M ring buffer */ | 428 | /* 1M ring buffer */ |
@@ -535,9 +541,6 @@ int rs400_init(struct radeon_device *rdev) | |||
535 | r = radeon_fence_driver_init(rdev); | 541 | r = radeon_fence_driver_init(rdev); |
536 | if (r) | 542 | if (r) |
537 | return r; | 543 | return r; |
538 | r = radeon_irq_kms_init(rdev); | ||
539 | if (r) | ||
540 | return r; | ||
541 | /* Memory manager */ | 544 | /* Memory manager */ |
542 | r = radeon_bo_init(rdev); | 545 | r = radeon_bo_init(rdev); |
543 | if (r) | 546 | if (r) |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 46fa1b07c560..670b555d2ca2 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -923,6 +923,12 @@ static int rs600_startup(struct radeon_device *rdev) | |||
923 | } | 923 | } |
924 | 924 | ||
925 | /* Enable IRQ */ | 925 | /* Enable IRQ */ |
926 | if (!rdev->irq.installed) { | ||
927 | r = radeon_irq_kms_init(rdev); | ||
928 | if (r) | ||
929 | return r; | ||
930 | } | ||
931 | |||
926 | rs600_irq_set(rdev); | 932 | rs600_irq_set(rdev); |
927 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | 933 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
928 | /* 1M ring buffer */ | 934 | /* 1M ring buffer */ |
@@ -1047,9 +1053,6 @@ int rs600_init(struct radeon_device *rdev) | |||
1047 | r = radeon_fence_driver_init(rdev); | 1053 | r = radeon_fence_driver_init(rdev); |
1048 | if (r) | 1054 | if (r) |
1049 | return r; | 1055 | return r; |
1050 | r = radeon_irq_kms_init(rdev); | ||
1051 | if (r) | ||
1052 | return r; | ||
1053 | /* Memory manager */ | 1056 | /* Memory manager */ |
1054 | r = radeon_bo_init(rdev); | 1057 | r = radeon_bo_init(rdev); |
1055 | if (r) | 1058 | if (r) |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index ab4c86cfd552..55880d5962c3 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -651,6 +651,12 @@ static int rs690_startup(struct radeon_device *rdev) | |||
651 | } | 651 | } |
652 | 652 | ||
653 | /* Enable IRQ */ | 653 | /* Enable IRQ */ |
654 | if (!rdev->irq.installed) { | ||
655 | r = radeon_irq_kms_init(rdev); | ||
656 | if (r) | ||
657 | return r; | ||
658 | } | ||
659 | |||
654 | rs600_irq_set(rdev); | 660 | rs600_irq_set(rdev); |
655 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | 661 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
656 | /* 1M ring buffer */ | 662 | /* 1M ring buffer */ |
@@ -776,9 +782,6 @@ int rs690_init(struct radeon_device *rdev) | |||
776 | r = radeon_fence_driver_init(rdev); | 782 | r = radeon_fence_driver_init(rdev); |
777 | if (r) | 783 | if (r) |
778 | return r; | 784 | return r; |
779 | r = radeon_irq_kms_init(rdev); | ||
780 | if (r) | ||
781 | return r; | ||
782 | /* Memory manager */ | 785 | /* Memory manager */ |
783 | r = radeon_bo_init(rdev); | 786 | r = radeon_bo_init(rdev); |
784 | if (r) | 787 | if (r) |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index ffcba730c57c..21c7d7b26e55 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -532,6 +532,12 @@ static int rv515_startup(struct radeon_device *rdev) | |||
532 | } | 532 | } |
533 | 533 | ||
534 | /* Enable IRQ */ | 534 | /* Enable IRQ */ |
535 | if (!rdev->irq.installed) { | ||
536 | r = radeon_irq_kms_init(rdev); | ||
537 | if (r) | ||
538 | return r; | ||
539 | } | ||
540 | |||
535 | rs600_irq_set(rdev); | 541 | rs600_irq_set(rdev); |
536 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | 542 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
537 | /* 1M ring buffer */ | 543 | /* 1M ring buffer */ |
@@ -662,9 +668,6 @@ int rv515_init(struct radeon_device *rdev) | |||
662 | r = radeon_fence_driver_init(rdev); | 668 | r = radeon_fence_driver_init(rdev); |
663 | if (r) | 669 | if (r) |
664 | return r; | 670 | return r; |
665 | r = radeon_irq_kms_init(rdev); | ||
666 | if (r) | ||
667 | return r; | ||
668 | /* Memory manager */ | 671 | /* Memory manager */ |
669 | r = radeon_bo_init(rdev); | 672 | r = radeon_bo_init(rdev); |
670 | if (r) | 673 | if (r) |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 83f612a9500b..4a62ad2e5399 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -862,10 +862,8 @@ int rv770_uvd_resume(struct radeon_device *rdev) | |||
862 | chip_id = 0x0100000b; | 862 | chip_id = 0x0100000b; |
863 | break; | 863 | break; |
864 | case CHIP_SUMO: | 864 | case CHIP_SUMO: |
865 | chip_id = 0x0100000c; | ||
866 | break; | ||
867 | case CHIP_SUMO2: | 865 | case CHIP_SUMO2: |
868 | chip_id = 0x0100000d; | 866 | chip_id = 0x0100000c; |
869 | break; | 867 | break; |
870 | case CHIP_PALM: | 868 | case CHIP_PALM: |
871 | chip_id = 0x0100000e; | 869 | chip_id = 0x0100000e; |
@@ -1889,6 +1887,12 @@ static int rv770_startup(struct radeon_device *rdev) | |||
1889 | rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size = 0; | 1887 | rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size = 0; |
1890 | 1888 | ||
1891 | /* Enable IRQ */ | 1889 | /* Enable IRQ */ |
1890 | if (!rdev->irq.installed) { | ||
1891 | r = radeon_irq_kms_init(rdev); | ||
1892 | if (r) | ||
1893 | return r; | ||
1894 | } | ||
1895 | |||
1892 | r = r600_irq_init(rdev); | 1896 | r = r600_irq_init(rdev); |
1893 | if (r) { | 1897 | if (r) { |
1894 | DRM_ERROR("radeon: IH init failed (%d).\n", r); | 1898 | DRM_ERROR("radeon: IH init failed (%d).\n", r); |
@@ -2047,10 +2051,6 @@ int rv770_init(struct radeon_device *rdev) | |||
2047 | if (r) | 2051 | if (r) |
2048 | return r; | 2052 | return r; |
2049 | 2053 | ||
2050 | r = radeon_irq_kms_init(rdev); | ||
2051 | if (r) | ||
2052 | return r; | ||
2053 | |||
2054 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL; | 2054 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL; |
2055 | r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024); | 2055 | r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024); |
2056 | 2056 | ||
@@ -2113,8 +2113,6 @@ static void rv770_pcie_gen2_enable(struct radeon_device *rdev) | |||
2113 | { | 2113 | { |
2114 | u32 link_width_cntl, lanes, speed_cntl, tmp; | 2114 | u32 link_width_cntl, lanes, speed_cntl, tmp; |
2115 | u16 link_cntl2; | 2115 | u16 link_cntl2; |
2116 | u32 mask; | ||
2117 | int ret; | ||
2118 | 2116 | ||
2119 | if (radeon_pcie_gen2 == 0) | 2117 | if (radeon_pcie_gen2 == 0) |
2120 | return; | 2118 | return; |
@@ -2129,11 +2127,8 @@ static void rv770_pcie_gen2_enable(struct radeon_device *rdev) | |||
2129 | if (ASIC_IS_X2(rdev)) | 2127 | if (ASIC_IS_X2(rdev)) |
2130 | return; | 2128 | return; |
2131 | 2129 | ||
2132 | ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); | 2130 | if ((rdev->pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) && |
2133 | if (ret != 0) | 2131 | (rdev->pdev->bus->max_bus_speed != PCIE_SPEED_8_0GT)) |
2134 | return; | ||
2135 | |||
2136 | if (!(mask & DRM_PCIE_SPEED_50)) | ||
2137 | return; | 2132 | return; |
2138 | 2133 | ||
2139 | DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n"); | 2134 | DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n"); |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index f0b6c2f87c4d..a1b0da6b5808 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -60,6 +60,11 @@ MODULE_FIRMWARE("radeon/OLAND_me.bin"); | |||
60 | MODULE_FIRMWARE("radeon/OLAND_ce.bin"); | 60 | MODULE_FIRMWARE("radeon/OLAND_ce.bin"); |
61 | MODULE_FIRMWARE("radeon/OLAND_mc.bin"); | 61 | MODULE_FIRMWARE("radeon/OLAND_mc.bin"); |
62 | MODULE_FIRMWARE("radeon/OLAND_rlc.bin"); | 62 | MODULE_FIRMWARE("radeon/OLAND_rlc.bin"); |
63 | MODULE_FIRMWARE("radeon/HAINAN_pfp.bin"); | ||
64 | MODULE_FIRMWARE("radeon/HAINAN_me.bin"); | ||
65 | MODULE_FIRMWARE("radeon/HAINAN_ce.bin"); | ||
66 | MODULE_FIRMWARE("radeon/HAINAN_mc.bin"); | ||
67 | MODULE_FIRMWARE("radeon/HAINAN_rlc.bin"); | ||
63 | 68 | ||
64 | extern int r600_ih_ring_alloc(struct radeon_device *rdev); | 69 | extern int r600_ih_ring_alloc(struct radeon_device *rdev); |
65 | extern void r600_ih_ring_fini(struct radeon_device *rdev); | 70 | extern void r600_ih_ring_fini(struct radeon_device *rdev); |
@@ -265,6 +270,40 @@ static const u32 oland_golden_registers[] = | |||
265 | 0x15c0, 0x000c0fc0, 0x000c0400 | 270 | 0x15c0, 0x000c0fc0, 0x000c0400 |
266 | }; | 271 | }; |
267 | 272 | ||
273 | static const u32 hainan_golden_registers[] = | ||
274 | { | ||
275 | 0x9a10, 0x00010000, 0x00018208, | ||
276 | 0x9830, 0xffffffff, 0x00000000, | ||
277 | 0x9834, 0xf00fffff, 0x00000400, | ||
278 | 0x9838, 0x0002021c, 0x00020200, | ||
279 | 0xd0c0, 0xff000fff, 0x00000100, | ||
280 | 0xd030, 0x000300c0, 0x00800040, | ||
281 | 0xd8c0, 0xff000fff, 0x00000100, | ||
282 | 0xd830, 0x000300c0, 0x00800040, | ||
283 | 0x2ae4, 0x00073ffe, 0x000022a2, | ||
284 | 0x240c, 0x000007ff, 0x00000000, | ||
285 | 0x8a14, 0xf000001f, 0x00000007, | ||
286 | 0x8b24, 0xffffffff, 0x00ffffff, | ||
287 | 0x8b10, 0x0000ff0f, 0x00000000, | ||
288 | 0x28a4c, 0x07ffffff, 0x4e000000, | ||
289 | 0x28350, 0x3f3f3fff, 0x00000000, | ||
290 | 0x30, 0x000000ff, 0x0040, | ||
291 | 0x34, 0x00000040, 0x00004040, | ||
292 | 0x9100, 0x03e00000, 0x03600000, | ||
293 | 0x9060, 0x0000007f, 0x00000020, | ||
294 | 0x9508, 0x00010000, 0x00010000, | ||
295 | 0xac14, 0x000003ff, 0x000000f1, | ||
296 | 0xac10, 0xffffffff, 0x00000000, | ||
297 | 0xac0c, 0xffffffff, 0x00003210, | ||
298 | 0x88d4, 0x0000001f, 0x00000010, | ||
299 | 0x15c0, 0x000c0fc0, 0x000c0400 | ||
300 | }; | ||
301 | |||
302 | static const u32 hainan_golden_registers2[] = | ||
303 | { | ||
304 | 0x98f8, 0xffffffff, 0x02010001 | ||
305 | }; | ||
306 | |||
268 | static const u32 tahiti_mgcg_cgcg_init[] = | 307 | static const u32 tahiti_mgcg_cgcg_init[] = |
269 | { | 308 | { |
270 | 0xc400, 0xffffffff, 0xfffffffc, | 309 | 0xc400, 0xffffffff, 0xfffffffc, |
@@ -673,6 +712,83 @@ static const u32 oland_mgcg_cgcg_init[] = | |||
673 | 0xd8c0, 0xfffffff0, 0x00000100 | 712 | 0xd8c0, 0xfffffff0, 0x00000100 |
674 | }; | 713 | }; |
675 | 714 | ||
715 | static const u32 hainan_mgcg_cgcg_init[] = | ||
716 | { | ||
717 | 0xc400, 0xffffffff, 0xfffffffc, | ||
718 | 0x802c, 0xffffffff, 0xe0000000, | ||
719 | 0x9a60, 0xffffffff, 0x00000100, | ||
720 | 0x92a4, 0xffffffff, 0x00000100, | ||
721 | 0xc164, 0xffffffff, 0x00000100, | ||
722 | 0x9774, 0xffffffff, 0x00000100, | ||
723 | 0x8984, 0xffffffff, 0x06000100, | ||
724 | 0x8a18, 0xffffffff, 0x00000100, | ||
725 | 0x92a0, 0xffffffff, 0x00000100, | ||
726 | 0xc380, 0xffffffff, 0x00000100, | ||
727 | 0x8b28, 0xffffffff, 0x00000100, | ||
728 | 0x9144, 0xffffffff, 0x00000100, | ||
729 | 0x8d88, 0xffffffff, 0x00000100, | ||
730 | 0x8d8c, 0xffffffff, 0x00000100, | ||
731 | 0x9030, 0xffffffff, 0x00000100, | ||
732 | 0x9034, 0xffffffff, 0x00000100, | ||
733 | 0x9038, 0xffffffff, 0x00000100, | ||
734 | 0x903c, 0xffffffff, 0x00000100, | ||
735 | 0xad80, 0xffffffff, 0x00000100, | ||
736 | 0xac54, 0xffffffff, 0x00000100, | ||
737 | 0x897c, 0xffffffff, 0x06000100, | ||
738 | 0x9868, 0xffffffff, 0x00000100, | ||
739 | 0x9510, 0xffffffff, 0x00000100, | ||
740 | 0xaf04, 0xffffffff, 0x00000100, | ||
741 | 0xae04, 0xffffffff, 0x00000100, | ||
742 | 0x949c, 0xffffffff, 0x00000100, | ||
743 | 0x802c, 0xffffffff, 0xe0000000, | ||
744 | 0x9160, 0xffffffff, 0x00010000, | ||
745 | 0x9164, 0xffffffff, 0x00030002, | ||
746 | 0x9168, 0xffffffff, 0x00040007, | ||
747 | 0x916c, 0xffffffff, 0x00060005, | ||
748 | 0x9170, 0xffffffff, 0x00090008, | ||
749 | 0x9174, 0xffffffff, 0x00020001, | ||
750 | 0x9178, 0xffffffff, 0x00040003, | ||
751 | 0x917c, 0xffffffff, 0x00000007, | ||
752 | 0x9180, 0xffffffff, 0x00060005, | ||
753 | 0x9184, 0xffffffff, 0x00090008, | ||
754 | 0x9188, 0xffffffff, 0x00030002, | ||
755 | 0x918c, 0xffffffff, 0x00050004, | ||
756 | 0x9190, 0xffffffff, 0x00000008, | ||
757 | 0x9194, 0xffffffff, 0x00070006, | ||
758 | 0x9198, 0xffffffff, 0x000a0009, | ||
759 | 0x919c, 0xffffffff, 0x00040003, | ||
760 | 0x91a0, 0xffffffff, 0x00060005, | ||
761 | 0x91a4, 0xffffffff, 0x00000009, | ||
762 | 0x91a8, 0xffffffff, 0x00080007, | ||
763 | 0x91ac, 0xffffffff, 0x000b000a, | ||
764 | 0x91b0, 0xffffffff, 0x00050004, | ||
765 | 0x91b4, 0xffffffff, 0x00070006, | ||
766 | 0x91b8, 0xffffffff, 0x0008000b, | ||
767 | 0x91bc, 0xffffffff, 0x000a0009, | ||
768 | 0x91c0, 0xffffffff, 0x000d000c, | ||
769 | 0x91c4, 0xffffffff, 0x00060005, | ||
770 | 0x91c8, 0xffffffff, 0x00080007, | ||
771 | 0x91cc, 0xffffffff, 0x0000000b, | ||
772 | 0x91d0, 0xffffffff, 0x000a0009, | ||
773 | 0x91d4, 0xffffffff, 0x000d000c, | ||
774 | 0x9150, 0xffffffff, 0x96940200, | ||
775 | 0x8708, 0xffffffff, 0x00900100, | ||
776 | 0xc478, 0xffffffff, 0x00000080, | ||
777 | 0xc404, 0xffffffff, 0x0020003f, | ||
778 | 0x30, 0xffffffff, 0x0000001c, | ||
779 | 0x34, 0x000f0000, 0x000f0000, | ||
780 | 0x160c, 0xffffffff, 0x00000100, | ||
781 | 0x1024, 0xffffffff, 0x00000100, | ||
782 | 0x20a8, 0xffffffff, 0x00000104, | ||
783 | 0x264c, 0x000c0000, 0x000c0000, | ||
784 | 0x2648, 0x000c0000, 0x000c0000, | ||
785 | 0x2f50, 0x00000001, 0x00000001, | ||
786 | 0x30cc, 0xc0000fff, 0x00000104, | ||
787 | 0xc1e4, 0x00000001, 0x00000001, | ||
788 | 0xd0c0, 0xfffffff0, 0x00000100, | ||
789 | 0xd8c0, 0xfffffff0, 0x00000100 | ||
790 | }; | ||
791 | |||
676 | static u32 verde_pg_init[] = | 792 | static u32 verde_pg_init[] = |
677 | { | 793 | { |
678 | 0x353c, 0xffffffff, 0x40000, | 794 | 0x353c, 0xffffffff, 0x40000, |
@@ -853,6 +969,17 @@ static void si_init_golden_registers(struct radeon_device *rdev) | |||
853 | oland_mgcg_cgcg_init, | 969 | oland_mgcg_cgcg_init, |
854 | (const u32)ARRAY_SIZE(oland_mgcg_cgcg_init)); | 970 | (const u32)ARRAY_SIZE(oland_mgcg_cgcg_init)); |
855 | break; | 971 | break; |
972 | case CHIP_HAINAN: | ||
973 | radeon_program_register_sequence(rdev, | ||
974 | hainan_golden_registers, | ||
975 | (const u32)ARRAY_SIZE(hainan_golden_registers)); | ||
976 | radeon_program_register_sequence(rdev, | ||
977 | hainan_golden_registers2, | ||
978 | (const u32)ARRAY_SIZE(hainan_golden_registers2)); | ||
979 | radeon_program_register_sequence(rdev, | ||
980 | hainan_mgcg_cgcg_init, | ||
981 | (const u32)ARRAY_SIZE(hainan_mgcg_cgcg_init)); | ||
982 | break; | ||
856 | default: | 983 | default: |
857 | break; | 984 | break; |
858 | } | 985 | } |
@@ -1062,6 +1189,45 @@ static const u32 oland_io_mc_regs[TAHITI_IO_MC_REGS_SIZE][2] = { | |||
1062 | {0x0000009f, 0x00a17730} | 1189 | {0x0000009f, 0x00a17730} |
1063 | }; | 1190 | }; |
1064 | 1191 | ||
1192 | static const u32 hainan_io_mc_regs[TAHITI_IO_MC_REGS_SIZE][2] = { | ||
1193 | {0x0000006f, 0x03044000}, | ||
1194 | {0x00000070, 0x0480c018}, | ||
1195 | {0x00000071, 0x00000040}, | ||
1196 | {0x00000072, 0x01000000}, | ||
1197 | {0x00000074, 0x000000ff}, | ||
1198 | {0x00000075, 0x00143400}, | ||
1199 | {0x00000076, 0x08ec0800}, | ||
1200 | {0x00000077, 0x040000cc}, | ||
1201 | {0x00000079, 0x00000000}, | ||
1202 | {0x0000007a, 0x21000409}, | ||
1203 | {0x0000007c, 0x00000000}, | ||
1204 | {0x0000007d, 0xe8000000}, | ||
1205 | {0x0000007e, 0x044408a8}, | ||
1206 | {0x0000007f, 0x00000003}, | ||
1207 | {0x00000080, 0x00000000}, | ||
1208 | {0x00000081, 0x01000000}, | ||
1209 | {0x00000082, 0x02000000}, | ||
1210 | {0x00000083, 0x00000000}, | ||
1211 | {0x00000084, 0xe3f3e4f4}, | ||
1212 | {0x00000085, 0x00052024}, | ||
1213 | {0x00000087, 0x00000000}, | ||
1214 | {0x00000088, 0x66036603}, | ||
1215 | {0x00000089, 0x01000000}, | ||
1216 | {0x0000008b, 0x1c0a0000}, | ||
1217 | {0x0000008c, 0xff010000}, | ||
1218 | {0x0000008e, 0xffffefff}, | ||
1219 | {0x0000008f, 0xfff3efff}, | ||
1220 | {0x00000090, 0xfff3efbf}, | ||
1221 | {0x00000094, 0x00101101}, | ||
1222 | {0x00000095, 0x00000fff}, | ||
1223 | {0x00000096, 0x00116fff}, | ||
1224 | {0x00000097, 0x60010000}, | ||
1225 | {0x00000098, 0x10010000}, | ||
1226 | {0x00000099, 0x00006000}, | ||
1227 | {0x0000009a, 0x00001000}, | ||
1228 | {0x0000009f, 0x00a07730} | ||
1229 | }; | ||
1230 | |||
1065 | /* ucode loading */ | 1231 | /* ucode loading */ |
1066 | static int si_mc_load_microcode(struct radeon_device *rdev) | 1232 | static int si_mc_load_microcode(struct radeon_device *rdev) |
1067 | { | 1233 | { |
@@ -1095,6 +1261,11 @@ static int si_mc_load_microcode(struct radeon_device *rdev) | |||
1095 | ucode_size = OLAND_MC_UCODE_SIZE; | 1261 | ucode_size = OLAND_MC_UCODE_SIZE; |
1096 | regs_size = TAHITI_IO_MC_REGS_SIZE; | 1262 | regs_size = TAHITI_IO_MC_REGS_SIZE; |
1097 | break; | 1263 | break; |
1264 | case CHIP_HAINAN: | ||
1265 | io_mc_regs = (u32 *)&hainan_io_mc_regs; | ||
1266 | ucode_size = OLAND_MC_UCODE_SIZE; | ||
1267 | regs_size = TAHITI_IO_MC_REGS_SIZE; | ||
1268 | break; | ||
1098 | } | 1269 | } |
1099 | 1270 | ||
1100 | running = RREG32(MC_SEQ_SUP_CNTL) & RUN_MASK; | 1271 | running = RREG32(MC_SEQ_SUP_CNTL) & RUN_MASK; |
@@ -1198,6 +1369,15 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1198 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; | 1369 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; |
1199 | mc_req_size = OLAND_MC_UCODE_SIZE * 4; | 1370 | mc_req_size = OLAND_MC_UCODE_SIZE * 4; |
1200 | break; | 1371 | break; |
1372 | case CHIP_HAINAN: | ||
1373 | chip_name = "HAINAN"; | ||
1374 | rlc_chip_name = "HAINAN"; | ||
1375 | pfp_req_size = SI_PFP_UCODE_SIZE * 4; | ||
1376 | me_req_size = SI_PM4_UCODE_SIZE * 4; | ||
1377 | ce_req_size = SI_CE_UCODE_SIZE * 4; | ||
1378 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; | ||
1379 | mc_req_size = OLAND_MC_UCODE_SIZE * 4; | ||
1380 | break; | ||
1201 | default: BUG(); | 1381 | default: BUG(); |
1202 | } | 1382 | } |
1203 | 1383 | ||
@@ -2003,7 +2183,8 @@ static void si_tiling_mode_table_init(struct radeon_device *rdev) | |||
2003 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); | 2183 | WREG32(GB_TILE_MODE0 + (reg_offset * 4), gb_tile_moden); |
2004 | } | 2184 | } |
2005 | } else if ((rdev->family == CHIP_VERDE) || | 2185 | } else if ((rdev->family == CHIP_VERDE) || |
2006 | (rdev->family == CHIP_OLAND)) { | 2186 | (rdev->family == CHIP_OLAND) || |
2187 | (rdev->family == CHIP_HAINAN)) { | ||
2007 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) { | 2188 | for (reg_offset = 0; reg_offset < num_tile_mode_states; reg_offset++) { |
2008 | switch (reg_offset) { | 2189 | switch (reg_offset) { |
2009 | case 0: /* non-AA compressed depth or any compressed stencil */ | 2190 | case 0: /* non-AA compressed depth or any compressed stencil */ |
@@ -2435,7 +2616,7 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
2435 | default: | 2616 | default: |
2436 | rdev->config.si.max_shader_engines = 1; | 2617 | rdev->config.si.max_shader_engines = 1; |
2437 | rdev->config.si.max_tile_pipes = 4; | 2618 | rdev->config.si.max_tile_pipes = 4; |
2438 | rdev->config.si.max_cu_per_sh = 2; | 2619 | rdev->config.si.max_cu_per_sh = 5; |
2439 | rdev->config.si.max_sh_per_se = 2; | 2620 | rdev->config.si.max_sh_per_se = 2; |
2440 | rdev->config.si.max_backends_per_se = 4; | 2621 | rdev->config.si.max_backends_per_se = 4; |
2441 | rdev->config.si.max_texture_channel_caches = 4; | 2622 | rdev->config.si.max_texture_channel_caches = 4; |
@@ -2466,6 +2647,23 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
2466 | rdev->config.si.sc_earlyz_tile_fifo_size = 0x130; | 2647 | rdev->config.si.sc_earlyz_tile_fifo_size = 0x130; |
2467 | gb_addr_config = VERDE_GB_ADDR_CONFIG_GOLDEN; | 2648 | gb_addr_config = VERDE_GB_ADDR_CONFIG_GOLDEN; |
2468 | break; | 2649 | break; |
2650 | case CHIP_HAINAN: | ||
2651 | rdev->config.si.max_shader_engines = 1; | ||
2652 | rdev->config.si.max_tile_pipes = 4; | ||
2653 | rdev->config.si.max_cu_per_sh = 5; | ||
2654 | rdev->config.si.max_sh_per_se = 1; | ||
2655 | rdev->config.si.max_backends_per_se = 1; | ||
2656 | rdev->config.si.max_texture_channel_caches = 2; | ||
2657 | rdev->config.si.max_gprs = 256; | ||
2658 | rdev->config.si.max_gs_threads = 16; | ||
2659 | rdev->config.si.max_hw_contexts = 8; | ||
2660 | |||
2661 | rdev->config.si.sc_prim_fifo_size_frontend = 0x20; | ||
2662 | rdev->config.si.sc_prim_fifo_size_backend = 0x40; | ||
2663 | rdev->config.si.sc_hiz_tile_fifo_size = 0x30; | ||
2664 | rdev->config.si.sc_earlyz_tile_fifo_size = 0x130; | ||
2665 | gb_addr_config = HAINAN_GB_ADDR_CONFIG_GOLDEN; | ||
2666 | break; | ||
2469 | } | 2667 | } |
2470 | 2668 | ||
2471 | /* Initialize HDP */ | 2669 | /* Initialize HDP */ |
@@ -2559,9 +2757,11 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
2559 | WREG32(HDP_ADDR_CONFIG, gb_addr_config); | 2757 | WREG32(HDP_ADDR_CONFIG, gb_addr_config); |
2560 | WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config); | 2758 | WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config); |
2561 | WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config); | 2759 | WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config); |
2562 | WREG32(UVD_UDEC_ADDR_CONFIG, gb_addr_config); | 2760 | if (rdev->has_uvd) { |
2563 | WREG32(UVD_UDEC_DB_ADDR_CONFIG, gb_addr_config); | 2761 | WREG32(UVD_UDEC_ADDR_CONFIG, gb_addr_config); |
2564 | WREG32(UVD_UDEC_DBW_ADDR_CONFIG, gb_addr_config); | 2762 | WREG32(UVD_UDEC_DB_ADDR_CONFIG, gb_addr_config); |
2763 | WREG32(UVD_UDEC_DBW_ADDR_CONFIG, gb_addr_config); | ||
2764 | } | ||
2565 | 2765 | ||
2566 | si_tiling_mode_table_init(rdev); | 2766 | si_tiling_mode_table_init(rdev); |
2567 | 2767 | ||
@@ -3304,8 +3504,9 @@ static void si_mc_program(struct radeon_device *rdev) | |||
3304 | if (radeon_mc_wait_for_idle(rdev)) { | 3504 | if (radeon_mc_wait_for_idle(rdev)) { |
3305 | dev_warn(rdev->dev, "Wait for MC idle timedout !\n"); | 3505 | dev_warn(rdev->dev, "Wait for MC idle timedout !\n"); |
3306 | } | 3506 | } |
3307 | /* Lockout access through VGA aperture*/ | 3507 | if (!ASIC_IS_NODCE(rdev)) |
3308 | WREG32(VGA_HDP_CONTROL, VGA_MEMORY_DISABLE); | 3508 | /* Lockout access through VGA aperture*/ |
3509 | WREG32(VGA_HDP_CONTROL, VGA_MEMORY_DISABLE); | ||
3309 | /* Update configuration */ | 3510 | /* Update configuration */ |
3310 | WREG32(MC_VM_SYSTEM_APERTURE_LOW_ADDR, | 3511 | WREG32(MC_VM_SYSTEM_APERTURE_LOW_ADDR, |
3311 | rdev->mc.vram_start >> 12); | 3512 | rdev->mc.vram_start >> 12); |
@@ -3327,9 +3528,11 @@ static void si_mc_program(struct radeon_device *rdev) | |||
3327 | dev_warn(rdev->dev, "Wait for MC idle timedout !\n"); | 3528 | dev_warn(rdev->dev, "Wait for MC idle timedout !\n"); |
3328 | } | 3529 | } |
3329 | evergreen_mc_resume(rdev, &save); | 3530 | evergreen_mc_resume(rdev, &save); |
3330 | /* we need to own VRAM, so turn off the VGA renderer here | 3531 | if (!ASIC_IS_NODCE(rdev)) { |
3331 | * to stop it overwriting our objects */ | 3532 | /* we need to own VRAM, so turn off the VGA renderer here |
3332 | rv515_vga_render_disable(rdev); | 3533 | * to stop it overwriting our objects */ |
3534 | rv515_vga_render_disable(rdev); | ||
3535 | } | ||
3333 | } | 3536 | } |
3334 | 3537 | ||
3335 | static void si_vram_gtt_location(struct radeon_device *rdev, | 3538 | static void si_vram_gtt_location(struct radeon_device *rdev, |
@@ -3397,8 +3600,8 @@ static int si_mc_init(struct radeon_device *rdev) | |||
3397 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); | 3600 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); |
3398 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); | 3601 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); |
3399 | /* size in MB on si */ | 3602 | /* size in MB on si */ |
3400 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 3603 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL; |
3401 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 3604 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL; |
3402 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 3605 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
3403 | si_vram_gtt_location(rdev, &rdev->mc); | 3606 | si_vram_gtt_location(rdev, &rdev->mc); |
3404 | radeon_update_bandwidth_info(rdev); | 3607 | radeon_update_bandwidth_info(rdev); |
@@ -4251,8 +4454,10 @@ static void si_disable_interrupt_state(struct radeon_device *rdev) | |||
4251 | tmp = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET) & ~TRAP_ENABLE; | 4454 | tmp = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET) & ~TRAP_ENABLE; |
4252 | WREG32(DMA_CNTL + DMA1_REGISTER_OFFSET, tmp); | 4455 | WREG32(DMA_CNTL + DMA1_REGISTER_OFFSET, tmp); |
4253 | WREG32(GRBM_INT_CNTL, 0); | 4456 | WREG32(GRBM_INT_CNTL, 0); |
4254 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); | 4457 | if (rdev->num_crtc >= 2) { |
4255 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); | 4458 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); |
4459 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); | ||
4460 | } | ||
4256 | if (rdev->num_crtc >= 4) { | 4461 | if (rdev->num_crtc >= 4) { |
4257 | WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); | 4462 | WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); |
4258 | WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); | 4463 | WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); |
@@ -4262,8 +4467,10 @@ static void si_disable_interrupt_state(struct radeon_device *rdev) | |||
4262 | WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); | 4467 | WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); |
4263 | } | 4468 | } |
4264 | 4469 | ||
4265 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); | 4470 | if (rdev->num_crtc >= 2) { |
4266 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); | 4471 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); |
4472 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); | ||
4473 | } | ||
4267 | if (rdev->num_crtc >= 4) { | 4474 | if (rdev->num_crtc >= 4) { |
4268 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); | 4475 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, 0); |
4269 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); | 4476 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, 0); |
@@ -4273,21 +4480,22 @@ static void si_disable_interrupt_state(struct radeon_device *rdev) | |||
4273 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); | 4480 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, 0); |
4274 | } | 4481 | } |
4275 | 4482 | ||
4276 | WREG32(DACA_AUTODETECT_INT_CONTROL, 0); | 4483 | if (!ASIC_IS_NODCE(rdev)) { |
4277 | 4484 | WREG32(DACA_AUTODETECT_INT_CONTROL, 0); | |
4278 | tmp = RREG32(DC_HPD1_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4279 | WREG32(DC_HPD1_INT_CONTROL, tmp); | ||
4280 | tmp = RREG32(DC_HPD2_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4281 | WREG32(DC_HPD2_INT_CONTROL, tmp); | ||
4282 | tmp = RREG32(DC_HPD3_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4283 | WREG32(DC_HPD3_INT_CONTROL, tmp); | ||
4284 | tmp = RREG32(DC_HPD4_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4285 | WREG32(DC_HPD4_INT_CONTROL, tmp); | ||
4286 | tmp = RREG32(DC_HPD5_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4287 | WREG32(DC_HPD5_INT_CONTROL, tmp); | ||
4288 | tmp = RREG32(DC_HPD6_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4289 | WREG32(DC_HPD6_INT_CONTROL, tmp); | ||
4290 | 4485 | ||
4486 | tmp = RREG32(DC_HPD1_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4487 | WREG32(DC_HPD1_INT_CONTROL, tmp); | ||
4488 | tmp = RREG32(DC_HPD2_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4489 | WREG32(DC_HPD2_INT_CONTROL, tmp); | ||
4490 | tmp = RREG32(DC_HPD3_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4491 | WREG32(DC_HPD3_INT_CONTROL, tmp); | ||
4492 | tmp = RREG32(DC_HPD4_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4493 | WREG32(DC_HPD4_INT_CONTROL, tmp); | ||
4494 | tmp = RREG32(DC_HPD5_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4495 | WREG32(DC_HPD5_INT_CONTROL, tmp); | ||
4496 | tmp = RREG32(DC_HPD6_INT_CONTROL) & DC_HPDx_INT_POLARITY; | ||
4497 | WREG32(DC_HPD6_INT_CONTROL, tmp); | ||
4498 | } | ||
4291 | } | 4499 | } |
4292 | 4500 | ||
4293 | static int si_irq_init(struct radeon_device *rdev) | 4501 | static int si_irq_init(struct radeon_device *rdev) |
@@ -4366,7 +4574,7 @@ int si_irq_set(struct radeon_device *rdev) | |||
4366 | u32 cp_int_cntl = CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE; | 4574 | u32 cp_int_cntl = CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE; |
4367 | u32 cp_int_cntl1 = 0, cp_int_cntl2 = 0; | 4575 | u32 cp_int_cntl1 = 0, cp_int_cntl2 = 0; |
4368 | u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; | 4576 | u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; |
4369 | u32 hpd1, hpd2, hpd3, hpd4, hpd5, hpd6; | 4577 | u32 hpd1 = 0, hpd2 = 0, hpd3 = 0, hpd4 = 0, hpd5 = 0, hpd6 = 0; |
4370 | u32 grbm_int_cntl = 0; | 4578 | u32 grbm_int_cntl = 0; |
4371 | u32 grph1 = 0, grph2 = 0, grph3 = 0, grph4 = 0, grph5 = 0, grph6 = 0; | 4579 | u32 grph1 = 0, grph2 = 0, grph3 = 0, grph4 = 0, grph5 = 0, grph6 = 0; |
4372 | u32 dma_cntl, dma_cntl1; | 4580 | u32 dma_cntl, dma_cntl1; |
@@ -4383,12 +4591,14 @@ int si_irq_set(struct radeon_device *rdev) | |||
4383 | return 0; | 4591 | return 0; |
4384 | } | 4592 | } |
4385 | 4593 | ||
4386 | hpd1 = RREG32(DC_HPD1_INT_CONTROL) & ~DC_HPDx_INT_EN; | 4594 | if (!ASIC_IS_NODCE(rdev)) { |
4387 | hpd2 = RREG32(DC_HPD2_INT_CONTROL) & ~DC_HPDx_INT_EN; | 4595 | hpd1 = RREG32(DC_HPD1_INT_CONTROL) & ~DC_HPDx_INT_EN; |
4388 | hpd3 = RREG32(DC_HPD3_INT_CONTROL) & ~DC_HPDx_INT_EN; | 4596 | hpd2 = RREG32(DC_HPD2_INT_CONTROL) & ~DC_HPDx_INT_EN; |
4389 | hpd4 = RREG32(DC_HPD4_INT_CONTROL) & ~DC_HPDx_INT_EN; | 4597 | hpd3 = RREG32(DC_HPD3_INT_CONTROL) & ~DC_HPDx_INT_EN; |
4390 | hpd5 = RREG32(DC_HPD5_INT_CONTROL) & ~DC_HPDx_INT_EN; | 4598 | hpd4 = RREG32(DC_HPD4_INT_CONTROL) & ~DC_HPDx_INT_EN; |
4391 | hpd6 = RREG32(DC_HPD6_INT_CONTROL) & ~DC_HPDx_INT_EN; | 4599 | hpd5 = RREG32(DC_HPD5_INT_CONTROL) & ~DC_HPDx_INT_EN; |
4600 | hpd6 = RREG32(DC_HPD6_INT_CONTROL) & ~DC_HPDx_INT_EN; | ||
4601 | } | ||
4392 | 4602 | ||
4393 | dma_cntl = RREG32(DMA_CNTL + DMA0_REGISTER_OFFSET) & ~TRAP_ENABLE; | 4603 | dma_cntl = RREG32(DMA_CNTL + DMA0_REGISTER_OFFSET) & ~TRAP_ENABLE; |
4394 | dma_cntl1 = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET) & ~TRAP_ENABLE; | 4604 | dma_cntl1 = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET) & ~TRAP_ENABLE; |
@@ -4479,8 +4689,10 @@ int si_irq_set(struct radeon_device *rdev) | |||
4479 | 4689 | ||
4480 | WREG32(GRBM_INT_CNTL, grbm_int_cntl); | 4690 | WREG32(GRBM_INT_CNTL, grbm_int_cntl); |
4481 | 4691 | ||
4482 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, crtc1); | 4692 | if (rdev->num_crtc >= 2) { |
4483 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, crtc2); | 4693 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, crtc1); |
4694 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, crtc2); | ||
4695 | } | ||
4484 | if (rdev->num_crtc >= 4) { | 4696 | if (rdev->num_crtc >= 4) { |
4485 | WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, crtc3); | 4697 | WREG32(INT_MASK + EVERGREEN_CRTC2_REGISTER_OFFSET, crtc3); |
4486 | WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, crtc4); | 4698 | WREG32(INT_MASK + EVERGREEN_CRTC3_REGISTER_OFFSET, crtc4); |
@@ -4490,8 +4702,10 @@ int si_irq_set(struct radeon_device *rdev) | |||
4490 | WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, crtc6); | 4702 | WREG32(INT_MASK + EVERGREEN_CRTC5_REGISTER_OFFSET, crtc6); |
4491 | } | 4703 | } |
4492 | 4704 | ||
4493 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, grph1); | 4705 | if (rdev->num_crtc >= 2) { |
4494 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, grph2); | 4706 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, grph1); |
4707 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, grph2); | ||
4708 | } | ||
4495 | if (rdev->num_crtc >= 4) { | 4709 | if (rdev->num_crtc >= 4) { |
4496 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, grph3); | 4710 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, grph3); |
4497 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, grph4); | 4711 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, grph4); |
@@ -4501,12 +4715,14 @@ int si_irq_set(struct radeon_device *rdev) | |||
4501 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, grph6); | 4715 | WREG32(GRPH_INT_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, grph6); |
4502 | } | 4716 | } |
4503 | 4717 | ||
4504 | WREG32(DC_HPD1_INT_CONTROL, hpd1); | 4718 | if (!ASIC_IS_NODCE(rdev)) { |
4505 | WREG32(DC_HPD2_INT_CONTROL, hpd2); | 4719 | WREG32(DC_HPD1_INT_CONTROL, hpd1); |
4506 | WREG32(DC_HPD3_INT_CONTROL, hpd3); | 4720 | WREG32(DC_HPD2_INT_CONTROL, hpd2); |
4507 | WREG32(DC_HPD4_INT_CONTROL, hpd4); | 4721 | WREG32(DC_HPD3_INT_CONTROL, hpd3); |
4508 | WREG32(DC_HPD5_INT_CONTROL, hpd5); | 4722 | WREG32(DC_HPD4_INT_CONTROL, hpd4); |
4509 | WREG32(DC_HPD6_INT_CONTROL, hpd6); | 4723 | WREG32(DC_HPD5_INT_CONTROL, hpd5); |
4724 | WREG32(DC_HPD6_INT_CONTROL, hpd6); | ||
4725 | } | ||
4510 | 4726 | ||
4511 | return 0; | 4727 | return 0; |
4512 | } | 4728 | } |
@@ -4515,6 +4731,9 @@ static inline void si_irq_ack(struct radeon_device *rdev) | |||
4515 | { | 4731 | { |
4516 | u32 tmp; | 4732 | u32 tmp; |
4517 | 4733 | ||
4734 | if (ASIC_IS_NODCE(rdev)) | ||
4735 | return; | ||
4736 | |||
4518 | rdev->irq.stat_regs.evergreen.disp_int = RREG32(DISP_INTERRUPT_STATUS); | 4737 | rdev->irq.stat_regs.evergreen.disp_int = RREG32(DISP_INTERRUPT_STATUS); |
4519 | rdev->irq.stat_regs.evergreen.disp_int_cont = RREG32(DISP_INTERRUPT_STATUS_CONTINUE); | 4738 | rdev->irq.stat_regs.evergreen.disp_int_cont = RREG32(DISP_INTERRUPT_STATUS_CONTINUE); |
4520 | rdev->irq.stat_regs.evergreen.disp_int_cont2 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE2); | 4739 | rdev->irq.stat_regs.evergreen.disp_int_cont2 = RREG32(DISP_INTERRUPT_STATUS_CONTINUE2); |
@@ -5118,17 +5337,25 @@ static int si_startup(struct radeon_device *rdev) | |||
5118 | return r; | 5337 | return r; |
5119 | } | 5338 | } |
5120 | 5339 | ||
5121 | r = rv770_uvd_resume(rdev); | 5340 | if (rdev->has_uvd) { |
5122 | if (!r) { | 5341 | r = rv770_uvd_resume(rdev); |
5123 | r = radeon_fence_driver_start_ring(rdev, | 5342 | if (!r) { |
5124 | R600_RING_TYPE_UVD_INDEX); | 5343 | r = radeon_fence_driver_start_ring(rdev, |
5344 | R600_RING_TYPE_UVD_INDEX); | ||
5345 | if (r) | ||
5346 | dev_err(rdev->dev, "UVD fences init error (%d).\n", r); | ||
5347 | } | ||
5125 | if (r) | 5348 | if (r) |
5126 | dev_err(rdev->dev, "UVD fences init error (%d).\n", r); | 5349 | rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size = 0; |
5127 | } | 5350 | } |
5128 | if (r) | ||
5129 | rdev->ring[R600_RING_TYPE_UVD_INDEX].ring_size = 0; | ||
5130 | 5351 | ||
5131 | /* Enable IRQ */ | 5352 | /* Enable IRQ */ |
5353 | if (!rdev->irq.installed) { | ||
5354 | r = radeon_irq_kms_init(rdev); | ||
5355 | if (r) | ||
5356 | return r; | ||
5357 | } | ||
5358 | |||
5132 | r = si_irq_init(rdev); | 5359 | r = si_irq_init(rdev); |
5133 | if (r) { | 5360 | if (r) { |
5134 | DRM_ERROR("radeon: IH init failed (%d).\n", r); | 5361 | DRM_ERROR("radeon: IH init failed (%d).\n", r); |
@@ -5185,16 +5412,18 @@ static int si_startup(struct radeon_device *rdev) | |||
5185 | if (r) | 5412 | if (r) |
5186 | return r; | 5413 | return r; |
5187 | 5414 | ||
5188 | ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; | 5415 | if (rdev->has_uvd) { |
5189 | if (ring->ring_size) { | 5416 | ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; |
5190 | r = radeon_ring_init(rdev, ring, ring->ring_size, | 5417 | if (ring->ring_size) { |
5191 | R600_WB_UVD_RPTR_OFFSET, | 5418 | r = radeon_ring_init(rdev, ring, ring->ring_size, |
5192 | UVD_RBC_RB_RPTR, UVD_RBC_RB_WPTR, | 5419 | R600_WB_UVD_RPTR_OFFSET, |
5193 | 0, 0xfffff, RADEON_CP_PACKET2); | 5420 | UVD_RBC_RB_RPTR, UVD_RBC_RB_WPTR, |
5194 | if (!r) | 5421 | 0, 0xfffff, RADEON_CP_PACKET2); |
5195 | r = r600_uvd_init(rdev); | 5422 | if (!r) |
5196 | if (r) | 5423 | r = r600_uvd_init(rdev); |
5197 | DRM_ERROR("radeon: failed initializing UVD (%d).\n", r); | 5424 | if (r) |
5425 | DRM_ERROR("radeon: failed initializing UVD (%d).\n", r); | ||
5426 | } | ||
5198 | } | 5427 | } |
5199 | 5428 | ||
5200 | r = radeon_ib_pool_init(rdev); | 5429 | r = radeon_ib_pool_init(rdev); |
@@ -5243,8 +5472,10 @@ int si_suspend(struct radeon_device *rdev) | |||
5243 | radeon_vm_manager_fini(rdev); | 5472 | radeon_vm_manager_fini(rdev); |
5244 | si_cp_enable(rdev, false); | 5473 | si_cp_enable(rdev, false); |
5245 | cayman_dma_stop(rdev); | 5474 | cayman_dma_stop(rdev); |
5246 | r600_uvd_rbc_stop(rdev); | 5475 | if (rdev->has_uvd) { |
5247 | radeon_uvd_suspend(rdev); | 5476 | r600_uvd_rbc_stop(rdev); |
5477 | radeon_uvd_suspend(rdev); | ||
5478 | } | ||
5248 | si_irq_suspend(rdev); | 5479 | si_irq_suspend(rdev); |
5249 | radeon_wb_disable(rdev); | 5480 | radeon_wb_disable(rdev); |
5250 | si_pcie_gart_disable(rdev); | 5481 | si_pcie_gart_disable(rdev); |
@@ -5308,10 +5539,6 @@ int si_init(struct radeon_device *rdev) | |||
5308 | if (r) | 5539 | if (r) |
5309 | return r; | 5540 | return r; |
5310 | 5541 | ||
5311 | r = radeon_irq_kms_init(rdev); | ||
5312 | if (r) | ||
5313 | return r; | ||
5314 | |||
5315 | ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; | 5542 | ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; |
5316 | ring->ring_obj = NULL; | 5543 | ring->ring_obj = NULL; |
5317 | r600_ring_init(rdev, ring, 1024 * 1024); | 5544 | r600_ring_init(rdev, ring, 1024 * 1024); |
@@ -5332,11 +5559,13 @@ int si_init(struct radeon_device *rdev) | |||
5332 | ring->ring_obj = NULL; | 5559 | ring->ring_obj = NULL; |
5333 | r600_ring_init(rdev, ring, 64 * 1024); | 5560 | r600_ring_init(rdev, ring, 64 * 1024); |
5334 | 5561 | ||
5335 | r = radeon_uvd_init(rdev); | 5562 | if (rdev->has_uvd) { |
5336 | if (!r) { | 5563 | r = radeon_uvd_init(rdev); |
5337 | ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; | 5564 | if (!r) { |
5338 | ring->ring_obj = NULL; | 5565 | ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; |
5339 | r600_ring_init(rdev, ring, 4096); | 5566 | ring->ring_obj = NULL; |
5567 | r600_ring_init(rdev, ring, 4096); | ||
5568 | } | ||
5340 | } | 5569 | } |
5341 | 5570 | ||
5342 | rdev->ih.ring_obj = NULL; | 5571 | rdev->ih.ring_obj = NULL; |
@@ -5384,7 +5613,8 @@ void si_fini(struct radeon_device *rdev) | |||
5384 | radeon_vm_manager_fini(rdev); | 5613 | radeon_vm_manager_fini(rdev); |
5385 | radeon_ib_pool_fini(rdev); | 5614 | radeon_ib_pool_fini(rdev); |
5386 | radeon_irq_kms_fini(rdev); | 5615 | radeon_irq_kms_fini(rdev); |
5387 | radeon_uvd_fini(rdev); | 5616 | if (rdev->has_uvd) |
5617 | radeon_uvd_fini(rdev); | ||
5388 | si_pcie_gart_fini(rdev); | 5618 | si_pcie_gart_fini(rdev); |
5389 | r600_vram_scratch_fini(rdev); | 5619 | r600_vram_scratch_fini(rdev); |
5390 | radeon_gem_fini(rdev); | 5620 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h index 222877ba6cf5..8f2d7d4f9b28 100644 --- a/drivers/gpu/drm/radeon/sid.h +++ b/drivers/gpu/drm/radeon/sid.h | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #define TAHITI_GB_ADDR_CONFIG_GOLDEN 0x12011003 | 29 | #define TAHITI_GB_ADDR_CONFIG_GOLDEN 0x12011003 |
30 | #define VERDE_GB_ADDR_CONFIG_GOLDEN 0x12010002 | 30 | #define VERDE_GB_ADDR_CONFIG_GOLDEN 0x12010002 |
31 | #define HAINAN_GB_ADDR_CONFIG_GOLDEN 0x02010001 | ||
31 | 32 | ||
32 | /* discrete uvd clocks */ | 33 | /* discrete uvd clocks */ |
33 | #define CG_UPLL_FUNC_CNTL 0x634 | 34 | #define CG_UPLL_FUNC_CNTL 0x634 |
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c index 7dff49ed66e7..99e2034e49cc 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c | |||
@@ -451,27 +451,16 @@ void shmob_drm_crtc_finish_page_flip(struct shmob_drm_crtc *scrtc) | |||
451 | { | 451 | { |
452 | struct drm_pending_vblank_event *event; | 452 | struct drm_pending_vblank_event *event; |
453 | struct drm_device *dev = scrtc->crtc.dev; | 453 | struct drm_device *dev = scrtc->crtc.dev; |
454 | struct timeval vblanktime; | ||
455 | unsigned long flags; | 454 | unsigned long flags; |
456 | 455 | ||
457 | spin_lock_irqsave(&dev->event_lock, flags); | 456 | spin_lock_irqsave(&dev->event_lock, flags); |
458 | event = scrtc->event; | 457 | event = scrtc->event; |
459 | scrtc->event = NULL; | 458 | scrtc->event = NULL; |
459 | if (event) { | ||
460 | drm_send_vblank_event(dev, 0, event); | ||
461 | drm_vblank_put(dev, 0); | ||
462 | } | ||
460 | spin_unlock_irqrestore(&dev->event_lock, flags); | 463 | spin_unlock_irqrestore(&dev->event_lock, flags); |
461 | |||
462 | if (event == NULL) | ||
463 | return; | ||
464 | |||
465 | event->event.sequence = drm_vblank_count_and_time(dev, 0, &vblanktime); | ||
466 | event->event.tv_sec = vblanktime.tv_sec; | ||
467 | event->event.tv_usec = vblanktime.tv_usec; | ||
468 | |||
469 | spin_lock_irqsave(&dev->event_lock, flags); | ||
470 | list_add_tail(&event->base.link, &event->base.file_priv->event_list); | ||
471 | wake_up_interruptible(&event->base.file_priv->event_wait); | ||
472 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
473 | |||
474 | drm_vblank_put(dev, 0); | ||
475 | } | 464 | } |
476 | 465 | ||
477 | static int shmob_drm_crtc_page_flip(struct drm_crtc *crtc, | 466 | static int shmob_drm_crtc_page_flip(struct drm_crtc *crtc, |
diff --git a/drivers/gpu/drm/tilcdc/Kconfig b/drivers/gpu/drm/tilcdc/Kconfig index e461e9972455..7a4d10106906 100644 --- a/drivers/gpu/drm/tilcdc/Kconfig +++ b/drivers/gpu/drm/tilcdc/Kconfig | |||
@@ -6,6 +6,7 @@ config DRM_TILCDC | |||
6 | select DRM_GEM_CMA_HELPER | 6 | select DRM_GEM_CMA_HELPER |
7 | select VIDEOMODE_HELPERS | 7 | select VIDEOMODE_HELPERS |
8 | select BACKLIGHT_CLASS_DEVICE | 8 | select BACKLIGHT_CLASS_DEVICE |
9 | select BACKLIGHT_LCD_SUPPORT | ||
9 | help | 10 | help |
10 | Choose this option if you have an TI SoC with LCDC display | 11 | Choose this option if you have an TI SoC with LCDC display |
11 | controller, for example AM33xx in beagle-bone, DA8xx, or | 12 | controller, for example AM33xx in beagle-bone, DA8xx, or |
diff --git a/drivers/gpu/host1x/drm/dc.c b/drivers/gpu/host1x/drm/dc.c index 1e2060324f02..8c04943f82e3 100644 --- a/drivers/gpu/host1x/drm/dc.c +++ b/drivers/gpu/host1x/drm/dc.c | |||
@@ -1128,11 +1128,6 @@ static int tegra_dc_probe(struct platform_device *pdev) | |||
1128 | return err; | 1128 | return err; |
1129 | 1129 | ||
1130 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1130 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1131 | if (!regs) { | ||
1132 | dev_err(&pdev->dev, "failed to get registers\n"); | ||
1133 | return -ENXIO; | ||
1134 | } | ||
1135 | |||
1136 | dc->regs = devm_ioremap_resource(&pdev->dev, regs); | 1131 | dc->regs = devm_ioremap_resource(&pdev->dev, regs); |
1137 | if (IS_ERR(dc->regs)) | 1132 | if (IS_ERR(dc->regs)) |
1138 | return PTR_ERR(dc->regs); | 1133 | return PTR_ERR(dc->regs); |
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index dc3ae5c56f56..d39a5cede0b0 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -264,9 +264,12 @@ static struct mt_class mt_classes[] = { | |||
264 | static void mt_free_input_name(struct hid_input *hi) | 264 | static void mt_free_input_name(struct hid_input *hi) |
265 | { | 265 | { |
266 | struct hid_device *hdev = hi->report->device; | 266 | struct hid_device *hdev = hi->report->device; |
267 | const char *name = hi->input->name; | ||
267 | 268 | ||
268 | if (hi->input->name != hdev->name) | 269 | if (name != hdev->name) { |
269 | kfree(hi->input->name); | 270 | hi->input->name = hdev->name; |
271 | kfree(name); | ||
272 | } | ||
270 | } | 273 | } |
271 | 274 | ||
272 | static ssize_t mt_show_quirks(struct device *dev, | 275 | static ssize_t mt_show_quirks(struct device *dev, |
@@ -1040,11 +1043,11 @@ static void mt_remove(struct hid_device *hdev) | |||
1040 | struct hid_input *hi; | 1043 | struct hid_input *hi; |
1041 | 1044 | ||
1042 | sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); | 1045 | sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); |
1043 | hid_hw_stop(hdev); | ||
1044 | |||
1045 | list_for_each_entry(hi, &hdev->inputs, list) | 1046 | list_for_each_entry(hi, &hdev->inputs, list) |
1046 | mt_free_input_name(hi); | 1047 | mt_free_input_name(hi); |
1047 | 1048 | ||
1049 | hid_hw_stop(hdev); | ||
1050 | |||
1048 | kfree(td); | 1051 | kfree(td); |
1049 | hid_set_drvdata(hdev, NULL); | 1052 | hid_set_drvdata(hdev, NULL); |
1050 | } | 1053 | } |
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index bad8128b283a..21ef68934a20 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c | |||
@@ -329,7 +329,7 @@ static u32 get_vp_index(uuid_le *type_guid) | |||
329 | return 0; | 329 | return 0; |
330 | } | 330 | } |
331 | cur_cpu = (++next_vp % max_cpus); | 331 | cur_cpu = (++next_vp % max_cpus); |
332 | return cur_cpu; | 332 | return hv_context.vp_index[cur_cpu]; |
333 | } | 333 | } |
334 | 334 | ||
335 | /* | 335 | /* |
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index df0b69987914..2ebd6ce46108 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c | |||
@@ -1414,14 +1414,18 @@ static int abituguru_probe(struct platform_device *pdev) | |||
1414 | pr_info("found Abit uGuru\n"); | 1414 | pr_info("found Abit uGuru\n"); |
1415 | 1415 | ||
1416 | /* Register sysfs hooks */ | 1416 | /* Register sysfs hooks */ |
1417 | for (i = 0; i < sysfs_attr_i; i++) | 1417 | for (i = 0; i < sysfs_attr_i; i++) { |
1418 | if (device_create_file(&pdev->dev, | 1418 | res = device_create_file(&pdev->dev, |
1419 | &data->sysfs_attr[i].dev_attr)) | 1419 | &data->sysfs_attr[i].dev_attr); |
1420 | if (res) | ||
1420 | goto abituguru_probe_error; | 1421 | goto abituguru_probe_error; |
1421 | for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++) | 1422 | } |
1422 | if (device_create_file(&pdev->dev, | 1423 | for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++) { |
1423 | &abituguru_sysfs_attr[i].dev_attr)) | 1424 | res = device_create_file(&pdev->dev, |
1425 | &abituguru_sysfs_attr[i].dev_attr); | ||
1426 | if (res) | ||
1424 | goto abituguru_probe_error; | 1427 | goto abituguru_probe_error; |
1428 | } | ||
1425 | 1429 | ||
1426 | data->hwmon_dev = hwmon_device_register(&pdev->dev); | 1430 | data->hwmon_dev = hwmon_device_register(&pdev->dev); |
1427 | if (!IS_ERR(data->hwmon_dev)) | 1431 | if (!IS_ERR(data->hwmon_dev)) |
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 7e76922a4ba9..f920619cd6da 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c | |||
@@ -331,26 +331,68 @@ static int adm1021_detect(struct i2c_client *client, | |||
331 | man_id = i2c_smbus_read_byte_data(client, ADM1021_REG_MAN_ID); | 331 | man_id = i2c_smbus_read_byte_data(client, ADM1021_REG_MAN_ID); |
332 | dev_id = i2c_smbus_read_byte_data(client, ADM1021_REG_DEV_ID); | 332 | dev_id = i2c_smbus_read_byte_data(client, ADM1021_REG_DEV_ID); |
333 | 333 | ||
334 | if (man_id < 0 || dev_id < 0) | ||
335 | return -ENODEV; | ||
336 | |||
334 | if (man_id == 0x4d && dev_id == 0x01) | 337 | if (man_id == 0x4d && dev_id == 0x01) |
335 | type_name = "max1617a"; | 338 | type_name = "max1617a"; |
336 | else if (man_id == 0x41) { | 339 | else if (man_id == 0x41) { |
337 | if ((dev_id & 0xF0) == 0x30) | 340 | if ((dev_id & 0xF0) == 0x30) |
338 | type_name = "adm1023"; | 341 | type_name = "adm1023"; |
339 | else | 342 | else if ((dev_id & 0xF0) == 0x00) |
340 | type_name = "adm1021"; | 343 | type_name = "adm1021"; |
344 | else | ||
345 | return -ENODEV; | ||
341 | } else if (man_id == 0x49) | 346 | } else if (man_id == 0x49) |
342 | type_name = "thmc10"; | 347 | type_name = "thmc10"; |
343 | else if (man_id == 0x23) | 348 | else if (man_id == 0x23) |
344 | type_name = "gl523sm"; | 349 | type_name = "gl523sm"; |
345 | else if (man_id == 0x54) | 350 | else if (man_id == 0x54) |
346 | type_name = "mc1066"; | 351 | type_name = "mc1066"; |
347 | /* LM84 Mfr ID in a different place, and it has more unused bits */ | 352 | else { |
348 | else if (conv_rate == 0x00 | 353 | int lte, rte, lhi, rhi, llo, rlo; |
349 | && (config & 0x7F) == 0x00 | 354 | |
350 | && (status & 0xAB) == 0x00) | 355 | /* extra checks for LM84 and MAX1617 to avoid misdetections */ |
351 | type_name = "lm84"; | 356 | |
352 | else | 357 | llo = i2c_smbus_read_byte_data(client, ADM1021_REG_THYST_R(0)); |
353 | type_name = "max1617"; | 358 | rlo = i2c_smbus_read_byte_data(client, ADM1021_REG_THYST_R(1)); |
359 | |||
360 | /* fail if any of the additional register reads failed */ | ||
361 | if (llo < 0 || rlo < 0) | ||
362 | return -ENODEV; | ||
363 | |||
364 | lte = i2c_smbus_read_byte_data(client, ADM1021_REG_TEMP(0)); | ||
365 | rte = i2c_smbus_read_byte_data(client, ADM1021_REG_TEMP(1)); | ||
366 | lhi = i2c_smbus_read_byte_data(client, ADM1021_REG_TOS_R(0)); | ||
367 | rhi = i2c_smbus_read_byte_data(client, ADM1021_REG_TOS_R(1)); | ||
368 | |||
369 | /* | ||
370 | * Fail for negative temperatures and negative high limits. | ||
371 | * This check also catches read errors on the tested registers. | ||
372 | */ | ||
373 | if ((s8)lte < 0 || (s8)rte < 0 || (s8)lhi < 0 || (s8)rhi < 0) | ||
374 | return -ENODEV; | ||
375 | |||
376 | /* fail if all registers hold the same value */ | ||
377 | if (lte == rte && lte == lhi && lte == rhi && lte == llo | ||
378 | && lte == rlo) | ||
379 | return -ENODEV; | ||
380 | |||
381 | /* | ||
382 | * LM84 Mfr ID is in a different place, | ||
383 | * and it has more unused bits. | ||
384 | */ | ||
385 | if (conv_rate == 0x00 | ||
386 | && (config & 0x7F) == 0x00 | ||
387 | && (status & 0xAB) == 0x00) { | ||
388 | type_name = "lm84"; | ||
389 | } else { | ||
390 | /* fail if low limits are larger than high limits */ | ||
391 | if ((s8)llo > lhi || (s8)rlo > rhi) | ||
392 | return -ENODEV; | ||
393 | type_name = "max1617"; | ||
394 | } | ||
395 | } | ||
354 | 396 | ||
355 | pr_debug("Detected chip %s at adapter %d, address 0x%02x.\n", | 397 | pr_debug("Detected chip %s at adapter %d, address 0x%02x.\n", |
356 | type_name, i2c_adapter_id(adapter), client->addr); | 398 | type_name, i2c_adapter_id(adapter), client->addr); |
diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c index aafa4531b961..52b77afebde1 100644 --- a/drivers/hwmon/iio_hwmon.c +++ b/drivers/hwmon/iio_hwmon.c | |||
@@ -84,8 +84,10 @@ static int iio_hwmon_probe(struct platform_device *pdev) | |||
84 | return PTR_ERR(channels); | 84 | return PTR_ERR(channels); |
85 | 85 | ||
86 | st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); | 86 | st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); |
87 | if (st == NULL) | 87 | if (st == NULL) { |
88 | return -ENOMEM; | 88 | ret = -ENOMEM; |
89 | goto error_release_channels; | ||
90 | } | ||
89 | 91 | ||
90 | st->channels = channels; | 92 | st->channels = channels; |
91 | 93 | ||
@@ -159,7 +161,7 @@ static int iio_hwmon_probe(struct platform_device *pdev) | |||
159 | error_remove_group: | 161 | error_remove_group: |
160 | sysfs_remove_group(&dev->kobj, &st->attr_group); | 162 | sysfs_remove_group(&dev->kobj, &st->attr_group); |
161 | error_release_channels: | 163 | error_release_channels: |
162 | iio_channel_release_all(st->channels); | 164 | iio_channel_release_all(channels); |
163 | return ret; | 165 | return ret; |
164 | } | 166 | } |
165 | 167 | ||
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index f43f5e571db9..04638aee9039 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c | |||
@@ -3705,8 +3705,10 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3705 | data->have_temp |= 1 << i; | 3705 | data->have_temp |= 1 << i; |
3706 | data->have_temp_fixed |= 1 << i; | 3706 | data->have_temp_fixed |= 1 << i; |
3707 | data->reg_temp[0][i] = reg_temp_alternate[i]; | 3707 | data->reg_temp[0][i] = reg_temp_alternate[i]; |
3708 | data->reg_temp[1][i] = reg_temp_over[i]; | 3708 | if (i < num_reg_temp) { |
3709 | data->reg_temp[2][i] = reg_temp_hyst[i]; | 3709 | data->reg_temp[1][i] = reg_temp_over[i]; |
3710 | data->reg_temp[2][i] = reg_temp_hyst[i]; | ||
3711 | } | ||
3710 | data->temp_src[i] = i + 1; | 3712 | data->temp_src[i] = i + 1; |
3711 | continue; | 3713 | continue; |
3712 | } | 3714 | } |
diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c index a478454f690f..dfe6d9527efb 100644 --- a/drivers/hwmon/tmp401.c +++ b/drivers/hwmon/tmp401.c | |||
@@ -240,7 +240,7 @@ static struct tmp401_data *tmp401_update_device(struct device *dev) | |||
240 | mutex_lock(&data->update_lock); | 240 | mutex_lock(&data->update_lock); |
241 | 241 | ||
242 | next_update = data->last_updated + | 242 | next_update = data->last_updated + |
243 | msecs_to_jiffies(data->update_interval) + 1; | 243 | msecs_to_jiffies(data->update_interval); |
244 | if (time_after(jiffies, next_update) || !data->valid) { | 244 | if (time_after(jiffies, next_update) || !data->valid) { |
245 | if (data->kind != tmp432) { | 245 | if (data->kind != tmp432) { |
246 | /* | 246 | /* |
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index 21fbb340ad66..c41ca6354fc5 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c | |||
@@ -383,7 +383,8 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev) | |||
383 | /* Enable the adapter */ | 383 | /* Enable the adapter */ |
384 | __i2c_dw_enable(dev, true); | 384 | __i2c_dw_enable(dev, true); |
385 | 385 | ||
386 | /* Enable interrupts */ | 386 | /* Clear and enable interrupts */ |
387 | i2c_dw_clear_int(dev); | ||
387 | dw_writel(dev, DW_IC_INTR_DEFAULT_MASK, DW_IC_INTR_MASK); | 388 | dw_writel(dev, DW_IC_INTR_DEFAULT_MASK, DW_IC_INTR_MASK); |
388 | } | 389 | } |
389 | 390 | ||
@@ -448,8 +449,14 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) | |||
448 | cmd |= BIT(9); | 449 | cmd |= BIT(9); |
449 | 450 | ||
450 | if (msgs[dev->msg_write_idx].flags & I2C_M_RD) { | 451 | if (msgs[dev->msg_write_idx].flags & I2C_M_RD) { |
452 | |||
453 | /* avoid rx buffer overrun */ | ||
454 | if (rx_limit - dev->rx_outstanding <= 0) | ||
455 | break; | ||
456 | |||
451 | dw_writel(dev, cmd | 0x100, DW_IC_DATA_CMD); | 457 | dw_writel(dev, cmd | 0x100, DW_IC_DATA_CMD); |
452 | rx_limit--; | 458 | rx_limit--; |
459 | dev->rx_outstanding++; | ||
453 | } else | 460 | } else |
454 | dw_writel(dev, cmd | *buf++, DW_IC_DATA_CMD); | 461 | dw_writel(dev, cmd | *buf++, DW_IC_DATA_CMD); |
455 | tx_limit--; buf_len--; | 462 | tx_limit--; buf_len--; |
@@ -502,8 +509,10 @@ i2c_dw_read(struct dw_i2c_dev *dev) | |||
502 | 509 | ||
503 | rx_valid = dw_readl(dev, DW_IC_RXFLR); | 510 | rx_valid = dw_readl(dev, DW_IC_RXFLR); |
504 | 511 | ||
505 | for (; len > 0 && rx_valid > 0; len--, rx_valid--) | 512 | for (; len > 0 && rx_valid > 0; len--, rx_valid--) { |
506 | *buf++ = dw_readl(dev, DW_IC_DATA_CMD); | 513 | *buf++ = dw_readl(dev, DW_IC_DATA_CMD); |
514 | dev->rx_outstanding--; | ||
515 | } | ||
507 | 516 | ||
508 | if (len > 0) { | 517 | if (len > 0) { |
509 | dev->status |= STATUS_READ_IN_PROGRESS; | 518 | dev->status |= STATUS_READ_IN_PROGRESS; |
@@ -561,6 +570,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | |||
561 | dev->msg_err = 0; | 570 | dev->msg_err = 0; |
562 | dev->status = STATUS_IDLE; | 571 | dev->status = STATUS_IDLE; |
563 | dev->abort_source = 0; | 572 | dev->abort_source = 0; |
573 | dev->rx_outstanding = 0; | ||
564 | 574 | ||
565 | ret = i2c_dw_wait_bus_not_busy(dev); | 575 | ret = i2c_dw_wait_bus_not_busy(dev); |
566 | if (ret < 0) | 576 | if (ret < 0) |
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index 9c1840ee09c7..e761ad18dd61 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h | |||
@@ -60,6 +60,7 @@ | |||
60 | * @adapter: i2c subsystem adapter node | 60 | * @adapter: i2c subsystem adapter node |
61 | * @tx_fifo_depth: depth of the hardware tx fifo | 61 | * @tx_fifo_depth: depth of the hardware tx fifo |
62 | * @rx_fifo_depth: depth of the hardware rx fifo | 62 | * @rx_fifo_depth: depth of the hardware rx fifo |
63 | * @rx_outstanding: current master-rx elements in tx fifo | ||
63 | */ | 64 | */ |
64 | struct dw_i2c_dev { | 65 | struct dw_i2c_dev { |
65 | struct device *dev; | 66 | struct device *dev; |
@@ -88,6 +89,7 @@ struct dw_i2c_dev { | |||
88 | u32 master_cfg; | 89 | u32 master_cfg; |
89 | unsigned int tx_fifo_depth; | 90 | unsigned int tx_fifo_depth; |
90 | unsigned int rx_fifo_depth; | 91 | unsigned int rx_fifo_depth; |
92 | int rx_outstanding; | ||
91 | }; | 93 | }; |
92 | 94 | ||
93 | #define ACCESS_SWAP 0x00000001 | 95 | #define ACCESS_SWAP 0x00000001 |
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 8ec91335d95a..35b70a1edf57 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
@@ -69,6 +69,7 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev) | |||
69 | static const struct acpi_device_id dw_i2c_acpi_match[] = { | 69 | static const struct acpi_device_id dw_i2c_acpi_match[] = { |
70 | { "INT33C2", 0 }, | 70 | { "INT33C2", 0 }, |
71 | { "INT33C3", 0 }, | 71 | { "INT33C3", 0 }, |
72 | { "80860F41", 0 }, | ||
72 | { } | 73 | { } |
73 | }; | 74 | }; |
74 | MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match); | 75 | MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match); |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index e1cf2e0e1f23..3a6903f63913 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -231,7 +231,11 @@ static const char *i801_feature_names[] = { | |||
231 | 231 | ||
232 | static unsigned int disable_features; | 232 | static unsigned int disable_features; |
233 | module_param(disable_features, uint, S_IRUGO | S_IWUSR); | 233 | module_param(disable_features, uint, S_IRUGO | S_IWUSR); |
234 | MODULE_PARM_DESC(disable_features, "Disable selected driver features"); | 234 | MODULE_PARM_DESC(disable_features, "Disable selected driver features:\n" |
235 | "\t\t 0x01 disable SMBus PEC\n" | ||
236 | "\t\t 0x02 disable the block buffer\n" | ||
237 | "\t\t 0x08 disable the I2C block read functionality\n" | ||
238 | "\t\t 0x10 don't use interrupts "); | ||
235 | 239 | ||
236 | /* Make sure the SMBus host is ready to start transmitting. | 240 | /* Make sure the SMBus host is ready to start transmitting. |
237 | Return 0 if it is, -EBUSY if it is not. */ | 241 | Return 0 if it is, -EBUSY if it is not. */ |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 3bbd65d35a5e..1a3abd6a0bfc 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -252,7 +252,7 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data) | |||
252 | writel(drv_data->cntl_bits, | 252 | writel(drv_data->cntl_bits, |
253 | drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); | 253 | drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); |
254 | drv_data->block = 0; | 254 | drv_data->block = 0; |
255 | wake_up_interruptible(&drv_data->waitq); | 255 | wake_up(&drv_data->waitq); |
256 | break; | 256 | break; |
257 | 257 | ||
258 | case MV64XXX_I2C_ACTION_CONTINUE: | 258 | case MV64XXX_I2C_ACTION_CONTINUE: |
@@ -300,7 +300,7 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data) | |||
300 | writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP, | 300 | writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP, |
301 | drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); | 301 | drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); |
302 | drv_data->block = 0; | 302 | drv_data->block = 0; |
303 | wake_up_interruptible(&drv_data->waitq); | 303 | wake_up(&drv_data->waitq); |
304 | break; | 304 | break; |
305 | 305 | ||
306 | case MV64XXX_I2C_ACTION_INVALID: | 306 | case MV64XXX_I2C_ACTION_INVALID: |
@@ -315,7 +315,7 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data) | |||
315 | writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP, | 315 | writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP, |
316 | drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); | 316 | drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); |
317 | drv_data->block = 0; | 317 | drv_data->block = 0; |
318 | wake_up_interruptible(&drv_data->waitq); | 318 | wake_up(&drv_data->waitq); |
319 | break; | 319 | break; |
320 | } | 320 | } |
321 | } | 321 | } |
@@ -381,7 +381,7 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data) | |||
381 | unsigned long flags; | 381 | unsigned long flags; |
382 | char abort = 0; | 382 | char abort = 0; |
383 | 383 | ||
384 | time_left = wait_event_interruptible_timeout(drv_data->waitq, | 384 | time_left = wait_event_timeout(drv_data->waitq, |
385 | !drv_data->block, drv_data->adapter.timeout); | 385 | !drv_data->block, drv_data->adapter.timeout); |
386 | 386 | ||
387 | spin_lock_irqsave(&drv_data->lock, flags); | 387 | spin_lock_irqsave(&drv_data->lock, flags); |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 6e8ee92ab553..cab1c91b75a3 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -1082,11 +1082,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
1082 | /* map the registers */ | 1082 | /* map the registers */ |
1083 | 1083 | ||
1084 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1084 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1085 | if (res == NULL) { | ||
1086 | dev_err(&pdev->dev, "cannot find IO resource\n"); | ||
1087 | return -ENOENT; | ||
1088 | } | ||
1089 | |||
1090 | i2c->regs = devm_ioremap_resource(&pdev->dev, res); | 1085 | i2c->regs = devm_ioremap_resource(&pdev->dev, res); |
1091 | 1086 | ||
1092 | if (IS_ERR(i2c->regs)) | 1087 | if (IS_ERR(i2c->regs)) |
diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c index 5a7ad240bd26..a63c7d506836 100644 --- a/drivers/i2c/busses/i2c-sirf.c +++ b/drivers/i2c/busses/i2c-sirf.c | |||
@@ -303,12 +303,6 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev) | |||
303 | adap->class = I2C_CLASS_HWMON; | 303 | adap->class = I2C_CLASS_HWMON; |
304 | 304 | ||
305 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 305 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
306 | if (mem_res == NULL) { | ||
307 | dev_err(&pdev->dev, "Unable to get MEM resource\n"); | ||
308 | err = -EINVAL; | ||
309 | goto out; | ||
310 | } | ||
311 | |||
312 | siic->base = devm_ioremap_resource(&pdev->dev, mem_res); | 306 | siic->base = devm_ioremap_resource(&pdev->dev, mem_res); |
313 | if (IS_ERR(siic->base)) { | 307 | if (IS_ERR(siic->base)) { |
314 | err = PTR_ERR(siic->base); | 308 | err = PTR_ERR(siic->base); |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index b60ff90adc39..9aa1b60f7fdd 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -714,11 +714,6 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
714 | int ret = 0; | 714 | int ret = 0; |
715 | 715 | ||
716 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 716 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
717 | if (!res) { | ||
718 | dev_err(&pdev->dev, "no mem resource\n"); | ||
719 | return -EINVAL; | ||
720 | } | ||
721 | |||
722 | base = devm_ioremap_resource(&pdev->dev, res); | 717 | base = devm_ioremap_resource(&pdev->dev, res); |
723 | if (IS_ERR(base)) | 718 | if (IS_ERR(base)) |
724 | return PTR_ERR(base); | 719 | return PTR_ERR(base); |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 6b63cc7eb71e..48e31ed69dbf 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -892,7 +892,8 @@ i2c_sysfs_delete_device(struct device *dev, struct device_attribute *attr, | |||
892 | } | 892 | } |
893 | 893 | ||
894 | static DEVICE_ATTR(new_device, S_IWUSR, NULL, i2c_sysfs_new_device); | 894 | static DEVICE_ATTR(new_device, S_IWUSR, NULL, i2c_sysfs_new_device); |
895 | static DEVICE_ATTR(delete_device, S_IWUSR, NULL, i2c_sysfs_delete_device); | 895 | static DEVICE_ATTR_IGNORE_LOCKDEP(delete_device, S_IWUSR, NULL, |
896 | i2c_sysfs_delete_device); | ||
896 | 897 | ||
897 | static struct attribute *i2c_adapter_attrs[] = { | 898 | static struct attribute *i2c_adapter_attrs[] = { |
898 | &dev_attr_name.attr, | 899 | &dev_attr_name.attr, |
diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index 9f3a8ef1fb3e..b3d03d335948 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c | |||
@@ -390,8 +390,8 @@ static int exynos_adc_remove(struct platform_device *pdev) | |||
390 | #ifdef CONFIG_PM_SLEEP | 390 | #ifdef CONFIG_PM_SLEEP |
391 | static int exynos_adc_suspend(struct device *dev) | 391 | static int exynos_adc_suspend(struct device *dev) |
392 | { | 392 | { |
393 | struct platform_device *pdev = to_platform_device(dev); | 393 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
394 | struct exynos_adc *info = platform_get_drvdata(pdev); | 394 | struct exynos_adc *info = iio_priv(indio_dev); |
395 | u32 con; | 395 | u32 con; |
396 | 396 | ||
397 | if (info->version == ADC_V2) { | 397 | if (info->version == ADC_V2) { |
@@ -413,8 +413,8 @@ static int exynos_adc_suspend(struct device *dev) | |||
413 | 413 | ||
414 | static int exynos_adc_resume(struct device *dev) | 414 | static int exynos_adc_resume(struct device *dev) |
415 | { | 415 | { |
416 | struct platform_device *pdev = to_platform_device(dev); | 416 | struct iio_dev *indio_dev = dev_get_drvdata(dev); |
417 | struct exynos_adc *info = platform_get_drvdata(pdev); | 417 | struct exynos_adc *info = iio_priv(indio_dev); |
418 | int ret; | 418 | int ret; |
419 | 419 | ||
420 | ret = regulator_enable(info->vdd); | 420 | ret = regulator_enable(info->vdd); |
diff --git a/drivers/iio/buffer_cb.c b/drivers/iio/buffer_cb.c index 9201022945e9..9d19ba74f22b 100644 --- a/drivers/iio/buffer_cb.c +++ b/drivers/iio/buffer_cb.c | |||
@@ -64,7 +64,7 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, | |||
64 | while (chan->indio_dev) { | 64 | while (chan->indio_dev) { |
65 | if (chan->indio_dev != indio_dev) { | 65 | if (chan->indio_dev != indio_dev) { |
66 | ret = -EINVAL; | 66 | ret = -EINVAL; |
67 | goto error_release_channels; | 67 | goto error_free_scan_mask; |
68 | } | 68 | } |
69 | set_bit(chan->channel->scan_index, | 69 | set_bit(chan->channel->scan_index, |
70 | cb_buff->buffer.scan_mask); | 70 | cb_buff->buffer.scan_mask); |
@@ -73,6 +73,8 @@ struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, | |||
73 | 73 | ||
74 | return cb_buff; | 74 | return cb_buff; |
75 | 75 | ||
76 | error_free_scan_mask: | ||
77 | kfree(cb_buff->buffer.scan_mask); | ||
76 | error_release_channels: | 78 | error_release_channels: |
77 | iio_channel_release_all(cb_buff->channels); | 79 | iio_channel_release_all(cb_buff->channels); |
78 | error_free_cb_buff: | 80 | error_free_cb_buff: |
@@ -100,6 +102,7 @@ EXPORT_SYMBOL_GPL(iio_channel_stop_all_cb); | |||
100 | 102 | ||
101 | void iio_channel_release_all_cb(struct iio_cb_buffer *cb_buff) | 103 | void iio_channel_release_all_cb(struct iio_cb_buffer *cb_buff) |
102 | { | 104 | { |
105 | kfree(cb_buff->buffer.scan_mask); | ||
103 | iio_channel_release_all(cb_buff->channels); | 106 | iio_channel_release_all(cb_buff->channels); |
104 | kfree(cb_buff); | 107 | kfree(cb_buff); |
105 | } | 108 | } |
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index bd33473f8e38..ed9bc8ae9330 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c | |||
@@ -312,6 +312,8 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev, | |||
312 | goto read_error; | 312 | goto read_error; |
313 | 313 | ||
314 | *val = *val >> ch->scan_type.shift; | 314 | *val = *val >> ch->scan_type.shift; |
315 | |||
316 | err = st_sensors_set_enable(indio_dev, false); | ||
315 | } | 317 | } |
316 | mutex_unlock(&indio_dev->mlock); | 318 | mutex_unlock(&indio_dev->mlock); |
317 | 319 | ||
diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig index f4a6f0838327..b61160bd935e 100644 --- a/drivers/iio/dac/Kconfig +++ b/drivers/iio/dac/Kconfig | |||
@@ -5,7 +5,7 @@ menu "Digital to analog converters" | |||
5 | 5 | ||
6 | config AD5064 | 6 | config AD5064 |
7 | tristate "Analog Devices AD5064 and similar multi-channel DAC driver" | 7 | tristate "Analog Devices AD5064 and similar multi-channel DAC driver" |
8 | depends on (SPI_MASTER || I2C) | 8 | depends on (SPI_MASTER && I2C!=m) || I2C |
9 | help | 9 | help |
10 | Say yes here to build support for Analog Devices AD5024, AD5025, AD5044, | 10 | Say yes here to build support for Analog Devices AD5024, AD5025, AD5044, |
11 | AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R, AD5648, AD5666, AD5668, | 11 | AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R, AD5648, AD5666, AD5668, |
@@ -27,7 +27,7 @@ config AD5360 | |||
27 | 27 | ||
28 | config AD5380 | 28 | config AD5380 |
29 | tristate "Analog Devices AD5380/81/82/83/84/90/91/92 DAC driver" | 29 | tristate "Analog Devices AD5380/81/82/83/84/90/91/92 DAC driver" |
30 | depends on (SPI_MASTER || I2C) | 30 | depends on (SPI_MASTER && I2C!=m) || I2C |
31 | select REGMAP_I2C if I2C | 31 | select REGMAP_I2C if I2C |
32 | select REGMAP_SPI if SPI_MASTER | 32 | select REGMAP_SPI if SPI_MASTER |
33 | help | 33 | help |
@@ -57,7 +57,7 @@ config AD5624R_SPI | |||
57 | 57 | ||
58 | config AD5446 | 58 | config AD5446 |
59 | tristate "Analog Devices AD5446 and similar single channel DACs driver" | 59 | tristate "Analog Devices AD5446 and similar single channel DACs driver" |
60 | depends on (SPI_MASTER || I2C) | 60 | depends on (SPI_MASTER && I2C!=m) || I2C |
61 | help | 61 | help |
62 | Say yes here to build support for Analog Devices AD5300, AD5301, AD5310, | 62 | Say yes here to build support for Analog Devices AD5300, AD5301, AD5310, |
63 | AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453, | 63 | AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453, |
diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c index a884252ac66b..e76d4ace53ff 100644 --- a/drivers/iio/frequency/adf4350.c +++ b/drivers/iio/frequency/adf4350.c | |||
@@ -212,7 +212,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq) | |||
212 | (pdata->r2_user_settings & (ADF4350_REG2_PD_POLARITY_POS | | 212 | (pdata->r2_user_settings & (ADF4350_REG2_PD_POLARITY_POS | |
213 | ADF4350_REG2_LDP_6ns | ADF4350_REG2_LDF_INT_N | | 213 | ADF4350_REG2_LDP_6ns | ADF4350_REG2_LDF_INT_N | |
214 | ADF4350_REG2_CHARGE_PUMP_CURR_uA(5000) | | 214 | ADF4350_REG2_CHARGE_PUMP_CURR_uA(5000) | |
215 | ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x9))); | 215 | ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x3))); |
216 | 216 | ||
217 | st->regs[ADF4350_REG3] = pdata->r3_user_settings & | 217 | st->regs[ADF4350_REG3] = pdata->r3_user_settings & |
218 | (ADF4350_REG3_12BIT_CLKDIV(0xFFF) | | 218 | (ADF4350_REG3_12BIT_CLKDIV(0xFFF) | |
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 795d100b4c36..98ddc323add0 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -124,7 +124,7 @@ static int __of_iio_channel_get(struct iio_channel *channel, | |||
124 | channel->indio_dev = indio_dev; | 124 | channel->indio_dev = indio_dev; |
125 | index = iiospec.args_count ? iiospec.args[0] : 0; | 125 | index = iiospec.args_count ? iiospec.args[0] : 0; |
126 | if (index >= indio_dev->num_channels) { | 126 | if (index >= indio_dev->num_channels) { |
127 | return -EINVAL; | 127 | err = -EINVAL; |
128 | goto err_put; | 128 | goto err_put; |
129 | } | 129 | } |
130 | channel->channel = &indio_dev->channels[index]; | 130 | channel->channel = &indio_dev->channels[index]; |
@@ -450,7 +450,7 @@ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan, | |||
450 | s64 raw64 = raw; | 450 | s64 raw64 = raw; |
451 | int ret; | 451 | int ret; |
452 | 452 | ||
453 | ret = iio_channel_read(chan, &offset, NULL, IIO_CHAN_INFO_SCALE); | 453 | ret = iio_channel_read(chan, &offset, NULL, IIO_CHAN_INFO_OFFSET); |
454 | if (ret == 0) | 454 | if (ret == 0) |
455 | raw64 += offset; | 455 | raw64 += offset; |
456 | 456 | ||
diff --git a/drivers/infiniband/hw/qib/qib_keys.c b/drivers/infiniband/hw/qib/qib_keys.c index 81c7b73695d2..3b9afccaaade 100644 --- a/drivers/infiniband/hw/qib/qib_keys.c +++ b/drivers/infiniband/hw/qib/qib_keys.c | |||
@@ -61,7 +61,7 @@ int qib_alloc_lkey(struct qib_mregion *mr, int dma_region) | |||
61 | if (dma_region) { | 61 | if (dma_region) { |
62 | struct qib_mregion *tmr; | 62 | struct qib_mregion *tmr; |
63 | 63 | ||
64 | tmr = rcu_dereference(dev->dma_mr); | 64 | tmr = rcu_access_pointer(dev->dma_mr); |
65 | if (!tmr) { | 65 | if (!tmr) { |
66 | qib_get_mr(mr); | 66 | qib_get_mr(mr); |
67 | rcu_assign_pointer(dev->dma_mr, mr); | 67 | rcu_assign_pointer(dev->dma_mr, mr); |
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index f19b0998a53c..2e84ef859c5b 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Copyright (C) 2004 Alex Aizman | 5 | * Copyright (C) 2004 Alex Aizman |
6 | * Copyright (C) 2005 Mike Christie | 6 | * Copyright (C) 2005 Mike Christie |
7 | * Copyright (c) 2005, 2006 Voltaire, Inc. All rights reserved. | 7 | * Copyright (c) 2005, 2006 Voltaire, Inc. All rights reserved. |
8 | * Copyright (c) 2013 Mellanox Technologies. All rights reserved. | ||
8 | * maintained by openib-general@openib.org | 9 | * maintained by openib-general@openib.org |
9 | * | 10 | * |
10 | * This software is available to you under a choice of one of two | 11 | * This software is available to you under a choice of one of two |
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h index 06f578cde75b..4f069c0d4c04 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.h +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h | |||
@@ -8,6 +8,7 @@ | |||
8 | * | 8 | * |
9 | * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved. | 9 | * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved. |
10 | * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. | 10 | * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. |
11 | * Copyright (c) 2013 Mellanox Technologies. All rights reserved. | ||
11 | * | 12 | * |
12 | * This software is available to you under a choice of one of two | 13 | * This software is available to you under a choice of one of two |
13 | * licenses. You may choose to be licensed under the terms of the GNU | 14 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index a00ccd1ca333..b6d81a86c976 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved. | 2 | * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved. |
3 | * Copyright (c) 2013 Mellanox Technologies. All rights reserved. | ||
3 | * | 4 | * |
4 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 6 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c index 68ebb7fe072a..7827baf455a1 100644 --- a/drivers/infiniband/ulp/iser/iser_memory.c +++ b/drivers/infiniband/ulp/iser/iser_memory.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved. | 2 | * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved. |
3 | * Copyright (c) 2013 Mellanox Technologies. All rights reserved. | ||
3 | * | 4 | * |
4 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 6 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 5278916c3103..2c4941d0656b 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved. | 2 | * Copyright (c) 2004, 2005, 2006 Voltaire, Inc. All rights reserved. |
3 | * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. | 3 | * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. |
4 | * Copyright (c) 2013 Mellanox Technologies. All rights reserved. | ||
4 | * | 5 | * |
5 | * This software is available to you under a choice of one of two | 6 | * This software is available to you under a choice of one of two |
6 | * licenses. You may choose to be licensed under the terms of the GNU | 7 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -292,10 +293,10 @@ out_err: | |||
292 | } | 293 | } |
293 | 294 | ||
294 | /** | 295 | /** |
295 | * releases the FMR pool, QP and CMA ID objects, returns 0 on success, | 296 | * releases the FMR pool and QP objects, returns 0 on success, |
296 | * -1 on failure | 297 | * -1 on failure |
297 | */ | 298 | */ |
298 | static int iser_free_ib_conn_res(struct iser_conn *ib_conn, int can_destroy_id) | 299 | static int iser_free_ib_conn_res(struct iser_conn *ib_conn) |
299 | { | 300 | { |
300 | int cq_index; | 301 | int cq_index; |
301 | BUG_ON(ib_conn == NULL); | 302 | BUG_ON(ib_conn == NULL); |
@@ -314,13 +315,9 @@ static int iser_free_ib_conn_res(struct iser_conn *ib_conn, int can_destroy_id) | |||
314 | 315 | ||
315 | rdma_destroy_qp(ib_conn->cma_id); | 316 | rdma_destroy_qp(ib_conn->cma_id); |
316 | } | 317 | } |
317 | /* if cma handler context, the caller acts s.t the cma destroy the id */ | ||
318 | if (ib_conn->cma_id != NULL && can_destroy_id) | ||
319 | rdma_destroy_id(ib_conn->cma_id); | ||
320 | 318 | ||
321 | ib_conn->fmr_pool = NULL; | 319 | ib_conn->fmr_pool = NULL; |
322 | ib_conn->qp = NULL; | 320 | ib_conn->qp = NULL; |
323 | ib_conn->cma_id = NULL; | ||
324 | kfree(ib_conn->page_vec); | 321 | kfree(ib_conn->page_vec); |
325 | 322 | ||
326 | if (ib_conn->login_buf) { | 323 | if (ib_conn->login_buf) { |
@@ -415,11 +412,16 @@ static void iser_conn_release(struct iser_conn *ib_conn, int can_destroy_id) | |||
415 | list_del(&ib_conn->conn_list); | 412 | list_del(&ib_conn->conn_list); |
416 | mutex_unlock(&ig.connlist_mutex); | 413 | mutex_unlock(&ig.connlist_mutex); |
417 | iser_free_rx_descriptors(ib_conn); | 414 | iser_free_rx_descriptors(ib_conn); |
418 | iser_free_ib_conn_res(ib_conn, can_destroy_id); | 415 | iser_free_ib_conn_res(ib_conn); |
419 | ib_conn->device = NULL; | 416 | ib_conn->device = NULL; |
420 | /* on EVENT_ADDR_ERROR there's no device yet for this conn */ | 417 | /* on EVENT_ADDR_ERROR there's no device yet for this conn */ |
421 | if (device != NULL) | 418 | if (device != NULL) |
422 | iser_device_try_release(device); | 419 | iser_device_try_release(device); |
420 | /* if cma handler context, the caller actually destroy the id */ | ||
421 | if (ib_conn->cma_id != NULL && can_destroy_id) { | ||
422 | rdma_destroy_id(ib_conn->cma_id); | ||
423 | ib_conn->cma_id = NULL; | ||
424 | } | ||
423 | iscsi_destroy_endpoint(ib_conn->ep); | 425 | iscsi_destroy_endpoint(ib_conn->ep); |
424 | } | 426 | } |
425 | 427 | ||
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index b08ca7a9f76b..3f3f0416fbdd 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -2227,6 +2227,27 @@ static void srpt_close_ch(struct srpt_rdma_ch *ch) | |||
2227 | } | 2227 | } |
2228 | 2228 | ||
2229 | /** | 2229 | /** |
2230 | * srpt_shutdown_session() - Whether or not a session may be shut down. | ||
2231 | */ | ||
2232 | static int srpt_shutdown_session(struct se_session *se_sess) | ||
2233 | { | ||
2234 | struct srpt_rdma_ch *ch = se_sess->fabric_sess_ptr; | ||
2235 | unsigned long flags; | ||
2236 | |||
2237 | spin_lock_irqsave(&ch->spinlock, flags); | ||
2238 | if (ch->in_shutdown) { | ||
2239 | spin_unlock_irqrestore(&ch->spinlock, flags); | ||
2240 | return true; | ||
2241 | } | ||
2242 | |||
2243 | ch->in_shutdown = true; | ||
2244 | target_sess_cmd_list_set_waiting(se_sess); | ||
2245 | spin_unlock_irqrestore(&ch->spinlock, flags); | ||
2246 | |||
2247 | return true; | ||
2248 | } | ||
2249 | |||
2250 | /** | ||
2230 | * srpt_drain_channel() - Drain a channel by resetting the IB queue pair. | 2251 | * srpt_drain_channel() - Drain a channel by resetting the IB queue pair. |
2231 | * @cm_id: Pointer to the CM ID of the channel to be drained. | 2252 | * @cm_id: Pointer to the CM ID of the channel to be drained. |
2232 | * | 2253 | * |
@@ -2264,6 +2285,9 @@ static void srpt_drain_channel(struct ib_cm_id *cm_id) | |||
2264 | spin_unlock_irq(&sdev->spinlock); | 2285 | spin_unlock_irq(&sdev->spinlock); |
2265 | 2286 | ||
2266 | if (do_reset) { | 2287 | if (do_reset) { |
2288 | if (ch->sess) | ||
2289 | srpt_shutdown_session(ch->sess); | ||
2290 | |||
2267 | ret = srpt_ch_qp_err(ch); | 2291 | ret = srpt_ch_qp_err(ch); |
2268 | if (ret < 0) | 2292 | if (ret < 0) |
2269 | printk(KERN_ERR "Setting queue pair in error state" | 2293 | printk(KERN_ERR "Setting queue pair in error state" |
@@ -2328,7 +2352,7 @@ static void srpt_release_channel_work(struct work_struct *w) | |||
2328 | se_sess = ch->sess; | 2352 | se_sess = ch->sess; |
2329 | BUG_ON(!se_sess); | 2353 | BUG_ON(!se_sess); |
2330 | 2354 | ||
2331 | target_wait_for_sess_cmds(se_sess, 0); | 2355 | target_wait_for_sess_cmds(se_sess); |
2332 | 2356 | ||
2333 | transport_deregister_session_configfs(se_sess); | 2357 | transport_deregister_session_configfs(se_sess); |
2334 | transport_deregister_session(se_sess); | 2358 | transport_deregister_session(se_sess); |
@@ -3467,14 +3491,6 @@ static void srpt_release_cmd(struct se_cmd *se_cmd) | |||
3467 | } | 3491 | } |
3468 | 3492 | ||
3469 | /** | 3493 | /** |
3470 | * srpt_shutdown_session() - Whether or not a session may be shut down. | ||
3471 | */ | ||
3472 | static int srpt_shutdown_session(struct se_session *se_sess) | ||
3473 | { | ||
3474 | return true; | ||
3475 | } | ||
3476 | |||
3477 | /** | ||
3478 | * srpt_close_session() - Forcibly close a session. | 3494 | * srpt_close_session() - Forcibly close a session. |
3479 | * | 3495 | * |
3480 | * Callback function invoked by the TCM core to clean up sessions associated | 3496 | * Callback function invoked by the TCM core to clean up sessions associated |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h index 4caf55cda7b1..3dae156905de 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h | |||
@@ -325,6 +325,7 @@ struct srpt_rdma_ch { | |||
325 | u8 sess_name[36]; | 325 | u8 sess_name[36]; |
326 | struct work_struct release_work; | 326 | struct work_struct release_work; |
327 | struct completion *release_done; | 327 | struct completion *release_done; |
328 | bool in_shutdown; | ||
328 | }; | 329 | }; |
329 | 330 | ||
330 | /** | 331 | /** |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 2f78538e09d0..b2420ae19e14 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -1379,6 +1379,7 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
1379 | { | 1379 | { |
1380 | struct synaptics_data *priv = psmouse->private; | 1380 | struct synaptics_data *priv = psmouse->private; |
1381 | struct synaptics_data old_priv = *priv; | 1381 | struct synaptics_data old_priv = *priv; |
1382 | unsigned char param[2]; | ||
1382 | int retry = 0; | 1383 | int retry = 0; |
1383 | int error; | 1384 | int error; |
1384 | 1385 | ||
@@ -1394,6 +1395,7 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
1394 | */ | 1395 | */ |
1395 | ssleep(1); | 1396 | ssleep(1); |
1396 | } | 1397 | } |
1398 | ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETID); | ||
1397 | error = synaptics_detect(psmouse, 0); | 1399 | error = synaptics_detect(psmouse, 0); |
1398 | } while (error && ++retry < 3); | 1400 | } while (error && ++retry < 3); |
1399 | 1401 | ||
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 0bfd8cf25200..518282da6d85 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -342,10 +342,10 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
342 | wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | | 342 | wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | |
343 | ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12); | 343 | ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12); |
344 | 344 | ||
345 | switch (wacom->id[idx] & 0xfffff) { | 345 | switch (wacom->id[idx]) { |
346 | case 0x812: /* Inking pen */ | 346 | case 0x812: /* Inking pen */ |
347 | case 0x801: /* Intuos3 Inking pen */ | 347 | case 0x801: /* Intuos3 Inking pen */ |
348 | case 0x20802: /* Intuos4 Inking Pen */ | 348 | case 0x120802: /* Intuos4/5 Inking Pen */ |
349 | case 0x012: | 349 | case 0x012: |
350 | wacom->tool[idx] = BTN_TOOL_PENCIL; | 350 | wacom->tool[idx] = BTN_TOOL_PENCIL; |
351 | break; | 351 | break; |
@@ -356,11 +356,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
356 | case 0x823: /* Intuos3 Grip Pen */ | 356 | case 0x823: /* Intuos3 Grip Pen */ |
357 | case 0x813: /* Intuos3 Classic Pen */ | 357 | case 0x813: /* Intuos3 Classic Pen */ |
358 | case 0x885: /* Intuos3 Marker Pen */ | 358 | case 0x885: /* Intuos3 Marker Pen */ |
359 | case 0x802: /* Intuos4 General Pen */ | 359 | case 0x802: /* Intuos4/5 13HD/24HD General Pen */ |
360 | case 0x804: /* Intuos4 Marker Pen */ | 360 | case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */ |
361 | case 0x40802: /* Intuos4 Classic Pen */ | ||
362 | case 0x18802: /* DTH2242 Grip Pen */ | ||
363 | case 0x022: | 361 | case 0x022: |
362 | case 0x100804: /* Intuos4/5 13HD/24HD Art Pen */ | ||
363 | case 0x140802: /* Intuos4/5 13HD/24HD Classic Pen */ | ||
364 | case 0x160802: /* Cintiq 13HD Pro Pen */ | ||
365 | case 0x180802: /* DTH2242 Pen */ | ||
364 | wacom->tool[idx] = BTN_TOOL_PEN; | 366 | wacom->tool[idx] = BTN_TOOL_PEN; |
365 | break; | 367 | break; |
366 | 368 | ||
@@ -391,10 +393,14 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
391 | case 0x82b: /* Intuos3 Grip Pen Eraser */ | 393 | case 0x82b: /* Intuos3 Grip Pen Eraser */ |
392 | case 0x81b: /* Intuos3 Classic Pen Eraser */ | 394 | case 0x81b: /* Intuos3 Classic Pen Eraser */ |
393 | case 0x91b: /* Intuos3 Airbrush Eraser */ | 395 | case 0x91b: /* Intuos3 Airbrush Eraser */ |
394 | case 0x80c: /* Intuos4 Marker Pen Eraser */ | 396 | case 0x80c: /* Intuos4/5 13HD/24HD Marker Pen Eraser */ |
395 | case 0x80a: /* Intuos4 General Pen Eraser */ | 397 | case 0x80a: /* Intuos4/5 13HD/24HD General Pen Eraser */ |
396 | case 0x4080a: /* Intuos4 Classic Pen Eraser */ | 398 | case 0x90a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ |
397 | case 0x90a: /* Intuos4 Airbrush Eraser */ | 399 | case 0x14080a: /* Intuos4/5 13HD/24HD Classic Pen Eraser */ |
400 | case 0x10090a: /* Intuos4/5 13HD/24HD Airbrush Eraser */ | ||
401 | case 0x10080c: /* Intuos4/5 13HD/24HD Art Pen Eraser */ | ||
402 | case 0x16080a: /* Cintiq 13HD Pro Pen Eraser */ | ||
403 | case 0x18080a: /* DTH2242 Eraser */ | ||
398 | wacom->tool[idx] = BTN_TOOL_RUBBER; | 404 | wacom->tool[idx] = BTN_TOOL_RUBBER; |
399 | break; | 405 | break; |
400 | 406 | ||
@@ -402,7 +408,8 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
402 | case 0x912: | 408 | case 0x912: |
403 | case 0x112: | 409 | case 0x112: |
404 | case 0x913: /* Intuos3 Airbrush */ | 410 | case 0x913: /* Intuos3 Airbrush */ |
405 | case 0x902: /* Intuos4 Airbrush */ | 411 | case 0x902: /* Intuos4/5 13HD/24HD Airbrush */ |
412 | case 0x100902: /* Intuos4/5 13HD/24HD Airbrush */ | ||
406 | wacom->tool[idx] = BTN_TOOL_AIRBRUSH; | 413 | wacom->tool[idx] = BTN_TOOL_AIRBRUSH; |
407 | break; | 414 | break; |
408 | 415 | ||
@@ -533,10 +540,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
533 | input_report_key(input, BTN_8, (data[3] & 0x80)); | 540 | input_report_key(input, BTN_8, (data[3] & 0x80)); |
534 | } | 541 | } |
535 | if (data[1] | (data[2] & 0x01) | data[3]) { | 542 | if (data[1] | (data[2] & 0x01) | data[3]) { |
536 | input_report_key(input, wacom->tool[1], 1); | ||
537 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | 543 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
538 | } else { | 544 | } else { |
539 | input_report_key(input, wacom->tool[1], 0); | ||
540 | input_report_abs(input, ABS_MISC, 0); | 545 | input_report_abs(input, ABS_MISC, 0); |
541 | } | 546 | } |
542 | } else if (features->type == DTK) { | 547 | } else if (features->type == DTK) { |
@@ -546,6 +551,26 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
546 | input_report_key(input, BTN_3, (data[6] & 0x08)); | 551 | input_report_key(input, BTN_3, (data[6] & 0x08)); |
547 | input_report_key(input, BTN_4, (data[6] & 0x10)); | 552 | input_report_key(input, BTN_4, (data[6] & 0x10)); |
548 | input_report_key(input, BTN_5, (data[6] & 0x20)); | 553 | input_report_key(input, BTN_5, (data[6] & 0x20)); |
554 | if (data[6] & 0x3f) { | ||
555 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | ||
556 | } else { | ||
557 | input_report_abs(input, ABS_MISC, 0); | ||
558 | } | ||
559 | } else if (features->type == WACOM_13HD) { | ||
560 | input_report_key(input, BTN_0, (data[3] & 0x01)); | ||
561 | input_report_key(input, BTN_1, (data[4] & 0x01)); | ||
562 | input_report_key(input, BTN_2, (data[4] & 0x02)); | ||
563 | input_report_key(input, BTN_3, (data[4] & 0x04)); | ||
564 | input_report_key(input, BTN_4, (data[4] & 0x08)); | ||
565 | input_report_key(input, BTN_5, (data[4] & 0x10)); | ||
566 | input_report_key(input, BTN_6, (data[4] & 0x20)); | ||
567 | input_report_key(input, BTN_7, (data[4] & 0x40)); | ||
568 | input_report_key(input, BTN_8, (data[4] & 0x80)); | ||
569 | if ((data[3] & 0x01) | data[4]) { | ||
570 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | ||
571 | } else { | ||
572 | input_report_abs(input, ABS_MISC, 0); | ||
573 | } | ||
549 | } else if (features->type == WACOM_24HD) { | 574 | } else if (features->type == WACOM_24HD) { |
550 | input_report_key(input, BTN_0, (data[6] & 0x01)); | 575 | input_report_key(input, BTN_0, (data[6] & 0x01)); |
551 | input_report_key(input, BTN_1, (data[6] & 0x02)); | 576 | input_report_key(input, BTN_1, (data[6] & 0x02)); |
@@ -590,10 +615,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
590 | } | 615 | } |
591 | 616 | ||
592 | if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | data[6] | data[8]) { | 617 | if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | data[6] | data[8]) { |
593 | input_report_key(input, wacom->tool[1], 1); | ||
594 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | 618 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
595 | } else { | 619 | } else { |
596 | input_report_key(input, wacom->tool[1], 0); | ||
597 | input_report_abs(input, ABS_MISC, 0); | 620 | input_report_abs(input, ABS_MISC, 0); |
598 | } | 621 | } |
599 | } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) { | 622 | } else if (features->type >= INTUOS5S && features->type <= INTUOS5L) { |
@@ -618,10 +641,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
618 | } | 641 | } |
619 | 642 | ||
620 | if (data[2] | (data[3] & 0x01) | data[4] | data[5]) { | 643 | if (data[2] | (data[3] & 0x01) | data[4] | data[5]) { |
621 | input_report_key(input, wacom->tool[1], 1); | ||
622 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | 644 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
623 | } else { | 645 | } else { |
624 | input_report_key(input, wacom->tool[1], 0); | ||
625 | input_report_abs(input, ABS_MISC, 0); | 646 | input_report_abs(input, ABS_MISC, 0); |
626 | } | 647 | } |
627 | } else { | 648 | } else { |
@@ -668,10 +689,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
668 | if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) | | 689 | if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) | |
669 | data[2] | (data[3] & 0x1f) | data[4] | data[8] | | 690 | data[2] | (data[3] & 0x1f) | data[4] | data[8] | |
670 | (data[7] & 0x01)) { | 691 | (data[7] & 0x01)) { |
671 | input_report_key(input, wacom->tool[1], 1); | ||
672 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | 692 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
673 | } else { | 693 | } else { |
674 | input_report_key(input, wacom->tool[1], 0); | ||
675 | input_report_abs(input, ABS_MISC, 0); | 694 | input_report_abs(input, ABS_MISC, 0); |
676 | } | 695 | } |
677 | } | 696 | } |
@@ -1301,6 +1320,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
1301 | case INTUOS4L: | 1320 | case INTUOS4L: |
1302 | case CINTIQ: | 1321 | case CINTIQ: |
1303 | case WACOM_BEE: | 1322 | case WACOM_BEE: |
1323 | case WACOM_13HD: | ||
1304 | case WACOM_21UX2: | 1324 | case WACOM_21UX2: |
1305 | case WACOM_22HD: | 1325 | case WACOM_22HD: |
1306 | case WACOM_24HD: | 1326 | case WACOM_24HD: |
@@ -1530,15 +1550,15 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1530 | __set_bit(KEY_PROG1, input_dev->keybit); | 1550 | __set_bit(KEY_PROG1, input_dev->keybit); |
1531 | __set_bit(KEY_PROG2, input_dev->keybit); | 1551 | __set_bit(KEY_PROG2, input_dev->keybit); |
1532 | __set_bit(KEY_PROG3, input_dev->keybit); | 1552 | __set_bit(KEY_PROG3, input_dev->keybit); |
1553 | |||
1554 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | ||
1555 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); | ||
1533 | /* fall through */ | 1556 | /* fall through */ |
1534 | 1557 | ||
1535 | case DTK: | 1558 | case DTK: |
1536 | for (i = 0; i < 6; i++) | 1559 | for (i = 0; i < 6; i++) |
1537 | __set_bit(BTN_0 + i, input_dev->keybit); | 1560 | __set_bit(BTN_0 + i, input_dev->keybit); |
1538 | 1561 | ||
1539 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | ||
1540 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); | ||
1541 | |||
1542 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | 1562 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
1543 | 1563 | ||
1544 | wacom_setup_cintiq(wacom_wac); | 1564 | wacom_setup_cintiq(wacom_wac); |
@@ -1579,6 +1599,15 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1579 | wacom_setup_cintiq(wacom_wac); | 1599 | wacom_setup_cintiq(wacom_wac); |
1580 | break; | 1600 | break; |
1581 | 1601 | ||
1602 | case WACOM_13HD: | ||
1603 | for (i = 0; i < 9; i++) | ||
1604 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
1605 | |||
1606 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | ||
1607 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | ||
1608 | wacom_setup_cintiq(wacom_wac); | ||
1609 | break; | ||
1610 | |||
1582 | case INTUOS3: | 1611 | case INTUOS3: |
1583 | case INTUOS3L: | 1612 | case INTUOS3L: |
1584 | __set_bit(BTN_4, input_dev->keybit); | 1613 | __set_bit(BTN_4, input_dev->keybit); |
@@ -1937,7 +1966,8 @@ static const struct wacom_features wacom_features_0xF4 = | |||
1937 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1966 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
1938 | static const struct wacom_features wacom_features_0xF8 = | 1967 | static const struct wacom_features wacom_features_0xF8 = |
1939 | { "Wacom Cintiq 24HD touch", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, /* Pen */ | 1968 | { "Wacom Cintiq 24HD touch", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, /* Pen */ |
1940 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; | 1969 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, |
1970 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; | ||
1941 | static const struct wacom_features wacom_features_0xF6 = | 1971 | static const struct wacom_features wacom_features_0xF6 = |
1942 | { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ | 1972 | { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ |
1943 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10 }; | 1973 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10 }; |
@@ -1950,6 +1980,9 @@ static const struct wacom_features wacom_features_0xC5 = | |||
1950 | static const struct wacom_features wacom_features_0xC6 = | 1980 | static const struct wacom_features wacom_features_0xC6 = |
1951 | { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, | 1981 | { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, |
1952 | 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1982 | 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
1983 | static const struct wacom_features wacom_features_0x304 = | ||
1984 | { "Wacom Cintiq 13HD", WACOM_PKGLEN_INTUOS, 59552, 33848, 1023, | ||
1985 | 63, WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | ||
1953 | static const struct wacom_features wacom_features_0xC7 = | 1986 | static const struct wacom_features wacom_features_0xC7 = |
1954 | { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, | 1987 | { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, |
1955 | 0, PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 1988 | 0, PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
@@ -1959,6 +1992,9 @@ static const struct wacom_features wacom_features_0xCE = | |||
1959 | static const struct wacom_features wacom_features_0xF0 = | 1992 | static const struct wacom_features wacom_features_0xF0 = |
1960 | { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, | 1993 | { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, |
1961 | 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 1994 | 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
1995 | static const struct wacom_features wacom_features_0x57 = | ||
1996 | { "Wacom DTK2241", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, | ||
1997 | 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES}; | ||
1962 | static const struct wacom_features wacom_features_0x59 = /* Pen */ | 1998 | static const struct wacom_features wacom_features_0x59 = /* Pen */ |
1963 | { "Wacom DTH2242", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, | 1999 | { "Wacom DTH2242", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, |
1964 | 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, | 2000 | 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, |
@@ -1972,6 +2008,13 @@ static const struct wacom_features wacom_features_0xCC = | |||
1972 | static const struct wacom_features wacom_features_0xFA = | 2008 | static const struct wacom_features wacom_features_0xFA = |
1973 | { "Wacom Cintiq 22HD", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, | 2009 | { "Wacom Cintiq 22HD", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, |
1974 | 63, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2010 | 63, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
2011 | static const struct wacom_features wacom_features_0x5B = | ||
2012 | { "Wacom Cintiq 22HDT", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, | ||
2013 | 63, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, | ||
2014 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e }; | ||
2015 | static const struct wacom_features wacom_features_0x5E = | ||
2016 | { "Wacom Cintiq 22HDT", .type = WACOM_24HDT, | ||
2017 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10 }; | ||
1975 | static const struct wacom_features wacom_features_0x90 = | 2018 | static const struct wacom_features wacom_features_0x90 = |
1976 | { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | 2019 | { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, |
1977 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2020 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
@@ -2001,7 +2044,7 @@ static const struct wacom_features wacom_features_0xE5 = | |||
2001 | static const struct wacom_features wacom_features_0xE6 = | 2044 | static const struct wacom_features wacom_features_0xE6 = |
2002 | { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255, | 2045 | { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255, |
2003 | 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2046 | 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
2004 | .touch_max = 2 }; | 2047 | .touch_max = 2 }; |
2005 | static const struct wacom_features wacom_features_0xEC = | 2048 | static const struct wacom_features wacom_features_0xEC = |
2006 | { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, | 2049 | { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, |
2007 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2050 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
@@ -2143,8 +2186,11 @@ const struct usb_device_id wacom_ids[] = { | |||
2143 | { USB_DEVICE_WACOM(0x43) }, | 2186 | { USB_DEVICE_WACOM(0x43) }, |
2144 | { USB_DEVICE_WACOM(0x44) }, | 2187 | { USB_DEVICE_WACOM(0x44) }, |
2145 | { USB_DEVICE_WACOM(0x45) }, | 2188 | { USB_DEVICE_WACOM(0x45) }, |
2189 | { USB_DEVICE_WACOM(0x57) }, | ||
2146 | { USB_DEVICE_WACOM(0x59) }, | 2190 | { USB_DEVICE_WACOM(0x59) }, |
2147 | { USB_DEVICE_DETAILED(0x5D, USB_CLASS_HID, 0, 0) }, | 2191 | { USB_DEVICE_DETAILED(0x5D, USB_CLASS_HID, 0, 0) }, |
2192 | { USB_DEVICE_WACOM(0x5B) }, | ||
2193 | { USB_DEVICE_DETAILED(0x5E, USB_CLASS_HID, 0, 0) }, | ||
2148 | { USB_DEVICE_WACOM(0xB0) }, | 2194 | { USB_DEVICE_WACOM(0xB0) }, |
2149 | { USB_DEVICE_WACOM(0xB1) }, | 2195 | { USB_DEVICE_WACOM(0xB1) }, |
2150 | { USB_DEVICE_WACOM(0xB2) }, | 2196 | { USB_DEVICE_WACOM(0xB2) }, |
@@ -2205,6 +2251,7 @@ const struct usb_device_id wacom_ids[] = { | |||
2205 | { USB_DEVICE_WACOM(0x100) }, | 2251 | { USB_DEVICE_WACOM(0x100) }, |
2206 | { USB_DEVICE_WACOM(0x101) }, | 2252 | { USB_DEVICE_WACOM(0x101) }, |
2207 | { USB_DEVICE_WACOM(0x10D) }, | 2253 | { USB_DEVICE_WACOM(0x10D) }, |
2254 | { USB_DEVICE_WACOM(0x304) }, | ||
2208 | { USB_DEVICE_WACOM(0x4001) }, | 2255 | { USB_DEVICE_WACOM(0x4001) }, |
2209 | { USB_DEVICE_WACOM(0x47) }, | 2256 | { USB_DEVICE_WACOM(0x47) }, |
2210 | { USB_DEVICE_WACOM(0xF4) }, | 2257 | { USB_DEVICE_WACOM(0xF4) }, |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 5f9a7721e16c..dfc9e08e7f70 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -82,6 +82,7 @@ enum { | |||
82 | WACOM_24HD, | 82 | WACOM_24HD, |
83 | CINTIQ, | 83 | CINTIQ, |
84 | WACOM_BEE, | 84 | WACOM_BEE, |
85 | WACOM_13HD, | ||
85 | WACOM_MO, | 86 | WACOM_MO, |
86 | WIRELESS, | 87 | WIRELESS, |
87 | BAMBOO_PT, | 88 | BAMBOO_PT, |
diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c index 17c9097f3b5d..39f3df8670c3 100644 --- a/drivers/input/touchscreen/egalax_ts.c +++ b/drivers/input/touchscreen/egalax_ts.c | |||
@@ -216,7 +216,7 @@ static int egalax_ts_probe(struct i2c_client *client, | |||
216 | input_set_abs_params(input_dev, | 216 | input_set_abs_params(input_dev, |
217 | ABS_MT_POSITION_X, 0, EGALAX_MAX_X, 0, 0); | 217 | ABS_MT_POSITION_X, 0, EGALAX_MAX_X, 0, 0); |
218 | input_set_abs_params(input_dev, | 218 | input_set_abs_params(input_dev, |
219 | ABS_MT_POSITION_X, 0, EGALAX_MAX_Y, 0, 0); | 219 | ABS_MT_POSITION_Y, 0, EGALAX_MAX_Y, 0, 0); |
220 | input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS, 0); | 220 | input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS, 0); |
221 | 221 | ||
222 | input_set_drvdata(input_dev, ts); | 222 | input_set_drvdata(input_dev, ts); |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 1760ceb68b7b..19ceaa60e0f4 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -705,7 +705,7 @@ static int gic_irq_domain_xlate(struct irq_domain *d, | |||
705 | static int __cpuinit gic_secondary_init(struct notifier_block *nfb, | 705 | static int __cpuinit gic_secondary_init(struct notifier_block *nfb, |
706 | unsigned long action, void *hcpu) | 706 | unsigned long action, void *hcpu) |
707 | { | 707 | { |
708 | if (action == CPU_STARTING) | 708 | if (action == CPU_STARTING || action == CPU_STARTING_FROZEN) |
709 | gic_cpu_init(&gic_data[0]); | 709 | gic_cpu_init(&gic_data[0]); |
710 | return NOTIFY_OK; | 710 | return NOTIFY_OK; |
711 | } | 711 | } |
diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c index 29889bbdcc6d..63b3d4eb0ef7 100644 --- a/drivers/irqchip/irq-mxs.c +++ b/drivers/irqchip/irq-mxs.c | |||
@@ -76,16 +76,10 @@ asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs) | |||
76 | { | 76 | { |
77 | u32 irqnr; | 77 | u32 irqnr; |
78 | 78 | ||
79 | do { | 79 | irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET); |
80 | irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET); | 80 | __raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR); |
81 | if (irqnr != 0x7f) { | 81 | irqnr = irq_find_mapping(icoll_domain, irqnr); |
82 | __raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR); | 82 | handle_IRQ(irqnr, regs); |
83 | irqnr = irq_find_mapping(icoll_domain, irqnr); | ||
84 | handle_IRQ(irqnr, regs); | ||
85 | continue; | ||
86 | } | ||
87 | break; | ||
88 | } while (1); | ||
89 | } | 83 | } |
90 | 84 | ||
91 | static int icoll_irq_domain_map(struct irq_domain *d, unsigned int virq, | 85 | static int icoll_irq_domain_map(struct irq_domain *d, unsigned int virq, |
diff --git a/drivers/irqchip/irq-versatile-fpga.c b/drivers/irqchip/irq-versatile-fpga.c index 065b7a31a478..47a52ab580d8 100644 --- a/drivers/irqchip/irq-versatile-fpga.c +++ b/drivers/irqchip/irq-versatile-fpga.c | |||
@@ -119,7 +119,7 @@ static int fpga_irqdomain_map(struct irq_domain *d, unsigned int irq, | |||
119 | 119 | ||
120 | /* Skip invalid IRQs, only register handlers for the real ones */ | 120 | /* Skip invalid IRQs, only register handlers for the real ones */ |
121 | if (!(f->valid & BIT(hwirq))) | 121 | if (!(f->valid & BIT(hwirq))) |
122 | return -ENOTSUPP; | 122 | return -EPERM; |
123 | irq_set_chip_data(irq, f); | 123 | irq_set_chip_data(irq, f); |
124 | irq_set_chip_and_handler(irq, &f->chip, | 124 | irq_set_chip_and_handler(irq, &f->chip, |
125 | handle_level_irq); | 125 | handle_level_irq); |
diff --git a/drivers/irqchip/irq-vic.c b/drivers/irqchip/irq-vic.c index 884d11c7355f..2bbb00404cf5 100644 --- a/drivers/irqchip/irq-vic.c +++ b/drivers/irqchip/irq-vic.c | |||
@@ -197,7 +197,7 @@ static int vic_irqdomain_map(struct irq_domain *d, unsigned int irq, | |||
197 | 197 | ||
198 | /* Skip invalid IRQs, only register handlers for the real ones */ | 198 | /* Skip invalid IRQs, only register handlers for the real ones */ |
199 | if (!(v->valid_sources & (1 << hwirq))) | 199 | if (!(v->valid_sources & (1 << hwirq))) |
200 | return -ENOTSUPP; | 200 | return -EPERM; |
201 | irq_set_chip_and_handler(irq, &vic_chip, handle_level_irq); | 201 | irq_set_chip_and_handler(irq, &vic_chip, handle_level_irq); |
202 | irq_set_chip_data(irq, v->base); | 202 | irq_set_chip_data(irq, v->base); |
203 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | 203 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); |
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c index 9b1b274c7d25..c123709acf82 100644 --- a/drivers/isdn/capi/kcapi.c +++ b/drivers/isdn/capi/kcapi.c | |||
@@ -93,7 +93,7 @@ capi_ctr_put(struct capi_ctr *ctr) | |||
93 | 93 | ||
94 | static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr) | 94 | static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr) |
95 | { | 95 | { |
96 | if (contr - 1 >= CAPI_MAXCONTR) | 96 | if (contr < 1 || contr - 1 >= CAPI_MAXCONTR) |
97 | return NULL; | 97 | return NULL; |
98 | 98 | ||
99 | return capi_controller[contr - 1]; | 99 | return capi_controller[contr - 1]; |
@@ -103,7 +103,7 @@ static inline struct capi20_appl *__get_capi_appl_by_nr(u16 applid) | |||
103 | { | 103 | { |
104 | lockdep_assert_held(&capi_controller_lock); | 104 | lockdep_assert_held(&capi_controller_lock); |
105 | 105 | ||
106 | if (applid - 1 >= CAPI_MAXAPPL) | 106 | if (applid < 1 || applid - 1 >= CAPI_MAXAPPL) |
107 | return NULL; | 107 | return NULL; |
108 | 108 | ||
109 | return capi_applications[applid - 1]; | 109 | return capi_applications[applid - 1]; |
@@ -111,7 +111,7 @@ static inline struct capi20_appl *__get_capi_appl_by_nr(u16 applid) | |||
111 | 111 | ||
112 | static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid) | 112 | static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid) |
113 | { | 113 | { |
114 | if (applid - 1 >= CAPI_MAXAPPL) | 114 | if (applid < 1 || applid - 1 >= CAPI_MAXAPPL) |
115 | return NULL; | 115 | return NULL; |
116 | 116 | ||
117 | return rcu_dereference(capi_applications[applid - 1]); | 117 | return rcu_dereference(capi_applications[applid - 1]); |
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index a0d931bcb37c..b02b679abf31 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
@@ -107,6 +107,10 @@ static int create_gpio_led(const struct gpio_led *template, | |||
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | ret = devm_gpio_request(parent, template->gpio, template->name); | ||
111 | if (ret < 0) | ||
112 | return ret; | ||
113 | |||
110 | led_dat->cdev.name = template->name; | 114 | led_dat->cdev.name = template->name; |
111 | led_dat->cdev.default_trigger = template->default_trigger; | 115 | led_dat->cdev.default_trigger = template->default_trigger; |
112 | led_dat->gpio = template->gpio; | 116 | led_dat->gpio = template->gpio; |
@@ -126,10 +130,7 @@ static int create_gpio_led(const struct gpio_led *template, | |||
126 | if (!template->retain_state_suspended) | 130 | if (!template->retain_state_suspended) |
127 | led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; | 131 | led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; |
128 | 132 | ||
129 | ret = devm_gpio_request_one(parent, template->gpio, | 133 | ret = gpio_direction_output(led_dat->gpio, led_dat->active_low ^ state); |
130 | (led_dat->active_low ^ state) ? | ||
131 | GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW, | ||
132 | template->name); | ||
133 | if (ret < 0) | 134 | if (ret < 0) |
134 | return ret; | 135 | return ret; |
135 | 136 | ||
diff --git a/drivers/leds/leds-ot200.c b/drivers/leds/leds-ot200.c index ee14662ed5ce..98cae529373f 100644 --- a/drivers/leds/leds-ot200.c +++ b/drivers/leds/leds-ot200.c | |||
@@ -47,37 +47,37 @@ static struct ot200_led leds[] = { | |||
47 | { | 47 | { |
48 | .name = "led_1", | 48 | .name = "led_1", |
49 | .port = 0x49, | 49 | .port = 0x49, |
50 | .mask = BIT(7), | 50 | .mask = BIT(6), |
51 | }, | 51 | }, |
52 | { | 52 | { |
53 | .name = "led_2", | 53 | .name = "led_2", |
54 | .port = 0x49, | 54 | .port = 0x49, |
55 | .mask = BIT(6), | 55 | .mask = BIT(5), |
56 | }, | 56 | }, |
57 | { | 57 | { |
58 | .name = "led_3", | 58 | .name = "led_3", |
59 | .port = 0x49, | 59 | .port = 0x49, |
60 | .mask = BIT(5), | 60 | .mask = BIT(4), |
61 | }, | 61 | }, |
62 | { | 62 | { |
63 | .name = "led_4", | 63 | .name = "led_4", |
64 | .port = 0x49, | 64 | .port = 0x49, |
65 | .mask = BIT(4), | 65 | .mask = BIT(3), |
66 | }, | 66 | }, |
67 | { | 67 | { |
68 | .name = "led_5", | 68 | .name = "led_5", |
69 | .port = 0x49, | 69 | .port = 0x49, |
70 | .mask = BIT(3), | 70 | .mask = BIT(2), |
71 | }, | 71 | }, |
72 | { | 72 | { |
73 | .name = "led_6", | 73 | .name = "led_6", |
74 | .port = 0x49, | 74 | .port = 0x49, |
75 | .mask = BIT(2), | 75 | .mask = BIT(1), |
76 | }, | 76 | }, |
77 | { | 77 | { |
78 | .name = "led_7", | 78 | .name = "led_7", |
79 | .port = 0x49, | 79 | .port = 0x49, |
80 | .mask = BIT(1), | 80 | .mask = BIT(0), |
81 | } | 81 | } |
82 | }; | 82 | }; |
83 | 83 | ||
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index 699187ab3800..5b9ac32801c7 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -1002,6 +1002,7 @@ void guest_set_pgd(struct lguest *lg, unsigned long gpgdir, u32 idx) | |||
1002 | kill_guest(&lg->cpus[0], | 1002 | kill_guest(&lg->cpus[0], |
1003 | "Cannot populate switcher mapping"); | 1003 | "Cannot populate switcher mapping"); |
1004 | } | 1004 | } |
1005 | lg->pgdirs[pgdir].last_host_cpu = -1; | ||
1005 | } | 1006 | } |
1006 | } | 1007 | } |
1007 | 1008 | ||
diff --git a/drivers/md/bcache/Kconfig b/drivers/md/bcache/Kconfig index 05c220d05e23..f950c9d29f3e 100644 --- a/drivers/md/bcache/Kconfig +++ b/drivers/md/bcache/Kconfig | |||
@@ -1,7 +1,6 @@ | |||
1 | 1 | ||
2 | config BCACHE | 2 | config BCACHE |
3 | tristate "Block device as cache" | 3 | tristate "Block device as cache" |
4 | select CLOSURES | ||
5 | ---help--- | 4 | ---help--- |
6 | Allows a block device to be used as cache for other devices; uses | 5 | Allows a block device to be used as cache for other devices; uses |
7 | a btree for indexing and the layout is optimized for SSDs. | 6 | a btree for indexing and the layout is optimized for SSDs. |
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 340146d7c17f..d3e15b42a4ab 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h | |||
@@ -1241,7 +1241,7 @@ void bch_cache_set_stop(struct cache_set *); | |||
1241 | struct cache_set *bch_cache_set_alloc(struct cache_sb *); | 1241 | struct cache_set *bch_cache_set_alloc(struct cache_sb *); |
1242 | void bch_btree_cache_free(struct cache_set *); | 1242 | void bch_btree_cache_free(struct cache_set *); |
1243 | int bch_btree_cache_alloc(struct cache_set *); | 1243 | int bch_btree_cache_alloc(struct cache_set *); |
1244 | void bch_writeback_init_cached_dev(struct cached_dev *); | 1244 | void bch_cached_dev_writeback_init(struct cached_dev *); |
1245 | void bch_moving_init_cache_set(struct cache_set *); | 1245 | void bch_moving_init_cache_set(struct cache_set *); |
1246 | 1246 | ||
1247 | void bch_cache_allocator_exit(struct cache *ca); | 1247 | void bch_cache_allocator_exit(struct cache *ca); |
diff --git a/drivers/md/bcache/stats.c b/drivers/md/bcache/stats.c index 64e679449c2a..b8730e714d69 100644 --- a/drivers/md/bcache/stats.c +++ b/drivers/md/bcache/stats.c | |||
@@ -93,24 +93,6 @@ static struct attribute *bch_stats_files[] = { | |||
93 | }; | 93 | }; |
94 | static KTYPE(bch_stats); | 94 | static KTYPE(bch_stats); |
95 | 95 | ||
96 | static void scale_accounting(unsigned long data); | ||
97 | |||
98 | void bch_cache_accounting_init(struct cache_accounting *acc, | ||
99 | struct closure *parent) | ||
100 | { | ||
101 | kobject_init(&acc->total.kobj, &bch_stats_ktype); | ||
102 | kobject_init(&acc->five_minute.kobj, &bch_stats_ktype); | ||
103 | kobject_init(&acc->hour.kobj, &bch_stats_ktype); | ||
104 | kobject_init(&acc->day.kobj, &bch_stats_ktype); | ||
105 | |||
106 | closure_init(&acc->cl, parent); | ||
107 | init_timer(&acc->timer); | ||
108 | acc->timer.expires = jiffies + accounting_delay; | ||
109 | acc->timer.data = (unsigned long) acc; | ||
110 | acc->timer.function = scale_accounting; | ||
111 | add_timer(&acc->timer); | ||
112 | } | ||
113 | |||
114 | int bch_cache_accounting_add_kobjs(struct cache_accounting *acc, | 96 | int bch_cache_accounting_add_kobjs(struct cache_accounting *acc, |
115 | struct kobject *parent) | 97 | struct kobject *parent) |
116 | { | 98 | { |
@@ -244,3 +226,19 @@ void bch_mark_sectors_bypassed(struct search *s, int sectors) | |||
244 | atomic_add(sectors, &dc->accounting.collector.sectors_bypassed); | 226 | atomic_add(sectors, &dc->accounting.collector.sectors_bypassed); |
245 | atomic_add(sectors, &s->op.c->accounting.collector.sectors_bypassed); | 227 | atomic_add(sectors, &s->op.c->accounting.collector.sectors_bypassed); |
246 | } | 228 | } |
229 | |||
230 | void bch_cache_accounting_init(struct cache_accounting *acc, | ||
231 | struct closure *parent) | ||
232 | { | ||
233 | kobject_init(&acc->total.kobj, &bch_stats_ktype); | ||
234 | kobject_init(&acc->five_minute.kobj, &bch_stats_ktype); | ||
235 | kobject_init(&acc->hour.kobj, &bch_stats_ktype); | ||
236 | kobject_init(&acc->day.kobj, &bch_stats_ktype); | ||
237 | |||
238 | closure_init(&acc->cl, parent); | ||
239 | init_timer(&acc->timer); | ||
240 | acc->timer.expires = jiffies + accounting_delay; | ||
241 | acc->timer.data = (unsigned long) acc; | ||
242 | acc->timer.function = scale_accounting; | ||
243 | add_timer(&acc->timer); | ||
244 | } | ||
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index c8046bc4aa57..f88e2b653a3f 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c | |||
@@ -634,11 +634,10 @@ static int open_dev(struct block_device *b, fmode_t mode) | |||
634 | return 0; | 634 | return 0; |
635 | } | 635 | } |
636 | 636 | ||
637 | static int release_dev(struct gendisk *b, fmode_t mode) | 637 | static void release_dev(struct gendisk *b, fmode_t mode) |
638 | { | 638 | { |
639 | struct bcache_device *d = b->private_data; | 639 | struct bcache_device *d = b->private_data; |
640 | closure_put(&d->cl); | 640 | closure_put(&d->cl); |
641 | return 0; | ||
642 | } | 641 | } |
643 | 642 | ||
644 | static int ioctl_dev(struct block_device *b, fmode_t mode, | 643 | static int ioctl_dev(struct block_device *b, fmode_t mode, |
@@ -732,8 +731,7 @@ static void bcache_device_free(struct bcache_device *d) | |||
732 | 731 | ||
733 | if (d->c) | 732 | if (d->c) |
734 | bcache_device_detach(d); | 733 | bcache_device_detach(d); |
735 | 734 | if (d->disk && d->disk->flags & GENHD_FL_UP) | |
736 | if (d->disk) | ||
737 | del_gendisk(d->disk); | 735 | del_gendisk(d->disk); |
738 | if (d->disk && d->disk->queue) | 736 | if (d->disk && d->disk->queue) |
739 | blk_cleanup_queue(d->disk->queue); | 737 | blk_cleanup_queue(d->disk->queue); |
@@ -756,12 +754,9 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size) | |||
756 | if (!(d->bio_split = bioset_create(4, offsetof(struct bbio, bio))) || | 754 | if (!(d->bio_split = bioset_create(4, offsetof(struct bbio, bio))) || |
757 | !(d->unaligned_bvec = mempool_create_kmalloc_pool(1, | 755 | !(d->unaligned_bvec = mempool_create_kmalloc_pool(1, |
758 | sizeof(struct bio_vec) * BIO_MAX_PAGES)) || | 756 | sizeof(struct bio_vec) * BIO_MAX_PAGES)) || |
759 | bio_split_pool_init(&d->bio_split_hook)) | 757 | bio_split_pool_init(&d->bio_split_hook) || |
760 | 758 | !(d->disk = alloc_disk(1)) || | |
761 | return -ENOMEM; | 759 | !(q = blk_alloc_queue(GFP_KERNEL))) |
762 | |||
763 | d->disk = alloc_disk(1); | ||
764 | if (!d->disk) | ||
765 | return -ENOMEM; | 760 | return -ENOMEM; |
766 | 761 | ||
767 | snprintf(d->disk->disk_name, DISK_NAME_LEN, "bcache%i", bcache_minor); | 762 | snprintf(d->disk->disk_name, DISK_NAME_LEN, "bcache%i", bcache_minor); |
@@ -771,10 +766,6 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size) | |||
771 | d->disk->fops = &bcache_ops; | 766 | d->disk->fops = &bcache_ops; |
772 | d->disk->private_data = d; | 767 | d->disk->private_data = d; |
773 | 768 | ||
774 | q = blk_alloc_queue(GFP_KERNEL); | ||
775 | if (!q) | ||
776 | return -ENOMEM; | ||
777 | |||
778 | blk_queue_make_request(q, NULL); | 769 | blk_queue_make_request(q, NULL); |
779 | d->disk->queue = q; | 770 | d->disk->queue = q; |
780 | q->queuedata = d; | 771 | q->queuedata = d; |
@@ -999,14 +990,17 @@ static void cached_dev_free(struct closure *cl) | |||
999 | 990 | ||
1000 | mutex_lock(&bch_register_lock); | 991 | mutex_lock(&bch_register_lock); |
1001 | 992 | ||
1002 | bd_unlink_disk_holder(dc->bdev, dc->disk.disk); | 993 | if (atomic_read(&dc->running)) |
994 | bd_unlink_disk_holder(dc->bdev, dc->disk.disk); | ||
1003 | bcache_device_free(&dc->disk); | 995 | bcache_device_free(&dc->disk); |
1004 | list_del(&dc->list); | 996 | list_del(&dc->list); |
1005 | 997 | ||
1006 | mutex_unlock(&bch_register_lock); | 998 | mutex_unlock(&bch_register_lock); |
1007 | 999 | ||
1008 | if (!IS_ERR_OR_NULL(dc->bdev)) { | 1000 | if (!IS_ERR_OR_NULL(dc->bdev)) { |
1009 | blk_sync_queue(bdev_get_queue(dc->bdev)); | 1001 | if (dc->bdev->bd_disk) |
1002 | blk_sync_queue(bdev_get_queue(dc->bdev)); | ||
1003 | |||
1010 | blkdev_put(dc->bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); | 1004 | blkdev_put(dc->bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); |
1011 | } | 1005 | } |
1012 | 1006 | ||
@@ -1028,73 +1022,67 @@ static void cached_dev_flush(struct closure *cl) | |||
1028 | 1022 | ||
1029 | static int cached_dev_init(struct cached_dev *dc, unsigned block_size) | 1023 | static int cached_dev_init(struct cached_dev *dc, unsigned block_size) |
1030 | { | 1024 | { |
1031 | int err; | 1025 | int ret; |
1032 | struct io *io; | 1026 | struct io *io; |
1033 | 1027 | struct request_queue *q = bdev_get_queue(dc->bdev); | |
1034 | closure_init(&dc->disk.cl, NULL); | ||
1035 | set_closure_fn(&dc->disk.cl, cached_dev_flush, system_wq); | ||
1036 | 1028 | ||
1037 | __module_get(THIS_MODULE); | 1029 | __module_get(THIS_MODULE); |
1038 | INIT_LIST_HEAD(&dc->list); | 1030 | INIT_LIST_HEAD(&dc->list); |
1031 | closure_init(&dc->disk.cl, NULL); | ||
1032 | set_closure_fn(&dc->disk.cl, cached_dev_flush, system_wq); | ||
1039 | kobject_init(&dc->disk.kobj, &bch_cached_dev_ktype); | 1033 | kobject_init(&dc->disk.kobj, &bch_cached_dev_ktype); |
1040 | |||
1041 | bch_cache_accounting_init(&dc->accounting, &dc->disk.cl); | ||
1042 | |||
1043 | err = bcache_device_init(&dc->disk, block_size); | ||
1044 | if (err) | ||
1045 | goto err; | ||
1046 | |||
1047 | spin_lock_init(&dc->io_lock); | ||
1048 | closure_init_unlocked(&dc->sb_write); | ||
1049 | INIT_WORK(&dc->detach, cached_dev_detach_finish); | 1034 | INIT_WORK(&dc->detach, cached_dev_detach_finish); |
1035 | closure_init_unlocked(&dc->sb_write); | ||
1036 | INIT_LIST_HEAD(&dc->io_lru); | ||
1037 | spin_lock_init(&dc->io_lock); | ||
1038 | bch_cache_accounting_init(&dc->accounting, &dc->disk.cl); | ||
1050 | 1039 | ||
1051 | dc->sequential_merge = true; | 1040 | dc->sequential_merge = true; |
1052 | dc->sequential_cutoff = 4 << 20; | 1041 | dc->sequential_cutoff = 4 << 20; |
1053 | 1042 | ||
1054 | INIT_LIST_HEAD(&dc->io_lru); | ||
1055 | dc->sb_bio.bi_max_vecs = 1; | ||
1056 | dc->sb_bio.bi_io_vec = dc->sb_bio.bi_inline_vecs; | ||
1057 | |||
1058 | for (io = dc->io; io < dc->io + RECENT_IO; io++) { | 1043 | for (io = dc->io; io < dc->io + RECENT_IO; io++) { |
1059 | list_add(&io->lru, &dc->io_lru); | 1044 | list_add(&io->lru, &dc->io_lru); |
1060 | hlist_add_head(&io->hash, dc->io_hash + RECENT_IO); | 1045 | hlist_add_head(&io->hash, dc->io_hash + RECENT_IO); |
1061 | } | 1046 | } |
1062 | 1047 | ||
1063 | bch_writeback_init_cached_dev(dc); | 1048 | ret = bcache_device_init(&dc->disk, block_size); |
1049 | if (ret) | ||
1050 | return ret; | ||
1051 | |||
1052 | set_capacity(dc->disk.disk, | ||
1053 | dc->bdev->bd_part->nr_sects - dc->sb.data_offset); | ||
1054 | |||
1055 | dc->disk.disk->queue->backing_dev_info.ra_pages = | ||
1056 | max(dc->disk.disk->queue->backing_dev_info.ra_pages, | ||
1057 | q->backing_dev_info.ra_pages); | ||
1058 | |||
1059 | bch_cached_dev_request_init(dc); | ||
1060 | bch_cached_dev_writeback_init(dc); | ||
1064 | return 0; | 1061 | return 0; |
1065 | err: | ||
1066 | bcache_device_stop(&dc->disk); | ||
1067 | return err; | ||
1068 | } | 1062 | } |
1069 | 1063 | ||
1070 | /* Cached device - bcache superblock */ | 1064 | /* Cached device - bcache superblock */ |
1071 | 1065 | ||
1072 | static const char *register_bdev(struct cache_sb *sb, struct page *sb_page, | 1066 | static void register_bdev(struct cache_sb *sb, struct page *sb_page, |
1073 | struct block_device *bdev, | 1067 | struct block_device *bdev, |
1074 | struct cached_dev *dc) | 1068 | struct cached_dev *dc) |
1075 | { | 1069 | { |
1076 | char name[BDEVNAME_SIZE]; | 1070 | char name[BDEVNAME_SIZE]; |
1077 | const char *err = "cannot allocate memory"; | 1071 | const char *err = "cannot allocate memory"; |
1078 | struct gendisk *g; | ||
1079 | struct cache_set *c; | 1072 | struct cache_set *c; |
1080 | 1073 | ||
1081 | if (!dc || cached_dev_init(dc, sb->block_size << 9) != 0) | ||
1082 | return err; | ||
1083 | |||
1084 | memcpy(&dc->sb, sb, sizeof(struct cache_sb)); | 1074 | memcpy(&dc->sb, sb, sizeof(struct cache_sb)); |
1085 | dc->sb_bio.bi_io_vec[0].bv_page = sb_page; | ||
1086 | dc->bdev = bdev; | 1075 | dc->bdev = bdev; |
1087 | dc->bdev->bd_holder = dc; | 1076 | dc->bdev->bd_holder = dc; |
1088 | 1077 | ||
1089 | g = dc->disk.disk; | 1078 | bio_init(&dc->sb_bio); |
1090 | 1079 | dc->sb_bio.bi_max_vecs = 1; | |
1091 | set_capacity(g, dc->bdev->bd_part->nr_sects - dc->sb.data_offset); | 1080 | dc->sb_bio.bi_io_vec = dc->sb_bio.bi_inline_vecs; |
1092 | 1081 | dc->sb_bio.bi_io_vec[0].bv_page = sb_page; | |
1093 | g->queue->backing_dev_info.ra_pages = | 1082 | get_page(sb_page); |
1094 | max(g->queue->backing_dev_info.ra_pages, | ||
1095 | bdev->bd_queue->backing_dev_info.ra_pages); | ||
1096 | 1083 | ||
1097 | bch_cached_dev_request_init(dc); | 1084 | if (cached_dev_init(dc, sb->block_size << 9)) |
1085 | goto err; | ||
1098 | 1086 | ||
1099 | err = "error creating kobject"; | 1087 | err = "error creating kobject"; |
1100 | if (kobject_add(&dc->disk.kobj, &part_to_dev(bdev->bd_part)->kobj, | 1088 | if (kobject_add(&dc->disk.kobj, &part_to_dev(bdev->bd_part)->kobj, |
@@ -1103,6 +1091,8 @@ static const char *register_bdev(struct cache_sb *sb, struct page *sb_page, | |||
1103 | if (bch_cache_accounting_add_kobjs(&dc->accounting, &dc->disk.kobj)) | 1091 | if (bch_cache_accounting_add_kobjs(&dc->accounting, &dc->disk.kobj)) |
1104 | goto err; | 1092 | goto err; |
1105 | 1093 | ||
1094 | pr_info("registered backing device %s", bdevname(bdev, name)); | ||
1095 | |||
1106 | list_add(&dc->list, &uncached_devices); | 1096 | list_add(&dc->list, &uncached_devices); |
1107 | list_for_each_entry(c, &bch_cache_sets, list) | 1097 | list_for_each_entry(c, &bch_cache_sets, list) |
1108 | bch_cached_dev_attach(dc, c); | 1098 | bch_cached_dev_attach(dc, c); |
@@ -1111,15 +1101,10 @@ static const char *register_bdev(struct cache_sb *sb, struct page *sb_page, | |||
1111 | BDEV_STATE(&dc->sb) == BDEV_STATE_STALE) | 1101 | BDEV_STATE(&dc->sb) == BDEV_STATE_STALE) |
1112 | bch_cached_dev_run(dc); | 1102 | bch_cached_dev_run(dc); |
1113 | 1103 | ||
1114 | return NULL; | 1104 | return; |
1115 | err: | 1105 | err: |
1116 | kobject_put(&dc->disk.kobj); | ||
1117 | pr_notice("error opening %s: %s", bdevname(bdev, name), err); | 1106 | pr_notice("error opening %s: %s", bdevname(bdev, name), err); |
1118 | /* | 1107 | bcache_device_stop(&dc->disk); |
1119 | * Return NULL instead of an error because kobject_put() cleans | ||
1120 | * everything up | ||
1121 | */ | ||
1122 | return NULL; | ||
1123 | } | 1108 | } |
1124 | 1109 | ||
1125 | /* Flash only volumes */ | 1110 | /* Flash only volumes */ |
@@ -1717,20 +1702,11 @@ static int cache_alloc(struct cache_sb *sb, struct cache *ca) | |||
1717 | size_t free; | 1702 | size_t free; |
1718 | struct bucket *b; | 1703 | struct bucket *b; |
1719 | 1704 | ||
1720 | if (!ca) | ||
1721 | return -ENOMEM; | ||
1722 | |||
1723 | __module_get(THIS_MODULE); | 1705 | __module_get(THIS_MODULE); |
1724 | kobject_init(&ca->kobj, &bch_cache_ktype); | 1706 | kobject_init(&ca->kobj, &bch_cache_ktype); |
1725 | 1707 | ||
1726 | memcpy(&ca->sb, sb, sizeof(struct cache_sb)); | ||
1727 | |||
1728 | INIT_LIST_HEAD(&ca->discards); | 1708 | INIT_LIST_HEAD(&ca->discards); |
1729 | 1709 | ||
1730 | bio_init(&ca->sb_bio); | ||
1731 | ca->sb_bio.bi_max_vecs = 1; | ||
1732 | ca->sb_bio.bi_io_vec = ca->sb_bio.bi_inline_vecs; | ||
1733 | |||
1734 | bio_init(&ca->journal.bio); | 1710 | bio_init(&ca->journal.bio); |
1735 | ca->journal.bio.bi_max_vecs = 8; | 1711 | ca->journal.bio.bi_max_vecs = 8; |
1736 | ca->journal.bio.bi_io_vec = ca->journal.bio.bi_inline_vecs; | 1712 | ca->journal.bio.bi_io_vec = ca->journal.bio.bi_inline_vecs; |
@@ -1742,18 +1718,17 @@ static int cache_alloc(struct cache_sb *sb, struct cache *ca) | |||
1742 | !init_fifo(&ca->free_inc, free << 2, GFP_KERNEL) || | 1718 | !init_fifo(&ca->free_inc, free << 2, GFP_KERNEL) || |
1743 | !init_fifo(&ca->unused, free << 2, GFP_KERNEL) || | 1719 | !init_fifo(&ca->unused, free << 2, GFP_KERNEL) || |
1744 | !init_heap(&ca->heap, free << 3, GFP_KERNEL) || | 1720 | !init_heap(&ca->heap, free << 3, GFP_KERNEL) || |
1745 | !(ca->buckets = vmalloc(sizeof(struct bucket) * | 1721 | !(ca->buckets = vzalloc(sizeof(struct bucket) * |
1746 | ca->sb.nbuckets)) || | 1722 | ca->sb.nbuckets)) || |
1747 | !(ca->prio_buckets = kzalloc(sizeof(uint64_t) * prio_buckets(ca) * | 1723 | !(ca->prio_buckets = kzalloc(sizeof(uint64_t) * prio_buckets(ca) * |
1748 | 2, GFP_KERNEL)) || | 1724 | 2, GFP_KERNEL)) || |
1749 | !(ca->disk_buckets = alloc_bucket_pages(GFP_KERNEL, ca)) || | 1725 | !(ca->disk_buckets = alloc_bucket_pages(GFP_KERNEL, ca)) || |
1750 | !(ca->alloc_workqueue = alloc_workqueue("bch_allocator", 0, 1)) || | 1726 | !(ca->alloc_workqueue = alloc_workqueue("bch_allocator", 0, 1)) || |
1751 | bio_split_pool_init(&ca->bio_split_hook)) | 1727 | bio_split_pool_init(&ca->bio_split_hook)) |
1752 | goto err; | 1728 | return -ENOMEM; |
1753 | 1729 | ||
1754 | ca->prio_last_buckets = ca->prio_buckets + prio_buckets(ca); | 1730 | ca->prio_last_buckets = ca->prio_buckets + prio_buckets(ca); |
1755 | 1731 | ||
1756 | memset(ca->buckets, 0, ca->sb.nbuckets * sizeof(struct bucket)); | ||
1757 | for_each_bucket(b, ca) | 1732 | for_each_bucket(b, ca) |
1758 | atomic_set(&b->pin, 0); | 1733 | atomic_set(&b->pin, 0); |
1759 | 1734 | ||
@@ -1766,22 +1741,28 @@ err: | |||
1766 | return -ENOMEM; | 1741 | return -ENOMEM; |
1767 | } | 1742 | } |
1768 | 1743 | ||
1769 | static const char *register_cache(struct cache_sb *sb, struct page *sb_page, | 1744 | static void register_cache(struct cache_sb *sb, struct page *sb_page, |
1770 | struct block_device *bdev, struct cache *ca) | 1745 | struct block_device *bdev, struct cache *ca) |
1771 | { | 1746 | { |
1772 | char name[BDEVNAME_SIZE]; | 1747 | char name[BDEVNAME_SIZE]; |
1773 | const char *err = "cannot allocate memory"; | 1748 | const char *err = "cannot allocate memory"; |
1774 | 1749 | ||
1775 | if (cache_alloc(sb, ca) != 0) | 1750 | memcpy(&ca->sb, sb, sizeof(struct cache_sb)); |
1776 | return err; | ||
1777 | |||
1778 | ca->sb_bio.bi_io_vec[0].bv_page = sb_page; | ||
1779 | ca->bdev = bdev; | 1751 | ca->bdev = bdev; |
1780 | ca->bdev->bd_holder = ca; | 1752 | ca->bdev->bd_holder = ca; |
1781 | 1753 | ||
1754 | bio_init(&ca->sb_bio); | ||
1755 | ca->sb_bio.bi_max_vecs = 1; | ||
1756 | ca->sb_bio.bi_io_vec = ca->sb_bio.bi_inline_vecs; | ||
1757 | ca->sb_bio.bi_io_vec[0].bv_page = sb_page; | ||
1758 | get_page(sb_page); | ||
1759 | |||
1782 | if (blk_queue_discard(bdev_get_queue(ca->bdev))) | 1760 | if (blk_queue_discard(bdev_get_queue(ca->bdev))) |
1783 | ca->discard = CACHE_DISCARD(&ca->sb); | 1761 | ca->discard = CACHE_DISCARD(&ca->sb); |
1784 | 1762 | ||
1763 | if (cache_alloc(sb, ca) != 0) | ||
1764 | goto err; | ||
1765 | |||
1785 | err = "error creating kobject"; | 1766 | err = "error creating kobject"; |
1786 | if (kobject_add(&ca->kobj, &part_to_dev(bdev->bd_part)->kobj, "bcache")) | 1767 | if (kobject_add(&ca->kobj, &part_to_dev(bdev->bd_part)->kobj, "bcache")) |
1787 | goto err; | 1768 | goto err; |
@@ -1791,15 +1772,10 @@ static const char *register_cache(struct cache_sb *sb, struct page *sb_page, | |||
1791 | goto err; | 1772 | goto err; |
1792 | 1773 | ||
1793 | pr_info("registered cache device %s", bdevname(bdev, name)); | 1774 | pr_info("registered cache device %s", bdevname(bdev, name)); |
1794 | 1775 | return; | |
1795 | return NULL; | ||
1796 | err: | 1776 | err: |
1777 | pr_notice("error opening %s: %s", bdevname(bdev, name), err); | ||
1797 | kobject_put(&ca->kobj); | 1778 | kobject_put(&ca->kobj); |
1798 | pr_info("error opening %s: %s", bdevname(bdev, name), err); | ||
1799 | /* Return NULL instead of an error because kobject_put() cleans | ||
1800 | * everything up | ||
1801 | */ | ||
1802 | return NULL; | ||
1803 | } | 1779 | } |
1804 | 1780 | ||
1805 | /* Global interfaces/init */ | 1781 | /* Global interfaces/init */ |
@@ -1833,12 +1809,15 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, | |||
1833 | bdev = blkdev_get_by_path(strim(path), | 1809 | bdev = blkdev_get_by_path(strim(path), |
1834 | FMODE_READ|FMODE_WRITE|FMODE_EXCL, | 1810 | FMODE_READ|FMODE_WRITE|FMODE_EXCL, |
1835 | sb); | 1811 | sb); |
1836 | if (bdev == ERR_PTR(-EBUSY)) | 1812 | if (IS_ERR(bdev)) { |
1837 | err = "device busy"; | 1813 | if (bdev == ERR_PTR(-EBUSY)) |
1838 | 1814 | err = "device busy"; | |
1839 | if (IS_ERR(bdev) || | ||
1840 | set_blocksize(bdev, 4096)) | ||
1841 | goto err; | 1815 | goto err; |
1816 | } | ||
1817 | |||
1818 | err = "failed to set blocksize"; | ||
1819 | if (set_blocksize(bdev, 4096)) | ||
1820 | goto err_close; | ||
1842 | 1821 | ||
1843 | err = read_super(sb, bdev, &sb_page); | 1822 | err = read_super(sb, bdev, &sb_page); |
1844 | if (err) | 1823 | if (err) |
@@ -1846,33 +1825,33 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, | |||
1846 | 1825 | ||
1847 | if (SB_IS_BDEV(sb)) { | 1826 | if (SB_IS_BDEV(sb)) { |
1848 | struct cached_dev *dc = kzalloc(sizeof(*dc), GFP_KERNEL); | 1827 | struct cached_dev *dc = kzalloc(sizeof(*dc), GFP_KERNEL); |
1828 | if (!dc) | ||
1829 | goto err_close; | ||
1849 | 1830 | ||
1850 | err = register_bdev(sb, sb_page, bdev, dc); | 1831 | register_bdev(sb, sb_page, bdev, dc); |
1851 | } else { | 1832 | } else { |
1852 | struct cache *ca = kzalloc(sizeof(*ca), GFP_KERNEL); | 1833 | struct cache *ca = kzalloc(sizeof(*ca), GFP_KERNEL); |
1834 | if (!ca) | ||
1835 | goto err_close; | ||
1853 | 1836 | ||
1854 | err = register_cache(sb, sb_page, bdev, ca); | 1837 | register_cache(sb, sb_page, bdev, ca); |
1855 | } | 1838 | } |
1856 | 1839 | out: | |
1857 | if (err) { | 1840 | if (sb_page) |
1858 | /* register_(bdev|cache) will only return an error if they | ||
1859 | * didn't get far enough to create the kobject - if they did, | ||
1860 | * the kobject destructor will do this cleanup. | ||
1861 | */ | ||
1862 | put_page(sb_page); | 1841 | put_page(sb_page); |
1863 | err_close: | ||
1864 | blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); | ||
1865 | err: | ||
1866 | if (attr != &ksysfs_register_quiet) | ||
1867 | pr_info("error opening %s: %s", path, err); | ||
1868 | ret = -EINVAL; | ||
1869 | } | ||
1870 | |||
1871 | kfree(sb); | 1842 | kfree(sb); |
1872 | kfree(path); | 1843 | kfree(path); |
1873 | mutex_unlock(&bch_register_lock); | 1844 | mutex_unlock(&bch_register_lock); |
1874 | module_put(THIS_MODULE); | 1845 | module_put(THIS_MODULE); |
1875 | return ret; | 1846 | return ret; |
1847 | |||
1848 | err_close: | ||
1849 | blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); | ||
1850 | err: | ||
1851 | if (attr != &ksysfs_register_quiet) | ||
1852 | pr_info("error opening %s: %s", path, err); | ||
1853 | ret = -EINVAL; | ||
1854 | goto out; | ||
1876 | } | 1855 | } |
1877 | 1856 | ||
1878 | static int bcache_reboot(struct notifier_block *n, unsigned long code, void *x) | 1857 | static int bcache_reboot(struct notifier_block *n, unsigned long code, void *x) |
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 93e7e31a4bd3..2714ed3991d1 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c | |||
@@ -375,7 +375,7 @@ err: | |||
375 | refill_dirty(cl); | 375 | refill_dirty(cl); |
376 | } | 376 | } |
377 | 377 | ||
378 | void bch_writeback_init_cached_dev(struct cached_dev *dc) | 378 | void bch_cached_dev_writeback_init(struct cached_dev *dc) |
379 | { | 379 | { |
380 | closure_init_unlocked(&dc->writeback); | 380 | closure_init_unlocked(&dc->writeback); |
381 | init_rwsem(&dc->writeback_lock); | 381 | init_rwsem(&dc->writeback_lock); |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 759cffc45cab..88f2f802d528 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -2188,7 +2188,7 @@ static int maybe_resize_metadata_dev(struct dm_target *ti, bool *need_commit) | |||
2188 | 2188 | ||
2189 | *need_commit = false; | 2189 | *need_commit = false; |
2190 | 2190 | ||
2191 | metadata_dev_size = get_metadata_dev_size(pool->md_dev); | 2191 | metadata_dev_size = get_metadata_dev_size_in_blocks(pool->md_dev); |
2192 | 2192 | ||
2193 | r = dm_pool_get_metadata_dev_size(pool->pmd, &sb_metadata_dev_size); | 2193 | r = dm_pool_get_metadata_dev_size(pool->pmd, &sb_metadata_dev_size); |
2194 | if (r) { | 2194 | if (r) { |
@@ -2197,7 +2197,7 @@ static int maybe_resize_metadata_dev(struct dm_target *ti, bool *need_commit) | |||
2197 | } | 2197 | } |
2198 | 2198 | ||
2199 | if (metadata_dev_size < sb_metadata_dev_size) { | 2199 | if (metadata_dev_size < sb_metadata_dev_size) { |
2200 | DMERR("metadata device (%llu sectors) too small: expected %llu", | 2200 | DMERR("metadata device (%llu blocks) too small: expected %llu", |
2201 | metadata_dev_size, sb_metadata_dev_size); | 2201 | metadata_dev_size, sb_metadata_dev_size); |
2202 | return -EINVAL; | 2202 | return -EINVAL; |
2203 | 2203 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 681d1099a2d5..9b82377a833b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5268,8 +5268,8 @@ static void md_clean(struct mddev *mddev) | |||
5268 | 5268 | ||
5269 | static void __md_stop_writes(struct mddev *mddev) | 5269 | static void __md_stop_writes(struct mddev *mddev) |
5270 | { | 5270 | { |
5271 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
5271 | if (mddev->sync_thread) { | 5272 | if (mddev->sync_thread) { |
5272 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
5273 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 5273 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
5274 | md_reap_sync_thread(mddev); | 5274 | md_reap_sync_thread(mddev); |
5275 | } | 5275 | } |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 55951182af73..6e17f8181c4b 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -417,7 +417,17 @@ static void raid1_end_write_request(struct bio *bio, int error) | |||
417 | 417 | ||
418 | r1_bio->bios[mirror] = NULL; | 418 | r1_bio->bios[mirror] = NULL; |
419 | to_put = bio; | 419 | to_put = bio; |
420 | set_bit(R1BIO_Uptodate, &r1_bio->state); | 420 | /* |
421 | * Do not set R1BIO_Uptodate if the current device is | ||
422 | * rebuilding or Faulty. This is because we cannot use | ||
423 | * such device for properly reading the data back (we could | ||
424 | * potentially use it, if the current write would have felt | ||
425 | * before rdev->recovery_offset, but for simplicity we don't | ||
426 | * check this here. | ||
427 | */ | ||
428 | if (test_bit(In_sync, &conf->mirrors[mirror].rdev->flags) && | ||
429 | !test_bit(Faulty, &conf->mirrors[mirror].rdev->flags)) | ||
430 | set_bit(R1BIO_Uptodate, &r1_bio->state); | ||
421 | 431 | ||
422 | /* Maybe we can clear some bad blocks. */ | 432 | /* Maybe we can clear some bad blocks. */ |
423 | if (is_badblock(conf->mirrors[mirror].rdev, | 433 | if (is_badblock(conf->mirrors[mirror].rdev, |
@@ -870,17 +880,17 @@ static void allow_barrier(struct r1conf *conf) | |||
870 | wake_up(&conf->wait_barrier); | 880 | wake_up(&conf->wait_barrier); |
871 | } | 881 | } |
872 | 882 | ||
873 | static void freeze_array(struct r1conf *conf) | 883 | static void freeze_array(struct r1conf *conf, int extra) |
874 | { | 884 | { |
875 | /* stop syncio and normal IO and wait for everything to | 885 | /* stop syncio and normal IO and wait for everything to |
876 | * go quite. | 886 | * go quite. |
877 | * We increment barrier and nr_waiting, and then | 887 | * We increment barrier and nr_waiting, and then |
878 | * wait until nr_pending match nr_queued+1 | 888 | * wait until nr_pending match nr_queued+extra |
879 | * This is called in the context of one normal IO request | 889 | * This is called in the context of one normal IO request |
880 | * that has failed. Thus any sync request that might be pending | 890 | * that has failed. Thus any sync request that might be pending |
881 | * will be blocked by nr_pending, and we need to wait for | 891 | * will be blocked by nr_pending, and we need to wait for |
882 | * pending IO requests to complete or be queued for re-try. | 892 | * pending IO requests to complete or be queued for re-try. |
883 | * Thus the number queued (nr_queued) plus this request (1) | 893 | * Thus the number queued (nr_queued) plus this request (extra) |
884 | * must match the number of pending IOs (nr_pending) before | 894 | * must match the number of pending IOs (nr_pending) before |
885 | * we continue. | 895 | * we continue. |
886 | */ | 896 | */ |
@@ -888,7 +898,7 @@ static void freeze_array(struct r1conf *conf) | |||
888 | conf->barrier++; | 898 | conf->barrier++; |
889 | conf->nr_waiting++; | 899 | conf->nr_waiting++; |
890 | wait_event_lock_irq_cmd(conf->wait_barrier, | 900 | wait_event_lock_irq_cmd(conf->wait_barrier, |
891 | conf->nr_pending == conf->nr_queued+1, | 901 | conf->nr_pending == conf->nr_queued+extra, |
892 | conf->resync_lock, | 902 | conf->resync_lock, |
893 | flush_pending_writes(conf)); | 903 | flush_pending_writes(conf)); |
894 | spin_unlock_irq(&conf->resync_lock); | 904 | spin_unlock_irq(&conf->resync_lock); |
@@ -1544,8 +1554,8 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
1544 | * we wait for all outstanding requests to complete. | 1554 | * we wait for all outstanding requests to complete. |
1545 | */ | 1555 | */ |
1546 | synchronize_sched(); | 1556 | synchronize_sched(); |
1547 | raise_barrier(conf); | 1557 | freeze_array(conf, 0); |
1548 | lower_barrier(conf); | 1558 | unfreeze_array(conf); |
1549 | clear_bit(Unmerged, &rdev->flags); | 1559 | clear_bit(Unmerged, &rdev->flags); |
1550 | } | 1560 | } |
1551 | md_integrity_add_rdev(rdev, mddev); | 1561 | md_integrity_add_rdev(rdev, mddev); |
@@ -1595,11 +1605,11 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
1595 | */ | 1605 | */ |
1596 | struct md_rdev *repl = | 1606 | struct md_rdev *repl = |
1597 | conf->mirrors[conf->raid_disks + number].rdev; | 1607 | conf->mirrors[conf->raid_disks + number].rdev; |
1598 | raise_barrier(conf); | 1608 | freeze_array(conf, 0); |
1599 | clear_bit(Replacement, &repl->flags); | 1609 | clear_bit(Replacement, &repl->flags); |
1600 | p->rdev = repl; | 1610 | p->rdev = repl; |
1601 | conf->mirrors[conf->raid_disks + number].rdev = NULL; | 1611 | conf->mirrors[conf->raid_disks + number].rdev = NULL; |
1602 | lower_barrier(conf); | 1612 | unfreeze_array(conf); |
1603 | clear_bit(WantReplacement, &rdev->flags); | 1613 | clear_bit(WantReplacement, &rdev->flags); |
1604 | } else | 1614 | } else |
1605 | clear_bit(WantReplacement, &rdev->flags); | 1615 | clear_bit(WantReplacement, &rdev->flags); |
@@ -2195,7 +2205,7 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio) | |||
2195 | * frozen | 2205 | * frozen |
2196 | */ | 2206 | */ |
2197 | if (mddev->ro == 0) { | 2207 | if (mddev->ro == 0) { |
2198 | freeze_array(conf); | 2208 | freeze_array(conf, 1); |
2199 | fix_read_error(conf, r1_bio->read_disk, | 2209 | fix_read_error(conf, r1_bio->read_disk, |
2200 | r1_bio->sector, r1_bio->sectors); | 2210 | r1_bio->sector, r1_bio->sectors); |
2201 | unfreeze_array(conf); | 2211 | unfreeze_array(conf); |
@@ -2780,8 +2790,8 @@ static int run(struct mddev *mddev) | |||
2780 | return PTR_ERR(conf); | 2790 | return PTR_ERR(conf); |
2781 | 2791 | ||
2782 | if (mddev->queue) | 2792 | if (mddev->queue) |
2783 | blk_queue_max_write_same_sectors(mddev->queue, | 2793 | blk_queue_max_write_same_sectors(mddev->queue, 0); |
2784 | mddev->chunk_sectors); | 2794 | |
2785 | rdev_for_each(rdev, mddev) { | 2795 | rdev_for_each(rdev, mddev) { |
2786 | if (!mddev->gendisk) | 2796 | if (!mddev->gendisk) |
2787 | continue; | 2797 | continue; |
@@ -2963,7 +2973,7 @@ static int raid1_reshape(struct mddev *mddev) | |||
2963 | return -ENOMEM; | 2973 | return -ENOMEM; |
2964 | } | 2974 | } |
2965 | 2975 | ||
2966 | raise_barrier(conf); | 2976 | freeze_array(conf, 0); |
2967 | 2977 | ||
2968 | /* ok, everything is stopped */ | 2978 | /* ok, everything is stopped */ |
2969 | oldpool = conf->r1bio_pool; | 2979 | oldpool = conf->r1bio_pool; |
@@ -2994,7 +3004,7 @@ static int raid1_reshape(struct mddev *mddev) | |||
2994 | conf->raid_disks = mddev->raid_disks = raid_disks; | 3004 | conf->raid_disks = mddev->raid_disks = raid_disks; |
2995 | mddev->delta_disks = 0; | 3005 | mddev->delta_disks = 0; |
2996 | 3006 | ||
2997 | lower_barrier(conf); | 3007 | unfreeze_array(conf); |
2998 | 3008 | ||
2999 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 3009 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
3000 | md_wakeup_thread(mddev->thread); | 3010 | md_wakeup_thread(mddev->thread); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 59d4daa5f4c7..6ddae2501b9a 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -490,7 +490,17 @@ static void raid10_end_write_request(struct bio *bio, int error) | |||
490 | sector_t first_bad; | 490 | sector_t first_bad; |
491 | int bad_sectors; | 491 | int bad_sectors; |
492 | 492 | ||
493 | set_bit(R10BIO_Uptodate, &r10_bio->state); | 493 | /* |
494 | * Do not set R10BIO_Uptodate if the current device is | ||
495 | * rebuilding or Faulty. This is because we cannot use | ||
496 | * such device for properly reading the data back (we could | ||
497 | * potentially use it, if the current write would have felt | ||
498 | * before rdev->recovery_offset, but for simplicity we don't | ||
499 | * check this here. | ||
500 | */ | ||
501 | if (test_bit(In_sync, &rdev->flags) && | ||
502 | !test_bit(Faulty, &rdev->flags)) | ||
503 | set_bit(R10BIO_Uptodate, &r10_bio->state); | ||
494 | 504 | ||
495 | /* Maybe we can clear some bad blocks. */ | 505 | /* Maybe we can clear some bad blocks. */ |
496 | if (is_badblock(rdev, | 506 | if (is_badblock(rdev, |
@@ -1055,17 +1065,17 @@ static void allow_barrier(struct r10conf *conf) | |||
1055 | wake_up(&conf->wait_barrier); | 1065 | wake_up(&conf->wait_barrier); |
1056 | } | 1066 | } |
1057 | 1067 | ||
1058 | static void freeze_array(struct r10conf *conf) | 1068 | static void freeze_array(struct r10conf *conf, int extra) |
1059 | { | 1069 | { |
1060 | /* stop syncio and normal IO and wait for everything to | 1070 | /* stop syncio and normal IO and wait for everything to |
1061 | * go quiet. | 1071 | * go quiet. |
1062 | * We increment barrier and nr_waiting, and then | 1072 | * We increment barrier and nr_waiting, and then |
1063 | * wait until nr_pending match nr_queued+1 | 1073 | * wait until nr_pending match nr_queued+extra |
1064 | * This is called in the context of one normal IO request | 1074 | * This is called in the context of one normal IO request |
1065 | * that has failed. Thus any sync request that might be pending | 1075 | * that has failed. Thus any sync request that might be pending |
1066 | * will be blocked by nr_pending, and we need to wait for | 1076 | * will be blocked by nr_pending, and we need to wait for |
1067 | * pending IO requests to complete or be queued for re-try. | 1077 | * pending IO requests to complete or be queued for re-try. |
1068 | * Thus the number queued (nr_queued) plus this request (1) | 1078 | * Thus the number queued (nr_queued) plus this request (extra) |
1069 | * must match the number of pending IOs (nr_pending) before | 1079 | * must match the number of pending IOs (nr_pending) before |
1070 | * we continue. | 1080 | * we continue. |
1071 | */ | 1081 | */ |
@@ -1073,7 +1083,7 @@ static void freeze_array(struct r10conf *conf) | |||
1073 | conf->barrier++; | 1083 | conf->barrier++; |
1074 | conf->nr_waiting++; | 1084 | conf->nr_waiting++; |
1075 | wait_event_lock_irq_cmd(conf->wait_barrier, | 1085 | wait_event_lock_irq_cmd(conf->wait_barrier, |
1076 | conf->nr_pending == conf->nr_queued+1, | 1086 | conf->nr_pending == conf->nr_queued+extra, |
1077 | conf->resync_lock, | 1087 | conf->resync_lock, |
1078 | flush_pending_writes(conf)); | 1088 | flush_pending_writes(conf)); |
1079 | 1089 | ||
@@ -1837,8 +1847,8 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
1837 | * we wait for all outstanding requests to complete. | 1847 | * we wait for all outstanding requests to complete. |
1838 | */ | 1848 | */ |
1839 | synchronize_sched(); | 1849 | synchronize_sched(); |
1840 | raise_barrier(conf, 0); | 1850 | freeze_array(conf, 0); |
1841 | lower_barrier(conf); | 1851 | unfreeze_array(conf); |
1842 | clear_bit(Unmerged, &rdev->flags); | 1852 | clear_bit(Unmerged, &rdev->flags); |
1843 | } | 1853 | } |
1844 | md_integrity_add_rdev(rdev, mddev); | 1854 | md_integrity_add_rdev(rdev, mddev); |
@@ -2612,7 +2622,7 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio) | |||
2612 | r10_bio->devs[slot].bio = NULL; | 2622 | r10_bio->devs[slot].bio = NULL; |
2613 | 2623 | ||
2614 | if (mddev->ro == 0) { | 2624 | if (mddev->ro == 0) { |
2615 | freeze_array(conf); | 2625 | freeze_array(conf, 1); |
2616 | fix_read_error(conf, mddev, r10_bio); | 2626 | fix_read_error(conf, mddev, r10_bio); |
2617 | unfreeze_array(conf); | 2627 | unfreeze_array(conf); |
2618 | } else | 2628 | } else |
@@ -3609,8 +3619,7 @@ static int run(struct mddev *mddev) | |||
3609 | if (mddev->queue) { | 3619 | if (mddev->queue) { |
3610 | blk_queue_max_discard_sectors(mddev->queue, | 3620 | blk_queue_max_discard_sectors(mddev->queue, |
3611 | mddev->chunk_sectors); | 3621 | mddev->chunk_sectors); |
3612 | blk_queue_max_write_same_sectors(mddev->queue, | 3622 | blk_queue_max_write_same_sectors(mddev->queue, 0); |
3613 | mddev->chunk_sectors); | ||
3614 | blk_queue_io_min(mddev->queue, chunk_size); | 3623 | blk_queue_io_min(mddev->queue, chunk_size); |
3615 | if (conf->geo.raid_disks % conf->geo.near_copies) | 3624 | if (conf->geo.raid_disks % conf->geo.near_copies) |
3616 | blk_queue_io_opt(mddev->queue, chunk_size * conf->geo.raid_disks); | 3625 | blk_queue_io_opt(mddev->queue, chunk_size * conf->geo.raid_disks); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 9359828ffe26..05e4a105b9c7 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -664,6 +664,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
664 | if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) | 664 | if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) |
665 | bi->bi_rw |= REQ_FLUSH; | 665 | bi->bi_rw |= REQ_FLUSH; |
666 | 666 | ||
667 | bi->bi_vcnt = 1; | ||
667 | bi->bi_io_vec[0].bv_len = STRIPE_SIZE; | 668 | bi->bi_io_vec[0].bv_len = STRIPE_SIZE; |
668 | bi->bi_io_vec[0].bv_offset = 0; | 669 | bi->bi_io_vec[0].bv_offset = 0; |
669 | bi->bi_size = STRIPE_SIZE; | 670 | bi->bi_size = STRIPE_SIZE; |
@@ -701,6 +702,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
701 | else | 702 | else |
702 | rbi->bi_sector = (sh->sector | 703 | rbi->bi_sector = (sh->sector |
703 | + rrdev->data_offset); | 704 | + rrdev->data_offset); |
705 | rbi->bi_vcnt = 1; | ||
704 | rbi->bi_io_vec[0].bv_len = STRIPE_SIZE; | 706 | rbi->bi_io_vec[0].bv_len = STRIPE_SIZE; |
705 | rbi->bi_io_vec[0].bv_offset = 0; | 707 | rbi->bi_io_vec[0].bv_offset = 0; |
706 | rbi->bi_size = STRIPE_SIZE; | 708 | rbi->bi_size = STRIPE_SIZE; |
@@ -5464,7 +5466,7 @@ static int run(struct mddev *mddev) | |||
5464 | if (mddev->major_version == 0 && | 5466 | if (mddev->major_version == 0 && |
5465 | mddev->minor_version > 90) | 5467 | mddev->minor_version > 90) |
5466 | rdev->recovery_offset = reshape_offset; | 5468 | rdev->recovery_offset = reshape_offset; |
5467 | 5469 | ||
5468 | if (rdev->recovery_offset < reshape_offset) { | 5470 | if (rdev->recovery_offset < reshape_offset) { |
5469 | /* We need to check old and new layout */ | 5471 | /* We need to check old and new layout */ |
5470 | if (!only_parity(rdev->raid_disk, | 5472 | if (!only_parity(rdev->raid_disk, |
@@ -5587,6 +5589,8 @@ static int run(struct mddev *mddev) | |||
5587 | */ | 5589 | */ |
5588 | mddev->queue->limits.discard_zeroes_data = 0; | 5590 | mddev->queue->limits.discard_zeroes_data = 0; |
5589 | 5591 | ||
5592 | blk_queue_max_write_same_sectors(mddev->queue, 0); | ||
5593 | |||
5590 | rdev_for_each(rdev, mddev) { | 5594 | rdev_for_each(rdev, mddev) { |
5591 | disk_stack_limits(mddev->gendisk, rdev->bdev, | 5595 | disk_stack_limits(mddev->gendisk, rdev->bdev, |
5592 | rdev->data_offset << 9); | 5596 | rdev->data_offset << 9); |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 7f5a7cac6dc7..8270388e2a0d 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -136,9 +136,9 @@ config DVB_NET | |||
136 | 136 | ||
137 | # This Kconfig option is used by both PCI and USB drivers | 137 | # This Kconfig option is used by both PCI and USB drivers |
138 | config TTPCI_EEPROM | 138 | config TTPCI_EEPROM |
139 | tristate | 139 | tristate |
140 | depends on I2C | 140 | depends on I2C |
141 | default n | 141 | default n |
142 | 142 | ||
143 | source "drivers/media/dvb-core/Kconfig" | 143 | source "drivers/media/dvb-core/Kconfig" |
144 | 144 | ||
@@ -189,6 +189,12 @@ config MEDIA_SUBDRV_AUTOSELECT | |||
189 | 189 | ||
190 | If unsure say Y. | 190 | If unsure say Y. |
191 | 191 | ||
192 | config MEDIA_ATTACH | ||
193 | bool | ||
194 | depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || MEDIA_RADIO_SUPPORT | ||
195 | depends on MODULES | ||
196 | default MODULES | ||
197 | |||
192 | source "drivers/media/i2c/Kconfig" | 198 | source "drivers/media/i2c/Kconfig" |
193 | source "drivers/media/tuners/Kconfig" | 199 | source "drivers/media/tuners/Kconfig" |
194 | source "drivers/media/dvb-frontends/Kconfig" | 200 | source "drivers/media/dvb-frontends/Kconfig" |
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c index cb52438e53ac..9eac5310942f 100644 --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c | |||
@@ -956,7 +956,7 @@ static int s5c73m3_oif_enum_frame_interval(struct v4l2_subdev *sd, | |||
956 | 956 | ||
957 | if (fie->pad != OIF_SOURCE_PAD) | 957 | if (fie->pad != OIF_SOURCE_PAD) |
958 | return -EINVAL; | 958 | return -EINVAL; |
959 | if (fie->index > ARRAY_SIZE(s5c73m3_intervals)) | 959 | if (fie->index >= ARRAY_SIZE(s5c73m3_intervals)) |
960 | return -EINVAL; | 960 | return -EINVAL; |
961 | 961 | ||
962 | mutex_lock(&state->lock); | 962 | mutex_lock(&state->lock); |
diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c index 27d62623274b..aba5b1c649e6 100644 --- a/drivers/media/pci/cx88/cx88-alsa.c +++ b/drivers/media/pci/cx88/cx88-alsa.c | |||
@@ -615,7 +615,7 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol, | |||
615 | int changed = 0; | 615 | int changed = 0; |
616 | u32 old; | 616 | u32 old; |
617 | 617 | ||
618 | if (core->board.audio_chip == V4L2_IDENT_WM8775) | 618 | if (core->sd_wm8775) |
619 | snd_cx88_wm8775_volume_put(kcontrol, value); | 619 | snd_cx88_wm8775_volume_put(kcontrol, value); |
620 | 620 | ||
621 | left = value->value.integer.value[0] & 0x3f; | 621 | left = value->value.integer.value[0] & 0x3f; |
@@ -682,8 +682,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol, | |||
682 | vol ^= bit; | 682 | vol ^= bit; |
683 | cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol); | 683 | cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol); |
684 | /* Pass mute onto any WM8775 */ | 684 | /* Pass mute onto any WM8775 */ |
685 | if ((core->board.audio_chip == V4L2_IDENT_WM8775) && | 685 | if (core->sd_wm8775 && ((1<<6) == bit)) |
686 | ((1<<6) == bit)) | ||
687 | wm8775_s_ctrl(core, V4L2_CID_AUDIO_MUTE, 0 != (vol & bit)); | 686 | wm8775_s_ctrl(core, V4L2_CID_AUDIO_MUTE, 0 != (vol & bit)); |
688 | ret = 1; | 687 | ret = 1; |
689 | } | 688 | } |
@@ -903,7 +902,7 @@ static int cx88_audio_initdev(struct pci_dev *pci, | |||
903 | goto error; | 902 | goto error; |
904 | 903 | ||
905 | /* If there's a wm8775 then add a Line-In ALC switch */ | 904 | /* If there's a wm8775 then add a Line-In ALC switch */ |
906 | if (core->board.audio_chip == V4L2_IDENT_WM8775) | 905 | if (core->sd_wm8775) |
907 | snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, chip)); | 906 | snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, chip)); |
908 | 907 | ||
909 | strcpy (card->driver, "CX88x"); | 908 | strcpy (card->driver, "CX88x"); |
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index 1b00615fd395..c7a9be1065c0 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c | |||
@@ -385,8 +385,7 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input) | |||
385 | /* The wm8775 module has the "2" route hardwired into | 385 | /* The wm8775 module has the "2" route hardwired into |
386 | the initialization. Some boards may use different | 386 | the initialization. Some boards may use different |
387 | routes for different inputs. HVR-1300 surely does */ | 387 | routes for different inputs. HVR-1300 surely does */ |
388 | if (core->board.audio_chip && | 388 | if (core->sd_wm8775) { |
389 | core->board.audio_chip == V4L2_IDENT_WM8775) { | ||
390 | call_all(core, audio, s_routing, | 389 | call_all(core, audio, s_routing, |
391 | INPUT(input).audioroute, 0, 0); | 390 | INPUT(input).audioroute, 0, 0); |
392 | } | 391 | } |
@@ -771,8 +770,7 @@ static int video_open(struct file *file) | |||
771 | cx_write(MO_GP1_IO, core->board.radio.gpio1); | 770 | cx_write(MO_GP1_IO, core->board.radio.gpio1); |
772 | cx_write(MO_GP2_IO, core->board.radio.gpio2); | 771 | cx_write(MO_GP2_IO, core->board.radio.gpio2); |
773 | if (core->board.radio.audioroute) { | 772 | if (core->board.radio.audioroute) { |
774 | if(core->board.audio_chip && | 773 | if (core->sd_wm8775) { |
775 | core->board.audio_chip == V4L2_IDENT_WM8775) { | ||
776 | call_all(core, audio, s_routing, | 774 | call_all(core, audio, s_routing, |
777 | core->board.radio.audioroute, 0, 0); | 775 | core->board.radio.audioroute, 0, 0); |
778 | } | 776 | } |
@@ -959,7 +957,7 @@ static int cx8800_s_aud_ctrl(struct v4l2_ctrl *ctrl) | |||
959 | u32 value,mask; | 957 | u32 value,mask; |
960 | 958 | ||
961 | /* Pass changes onto any WM8775 */ | 959 | /* Pass changes onto any WM8775 */ |
962 | if (core->board.audio_chip == V4L2_IDENT_WM8775) { | 960 | if (core->sd_wm8775) { |
963 | switch (ctrl->id) { | 961 | switch (ctrl->id) { |
964 | case V4L2_CID_AUDIO_MUTE: | 962 | case V4L2_CID_AUDIO_MUTE: |
965 | wm8775_s_ctrl(core, ctrl->id, ctrl->val); | 963 | wm8775_s_ctrl(core, ctrl->id, ctrl->val); |
diff --git a/drivers/media/pci/zoran/zoran.h b/drivers/media/pci/zoran/zoran.h index ca2754a3cd63..5e040085c2ff 100644 --- a/drivers/media/pci/zoran/zoran.h +++ b/drivers/media/pci/zoran/zoran.h | |||
@@ -176,7 +176,7 @@ struct zoran_fh; | |||
176 | 176 | ||
177 | struct zoran_mapping { | 177 | struct zoran_mapping { |
178 | struct zoran_fh *fh; | 178 | struct zoran_fh *fh; |
179 | int count; | 179 | atomic_t count; |
180 | }; | 180 | }; |
181 | 181 | ||
182 | struct zoran_buffer { | 182 | struct zoran_buffer { |
diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c index 1168a84a737d..d133c30c3fdc 100644 --- a/drivers/media/pci/zoran/zoran_driver.c +++ b/drivers/media/pci/zoran/zoran_driver.c | |||
@@ -2803,8 +2803,7 @@ static void | |||
2803 | zoran_vm_open (struct vm_area_struct *vma) | 2803 | zoran_vm_open (struct vm_area_struct *vma) |
2804 | { | 2804 | { |
2805 | struct zoran_mapping *map = vma->vm_private_data; | 2805 | struct zoran_mapping *map = vma->vm_private_data; |
2806 | 2806 | atomic_inc(&map->count); | |
2807 | map->count++; | ||
2808 | } | 2807 | } |
2809 | 2808 | ||
2810 | static void | 2809 | static void |
@@ -2815,7 +2814,7 @@ zoran_vm_close (struct vm_area_struct *vma) | |||
2815 | struct zoran *zr = fh->zr; | 2814 | struct zoran *zr = fh->zr; |
2816 | int i; | 2815 | int i; |
2817 | 2816 | ||
2818 | if (--map->count > 0) | 2817 | if (!atomic_dec_and_mutex_lock(&map->count, &zr->resource_lock)) |
2819 | return; | 2818 | return; |
2820 | 2819 | ||
2821 | dprintk(3, KERN_INFO "%s: %s - munmap(%s)\n", ZR_DEVNAME(zr), | 2820 | dprintk(3, KERN_INFO "%s: %s - munmap(%s)\n", ZR_DEVNAME(zr), |
@@ -2828,14 +2827,16 @@ zoran_vm_close (struct vm_area_struct *vma) | |||
2828 | kfree(map); | 2827 | kfree(map); |
2829 | 2828 | ||
2830 | /* Any buffers still mapped? */ | 2829 | /* Any buffers still mapped? */ |
2831 | for (i = 0; i < fh->buffers.num_buffers; i++) | 2830 | for (i = 0; i < fh->buffers.num_buffers; i++) { |
2832 | if (fh->buffers.buffer[i].map) | 2831 | if (fh->buffers.buffer[i].map) { |
2832 | mutex_unlock(&zr->resource_lock); | ||
2833 | return; | 2833 | return; |
2834 | } | ||
2835 | } | ||
2834 | 2836 | ||
2835 | dprintk(3, KERN_INFO "%s: %s - free %s buffers\n", ZR_DEVNAME(zr), | 2837 | dprintk(3, KERN_INFO "%s: %s - free %s buffers\n", ZR_DEVNAME(zr), |
2836 | __func__, mode_name(fh->map_mode)); | 2838 | __func__, mode_name(fh->map_mode)); |
2837 | 2839 | ||
2838 | mutex_lock(&zr->resource_lock); | ||
2839 | 2840 | ||
2840 | if (fh->map_mode == ZORAN_MAP_MODE_RAW) { | 2841 | if (fh->map_mode == ZORAN_MAP_MODE_RAW) { |
2841 | if (fh->buffers.active != ZORAN_FREE) { | 2842 | if (fh->buffers.active != ZORAN_FREE) { |
@@ -2939,7 +2940,7 @@ zoran_mmap (struct file *file, | |||
2939 | goto mmap_unlock_and_return; | 2940 | goto mmap_unlock_and_return; |
2940 | } | 2941 | } |
2941 | map->fh = fh; | 2942 | map->fh = fh; |
2942 | map->count = 1; | 2943 | atomic_set(&map->count, 1); |
2943 | 2944 | ||
2944 | vma->vm_ops = &zoran_vm_ops; | 2945 | vma->vm_ops = &zoran_vm_ops; |
2945 | vma->vm_flags |= VM_DONTEXPAND; | 2946 | vma->vm_flags |= VM_DONTEXPAND; |
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index 48b8d7af386d..9d1481a60bd9 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c | |||
@@ -576,6 +576,14 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
576 | return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf); | 576 | return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf); |
577 | } | 577 | } |
578 | 578 | ||
579 | static int vidioc_create_bufs(struct file *file, void *priv, | ||
580 | struct v4l2_create_buffers *create) | ||
581 | { | ||
582 | struct coda_ctx *ctx = fh_to_ctx(priv); | ||
583 | |||
584 | return v4l2_m2m_create_bufs(file, ctx->m2m_ctx, create); | ||
585 | } | ||
586 | |||
579 | static int vidioc_streamon(struct file *file, void *priv, | 587 | static int vidioc_streamon(struct file *file, void *priv, |
580 | enum v4l2_buf_type type) | 588 | enum v4l2_buf_type type) |
581 | { | 589 | { |
@@ -610,6 +618,7 @@ static const struct v4l2_ioctl_ops coda_ioctl_ops = { | |||
610 | 618 | ||
611 | .vidioc_qbuf = vidioc_qbuf, | 619 | .vidioc_qbuf = vidioc_qbuf, |
612 | .vidioc_dqbuf = vidioc_dqbuf, | 620 | .vidioc_dqbuf = vidioc_dqbuf, |
621 | .vidioc_create_bufs = vidioc_create_bufs, | ||
613 | 622 | ||
614 | .vidioc_streamon = vidioc_streamon, | 623 | .vidioc_streamon = vidioc_streamon, |
615 | .vidioc_streamoff = vidioc_streamoff, | 624 | .vidioc_streamoff = vidioc_streamoff, |
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 1802f11e939f..d0b375cf565f 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c | |||
@@ -916,6 +916,21 @@ static int vpbe_display_s_fmt(struct file *file, void *priv, | |||
916 | other video window */ | 916 | other video window */ |
917 | 917 | ||
918 | layer->pix_fmt = *pixfmt; | 918 | layer->pix_fmt = *pixfmt; |
919 | if (pixfmt->pixelformat == V4L2_PIX_FMT_NV12) { | ||
920 | struct vpbe_layer *otherlayer; | ||
921 | |||
922 | otherlayer = _vpbe_display_get_other_win_layer(disp_dev, layer); | ||
923 | /* if other layer is available, only | ||
924 | * claim it, do not configure it | ||
925 | */ | ||
926 | ret = osd_device->ops.request_layer(osd_device, | ||
927 | otherlayer->layer_info.id); | ||
928 | if (ret < 0) { | ||
929 | v4l2_err(&vpbe_dev->v4l2_dev, | ||
930 | "Display Manager failed to allocate layer\n"); | ||
931 | return -EBUSY; | ||
932 | } | ||
933 | } | ||
919 | 934 | ||
920 | /* Get osd layer config */ | 935 | /* Get osd layer config */ |
921 | osd_device->ops.get_layer_config(osd_device, | 936 | osd_device->ops.get_layer_config(osd_device, |
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index 8c50d3074866..93609091cb23 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c | |||
@@ -1837,7 +1837,7 @@ static int vpfe_probe(struct platform_device *pdev) | |||
1837 | if (NULL == ccdc_cfg) { | 1837 | if (NULL == ccdc_cfg) { |
1838 | v4l2_err(pdev->dev.driver, | 1838 | v4l2_err(pdev->dev.driver, |
1839 | "Memory allocation failed for ccdc_cfg\n"); | 1839 | "Memory allocation failed for ccdc_cfg\n"); |
1840 | goto probe_free_lock; | 1840 | goto probe_free_dev_mem; |
1841 | } | 1841 | } |
1842 | 1842 | ||
1843 | mutex_lock(&ccdc_lock); | 1843 | mutex_lock(&ccdc_lock); |
@@ -1991,7 +1991,6 @@ probe_out_release_irq: | |||
1991 | free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); | 1991 | free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); |
1992 | probe_free_ccdc_cfg_mem: | 1992 | probe_free_ccdc_cfg_mem: |
1993 | kfree(ccdc_cfg); | 1993 | kfree(ccdc_cfg); |
1994 | probe_free_lock: | ||
1995 | mutex_unlock(&ccdc_lock); | 1994 | mutex_unlock(&ccdc_lock); |
1996 | probe_free_dev_mem: | 1995 | probe_free_dev_mem: |
1997 | kfree(vpfe_dev); | 1996 | kfree(vpfe_dev); |
diff --git a/drivers/media/platform/exynos4-is/fimc-is-regs.c b/drivers/media/platform/exynos4-is/fimc-is-regs.c index b0ff67bc1b05..d05eaa2c8490 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-regs.c +++ b/drivers/media/platform/exynos4-is/fimc-is-regs.c | |||
@@ -174,7 +174,7 @@ int fimc_is_hw_change_mode(struct fimc_is *is) | |||
174 | HIC_CAPTURE_STILL, HIC_CAPTURE_VIDEO, | 174 | HIC_CAPTURE_STILL, HIC_CAPTURE_VIDEO, |
175 | }; | 175 | }; |
176 | 176 | ||
177 | if (WARN_ON(is->config_index > ARRAY_SIZE(cmd))) | 177 | if (WARN_ON(is->config_index >= ARRAY_SIZE(cmd))) |
178 | return -EINVAL; | 178 | return -EINVAL; |
179 | 179 | ||
180 | mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0)); | 180 | mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0)); |
diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 47c6363d04e2..0741945b79ed 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c | |||
@@ -48,7 +48,6 @@ static char *fimc_is_clocks[ISS_CLKS_MAX] = { | |||
48 | [ISS_CLK_LITE0] = "lite0", | 48 | [ISS_CLK_LITE0] = "lite0", |
49 | [ISS_CLK_LITE1] = "lite1", | 49 | [ISS_CLK_LITE1] = "lite1", |
50 | [ISS_CLK_MPLL] = "mpll", | 50 | [ISS_CLK_MPLL] = "mpll", |
51 | [ISS_CLK_SYSREG] = "sysreg", | ||
52 | [ISS_CLK_ISP] = "isp", | 51 | [ISS_CLK_ISP] = "isp", |
53 | [ISS_CLK_DRC] = "drc", | 52 | [ISS_CLK_DRC] = "drc", |
54 | [ISS_CLK_FD] = "fd", | 53 | [ISS_CLK_FD] = "fd", |
@@ -71,7 +70,6 @@ static void fimc_is_put_clocks(struct fimc_is *is) | |||
71 | for (i = 0; i < ISS_CLKS_MAX; i++) { | 70 | for (i = 0; i < ISS_CLKS_MAX; i++) { |
72 | if (IS_ERR(is->clocks[i])) | 71 | if (IS_ERR(is->clocks[i])) |
73 | continue; | 72 | continue; |
74 | clk_unprepare(is->clocks[i]); | ||
75 | clk_put(is->clocks[i]); | 73 | clk_put(is->clocks[i]); |
76 | is->clocks[i] = ERR_PTR(-EINVAL); | 74 | is->clocks[i] = ERR_PTR(-EINVAL); |
77 | } | 75 | } |
@@ -90,12 +88,6 @@ static int fimc_is_get_clocks(struct fimc_is *is) | |||
90 | ret = PTR_ERR(is->clocks[i]); | 88 | ret = PTR_ERR(is->clocks[i]); |
91 | goto err; | 89 | goto err; |
92 | } | 90 | } |
93 | ret = clk_prepare(is->clocks[i]); | ||
94 | if (ret < 0) { | ||
95 | clk_put(is->clocks[i]); | ||
96 | is->clocks[i] = ERR_PTR(-EINVAL); | ||
97 | goto err; | ||
98 | } | ||
99 | } | 91 | } |
100 | 92 | ||
101 | return 0; | 93 | return 0; |
@@ -103,7 +95,7 @@ err: | |||
103 | fimc_is_put_clocks(is); | 95 | fimc_is_put_clocks(is); |
104 | dev_err(&is->pdev->dev, "failed to get clock: %s\n", | 96 | dev_err(&is->pdev->dev, "failed to get clock: %s\n", |
105 | fimc_is_clocks[i]); | 97 | fimc_is_clocks[i]); |
106 | return -ENXIO; | 98 | return ret; |
107 | } | 99 | } |
108 | 100 | ||
109 | static int fimc_is_setup_clocks(struct fimc_is *is) | 101 | static int fimc_is_setup_clocks(struct fimc_is *is) |
@@ -144,7 +136,7 @@ int fimc_is_enable_clocks(struct fimc_is *is) | |||
144 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { | 136 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { |
145 | if (IS_ERR(is->clocks[i])) | 137 | if (IS_ERR(is->clocks[i])) |
146 | continue; | 138 | continue; |
147 | ret = clk_enable(is->clocks[i]); | 139 | ret = clk_prepare_enable(is->clocks[i]); |
148 | if (ret < 0) { | 140 | if (ret < 0) { |
149 | dev_err(&is->pdev->dev, "clock %s enable failed\n", | 141 | dev_err(&is->pdev->dev, "clock %s enable failed\n", |
150 | fimc_is_clocks[i]); | 142 | fimc_is_clocks[i]); |
@@ -163,7 +155,7 @@ void fimc_is_disable_clocks(struct fimc_is *is) | |||
163 | 155 | ||
164 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { | 156 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { |
165 | if (!IS_ERR(is->clocks[i])) { | 157 | if (!IS_ERR(is->clocks[i])) { |
166 | clk_disable(is->clocks[i]); | 158 | clk_disable_unprepare(is->clocks[i]); |
167 | pr_debug("disabled clock: %s\n", fimc_is_clocks[i]); | 159 | pr_debug("disabled clock: %s\n", fimc_is_clocks[i]); |
168 | } | 160 | } |
169 | } | 161 | } |
@@ -326,6 +318,11 @@ int fimc_is_start_firmware(struct fimc_is *is) | |||
326 | struct device *dev = &is->pdev->dev; | 318 | struct device *dev = &is->pdev->dev; |
327 | int ret; | 319 | int ret; |
328 | 320 | ||
321 | if (is->fw.f_w == NULL) { | ||
322 | dev_err(dev, "firmware is not loaded\n"); | ||
323 | return -EINVAL; | ||
324 | } | ||
325 | |||
329 | memcpy(is->memory.vaddr, is->fw.f_w->data, is->fw.f_w->size); | 326 | memcpy(is->memory.vaddr, is->fw.f_w->data, is->fw.f_w->size); |
330 | wmb(); | 327 | wmb(); |
331 | 328 | ||
@@ -837,23 +834,11 @@ static int fimc_is_probe(struct platform_device *pdev) | |||
837 | goto err_clk; | 834 | goto err_clk; |
838 | } | 835 | } |
839 | pm_runtime_enable(dev); | 836 | pm_runtime_enable(dev); |
840 | /* | ||
841 | * Enable only the ISP power domain, keep FIMC-IS clocks off until | ||
842 | * the whole clock tree is configured. The ISP power domain needs | ||
843 | * be active in order to acces any CMU_ISP clock registers. | ||
844 | */ | ||
845 | ret = pm_runtime_get_sync(dev); | ||
846 | if (ret < 0) | ||
847 | goto err_irq; | ||
848 | |||
849 | ret = fimc_is_setup_clocks(is); | ||
850 | pm_runtime_put_sync(dev); | ||
851 | 837 | ||
838 | ret = pm_runtime_get_sync(dev); | ||
852 | if (ret < 0) | 839 | if (ret < 0) |
853 | goto err_irq; | 840 | goto err_irq; |
854 | 841 | ||
855 | is->clk_init = true; | ||
856 | |||
857 | is->alloc_ctx = vb2_dma_contig_init_ctx(dev); | 842 | is->alloc_ctx = vb2_dma_contig_init_ctx(dev); |
858 | if (IS_ERR(is->alloc_ctx)) { | 843 | if (IS_ERR(is->alloc_ctx)) { |
859 | ret = PTR_ERR(is->alloc_ctx); | 844 | ret = PTR_ERR(is->alloc_ctx); |
@@ -875,6 +860,8 @@ static int fimc_is_probe(struct platform_device *pdev) | |||
875 | if (ret < 0) | 860 | if (ret < 0) |
876 | goto err_dfs; | 861 | goto err_dfs; |
877 | 862 | ||
863 | pm_runtime_put_sync(dev); | ||
864 | |||
878 | dev_dbg(dev, "FIMC-IS registered successfully\n"); | 865 | dev_dbg(dev, "FIMC-IS registered successfully\n"); |
879 | return 0; | 866 | return 0; |
880 | 867 | ||
@@ -894,9 +881,11 @@ err_clk: | |||
894 | static int fimc_is_runtime_resume(struct device *dev) | 881 | static int fimc_is_runtime_resume(struct device *dev) |
895 | { | 882 | { |
896 | struct fimc_is *is = dev_get_drvdata(dev); | 883 | struct fimc_is *is = dev_get_drvdata(dev); |
884 | int ret; | ||
897 | 885 | ||
898 | if (!is->clk_init) | 886 | ret = fimc_is_setup_clocks(is); |
899 | return 0; | 887 | if (ret) |
888 | return ret; | ||
900 | 889 | ||
901 | return fimc_is_enable_clocks(is); | 890 | return fimc_is_enable_clocks(is); |
902 | } | 891 | } |
@@ -905,9 +894,7 @@ static int fimc_is_runtime_suspend(struct device *dev) | |||
905 | { | 894 | { |
906 | struct fimc_is *is = dev_get_drvdata(dev); | 895 | struct fimc_is *is = dev_get_drvdata(dev); |
907 | 896 | ||
908 | if (is->clk_init) | 897 | fimc_is_disable_clocks(is); |
909 | fimc_is_disable_clocks(is); | ||
910 | |||
911 | return 0; | 898 | return 0; |
912 | } | 899 | } |
913 | 900 | ||
@@ -941,7 +928,8 @@ static int fimc_is_remove(struct platform_device *pdev) | |||
941 | vb2_dma_contig_cleanup_ctx(is->alloc_ctx); | 928 | vb2_dma_contig_cleanup_ctx(is->alloc_ctx); |
942 | fimc_is_put_clocks(is); | 929 | fimc_is_put_clocks(is); |
943 | fimc_is_debugfs_remove(is); | 930 | fimc_is_debugfs_remove(is); |
944 | release_firmware(is->fw.f_w); | 931 | if (is->fw.f_w) |
932 | release_firmware(is->fw.f_w); | ||
945 | fimc_is_free_cpu_memory(is); | 933 | fimc_is_free_cpu_memory(is); |
946 | 934 | ||
947 | return 0; | 935 | return 0; |
diff --git a/drivers/media/platform/exynos4-is/fimc-is.h b/drivers/media/platform/exynos4-is/fimc-is.h index f5275a5b0156..d7db133b493f 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.h +++ b/drivers/media/platform/exynos4-is/fimc-is.h | |||
@@ -73,7 +73,6 @@ enum { | |||
73 | ISS_CLK_LITE0, | 73 | ISS_CLK_LITE0, |
74 | ISS_CLK_LITE1, | 74 | ISS_CLK_LITE1, |
75 | ISS_CLK_MPLL, | 75 | ISS_CLK_MPLL, |
76 | ISS_CLK_SYSREG, | ||
77 | ISS_CLK_ISP, | 76 | ISS_CLK_ISP, |
78 | ISS_CLK_DRC, | 77 | ISS_CLK_DRC, |
79 | ISS_CLK_FD, | 78 | ISS_CLK_FD, |
@@ -265,7 +264,6 @@ struct fimc_is { | |||
265 | spinlock_t slock; | 264 | spinlock_t slock; |
266 | 265 | ||
267 | struct clk *clocks[ISS_CLKS_MAX]; | 266 | struct clk *clocks[ISS_CLKS_MAX]; |
268 | bool clk_init; | ||
269 | void __iomem *regs; | 267 | void __iomem *regs; |
270 | void __iomem *pmu_regs; | 268 | void __iomem *pmu_regs; |
271 | int irq; | 269 | int irq; |
diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c index d63947f7b302..7ede30b5910f 100644 --- a/drivers/media/platform/exynos4-is/fimc-isp.c +++ b/drivers/media/platform/exynos4-is/fimc-isp.c | |||
@@ -138,7 +138,7 @@ static int fimc_isp_subdev_get_fmt(struct v4l2_subdev *sd, | |||
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | 140 | ||
141 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 141 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
142 | 142 | ||
143 | mutex_lock(&isp->subdev_lock); | 143 | mutex_lock(&isp->subdev_lock); |
144 | __is_get_frame_size(is, &cur_fmt); | 144 | __is_get_frame_size(is, &cur_fmt); |
@@ -194,7 +194,7 @@ static int fimc_isp_subdev_set_fmt(struct v4l2_subdev *sd, | |||
194 | v4l2_dbg(1, debug, sd, "%s: pad%d: code: 0x%x, %dx%d\n", | 194 | v4l2_dbg(1, debug, sd, "%s: pad%d: code: 0x%x, %dx%d\n", |
195 | __func__, fmt->pad, mf->code, mf->width, mf->height); | 195 | __func__, fmt->pad, mf->code, mf->width, mf->height); |
196 | 196 | ||
197 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 197 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
198 | 198 | ||
199 | mutex_lock(&isp->subdev_lock); | 199 | mutex_lock(&isp->subdev_lock); |
200 | __isp_subdev_try_format(isp, fmt); | 200 | __isp_subdev_try_format(isp, fmt); |
diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c index a2eda9d5ac87..254d70fe762a 100644 --- a/drivers/media/platform/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/exynos4-is/mipi-csis.c | |||
@@ -746,7 +746,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev, | |||
746 | node = v4l2_of_get_next_endpoint(node, NULL); | 746 | node = v4l2_of_get_next_endpoint(node, NULL); |
747 | if (!node) { | 747 | if (!node) { |
748 | dev_err(&pdev->dev, "No port node at %s\n", | 748 | dev_err(&pdev->dev, "No port node at %s\n", |
749 | node->full_name); | 749 | pdev->dev.of_node->full_name); |
750 | return -EINVAL; | 750 | return -EINVAL; |
751 | } | 751 | } |
752 | /* Get port node and validate MIPI-CSI channel id. */ | 752 | /* Get port node and validate MIPI-CSI channel id. */ |
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index 477268a2415f..d338b19da544 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c | |||
@@ -2150,6 +2150,9 @@ static int __init omap_vout_probe(struct platform_device *pdev) | |||
2150 | struct omap_dss_device *def_display; | 2150 | struct omap_dss_device *def_display; |
2151 | struct omap2video_device *vid_dev = NULL; | 2151 | struct omap2video_device *vid_dev = NULL; |
2152 | 2152 | ||
2153 | if (omapdss_is_initialized() == false) | ||
2154 | return -EPROBE_DEFER; | ||
2155 | |||
2153 | ret = omapdss_compat_init(); | 2156 | ret = omapdss_compat_init(); |
2154 | if (ret) { | 2157 | if (ret) { |
2155 | dev_err(&pdev->dev, "failed to init dss\n"); | 2158 | dev_err(&pdev->dev, "failed to init dss\n"); |
diff --git a/drivers/media/platform/s3c-camif/camif-core.h b/drivers/media/platform/s3c-camif/camif-core.h index 261134baa655..35d2fcdc0036 100644 --- a/drivers/media/platform/s3c-camif/camif-core.h +++ b/drivers/media/platform/s3c-camif/camif-core.h | |||
@@ -229,7 +229,7 @@ struct camif_vp { | |||
229 | unsigned int state; | 229 | unsigned int state; |
230 | u16 fmt_flags; | 230 | u16 fmt_flags; |
231 | u8 id; | 231 | u8 id; |
232 | u8 rotation; | 232 | u16 rotation; |
233 | u8 hflip; | 233 | u8 hflip; |
234 | u8 vflip; | 234 | u8 vflip; |
235 | unsigned int offset; | 235 | unsigned int offset; |
diff --git a/drivers/media/platform/s5p-jpeg/Makefile b/drivers/media/platform/s5p-jpeg/Makefile index ddc2900d88a2..d18cb5edd2d5 100644 --- a/drivers/media/platform/s5p-jpeg/Makefile +++ b/drivers/media/platform/s5p-jpeg/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | s5p-jpeg-objs := jpeg-core.o | 1 | s5p-jpeg-objs := jpeg-core.o |
2 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) := s5p-jpeg.o | 2 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) += s5p-jpeg.o |
diff --git a/drivers/media/platform/s5p-mfc/Makefile b/drivers/media/platform/s5p-mfc/Makefile index 379008c6d09a..15f59b324fef 100644 --- a/drivers/media/platform/s5p-mfc/Makefile +++ b/drivers/media/platform/s5p-mfc/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MFC) := s5p-mfc.o | 1 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MFC) += s5p-mfc.o |
2 | s5p-mfc-y += s5p_mfc.o s5p_mfc_intr.o | 2 | s5p-mfc-y += s5p_mfc.o s5p_mfc_intr.o |
3 | s5p-mfc-y += s5p_mfc_dec.o s5p_mfc_enc.o | 3 | s5p-mfc-y += s5p_mfc_dec.o s5p_mfc_enc.o |
4 | s5p-mfc-y += s5p_mfc_ctrl.o s5p_mfc_pm.o | 4 | s5p-mfc-y += s5p_mfc_ctrl.o s5p_mfc_pm.o |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 01f9ae0dadb0..d12faa691af8 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c | |||
@@ -397,7 +397,7 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx, | |||
397 | leave_handle_frame: | 397 | leave_handle_frame: |
398 | spin_unlock_irqrestore(&dev->irqlock, flags); | 398 | spin_unlock_irqrestore(&dev->irqlock, flags); |
399 | if ((ctx->src_queue_cnt == 0 && ctx->state != MFCINST_FINISHING) | 399 | if ((ctx->src_queue_cnt == 0 && ctx->state != MFCINST_FINISHING) |
400 | || ctx->dst_queue_cnt < ctx->dpb_count) | 400 | || ctx->dst_queue_cnt < ctx->pb_count) |
401 | clear_work_bit(ctx); | 401 | clear_work_bit(ctx); |
402 | s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev); | 402 | s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev); |
403 | wake_up_ctx(ctx, reason, err); | 403 | wake_up_ctx(ctx, reason, err); |
@@ -473,7 +473,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx, | |||
473 | 473 | ||
474 | s5p_mfc_hw_call(dev->mfc_ops, dec_calc_dpb_size, ctx); | 474 | s5p_mfc_hw_call(dev->mfc_ops, dec_calc_dpb_size, ctx); |
475 | 475 | ||
476 | ctx->dpb_count = s5p_mfc_hw_call(dev->mfc_ops, get_dpb_count, | 476 | ctx->pb_count = s5p_mfc_hw_call(dev->mfc_ops, get_dpb_count, |
477 | dev); | 477 | dev); |
478 | ctx->mv_count = s5p_mfc_hw_call(dev->mfc_ops, get_mv_count, | 478 | ctx->mv_count = s5p_mfc_hw_call(dev->mfc_ops, get_mv_count, |
479 | dev); | 479 | dev); |
@@ -562,7 +562,7 @@ static void s5p_mfc_handle_stream_complete(struct s5p_mfc_ctx *ctx, | |||
562 | struct s5p_mfc_dev *dev = ctx->dev; | 562 | struct s5p_mfc_dev *dev = ctx->dev; |
563 | struct s5p_mfc_buf *mb_entry; | 563 | struct s5p_mfc_buf *mb_entry; |
564 | 564 | ||
565 | mfc_debug(2, "Stream completed"); | 565 | mfc_debug(2, "Stream completed\n"); |
566 | 566 | ||
567 | s5p_mfc_clear_int_flags(dev); | 567 | s5p_mfc_clear_int_flags(dev); |
568 | ctx->int_type = reason; | 568 | ctx->int_type = reason; |
@@ -1362,7 +1362,6 @@ static struct s5p_mfc_variant mfc_drvdata_v5 = { | |||
1362 | .port_num = MFC_NUM_PORTS, | 1362 | .port_num = MFC_NUM_PORTS, |
1363 | .buf_size = &buf_size_v5, | 1363 | .buf_size = &buf_size_v5, |
1364 | .buf_align = &mfc_buf_align_v5, | 1364 | .buf_align = &mfc_buf_align_v5, |
1365 | .mclk_name = "sclk_mfc", | ||
1366 | .fw_name = "s5p-mfc.fw", | 1365 | .fw_name = "s5p-mfc.fw", |
1367 | }; | 1366 | }; |
1368 | 1367 | ||
@@ -1389,7 +1388,6 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = { | |||
1389 | .port_num = MFC_NUM_PORTS_V6, | 1388 | .port_num = MFC_NUM_PORTS_V6, |
1390 | .buf_size = &buf_size_v6, | 1389 | .buf_size = &buf_size_v6, |
1391 | .buf_align = &mfc_buf_align_v6, | 1390 | .buf_align = &mfc_buf_align_v6, |
1392 | .mclk_name = "aclk_333", | ||
1393 | .fw_name = "s5p-mfc-v6.fw", | 1391 | .fw_name = "s5p-mfc-v6.fw", |
1394 | }; | 1392 | }; |
1395 | 1393 | ||
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 202d1d7a37a8..ef4074cd5316 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h | |||
@@ -138,6 +138,7 @@ enum s5p_mfc_inst_state { | |||
138 | MFCINST_INIT = 100, | 138 | MFCINST_INIT = 100, |
139 | MFCINST_GOT_INST, | 139 | MFCINST_GOT_INST, |
140 | MFCINST_HEAD_PARSED, | 140 | MFCINST_HEAD_PARSED, |
141 | MFCINST_HEAD_PRODUCED, | ||
141 | MFCINST_BUFS_SET, | 142 | MFCINST_BUFS_SET, |
142 | MFCINST_RUNNING, | 143 | MFCINST_RUNNING, |
143 | MFCINST_FINISHING, | 144 | MFCINST_FINISHING, |
@@ -231,7 +232,6 @@ struct s5p_mfc_variant { | |||
231 | unsigned int port_num; | 232 | unsigned int port_num; |
232 | struct s5p_mfc_buf_size *buf_size; | 233 | struct s5p_mfc_buf_size *buf_size; |
233 | struct s5p_mfc_buf_align *buf_align; | 234 | struct s5p_mfc_buf_align *buf_align; |
234 | char *mclk_name; | ||
235 | char *fw_name; | 235 | char *fw_name; |
236 | }; | 236 | }; |
237 | 237 | ||
@@ -438,7 +438,7 @@ struct s5p_mfc_enc_params { | |||
438 | u32 rc_framerate_num; | 438 | u32 rc_framerate_num; |
439 | u32 rc_framerate_denom; | 439 | u32 rc_framerate_denom; |
440 | 440 | ||
441 | union { | 441 | struct { |
442 | struct s5p_mfc_h264_enc_params h264; | 442 | struct s5p_mfc_h264_enc_params h264; |
443 | struct s5p_mfc_mpeg4_enc_params mpeg4; | 443 | struct s5p_mfc_mpeg4_enc_params mpeg4; |
444 | } codec; | 444 | } codec; |
@@ -602,7 +602,7 @@ struct s5p_mfc_ctx { | |||
602 | int after_packed_pb; | 602 | int after_packed_pb; |
603 | int sei_fp_parse; | 603 | int sei_fp_parse; |
604 | 604 | ||
605 | int dpb_count; | 605 | int pb_count; |
606 | int total_dpb_count; | 606 | int total_dpb_count; |
607 | int mv_count; | 607 | int mv_count; |
608 | /* Buffers */ | 608 | /* Buffers */ |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index 2e5f30b40dea..dc1fc94a488d 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | |||
@@ -38,7 +38,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) | |||
38 | dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev_l, dev->fw_size, | 38 | dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev_l, dev->fw_size, |
39 | &dev->bank1, GFP_KERNEL); | 39 | &dev->bank1, GFP_KERNEL); |
40 | 40 | ||
41 | if (IS_ERR(dev->fw_virt_addr)) { | 41 | if (IS_ERR_OR_NULL(dev->fw_virt_addr)) { |
42 | dev->fw_virt_addr = NULL; | 42 | dev->fw_virt_addr = NULL; |
43 | mfc_err("Allocating bitprocessor buffer failed\n"); | 43 | mfc_err("Allocating bitprocessor buffer failed\n"); |
44 | return -ENOMEM; | 44 | return -ENOMEM; |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_debug.h b/drivers/media/platform/s5p-mfc/s5p_mfc_debug.h index bd5cd4ae993c..8e608f5aa0d7 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_debug.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_debug.h | |||
@@ -30,8 +30,8 @@ extern int debug; | |||
30 | #define mfc_debug(level, fmt, args...) | 30 | #define mfc_debug(level, fmt, args...) |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | #define mfc_debug_enter() mfc_debug(5, "enter") | 33 | #define mfc_debug_enter() mfc_debug(5, "enter\n") |
34 | #define mfc_debug_leave() mfc_debug(5, "leave") | 34 | #define mfc_debug_leave() mfc_debug(5, "leave\n") |
35 | 35 | ||
36 | #define mfc_err(fmt, args...) \ | 36 | #define mfc_err(fmt, args...) \ |
37 | do { \ | 37 | do { \ |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 4af53bd2f182..00b07032f4f0 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | |||
@@ -210,11 +210,11 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx) | |||
210 | /* Context is to decode a frame */ | 210 | /* Context is to decode a frame */ |
211 | if (ctx->src_queue_cnt >= 1 && | 211 | if (ctx->src_queue_cnt >= 1 && |
212 | ctx->state == MFCINST_RUNNING && | 212 | ctx->state == MFCINST_RUNNING && |
213 | ctx->dst_queue_cnt >= ctx->dpb_count) | 213 | ctx->dst_queue_cnt >= ctx->pb_count) |
214 | return 1; | 214 | return 1; |
215 | /* Context is to return last frame */ | 215 | /* Context is to return last frame */ |
216 | if (ctx->state == MFCINST_FINISHING && | 216 | if (ctx->state == MFCINST_FINISHING && |
217 | ctx->dst_queue_cnt >= ctx->dpb_count) | 217 | ctx->dst_queue_cnt >= ctx->pb_count) |
218 | return 1; | 218 | return 1; |
219 | /* Context is to set buffers */ | 219 | /* Context is to set buffers */ |
220 | if (ctx->src_queue_cnt >= 1 && | 220 | if (ctx->src_queue_cnt >= 1 && |
@@ -224,7 +224,7 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx) | |||
224 | /* Resolution change */ | 224 | /* Resolution change */ |
225 | if ((ctx->state == MFCINST_RES_CHANGE_INIT || | 225 | if ((ctx->state == MFCINST_RES_CHANGE_INIT || |
226 | ctx->state == MFCINST_RES_CHANGE_FLUSH) && | 226 | ctx->state == MFCINST_RES_CHANGE_FLUSH) && |
227 | ctx->dst_queue_cnt >= ctx->dpb_count) | 227 | ctx->dst_queue_cnt >= ctx->pb_count) |
228 | return 1; | 228 | return 1; |
229 | if (ctx->state == MFCINST_RES_CHANGE_END && | 229 | if (ctx->state == MFCINST_RES_CHANGE_END && |
230 | ctx->src_queue_cnt >= 1) | 230 | ctx->src_queue_cnt >= 1) |
@@ -537,7 +537,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
537 | mfc_err("vb2_reqbufs on capture failed\n"); | 537 | mfc_err("vb2_reqbufs on capture failed\n"); |
538 | return ret; | 538 | return ret; |
539 | } | 539 | } |
540 | if (reqbufs->count < ctx->dpb_count) { | 540 | if (reqbufs->count < ctx->pb_count) { |
541 | mfc_err("Not enough buffers allocated\n"); | 541 | mfc_err("Not enough buffers allocated\n"); |
542 | reqbufs->count = 0; | 542 | reqbufs->count = 0; |
543 | s5p_mfc_clock_on(); | 543 | s5p_mfc_clock_on(); |
@@ -751,7 +751,7 @@ static int s5p_mfc_dec_g_v_ctrl(struct v4l2_ctrl *ctrl) | |||
751 | case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: | 751 | case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: |
752 | if (ctx->state >= MFCINST_HEAD_PARSED && | 752 | if (ctx->state >= MFCINST_HEAD_PARSED && |
753 | ctx->state < MFCINST_ABORT) { | 753 | ctx->state < MFCINST_ABORT) { |
754 | ctrl->val = ctx->dpb_count; | 754 | ctrl->val = ctx->pb_count; |
755 | break; | 755 | break; |
756 | } else if (ctx->state != MFCINST_INIT) { | 756 | } else if (ctx->state != MFCINST_INIT) { |
757 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); | 757 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); |
@@ -763,7 +763,7 @@ static int s5p_mfc_dec_g_v_ctrl(struct v4l2_ctrl *ctrl) | |||
763 | S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0); | 763 | S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0); |
764 | if (ctx->state >= MFCINST_HEAD_PARSED && | 764 | if (ctx->state >= MFCINST_HEAD_PARSED && |
765 | ctx->state < MFCINST_ABORT) { | 765 | ctx->state < MFCINST_ABORT) { |
766 | ctrl->val = ctx->dpb_count; | 766 | ctrl->val = ctx->pb_count; |
767 | } else { | 767 | } else { |
768 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); | 768 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); |
769 | return -EINVAL; | 769 | return -EINVAL; |
@@ -924,10 +924,10 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, | |||
924 | /* Output plane count is 2 - one for Y and one for CbCr */ | 924 | /* Output plane count is 2 - one for Y and one for CbCr */ |
925 | *plane_count = 2; | 925 | *plane_count = 2; |
926 | /* Setup buffer count */ | 926 | /* Setup buffer count */ |
927 | if (*buf_count < ctx->dpb_count) | 927 | if (*buf_count < ctx->pb_count) |
928 | *buf_count = ctx->dpb_count; | 928 | *buf_count = ctx->pb_count; |
929 | if (*buf_count > ctx->dpb_count + MFC_MAX_EXTRA_DPB) | 929 | if (*buf_count > ctx->pb_count + MFC_MAX_EXTRA_DPB) |
930 | *buf_count = ctx->dpb_count + MFC_MAX_EXTRA_DPB; | 930 | *buf_count = ctx->pb_count + MFC_MAX_EXTRA_DPB; |
931 | if (*buf_count > MFC_MAX_BUFFERS) | 931 | if (*buf_count > MFC_MAX_BUFFERS) |
932 | *buf_count = MFC_MAX_BUFFERS; | 932 | *buf_count = MFC_MAX_BUFFERS; |
933 | } else { | 933 | } else { |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 4f6b553c4b2d..2549967b2f85 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |||
@@ -592,7 +592,7 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx) | |||
592 | return 1; | 592 | return 1; |
593 | /* context is ready to encode a frame */ | 593 | /* context is ready to encode a frame */ |
594 | if ((ctx->state == MFCINST_RUNNING || | 594 | if ((ctx->state == MFCINST_RUNNING || |
595 | ctx->state == MFCINST_HEAD_PARSED) && | 595 | ctx->state == MFCINST_HEAD_PRODUCED) && |
596 | ctx->src_queue_cnt >= 1 && ctx->dst_queue_cnt >= 1) | 596 | ctx->src_queue_cnt >= 1 && ctx->dst_queue_cnt >= 1) |
597 | return 1; | 597 | return 1; |
598 | /* context is ready to encode remaining frames */ | 598 | /* context is ready to encode remaining frames */ |
@@ -649,6 +649,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) | |||
649 | struct s5p_mfc_enc_params *p = &ctx->enc_params; | 649 | struct s5p_mfc_enc_params *p = &ctx->enc_params; |
650 | struct s5p_mfc_buf *dst_mb; | 650 | struct s5p_mfc_buf *dst_mb; |
651 | unsigned long flags; | 651 | unsigned long flags; |
652 | unsigned int enc_pb_count; | ||
652 | 653 | ||
653 | if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) { | 654 | if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) { |
654 | spin_lock_irqsave(&dev->irqlock, flags); | 655 | spin_lock_irqsave(&dev->irqlock, flags); |
@@ -661,18 +662,19 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) | |||
661 | vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE); | 662 | vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE); |
662 | spin_unlock_irqrestore(&dev->irqlock, flags); | 663 | spin_unlock_irqrestore(&dev->irqlock, flags); |
663 | } | 664 | } |
664 | if (IS_MFCV6(dev)) { | 665 | |
665 | ctx->state = MFCINST_HEAD_PARSED; /* for INIT_BUFFER cmd */ | 666 | if (!IS_MFCV6(dev)) { |
666 | } else { | ||
667 | ctx->state = MFCINST_RUNNING; | 667 | ctx->state = MFCINST_RUNNING; |
668 | if (s5p_mfc_ctx_ready(ctx)) | 668 | if (s5p_mfc_ctx_ready(ctx)) |
669 | set_work_bit_irqsave(ctx); | 669 | set_work_bit_irqsave(ctx); |
670 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); | 670 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); |
671 | } | 671 | } else { |
672 | 672 | enc_pb_count = s5p_mfc_hw_call(dev->mfc_ops, | |
673 | if (IS_MFCV6(dev)) | ||
674 | ctx->dpb_count = s5p_mfc_hw_call(dev->mfc_ops, | ||
675 | get_enc_dpb_count, dev); | 673 | get_enc_dpb_count, dev); |
674 | if (ctx->pb_count < enc_pb_count) | ||
675 | ctx->pb_count = enc_pb_count; | ||
676 | ctx->state = MFCINST_HEAD_PRODUCED; | ||
677 | } | ||
676 | 678 | ||
677 | return 0; | 679 | return 0; |
678 | } | 680 | } |
@@ -717,9 +719,9 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) | |||
717 | 719 | ||
718 | slice_type = s5p_mfc_hw_call(dev->mfc_ops, get_enc_slice_type, dev); | 720 | slice_type = s5p_mfc_hw_call(dev->mfc_ops, get_enc_slice_type, dev); |
719 | strm_size = s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev); | 721 | strm_size = s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev); |
720 | mfc_debug(2, "Encoded slice type: %d", slice_type); | 722 | mfc_debug(2, "Encoded slice type: %d\n", slice_type); |
721 | mfc_debug(2, "Encoded stream size: %d", strm_size); | 723 | mfc_debug(2, "Encoded stream size: %d\n", strm_size); |
722 | mfc_debug(2, "Display order: %d", | 724 | mfc_debug(2, "Display order: %d\n", |
723 | mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT)); | 725 | mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT)); |
724 | spin_lock_irqsave(&dev->irqlock, flags); | 726 | spin_lock_irqsave(&dev->irqlock, flags); |
725 | if (slice_type >= 0) { | 727 | if (slice_type >= 0) { |
@@ -1055,15 +1057,13 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1055 | } | 1057 | } |
1056 | ctx->capture_state = QUEUE_BUFS_REQUESTED; | 1058 | ctx->capture_state = QUEUE_BUFS_REQUESTED; |
1057 | 1059 | ||
1058 | if (!IS_MFCV6(dev)) { | 1060 | ret = s5p_mfc_hw_call(ctx->dev->mfc_ops, |
1059 | ret = s5p_mfc_hw_call(ctx->dev->mfc_ops, | 1061 | alloc_codec_buffers, ctx); |
1060 | alloc_codec_buffers, ctx); | 1062 | if (ret) { |
1061 | if (ret) { | 1063 | mfc_err("Failed to allocate encoding buffers\n"); |
1062 | mfc_err("Failed to allocate encoding buffers\n"); | 1064 | reqbufs->count = 0; |
1063 | reqbufs->count = 0; | 1065 | ret = vb2_reqbufs(&ctx->vq_dst, reqbufs); |
1064 | ret = vb2_reqbufs(&ctx->vq_dst, reqbufs); | 1066 | return -ENOMEM; |
1065 | return -ENOMEM; | ||
1066 | } | ||
1067 | } | 1067 | } |
1068 | } else if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { | 1068 | } else if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
1069 | if (ctx->output_state != QUEUE_FREE) { | 1069 | if (ctx->output_state != QUEUE_FREE) { |
@@ -1071,6 +1071,19 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1071 | ctx->output_state); | 1071 | ctx->output_state); |
1072 | return -EINVAL; | 1072 | return -EINVAL; |
1073 | } | 1073 | } |
1074 | |||
1075 | if (IS_MFCV6(dev)) { | ||
1076 | /* Check for min encoder buffers */ | ||
1077 | if (ctx->pb_count && | ||
1078 | (reqbufs->count < ctx->pb_count)) { | ||
1079 | reqbufs->count = ctx->pb_count; | ||
1080 | mfc_debug(2, "Minimum %d output buffers needed\n", | ||
1081 | ctx->pb_count); | ||
1082 | } else { | ||
1083 | ctx->pb_count = reqbufs->count; | ||
1084 | } | ||
1085 | } | ||
1086 | |||
1074 | ret = vb2_reqbufs(&ctx->vq_src, reqbufs); | 1087 | ret = vb2_reqbufs(&ctx->vq_src, reqbufs); |
1075 | if (ret != 0) { | 1088 | if (ret != 0) { |
1076 | mfc_err("error in vb2_reqbufs() for E(S)\n"); | 1089 | mfc_err("error in vb2_reqbufs() for E(S)\n"); |
@@ -1533,14 +1546,14 @@ int vidioc_encoder_cmd(struct file *file, void *priv, | |||
1533 | 1546 | ||
1534 | spin_lock_irqsave(&dev->irqlock, flags); | 1547 | spin_lock_irqsave(&dev->irqlock, flags); |
1535 | if (list_empty(&ctx->src_queue)) { | 1548 | if (list_empty(&ctx->src_queue)) { |
1536 | mfc_debug(2, "EOS: empty src queue, entering finishing state"); | 1549 | mfc_debug(2, "EOS: empty src queue, entering finishing state\n"); |
1537 | ctx->state = MFCINST_FINISHING; | 1550 | ctx->state = MFCINST_FINISHING; |
1538 | if (s5p_mfc_ctx_ready(ctx)) | 1551 | if (s5p_mfc_ctx_ready(ctx)) |
1539 | set_work_bit_irqsave(ctx); | 1552 | set_work_bit_irqsave(ctx); |
1540 | spin_unlock_irqrestore(&dev->irqlock, flags); | 1553 | spin_unlock_irqrestore(&dev->irqlock, flags); |
1541 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); | 1554 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); |
1542 | } else { | 1555 | } else { |
1543 | mfc_debug(2, "EOS: marking last buffer of stream"); | 1556 | mfc_debug(2, "EOS: marking last buffer of stream\n"); |
1544 | buf = list_entry(ctx->src_queue.prev, | 1557 | buf = list_entry(ctx->src_queue.prev, |
1545 | struct s5p_mfc_buf, list); | 1558 | struct s5p_mfc_buf, list); |
1546 | if (buf->flags & MFC_BUF_FLAG_USED) | 1559 | if (buf->flags & MFC_BUF_FLAG_USED) |
@@ -1609,9 +1622,9 @@ static int check_vb_with_fmt(struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb) | |||
1609 | mfc_err("failed to get plane cookie\n"); | 1622 | mfc_err("failed to get plane cookie\n"); |
1610 | return -EINVAL; | 1623 | return -EINVAL; |
1611 | } | 1624 | } |
1612 | mfc_debug(2, "index: %d, plane[%d] cookie: 0x%08zx", | 1625 | mfc_debug(2, "index: %d, plane[%d] cookie: 0x%08zx\n", |
1613 | vb->v4l2_buf.index, i, | 1626 | vb->v4l2_buf.index, i, |
1614 | vb2_dma_contig_plane_dma_addr(vb, i)); | 1627 | vb2_dma_contig_plane_dma_addr(vb, i)); |
1615 | } | 1628 | } |
1616 | return 0; | 1629 | return 0; |
1617 | } | 1630 | } |
@@ -1760,11 +1773,27 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count) | |||
1760 | struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv); | 1773 | struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv); |
1761 | struct s5p_mfc_dev *dev = ctx->dev; | 1774 | struct s5p_mfc_dev *dev = ctx->dev; |
1762 | 1775 | ||
1763 | v4l2_ctrl_handler_setup(&ctx->ctrl_handler); | 1776 | if (IS_MFCV6(dev) && (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) { |
1777 | |||
1778 | if ((ctx->state == MFCINST_GOT_INST) && | ||
1779 | (dev->curr_ctx == ctx->num) && dev->hw_lock) { | ||
1780 | s5p_mfc_wait_for_done_ctx(ctx, | ||
1781 | S5P_MFC_R2H_CMD_SEQ_DONE_RET, | ||
1782 | 0); | ||
1783 | } | ||
1784 | |||
1785 | if (ctx->src_bufs_cnt < ctx->pb_count) { | ||
1786 | mfc_err("Need minimum %d OUTPUT buffers\n", | ||
1787 | ctx->pb_count); | ||
1788 | return -EINVAL; | ||
1789 | } | ||
1790 | } | ||
1791 | |||
1764 | /* If context is ready then dev = work->data;schedule it to run */ | 1792 | /* If context is ready then dev = work->data;schedule it to run */ |
1765 | if (s5p_mfc_ctx_ready(ctx)) | 1793 | if (s5p_mfc_ctx_ready(ctx)) |
1766 | set_work_bit_irqsave(ctx); | 1794 | set_work_bit_irqsave(ctx); |
1767 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); | 1795 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); |
1796 | |||
1768 | return 0; | 1797 | return 0; |
1769 | } | 1798 | } |
1770 | 1799 | ||
@@ -1920,6 +1949,7 @@ int s5p_mfc_enc_ctrls_setup(struct s5p_mfc_ctx *ctx) | |||
1920 | if (controls[i].is_volatile && ctx->ctrls[i]) | 1949 | if (controls[i].is_volatile && ctx->ctrls[i]) |
1921 | ctx->ctrls[i]->flags |= V4L2_CTRL_FLAG_VOLATILE; | 1950 | ctx->ctrls[i]->flags |= V4L2_CTRL_FLAG_VOLATILE; |
1922 | } | 1951 | } |
1952 | v4l2_ctrl_handler_setup(&ctx->ctrl_handler); | ||
1923 | return 0; | 1953 | return 0; |
1924 | } | 1954 | } |
1925 | 1955 | ||
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c index 0af05a2d1cd4..368582b091bf 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c | |||
@@ -1275,8 +1275,8 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) | |||
1275 | spin_unlock_irqrestore(&dev->irqlock, flags); | 1275 | spin_unlock_irqrestore(&dev->irqlock, flags); |
1276 | dev->curr_ctx = ctx->num; | 1276 | dev->curr_ctx = ctx->num; |
1277 | s5p_mfc_clean_ctx_int_flags(ctx); | 1277 | s5p_mfc_clean_ctx_int_flags(ctx); |
1278 | mfc_debug(2, "encoding buffer with index=%d state=%d", | 1278 | mfc_debug(2, "encoding buffer with index=%d state=%d\n", |
1279 | src_mb ? src_mb->b->v4l2_buf.index : -1, ctx->state); | 1279 | src_mb ? src_mb->b->v4l2_buf.index : -1, ctx->state); |
1280 | s5p_mfc_encode_one_frame_v5(ctx); | 1280 | s5p_mfc_encode_one_frame_v5(ctx); |
1281 | return 0; | 1281 | return 0; |
1282 | } | 1282 | } |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index 7e76fce2e524..66f0d042357f 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | |||
@@ -62,12 +62,6 @@ static void s5p_mfc_release_dec_desc_buffer_v6(struct s5p_mfc_ctx *ctx) | |||
62 | /* NOP */ | 62 | /* NOP */ |
63 | } | 63 | } |
64 | 64 | ||
65 | static int s5p_mfc_get_dec_status_v6(struct s5p_mfc_dev *dev) | ||
66 | { | ||
67 | /* NOP */ | ||
68 | return -1; | ||
69 | } | ||
70 | |||
71 | /* Allocate codec buffers */ | 65 | /* Allocate codec buffers */ |
72 | static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | 66 | static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) |
73 | { | 67 | { |
@@ -167,7 +161,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | |||
167 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); | 161 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); |
168 | ctx->bank1.size = | 162 | ctx->bank1.size = |
169 | ctx->scratch_buf_size + ctx->tmv_buffer_size + | 163 | ctx->scratch_buf_size + ctx->tmv_buffer_size + |
170 | (ctx->dpb_count * (ctx->luma_dpb_size + | 164 | (ctx->pb_count * (ctx->luma_dpb_size + |
171 | ctx->chroma_dpb_size + ctx->me_buffer_size)); | 165 | ctx->chroma_dpb_size + ctx->me_buffer_size)); |
172 | ctx->bank2.size = 0; | 166 | ctx->bank2.size = 0; |
173 | break; | 167 | break; |
@@ -181,7 +175,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | |||
181 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); | 175 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); |
182 | ctx->bank1.size = | 176 | ctx->bank1.size = |
183 | ctx->scratch_buf_size + ctx->tmv_buffer_size + | 177 | ctx->scratch_buf_size + ctx->tmv_buffer_size + |
184 | (ctx->dpb_count * (ctx->luma_dpb_size + | 178 | (ctx->pb_count * (ctx->luma_dpb_size + |
185 | ctx->chroma_dpb_size + ctx->me_buffer_size)); | 179 | ctx->chroma_dpb_size + ctx->me_buffer_size)); |
186 | ctx->bank2.size = 0; | 180 | ctx->bank2.size = 0; |
187 | break; | 181 | break; |
@@ -198,7 +192,6 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | |||
198 | } | 192 | } |
199 | BUG_ON(ctx->bank1.dma & ((1 << MFC_BANK1_ALIGN_ORDER) - 1)); | 193 | BUG_ON(ctx->bank1.dma & ((1 << MFC_BANK1_ALIGN_ORDER) - 1)); |
200 | } | 194 | } |
201 | |||
202 | return 0; | 195 | return 0; |
203 | } | 196 | } |
204 | 197 | ||
@@ -449,8 +442,8 @@ static int s5p_mfc_set_enc_stream_buffer_v6(struct s5p_mfc_ctx *ctx, | |||
449 | WRITEL(addr, S5P_FIMV_E_STREAM_BUFFER_ADDR_V6); /* 16B align */ | 442 | WRITEL(addr, S5P_FIMV_E_STREAM_BUFFER_ADDR_V6); /* 16B align */ |
450 | WRITEL(size, S5P_FIMV_E_STREAM_BUFFER_SIZE_V6); | 443 | WRITEL(size, S5P_FIMV_E_STREAM_BUFFER_SIZE_V6); |
451 | 444 | ||
452 | mfc_debug(2, "stream buf addr: 0x%08lx, size: 0x%d", | 445 | mfc_debug(2, "stream buf addr: 0x%08lx, size: 0x%d\n", |
453 | addr, size); | 446 | addr, size); |
454 | 447 | ||
455 | return 0; | 448 | return 0; |
456 | } | 449 | } |
@@ -463,8 +456,8 @@ static void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, | |||
463 | WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6); /* 256B align */ | 456 | WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6); /* 256B align */ |
464 | WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6); | 457 | WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6); |
465 | 458 | ||
466 | mfc_debug(2, "enc src y buf addr: 0x%08lx", y_addr); | 459 | mfc_debug(2, "enc src y buf addr: 0x%08lx\n", y_addr); |
467 | mfc_debug(2, "enc src c buf addr: 0x%08lx", c_addr); | 460 | mfc_debug(2, "enc src c buf addr: 0x%08lx\n", c_addr); |
468 | } | 461 | } |
469 | 462 | ||
470 | static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, | 463 | static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, |
@@ -479,8 +472,8 @@ static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, | |||
479 | enc_recon_y_addr = READL(S5P_FIMV_E_RECON_LUMA_DPB_ADDR_V6); | 472 | enc_recon_y_addr = READL(S5P_FIMV_E_RECON_LUMA_DPB_ADDR_V6); |
480 | enc_recon_c_addr = READL(S5P_FIMV_E_RECON_CHROMA_DPB_ADDR_V6); | 473 | enc_recon_c_addr = READL(S5P_FIMV_E_RECON_CHROMA_DPB_ADDR_V6); |
481 | 474 | ||
482 | mfc_debug(2, "recon y addr: 0x%08lx", enc_recon_y_addr); | 475 | mfc_debug(2, "recon y addr: 0x%08lx\n", enc_recon_y_addr); |
483 | mfc_debug(2, "recon c addr: 0x%08lx", enc_recon_c_addr); | 476 | mfc_debug(2, "recon c addr: 0x%08lx\n", enc_recon_c_addr); |
484 | } | 477 | } |
485 | 478 | ||
486 | /* Set encoding ref & codec buffer */ | 479 | /* Set encoding ref & codec buffer */ |
@@ -497,7 +490,7 @@ static int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx) | |||
497 | 490 | ||
498 | mfc_debug(2, "Buf1: %p (%d)\n", (void *)buf_addr1, buf_size1); | 491 | mfc_debug(2, "Buf1: %p (%d)\n", (void *)buf_addr1, buf_size1); |
499 | 492 | ||
500 | for (i = 0; i < ctx->dpb_count; i++) { | 493 | for (i = 0; i < ctx->pb_count; i++) { |
501 | WRITEL(buf_addr1, S5P_FIMV_E_LUMA_DPB_V6 + (4 * i)); | 494 | WRITEL(buf_addr1, S5P_FIMV_E_LUMA_DPB_V6 + (4 * i)); |
502 | buf_addr1 += ctx->luma_dpb_size; | 495 | buf_addr1 += ctx->luma_dpb_size; |
503 | WRITEL(buf_addr1, S5P_FIMV_E_CHROMA_DPB_V6 + (4 * i)); | 496 | WRITEL(buf_addr1, S5P_FIMV_E_CHROMA_DPB_V6 + (4 * i)); |
@@ -520,7 +513,7 @@ static int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx) | |||
520 | buf_size1 -= ctx->tmv_buffer_size; | 513 | buf_size1 -= ctx->tmv_buffer_size; |
521 | 514 | ||
522 | mfc_debug(2, "Buf1: %u, buf_size1: %d (ref frames %d)\n", | 515 | mfc_debug(2, "Buf1: %u, buf_size1: %d (ref frames %d)\n", |
523 | buf_addr1, buf_size1, ctx->dpb_count); | 516 | buf_addr1, buf_size1, ctx->pb_count); |
524 | if (buf_size1 < 0) { | 517 | if (buf_size1 < 0) { |
525 | mfc_debug(2, "Not enough memory has been allocated.\n"); | 518 | mfc_debug(2, "Not enough memory has been allocated.\n"); |
526 | return -ENOMEM; | 519 | return -ENOMEM; |
@@ -1431,8 +1424,8 @@ static inline int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) | |||
1431 | src_y_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 0); | 1424 | src_y_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 0); |
1432 | src_c_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 1); | 1425 | src_c_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 1); |
1433 | 1426 | ||
1434 | mfc_debug(2, "enc src y addr: 0x%08lx", src_y_addr); | 1427 | mfc_debug(2, "enc src y addr: 0x%08lx\n", src_y_addr); |
1435 | mfc_debug(2, "enc src c addr: 0x%08lx", src_c_addr); | 1428 | mfc_debug(2, "enc src c addr: 0x%08lx\n", src_c_addr); |
1436 | 1429 | ||
1437 | s5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr, src_c_addr); | 1430 | s5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr, src_c_addr); |
1438 | 1431 | ||
@@ -1522,22 +1515,6 @@ static inline int s5p_mfc_run_init_enc_buffers(struct s5p_mfc_ctx *ctx) | |||
1522 | struct s5p_mfc_dev *dev = ctx->dev; | 1515 | struct s5p_mfc_dev *dev = ctx->dev; |
1523 | int ret; | 1516 | int ret; |
1524 | 1517 | ||
1525 | ret = s5p_mfc_alloc_codec_buffers_v6(ctx); | ||
1526 | if (ret) { | ||
1527 | mfc_err("Failed to allocate encoding buffers.\n"); | ||
1528 | return -ENOMEM; | ||
1529 | } | ||
1530 | |||
1531 | /* Header was generated now starting processing | ||
1532 | * First set the reference frame buffers | ||
1533 | */ | ||
1534 | if (ctx->capture_state != QUEUE_BUFS_REQUESTED) { | ||
1535 | mfc_err("It seems that destionation buffers were not\n" | ||
1536 | "requested.MFC requires that header should be generated\n" | ||
1537 | "before allocating codec buffer.\n"); | ||
1538 | return -EAGAIN; | ||
1539 | } | ||
1540 | |||
1541 | dev->curr_ctx = ctx->num; | 1518 | dev->curr_ctx = ctx->num; |
1542 | s5p_mfc_clean_ctx_int_flags(ctx); | 1519 | s5p_mfc_clean_ctx_int_flags(ctx); |
1543 | ret = s5p_mfc_set_enc_ref_buffer_v6(ctx); | 1520 | ret = s5p_mfc_set_enc_ref_buffer_v6(ctx); |
@@ -1582,7 +1559,7 @@ static void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev) | |||
1582 | mfc_debug(1, "Seting new context to %p\n", ctx); | 1559 | mfc_debug(1, "Seting new context to %p\n", ctx); |
1583 | /* Got context to run in ctx */ | 1560 | /* Got context to run in ctx */ |
1584 | mfc_debug(1, "ctx->dst_queue_cnt=%d ctx->dpb_count=%d ctx->src_queue_cnt=%d\n", | 1561 | mfc_debug(1, "ctx->dst_queue_cnt=%d ctx->dpb_count=%d ctx->src_queue_cnt=%d\n", |
1585 | ctx->dst_queue_cnt, ctx->dpb_count, ctx->src_queue_cnt); | 1562 | ctx->dst_queue_cnt, ctx->pb_count, ctx->src_queue_cnt); |
1586 | mfc_debug(1, "ctx->state=%d\n", ctx->state); | 1563 | mfc_debug(1, "ctx->state=%d\n", ctx->state); |
1587 | /* Last frame has already been sent to MFC | 1564 | /* Last frame has already been sent to MFC |
1588 | * Now obtaining frames from MFC buffer */ | 1565 | * Now obtaining frames from MFC buffer */ |
@@ -1647,7 +1624,7 @@ static void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev) | |||
1647 | case MFCINST_GOT_INST: | 1624 | case MFCINST_GOT_INST: |
1648 | s5p_mfc_run_init_enc(ctx); | 1625 | s5p_mfc_run_init_enc(ctx); |
1649 | break; | 1626 | break; |
1650 | case MFCINST_HEAD_PARSED: /* Only for MFC6.x */ | 1627 | case MFCINST_HEAD_PRODUCED: |
1651 | ret = s5p_mfc_run_init_enc_buffers(ctx); | 1628 | ret = s5p_mfc_run_init_enc_buffers(ctx); |
1652 | break; | 1629 | break; |
1653 | default: | 1630 | default: |
@@ -1730,7 +1707,7 @@ static int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev) | |||
1730 | return mfc_read(dev, S5P_FIMV_D_DISPLAY_STATUS_V6); | 1707 | return mfc_read(dev, S5P_FIMV_D_DISPLAY_STATUS_V6); |
1731 | } | 1708 | } |
1732 | 1709 | ||
1733 | static int s5p_mfc_get_decoded_status_v6(struct s5p_mfc_dev *dev) | 1710 | static int s5p_mfc_get_dec_status_v6(struct s5p_mfc_dev *dev) |
1734 | { | 1711 | { |
1735 | return mfc_read(dev, S5P_FIMV_D_DECODED_STATUS_V6); | 1712 | return mfc_read(dev, S5P_FIMV_D_DECODED_STATUS_V6); |
1736 | } | 1713 | } |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c index 6aa38a56aaf2..11d5f1dada32 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | |||
@@ -50,19 +50,6 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) | |||
50 | goto err_p_ip_clk; | 50 | goto err_p_ip_clk; |
51 | } | 51 | } |
52 | 52 | ||
53 | pm->clock = clk_get(&dev->plat_dev->dev, dev->variant->mclk_name); | ||
54 | if (IS_ERR(pm->clock)) { | ||
55 | mfc_err("Failed to get MFC clock\n"); | ||
56 | ret = PTR_ERR(pm->clock); | ||
57 | goto err_g_ip_clk_2; | ||
58 | } | ||
59 | |||
60 | ret = clk_prepare(pm->clock); | ||
61 | if (ret) { | ||
62 | mfc_err("Failed to prepare MFC clock\n"); | ||
63 | goto err_p_ip_clk_2; | ||
64 | } | ||
65 | |||
66 | atomic_set(&pm->power, 0); | 53 | atomic_set(&pm->power, 0); |
67 | #ifdef CONFIG_PM_RUNTIME | 54 | #ifdef CONFIG_PM_RUNTIME |
68 | pm->device = &dev->plat_dev->dev; | 55 | pm->device = &dev->plat_dev->dev; |
@@ -72,10 +59,6 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) | |||
72 | atomic_set(&clk_ref, 0); | 59 | atomic_set(&clk_ref, 0); |
73 | #endif | 60 | #endif |
74 | return 0; | 61 | return 0; |
75 | err_p_ip_clk_2: | ||
76 | clk_put(pm->clock); | ||
77 | err_g_ip_clk_2: | ||
78 | clk_unprepare(pm->clock_gate); | ||
79 | err_p_ip_clk: | 62 | err_p_ip_clk: |
80 | clk_put(pm->clock_gate); | 63 | clk_put(pm->clock_gate); |
81 | err_g_ip_clk: | 64 | err_g_ip_clk: |
@@ -86,8 +69,6 @@ void s5p_mfc_final_pm(struct s5p_mfc_dev *dev) | |||
86 | { | 69 | { |
87 | clk_unprepare(pm->clock_gate); | 70 | clk_unprepare(pm->clock_gate); |
88 | clk_put(pm->clock_gate); | 71 | clk_put(pm->clock_gate); |
89 | clk_unprepare(pm->clock); | ||
90 | clk_put(pm->clock); | ||
91 | #ifdef CONFIG_PM_RUNTIME | 72 | #ifdef CONFIG_PM_RUNTIME |
92 | pm_runtime_disable(pm->device); | 73 | pm_runtime_disable(pm->device); |
93 | #endif | 74 | #endif |
@@ -98,7 +79,7 @@ int s5p_mfc_clock_on(void) | |||
98 | int ret; | 79 | int ret; |
99 | #ifdef CLK_DEBUG | 80 | #ifdef CLK_DEBUG |
100 | atomic_inc(&clk_ref); | 81 | atomic_inc(&clk_ref); |
101 | mfc_debug(3, "+ %d", atomic_read(&clk_ref)); | 82 | mfc_debug(3, "+ %d\n", atomic_read(&clk_ref)); |
102 | #endif | 83 | #endif |
103 | ret = clk_enable(pm->clock_gate); | 84 | ret = clk_enable(pm->clock_gate); |
104 | return ret; | 85 | return ret; |
@@ -108,7 +89,7 @@ void s5p_mfc_clock_off(void) | |||
108 | { | 89 | { |
109 | #ifdef CLK_DEBUG | 90 | #ifdef CLK_DEBUG |
110 | atomic_dec(&clk_ref); | 91 | atomic_dec(&clk_ref); |
111 | mfc_debug(3, "- %d", atomic_read(&clk_ref)); | 92 | mfc_debug(3, "- %d\n", atomic_read(&clk_ref)); |
112 | #endif | 93 | #endif |
113 | clk_disable(pm->clock_gate); | 94 | clk_disable(pm->clock_gate); |
114 | } | 95 | } |
diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c index 0b32cc3f6a47..59a9deefb242 100644 --- a/drivers/media/platform/sh_veu.c +++ b/drivers/media/platform/sh_veu.c | |||
@@ -905,11 +905,11 @@ static int sh_veu_queue_setup(struct vb2_queue *vq, | |||
905 | if (ftmp.fmt.pix.width != pix->width || | 905 | if (ftmp.fmt.pix.width != pix->width || |
906 | ftmp.fmt.pix.height != pix->height) | 906 | ftmp.fmt.pix.height != pix->height) |
907 | return -EINVAL; | 907 | return -EINVAL; |
908 | size = pix->bytesperline ? pix->bytesperline * pix->height : | 908 | size = pix->bytesperline ? pix->bytesperline * pix->height * fmt->depth / fmt->ydepth : |
909 | pix->width * pix->height * fmt->depth >> 3; | 909 | pix->width * pix->height * fmt->depth / fmt->ydepth; |
910 | } else { | 910 | } else { |
911 | vfmt = sh_veu_get_vfmt(veu, vq->type); | 911 | vfmt = sh_veu_get_vfmt(veu, vq->type); |
912 | size = vfmt->bytesperline * vfmt->frame.height; | 912 | size = vfmt->bytesperline * vfmt->frame.height * vfmt->fmt->depth / vfmt->fmt->ydepth; |
913 | } | 913 | } |
914 | 914 | ||
915 | if (count < 2) | 915 | if (count < 2) |
@@ -1033,8 +1033,6 @@ static int sh_veu_release(struct file *file) | |||
1033 | 1033 | ||
1034 | dev_dbg(veu->dev, "Releasing instance %p\n", veu_file); | 1034 | dev_dbg(veu->dev, "Releasing instance %p\n", veu_file); |
1035 | 1035 | ||
1036 | pm_runtime_put(veu->dev); | ||
1037 | |||
1038 | if (veu_file == veu->capture) { | 1036 | if (veu_file == veu->capture) { |
1039 | veu->capture = NULL; | 1037 | veu->capture = NULL; |
1040 | vb2_queue_release(v4l2_m2m_get_vq(veu->m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE)); | 1038 | vb2_queue_release(v4l2_m2m_get_vq(veu->m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE)); |
@@ -1050,6 +1048,8 @@ static int sh_veu_release(struct file *file) | |||
1050 | veu->m2m_ctx = NULL; | 1048 | veu->m2m_ctx = NULL; |
1051 | } | 1049 | } |
1052 | 1050 | ||
1051 | pm_runtime_put(veu->dev); | ||
1052 | |||
1053 | kfree(veu_file); | 1053 | kfree(veu_file); |
1054 | 1054 | ||
1055 | return 0; | 1055 | return 0; |
@@ -1138,10 +1138,7 @@ static irqreturn_t sh_veu_isr(int irq, void *dev_id) | |||
1138 | 1138 | ||
1139 | veu->xaction++; | 1139 | veu->xaction++; |
1140 | 1140 | ||
1141 | if (!veu->aborting) | 1141 | return IRQ_WAKE_THREAD; |
1142 | return IRQ_WAKE_THREAD; | ||
1143 | |||
1144 | return IRQ_HANDLED; | ||
1145 | } | 1142 | } |
1146 | 1143 | ||
1147 | static int sh_veu_probe(struct platform_device *pdev) | 1144 | static int sh_veu_probe(struct platform_device *pdev) |
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index eea832c5fd01..3a4efbdc7668 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c | |||
@@ -643,9 +643,9 @@ static int soc_camera_close(struct file *file) | |||
643 | 643 | ||
644 | if (ici->ops->init_videobuf2) | 644 | if (ici->ops->init_videobuf2) |
645 | vb2_queue_release(&icd->vb2_vidq); | 645 | vb2_queue_release(&icd->vb2_vidq); |
646 | ici->ops->remove(icd); | ||
647 | |||
648 | __soc_camera_power_off(icd); | 646 | __soc_camera_power_off(icd); |
647 | |||
648 | ici->ops->remove(icd); | ||
649 | } | 649 | } |
650 | 650 | ||
651 | if (icd->streamer == file) | 651 | if (icd->streamer == file) |
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index c0beee2fa37c..d529ba788f41 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
@@ -22,6 +22,7 @@ config RADIO_SI476X | |||
22 | tristate "Silicon Laboratories Si476x I2C FM Radio" | 22 | tristate "Silicon Laboratories Si476x I2C FM Radio" |
23 | depends on I2C && VIDEO_V4L2 | 23 | depends on I2C && VIDEO_V4L2 |
24 | depends on MFD_SI476X_CORE | 24 | depends on MFD_SI476X_CORE |
25 | depends on SND_SOC | ||
25 | select SND_SOC_SI476X | 26 | select SND_SOC_SI476X |
26 | ---help--- | 27 | ---help--- |
27 | Choose Y here if you have this FM radio chip. | 28 | Choose Y here if you have this FM radio chip. |
diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index 9430c6a29937..9dc8bafe6486 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c | |||
@@ -44,7 +44,7 @@ | |||
44 | 44 | ||
45 | #define FREQ_MUL (10000000 / 625) | 45 | #define FREQ_MUL (10000000 / 625) |
46 | 46 | ||
47 | #define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0b10000000 & (status)) | 47 | #define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0x80 & (status)) |
48 | 48 | ||
49 | #define DRIVER_NAME "si476x-radio" | 49 | #define DRIVER_NAME "si476x-radio" |
50 | #define DRIVER_CARD "SI476x AM/FM Receiver" | 50 | #define DRIVER_CARD "SI476x AM/FM Receiver" |
diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig index f6768cad001a..15665debc572 100644 --- a/drivers/media/tuners/Kconfig +++ b/drivers/media/tuners/Kconfig | |||
@@ -1,23 +1,3 @@ | |||
1 | config MEDIA_ATTACH | ||
2 | bool "Load and attach frontend and tuner driver modules as needed" | ||
3 | depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || MEDIA_RADIO_SUPPORT | ||
4 | depends on MODULES | ||
5 | default y if !EXPERT | ||
6 | help | ||
7 | Remove the static dependency of DVB card drivers on all | ||
8 | frontend modules for all possible card variants. Instead, | ||
9 | allow the card drivers to only load the frontend modules | ||
10 | they require. | ||
11 | |||
12 | Also, tuner module will automatically load a tuner driver | ||
13 | when needed, for analog mode. | ||
14 | |||
15 | This saves several KBytes of memory. | ||
16 | |||
17 | Note: You will need module-init-tools v3.2 or later for this feature. | ||
18 | |||
19 | If unsure say Y. | ||
20 | |||
21 | # Analog TV tuners, auto-loaded via tuner.ko | 1 | # Analog TV tuners, auto-loaded via tuner.ko |
22 | config MEDIA_TUNER | 2 | config MEDIA_TUNER |
23 | tristate | 3 | tristate |
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index 22015fe1a0f3..2cc8ec70e3b6 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c | |||
@@ -376,7 +376,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d) | |||
376 | struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf}; | 376 | struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf}; |
377 | struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf}; | 377 | struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf}; |
378 | struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf}; | 378 | struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf}; |
379 | struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 5, buf}; | 379 | struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf}; |
380 | 380 | ||
381 | dev_dbg(&d->udev->dev, "%s:\n", __func__); | 381 | dev_dbg(&d->udev->dev, "%s:\n", __func__); |
382 | 382 | ||
@@ -481,9 +481,9 @@ static int rtl2832u_read_config(struct dvb_usb_device *d) | |||
481 | goto found; | 481 | goto found; |
482 | } | 482 | } |
483 | 483 | ||
484 | /* check R820T by reading tuner stats at I2C addr 0x1a */ | 484 | /* check R820T ID register; reg=00 val=69 */ |
485 | ret = rtl28xxu_ctrl_msg(d, &req_r820t); | 485 | ret = rtl28xxu_ctrl_msg(d, &req_r820t); |
486 | if (ret == 0) { | 486 | if (ret == 0 && buf[0] == 0x69) { |
487 | priv->tuner = TUNER_RTL2832_R820T; | 487 | priv->tuner = TUNER_RTL2832_R820T; |
488 | priv->tuner_name = "R820T"; | 488 | priv->tuner_name = "R820T"; |
489 | goto found; | 489 | goto found; |
diff --git a/drivers/media/usb/gspca/sonixb.c b/drivers/media/usb/gspca/sonixb.c index 3fe207e038c7..d7ff3b9687c5 100644 --- a/drivers/media/usb/gspca/sonixb.c +++ b/drivers/media/usb/gspca/sonixb.c | |||
@@ -1159,6 +1159,13 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
1159 | regs[0x01] = 0x44; /* Select 24 Mhz clock */ | 1159 | regs[0x01] = 0x44; /* Select 24 Mhz clock */ |
1160 | regs[0x12] = 0x02; /* Set hstart to 2 */ | 1160 | regs[0x12] = 0x02; /* Set hstart to 2 */ |
1161 | } | 1161 | } |
1162 | break; | ||
1163 | case SENSOR_PAS202: | ||
1164 | /* For some unknown reason we need to increase hstart by 1 on | ||
1165 | the sn9c103, otherwise we get wrong colors (bayer shift). */ | ||
1166 | if (sd->bridge == BRIDGE_103) | ||
1167 | regs[0x12] += 1; | ||
1168 | break; | ||
1162 | } | 1169 | } |
1163 | /* Disable compression when the raw bayer format has been selected */ | 1170 | /* Disable compression when the raw bayer format has been selected */ |
1164 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) | 1171 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) |
diff --git a/drivers/media/usb/pwc/pwc.h b/drivers/media/usb/pwc/pwc.h index 7a6a0d39c2c6..81b017a554bc 100644 --- a/drivers/media/usb/pwc/pwc.h +++ b/drivers/media/usb/pwc/pwc.h | |||
@@ -226,7 +226,7 @@ struct pwc_device | |||
226 | struct list_head queued_bufs; | 226 | struct list_head queued_bufs; |
227 | spinlock_t queued_bufs_lock; /* Protects queued_bufs */ | 227 | spinlock_t queued_bufs_lock; /* Protects queued_bufs */ |
228 | 228 | ||
229 | /* Note if taking both locks v4l2_lock must always be locked first! */ | 229 | /* If taking both locks vb_queue_lock must always be locked first! */ |
230 | struct mutex v4l2_lock; /* Protects everything else */ | 230 | struct mutex v4l2_lock; /* Protects everything else */ |
231 | struct mutex vb_queue_lock; /* Protects vb_queue and capt_file */ | 231 | struct mutex vb_queue_lock; /* Protects vb_queue and capt_file */ |
232 | 232 | ||
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index ebb8e48619a2..fccd08b66d1a 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c | |||
@@ -1835,6 +1835,8 @@ bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl) | |||
1835 | { | 1835 | { |
1836 | if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_TX) | 1836 | if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_TX) |
1837 | return true; | 1837 | return true; |
1838 | if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_RX) | ||
1839 | return true; | ||
1838 | switch (ctrl->id) { | 1840 | switch (ctrl->id) { |
1839 | case V4L2_CID_AUDIO_MUTE: | 1841 | case V4L2_CID_AUDIO_MUTE: |
1840 | case V4L2_CID_AUDIO_VOLUME: | 1842 | case V4L2_CID_AUDIO_VOLUME: |
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index f81bda1a48ec..7658586fe5f4 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c | |||
@@ -243,7 +243,6 @@ static void v4l_print_format(const void *arg, bool write_only) | |||
243 | const struct v4l2_vbi_format *vbi; | 243 | const struct v4l2_vbi_format *vbi; |
244 | const struct v4l2_sliced_vbi_format *sliced; | 244 | const struct v4l2_sliced_vbi_format *sliced; |
245 | const struct v4l2_window *win; | 245 | const struct v4l2_window *win; |
246 | const struct v4l2_clip *clip; | ||
247 | unsigned i; | 246 | unsigned i; |
248 | 247 | ||
249 | pr_cont("type=%s", prt_names(p->type, v4l2_type_names)); | 248 | pr_cont("type=%s", prt_names(p->type, v4l2_type_names)); |
@@ -253,7 +252,7 @@ static void v4l_print_format(const void *arg, bool write_only) | |||
253 | pix = &p->fmt.pix; | 252 | pix = &p->fmt.pix; |
254 | pr_cont(", width=%u, height=%u, " | 253 | pr_cont(", width=%u, height=%u, " |
255 | "pixelformat=%c%c%c%c, field=%s, " | 254 | "pixelformat=%c%c%c%c, field=%s, " |
256 | "bytesperline=%u sizeimage=%u, colorspace=%d\n", | 255 | "bytesperline=%u, sizeimage=%u, colorspace=%d\n", |
257 | pix->width, pix->height, | 256 | pix->width, pix->height, |
258 | (pix->pixelformat & 0xff), | 257 | (pix->pixelformat & 0xff), |
259 | (pix->pixelformat >> 8) & 0xff, | 258 | (pix->pixelformat >> 8) & 0xff, |
@@ -284,20 +283,14 @@ static void v4l_print_format(const void *arg, bool write_only) | |||
284 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 283 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
285 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: | 284 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: |
286 | win = &p->fmt.win; | 285 | win = &p->fmt.win; |
287 | pr_cont(", wxh=%dx%d, x,y=%d,%d, field=%s, " | 286 | /* Note: we can't print the clip list here since the clips |
288 | "chromakey=0x%08x, bitmap=%p, " | 287 | * pointer is a userspace pointer, not a kernelspace |
289 | "global_alpha=0x%02x\n", | 288 | * pointer. */ |
290 | win->w.width, win->w.height, | 289 | pr_cont(", wxh=%dx%d, x,y=%d,%d, field=%s, chromakey=0x%08x, clipcount=%u, clips=%p, bitmap=%p, global_alpha=0x%02x\n", |
291 | win->w.left, win->w.top, | 290 | win->w.width, win->w.height, win->w.left, win->w.top, |
292 | prt_names(win->field, v4l2_field_names), | 291 | prt_names(win->field, v4l2_field_names), |
293 | win->chromakey, win->bitmap, win->global_alpha); | 292 | win->chromakey, win->clipcount, win->clips, |
294 | clip = win->clips; | 293 | win->bitmap, win->global_alpha); |
295 | for (i = 0; i < win->clipcount; i++) { | ||
296 | printk(KERN_DEBUG "clip %u: wxh=%dx%d, x,y=%d,%d\n", | ||
297 | i, clip->c.width, clip->c.height, | ||
298 | clip->c.left, clip->c.top); | ||
299 | clip = clip->next; | ||
300 | } | ||
301 | break; | 294 | break; |
302 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 295 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
303 | case V4L2_BUF_TYPE_VBI_OUTPUT: | 296 | case V4L2_BUF_TYPE_VBI_OUTPUT: |
@@ -332,7 +325,7 @@ static void v4l_print_framebuffer(const void *arg, bool write_only) | |||
332 | 325 | ||
333 | pr_cont("capability=0x%x, flags=0x%x, base=0x%p, width=%u, " | 326 | pr_cont("capability=0x%x, flags=0x%x, base=0x%p, width=%u, " |
334 | "height=%u, pixelformat=%c%c%c%c, " | 327 | "height=%u, pixelformat=%c%c%c%c, " |
335 | "bytesperline=%u sizeimage=%u, colorspace=%d\n", | 328 | "bytesperline=%u, sizeimage=%u, colorspace=%d\n", |
336 | p->capability, p->flags, p->base, | 329 | p->capability, p->flags, p->base, |
337 | p->fmt.width, p->fmt.height, | 330 | p->fmt.width, p->fmt.height, |
338 | (p->fmt.pixelformat & 0xff), | 331 | (p->fmt.pixelformat & 0xff), |
@@ -353,7 +346,7 @@ static void v4l_print_modulator(const void *arg, bool write_only) | |||
353 | const struct v4l2_modulator *p = arg; | 346 | const struct v4l2_modulator *p = arg; |
354 | 347 | ||
355 | if (write_only) | 348 | if (write_only) |
356 | pr_cont("index=%u, txsubchans=0x%x", p->index, p->txsubchans); | 349 | pr_cont("index=%u, txsubchans=0x%x\n", p->index, p->txsubchans); |
357 | else | 350 | else |
358 | pr_cont("index=%u, name=%.*s, capability=0x%x, " | 351 | pr_cont("index=%u, name=%.*s, capability=0x%x, " |
359 | "rangelow=%u, rangehigh=%u, txsubchans=0x%x\n", | 352 | "rangelow=%u, rangehigh=%u, txsubchans=0x%x\n", |
@@ -445,13 +438,13 @@ static void v4l_print_buffer(const void *arg, bool write_only) | |||
445 | for (i = 0; i < p->length; ++i) { | 438 | for (i = 0; i < p->length; ++i) { |
446 | plane = &p->m.planes[i]; | 439 | plane = &p->m.planes[i]; |
447 | printk(KERN_DEBUG | 440 | printk(KERN_DEBUG |
448 | "plane %d: bytesused=%d, data_offset=0x%08x " | 441 | "plane %d: bytesused=%d, data_offset=0x%08x, " |
449 | "offset/userptr=0x%lx, length=%d\n", | 442 | "offset/userptr=0x%lx, length=%d\n", |
450 | i, plane->bytesused, plane->data_offset, | 443 | i, plane->bytesused, plane->data_offset, |
451 | plane->m.userptr, plane->length); | 444 | plane->m.userptr, plane->length); |
452 | } | 445 | } |
453 | } else { | 446 | } else { |
454 | pr_cont("bytesused=%d, offset/userptr=0x%lx, length=%d\n", | 447 | pr_cont(", bytesused=%d, offset/userptr=0x%lx, length=%d\n", |
455 | p->bytesused, p->m.userptr, p->length); | 448 | p->bytesused, p->m.userptr, p->length); |
456 | } | 449 | } |
457 | 450 | ||
@@ -504,6 +497,8 @@ static void v4l_print_streamparm(const void *arg, bool write_only) | |||
504 | c->capability, c->outputmode, | 497 | c->capability, c->outputmode, |
505 | c->timeperframe.numerator, c->timeperframe.denominator, | 498 | c->timeperframe.numerator, c->timeperframe.denominator, |
506 | c->extendedmode, c->writebuffers); | 499 | c->extendedmode, c->writebuffers); |
500 | } else { | ||
501 | pr_cont("\n"); | ||
507 | } | 502 | } |
508 | } | 503 | } |
509 | 504 | ||
@@ -734,11 +729,11 @@ static void v4l_print_frmsizeenum(const void *arg, bool write_only) | |||
734 | p->type); | 729 | p->type); |
735 | switch (p->type) { | 730 | switch (p->type) { |
736 | case V4L2_FRMSIZE_TYPE_DISCRETE: | 731 | case V4L2_FRMSIZE_TYPE_DISCRETE: |
737 | pr_cont(" wxh=%ux%u\n", | 732 | pr_cont(", wxh=%ux%u\n", |
738 | p->discrete.width, p->discrete.height); | 733 | p->discrete.width, p->discrete.height); |
739 | break; | 734 | break; |
740 | case V4L2_FRMSIZE_TYPE_STEPWISE: | 735 | case V4L2_FRMSIZE_TYPE_STEPWISE: |
741 | pr_cont(" min=%ux%u, max=%ux%u, step=%ux%u\n", | 736 | pr_cont(", min=%ux%u, max=%ux%u, step=%ux%u\n", |
742 | p->stepwise.min_width, p->stepwise.min_height, | 737 | p->stepwise.min_width, p->stepwise.min_height, |
743 | p->stepwise.step_width, p->stepwise.step_height, | 738 | p->stepwise.step_width, p->stepwise.step_height, |
744 | p->stepwise.max_width, p->stepwise.max_height); | 739 | p->stepwise.max_width, p->stepwise.max_height); |
@@ -764,12 +759,12 @@ static void v4l_print_frmivalenum(const void *arg, bool write_only) | |||
764 | p->width, p->height, p->type); | 759 | p->width, p->height, p->type); |
765 | switch (p->type) { | 760 | switch (p->type) { |
766 | case V4L2_FRMIVAL_TYPE_DISCRETE: | 761 | case V4L2_FRMIVAL_TYPE_DISCRETE: |
767 | pr_cont(" fps=%d/%d\n", | 762 | pr_cont(", fps=%d/%d\n", |
768 | p->discrete.numerator, | 763 | p->discrete.numerator, |
769 | p->discrete.denominator); | 764 | p->discrete.denominator); |
770 | break; | 765 | break; |
771 | case V4L2_FRMIVAL_TYPE_STEPWISE: | 766 | case V4L2_FRMIVAL_TYPE_STEPWISE: |
772 | pr_cont(" min=%d/%d, max=%d/%d, step=%d/%d\n", | 767 | pr_cont(", min=%d/%d, max=%d/%d, step=%d/%d\n", |
773 | p->stepwise.min.numerator, | 768 | p->stepwise.min.numerator, |
774 | p->stepwise.min.denominator, | 769 | p->stepwise.min.denominator, |
775 | p->stepwise.max.numerator, | 770 | p->stepwise.max.numerator, |
@@ -807,8 +802,8 @@ static void v4l_print_event(const void *arg, bool write_only) | |||
807 | pr_cont("value64=%lld, ", c->value64); | 802 | pr_cont("value64=%lld, ", c->value64); |
808 | else | 803 | else |
809 | pr_cont("value=%d, ", c->value); | 804 | pr_cont("value=%d, ", c->value); |
810 | pr_cont("flags=0x%x, minimum=%d, maximum=%d, step=%d," | 805 | pr_cont("flags=0x%x, minimum=%d, maximum=%d, step=%d, " |
811 | " default_value=%d\n", | 806 | "default_value=%d\n", |
812 | c->flags, c->minimum, c->maximum, | 807 | c->flags, c->minimum, c->maximum, |
813 | c->step, c->default_value); | 808 | c->step, c->default_value); |
814 | break; | 809 | break; |
@@ -845,7 +840,7 @@ static void v4l_print_freq_band(const void *arg, bool write_only) | |||
845 | const struct v4l2_frequency_band *p = arg; | 840 | const struct v4l2_frequency_band *p = arg; |
846 | 841 | ||
847 | pr_cont("tuner=%u, type=%u, index=%u, capability=0x%x, " | 842 | pr_cont("tuner=%u, type=%u, index=%u, capability=0x%x, " |
848 | "rangelow=%u, rangehigh=%u, modulation=0x%x\n", | 843 | "rangelow=%u, rangehigh=%u, modulation=0x%x\n", |
849 | p->tuner, p->type, p->index, | 844 | p->tuner, p->type, p->index, |
850 | p->capability, p->rangelow, | 845 | p->capability, p->rangelow, |
851 | p->rangehigh, p->modulation); | 846 | p->rangehigh, p->modulation); |
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 66f599fcb829..e96497f7c3ed 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c | |||
@@ -205,7 +205,7 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev) | |||
205 | static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx) | 205 | static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx) |
206 | { | 206 | { |
207 | struct v4l2_m2m_dev *m2m_dev; | 207 | struct v4l2_m2m_dev *m2m_dev; |
208 | unsigned long flags_job, flags; | 208 | unsigned long flags_job, flags_out, flags_cap; |
209 | 209 | ||
210 | m2m_dev = m2m_ctx->m2m_dev; | 210 | m2m_dev = m2m_ctx->m2m_dev; |
211 | dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx); | 211 | dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx); |
@@ -223,23 +223,26 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx) | |||
223 | return; | 223 | return; |
224 | } | 224 | } |
225 | 225 | ||
226 | spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); | 226 | spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out); |
227 | if (list_empty(&m2m_ctx->out_q_ctx.rdy_queue)) { | 227 | if (list_empty(&m2m_ctx->out_q_ctx.rdy_queue)) { |
228 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); | 228 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, |
229 | flags_out); | ||
229 | spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); | 230 | spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); |
230 | dprintk("No input buffers available\n"); | 231 | dprintk("No input buffers available\n"); |
231 | return; | 232 | return; |
232 | } | 233 | } |
233 | spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); | 234 | spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap); |
234 | if (list_empty(&m2m_ctx->cap_q_ctx.rdy_queue)) { | 235 | if (list_empty(&m2m_ctx->cap_q_ctx.rdy_queue)) { |
235 | spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); | 236 | spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, |
236 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); | 237 | flags_cap); |
238 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, | ||
239 | flags_out); | ||
237 | spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); | 240 | spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); |
238 | dprintk("No output buffers available\n"); | 241 | dprintk("No output buffers available\n"); |
239 | return; | 242 | return; |
240 | } | 243 | } |
241 | spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); | 244 | spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap); |
242 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); | 245 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out); |
243 | 246 | ||
244 | if (m2m_dev->m2m_ops->job_ready | 247 | if (m2m_dev->m2m_ops->job_ready |
245 | && (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) { | 248 | && (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) { |
@@ -372,6 +375,20 @@ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | |||
372 | EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf); | 375 | EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf); |
373 | 376 | ||
374 | /** | 377 | /** |
378 | * v4l2_m2m_create_bufs() - create a source or destination buffer, depending | ||
379 | * on the type | ||
380 | */ | ||
381 | int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | ||
382 | struct v4l2_create_buffers *create) | ||
383 | { | ||
384 | struct vb2_queue *vq; | ||
385 | |||
386 | vq = v4l2_m2m_get_vq(m2m_ctx, create->format.type); | ||
387 | return vb2_create_bufs(vq, create); | ||
388 | } | ||
389 | EXPORT_SYMBOL_GPL(v4l2_m2m_create_bufs); | ||
390 | |||
391 | /** | ||
375 | * v4l2_m2m_expbuf() - export a source or destination buffer, depending on | 392 | * v4l2_m2m_expbuf() - export a source or destination buffer, depending on |
376 | * the type | 393 | * the type |
377 | */ | 394 | */ |
@@ -486,8 +503,10 @@ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | |||
486 | if (m2m_ctx->m2m_dev->m2m_ops->unlock) | 503 | if (m2m_ctx->m2m_dev->m2m_ops->unlock) |
487 | m2m_ctx->m2m_dev->m2m_ops->unlock(m2m_ctx->priv); | 504 | m2m_ctx->m2m_dev->m2m_ops->unlock(m2m_ctx->priv); |
488 | 505 | ||
489 | poll_wait(file, &src_q->done_wq, wait); | 506 | if (list_empty(&src_q->done_list)) |
490 | poll_wait(file, &dst_q->done_wq, wait); | 507 | poll_wait(file, &src_q->done_wq, wait); |
508 | if (list_empty(&dst_q->done_list)) | ||
509 | poll_wait(file, &dst_q->done_wq, wait); | ||
491 | 510 | ||
492 | if (m2m_ctx->m2m_dev->m2m_ops->lock) | 511 | if (m2m_ctx->m2m_dev->m2m_ops->lock) |
493 | m2m_ctx->m2m_dev->m2m_ops->lock(m2m_ctx->priv); | 512 | m2m_ctx->m2m_dev->m2m_ops->lock(m2m_ctx->priv); |
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7d833eefaf4e..e3bdc3be91e1 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -2014,7 +2014,8 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) | |||
2014 | if (list_empty(&q->queued_list)) | 2014 | if (list_empty(&q->queued_list)) |
2015 | return res | POLLERR; | 2015 | return res | POLLERR; |
2016 | 2016 | ||
2017 | poll_wait(file, &q->done_wq, wait); | 2017 | if (list_empty(&q->done_list)) |
2018 | poll_wait(file, &q->done_wq, wait); | ||
2018 | 2019 | ||
2019 | /* | 2020 | /* |
2020 | * Take first buffer available for dequeuing. | 2021 | * Take first buffer available for dequeuing. |
diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index cadf1cc19aaf..04644e7b42b1 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c | |||
@@ -1560,12 +1560,6 @@ static int __init_or_module emif_probe(struct platform_device *pdev) | |||
1560 | platform_set_drvdata(pdev, emif); | 1560 | platform_set_drvdata(pdev, emif); |
1561 | 1561 | ||
1562 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1562 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1563 | if (!res) { | ||
1564 | dev_err(emif->dev, "%s: error getting memory resource\n", | ||
1565 | __func__); | ||
1566 | goto error; | ||
1567 | } | ||
1568 | |||
1569 | emif->base = devm_ioremap_resource(emif->dev, res); | 1563 | emif->base = devm_ioremap_resource(emif->dev, res); |
1570 | if (IS_ERR(emif->base)) | 1564 | if (IS_ERR(emif->base)) |
1571 | goto error; | 1565 | goto error; |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index d9aed1593e5d..d54e985748b7 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -579,7 +579,7 @@ config AB8500_CORE | |||
579 | 579 | ||
580 | config AB8500_DEBUG | 580 | config AB8500_DEBUG |
581 | bool "Enable debug info via debugfs" | 581 | bool "Enable debug info via debugfs" |
582 | depends on AB8500_CORE && DEBUG_FS | 582 | depends on AB8500_GPADC && DEBUG_FS |
583 | default y if DEBUG_FS | 583 | default y if DEBUG_FS |
584 | help | 584 | help |
585 | Select this option if you want debug information using the debug | 585 | Select this option if you want debug information using the debug |
@@ -818,6 +818,7 @@ config MFD_TPS65910 | |||
818 | config MFD_TPS65912 | 818 | config MFD_TPS65912 |
819 | bool "TI TPS65912 Power Management chip" | 819 | bool "TI TPS65912 Power Management chip" |
820 | depends on GPIOLIB | 820 | depends on GPIOLIB |
821 | select MFD_CORE | ||
821 | help | 822 | help |
822 | If you say yes here you get support for the TPS65912 series of | 823 | If you say yes here you get support for the TPS65912 series of |
823 | PM chips. | 824 | PM chips. |
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 8e8a016effe9..258b367e3989 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
@@ -868,6 +868,15 @@ static struct resource ab8500_chargalg_resources[] = {}; | |||
868 | #ifdef CONFIG_DEBUG_FS | 868 | #ifdef CONFIG_DEBUG_FS |
869 | static struct resource ab8500_debug_resources[] = { | 869 | static struct resource ab8500_debug_resources[] = { |
870 | { | 870 | { |
871 | .name = "IRQ_AB8500", | ||
872 | /* | ||
873 | * Number will be filled in. NOTE: this is deliberately | ||
874 | * not flagged as an IRQ in ordet to avoid remapping using | ||
875 | * the irqdomain in the MFD core, so that this IRQ passes | ||
876 | * unremapped to the debug code. | ||
877 | */ | ||
878 | }, | ||
879 | { | ||
871 | .name = "IRQ_FIRST", | 880 | .name = "IRQ_FIRST", |
872 | .start = AB8500_INT_MAIN_EXT_CH_NOT_OK, | 881 | .start = AB8500_INT_MAIN_EXT_CH_NOT_OK, |
873 | .end = AB8500_INT_MAIN_EXT_CH_NOT_OK, | 882 | .end = AB8500_INT_MAIN_EXT_CH_NOT_OK, |
@@ -1051,6 +1060,7 @@ static struct mfd_cell ab8500_devs[] = { | |||
1051 | }, | 1060 | }, |
1052 | { | 1061 | { |
1053 | .name = "ab8500-gpadc", | 1062 | .name = "ab8500-gpadc", |
1063 | .of_compatible = "stericsson,ab8500-gpadc", | ||
1054 | .num_resources = ARRAY_SIZE(ab8500_gpadc_resources), | 1064 | .num_resources = ARRAY_SIZE(ab8500_gpadc_resources), |
1055 | .resources = ab8500_gpadc_resources, | 1065 | .resources = ab8500_gpadc_resources, |
1056 | }, | 1066 | }, |
@@ -1097,7 +1107,7 @@ static struct mfd_cell ab8500_devs[] = { | |||
1097 | .of_compatible = "stericsson,ab8500-denc", | 1107 | .of_compatible = "stericsson,ab8500-denc", |
1098 | }, | 1108 | }, |
1099 | { | 1109 | { |
1100 | .name = "ab8500-gpio", | 1110 | .name = "pinctrl-ab8500", |
1101 | .of_compatible = "stericsson,ab8500-gpio", | 1111 | .of_compatible = "stericsson,ab8500-gpio", |
1102 | }, | 1112 | }, |
1103 | { | 1113 | { |
@@ -1208,6 +1218,7 @@ static struct mfd_cell ab8505_devs[] = { | |||
1208 | }, | 1218 | }, |
1209 | { | 1219 | { |
1210 | .name = "ab8500-gpadc", | 1220 | .name = "ab8500-gpadc", |
1221 | .of_compatible = "stericsson,ab8500-gpadc", | ||
1211 | .num_resources = ARRAY_SIZE(ab8505_gpadc_resources), | 1222 | .num_resources = ARRAY_SIZE(ab8505_gpadc_resources), |
1212 | .resources = ab8505_gpadc_resources, | 1223 | .resources = ab8505_gpadc_resources, |
1213 | }, | 1224 | }, |
@@ -1234,7 +1245,7 @@ static struct mfd_cell ab8505_devs[] = { | |||
1234 | .name = "ab8500-leds", | 1245 | .name = "ab8500-leds", |
1235 | }, | 1246 | }, |
1236 | { | 1247 | { |
1237 | .name = "ab8500-gpio", | 1248 | .name = "pinctrl-ab8505", |
1238 | }, | 1249 | }, |
1239 | { | 1250 | { |
1240 | .name = "ab8500-usb", | 1251 | .name = "ab8500-usb", |
@@ -1271,6 +1282,7 @@ static struct mfd_cell ab8540_devs[] = { | |||
1271 | }, | 1282 | }, |
1272 | { | 1283 | { |
1273 | .name = "ab8500-gpadc", | 1284 | .name = "ab8500-gpadc", |
1285 | .of_compatible = "stericsson,ab8500-gpadc", | ||
1274 | .num_resources = ARRAY_SIZE(ab8505_gpadc_resources), | 1286 | .num_resources = ARRAY_SIZE(ab8505_gpadc_resources), |
1275 | .resources = ab8505_gpadc_resources, | 1287 | .resources = ab8505_gpadc_resources, |
1276 | }, | 1288 | }, |
@@ -1302,7 +1314,7 @@ static struct mfd_cell ab8540_devs[] = { | |||
1302 | .resources = ab8500_temp_resources, | 1314 | .resources = ab8500_temp_resources, |
1303 | }, | 1315 | }, |
1304 | { | 1316 | { |
1305 | .name = "ab8500-gpio", | 1317 | .name = "pinctrl-ab8540", |
1306 | }, | 1318 | }, |
1307 | { | 1319 | { |
1308 | .name = "ab8540-usb", | 1320 | .name = "ab8540-usb", |
@@ -1712,6 +1724,12 @@ static int ab8500_probe(struct platform_device *pdev) | |||
1712 | if (ret) | 1724 | if (ret) |
1713 | return ret; | 1725 | return ret; |
1714 | 1726 | ||
1727 | #if CONFIG_DEBUG_FS | ||
1728 | /* Pass to debugfs */ | ||
1729 | ab8500_debug_resources[0].start = ab8500->irq; | ||
1730 | ab8500_debug_resources[0].end = ab8500->irq; | ||
1731 | #endif | ||
1732 | |||
1715 | if (is_ab9540(ab8500)) | 1733 | if (is_ab9540(ab8500)) |
1716 | ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, | 1734 | ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, |
1717 | ARRAY_SIZE(ab9540_devs), NULL, | 1735 | ARRAY_SIZE(ab9540_devs), NULL, |
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index b88bbbc15f1e..37b7ce4c7c3b 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c | |||
@@ -91,12 +91,10 @@ | |||
91 | #include <linux/ctype.h> | 91 | #include <linux/ctype.h> |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | /* TODO: this file should not reference IRQ_DB8500_AB8500! */ | ||
95 | #include <mach/irqs.h> | ||
96 | |||
97 | static u32 debug_bank; | 94 | static u32 debug_bank; |
98 | static u32 debug_address; | 95 | static u32 debug_address; |
99 | 96 | ||
97 | static int irq_ab8500; | ||
100 | static int irq_first; | 98 | static int irq_first; |
101 | static int irq_last; | 99 | static int irq_last; |
102 | static u32 *irq_count; | 100 | static u32 *irq_count; |
@@ -1589,7 +1587,7 @@ void ab8500_debug_register_interrupt(int line) | |||
1589 | { | 1587 | { |
1590 | if (line < num_interrupt_lines) { | 1588 | if (line < num_interrupt_lines) { |
1591 | num_interrupts[line]++; | 1589 | num_interrupts[line]++; |
1592 | if (suspend_test_wake_cause_interrupt_is_mine(IRQ_DB8500_AB8500)) | 1590 | if (suspend_test_wake_cause_interrupt_is_mine(irq_ab8500)) |
1593 | num_wake_interrupts[line]++; | 1591 | num_wake_interrupts[line]++; |
1594 | } | 1592 | } |
1595 | } | 1593 | } |
@@ -2941,6 +2939,7 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
2941 | struct dentry *file; | 2939 | struct dentry *file; |
2942 | int ret = -ENOMEM; | 2940 | int ret = -ENOMEM; |
2943 | struct ab8500 *ab8500; | 2941 | struct ab8500 *ab8500; |
2942 | struct resource *res; | ||
2944 | debug_bank = AB8500_MISC; | 2943 | debug_bank = AB8500_MISC; |
2945 | debug_address = AB8500_REV_REG & 0x00FF; | 2944 | debug_address = AB8500_REV_REG & 0x00FF; |
2946 | 2945 | ||
@@ -2959,6 +2958,15 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
2959 | if (!event_name) | 2958 | if (!event_name) |
2960 | goto out_freedev_attr; | 2959 | goto out_freedev_attr; |
2961 | 2960 | ||
2961 | res = platform_get_resource_byname(plf, 0, "IRQ_AB8500"); | ||
2962 | if (!res) { | ||
2963 | dev_err(&plf->dev, "AB8500 irq not found, err %d\n", | ||
2964 | irq_first); | ||
2965 | ret = -ENXIO; | ||
2966 | goto out_freeevent_name; | ||
2967 | } | ||
2968 | irq_ab8500 = res->start; | ||
2969 | |||
2962 | irq_first = platform_get_irq_byname(plf, "IRQ_FIRST"); | 2970 | irq_first = platform_get_irq_byname(plf, "IRQ_FIRST"); |
2963 | if (irq_first < 0) { | 2971 | if (irq_first < 0) { |
2964 | dev_err(&plf->dev, "First irq not found, err %d\n", | 2972 | dev_err(&plf->dev, "First irq not found, err %d\n", |
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c index 5e65b28a5d09..13f7866de46e 100644 --- a/drivers/mfd/ab8500-gpadc.c +++ b/drivers/mfd/ab8500-gpadc.c | |||
@@ -907,14 +907,17 @@ static int ab8500_gpadc_suspend(struct device *dev) | |||
907 | static int ab8500_gpadc_resume(struct device *dev) | 907 | static int ab8500_gpadc_resume(struct device *dev) |
908 | { | 908 | { |
909 | struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); | 909 | struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); |
910 | int ret; | ||
910 | 911 | ||
911 | regulator_enable(gpadc->regu); | 912 | ret = regulator_enable(gpadc->regu); |
913 | if (ret) | ||
914 | dev_err(dev, "Failed to enable vtvout LDO: %d\n", ret); | ||
912 | 915 | ||
913 | pm_runtime_mark_last_busy(gpadc->dev); | 916 | pm_runtime_mark_last_busy(gpadc->dev); |
914 | pm_runtime_put_autosuspend(gpadc->dev); | 917 | pm_runtime_put_autosuspend(gpadc->dev); |
915 | 918 | ||
916 | mutex_unlock(&gpadc->ab8500_gpadc_lock); | 919 | mutex_unlock(&gpadc->ab8500_gpadc_lock); |
917 | return 0; | 920 | return ret; |
918 | } | 921 | } |
919 | 922 | ||
920 | static int ab8500_gpadc_probe(struct platform_device *pdev) | 923 | static int ab8500_gpadc_probe(struct platform_device *pdev) |
diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c index fbca1ced49fa..8e0dae59844d 100644 --- a/drivers/mfd/ab8500-sysctrl.c +++ b/drivers/mfd/ab8500-sysctrl.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | static struct device *sysctrl_dev; | 24 | static struct device *sysctrl_dev; |
25 | 25 | ||
26 | void ab8500_power_off(void) | 26 | static void ab8500_power_off(void) |
27 | { | 27 | { |
28 | sigset_t old; | 28 | sigset_t old; |
29 | sigset_t all; | 29 | sigset_t all; |
@@ -104,7 +104,7 @@ void ab8500_restart(char mode, const char *cmd) | |||
104 | 104 | ||
105 | plat = dev_get_platdata(sysctrl_dev->parent); | 105 | plat = dev_get_platdata(sysctrl_dev->parent); |
106 | pdata = plat->sysctrl; | 106 | pdata = plat->sysctrl; |
107 | if (pdata->reboot_reason_code) | 107 | if (pdata && pdata->reboot_reason_code) |
108 | reason = pdata->reboot_reason_code(cmd); | 108 | reason = pdata->reboot_reason_code(cmd); |
109 | else | 109 | else |
110 | pr_warn("[%s] No reboot reason set. Default reason %d\n", | 110 | pr_warn("[%s] No reboot reason set. Default reason %d\n", |
@@ -188,14 +188,15 @@ static int ab8500_sysctrl_probe(struct platform_device *pdev) | |||
188 | 188 | ||
189 | plat = dev_get_platdata(pdev->dev.parent); | 189 | plat = dev_get_platdata(pdev->dev.parent); |
190 | 190 | ||
191 | if (!(plat && plat->sysctrl)) | 191 | if (!plat) |
192 | return -EINVAL; | 192 | return -EINVAL; |
193 | 193 | ||
194 | if (plat->pm_power_off) | 194 | sysctrl_dev = &pdev->dev; |
195 | |||
196 | if (!pm_power_off) | ||
195 | pm_power_off = ab8500_power_off; | 197 | pm_power_off = ab8500_power_off; |
196 | 198 | ||
197 | pdata = plat->sysctrl; | 199 | pdata = plat->sysctrl; |
198 | |||
199 | if (pdata) { | 200 | if (pdata) { |
200 | int last, ret, i, j; | 201 | int last, ret, i, j; |
201 | 202 | ||
@@ -226,6 +227,10 @@ static int ab8500_sysctrl_probe(struct platform_device *pdev) | |||
226 | static int ab8500_sysctrl_remove(struct platform_device *pdev) | 227 | static int ab8500_sysctrl_remove(struct platform_device *pdev) |
227 | { | 228 | { |
228 | sysctrl_dev = NULL; | 229 | sysctrl_dev = NULL; |
230 | |||
231 | if (pm_power_off == ab8500_power_off) | ||
232 | pm_power_off = NULL; | ||
233 | |||
229 | return 0; | 234 | return 0; |
230 | } | 235 | } |
231 | 236 | ||
diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c index 9818afba2515..3714acb61458 100644 --- a/drivers/mfd/abx500-core.c +++ b/drivers/mfd/abx500-core.c | |||
@@ -156,7 +156,7 @@ EXPORT_SYMBOL(abx500_startup_irq_enabled); | |||
156 | void abx500_dump_all_banks(void) | 156 | void abx500_dump_all_banks(void) |
157 | { | 157 | { |
158 | struct abx500_ops *ops; | 158 | struct abx500_ops *ops; |
159 | struct device dummy_child = {0}; | 159 | struct device dummy_child = {NULL}; |
160 | struct abx500_device_entry *dev_entry; | 160 | struct abx500_device_entry *dev_entry; |
161 | 161 | ||
162 | list_for_each_entry(dev_entry, &abx500_list, list) { | 162 | list_for_each_entry(dev_entry, &abx500_list, list) { |
diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c index 19193cf1e7a1..367ccb58ecb1 100644 --- a/drivers/mfd/cros_ec_spi.c +++ b/drivers/mfd/cros_ec_spi.c | |||
@@ -120,7 +120,7 @@ static int cros_ec_spi_receive_response(struct cros_ec_device *ec_dev, | |||
120 | 120 | ||
121 | for (end = ptr + EC_MSG_PREAMBLE_COUNT; ptr != end; ptr++) { | 121 | for (end = ptr + EC_MSG_PREAMBLE_COUNT; ptr != end; ptr++) { |
122 | if (*ptr == EC_MSG_HEADER) { | 122 | if (*ptr == EC_MSG_HEADER) { |
123 | dev_dbg(ec_dev->dev, "msg found at %ld\n", | 123 | dev_dbg(ec_dev->dev, "msg found at %zd\n", |
124 | ptr - ec_dev->din); | 124 | ptr - ec_dev->din); |
125 | break; | 125 | break; |
126 | } | 126 | } |
@@ -154,7 +154,7 @@ static int cros_ec_spi_receive_response(struct cros_ec_device *ec_dev, | |||
154 | * maximum-supported transfer size. | 154 | * maximum-supported transfer size. |
155 | */ | 155 | */ |
156 | todo = min(need_len, 256); | 156 | todo = min(need_len, 256); |
157 | dev_dbg(ec_dev->dev, "loop, todo=%d, need_len=%d, ptr=%ld\n", | 157 | dev_dbg(ec_dev->dev, "loop, todo=%d, need_len=%d, ptr=%zd\n", |
158 | todo, need_len, ptr - ec_dev->din); | 158 | todo, need_len, ptr - ec_dev->din); |
159 | 159 | ||
160 | memset(&trans, '\0', sizeof(trans)); | 160 | memset(&trans, '\0', sizeof(trans)); |
@@ -178,7 +178,7 @@ static int cros_ec_spi_receive_response(struct cros_ec_device *ec_dev, | |||
178 | need_len -= todo; | 178 | need_len -= todo; |
179 | } | 179 | } |
180 | 180 | ||
181 | dev_dbg(ec_dev->dev, "loop done, ptr=%ld\n", ptr - ec_dev->din); | 181 | dev_dbg(ec_dev->dev, "loop done, ptr=%zd\n", ptr - ec_dev->din); |
182 | 182 | ||
183 | return 0; | 183 | return 0; |
184 | } | 184 | } |
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 319b8abe742b..66f80973596b 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c | |||
@@ -1613,6 +1613,8 @@ static unsigned long dsiclk_rate(u8 n) | |||
1613 | 1613 | ||
1614 | if (divsel == PRCM_DSI_PLLOUT_SEL_OFF) | 1614 | if (divsel == PRCM_DSI_PLLOUT_SEL_OFF) |
1615 | divsel = dsiclk[n].divsel; | 1615 | divsel = dsiclk[n].divsel; |
1616 | else | ||
1617 | dsiclk[n].divsel = divsel; | ||
1616 | 1618 | ||
1617 | switch (divsel) { | 1619 | switch (divsel) { |
1618 | case PRCM_DSI_PLLOUT_SEL_PHI_4: | 1620 | case PRCM_DSI_PLLOUT_SEL_PHI_4: |
@@ -3095,6 +3097,7 @@ static struct mfd_cell db8500_prcmu_devs[] = { | |||
3095 | .num_resources = ARRAY_SIZE(db8500_thsens_resources), | 3097 | .num_resources = ARRAY_SIZE(db8500_thsens_resources), |
3096 | .resources = db8500_thsens_resources, | 3098 | .resources = db8500_thsens_resources, |
3097 | .platform_data = &db8500_thsens_data, | 3099 | .platform_data = &db8500_thsens_data, |
3100 | .pdata_size = sizeof(db8500_thsens_data), | ||
3098 | }, | 3101 | }, |
3099 | }; | 3102 | }; |
3100 | 3103 | ||
diff --git a/drivers/mfd/intel_msic.c b/drivers/mfd/intel_msic.c index 5be3b5e13855..d8d5137f9717 100644 --- a/drivers/mfd/intel_msic.c +++ b/drivers/mfd/intel_msic.c | |||
@@ -414,11 +414,6 @@ static int intel_msic_probe(struct platform_device *pdev) | |||
414 | * the clients via intel_msic_irq_read(). | 414 | * the clients via intel_msic_irq_read(). |
415 | */ | 415 | */ |
416 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 416 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
417 | if (!res) { | ||
418 | dev_err(&pdev->dev, "failed to get SRAM iomem resource\n"); | ||
419 | return -ENODEV; | ||
420 | } | ||
421 | |||
422 | msic->irq_base = devm_ioremap_resource(&pdev->dev, res); | 417 | msic->irq_base = devm_ioremap_resource(&pdev->dev, res); |
423 | if (IS_ERR(msic->irq_base)) | 418 | if (IS_ERR(msic->irq_base)) |
424 | return PTR_ERR(msic->irq_base); | 419 | return PTR_ERR(msic->irq_base); |
diff --git a/drivers/mfd/si476x-cmd.c b/drivers/mfd/si476x-cmd.c index de48b4e88450..6f1ef63086c9 100644 --- a/drivers/mfd/si476x-cmd.c +++ b/drivers/mfd/si476x-cmd.c | |||
@@ -29,6 +29,8 @@ | |||
29 | 29 | ||
30 | #include <linux/mfd/si476x-core.h> | 30 | #include <linux/mfd/si476x-core.h> |
31 | 31 | ||
32 | #include <asm/unaligned.h> | ||
33 | |||
32 | #define msb(x) ((u8)((u16) x >> 8)) | 34 | #define msb(x) ((u8)((u16) x >> 8)) |
33 | #define lsb(x) ((u8)((u16) x & 0x00FF)) | 35 | #define lsb(x) ((u8)((u16) x & 0x00FF)) |
34 | 36 | ||
@@ -150,7 +152,7 @@ enum si476x_acf_status_report_bits { | |||
150 | SI476X_ACF_SOFTMUTE_INT = (1 << 0), | 152 | SI476X_ACF_SOFTMUTE_INT = (1 << 0), |
151 | 153 | ||
152 | SI476X_ACF_SMUTE = (1 << 0), | 154 | SI476X_ACF_SMUTE = (1 << 0), |
153 | SI476X_ACF_SMATTN = 0b11111, | 155 | SI476X_ACF_SMATTN = 0x1f, |
154 | SI476X_ACF_PILOT = (1 << 7), | 156 | SI476X_ACF_PILOT = (1 << 7), |
155 | SI476X_ACF_STBLEND = ~SI476X_ACF_PILOT, | 157 | SI476X_ACF_STBLEND = ~SI476X_ACF_PILOT, |
156 | }; | 158 | }; |
@@ -483,7 +485,7 @@ int si476x_core_cmd_get_property(struct si476x_core *core, u16 property) | |||
483 | if (err < 0) | 485 | if (err < 0) |
484 | return err; | 486 | return err; |
485 | else | 487 | else |
486 | return be16_to_cpup((__be16 *)(resp + 2)); | 488 | return get_unaligned_be16(resp + 2); |
487 | } | 489 | } |
488 | EXPORT_SYMBOL_GPL(si476x_core_cmd_get_property); | 490 | EXPORT_SYMBOL_GPL(si476x_core_cmd_get_property); |
489 | 491 | ||
@@ -772,18 +774,18 @@ int si476x_core_cmd_am_rsq_status(struct si476x_core *core, | |||
772 | if (!report) | 774 | if (!report) |
773 | return err; | 775 | return err; |
774 | 776 | ||
775 | report->snrhint = 0b00001000 & resp[1]; | 777 | report->snrhint = 0x08 & resp[1]; |
776 | report->snrlint = 0b00000100 & resp[1]; | 778 | report->snrlint = 0x04 & resp[1]; |
777 | report->rssihint = 0b00000010 & resp[1]; | 779 | report->rssihint = 0x02 & resp[1]; |
778 | report->rssilint = 0b00000001 & resp[1]; | 780 | report->rssilint = 0x01 & resp[1]; |
779 | 781 | ||
780 | report->bltf = 0b10000000 & resp[2]; | 782 | report->bltf = 0x80 & resp[2]; |
781 | report->snr_ready = 0b00100000 & resp[2]; | 783 | report->snr_ready = 0x20 & resp[2]; |
782 | report->rssiready = 0b00001000 & resp[2]; | 784 | report->rssiready = 0x08 & resp[2]; |
783 | report->afcrl = 0b00000010 & resp[2]; | 785 | report->afcrl = 0x02 & resp[2]; |
784 | report->valid = 0b00000001 & resp[2]; | 786 | report->valid = 0x01 & resp[2]; |
785 | 787 | ||
786 | report->readfreq = be16_to_cpup((__be16 *)(resp + 3)); | 788 | report->readfreq = get_unaligned_be16(resp + 3); |
787 | report->freqoff = resp[5]; | 789 | report->freqoff = resp[5]; |
788 | report->rssi = resp[6]; | 790 | report->rssi = resp[6]; |
789 | report->snr = resp[7]; | 791 | report->snr = resp[7]; |
@@ -931,26 +933,26 @@ int si476x_core_cmd_fm_rds_status(struct si476x_core *core, | |||
931 | if (err < 0 || report == NULL) | 933 | if (err < 0 || report == NULL) |
932 | return err; | 934 | return err; |
933 | 935 | ||
934 | report->rdstpptyint = 0b00010000 & resp[1]; | 936 | report->rdstpptyint = 0x10 & resp[1]; |
935 | report->rdspiint = 0b00001000 & resp[1]; | 937 | report->rdspiint = 0x08 & resp[1]; |
936 | report->rdssyncint = 0b00000010 & resp[1]; | 938 | report->rdssyncint = 0x02 & resp[1]; |
937 | report->rdsfifoint = 0b00000001 & resp[1]; | 939 | report->rdsfifoint = 0x01 & resp[1]; |
938 | 940 | ||
939 | report->tpptyvalid = 0b00010000 & resp[2]; | 941 | report->tpptyvalid = 0x10 & resp[2]; |
940 | report->pivalid = 0b00001000 & resp[2]; | 942 | report->pivalid = 0x08 & resp[2]; |
941 | report->rdssync = 0b00000010 & resp[2]; | 943 | report->rdssync = 0x02 & resp[2]; |
942 | report->rdsfifolost = 0b00000001 & resp[2]; | 944 | report->rdsfifolost = 0x01 & resp[2]; |
943 | 945 | ||
944 | report->tp = 0b00100000 & resp[3]; | 946 | report->tp = 0x20 & resp[3]; |
945 | report->pty = 0b00011111 & resp[3]; | 947 | report->pty = 0x1f & resp[3]; |
946 | 948 | ||
947 | report->pi = be16_to_cpup((__be16 *)(resp + 4)); | 949 | report->pi = get_unaligned_be16(resp + 4); |
948 | report->rdsfifoused = resp[6]; | 950 | report->rdsfifoused = resp[6]; |
949 | 951 | ||
950 | report->ble[V4L2_RDS_BLOCK_A] = 0b11000000 & resp[7]; | 952 | report->ble[V4L2_RDS_BLOCK_A] = 0xc0 & resp[7]; |
951 | report->ble[V4L2_RDS_BLOCK_B] = 0b00110000 & resp[7]; | 953 | report->ble[V4L2_RDS_BLOCK_B] = 0x30 & resp[7]; |
952 | report->ble[V4L2_RDS_BLOCK_C] = 0b00001100 & resp[7]; | 954 | report->ble[V4L2_RDS_BLOCK_C] = 0x0c & resp[7]; |
953 | report->ble[V4L2_RDS_BLOCK_D] = 0b00000011 & resp[7]; | 955 | report->ble[V4L2_RDS_BLOCK_D] = 0x03 & resp[7]; |
954 | 956 | ||
955 | report->rds[V4L2_RDS_BLOCK_A].block = V4L2_RDS_BLOCK_A; | 957 | report->rds[V4L2_RDS_BLOCK_A].block = V4L2_RDS_BLOCK_A; |
956 | report->rds[V4L2_RDS_BLOCK_A].msb = resp[8]; | 958 | report->rds[V4L2_RDS_BLOCK_A].msb = resp[8]; |
@@ -991,9 +993,9 @@ int si476x_core_cmd_fm_rds_blockcount(struct si476x_core *core, | |||
991 | SI476X_DEFAULT_TIMEOUT); | 993 | SI476X_DEFAULT_TIMEOUT); |
992 | 994 | ||
993 | if (!err) { | 995 | if (!err) { |
994 | report->expected = be16_to_cpup((__be16 *)(resp + 2)); | 996 | report->expected = get_unaligned_be16(resp + 2); |
995 | report->received = be16_to_cpup((__be16 *)(resp + 4)); | 997 | report->received = get_unaligned_be16(resp + 4); |
996 | report->uncorrectable = be16_to_cpup((__be16 *)(resp + 6)); | 998 | report->uncorrectable = get_unaligned_be16(resp + 6); |
997 | } | 999 | } |
998 | 1000 | ||
999 | return err; | 1001 | return err; |
@@ -1005,7 +1007,7 @@ int si476x_core_cmd_fm_phase_diversity(struct si476x_core *core, | |||
1005 | { | 1007 | { |
1006 | u8 resp[CMD_FM_PHASE_DIVERSITY_NRESP]; | 1008 | u8 resp[CMD_FM_PHASE_DIVERSITY_NRESP]; |
1007 | const u8 args[CMD_FM_PHASE_DIVERSITY_NARGS] = { | 1009 | const u8 args[CMD_FM_PHASE_DIVERSITY_NARGS] = { |
1008 | mode & 0b111, | 1010 | mode & 0x07, |
1009 | }; | 1011 | }; |
1010 | 1012 | ||
1011 | return si476x_core_send_command(core, CMD_FM_PHASE_DIVERSITY, | 1013 | return si476x_core_send_command(core, CMD_FM_PHASE_DIVERSITY, |
@@ -1162,7 +1164,7 @@ static int si476x_core_cmd_am_tune_freq_a20(struct si476x_core *core, | |||
1162 | const int am_freq = tuneargs->freq; | 1164 | const int am_freq = tuneargs->freq; |
1163 | u8 resp[CMD_AM_TUNE_FREQ_NRESP]; | 1165 | u8 resp[CMD_AM_TUNE_FREQ_NRESP]; |
1164 | const u8 args[CMD_AM_TUNE_FREQ_NARGS] = { | 1166 | const u8 args[CMD_AM_TUNE_FREQ_NARGS] = { |
1165 | (tuneargs->zifsr << 6) | (tuneargs->injside & 0b11), | 1167 | (tuneargs->zifsr << 6) | (tuneargs->injside & 0x03), |
1166 | msb(am_freq), | 1168 | msb(am_freq), |
1167 | lsb(am_freq), | 1169 | lsb(am_freq), |
1168 | }; | 1170 | }; |
@@ -1197,20 +1199,20 @@ static int si476x_core_cmd_fm_rsq_status_a10(struct si476x_core *core, | |||
1197 | if (err < 0 || report == NULL) | 1199 | if (err < 0 || report == NULL) |
1198 | return err; | 1200 | return err; |
1199 | 1201 | ||
1200 | report->multhint = 0b10000000 & resp[1]; | 1202 | report->multhint = 0x80 & resp[1]; |
1201 | report->multlint = 0b01000000 & resp[1]; | 1203 | report->multlint = 0x40 & resp[1]; |
1202 | report->snrhint = 0b00001000 & resp[1]; | 1204 | report->snrhint = 0x08 & resp[1]; |
1203 | report->snrlint = 0b00000100 & resp[1]; | 1205 | report->snrlint = 0x04 & resp[1]; |
1204 | report->rssihint = 0b00000010 & resp[1]; | 1206 | report->rssihint = 0x02 & resp[1]; |
1205 | report->rssilint = 0b00000001 & resp[1]; | 1207 | report->rssilint = 0x01 & resp[1]; |
1206 | 1208 | ||
1207 | report->bltf = 0b10000000 & resp[2]; | 1209 | report->bltf = 0x80 & resp[2]; |
1208 | report->snr_ready = 0b00100000 & resp[2]; | 1210 | report->snr_ready = 0x20 & resp[2]; |
1209 | report->rssiready = 0b00001000 & resp[2]; | 1211 | report->rssiready = 0x08 & resp[2]; |
1210 | report->afcrl = 0b00000010 & resp[2]; | 1212 | report->afcrl = 0x02 & resp[2]; |
1211 | report->valid = 0b00000001 & resp[2]; | 1213 | report->valid = 0x01 & resp[2]; |
1212 | 1214 | ||
1213 | report->readfreq = be16_to_cpup((__be16 *)(resp + 3)); | 1215 | report->readfreq = get_unaligned_be16(resp + 3); |
1214 | report->freqoff = resp[5]; | 1216 | report->freqoff = resp[5]; |
1215 | report->rssi = resp[6]; | 1217 | report->rssi = resp[6]; |
1216 | report->snr = resp[7]; | 1218 | report->snr = resp[7]; |
@@ -1218,7 +1220,7 @@ static int si476x_core_cmd_fm_rsq_status_a10(struct si476x_core *core, | |||
1218 | report->hassi = resp[10]; | 1220 | report->hassi = resp[10]; |
1219 | report->mult = resp[11]; | 1221 | report->mult = resp[11]; |
1220 | report->dev = resp[12]; | 1222 | report->dev = resp[12]; |
1221 | report->readantcap = be16_to_cpup((__be16 *)(resp + 13)); | 1223 | report->readantcap = get_unaligned_be16(resp + 13); |
1222 | report->assi = resp[15]; | 1224 | report->assi = resp[15]; |
1223 | report->usn = resp[16]; | 1225 | report->usn = resp[16]; |
1224 | 1226 | ||
@@ -1251,20 +1253,20 @@ static int si476x_core_cmd_fm_rsq_status_a20(struct si476x_core *core, | |||
1251 | if (err < 0 || report == NULL) | 1253 | if (err < 0 || report == NULL) |
1252 | return err; | 1254 | return err; |
1253 | 1255 | ||
1254 | report->multhint = 0b10000000 & resp[1]; | 1256 | report->multhint = 0x80 & resp[1]; |
1255 | report->multlint = 0b01000000 & resp[1]; | 1257 | report->multlint = 0x40 & resp[1]; |
1256 | report->snrhint = 0b00001000 & resp[1]; | 1258 | report->snrhint = 0x08 & resp[1]; |
1257 | report->snrlint = 0b00000100 & resp[1]; | 1259 | report->snrlint = 0x04 & resp[1]; |
1258 | report->rssihint = 0b00000010 & resp[1]; | 1260 | report->rssihint = 0x02 & resp[1]; |
1259 | report->rssilint = 0b00000001 & resp[1]; | 1261 | report->rssilint = 0x01 & resp[1]; |
1260 | 1262 | ||
1261 | report->bltf = 0b10000000 & resp[2]; | 1263 | report->bltf = 0x80 & resp[2]; |
1262 | report->snr_ready = 0b00100000 & resp[2]; | 1264 | report->snr_ready = 0x20 & resp[2]; |
1263 | report->rssiready = 0b00001000 & resp[2]; | 1265 | report->rssiready = 0x08 & resp[2]; |
1264 | report->afcrl = 0b00000010 & resp[2]; | 1266 | report->afcrl = 0x02 & resp[2]; |
1265 | report->valid = 0b00000001 & resp[2]; | 1267 | report->valid = 0x01 & resp[2]; |
1266 | 1268 | ||
1267 | report->readfreq = be16_to_cpup((__be16 *)(resp + 3)); | 1269 | report->readfreq = get_unaligned_be16(resp + 3); |
1268 | report->freqoff = resp[5]; | 1270 | report->freqoff = resp[5]; |
1269 | report->rssi = resp[6]; | 1271 | report->rssi = resp[6]; |
1270 | report->snr = resp[7]; | 1272 | report->snr = resp[7]; |
@@ -1272,7 +1274,7 @@ static int si476x_core_cmd_fm_rsq_status_a20(struct si476x_core *core, | |||
1272 | report->hassi = resp[10]; | 1274 | report->hassi = resp[10]; |
1273 | report->mult = resp[11]; | 1275 | report->mult = resp[11]; |
1274 | report->dev = resp[12]; | 1276 | report->dev = resp[12]; |
1275 | report->readantcap = be16_to_cpup((__be16 *)(resp + 13)); | 1277 | report->readantcap = get_unaligned_be16(resp + 13); |
1276 | report->assi = resp[15]; | 1278 | report->assi = resp[15]; |
1277 | report->usn = resp[16]; | 1279 | report->usn = resp[16]; |
1278 | 1280 | ||
@@ -1306,21 +1308,21 @@ static int si476x_core_cmd_fm_rsq_status_a30(struct si476x_core *core, | |||
1306 | if (err < 0 || report == NULL) | 1308 | if (err < 0 || report == NULL) |
1307 | return err; | 1309 | return err; |
1308 | 1310 | ||
1309 | report->multhint = 0b10000000 & resp[1]; | 1311 | report->multhint = 0x80 & resp[1]; |
1310 | report->multlint = 0b01000000 & resp[1]; | 1312 | report->multlint = 0x40 & resp[1]; |
1311 | report->snrhint = 0b00001000 & resp[1]; | 1313 | report->snrhint = 0x08 & resp[1]; |
1312 | report->snrlint = 0b00000100 & resp[1]; | 1314 | report->snrlint = 0x04 & resp[1]; |
1313 | report->rssihint = 0b00000010 & resp[1]; | 1315 | report->rssihint = 0x02 & resp[1]; |
1314 | report->rssilint = 0b00000001 & resp[1]; | 1316 | report->rssilint = 0x01 & resp[1]; |
1315 | 1317 | ||
1316 | report->bltf = 0b10000000 & resp[2]; | 1318 | report->bltf = 0x80 & resp[2]; |
1317 | report->snr_ready = 0b00100000 & resp[2]; | 1319 | report->snr_ready = 0x20 & resp[2]; |
1318 | report->rssiready = 0b00001000 & resp[2]; | 1320 | report->rssiready = 0x08 & resp[2]; |
1319 | report->injside = 0b00000100 & resp[2]; | 1321 | report->injside = 0x04 & resp[2]; |
1320 | report->afcrl = 0b00000010 & resp[2]; | 1322 | report->afcrl = 0x02 & resp[2]; |
1321 | report->valid = 0b00000001 & resp[2]; | 1323 | report->valid = 0x01 & resp[2]; |
1322 | 1324 | ||
1323 | report->readfreq = be16_to_cpup((__be16 *)(resp + 3)); | 1325 | report->readfreq = get_unaligned_be16(resp + 3); |
1324 | report->freqoff = resp[5]; | 1326 | report->freqoff = resp[5]; |
1325 | report->rssi = resp[6]; | 1327 | report->rssi = resp[6]; |
1326 | report->snr = resp[7]; | 1328 | report->snr = resp[7]; |
@@ -1329,7 +1331,7 @@ static int si476x_core_cmd_fm_rsq_status_a30(struct si476x_core *core, | |||
1329 | report->hassi = resp[10]; | 1331 | report->hassi = resp[10]; |
1330 | report->mult = resp[11]; | 1332 | report->mult = resp[11]; |
1331 | report->dev = resp[12]; | 1333 | report->dev = resp[12]; |
1332 | report->readantcap = be16_to_cpup((__be16 *)(resp + 13)); | 1334 | report->readantcap = get_unaligned_be16(resp + 13); |
1333 | report->assi = resp[15]; | 1335 | report->assi = resp[15]; |
1334 | report->usn = resp[16]; | 1336 | report->usn = resp[16]; |
1335 | 1337 | ||
@@ -1337,7 +1339,7 @@ static int si476x_core_cmd_fm_rsq_status_a30(struct si476x_core *core, | |||
1337 | report->rdsdev = resp[18]; | 1339 | report->rdsdev = resp[18]; |
1338 | report->assidev = resp[19]; | 1340 | report->assidev = resp[19]; |
1339 | report->strongdev = resp[20]; | 1341 | report->strongdev = resp[20]; |
1340 | report->rdspi = be16_to_cpup((__be16 *)(resp + 21)); | 1342 | report->rdspi = get_unaligned_be16(resp + 21); |
1341 | 1343 | ||
1342 | return err; | 1344 | return err; |
1343 | } | 1345 | } |
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index c09c28f92055..1abd5ad59925 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c | |||
@@ -154,11 +154,6 @@ static int ssc_probe(struct platform_device *pdev) | |||
154 | ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat; | 154 | ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat; |
155 | 155 | ||
156 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 156 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
157 | if (!regs) { | ||
158 | dev_dbg(&pdev->dev, "no mmio resource defined\n"); | ||
159 | return -ENXIO; | ||
160 | } | ||
161 | |||
162 | ssc->regs = devm_ioremap_resource(&pdev->dev, regs); | 157 | ssc->regs = devm_ioremap_resource(&pdev->dev, regs); |
163 | if (IS_ERR(ssc->regs)) | 158 | if (IS_ERR(ssc->regs)) |
164 | return PTR_ERR(ssc->regs); | 159 | return PTR_ERR(ssc->regs); |
diff --git a/drivers/misc/dummy-irq.c b/drivers/misc/dummy-irq.c index 7014167e2c61..c37eeedfe215 100644 --- a/drivers/misc/dummy-irq.c +++ b/drivers/misc/dummy-irq.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/irq.h> | 19 | #include <linux/irq.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | 21 | ||
22 | static int irq; | 22 | static int irq = -1; |
23 | 23 | ||
24 | static irqreturn_t dummy_interrupt(int irq, void *dev_id) | 24 | static irqreturn_t dummy_interrupt(int irq, void *dev_id) |
25 | { | 25 | { |
@@ -36,6 +36,10 @@ static irqreturn_t dummy_interrupt(int irq, void *dev_id) | |||
36 | 36 | ||
37 | static int __init dummy_irq_init(void) | 37 | static int __init dummy_irq_init(void) |
38 | { | 38 | { |
39 | if (irq < 0) { | ||
40 | printk(KERN_ERR "dummy-irq: no IRQ given. Use irq=N\n"); | ||
41 | return -EIO; | ||
42 | } | ||
39 | if (request_irq(irq, &dummy_interrupt, IRQF_SHARED, "dummy_irq", &irq)) { | 43 | if (request_irq(irq, &dummy_interrupt, IRQF_SHARED, "dummy_irq", &irq)) { |
40 | printk(KERN_ERR "dummy-irq: cannot register IRQ %d\n", irq); | 44 | printk(KERN_ERR "dummy-irq: cannot register IRQ %d\n", irq); |
41 | return -EIO; | 45 | return -EIO; |
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 1e935eacaa7f..9ecd49a7be1b 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c | |||
@@ -496,6 +496,8 @@ int mei_cl_disable_device(struct mei_cl_device *device) | |||
496 | } | 496 | } |
497 | } | 497 | } |
498 | 498 | ||
499 | device->event_cb = NULL; | ||
500 | |||
499 | mutex_unlock(&dev->device_lock); | 501 | mutex_unlock(&dev->device_lock); |
500 | 502 | ||
501 | if (!device->ops || !device->ops->disable) | 503 | if (!device->ops || !device->ops->disable) |
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index 713d89fedc46..f580d30bb784 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
@@ -197,6 +197,8 @@ void mei_stop(struct mei_device *dev) | |||
197 | { | 197 | { |
198 | dev_dbg(&dev->pdev->dev, "stopping the device.\n"); | 198 | dev_dbg(&dev->pdev->dev, "stopping the device.\n"); |
199 | 199 | ||
200 | flush_scheduled_work(); | ||
201 | |||
200 | mutex_lock(&dev->device_lock); | 202 | mutex_lock(&dev->device_lock); |
201 | 203 | ||
202 | cancel_delayed_work(&dev->timer_work); | 204 | cancel_delayed_work(&dev->timer_work); |
@@ -210,8 +212,6 @@ void mei_stop(struct mei_device *dev) | |||
210 | 212 | ||
211 | mutex_unlock(&dev->device_lock); | 213 | mutex_unlock(&dev->device_lock); |
212 | 214 | ||
213 | flush_scheduled_work(); | ||
214 | |||
215 | mei_watchdog_unregister(dev); | 215 | mei_watchdog_unregister(dev); |
216 | } | 216 | } |
217 | EXPORT_SYMBOL_GPL(mei_stop); | 217 | EXPORT_SYMBOL_GPL(mei_stop); |
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 7c44c8dbae42..053139f61086 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -489,11 +489,16 @@ static int mei_ioctl_connect_client(struct file *file, | |||
489 | 489 | ||
490 | /* find ME client we're trying to connect to */ | 490 | /* find ME client we're trying to connect to */ |
491 | i = mei_me_cl_by_uuid(dev, &data->in_client_uuid); | 491 | i = mei_me_cl_by_uuid(dev, &data->in_client_uuid); |
492 | if (i >= 0 && !dev->me_clients[i].props.fixed_address) { | 492 | if (i < 0 || dev->me_clients[i].props.fixed_address) { |
493 | cl->me_client_id = dev->me_clients[i].client_id; | 493 | dev_dbg(&dev->pdev->dev, "Cannot connect to FW Client UUID = %pUl\n", |
494 | cl->state = MEI_FILE_CONNECTING; | 494 | &data->in_client_uuid); |
495 | rets = -ENODEV; | ||
496 | goto end; | ||
495 | } | 497 | } |
496 | 498 | ||
499 | cl->me_client_id = dev->me_clients[i].client_id; | ||
500 | cl->state = MEI_FILE_CONNECTING; | ||
501 | |||
497 | dev_dbg(&dev->pdev->dev, "Connect to FW Client ID = %d\n", | 502 | dev_dbg(&dev->pdev->dev, "Connect to FW Client ID = %d\n", |
498 | cl->me_client_id); | 503 | cl->me_client_id); |
499 | dev_dbg(&dev->pdev->dev, "FW Client - Protocol Version = %d\n", | 504 | dev_dbg(&dev->pdev->dev, "FW Client - Protocol Version = %d\n", |
@@ -527,11 +532,6 @@ static int mei_ioctl_connect_client(struct file *file, | |||
527 | goto end; | 532 | goto end; |
528 | } | 533 | } |
529 | 534 | ||
530 | if (cl->state != MEI_FILE_CONNECTING) { | ||
531 | rets = -ENODEV; | ||
532 | goto end; | ||
533 | } | ||
534 | |||
535 | 535 | ||
536 | /* prepare the output buffer */ | 536 | /* prepare the output buffer */ |
537 | client = &data->out_client_properties; | 537 | client = &data->out_client_properties; |
@@ -543,7 +543,6 @@ static int mei_ioctl_connect_client(struct file *file, | |||
543 | rets = mei_cl_connect(cl, file); | 543 | rets = mei_cl_connect(cl, file); |
544 | 544 | ||
545 | end: | 545 | end: |
546 | dev_dbg(&dev->pdev->dev, "free connect cb memory."); | ||
547 | return rets; | 546 | return rets; |
548 | } | 547 | } |
549 | 548 | ||
diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c index 3adf8a70f26e..d0c6907dfd92 100644 --- a/drivers/misc/mei/nfc.c +++ b/drivers/misc/mei/nfc.c | |||
@@ -142,6 +142,8 @@ static void mei_nfc_free(struct mei_nfc_dev *ndev) | |||
142 | mei_cl_unlink(ndev->cl_info); | 142 | mei_cl_unlink(ndev->cl_info); |
143 | kfree(ndev->cl_info); | 143 | kfree(ndev->cl_info); |
144 | } | 144 | } |
145 | |||
146 | memset(ndev, 0, sizeof(struct mei_nfc_dev)); | ||
145 | } | 147 | } |
146 | 148 | ||
147 | static int mei_nfc_build_bus_name(struct mei_nfc_dev *ndev) | 149 | static int mei_nfc_build_bus_name(struct mei_nfc_dev *ndev) |
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index a727464e9c3f..0f268329bd3a 100644 --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c | |||
@@ -325,6 +325,7 @@ static int mei_me_pci_resume(struct device *device) | |||
325 | 325 | ||
326 | mutex_lock(&dev->device_lock); | 326 | mutex_lock(&dev->device_lock); |
327 | dev->dev_state = MEI_DEV_POWER_UP; | 327 | dev->dev_state = MEI_DEV_POWER_UP; |
328 | mei_clear_interrupts(dev); | ||
328 | mei_reset(dev, 1); | 329 | mei_reset(dev, 1); |
329 | mutex_unlock(&dev->device_lock); | 330 | mutex_unlock(&dev->device_lock); |
330 | 331 | ||
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index 44d273c5e19d..0535d1e0bc78 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
@@ -172,6 +172,7 @@ static long gru_get_config_info(unsigned long arg) | |||
172 | nodesperblade = 2; | 172 | nodesperblade = 2; |
173 | else | 173 | else |
174 | nodesperblade = 1; | 174 | nodesperblade = 1; |
175 | memset(&info, 0, sizeof(info)); | ||
175 | info.cpus = num_online_cpus(); | 176 | info.cpus = num_online_cpus(); |
176 | info.nodes = num_online_nodes(); | 177 | info.nodes = num_online_nodes(); |
177 | info.blades = info.nodes / nodesperblade; | 178 | info.blades = info.nodes / nodesperblade; |
diff --git a/drivers/misc/vmw_vmci/Kconfig b/drivers/misc/vmw_vmci/Kconfig index ea98f7e9ccd1..39c2ecadb273 100644 --- a/drivers/misc/vmw_vmci/Kconfig +++ b/drivers/misc/vmw_vmci/Kconfig | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | config VMWARE_VMCI | 5 | config VMWARE_VMCI |
6 | tristate "VMware VMCI Driver" | 6 | tristate "VMware VMCI Driver" |
7 | depends on X86 && PCI && NET | 7 | depends on X86 && PCI |
8 | help | 8 | help |
9 | This is VMware's Virtual Machine Communication Interface. It enables | 9 | This is VMware's Virtual Machine Communication Interface. It enables |
10 | high-speed communication between host and guest in a virtual | 10 | high-speed communication between host and guest in a virtual |
diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c index d94245dbd765..8ff2e5ee8fb8 100644 --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/pagemap.h> | 23 | #include <linux/pagemap.h> |
24 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/socket.h> | 26 | #include <linux/uio.h> |
27 | #include <linux/wait.h> | 27 | #include <linux/wait.h> |
28 | #include <linux/vmalloc.h> | 28 | #include <linux/vmalloc.h> |
29 | 29 | ||
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index e75774f72606..aca59d93d5a9 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -2230,10 +2230,15 @@ static void __exit atmci_cleanup_slot(struct atmel_mci_slot *slot, | |||
2230 | mmc_free_host(slot->mmc); | 2230 | mmc_free_host(slot->mmc); |
2231 | } | 2231 | } |
2232 | 2232 | ||
2233 | static bool atmci_filter(struct dma_chan *chan, void *slave) | 2233 | static bool atmci_filter(struct dma_chan *chan, void *pdata) |
2234 | { | 2234 | { |
2235 | struct mci_dma_data *sl = slave; | 2235 | struct mci_platform_data *sl_pdata = pdata; |
2236 | struct mci_dma_data *sl; | ||
2236 | 2237 | ||
2238 | if (!sl_pdata) | ||
2239 | return false; | ||
2240 | |||
2241 | sl = sl_pdata->dma_slave; | ||
2237 | if (sl && find_slave_dev(sl) == chan->device->dev) { | 2242 | if (sl && find_slave_dev(sl) == chan->device->dev) { |
2238 | chan->private = slave_data_ptr(sl); | 2243 | chan->private = slave_data_ptr(sl); |
2239 | return true; | 2244 | return true; |
@@ -2245,24 +2250,18 @@ static bool atmci_filter(struct dma_chan *chan, void *slave) | |||
2245 | static bool atmci_configure_dma(struct atmel_mci *host) | 2250 | static bool atmci_configure_dma(struct atmel_mci *host) |
2246 | { | 2251 | { |
2247 | struct mci_platform_data *pdata; | 2252 | struct mci_platform_data *pdata; |
2253 | dma_cap_mask_t mask; | ||
2248 | 2254 | ||
2249 | if (host == NULL) | 2255 | if (host == NULL) |
2250 | return false; | 2256 | return false; |
2251 | 2257 | ||
2252 | pdata = host->pdev->dev.platform_data; | 2258 | pdata = host->pdev->dev.platform_data; |
2253 | 2259 | ||
2254 | if (!pdata) | 2260 | dma_cap_zero(mask); |
2255 | return false; | 2261 | dma_cap_set(DMA_SLAVE, mask); |
2256 | 2262 | ||
2257 | if (pdata->dma_slave && find_slave_dev(pdata->dma_slave)) { | 2263 | host->dma.chan = dma_request_slave_channel_compat(mask, atmci_filter, pdata, |
2258 | dma_cap_mask_t mask; | 2264 | &host->pdev->dev, "rxtx"); |
2259 | |||
2260 | /* Try to grab a DMA channel */ | ||
2261 | dma_cap_zero(mask); | ||
2262 | dma_cap_set(DMA_SLAVE, mask); | ||
2263 | host->dma.chan = | ||
2264 | dma_request_channel(mask, atmci_filter, pdata->dma_slave); | ||
2265 | } | ||
2266 | if (!host->dma.chan) { | 2265 | if (!host->dma.chan) { |
2267 | dev_warn(&host->pdev->dev, "no DMA channel available\n"); | 2266 | dev_warn(&host->pdev->dev, "no DMA channel available\n"); |
2268 | return false; | 2267 | return false; |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 375c109607ff..f4f3038c1df0 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -1130,6 +1130,7 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1130 | struct variant_data *variant = host->variant; | 1130 | struct variant_data *variant = host->variant; |
1131 | u32 pwr = 0; | 1131 | u32 pwr = 0; |
1132 | unsigned long flags; | 1132 | unsigned long flags; |
1133 | int ret; | ||
1133 | 1134 | ||
1134 | pm_runtime_get_sync(mmc_dev(mmc)); | 1135 | pm_runtime_get_sync(mmc_dev(mmc)); |
1135 | 1136 | ||
@@ -1161,8 +1162,12 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1161 | break; | 1162 | break; |
1162 | case MMC_POWER_ON: | 1163 | case MMC_POWER_ON: |
1163 | if (!IS_ERR(mmc->supply.vqmmc) && | 1164 | if (!IS_ERR(mmc->supply.vqmmc) && |
1164 | !regulator_is_enabled(mmc->supply.vqmmc)) | 1165 | !regulator_is_enabled(mmc->supply.vqmmc)) { |
1165 | regulator_enable(mmc->supply.vqmmc); | 1166 | ret = regulator_enable(mmc->supply.vqmmc); |
1167 | if (ret < 0) | ||
1168 | dev_err(mmc_dev(mmc), | ||
1169 | "failed to enable vqmmc regulator\n"); | ||
1170 | } | ||
1166 | 1171 | ||
1167 | pwr |= MCI_PWR_ON; | 1172 | pwr |= MCI_PWR_ON; |
1168 | break; | 1173 | break; |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 6e44025acf01..eccedc7d06a4 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -161,6 +161,7 @@ struct omap_hsmmc_host { | |||
161 | */ | 161 | */ |
162 | struct regulator *vcc; | 162 | struct regulator *vcc; |
163 | struct regulator *vcc_aux; | 163 | struct regulator *vcc_aux; |
164 | int pbias_disable; | ||
164 | void __iomem *base; | 165 | void __iomem *base; |
165 | resource_size_t mapbase; | 166 | resource_size_t mapbase; |
166 | spinlock_t irq_lock; /* Prevent races with irq handler */ | 167 | spinlock_t irq_lock; /* Prevent races with irq handler */ |
@@ -255,11 +256,11 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, | |||
255 | if (!host->vcc) | 256 | if (!host->vcc) |
256 | return 0; | 257 | return 0; |
257 | /* | 258 | /* |
258 | * With DT, never turn OFF the regulator. This is because | 259 | * With DT, never turn OFF the regulator for MMC1. This is because |
259 | * the pbias cell programming support is still missing when | 260 | * the pbias cell programming support is still missing when |
260 | * booting with Device tree | 261 | * booting with Device tree |
261 | */ | 262 | */ |
262 | if (dev->of_node && !vdd) | 263 | if (host->pbias_disable && !vdd) |
263 | return 0; | 264 | return 0; |
264 | 265 | ||
265 | if (mmc_slot(host).before_set_reg) | 266 | if (mmc_slot(host).before_set_reg) |
@@ -1520,10 +1521,10 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1520 | (ios->vdd == DUAL_VOLT_OCR_BIT) && | 1521 | (ios->vdd == DUAL_VOLT_OCR_BIT) && |
1521 | /* | 1522 | /* |
1522 | * With pbias cell programming missing, this | 1523 | * With pbias cell programming missing, this |
1523 | * can't be allowed when booting with device | 1524 | * can't be allowed on MMC1 when booting with device |
1524 | * tree. | 1525 | * tree. |
1525 | */ | 1526 | */ |
1526 | !host->dev->of_node) { | 1527 | !host->pbias_disable) { |
1527 | /* | 1528 | /* |
1528 | * The mmc_select_voltage fn of the core does | 1529 | * The mmc_select_voltage fn of the core does |
1529 | * not seem to set the power_mode to | 1530 | * not seem to set the power_mode to |
@@ -1871,6 +1872,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev) | |||
1871 | 1872 | ||
1872 | omap_hsmmc_context_save(host); | 1873 | omap_hsmmc_context_save(host); |
1873 | 1874 | ||
1875 | /* This can be removed once we support PBIAS with DT */ | ||
1876 | if (host->dev->of_node && host->mapbase == 0x4809c000) | ||
1877 | host->pbias_disable = 1; | ||
1878 | |||
1874 | host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck"); | 1879 | host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck"); |
1875 | /* | 1880 | /* |
1876 | * MMC can still work without debounce clock. | 1881 | * MMC can still work without debounce clock. |
@@ -1906,33 +1911,41 @@ static int omap_hsmmc_probe(struct platform_device *pdev) | |||
1906 | 1911 | ||
1907 | omap_hsmmc_conf_bus_power(host); | 1912 | omap_hsmmc_conf_bus_power(host); |
1908 | 1913 | ||
1909 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); | 1914 | if (!pdev->dev.of_node) { |
1910 | if (!res) { | 1915 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); |
1911 | dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n"); | 1916 | if (!res) { |
1912 | ret = -ENXIO; | 1917 | dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n"); |
1913 | goto err_irq; | 1918 | ret = -ENXIO; |
1914 | } | 1919 | goto err_irq; |
1915 | tx_req = res->start; | 1920 | } |
1921 | tx_req = res->start; | ||
1916 | 1922 | ||
1917 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); | 1923 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); |
1918 | if (!res) { | 1924 | if (!res) { |
1919 | dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n"); | 1925 | dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n"); |
1920 | ret = -ENXIO; | 1926 | ret = -ENXIO; |
1921 | goto err_irq; | 1927 | goto err_irq; |
1928 | } | ||
1929 | rx_req = res->start; | ||
1922 | } | 1930 | } |
1923 | rx_req = res->start; | ||
1924 | 1931 | ||
1925 | dma_cap_zero(mask); | 1932 | dma_cap_zero(mask); |
1926 | dma_cap_set(DMA_SLAVE, mask); | 1933 | dma_cap_set(DMA_SLAVE, mask); |
1927 | 1934 | ||
1928 | host->rx_chan = dma_request_channel(mask, omap_dma_filter_fn, &rx_req); | 1935 | host->rx_chan = |
1936 | dma_request_slave_channel_compat(mask, omap_dma_filter_fn, | ||
1937 | &rx_req, &pdev->dev, "rx"); | ||
1938 | |||
1929 | if (!host->rx_chan) { | 1939 | if (!host->rx_chan) { |
1930 | dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req); | 1940 | dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req); |
1931 | ret = -ENXIO; | 1941 | ret = -ENXIO; |
1932 | goto err_irq; | 1942 | goto err_irq; |
1933 | } | 1943 | } |
1934 | 1944 | ||
1935 | host->tx_chan = dma_request_channel(mask, omap_dma_filter_fn, &tx_req); | 1945 | host->tx_chan = |
1946 | dma_request_slave_channel_compat(mask, omap_dma_filter_fn, | ||
1947 | &tx_req, &pdev->dev, "tx"); | ||
1948 | |||
1936 | if (!host->tx_chan) { | 1949 | if (!host->tx_chan) { |
1937 | dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel %u\n", tx_req); | 1950 | dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel %u\n", tx_req); |
1938 | ret = -ENXIO; | 1951 | ret = -ENXIO; |
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index 7bcf74b1a5cd..706d9cb1a49e 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c | |||
@@ -87,6 +87,12 @@ static const struct sdhci_ops sdhci_acpi_ops_dflt = { | |||
87 | .enable_dma = sdhci_acpi_enable_dma, | 87 | .enable_dma = sdhci_acpi_enable_dma, |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = { | ||
91 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, | ||
92 | .caps2 = MMC_CAP2_HC_ERASE_SZ, | ||
93 | .flags = SDHCI_ACPI_RUNTIME_PM, | ||
94 | }; | ||
95 | |||
90 | static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = { | 96 | static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = { |
91 | .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON, | 97 | .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON, |
92 | .caps = MMC_CAP_NONREMOVABLE | MMC_CAP_POWER_OFF_CARD, | 98 | .caps = MMC_CAP_NONREMOVABLE | MMC_CAP_POWER_OFF_CARD, |
@@ -94,23 +100,67 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = { | |||
94 | .pm_caps = MMC_PM_KEEP_POWER, | 100 | .pm_caps = MMC_PM_KEEP_POWER, |
95 | }; | 101 | }; |
96 | 102 | ||
103 | static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sd = { | ||
104 | }; | ||
105 | |||
106 | struct sdhci_acpi_uid_slot { | ||
107 | const char *hid; | ||
108 | const char *uid; | ||
109 | const struct sdhci_acpi_slot *slot; | ||
110 | }; | ||
111 | |||
112 | static const struct sdhci_acpi_uid_slot sdhci_acpi_uids[] = { | ||
113 | { "80860F14" , "1" , &sdhci_acpi_slot_int_emmc }, | ||
114 | { "80860F14" , "3" , &sdhci_acpi_slot_int_sd }, | ||
115 | { "INT33BB" , "2" , &sdhci_acpi_slot_int_sdio }, | ||
116 | { "INT33C6" , NULL, &sdhci_acpi_slot_int_sdio }, | ||
117 | { "PNP0D40" }, | ||
118 | { }, | ||
119 | }; | ||
120 | |||
97 | static const struct acpi_device_id sdhci_acpi_ids[] = { | 121 | static const struct acpi_device_id sdhci_acpi_ids[] = { |
98 | { "INT33C6", (kernel_ulong_t)&sdhci_acpi_slot_int_sdio }, | 122 | { "80860F14" }, |
99 | { "PNP0D40" }, | 123 | { "INT33BB" }, |
124 | { "INT33C6" }, | ||
125 | { "PNP0D40" }, | ||
100 | { }, | 126 | { }, |
101 | }; | 127 | }; |
102 | MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids); | 128 | MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids); |
103 | 129 | ||
104 | static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid) | 130 | static const struct sdhci_acpi_slot *sdhci_acpi_get_slot_by_ids(const char *hid, |
131 | const char *uid) | ||
105 | { | 132 | { |
106 | const struct acpi_device_id *id; | 133 | const struct sdhci_acpi_uid_slot *u; |
107 | 134 | ||
108 | for (id = sdhci_acpi_ids; id->id[0]; id++) | 135 | for (u = sdhci_acpi_uids; u->hid; u++) { |
109 | if (!strcmp(id->id, hid)) | 136 | if (strcmp(u->hid, hid)) |
110 | return (const struct sdhci_acpi_slot *)id->driver_data; | 137 | continue; |
138 | if (!u->uid) | ||
139 | return u->slot; | ||
140 | if (uid && !strcmp(u->uid, uid)) | ||
141 | return u->slot; | ||
142 | } | ||
111 | return NULL; | 143 | return NULL; |
112 | } | 144 | } |
113 | 145 | ||
146 | static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(acpi_handle handle, | ||
147 | const char *hid) | ||
148 | { | ||
149 | const struct sdhci_acpi_slot *slot; | ||
150 | struct acpi_device_info *info; | ||
151 | const char *uid = NULL; | ||
152 | acpi_status status; | ||
153 | |||
154 | status = acpi_get_object_info(handle, &info); | ||
155 | if (!ACPI_FAILURE(status) && (info->valid & ACPI_VALID_UID)) | ||
156 | uid = info->unique_id.string; | ||
157 | |||
158 | slot = sdhci_acpi_get_slot_by_ids(hid, uid); | ||
159 | |||
160 | kfree(info); | ||
161 | return slot; | ||
162 | } | ||
163 | |||
114 | static int sdhci_acpi_probe(struct platform_device *pdev) | 164 | static int sdhci_acpi_probe(struct platform_device *pdev) |
115 | { | 165 | { |
116 | struct device *dev = &pdev->dev; | 166 | struct device *dev = &pdev->dev; |
@@ -148,7 +198,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev) | |||
148 | 198 | ||
149 | c = sdhci_priv(host); | 199 | c = sdhci_priv(host); |
150 | c->host = host; | 200 | c->host = host; |
151 | c->slot = sdhci_acpi_get_slot(hid); | 201 | c->slot = sdhci_acpi_get_slot(handle, hid); |
152 | c->pdev = pdev; | 202 | c->pdev = pdev; |
153 | c->use_runtime_pm = sdhci_acpi_flag(c, SDHCI_ACPI_RUNTIME_PM); | 203 | c->use_runtime_pm = sdhci_acpi_flag(c, SDHCI_ACPI_RUNTIME_PM); |
154 | 204 | ||
@@ -202,6 +252,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev) | |||
202 | goto err_free; | 252 | goto err_free; |
203 | 253 | ||
204 | if (c->use_runtime_pm) { | 254 | if (c->use_runtime_pm) { |
255 | pm_runtime_set_active(dev); | ||
205 | pm_suspend_ignore_children(dev, 1); | 256 | pm_suspend_ignore_children(dev, 1); |
206 | pm_runtime_set_autosuspend_delay(dev, 50); | 257 | pm_runtime_set_autosuspend_delay(dev, 50); |
207 | pm_runtime_use_autosuspend(dev); | 258 | pm_runtime_use_autosuspend(dev); |
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 67d6dde2ff19..d5f0d59e1310 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -85,6 +85,12 @@ struct pltfm_imx_data { | |||
85 | struct clk *clk_ipg; | 85 | struct clk *clk_ipg; |
86 | struct clk *clk_ahb; | 86 | struct clk *clk_ahb; |
87 | struct clk *clk_per; | 87 | struct clk *clk_per; |
88 | enum { | ||
89 | NO_CMD_PENDING, /* no multiblock command pending*/ | ||
90 | MULTIBLK_IN_PROCESS, /* exact multiblock cmd in process */ | ||
91 | WAIT_FOR_INT, /* sent CMD12, waiting for response INT */ | ||
92 | } multiblock_status; | ||
93 | |||
88 | }; | 94 | }; |
89 | 95 | ||
90 | static struct platform_device_id imx_esdhc_devtype[] = { | 96 | static struct platform_device_id imx_esdhc_devtype[] = { |
@@ -154,6 +160,8 @@ static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, i | |||
154 | 160 | ||
155 | static u32 esdhc_readl_le(struct sdhci_host *host, int reg) | 161 | static u32 esdhc_readl_le(struct sdhci_host *host, int reg) |
156 | { | 162 | { |
163 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | ||
164 | struct pltfm_imx_data *imx_data = pltfm_host->priv; | ||
157 | u32 val = readl(host->ioaddr + reg); | 165 | u32 val = readl(host->ioaddr + reg); |
158 | 166 | ||
159 | if (unlikely(reg == SDHCI_CAPABILITIES)) { | 167 | if (unlikely(reg == SDHCI_CAPABILITIES)) { |
@@ -175,6 +183,18 @@ static u32 esdhc_readl_le(struct sdhci_host *host, int reg) | |||
175 | val &= ~ESDHC_INT_VENDOR_SPEC_DMA_ERR; | 183 | val &= ~ESDHC_INT_VENDOR_SPEC_DMA_ERR; |
176 | val |= SDHCI_INT_ADMA_ERROR; | 184 | val |= SDHCI_INT_ADMA_ERROR; |
177 | } | 185 | } |
186 | |||
187 | /* | ||
188 | * mask off the interrupt we get in response to the manually | ||
189 | * sent CMD12 | ||
190 | */ | ||
191 | if ((imx_data->multiblock_status == WAIT_FOR_INT) && | ||
192 | ((val & SDHCI_INT_RESPONSE) == SDHCI_INT_RESPONSE)) { | ||
193 | val &= ~SDHCI_INT_RESPONSE; | ||
194 | writel(SDHCI_INT_RESPONSE, host->ioaddr + | ||
195 | SDHCI_INT_STATUS); | ||
196 | imx_data->multiblock_status = NO_CMD_PENDING; | ||
197 | } | ||
178 | } | 198 | } |
179 | 199 | ||
180 | return val; | 200 | return val; |
@@ -211,6 +231,15 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg) | |||
211 | v = readl(host->ioaddr + ESDHC_VENDOR_SPEC); | 231 | v = readl(host->ioaddr + ESDHC_VENDOR_SPEC); |
212 | v &= ~ESDHC_VENDOR_SPEC_SDIO_QUIRK; | 232 | v &= ~ESDHC_VENDOR_SPEC_SDIO_QUIRK; |
213 | writel(v, host->ioaddr + ESDHC_VENDOR_SPEC); | 233 | writel(v, host->ioaddr + ESDHC_VENDOR_SPEC); |
234 | |||
235 | if (imx_data->multiblock_status == MULTIBLK_IN_PROCESS) | ||
236 | { | ||
237 | /* send a manual CMD12 with RESPTYP=none */ | ||
238 | data = MMC_STOP_TRANSMISSION << 24 | | ||
239 | SDHCI_CMD_ABORTCMD << 16; | ||
240 | writel(data, host->ioaddr + SDHCI_TRANSFER_MODE); | ||
241 | imx_data->multiblock_status = WAIT_FOR_INT; | ||
242 | } | ||
214 | } | 243 | } |
215 | 244 | ||
216 | if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) { | 245 | if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) { |
@@ -277,11 +306,13 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg) | |||
277 | } | 306 | } |
278 | return; | 307 | return; |
279 | case SDHCI_COMMAND: | 308 | case SDHCI_COMMAND: |
280 | if ((host->cmd->opcode == MMC_STOP_TRANSMISSION || | 309 | if (host->cmd->opcode == MMC_STOP_TRANSMISSION) |
281 | host->cmd->opcode == MMC_SET_BLOCK_COUNT) && | ||
282 | (imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT)) | ||
283 | val |= SDHCI_CMD_ABORTCMD; | 310 | val |= SDHCI_CMD_ABORTCMD; |
284 | 311 | ||
312 | if ((host->cmd->opcode == MMC_SET_BLOCK_COUNT) && | ||
313 | (imx_data->flags & ESDHC_FLAG_MULTIBLK_NO_INT)) | ||
314 | imx_data->multiblock_status = MULTIBLK_IN_PROCESS; | ||
315 | |||
285 | if (is_imx6q_usdhc(imx_data)) | 316 | if (is_imx6q_usdhc(imx_data)) |
286 | writel(val << 16, | 317 | writel(val << 16, |
287 | host->ioaddr + SDHCI_TRANSFER_MODE); | 318 | host->ioaddr + SDHCI_TRANSFER_MODE); |
@@ -324,8 +355,10 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg) | |||
324 | /* | 355 | /* |
325 | * Do not touch buswidth bits here. This is done in | 356 | * Do not touch buswidth bits here. This is done in |
326 | * esdhc_pltfm_bus_width. | 357 | * esdhc_pltfm_bus_width. |
358 | * Do not touch the D3CD bit either which is used for the | ||
359 | * SDIO interrupt errata workaround. | ||
327 | */ | 360 | */ |
328 | mask = 0xffff & ~ESDHC_CTRL_BUSWIDTH_MASK; | 361 | mask = 0xffff & ~(ESDHC_CTRL_BUSWIDTH_MASK | ESDHC_CTRL_D3CD); |
329 | 362 | ||
330 | esdhc_clrset_le(host, mask, new_val, reg); | 363 | esdhc_clrset_le(host, mask, new_val, reg); |
331 | return; | 364 | return; |
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index 0012d3fdc999..701d06d0e1fb 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c | |||
@@ -33,6 +33,9 @@ | |||
33 | */ | 33 | */ |
34 | #define PCI_DEVICE_ID_INTEL_PCH_SDIO0 0x8809 | 34 | #define PCI_DEVICE_ID_INTEL_PCH_SDIO0 0x8809 |
35 | #define PCI_DEVICE_ID_INTEL_PCH_SDIO1 0x880a | 35 | #define PCI_DEVICE_ID_INTEL_PCH_SDIO1 0x880a |
36 | #define PCI_DEVICE_ID_INTEL_BYT_EMMC 0x0f14 | ||
37 | #define PCI_DEVICE_ID_INTEL_BYT_SDIO 0x0f15 | ||
38 | #define PCI_DEVICE_ID_INTEL_BYT_SD 0x0f16 | ||
36 | 39 | ||
37 | /* | 40 | /* |
38 | * PCI registers | 41 | * PCI registers |
@@ -304,6 +307,33 @@ static const struct sdhci_pci_fixes sdhci_intel_pch_sdio = { | |||
304 | .probe_slot = pch_hc_probe_slot, | 307 | .probe_slot = pch_hc_probe_slot, |
305 | }; | 308 | }; |
306 | 309 | ||
310 | static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) | ||
311 | { | ||
312 | slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE; | ||
313 | slot->host->mmc->caps2 |= MMC_CAP2_HC_ERASE_SZ; | ||
314 | return 0; | ||
315 | } | ||
316 | |||
317 | static int byt_sdio_probe_slot(struct sdhci_pci_slot *slot) | ||
318 | { | ||
319 | slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE; | ||
320 | return 0; | ||
321 | } | ||
322 | |||
323 | static const struct sdhci_pci_fixes sdhci_intel_byt_emmc = { | ||
324 | .allow_runtime_pm = true, | ||
325 | .probe_slot = byt_emmc_probe_slot, | ||
326 | }; | ||
327 | |||
328 | static const struct sdhci_pci_fixes sdhci_intel_byt_sdio = { | ||
329 | .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON, | ||
330 | .allow_runtime_pm = true, | ||
331 | .probe_slot = byt_sdio_probe_slot, | ||
332 | }; | ||
333 | |||
334 | static const struct sdhci_pci_fixes sdhci_intel_byt_sd = { | ||
335 | }; | ||
336 | |||
307 | /* O2Micro extra registers */ | 337 | /* O2Micro extra registers */ |
308 | #define O2_SD_LOCK_WP 0xD3 | 338 | #define O2_SD_LOCK_WP 0xD3 |
309 | #define O2_SD_MULTI_VCC3V 0xEE | 339 | #define O2_SD_MULTI_VCC3V 0xEE |
@@ -856,6 +886,30 @@ static const struct pci_device_id pci_ids[] = { | |||
856 | }, | 886 | }, |
857 | 887 | ||
858 | { | 888 | { |
889 | .vendor = PCI_VENDOR_ID_INTEL, | ||
890 | .device = PCI_DEVICE_ID_INTEL_BYT_EMMC, | ||
891 | .subvendor = PCI_ANY_ID, | ||
892 | .subdevice = PCI_ANY_ID, | ||
893 | .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc, | ||
894 | }, | ||
895 | |||
896 | { | ||
897 | .vendor = PCI_VENDOR_ID_INTEL, | ||
898 | .device = PCI_DEVICE_ID_INTEL_BYT_SDIO, | ||
899 | .subvendor = PCI_ANY_ID, | ||
900 | .subdevice = PCI_ANY_ID, | ||
901 | .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio, | ||
902 | }, | ||
903 | |||
904 | { | ||
905 | .vendor = PCI_VENDOR_ID_INTEL, | ||
906 | .device = PCI_DEVICE_ID_INTEL_BYT_SD, | ||
907 | .subvendor = PCI_ANY_ID, | ||
908 | .subdevice = PCI_ANY_ID, | ||
909 | .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd, | ||
910 | }, | ||
911 | |||
912 | { | ||
859 | .vendor = PCI_VENDOR_ID_O2, | 913 | .vendor = PCI_VENDOR_ID_O2, |
860 | .device = PCI_DEVICE_ID_O2_8120, | 914 | .device = PCI_DEVICE_ID_O2_8120, |
861 | .subvendor = PCI_ANY_ID, | 915 | .subvendor = PCI_ANY_ID, |
diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c index a94facb46e5c..fd1df5e13ae4 100644 --- a/drivers/mtd/nand/lpc32xx_mlc.c +++ b/drivers/mtd/nand/lpc32xx_mlc.c | |||
@@ -672,11 +672,6 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) | |||
672 | } | 672 | } |
673 | 673 | ||
674 | rc = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 674 | rc = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
675 | if (rc == NULL) { | ||
676 | dev_err(&pdev->dev, "No memory resource found for device!\r\n"); | ||
677 | return -ENXIO; | ||
678 | } | ||
679 | |||
680 | host->io_base = devm_ioremap_resource(&pdev->dev, rc); | 675 | host->io_base = devm_ioremap_resource(&pdev->dev, rc); |
681 | if (IS_ERR(host->io_base)) | 676 | if (IS_ERR(host->io_base)) |
682 | return PTR_ERR(host->io_base); | 677 | return PTR_ERR(host->io_base); |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index fc58d118d844..390061d09693 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2360,14 +2360,15 @@ int bond_3ad_set_carrier(struct bonding *bond) | |||
2360 | } | 2360 | } |
2361 | 2361 | ||
2362 | /** | 2362 | /** |
2363 | * bond_3ad_get_active_agg_info - get information of the active aggregator | 2363 | * __bond_3ad_get_active_agg_info - get information of the active aggregator |
2364 | * @bond: bonding struct to work on | 2364 | * @bond: bonding struct to work on |
2365 | * @ad_info: ad_info struct to fill with the bond's info | 2365 | * @ad_info: ad_info struct to fill with the bond's info |
2366 | * | 2366 | * |
2367 | * Returns: 0 on success | 2367 | * Returns: 0 on success |
2368 | * < 0 on error | 2368 | * < 0 on error |
2369 | */ | 2369 | */ |
2370 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) | 2370 | int __bond_3ad_get_active_agg_info(struct bonding *bond, |
2371 | struct ad_info *ad_info) | ||
2371 | { | 2372 | { |
2372 | struct aggregator *aggregator = NULL; | 2373 | struct aggregator *aggregator = NULL; |
2373 | struct port *port; | 2374 | struct port *port; |
@@ -2391,6 +2392,18 @@ int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) | |||
2391 | return -1; | 2392 | return -1; |
2392 | } | 2393 | } |
2393 | 2394 | ||
2395 | /* Wrapper used to hold bond->lock so no slave manipulation can occur */ | ||
2396 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) | ||
2397 | { | ||
2398 | int ret; | ||
2399 | |||
2400 | read_lock(&bond->lock); | ||
2401 | ret = __bond_3ad_get_active_agg_info(bond, ad_info); | ||
2402 | read_unlock(&bond->lock); | ||
2403 | |||
2404 | return ret; | ||
2405 | } | ||
2406 | |||
2394 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | 2407 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) |
2395 | { | 2408 | { |
2396 | struct slave *slave, *start_at; | 2409 | struct slave *slave, *start_at; |
@@ -2402,8 +2415,8 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) | |||
2402 | struct ad_info ad_info; | 2415 | struct ad_info ad_info; |
2403 | int res = 1; | 2416 | int res = 1; |
2404 | 2417 | ||
2405 | if (bond_3ad_get_active_agg_info(bond, &ad_info)) { | 2418 | if (__bond_3ad_get_active_agg_info(bond, &ad_info)) { |
2406 | pr_debug("%s: Error: bond_3ad_get_active_agg_info failed\n", | 2419 | pr_debug("%s: Error: __bond_3ad_get_active_agg_info failed\n", |
2407 | dev->name); | 2420 | dev->name); |
2408 | goto out; | 2421 | goto out; |
2409 | } | 2422 | } |
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h index 0cfaa4afdece..5d91ad0cc041 100644 --- a/drivers/net/bonding/bond_3ad.h +++ b/drivers/net/bonding/bond_3ad.h | |||
@@ -273,6 +273,8 @@ void bond_3ad_adapter_speed_changed(struct slave *slave); | |||
273 | void bond_3ad_adapter_duplex_changed(struct slave *slave); | 273 | void bond_3ad_adapter_duplex_changed(struct slave *slave); |
274 | void bond_3ad_handle_link_change(struct slave *slave, char link); | 274 | void bond_3ad_handle_link_change(struct slave *slave, char link); |
275 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); | 275 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); |
276 | int __bond_3ad_get_active_agg_info(struct bonding *bond, | ||
277 | struct ad_info *ad_info); | ||
276 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); | 278 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); |
277 | int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, | 279 | int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, |
278 | struct slave *slave); | 280 | struct slave *slave); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index d0aade04e49a..02d9ae7d527e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -764,8 +764,8 @@ static void bond_resend_igmp_join_requests(struct bonding *bond) | |||
764 | struct net_device *bond_dev, *vlan_dev, *upper_dev; | 764 | struct net_device *bond_dev, *vlan_dev, *upper_dev; |
765 | struct vlan_entry *vlan; | 765 | struct vlan_entry *vlan; |
766 | 766 | ||
767 | rcu_read_lock(); | ||
768 | read_lock(&bond->lock); | 767 | read_lock(&bond->lock); |
768 | rcu_read_lock(); | ||
769 | 769 | ||
770 | bond_dev = bond->dev; | 770 | bond_dev = bond->dev; |
771 | 771 | ||
@@ -787,12 +787,19 @@ static void bond_resend_igmp_join_requests(struct bonding *bond) | |||
787 | if (vlan_dev) | 787 | if (vlan_dev) |
788 | __bond_resend_igmp_join_requests(vlan_dev); | 788 | __bond_resend_igmp_join_requests(vlan_dev); |
789 | } | 789 | } |
790 | rcu_read_unlock(); | ||
790 | 791 | ||
791 | if (--bond->igmp_retrans > 0) | 792 | /* We use curr_slave_lock to protect against concurrent access to |
793 | * igmp_retrans from multiple running instances of this function and | ||
794 | * bond_change_active_slave | ||
795 | */ | ||
796 | write_lock_bh(&bond->curr_slave_lock); | ||
797 | if (bond->igmp_retrans > 1) { | ||
798 | bond->igmp_retrans--; | ||
792 | queue_delayed_work(bond->wq, &bond->mcast_work, HZ/5); | 799 | queue_delayed_work(bond->wq, &bond->mcast_work, HZ/5); |
793 | 800 | } | |
801 | write_unlock_bh(&bond->curr_slave_lock); | ||
794 | read_unlock(&bond->lock); | 802 | read_unlock(&bond->lock); |
795 | rcu_read_unlock(); | ||
796 | } | 803 | } |
797 | 804 | ||
798 | static void bond_resend_igmp_join_requests_delayed(struct work_struct *work) | 805 | static void bond_resend_igmp_join_requests_delayed(struct work_struct *work) |
@@ -1362,6 +1369,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev, | |||
1362 | slave->dev->features, | 1369 | slave->dev->features, |
1363 | mask); | 1370 | mask); |
1364 | } | 1371 | } |
1372 | features = netdev_add_tso_features(features, mask); | ||
1365 | 1373 | ||
1366 | out: | 1374 | out: |
1367 | read_unlock(&bond->lock); | 1375 | read_unlock(&bond->lock); |
@@ -1956,6 +1964,10 @@ err_free: | |||
1956 | 1964 | ||
1957 | err_undo_flags: | 1965 | err_undo_flags: |
1958 | bond_compute_features(bond); | 1966 | bond_compute_features(bond); |
1967 | /* Enslave of first slave has failed and we need to fix master's mac */ | ||
1968 | if (bond->slave_cnt == 0 && | ||
1969 | ether_addr_equal(bond_dev->dev_addr, slave_dev->dev_addr)) | ||
1970 | eth_hw_addr_random(bond_dev); | ||
1959 | 1971 | ||
1960 | return res; | 1972 | return res; |
1961 | } | 1973 | } |
@@ -2555,8 +2567,8 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_ | |||
2555 | { | 2567 | { |
2556 | struct sk_buff *skb; | 2568 | struct sk_buff *skb; |
2557 | 2569 | ||
2558 | pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op, | 2570 | pr_debug("arp %d on slave %s: dst %pI4 src %pI4 vid %d\n", arp_op, |
2559 | slave_dev->name, dest_ip, src_ip, vlan_id); | 2571 | slave_dev->name, &dest_ip, &src_ip, vlan_id); |
2560 | 2572 | ||
2561 | skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, | 2573 | skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, |
2562 | NULL, slave_dev->dev_addr, NULL); | 2574 | NULL, slave_dev->dev_addr, NULL); |
@@ -2588,7 +2600,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2588 | __be32 addr; | 2600 | __be32 addr; |
2589 | if (!targets[i]) | 2601 | if (!targets[i]) |
2590 | break; | 2602 | break; |
2591 | pr_debug("basa: target %x\n", targets[i]); | 2603 | pr_debug("basa: target %pI4\n", &targets[i]); |
2592 | if (!bond_vlan_used(bond)) { | 2604 | if (!bond_vlan_used(bond)) { |
2593 | pr_debug("basa: empty vlan: arp_send\n"); | 2605 | pr_debug("basa: empty vlan: arp_send\n"); |
2594 | addr = bond_confirm_addr(bond->dev, targets[i], 0); | 2606 | addr = bond_confirm_addr(bond->dev, targets[i], 0); |
@@ -4470,7 +4482,7 @@ int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl) | |||
4470 | 4482 | ||
4471 | static int bond_check_params(struct bond_params *params) | 4483 | static int bond_check_params(struct bond_params *params) |
4472 | { | 4484 | { |
4473 | int arp_validate_value, fail_over_mac_value, primary_reselect_value; | 4485 | int arp_validate_value, fail_over_mac_value, primary_reselect_value, i; |
4474 | 4486 | ||
4475 | /* | 4487 | /* |
4476 | * Convert string parameters. | 4488 | * Convert string parameters. |
@@ -4650,19 +4662,18 @@ static int bond_check_params(struct bond_params *params) | |||
4650 | arp_interval = BOND_LINK_ARP_INTERV; | 4662 | arp_interval = BOND_LINK_ARP_INTERV; |
4651 | } | 4663 | } |
4652 | 4664 | ||
4653 | for (arp_ip_count = 0; | 4665 | for (arp_ip_count = 0, i = 0; |
4654 | (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[arp_ip_count]; | 4666 | (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) { |
4655 | arp_ip_count++) { | ||
4656 | /* not complete check, but should be good enough to | 4667 | /* not complete check, but should be good enough to |
4657 | catch mistakes */ | 4668 | catch mistakes */ |
4658 | __be32 ip = in_aton(arp_ip_target[arp_ip_count]); | 4669 | __be32 ip = in_aton(arp_ip_target[i]); |
4659 | if (!isdigit(arp_ip_target[arp_ip_count][0]) || | 4670 | if (!isdigit(arp_ip_target[i][0]) || ip == 0 || |
4660 | ip == 0 || ip == htonl(INADDR_BROADCAST)) { | 4671 | ip == htonl(INADDR_BROADCAST)) { |
4661 | pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", | 4672 | pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", |
4662 | arp_ip_target[arp_ip_count]); | 4673 | arp_ip_target[i]); |
4663 | arp_interval = 0; | 4674 | arp_interval = 0; |
4664 | } else { | 4675 | } else { |
4665 | arp_target[arp_ip_count] = ip; | 4676 | arp_target[arp_ip_count++] = ip; |
4666 | } | 4677 | } |
4667 | } | 4678 | } |
4668 | 4679 | ||
@@ -4696,8 +4707,6 @@ static int bond_check_params(struct bond_params *params) | |||
4696 | if (miimon) { | 4707 | if (miimon) { |
4697 | pr_info("MII link monitoring set to %d ms\n", miimon); | 4708 | pr_info("MII link monitoring set to %d ms\n", miimon); |
4698 | } else if (arp_interval) { | 4709 | } else if (arp_interval) { |
4699 | int i; | ||
4700 | |||
4701 | pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):", | 4710 | pr_info("ARP monitoring set to %d ms, validate %s, with %d target(s):", |
4702 | arp_interval, | 4711 | arp_interval, |
4703 | arp_validate_tbl[arp_validate_value].modename, | 4712 | arp_validate_tbl[arp_validate_value].modename, |
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 94d06f1307b8..4060d41f0ee7 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c | |||
@@ -130,7 +130,7 @@ static void bond_info_show_master(struct seq_file *seq) | |||
130 | seq_printf(seq, "Aggregator selection policy (ad_select): %s\n", | 130 | seq_printf(seq, "Aggregator selection policy (ad_select): %s\n", |
131 | ad_select_tbl[bond->params.ad_select].modename); | 131 | ad_select_tbl[bond->params.ad_select].modename); |
132 | 132 | ||
133 | if (bond_3ad_get_active_agg_info(bond, &ad_info)) { | 133 | if (__bond_3ad_get_active_agg_info(bond, &ad_info)) { |
134 | seq_printf(seq, "bond %s has no active aggregator\n", | 134 | seq_printf(seq, "bond %s has no active aggregator\n", |
135 | bond->dev->name); | 135 | bond->dev->name); |
136 | } else { | 136 | } else { |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index ea7a388f4843..d7434e0a610e 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -316,6 +316,9 @@ static ssize_t bonding_store_mode(struct device *d, | |||
316 | int new_value, ret = count; | 316 | int new_value, ret = count; |
317 | struct bonding *bond = to_bond(d); | 317 | struct bonding *bond = to_bond(d); |
318 | 318 | ||
319 | if (!rtnl_trylock()) | ||
320 | return restart_syscall(); | ||
321 | |||
319 | if (bond->dev->flags & IFF_UP) { | 322 | if (bond->dev->flags & IFF_UP) { |
320 | pr_err("unable to update mode of %s because interface is up.\n", | 323 | pr_err("unable to update mode of %s because interface is up.\n", |
321 | bond->dev->name); | 324 | bond->dev->name); |
@@ -352,6 +355,7 @@ static ssize_t bonding_store_mode(struct device *d, | |||
352 | bond->dev->name, bond_mode_tbl[new_value].modename, | 355 | bond->dev->name, bond_mode_tbl[new_value].modename, |
353 | new_value); | 356 | new_value); |
354 | out: | 357 | out: |
358 | rtnl_unlock(); | ||
355 | return ret; | 359 | return ret; |
356 | } | 360 | } |
357 | static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, | 361 | static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, |
@@ -1315,7 +1319,6 @@ static ssize_t bonding_show_mii_status(struct device *d, | |||
1315 | } | 1319 | } |
1316 | static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); | 1320 | static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); |
1317 | 1321 | ||
1318 | |||
1319 | /* | 1322 | /* |
1320 | * Show current 802.3ad aggregator ID. | 1323 | * Show current 802.3ad aggregator ID. |
1321 | */ | 1324 | */ |
@@ -1329,7 +1332,7 @@ static ssize_t bonding_show_ad_aggregator(struct device *d, | |||
1329 | if (bond->params.mode == BOND_MODE_8023AD) { | 1332 | if (bond->params.mode == BOND_MODE_8023AD) { |
1330 | struct ad_info ad_info; | 1333 | struct ad_info ad_info; |
1331 | count = sprintf(buf, "%d\n", | 1334 | count = sprintf(buf, "%d\n", |
1332 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | 1335 | bond_3ad_get_active_agg_info(bond, &ad_info) |
1333 | ? 0 : ad_info.aggregator_id); | 1336 | ? 0 : ad_info.aggregator_id); |
1334 | } | 1337 | } |
1335 | 1338 | ||
@@ -1351,7 +1354,7 @@ static ssize_t bonding_show_ad_num_ports(struct device *d, | |||
1351 | if (bond->params.mode == BOND_MODE_8023AD) { | 1354 | if (bond->params.mode == BOND_MODE_8023AD) { |
1352 | struct ad_info ad_info; | 1355 | struct ad_info ad_info; |
1353 | count = sprintf(buf, "%d\n", | 1356 | count = sprintf(buf, "%d\n", |
1354 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | 1357 | bond_3ad_get_active_agg_info(bond, &ad_info) |
1355 | ? 0 : ad_info.ports); | 1358 | ? 0 : ad_info.ports); |
1356 | } | 1359 | } |
1357 | 1360 | ||
@@ -1373,7 +1376,7 @@ static ssize_t bonding_show_ad_actor_key(struct device *d, | |||
1373 | if (bond->params.mode == BOND_MODE_8023AD) { | 1376 | if (bond->params.mode == BOND_MODE_8023AD) { |
1374 | struct ad_info ad_info; | 1377 | struct ad_info ad_info; |
1375 | count = sprintf(buf, "%d\n", | 1378 | count = sprintf(buf, "%d\n", |
1376 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | 1379 | bond_3ad_get_active_agg_info(bond, &ad_info) |
1377 | ? 0 : ad_info.actor_key); | 1380 | ? 0 : ad_info.actor_key); |
1378 | } | 1381 | } |
1379 | 1382 | ||
@@ -1395,7 +1398,7 @@ static ssize_t bonding_show_ad_partner_key(struct device *d, | |||
1395 | if (bond->params.mode == BOND_MODE_8023AD) { | 1398 | if (bond->params.mode == BOND_MODE_8023AD) { |
1396 | struct ad_info ad_info; | 1399 | struct ad_info ad_info; |
1397 | count = sprintf(buf, "%d\n", | 1400 | count = sprintf(buf, "%d\n", |
1398 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | 1401 | bond_3ad_get_active_agg_info(bond, &ad_info) |
1399 | ? 0 : ad_info.partner_key); | 1402 | ? 0 : ad_info.partner_key); |
1400 | } | 1403 | } |
1401 | 1404 | ||
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 2baec24388b1..f989e1529a29 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -225,7 +225,7 @@ struct bonding { | |||
225 | rwlock_t curr_slave_lock; | 225 | rwlock_t curr_slave_lock; |
226 | u8 send_peer_notif; | 226 | u8 send_peer_notif; |
227 | s8 setup_by_slave; | 227 | s8 setup_by_slave; |
228 | s8 igmp_retrans; | 228 | u8 igmp_retrans; |
229 | #ifdef CONFIG_PROC_FS | 229 | #ifdef CONFIG_PROC_FS |
230 | struct proc_dir_entry *proc_entry; | 230 | struct proc_dir_entry *proc_entry; |
231 | char proc_file_name[IFNAMSIZ]; | 231 | char proc_file_name[IFNAMSIZ]; |
diff --git a/drivers/net/caif/Kconfig b/drivers/net/caif/Kconfig index 7ffc756131a2..547098086773 100644 --- a/drivers/net/caif/Kconfig +++ b/drivers/net/caif/Kconfig | |||
@@ -43,7 +43,7 @@ config CAIF_HSI | |||
43 | 43 | ||
44 | config CAIF_VIRTIO | 44 | config CAIF_VIRTIO |
45 | tristate "CAIF virtio transport driver" | 45 | tristate "CAIF virtio transport driver" |
46 | depends on CAIF | 46 | depends on CAIF && HAS_DMA |
47 | select VHOST_RING | 47 | select VHOST_RING |
48 | select VIRTIO | 48 | select VIRTIO |
49 | select GENERIC_ALLOCATOR | 49 | select GENERIC_ALLOCATOR |
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index 9b74d1e3ad44..6aa7b3266c80 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c | |||
@@ -612,9 +612,15 @@ static int esd_usb2_start(struct esd_usb2_net_priv *priv) | |||
612 | { | 612 | { |
613 | struct esd_usb2 *dev = priv->usb2; | 613 | struct esd_usb2 *dev = priv->usb2; |
614 | struct net_device *netdev = priv->netdev; | 614 | struct net_device *netdev = priv->netdev; |
615 | struct esd_usb2_msg msg; | 615 | struct esd_usb2_msg *msg; |
616 | int err, i; | 616 | int err, i; |
617 | 617 | ||
618 | msg = kmalloc(sizeof(*msg), GFP_KERNEL); | ||
619 | if (!msg) { | ||
620 | err = -ENOMEM; | ||
621 | goto out; | ||
622 | } | ||
623 | |||
618 | /* | 624 | /* |
619 | * Enable all IDs | 625 | * Enable all IDs |
620 | * The IDADD message takes up to 64 32 bit bitmasks (2048 bits). | 626 | * The IDADD message takes up to 64 32 bit bitmasks (2048 bits). |
@@ -628,33 +634,32 @@ static int esd_usb2_start(struct esd_usb2_net_priv *priv) | |||
628 | * the number of the starting bitmask (0..64) to the filter.option | 634 | * the number of the starting bitmask (0..64) to the filter.option |
629 | * field followed by only some bitmasks. | 635 | * field followed by only some bitmasks. |
630 | */ | 636 | */ |
631 | msg.msg.hdr.cmd = CMD_IDADD; | 637 | msg->msg.hdr.cmd = CMD_IDADD; |
632 | msg.msg.hdr.len = 2 + ESD_MAX_ID_SEGMENT; | 638 | msg->msg.hdr.len = 2 + ESD_MAX_ID_SEGMENT; |
633 | msg.msg.filter.net = priv->index; | 639 | msg->msg.filter.net = priv->index; |
634 | msg.msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */ | 640 | msg->msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */ |
635 | for (i = 0; i < ESD_MAX_ID_SEGMENT; i++) | 641 | for (i = 0; i < ESD_MAX_ID_SEGMENT; i++) |
636 | msg.msg.filter.mask[i] = cpu_to_le32(0xffffffff); | 642 | msg->msg.filter.mask[i] = cpu_to_le32(0xffffffff); |
637 | /* enable 29bit extended IDs */ | 643 | /* enable 29bit extended IDs */ |
638 | msg.msg.filter.mask[ESD_MAX_ID_SEGMENT] = cpu_to_le32(0x00000001); | 644 | msg->msg.filter.mask[ESD_MAX_ID_SEGMENT] = cpu_to_le32(0x00000001); |
639 | 645 | ||
640 | err = esd_usb2_send_msg(dev, &msg); | 646 | err = esd_usb2_send_msg(dev, msg); |
641 | if (err) | 647 | if (err) |
642 | goto failed; | 648 | goto out; |
643 | 649 | ||
644 | err = esd_usb2_setup_rx_urbs(dev); | 650 | err = esd_usb2_setup_rx_urbs(dev); |
645 | if (err) | 651 | if (err) |
646 | goto failed; | 652 | goto out; |
647 | 653 | ||
648 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | 654 | priv->can.state = CAN_STATE_ERROR_ACTIVE; |
649 | 655 | ||
650 | return 0; | 656 | out: |
651 | |||
652 | failed: | ||
653 | if (err == -ENODEV) | 657 | if (err == -ENODEV) |
654 | netif_device_detach(netdev); | 658 | netif_device_detach(netdev); |
659 | if (err) | ||
660 | netdev_err(netdev, "couldn't start device: %d\n", err); | ||
655 | 661 | ||
656 | netdev_err(netdev, "couldn't start device: %d\n", err); | 662 | kfree(msg); |
657 | |||
658 | return err; | 663 | return err; |
659 | } | 664 | } |
660 | 665 | ||
@@ -833,26 +838,30 @@ nourbmem: | |||
833 | static int esd_usb2_close(struct net_device *netdev) | 838 | static int esd_usb2_close(struct net_device *netdev) |
834 | { | 839 | { |
835 | struct esd_usb2_net_priv *priv = netdev_priv(netdev); | 840 | struct esd_usb2_net_priv *priv = netdev_priv(netdev); |
836 | struct esd_usb2_msg msg; | 841 | struct esd_usb2_msg *msg; |
837 | int i; | 842 | int i; |
838 | 843 | ||
844 | msg = kmalloc(sizeof(*msg), GFP_KERNEL); | ||
845 | if (!msg) | ||
846 | return -ENOMEM; | ||
847 | |||
839 | /* Disable all IDs (see esd_usb2_start()) */ | 848 | /* Disable all IDs (see esd_usb2_start()) */ |
840 | msg.msg.hdr.cmd = CMD_IDADD; | 849 | msg->msg.hdr.cmd = CMD_IDADD; |
841 | msg.msg.hdr.len = 2 + ESD_MAX_ID_SEGMENT; | 850 | msg->msg.hdr.len = 2 + ESD_MAX_ID_SEGMENT; |
842 | msg.msg.filter.net = priv->index; | 851 | msg->msg.filter.net = priv->index; |
843 | msg.msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */ | 852 | msg->msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */ |
844 | for (i = 0; i <= ESD_MAX_ID_SEGMENT; i++) | 853 | for (i = 0; i <= ESD_MAX_ID_SEGMENT; i++) |
845 | msg.msg.filter.mask[i] = 0; | 854 | msg->msg.filter.mask[i] = 0; |
846 | if (esd_usb2_send_msg(priv->usb2, &msg) < 0) | 855 | if (esd_usb2_send_msg(priv->usb2, msg) < 0) |
847 | netdev_err(netdev, "sending idadd message failed\n"); | 856 | netdev_err(netdev, "sending idadd message failed\n"); |
848 | 857 | ||
849 | /* set CAN controller to reset mode */ | 858 | /* set CAN controller to reset mode */ |
850 | msg.msg.hdr.len = 2; | 859 | msg->msg.hdr.len = 2; |
851 | msg.msg.hdr.cmd = CMD_SETBAUD; | 860 | msg->msg.hdr.cmd = CMD_SETBAUD; |
852 | msg.msg.setbaud.net = priv->index; | 861 | msg->msg.setbaud.net = priv->index; |
853 | msg.msg.setbaud.rsvd = 0; | 862 | msg->msg.setbaud.rsvd = 0; |
854 | msg.msg.setbaud.baud = cpu_to_le32(ESD_USB2_NO_BAUDRATE); | 863 | msg->msg.setbaud.baud = cpu_to_le32(ESD_USB2_NO_BAUDRATE); |
855 | if (esd_usb2_send_msg(priv->usb2, &msg) < 0) | 864 | if (esd_usb2_send_msg(priv->usb2, msg) < 0) |
856 | netdev_err(netdev, "sending setbaud message failed\n"); | 865 | netdev_err(netdev, "sending setbaud message failed\n"); |
857 | 866 | ||
858 | priv->can.state = CAN_STATE_STOPPED; | 867 | priv->can.state = CAN_STATE_STOPPED; |
@@ -861,6 +870,8 @@ static int esd_usb2_close(struct net_device *netdev) | |||
861 | 870 | ||
862 | close_candev(netdev); | 871 | close_candev(netdev); |
863 | 872 | ||
873 | kfree(msg); | ||
874 | |||
864 | return 0; | 875 | return 0; |
865 | } | 876 | } |
866 | 877 | ||
@@ -886,7 +897,8 @@ static int esd_usb2_set_bittiming(struct net_device *netdev) | |||
886 | { | 897 | { |
887 | struct esd_usb2_net_priv *priv = netdev_priv(netdev); | 898 | struct esd_usb2_net_priv *priv = netdev_priv(netdev); |
888 | struct can_bittiming *bt = &priv->can.bittiming; | 899 | struct can_bittiming *bt = &priv->can.bittiming; |
889 | struct esd_usb2_msg msg; | 900 | struct esd_usb2_msg *msg; |
901 | int err; | ||
890 | u32 canbtr; | 902 | u32 canbtr; |
891 | int sjw_shift; | 903 | int sjw_shift; |
892 | 904 | ||
@@ -912,15 +924,22 @@ static int esd_usb2_set_bittiming(struct net_device *netdev) | |||
912 | if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) | 924 | if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) |
913 | canbtr |= ESD_USB2_3_SAMPLES; | 925 | canbtr |= ESD_USB2_3_SAMPLES; |
914 | 926 | ||
915 | msg.msg.hdr.len = 2; | 927 | msg = kmalloc(sizeof(*msg), GFP_KERNEL); |
916 | msg.msg.hdr.cmd = CMD_SETBAUD; | 928 | if (!msg) |
917 | msg.msg.setbaud.net = priv->index; | 929 | return -ENOMEM; |
918 | msg.msg.setbaud.rsvd = 0; | 930 | |
919 | msg.msg.setbaud.baud = cpu_to_le32(canbtr); | 931 | msg->msg.hdr.len = 2; |
932 | msg->msg.hdr.cmd = CMD_SETBAUD; | ||
933 | msg->msg.setbaud.net = priv->index; | ||
934 | msg->msg.setbaud.rsvd = 0; | ||
935 | msg->msg.setbaud.baud = cpu_to_le32(canbtr); | ||
920 | 936 | ||
921 | netdev_info(netdev, "setting BTR=%#x\n", canbtr); | 937 | netdev_info(netdev, "setting BTR=%#x\n", canbtr); |
922 | 938 | ||
923 | return esd_usb2_send_msg(priv->usb2, &msg); | 939 | err = esd_usb2_send_msg(priv->usb2, msg); |
940 | |||
941 | kfree(msg); | ||
942 | return err; | ||
924 | } | 943 | } |
925 | 944 | ||
926 | static int esd_usb2_get_berr_counter(const struct net_device *netdev, | 945 | static int esd_usb2_get_berr_counter(const struct net_device *netdev, |
@@ -1022,7 +1041,7 @@ static int esd_usb2_probe(struct usb_interface *intf, | |||
1022 | const struct usb_device_id *id) | 1041 | const struct usb_device_id *id) |
1023 | { | 1042 | { |
1024 | struct esd_usb2 *dev; | 1043 | struct esd_usb2 *dev; |
1025 | struct esd_usb2_msg msg; | 1044 | struct esd_usb2_msg *msg; |
1026 | int i, err; | 1045 | int i, err; |
1027 | 1046 | ||
1028 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 1047 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
@@ -1037,27 +1056,33 @@ static int esd_usb2_probe(struct usb_interface *intf, | |||
1037 | 1056 | ||
1038 | usb_set_intfdata(intf, dev); | 1057 | usb_set_intfdata(intf, dev); |
1039 | 1058 | ||
1059 | msg = kmalloc(sizeof(*msg), GFP_KERNEL); | ||
1060 | if (!msg) { | ||
1061 | err = -ENOMEM; | ||
1062 | goto free_msg; | ||
1063 | } | ||
1064 | |||
1040 | /* query number of CAN interfaces (nets) */ | 1065 | /* query number of CAN interfaces (nets) */ |
1041 | msg.msg.hdr.cmd = CMD_VERSION; | 1066 | msg->msg.hdr.cmd = CMD_VERSION; |
1042 | msg.msg.hdr.len = 2; | 1067 | msg->msg.hdr.len = 2; |
1043 | msg.msg.version.rsvd = 0; | 1068 | msg->msg.version.rsvd = 0; |
1044 | msg.msg.version.flags = 0; | 1069 | msg->msg.version.flags = 0; |
1045 | msg.msg.version.drv_version = 0; | 1070 | msg->msg.version.drv_version = 0; |
1046 | 1071 | ||
1047 | err = esd_usb2_send_msg(dev, &msg); | 1072 | err = esd_usb2_send_msg(dev, msg); |
1048 | if (err < 0) { | 1073 | if (err < 0) { |
1049 | dev_err(&intf->dev, "sending version message failed\n"); | 1074 | dev_err(&intf->dev, "sending version message failed\n"); |
1050 | goto free_dev; | 1075 | goto free_msg; |
1051 | } | 1076 | } |
1052 | 1077 | ||
1053 | err = esd_usb2_wait_msg(dev, &msg); | 1078 | err = esd_usb2_wait_msg(dev, msg); |
1054 | if (err < 0) { | 1079 | if (err < 0) { |
1055 | dev_err(&intf->dev, "no version message answer\n"); | 1080 | dev_err(&intf->dev, "no version message answer\n"); |
1056 | goto free_dev; | 1081 | goto free_msg; |
1057 | } | 1082 | } |
1058 | 1083 | ||
1059 | dev->net_count = (int)msg.msg.version_reply.nets; | 1084 | dev->net_count = (int)msg->msg.version_reply.nets; |
1060 | dev->version = le32_to_cpu(msg.msg.version_reply.version); | 1085 | dev->version = le32_to_cpu(msg->msg.version_reply.version); |
1061 | 1086 | ||
1062 | if (device_create_file(&intf->dev, &dev_attr_firmware)) | 1087 | if (device_create_file(&intf->dev, &dev_attr_firmware)) |
1063 | dev_err(&intf->dev, | 1088 | dev_err(&intf->dev, |
@@ -1075,10 +1100,10 @@ static int esd_usb2_probe(struct usb_interface *intf, | |||
1075 | for (i = 0; i < dev->net_count; i++) | 1100 | for (i = 0; i < dev->net_count; i++) |
1076 | esd_usb2_probe_one_net(intf, i); | 1101 | esd_usb2_probe_one_net(intf, i); |
1077 | 1102 | ||
1078 | return 0; | 1103 | free_msg: |
1079 | 1104 | kfree(msg); | |
1080 | free_dev: | 1105 | if (err) |
1081 | kfree(dev); | 1106 | kfree(dev); |
1082 | done: | 1107 | done: |
1083 | return err; | 1108 | return err; |
1084 | } | 1109 | } |
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 45cb9f3c1324..3b9546588240 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c | |||
@@ -136,6 +136,9 @@ | |||
136 | #define KVASER_CTRL_MODE_SELFRECEPTION 3 | 136 | #define KVASER_CTRL_MODE_SELFRECEPTION 3 |
137 | #define KVASER_CTRL_MODE_OFF 4 | 137 | #define KVASER_CTRL_MODE_OFF 4 |
138 | 138 | ||
139 | /* log message */ | ||
140 | #define KVASER_EXTENDED_FRAME BIT(31) | ||
141 | |||
139 | struct kvaser_msg_simple { | 142 | struct kvaser_msg_simple { |
140 | u8 tid; | 143 | u8 tid; |
141 | u8 channel; | 144 | u8 channel; |
@@ -817,8 +820,13 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, | |||
817 | priv = dev->nets[channel]; | 820 | priv = dev->nets[channel]; |
818 | stats = &priv->netdev->stats; | 821 | stats = &priv->netdev->stats; |
819 | 822 | ||
820 | if (msg->u.rx_can.flag & (MSG_FLAG_ERROR_FRAME | MSG_FLAG_NERR | | 823 | if ((msg->u.rx_can.flag & MSG_FLAG_ERROR_FRAME) && |
821 | MSG_FLAG_OVERRUN)) { | 824 | (msg->id == CMD_LOG_MESSAGE)) { |
825 | kvaser_usb_rx_error(dev, msg); | ||
826 | return; | ||
827 | } else if (msg->u.rx_can.flag & (MSG_FLAG_ERROR_FRAME | | ||
828 | MSG_FLAG_NERR | | ||
829 | MSG_FLAG_OVERRUN)) { | ||
822 | kvaser_usb_rx_can_err(priv, msg); | 830 | kvaser_usb_rx_can_err(priv, msg); |
823 | return; | 831 | return; |
824 | } else if (msg->u.rx_can.flag & ~MSG_FLAG_REMOTE_FRAME) { | 832 | } else if (msg->u.rx_can.flag & ~MSG_FLAG_REMOTE_FRAME) { |
@@ -834,22 +842,40 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, | |||
834 | return; | 842 | return; |
835 | } | 843 | } |
836 | 844 | ||
837 | cf->can_id = ((msg->u.rx_can.msg[0] & 0x1f) << 6) | | 845 | if (msg->id == CMD_LOG_MESSAGE) { |
838 | (msg->u.rx_can.msg[1] & 0x3f); | 846 | cf->can_id = le32_to_cpu(msg->u.log_message.id); |
839 | cf->can_dlc = get_can_dlc(msg->u.rx_can.msg[5]); | 847 | if (cf->can_id & KVASER_EXTENDED_FRAME) |
848 | cf->can_id &= CAN_EFF_MASK | CAN_EFF_FLAG; | ||
849 | else | ||
850 | cf->can_id &= CAN_SFF_MASK; | ||
840 | 851 | ||
841 | if (msg->id == CMD_RX_EXT_MESSAGE) { | 852 | cf->can_dlc = get_can_dlc(msg->u.log_message.dlc); |
842 | cf->can_id <<= 18; | ||
843 | cf->can_id |= ((msg->u.rx_can.msg[2] & 0x0f) << 14) | | ||
844 | ((msg->u.rx_can.msg[3] & 0xff) << 6) | | ||
845 | (msg->u.rx_can.msg[4] & 0x3f); | ||
846 | cf->can_id |= CAN_EFF_FLAG; | ||
847 | } | ||
848 | 853 | ||
849 | if (msg->u.rx_can.flag & MSG_FLAG_REMOTE_FRAME) | 854 | if (msg->u.log_message.flags & MSG_FLAG_REMOTE_FRAME) |
850 | cf->can_id |= CAN_RTR_FLAG; | 855 | cf->can_id |= CAN_RTR_FLAG; |
851 | else | 856 | else |
852 | memcpy(cf->data, &msg->u.rx_can.msg[6], cf->can_dlc); | 857 | memcpy(cf->data, &msg->u.log_message.data, |
858 | cf->can_dlc); | ||
859 | } else { | ||
860 | cf->can_id = ((msg->u.rx_can.msg[0] & 0x1f) << 6) | | ||
861 | (msg->u.rx_can.msg[1] & 0x3f); | ||
862 | |||
863 | if (msg->id == CMD_RX_EXT_MESSAGE) { | ||
864 | cf->can_id <<= 18; | ||
865 | cf->can_id |= ((msg->u.rx_can.msg[2] & 0x0f) << 14) | | ||
866 | ((msg->u.rx_can.msg[3] & 0xff) << 6) | | ||
867 | (msg->u.rx_can.msg[4] & 0x3f); | ||
868 | cf->can_id |= CAN_EFF_FLAG; | ||
869 | } | ||
870 | |||
871 | cf->can_dlc = get_can_dlc(msg->u.rx_can.msg[5]); | ||
872 | |||
873 | if (msg->u.rx_can.flag & MSG_FLAG_REMOTE_FRAME) | ||
874 | cf->can_id |= CAN_RTR_FLAG; | ||
875 | else | ||
876 | memcpy(cf->data, &msg->u.rx_can.msg[6], | ||
877 | cf->can_dlc); | ||
878 | } | ||
853 | 879 | ||
854 | netif_rx(skb); | 880 | netif_rx(skb); |
855 | 881 | ||
@@ -911,6 +937,7 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev, | |||
911 | 937 | ||
912 | case CMD_RX_STD_MESSAGE: | 938 | case CMD_RX_STD_MESSAGE: |
913 | case CMD_RX_EXT_MESSAGE: | 939 | case CMD_RX_EXT_MESSAGE: |
940 | case CMD_LOG_MESSAGE: | ||
914 | kvaser_usb_rx_can_msg(dev, msg); | 941 | kvaser_usb_rx_can_msg(dev, msg); |
915 | break; | 942 | break; |
916 | 943 | ||
@@ -919,11 +946,6 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev, | |||
919 | kvaser_usb_rx_error(dev, msg); | 946 | kvaser_usb_rx_error(dev, msg); |
920 | break; | 947 | break; |
921 | 948 | ||
922 | case CMD_LOG_MESSAGE: | ||
923 | if (msg->u.log_message.flags & MSG_FLAG_ERROR_FRAME) | ||
924 | kvaser_usb_rx_error(dev, msg); | ||
925 | break; | ||
926 | |||
927 | case CMD_TX_ACKNOWLEDGE: | 949 | case CMD_TX_ACKNOWLEDGE: |
928 | kvaser_usb_tx_acknowledge(dev, msg); | 950 | kvaser_usb_tx_acknowledge(dev, msg); |
929 | break; | 951 | break; |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index 30d79bfa5b10..8ee9d1556e6e 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c | |||
@@ -504,15 +504,24 @@ static int pcan_usb_pro_restart_async(struct peak_usb_device *dev, | |||
504 | return usb_submit_urb(urb, GFP_ATOMIC); | 504 | return usb_submit_urb(urb, GFP_ATOMIC); |
505 | } | 505 | } |
506 | 506 | ||
507 | static void pcan_usb_pro_drv_loaded(struct peak_usb_device *dev, int loaded) | 507 | static int pcan_usb_pro_drv_loaded(struct peak_usb_device *dev, int loaded) |
508 | { | 508 | { |
509 | u8 buffer[16]; | 509 | u8 *buffer; |
510 | int err; | ||
511 | |||
512 | buffer = kmalloc(PCAN_USBPRO_FCT_DRVLD_REQ_LEN, GFP_KERNEL); | ||
513 | if (!buffer) | ||
514 | return -ENOMEM; | ||
510 | 515 | ||
511 | buffer[0] = 0; | 516 | buffer[0] = 0; |
512 | buffer[1] = !!loaded; | 517 | buffer[1] = !!loaded; |
513 | 518 | ||
514 | pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_FCT, | 519 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_FCT, |
515 | PCAN_USBPRO_FCT_DRVLD, buffer, sizeof(buffer)); | 520 | PCAN_USBPRO_FCT_DRVLD, buffer, |
521 | PCAN_USBPRO_FCT_DRVLD_REQ_LEN); | ||
522 | kfree(buffer); | ||
523 | |||
524 | return err; | ||
516 | } | 525 | } |
517 | 526 | ||
518 | static inline | 527 | static inline |
@@ -851,21 +860,24 @@ static int pcan_usb_pro_stop(struct peak_usb_device *dev) | |||
851 | */ | 860 | */ |
852 | static int pcan_usb_pro_init(struct peak_usb_device *dev) | 861 | static int pcan_usb_pro_init(struct peak_usb_device *dev) |
853 | { | 862 | { |
854 | struct pcan_usb_pro_interface *usb_if; | ||
855 | struct pcan_usb_pro_device *pdev = | 863 | struct pcan_usb_pro_device *pdev = |
856 | container_of(dev, struct pcan_usb_pro_device, dev); | 864 | container_of(dev, struct pcan_usb_pro_device, dev); |
865 | struct pcan_usb_pro_interface *usb_if = NULL; | ||
866 | struct pcan_usb_pro_fwinfo *fi = NULL; | ||
867 | struct pcan_usb_pro_blinfo *bi = NULL; | ||
868 | int err; | ||
857 | 869 | ||
858 | /* do this for 1st channel only */ | 870 | /* do this for 1st channel only */ |
859 | if (!dev->prev_siblings) { | 871 | if (!dev->prev_siblings) { |
860 | struct pcan_usb_pro_fwinfo fi; | ||
861 | struct pcan_usb_pro_blinfo bi; | ||
862 | int err; | ||
863 | |||
864 | /* allocate netdevices common structure attached to first one */ | 872 | /* allocate netdevices common structure attached to first one */ |
865 | usb_if = kzalloc(sizeof(struct pcan_usb_pro_interface), | 873 | usb_if = kzalloc(sizeof(struct pcan_usb_pro_interface), |
866 | GFP_KERNEL); | 874 | GFP_KERNEL); |
867 | if (!usb_if) | 875 | fi = kmalloc(sizeof(struct pcan_usb_pro_fwinfo), GFP_KERNEL); |
868 | return -ENOMEM; | 876 | bi = kmalloc(sizeof(struct pcan_usb_pro_blinfo), GFP_KERNEL); |
877 | if (!usb_if || !fi || !bi) { | ||
878 | err = -ENOMEM; | ||
879 | goto err_out; | ||
880 | } | ||
869 | 881 | ||
870 | /* number of ts msgs to ignore before taking one into account */ | 882 | /* number of ts msgs to ignore before taking one into account */ |
871 | usb_if->cm_ignore_count = 5; | 883 | usb_if->cm_ignore_count = 5; |
@@ -877,34 +889,34 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) | |||
877 | */ | 889 | */ |
878 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO, | 890 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO, |
879 | PCAN_USBPRO_INFO_FW, | 891 | PCAN_USBPRO_INFO_FW, |
880 | &fi, sizeof(fi)); | 892 | fi, sizeof(*fi)); |
881 | if (err) { | 893 | if (err) { |
882 | kfree(usb_if); | ||
883 | dev_err(dev->netdev->dev.parent, | 894 | dev_err(dev->netdev->dev.parent, |
884 | "unable to read %s firmware info (err %d)\n", | 895 | "unable to read %s firmware info (err %d)\n", |
885 | pcan_usb_pro.name, err); | 896 | pcan_usb_pro.name, err); |
886 | return err; | 897 | goto err_out; |
887 | } | 898 | } |
888 | 899 | ||
889 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO, | 900 | err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO, |
890 | PCAN_USBPRO_INFO_BL, | 901 | PCAN_USBPRO_INFO_BL, |
891 | &bi, sizeof(bi)); | 902 | bi, sizeof(*bi)); |
892 | if (err) { | 903 | if (err) { |
893 | kfree(usb_if); | ||
894 | dev_err(dev->netdev->dev.parent, | 904 | dev_err(dev->netdev->dev.parent, |
895 | "unable to read %s bootloader info (err %d)\n", | 905 | "unable to read %s bootloader info (err %d)\n", |
896 | pcan_usb_pro.name, err); | 906 | pcan_usb_pro.name, err); |
897 | return err; | 907 | goto err_out; |
898 | } | 908 | } |
899 | 909 | ||
910 | /* tell the device the can driver is running */ | ||
911 | err = pcan_usb_pro_drv_loaded(dev, 1); | ||
912 | if (err) | ||
913 | goto err_out; | ||
914 | |||
900 | dev_info(dev->netdev->dev.parent, | 915 | dev_info(dev->netdev->dev.parent, |
901 | "PEAK-System %s hwrev %u serial %08X.%08X (%u channels)\n", | 916 | "PEAK-System %s hwrev %u serial %08X.%08X (%u channels)\n", |
902 | pcan_usb_pro.name, | 917 | pcan_usb_pro.name, |
903 | bi.hw_rev, bi.serial_num_hi, bi.serial_num_lo, | 918 | bi->hw_rev, bi->serial_num_hi, bi->serial_num_lo, |
904 | pcan_usb_pro.ctrl_count); | 919 | pcan_usb_pro.ctrl_count); |
905 | |||
906 | /* tell the device the can driver is running */ | ||
907 | pcan_usb_pro_drv_loaded(dev, 1); | ||
908 | } else { | 920 | } else { |
909 | usb_if = pcan_usb_pro_dev_if(dev->prev_siblings); | 921 | usb_if = pcan_usb_pro_dev_if(dev->prev_siblings); |
910 | } | 922 | } |
@@ -916,6 +928,13 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) | |||
916 | pcan_usb_pro_set_led(dev, 0, 1); | 928 | pcan_usb_pro_set_led(dev, 0, 1); |
917 | 929 | ||
918 | return 0; | 930 | return 0; |
931 | |||
932 | err_out: | ||
933 | kfree(bi); | ||
934 | kfree(fi); | ||
935 | kfree(usb_if); | ||
936 | |||
937 | return err; | ||
919 | } | 938 | } |
920 | 939 | ||
921 | static void pcan_usb_pro_exit(struct peak_usb_device *dev) | 940 | static void pcan_usb_pro_exit(struct peak_usb_device *dev) |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.h b/drivers/net/can/usb/peak_usb/pcan_usb_pro.h index a869918c5620..32275af547e0 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.h +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.h | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | /* Vendor Request value for XXX_FCT */ | 30 | /* Vendor Request value for XXX_FCT */ |
31 | #define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */ | 31 | #define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */ |
32 | #define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16 | ||
32 | 33 | ||
33 | /* PCAN_USBPRO_INFO_BL vendor request record type */ | 34 | /* PCAN_USBPRO_INFO_BL vendor request record type */ |
34 | struct __packed pcan_usb_pro_blinfo { | 35 | struct __packed pcan_usb_pro_blinfo { |
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index de570a8f8967..072c6f14e8fc 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c | |||
@@ -632,7 +632,6 @@ struct vortex_private { | |||
632 | pm_state_valid:1, /* pci_dev->saved_config_space has sane contents */ | 632 | pm_state_valid:1, /* pci_dev->saved_config_space has sane contents */ |
633 | open:1, | 633 | open:1, |
634 | medialock:1, | 634 | medialock:1, |
635 | must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */ | ||
636 | large_frames:1, /* accept large frames */ | 635 | large_frames:1, /* accept large frames */ |
637 | handling_irq:1; /* private in_irq indicator */ | 636 | handling_irq:1; /* private in_irq indicator */ |
638 | /* {get|set}_wol operations are already serialized by rtnl. | 637 | /* {get|set}_wol operations are already serialized by rtnl. |
@@ -1012,6 +1011,12 @@ static int vortex_init_one(struct pci_dev *pdev, | |||
1012 | if (rc < 0) | 1011 | if (rc < 0) |
1013 | goto out; | 1012 | goto out; |
1014 | 1013 | ||
1014 | rc = pci_request_regions(pdev, DRV_NAME); | ||
1015 | if (rc < 0) { | ||
1016 | pci_disable_device(pdev); | ||
1017 | goto out; | ||
1018 | } | ||
1019 | |||
1015 | unit = vortex_cards_found; | 1020 | unit = vortex_cards_found; |
1016 | 1021 | ||
1017 | if (global_use_mmio < 0 && (unit >= MAX_UNITS || use_mmio[unit] < 0)) { | 1022 | if (global_use_mmio < 0 && (unit >= MAX_UNITS || use_mmio[unit] < 0)) { |
@@ -1027,6 +1032,7 @@ static int vortex_init_one(struct pci_dev *pdev, | |||
1027 | if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */ | 1032 | if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */ |
1028 | ioaddr = pci_iomap(pdev, 0, 0); | 1033 | ioaddr = pci_iomap(pdev, 0, 0); |
1029 | if (!ioaddr) { | 1034 | if (!ioaddr) { |
1035 | pci_release_regions(pdev); | ||
1030 | pci_disable_device(pdev); | 1036 | pci_disable_device(pdev); |
1031 | rc = -ENOMEM; | 1037 | rc = -ENOMEM; |
1032 | goto out; | 1038 | goto out; |
@@ -1036,6 +1042,7 @@ static int vortex_init_one(struct pci_dev *pdev, | |||
1036 | ent->driver_data, unit); | 1042 | ent->driver_data, unit); |
1037 | if (rc < 0) { | 1043 | if (rc < 0) { |
1038 | pci_iounmap(pdev, ioaddr); | 1044 | pci_iounmap(pdev, ioaddr); |
1045 | pci_release_regions(pdev); | ||
1039 | pci_disable_device(pdev); | 1046 | pci_disable_device(pdev); |
1040 | goto out; | 1047 | goto out; |
1041 | } | 1048 | } |
@@ -1178,11 +1185,6 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, | |||
1178 | 1185 | ||
1179 | /* PCI-only startup logic */ | 1186 | /* PCI-only startup logic */ |
1180 | if (pdev) { | 1187 | if (pdev) { |
1181 | /* EISA resources already marked, so only PCI needs to do this here */ | ||
1182 | /* Ignore return value, because Cardbus drivers already allocate for us */ | ||
1183 | if (request_region(dev->base_addr, vci->io_size, print_name) != NULL) | ||
1184 | vp->must_free_region = 1; | ||
1185 | |||
1186 | /* enable bus-mastering if necessary */ | 1188 | /* enable bus-mastering if necessary */ |
1187 | if (vci->flags & PCI_USES_MASTER) | 1189 | if (vci->flags & PCI_USES_MASTER) |
1188 | pci_set_master(pdev); | 1190 | pci_set_master(pdev); |
@@ -1220,7 +1222,7 @@ static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, | |||
1220 | &vp->rx_ring_dma); | 1222 | &vp->rx_ring_dma); |
1221 | retval = -ENOMEM; | 1223 | retval = -ENOMEM; |
1222 | if (!vp->rx_ring) | 1224 | if (!vp->rx_ring) |
1223 | goto free_region; | 1225 | goto free_device; |
1224 | 1226 | ||
1225 | vp->tx_ring = (struct boom_tx_desc *)(vp->rx_ring + RX_RING_SIZE); | 1227 | vp->tx_ring = (struct boom_tx_desc *)(vp->rx_ring + RX_RING_SIZE); |
1226 | vp->tx_ring_dma = vp->rx_ring_dma + sizeof(struct boom_rx_desc) * RX_RING_SIZE; | 1228 | vp->tx_ring_dma = vp->rx_ring_dma + sizeof(struct boom_rx_desc) * RX_RING_SIZE; |
@@ -1484,9 +1486,7 @@ free_ring: | |||
1484 | + sizeof(struct boom_tx_desc) * TX_RING_SIZE, | 1486 | + sizeof(struct boom_tx_desc) * TX_RING_SIZE, |
1485 | vp->rx_ring, | 1487 | vp->rx_ring, |
1486 | vp->rx_ring_dma); | 1488 | vp->rx_ring_dma); |
1487 | free_region: | 1489 | free_device: |
1488 | if (vp->must_free_region) | ||
1489 | release_region(dev->base_addr, vci->io_size); | ||
1490 | free_netdev(dev); | 1490 | free_netdev(dev); |
1491 | pr_err(PFX "vortex_probe1 fails. Returns %d\n", retval); | 1491 | pr_err(PFX "vortex_probe1 fails. Returns %d\n", retval); |
1492 | out: | 1492 | out: |
@@ -3254,8 +3254,9 @@ static void vortex_remove_one(struct pci_dev *pdev) | |||
3254 | + sizeof(struct boom_tx_desc) * TX_RING_SIZE, | 3254 | + sizeof(struct boom_tx_desc) * TX_RING_SIZE, |
3255 | vp->rx_ring, | 3255 | vp->rx_ring, |
3256 | vp->rx_ring_dma); | 3256 | vp->rx_ring_dma); |
3257 | if (vp->must_free_region) | 3257 | |
3258 | release_region(dev->base_addr, vp->io_size); | 3258 | pci_release_regions(pdev); |
3259 | |||
3259 | free_netdev(dev); | 3260 | free_netdev(dev); |
3260 | } | 3261 | } |
3261 | 3262 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index b8fbe266ab68..638e55435b04 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -3192,11 +3192,11 @@ static u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb) | |||
3192 | rc |= XMIT_CSUM_TCP; | 3192 | rc |= XMIT_CSUM_TCP; |
3193 | 3193 | ||
3194 | if (skb_is_gso_v6(skb)) { | 3194 | if (skb_is_gso_v6(skb)) { |
3195 | rc |= (XMIT_GSO_V6 | XMIT_CSUM_TCP | XMIT_CSUM_V6); | 3195 | rc |= (XMIT_GSO_V6 | XMIT_CSUM_TCP); |
3196 | if (rc & XMIT_CSUM_ENC) | 3196 | if (rc & XMIT_CSUM_ENC) |
3197 | rc |= XMIT_GSO_ENC_V6; | 3197 | rc |= XMIT_GSO_ENC_V6; |
3198 | } else if (skb_is_gso(skb)) { | 3198 | } else if (skb_is_gso(skb)) { |
3199 | rc |= (XMIT_GSO_V4 | XMIT_CSUM_V4 | XMIT_CSUM_TCP); | 3199 | rc |= (XMIT_GSO_V4 | XMIT_CSUM_TCP); |
3200 | if (rc & XMIT_CSUM_ENC) | 3200 | if (rc & XMIT_CSUM_ENC) |
3201 | rc |= XMIT_GSO_ENC_V4; | 3201 | rc |= XMIT_GSO_ENC_V4; |
3202 | } | 3202 | } |
@@ -3313,6 +3313,7 @@ static void bnx2x_set_pbd_gso_e2(struct sk_buff *skb, u32 *parsing_data, | |||
3313 | */ | 3313 | */ |
3314 | static void bnx2x_set_pbd_gso(struct sk_buff *skb, | 3314 | static void bnx2x_set_pbd_gso(struct sk_buff *skb, |
3315 | struct eth_tx_parse_bd_e1x *pbd, | 3315 | struct eth_tx_parse_bd_e1x *pbd, |
3316 | struct eth_tx_start_bd *tx_start_bd, | ||
3316 | u32 xmit_type) | 3317 | u32 xmit_type) |
3317 | { | 3318 | { |
3318 | pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | 3319 | pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
@@ -3326,11 +3327,14 @@ static void bnx2x_set_pbd_gso(struct sk_buff *skb, | |||
3326 | ip_hdr(skb)->daddr, | 3327 | ip_hdr(skb)->daddr, |
3327 | 0, IPPROTO_TCP, 0)); | 3328 | 0, IPPROTO_TCP, 0)); |
3328 | 3329 | ||
3329 | } else | 3330 | /* GSO on 57710/57711 needs FW to calculate IP checksum */ |
3331 | tx_start_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_IP_CSUM; | ||
3332 | } else { | ||
3330 | pbd->tcp_pseudo_csum = | 3333 | pbd->tcp_pseudo_csum = |
3331 | bswab16(~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 3334 | bswab16(~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
3332 | &ipv6_hdr(skb)->daddr, | 3335 | &ipv6_hdr(skb)->daddr, |
3333 | 0, IPPROTO_TCP, 0)); | 3336 | 0, IPPROTO_TCP, 0)); |
3337 | } | ||
3334 | 3338 | ||
3335 | pbd->global_data |= | 3339 | pbd->global_data |= |
3336 | cpu_to_le16(ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN); | 3340 | cpu_to_le16(ETH_TX_PARSE_BD_E1X_PSEUDO_CS_WITHOUT_LEN); |
@@ -3479,19 +3483,18 @@ static void bnx2x_update_pbds_gso_enc(struct sk_buff *skb, | |||
3479 | { | 3483 | { |
3480 | u16 hlen_w = 0; | 3484 | u16 hlen_w = 0; |
3481 | u8 outerip_off, outerip_len = 0; | 3485 | u8 outerip_off, outerip_len = 0; |
3486 | |||
3482 | /* from outer IP to transport */ | 3487 | /* from outer IP to transport */ |
3483 | hlen_w = (skb_inner_transport_header(skb) - | 3488 | hlen_w = (skb_inner_transport_header(skb) - |
3484 | skb_network_header(skb)) >> 1; | 3489 | skb_network_header(skb)) >> 1; |
3485 | 3490 | ||
3486 | /* transport len */ | 3491 | /* transport len */ |
3487 | if (xmit_type & XMIT_CSUM_TCP) | 3492 | hlen_w += inner_tcp_hdrlen(skb) >> 1; |
3488 | hlen_w += inner_tcp_hdrlen(skb) >> 1; | ||
3489 | else | ||
3490 | hlen_w += sizeof(struct udphdr) >> 1; | ||
3491 | 3493 | ||
3492 | pbd2->fw_ip_hdr_to_payload_w = hlen_w; | 3494 | pbd2->fw_ip_hdr_to_payload_w = hlen_w; |
3493 | 3495 | ||
3494 | if (xmit_type & XMIT_CSUM_ENC_V4) { | 3496 | /* outer IP header info */ |
3497 | if (xmit_type & XMIT_CSUM_V4) { | ||
3495 | struct iphdr *iph = ip_hdr(skb); | 3498 | struct iphdr *iph = ip_hdr(skb); |
3496 | pbd2->fw_ip_csum_wo_len_flags_frag = | 3499 | pbd2->fw_ip_csum_wo_len_flags_frag = |
3497 | bswab16(csum_fold((~iph->check) - | 3500 | bswab16(csum_fold((~iph->check) - |
@@ -3814,7 +3817,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3814 | bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data, | 3817 | bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data, |
3815 | xmit_type); | 3818 | xmit_type); |
3816 | else | 3819 | else |
3817 | bnx2x_set_pbd_gso(skb, pbd_e1x, xmit_type); | 3820 | bnx2x_set_pbd_gso(skb, pbd_e1x, first_bd, xmit_type); |
3818 | } | 3821 | } |
3819 | 3822 | ||
3820 | /* Set the PBD's parsing_data field if not zero | 3823 | /* Set the PBD's parsing_data field if not zero |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 728d42ab2a76..c777b9013164 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -94,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) | |||
94 | 94 | ||
95 | #define DRV_MODULE_NAME "tg3" | 95 | #define DRV_MODULE_NAME "tg3" |
96 | #define TG3_MAJ_NUM 3 | 96 | #define TG3_MAJ_NUM 3 |
97 | #define TG3_MIN_NUM 131 | 97 | #define TG3_MIN_NUM 132 |
98 | #define DRV_MODULE_VERSION \ | 98 | #define DRV_MODULE_VERSION \ |
99 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) | 99 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) |
100 | #define DRV_MODULE_RELDATE "April 09, 2013" | 100 | #define DRV_MODULE_RELDATE "May 21, 2013" |
101 | 101 | ||
102 | #define RESET_KIND_SHUTDOWN 0 | 102 | #define RESET_KIND_SHUTDOWN 0 |
103 | #define RESET_KIND_INIT 1 | 103 | #define RESET_KIND_INIT 1 |
@@ -1800,6 +1800,9 @@ static int tg3_poll_fw(struct tg3 *tp) | |||
1800 | int i; | 1800 | int i; |
1801 | u32 val; | 1801 | u32 val; |
1802 | 1802 | ||
1803 | if (tg3_flag(tp, NO_FWARE_REPORTED)) | ||
1804 | return 0; | ||
1805 | |||
1803 | if (tg3_flag(tp, IS_SSB_CORE)) { | 1806 | if (tg3_flag(tp, IS_SSB_CORE)) { |
1804 | /* We don't use firmware. */ | 1807 | /* We don't use firmware. */ |
1805 | return 0; | 1808 | return 0; |
@@ -2957,6 +2960,31 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed) | |||
2957 | return 0; | 2960 | return 0; |
2958 | } | 2961 | } |
2959 | 2962 | ||
2963 | static bool tg3_phy_power_bug(struct tg3 *tp) | ||
2964 | { | ||
2965 | switch (tg3_asic_rev(tp)) { | ||
2966 | case ASIC_REV_5700: | ||
2967 | case ASIC_REV_5704: | ||
2968 | return true; | ||
2969 | case ASIC_REV_5780: | ||
2970 | if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) | ||
2971 | return true; | ||
2972 | return false; | ||
2973 | case ASIC_REV_5717: | ||
2974 | if (!tp->pci_fn) | ||
2975 | return true; | ||
2976 | return false; | ||
2977 | case ASIC_REV_5719: | ||
2978 | case ASIC_REV_5720: | ||
2979 | if ((tp->phy_flags & TG3_PHYFLG_PHY_SERDES) && | ||
2980 | !tp->pci_fn) | ||
2981 | return true; | ||
2982 | return false; | ||
2983 | } | ||
2984 | |||
2985 | return false; | ||
2986 | } | ||
2987 | |||
2960 | static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | 2988 | static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) |
2961 | { | 2989 | { |
2962 | u32 val; | 2990 | u32 val; |
@@ -3016,12 +3044,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | |||
3016 | /* The PHY should not be powered down on some chips because | 3044 | /* The PHY should not be powered down on some chips because |
3017 | * of bugs. | 3045 | * of bugs. |
3018 | */ | 3046 | */ |
3019 | if (tg3_asic_rev(tp) == ASIC_REV_5700 || | 3047 | if (tg3_phy_power_bug(tp)) |
3020 | tg3_asic_rev(tp) == ASIC_REV_5704 || | ||
3021 | (tg3_asic_rev(tp) == ASIC_REV_5780 && | ||
3022 | (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) || | ||
3023 | (tg3_asic_rev(tp) == ASIC_REV_5717 && | ||
3024 | !tp->pci_fn)) | ||
3025 | return; | 3048 | return; |
3026 | 3049 | ||
3027 | if (tg3_chip_rev(tp) == CHIPREV_5784_AX || | 3050 | if (tg3_chip_rev(tp) == CHIPREV_5784_AX || |
@@ -7428,6 +7451,20 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) | |||
7428 | return (base > 0xffffdcc0) && (base + len + 8 < base); | 7451 | return (base > 0xffffdcc0) && (base + len + 8 < base); |
7429 | } | 7452 | } |
7430 | 7453 | ||
7454 | /* Test for TSO DMA buffers that cross into regions which are within MSS bytes | ||
7455 | * of any 4GB boundaries: 4G, 8G, etc | ||
7456 | */ | ||
7457 | static inline int tg3_4g_tso_overflow_test(struct tg3 *tp, dma_addr_t mapping, | ||
7458 | u32 len, u32 mss) | ||
7459 | { | ||
7460 | if (tg3_asic_rev(tp) == ASIC_REV_5762 && mss) { | ||
7461 | u32 base = (u32) mapping & 0xffffffff; | ||
7462 | |||
7463 | return ((base + len + (mss & 0x3fff)) < base); | ||
7464 | } | ||
7465 | return 0; | ||
7466 | } | ||
7467 | |||
7431 | /* Test for DMA addresses > 40-bit */ | 7468 | /* Test for DMA addresses > 40-bit */ |
7432 | static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping, | 7469 | static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping, |
7433 | int len) | 7470 | int len) |
@@ -7464,6 +7501,9 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget, | |||
7464 | if (tg3_4g_overflow_test(map, len)) | 7501 | if (tg3_4g_overflow_test(map, len)) |
7465 | hwbug = true; | 7502 | hwbug = true; |
7466 | 7503 | ||
7504 | if (tg3_4g_tso_overflow_test(tp, map, len, mss)) | ||
7505 | hwbug = true; | ||
7506 | |||
7467 | if (tg3_40bit_overflow_test(tp, map, len)) | 7507 | if (tg3_40bit_overflow_test(tp, map, len)) |
7468 | hwbug = true; | 7508 | hwbug = true; |
7469 | 7509 | ||
@@ -8874,6 +8914,10 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
8874 | tg3_halt_cpu(tp, RX_CPU_BASE); | 8914 | tg3_halt_cpu(tp, RX_CPU_BASE); |
8875 | } | 8915 | } |
8876 | 8916 | ||
8917 | err = tg3_poll_fw(tp); | ||
8918 | if (err) | ||
8919 | return err; | ||
8920 | |||
8877 | tw32(GRC_MODE, tp->grc_mode); | 8921 | tw32(GRC_MODE, tp->grc_mode); |
8878 | 8922 | ||
8879 | if (tg3_chip_rev_id(tp) == CHIPREV_ID_5705_A0) { | 8923 | if (tg3_chip_rev_id(tp) == CHIPREV_ID_5705_A0) { |
@@ -8904,10 +8948,6 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
8904 | 8948 | ||
8905 | tg3_ape_unlock(tp, TG3_APE_LOCK_GRC); | 8949 | tg3_ape_unlock(tp, TG3_APE_LOCK_GRC); |
8906 | 8950 | ||
8907 | err = tg3_poll_fw(tp); | ||
8908 | if (err) | ||
8909 | return err; | ||
8910 | |||
8911 | tg3_mdio_start(tp); | 8951 | tg3_mdio_start(tp); |
8912 | 8952 | ||
8913 | if (tg3_flag(tp, PCI_EXPRESS) && | 8953 | if (tg3_flag(tp, PCI_EXPRESS) && |
@@ -9431,6 +9471,14 @@ static void tg3_rss_write_indir_tbl(struct tg3 *tp) | |||
9431 | } | 9471 | } |
9432 | } | 9472 | } |
9433 | 9473 | ||
9474 | static inline u32 tg3_lso_rd_dma_workaround_bit(struct tg3 *tp) | ||
9475 | { | ||
9476 | if (tg3_asic_rev(tp) == ASIC_REV_5719) | ||
9477 | return TG3_LSO_RD_DMA_TX_LENGTH_WA_5719; | ||
9478 | else | ||
9479 | return TG3_LSO_RD_DMA_TX_LENGTH_WA_5720; | ||
9480 | } | ||
9481 | |||
9434 | /* tp->lock is held. */ | 9482 | /* tp->lock is held. */ |
9435 | static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) | 9483 | static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) |
9436 | { | 9484 | { |
@@ -10116,16 +10164,17 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) | |||
10116 | tw32_f(RDMAC_MODE, rdmac_mode); | 10164 | tw32_f(RDMAC_MODE, rdmac_mode); |
10117 | udelay(40); | 10165 | udelay(40); |
10118 | 10166 | ||
10119 | if (tg3_asic_rev(tp) == ASIC_REV_5719) { | 10167 | if (tg3_asic_rev(tp) == ASIC_REV_5719 || |
10168 | tg3_asic_rev(tp) == ASIC_REV_5720) { | ||
10120 | for (i = 0; i < TG3_NUM_RDMA_CHANNELS; i++) { | 10169 | for (i = 0; i < TG3_NUM_RDMA_CHANNELS; i++) { |
10121 | if (tr32(TG3_RDMA_LENGTH + (i << 2)) > TG3_MAX_MTU(tp)) | 10170 | if (tr32(TG3_RDMA_LENGTH + (i << 2)) > TG3_MAX_MTU(tp)) |
10122 | break; | 10171 | break; |
10123 | } | 10172 | } |
10124 | if (i < TG3_NUM_RDMA_CHANNELS) { | 10173 | if (i < TG3_NUM_RDMA_CHANNELS) { |
10125 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); | 10174 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); |
10126 | val |= TG3_LSO_RD_DMA_TX_LENGTH_WA; | 10175 | val |= tg3_lso_rd_dma_workaround_bit(tp); |
10127 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); | 10176 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); |
10128 | tg3_flag_set(tp, 5719_RDMA_BUG); | 10177 | tg3_flag_set(tp, 5719_5720_RDMA_BUG); |
10129 | } | 10178 | } |
10130 | } | 10179 | } |
10131 | 10180 | ||
@@ -10358,6 +10407,13 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy) | |||
10358 | */ | 10407 | */ |
10359 | static int tg3_init_hw(struct tg3 *tp, bool reset_phy) | 10408 | static int tg3_init_hw(struct tg3 *tp, bool reset_phy) |
10360 | { | 10409 | { |
10410 | /* Chip may have been just powered on. If so, the boot code may still | ||
10411 | * be running initialization. Wait for it to finish to avoid races in | ||
10412 | * accessing the hardware. | ||
10413 | */ | ||
10414 | tg3_enable_register_access(tp); | ||
10415 | tg3_poll_fw(tp); | ||
10416 | |||
10361 | tg3_switch_clocks(tp); | 10417 | tg3_switch_clocks(tp); |
10362 | 10418 | ||
10363 | tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); | 10419 | tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); |
@@ -10489,15 +10545,15 @@ static void tg3_periodic_fetch_stats(struct tg3 *tp) | |||
10489 | TG3_STAT_ADD32(&sp->tx_ucast_packets, MAC_TX_STATS_UCAST); | 10545 | TG3_STAT_ADD32(&sp->tx_ucast_packets, MAC_TX_STATS_UCAST); |
10490 | TG3_STAT_ADD32(&sp->tx_mcast_packets, MAC_TX_STATS_MCAST); | 10546 | TG3_STAT_ADD32(&sp->tx_mcast_packets, MAC_TX_STATS_MCAST); |
10491 | TG3_STAT_ADD32(&sp->tx_bcast_packets, MAC_TX_STATS_BCAST); | 10547 | TG3_STAT_ADD32(&sp->tx_bcast_packets, MAC_TX_STATS_BCAST); |
10492 | if (unlikely(tg3_flag(tp, 5719_RDMA_BUG) && | 10548 | if (unlikely(tg3_flag(tp, 5719_5720_RDMA_BUG) && |
10493 | (sp->tx_ucast_packets.low + sp->tx_mcast_packets.low + | 10549 | (sp->tx_ucast_packets.low + sp->tx_mcast_packets.low + |
10494 | sp->tx_bcast_packets.low) > TG3_NUM_RDMA_CHANNELS)) { | 10550 | sp->tx_bcast_packets.low) > TG3_NUM_RDMA_CHANNELS)) { |
10495 | u32 val; | 10551 | u32 val; |
10496 | 10552 | ||
10497 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); | 10553 | val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL); |
10498 | val &= ~TG3_LSO_RD_DMA_TX_LENGTH_WA; | 10554 | val &= ~tg3_lso_rd_dma_workaround_bit(tp); |
10499 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); | 10555 | tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val); |
10500 | tg3_flag_clear(tp, 5719_RDMA_BUG); | 10556 | tg3_flag_clear(tp, 5719_5720_RDMA_BUG); |
10501 | } | 10557 | } |
10502 | 10558 | ||
10503 | TG3_STAT_ADD32(&sp->rx_octets, MAC_RX_STATS_OCTETS); | 10559 | TG3_STAT_ADD32(&sp->rx_octets, MAC_RX_STATS_OCTETS); |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index 9b2d3ac2474a..ff6e30eeae35 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
@@ -1422,7 +1422,8 @@ | |||
1422 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL 0x00004910 | 1422 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL 0x00004910 |
1423 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_BD_4K 0x00030000 | 1423 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_BD_4K 0x00030000 |
1424 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_LSO_4K 0x000c0000 | 1424 | #define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_LSO_4K 0x000c0000 |
1425 | #define TG3_LSO_RD_DMA_TX_LENGTH_WA 0x02000000 | 1425 | #define TG3_LSO_RD_DMA_TX_LENGTH_WA_5719 0x02000000 |
1426 | #define TG3_LSO_RD_DMA_TX_LENGTH_WA_5720 0x00200000 | ||
1426 | /* 0x4914 --> 0x4be0 unused */ | 1427 | /* 0x4914 --> 0x4be0 unused */ |
1427 | 1428 | ||
1428 | #define TG3_NUM_RDMA_CHANNELS 4 | 1429 | #define TG3_NUM_RDMA_CHANNELS 4 |
@@ -3059,7 +3060,7 @@ enum TG3_FLAGS { | |||
3059 | TG3_FLAG_APE_HAS_NCSI, | 3060 | TG3_FLAG_APE_HAS_NCSI, |
3060 | TG3_FLAG_TX_TSTAMP_EN, | 3061 | TG3_FLAG_TX_TSTAMP_EN, |
3061 | TG3_FLAG_4K_FIFO_LIMIT, | 3062 | TG3_FLAG_4K_FIFO_LIMIT, |
3062 | TG3_FLAG_5719_RDMA_BUG, | 3063 | TG3_FLAG_5719_5720_RDMA_BUG, |
3063 | TG3_FLAG_RESET_TASK_PENDING, | 3064 | TG3_FLAG_RESET_TASK_PENDING, |
3064 | TG3_FLAG_PTP_CAPABLE, | 3065 | TG3_FLAG_PTP_CAPABLE, |
3065 | TG3_FLAG_5705_PLUS, | 3066 | TG3_FLAG_5705_PLUS, |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index ce4a030d3d0c..07f7ef05c3f2 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -3236,9 +3236,10 @@ bnad_init(struct bnad *bnad, | |||
3236 | 3236 | ||
3237 | sprintf(bnad->wq_name, "%s_wq_%d", BNAD_NAME, bnad->id); | 3237 | sprintf(bnad->wq_name, "%s_wq_%d", BNAD_NAME, bnad->id); |
3238 | bnad->work_q = create_singlethread_workqueue(bnad->wq_name); | 3238 | bnad->work_q = create_singlethread_workqueue(bnad->wq_name); |
3239 | 3239 | if (!bnad->work_q) { | |
3240 | if (!bnad->work_q) | 3240 | iounmap(bnad->bar0); |
3241 | return -ENOMEM; | 3241 | return -ENOMEM; |
3242 | } | ||
3242 | 3243 | ||
3243 | return 0; | 3244 | return 0; |
3244 | } | 3245 | } |
diff --git a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c index 6e8bc9d88c41..94d957d203a6 100644 --- a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c +++ b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c | |||
@@ -244,7 +244,7 @@ bnad_debugfs_lseek(struct file *file, loff_t offset, int orig) | |||
244 | file->f_pos += offset; | 244 | file->f_pos += offset; |
245 | break; | 245 | break; |
246 | case 2: | 246 | case 2: |
247 | file->f_pos = debug->buffer_len - offset; | 247 | file->f_pos = debug->buffer_len + offset; |
248 | break; | 248 | break; |
249 | default: | 249 | default: |
250 | return -EINVAL; | 250 | return -EINVAL; |
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig index 1194446f859a..768285ec10f4 100644 --- a/drivers/net/ethernet/cadence/Kconfig +++ b/drivers/net/ethernet/cadence/Kconfig | |||
@@ -22,7 +22,7 @@ if NET_CADENCE | |||
22 | 22 | ||
23 | config ARM_AT91_ETHER | 23 | config ARM_AT91_ETHER |
24 | tristate "AT91RM9200 Ethernet support" | 24 | tristate "AT91RM9200 Ethernet support" |
25 | depends on GENERIC_HARDIRQS | 25 | depends on GENERIC_HARDIRQS && HAS_DMA |
26 | select NET_CORE | 26 | select NET_CORE |
27 | select MACB | 27 | select MACB |
28 | ---help--- | 28 | ---help--- |
@@ -31,6 +31,7 @@ config ARM_AT91_ETHER | |||
31 | 31 | ||
32 | config MACB | 32 | config MACB |
33 | tristate "Cadence MACB/GEM support" | 33 | tristate "Cadence MACB/GEM support" |
34 | depends on HAS_DMA | ||
34 | select PHYLIB | 35 | select PHYLIB |
35 | ---help--- | 36 | ---help--- |
36 | The Cadence MACB ethernet interface is found on many Atmel AT32 and | 37 | The Cadence MACB ethernet interface is found on many Atmel AT32 and |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 6be513deb17f..c89aa41dd448 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -485,7 +485,8 @@ static void macb_tx_interrupt(struct macb *bp) | |||
485 | status = macb_readl(bp, TSR); | 485 | status = macb_readl(bp, TSR); |
486 | macb_writel(bp, TSR, status); | 486 | macb_writel(bp, TSR, status); |
487 | 487 | ||
488 | macb_writel(bp, ISR, MACB_BIT(TCOMP)); | 488 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) |
489 | macb_writel(bp, ISR, MACB_BIT(TCOMP)); | ||
489 | 490 | ||
490 | netdev_vdbg(bp->dev, "macb_tx_interrupt status = 0x%03lx\n", | 491 | netdev_vdbg(bp->dev, "macb_tx_interrupt status = 0x%03lx\n", |
491 | (unsigned long)status); | 492 | (unsigned long)status); |
@@ -738,7 +739,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
738 | * now. | 739 | * now. |
739 | */ | 740 | */ |
740 | macb_writel(bp, IDR, MACB_RX_INT_FLAGS); | 741 | macb_writel(bp, IDR, MACB_RX_INT_FLAGS); |
741 | macb_writel(bp, ISR, MACB_BIT(RCOMP)); | 742 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) |
743 | macb_writel(bp, ISR, MACB_BIT(RCOMP)); | ||
742 | 744 | ||
743 | if (napi_schedule_prep(&bp->napi)) { | 745 | if (napi_schedule_prep(&bp->napi)) { |
744 | netdev_vdbg(bp->dev, "scheduling RX softirq\n"); | 746 | netdev_vdbg(bp->dev, "scheduling RX softirq\n"); |
@@ -1062,6 +1064,17 @@ static void macb_configure_dma(struct macb *bp) | |||
1062 | } | 1064 | } |
1063 | } | 1065 | } |
1064 | 1066 | ||
1067 | /* | ||
1068 | * Configure peripheral capacities according to integration options used | ||
1069 | */ | ||
1070 | static void macb_configure_caps(struct macb *bp) | ||
1071 | { | ||
1072 | if (macb_is_gem(bp)) { | ||
1073 | if (GEM_BF(IRQCOR, gem_readl(bp, DCFG1)) == 0) | ||
1074 | bp->caps |= MACB_CAPS_ISR_CLEAR_ON_WRITE; | ||
1075 | } | ||
1076 | } | ||
1077 | |||
1065 | static void macb_init_hw(struct macb *bp) | 1078 | static void macb_init_hw(struct macb *bp) |
1066 | { | 1079 | { |
1067 | u32 config; | 1080 | u32 config; |
@@ -1084,6 +1097,7 @@ static void macb_init_hw(struct macb *bp) | |||
1084 | bp->duplex = DUPLEX_HALF; | 1097 | bp->duplex = DUPLEX_HALF; |
1085 | 1098 | ||
1086 | macb_configure_dma(bp); | 1099 | macb_configure_dma(bp); |
1100 | macb_configure_caps(bp); | ||
1087 | 1101 | ||
1088 | /* Initialize TX and RX buffers */ | 1102 | /* Initialize TX and RX buffers */ |
1089 | macb_writel(bp, RBQP, bp->rx_ring_dma); | 1103 | macb_writel(bp, RBQP, bp->rx_ring_dma); |
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 993d70380688..548c0ecae869 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
@@ -300,6 +300,8 @@ | |||
300 | #define MACB_REV_SIZE 16 | 300 | #define MACB_REV_SIZE 16 |
301 | 301 | ||
302 | /* Bitfields in DCFG1. */ | 302 | /* Bitfields in DCFG1. */ |
303 | #define GEM_IRQCOR_OFFSET 23 | ||
304 | #define GEM_IRQCOR_SIZE 1 | ||
303 | #define GEM_DBWDEF_OFFSET 25 | 305 | #define GEM_DBWDEF_OFFSET 25 |
304 | #define GEM_DBWDEF_SIZE 3 | 306 | #define GEM_DBWDEF_SIZE 3 |
305 | 307 | ||
@@ -323,6 +325,9 @@ | |||
323 | #define MACB_MAN_READ 2 | 325 | #define MACB_MAN_READ 2 |
324 | #define MACB_MAN_CODE 2 | 326 | #define MACB_MAN_CODE 2 |
325 | 327 | ||
328 | /* Capability mask bits */ | ||
329 | #define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x1 | ||
330 | |||
326 | /* Bit manipulation macros */ | 331 | /* Bit manipulation macros */ |
327 | #define MACB_BIT(name) \ | 332 | #define MACB_BIT(name) \ |
328 | (1 << MACB_##name##_OFFSET) | 333 | (1 << MACB_##name##_OFFSET) |
@@ -574,6 +579,8 @@ struct macb { | |||
574 | unsigned int speed; | 579 | unsigned int speed; |
575 | unsigned int duplex; | 580 | unsigned int duplex; |
576 | 581 | ||
582 | u32 caps; | ||
583 | |||
577 | phy_interface_t phy_interface; | 584 | phy_interface_t phy_interface; |
578 | 585 | ||
579 | /* AT91RM9200 transmit */ | 586 | /* AT91RM9200 transmit */ |
diff --git a/drivers/net/ethernet/calxeda/Kconfig b/drivers/net/ethernet/calxeda/Kconfig index aba435c3d4ae..184a063bed5f 100644 --- a/drivers/net/ethernet/calxeda/Kconfig +++ b/drivers/net/ethernet/calxeda/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config NET_CALXEDA_XGMAC | 1 | config NET_CALXEDA_XGMAC |
2 | tristate "Calxeda 1G/10G XGMAC Ethernet driver" | 2 | tristate "Calxeda 1G/10G XGMAC Ethernet driver" |
3 | depends on HAS_IOMEM | 3 | depends on HAS_IOMEM && HAS_DMA |
4 | select CRC32 | 4 | select CRC32 |
5 | help | 5 | help |
6 | This is the driver for the XGMAC Ethernet IP block found on Calxeda | 6 | This is the driver for the XGMAC Ethernet IP block found on Calxeda |
diff --git a/drivers/net/ethernet/dec/tulip/interrupt.c b/drivers/net/ethernet/dec/tulip/interrupt.c index 28a5e425fecf..92306b320840 100644 --- a/drivers/net/ethernet/dec/tulip/interrupt.c +++ b/drivers/net/ethernet/dec/tulip/interrupt.c | |||
@@ -76,6 +76,12 @@ int tulip_refill_rx(struct net_device *dev) | |||
76 | 76 | ||
77 | mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, | 77 | mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ, |
78 | PCI_DMA_FROMDEVICE); | 78 | PCI_DMA_FROMDEVICE); |
79 | if (dma_mapping_error(&tp->pdev->dev, mapping)) { | ||
80 | dev_kfree_skb(skb); | ||
81 | tp->rx_buffers[entry].skb = NULL; | ||
82 | break; | ||
83 | } | ||
84 | |||
79 | tp->rx_buffers[entry].mapping = mapping; | 85 | tp->rx_buffers[entry].mapping = mapping; |
80 | 86 | ||
81 | tp->rx_ring[entry].buffer1 = cpu_to_le32(mapping); | 87 | tp->rx_ring[entry].buffer1 = cpu_to_le32(mapping); |
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index f544b297c9ab..0a510684e468 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -262,6 +262,7 @@ struct be_rx_compl_info { | |||
262 | u8 ipv6; | 262 | u8 ipv6; |
263 | u8 vtm; | 263 | u8 vtm; |
264 | u8 pkt_type; | 264 | u8 pkt_type; |
265 | u8 ip_frag; | ||
265 | }; | 266 | }; |
266 | 267 | ||
267 | struct be_rx_obj { | 268 | struct be_rx_obj { |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index fd7b547698ab..1db2df61b8af 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -562,7 +562,7 @@ int lancer_test_and_set_rdy_state(struct be_adapter *adapter) | |||
562 | 562 | ||
563 | resource_error = lancer_provisioning_error(adapter); | 563 | resource_error = lancer_provisioning_error(adapter); |
564 | if (resource_error) | 564 | if (resource_error) |
565 | return -1; | 565 | return -EAGAIN; |
566 | 566 | ||
567 | status = lancer_wait_ready(adapter); | 567 | status = lancer_wait_ready(adapter); |
568 | if (!status) { | 568 | if (!status) { |
@@ -590,8 +590,8 @@ int lancer_test_and_set_rdy_state(struct be_adapter *adapter) | |||
590 | * when PF provisions resources. | 590 | * when PF provisions resources. |
591 | */ | 591 | */ |
592 | resource_error = lancer_provisioning_error(adapter); | 592 | resource_error = lancer_provisioning_error(adapter); |
593 | if (status == -1 && !resource_error) | 593 | if (resource_error) |
594 | adapter->eeh_error = true; | 594 | status = -EAGAIN; |
595 | 595 | ||
596 | return status; | 596 | return status; |
597 | } | 597 | } |
@@ -2976,22 +2976,17 @@ static struct be_nic_resource_desc *be_get_nic_desc(u8 *buf, u32 desc_count, | |||
2976 | for (i = 0; i < desc_count; i++) { | 2976 | for (i = 0; i < desc_count; i++) { |
2977 | desc->desc_len = desc->desc_len ? : RESOURCE_DESC_SIZE; | 2977 | desc->desc_len = desc->desc_len ? : RESOURCE_DESC_SIZE; |
2978 | if (((void *)desc + desc->desc_len) > | 2978 | if (((void *)desc + desc->desc_len) > |
2979 | (void *)(buf + max_buf_size)) { | 2979 | (void *)(buf + max_buf_size)) |
2980 | desc = NULL; | 2980 | return NULL; |
2981 | break; | ||
2982 | } | ||
2983 | 2981 | ||
2984 | if (desc->desc_type == NIC_RESOURCE_DESC_TYPE_V0 || | 2982 | if (desc->desc_type == NIC_RESOURCE_DESC_TYPE_V0 || |
2985 | desc->desc_type == NIC_RESOURCE_DESC_TYPE_V1) | 2983 | desc->desc_type == NIC_RESOURCE_DESC_TYPE_V1) |
2986 | break; | 2984 | return desc; |
2987 | 2985 | ||
2988 | desc = (void *)desc + desc->desc_len; | 2986 | desc = (void *)desc + desc->desc_len; |
2989 | } | 2987 | } |
2990 | 2988 | ||
2991 | if (!desc || i == MAX_RESOURCE_DESC) | 2989 | return NULL; |
2992 | return NULL; | ||
2993 | |||
2994 | return desc; | ||
2995 | } | 2990 | } |
2996 | 2991 | ||
2997 | /* Uses Mbox */ | 2992 | /* Uses Mbox */ |
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h index 3c1099b47f2a..8780183c6d1c 100644 --- a/drivers/net/ethernet/emulex/benet/be_hw.h +++ b/drivers/net/ethernet/emulex/benet/be_hw.h | |||
@@ -356,7 +356,7 @@ struct amap_eth_rx_compl_v0 { | |||
356 | u8 ip_version; /* dword 1 */ | 356 | u8 ip_version; /* dword 1 */ |
357 | u8 macdst[6]; /* dword 1 */ | 357 | u8 macdst[6]; /* dword 1 */ |
358 | u8 vtp; /* dword 1 */ | 358 | u8 vtp; /* dword 1 */ |
359 | u8 rsvd0; /* dword 1 */ | 359 | u8 ip_frag; /* dword 1 */ |
360 | u8 fragndx[10]; /* dword 1 */ | 360 | u8 fragndx[10]; /* dword 1 */ |
361 | u8 ct[2]; /* dword 1 */ | 361 | u8 ct[2]; /* dword 1 */ |
362 | u8 sw; /* dword 1 */ | 362 | u8 sw; /* dword 1 */ |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index a444110b060f..a0b4be51f0d1 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -780,26 +780,18 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter, | |||
780 | if (unlikely(!skb)) | 780 | if (unlikely(!skb)) |
781 | return skb; | 781 | return skb; |
782 | 782 | ||
783 | if (vlan_tx_tag_present(skb)) { | 783 | if (vlan_tx_tag_present(skb)) |
784 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); | 784 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); |
785 | skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); | 785 | else if (qnq_async_evt_rcvd(adapter) && adapter->pvid) |
786 | if (skb) | 786 | vlan_tag = adapter->pvid; |
787 | skb->vlan_tci = 0; | ||
788 | } | ||
789 | |||
790 | if (qnq_async_evt_rcvd(adapter) && adapter->pvid) { | ||
791 | if (!vlan_tag) | ||
792 | vlan_tag = adapter->pvid; | ||
793 | if (skip_hw_vlan) | ||
794 | *skip_hw_vlan = true; | ||
795 | } | ||
796 | 787 | ||
797 | if (vlan_tag) { | 788 | if (vlan_tag) { |
798 | skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); | 789 | skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); |
799 | if (unlikely(!skb)) | 790 | if (unlikely(!skb)) |
800 | return skb; | 791 | return skb; |
801 | |||
802 | skb->vlan_tci = 0; | 792 | skb->vlan_tci = 0; |
793 | if (skip_hw_vlan) | ||
794 | *skip_hw_vlan = true; | ||
803 | } | 795 | } |
804 | 796 | ||
805 | /* Insert the outer VLAN, if any */ | 797 | /* Insert the outer VLAN, if any */ |
@@ -1607,6 +1599,8 @@ static void be_parse_rx_compl_v0(struct be_eth_rx_compl *compl, | |||
1607 | compl); | 1599 | compl); |
1608 | } | 1600 | } |
1609 | rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl); | 1601 | rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl); |
1602 | rxcp->ip_frag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, | ||
1603 | ip_frag, compl); | ||
1610 | } | 1604 | } |
1611 | 1605 | ||
1612 | static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) | 1606 | static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) |
@@ -1628,6 +1622,9 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) | |||
1628 | else | 1622 | else |
1629 | be_parse_rx_compl_v0(compl, rxcp); | 1623 | be_parse_rx_compl_v0(compl, rxcp); |
1630 | 1624 | ||
1625 | if (rxcp->ip_frag) | ||
1626 | rxcp->l4_csum = 0; | ||
1627 | |||
1631 | if (rxcp->vlanf) { | 1628 | if (rxcp->vlanf) { |
1632 | /* vlanf could be wrongly set in some cards. | 1629 | /* vlanf could be wrongly set in some cards. |
1633 | * ignore if vtm is not set */ | 1630 | * ignore if vtm is not set */ |
@@ -2176,7 +2173,7 @@ static irqreturn_t be_msix(int irq, void *dev) | |||
2176 | 2173 | ||
2177 | static inline bool do_gro(struct be_rx_compl_info *rxcp) | 2174 | static inline bool do_gro(struct be_rx_compl_info *rxcp) |
2178 | { | 2175 | { |
2179 | return (rxcp->tcpf && !rxcp->err) ? true : false; | 2176 | return (rxcp->tcpf && !rxcp->err && rxcp->l4_csum) ? true : false; |
2180 | } | 2177 | } |
2181 | 2178 | ||
2182 | static int be_process_rx(struct be_rx_obj *rxo, struct napi_struct *napi, | 2179 | static int be_process_rx(struct be_rx_obj *rxo, struct napi_struct *napi, |
@@ -4101,6 +4098,7 @@ static int be_get_initial_config(struct be_adapter *adapter) | |||
4101 | 4098 | ||
4102 | static int lancer_recover_func(struct be_adapter *adapter) | 4099 | static int lancer_recover_func(struct be_adapter *adapter) |
4103 | { | 4100 | { |
4101 | struct device *dev = &adapter->pdev->dev; | ||
4104 | int status; | 4102 | int status; |
4105 | 4103 | ||
4106 | status = lancer_test_and_set_rdy_state(adapter); | 4104 | status = lancer_test_and_set_rdy_state(adapter); |
@@ -4112,8 +4110,7 @@ static int lancer_recover_func(struct be_adapter *adapter) | |||
4112 | 4110 | ||
4113 | be_clear(adapter); | 4111 | be_clear(adapter); |
4114 | 4112 | ||
4115 | adapter->hw_error = false; | 4113 | be_clear_all_error(adapter); |
4116 | adapter->fw_timeout = false; | ||
4117 | 4114 | ||
4118 | status = be_setup(adapter); | 4115 | status = be_setup(adapter); |
4119 | if (status) | 4116 | if (status) |
@@ -4125,13 +4122,13 @@ static int lancer_recover_func(struct be_adapter *adapter) | |||
4125 | goto err; | 4122 | goto err; |
4126 | } | 4123 | } |
4127 | 4124 | ||
4128 | dev_err(&adapter->pdev->dev, | 4125 | dev_err(dev, "Error recovery successful\n"); |
4129 | "Adapter SLIPORT recovery succeeded\n"); | ||
4130 | return 0; | 4126 | return 0; |
4131 | err: | 4127 | err: |
4132 | if (adapter->eeh_error) | 4128 | if (status == -EAGAIN) |
4133 | dev_err(&adapter->pdev->dev, | 4129 | dev_err(dev, "Waiting for resource provisioning\n"); |
4134 | "Adapter SLIPORT recovery failed\n"); | 4130 | else |
4131 | dev_err(dev, "Error recovery failed\n"); | ||
4135 | 4132 | ||
4136 | return status; | 4133 | return status; |
4137 | } | 4134 | } |
@@ -4140,28 +4137,27 @@ static void be_func_recovery_task(struct work_struct *work) | |||
4140 | { | 4137 | { |
4141 | struct be_adapter *adapter = | 4138 | struct be_adapter *adapter = |
4142 | container_of(work, struct be_adapter, func_recovery_work.work); | 4139 | container_of(work, struct be_adapter, func_recovery_work.work); |
4143 | int status; | 4140 | int status = 0; |
4144 | 4141 | ||
4145 | be_detect_error(adapter); | 4142 | be_detect_error(adapter); |
4146 | 4143 | ||
4147 | if (adapter->hw_error && lancer_chip(adapter)) { | 4144 | if (adapter->hw_error && lancer_chip(adapter)) { |
4148 | 4145 | ||
4149 | if (adapter->eeh_error) | ||
4150 | goto out; | ||
4151 | |||
4152 | rtnl_lock(); | 4146 | rtnl_lock(); |
4153 | netif_device_detach(adapter->netdev); | 4147 | netif_device_detach(adapter->netdev); |
4154 | rtnl_unlock(); | 4148 | rtnl_unlock(); |
4155 | 4149 | ||
4156 | status = lancer_recover_func(adapter); | 4150 | status = lancer_recover_func(adapter); |
4157 | |||
4158 | if (!status) | 4151 | if (!status) |
4159 | netif_device_attach(adapter->netdev); | 4152 | netif_device_attach(adapter->netdev); |
4160 | } | 4153 | } |
4161 | 4154 | ||
4162 | out: | 4155 | /* In Lancer, for all errors other than provisioning error (-EAGAIN), |
4163 | schedule_delayed_work(&adapter->func_recovery_work, | 4156 | * no need to attempt further recovery. |
4164 | msecs_to_jiffies(1000)); | 4157 | */ |
4158 | if (!status || status == -EAGAIN) | ||
4159 | schedule_delayed_work(&adapter->func_recovery_work, | ||
4160 | msecs_to_jiffies(1000)); | ||
4165 | } | 4161 | } |
4166 | 4162 | ||
4167 | static void be_worker(struct work_struct *work) | 4163 | static void be_worker(struct work_struct *work) |
@@ -4266,6 +4262,9 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) | |||
4266 | netdev->features |= NETIF_F_HIGHDMA; | 4262 | netdev->features |= NETIF_F_HIGHDMA; |
4267 | } else { | 4263 | } else { |
4268 | status = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); | 4264 | status = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
4265 | if (!status) | ||
4266 | status = dma_set_coherent_mask(&pdev->dev, | ||
4267 | DMA_BIT_MASK(32)); | ||
4269 | if (status) { | 4268 | if (status) { |
4270 | dev_err(&pdev->dev, "Could not set PCI DMA Mask\n"); | 4269 | dev_err(&pdev->dev, "Could not set PCI DMA Mask\n"); |
4271 | goto free_netdev; | 4270 | goto free_netdev; |
@@ -4444,20 +4443,19 @@ static pci_ers_result_t be_eeh_err_detected(struct pci_dev *pdev, | |||
4444 | 4443 | ||
4445 | dev_err(&adapter->pdev->dev, "EEH error detected\n"); | 4444 | dev_err(&adapter->pdev->dev, "EEH error detected\n"); |
4446 | 4445 | ||
4447 | adapter->eeh_error = true; | 4446 | if (!adapter->eeh_error) { |
4447 | adapter->eeh_error = true; | ||
4448 | 4448 | ||
4449 | cancel_delayed_work_sync(&adapter->func_recovery_work); | 4449 | cancel_delayed_work_sync(&adapter->func_recovery_work); |
4450 | 4450 | ||
4451 | rtnl_lock(); | ||
4452 | netif_device_detach(netdev); | ||
4453 | rtnl_unlock(); | ||
4454 | |||
4455 | if (netif_running(netdev)) { | ||
4456 | rtnl_lock(); | 4451 | rtnl_lock(); |
4457 | be_close(netdev); | 4452 | netif_device_detach(netdev); |
4453 | if (netif_running(netdev)) | ||
4454 | be_close(netdev); | ||
4458 | rtnl_unlock(); | 4455 | rtnl_unlock(); |
4456 | |||
4457 | be_clear(adapter); | ||
4459 | } | 4458 | } |
4460 | be_clear(adapter); | ||
4461 | 4459 | ||
4462 | if (state == pci_channel_io_perm_failure) | 4460 | if (state == pci_channel_io_perm_failure) |
4463 | return PCI_ERS_RESULT_DISCONNECT; | 4461 | return PCI_ERS_RESULT_DISCONNECT; |
@@ -4482,7 +4480,6 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev) | |||
4482 | int status; | 4480 | int status; |
4483 | 4481 | ||
4484 | dev_info(&adapter->pdev->dev, "EEH reset\n"); | 4482 | dev_info(&adapter->pdev->dev, "EEH reset\n"); |
4485 | be_clear_all_error(adapter); | ||
4486 | 4483 | ||
4487 | status = pci_enable_device(pdev); | 4484 | status = pci_enable_device(pdev); |
4488 | if (status) | 4485 | if (status) |
@@ -4500,6 +4497,7 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev) | |||
4500 | return PCI_ERS_RESULT_DISCONNECT; | 4497 | return PCI_ERS_RESULT_DISCONNECT; |
4501 | 4498 | ||
4502 | pci_cleanup_aer_uncorrect_error_status(pdev); | 4499 | pci_cleanup_aer_uncorrect_error_status(pdev); |
4500 | be_clear_all_error(adapter); | ||
4503 | return PCI_ERS_RESULT_RECOVERED; | 4501 | return PCI_ERS_RESULT_RECOVERED; |
4504 | } | 4502 | } |
4505 | 4503 | ||
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index aff0310a778b..a667015be22a 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -87,6 +87,8 @@ | |||
87 | #define FEC_QUIRK_HAS_GBIT (1 << 3) | 87 | #define FEC_QUIRK_HAS_GBIT (1 << 3) |
88 | /* Controller has extend desc buffer */ | 88 | /* Controller has extend desc buffer */ |
89 | #define FEC_QUIRK_HAS_BUFDESC_EX (1 << 4) | 89 | #define FEC_QUIRK_HAS_BUFDESC_EX (1 << 4) |
90 | /* Controller has hardware checksum support */ | ||
91 | #define FEC_QUIRK_HAS_CSUM (1 << 5) | ||
90 | 92 | ||
91 | static struct platform_device_id fec_devtype[] = { | 93 | static struct platform_device_id fec_devtype[] = { |
92 | { | 94 | { |
@@ -105,9 +107,9 @@ static struct platform_device_id fec_devtype[] = { | |||
105 | }, { | 107 | }, { |
106 | .name = "imx6q-fec", | 108 | .name = "imx6q-fec", |
107 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 109 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
108 | FEC_QUIRK_HAS_BUFDESC_EX, | 110 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM, |
109 | }, { | 111 | }, { |
110 | .name = "mvf-fec", | 112 | .name = "mvf600-fec", |
111 | .driver_data = FEC_QUIRK_ENET_MAC, | 113 | .driver_data = FEC_QUIRK_ENET_MAC, |
112 | }, { | 114 | }, { |
113 | /* sentinel */ | 115 | /* sentinel */ |
@@ -120,7 +122,7 @@ enum imx_fec_type { | |||
120 | IMX27_FEC, /* runs on i.mx27/35/51 */ | 122 | IMX27_FEC, /* runs on i.mx27/35/51 */ |
121 | IMX28_FEC, | 123 | IMX28_FEC, |
122 | IMX6Q_FEC, | 124 | IMX6Q_FEC, |
123 | MVF_FEC, | 125 | MVF600_FEC, |
124 | }; | 126 | }; |
125 | 127 | ||
126 | static const struct of_device_id fec_dt_ids[] = { | 128 | static const struct of_device_id fec_dt_ids[] = { |
@@ -128,7 +130,7 @@ static const struct of_device_id fec_dt_ids[] = { | |||
128 | { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], }, | 130 | { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], }, |
129 | { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], }, | 131 | { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], }, |
130 | { .compatible = "fsl,imx6q-fec", .data = &fec_devtype[IMX6Q_FEC], }, | 132 | { .compatible = "fsl,imx6q-fec", .data = &fec_devtype[IMX6Q_FEC], }, |
131 | { .compatible = "fsl,mvf-fec", .data = &fec_devtype[MVF_FEC], }, | 133 | { .compatible = "fsl,mvf600-fec", .data = &fec_devtype[MVF600_FEC], }, |
132 | { /* sentinel */ } | 134 | { /* sentinel */ } |
133 | }; | 135 | }; |
134 | MODULE_DEVICE_TABLE(of, fec_dt_ids); | 136 | MODULE_DEVICE_TABLE(of, fec_dt_ids); |
@@ -449,7 +451,7 @@ fec_restart(struct net_device *ndev, int duplex) | |||
449 | netif_device_detach(ndev); | 451 | netif_device_detach(ndev); |
450 | napi_disable(&fep->napi); | 452 | napi_disable(&fep->napi); |
451 | netif_stop_queue(ndev); | 453 | netif_stop_queue(ndev); |
452 | netif_tx_lock(ndev); | 454 | netif_tx_lock_bh(ndev); |
453 | } | 455 | } |
454 | 456 | ||
455 | /* Whack a reset. We should wait for this. */ | 457 | /* Whack a reset. We should wait for this. */ |
@@ -614,10 +616,10 @@ fec_restart(struct net_device *ndev, int duplex) | |||
614 | writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); | 616 | writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK); |
615 | 617 | ||
616 | if (netif_running(ndev)) { | 618 | if (netif_running(ndev)) { |
617 | netif_device_attach(ndev); | 619 | netif_tx_unlock_bh(ndev); |
618 | napi_enable(&fep->napi); | ||
619 | netif_wake_queue(ndev); | 620 | netif_wake_queue(ndev); |
620 | netif_tx_unlock(ndev); | 621 | napi_enable(&fep->napi); |
622 | netif_device_attach(ndev); | ||
621 | } | 623 | } |
622 | } | 624 | } |
623 | 625 | ||
@@ -1036,6 +1038,18 @@ static void fec_get_mac(struct net_device *ndev) | |||
1036 | iap = &tmpaddr[0]; | 1038 | iap = &tmpaddr[0]; |
1037 | } | 1039 | } |
1038 | 1040 | ||
1041 | /* | ||
1042 | * 5) random mac address | ||
1043 | */ | ||
1044 | if (!is_valid_ether_addr(iap)) { | ||
1045 | /* Report it and use a random ethernet address instead */ | ||
1046 | netdev_err(ndev, "Invalid MAC address: %pM\n", iap); | ||
1047 | eth_hw_addr_random(ndev); | ||
1048 | netdev_info(ndev, "Using random MAC address: %pM\n", | ||
1049 | ndev->dev_addr); | ||
1050 | return; | ||
1051 | } | ||
1052 | |||
1039 | memcpy(ndev->dev_addr, iap, ETH_ALEN); | 1053 | memcpy(ndev->dev_addr, iap, ETH_ALEN); |
1040 | 1054 | ||
1041 | /* Adjust MAC if using macaddr */ | 1055 | /* Adjust MAC if using macaddr */ |
@@ -1744,6 +1758,8 @@ static const struct net_device_ops fec_netdev_ops = { | |||
1744 | static int fec_enet_init(struct net_device *ndev) | 1758 | static int fec_enet_init(struct net_device *ndev) |
1745 | { | 1759 | { |
1746 | struct fec_enet_private *fep = netdev_priv(ndev); | 1760 | struct fec_enet_private *fep = netdev_priv(ndev); |
1761 | const struct platform_device_id *id_entry = | ||
1762 | platform_get_device_id(fep->pdev); | ||
1747 | struct bufdesc *cbd_base; | 1763 | struct bufdesc *cbd_base; |
1748 | 1764 | ||
1749 | /* Allocate memory for buffer descriptors. */ | 1765 | /* Allocate memory for buffer descriptors. */ |
@@ -1775,12 +1791,14 @@ static int fec_enet_init(struct net_device *ndev) | |||
1775 | writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); | 1791 | writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); |
1776 | netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); | 1792 | netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); |
1777 | 1793 | ||
1778 | /* enable hw accelerator */ | 1794 | if (id_entry->driver_data & FEC_QUIRK_HAS_CSUM) { |
1779 | ndev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 1795 | /* enable hw accelerator */ |
1780 | | NETIF_F_RXCSUM); | 1796 | ndev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1781 | ndev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 1797 | | NETIF_F_RXCSUM); |
1782 | | NETIF_F_RXCSUM); | 1798 | ndev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1783 | fep->csum_flags |= FLAG_RX_CSUM_ENABLED; | 1799 | | NETIF_F_RXCSUM); |
1800 | fep->csum_flags |= FLAG_RX_CSUM_ENABLED; | ||
1801 | } | ||
1784 | 1802 | ||
1785 | fec_restart(ndev, 0); | 1803 | fec_restart(ndev, 0); |
1786 | 1804 | ||
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c index 576e4b858fce..083ea2b4d20a 100644 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c | |||
@@ -524,6 +524,7 @@ static int gianfar_ptp_probe(struct platform_device *dev) | |||
524 | return 0; | 524 | return 0; |
525 | 525 | ||
526 | no_clock: | 526 | no_clock: |
527 | iounmap(etsects->regs); | ||
527 | no_ioremap: | 528 | no_ioremap: |
528 | release_resource(etsects->rsrc); | 529 | release_resource(etsects->rsrc); |
529 | no_resource: | 530 | no_resource: |
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 4989481c19f0..d300a0c0eafc 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c | |||
@@ -359,10 +359,26 @@ static int emac_reset(struct emac_instance *dev) | |||
359 | } | 359 | } |
360 | 360 | ||
361 | #ifdef CONFIG_PPC_DCR_NATIVE | 361 | #ifdef CONFIG_PPC_DCR_NATIVE |
362 | /* Enable internal clock source */ | 362 | /* |
363 | if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) | 363 | * PPC460EX/GT Embedded Processor Advanced User's Manual |
364 | dcri_clrset(SDR0, SDR0_ETH_CFG, | 364 | * section 28.10.1 Mode Register 0 (EMACx_MR0) states: |
365 | 0, SDR0_ETH_CFG_ECS << dev->cell_index); | 365 | * Note: The PHY must provide a TX Clk in order to perform a soft reset |
366 | * of the EMAC. If none is present, select the internal clock | ||
367 | * (SDR0_ETH_CFG[EMACx_PHY_CLK] = 1). | ||
368 | * After a soft reset, select the external clock. | ||
369 | */ | ||
370 | if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) { | ||
371 | if (dev->phy_address == 0xffffffff && | ||
372 | dev->phy_map == 0xffffffff) { | ||
373 | /* No PHY: select internal loop clock before reset */ | ||
374 | dcri_clrset(SDR0, SDR0_ETH_CFG, | ||
375 | 0, SDR0_ETH_CFG_ECS << dev->cell_index); | ||
376 | } else { | ||
377 | /* PHY present: select external clock before reset */ | ||
378 | dcri_clrset(SDR0, SDR0_ETH_CFG, | ||
379 | SDR0_ETH_CFG_ECS << dev->cell_index, 0); | ||
380 | } | ||
381 | } | ||
366 | #endif | 382 | #endif |
367 | 383 | ||
368 | out_be32(&p->mr0, EMAC_MR0_SRST); | 384 | out_be32(&p->mr0, EMAC_MR0_SRST); |
@@ -370,10 +386,14 @@ static int emac_reset(struct emac_instance *dev) | |||
370 | --n; | 386 | --n; |
371 | 387 | ||
372 | #ifdef CONFIG_PPC_DCR_NATIVE | 388 | #ifdef CONFIG_PPC_DCR_NATIVE |
373 | /* Enable external clock source */ | 389 | if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) { |
374 | if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) | 390 | if (dev->phy_address == 0xffffffff && |
375 | dcri_clrset(SDR0, SDR0_ETH_CFG, | 391 | dev->phy_map == 0xffffffff) { |
376 | SDR0_ETH_CFG_ECS << dev->cell_index, 0); | 392 | /* No PHY: restore external clock source after reset */ |
393 | dcri_clrset(SDR0, SDR0_ETH_CFG, | ||
394 | SDR0_ETH_CFG_ECS << dev->cell_index, 0); | ||
395 | } | ||
396 | } | ||
377 | #endif | 397 | #endif |
378 | 398 | ||
379 | if (n) { | 399 | if (n) { |
diff --git a/drivers/net/ethernet/icplus/ipg.h b/drivers/net/ethernet/icplus/ipg.h index 6ce027355fcf..abb300a31912 100644 --- a/drivers/net/ethernet/icplus/ipg.h +++ b/drivers/net/ethernet/icplus/ipg.h | |||
@@ -195,57 +195,57 @@ enum ipg_regs { | |||
195 | /* TFD data structure masks. */ | 195 | /* TFD data structure masks. */ |
196 | 196 | ||
197 | /* TFDList, TFC */ | 197 | /* TFDList, TFC */ |
198 | #define IPG_TFC_RSVD_MASK 0x0000FFFF9FFFFFFF | 198 | #define IPG_TFC_RSVD_MASK 0x0000FFFF9FFFFFFFULL |
199 | #define IPG_TFC_FRAMEID 0x000000000000FFFF | 199 | #define IPG_TFC_FRAMEID 0x000000000000FFFFULL |
200 | #define IPG_TFC_WORDALIGN 0x0000000000030000 | 200 | #define IPG_TFC_WORDALIGN 0x0000000000030000ULL |
201 | #define IPG_TFC_WORDALIGNTODWORD 0x0000000000000000 | 201 | #define IPG_TFC_WORDALIGNTODWORD 0x0000000000000000ULL |
202 | #define IPG_TFC_WORDALIGNTOWORD 0x0000000000020000 | 202 | #define IPG_TFC_WORDALIGNTOWORD 0x0000000000020000ULL |
203 | #define IPG_TFC_WORDALIGNDISABLED 0x0000000000030000 | 203 | #define IPG_TFC_WORDALIGNDISABLED 0x0000000000030000ULL |
204 | #define IPG_TFC_TCPCHECKSUMENABLE 0x0000000000040000 | 204 | #define IPG_TFC_TCPCHECKSUMENABLE 0x0000000000040000ULL |
205 | #define IPG_TFC_UDPCHECKSUMENABLE 0x0000000000080000 | 205 | #define IPG_TFC_UDPCHECKSUMENABLE 0x0000000000080000ULL |
206 | #define IPG_TFC_IPCHECKSUMENABLE 0x0000000000100000 | 206 | #define IPG_TFC_IPCHECKSUMENABLE 0x0000000000100000ULL |
207 | #define IPG_TFC_FCSAPPENDDISABLE 0x0000000000200000 | 207 | #define IPG_TFC_FCSAPPENDDISABLE 0x0000000000200000ULL |
208 | #define IPG_TFC_TXINDICATE 0x0000000000400000 | 208 | #define IPG_TFC_TXINDICATE 0x0000000000400000ULL |
209 | #define IPG_TFC_TXDMAINDICATE 0x0000000000800000 | 209 | #define IPG_TFC_TXDMAINDICATE 0x0000000000800000ULL |
210 | #define IPG_TFC_FRAGCOUNT 0x000000000F000000 | 210 | #define IPG_TFC_FRAGCOUNT 0x000000000F000000ULL |
211 | #define IPG_TFC_VLANTAGINSERT 0x0000000010000000 | 211 | #define IPG_TFC_VLANTAGINSERT 0x0000000010000000ULL |
212 | #define IPG_TFC_TFDDONE 0x0000000080000000 | 212 | #define IPG_TFC_TFDDONE 0x0000000080000000ULL |
213 | #define IPG_TFC_VID 0x00000FFF00000000 | 213 | #define IPG_TFC_VID 0x00000FFF00000000ULL |
214 | #define IPG_TFC_CFI 0x0000100000000000 | 214 | #define IPG_TFC_CFI 0x0000100000000000ULL |
215 | #define IPG_TFC_USERPRIORITY 0x0000E00000000000 | 215 | #define IPG_TFC_USERPRIORITY 0x0000E00000000000ULL |
216 | 216 | ||
217 | /* TFDList, FragInfo */ | 217 | /* TFDList, FragInfo */ |
218 | #define IPG_TFI_RSVD_MASK 0xFFFF00FFFFFFFFFF | 218 | #define IPG_TFI_RSVD_MASK 0xFFFF00FFFFFFFFFFULL |
219 | #define IPG_TFI_FRAGADDR 0x000000FFFFFFFFFF | 219 | #define IPG_TFI_FRAGADDR 0x000000FFFFFFFFFFULL |
220 | #define IPG_TFI_FRAGLEN 0xFFFF000000000000LL | 220 | #define IPG_TFI_FRAGLEN 0xFFFF000000000000ULL |
221 | 221 | ||
222 | /* RFD data structure masks. */ | 222 | /* RFD data structure masks. */ |
223 | 223 | ||
224 | /* RFDList, RFS */ | 224 | /* RFDList, RFS */ |
225 | #define IPG_RFS_RSVD_MASK 0x0000FFFFFFFFFFFF | 225 | #define IPG_RFS_RSVD_MASK 0x0000FFFFFFFFFFFFULL |
226 | #define IPG_RFS_RXFRAMELEN 0x000000000000FFFF | 226 | #define IPG_RFS_RXFRAMELEN 0x000000000000FFFFULL |
227 | #define IPG_RFS_RXFIFOOVERRUN 0x0000000000010000 | 227 | #define IPG_RFS_RXFIFOOVERRUN 0x0000000000010000ULL |
228 | #define IPG_RFS_RXRUNTFRAME 0x0000000000020000 | 228 | #define IPG_RFS_RXRUNTFRAME 0x0000000000020000ULL |
229 | #define IPG_RFS_RXALIGNMENTERROR 0x0000000000040000 | 229 | #define IPG_RFS_RXALIGNMENTERROR 0x0000000000040000ULL |
230 | #define IPG_RFS_RXFCSERROR 0x0000000000080000 | 230 | #define IPG_RFS_RXFCSERROR 0x0000000000080000ULL |
231 | #define IPG_RFS_RXOVERSIZEDFRAME 0x0000000000100000 | 231 | #define IPG_RFS_RXOVERSIZEDFRAME 0x0000000000100000ULL |
232 | #define IPG_RFS_RXLENGTHERROR 0x0000000000200000 | 232 | #define IPG_RFS_RXLENGTHERROR 0x0000000000200000ULL |
233 | #define IPG_RFS_VLANDETECTED 0x0000000000400000 | 233 | #define IPG_RFS_VLANDETECTED 0x0000000000400000ULL |
234 | #define IPG_RFS_TCPDETECTED 0x0000000000800000 | 234 | #define IPG_RFS_TCPDETECTED 0x0000000000800000ULL |
235 | #define IPG_RFS_TCPERROR 0x0000000001000000 | 235 | #define IPG_RFS_TCPERROR 0x0000000001000000ULL |
236 | #define IPG_RFS_UDPDETECTED 0x0000000002000000 | 236 | #define IPG_RFS_UDPDETECTED 0x0000000002000000ULL |
237 | #define IPG_RFS_UDPERROR 0x0000000004000000 | 237 | #define IPG_RFS_UDPERROR 0x0000000004000000ULL |
238 | #define IPG_RFS_IPDETECTED 0x0000000008000000 | 238 | #define IPG_RFS_IPDETECTED 0x0000000008000000ULL |
239 | #define IPG_RFS_IPERROR 0x0000000010000000 | 239 | #define IPG_RFS_IPERROR 0x0000000010000000ULL |
240 | #define IPG_RFS_FRAMESTART 0x0000000020000000 | 240 | #define IPG_RFS_FRAMESTART 0x0000000020000000ULL |
241 | #define IPG_RFS_FRAMEEND 0x0000000040000000 | 241 | #define IPG_RFS_FRAMEEND 0x0000000040000000ULL |
242 | #define IPG_RFS_RFDDONE 0x0000000080000000 | 242 | #define IPG_RFS_RFDDONE 0x0000000080000000ULL |
243 | #define IPG_RFS_TCI 0x0000FFFF00000000 | 243 | #define IPG_RFS_TCI 0x0000FFFF00000000ULL |
244 | 244 | ||
245 | /* RFDList, FragInfo */ | 245 | /* RFDList, FragInfo */ |
246 | #define IPG_RFI_RSVD_MASK 0xFFFF00FFFFFFFFFF | 246 | #define IPG_RFI_RSVD_MASK 0xFFFF00FFFFFFFFFFULL |
247 | #define IPG_RFI_FRAGADDR 0x000000FFFFFFFFFF | 247 | #define IPG_RFI_FRAGADDR 0x000000FFFFFFFFFFULL |
248 | #define IPG_RFI_FRAGLEN 0xFFFF000000000000LL | 248 | #define IPG_RFI_FRAGLEN 0xFFFF000000000000ULL |
249 | 249 | ||
250 | /* I/O Register masks. */ | 250 | /* I/O Register masks. */ |
251 | 251 | ||
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index d0afeea181fb..2ad1494efbb3 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
@@ -867,7 +867,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) | |||
867 | struct netdev_queue *nq = netdev_get_tx_queue(mp->dev, txq->index); | 867 | struct netdev_queue *nq = netdev_get_tx_queue(mp->dev, txq->index); |
868 | int reclaimed; | 868 | int reclaimed; |
869 | 869 | ||
870 | __netif_tx_lock(nq, smp_processor_id()); | 870 | __netif_tx_lock_bh(nq); |
871 | 871 | ||
872 | reclaimed = 0; | 872 | reclaimed = 0; |
873 | while (reclaimed < budget && txq->tx_desc_count > 0) { | 873 | while (reclaimed < budget && txq->tx_desc_count > 0) { |
@@ -913,7 +913,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) | |||
913 | dev_kfree_skb(skb); | 913 | dev_kfree_skb(skb); |
914 | } | 914 | } |
915 | 915 | ||
916 | __netif_tx_unlock(nq); | 916 | __netif_tx_unlock_bh(nq); |
917 | 917 | ||
918 | if (reclaimed < budget) | 918 | if (reclaimed < budget) |
919 | mp->work_tx &= ~(1 << txq->index); | 919 | mp->work_tx &= ~(1 << txq->index); |
@@ -2745,7 +2745,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
2745 | 2745 | ||
2746 | INIT_WORK(&mp->tx_timeout_task, tx_timeout_task); | 2746 | INIT_WORK(&mp->tx_timeout_task, tx_timeout_task); |
2747 | 2747 | ||
2748 | netif_napi_add(dev, &mp->napi, mv643xx_eth_poll, 128); | 2748 | netif_napi_add(dev, &mp->napi, mv643xx_eth_poll, NAPI_POLL_WEIGHT); |
2749 | 2749 | ||
2750 | init_timer(&mp->rx_oom); | 2750 | init_timer(&mp->rx_oom); |
2751 | mp->rx_oom.data = (unsigned long)mp; | 2751 | mp->rx_oom.data = (unsigned long)mp; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 1df56cc50ee9..0e572a527154 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -222,8 +222,6 @@ static int mlx4_comm_cmd_poll(struct mlx4_dev *dev, u8 cmd, u16 param, | |||
222 | * FLR process. The only non-zero result in the RESET command | 222 | * FLR process. The only non-zero result in the RESET command |
223 | * is MLX4_DELAY_RESET_SLAVE*/ | 223 | * is MLX4_DELAY_RESET_SLAVE*/ |
224 | if ((MLX4_COMM_CMD_RESET == cmd)) { | 224 | if ((MLX4_COMM_CMD_RESET == cmd)) { |
225 | mlx4_warn(dev, "Got slave FLRed from Communication" | ||
226 | " channel (ret:0x%x)\n", ret_from_pending); | ||
227 | err = MLX4_DELAY_RESET_SLAVE; | 225 | err = MLX4_DELAY_RESET_SLAVE; |
228 | } else { | 226 | } else { |
229 | mlx4_warn(dev, "Communication channel timed out\n"); | 227 | mlx4_warn(dev, "Communication channel timed out\n"); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index b35f94700093..89c47ea84b50 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -1323,6 +1323,7 @@ static void mlx4_en_auto_moderation(struct mlx4_en_priv *priv) | |||
1323 | priv->last_moder_time[ring] = moder_time; | 1323 | priv->last_moder_time[ring] = moder_time; |
1324 | cq = &priv->rx_cq[ring]; | 1324 | cq = &priv->rx_cq[ring]; |
1325 | cq->moder_time = moder_time; | 1325 | cq->moder_time = moder_time; |
1326 | cq->moder_cnt = priv->rx_frames; | ||
1326 | err = mlx4_en_set_cq_moder(priv, cq); | 1327 | err = mlx4_en_set_cq_moder(priv, cq); |
1327 | if (err) | 1328 | if (err) |
1328 | en_err(priv, "Failed modifying moderation for cq:%d\n", | 1329 | en_err(priv, "Failed modifying moderation for cq:%d\n", |
@@ -2118,6 +2119,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2118 | struct mlx4_en_priv *priv; | 2119 | struct mlx4_en_priv *priv; |
2119 | int i; | 2120 | int i; |
2120 | int err; | 2121 | int err; |
2122 | u64 mac_u64; | ||
2121 | 2123 | ||
2122 | dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), | 2124 | dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), |
2123 | MAX_TX_RINGS, MAX_RX_RINGS); | 2125 | MAX_TX_RINGS, MAX_RX_RINGS); |
@@ -2191,10 +2193,17 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2191 | dev->addr_len = ETH_ALEN; | 2193 | dev->addr_len = ETH_ALEN; |
2192 | mlx4_en_u64_to_mac(dev->dev_addr, mdev->dev->caps.def_mac[priv->port]); | 2194 | mlx4_en_u64_to_mac(dev->dev_addr, mdev->dev->caps.def_mac[priv->port]); |
2193 | if (!is_valid_ether_addr(dev->dev_addr)) { | 2195 | if (!is_valid_ether_addr(dev->dev_addr)) { |
2194 | en_err(priv, "Port: %d, invalid mac burned: %pM, quiting\n", | 2196 | if (mlx4_is_slave(priv->mdev->dev)) { |
2195 | priv->port, dev->dev_addr); | 2197 | eth_hw_addr_random(dev); |
2196 | err = -EINVAL; | 2198 | en_warn(priv, "Assigned random MAC address %pM\n", dev->dev_addr); |
2197 | goto out; | 2199 | mac_u64 = mlx4_en_mac_to_u64(dev->dev_addr); |
2200 | mdev->dev->caps.def_mac[priv->port] = mac_u64; | ||
2201 | } else { | ||
2202 | en_err(priv, "Port: %d, invalid mac burned: %pM, quiting\n", | ||
2203 | priv->port, dev->dev_addr); | ||
2204 | err = -EINVAL; | ||
2205 | goto out; | ||
2206 | } | ||
2198 | } | 2207 | } |
2199 | 2208 | ||
2200 | memcpy(priv->prev_mac, dev->dev_addr, sizeof(priv->prev_mac)); | 2209 | memcpy(priv->prev_mac, dev->dev_addr, sizeof(priv->prev_mac)); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_resources.c b/drivers/net/ethernet/mellanox/mlx4/en_resources.c index 91f2b2c43c12..d3f508697a3d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_resources.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_resources.c | |||
@@ -60,7 +60,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, | |||
60 | context->pri_path.sched_queue = 0x83 | (priv->port - 1) << 6; | 60 | context->pri_path.sched_queue = 0x83 | (priv->port - 1) << 6; |
61 | if (user_prio >= 0) { | 61 | if (user_prio >= 0) { |
62 | context->pri_path.sched_queue |= user_prio << 3; | 62 | context->pri_path.sched_queue |= user_prio << 3; |
63 | context->pri_path.feup = 1 << 6; | 63 | context->pri_path.feup = MLX4_FEUP_FORCE_ETH_UP; |
64 | } | 64 | } |
65 | context->pri_path.counter_index = 0xff; | 65 | context->pri_path.counter_index = 0xff; |
66 | context->cqn_send = cpu_to_be32(cqn); | 66 | context->cqn_send = cpu_to_be32(cqn); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index b147bdd40768..2c97901c6a6d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -131,7 +131,9 @@ static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags) | |||
131 | [2] = "RSS XOR Hash Function support", | 131 | [2] = "RSS XOR Hash Function support", |
132 | [3] = "Device manage flow steering support", | 132 | [3] = "Device manage flow steering support", |
133 | [4] = "Automatic MAC reassignment support", | 133 | [4] = "Automatic MAC reassignment support", |
134 | [5] = "Time stamping support" | 134 | [5] = "Time stamping support", |
135 | [6] = "VST (control vlan insertion/stripping) support", | ||
136 | [7] = "FSM (MAC anti-spoofing) support" | ||
135 | }; | 137 | }; |
136 | int i; | 138 | int i; |
137 | 139 | ||
@@ -838,12 +840,16 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, | |||
838 | MLX4_CMD_NATIVE); | 840 | MLX4_CMD_NATIVE); |
839 | 841 | ||
840 | if (!err && dev->caps.function != slave) { | 842 | if (!err && dev->caps.function != slave) { |
841 | /* set slave default_mac address */ | ||
842 | MLX4_GET(def_mac, outbox->buf, QUERY_PORT_MAC_OFFSET); | ||
843 | def_mac += slave << 8; | ||
844 | /* if config MAC in DB use it */ | 843 | /* if config MAC in DB use it */ |
845 | if (priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac) | 844 | if (priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac) |
846 | def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; | 845 | def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; |
846 | else { | ||
847 | /* set slave default_mac address */ | ||
848 | MLX4_GET(def_mac, outbox->buf, QUERY_PORT_MAC_OFFSET); | ||
849 | def_mac += slave << 8; | ||
850 | priv->mfunc.master.vf_admin[slave].vport[vhcr->in_modifier].mac = def_mac; | ||
851 | } | ||
852 | |||
847 | MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET); | 853 | MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET); |
848 | 854 | ||
849 | /* get port type - currently only eth is enabled */ | 855 | /* get port type - currently only eth is enabled */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 0d32a82458bf..2f4a26039e80 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -1290,7 +1290,6 @@ static int mlx4_init_slave(struct mlx4_dev *dev) | |||
1290 | { | 1290 | { |
1291 | struct mlx4_priv *priv = mlx4_priv(dev); | 1291 | struct mlx4_priv *priv = mlx4_priv(dev); |
1292 | u64 dma = (u64) priv->mfunc.vhcr_dma; | 1292 | u64 dma = (u64) priv->mfunc.vhcr_dma; |
1293 | int num_of_reset_retries = NUM_OF_RESET_RETRIES; | ||
1294 | int ret_from_reset = 0; | 1293 | int ret_from_reset = 0; |
1295 | u32 slave_read; | 1294 | u32 slave_read; |
1296 | u32 cmd_channel_ver; | 1295 | u32 cmd_channel_ver; |
@@ -1304,18 +1303,10 @@ static int mlx4_init_slave(struct mlx4_dev *dev) | |||
1304 | * NUM_OF_RESET_RETRIES times before leaving.*/ | 1303 | * NUM_OF_RESET_RETRIES times before leaving.*/ |
1305 | if (ret_from_reset) { | 1304 | if (ret_from_reset) { |
1306 | if (MLX4_DELAY_RESET_SLAVE == ret_from_reset) { | 1305 | if (MLX4_DELAY_RESET_SLAVE == ret_from_reset) { |
1307 | msleep(SLEEP_TIME_IN_RESET); | 1306 | mlx4_warn(dev, "slave is currently in the " |
1308 | while (ret_from_reset && num_of_reset_retries) { | 1307 | "middle of FLR. Deferring probe.\n"); |
1309 | mlx4_warn(dev, "slave is currently in the" | 1308 | mutex_unlock(&priv->cmd.slave_cmd_mutex); |
1310 | "middle of FLR. retrying..." | 1309 | return -EPROBE_DEFER; |
1311 | "(try num:%d)\n", | ||
1312 | (NUM_OF_RESET_RETRIES - | ||
1313 | num_of_reset_retries + 1)); | ||
1314 | ret_from_reset = | ||
1315 | mlx4_comm_cmd(dev, MLX4_COMM_CMD_RESET, | ||
1316 | 0, MLX4_COMM_TIME); | ||
1317 | num_of_reset_retries = num_of_reset_retries - 1; | ||
1318 | } | ||
1319 | } else | 1310 | } else |
1320 | goto err; | 1311 | goto err; |
1321 | } | 1312 | } |
@@ -1526,7 +1517,8 @@ static int mlx4_init_hca(struct mlx4_dev *dev) | |||
1526 | } else { | 1517 | } else { |
1527 | err = mlx4_init_slave(dev); | 1518 | err = mlx4_init_slave(dev); |
1528 | if (err) { | 1519 | if (err) { |
1529 | mlx4_err(dev, "Failed to initialize slave\n"); | 1520 | if (err != -EPROBE_DEFER) |
1521 | mlx4_err(dev, "Failed to initialize slave\n"); | ||
1530 | return err; | 1522 | return err; |
1531 | } | 1523 | } |
1532 | 1524 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index e12e0d2e0ee0..1157f028a90f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -372,24 +372,29 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
372 | if (MLX4_QP_ST_RC == qp_type) | 372 | if (MLX4_QP_ST_RC == qp_type) |
373 | return -EINVAL; | 373 | return -EINVAL; |
374 | 374 | ||
375 | /* force strip vlan by clear vsd */ | ||
376 | qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN); | ||
377 | if (0 != vp_oper->state.default_vlan) { | ||
378 | qpc->pri_path.vlan_control = | ||
379 | MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED | | ||
380 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED | | ||
381 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED; | ||
382 | } else { /* priority tagged */ | ||
383 | qpc->pri_path.vlan_control = | ||
384 | MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED | | ||
385 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED; | ||
386 | } | ||
387 | |||
388 | qpc->pri_path.fvl_rx |= MLX4_FVL_RX_FORCE_ETH_VLAN; | ||
375 | qpc->pri_path.vlan_index = vp_oper->vlan_idx; | 389 | qpc->pri_path.vlan_index = vp_oper->vlan_idx; |
376 | qpc->pri_path.fl = (1 << 6) | (1 << 2); /* set cv bit and hide_cqe_vlan bit*/ | 390 | qpc->pri_path.fl |= MLX4_FL_CV | MLX4_FL_ETH_HIDE_CQE_VLAN; |
377 | qpc->pri_path.feup |= 1 << 3; /* set fvl bit */ | 391 | qpc->pri_path.feup |= MLX4_FEUP_FORCE_ETH_UP | MLX4_FVL_FORCE_ETH_VLAN; |
378 | qpc->pri_path.sched_queue &= 0xC7; | 392 | qpc->pri_path.sched_queue &= 0xC7; |
379 | qpc->pri_path.sched_queue |= (vp_oper->state.default_qos) << 3; | 393 | qpc->pri_path.sched_queue |= (vp_oper->state.default_qos) << 3; |
380 | mlx4_dbg(dev, "qp %d port %d Q 0x%x set vlan to %d vidx %d feup %x fl %x\n", | ||
381 | be32_to_cpu(qpc->local_qpn) & 0xffffff, port, | ||
382 | (int)(qpc->pri_path.sched_queue), vp_oper->state.default_vlan, | ||
383 | vp_oper->vlan_idx, (int)(qpc->pri_path.feup), | ||
384 | (int)(qpc->pri_path.fl)); | ||
385 | } | 394 | } |
386 | if (vp_oper->state.spoofchk) { | 395 | if (vp_oper->state.spoofchk) { |
387 | qpc->pri_path.feup |= 1 << 5; /* set fsm bit */; | 396 | qpc->pri_path.feup |= MLX4_FSM_FORCE_ETH_SRC_MAC; |
388 | qpc->pri_path.grh_mylmc = (0x80 & qpc->pri_path.grh_mylmc) + vp_oper->mac_idx; | 397 | qpc->pri_path.grh_mylmc = (0x80 & qpc->pri_path.grh_mylmc) + vp_oper->mac_idx; |
389 | mlx4_dbg(dev, "spoof qp %d port %d feup 0x%x, myLmc 0x%x mindx %d\n", | ||
390 | be32_to_cpu(qpc->local_qpn) & 0xffffff, port, | ||
391 | (int)qpc->pri_path.feup, (int)qpc->pri_path.grh_mylmc, | ||
392 | vp_oper->mac_idx); | ||
393 | } | 398 | } |
394 | return 0; | 399 | return 0; |
395 | } | 400 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 90c253b145ef..c1b693cb3df3 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -429,6 +429,7 @@ struct qlcnic_hardware_context { | |||
429 | 429 | ||
430 | u16 port_type; | 430 | u16 port_type; |
431 | u16 board_type; | 431 | u16 board_type; |
432 | u16 supported_type; | ||
432 | 433 | ||
433 | u16 link_speed; | 434 | u16 link_speed; |
434 | u16 link_duplex; | 435 | u16 link_duplex; |
@@ -906,8 +907,11 @@ struct qlcnic_ipaddr { | |||
906 | #define QLCNIC_FW_HANG 0x4000 | 907 | #define QLCNIC_FW_HANG 0x4000 |
907 | #define QLCNIC_FW_LRO_MSS_CAP 0x8000 | 908 | #define QLCNIC_FW_LRO_MSS_CAP 0x8000 |
908 | #define QLCNIC_TX_INTR_SHARED 0x10000 | 909 | #define QLCNIC_TX_INTR_SHARED 0x10000 |
910 | #define QLCNIC_APP_CHANGED_FLAGS 0x20000 | ||
909 | #define QLCNIC_IS_MSI_FAMILY(adapter) \ | 911 | #define QLCNIC_IS_MSI_FAMILY(adapter) \ |
910 | ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) | 912 | ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) |
913 | #define QLCNIC_IS_TSO_CAPABLE(adapter) \ | ||
914 | ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO) | ||
911 | 915 | ||
912 | #define QLCNIC_DEF_NUM_STS_DESC_RINGS 4 | 916 | #define QLCNIC_DEF_NUM_STS_DESC_RINGS 4 |
913 | #define QLCNIC_MSIX_TBL_SPACE 8192 | 917 | #define QLCNIC_MSIX_TBL_SPACE 8192 |
@@ -1033,6 +1037,7 @@ struct qlcnic_adapter { | |||
1033 | spinlock_t rx_mac_learn_lock; | 1037 | spinlock_t rx_mac_learn_lock; |
1034 | u32 file_prd_off; /*File fw product offset*/ | 1038 | u32 file_prd_off; /*File fw product offset*/ |
1035 | u32 fw_version; | 1039 | u32 fw_version; |
1040 | u32 offload_flags; | ||
1036 | const struct firmware *fw; | 1041 | const struct firmware *fw; |
1037 | }; | 1042 | }; |
1038 | 1043 | ||
@@ -1514,6 +1519,7 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter); | |||
1514 | void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter); | 1519 | void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter); |
1515 | void qlcnic_82xx_add_sysfs(struct qlcnic_adapter *adapter); | 1520 | void qlcnic_82xx_add_sysfs(struct qlcnic_adapter *adapter); |
1516 | void qlcnic_82xx_remove_sysfs(struct qlcnic_adapter *adapter); | 1521 | void qlcnic_82xx_remove_sysfs(struct qlcnic_adapter *adapter); |
1522 | int qlcnic_82xx_get_settings(struct qlcnic_adapter *, struct ethtool_cmd *); | ||
1517 | 1523 | ||
1518 | int qlcnicvf_config_bridged_mode(struct qlcnic_adapter *, u32); | 1524 | int qlcnicvf_config_bridged_mode(struct qlcnic_adapter *, u32); |
1519 | int qlcnicvf_config_led(struct qlcnic_adapter *, u32, u32); | 1525 | int qlcnicvf_config_led(struct qlcnic_adapter *, u32, u32); |
@@ -1540,6 +1546,8 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *, struct sk_buff *, int, u16); | |||
1540 | int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter); | 1546 | int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter); |
1541 | int qlcnic_read_mac_addr(struct qlcnic_adapter *); | 1547 | int qlcnic_read_mac_addr(struct qlcnic_adapter *); |
1542 | int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int); | 1548 | int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int); |
1549 | void qlcnic_set_netdev_features(struct qlcnic_adapter *, | ||
1550 | struct qlcnic_esw_func_cfg *); | ||
1543 | void qlcnic_sriov_vf_schedule_multi(struct net_device *); | 1551 | void qlcnic_sriov_vf_schedule_multi(struct net_device *); |
1544 | void qlcnic_vf_add_mc_list(struct net_device *, u16); | 1552 | void qlcnic_vf_add_mc_list(struct net_device *, u16); |
1545 | 1553 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index ea790a93ee7c..b4ff1e35a11d 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -696,15 +696,14 @@ u32 qlcnic_83xx_mac_rcode(struct qlcnic_adapter *adapter) | |||
696 | return 1; | 696 | return 1; |
697 | } | 697 | } |
698 | 698 | ||
699 | u32 qlcnic_83xx_mbx_poll(struct qlcnic_adapter *adapter) | 699 | u32 qlcnic_83xx_mbx_poll(struct qlcnic_adapter *adapter, u32 *wait_time) |
700 | { | 700 | { |
701 | u32 data; | 701 | u32 data; |
702 | unsigned long wait_time = 0; | ||
703 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 702 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
704 | /* wait for mailbox completion */ | 703 | /* wait for mailbox completion */ |
705 | do { | 704 | do { |
706 | data = QLCRDX(ahw, QLCNIC_FW_MBX_CTRL); | 705 | data = QLCRDX(ahw, QLCNIC_FW_MBX_CTRL); |
707 | if (++wait_time > QLCNIC_MBX_TIMEOUT) { | 706 | if (++(*wait_time) > QLCNIC_MBX_TIMEOUT) { |
708 | data = QLCNIC_RCODE_TIMEOUT; | 707 | data = QLCNIC_RCODE_TIMEOUT; |
709 | break; | 708 | break; |
710 | } | 709 | } |
@@ -720,8 +719,8 @@ int qlcnic_83xx_mbx_op(struct qlcnic_adapter *adapter, | |||
720 | u16 opcode; | 719 | u16 opcode; |
721 | u8 mbx_err_code; | 720 | u8 mbx_err_code; |
722 | unsigned long flags; | 721 | unsigned long flags; |
723 | u32 rsp, mbx_val, fw_data, rsp_num, mbx_cmd; | ||
724 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 722 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
723 | u32 rsp, mbx_val, fw_data, rsp_num, mbx_cmd, wait_time = 0; | ||
725 | 724 | ||
726 | opcode = LSW(cmd->req.arg[0]); | 725 | opcode = LSW(cmd->req.arg[0]); |
727 | if (!test_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status)) { | 726 | if (!test_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status)) { |
@@ -754,15 +753,13 @@ int qlcnic_83xx_mbx_op(struct qlcnic_adapter *adapter, | |||
754 | /* Signal FW about the impending command */ | 753 | /* Signal FW about the impending command */ |
755 | QLCWRX(ahw, QLCNIC_HOST_MBX_CTRL, QLCNIC_SET_OWNER); | 754 | QLCWRX(ahw, QLCNIC_HOST_MBX_CTRL, QLCNIC_SET_OWNER); |
756 | poll: | 755 | poll: |
757 | rsp = qlcnic_83xx_mbx_poll(adapter); | 756 | rsp = qlcnic_83xx_mbx_poll(adapter, &wait_time); |
758 | if (rsp != QLCNIC_RCODE_TIMEOUT) { | 757 | if (rsp != QLCNIC_RCODE_TIMEOUT) { |
759 | /* Get the FW response data */ | 758 | /* Get the FW response data */ |
760 | fw_data = readl(QLCNIC_MBX_FW(ahw, 0)); | 759 | fw_data = readl(QLCNIC_MBX_FW(ahw, 0)); |
761 | if (fw_data & QLCNIC_MBX_ASYNC_EVENT) { | 760 | if (fw_data & QLCNIC_MBX_ASYNC_EVENT) { |
762 | __qlcnic_83xx_process_aen(adapter); | 761 | __qlcnic_83xx_process_aen(adapter); |
763 | mbx_val = QLCRDX(ahw, QLCNIC_HOST_MBX_CTRL); | 762 | goto poll; |
764 | if (mbx_val) | ||
765 | goto poll; | ||
766 | } | 763 | } |
767 | mbx_err_code = QLCNIC_MBX_STATUS(fw_data); | 764 | mbx_err_code = QLCNIC_MBX_STATUS(fw_data); |
768 | rsp_num = QLCNIC_MBX_NUM_REGS(fw_data); | 765 | rsp_num = QLCNIC_MBX_NUM_REGS(fw_data); |
@@ -1276,11 +1273,13 @@ out: | |||
1276 | return err; | 1273 | return err; |
1277 | } | 1274 | } |
1278 | 1275 | ||
1279 | static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test) | 1276 | static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test, |
1277 | int num_sds_ring) | ||
1280 | { | 1278 | { |
1281 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1279 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1282 | struct qlcnic_host_sds_ring *sds_ring; | 1280 | struct qlcnic_host_sds_ring *sds_ring; |
1283 | struct qlcnic_host_rds_ring *rds_ring; | 1281 | struct qlcnic_host_rds_ring *rds_ring; |
1282 | u16 adapter_state = adapter->is_up; | ||
1284 | u8 ring; | 1283 | u8 ring; |
1285 | int ret; | 1284 | int ret; |
1286 | 1285 | ||
@@ -1304,6 +1303,10 @@ static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test) | |||
1304 | ret = qlcnic_fw_create_ctx(adapter); | 1303 | ret = qlcnic_fw_create_ctx(adapter); |
1305 | if (ret) { | 1304 | if (ret) { |
1306 | qlcnic_detach(adapter); | 1305 | qlcnic_detach(adapter); |
1306 | if (adapter_state == QLCNIC_ADAPTER_UP_MAGIC) { | ||
1307 | adapter->max_sds_rings = num_sds_ring; | ||
1308 | qlcnic_attach(adapter); | ||
1309 | } | ||
1307 | netif_device_attach(netdev); | 1310 | netif_device_attach(netdev); |
1308 | return ret; | 1311 | return ret; |
1309 | } | 1312 | } |
@@ -1596,7 +1599,8 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode) | |||
1596 | if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) | 1599 | if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) |
1597 | return -EBUSY; | 1600 | return -EBUSY; |
1598 | 1601 | ||
1599 | ret = qlcnic_83xx_diag_alloc_res(netdev, QLCNIC_LOOPBACK_TEST); | 1602 | ret = qlcnic_83xx_diag_alloc_res(netdev, QLCNIC_LOOPBACK_TEST, |
1603 | max_sds_rings); | ||
1600 | if (ret) | 1604 | if (ret) |
1601 | goto fail_diag_alloc; | 1605 | goto fail_diag_alloc; |
1602 | 1606 | ||
@@ -2830,6 +2834,23 @@ int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter) | |||
2830 | break; | 2834 | break; |
2831 | } | 2835 | } |
2832 | config = cmd.rsp.arg[3]; | 2836 | config = cmd.rsp.arg[3]; |
2837 | if (QLC_83XX_SFP_PRESENT(config)) { | ||
2838 | switch (ahw->module_type) { | ||
2839 | case LINKEVENT_MODULE_OPTICAL_UNKNOWN: | ||
2840 | case LINKEVENT_MODULE_OPTICAL_SRLR: | ||
2841 | case LINKEVENT_MODULE_OPTICAL_LRM: | ||
2842 | case LINKEVENT_MODULE_OPTICAL_SFP_1G: | ||
2843 | ahw->supported_type = PORT_FIBRE; | ||
2844 | break; | ||
2845 | case LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLE: | ||
2846 | case LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLELEN: | ||
2847 | case LINKEVENT_MODULE_TWINAX: | ||
2848 | ahw->supported_type = PORT_TP; | ||
2849 | break; | ||
2850 | default: | ||
2851 | ahw->supported_type = PORT_OTHER; | ||
2852 | } | ||
2853 | } | ||
2833 | if (config & 1) | 2854 | if (config & 1) |
2834 | err = 1; | 2855 | err = 1; |
2835 | } | 2856 | } |
@@ -2838,7 +2859,8 @@ out: | |||
2838 | return config; | 2859 | return config; |
2839 | } | 2860 | } |
2840 | 2861 | ||
2841 | int qlcnic_83xx_get_settings(struct qlcnic_adapter *adapter) | 2862 | int qlcnic_83xx_get_settings(struct qlcnic_adapter *adapter, |
2863 | struct ethtool_cmd *ecmd) | ||
2842 | { | 2864 | { |
2843 | u32 config = 0; | 2865 | u32 config = 0; |
2844 | int status = 0; | 2866 | int status = 0; |
@@ -2851,6 +2873,54 @@ int qlcnic_83xx_get_settings(struct qlcnic_adapter *adapter) | |||
2851 | ahw->module_type = QLC_83XX_SFP_MODULE_TYPE(config); | 2873 | ahw->module_type = QLC_83XX_SFP_MODULE_TYPE(config); |
2852 | /* hard code until there is a way to get it from flash */ | 2874 | /* hard code until there is a way to get it from flash */ |
2853 | ahw->board_type = QLCNIC_BRDTYPE_83XX_10G; | 2875 | ahw->board_type = QLCNIC_BRDTYPE_83XX_10G; |
2876 | |||
2877 | if (netif_running(adapter->netdev) && ahw->has_link_events) { | ||
2878 | ethtool_cmd_speed_set(ecmd, ahw->link_speed); | ||
2879 | ecmd->duplex = ahw->link_duplex; | ||
2880 | ecmd->autoneg = ahw->link_autoneg; | ||
2881 | } else { | ||
2882 | ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN); | ||
2883 | ecmd->duplex = DUPLEX_UNKNOWN; | ||
2884 | ecmd->autoneg = AUTONEG_DISABLE; | ||
2885 | } | ||
2886 | |||
2887 | if (ahw->port_type == QLCNIC_XGBE) { | ||
2888 | ecmd->supported = SUPPORTED_1000baseT_Full; | ||
2889 | ecmd->advertising = ADVERTISED_1000baseT_Full; | ||
2890 | } else { | ||
2891 | ecmd->supported = (SUPPORTED_10baseT_Half | | ||
2892 | SUPPORTED_10baseT_Full | | ||
2893 | SUPPORTED_100baseT_Half | | ||
2894 | SUPPORTED_100baseT_Full | | ||
2895 | SUPPORTED_1000baseT_Half | | ||
2896 | SUPPORTED_1000baseT_Full); | ||
2897 | ecmd->advertising = (ADVERTISED_100baseT_Half | | ||
2898 | ADVERTISED_100baseT_Full | | ||
2899 | ADVERTISED_1000baseT_Half | | ||
2900 | ADVERTISED_1000baseT_Full); | ||
2901 | } | ||
2902 | |||
2903 | switch (ahw->supported_type) { | ||
2904 | case PORT_FIBRE: | ||
2905 | ecmd->supported |= SUPPORTED_FIBRE; | ||
2906 | ecmd->advertising |= ADVERTISED_FIBRE; | ||
2907 | ecmd->port = PORT_FIBRE; | ||
2908 | ecmd->transceiver = XCVR_EXTERNAL; | ||
2909 | break; | ||
2910 | case PORT_TP: | ||
2911 | ecmd->supported |= SUPPORTED_TP; | ||
2912 | ecmd->advertising |= ADVERTISED_TP; | ||
2913 | ecmd->port = PORT_TP; | ||
2914 | ecmd->transceiver = XCVR_INTERNAL; | ||
2915 | break; | ||
2916 | default: | ||
2917 | ecmd->supported |= SUPPORTED_FIBRE; | ||
2918 | ecmd->advertising |= ADVERTISED_FIBRE; | ||
2919 | ecmd->port = PORT_OTHER; | ||
2920 | ecmd->transceiver = XCVR_EXTERNAL; | ||
2921 | break; | ||
2922 | } | ||
2923 | ecmd->phy_address = ahw->physical_port; | ||
2854 | return status; | 2924 | return status; |
2855 | } | 2925 | } |
2856 | 2926 | ||
@@ -3046,7 +3116,8 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev) | |||
3046 | if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) | 3116 | if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) |
3047 | return -EIO; | 3117 | return -EIO; |
3048 | 3118 | ||
3049 | ret = qlcnic_83xx_diag_alloc_res(netdev, QLCNIC_INTERRUPT_TEST); | 3119 | ret = qlcnic_83xx_diag_alloc_res(netdev, QLCNIC_INTERRUPT_TEST, |
3120 | max_sds_rings); | ||
3050 | if (ret) | 3121 | if (ret) |
3051 | goto fail_diag_irq; | 3122 | goto fail_diag_irq; |
3052 | 3123 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h index 1f1d85e6f2af..f5db67fc9f55 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | |||
@@ -603,7 +603,7 @@ int qlcnic_83xx_get_vnic_pf_info(struct qlcnic_adapter *, struct qlcnic_info *); | |||
603 | 603 | ||
604 | void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *); | 604 | void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *); |
605 | void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data); | 605 | void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data); |
606 | int qlcnic_83xx_get_settings(struct qlcnic_adapter *); | 606 | int qlcnic_83xx_get_settings(struct qlcnic_adapter *, struct ethtool_cmd *); |
607 | int qlcnic_83xx_set_settings(struct qlcnic_adapter *, struct ethtool_cmd *); | 607 | int qlcnic_83xx_set_settings(struct qlcnic_adapter *, struct ethtool_cmd *); |
608 | void qlcnic_83xx_get_pauseparam(struct qlcnic_adapter *, | 608 | void qlcnic_83xx_get_pauseparam(struct qlcnic_adapter *, |
609 | struct ethtool_pauseparam *); | 609 | struct ethtool_pauseparam *); |
@@ -620,7 +620,7 @@ int qlcnic_83xx_flash_test(struct qlcnic_adapter *); | |||
620 | int qlcnic_83xx_enable_flash_write(struct qlcnic_adapter *); | 620 | int qlcnic_83xx_enable_flash_write(struct qlcnic_adapter *); |
621 | int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *); | 621 | int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *); |
622 | u32 qlcnic_83xx_mac_rcode(struct qlcnic_adapter *); | 622 | u32 qlcnic_83xx_mac_rcode(struct qlcnic_adapter *); |
623 | u32 qlcnic_83xx_mbx_poll(struct qlcnic_adapter *); | 623 | u32 qlcnic_83xx_mbx_poll(struct qlcnic_adapter *, u32 *); |
624 | void qlcnic_83xx_enable_mbx_poll(struct qlcnic_adapter *); | 624 | void qlcnic_83xx_enable_mbx_poll(struct qlcnic_adapter *); |
625 | void qlcnic_83xx_disable_mbx_poll(struct qlcnic_adapter *); | 625 | void qlcnic_83xx_disable_mbx_poll(struct qlcnic_adapter *); |
626 | #endif | 626 | #endif |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index ab1d8d99cbd5..5e7fb1dfb97b 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -382,8 +382,6 @@ static int qlcnic_83xx_idc_tx_soft_reset(struct qlcnic_adapter *adapter) | |||
382 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | 382 | clear_bit(__QLCNIC_RESETTING, &adapter->state); |
383 | dev_err(&adapter->pdev->dev, "%s:\n", __func__); | 383 | dev_err(&adapter->pdev->dev, "%s:\n", __func__); |
384 | 384 | ||
385 | adapter->netdev->trans_start = jiffies; | ||
386 | |||
387 | return 0; | 385 | return 0; |
388 | } | 386 | } |
389 | 387 | ||
@@ -435,10 +433,6 @@ static void qlcnic_83xx_idc_attach_driver(struct qlcnic_adapter *adapter) | |||
435 | } | 433 | } |
436 | done: | 434 | done: |
437 | netif_device_attach(netdev); | 435 | netif_device_attach(netdev); |
438 | if (netif_running(netdev)) { | ||
439 | netif_carrier_on(netdev); | ||
440 | netif_wake_queue(netdev); | ||
441 | } | ||
442 | } | 436 | } |
443 | 437 | ||
444 | static int qlcnic_83xx_idc_enter_failed_state(struct qlcnic_adapter *adapter, | 438 | static int qlcnic_83xx_idc_enter_failed_state(struct qlcnic_adapter *adapter, |
@@ -642,15 +636,21 @@ static int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter) | |||
642 | 636 | ||
643 | static void qlcnic_83xx_idc_update_idc_params(struct qlcnic_adapter *adapter) | 637 | static void qlcnic_83xx_idc_update_idc_params(struct qlcnic_adapter *adapter) |
644 | { | 638 | { |
639 | struct qlcnic_hardware_context *ahw = adapter->ahw; | ||
640 | |||
645 | qlcnic_83xx_idc_update_drv_presence_reg(adapter, 1, 1); | 641 | qlcnic_83xx_idc_update_drv_presence_reg(adapter, 1, 1); |
646 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | ||
647 | set_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status); | 642 | set_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status); |
648 | qlcnic_83xx_idc_update_audit_reg(adapter, 0, 1); | 643 | qlcnic_83xx_idc_update_audit_reg(adapter, 0, 1); |
649 | set_bit(QLC_83XX_MODULE_LOADED, &adapter->ahw->idc.status); | 644 | set_bit(QLC_83XX_MODULE_LOADED, &adapter->ahw->idc.status); |
650 | adapter->ahw->idc.quiesce_req = 0; | 645 | |
651 | adapter->ahw->idc.delay = QLC_83XX_IDC_FW_POLL_DELAY; | 646 | ahw->idc.quiesce_req = 0; |
652 | adapter->ahw->idc.err_code = 0; | 647 | ahw->idc.delay = QLC_83XX_IDC_FW_POLL_DELAY; |
653 | adapter->ahw->idc.collect_dump = 0; | 648 | ahw->idc.err_code = 0; |
649 | ahw->idc.collect_dump = 0; | ||
650 | ahw->reset_context = 0; | ||
651 | adapter->tx_timeo_cnt = 0; | ||
652 | |||
653 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | ||
654 | } | 654 | } |
655 | 655 | ||
656 | /** | 656 | /** |
@@ -851,6 +851,7 @@ static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter) | |||
851 | /* Check for soft reset request */ | 851 | /* Check for soft reset request */ |
852 | if (ahw->reset_context && | 852 | if (ahw->reset_context && |
853 | !(val & QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY)) { | 853 | !(val & QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY)) { |
854 | adapter->ahw->reset_context = 0; | ||
854 | qlcnic_83xx_idc_tx_soft_reset(adapter); | 855 | qlcnic_83xx_idc_tx_soft_reset(adapter); |
855 | return ret; | 856 | return ret; |
856 | } | 857 | } |
@@ -914,6 +915,7 @@ static int qlcnic_83xx_idc_need_quiesce_state(struct qlcnic_adapter *adapter) | |||
914 | static int qlcnic_83xx_idc_failed_state(struct qlcnic_adapter *adapter) | 915 | static int qlcnic_83xx_idc_failed_state(struct qlcnic_adapter *adapter) |
915 | { | 916 | { |
916 | dev_err(&adapter->pdev->dev, "%s: please restart!!\n", __func__); | 917 | dev_err(&adapter->pdev->dev, "%s: please restart!!\n", __func__); |
918 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | ||
917 | adapter->ahw->idc.err_code = -EIO; | 919 | adapter->ahw->idc.err_code = -EIO; |
918 | 920 | ||
919 | return 0; | 921 | return 0; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 08efb4635007..f67652de5a63 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -131,12 +131,13 @@ static const char qlcnic_83xx_rx_stats_strings[][ETH_GSTRING_LEN] = { | |||
131 | "ctx_lro_pkt_cnt", | 131 | "ctx_lro_pkt_cnt", |
132 | "ctx_ip_csum_error", | 132 | "ctx_ip_csum_error", |
133 | "ctx_rx_pkts_wo_ctx", | 133 | "ctx_rx_pkts_wo_ctx", |
134 | "ctx_rx_pkts_dropped_wo_sts", | 134 | "ctx_rx_pkts_drop_wo_sds_on_card", |
135 | "ctx_rx_pkts_drop_wo_sds_on_host", | ||
135 | "ctx_rx_osized_pkts", | 136 | "ctx_rx_osized_pkts", |
136 | "ctx_rx_pkts_dropped_wo_rds", | 137 | "ctx_rx_pkts_dropped_wo_rds", |
137 | "ctx_rx_unexpected_mcast_pkts", | 138 | "ctx_rx_unexpected_mcast_pkts", |
138 | "ctx_invalid_mac_address", | 139 | "ctx_invalid_mac_address", |
139 | "ctx_rx_rds_ring_prim_attemoted", | 140 | "ctx_rx_rds_ring_prim_attempted", |
140 | "ctx_rx_rds_ring_prim_success", | 141 | "ctx_rx_rds_ring_prim_success", |
141 | "ctx_num_lro_flows_added", | 142 | "ctx_num_lro_flows_added", |
142 | "ctx_num_lro_flows_removed", | 143 | "ctx_num_lro_flows_removed", |
@@ -251,6 +252,18 @@ static int | |||
251 | qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 252 | qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
252 | { | 253 | { |
253 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 254 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
255 | |||
256 | if (qlcnic_82xx_check(adapter)) | ||
257 | return qlcnic_82xx_get_settings(adapter, ecmd); | ||
258 | else if (qlcnic_83xx_check(adapter)) | ||
259 | return qlcnic_83xx_get_settings(adapter, ecmd); | ||
260 | |||
261 | return -EIO; | ||
262 | } | ||
263 | |||
264 | int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, | ||
265 | struct ethtool_cmd *ecmd) | ||
266 | { | ||
254 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 267 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
255 | u32 speed, reg; | 268 | u32 speed, reg; |
256 | int check_sfp_module = 0; | 269 | int check_sfp_module = 0; |
@@ -276,10 +289,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
276 | 289 | ||
277 | } else if (adapter->ahw->port_type == QLCNIC_XGBE) { | 290 | } else if (adapter->ahw->port_type == QLCNIC_XGBE) { |
278 | u32 val = 0; | 291 | u32 val = 0; |
279 | if (qlcnic_83xx_check(adapter)) | 292 | val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR); |
280 | qlcnic_83xx_get_settings(adapter); | ||
281 | else | ||
282 | val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR); | ||
283 | 293 | ||
284 | if (val == QLCNIC_PORT_MODE_802_3_AP) { | 294 | if (val == QLCNIC_PORT_MODE_802_3_AP) { |
285 | ecmd->supported = SUPPORTED_1000baseT_Full; | 295 | ecmd->supported = SUPPORTED_1000baseT_Full; |
@@ -289,16 +299,13 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
289 | ecmd->advertising = ADVERTISED_10000baseT_Full; | 299 | ecmd->advertising = ADVERTISED_10000baseT_Full; |
290 | } | 300 | } |
291 | 301 | ||
292 | if (netif_running(dev) && adapter->ahw->has_link_events) { | 302 | if (netif_running(adapter->netdev) && ahw->has_link_events) { |
293 | if (qlcnic_82xx_check(adapter)) { | 303 | reg = QLCRD32(adapter, P3P_LINK_SPEED_REG(pcifn)); |
294 | reg = QLCRD32(adapter, | 304 | speed = P3P_LINK_SPEED_VAL(pcifn, reg); |
295 | P3P_LINK_SPEED_REG(pcifn)); | 305 | ahw->link_speed = speed * P3P_LINK_SPEED_MHZ; |
296 | speed = P3P_LINK_SPEED_VAL(pcifn, reg); | 306 | ethtool_cmd_speed_set(ecmd, ahw->link_speed); |
297 | ahw->link_speed = speed * P3P_LINK_SPEED_MHZ; | 307 | ecmd->autoneg = ahw->link_autoneg; |
298 | } | 308 | ecmd->duplex = ahw->link_duplex; |
299 | ethtool_cmd_speed_set(ecmd, adapter->ahw->link_speed); | ||
300 | ecmd->autoneg = adapter->ahw->link_autoneg; | ||
301 | ecmd->duplex = adapter->ahw->link_duplex; | ||
302 | goto skip; | 309 | goto skip; |
303 | } | 310 | } |
304 | 311 | ||
@@ -340,8 +347,8 @@ skip: | |||
340 | case QLCNIC_BRDTYPE_P3P_10G_SFP_QT: | 347 | case QLCNIC_BRDTYPE_P3P_10G_SFP_QT: |
341 | ecmd->advertising |= ADVERTISED_TP; | 348 | ecmd->advertising |= ADVERTISED_TP; |
342 | ecmd->supported |= SUPPORTED_TP; | 349 | ecmd->supported |= SUPPORTED_TP; |
343 | check_sfp_module = netif_running(dev) && | 350 | check_sfp_module = netif_running(adapter->netdev) && |
344 | adapter->ahw->has_link_events; | 351 | ahw->has_link_events; |
345 | case QLCNIC_BRDTYPE_P3P_10G_XFP: | 352 | case QLCNIC_BRDTYPE_P3P_10G_XFP: |
346 | ecmd->supported |= SUPPORTED_FIBRE; | 353 | ecmd->supported |= SUPPORTED_FIBRE; |
347 | ecmd->advertising |= ADVERTISED_FIBRE; | 354 | ecmd->advertising |= ADVERTISED_FIBRE; |
@@ -355,8 +362,8 @@ skip: | |||
355 | ecmd->advertising |= | 362 | ecmd->advertising |= |
356 | (ADVERTISED_FIBRE | ADVERTISED_TP); | 363 | (ADVERTISED_FIBRE | ADVERTISED_TP); |
357 | ecmd->port = PORT_FIBRE; | 364 | ecmd->port = PORT_FIBRE; |
358 | check_sfp_module = netif_running(dev) && | 365 | check_sfp_module = netif_running(adapter->netdev) && |
359 | adapter->ahw->has_link_events; | 366 | ahw->has_link_events; |
360 | } else { | 367 | } else { |
361 | ecmd->autoneg = AUTONEG_ENABLE; | 368 | ecmd->autoneg = AUTONEG_ENABLE; |
362 | ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); | 369 | ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); |
@@ -365,13 +372,6 @@ skip: | |||
365 | ecmd->port = PORT_TP; | 372 | ecmd->port = PORT_TP; |
366 | } | 373 | } |
367 | break; | 374 | break; |
368 | case QLCNIC_BRDTYPE_83XX_10G: | ||
369 | ecmd->autoneg = AUTONEG_DISABLE; | ||
370 | ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP); | ||
371 | ecmd->advertising |= (ADVERTISED_FIBRE | ADVERTISED_TP); | ||
372 | ecmd->port = PORT_FIBRE; | ||
373 | check_sfp_module = netif_running(dev) && ahw->has_link_events; | ||
374 | break; | ||
375 | default: | 375 | default: |
376 | dev_err(&adapter->pdev->dev, "Unsupported board model %d\n", | 376 | dev_err(&adapter->pdev->dev, "Unsupported board model %d\n", |
377 | adapter->ahw->board_type); | 377 | adapter->ahw->board_type); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 6a6512ba9f38..106a12f2a02f 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | |||
@@ -973,16 +973,57 @@ int qlcnic_change_mtu(struct net_device *netdev, int mtu) | |||
973 | return rc; | 973 | return rc; |
974 | } | 974 | } |
975 | 975 | ||
976 | static netdev_features_t qlcnic_process_flags(struct qlcnic_adapter *adapter, | ||
977 | netdev_features_t features) | ||
978 | { | ||
979 | u32 offload_flags = adapter->offload_flags; | ||
980 | |||
981 | if (offload_flags & BIT_0) { | ||
982 | features |= NETIF_F_RXCSUM | NETIF_F_IP_CSUM | | ||
983 | NETIF_F_IPV6_CSUM; | ||
984 | adapter->rx_csum = 1; | ||
985 | if (QLCNIC_IS_TSO_CAPABLE(adapter)) { | ||
986 | if (!(offload_flags & BIT_1)) | ||
987 | features &= ~NETIF_F_TSO; | ||
988 | else | ||
989 | features |= NETIF_F_TSO; | ||
990 | |||
991 | if (!(offload_flags & BIT_2)) | ||
992 | features &= ~NETIF_F_TSO6; | ||
993 | else | ||
994 | features |= NETIF_F_TSO6; | ||
995 | } | ||
996 | } else { | ||
997 | features &= ~(NETIF_F_RXCSUM | | ||
998 | NETIF_F_IP_CSUM | | ||
999 | NETIF_F_IPV6_CSUM); | ||
1000 | |||
1001 | if (QLCNIC_IS_TSO_CAPABLE(adapter)) | ||
1002 | features &= ~(NETIF_F_TSO | NETIF_F_TSO6); | ||
1003 | adapter->rx_csum = 0; | ||
1004 | } | ||
1005 | |||
1006 | return features; | ||
1007 | } | ||
976 | 1008 | ||
977 | netdev_features_t qlcnic_fix_features(struct net_device *netdev, | 1009 | netdev_features_t qlcnic_fix_features(struct net_device *netdev, |
978 | netdev_features_t features) | 1010 | netdev_features_t features) |
979 | { | 1011 | { |
980 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1012 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1013 | netdev_features_t changed; | ||
981 | 1014 | ||
982 | if ((adapter->flags & QLCNIC_ESWITCH_ENABLED) && | 1015 | if (qlcnic_82xx_check(adapter) && |
983 | qlcnic_82xx_check(adapter)) { | 1016 | (adapter->flags & QLCNIC_ESWITCH_ENABLED)) { |
984 | netdev_features_t changed = features ^ netdev->features; | 1017 | if (adapter->flags & QLCNIC_APP_CHANGED_FLAGS) { |
985 | features ^= changed & (NETIF_F_ALL_CSUM | NETIF_F_RXCSUM); | 1018 | features = qlcnic_process_flags(adapter, features); |
1019 | } else { | ||
1020 | changed = features ^ netdev->features; | ||
1021 | features ^= changed & (NETIF_F_RXCSUM | | ||
1022 | NETIF_F_IP_CSUM | | ||
1023 | NETIF_F_IPV6_CSUM | | ||
1024 | NETIF_F_TSO | | ||
1025 | NETIF_F_TSO6); | ||
1026 | } | ||
986 | } | 1027 | } |
987 | 1028 | ||
988 | if (!(features & NETIF_F_RXCSUM)) | 1029 | if (!(features & NETIF_F_RXCSUM)) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h index 95b1b5732838..b6818f4356b9 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h | |||
@@ -134,7 +134,7 @@ struct qlcnic_mailbox_metadata { | |||
134 | 134 | ||
135 | #define QLCNIC_SET_OWNER 1 | 135 | #define QLCNIC_SET_OWNER 1 |
136 | #define QLCNIC_CLR_OWNER 0 | 136 | #define QLCNIC_CLR_OWNER 0 |
137 | #define QLCNIC_MBX_TIMEOUT 10000 | 137 | #define QLCNIC_MBX_TIMEOUT 5000 |
138 | 138 | ||
139 | #define QLCNIC_MBX_RSP_OK 1 | 139 | #define QLCNIC_MBX_RSP_OK 1 |
140 | #define QLCNIC_MBX_PORT_RSP_OK 0x1a | 140 | #define QLCNIC_MBX_PORT_RSP_OK 0x1a |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 264d5a4f8153..aeb26a850679 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -37,24 +37,24 @@ MODULE_PARM_DESC(qlcnic_mac_learn, | |||
37 | "Mac Filter (0=learning is disabled, 1=Driver learning is enabled, 2=FDB learning is enabled)"); | 37 | "Mac Filter (0=learning is disabled, 1=Driver learning is enabled, 2=FDB learning is enabled)"); |
38 | 38 | ||
39 | int qlcnic_use_msi = 1; | 39 | int qlcnic_use_msi = 1; |
40 | MODULE_PARM_DESC(use_msi, "MSI interrupt (0=disabled, 1=enabled"); | 40 | MODULE_PARM_DESC(use_msi, "MSI interrupt (0=disabled, 1=enabled)"); |
41 | module_param_named(use_msi, qlcnic_use_msi, int, 0444); | 41 | module_param_named(use_msi, qlcnic_use_msi, int, 0444); |
42 | 42 | ||
43 | int qlcnic_use_msi_x = 1; | 43 | int qlcnic_use_msi_x = 1; |
44 | MODULE_PARM_DESC(use_msi_x, "MSI-X interrupt (0=disabled, 1=enabled"); | 44 | MODULE_PARM_DESC(use_msi_x, "MSI-X interrupt (0=disabled, 1=enabled)"); |
45 | module_param_named(use_msi_x, qlcnic_use_msi_x, int, 0444); | 45 | module_param_named(use_msi_x, qlcnic_use_msi_x, int, 0444); |
46 | 46 | ||
47 | int qlcnic_auto_fw_reset = 1; | 47 | int qlcnic_auto_fw_reset = 1; |
48 | MODULE_PARM_DESC(auto_fw_reset, "Auto firmware reset (0=disabled, 1=enabled"); | 48 | MODULE_PARM_DESC(auto_fw_reset, "Auto firmware reset (0=disabled, 1=enabled)"); |
49 | module_param_named(auto_fw_reset, qlcnic_auto_fw_reset, int, 0644); | 49 | module_param_named(auto_fw_reset, qlcnic_auto_fw_reset, int, 0644); |
50 | 50 | ||
51 | int qlcnic_load_fw_file; | 51 | int qlcnic_load_fw_file; |
52 | MODULE_PARM_DESC(load_fw_file, "Load firmware from (0=flash, 1=file"); | 52 | MODULE_PARM_DESC(load_fw_file, "Load firmware from (0=flash, 1=file)"); |
53 | module_param_named(load_fw_file, qlcnic_load_fw_file, int, 0444); | 53 | module_param_named(load_fw_file, qlcnic_load_fw_file, int, 0444); |
54 | 54 | ||
55 | int qlcnic_config_npars; | 55 | int qlcnic_config_npars; |
56 | module_param(qlcnic_config_npars, int, 0444); | 56 | module_param(qlcnic_config_npars, int, 0444); |
57 | MODULE_PARM_DESC(qlcnic_config_npars, "Configure NPARs (0=disabled, 1=enabled"); | 57 | MODULE_PARM_DESC(qlcnic_config_npars, "Configure NPARs (0=disabled, 1=enabled)"); |
58 | 58 | ||
59 | static int qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent); | 59 | static int qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent); |
60 | static void qlcnic_remove(struct pci_dev *pdev); | 60 | static void qlcnic_remove(struct pci_dev *pdev); |
@@ -84,14 +84,9 @@ static int qlcnic_start_firmware(struct qlcnic_adapter *); | |||
84 | static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter); | 84 | static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter); |
85 | static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *); | 85 | static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *); |
86 | static int qlcnicvf_start_firmware(struct qlcnic_adapter *); | 86 | static int qlcnicvf_start_firmware(struct qlcnic_adapter *); |
87 | static void qlcnic_set_netdev_features(struct qlcnic_adapter *, | ||
88 | struct qlcnic_esw_func_cfg *); | ||
89 | static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16); | 87 | static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16); |
90 | static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16); | 88 | static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16); |
91 | 89 | ||
92 | #define QLCNIC_IS_TSO_CAPABLE(adapter) \ | ||
93 | ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO) | ||
94 | |||
95 | static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter) | 90 | static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter) |
96 | { | 91 | { |
97 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 92 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
@@ -308,6 +303,23 @@ int qlcnic_read_mac_addr(struct qlcnic_adapter *adapter) | |||
308 | return 0; | 303 | return 0; |
309 | } | 304 | } |
310 | 305 | ||
306 | static void qlcnic_delete_adapter_mac(struct qlcnic_adapter *adapter) | ||
307 | { | ||
308 | struct qlcnic_mac_list_s *cur; | ||
309 | struct list_head *head; | ||
310 | |||
311 | list_for_each(head, &adapter->mac_list) { | ||
312 | cur = list_entry(head, struct qlcnic_mac_list_s, list); | ||
313 | if (!memcmp(adapter->mac_addr, cur->mac_addr, ETH_ALEN)) { | ||
314 | qlcnic_sre_macaddr_change(adapter, cur->mac_addr, | ||
315 | 0, QLCNIC_MAC_DEL); | ||
316 | list_del(&cur->list); | ||
317 | kfree(cur); | ||
318 | return; | ||
319 | } | ||
320 | } | ||
321 | } | ||
322 | |||
311 | static int qlcnic_set_mac(struct net_device *netdev, void *p) | 323 | static int qlcnic_set_mac(struct net_device *netdev, void *p) |
312 | { | 324 | { |
313 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 325 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
@@ -322,11 +334,15 @@ static int qlcnic_set_mac(struct net_device *netdev, void *p) | |||
322 | if (!is_valid_ether_addr(addr->sa_data)) | 334 | if (!is_valid_ether_addr(addr->sa_data)) |
323 | return -EINVAL; | 335 | return -EINVAL; |
324 | 336 | ||
337 | if (!memcmp(adapter->mac_addr, addr->sa_data, ETH_ALEN)) | ||
338 | return 0; | ||
339 | |||
325 | if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { | 340 | if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { |
326 | netif_device_detach(netdev); | 341 | netif_device_detach(netdev); |
327 | qlcnic_napi_disable(adapter); | 342 | qlcnic_napi_disable(adapter); |
328 | } | 343 | } |
329 | 344 | ||
345 | qlcnic_delete_adapter_mac(adapter); | ||
330 | memcpy(adapter->mac_addr, addr->sa_data, netdev->addr_len); | 346 | memcpy(adapter->mac_addr, addr->sa_data, netdev->addr_len); |
331 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | 347 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
332 | qlcnic_set_multi(adapter->netdev); | 348 | qlcnic_set_multi(adapter->netdev); |
@@ -1053,8 +1069,6 @@ void qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter, | |||
1053 | 1069 | ||
1054 | if (!esw_cfg->promisc_mode) | 1070 | if (!esw_cfg->promisc_mode) |
1055 | adapter->flags |= QLCNIC_PROMISC_DISABLED; | 1071 | adapter->flags |= QLCNIC_PROMISC_DISABLED; |
1056 | |||
1057 | qlcnic_set_netdev_features(adapter, esw_cfg); | ||
1058 | } | 1072 | } |
1059 | 1073 | ||
1060 | int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter) | 1074 | int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter) |
@@ -1069,51 +1083,23 @@ int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter) | |||
1069 | return -EIO; | 1083 | return -EIO; |
1070 | qlcnic_set_vlan_config(adapter, &esw_cfg); | 1084 | qlcnic_set_vlan_config(adapter, &esw_cfg); |
1071 | qlcnic_set_eswitch_port_features(adapter, &esw_cfg); | 1085 | qlcnic_set_eswitch_port_features(adapter, &esw_cfg); |
1086 | qlcnic_set_netdev_features(adapter, &esw_cfg); | ||
1072 | 1087 | ||
1073 | return 0; | 1088 | return 0; |
1074 | } | 1089 | } |
1075 | 1090 | ||
1076 | static void | 1091 | void qlcnic_set_netdev_features(struct qlcnic_adapter *adapter, |
1077 | qlcnic_set_netdev_features(struct qlcnic_adapter *adapter, | 1092 | struct qlcnic_esw_func_cfg *esw_cfg) |
1078 | struct qlcnic_esw_func_cfg *esw_cfg) | ||
1079 | { | 1093 | { |
1080 | struct net_device *netdev = adapter->netdev; | 1094 | struct net_device *netdev = adapter->netdev; |
1081 | unsigned long features, vlan_features; | ||
1082 | 1095 | ||
1083 | if (qlcnic_83xx_check(adapter)) | 1096 | if (qlcnic_83xx_check(adapter)) |
1084 | return; | 1097 | return; |
1085 | 1098 | ||
1086 | features = (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | 1099 | adapter->offload_flags = esw_cfg->offload_flags; |
1087 | NETIF_F_IPV6_CSUM | NETIF_F_GRO); | 1100 | adapter->flags |= QLCNIC_APP_CHANGED_FLAGS; |
1088 | vlan_features = (NETIF_F_SG | NETIF_F_IP_CSUM | | 1101 | netdev_update_features(netdev); |
1089 | NETIF_F_IPV6_CSUM); | 1102 | adapter->flags &= ~QLCNIC_APP_CHANGED_FLAGS; |
1090 | |||
1091 | if (QLCNIC_IS_TSO_CAPABLE(adapter)) { | ||
1092 | features |= (NETIF_F_TSO | NETIF_F_TSO6); | ||
1093 | vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6); | ||
1094 | } | ||
1095 | |||
1096 | if (netdev->features & NETIF_F_LRO) | ||
1097 | features |= NETIF_F_LRO; | ||
1098 | |||
1099 | if (esw_cfg->offload_flags & BIT_0) { | ||
1100 | netdev->features |= features; | ||
1101 | adapter->rx_csum = 1; | ||
1102 | if (!(esw_cfg->offload_flags & BIT_1)) { | ||
1103 | netdev->features &= ~NETIF_F_TSO; | ||
1104 | features &= ~NETIF_F_TSO; | ||
1105 | } | ||
1106 | if (!(esw_cfg->offload_flags & BIT_2)) { | ||
1107 | netdev->features &= ~NETIF_F_TSO6; | ||
1108 | features &= ~NETIF_F_TSO6; | ||
1109 | } | ||
1110 | } else { | ||
1111 | netdev->features &= ~features; | ||
1112 | features &= ~features; | ||
1113 | adapter->rx_csum = 0; | ||
1114 | } | ||
1115 | |||
1116 | netdev->vlan_features = (features & vlan_features); | ||
1117 | } | 1103 | } |
1118 | 1104 | ||
1119 | static int | 1105 | static int |
@@ -1995,8 +1981,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1995 | pci_enable_pcie_error_reporting(pdev); | 1981 | pci_enable_pcie_error_reporting(pdev); |
1996 | 1982 | ||
1997 | ahw = kzalloc(sizeof(struct qlcnic_hardware_context), GFP_KERNEL); | 1983 | ahw = kzalloc(sizeof(struct qlcnic_hardware_context), GFP_KERNEL); |
1998 | if (!ahw) | 1984 | if (!ahw) { |
1985 | err = -ENOMEM; | ||
1999 | goto err_out_free_res; | 1986 | goto err_out_free_res; |
1987 | } | ||
2000 | 1988 | ||
2001 | switch (ent->device) { | 1989 | switch (ent->device) { |
2002 | case PCI_DEVICE_ID_QLOGIC_QLE824X: | 1990 | case PCI_DEVICE_ID_QLOGIC_QLE824X: |
@@ -2032,6 +2020,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2032 | 2020 | ||
2033 | adapter->qlcnic_wq = create_singlethread_workqueue("qlcnic"); | 2021 | adapter->qlcnic_wq = create_singlethread_workqueue("qlcnic"); |
2034 | if (adapter->qlcnic_wq == NULL) { | 2022 | if (adapter->qlcnic_wq == NULL) { |
2023 | err = -ENOMEM; | ||
2035 | dev_err(&pdev->dev, "Failed to create workqueue\n"); | 2024 | dev_err(&pdev->dev, "Failed to create workqueue\n"); |
2036 | goto err_out_free_netdev; | 2025 | goto err_out_free_netdev; |
2037 | } | 2026 | } |
@@ -2112,6 +2101,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2112 | goto err_out_disable_msi; | 2101 | goto err_out_disable_msi; |
2113 | } | 2102 | } |
2114 | 2103 | ||
2104 | err = qlcnic_get_act_pci_func(adapter); | ||
2105 | if (err) | ||
2106 | goto err_out_disable_mbx_intr; | ||
2107 | |||
2115 | err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac); | 2108 | err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac); |
2116 | if (err) | 2109 | if (err) |
2117 | goto err_out_disable_mbx_intr; | 2110 | goto err_out_disable_mbx_intr; |
@@ -2141,9 +2134,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2141 | break; | 2134 | break; |
2142 | } | 2135 | } |
2143 | 2136 | ||
2144 | if (qlcnic_get_act_pci_func(adapter)) | ||
2145 | goto err_out_disable_mbx_intr; | ||
2146 | |||
2147 | if (adapter->drv_mac_learn) | 2137 | if (adapter->drv_mac_learn) |
2148 | qlcnic_alloc_lb_filters_mem(adapter); | 2138 | qlcnic_alloc_lb_filters_mem(adapter); |
2149 | 2139 | ||
@@ -2481,12 +2471,17 @@ static void qlcnic_tx_timeout(struct net_device *netdev) | |||
2481 | if (test_bit(__QLCNIC_RESETTING, &adapter->state)) | 2471 | if (test_bit(__QLCNIC_RESETTING, &adapter->state)) |
2482 | return; | 2472 | return; |
2483 | 2473 | ||
2484 | dev_err(&netdev->dev, "transmit timeout, resetting.\n"); | 2474 | if (++adapter->tx_timeo_cnt >= QLCNIC_MAX_TX_TIMEOUTS) { |
2485 | 2475 | netdev_info(netdev, "Tx timeout, reset the adapter.\n"); | |
2486 | if (++adapter->tx_timeo_cnt >= QLCNIC_MAX_TX_TIMEOUTS) | 2476 | if (qlcnic_82xx_check(adapter)) |
2487 | adapter->need_fw_reset = 1; | 2477 | adapter->need_fw_reset = 1; |
2488 | else | 2478 | else if (qlcnic_83xx_check(adapter)) |
2479 | qlcnic_83xx_idc_request_reset(adapter, | ||
2480 | QLCNIC_FORCE_FW_DUMP_KEY); | ||
2481 | } else { | ||
2482 | netdev_info(netdev, "Tx timeout, reset adapter context.\n"); | ||
2489 | adapter->ahw->reset_context = 1; | 2483 | adapter->ahw->reset_context = 1; |
2484 | } | ||
2490 | } | 2485 | } |
2491 | 2486 | ||
2492 | static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev) | 2487 | static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev) |
@@ -3123,10 +3118,8 @@ qlcnic_check_health(struct qlcnic_adapter *adapter) | |||
3123 | if (adapter->need_fw_reset) | 3118 | if (adapter->need_fw_reset) |
3124 | goto detach; | 3119 | goto detach; |
3125 | 3120 | ||
3126 | if (adapter->ahw->reset_context && qlcnic_auto_fw_reset) { | 3121 | if (adapter->ahw->reset_context && qlcnic_auto_fw_reset) |
3127 | qlcnic_reset_hw_context(adapter); | 3122 | qlcnic_reset_hw_context(adapter); |
3128 | adapter->netdev->trans_start = jiffies; | ||
3129 | } | ||
3130 | 3123 | ||
3131 | return 0; | 3124 | return 0; |
3132 | } | 3125 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 44d547d78b84..196b2d100407 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | |||
@@ -280,9 +280,9 @@ void qlcnic_sriov_cleanup(struct qlcnic_adapter *adapter) | |||
280 | static int qlcnic_sriov_post_bc_msg(struct qlcnic_adapter *adapter, u32 *hdr, | 280 | static int qlcnic_sriov_post_bc_msg(struct qlcnic_adapter *adapter, u32 *hdr, |
281 | u32 *pay, u8 pci_func, u8 size) | 281 | u32 *pay, u8 pci_func, u8 size) |
282 | { | 282 | { |
283 | u32 rsp, mbx_val, fw_data, rsp_num, mbx_cmd, val, wait_time = 0; | ||
283 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 284 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
284 | unsigned long flags; | 285 | unsigned long flags; |
285 | u32 rsp, mbx_val, fw_data, rsp_num, mbx_cmd, val; | ||
286 | u16 opcode; | 286 | u16 opcode; |
287 | u8 mbx_err_code; | 287 | u8 mbx_err_code; |
288 | int i, j; | 288 | int i, j; |
@@ -330,15 +330,13 @@ static int qlcnic_sriov_post_bc_msg(struct qlcnic_adapter *adapter, u32 *hdr, | |||
330 | * assume something is wrong. | 330 | * assume something is wrong. |
331 | */ | 331 | */ |
332 | poll: | 332 | poll: |
333 | rsp = qlcnic_83xx_mbx_poll(adapter); | 333 | rsp = qlcnic_83xx_mbx_poll(adapter, &wait_time); |
334 | if (rsp != QLCNIC_RCODE_TIMEOUT) { | 334 | if (rsp != QLCNIC_RCODE_TIMEOUT) { |
335 | /* Get the FW response data */ | 335 | /* Get the FW response data */ |
336 | fw_data = readl(QLCNIC_MBX_FW(ahw, 0)); | 336 | fw_data = readl(QLCNIC_MBX_FW(ahw, 0)); |
337 | if (fw_data & QLCNIC_MBX_ASYNC_EVENT) { | 337 | if (fw_data & QLCNIC_MBX_ASYNC_EVENT) { |
338 | __qlcnic_83xx_process_aen(adapter); | 338 | __qlcnic_83xx_process_aen(adapter); |
339 | mbx_val = QLCRDX(ahw, QLCNIC_HOST_MBX_CTRL); | 339 | goto poll; |
340 | if (mbx_val) | ||
341 | goto poll; | ||
342 | } | 340 | } |
343 | mbx_err_code = QLCNIC_MBX_STATUS(fw_data); | 341 | mbx_err_code = QLCNIC_MBX_STATUS(fw_data); |
344 | rsp_num = QLCNIC_MBX_NUM_REGS(fw_data); | 342 | rsp_num = QLCNIC_MBX_NUM_REGS(fw_data); |
@@ -1736,7 +1734,6 @@ static int qlcnic_sriov_vf_handle_context_reset(struct qlcnic_adapter *adapter) | |||
1736 | 1734 | ||
1737 | if (!qlcnic_sriov_vf_reinit_driver(adapter)) { | 1735 | if (!qlcnic_sriov_vf_reinit_driver(adapter)) { |
1738 | qlcnic_sriov_vf_attach(adapter); | 1736 | qlcnic_sriov_vf_attach(adapter); |
1739 | adapter->netdev->trans_start = jiffies; | ||
1740 | adapter->tx_timeo_cnt = 0; | 1737 | adapter->tx_timeo_cnt = 0; |
1741 | adapter->reset_ctx_cnt = 0; | 1738 | adapter->reset_ctx_cnt = 0; |
1742 | adapter->fw_fail_cnt = 0; | 1739 | adapter->fw_fail_cnt = 0; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index c81be2da119b..1a66ccded235 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | |||
@@ -1133,9 +1133,6 @@ static int qlcnic_sriov_validate_linkevent(struct qlcnic_vf_info *vf, | |||
1133 | if ((cmd->req.arg[1] >> 16) != vf->rx_ctx_id) | 1133 | if ((cmd->req.arg[1] >> 16) != vf->rx_ctx_id) |
1134 | return -EINVAL; | 1134 | return -EINVAL; |
1135 | 1135 | ||
1136 | if (!(cmd->req.arg[1] & BIT_8)) | ||
1137 | return -EINVAL; | ||
1138 | |||
1139 | return 0; | 1136 | return 0; |
1140 | } | 1137 | } |
1141 | 1138 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index 4e22e794a186..e7a2fe21b649 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
@@ -544,6 +544,9 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file, | |||
544 | switch (esw_cfg[i].op_mode) { | 544 | switch (esw_cfg[i].op_mode) { |
545 | case QLCNIC_PORT_DEFAULTS: | 545 | case QLCNIC_PORT_DEFAULTS: |
546 | qlcnic_set_eswitch_port_features(adapter, &esw_cfg[i]); | 546 | qlcnic_set_eswitch_port_features(adapter, &esw_cfg[i]); |
547 | rtnl_lock(); | ||
548 | qlcnic_set_netdev_features(adapter, &esw_cfg[i]); | ||
549 | rtnl_unlock(); | ||
547 | break; | 550 | break; |
548 | case QLCNIC_ADD_VLAN: | 551 | case QLCNIC_ADD_VLAN: |
549 | qlcnic_set_vlan_config(adapter, &esw_cfg[i]); | 552 | qlcnic_set_vlan_config(adapter, &esw_cfg[i]); |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index 87463bc701a6..f87cc216045b 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -1106,6 +1106,7 @@ static int ql_get_next_chunk(struct ql_adapter *qdev, struct rx_ring *rx_ring, | |||
1106 | if (pci_dma_mapping_error(qdev->pdev, map)) { | 1106 | if (pci_dma_mapping_error(qdev->pdev, map)) { |
1107 | __free_pages(rx_ring->pg_chunk.page, | 1107 | __free_pages(rx_ring->pg_chunk.page, |
1108 | qdev->lbq_buf_order); | 1108 | qdev->lbq_buf_order); |
1109 | rx_ring->pg_chunk.page = NULL; | ||
1109 | netif_err(qdev, drv, qdev->ndev, | 1110 | netif_err(qdev, drv, qdev->ndev, |
1110 | "PCI mapping failed.\n"); | 1111 | "PCI mapping failed.\n"); |
1111 | return -ENOMEM; | 1112 | return -ENOMEM; |
@@ -2777,6 +2778,12 @@ static void ql_free_lbq_buffers(struct ql_adapter *qdev, struct rx_ring *rx_ring | |||
2777 | curr_idx = 0; | 2778 | curr_idx = 0; |
2778 | 2779 | ||
2779 | } | 2780 | } |
2781 | if (rx_ring->pg_chunk.page) { | ||
2782 | pci_unmap_page(qdev->pdev, rx_ring->pg_chunk.map, | ||
2783 | ql_lbq_block_size(qdev), PCI_DMA_FROMDEVICE); | ||
2784 | put_page(rx_ring->pg_chunk.page); | ||
2785 | rx_ring->pg_chunk.page = NULL; | ||
2786 | } | ||
2780 | } | 2787 | } |
2781 | 2788 | ||
2782 | static void ql_free_sbq_buffers(struct ql_adapter *qdev, struct rx_ring *rx_ring) | 2789 | static void ql_free_sbq_buffers(struct ql_adapter *qdev, struct rx_ring *rx_ring) |
@@ -4710,6 +4717,7 @@ static int qlge_probe(struct pci_dev *pdev, | |||
4710 | dev_err(&pdev->dev, "net device registration failed.\n"); | 4717 | dev_err(&pdev->dev, "net device registration failed.\n"); |
4711 | ql_release_all(pdev); | 4718 | ql_release_all(pdev); |
4712 | pci_disable_device(pdev); | 4719 | pci_disable_device(pdev); |
4720 | free_netdev(ndev); | ||
4713 | return err; | 4721 | return err; |
4714 | } | 4722 | } |
4715 | /* Start up the timer to trigger EEH if | 4723 | /* Start up the timer to trigger EEH if |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 7d1fb9ad1296..03523459c406 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
@@ -1136,6 +1136,7 @@ static void cp_clean_rings (struct cp_private *cp) | |||
1136 | cp->dev->stats.tx_dropped++; | 1136 | cp->dev->stats.tx_dropped++; |
1137 | } | 1137 | } |
1138 | } | 1138 | } |
1139 | netdev_reset_queue(cp->dev); | ||
1139 | 1140 | ||
1140 | memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE); | 1141 | memset(cp->rx_ring, 0, sizeof(struct cp_desc) * CP_RX_RING_SIZE); |
1141 | memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); | 1142 | memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 79c520b64fdd..393f961a013c 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -5856,7 +5856,20 @@ err_out: | |||
5856 | return -EIO; | 5856 | return -EIO; |
5857 | } | 5857 | } |
5858 | 5858 | ||
5859 | static inline void rtl8169_tso_csum(struct rtl8169_private *tp, | 5859 | static bool rtl_skb_pad(struct sk_buff *skb) |
5860 | { | ||
5861 | if (skb_padto(skb, ETH_ZLEN)) | ||
5862 | return false; | ||
5863 | skb_put(skb, ETH_ZLEN - skb->len); | ||
5864 | return true; | ||
5865 | } | ||
5866 | |||
5867 | static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp, struct sk_buff *skb) | ||
5868 | { | ||
5869 | return skb->len < ETH_ZLEN && tp->mac_version == RTL_GIGA_MAC_VER_34; | ||
5870 | } | ||
5871 | |||
5872 | static inline bool rtl8169_tso_csum(struct rtl8169_private *tp, | ||
5860 | struct sk_buff *skb, u32 *opts) | 5873 | struct sk_buff *skb, u32 *opts) |
5861 | { | 5874 | { |
5862 | const struct rtl_tx_desc_info *info = tx_desc_info + tp->txd_version; | 5875 | const struct rtl_tx_desc_info *info = tx_desc_info + tp->txd_version; |
@@ -5869,13 +5882,20 @@ static inline void rtl8169_tso_csum(struct rtl8169_private *tp, | |||
5869 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | 5882 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { |
5870 | const struct iphdr *ip = ip_hdr(skb); | 5883 | const struct iphdr *ip = ip_hdr(skb); |
5871 | 5884 | ||
5885 | if (unlikely(rtl_test_hw_pad_bug(tp, skb))) | ||
5886 | return skb_checksum_help(skb) == 0 && rtl_skb_pad(skb); | ||
5887 | |||
5872 | if (ip->protocol == IPPROTO_TCP) | 5888 | if (ip->protocol == IPPROTO_TCP) |
5873 | opts[offset] |= info->checksum.tcp; | 5889 | opts[offset] |= info->checksum.tcp; |
5874 | else if (ip->protocol == IPPROTO_UDP) | 5890 | else if (ip->protocol == IPPROTO_UDP) |
5875 | opts[offset] |= info->checksum.udp; | 5891 | opts[offset] |= info->checksum.udp; |
5876 | else | 5892 | else |
5877 | WARN_ON_ONCE(1); | 5893 | WARN_ON_ONCE(1); |
5894 | } else { | ||
5895 | if (unlikely(rtl_test_hw_pad_bug(tp, skb))) | ||
5896 | return rtl_skb_pad(skb); | ||
5878 | } | 5897 | } |
5898 | return true; | ||
5879 | } | 5899 | } |
5880 | 5900 | ||
5881 | static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | 5901 | static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, |
@@ -5896,17 +5916,15 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
5896 | goto err_stop_0; | 5916 | goto err_stop_0; |
5897 | } | 5917 | } |
5898 | 5918 | ||
5899 | /* 8168evl does not automatically pad to minimum length. */ | ||
5900 | if (unlikely(tp->mac_version == RTL_GIGA_MAC_VER_34 && | ||
5901 | skb->len < ETH_ZLEN)) { | ||
5902 | if (skb_padto(skb, ETH_ZLEN)) | ||
5903 | goto err_update_stats; | ||
5904 | skb_put(skb, ETH_ZLEN - skb->len); | ||
5905 | } | ||
5906 | |||
5907 | if (unlikely(le32_to_cpu(txd->opts1) & DescOwn)) | 5919 | if (unlikely(le32_to_cpu(txd->opts1) & DescOwn)) |
5908 | goto err_stop_0; | 5920 | goto err_stop_0; |
5909 | 5921 | ||
5922 | opts[1] = cpu_to_le32(rtl8169_tx_vlan_tag(skb)); | ||
5923 | opts[0] = DescOwn; | ||
5924 | |||
5925 | if (!rtl8169_tso_csum(tp, skb, opts)) | ||
5926 | goto err_update_stats; | ||
5927 | |||
5910 | len = skb_headlen(skb); | 5928 | len = skb_headlen(skb); |
5911 | mapping = dma_map_single(d, skb->data, len, DMA_TO_DEVICE); | 5929 | mapping = dma_map_single(d, skb->data, len, DMA_TO_DEVICE); |
5912 | if (unlikely(dma_mapping_error(d, mapping))) { | 5930 | if (unlikely(dma_mapping_error(d, mapping))) { |
@@ -5918,11 +5936,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
5918 | tp->tx_skb[entry].len = len; | 5936 | tp->tx_skb[entry].len = len; |
5919 | txd->addr = cpu_to_le64(mapping); | 5937 | txd->addr = cpu_to_le64(mapping); |
5920 | 5938 | ||
5921 | opts[1] = cpu_to_le32(rtl8169_tx_vlan_tag(skb)); | ||
5922 | opts[0] = DescOwn; | ||
5923 | |||
5924 | rtl8169_tso_csum(tp, skb, opts); | ||
5925 | |||
5926 | frags = rtl8169_xmit_frags(tp, skb, opts); | 5939 | frags = rtl8169_xmit_frags(tp, skb, opts); |
5927 | if (frags < 0) | 5940 | if (frags < 0) |
5928 | goto err_dma_1; | 5941 | goto err_dma_1; |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 33dc6f2418f2..5e3982fc5398 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -897,8 +897,8 @@ static int sh_eth_check_reset(struct net_device *ndev) | |||
897 | mdelay(1); | 897 | mdelay(1); |
898 | cnt--; | 898 | cnt--; |
899 | } | 899 | } |
900 | if (cnt < 0) { | 900 | if (cnt <= 0) { |
901 | pr_err("Device reset fail\n"); | 901 | pr_err("Device reset failed\n"); |
902 | ret = -ETIMEDOUT; | 902 | ret = -ETIMEDOUT; |
903 | } | 903 | } |
904 | return ret; | 904 | return ret; |
@@ -1401,16 +1401,23 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status) | |||
1401 | desc_status = edmac_to_cpu(mdp, rxdesc->status); | 1401 | desc_status = edmac_to_cpu(mdp, rxdesc->status); |
1402 | pkt_len = rxdesc->frame_length; | 1402 | pkt_len = rxdesc->frame_length; |
1403 | 1403 | ||
1404 | #if defined(CONFIG_ARCH_R8A7740) | ||
1405 | desc_status >>= 16; | ||
1406 | #endif | ||
1407 | |||
1408 | if (--boguscnt < 0) | 1404 | if (--boguscnt < 0) |
1409 | break; | 1405 | break; |
1410 | 1406 | ||
1411 | if (!(desc_status & RDFEND)) | 1407 | if (!(desc_status & RDFEND)) |
1412 | ndev->stats.rx_length_errors++; | 1408 | ndev->stats.rx_length_errors++; |
1413 | 1409 | ||
1410 | #if defined(CONFIG_ARCH_R8A7740) | ||
1411 | /* | ||
1412 | * In case of almost all GETHER/ETHERs, the Receive Frame State | ||
1413 | * (RFS) bits in the Receive Descriptor 0 are from bit 9 to | ||
1414 | * bit 0. However, in case of the R8A7740's GETHER, the RFS | ||
1415 | * bits are from bit 25 to bit 16. So, the driver needs right | ||
1416 | * shifting by 16. | ||
1417 | */ | ||
1418 | desc_status >>= 16; | ||
1419 | #endif | ||
1420 | |||
1414 | if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 | | 1421 | if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 | |
1415 | RD_RFS5 | RD_RFS6 | RD_RFS10)) { | 1422 | RD_RFS5 | RD_RFS6 | RD_RFS10)) { |
1416 | ndev->stats.rx_errors++; | 1423 | ndev->stats.rx_errors++; |
@@ -2745,11 +2752,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev) | |||
2745 | if (mdp->cd->tsu) { | 2752 | if (mdp->cd->tsu) { |
2746 | struct resource *rtsu; | 2753 | struct resource *rtsu; |
2747 | rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 2754 | rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
2748 | if (!rtsu) { | ||
2749 | dev_err(&pdev->dev, "Not found TSU resource\n"); | ||
2750 | ret = -ENODEV; | ||
2751 | goto out_release; | ||
2752 | } | ||
2753 | mdp->tsu_addr = devm_ioremap_resource(&pdev->dev, rtsu); | 2755 | mdp->tsu_addr = devm_ioremap_resource(&pdev->dev, rtsu); |
2754 | if (IS_ERR(mdp->tsu_addr)) { | 2756 | if (IS_ERR(mdp->tsu_addr)) { |
2755 | ret = PTR_ERR(mdp->tsu_addr); | 2757 | ret = PTR_ERR(mdp->tsu_addr); |
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 01b99206139a..39e4cb39de29 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -638,14 +638,16 @@ static void efx_start_datapath(struct efx_nic *efx) | |||
638 | EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + | 638 | EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + |
639 | efx->type->rx_buffer_padding); | 639 | efx->type->rx_buffer_padding); |
640 | rx_buf_len = (sizeof(struct efx_rx_page_state) + | 640 | rx_buf_len = (sizeof(struct efx_rx_page_state) + |
641 | EFX_PAGE_IP_ALIGN + efx->rx_dma_len); | 641 | NET_IP_ALIGN + efx->rx_dma_len); |
642 | if (rx_buf_len <= PAGE_SIZE) { | 642 | if (rx_buf_len <= PAGE_SIZE) { |
643 | efx->rx_scatter = false; | 643 | efx->rx_scatter = false; |
644 | efx->rx_buffer_order = 0; | 644 | efx->rx_buffer_order = 0; |
645 | } else if (efx->type->can_rx_scatter) { | 645 | } else if (efx->type->can_rx_scatter) { |
646 | BUILD_BUG_ON(EFX_RX_USR_BUF_SIZE % L1_CACHE_BYTES); | ||
646 | BUILD_BUG_ON(sizeof(struct efx_rx_page_state) + | 647 | BUILD_BUG_ON(sizeof(struct efx_rx_page_state) + |
647 | EFX_PAGE_IP_ALIGN + EFX_RX_USR_BUF_SIZE > | 648 | 2 * ALIGN(NET_IP_ALIGN + EFX_RX_USR_BUF_SIZE, |
648 | PAGE_SIZE / 2); | 649 | EFX_RX_BUF_ALIGNMENT) > |
650 | PAGE_SIZE); | ||
649 | efx->rx_scatter = true; | 651 | efx->rx_scatter = true; |
650 | efx->rx_dma_len = EFX_RX_USR_BUF_SIZE; | 652 | efx->rx_dma_len = EFX_RX_USR_BUF_SIZE; |
651 | efx->rx_buffer_order = 0; | 653 | efx->rx_buffer_order = 0; |
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index 9bd433a095c5..39d6bd77f015 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h | |||
@@ -72,8 +72,20 @@ | |||
72 | /* Maximum possible MTU the driver supports */ | 72 | /* Maximum possible MTU the driver supports */ |
73 | #define EFX_MAX_MTU (9 * 1024) | 73 | #define EFX_MAX_MTU (9 * 1024) |
74 | 74 | ||
75 | /* Size of an RX scatter buffer. Small enough to pack 2 into a 4K page. */ | 75 | /* Size of an RX scatter buffer. Small enough to pack 2 into a 4K page, |
76 | #define EFX_RX_USR_BUF_SIZE 1824 | 76 | * and should be a multiple of the cache line size. |
77 | */ | ||
78 | #define EFX_RX_USR_BUF_SIZE (2048 - 256) | ||
79 | |||
80 | /* If possible, we should ensure cache line alignment at start and end | ||
81 | * of every buffer. Otherwise, we just need to ensure 4-byte | ||
82 | * alignment of the network header. | ||
83 | */ | ||
84 | #if NET_IP_ALIGN == 0 | ||
85 | #define EFX_RX_BUF_ALIGNMENT L1_CACHE_BYTES | ||
86 | #else | ||
87 | #define EFX_RX_BUF_ALIGNMENT 4 | ||
88 | #endif | ||
77 | 89 | ||
78 | /* Forward declare Precision Time Protocol (PTP) support structure. */ | 90 | /* Forward declare Precision Time Protocol (PTP) support structure. */ |
79 | struct efx_ptp_data; | 91 | struct efx_ptp_data; |
@@ -468,24 +480,11 @@ enum nic_state { | |||
468 | }; | 480 | }; |
469 | 481 | ||
470 | /* | 482 | /* |
471 | * Alignment of page-allocated RX buffers | ||
472 | * | ||
473 | * Controls the number of bytes inserted at the start of an RX buffer. | ||
474 | * This is the equivalent of NET_IP_ALIGN [which controls the alignment | ||
475 | * of the skb->head for hardware DMA]. | ||
476 | */ | ||
477 | #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS | ||
478 | #define EFX_PAGE_IP_ALIGN 0 | ||
479 | #else | ||
480 | #define EFX_PAGE_IP_ALIGN NET_IP_ALIGN | ||
481 | #endif | ||
482 | |||
483 | /* | ||
484 | * Alignment of the skb->head which wraps a page-allocated RX buffer | 483 | * Alignment of the skb->head which wraps a page-allocated RX buffer |
485 | * | 484 | * |
486 | * The skb allocated to wrap an rx_buffer can have this alignment. Since | 485 | * The skb allocated to wrap an rx_buffer can have this alignment. Since |
487 | * the data is memcpy'd from the rx_buf, it does not need to be equal to | 486 | * the data is memcpy'd from the rx_buf, it does not need to be equal to |
488 | * EFX_PAGE_IP_ALIGN. | 487 | * NET_IP_ALIGN. |
489 | */ | 488 | */ |
490 | #define EFX_PAGE_SKB_ALIGN 2 | 489 | #define EFX_PAGE_SKB_ALIGN 2 |
491 | 490 | ||
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index e73e30bac10e..a7dfe36cabf4 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c | |||
@@ -93,8 +93,8 @@ static inline void efx_sync_rx_buffer(struct efx_nic *efx, | |||
93 | 93 | ||
94 | void efx_rx_config_page_split(struct efx_nic *efx) | 94 | void efx_rx_config_page_split(struct efx_nic *efx) |
95 | { | 95 | { |
96 | efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + EFX_PAGE_IP_ALIGN, | 96 | efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + NET_IP_ALIGN, |
97 | L1_CACHE_BYTES); | 97 | EFX_RX_BUF_ALIGNMENT); |
98 | efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 : | 98 | efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 : |
99 | ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) / | 99 | ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) / |
100 | efx->rx_page_buf_step); | 100 | efx->rx_page_buf_step); |
@@ -188,9 +188,9 @@ static int efx_init_rx_buffers(struct efx_rx_queue *rx_queue) | |||
188 | do { | 188 | do { |
189 | index = rx_queue->added_count & rx_queue->ptr_mask; | 189 | index = rx_queue->added_count & rx_queue->ptr_mask; |
190 | rx_buf = efx_rx_buffer(rx_queue, index); | 190 | rx_buf = efx_rx_buffer(rx_queue, index); |
191 | rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN; | 191 | rx_buf->dma_addr = dma_addr + NET_IP_ALIGN; |
192 | rx_buf->page = page; | 192 | rx_buf->page = page; |
193 | rx_buf->page_offset = page_offset + EFX_PAGE_IP_ALIGN; | 193 | rx_buf->page_offset = page_offset + NET_IP_ALIGN; |
194 | rx_buf->len = efx->rx_dma_len; | 194 | rx_buf->len = efx->rx_dma_len; |
195 | rx_buf->flags = 0; | 195 | rx_buf->flags = 0; |
196 | ++rx_queue->added_count; | 196 | ++rx_queue->added_count; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index f695a50bac47..43c1f3223322 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config STMMAC_ETH | 1 | config STMMAC_ETH |
2 | tristate "STMicroelectronics 10/100/1000 Ethernet driver" | 2 | tristate "STMicroelectronics 10/100/1000 Ethernet driver" |
3 | depends on HAS_IOMEM | 3 | depends on HAS_IOMEM && HAS_DMA |
4 | select NET_CORE | 4 | select NET_CORE |
5 | select MII | 5 | select MII |
6 | select PHYLIB | 6 | select PHYLIB |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 618446ae1ec1..ee919ca8b8a0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -1899,7 +1899,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1899 | 1899 | ||
1900 | #ifdef STMMAC_XMIT_DEBUG | 1900 | #ifdef STMMAC_XMIT_DEBUG |
1901 | if (netif_msg_pktdata(priv)) { | 1901 | if (netif_msg_pktdata(priv)) { |
1902 | pr_info("%s: curr %d dirty=%d entry=%d, first=%p, nfrags=%d" | 1902 | pr_info("%s: curr %d dirty=%d entry=%d, first=%p, nfrags=%d", |
1903 | __func__, (priv->cur_tx % txsize), | 1903 | __func__, (priv->cur_tx % txsize), |
1904 | (priv->dirty_tx % txsize), entry, first, nfrags); | 1904 | (priv->dirty_tx % txsize), entry, first, nfrags); |
1905 | if (priv->extend_desc) | 1905 | if (priv->extend_desc) |
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 12aec173564c..c47f0dbcebb5 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c | |||
@@ -449,10 +449,9 @@ static int davinci_mdio_suspend(struct device *dev) | |||
449 | __raw_writel(ctrl, &data->regs->control); | 449 | __raw_writel(ctrl, &data->regs->control); |
450 | wait_for_idle(data); | 450 | wait_for_idle(data); |
451 | 451 | ||
452 | pm_runtime_put_sync(data->dev); | ||
453 | |||
454 | data->suspended = true; | 452 | data->suspended = true; |
455 | spin_unlock(&data->lock); | 453 | spin_unlock(&data->lock); |
454 | pm_runtime_put_sync(data->dev); | ||
456 | 455 | ||
457 | return 0; | 456 | return 0; |
458 | } | 457 | } |
@@ -460,15 +459,12 @@ static int davinci_mdio_suspend(struct device *dev) | |||
460 | static int davinci_mdio_resume(struct device *dev) | 459 | static int davinci_mdio_resume(struct device *dev) |
461 | { | 460 | { |
462 | struct davinci_mdio_data *data = dev_get_drvdata(dev); | 461 | struct davinci_mdio_data *data = dev_get_drvdata(dev); |
463 | u32 ctrl; | ||
464 | 462 | ||
465 | spin_lock(&data->lock); | ||
466 | pm_runtime_get_sync(data->dev); | 463 | pm_runtime_get_sync(data->dev); |
467 | 464 | ||
465 | spin_lock(&data->lock); | ||
468 | /* restart the scan state machine */ | 466 | /* restart the scan state machine */ |
469 | ctrl = __raw_readl(&data->regs->control); | 467 | __davinci_mdio_reset(data); |
470 | ctrl |= CONTROL_ENABLE; | ||
471 | __raw_writel(ctrl, &data->regs->control); | ||
472 | 468 | ||
473 | data->suspended = false; | 469 | data->suspended = false; |
474 | spin_unlock(&data->lock); | 470 | spin_unlock(&data->lock); |
@@ -477,8 +473,8 @@ static int davinci_mdio_resume(struct device *dev) | |||
477 | } | 473 | } |
478 | 474 | ||
479 | static const struct dev_pm_ops davinci_mdio_pm_ops = { | 475 | static const struct dev_pm_ops davinci_mdio_pm_ops = { |
480 | .suspend = davinci_mdio_suspend, | 476 | .suspend_late = davinci_mdio_suspend, |
481 | .resume = davinci_mdio_resume, | 477 | .resume_early = davinci_mdio_resume, |
482 | }; | 478 | }; |
483 | 479 | ||
484 | static const struct of_device_id davinci_mdio_of_mtable[] = { | 480 | static const struct of_device_id davinci_mdio_of_mtable[] = { |
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c index 919b983114e9..b7268b3dae77 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c | |||
@@ -946,7 +946,8 @@ static int xemaclite_open(struct net_device *dev) | |||
946 | phy_write(lp->phy_dev, MII_CTRL1000, 0); | 946 | phy_write(lp->phy_dev, MII_CTRL1000, 0); |
947 | 947 | ||
948 | /* Advertise only 10 and 100mbps full/half duplex speeds */ | 948 | /* Advertise only 10 and 100mbps full/half duplex speeds */ |
949 | phy_write(lp->phy_dev, MII_ADVERTISE, ADVERTISE_ALL); | 949 | phy_write(lp->phy_dev, MII_ADVERTISE, ADVERTISE_ALL | |
950 | ADVERTISE_CSMA); | ||
950 | 951 | ||
951 | /* Restart auto negotiation */ | 952 | /* Restart auto negotiation */ |
952 | bmcr = phy_read(lp->phy_dev, MII_BMCR); | 953 | bmcr = phy_read(lp->phy_dev, MII_BMCR); |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 088c55496191..ab2307b5d9a7 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/inetdevice.h> | 31 | #include <linux/inetdevice.h> |
32 | #include <linux/etherdevice.h> | 32 | #include <linux/etherdevice.h> |
33 | #include <linux/skbuff.h> | 33 | #include <linux/skbuff.h> |
34 | #include <linux/if_vlan.h> | ||
34 | #include <linux/in.h> | 35 | #include <linux/in.h> |
35 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
36 | #include <net/arp.h> | 37 | #include <net/arp.h> |
@@ -284,7 +285,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, | |||
284 | 285 | ||
285 | skb->protocol = eth_type_trans(skb, net); | 286 | skb->protocol = eth_type_trans(skb, net); |
286 | skb->ip_summed = CHECKSUM_NONE; | 287 | skb->ip_summed = CHECKSUM_NONE; |
287 | skb->vlan_tci = packet->vlan_tci; | 288 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), packet->vlan_tci); |
288 | 289 | ||
289 | net->stats.rx_packets++; | 290 | net->stats.rx_packets++; |
290 | net->stats.rx_bytes += packet->total_data_buflen; | 291 | net->stats.rx_bytes += packet->total_data_buflen; |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index d5a141c7c4e7..6e91931a1c2c 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -229,7 +229,8 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | if (port->passthru) | 231 | if (port->passthru) |
232 | vlan = list_first_entry(&port->vlans, struct macvlan_dev, list); | 232 | vlan = list_first_or_null_rcu(&port->vlans, |
233 | struct macvlan_dev, list); | ||
233 | else | 234 | else |
234 | vlan = macvlan_hash_lookup(port, eth->h_dest); | 235 | vlan = macvlan_hash_lookup(port, eth->h_dest); |
235 | if (vlan == NULL) | 236 | if (vlan == NULL) |
@@ -814,7 +815,7 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, | |||
814 | if (err < 0) | 815 | if (err < 0) |
815 | goto upper_dev_unlink; | 816 | goto upper_dev_unlink; |
816 | 817 | ||
817 | list_add_tail(&vlan->list, &port->vlans); | 818 | list_add_tail_rcu(&vlan->list, &port->vlans); |
818 | netif_stacked_transfer_operstate(lowerdev, dev); | 819 | netif_stacked_transfer_operstate(lowerdev, dev); |
819 | 820 | ||
820 | return 0; | 821 | return 0; |
@@ -842,7 +843,7 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head) | |||
842 | { | 843 | { |
843 | struct macvlan_dev *vlan = netdev_priv(dev); | 844 | struct macvlan_dev *vlan = netdev_priv(dev); |
844 | 845 | ||
845 | list_del(&vlan->list); | 846 | list_del_rcu(&vlan->list); |
846 | unregister_netdevice_queue(dev, head); | 847 | unregister_netdevice_queue(dev, head); |
847 | netdev_upper_dev_unlink(vlan->lowerdev, dev); | 848 | netdev_upper_dev_unlink(vlan->lowerdev, dev); |
848 | } | 849 | } |
@@ -852,18 +853,24 @@ static int macvlan_changelink(struct net_device *dev, | |||
852 | struct nlattr *tb[], struct nlattr *data[]) | 853 | struct nlattr *tb[], struct nlattr *data[]) |
853 | { | 854 | { |
854 | struct macvlan_dev *vlan = netdev_priv(dev); | 855 | struct macvlan_dev *vlan = netdev_priv(dev); |
855 | if (data && data[IFLA_MACVLAN_MODE]) | 856 | |
856 | vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); | ||
857 | if (data && data[IFLA_MACVLAN_FLAGS]) { | 857 | if (data && data[IFLA_MACVLAN_FLAGS]) { |
858 | __u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]); | 858 | __u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]); |
859 | bool promisc = (flags ^ vlan->flags) & MACVLAN_FLAG_NOPROMISC; | 859 | bool promisc = (flags ^ vlan->flags) & MACVLAN_FLAG_NOPROMISC; |
860 | 860 | if (vlan->port->passthru && promisc) { | |
861 | if (promisc && (flags & MACVLAN_FLAG_NOPROMISC)) | 861 | int err; |
862 | dev_set_promiscuity(vlan->lowerdev, -1); | 862 | |
863 | else if (promisc && !(flags & MACVLAN_FLAG_NOPROMISC)) | 863 | if (flags & MACVLAN_FLAG_NOPROMISC) |
864 | dev_set_promiscuity(vlan->lowerdev, 1); | 864 | err = dev_set_promiscuity(vlan->lowerdev, -1); |
865 | else | ||
866 | err = dev_set_promiscuity(vlan->lowerdev, 1); | ||
867 | if (err < 0) | ||
868 | return err; | ||
869 | } | ||
865 | vlan->flags = flags; | 870 | vlan->flags = flags; |
866 | } | 871 | } |
872 | if (data && data[IFLA_MACVLAN_MODE]) | ||
873 | vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); | ||
867 | return 0; | 874 | return 0; |
868 | } | 875 | } |
869 | 876 | ||
diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c index ed947dd76fbd..f3cdf64997d6 100644 --- a/drivers/net/ntb_netdev.c +++ b/drivers/net/ntb_netdev.c | |||
@@ -375,6 +375,8 @@ static void ntb_netdev_remove(struct pci_dev *pdev) | |||
375 | if (dev == NULL) | 375 | if (dev == NULL) |
376 | return; | 376 | return; |
377 | 377 | ||
378 | list_del(&dev->list); | ||
379 | |||
378 | ndev = dev->ndev; | 380 | ndev = dev->ndev; |
379 | 381 | ||
380 | unregister_netdev(ndev); | 382 | unregister_netdev(ndev); |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index c14f14741b3f..38f0b312ff85 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -1044,7 +1044,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
1044 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); | 1044 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); |
1045 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); | 1045 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); |
1046 | idx = phy_find_setting(phydev->speed, phydev->duplex); | 1046 | idx = phy_find_setting(phydev->speed, phydev->duplex); |
1047 | if ((lp & adv & settings[idx].setting)) | 1047 | if (!(lp & adv & settings[idx].setting)) |
1048 | goto eee_exit; | 1048 | goto eee_exit; |
1049 | 1049 | ||
1050 | if (clk_stop_enable) { | 1050 | if (clk_stop_enable) { |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 7c43261975bd..b3051052f3ad 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -1092,8 +1092,8 @@ static int team_port_add(struct team *team, struct net_device *port_dev) | |||
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | port->index = -1; | 1094 | port->index = -1; |
1095 | team_port_enable(team, port); | ||
1096 | list_add_tail_rcu(&port->list, &team->port_list); | 1095 | list_add_tail_rcu(&port->list, &team->port_list); |
1096 | team_port_enable(team, port); | ||
1097 | __team_compute_features(team); | 1097 | __team_compute_features(team); |
1098 | __team_port_change_port_added(port, !!netif_carrier_ok(port_dev)); | 1098 | __team_port_change_port_added(port, !!netif_carrier_ok(port_dev)); |
1099 | __team_options_change_check(team); | 1099 | __team_options_change_check(team); |
@@ -2374,7 +2374,8 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq, | |||
2374 | bool incomplete; | 2374 | bool incomplete; |
2375 | int i; | 2375 | int i; |
2376 | 2376 | ||
2377 | port = list_first_entry(&team->port_list, struct team_port, list); | 2377 | port = list_first_entry_or_null(&team->port_list, |
2378 | struct team_port, list); | ||
2378 | 2379 | ||
2379 | start_again: | 2380 | start_again: |
2380 | err = __send_and_alloc_skb(&skb, team, portid, send_func); | 2381 | err = __send_and_alloc_skb(&skb, team, portid, send_func); |
@@ -2402,8 +2403,8 @@ start_again: | |||
2402 | err = team_nl_fill_one_port_get(skb, one_port); | 2403 | err = team_nl_fill_one_port_get(skb, one_port); |
2403 | if (err) | 2404 | if (err) |
2404 | goto errout; | 2405 | goto errout; |
2405 | } else { | 2406 | } else if (port) { |
2406 | list_for_each_entry(port, &team->port_list, list) { | 2407 | list_for_each_entry_from(port, &team->port_list, list) { |
2407 | err = team_nl_fill_one_port_get(skb, port); | 2408 | err = team_nl_fill_one_port_get(skb, port); |
2408 | if (err) { | 2409 | if (err) { |
2409 | if (err == -EMSGSIZE) { | 2410 | if (err == -EMSGSIZE) { |
diff --git a/drivers/net/team/team_mode_random.c b/drivers/net/team/team_mode_random.c index 5ca14d463ba7..7f032e211343 100644 --- a/drivers/net/team/team_mode_random.c +++ b/drivers/net/team/team_mode_random.c | |||
@@ -28,6 +28,8 @@ static bool rnd_transmit(struct team *team, struct sk_buff *skb) | |||
28 | 28 | ||
29 | port_index = random_N(team->en_port_count); | 29 | port_index = random_N(team->en_port_count); |
30 | port = team_get_port_by_index_rcu(team, port_index); | 30 | port = team_get_port_by_index_rcu(team, port_index); |
31 | if (unlikely(!port)) | ||
32 | goto drop; | ||
31 | port = team_get_first_port_txable_rcu(team, port); | 33 | port = team_get_first_port_txable_rcu(team, port); |
32 | if (unlikely(!port)) | 34 | if (unlikely(!port)) |
33 | goto drop; | 35 | goto drop; |
diff --git a/drivers/net/team/team_mode_roundrobin.c b/drivers/net/team/team_mode_roundrobin.c index d268e4de781b..472623f8ce3d 100644 --- a/drivers/net/team/team_mode_roundrobin.c +++ b/drivers/net/team/team_mode_roundrobin.c | |||
@@ -32,6 +32,8 @@ static bool rr_transmit(struct team *team, struct sk_buff *skb) | |||
32 | 32 | ||
33 | port_index = rr_priv(team)->sent_packets++ % team->en_port_count; | 33 | port_index = rr_priv(team)->sent_packets++ % team->en_port_count; |
34 | port = team_get_port_by_index_rcu(team, port_index); | 34 | port = team_get_port_by_index_rcu(team, port_index); |
35 | if (unlikely(!port)) | ||
36 | goto drop; | ||
35 | port = team_get_first_port_txable_rcu(team, port); | 37 | port = team_get_first_port_txable_rcu(team, port); |
36 | if (unlikely(!port)) | 38 | if (unlikely(!port)) |
37 | goto drop; | 39 | goto drop; |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index f042b0373e5d..bfa9bb48e42d 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -352,7 +352,7 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
352 | u32 numqueues = 0; | 352 | u32 numqueues = 0; |
353 | 353 | ||
354 | rcu_read_lock(); | 354 | rcu_read_lock(); |
355 | numqueues = tun->numqueues; | 355 | numqueues = ACCESS_ONCE(tun->numqueues); |
356 | 356 | ||
357 | txq = skb_get_rxhash(skb); | 357 | txq = skb_get_rxhash(skb); |
358 | if (txq) { | 358 | if (txq) { |
@@ -1585,6 +1585,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1585 | else | 1585 | else |
1586 | return -EINVAL; | 1586 | return -EINVAL; |
1587 | 1587 | ||
1588 | if (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) != | ||
1589 | !!(tun->flags & TUN_TAP_MQ)) | ||
1590 | return -EINVAL; | ||
1591 | |||
1588 | if (tun_not_capable(tun)) | 1592 | if (tun_not_capable(tun)) |
1589 | return -EPERM; | 1593 | return -EPERM; |
1590 | err = security_tun_dev_open(tun->security); | 1594 | err = security_tun_dev_open(tun->security); |
@@ -2155,6 +2159,8 @@ static int tun_chr_open(struct inode *inode, struct file * file) | |||
2155 | set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags); | 2159 | set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags); |
2156 | INIT_LIST_HEAD(&tfile->next); | 2160 | INIT_LIST_HEAD(&tfile->next); |
2157 | 2161 | ||
2162 | sock_set_flag(&tfile->sk, SOCK_ZEROCOPY); | ||
2163 | |||
2158 | return 0; | 2164 | return 0; |
2159 | } | 2165 | } |
2160 | 2166 | ||
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 078795fe6e31..04ee044dde51 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -627,6 +627,12 @@ static const struct usb_device_id products [] = { | |||
627 | .driver_info = 0, | 627 | .driver_info = 0, |
628 | }, | 628 | }, |
629 | 629 | ||
630 | /* Huawei E1820 - handled by qmi_wwan */ | ||
631 | { | ||
632 | USB_DEVICE_INTERFACE_NUMBER(HUAWEI_VENDOR_ID, 0x14ac, 1), | ||
633 | .driver_info = 0, | ||
634 | }, | ||
635 | |||
630 | /* Realtek RTL8152 Based USB 2.0 Ethernet Adapters */ | 636 | /* Realtek RTL8152 Based USB 2.0 Ethernet Adapters */ |
631 | #if defined(CONFIG_USB_RTL8152) || defined(CONFIG_USB_RTL8152_MODULE) | 637 | #if defined(CONFIG_USB_RTL8152) || defined(CONFIG_USB_RTL8152_MODULE) |
632 | { | 638 | { |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index cf887c2384e9..d095d0d3056b 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -519,6 +519,7 @@ static const struct usb_device_id products[] = { | |||
519 | /* 3. Combined interface devices matching on interface number */ | 519 | /* 3. Combined interface devices matching on interface number */ |
520 | {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ | 520 | {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ |
521 | {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ | 521 | {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ |
522 | {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ | ||
522 | {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, | 523 | {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, |
523 | {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, | 524 | {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, |
524 | {QMI_FIXED_INTF(0x19d2, 0x0017, 3)}, | 525 | {QMI_FIXED_INTF(0x19d2, 0x0017, 3)}, |
@@ -582,6 +583,7 @@ static const struct usb_device_id products[] = { | |||
582 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ | 583 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ |
583 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ | 584 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
584 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ | 585 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
586 | {QMI_FIXED_INTF(0x1e2d, 0x12d1, 4)}, /* Cinterion PLxx */ | ||
585 | 587 | ||
586 | /* 4. Gobi 1000 devices */ | 588 | /* 4. Gobi 1000 devices */ |
587 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 589 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index a491d3a95393..6cbdac67f3a0 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -130,19 +130,23 @@ struct rtl8150 { | |||
130 | struct usb_device *udev; | 130 | struct usb_device *udev; |
131 | struct tasklet_struct tl; | 131 | struct tasklet_struct tl; |
132 | struct net_device *netdev; | 132 | struct net_device *netdev; |
133 | struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb; | 133 | struct urb *rx_urb, *tx_urb, *intr_urb; |
134 | struct sk_buff *tx_skb, *rx_skb; | 134 | struct sk_buff *tx_skb, *rx_skb; |
135 | struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE]; | 135 | struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE]; |
136 | spinlock_t rx_pool_lock; | 136 | spinlock_t rx_pool_lock; |
137 | struct usb_ctrlrequest dr; | 137 | struct usb_ctrlrequest dr; |
138 | int intr_interval; | 138 | int intr_interval; |
139 | __le16 rx_creg; | ||
140 | u8 *intr_buff; | 139 | u8 *intr_buff; |
141 | u8 phy; | 140 | u8 phy; |
142 | }; | 141 | }; |
143 | 142 | ||
144 | typedef struct rtl8150 rtl8150_t; | 143 | typedef struct rtl8150 rtl8150_t; |
145 | 144 | ||
145 | struct async_req { | ||
146 | struct usb_ctrlrequest dr; | ||
147 | u16 rx_creg; | ||
148 | }; | ||
149 | |||
146 | static const char driver_name [] = "rtl8150"; | 150 | static const char driver_name [] = "rtl8150"; |
147 | 151 | ||
148 | /* | 152 | /* |
@@ -164,51 +168,47 @@ static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data) | |||
164 | indx, 0, data, size, 500); | 168 | indx, 0, data, size, 500); |
165 | } | 169 | } |
166 | 170 | ||
167 | static void ctrl_callback(struct urb *urb) | 171 | static void async_set_reg_cb(struct urb *urb) |
168 | { | 172 | { |
169 | rtl8150_t *dev; | 173 | struct async_req *req = (struct async_req *)urb->context; |
170 | int status = urb->status; | 174 | int status = urb->status; |
171 | 175 | ||
172 | switch (status) { | 176 | if (status < 0) |
173 | case 0: | 177 | dev_dbg(&urb->dev->dev, "%s failed with %d", __func__, status); |
174 | break; | 178 | kfree(req); |
175 | case -EINPROGRESS: | 179 | usb_free_urb(urb); |
176 | break; | ||
177 | case -ENOENT: | ||
178 | break; | ||
179 | default: | ||
180 | if (printk_ratelimit()) | ||
181 | dev_warn(&urb->dev->dev, "ctrl urb status %d\n", status); | ||
182 | } | ||
183 | dev = urb->context; | ||
184 | clear_bit(RX_REG_SET, &dev->flags); | ||
185 | } | 180 | } |
186 | 181 | ||
187 | static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size) | 182 | static int async_set_registers(rtl8150_t *dev, u16 indx, u16 size, u16 reg) |
188 | { | 183 | { |
189 | int ret; | 184 | int res = -ENOMEM; |
190 | 185 | struct urb *async_urb; | |
191 | if (test_bit(RX_REG_SET, &dev->flags)) | 186 | struct async_req *req; |
192 | return -EAGAIN; | ||
193 | 187 | ||
194 | dev->dr.bRequestType = RTL8150_REQT_WRITE; | 188 | req = kmalloc(sizeof(struct async_req), GFP_ATOMIC); |
195 | dev->dr.bRequest = RTL8150_REQ_SET_REGS; | 189 | if (req == NULL) |
196 | dev->dr.wValue = cpu_to_le16(indx); | 190 | return res; |
197 | dev->dr.wIndex = 0; | 191 | async_urb = usb_alloc_urb(0, GFP_ATOMIC); |
198 | dev->dr.wLength = cpu_to_le16(size); | 192 | if (async_urb == NULL) { |
199 | dev->ctrl_urb->transfer_buffer_length = size; | 193 | kfree(req); |
200 | usb_fill_control_urb(dev->ctrl_urb, dev->udev, | 194 | return res; |
201 | usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr, | 195 | } |
202 | &dev->rx_creg, size, ctrl_callback, dev); | 196 | req->rx_creg = cpu_to_le16(reg); |
203 | if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) { | 197 | req->dr.bRequestType = RTL8150_REQT_WRITE; |
204 | if (ret == -ENODEV) | 198 | req->dr.bRequest = RTL8150_REQ_SET_REGS; |
199 | req->dr.wIndex = 0; | ||
200 | req->dr.wValue = cpu_to_le16(indx); | ||
201 | req->dr.wLength = cpu_to_le16(size); | ||
202 | usb_fill_control_urb(async_urb, dev->udev, | ||
203 | usb_sndctrlpipe(dev->udev, 0), (void *)&req->dr, | ||
204 | &req->rx_creg, size, async_set_reg_cb, req); | ||
205 | res = usb_submit_urb(async_urb, GFP_ATOMIC); | ||
206 | if (res) { | ||
207 | if (res == -ENODEV) | ||
205 | netif_device_detach(dev->netdev); | 208 | netif_device_detach(dev->netdev); |
206 | dev_err(&dev->udev->dev, | 209 | dev_err(&dev->udev->dev, "%s failed with %d\n", __func__, res); |
207 | "control request submission failed: %d\n", ret); | 210 | } |
208 | } else | 211 | return res; |
209 | set_bit(RX_REG_SET, &dev->flags); | ||
210 | |||
211 | return ret; | ||
212 | } | 212 | } |
213 | 213 | ||
214 | static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg) | 214 | static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg) |
@@ -330,13 +330,6 @@ static int alloc_all_urbs(rtl8150_t * dev) | |||
330 | usb_free_urb(dev->tx_urb); | 330 | usb_free_urb(dev->tx_urb); |
331 | return 0; | 331 | return 0; |
332 | } | 332 | } |
333 | dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
334 | if (!dev->ctrl_urb) { | ||
335 | usb_free_urb(dev->rx_urb); | ||
336 | usb_free_urb(dev->tx_urb); | ||
337 | usb_free_urb(dev->intr_urb); | ||
338 | return 0; | ||
339 | } | ||
340 | 333 | ||
341 | return 1; | 334 | return 1; |
342 | } | 335 | } |
@@ -346,7 +339,6 @@ static void free_all_urbs(rtl8150_t * dev) | |||
346 | usb_free_urb(dev->rx_urb); | 339 | usb_free_urb(dev->rx_urb); |
347 | usb_free_urb(dev->tx_urb); | 340 | usb_free_urb(dev->tx_urb); |
348 | usb_free_urb(dev->intr_urb); | 341 | usb_free_urb(dev->intr_urb); |
349 | usb_free_urb(dev->ctrl_urb); | ||
350 | } | 342 | } |
351 | 343 | ||
352 | static void unlink_all_urbs(rtl8150_t * dev) | 344 | static void unlink_all_urbs(rtl8150_t * dev) |
@@ -354,7 +346,6 @@ static void unlink_all_urbs(rtl8150_t * dev) | |||
354 | usb_kill_urb(dev->rx_urb); | 346 | usb_kill_urb(dev->rx_urb); |
355 | usb_kill_urb(dev->tx_urb); | 347 | usb_kill_urb(dev->tx_urb); |
356 | usb_kill_urb(dev->intr_urb); | 348 | usb_kill_urb(dev->intr_urb); |
357 | usb_kill_urb(dev->ctrl_urb); | ||
358 | } | 349 | } |
359 | 350 | ||
360 | static inline struct sk_buff *pull_skb(rtl8150_t *dev) | 351 | static inline struct sk_buff *pull_skb(rtl8150_t *dev) |
@@ -629,7 +620,6 @@ static int enable_net_traffic(rtl8150_t * dev) | |||
629 | } | 620 | } |
630 | /* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */ | 621 | /* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */ |
631 | rcr = 0x9e; | 622 | rcr = 0x9e; |
632 | dev->rx_creg = cpu_to_le16(rcr); | ||
633 | tcr = 0xd8; | 623 | tcr = 0xd8; |
634 | cr = 0x0c; | 624 | cr = 0x0c; |
635 | if (!(rcr & 0x80)) | 625 | if (!(rcr & 0x80)) |
@@ -662,20 +652,22 @@ static void rtl8150_tx_timeout(struct net_device *netdev) | |||
662 | static void rtl8150_set_multicast(struct net_device *netdev) | 652 | static void rtl8150_set_multicast(struct net_device *netdev) |
663 | { | 653 | { |
664 | rtl8150_t *dev = netdev_priv(netdev); | 654 | rtl8150_t *dev = netdev_priv(netdev); |
655 | u16 rx_creg = 0x9e; | ||
656 | |||
665 | netif_stop_queue(netdev); | 657 | netif_stop_queue(netdev); |
666 | if (netdev->flags & IFF_PROMISC) { | 658 | if (netdev->flags & IFF_PROMISC) { |
667 | dev->rx_creg |= cpu_to_le16(0x0001); | 659 | rx_creg |= 0x0001; |
668 | dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name); | 660 | dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name); |
669 | } else if (!netdev_mc_empty(netdev) || | 661 | } else if (!netdev_mc_empty(netdev) || |
670 | (netdev->flags & IFF_ALLMULTI)) { | 662 | (netdev->flags & IFF_ALLMULTI)) { |
671 | dev->rx_creg &= cpu_to_le16(0xfffe); | 663 | rx_creg &= 0xfffe; |
672 | dev->rx_creg |= cpu_to_le16(0x0002); | 664 | rx_creg |= 0x0002; |
673 | dev_info(&netdev->dev, "%s: allmulti set\n", netdev->name); | 665 | dev_info(&netdev->dev, "%s: allmulti set\n", netdev->name); |
674 | } else { | 666 | } else { |
675 | /* ~RX_MULTICAST, ~RX_PROMISCUOUS */ | 667 | /* ~RX_MULTICAST, ~RX_PROMISCUOUS */ |
676 | dev->rx_creg &= cpu_to_le16(0x00fc); | 668 | rx_creg &= 0x00fc; |
677 | } | 669 | } |
678 | async_set_registers(dev, RCR, 2); | 670 | async_set_registers(dev, RCR, sizeof(rx_creg), rx_creg); |
679 | netif_wake_queue(netdev); | 671 | netif_wake_queue(netdev); |
680 | } | 672 | } |
681 | 673 | ||
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index f95cb032394b..06ee82f557d4 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1477,7 +1477,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1477 | 1477 | ||
1478 | /* usbnet already took usb runtime pm, so have to enable the feature | 1478 | /* usbnet already took usb runtime pm, so have to enable the feature |
1479 | * for usb interface, otherwise usb_autopm_get_interface may return | 1479 | * for usb interface, otherwise usb_autopm_get_interface may return |
1480 | * failure if USB_SUSPEND(RUNTIME_PM) is enabled. | 1480 | * failure if RUNTIME_PM is enabled. |
1481 | */ | 1481 | */ |
1482 | if (!driver->supports_autosuspend) { | 1482 | if (!driver->supports_autosuspend) { |
1483 | driver->supports_autosuspend = 1; | 1483 | driver->supports_autosuspend = 1; |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 3c23fdc27bf0..c9e00387d999 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/cpu.h> | 29 | #include <linux/cpu.h> |
30 | 30 | ||
31 | static int napi_weight = 128; | 31 | static int napi_weight = NAPI_POLL_WEIGHT; |
32 | module_param(napi_weight, int, 0444); | 32 | module_param(napi_weight, int, 0444); |
33 | 33 | ||
34 | static bool csum = true, gso = true; | 34 | static bool csum = true, gso = true; |
@@ -636,10 +636,11 @@ static int virtnet_open(struct net_device *dev) | |||
636 | struct virtnet_info *vi = netdev_priv(dev); | 636 | struct virtnet_info *vi = netdev_priv(dev); |
637 | int i; | 637 | int i; |
638 | 638 | ||
639 | for (i = 0; i < vi->curr_queue_pairs; i++) { | 639 | for (i = 0; i < vi->max_queue_pairs; i++) { |
640 | /* Make sure we have some buffers: if oom use wq. */ | 640 | if (i < vi->curr_queue_pairs) |
641 | if (!try_fill_recv(&vi->rq[i], GFP_KERNEL)) | 641 | /* Make sure we have some buffers: if oom use wq. */ |
642 | schedule_delayed_work(&vi->refill, 0); | 642 | if (!try_fill_recv(&vi->rq[i], GFP_KERNEL)) |
643 | schedule_delayed_work(&vi->refill, 0); | ||
643 | virtnet_napi_enable(&vi->rq[i]); | 644 | virtnet_napi_enable(&vi->rq[i]); |
644 | } | 645 | } |
645 | 646 | ||
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index ba81f3c39a83..3b1d2ee7156b 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -301,7 +301,7 @@ static inline struct hlist_head *vxlan_fdb_head(struct vxlan_dev *vxlan, | |||
301 | } | 301 | } |
302 | 302 | ||
303 | /* Look up Ethernet address in forwarding table */ | 303 | /* Look up Ethernet address in forwarding table */ |
304 | static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, | 304 | static struct vxlan_fdb *__vxlan_find_mac(struct vxlan_dev *vxlan, |
305 | const u8 *mac) | 305 | const u8 *mac) |
306 | 306 | ||
307 | { | 307 | { |
@@ -316,6 +316,18 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, | |||
316 | return NULL; | 316 | return NULL; |
317 | } | 317 | } |
318 | 318 | ||
319 | static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, | ||
320 | const u8 *mac) | ||
321 | { | ||
322 | struct vxlan_fdb *f; | ||
323 | |||
324 | f = __vxlan_find_mac(vxlan, mac); | ||
325 | if (f) | ||
326 | f->used = jiffies; | ||
327 | |||
328 | return f; | ||
329 | } | ||
330 | |||
319 | /* Add/update destinations for multicast */ | 331 | /* Add/update destinations for multicast */ |
320 | static int vxlan_fdb_append(struct vxlan_fdb *f, | 332 | static int vxlan_fdb_append(struct vxlan_fdb *f, |
321 | __be32 ip, __be16 port, __u32 vni, __u32 ifindex) | 333 | __be32 ip, __be16 port, __u32 vni, __u32 ifindex) |
@@ -353,7 +365,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan, | |||
353 | struct vxlan_fdb *f; | 365 | struct vxlan_fdb *f; |
354 | int notify = 0; | 366 | int notify = 0; |
355 | 367 | ||
356 | f = vxlan_find_mac(vxlan, mac); | 368 | f = __vxlan_find_mac(vxlan, mac); |
357 | if (f) { | 369 | if (f) { |
358 | if (flags & NLM_F_EXCL) { | 370 | if (flags & NLM_F_EXCL) { |
359 | netdev_dbg(vxlan->dev, | 371 | netdev_dbg(vxlan->dev, |
@@ -563,7 +575,6 @@ static void vxlan_snoop(struct net_device *dev, | |||
563 | 575 | ||
564 | f = vxlan_find_mac(vxlan, src_mac); | 576 | f = vxlan_find_mac(vxlan, src_mac); |
565 | if (likely(f)) { | 577 | if (likely(f)) { |
566 | f->used = jiffies; | ||
567 | if (likely(f->remote.remote_ip == src_ip)) | 578 | if (likely(f->remote.remote_ip == src_ip)) |
568 | return; | 579 | return; |
569 | 580 | ||
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 9b20d9ee2719..7f702fe3ecc2 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -2369,6 +2369,9 @@ ath5k_tx_complete_poll_work(struct work_struct *work) | |||
2369 | int i; | 2369 | int i; |
2370 | bool needreset = false; | 2370 | bool needreset = false; |
2371 | 2371 | ||
2372 | if (!test_bit(ATH_STAT_STARTED, ah->status)) | ||
2373 | return; | ||
2374 | |||
2372 | mutex_lock(&ah->lock); | 2375 | mutex_lock(&ah->lock); |
2373 | 2376 | ||
2374 | for (i = 0; i < ARRAY_SIZE(ah->txqs); i++) { | 2377 | for (i = 0; i < ARRAY_SIZE(ah->txqs); i++) { |
@@ -2676,6 +2679,7 @@ done: | |||
2676 | mmiowb(); | 2679 | mmiowb(); |
2677 | mutex_unlock(&ah->lock); | 2680 | mutex_unlock(&ah->lock); |
2678 | 2681 | ||
2682 | set_bit(ATH_STAT_STARTED, ah->status); | ||
2679 | ieee80211_queue_delayed_work(ah->hw, &ah->tx_complete_work, | 2683 | ieee80211_queue_delayed_work(ah->hw, &ah->tx_complete_work, |
2680 | msecs_to_jiffies(ATH5K_TX_COMPLETE_POLL_INT)); | 2684 | msecs_to_jiffies(ATH5K_TX_COMPLETE_POLL_INT)); |
2681 | 2685 | ||
@@ -2737,6 +2741,7 @@ void ath5k_stop(struct ieee80211_hw *hw) | |||
2737 | 2741 | ||
2738 | ath5k_stop_tasklets(ah); | 2742 | ath5k_stop_tasklets(ah); |
2739 | 2743 | ||
2744 | clear_bit(ATH_STAT_STARTED, ah->status); | ||
2740 | cancel_delayed_work_sync(&ah->tx_complete_work); | 2745 | cancel_delayed_work_sync(&ah->tx_complete_work); |
2741 | 2746 | ||
2742 | if (!ath5k_modparam_no_hw_rfkill_switch) | 2747 | if (!ath5k_modparam_no_hw_rfkill_switch) |
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig index 17507dc8a1e7..3c2cbc9d6295 100644 --- a/drivers/net/wireless/ath/ath9k/Kconfig +++ b/drivers/net/wireless/ath/ath9k/Kconfig | |||
@@ -17,7 +17,7 @@ config ATH9K_BTCOEX_SUPPORT | |||
17 | 17 | ||
18 | config ATH9K | 18 | config ATH9K |
19 | tristate "Atheros 802.11n wireless cards support" | 19 | tristate "Atheros 802.11n wireless cards support" |
20 | depends on MAC80211 | 20 | depends on MAC80211 && HAS_DMA |
21 | select ATH9K_HW | 21 | select ATH9K_HW |
22 | select MAC80211_LEDS | 22 | select MAC80211_LEDS |
23 | select LEDS_CLASS | 23 | select LEDS_CLASS |
@@ -92,13 +92,17 @@ config ATH9K_MAC_DEBUG | |||
92 | This option enables collection of statistics for Rx/Tx status | 92 | This option enables collection of statistics for Rx/Tx status |
93 | data and some other MAC related statistics | 93 | data and some other MAC related statistics |
94 | 94 | ||
95 | config ATH9K_RATE_CONTROL | 95 | config ATH9K_LEGACY_RATE_CONTROL |
96 | bool "Atheros ath9k rate control" | 96 | bool "Atheros ath9k rate control" |
97 | depends on ATH9K | 97 | depends on ATH9K |
98 | default y | 98 | default n |
99 | ---help--- | 99 | ---help--- |
100 | Say Y, if you want to use the ath9k specific rate control | 100 | Say Y, if you want to use the ath9k specific rate control |
101 | module instead of minstrel_ht. | 101 | module instead of minstrel_ht. Be warned that there are various |
102 | issues with the ath9k RC and minstrel is a more robust algorithm. | ||
103 | Note that even if this option is selected, "ath9k_rate_control" | ||
104 | has to be passed to mac80211 using the module parameter, | ||
105 | ieee80211_default_rc_algo. | ||
102 | 106 | ||
103 | config ATH9K_HTC | 107 | config ATH9K_HTC |
104 | tristate "Atheros HTC based wireless cards support" | 108 | tristate "Atheros HTC based wireless cards support" |
diff --git a/drivers/net/wireless/ath/ath9k/Makefile b/drivers/net/wireless/ath/ath9k/Makefile index 2ad8f9474ba1..75ee9e7704ce 100644 --- a/drivers/net/wireless/ath/ath9k/Makefile +++ b/drivers/net/wireless/ath/ath9k/Makefile | |||
@@ -8,7 +8,7 @@ ath9k-y += beacon.o \ | |||
8 | antenna.o | 8 | antenna.o |
9 | 9 | ||
10 | ath9k-$(CONFIG_ATH9K_BTCOEX_SUPPORT) += mci.o | 10 | ath9k-$(CONFIG_ATH9K_BTCOEX_SUPPORT) += mci.o |
11 | ath9k-$(CONFIG_ATH9K_RATE_CONTROL) += rc.o | 11 | ath9k-$(CONFIG_ATH9K_LEGACY_RATE_CONTROL) += rc.o |
12 | ath9k-$(CONFIG_ATH9K_PCI) += pci.o | 12 | ath9k-$(CONFIG_ATH9K_PCI) += pci.o |
13 | ath9k-$(CONFIG_ATH9K_AHB) += ahb.o | 13 | ath9k-$(CONFIG_ATH9K_AHB) += ahb.o |
14 | ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o | 14 | ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h index db5ffada2217..7546b9a7dcbf 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | |||
@@ -958,11 +958,11 @@ static const u32 ar9300Common_rx_gain_table_2p2[][2] = { | |||
958 | {0x0000a074, 0x00000000}, | 958 | {0x0000a074, 0x00000000}, |
959 | {0x0000a078, 0x00000000}, | 959 | {0x0000a078, 0x00000000}, |
960 | {0x0000a07c, 0x00000000}, | 960 | {0x0000a07c, 0x00000000}, |
961 | {0x0000a080, 0x1a1a1a1a}, | 961 | {0x0000a080, 0x22222229}, |
962 | {0x0000a084, 0x1a1a1a1a}, | 962 | {0x0000a084, 0x1d1d1d1d}, |
963 | {0x0000a088, 0x1a1a1a1a}, | 963 | {0x0000a088, 0x1d1d1d1d}, |
964 | {0x0000a08c, 0x1a1a1a1a}, | 964 | {0x0000a08c, 0x1d1d1d1d}, |
965 | {0x0000a090, 0x171a1a1a}, | 965 | {0x0000a090, 0x171d1d1d}, |
966 | {0x0000a094, 0x11111717}, | 966 | {0x0000a094, 0x11111717}, |
967 | {0x0000a098, 0x00030311}, | 967 | {0x0000a098, 0x00030311}, |
968 | {0x0000a09c, 0x00000000}, | 968 | {0x0000a09c, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 639ba7d18ea4..6988e1d081f2 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c | |||
@@ -965,7 +965,7 @@ static void ar9003_hw_do_manual_peak_cal(struct ath_hw *ah, | |||
965 | { | 965 | { |
966 | int i; | 966 | int i; |
967 | 967 | ||
968 | if (!AR_SREV_9462(ah) && !AR_SREV_9565(ah)) | 968 | if (!AR_SREV_9462(ah) && !AR_SREV_9565(ah) && !AR_SREV_9485(ah)) |
969 | return; | 969 | return; |
970 | 970 | ||
971 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { | 971 | for (i = 0; i < AR9300_MAX_CHAINS; i++) { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h index 54ba42f4108a..874f6570bd1c 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | |||
@@ -68,13 +68,16 @@ | |||
68 | #define AR9300_BASE_ADDR 0x3ff | 68 | #define AR9300_BASE_ADDR 0x3ff |
69 | #define AR9300_BASE_ADDR_512 0x1ff | 69 | #define AR9300_BASE_ADDR_512 0x1ff |
70 | 70 | ||
71 | #define AR9300_OTP_BASE (AR_SREV_9340(ah) ? 0x30000 : 0x14000) | 71 | #define AR9300_OTP_BASE \ |
72 | #define AR9300_OTP_STATUS (AR_SREV_9340(ah) ? 0x30018 : 0x15f18) | 72 | ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30000 : 0x14000) |
73 | #define AR9300_OTP_STATUS \ | ||
74 | ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30018 : 0x15f18) | ||
73 | #define AR9300_OTP_STATUS_TYPE 0x7 | 75 | #define AR9300_OTP_STATUS_TYPE 0x7 |
74 | #define AR9300_OTP_STATUS_VALID 0x4 | 76 | #define AR9300_OTP_STATUS_VALID 0x4 |
75 | #define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 | 77 | #define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 |
76 | #define AR9300_OTP_STATUS_SM_BUSY 0x1 | 78 | #define AR9300_OTP_STATUS_SM_BUSY 0x1 |
77 | #define AR9300_OTP_READ_DATA (AR_SREV_9340(ah) ? 0x3001c : 0x15f1c) | 79 | #define AR9300_OTP_READ_DATA \ |
80 | ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x3001c : 0x15f1c) | ||
78 | 81 | ||
79 | enum targetPowerHTRates { | 82 | enum targetPowerHTRates { |
80 | HT_TARGET_RATE_0_8_16, | 83 | HT_TARGET_RATE_0_8_16, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 2bf6548dd143..e1714d7c9eeb 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -334,7 +334,8 @@ static void ar9003_hw_spur_ofdm(struct ath_hw *ah, | |||
334 | REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, | 334 | REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, |
335 | AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI, 1); | 335 | AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI, 1); |
336 | 336 | ||
337 | if (REG_READ_FIELD(ah, AR_PHY_MODE, | 337 | if (!AR_SREV_9340(ah) && |
338 | REG_READ_FIELD(ah, AR_PHY_MODE, | ||
338 | AR_PHY_MODE_DYNAMIC) == 0x1) | 339 | AR_PHY_MODE_DYNAMIC) == 0x1) |
339 | REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, | 340 | REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, |
340 | AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT, 1); | 341 | AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT, 1); |
diff --git a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h index 712f415b8c08..88ff1d7b53ab 100644 --- a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h | |||
@@ -1020,7 +1020,7 @@ static const u32 ar9485_1_1_baseband_postamble[][5] = { | |||
1020 | {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0}, | 1020 | {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0}, |
1021 | {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1021 | {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1022 | {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1022 | {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1023 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, | 1023 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00058d18, 0x00058d18}, |
1024 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982}, | 1024 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982}, |
1025 | {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, | 1025 | {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, |
1026 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1026 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9565_1p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9565_1p0_initvals.h index 0c2ac0c6dc89..e85a8b076c22 100644 --- a/drivers/net/wireless/ath/ath9k/ar9565_1p0_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9565_1p0_initvals.h | |||
@@ -233,9 +233,9 @@ static const u32 ar9565_1p0_baseband_core[][2] = { | |||
233 | {0x00009d10, 0x01834061}, | 233 | {0x00009d10, 0x01834061}, |
234 | {0x00009d14, 0x00c00400}, | 234 | {0x00009d14, 0x00c00400}, |
235 | {0x00009d18, 0x00000000}, | 235 | {0x00009d18, 0x00000000}, |
236 | {0x00009e08, 0x0078230c}, | 236 | {0x00009e08, 0x0038230c}, |
237 | {0x00009e24, 0x990bb515}, | 237 | {0x00009e24, 0x9907b515}, |
238 | {0x00009e28, 0x126f0000}, | 238 | {0x00009e28, 0x126f0600}, |
239 | {0x00009e30, 0x06336f77}, | 239 | {0x00009e30, 0x06336f77}, |
240 | {0x00009e34, 0x6af6532f}, | 240 | {0x00009e34, 0x6af6532f}, |
241 | {0x00009e38, 0x0cc80c00}, | 241 | {0x00009e38, 0x0cc80c00}, |
@@ -337,7 +337,7 @@ static const u32 ar9565_1p0_baseband_core[][2] = { | |||
337 | 337 | ||
338 | static const u32 ar9565_1p0_baseband_postamble[][5] = { | 338 | static const u32 ar9565_1p0_baseband_postamble[][5] = { |
339 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 339 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
340 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a800d}, | 340 | {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8009}, |
341 | {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a01ae}, | 341 | {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a01ae}, |
342 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x63c640da}, | 342 | {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x63c640da}, |
343 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x09143c81}, | 343 | {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x09143c81}, |
@@ -345,9 +345,9 @@ static const u32 ar9565_1p0_baseband_postamble[][5] = { | |||
345 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, | 345 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, |
346 | {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, | 346 | {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, |
347 | {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0}, | 347 | {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0}, |
348 | {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, | 348 | {0x00009e04, 0x00802020, 0x00802020, 0x00142020, 0x00142020}, |
349 | {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000d8}, | 349 | {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, |
350 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec86d2e}, | 350 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, |
351 | {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e}, | 351 | {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e}, |
352 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 352 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
353 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, | 353 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, |
@@ -450,6 +450,8 @@ static const u32 ar9565_1p0_soc_postamble[][5] = { | |||
450 | 450 | ||
451 | static const u32 ar9565_1p0_Common_rx_gain_table[][2] = { | 451 | static const u32 ar9565_1p0_Common_rx_gain_table[][2] = { |
452 | /* Addr allmodes */ | 452 | /* Addr allmodes */ |
453 | {0x00004050, 0x00300300}, | ||
454 | {0x0000406c, 0x00100000}, | ||
453 | {0x0000a000, 0x00010000}, | 455 | {0x0000a000, 0x00010000}, |
454 | {0x0000a004, 0x00030002}, | 456 | {0x0000a004, 0x00030002}, |
455 | {0x0000a008, 0x00050004}, | 457 | {0x0000a008, 0x00050004}, |
@@ -498,27 +500,27 @@ static const u32 ar9565_1p0_Common_rx_gain_table[][2] = { | |||
498 | {0x0000a0b4, 0x00000000}, | 500 | {0x0000a0b4, 0x00000000}, |
499 | {0x0000a0b8, 0x00000000}, | 501 | {0x0000a0b8, 0x00000000}, |
500 | {0x0000a0bc, 0x00000000}, | 502 | {0x0000a0bc, 0x00000000}, |
501 | {0x0000a0c0, 0x001f0000}, | 503 | {0x0000a0c0, 0x00bf00a0}, |
502 | {0x0000a0c4, 0x01000101}, | 504 | {0x0000a0c4, 0x11a011a1}, |
503 | {0x0000a0c8, 0x011e011f}, | 505 | {0x0000a0c8, 0x11be11bf}, |
504 | {0x0000a0cc, 0x011c011d}, | 506 | {0x0000a0cc, 0x11bc11bd}, |
505 | {0x0000a0d0, 0x02030204}, | 507 | {0x0000a0d0, 0x22632264}, |
506 | {0x0000a0d4, 0x02010202}, | 508 | {0x0000a0d4, 0x22612262}, |
507 | {0x0000a0d8, 0x021f0200}, | 509 | {0x0000a0d8, 0x227f2260}, |
508 | {0x0000a0dc, 0x0302021e}, | 510 | {0x0000a0dc, 0x4322227e}, |
509 | {0x0000a0e0, 0x03000301}, | 511 | {0x0000a0e0, 0x43204321}, |
510 | {0x0000a0e4, 0x031e031f}, | 512 | {0x0000a0e4, 0x433e433f}, |
511 | {0x0000a0e8, 0x0402031d}, | 513 | {0x0000a0e8, 0x4462433d}, |
512 | {0x0000a0ec, 0x04000401}, | 514 | {0x0000a0ec, 0x44604461}, |
513 | {0x0000a0f0, 0x041e041f}, | 515 | {0x0000a0f0, 0x447e447f}, |
514 | {0x0000a0f4, 0x0502041d}, | 516 | {0x0000a0f4, 0x5582447d}, |
515 | {0x0000a0f8, 0x05000501}, | 517 | {0x0000a0f8, 0x55805581}, |
516 | {0x0000a0fc, 0x051e051f}, | 518 | {0x0000a0fc, 0x559e559f}, |
517 | {0x0000a100, 0x06010602}, | 519 | {0x0000a100, 0x66816682}, |
518 | {0x0000a104, 0x061f0600}, | 520 | {0x0000a104, 0x669f6680}, |
519 | {0x0000a108, 0x061d061e}, | 521 | {0x0000a108, 0x669d669e}, |
520 | {0x0000a10c, 0x07020703}, | 522 | {0x0000a10c, 0x77627763}, |
521 | {0x0000a110, 0x07000701}, | 523 | {0x0000a110, 0x77607761}, |
522 | {0x0000a114, 0x00000000}, | 524 | {0x0000a114, 0x00000000}, |
523 | {0x0000a118, 0x00000000}, | 525 | {0x0000a118, 0x00000000}, |
524 | {0x0000a11c, 0x00000000}, | 526 | {0x0000a11c, 0x00000000}, |
@@ -530,27 +532,27 @@ static const u32 ar9565_1p0_Common_rx_gain_table[][2] = { | |||
530 | {0x0000a134, 0x00000000}, | 532 | {0x0000a134, 0x00000000}, |
531 | {0x0000a138, 0x00000000}, | 533 | {0x0000a138, 0x00000000}, |
532 | {0x0000a13c, 0x00000000}, | 534 | {0x0000a13c, 0x00000000}, |
533 | {0x0000a140, 0x001f0000}, | 535 | {0x0000a140, 0x00bf00a0}, |
534 | {0x0000a144, 0x01000101}, | 536 | {0x0000a144, 0x11a011a1}, |
535 | {0x0000a148, 0x011e011f}, | 537 | {0x0000a148, 0x11be11bf}, |
536 | {0x0000a14c, 0x011c011d}, | 538 | {0x0000a14c, 0x11bc11bd}, |
537 | {0x0000a150, 0x02030204}, | 539 | {0x0000a150, 0x22632264}, |
538 | {0x0000a154, 0x02010202}, | 540 | {0x0000a154, 0x22612262}, |
539 | {0x0000a158, 0x021f0200}, | 541 | {0x0000a158, 0x227f2260}, |
540 | {0x0000a15c, 0x0302021e}, | 542 | {0x0000a15c, 0x4322227e}, |
541 | {0x0000a160, 0x03000301}, | 543 | {0x0000a160, 0x43204321}, |
542 | {0x0000a164, 0x031e031f}, | 544 | {0x0000a164, 0x433e433f}, |
543 | {0x0000a168, 0x0402031d}, | 545 | {0x0000a168, 0x4462433d}, |
544 | {0x0000a16c, 0x04000401}, | 546 | {0x0000a16c, 0x44604461}, |
545 | {0x0000a170, 0x041e041f}, | 547 | {0x0000a170, 0x447e447f}, |
546 | {0x0000a174, 0x0502041d}, | 548 | {0x0000a174, 0x5582447d}, |
547 | {0x0000a178, 0x05000501}, | 549 | {0x0000a178, 0x55805581}, |
548 | {0x0000a17c, 0x051e051f}, | 550 | {0x0000a17c, 0x559e559f}, |
549 | {0x0000a180, 0x06010602}, | 551 | {0x0000a180, 0x66816682}, |
550 | {0x0000a184, 0x061f0600}, | 552 | {0x0000a184, 0x669f6680}, |
551 | {0x0000a188, 0x061d061e}, | 553 | {0x0000a188, 0x669d669e}, |
552 | {0x0000a18c, 0x07020703}, | 554 | {0x0000a18c, 0x77e677e7}, |
553 | {0x0000a190, 0x07000701}, | 555 | {0x0000a190, 0x77e477e5}, |
554 | {0x0000a194, 0x00000000}, | 556 | {0x0000a194, 0x00000000}, |
555 | {0x0000a198, 0x00000000}, | 557 | {0x0000a198, 0x00000000}, |
556 | {0x0000a19c, 0x00000000}, | 558 | {0x0000a19c, 0x00000000}, |
@@ -770,7 +772,7 @@ static const u32 ar9565_1p0_Modes_lowest_ob_db_tx_gain_table[][5] = { | |||
770 | 772 | ||
771 | static const u32 ar9565_1p0_pciephy_clkreq_disable_L1[][2] = { | 773 | static const u32 ar9565_1p0_pciephy_clkreq_disable_L1[][2] = { |
772 | /* Addr allmodes */ | 774 | /* Addr allmodes */ |
773 | {0x00018c00, 0x18213ede}, | 775 | {0x00018c00, 0x18212ede}, |
774 | {0x00018c04, 0x000801d8}, | 776 | {0x00018c04, 0x000801d8}, |
775 | {0x00018c08, 0x0003780c}, | 777 | {0x00018c08, 0x0003780c}, |
776 | }; | 778 | }; |
@@ -889,8 +891,8 @@ static const u32 ar9565_1p0_common_wo_xlna_rx_gain_table[][2] = { | |||
889 | {0x0000a180, 0x66816682}, | 891 | {0x0000a180, 0x66816682}, |
890 | {0x0000a184, 0x669f6680}, | 892 | {0x0000a184, 0x669f6680}, |
891 | {0x0000a188, 0x669d669e}, | 893 | {0x0000a188, 0x669d669e}, |
892 | {0x0000a18c, 0x77627763}, | 894 | {0x0000a18c, 0x77e677e7}, |
893 | {0x0000a190, 0x77607761}, | 895 | {0x0000a190, 0x77e477e5}, |
894 | {0x0000a194, 0x00000000}, | 896 | {0x0000a194, 0x00000000}, |
895 | {0x0000a198, 0x00000000}, | 897 | {0x0000a198, 0x00000000}, |
896 | {0x0000a19c, 0x00000000}, | 898 | {0x0000a19c, 0x00000000}, |
@@ -1114,7 +1116,7 @@ static const u32 ar9565_1p0_modes_high_ob_db_tx_gain_table[][5] = { | |||
1114 | {0x0000a2e0, 0xffecec00, 0xffecec00, 0xfd339c84, 0xfd339c84}, | 1116 | {0x0000a2e0, 0xffecec00, 0xffecec00, 0xfd339c84, 0xfd339c84}, |
1115 | {0x0000a2e4, 0xfc0f0000, 0xfc0f0000, 0xfec3e000, 0xfec3e000}, | 1117 | {0x0000a2e4, 0xfc0f0000, 0xfc0f0000, 0xfec3e000, 0xfec3e000}, |
1116 | {0x0000a2e8, 0xfc100000, 0xfc100000, 0xfffc0000, 0xfffc0000}, | 1118 | {0x0000a2e8, 0xfc100000, 0xfc100000, 0xfffc0000, 0xfffc0000}, |
1117 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | 1119 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050df, 0x000050df}, |
1118 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | 1120 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
1119 | {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002}, | 1121 | {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002}, |
1120 | {0x0000a508, 0x0b022220, 0x0b022220, 0x08000004, 0x08000004}, | 1122 | {0x0000a508, 0x0b022220, 0x0b022220, 0x08000004, 0x08000004}, |
@@ -1140,13 +1142,13 @@ static const u32 ar9565_1p0_modes_high_ob_db_tx_gain_table[][5] = { | |||
1140 | {0x0000a558, 0x69027f56, 0x69027f56, 0x53001ce5, 0x53001ce5}, | 1142 | {0x0000a558, 0x69027f56, 0x69027f56, 0x53001ce5, 0x53001ce5}, |
1141 | {0x0000a55c, 0x6d029f56, 0x6d029f56, 0x57001ce9, 0x57001ce9}, | 1143 | {0x0000a55c, 0x6d029f56, 0x6d029f56, 0x57001ce9, 0x57001ce9}, |
1142 | {0x0000a560, 0x73049f56, 0x73049f56, 0x5b001ceb, 0x5b001ceb}, | 1144 | {0x0000a560, 0x73049f56, 0x73049f56, 0x5b001ceb, 0x5b001ceb}, |
1143 | {0x0000a564, 0x7804ff56, 0x7804ff56, 0x5d001eec, 0x5d001eec}, | 1145 | {0x0000a564, 0x7804ff56, 0x7804ff56, 0x60001cf0, 0x60001cf0}, |
1144 | {0x0000a568, 0x7804ff56, 0x7804ff56, 0x5d001eec, 0x5d001eec}, | 1146 | {0x0000a568, 0x7804ff56, 0x7804ff56, 0x61001cf1, 0x61001cf1}, |
1145 | {0x0000a56c, 0x7804ff56, 0x7804ff56, 0x5d001eec, 0x5d001eec}, | 1147 | {0x0000a56c, 0x7804ff56, 0x7804ff56, 0x62001cf2, 0x62001cf2}, |
1146 | {0x0000a570, 0x7804ff56, 0x7804ff56, 0x5d001eec, 0x5d001eec}, | 1148 | {0x0000a570, 0x7804ff56, 0x7804ff56, 0x63001cf3, 0x63001cf3}, |
1147 | {0x0000a574, 0x7804ff56, 0x7804ff56, 0x5d001eec, 0x5d001eec}, | 1149 | {0x0000a574, 0x7804ff56, 0x7804ff56, 0x64001cf4, 0x64001cf4}, |
1148 | {0x0000a578, 0x7804ff56, 0x7804ff56, 0x5d001eec, 0x5d001eec}, | 1150 | {0x0000a578, 0x7804ff56, 0x7804ff56, 0x66001ff6, 0x66001ff6}, |
1149 | {0x0000a57c, 0x7804ff56, 0x7804ff56, 0x5d001eec, 0x5d001eec}, | 1151 | {0x0000a57c, 0x7804ff56, 0x7804ff56, 0x66001ff6, 0x66001ff6}, |
1150 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1152 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1151 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1153 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1152 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1154 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
@@ -1174,7 +1176,7 @@ static const u32 ar9565_1p0_modes_high_power_tx_gain_table[][5] = { | |||
1174 | {0x0000a2e0, 0xffecec00, 0xffecec00, 0xfd339c84, 0xfd339c84}, | 1176 | {0x0000a2e0, 0xffecec00, 0xffecec00, 0xfd339c84, 0xfd339c84}, |
1175 | {0x0000a2e4, 0xfc0f0000, 0xfc0f0000, 0xfec3e000, 0xfec3e000}, | 1177 | {0x0000a2e4, 0xfc0f0000, 0xfc0f0000, 0xfec3e000, 0xfec3e000}, |
1176 | {0x0000a2e8, 0xfc100000, 0xfc100000, 0xfffc0000, 0xfffc0000}, | 1178 | {0x0000a2e8, 0xfc100000, 0xfc100000, 0xfffc0000, 0xfffc0000}, |
1177 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | 1179 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050df, 0x000050df}, |
1178 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | 1180 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
1179 | {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002}, | 1181 | {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002}, |
1180 | {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004}, | 1182 | {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004}, |
@@ -1200,13 +1202,13 @@ static const u32 ar9565_1p0_modes_high_power_tx_gain_table[][5] = { | |||
1200 | {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5}, | 1202 | {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5}, |
1201 | {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9}, | 1203 | {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9}, |
1202 | {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb}, | 1204 | {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb}, |
1203 | {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, | 1205 | {0x0000a564, 0x7504ff56, 0x7504ff56, 0x59001cf0, 0x59001cf0}, |
1204 | {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, | 1206 | {0x0000a568, 0x7504ff56, 0x7504ff56, 0x5a001cf1, 0x5a001cf1}, |
1205 | {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, | 1207 | {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x5b001cf2, 0x5b001cf2}, |
1206 | {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, | 1208 | {0x0000a570, 0x7504ff56, 0x7504ff56, 0x5c001cf3, 0x5c001cf3}, |
1207 | {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, | 1209 | {0x0000a574, 0x7504ff56, 0x7504ff56, 0x5d001cf4, 0x5d001cf4}, |
1208 | {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, | 1210 | {0x0000a578, 0x7504ff56, 0x7504ff56, 0x5f001ff6, 0x5f001ff6}, |
1209 | {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec}, | 1211 | {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x5f001ff6, 0x5f001ff6}, |
1210 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1212 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1211 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1213 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1212 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1214 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 8a1888d02070..42b03dc39d14 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -251,9 +251,9 @@ struct ath_atx_tid { | |||
251 | int tidno; | 251 | int tidno; |
252 | int baw_head; /* first un-acked tx buffer */ | 252 | int baw_head; /* first un-acked tx buffer */ |
253 | int baw_tail; /* next unused tx buffer slot */ | 253 | int baw_tail; /* next unused tx buffer slot */ |
254 | int sched; | 254 | bool sched; |
255 | int paused; | 255 | bool paused; |
256 | u8 state; | 256 | bool active; |
257 | }; | 257 | }; |
258 | 258 | ||
259 | struct ath_node { | 259 | struct ath_node { |
@@ -274,10 +274,6 @@ struct ath_node { | |||
274 | #endif | 274 | #endif |
275 | }; | 275 | }; |
276 | 276 | ||
277 | #define AGGR_CLEANUP BIT(1) | ||
278 | #define AGGR_ADDBA_COMPLETE BIT(2) | ||
279 | #define AGGR_ADDBA_PROGRESS BIT(3) | ||
280 | |||
281 | struct ath_tx_control { | 277 | struct ath_tx_control { |
282 | struct ath_txq *txq; | 278 | struct ath_txq *txq; |
283 | struct ath_node *an; | 279 | struct ath_node *an; |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index e6307b86363a..b37eb8d38811 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -2008,6 +2008,14 @@ void ath9k_get_et_stats(struct ieee80211_hw *hw, | |||
2008 | WARN_ON(i != ATH9K_SSTATS_LEN); | 2008 | WARN_ON(i != ATH9K_SSTATS_LEN); |
2009 | } | 2009 | } |
2010 | 2010 | ||
2011 | void ath9k_deinit_debug(struct ath_softc *sc) | ||
2012 | { | ||
2013 | if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) { | ||
2014 | relay_close(sc->rfs_chan_spec_scan); | ||
2015 | sc->rfs_chan_spec_scan = NULL; | ||
2016 | } | ||
2017 | } | ||
2018 | |||
2011 | int ath9k_init_debug(struct ath_hw *ah) | 2019 | int ath9k_init_debug(struct ath_hw *ah) |
2012 | { | 2020 | { |
2013 | struct ath_common *common = ath9k_hw_common(ah); | 2021 | struct ath_common *common = ath9k_hw_common(ah); |
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h index 794a7ec83a24..9d49aab8b989 100644 --- a/drivers/net/wireless/ath/ath9k/debug.h +++ b/drivers/net/wireless/ath/ath9k/debug.h | |||
@@ -304,6 +304,7 @@ struct ath9k_debug { | |||
304 | }; | 304 | }; |
305 | 305 | ||
306 | int ath9k_init_debug(struct ath_hw *ah); | 306 | int ath9k_init_debug(struct ath_hw *ah); |
307 | void ath9k_deinit_debug(struct ath_softc *sc); | ||
307 | 308 | ||
308 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); | 309 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); |
309 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, | 310 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, |
@@ -339,6 +340,10 @@ static inline int ath9k_init_debug(struct ath_hw *ah) | |||
339 | return 0; | 340 | return 0; |
340 | } | 341 | } |
341 | 342 | ||
343 | static inline void ath9k_deinit_debug(struct ath_softc *sc) | ||
344 | { | ||
345 | } | ||
346 | |||
342 | static inline void ath_debug_stat_interrupt(struct ath_softc *sc, | 347 | static inline void ath_debug_stat_interrupt(struct ath_softc *sc, |
343 | enum ath9k_int status) | 348 | enum ath9k_int status) |
344 | { | 349 | { |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 7f25da8444fe..15dfefcf2d0f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1172,6 +1172,7 @@ u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan) | |||
1172 | static inline void ath9k_hw_set_dma(struct ath_hw *ah) | 1172 | static inline void ath9k_hw_set_dma(struct ath_hw *ah) |
1173 | { | 1173 | { |
1174 | struct ath_common *common = ath9k_hw_common(ah); | 1174 | struct ath_common *common = ath9k_hw_common(ah); |
1175 | int txbuf_size; | ||
1175 | 1176 | ||
1176 | ENABLE_REGWRITE_BUFFER(ah); | 1177 | ENABLE_REGWRITE_BUFFER(ah); |
1177 | 1178 | ||
@@ -1225,13 +1226,17 @@ static inline void ath9k_hw_set_dma(struct ath_hw *ah) | |||
1225 | * So set the usable tx buf size also to half to | 1226 | * So set the usable tx buf size also to half to |
1226 | * avoid data/delimiter underruns | 1227 | * avoid data/delimiter underruns |
1227 | */ | 1228 | */ |
1228 | REG_WRITE(ah, AR_PCU_TXBUF_CTRL, | 1229 | txbuf_size = AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE; |
1229 | AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE); | 1230 | } else if (AR_SREV_9340_13_OR_LATER(ah)) { |
1230 | } else if (!AR_SREV_9271(ah)) { | 1231 | /* Uses fewer entries for AR934x v1.3+ to prevent rx overruns */ |
1231 | REG_WRITE(ah, AR_PCU_TXBUF_CTRL, | 1232 | txbuf_size = AR_9340_PCU_TXBUF_CTRL_USABLE_SIZE; |
1232 | AR_PCU_TXBUF_CTRL_USABLE_SIZE); | 1233 | } else { |
1234 | txbuf_size = AR_PCU_TXBUF_CTRL_USABLE_SIZE; | ||
1233 | } | 1235 | } |
1234 | 1236 | ||
1237 | if (!AR_SREV_9271(ah)) | ||
1238 | REG_WRITE(ah, AR_PCU_TXBUF_CTRL, txbuf_size); | ||
1239 | |||
1235 | REGWRITE_BUFFER_FLUSH(ah); | 1240 | REGWRITE_BUFFER_FLUSH(ah); |
1236 | 1241 | ||
1237 | if (AR_SREV_9300_20_OR_LATER(ah)) | 1242 | if (AR_SREV_9300_20_OR_LATER(ah)) |
@@ -1306,9 +1311,13 @@ static bool ath9k_hw_set_reset(struct ath_hw *ah, int type) | |||
1306 | AR_RTC_RC_COLD_RESET | AR_RTC_RC_WARM_RESET; | 1311 | AR_RTC_RC_COLD_RESET | AR_RTC_RC_WARM_RESET; |
1307 | } else { | 1312 | } else { |
1308 | tmpReg = REG_READ(ah, AR_INTR_SYNC_CAUSE); | 1313 | tmpReg = REG_READ(ah, AR_INTR_SYNC_CAUSE); |
1309 | if (tmpReg & | 1314 | if (AR_SREV_9340(ah)) |
1310 | (AR_INTR_SYNC_LOCAL_TIMEOUT | | 1315 | tmpReg &= AR9340_INTR_SYNC_LOCAL_TIMEOUT; |
1311 | AR_INTR_SYNC_RADM_CPL_TIMEOUT)) { | 1316 | else |
1317 | tmpReg &= AR_INTR_SYNC_LOCAL_TIMEOUT | | ||
1318 | AR_INTR_SYNC_RADM_CPL_TIMEOUT; | ||
1319 | |||
1320 | if (tmpReg) { | ||
1312 | u32 val; | 1321 | u32 val; |
1313 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0); | 1322 | REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0); |
1314 | 1323 | ||
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 0237b2868961..2ba494567777 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -787,8 +787,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
787 | hw->wiphy->iface_combinations = if_comb; | 787 | hw->wiphy->iface_combinations = if_comb; |
788 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); | 788 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); |
789 | 789 | ||
790 | if (AR_SREV_5416(sc->sc_ah)) | 790 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
791 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
792 | 791 | ||
793 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 792 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
794 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; | 793 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; |
@@ -830,10 +829,6 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
830 | sc->ant_rx = hw->wiphy->available_antennas_rx; | 829 | sc->ant_rx = hw->wiphy->available_antennas_rx; |
831 | sc->ant_tx = hw->wiphy->available_antennas_tx; | 830 | sc->ant_tx = hw->wiphy->available_antennas_tx; |
832 | 831 | ||
833 | #ifdef CONFIG_ATH9K_RATE_CONTROL | ||
834 | hw->rate_control_algorithm = "ath9k_rate_control"; | ||
835 | #endif | ||
836 | |||
837 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) | 832 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) |
838 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | 833 | hw->wiphy->bands[IEEE80211_BAND_2GHZ] = |
839 | &sc->sbands[IEEE80211_BAND_2GHZ]; | 834 | &sc->sbands[IEEE80211_BAND_2GHZ]; |
@@ -906,7 +901,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, | |||
906 | if (!ath_is_world_regd(reg)) { | 901 | if (!ath_is_world_regd(reg)) { |
907 | error = regulatory_hint(hw->wiphy, reg->alpha2); | 902 | error = regulatory_hint(hw->wiphy, reg->alpha2); |
908 | if (error) | 903 | if (error) |
909 | goto unregister; | 904 | goto debug_cleanup; |
910 | } | 905 | } |
911 | 906 | ||
912 | ath_init_leds(sc); | 907 | ath_init_leds(sc); |
@@ -914,6 +909,8 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, | |||
914 | 909 | ||
915 | return 0; | 910 | return 0; |
916 | 911 | ||
912 | debug_cleanup: | ||
913 | ath9k_deinit_debug(sc); | ||
917 | unregister: | 914 | unregister: |
918 | ieee80211_unregister_hw(hw); | 915 | ieee80211_unregister_hw(hw); |
919 | rx_cleanup: | 916 | rx_cleanup: |
@@ -942,11 +939,6 @@ static void ath9k_deinit_softc(struct ath_softc *sc) | |||
942 | sc->dfs_detector->exit(sc->dfs_detector); | 939 | sc->dfs_detector->exit(sc->dfs_detector); |
943 | 940 | ||
944 | ath9k_eeprom_release(sc); | 941 | ath9k_eeprom_release(sc); |
945 | |||
946 | if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) { | ||
947 | relay_close(sc->rfs_chan_spec_scan); | ||
948 | sc->rfs_chan_spec_scan = NULL; | ||
949 | } | ||
950 | } | 942 | } |
951 | 943 | ||
952 | void ath9k_deinit_device(struct ath_softc *sc) | 944 | void ath9k_deinit_device(struct ath_softc *sc) |
@@ -960,6 +952,7 @@ void ath9k_deinit_device(struct ath_softc *sc) | |||
960 | 952 | ||
961 | ath9k_ps_restore(sc); | 953 | ath9k_ps_restore(sc); |
962 | 954 | ||
955 | ath9k_deinit_debug(sc); | ||
963 | ieee80211_unregister_hw(hw); | 956 | ieee80211_unregister_hw(hw); |
964 | ath_rx_cleanup(sc); | 957 | ath_rx_cleanup(sc); |
965 | ath9k_deinit_softc(sc); | 958 | ath9k_deinit_softc(sc); |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 498fee04afa0..566109a40fb3 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -410,7 +410,7 @@ bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q) | |||
410 | 410 | ||
411 | REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ); | 411 | REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ); |
412 | 412 | ||
413 | if (AR_SREV_9340(ah)) | 413 | if (AR_SREV_9340(ah) && !AR_SREV_9340_13_OR_LATER(ah)) |
414 | REG_WRITE(ah, AR_DMISC(q), | 414 | REG_WRITE(ah, AR_DMISC(q), |
415 | AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x1); | 415 | AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x1); |
416 | else | 416 | else |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 6963862a1872..5092ecae7706 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -227,13 +227,13 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start) | |||
227 | if (!test_bit(SC_OP_BEACONS, &sc->sc_flags)) | 227 | if (!test_bit(SC_OP_BEACONS, &sc->sc_flags)) |
228 | goto work; | 228 | goto work; |
229 | 229 | ||
230 | ath9k_set_beacon(sc); | ||
231 | |||
232 | if (ah->opmode == NL80211_IFTYPE_STATION && | 230 | if (ah->opmode == NL80211_IFTYPE_STATION && |
233 | test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) { | 231 | test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) { |
234 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | 232 | spin_lock_irqsave(&sc->sc_pm_lock, flags); |
235 | sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; | 233 | sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; |
236 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | 234 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
235 | } else { | ||
236 | ath9k_set_beacon(sc); | ||
237 | } | 237 | } |
238 | work: | 238 | work: |
239 | ath_restart_work(sc); | 239 | ath_restart_work(sc); |
@@ -1332,6 +1332,7 @@ static int ath9k_sta_add(struct ieee80211_hw *hw, | |||
1332 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1332 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1333 | struct ath_node *an = (struct ath_node *) sta->drv_priv; | 1333 | struct ath_node *an = (struct ath_node *) sta->drv_priv; |
1334 | struct ieee80211_key_conf ps_key = { }; | 1334 | struct ieee80211_key_conf ps_key = { }; |
1335 | int key; | ||
1335 | 1336 | ||
1336 | ath_node_attach(sc, sta, vif); | 1337 | ath_node_attach(sc, sta, vif); |
1337 | 1338 | ||
@@ -1339,7 +1340,9 @@ static int ath9k_sta_add(struct ieee80211_hw *hw, | |||
1339 | vif->type != NL80211_IFTYPE_AP_VLAN) | 1340 | vif->type != NL80211_IFTYPE_AP_VLAN) |
1340 | return 0; | 1341 | return 0; |
1341 | 1342 | ||
1342 | an->ps_key = ath_key_config(common, vif, sta, &ps_key); | 1343 | key = ath_key_config(common, vif, sta, &ps_key); |
1344 | if (key > 0) | ||
1345 | an->ps_key = key; | ||
1343 | 1346 | ||
1344 | return 0; | 1347 | return 0; |
1345 | } | 1348 | } |
@@ -1356,6 +1359,7 @@ static void ath9k_del_ps_key(struct ath_softc *sc, | |||
1356 | return; | 1359 | return; |
1357 | 1360 | ||
1358 | ath_key_delete(common, &ps_key); | 1361 | ath_key_delete(common, &ps_key); |
1362 | an->ps_key = 0; | ||
1359 | } | 1363 | } |
1360 | 1364 | ||
1361 | static int ath9k_sta_remove(struct ieee80211_hw *hw, | 1365 | static int ath9k_sta_remove(struct ieee80211_hw *hw, |
@@ -1683,6 +1687,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
1683 | u16 tid, u16 *ssn, u8 buf_size) | 1687 | u16 tid, u16 *ssn, u8 buf_size) |
1684 | { | 1688 | { |
1685 | struct ath_softc *sc = hw->priv; | 1689 | struct ath_softc *sc = hw->priv; |
1690 | bool flush = false; | ||
1686 | int ret = 0; | 1691 | int ret = 0; |
1687 | 1692 | ||
1688 | local_bh_disable(); | 1693 | local_bh_disable(); |
@@ -1699,12 +1704,14 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
1699 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 1704 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
1700 | ath9k_ps_restore(sc); | 1705 | ath9k_ps_restore(sc); |
1701 | break; | 1706 | break; |
1702 | case IEEE80211_AMPDU_TX_STOP_CONT: | ||
1703 | case IEEE80211_AMPDU_TX_STOP_FLUSH: | 1707 | case IEEE80211_AMPDU_TX_STOP_FLUSH: |
1704 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: | 1708 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: |
1709 | flush = true; | ||
1710 | case IEEE80211_AMPDU_TX_STOP_CONT: | ||
1705 | ath9k_ps_wakeup(sc); | 1711 | ath9k_ps_wakeup(sc); |
1706 | ath_tx_aggr_stop(sc, sta, tid); | 1712 | ath_tx_aggr_stop(sc, sta, tid); |
1707 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 1713 | if (!flush) |
1714 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | ||
1708 | ath9k_ps_restore(sc); | 1715 | ath9k_ps_restore(sc); |
1709 | break; | 1716 | break; |
1710 | case IEEE80211_AMPDU_TX_OPERATIONAL: | 1717 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index aa4d368d8d3d..7eb1f4b458e4 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -1227,10 +1227,7 @@ static bool ath_tx_aggr_check(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1227 | return false; | 1227 | return false; |
1228 | 1228 | ||
1229 | txtid = ATH_AN_2_TID(an, tidno); | 1229 | txtid = ATH_AN_2_TID(an, tidno); |
1230 | 1230 | return !txtid->active; | |
1231 | if (!(txtid->state & (AGGR_ADDBA_COMPLETE | AGGR_ADDBA_PROGRESS))) | ||
1232 | return true; | ||
1233 | return false; | ||
1234 | } | 1231 | } |
1235 | 1232 | ||
1236 | 1233 | ||
diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h index 267dbfcfaa96..b9a87383cb43 100644 --- a/drivers/net/wireless/ath/ath9k/rc.h +++ b/drivers/net/wireless/ath/ath9k/rc.h | |||
@@ -231,7 +231,7 @@ static inline void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix, | |||
231 | } | 231 | } |
232 | #endif | 232 | #endif |
233 | 233 | ||
234 | #ifdef CONFIG_ATH9K_RATE_CONTROL | 234 | #ifdef CONFIG_ATH9K_LEGACY_RATE_CONTROL |
235 | int ath_rate_control_register(void); | 235 | int ath_rate_control_register(void); |
236 | void ath_rate_control_unregister(void); | 236 | void ath_rate_control_unregister(void); |
237 | #else | 237 | #else |
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index 5c4ab5026dca..f7c90cc58d56 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
@@ -798,6 +798,10 @@ | |||
798 | #define AR_SREV_REVISION_9485_10 0 | 798 | #define AR_SREV_REVISION_9485_10 0 |
799 | #define AR_SREV_REVISION_9485_11 1 | 799 | #define AR_SREV_REVISION_9485_11 1 |
800 | #define AR_SREV_VERSION_9340 0x300 | 800 | #define AR_SREV_VERSION_9340 0x300 |
801 | #define AR_SREV_REVISION_9340_10 0 | ||
802 | #define AR_SREV_REVISION_9340_11 1 | ||
803 | #define AR_SREV_REVISION_9340_12 2 | ||
804 | #define AR_SREV_REVISION_9340_13 3 | ||
801 | #define AR_SREV_VERSION_9580 0x1C0 | 805 | #define AR_SREV_VERSION_9580 0x1C0 |
802 | #define AR_SREV_REVISION_9580_10 4 /* AR9580 1.0 */ | 806 | #define AR_SREV_REVISION_9580_10 4 /* AR9580 1.0 */ |
803 | #define AR_SREV_VERSION_9462 0x280 | 807 | #define AR_SREV_VERSION_9462 0x280 |
@@ -897,6 +901,10 @@ | |||
897 | #define AR_SREV_9340(_ah) \ | 901 | #define AR_SREV_9340(_ah) \ |
898 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340)) | 902 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340)) |
899 | 903 | ||
904 | #define AR_SREV_9340_13_OR_LATER(_ah) \ | ||
905 | (AR_SREV_9340((_ah)) && \ | ||
906 | ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9340_13)) | ||
907 | |||
900 | #define AR_SREV_9285E_20(_ah) \ | 908 | #define AR_SREV_9285E_20(_ah) \ |
901 | (AR_SREV_9285_12_OR_LATER(_ah) && \ | 909 | (AR_SREV_9285_12_OR_LATER(_ah) && \ |
902 | ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) | 910 | ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) |
@@ -1007,6 +1015,8 @@ enum { | |||
1007 | AR_INTR_SYNC_LOCAL_TIMEOUT | | 1015 | AR_INTR_SYNC_LOCAL_TIMEOUT | |
1008 | AR_INTR_SYNC_MAC_SLEEP_ACCESS), | 1016 | AR_INTR_SYNC_MAC_SLEEP_ACCESS), |
1009 | 1017 | ||
1018 | AR9340_INTR_SYNC_LOCAL_TIMEOUT = 0x00000010, | ||
1019 | |||
1010 | AR_INTR_SYNC_SPURIOUS = 0xFFFFFFFF, | 1020 | AR_INTR_SYNC_SPURIOUS = 0xFFFFFFFF, |
1011 | 1021 | ||
1012 | }; | 1022 | }; |
@@ -1881,6 +1891,7 @@ enum { | |||
1881 | #define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF | 1891 | #define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF |
1882 | #define AR_PCU_TXBUF_CTRL_USABLE_SIZE 0x700 | 1892 | #define AR_PCU_TXBUF_CTRL_USABLE_SIZE 0x700 |
1883 | #define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE 0x380 | 1893 | #define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE 0x380 |
1894 | #define AR_9340_PCU_TXBUF_CTRL_USABLE_SIZE 0x500 | ||
1884 | 1895 | ||
1885 | #define AR_PCU_MISC_MODE2 0x8344 | 1896 | #define AR_PCU_MISC_MODE2 0x8344 |
1886 | #define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 | 1897 | #define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index eab0fcb7ded6..1c9b1bac8b0d 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -125,24 +125,6 @@ static void ath_tx_queue_tid(struct ath_txq *txq, struct ath_atx_tid *tid) | |||
125 | list_add_tail(&ac->list, &txq->axq_acq); | 125 | list_add_tail(&ac->list, &txq->axq_acq); |
126 | } | 126 | } |
127 | 127 | ||
128 | static void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | ||
129 | { | ||
130 | struct ath_txq *txq = tid->ac->txq; | ||
131 | |||
132 | WARN_ON(!tid->paused); | ||
133 | |||
134 | ath_txq_lock(sc, txq); | ||
135 | tid->paused = false; | ||
136 | |||
137 | if (skb_queue_empty(&tid->buf_q)) | ||
138 | goto unlock; | ||
139 | |||
140 | ath_tx_queue_tid(txq, tid); | ||
141 | ath_txq_schedule(sc, txq); | ||
142 | unlock: | ||
143 | ath_txq_unlock_complete(sc, txq); | ||
144 | } | ||
145 | |||
146 | static struct ath_frame_info *get_frame_info(struct sk_buff *skb) | 128 | static struct ath_frame_info *get_frame_info(struct sk_buff *skb) |
147 | { | 129 | { |
148 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 130 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
@@ -201,11 +183,6 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | |||
201 | } | 183 | } |
202 | } | 184 | } |
203 | 185 | ||
204 | if (tid->baw_head == tid->baw_tail) { | ||
205 | tid->state &= ~AGGR_ADDBA_COMPLETE; | ||
206 | tid->state &= ~AGGR_CLEANUP; | ||
207 | } | ||
208 | |||
209 | if (sendbar) { | 186 | if (sendbar) { |
210 | ath_txq_unlock(sc, txq); | 187 | ath_txq_unlock(sc, txq); |
211 | ath_send_bar(tid, tid->seq_start); | 188 | ath_send_bar(tid, tid->seq_start); |
@@ -277,9 +254,7 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq, | |||
277 | 254 | ||
278 | list_add_tail(&bf->list, &bf_head); | 255 | list_add_tail(&bf->list, &bf_head); |
279 | 256 | ||
280 | if (fi->retries) | 257 | ath_tx_update_baw(sc, tid, bf->bf_state.seqno); |
281 | ath_tx_update_baw(sc, tid, bf->bf_state.seqno); | ||
282 | |||
283 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); | 258 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); |
284 | } | 259 | } |
285 | 260 | ||
@@ -491,19 +466,19 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
491 | tx_info = IEEE80211_SKB_CB(skb); | 466 | tx_info = IEEE80211_SKB_CB(skb); |
492 | fi = get_frame_info(skb); | 467 | fi = get_frame_info(skb); |
493 | 468 | ||
494 | if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, seqno))) { | 469 | if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) { |
470 | /* | ||
471 | * Outside of the current BlockAck window, | ||
472 | * maybe part of a previous session | ||
473 | */ | ||
474 | txfail = 1; | ||
475 | } else if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, seqno))) { | ||
495 | /* transmit completion, subframe is | 476 | /* transmit completion, subframe is |
496 | * acked by block ack */ | 477 | * acked by block ack */ |
497 | acked_cnt++; | 478 | acked_cnt++; |
498 | } else if (!isaggr && txok) { | 479 | } else if (!isaggr && txok) { |
499 | /* transmit completion */ | 480 | /* transmit completion */ |
500 | acked_cnt++; | 481 | acked_cnt++; |
501 | } else if (tid->state & AGGR_CLEANUP) { | ||
502 | /* | ||
503 | * cleanup in progress, just fail | ||
504 | * the un-acked sub-frames | ||
505 | */ | ||
506 | txfail = 1; | ||
507 | } else if (flush) { | 482 | } else if (flush) { |
508 | txpending = 1; | 483 | txpending = 1; |
509 | } else if (fi->retries < ATH_MAX_SW_RETRIES) { | 484 | } else if (fi->retries < ATH_MAX_SW_RETRIES) { |
@@ -527,7 +502,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
527 | if (bf_next != NULL || !bf_last->bf_stale) | 502 | if (bf_next != NULL || !bf_last->bf_stale) |
528 | list_move_tail(&bf->list, &bf_head); | 503 | list_move_tail(&bf->list, &bf_head); |
529 | 504 | ||
530 | if (!txpending || (tid->state & AGGR_CLEANUP)) { | 505 | if (!txpending) { |
531 | /* | 506 | /* |
532 | * complete the acked-ones/xretried ones; update | 507 | * complete the acked-ones/xretried ones; update |
533 | * block-ack window | 508 | * block-ack window |
@@ -601,9 +576,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
601 | ath_txq_lock(sc, txq); | 576 | ath_txq_lock(sc, txq); |
602 | } | 577 | } |
603 | 578 | ||
604 | if (tid->state & AGGR_CLEANUP) | ||
605 | ath_tx_flush_tid(sc, tid); | ||
606 | |||
607 | rcu_read_unlock(); | 579 | rcu_read_unlock(); |
608 | 580 | ||
609 | if (needreset) | 581 | if (needreset) |
@@ -620,6 +592,7 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, | |||
620 | struct ath_tx_status *ts, struct ath_buf *bf, | 592 | struct ath_tx_status *ts, struct ath_buf *bf, |
621 | struct list_head *bf_head) | 593 | struct list_head *bf_head) |
622 | { | 594 | { |
595 | struct ieee80211_tx_info *info; | ||
623 | bool txok, flush; | 596 | bool txok, flush; |
624 | 597 | ||
625 | txok = !(ts->ts_status & ATH9K_TXERR_MASK); | 598 | txok = !(ts->ts_status & ATH9K_TXERR_MASK); |
@@ -631,8 +604,12 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, | |||
631 | txq->axq_ampdu_depth--; | 604 | txq->axq_ampdu_depth--; |
632 | 605 | ||
633 | if (!bf_isampdu(bf)) { | 606 | if (!bf_isampdu(bf)) { |
634 | if (!flush) | 607 | if (!flush) { |
608 | info = IEEE80211_SKB_CB(bf->bf_mpdu); | ||
609 | memcpy(info->control.rates, bf->rates, | ||
610 | sizeof(info->control.rates)); | ||
635 | ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); | 611 | ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); |
612 | } | ||
636 | ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok); | 613 | ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok); |
637 | } else | 614 | } else |
638 | ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok); | 615 | ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok); |
@@ -676,7 +653,7 @@ static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf, | |||
676 | 653 | ||
677 | skb = bf->bf_mpdu; | 654 | skb = bf->bf_mpdu; |
678 | tx_info = IEEE80211_SKB_CB(skb); | 655 | tx_info = IEEE80211_SKB_CB(skb); |
679 | rates = tx_info->control.rates; | 656 | rates = bf->rates; |
680 | 657 | ||
681 | /* | 658 | /* |
682 | * Find the lowest frame length among the rate series that will have a | 659 | * Find the lowest frame length among the rate series that will have a |
@@ -1231,9 +1208,6 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1231 | an = (struct ath_node *)sta->drv_priv; | 1208 | an = (struct ath_node *)sta->drv_priv; |
1232 | txtid = ATH_AN_2_TID(an, tid); | 1209 | txtid = ATH_AN_2_TID(an, tid); |
1233 | 1210 | ||
1234 | if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE)) | ||
1235 | return -EAGAIN; | ||
1236 | |||
1237 | /* update ampdu factor/density, they may have changed. This may happen | 1211 | /* update ampdu factor/density, they may have changed. This may happen |
1238 | * in HT IBSS when a beacon with HT-info is received after the station | 1212 | * in HT IBSS when a beacon with HT-info is received after the station |
1239 | * has already been added. | 1213 | * has already been added. |
@@ -1245,7 +1219,7 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1245 | an->mpdudensity = density; | 1219 | an->mpdudensity = density; |
1246 | } | 1220 | } |
1247 | 1221 | ||
1248 | txtid->state |= AGGR_ADDBA_PROGRESS; | 1222 | txtid->active = true; |
1249 | txtid->paused = true; | 1223 | txtid->paused = true; |
1250 | *ssn = txtid->seq_start = txtid->seq_next; | 1224 | *ssn = txtid->seq_start = txtid->seq_next; |
1251 | txtid->bar_index = -1; | 1225 | txtid->bar_index = -1; |
@@ -1262,28 +1236,9 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) | |||
1262 | struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); | 1236 | struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); |
1263 | struct ath_txq *txq = txtid->ac->txq; | 1237 | struct ath_txq *txq = txtid->ac->txq; |
1264 | 1238 | ||
1265 | if (txtid->state & AGGR_CLEANUP) | ||
1266 | return; | ||
1267 | |||
1268 | if (!(txtid->state & AGGR_ADDBA_COMPLETE)) { | ||
1269 | txtid->state &= ~AGGR_ADDBA_PROGRESS; | ||
1270 | return; | ||
1271 | } | ||
1272 | |||
1273 | ath_txq_lock(sc, txq); | 1239 | ath_txq_lock(sc, txq); |
1240 | txtid->active = false; | ||
1274 | txtid->paused = true; | 1241 | txtid->paused = true; |
1275 | |||
1276 | /* | ||
1277 | * If frames are still being transmitted for this TID, they will be | ||
1278 | * cleaned up during tx completion. To prevent race conditions, this | ||
1279 | * TID can only be reused after all in-progress subframes have been | ||
1280 | * completed. | ||
1281 | */ | ||
1282 | if (txtid->baw_head != txtid->baw_tail) | ||
1283 | txtid->state |= AGGR_CLEANUP; | ||
1284 | else | ||
1285 | txtid->state &= ~AGGR_ADDBA_COMPLETE; | ||
1286 | |||
1287 | ath_tx_flush_tid(sc, txtid); | 1242 | ath_tx_flush_tid(sc, txtid); |
1288 | ath_txq_unlock_complete(sc, txq); | 1243 | ath_txq_unlock_complete(sc, txq); |
1289 | } | 1244 | } |
@@ -1349,18 +1304,28 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an) | |||
1349 | } | 1304 | } |
1350 | } | 1305 | } |
1351 | 1306 | ||
1352 | void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) | 1307 | void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, |
1308 | u16 tidno) | ||
1353 | { | 1309 | { |
1354 | struct ath_atx_tid *txtid; | 1310 | struct ath_atx_tid *tid; |
1355 | struct ath_node *an; | 1311 | struct ath_node *an; |
1312 | struct ath_txq *txq; | ||
1356 | 1313 | ||
1357 | an = (struct ath_node *)sta->drv_priv; | 1314 | an = (struct ath_node *)sta->drv_priv; |
1315 | tid = ATH_AN_2_TID(an, tidno); | ||
1316 | txq = tid->ac->txq; | ||
1358 | 1317 | ||
1359 | txtid = ATH_AN_2_TID(an, tid); | 1318 | ath_txq_lock(sc, txq); |
1360 | txtid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; | 1319 | |
1361 | txtid->state |= AGGR_ADDBA_COMPLETE; | 1320 | tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; |
1362 | txtid->state &= ~AGGR_ADDBA_PROGRESS; | 1321 | tid->paused = false; |
1363 | ath_tx_resume_tid(sc, txtid); | 1322 | |
1323 | if (!skb_queue_empty(&tid->buf_q)) { | ||
1324 | ath_tx_queue_tid(txq, tid); | ||
1325 | ath_txq_schedule(sc, txq); | ||
1326 | } | ||
1327 | |||
1328 | ath_txq_unlock_complete(sc, txq); | ||
1364 | } | 1329 | } |
1365 | 1330 | ||
1366 | /********************/ | 1331 | /********************/ |
@@ -2409,12 +2374,10 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an) | |||
2409 | tid->baw_head = tid->baw_tail = 0; | 2374 | tid->baw_head = tid->baw_tail = 0; |
2410 | tid->sched = false; | 2375 | tid->sched = false; |
2411 | tid->paused = false; | 2376 | tid->paused = false; |
2412 | tid->state &= ~AGGR_CLEANUP; | 2377 | tid->active = false; |
2413 | __skb_queue_head_init(&tid->buf_q); | 2378 | __skb_queue_head_init(&tid->buf_q); |
2414 | acno = TID_TO_WME_AC(tidno); | 2379 | acno = TID_TO_WME_AC(tidno); |
2415 | tid->ac = &an->ac[acno]; | 2380 | tid->ac = &an->ac[acno]; |
2416 | tid->state &= ~AGGR_ADDBA_COMPLETE; | ||
2417 | tid->state &= ~AGGR_ADDBA_PROGRESS; | ||
2418 | } | 2381 | } |
2419 | 2382 | ||
2420 | for (acno = 0, ac = &an->ac[acno]; | 2383 | for (acno = 0, ac = &an->ac[acno]; |
@@ -2451,8 +2414,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an) | |||
2451 | } | 2414 | } |
2452 | 2415 | ||
2453 | ath_tid_drain(sc, txq, tid); | 2416 | ath_tid_drain(sc, txq, tid); |
2454 | tid->state &= ~AGGR_ADDBA_COMPLETE; | 2417 | tid->active = false; |
2455 | tid->state &= ~AGGR_CLEANUP; | ||
2456 | 2418 | ||
2457 | ath_txq_unlock(sc, txq); | 2419 | ath_txq_unlock(sc, txq); |
2458 | } | 2420 | } |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 830bb1d1f957..b827d51c30a3 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -1624,7 +1624,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | |||
1624 | 1624 | ||
1625 | netif_carrier_off(dev); | 1625 | netif_carrier_off(dev); |
1626 | 1626 | ||
1627 | if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)); | 1627 | if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)) |
1628 | printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); | 1628 | printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); |
1629 | 1629 | ||
1630 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", | 1630 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", |
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 523355b87659..f7c70b3a6ea9 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -1728,6 +1728,25 @@ drop_recycle_buffer: | |||
1728 | sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); | 1728 | sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); |
1729 | } | 1729 | } |
1730 | 1730 | ||
1731 | void b43_dma_handle_rx_overflow(struct b43_dmaring *ring) | ||
1732 | { | ||
1733 | int current_slot, previous_slot; | ||
1734 | |||
1735 | B43_WARN_ON(ring->tx); | ||
1736 | |||
1737 | /* Device has filled all buffers, drop all packets and let TCP | ||
1738 | * decrease speed. | ||
1739 | * Decrement RX index by one will let the device to see all slots | ||
1740 | * as free again | ||
1741 | */ | ||
1742 | /* | ||
1743 | *TODO: How to increase rx_drop in mac80211? | ||
1744 | */ | ||
1745 | current_slot = ring->ops->get_current_rxslot(ring); | ||
1746 | previous_slot = prev_slot(ring, current_slot); | ||
1747 | ring->ops->set_current_rxslot(ring, previous_slot); | ||
1748 | } | ||
1749 | |||
1731 | void b43_dma_rx(struct b43_dmaring *ring) | 1750 | void b43_dma_rx(struct b43_dmaring *ring) |
1732 | { | 1751 | { |
1733 | const struct b43_dma_ops *ops = ring->ops; | 1752 | const struct b43_dma_ops *ops = ring->ops; |
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h index 9fdd1983079c..df8c8cdcbdb5 100644 --- a/drivers/net/wireless/b43/dma.h +++ b/drivers/net/wireless/b43/dma.h | |||
@@ -9,7 +9,7 @@ | |||
9 | /* DMA-Interrupt reasons. */ | 9 | /* DMA-Interrupt reasons. */ |
10 | #define B43_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \ | 10 | #define B43_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \ |
11 | | (1 << 14) | (1 << 15)) | 11 | | (1 << 14) | (1 << 15)) |
12 | #define B43_DMAIRQ_NONFATALMASK (1 << 13) | 12 | #define B43_DMAIRQ_RDESC_UFLOW (1 << 13) |
13 | #define B43_DMAIRQ_RX_DONE (1 << 16) | 13 | #define B43_DMAIRQ_RX_DONE (1 << 16) |
14 | 14 | ||
15 | /*** 32-bit DMA Engine. ***/ | 15 | /*** 32-bit DMA Engine. ***/ |
@@ -295,6 +295,8 @@ int b43_dma_tx(struct b43_wldev *dev, | |||
295 | void b43_dma_handle_txstatus(struct b43_wldev *dev, | 295 | void b43_dma_handle_txstatus(struct b43_wldev *dev, |
296 | const struct b43_txstatus *status); | 296 | const struct b43_txstatus *status); |
297 | 297 | ||
298 | void b43_dma_handle_rx_overflow(struct b43_dmaring *ring); | ||
299 | |||
298 | void b43_dma_rx(struct b43_dmaring *ring); | 300 | void b43_dma_rx(struct b43_dmaring *ring); |
299 | 301 | ||
300 | void b43_dma_direct_fifo_rx(struct b43_wldev *dev, | 302 | void b43_dma_direct_fifo_rx(struct b43_wldev *dev, |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index d377f77d30b5..a95b77ab360e 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -1902,30 +1902,18 @@ static void b43_do_interrupt_thread(struct b43_wldev *dev) | |||
1902 | } | 1902 | } |
1903 | } | 1903 | } |
1904 | 1904 | ||
1905 | if (unlikely(merged_dma_reason & (B43_DMAIRQ_FATALMASK | | 1905 | if (unlikely(merged_dma_reason & (B43_DMAIRQ_FATALMASK))) { |
1906 | B43_DMAIRQ_NONFATALMASK))) { | 1906 | b43err(dev->wl, |
1907 | if (merged_dma_reason & B43_DMAIRQ_FATALMASK) { | 1907 | "Fatal DMA error: 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X\n", |
1908 | b43err(dev->wl, "Fatal DMA error: " | 1908 | dma_reason[0], dma_reason[1], |
1909 | "0x%08X, 0x%08X, 0x%08X, " | 1909 | dma_reason[2], dma_reason[3], |
1910 | "0x%08X, 0x%08X, 0x%08X\n", | 1910 | dma_reason[4], dma_reason[5]); |
1911 | dma_reason[0], dma_reason[1], | 1911 | b43err(dev->wl, "This device does not support DMA " |
1912 | dma_reason[2], dma_reason[3], | ||
1913 | dma_reason[4], dma_reason[5]); | ||
1914 | b43err(dev->wl, "This device does not support DMA " | ||
1915 | "on your system. It will now be switched to PIO.\n"); | 1912 | "on your system. It will now be switched to PIO.\n"); |
1916 | /* Fall back to PIO transfers if we get fatal DMA errors! */ | 1913 | /* Fall back to PIO transfers if we get fatal DMA errors! */ |
1917 | dev->use_pio = true; | 1914 | dev->use_pio = true; |
1918 | b43_controller_restart(dev, "DMA error"); | 1915 | b43_controller_restart(dev, "DMA error"); |
1919 | return; | 1916 | return; |
1920 | } | ||
1921 | if (merged_dma_reason & B43_DMAIRQ_NONFATALMASK) { | ||
1922 | b43err(dev->wl, "DMA error: " | ||
1923 | "0x%08X, 0x%08X, 0x%08X, " | ||
1924 | "0x%08X, 0x%08X, 0x%08X\n", | ||
1925 | dma_reason[0], dma_reason[1], | ||
1926 | dma_reason[2], dma_reason[3], | ||
1927 | dma_reason[4], dma_reason[5]); | ||
1928 | } | ||
1929 | } | 1917 | } |
1930 | 1918 | ||
1931 | if (unlikely(reason & B43_IRQ_UCODE_DEBUG)) | 1919 | if (unlikely(reason & B43_IRQ_UCODE_DEBUG)) |
@@ -1944,6 +1932,11 @@ static void b43_do_interrupt_thread(struct b43_wldev *dev) | |||
1944 | handle_irq_noise(dev); | 1932 | handle_irq_noise(dev); |
1945 | 1933 | ||
1946 | /* Check the DMA reason registers for received data. */ | 1934 | /* Check the DMA reason registers for received data. */ |
1935 | if (dma_reason[0] & B43_DMAIRQ_RDESC_UFLOW) { | ||
1936 | if (B43_DEBUG) | ||
1937 | b43warn(dev->wl, "RX descriptor underrun\n"); | ||
1938 | b43_dma_handle_rx_overflow(dev->dma.rx_ring); | ||
1939 | } | ||
1947 | if (dma_reason[0] & B43_DMAIRQ_RX_DONE) { | 1940 | if (dma_reason[0] & B43_DMAIRQ_RX_DONE) { |
1948 | if (b43_using_pio_transfers(dev)) | 1941 | if (b43_using_pio_transfers(dev)) |
1949 | b43_pio_rx(dev->pio.rx_queue); | 1942 | b43_pio_rx(dev->pio.rx_queue); |
@@ -2001,7 +1994,7 @@ static irqreturn_t b43_do_interrupt(struct b43_wldev *dev) | |||
2001 | return IRQ_NONE; | 1994 | return IRQ_NONE; |
2002 | 1995 | ||
2003 | dev->dma_reason[0] = b43_read32(dev, B43_MMIO_DMA0_REASON) | 1996 | dev->dma_reason[0] = b43_read32(dev, B43_MMIO_DMA0_REASON) |
2004 | & 0x0001DC00; | 1997 | & 0x0001FC00; |
2005 | dev->dma_reason[1] = b43_read32(dev, B43_MMIO_DMA1_REASON) | 1998 | dev->dma_reason[1] = b43_read32(dev, B43_MMIO_DMA1_REASON) |
2006 | & 0x0000DC00; | 1999 | & 0x0000DC00; |
2007 | dev->dma_reason[2] = b43_read32(dev, B43_MMIO_DMA2_REASON) | 2000 | dev->dma_reason[2] = b43_read32(dev, B43_MMIO_DMA2_REASON) |
@@ -2465,7 +2458,7 @@ static void b43_request_firmware(struct work_struct *work) | |||
2465 | for (i = 0; i < B43_NR_FWTYPES; i++) { | 2458 | for (i = 0; i < B43_NR_FWTYPES; i++) { |
2466 | errmsg = ctx->errors[i]; | 2459 | errmsg = ctx->errors[i]; |
2467 | if (strlen(errmsg)) | 2460 | if (strlen(errmsg)) |
2468 | b43err(dev->wl, errmsg); | 2461 | b43err(dev->wl, "%s", errmsg); |
2469 | } | 2462 | } |
2470 | b43_print_fw_helptext(dev->wl, 1); | 2463 | b43_print_fw_helptext(dev->wl, 1); |
2471 | goto out; | 2464 | goto out; |
@@ -3130,7 +3123,7 @@ static int b43_chip_init(struct b43_wldev *dev) | |||
3130 | b43_write32(dev, 0x018C, 0x02000000); | 3123 | b43_write32(dev, 0x018C, 0x02000000); |
3131 | } | 3124 | } |
3132 | b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, 0x00004000); | 3125 | b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, 0x00004000); |
3133 | b43_write32(dev, B43_MMIO_DMA0_IRQ_MASK, 0x0001DC00); | 3126 | b43_write32(dev, B43_MMIO_DMA0_IRQ_MASK, 0x0001FC00); |
3134 | b43_write32(dev, B43_MMIO_DMA1_IRQ_MASK, 0x0000DC00); | 3127 | b43_write32(dev, B43_MMIO_DMA1_IRQ_MASK, 0x0000DC00); |
3135 | b43_write32(dev, B43_MMIO_DMA2_IRQ_MASK, 0x0000DC00); | 3128 | b43_write32(dev, B43_MMIO_DMA2_IRQ_MASK, 0x0000DC00); |
3136 | b43_write32(dev, B43_MMIO_DMA3_IRQ_MASK, 0x0001DC00); | 3129 | b43_write32(dev, B43_MMIO_DMA3_IRQ_MASK, 0x0001DC00); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c index be0787cab24f..9431af2465f3 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "tracepoint.h" | 27 | #include "tracepoint.h" |
28 | 28 | ||
29 | #define PKTFILTER_BUF_SIZE 128 | 29 | #define PKTFILTER_BUF_SIZE 128 |
30 | #define BRCMF_ARPOL_MODE 0xb /* agent|snoop|peer_autoreply */ | ||
31 | #define BRCMF_DEFAULT_BCN_TIMEOUT 3 | 30 | #define BRCMF_DEFAULT_BCN_TIMEOUT 3 |
32 | #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40 | 31 | #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40 |
33 | #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 | 32 | #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 |
@@ -338,23 +337,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) | |||
338 | goto done; | 337 | goto done; |
339 | } | 338 | } |
340 | 339 | ||
341 | /* Try to set and enable ARP offload feature, this may fail */ | ||
342 | err = brcmf_fil_iovar_int_set(ifp, "arp_ol", BRCMF_ARPOL_MODE); | ||
343 | if (err) { | ||
344 | brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", | ||
345 | BRCMF_ARPOL_MODE, err); | ||
346 | err = 0; | ||
347 | } else { | ||
348 | err = brcmf_fil_iovar_int_set(ifp, "arpoe", 1); | ||
349 | if (err) { | ||
350 | brcmf_dbg(TRACE, "failed to enable ARP offload err = %d\n", | ||
351 | err); | ||
352 | err = 0; | ||
353 | } else | ||
354 | brcmf_dbg(TRACE, "successfully enabled ARP offload to 0x%x\n", | ||
355 | BRCMF_ARPOL_MODE); | ||
356 | } | ||
357 | |||
358 | /* Setup packet filter */ | 340 | /* Setup packet filter */ |
359 | brcmf_c_pktfilter_offload_set(ifp, BRCMF_DEFAULT_PACKET_FILTER); | 341 | brcmf_c_pktfilter_offload_set(ifp, BRCMF_DEFAULT_PACKET_FILTER); |
360 | brcmf_c_pktfilter_offload_enable(ifp, BRCMF_DEFAULT_PACKET_FILTER, | 342 | brcmf_c_pktfilter_offload_enable(ifp, BRCMF_DEFAULT_PACKET_FILTER, |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 59c25463e428..b98f2235978e 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -653,10 +653,13 @@ int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked) | |||
653 | 653 | ||
654 | brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name); | 654 | brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name); |
655 | 655 | ||
656 | ndev->destructor = free_netdev; | ||
656 | return 0; | 657 | return 0; |
657 | 658 | ||
658 | fail: | 659 | fail: |
660 | drvr->iflist[ifp->bssidx] = NULL; | ||
659 | ndev->netdev_ops = NULL; | 661 | ndev->netdev_ops = NULL; |
662 | free_netdev(ndev); | ||
660 | return -EBADE; | 663 | return -EBADE; |
661 | } | 664 | } |
662 | 665 | ||
@@ -720,6 +723,9 @@ static int brcmf_net_p2p_attach(struct brcmf_if *ifp) | |||
720 | return 0; | 723 | return 0; |
721 | 724 | ||
722 | fail: | 725 | fail: |
726 | ifp->drvr->iflist[ifp->bssidx] = NULL; | ||
727 | ndev->netdev_ops = NULL; | ||
728 | free_netdev(ndev); | ||
723 | return -EBADE; | 729 | return -EBADE; |
724 | } | 730 | } |
725 | 731 | ||
@@ -788,6 +794,7 @@ void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx) | |||
788 | struct brcmf_if *ifp; | 794 | struct brcmf_if *ifp; |
789 | 795 | ||
790 | ifp = drvr->iflist[bssidx]; | 796 | ifp = drvr->iflist[bssidx]; |
797 | drvr->iflist[bssidx] = NULL; | ||
791 | if (!ifp) { | 798 | if (!ifp) { |
792 | brcmf_err("Null interface, idx=%d\n", bssidx); | 799 | brcmf_err("Null interface, idx=%d\n", bssidx); |
793 | return; | 800 | return; |
@@ -808,15 +815,13 @@ void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx) | |||
808 | cancel_work_sync(&ifp->setmacaddr_work); | 815 | cancel_work_sync(&ifp->setmacaddr_work); |
809 | cancel_work_sync(&ifp->multicast_work); | 816 | cancel_work_sync(&ifp->multicast_work); |
810 | } | 817 | } |
811 | 818 | /* unregister will take care of freeing it */ | |
812 | unregister_netdev(ifp->ndev); | 819 | unregister_netdev(ifp->ndev); |
813 | if (bssidx == 0) | 820 | if (bssidx == 0) |
814 | brcmf_cfg80211_detach(drvr->config); | 821 | brcmf_cfg80211_detach(drvr->config); |
815 | free_netdev(ifp->ndev); | ||
816 | } else { | 822 | } else { |
817 | kfree(ifp); | 823 | kfree(ifp); |
818 | } | 824 | } |
819 | drvr->iflist[bssidx] = NULL; | ||
820 | } | 825 | } |
821 | 826 | ||
822 | int brcmf_attach(uint bus_hdrlen, struct device *dev) | 827 | int brcmf_attach(uint bus_hdrlen, struct device *dev) |
@@ -925,8 +930,6 @@ fail: | |||
925 | brcmf_fws_del_interface(ifp); | 930 | brcmf_fws_del_interface(ifp); |
926 | brcmf_fws_deinit(drvr); | 931 | brcmf_fws_deinit(drvr); |
927 | } | 932 | } |
928 | free_netdev(ifp->ndev); | ||
929 | drvr->iflist[0] = NULL; | ||
930 | if (p2p_ifp) { | 933 | if (p2p_ifp) { |
931 | free_netdev(p2p_ifp->ndev); | 934 | free_netdev(p2p_ifp->ndev); |
932 | drvr->iflist[1] = NULL; | 935 | drvr->iflist[1] = NULL; |
@@ -934,7 +937,8 @@ fail: | |||
934 | return ret; | 937 | return ret; |
935 | } | 938 | } |
936 | if ((brcmf_p2p_enable) && (p2p_ifp)) | 939 | if ((brcmf_p2p_enable) && (p2p_ifp)) |
937 | brcmf_net_p2p_attach(p2p_ifp); | 940 | if (brcmf_net_p2p_attach(p2p_ifp) < 0) |
941 | brcmf_p2p_enable = 0; | ||
938 | 942 | ||
939 | return 0; | 943 | return 0; |
940 | } | 944 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c index 5a64280e6485..83ee53a7c76e 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c | |||
@@ -202,7 +202,8 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, | |||
202 | return; | 202 | return; |
203 | brcmf_fws_add_interface(ifp); | 203 | brcmf_fws_add_interface(ifp); |
204 | if (!drvr->fweh.evt_handler[BRCMF_E_IF]) | 204 | if (!drvr->fweh.evt_handler[BRCMF_E_IF]) |
205 | err = brcmf_net_attach(ifp, false); | 205 | if (brcmf_net_attach(ifp, false) < 0) |
206 | return; | ||
206 | } | 207 | } |
207 | 208 | ||
208 | if (ifevent->action == BRCMF_E_IF_CHANGE) | 209 | if (ifevent->action == BRCMF_E_IF_CHANGE) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h index 0f2c83bc95dc..665ef69e974b 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h | |||
@@ -23,6 +23,12 @@ | |||
23 | 23 | ||
24 | #define BRCMF_FIL_ACTION_FRAME_SIZE 1800 | 24 | #define BRCMF_FIL_ACTION_FRAME_SIZE 1800 |
25 | 25 | ||
26 | /* ARP Offload feature flags for arp_ol iovar */ | ||
27 | #define BRCMF_ARP_OL_AGENT 0x00000001 | ||
28 | #define BRCMF_ARP_OL_SNOOP 0x00000002 | ||
29 | #define BRCMF_ARP_OL_HOST_AUTO_REPLY 0x00000004 | ||
30 | #define BRCMF_ARP_OL_PEER_AUTO_REPLY 0x00000008 | ||
31 | |||
26 | 32 | ||
27 | enum brcmf_fil_p2p_if_types { | 33 | enum brcmf_fil_p2p_if_types { |
28 | BRCMF_FIL_P2P_IF_CLIENT, | 34 | BRCMF_FIL_P2P_IF_CLIENT, |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c index e7a1a4770996..79555f006d53 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #define IS_P2P_SOCIAL_CHANNEL(channel) ((channel == SOCIAL_CHAN_1) || \ | 47 | #define IS_P2P_SOCIAL_CHANNEL(channel) ((channel == SOCIAL_CHAN_1) || \ |
48 | (channel == SOCIAL_CHAN_2) || \ | 48 | (channel == SOCIAL_CHAN_2) || \ |
49 | (channel == SOCIAL_CHAN_3)) | 49 | (channel == SOCIAL_CHAN_3)) |
50 | #define BRCMF_P2P_TEMP_CHAN SOCIAL_CHAN_3 | ||
50 | #define SOCIAL_CHAN_CNT 3 | 51 | #define SOCIAL_CHAN_CNT 3 |
51 | #define AF_PEER_SEARCH_CNT 2 | 52 | #define AF_PEER_SEARCH_CNT 2 |
52 | 53 | ||
@@ -1954,21 +1955,21 @@ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg) | |||
1954 | err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); | 1955 | err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); |
1955 | if (err < 0) { | 1956 | if (err < 0) { |
1956 | brcmf_err("set p2p_disc error\n"); | 1957 | brcmf_err("set p2p_disc error\n"); |
1957 | brcmf_free_vif(p2p_vif); | 1958 | brcmf_free_vif(cfg, p2p_vif); |
1958 | goto exit; | 1959 | goto exit; |
1959 | } | 1960 | } |
1960 | /* obtain bsscfg index for P2P discovery */ | 1961 | /* obtain bsscfg index for P2P discovery */ |
1961 | err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx); | 1962 | err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx); |
1962 | if (err < 0) { | 1963 | if (err < 0) { |
1963 | brcmf_err("retrieving discover bsscfg index failed\n"); | 1964 | brcmf_err("retrieving discover bsscfg index failed\n"); |
1964 | brcmf_free_vif(p2p_vif); | 1965 | brcmf_free_vif(cfg, p2p_vif); |
1965 | goto exit; | 1966 | goto exit; |
1966 | } | 1967 | } |
1967 | /* Verify that firmware uses same bssidx as driver !! */ | 1968 | /* Verify that firmware uses same bssidx as driver !! */ |
1968 | if (p2p_ifp->bssidx != bssidx) { | 1969 | if (p2p_ifp->bssidx != bssidx) { |
1969 | brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n", | 1970 | brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n", |
1970 | bssidx, p2p_ifp->bssidx); | 1971 | bssidx, p2p_ifp->bssidx); |
1971 | brcmf_free_vif(p2p_vif); | 1972 | brcmf_free_vif(cfg, p2p_vif); |
1972 | goto exit; | 1973 | goto exit; |
1973 | } | 1974 | } |
1974 | 1975 | ||
@@ -1996,7 +1997,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_info *p2p) | |||
1996 | brcmf_p2p_cancel_remain_on_channel(vif->ifp); | 1997 | brcmf_p2p_cancel_remain_on_channel(vif->ifp); |
1997 | brcmf_p2p_deinit_discovery(p2p); | 1998 | brcmf_p2p_deinit_discovery(p2p); |
1998 | /* remove discovery interface */ | 1999 | /* remove discovery interface */ |
1999 | brcmf_free_vif(vif); | 2000 | brcmf_free_vif(p2p->cfg, vif); |
2000 | p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; | 2001 | p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; |
2001 | } | 2002 | } |
2002 | /* just set it all to zero */ | 2003 | /* just set it all to zero */ |
@@ -2013,17 +2014,30 @@ static void brcmf_p2p_get_current_chanspec(struct brcmf_p2p_info *p2p, | |||
2013 | u16 *chanspec) | 2014 | u16 *chanspec) |
2014 | { | 2015 | { |
2015 | struct brcmf_if *ifp; | 2016 | struct brcmf_if *ifp; |
2016 | struct brcmf_fil_chan_info_le ci; | 2017 | u8 mac_addr[ETH_ALEN]; |
2017 | struct brcmu_chan ch; | 2018 | struct brcmu_chan ch; |
2018 | s32 err; | 2019 | struct brcmf_bss_info_le *bi; |
2020 | u8 *buf; | ||
2019 | 2021 | ||
2020 | ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; | 2022 | ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; |
2021 | 2023 | ||
2022 | ch.chnum = 11; | 2024 | if (brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSSID, mac_addr, |
2023 | 2025 | ETH_ALEN) == 0) { | |
2024 | err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_CHANNEL, &ci, sizeof(ci)); | 2026 | buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); |
2025 | if (!err) | 2027 | if (buf != NULL) { |
2026 | ch.chnum = le32_to_cpu(ci.hw_channel); | 2028 | *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX); |
2029 | if (brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, | ||
2030 | buf, WL_BSS_INFO_MAX) == 0) { | ||
2031 | bi = (struct brcmf_bss_info_le *)(buf + 4); | ||
2032 | *chanspec = le16_to_cpu(bi->chanspec); | ||
2033 | kfree(buf); | ||
2034 | return; | ||
2035 | } | ||
2036 | kfree(buf); | ||
2037 | } | ||
2038 | } | ||
2039 | /* Use default channel for P2P */ | ||
2040 | ch.chnum = BRCMF_P2P_TEMP_CHAN; | ||
2027 | ch.bw = BRCMU_CHAN_BW_20; | 2041 | ch.bw = BRCMU_CHAN_BW_20; |
2028 | p2p->cfg->d11inf.encchspec(&ch); | 2042 | p2p->cfg->d11inf.encchspec(&ch); |
2029 | *chanspec = ch.chspec; | 2043 | *chanspec = ch.chspec; |
@@ -2208,7 +2222,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p, | |||
2208 | return &p2p_vif->wdev; | 2222 | return &p2p_vif->wdev; |
2209 | 2223 | ||
2210 | fail: | 2224 | fail: |
2211 | brcmf_free_vif(p2p_vif); | 2225 | brcmf_free_vif(p2p->cfg, p2p_vif); |
2212 | return ERR_PTR(err); | 2226 | return ERR_PTR(err); |
2213 | } | 2227 | } |
2214 | 2228 | ||
@@ -2217,13 +2231,31 @@ fail: | |||
2217 | * | 2231 | * |
2218 | * @vif: virtual interface object to delete. | 2232 | * @vif: virtual interface object to delete. |
2219 | */ | 2233 | */ |
2220 | static void brcmf_p2p_delete_p2pdev(struct brcmf_cfg80211_vif *vif) | 2234 | static void brcmf_p2p_delete_p2pdev(struct brcmf_cfg80211_info *cfg, |
2235 | struct brcmf_cfg80211_vif *vif) | ||
2221 | { | 2236 | { |
2222 | struct brcmf_p2p_info *p2p = &vif->ifp->drvr->config->p2p; | ||
2223 | |||
2224 | cfg80211_unregister_wdev(&vif->wdev); | 2237 | cfg80211_unregister_wdev(&vif->wdev); |
2225 | p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; | 2238 | cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; |
2226 | brcmf_free_vif(vif); | 2239 | brcmf_free_vif(cfg, vif); |
2240 | } | ||
2241 | |||
2242 | /** | ||
2243 | * brcmf_p2p_free_p2p_if() - free up net device related data. | ||
2244 | * | ||
2245 | * @ndev: net device that needs to be freed. | ||
2246 | */ | ||
2247 | static void brcmf_p2p_free_p2p_if(struct net_device *ndev) | ||
2248 | { | ||
2249 | struct brcmf_cfg80211_info *cfg; | ||
2250 | struct brcmf_cfg80211_vif *vif; | ||
2251 | struct brcmf_if *ifp; | ||
2252 | |||
2253 | ifp = netdev_priv(ndev); | ||
2254 | cfg = ifp->drvr->config; | ||
2255 | vif = ifp->vif; | ||
2256 | |||
2257 | brcmf_free_vif(cfg, vif); | ||
2258 | free_netdev(ifp->ndev); | ||
2227 | } | 2259 | } |
2228 | 2260 | ||
2229 | /** | 2261 | /** |
@@ -2303,6 +2335,9 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name, | |||
2303 | brcmf_err("Registering netdevice failed\n"); | 2335 | brcmf_err("Registering netdevice failed\n"); |
2304 | goto fail; | 2336 | goto fail; |
2305 | } | 2337 | } |
2338 | /* override destructor */ | ||
2339 | ifp->ndev->destructor = brcmf_p2p_free_p2p_if; | ||
2340 | |||
2306 | cfg->p2p.bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = vif; | 2341 | cfg->p2p.bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = vif; |
2307 | /* Disable firmware roaming for P2P interface */ | 2342 | /* Disable firmware roaming for P2P interface */ |
2308 | brcmf_fil_iovar_int_set(ifp, "roam_off", 1); | 2343 | brcmf_fil_iovar_int_set(ifp, "roam_off", 1); |
@@ -2314,7 +2349,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name, | |||
2314 | return &ifp->vif->wdev; | 2349 | return &ifp->vif->wdev; |
2315 | 2350 | ||
2316 | fail: | 2351 | fail: |
2317 | brcmf_free_vif(vif); | 2352 | brcmf_free_vif(cfg, vif); |
2318 | return ERR_PTR(err); | 2353 | return ERR_PTR(err); |
2319 | } | 2354 | } |
2320 | 2355 | ||
@@ -2350,7 +2385,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
2350 | break; | 2385 | break; |
2351 | 2386 | ||
2352 | case NL80211_IFTYPE_P2P_DEVICE: | 2387 | case NL80211_IFTYPE_P2P_DEVICE: |
2353 | brcmf_p2p_delete_p2pdev(vif); | 2388 | brcmf_p2p_delete_p2pdev(cfg, vif); |
2354 | return 0; | 2389 | return 0; |
2355 | default: | 2390 | default: |
2356 | return -ENOTSUPP; | 2391 | return -ENOTSUPP; |
@@ -2378,7 +2413,6 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
2378 | err = 0; | 2413 | err = 0; |
2379 | } | 2414 | } |
2380 | brcmf_cfg80211_arm_vif_event(cfg, NULL); | 2415 | brcmf_cfg80211_arm_vif_event(cfg, NULL); |
2381 | brcmf_free_vif(vif); | ||
2382 | p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL; | 2416 | p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL; |
2383 | 2417 | ||
2384 | return err; | 2418 | return err; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 6d758f285352..301e572e8923 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -459,6 +459,38 @@ send_key_to_dongle(struct net_device *ndev, struct brcmf_wsec_key *key) | |||
459 | return err; | 459 | return err; |
460 | } | 460 | } |
461 | 461 | ||
462 | static s32 | ||
463 | brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable) | ||
464 | { | ||
465 | s32 err; | ||
466 | u32 mode; | ||
467 | |||
468 | if (enable) | ||
469 | mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; | ||
470 | else | ||
471 | mode = 0; | ||
472 | |||
473 | /* Try to set and enable ARP offload feature, this may fail, then it */ | ||
474 | /* is simply not supported and err 0 will be returned */ | ||
475 | err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); | ||
476 | if (err) { | ||
477 | brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", | ||
478 | mode, err); | ||
479 | err = 0; | ||
480 | } else { | ||
481 | err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); | ||
482 | if (err) { | ||
483 | brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", | ||
484 | enable, err); | ||
485 | err = 0; | ||
486 | } else | ||
487 | brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", | ||
488 | enable, mode); | ||
489 | } | ||
490 | |||
491 | return err; | ||
492 | } | ||
493 | |||
462 | static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, | 494 | static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, |
463 | const char *name, | 495 | const char *name, |
464 | enum nl80211_iftype type, | 496 | enum nl80211_iftype type, |
@@ -2216,6 +2248,11 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, | |||
2216 | } | 2248 | } |
2217 | 2249 | ||
2218 | pm = enabled ? PM_FAST : PM_OFF; | 2250 | pm = enabled ? PM_FAST : PM_OFF; |
2251 | /* Do not enable the power save after assoc if it is a p2p interface */ | ||
2252 | if (ifp->vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) { | ||
2253 | brcmf_dbg(INFO, "Do not enable power save for P2P clients\n"); | ||
2254 | pm = PM_OFF; | ||
2255 | } | ||
2219 | brcmf_dbg(INFO, "power save %s\n", (pm ? "enabled" : "disabled")); | 2256 | brcmf_dbg(INFO, "power save %s\n", (pm ? "enabled" : "disabled")); |
2220 | 2257 | ||
2221 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); | 2258 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); |
@@ -3640,10 +3677,28 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif, | |||
3640 | } | 3677 | } |
3641 | 3678 | ||
3642 | static s32 | 3679 | static s32 |
3680 | brcmf_cfg80211_set_channel(struct brcmf_cfg80211_info *cfg, | ||
3681 | struct brcmf_if *ifp, | ||
3682 | struct ieee80211_channel *channel) | ||
3683 | { | ||
3684 | u16 chanspec; | ||
3685 | s32 err; | ||
3686 | |||
3687 | brcmf_dbg(TRACE, "band=%d, center_freq=%d\n", channel->band, | ||
3688 | channel->center_freq); | ||
3689 | |||
3690 | chanspec = channel_to_chanspec(&cfg->d11inf, channel); | ||
3691 | err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); | ||
3692 | |||
3693 | return err; | ||
3694 | } | ||
3695 | |||
3696 | static s32 | ||
3643 | brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | 3697 | brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, |
3644 | struct cfg80211_ap_settings *settings) | 3698 | struct cfg80211_ap_settings *settings) |
3645 | { | 3699 | { |
3646 | s32 ie_offset; | 3700 | s32 ie_offset; |
3701 | struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); | ||
3647 | struct brcmf_if *ifp = netdev_priv(ndev); | 3702 | struct brcmf_if *ifp = netdev_priv(ndev); |
3648 | struct brcmf_tlv *ssid_ie; | 3703 | struct brcmf_tlv *ssid_ie; |
3649 | struct brcmf_ssid_le ssid_le; | 3704 | struct brcmf_ssid_le ssid_le; |
@@ -3683,6 +3738,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
3683 | } | 3738 | } |
3684 | 3739 | ||
3685 | brcmf_set_mpc(ifp, 0); | 3740 | brcmf_set_mpc(ifp, 0); |
3741 | brcmf_configure_arp_offload(ifp, false); | ||
3686 | 3742 | ||
3687 | /* find the RSN_IE */ | 3743 | /* find the RSN_IE */ |
3688 | rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, | 3744 | rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, |
@@ -3713,6 +3769,12 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
3713 | 3769 | ||
3714 | brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); | 3770 | brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); |
3715 | 3771 | ||
3772 | err = brcmf_cfg80211_set_channel(cfg, ifp, settings->chandef.chan); | ||
3773 | if (err < 0) { | ||
3774 | brcmf_err("Set Channel failed, %d\n", err); | ||
3775 | goto exit; | ||
3776 | } | ||
3777 | |||
3716 | if (settings->beacon_interval) { | 3778 | if (settings->beacon_interval) { |
3717 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, | 3779 | err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, |
3718 | settings->beacon_interval); | 3780 | settings->beacon_interval); |
@@ -3789,8 +3851,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
3789 | set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); | 3851 | set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); |
3790 | 3852 | ||
3791 | exit: | 3853 | exit: |
3792 | if (err) | 3854 | if (err) { |
3793 | brcmf_set_mpc(ifp, 1); | 3855 | brcmf_set_mpc(ifp, 1); |
3856 | brcmf_configure_arp_offload(ifp, true); | ||
3857 | } | ||
3794 | return err; | 3858 | return err; |
3795 | } | 3859 | } |
3796 | 3860 | ||
@@ -3831,6 +3895,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) | |||
3831 | brcmf_err("bss_enable config failed %d\n", err); | 3895 | brcmf_err("bss_enable config failed %d\n", err); |
3832 | } | 3896 | } |
3833 | brcmf_set_mpc(ifp, 1); | 3897 | brcmf_set_mpc(ifp, 1); |
3898 | brcmf_configure_arp_offload(ifp, true); | ||
3834 | set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); | 3899 | set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); |
3835 | clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); | 3900 | clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); |
3836 | 3901 | ||
@@ -4140,11 +4205,15 @@ static const struct ieee80211_iface_limit brcmf_iface_limits[] = { | |||
4140 | .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | | 4205 | .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | |
4141 | BIT(NL80211_IFTYPE_P2P_GO) | 4206 | BIT(NL80211_IFTYPE_P2P_GO) |
4142 | }, | 4207 | }, |
4208 | { | ||
4209 | .max = 1, | ||
4210 | .types = BIT(NL80211_IFTYPE_P2P_DEVICE) | ||
4211 | } | ||
4143 | }; | 4212 | }; |
4144 | static const struct ieee80211_iface_combination brcmf_iface_combos[] = { | 4213 | static const struct ieee80211_iface_combination brcmf_iface_combos[] = { |
4145 | { | 4214 | { |
4146 | .max_interfaces = BRCMF_IFACE_MAX_CNT, | 4215 | .max_interfaces = BRCMF_IFACE_MAX_CNT, |
4147 | .num_different_channels = 1, /* no multi-channel for now */ | 4216 | .num_different_channels = 2, |
4148 | .n_limits = ARRAY_SIZE(brcmf_iface_limits), | 4217 | .n_limits = ARRAY_SIZE(brcmf_iface_limits), |
4149 | .limits = brcmf_iface_limits | 4218 | .limits = brcmf_iface_limits |
4150 | } | 4219 | } |
@@ -4197,7 +4266,8 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) | |||
4197 | BIT(NL80211_IFTYPE_ADHOC) | | 4266 | BIT(NL80211_IFTYPE_ADHOC) | |
4198 | BIT(NL80211_IFTYPE_AP) | | 4267 | BIT(NL80211_IFTYPE_AP) | |
4199 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | 4268 | BIT(NL80211_IFTYPE_P2P_CLIENT) | |
4200 | BIT(NL80211_IFTYPE_P2P_GO); | 4269 | BIT(NL80211_IFTYPE_P2P_GO) | |
4270 | BIT(NL80211_IFTYPE_P2P_DEVICE); | ||
4201 | wiphy->iface_combinations = brcmf_iface_combos; | 4271 | wiphy->iface_combinations = brcmf_iface_combos; |
4202 | wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); | 4272 | wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); |
4203 | wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; | 4273 | wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; |
@@ -4251,20 +4321,16 @@ struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, | |||
4251 | return vif; | 4321 | return vif; |
4252 | } | 4322 | } |
4253 | 4323 | ||
4254 | void brcmf_free_vif(struct brcmf_cfg80211_vif *vif) | 4324 | void brcmf_free_vif(struct brcmf_cfg80211_info *cfg, |
4325 | struct brcmf_cfg80211_vif *vif) | ||
4255 | { | 4326 | { |
4256 | struct brcmf_cfg80211_info *cfg; | ||
4257 | struct wiphy *wiphy; | ||
4258 | |||
4259 | wiphy = vif->wdev.wiphy; | ||
4260 | cfg = wiphy_priv(wiphy); | ||
4261 | list_del(&vif->list); | 4327 | list_del(&vif->list); |
4262 | cfg->vif_cnt--; | 4328 | cfg->vif_cnt--; |
4263 | 4329 | ||
4264 | kfree(vif); | 4330 | kfree(vif); |
4265 | if (!cfg->vif_cnt) { | 4331 | if (!cfg->vif_cnt) { |
4266 | wiphy_unregister(wiphy); | 4332 | wiphy_unregister(cfg->wiphy); |
4267 | wiphy_free(wiphy); | 4333 | wiphy_free(cfg->wiphy); |
4268 | } | 4334 | } |
4269 | } | 4335 | } |
4270 | 4336 | ||
@@ -4641,7 +4707,6 @@ static s32 brcmf_notify_vif_event(struct brcmf_if *ifp, | |||
4641 | return 0; | 4707 | return 0; |
4642 | 4708 | ||
4643 | case BRCMF_E_IF_DEL: | 4709 | case BRCMF_E_IF_DEL: |
4644 | ifp->vif = NULL; | ||
4645 | mutex_unlock(&event->vif_event_lock); | 4710 | mutex_unlock(&event->vif_event_lock); |
4646 | /* event may not be upon user request */ | 4711 | /* event may not be upon user request */ |
4647 | if (brcmf_cfg80211_vif_event_armed(cfg)) | 4712 | if (brcmf_cfg80211_vif_event_armed(cfg)) |
@@ -4847,8 +4912,7 @@ cfg80211_p2p_attach_out: | |||
4847 | wl_deinit_priv(cfg); | 4912 | wl_deinit_priv(cfg); |
4848 | 4913 | ||
4849 | cfg80211_attach_out: | 4914 | cfg80211_attach_out: |
4850 | brcmf_free_vif(vif); | 4915 | brcmf_free_vif(cfg, vif); |
4851 | wiphy_free(wiphy); | ||
4852 | return NULL; | 4916 | return NULL; |
4853 | } | 4917 | } |
4854 | 4918 | ||
@@ -4860,7 +4924,7 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg) | |||
4860 | wl_deinit_priv(cfg); | 4924 | wl_deinit_priv(cfg); |
4861 | brcmf_btcoex_detach(cfg); | 4925 | brcmf_btcoex_detach(cfg); |
4862 | list_for_each_entry_safe(vif, tmp, &cfg->vif_list, list) { | 4926 | list_for_each_entry_safe(vif, tmp, &cfg->vif_list, list) { |
4863 | brcmf_free_vif(vif); | 4927 | brcmf_free_vif(cfg, vif); |
4864 | } | 4928 | } |
4865 | } | 4929 | } |
4866 | 4930 | ||
@@ -5224,6 +5288,8 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) | |||
5224 | if (err) | 5288 | if (err) |
5225 | goto default_conf_out; | 5289 | goto default_conf_out; |
5226 | 5290 | ||
5291 | brcmf_configure_arp_offload(ifp, true); | ||
5292 | |||
5227 | cfg->dongle_up = true; | 5293 | cfg->dongle_up = true; |
5228 | default_conf_out: | 5294 | default_conf_out: |
5229 | 5295 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h index a71cff84cdcf..d9bdaf9a72d0 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h | |||
@@ -487,7 +487,8 @@ enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp); | |||
487 | struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, | 487 | struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, |
488 | enum nl80211_iftype type, | 488 | enum nl80211_iftype type, |
489 | bool pm_block); | 489 | bool pm_block); |
490 | void brcmf_free_vif(struct brcmf_cfg80211_vif *vif); | 490 | void brcmf_free_vif(struct brcmf_cfg80211_info *cfg, |
491 | struct brcmf_cfg80211_vif *vif); | ||
491 | 492 | ||
492 | s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, | 493 | s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, |
493 | const u8 *vndr_ie_buf, u32 vndr_ie_len); | 494 | const u8 *vndr_ie_buf, u32 vndr_ie_len); |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index b8f82e688c72..9a95045c97b6 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -5741,8 +5741,7 @@ il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length) | |||
5741 | hw->flags = | 5741 | hw->flags = |
5742 | IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_AMPDU_AGGREGATION | | 5742 | IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_AMPDU_AGGREGATION | |
5743 | IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC | IEEE80211_HW_SPECTRUM_MGMT | | 5743 | IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC | IEEE80211_HW_SPECTRUM_MGMT | |
5744 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | IEEE80211_HW_SUPPORTS_PS | | 5744 | IEEE80211_HW_SUPPORTS_PS | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; |
5745 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | ||
5746 | if (il->cfg->sku & IL_SKU_N) | 5745 | if (il->cfg->sku & IL_SKU_N) |
5747 | hw->flags |= | 5746 | hw->flags |= |
5748 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | | 5747 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | |
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index 592d0aa634a8..e9a3cbc409ae 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -1423,7 +1423,7 @@ il_setup_rx_scan_handlers(struct il_priv *il) | |||
1423 | } | 1423 | } |
1424 | EXPORT_SYMBOL(il_setup_rx_scan_handlers); | 1424 | EXPORT_SYMBOL(il_setup_rx_scan_handlers); |
1425 | 1425 | ||
1426 | inline u16 | 1426 | u16 |
1427 | il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band, | 1427 | il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band, |
1428 | u8 n_probes) | 1428 | u8 n_probes) |
1429 | { | 1429 | { |
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index f8246f2d88f9..4caaf52986a4 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h | |||
@@ -1832,16 +1832,16 @@ u32 il_usecs_to_beacons(struct il_priv *il, u32 usec, u32 beacon_interval); | |||
1832 | __le32 il_add_beacon_time(struct il_priv *il, u32 base, u32 addon, | 1832 | __le32 il_add_beacon_time(struct il_priv *il, u32 base, u32 addon, |
1833 | u32 beacon_interval); | 1833 | u32 beacon_interval); |
1834 | 1834 | ||
1835 | #ifdef CONFIG_PM | 1835 | #ifdef CONFIG_PM_SLEEP |
1836 | extern const struct dev_pm_ops il_pm_ops; | 1836 | extern const struct dev_pm_ops il_pm_ops; |
1837 | 1837 | ||
1838 | #define IL_LEGACY_PM_OPS (&il_pm_ops) | 1838 | #define IL_LEGACY_PM_OPS (&il_pm_ops) |
1839 | 1839 | ||
1840 | #else /* !CONFIG_PM */ | 1840 | #else /* !CONFIG_PM_SLEEP */ |
1841 | 1841 | ||
1842 | #define IL_LEGACY_PM_OPS NULL | 1842 | #define IL_LEGACY_PM_OPS NULL |
1843 | 1843 | ||
1844 | #endif /* !CONFIG_PM */ | 1844 | #endif /* !CONFIG_PM_SLEEP */ |
1845 | 1845 | ||
1846 | /***************************************************** | 1846 | /***************************************************** |
1847 | * Error Handling Debugging | 1847 | * Error Handling Debugging |
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c index db183b44e038..c3c13ce96eb0 100644 --- a/drivers/net/wireless/iwlwifi/dvm/sta.c +++ b/drivers/net/wireless/iwlwifi/dvm/sta.c | |||
@@ -735,7 +735,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
735 | memcpy(&lq, priv->stations[i].lq, | 735 | memcpy(&lq, priv->stations[i].lq, |
736 | sizeof(struct iwl_link_quality_cmd)); | 736 | sizeof(struct iwl_link_quality_cmd)); |
737 | 737 | ||
738 | if (!memcmp(&lq, &zero_lq, sizeof(lq))) | 738 | if (memcmp(&lq, &zero_lq, sizeof(lq))) |
739 | send_lq = true; | 739 | send_lq = true; |
740 | } | 740 | } |
741 | spin_unlock_bh(&priv->sta_lock); | 741 | spin_unlock_bh(&priv->sta_lock); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h index 191dcae8ba47..c6384555aab4 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h | |||
@@ -173,6 +173,8 @@ enum { | |||
173 | REPLY_DEBUG_CMD = 0xf0, | 173 | REPLY_DEBUG_CMD = 0xf0, |
174 | DEBUG_LOG_MSG = 0xf7, | 174 | DEBUG_LOG_MSG = 0xf7, |
175 | 175 | ||
176 | MCAST_FILTER_CMD = 0xd0, | ||
177 | |||
176 | /* D3 commands/notifications */ | 178 | /* D3 commands/notifications */ |
177 | D3_CONFIG_CMD = 0xd3, | 179 | D3_CONFIG_CMD = 0xd3, |
178 | PROT_OFFLOAD_CONFIG_CMD = 0xd4, | 180 | PROT_OFFLOAD_CONFIG_CMD = 0xd4, |
@@ -948,4 +950,29 @@ struct iwl_set_calib_default_cmd { | |||
948 | u8 data[0]; | 950 | u8 data[0]; |
949 | } __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */ | 951 | } __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */ |
950 | 952 | ||
953 | #define MAX_PORT_ID_NUM 2 | ||
954 | |||
955 | /** | ||
956 | * struct iwl_mcast_filter_cmd - configure multicast filter. | ||
957 | * @filter_own: Set 1 to filter out multicast packets sent by station itself | ||
958 | * @port_id: Multicast MAC addresses array specifier. This is a strange way | ||
959 | * to identify network interface adopted in host-device IF. | ||
960 | * It is used by FW as index in array of addresses. This array has | ||
961 | * MAX_PORT_ID_NUM members. | ||
962 | * @count: Number of MAC addresses in the array | ||
963 | * @pass_all: Set 1 to pass all multicast packets. | ||
964 | * @bssid: current association BSSID. | ||
965 | * @addr_list: Place holder for array of MAC addresses. | ||
966 | * IMPORTANT: add padding if necessary to ensure DWORD alignment. | ||
967 | */ | ||
968 | struct iwl_mcast_filter_cmd { | ||
969 | u8 filter_own; | ||
970 | u8 port_id; | ||
971 | u8 count; | ||
972 | u8 pass_all; | ||
973 | u8 bssid[6]; | ||
974 | u8 reserved[2]; | ||
975 | u8 addr_list[0]; | ||
976 | } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */ | ||
977 | |||
951 | #endif /* __fw_api_h__ */ | 978 | #endif /* __fw_api_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c index e6eca4d66f6c..b2cc3d98e0f7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | |||
@@ -586,10 +586,12 @@ static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, | |||
586 | */ | 586 | */ |
587 | static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm, | 587 | static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm, |
588 | struct ieee80211_vif *vif, | 588 | struct ieee80211_vif *vif, |
589 | struct iwl_mac_data_sta *ctxt_sta) | 589 | struct iwl_mac_data_sta *ctxt_sta, |
590 | bool force_assoc_off) | ||
590 | { | 591 | { |
591 | /* We need the dtim_period to set the MAC as associated */ | 592 | /* We need the dtim_period to set the MAC as associated */ |
592 | if (vif->bss_conf.assoc && vif->bss_conf.dtim_period) { | 593 | if (vif->bss_conf.assoc && vif->bss_conf.dtim_period && |
594 | !force_assoc_off) { | ||
593 | u32 dtim_offs; | 595 | u32 dtim_offs; |
594 | 596 | ||
595 | /* | 597 | /* |
@@ -659,7 +661,8 @@ static int iwl_mvm_mac_ctxt_cmd_station(struct iwl_mvm *mvm, | |||
659 | cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON); | 661 | cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON); |
660 | 662 | ||
661 | /* Fill the data specific for station mode */ | 663 | /* Fill the data specific for station mode */ |
662 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta); | 664 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta, |
665 | action == FW_CTXT_ACTION_ADD); | ||
663 | 666 | ||
664 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); | 667 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); |
665 | } | 668 | } |
@@ -677,7 +680,8 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm, | |||
677 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); | 680 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); |
678 | 681 | ||
679 | /* Fill the data specific for station mode */ | 682 | /* Fill the data specific for station mode */ |
680 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta); | 683 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta, |
684 | action == FW_CTXT_ACTION_ADD); | ||
681 | 685 | ||
682 | cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & | 686 | cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & |
683 | IEEE80211_P2P_OPPPS_CTWINDOW_MASK); | 687 | IEEE80211_P2P_OPPPS_CTWINDOW_MASK); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index dd158ec571fb..a5eb8c82f16a 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -701,6 +701,20 @@ static void iwl_mvm_configure_filter(struct ieee80211_hw *hw, | |||
701 | *total_flags = 0; | 701 | *total_flags = 0; |
702 | } | 702 | } |
703 | 703 | ||
704 | static int iwl_mvm_configure_mcast_filter(struct iwl_mvm *mvm, | ||
705 | struct ieee80211_vif *vif) | ||
706 | { | ||
707 | struct iwl_mcast_filter_cmd mcast_filter_cmd = { | ||
708 | .pass_all = 1, | ||
709 | }; | ||
710 | |||
711 | memcpy(mcast_filter_cmd.bssid, vif->bss_conf.bssid, ETH_ALEN); | ||
712 | |||
713 | return iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_SYNC, | ||
714 | sizeof(mcast_filter_cmd), | ||
715 | &mcast_filter_cmd); | ||
716 | } | ||
717 | |||
704 | static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | 718 | static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, |
705 | struct ieee80211_vif *vif, | 719 | struct ieee80211_vif *vif, |
706 | struct ieee80211_bss_conf *bss_conf, | 720 | struct ieee80211_bss_conf *bss_conf, |
@@ -722,6 +736,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
722 | return; | 736 | return; |
723 | } | 737 | } |
724 | iwl_mvm_bt_coex_vif_assoc(mvm, vif); | 738 | iwl_mvm_bt_coex_vif_assoc(mvm, vif); |
739 | iwl_mvm_configure_mcast_filter(mvm, vif); | ||
725 | } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { | 740 | } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { |
726 | /* remove AP station now that the MAC is unassoc */ | 741 | /* remove AP station now that the MAC is unassoc */ |
727 | ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id); | 742 | ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id); |
@@ -931,7 +946,7 @@ static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, | |||
931 | 946 | ||
932 | switch (cmd) { | 947 | switch (cmd) { |
933 | case STA_NOTIFY_SLEEP: | 948 | case STA_NOTIFY_SLEEP: |
934 | if (atomic_read(&mvmsta->pending_frames) > 0) | 949 | if (atomic_read(&mvm->pending_frames[mvmsta->sta_id]) > 0) |
935 | ieee80211_sta_block_awake(hw, sta, true); | 950 | ieee80211_sta_block_awake(hw, sta, true); |
936 | /* | 951 | /* |
937 | * The fw updates the STA to be asleep. Tx packets on the Tx | 952 | * The fw updates the STA to be asleep. Tx packets on the Tx |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index 8269bc562951..9f46b23801bc 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -292,6 +292,7 @@ struct iwl_mvm { | |||
292 | struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT]; | 292 | struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT]; |
293 | struct work_struct sta_drained_wk; | 293 | struct work_struct sta_drained_wk; |
294 | unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; | 294 | unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; |
295 | atomic_t pending_frames[IWL_MVM_STATION_COUNT]; | ||
295 | 296 | ||
296 | /* configured by mac80211 */ | 297 | /* configured by mac80211 */ |
297 | u32 rts_threshold; | 298 | u32 rts_threshold; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index fe031d304d1e..b29c31a41594 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
@@ -292,6 +292,7 @@ static const char *iwl_mvm_cmd_strings[REPLY_MAX] = { | |||
292 | CMD(BT_COEX_PROT_ENV), | 292 | CMD(BT_COEX_PROT_ENV), |
293 | CMD(BT_PROFILE_NOTIFICATION), | 293 | CMD(BT_PROFILE_NOTIFICATION), |
294 | CMD(BT_CONFIG), | 294 | CMD(BT_CONFIG), |
295 | CMD(MCAST_FILTER_CMD), | ||
295 | }; | 296 | }; |
296 | #undef CMD | 297 | #undef CMD |
297 | 298 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 2157b0f8ced5..2476e43799d5 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -298,6 +298,12 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm, | |||
298 | else | 298 | else |
299 | cmd->type = cpu_to_le32(SCAN_TYPE_FORCED); | 299 | cmd->type = cpu_to_le32(SCAN_TYPE_FORCED); |
300 | 300 | ||
301 | /* | ||
302 | * TODO: This is a WA due to a bug in the FW AUX framework that does not | ||
303 | * properly handle time events that fail to be scheduled | ||
304 | */ | ||
305 | cmd->type = cpu_to_le32(SCAN_TYPE_FORCED); | ||
306 | |||
301 | cmd->repeats = cpu_to_le32(1); | 307 | cmd->repeats = cpu_to_le32(1); |
302 | 308 | ||
303 | /* | 309 | /* |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index 0fd96e4da461..5c664ed54400 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c | |||
@@ -219,7 +219,7 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm, | |||
219 | mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF; | 219 | mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF; |
220 | 220 | ||
221 | /* HW restart, don't assume the memory has been zeroed */ | 221 | /* HW restart, don't assume the memory has been zeroed */ |
222 | atomic_set(&mvm_sta->pending_frames, 0); | 222 | atomic_set(&mvm->pending_frames[sta_id], 0); |
223 | mvm_sta->tid_disable_agg = 0; | 223 | mvm_sta->tid_disable_agg = 0; |
224 | mvm_sta->tfd_queue_msk = 0; | 224 | mvm_sta->tfd_queue_msk = 0; |
225 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | 225 | for (i = 0; i < IEEE80211_NUM_ACS; i++) |
@@ -407,14 +407,21 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm, | |||
407 | } | 407 | } |
408 | 408 | ||
409 | /* | 409 | /* |
410 | * Make sure that the tx response code sees the station as -EBUSY and | ||
411 | * calls the drain worker. | ||
412 | */ | ||
413 | spin_lock_bh(&mvm_sta->lock); | ||
414 | /* | ||
410 | * There are frames pending on the AC queues for this station. | 415 | * There are frames pending on the AC queues for this station. |
411 | * We need to wait until all the frames are drained... | 416 | * We need to wait until all the frames are drained... |
412 | */ | 417 | */ |
413 | if (atomic_read(&mvm_sta->pending_frames)) { | 418 | if (atomic_read(&mvm->pending_frames[mvm_sta->sta_id])) { |
414 | ret = iwl_mvm_drain_sta(mvm, mvm_sta, true); | ||
415 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], | 419 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], |
416 | ERR_PTR(-EBUSY)); | 420 | ERR_PTR(-EBUSY)); |
421 | spin_unlock_bh(&mvm_sta->lock); | ||
422 | ret = iwl_mvm_drain_sta(mvm, mvm_sta, true); | ||
417 | } else { | 423 | } else { |
424 | spin_unlock_bh(&mvm_sta->lock); | ||
418 | ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); | 425 | ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); |
419 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); | 426 | rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); |
420 | } | 427 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.h b/drivers/net/wireless/iwlwifi/mvm/sta.h index 12abd2d71835..a4ddce77aaae 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.h +++ b/drivers/net/wireless/iwlwifi/mvm/sta.h | |||
@@ -274,7 +274,6 @@ struct iwl_mvm_tid_data { | |||
274 | * @bt_reduced_txpower: is reduced tx power enabled for this station | 274 | * @bt_reduced_txpower: is reduced tx power enabled for this station |
275 | * @lock: lock to protect the whole struct. Since %tid_data is access from Tx | 275 | * @lock: lock to protect the whole struct. Since %tid_data is access from Tx |
276 | * and from Tx response flow, it needs a spinlock. | 276 | * and from Tx response flow, it needs a spinlock. |
277 | * @pending_frames: number of frames for this STA on the shared Tx queues. | ||
278 | * @tid_data: per tid data. Look at %iwl_mvm_tid_data. | 277 | * @tid_data: per tid data. Look at %iwl_mvm_tid_data. |
279 | * | 278 | * |
280 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) | 279 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) |
@@ -290,7 +289,6 @@ struct iwl_mvm_sta { | |||
290 | u8 max_agg_bufsize; | 289 | u8 max_agg_bufsize; |
291 | bool bt_reduced_txpower; | 290 | bool bt_reduced_txpower; |
292 | spinlock_t lock; | 291 | spinlock_t lock; |
293 | atomic_t pending_frames; | ||
294 | struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT]; | 292 | struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT]; |
295 | struct iwl_lq_sta lq_sta; | 293 | struct iwl_lq_sta lq_sta; |
296 | struct ieee80211_vif *vif; | 294 | struct ieee80211_vif *vif; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 479074303bd7..f212f16502ff 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -416,9 +416,8 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb, | |||
416 | 416 | ||
417 | spin_unlock(&mvmsta->lock); | 417 | spin_unlock(&mvmsta->lock); |
418 | 418 | ||
419 | if (mvmsta->vif->type == NL80211_IFTYPE_AP && | 419 | if (txq_id < IWL_MVM_FIRST_AGG_QUEUE) |
420 | txq_id < IWL_MVM_FIRST_AGG_QUEUE) | 420 | atomic_inc(&mvm->pending_frames[mvmsta->sta_id]); |
421 | atomic_inc(&mvmsta->pending_frames); | ||
422 | 421 | ||
423 | return 0; | 422 | return 0; |
424 | 423 | ||
@@ -680,16 +679,41 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, | |||
680 | /* | 679 | /* |
681 | * If the txq is not an AMPDU queue, there is no chance we freed | 680 | * If the txq is not an AMPDU queue, there is no chance we freed |
682 | * several skbs. Check that out... | 681 | * several skbs. Check that out... |
683 | * If there are no pending frames for this STA, notify mac80211 that | ||
684 | * this station can go to sleep in its STA table. | ||
685 | */ | 682 | */ |
686 | if (txq_id < IWL_MVM_FIRST_AGG_QUEUE && mvmsta && | 683 | if (txq_id < IWL_MVM_FIRST_AGG_QUEUE && !WARN_ON(skb_freed > 1) && |
687 | !WARN_ON(skb_freed > 1) && | 684 | atomic_sub_and_test(skb_freed, &mvm->pending_frames[sta_id])) { |
688 | mvmsta->vif->type == NL80211_IFTYPE_AP && | 685 | if (mvmsta) { |
689 | atomic_sub_and_test(skb_freed, &mvmsta->pending_frames)) { | 686 | /* |
690 | ieee80211_sta_block_awake(mvm->hw, sta, false); | 687 | * If there are no pending frames for this STA, notify |
691 | set_bit(sta_id, mvm->sta_drained); | 688 | * mac80211 that this station can go to sleep in its |
692 | schedule_work(&mvm->sta_drained_wk); | 689 | * STA table. |
690 | */ | ||
691 | if (mvmsta->vif->type == NL80211_IFTYPE_AP) | ||
692 | ieee80211_sta_block_awake(mvm->hw, sta, false); | ||
693 | /* | ||
694 | * We might very well have taken mvmsta pointer while | ||
695 | * the station was being removed. The remove flow might | ||
696 | * have seen a pending_frame (because we didn't take | ||
697 | * the lock) even if now the queues are drained. So make | ||
698 | * really sure now that this the station is not being | ||
699 | * removed. If it is, run the drain worker to remove it. | ||
700 | */ | ||
701 | spin_lock_bh(&mvmsta->lock); | ||
702 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); | ||
703 | if (IS_ERR_OR_NULL(sta)) { | ||
704 | /* | ||
705 | * Station disappeared in the meantime: | ||
706 | * so we are draining. | ||
707 | */ | ||
708 | set_bit(sta_id, mvm->sta_drained); | ||
709 | schedule_work(&mvm->sta_drained_wk); | ||
710 | } | ||
711 | spin_unlock_bh(&mvmsta->lock); | ||
712 | } else if (!mvmsta) { | ||
713 | /* Tx response without STA, so we are draining */ | ||
714 | set_bit(sta_id, mvm->sta_drained); | ||
715 | schedule_work(&mvm->sta_drained_wk); | ||
716 | } | ||
693 | } | 717 | } |
694 | 718 | ||
695 | rcu_read_unlock(); | 719 | rcu_read_unlock(); |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index b878a32e7a98..cb34c7895f2a 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -1723,11 +1723,11 @@ static void mac80211_hwsim_free(void) | |||
1723 | class_destroy(hwsim_class); | 1723 | class_destroy(hwsim_class); |
1724 | } | 1724 | } |
1725 | 1725 | ||
1726 | 1726 | static struct platform_driver mac80211_hwsim_driver = { | |
1727 | static struct device_driver mac80211_hwsim_driver = { | 1727 | .driver = { |
1728 | .name = "mac80211_hwsim", | 1728 | .name = "mac80211_hwsim", |
1729 | .bus = &platform_bus_type, | 1729 | .owner = THIS_MODULE, |
1730 | .owner = THIS_MODULE, | 1730 | }, |
1731 | }; | 1731 | }; |
1732 | 1732 | ||
1733 | static const struct net_device_ops hwsim_netdev_ops = { | 1733 | static const struct net_device_ops hwsim_netdev_ops = { |
@@ -2219,7 +2219,7 @@ static int __init init_mac80211_hwsim(void) | |||
2219 | spin_lock_init(&hwsim_radio_lock); | 2219 | spin_lock_init(&hwsim_radio_lock); |
2220 | INIT_LIST_HEAD(&hwsim_radios); | 2220 | INIT_LIST_HEAD(&hwsim_radios); |
2221 | 2221 | ||
2222 | err = driver_register(&mac80211_hwsim_driver); | 2222 | err = platform_driver_register(&mac80211_hwsim_driver); |
2223 | if (err) | 2223 | if (err) |
2224 | return err; | 2224 | return err; |
2225 | 2225 | ||
@@ -2254,7 +2254,7 @@ static int __init init_mac80211_hwsim(void) | |||
2254 | err = -ENOMEM; | 2254 | err = -ENOMEM; |
2255 | goto failed_drvdata; | 2255 | goto failed_drvdata; |
2256 | } | 2256 | } |
2257 | data->dev->driver = &mac80211_hwsim_driver; | 2257 | data->dev->driver = &mac80211_hwsim_driver.driver; |
2258 | err = device_bind_driver(data->dev); | 2258 | err = device_bind_driver(data->dev); |
2259 | if (err != 0) { | 2259 | if (err != 0) { |
2260 | printk(KERN_DEBUG | 2260 | printk(KERN_DEBUG |
@@ -2564,7 +2564,7 @@ failed_drvdata: | |||
2564 | failed: | 2564 | failed: |
2565 | mac80211_hwsim_free(); | 2565 | mac80211_hwsim_free(); |
2566 | failed_unregister_driver: | 2566 | failed_unregister_driver: |
2567 | driver_unregister(&mac80211_hwsim_driver); | 2567 | platform_driver_unregister(&mac80211_hwsim_driver); |
2568 | return err; | 2568 | return err; |
2569 | } | 2569 | } |
2570 | module_init(init_mac80211_hwsim); | 2570 | module_init(init_mac80211_hwsim); |
@@ -2577,6 +2577,6 @@ static void __exit exit_mac80211_hwsim(void) | |||
2577 | 2577 | ||
2578 | mac80211_hwsim_free(); | 2578 | mac80211_hwsim_free(); |
2579 | unregister_netdev(hwsim_mon); | 2579 | unregister_netdev(hwsim_mon); |
2580 | driver_unregister(&mac80211_hwsim_driver); | 2580 | platform_driver_unregister(&mac80211_hwsim_driver); |
2581 | } | 2581 | } |
2582 | module_exit(exit_mac80211_hwsim); | 2582 | module_exit(exit_mac80211_hwsim); |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index d3c8ece980d8..e42b266a023a 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -2234,9 +2234,6 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
2234 | if (wdev->netdev->reg_state == NETREG_REGISTERED) | 2234 | if (wdev->netdev->reg_state == NETREG_REGISTERED) |
2235 | unregister_netdevice(wdev->netdev); | 2235 | unregister_netdevice(wdev->netdev); |
2236 | 2236 | ||
2237 | if (wdev->netdev->reg_state == NETREG_UNREGISTERED) | ||
2238 | free_netdev(wdev->netdev); | ||
2239 | |||
2240 | /* Clear the priv in adapter */ | 2237 | /* Clear the priv in adapter */ |
2241 | priv->netdev = NULL; | 2238 | priv->netdev = NULL; |
2242 | 2239 | ||
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 74db0d24a579..26755d9acb55 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -1191,6 +1191,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter) | |||
1191 | adapter->if_ops.wakeup(adapter); | 1191 | adapter->if_ops.wakeup(adapter); |
1192 | adapter->hs_activated = false; | 1192 | adapter->hs_activated = false; |
1193 | adapter->is_hs_configured = false; | 1193 | adapter->is_hs_configured = false; |
1194 | adapter->is_suspended = false; | ||
1194 | mwifiex_hs_activated_event(mwifiex_get_priv(adapter, | 1195 | mwifiex_hs_activated_event(mwifiex_get_priv(adapter, |
1195 | MWIFIEX_BSS_ROLE_ANY), | 1196 | MWIFIEX_BSS_ROLE_ANY), |
1196 | false); | 1197 | false); |
diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c index 753b5682d53f..a5f9875cfd6e 100644 --- a/drivers/net/wireless/mwifiex/debugfs.c +++ b/drivers/net/wireless/mwifiex/debugfs.c | |||
@@ -26,10 +26,17 @@ | |||
26 | static struct dentry *mwifiex_dfs_dir; | 26 | static struct dentry *mwifiex_dfs_dir; |
27 | 27 | ||
28 | static char *bss_modes[] = { | 28 | static char *bss_modes[] = { |
29 | "Unknown", | 29 | "UNSPECIFIED", |
30 | "Ad-hoc", | 30 | "ADHOC", |
31 | "Managed", | 31 | "STATION", |
32 | "Auto" | 32 | "AP", |
33 | "AP_VLAN", | ||
34 | "WDS", | ||
35 | "MONITOR", | ||
36 | "MESH_POINT", | ||
37 | "P2P_CLIENT", | ||
38 | "P2P_GO", | ||
39 | "P2P_DEVICE", | ||
33 | }; | 40 | }; |
34 | 41 | ||
35 | /* size/addr for mwifiex_debug_info */ | 42 | /* size/addr for mwifiex_debug_info */ |
@@ -200,7 +207,12 @@ mwifiex_info_read(struct file *file, char __user *ubuf, | |||
200 | p += sprintf(p, "driver_version = %s", fmt); | 207 | p += sprintf(p, "driver_version = %s", fmt); |
201 | p += sprintf(p, "\nverext = %s", priv->version_str); | 208 | p += sprintf(p, "\nverext = %s", priv->version_str); |
202 | p += sprintf(p, "\ninterface_name=\"%s\"\n", netdev->name); | 209 | p += sprintf(p, "\ninterface_name=\"%s\"\n", netdev->name); |
203 | p += sprintf(p, "bss_mode=\"%s\"\n", bss_modes[info.bss_mode]); | 210 | |
211 | if (info.bss_mode >= ARRAY_SIZE(bss_modes)) | ||
212 | p += sprintf(p, "bss_mode=\"%d\"\n", info.bss_mode); | ||
213 | else | ||
214 | p += sprintf(p, "bss_mode=\"%s\"\n", bss_modes[info.bss_mode]); | ||
215 | |||
204 | p += sprintf(p, "media_state=\"%s\"\n", | 216 | p += sprintf(p, "media_state=\"%s\"\n", |
205 | (!priv->media_connected ? "Disconnected" : "Connected")); | 217 | (!priv->media_connected ? "Disconnected" : "Connected")); |
206 | p += sprintf(p, "mac_address=\"%pM\"\n", netdev->dev_addr); | 218 | p += sprintf(p, "mac_address=\"%pM\"\n", netdev->dev_addr); |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 121443a0f2a1..2eb88ea9acf7 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -655,6 +655,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, | |||
655 | struct net_device *dev) | 655 | struct net_device *dev) |
656 | { | 656 | { |
657 | dev->netdev_ops = &mwifiex_netdev_ops; | 657 | dev->netdev_ops = &mwifiex_netdev_ops; |
658 | dev->destructor = free_netdev; | ||
658 | /* Initialize private structure */ | 659 | /* Initialize private structure */ |
659 | priv->current_key_index = 0; | 660 | priv->current_key_index = 0; |
660 | priv->media_connected = false; | 661 | priv->media_connected = false; |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 311d0b26b81c..1a8a19dbd635 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -96,7 +96,7 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, | |||
96 | } else { | 96 | } else { |
97 | /* Multicast */ | 97 | /* Multicast */ |
98 | priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_PROMISCUOUS_ENABLE; | 98 | priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_PROMISCUOUS_ENABLE; |
99 | if (mcast_list->mode == MWIFIEX_MULTICAST_MODE) { | 99 | if (mcast_list->mode == MWIFIEX_ALL_MULTI_MODE) { |
100 | dev_dbg(priv->adapter->dev, | 100 | dev_dbg(priv->adapter->dev, |
101 | "info: Enabling All Multicast!\n"); | 101 | "info: Enabling All Multicast!\n"); |
102 | priv->curr_pkt_filter |= | 102 | priv->curr_pkt_filter |= |
@@ -108,20 +108,11 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, | |||
108 | dev_dbg(priv->adapter->dev, | 108 | dev_dbg(priv->adapter->dev, |
109 | "info: Set multicast list=%d\n", | 109 | "info: Set multicast list=%d\n", |
110 | mcast_list->num_multicast_addr); | 110 | mcast_list->num_multicast_addr); |
111 | /* Set multicast addresses to firmware */ | 111 | /* Send multicast addresses to firmware */ |
112 | if (old_pkt_filter == priv->curr_pkt_filter) { | 112 | ret = mwifiex_send_cmd_async(priv, |
113 | /* Send request to firmware */ | 113 | HostCmd_CMD_MAC_MULTICAST_ADR, |
114 | ret = mwifiex_send_cmd_async(priv, | 114 | HostCmd_ACT_GEN_SET, 0, |
115 | HostCmd_CMD_MAC_MULTICAST_ADR, | 115 | mcast_list); |
116 | HostCmd_ACT_GEN_SET, 0, | ||
117 | mcast_list); | ||
118 | } else { | ||
119 | /* Send request to firmware */ | ||
120 | ret = mwifiex_send_cmd_async(priv, | ||
121 | HostCmd_CMD_MAC_MULTICAST_ADR, | ||
122 | HostCmd_ACT_GEN_SET, 0, | ||
123 | mcast_list); | ||
124 | } | ||
125 | } | 116 | } |
126 | } | 117 | } |
127 | } | 118 | } |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 999ffc12578b..c97e9d327331 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -764,6 +764,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
764 | "can't alloc skb for rx\n"); | 764 | "can't alloc skb for rx\n"); |
765 | goto done; | 765 | goto done; |
766 | } | 766 | } |
767 | kmemleak_not_leak(new_skb); | ||
767 | 768 | ||
768 | pci_unmap_single(rtlpci->pdev, | 769 | pci_unmap_single(rtlpci->pdev, |
769 | *((dma_addr_t *) skb->cb), | 770 | *((dma_addr_t *) skb->cb), |
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h index d3a02e73f53a..21ca33a7c770 100644 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h | |||
@@ -550,7 +550,7 @@ do { \ | |||
550 | rxmcs == DESC92C_RATE11M) | 550 | rxmcs == DESC92C_RATE11M) |
551 | 551 | ||
552 | struct phy_rx_agc_info_t { | 552 | struct phy_rx_agc_info_t { |
553 | #if __LITTLE_ENDIAN | 553 | #ifdef __LITTLE_ENDIAN |
554 | u8 gain:7, trsw:1; | 554 | u8 gain:7, trsw:1; |
555 | #else | 555 | #else |
556 | u8 trsw:1, gain:7; | 556 | u8 trsw:1, gain:7; |
@@ -574,7 +574,7 @@ struct phy_status_rpt { | |||
574 | u8 stream_target_csi[2]; | 574 | u8 stream_target_csi[2]; |
575 | u8 sig_evm; | 575 | u8 sig_evm; |
576 | u8 rsvd_3; | 576 | u8 rsvd_3; |
577 | #if __LITTLE_ENDIAN | 577 | #ifdef __LITTLE_ENDIAN |
578 | u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ | 578 | u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ |
579 | u8 sgi_en:1; | 579 | u8 sgi_en:1; |
580 | u8 rxsc:2; | 580 | u8 rxsc:2; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index 3d0498e69c8c..189ba124a8c6 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
@@ -1973,26 +1973,35 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1973 | } | 1973 | } |
1974 | } | 1974 | } |
1975 | 1975 | ||
1976 | void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | 1976 | static void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, |
1977 | struct ieee80211_sta *sta, | 1977 | struct ieee80211_sta *sta) |
1978 | u8 rssi_level) | ||
1979 | { | 1978 | { |
1980 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1979 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1981 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 1980 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
1982 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 1981 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
1983 | u32 ratr_value = (u32) mac->basic_rates; | 1982 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
1984 | u8 *mcsrate = mac->mcs; | 1983 | u32 ratr_value; |
1985 | u8 ratr_index = 0; | 1984 | u8 ratr_index = 0; |
1986 | u8 nmode = mac->ht_enable; | 1985 | u8 nmode = mac->ht_enable; |
1987 | u8 mimo_ps = 1; | 1986 | u8 mimo_ps = IEEE80211_SMPS_OFF; |
1988 | u16 shortgi_rate = 0; | 1987 | u16 shortgi_rate; |
1989 | u32 tmp_ratr_value = 0; | 1988 | u32 tmp_ratr_value; |
1990 | u8 curtxbw_40mhz = mac->bw_40; | 1989 | u8 curtxbw_40mhz = mac->bw_40; |
1991 | u8 curshortgi_40mhz = mac->sgi_40; | 1990 | u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? |
1992 | u8 curshortgi_20mhz = mac->sgi_20; | 1991 | 1 : 0; |
1992 | u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? | ||
1993 | 1 : 0; | ||
1993 | enum wireless_mode wirelessmode = mac->mode; | 1994 | enum wireless_mode wirelessmode = mac->mode; |
1994 | 1995 | ||
1995 | ratr_value |= ((*(u16 *) (mcsrate))) << 12; | 1996 | if (rtlhal->current_bandtype == BAND_ON_5G) |
1997 | ratr_value = sta->supp_rates[1] << 4; | ||
1998 | else | ||
1999 | ratr_value = sta->supp_rates[0]; | ||
2000 | if (mac->opmode == NL80211_IFTYPE_ADHOC) | ||
2001 | ratr_value = 0xfff; | ||
2002 | |||
2003 | ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 | | ||
2004 | sta->ht_cap.mcs.rx_mask[0] << 12); | ||
1996 | switch (wirelessmode) { | 2005 | switch (wirelessmode) { |
1997 | case WIRELESS_MODE_B: | 2006 | case WIRELESS_MODE_B: |
1998 | if (ratr_value & 0x0000000c) | 2007 | if (ratr_value & 0x0000000c) |
@@ -2006,7 +2015,7 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | |||
2006 | case WIRELESS_MODE_N_24G: | 2015 | case WIRELESS_MODE_N_24G: |
2007 | case WIRELESS_MODE_N_5G: | 2016 | case WIRELESS_MODE_N_5G: |
2008 | nmode = 1; | 2017 | nmode = 1; |
2009 | if (mimo_ps == 0) { | 2018 | if (mimo_ps == IEEE80211_SMPS_STATIC) { |
2010 | ratr_value &= 0x0007F005; | 2019 | ratr_value &= 0x0007F005; |
2011 | } else { | 2020 | } else { |
2012 | u32 ratr_mask; | 2021 | u32 ratr_mask; |
@@ -2016,8 +2025,7 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | |||
2016 | ratr_mask = 0x000ff005; | 2025 | ratr_mask = 0x000ff005; |
2017 | else | 2026 | else |
2018 | ratr_mask = 0x0f0ff005; | 2027 | ratr_mask = 0x0f0ff005; |
2019 | if (curtxbw_40mhz) | 2028 | |
2020 | ratr_mask |= 0x00000010; | ||
2021 | ratr_value &= ratr_mask; | 2029 | ratr_value &= ratr_mask; |
2022 | } | 2030 | } |
2023 | break; | 2031 | break; |
@@ -2026,41 +2034,74 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | |||
2026 | ratr_value &= 0x000ff0ff; | 2034 | ratr_value &= 0x000ff0ff; |
2027 | else | 2035 | else |
2028 | ratr_value &= 0x0f0ff0ff; | 2036 | ratr_value &= 0x0f0ff0ff; |
2037 | |||
2029 | break; | 2038 | break; |
2030 | } | 2039 | } |
2040 | |||
2031 | ratr_value &= 0x0FFFFFFF; | 2041 | ratr_value &= 0x0FFFFFFF; |
2032 | if (nmode && ((curtxbw_40mhz && curshortgi_40mhz) || | 2042 | |
2033 | (!curtxbw_40mhz && curshortgi_20mhz))) { | 2043 | if (nmode && ((curtxbw_40mhz && |
2044 | curshortgi_40mhz) || (!curtxbw_40mhz && | ||
2045 | curshortgi_20mhz))) { | ||
2046 | |||
2034 | ratr_value |= 0x10000000; | 2047 | ratr_value |= 0x10000000; |
2035 | tmp_ratr_value = (ratr_value >> 12); | 2048 | tmp_ratr_value = (ratr_value >> 12); |
2049 | |||
2036 | for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { | 2050 | for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { |
2037 | if ((1 << shortgi_rate) & tmp_ratr_value) | 2051 | if ((1 << shortgi_rate) & tmp_ratr_value) |
2038 | break; | 2052 | break; |
2039 | } | 2053 | } |
2054 | |||
2040 | shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | | 2055 | shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | |
2041 | (shortgi_rate << 4) | (shortgi_rate); | 2056 | (shortgi_rate << 4) | (shortgi_rate); |
2042 | } | 2057 | } |
2058 | |||
2043 | rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); | 2059 | rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); |
2060 | |||
2061 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n", | ||
2062 | rtl_read_dword(rtlpriv, REG_ARFR0)); | ||
2044 | } | 2063 | } |
2045 | 2064 | ||
2046 | void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | 2065 | static void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, |
2066 | struct ieee80211_sta *sta, | ||
2067 | u8 rssi_level) | ||
2047 | { | 2068 | { |
2048 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 2069 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2049 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 2070 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
2050 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 2071 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
2051 | u32 ratr_bitmap = (u32) mac->basic_rates; | 2072 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
2052 | u8 *p_mcsrate = mac->mcs; | 2073 | struct rtl_sta_info *sta_entry = NULL; |
2053 | u8 ratr_index = 0; | 2074 | u32 ratr_bitmap; |
2054 | u8 curtxbw_40mhz = mac->bw_40; | 2075 | u8 ratr_index; |
2055 | u8 curshortgi_40mhz = mac->sgi_40; | 2076 | u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0; |
2056 | u8 curshortgi_20mhz = mac->sgi_20; | 2077 | u8 curshortgi_40mhz = curtxbw_40mhz && |
2057 | enum wireless_mode wirelessmode = mac->mode; | 2078 | (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? |
2079 | 1 : 0; | ||
2080 | u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? | ||
2081 | 1 : 0; | ||
2082 | enum wireless_mode wirelessmode = 0; | ||
2058 | bool shortgi = false; | 2083 | bool shortgi = false; |
2059 | u8 rate_mask[5]; | 2084 | u8 rate_mask[5]; |
2060 | u8 macid = 0; | 2085 | u8 macid = 0; |
2061 | u8 mimops = 1; | 2086 | u8 mimo_ps = IEEE80211_SMPS_OFF; |
2062 | 2087 | ||
2063 | ratr_bitmap |= (p_mcsrate[1] << 20) | (p_mcsrate[0] << 12); | 2088 | sta_entry = (struct rtl_sta_info *) sta->drv_priv; |
2089 | wirelessmode = sta_entry->wireless_mode; | ||
2090 | if (mac->opmode == NL80211_IFTYPE_STATION || | ||
2091 | mac->opmode == NL80211_IFTYPE_MESH_POINT) | ||
2092 | curtxbw_40mhz = mac->bw_40; | ||
2093 | else if (mac->opmode == NL80211_IFTYPE_AP || | ||
2094 | mac->opmode == NL80211_IFTYPE_ADHOC) | ||
2095 | macid = sta->aid + 1; | ||
2096 | |||
2097 | if (rtlhal->current_bandtype == BAND_ON_5G) | ||
2098 | ratr_bitmap = sta->supp_rates[1] << 4; | ||
2099 | else | ||
2100 | ratr_bitmap = sta->supp_rates[0]; | ||
2101 | if (mac->opmode == NL80211_IFTYPE_ADHOC) | ||
2102 | ratr_bitmap = 0xfff; | ||
2103 | ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 | | ||
2104 | sta->ht_cap.mcs.rx_mask[0] << 12); | ||
2064 | switch (wirelessmode) { | 2105 | switch (wirelessmode) { |
2065 | case WIRELESS_MODE_B: | 2106 | case WIRELESS_MODE_B: |
2066 | ratr_index = RATR_INX_WIRELESS_B; | 2107 | ratr_index = RATR_INX_WIRELESS_B; |
@@ -2071,6 +2112,7 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | |||
2071 | break; | 2112 | break; |
2072 | case WIRELESS_MODE_G: | 2113 | case WIRELESS_MODE_G: |
2073 | ratr_index = RATR_INX_WIRELESS_GB; | 2114 | ratr_index = RATR_INX_WIRELESS_GB; |
2115 | |||
2074 | if (rssi_level == 1) | 2116 | if (rssi_level == 1) |
2075 | ratr_bitmap &= 0x00000f00; | 2117 | ratr_bitmap &= 0x00000f00; |
2076 | else if (rssi_level == 2) | 2118 | else if (rssi_level == 2) |
@@ -2085,7 +2127,8 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | |||
2085 | case WIRELESS_MODE_N_24G: | 2127 | case WIRELESS_MODE_N_24G: |
2086 | case WIRELESS_MODE_N_5G: | 2128 | case WIRELESS_MODE_N_5G: |
2087 | ratr_index = RATR_INX_WIRELESS_NGB; | 2129 | ratr_index = RATR_INX_WIRELESS_NGB; |
2088 | if (mimops == 0) { | 2130 | |
2131 | if (mimo_ps == IEEE80211_SMPS_STATIC) { | ||
2089 | if (rssi_level == 1) | 2132 | if (rssi_level == 1) |
2090 | ratr_bitmap &= 0x00070000; | 2133 | ratr_bitmap &= 0x00070000; |
2091 | else if (rssi_level == 2) | 2134 | else if (rssi_level == 2) |
@@ -2128,8 +2171,10 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | |||
2128 | } | 2171 | } |
2129 | } | 2172 | } |
2130 | } | 2173 | } |
2174 | |||
2131 | if ((curtxbw_40mhz && curshortgi_40mhz) || | 2175 | if ((curtxbw_40mhz && curshortgi_40mhz) || |
2132 | (!curtxbw_40mhz && curshortgi_20mhz)) { | 2176 | (!curtxbw_40mhz && curshortgi_20mhz)) { |
2177 | |||
2133 | if (macid == 0) | 2178 | if (macid == 0) |
2134 | shortgi = true; | 2179 | shortgi = true; |
2135 | else if (macid == 1) | 2180 | else if (macid == 1) |
@@ -2138,21 +2183,42 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | |||
2138 | break; | 2183 | break; |
2139 | default: | 2184 | default: |
2140 | ratr_index = RATR_INX_WIRELESS_NGB; | 2185 | ratr_index = RATR_INX_WIRELESS_NGB; |
2186 | |||
2141 | if (rtlphy->rf_type == RF_1T2R) | 2187 | if (rtlphy->rf_type == RF_1T2R) |
2142 | ratr_bitmap &= 0x000ff0ff; | 2188 | ratr_bitmap &= 0x000ff0ff; |
2143 | else | 2189 | else |
2144 | ratr_bitmap &= 0x0f0ff0ff; | 2190 | ratr_bitmap &= 0x0f0ff0ff; |
2145 | break; | 2191 | break; |
2146 | } | 2192 | } |
2147 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "ratr_bitmap :%x\n", | 2193 | sta_entry->ratr_index = ratr_index; |
2148 | ratr_bitmap); | 2194 | |
2149 | *(u32 *)&rate_mask = ((ratr_bitmap & 0x0fffffff) | | 2195 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, |
2150 | ratr_index << 28); | 2196 | "ratr_bitmap :%x\n", ratr_bitmap); |
2197 | *(u32 *)&rate_mask = (ratr_bitmap & 0x0fffffff) | | ||
2198 | (ratr_index << 28); | ||
2151 | rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; | 2199 | rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; |
2152 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, | 2200 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, |
2153 | "Rate_index:%x, ratr_val:%x, %5phC\n", | 2201 | "Rate_index:%x, ratr_val:%x, %5phC\n", |
2154 | ratr_index, ratr_bitmap, rate_mask); | 2202 | ratr_index, ratr_bitmap, rate_mask); |
2155 | rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask); | 2203 | memcpy(rtlpriv->rate_mask, rate_mask, 5); |
2204 | /* rtl92c_fill_h2c_cmd() does USB I/O and will result in a | ||
2205 | * "scheduled while atomic" if called directly */ | ||
2206 | schedule_work(&rtlpriv->works.fill_h2c_cmd); | ||
2207 | |||
2208 | if (macid != 0) | ||
2209 | sta_entry->ratr_index = ratr_index; | ||
2210 | } | ||
2211 | |||
2212 | void rtl92cu_update_hal_rate_tbl(struct ieee80211_hw *hw, | ||
2213 | struct ieee80211_sta *sta, | ||
2214 | u8 rssi_level) | ||
2215 | { | ||
2216 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
2217 | |||
2218 | if (rtlpriv->dm.useramask) | ||
2219 | rtl92cu_update_hal_rate_mask(hw, sta, rssi_level); | ||
2220 | else | ||
2221 | rtl92cu_update_hal_rate_table(hw, sta); | ||
2156 | } | 2222 | } |
2157 | 2223 | ||
2158 | void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw) | 2224 | void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h index f41a3aa4a26f..8e3ec1e25644 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h | |||
@@ -98,10 +98,6 @@ void rtl92cu_update_interrupt_mask(struct ieee80211_hw *hw, | |||
98 | u32 add_msr, u32 rm_msr); | 98 | u32 add_msr, u32 rm_msr); |
99 | void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); | 99 | void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); |
100 | void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); | 100 | void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); |
101 | void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | ||
102 | struct ieee80211_sta *sta, | ||
103 | u8 rssi_level); | ||
104 | void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level); | ||
105 | 101 | ||
106 | void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw); | 102 | void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw); |
107 | bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid); | 103 | bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c index 85b6bdb163c0..da4f587199ee 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c | |||
@@ -289,14 +289,30 @@ void rtl92c_set_key(struct ieee80211_hw *hw, u32 key_index, | |||
289 | macaddr = cam_const_broad; | 289 | macaddr = cam_const_broad; |
290 | entry_id = key_index; | 290 | entry_id = key_index; |
291 | } else { | 291 | } else { |
292 | if (mac->opmode == NL80211_IFTYPE_AP || | ||
293 | mac->opmode == NL80211_IFTYPE_MESH_POINT) { | ||
294 | entry_id = rtl_cam_get_free_entry(hw, | ||
295 | p_macaddr); | ||
296 | if (entry_id >= TOTAL_CAM_ENTRY) { | ||
297 | RT_TRACE(rtlpriv, COMP_SEC, | ||
298 | DBG_EMERG, | ||
299 | "Can not find free hw security cam entry\n"); | ||
300 | return; | ||
301 | } | ||
302 | } else { | ||
303 | entry_id = CAM_PAIRWISE_KEY_POSITION; | ||
304 | } | ||
305 | |||
292 | key_index = PAIRWISE_KEYIDX; | 306 | key_index = PAIRWISE_KEYIDX; |
293 | entry_id = CAM_PAIRWISE_KEY_POSITION; | ||
294 | is_pairwise = true; | 307 | is_pairwise = true; |
295 | } | 308 | } |
296 | } | 309 | } |
297 | if (rtlpriv->sec.key_len[key_index] == 0) { | 310 | if (rtlpriv->sec.key_len[key_index] == 0) { |
298 | RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, | 311 | RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, |
299 | "delete one entry\n"); | 312 | "delete one entry\n"); |
313 | if (mac->opmode == NL80211_IFTYPE_AP || | ||
314 | mac->opmode == NL80211_IFTYPE_MESH_POINT) | ||
315 | rtl_cam_del_entry(hw, p_macaddr); | ||
300 | rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); | 316 | rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); |
301 | } else { | 317 | } else { |
302 | RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, | 318 | RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index 23d640a4debd..826f085c29dd 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | |||
@@ -106,8 +106,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = { | |||
106 | .update_interrupt_mask = rtl92cu_update_interrupt_mask, | 106 | .update_interrupt_mask = rtl92cu_update_interrupt_mask, |
107 | .get_hw_reg = rtl92cu_get_hw_reg, | 107 | .get_hw_reg = rtl92cu_get_hw_reg, |
108 | .set_hw_reg = rtl92cu_set_hw_reg, | 108 | .set_hw_reg = rtl92cu_set_hw_reg, |
109 | .update_rate_tbl = rtl92cu_update_hal_rate_table, | 109 | .update_rate_tbl = rtl92cu_update_hal_rate_tbl, |
110 | .update_rate_mask = rtl92cu_update_hal_rate_mask, | ||
111 | .fill_tx_desc = rtl92cu_tx_fill_desc, | 110 | .fill_tx_desc = rtl92cu_tx_fill_desc, |
112 | .fill_fake_txdesc = rtl92cu_fill_fake_txdesc, | 111 | .fill_fake_txdesc = rtl92cu_fill_fake_txdesc, |
113 | .fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc, | 112 | .fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc, |
@@ -137,6 +136,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = { | |||
137 | .phy_lc_calibrate = _rtl92cu_phy_lc_calibrate, | 136 | .phy_lc_calibrate = _rtl92cu_phy_lc_calibrate, |
138 | .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback, | 137 | .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback, |
139 | .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower, | 138 | .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower, |
139 | .fill_h2c_cmd = rtl92c_fill_h2c_cmd, | ||
140 | }; | 140 | }; |
141 | 141 | ||
142 | static struct rtl_mod_params rtl92cu_mod_params = { | 142 | static struct rtl_mod_params rtl92cu_mod_params = { |
@@ -349,6 +349,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { | |||
349 | {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/ | 349 | {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/ |
350 | {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ | 350 | {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ |
351 | {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ | 351 | {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ |
352 | {RTL_USB_DEVICE(0x0846, 0xf001, rtl92cu_hal_cfg)}, /*On Netwrks N300MA*/ | ||
352 | {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ | 353 | {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ |
353 | {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ | 354 | {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ |
354 | {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ | 355 | {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h index a1310abd0d54..262e1e4c6e5b 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h | |||
@@ -49,5 +49,8 @@ bool rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw, | |||
49 | u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw, | 49 | u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw, |
50 | enum radio_path rfpath, u32 regaddr, u32 bitmask); | 50 | enum radio_path rfpath, u32 regaddr, u32 bitmask); |
51 | void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw); | 51 | void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw); |
52 | void rtl92cu_update_hal_rate_tbl(struct ieee80211_hw *hw, | ||
53 | struct ieee80211_sta *sta, | ||
54 | u8 rssi_level); | ||
52 | 55 | ||
53 | #endif | 56 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 76732b0cd221..a3532e077871 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -824,6 +824,7 @@ static void rtl_usb_stop(struct ieee80211_hw *hw) | |||
824 | 824 | ||
825 | /* should after adapter start and interrupt enable. */ | 825 | /* should after adapter start and interrupt enable. */ |
826 | set_hal_stop(rtlhal); | 826 | set_hal_stop(rtlhal); |
827 | cancel_work_sync(&rtlpriv->works.fill_h2c_cmd); | ||
827 | /* Enable software */ | 828 | /* Enable software */ |
828 | SET_USB_STOP(rtlusb); | 829 | SET_USB_STOP(rtlusb); |
829 | rtl_usb_deinit(hw); | 830 | rtl_usb_deinit(hw); |
@@ -1026,6 +1027,16 @@ static bool rtl_usb_tx_chk_waitq_insert(struct ieee80211_hw *hw, | |||
1026 | return false; | 1027 | return false; |
1027 | } | 1028 | } |
1028 | 1029 | ||
1030 | static void rtl_fill_h2c_cmd_work_callback(struct work_struct *work) | ||
1031 | { | ||
1032 | struct rtl_works *rtlworks = | ||
1033 | container_of(work, struct rtl_works, fill_h2c_cmd); | ||
1034 | struct ieee80211_hw *hw = rtlworks->hw; | ||
1035 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
1036 | |||
1037 | rtlpriv->cfg->ops->fill_h2c_cmd(hw, H2C_RA_MASK, 5, rtlpriv->rate_mask); | ||
1038 | } | ||
1039 | |||
1029 | static struct rtl_intf_ops rtl_usb_ops = { | 1040 | static struct rtl_intf_ops rtl_usb_ops = { |
1030 | .adapter_start = rtl_usb_start, | 1041 | .adapter_start = rtl_usb_start, |
1031 | .adapter_stop = rtl_usb_stop, | 1042 | .adapter_stop = rtl_usb_stop, |
@@ -1057,6 +1068,8 @@ int rtl_usb_probe(struct usb_interface *intf, | |||
1057 | 1068 | ||
1058 | /* this spin lock must be initialized early */ | 1069 | /* this spin lock must be initialized early */ |
1059 | spin_lock_init(&rtlpriv->locks.usb_lock); | 1070 | spin_lock_init(&rtlpriv->locks.usb_lock); |
1071 | INIT_WORK(&rtlpriv->works.fill_h2c_cmd, | ||
1072 | rtl_fill_h2c_cmd_work_callback); | ||
1060 | 1073 | ||
1061 | rtlpriv->usb_data_index = 0; | 1074 | rtlpriv->usb_data_index = 0; |
1062 | init_completion(&rtlpriv->firmware_loading_complete); | 1075 | init_completion(&rtlpriv->firmware_loading_complete); |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index 44328baa6389..cc03e7c87cbe 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -1736,6 +1736,8 @@ struct rtl_hal_ops { | |||
1736 | void (*bt_wifi_media_status_notify) (struct ieee80211_hw *hw, | 1736 | void (*bt_wifi_media_status_notify) (struct ieee80211_hw *hw, |
1737 | bool mstate); | 1737 | bool mstate); |
1738 | void (*bt_coex_off_before_lps) (struct ieee80211_hw *hw); | 1738 | void (*bt_coex_off_before_lps) (struct ieee80211_hw *hw); |
1739 | void (*fill_h2c_cmd) (struct ieee80211_hw *hw, u8 element_id, | ||
1740 | u32 cmd_len, u8 *p_cmdbuffer); | ||
1739 | }; | 1741 | }; |
1740 | 1742 | ||
1741 | struct rtl_intf_ops { | 1743 | struct rtl_intf_ops { |
@@ -1869,6 +1871,7 @@ struct rtl_works { | |||
1869 | struct delayed_work fwevt_wq; | 1871 | struct delayed_work fwevt_wq; |
1870 | 1872 | ||
1871 | struct work_struct lps_change_work; | 1873 | struct work_struct lps_change_work; |
1874 | struct work_struct fill_h2c_cmd; | ||
1872 | }; | 1875 | }; |
1873 | 1876 | ||
1874 | struct rtl_debug { | 1877 | struct rtl_debug { |
@@ -2048,6 +2051,7 @@ struct rtl_priv { | |||
2048 | }; | 2051 | }; |
2049 | }; | 2052 | }; |
2050 | bool enter_ps; /* true when entering PS */ | 2053 | bool enter_ps; /* true when entering PS */ |
2054 | u8 rate_mask[5]; | ||
2051 | 2055 | ||
2052 | /*This must be the last item so | 2056 | /*This must be the last item so |
2053 | that it points to the data allocated | 2057 | that it points to the data allocated |
diff --git a/drivers/net/wireless/ti/wl12xx/scan.c b/drivers/net/wireless/ti/wl12xx/scan.c index affdb3ec6225..4a0bbb13806b 100644 --- a/drivers/net/wireless/ti/wl12xx/scan.c +++ b/drivers/net/wireless/ti/wl12xx/scan.c | |||
@@ -310,7 +310,7 @@ static void wl12xx_adjust_channels(struct wl1271_cmd_sched_scan_config *cmd, | |||
310 | memcpy(cmd->channels_2, cmd_channels->channels_2, | 310 | memcpy(cmd->channels_2, cmd_channels->channels_2, |
311 | sizeof(cmd->channels_2)); | 311 | sizeof(cmd->channels_2)); |
312 | memcpy(cmd->channels_5, cmd_channels->channels_5, | 312 | memcpy(cmd->channels_5, cmd_channels->channels_5, |
313 | sizeof(cmd->channels_2)); | 313 | sizeof(cmd->channels_5)); |
314 | /* channels_4 are not supported, so no need to copy them */ | 314 | /* channels_4 are not supported, so no need to copy them */ |
315 | } | 315 | } |
316 | 316 | ||
diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h index 222d03540200..9e5484a73667 100644 --- a/drivers/net/wireless/ti/wl12xx/wl12xx.h +++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h | |||
@@ -36,12 +36,12 @@ | |||
36 | #define WL127X_IFTYPE_SR_VER 3 | 36 | #define WL127X_IFTYPE_SR_VER 3 |
37 | #define WL127X_MAJOR_SR_VER 10 | 37 | #define WL127X_MAJOR_SR_VER 10 |
38 | #define WL127X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE | 38 | #define WL127X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE |
39 | #define WL127X_MINOR_SR_VER 115 | 39 | #define WL127X_MINOR_SR_VER 133 |
40 | /* minimum multi-role FW version for wl127x */ | 40 | /* minimum multi-role FW version for wl127x */ |
41 | #define WL127X_IFTYPE_MR_VER 5 | 41 | #define WL127X_IFTYPE_MR_VER 5 |
42 | #define WL127X_MAJOR_MR_VER 7 | 42 | #define WL127X_MAJOR_MR_VER 7 |
43 | #define WL127X_SUBTYPE_MR_VER WLCORE_FW_VER_IGNORE | 43 | #define WL127X_SUBTYPE_MR_VER WLCORE_FW_VER_IGNORE |
44 | #define WL127X_MINOR_MR_VER 115 | 44 | #define WL127X_MINOR_MR_VER 42 |
45 | 45 | ||
46 | /* FW chip version for wl128x */ | 46 | /* FW chip version for wl128x */ |
47 | #define WL128X_CHIP_VER 7 | 47 | #define WL128X_CHIP_VER 7 |
@@ -49,7 +49,7 @@ | |||
49 | #define WL128X_IFTYPE_SR_VER 3 | 49 | #define WL128X_IFTYPE_SR_VER 3 |
50 | #define WL128X_MAJOR_SR_VER 10 | 50 | #define WL128X_MAJOR_SR_VER 10 |
51 | #define WL128X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE | 51 | #define WL128X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE |
52 | #define WL128X_MINOR_SR_VER 115 | 52 | #define WL128X_MINOR_SR_VER 133 |
53 | /* minimum multi-role FW version for wl128x */ | 53 | /* minimum multi-role FW version for wl128x */ |
54 | #define WL128X_IFTYPE_MR_VER 5 | 54 | #define WL128X_IFTYPE_MR_VER 5 |
55 | #define WL128X_MAJOR_MR_VER 7 | 55 | #define WL128X_MAJOR_MR_VER 7 |
diff --git a/drivers/net/wireless/ti/wl18xx/scan.c b/drivers/net/wireless/ti/wl18xx/scan.c index 09d944505ac0..2b642f8c9266 100644 --- a/drivers/net/wireless/ti/wl18xx/scan.c +++ b/drivers/net/wireless/ti/wl18xx/scan.c | |||
@@ -34,7 +34,7 @@ static void wl18xx_adjust_channels(struct wl18xx_cmd_scan_params *cmd, | |||
34 | memcpy(cmd->channels_2, cmd_channels->channels_2, | 34 | memcpy(cmd->channels_2, cmd_channels->channels_2, |
35 | sizeof(cmd->channels_2)); | 35 | sizeof(cmd->channels_2)); |
36 | memcpy(cmd->channels_5, cmd_channels->channels_5, | 36 | memcpy(cmd->channels_5, cmd_channels->channels_5, |
37 | sizeof(cmd->channels_2)); | 37 | sizeof(cmd->channels_5)); |
38 | /* channels_4 are not supported, so no need to copy them */ | 38 | /* channels_4 are not supported, so no need to copy them */ |
39 | } | 39 | } |
40 | 40 | ||
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 37984e6d4e99..8c20935d72c9 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -662,7 +662,7 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk) | |||
662 | { | 662 | { |
663 | struct xenvif *vif = NULL, *tmp; | 663 | struct xenvif *vif = NULL, *tmp; |
664 | s8 status; | 664 | s8 status; |
665 | u16 irq, flags; | 665 | u16 flags; |
666 | struct xen_netif_rx_response *resp; | 666 | struct xen_netif_rx_response *resp; |
667 | struct sk_buff_head rxq; | 667 | struct sk_buff_head rxq; |
668 | struct sk_buff *skb; | 668 | struct sk_buff *skb; |
@@ -771,13 +771,13 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk) | |||
771 | sco->meta_slots_used); | 771 | sco->meta_slots_used); |
772 | 772 | ||
773 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret); | 773 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret); |
774 | irq = vif->irq; | ||
775 | if (ret && list_empty(&vif->notify_list)) | ||
776 | list_add_tail(&vif->notify_list, ¬ify); | ||
777 | 774 | ||
778 | xenvif_notify_tx_completion(vif); | 775 | xenvif_notify_tx_completion(vif); |
779 | 776 | ||
780 | xenvif_put(vif); | 777 | if (ret && list_empty(&vif->notify_list)) |
778 | list_add_tail(&vif->notify_list, ¬ify); | ||
779 | else | ||
780 | xenvif_put(vif); | ||
781 | npo.meta_cons += sco->meta_slots_used; | 781 | npo.meta_cons += sco->meta_slots_used; |
782 | dev_kfree_skb(skb); | 782 | dev_kfree_skb(skb); |
783 | } | 783 | } |
@@ -785,6 +785,7 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk) | |||
785 | list_for_each_entry_safe(vif, tmp, ¬ify, notify_list) { | 785 | list_for_each_entry_safe(vif, tmp, ¬ify, notify_list) { |
786 | notify_remote_via_irq(vif->irq); | 786 | notify_remote_via_irq(vif->irq); |
787 | list_del_init(&vif->notify_list); | 787 | list_del_init(&vif->notify_list); |
788 | xenvif_put(vif); | ||
788 | } | 789 | } |
789 | 790 | ||
790 | /* More work to do? */ | 791 | /* More work to do? */ |
diff --git a/drivers/nfc/Kconfig b/drivers/nfc/Kconfig index 4775d4e61b88..74a852e4e41f 100644 --- a/drivers/nfc/Kconfig +++ b/drivers/nfc/Kconfig | |||
@@ -28,7 +28,7 @@ config NFC_WILINK | |||
28 | 28 | ||
29 | config NFC_MEI_PHY | 29 | config NFC_MEI_PHY |
30 | tristate "MEI bus NFC device support" | 30 | tristate "MEI bus NFC device support" |
31 | depends on INTEL_MEI_BUS_NFC && NFC_HCI | 31 | depends on INTEL_MEI && NFC_HCI |
32 | help | 32 | help |
33 | This adds support to use an mei bus nfc device. Select this if you | 33 | This adds support to use an mei bus nfc device. Select this if you |
34 | will use an HCI NFC driver for an NFC chip connected behind an | 34 | will use an HCI NFC driver for an NFC chip connected behind an |
diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c index b8f8abc422f0..1201bdbfb791 100644 --- a/drivers/nfc/mei_phy.c +++ b/drivers/nfc/mei_phy.c | |||
@@ -64,6 +64,15 @@ int nfc_mei_phy_enable(void *phy_id) | |||
64 | return r; | 64 | return r; |
65 | } | 65 | } |
66 | 66 | ||
67 | r = mei_cl_register_event_cb(phy->device, nfc_mei_event_cb, phy); | ||
68 | if (r) { | ||
69 | pr_err("MEY_PHY: Event cb registration failed\n"); | ||
70 | mei_cl_disable_device(phy->device); | ||
71 | phy->powered = 0; | ||
72 | |||
73 | return r; | ||
74 | } | ||
75 | |||
67 | phy->powered = 1; | 76 | phy->powered = 1; |
68 | 77 | ||
69 | return 0; | 78 | return 0; |
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c index 1ad044dce7b6..cdf1bc53b257 100644 --- a/drivers/nfc/microread/mei.c +++ b/drivers/nfc/microread/mei.c | |||
@@ -43,24 +43,16 @@ static int microread_mei_probe(struct mei_cl_device *device, | |||
43 | return -ENOMEM; | 43 | return -ENOMEM; |
44 | } | 44 | } |
45 | 45 | ||
46 | r = mei_cl_register_event_cb(device, nfc_mei_event_cb, phy); | ||
47 | if (r) { | ||
48 | pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n"); | ||
49 | goto err_out; | ||
50 | } | ||
51 | |||
52 | r = microread_probe(phy, &mei_phy_ops, LLC_NOP_NAME, | 46 | r = microread_probe(phy, &mei_phy_ops, LLC_NOP_NAME, |
53 | MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, | 47 | MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, |
54 | &phy->hdev); | 48 | &phy->hdev); |
55 | if (r < 0) | 49 | if (r < 0) { |
56 | goto err_out; | 50 | nfc_mei_phy_free(phy); |
57 | |||
58 | return 0; | ||
59 | 51 | ||
60 | err_out: | 52 | return r; |
61 | nfc_mei_phy_free(phy); | 53 | } |
62 | 54 | ||
63 | return r; | 55 | return 0; |
64 | } | 56 | } |
65 | 57 | ||
66 | static int microread_mei_remove(struct mei_cl_device *device) | 58 | static int microread_mei_remove(struct mei_cl_device *device) |
@@ -71,8 +63,6 @@ static int microread_mei_remove(struct mei_cl_device *device) | |||
71 | 63 | ||
72 | microread_remove(phy->hdev); | 64 | microread_remove(phy->hdev); |
73 | 65 | ||
74 | nfc_mei_phy_disable(phy); | ||
75 | |||
76 | nfc_mei_phy_free(phy); | 66 | nfc_mei_phy_free(phy); |
77 | 67 | ||
78 | return 0; | 68 | return 0; |
diff --git a/drivers/nfc/pn544/mei.c b/drivers/nfc/pn544/mei.c index 1eb48848a35a..b5d3d18179eb 100644 --- a/drivers/nfc/pn544/mei.c +++ b/drivers/nfc/pn544/mei.c | |||
@@ -43,24 +43,16 @@ static int pn544_mei_probe(struct mei_cl_device *device, | |||
43 | return -ENOMEM; | 43 | return -ENOMEM; |
44 | } | 44 | } |
45 | 45 | ||
46 | r = mei_cl_register_event_cb(device, nfc_mei_event_cb, phy); | ||
47 | if (r) { | ||
48 | pr_err(PN544_DRIVER_NAME ": event cb registration failed\n"); | ||
49 | goto err_out; | ||
50 | } | ||
51 | |||
52 | r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME, | 46 | r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME, |
53 | MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, | 47 | MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, |
54 | &phy->hdev); | 48 | &phy->hdev); |
55 | if (r < 0) | 49 | if (r < 0) { |
56 | goto err_out; | 50 | nfc_mei_phy_free(phy); |
57 | |||
58 | return 0; | ||
59 | 51 | ||
60 | err_out: | 52 | return r; |
61 | nfc_mei_phy_free(phy); | 53 | } |
62 | 54 | ||
63 | return r; | 55 | return 0; |
64 | } | 56 | } |
65 | 57 | ||
66 | static int pn544_mei_remove(struct mei_cl_device *device) | 58 | static int pn544_mei_remove(struct mei_cl_device *device) |
@@ -71,8 +63,6 @@ static int pn544_mei_remove(struct mei_cl_device *device) | |||
71 | 63 | ||
72 | pn544_hci_remove(phy->hdev); | 64 | pn544_hci_remove(phy->hdev); |
73 | 65 | ||
74 | nfc_mei_phy_disable(phy); | ||
75 | |||
76 | nfc_mei_phy_free(phy); | 66 | nfc_mei_phy_free(phy); |
77 | 67 | ||
78 | return 0; | 68 | return 0; |
diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c index f802e7c92356..2dacd19e1b8a 100644 --- a/drivers/ntb/ntb_hw.c +++ b/drivers/ntb/ntb_hw.c | |||
@@ -345,7 +345,7 @@ int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val) | |||
345 | */ | 345 | */ |
346 | void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw) | 346 | void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw) |
347 | { | 347 | { |
348 | if (mw > NTB_NUM_MW) | 348 | if (mw >= NTB_NUM_MW) |
349 | return NULL; | 349 | return NULL; |
350 | 350 | ||
351 | return ndev->mw[mw].vbase; | 351 | return ndev->mw[mw].vbase; |
@@ -362,7 +362,7 @@ void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw) | |||
362 | */ | 362 | */ |
363 | resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw) | 363 | resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw) |
364 | { | 364 | { |
365 | if (mw > NTB_NUM_MW) | 365 | if (mw >= NTB_NUM_MW) |
366 | return 0; | 366 | return 0; |
367 | 367 | ||
368 | return ndev->mw[mw].bar_sz; | 368 | return ndev->mw[mw].bar_sz; |
@@ -380,7 +380,7 @@ resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw) | |||
380 | */ | 380 | */ |
381 | void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr) | 381 | void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr) |
382 | { | 382 | { |
383 | if (mw > NTB_NUM_MW) | 383 | if (mw >= NTB_NUM_MW) |
384 | return; | 384 | return; |
385 | 385 | ||
386 | dev_dbg(&ndev->pdev->dev, "Writing addr %Lx to BAR %d\n", addr, | 386 | dev_dbg(&ndev->pdev->dev, "Writing addr %Lx to BAR %d\n", addr, |
@@ -1027,8 +1027,8 @@ static int ntb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1027 | ndev->mw[i].vbase = | 1027 | ndev->mw[i].vbase = |
1028 | ioremap_wc(pci_resource_start(pdev, MW_TO_BAR(i)), | 1028 | ioremap_wc(pci_resource_start(pdev, MW_TO_BAR(i)), |
1029 | ndev->mw[i].bar_sz); | 1029 | ndev->mw[i].bar_sz); |
1030 | dev_info(&pdev->dev, "MW %d size %d\n", i, | 1030 | dev_info(&pdev->dev, "MW %d size %llu\n", i, |
1031 | (u32) pci_resource_len(pdev, MW_TO_BAR(i))); | 1031 | pci_resource_len(pdev, MW_TO_BAR(i))); |
1032 | if (!ndev->mw[i].vbase) { | 1032 | if (!ndev->mw[i].vbase) { |
1033 | dev_warn(&pdev->dev, "Cannot remap BAR %d\n", | 1033 | dev_warn(&pdev->dev, "Cannot remap BAR %d\n", |
1034 | MW_TO_BAR(i)); | 1034 | MW_TO_BAR(i)); |
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index e0bdfd7f9930..f8d7081ee301 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c | |||
@@ -58,7 +58,7 @@ | |||
58 | #include <linux/ntb.h> | 58 | #include <linux/ntb.h> |
59 | #include "ntb_hw.h" | 59 | #include "ntb_hw.h" |
60 | 60 | ||
61 | #define NTB_TRANSPORT_VERSION 2 | 61 | #define NTB_TRANSPORT_VERSION 3 |
62 | 62 | ||
63 | static unsigned int transport_mtu = 0x401E; | 63 | static unsigned int transport_mtu = 0x401E; |
64 | module_param(transport_mtu, uint, 0644); | 64 | module_param(transport_mtu, uint, 0644); |
@@ -173,10 +173,13 @@ struct ntb_payload_header { | |||
173 | 173 | ||
174 | enum { | 174 | enum { |
175 | VERSION = 0, | 175 | VERSION = 0, |
176 | MW0_SZ, | ||
177 | MW1_SZ, | ||
178 | NUM_QPS, | ||
179 | QP_LINKS, | 176 | QP_LINKS, |
177 | NUM_QPS, | ||
178 | NUM_MWS, | ||
179 | MW0_SZ_HIGH, | ||
180 | MW0_SZ_LOW, | ||
181 | MW1_SZ_HIGH, | ||
182 | MW1_SZ_LOW, | ||
180 | MAX_SPAD, | 183 | MAX_SPAD, |
181 | }; | 184 | }; |
182 | 185 | ||
@@ -297,7 +300,7 @@ int ntb_register_client_dev(char *device_name) | |||
297 | { | 300 | { |
298 | struct ntb_transport_client_dev *client_dev; | 301 | struct ntb_transport_client_dev *client_dev; |
299 | struct ntb_transport *nt; | 302 | struct ntb_transport *nt; |
300 | int rc; | 303 | int rc, i = 0; |
301 | 304 | ||
302 | if (list_empty(&ntb_transport_list)) | 305 | if (list_empty(&ntb_transport_list)) |
303 | return -ENODEV; | 306 | return -ENODEV; |
@@ -315,7 +318,7 @@ int ntb_register_client_dev(char *device_name) | |||
315 | dev = &client_dev->dev; | 318 | dev = &client_dev->dev; |
316 | 319 | ||
317 | /* setup and register client devices */ | 320 | /* setup and register client devices */ |
318 | dev_set_name(dev, "%s", device_name); | 321 | dev_set_name(dev, "%s%d", device_name, i); |
319 | dev->bus = &ntb_bus_type; | 322 | dev->bus = &ntb_bus_type; |
320 | dev->release = ntb_client_release; | 323 | dev->release = ntb_client_release; |
321 | dev->parent = &ntb_query_pdev(nt->ndev)->dev; | 324 | dev->parent = &ntb_query_pdev(nt->ndev)->dev; |
@@ -327,6 +330,7 @@ int ntb_register_client_dev(char *device_name) | |||
327 | } | 330 | } |
328 | 331 | ||
329 | list_add_tail(&client_dev->entry, &nt->client_devs); | 332 | list_add_tail(&client_dev->entry, &nt->client_devs); |
333 | i++; | ||
330 | } | 334 | } |
331 | 335 | ||
332 | return 0; | 336 | return 0; |
@@ -486,12 +490,13 @@ static void ntb_transport_setup_qp_mw(struct ntb_transport *nt, | |||
486 | (qp_num / NTB_NUM_MW * rx_size); | 490 | (qp_num / NTB_NUM_MW * rx_size); |
487 | rx_size -= sizeof(struct ntb_rx_info); | 491 | rx_size -= sizeof(struct ntb_rx_info); |
488 | 492 | ||
489 | qp->rx_buff = qp->remote_rx_info + sizeof(struct ntb_rx_info); | 493 | qp->rx_buff = qp->remote_rx_info + 1; |
490 | qp->rx_max_frame = min(transport_mtu, rx_size); | 494 | /* Due to housekeeping, there must be atleast 2 buffs */ |
495 | qp->rx_max_frame = min(transport_mtu, rx_size / 2); | ||
491 | qp->rx_max_entry = rx_size / qp->rx_max_frame; | 496 | qp->rx_max_entry = rx_size / qp->rx_max_frame; |
492 | qp->rx_index = 0; | 497 | qp->rx_index = 0; |
493 | 498 | ||
494 | qp->remote_rx_info->entry = qp->rx_max_entry; | 499 | qp->remote_rx_info->entry = qp->rx_max_entry - 1; |
495 | 500 | ||
496 | /* setup the hdr offsets with 0's */ | 501 | /* setup the hdr offsets with 0's */ |
497 | for (i = 0; i < qp->rx_max_entry; i++) { | 502 | for (i = 0; i < qp->rx_max_entry; i++) { |
@@ -502,6 +507,19 @@ static void ntb_transport_setup_qp_mw(struct ntb_transport *nt, | |||
502 | 507 | ||
503 | qp->rx_pkts = 0; | 508 | qp->rx_pkts = 0; |
504 | qp->tx_pkts = 0; | 509 | qp->tx_pkts = 0; |
510 | qp->tx_index = 0; | ||
511 | } | ||
512 | |||
513 | static void ntb_free_mw(struct ntb_transport *nt, int num_mw) | ||
514 | { | ||
515 | struct ntb_transport_mw *mw = &nt->mw[num_mw]; | ||
516 | struct pci_dev *pdev = ntb_query_pdev(nt->ndev); | ||
517 | |||
518 | if (!mw->virt_addr) | ||
519 | return; | ||
520 | |||
521 | dma_free_coherent(&pdev->dev, mw->size, mw->virt_addr, mw->dma_addr); | ||
522 | mw->virt_addr = NULL; | ||
505 | } | 523 | } |
506 | 524 | ||
507 | static int ntb_set_mw(struct ntb_transport *nt, int num_mw, unsigned int size) | 525 | static int ntb_set_mw(struct ntb_transport *nt, int num_mw, unsigned int size) |
@@ -509,12 +527,20 @@ static int ntb_set_mw(struct ntb_transport *nt, int num_mw, unsigned int size) | |||
509 | struct ntb_transport_mw *mw = &nt->mw[num_mw]; | 527 | struct ntb_transport_mw *mw = &nt->mw[num_mw]; |
510 | struct pci_dev *pdev = ntb_query_pdev(nt->ndev); | 528 | struct pci_dev *pdev = ntb_query_pdev(nt->ndev); |
511 | 529 | ||
530 | /* No need to re-setup */ | ||
531 | if (mw->size == ALIGN(size, 4096)) | ||
532 | return 0; | ||
533 | |||
534 | if (mw->size != 0) | ||
535 | ntb_free_mw(nt, num_mw); | ||
536 | |||
512 | /* Alloc memory for receiving data. Must be 4k aligned */ | 537 | /* Alloc memory for receiving data. Must be 4k aligned */ |
513 | mw->size = ALIGN(size, 4096); | 538 | mw->size = ALIGN(size, 4096); |
514 | 539 | ||
515 | mw->virt_addr = dma_alloc_coherent(&pdev->dev, mw->size, &mw->dma_addr, | 540 | mw->virt_addr = dma_alloc_coherent(&pdev->dev, mw->size, &mw->dma_addr, |
516 | GFP_KERNEL); | 541 | GFP_KERNEL); |
517 | if (!mw->virt_addr) { | 542 | if (!mw->virt_addr) { |
543 | mw->size = 0; | ||
518 | dev_err(&pdev->dev, "Unable to allocate MW buffer of size %d\n", | 544 | dev_err(&pdev->dev, "Unable to allocate MW buffer of size %d\n", |
519 | (int) mw->size); | 545 | (int) mw->size); |
520 | return -ENOMEM; | 546 | return -ENOMEM; |
@@ -604,25 +630,31 @@ static void ntb_transport_link_work(struct work_struct *work) | |||
604 | u32 val; | 630 | u32 val; |
605 | int rc, i; | 631 | int rc, i; |
606 | 632 | ||
607 | /* send the local info */ | 633 | /* send the local info, in the opposite order of the way we read it */ |
608 | rc = ntb_write_remote_spad(ndev, VERSION, NTB_TRANSPORT_VERSION); | 634 | for (i = 0; i < NTB_NUM_MW; i++) { |
609 | if (rc) { | 635 | rc = ntb_write_remote_spad(ndev, MW0_SZ_HIGH + (i * 2), |
610 | dev_err(&pdev->dev, "Error writing %x to remote spad %d\n", | 636 | ntb_get_mw_size(ndev, i) >> 32); |
611 | 0, VERSION); | 637 | if (rc) { |
612 | goto out; | 638 | dev_err(&pdev->dev, "Error writing %u to remote spad %d\n", |
613 | } | 639 | (u32)(ntb_get_mw_size(ndev, i) >> 32), |
640 | MW0_SZ_HIGH + (i * 2)); | ||
641 | goto out; | ||
642 | } | ||
614 | 643 | ||
615 | rc = ntb_write_remote_spad(ndev, MW0_SZ, ntb_get_mw_size(ndev, 0)); | 644 | rc = ntb_write_remote_spad(ndev, MW0_SZ_LOW + (i * 2), |
616 | if (rc) { | 645 | (u32) ntb_get_mw_size(ndev, i)); |
617 | dev_err(&pdev->dev, "Error writing %x to remote spad %d\n", | 646 | if (rc) { |
618 | (u32) ntb_get_mw_size(ndev, 0), MW0_SZ); | 647 | dev_err(&pdev->dev, "Error writing %u to remote spad %d\n", |
619 | goto out; | 648 | (u32) ntb_get_mw_size(ndev, i), |
649 | MW0_SZ_LOW + (i * 2)); | ||
650 | goto out; | ||
651 | } | ||
620 | } | 652 | } |
621 | 653 | ||
622 | rc = ntb_write_remote_spad(ndev, MW1_SZ, ntb_get_mw_size(ndev, 1)); | 654 | rc = ntb_write_remote_spad(ndev, NUM_MWS, NTB_NUM_MW); |
623 | if (rc) { | 655 | if (rc) { |
624 | dev_err(&pdev->dev, "Error writing %x to remote spad %d\n", | 656 | dev_err(&pdev->dev, "Error writing %x to remote spad %d\n", |
625 | (u32) ntb_get_mw_size(ndev, 1), MW1_SZ); | 657 | NTB_NUM_MW, NUM_MWS); |
626 | goto out; | 658 | goto out; |
627 | } | 659 | } |
628 | 660 | ||
@@ -633,16 +665,10 @@ static void ntb_transport_link_work(struct work_struct *work) | |||
633 | goto out; | 665 | goto out; |
634 | } | 666 | } |
635 | 667 | ||
636 | rc = ntb_read_local_spad(nt->ndev, QP_LINKS, &val); | 668 | rc = ntb_write_remote_spad(ndev, VERSION, NTB_TRANSPORT_VERSION); |
637 | if (rc) { | ||
638 | dev_err(&pdev->dev, "Error reading spad %d\n", QP_LINKS); | ||
639 | goto out; | ||
640 | } | ||
641 | |||
642 | rc = ntb_write_remote_spad(ndev, QP_LINKS, val); | ||
643 | if (rc) { | 669 | if (rc) { |
644 | dev_err(&pdev->dev, "Error writing %x to remote spad %d\n", | 670 | dev_err(&pdev->dev, "Error writing %x to remote spad %d\n", |
645 | val, QP_LINKS); | 671 | NTB_TRANSPORT_VERSION, VERSION); |
646 | goto out; | 672 | goto out; |
647 | } | 673 | } |
648 | 674 | ||
@@ -667,33 +693,43 @@ static void ntb_transport_link_work(struct work_struct *work) | |||
667 | goto out; | 693 | goto out; |
668 | dev_dbg(&pdev->dev, "Remote max number of qps = %d\n", val); | 694 | dev_dbg(&pdev->dev, "Remote max number of qps = %d\n", val); |
669 | 695 | ||
670 | rc = ntb_read_remote_spad(ndev, MW0_SZ, &val); | 696 | rc = ntb_read_remote_spad(ndev, NUM_MWS, &val); |
671 | if (rc) { | 697 | if (rc) { |
672 | dev_err(&pdev->dev, "Error reading remote spad %d\n", MW0_SZ); | 698 | dev_err(&pdev->dev, "Error reading remote spad %d\n", NUM_MWS); |
673 | goto out; | 699 | goto out; |
674 | } | 700 | } |
675 | 701 | ||
676 | if (!val) | 702 | if (val != NTB_NUM_MW) |
677 | goto out; | 703 | goto out; |
678 | dev_dbg(&pdev->dev, "Remote MW0 size = %d\n", val); | 704 | dev_dbg(&pdev->dev, "Remote number of mws = %d\n", val); |
679 | 705 | ||
680 | rc = ntb_set_mw(nt, 0, val); | 706 | for (i = 0; i < NTB_NUM_MW; i++) { |
681 | if (rc) | 707 | u64 val64; |
682 | goto out; | ||
683 | 708 | ||
684 | rc = ntb_read_remote_spad(ndev, MW1_SZ, &val); | 709 | rc = ntb_read_remote_spad(ndev, MW0_SZ_HIGH + (i * 2), &val); |
685 | if (rc) { | 710 | if (rc) { |
686 | dev_err(&pdev->dev, "Error reading remote spad %d\n", MW1_SZ); | 711 | dev_err(&pdev->dev, "Error reading remote spad %d\n", |
687 | goto out; | 712 | MW0_SZ_HIGH + (i * 2)); |
688 | } | 713 | goto out1; |
714 | } | ||
689 | 715 | ||
690 | if (!val) | 716 | val64 = (u64) val << 32; |
691 | goto out; | ||
692 | dev_dbg(&pdev->dev, "Remote MW1 size = %d\n", val); | ||
693 | 717 | ||
694 | rc = ntb_set_mw(nt, 1, val); | 718 | rc = ntb_read_remote_spad(ndev, MW0_SZ_LOW + (i * 2), &val); |
695 | if (rc) | 719 | if (rc) { |
696 | goto out; | 720 | dev_err(&pdev->dev, "Error reading remote spad %d\n", |
721 | MW0_SZ_LOW + (i * 2)); | ||
722 | goto out1; | ||
723 | } | ||
724 | |||
725 | val64 |= val; | ||
726 | |||
727 | dev_dbg(&pdev->dev, "Remote MW%d size = %llu\n", i, val64); | ||
728 | |||
729 | rc = ntb_set_mw(nt, i, val64); | ||
730 | if (rc) | ||
731 | goto out1; | ||
732 | } | ||
697 | 733 | ||
698 | nt->transport_link = NTB_LINK_UP; | 734 | nt->transport_link = NTB_LINK_UP; |
699 | 735 | ||
@@ -708,6 +744,9 @@ static void ntb_transport_link_work(struct work_struct *work) | |||
708 | 744 | ||
709 | return; | 745 | return; |
710 | 746 | ||
747 | out1: | ||
748 | for (i = 0; i < NTB_NUM_MW; i++) | ||
749 | ntb_free_mw(nt, i); | ||
711 | out: | 750 | out: |
712 | if (ntb_hw_link_status(ndev)) | 751 | if (ntb_hw_link_status(ndev)) |
713 | schedule_delayed_work(&nt->link_work, | 752 | schedule_delayed_work(&nt->link_work, |
@@ -780,10 +819,10 @@ static void ntb_transport_init_queue(struct ntb_transport *nt, | |||
780 | (qp_num / NTB_NUM_MW * tx_size); | 819 | (qp_num / NTB_NUM_MW * tx_size); |
781 | tx_size -= sizeof(struct ntb_rx_info); | 820 | tx_size -= sizeof(struct ntb_rx_info); |
782 | 821 | ||
783 | qp->tx_mw = qp->rx_info + sizeof(struct ntb_rx_info); | 822 | qp->tx_mw = qp->rx_info + 1; |
784 | qp->tx_max_frame = min(transport_mtu, tx_size); | 823 | /* Due to housekeeping, there must be atleast 2 buffs */ |
824 | qp->tx_max_frame = min(transport_mtu, tx_size / 2); | ||
785 | qp->tx_max_entry = tx_size / qp->tx_max_frame; | 825 | qp->tx_max_entry = tx_size / qp->tx_max_frame; |
786 | qp->tx_index = 0; | ||
787 | 826 | ||
788 | if (nt->debugfs_dir) { | 827 | if (nt->debugfs_dir) { |
789 | char debugfs_name[4]; | 828 | char debugfs_name[4]; |
@@ -897,10 +936,7 @@ void ntb_transport_free(void *transport) | |||
897 | pdev = ntb_query_pdev(nt->ndev); | 936 | pdev = ntb_query_pdev(nt->ndev); |
898 | 937 | ||
899 | for (i = 0; i < NTB_NUM_MW; i++) | 938 | for (i = 0; i < NTB_NUM_MW; i++) |
900 | if (nt->mw[i].virt_addr) | 939 | ntb_free_mw(nt, i); |
901 | dma_free_coherent(&pdev->dev, nt->mw[i].size, | ||
902 | nt->mw[i].virt_addr, | ||
903 | nt->mw[i].dma_addr); | ||
904 | 940 | ||
905 | kfree(nt->qps); | 941 | kfree(nt->qps); |
906 | ntb_unregister_transport(nt->ndev); | 942 | ntb_unregister_transport(nt->ndev); |
@@ -999,11 +1035,16 @@ out: | |||
999 | static void ntb_transport_rx(unsigned long data) | 1035 | static void ntb_transport_rx(unsigned long data) |
1000 | { | 1036 | { |
1001 | struct ntb_transport_qp *qp = (struct ntb_transport_qp *)data; | 1037 | struct ntb_transport_qp *qp = (struct ntb_transport_qp *)data; |
1002 | int rc; | 1038 | int rc, i; |
1003 | 1039 | ||
1004 | do { | 1040 | /* Limit the number of packets processed in a single interrupt to |
1041 | * provide fairness to others | ||
1042 | */ | ||
1043 | for (i = 0; i < qp->rx_max_entry; i++) { | ||
1005 | rc = ntb_process_rxc(qp); | 1044 | rc = ntb_process_rxc(qp); |
1006 | } while (!rc); | 1045 | if (rc) |
1046 | break; | ||
1047 | } | ||
1007 | } | 1048 | } |
1008 | 1049 | ||
1009 | static void ntb_transport_rxc_db(void *data, int db_num) | 1050 | static void ntb_transport_rxc_db(void *data, int db_num) |
@@ -1210,12 +1251,14 @@ EXPORT_SYMBOL_GPL(ntb_transport_create_queue); | |||
1210 | */ | 1251 | */ |
1211 | void ntb_transport_free_queue(struct ntb_transport_qp *qp) | 1252 | void ntb_transport_free_queue(struct ntb_transport_qp *qp) |
1212 | { | 1253 | { |
1213 | struct pci_dev *pdev = ntb_query_pdev(qp->ndev); | 1254 | struct pci_dev *pdev; |
1214 | struct ntb_queue_entry *entry; | 1255 | struct ntb_queue_entry *entry; |
1215 | 1256 | ||
1216 | if (!qp) | 1257 | if (!qp) |
1217 | return; | 1258 | return; |
1218 | 1259 | ||
1260 | pdev = ntb_query_pdev(qp->ndev); | ||
1261 | |||
1219 | cancel_delayed_work_sync(&qp->link_work); | 1262 | cancel_delayed_work_sync(&qp->link_work); |
1220 | 1263 | ||
1221 | ntb_unregister_db_callback(qp->ndev, qp->qp_num); | 1264 | ntb_unregister_db_callback(qp->ndev, qp->qp_num); |
@@ -1371,12 +1414,13 @@ EXPORT_SYMBOL_GPL(ntb_transport_link_up); | |||
1371 | */ | 1414 | */ |
1372 | void ntb_transport_link_down(struct ntb_transport_qp *qp) | 1415 | void ntb_transport_link_down(struct ntb_transport_qp *qp) |
1373 | { | 1416 | { |
1374 | struct pci_dev *pdev = ntb_query_pdev(qp->ndev); | 1417 | struct pci_dev *pdev; |
1375 | int rc, val; | 1418 | int rc, val; |
1376 | 1419 | ||
1377 | if (!qp) | 1420 | if (!qp) |
1378 | return; | 1421 | return; |
1379 | 1422 | ||
1423 | pdev = ntb_query_pdev(qp->ndev); | ||
1380 | qp->client_ready = NTB_LINK_DOWN; | 1424 | qp->client_ready = NTB_LINK_DOWN; |
1381 | 1425 | ||
1382 | rc = ntb_read_local_spad(qp->ndev, QP_LINKS, &val); | 1426 | rc = ntb_read_local_spad(qp->ndev, QP_LINKS, &val); |
@@ -1408,6 +1452,9 @@ EXPORT_SYMBOL_GPL(ntb_transport_link_down); | |||
1408 | */ | 1452 | */ |
1409 | bool ntb_transport_link_query(struct ntb_transport_qp *qp) | 1453 | bool ntb_transport_link_query(struct ntb_transport_qp *qp) |
1410 | { | 1454 | { |
1455 | if (!qp) | ||
1456 | return false; | ||
1457 | |||
1411 | return qp->qp_link == NTB_LINK_UP; | 1458 | return qp->qp_link == NTB_LINK_UP; |
1412 | } | 1459 | } |
1413 | EXPORT_SYMBOL_GPL(ntb_transport_link_query); | 1460 | EXPORT_SYMBOL_GPL(ntb_transport_link_query); |
@@ -1422,6 +1469,9 @@ EXPORT_SYMBOL_GPL(ntb_transport_link_query); | |||
1422 | */ | 1469 | */ |
1423 | unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp) | 1470 | unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp) |
1424 | { | 1471 | { |
1472 | if (!qp) | ||
1473 | return 0; | ||
1474 | |||
1425 | return qp->qp_num; | 1475 | return qp->qp_num; |
1426 | } | 1476 | } |
1427 | EXPORT_SYMBOL_GPL(ntb_transport_qp_num); | 1477 | EXPORT_SYMBOL_GPL(ntb_transport_qp_num); |
@@ -1436,6 +1486,9 @@ EXPORT_SYMBOL_GPL(ntb_transport_qp_num); | |||
1436 | */ | 1486 | */ |
1437 | unsigned int ntb_transport_max_size(struct ntb_transport_qp *qp) | 1487 | unsigned int ntb_transport_max_size(struct ntb_transport_qp *qp) |
1438 | { | 1488 | { |
1489 | if (!qp) | ||
1490 | return 0; | ||
1491 | |||
1439 | return qp->tx_max_frame - sizeof(struct ntb_payload_header); | 1492 | return qp->tx_max_frame - sizeof(struct ntb_payload_header); |
1440 | } | 1493 | } |
1441 | EXPORT_SYMBOL_GPL(ntb_transport_max_size); | 1494 | EXPORT_SYMBOL_GPL(ntb_transport_max_size); |
diff --git a/drivers/of/base.c b/drivers/of/base.c index c76d16c972cc..a6f584a7f4a1 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -192,14 +192,15 @@ EXPORT_SYMBOL(of_find_property); | |||
192 | struct device_node *of_find_all_nodes(struct device_node *prev) | 192 | struct device_node *of_find_all_nodes(struct device_node *prev) |
193 | { | 193 | { |
194 | struct device_node *np; | 194 | struct device_node *np; |
195 | unsigned long flags; | ||
195 | 196 | ||
196 | raw_spin_lock(&devtree_lock); | 197 | raw_spin_lock_irqsave(&devtree_lock, flags); |
197 | np = prev ? prev->allnext : of_allnodes; | 198 | np = prev ? prev->allnext : of_allnodes; |
198 | for (; np != NULL; np = np->allnext) | 199 | for (; np != NULL; np = np->allnext) |
199 | if (of_node_get(np)) | 200 | if (of_node_get(np)) |
200 | break; | 201 | break; |
201 | of_node_put(prev); | 202 | of_node_put(prev); |
202 | raw_spin_unlock(&devtree_lock); | 203 | raw_spin_unlock_irqrestore(&devtree_lock, flags); |
203 | return np; | 204 | return np; |
204 | } | 205 | } |
205 | EXPORT_SYMBOL(of_find_all_nodes); | 206 | EXPORT_SYMBOL(of_find_all_nodes); |
@@ -421,8 +422,9 @@ struct device_node *of_get_next_available_child(const struct device_node *node, | |||
421 | struct device_node *prev) | 422 | struct device_node *prev) |
422 | { | 423 | { |
423 | struct device_node *next; | 424 | struct device_node *next; |
425 | unsigned long flags; | ||
424 | 426 | ||
425 | raw_spin_lock(&devtree_lock); | 427 | raw_spin_lock_irqsave(&devtree_lock, flags); |
426 | next = prev ? prev->sibling : node->child; | 428 | next = prev ? prev->sibling : node->child; |
427 | for (; next; next = next->sibling) { | 429 | for (; next; next = next->sibling) { |
428 | if (!__of_device_is_available(next)) | 430 | if (!__of_device_is_available(next)) |
@@ -431,7 +433,7 @@ struct device_node *of_get_next_available_child(const struct device_node *node, | |||
431 | break; | 433 | break; |
432 | } | 434 | } |
433 | of_node_put(prev); | 435 | of_node_put(prev); |
434 | raw_spin_unlock(&devtree_lock); | 436 | raw_spin_unlock_irqrestore(&devtree_lock, flags); |
435 | return next; | 437 | return next; |
436 | } | 438 | } |
437 | EXPORT_SYMBOL(of_get_next_available_child); | 439 | EXPORT_SYMBOL(of_get_next_available_child); |
@@ -735,13 +737,14 @@ EXPORT_SYMBOL_GPL(of_modalias_node); | |||
735 | struct device_node *of_find_node_by_phandle(phandle handle) | 737 | struct device_node *of_find_node_by_phandle(phandle handle) |
736 | { | 738 | { |
737 | struct device_node *np; | 739 | struct device_node *np; |
740 | unsigned long flags; | ||
738 | 741 | ||
739 | raw_spin_lock(&devtree_lock); | 742 | raw_spin_lock_irqsave(&devtree_lock, flags); |
740 | for (np = of_allnodes; np; np = np->allnext) | 743 | for (np = of_allnodes; np; np = np->allnext) |
741 | if (np->phandle == handle) | 744 | if (np->phandle == handle) |
742 | break; | 745 | break; |
743 | of_node_get(np); | 746 | of_node_get(np); |
744 | raw_spin_unlock(&devtree_lock); | 747 | raw_spin_unlock_irqrestore(&devtree_lock, flags); |
745 | return np; | 748 | return np; |
746 | } | 749 | } |
747 | EXPORT_SYMBOL(of_find_node_by_phandle); | 750 | EXPORT_SYMBOL(of_find_node_by_phandle); |
@@ -1208,11 +1211,11 @@ static int __of_parse_phandle_with_args(const struct device_node *np, | |||
1208 | out_args->args_count = count; | 1211 | out_args->args_count = count; |
1209 | for (i = 0; i < count; i++) | 1212 | for (i = 0; i < count; i++) |
1210 | out_args->args[i] = be32_to_cpup(list++); | 1213 | out_args->args[i] = be32_to_cpup(list++); |
1214 | } else { | ||
1215 | of_node_put(node); | ||
1211 | } | 1216 | } |
1212 | 1217 | ||
1213 | /* Found it! return success */ | 1218 | /* Found it! return success */ |
1214 | if (node) | ||
1215 | of_node_put(node); | ||
1216 | return 0; | 1219 | return 0; |
1217 | } | 1220 | } |
1218 | 1221 | ||
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 9544cdc0d1af..e79e006eb9ab 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c | |||
@@ -811,6 +811,70 @@ int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev) | |||
811 | return pcidev->irq; | 811 | return pcidev->irq; |
812 | } | 812 | } |
813 | 813 | ||
814 | static struct iosapic_info *first_isi = NULL; | ||
815 | |||
816 | #ifdef CONFIG_64BIT | ||
817 | int iosapic_serial_irq(int num) | ||
818 | { | ||
819 | struct iosapic_info *isi = first_isi; | ||
820 | struct irt_entry *irte = NULL; /* only used if PAT PDC */ | ||
821 | struct vector_info *vi; | ||
822 | int isi_line; /* line used by device */ | ||
823 | |||
824 | /* lookup IRT entry for isi/slot/pin set */ | ||
825 | irte = &irt_cell[num]; | ||
826 | |||
827 | DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n", | ||
828 | irte, | ||
829 | irte->entry_type, | ||
830 | irte->entry_length, | ||
831 | irte->polarity_trigger, | ||
832 | irte->src_bus_irq_devno, | ||
833 | irte->src_bus_id, | ||
834 | irte->src_seg_id, | ||
835 | irte->dest_iosapic_intin, | ||
836 | (u32) irte->dest_iosapic_addr); | ||
837 | isi_line = irte->dest_iosapic_intin; | ||
838 | |||
839 | /* get vector info for this input line */ | ||
840 | vi = isi->isi_vector + isi_line; | ||
841 | DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", isi_line, vi); | ||
842 | |||
843 | /* If this IRQ line has already been setup, skip it */ | ||
844 | if (vi->irte) | ||
845 | goto out; | ||
846 | |||
847 | vi->irte = irte; | ||
848 | |||
849 | /* | ||
850 | * Allocate processor IRQ | ||
851 | * | ||
852 | * XXX/FIXME The txn_alloc_irq() code and related code should be | ||
853 | * moved to enable_irq(). That way we only allocate processor IRQ | ||
854 | * bits for devices that actually have drivers claiming them. | ||
855 | * Right now we assign an IRQ to every PCI device present, | ||
856 | * regardless of whether it's used or not. | ||
857 | */ | ||
858 | vi->txn_irq = txn_alloc_irq(8); | ||
859 | |||
860 | if (vi->txn_irq < 0) | ||
861 | panic("I/O sapic: couldn't get TXN IRQ\n"); | ||
862 | |||
863 | /* enable_irq() will use txn_* to program IRdT */ | ||
864 | vi->txn_addr = txn_alloc_addr(vi->txn_irq); | ||
865 | vi->txn_data = txn_alloc_data(vi->txn_irq); | ||
866 | |||
867 | vi->eoi_addr = isi->addr + IOSAPIC_REG_EOI; | ||
868 | vi->eoi_data = cpu_to_le32(vi->txn_data); | ||
869 | |||
870 | cpu_claim_irq(vi->txn_irq, &iosapic_interrupt_type, vi); | ||
871 | |||
872 | out: | ||
873 | |||
874 | return vi->txn_irq; | ||
875 | } | ||
876 | #endif | ||
877 | |||
814 | 878 | ||
815 | /* | 879 | /* |
816 | ** squirrel away the I/O Sapic Version | 880 | ** squirrel away the I/O Sapic Version |
@@ -877,6 +941,8 @@ void *iosapic_register(unsigned long hpa) | |||
877 | vip->irqline = (unsigned char) cnt; | 941 | vip->irqline = (unsigned char) cnt; |
878 | vip->iosapic = isi; | 942 | vip->iosapic = isi; |
879 | } | 943 | } |
944 | if (!first_isi) | ||
945 | first_isi = isi; | ||
880 | return isi; | 946 | return isi; |
881 | } | 947 | } |
882 | 948 | ||
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 2ef7103270bb..1f05913ae677 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
@@ -668,7 +668,7 @@ lba_fixup_bus(struct pci_bus *bus) | |||
668 | BUG(); | 668 | BUG(); |
669 | } | 669 | } |
670 | 670 | ||
671 | if (ldev->hba.elmmio_space.start) { | 671 | if (ldev->hba.elmmio_space.flags) { |
672 | err = request_resource(&iomem_resource, | 672 | err = request_resource(&iomem_resource, |
673 | &(ldev->hba.elmmio_space)); | 673 | &(ldev->hba.elmmio_space)); |
674 | if (err < 0) { | 674 | if (err < 0) { |
@@ -993,7 +993,7 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) | |||
993 | 993 | ||
994 | case PAT_LMMIO: | 994 | case PAT_LMMIO: |
995 | /* used to fix up pre-initialized MEM BARs */ | 995 | /* used to fix up pre-initialized MEM BARs */ |
996 | if (!lba_dev->hba.lmmio_space.start) { | 996 | if (!lba_dev->hba.lmmio_space.flags) { |
997 | sprintf(lba_dev->hba.lmmio_name, | 997 | sprintf(lba_dev->hba.lmmio_name, |
998 | "PCI%02x LMMIO", | 998 | "PCI%02x LMMIO", |
999 | (int)lba_dev->hba.bus_num.start); | 999 | (int)lba_dev->hba.bus_num.start); |
@@ -1001,7 +1001,7 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) | |||
1001 | io->start; | 1001 | io->start; |
1002 | r = &lba_dev->hba.lmmio_space; | 1002 | r = &lba_dev->hba.lmmio_space; |
1003 | r->name = lba_dev->hba.lmmio_name; | 1003 | r->name = lba_dev->hba.lmmio_name; |
1004 | } else if (!lba_dev->hba.elmmio_space.start) { | 1004 | } else if (!lba_dev->hba.elmmio_space.flags) { |
1005 | sprintf(lba_dev->hba.elmmio_name, | 1005 | sprintf(lba_dev->hba.elmmio_name, |
1006 | "PCI%02x ELMMIO", | 1006 | "PCI%02x ELMMIO", |
1007 | (int)lba_dev->hba.bus_num.start); | 1007 | (int)lba_dev->hba.bus_num.start); |
@@ -1096,6 +1096,7 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) | |||
1096 | r->name = "LBA PCI Busses"; | 1096 | r->name = "LBA PCI Busses"; |
1097 | r->start = lba_num & 0xff; | 1097 | r->start = lba_num & 0xff; |
1098 | r->end = (lba_num>>8) & 0xff; | 1098 | r->end = (lba_num>>8) & 0xff; |
1099 | r->flags = IORESOURCE_BUS; | ||
1099 | 1100 | ||
1100 | /* Set up local PCI Bus resources - we don't need them for | 1101 | /* Set up local PCI Bus resources - we don't need them for |
1101 | ** Legacy boxes but it's nice to see in /proc/iomem. | 1102 | ** Legacy boxes but it's nice to see in /proc/iomem. |
@@ -1494,7 +1495,7 @@ lba_driver_probe(struct parisc_device *dev) | |||
1494 | 1495 | ||
1495 | pci_add_resource_offset(&resources, &lba_dev->hba.io_space, | 1496 | pci_add_resource_offset(&resources, &lba_dev->hba.io_space, |
1496 | HBA_PORT_BASE(lba_dev->hba.hba_num)); | 1497 | HBA_PORT_BASE(lba_dev->hba.hba_num)); |
1497 | if (lba_dev->hba.elmmio_space.start) | 1498 | if (lba_dev->hba.elmmio_space.flags) |
1498 | pci_add_resource_offset(&resources, &lba_dev->hba.elmmio_space, | 1499 | pci_add_resource_offset(&resources, &lba_dev->hba.elmmio_space, |
1499 | lba_dev->hba.lmmio_space_offset); | 1500 | lba_dev->hba.lmmio_space_offset); |
1500 | if (lba_dev->hba.lmmio_space.flags) | 1501 | if (lba_dev->hba.lmmio_space.flags) |
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index ac6e8e7a02df..a042d065a0c7 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c | |||
@@ -494,15 +494,4 @@ static struct pci_driver superio_driver = { | |||
494 | .probe = superio_probe, | 494 | .probe = superio_probe, |
495 | }; | 495 | }; |
496 | 496 | ||
497 | static int __init superio_modinit(void) | 497 | module_pci_driver(superio_driver); |
498 | { | ||
499 | return pci_register_driver(&superio_driver); | ||
500 | } | ||
501 | |||
502 | static void __exit superio_exit(void) | ||
503 | { | ||
504 | pci_unregister_driver(&superio_driver); | ||
505 | } | ||
506 | |||
507 | module_init(superio_modinit); | ||
508 | module_exit(superio_exit); | ||
diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig index 24e12d4d1769..a50576081b34 100644 --- a/drivers/parport/Kconfig +++ b/drivers/parport/Kconfig | |||
@@ -71,7 +71,7 @@ config PARPORT_PC_FIFO | |||
71 | 71 | ||
72 | config PARPORT_PC_SUPERIO | 72 | config PARPORT_PC_SUPERIO |
73 | bool "SuperIO chipset support" | 73 | bool "SuperIO chipset support" |
74 | depends on PARPORT_PC | 74 | depends on PARPORT_PC && !PARISC |
75 | help | 75 | help |
76 | Saying Y here enables some probes for Super-IO chipsets in order to | 76 | Saying Y here enables some probes for Super-IO chipsets in order to |
77 | find out things like base addresses, IRQ lines and DMA channels. It | 77 | find out things like base addresses, IRQ lines and DMA channels. It |
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c index a5251cb5fb0c..6e3a60c78873 100644 --- a/drivers/parport/parport_gsc.c +++ b/drivers/parport/parport_gsc.c | |||
@@ -234,7 +234,7 @@ static int parport_PS2_supported(struct parport *pb) | |||
234 | 234 | ||
235 | struct parport *parport_gsc_probe_port(unsigned long base, | 235 | struct parport *parport_gsc_probe_port(unsigned long base, |
236 | unsigned long base_hi, int irq, | 236 | unsigned long base_hi, int irq, |
237 | int dma, struct pci_dev *dev) | 237 | int dma, struct parisc_device *padev) |
238 | { | 238 | { |
239 | struct parport_gsc_private *priv; | 239 | struct parport_gsc_private *priv; |
240 | struct parport_operations *ops; | 240 | struct parport_operations *ops; |
@@ -258,7 +258,6 @@ struct parport *parport_gsc_probe_port(unsigned long base, | |||
258 | priv->ctr_writable = 0xff; | 258 | priv->ctr_writable = 0xff; |
259 | priv->dma_buf = 0; | 259 | priv->dma_buf = 0; |
260 | priv->dma_handle = 0; | 260 | priv->dma_handle = 0; |
261 | priv->dev = dev; | ||
262 | p->base = base; | 261 | p->base = base; |
263 | p->base_hi = base_hi; | 262 | p->base_hi = base_hi; |
264 | p->irq = irq; | 263 | p->irq = irq; |
@@ -282,6 +281,7 @@ struct parport *parport_gsc_probe_port(unsigned long base, | |||
282 | return NULL; | 281 | return NULL; |
283 | } | 282 | } |
284 | 283 | ||
284 | p->dev = &padev->dev; | ||
285 | p->base_hi = base_hi; | 285 | p->base_hi = base_hi; |
286 | p->modes = tmp.modes; | 286 | p->modes = tmp.modes; |
287 | p->size = (p->modes & PARPORT_MODE_EPP)?8:3; | 287 | p->size = (p->modes & PARPORT_MODE_EPP)?8:3; |
@@ -373,7 +373,7 @@ static int parport_init_chip(struct parisc_device *dev) | |||
373 | } | 373 | } |
374 | 374 | ||
375 | p = parport_gsc_probe_port(port, 0, dev->irq, | 375 | p = parport_gsc_probe_port(port, 0, dev->irq, |
376 | /* PARPORT_IRQ_NONE */ PARPORT_DMA_NONE, NULL); | 376 | /* PARPORT_IRQ_NONE */ PARPORT_DMA_NONE, dev); |
377 | if (p) | 377 | if (p) |
378 | parport_count++; | 378 | parport_count++; |
379 | dev_set_drvdata(&dev->dev, p); | 379 | dev_set_drvdata(&dev->dev, p); |
diff --git a/drivers/parport/parport_gsc.h b/drivers/parport/parport_gsc.h index fc9c37c54022..812214768d27 100644 --- a/drivers/parport/parport_gsc.h +++ b/drivers/parport/parport_gsc.h | |||
@@ -217,6 +217,6 @@ extern void parport_gsc_dec_use_count(void); | |||
217 | extern struct parport *parport_gsc_probe_port(unsigned long base, | 217 | extern struct parport *parport_gsc_probe_port(unsigned long base, |
218 | unsigned long base_hi, | 218 | unsigned long base_hi, |
219 | int irq, int dma, | 219 | int irq, int dma, |
220 | struct pci_dev *dev); | 220 | struct parisc_device *padev); |
221 | 221 | ||
222 | #endif /* __DRIVERS_PARPORT_PARPORT_GSC_H */ | 222 | #endif /* __DRIVERS_PARPORT_PARPORT_GSC_H */ |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 96fed19c6d90..716aa93fff76 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -950,6 +950,20 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
950 | return AE_OK ; | 950 | return AE_OK ; |
951 | } | 951 | } |
952 | 952 | ||
953 | void acpiphp_check_host_bridge(acpi_handle handle) | ||
954 | { | ||
955 | struct acpiphp_bridge *bridge; | ||
956 | |||
957 | bridge = acpiphp_handle_to_bridge(handle); | ||
958 | if (bridge) { | ||
959 | acpiphp_check_bridge(bridge); | ||
960 | put_bridge(bridge); | ||
961 | } | ||
962 | |||
963 | acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, | ||
964 | ACPI_UINT32_MAX, check_sub_bridges, NULL, NULL, NULL); | ||
965 | } | ||
966 | |||
953 | static void _handle_hotplug_event_bridge(struct work_struct *work) | 967 | static void _handle_hotplug_event_bridge(struct work_struct *work) |
954 | { | 968 | { |
955 | struct acpiphp_bridge *bridge; | 969 | struct acpiphp_bridge *bridge; |
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 8ec8b4f48560..0f4554e48cc5 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
@@ -580,6 +580,7 @@ struct aer_recover_entry | |||
580 | u8 devfn; | 580 | u8 devfn; |
581 | u16 domain; | 581 | u16 domain; |
582 | int severity; | 582 | int severity; |
583 | struct aer_capability_regs *regs; | ||
583 | }; | 584 | }; |
584 | 585 | ||
585 | static DEFINE_KFIFO(aer_recover_ring, struct aer_recover_entry, | 586 | static DEFINE_KFIFO(aer_recover_ring, struct aer_recover_entry, |
@@ -593,7 +594,7 @@ static DEFINE_SPINLOCK(aer_recover_ring_lock); | |||
593 | static DECLARE_WORK(aer_recover_work, aer_recover_work_func); | 594 | static DECLARE_WORK(aer_recover_work, aer_recover_work_func); |
594 | 595 | ||
595 | void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, | 596 | void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, |
596 | int severity) | 597 | int severity, struct aer_capability_regs *aer_regs) |
597 | { | 598 | { |
598 | unsigned long flags; | 599 | unsigned long flags; |
599 | struct aer_recover_entry entry = { | 600 | struct aer_recover_entry entry = { |
@@ -601,6 +602,7 @@ void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, | |||
601 | .devfn = devfn, | 602 | .devfn = devfn, |
602 | .domain = domain, | 603 | .domain = domain, |
603 | .severity = severity, | 604 | .severity = severity, |
605 | .regs = aer_regs, | ||
604 | }; | 606 | }; |
605 | 607 | ||
606 | spin_lock_irqsave(&aer_recover_ring_lock, flags); | 608 | spin_lock_irqsave(&aer_recover_ring_lock, flags); |
@@ -627,6 +629,7 @@ static void aer_recover_work_func(struct work_struct *work) | |||
627 | PCI_SLOT(entry.devfn), PCI_FUNC(entry.devfn)); | 629 | PCI_SLOT(entry.devfn), PCI_FUNC(entry.devfn)); |
628 | continue; | 630 | continue; |
629 | } | 631 | } |
632 | cper_print_aer(pdev, entry.severity, entry.regs); | ||
630 | do_recovery(pdev, entry.severity); | 633 | do_recovery(pdev, entry.severity); |
631 | pci_dev_put(pdev); | 634 | pci_dev_put(pdev); |
632 | } | 635 | } |
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index 5ab14251839d..2c7c9f5f592c 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c | |||
@@ -220,7 +220,7 @@ int cper_severity_to_aer(int cper_severity) | |||
220 | } | 220 | } |
221 | EXPORT_SYMBOL_GPL(cper_severity_to_aer); | 221 | EXPORT_SYMBOL_GPL(cper_severity_to_aer); |
222 | 222 | ||
223 | void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity, | 223 | void cper_print_aer(struct pci_dev *dev, int cper_severity, |
224 | struct aer_capability_regs *aer) | 224 | struct aer_capability_regs *aer) |
225 | { | 225 | { |
226 | int aer_severity, layer, agent, status_strs_size, tlp_header_valid = 0; | 226 | int aer_severity, layer, agent, status_strs_size, tlp_header_valid = 0; |
@@ -244,7 +244,7 @@ void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity, | |||
244 | agent = AER_GET_AGENT(aer_severity, status); | 244 | agent = AER_GET_AGENT(aer_severity, status); |
245 | dev_err(&dev->dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", | 245 | dev_err(&dev->dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", |
246 | status, mask); | 246 | status, mask); |
247 | cper_print_bits(prefix, status, status_strs, status_strs_size); | 247 | cper_print_bits("", status, status_strs, status_strs_size); |
248 | dev_err(&dev->dev, "aer_layer=%s, aer_agent=%s\n", | 248 | dev_err(&dev->dev, "aer_layer=%s, aer_agent=%s\n", |
249 | aer_error_layer[layer], aer_agent_string[agent]); | 249 | aer_error_layer[layer], aer_agent_string[agent]); |
250 | if (aer_severity != AER_CORRECTABLE) | 250 | if (aer_severity != AER_CORRECTABLE) |
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index c67c37e23dd7..694c3ace4520 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c | |||
@@ -610,7 +610,7 @@ static int pinconf_dbg_config_print(struct seq_file *s, void *d) | |||
610 | bool found = false; | 610 | bool found = false; |
611 | unsigned long config; | 611 | unsigned long config; |
612 | 612 | ||
613 | mutex_lock(&pctldev->mutex); | 613 | mutex_lock(&pinctrl_maps_mutex); |
614 | 614 | ||
615 | /* Parse the pinctrl map and look for the elected pin/state */ | 615 | /* Parse the pinctrl map and look for the elected pin/state */ |
616 | for_each_maps(maps_node, i, map) { | 616 | for_each_maps(maps_node, i, map) { |
@@ -659,7 +659,7 @@ static int pinconf_dbg_config_print(struct seq_file *s, void *d) | |||
659 | confops->pin_config_config_dbg_show(pctldev, s, config); | 659 | confops->pin_config_config_dbg_show(pctldev, s, config); |
660 | 660 | ||
661 | exit: | 661 | exit: |
662 | mutex_unlock(&pctldev->mutex); | 662 | mutex_unlock(&pinctrl_maps_mutex); |
663 | 663 | ||
664 | return 0; | 664 | return 0; |
665 | } | 665 | } |
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index aa17f7580f61..6d4532702f80 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c | |||
@@ -851,23 +851,12 @@ static int abx500_gpio_probe(struct platform_device *pdev) | |||
851 | 851 | ||
852 | if (abx500_pdata) | 852 | if (abx500_pdata) |
853 | pdata = abx500_pdata->gpio; | 853 | pdata = abx500_pdata->gpio; |
854 | if (!pdata) { | ||
855 | if (np) { | ||
856 | const struct of_device_id *match; | ||
857 | 854 | ||
858 | match = of_match_device(abx500_gpio_match, &pdev->dev); | 855 | if (!(pdata || np)) { |
859 | if (!match) | 856 | dev_err(&pdev->dev, "gpio dt and platform data missing\n"); |
860 | return -ENODEV; | 857 | return -ENODEV; |
861 | id = (unsigned long)match->data; | ||
862 | } else { | ||
863 | dev_err(&pdev->dev, "gpio dt and platform data missing\n"); | ||
864 | return -ENODEV; | ||
865 | } | ||
866 | } | 858 | } |
867 | 859 | ||
868 | if (platid) | ||
869 | id = platid->driver_data; | ||
870 | |||
871 | pct = devm_kzalloc(&pdev->dev, sizeof(struct abx500_pinctrl), | 860 | pct = devm_kzalloc(&pdev->dev, sizeof(struct abx500_pinctrl), |
872 | GFP_KERNEL); | 861 | GFP_KERNEL); |
873 | if (pct == NULL) { | 862 | if (pct == NULL) { |
@@ -882,6 +871,16 @@ static int abx500_gpio_probe(struct platform_device *pdev) | |||
882 | pct->chip.dev = &pdev->dev; | 871 | pct->chip.dev = &pdev->dev; |
883 | pct->chip.base = (np) ? -1 : pdata->gpio_base; | 872 | pct->chip.base = (np) ? -1 : pdata->gpio_base; |
884 | 873 | ||
874 | if (platid) | ||
875 | id = platid->driver_data; | ||
876 | else if (np) { | ||
877 | const struct of_device_id *match; | ||
878 | |||
879 | match = of_match_device(abx500_gpio_match, &pdev->dev); | ||
880 | if (match) | ||
881 | id = (unsigned long)match->data; | ||
882 | } | ||
883 | |||
885 | /* initialize the lock */ | 884 | /* initialize the lock */ |
886 | mutex_init(&pct->lock); | 885 | mutex_init(&pct->lock); |
887 | 886 | ||
@@ -900,8 +899,7 @@ static int abx500_gpio_probe(struct platform_device *pdev) | |||
900 | abx500_pinctrl_ab8505_init(&pct->soc); | 899 | abx500_pinctrl_ab8505_init(&pct->soc); |
901 | break; | 900 | break; |
902 | default: | 901 | default: |
903 | dev_err(&pdev->dev, "Unsupported pinctrl sub driver (%d)\n", | 902 | dev_err(&pdev->dev, "Unsupported pinctrl sub driver (%d)\n", id); |
904 | (int) platid->driver_data); | ||
905 | mutex_destroy(&pct->lock); | 903 | mutex_destroy(&pct->lock); |
906 | return -EINVAL; | 904 | return -EINVAL; |
907 | } | 905 | } |
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c index edde3acc4186..d6b41747d687 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c | |||
@@ -713,11 +713,6 @@ static int __init u300_gpio_probe(struct platform_device *pdev) | |||
713 | gpio->dev = &pdev->dev; | 713 | gpio->dev = &pdev->dev; |
714 | 714 | ||
715 | memres = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 715 | memres = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
716 | if (!memres) { | ||
717 | dev_err(gpio->dev, "could not get GPIO memory resource\n"); | ||
718 | return -ENODEV; | ||
719 | } | ||
720 | |||
721 | gpio->base = devm_ioremap_resource(&pdev->dev, memres); | 716 | gpio->base = devm_ioremap_resource(&pdev->dev, memres); |
722 | if (IS_ERR(gpio->base)) | 717 | if (IS_ERR(gpio->base)) |
723 | return PTR_ERR(gpio->base); | 718 | return PTR_ERR(gpio->base); |
@@ -835,7 +830,8 @@ static int __init u300_gpio_probe(struct platform_device *pdev) | |||
835 | return 0; | 830 | return 0; |
836 | 831 | ||
837 | err_no_range: | 832 | err_no_range: |
838 | err = gpiochip_remove(&gpio->chip); | 833 | if (gpiochip_remove(&gpio->chip)) |
834 | dev_err(&pdev->dev, "failed to remove gpio chip\n"); | ||
839 | err_no_chip: | 835 | err_no_chip: |
840 | err_no_domain: | 836 | err_no_domain: |
841 | err_no_port: | 837 | err_no_port: |
diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c index ac742817ebce..2d76f66a2e0b 100644 --- a/drivers/pinctrl/pinctrl-exynos.c +++ b/drivers/pinctrl/pinctrl-exynos.c | |||
@@ -196,6 +196,12 @@ static irqreturn_t exynos_eint_gpio_irq(int irq, void *data) | |||
196 | return IRQ_HANDLED; | 196 | return IRQ_HANDLED; |
197 | } | 197 | } |
198 | 198 | ||
199 | struct exynos_eint_gpio_save { | ||
200 | u32 eint_con; | ||
201 | u32 eint_fltcon0; | ||
202 | u32 eint_fltcon1; | ||
203 | }; | ||
204 | |||
199 | /* | 205 | /* |
200 | * exynos_eint_gpio_init() - setup handling of external gpio interrupts. | 206 | * exynos_eint_gpio_init() - setup handling of external gpio interrupts. |
201 | * @d: driver data of samsung pinctrl driver. | 207 | * @d: driver data of samsung pinctrl driver. |
@@ -204,8 +210,8 @@ static int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d) | |||
204 | { | 210 | { |
205 | struct samsung_pin_bank *bank; | 211 | struct samsung_pin_bank *bank; |
206 | struct device *dev = d->dev; | 212 | struct device *dev = d->dev; |
207 | unsigned int ret; | 213 | int ret; |
208 | unsigned int i; | 214 | int i; |
209 | 215 | ||
210 | if (!d->irq) { | 216 | if (!d->irq) { |
211 | dev_err(dev, "irq number not available\n"); | 217 | dev_err(dev, "irq number not available\n"); |
@@ -227,11 +233,29 @@ static int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d) | |||
227 | bank->nr_pins, &exynos_gpio_irqd_ops, bank); | 233 | bank->nr_pins, &exynos_gpio_irqd_ops, bank); |
228 | if (!bank->irq_domain) { | 234 | if (!bank->irq_domain) { |
229 | dev_err(dev, "gpio irq domain add failed\n"); | 235 | dev_err(dev, "gpio irq domain add failed\n"); |
230 | return -ENXIO; | 236 | ret = -ENXIO; |
237 | goto err_domains; | ||
238 | } | ||
239 | |||
240 | bank->soc_priv = devm_kzalloc(d->dev, | ||
241 | sizeof(struct exynos_eint_gpio_save), GFP_KERNEL); | ||
242 | if (!bank->soc_priv) { | ||
243 | irq_domain_remove(bank->irq_domain); | ||
244 | ret = -ENOMEM; | ||
245 | goto err_domains; | ||
231 | } | 246 | } |
232 | } | 247 | } |
233 | 248 | ||
234 | return 0; | 249 | return 0; |
250 | |||
251 | err_domains: | ||
252 | for (--i, --bank; i >= 0; --i, --bank) { | ||
253 | if (bank->eint_type != EINT_TYPE_GPIO) | ||
254 | continue; | ||
255 | irq_domain_remove(bank->irq_domain); | ||
256 | } | ||
257 | |||
258 | return ret; | ||
235 | } | 259 | } |
236 | 260 | ||
237 | static void exynos_wkup_irq_unmask(struct irq_data *irqd) | 261 | static void exynos_wkup_irq_unmask(struct irq_data *irqd) |
@@ -326,6 +350,28 @@ static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type) | |||
326 | return 0; | 350 | return 0; |
327 | } | 351 | } |
328 | 352 | ||
353 | static u32 exynos_eint_wake_mask = 0xffffffff; | ||
354 | |||
355 | u32 exynos_get_eint_wake_mask(void) | ||
356 | { | ||
357 | return exynos_eint_wake_mask; | ||
358 | } | ||
359 | |||
360 | static int exynos_wkup_irq_set_wake(struct irq_data *irqd, unsigned int on) | ||
361 | { | ||
362 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); | ||
363 | unsigned long bit = 1UL << (2 * bank->eint_offset + irqd->hwirq); | ||
364 | |||
365 | pr_info("wake %s for irq %d\n", on ? "enabled" : "disabled", irqd->irq); | ||
366 | |||
367 | if (!on) | ||
368 | exynos_eint_wake_mask |= bit; | ||
369 | else | ||
370 | exynos_eint_wake_mask &= ~bit; | ||
371 | |||
372 | return 0; | ||
373 | } | ||
374 | |||
329 | /* | 375 | /* |
330 | * irq_chip for wakeup interrupts | 376 | * irq_chip for wakeup interrupts |
331 | */ | 377 | */ |
@@ -335,6 +381,7 @@ static struct irq_chip exynos_wkup_irq_chip = { | |||
335 | .irq_mask = exynos_wkup_irq_mask, | 381 | .irq_mask = exynos_wkup_irq_mask, |
336 | .irq_ack = exynos_wkup_irq_ack, | 382 | .irq_ack = exynos_wkup_irq_ack, |
337 | .irq_set_type = exynos_wkup_irq_set_type, | 383 | .irq_set_type = exynos_wkup_irq_set_type, |
384 | .irq_set_wake = exynos_wkup_irq_set_wake, | ||
338 | }; | 385 | }; |
339 | 386 | ||
340 | /* interrupt handler for wakeup interrupts 0..15 */ | 387 | /* interrupt handler for wakeup interrupts 0..15 */ |
@@ -505,6 +552,72 @@ static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) | |||
505 | return 0; | 552 | return 0; |
506 | } | 553 | } |
507 | 554 | ||
555 | static void exynos_pinctrl_suspend_bank( | ||
556 | struct samsung_pinctrl_drv_data *drvdata, | ||
557 | struct samsung_pin_bank *bank) | ||
558 | { | ||
559 | struct exynos_eint_gpio_save *save = bank->soc_priv; | ||
560 | void __iomem *regs = drvdata->virt_base; | ||
561 | |||
562 | save->eint_con = readl(regs + EXYNOS_GPIO_ECON_OFFSET | ||
563 | + bank->eint_offset); | ||
564 | save->eint_fltcon0 = readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET | ||
565 | + 2 * bank->eint_offset); | ||
566 | save->eint_fltcon1 = readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET | ||
567 | + 2 * bank->eint_offset + 4); | ||
568 | |||
569 | pr_debug("%s: save con %#010x\n", bank->name, save->eint_con); | ||
570 | pr_debug("%s: save fltcon0 %#010x\n", bank->name, save->eint_fltcon0); | ||
571 | pr_debug("%s: save fltcon1 %#010x\n", bank->name, save->eint_fltcon1); | ||
572 | } | ||
573 | |||
574 | static void exynos_pinctrl_suspend(struct samsung_pinctrl_drv_data *drvdata) | ||
575 | { | ||
576 | struct samsung_pin_ctrl *ctrl = drvdata->ctrl; | ||
577 | struct samsung_pin_bank *bank = ctrl->pin_banks; | ||
578 | int i; | ||
579 | |||
580 | for (i = 0; i < ctrl->nr_banks; ++i, ++bank) | ||
581 | if (bank->eint_type == EINT_TYPE_GPIO) | ||
582 | exynos_pinctrl_suspend_bank(drvdata, bank); | ||
583 | } | ||
584 | |||
585 | static void exynos_pinctrl_resume_bank( | ||
586 | struct samsung_pinctrl_drv_data *drvdata, | ||
587 | struct samsung_pin_bank *bank) | ||
588 | { | ||
589 | struct exynos_eint_gpio_save *save = bank->soc_priv; | ||
590 | void __iomem *regs = drvdata->virt_base; | ||
591 | |||
592 | pr_debug("%s: con %#010x => %#010x\n", bank->name, | ||
593 | readl(regs + EXYNOS_GPIO_ECON_OFFSET | ||
594 | + bank->eint_offset), save->eint_con); | ||
595 | pr_debug("%s: fltcon0 %#010x => %#010x\n", bank->name, | ||
596 | readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET | ||
597 | + 2 * bank->eint_offset), save->eint_fltcon0); | ||
598 | pr_debug("%s: fltcon1 %#010x => %#010x\n", bank->name, | ||
599 | readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET | ||
600 | + 2 * bank->eint_offset + 4), save->eint_fltcon1); | ||
601 | |||
602 | writel(save->eint_con, regs + EXYNOS_GPIO_ECON_OFFSET | ||
603 | + bank->eint_offset); | ||
604 | writel(save->eint_fltcon0, regs + EXYNOS_GPIO_EFLTCON_OFFSET | ||
605 | + 2 * bank->eint_offset); | ||
606 | writel(save->eint_fltcon1, regs + EXYNOS_GPIO_EFLTCON_OFFSET | ||
607 | + 2 * bank->eint_offset + 4); | ||
608 | } | ||
609 | |||
610 | static void exynos_pinctrl_resume(struct samsung_pinctrl_drv_data *drvdata) | ||
611 | { | ||
612 | struct samsung_pin_ctrl *ctrl = drvdata->ctrl; | ||
613 | struct samsung_pin_bank *bank = ctrl->pin_banks; | ||
614 | int i; | ||
615 | |||
616 | for (i = 0; i < ctrl->nr_banks; ++i, ++bank) | ||
617 | if (bank->eint_type == EINT_TYPE_GPIO) | ||
618 | exynos_pinctrl_resume_bank(drvdata, bank); | ||
619 | } | ||
620 | |||
508 | /* pin banks of exynos4210 pin-controller 0 */ | 621 | /* pin banks of exynos4210 pin-controller 0 */ |
509 | static struct samsung_pin_bank exynos4210_pin_banks0[] = { | 622 | static struct samsung_pin_bank exynos4210_pin_banks0[] = { |
510 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), | 623 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), |
@@ -568,6 +681,8 @@ struct samsung_pin_ctrl exynos4210_pin_ctrl[] = { | |||
568 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | 681 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
569 | .svc = EXYNOS_SVC_OFFSET, | 682 | .svc = EXYNOS_SVC_OFFSET, |
570 | .eint_gpio_init = exynos_eint_gpio_init, | 683 | .eint_gpio_init = exynos_eint_gpio_init, |
684 | .suspend = exynos_pinctrl_suspend, | ||
685 | .resume = exynos_pinctrl_resume, | ||
571 | .label = "exynos4210-gpio-ctrl0", | 686 | .label = "exynos4210-gpio-ctrl0", |
572 | }, { | 687 | }, { |
573 | /* pin-controller instance 1 data */ | 688 | /* pin-controller instance 1 data */ |
@@ -582,6 +697,8 @@ struct samsung_pin_ctrl exynos4210_pin_ctrl[] = { | |||
582 | .svc = EXYNOS_SVC_OFFSET, | 697 | .svc = EXYNOS_SVC_OFFSET, |
583 | .eint_gpio_init = exynos_eint_gpio_init, | 698 | .eint_gpio_init = exynos_eint_gpio_init, |
584 | .eint_wkup_init = exynos_eint_wkup_init, | 699 | .eint_wkup_init = exynos_eint_wkup_init, |
700 | .suspend = exynos_pinctrl_suspend, | ||
701 | .resume = exynos_pinctrl_resume, | ||
585 | .label = "exynos4210-gpio-ctrl1", | 702 | .label = "exynos4210-gpio-ctrl1", |
586 | }, { | 703 | }, { |
587 | /* pin-controller instance 2 data */ | 704 | /* pin-controller instance 2 data */ |
@@ -663,6 +780,8 @@ struct samsung_pin_ctrl exynos4x12_pin_ctrl[] = { | |||
663 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | 780 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
664 | .svc = EXYNOS_SVC_OFFSET, | 781 | .svc = EXYNOS_SVC_OFFSET, |
665 | .eint_gpio_init = exynos_eint_gpio_init, | 782 | .eint_gpio_init = exynos_eint_gpio_init, |
783 | .suspend = exynos_pinctrl_suspend, | ||
784 | .resume = exynos_pinctrl_resume, | ||
666 | .label = "exynos4x12-gpio-ctrl0", | 785 | .label = "exynos4x12-gpio-ctrl0", |
667 | }, { | 786 | }, { |
668 | /* pin-controller instance 1 data */ | 787 | /* pin-controller instance 1 data */ |
@@ -677,6 +796,8 @@ struct samsung_pin_ctrl exynos4x12_pin_ctrl[] = { | |||
677 | .svc = EXYNOS_SVC_OFFSET, | 796 | .svc = EXYNOS_SVC_OFFSET, |
678 | .eint_gpio_init = exynos_eint_gpio_init, | 797 | .eint_gpio_init = exynos_eint_gpio_init, |
679 | .eint_wkup_init = exynos_eint_wkup_init, | 798 | .eint_wkup_init = exynos_eint_wkup_init, |
799 | .suspend = exynos_pinctrl_suspend, | ||
800 | .resume = exynos_pinctrl_resume, | ||
680 | .label = "exynos4x12-gpio-ctrl1", | 801 | .label = "exynos4x12-gpio-ctrl1", |
681 | }, { | 802 | }, { |
682 | /* pin-controller instance 2 data */ | 803 | /* pin-controller instance 2 data */ |
@@ -687,6 +808,8 @@ struct samsung_pin_ctrl exynos4x12_pin_ctrl[] = { | |||
687 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | 808 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
688 | .svc = EXYNOS_SVC_OFFSET, | 809 | .svc = EXYNOS_SVC_OFFSET, |
689 | .eint_gpio_init = exynos_eint_gpio_init, | 810 | .eint_gpio_init = exynos_eint_gpio_init, |
811 | .suspend = exynos_pinctrl_suspend, | ||
812 | .resume = exynos_pinctrl_resume, | ||
690 | .label = "exynos4x12-gpio-ctrl2", | 813 | .label = "exynos4x12-gpio-ctrl2", |
691 | }, { | 814 | }, { |
692 | /* pin-controller instance 3 data */ | 815 | /* pin-controller instance 3 data */ |
@@ -697,6 +820,8 @@ struct samsung_pin_ctrl exynos4x12_pin_ctrl[] = { | |||
697 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | 820 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
698 | .svc = EXYNOS_SVC_OFFSET, | 821 | .svc = EXYNOS_SVC_OFFSET, |
699 | .eint_gpio_init = exynos_eint_gpio_init, | 822 | .eint_gpio_init = exynos_eint_gpio_init, |
823 | .suspend = exynos_pinctrl_suspend, | ||
824 | .resume = exynos_pinctrl_resume, | ||
700 | .label = "exynos4x12-gpio-ctrl3", | 825 | .label = "exynos4x12-gpio-ctrl3", |
701 | }, | 826 | }, |
702 | }; | 827 | }; |
@@ -775,6 +900,8 @@ struct samsung_pin_ctrl exynos5250_pin_ctrl[] = { | |||
775 | .svc = EXYNOS_SVC_OFFSET, | 900 | .svc = EXYNOS_SVC_OFFSET, |
776 | .eint_gpio_init = exynos_eint_gpio_init, | 901 | .eint_gpio_init = exynos_eint_gpio_init, |
777 | .eint_wkup_init = exynos_eint_wkup_init, | 902 | .eint_wkup_init = exynos_eint_wkup_init, |
903 | .suspend = exynos_pinctrl_suspend, | ||
904 | .resume = exynos_pinctrl_resume, | ||
778 | .label = "exynos5250-gpio-ctrl0", | 905 | .label = "exynos5250-gpio-ctrl0", |
779 | }, { | 906 | }, { |
780 | /* pin-controller instance 1 data */ | 907 | /* pin-controller instance 1 data */ |
@@ -785,6 +912,8 @@ struct samsung_pin_ctrl exynos5250_pin_ctrl[] = { | |||
785 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | 912 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
786 | .svc = EXYNOS_SVC_OFFSET, | 913 | .svc = EXYNOS_SVC_OFFSET, |
787 | .eint_gpio_init = exynos_eint_gpio_init, | 914 | .eint_gpio_init = exynos_eint_gpio_init, |
915 | .suspend = exynos_pinctrl_suspend, | ||
916 | .resume = exynos_pinctrl_resume, | ||
788 | .label = "exynos5250-gpio-ctrl1", | 917 | .label = "exynos5250-gpio-ctrl1", |
789 | }, { | 918 | }, { |
790 | /* pin-controller instance 2 data */ | 919 | /* pin-controller instance 2 data */ |
@@ -795,6 +924,8 @@ struct samsung_pin_ctrl exynos5250_pin_ctrl[] = { | |||
795 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | 924 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
796 | .svc = EXYNOS_SVC_OFFSET, | 925 | .svc = EXYNOS_SVC_OFFSET, |
797 | .eint_gpio_init = exynos_eint_gpio_init, | 926 | .eint_gpio_init = exynos_eint_gpio_init, |
927 | .suspend = exynos_pinctrl_suspend, | ||
928 | .resume = exynos_pinctrl_resume, | ||
798 | .label = "exynos5250-gpio-ctrl2", | 929 | .label = "exynos5250-gpio-ctrl2", |
799 | }, { | 930 | }, { |
800 | /* pin-controller instance 3 data */ | 931 | /* pin-controller instance 3 data */ |
@@ -805,6 +936,8 @@ struct samsung_pin_ctrl exynos5250_pin_ctrl[] = { | |||
805 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | 936 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
806 | .svc = EXYNOS_SVC_OFFSET, | 937 | .svc = EXYNOS_SVC_OFFSET, |
807 | .eint_gpio_init = exynos_eint_gpio_init, | 938 | .eint_gpio_init = exynos_eint_gpio_init, |
939 | .suspend = exynos_pinctrl_suspend, | ||
940 | .resume = exynos_pinctrl_resume, | ||
808 | .label = "exynos5250-gpio-ctrl3", | 941 | .label = "exynos5250-gpio-ctrl3", |
809 | }, | 942 | }, |
810 | }; | 943 | }; |
diff --git a/drivers/pinctrl/pinctrl-exynos.h b/drivers/pinctrl/pinctrl-exynos.h index 9b1f77a5bf0f..3c91c357792f 100644 --- a/drivers/pinctrl/pinctrl-exynos.h +++ b/drivers/pinctrl/pinctrl-exynos.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | /* External GPIO and wakeup interrupt related definitions */ | 20 | /* External GPIO and wakeup interrupt related definitions */ |
21 | #define EXYNOS_GPIO_ECON_OFFSET 0x700 | 21 | #define EXYNOS_GPIO_ECON_OFFSET 0x700 |
22 | #define EXYNOS_GPIO_EFLTCON_OFFSET 0x800 | ||
22 | #define EXYNOS_GPIO_EMASK_OFFSET 0x900 | 23 | #define EXYNOS_GPIO_EMASK_OFFSET 0x900 |
23 | #define EXYNOS_GPIO_EPEND_OFFSET 0xA00 | 24 | #define EXYNOS_GPIO_EPEND_OFFSET 0xA00 |
24 | #define EXYNOS_WKUP_ECON_OFFSET 0xE00 | 25 | #define EXYNOS_WKUP_ECON_OFFSET 0xE00 |
diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c index 6038503ed929..32a48f44f574 100644 --- a/drivers/pinctrl/pinctrl-exynos5440.c +++ b/drivers/pinctrl/pinctrl-exynos5440.c | |||
@@ -1000,11 +1000,6 @@ static int exynos5440_pinctrl_probe(struct platform_device *pdev) | |||
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1002 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1003 | if (!res) { | ||
1004 | dev_err(dev, "cannot find IO resource\n"); | ||
1005 | return -ENOENT; | ||
1006 | } | ||
1007 | |||
1008 | priv->reg_base = devm_ioremap_resource(&pdev->dev, res); | 1003 | priv->reg_base = devm_ioremap_resource(&pdev->dev, res); |
1009 | if (IS_ERR(priv->reg_base)) | 1004 | if (IS_ERR(priv->reg_base)) |
1010 | return PTR_ERR(priv->reg_base); | 1005 | return PTR_ERR(priv->reg_base); |
diff --git a/drivers/pinctrl/pinctrl-lantiq.c b/drivers/pinctrl/pinctrl-lantiq.c index 615c5002b757..d22ca252b80d 100644 --- a/drivers/pinctrl/pinctrl-lantiq.c +++ b/drivers/pinctrl/pinctrl-lantiq.c | |||
@@ -52,7 +52,8 @@ static void ltq_pinctrl_dt_free_map(struct pinctrl_dev *pctldev, | |||
52 | int i; | 52 | int i; |
53 | 53 | ||
54 | for (i = 0; i < num_maps; i++) | 54 | for (i = 0; i < num_maps; i++) |
55 | if (map[i].type == PIN_MAP_TYPE_CONFIGS_PIN) | 55 | if (map[i].type == PIN_MAP_TYPE_CONFIGS_PIN || |
56 | map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP) | ||
56 | kfree(map[i].data.configs.configs); | 57 | kfree(map[i].data.configs.configs); |
57 | kfree(map); | 58 | kfree(map); |
58 | } | 59 | } |
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index 976366899f68..63ac22e89678 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/gpio.h> | 28 | #include <linux/gpio.h> |
29 | #include <linux/irqdomain.h> | 29 | #include <linux/irqdomain.h> |
30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
31 | #include <linux/syscore_ops.h> | ||
31 | 32 | ||
32 | #include "core.h" | 33 | #include "core.h" |
33 | #include "pinctrl-samsung.h" | 34 | #include "pinctrl-samsung.h" |
@@ -48,6 +49,9 @@ static struct pin_config { | |||
48 | { "samsung,pin-pud-pdn", PINCFG_TYPE_PUD_PDN }, | 49 | { "samsung,pin-pud-pdn", PINCFG_TYPE_PUD_PDN }, |
49 | }; | 50 | }; |
50 | 51 | ||
52 | /* Global list of devices (struct samsung_pinctrl_drv_data) */ | ||
53 | LIST_HEAD(drvdata_list); | ||
54 | |||
51 | static unsigned int pin_base; | 55 | static unsigned int pin_base; |
52 | 56 | ||
53 | static inline struct samsung_pin_bank *gc_to_pin_bank(struct gpio_chip *gc) | 57 | static inline struct samsung_pin_bank *gc_to_pin_bank(struct gpio_chip *gc) |
@@ -932,11 +936,6 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) | |||
932 | drvdata->dev = dev; | 936 | drvdata->dev = dev; |
933 | 937 | ||
934 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 938 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
935 | if (!res) { | ||
936 | dev_err(dev, "cannot find IO resource\n"); | ||
937 | return -ENOENT; | ||
938 | } | ||
939 | |||
940 | drvdata->virt_base = devm_ioremap_resource(&pdev->dev, res); | 939 | drvdata->virt_base = devm_ioremap_resource(&pdev->dev, res); |
941 | if (IS_ERR(drvdata->virt_base)) | 940 | if (IS_ERR(drvdata->virt_base)) |
942 | return PTR_ERR(drvdata->virt_base); | 941 | return PTR_ERR(drvdata->virt_base); |
@@ -961,9 +960,151 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) | |||
961 | ctrl->eint_wkup_init(drvdata); | 960 | ctrl->eint_wkup_init(drvdata); |
962 | 961 | ||
963 | platform_set_drvdata(pdev, drvdata); | 962 | platform_set_drvdata(pdev, drvdata); |
963 | |||
964 | /* Add to the global list */ | ||
965 | list_add_tail(&drvdata->node, &drvdata_list); | ||
966 | |||
964 | return 0; | 967 | return 0; |
965 | } | 968 | } |
966 | 969 | ||
970 | #ifdef CONFIG_PM | ||
971 | |||
972 | /** | ||
973 | * samsung_pinctrl_suspend_dev - save pinctrl state for suspend for a device | ||
974 | * | ||
975 | * Save data for all banks handled by this device. | ||
976 | */ | ||
977 | static void samsung_pinctrl_suspend_dev( | ||
978 | struct samsung_pinctrl_drv_data *drvdata) | ||
979 | { | ||
980 | struct samsung_pin_ctrl *ctrl = drvdata->ctrl; | ||
981 | void __iomem *virt_base = drvdata->virt_base; | ||
982 | int i; | ||
983 | |||
984 | for (i = 0; i < ctrl->nr_banks; i++) { | ||
985 | struct samsung_pin_bank *bank = &ctrl->pin_banks[i]; | ||
986 | void __iomem *reg = virt_base + bank->pctl_offset; | ||
987 | |||
988 | u8 *offs = bank->type->reg_offset; | ||
989 | u8 *widths = bank->type->fld_width; | ||
990 | enum pincfg_type type; | ||
991 | |||
992 | /* Registers without a powerdown config aren't lost */ | ||
993 | if (!widths[PINCFG_TYPE_CON_PDN]) | ||
994 | continue; | ||
995 | |||
996 | for (type = 0; type < PINCFG_TYPE_NUM; type++) | ||
997 | if (widths[type]) | ||
998 | bank->pm_save[type] = readl(reg + offs[type]); | ||
999 | |||
1000 | if (widths[PINCFG_TYPE_FUNC] * bank->nr_pins > 32) { | ||
1001 | /* Some banks have two config registers */ | ||
1002 | bank->pm_save[PINCFG_TYPE_NUM] = | ||
1003 | readl(reg + offs[PINCFG_TYPE_FUNC] + 4); | ||
1004 | pr_debug("Save %s @ %p (con %#010x %08x)\n", | ||
1005 | bank->name, reg, | ||
1006 | bank->pm_save[PINCFG_TYPE_FUNC], | ||
1007 | bank->pm_save[PINCFG_TYPE_NUM]); | ||
1008 | } else { | ||
1009 | pr_debug("Save %s @ %p (con %#010x)\n", bank->name, | ||
1010 | reg, bank->pm_save[PINCFG_TYPE_FUNC]); | ||
1011 | } | ||
1012 | } | ||
1013 | |||
1014 | if (ctrl->suspend) | ||
1015 | ctrl->suspend(drvdata); | ||
1016 | } | ||
1017 | |||
1018 | /** | ||
1019 | * samsung_pinctrl_resume_dev - restore pinctrl state from suspend for a device | ||
1020 | * | ||
1021 | * Restore one of the banks that was saved during suspend. | ||
1022 | * | ||
1023 | * We don't bother doing anything complicated to avoid glitching lines since | ||
1024 | * we're called before pad retention is turned off. | ||
1025 | */ | ||
1026 | static void samsung_pinctrl_resume_dev(struct samsung_pinctrl_drv_data *drvdata) | ||
1027 | { | ||
1028 | struct samsung_pin_ctrl *ctrl = drvdata->ctrl; | ||
1029 | void __iomem *virt_base = drvdata->virt_base; | ||
1030 | int i; | ||
1031 | |||
1032 | if (ctrl->resume) | ||
1033 | ctrl->resume(drvdata); | ||
1034 | |||
1035 | for (i = 0; i < ctrl->nr_banks; i++) { | ||
1036 | struct samsung_pin_bank *bank = &ctrl->pin_banks[i]; | ||
1037 | void __iomem *reg = virt_base + bank->pctl_offset; | ||
1038 | |||
1039 | u8 *offs = bank->type->reg_offset; | ||
1040 | u8 *widths = bank->type->fld_width; | ||
1041 | enum pincfg_type type; | ||
1042 | |||
1043 | /* Registers without a powerdown config aren't lost */ | ||
1044 | if (!widths[PINCFG_TYPE_CON_PDN]) | ||
1045 | continue; | ||
1046 | |||
1047 | if (widths[PINCFG_TYPE_FUNC] * bank->nr_pins > 32) { | ||
1048 | /* Some banks have two config registers */ | ||
1049 | pr_debug("%s @ %p (con %#010x %08x => %#010x %08x)\n", | ||
1050 | bank->name, reg, | ||
1051 | readl(reg + offs[PINCFG_TYPE_FUNC]), | ||
1052 | readl(reg + offs[PINCFG_TYPE_FUNC] + 4), | ||
1053 | bank->pm_save[PINCFG_TYPE_FUNC], | ||
1054 | bank->pm_save[PINCFG_TYPE_NUM]); | ||
1055 | writel(bank->pm_save[PINCFG_TYPE_NUM], | ||
1056 | reg + offs[PINCFG_TYPE_FUNC] + 4); | ||
1057 | } else { | ||
1058 | pr_debug("%s @ %p (con %#010x => %#010x)\n", bank->name, | ||
1059 | reg, readl(reg + offs[PINCFG_TYPE_FUNC]), | ||
1060 | bank->pm_save[PINCFG_TYPE_FUNC]); | ||
1061 | } | ||
1062 | for (type = 0; type < PINCFG_TYPE_NUM; type++) | ||
1063 | if (widths[type]) | ||
1064 | writel(bank->pm_save[type], reg + offs[type]); | ||
1065 | } | ||
1066 | } | ||
1067 | |||
1068 | /** | ||
1069 | * samsung_pinctrl_suspend - save pinctrl state for suspend | ||
1070 | * | ||
1071 | * Save data for all banks across all devices. | ||
1072 | */ | ||
1073 | static int samsung_pinctrl_suspend(void) | ||
1074 | { | ||
1075 | struct samsung_pinctrl_drv_data *drvdata; | ||
1076 | |||
1077 | list_for_each_entry(drvdata, &drvdata_list, node) { | ||
1078 | samsung_pinctrl_suspend_dev(drvdata); | ||
1079 | } | ||
1080 | |||
1081 | return 0; | ||
1082 | } | ||
1083 | |||
1084 | /** | ||
1085 | * samsung_pinctrl_resume - restore pinctrl state for suspend | ||
1086 | * | ||
1087 | * Restore data for all banks across all devices. | ||
1088 | */ | ||
1089 | static void samsung_pinctrl_resume(void) | ||
1090 | { | ||
1091 | struct samsung_pinctrl_drv_data *drvdata; | ||
1092 | |||
1093 | list_for_each_entry_reverse(drvdata, &drvdata_list, node) { | ||
1094 | samsung_pinctrl_resume_dev(drvdata); | ||
1095 | } | ||
1096 | } | ||
1097 | |||
1098 | #else | ||
1099 | #define samsung_pinctrl_suspend NULL | ||
1100 | #define samsung_pinctrl_resume NULL | ||
1101 | #endif | ||
1102 | |||
1103 | static struct syscore_ops samsung_pinctrl_syscore_ops = { | ||
1104 | .suspend = samsung_pinctrl_suspend, | ||
1105 | .resume = samsung_pinctrl_resume, | ||
1106 | }; | ||
1107 | |||
967 | static const struct of_device_id samsung_pinctrl_dt_match[] = { | 1108 | static const struct of_device_id samsung_pinctrl_dt_match[] = { |
968 | #ifdef CONFIG_PINCTRL_EXYNOS | 1109 | #ifdef CONFIG_PINCTRL_EXYNOS |
969 | { .compatible = "samsung,exynos4210-pinctrl", | 1110 | { .compatible = "samsung,exynos4210-pinctrl", |
@@ -992,6 +1133,14 @@ static struct platform_driver samsung_pinctrl_driver = { | |||
992 | 1133 | ||
993 | static int __init samsung_pinctrl_drv_register(void) | 1134 | static int __init samsung_pinctrl_drv_register(void) |
994 | { | 1135 | { |
1136 | /* | ||
1137 | * Register syscore ops for save/restore of registers across suspend. | ||
1138 | * It's important to ensure that this driver is running at an earlier | ||
1139 | * initcall level than any arch-specific init calls that install syscore | ||
1140 | * ops that turn off pad retention (like exynos_pm_resume). | ||
1141 | */ | ||
1142 | register_syscore_ops(&samsung_pinctrl_syscore_ops); | ||
1143 | |||
995 | return platform_driver_register(&samsung_pinctrl_driver); | 1144 | return platform_driver_register(&samsung_pinctrl_driver); |
996 | } | 1145 | } |
997 | postcore_initcall(samsung_pinctrl_drv_register); | 1146 | postcore_initcall(samsung_pinctrl_drv_register); |
diff --git a/drivers/pinctrl/pinctrl-samsung.h b/drivers/pinctrl/pinctrl-samsung.h index 7c7f9ebcd05b..26d3519240c9 100644 --- a/drivers/pinctrl/pinctrl-samsung.h +++ b/drivers/pinctrl/pinctrl-samsung.h | |||
@@ -127,6 +127,7 @@ struct samsung_pin_bank_type { | |||
127 | * @gpio_chip: GPIO chip of the bank. | 127 | * @gpio_chip: GPIO chip of the bank. |
128 | * @grange: linux gpio pin range supported by this bank. | 128 | * @grange: linux gpio pin range supported by this bank. |
129 | * @slock: spinlock protecting bank registers | 129 | * @slock: spinlock protecting bank registers |
130 | * @pm_save: saved register values during suspend | ||
130 | */ | 131 | */ |
131 | struct samsung_pin_bank { | 132 | struct samsung_pin_bank { |
132 | struct samsung_pin_bank_type *type; | 133 | struct samsung_pin_bank_type *type; |
@@ -138,12 +139,15 @@ struct samsung_pin_bank { | |||
138 | u32 eint_mask; | 139 | u32 eint_mask; |
139 | u32 eint_offset; | 140 | u32 eint_offset; |
140 | char *name; | 141 | char *name; |
142 | void *soc_priv; | ||
141 | struct device_node *of_node; | 143 | struct device_node *of_node; |
142 | struct samsung_pinctrl_drv_data *drvdata; | 144 | struct samsung_pinctrl_drv_data *drvdata; |
143 | struct irq_domain *irq_domain; | 145 | struct irq_domain *irq_domain; |
144 | struct gpio_chip gpio_chip; | 146 | struct gpio_chip gpio_chip; |
145 | struct pinctrl_gpio_range grange; | 147 | struct pinctrl_gpio_range grange; |
146 | spinlock_t slock; | 148 | spinlock_t slock; |
149 | |||
150 | u32 pm_save[PINCFG_TYPE_NUM + 1]; /* +1 to handle double CON registers*/ | ||
147 | }; | 151 | }; |
148 | 152 | ||
149 | /** | 153 | /** |
@@ -184,11 +188,15 @@ struct samsung_pin_ctrl { | |||
184 | 188 | ||
185 | int (*eint_gpio_init)(struct samsung_pinctrl_drv_data *); | 189 | int (*eint_gpio_init)(struct samsung_pinctrl_drv_data *); |
186 | int (*eint_wkup_init)(struct samsung_pinctrl_drv_data *); | 190 | int (*eint_wkup_init)(struct samsung_pinctrl_drv_data *); |
191 | void (*suspend)(struct samsung_pinctrl_drv_data *); | ||
192 | void (*resume)(struct samsung_pinctrl_drv_data *); | ||
193 | |||
187 | char *label; | 194 | char *label; |
188 | }; | 195 | }; |
189 | 196 | ||
190 | /** | 197 | /** |
191 | * struct samsung_pinctrl_drv_data: wrapper for holding driver data together. | 198 | * struct samsung_pinctrl_drv_data: wrapper for holding driver data together. |
199 | * @node: global list node | ||
192 | * @virt_base: register base address of the controller. | 200 | * @virt_base: register base address of the controller. |
193 | * @dev: device instance representing the controller. | 201 | * @dev: device instance representing the controller. |
194 | * @irq: interrpt number used by the controller to notify gpio interrupts. | 202 | * @irq: interrpt number used by the controller to notify gpio interrupts. |
@@ -201,6 +209,7 @@ struct samsung_pin_ctrl { | |||
201 | * @nr_function: number of such pin functions. | 209 | * @nr_function: number of such pin functions. |
202 | */ | 210 | */ |
203 | struct samsung_pinctrl_drv_data { | 211 | struct samsung_pinctrl_drv_data { |
212 | struct list_head node; | ||
204 | void __iomem *virt_base; | 213 | void __iomem *virt_base; |
205 | struct device *dev; | 214 | struct device *dev; |
206 | int irq; | 215 | int irq; |
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 5f2d2bfd356e..b9fa04618601 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c | |||
@@ -1166,7 +1166,8 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, | |||
1166 | (*map)->data.mux.function = np->name; | 1166 | (*map)->data.mux.function = np->name; |
1167 | 1167 | ||
1168 | if (pcs->is_pinconf) { | 1168 | if (pcs->is_pinconf) { |
1169 | if (pcs_parse_pinconf(pcs, np, function, map)) | 1169 | res = pcs_parse_pinconf(pcs, np, function, map); |
1170 | if (res) | ||
1170 | goto free_pingroups; | 1171 | goto free_pingroups; |
1171 | *num_maps = 2; | 1172 | *num_maps = 2; |
1172 | } else { | 1173 | } else { |
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c index c52fc2c08732..b7d8c890514c 100644 --- a/drivers/pinctrl/pinctrl-sunxi.c +++ b/drivers/pinctrl/pinctrl-sunxi.c | |||
@@ -1990,8 +1990,10 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) | |||
1990 | } | 1990 | } |
1991 | 1991 | ||
1992 | clk = devm_clk_get(&pdev->dev, NULL); | 1992 | clk = devm_clk_get(&pdev->dev, NULL); |
1993 | if (IS_ERR(clk)) | 1993 | if (IS_ERR(clk)) { |
1994 | ret = PTR_ERR(clk); | ||
1994 | goto gpiochip_error; | 1995 | goto gpiochip_error; |
1996 | } | ||
1995 | 1997 | ||
1996 | clk_prepare_enable(clk); | 1998 | clk_prepare_enable(clk); |
1997 | 1999 | ||
@@ -2000,7 +2002,8 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) | |||
2000 | return 0; | 2002 | return 0; |
2001 | 2003 | ||
2002 | gpiochip_error: | 2004 | gpiochip_error: |
2003 | ret = gpiochip_remove(pctl->chip); | 2005 | if (gpiochip_remove(pctl->chip)) |
2006 | dev_err(&pdev->dev, "failed to remove gpio chip\n"); | ||
2004 | pinctrl_error: | 2007 | pinctrl_error: |
2005 | pinctrl_unregister(pctl->pctl_dev); | 2008 | pinctrl_unregister(pctl->pctl_dev); |
2006 | return ret; | 2009 | return ret; |
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c index f2977cff8366..e92132c76a6b 100644 --- a/drivers/pinctrl/pinctrl-xway.c +++ b/drivers/pinctrl/pinctrl-xway.c | |||
@@ -716,10 +716,6 @@ static int pinmux_xway_probe(struct platform_device *pdev) | |||
716 | 716 | ||
717 | /* get and remap our register range */ | 717 | /* get and remap our register range */ |
718 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 718 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
719 | if (!res) { | ||
720 | dev_err(&pdev->dev, "Failed to get resource\n"); | ||
721 | return -ENOENT; | ||
722 | } | ||
723 | xway_info.membase[0] = devm_ioremap_resource(&pdev->dev, res); | 719 | xway_info.membase[0] = devm_ioremap_resource(&pdev->dev, res); |
724 | if (IS_ERR(xway_info.membase[0])) | 720 | if (IS_ERR(xway_info.membase[0])) |
725 | return PTR_ERR(xway_info.membase[0]); | 721 | return PTR_ERR(xway_info.membase[0]); |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c index 791a6719d8a9..8cd90e7e945a 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7779.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7779.c | |||
@@ -2357,27 +2357,48 @@ static const unsigned int sdhi3_wp_mux[] = { | |||
2357 | }; | 2357 | }; |
2358 | /* - USB0 ------------------------------------------------------------------- */ | 2358 | /* - USB0 ------------------------------------------------------------------- */ |
2359 | static const unsigned int usb0_pins[] = { | 2359 | static const unsigned int usb0_pins[] = { |
2360 | /* OVC */ | 2360 | /* PENC */ |
2361 | 150, 154, | 2361 | 154, |
2362 | }; | 2362 | }; |
2363 | static const unsigned int usb0_mux[] = { | 2363 | static const unsigned int usb0_mux[] = { |
2364 | USB_OVC0_MARK, USB_PENC0_MARK, | 2364 | USB_PENC0_MARK, |
2365 | }; | ||
2366 | static const unsigned int usb0_ovc_pins[] = { | ||
2367 | /* USB_OVC */ | ||
2368 | 150 | ||
2369 | }; | ||
2370 | static const unsigned int usb0_ovc_mux[] = { | ||
2371 | USB_OVC0_MARK, | ||
2365 | }; | 2372 | }; |
2366 | /* - USB1 ------------------------------------------------------------------- */ | 2373 | /* - USB1 ------------------------------------------------------------------- */ |
2367 | static const unsigned int usb1_pins[] = { | 2374 | static const unsigned int usb1_pins[] = { |
2368 | /* OVC */ | 2375 | /* PENC */ |
2369 | 152, 155, | 2376 | 155, |
2370 | }; | 2377 | }; |
2371 | static const unsigned int usb1_mux[] = { | 2378 | static const unsigned int usb1_mux[] = { |
2372 | USB_OVC1_MARK, USB_PENC1_MARK, | 2379 | USB_PENC1_MARK, |
2380 | }; | ||
2381 | static const unsigned int usb1_ovc_pins[] = { | ||
2382 | /* USB_OVC */ | ||
2383 | 152, | ||
2384 | }; | ||
2385 | static const unsigned int usb1_ovc_mux[] = { | ||
2386 | USB_OVC1_MARK, | ||
2373 | }; | 2387 | }; |
2374 | /* - USB2 ------------------------------------------------------------------- */ | 2388 | /* - USB2 ------------------------------------------------------------------- */ |
2375 | static const unsigned int usb2_pins[] = { | 2389 | static const unsigned int usb2_pins[] = { |
2376 | /* OVC, PENC */ | 2390 | /* PENC */ |
2377 | 125, 156, | 2391 | 156, |
2378 | }; | 2392 | }; |
2379 | static const unsigned int usb2_mux[] = { | 2393 | static const unsigned int usb2_mux[] = { |
2380 | USB_OVC2_MARK, USB_PENC2_MARK, | 2394 | USB_PENC2_MARK, |
2395 | }; | ||
2396 | static const unsigned int usb2_ovc_pins[] = { | ||
2397 | /* USB_OVC */ | ||
2398 | 125, | ||
2399 | }; | ||
2400 | static const unsigned int usb2_ovc_mux[] = { | ||
2401 | USB_OVC2_MARK, | ||
2381 | }; | 2402 | }; |
2382 | 2403 | ||
2383 | static const struct sh_pfc_pin_group pinmux_groups[] = { | 2404 | static const struct sh_pfc_pin_group pinmux_groups[] = { |
@@ -2501,8 +2522,11 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { | |||
2501 | SH_PFC_PIN_GROUP(sdhi3_cd), | 2522 | SH_PFC_PIN_GROUP(sdhi3_cd), |
2502 | SH_PFC_PIN_GROUP(sdhi3_wp), | 2523 | SH_PFC_PIN_GROUP(sdhi3_wp), |
2503 | SH_PFC_PIN_GROUP(usb0), | 2524 | SH_PFC_PIN_GROUP(usb0), |
2525 | SH_PFC_PIN_GROUP(usb0_ovc), | ||
2504 | SH_PFC_PIN_GROUP(usb1), | 2526 | SH_PFC_PIN_GROUP(usb1), |
2527 | SH_PFC_PIN_GROUP(usb1_ovc), | ||
2505 | SH_PFC_PIN_GROUP(usb2), | 2528 | SH_PFC_PIN_GROUP(usb2), |
2529 | SH_PFC_PIN_GROUP(usb2_ovc), | ||
2506 | }; | 2530 | }; |
2507 | 2531 | ||
2508 | static const char * const du0_groups[] = { | 2532 | static const char * const du0_groups[] = { |
@@ -2683,14 +2707,17 @@ static const char * const sdhi3_groups[] = { | |||
2683 | 2707 | ||
2684 | static const char * const usb0_groups[] = { | 2708 | static const char * const usb0_groups[] = { |
2685 | "usb0", | 2709 | "usb0", |
2710 | "usb0_ovc", | ||
2686 | }; | 2711 | }; |
2687 | 2712 | ||
2688 | static const char * const usb1_groups[] = { | 2713 | static const char * const usb1_groups[] = { |
2689 | "usb1", | 2714 | "usb1", |
2715 | "usb1_ovc", | ||
2690 | }; | 2716 | }; |
2691 | 2717 | ||
2692 | static const char * const usb2_groups[] = { | 2718 | static const char * const usb2_groups[] = { |
2693 | "usb2", | 2719 | "usb2", |
2720 | "usb2_ovc", | ||
2694 | }; | 2721 | }; |
2695 | 2722 | ||
2696 | static const struct sh_pfc_function pinmux_functions[] = { | 2723 | static const struct sh_pfc_function pinmux_functions[] = { |
diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8750.c b/drivers/pinctrl/vt8500/pinctrl-wm8750.c index b964cc550568..de43262398db 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wm8750.c +++ b/drivers/pinctrl/vt8500/pinctrl-wm8750.c | |||
@@ -53,7 +53,7 @@ static const struct wmt_pinctrl_bank_registers wm8750_banks[] = { | |||
53 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | 53 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) |
54 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | 54 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) |
55 | #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) | 55 | #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) |
56 | #define WMT_PIN_WAKEUP1 WMT_PIN(0, 16) | 56 | #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17) |
57 | #define WMT_PIN_SD0CD WMT_PIN(0, 28) | 57 | #define WMT_PIN_SD0CD WMT_PIN(0, 28) |
58 | #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) | 58 | #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) |
59 | #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) | 59 | #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) |
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c index ab63104e8dc9..70d986e04afb 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wmt.c +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c | |||
@@ -609,8 +609,7 @@ int wmt_pinctrl_probe(struct platform_device *pdev, | |||
609 | return 0; | 609 | return 0; |
610 | 610 | ||
611 | fail_range: | 611 | fail_range: |
612 | err = gpiochip_remove(&data->gpio_chip); | 612 | if (gpiochip_remove(&data->gpio_chip)) |
613 | if (err) | ||
614 | dev_err(&pdev->dev, "failed to remove gpio chip\n"); | 613 | dev_err(&pdev->dev, "failed to remove gpio chip\n"); |
615 | fail_gpio: | 614 | fail_gpio: |
616 | pinctrl_unregister(data->pctl_dev); | 615 | pinctrl_unregister(data->pctl_dev); |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 8df0c5a21be2..d111c8687f9b 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -703,7 +703,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) | |||
703 | } | 703 | } |
704 | rfkill_init_sw_state(gps_rfkill, | 704 | rfkill_init_sw_state(gps_rfkill, |
705 | hp_wmi_get_sw_state(HPWMI_GPS)); | 705 | hp_wmi_get_sw_state(HPWMI_GPS)); |
706 | rfkill_set_hw_state(bluetooth_rfkill, | 706 | rfkill_set_hw_state(gps_rfkill, |
707 | hp_wmi_get_hw_state(HPWMI_GPS)); | 707 | hp_wmi_get_hw_state(HPWMI_GPS)); |
708 | err = rfkill_register(gps_rfkill); | 708 | err = rfkill_register(gps_rfkill); |
709 | if (err) | 709 | if (err) |
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 0d0b5d7d19d0..7b8979c63f48 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig | |||
@@ -152,6 +152,7 @@ config BATTERY_SBS | |||
152 | 152 | ||
153 | config BATTERY_BQ27x00 | 153 | config BATTERY_BQ27x00 |
154 | tristate "BQ27x00 battery driver" | 154 | tristate "BQ27x00 battery driver" |
155 | depends on I2C || I2C=n | ||
155 | help | 156 | help |
156 | Say Y here to enable support for batteries with BQ27x00 (I2C/HDQ) chips. | 157 | Say Y here to enable support for batteries with BQ27x00 (I2C/HDQ) chips. |
157 | 158 | ||
@@ -284,6 +285,7 @@ config CHARGER_LP8788 | |||
284 | tristate "TI LP8788 charger driver" | 285 | tristate "TI LP8788 charger driver" |
285 | depends on MFD_LP8788 | 286 | depends on MFD_LP8788 |
286 | depends on LP8788_ADC | 287 | depends on LP8788_ADC |
288 | depends on IIO | ||
287 | help | 289 | help |
288 | Say Y to enable support for the LP8788 linear charger. | 290 | Say Y to enable support for the LP8788 linear charger. |
289 | 291 | ||
diff --git a/drivers/power/pm2301_charger.c b/drivers/power/pm2301_charger.c index a44175139bbf..fef56e2041b3 100644 --- a/drivers/power/pm2301_charger.c +++ b/drivers/power/pm2301_charger.c | |||
@@ -1269,5 +1269,5 @@ module_exit(pm2xxx_charger_exit); | |||
1269 | 1269 | ||
1270 | MODULE_LICENSE("GPL v2"); | 1270 | MODULE_LICENSE("GPL v2"); |
1271 | MODULE_AUTHOR("Rajkumar kasirajan, Olivier Launay"); | 1271 | MODULE_AUTHOR("Rajkumar kasirajan, Olivier Launay"); |
1272 | MODULE_ALIAS("platform:pm2xxx-charger"); | 1272 | MODULE_ALIAS("i2c:pm2xxx-charger"); |
1273 | MODULE_DESCRIPTION("PM2xxx charger management driver"); | 1273 | MODULE_DESCRIPTION("PM2xxx charger management driver"); |
diff --git a/drivers/power/wm831x_backup.c b/drivers/power/wm831x_backup.c index 58cbb009b74f..56fb509f4be0 100644 --- a/drivers/power/wm831x_backup.c +++ b/drivers/power/wm831x_backup.c | |||
@@ -207,7 +207,6 @@ static int wm831x_backup_remove(struct platform_device *pdev) | |||
207 | struct wm831x_backup *devdata = platform_get_drvdata(pdev); | 207 | struct wm831x_backup *devdata = platform_get_drvdata(pdev); |
208 | 208 | ||
209 | power_supply_unregister(&devdata->backup); | 209 | power_supply_unregister(&devdata->backup); |
210 | kfree(devdata->backup.name); | ||
211 | 210 | ||
212 | return 0; | 211 | return 0; |
213 | } | 212 | } |
diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c index bea94510ad2d..71a2559278d7 100644 --- a/drivers/ptp/ptp_pch.c +++ b/drivers/ptp/ptp_pch.c | |||
@@ -628,9 +628,10 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
628 | 628 | ||
629 | chip->caps = ptp_pch_caps; | 629 | chip->caps = ptp_pch_caps; |
630 | chip->ptp_clock = ptp_clock_register(&chip->caps, &pdev->dev); | 630 | chip->ptp_clock = ptp_clock_register(&chip->caps, &pdev->dev); |
631 | 631 | if (IS_ERR(chip->ptp_clock)) { | |
632 | if (IS_ERR(chip->ptp_clock)) | 632 | ret = PTR_ERR(chip->ptp_clock); |
633 | return PTR_ERR(chip->ptp_clock); | 633 | goto err_ptp_clock_reg; |
634 | } | ||
634 | 635 | ||
635 | spin_lock_init(&chip->register_lock); | 636 | spin_lock_init(&chip->register_lock); |
636 | 637 | ||
@@ -669,6 +670,7 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
669 | 670 | ||
670 | err_req_irq: | 671 | err_req_irq: |
671 | ptp_clock_unregister(chip->ptp_clock); | 672 | ptp_clock_unregister(chip->ptp_clock); |
673 | err_ptp_clock_reg: | ||
672 | iounmap(chip->regs); | 674 | iounmap(chip->regs); |
673 | chip->regs = NULL; | 675 | chip->regs = NULL; |
674 | 676 | ||
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c index ec287989eafc..c938bae18812 100644 --- a/drivers/pwm/pwm-imx.c +++ b/drivers/pwm/pwm-imx.c | |||
@@ -265,11 +265,6 @@ static int imx_pwm_probe(struct platform_device *pdev) | |||
265 | imx->chip.npwm = 1; | 265 | imx->chip.npwm = 1; |
266 | 266 | ||
267 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 267 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
268 | if (r == NULL) { | ||
269 | dev_err(&pdev->dev, "no memory resource defined\n"); | ||
270 | return -ENODEV; | ||
271 | } | ||
272 | |||
273 | imx->mmio_base = devm_ioremap_resource(&pdev->dev, r); | 268 | imx->mmio_base = devm_ioremap_resource(&pdev->dev, r); |
274 | if (IS_ERR(imx->mmio_base)) | 269 | if (IS_ERR(imx->mmio_base)) |
275 | return PTR_ERR(imx->mmio_base); | 270 | return PTR_ERR(imx->mmio_base); |
diff --git a/drivers/pwm/pwm-puv3.c b/drivers/pwm/pwm-puv3.c index d1eb499fb15d..ed6007b27585 100644 --- a/drivers/pwm/pwm-puv3.c +++ b/drivers/pwm/pwm-puv3.c | |||
@@ -117,11 +117,6 @@ static int pwm_probe(struct platform_device *pdev) | |||
117 | return PTR_ERR(puv3->clk); | 117 | return PTR_ERR(puv3->clk); |
118 | 118 | ||
119 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 119 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
120 | if (r == NULL) { | ||
121 | dev_err(&pdev->dev, "no memory resource defined\n"); | ||
122 | return -ENODEV; | ||
123 | } | ||
124 | |||
125 | puv3->base = devm_ioremap_resource(&pdev->dev, r); | 120 | puv3->base = devm_ioremap_resource(&pdev->dev, r); |
126 | if (IS_ERR(puv3->base)) | 121 | if (IS_ERR(puv3->base)) |
127 | return PTR_ERR(puv3->base); | 122 | return PTR_ERR(puv3->base); |
diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c index dee6ab552a0a..dc9717551d39 100644 --- a/drivers/pwm/pwm-pxa.c +++ b/drivers/pwm/pwm-pxa.c | |||
@@ -147,11 +147,6 @@ static int pwm_probe(struct platform_device *pdev) | |||
147 | pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1; | 147 | pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1; |
148 | 148 | ||
149 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 149 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
150 | if (r == NULL) { | ||
151 | dev_err(&pdev->dev, "no memory resource defined\n"); | ||
152 | return -ENODEV; | ||
153 | } | ||
154 | |||
155 | pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r); | 150 | pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r); |
156 | if (IS_ERR(pwm->mmio_base)) | 151 | if (IS_ERR(pwm->mmio_base)) |
157 | return PTR_ERR(pwm->mmio_base); | 152 | return PTR_ERR(pwm->mmio_base); |
diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c index 3d75f4a88f98..a5402933001f 100644 --- a/drivers/pwm/pwm-tegra.c +++ b/drivers/pwm/pwm-tegra.c | |||
@@ -181,11 +181,6 @@ static int tegra_pwm_probe(struct platform_device *pdev) | |||
181 | pwm->dev = &pdev->dev; | 181 | pwm->dev = &pdev->dev; |
182 | 182 | ||
183 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 183 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
184 | if (!r) { | ||
185 | dev_err(&pdev->dev, "no memory resources defined\n"); | ||
186 | return -ENODEV; | ||
187 | } | ||
188 | |||
189 | pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r); | 184 | pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r); |
190 | if (IS_ERR(pwm->mmio_base)) | 185 | if (IS_ERR(pwm->mmio_base)) |
191 | return PTR_ERR(pwm->mmio_base); | 186 | return PTR_ERR(pwm->mmio_base); |
diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c index 0d65fb2e02c7..72ca42dfa733 100644 --- a/drivers/pwm/pwm-tiecap.c +++ b/drivers/pwm/pwm-tiecap.c | |||
@@ -240,11 +240,6 @@ static int ecap_pwm_probe(struct platform_device *pdev) | |||
240 | pc->chip.npwm = 1; | 240 | pc->chip.npwm = 1; |
241 | 241 | ||
242 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 242 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
243 | if (!r) { | ||
244 | dev_err(&pdev->dev, "no memory resource defined\n"); | ||
245 | return -ENODEV; | ||
246 | } | ||
247 | |||
248 | pc->mmio_base = devm_ioremap_resource(&pdev->dev, r); | 243 | pc->mmio_base = devm_ioremap_resource(&pdev->dev, r); |
249 | if (IS_ERR(pc->mmio_base)) | 244 | if (IS_ERR(pc->mmio_base)) |
250 | return PTR_ERR(pc->mmio_base); | 245 | return PTR_ERR(pc->mmio_base); |
diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c index 6a217596942f..48a485c2e422 100644 --- a/drivers/pwm/pwm-tiehrpwm.c +++ b/drivers/pwm/pwm-tiehrpwm.c | |||
@@ -471,11 +471,6 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev) | |||
471 | pc->chip.npwm = NUM_PWM_CHANNEL; | 471 | pc->chip.npwm = NUM_PWM_CHANNEL; |
472 | 472 | ||
473 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 473 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
474 | if (!r) { | ||
475 | dev_err(&pdev->dev, "no memory resource defined\n"); | ||
476 | return -ENODEV; | ||
477 | } | ||
478 | |||
479 | pc->mmio_base = devm_ioremap_resource(&pdev->dev, r); | 474 | pc->mmio_base = devm_ioremap_resource(&pdev->dev, r); |
480 | if (IS_ERR(pc->mmio_base)) | 475 | if (IS_ERR(pc->mmio_base)) |
481 | return PTR_ERR(pc->mmio_base); | 476 | return PTR_ERR(pc->mmio_base); |
diff --git a/drivers/pwm/pwm-tipwmss.c b/drivers/pwm/pwm-tipwmss.c index c9c3d3a1e0eb..3b119bc2c3c6 100644 --- a/drivers/pwm/pwm-tipwmss.c +++ b/drivers/pwm/pwm-tipwmss.c | |||
@@ -70,11 +70,6 @@ static int pwmss_probe(struct platform_device *pdev) | |||
70 | mutex_init(&info->pwmss_lock); | 70 | mutex_init(&info->pwmss_lock); |
71 | 71 | ||
72 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 72 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
73 | if (!r) { | ||
74 | dev_err(&pdev->dev, "no memory resource defined\n"); | ||
75 | return -ENODEV; | ||
76 | } | ||
77 | |||
78 | info->mmio_base = devm_ioremap_resource(&pdev->dev, r); | 73 | info->mmio_base = devm_ioremap_resource(&pdev->dev, r); |
79 | if (IS_ERR(info->mmio_base)) | 74 | if (IS_ERR(info->mmio_base)) |
80 | return PTR_ERR(info->mmio_base); | 75 | return PTR_ERR(info->mmio_base); |
diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c index 69effd19afc7..323125abf3f4 100644 --- a/drivers/pwm/pwm-vt8500.c +++ b/drivers/pwm/pwm-vt8500.c | |||
@@ -230,11 +230,6 @@ static int vt8500_pwm_probe(struct platform_device *pdev) | |||
230 | } | 230 | } |
231 | 231 | ||
232 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 232 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
233 | if (r == NULL) { | ||
234 | dev_err(&pdev->dev, "no memory resource defined\n"); | ||
235 | return -ENODEV; | ||
236 | } | ||
237 | |||
238 | chip->base = devm_ioremap_resource(&pdev->dev, r); | 233 | chip->base = devm_ioremap_resource(&pdev->dev, r); |
239 | if (IS_ERR(chip->base)) | 234 | if (IS_ERR(chip->base)) |
240 | return PTR_ERR(chip->base); | 235 | return PTR_ERR(chip->base); |
diff --git a/drivers/rapidio/Kconfig b/drivers/rapidio/Kconfig index 6194d35ebb97..5ab056494bbe 100644 --- a/drivers/rapidio/Kconfig +++ b/drivers/rapidio/Kconfig | |||
@@ -47,4 +47,24 @@ config RAPIDIO_DEBUG | |||
47 | 47 | ||
48 | If you are unsure about this, say N here. | 48 | If you are unsure about this, say N here. |
49 | 49 | ||
50 | choice | ||
51 | prompt "Enumeration method" | ||
52 | depends on RAPIDIO | ||
53 | default RAPIDIO_ENUM_BASIC | ||
54 | help | ||
55 | There are different enumeration and discovery mechanisms offered | ||
56 | for RapidIO subsystem. You may select single built-in method or | ||
57 | or any number of methods to be built as modules. | ||
58 | Selecting a built-in method disables use of loadable methods. | ||
59 | |||
60 | If unsure, select Basic built-in. | ||
61 | |||
62 | config RAPIDIO_ENUM_BASIC | ||
63 | tristate "Basic" | ||
64 | help | ||
65 | This option includes basic RapidIO fabric enumeration and discovery | ||
66 | mechanism similar to one described in RapidIO specification Annex 1. | ||
67 | |||
68 | endchoice | ||
69 | |||
50 | source "drivers/rapidio/switches/Kconfig" | 70 | source "drivers/rapidio/switches/Kconfig" |
diff --git a/drivers/rapidio/Makefile b/drivers/rapidio/Makefile index ec3fb8121004..3036702ffe8b 100644 --- a/drivers/rapidio/Makefile +++ b/drivers/rapidio/Makefile | |||
@@ -1,7 +1,8 @@ | |||
1 | # | 1 | # |
2 | # Makefile for RapidIO interconnect services | 2 | # Makefile for RapidIO interconnect services |
3 | # | 3 | # |
4 | obj-y += rio.o rio-access.o rio-driver.o rio-scan.o rio-sysfs.o | 4 | obj-y += rio.o rio-access.o rio-driver.o rio-sysfs.o |
5 | obj-$(CONFIG_RAPIDIO_ENUM_BASIC) += rio-scan.o | ||
5 | 6 | ||
6 | obj-$(CONFIG_RAPIDIO) += switches/ | 7 | obj-$(CONFIG_RAPIDIO) += switches/ |
7 | obj-$(CONFIG_RAPIDIO) += devices/ | 8 | obj-$(CONFIG_RAPIDIO) += devices/ |
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c index 6faba406b6e9..a8b2c23a7ef4 100644 --- a/drivers/rapidio/devices/tsi721.c +++ b/drivers/rapidio/devices/tsi721.c | |||
@@ -471,6 +471,10 @@ static irqreturn_t tsi721_irqhandler(int irq, void *ptr) | |||
471 | u32 intval; | 471 | u32 intval; |
472 | u32 ch_inte; | 472 | u32 ch_inte; |
473 | 473 | ||
474 | /* For MSI mode disable all device-level interrupts */ | ||
475 | if (priv->flags & TSI721_USING_MSI) | ||
476 | iowrite32(0, priv->regs + TSI721_DEV_INTE); | ||
477 | |||
474 | dev_int = ioread32(priv->regs + TSI721_DEV_INT); | 478 | dev_int = ioread32(priv->regs + TSI721_DEV_INT); |
475 | if (!dev_int) | 479 | if (!dev_int) |
476 | return IRQ_NONE; | 480 | return IRQ_NONE; |
@@ -560,6 +564,14 @@ static irqreturn_t tsi721_irqhandler(int irq, void *ptr) | |||
560 | } | 564 | } |
561 | } | 565 | } |
562 | #endif | 566 | #endif |
567 | |||
568 | /* For MSI mode re-enable device-level interrupts */ | ||
569 | if (priv->flags & TSI721_USING_MSI) { | ||
570 | dev_int = TSI721_DEV_INT_SR2PC_CH | TSI721_DEV_INT_SRIO | | ||
571 | TSI721_DEV_INT_SMSG_CH | TSI721_DEV_INT_BDMA_CH; | ||
572 | iowrite32(dev_int, priv->regs + TSI721_DEV_INTE); | ||
573 | } | ||
574 | |||
563 | return IRQ_HANDLED; | 575 | return IRQ_HANDLED; |
564 | } | 576 | } |
565 | 577 | ||
diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c index 0f4a53bdaa3c..a0c875563d76 100644 --- a/drivers/rapidio/rio-driver.c +++ b/drivers/rapidio/rio-driver.c | |||
@@ -164,6 +164,13 @@ void rio_unregister_driver(struct rio_driver *rdrv) | |||
164 | driver_unregister(&rdrv->driver); | 164 | driver_unregister(&rdrv->driver); |
165 | } | 165 | } |
166 | 166 | ||
167 | void rio_attach_device(struct rio_dev *rdev) | ||
168 | { | ||
169 | rdev->dev.bus = &rio_bus_type; | ||
170 | rdev->dev.parent = &rio_bus; | ||
171 | } | ||
172 | EXPORT_SYMBOL_GPL(rio_attach_device); | ||
173 | |||
167 | /** | 174 | /** |
168 | * rio_match_bus - Tell if a RIO device structure has a matching RIO driver device id structure | 175 | * rio_match_bus - Tell if a RIO device structure has a matching RIO driver device id structure |
169 | * @dev: the standard device structure to match against | 176 | * @dev: the standard device structure to match against |
@@ -200,6 +207,7 @@ struct bus_type rio_bus_type = { | |||
200 | .name = "rapidio", | 207 | .name = "rapidio", |
201 | .match = rio_match_bus, | 208 | .match = rio_match_bus, |
202 | .dev_attrs = rio_dev_attrs, | 209 | .dev_attrs = rio_dev_attrs, |
210 | .bus_attrs = rio_bus_attrs, | ||
203 | .probe = rio_device_probe, | 211 | .probe = rio_device_probe, |
204 | .remove = rio_device_remove, | 212 | .remove = rio_device_remove, |
205 | }; | 213 | }; |
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index a965acd3c0e4..4c15dbf81087 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c | |||
@@ -37,12 +37,8 @@ | |||
37 | 37 | ||
38 | #include "rio.h" | 38 | #include "rio.h" |
39 | 39 | ||
40 | LIST_HEAD(rio_devices); | ||
41 | |||
42 | static void rio_init_em(struct rio_dev *rdev); | 40 | static void rio_init_em(struct rio_dev *rdev); |
43 | 41 | ||
44 | DEFINE_SPINLOCK(rio_global_list_lock); | ||
45 | |||
46 | static int next_destid = 0; | 42 | static int next_destid = 0; |
47 | static int next_comptag = 1; | 43 | static int next_comptag = 1; |
48 | 44 | ||
@@ -327,127 +323,6 @@ static int rio_is_switch(struct rio_dev *rdev) | |||
327 | } | 323 | } |
328 | 324 | ||
329 | /** | 325 | /** |
330 | * rio_switch_init - Sets switch operations for a particular vendor switch | ||
331 | * @rdev: RIO device | ||
332 | * @do_enum: Enumeration/Discovery mode flag | ||
333 | * | ||
334 | * Searches the RIO switch ops table for known switch types. If the vid | ||
335 | * and did match a switch table entry, then call switch initialization | ||
336 | * routine to setup switch-specific routines. | ||
337 | */ | ||
338 | static void rio_switch_init(struct rio_dev *rdev, int do_enum) | ||
339 | { | ||
340 | struct rio_switch_ops *cur = __start_rio_switch_ops; | ||
341 | struct rio_switch_ops *end = __end_rio_switch_ops; | ||
342 | |||
343 | while (cur < end) { | ||
344 | if ((cur->vid == rdev->vid) && (cur->did == rdev->did)) { | ||
345 | pr_debug("RIO: calling init routine for %s\n", | ||
346 | rio_name(rdev)); | ||
347 | cur->init_hook(rdev, do_enum); | ||
348 | break; | ||
349 | } | ||
350 | cur++; | ||
351 | } | ||
352 | |||
353 | if ((cur >= end) && (rdev->pef & RIO_PEF_STD_RT)) { | ||
354 | pr_debug("RIO: adding STD routing ops for %s\n", | ||
355 | rio_name(rdev)); | ||
356 | rdev->rswitch->add_entry = rio_std_route_add_entry; | ||
357 | rdev->rswitch->get_entry = rio_std_route_get_entry; | ||
358 | rdev->rswitch->clr_table = rio_std_route_clr_table; | ||
359 | } | ||
360 | |||
361 | if (!rdev->rswitch->add_entry || !rdev->rswitch->get_entry) | ||
362 | printk(KERN_ERR "RIO: missing routing ops for %s\n", | ||
363 | rio_name(rdev)); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * rio_add_device- Adds a RIO device to the device model | ||
368 | * @rdev: RIO device | ||
369 | * | ||
370 | * Adds the RIO device to the global device list and adds the RIO | ||
371 | * device to the RIO device list. Creates the generic sysfs nodes | ||
372 | * for an RIO device. | ||
373 | */ | ||
374 | static int rio_add_device(struct rio_dev *rdev) | ||
375 | { | ||
376 | int err; | ||
377 | |||
378 | err = device_add(&rdev->dev); | ||
379 | if (err) | ||
380 | return err; | ||
381 | |||
382 | spin_lock(&rio_global_list_lock); | ||
383 | list_add_tail(&rdev->global_list, &rio_devices); | ||
384 | spin_unlock(&rio_global_list_lock); | ||
385 | |||
386 | rio_create_sysfs_dev_files(rdev); | ||
387 | |||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * rio_enable_rx_tx_port - enable input receiver and output transmitter of | ||
393 | * given port | ||
394 | * @port: Master port associated with the RIO network | ||
395 | * @local: local=1 select local port otherwise a far device is reached | ||
396 | * @destid: Destination ID of the device to check host bit | ||
397 | * @hopcount: Number of hops to reach the target | ||
398 | * @port_num: Port (-number on switch) to enable on a far end device | ||
399 | * | ||
400 | * Returns 0 or 1 from on General Control Command and Status Register | ||
401 | * (EXT_PTR+0x3C) | ||
402 | */ | ||
403 | inline int rio_enable_rx_tx_port(struct rio_mport *port, | ||
404 | int local, u16 destid, | ||
405 | u8 hopcount, u8 port_num) { | ||
406 | #ifdef CONFIG_RAPIDIO_ENABLE_RX_TX_PORTS | ||
407 | u32 regval; | ||
408 | u32 ext_ftr_ptr; | ||
409 | |||
410 | /* | ||
411 | * enable rx input tx output port | ||
412 | */ | ||
413 | pr_debug("rio_enable_rx_tx_port(local = %d, destid = %d, hopcount = " | ||
414 | "%d, port_num = %d)\n", local, destid, hopcount, port_num); | ||
415 | |||
416 | ext_ftr_ptr = rio_mport_get_physefb(port, local, destid, hopcount); | ||
417 | |||
418 | if (local) { | ||
419 | rio_local_read_config_32(port, ext_ftr_ptr + | ||
420 | RIO_PORT_N_CTL_CSR(0), | ||
421 | ®val); | ||
422 | } else { | ||
423 | if (rio_mport_read_config_32(port, destid, hopcount, | ||
424 | ext_ftr_ptr + RIO_PORT_N_CTL_CSR(port_num), ®val) < 0) | ||
425 | return -EIO; | ||
426 | } | ||
427 | |||
428 | if (regval & RIO_PORT_N_CTL_P_TYP_SER) { | ||
429 | /* serial */ | ||
430 | regval = regval | RIO_PORT_N_CTL_EN_RX_SER | ||
431 | | RIO_PORT_N_CTL_EN_TX_SER; | ||
432 | } else { | ||
433 | /* parallel */ | ||
434 | regval = regval | RIO_PORT_N_CTL_EN_RX_PAR | ||
435 | | RIO_PORT_N_CTL_EN_TX_PAR; | ||
436 | } | ||
437 | |||
438 | if (local) { | ||
439 | rio_local_write_config_32(port, ext_ftr_ptr + | ||
440 | RIO_PORT_N_CTL_CSR(0), regval); | ||
441 | } else { | ||
442 | if (rio_mport_write_config_32(port, destid, hopcount, | ||
443 | ext_ftr_ptr + RIO_PORT_N_CTL_CSR(port_num), regval) < 0) | ||
444 | return -EIO; | ||
445 | } | ||
446 | #endif | ||
447 | return 0; | ||
448 | } | ||
449 | |||
450 | /** | ||
451 | * rio_setup_device- Allocates and sets up a RIO device | 326 | * rio_setup_device- Allocates and sets up a RIO device |
452 | * @net: RIO network | 327 | * @net: RIO network |
453 | * @port: Master port to send transactions | 328 | * @port: Master port to send transactions |
@@ -587,8 +462,7 @@ static struct rio_dev *rio_setup_device(struct rio_net *net, | |||
587 | rdev->destid); | 462 | rdev->destid); |
588 | } | 463 | } |
589 | 464 | ||
590 | rdev->dev.bus = &rio_bus_type; | 465 | rio_attach_device(rdev); |
591 | rdev->dev.parent = &rio_bus; | ||
592 | 466 | ||
593 | device_initialize(&rdev->dev); | 467 | device_initialize(&rdev->dev); |
594 | rdev->dev.release = rio_release_dev; | 468 | rdev->dev.release = rio_release_dev; |
@@ -1260,19 +1134,30 @@ static void rio_pw_enable(struct rio_mport *port, int enable) | |||
1260 | /** | 1134 | /** |
1261 | * rio_enum_mport- Start enumeration through a master port | 1135 | * rio_enum_mport- Start enumeration through a master port |
1262 | * @mport: Master port to send transactions | 1136 | * @mport: Master port to send transactions |
1137 | * @flags: Enumeration control flags | ||
1263 | * | 1138 | * |
1264 | * Starts the enumeration process. If somebody has enumerated our | 1139 | * Starts the enumeration process. If somebody has enumerated our |
1265 | * master port device, then give up. If not and we have an active | 1140 | * master port device, then give up. If not and we have an active |
1266 | * link, then start recursive peer enumeration. Returns %0 if | 1141 | * link, then start recursive peer enumeration. Returns %0 if |
1267 | * enumeration succeeds or %-EBUSY if enumeration fails. | 1142 | * enumeration succeeds or %-EBUSY if enumeration fails. |
1268 | */ | 1143 | */ |
1269 | int rio_enum_mport(struct rio_mport *mport) | 1144 | int rio_enum_mport(struct rio_mport *mport, u32 flags) |
1270 | { | 1145 | { |
1271 | struct rio_net *net = NULL; | 1146 | struct rio_net *net = NULL; |
1272 | int rc = 0; | 1147 | int rc = 0; |
1273 | 1148 | ||
1274 | printk(KERN_INFO "RIO: enumerate master port %d, %s\n", mport->id, | 1149 | printk(KERN_INFO "RIO: enumerate master port %d, %s\n", mport->id, |
1275 | mport->name); | 1150 | mport->name); |
1151 | |||
1152 | /* | ||
1153 | * To avoid multiple start requests (repeat enumeration is not supported | ||
1154 | * by this method) check if enumeration/discovery was performed for this | ||
1155 | * mport: if mport was added into the list of mports for a net exit | ||
1156 | * with error. | ||
1157 | */ | ||
1158 | if (mport->nnode.next || mport->nnode.prev) | ||
1159 | return -EBUSY; | ||
1160 | |||
1276 | /* If somebody else enumerated our master port device, bail. */ | 1161 | /* If somebody else enumerated our master port device, bail. */ |
1277 | if (rio_enum_host(mport) < 0) { | 1162 | if (rio_enum_host(mport) < 0) { |
1278 | printk(KERN_INFO | 1163 | printk(KERN_INFO |
@@ -1362,14 +1247,16 @@ static void rio_build_route_tables(struct rio_net *net) | |||
1362 | /** | 1247 | /** |
1363 | * rio_disc_mport- Start discovery through a master port | 1248 | * rio_disc_mport- Start discovery through a master port |
1364 | * @mport: Master port to send transactions | 1249 | * @mport: Master port to send transactions |
1250 | * @flags: discovery control flags | ||
1365 | * | 1251 | * |
1366 | * Starts the discovery process. If we have an active link, | 1252 | * Starts the discovery process. If we have an active link, |
1367 | * then wait for the signal that enumeration is complete. | 1253 | * then wait for the signal that enumeration is complete (if wait |
1254 | * is allowed). | ||
1368 | * When enumeration completion is signaled, start recursive | 1255 | * When enumeration completion is signaled, start recursive |
1369 | * peer discovery. Returns %0 if discovery succeeds or %-EBUSY | 1256 | * peer discovery. Returns %0 if discovery succeeds or %-EBUSY |
1370 | * on failure. | 1257 | * on failure. |
1371 | */ | 1258 | */ |
1372 | int rio_disc_mport(struct rio_mport *mport) | 1259 | int rio_disc_mport(struct rio_mport *mport, u32 flags) |
1373 | { | 1260 | { |
1374 | struct rio_net *net = NULL; | 1261 | struct rio_net *net = NULL; |
1375 | unsigned long to_end; | 1262 | unsigned long to_end; |
@@ -1379,6 +1266,11 @@ int rio_disc_mport(struct rio_mport *mport) | |||
1379 | 1266 | ||
1380 | /* If master port has an active link, allocate net and discover peers */ | 1267 | /* If master port has an active link, allocate net and discover peers */ |
1381 | if (rio_mport_is_active(mport)) { | 1268 | if (rio_mport_is_active(mport)) { |
1269 | if (rio_enum_complete(mport)) | ||
1270 | goto enum_done; | ||
1271 | else if (flags & RIO_SCAN_ENUM_NO_WAIT) | ||
1272 | return -EAGAIN; | ||
1273 | |||
1382 | pr_debug("RIO: wait for enumeration to complete...\n"); | 1274 | pr_debug("RIO: wait for enumeration to complete...\n"); |
1383 | 1275 | ||
1384 | to_end = jiffies + CONFIG_RAPIDIO_DISC_TIMEOUT * HZ; | 1276 | to_end = jiffies + CONFIG_RAPIDIO_DISC_TIMEOUT * HZ; |
@@ -1421,3 +1313,41 @@ enum_done: | |||
1421 | bail: | 1313 | bail: |
1422 | return -EBUSY; | 1314 | return -EBUSY; |
1423 | } | 1315 | } |
1316 | |||
1317 | static struct rio_scan rio_scan_ops = { | ||
1318 | .enumerate = rio_enum_mport, | ||
1319 | .discover = rio_disc_mport, | ||
1320 | }; | ||
1321 | |||
1322 | static bool scan; | ||
1323 | module_param(scan, bool, 0); | ||
1324 | MODULE_PARM_DESC(scan, "Start RapidIO network enumeration/discovery " | ||
1325 | "(default = 0)"); | ||
1326 | |||
1327 | /** | ||
1328 | * rio_basic_attach: | ||
1329 | * | ||
1330 | * When this enumeration/discovery method is loaded as a module this function | ||
1331 | * registers its specific enumeration and discover routines for all available | ||
1332 | * RapidIO mport devices. The "scan" command line parameter controls ability of | ||
1333 | * the module to start RapidIO enumeration/discovery automatically. | ||
1334 | * | ||
1335 | * Returns 0 for success or -EIO if unable to register itself. | ||
1336 | * | ||
1337 | * This enumeration/discovery method cannot be unloaded and therefore does not | ||
1338 | * provide a matching cleanup_module routine. | ||
1339 | */ | ||
1340 | |||
1341 | static int __init rio_basic_attach(void) | ||
1342 | { | ||
1343 | if (rio_register_scan(RIO_MPORT_ANY, &rio_scan_ops)) | ||
1344 | return -EIO; | ||
1345 | if (scan) | ||
1346 | rio_init_mports(); | ||
1347 | return 0; | ||
1348 | } | ||
1349 | |||
1350 | late_initcall(rio_basic_attach); | ||
1351 | |||
1352 | MODULE_DESCRIPTION("Basic RapidIO enumeration/discovery"); | ||
1353 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c index 4dbe360989be..66d4acd5e18f 100644 --- a/drivers/rapidio/rio-sysfs.c +++ b/drivers/rapidio/rio-sysfs.c | |||
@@ -285,3 +285,48 @@ void rio_remove_sysfs_dev_files(struct rio_dev *rdev) | |||
285 | rdev->rswitch->sw_sysfs(rdev, RIO_SW_SYSFS_REMOVE); | 285 | rdev->rswitch->sw_sysfs(rdev, RIO_SW_SYSFS_REMOVE); |
286 | } | 286 | } |
287 | } | 287 | } |
288 | |||
289 | static ssize_t bus_scan_store(struct bus_type *bus, const char *buf, | ||
290 | size_t count) | ||
291 | { | ||
292 | long val; | ||
293 | struct rio_mport *port = NULL; | ||
294 | int rc; | ||
295 | |||
296 | if (kstrtol(buf, 0, &val) < 0) | ||
297 | return -EINVAL; | ||
298 | |||
299 | if (val == RIO_MPORT_ANY) { | ||
300 | rc = rio_init_mports(); | ||
301 | goto exit; | ||
302 | } | ||
303 | |||
304 | if (val < 0 || val >= RIO_MAX_MPORTS) | ||
305 | return -EINVAL; | ||
306 | |||
307 | port = rio_find_mport((int)val); | ||
308 | |||
309 | if (!port) { | ||
310 | pr_debug("RIO: %s: mport_%d not available\n", | ||
311 | __func__, (int)val); | ||
312 | return -EINVAL; | ||
313 | } | ||
314 | |||
315 | if (!port->nscan) | ||
316 | return -EINVAL; | ||
317 | |||
318 | if (port->host_deviceid >= 0) | ||
319 | rc = port->nscan->enumerate(port, 0); | ||
320 | else | ||
321 | rc = port->nscan->discover(port, RIO_SCAN_ENUM_NO_WAIT); | ||
322 | exit: | ||
323 | if (!rc) | ||
324 | rc = count; | ||
325 | |||
326 | return rc; | ||
327 | } | ||
328 | |||
329 | struct bus_attribute rio_bus_attrs[] = { | ||
330 | __ATTR(scan, (S_IWUSR|S_IWGRP), NULL, bus_scan_store), | ||
331 | __ATTR_NULL | ||
332 | }; | ||
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index d553b5d13722..cb1c08996fbb 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c | |||
@@ -31,7 +31,11 @@ | |||
31 | 31 | ||
32 | #include "rio.h" | 32 | #include "rio.h" |
33 | 33 | ||
34 | static LIST_HEAD(rio_devices); | ||
35 | static DEFINE_SPINLOCK(rio_global_list_lock); | ||
36 | |||
34 | static LIST_HEAD(rio_mports); | 37 | static LIST_HEAD(rio_mports); |
38 | static DEFINE_MUTEX(rio_mport_list_lock); | ||
35 | static unsigned char next_portid; | 39 | static unsigned char next_portid; |
36 | static DEFINE_SPINLOCK(rio_mmap_lock); | 40 | static DEFINE_SPINLOCK(rio_mmap_lock); |
37 | 41 | ||
@@ -53,6 +57,32 @@ u16 rio_local_get_device_id(struct rio_mport *port) | |||
53 | } | 57 | } |
54 | 58 | ||
55 | /** | 59 | /** |
60 | * rio_add_device- Adds a RIO device to the device model | ||
61 | * @rdev: RIO device | ||
62 | * | ||
63 | * Adds the RIO device to the global device list and adds the RIO | ||
64 | * device to the RIO device list. Creates the generic sysfs nodes | ||
65 | * for an RIO device. | ||
66 | */ | ||
67 | int rio_add_device(struct rio_dev *rdev) | ||
68 | { | ||
69 | int err; | ||
70 | |||
71 | err = device_add(&rdev->dev); | ||
72 | if (err) | ||
73 | return err; | ||
74 | |||
75 | spin_lock(&rio_global_list_lock); | ||
76 | list_add_tail(&rdev->global_list, &rio_devices); | ||
77 | spin_unlock(&rio_global_list_lock); | ||
78 | |||
79 | rio_create_sysfs_dev_files(rdev); | ||
80 | |||
81 | return 0; | ||
82 | } | ||
83 | EXPORT_SYMBOL_GPL(rio_add_device); | ||
84 | |||
85 | /** | ||
56 | * rio_request_inb_mbox - request inbound mailbox service | 86 | * rio_request_inb_mbox - request inbound mailbox service |
57 | * @mport: RIO master port from which to allocate the mailbox resource | 87 | * @mport: RIO master port from which to allocate the mailbox resource |
58 | * @dev_id: Device specific pointer to pass on event | 88 | * @dev_id: Device specific pointer to pass on event |
@@ -489,6 +519,7 @@ rio_mport_get_physefb(struct rio_mport *port, int local, | |||
489 | 519 | ||
490 | return ext_ftr_ptr; | 520 | return ext_ftr_ptr; |
491 | } | 521 | } |
522 | EXPORT_SYMBOL_GPL(rio_mport_get_physefb); | ||
492 | 523 | ||
493 | /** | 524 | /** |
494 | * rio_get_comptag - Begin or continue searching for a RIO device by component tag | 525 | * rio_get_comptag - Begin or continue searching for a RIO device by component tag |
@@ -521,6 +552,7 @@ exit: | |||
521 | spin_unlock(&rio_global_list_lock); | 552 | spin_unlock(&rio_global_list_lock); |
522 | return rdev; | 553 | return rdev; |
523 | } | 554 | } |
555 | EXPORT_SYMBOL_GPL(rio_get_comptag); | ||
524 | 556 | ||
525 | /** | 557 | /** |
526 | * rio_set_port_lockout - Sets/clears LOCKOUT bit (RIO EM 1.3) for a switch port. | 558 | * rio_set_port_lockout - Sets/clears LOCKOUT bit (RIO EM 1.3) for a switch port. |
@@ -545,6 +577,107 @@ int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock) | |||
545 | regval); | 577 | regval); |
546 | return 0; | 578 | return 0; |
547 | } | 579 | } |
580 | EXPORT_SYMBOL_GPL(rio_set_port_lockout); | ||
581 | |||
582 | /** | ||
583 | * rio_switch_init - Sets switch operations for a particular vendor switch | ||
584 | * @rdev: RIO device | ||
585 | * @do_enum: Enumeration/Discovery mode flag | ||
586 | * | ||
587 | * Searches the RIO switch ops table for known switch types. If the vid | ||
588 | * and did match a switch table entry, then call switch initialization | ||
589 | * routine to setup switch-specific routines. | ||
590 | */ | ||
591 | void rio_switch_init(struct rio_dev *rdev, int do_enum) | ||
592 | { | ||
593 | struct rio_switch_ops *cur = __start_rio_switch_ops; | ||
594 | struct rio_switch_ops *end = __end_rio_switch_ops; | ||
595 | |||
596 | while (cur < end) { | ||
597 | if ((cur->vid == rdev->vid) && (cur->did == rdev->did)) { | ||
598 | pr_debug("RIO: calling init routine for %s\n", | ||
599 | rio_name(rdev)); | ||
600 | cur->init_hook(rdev, do_enum); | ||
601 | break; | ||
602 | } | ||
603 | cur++; | ||
604 | } | ||
605 | |||
606 | if ((cur >= end) && (rdev->pef & RIO_PEF_STD_RT)) { | ||
607 | pr_debug("RIO: adding STD routing ops for %s\n", | ||
608 | rio_name(rdev)); | ||
609 | rdev->rswitch->add_entry = rio_std_route_add_entry; | ||
610 | rdev->rswitch->get_entry = rio_std_route_get_entry; | ||
611 | rdev->rswitch->clr_table = rio_std_route_clr_table; | ||
612 | } | ||
613 | |||
614 | if (!rdev->rswitch->add_entry || !rdev->rswitch->get_entry) | ||
615 | printk(KERN_ERR "RIO: missing routing ops for %s\n", | ||
616 | rio_name(rdev)); | ||
617 | } | ||
618 | EXPORT_SYMBOL_GPL(rio_switch_init); | ||
619 | |||
620 | /** | ||
621 | * rio_enable_rx_tx_port - enable input receiver and output transmitter of | ||
622 | * given port | ||
623 | * @port: Master port associated with the RIO network | ||
624 | * @local: local=1 select local port otherwise a far device is reached | ||
625 | * @destid: Destination ID of the device to check host bit | ||
626 | * @hopcount: Number of hops to reach the target | ||
627 | * @port_num: Port (-number on switch) to enable on a far end device | ||
628 | * | ||
629 | * Returns 0 or 1 from on General Control Command and Status Register | ||
630 | * (EXT_PTR+0x3C) | ||
631 | */ | ||
632 | int rio_enable_rx_tx_port(struct rio_mport *port, | ||
633 | int local, u16 destid, | ||
634 | u8 hopcount, u8 port_num) | ||
635 | { | ||
636 | #ifdef CONFIG_RAPIDIO_ENABLE_RX_TX_PORTS | ||
637 | u32 regval; | ||
638 | u32 ext_ftr_ptr; | ||
639 | |||
640 | /* | ||
641 | * enable rx input tx output port | ||
642 | */ | ||
643 | pr_debug("rio_enable_rx_tx_port(local = %d, destid = %d, hopcount = " | ||
644 | "%d, port_num = %d)\n", local, destid, hopcount, port_num); | ||
645 | |||
646 | ext_ftr_ptr = rio_mport_get_physefb(port, local, destid, hopcount); | ||
647 | |||
648 | if (local) { | ||
649 | rio_local_read_config_32(port, ext_ftr_ptr + | ||
650 | RIO_PORT_N_CTL_CSR(0), | ||
651 | ®val); | ||
652 | } else { | ||
653 | if (rio_mport_read_config_32(port, destid, hopcount, | ||
654 | ext_ftr_ptr + RIO_PORT_N_CTL_CSR(port_num), ®val) < 0) | ||
655 | return -EIO; | ||
656 | } | ||
657 | |||
658 | if (regval & RIO_PORT_N_CTL_P_TYP_SER) { | ||
659 | /* serial */ | ||
660 | regval = regval | RIO_PORT_N_CTL_EN_RX_SER | ||
661 | | RIO_PORT_N_CTL_EN_TX_SER; | ||
662 | } else { | ||
663 | /* parallel */ | ||
664 | regval = regval | RIO_PORT_N_CTL_EN_RX_PAR | ||
665 | | RIO_PORT_N_CTL_EN_TX_PAR; | ||
666 | } | ||
667 | |||
668 | if (local) { | ||
669 | rio_local_write_config_32(port, ext_ftr_ptr + | ||
670 | RIO_PORT_N_CTL_CSR(0), regval); | ||
671 | } else { | ||
672 | if (rio_mport_write_config_32(port, destid, hopcount, | ||
673 | ext_ftr_ptr + RIO_PORT_N_CTL_CSR(port_num), regval) < 0) | ||
674 | return -EIO; | ||
675 | } | ||
676 | #endif | ||
677 | return 0; | ||
678 | } | ||
679 | EXPORT_SYMBOL_GPL(rio_enable_rx_tx_port); | ||
680 | |||
548 | 681 | ||
549 | /** | 682 | /** |
550 | * rio_chk_dev_route - Validate route to the specified device. | 683 | * rio_chk_dev_route - Validate route to the specified device. |
@@ -610,6 +743,7 @@ rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid, u8 hopcount) | |||
610 | 743 | ||
611 | return 0; | 744 | return 0; |
612 | } | 745 | } |
746 | EXPORT_SYMBOL_GPL(rio_mport_chk_dev_access); | ||
613 | 747 | ||
614 | /** | 748 | /** |
615 | * rio_chk_dev_access - Validate access to the specified device. | 749 | * rio_chk_dev_access - Validate access to the specified device. |
@@ -941,6 +1075,7 @@ rio_mport_get_efb(struct rio_mport *port, int local, u16 destid, | |||
941 | return RIO_GET_BLOCK_ID(reg_val); | 1075 | return RIO_GET_BLOCK_ID(reg_val); |
942 | } | 1076 | } |
943 | } | 1077 | } |
1078 | EXPORT_SYMBOL_GPL(rio_mport_get_efb); | ||
944 | 1079 | ||
945 | /** | 1080 | /** |
946 | * rio_mport_get_feature - query for devices' extended features | 1081 | * rio_mport_get_feature - query for devices' extended features |
@@ -997,6 +1132,7 @@ rio_mport_get_feature(struct rio_mport * port, int local, u16 destid, | |||
997 | 1132 | ||
998 | return 0; | 1133 | return 0; |
999 | } | 1134 | } |
1135 | EXPORT_SYMBOL_GPL(rio_mport_get_feature); | ||
1000 | 1136 | ||
1001 | /** | 1137 | /** |
1002 | * rio_get_asm - Begin or continue searching for a RIO device by vid/did/asm_vid/asm_did | 1138 | * rio_get_asm - Begin or continue searching for a RIO device by vid/did/asm_vid/asm_did |
@@ -1246,6 +1382,95 @@ EXPORT_SYMBOL_GPL(rio_dma_prep_slave_sg); | |||
1246 | 1382 | ||
1247 | #endif /* CONFIG_RAPIDIO_DMA_ENGINE */ | 1383 | #endif /* CONFIG_RAPIDIO_DMA_ENGINE */ |
1248 | 1384 | ||
1385 | /** | ||
1386 | * rio_find_mport - find RIO mport by its ID | ||
1387 | * @mport_id: number (ID) of mport device | ||
1388 | * | ||
1389 | * Given a RIO mport number, the desired mport is located | ||
1390 | * in the global list of mports. If the mport is found, a pointer to its | ||
1391 | * data structure is returned. If no mport is found, %NULL is returned. | ||
1392 | */ | ||
1393 | struct rio_mport *rio_find_mport(int mport_id) | ||
1394 | { | ||
1395 | struct rio_mport *port; | ||
1396 | |||
1397 | mutex_lock(&rio_mport_list_lock); | ||
1398 | list_for_each_entry(port, &rio_mports, node) { | ||
1399 | if (port->id == mport_id) | ||
1400 | goto found; | ||
1401 | } | ||
1402 | port = NULL; | ||
1403 | found: | ||
1404 | mutex_unlock(&rio_mport_list_lock); | ||
1405 | |||
1406 | return port; | ||
1407 | } | ||
1408 | |||
1409 | /** | ||
1410 | * rio_register_scan - enumeration/discovery method registration interface | ||
1411 | * @mport_id: mport device ID for which fabric scan routine has to be set | ||
1412 | * (RIO_MPORT_ANY = set for all available mports) | ||
1413 | * @scan_ops: enumeration/discovery control structure | ||
1414 | * | ||
1415 | * Assigns enumeration or discovery method to the specified mport device (or all | ||
1416 | * available mports if RIO_MPORT_ANY is specified). | ||
1417 | * Returns error if the mport already has an enumerator attached to it. | ||
1418 | * In case of RIO_MPORT_ANY ignores ports with valid scan routines and returns | ||
1419 | * an error if was unable to find at least one available mport. | ||
1420 | */ | ||
1421 | int rio_register_scan(int mport_id, struct rio_scan *scan_ops) | ||
1422 | { | ||
1423 | struct rio_mport *port; | ||
1424 | int rc = -EBUSY; | ||
1425 | |||
1426 | mutex_lock(&rio_mport_list_lock); | ||
1427 | list_for_each_entry(port, &rio_mports, node) { | ||
1428 | if (port->id == mport_id || mport_id == RIO_MPORT_ANY) { | ||
1429 | if (port->nscan && mport_id == RIO_MPORT_ANY) | ||
1430 | continue; | ||
1431 | else if (port->nscan) | ||
1432 | break; | ||
1433 | |||
1434 | port->nscan = scan_ops; | ||
1435 | rc = 0; | ||
1436 | |||
1437 | if (mport_id != RIO_MPORT_ANY) | ||
1438 | break; | ||
1439 | } | ||
1440 | } | ||
1441 | mutex_unlock(&rio_mport_list_lock); | ||
1442 | |||
1443 | return rc; | ||
1444 | } | ||
1445 | EXPORT_SYMBOL_GPL(rio_register_scan); | ||
1446 | |||
1447 | /** | ||
1448 | * rio_unregister_scan - removes enumeration/discovery method from mport | ||
1449 | * @mport_id: mport device ID for which fabric scan routine has to be | ||
1450 | * unregistered (RIO_MPORT_ANY = set for all available mports) | ||
1451 | * | ||
1452 | * Removes enumeration or discovery method assigned to the specified mport | ||
1453 | * device (or all available mports if RIO_MPORT_ANY is specified). | ||
1454 | */ | ||
1455 | int rio_unregister_scan(int mport_id) | ||
1456 | { | ||
1457 | struct rio_mport *port; | ||
1458 | |||
1459 | mutex_lock(&rio_mport_list_lock); | ||
1460 | list_for_each_entry(port, &rio_mports, node) { | ||
1461 | if (port->id == mport_id || mport_id == RIO_MPORT_ANY) { | ||
1462 | if (port->nscan) | ||
1463 | port->nscan = NULL; | ||
1464 | if (mport_id != RIO_MPORT_ANY) | ||
1465 | break; | ||
1466 | } | ||
1467 | } | ||
1468 | mutex_unlock(&rio_mport_list_lock); | ||
1469 | |||
1470 | return 0; | ||
1471 | } | ||
1472 | EXPORT_SYMBOL_GPL(rio_unregister_scan); | ||
1473 | |||
1249 | static void rio_fixup_device(struct rio_dev *dev) | 1474 | static void rio_fixup_device(struct rio_dev *dev) |
1250 | { | 1475 | { |
1251 | } | 1476 | } |
@@ -1274,7 +1499,7 @@ static void disc_work_handler(struct work_struct *_work) | |||
1274 | work = container_of(_work, struct rio_disc_work, work); | 1499 | work = container_of(_work, struct rio_disc_work, work); |
1275 | pr_debug("RIO: discovery work for mport %d %s\n", | 1500 | pr_debug("RIO: discovery work for mport %d %s\n", |
1276 | work->mport->id, work->mport->name); | 1501 | work->mport->id, work->mport->name); |
1277 | rio_disc_mport(work->mport); | 1502 | work->mport->nscan->discover(work->mport, 0); |
1278 | } | 1503 | } |
1279 | 1504 | ||
1280 | int rio_init_mports(void) | 1505 | int rio_init_mports(void) |
@@ -1290,12 +1515,15 @@ int rio_init_mports(void) | |||
1290 | * First, run enumerations and check if we need to perform discovery | 1515 | * First, run enumerations and check if we need to perform discovery |
1291 | * on any of the registered mports. | 1516 | * on any of the registered mports. |
1292 | */ | 1517 | */ |
1518 | mutex_lock(&rio_mport_list_lock); | ||
1293 | list_for_each_entry(port, &rio_mports, node) { | 1519 | list_for_each_entry(port, &rio_mports, node) { |
1294 | if (port->host_deviceid >= 0) | 1520 | if (port->host_deviceid >= 0) { |
1295 | rio_enum_mport(port); | 1521 | if (port->nscan) |
1296 | else | 1522 | port->nscan->enumerate(port, 0); |
1523 | } else | ||
1297 | n++; | 1524 | n++; |
1298 | } | 1525 | } |
1526 | mutex_unlock(&rio_mport_list_lock); | ||
1299 | 1527 | ||
1300 | if (!n) | 1528 | if (!n) |
1301 | goto no_disc; | 1529 | goto no_disc; |
@@ -1322,14 +1550,16 @@ int rio_init_mports(void) | |||
1322 | } | 1550 | } |
1323 | 1551 | ||
1324 | n = 0; | 1552 | n = 0; |
1553 | mutex_lock(&rio_mport_list_lock); | ||
1325 | list_for_each_entry(port, &rio_mports, node) { | 1554 | list_for_each_entry(port, &rio_mports, node) { |
1326 | if (port->host_deviceid < 0) { | 1555 | if (port->host_deviceid < 0 && port->nscan) { |
1327 | work[n].mport = port; | 1556 | work[n].mport = port; |
1328 | INIT_WORK(&work[n].work, disc_work_handler); | 1557 | INIT_WORK(&work[n].work, disc_work_handler); |
1329 | queue_work(rio_wq, &work[n].work); | 1558 | queue_work(rio_wq, &work[n].work); |
1330 | n++; | 1559 | n++; |
1331 | } | 1560 | } |
1332 | } | 1561 | } |
1562 | mutex_unlock(&rio_mport_list_lock); | ||
1333 | 1563 | ||
1334 | flush_workqueue(rio_wq); | 1564 | flush_workqueue(rio_wq); |
1335 | pr_debug("RIO: destroy discovery workqueue\n"); | 1565 | pr_debug("RIO: destroy discovery workqueue\n"); |
@@ -1342,8 +1572,6 @@ no_disc: | |||
1342 | return 0; | 1572 | return 0; |
1343 | } | 1573 | } |
1344 | 1574 | ||
1345 | device_initcall_sync(rio_init_mports); | ||
1346 | |||
1347 | static int hdids[RIO_MAX_MPORTS + 1]; | 1575 | static int hdids[RIO_MAX_MPORTS + 1]; |
1348 | 1576 | ||
1349 | static int rio_get_hdid(int index) | 1577 | static int rio_get_hdid(int index) |
@@ -1371,7 +1599,10 @@ int rio_register_mport(struct rio_mport *port) | |||
1371 | 1599 | ||
1372 | port->id = next_portid++; | 1600 | port->id = next_portid++; |
1373 | port->host_deviceid = rio_get_hdid(port->id); | 1601 | port->host_deviceid = rio_get_hdid(port->id); |
1602 | port->nscan = NULL; | ||
1603 | mutex_lock(&rio_mport_list_lock); | ||
1374 | list_add_tail(&port->node, &rio_mports); | 1604 | list_add_tail(&port->node, &rio_mports); |
1605 | mutex_unlock(&rio_mport_list_lock); | ||
1375 | return 0; | 1606 | return 0; |
1376 | } | 1607 | } |
1377 | 1608 | ||
@@ -1386,3 +1617,4 @@ EXPORT_SYMBOL_GPL(rio_request_inb_mbox); | |||
1386 | EXPORT_SYMBOL_GPL(rio_release_inb_mbox); | 1617 | EXPORT_SYMBOL_GPL(rio_release_inb_mbox); |
1387 | EXPORT_SYMBOL_GPL(rio_request_outb_mbox); | 1618 | EXPORT_SYMBOL_GPL(rio_request_outb_mbox); |
1388 | EXPORT_SYMBOL_GPL(rio_release_outb_mbox); | 1619 | EXPORT_SYMBOL_GPL(rio_release_outb_mbox); |
1620 | EXPORT_SYMBOL_GPL(rio_init_mports); | ||
diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h index b1af414f15e6..c14f864dea5c 100644 --- a/drivers/rapidio/rio.h +++ b/drivers/rapidio/rio.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/rio.h> | 15 | #include <linux/rio.h> |
16 | 16 | ||
17 | #define RIO_MAX_CHK_RETRY 3 | 17 | #define RIO_MAX_CHK_RETRY 3 |
18 | #define RIO_MPORT_ANY (-1) | ||
18 | 19 | ||
19 | /* Functions internal to the RIO core code */ | 20 | /* Functions internal to the RIO core code */ |
20 | 21 | ||
@@ -27,8 +28,6 @@ extern u32 rio_mport_get_efb(struct rio_mport *port, int local, u16 destid, | |||
27 | extern int rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid, | 28 | extern int rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid, |
28 | u8 hopcount); | 29 | u8 hopcount); |
29 | extern int rio_create_sysfs_dev_files(struct rio_dev *rdev); | 30 | extern int rio_create_sysfs_dev_files(struct rio_dev *rdev); |
30 | extern int rio_enum_mport(struct rio_mport *mport); | ||
31 | extern int rio_disc_mport(struct rio_mport *mport); | ||
32 | extern int rio_std_route_add_entry(struct rio_mport *mport, u16 destid, | 31 | extern int rio_std_route_add_entry(struct rio_mport *mport, u16 destid, |
33 | u8 hopcount, u16 table, u16 route_destid, | 32 | u8 hopcount, u16 table, u16 route_destid, |
34 | u8 route_port); | 33 | u8 route_port); |
@@ -39,10 +38,18 @@ extern int rio_std_route_clr_table(struct rio_mport *mport, u16 destid, | |||
39 | u8 hopcount, u16 table); | 38 | u8 hopcount, u16 table); |
40 | extern int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock); | 39 | extern int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock); |
41 | extern struct rio_dev *rio_get_comptag(u32 comp_tag, struct rio_dev *from); | 40 | extern struct rio_dev *rio_get_comptag(u32 comp_tag, struct rio_dev *from); |
41 | extern int rio_add_device(struct rio_dev *rdev); | ||
42 | extern void rio_switch_init(struct rio_dev *rdev, int do_enum); | ||
43 | extern int rio_enable_rx_tx_port(struct rio_mport *port, int local, u16 destid, | ||
44 | u8 hopcount, u8 port_num); | ||
45 | extern int rio_register_scan(int mport_id, struct rio_scan *scan_ops); | ||
46 | extern int rio_unregister_scan(int mport_id); | ||
47 | extern void rio_attach_device(struct rio_dev *rdev); | ||
48 | extern struct rio_mport *rio_find_mport(int mport_id); | ||
42 | 49 | ||
43 | /* Structures internal to the RIO core code */ | 50 | /* Structures internal to the RIO core code */ |
44 | extern struct device_attribute rio_dev_attrs[]; | 51 | extern struct device_attribute rio_dev_attrs[]; |
45 | extern spinlock_t rio_global_list_lock; | 52 | extern struct bus_attribute rio_bus_attrs[]; |
46 | 53 | ||
47 | extern struct rio_switch_ops __start_rio_switch_ops[]; | 54 | extern struct rio_switch_ops __start_rio_switch_ops[]; |
48 | extern struct rio_switch_ops __end_rio_switch_ops[]; | 55 | extern struct rio_switch_ops __end_rio_switch_ops[]; |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6e5017841582..815d6df8bd5f 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -1539,7 +1539,10 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev) | |||
1539 | } | 1539 | } |
1540 | 1540 | ||
1541 | /** | 1541 | /** |
1542 | * Balance enable_count of each GPIO and actual GPIO pin control. | 1542 | * regulator_ena_gpio_ctrl - balance enable_count of each GPIO and actual GPIO pin control |
1543 | * @rdev: regulator_dev structure | ||
1544 | * @enable: enable GPIO at initial use? | ||
1545 | * | ||
1543 | * GPIO is enabled in case of initial use. (enable_count is 0) | 1546 | * GPIO is enabled in case of initial use. (enable_count is 0) |
1544 | * GPIO is disabled when it is not shared any more. (enable_count <= 1) | 1547 | * GPIO is disabled when it is not shared any more. (enable_count <= 1) |
1545 | */ | 1548 | */ |
@@ -2702,7 +2705,7 @@ EXPORT_SYMBOL_GPL(regulator_get_voltage); | |||
2702 | /** | 2705 | /** |
2703 | * regulator_set_current_limit - set regulator output current limit | 2706 | * regulator_set_current_limit - set regulator output current limit |
2704 | * @regulator: regulator source | 2707 | * @regulator: regulator source |
2705 | * @min_uA: Minimuum supported current in uA | 2708 | * @min_uA: Minimum supported current in uA |
2706 | * @max_uA: Maximum supported current in uA | 2709 | * @max_uA: Maximum supported current in uA |
2707 | * | 2710 | * |
2708 | * Sets current sink to the desired output current. This can be set during | 2711 | * Sets current sink to the desired output current. This can be set during |
diff --git a/drivers/regulator/dbx500-prcmu.c b/drivers/regulator/dbx500-prcmu.c index 89bd2faaef8c..ce89f7848a57 100644 --- a/drivers/regulator/dbx500-prcmu.c +++ b/drivers/regulator/dbx500-prcmu.c | |||
@@ -24,18 +24,6 @@ | |||
24 | static int power_state_active_cnt; /* will initialize to zero */ | 24 | static int power_state_active_cnt; /* will initialize to zero */ |
25 | static DEFINE_SPINLOCK(power_state_active_lock); | 25 | static DEFINE_SPINLOCK(power_state_active_lock); |
26 | 26 | ||
27 | int power_state_active_get(void) | ||
28 | { | ||
29 | unsigned long flags; | ||
30 | int cnt; | ||
31 | |||
32 | spin_lock_irqsave(&power_state_active_lock, flags); | ||
33 | cnt = power_state_active_cnt; | ||
34 | spin_unlock_irqrestore(&power_state_active_lock, flags); | ||
35 | |||
36 | return cnt; | ||
37 | } | ||
38 | |||
39 | void power_state_active_enable(void) | 27 | void power_state_active_enable(void) |
40 | { | 28 | { |
41 | unsigned long flags; | 29 | unsigned long flags; |
@@ -65,6 +53,18 @@ out: | |||
65 | 53 | ||
66 | #ifdef CONFIG_REGULATOR_DEBUG | 54 | #ifdef CONFIG_REGULATOR_DEBUG |
67 | 55 | ||
56 | static int power_state_active_get(void) | ||
57 | { | ||
58 | unsigned long flags; | ||
59 | int cnt; | ||
60 | |||
61 | spin_lock_irqsave(&power_state_active_lock, flags); | ||
62 | cnt = power_state_active_cnt; | ||
63 | spin_unlock_irqrestore(&power_state_active_lock, flags); | ||
64 | |||
65 | return cnt; | ||
66 | } | ||
67 | |||
68 | static struct ux500_regulator_debug { | 68 | static struct ux500_regulator_debug { |
69 | struct dentry *dir; | 69 | struct dentry *dir; |
70 | struct dentry *status_file; | 70 | struct dentry *status_file; |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 92ceed0fc65e..3ae44ac12a94 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -840,7 +840,7 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
840 | break; | 840 | break; |
841 | } | 841 | } |
842 | 842 | ||
843 | if ((id == PALMAS_REG_SMPS6) && (id == PALMAS_REG_SMPS8)) | 843 | if ((id == PALMAS_REG_SMPS6) || (id == PALMAS_REG_SMPS8)) |
844 | ramp_delay_support = true; | 844 | ramp_delay_support = true; |
845 | 845 | ||
846 | if (ramp_delay_support) { | 846 | if (ramp_delay_support) { |
@@ -878,7 +878,7 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
878 | pmic->desc[id].vsel_mask = SMPS10_VSEL; | 878 | pmic->desc[id].vsel_mask = SMPS10_VSEL; |
879 | pmic->desc[id].enable_reg = | 879 | pmic->desc[id].enable_reg = |
880 | PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, | 880 | PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, |
881 | PALMAS_SMPS10_STATUS); | 881 | PALMAS_SMPS10_CTRL); |
882 | pmic->desc[id].enable_mask = SMPS10_BOOST_EN; | 882 | pmic->desc[id].enable_mask = SMPS10_BOOST_EN; |
883 | pmic->desc[id].min_uV = 3750000; | 883 | pmic->desc[id].min_uV = 3750000; |
884 | pmic->desc[id].uV_step = 1250000; | 884 | pmic->desc[id].uV_step = 1250000; |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 0c81915b1997..b9838130a7b0 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -20,7 +20,6 @@ if RTC_CLASS | |||
20 | config RTC_HCTOSYS | 20 | config RTC_HCTOSYS |
21 | bool "Set system time from RTC on startup and resume" | 21 | bool "Set system time from RTC on startup and resume" |
22 | default y | 22 | default y |
23 | depends on !ALWAYS_USE_PERSISTENT_CLOCK | ||
24 | help | 23 | help |
25 | If you say yes here, the system time (wall clock) will be set using | 24 | If you say yes here, the system time (wall clock) will be set using |
26 | the value read from a specified RTC device. This is useful to avoid | 25 | the value read from a specified RTC device. This is useful to avoid |
@@ -29,7 +28,6 @@ config RTC_HCTOSYS | |||
29 | config RTC_SYSTOHC | 28 | config RTC_SYSTOHC |
30 | bool "Set the RTC time based on NTP synchronization" | 29 | bool "Set the RTC time based on NTP synchronization" |
31 | default y | 30 | default y |
32 | depends on !ALWAYS_USE_PERSISTENT_CLOCK | ||
33 | help | 31 | help |
34 | If you say yes here, the system time (wall clock) will be stored | 32 | If you say yes here, the system time (wall clock) will be stored |
35 | in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11 | 33 | in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11 |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index 0eab77b22340..f296f3f7db9b 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/rtc.h> | 25 | #include <linux/rtc.h> |
26 | #include <linux/bcd.h> | 26 | #include <linux/bcd.h> |
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/spinlock.h> | ||
28 | #include <linux/ioctl.h> | 29 | #include <linux/ioctl.h> |
29 | #include <linux/completion.h> | 30 | #include <linux/completion.h> |
30 | #include <linux/io.h> | 31 | #include <linux/io.h> |
@@ -42,10 +43,65 @@ | |||
42 | 43 | ||
43 | #define AT91_RTC_EPOCH 1900UL /* just like arch/arm/common/rtctime.c */ | 44 | #define AT91_RTC_EPOCH 1900UL /* just like arch/arm/common/rtctime.c */ |
44 | 45 | ||
46 | struct at91_rtc_config { | ||
47 | bool use_shadow_imr; | ||
48 | }; | ||
49 | |||
50 | static const struct at91_rtc_config *at91_rtc_config; | ||
45 | static DECLARE_COMPLETION(at91_rtc_updated); | 51 | static DECLARE_COMPLETION(at91_rtc_updated); |
46 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; | 52 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; |
47 | static void __iomem *at91_rtc_regs; | 53 | static void __iomem *at91_rtc_regs; |
48 | static int irq; | 54 | static int irq; |
55 | static DEFINE_SPINLOCK(at91_rtc_lock); | ||
56 | static u32 at91_rtc_shadow_imr; | ||
57 | |||
58 | static void at91_rtc_write_ier(u32 mask) | ||
59 | { | ||
60 | unsigned long flags; | ||
61 | |||
62 | spin_lock_irqsave(&at91_rtc_lock, flags); | ||
63 | at91_rtc_shadow_imr |= mask; | ||
64 | at91_rtc_write(AT91_RTC_IER, mask); | ||
65 | spin_unlock_irqrestore(&at91_rtc_lock, flags); | ||
66 | } | ||
67 | |||
68 | static void at91_rtc_write_idr(u32 mask) | ||
69 | { | ||
70 | unsigned long flags; | ||
71 | |||
72 | spin_lock_irqsave(&at91_rtc_lock, flags); | ||
73 | at91_rtc_write(AT91_RTC_IDR, mask); | ||
74 | /* | ||
75 | * Register read back (of any RTC-register) needed to make sure | ||
76 | * IDR-register write has reached the peripheral before updating | ||
77 | * shadow mask. | ||
78 | * | ||
79 | * Note that there is still a possibility that the mask is updated | ||
80 | * before interrupts have actually been disabled in hardware. The only | ||
81 | * way to be certain would be to poll the IMR-register, which is is | ||
82 | * the very register we are trying to emulate. The register read back | ||
83 | * is a reasonable heuristic. | ||
84 | */ | ||
85 | at91_rtc_read(AT91_RTC_SR); | ||
86 | at91_rtc_shadow_imr &= ~mask; | ||
87 | spin_unlock_irqrestore(&at91_rtc_lock, flags); | ||
88 | } | ||
89 | |||
90 | static u32 at91_rtc_read_imr(void) | ||
91 | { | ||
92 | unsigned long flags; | ||
93 | u32 mask; | ||
94 | |||
95 | if (at91_rtc_config->use_shadow_imr) { | ||
96 | spin_lock_irqsave(&at91_rtc_lock, flags); | ||
97 | mask = at91_rtc_shadow_imr; | ||
98 | spin_unlock_irqrestore(&at91_rtc_lock, flags); | ||
99 | } else { | ||
100 | mask = at91_rtc_read(AT91_RTC_IMR); | ||
101 | } | ||
102 | |||
103 | return mask; | ||
104 | } | ||
49 | 105 | ||
50 | /* | 106 | /* |
51 | * Decode time/date into rtc_time structure | 107 | * Decode time/date into rtc_time structure |
@@ -110,9 +166,9 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
110 | cr = at91_rtc_read(AT91_RTC_CR); | 166 | cr = at91_rtc_read(AT91_RTC_CR); |
111 | at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); | 167 | at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); |
112 | 168 | ||
113 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); | 169 | at91_rtc_write_ier(AT91_RTC_ACKUPD); |
114 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ | 170 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ |
115 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); | 171 | at91_rtc_write_idr(AT91_RTC_ACKUPD); |
116 | 172 | ||
117 | at91_rtc_write(AT91_RTC_TIMR, | 173 | at91_rtc_write(AT91_RTC_TIMR, |
118 | bin2bcd(tm->tm_sec) << 0 | 174 | bin2bcd(tm->tm_sec) << 0 |
@@ -144,7 +200,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
144 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); | 200 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); |
145 | tm->tm_year = at91_alarm_year - 1900; | 201 | tm->tm_year = at91_alarm_year - 1900; |
146 | 202 | ||
147 | alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM) | 203 | alrm->enabled = (at91_rtc_read_imr() & AT91_RTC_ALARM) |
148 | ? 1 : 0; | 204 | ? 1 : 0; |
149 | 205 | ||
150 | dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, | 206 | dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
@@ -169,7 +225,7 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
169 | tm.tm_min = alrm->time.tm_min; | 225 | tm.tm_min = alrm->time.tm_min; |
170 | tm.tm_sec = alrm->time.tm_sec; | 226 | tm.tm_sec = alrm->time.tm_sec; |
171 | 227 | ||
172 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 228 | at91_rtc_write_idr(AT91_RTC_ALARM); |
173 | at91_rtc_write(AT91_RTC_TIMALR, | 229 | at91_rtc_write(AT91_RTC_TIMALR, |
174 | bin2bcd(tm.tm_sec) << 0 | 230 | bin2bcd(tm.tm_sec) << 0 |
175 | | bin2bcd(tm.tm_min) << 8 | 231 | | bin2bcd(tm.tm_min) << 8 |
@@ -182,7 +238,7 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
182 | 238 | ||
183 | if (alrm->enabled) { | 239 | if (alrm->enabled) { |
184 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 240 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
185 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); | 241 | at91_rtc_write_ier(AT91_RTC_ALARM); |
186 | } | 242 | } |
187 | 243 | ||
188 | dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, | 244 | dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
@@ -198,9 +254,9 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
198 | 254 | ||
199 | if (enabled) { | 255 | if (enabled) { |
200 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 256 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
201 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); | 257 | at91_rtc_write_ier(AT91_RTC_ALARM); |
202 | } else | 258 | } else |
203 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 259 | at91_rtc_write_idr(AT91_RTC_ALARM); |
204 | 260 | ||
205 | return 0; | 261 | return 0; |
206 | } | 262 | } |
@@ -209,7 +265,7 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
209 | */ | 265 | */ |
210 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) | 266 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) |
211 | { | 267 | { |
212 | unsigned long imr = at91_rtc_read(AT91_RTC_IMR); | 268 | unsigned long imr = at91_rtc_read_imr(); |
213 | 269 | ||
214 | seq_printf(seq, "update_IRQ\t: %s\n", | 270 | seq_printf(seq, "update_IRQ\t: %s\n", |
215 | (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); | 271 | (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); |
@@ -229,7 +285,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
229 | unsigned int rtsr; | 285 | unsigned int rtsr; |
230 | unsigned long events = 0; | 286 | unsigned long events = 0; |
231 | 287 | ||
232 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR); | 288 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read_imr(); |
233 | if (rtsr) { /* this interrupt is shared! Is it ours? */ | 289 | if (rtsr) { /* this interrupt is shared! Is it ours? */ |
234 | if (rtsr & AT91_RTC_ALARM) | 290 | if (rtsr & AT91_RTC_ALARM) |
235 | events |= (RTC_AF | RTC_IRQF); | 291 | events |= (RTC_AF | RTC_IRQF); |
@@ -250,6 +306,43 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
250 | return IRQ_NONE; /* not handled */ | 306 | return IRQ_NONE; /* not handled */ |
251 | } | 307 | } |
252 | 308 | ||
309 | static const struct at91_rtc_config at91rm9200_config = { | ||
310 | }; | ||
311 | |||
312 | static const struct at91_rtc_config at91sam9x5_config = { | ||
313 | .use_shadow_imr = true, | ||
314 | }; | ||
315 | |||
316 | #ifdef CONFIG_OF | ||
317 | static const struct of_device_id at91_rtc_dt_ids[] = { | ||
318 | { | ||
319 | .compatible = "atmel,at91rm9200-rtc", | ||
320 | .data = &at91rm9200_config, | ||
321 | }, { | ||
322 | .compatible = "atmel,at91sam9x5-rtc", | ||
323 | .data = &at91sam9x5_config, | ||
324 | }, { | ||
325 | /* sentinel */ | ||
326 | } | ||
327 | }; | ||
328 | MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids); | ||
329 | #endif | ||
330 | |||
331 | static const struct at91_rtc_config * | ||
332 | at91_rtc_get_config(struct platform_device *pdev) | ||
333 | { | ||
334 | const struct of_device_id *match; | ||
335 | |||
336 | if (pdev->dev.of_node) { | ||
337 | match = of_match_node(at91_rtc_dt_ids, pdev->dev.of_node); | ||
338 | if (!match) | ||
339 | return NULL; | ||
340 | return (const struct at91_rtc_config *)match->data; | ||
341 | } | ||
342 | |||
343 | return &at91rm9200_config; | ||
344 | } | ||
345 | |||
253 | static const struct rtc_class_ops at91_rtc_ops = { | 346 | static const struct rtc_class_ops at91_rtc_ops = { |
254 | .read_time = at91_rtc_readtime, | 347 | .read_time = at91_rtc_readtime, |
255 | .set_time = at91_rtc_settime, | 348 | .set_time = at91_rtc_settime, |
@@ -268,6 +361,10 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
268 | struct resource *regs; | 361 | struct resource *regs; |
269 | int ret = 0; | 362 | int ret = 0; |
270 | 363 | ||
364 | at91_rtc_config = at91_rtc_get_config(pdev); | ||
365 | if (!at91_rtc_config) | ||
366 | return -ENODEV; | ||
367 | |||
271 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 368 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
272 | if (!regs) { | 369 | if (!regs) { |
273 | dev_err(&pdev->dev, "no mmio resource defined\n"); | 370 | dev_err(&pdev->dev, "no mmio resource defined\n"); |
@@ -290,7 +387,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
290 | at91_rtc_write(AT91_RTC_MR, 0); /* 24 hour mode */ | 387 | at91_rtc_write(AT91_RTC_MR, 0); /* 24 hour mode */ |
291 | 388 | ||
292 | /* Disable all interrupts */ | 389 | /* Disable all interrupts */ |
293 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 390 | at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
294 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 391 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
295 | AT91_RTC_CALEV); | 392 | AT91_RTC_CALEV); |
296 | 393 | ||
@@ -335,7 +432,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) | |||
335 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 432 | struct rtc_device *rtc = platform_get_drvdata(pdev); |
336 | 433 | ||
337 | /* Disable all interrupts */ | 434 | /* Disable all interrupts */ |
338 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 435 | at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
339 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 436 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
340 | AT91_RTC_CALEV); | 437 | AT91_RTC_CALEV); |
341 | free_irq(irq, pdev); | 438 | free_irq(irq, pdev); |
@@ -358,13 +455,13 @@ static int at91_rtc_suspend(struct device *dev) | |||
358 | /* this IRQ is shared with DBGU and other hardware which isn't | 455 | /* this IRQ is shared with DBGU and other hardware which isn't |
359 | * necessarily doing PM like we are... | 456 | * necessarily doing PM like we are... |
360 | */ | 457 | */ |
361 | at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR) | 458 | at91_rtc_imr = at91_rtc_read_imr() |
362 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); | 459 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); |
363 | if (at91_rtc_imr) { | 460 | if (at91_rtc_imr) { |
364 | if (device_may_wakeup(dev)) | 461 | if (device_may_wakeup(dev)) |
365 | enable_irq_wake(irq); | 462 | enable_irq_wake(irq); |
366 | else | 463 | else |
367 | at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr); | 464 | at91_rtc_write_idr(at91_rtc_imr); |
368 | } | 465 | } |
369 | return 0; | 466 | return 0; |
370 | } | 467 | } |
@@ -375,7 +472,7 @@ static int at91_rtc_resume(struct device *dev) | |||
375 | if (device_may_wakeup(dev)) | 472 | if (device_may_wakeup(dev)) |
376 | disable_irq_wake(irq); | 473 | disable_irq_wake(irq); |
377 | else | 474 | else |
378 | at91_rtc_write(AT91_RTC_IER, at91_rtc_imr); | 475 | at91_rtc_write_ier(at91_rtc_imr); |
379 | } | 476 | } |
380 | return 0; | 477 | return 0; |
381 | } | 478 | } |
@@ -383,12 +480,6 @@ static int at91_rtc_resume(struct device *dev) | |||
383 | 480 | ||
384 | static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume); | 481 | static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume); |
385 | 482 | ||
386 | static const struct of_device_id at91_rtc_dt_ids[] = { | ||
387 | { .compatible = "atmel,at91rm9200-rtc" }, | ||
388 | { /* sentinel */ } | ||
389 | }; | ||
390 | MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids); | ||
391 | |||
392 | static struct platform_driver at91_rtc_driver = { | 483 | static struct platform_driver at91_rtc_driver = { |
393 | .remove = __exit_p(at91_rtc_remove), | 484 | .remove = __exit_p(at91_rtc_remove), |
394 | .driver = { | 485 | .driver = { |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index cc5bea9c4b1c..f1cb706445c7 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -854,6 +854,9 @@ static int cmos_resume(struct device *dev) | |||
854 | } | 854 | } |
855 | 855 | ||
856 | spin_lock_irq(&rtc_lock); | 856 | spin_lock_irq(&rtc_lock); |
857 | if (device_may_wakeup(dev)) | ||
858 | hpet_rtc_timer_init(); | ||
859 | |||
857 | do { | 860 | do { |
858 | CMOS_WRITE(tmp, RTC_CONTROL); | 861 | CMOS_WRITE(tmp, RTC_CONTROL); |
859 | hpet_set_rtc_irq_bit(tmp & RTC_IRQMASK); | 862 | hpet_set_rtc_irq_bit(tmp & RTC_IRQMASK); |
@@ -869,7 +872,6 @@ static int cmos_resume(struct device *dev) | |||
869 | rtc_update_irq(cmos->rtc, 1, mask); | 872 | rtc_update_irq(cmos->rtc, 1, mask); |
870 | tmp &= ~RTC_AIE; | 873 | tmp &= ~RTC_AIE; |
871 | hpet_mask_rtc_irq_bit(RTC_AIE); | 874 | hpet_mask_rtc_irq_bit(RTC_AIE); |
872 | hpet_rtc_timer_init(); | ||
873 | } while (mask & RTC_AIE); | 875 | } while (mask & RTC_AIE); |
874 | spin_unlock_irq(&rtc_lock); | 876 | spin_unlock_irq(&rtc_lock); |
875 | } | 877 | } |
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c index 48b6612fae7f..d5af7baa48b5 100644 --- a/drivers/rtc/rtc-max8998.c +++ b/drivers/rtc/rtc-max8998.c | |||
@@ -285,7 +285,7 @@ static int max8998_rtc_probe(struct platform_device *pdev) | |||
285 | info->irq, ret); | 285 | info->irq, ret); |
286 | 286 | ||
287 | dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); | 287 | dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); |
288 | if (pdata->rtc_delay) { | 288 | if (pdata && pdata->rtc_delay) { |
289 | info->lp3974_bug_workaround = true; | 289 | info->lp3974_bug_workaround = true; |
290 | dev_warn(&pdev->dev, "LP3974 with RTC REGERR option." | 290 | dev_warn(&pdev->dev, "LP3974 with RTC REGERR option." |
291 | " RTC updates will be extremely slow.\n"); | 291 | " RTC updates will be extremely slow.\n"); |
diff --git a/drivers/rtc/rtc-nuc900.c b/drivers/rtc/rtc-nuc900.c index f5dfb6e5e7d9..d592e2fe43f7 100644 --- a/drivers/rtc/rtc-nuc900.c +++ b/drivers/rtc/rtc-nuc900.c | |||
@@ -234,11 +234,6 @@ static int __init nuc900_rtc_probe(struct platform_device *pdev) | |||
234 | return -ENOMEM; | 234 | return -ENOMEM; |
235 | } | 235 | } |
236 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 236 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
237 | if (!res) { | ||
238 | dev_err(&pdev->dev, "platform_get_resource failed\n"); | ||
239 | return -ENXIO; | ||
240 | } | ||
241 | |||
242 | nuc900_rtc->rtc_reg = devm_ioremap_resource(&pdev->dev, res); | 237 | nuc900_rtc->rtc_reg = devm_ioremap_resource(&pdev->dev, res); |
243 | if (IS_ERR(nuc900_rtc->rtc_reg)) | 238 | if (IS_ERR(nuc900_rtc->rtc_reg)) |
244 | return PTR_ERR(nuc900_rtc->rtc_reg); | 239 | return PTR_ERR(nuc900_rtc->rtc_reg); |
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 4e1bdb832e37..b0ba3fc991ea 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c | |||
@@ -347,11 +347,6 @@ static int __init omap_rtc_probe(struct platform_device *pdev) | |||
347 | } | 347 | } |
348 | 348 | ||
349 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 349 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
350 | if (!res) { | ||
351 | pr_debug("%s: RTC resource data missing\n", pdev->name); | ||
352 | return -ENOENT; | ||
353 | } | ||
354 | |||
355 | rtc_base = devm_ioremap_resource(&pdev->dev, res); | 350 | rtc_base = devm_ioremap_resource(&pdev->dev, res); |
356 | if (IS_ERR(rtc_base)) | 351 | if (IS_ERR(rtc_base)) |
357 | return PTR_ERR(rtc_base); | 352 | return PTR_ERR(rtc_base); |
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 8900ea784817..0f0609b1aa2c 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
@@ -306,7 +306,7 @@ static int pl031_remove(struct amba_device *adev) | |||
306 | struct pl031_local *ldata = dev_get_drvdata(&adev->dev); | 306 | struct pl031_local *ldata = dev_get_drvdata(&adev->dev); |
307 | 307 | ||
308 | amba_set_drvdata(adev, NULL); | 308 | amba_set_drvdata(adev, NULL); |
309 | free_irq(adev->irq[0], ldata->rtc); | 309 | free_irq(adev->irq[0], ldata); |
310 | rtc_device_unregister(ldata->rtc); | 310 | rtc_device_unregister(ldata->rtc); |
311 | iounmap(ldata->base); | 311 | iounmap(ldata->base); |
312 | kfree(ldata); | 312 | kfree(ldata); |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 14040b22888d..0b495e8b8e66 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -477,11 +477,6 @@ static int s3c_rtc_probe(struct platform_device *pdev) | |||
477 | /* get the memory region */ | 477 | /* get the memory region */ |
478 | 478 | ||
479 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 479 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
480 | if (res == NULL) { | ||
481 | dev_err(&pdev->dev, "failed to get memory region resource\n"); | ||
482 | return -ENOENT; | ||
483 | } | ||
484 | |||
485 | s3c_rtc_base = devm_ioremap_resource(&pdev->dev, res); | 480 | s3c_rtc_base = devm_ioremap_resource(&pdev->dev, res); |
486 | if (IS_ERR(s3c_rtc_base)) | 481 | if (IS_ERR(s3c_rtc_base)) |
487 | return PTR_ERR(s3c_rtc_base); | 482 | return PTR_ERR(s3c_rtc_base); |
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c index a34315d25478..76af92ad5a8a 100644 --- a/drivers/rtc/rtc-tegra.c +++ b/drivers/rtc/rtc-tegra.c | |||
@@ -322,12 +322,6 @@ static int __init tegra_rtc_probe(struct platform_device *pdev) | |||
322 | return -ENOMEM; | 322 | return -ENOMEM; |
323 | 323 | ||
324 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 324 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
325 | if (!res) { | ||
326 | dev_err(&pdev->dev, | ||
327 | "Unable to allocate resources for device.\n"); | ||
328 | return -EBUSY; | ||
329 | } | ||
330 | |||
331 | info->rtc_base = devm_ioremap_resource(&pdev->dev, res); | 325 | info->rtc_base = devm_ioremap_resource(&pdev->dev, res); |
332 | if (IS_ERR(info->rtc_base)) | 326 | if (IS_ERR(info->rtc_base)) |
333 | return PTR_ERR(info->rtc_base); | 327 | return PTR_ERR(info->rtc_base); |
diff --git a/drivers/rtc/rtc-tps6586x.c b/drivers/rtc/rtc-tps6586x.c index 459c2ffc95a6..426901cef14f 100644 --- a/drivers/rtc/rtc-tps6586x.c +++ b/drivers/rtc/rtc-tps6586x.c | |||
@@ -273,6 +273,8 @@ static int tps6586x_rtc_probe(struct platform_device *pdev) | |||
273 | return ret; | 273 | return ret; |
274 | } | 274 | } |
275 | 275 | ||
276 | device_init_wakeup(&pdev->dev, 1); | ||
277 | |||
276 | platform_set_drvdata(pdev, rtc); | 278 | platform_set_drvdata(pdev, rtc); |
277 | rtc->rtc = devm_rtc_device_register(&pdev->dev, dev_name(&pdev->dev), | 279 | rtc->rtc = devm_rtc_device_register(&pdev->dev, dev_name(&pdev->dev), |
278 | &tps6586x_rtc_ops, THIS_MODULE); | 280 | &tps6586x_rtc_ops, THIS_MODULE); |
@@ -292,7 +294,6 @@ static int tps6586x_rtc_probe(struct platform_device *pdev) | |||
292 | goto fail_rtc_register; | 294 | goto fail_rtc_register; |
293 | } | 295 | } |
294 | disable_irq(rtc->irq); | 296 | disable_irq(rtc->irq); |
295 | device_set_wakeup_capable(&pdev->dev, 1); | ||
296 | return 0; | 297 | return 0; |
297 | 298 | ||
298 | fail_rtc_register: | 299 | fail_rtc_register: |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 8751a5240c99..b2eab34f38d9 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -524,6 +524,7 @@ static int twl_rtc_probe(struct platform_device *pdev) | |||
524 | } | 524 | } |
525 | 525 | ||
526 | platform_set_drvdata(pdev, rtc); | 526 | platform_set_drvdata(pdev, rtc); |
527 | device_init_wakeup(&pdev->dev, 1); | ||
527 | return 0; | 528 | return 0; |
528 | 529 | ||
529 | out2: | 530 | out2: |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 4361d9772c42..d72a9216ee2e 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -3440,8 +3440,16 @@ void dasd_generic_path_event(struct ccw_device *cdev, int *path_event) | |||
3440 | device->path_data.opm &= ~eventlpm; | 3440 | device->path_data.opm &= ~eventlpm; |
3441 | device->path_data.ppm &= ~eventlpm; | 3441 | device->path_data.ppm &= ~eventlpm; |
3442 | device->path_data.npm &= ~eventlpm; | 3442 | device->path_data.npm &= ~eventlpm; |
3443 | if (oldopm && !device->path_data.opm) | 3443 | if (oldopm && !device->path_data.opm) { |
3444 | dasd_generic_last_path_gone(device); | 3444 | dev_warn(&device->cdev->dev, |
3445 | "No verified channel paths remain " | ||
3446 | "for the device\n"); | ||
3447 | DBF_DEV_EVENT(DBF_WARNING, device, | ||
3448 | "%s", "last verified path gone"); | ||
3449 | dasd_eer_write(device, NULL, DASD_EER_NOPATH); | ||
3450 | dasd_device_set_stop_bits(device, | ||
3451 | DASD_STOPPED_DC_WAIT); | ||
3452 | } | ||
3445 | } | 3453 | } |
3446 | if (path_event[chp] & PE_PATH_AVAILABLE) { | 3454 | if (path_event[chp] & PE_PATH_AVAILABLE) { |
3447 | device->path_data.opm &= ~eventlpm; | 3455 | device->path_data.opm &= ~eventlpm; |
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index 690c3338a8ae..464dd29d06c0 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c | |||
@@ -343,6 +343,7 @@ static int __init xpram_setup_blkdev(void) | |||
343 | put_disk(xpram_disks[i]); | 343 | put_disk(xpram_disks[i]); |
344 | goto out; | 344 | goto out; |
345 | } | 345 | } |
346 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, xpram_queues[i]); | ||
346 | blk_queue_make_request(xpram_queues[i], xpram_make_request); | 347 | blk_queue_make_request(xpram_queues[i], xpram_make_request); |
347 | blk_queue_logical_block_size(xpram_queues[i], 4096); | 348 | blk_queue_logical_block_size(xpram_queues[i], 4096); |
348 | } | 349 | } |
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c index 21fabc6d5a9c..6c440d4349d4 100644 --- a/drivers/s390/cio/chp.c +++ b/drivers/s390/cio/chp.c | |||
@@ -352,12 +352,48 @@ static ssize_t chp_shared_show(struct device *dev, | |||
352 | 352 | ||
353 | static DEVICE_ATTR(shared, 0444, chp_shared_show, NULL); | 353 | static DEVICE_ATTR(shared, 0444, chp_shared_show, NULL); |
354 | 354 | ||
355 | static ssize_t chp_chid_show(struct device *dev, struct device_attribute *attr, | ||
356 | char *buf) | ||
357 | { | ||
358 | struct channel_path *chp = to_channelpath(dev); | ||
359 | ssize_t rc; | ||
360 | |||
361 | mutex_lock(&chp->lock); | ||
362 | if (chp->desc_fmt1.flags & 0x10) | ||
363 | rc = sprintf(buf, "%04x\n", chp->desc_fmt1.chid); | ||
364 | else | ||
365 | rc = 0; | ||
366 | mutex_unlock(&chp->lock); | ||
367 | |||
368 | return rc; | ||
369 | } | ||
370 | static DEVICE_ATTR(chid, 0444, chp_chid_show, NULL); | ||
371 | |||
372 | static ssize_t chp_chid_external_show(struct device *dev, | ||
373 | struct device_attribute *attr, char *buf) | ||
374 | { | ||
375 | struct channel_path *chp = to_channelpath(dev); | ||
376 | ssize_t rc; | ||
377 | |||
378 | mutex_lock(&chp->lock); | ||
379 | if (chp->desc_fmt1.flags & 0x10) | ||
380 | rc = sprintf(buf, "%x\n", chp->desc_fmt1.flags & 0x8 ? 1 : 0); | ||
381 | else | ||
382 | rc = 0; | ||
383 | mutex_unlock(&chp->lock); | ||
384 | |||
385 | return rc; | ||
386 | } | ||
387 | static DEVICE_ATTR(chid_external, 0444, chp_chid_external_show, NULL); | ||
388 | |||
355 | static struct attribute *chp_attrs[] = { | 389 | static struct attribute *chp_attrs[] = { |
356 | &dev_attr_status.attr, | 390 | &dev_attr_status.attr, |
357 | &dev_attr_configure.attr, | 391 | &dev_attr_configure.attr, |
358 | &dev_attr_type.attr, | 392 | &dev_attr_type.attr, |
359 | &dev_attr_cmg.attr, | 393 | &dev_attr_cmg.attr, |
360 | &dev_attr_shared.attr, | 394 | &dev_attr_shared.attr, |
395 | &dev_attr_chid.attr, | ||
396 | &dev_attr_chid_external.attr, | ||
361 | NULL, | 397 | NULL, |
362 | }; | 398 | }; |
363 | static struct attribute_group chp_attr_group = { | 399 | static struct attribute_group chp_attr_group = { |
diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h index 349d5fc47196..e7ef2a683b8f 100644 --- a/drivers/s390/cio/chsc.h +++ b/drivers/s390/cio/chsc.h | |||
@@ -43,7 +43,9 @@ struct channel_path_desc_fmt1 { | |||
43 | u8 chpid; | 43 | u8 chpid; |
44 | u32:24; | 44 | u32:24; |
45 | u8 chpp; | 45 | u8 chpp; |
46 | u32 unused[3]; | 46 | u32 unused[2]; |
47 | u16 chid; | ||
48 | u32:16; | ||
47 | u16 mdc; | 49 | u16 mdc; |
48 | u16:13; | 50 | u16:13; |
49 | u8 r:1; | 51 | u8 r:1; |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 4ffa66c87ea5..9ca3996f65b2 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -2040,6 +2040,7 @@ static struct net_device *netiucv_init_netdevice(char *username, char *userdata) | |||
2040 | netiucv_setup_netdevice); | 2040 | netiucv_setup_netdevice); |
2041 | if (!dev) | 2041 | if (!dev) |
2042 | return NULL; | 2042 | return NULL; |
2043 | rtnl_lock(); | ||
2043 | if (dev_alloc_name(dev, dev->name) < 0) | 2044 | if (dev_alloc_name(dev, dev->name) < 0) |
2044 | goto out_netdev; | 2045 | goto out_netdev; |
2045 | 2046 | ||
@@ -2061,6 +2062,7 @@ static struct net_device *netiucv_init_netdevice(char *username, char *userdata) | |||
2061 | out_fsm: | 2062 | out_fsm: |
2062 | kfree_fsm(privptr->fsm); | 2063 | kfree_fsm(privptr->fsm); |
2063 | out_netdev: | 2064 | out_netdev: |
2065 | rtnl_unlock(); | ||
2064 | free_netdev(dev); | 2066 | free_netdev(dev); |
2065 | return NULL; | 2067 | return NULL; |
2066 | } | 2068 | } |
@@ -2100,6 +2102,7 @@ static ssize_t conn_write(struct device_driver *drv, | |||
2100 | 2102 | ||
2101 | rc = netiucv_register_device(dev); | 2103 | rc = netiucv_register_device(dev); |
2102 | if (rc) { | 2104 | if (rc) { |
2105 | rtnl_unlock(); | ||
2103 | IUCV_DBF_TEXT_(setup, 2, | 2106 | IUCV_DBF_TEXT_(setup, 2, |
2104 | "ret %d from netiucv_register_device\n", rc); | 2107 | "ret %d from netiucv_register_device\n", rc); |
2105 | goto out_free_ndev; | 2108 | goto out_free_ndev; |
@@ -2109,7 +2112,8 @@ static ssize_t conn_write(struct device_driver *drv, | |||
2109 | priv = netdev_priv(dev); | 2112 | priv = netdev_priv(dev); |
2110 | SET_NETDEV_DEV(dev, priv->dev); | 2113 | SET_NETDEV_DEV(dev, priv->dev); |
2111 | 2114 | ||
2112 | rc = register_netdev(dev); | 2115 | rc = register_netdevice(dev); |
2116 | rtnl_unlock(); | ||
2113 | if (rc) | 2117 | if (rc) |
2114 | goto out_unreg; | 2118 | goto out_unreg; |
2115 | 2119 | ||
diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c index 439c012be763..b63d534192e3 100644 --- a/drivers/scsi/bfa/bfad_debugfs.c +++ b/drivers/scsi/bfa/bfad_debugfs.c | |||
@@ -186,7 +186,7 @@ bfad_debugfs_lseek(struct file *file, loff_t offset, int orig) | |||
186 | file->f_pos += offset; | 186 | file->f_pos += offset; |
187 | break; | 187 | break; |
188 | case 2: | 188 | case 2: |
189 | file->f_pos = debug->buffer_len - offset; | 189 | file->f_pos = debug->buffer_len + offset; |
190 | break; | 190 | break; |
191 | default: | 191 | default: |
192 | return -EINVAL; | 192 | return -EINVAL; |
diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c index adc1f7f471f5..85e1ffd0e5c5 100644 --- a/drivers/scsi/fnic/fnic_debugfs.c +++ b/drivers/scsi/fnic/fnic_debugfs.c | |||
@@ -174,7 +174,7 @@ static loff_t fnic_trace_debugfs_lseek(struct file *file, | |||
174 | pos = file->f_pos + offset; | 174 | pos = file->f_pos + offset; |
175 | break; | 175 | break; |
176 | case 2: | 176 | case 2: |
177 | pos = fnic_dbg_prt->buffer_len - offset; | 177 | pos = fnic_dbg_prt->buffer_len + offset; |
178 | } | 178 | } |
179 | return (pos < 0 || pos > fnic_dbg_prt->buffer_len) ? | 179 | return (pos < 0 || pos > fnic_dbg_prt->buffer_len) ? |
180 | -EINVAL : (file->f_pos = pos); | 180 | -EINVAL : (file->f_pos = pos); |
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index f63f5ff7f274..f525ecb7a9c6 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -1178,7 +1178,7 @@ lpfc_debugfs_lseek(struct file *file, loff_t off, int whence) | |||
1178 | pos = file->f_pos + off; | 1178 | pos = file->f_pos + off; |
1179 | break; | 1179 | break; |
1180 | case 2: | 1180 | case 2: |
1181 | pos = debug->len - off; | 1181 | pos = debug->len + off; |
1182 | } | 1182 | } |
1183 | return (pos < 0 || pos > debug->len) ? -EINVAL : (file->f_pos = pos); | 1183 | return (pos < 0 || pos > debug->len) ? -EINVAL : (file->f_pos = pos); |
1184 | } | 1184 | } |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index d182c96e17ea..66b0b26a1381 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -688,8 +688,12 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) | |||
688 | * For FCP_READ with CHECK_CONDITION status, clear cmd->bufflen | 688 | * For FCP_READ with CHECK_CONDITION status, clear cmd->bufflen |
689 | * for qla_tgt_xmit_response LLD code | 689 | * for qla_tgt_xmit_response LLD code |
690 | */ | 690 | */ |
691 | if (se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { | ||
692 | se_cmd->se_cmd_flags &= ~SCF_OVERFLOW_BIT; | ||
693 | se_cmd->residual_count = 0; | ||
694 | } | ||
691 | se_cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; | 695 | se_cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; |
692 | se_cmd->residual_count = se_cmd->data_length; | 696 | se_cmd->residual_count += se_cmd->data_length; |
693 | 697 | ||
694 | cmd->bufflen = 0; | 698 | cmd->bufflen = 0; |
695 | } | 699 | } |
@@ -1370,7 +1374,7 @@ static void tcm_qla2xxx_free_session(struct qla_tgt_sess *sess) | |||
1370 | dump_stack(); | 1374 | dump_stack(); |
1371 | return; | 1375 | return; |
1372 | } | 1376 | } |
1373 | target_wait_for_sess_cmds(se_sess, 0); | 1377 | target_wait_for_sess_cmds(se_sess); |
1374 | 1378 | ||
1375 | transport_deregister_session_configfs(sess->se_sess); | 1379 | transport_deregister_session_configfs(sess->se_sess); |
1376 | transport_deregister_session(sess->se_sess); | 1380 | transport_deregister_session(sess->se_sess); |
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index db66357211ed..86f0c5d5c116 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c | |||
@@ -84,6 +84,7 @@ static int proc_scsi_host_open(struct inode *inode, struct file *file) | |||
84 | 84 | ||
85 | static const struct file_operations proc_scsi_fops = { | 85 | static const struct file_operations proc_scsi_fops = { |
86 | .open = proc_scsi_host_open, | 86 | .open = proc_scsi_host_open, |
87 | .release = single_release, | ||
87 | .read = seq_read, | 88 | .read = seq_read, |
88 | .llseek = seq_lseek, | 89 | .llseek = seq_lseek, |
89 | .write = proc_scsi_host_write | 90 | .write = proc_scsi_host_write |
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 787bd2c22bca..380387a47b1d 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -526,13 +526,17 @@ static void atmel_spi_next_xfer_pio(struct spi_master *master, | |||
526 | } | 526 | } |
527 | 527 | ||
528 | if (xfer->tx_buf) | 528 | if (xfer->tx_buf) |
529 | spi_writel(as, TDR, *(u8 *)(xfer->tx_buf)); | 529 | if (xfer->bits_per_word > 8) |
530 | spi_writel(as, TDR, *(u16 *)(xfer->tx_buf)); | ||
531 | else | ||
532 | spi_writel(as, TDR, *(u8 *)(xfer->tx_buf)); | ||
530 | else | 533 | else |
531 | spi_writel(as, TDR, 0); | 534 | spi_writel(as, TDR, 0); |
532 | 535 | ||
533 | dev_dbg(master->dev.parent, | 536 | dev_dbg(master->dev.parent, |
534 | " start pio xfer %p: len %u tx %p rx %p\n", | 537 | " start pio xfer %p: len %u tx %p rx %p bitpw %d\n", |
535 | xfer, xfer->len, xfer->tx_buf, xfer->rx_buf); | 538 | xfer, xfer->len, xfer->tx_buf, xfer->rx_buf, |
539 | xfer->bits_per_word); | ||
536 | 540 | ||
537 | /* Enable relevant interrupts */ | 541 | /* Enable relevant interrupts */ |
538 | spi_writel(as, IER, SPI_BIT(RDRF) | SPI_BIT(OVRES)); | 542 | spi_writel(as, IER, SPI_BIT(RDRF) | SPI_BIT(OVRES)); |
@@ -950,21 +954,39 @@ atmel_spi_pump_pio_data(struct atmel_spi *as, struct spi_transfer *xfer) | |||
950 | { | 954 | { |
951 | u8 *txp; | 955 | u8 *txp; |
952 | u8 *rxp; | 956 | u8 *rxp; |
957 | u16 *txp16; | ||
958 | u16 *rxp16; | ||
953 | unsigned long xfer_pos = xfer->len - as->current_remaining_bytes; | 959 | unsigned long xfer_pos = xfer->len - as->current_remaining_bytes; |
954 | 960 | ||
955 | if (xfer->rx_buf) { | 961 | if (xfer->rx_buf) { |
956 | rxp = ((u8 *)xfer->rx_buf) + xfer_pos; | 962 | if (xfer->bits_per_word > 8) { |
957 | *rxp = spi_readl(as, RDR); | 963 | rxp16 = (u16 *)(((u8 *)xfer->rx_buf) + xfer_pos); |
964 | *rxp16 = spi_readl(as, RDR); | ||
965 | } else { | ||
966 | rxp = ((u8 *)xfer->rx_buf) + xfer_pos; | ||
967 | *rxp = spi_readl(as, RDR); | ||
968 | } | ||
958 | } else { | 969 | } else { |
959 | spi_readl(as, RDR); | 970 | spi_readl(as, RDR); |
960 | } | 971 | } |
961 | 972 | if (xfer->bits_per_word > 8) { | |
962 | as->current_remaining_bytes--; | 973 | as->current_remaining_bytes -= 2; |
974 | if (as->current_remaining_bytes < 0) | ||
975 | as->current_remaining_bytes = 0; | ||
976 | } else { | ||
977 | as->current_remaining_bytes--; | ||
978 | } | ||
963 | 979 | ||
964 | if (as->current_remaining_bytes) { | 980 | if (as->current_remaining_bytes) { |
965 | if (xfer->tx_buf) { | 981 | if (xfer->tx_buf) { |
966 | txp = ((u8 *)xfer->tx_buf) + xfer_pos + 1; | 982 | if (xfer->bits_per_word > 8) { |
967 | spi_writel(as, TDR, *txp); | 983 | txp16 = (u16 *)(((u8 *)xfer->tx_buf) |
984 | + xfer_pos + 2); | ||
985 | spi_writel(as, TDR, *txp16); | ||
986 | } else { | ||
987 | txp = ((u8 *)xfer->tx_buf) + xfer_pos + 1; | ||
988 | spi_writel(as, TDR, *txp); | ||
989 | } | ||
968 | } else { | 990 | } else { |
969 | spi_writel(as, TDR, 0); | 991 | spi_writel(as, TDR, 0); |
970 | } | 992 | } |
@@ -1378,9 +1400,16 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg) | |||
1378 | } | 1400 | } |
1379 | } | 1401 | } |
1380 | 1402 | ||
1403 | if (xfer->bits_per_word > 8) { | ||
1404 | if (xfer->len % 2) { | ||
1405 | dev_dbg(&spi->dev, "buffer len should be 16 bits aligned\n"); | ||
1406 | return -EINVAL; | ||
1407 | } | ||
1408 | } | ||
1409 | |||
1381 | /* FIXME implement these protocol options!! */ | 1410 | /* FIXME implement these protocol options!! */ |
1382 | if (xfer->speed_hz) { | 1411 | if (xfer->speed_hz < spi->max_speed_hz) { |
1383 | dev_dbg(&spi->dev, "no protocol options yet\n"); | 1412 | dev_dbg(&spi->dev, "can't change speed in transfer\n"); |
1384 | return -ENOPROTOOPT; | 1413 | return -ENOPROTOOPT; |
1385 | } | 1414 | } |
1386 | 1415 | ||
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 2e8f24a1fb95..50b13c9b1ab6 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -784,7 +784,7 @@ static const struct of_device_id davinci_spi_of_match[] = { | |||
784 | }, | 784 | }, |
785 | { }, | 785 | { }, |
786 | }; | 786 | }; |
787 | MODULE_DEVICE_TABLE(of, davini_spi_of_match); | 787 | MODULE_DEVICE_TABLE(of, davinci_spi_of_match); |
788 | 788 | ||
789 | /** | 789 | /** |
790 | * spi_davinci_get_pdata - Get platform data from DTS binding | 790 | * spi_davinci_get_pdata - Get platform data from DTS binding |
diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c index 60cfae51c713..eab593eaaafa 100644 --- a/drivers/spi/spi-sh-hspi.c +++ b/drivers/spi/spi-sh-hspi.c | |||
@@ -89,7 +89,7 @@ static int hspi_status_check_timeout(struct hspi_priv *hspi, u32 mask, u32 val) | |||
89 | if ((mask & hspi_read(hspi, SPSR)) == val) | 89 | if ((mask & hspi_read(hspi, SPSR)) == val) |
90 | return 0; | 90 | return 0; |
91 | 91 | ||
92 | msleep(20); | 92 | udelay(10); |
93 | } | 93 | } |
94 | 94 | ||
95 | dev_err(hspi->dev, "timeout\n"); | 95 | dev_err(hspi->dev, "timeout\n"); |
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index d65c000efe35..09df8e22dba0 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c | |||
@@ -489,11 +489,6 @@ static int tegra_sflash_probe(struct platform_device *pdev) | |||
489 | tegra_sflash_parse_dt(tsd); | 489 | tegra_sflash_parse_dt(tsd); |
490 | 490 | ||
491 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 491 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
492 | if (!r) { | ||
493 | dev_err(&pdev->dev, "No IO memory resource\n"); | ||
494 | ret = -ENODEV; | ||
495 | goto exit_free_master; | ||
496 | } | ||
497 | tsd->base = devm_ioremap_resource(&pdev->dev, r); | 492 | tsd->base = devm_ioremap_resource(&pdev->dev, r); |
498 | if (IS_ERR(tsd->base)) { | 493 | if (IS_ERR(tsd->base)) { |
499 | ret = PTR_ERR(tsd->base); | 494 | ret = PTR_ERR(tsd->base); |
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index 35f60bd252dd..637d728fbeb5 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c | |||
@@ -1487,7 +1487,7 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev) | |||
1487 | return 0; | 1487 | return 0; |
1488 | 1488 | ||
1489 | err_spi_register_master: | 1489 | err_spi_register_master: |
1490 | free_irq(board_dat->pdev->irq, board_dat); | 1490 | free_irq(board_dat->pdev->irq, data); |
1491 | err_request_irq: | 1491 | err_request_irq: |
1492 | pch_spi_free_resources(board_dat, data); | 1492 | pch_spi_free_resources(board_dat, data); |
1493 | err_spi_get_resources: | 1493 | err_spi_get_resources: |
@@ -1667,6 +1667,7 @@ static int pch_spi_probe(struct pci_dev *pdev, | |||
1667 | pd_dev = platform_device_alloc("pch-spi", i); | 1667 | pd_dev = platform_device_alloc("pch-spi", i); |
1668 | if (!pd_dev) { | 1668 | if (!pd_dev) { |
1669 | dev_err(&pdev->dev, "platform_device_alloc failed\n"); | 1669 | dev_err(&pdev->dev, "platform_device_alloc failed\n"); |
1670 | retval = -ENOMEM; | ||
1670 | goto err_platform_device; | 1671 | goto err_platform_device; |
1671 | } | 1672 | } |
1672 | pd_dev_save->pd_save[i] = pd_dev; | 1673 | pd_dev_save->pd_save[i] = pd_dev; |
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index e1d769607425..34d18dcfa0db 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c | |||
@@ -267,7 +267,6 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
267 | { | 267 | { |
268 | struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); | 268 | struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); |
269 | u32 ipif_ier; | 269 | u32 ipif_ier; |
270 | u16 cr; | ||
271 | 270 | ||
272 | /* We get here with transmitter inhibited */ | 271 | /* We get here with transmitter inhibited */ |
273 | 272 | ||
@@ -276,7 +275,6 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
276 | xspi->remaining_bytes = t->len; | 275 | xspi->remaining_bytes = t->len; |
277 | INIT_COMPLETION(xspi->done); | 276 | INIT_COMPLETION(xspi->done); |
278 | 277 | ||
279 | xilinx_spi_fill_tx_fifo(xspi); | ||
280 | 278 | ||
281 | /* Enable the transmit empty interrupt, which we use to determine | 279 | /* Enable the transmit empty interrupt, which we use to determine |
282 | * progress on the transmission. | 280 | * progress on the transmission. |
@@ -285,12 +283,41 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
285 | xspi->write_fn(ipif_ier | XSPI_INTR_TX_EMPTY, | 283 | xspi->write_fn(ipif_ier | XSPI_INTR_TX_EMPTY, |
286 | xspi->regs + XIPIF_V123B_IIER_OFFSET); | 284 | xspi->regs + XIPIF_V123B_IIER_OFFSET); |
287 | 285 | ||
288 | /* Start the transfer by not inhibiting the transmitter any longer */ | 286 | for (;;) { |
289 | cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET) & | 287 | u16 cr; |
290 | ~XSPI_CR_TRANS_INHIBIT; | 288 | u8 sr; |
291 | xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET); | 289 | |
290 | xilinx_spi_fill_tx_fifo(xspi); | ||
291 | |||
292 | /* Start the transfer by not inhibiting the transmitter any | ||
293 | * longer | ||
294 | */ | ||
295 | cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET) & | ||
296 | ~XSPI_CR_TRANS_INHIBIT; | ||
297 | xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET); | ||
298 | |||
299 | wait_for_completion(&xspi->done); | ||
300 | |||
301 | /* A transmit has just completed. Process received data and | ||
302 | * check for more data to transmit. Always inhibit the | ||
303 | * transmitter while the Isr refills the transmit register/FIFO, | ||
304 | * or make sure it is stopped if we're done. | ||
305 | */ | ||
306 | cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET); | ||
307 | xspi->write_fn(cr | XSPI_CR_TRANS_INHIBIT, | ||
308 | xspi->regs + XSPI_CR_OFFSET); | ||
309 | |||
310 | /* Read out all the data from the Rx FIFO */ | ||
311 | sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET); | ||
312 | while ((sr & XSPI_SR_RX_EMPTY_MASK) == 0) { | ||
313 | xspi->rx_fn(xspi); | ||
314 | sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET); | ||
315 | } | ||
292 | 316 | ||
293 | wait_for_completion(&xspi->done); | 317 | /* See if there is more data to send */ |
318 | if (!xspi->remaining_bytes > 0) | ||
319 | break; | ||
320 | } | ||
294 | 321 | ||
295 | /* Disable the transmit empty interrupt */ | 322 | /* Disable the transmit empty interrupt */ |
296 | xspi->write_fn(ipif_ier, xspi->regs + XIPIF_V123B_IIER_OFFSET); | 323 | xspi->write_fn(ipif_ier, xspi->regs + XIPIF_V123B_IIER_OFFSET); |
@@ -314,38 +341,7 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id) | |||
314 | xspi->write_fn(ipif_isr, xspi->regs + XIPIF_V123B_IISR_OFFSET); | 341 | xspi->write_fn(ipif_isr, xspi->regs + XIPIF_V123B_IISR_OFFSET); |
315 | 342 | ||
316 | if (ipif_isr & XSPI_INTR_TX_EMPTY) { /* Transmission completed */ | 343 | if (ipif_isr & XSPI_INTR_TX_EMPTY) { /* Transmission completed */ |
317 | u16 cr; | 344 | complete(&xspi->done); |
318 | u8 sr; | ||
319 | |||
320 | /* A transmit has just completed. Process received data and | ||
321 | * check for more data to transmit. Always inhibit the | ||
322 | * transmitter while the Isr refills the transmit register/FIFO, | ||
323 | * or make sure it is stopped if we're done. | ||
324 | */ | ||
325 | cr = xspi->read_fn(xspi->regs + XSPI_CR_OFFSET); | ||
326 | xspi->write_fn(cr | XSPI_CR_TRANS_INHIBIT, | ||
327 | xspi->regs + XSPI_CR_OFFSET); | ||
328 | |||
329 | /* Read out all the data from the Rx FIFO */ | ||
330 | sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET); | ||
331 | while ((sr & XSPI_SR_RX_EMPTY_MASK) == 0) { | ||
332 | xspi->rx_fn(xspi); | ||
333 | sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET); | ||
334 | } | ||
335 | |||
336 | /* See if there is more data to send */ | ||
337 | if (xspi->remaining_bytes > 0) { | ||
338 | xilinx_spi_fill_tx_fifo(xspi); | ||
339 | /* Start the transfer by not inhibiting the | ||
340 | * transmitter any longer | ||
341 | */ | ||
342 | xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET); | ||
343 | } else { | ||
344 | /* No more data to send. | ||
345 | * Indicate the transfer is completed. | ||
346 | */ | ||
347 | complete(&xspi->done); | ||
348 | } | ||
349 | } | 345 | } |
350 | 346 | ||
351 | return IRQ_HANDLED; | 347 | return IRQ_HANDLED; |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 163fd802b7ac..32b7bb111eb6 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -334,7 +334,7 @@ struct spi_device *spi_alloc_device(struct spi_master *master) | |||
334 | spi->dev.parent = &master->dev; | 334 | spi->dev.parent = &master->dev; |
335 | spi->dev.bus = &spi_bus_type; | 335 | spi->dev.bus = &spi_bus_type; |
336 | spi->dev.release = spidev_release; | 336 | spi->dev.release = spidev_release; |
337 | spi->cs_gpio = -EINVAL; | 337 | spi->cs_gpio = -ENOENT; |
338 | device_initialize(&spi->dev); | 338 | device_initialize(&spi->dev); |
339 | return spi; | 339 | return spi; |
340 | } | 340 | } |
@@ -1067,8 +1067,11 @@ static int of_spi_register_master(struct spi_master *master) | |||
1067 | nb = of_gpio_named_count(np, "cs-gpios"); | 1067 | nb = of_gpio_named_count(np, "cs-gpios"); |
1068 | master->num_chipselect = max(nb, (int)master->num_chipselect); | 1068 | master->num_chipselect = max(nb, (int)master->num_chipselect); |
1069 | 1069 | ||
1070 | if (nb < 1) | 1070 | /* Return error only for an incorrectly formed cs-gpios property */ |
1071 | if (nb == 0 || nb == -ENOENT) | ||
1071 | return 0; | 1072 | return 0; |
1073 | else if (nb < 0) | ||
1074 | return nb; | ||
1072 | 1075 | ||
1073 | cs = devm_kzalloc(&master->dev, | 1076 | cs = devm_kzalloc(&master->dev, |
1074 | sizeof(int) * master->num_chipselect, | 1077 | sizeof(int) * master->num_chipselect, |
@@ -1079,7 +1082,7 @@ static int of_spi_register_master(struct spi_master *master) | |||
1079 | return -ENOMEM; | 1082 | return -ENOMEM; |
1080 | 1083 | ||
1081 | for (i = 0; i < master->num_chipselect; i++) | 1084 | for (i = 0; i < master->num_chipselect; i++) |
1082 | cs[i] = -EINVAL; | 1085 | cs[i] = -ENOENT; |
1083 | 1086 | ||
1084 | for (i = 0; i < nb; i++) | 1087 | for (i = 0; i < nb; i++) |
1085 | cs[i] = of_get_named_gpio(np, "cs-gpios", i); | 1088 | cs[i] = of_get_named_gpio(np, "cs-gpios", i); |
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 4e8a1794f50a..aefe820a8005 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig | |||
@@ -72,10 +72,10 @@ source "drivers/staging/sep/Kconfig" | |||
72 | 72 | ||
73 | source "drivers/staging/iio/Kconfig" | 73 | source "drivers/staging/iio/Kconfig" |
74 | 74 | ||
75 | source "drivers/staging/zram/Kconfig" | ||
76 | |||
77 | source "drivers/staging/zsmalloc/Kconfig" | 75 | source "drivers/staging/zsmalloc/Kconfig" |
78 | 76 | ||
77 | source "drivers/staging/zram/Kconfig" | ||
78 | |||
79 | source "drivers/staging/wlags49_h2/Kconfig" | 79 | source "drivers/staging/wlags49_h2/Kconfig" |
80 | 80 | ||
81 | source "drivers/staging/wlags49_h25/Kconfig" | 81 | source "drivers/staging/wlags49_h25/Kconfig" |
diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c index ceb1c643753d..6dc27dac679d 100644 --- a/drivers/staging/android/alarm-dev.c +++ b/drivers/staging/android/alarm-dev.c | |||
@@ -264,6 +264,8 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
264 | } | 264 | } |
265 | 265 | ||
266 | rv = alarm_do_ioctl(file, cmd, &ts); | 266 | rv = alarm_do_ioctl(file, cmd, &ts); |
267 | if (rv) | ||
268 | return rv; | ||
267 | 269 | ||
268 | switch (ANDROID_ALARM_BASE_CMD(cmd)) { | 270 | switch (ANDROID_ALARM_BASE_CMD(cmd)) { |
269 | case ANDROID_ALARM_GET_TIME(0): | 271 | case ANDROID_ALARM_GET_TIME(0): |
@@ -272,7 +274,7 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
272 | break; | 274 | break; |
273 | } | 275 | } |
274 | 276 | ||
275 | return rv; | 277 | return 0; |
276 | } | 278 | } |
277 | #ifdef CONFIG_COMPAT | 279 | #ifdef CONFIG_COMPAT |
278 | static long alarm_compat_ioctl(struct file *file, unsigned int cmd, | 280 | static long alarm_compat_ioctl(struct file *file, unsigned int cmd, |
@@ -295,6 +297,8 @@ static long alarm_compat_ioctl(struct file *file, unsigned int cmd, | |||
295 | } | 297 | } |
296 | 298 | ||
297 | rv = alarm_do_ioctl(file, cmd, &ts); | 299 | rv = alarm_do_ioctl(file, cmd, &ts); |
300 | if (rv) | ||
301 | return rv; | ||
298 | 302 | ||
299 | switch (ANDROID_ALARM_BASE_CMD(cmd)) { | 303 | switch (ANDROID_ALARM_BASE_CMD(cmd)) { |
300 | case ANDROID_ALARM_GET_TIME(0): /* NOTE: we modified cmd above */ | 304 | case ANDROID_ALARM_GET_TIME(0): /* NOTE: we modified cmd above */ |
@@ -303,7 +307,7 @@ static long alarm_compat_ioctl(struct file *file, unsigned int cmd, | |||
303 | break; | 307 | break; |
304 | } | 308 | } |
305 | 309 | ||
306 | return rv; | 310 | return 0; |
307 | } | 311 | } |
308 | #endif | 312 | #endif |
309 | 313 | ||
diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index b040200a5a55..9bd874789ce5 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c | |||
@@ -242,7 +242,7 @@ static ssize_t do_read_log_to_user(struct logger_log *log, | |||
242 | * 'log->buffer' which contains the first entry readable by 'euid' | 242 | * 'log->buffer' which contains the first entry readable by 'euid' |
243 | */ | 243 | */ |
244 | static size_t get_next_entry_by_uid(struct logger_log *log, | 244 | static size_t get_next_entry_by_uid(struct logger_log *log, |
245 | size_t off, uid_t euid) | 245 | size_t off, kuid_t euid) |
246 | { | 246 | { |
247 | while (off != log->w_off) { | 247 | while (off != log->w_off) { |
248 | struct logger_entry *entry; | 248 | struct logger_entry *entry; |
@@ -251,7 +251,7 @@ static size_t get_next_entry_by_uid(struct logger_log *log, | |||
251 | 251 | ||
252 | entry = get_entry_header(log, off, &scratch); | 252 | entry = get_entry_header(log, off, &scratch); |
253 | 253 | ||
254 | if (entry->euid == euid) | 254 | if (uid_eq(entry->euid, euid)) |
255 | return off; | 255 | return off; |
256 | 256 | ||
257 | next_len = sizeof(struct logger_entry) + entry->len; | 257 | next_len = sizeof(struct logger_entry) + entry->len; |
diff --git a/drivers/staging/android/logger.h b/drivers/staging/android/logger.h index cc6bbd99c8e0..70af7d805dff 100644 --- a/drivers/staging/android/logger.h +++ b/drivers/staging/android/logger.h | |||
@@ -66,7 +66,7 @@ struct logger_entry { | |||
66 | __s32 tid; | 66 | __s32 tid; |
67 | __s32 sec; | 67 | __s32 sec; |
68 | __s32 nsec; | 68 | __s32 nsec; |
69 | uid_t euid; | 69 | kuid_t euid; |
70 | char msg[0]; | 70 | char msg[0]; |
71 | }; | 71 | }; |
72 | 72 | ||
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 7871579bb83d..87e852a0ef49 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig | |||
@@ -981,6 +981,7 @@ config COMEDI_ME_DAQ | |||
981 | 981 | ||
982 | config COMEDI_NI_6527 | 982 | config COMEDI_NI_6527 |
983 | tristate "NI 6527 support" | 983 | tristate "NI 6527 support" |
984 | depends on HAS_DMA | ||
984 | select COMEDI_MITE | 985 | select COMEDI_MITE |
985 | ---help--- | 986 | ---help--- |
986 | Enable support for the National Instruments 6527 PCI card | 987 | Enable support for the National Instruments 6527 PCI card |
@@ -990,6 +991,7 @@ config COMEDI_NI_6527 | |||
990 | 991 | ||
991 | config COMEDI_NI_65XX | 992 | config COMEDI_NI_65XX |
992 | tristate "NI 65xx static dio PCI card support" | 993 | tristate "NI 65xx static dio PCI card support" |
994 | depends on HAS_DMA | ||
993 | select COMEDI_MITE | 995 | select COMEDI_MITE |
994 | ---help--- | 996 | ---help--- |
995 | Enable support for National Instruments 65xx static dio boards. | 997 | Enable support for National Instruments 65xx static dio boards. |
@@ -1003,6 +1005,7 @@ config COMEDI_NI_65XX | |||
1003 | 1005 | ||
1004 | config COMEDI_NI_660X | 1006 | config COMEDI_NI_660X |
1005 | tristate "NI 660x counter/timer PCI card support" | 1007 | tristate "NI 660x counter/timer PCI card support" |
1008 | depends on HAS_DMA | ||
1006 | select COMEDI_NI_TIOCMD | 1009 | select COMEDI_NI_TIOCMD |
1007 | ---help--- | 1010 | ---help--- |
1008 | Enable support for National Instruments PCI-6601 (ni_660x), PCI-6602, | 1011 | Enable support for National Instruments PCI-6601 (ni_660x), PCI-6602, |
@@ -1013,6 +1016,7 @@ config COMEDI_NI_660X | |||
1013 | 1016 | ||
1014 | config COMEDI_NI_670X | 1017 | config COMEDI_NI_670X |
1015 | tristate "NI 670x PCI card support" | 1018 | tristate "NI 670x PCI card support" |
1019 | depends on HAS_DMA | ||
1016 | select COMEDI_MITE | 1020 | select COMEDI_MITE |
1017 | ---help--- | 1021 | ---help--- |
1018 | Enable support for National Instruments PCI-6703 and PCI-6704 | 1022 | Enable support for National Instruments PCI-6703 and PCI-6704 |
@@ -1022,6 +1026,7 @@ config COMEDI_NI_670X | |||
1022 | 1026 | ||
1023 | config COMEDI_NI_LABPC_PCI | 1027 | config COMEDI_NI_LABPC_PCI |
1024 | tristate "NI Lab-PC PCI-1200 support" | 1028 | tristate "NI Lab-PC PCI-1200 support" |
1029 | depends on HAS_DMA | ||
1025 | select COMEDI_NI_LABPC | 1030 | select COMEDI_NI_LABPC |
1026 | select COMEDI_MITE | 1031 | select COMEDI_MITE |
1027 | ---help--- | 1032 | ---help--- |
@@ -1032,6 +1037,7 @@ config COMEDI_NI_LABPC_PCI | |||
1032 | 1037 | ||
1033 | config COMEDI_NI_PCIDIO | 1038 | config COMEDI_NI_PCIDIO |
1034 | tristate "NI PCI-DIO32HS, PCI-6533, PCI-6534 support" | 1039 | tristate "NI PCI-DIO32HS, PCI-6533, PCI-6534 support" |
1040 | depends on HAS_DMA | ||
1035 | select COMEDI_MITE | 1041 | select COMEDI_MITE |
1036 | select COMEDI_8255 | 1042 | select COMEDI_8255 |
1037 | ---help--- | 1043 | ---help--- |
@@ -1043,6 +1049,7 @@ config COMEDI_NI_PCIDIO | |||
1043 | 1049 | ||
1044 | config COMEDI_NI_PCIMIO | 1050 | config COMEDI_NI_PCIMIO |
1045 | tristate "NI PCI-MIO-E series and M series support" | 1051 | tristate "NI PCI-MIO-E series and M series support" |
1052 | depends on HAS_DMA | ||
1046 | select COMEDI_NI_TIOCMD | 1053 | select COMEDI_NI_TIOCMD |
1047 | select COMEDI_8255 | 1054 | select COMEDI_8255 |
1048 | select COMEDI_FC | 1055 | select COMEDI_FC |
@@ -1095,10 +1102,12 @@ config COMEDI_SSV_DNP | |||
1095 | called ssv_dnp. | 1102 | called ssv_dnp. |
1096 | 1103 | ||
1097 | config COMEDI_MITE | 1104 | config COMEDI_MITE |
1105 | depends on HAS_DMA | ||
1098 | tristate | 1106 | tristate |
1099 | 1107 | ||
1100 | config COMEDI_NI_TIOCMD | 1108 | config COMEDI_NI_TIOCMD |
1101 | tristate | 1109 | tristate |
1110 | depends on HAS_DMA | ||
1102 | select COMEDI_NI_TIO | 1111 | select COMEDI_NI_TIO |
1103 | select COMEDI_MITE | 1112 | select COMEDI_MITE |
1104 | 1113 | ||
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index ca709901fb3e..d4be0e68509b 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c | |||
@@ -51,10 +51,12 @@ static void __comedi_buf_free(struct comedi_device *dev, | |||
51 | clear_bit(PG_reserved, | 51 | clear_bit(PG_reserved, |
52 | &(virt_to_page(buf->virt_addr)->flags)); | 52 | &(virt_to_page(buf->virt_addr)->flags)); |
53 | if (s->async_dma_dir != DMA_NONE) { | 53 | if (s->async_dma_dir != DMA_NONE) { |
54 | #ifdef CONFIG_HAS_DMA | ||
54 | dma_free_coherent(dev->hw_dev, | 55 | dma_free_coherent(dev->hw_dev, |
55 | PAGE_SIZE, | 56 | PAGE_SIZE, |
56 | buf->virt_addr, | 57 | buf->virt_addr, |
57 | buf->dma_addr); | 58 | buf->dma_addr); |
59 | #endif | ||
58 | } else { | 60 | } else { |
59 | free_page((unsigned long)buf->virt_addr); | 61 | free_page((unsigned long)buf->virt_addr); |
60 | } | 62 | } |
@@ -74,6 +76,12 @@ static void __comedi_buf_alloc(struct comedi_device *dev, | |||
74 | struct comedi_buf_page *buf; | 76 | struct comedi_buf_page *buf; |
75 | unsigned i; | 77 | unsigned i; |
76 | 78 | ||
79 | if (!IS_ENABLED(CONFIG_HAS_DMA) && s->async_dma_dir != DMA_NONE) { | ||
80 | dev_err(dev->class_dev, | ||
81 | "dma buffer allocation not supported\n"); | ||
82 | return; | ||
83 | } | ||
84 | |||
77 | async->buf_page_list = vzalloc(sizeof(*buf) * n_pages); | 85 | async->buf_page_list = vzalloc(sizeof(*buf) * n_pages); |
78 | if (async->buf_page_list) | 86 | if (async->buf_page_list) |
79 | pages = vmalloc(sizeof(struct page *) * n_pages); | 87 | pages = vmalloc(sizeof(struct page *) * n_pages); |
@@ -84,11 +92,15 @@ static void __comedi_buf_alloc(struct comedi_device *dev, | |||
84 | for (i = 0; i < n_pages; i++) { | 92 | for (i = 0; i < n_pages; i++) { |
85 | buf = &async->buf_page_list[i]; | 93 | buf = &async->buf_page_list[i]; |
86 | if (s->async_dma_dir != DMA_NONE) | 94 | if (s->async_dma_dir != DMA_NONE) |
95 | #ifdef CONFIG_HAS_DMA | ||
87 | buf->virt_addr = dma_alloc_coherent(dev->hw_dev, | 96 | buf->virt_addr = dma_alloc_coherent(dev->hw_dev, |
88 | PAGE_SIZE, | 97 | PAGE_SIZE, |
89 | &buf->dma_addr, | 98 | &buf->dma_addr, |
90 | GFP_KERNEL | | 99 | GFP_KERNEL | |
91 | __GFP_COMP); | 100 | __GFP_COMP); |
101 | #else | ||
102 | break; | ||
103 | #endif | ||
92 | else | 104 | else |
93 | buf->virt_addr = (void *)get_zeroed_page(GFP_KERNEL); | 105 | buf->virt_addr = (void *)get_zeroed_page(GFP_KERNEL); |
94 | if (!buf->virt_addr) | 106 | if (!buf->virt_addr) |
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 00f2547024ec..924c54c9c31f 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c | |||
@@ -246,9 +246,6 @@ static int resize_async_buffer(struct comedi_device *dev, | |||
246 | return -EBUSY; | 246 | return -EBUSY; |
247 | } | 247 | } |
248 | 248 | ||
249 | if (!async->prealloc_buf) | ||
250 | return -EINVAL; | ||
251 | |||
252 | /* make sure buffer is an integral number of pages | 249 | /* make sure buffer is an integral number of pages |
253 | * (we round up) */ | 250 | * (we round up) */ |
254 | new_size = (new_size + PAGE_SIZE - 1) & PAGE_MASK; | 251 | new_size = (new_size + PAGE_SIZE - 1) & PAGE_MASK; |
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 3d978f34d212..77a7bb632580 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c | |||
@@ -976,8 +976,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) | |||
976 | /* clear flip-flop to make sure 2-byte registers for | 976 | /* clear flip-flop to make sure 2-byte registers for |
977 | * count and address get set correctly */ | 977 | * count and address get set correctly */ |
978 | clear_dma_ff(devpriv->dma_chan); | 978 | clear_dma_ff(devpriv->dma_chan); |
979 | set_dma_addr(devpriv->dma_chan, | 979 | set_dma_addr(devpriv->dma_chan, devpriv->dma_addr); |
980 | virt_to_bus(devpriv->dma_buffer)); | ||
981 | /* set appropriate size of transfer */ | 980 | /* set appropriate size of transfer */ |
982 | devpriv->dma_transfer_size = labpc_suggest_transfer_size(cmd); | 981 | devpriv->dma_transfer_size = labpc_suggest_transfer_size(cmd); |
983 | if (cmd->stop_src == TRIG_COUNT && | 982 | if (cmd->stop_src == TRIG_COUNT && |
@@ -1089,7 +1088,7 @@ static void labpc_drain_dma(struct comedi_device *dev) | |||
1089 | devpriv->count -= num_points; | 1088 | devpriv->count -= num_points; |
1090 | 1089 | ||
1091 | /* set address and count for next transfer */ | 1090 | /* set address and count for next transfer */ |
1092 | set_dma_addr(devpriv->dma_chan, virt_to_bus(devpriv->dma_buffer)); | 1091 | set_dma_addr(devpriv->dma_chan, devpriv->dma_addr); |
1093 | set_dma_count(devpriv->dma_chan, leftover * sample_size); | 1092 | set_dma_count(devpriv->dma_chan, leftover * sample_size); |
1094 | release_dma_lock(flags); | 1093 | release_dma_lock(flags); |
1095 | 1094 | ||
@@ -1741,6 +1740,9 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
1741 | unsigned long dma_flags; | 1740 | unsigned long dma_flags; |
1742 | 1741 | ||
1743 | devpriv->dma_chan = dma_chan; | 1742 | devpriv->dma_chan = dma_chan; |
1743 | devpriv->dma_addr = | ||
1744 | virt_to_bus(devpriv->dma_buffer); | ||
1745 | |||
1744 | dma_flags = claim_dma_lock(); | 1746 | dma_flags = claim_dma_lock(); |
1745 | disable_dma(devpriv->dma_chan); | 1747 | disable_dma(devpriv->dma_chan); |
1746 | set_dma_mode(devpriv->dma_chan, DMA_MODE_READ); | 1748 | set_dma_mode(devpriv->dma_chan, DMA_MODE_READ); |
diff --git a/drivers/staging/comedi/drivers/ni_labpc.h b/drivers/staging/comedi/drivers/ni_labpc.h index 615f16f271c0..4b691f5a9965 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.h +++ b/drivers/staging/comedi/drivers/ni_labpc.h | |||
@@ -82,6 +82,7 @@ struct labpc_private { | |||
82 | unsigned int divisor_b1; | 82 | unsigned int divisor_b1; |
83 | unsigned int dma_chan; /* dma channel to use */ | 83 | unsigned int dma_chan; /* dma channel to use */ |
84 | u16 *dma_buffer; /* buffer ai will dma into */ | 84 | u16 *dma_buffer; /* buffer ai will dma into */ |
85 | phys_addr_t dma_addr; | ||
85 | /* transfer size in bytes for current transfer */ | 86 | /* transfer size in bytes for current transfer */ |
86 | unsigned int dma_transfer_size; | 87 | unsigned int dma_transfer_size; |
87 | /* we are using dma/fifo-half-full/etc. */ | 88 | /* we are using dma/fifo-half-full/etc. */ |
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index a46d579016d9..8c5dee9b3b05 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c | |||
@@ -310,9 +310,11 @@ static int ni_gpct_insn_read(struct comedi_device *dev, | |||
310 | static int ni_gpct_insn_config(struct comedi_device *dev, | 310 | static int ni_gpct_insn_config(struct comedi_device *dev, |
311 | struct comedi_subdevice *s, | 311 | struct comedi_subdevice *s, |
312 | struct comedi_insn *insn, unsigned int *data); | 312 | struct comedi_insn *insn, unsigned int *data); |
313 | #ifdef PCIDMA | ||
313 | static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s); | 314 | static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s); |
314 | static int ni_gpct_cmdtest(struct comedi_device *dev, | 315 | static int ni_gpct_cmdtest(struct comedi_device *dev, |
315 | struct comedi_subdevice *s, struct comedi_cmd *cmd); | 316 | struct comedi_subdevice *s, struct comedi_cmd *cmd); |
317 | #endif | ||
316 | static int ni_gpct_cancel(struct comedi_device *dev, | 318 | static int ni_gpct_cancel(struct comedi_device *dev, |
317 | struct comedi_subdevice *s); | 319 | struct comedi_subdevice *s); |
318 | static void handle_gpct_interrupt(struct comedi_device *dev, | 320 | static void handle_gpct_interrupt(struct comedi_device *dev, |
@@ -4617,9 +4619,7 @@ static int ni_E_init(struct comedi_device *dev) | |||
4617 | for (j = 0; j < NUM_GPCT; ++j) { | 4619 | for (j = 0; j < NUM_GPCT; ++j) { |
4618 | s = &dev->subdevices[NI_GPCT_SUBDEV(j)]; | 4620 | s = &dev->subdevices[NI_GPCT_SUBDEV(j)]; |
4619 | s->type = COMEDI_SUBD_COUNTER; | 4621 | s->type = COMEDI_SUBD_COUNTER; |
4620 | s->subdev_flags = | 4622 | s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; |
4621 | SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_CMD_READ | ||
4622 | /* | SDF_CMD_WRITE */ ; | ||
4623 | s->n_chan = 3; | 4623 | s->n_chan = 3; |
4624 | if (board->reg_type & ni_reg_m_series_mask) | 4624 | if (board->reg_type & ni_reg_m_series_mask) |
4625 | s->maxdata = 0xffffffff; | 4625 | s->maxdata = 0xffffffff; |
@@ -4628,11 +4628,14 @@ static int ni_E_init(struct comedi_device *dev) | |||
4628 | s->insn_read = &ni_gpct_insn_read; | 4628 | s->insn_read = &ni_gpct_insn_read; |
4629 | s->insn_write = &ni_gpct_insn_write; | 4629 | s->insn_write = &ni_gpct_insn_write; |
4630 | s->insn_config = &ni_gpct_insn_config; | 4630 | s->insn_config = &ni_gpct_insn_config; |
4631 | #ifdef PCIDMA | ||
4632 | s->subdev_flags |= SDF_CMD_READ /* | SDF_CMD_WRITE */; | ||
4631 | s->do_cmd = &ni_gpct_cmd; | 4633 | s->do_cmd = &ni_gpct_cmd; |
4632 | s->len_chanlist = 1; | 4634 | s->len_chanlist = 1; |
4633 | s->do_cmdtest = &ni_gpct_cmdtest; | 4635 | s->do_cmdtest = &ni_gpct_cmdtest; |
4634 | s->cancel = &ni_gpct_cancel; | 4636 | s->cancel = &ni_gpct_cancel; |
4635 | s->async_dma_dir = DMA_BIDIRECTIONAL; | 4637 | s->async_dma_dir = DMA_BIDIRECTIONAL; |
4638 | #endif | ||
4636 | s->private = &devpriv->counter_dev->counters[j]; | 4639 | s->private = &devpriv->counter_dev->counters[j]; |
4637 | 4640 | ||
4638 | devpriv->counter_dev->counters[j].chip_index = 0; | 4641 | devpriv->counter_dev->counters[j].chip_index = 0; |
@@ -5216,10 +5219,10 @@ static int ni_gpct_insn_write(struct comedi_device *dev, | |||
5216 | return ni_tio_winsn(counter, insn, data); | 5219 | return ni_tio_winsn(counter, insn, data); |
5217 | } | 5220 | } |
5218 | 5221 | ||
5222 | #ifdef PCIDMA | ||
5219 | static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s) | 5223 | static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s) |
5220 | { | 5224 | { |
5221 | int retval; | 5225 | int retval; |
5222 | #ifdef PCIDMA | ||
5223 | struct ni_gpct *counter = s->private; | 5226 | struct ni_gpct *counter = s->private; |
5224 | /* const struct comedi_cmd *cmd = &s->async->cmd; */ | 5227 | /* const struct comedi_cmd *cmd = &s->async->cmd; */ |
5225 | 5228 | ||
@@ -5233,23 +5236,20 @@ static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s) | |||
5233 | ni_tio_acknowledge_and_confirm(counter, NULL, NULL, NULL, NULL); | 5236 | ni_tio_acknowledge_and_confirm(counter, NULL, NULL, NULL, NULL); |
5234 | ni_e_series_enable_second_irq(dev, counter->counter_index, 1); | 5237 | ni_e_series_enable_second_irq(dev, counter->counter_index, 1); |
5235 | retval = ni_tio_cmd(counter, s->async); | 5238 | retval = ni_tio_cmd(counter, s->async); |
5236 | #else | ||
5237 | retval = -ENOTSUPP; | ||
5238 | #endif | ||
5239 | return retval; | 5239 | return retval; |
5240 | } | 5240 | } |
5241 | #endif | ||
5241 | 5242 | ||
5243 | #ifdef PCIDMA | ||
5242 | static int ni_gpct_cmdtest(struct comedi_device *dev, | 5244 | static int ni_gpct_cmdtest(struct comedi_device *dev, |
5243 | struct comedi_subdevice *s, struct comedi_cmd *cmd) | 5245 | struct comedi_subdevice *s, struct comedi_cmd *cmd) |
5244 | { | 5246 | { |
5245 | #ifdef PCIDMA | ||
5246 | struct ni_gpct *counter = s->private; | 5247 | struct ni_gpct *counter = s->private; |
5247 | 5248 | ||
5248 | return ni_tio_cmdtest(counter, cmd); | 5249 | return ni_tio_cmdtest(counter, cmd); |
5249 | #else | ||
5250 | return -ENOTSUPP; | 5250 | return -ENOTSUPP; |
5251 | #endif | ||
5252 | } | 5251 | } |
5252 | #endif | ||
5253 | 5253 | ||
5254 | static int ni_gpct_cancel(struct comedi_device *dev, struct comedi_subdevice *s) | 5254 | static int ni_gpct_cancel(struct comedi_device *dev, struct comedi_subdevice *s) |
5255 | { | 5255 | { |
diff --git a/drivers/staging/dwc2/Kconfig b/drivers/staging/dwc2/Kconfig index f0b4739c65a1..d15d9d58e5ac 100644 --- a/drivers/staging/dwc2/Kconfig +++ b/drivers/staging/dwc2/Kconfig | |||
@@ -2,7 +2,6 @@ config USB_DWC2 | |||
2 | tristate "DesignWare USB2 DRD Core Support" | 2 | tristate "DesignWare USB2 DRD Core Support" |
3 | depends on USB | 3 | depends on USB |
4 | depends on VIRT_TO_BUS | 4 | depends on VIRT_TO_BUS |
5 | select USB_OTG_UTILS | ||
6 | help | 5 | help |
7 | Say Y or M here if your system has a Dual Role HighSpeed | 6 | Say Y or M here if your system has a Dual Role HighSpeed |
8 | USB controller based on the DesignWare HSOTG IP Core. | 7 | USB controller based on the DesignWare HSOTG IP Core. |
@@ -39,6 +38,7 @@ config USB_DWC2_TRACK_MISSED_SOFS | |||
39 | bool "Enable Missed SOF Tracking" | 38 | bool "Enable Missed SOF Tracking" |
40 | help | 39 | help |
41 | Say Y here to enable logging of missed SOF events to the dmesg log. | 40 | Say Y here to enable logging of missed SOF events to the dmesg log. |
41 | WARNING: This feature is still experimental. | ||
42 | If in doubt, say N. | 42 | If in doubt, say N. |
43 | 43 | ||
44 | config USB_DWC2_DEBUG_PERIODIC | 44 | config USB_DWC2_DEBUG_PERIODIC |
diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c index 827ab781ae9b..8551ccedf037 100644 --- a/drivers/staging/dwc2/hcd.c +++ b/drivers/staging/dwc2/hcd.c | |||
@@ -2804,9 +2804,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, | |||
2804 | 2804 | ||
2805 | /* Set device flags indicating whether the HCD supports DMA */ | 2805 | /* Set device flags indicating whether the HCD supports DMA */ |
2806 | if (hsotg->core_params->dma_enable > 0) { | 2806 | if (hsotg->core_params->dma_enable > 0) { |
2807 | if (dma_set_mask(hsotg->dev, DMA_BIT_MASK(31)) < 0) | 2807 | if (dma_set_mask(hsotg->dev, DMA_BIT_MASK(32)) < 0) |
2808 | dev_warn(hsotg->dev, | 2808 | dev_warn(hsotg->dev, "can't set DMA mask\n"); |
2809 | "can't enable workaround for >2GB RAM\n"); | ||
2810 | if (dma_set_coherent_mask(hsotg->dev, DMA_BIT_MASK(31)) < 0) | 2809 | if (dma_set_coherent_mask(hsotg->dev, DMA_BIT_MASK(31)) < 0) |
2811 | dev_warn(hsotg->dev, | 2810 | dev_warn(hsotg->dev, |
2812 | "can't enable workaround for >2GB RAM\n"); | 2811 | "can't enable workaround for >2GB RAM\n"); |
diff --git a/drivers/staging/dwc2/hcd_intr.c b/drivers/staging/dwc2/hcd_intr.c index 6e5dbed6ccec..e24062f0a49e 100644 --- a/drivers/staging/dwc2/hcd_intr.c +++ b/drivers/staging/dwc2/hcd_intr.c | |||
@@ -56,8 +56,6 @@ | |||
56 | static void dwc2_track_missed_sofs(struct dwc2_hsotg *hsotg) | 56 | static void dwc2_track_missed_sofs(struct dwc2_hsotg *hsotg) |
57 | { | 57 | { |
58 | #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS | 58 | #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS |
59 | #warning Compiling code to track missed SOFs | ||
60 | |||
61 | u16 curr_frame_number = hsotg->frame_number; | 59 | u16 curr_frame_number = hsotg->frame_number; |
62 | 60 | ||
63 | if (hsotg->frame_num_idx < FRAME_NUM_ARRAY_SIZE) { | 61 | if (hsotg->frame_num_idx < FRAME_NUM_ARRAY_SIZE) { |
diff --git a/drivers/staging/dwc2/platform.c b/drivers/staging/dwc2/platform.c index 1f3d581a1078..44cce2fa6361 100644 --- a/drivers/staging/dwc2/platform.c +++ b/drivers/staging/dwc2/platform.c | |||
@@ -95,6 +95,14 @@ static int dwc2_driver_probe(struct platform_device *dev) | |||
95 | 95 | ||
96 | hsotg->dev = &dev->dev; | 96 | hsotg->dev = &dev->dev; |
97 | 97 | ||
98 | /* | ||
99 | * Use reasonable defaults so platforms don't have to provide these. | ||
100 | */ | ||
101 | if (!dev->dev.dma_mask) | ||
102 | dev->dev.dma_mask = &dev->dev.coherent_dma_mask; | ||
103 | if (!dev->dev.coherent_dma_mask) | ||
104 | dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
105 | |||
98 | irq = platform_get_irq(dev, 0); | 106 | irq = platform_get_irq(dev, 0); |
99 | if (irq < 0) { | 107 | if (irq < 0) { |
100 | dev_err(&dev->dev, "missing IRQ resource\n"); | 108 | dev_err(&dev->dev, "missing IRQ resource\n"); |
@@ -102,11 +110,6 @@ static int dwc2_driver_probe(struct platform_device *dev) | |||
102 | } | 110 | } |
103 | 111 | ||
104 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | 112 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
105 | if (!res) { | ||
106 | dev_err(&dev->dev, "missing memory base resource\n"); | ||
107 | return -EINVAL; | ||
108 | } | ||
109 | |||
110 | hsotg->regs = devm_ioremap_resource(&dev->dev, res); | 113 | hsotg->regs = devm_ioremap_resource(&dev->dev, res); |
111 | if (IS_ERR(hsotg->regs)) | 114 | if (IS_ERR(hsotg->regs)) |
112 | return PTR_ERR(hsotg->regs); | 115 | return PTR_ERR(hsotg->regs); |
diff --git a/drivers/staging/gdm72xx/Kconfig b/drivers/staging/gdm72xx/Kconfig index 3c18efe31365..69059138de4a 100644 --- a/drivers/staging/gdm72xx/Kconfig +++ b/drivers/staging/gdm72xx/Kconfig | |||
@@ -39,7 +39,7 @@ if WIMAX_GDM72XX_USB | |||
39 | 39 | ||
40 | config WIMAX_GDM72XX_USB_PM | 40 | config WIMAX_GDM72XX_USB_PM |
41 | bool "Enable power managerment support" | 41 | bool "Enable power managerment support" |
42 | depends on USB_SUSPEND | 42 | depends on PM_RUNTIME |
43 | 43 | ||
44 | endif # WIMAX_GDM72XX_USB | 44 | endif # WIMAX_GDM72XX_USB |
45 | 45 | ||
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 2856b8fd44ad..163c638e4095 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -690,7 +690,6 @@ static void mxs_lradc_trigger_remove(struct iio_dev *iio) | |||
690 | static int mxs_lradc_buffer_preenable(struct iio_dev *iio) | 690 | static int mxs_lradc_buffer_preenable(struct iio_dev *iio) |
691 | { | 691 | { |
692 | struct mxs_lradc *lradc = iio_priv(iio); | 692 | struct mxs_lradc *lradc = iio_priv(iio); |
693 | struct iio_buffer *buffer = iio->buffer; | ||
694 | int ret = 0, chan, ofs = 0; | 693 | int ret = 0, chan, ofs = 0; |
695 | unsigned long enable = 0; | 694 | unsigned long enable = 0; |
696 | uint32_t ctrl4_set = 0; | 695 | uint32_t ctrl4_set = 0; |
@@ -698,7 +697,7 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio) | |||
698 | uint32_t ctrl1_irq = 0; | 697 | uint32_t ctrl1_irq = 0; |
699 | const uint32_t chan_value = LRADC_CH_ACCUMULATE | | 698 | const uint32_t chan_value = LRADC_CH_ACCUMULATE | |
700 | ((LRADC_DELAY_TIMER_LOOP - 1) << LRADC_CH_NUM_SAMPLES_OFFSET); | 699 | ((LRADC_DELAY_TIMER_LOOP - 1) << LRADC_CH_NUM_SAMPLES_OFFSET); |
701 | const int len = bitmap_weight(buffer->scan_mask, LRADC_MAX_TOTAL_CHANS); | 700 | const int len = bitmap_weight(iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS); |
702 | 701 | ||
703 | if (!len) | 702 | if (!len) |
704 | return -EINVAL; | 703 | return -EINVAL; |
@@ -725,7 +724,7 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio) | |||
725 | lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR); | 724 | lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR); |
726 | writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR); | 725 | writel(0xff, lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR); |
727 | 726 | ||
728 | for_each_set_bit(chan, buffer->scan_mask, LRADC_MAX_TOTAL_CHANS) { | 727 | for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) { |
729 | ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs); | 728 | ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs); |
730 | ctrl4_clr |= LRADC_CTRL4_LRADCSELECT_MASK(ofs); | 729 | ctrl4_clr |= LRADC_CTRL4_LRADCSELECT_MASK(ofs); |
731 | ctrl1_irq |= LRADC_CTRL1_LRADC_IRQ_EN(ofs); | 730 | ctrl1_irq |= LRADC_CTRL1_LRADC_IRQ_EN(ofs); |
diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index d060f2572512..c99f890cc6c6 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c | |||
@@ -1869,6 +1869,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp, | |||
1869 | dev_info(&chip->client->dev, | 1869 | dev_info(&chip->client->dev, |
1870 | "%s: i2c device found does not match expected id\n", | 1870 | "%s: i2c device found does not match expected id\n", |
1871 | __func__); | 1871 | __func__); |
1872 | ret = -EINVAL; | ||
1872 | goto fail1; | 1873 | goto fail1; |
1873 | } | 1874 | } |
1874 | 1875 | ||
@@ -1907,7 +1908,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp, | |||
1907 | if (ret) { | 1908 | if (ret) { |
1908 | dev_err(&clientp->dev, | 1909 | dev_err(&clientp->dev, |
1909 | "%s: irq request failed", __func__); | 1910 | "%s: irq request failed", __func__); |
1910 | goto fail2; | 1911 | goto fail1; |
1911 | } | 1912 | } |
1912 | } | 1913 | } |
1913 | 1914 | ||
@@ -1920,17 +1921,17 @@ static int tsl2x7x_probe(struct i2c_client *clientp, | |||
1920 | if (ret) { | 1921 | if (ret) { |
1921 | dev_err(&clientp->dev, | 1922 | dev_err(&clientp->dev, |
1922 | "%s: iio registration failed\n", __func__); | 1923 | "%s: iio registration failed\n", __func__); |
1923 | goto fail1; | 1924 | goto fail2; |
1924 | } | 1925 | } |
1925 | 1926 | ||
1926 | dev_info(&clientp->dev, "%s Light sensor found.\n", id->name); | 1927 | dev_info(&clientp->dev, "%s Light sensor found.\n", id->name); |
1927 | 1928 | ||
1928 | return 0; | 1929 | return 0; |
1929 | 1930 | ||
1930 | fail1: | 1931 | fail2: |
1931 | if (clientp->irq) | 1932 | if (clientp->irq) |
1932 | free_irq(clientp->irq, indio_dev); | 1933 | free_irq(clientp->irq, indio_dev); |
1933 | fail2: | 1934 | fail1: |
1934 | iio_device_free(indio_dev); | 1935 | iio_device_free(indio_dev); |
1935 | 1936 | ||
1936 | return ret; | 1937 | return ret; |
diff --git a/drivers/staging/imx-drm/Kconfig b/drivers/staging/imx-drm/Kconfig index 8c9e40390f42..ef699f753186 100644 --- a/drivers/staging/imx-drm/Kconfig +++ b/drivers/staging/imx-drm/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config DRM_IMX | 1 | config DRM_IMX |
2 | tristate "DRM Support for Freescale i.MX" | 2 | tristate "DRM Support for Freescale i.MX" |
3 | select DRM_KMS_HELPER | 3 | select DRM_KMS_HELPER |
4 | select VIDEOMODE_HELPERS | ||
4 | select DRM_GEM_CMA_HELPER | 5 | select DRM_GEM_CMA_HELPER |
5 | select DRM_KMS_CMA_HELPER | 6 | select DRM_KMS_CMA_HELPER |
6 | depends on DRM && (ARCH_MXC || ARCH_MULTIPLATFORM) | 7 | depends on DRM && (ARCH_MXC || ARCH_MULTIPLATFORM) |
@@ -19,10 +20,12 @@ config DRM_IMX_FB_HELPER | |||
19 | config DRM_IMX_PARALLEL_DISPLAY | 20 | config DRM_IMX_PARALLEL_DISPLAY |
20 | tristate "Support for parallel displays" | 21 | tristate "Support for parallel displays" |
21 | depends on DRM_IMX | 22 | depends on DRM_IMX |
23 | select VIDEOMODE_HELPERS | ||
22 | 24 | ||
23 | config DRM_IMX_TVE | 25 | config DRM_IMX_TVE |
24 | tristate "Support for TV and VGA displays" | 26 | tristate "Support for TV and VGA displays" |
25 | depends on DRM_IMX | 27 | depends on DRM_IMX |
28 | select REGMAP_MMIO | ||
26 | help | 29 | help |
27 | Choose this to enable the internal Television Encoder (TVe) | 30 | Choose this to enable the internal Television Encoder (TVe) |
28 | found on i.MX53 processors. | 31 | found on i.MX53 processors. |
@@ -30,6 +33,7 @@ config DRM_IMX_TVE | |||
30 | config DRM_IMX_IPUV3_CORE | 33 | config DRM_IMX_IPUV3_CORE |
31 | tristate "IPUv3 core support" | 34 | tristate "IPUv3 core support" |
32 | depends on DRM_IMX | 35 | depends on DRM_IMX |
36 | depends on RESET_CONTROLLER | ||
33 | help | 37 | help |
34 | Choose this if you have a i.MX5/6 system and want | 38 | Choose this if you have a i.MX5/6 system and want |
35 | to use the IPU. This option only enables IPU base | 39 | to use the IPU. This option only enables IPU base |
@@ -38,5 +42,6 @@ config DRM_IMX_IPUV3_CORE | |||
38 | config DRM_IMX_IPUV3 | 42 | config DRM_IMX_IPUV3 |
39 | tristate "DRM Support for i.MX IPUv3" | 43 | tristate "DRM Support for i.MX IPUv3" |
40 | depends on DRM_IMX | 44 | depends on DRM_IMX |
45 | depends on DRM_IMX_IPUV3_CORE | ||
41 | help | 46 | help |
42 | Choose this if you have a i.MX5 or i.MX6 processor. | 47 | Choose this if you have a i.MX5 or i.MX6 processor. |
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c index ac1634464407..03892de9bd7e 100644 --- a/drivers/staging/imx-drm/imx-tve.c +++ b/drivers/staging/imx-drm/imx-tve.c | |||
@@ -670,7 +670,9 @@ static int imx_tve_probe(struct platform_device *pdev) | |||
670 | tve->dac_reg = devm_regulator_get(&pdev->dev, "dac"); | 670 | tve->dac_reg = devm_regulator_get(&pdev->dev, "dac"); |
671 | if (!IS_ERR(tve->dac_reg)) { | 671 | if (!IS_ERR(tve->dac_reg)) { |
672 | regulator_set_voltage(tve->dac_reg, 2750000, 2750000); | 672 | regulator_set_voltage(tve->dac_reg, 2750000, 2750000); |
673 | regulator_enable(tve->dac_reg); | 673 | ret = regulator_enable(tve->dac_reg); |
674 | if (ret) | ||
675 | return ret; | ||
674 | } | 676 | } |
675 | 677 | ||
676 | tve->clk = devm_clk_get(&pdev->dev, "tve"); | 678 | tve->clk = devm_clk_get(&pdev->dev, "tve"); |
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index ea61c869110f..ff5c63350932 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c | |||
@@ -316,31 +316,14 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc, | |||
316 | 316 | ||
317 | static void ipu_crtc_handle_pageflip(struct ipu_crtc *ipu_crtc) | 317 | static void ipu_crtc_handle_pageflip(struct ipu_crtc *ipu_crtc) |
318 | { | 318 | { |
319 | struct drm_pending_vblank_event *e; | ||
320 | struct timeval now; | ||
321 | unsigned long flags; | 319 | unsigned long flags; |
322 | struct drm_device *drm = ipu_crtc->base.dev; | 320 | struct drm_device *drm = ipu_crtc->base.dev; |
323 | 321 | ||
324 | spin_lock_irqsave(&drm->event_lock, flags); | 322 | spin_lock_irqsave(&drm->event_lock, flags); |
325 | 323 | if (ipu_crtc->page_flip_event) | |
326 | e = ipu_crtc->page_flip_event; | 324 | drm_send_vblank_event(drm, -1, ipu_crtc->page_flip_event); |
327 | if (!e) { | ||
328 | spin_unlock_irqrestore(&drm->event_lock, flags); | ||
329 | return; | ||
330 | } | ||
331 | |||
332 | do_gettimeofday(&now); | ||
333 | e->event.sequence = 0; | ||
334 | e->event.tv_sec = now.tv_sec; | ||
335 | e->event.tv_usec = now.tv_usec; | ||
336 | ipu_crtc->page_flip_event = NULL; | 325 | ipu_crtc->page_flip_event = NULL; |
337 | |||
338 | imx_drm_crtc_vblank_put(ipu_crtc->imx_crtc); | 326 | imx_drm_crtc_vblank_put(ipu_crtc->imx_crtc); |
339 | |||
340 | list_add_tail(&e->base.link, &e->base.file_priv->event_list); | ||
341 | |||
342 | wake_up_interruptible(&e->base.file_priv->event_wait); | ||
343 | |||
344 | spin_unlock_irqrestore(&drm->event_lock, flags); | 327 | spin_unlock_irqrestore(&drm->event_lock, flags); |
345 | } | 328 | } |
346 | 329 | ||
diff --git a/drivers/staging/media/davinci_vpfe/Kconfig b/drivers/staging/media/davinci_vpfe/Kconfig index 2e4a28b018e8..12f321dd2399 100644 --- a/drivers/staging/media/davinci_vpfe/Kconfig +++ b/drivers/staging/media/davinci_vpfe/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_DM365_VPFE | 1 | config VIDEO_DM365_VPFE |
2 | tristate "DM365 VPFE Media Controller Capture Driver" | 2 | tristate "DM365 VPFE Media Controller Capture Driver" |
3 | depends on VIDEO_V4L2 && ARCH_DAVINCI_DM365 && !VIDEO_VPFE_CAPTURE | 3 | depends on VIDEO_V4L2 && ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF |
4 | select VIDEOBUF2_DMA_CONTIG | 4 | select VIDEOBUF2_DMA_CONTIG |
5 | help | 5 | help |
6 | Support for DM365 VPFE based Media Controller Capture driver. | 6 | Support for DM365 VPFE based Media Controller Capture driver. |
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c index b88e1ddce229..d8ce20d2fbda 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | |||
@@ -639,7 +639,8 @@ static int vpfe_probe(struct platform_device *pdev) | |||
639 | if (ret) | 639 | if (ret) |
640 | goto probe_free_dev_mem; | 640 | goto probe_free_dev_mem; |
641 | 641 | ||
642 | if (vpfe_initialize_modules(vpfe_dev, pdev)) | 642 | ret = vpfe_initialize_modules(vpfe_dev, pdev); |
643 | if (ret) | ||
643 | goto probe_disable_clock; | 644 | goto probe_disable_clock; |
644 | 645 | ||
645 | vpfe_dev->media_dev.dev = vpfe_dev->pdev; | 646 | vpfe_dev->media_dev.dev = vpfe_dev->pdev; |
@@ -663,7 +664,8 @@ static int vpfe_probe(struct platform_device *pdev) | |||
663 | /* set the driver data in platform device */ | 664 | /* set the driver data in platform device */ |
664 | platform_set_drvdata(pdev, vpfe_dev); | 665 | platform_set_drvdata(pdev, vpfe_dev); |
665 | /* register subdevs/entities */ | 666 | /* register subdevs/entities */ |
666 | if (vpfe_register_entities(vpfe_dev)) | 667 | ret = vpfe_register_entities(vpfe_dev); |
668 | if (ret) | ||
667 | goto probe_out_v4l2_unregister; | 669 | goto probe_out_v4l2_unregister; |
668 | 670 | ||
669 | ret = vpfe_attach_irq(vpfe_dev); | 671 | ret = vpfe_attach_irq(vpfe_dev); |
diff --git a/drivers/staging/media/solo6x10/Kconfig b/drivers/staging/media/solo6x10/Kconfig index ec32776ff547..34f3b6d02d2a 100644 --- a/drivers/staging/media/solo6x10/Kconfig +++ b/drivers/staging/media/solo6x10/Kconfig | |||
@@ -1,9 +1,11 @@ | |||
1 | config SOLO6X10 | 1 | config SOLO6X10 |
2 | tristate "Softlogic 6x10 MPEG codec cards" | 2 | tristate "Softlogic 6x10 MPEG codec cards" |
3 | depends on PCI && VIDEO_DEV && SND && I2C | 3 | depends on PCI && VIDEO_DEV && SND && I2C |
4 | depends on FONTS | ||
4 | select VIDEOBUF2_DMA_SG | 5 | select VIDEOBUF2_DMA_SG |
5 | select VIDEOBUF2_DMA_CONTIG | 6 | select VIDEOBUF2_DMA_CONTIG |
6 | select SND_PCM | 7 | select SND_PCM |
8 | select FONT_8x16 | ||
7 | ---help--- | 9 | ---help--- |
8 | This driver supports the Softlogic based MPEG-4 and h.264 codec | 10 | This driver supports the Softlogic based MPEG-4 and h.264 codec |
9 | cards. | 11 | cards. |
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index a88959f9a07a..197c393c4ca7 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c | |||
@@ -124,6 +124,20 @@ int nvec_register_notifier(struct nvec_chip *nvec, struct notifier_block *nb, | |||
124 | EXPORT_SYMBOL_GPL(nvec_register_notifier); | 124 | EXPORT_SYMBOL_GPL(nvec_register_notifier); |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * nvec_unregister_notifier - Unregister a notifier with nvec | ||
128 | * @nvec: A &struct nvec_chip | ||
129 | * @nb: The notifier block to unregister | ||
130 | * | ||
131 | * Unregisters a notifier with @nvec. The notifier will be removed from the | ||
132 | * atomic notifier chain. | ||
133 | */ | ||
134 | int nvec_unregister_notifier(struct nvec_chip *nvec, struct notifier_block *nb) | ||
135 | { | ||
136 | return atomic_notifier_chain_unregister(&nvec->notifier_list, nb); | ||
137 | } | ||
138 | EXPORT_SYMBOL_GPL(nvec_unregister_notifier); | ||
139 | |||
140 | /** | ||
127 | * nvec_status_notifier - The final notifier | 141 | * nvec_status_notifier - The final notifier |
128 | * | 142 | * |
129 | * Prints a message about control events not handled in the notifier | 143 | * Prints a message about control events not handled in the notifier |
@@ -185,7 +199,7 @@ static struct nvec_msg *nvec_msg_alloc(struct nvec_chip *nvec, | |||
185 | * | 199 | * |
186 | * Free the given message | 200 | * Free the given message |
187 | */ | 201 | */ |
188 | inline void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg) | 202 | void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg) |
189 | { | 203 | { |
190 | if (msg != &nvec->tx_scratch) | 204 | if (msg != &nvec->tx_scratch) |
191 | dev_vdbg(nvec->dev, "INFO: Free %ti\n", msg - nvec->msg_pool); | 205 | dev_vdbg(nvec->dev, "INFO: Free %ti\n", msg - nvec->msg_pool); |
@@ -800,11 +814,6 @@ static int tegra_nvec_probe(struct platform_device *pdev) | |||
800 | } | 814 | } |
801 | 815 | ||
802 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 816 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
803 | if (!res) { | ||
804 | dev_err(&pdev->dev, "no mem resource?\n"); | ||
805 | return -ENODEV; | ||
806 | } | ||
807 | |||
808 | base = devm_ioremap_resource(&pdev->dev, res); | 817 | base = devm_ioremap_resource(&pdev->dev, res); |
809 | if (IS_ERR(base)) | 818 | if (IS_ERR(base)) |
810 | return PTR_ERR(base); | 819 | return PTR_ERR(base); |
@@ -815,7 +824,7 @@ static int tegra_nvec_probe(struct platform_device *pdev) | |||
815 | return -ENODEV; | 824 | return -ENODEV; |
816 | } | 825 | } |
817 | 826 | ||
818 | i2c_clk = clk_get(&pdev->dev, "div-clk"); | 827 | i2c_clk = devm_clk_get(&pdev->dev, "div-clk"); |
819 | if (IS_ERR(i2c_clk)) { | 828 | if (IS_ERR(i2c_clk)) { |
820 | dev_err(nvec->dev, "failed to get controller clock\n"); | 829 | dev_err(nvec->dev, "failed to get controller clock\n"); |
821 | return -ENODEV; | 830 | return -ENODEV; |
@@ -902,8 +911,11 @@ static int tegra_nvec_remove(struct platform_device *pdev) | |||
902 | 911 | ||
903 | nvec_toggle_global_events(nvec, false); | 912 | nvec_toggle_global_events(nvec, false); |
904 | mfd_remove_devices(nvec->dev); | 913 | mfd_remove_devices(nvec->dev); |
914 | nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier); | ||
905 | cancel_work_sync(&nvec->rx_work); | 915 | cancel_work_sync(&nvec->rx_work); |
906 | cancel_work_sync(&nvec->tx_work); | 916 | cancel_work_sync(&nvec->tx_work); |
917 | /* FIXME: needs check wether nvec is responsible for power off */ | ||
918 | pm_power_off = NULL; | ||
907 | 919 | ||
908 | return 0; | 920 | return 0; |
909 | } | 921 | } |
diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h index b7a14bc0ab91..2b1316d87470 100644 --- a/drivers/staging/nvec/nvec.h +++ b/drivers/staging/nvec/nvec.h | |||
@@ -197,9 +197,8 @@ extern int nvec_register_notifier(struct nvec_chip *nvec, | |||
197 | struct notifier_block *nb, | 197 | struct notifier_block *nb, |
198 | unsigned int events); | 198 | unsigned int events); |
199 | 199 | ||
200 | extern int nvec_unregister_notifier(struct device *dev, | 200 | extern int nvec_unregister_notifier(struct nvec_chip *dev, |
201 | struct notifier_block *nb, | 201 | struct notifier_block *nb); |
202 | unsigned int events); | ||
203 | 202 | ||
204 | extern void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg); | 203 | extern void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg); |
205 | 204 | ||
diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c index 7445ce6422bb..a0ec52a4114f 100644 --- a/drivers/staging/nvec/nvec_kbd.c +++ b/drivers/staging/nvec/nvec_kbd.c | |||
@@ -169,8 +169,15 @@ fail: | |||
169 | 169 | ||
170 | static int nvec_kbd_remove(struct platform_device *pdev) | 170 | static int nvec_kbd_remove(struct platform_device *pdev) |
171 | { | 171 | { |
172 | struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); | ||
173 | char disable_kbd[] = { NVEC_KBD, DISABLE_KBD }, | ||
174 | uncnfg_wake_key_reporting[] = { NVEC_KBD, CNFG_WAKE_KEY_REPORTING, | ||
175 | false }; | ||
176 | nvec_write_async(nvec, uncnfg_wake_key_reporting, 3); | ||
177 | nvec_write_async(nvec, disable_kbd, 2); | ||
178 | nvec_unregister_notifier(nvec, &keys_dev.notifier); | ||
179 | |||
172 | input_unregister_device(keys_dev.input); | 180 | input_unregister_device(keys_dev.input); |
173 | input_free_device(keys_dev.input); | ||
174 | 181 | ||
175 | return 0; | 182 | return 0; |
176 | } | 183 | } |
@@ -188,4 +195,5 @@ module_platform_driver(nvec_kbd_driver); | |||
188 | 195 | ||
189 | MODULE_AUTHOR("Marc Dietrich <marvin24@gmx.de>"); | 196 | MODULE_AUTHOR("Marc Dietrich <marvin24@gmx.de>"); |
190 | MODULE_DESCRIPTION("NVEC keyboard driver"); | 197 | MODULE_DESCRIPTION("NVEC keyboard driver"); |
198 | MODULE_ALIAS("platform:nvec-kbd"); | ||
191 | MODULE_LICENSE("GPL"); | 199 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c index 296f7b9a8c8c..aacfcd6954a3 100644 --- a/drivers/staging/nvec/nvec_power.c +++ b/drivers/staging/nvec/nvec_power.c | |||
@@ -414,6 +414,7 @@ static int nvec_power_remove(struct platform_device *pdev) | |||
414 | struct nvec_power *power = platform_get_drvdata(pdev); | 414 | struct nvec_power *power = platform_get_drvdata(pdev); |
415 | 415 | ||
416 | cancel_delayed_work_sync(&power->poller); | 416 | cancel_delayed_work_sync(&power->poller); |
417 | nvec_unregister_notifier(power->nvec, &power->notifier); | ||
417 | switch (pdev->id) { | 418 | switch (pdev->id) { |
418 | case AC: | 419 | case AC: |
419 | power_supply_unregister(&nvec_psy); | 420 | power_supply_unregister(&nvec_psy); |
diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index aff6b9b9f9aa..06dbb02085a9 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c | |||
@@ -106,7 +106,7 @@ static int nvec_mouse_probe(struct platform_device *pdev) | |||
106 | struct serio *ser_dev; | 106 | struct serio *ser_dev; |
107 | char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 }; | 107 | char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 }; |
108 | 108 | ||
109 | ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL); | 109 | ser_dev = kzalloc(sizeof(struct serio), GFP_KERNEL); |
110 | if (ser_dev == NULL) | 110 | if (ser_dev == NULL) |
111 | return -ENOMEM; | 111 | return -ENOMEM; |
112 | 112 | ||
@@ -133,6 +133,11 @@ static int nvec_mouse_probe(struct platform_device *pdev) | |||
133 | 133 | ||
134 | static int nvec_mouse_remove(struct platform_device *pdev) | 134 | static int nvec_mouse_remove(struct platform_device *pdev) |
135 | { | 135 | { |
136 | struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); | ||
137 | |||
138 | ps2_sendcommand(ps2_dev.ser_dev, DISABLE_MOUSE); | ||
139 | ps2_stopstreaming(ps2_dev.ser_dev); | ||
140 | nvec_unregister_notifier(nvec, &ps2_dev.notifier); | ||
136 | serio_unregister_port(ps2_dev.ser_dev); | 141 | serio_unregister_port(ps2_dev.ser_dev); |
137 | 142 | ||
138 | return 0; | 143 | return 0; |
@@ -179,4 +184,5 @@ module_platform_driver(nvec_mouse_driver); | |||
179 | 184 | ||
180 | MODULE_DESCRIPTION("NVEC mouse driver"); | 185 | MODULE_DESCRIPTION("NVEC mouse driver"); |
181 | MODULE_AUTHOR("Marc Dietrich <marvin24@gmx.de>"); | 186 | MODULE_AUTHOR("Marc Dietrich <marvin24@gmx.de>"); |
187 | MODULE_ALIAS("platform:nvec-mouse"); | ||
182 | MODULE_LICENSE("GPL"); | 188 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/staging/sep/Kconfig b/drivers/staging/sep/Kconfig index 185b676d858a..aab945a316ea 100644 --- a/drivers/staging/sep/Kconfig +++ b/drivers/staging/sep/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DX_SEP | 1 | config DX_SEP |
2 | tristate "Discretix SEP driver" | 2 | tristate "Discretix SEP driver" |
3 | depends on PCI | 3 | depends on PCI && CRYPTO |
4 | help | 4 | help |
5 | Discretix SEP driver; used for the security processor subsystem | 5 | Discretix SEP driver; used for the security processor subsystem |
6 | on board the Intel Mobile Internet Device and adds SEP availability | 6 | on board the Intel Mobile Internet Device and adds SEP availability |
diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c index fe667dde43ce..386362c9964f 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | |||
@@ -1087,7 +1087,11 @@ static int synaptics_rmi4_resume(struct device *dev) | |||
1087 | unsigned char intr_status; | 1087 | unsigned char intr_status; |
1088 | struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); | 1088 | struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); |
1089 | 1089 | ||
1090 | regulator_enable(rmi4_data->regulator); | 1090 | retval = regulator_enable(rmi4_data->regulator); |
1091 | if (retval) { | ||
1092 | dev_err(dev, "Regulator enable failed (%d)\n", retval); | ||
1093 | return retval; | ||
1094 | } | ||
1091 | 1095 | ||
1092 | enable_irq(rmi4_data->i2c_client->irq); | 1096 | enable_irq(rmi4_data->i2c_client->irq); |
1093 | rmi4_data->touch_stopped = false; | 1097 | rmi4_data->touch_stopped = false; |
diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index f4f1bf7a30fd..c699a3058b39 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c | |||
@@ -133,7 +133,7 @@ static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked) | |||
133 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", | 133 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n", |
134 | pDevice->dev->name, pDevice->apdev->name); | 134 | pDevice->dev->name, pDevice->apdev->name); |
135 | } | 135 | } |
136 | kfree(pDevice->apdev); | 136 | free_netdev(pDevice->apdev); |
137 | pDevice->apdev = NULL; | 137 | pDevice->apdev = NULL; |
138 | pDevice->bEnable8021x = false; | 138 | pDevice->bEnable8021x = false; |
139 | pDevice->bEnableHostWEP = false; | 139 | pDevice->bEnableHostWEP = false; |
diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index c335808211ee..d0cf7d8a20e5 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c | |||
@@ -1345,9 +1345,12 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, | |||
1345 | return rc; | 1345 | return rc; |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | spin_lock_irq(&pDevice->lock); | ||
1349 | |||
1348 | if (wrq->disabled) { | 1350 | if (wrq->disabled) { |
1349 | pDevice->ePSMode = WMAC_POWER_CAM; | 1351 | pDevice->ePSMode = WMAC_POWER_CAM; |
1350 | PSvDisablePowerSaving(pDevice); | 1352 | PSvDisablePowerSaving(pDevice); |
1353 | spin_unlock_irq(&pDevice->lock); | ||
1351 | return rc; | 1354 | return rc; |
1352 | } | 1355 | } |
1353 | if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { | 1356 | if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { |
@@ -1358,6 +1361,9 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info, | |||
1358 | pDevice->ePSMode = WMAC_POWER_FAST; | 1361 | pDevice->ePSMode = WMAC_POWER_FAST; |
1359 | PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval); | 1362 | PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval); |
1360 | } | 1363 | } |
1364 | |||
1365 | spin_unlock_irq(&pDevice->lock); | ||
1366 | |||
1361 | switch (wrq->flags & IW_POWER_MODE) { | 1367 | switch (wrq->flags & IW_POWER_MODE) { |
1362 | case IW_POWER_UNICAST_R: | 1368 | case IW_POWER_UNICAST_R: |
1363 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n"); | 1369 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n"); |
diff --git a/drivers/staging/zcache/ramster.h b/drivers/staging/zcache/ramster.h index e1f91d5a0f6a..a858666eae68 100644 --- a/drivers/staging/zcache/ramster.h +++ b/drivers/staging/zcache/ramster.h | |||
@@ -11,10 +11,6 @@ | |||
11 | #ifndef _ZCACHE_RAMSTER_H_ | 11 | #ifndef _ZCACHE_RAMSTER_H_ |
12 | #define _ZCACHE_RAMSTER_H_ | 12 | #define _ZCACHE_RAMSTER_H_ |
13 | 13 | ||
14 | #ifdef CONFIG_RAMSTER_MODULE | ||
15 | #define CONFIG_RAMSTER | ||
16 | #endif | ||
17 | |||
18 | #ifdef CONFIG_RAMSTER | 14 | #ifdef CONFIG_RAMSTER |
19 | #include "ramster/ramster.h" | 15 | #include "ramster/ramster.h" |
20 | #else | 16 | #else |
diff --git a/drivers/staging/zcache/ramster/debug.c b/drivers/staging/zcache/ramster/debug.c index 327e4f0d98e1..5b26ee977c2f 100644 --- a/drivers/staging/zcache/ramster/debug.c +++ b/drivers/staging/zcache/ramster/debug.c | |||
@@ -1,6 +1,8 @@ | |||
1 | #include <linux/atomic.h> | 1 | #include <linux/atomic.h> |
2 | #include "debug.h" | 2 | #include "debug.h" |
3 | 3 | ||
4 | ssize_t ramster_foreign_eph_pages; | ||
5 | ssize_t ramster_foreign_pers_pages; | ||
4 | #ifdef CONFIG_DEBUG_FS | 6 | #ifdef CONFIG_DEBUG_FS |
5 | #include <linux/debugfs.h> | 7 | #include <linux/debugfs.h> |
6 | 8 | ||
diff --git a/drivers/staging/zcache/ramster/ramster-howto.txt b/drivers/staging/zcache/ramster/ramster-howto.txt new file mode 100644 index 000000000000..7b1ee3bbfdd5 --- /dev/null +++ b/drivers/staging/zcache/ramster/ramster-howto.txt | |||
@@ -0,0 +1,366 @@ | |||
1 | RAMSTER HOW-TO | ||
2 | |||
3 | Author: Dan Magenheimer | ||
4 | Ramster maintainer: Konrad Wilk <konrad.wilk@oracle.com> | ||
5 | |||
6 | This is a HOWTO document for ramster which, as of this writing, is in | ||
7 | the kernel as a subdirectory of zcache in drivers/staging, called ramster. | ||
8 | (Zcache can be built with or without ramster functionality.) If enabled | ||
9 | and properly configured, ramster allows memory capacity load balancing | ||
10 | across multiple machines in a cluster. Further, the ramster code serves | ||
11 | as an example of asynchronous access for zcache (as well as cleancache and | ||
12 | frontswap) that may prove useful for future transcendent memory | ||
13 | implementations, such as KVM and NVRAM. While ramster works today on | ||
14 | any network connection that supports kernel sockets, its features may | ||
15 | become more interesting on future high-speed fabrics/interconnects. | ||
16 | |||
17 | Ramster requires both kernel and userland support. The userland support, | ||
18 | called ramster-tools, is known to work with EL6-based distros, but is a | ||
19 | set of poorly-hacked slightly-modified cluster tools based on ocfs2, which | ||
20 | includes an init file, a config file, and a userland binary that interfaces | ||
21 | to the kernel. This state of userland support reflects the abysmal userland | ||
22 | skills of this suitably-embarrassed author; any help/patches to turn | ||
23 | ramster-tools into more distributable rpms/debs useful for a wider range | ||
24 | of distros would be appreciated. The source RPM that can be used as a | ||
25 | starting point is available at: | ||
26 | http://oss.oracle.com/projects/tmem/files/RAMster/ | ||
27 | |||
28 | As a result of this author's ignorance, userland setup described in this | ||
29 | HOWTO assumes an EL6 distro and is described in EL6 syntax. Apologies | ||
30 | if this offends anyone! | ||
31 | |||
32 | Kernel support has only been tested on x86_64. Systems with an active | ||
33 | ocfs2 filesystem should work, but since ramster leverages a lot of | ||
34 | code from ocfs2, there may be latent issues. A kernel configuration that | ||
35 | includes CONFIG_OCFS2_FS should build OK, and should certainly run OK | ||
36 | if no ocfs2 filesystem is mounted. | ||
37 | |||
38 | This HOWTO demonstrates memory capacity load balancing for a two-node | ||
39 | cluster, where one node called the "local" node becomes overcommitted | ||
40 | and the other node called the "remote" node provides additional RAM | ||
41 | capacity for use by the local node. Ramster is capable of more complex | ||
42 | topologies; see the last section titled "ADVANCED RAMSTER TOPOLOGIES". | ||
43 | |||
44 | If you find any terms in this HOWTO unfamiliar or don't understand the | ||
45 | motivation for ramster, the following LWN reading is recommended: | ||
46 | -- Transcendent Memory in a Nutshell (lwn.net/Articles/454795) | ||
47 | -- The future calculus of memory management (lwn.net/Articles/475681) | ||
48 | And since ramster is built on top of zcache, this article may be helpful: | ||
49 | -- In-kernel memory compression (lwn.net/Articles/545244) | ||
50 | |||
51 | Now that you've memorized the contents of those articles, let's get started! | ||
52 | |||
53 | A. PRELIMINARY | ||
54 | |||
55 | 1) Install two x86_64 Linux systems that are known to work when | ||
56 | upgraded to a recent upstream Linux kernel version. | ||
57 | |||
58 | On each system: | ||
59 | |||
60 | 2) Configure, build and install, then boot Linux, just to ensure it | ||
61 | can be done with an unmodified upstream kernel. Confirm you booted | ||
62 | the upstream kernel with "uname -a". | ||
63 | |||
64 | 3) If you plan to do any performance testing or unless you plan to | ||
65 | test only swapping, the "WasActive" patch is also highly recommended. | ||
66 | (Search lkml.org for WasActive, apply the patch, rebuild your kernel.) | ||
67 | For a demo or simple testing, the patch can be ignored. | ||
68 | |||
69 | 4) Install ramster-tools as root. An x86_64 rpm for EL6-based systems | ||
70 | can be found at: | ||
71 | http://oss.oracle.com/projects/tmem/files/RAMster/ | ||
72 | (Sorry but for now, non-EL6 users must recreate ramster-tools on | ||
73 | their own from source. See above.) | ||
74 | |||
75 | 5) Ensure that debugfs is mounted at each boot. Examples below assume it | ||
76 | is mounted at /sys/kernel/debug. | ||
77 | |||
78 | B. BUILDING RAMSTER INTO THE KERNEL | ||
79 | |||
80 | Do the following on each system: | ||
81 | |||
82 | 1) Using the kernel configuration mechanism of your choice, change | ||
83 | your config to include: | ||
84 | |||
85 | CONFIG_CLEANCACHE=y | ||
86 | CONFIG_FRONTSWAP=y | ||
87 | CONFIG_STAGING=y | ||
88 | CONFIG_CONFIGFS_FS=y # NOTE: MUST BE y, not m | ||
89 | CONFIG_ZCACHE=y | ||
90 | CONFIG_RAMSTER=y | ||
91 | |||
92 | For a linux-3.10 or later kernel, you should also set: | ||
93 | |||
94 | CONFIG_ZCACHE_DEBUG=y | ||
95 | CONFIG_RAMSTER_DEBUG=y | ||
96 | |||
97 | Before building the kernel please doublecheck your kernel config | ||
98 | file to ensure all of the settings are correct. | ||
99 | |||
100 | 2) Build this kernel and change your boot file (e.g. /etc/grub.conf) | ||
101 | so that the new kernel will boot. | ||
102 | |||
103 | 3) Add "zcache" and "ramster" as kernel boot parameters for the new kernel. | ||
104 | |||
105 | 4) Reboot each system approximately simultaneously. | ||
106 | |||
107 | 5) Check dmesg to ensure there are some messages from ramster, prefixed | ||
108 | by "ramster:" | ||
109 | |||
110 | # dmesg | grep ramster | ||
111 | |||
112 | You should also see a lot of files in: | ||
113 | |||
114 | # ls /sys/kernel/debug/zcache | ||
115 | # ls /sys/kernel/debug/ramster | ||
116 | |||
117 | These are mostly counters for various zcache and ramster activities. | ||
118 | You should also see files in: | ||
119 | |||
120 | # ls /sys/kernel/mm/ramster | ||
121 | |||
122 | These are sysfs files that control ramster as we shall see. | ||
123 | |||
124 | Ramster now will act as a single-system zcache on each system | ||
125 | but doesn't yet know anything about the cluster so can't yet do | ||
126 | anything remotely. | ||
127 | |||
128 | C. CONFIGURING THE RAMSTER CLUSTER | ||
129 | |||
130 | This part can be error prone unless you are familiar with clustering | ||
131 | filesystems. We need to describe the cluster in a /etc/ramster.conf | ||
132 | file and the init scripts that parse it are extremely picky about | ||
133 | the syntax. | ||
134 | |||
135 | 1) Create a /etc/ramster.conf file and ensure it is identical on both | ||
136 | systems. This file mimics the ocfs2 format and there is a good amount | ||
137 | of documentation that can be searched for ocfs2.conf, but you can use: | ||
138 | |||
139 | cluster: | ||
140 | name = ramster | ||
141 | node_count = 2 | ||
142 | node: | ||
143 | name = system1 | ||
144 | cluster = ramster | ||
145 | number = 0 | ||
146 | ip_address = my.ip.ad.r1 | ||
147 | ip_port = 7777 | ||
148 | node: | ||
149 | name = system2 | ||
150 | cluster = ramster | ||
151 | number = 1 | ||
152 | ip_address = my.ip.ad.r2 | ||
153 | ip_port = 7777 | ||
154 | |||
155 | You must ensure that the "name" field in the file exactly matches | ||
156 | the output of "hostname" on each system; if "hostname" shows a | ||
157 | fully-qualified hostname, ensure the name is fully qualified in | ||
158 | /etc/ramster.conf. Obviously, substitute my.ip.ad.rx with proper | ||
159 | ip addresses. | ||
160 | |||
161 | 2) Enable the ramster service and configure it. If you used the | ||
162 | EL6 ramster-tools, this would be: | ||
163 | |||
164 | # chkconfig --add ramster | ||
165 | # service ramster configure | ||
166 | |||
167 | Set "load on boot" to "y", cluster to start is "ramster" (or whatever | ||
168 | name you chose in ramster.conf), heartbeat dead threshold as "500", | ||
169 | network idle timeout as "1000000". Leave the others as default. | ||
170 | |||
171 | 3) Reboot both systems. After reboot, try (assuming EL6 ramster-tools): | ||
172 | |||
173 | # service ramster status | ||
174 | |||
175 | You should see "Checking RAMSTER cluster "ramster": Online". If you do | ||
176 | not, something is wrong and ramster will not work. Note that you | ||
177 | should also see that the driver for "configfs" is loaded and mounted, | ||
178 | the driver for ocfs2_dlmfs is not loaded, and some numbers for network | ||
179 | parameters. You will also see "Checking RAMSTER heartbeat: Not active". | ||
180 | That's all OK. | ||
181 | |||
182 | 4) Now you need to start the cluster heartbeat; the cluster is not "up" | ||
183 | until all nodes detect a heartbeat. In a real cluster, heartbeat detection | ||
184 | is done via a cluster filesystem, but ramster doesn't require one. Some | ||
185 | hack-y kernel code in ramster can start the heartbeat for you though if | ||
186 | you tell it what nodes are "up". To enable the heartbeat, do: | ||
187 | |||
188 | # echo 0 > /sys/kernel/mm/ramster/manual_node_up | ||
189 | # echo 1 > /sys/kernel/mm/ramster/manual_node_up | ||
190 | |||
191 | This must be done on BOTH nodes and, to avoid timeouts, must be done | ||
192 | approximately concurrently on both nodes. On an EL6 system, it is | ||
193 | convenient to put these lines in /etc/rc.local. To confirm that the | ||
194 | cluster is now up, on both systems do: | ||
195 | |||
196 | # dmesg | grep ramster | ||
197 | |||
198 | You should see ramster "Accepted connection" messages in dmesg on both | ||
199 | nodes after this. Note that if you check userland status again with | ||
200 | |||
201 | # service ramster status | ||
202 | |||
203 | you will still see "Checking RAMSTER heartbeat: Not active". That's | ||
204 | still OK... the ramster kernel heartbeat hack doesn't communicate to | ||
205 | userland. | ||
206 | |||
207 | 5) You now must tell each node the node to which it should "remotify" pages. | ||
208 | On this two node cluster, we will assume the "local" node, node 0, has | ||
209 | memory overcommitted and will use ramster to utilize RAM capacity on | ||
210 | the "remote node", node 1. To configure this, on node 0, you do: | ||
211 | |||
212 | # echo 1 > /sys/kernel/mm/ramster/remote_target_nodenum | ||
213 | |||
214 | You should see "ramster: node 1 set as remotification target" in dmesg | ||
215 | on node 0. Again, on EL6, /etc/rc.local is a good place to put this | ||
216 | on node 0 so you don't forget to do it at each boot. | ||
217 | |||
218 | 6) One more step: By default, the ramster code does not "remotify" any | ||
219 | pages; this is primarily for testing purposes, but sometimes it is | ||
220 | useful. This may change in the future, but for now, on node 0, you do: | ||
221 | |||
222 | # echo 1 > /sys/kernel/mm/ramster/pers_remotify_enable | ||
223 | # echo 1 > /sys/kernel/mm/ramster/eph_remotify_enable | ||
224 | |||
225 | The first enables remotifying swap (persistent, aka frontswap) pages, | ||
226 | the second enables remotifying of page cache (ephemeral, cleancache) | ||
227 | pages. | ||
228 | |||
229 | On EL6, these lines can also be put in /etc/rc.local (AFTER the | ||
230 | node_up lines), or at the beginning of a script that runs a workload. | ||
231 | |||
232 | 7) Note that most testing has been done with both/all machines booted | ||
233 | roughly simultaneously to avoid cluster timeouts. Ideally, you should | ||
234 | do this too unless you are trying to break ramster rather than just | ||
235 | use it. ;-) | ||
236 | |||
237 | D. TESTING RAMSTER | ||
238 | |||
239 | 1) Note that ramster has no value unless pages get "remotified". For | ||
240 | swap/frontswap/persistent pages, this doesn't happen unless/until | ||
241 | the workload would cause swapping to occur, at which point pages | ||
242 | are put into frontswap/zcache, and the remotification thread starts | ||
243 | working. To get to the point where the system swaps, you either | ||
244 | need a workload for which the working set exceeds the RAM in the | ||
245 | system; or you need to somehow reduce the amount of RAM one of | ||
246 | the system sees. This latter is easy when testing in a VM, but | ||
247 | harder on physical systems. In some cases, "mem=xxxM" on the | ||
248 | kernel command line restricts memory, but for some values of xxx | ||
249 | the kernel may fail to boot. One may also try creating a fixed | ||
250 | RAMdisk, doing nothing with it, but ensuring that it eats up a fixed | ||
251 | amount of RAM. | ||
252 | |||
253 | 2) To see if ramster is working, on the "remote node", node 1, try: | ||
254 | |||
255 | # grep . /sys/kernel/debug/ramster/foreign_* | ||
256 | # # note, that is space-dot-space between grep and the pathname | ||
257 | |||
258 | to monitor the number (and max) ephemeral and persistent pages | ||
259 | that ramster has sent. If these stay at zero, ramster is not working | ||
260 | either because the workload on the local node (node 0) isn't creating | ||
261 | enough memory pressure or because "remotifying" isn't working. On the | ||
262 | local system, node 0, you can watch lots of useful information also. | ||
263 | Try: | ||
264 | |||
265 | grep . /sys/kernel/debug/zcache/*pageframes* \ | ||
266 | /sys/kernel/debug/zcache/*zbytes* \ | ||
267 | /sys/kernel/debug/zcache/*zpages* \ | ||
268 | /sys/kernel/debug/ramster/*remote* | ||
269 | |||
270 | Of particular note are the remote_*_pages_succ_get counters. These | ||
271 | show how many disk reads and/or disk writes have been avoided on the | ||
272 | overcommitted local system by storing pages remotely using ramster. | ||
273 | |||
274 | At the risk of information overload, you can also grep: | ||
275 | |||
276 | /sys/kernel/debug/cleancache/* and /sys/kernel/debug/frontswap/* | ||
277 | |||
278 | These show, for example, how many disk reads and/or disk writes have | ||
279 | been avoided by using zcache to optimize RAM on the local system. | ||
280 | |||
281 | |||
282 | AUTOMATIC SWAP REPATRIATION | ||
283 | |||
284 | You may notice that while the systems are idle, the foreign persistent | ||
285 | page count on the remote machine slowly decreases. This is because | ||
286 | ramster implements "frontswap selfshrinking": When possible, swap | ||
287 | pages that have been remotified are slowly repatriated to the local | ||
288 | machine. This is so that local RAM can be used when possible and | ||
289 | so that, in case of remote machine crash, the probability of loss | ||
290 | of data is reduced. | ||
291 | |||
292 | REBOOTING / POWEROFF | ||
293 | |||
294 | If a system is shut down while some of its swap pages still reside | ||
295 | on a remote system, the system may lock up during the shutdown | ||
296 | sequence. This will occur if the network is shut down before the | ||
297 | swap mechansim is shut down, which is the default ordering on many | ||
298 | distros. To avoid this annoying problem, simply shut off the swap | ||
299 | subsystem before starting the shutdown sequence, e.g.: | ||
300 | |||
301 | # swapoff -a | ||
302 | # reboot | ||
303 | |||
304 | Ideally, this swapoff-before-ifdown ordering should be enforced permanently | ||
305 | using shutdown scripts. | ||
306 | |||
307 | KNOWN PROBLEMS | ||
308 | |||
309 | 1) You may periodically see messages such as: | ||
310 | |||
311 | ramster_r2net, message length problem | ||
312 | |||
313 | This is harmless but indicates that a node is sending messages | ||
314 | containing compressed pages that exceed the maximum for zcache | ||
315 | (PAGE_SIZE*15/16). The sender side needs to be fixed. | ||
316 | |||
317 | 2) If you see a "No longer connected to node..." message or a "No connection | ||
318 | established with node X after N seconds", it is possible you may | ||
319 | be in an unrecoverable state. If you are certain all of the | ||
320 | appropriate cluster configuration steps described above have been | ||
321 | performed, try rebooting the two servers concurrently to see if | ||
322 | the cluster starts. | ||
323 | |||
324 | Note that "Connection to node... shutdown, state 7" is an intermediate | ||
325 | connection state. As long as you later see "Accepted connection", the | ||
326 | intermediate states are harmless. | ||
327 | |||
328 | 3) There are known issues in counting certain values. As a result | ||
329 | you may see periodic warnings from the kernel. Almost always you | ||
330 | will see "ramster: bad accounting for XXX". There are also "WARN_ONCE" | ||
331 | messages. If you see kernel warnings with a tombstone, please report | ||
332 | them. They are harmless but reflect bugs that need to be eventually fixed. | ||
333 | |||
334 | ADVANCED RAMSTER TOPOLOGIES | ||
335 | |||
336 | The kernel code for ramster can support up to eight nodes in a cluster, | ||
337 | but no testing has been done with more than three nodes. | ||
338 | |||
339 | In the example described above, the "remote" node serves as a RAM | ||
340 | overflow for the "local" node. This can be made symmetric by appropriate | ||
341 | settings of the sysfs remote_target_nodenum file. For example, by setting: | ||
342 | |||
343 | # echo 1 > /sys/kernel/mm/ramster/remote_target_nodenum | ||
344 | |||
345 | on node 0, and | ||
346 | |||
347 | # echo 0 > /sys/kernel/mm/ramster/remote_target_nodenum | ||
348 | |||
349 | on node 1, each node can serve as a RAM overflow for the other. | ||
350 | |||
351 | For more than two nodes, a "RAM server" can be configured. For a | ||
352 | three node system, set: | ||
353 | |||
354 | # echo 0 > /sys/kernel/mm/ramster/remote_target_nodenum | ||
355 | |||
356 | on node 1, and | ||
357 | |||
358 | # echo 0 > /sys/kernel/mm/ramster/remote_target_nodenum | ||
359 | |||
360 | on node 2. Then node 0 is a RAM server for node 1 and node 2. | ||
361 | |||
362 | In this implementation of ramster, any remote node is potentially a single | ||
363 | point of failure (SPOF). Though the probability of failure is reduced | ||
364 | by automatic swap repatriation (see above), a proposed future enhancement | ||
365 | to ramster improves high-availability for the cluster by sending a copy | ||
366 | of each page of date to two other nodes. Patches welcome! | ||
diff --git a/drivers/staging/zcache/ramster/ramster.c b/drivers/staging/zcache/ramster/ramster.c index b18b887db79f..a937ce1fa27a 100644 --- a/drivers/staging/zcache/ramster/ramster.c +++ b/drivers/staging/zcache/ramster/ramster.c | |||
@@ -66,8 +66,6 @@ static int ramster_remote_target_nodenum __read_mostly = -1; | |||
66 | 66 | ||
67 | /* Used by this code. */ | 67 | /* Used by this code. */ |
68 | long ramster_flnodes; | 68 | long ramster_flnodes; |
69 | ssize_t ramster_foreign_eph_pages; | ||
70 | ssize_t ramster_foreign_pers_pages; | ||
71 | /* FIXME frontswap selfshrinking knobs in debugfs? */ | 69 | /* FIXME frontswap selfshrinking knobs in debugfs? */ |
72 | 70 | ||
73 | static LIST_HEAD(ramster_rem_op_list); | 71 | static LIST_HEAD(ramster_rem_op_list); |
@@ -399,14 +397,18 @@ void ramster_count_foreign_pages(bool eph, int count) | |||
399 | inc_ramster_foreign_eph_pages(); | 397 | inc_ramster_foreign_eph_pages(); |
400 | } else { | 398 | } else { |
401 | dec_ramster_foreign_eph_pages(); | 399 | dec_ramster_foreign_eph_pages(); |
400 | #ifdef CONFIG_RAMSTER_DEBUG | ||
402 | WARN_ON_ONCE(ramster_foreign_eph_pages < 0); | 401 | WARN_ON_ONCE(ramster_foreign_eph_pages < 0); |
402 | #endif | ||
403 | } | 403 | } |
404 | } else { | 404 | } else { |
405 | if (count > 0) { | 405 | if (count > 0) { |
406 | inc_ramster_foreign_pers_pages(); | 406 | inc_ramster_foreign_pers_pages(); |
407 | } else { | 407 | } else { |
408 | dec_ramster_foreign_pers_pages(); | 408 | dec_ramster_foreign_pers_pages(); |
409 | #ifdef CONFIG_RAMSTER_DEBUG | ||
409 | WARN_ON_ONCE(ramster_foreign_pers_pages < 0); | 410 | WARN_ON_ONCE(ramster_foreign_pers_pages < 0); |
411 | #endif | ||
410 | } | 412 | } |
411 | } | 413 | } |
412 | } | 414 | } |
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 522cb8e55142..dcceed29d31a 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c | |||
@@ -1922,15 +1922,15 @@ out: | |||
1922 | 1922 | ||
1923 | #ifdef CONFIG_ZCACHE_MODULE | 1923 | #ifdef CONFIG_ZCACHE_MODULE |
1924 | #ifdef CONFIG_RAMSTER | 1924 | #ifdef CONFIG_RAMSTER |
1925 | module_param(ramster_enabled, int, S_IRUGO); | 1925 | module_param(ramster_enabled, bool, S_IRUGO); |
1926 | module_param(disable_frontswap_selfshrink, int, S_IRUGO); | 1926 | module_param(disable_frontswap_selfshrink, int, S_IRUGO); |
1927 | #endif | 1927 | #endif |
1928 | module_param(disable_cleancache, int, S_IRUGO); | 1928 | module_param(disable_cleancache, bool, S_IRUGO); |
1929 | module_param(disable_frontswap, int, S_IRUGO); | 1929 | module_param(disable_frontswap, bool, S_IRUGO); |
1930 | #ifdef FRONTSWAP_HAS_EXCLUSIVE_GETS | 1930 | #ifdef FRONTSWAP_HAS_EXCLUSIVE_GETS |
1931 | module_param(frontswap_has_exclusive_gets, bool, S_IRUGO); | 1931 | module_param(frontswap_has_exclusive_gets, bool, S_IRUGO); |
1932 | #endif | 1932 | #endif |
1933 | module_param(disable_frontswap_ignore_nonactive, int, S_IRUGO); | 1933 | module_param(disable_frontswap_ignore_nonactive, bool, S_IRUGO); |
1934 | module_param(zcache_comp_name, charp, S_IRUGO); | 1934 | module_param(zcache_comp_name, charp, S_IRUGO); |
1935 | module_init(zcache_init); | 1935 | module_init(zcache_init); |
1936 | MODULE_LICENSE("GPL"); | 1936 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index ffbc6a94be52..d7705e5824fb 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -651,7 +651,7 @@ static int iscsit_add_reject( | |||
651 | cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); | 651 | cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); |
652 | if (!cmd->buf_ptr) { | 652 | if (!cmd->buf_ptr) { |
653 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); | 653 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); |
654 | iscsit_release_cmd(cmd); | 654 | iscsit_free_cmd(cmd, false); |
655 | return -1; | 655 | return -1; |
656 | } | 656 | } |
657 | 657 | ||
@@ -697,7 +697,7 @@ int iscsit_add_reject_from_cmd( | |||
697 | cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); | 697 | cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); |
698 | if (!cmd->buf_ptr) { | 698 | if (!cmd->buf_ptr) { |
699 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); | 699 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); |
700 | iscsit_release_cmd(cmd); | 700 | iscsit_free_cmd(cmd, false); |
701 | return -1; | 701 | return -1; |
702 | } | 702 | } |
703 | 703 | ||
@@ -1250,7 +1250,7 @@ static u32 iscsit_do_crypto_hash_sg( | |||
1250 | 1250 | ||
1251 | static void iscsit_do_crypto_hash_buf( | 1251 | static void iscsit_do_crypto_hash_buf( |
1252 | struct hash_desc *hash, | 1252 | struct hash_desc *hash, |
1253 | unsigned char *buf, | 1253 | const void *buf, |
1254 | u32 payload_length, | 1254 | u32 payload_length, |
1255 | u32 padding, | 1255 | u32 padding, |
1256 | u8 *pad_bytes, | 1256 | u8 *pad_bytes, |
@@ -1743,7 +1743,7 @@ int iscsit_handle_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, | |||
1743 | return 0; | 1743 | return 0; |
1744 | out: | 1744 | out: |
1745 | if (cmd) | 1745 | if (cmd) |
1746 | iscsit_release_cmd(cmd); | 1746 | iscsit_free_cmd(cmd, false); |
1747 | ping_out: | 1747 | ping_out: |
1748 | kfree(ping_data); | 1748 | kfree(ping_data); |
1749 | return ret; | 1749 | return ret; |
@@ -2251,7 +2251,7 @@ iscsit_handle_logout_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, | |||
2251 | if (conn->conn_state != TARG_CONN_STATE_LOGGED_IN) { | 2251 | if (conn->conn_state != TARG_CONN_STATE_LOGGED_IN) { |
2252 | pr_err("Received logout request on connection that" | 2252 | pr_err("Received logout request on connection that" |
2253 | " is not in logged in state, ignoring request.\n"); | 2253 | " is not in logged in state, ignoring request.\n"); |
2254 | iscsit_release_cmd(cmd); | 2254 | iscsit_free_cmd(cmd, false); |
2255 | return 0; | 2255 | return 0; |
2256 | } | 2256 | } |
2257 | 2257 | ||
@@ -2524,9 +2524,8 @@ static int iscsit_send_conn_drop_async_message( | |||
2524 | if (conn->conn_ops->HeaderDigest) { | 2524 | if (conn->conn_ops->HeaderDigest) { |
2525 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; | 2525 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; |
2526 | 2526 | ||
2527 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 2527 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr, |
2528 | (unsigned char *)hdr, ISCSI_HDR_LEN, | 2528 | ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest); |
2529 | 0, NULL, (u8 *)header_digest); | ||
2530 | 2529 | ||
2531 | cmd->tx_size += ISCSI_CRC_LEN; | 2530 | cmd->tx_size += ISCSI_CRC_LEN; |
2532 | pr_debug("Attaching CRC32C HeaderDigest to" | 2531 | pr_debug("Attaching CRC32C HeaderDigest to" |
@@ -2662,9 +2661,8 @@ static int iscsit_send_datain(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
2662 | if (conn->conn_ops->HeaderDigest) { | 2661 | if (conn->conn_ops->HeaderDigest) { |
2663 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; | 2662 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; |
2664 | 2663 | ||
2665 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 2664 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->pdu, |
2666 | (unsigned char *)cmd->pdu, ISCSI_HDR_LEN, | 2665 | ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest); |
2667 | 0, NULL, (u8 *)header_digest); | ||
2668 | 2666 | ||
2669 | iov[0].iov_len += ISCSI_CRC_LEN; | 2667 | iov[0].iov_len += ISCSI_CRC_LEN; |
2670 | tx_size += ISCSI_CRC_LEN; | 2668 | tx_size += ISCSI_CRC_LEN; |
@@ -2841,9 +2839,8 @@ iscsit_send_logout(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
2841 | if (conn->conn_ops->HeaderDigest) { | 2839 | if (conn->conn_ops->HeaderDigest) { |
2842 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; | 2840 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; |
2843 | 2841 | ||
2844 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 2842 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, &cmd->pdu[0], |
2845 | (unsigned char *)&cmd->pdu[0], ISCSI_HDR_LEN, | 2843 | ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest); |
2846 | 0, NULL, (u8 *)header_digest); | ||
2847 | 2844 | ||
2848 | iov[0].iov_len += ISCSI_CRC_LEN; | 2845 | iov[0].iov_len += ISCSI_CRC_LEN; |
2849 | tx_size += ISCSI_CRC_LEN; | 2846 | tx_size += ISCSI_CRC_LEN; |
@@ -2900,9 +2897,8 @@ static int iscsit_send_unsolicited_nopin( | |||
2900 | if (conn->conn_ops->HeaderDigest) { | 2897 | if (conn->conn_ops->HeaderDigest) { |
2901 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; | 2898 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; |
2902 | 2899 | ||
2903 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 2900 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr, |
2904 | (unsigned char *)hdr, ISCSI_HDR_LEN, | 2901 | ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest); |
2905 | 0, NULL, (u8 *)header_digest); | ||
2906 | 2902 | ||
2907 | tx_size += ISCSI_CRC_LEN; | 2903 | tx_size += ISCSI_CRC_LEN; |
2908 | pr_debug("Attaching CRC32C HeaderDigest to" | 2904 | pr_debug("Attaching CRC32C HeaderDigest to" |
@@ -2949,9 +2945,8 @@ iscsit_send_nopin(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
2949 | if (conn->conn_ops->HeaderDigest) { | 2945 | if (conn->conn_ops->HeaderDigest) { |
2950 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; | 2946 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; |
2951 | 2947 | ||
2952 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 2948 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr, |
2953 | (unsigned char *)hdr, ISCSI_HDR_LEN, | 2949 | ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest); |
2954 | 0, NULL, (u8 *)header_digest); | ||
2955 | 2950 | ||
2956 | iov[0].iov_len += ISCSI_CRC_LEN; | 2951 | iov[0].iov_len += ISCSI_CRC_LEN; |
2957 | tx_size += ISCSI_CRC_LEN; | 2952 | tx_size += ISCSI_CRC_LEN; |
@@ -3040,9 +3035,8 @@ static int iscsit_send_r2t( | |||
3040 | if (conn->conn_ops->HeaderDigest) { | 3035 | if (conn->conn_ops->HeaderDigest) { |
3041 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; | 3036 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; |
3042 | 3037 | ||
3043 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 3038 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr, |
3044 | (unsigned char *)hdr, ISCSI_HDR_LEN, | 3039 | ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest); |
3045 | 0, NULL, (u8 *)header_digest); | ||
3046 | 3040 | ||
3047 | cmd->iov_misc[0].iov_len += ISCSI_CRC_LEN; | 3041 | cmd->iov_misc[0].iov_len += ISCSI_CRC_LEN; |
3048 | tx_size += ISCSI_CRC_LEN; | 3042 | tx_size += ISCSI_CRC_LEN; |
@@ -3256,9 +3250,8 @@ static int iscsit_send_response(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
3256 | if (conn->conn_ops->HeaderDigest) { | 3250 | if (conn->conn_ops->HeaderDigest) { |
3257 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; | 3251 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; |
3258 | 3252 | ||
3259 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 3253 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->pdu, |
3260 | (unsigned char *)cmd->pdu, ISCSI_HDR_LEN, | 3254 | ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest); |
3261 | 0, NULL, (u8 *)header_digest); | ||
3262 | 3255 | ||
3263 | iov[0].iov_len += ISCSI_CRC_LEN; | 3256 | iov[0].iov_len += ISCSI_CRC_LEN; |
3264 | tx_size += ISCSI_CRC_LEN; | 3257 | tx_size += ISCSI_CRC_LEN; |
@@ -3329,9 +3322,8 @@ iscsit_send_task_mgt_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
3329 | if (conn->conn_ops->HeaderDigest) { | 3322 | if (conn->conn_ops->HeaderDigest) { |
3330 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; | 3323 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; |
3331 | 3324 | ||
3332 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 3325 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr, |
3333 | (unsigned char *)hdr, ISCSI_HDR_LEN, | 3326 | ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest); |
3334 | 0, NULL, (u8 *)header_digest); | ||
3335 | 3327 | ||
3336 | cmd->iov_misc[0].iov_len += ISCSI_CRC_LEN; | 3328 | cmd->iov_misc[0].iov_len += ISCSI_CRC_LEN; |
3337 | tx_size += ISCSI_CRC_LEN; | 3329 | tx_size += ISCSI_CRC_LEN; |
@@ -3504,9 +3496,8 @@ static int iscsit_send_text_rsp( | |||
3504 | if (conn->conn_ops->HeaderDigest) { | 3496 | if (conn->conn_ops->HeaderDigest) { |
3505 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; | 3497 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; |
3506 | 3498 | ||
3507 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 3499 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr, |
3508 | (unsigned char *)hdr, ISCSI_HDR_LEN, | 3500 | ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest); |
3509 | 0, NULL, (u8 *)header_digest); | ||
3510 | 3501 | ||
3511 | iov[0].iov_len += ISCSI_CRC_LEN; | 3502 | iov[0].iov_len += ISCSI_CRC_LEN; |
3512 | tx_size += ISCSI_CRC_LEN; | 3503 | tx_size += ISCSI_CRC_LEN; |
@@ -3557,11 +3548,11 @@ static int iscsit_send_reject( | |||
3557 | struct iscsi_cmd *cmd, | 3548 | struct iscsi_cmd *cmd, |
3558 | struct iscsi_conn *conn) | 3549 | struct iscsi_conn *conn) |
3559 | { | 3550 | { |
3560 | u32 iov_count = 0, tx_size = 0; | 3551 | struct iscsi_reject *hdr = (struct iscsi_reject *)&cmd->pdu[0]; |
3561 | struct iscsi_reject *hdr; | ||
3562 | struct kvec *iov; | 3552 | struct kvec *iov; |
3553 | u32 iov_count = 0, tx_size; | ||
3563 | 3554 | ||
3564 | iscsit_build_reject(cmd, conn, (struct iscsi_reject *)&cmd->pdu[0]); | 3555 | iscsit_build_reject(cmd, conn, hdr); |
3565 | 3556 | ||
3566 | iov = &cmd->iov_misc[0]; | 3557 | iov = &cmd->iov_misc[0]; |
3567 | iov[iov_count].iov_base = cmd->pdu; | 3558 | iov[iov_count].iov_base = cmd->pdu; |
@@ -3574,9 +3565,8 @@ static int iscsit_send_reject( | |||
3574 | if (conn->conn_ops->HeaderDigest) { | 3565 | if (conn->conn_ops->HeaderDigest) { |
3575 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; | 3566 | u32 *header_digest = (u32 *)&cmd->pdu[ISCSI_HDR_LEN]; |
3576 | 3567 | ||
3577 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 3568 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, hdr, |
3578 | (unsigned char *)hdr, ISCSI_HDR_LEN, | 3569 | ISCSI_HDR_LEN, 0, NULL, (u8 *)header_digest); |
3579 | 0, NULL, (u8 *)header_digest); | ||
3580 | 3570 | ||
3581 | iov[0].iov_len += ISCSI_CRC_LEN; | 3571 | iov[0].iov_len += ISCSI_CRC_LEN; |
3582 | tx_size += ISCSI_CRC_LEN; | 3572 | tx_size += ISCSI_CRC_LEN; |
@@ -3585,9 +3575,8 @@ static int iscsit_send_reject( | |||
3585 | } | 3575 | } |
3586 | 3576 | ||
3587 | if (conn->conn_ops->DataDigest) { | 3577 | if (conn->conn_ops->DataDigest) { |
3588 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, | 3578 | iscsit_do_crypto_hash_buf(&conn->conn_tx_hash, cmd->buf_ptr, |
3589 | (unsigned char *)cmd->buf_ptr, ISCSI_HDR_LEN, | 3579 | ISCSI_HDR_LEN, 0, NULL, (u8 *)&cmd->data_crc); |
3590 | 0, NULL, (u8 *)&cmd->data_crc); | ||
3591 | 3580 | ||
3592 | iov[iov_count].iov_base = &cmd->data_crc; | 3581 | iov[iov_count].iov_base = &cmd->data_crc; |
3593 | iov[iov_count++].iov_len = ISCSI_CRC_LEN; | 3582 | iov[iov_count++].iov_len = ISCSI_CRC_LEN; |
@@ -3676,7 +3665,7 @@ iscsit_immediate_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state | |||
3676 | list_del(&cmd->i_conn_node); | 3665 | list_del(&cmd->i_conn_node); |
3677 | spin_unlock_bh(&conn->cmd_lock); | 3666 | spin_unlock_bh(&conn->cmd_lock); |
3678 | 3667 | ||
3679 | iscsit_free_cmd(cmd); | 3668 | iscsit_free_cmd(cmd, false); |
3680 | break; | 3669 | break; |
3681 | case ISTATE_SEND_NOPIN_WANT_RESPONSE: | 3670 | case ISTATE_SEND_NOPIN_WANT_RESPONSE: |
3682 | iscsit_mod_nopin_response_timer(conn); | 3671 | iscsit_mod_nopin_response_timer(conn); |
@@ -4133,7 +4122,7 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) | |||
4133 | 4122 | ||
4134 | iscsit_increment_maxcmdsn(cmd, sess); | 4123 | iscsit_increment_maxcmdsn(cmd, sess); |
4135 | 4124 | ||
4136 | iscsit_free_cmd(cmd); | 4125 | iscsit_free_cmd(cmd, true); |
4137 | 4126 | ||
4138 | spin_lock_bh(&conn->cmd_lock); | 4127 | spin_lock_bh(&conn->cmd_lock); |
4139 | } | 4128 | } |
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 13e9e715ad2e..8d8b3ff68490 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -155,7 +155,7 @@ static ssize_t lio_target_np_store_iser( | |||
155 | struct iscsi_tpg_np *tpg_np_iser = NULL; | 155 | struct iscsi_tpg_np *tpg_np_iser = NULL; |
156 | char *endptr; | 156 | char *endptr; |
157 | u32 op; | 157 | u32 op; |
158 | int rc; | 158 | int rc = 0; |
159 | 159 | ||
160 | op = simple_strtoul(page, &endptr, 0); | 160 | op = simple_strtoul(page, &endptr, 0); |
161 | if ((op != 1) && (op != 0)) { | 161 | if ((op != 1) && (op != 0)) { |
@@ -174,31 +174,32 @@ static ssize_t lio_target_np_store_iser( | |||
174 | return -EINVAL; | 174 | return -EINVAL; |
175 | 175 | ||
176 | if (op) { | 176 | if (op) { |
177 | int rc = request_module("ib_isert"); | 177 | rc = request_module("ib_isert"); |
178 | if (rc != 0) | 178 | if (rc != 0) { |
179 | pr_warn("Unable to request_module for ib_isert\n"); | 179 | pr_warn("Unable to request_module for ib_isert\n"); |
180 | rc = 0; | ||
181 | } | ||
180 | 182 | ||
181 | tpg_np_iser = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr, | 183 | tpg_np_iser = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr, |
182 | np->np_ip, tpg_np, ISCSI_INFINIBAND); | 184 | np->np_ip, tpg_np, ISCSI_INFINIBAND); |
183 | if (!tpg_np_iser || IS_ERR(tpg_np_iser)) | 185 | if (IS_ERR(tpg_np_iser)) { |
186 | rc = PTR_ERR(tpg_np_iser); | ||
184 | goto out; | 187 | goto out; |
188 | } | ||
185 | } else { | 189 | } else { |
186 | tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND); | 190 | tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND); |
187 | if (!tpg_np_iser) | 191 | if (tpg_np_iser) { |
188 | goto out; | 192 | rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser); |
189 | 193 | if (rc < 0) | |
190 | rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser); | 194 | goto out; |
191 | if (rc < 0) | 195 | } |
192 | goto out; | ||
193 | } | 196 | } |
194 | 197 | ||
195 | printk("lio_target_np_store_iser() done, op: %d\n", op); | ||
196 | |||
197 | iscsit_put_tpg(tpg); | 198 | iscsit_put_tpg(tpg); |
198 | return count; | 199 | return count; |
199 | out: | 200 | out: |
200 | iscsit_put_tpg(tpg); | 201 | iscsit_put_tpg(tpg); |
201 | return -EINVAL; | 202 | return rc; |
202 | } | 203 | } |
203 | 204 | ||
204 | TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR); | 205 | TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR); |
diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c index 8e6298cc8839..dcb199da06b9 100644 --- a/drivers/target/iscsi/iscsi_target_erl0.c +++ b/drivers/target/iscsi/iscsi_target_erl0.c | |||
@@ -842,11 +842,11 @@ int iscsit_stop_time2retain_timer(struct iscsi_session *sess) | |||
842 | return 0; | 842 | return 0; |
843 | 843 | ||
844 | sess->time2retain_timer_flags |= ISCSI_TF_STOP; | 844 | sess->time2retain_timer_flags |= ISCSI_TF_STOP; |
845 | spin_unlock_bh(&se_tpg->session_lock); | 845 | spin_unlock(&se_tpg->session_lock); |
846 | 846 | ||
847 | del_timer_sync(&sess->time2retain_timer); | 847 | del_timer_sync(&sess->time2retain_timer); |
848 | 848 | ||
849 | spin_lock_bh(&se_tpg->session_lock); | 849 | spin_lock(&se_tpg->session_lock); |
850 | sess->time2retain_timer_flags &= ~ISCSI_TF_RUNNING; | 850 | sess->time2retain_timer_flags &= ~ISCSI_TF_RUNNING; |
851 | pr_debug("Stopped Time2Retain Timer for SID: %u\n", | 851 | pr_debug("Stopped Time2Retain Timer for SID: %u\n", |
852 | sess->sid); | 852 | sess->sid); |
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index 7816af6cdd12..40d9dbca987b 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c | |||
@@ -823,7 +823,7 @@ static int iscsit_attach_ooo_cmdsn( | |||
823 | /* | 823 | /* |
824 | * CmdSN is greater than the tail of the list. | 824 | * CmdSN is greater than the tail of the list. |
825 | */ | 825 | */ |
826 | if (ooo_tail->cmdsn < ooo_cmdsn->cmdsn) | 826 | if (iscsi_sna_lt(ooo_tail->cmdsn, ooo_cmdsn->cmdsn)) |
827 | list_add_tail(&ooo_cmdsn->ooo_list, | 827 | list_add_tail(&ooo_cmdsn->ooo_list, |
828 | &sess->sess_ooo_cmdsn_list); | 828 | &sess->sess_ooo_cmdsn_list); |
829 | else { | 829 | else { |
@@ -833,11 +833,12 @@ static int iscsit_attach_ooo_cmdsn( | |||
833 | */ | 833 | */ |
834 | list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list, | 834 | list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list, |
835 | ooo_list) { | 835 | ooo_list) { |
836 | if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn) | 836 | if (iscsi_sna_lt(ooo_tmp->cmdsn, ooo_cmdsn->cmdsn)) |
837 | continue; | 837 | continue; |
838 | 838 | ||
839 | /* Insert before this entry */ | ||
839 | list_add(&ooo_cmdsn->ooo_list, | 840 | list_add(&ooo_cmdsn->ooo_list, |
840 | &ooo_tmp->ooo_list); | 841 | ooo_tmp->ooo_list.prev); |
841 | break; | 842 | break; |
842 | } | 843 | } |
843 | } | 844 | } |
diff --git a/drivers/target/iscsi/iscsi_target_erl2.c b/drivers/target/iscsi/iscsi_target_erl2.c index ba6091bf93fc..45a5afd5ea13 100644 --- a/drivers/target/iscsi/iscsi_target_erl2.c +++ b/drivers/target/iscsi/iscsi_target_erl2.c | |||
@@ -143,7 +143,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) | |||
143 | list_del(&cmd->i_conn_node); | 143 | list_del(&cmd->i_conn_node); |
144 | cmd->conn = NULL; | 144 | cmd->conn = NULL; |
145 | spin_unlock(&cr->conn_recovery_cmd_lock); | 145 | spin_unlock(&cr->conn_recovery_cmd_lock); |
146 | iscsit_free_cmd(cmd); | 146 | iscsit_free_cmd(cmd, true); |
147 | spin_lock(&cr->conn_recovery_cmd_lock); | 147 | spin_lock(&cr->conn_recovery_cmd_lock); |
148 | } | 148 | } |
149 | spin_unlock(&cr->conn_recovery_cmd_lock); | 149 | spin_unlock(&cr->conn_recovery_cmd_lock); |
@@ -165,7 +165,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) | |||
165 | list_del(&cmd->i_conn_node); | 165 | list_del(&cmd->i_conn_node); |
166 | cmd->conn = NULL; | 166 | cmd->conn = NULL; |
167 | spin_unlock(&cr->conn_recovery_cmd_lock); | 167 | spin_unlock(&cr->conn_recovery_cmd_lock); |
168 | iscsit_free_cmd(cmd); | 168 | iscsit_free_cmd(cmd, true); |
169 | spin_lock(&cr->conn_recovery_cmd_lock); | 169 | spin_lock(&cr->conn_recovery_cmd_lock); |
170 | } | 170 | } |
171 | spin_unlock(&cr->conn_recovery_cmd_lock); | 171 | spin_unlock(&cr->conn_recovery_cmd_lock); |
@@ -248,7 +248,7 @@ void iscsit_discard_cr_cmds_by_expstatsn( | |||
248 | iscsit_remove_cmd_from_connection_recovery(cmd, sess); | 248 | iscsit_remove_cmd_from_connection_recovery(cmd, sess); |
249 | 249 | ||
250 | spin_unlock(&cr->conn_recovery_cmd_lock); | 250 | spin_unlock(&cr->conn_recovery_cmd_lock); |
251 | iscsit_free_cmd(cmd); | 251 | iscsit_free_cmd(cmd, true); |
252 | spin_lock(&cr->conn_recovery_cmd_lock); | 252 | spin_lock(&cr->conn_recovery_cmd_lock); |
253 | } | 253 | } |
254 | spin_unlock(&cr->conn_recovery_cmd_lock); | 254 | spin_unlock(&cr->conn_recovery_cmd_lock); |
@@ -302,7 +302,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsi_conn *conn) | |||
302 | list_del(&cmd->i_conn_node); | 302 | list_del(&cmd->i_conn_node); |
303 | 303 | ||
304 | spin_unlock_bh(&conn->cmd_lock); | 304 | spin_unlock_bh(&conn->cmd_lock); |
305 | iscsit_free_cmd(cmd); | 305 | iscsit_free_cmd(cmd, true); |
306 | spin_lock_bh(&conn->cmd_lock); | 306 | spin_lock_bh(&conn->cmd_lock); |
307 | } | 307 | } |
308 | spin_unlock_bh(&conn->cmd_lock); | 308 | spin_unlock_bh(&conn->cmd_lock); |
@@ -355,7 +355,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
355 | 355 | ||
356 | list_del(&cmd->i_conn_node); | 356 | list_del(&cmd->i_conn_node); |
357 | spin_unlock_bh(&conn->cmd_lock); | 357 | spin_unlock_bh(&conn->cmd_lock); |
358 | iscsit_free_cmd(cmd); | 358 | iscsit_free_cmd(cmd, true); |
359 | spin_lock_bh(&conn->cmd_lock); | 359 | spin_lock_bh(&conn->cmd_lock); |
360 | continue; | 360 | continue; |
361 | } | 361 | } |
@@ -375,7 +375,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
375 | iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { | 375 | iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { |
376 | list_del(&cmd->i_conn_node); | 376 | list_del(&cmd->i_conn_node); |
377 | spin_unlock_bh(&conn->cmd_lock); | 377 | spin_unlock_bh(&conn->cmd_lock); |
378 | iscsit_free_cmd(cmd); | 378 | iscsit_free_cmd(cmd, true); |
379 | spin_lock_bh(&conn->cmd_lock); | 379 | spin_lock_bh(&conn->cmd_lock); |
380 | continue; | 380 | continue; |
381 | } | 381 | } |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index bb5d5c5bce65..3402241be87c 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -984,8 +984,6 @@ int iscsi_target_setup_login_socket( | |||
984 | } | 984 | } |
985 | 985 | ||
986 | np->np_transport = t; | 986 | np->np_transport = t; |
987 | printk("Set np->np_transport to %p -> %s\n", np->np_transport, | ||
988 | np->np_transport->name); | ||
989 | return 0; | 987 | return 0; |
990 | } | 988 | } |
991 | 989 | ||
@@ -1002,7 +1000,6 @@ int iscsit_accept_np(struct iscsi_np *np, struct iscsi_conn *conn) | |||
1002 | 1000 | ||
1003 | conn->sock = new_sock; | 1001 | conn->sock = new_sock; |
1004 | conn->login_family = np->np_sockaddr.ss_family; | 1002 | conn->login_family = np->np_sockaddr.ss_family; |
1005 | printk("iSCSI/TCP: Setup conn->sock from new_sock: %p\n", new_sock); | ||
1006 | 1003 | ||
1007 | if (np->np_sockaddr.ss_family == AF_INET6) { | 1004 | if (np->np_sockaddr.ss_family == AF_INET6) { |
1008 | memset(&sock_in6, 0, sizeof(struct sockaddr_in6)); | 1005 | memset(&sock_in6, 0, sizeof(struct sockaddr_in6)); |
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index 7ad912060e21..cd5018ff9cd7 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c | |||
@@ -721,9 +721,6 @@ int iscsi_target_locate_portal( | |||
721 | 721 | ||
722 | start += strlen(key) + strlen(value) + 2; | 722 | start += strlen(key) + strlen(value) + 2; |
723 | } | 723 | } |
724 | |||
725 | printk("i_buf: %s, s_buf: %s, t_buf: %s\n", i_buf, s_buf, t_buf); | ||
726 | |||
727 | /* | 724 | /* |
728 | * See 5.3. Login Phase. | 725 | * See 5.3. Login Phase. |
729 | */ | 726 | */ |
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index f690be9e5293..e38222191a33 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c | |||
@@ -436,7 +436,7 @@ int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) | |||
436 | /* | 436 | /* |
437 | * Extra parameters for ISER from RFC-5046 | 437 | * Extra parameters for ISER from RFC-5046 |
438 | */ | 438 | */ |
439 | param = iscsi_set_default_param(pl, RDMAEXTENTIONS, INITIAL_RDMAEXTENTIONS, | 439 | param = iscsi_set_default_param(pl, RDMAEXTENSIONS, INITIAL_RDMAEXTENSIONS, |
440 | PHASE_OPERATIONAL, SCOPE_SESSION_WIDE, SENDER_BOTH, | 440 | PHASE_OPERATIONAL, SCOPE_SESSION_WIDE, SENDER_BOTH, |
441 | TYPERANGE_BOOL_AND, USE_LEADING_ONLY); | 441 | TYPERANGE_BOOL_AND, USE_LEADING_ONLY); |
442 | if (!param) | 442 | if (!param) |
@@ -529,7 +529,7 @@ int iscsi_set_keys_to_negotiate( | |||
529 | SET_PSTATE_NEGOTIATE(param); | 529 | SET_PSTATE_NEGOTIATE(param); |
530 | } else if (!strcmp(param->name, OFMARKINT)) { | 530 | } else if (!strcmp(param->name, OFMARKINT)) { |
531 | SET_PSTATE_NEGOTIATE(param); | 531 | SET_PSTATE_NEGOTIATE(param); |
532 | } else if (!strcmp(param->name, RDMAEXTENTIONS)) { | 532 | } else if (!strcmp(param->name, RDMAEXTENSIONS)) { |
533 | if (iser == true) | 533 | if (iser == true) |
534 | SET_PSTATE_NEGOTIATE(param); | 534 | SET_PSTATE_NEGOTIATE(param); |
535 | } else if (!strcmp(param->name, INITIATORRECVDATASEGMENTLENGTH)) { | 535 | } else if (!strcmp(param->name, INITIATORRECVDATASEGMENTLENGTH)) { |
@@ -580,7 +580,7 @@ int iscsi_set_keys_irrelevant_for_discovery( | |||
580 | param->state &= ~PSTATE_NEGOTIATE; | 580 | param->state &= ~PSTATE_NEGOTIATE; |
581 | else if (!strcmp(param->name, OFMARKINT)) | 581 | else if (!strcmp(param->name, OFMARKINT)) |
582 | param->state &= ~PSTATE_NEGOTIATE; | 582 | param->state &= ~PSTATE_NEGOTIATE; |
583 | else if (!strcmp(param->name, RDMAEXTENTIONS)) | 583 | else if (!strcmp(param->name, RDMAEXTENSIONS)) |
584 | param->state &= ~PSTATE_NEGOTIATE; | 584 | param->state &= ~PSTATE_NEGOTIATE; |
585 | else if (!strcmp(param->name, INITIATORRECVDATASEGMENTLENGTH)) | 585 | else if (!strcmp(param->name, INITIATORRECVDATASEGMENTLENGTH)) |
586 | param->state &= ~PSTATE_NEGOTIATE; | 586 | param->state &= ~PSTATE_NEGOTIATE; |
@@ -758,9 +758,9 @@ static int iscsi_add_notunderstood_response( | |||
758 | } | 758 | } |
759 | INIT_LIST_HEAD(&extra_response->er_list); | 759 | INIT_LIST_HEAD(&extra_response->er_list); |
760 | 760 | ||
761 | strncpy(extra_response->key, key, strlen(key) + 1); | 761 | strlcpy(extra_response->key, key, sizeof(extra_response->key)); |
762 | strncpy(extra_response->value, NOTUNDERSTOOD, | 762 | strlcpy(extra_response->value, NOTUNDERSTOOD, |
763 | strlen(NOTUNDERSTOOD) + 1); | 763 | sizeof(extra_response->value)); |
764 | 764 | ||
765 | list_add_tail(&extra_response->er_list, | 765 | list_add_tail(&extra_response->er_list, |
766 | ¶m_list->extra_response_list); | 766 | ¶m_list->extra_response_list); |
@@ -1629,8 +1629,6 @@ int iscsi_decode_text_input( | |||
1629 | 1629 | ||
1630 | if (phase & PHASE_SECURITY) { | 1630 | if (phase & PHASE_SECURITY) { |
1631 | if (iscsi_check_for_auth_key(key) > 0) { | 1631 | if (iscsi_check_for_auth_key(key) > 0) { |
1632 | char *tmpptr = key + strlen(key); | ||
1633 | *tmpptr = '='; | ||
1634 | kfree(tmpbuf); | 1632 | kfree(tmpbuf); |
1635 | return 1; | 1633 | return 1; |
1636 | } | 1634 | } |
@@ -1977,7 +1975,7 @@ void iscsi_set_session_parameters( | |||
1977 | ops->SessionType = !strcmp(param->value, DISCOVERY); | 1975 | ops->SessionType = !strcmp(param->value, DISCOVERY); |
1978 | pr_debug("SessionType: %s\n", | 1976 | pr_debug("SessionType: %s\n", |
1979 | param->value); | 1977 | param->value); |
1980 | } else if (!strcmp(param->name, RDMAEXTENTIONS)) { | 1978 | } else if (!strcmp(param->name, RDMAEXTENSIONS)) { |
1981 | ops->RDMAExtensions = !strcmp(param->value, YES); | 1979 | ops->RDMAExtensions = !strcmp(param->value, YES); |
1982 | pr_debug("RDMAExtensions: %s\n", | 1980 | pr_debug("RDMAExtensions: %s\n", |
1983 | param->value); | 1981 | param->value); |
diff --git a/drivers/target/iscsi/iscsi_target_parameters.h b/drivers/target/iscsi/iscsi_target_parameters.h index f31b9c4b83f2..a47046a752aa 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.h +++ b/drivers/target/iscsi/iscsi_target_parameters.h | |||
@@ -1,8 +1,10 @@ | |||
1 | #ifndef ISCSI_PARAMETERS_H | 1 | #ifndef ISCSI_PARAMETERS_H |
2 | #define ISCSI_PARAMETERS_H | 2 | #define ISCSI_PARAMETERS_H |
3 | 3 | ||
4 | #include <scsi/iscsi_proto.h> | ||
5 | |||
4 | struct iscsi_extra_response { | 6 | struct iscsi_extra_response { |
5 | char key[64]; | 7 | char key[KEY_MAXLEN]; |
6 | char value[32]; | 8 | char value[32]; |
7 | struct list_head er_list; | 9 | struct list_head er_list; |
8 | } ____cacheline_aligned; | 10 | } ____cacheline_aligned; |
@@ -91,7 +93,7 @@ extern void iscsi_set_session_parameters(struct iscsi_sess_ops *, | |||
91 | /* | 93 | /* |
92 | * Parameter names of iSCSI Extentions for RDMA (iSER). See RFC-5046 | 94 | * Parameter names of iSCSI Extentions for RDMA (iSER). See RFC-5046 |
93 | */ | 95 | */ |
94 | #define RDMAEXTENTIONS "RDMAExtensions" | 96 | #define RDMAEXTENSIONS "RDMAExtensions" |
95 | #define INITIATORRECVDATASEGMENTLENGTH "InitiatorRecvDataSegmentLength" | 97 | #define INITIATORRECVDATASEGMENTLENGTH "InitiatorRecvDataSegmentLength" |
96 | #define TARGETRECVDATASEGMENTLENGTH "TargetRecvDataSegmentLength" | 98 | #define TARGETRECVDATASEGMENTLENGTH "TargetRecvDataSegmentLength" |
97 | 99 | ||
@@ -142,7 +144,7 @@ extern void iscsi_set_session_parameters(struct iscsi_sess_ops *, | |||
142 | /* | 144 | /* |
143 | * Initial values for iSER parameters following RFC-5046 Section 6 | 145 | * Initial values for iSER parameters following RFC-5046 Section 6 |
144 | */ | 146 | */ |
145 | #define INITIAL_RDMAEXTENTIONS NO | 147 | #define INITIAL_RDMAEXTENSIONS NO |
146 | #define INITIAL_INITIATORRECVDATASEGMENTLENGTH "262144" | 148 | #define INITIAL_INITIATORRECVDATASEGMENTLENGTH "262144" |
147 | #define INITIAL_TARGETRECVDATASEGMENTLENGTH "8192" | 149 | #define INITIAL_TARGETRECVDATASEGMENTLENGTH "8192" |
148 | 150 | ||
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 2cc6c9a3ffb8..08a3bacef0c5 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -676,40 +676,56 @@ void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *conn) | |||
676 | 676 | ||
677 | void iscsit_release_cmd(struct iscsi_cmd *cmd) | 677 | void iscsit_release_cmd(struct iscsi_cmd *cmd) |
678 | { | 678 | { |
679 | struct iscsi_conn *conn = cmd->conn; | ||
680 | |||
681 | iscsit_free_r2ts_from_list(cmd); | ||
682 | iscsit_free_all_datain_reqs(cmd); | ||
683 | |||
684 | kfree(cmd->buf_ptr); | 679 | kfree(cmd->buf_ptr); |
685 | kfree(cmd->pdu_list); | 680 | kfree(cmd->pdu_list); |
686 | kfree(cmd->seq_list); | 681 | kfree(cmd->seq_list); |
687 | kfree(cmd->tmr_req); | 682 | kfree(cmd->tmr_req); |
688 | kfree(cmd->iov_data); | 683 | kfree(cmd->iov_data); |
689 | 684 | ||
690 | if (conn) { | 685 | kmem_cache_free(lio_cmd_cache, cmd); |
686 | } | ||
687 | |||
688 | static void __iscsit_free_cmd(struct iscsi_cmd *cmd, bool scsi_cmd, | ||
689 | bool check_queues) | ||
690 | { | ||
691 | struct iscsi_conn *conn = cmd->conn; | ||
692 | |||
693 | if (scsi_cmd) { | ||
694 | if (cmd->data_direction == DMA_TO_DEVICE) { | ||
695 | iscsit_stop_dataout_timer(cmd); | ||
696 | iscsit_free_r2ts_from_list(cmd); | ||
697 | } | ||
698 | if (cmd->data_direction == DMA_FROM_DEVICE) | ||
699 | iscsit_free_all_datain_reqs(cmd); | ||
700 | } | ||
701 | |||
702 | if (conn && check_queues) { | ||
691 | iscsit_remove_cmd_from_immediate_queue(cmd, conn); | 703 | iscsit_remove_cmd_from_immediate_queue(cmd, conn); |
692 | iscsit_remove_cmd_from_response_queue(cmd, conn); | 704 | iscsit_remove_cmd_from_response_queue(cmd, conn); |
693 | } | 705 | } |
694 | |||
695 | kmem_cache_free(lio_cmd_cache, cmd); | ||
696 | } | 706 | } |
697 | 707 | ||
698 | void iscsit_free_cmd(struct iscsi_cmd *cmd) | 708 | void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) |
699 | { | 709 | { |
710 | struct se_cmd *se_cmd = NULL; | ||
711 | int rc; | ||
700 | /* | 712 | /* |
701 | * Determine if a struct se_cmd is associated with | 713 | * Determine if a struct se_cmd is associated with |
702 | * this struct iscsi_cmd. | 714 | * this struct iscsi_cmd. |
703 | */ | 715 | */ |
704 | switch (cmd->iscsi_opcode) { | 716 | switch (cmd->iscsi_opcode) { |
705 | case ISCSI_OP_SCSI_CMD: | 717 | case ISCSI_OP_SCSI_CMD: |
706 | if (cmd->data_direction == DMA_TO_DEVICE) | 718 | se_cmd = &cmd->se_cmd; |
707 | iscsit_stop_dataout_timer(cmd); | 719 | __iscsit_free_cmd(cmd, true, shutdown); |
708 | /* | 720 | /* |
709 | * Fallthrough | 721 | * Fallthrough |
710 | */ | 722 | */ |
711 | case ISCSI_OP_SCSI_TMFUNC: | 723 | case ISCSI_OP_SCSI_TMFUNC: |
712 | transport_generic_free_cmd(&cmd->se_cmd, 1); | 724 | rc = transport_generic_free_cmd(&cmd->se_cmd, 1); |
725 | if (!rc && shutdown && se_cmd && se_cmd->se_sess) { | ||
726 | __iscsit_free_cmd(cmd, true, shutdown); | ||
727 | target_put_sess_cmd(se_cmd->se_sess, se_cmd); | ||
728 | } | ||
713 | break; | 729 | break; |
714 | case ISCSI_OP_REJECT: | 730 | case ISCSI_OP_REJECT: |
715 | /* | 731 | /* |
@@ -718,11 +734,19 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd) | |||
718 | * associated cmd->se_cmd needs to be released. | 734 | * associated cmd->se_cmd needs to be released. |
719 | */ | 735 | */ |
720 | if (cmd->se_cmd.se_tfo != NULL) { | 736 | if (cmd->se_cmd.se_tfo != NULL) { |
721 | transport_generic_free_cmd(&cmd->se_cmd, 1); | 737 | se_cmd = &cmd->se_cmd; |
738 | __iscsit_free_cmd(cmd, true, shutdown); | ||
739 | |||
740 | rc = transport_generic_free_cmd(&cmd->se_cmd, 1); | ||
741 | if (!rc && shutdown && se_cmd->se_sess) { | ||
742 | __iscsit_free_cmd(cmd, true, shutdown); | ||
743 | target_put_sess_cmd(se_cmd->se_sess, se_cmd); | ||
744 | } | ||
722 | break; | 745 | break; |
723 | } | 746 | } |
724 | /* Fall-through */ | 747 | /* Fall-through */ |
725 | default: | 748 | default: |
749 | __iscsit_free_cmd(cmd, false, shutdown); | ||
726 | cmd->release_cmd(cmd); | 750 | cmd->release_cmd(cmd); |
727 | break; | 751 | break; |
728 | } | 752 | } |
diff --git a/drivers/target/iscsi/iscsi_target_util.h b/drivers/target/iscsi/iscsi_target_util.h index 4f8e01a47081..a4422659d049 100644 --- a/drivers/target/iscsi/iscsi_target_util.h +++ b/drivers/target/iscsi/iscsi_target_util.h | |||
@@ -29,7 +29,7 @@ extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_co | |||
29 | extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *); | 29 | extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *); |
30 | extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *); | 30 | extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *); |
31 | extern void iscsit_release_cmd(struct iscsi_cmd *); | 31 | extern void iscsit_release_cmd(struct iscsi_cmd *); |
32 | extern void iscsit_free_cmd(struct iscsi_cmd *); | 32 | extern void iscsit_free_cmd(struct iscsi_cmd *, bool); |
33 | extern int iscsit_check_session_usage_count(struct iscsi_session *); | 33 | extern int iscsit_check_session_usage_count(struct iscsi_session *); |
34 | extern void iscsit_dec_session_usage_count(struct iscsi_session *); | 34 | extern void iscsit_dec_session_usage_count(struct iscsi_session *); |
35 | extern void iscsit_inc_session_usage_count(struct iscsi_session *); | 35 | extern void iscsit_inc_session_usage_count(struct iscsi_session *); |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 43b7ac6c5b1c..4a8bd36d3958 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -1584,6 +1584,13 @@ static struct target_core_configfs_attribute target_core_attr_dev_udev_path = { | |||
1584 | .store = target_core_store_dev_udev_path, | 1584 | .store = target_core_store_dev_udev_path, |
1585 | }; | 1585 | }; |
1586 | 1586 | ||
1587 | static ssize_t target_core_show_dev_enable(void *p, char *page) | ||
1588 | { | ||
1589 | struct se_device *dev = p; | ||
1590 | |||
1591 | return snprintf(page, PAGE_SIZE, "%d\n", !!(dev->dev_flags & DF_CONFIGURED)); | ||
1592 | } | ||
1593 | |||
1587 | static ssize_t target_core_store_dev_enable( | 1594 | static ssize_t target_core_store_dev_enable( |
1588 | void *p, | 1595 | void *p, |
1589 | const char *page, | 1596 | const char *page, |
@@ -1609,8 +1616,8 @@ static ssize_t target_core_store_dev_enable( | |||
1609 | static struct target_core_configfs_attribute target_core_attr_dev_enable = { | 1616 | static struct target_core_configfs_attribute target_core_attr_dev_enable = { |
1610 | .attr = { .ca_owner = THIS_MODULE, | 1617 | .attr = { .ca_owner = THIS_MODULE, |
1611 | .ca_name = "enable", | 1618 | .ca_name = "enable", |
1612 | .ca_mode = S_IWUSR }, | 1619 | .ca_mode = S_IRUGO | S_IWUSR }, |
1613 | .show = NULL, | 1620 | .show = target_core_show_dev_enable, |
1614 | .store = target_core_store_dev_enable, | 1621 | .store = target_core_store_dev_enable, |
1615 | }; | 1622 | }; |
1616 | 1623 | ||
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 2e4d655471bc..4630481b6043 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -68,7 +68,6 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) | |||
68 | struct se_dev_entry *deve = se_cmd->se_deve; | 68 | struct se_dev_entry *deve = se_cmd->se_deve; |
69 | 69 | ||
70 | deve->total_cmds++; | 70 | deve->total_cmds++; |
71 | deve->total_bytes += se_cmd->data_length; | ||
72 | 71 | ||
73 | if ((se_cmd->data_direction == DMA_TO_DEVICE) && | 72 | if ((se_cmd->data_direction == DMA_TO_DEVICE) && |
74 | (deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY)) { | 73 | (deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY)) { |
@@ -85,8 +84,6 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) | |||
85 | else if (se_cmd->data_direction == DMA_FROM_DEVICE) | 84 | else if (se_cmd->data_direction == DMA_FROM_DEVICE) |
86 | deve->read_bytes += se_cmd->data_length; | 85 | deve->read_bytes += se_cmd->data_length; |
87 | 86 | ||
88 | deve->deve_cmds++; | ||
89 | |||
90 | se_lun = deve->se_lun; | 87 | se_lun = deve->se_lun; |
91 | se_cmd->se_lun = deve->se_lun; | 88 | se_cmd->se_lun = deve->se_lun; |
92 | se_cmd->pr_res_key = deve->pr_res_key; | 89 | se_cmd->pr_res_key = deve->pr_res_key; |
@@ -275,17 +272,6 @@ int core_free_device_list_for_node( | |||
275 | return 0; | 272 | return 0; |
276 | } | 273 | } |
277 | 274 | ||
278 | void core_dec_lacl_count(struct se_node_acl *se_nacl, struct se_cmd *se_cmd) | ||
279 | { | ||
280 | struct se_dev_entry *deve; | ||
281 | unsigned long flags; | ||
282 | |||
283 | spin_lock_irqsave(&se_nacl->device_list_lock, flags); | ||
284 | deve = se_nacl->device_list[se_cmd->orig_fe_lun]; | ||
285 | deve->deve_cmds--; | ||
286 | spin_unlock_irqrestore(&se_nacl->device_list_lock, flags); | ||
287 | } | ||
288 | |||
289 | void core_update_device_list_access( | 275 | void core_update_device_list_access( |
290 | u32 mapped_lun, | 276 | u32 mapped_lun, |
291 | u32 lun_access, | 277 | u32 lun_access, |
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 58ed683e04ae..b11890d85120 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
@@ -153,10 +153,7 @@ static int fd_configure_device(struct se_device *dev) | |||
153 | struct request_queue *q = bdev_get_queue(inode->i_bdev); | 153 | struct request_queue *q = bdev_get_queue(inode->i_bdev); |
154 | unsigned long long dev_size; | 154 | unsigned long long dev_size; |
155 | 155 | ||
156 | dev->dev_attrib.hw_block_size = | 156 | fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev); |
157 | bdev_logical_block_size(inode->i_bdev); | ||
158 | dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); | ||
159 | |||
160 | /* | 157 | /* |
161 | * Determine the number of bytes from i_size_read() minus | 158 | * Determine the number of bytes from i_size_read() minus |
162 | * one (1) logical sector from underlying struct block_device | 159 | * one (1) logical sector from underlying struct block_device |
@@ -203,9 +200,7 @@ static int fd_configure_device(struct se_device *dev) | |||
203 | goto fail; | 200 | goto fail; |
204 | } | 201 | } |
205 | 202 | ||
206 | dev->dev_attrib.hw_block_size = FD_BLOCKSIZE; | 203 | fd_dev->fd_block_size = FD_BLOCKSIZE; |
207 | dev->dev_attrib.hw_max_sectors = FD_MAX_SECTORS; | ||
208 | |||
209 | /* | 204 | /* |
210 | * Limit UNMAP emulation to 8k Number of LBAs (NoLB) | 205 | * Limit UNMAP emulation to 8k Number of LBAs (NoLB) |
211 | */ | 206 | */ |
@@ -224,8 +219,8 @@ static int fd_configure_device(struct se_device *dev) | |||
224 | dev->dev_attrib.max_write_same_len = 0x1000; | 219 | dev->dev_attrib.max_write_same_len = 0x1000; |
225 | } | 220 | } |
226 | 221 | ||
227 | fd_dev->fd_block_size = dev->dev_attrib.hw_block_size; | 222 | dev->dev_attrib.hw_block_size = fd_dev->fd_block_size; |
228 | 223 | dev->dev_attrib.hw_max_sectors = FD_MAX_SECTORS; | |
229 | dev->dev_attrib.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH; | 224 | dev->dev_attrib.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH; |
230 | 225 | ||
231 | if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) { | 226 | if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) { |
@@ -699,11 +694,12 @@ static sector_t fd_get_blocks(struct se_device *dev) | |||
699 | * to handle underlying block_device resize operations. | 694 | * to handle underlying block_device resize operations. |
700 | */ | 695 | */ |
701 | if (S_ISBLK(i->i_mode)) | 696 | if (S_ISBLK(i->i_mode)) |
702 | dev_size = (i_size_read(i) - fd_dev->fd_block_size); | 697 | dev_size = i_size_read(i); |
703 | else | 698 | else |
704 | dev_size = fd_dev->fd_dev_size; | 699 | dev_size = fd_dev->fd_dev_size; |
705 | 700 | ||
706 | return div_u64(dev_size, dev->dev_attrib.block_size); | 701 | return div_u64(dev_size - dev->dev_attrib.block_size, |
702 | dev->dev_attrib.block_size); | ||
707 | } | 703 | } |
708 | 704 | ||
709 | static struct sbc_ops fd_sbc_ops = { | 705 | static struct sbc_ops fd_sbc_ops = { |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 07f5f94634bb..aa1620abec6d 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -615,6 +615,8 @@ iblock_execute_rw(struct se_cmd *cmd) | |||
615 | rw = WRITE_FUA; | 615 | rw = WRITE_FUA; |
616 | else if (!(q->flush_flags & REQ_FLUSH)) | 616 | else if (!(q->flush_flags & REQ_FLUSH)) |
617 | rw = WRITE_FUA; | 617 | rw = WRITE_FUA; |
618 | else | ||
619 | rw = WRITE; | ||
618 | } else { | 620 | } else { |
619 | rw = WRITE; | 621 | rw = WRITE; |
620 | } | 622 | } |
diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 853bab60e362..18d49df4d0ac 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h | |||
@@ -8,7 +8,6 @@ extern struct t10_alua_lu_gp *default_lu_gp; | |||
8 | struct se_dev_entry *core_get_se_deve_from_rtpi(struct se_node_acl *, u16); | 8 | struct se_dev_entry *core_get_se_deve_from_rtpi(struct se_node_acl *, u16); |
9 | int core_free_device_list_for_node(struct se_node_acl *, | 9 | int core_free_device_list_for_node(struct se_node_acl *, |
10 | struct se_portal_group *); | 10 | struct se_portal_group *); |
11 | void core_dec_lacl_count(struct se_node_acl *, struct se_cmd *); | ||
12 | void core_update_device_list_access(u32, u32, struct se_node_acl *); | 11 | void core_update_device_list_access(u32, u32, struct se_node_acl *); |
13 | int core_enable_device_list_for_node(struct se_lun *, struct se_lun_acl *, | 12 | int core_enable_device_list_for_node(struct se_lun *, struct se_lun_acl *, |
14 | u32, u32, struct se_node_acl *, struct se_portal_group *); | 13 | u32, u32, struct se_node_acl *, struct se_portal_group *); |
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index e0b3c379aa14..0921a64b5550 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c | |||
@@ -291,6 +291,11 @@ rd_execute_rw(struct se_cmd *cmd) | |||
291 | u32 src_len; | 291 | u32 src_len; |
292 | u64 tmp; | 292 | u64 tmp; |
293 | 293 | ||
294 | if (dev->rd_flags & RDF_NULLIO) { | ||
295 | target_complete_cmd(cmd, SAM_STAT_GOOD); | ||
296 | return 0; | ||
297 | } | ||
298 | |||
294 | tmp = cmd->t_task_lba * se_dev->dev_attrib.block_size; | 299 | tmp = cmd->t_task_lba * se_dev->dev_attrib.block_size; |
295 | rd_offset = do_div(tmp, PAGE_SIZE); | 300 | rd_offset = do_div(tmp, PAGE_SIZE); |
296 | rd_page = tmp; | 301 | rd_page = tmp; |
@@ -373,11 +378,12 @@ rd_execute_rw(struct se_cmd *cmd) | |||
373 | } | 378 | } |
374 | 379 | ||
375 | enum { | 380 | enum { |
376 | Opt_rd_pages, Opt_err | 381 | Opt_rd_pages, Opt_rd_nullio, Opt_err |
377 | }; | 382 | }; |
378 | 383 | ||
379 | static match_table_t tokens = { | 384 | static match_table_t tokens = { |
380 | {Opt_rd_pages, "rd_pages=%d"}, | 385 | {Opt_rd_pages, "rd_pages=%d"}, |
386 | {Opt_rd_nullio, "rd_nullio=%d"}, | ||
381 | {Opt_err, NULL} | 387 | {Opt_err, NULL} |
382 | }; | 388 | }; |
383 | 389 | ||
@@ -408,6 +414,14 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev, | |||
408 | " Count: %u\n", rd_dev->rd_page_count); | 414 | " Count: %u\n", rd_dev->rd_page_count); |
409 | rd_dev->rd_flags |= RDF_HAS_PAGE_COUNT; | 415 | rd_dev->rd_flags |= RDF_HAS_PAGE_COUNT; |
410 | break; | 416 | break; |
417 | case Opt_rd_nullio: | ||
418 | match_int(args, &arg); | ||
419 | if (arg != 1) | ||
420 | break; | ||
421 | |||
422 | pr_debug("RAMDISK: Setting NULLIO flag: %d\n", arg); | ||
423 | rd_dev->rd_flags |= RDF_NULLIO; | ||
424 | break; | ||
411 | default: | 425 | default: |
412 | break; | 426 | break; |
413 | } | 427 | } |
@@ -424,8 +438,9 @@ static ssize_t rd_show_configfs_dev_params(struct se_device *dev, char *b) | |||
424 | ssize_t bl = sprintf(b, "TCM RamDisk ID: %u RamDisk Makeup: rd_mcp\n", | 438 | ssize_t bl = sprintf(b, "TCM RamDisk ID: %u RamDisk Makeup: rd_mcp\n", |
425 | rd_dev->rd_dev_id); | 439 | rd_dev->rd_dev_id); |
426 | bl += sprintf(b + bl, " PAGES/PAGE_SIZE: %u*%lu" | 440 | bl += sprintf(b + bl, " PAGES/PAGE_SIZE: %u*%lu" |
427 | " SG_table_count: %u\n", rd_dev->rd_page_count, | 441 | " SG_table_count: %u nullio: %d\n", rd_dev->rd_page_count, |
428 | PAGE_SIZE, rd_dev->sg_table_count); | 442 | PAGE_SIZE, rd_dev->sg_table_count, |
443 | !!(rd_dev->rd_flags & RDF_NULLIO)); | ||
429 | return bl; | 444 | return bl; |
430 | } | 445 | } |
431 | 446 | ||
diff --git a/drivers/target/target_core_rd.h b/drivers/target/target_core_rd.h index 933b38b6e563..1789d1e14395 100644 --- a/drivers/target/target_core_rd.h +++ b/drivers/target/target_core_rd.h | |||
@@ -22,6 +22,7 @@ struct rd_dev_sg_table { | |||
22 | } ____cacheline_aligned; | 22 | } ____cacheline_aligned; |
23 | 23 | ||
24 | #define RDF_HAS_PAGE_COUNT 0x01 | 24 | #define RDF_HAS_PAGE_COUNT 0x01 |
25 | #define RDF_NULLIO 0x02 | ||
25 | 26 | ||
26 | struct rd_dev { | 27 | struct rd_dev { |
27 | struct se_device dev; | 28 | struct se_device dev; |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index f8388b4024aa..21e315874a54 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -65,7 +65,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd); | |||
65 | static void transport_handle_queue_full(struct se_cmd *cmd, | 65 | static void transport_handle_queue_full(struct se_cmd *cmd, |
66 | struct se_device *dev); | 66 | struct se_device *dev); |
67 | static int transport_generic_get_mem(struct se_cmd *cmd); | 67 | static int transport_generic_get_mem(struct se_cmd *cmd); |
68 | static void transport_put_cmd(struct se_cmd *cmd); | 68 | static int transport_put_cmd(struct se_cmd *cmd); |
69 | static void target_complete_ok_work(struct work_struct *work); | 69 | static void target_complete_ok_work(struct work_struct *work); |
70 | 70 | ||
71 | int init_se_kmem_caches(void) | 71 | int init_se_kmem_caches(void) |
@@ -221,6 +221,7 @@ struct se_session *transport_init_session(void) | |||
221 | INIT_LIST_HEAD(&se_sess->sess_list); | 221 | INIT_LIST_HEAD(&se_sess->sess_list); |
222 | INIT_LIST_HEAD(&se_sess->sess_acl_list); | 222 | INIT_LIST_HEAD(&se_sess->sess_acl_list); |
223 | INIT_LIST_HEAD(&se_sess->sess_cmd_list); | 223 | INIT_LIST_HEAD(&se_sess->sess_cmd_list); |
224 | INIT_LIST_HEAD(&se_sess->sess_wait_list); | ||
224 | spin_lock_init(&se_sess->sess_cmd_lock); | 225 | spin_lock_init(&se_sess->sess_cmd_lock); |
225 | kref_init(&se_sess->sess_kref); | 226 | kref_init(&se_sess->sess_kref); |
226 | 227 | ||
@@ -1943,7 +1944,7 @@ static inline void transport_free_pages(struct se_cmd *cmd) | |||
1943 | * This routine unconditionally frees a command, and reference counting | 1944 | * This routine unconditionally frees a command, and reference counting |
1944 | * or list removal must be done in the caller. | 1945 | * or list removal must be done in the caller. |
1945 | */ | 1946 | */ |
1946 | static void transport_release_cmd(struct se_cmd *cmd) | 1947 | static int transport_release_cmd(struct se_cmd *cmd) |
1947 | { | 1948 | { |
1948 | BUG_ON(!cmd->se_tfo); | 1949 | BUG_ON(!cmd->se_tfo); |
1949 | 1950 | ||
@@ -1955,11 +1956,11 @@ static void transport_release_cmd(struct se_cmd *cmd) | |||
1955 | * If this cmd has been setup with target_get_sess_cmd(), drop | 1956 | * If this cmd has been setup with target_get_sess_cmd(), drop |
1956 | * the kref and call ->release_cmd() in kref callback. | 1957 | * the kref and call ->release_cmd() in kref callback. |
1957 | */ | 1958 | */ |
1958 | if (cmd->check_release != 0) { | 1959 | if (cmd->check_release != 0) |
1959 | target_put_sess_cmd(cmd->se_sess, cmd); | 1960 | return target_put_sess_cmd(cmd->se_sess, cmd); |
1960 | return; | 1961 | |
1961 | } | ||
1962 | cmd->se_tfo->release_cmd(cmd); | 1962 | cmd->se_tfo->release_cmd(cmd); |
1963 | return 1; | ||
1963 | } | 1964 | } |
1964 | 1965 | ||
1965 | /** | 1966 | /** |
@@ -1968,7 +1969,7 @@ static void transport_release_cmd(struct se_cmd *cmd) | |||
1968 | * | 1969 | * |
1969 | * This routine releases our reference to the command and frees it if possible. | 1970 | * This routine releases our reference to the command and frees it if possible. |
1970 | */ | 1971 | */ |
1971 | static void transport_put_cmd(struct se_cmd *cmd) | 1972 | static int transport_put_cmd(struct se_cmd *cmd) |
1972 | { | 1973 | { |
1973 | unsigned long flags; | 1974 | unsigned long flags; |
1974 | 1975 | ||
@@ -1976,7 +1977,7 @@ static void transport_put_cmd(struct se_cmd *cmd) | |||
1976 | if (atomic_read(&cmd->t_fe_count) && | 1977 | if (atomic_read(&cmd->t_fe_count) && |
1977 | !atomic_dec_and_test(&cmd->t_fe_count)) { | 1978 | !atomic_dec_and_test(&cmd->t_fe_count)) { |
1978 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 1979 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
1979 | return; | 1980 | return 0; |
1980 | } | 1981 | } |
1981 | 1982 | ||
1982 | if (cmd->transport_state & CMD_T_DEV_ACTIVE) { | 1983 | if (cmd->transport_state & CMD_T_DEV_ACTIVE) { |
@@ -1986,8 +1987,7 @@ static void transport_put_cmd(struct se_cmd *cmd) | |||
1986 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 1987 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
1987 | 1988 | ||
1988 | transport_free_pages(cmd); | 1989 | transport_free_pages(cmd); |
1989 | transport_release_cmd(cmd); | 1990 | return transport_release_cmd(cmd); |
1990 | return; | ||
1991 | } | 1991 | } |
1992 | 1992 | ||
1993 | void *transport_kmap_data_sg(struct se_cmd *cmd) | 1993 | void *transport_kmap_data_sg(struct se_cmd *cmd) |
@@ -2152,24 +2152,25 @@ static void transport_write_pending_qf(struct se_cmd *cmd) | |||
2152 | } | 2152 | } |
2153 | } | 2153 | } |
2154 | 2154 | ||
2155 | void transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) | 2155 | int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) |
2156 | { | 2156 | { |
2157 | int ret = 0; | ||
2158 | |||
2157 | if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) { | 2159 | if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) { |
2158 | if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) | 2160 | if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) |
2159 | transport_wait_for_tasks(cmd); | 2161 | transport_wait_for_tasks(cmd); |
2160 | 2162 | ||
2161 | transport_release_cmd(cmd); | 2163 | ret = transport_release_cmd(cmd); |
2162 | } else { | 2164 | } else { |
2163 | if (wait_for_tasks) | 2165 | if (wait_for_tasks) |
2164 | transport_wait_for_tasks(cmd); | 2166 | transport_wait_for_tasks(cmd); |
2165 | 2167 | ||
2166 | core_dec_lacl_count(cmd->se_sess->se_node_acl, cmd); | ||
2167 | |||
2168 | if (cmd->se_lun) | 2168 | if (cmd->se_lun) |
2169 | transport_lun_remove_cmd(cmd); | 2169 | transport_lun_remove_cmd(cmd); |
2170 | 2170 | ||
2171 | transport_put_cmd(cmd); | 2171 | ret = transport_put_cmd(cmd); |
2172 | } | 2172 | } |
2173 | return ret; | ||
2173 | } | 2174 | } |
2174 | EXPORT_SYMBOL(transport_generic_free_cmd); | 2175 | EXPORT_SYMBOL(transport_generic_free_cmd); |
2175 | 2176 | ||
@@ -2213,21 +2214,19 @@ static void target_release_cmd_kref(struct kref *kref) | |||
2213 | { | 2214 | { |
2214 | struct se_cmd *se_cmd = container_of(kref, struct se_cmd, cmd_kref); | 2215 | struct se_cmd *se_cmd = container_of(kref, struct se_cmd, cmd_kref); |
2215 | struct se_session *se_sess = se_cmd->se_sess; | 2216 | struct se_session *se_sess = se_cmd->se_sess; |
2216 | unsigned long flags; | ||
2217 | 2217 | ||
2218 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); | ||
2219 | if (list_empty(&se_cmd->se_cmd_list)) { | 2218 | if (list_empty(&se_cmd->se_cmd_list)) { |
2220 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2219 | spin_unlock(&se_sess->sess_cmd_lock); |
2221 | se_cmd->se_tfo->release_cmd(se_cmd); | 2220 | se_cmd->se_tfo->release_cmd(se_cmd); |
2222 | return; | 2221 | return; |
2223 | } | 2222 | } |
2224 | if (se_sess->sess_tearing_down && se_cmd->cmd_wait_set) { | 2223 | if (se_sess->sess_tearing_down && se_cmd->cmd_wait_set) { |
2225 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2224 | spin_unlock(&se_sess->sess_cmd_lock); |
2226 | complete(&se_cmd->cmd_wait_comp); | 2225 | complete(&se_cmd->cmd_wait_comp); |
2227 | return; | 2226 | return; |
2228 | } | 2227 | } |
2229 | list_del(&se_cmd->se_cmd_list); | 2228 | list_del(&se_cmd->se_cmd_list); |
2230 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2229 | spin_unlock(&se_sess->sess_cmd_lock); |
2231 | 2230 | ||
2232 | se_cmd->se_tfo->release_cmd(se_cmd); | 2231 | se_cmd->se_tfo->release_cmd(se_cmd); |
2233 | } | 2232 | } |
@@ -2238,7 +2237,8 @@ static void target_release_cmd_kref(struct kref *kref) | |||
2238 | */ | 2237 | */ |
2239 | int target_put_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd) | 2238 | int target_put_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd) |
2240 | { | 2239 | { |
2241 | return kref_put(&se_cmd->cmd_kref, target_release_cmd_kref); | 2240 | return kref_put_spinlock_irqsave(&se_cmd->cmd_kref, target_release_cmd_kref, |
2241 | &se_sess->sess_cmd_lock); | ||
2242 | } | 2242 | } |
2243 | EXPORT_SYMBOL(target_put_sess_cmd); | 2243 | EXPORT_SYMBOL(target_put_sess_cmd); |
2244 | 2244 | ||
@@ -2253,11 +2253,14 @@ void target_sess_cmd_list_set_waiting(struct se_session *se_sess) | |||
2253 | unsigned long flags; | 2253 | unsigned long flags; |
2254 | 2254 | ||
2255 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); | 2255 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); |
2256 | 2256 | if (se_sess->sess_tearing_down) { | |
2257 | WARN_ON(se_sess->sess_tearing_down); | 2257 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
2258 | return; | ||
2259 | } | ||
2258 | se_sess->sess_tearing_down = 1; | 2260 | se_sess->sess_tearing_down = 1; |
2261 | list_splice_init(&se_sess->sess_cmd_list, &se_sess->sess_wait_list); | ||
2259 | 2262 | ||
2260 | list_for_each_entry(se_cmd, &se_sess->sess_cmd_list, se_cmd_list) | 2263 | list_for_each_entry(se_cmd, &se_sess->sess_wait_list, se_cmd_list) |
2261 | se_cmd->cmd_wait_set = 1; | 2264 | se_cmd->cmd_wait_set = 1; |
2262 | 2265 | ||
2263 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2266 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
@@ -2266,44 +2269,32 @@ EXPORT_SYMBOL(target_sess_cmd_list_set_waiting); | |||
2266 | 2269 | ||
2267 | /* target_wait_for_sess_cmds - Wait for outstanding descriptors | 2270 | /* target_wait_for_sess_cmds - Wait for outstanding descriptors |
2268 | * @se_sess: session to wait for active I/O | 2271 | * @se_sess: session to wait for active I/O |
2269 | * @wait_for_tasks: Make extra transport_wait_for_tasks call | ||
2270 | */ | 2272 | */ |
2271 | void target_wait_for_sess_cmds( | 2273 | void target_wait_for_sess_cmds(struct se_session *se_sess) |
2272 | struct se_session *se_sess, | ||
2273 | int wait_for_tasks) | ||
2274 | { | 2274 | { |
2275 | struct se_cmd *se_cmd, *tmp_cmd; | 2275 | struct se_cmd *se_cmd, *tmp_cmd; |
2276 | bool rc = false; | 2276 | unsigned long flags; |
2277 | 2277 | ||
2278 | list_for_each_entry_safe(se_cmd, tmp_cmd, | 2278 | list_for_each_entry_safe(se_cmd, tmp_cmd, |
2279 | &se_sess->sess_cmd_list, se_cmd_list) { | 2279 | &se_sess->sess_wait_list, se_cmd_list) { |
2280 | list_del(&se_cmd->se_cmd_list); | 2280 | list_del(&se_cmd->se_cmd_list); |
2281 | 2281 | ||
2282 | pr_debug("Waiting for se_cmd: %p t_state: %d, fabric state:" | 2282 | pr_debug("Waiting for se_cmd: %p t_state: %d, fabric state:" |
2283 | " %d\n", se_cmd, se_cmd->t_state, | 2283 | " %d\n", se_cmd, se_cmd->t_state, |
2284 | se_cmd->se_tfo->get_cmd_state(se_cmd)); | 2284 | se_cmd->se_tfo->get_cmd_state(se_cmd)); |
2285 | 2285 | ||
2286 | if (wait_for_tasks) { | 2286 | wait_for_completion(&se_cmd->cmd_wait_comp); |
2287 | pr_debug("Calling transport_wait_for_tasks se_cmd: %p t_state: %d," | 2287 | pr_debug("After cmd_wait_comp: se_cmd: %p t_state: %d" |
2288 | " fabric state: %d\n", se_cmd, se_cmd->t_state, | 2288 | " fabric state: %d\n", se_cmd, se_cmd->t_state, |
2289 | se_cmd->se_tfo->get_cmd_state(se_cmd)); | 2289 | se_cmd->se_tfo->get_cmd_state(se_cmd)); |
2290 | |||
2291 | rc = transport_wait_for_tasks(se_cmd); | ||
2292 | |||
2293 | pr_debug("After transport_wait_for_tasks se_cmd: %p t_state: %d," | ||
2294 | " fabric state: %d\n", se_cmd, se_cmd->t_state, | ||
2295 | se_cmd->se_tfo->get_cmd_state(se_cmd)); | ||
2296 | } | ||
2297 | |||
2298 | if (!rc) { | ||
2299 | wait_for_completion(&se_cmd->cmd_wait_comp); | ||
2300 | pr_debug("After cmd_wait_comp: se_cmd: %p t_state: %d" | ||
2301 | " fabric state: %d\n", se_cmd, se_cmd->t_state, | ||
2302 | se_cmd->se_tfo->get_cmd_state(se_cmd)); | ||
2303 | } | ||
2304 | 2290 | ||
2305 | se_cmd->se_tfo->release_cmd(se_cmd); | 2291 | se_cmd->se_tfo->release_cmd(se_cmd); |
2306 | } | 2292 | } |
2293 | |||
2294 | spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); | ||
2295 | WARN_ON(!list_empty(&se_sess->sess_cmd_list)); | ||
2296 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | ||
2297 | |||
2307 | } | 2298 | } |
2308 | EXPORT_SYMBOL(target_wait_for_sess_cmds); | 2299 | EXPORT_SYMBOL(target_wait_for_sess_cmds); |
2309 | 2300 | ||
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 5b4d75fd7b49..54ffd64ca3f7 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c | |||
@@ -169,21 +169,11 @@ static int armada_thermal_probe(struct platform_device *pdev) | |||
169 | return -ENOMEM; | 169 | return -ENOMEM; |
170 | 170 | ||
171 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 171 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
172 | if (!res) { | ||
173 | dev_err(&pdev->dev, "Failed to get platform resource\n"); | ||
174 | return -ENODEV; | ||
175 | } | ||
176 | |||
177 | priv->sensor = devm_ioremap_resource(&pdev->dev, res); | 172 | priv->sensor = devm_ioremap_resource(&pdev->dev, res); |
178 | if (IS_ERR(priv->sensor)) | 173 | if (IS_ERR(priv->sensor)) |
179 | return PTR_ERR(priv->sensor); | 174 | return PTR_ERR(priv->sensor); |
180 | 175 | ||
181 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 176 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
182 | if (!res) { | ||
183 | dev_err(&pdev->dev, "Failed to get platform resource\n"); | ||
184 | return -ENODEV; | ||
185 | } | ||
186 | |||
187 | priv->control = devm_ioremap_resource(&pdev->dev, res); | 177 | priv->control = devm_ioremap_resource(&pdev->dev, res); |
188 | if (IS_ERR(priv->control)) | 178 | if (IS_ERR(priv->control)) |
189 | return PTR_ERR(priv->control); | 179 | return PTR_ERR(priv->control); |
diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 4b15a5f270dc..a088d1365ca5 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c | |||
@@ -149,10 +149,6 @@ static int dove_thermal_probe(struct platform_device *pdev) | |||
149 | return PTR_ERR(priv->sensor); | 149 | return PTR_ERR(priv->sensor); |
150 | 150 | ||
151 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 151 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
152 | if (!res) { | ||
153 | dev_err(&pdev->dev, "Failed to get platform resource\n"); | ||
154 | return -ENODEV; | ||
155 | } | ||
156 | priv->control = devm_ioremap_resource(&pdev->dev, res); | 152 | priv->control = devm_ioremap_resource(&pdev->dev, res); |
157 | if (IS_ERR(priv->control)) | 153 | if (IS_ERR(priv->control)) |
158 | return PTR_ERR(priv->control); | 154 | return PTR_ERR(priv->control); |
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c index d20ce9e61403..788b1ddcac6c 100644 --- a/drivers/thermal/exynos_thermal.c +++ b/drivers/thermal/exynos_thermal.c | |||
@@ -925,11 +925,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) | |||
925 | INIT_WORK(&data->irq_work, exynos_tmu_work); | 925 | INIT_WORK(&data->irq_work, exynos_tmu_work); |
926 | 926 | ||
927 | data->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 927 | data->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
928 | if (!data->mem) { | ||
929 | dev_err(&pdev->dev, "Failed to get platform resource\n"); | ||
930 | return -ENOENT; | ||
931 | } | ||
932 | |||
933 | data->base = devm_ioremap_resource(&pdev->dev, data->mem); | 928 | data->base = devm_ioremap_resource(&pdev->dev, data->mem); |
934 | if (IS_ERR(data->base)) | 929 | if (IS_ERR(data->base)) |
935 | return PTR_ERR(data->base); | 930 | return PTR_ERR(data->base); |
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c index 6d0c27cd03da..9bffcec5ad82 100644 --- a/drivers/tty/ehv_bytechan.c +++ b/drivers/tty/ehv_bytechan.c | |||
@@ -859,6 +859,7 @@ error: | |||
859 | */ | 859 | */ |
860 | static void __exit ehv_bc_exit(void) | 860 | static void __exit ehv_bc_exit(void) |
861 | { | 861 | { |
862 | platform_driver_unregister(&ehv_bc_tty_driver); | ||
862 | tty_unregister_driver(ehv_bc_driver); | 863 | tty_unregister_driver(ehv_bc_driver); |
863 | put_tty_driver(ehv_bc_driver); | 864 | put_tty_driver(ehv_bc_driver); |
864 | kfree(bcs); | 865 | kfree(bcs); |
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 71d6eb2c93b1..4c4a23674569 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c | |||
@@ -1618,8 +1618,12 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1618 | if (ip->type == PORT_16550A) | 1618 | if (ip->type == PORT_16550A) |
1619 | me->fifo[p] = 1; | 1619 | me->fifo[p] = 1; |
1620 | 1620 | ||
1621 | opmode = inb(ip->opmode_ioaddr)>>((p % 4) * 2); | 1621 | if (ip->board->chip_flag == MOXA_MUST_MU860_HWID) { |
1622 | opmode &= OP_MODE_MASK; | 1622 | opmode = inb(ip->opmode_ioaddr)>>((p % 4) * 2); |
1623 | opmode &= OP_MODE_MASK; | ||
1624 | } else { | ||
1625 | opmode = RS232_MODE; | ||
1626 | } | ||
1623 | me->iftype[p] = opmode; | 1627 | me->iftype[p] = opmode; |
1624 | mutex_unlock(&port->mutex); | 1628 | mutex_unlock(&port->mutex); |
1625 | } | 1629 | } |
@@ -1676,6 +1680,9 @@ static int mxser_ioctl(struct tty_struct *tty, | |||
1676 | int shiftbit; | 1680 | int shiftbit; |
1677 | unsigned char val, mask; | 1681 | unsigned char val, mask; |
1678 | 1682 | ||
1683 | if (info->board->chip_flag != MOXA_MUST_MU860_HWID) | ||
1684 | return -EFAULT; | ||
1685 | |||
1679 | p = tty->index % 4; | 1686 | p = tty->index % 4; |
1680 | if (cmd == MOXA_SET_OP_MODE) { | 1687 | if (cmd == MOXA_SET_OP_MODE) { |
1681 | if (get_user(opmode, (int __user *) argp)) | 1688 | if (get_user(opmode, (int __user *) argp)) |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index d655416087b7..6c7fe90ad72d 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -1573,6 +1573,14 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old) | |||
1573 | ldata->real_raw = 0; | 1573 | ldata->real_raw = 0; |
1574 | } | 1574 | } |
1575 | n_tty_set_room(tty); | 1575 | n_tty_set_room(tty); |
1576 | /* | ||
1577 | * Fix tty hang when I_IXON(tty) is cleared, but the tty | ||
1578 | * been stopped by STOP_CHAR(tty) before it. | ||
1579 | */ | ||
1580 | if (!I_IXON(tty) && old && (old->c_iflag & IXON) && !tty->flow_stopped) { | ||
1581 | start_tty(tty); | ||
1582 | } | ||
1583 | |||
1576 | /* The termios change make the tty ready for I/O */ | 1584 | /* The termios change make the tty ready for I/O */ |
1577 | wake_up_interruptible(&tty->write_wait); | 1585 | wake_up_interruptible(&tty->write_wait); |
1578 | wake_up_interruptible(&tty->read_wait); | 1586 | wake_up_interruptible(&tty->read_wait); |
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 59bfaecc4e14..abfd99089781 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -244,14 +244,9 @@ static void pty_flush_buffer(struct tty_struct *tty) | |||
244 | 244 | ||
245 | static int pty_open(struct tty_struct *tty, struct file *filp) | 245 | static int pty_open(struct tty_struct *tty, struct file *filp) |
246 | { | 246 | { |
247 | int retval = -ENODEV; | ||
248 | |||
249 | if (!tty || !tty->link) | 247 | if (!tty || !tty->link) |
250 | goto out; | 248 | return -ENODEV; |
251 | |||
252 | set_bit(TTY_IO_ERROR, &tty->flags); | ||
253 | 249 | ||
254 | retval = -EIO; | ||
255 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | 250 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) |
256 | goto out; | 251 | goto out; |
257 | if (test_bit(TTY_PTY_LOCK, &tty->link->flags)) | 252 | if (test_bit(TTY_PTY_LOCK, &tty->link->flags)) |
@@ -262,9 +257,11 @@ static int pty_open(struct tty_struct *tty, struct file *filp) | |||
262 | clear_bit(TTY_IO_ERROR, &tty->flags); | 257 | clear_bit(TTY_IO_ERROR, &tty->flags); |
263 | clear_bit(TTY_OTHER_CLOSED, &tty->link->flags); | 258 | clear_bit(TTY_OTHER_CLOSED, &tty->link->flags); |
264 | set_bit(TTY_THROTTLED, &tty->flags); | 259 | set_bit(TTY_THROTTLED, &tty->flags); |
265 | retval = 0; | 260 | return 0; |
261 | |||
266 | out: | 262 | out: |
267 | return retval; | 263 | set_bit(TTY_IO_ERROR, &tty->flags); |
264 | return -EIO; | ||
268 | } | 265 | } |
269 | 266 | ||
270 | static void pty_set_termios(struct tty_struct *tty, | 267 | static void pty_set_termios(struct tty_struct *tty, |
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index 82d35c5a58fd..354564ea47c5 100644 --- a/drivers/tty/rocket.c +++ b/drivers/tty/rocket.c | |||
@@ -150,12 +150,14 @@ static Word_t aiop_intr_bits[AIOP_CTL_SIZE] = { | |||
150 | AIOP_INTR_BIT_3 | 150 | AIOP_INTR_BIT_3 |
151 | }; | 151 | }; |
152 | 152 | ||
153 | #ifdef CONFIG_PCI | ||
153 | static Word_t upci_aiop_intr_bits[AIOP_CTL_SIZE] = { | 154 | static Word_t upci_aiop_intr_bits[AIOP_CTL_SIZE] = { |
154 | UPCI_AIOP_INTR_BIT_0, | 155 | UPCI_AIOP_INTR_BIT_0, |
155 | UPCI_AIOP_INTR_BIT_1, | 156 | UPCI_AIOP_INTR_BIT_1, |
156 | UPCI_AIOP_INTR_BIT_2, | 157 | UPCI_AIOP_INTR_BIT_2, |
157 | UPCI_AIOP_INTR_BIT_3 | 158 | UPCI_AIOP_INTR_BIT_3 |
158 | }; | 159 | }; |
160 | #endif | ||
159 | 161 | ||
160 | static Byte_t RData[RDATASIZE] = { | 162 | static Byte_t RData[RDATASIZE] = { |
161 | 0x00, 0x09, 0xf6, 0x82, | 163 | 0x00, 0x09, 0xf6, 0x82, |
@@ -227,7 +229,6 @@ static unsigned long nextLineNumber; | |||
227 | static int __init init_ISA(int i); | 229 | static int __init init_ISA(int i); |
228 | static void rp_wait_until_sent(struct tty_struct *tty, int timeout); | 230 | static void rp_wait_until_sent(struct tty_struct *tty, int timeout); |
229 | static void rp_flush_buffer(struct tty_struct *tty); | 231 | static void rp_flush_buffer(struct tty_struct *tty); |
230 | static void rmSpeakerReset(CONTROLLER_T * CtlP, unsigned long model); | ||
231 | static unsigned char GetLineNumber(int ctrl, int aiop, int ch); | 232 | static unsigned char GetLineNumber(int ctrl, int aiop, int ch); |
232 | static unsigned char SetLineNumber(int ctrl, int aiop, int ch); | 233 | static unsigned char SetLineNumber(int ctrl, int aiop, int ch); |
233 | static void rp_start(struct tty_struct *tty); | 234 | static void rp_start(struct tty_struct *tty); |
@@ -241,11 +242,6 @@ static void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags); | |||
241 | static void sModemReset(CONTROLLER_T * CtlP, int chan, int on); | 242 | static void sModemReset(CONTROLLER_T * CtlP, int chan, int on); |
242 | static void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on); | 243 | static void sPCIModemReset(CONTROLLER_T * CtlP, int chan, int on); |
243 | static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data); | 244 | static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data); |
244 | static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum, | ||
245 | ByteIO_t * AiopIOList, int AiopIOListSize, | ||
246 | WordIO_t ConfigIO, int IRQNum, Byte_t Frequency, | ||
247 | int PeriodicOnly, int altChanRingIndicator, | ||
248 | int UPCIRingInd); | ||
249 | static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO, | 245 | static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO, |
250 | ByteIO_t * AiopIOList, int AiopIOListSize, | 246 | ByteIO_t * AiopIOList, int AiopIOListSize, |
251 | int IRQNum, Byte_t Frequency, int PeriodicOnly); | 247 | int IRQNum, Byte_t Frequency, int PeriodicOnly); |
@@ -1775,6 +1771,145 @@ static DEFINE_PCI_DEVICE_TABLE(rocket_pci_ids) = { | |||
1775 | }; | 1771 | }; |
1776 | MODULE_DEVICE_TABLE(pci, rocket_pci_ids); | 1772 | MODULE_DEVICE_TABLE(pci, rocket_pci_ids); |
1777 | 1773 | ||
1774 | /* Resets the speaker controller on RocketModem II and III devices */ | ||
1775 | static void rmSpeakerReset(CONTROLLER_T * CtlP, unsigned long model) | ||
1776 | { | ||
1777 | ByteIO_t addr; | ||
1778 | |||
1779 | /* RocketModem II speaker control is at the 8th port location of offset 0x40 */ | ||
1780 | if ((model == MODEL_RP4M) || (model == MODEL_RP6M)) { | ||
1781 | addr = CtlP->AiopIO[0] + 0x4F; | ||
1782 | sOutB(addr, 0); | ||
1783 | } | ||
1784 | |||
1785 | /* RocketModem III speaker control is at the 1st port location of offset 0x80 */ | ||
1786 | if ((model == MODEL_UPCI_RM3_8PORT) | ||
1787 | || (model == MODEL_UPCI_RM3_4PORT)) { | ||
1788 | addr = CtlP->AiopIO[0] + 0x88; | ||
1789 | sOutB(addr, 0); | ||
1790 | } | ||
1791 | } | ||
1792 | |||
1793 | /*************************************************************************** | ||
1794 | Function: sPCIInitController | ||
1795 | Purpose: Initialization of controller global registers and controller | ||
1796 | structure. | ||
1797 | Call: sPCIInitController(CtlP,CtlNum,AiopIOList,AiopIOListSize, | ||
1798 | IRQNum,Frequency,PeriodicOnly) | ||
1799 | CONTROLLER_T *CtlP; Ptr to controller structure | ||
1800 | int CtlNum; Controller number | ||
1801 | ByteIO_t *AiopIOList; List of I/O addresses for each AIOP. | ||
1802 | This list must be in the order the AIOPs will be found on the | ||
1803 | controller. Once an AIOP in the list is not found, it is | ||
1804 | assumed that there are no more AIOPs on the controller. | ||
1805 | int AiopIOListSize; Number of addresses in AiopIOList | ||
1806 | int IRQNum; Interrupt Request number. Can be any of the following: | ||
1807 | 0: Disable global interrupts | ||
1808 | 3: IRQ 3 | ||
1809 | 4: IRQ 4 | ||
1810 | 5: IRQ 5 | ||
1811 | 9: IRQ 9 | ||
1812 | 10: IRQ 10 | ||
1813 | 11: IRQ 11 | ||
1814 | 12: IRQ 12 | ||
1815 | 15: IRQ 15 | ||
1816 | Byte_t Frequency: A flag identifying the frequency | ||
1817 | of the periodic interrupt, can be any one of the following: | ||
1818 | FREQ_DIS - periodic interrupt disabled | ||
1819 | FREQ_137HZ - 137 Hertz | ||
1820 | FREQ_69HZ - 69 Hertz | ||
1821 | FREQ_34HZ - 34 Hertz | ||
1822 | FREQ_17HZ - 17 Hertz | ||
1823 | FREQ_9HZ - 9 Hertz | ||
1824 | FREQ_4HZ - 4 Hertz | ||
1825 | If IRQNum is set to 0 the Frequency parameter is | ||
1826 | overidden, it is forced to a value of FREQ_DIS. | ||
1827 | int PeriodicOnly: 1 if all interrupts except the periodic | ||
1828 | interrupt are to be blocked. | ||
1829 | 0 is both the periodic interrupt and | ||
1830 | other channel interrupts are allowed. | ||
1831 | If IRQNum is set to 0 the PeriodicOnly parameter is | ||
1832 | overidden, it is forced to a value of 0. | ||
1833 | Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller | ||
1834 | initialization failed. | ||
1835 | |||
1836 | Comments: | ||
1837 | If periodic interrupts are to be disabled but AIOP interrupts | ||
1838 | are allowed, set Frequency to FREQ_DIS and PeriodicOnly to 0. | ||
1839 | |||
1840 | If interrupts are to be completely disabled set IRQNum to 0. | ||
1841 | |||
1842 | Setting Frequency to FREQ_DIS and PeriodicOnly to 1 is an | ||
1843 | invalid combination. | ||
1844 | |||
1845 | This function performs initialization of global interrupt modes, | ||
1846 | but it does not actually enable global interrupts. To enable | ||
1847 | and disable global interrupts use functions sEnGlobalInt() and | ||
1848 | sDisGlobalInt(). Enabling of global interrupts is normally not | ||
1849 | done until all other initializations are complete. | ||
1850 | |||
1851 | Even if interrupts are globally enabled, they must also be | ||
1852 | individually enabled for each channel that is to generate | ||
1853 | interrupts. | ||
1854 | |||
1855 | Warnings: No range checking on any of the parameters is done. | ||
1856 | |||
1857 | No context switches are allowed while executing this function. | ||
1858 | |||
1859 | After this function all AIOPs on the controller are disabled, | ||
1860 | they can be enabled with sEnAiop(). | ||
1861 | */ | ||
1862 | static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum, | ||
1863 | ByteIO_t * AiopIOList, int AiopIOListSize, | ||
1864 | WordIO_t ConfigIO, int IRQNum, Byte_t Frequency, | ||
1865 | int PeriodicOnly, int altChanRingIndicator, | ||
1866 | int UPCIRingInd) | ||
1867 | { | ||
1868 | int i; | ||
1869 | ByteIO_t io; | ||
1870 | |||
1871 | CtlP->AltChanRingIndicator = altChanRingIndicator; | ||
1872 | CtlP->UPCIRingInd = UPCIRingInd; | ||
1873 | CtlP->CtlNum = CtlNum; | ||
1874 | CtlP->CtlID = CTLID_0001; /* controller release 1 */ | ||
1875 | CtlP->BusType = isPCI; /* controller release 1 */ | ||
1876 | |||
1877 | if (ConfigIO) { | ||
1878 | CtlP->isUPCI = 1; | ||
1879 | CtlP->PCIIO = ConfigIO + _PCI_9030_INT_CTRL; | ||
1880 | CtlP->PCIIO2 = ConfigIO + _PCI_9030_GPIO_CTRL; | ||
1881 | CtlP->AiopIntrBits = upci_aiop_intr_bits; | ||
1882 | } else { | ||
1883 | CtlP->isUPCI = 0; | ||
1884 | CtlP->PCIIO = | ||
1885 | (WordIO_t) ((ByteIO_t) AiopIOList[0] + _PCI_INT_FUNC); | ||
1886 | CtlP->AiopIntrBits = aiop_intr_bits; | ||
1887 | } | ||
1888 | |||
1889 | sPCIControllerEOI(CtlP); /* clear EOI if warm init */ | ||
1890 | /* Init AIOPs */ | ||
1891 | CtlP->NumAiop = 0; | ||
1892 | for (i = 0; i < AiopIOListSize; i++) { | ||
1893 | io = AiopIOList[i]; | ||
1894 | CtlP->AiopIO[i] = (WordIO_t) io; | ||
1895 | CtlP->AiopIntChanIO[i] = io + _INT_CHAN; | ||
1896 | |||
1897 | CtlP->AiopID[i] = sReadAiopID(io); /* read AIOP ID */ | ||
1898 | if (CtlP->AiopID[i] == AIOPID_NULL) /* if AIOP does not exist */ | ||
1899 | break; /* done looking for AIOPs */ | ||
1900 | |||
1901 | CtlP->AiopNumChan[i] = sReadAiopNumChan((WordIO_t) io); /* num channels in AIOP */ | ||
1902 | sOutW((WordIO_t) io + _INDX_ADDR, _CLK_PRE); /* clock prescaler */ | ||
1903 | sOutB(io + _INDX_DATA, sClockPrescale); | ||
1904 | CtlP->NumAiop++; /* bump count of AIOPs */ | ||
1905 | } | ||
1906 | |||
1907 | if (CtlP->NumAiop == 0) | ||
1908 | return (-1); | ||
1909 | else | ||
1910 | return (CtlP->NumAiop); | ||
1911 | } | ||
1912 | |||
1778 | /* | 1913 | /* |
1779 | * Called when a PCI card is found. Retrieves and stores model information, | 1914 | * Called when a PCI card is found. Retrieves and stores model information, |
1780 | * init's aiopic and serial port hardware. | 1915 | * init's aiopic and serial port hardware. |
@@ -2519,147 +2654,6 @@ static int sInitController(CONTROLLER_T * CtlP, int CtlNum, ByteIO_t MudbacIO, | |||
2519 | return (CtlP->NumAiop); | 2654 | return (CtlP->NumAiop); |
2520 | } | 2655 | } |
2521 | 2656 | ||
2522 | #ifdef CONFIG_PCI | ||
2523 | /*************************************************************************** | ||
2524 | Function: sPCIInitController | ||
2525 | Purpose: Initialization of controller global registers and controller | ||
2526 | structure. | ||
2527 | Call: sPCIInitController(CtlP,CtlNum,AiopIOList,AiopIOListSize, | ||
2528 | IRQNum,Frequency,PeriodicOnly) | ||
2529 | CONTROLLER_T *CtlP; Ptr to controller structure | ||
2530 | int CtlNum; Controller number | ||
2531 | ByteIO_t *AiopIOList; List of I/O addresses for each AIOP. | ||
2532 | This list must be in the order the AIOPs will be found on the | ||
2533 | controller. Once an AIOP in the list is not found, it is | ||
2534 | assumed that there are no more AIOPs on the controller. | ||
2535 | int AiopIOListSize; Number of addresses in AiopIOList | ||
2536 | int IRQNum; Interrupt Request number. Can be any of the following: | ||
2537 | 0: Disable global interrupts | ||
2538 | 3: IRQ 3 | ||
2539 | 4: IRQ 4 | ||
2540 | 5: IRQ 5 | ||
2541 | 9: IRQ 9 | ||
2542 | 10: IRQ 10 | ||
2543 | 11: IRQ 11 | ||
2544 | 12: IRQ 12 | ||
2545 | 15: IRQ 15 | ||
2546 | Byte_t Frequency: A flag identifying the frequency | ||
2547 | of the periodic interrupt, can be any one of the following: | ||
2548 | FREQ_DIS - periodic interrupt disabled | ||
2549 | FREQ_137HZ - 137 Hertz | ||
2550 | FREQ_69HZ - 69 Hertz | ||
2551 | FREQ_34HZ - 34 Hertz | ||
2552 | FREQ_17HZ - 17 Hertz | ||
2553 | FREQ_9HZ - 9 Hertz | ||
2554 | FREQ_4HZ - 4 Hertz | ||
2555 | If IRQNum is set to 0 the Frequency parameter is | ||
2556 | overidden, it is forced to a value of FREQ_DIS. | ||
2557 | int PeriodicOnly: 1 if all interrupts except the periodic | ||
2558 | interrupt are to be blocked. | ||
2559 | 0 is both the periodic interrupt and | ||
2560 | other channel interrupts are allowed. | ||
2561 | If IRQNum is set to 0 the PeriodicOnly parameter is | ||
2562 | overidden, it is forced to a value of 0. | ||
2563 | Return: int: Number of AIOPs on the controller, or CTLID_NULL if controller | ||
2564 | initialization failed. | ||
2565 | |||
2566 | Comments: | ||
2567 | If periodic interrupts are to be disabled but AIOP interrupts | ||
2568 | are allowed, set Frequency to FREQ_DIS and PeriodicOnly to 0. | ||
2569 | |||
2570 | If interrupts are to be completely disabled set IRQNum to 0. | ||
2571 | |||
2572 | Setting Frequency to FREQ_DIS and PeriodicOnly to 1 is an | ||
2573 | invalid combination. | ||
2574 | |||
2575 | This function performs initialization of global interrupt modes, | ||
2576 | but it does not actually enable global interrupts. To enable | ||
2577 | and disable global interrupts use functions sEnGlobalInt() and | ||
2578 | sDisGlobalInt(). Enabling of global interrupts is normally not | ||
2579 | done until all other initializations are complete. | ||
2580 | |||
2581 | Even if interrupts are globally enabled, they must also be | ||
2582 | individually enabled for each channel that is to generate | ||
2583 | interrupts. | ||
2584 | |||
2585 | Warnings: No range checking on any of the parameters is done. | ||
2586 | |||
2587 | No context switches are allowed while executing this function. | ||
2588 | |||
2589 | After this function all AIOPs on the controller are disabled, | ||
2590 | they can be enabled with sEnAiop(). | ||
2591 | */ | ||
2592 | static int sPCIInitController(CONTROLLER_T * CtlP, int CtlNum, | ||
2593 | ByteIO_t * AiopIOList, int AiopIOListSize, | ||
2594 | WordIO_t ConfigIO, int IRQNum, Byte_t Frequency, | ||
2595 | int PeriodicOnly, int altChanRingIndicator, | ||
2596 | int UPCIRingInd) | ||
2597 | { | ||
2598 | int i; | ||
2599 | ByteIO_t io; | ||
2600 | |||
2601 | CtlP->AltChanRingIndicator = altChanRingIndicator; | ||
2602 | CtlP->UPCIRingInd = UPCIRingInd; | ||
2603 | CtlP->CtlNum = CtlNum; | ||
2604 | CtlP->CtlID = CTLID_0001; /* controller release 1 */ | ||
2605 | CtlP->BusType = isPCI; /* controller release 1 */ | ||
2606 | |||
2607 | if (ConfigIO) { | ||
2608 | CtlP->isUPCI = 1; | ||
2609 | CtlP->PCIIO = ConfigIO + _PCI_9030_INT_CTRL; | ||
2610 | CtlP->PCIIO2 = ConfigIO + _PCI_9030_GPIO_CTRL; | ||
2611 | CtlP->AiopIntrBits = upci_aiop_intr_bits; | ||
2612 | } else { | ||
2613 | CtlP->isUPCI = 0; | ||
2614 | CtlP->PCIIO = | ||
2615 | (WordIO_t) ((ByteIO_t) AiopIOList[0] + _PCI_INT_FUNC); | ||
2616 | CtlP->AiopIntrBits = aiop_intr_bits; | ||
2617 | } | ||
2618 | |||
2619 | sPCIControllerEOI(CtlP); /* clear EOI if warm init */ | ||
2620 | /* Init AIOPs */ | ||
2621 | CtlP->NumAiop = 0; | ||
2622 | for (i = 0; i < AiopIOListSize; i++) { | ||
2623 | io = AiopIOList[i]; | ||
2624 | CtlP->AiopIO[i] = (WordIO_t) io; | ||
2625 | CtlP->AiopIntChanIO[i] = io + _INT_CHAN; | ||
2626 | |||
2627 | CtlP->AiopID[i] = sReadAiopID(io); /* read AIOP ID */ | ||
2628 | if (CtlP->AiopID[i] == AIOPID_NULL) /* if AIOP does not exist */ | ||
2629 | break; /* done looking for AIOPs */ | ||
2630 | |||
2631 | CtlP->AiopNumChan[i] = sReadAiopNumChan((WordIO_t) io); /* num channels in AIOP */ | ||
2632 | sOutW((WordIO_t) io + _INDX_ADDR, _CLK_PRE); /* clock prescaler */ | ||
2633 | sOutB(io + _INDX_DATA, sClockPrescale); | ||
2634 | CtlP->NumAiop++; /* bump count of AIOPs */ | ||
2635 | } | ||
2636 | |||
2637 | if (CtlP->NumAiop == 0) | ||
2638 | return (-1); | ||
2639 | else | ||
2640 | return (CtlP->NumAiop); | ||
2641 | } | ||
2642 | |||
2643 | /* Resets the speaker controller on RocketModem II and III devices */ | ||
2644 | static void rmSpeakerReset(CONTROLLER_T * CtlP, unsigned long model) | ||
2645 | { | ||
2646 | ByteIO_t addr; | ||
2647 | |||
2648 | /* RocketModem II speaker control is at the 8th port location of offset 0x40 */ | ||
2649 | if ((model == MODEL_RP4M) || (model == MODEL_RP6M)) { | ||
2650 | addr = CtlP->AiopIO[0] + 0x4F; | ||
2651 | sOutB(addr, 0); | ||
2652 | } | ||
2653 | |||
2654 | /* RocketModem III speaker control is at the 1st port location of offset 0x80 */ | ||
2655 | if ((model == MODEL_UPCI_RM3_8PORT) | ||
2656 | || (model == MODEL_UPCI_RM3_4PORT)) { | ||
2657 | addr = CtlP->AiopIO[0] + 0x88; | ||
2658 | sOutB(addr, 0); | ||
2659 | } | ||
2660 | } | ||
2661 | #endif | ||
2662 | |||
2663 | /*************************************************************************** | 2657 | /*************************************************************************** |
2664 | Function: sReadAiopID | 2658 | Function: sReadAiopID |
2665 | Purpose: Read the AIOP idenfication number directly from an AIOP. | 2659 | Purpose: Read the AIOP idenfication number directly from an AIOP. |
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 46528d57be72..86c00b1c5583 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -2755,7 +2755,7 @@ static void __init serial8250_isa_init_ports(void) | |||
2755 | if (nr_uarts > UART_NR) | 2755 | if (nr_uarts > UART_NR) |
2756 | nr_uarts = UART_NR; | 2756 | nr_uarts = UART_NR; |
2757 | 2757 | ||
2758 | for (i = 0; i < UART_NR; i++) { | 2758 | for (i = 0; i < nr_uarts; i++) { |
2759 | struct uart_8250_port *up = &serial8250_ports[i]; | 2759 | struct uart_8250_port *up = &serial8250_ports[i]; |
2760 | struct uart_port *port = &up->port; | 2760 | struct uart_port *port = &up->port; |
2761 | 2761 | ||
@@ -2916,7 +2916,7 @@ static int __init serial8250_console_setup(struct console *co, char *options) | |||
2916 | * if so, search for the first available port that does have | 2916 | * if so, search for the first available port that does have |
2917 | * console support. | 2917 | * console support. |
2918 | */ | 2918 | */ |
2919 | if (co->index >= UART_NR) | 2919 | if (co->index >= nr_uarts) |
2920 | co->index = 0; | 2920 | co->index = 0; |
2921 | port = &serial8250_ports[co->index].port; | 2921 | port = &serial8250_ports[co->index].port; |
2922 | if (!port->iobase && !port->membase) | 2922 | if (!port->iobase && !port->membase) |
@@ -2957,7 +2957,7 @@ int serial8250_find_port(struct uart_port *p) | |||
2957 | int line; | 2957 | int line; |
2958 | struct uart_port *port; | 2958 | struct uart_port *port; |
2959 | 2959 | ||
2960 | for (line = 0; line < UART_NR; line++) { | 2960 | for (line = 0; line < nr_uarts; line++) { |
2961 | port = &serial8250_ports[line].port; | 2961 | port = &serial8250_ports[line].port; |
2962 | if (uart_match_port(p, port)) | 2962 | if (uart_match_port(p, port)) |
2963 | return line; | 2963 | return line; |
@@ -3110,7 +3110,7 @@ static int serial8250_remove(struct platform_device *dev) | |||
3110 | { | 3110 | { |
3111 | int i; | 3111 | int i; |
3112 | 3112 | ||
3113 | for (i = 0; i < UART_NR; i++) { | 3113 | for (i = 0; i < nr_uarts; i++) { |
3114 | struct uart_8250_port *up = &serial8250_ports[i]; | 3114 | struct uart_8250_port *up = &serial8250_ports[i]; |
3115 | 3115 | ||
3116 | if (up->port.dev == &dev->dev) | 3116 | if (up->port.dev == &dev->dev) |
@@ -3178,7 +3178,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port * | |||
3178 | /* | 3178 | /* |
3179 | * First, find a port entry which matches. | 3179 | * First, find a port entry which matches. |
3180 | */ | 3180 | */ |
3181 | for (i = 0; i < UART_NR; i++) | 3181 | for (i = 0; i < nr_uarts; i++) |
3182 | if (uart_match_port(&serial8250_ports[i].port, port)) | 3182 | if (uart_match_port(&serial8250_ports[i].port, port)) |
3183 | return &serial8250_ports[i]; | 3183 | return &serial8250_ports[i]; |
3184 | 3184 | ||
@@ -3187,7 +3187,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port * | |||
3187 | * free entry. We look for one which hasn't been previously | 3187 | * free entry. We look for one which hasn't been previously |
3188 | * used (indicated by zero iobase). | 3188 | * used (indicated by zero iobase). |
3189 | */ | 3189 | */ |
3190 | for (i = 0; i < UART_NR; i++) | 3190 | for (i = 0; i < nr_uarts; i++) |
3191 | if (serial8250_ports[i].port.type == PORT_UNKNOWN && | 3191 | if (serial8250_ports[i].port.type == PORT_UNKNOWN && |
3192 | serial8250_ports[i].port.iobase == 0) | 3192 | serial8250_ports[i].port.iobase == 0) |
3193 | return &serial8250_ports[i]; | 3193 | return &serial8250_ports[i]; |
@@ -3196,7 +3196,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port * | |||
3196 | * That also failed. Last resort is to find any entry which | 3196 | * That also failed. Last resort is to find any entry which |
3197 | * doesn't have a real port associated with it. | 3197 | * doesn't have a real port associated with it. |
3198 | */ | 3198 | */ |
3199 | for (i = 0; i < UART_NR; i++) | 3199 | for (i = 0; i < nr_uarts; i++) |
3200 | if (serial8250_ports[i].port.type == PORT_UNKNOWN) | 3200 | if (serial8250_ports[i].port.type == PORT_UNKNOWN) |
3201 | return &serial8250_ports[i]; | 3201 | return &serial8250_ports[i]; |
3202 | 3202 | ||
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index beaa283f5cc6..d07b6af3a937 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c | |||
@@ -338,7 +338,8 @@ static int dw8250_runtime_suspend(struct device *dev) | |||
338 | { | 338 | { |
339 | struct dw8250_data *data = dev_get_drvdata(dev); | 339 | struct dw8250_data *data = dev_get_drvdata(dev); |
340 | 340 | ||
341 | clk_disable_unprepare(data->clk); | 341 | if (!IS_ERR(data->clk)) |
342 | clk_disable_unprepare(data->clk); | ||
342 | 343 | ||
343 | return 0; | 344 | return 0; |
344 | } | 345 | } |
@@ -347,7 +348,8 @@ static int dw8250_runtime_resume(struct device *dev) | |||
347 | { | 348 | { |
348 | struct dw8250_data *data = dev_get_drvdata(dev); | 349 | struct dw8250_data *data = dev_get_drvdata(dev); |
349 | 350 | ||
350 | clk_prepare_enable(data->clk); | 351 | if (!IS_ERR(data->clk)) |
352 | clk_prepare_enable(data->clk); | ||
351 | 353 | ||
352 | return 0; | 354 | return 0; |
353 | } | 355 | } |
@@ -367,6 +369,7 @@ MODULE_DEVICE_TABLE(of, dw8250_of_match); | |||
367 | static const struct acpi_device_id dw8250_acpi_match[] = { | 369 | static const struct acpi_device_id dw8250_acpi_match[] = { |
368 | { "INT33C4", 0 }, | 370 | { "INT33C4", 0 }, |
369 | { "INT33C5", 0 }, | 371 | { "INT33C5", 0 }, |
372 | { "80860F0A", 0 }, | ||
370 | { }, | 373 | { }, |
371 | }; | 374 | }; |
372 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); | 375 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); |
diff --git a/drivers/tty/serial/8250/8250_gsc.c b/drivers/tty/serial/8250/8250_gsc.c index 097dff9c08ad..bb91b4713ebd 100644 --- a/drivers/tty/serial/8250/8250_gsc.c +++ b/drivers/tty/serial/8250/8250_gsc.c | |||
@@ -30,6 +30,12 @@ static int __init serial_init_chip(struct parisc_device *dev) | |||
30 | unsigned long address; | 30 | unsigned long address; |
31 | int err; | 31 | int err; |
32 | 32 | ||
33 | #ifdef CONFIG_64BIT | ||
34 | extern int iosapic_serial_irq(int cellnum); | ||
35 | if (!dev->irq && (dev->id.sversion == 0xad)) | ||
36 | dev->irq = iosapic_serial_irq(dev->mod_index-1); | ||
37 | #endif | ||
38 | |||
33 | if (!dev->irq) { | 39 | if (!dev->irq) { |
34 | /* We find some unattached serial ports by walking native | 40 | /* We find some unattached serial ports by walking native |
35 | * busses. These should be silently ignored. Otherwise, | 41 | * busses. These should be silently ignored. Otherwise, |
@@ -51,7 +57,8 @@ static int __init serial_init_chip(struct parisc_device *dev) | |||
51 | memset(&uart, 0, sizeof(uart)); | 57 | memset(&uart, 0, sizeof(uart)); |
52 | uart.port.iotype = UPIO_MEM; | 58 | uart.port.iotype = UPIO_MEM; |
53 | /* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */ | 59 | /* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */ |
54 | uart.port.uartclk = 7272727; | 60 | uart.port.uartclk = (dev->id.sversion != 0xad) ? |
61 | 7272727 : 1843200; | ||
55 | uart.port.mapbase = address; | 62 | uart.port.mapbase = address; |
56 | uart.port.membase = ioremap_nocache(address, 16); | 63 | uart.port.membase = ioremap_nocache(address, 16); |
57 | uart.port.irq = dev->irq; | 64 | uart.port.irq = dev->irq; |
@@ -73,6 +80,7 @@ static struct parisc_device_id serial_tbl[] = { | |||
73 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 }, | 80 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 }, |
74 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c }, | 81 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c }, |
75 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d }, | 82 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d }, |
83 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x000ad }, | ||
76 | { 0 } | 84 | { 0 } |
77 | }; | 85 | }; |
78 | 86 | ||
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 8ab70a620919..e2774f9ecd59 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -332,7 +332,7 @@ static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port * | |||
332 | dmaengine_slave_config(chan, &rx_conf); | 332 | dmaengine_slave_config(chan, &rx_conf); |
333 | uap->dmarx.chan = chan; | 333 | uap->dmarx.chan = chan; |
334 | 334 | ||
335 | if (plat->dma_rx_poll_enable) { | 335 | if (plat && plat->dma_rx_poll_enable) { |
336 | /* Set poll rate if specified. */ | 336 | /* Set poll rate if specified. */ |
337 | if (plat->dma_rx_poll_rate) { | 337 | if (plat->dma_rx_poll_rate) { |
338 | uap->dmarx.auto_poll_rate = false; | 338 | uap->dmarx.auto_poll_rate = false; |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 147c9e193595..8cdfbd365892 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -761,6 +761,8 @@ static int imx_startup(struct uart_port *port) | |||
761 | 761 | ||
762 | temp = readl(sport->port.membase + UCR2); | 762 | temp = readl(sport->port.membase + UCR2); |
763 | temp |= (UCR2_RXEN | UCR2_TXEN); | 763 | temp |= (UCR2_RXEN | UCR2_TXEN); |
764 | if (!sport->have_rtscts) | ||
765 | temp |= UCR2_IRTS; | ||
764 | writel(temp, sport->port.membase + UCR2); | 766 | writel(temp, sport->port.membase + UCR2); |
765 | 767 | ||
766 | if (USE_IRDA(sport)) { | 768 | if (USE_IRDA(sport)) { |
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c index e956377a38fe..65be0c00c4bf 100644 --- a/drivers/tty/serial/mcf.c +++ b/drivers/tty/serial/mcf.c | |||
@@ -707,8 +707,10 @@ static int __init mcf_init(void) | |||
707 | if (rc) | 707 | if (rc) |
708 | return rc; | 708 | return rc; |
709 | rc = platform_driver_register(&mcf_platform_driver); | 709 | rc = platform_driver_register(&mcf_platform_driver); |
710 | if (rc) | 710 | if (rc) { |
711 | uart_unregister_driver(&mcf_driver); | ||
711 | return rc; | 712 | return rc; |
713 | } | ||
712 | return 0; | 714 | return 0; |
713 | } | 715 | } |
714 | 716 | ||
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c index 018bad922554..f51b280f3bf2 100644 --- a/drivers/tty/serial/mpc52xx_uart.c +++ b/drivers/tty/serial/mpc52xx_uart.c | |||
@@ -1497,18 +1497,23 @@ mpc52xx_uart_init(void) | |||
1497 | if (psc_ops && psc_ops->fifoc_init) { | 1497 | if (psc_ops && psc_ops->fifoc_init) { |
1498 | ret = psc_ops->fifoc_init(); | 1498 | ret = psc_ops->fifoc_init(); |
1499 | if (ret) | 1499 | if (ret) |
1500 | return ret; | 1500 | goto err_init; |
1501 | } | 1501 | } |
1502 | 1502 | ||
1503 | ret = platform_driver_register(&mpc52xx_uart_of_driver); | 1503 | ret = platform_driver_register(&mpc52xx_uart_of_driver); |
1504 | if (ret) { | 1504 | if (ret) { |
1505 | printk(KERN_ERR "%s: platform_driver_register failed (%i)\n", | 1505 | printk(KERN_ERR "%s: platform_driver_register failed (%i)\n", |
1506 | __FILE__, ret); | 1506 | __FILE__, ret); |
1507 | uart_unregister_driver(&mpc52xx_uart_driver); | 1507 | goto err_reg; |
1508 | return ret; | ||
1509 | } | 1508 | } |
1510 | 1509 | ||
1511 | return 0; | 1510 | return 0; |
1511 | err_reg: | ||
1512 | if (psc_ops && psc_ops->fifoc_uninit) | ||
1513 | psc_ops->fifoc_uninit(); | ||
1514 | err_init: | ||
1515 | uart_unregister_driver(&mpc52xx_uart_driver); | ||
1516 | return ret; | ||
1512 | } | 1517 | } |
1513 | 1518 | ||
1514 | static void __exit | 1519 | static void __exit |
diff --git a/drivers/tty/serial/nwpserial.c b/drivers/tty/serial/nwpserial.c index 77287c54f331..549c70a2a63e 100644 --- a/drivers/tty/serial/nwpserial.c +++ b/drivers/tty/serial/nwpserial.c | |||
@@ -199,7 +199,7 @@ static void nwpserial_shutdown(struct uart_port *port) | |||
199 | dcr_write(up->dcr_host, UART_IER, up->ier); | 199 | dcr_write(up->dcr_host, UART_IER, up->ier); |
200 | 200 | ||
201 | /* free irq */ | 201 | /* free irq */ |
202 | free_irq(up->port.irq, port); | 202 | free_irq(up->port.irq, up); |
203 | } | 203 | } |
204 | 204 | ||
205 | static int nwpserial_verify_port(struct uart_port *port, | 205 | static int nwpserial_verify_port(struct uart_port *port, |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 30d4f7a783cd..f0b9f6b52b32 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -202,26 +202,6 @@ static int serial_omap_get_context_loss_count(struct uart_omap_port *up) | |||
202 | return pdata->get_context_loss_count(up->dev); | 202 | return pdata->get_context_loss_count(up->dev); |
203 | } | 203 | } |
204 | 204 | ||
205 | static void serial_omap_set_forceidle(struct uart_omap_port *up) | ||
206 | { | ||
207 | struct omap_uart_port_info *pdata = up->dev->platform_data; | ||
208 | |||
209 | if (!pdata || !pdata->set_forceidle) | ||
210 | return; | ||
211 | |||
212 | pdata->set_forceidle(up->dev); | ||
213 | } | ||
214 | |||
215 | static void serial_omap_set_noidle(struct uart_omap_port *up) | ||
216 | { | ||
217 | struct omap_uart_port_info *pdata = up->dev->platform_data; | ||
218 | |||
219 | if (!pdata || !pdata->set_noidle) | ||
220 | return; | ||
221 | |||
222 | pdata->set_noidle(up->dev); | ||
223 | } | ||
224 | |||
225 | static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable) | 205 | static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable) |
226 | { | 206 | { |
227 | struct omap_uart_port_info *pdata = up->dev->platform_data; | 207 | struct omap_uart_port_info *pdata = up->dev->platform_data; |
@@ -298,8 +278,6 @@ static void serial_omap_stop_tx(struct uart_port *port) | |||
298 | serial_out(up, UART_IER, up->ier); | 278 | serial_out(up, UART_IER, up->ier); |
299 | } | 279 | } |
300 | 280 | ||
301 | serial_omap_set_forceidle(up); | ||
302 | |||
303 | pm_runtime_mark_last_busy(up->dev); | 281 | pm_runtime_mark_last_busy(up->dev); |
304 | pm_runtime_put_autosuspend(up->dev); | 282 | pm_runtime_put_autosuspend(up->dev); |
305 | } | 283 | } |
@@ -364,7 +342,6 @@ static void serial_omap_start_tx(struct uart_port *port) | |||
364 | 342 | ||
365 | pm_runtime_get_sync(up->dev); | 343 | pm_runtime_get_sync(up->dev); |
366 | serial_omap_enable_ier_thri(up); | 344 | serial_omap_enable_ier_thri(up); |
367 | serial_omap_set_noidle(up); | ||
368 | pm_runtime_mark_last_busy(up->dev); | 345 | pm_runtime_mark_last_busy(up->dev); |
369 | pm_runtime_put_autosuspend(up->dev); | 346 | pm_runtime_put_autosuspend(up->dev); |
370 | } | 347 | } |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 074b9194144f..0c8a9fa2be6c 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -1166,6 +1166,18 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
1166 | ourport->tx_irq = ret; | 1166 | ourport->tx_irq = ret; |
1167 | 1167 | ||
1168 | ourport->clk = clk_get(&platdev->dev, "uart"); | 1168 | ourport->clk = clk_get(&platdev->dev, "uart"); |
1169 | if (IS_ERR(ourport->clk)) { | ||
1170 | pr_err("%s: Controller clock not found\n", | ||
1171 | dev_name(&platdev->dev)); | ||
1172 | return PTR_ERR(ourport->clk); | ||
1173 | } | ||
1174 | |||
1175 | ret = clk_prepare_enable(ourport->clk); | ||
1176 | if (ret) { | ||
1177 | pr_err("uart: clock failed to prepare+enable: %d\n", ret); | ||
1178 | clk_put(ourport->clk); | ||
1179 | return ret; | ||
1180 | } | ||
1169 | 1181 | ||
1170 | /* Keep all interrupts masked and cleared */ | 1182 | /* Keep all interrupts masked and cleared */ |
1171 | if (s3c24xx_serial_has_interrupt_mask(port)) { | 1183 | if (s3c24xx_serial_has_interrupt_mask(port)) { |
@@ -1180,6 +1192,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
1180 | 1192 | ||
1181 | /* reset the fifos (and setup the uart) */ | 1193 | /* reset the fifos (and setup the uart) */ |
1182 | s3c24xx_serial_resetport(port, cfg); | 1194 | s3c24xx_serial_resetport(port, cfg); |
1195 | clk_disable_unprepare(ourport->clk); | ||
1183 | return 0; | 1196 | return 0; |
1184 | } | 1197 | } |
1185 | 1198 | ||
@@ -1803,6 +1816,7 @@ static int __init s3c24xx_serial_modinit(void) | |||
1803 | 1816 | ||
1804 | static void __exit s3c24xx_serial_modexit(void) | 1817 | static void __exit s3c24xx_serial_modexit(void) |
1805 | { | 1818 | { |
1819 | platform_driver_unregister(&samsung_serial_driver); | ||
1806 | uart_unregister_driver(&s3c24xx_uart_drv); | 1820 | uart_unregister_driver(&s3c24xx_uart_drv); |
1807 | } | 1821 | } |
1808 | 1822 | ||
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index fbd447b390f7..740202d8a5c4 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -779,7 +779,6 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ | |||
779 | con_set_default_unimap(vc); | 779 | con_set_default_unimap(vc); |
780 | vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL); | 780 | vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL); |
781 | if (!vc->vc_screenbuf) { | 781 | if (!vc->vc_screenbuf) { |
782 | tty_port_destroy(&vc->port); | ||
783 | kfree(vc); | 782 | kfree(vc); |
784 | vc_cons[currcons].d = NULL; | 783 | vc_cons[currcons].d = NULL; |
785 | return -ENOMEM; | 784 | return -ENOMEM; |
@@ -986,26 +985,25 @@ static int vt_resize(struct tty_struct *tty, struct winsize *ws) | |||
986 | return ret; | 985 | return ret; |
987 | } | 986 | } |
988 | 987 | ||
989 | void vc_deallocate(unsigned int currcons) | 988 | struct vc_data *vc_deallocate(unsigned int currcons) |
990 | { | 989 | { |
990 | struct vc_data *vc = NULL; | ||
991 | |||
991 | WARN_CONSOLE_UNLOCKED(); | 992 | WARN_CONSOLE_UNLOCKED(); |
992 | 993 | ||
993 | if (vc_cons_allocated(currcons)) { | 994 | if (vc_cons_allocated(currcons)) { |
994 | struct vc_data *vc = vc_cons[currcons].d; | 995 | struct vt_notifier_param param; |
995 | struct vt_notifier_param param = { .vc = vc }; | ||
996 | 996 | ||
997 | param.vc = vc = vc_cons[currcons].d; | ||
997 | atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, ¶m); | 998 | atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, ¶m); |
998 | vcs_remove_sysfs(currcons); | 999 | vcs_remove_sysfs(currcons); |
999 | vc->vc_sw->con_deinit(vc); | 1000 | vc->vc_sw->con_deinit(vc); |
1000 | put_pid(vc->vt_pid); | 1001 | put_pid(vc->vt_pid); |
1001 | module_put(vc->vc_sw->owner); | 1002 | module_put(vc->vc_sw->owner); |
1002 | kfree(vc->vc_screenbuf); | 1003 | kfree(vc->vc_screenbuf); |
1003 | if (currcons >= MIN_NR_CONSOLES) { | ||
1004 | tty_port_destroy(&vc->port); | ||
1005 | kfree(vc); | ||
1006 | } | ||
1007 | vc_cons[currcons].d = NULL; | 1004 | vc_cons[currcons].d = NULL; |
1008 | } | 1005 | } |
1006 | return vc; | ||
1009 | } | 1007 | } |
1010 | 1008 | ||
1011 | /* | 1009 | /* |
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 98ff1735eafc..2bd78e2ac8ec 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c | |||
@@ -283,6 +283,48 @@ do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, struct vc_ | |||
283 | return 0; | 283 | return 0; |
284 | } | 284 | } |
285 | 285 | ||
286 | /* deallocate a single console, if possible (leave 0) */ | ||
287 | static int vt_disallocate(unsigned int vc_num) | ||
288 | { | ||
289 | struct vc_data *vc = NULL; | ||
290 | int ret = 0; | ||
291 | |||
292 | console_lock(); | ||
293 | if (VT_BUSY(vc_num)) | ||
294 | ret = -EBUSY; | ||
295 | else if (vc_num) | ||
296 | vc = vc_deallocate(vc_num); | ||
297 | console_unlock(); | ||
298 | |||
299 | if (vc && vc_num >= MIN_NR_CONSOLES) { | ||
300 | tty_port_destroy(&vc->port); | ||
301 | kfree(vc); | ||
302 | } | ||
303 | |||
304 | return ret; | ||
305 | } | ||
306 | |||
307 | /* deallocate all unused consoles, but leave 0 */ | ||
308 | static void vt_disallocate_all(void) | ||
309 | { | ||
310 | struct vc_data *vc[MAX_NR_CONSOLES]; | ||
311 | int i; | ||
312 | |||
313 | console_lock(); | ||
314 | for (i = 1; i < MAX_NR_CONSOLES; i++) | ||
315 | if (!VT_BUSY(i)) | ||
316 | vc[i] = vc_deallocate(i); | ||
317 | else | ||
318 | vc[i] = NULL; | ||
319 | console_unlock(); | ||
320 | |||
321 | for (i = 1; i < MAX_NR_CONSOLES; i++) { | ||
322 | if (vc[i] && i >= MIN_NR_CONSOLES) { | ||
323 | tty_port_destroy(&vc[i]->port); | ||
324 | kfree(vc[i]); | ||
325 | } | ||
326 | } | ||
327 | } | ||
286 | 328 | ||
287 | 329 | ||
288 | /* | 330 | /* |
@@ -769,24 +811,10 @@ int vt_ioctl(struct tty_struct *tty, | |||
769 | ret = -ENXIO; | 811 | ret = -ENXIO; |
770 | break; | 812 | break; |
771 | } | 813 | } |
772 | if (arg == 0) { | 814 | if (arg == 0) |
773 | /* deallocate all unused consoles, but leave 0 */ | 815 | vt_disallocate_all(); |
774 | console_lock(); | 816 | else |
775 | for (i=1; i<MAX_NR_CONSOLES; i++) | 817 | ret = vt_disallocate(--arg); |
776 | if (! VT_BUSY(i)) | ||
777 | vc_deallocate(i); | ||
778 | console_unlock(); | ||
779 | } else { | ||
780 | /* deallocate a single console, if possible */ | ||
781 | arg--; | ||
782 | if (VT_BUSY(arg)) | ||
783 | ret = -EBUSY; | ||
784 | else if (arg) { /* leave 0 */ | ||
785 | console_lock(); | ||
786 | vc_deallocate(arg); | ||
787 | console_unlock(); | ||
788 | } | ||
789 | } | ||
790 | break; | 818 | break; |
791 | 819 | ||
792 | case VT_RESIZE: | 820 | case VT_RESIZE: |
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index e92eeaf251fe..5295be0342c1 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig | |||
@@ -45,6 +45,7 @@ config UIO_PDRV_GENIRQ | |||
45 | 45 | ||
46 | config UIO_DMEM_GENIRQ | 46 | config UIO_DMEM_GENIRQ |
47 | tristate "Userspace platform driver with generic irq and dynamic memory" | 47 | tristate "Userspace platform driver with generic irq and dynamic memory" |
48 | depends on HAS_DMA | ||
48 | help | 49 | help |
49 | Platform driver for Userspace I/O devices, including generic | 50 | Platform driver for Userspace I/O devices, including generic |
50 | interrupt handling code. Shared interrupts are not supported. | 51 | interrupt handling code. Shared interrupts are not supported. |
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index b7eb86ad6bf2..8a7eb77233b4 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -686,7 +686,8 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ | |||
686 | { | 686 | { |
687 | int ret, len; | 687 | int ret, len; |
688 | __le32 *buf; | 688 | __le32 *buf; |
689 | int offb, offd; | 689 | int offb; |
690 | unsigned int offd; | ||
690 | const int stride = CMD_PACKET_SIZE / (4 * 2) - 1; | 691 | const int stride = CMD_PACKET_SIZE / (4 * 2) - 1; |
691 | int buflen = ((size - 1) / stride + 1 + size * 2) * 4; | 692 | int buflen = ((size - 1) / stride + 1 + size * 2) * 4; |
692 | 693 | ||
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig index 608a2aeb400c..b2df442eb3e5 100644 --- a/drivers/usb/chipidea/Kconfig +++ b/drivers/usb/chipidea/Kconfig | |||
@@ -20,7 +20,7 @@ config USB_CHIPIDEA_UDC | |||
20 | config USB_CHIPIDEA_HOST | 20 | config USB_CHIPIDEA_HOST |
21 | bool "ChipIdea host controller" | 21 | bool "ChipIdea host controller" |
22 | depends on USB=y || USB=USB_CHIPIDEA | 22 | depends on USB=y || USB=USB_CHIPIDEA |
23 | depends on USB_EHCI_HCD | 23 | depends on USB_EHCI_HCD=y |
24 | select USB_EHCI_ROOT_HUB_TT | 24 | select USB_EHCI_ROOT_HUB_TT |
25 | help | 25 | help |
26 | Say Y here to enable host controller functionality of the | 26 | Say Y here to enable host controller functionality of the |
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c index 8faec9dbbb84..73f9d5f15adb 100644 --- a/drivers/usb/chipidea/ci13xxx_imx.c +++ b/drivers/usb/chipidea/ci13xxx_imx.c | |||
@@ -173,17 +173,10 @@ static int ci13xxx_imx_probe(struct platform_device *pdev) | |||
173 | 173 | ||
174 | ci13xxx_imx_platdata.phy = data->phy; | 174 | ci13xxx_imx_platdata.phy = data->phy; |
175 | 175 | ||
176 | if (!pdev->dev.dma_mask) { | 176 | if (!pdev->dev.dma_mask) |
177 | pdev->dev.dma_mask = devm_kzalloc(&pdev->dev, | 177 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
178 | sizeof(*pdev->dev.dma_mask), GFP_KERNEL); | 178 | if (!pdev->dev.coherent_dma_mask) |
179 | if (!pdev->dev.dma_mask) { | 179 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |
180 | ret = -ENOMEM; | ||
181 | dev_err(&pdev->dev, "Failed to alloc dma_mask!\n"); | ||
182 | goto err; | ||
183 | } | ||
184 | *pdev->dev.dma_mask = DMA_BIT_MASK(32); | ||
185 | dma_set_coherent_mask(&pdev->dev, *pdev->dev.dma_mask); | ||
186 | } | ||
187 | 180 | ||
188 | if (usbmisc_ops && usbmisc_ops->init) { | 181 | if (usbmisc_ops && usbmisc_ops->init) { |
189 | ret = usbmisc_ops->init(&pdev->dev); | 182 | ret = usbmisc_ops->init(&pdev->dev); |
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 450107e5f657..475c9c114689 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -276,8 +276,9 @@ static void ci_role_work(struct work_struct *work) | |||
276 | 276 | ||
277 | ci_role_stop(ci); | 277 | ci_role_stop(ci); |
278 | ci_role_start(ci, role); | 278 | ci_role_start(ci, role); |
279 | enable_irq(ci->irq); | ||
280 | } | 279 | } |
280 | |||
281 | enable_irq(ci->irq); | ||
281 | } | 282 | } |
282 | 283 | ||
283 | static irqreturn_t ci_irq(int irq, void *data) | 284 | static irqreturn_t ci_irq(int irq, void *data) |
@@ -370,11 +371,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
370 | } | 371 | } |
371 | 372 | ||
372 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 373 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
373 | if (!res) { | ||
374 | dev_err(dev, "missing resource\n"); | ||
375 | return -ENODEV; | ||
376 | } | ||
377 | |||
378 | base = devm_ioremap_resource(dev, res); | 374 | base = devm_ioremap_resource(dev, res); |
379 | if (IS_ERR(base)) | 375 | if (IS_ERR(base)) |
380 | return PTR_ERR(base); | 376 | return PTR_ERR(base); |
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 519ead2443c5..b501346484ae 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -1678,8 +1678,11 @@ static int udc_start(struct ci13xxx *ci) | |||
1678 | 1678 | ||
1679 | ci->gadget.ep0 = &ci->ep0in->ep; | 1679 | ci->gadget.ep0 = &ci->ep0in->ep; |
1680 | 1680 | ||
1681 | if (ci->global_phy) | 1681 | if (ci->global_phy) { |
1682 | ci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); | 1682 | ci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); |
1683 | if (IS_ERR(ci->transceiver)) | ||
1684 | ci->transceiver = NULL; | ||
1685 | } | ||
1683 | 1686 | ||
1684 | if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) { | 1687 | if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) { |
1685 | if (ci->transceiver == NULL) { | 1688 | if (ci->transceiver == NULL) { |
@@ -1694,7 +1697,7 @@ static int udc_start(struct ci13xxx *ci) | |||
1694 | goto put_transceiver; | 1697 | goto put_transceiver; |
1695 | } | 1698 | } |
1696 | 1699 | ||
1697 | if (!IS_ERR_OR_NULL(ci->transceiver)) { | 1700 | if (ci->transceiver) { |
1698 | retval = otg_set_peripheral(ci->transceiver->otg, | 1701 | retval = otg_set_peripheral(ci->transceiver->otg, |
1699 | &ci->gadget); | 1702 | &ci->gadget); |
1700 | if (retval) | 1703 | if (retval) |
@@ -1711,7 +1714,7 @@ static int udc_start(struct ci13xxx *ci) | |||
1711 | return retval; | 1714 | return retval; |
1712 | 1715 | ||
1713 | remove_trans: | 1716 | remove_trans: |
1714 | if (!IS_ERR_OR_NULL(ci->transceiver)) { | 1717 | if (ci->transceiver) { |
1715 | otg_set_peripheral(ci->transceiver->otg, NULL); | 1718 | otg_set_peripheral(ci->transceiver->otg, NULL); |
1716 | if (ci->global_phy) | 1719 | if (ci->global_phy) |
1717 | usb_put_phy(ci->transceiver); | 1720 | usb_put_phy(ci->transceiver); |
@@ -1719,7 +1722,7 @@ remove_trans: | |||
1719 | 1722 | ||
1720 | dev_err(dev, "error = %i\n", retval); | 1723 | dev_err(dev, "error = %i\n", retval); |
1721 | put_transceiver: | 1724 | put_transceiver: |
1722 | if (!IS_ERR_OR_NULL(ci->transceiver) && ci->global_phy) | 1725 | if (ci->transceiver && ci->global_phy) |
1723 | usb_put_phy(ci->transceiver); | 1726 | usb_put_phy(ci->transceiver); |
1724 | destroy_eps: | 1727 | destroy_eps: |
1725 | destroy_eps(ci); | 1728 | destroy_eps(ci); |
@@ -1747,7 +1750,7 @@ static void udc_stop(struct ci13xxx *ci) | |||
1747 | dma_pool_destroy(ci->td_pool); | 1750 | dma_pool_destroy(ci->td_pool); |
1748 | dma_pool_destroy(ci->qh_pool); | 1751 | dma_pool_destroy(ci->qh_pool); |
1749 | 1752 | ||
1750 | if (!IS_ERR_OR_NULL(ci->transceiver)) { | 1753 | if (ci->transceiver) { |
1751 | otg_set_peripheral(ci->transceiver->otg, NULL); | 1754 | otg_set_peripheral(ci->transceiver->otg, NULL); |
1752 | if (ci->global_phy) | 1755 | if (ci->global_phy) |
1753 | usb_put_phy(ci->transceiver); | 1756 | usb_put_phy(ci->transceiver); |
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index 8772b3659296..db535b0aa172 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -51,7 +51,7 @@ config USB_DYNAMIC_MINORS | |||
51 | 51 | ||
52 | config USB_OTG | 52 | config USB_OTG |
53 | bool "OTG support" | 53 | bool "OTG support" |
54 | depends on USB_SUSPEND | 54 | depends on PM_RUNTIME |
55 | default n | 55 | default n |
56 | help | 56 | help |
57 | The most notable feature of USB OTG is support for a | 57 | The most notable feature of USB OTG is support for a |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index caefc800f298..c88c4fb9459d 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -1287,9 +1287,13 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1287 | goto error; | 1287 | goto error; |
1288 | } | 1288 | } |
1289 | for (totlen = u = 0; u < uurb->number_of_packets; u++) { | 1289 | for (totlen = u = 0; u < uurb->number_of_packets; u++) { |
1290 | /* arbitrary limit, | 1290 | /* |
1291 | * sufficient for USB 2.0 high-bandwidth iso */ | 1291 | * arbitrary limit need for USB 3.0 |
1292 | if (isopkt[u].length > 8192) { | 1292 | * bMaxBurst (0~15 allowed, 1~16 packets) |
1293 | * bmAttributes (bit 1:0, mult 0~2, 1~3 packets) | ||
1294 | * sizemax: 1024 * 16 * 3 = 49152 | ||
1295 | */ | ||
1296 | if (isopkt[u].length > 49152) { | ||
1293 | ret = -EINVAL; | 1297 | ret = -EINVAL; |
1294 | goto error; | 1298 | goto error; |
1295 | } | 1299 | } |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index ab5638d9c707..a63598895077 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -88,6 +88,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
88 | /* Edirol SD-20 */ | 88 | /* Edirol SD-20 */ |
89 | { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, | 89 | { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, |
90 | 90 | ||
91 | /* Alcor Micro Corp. Hub */ | ||
92 | { USB_DEVICE(0x058f, 0x9254), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
93 | |||
91 | /* appletouch */ | 94 | /* appletouch */ |
92 | { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME }, | 95 | { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME }, |
93 | 96 | ||
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index ea5ee9c21c35..757aa18027d0 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig | |||
@@ -19,21 +19,21 @@ choice | |||
19 | 19 | ||
20 | config USB_DWC3_HOST | 20 | config USB_DWC3_HOST |
21 | bool "Host only mode" | 21 | bool "Host only mode" |
22 | depends on USB | 22 | depends on USB=y || USB=USB_DWC3 |
23 | help | 23 | help |
24 | Select this when you want to use DWC3 in host mode only, | 24 | Select this when you want to use DWC3 in host mode only, |
25 | thereby the gadget feature will be regressed. | 25 | thereby the gadget feature will be regressed. |
26 | 26 | ||
27 | config USB_DWC3_GADGET | 27 | config USB_DWC3_GADGET |
28 | bool "Gadget only mode" | 28 | bool "Gadget only mode" |
29 | depends on USB_GADGET | 29 | depends on USB_GADGET=y || USB_GADGET=USB_DWC3 |
30 | help | 30 | help |
31 | Select this when you want to use DWC3 in gadget mode only, | 31 | Select this when you want to use DWC3 in gadget mode only, |
32 | thereby the host feature will be regressed. | 32 | thereby the host feature will be regressed. |
33 | 33 | ||
34 | config USB_DWC3_DUAL_ROLE | 34 | config USB_DWC3_DUAL_ROLE |
35 | bool "Dual Role mode" | 35 | bool "Dual Role mode" |
36 | depends on (USB && USB_GADGET) | 36 | depends on ((USB=y || USB=USB_DWC3) && (USB_GADGET=y || USB_GADGET=USB_DWC3)) |
37 | help | 37 | help |
38 | This is the default mode of working of DWC3 controller where | 38 | This is the default mode of working of DWC3 controller where |
39 | both host and gadget features are enabled. | 39 | both host and gadget features are enabled. |
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index a8afe6e26621..8ce9d7fd6cfc 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c | |||
@@ -95,8 +95,6 @@ static int dwc3_exynos_remove_child(struct device *dev, void *unused) | |||
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | 97 | ||
98 | static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32); | ||
99 | |||
100 | static int dwc3_exynos_probe(struct platform_device *pdev) | 98 | static int dwc3_exynos_probe(struct platform_device *pdev) |
101 | { | 99 | { |
102 | struct dwc3_exynos *exynos; | 100 | struct dwc3_exynos *exynos; |
@@ -118,7 +116,9 @@ static int dwc3_exynos_probe(struct platform_device *pdev) | |||
118 | * Once we move to full device tree support this will vanish off. | 116 | * Once we move to full device tree support this will vanish off. |
119 | */ | 117 | */ |
120 | if (!dev->dma_mask) | 118 | if (!dev->dma_mask) |
121 | dev->dma_mask = &dwc3_exynos_dma_mask; | 119 | dev->dma_mask = &dev->coherent_dma_mask; |
120 | if (!dev->coherent_dma_mask) | ||
121 | dev->coherent_dma_mask = DMA_BIT_MASK(32); | ||
122 | 122 | ||
123 | platform_set_drvdata(pdev, exynos); | 123 | platform_set_drvdata(pdev, exynos); |
124 | 124 | ||
@@ -164,9 +164,9 @@ static int dwc3_exynos_remove(struct platform_device *pdev) | |||
164 | { | 164 | { |
165 | struct dwc3_exynos *exynos = platform_get_drvdata(pdev); | 165 | struct dwc3_exynos *exynos = platform_get_drvdata(pdev); |
166 | 166 | ||
167 | device_for_each_child(&pdev->dev, NULL, dwc3_exynos_remove_child); | ||
167 | platform_device_unregister(exynos->usb2_phy); | 168 | platform_device_unregister(exynos->usb2_phy); |
168 | platform_device_unregister(exynos->usb3_phy); | 169 | platform_device_unregister(exynos->usb3_phy); |
169 | device_for_each_child(&pdev->dev, NULL, dwc3_exynos_remove_child); | ||
170 | 170 | ||
171 | clk_disable_unprepare(exynos->clk); | 171 | clk_disable_unprepare(exynos->clk); |
172 | 172 | ||
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 227d4a7acad7..eba9e2baf32b 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -196,9 +196,9 @@ static void dwc3_pci_remove(struct pci_dev *pci) | |||
196 | { | 196 | { |
197 | struct dwc3_pci *glue = pci_get_drvdata(pci); | 197 | struct dwc3_pci *glue = pci_get_drvdata(pci); |
198 | 198 | ||
199 | platform_device_unregister(glue->dwc3); | ||
199 | platform_device_unregister(glue->usb2_phy); | 200 | platform_device_unregister(glue->usb2_phy); |
200 | platform_device_unregister(glue->usb3_phy); | 201 | platform_device_unregister(glue->usb3_phy); |
201 | platform_device_unregister(glue->dwc3); | ||
202 | pci_set_drvdata(pci, NULL); | 202 | pci_set_drvdata(pci, NULL); |
203 | pci_disable_device(pci); | 203 | pci_disable_device(pci); |
204 | } | 204 | } |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 2b6e7e001207..b5e5b35df49c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -1706,11 +1706,19 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc) | |||
1706 | dep = dwc->eps[epnum]; | 1706 | dep = dwc->eps[epnum]; |
1707 | if (!dep) | 1707 | if (!dep) |
1708 | continue; | 1708 | continue; |
1709 | 1709 | /* | |
1710 | dwc3_free_trb_pool(dep); | 1710 | * Physical endpoints 0 and 1 are special; they form the |
1711 | 1711 | * bi-directional USB endpoint 0. | |
1712 | if (epnum != 0 && epnum != 1) | 1712 | * |
1713 | * For those two physical endpoints, we don't allocate a TRB | ||
1714 | * pool nor do we add them the endpoints list. Due to that, we | ||
1715 | * shouldn't do these two operations otherwise we would end up | ||
1716 | * with all sorts of bugs when removing dwc3.ko. | ||
1717 | */ | ||
1718 | if (epnum != 0 && epnum != 1) { | ||
1719 | dwc3_free_trb_pool(dep); | ||
1713 | list_del(&dep->endpoint.ep_list); | 1720 | list_del(&dep->endpoint.ep_list); |
1721 | } | ||
1714 | 1722 | ||
1715 | kfree(dep); | 1723 | kfree(dep); |
1716 | } | 1724 | } |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 83300d94a893..f41aa0d0c414 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -146,7 +146,6 @@ config USB_LPC32XX | |||
146 | depends on ARCH_LPC32XX | 146 | depends on ARCH_LPC32XX |
147 | depends on USB_PHY | 147 | depends on USB_PHY |
148 | select USB_ISP1301 | 148 | select USB_ISP1301 |
149 | select USB_OTG_UTILS | ||
150 | help | 149 | help |
151 | This option selects the USB device controller in the LPC32xx SoC. | 150 | This option selects the USB device controller in the LPC32xx SoC. |
152 | 151 | ||
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index f2a970f75bfa..5a5128a226f7 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -1992,8 +1992,6 @@ err_map_regs: | |||
1992 | err_get_hclk: | 1992 | err_get_hclk: |
1993 | clk_put(pclk); | 1993 | clk_put(pclk); |
1994 | 1994 | ||
1995 | platform_set_drvdata(pdev, NULL); | ||
1996 | |||
1997 | return ret; | 1995 | return ret; |
1998 | } | 1996 | } |
1999 | 1997 | ||
diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c index 6e6518264c42..fd24cb4540a4 100644 --- a/drivers/usb/gadget/bcm63xx_udc.c +++ b/drivers/usb/gadget/bcm63xx_udc.c | |||
@@ -2334,21 +2334,11 @@ static int bcm63xx_udc_probe(struct platform_device *pdev) | |||
2334 | } | 2334 | } |
2335 | 2335 | ||
2336 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2336 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2337 | if (!res) { | ||
2338 | dev_err(dev, "error finding USBD resource\n"); | ||
2339 | return -ENXIO; | ||
2340 | } | ||
2341 | |||
2342 | udc->usbd_regs = devm_ioremap_resource(dev, res); | 2337 | udc->usbd_regs = devm_ioremap_resource(dev, res); |
2343 | if (IS_ERR(udc->usbd_regs)) | 2338 | if (IS_ERR(udc->usbd_regs)) |
2344 | return PTR_ERR(udc->usbd_regs); | 2339 | return PTR_ERR(udc->usbd_regs); |
2345 | 2340 | ||
2346 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 2341 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
2347 | if (!res) { | ||
2348 | dev_err(dev, "error finding IUDMA resource\n"); | ||
2349 | return -ENXIO; | ||
2350 | } | ||
2351 | |||
2352 | udc->iudma_regs = devm_ioremap_resource(dev, res); | 2342 | udc->iudma_regs = devm_ioremap_resource(dev, res); |
2353 | if (IS_ERR(udc->iudma_regs)) | 2343 | if (IS_ERR(udc->iudma_regs)) |
2354 | return PTR_ERR(udc->iudma_regs); | 2344 | return PTR_ERR(udc->iudma_regs); |
@@ -2420,7 +2410,6 @@ static int bcm63xx_udc_remove(struct platform_device *pdev) | |||
2420 | usb_del_gadget_udc(&udc->gadget); | 2410 | usb_del_gadget_udc(&udc->gadget); |
2421 | BUG_ON(udc->driver); | 2411 | BUG_ON(udc->driver); |
2422 | 2412 | ||
2423 | platform_set_drvdata(pdev, NULL); | ||
2424 | bcm63xx_uninit_udc_hw(udc); | 2413 | bcm63xx_uninit_udc_hw(udc); |
2425 | 2414 | ||
2426 | return 0; | 2415 | return 0; |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 3d5cfc9c2c78..80e7f75a56c7 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
@@ -821,8 +821,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget, | |||
821 | gi->gstrings[i] = NULL; | 821 | gi->gstrings[i] = NULL; |
822 | s = usb_gstrings_attach(&gi->cdev, gi->gstrings, | 822 | s = usb_gstrings_attach(&gi->cdev, gi->gstrings, |
823 | USB_GADGET_FIRST_AVAIL_IDX); | 823 | USB_GADGET_FIRST_AVAIL_IDX); |
824 | if (IS_ERR(s)) | 824 | if (IS_ERR(s)) { |
825 | ret = PTR_ERR(s); | ||
825 | goto err_comp_cleanup; | 826 | goto err_comp_cleanup; |
827 | } | ||
826 | 828 | ||
827 | gi->cdev.desc.iManufacturer = s[USB_GADGET_MANUFACTURER_IDX].id; | 829 | gi->cdev.desc.iManufacturer = s[USB_GADGET_MANUFACTURER_IDX].id; |
828 | gi->cdev.desc.iProduct = s[USB_GADGET_PRODUCT_IDX].id; | 830 | gi->cdev.desc.iProduct = s[USB_GADGET_PRODUCT_IDX].id; |
@@ -847,8 +849,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget, | |||
847 | } | 849 | } |
848 | cfg->gstrings[i] = NULL; | 850 | cfg->gstrings[i] = NULL; |
849 | s = usb_gstrings_attach(&gi->cdev, cfg->gstrings, 1); | 851 | s = usb_gstrings_attach(&gi->cdev, cfg->gstrings, 1); |
850 | if (IS_ERR(s)) | 852 | if (IS_ERR(s)) { |
853 | ret = PTR_ERR(s); | ||
851 | goto err_comp_cleanup; | 854 | goto err_comp_cleanup; |
855 | } | ||
852 | c->iConfiguration = s[0].id; | 856 | c->iConfiguration = s[0].id; |
853 | } | 857 | } |
854 | 858 | ||
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index a792e322f4f1..c588e8e486e5 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -1001,7 +1001,6 @@ static int dummy_udc_remove(struct platform_device *pdev) | |||
1001 | struct dummy *dum = platform_get_drvdata(pdev); | 1001 | struct dummy *dum = platform_get_drvdata(pdev); |
1002 | 1002 | ||
1003 | usb_del_gadget_udc(&dum->gadget); | 1003 | usb_del_gadget_udc(&dum->gadget); |
1004 | platform_set_drvdata(pdev, NULL); | ||
1005 | device_remove_file(&dum->gadget.dev, &dev_attr_function); | 1004 | device_remove_file(&dum->gadget.dev, &dev_attr_function); |
1006 | return 0; | 1005 | return 0; |
1007 | } | 1006 | } |
@@ -2661,8 +2660,10 @@ static int __init init(void) | |||
2661 | } | 2660 | } |
2662 | for (i = 0; i < mod_data.num; i++) { | 2661 | for (i = 0; i < mod_data.num; i++) { |
2663 | dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL); | 2662 | dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL); |
2664 | if (!dum[i]) | 2663 | if (!dum[i]) { |
2664 | retval = -ENOMEM; | ||
2665 | goto err_add_pdata; | 2665 | goto err_add_pdata; |
2666 | } | ||
2666 | retval = platform_device_add_data(the_hcd_pdev[i], &dum[i], | 2667 | retval = platform_device_add_data(the_hcd_pdev[i], &dum[i], |
2667 | sizeof(void *)); | 2668 | sizeof(void *)); |
2668 | if (retval) | 2669 | if (retval) |
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c index d893d6929079..abf8a31ae146 100644 --- a/drivers/usb/gadget/f_ecm.c +++ b/drivers/usb/gadget/f_ecm.c | |||
@@ -816,6 +816,7 @@ ecm_unbind(struct usb_configuration *c, struct usb_function *f) | |||
816 | * @c: the configuration to support the network link | 816 | * @c: the configuration to support the network link |
817 | * @ethaddr: a buffer in which the ethernet address of the host side | 817 | * @ethaddr: a buffer in which the ethernet address of the host side |
818 | * side of the link was recorded | 818 | * side of the link was recorded |
819 | * @dev: eth_dev structure | ||
819 | * Context: single threaded during gadget setup | 820 | * Context: single threaded during gadget setup |
820 | * | 821 | * |
821 | * Returns zero on success, else negative errno. | 822 | * Returns zero on success, else negative errno. |
diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c index 185d6f5e4e4d..7be04b342494 100644 --- a/drivers/usb/gadget/f_subset.c +++ b/drivers/usb/gadget/f_subset.c | |||
@@ -373,6 +373,7 @@ geth_unbind(struct usb_configuration *c, struct usb_function *f) | |||
373 | * @c: the configuration to support the network link | 373 | * @c: the configuration to support the network link |
374 | * @ethaddr: a buffer in which the ethernet address of the host side | 374 | * @ethaddr: a buffer in which the ethernet address of the host side |
375 | * side of the link was recorded | 375 | * side of the link was recorded |
376 | * @dev: eth_dev structure | ||
376 | * Context: single threaded during gadget setup | 377 | * Context: single threaded during gadget setup |
377 | * | 378 | * |
378 | * Returns zero on success, else negative errno. | 379 | * Returns zero on success, else negative errno. |
diff --git a/drivers/usb/gadget/f_uac2.c b/drivers/usb/gadget/f_uac2.c index c7468b6c07b0..03c1fb686644 100644 --- a/drivers/usb/gadget/f_uac2.c +++ b/drivers/usb/gadget/f_uac2.c | |||
@@ -456,8 +456,6 @@ static int snd_uac2_remove(struct platform_device *pdev) | |||
456 | { | 456 | { |
457 | struct snd_card *card = platform_get_drvdata(pdev); | 457 | struct snd_card *card = platform_get_drvdata(pdev); |
458 | 458 | ||
459 | platform_set_drvdata(pdev, NULL); | ||
460 | |||
461 | if (card) | 459 | if (card) |
462 | return snd_card_free(card); | 460 | return snd_card_free(card); |
463 | 461 | ||
diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c index cec8871b77f9..b8632d40f8bf 100644 --- a/drivers/usb/gadget/fusb300_udc.c +++ b/drivers/usb/gadget/fusb300_udc.c | |||
@@ -1461,8 +1461,10 @@ static int __init fusb300_probe(struct platform_device *pdev) | |||
1461 | 1461 | ||
1462 | fusb300->ep0_req = fusb300_alloc_request(&fusb300->ep[0]->ep, | 1462 | fusb300->ep0_req = fusb300_alloc_request(&fusb300->ep[0]->ep, |
1463 | GFP_KERNEL); | 1463 | GFP_KERNEL); |
1464 | if (fusb300->ep0_req == NULL) | 1464 | if (fusb300->ep0_req == NULL) { |
1465 | ret = -ENOMEM; | ||
1465 | goto clean_up3; | 1466 | goto clean_up3; |
1467 | } | ||
1466 | 1468 | ||
1467 | init_controller(fusb300); | 1469 | init_controller(fusb300); |
1468 | ret = usb_add_gadget_udc(&pdev->dev, &fusb300->gadget); | 1470 | ret = usb_add_gadget_udc(&pdev->dev, &fusb300->gadget); |
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c index b5cebd6b0d7a..9b2d24e4c95f 100644 --- a/drivers/usb/gadget/imx_udc.c +++ b/drivers/usb/gadget/imx_udc.c | |||
@@ -1511,8 +1511,6 @@ static int __exit imx_udc_remove(struct platform_device *pdev) | |||
1511 | if (pdata->exit) | 1511 | if (pdata->exit) |
1512 | pdata->exit(&pdev->dev); | 1512 | pdata->exit(&pdev->dev); |
1513 | 1513 | ||
1514 | platform_set_drvdata(pdev, NULL); | ||
1515 | |||
1516 | return 0; | 1514 | return 0; |
1517 | } | 1515 | } |
1518 | 1516 | ||
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c index 866ef0999247..51cfe72da5bb 100644 --- a/drivers/usb/gadget/m66592-udc.c +++ b/drivers/usb/gadget/m66592-udc.c | |||
@@ -1660,8 +1660,10 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
1660 | m66592->epaddr2ep[0] = &m66592->ep[0]; | 1660 | m66592->epaddr2ep[0] = &m66592->ep[0]; |
1661 | 1661 | ||
1662 | m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); | 1662 | m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); |
1663 | if (m66592->ep0_req == NULL) | 1663 | if (m66592->ep0_req == NULL) { |
1664 | ret = -ENOMEM; | ||
1664 | goto clean_up3; | 1665 | goto clean_up3; |
1666 | } | ||
1665 | m66592->ep0_req->complete = nop_completion; | 1667 | m66592->ep0_req->complete = nop_completion; |
1666 | 1668 | ||
1667 | init_controller(m66592); | 1669 | init_controller(m66592); |
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index ef47495dec8f..95c531d5aa4f 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -2236,7 +2236,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) | |||
2236 | dev->transceiver = NULL; | 2236 | dev->transceiver = NULL; |
2237 | } | 2237 | } |
2238 | 2238 | ||
2239 | platform_set_drvdata(pdev, NULL); | ||
2240 | the_controller = NULL; | 2239 | the_controller = NULL; |
2241 | return 0; | 2240 | return 0; |
2242 | } | 2241 | } |
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 0b742d171843..7ff7d9cf2061 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c | |||
@@ -1977,8 +1977,10 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
1977 | 1977 | ||
1978 | r8a66597->ep0_req = r8a66597_alloc_request(&r8a66597->ep[0].ep, | 1978 | r8a66597->ep0_req = r8a66597_alloc_request(&r8a66597->ep[0].ep, |
1979 | GFP_KERNEL); | 1979 | GFP_KERNEL); |
1980 | if (r8a66597->ep0_req == NULL) | 1980 | if (r8a66597->ep0_req == NULL) { |
1981 | ret = -ENOMEM; | ||
1981 | goto clean_up3; | 1982 | goto clean_up3; |
1983 | } | ||
1982 | r8a66597->ep0_req->complete = nop_completion; | 1984 | r8a66597->ep0_req->complete = nop_completion; |
1983 | 1985 | ||
1984 | ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget); | 1986 | ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget); |
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index a3cdc32115d5..af22f24046b2 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -437,7 +437,7 @@ static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg, | |||
437 | if (hs_req->req.length == 0) | 437 | if (hs_req->req.length == 0) |
438 | return; | 438 | return; |
439 | 439 | ||
440 | usb_gadget_unmap_request(&hsotg->gadget, hs_req, hs_ep->dir_in); | 440 | usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->dir_in); |
441 | } | 441 | } |
442 | 442 | ||
443 | /** | 443 | /** |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index d0e75e1b3ccb..09c4f70c93c4 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -1851,6 +1851,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev) | |||
1851 | irq = gpio_to_irq(udc_info->vbus_pin); | 1851 | irq = gpio_to_irq(udc_info->vbus_pin); |
1852 | if (irq < 0) { | 1852 | if (irq < 0) { |
1853 | dev_err(dev, "no irq for gpio vbus pin\n"); | 1853 | dev_err(dev, "no irq for gpio vbus pin\n"); |
1854 | retval = irq; | ||
1854 | goto err_gpio_claim; | 1855 | goto err_gpio_claim; |
1855 | } | 1856 | } |
1856 | 1857 | ||
@@ -1948,8 +1949,6 @@ static int s3c2410_udc_remove(struct platform_device *pdev) | |||
1948 | iounmap(base_addr); | 1949 | iounmap(base_addr); |
1949 | release_mem_region(rsrc_start, rsrc_len); | 1950 | release_mem_region(rsrc_start, rsrc_len); |
1950 | 1951 | ||
1951 | platform_set_drvdata(pdev, NULL); | ||
1952 | |||
1953 | if (!IS_ERR(udc_clock) && udc_clock != NULL) { | 1952 | if (!IS_ERR(udc_clock) && udc_clock != NULL) { |
1954 | clk_disable(udc_clock); | 1953 | clk_disable(udc_clock); |
1955 | clk_put(udc_clock); | 1954 | clk_put(udc_clock); |
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 2cd6262e8b71..0deb9d6cde26 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -284,12 +284,16 @@ static int __init zero_bind(struct usb_composite_dev *cdev) | |||
284 | ss_opts->bulk_buflen = gzero_options.bulk_buflen; | 284 | ss_opts->bulk_buflen = gzero_options.bulk_buflen; |
285 | 285 | ||
286 | func_ss = usb_get_function(func_inst_ss); | 286 | func_ss = usb_get_function(func_inst_ss); |
287 | if (IS_ERR(func_ss)) | 287 | if (IS_ERR(func_ss)) { |
288 | status = PTR_ERR(func_ss); | ||
288 | goto err_put_func_inst_ss; | 289 | goto err_put_func_inst_ss; |
290 | } | ||
289 | 291 | ||
290 | func_inst_lb = usb_get_function_instance("Loopback"); | 292 | func_inst_lb = usb_get_function_instance("Loopback"); |
291 | if (IS_ERR(func_inst_lb)) | 293 | if (IS_ERR(func_inst_lb)) { |
294 | status = PTR_ERR(func_inst_lb); | ||
292 | goto err_put_func_ss; | 295 | goto err_put_func_ss; |
296 | } | ||
293 | 297 | ||
294 | lb_opts = container_of(func_inst_lb, struct f_lb_opts, func_inst); | 298 | lb_opts = container_of(func_inst_lb, struct f_lb_opts, func_inst); |
295 | lb_opts->bulk_buflen = gzero_options.bulk_buflen; | 299 | lb_opts->bulk_buflen = gzero_options.bulk_buflen; |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index de94f2699063..344d5e2f87d7 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -507,7 +507,7 @@ endif # USB_OHCI_HCD | |||
507 | 507 | ||
508 | config USB_UHCI_HCD | 508 | config USB_UHCI_HCD |
509 | tristate "UHCI HCD (most Intel and VIA) support" | 509 | tristate "UHCI HCD (most Intel and VIA) support" |
510 | depends on PCI || SPARC_LEON || ARCH_VT8500 | 510 | depends on PCI || USB_UHCI_SUPPORT_NON_PCI_HC |
511 | ---help--- | 511 | ---help--- |
512 | The Universal Host Controller Interface is a standard by Intel for | 512 | The Universal Host Controller Interface is a standard by Intel for |
513 | accessing the USB hardware in the PC (which is also called the USB | 513 | accessing the USB hardware in the PC (which is also called the USB |
@@ -524,26 +524,19 @@ config USB_UHCI_HCD | |||
524 | 524 | ||
525 | config USB_UHCI_SUPPORT_NON_PCI_HC | 525 | config USB_UHCI_SUPPORT_NON_PCI_HC |
526 | bool | 526 | bool |
527 | depends on USB_UHCI_HCD | 527 | default y if (SPARC_LEON || USB_UHCI_PLATFORM) |
528 | default y if (SPARC_LEON || ARCH_VT8500) | ||
529 | 528 | ||
530 | config USB_UHCI_PLATFORM | 529 | config USB_UHCI_PLATFORM |
531 | bool "Generic UHCI Platform Driver support" | 530 | bool |
532 | depends on USB_UHCI_SUPPORT_NON_PCI_HC | ||
533 | default y if ARCH_VT8500 | 531 | default y if ARCH_VT8500 |
534 | ---help--- | ||
535 | Enable support for generic UHCI platform devices that require no | ||
536 | additional configuration. | ||
537 | 532 | ||
538 | config USB_UHCI_BIG_ENDIAN_MMIO | 533 | config USB_UHCI_BIG_ENDIAN_MMIO |
539 | bool | 534 | bool |
540 | depends on USB_UHCI_SUPPORT_NON_PCI_HC && SPARC_LEON | 535 | default y if SPARC_LEON |
541 | default y | ||
542 | 536 | ||
543 | config USB_UHCI_BIG_ENDIAN_DESC | 537 | config USB_UHCI_BIG_ENDIAN_DESC |
544 | bool | 538 | bool |
545 | depends on USB_UHCI_SUPPORT_NON_PCI_HC && SPARC_LEON | 539 | default y if SPARC_LEON |
546 | default y | ||
547 | 540 | ||
548 | config USB_FHCI_HCD | 541 | config USB_FHCI_HCD |
549 | tristate "Freescale QE USB Host Controller support" | 542 | tristate "Freescale QE USB Host Controller support" |
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index 66420097c242..02f4611faa62 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c | |||
@@ -63,8 +63,6 @@ static void atmel_stop_ehci(struct platform_device *pdev) | |||
63 | 63 | ||
64 | /*-------------------------------------------------------------------------*/ | 64 | /*-------------------------------------------------------------------------*/ |
65 | 65 | ||
66 | static u64 at91_ehci_dma_mask = DMA_BIT_MASK(32); | ||
67 | |||
68 | static int ehci_atmel_drv_probe(struct platform_device *pdev) | 66 | static int ehci_atmel_drv_probe(struct platform_device *pdev) |
69 | { | 67 | { |
70 | struct usb_hcd *hcd; | 68 | struct usb_hcd *hcd; |
@@ -93,7 +91,9 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) | |||
93 | * Once we have dma capability bindings this can go away. | 91 | * Once we have dma capability bindings this can go away. |
94 | */ | 92 | */ |
95 | if (!pdev->dev.dma_mask) | 93 | if (!pdev->dev.dma_mask) |
96 | pdev->dev.dma_mask = &at91_ehci_dma_mask; | 94 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
95 | if (!pdev->dev.coherent_dma_mask) | ||
96 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
97 | 97 | ||
98 | hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); | 98 | hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); |
99 | if (!hcd) { | 99 | if (!hcd) { |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 312fc10da3c7..246e124e6ac5 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1286,23 +1286,6 @@ MODULE_LICENSE ("GPL"); | |||
1286 | #define PLATFORM_DRIVER ehci_hcd_sead3_driver | 1286 | #define PLATFORM_DRIVER ehci_hcd_sead3_driver |
1287 | #endif | 1287 | #endif |
1288 | 1288 | ||
1289 | #if !IS_ENABLED(CONFIG_USB_EHCI_PCI) && \ | ||
1290 | !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \ | ||
1291 | !IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \ | ||
1292 | !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \ | ||
1293 | !IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) && \ | ||
1294 | !IS_ENABLED(CONFIG_USB_EHCI_HCD_ORION) && \ | ||
1295 | !IS_ENABLED(CONFIG_USB_EHCI_HCD_SPEAR) && \ | ||
1296 | !IS_ENABLED(CONFIG_USB_EHCI_S5P) && \ | ||
1297 | !IS_ENABLED(CONFIG_USB_EHCI_HCD_AT91) && \ | ||
1298 | !IS_ENABLED(CONFIG_USB_EHCI_MSM) && \ | ||
1299 | !defined(PLATFORM_DRIVER) && \ | ||
1300 | !defined(PS3_SYSTEM_BUS_DRIVER) && \ | ||
1301 | !defined(OF_PLATFORM_DRIVER) && \ | ||
1302 | !defined(XILINX_OF_PLATFORM_DRIVER) | ||
1303 | #error "missing bus glue for ehci-hcd" | ||
1304 | #endif | ||
1305 | |||
1306 | static int __init ehci_hcd_init(void) | 1289 | static int __init ehci_hcd_init(void) |
1307 | { | 1290 | { |
1308 | int retval = 0; | 1291 | int retval = 0; |
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 3d1491b5f360..16d7150e8557 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -90,8 +90,6 @@ static const struct ehci_driver_overrides ehci_omap_overrides __initdata = { | |||
90 | .extra_priv_size = sizeof(struct omap_hcd), | 90 | .extra_priv_size = sizeof(struct omap_hcd), |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static u64 omap_ehci_dma_mask = DMA_BIT_MASK(32); | ||
94 | |||
95 | /** | 93 | /** |
96 | * ehci_hcd_omap_probe - initialize TI-based HCDs | 94 | * ehci_hcd_omap_probe - initialize TI-based HCDs |
97 | * | 95 | * |
@@ -146,8 +144,10 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
146 | * Since shared usb code relies on it, set it here for now. | 144 | * Since shared usb code relies on it, set it here for now. |
147 | * Once we have dma capability bindings this can go away. | 145 | * Once we have dma capability bindings this can go away. |
148 | */ | 146 | */ |
149 | if (!pdev->dev.dma_mask) | 147 | if (!dev->dma_mask) |
150 | pdev->dev.dma_mask = &omap_ehci_dma_mask; | 148 | dev->dma_mask = &dev->coherent_dma_mask; |
149 | if (!dev->coherent_dma_mask) | ||
150 | dev->coherent_dma_mask = DMA_BIT_MASK(32); | ||
151 | 151 | ||
152 | hcd = usb_create_hcd(&ehci_omap_hc_driver, dev, | 152 | hcd = usb_create_hcd(&ehci_omap_hc_driver, dev, |
153 | dev_name(dev)); | 153 | dev_name(dev)); |
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 54c579485150..efbc588b48c5 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
@@ -137,8 +137,6 @@ ehci_orion_conf_mbus_windows(struct usb_hcd *hcd, | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | static u64 ehci_orion_dma_mask = DMA_BIT_MASK(32); | ||
141 | |||
142 | static int ehci_orion_drv_probe(struct platform_device *pdev) | 140 | static int ehci_orion_drv_probe(struct platform_device *pdev) |
143 | { | 141 | { |
144 | struct orion_ehci_data *pd = pdev->dev.platform_data; | 142 | struct orion_ehci_data *pd = pdev->dev.platform_data; |
@@ -183,7 +181,9 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) | |||
183 | * now. Once we have dma capability bindings this can go away. | 181 | * now. Once we have dma capability bindings this can go away. |
184 | */ | 182 | */ |
185 | if (!pdev->dev.dma_mask) | 183 | if (!pdev->dev.dma_mask) |
186 | pdev->dev.dma_mask = &ehci_orion_dma_mask; | 184 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
185 | if (!pdev->dev.coherent_dma_mask) | ||
186 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
187 | 187 | ||
188 | if (!request_mem_region(res->start, resource_size(res), | 188 | if (!request_mem_region(res->start, resource_size(res), |
189 | ehci_orion_hc_driver.description)) { | 189 | ehci_orion_hc_driver.description)) { |
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index 635775278c7f..379037f51a2f 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c | |||
@@ -71,8 +71,6 @@ static void s5p_setup_vbus_gpio(struct platform_device *pdev) | |||
71 | dev_err(dev, "can't request ehci vbus gpio %d", gpio); | 71 | dev_err(dev, "can't request ehci vbus gpio %d", gpio); |
72 | } | 72 | } |
73 | 73 | ||
74 | static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32); | ||
75 | |||
76 | static int s5p_ehci_probe(struct platform_device *pdev) | 74 | static int s5p_ehci_probe(struct platform_device *pdev) |
77 | { | 75 | { |
78 | struct s5p_ehci_platdata *pdata = pdev->dev.platform_data; | 76 | struct s5p_ehci_platdata *pdata = pdev->dev.platform_data; |
@@ -90,7 +88,7 @@ static int s5p_ehci_probe(struct platform_device *pdev) | |||
90 | * Once we move to full device tree support this will vanish off. | 88 | * Once we move to full device tree support this will vanish off. |
91 | */ | 89 | */ |
92 | if (!pdev->dev.dma_mask) | 90 | if (!pdev->dev.dma_mask) |
93 | pdev->dev.dma_mask = &ehci_s5p_dma_mask; | 91 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
94 | if (!pdev->dev.coherent_dma_mask) | 92 | if (!pdev->dev.coherent_dma_mask) |
95 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | 93 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |
96 | 94 | ||
@@ -107,6 +105,7 @@ static int s5p_ehci_probe(struct platform_device *pdev) | |||
107 | if (IS_ERR(phy)) { | 105 | if (IS_ERR(phy)) { |
108 | /* Fallback to pdata */ | 106 | /* Fallback to pdata */ |
109 | if (!pdata) { | 107 | if (!pdata) { |
108 | usb_put_hcd(hcd); | ||
110 | dev_warn(&pdev->dev, "no platform data or transceiver defined\n"); | 109 | dev_warn(&pdev->dev, "no platform data or transceiver defined\n"); |
111 | return -EPROBE_DEFER; | 110 | return -EPROBE_DEFER; |
112 | } else { | 111 | } else { |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index acff5b8f6e89..f80d0330d548 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -213,7 +213,7 @@ static inline unsigned char tt_start_uframe(struct ehci_hcd *ehci, __hc32 mask) | |||
213 | } | 213 | } |
214 | 214 | ||
215 | static const unsigned char | 215 | static const unsigned char |
216 | max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 125, 25 }; | 216 | max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 30, 0 }; |
217 | 217 | ||
218 | /* carryover low/fullspeed bandwidth that crosses uframe boundries */ | 218 | /* carryover low/fullspeed bandwidth that crosses uframe boundries */ |
219 | static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8]) | 219 | static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8]) |
@@ -646,6 +646,10 @@ static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
646 | /* reschedule QH iff another request is queued */ | 646 | /* reschedule QH iff another request is queued */ |
647 | if (!list_empty(&qh->qtd_list) && ehci->rh_state == EHCI_RH_RUNNING) { | 647 | if (!list_empty(&qh->qtd_list) && ehci->rh_state == EHCI_RH_RUNNING) { |
648 | rc = qh_schedule(ehci, qh); | 648 | rc = qh_schedule(ehci, qh); |
649 | if (rc == 0) { | ||
650 | qh_refresh(ehci, qh); | ||
651 | qh_link_periodic(ehci, qh); | ||
652 | } | ||
649 | 653 | ||
650 | /* An error here likely indicates handshake failure | 654 | /* An error here likely indicates handshake failure |
651 | * or no space left in the schedule. Neither fault | 655 | * or no space left in the schedule. Neither fault |
@@ -653,9 +657,10 @@ static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
653 | * | 657 | * |
654 | * FIXME kill the now-dysfunctional queued urbs | 658 | * FIXME kill the now-dysfunctional queued urbs |
655 | */ | 659 | */ |
656 | if (rc != 0) | 660 | else { |
657 | ehci_err(ehci, "can't reschedule qh %p, err %d\n", | 661 | ehci_err(ehci, "can't reschedule qh %p, err %d\n", |
658 | qh, rc); | 662 | qh, rc); |
663 | } | ||
659 | } | 664 | } |
660 | 665 | ||
661 | /* maybe turn off periodic schedule */ | 666 | /* maybe turn off periodic schedule */ |
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index 61ecfb3d52f5..bd3e5cbc6240 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c | |||
@@ -58,8 +58,6 @@ static int ehci_spear_drv_resume(struct device *dev) | |||
58 | static SIMPLE_DEV_PM_OPS(ehci_spear_pm_ops, ehci_spear_drv_suspend, | 58 | static SIMPLE_DEV_PM_OPS(ehci_spear_pm_ops, ehci_spear_drv_suspend, |
59 | ehci_spear_drv_resume); | 59 | ehci_spear_drv_resume); |
60 | 60 | ||
61 | static u64 spear_ehci_dma_mask = DMA_BIT_MASK(32); | ||
62 | |||
63 | static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) | 61 | static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) |
64 | { | 62 | { |
65 | struct usb_hcd *hcd ; | 63 | struct usb_hcd *hcd ; |
@@ -84,7 +82,9 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) | |||
84 | * Once we have dma capability bindings this can go away. | 82 | * Once we have dma capability bindings this can go away. |
85 | */ | 83 | */ |
86 | if (!pdev->dev.dma_mask) | 84 | if (!pdev->dev.dma_mask) |
87 | pdev->dev.dma_mask = &spear_ehci_dma_mask; | 85 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
86 | if (!pdev->dev.coherent_dma_mask) | ||
87 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
88 | 88 | ||
89 | usbh_clk = devm_clk_get(&pdev->dev, NULL); | 89 | usbh_clk = devm_clk_get(&pdev->dev, NULL); |
90 | if (IS_ERR(usbh_clk)) { | 90 | if (IS_ERR(usbh_clk)) { |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index e3eddc31ac83..59d111bf44a9 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -637,8 +637,6 @@ static void tegra_ehci_set_phcd(struct usb_phy *x, bool enable) | |||
637 | writel(val, base + TEGRA_USB_PORTSC1); | 637 | writel(val, base + TEGRA_USB_PORTSC1); |
638 | } | 638 | } |
639 | 639 | ||
640 | static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32); | ||
641 | |||
642 | static int tegra_ehci_probe(struct platform_device *pdev) | 640 | static int tegra_ehci_probe(struct platform_device *pdev) |
643 | { | 641 | { |
644 | struct resource *res; | 642 | struct resource *res; |
@@ -661,7 +659,9 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
661 | * Once we have dma capability bindings this can go away. | 659 | * Once we have dma capability bindings this can go away. |
662 | */ | 660 | */ |
663 | if (!pdev->dev.dma_mask) | 661 | if (!pdev->dev.dma_mask) |
664 | pdev->dev.dma_mask = &tegra_ehci_dma_mask; | 662 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
663 | if (!pdev->dev.coherent_dma_mask) | ||
664 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
665 | 665 | ||
666 | setup_vbus_gpio(pdev, pdata); | 666 | setup_vbus_gpio(pdev, pdata); |
667 | 667 | ||
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 125e261f5bfc..2facee53eab1 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -1739,7 +1739,7 @@ static int isp1760_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
1739 | int retval = 1; | 1739 | int retval = 1; |
1740 | unsigned long flags; | 1740 | unsigned long flags; |
1741 | 1741 | ||
1742 | /* if !USB_SUSPEND, root hub timers won't get shut down ... */ | 1742 | /* if !PM_RUNTIME, root hub timers won't get shut down ... */ |
1743 | if (!HC_IS_RUNNING(hcd->state)) | 1743 | if (!HC_IS_RUNNING(hcd->state)) |
1744 | return 0; | 1744 | return 0; |
1745 | 1745 | ||
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index bbb791bd7617..a13709ee4e5d 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
@@ -373,8 +373,10 @@ static int isp1760_plat_probe(struct platform_device *pdev) | |||
373 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 373 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
374 | if (!irq_res) { | 374 | if (!irq_res) { |
375 | pr_warning("isp1760: IRQ resource not available\n"); | 375 | pr_warning("isp1760: IRQ resource not available\n"); |
376 | return -ENODEV; | 376 | ret = -ENODEV; |
377 | goto cleanup; | ||
377 | } | 378 | } |
379 | |||
378 | irqflags |= irq_res->flags & IRQF_TRIGGER_MASK; | 380 | irqflags |= irq_res->flags & IRQF_TRIGGER_MASK; |
379 | 381 | ||
380 | if (priv) { | 382 | if (priv) { |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index a0cb44f0e724..2ee1496dbc1d 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -504,8 +504,6 @@ static const struct of_device_id at91_ohci_dt_ids[] = { | |||
504 | 504 | ||
505 | MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids); | 505 | MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids); |
506 | 506 | ||
507 | static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32); | ||
508 | |||
509 | static int ohci_at91_of_init(struct platform_device *pdev) | 507 | static int ohci_at91_of_init(struct platform_device *pdev) |
510 | { | 508 | { |
511 | struct device_node *np = pdev->dev.of_node; | 509 | struct device_node *np = pdev->dev.of_node; |
@@ -522,7 +520,9 @@ static int ohci_at91_of_init(struct platform_device *pdev) | |||
522 | * Once we have dma capability bindings this can go away. | 520 | * Once we have dma capability bindings this can go away. |
523 | */ | 521 | */ |
524 | if (!pdev->dev.dma_mask) | 522 | if (!pdev->dev.dma_mask) |
525 | pdev->dev.dma_mask = &at91_ohci_dma_mask; | 523 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
524 | if (!pdev->dev.coherent_dma_mask) | ||
525 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
526 | 526 | ||
527 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | 527 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); |
528 | if (!pdata) | 528 | if (!pdata) |
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 07592c00af26..b0b542c14e31 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c | |||
@@ -98,8 +98,6 @@ static const struct hc_driver exynos_ohci_hc_driver = { | |||
98 | .start_port_reset = ohci_start_port_reset, | 98 | .start_port_reset = ohci_start_port_reset, |
99 | }; | 99 | }; |
100 | 100 | ||
101 | static u64 ohci_exynos_dma_mask = DMA_BIT_MASK(32); | ||
102 | |||
103 | static int exynos_ohci_probe(struct platform_device *pdev) | 101 | static int exynos_ohci_probe(struct platform_device *pdev) |
104 | { | 102 | { |
105 | struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data; | 103 | struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data; |
@@ -117,7 +115,7 @@ static int exynos_ohci_probe(struct platform_device *pdev) | |||
117 | * Once we move to full device tree support this will vanish off. | 115 | * Once we move to full device tree support this will vanish off. |
118 | */ | 116 | */ |
119 | if (!pdev->dev.dma_mask) | 117 | if (!pdev->dev.dma_mask) |
120 | pdev->dev.dma_mask = &ohci_exynos_dma_mask; | 118 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
121 | if (!pdev->dev.coherent_dma_mask) | 119 | if (!pdev->dev.coherent_dma_mask) |
122 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | 120 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |
123 | 121 | ||
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 9e6de9586ae4..fc627fd54116 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -233,14 +233,14 @@ static int ohci_urb_enqueue ( | |||
233 | urb->start_frame = frame; | 233 | urb->start_frame = frame; |
234 | } | 234 | } |
235 | } else if (ed->type == PIPE_ISOCHRONOUS) { | 235 | } else if (ed->type == PIPE_ISOCHRONOUS) { |
236 | u16 next = ohci_frame_no(ohci) + 2; | 236 | u16 next = ohci_frame_no(ohci) + 1; |
237 | u16 frame = ed->last_iso + ed->interval; | 237 | u16 frame = ed->last_iso + ed->interval; |
238 | 238 | ||
239 | /* Behind the scheduling threshold? */ | 239 | /* Behind the scheduling threshold? */ |
240 | if (unlikely(tick_before(frame, next))) { | 240 | if (unlikely(tick_before(frame, next))) { |
241 | 241 | ||
242 | /* USB_ISO_ASAP: Round up to the first available slot */ | 242 | /* USB_ISO_ASAP: Round up to the first available slot */ |
243 | if (urb->transfer_flags & URB_ISO_ASAP) | 243 | if (urb->transfer_flags & URB_ISO_ASAP) { |
244 | frame += (next - frame + ed->interval - 1) & | 244 | frame += (next - frame + ed->interval - 1) & |
245 | -ed->interval; | 245 | -ed->interval; |
246 | 246 | ||
@@ -248,21 +248,25 @@ static int ohci_urb_enqueue ( | |||
248 | * Not ASAP: Use the next slot in the stream. If | 248 | * Not ASAP: Use the next slot in the stream. If |
249 | * the entire URB falls before the threshold, fail. | 249 | * the entire URB falls before the threshold, fail. |
250 | */ | 250 | */ |
251 | else if (tick_before(frame + ed->interval * | 251 | } else { |
252 | if (tick_before(frame + ed->interval * | ||
252 | (urb->number_of_packets - 1), next)) { | 253 | (urb->number_of_packets - 1), next)) { |
253 | retval = -EXDEV; | 254 | retval = -EXDEV; |
254 | usb_hcd_unlink_urb_from_ep(hcd, urb); | 255 | usb_hcd_unlink_urb_from_ep(hcd, urb); |
255 | goto fail; | 256 | goto fail; |
256 | } | 257 | } |
257 | 258 | ||
258 | /* | 259 | /* |
259 | * Some OHCI hardware doesn't handle late TDs | 260 | * Some OHCI hardware doesn't handle late TDs |
260 | * correctly. After retiring them it proceeds to | 261 | * correctly. After retiring them it proceeds |
261 | * the next ED instead of the next TD. Therefore | 262 | * to the next ED instead of the next TD. |
262 | * we have to omit the late TDs entirely. | 263 | * Therefore we have to omit the late TDs |
263 | */ | 264 | * entirely. |
264 | urb_priv->td_cnt = DIV_ROUND_UP(next - frame, | 265 | */ |
265 | ed->interval); | 266 | urb_priv->td_cnt = DIV_ROUND_UP( |
267 | (u16) (next - frame), | ||
268 | ed->interval); | ||
269 | } | ||
266 | } | 270 | } |
267 | urb->start_frame = frame; | 271 | urb->start_frame = frame; |
268 | } | 272 | } |
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c index f4988fbe78e7..5d7eb72c5064 100644 --- a/drivers/usb/host/ohci-nxp.c +++ b/drivers/usb/host/ohci-nxp.c | |||
@@ -223,8 +223,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev) | |||
223 | 223 | ||
224 | isp1301_i2c_client = isp1301_get_client(isp1301_node); | 224 | isp1301_i2c_client = isp1301_get_client(isp1301_node); |
225 | if (!isp1301_i2c_client) { | 225 | if (!isp1301_i2c_client) { |
226 | ret = -EPROBE_DEFER; | 226 | return -EPROBE_DEFER; |
227 | goto out; | ||
228 | } | 227 | } |
229 | 228 | ||
230 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | 229 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |
@@ -234,7 +233,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev) | |||
234 | if (usb_disabled()) { | 233 | if (usb_disabled()) { |
235 | dev_err(&pdev->dev, "USB is disabled\n"); | 234 | dev_err(&pdev->dev, "USB is disabled\n"); |
236 | ret = -ENODEV; | 235 | ret = -ENODEV; |
237 | goto out; | 236 | goto fail_disable; |
238 | } | 237 | } |
239 | 238 | ||
240 | /* Enable AHB slave USB clock, needed for further USB clock control */ | 239 | /* Enable AHB slave USB clock, needed for further USB clock control */ |
@@ -245,19 +244,19 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev) | |||
245 | if (IS_ERR(usb_pll_clk)) { | 244 | if (IS_ERR(usb_pll_clk)) { |
246 | dev_err(&pdev->dev, "failed to acquire USB PLL\n"); | 245 | dev_err(&pdev->dev, "failed to acquire USB PLL\n"); |
247 | ret = PTR_ERR(usb_pll_clk); | 246 | ret = PTR_ERR(usb_pll_clk); |
248 | goto out1; | 247 | goto fail_pll; |
249 | } | 248 | } |
250 | 249 | ||
251 | ret = clk_enable(usb_pll_clk); | 250 | ret = clk_enable(usb_pll_clk); |
252 | if (ret < 0) { | 251 | if (ret < 0) { |
253 | dev_err(&pdev->dev, "failed to start USB PLL\n"); | 252 | dev_err(&pdev->dev, "failed to start USB PLL\n"); |
254 | goto out2; | 253 | goto fail_pllen; |
255 | } | 254 | } |
256 | 255 | ||
257 | ret = clk_set_rate(usb_pll_clk, 48000); | 256 | ret = clk_set_rate(usb_pll_clk, 48000); |
258 | if (ret < 0) { | 257 | if (ret < 0) { |
259 | dev_err(&pdev->dev, "failed to set USB clock rate\n"); | 258 | dev_err(&pdev->dev, "failed to set USB clock rate\n"); |
260 | goto out3; | 259 | goto fail_rate; |
261 | } | 260 | } |
262 | 261 | ||
263 | /* Enable USB device clock */ | 262 | /* Enable USB device clock */ |
@@ -265,13 +264,13 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev) | |||
265 | if (IS_ERR(usb_dev_clk)) { | 264 | if (IS_ERR(usb_dev_clk)) { |
266 | dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); | 265 | dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); |
267 | ret = PTR_ERR(usb_dev_clk); | 266 | ret = PTR_ERR(usb_dev_clk); |
268 | goto out4; | 267 | goto fail_dev; |
269 | } | 268 | } |
270 | 269 | ||
271 | ret = clk_enable(usb_dev_clk); | 270 | ret = clk_enable(usb_dev_clk); |
272 | if (ret < 0) { | 271 | if (ret < 0) { |
273 | dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); | 272 | dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); |
274 | goto out5; | 273 | goto fail_deven; |
275 | } | 274 | } |
276 | 275 | ||
277 | /* Enable USB otg clocks */ | 276 | /* Enable USB otg clocks */ |
@@ -279,7 +278,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev) | |||
279 | if (IS_ERR(usb_otg_clk)) { | 278 | if (IS_ERR(usb_otg_clk)) { |
280 | dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); | 279 | dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); |
281 | ret = PTR_ERR(usb_otg_clk); | 280 | ret = PTR_ERR(usb_otg_clk); |
282 | goto out6; | 281 | goto fail_otg; |
283 | } | 282 | } |
284 | 283 | ||
285 | __raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL); | 284 | __raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL); |
@@ -287,7 +286,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev) | |||
287 | ret = clk_enable(usb_otg_clk); | 286 | ret = clk_enable(usb_otg_clk); |
288 | if (ret < 0) { | 287 | if (ret < 0) { |
289 | dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); | 288 | dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); |
290 | goto out7; | 289 | goto fail_otgen; |
291 | } | 290 | } |
292 | 291 | ||
293 | isp1301_configure(); | 292 | isp1301_configure(); |
@@ -296,20 +295,14 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev) | |||
296 | if (!hcd) { | 295 | if (!hcd) { |
297 | dev_err(&pdev->dev, "Failed to allocate HC buffer\n"); | 296 | dev_err(&pdev->dev, "Failed to allocate HC buffer\n"); |
298 | ret = -ENOMEM; | 297 | ret = -ENOMEM; |
299 | goto out8; | 298 | goto fail_hcd; |
300 | } | 299 | } |
301 | 300 | ||
302 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 301 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
303 | if (!res) { | ||
304 | dev_err(&pdev->dev, "Failed to get MEM resource\n"); | ||
305 | ret = -ENOMEM; | ||
306 | goto out8; | ||
307 | } | ||
308 | |||
309 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); | 302 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
310 | if (IS_ERR(hcd->regs)) { | 303 | if (IS_ERR(hcd->regs)) { |
311 | ret = PTR_ERR(hcd->regs); | 304 | ret = PTR_ERR(hcd->regs); |
312 | goto out8; | 305 | goto fail_resource; |
313 | } | 306 | } |
314 | hcd->rsrc_start = res->start; | 307 | hcd->rsrc_start = res->start; |
315 | hcd->rsrc_len = resource_size(res); | 308 | hcd->rsrc_len = resource_size(res); |
@@ -317,7 +310,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev) | |||
317 | irq = platform_get_irq(pdev, 0); | 310 | irq = platform_get_irq(pdev, 0); |
318 | if (irq < 0) { | 311 | if (irq < 0) { |
319 | ret = -ENXIO; | 312 | ret = -ENXIO; |
320 | goto out8; | 313 | goto fail_resource; |
321 | } | 314 | } |
322 | 315 | ||
323 | nxp_start_hc(); | 316 | nxp_start_hc(); |
@@ -331,23 +324,24 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev) | |||
331 | return ret; | 324 | return ret; |
332 | 325 | ||
333 | nxp_stop_hc(); | 326 | nxp_stop_hc(); |
334 | out8: | 327 | fail_resource: |
335 | usb_put_hcd(hcd); | 328 | usb_put_hcd(hcd); |
336 | out7: | 329 | fail_hcd: |
337 | clk_disable(usb_otg_clk); | 330 | clk_disable(usb_otg_clk); |
338 | out6: | 331 | fail_otgen: |
339 | clk_put(usb_otg_clk); | 332 | clk_put(usb_otg_clk); |
340 | out5: | 333 | fail_otg: |
341 | clk_disable(usb_dev_clk); | 334 | clk_disable(usb_dev_clk); |
342 | out4: | 335 | fail_deven: |
343 | clk_put(usb_dev_clk); | 336 | clk_put(usb_dev_clk); |
344 | out3: | 337 | fail_dev: |
338 | fail_rate: | ||
345 | clk_disable(usb_pll_clk); | 339 | clk_disable(usb_pll_clk); |
346 | out2: | 340 | fail_pllen: |
347 | clk_put(usb_pll_clk); | 341 | clk_put(usb_pll_clk); |
348 | out1: | 342 | fail_pll: |
343 | fail_disable: | ||
349 | isp1301_i2c_client = NULL; | 344 | isp1301_i2c_client = NULL; |
350 | out: | ||
351 | return ret; | 345 | return ret; |
352 | } | 346 | } |
353 | 347 | ||
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c index ddfc31427bc0..8663851c8d8e 100644 --- a/drivers/usb/host/ohci-omap3.c +++ b/drivers/usb/host/ohci-omap3.c | |||
@@ -114,8 +114,6 @@ static const struct hc_driver ohci_omap3_hc_driver = { | |||
114 | 114 | ||
115 | /*-------------------------------------------------------------------------*/ | 115 | /*-------------------------------------------------------------------------*/ |
116 | 116 | ||
117 | static u64 omap_ohci_dma_mask = DMA_BIT_MASK(32); | ||
118 | |||
119 | /* | 117 | /* |
120 | * configure so an HC device and id are always provided | 118 | * configure so an HC device and id are always provided |
121 | * always called with process context; sleeping is OK | 119 | * always called with process context; sleeping is OK |
@@ -168,8 +166,10 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev) | |||
168 | * Since shared usb code relies on it, set it here for now. | 166 | * Since shared usb code relies on it, set it here for now. |
169 | * Once we have dma capability bindings this can go away. | 167 | * Once we have dma capability bindings this can go away. |
170 | */ | 168 | */ |
171 | if (!pdev->dev.dma_mask) | 169 | if (!dev->dma_mask) |
172 | pdev->dev.dma_mask = &omap_ohci_dma_mask; | 170 | dev->dma_mask = &dev->coherent_dma_mask; |
171 | if (!dev->coherent_dma_mask) | ||
172 | dev->coherent_dma_mask = DMA_BIT_MASK(32); | ||
173 | 173 | ||
174 | hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev, | 174 | hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev, |
175 | dev_name(dev)); | 175 | dev_name(dev)); |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index efe71f3ca477..279b2ef17411 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -282,8 +282,6 @@ static const struct of_device_id pxa_ohci_dt_ids[] = { | |||
282 | 282 | ||
283 | MODULE_DEVICE_TABLE(of, pxa_ohci_dt_ids); | 283 | MODULE_DEVICE_TABLE(of, pxa_ohci_dt_ids); |
284 | 284 | ||
285 | static u64 pxa_ohci_dma_mask = DMA_BIT_MASK(32); | ||
286 | |||
287 | static int ohci_pxa_of_init(struct platform_device *pdev) | 285 | static int ohci_pxa_of_init(struct platform_device *pdev) |
288 | { | 286 | { |
289 | struct device_node *np = pdev->dev.of_node; | 287 | struct device_node *np = pdev->dev.of_node; |
@@ -298,7 +296,9 @@ static int ohci_pxa_of_init(struct platform_device *pdev) | |||
298 | * Once we have dma capability bindings this can go away. | 296 | * Once we have dma capability bindings this can go away. |
299 | */ | 297 | */ |
300 | if (!pdev->dev.dma_mask) | 298 | if (!pdev->dev.dma_mask) |
301 | pdev->dev.dma_mask = &pxa_ohci_dma_mask; | 299 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
300 | if (!pdev->dev.coherent_dma_mask) | ||
301 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
302 | 302 | ||
303 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | 303 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); |
304 | if (!pdata) | 304 | if (!pdata) |
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 9020bf0e2eca..3e19e0170d11 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c | |||
@@ -91,8 +91,6 @@ static const struct hc_driver ohci_spear_hc_driver = { | |||
91 | .start_port_reset = ohci_start_port_reset, | 91 | .start_port_reset = ohci_start_port_reset, |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static u64 spear_ohci_dma_mask = DMA_BIT_MASK(32); | ||
95 | |||
96 | static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) | 94 | static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) |
97 | { | 95 | { |
98 | const struct hc_driver *driver = &ohci_spear_hc_driver; | 96 | const struct hc_driver *driver = &ohci_spear_hc_driver; |
@@ -114,7 +112,9 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) | |||
114 | * Once we have dma capability bindings this can go away. | 112 | * Once we have dma capability bindings this can go away. |
115 | */ | 113 | */ |
116 | if (!pdev->dev.dma_mask) | 114 | if (!pdev->dev.dma_mask) |
117 | pdev->dev.dma_mask = &spear_ohci_dma_mask; | 115 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
116 | if (!pdev->dev.coherent_dma_mask) | ||
117 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
118 | 118 | ||
119 | usbh_clk = devm_clk_get(&pdev->dev, NULL); | 119 | usbh_clk = devm_clk_get(&pdev->dev, NULL); |
120 | if (IS_ERR(usbh_clk)) { | 120 | if (IS_ERR(usbh_clk)) { |
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c index 4f0f0339532f..0f401dbfaf07 100644 --- a/drivers/usb/host/oxu210hp-hcd.c +++ b/drivers/usb/host/oxu210hp-hcd.c | |||
@@ -3084,7 +3084,7 @@ static int oxu_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
3084 | int ports, i, retval = 1; | 3084 | int ports, i, retval = 1; |
3085 | unsigned long flags; | 3085 | unsigned long flags; |
3086 | 3086 | ||
3087 | /* if !USB_SUSPEND, root hub timers won't get shut down ... */ | 3087 | /* if !PM_RUNTIME, root hub timers won't get shut down ... */ |
3088 | if (!HC_IS_RUNNING(hcd->state)) | 3088 | if (!HC_IS_RUNNING(hcd->state)) |
3089 | return 0; | 3089 | return 0; |
3090 | 3090 | ||
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index ad4483efb6d6..b2ec7fe758dd 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * and usb-storage. | 22 | * and usb-storage. |
23 | * | 23 | * |
24 | * TODO: | 24 | * TODO: |
25 | * - usb suspend/resume triggered by sl811 (with USB_SUSPEND) | 25 | * - usb suspend/resume triggered by sl811 (with PM_RUNTIME) |
26 | * - various issues noted in the code | 26 | * - various issues noted in the code |
27 | * - performance work; use both register banks; ... | 27 | * - performance work; use both register banks; ... |
28 | * - use urb->iso_frame_desc[] with ISO transfers | 28 | * - use urb->iso_frame_desc[] with ISO transfers |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index f87bee6d2789..9189bc984c98 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -225,7 +225,8 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
225 | /* auto-stop if nothing connected for 1 second */ | 225 | /* auto-stop if nothing connected for 1 second */ |
226 | if (any_ports_active(uhci)) | 226 | if (any_ports_active(uhci)) |
227 | uhci->rh_state = UHCI_RH_RUNNING; | 227 | uhci->rh_state = UHCI_RH_RUNNING; |
228 | else if (time_after_eq(jiffies, uhci->auto_stop_time)) | 228 | else if (time_after_eq(jiffies, uhci->auto_stop_time) && |
229 | !uhci->wait_for_hp) | ||
229 | suspend_rh(uhci, UHCI_RH_AUTO_STOPPED); | 230 | suspend_rh(uhci, UHCI_RH_AUTO_STOPPED); |
230 | break; | 231 | break; |
231 | 232 | ||
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index 8c4dace4b14a..f1db61ada6a8 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c | |||
@@ -60,8 +60,6 @@ static const struct hc_driver uhci_platform_hc_driver = { | |||
60 | .hub_control = uhci_hub_control, | 60 | .hub_control = uhci_hub_control, |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static u64 platform_uhci_dma_mask = DMA_BIT_MASK(32); | ||
64 | |||
65 | static int uhci_hcd_platform_probe(struct platform_device *pdev) | 63 | static int uhci_hcd_platform_probe(struct platform_device *pdev) |
66 | { | 64 | { |
67 | struct usb_hcd *hcd; | 65 | struct usb_hcd *hcd; |
@@ -78,7 +76,9 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) | |||
78 | * Once we have dma capability bindings this can go away. | 76 | * Once we have dma capability bindings this can go away. |
79 | */ | 77 | */ |
80 | if (!pdev->dev.dma_mask) | 78 | if (!pdev->dev.dma_mask) |
81 | pdev->dev.dma_mask = &platform_uhci_dma_mask; | 79 | pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
80 | if (!pdev->dev.coherent_dma_mask) | ||
81 | pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | ||
82 | 82 | ||
83 | hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev, | 83 | hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev, |
84 | pdev->name); | 84 | pdev->name); |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index f0976d8190bc..041c6ddb695c 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -1287,7 +1287,7 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb, | |||
1287 | return -EINVAL; /* Can't change the period */ | 1287 | return -EINVAL; /* Can't change the period */ |
1288 | 1288 | ||
1289 | } else { | 1289 | } else { |
1290 | next = uhci->frame_number + 2; | 1290 | next = uhci->frame_number + 1; |
1291 | 1291 | ||
1292 | /* Find the next unused frame */ | 1292 | /* Find the next unused frame */ |
1293 | if (list_empty(&qh->queue)) { | 1293 | if (list_empty(&qh->queue)) { |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 965b539bc474..fbf75e57628b 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1423,15 +1423,17 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
1423 | ep_ctx->ep_info2 |= cpu_to_le32(xhci_get_endpoint_type(udev, ep)); | 1423 | ep_ctx->ep_info2 |= cpu_to_le32(xhci_get_endpoint_type(udev, ep)); |
1424 | 1424 | ||
1425 | /* Set the max packet size and max burst */ | 1425 | /* Set the max packet size and max burst */ |
1426 | max_packet = GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc)); | ||
1427 | max_burst = 0; | ||
1426 | switch (udev->speed) { | 1428 | switch (udev->speed) { |
1427 | case USB_SPEED_SUPER: | 1429 | case USB_SPEED_SUPER: |
1428 | max_packet = usb_endpoint_maxp(&ep->desc); | ||
1429 | ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet)); | ||
1430 | /* dig out max burst from ep companion desc */ | 1430 | /* dig out max burst from ep companion desc */ |
1431 | max_packet = ep->ss_ep_comp.bMaxBurst; | 1431 | max_burst = ep->ss_ep_comp.bMaxBurst; |
1432 | ep_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(max_packet)); | ||
1433 | break; | 1432 | break; |
1434 | case USB_SPEED_HIGH: | 1433 | case USB_SPEED_HIGH: |
1434 | /* Some devices get this wrong */ | ||
1435 | if (usb_endpoint_xfer_bulk(&ep->desc)) | ||
1436 | max_packet = 512; | ||
1435 | /* bits 11:12 specify the number of additional transaction | 1437 | /* bits 11:12 specify the number of additional transaction |
1436 | * opportunities per microframe (USB 2.0, section 9.6.6) | 1438 | * opportunities per microframe (USB 2.0, section 9.6.6) |
1437 | */ | 1439 | */ |
@@ -1439,17 +1441,16 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
1439 | usb_endpoint_xfer_int(&ep->desc)) { | 1441 | usb_endpoint_xfer_int(&ep->desc)) { |
1440 | max_burst = (usb_endpoint_maxp(&ep->desc) | 1442 | max_burst = (usb_endpoint_maxp(&ep->desc) |
1441 | & 0x1800) >> 11; | 1443 | & 0x1800) >> 11; |
1442 | ep_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(max_burst)); | ||
1443 | } | 1444 | } |
1444 | /* Fall through */ | 1445 | break; |
1445 | case USB_SPEED_FULL: | 1446 | case USB_SPEED_FULL: |
1446 | case USB_SPEED_LOW: | 1447 | case USB_SPEED_LOW: |
1447 | max_packet = GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc)); | ||
1448 | ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet)); | ||
1449 | break; | 1448 | break; |
1450 | default: | 1449 | default: |
1451 | BUG(); | 1450 | BUG(); |
1452 | } | 1451 | } |
1452 | ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet) | | ||
1453 | MAX_BURST(max_burst)); | ||
1453 | max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep); | 1454 | max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep); |
1454 | ep_ctx->tx_info = cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload)); | 1455 | ep_ctx->tx_info = cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload)); |
1455 | 1456 | ||
@@ -1826,6 +1827,9 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1826 | } | 1827 | } |
1827 | spin_unlock_irqrestore(&xhci->lock, flags); | 1828 | spin_unlock_irqrestore(&xhci->lock, flags); |
1828 | 1829 | ||
1830 | if (!xhci->rh_bw) | ||
1831 | goto no_bw; | ||
1832 | |||
1829 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); | 1833 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); |
1830 | for (i = 0; i < num_ports; i++) { | 1834 | for (i = 0; i < num_ports; i++) { |
1831 | struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; | 1835 | struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; |
@@ -1844,6 +1848,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1844 | } | 1848 | } |
1845 | } | 1849 | } |
1846 | 1850 | ||
1851 | no_bw: | ||
1847 | xhci->num_usb2_ports = 0; | 1852 | xhci->num_usb2_ports = 0; |
1848 | xhci->num_usb3_ports = 0; | 1853 | xhci->num_usb3_ports = 0; |
1849 | xhci->num_active_eps = 0; | 1854 | xhci->num_active_eps = 0; |
@@ -2255,6 +2260,9 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
2255 | u32 page_size, temp; | 2260 | u32 page_size, temp; |
2256 | int i; | 2261 | int i; |
2257 | 2262 | ||
2263 | INIT_LIST_HEAD(&xhci->lpm_failed_devs); | ||
2264 | INIT_LIST_HEAD(&xhci->cancel_cmd_list); | ||
2265 | |||
2258 | page_size = xhci_readl(xhci, &xhci->op_regs->page_size); | 2266 | page_size = xhci_readl(xhci, &xhci->op_regs->page_size); |
2259 | xhci_dbg(xhci, "Supported page size register = 0x%x\n", page_size); | 2267 | xhci_dbg(xhci, "Supported page size register = 0x%x\n", page_size); |
2260 | for (i = 0; i < 16; i++) { | 2268 | for (i = 0; i < 16; i++) { |
@@ -2333,7 +2341,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
2333 | xhci->cmd_ring = xhci_ring_alloc(xhci, 1, 1, TYPE_COMMAND, flags); | 2341 | xhci->cmd_ring = xhci_ring_alloc(xhci, 1, 1, TYPE_COMMAND, flags); |
2334 | if (!xhci->cmd_ring) | 2342 | if (!xhci->cmd_ring) |
2335 | goto fail; | 2343 | goto fail; |
2336 | INIT_LIST_HEAD(&xhci->cancel_cmd_list); | ||
2337 | xhci_dbg(xhci, "Allocated command ring at %p\n", xhci->cmd_ring); | 2344 | xhci_dbg(xhci, "Allocated command ring at %p\n", xhci->cmd_ring); |
2338 | xhci_dbg(xhci, "First segment DMA is 0x%llx\n", | 2345 | xhci_dbg(xhci, "First segment DMA is 0x%llx\n", |
2339 | (unsigned long long)xhci->cmd_ring->first_seg->dma); | 2346 | (unsigned long long)xhci->cmd_ring->first_seg->dma); |
@@ -2444,8 +2451,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
2444 | if (xhci_setup_port_arrays(xhci, flags)) | 2451 | if (xhci_setup_port_arrays(xhci, flags)) |
2445 | goto fail; | 2452 | goto fail; |
2446 | 2453 | ||
2447 | INIT_LIST_HEAD(&xhci->lpm_failed_devs); | ||
2448 | |||
2449 | /* Enable USB 3.0 device notifications for function remote wake, which | 2454 | /* Enable USB 3.0 device notifications for function remote wake, which |
2450 | * is necessary for allowing USB 3.0 devices to do remote wakeup from | 2455 | * is necessary for allowing USB 3.0 devices to do remote wakeup from |
2451 | * U3 (device suspend). | 2456 | * U3 (device suspend). |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 1a30c380043c..cc24e39b97d5 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -221,6 +221,14 @@ static void xhci_pci_remove(struct pci_dev *dev) | |||
221 | static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | 221 | static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) |
222 | { | 222 | { |
223 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 223 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
224 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
225 | |||
226 | /* | ||
227 | * Systems with the TI redriver that loses port status change events | ||
228 | * need to have the registers polled during D3, so avoid D3cold. | ||
229 | */ | ||
230 | if (xhci_compliance_mode_recovery_timer_quirk_check()) | ||
231 | pdev->no_d3cold = true; | ||
224 | 232 | ||
225 | return xhci_suspend(xhci); | 233 | return xhci_suspend(xhci); |
226 | } | 234 | } |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index b4aa79d154b2..d8f640b12dd9 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -466,7 +466,7 @@ static void compliance_mode_recovery_timer_init(struct xhci_hcd *xhci) | |||
466 | * Systems: | 466 | * Systems: |
467 | * Vendor: Hewlett-Packard -> System Models: Z420, Z620 and Z820 | 467 | * Vendor: Hewlett-Packard -> System Models: Z420, Z620 and Z820 |
468 | */ | 468 | */ |
469 | static bool compliance_mode_recovery_timer_quirk_check(void) | 469 | bool xhci_compliance_mode_recovery_timer_quirk_check(void) |
470 | { | 470 | { |
471 | const char *dmi_product_name, *dmi_sys_vendor; | 471 | const char *dmi_product_name, *dmi_sys_vendor; |
472 | 472 | ||
@@ -517,7 +517,7 @@ int xhci_init(struct usb_hcd *hcd) | |||
517 | xhci_dbg(xhci, "Finished xhci_init\n"); | 517 | xhci_dbg(xhci, "Finished xhci_init\n"); |
518 | 518 | ||
519 | /* Initializing Compliance Mode Recovery Data If Needed */ | 519 | /* Initializing Compliance Mode Recovery Data If Needed */ |
520 | if (compliance_mode_recovery_timer_quirk_check()) { | 520 | if (xhci_compliance_mode_recovery_timer_quirk_check()) { |
521 | xhci->quirks |= XHCI_COMP_MODE_QUIRK; | 521 | xhci->quirks |= XHCI_COMP_MODE_QUIRK; |
522 | compliance_mode_recovery_timer_init(xhci); | 522 | compliance_mode_recovery_timer_init(xhci); |
523 | } | 523 | } |
@@ -956,6 +956,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
956 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 956 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
957 | struct usb_hcd *secondary_hcd; | 957 | struct usb_hcd *secondary_hcd; |
958 | int retval = 0; | 958 | int retval = 0; |
959 | bool comp_timer_running = false; | ||
959 | 960 | ||
960 | /* Wait a bit if either of the roothubs need to settle from the | 961 | /* Wait a bit if either of the roothubs need to settle from the |
961 | * transition into bus suspend. | 962 | * transition into bus suspend. |
@@ -993,6 +994,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
993 | 994 | ||
994 | /* If restore operation fails, re-initialize the HC during resume */ | 995 | /* If restore operation fails, re-initialize the HC during resume */ |
995 | if ((temp & STS_SRE) || hibernated) { | 996 | if ((temp & STS_SRE) || hibernated) { |
997 | |||
998 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && | ||
999 | !(xhci_all_ports_seen_u0(xhci))) { | ||
1000 | del_timer_sync(&xhci->comp_mode_recovery_timer); | ||
1001 | xhci_dbg(xhci, "Compliance Mode Recovery Timer deleted!\n"); | ||
1002 | } | ||
1003 | |||
996 | /* Let the USB core know _both_ roothubs lost power. */ | 1004 | /* Let the USB core know _both_ roothubs lost power. */ |
997 | usb_root_hub_lost_power(xhci->main_hcd->self.root_hub); | 1005 | usb_root_hub_lost_power(xhci->main_hcd->self.root_hub); |
998 | usb_root_hub_lost_power(xhci->shared_hcd->self.root_hub); | 1006 | usb_root_hub_lost_power(xhci->shared_hcd->self.root_hub); |
@@ -1035,6 +1043,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
1035 | retval = xhci_init(hcd->primary_hcd); | 1043 | retval = xhci_init(hcd->primary_hcd); |
1036 | if (retval) | 1044 | if (retval) |
1037 | return retval; | 1045 | return retval; |
1046 | comp_timer_running = true; | ||
1047 | |||
1038 | xhci_dbg(xhci, "Start the primary HCD\n"); | 1048 | xhci_dbg(xhci, "Start the primary HCD\n"); |
1039 | retval = xhci_run(hcd->primary_hcd); | 1049 | retval = xhci_run(hcd->primary_hcd); |
1040 | if (!retval) { | 1050 | if (!retval) { |
@@ -1076,7 +1086,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
1076 | * to suffer the Compliance Mode issue again. It doesn't matter if | 1086 | * to suffer the Compliance Mode issue again. It doesn't matter if |
1077 | * ports have entered previously to U0 before system's suspension. | 1087 | * ports have entered previously to U0 before system's suspension. |
1078 | */ | 1088 | */ |
1079 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) | 1089 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !comp_timer_running) |
1080 | compliance_mode_recovery_timer_init(xhci); | 1090 | compliance_mode_recovery_timer_init(xhci); |
1081 | 1091 | ||
1082 | /* Re-enable port polling. */ | 1092 | /* Re-enable port polling. */ |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 29c978e37135..77600cefcaf1 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1853,4 +1853,7 @@ struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_hcd *xhci, | |||
1853 | struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); | 1853 | struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); |
1854 | struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int ep_index); | 1854 | struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int ep_index); |
1855 | 1855 | ||
1856 | /* xHCI quirks */ | ||
1857 | bool xhci_compliance_mode_recovery_timer_quirk_check(void); | ||
1858 | |||
1856 | #endif /* __LINUX_XHCI_HCD_H */ | 1859 | #endif /* __LINUX_XHCI_HCD_H */ |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 3a18e44e9391..e1b661d04021 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -560,6 +560,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) | |||
560 | if (!config) { | 560 | if (!config) { |
561 | dev_err(&pdev->dev, | 561 | dev_err(&pdev->dev, |
562 | "failed to allocate musb hdrc config\n"); | 562 | "failed to allocate musb hdrc config\n"); |
563 | ret = -ENOMEM; | ||
563 | goto err2; | 564 | goto err2; |
564 | } | 565 | } |
565 | 566 | ||
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 8914dec49f01..9d3044bdebe5 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -1232,7 +1232,6 @@ void musb_host_tx(struct musb *musb, u8 epnum) | |||
1232 | void __iomem *mbase = musb->mregs; | 1232 | void __iomem *mbase = musb->mregs; |
1233 | struct dma_channel *dma; | 1233 | struct dma_channel *dma; |
1234 | bool transfer_pending = false; | 1234 | bool transfer_pending = false; |
1235 | static bool use_sg; | ||
1236 | 1235 | ||
1237 | musb_ep_select(mbase, epnum); | 1236 | musb_ep_select(mbase, epnum); |
1238 | tx_csr = musb_readw(epio, MUSB_TXCSR); | 1237 | tx_csr = musb_readw(epio, MUSB_TXCSR); |
@@ -1463,9 +1462,9 @@ done: | |||
1463 | * NULL. | 1462 | * NULL. |
1464 | */ | 1463 | */ |
1465 | if (!urb->transfer_buffer) | 1464 | if (!urb->transfer_buffer) |
1466 | use_sg = true; | 1465 | qh->use_sg = true; |
1467 | 1466 | ||
1468 | if (use_sg) { | 1467 | if (qh->use_sg) { |
1469 | /* sg_miter_start is already done in musb_ep_program */ | 1468 | /* sg_miter_start is already done in musb_ep_program */ |
1470 | if (!sg_miter_next(&qh->sg_miter)) { | 1469 | if (!sg_miter_next(&qh->sg_miter)) { |
1471 | dev_err(musb->controller, "error: sg list empty\n"); | 1470 | dev_err(musb->controller, "error: sg list empty\n"); |
@@ -1484,9 +1483,9 @@ done: | |||
1484 | 1483 | ||
1485 | qh->segsize = length; | 1484 | qh->segsize = length; |
1486 | 1485 | ||
1487 | if (use_sg) { | 1486 | if (qh->use_sg) { |
1488 | if (offset + length >= urb->transfer_buffer_length) | 1487 | if (offset + length >= urb->transfer_buffer_length) |
1489 | use_sg = false; | 1488 | qh->use_sg = false; |
1490 | } | 1489 | } |
1491 | 1490 | ||
1492 | musb_ep_select(mbase, epnum); | 1491 | musb_ep_select(mbase, epnum); |
@@ -1552,7 +1551,6 @@ void musb_host_rx(struct musb *musb, u8 epnum) | |||
1552 | bool done = false; | 1551 | bool done = false; |
1553 | u32 status; | 1552 | u32 status; |
1554 | struct dma_channel *dma; | 1553 | struct dma_channel *dma; |
1555 | static bool use_sg; | ||
1556 | unsigned int sg_flags = SG_MITER_ATOMIC | SG_MITER_TO_SG; | 1554 | unsigned int sg_flags = SG_MITER_ATOMIC | SG_MITER_TO_SG; |
1557 | 1555 | ||
1558 | musb_ep_select(mbase, epnum); | 1556 | musb_ep_select(mbase, epnum); |
@@ -1878,12 +1876,12 @@ void musb_host_rx(struct musb *musb, u8 epnum) | |||
1878 | * NULL. | 1876 | * NULL. |
1879 | */ | 1877 | */ |
1880 | if (!urb->transfer_buffer) { | 1878 | if (!urb->transfer_buffer) { |
1881 | use_sg = true; | 1879 | qh->use_sg = true; |
1882 | sg_miter_start(&qh->sg_miter, urb->sg, 1, | 1880 | sg_miter_start(&qh->sg_miter, urb->sg, 1, |
1883 | sg_flags); | 1881 | sg_flags); |
1884 | } | 1882 | } |
1885 | 1883 | ||
1886 | if (use_sg) { | 1884 | if (qh->use_sg) { |
1887 | if (!sg_miter_next(&qh->sg_miter)) { | 1885 | if (!sg_miter_next(&qh->sg_miter)) { |
1888 | dev_err(musb->controller, "error: sg list empty\n"); | 1886 | dev_err(musb->controller, "error: sg list empty\n"); |
1889 | sg_miter_stop(&qh->sg_miter); | 1887 | sg_miter_stop(&qh->sg_miter); |
@@ -1913,8 +1911,8 @@ finish: | |||
1913 | urb->actual_length += xfer_len; | 1911 | urb->actual_length += xfer_len; |
1914 | qh->offset += xfer_len; | 1912 | qh->offset += xfer_len; |
1915 | if (done) { | 1913 | if (done) { |
1916 | if (use_sg) | 1914 | if (qh->use_sg) |
1917 | use_sg = false; | 1915 | qh->use_sg = false; |
1918 | 1916 | ||
1919 | if (urb->status == -EINPROGRESS) | 1917 | if (urb->status == -EINPROGRESS) |
1920 | urb->status = status; | 1918 | urb->status = status; |
diff --git a/drivers/usb/musb/musb_host.h b/drivers/usb/musb/musb_host.h index 5a9c8feec10c..738f7eb60df9 100644 --- a/drivers/usb/musb/musb_host.h +++ b/drivers/usb/musb/musb_host.h | |||
@@ -74,6 +74,7 @@ struct musb_qh { | |||
74 | u16 frame; /* for periodic schedule */ | 74 | u16 frame; /* for periodic schedule */ |
75 | unsigned iso_idx; /* in urb->iso_frame_desc[] */ | 75 | unsigned iso_idx; /* in urb->iso_frame_desc[] */ |
76 | struct sg_mapping_iter sg_miter; /* for highmem in PIO mode */ | 76 | struct sg_mapping_iter sg_miter; /* for highmem in PIO mode */ |
77 | bool use_sg; /* to track urb using sglist */ | ||
77 | }; | 78 | }; |
78 | 79 | ||
79 | /* map from control or bulk queue head to the first qh on that ring */ | 80 | /* map from control or bulk queue head to the first qh on that ring */ |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 3551f1a30c65..628b93fe5ccc 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -549,7 +549,8 @@ static int omap2430_probe(struct platform_device *pdev) | |||
549 | glue->control_otghs = omap_get_control_dev(); | 549 | glue->control_otghs = omap_get_control_dev(); |
550 | if (IS_ERR(glue->control_otghs)) { | 550 | if (IS_ERR(glue->control_otghs)) { |
551 | dev_vdbg(&pdev->dev, "Failed to get control device\n"); | 551 | dev_vdbg(&pdev->dev, "Failed to get control device\n"); |
552 | return -ENODEV; | 552 | ret = PTR_ERR(glue->control_otghs); |
553 | goto err2; | ||
553 | } | 554 | } |
554 | } else { | 555 | } else { |
555 | glue->control_otghs = ERR_PTR(-ENODEV); | 556 | glue->control_otghs = ERR_PTR(-ENODEV); |
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 371d0e74e909..2311b1e4e43c 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig | |||
@@ -4,11 +4,17 @@ | |||
4 | menuconfig USB_PHY | 4 | menuconfig USB_PHY |
5 | bool "USB Physical Layer drivers" | 5 | bool "USB Physical Layer drivers" |
6 | help | 6 | help |
7 | USB controllers (those which are host, device or DRD) need a | 7 | Most USB controllers have the physical layer signalling part |
8 | device to handle the physical layer signalling, commonly called | 8 | (commonly called a PHY) built in. However, dual-role devices |
9 | a PHY. | 9 | (a.k.a. USB on-the-go) which support being USB master or slave |
10 | with the same connector often use an external PHY. | ||
10 | 11 | ||
11 | The following drivers add support for such PHY devices. | 12 | The drivers in this submenu add support for such PHY devices. |
13 | They are not needed for standard master-only (or the vast | ||
14 | majority of slave-only) USB interfaces. | ||
15 | |||
16 | If you're not sure if this applies to you, it probably doesn't; | ||
17 | say N here. | ||
12 | 18 | ||
13 | if USB_PHY | 19 | if USB_PHY |
14 | 20 | ||
@@ -25,7 +31,7 @@ config AB8500_USB | |||
25 | 31 | ||
26 | config FSL_USB2_OTG | 32 | config FSL_USB2_OTG |
27 | bool "Freescale USB OTG Transceiver Driver" | 33 | bool "Freescale USB OTG Transceiver Driver" |
28 | depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_SUSPEND | 34 | depends on USB_EHCI_FSL && USB_FSL_USB2 && PM_RUNTIME |
29 | select USB_OTG | 35 | select USB_OTG |
30 | help | 36 | help |
31 | Enable this to support Freescale USB OTG transceiver. | 37 | Enable this to support Freescale USB OTG transceiver. |
@@ -139,7 +145,6 @@ config USB_ISP1301 | |||
139 | tristate "NXP ISP1301 USB transceiver support" | 145 | tristate "NXP ISP1301 USB transceiver support" |
140 | depends on USB || USB_GADGET | 146 | depends on USB || USB_GADGET |
141 | depends on I2C | 147 | depends on I2C |
142 | select USB_OTG_UTILS | ||
143 | help | 148 | help |
144 | Say Y here to add support for the NXP ISP1301 USB transceiver driver. | 149 | Say Y here to add support for the NXP ISP1301 USB transceiver driver. |
145 | This chip is typically used as USB transceiver for USB host, gadget | 150 | This chip is typically used as USB transceiver for USB host, gadget |
@@ -162,7 +167,7 @@ config USB_MSM_OTG | |||
162 | 167 | ||
163 | config USB_MV_OTG | 168 | config USB_MV_OTG |
164 | tristate "Marvell USB OTG support" | 169 | tristate "Marvell USB OTG support" |
165 | depends on USB_EHCI_MV && USB_MV_UDC && USB_SUSPEND | 170 | depends on USB_EHCI_MV && USB_MV_UDC && PM_RUNTIME |
166 | select USB_OTG | 171 | select USB_OTG |
167 | help | 172 | help |
168 | Say Y here if you want to build Marvell USB OTG transciever | 173 | Say Y here if you want to build Marvell USB OTG transciever |
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 4acef26a2ef5..e5eb1b5a04eb 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c | |||
@@ -892,8 +892,6 @@ static int ab8500_usb_remove(struct platform_device *pdev) | |||
892 | else if (ab->mode == USB_PERIPHERAL) | 892 | else if (ab->mode == USB_PERIPHERAL) |
893 | ab8500_usb_peri_phy_dis(ab); | 893 | ab8500_usb_peri_phy_dis(ab); |
894 | 894 | ||
895 | platform_set_drvdata(pdev, NULL); | ||
896 | |||
897 | return 0; | 895 | return 0; |
898 | } | 896 | } |
899 | 897 | ||
diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 97b9308507c3..e771bafb9f1d 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c | |||
@@ -799,6 +799,7 @@ static int fsl_otg_conf(struct platform_device *pdev) | |||
799 | 799 | ||
800 | /* initialize the otg structure */ | 800 | /* initialize the otg structure */ |
801 | fsl_otg_tc->phy.label = DRIVER_DESC; | 801 | fsl_otg_tc->phy.label = DRIVER_DESC; |
802 | fsl_otg_tc->phy.dev = &pdev->dev; | ||
802 | fsl_otg_tc->phy.set_power = fsl_otg_set_power; | 803 | fsl_otg_tc->phy.set_power = fsl_otg_set_power; |
803 | 804 | ||
804 | fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy; | 805 | fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy; |
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c index 4c76074e518d..8443335c2ea0 100644 --- a/drivers/usb/phy/phy-gpio-vbus-usb.c +++ b/drivers/usb/phy/phy-gpio-vbus-usb.c | |||
@@ -266,6 +266,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) | |||
266 | platform_set_drvdata(pdev, gpio_vbus); | 266 | platform_set_drvdata(pdev, gpio_vbus); |
267 | gpio_vbus->dev = &pdev->dev; | 267 | gpio_vbus->dev = &pdev->dev; |
268 | gpio_vbus->phy.label = "gpio-vbus"; | 268 | gpio_vbus->phy.label = "gpio-vbus"; |
269 | gpio_vbus->phy.dev = gpio_vbus->dev; | ||
269 | gpio_vbus->phy.set_power = gpio_vbus_set_power; | 270 | gpio_vbus->phy.set_power = gpio_vbus_set_power; |
270 | gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; | 271 | gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; |
271 | gpio_vbus->phy.state = OTG_STATE_UNDEFINED; | 272 | gpio_vbus->phy.state = OTG_STATE_UNDEFINED; |
@@ -343,7 +344,6 @@ err_irq: | |||
343 | gpio_free(pdata->gpio_pullup); | 344 | gpio_free(pdata->gpio_pullup); |
344 | gpio_free(pdata->gpio_vbus); | 345 | gpio_free(pdata->gpio_vbus); |
345 | err_gpio: | 346 | err_gpio: |
346 | platform_set_drvdata(pdev, NULL); | ||
347 | kfree(gpio_vbus->phy.otg); | 347 | kfree(gpio_vbus->phy.otg); |
348 | kfree(gpio_vbus); | 348 | kfree(gpio_vbus); |
349 | return err; | 349 | return err; |
@@ -365,7 +365,6 @@ static int __exit gpio_vbus_remove(struct platform_device *pdev) | |||
365 | if (gpio_is_valid(pdata->gpio_pullup)) | 365 | if (gpio_is_valid(pdata->gpio_pullup)) |
366 | gpio_free(pdata->gpio_pullup); | 366 | gpio_free(pdata->gpio_pullup); |
367 | gpio_free(gpio); | 367 | gpio_free(gpio); |
368 | platform_set_drvdata(pdev, NULL); | ||
369 | kfree(gpio_vbus->phy.otg); | 368 | kfree(gpio_vbus->phy.otg); |
370 | kfree(gpio_vbus); | 369 | kfree(gpio_vbus); |
371 | 370 | ||
diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c index 225ae6c97eeb..8a55b37d1a02 100644 --- a/drivers/usb/phy/phy-isp1301.c +++ b/drivers/usb/phy/phy-isp1301.c | |||
@@ -102,6 +102,7 @@ static int isp1301_probe(struct i2c_client *client, | |||
102 | mutex_init(&isp->mutex); | 102 | mutex_init(&isp->mutex); |
103 | 103 | ||
104 | phy = &isp->phy; | 104 | phy = &isp->phy; |
105 | phy->dev = &client->dev; | ||
105 | phy->label = DRV_NAME; | 106 | phy->label = DRV_NAME; |
106 | phy->init = isp1301_phy_init; | 107 | phy->init = isp1301_phy_init; |
107 | phy->set_vbus = isp1301_phy_set_vbus; | 108 | phy->set_vbus = isp1301_phy_set_vbus; |
diff --git a/drivers/usb/phy/phy-mv-u3d-usb.c b/drivers/usb/phy/phy-mv-u3d-usb.c index f7838a43347c..1568ea63e338 100644 --- a/drivers/usb/phy/phy-mv-u3d-usb.c +++ b/drivers/usb/phy/phy-mv-u3d-usb.c | |||
@@ -278,11 +278,6 @@ static int mv_u3d_phy_probe(struct platform_device *pdev) | |||
278 | } | 278 | } |
279 | 279 | ||
280 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 280 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
281 | if (!res) { | ||
282 | dev_err(dev, "missing mem resource\n"); | ||
283 | return -ENODEV; | ||
284 | } | ||
285 | |||
286 | phy_base = devm_ioremap_resource(dev, res); | 281 | phy_base = devm_ioremap_resource(dev, res); |
287 | if (IS_ERR(phy_base)) | 282 | if (IS_ERR(phy_base)) |
288 | return PTR_ERR(phy_base); | 283 | return PTR_ERR(phy_base); |
diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c index c987bbe27851..4a6b03c73876 100644 --- a/drivers/usb/phy/phy-mv-usb.c +++ b/drivers/usb/phy/phy-mv-usb.c | |||
@@ -667,7 +667,6 @@ int mv_otg_remove(struct platform_device *pdev) | |||
667 | mv_otg_disable(mvotg); | 667 | mv_otg_disable(mvotg); |
668 | 668 | ||
669 | usb_remove_phy(&mvotg->phy); | 669 | usb_remove_phy(&mvotg->phy); |
670 | platform_set_drvdata(pdev, NULL); | ||
671 | 670 | ||
672 | return 0; | 671 | return 0; |
673 | } | 672 | } |
@@ -850,8 +849,6 @@ err_destroy_workqueue: | |||
850 | flush_workqueue(mvotg->qwork); | 849 | flush_workqueue(mvotg->qwork); |
851 | destroy_workqueue(mvotg->qwork); | 850 | destroy_workqueue(mvotg->qwork); |
852 | 851 | ||
853 | platform_set_drvdata(pdev, NULL); | ||
854 | |||
855 | return retval; | 852 | return retval; |
856 | } | 853 | } |
857 | 854 | ||
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 9d4381e64d51..bd601c537c8d 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c | |||
@@ -130,11 +130,6 @@ static int mxs_phy_probe(struct platform_device *pdev) | |||
130 | int ret; | 130 | int ret; |
131 | 131 | ||
132 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 132 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
133 | if (!res) { | ||
134 | dev_err(&pdev->dev, "can't get device resources\n"); | ||
135 | return -ENOENT; | ||
136 | } | ||
137 | |||
138 | base = devm_ioremap_resource(&pdev->dev, res); | 133 | base = devm_ioremap_resource(&pdev->dev, res); |
139 | if (IS_ERR(base)) | 134 | if (IS_ERR(base)) |
140 | return PTR_ERR(base); | 135 | return PTR_ERR(base); |
@@ -160,6 +155,7 @@ static int mxs_phy_probe(struct platform_device *pdev) | |||
160 | mxs_phy->phy.set_suspend = mxs_phy_suspend; | 155 | mxs_phy->phy.set_suspend = mxs_phy_suspend; |
161 | mxs_phy->phy.notify_connect = mxs_phy_on_connect; | 156 | mxs_phy->phy.notify_connect = mxs_phy_on_connect; |
162 | mxs_phy->phy.notify_disconnect = mxs_phy_on_disconnect; | 157 | mxs_phy->phy.notify_disconnect = mxs_phy_on_disconnect; |
158 | mxs_phy->phy.type = USB_PHY_TYPE_USB2; | ||
163 | 159 | ||
164 | ATOMIC_INIT_NOTIFIER_HEAD(&mxs_phy->phy.notifier); | 160 | ATOMIC_INIT_NOTIFIER_HEAD(&mxs_phy->phy.notifier); |
165 | 161 | ||
@@ -180,8 +176,6 @@ static int mxs_phy_remove(struct platform_device *pdev) | |||
180 | 176 | ||
181 | usb_remove_phy(&mxs_phy->phy); | 177 | usb_remove_phy(&mxs_phy->phy); |
182 | 178 | ||
183 | platform_set_drvdata(pdev, NULL); | ||
184 | |||
185 | return 0; | 179 | return 0; |
186 | } | 180 | } |
187 | 181 | ||
diff --git a/drivers/usb/phy/phy-nop.c b/drivers/usb/phy/phy-nop.c index 2b10cc969bbb..638cc5dade35 100644 --- a/drivers/usb/phy/phy-nop.c +++ b/drivers/usb/phy/phy-nop.c | |||
@@ -254,8 +254,6 @@ static int nop_usb_xceiv_remove(struct platform_device *pdev) | |||
254 | 254 | ||
255 | usb_remove_phy(&nop->phy); | 255 | usb_remove_phy(&nop->phy); |
256 | 256 | ||
257 | platform_set_drvdata(pdev, NULL); | ||
258 | |||
259 | return 0; | 257 | return 0; |
260 | } | 258 | } |
261 | 259 | ||
diff --git a/drivers/usb/phy/phy-samsung-usb2.c b/drivers/usb/phy/phy-samsung-usb2.c index 45ffe036dacc..9d5e273abcc7 100644 --- a/drivers/usb/phy/phy-samsung-usb2.c +++ b/drivers/usb/phy/phy-samsung-usb2.c | |||
@@ -363,11 +363,6 @@ static int samsung_usb2phy_probe(struct platform_device *pdev) | |||
363 | int ret; | 363 | int ret; |
364 | 364 | ||
365 | phy_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 365 | phy_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
366 | if (!phy_mem) { | ||
367 | dev_err(dev, "%s: missing mem resource\n", __func__); | ||
368 | return -ENODEV; | ||
369 | } | ||
370 | |||
371 | phy_base = devm_ioremap_resource(dev, phy_mem); | 366 | phy_base = devm_ioremap_resource(dev, phy_mem); |
372 | if (IS_ERR(phy_base)) | 367 | if (IS_ERR(phy_base)) |
373 | return PTR_ERR(phy_base); | 368 | return PTR_ERR(phy_base); |
diff --git a/drivers/usb/phy/phy-samsung-usb3.c b/drivers/usb/phy/phy-samsung-usb3.c index 133f3d0c554f..5a9efcbcb532 100644 --- a/drivers/usb/phy/phy-samsung-usb3.c +++ b/drivers/usb/phy/phy-samsung-usb3.c | |||
@@ -239,11 +239,6 @@ static int samsung_usb3phy_probe(struct platform_device *pdev) | |||
239 | int ret; | 239 | int ret; |
240 | 240 | ||
241 | phy_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 241 | phy_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
242 | if (!phy_mem) { | ||
243 | dev_err(dev, "%s: missing mem resource\n", __func__); | ||
244 | return -ENODEV; | ||
245 | } | ||
246 | |||
247 | phy_base = devm_ioremap_resource(dev, phy_mem); | 242 | phy_base = devm_ioremap_resource(dev, phy_mem); |
248 | if (IS_ERR(phy_base)) | 243 | if (IS_ERR(phy_base)) |
249 | return PTR_ERR(phy_base); | 244 | return PTR_ERR(phy_base); |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 3b16118cbf62..40e7fd94646f 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #define DRIVER_NAME "ark3116" | 43 | #define DRIVER_NAME "ark3116" |
44 | 44 | ||
45 | /* usb timeout of 1 second */ | 45 | /* usb timeout of 1 second */ |
46 | #define ARK_TIMEOUT (1*HZ) | 46 | #define ARK_TIMEOUT 1000 |
47 | 47 | ||
48 | static const struct usb_device_id id_table[] = { | 48 | static const struct usb_device_id id_table[] = { |
49 | { USB_DEVICE(0x6547, 0x0232) }, | 49 | { USB_DEVICE(0x6547, 0x0232) }, |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index d341555d37d8..082120198f87 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -65,6 +65,7 @@ static const struct usb_device_id id_table_earthmate[] = { | |||
65 | static const struct usb_device_id id_table_cyphidcomrs232[] = { | 65 | static const struct usb_device_id id_table_cyphidcomrs232[] = { |
66 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, | 66 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, |
67 | { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, | 67 | { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, |
68 | { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) }, | ||
68 | { } /* Terminating entry */ | 69 | { } /* Terminating entry */ |
69 | }; | 70 | }; |
70 | 71 | ||
@@ -78,6 +79,7 @@ static const struct usb_device_id id_table_combined[] = { | |||
78 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, | 79 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, |
79 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, | 80 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, |
80 | { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, | 81 | { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, |
82 | { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) }, | ||
81 | { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, | 83 | { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, |
82 | { } /* Terminating entry */ | 84 | { } /* Terminating entry */ |
83 | }; | 85 | }; |
@@ -229,6 +231,12 @@ static struct usb_serial_driver * const serial_drivers[] = { | |||
229 | * Cypress serial helper functions | 231 | * Cypress serial helper functions |
230 | *****************************************************************************/ | 232 | *****************************************************************************/ |
231 | 233 | ||
234 | /* FRWD Dongle hidcom needs to skip reset and speed checks */ | ||
235 | static inline bool is_frwd(struct usb_device *dev) | ||
236 | { | ||
237 | return ((le16_to_cpu(dev->descriptor.idVendor) == VENDOR_ID_FRWD) && | ||
238 | (le16_to_cpu(dev->descriptor.idProduct) == PRODUCT_ID_CYPHIDCOM_FRWD)); | ||
239 | } | ||
232 | 240 | ||
233 | static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate) | 241 | static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate) |
234 | { | 242 | { |
@@ -238,6 +246,10 @@ static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate) | |||
238 | if (unstable_bauds) | 246 | if (unstable_bauds) |
239 | return new_rate; | 247 | return new_rate; |
240 | 248 | ||
249 | /* FRWD Dongle uses 115200 bps */ | ||
250 | if (is_frwd(port->serial->dev)) | ||
251 | return new_rate; | ||
252 | |||
241 | /* | 253 | /* |
242 | * The general purpose firmware for the Cypress M8 allows for | 254 | * The general purpose firmware for the Cypress M8 allows for |
243 | * a maximum speed of 57600bps (I have no idea whether DeLorme | 255 | * a maximum speed of 57600bps (I have no idea whether DeLorme |
@@ -448,7 +460,11 @@ static int cypress_generic_port_probe(struct usb_serial_port *port) | |||
448 | return -ENOMEM; | 460 | return -ENOMEM; |
449 | } | 461 | } |
450 | 462 | ||
451 | usb_reset_configuration(serial->dev); | 463 | /* Skip reset for FRWD device. It is a workaound: |
464 | device hangs if it receives SET_CONFIGURE in Configured | ||
465 | state. */ | ||
466 | if (!is_frwd(serial->dev)) | ||
467 | usb_reset_configuration(serial->dev); | ||
452 | 468 | ||
453 | priv->cmd_ctrl = 0; | 469 | priv->cmd_ctrl = 0; |
454 | priv->line_control = 0; | 470 | priv->line_control = 0; |
diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h index 67cf60826884..b461311a2ae7 100644 --- a/drivers/usb/serial/cypress_m8.h +++ b/drivers/usb/serial/cypress_m8.h | |||
@@ -24,6 +24,10 @@ | |||
24 | #define VENDOR_ID_CYPRESS 0x04b4 | 24 | #define VENDOR_ID_CYPRESS 0x04b4 |
25 | #define PRODUCT_ID_CYPHIDCOM 0x5500 | 25 | #define PRODUCT_ID_CYPHIDCOM 0x5500 |
26 | 26 | ||
27 | /* FRWD Dongle - a GPS sports watch */ | ||
28 | #define VENDOR_ID_FRWD 0x6737 | ||
29 | #define PRODUCT_ID_CYPHIDCOM_FRWD 0x0001 | ||
30 | |||
27 | /* Powercom UPS, chip CY7C63723 */ | 31 | /* Powercom UPS, chip CY7C63723 */ |
28 | #define VENDOR_ID_POWERCOM 0x0d9f | 32 | #define VENDOR_ID_POWERCOM 0x0d9f |
29 | #define PRODUCT_ID_UPS 0x0002 | 33 | #define PRODUCT_ID_UPS 0x0002 |
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 090b411d893f..7d8dd5aad236 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c | |||
@@ -165,11 +165,12 @@ static void f81232_set_termios(struct tty_struct *tty, | |||
165 | /* FIXME - Stubbed out for now */ | 165 | /* FIXME - Stubbed out for now */ |
166 | 166 | ||
167 | /* Don't change anything if nothing has changed */ | 167 | /* Don't change anything if nothing has changed */ |
168 | if (!tty_termios_hw_change(&tty->termios, old_termios)) | 168 | if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios)) |
169 | return; | 169 | return; |
170 | 170 | ||
171 | /* Do the real work here... */ | 171 | /* Do the real work here... */ |
172 | tty_termios_copy_hw(&tty->termios, old_termios); | 172 | if (old_termios) |
173 | tty_termios_copy_hw(&tty->termios, old_termios); | ||
173 | } | 174 | } |
174 | 175 | ||
175 | static int f81232_tiocmget(struct tty_struct *tty) | 176 | static int f81232_tiocmget(struct tty_struct *tty) |
@@ -187,12 +188,11 @@ static int f81232_tiocmset(struct tty_struct *tty, | |||
187 | 188 | ||
188 | static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port) | 189 | static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port) |
189 | { | 190 | { |
190 | struct ktermios tmp_termios; | ||
191 | int result; | 191 | int result; |
192 | 192 | ||
193 | /* Setup termios */ | 193 | /* Setup termios */ |
194 | if (tty) | 194 | if (tty) |
195 | f81232_set_termios(tty, port, &tmp_termios); | 195 | f81232_set_termios(tty, port, NULL); |
196 | 196 | ||
197 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 197 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
198 | if (result) { | 198 | if (result) { |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 242b5776648a..7260ec660347 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -189,6 +189,8 @@ static struct usb_device_id id_table_combined [] = { | |||
189 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, | 189 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, |
190 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) }, | 190 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) }, |
191 | { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) }, | 191 | { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) }, |
192 | { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_CC_PID) }, | ||
193 | { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_AGP_PID) }, | ||
192 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, | 194 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, |
193 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, | 195 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, |
194 | { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, | 196 | { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, |
@@ -924,8 +926,8 @@ static int ftdi_tiocmset(struct tty_struct *tty, | |||
924 | static int ftdi_ioctl(struct tty_struct *tty, | 926 | static int ftdi_ioctl(struct tty_struct *tty, |
925 | unsigned int cmd, unsigned long arg); | 927 | unsigned int cmd, unsigned long arg); |
926 | static void ftdi_break_ctl(struct tty_struct *tty, int break_state); | 928 | static void ftdi_break_ctl(struct tty_struct *tty, int break_state); |
927 | static int ftdi_chars_in_buffer(struct tty_struct *tty); | 929 | static bool ftdi_tx_empty(struct usb_serial_port *port); |
928 | static int ftdi_get_modem_status(struct tty_struct *tty, | 930 | static int ftdi_get_modem_status(struct usb_serial_port *port, |
929 | unsigned char status[2]); | 931 | unsigned char status[2]); |
930 | 932 | ||
931 | static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); | 933 | static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); |
@@ -961,7 +963,7 @@ static struct usb_serial_driver ftdi_sio_device = { | |||
961 | .ioctl = ftdi_ioctl, | 963 | .ioctl = ftdi_ioctl, |
962 | .set_termios = ftdi_set_termios, | 964 | .set_termios = ftdi_set_termios, |
963 | .break_ctl = ftdi_break_ctl, | 965 | .break_ctl = ftdi_break_ctl, |
964 | .chars_in_buffer = ftdi_chars_in_buffer, | 966 | .tx_empty = ftdi_tx_empty, |
965 | }; | 967 | }; |
966 | 968 | ||
967 | static struct usb_serial_driver * const serial_drivers[] = { | 969 | static struct usb_serial_driver * const serial_drivers[] = { |
@@ -2056,27 +2058,18 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state) | |||
2056 | 2058 | ||
2057 | } | 2059 | } |
2058 | 2060 | ||
2059 | static int ftdi_chars_in_buffer(struct tty_struct *tty) | 2061 | static bool ftdi_tx_empty(struct usb_serial_port *port) |
2060 | { | 2062 | { |
2061 | struct usb_serial_port *port = tty->driver_data; | ||
2062 | int chars; | ||
2063 | unsigned char buf[2]; | 2063 | unsigned char buf[2]; |
2064 | int ret; | 2064 | int ret; |
2065 | 2065 | ||
2066 | chars = usb_serial_generic_chars_in_buffer(tty); | 2066 | ret = ftdi_get_modem_status(port, buf); |
2067 | if (chars) | ||
2068 | goto out; | ||
2069 | |||
2070 | /* Check if hardware buffer is empty. */ | ||
2071 | ret = ftdi_get_modem_status(tty, buf); | ||
2072 | if (ret == 2) { | 2067 | if (ret == 2) { |
2073 | if (!(buf[1] & FTDI_RS_TEMT)) | 2068 | if (!(buf[1] & FTDI_RS_TEMT)) |
2074 | chars = 1; | 2069 | return false; |
2075 | } | 2070 | } |
2076 | out: | ||
2077 | dev_dbg(&port->dev, "%s - %d\n", __func__, chars); | ||
2078 | 2071 | ||
2079 | return chars; | 2072 | return true; |
2080 | } | 2073 | } |
2081 | 2074 | ||
2082 | /* old_termios contains the original termios settings and tty->termios contains | 2075 | /* old_termios contains the original termios settings and tty->termios contains |
@@ -2268,10 +2261,9 @@ no_c_cflag_changes: | |||
2268 | * Returns the number of status bytes retrieved (device dependant), or | 2261 | * Returns the number of status bytes retrieved (device dependant), or |
2269 | * negative error code. | 2262 | * negative error code. |
2270 | */ | 2263 | */ |
2271 | static int ftdi_get_modem_status(struct tty_struct *tty, | 2264 | static int ftdi_get_modem_status(struct usb_serial_port *port, |
2272 | unsigned char status[2]) | 2265 | unsigned char status[2]) |
2273 | { | 2266 | { |
2274 | struct usb_serial_port *port = tty->driver_data; | ||
2275 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 2267 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
2276 | unsigned char *buf; | 2268 | unsigned char *buf; |
2277 | int len; | 2269 | int len; |
@@ -2336,7 +2328,7 @@ static int ftdi_tiocmget(struct tty_struct *tty) | |||
2336 | unsigned char buf[2]; | 2328 | unsigned char buf[2]; |
2337 | int ret; | 2329 | int ret; |
2338 | 2330 | ||
2339 | ret = ftdi_get_modem_status(tty, buf); | 2331 | ret = ftdi_get_modem_status(port, buf); |
2340 | if (ret < 0) | 2332 | if (ret < 0) |
2341 | return ret; | 2333 | return ret; |
2342 | 2334 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 98528270c43c..6dd79253205d 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -772,6 +772,8 @@ | |||
772 | */ | 772 | */ |
773 | #define NEWPORT_VID 0x104D | 773 | #define NEWPORT_VID 0x104D |
774 | #define NEWPORT_AGILIS_PID 0x3000 | 774 | #define NEWPORT_AGILIS_PID 0x3000 |
775 | #define NEWPORT_CONEX_CC_PID 0x3002 | ||
776 | #define NEWPORT_CONEX_AGP_PID 0x3006 | ||
775 | 777 | ||
776 | /* Interbiometrics USB I/O Board */ | 778 | /* Interbiometrics USB I/O Board */ |
777 | /* Developed for Interbiometrics by Rudolf Gugler */ | 779 | /* Developed for Interbiometrics by Rudolf Gugler */ |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 297665fdd16d..ba45170c78e5 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -253,6 +253,37 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) | |||
253 | } | 253 | } |
254 | EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer); | 254 | EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer); |
255 | 255 | ||
256 | void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) | ||
257 | { | ||
258 | struct usb_serial_port *port = tty->driver_data; | ||
259 | unsigned int bps; | ||
260 | unsigned long period; | ||
261 | unsigned long expire; | ||
262 | |||
263 | bps = tty_get_baud_rate(tty); | ||
264 | if (!bps) | ||
265 | bps = 9600; /* B0 */ | ||
266 | /* | ||
267 | * Use a poll-period of roughly the time it takes to send one | ||
268 | * character or at least one jiffy. | ||
269 | */ | ||
270 | period = max_t(unsigned long, (10 * HZ / bps), 1); | ||
271 | period = min_t(unsigned long, period, timeout); | ||
272 | |||
273 | dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n", | ||
274 | __func__, jiffies_to_msecs(timeout), | ||
275 | jiffies_to_msecs(period)); | ||
276 | expire = jiffies + timeout; | ||
277 | while (!port->serial->type->tx_empty(port)) { | ||
278 | schedule_timeout_interruptible(period); | ||
279 | if (signal_pending(current)) | ||
280 | break; | ||
281 | if (time_after(jiffies, expire)) | ||
282 | break; | ||
283 | } | ||
284 | } | ||
285 | EXPORT_SYMBOL_GPL(usb_serial_generic_wait_until_sent); | ||
286 | |||
256 | static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, | 287 | static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, |
257 | int index, gfp_t mem_flags) | 288 | int index, gfp_t mem_flags) |
258 | { | 289 | { |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 158bf4bc29cc..1be6ba7bee27 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -2019,8 +2019,6 @@ static int edge_chars_in_buffer(struct tty_struct *tty) | |||
2019 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2019 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2020 | int chars = 0; | 2020 | int chars = 0; |
2021 | unsigned long flags; | 2021 | unsigned long flags; |
2022 | int ret; | ||
2023 | |||
2024 | if (edge_port == NULL) | 2022 | if (edge_port == NULL) |
2025 | return 0; | 2023 | return 0; |
2026 | 2024 | ||
@@ -2028,16 +2026,22 @@ static int edge_chars_in_buffer(struct tty_struct *tty) | |||
2028 | chars = kfifo_len(&edge_port->write_fifo); | 2026 | chars = kfifo_len(&edge_port->write_fifo); |
2029 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); | 2027 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
2030 | 2028 | ||
2031 | if (!chars) { | ||
2032 | ret = tx_active(edge_port); | ||
2033 | if (ret > 0) | ||
2034 | chars = ret; | ||
2035 | } | ||
2036 | |||
2037 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); | 2029 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); |
2038 | return chars; | 2030 | return chars; |
2039 | } | 2031 | } |
2040 | 2032 | ||
2033 | static bool edge_tx_empty(struct usb_serial_port *port) | ||
2034 | { | ||
2035 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | ||
2036 | int ret; | ||
2037 | |||
2038 | ret = tx_active(edge_port); | ||
2039 | if (ret > 0) | ||
2040 | return false; | ||
2041 | |||
2042 | return true; | ||
2043 | } | ||
2044 | |||
2041 | static void edge_throttle(struct tty_struct *tty) | 2045 | static void edge_throttle(struct tty_struct *tty) |
2042 | { | 2046 | { |
2043 | struct usb_serial_port *port = tty->driver_data; | 2047 | struct usb_serial_port *port = tty->driver_data; |
@@ -2557,6 +2561,7 @@ static struct usb_serial_driver edgeport_1port_device = { | |||
2557 | .write = edge_write, | 2561 | .write = edge_write, |
2558 | .write_room = edge_write_room, | 2562 | .write_room = edge_write_room, |
2559 | .chars_in_buffer = edge_chars_in_buffer, | 2563 | .chars_in_buffer = edge_chars_in_buffer, |
2564 | .tx_empty = edge_tx_empty, | ||
2560 | .break_ctl = edge_break, | 2565 | .break_ctl = edge_break, |
2561 | .read_int_callback = edge_interrupt_callback, | 2566 | .read_int_callback = edge_interrupt_callback, |
2562 | .read_bulk_callback = edge_bulk_in_callback, | 2567 | .read_bulk_callback = edge_bulk_in_callback, |
@@ -2589,6 +2594,7 @@ static struct usb_serial_driver edgeport_2port_device = { | |||
2589 | .write = edge_write, | 2594 | .write = edge_write, |
2590 | .write_room = edge_write_room, | 2595 | .write_room = edge_write_room, |
2591 | .chars_in_buffer = edge_chars_in_buffer, | 2596 | .chars_in_buffer = edge_chars_in_buffer, |
2597 | .tx_empty = edge_tx_empty, | ||
2592 | .break_ctl = edge_break, | 2598 | .break_ctl = edge_break, |
2593 | .read_int_callback = edge_interrupt_callback, | 2599 | .read_int_callback = edge_interrupt_callback, |
2594 | .read_bulk_callback = edge_bulk_in_callback, | 2600 | .read_bulk_callback = edge_bulk_in_callback, |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 9d74c278b7b5..790673e5faa7 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -287,7 +287,7 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count) | |||
287 | usb_bulk_msg(serial->dev, | 287 | usb_bulk_msg(serial->dev, |
288 | usb_sndbulkpipe(serial->dev, | 288 | usb_sndbulkpipe(serial->dev, |
289 | port->bulk_out_endpointAddress), buf, | 289 | port->bulk_out_endpointAddress), buf, |
290 | count, &actual, HZ * 1); | 290 | count, &actual, 1000); |
291 | 291 | ||
292 | if (status != IUU_OPERATION_OK) | 292 | if (status != IUU_OPERATION_OK) |
293 | dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status); | 293 | dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status); |
@@ -307,7 +307,7 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count) | |||
307 | usb_bulk_msg(serial->dev, | 307 | usb_bulk_msg(serial->dev, |
308 | usb_rcvbulkpipe(serial->dev, | 308 | usb_rcvbulkpipe(serial->dev, |
309 | port->bulk_in_endpointAddress), buf, | 309 | port->bulk_in_endpointAddress), buf, |
310 | count, &actual, HZ * 1); | 310 | count, &actual, 1000); |
311 | 311 | ||
312 | if (status != IUU_OPERATION_OK) | 312 | if (status != IUU_OPERATION_OK) |
313 | dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status); | 313 | dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status); |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index eb30d7b01f36..3549d073df22 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -1548,7 +1548,6 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, | |||
1548 | struct keyspan_serial_private *s_priv; | 1548 | struct keyspan_serial_private *s_priv; |
1549 | struct keyspan_port_private *p_priv; | 1549 | struct keyspan_port_private *p_priv; |
1550 | const struct keyspan_device_details *d_details; | 1550 | const struct keyspan_device_details *d_details; |
1551 | int outcont_urb; | ||
1552 | struct urb *this_urb; | 1551 | struct urb *this_urb; |
1553 | int device_port, err; | 1552 | int device_port, err; |
1554 | 1553 | ||
@@ -1559,7 +1558,6 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, | |||
1559 | d_details = s_priv->device_details; | 1558 | d_details = s_priv->device_details; |
1560 | device_port = port->number - port->serial->minor; | 1559 | device_port = port->number - port->serial->minor; |
1561 | 1560 | ||
1562 | outcont_urb = d_details->outcont_endpoints[port->number]; | ||
1563 | this_urb = p_priv->outcont_urb; | 1561 | this_urb = p_priv->outcont_urb; |
1564 | 1562 | ||
1565 | dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe)); | 1563 | dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe)); |
@@ -1685,14 +1683,6 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, | |||
1685 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 1683 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
1686 | if (err != 0) | 1684 | if (err != 0) |
1687 | dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err); | 1685 | dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err); |
1688 | #if 0 | ||
1689 | else { | ||
1690 | dev_dbg(&port->dev, "%s - usb_submit_urb(%d) OK %d bytes (end %d)\n", __func__ | ||
1691 | outcont_urb, this_urb->transfer_buffer_length, | ||
1692 | usb_pipeendpoint(this_urb->pipe)); | ||
1693 | } | ||
1694 | #endif | ||
1695 | |||
1696 | return 0; | 1686 | return 0; |
1697 | } | 1687 | } |
1698 | 1688 | ||
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index cc0e54345df9..f27c621a9297 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #define DRIVER_DESC "Moschip USB Serial Driver" | 40 | #define DRIVER_DESC "Moschip USB Serial Driver" |
41 | 41 | ||
42 | /* default urb timeout */ | 42 | /* default urb timeout */ |
43 | #define MOS_WDR_TIMEOUT (HZ * 5) | 43 | #define MOS_WDR_TIMEOUT 5000 |
44 | 44 | ||
45 | #define MOS_MAX_PORT 0x02 | 45 | #define MOS_MAX_PORT 0x02 |
46 | #define MOS_WRITE 0x0E | 46 | #define MOS_WRITE 0x0E |
@@ -227,11 +227,22 @@ static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum, | |||
227 | __u8 requesttype = (__u8)0xc0; | 227 | __u8 requesttype = (__u8)0xc0; |
228 | __u16 index = get_reg_index(reg); | 228 | __u16 index = get_reg_index(reg); |
229 | __u16 value = get_reg_value(reg, serial_portnum); | 229 | __u16 value = get_reg_value(reg, serial_portnum); |
230 | int status = usb_control_msg(usbdev, pipe, request, requesttype, value, | 230 | u8 *buf; |
231 | index, data, 1, MOS_WDR_TIMEOUT); | 231 | int status; |
232 | if (status < 0) | 232 | |
233 | buf = kmalloc(1, GFP_KERNEL); | ||
234 | if (!buf) | ||
235 | return -ENOMEM; | ||
236 | |||
237 | status = usb_control_msg(usbdev, pipe, request, requesttype, value, | ||
238 | index, buf, 1, MOS_WDR_TIMEOUT); | ||
239 | if (status == 1) | ||
240 | *data = *buf; | ||
241 | else if (status < 0) | ||
233 | dev_err(&usbdev->dev, | 242 | dev_err(&usbdev->dev, |
234 | "mos7720: usb_control_msg() failed: %d", status); | 243 | "mos7720: usb_control_msg() failed: %d", status); |
244 | kfree(buf); | ||
245 | |||
235 | return status; | 246 | return status; |
236 | } | 247 | } |
237 | 248 | ||
@@ -1618,7 +1629,7 @@ static void change_port_settings(struct tty_struct *tty, | |||
1618 | mos7720_port->shadowMCR |= (UART_MCR_XONANY); | 1629 | mos7720_port->shadowMCR |= (UART_MCR_XONANY); |
1619 | /* To set hardware flow control to the specified * | 1630 | /* To set hardware flow control to the specified * |
1620 | * serial port, in SP1/2_CONTROL_REG */ | 1631 | * serial port, in SP1/2_CONTROL_REG */ |
1621 | if (port->number) | 1632 | if (port_number) |
1622 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01); | 1633 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01); |
1623 | else | 1634 | else |
1624 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02); | 1635 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02); |
@@ -1927,7 +1938,7 @@ static int mos7720_startup(struct usb_serial *serial) | |||
1927 | 1938 | ||
1928 | /* setting configuration feature to one */ | 1939 | /* setting configuration feature to one */ |
1929 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 1940 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
1930 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); | 1941 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5000); |
1931 | 1942 | ||
1932 | /* start the interrupt urb */ | 1943 | /* start the interrupt urb */ |
1933 | ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); | 1944 | ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); |
@@ -1970,7 +1981,7 @@ static void mos7720_release(struct usb_serial *serial) | |||
1970 | /* wait for synchronous usb calls to return */ | 1981 | /* wait for synchronous usb calls to return */ |
1971 | if (mos_parport->msg_pending) | 1982 | if (mos_parport->msg_pending) |
1972 | wait_for_completion_timeout(&mos_parport->syncmsg_compl, | 1983 | wait_for_completion_timeout(&mos_parport->syncmsg_compl, |
1973 | MOS_WDR_TIMEOUT); | 1984 | msecs_to_jiffies(MOS_WDR_TIMEOUT)); |
1974 | 1985 | ||
1975 | parport_remove_port(mos_parport->pp); | 1986 | parport_remove_port(mos_parport->pp); |
1976 | usb_set_serial_data(serial, NULL); | 1987 | usb_set_serial_data(serial, NULL); |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index a0d5ea545982..7e998081e1cd 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -2142,13 +2142,21 @@ static int mos7840_ioctl(struct tty_struct *tty, | |||
2142 | static int mos7810_check(struct usb_serial *serial) | 2142 | static int mos7810_check(struct usb_serial *serial) |
2143 | { | 2143 | { |
2144 | int i, pass_count = 0; | 2144 | int i, pass_count = 0; |
2145 | u8 *buf; | ||
2145 | __u16 data = 0, mcr_data = 0; | 2146 | __u16 data = 0, mcr_data = 0; |
2146 | __u16 test_pattern = 0x55AA; | 2147 | __u16 test_pattern = 0x55AA; |
2148 | int res; | ||
2149 | |||
2150 | buf = kmalloc(VENDOR_READ_LENGTH, GFP_KERNEL); | ||
2151 | if (!buf) | ||
2152 | return 0; /* failed to identify 7810 */ | ||
2147 | 2153 | ||
2148 | /* Store MCR setting */ | 2154 | /* Store MCR setting */ |
2149 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 2155 | res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
2150 | MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER, | 2156 | MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER, |
2151 | &mcr_data, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); | 2157 | buf, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
2158 | if (res == VENDOR_READ_LENGTH) | ||
2159 | mcr_data = *buf; | ||
2152 | 2160 | ||
2153 | for (i = 0; i < 16; i++) { | 2161 | for (i = 0; i < 16; i++) { |
2154 | /* Send the 1-bit test pattern out to MCS7810 test pin */ | 2162 | /* Send the 1-bit test pattern out to MCS7810 test pin */ |
@@ -2158,9 +2166,12 @@ static int mos7810_check(struct usb_serial *serial) | |||
2158 | MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT); | 2166 | MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT); |
2159 | 2167 | ||
2160 | /* Read the test pattern back */ | 2168 | /* Read the test pattern back */ |
2161 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 2169 | res = usb_control_msg(serial->dev, |
2162 | MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data, | 2170 | usb_rcvctrlpipe(serial->dev, 0), MCS_RDREQ, |
2163 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); | 2171 | MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, |
2172 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); | ||
2173 | if (res == VENDOR_READ_LENGTH) | ||
2174 | data = *buf; | ||
2164 | 2175 | ||
2165 | /* If this is a MCS7810 device, both test patterns must match */ | 2176 | /* If this is a MCS7810 device, both test patterns must match */ |
2166 | if (((test_pattern >> i) ^ (~data >> 1)) & 0x0001) | 2177 | if (((test_pattern >> i) ^ (~data >> 1)) & 0x0001) |
@@ -2174,6 +2185,8 @@ static int mos7810_check(struct usb_serial *serial) | |||
2174 | MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL, | 2185 | MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL, |
2175 | 0, MOS_WDR_TIMEOUT); | 2186 | 0, MOS_WDR_TIMEOUT); |
2176 | 2187 | ||
2188 | kfree(buf); | ||
2189 | |||
2177 | if (pass_count == 16) | 2190 | if (pass_count == 16) |
2178 | return 1; | 2191 | return 1; |
2179 | 2192 | ||
@@ -2183,11 +2196,17 @@ static int mos7810_check(struct usb_serial *serial) | |||
2183 | static int mos7840_calc_num_ports(struct usb_serial *serial) | 2196 | static int mos7840_calc_num_ports(struct usb_serial *serial) |
2184 | { | 2197 | { |
2185 | __u16 data = 0x00; | 2198 | __u16 data = 0x00; |
2199 | u8 *buf; | ||
2186 | int mos7840_num_ports; | 2200 | int mos7840_num_ports; |
2187 | 2201 | ||
2188 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 2202 | buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL); |
2189 | MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data, | 2203 | if (buf) { |
2190 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); | 2204 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
2205 | MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, | ||
2206 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); | ||
2207 | data = *buf; | ||
2208 | kfree(buf); | ||
2209 | } | ||
2191 | 2210 | ||
2192 | if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 || | 2211 | if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 || |
2193 | serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) { | 2212 | serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) { |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 734372846abb..bd4323ddae1a 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -196,6 +196,7 @@ static void option_instat_callback(struct urb *urb); | |||
196 | 196 | ||
197 | #define DELL_PRODUCT_5800_MINICARD_VZW 0x8195 /* Novatel E362 */ | 197 | #define DELL_PRODUCT_5800_MINICARD_VZW 0x8195 /* Novatel E362 */ |
198 | #define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196 /* Novatel E362 */ | 198 | #define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196 /* Novatel E362 */ |
199 | #define DELL_PRODUCT_5804_MINICARD_ATT 0x819b /* Novatel E371 */ | ||
199 | 200 | ||
200 | #define KYOCERA_VENDOR_ID 0x0c88 | 201 | #define KYOCERA_VENDOR_ID 0x0c88 |
201 | #define KYOCERA_PRODUCT_KPC650 0x17da | 202 | #define KYOCERA_PRODUCT_KPC650 0x17da |
@@ -249,13 +250,7 @@ static void option_instat_callback(struct urb *urb); | |||
249 | #define ZTE_PRODUCT_MF622 0x0001 | 250 | #define ZTE_PRODUCT_MF622 0x0001 |
250 | #define ZTE_PRODUCT_MF628 0x0015 | 251 | #define ZTE_PRODUCT_MF628 0x0015 |
251 | #define ZTE_PRODUCT_MF626 0x0031 | 252 | #define ZTE_PRODUCT_MF626 0x0031 |
252 | #define ZTE_PRODUCT_CDMA_TECH 0xfffe | ||
253 | #define ZTE_PRODUCT_AC8710 0xfff1 | ||
254 | #define ZTE_PRODUCT_AC2726 0xfff5 | ||
255 | #define ZTE_PRODUCT_AC8710T 0xffff | ||
256 | #define ZTE_PRODUCT_MC2718 0xffe8 | 253 | #define ZTE_PRODUCT_MC2718 0xffe8 |
257 | #define ZTE_PRODUCT_AD3812 0xffeb | ||
258 | #define ZTE_PRODUCT_MC2716 0xffed | ||
259 | 254 | ||
260 | #define BENQ_VENDOR_ID 0x04a5 | 255 | #define BENQ_VENDOR_ID 0x04a5 |
261 | #define BENQ_PRODUCT_H10 0x4068 | 256 | #define BENQ_PRODUCT_H10 0x4068 |
@@ -341,8 +336,8 @@ static void option_instat_callback(struct urb *urb); | |||
341 | #define CINTERION_PRODUCT_EU3_E 0x0051 | 336 | #define CINTERION_PRODUCT_EU3_E 0x0051 |
342 | #define CINTERION_PRODUCT_EU3_P 0x0052 | 337 | #define CINTERION_PRODUCT_EU3_P 0x0052 |
343 | #define CINTERION_PRODUCT_PH8 0x0053 | 338 | #define CINTERION_PRODUCT_PH8 0x0053 |
344 | #define CINTERION_PRODUCT_AH6 0x0055 | 339 | #define CINTERION_PRODUCT_AHXX 0x0055 |
345 | #define CINTERION_PRODUCT_PLS8 0x0060 | 340 | #define CINTERION_PRODUCT_PLXX 0x0060 |
346 | 341 | ||
347 | /* Olivetti products */ | 342 | /* Olivetti products */ |
348 | #define OLIVETTI_VENDOR_ID 0x0b3c | 343 | #define OLIVETTI_VENDOR_ID 0x0b3c |
@@ -494,18 +489,10 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = { | |||
494 | .reserved = BIT(4), | 489 | .reserved = BIT(4), |
495 | }; | 490 | }; |
496 | 491 | ||
497 | static const struct option_blacklist_info zte_ad3812_z_blacklist = { | ||
498 | .sendsetup = BIT(0) | BIT(1) | BIT(2), | ||
499 | }; | ||
500 | |||
501 | static const struct option_blacklist_info zte_mc2718_z_blacklist = { | 492 | static const struct option_blacklist_info zte_mc2718_z_blacklist = { |
502 | .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4), | 493 | .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4), |
503 | }; | 494 | }; |
504 | 495 | ||
505 | static const struct option_blacklist_info zte_mc2716_z_blacklist = { | ||
506 | .sendsetup = BIT(1) | BIT(2) | BIT(3), | ||
507 | }; | ||
508 | |||
509 | static const struct option_blacklist_info huawei_cdc12_blacklist = { | 496 | static const struct option_blacklist_info huawei_cdc12_blacklist = { |
510 | .reserved = BIT(1) | BIT(2), | 497 | .reserved = BIT(1) | BIT(2), |
511 | }; | 498 | }; |
@@ -592,6 +579,8 @@ static const struct usb_device_id option_ids[] = { | |||
592 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, | 579 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, |
593 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), | 580 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), |
594 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, | 581 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, |
582 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x14ac, 0xff, 0xff, 0xff), /* Huawei E1820 */ | ||
583 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, | ||
595 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), | 584 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), |
596 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, | 585 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, |
597 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) }, | 586 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) }, |
@@ -771,6 +760,7 @@ static const struct usb_device_id option_ids[] = { | |||
771 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */ | 760 | { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */ |
772 | { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) }, | 761 | { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) }, |
773 | { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) }, | 762 | { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) }, |
763 | { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5804_MINICARD_ATT, 0xff, 0xff, 0xff) }, | ||
774 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ | 764 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ |
775 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, | 765 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, |
776 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, | 766 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, |
@@ -795,7 +785,6 @@ static const struct usb_device_id option_ids[] = { | |||
795 | { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) }, | 785 | { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) }, |
796 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, | 786 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, |
797 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, | 787 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, |
798 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ | ||
799 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ | 788 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
800 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ | 789 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ |
801 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ | 790 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ |
@@ -966,6 +955,8 @@ static const struct usb_device_id option_ids[] = { | |||
966 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | 955 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
967 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) }, | 956 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) }, |
968 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) }, | 957 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) }, |
958 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0412, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G */ | ||
959 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
969 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) }, | 960 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) }, |
970 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) }, | 961 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) }, |
971 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff), | 962 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff), |
@@ -1195,16 +1186,9 @@ static const struct usb_device_id option_ids[] = { | |||
1195 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff), | 1186 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff), |
1196 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, | 1187 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, |
1197 | 1188 | ||
1198 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, | 1189 | /* NOTE: most ZTE CDMA devices should be driven by zte_ev, not option */ |
1199 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, | ||
1200 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, | ||
1201 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, | ||
1202 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), | 1190 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), |
1203 | .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist }, | 1191 | .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist }, |
1204 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff), | ||
1205 | .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, | ||
1206 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), | ||
1207 | .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, | ||
1208 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, | 1192 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, |
1209 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, | 1193 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, |
1210 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, | 1194 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, |
@@ -1264,8 +1248,9 @@ static const struct usb_device_id option_ids[] = { | |||
1264 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, | 1248 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, |
1265 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, | 1249 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, |
1266 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, | 1250 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, |
1267 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AH6) }, | 1251 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) }, |
1268 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLS8) }, | 1252 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX), |
1253 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
1269 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, | 1254 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, |
1270 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | 1255 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
1271 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, | 1256 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 7151659367a0..048cd44d51b1 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -284,7 +284,7 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
284 | serial settings even to the same values as before. Thus | 284 | serial settings even to the same values as before. Thus |
285 | we actually need to filter in this specific case */ | 285 | we actually need to filter in this specific case */ |
286 | 286 | ||
287 | if (!tty_termios_hw_change(&tty->termios, old_termios)) | 287 | if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios)) |
288 | return; | 288 | return; |
289 | 289 | ||
290 | cflag = tty->termios.c_cflag; | 290 | cflag = tty->termios.c_cflag; |
@@ -293,7 +293,8 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
293 | if (!buf) { | 293 | if (!buf) { |
294 | dev_err(&port->dev, "%s - out of memory.\n", __func__); | 294 | dev_err(&port->dev, "%s - out of memory.\n", __func__); |
295 | /* Report back no change occurred */ | 295 | /* Report back no change occurred */ |
296 | tty->termios = *old_termios; | 296 | if (old_termios) |
297 | tty->termios = *old_termios; | ||
297 | return; | 298 | return; |
298 | } | 299 | } |
299 | 300 | ||
@@ -433,7 +434,7 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
433 | control = priv->line_control; | 434 | control = priv->line_control; |
434 | if ((cflag & CBAUD) == B0) | 435 | if ((cflag & CBAUD) == B0) |
435 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); | 436 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); |
436 | else if ((old_termios->c_cflag & CBAUD) == B0) | 437 | else if (old_termios && (old_termios->c_cflag & CBAUD) == B0) |
437 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); | 438 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); |
438 | if (control != priv->line_control) { | 439 | if (control != priv->line_control) { |
439 | control = priv->line_control; | 440 | control = priv->line_control; |
@@ -492,7 +493,6 @@ static void pl2303_close(struct usb_serial_port *port) | |||
492 | 493 | ||
493 | static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) | 494 | static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) |
494 | { | 495 | { |
495 | struct ktermios tmp_termios; | ||
496 | struct usb_serial *serial = port->serial; | 496 | struct usb_serial *serial = port->serial; |
497 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); | 497 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); |
498 | int result; | 498 | int result; |
@@ -508,7 +508,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
508 | 508 | ||
509 | /* Setup termios */ | 509 | /* Setup termios */ |
510 | if (tty) | 510 | if (tty) |
511 | pl2303_set_termios(tty, port, &tmp_termios); | 511 | pl2303_set_termios(tty, port, NULL); |
512 | 512 | ||
513 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 513 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
514 | if (result) { | 514 | if (result) { |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 59b32b782126..bd794b43898c 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -118,6 +118,7 @@ static const struct usb_device_id id_table[] = { | |||
118 | {USB_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ | 118 | {USB_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ |
119 | {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */ | 119 | {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */ |
120 | {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */ | 120 | {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */ |
121 | {USB_DEVICE(0x0AF0, 0x8120)}, /* Option GTM681W */ | ||
121 | 122 | ||
122 | /* non Gobi Qualcomm serial devices */ | 123 | /* non Gobi Qualcomm serial devices */ |
123 | {USB_DEVICE_INTERFACE_NUMBER(0x0f3d, 0x68a2, 0)}, /* Sierra Wireless MC7700 Device Management */ | 124 | {USB_DEVICE_INTERFACE_NUMBER(0x0f3d, 0x68a2, 0)}, /* Sierra Wireless MC7700 Device Management */ |
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index cf3df793c2b7..ddf6c47137dc 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -291,7 +291,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty, | |||
291 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); | 291 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); |
292 | unsigned long flags; | 292 | unsigned long flags; |
293 | unsigned int cflag = tty->termios.c_cflag; | 293 | unsigned int cflag = tty->termios.c_cflag; |
294 | unsigned int old_cflag = old_termios->c_cflag; | ||
295 | unsigned short uartdata; | 294 | unsigned short uartdata; |
296 | unsigned char buf[2] = {0, 0}; | 295 | unsigned char buf[2] = {0, 0}; |
297 | int baud; | 296 | int baud; |
@@ -299,15 +298,15 @@ static void spcp8x5_set_termios(struct tty_struct *tty, | |||
299 | u8 control; | 298 | u8 control; |
300 | 299 | ||
301 | /* check that they really want us to change something */ | 300 | /* check that they really want us to change something */ |
302 | if (!tty_termios_hw_change(&tty->termios, old_termios)) | 301 | if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios)) |
303 | return; | 302 | return; |
304 | 303 | ||
305 | /* set DTR/RTS active */ | 304 | /* set DTR/RTS active */ |
306 | spin_lock_irqsave(&priv->lock, flags); | 305 | spin_lock_irqsave(&priv->lock, flags); |
307 | control = priv->line_control; | 306 | control = priv->line_control; |
308 | if ((old_cflag & CBAUD) == B0) { | 307 | if (old_termios && (old_termios->c_cflag & CBAUD) == B0) { |
309 | priv->line_control |= MCR_DTR; | 308 | priv->line_control |= MCR_DTR; |
310 | if (!(old_cflag & CRTSCTS)) | 309 | if (!(old_termios->c_cflag & CRTSCTS)) |
311 | priv->line_control |= MCR_RTS; | 310 | priv->line_control |= MCR_RTS; |
312 | } | 311 | } |
313 | if (control != priv->line_control) { | 312 | if (control != priv->line_control) { |
@@ -394,7 +393,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty, | |||
394 | 393 | ||
395 | static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port) | 394 | static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port) |
396 | { | 395 | { |
397 | struct ktermios tmp_termios; | ||
398 | struct usb_serial *serial = port->serial; | 396 | struct usb_serial *serial = port->serial; |
399 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); | 397 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); |
400 | int ret; | 398 | int ret; |
@@ -411,7 +409,7 @@ static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
411 | spcp8x5_set_ctrl_line(port, priv->line_control); | 409 | spcp8x5_set_ctrl_line(port, priv->line_control); |
412 | 410 | ||
413 | if (tty) | 411 | if (tty) |
414 | spcp8x5_set_termios(tty, port, &tmp_termios); | 412 | spcp8x5_set_termios(tty, port, NULL); |
415 | 413 | ||
416 | port->port.drain_delay = 256; | 414 | port->port.drain_delay = 256; |
417 | 415 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index cac47aef2918..e581c2549a57 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -101,6 +101,7 @@ static int ti_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
101 | const unsigned char *data, int count); | 101 | const unsigned char *data, int count); |
102 | static int ti_write_room(struct tty_struct *tty); | 102 | static int ti_write_room(struct tty_struct *tty); |
103 | static int ti_chars_in_buffer(struct tty_struct *tty); | 103 | static int ti_chars_in_buffer(struct tty_struct *tty); |
104 | static bool ti_tx_empty(struct usb_serial_port *port); | ||
104 | static void ti_throttle(struct tty_struct *tty); | 105 | static void ti_throttle(struct tty_struct *tty); |
105 | static void ti_unthrottle(struct tty_struct *tty); | 106 | static void ti_unthrottle(struct tty_struct *tty); |
106 | static int ti_ioctl(struct tty_struct *tty, | 107 | static int ti_ioctl(struct tty_struct *tty, |
@@ -171,7 +172,8 @@ static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = { | |||
171 | { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, | 172 | { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, |
172 | { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, | 173 | { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, |
173 | { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, | 174 | { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, |
174 | { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) }, | 175 | { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) }, |
176 | { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) }, | ||
175 | { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, | 177 | { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, |
176 | }; | 178 | }; |
177 | 179 | ||
@@ -222,6 +224,7 @@ static struct usb_serial_driver ti_1port_device = { | |||
222 | .write = ti_write, | 224 | .write = ti_write, |
223 | .write_room = ti_write_room, | 225 | .write_room = ti_write_room, |
224 | .chars_in_buffer = ti_chars_in_buffer, | 226 | .chars_in_buffer = ti_chars_in_buffer, |
227 | .tx_empty = ti_tx_empty, | ||
225 | .throttle = ti_throttle, | 228 | .throttle = ti_throttle, |
226 | .unthrottle = ti_unthrottle, | 229 | .unthrottle = ti_unthrottle, |
227 | .ioctl = ti_ioctl, | 230 | .ioctl = ti_ioctl, |
@@ -253,6 +256,7 @@ static struct usb_serial_driver ti_2port_device = { | |||
253 | .write = ti_write, | 256 | .write = ti_write, |
254 | .write_room = ti_write_room, | 257 | .write_room = ti_write_room, |
255 | .chars_in_buffer = ti_chars_in_buffer, | 258 | .chars_in_buffer = ti_chars_in_buffer, |
259 | .tx_empty = ti_tx_empty, | ||
256 | .throttle = ti_throttle, | 260 | .throttle = ti_throttle, |
257 | .unthrottle = ti_unthrottle, | 261 | .unthrottle = ti_unthrottle, |
258 | .ioctl = ti_ioctl, | 262 | .ioctl = ti_ioctl, |
@@ -684,8 +688,6 @@ static int ti_chars_in_buffer(struct tty_struct *tty) | |||
684 | struct ti_port *tport = usb_get_serial_port_data(port); | 688 | struct ti_port *tport = usb_get_serial_port_data(port); |
685 | int chars = 0; | 689 | int chars = 0; |
686 | unsigned long flags; | 690 | unsigned long flags; |
687 | int ret; | ||
688 | u8 lsr; | ||
689 | 691 | ||
690 | if (tport == NULL) | 692 | if (tport == NULL) |
691 | return 0; | 693 | return 0; |
@@ -694,16 +696,22 @@ static int ti_chars_in_buffer(struct tty_struct *tty) | |||
694 | chars = kfifo_len(&tport->write_fifo); | 696 | chars = kfifo_len(&tport->write_fifo); |
695 | spin_unlock_irqrestore(&tport->tp_lock, flags); | 697 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
696 | 698 | ||
697 | if (!chars) { | ||
698 | ret = ti_get_lsr(tport, &lsr); | ||
699 | if (!ret && !(lsr & TI_LSR_TX_EMPTY)) | ||
700 | chars = 1; | ||
701 | } | ||
702 | |||
703 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); | 699 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); |
704 | return chars; | 700 | return chars; |
705 | } | 701 | } |
706 | 702 | ||
703 | static bool ti_tx_empty(struct usb_serial_port *port) | ||
704 | { | ||
705 | struct ti_port *tport = usb_get_serial_port_data(port); | ||
706 | int ret; | ||
707 | u8 lsr; | ||
708 | |||
709 | ret = ti_get_lsr(tport, &lsr); | ||
710 | if (!ret && !(lsr & TI_LSR_TX_EMPTY)) | ||
711 | return false; | ||
712 | |||
713 | return true; | ||
714 | } | ||
707 | 715 | ||
708 | static void ti_throttle(struct tty_struct *tty) | 716 | static void ti_throttle(struct tty_struct *tty) |
709 | { | 717 | { |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h index b353e7e3d480..4a2423e84d55 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.h +++ b/drivers/usb/serial/ti_usb_3410_5052.h | |||
@@ -52,7 +52,9 @@ | |||
52 | 52 | ||
53 | /* Abbott Diabetics vendor and product ids */ | 53 | /* Abbott Diabetics vendor and product ids */ |
54 | #define ABBOTT_VENDOR_ID 0x1a61 | 54 | #define ABBOTT_VENDOR_ID 0x1a61 |
55 | #define ABBOTT_PRODUCT_ID 0x3410 | 55 | #define ABBOTT_STEREO_PLUG_ID 0x3410 |
56 | #define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID | ||
57 | #define ABBOTT_STRIP_PORT_ID 0x3420 | ||
56 | 58 | ||
57 | /* Commands */ | 59 | /* Commands */ |
58 | #define TI_GET_VERSION 0x01 | 60 | #define TI_GET_VERSION 0x01 |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index cf75beb1251b..5f6b1ff9d29e 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -359,20 +359,29 @@ static int serial_chars_in_buffer(struct tty_struct *tty) | |||
359 | { | 359 | { |
360 | struct usb_serial_port *port = tty->driver_data; | 360 | struct usb_serial_port *port = tty->driver_data; |
361 | struct usb_serial *serial = port->serial; | 361 | struct usb_serial *serial = port->serial; |
362 | int count = 0; | ||
363 | 362 | ||
364 | dev_dbg(tty->dev, "%s\n", __func__); | 363 | dev_dbg(tty->dev, "%s\n", __func__); |
365 | 364 | ||
366 | mutex_lock(&serial->disc_mutex); | ||
367 | /* if the device was unplugged then any remaining characters | ||
368 | fell out of the connector ;) */ | ||
369 | if (serial->disconnected) | 365 | if (serial->disconnected) |
370 | count = 0; | 366 | return 0; |
371 | else | ||
372 | count = serial->type->chars_in_buffer(tty); | ||
373 | mutex_unlock(&serial->disc_mutex); | ||
374 | 367 | ||
375 | return count; | 368 | return serial->type->chars_in_buffer(tty); |
369 | } | ||
370 | |||
371 | static void serial_wait_until_sent(struct tty_struct *tty, int timeout) | ||
372 | { | ||
373 | struct usb_serial_port *port = tty->driver_data; | ||
374 | struct usb_serial *serial = port->serial; | ||
375 | |||
376 | dev_dbg(tty->dev, "%s\n", __func__); | ||
377 | |||
378 | if (!port->serial->type->wait_until_sent) | ||
379 | return; | ||
380 | |||
381 | mutex_lock(&serial->disc_mutex); | ||
382 | if (!serial->disconnected) | ||
383 | port->serial->type->wait_until_sent(tty, timeout); | ||
384 | mutex_unlock(&serial->disc_mutex); | ||
376 | } | 385 | } |
377 | 386 | ||
378 | static void serial_throttle(struct tty_struct *tty) | 387 | static void serial_throttle(struct tty_struct *tty) |
@@ -399,7 +408,7 @@ static int serial_ioctl(struct tty_struct *tty, | |||
399 | unsigned int cmd, unsigned long arg) | 408 | unsigned int cmd, unsigned long arg) |
400 | { | 409 | { |
401 | struct usb_serial_port *port = tty->driver_data; | 410 | struct usb_serial_port *port = tty->driver_data; |
402 | int retval = -ENODEV; | 411 | int retval = -ENOIOCTLCMD; |
403 | 412 | ||
404 | dev_dbg(tty->dev, "%s - cmd 0x%.4x\n", __func__, cmd); | 413 | dev_dbg(tty->dev, "%s - cmd 0x%.4x\n", __func__, cmd); |
405 | 414 | ||
@@ -411,8 +420,6 @@ static int serial_ioctl(struct tty_struct *tty, | |||
411 | default: | 420 | default: |
412 | if (port->serial->type->ioctl) | 421 | if (port->serial->type->ioctl) |
413 | retval = port->serial->type->ioctl(tty, cmd, arg); | 422 | retval = port->serial->type->ioctl(tty, cmd, arg); |
414 | else | ||
415 | retval = -ENOIOCTLCMD; | ||
416 | } | 423 | } |
417 | 424 | ||
418 | return retval; | 425 | return retval; |
@@ -1191,6 +1198,7 @@ static const struct tty_operations serial_ops = { | |||
1191 | .unthrottle = serial_unthrottle, | 1198 | .unthrottle = serial_unthrottle, |
1192 | .break_ctl = serial_break, | 1199 | .break_ctl = serial_break, |
1193 | .chars_in_buffer = serial_chars_in_buffer, | 1200 | .chars_in_buffer = serial_chars_in_buffer, |
1201 | .wait_until_sent = serial_wait_until_sent, | ||
1194 | .tiocmget = serial_tiocmget, | 1202 | .tiocmget = serial_tiocmget, |
1195 | .tiocmset = serial_tiocmset, | 1203 | .tiocmset = serial_tiocmset, |
1196 | .get_icount = serial_get_icount, | 1204 | .get_icount = serial_get_icount, |
@@ -1316,6 +1324,8 @@ static void usb_serial_operations_init(struct usb_serial_driver *device) | |||
1316 | set_to_generic_if_null(device, close); | 1324 | set_to_generic_if_null(device, close); |
1317 | set_to_generic_if_null(device, write_room); | 1325 | set_to_generic_if_null(device, write_room); |
1318 | set_to_generic_if_null(device, chars_in_buffer); | 1326 | set_to_generic_if_null(device, chars_in_buffer); |
1327 | if (device->tx_empty) | ||
1328 | set_to_generic_if_null(device, wait_until_sent); | ||
1319 | set_to_generic_if_null(device, read_bulk_callback); | 1329 | set_to_generic_if_null(device, read_bulk_callback); |
1320 | set_to_generic_if_null(device, write_bulk_callback); | 1330 | set_to_generic_if_null(device, write_bulk_callback); |
1321 | set_to_generic_if_null(device, process_read_urb); | 1331 | set_to_generic_if_null(device, process_read_urb); |
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 7573ec8a084f..9910aa2edf4b 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -560,10 +560,19 @@ static int treo_attach(struct usb_serial *serial) | |||
560 | */ | 560 | */ |
561 | #define COPY_PORT(dest, src) \ | 561 | #define COPY_PORT(dest, src) \ |
562 | do { \ | 562 | do { \ |
563 | int i; \ | ||
564 | \ | ||
565 | for (i = 0; i < ARRAY_SIZE(src->read_urbs); ++i) { \ | ||
566 | dest->read_urbs[i] = src->read_urbs[i]; \ | ||
567 | dest->read_urbs[i]->context = dest; \ | ||
568 | dest->bulk_in_buffers[i] = src->bulk_in_buffers[i]; \ | ||
569 | } \ | ||
563 | dest->read_urb = src->read_urb; \ | 570 | dest->read_urb = src->read_urb; \ |
564 | dest->bulk_in_endpointAddress = src->bulk_in_endpointAddress;\ | 571 | dest->bulk_in_endpointAddress = src->bulk_in_endpointAddress;\ |
565 | dest->bulk_in_buffer = src->bulk_in_buffer; \ | 572 | dest->bulk_in_buffer = src->bulk_in_buffer; \ |
573 | dest->bulk_in_size = src->bulk_in_size; \ | ||
566 | dest->interrupt_in_urb = src->interrupt_in_urb; \ | 574 | dest->interrupt_in_urb = src->interrupt_in_urb; \ |
575 | dest->interrupt_in_urb->context = dest; \ | ||
567 | dest->interrupt_in_endpointAddress = \ | 576 | dest->interrupt_in_endpointAddress = \ |
568 | src->interrupt_in_endpointAddress;\ | 577 | src->interrupt_in_endpointAddress;\ |
569 | dest->interrupt_in_buffer = src->interrupt_in_buffer; \ | 578 | dest->interrupt_in_buffer = src->interrupt_in_buffer; \ |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index b9fca3586d74..347caad47a12 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -649,7 +649,7 @@ static void firm_setup_port(struct tty_struct *tty) | |||
649 | struct whiteheat_port_settings port_settings; | 649 | struct whiteheat_port_settings port_settings; |
650 | unsigned int cflag = tty->termios.c_cflag; | 650 | unsigned int cflag = tty->termios.c_cflag; |
651 | 651 | ||
652 | port_settings.port = port->number + 1; | 652 | port_settings.port = port->number - port->serial->minor + 1; |
653 | 653 | ||
654 | /* get the byte size */ | 654 | /* get the byte size */ |
655 | switch (cflag & CSIZE) { | 655 | switch (cflag & CSIZE) { |
diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c index 39ee7373b4ee..fca4c752a4ed 100644 --- a/drivers/usb/serial/zte_ev.c +++ b/drivers/usb/serial/zte_ev.c | |||
@@ -41,9 +41,6 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, | |||
41 | int len; | 41 | int len; |
42 | unsigned char *buf; | 42 | unsigned char *buf; |
43 | 43 | ||
44 | if (port->number != 0) | ||
45 | return -ENODEV; | ||
46 | |||
47 | buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); | 44 | buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); |
48 | if (!buf) | 45 | if (!buf) |
49 | return -ENOMEM; | 46 | return -ENOMEM; |
@@ -53,7 +50,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, | |||
53 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 50 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
54 | 0x22, 0x21, | 51 | 0x22, 0x21, |
55 | 0x0001, 0x0000, NULL, len, | 52 | 0x0001, 0x0000, NULL, len, |
56 | HZ * USB_CTRL_GET_TIMEOUT); | 53 | USB_CTRL_GET_TIMEOUT); |
57 | dev_dbg(dev, "result = %d\n", result); | 54 | dev_dbg(dev, "result = %d\n", result); |
58 | 55 | ||
59 | /* send 2st cmd and recieve data */ | 56 | /* send 2st cmd and recieve data */ |
@@ -65,7 +62,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, | |||
65 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 62 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
66 | 0x21, 0xa1, | 63 | 0x21, 0xa1, |
67 | 0x0000, 0x0000, buf, len, | 64 | 0x0000, 0x0000, buf, len, |
68 | HZ * USB_CTRL_GET_TIMEOUT); | 65 | USB_CTRL_GET_TIMEOUT); |
69 | debug_data(dev, __func__, len, buf, result); | 66 | debug_data(dev, __func__, len, buf, result); |
70 | 67 | ||
71 | /* send 3 cmd */ | 68 | /* send 3 cmd */ |
@@ -84,7 +81,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, | |||
84 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 81 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
85 | 0x20, 0x21, | 82 | 0x20, 0x21, |
86 | 0x0000, 0x0000, buf, len, | 83 | 0x0000, 0x0000, buf, len, |
87 | HZ * USB_CTRL_GET_TIMEOUT); | 84 | USB_CTRL_GET_TIMEOUT); |
88 | debug_data(dev, __func__, len, buf, result); | 85 | debug_data(dev, __func__, len, buf, result); |
89 | 86 | ||
90 | /* send 4 cmd */ | 87 | /* send 4 cmd */ |
@@ -95,7 +92,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, | |||
95 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 92 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
96 | 0x22, 0x21, | 93 | 0x22, 0x21, |
97 | 0x0003, 0x0000, NULL, len, | 94 | 0x0003, 0x0000, NULL, len, |
98 | HZ * USB_CTRL_GET_TIMEOUT); | 95 | USB_CTRL_GET_TIMEOUT); |
99 | dev_dbg(dev, "result = %d\n", result); | 96 | dev_dbg(dev, "result = %d\n", result); |
100 | 97 | ||
101 | /* send 5 cmd */ | 98 | /* send 5 cmd */ |
@@ -107,7 +104,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, | |||
107 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 104 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
108 | 0x21, 0xa1, | 105 | 0x21, 0xa1, |
109 | 0x0000, 0x0000, buf, len, | 106 | 0x0000, 0x0000, buf, len, |
110 | HZ * USB_CTRL_GET_TIMEOUT); | 107 | USB_CTRL_GET_TIMEOUT); |
111 | debug_data(dev, __func__, len, buf, result); | 108 | debug_data(dev, __func__, len, buf, result); |
112 | 109 | ||
113 | /* send 6 cmd */ | 110 | /* send 6 cmd */ |
@@ -126,7 +123,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, | |||
126 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 123 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
127 | 0x20, 0x21, | 124 | 0x20, 0x21, |
128 | 0x0000, 0x0000, buf, len, | 125 | 0x0000, 0x0000, buf, len, |
129 | HZ * USB_CTRL_GET_TIMEOUT); | 126 | USB_CTRL_GET_TIMEOUT); |
130 | debug_data(dev, __func__, len, buf, result); | 127 | debug_data(dev, __func__, len, buf, result); |
131 | kfree(buf); | 128 | kfree(buf); |
132 | 129 | ||
@@ -166,9 +163,6 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
166 | int len; | 163 | int len; |
167 | unsigned char *buf; | 164 | unsigned char *buf; |
168 | 165 | ||
169 | if (port->number != 0) | ||
170 | return; | ||
171 | |||
172 | buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); | 166 | buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); |
173 | if (!buf) | 167 | if (!buf) |
174 | return; | 168 | return; |
@@ -178,7 +172,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
178 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 172 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
179 | 0x22, 0x21, | 173 | 0x22, 0x21, |
180 | 0x0002, 0x0000, NULL, len, | 174 | 0x0002, 0x0000, NULL, len, |
181 | HZ * USB_CTRL_GET_TIMEOUT); | 175 | USB_CTRL_GET_TIMEOUT); |
182 | dev_dbg(dev, "result = %d\n", result); | 176 | dev_dbg(dev, "result = %d\n", result); |
183 | 177 | ||
184 | /* send 2st ctl cmd(CTL 21 22 03 00 00 00 00 00 ) */ | 178 | /* send 2st ctl cmd(CTL 21 22 03 00 00 00 00 00 ) */ |
@@ -186,7 +180,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
186 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 180 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
187 | 0x22, 0x21, | 181 | 0x22, 0x21, |
188 | 0x0003, 0x0000, NULL, len, | 182 | 0x0003, 0x0000, NULL, len, |
189 | HZ * USB_CTRL_GET_TIMEOUT); | 183 | USB_CTRL_GET_TIMEOUT); |
190 | dev_dbg(dev, "result = %d\n", result); | 184 | dev_dbg(dev, "result = %d\n", result); |
191 | 185 | ||
192 | /* send 3st cmd and recieve data */ | 186 | /* send 3st cmd and recieve data */ |
@@ -198,7 +192,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
198 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 192 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
199 | 0x21, 0xa1, | 193 | 0x21, 0xa1, |
200 | 0x0000, 0x0000, buf, len, | 194 | 0x0000, 0x0000, buf, len, |
201 | HZ * USB_CTRL_GET_TIMEOUT); | 195 | USB_CTRL_GET_TIMEOUT); |
202 | debug_data(dev, __func__, len, buf, result); | 196 | debug_data(dev, __func__, len, buf, result); |
203 | 197 | ||
204 | /* send 4 cmd */ | 198 | /* send 4 cmd */ |
@@ -217,7 +211,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
217 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 211 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
218 | 0x20, 0x21, | 212 | 0x20, 0x21, |
219 | 0x0000, 0x0000, buf, len, | 213 | 0x0000, 0x0000, buf, len, |
220 | HZ * USB_CTRL_GET_TIMEOUT); | 214 | USB_CTRL_GET_TIMEOUT); |
221 | debug_data(dev, __func__, len, buf, result); | 215 | debug_data(dev, __func__, len, buf, result); |
222 | 216 | ||
223 | /* send 5 cmd */ | 217 | /* send 5 cmd */ |
@@ -228,7 +222,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
228 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 222 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
229 | 0x22, 0x21, | 223 | 0x22, 0x21, |
230 | 0x0003, 0x0000, NULL, len, | 224 | 0x0003, 0x0000, NULL, len, |
231 | HZ * USB_CTRL_GET_TIMEOUT); | 225 | USB_CTRL_GET_TIMEOUT); |
232 | dev_dbg(dev, "result = %d\n", result); | 226 | dev_dbg(dev, "result = %d\n", result); |
233 | 227 | ||
234 | /* send 6 cmd */ | 228 | /* send 6 cmd */ |
@@ -240,7 +234,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
240 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 234 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
241 | 0x21, 0xa1, | 235 | 0x21, 0xa1, |
242 | 0x0000, 0x0000, buf, len, | 236 | 0x0000, 0x0000, buf, len, |
243 | HZ * USB_CTRL_GET_TIMEOUT); | 237 | USB_CTRL_GET_TIMEOUT); |
244 | debug_data(dev, __func__, len, buf, result); | 238 | debug_data(dev, __func__, len, buf, result); |
245 | 239 | ||
246 | /* send 7 cmd */ | 240 | /* send 7 cmd */ |
@@ -259,7 +253,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
259 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 253 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
260 | 0x20, 0x21, | 254 | 0x20, 0x21, |
261 | 0x0000, 0x0000, buf, len, | 255 | 0x0000, 0x0000, buf, len, |
262 | HZ * USB_CTRL_GET_TIMEOUT); | 256 | USB_CTRL_GET_TIMEOUT); |
263 | debug_data(dev, __func__, len, buf, result); | 257 | debug_data(dev, __func__, len, buf, result); |
264 | 258 | ||
265 | /* send 8 cmd */ | 259 | /* send 8 cmd */ |
@@ -270,7 +264,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
270 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 264 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
271 | 0x22, 0x21, | 265 | 0x22, 0x21, |
272 | 0x0003, 0x0000, NULL, len, | 266 | 0x0003, 0x0000, NULL, len, |
273 | HZ * USB_CTRL_GET_TIMEOUT); | 267 | USB_CTRL_GET_TIMEOUT); |
274 | dev_dbg(dev, "result = %d\n", result); | 268 | dev_dbg(dev, "result = %d\n", result); |
275 | 269 | ||
276 | kfree(buf); | 270 | kfree(buf); |
@@ -279,11 +273,29 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
279 | } | 273 | } |
280 | 274 | ||
281 | static const struct usb_device_id id_table[] = { | 275 | static const struct usb_device_id id_table[] = { |
282 | { USB_DEVICE(0x19d2, 0xffff) }, /* AC8700 */ | 276 | /* AC8710, AC8710T */ |
283 | { USB_DEVICE(0x19d2, 0xfffe) }, | 277 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffff, 0xff, 0xff, 0xff) }, |
284 | { USB_DEVICE(0x19d2, 0xfffd) }, /* MG880 */ | 278 | /* AC8700 */ |
279 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfffe, 0xff, 0xff, 0xff) }, | ||
280 | /* MG880 */ | ||
281 | { USB_DEVICE(0x19d2, 0xfffd) }, | ||
282 | { USB_DEVICE(0x19d2, 0xfffc) }, | ||
283 | { USB_DEVICE(0x19d2, 0xfffb) }, | ||
284 | /* AC2726, AC8710_V3 */ | ||
285 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfff1, 0xff, 0xff, 0xff) }, | ||
286 | { USB_DEVICE(0x19d2, 0xfff6) }, | ||
287 | { USB_DEVICE(0x19d2, 0xfff7) }, | ||
288 | { USB_DEVICE(0x19d2, 0xfff8) }, | ||
289 | { USB_DEVICE(0x19d2, 0xfff9) }, | ||
290 | { USB_DEVICE(0x19d2, 0xffee) }, | ||
291 | /* AC2716, MC2716 */ | ||
292 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffed, 0xff, 0xff, 0xff) }, | ||
293 | /* AD3812 */ | ||
294 | { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffeb, 0xff, 0xff, 0xff) }, | ||
295 | { USB_DEVICE(0x19d2, 0xffec) }, | ||
285 | { USB_DEVICE(0x05C6, 0x3197) }, | 296 | { USB_DEVICE(0x05C6, 0x3197) }, |
286 | { USB_DEVICE(0x05C6, 0x6000) }, | 297 | { USB_DEVICE(0x05C6, 0x6000) }, |
298 | { USB_DEVICE(0x05C6, 0x9008) }, | ||
287 | { }, | 299 | { }, |
288 | }; | 300 | }; |
289 | MODULE_DEVICE_TABLE(usb, id_table); | 301 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 8623577bbbe7..281be56d5648 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c | |||
@@ -105,8 +105,9 @@ struct rts51x_chip { | |||
105 | int status_len; | 105 | int status_len; |
106 | 106 | ||
107 | u32 flag; | 107 | u32 flag; |
108 | #ifdef CONFIG_REALTEK_AUTOPM | ||
109 | struct us_data *us; | 108 | struct us_data *us; |
109 | |||
110 | #ifdef CONFIG_REALTEK_AUTOPM | ||
110 | struct timer_list rts51x_suspend_timer; | 111 | struct timer_list rts51x_suspend_timer; |
111 | unsigned long timer_expires; | 112 | unsigned long timer_expires; |
112 | int pwr_state; | 113 | int pwr_state; |
@@ -988,6 +989,7 @@ static int init_realtek_cr(struct us_data *us) | |||
988 | us->extra = chip; | 989 | us->extra = chip; |
989 | us->extra_destructor = realtek_cr_destructor; | 990 | us->extra_destructor = realtek_cr_destructor; |
990 | us->max_lun = chip->max_lun = rts51x_get_max_lun(us); | 991 | us->max_lun = chip->max_lun = rts51x_get_max_lun(us); |
992 | chip->us = us; | ||
991 | 993 | ||
992 | usb_stor_dbg(us, "chip->max_lun = %d\n", chip->max_lun); | 994 | usb_stor_dbg(us, "chip->max_lun = %d\n", chip->max_lun); |
993 | 995 | ||
@@ -1010,10 +1012,8 @@ static int init_realtek_cr(struct us_data *us) | |||
1010 | SET_AUTO_DELINK(chip); | 1012 | SET_AUTO_DELINK(chip); |
1011 | } | 1013 | } |
1012 | #ifdef CONFIG_REALTEK_AUTOPM | 1014 | #ifdef CONFIG_REALTEK_AUTOPM |
1013 | if (ss_en) { | 1015 | if (ss_en) |
1014 | chip->us = us; | ||
1015 | realtek_cr_autosuspend_setup(us); | 1016 | realtek_cr_autosuspend_setup(us); |
1016 | } | ||
1017 | #endif | 1017 | #endif |
1018 | 1018 | ||
1019 | usb_stor_dbg(us, "chip->flag = 0x%x\n", chip->flag); | 1019 | usb_stor_dbg(us, "chip->flag = 0x%x\n", chip->flag); |
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index acb7121a9316..6d78736563de 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c | |||
@@ -1360,7 +1360,7 @@ static const struct file_operations vfio_device_fops = { | |||
1360 | */ | 1360 | */ |
1361 | static char *vfio_devnode(struct device *dev, umode_t *mode) | 1361 | static char *vfio_devnode(struct device *dev, umode_t *mode) |
1362 | { | 1362 | { |
1363 | if (MINOR(dev->devt) == 0) | 1363 | if (mode && (MINOR(dev->devt) == 0)) |
1364 | *mode = S_IRUGO | S_IWUGO; | 1364 | *mode = S_IRUGO | S_IWUGO; |
1365 | 1365 | ||
1366 | return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev)); | 1366 | return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev)); |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 2b51e2336aa2..f80d3dd41d8c 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -155,14 +155,11 @@ static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs) | |||
155 | 155 | ||
156 | static void vhost_net_clear_ubuf_info(struct vhost_net *n) | 156 | static void vhost_net_clear_ubuf_info(struct vhost_net *n) |
157 | { | 157 | { |
158 | |||
159 | bool zcopy; | ||
160 | int i; | 158 | int i; |
161 | 159 | ||
162 | for (i = 0; i < n->dev.nvqs; ++i) { | 160 | for (i = 0; i < VHOST_NET_VQ_MAX; ++i) { |
163 | zcopy = vhost_net_zcopy_mask & (0x1 << i); | 161 | kfree(n->vqs[i].ubuf_info); |
164 | if (zcopy) | 162 | n->vqs[i].ubuf_info = NULL; |
165 | kfree(n->vqs[i].ubuf_info); | ||
166 | } | 163 | } |
167 | } | 164 | } |
168 | 165 | ||
@@ -171,7 +168,7 @@ int vhost_net_set_ubuf_info(struct vhost_net *n) | |||
171 | bool zcopy; | 168 | bool zcopy; |
172 | int i; | 169 | int i; |
173 | 170 | ||
174 | for (i = 0; i < n->dev.nvqs; ++i) { | 171 | for (i = 0; i < VHOST_NET_VQ_MAX; ++i) { |
175 | zcopy = vhost_net_zcopy_mask & (0x1 << i); | 172 | zcopy = vhost_net_zcopy_mask & (0x1 << i); |
176 | if (!zcopy) | 173 | if (!zcopy) |
177 | continue; | 174 | continue; |
@@ -183,12 +180,7 @@ int vhost_net_set_ubuf_info(struct vhost_net *n) | |||
183 | return 0; | 180 | return 0; |
184 | 181 | ||
185 | err: | 182 | err: |
186 | while (i--) { | 183 | vhost_net_clear_ubuf_info(n); |
187 | zcopy = vhost_net_zcopy_mask & (0x1 << i); | ||
188 | if (!zcopy) | ||
189 | continue; | ||
190 | kfree(n->vqs[i].ubuf_info); | ||
191 | } | ||
192 | return -ENOMEM; | 184 | return -ENOMEM; |
193 | } | 185 | } |
194 | 186 | ||
@@ -196,12 +188,12 @@ void vhost_net_vq_reset(struct vhost_net *n) | |||
196 | { | 188 | { |
197 | int i; | 189 | int i; |
198 | 190 | ||
191 | vhost_net_clear_ubuf_info(n); | ||
192 | |||
199 | for (i = 0; i < VHOST_NET_VQ_MAX; i++) { | 193 | for (i = 0; i < VHOST_NET_VQ_MAX; i++) { |
200 | n->vqs[i].done_idx = 0; | 194 | n->vqs[i].done_idx = 0; |
201 | n->vqs[i].upend_idx = 0; | 195 | n->vqs[i].upend_idx = 0; |
202 | n->vqs[i].ubufs = NULL; | 196 | n->vqs[i].ubufs = NULL; |
203 | kfree(n->vqs[i].ubuf_info); | ||
204 | n->vqs[i].ubuf_info = NULL; | ||
205 | n->vqs[i].vhost_hlen = 0; | 197 | n->vqs[i].vhost_hlen = 0; |
206 | n->vqs[i].sock_hlen = 0; | 198 | n->vqs[i].sock_hlen = 0; |
207 | } | 199 | } |
@@ -436,7 +428,8 @@ static void handle_tx(struct vhost_net *net) | |||
436 | kref_get(&ubufs->kref); | 428 | kref_get(&ubufs->kref); |
437 | } | 429 | } |
438 | nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV; | 430 | nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV; |
439 | } | 431 | } else |
432 | msg.msg_control = NULL; | ||
440 | /* TODO: Check specific error and bomb out unless ENOBUFS? */ | 433 | /* TODO: Check specific error and bomb out unless ENOBUFS? */ |
441 | err = sock->ops->sendmsg(NULL, sock, &msg, len); | 434 | err = sock->ops->sendmsg(NULL, sock, &msg, len); |
442 | if (unlikely(err < 0)) { | 435 | if (unlikely(err < 0)) { |
@@ -1053,6 +1046,10 @@ static long vhost_net_set_owner(struct vhost_net *n) | |||
1053 | int r; | 1046 | int r; |
1054 | 1047 | ||
1055 | mutex_lock(&n->dev.mutex); | 1048 | mutex_lock(&n->dev.mutex); |
1049 | if (vhost_dev_has_owner(&n->dev)) { | ||
1050 | r = -EBUSY; | ||
1051 | goto out; | ||
1052 | } | ||
1056 | r = vhost_net_set_ubuf_info(n); | 1053 | r = vhost_net_set_ubuf_info(n); |
1057 | if (r) | 1054 | if (r) |
1058 | goto out; | 1055 | goto out; |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index beee7f5787e6..60aa5ad09a2f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -344,13 +344,19 @@ static int vhost_attach_cgroups(struct vhost_dev *dev) | |||
344 | } | 344 | } |
345 | 345 | ||
346 | /* Caller should have device mutex */ | 346 | /* Caller should have device mutex */ |
347 | bool vhost_dev_has_owner(struct vhost_dev *dev) | ||
348 | { | ||
349 | return dev->mm; | ||
350 | } | ||
351 | |||
352 | /* Caller should have device mutex */ | ||
347 | long vhost_dev_set_owner(struct vhost_dev *dev) | 353 | long vhost_dev_set_owner(struct vhost_dev *dev) |
348 | { | 354 | { |
349 | struct task_struct *worker; | 355 | struct task_struct *worker; |
350 | int err; | 356 | int err; |
351 | 357 | ||
352 | /* Is there an owner already? */ | 358 | /* Is there an owner already? */ |
353 | if (dev->mm) { | 359 | if (vhost_dev_has_owner(dev)) { |
354 | err = -EBUSY; | 360 | err = -EBUSY; |
355 | goto err_mm; | 361 | goto err_mm; |
356 | } | 362 | } |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index a7ad63592987..64adcf99ff33 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -133,6 +133,7 @@ struct vhost_dev { | |||
133 | 133 | ||
134 | long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs); | 134 | long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs); |
135 | long vhost_dev_set_owner(struct vhost_dev *dev); | 135 | long vhost_dev_set_owner(struct vhost_dev *dev); |
136 | bool vhost_dev_has_owner(struct vhost_dev *dev); | ||
136 | long vhost_dev_check_owner(struct vhost_dev *); | 137 | long vhost_dev_check_owner(struct vhost_dev *); |
137 | struct vhost_memory *vhost_dev_reset_owner_prepare(void); | 138 | struct vhost_memory *vhost_dev_reset_owner_prepare(void); |
138 | void vhost_dev_reset_owner(struct vhost_dev *, struct vhost_memory *); | 139 | void vhost_dev_reset_owner(struct vhost_dev *, struct vhost_memory *); |
diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index bff0775e258c..5174ebac288d 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Since these may be in userspace, we use (inline) accessors. | 4 | * Since these may be in userspace, we use (inline) accessors. |
5 | */ | 5 | */ |
6 | #include <linux/module.h> | ||
6 | #include <linux/vringh.h> | 7 | #include <linux/vringh.h> |
7 | #include <linux/virtio_ring.h> | 8 | #include <linux/virtio_ring.h> |
8 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
@@ -1005,3 +1006,5 @@ int vringh_need_notify_kern(struct vringh *vrh) | |||
1005 | return __vringh_need_notify(vrh, getu16_kern); | 1006 | return __vringh_need_notify(vrh, getu16_kern); |
1006 | } | 1007 | } |
1007 | EXPORT_SYMBOL(vringh_need_notify_kern); | 1008 | EXPORT_SYMBOL(vringh_need_notify_kern); |
1009 | |||
1010 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index d71d60f94fc1..2e937bdace6f 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -2199,7 +2199,7 @@ config FB_XILINX | |||
2199 | 2199 | ||
2200 | config FB_GOLDFISH | 2200 | config FB_GOLDFISH |
2201 | tristate "Goldfish Framebuffer" | 2201 | tristate "Goldfish Framebuffer" |
2202 | depends on FB | 2202 | depends on FB && HAS_DMA |
2203 | select FB_CFB_FILLRECT | 2203 | select FB_CFB_FILLRECT |
2204 | select FB_CFB_COPYAREA | 2204 | select FB_CFB_COPYAREA |
2205 | select FB_CFB_IMAGEBLIT | 2205 | select FB_CFB_IMAGEBLIT |
@@ -2453,6 +2453,23 @@ config FB_HYPERV | |||
2453 | help | 2453 | help |
2454 | This framebuffer driver supports Microsoft Hyper-V Synthetic Video. | 2454 | This framebuffer driver supports Microsoft Hyper-V Synthetic Video. |
2455 | 2455 | ||
2456 | config FB_SIMPLE | ||
2457 | bool "Simple framebuffer support" | ||
2458 | depends on (FB = y) && OF | ||
2459 | select FB_CFB_FILLRECT | ||
2460 | select FB_CFB_COPYAREA | ||
2461 | select FB_CFB_IMAGEBLIT | ||
2462 | help | ||
2463 | Say Y if you want support for a simple frame-buffer. | ||
2464 | |||
2465 | This driver assumes that the display hardware has been initialized | ||
2466 | before the kernel boots, and the kernel will simply render to the | ||
2467 | pre-allocated frame buffer surface. | ||
2468 | |||
2469 | Configuration re: surface address, size, and format must be provided | ||
2470 | through device tree, or potentially plain old platform data in the | ||
2471 | future. | ||
2472 | |||
2456 | source "drivers/video/omap/Kconfig" | 2473 | source "drivers/video/omap/Kconfig" |
2457 | source "drivers/video/omap2/Kconfig" | 2474 | source "drivers/video/omap2/Kconfig" |
2458 | source "drivers/video/exynos/Kconfig" | 2475 | source "drivers/video/exynos/Kconfig" |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 7234e4a959e8..e8bae8dd4804 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -166,6 +166,7 @@ obj-$(CONFIG_FB_MX3) += mx3fb.o | |||
166 | obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o | 166 | obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o |
167 | obj-$(CONFIG_FB_MXS) += mxsfb.o | 167 | obj-$(CONFIG_FB_MXS) += mxsfb.o |
168 | obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o | 168 | obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o |
169 | obj-$(CONFIG_FB_SIMPLE) += simplefb.o | ||
169 | 170 | ||
170 | # the test framebuffer is last | 171 | # the test framebuffer is last |
171 | obj-$(CONFIG_FB_VIRTUAL) += vfb.o | 172 | obj-$(CONFIG_FB_VIRTUAL) += vfb.o |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 540909de6247..effdb373b8db 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -223,8 +223,14 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) | |||
223 | 223 | ||
224 | static void exit_backlight(struct atmel_lcdfb_info *sinfo) | 224 | static void exit_backlight(struct atmel_lcdfb_info *sinfo) |
225 | { | 225 | { |
226 | if (sinfo->backlight) | 226 | if (!sinfo->backlight) |
227 | backlight_device_unregister(sinfo->backlight); | 227 | return; |
228 | |||
229 | if (sinfo->backlight->ops) { | ||
230 | sinfo->backlight->props.power = FB_BLANK_POWERDOWN; | ||
231 | sinfo->backlight->ops->update_status(sinfo->backlight); | ||
232 | } | ||
233 | backlight_device_unregister(sinfo->backlight); | ||
228 | } | 234 | } |
229 | 235 | ||
230 | #else | 236 | #else |
@@ -461,8 +467,11 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, | |||
461 | if (info->fix.smem_len) { | 467 | if (info->fix.smem_len) { |
462 | unsigned int smem_len = (var->xres_virtual * var->yres_virtual | 468 | unsigned int smem_len = (var->xres_virtual * var->yres_virtual |
463 | * ((var->bits_per_pixel + 7) / 8)); | 469 | * ((var->bits_per_pixel + 7) / 8)); |
464 | if (smem_len > info->fix.smem_len) | 470 | if (smem_len > info->fix.smem_len) { |
471 | dev_err(dev, "Frame buffer is too small (%u) for screen size (need at least %u)\n", | ||
472 | info->fix.smem_len, smem_len); | ||
465 | return -EINVAL; | 473 | return -EINVAL; |
474 | } | ||
466 | } | 475 | } |
467 | 476 | ||
468 | /* Saturate vertical and horizontal timings at maximum values */ | 477 | /* Saturate vertical and horizontal timings at maximum values */ |
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile index a862e9173ebe..48da25c96cd3 100644 --- a/drivers/video/console/Makefile +++ b/drivers/video/console/Makefile | |||
@@ -18,6 +18,8 @@ font-objs-$(CONFIG_FONT_MINI_4x6) += font_mini_4x6.o | |||
18 | 18 | ||
19 | font-objs += $(font-objs-y) | 19 | font-objs += $(font-objs-y) |
20 | 20 | ||
21 | obj-$(CONFIG_FONTS) += font.o | ||
22 | |||
21 | # Each configuration option enables a list of files. | 23 | # Each configuration option enables a list of files. |
22 | 24 | ||
23 | obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o | 25 | obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o |
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 60cc6fee6548..c9c2252e3719 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c | |||
@@ -53,6 +53,8 @@ static char *def_disp_name; | |||
53 | module_param_named(def_disp, def_disp_name, charp, 0); | 53 | module_param_named(def_disp, def_disp_name, charp, 0); |
54 | MODULE_PARM_DESC(def_disp, "default display name"); | 54 | MODULE_PARM_DESC(def_disp, "default display name"); |
55 | 55 | ||
56 | static bool dss_initialized; | ||
57 | |||
56 | const char *omapdss_get_default_display_name(void) | 58 | const char *omapdss_get_default_display_name(void) |
57 | { | 59 | { |
58 | return core.default_display_name; | 60 | return core.default_display_name; |
@@ -66,6 +68,12 @@ enum omapdss_version omapdss_get_version(void) | |||
66 | } | 68 | } |
67 | EXPORT_SYMBOL(omapdss_get_version); | 69 | EXPORT_SYMBOL(omapdss_get_version); |
68 | 70 | ||
71 | bool omapdss_is_initialized(void) | ||
72 | { | ||
73 | return dss_initialized; | ||
74 | } | ||
75 | EXPORT_SYMBOL(omapdss_is_initialized); | ||
76 | |||
69 | struct platform_device *dss_get_core_pdev(void) | 77 | struct platform_device *dss_get_core_pdev(void) |
70 | { | 78 | { |
71 | return core.pdev; | 79 | return core.pdev; |
@@ -603,6 +611,8 @@ static int __init omap_dss_init(void) | |||
603 | return r; | 611 | return r; |
604 | } | 612 | } |
605 | 613 | ||
614 | dss_initialized = true; | ||
615 | |||
606 | return 0; | 616 | return 0; |
607 | } | 617 | } |
608 | 618 | ||
@@ -633,7 +643,15 @@ static int __init omap_dss_init(void) | |||
633 | 643 | ||
634 | static int __init omap_dss_init2(void) | 644 | static int __init omap_dss_init2(void) |
635 | { | 645 | { |
636 | return omap_dss_register_drivers(); | 646 | int r; |
647 | |||
648 | r = omap_dss_register_drivers(); | ||
649 | if (r) | ||
650 | return r; | ||
651 | |||
652 | dss_initialized = true; | ||
653 | |||
654 | return 0; | ||
637 | } | 655 | } |
638 | 656 | ||
639 | core_initcall(omap_dss_init); | 657 | core_initcall(omap_dss_init); |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 17f4d55c621c..a109934c0478 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -1065,10 +1065,6 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) | |||
1065 | mutex_init(&hdmi.ip_data.lock); | 1065 | mutex_init(&hdmi.ip_data.lock); |
1066 | 1066 | ||
1067 | res = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0); | 1067 | res = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0); |
1068 | if (!res) { | ||
1069 | DSSERR("can't get IORESOURCE_MEM HDMI\n"); | ||
1070 | return -EINVAL; | ||
1071 | } | ||
1072 | 1068 | ||
1073 | /* Base address taken from platform */ | 1069 | /* Base address taken from platform */ |
1074 | hdmi.ip_data.base_wp = devm_ioremap_resource(&pdev->dev, res); | 1070 | hdmi.ip_data.base_wp = devm_ioremap_resource(&pdev->dev, res); |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index c84bb8a4d0c4..856917b33616 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -2416,6 +2416,9 @@ static int omapfb_probe(struct platform_device *pdev) | |||
2416 | 2416 | ||
2417 | DBG("omapfb_probe\n"); | 2417 | DBG("omapfb_probe\n"); |
2418 | 2418 | ||
2419 | if (omapdss_is_initialized() == false) | ||
2420 | return -EPROBE_DEFER; | ||
2421 | |||
2419 | if (pdev->num_resources != 0) { | 2422 | if (pdev->num_resources != 0) { |
2420 | dev_err(&pdev->dev, "probed for an unknown device\n"); | 2423 | dev_err(&pdev->dev, "probed for an unknown device\n"); |
2421 | r = -ENODEV; | 2424 | r = -ENODEV; |
diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c index 5261229c79af..f346b02eee1d 100644 --- a/drivers/video/omap2/vrfb.c +++ b/drivers/video/omap2/vrfb.c | |||
@@ -353,11 +353,6 @@ static int __init vrfb_probe(struct platform_device *pdev) | |||
353 | /* first resource is the register res, the rest are vrfb contexts */ | 353 | /* first resource is the register res, the rest are vrfb contexts */ |
354 | 354 | ||
355 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 355 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
356 | if (!mem) { | ||
357 | dev_err(&pdev->dev, "can't get vrfb base address\n"); | ||
358 | return -EINVAL; | ||
359 | } | ||
360 | |||
361 | vrfb_base = devm_ioremap_resource(&pdev->dev, mem); | 356 | vrfb_base = devm_ioremap_resource(&pdev->dev, mem); |
362 | if (IS_ERR(vrfb_base)) | 357 | if (IS_ERR(vrfb_base)) |
363 | return PTR_ERR(vrfb_base); | 358 | return PTR_ERR(vrfb_base); |
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index d9f08c653d62..dbfe2c18a434 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -710,7 +710,7 @@ static int ps3fb_mmap(struct fb_info *info, struct vm_area_struct *vma) | |||
710 | r = vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len); | 710 | r = vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len); |
711 | 711 | ||
712 | dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n", | 712 | dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n", |
713 | info->fix.smem_start + vma->vm_pgoff << PAGE_SHIFT, | 713 | info->fix.smem_start + (vma->vm_pgoff << PAGE_SHIFT), |
714 | vma->vm_start); | 714 | vma->vm_start); |
715 | 715 | ||
716 | return r; | 716 | return r; |
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c new file mode 100644 index 000000000000..e2e9e3e61b72 --- /dev/null +++ b/drivers/video/simplefb.c | |||
@@ -0,0 +1,234 @@ | |||
1 | /* | ||
2 | * Simplest possible simple frame-buffer driver, as a platform device | ||
3 | * | ||
4 | * Copyright (c) 2013, Stephen Warren | ||
5 | * | ||
6 | * Based on q40fb.c, which was: | ||
7 | * Copyright (C) 2001 Richard Zidlicky <rz@linux-m68k.org> | ||
8 | * | ||
9 | * Also based on offb.c, which was: | ||
10 | * Copyright (C) 1997 Geert Uytterhoeven | ||
11 | * Copyright (C) 1996 Paul Mackerras | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms and conditions of the GNU General Public License, | ||
15 | * version 2, as published by the Free Software Foundation. | ||
16 | * | ||
17 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
18 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
20 | * more details. | ||
21 | */ | ||
22 | |||
23 | #include <linux/errno.h> | ||
24 | #include <linux/fb.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/module.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | |||
29 | static struct fb_fix_screeninfo simplefb_fix = { | ||
30 | .id = "simple", | ||
31 | .type = FB_TYPE_PACKED_PIXELS, | ||
32 | .visual = FB_VISUAL_TRUECOLOR, | ||
33 | .accel = FB_ACCEL_NONE, | ||
34 | }; | ||
35 | |||
36 | static struct fb_var_screeninfo simplefb_var = { | ||
37 | .height = -1, | ||
38 | .width = -1, | ||
39 | .activate = FB_ACTIVATE_NOW, | ||
40 | .vmode = FB_VMODE_NONINTERLACED, | ||
41 | }; | ||
42 | |||
43 | static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | ||
44 | u_int transp, struct fb_info *info) | ||
45 | { | ||
46 | u32 *pal = info->pseudo_palette; | ||
47 | u32 cr = red >> (16 - info->var.red.length); | ||
48 | u32 cg = green >> (16 - info->var.green.length); | ||
49 | u32 cb = blue >> (16 - info->var.blue.length); | ||
50 | u32 value; | ||
51 | |||
52 | if (regno >= 16) | ||
53 | return -EINVAL; | ||
54 | |||
55 | value = (cr << info->var.red.offset) | | ||
56 | (cg << info->var.green.offset) | | ||
57 | (cb << info->var.blue.offset); | ||
58 | if (info->var.transp.length > 0) { | ||
59 | u32 mask = (1 << info->var.transp.length) - 1; | ||
60 | mask <<= info->var.transp.offset; | ||
61 | value |= mask; | ||
62 | } | ||
63 | pal[regno] = value; | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | static struct fb_ops simplefb_ops = { | ||
69 | .owner = THIS_MODULE, | ||
70 | .fb_setcolreg = simplefb_setcolreg, | ||
71 | .fb_fillrect = cfb_fillrect, | ||
72 | .fb_copyarea = cfb_copyarea, | ||
73 | .fb_imageblit = cfb_imageblit, | ||
74 | }; | ||
75 | |||
76 | struct simplefb_format { | ||
77 | const char *name; | ||
78 | u32 bits_per_pixel; | ||
79 | struct fb_bitfield red; | ||
80 | struct fb_bitfield green; | ||
81 | struct fb_bitfield blue; | ||
82 | struct fb_bitfield transp; | ||
83 | }; | ||
84 | |||
85 | static struct simplefb_format simplefb_formats[] = { | ||
86 | { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0} }, | ||
87 | }; | ||
88 | |||
89 | struct simplefb_params { | ||
90 | u32 width; | ||
91 | u32 height; | ||
92 | u32 stride; | ||
93 | struct simplefb_format *format; | ||
94 | }; | ||
95 | |||
96 | static int simplefb_parse_dt(struct platform_device *pdev, | ||
97 | struct simplefb_params *params) | ||
98 | { | ||
99 | struct device_node *np = pdev->dev.of_node; | ||
100 | int ret; | ||
101 | const char *format; | ||
102 | int i; | ||
103 | |||
104 | ret = of_property_read_u32(np, "width", ¶ms->width); | ||
105 | if (ret) { | ||
106 | dev_err(&pdev->dev, "Can't parse width property\n"); | ||
107 | return ret; | ||
108 | } | ||
109 | |||
110 | ret = of_property_read_u32(np, "height", ¶ms->height); | ||
111 | if (ret) { | ||
112 | dev_err(&pdev->dev, "Can't parse height property\n"); | ||
113 | return ret; | ||
114 | } | ||
115 | |||
116 | ret = of_property_read_u32(np, "stride", ¶ms->stride); | ||
117 | if (ret) { | ||
118 | dev_err(&pdev->dev, "Can't parse stride property\n"); | ||
119 | return ret; | ||
120 | } | ||
121 | |||
122 | ret = of_property_read_string(np, "format", &format); | ||
123 | if (ret) { | ||
124 | dev_err(&pdev->dev, "Can't parse format property\n"); | ||
125 | return ret; | ||
126 | } | ||
127 | params->format = NULL; | ||
128 | for (i = 0; i < ARRAY_SIZE(simplefb_formats); i++) { | ||
129 | if (strcmp(format, simplefb_formats[i].name)) | ||
130 | continue; | ||
131 | params->format = &simplefb_formats[i]; | ||
132 | break; | ||
133 | } | ||
134 | if (!params->format) { | ||
135 | dev_err(&pdev->dev, "Invalid format value\n"); | ||
136 | return -EINVAL; | ||
137 | } | ||
138 | |||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | static int simplefb_probe(struct platform_device *pdev) | ||
143 | { | ||
144 | int ret; | ||
145 | struct simplefb_params params; | ||
146 | struct fb_info *info; | ||
147 | struct resource *mem; | ||
148 | |||
149 | if (fb_get_options("simplefb", NULL)) | ||
150 | return -ENODEV; | ||
151 | |||
152 | ret = simplefb_parse_dt(pdev, ¶ms); | ||
153 | if (ret) | ||
154 | return ret; | ||
155 | |||
156 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
157 | if (!mem) { | ||
158 | dev_err(&pdev->dev, "No memory resource\n"); | ||
159 | return -EINVAL; | ||
160 | } | ||
161 | |||
162 | info = framebuffer_alloc(sizeof(u32) * 16, &pdev->dev); | ||
163 | if (!info) | ||
164 | return -ENOMEM; | ||
165 | platform_set_drvdata(pdev, info); | ||
166 | |||
167 | info->fix = simplefb_fix; | ||
168 | info->fix.smem_start = mem->start; | ||
169 | info->fix.smem_len = resource_size(mem); | ||
170 | info->fix.line_length = params.stride; | ||
171 | |||
172 | info->var = simplefb_var; | ||
173 | info->var.xres = params.width; | ||
174 | info->var.yres = params.height; | ||
175 | info->var.xres_virtual = params.width; | ||
176 | info->var.yres_virtual = params.height; | ||
177 | info->var.bits_per_pixel = params.format->bits_per_pixel; | ||
178 | info->var.red = params.format->red; | ||
179 | info->var.green = params.format->green; | ||
180 | info->var.blue = params.format->blue; | ||
181 | info->var.transp = params.format->transp; | ||
182 | |||
183 | info->fbops = &simplefb_ops; | ||
184 | info->flags = FBINFO_DEFAULT; | ||
185 | info->screen_base = devm_ioremap(&pdev->dev, info->fix.smem_start, | ||
186 | info->fix.smem_len); | ||
187 | if (!info->screen_base) { | ||
188 | framebuffer_release(info); | ||
189 | return -ENODEV; | ||
190 | } | ||
191 | info->pseudo_palette = (void *)(info + 1); | ||
192 | |||
193 | ret = register_framebuffer(info); | ||
194 | if (ret < 0) { | ||
195 | dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret); | ||
196 | framebuffer_release(info); | ||
197 | return ret; | ||
198 | } | ||
199 | |||
200 | dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node); | ||
201 | |||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static int simplefb_remove(struct platform_device *pdev) | ||
206 | { | ||
207 | struct fb_info *info = platform_get_drvdata(pdev); | ||
208 | |||
209 | unregister_framebuffer(info); | ||
210 | framebuffer_release(info); | ||
211 | |||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | static const struct of_device_id simplefb_of_match[] = { | ||
216 | { .compatible = "simple-framebuffer", }, | ||
217 | { }, | ||
218 | }; | ||
219 | MODULE_DEVICE_TABLE(of, simplefb_of_match); | ||
220 | |||
221 | static struct platform_driver simplefb_driver = { | ||
222 | .driver = { | ||
223 | .name = "simple-framebuffer", | ||
224 | .owner = THIS_MODULE, | ||
225 | .of_match_table = simplefb_of_match, | ||
226 | }, | ||
227 | .probe = simplefb_probe, | ||
228 | .remove = simplefb_remove, | ||
229 | }; | ||
230 | module_platform_driver(simplefb_driver); | ||
231 | |||
232 | MODULE_AUTHOR("Stephen Warren <swarren@wwwdotorg.org>"); | ||
233 | MODULE_DESCRIPTION("Simple framebuffer driver"); | ||
234 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index db2390aed387..6e94d8dd3d00 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c | |||
@@ -555,11 +555,6 @@ static int omap_hdq_probe(struct platform_device *pdev) | |||
555 | platform_set_drvdata(pdev, hdq_data); | 555 | platform_set_drvdata(pdev, hdq_data); |
556 | 556 | ||
557 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 557 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
558 | if (!res) { | ||
559 | dev_dbg(&pdev->dev, "unable to get resource\n"); | ||
560 | return -ENXIO; | ||
561 | } | ||
562 | |||
563 | hdq_data->hdq_base = devm_ioremap_resource(dev, res); | 558 | hdq_data->hdq_base = devm_ioremap_resource(dev, res); |
564 | if (IS_ERR(hdq_data->hdq_base)) | 559 | if (IS_ERR(hdq_data->hdq_base)) |
565 | return PTR_ERR(hdq_data->hdq_base); | 560 | return PTR_ERR(hdq_data->hdq_base); |
diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c index d184c48a0482..37cb09b27b63 100644 --- a/drivers/watchdog/ath79_wdt.c +++ b/drivers/watchdog/ath79_wdt.c | |||
@@ -248,11 +248,6 @@ static int ath79_wdt_probe(struct platform_device *pdev) | |||
248 | return -EBUSY; | 248 | return -EBUSY; |
249 | 249 | ||
250 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 250 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
251 | if (!res) { | ||
252 | dev_err(&pdev->dev, "no memory resource found\n"); | ||
253 | return -EINVAL; | ||
254 | } | ||
255 | |||
256 | wdt_base = devm_ioremap_resource(&pdev->dev, res); | 251 | wdt_base = devm_ioremap_resource(&pdev->dev, res); |
257 | if (IS_ERR(wdt_base)) | 252 | if (IS_ERR(wdt_base)) |
258 | return PTR_ERR(wdt_base); | 253 | return PTR_ERR(wdt_base); |
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c index 100d4fbfde2a..bead7740c86a 100644 --- a/drivers/watchdog/davinci_wdt.c +++ b/drivers/watchdog/davinci_wdt.c | |||
@@ -217,11 +217,6 @@ static int davinci_wdt_probe(struct platform_device *pdev) | |||
217 | dev_info(dev, "heartbeat %d sec\n", heartbeat); | 217 | dev_info(dev, "heartbeat %d sec\n", heartbeat); |
218 | 218 | ||
219 | wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 219 | wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
220 | if (wdt_mem == NULL) { | ||
221 | dev_err(dev, "failed to get memory region resource\n"); | ||
222 | return -ENOENT; | ||
223 | } | ||
224 | |||
225 | wdt_base = devm_ioremap_resource(dev, wdt_mem); | 220 | wdt_base = devm_ioremap_resource(dev, wdt_mem); |
226 | if (IS_ERR(wdt_base)) | 221 | if (IS_ERR(wdt_base)) |
227 | return PTR_ERR(wdt_base); | 222 | return PTR_ERR(wdt_base); |
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index ff908823688c..62946c2cb4f8 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c | |||
@@ -257,11 +257,6 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) | |||
257 | struct resource *res; | 257 | struct resource *res; |
258 | 258 | ||
259 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 259 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
260 | if (!res) { | ||
261 | dev_err(&pdev->dev, "can't get device resources\n"); | ||
262 | return -ENODEV; | ||
263 | } | ||
264 | |||
265 | imx2_wdt.base = devm_ioremap_resource(&pdev->dev, res); | 260 | imx2_wdt.base = devm_ioremap_resource(&pdev->dev, res); |
266 | if (IS_ERR(imx2_wdt.base)) | 261 | if (IS_ERR(imx2_wdt.base)) |
267 | return PTR_ERR(imx2_wdt.base); | 262 | return PTR_ERR(imx2_wdt.base); |
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index f03bf501527f..9e02d60a364b 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -19,11 +19,10 @@ config XEN_SELFBALLOONING | |||
19 | by the current usage of anonymous memory ("committed AS") and | 19 | by the current usage of anonymous memory ("committed AS") and |
20 | controlled by various sysfs-settable parameters. Configuring | 20 | controlled by various sysfs-settable parameters. Configuring |
21 | FRONTSWAP is highly recommended; if it is not configured, self- | 21 | FRONTSWAP is highly recommended; if it is not configured, self- |
22 | ballooning is disabled by default but can be enabled with the | 22 | ballooning is disabled by default. If FRONTSWAP is configured, |
23 | 'selfballooning' kernel boot parameter. If FRONTSWAP is configured, | ||
24 | frontswap-selfshrinking is enabled by default but can be disabled | 23 | frontswap-selfshrinking is enabled by default but can be disabled |
25 | with the 'noselfshrink' kernel boot parameter; and self-ballooning | 24 | with the 'tmem.selfshrink=0' kernel boot parameter; and self-ballooning |
26 | is enabled by default but can be disabled with the 'noselfballooning' | 25 | is enabled by default but can be disabled with the 'tmem.selfballooning=0' |
27 | kernel boot parameter. Note that systems without a sufficiently | 26 | kernel boot parameter. Note that systems without a sufficiently |
28 | large swap device should not enable self-ballooning. | 27 | large swap device should not enable self-ballooning. |
29 | 28 | ||
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index a56776dbe095..930fb6817901 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -407,7 +407,8 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
407 | nr_pages = ARRAY_SIZE(frame_list); | 407 | nr_pages = ARRAY_SIZE(frame_list); |
408 | 408 | ||
409 | for (i = 0; i < nr_pages; i++) { | 409 | for (i = 0; i < nr_pages; i++) { |
410 | if ((page = alloc_page(gfp)) == NULL) { | 410 | page = alloc_page(gfp); |
411 | if (page == NULL) { | ||
411 | nr_pages = i; | 412 | nr_pages = i; |
412 | state = BP_EAGAIN; | 413 | state = BP_EAGAIN; |
413 | break; | 414 | break; |
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index ca2b00e9d558..2cfc24d76fc5 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c | |||
@@ -504,7 +504,7 @@ static void privcmd_close(struct vm_area_struct *vma) | |||
504 | struct page **pages = vma->vm_private_data; | 504 | struct page **pages = vma->vm_private_data; |
505 | int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 505 | int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
506 | 506 | ||
507 | if (!xen_feature(XENFEAT_auto_translated_physmap || !numpgs || !pages)) | 507 | if (!xen_feature(XENFEAT_auto_translated_physmap) || !numpgs || !pages) |
508 | return; | 508 | return; |
509 | 509 | ||
510 | xen_unmap_domain_mfn_range(vma, numpgs, pages); | 510 | xen_unmap_domain_mfn_range(vma, numpgs, pages); |
diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index e3600be4e7fa..0f0493c63371 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c | |||
@@ -11,11 +11,7 @@ | |||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/cleancache.h> | 13 | #include <linux/cleancache.h> |
14 | |||
15 | /* temporary ifdef until include/linux/frontswap.h is upstream */ | ||
16 | #ifdef CONFIG_FRONTSWAP | ||
17 | #include <linux/frontswap.h> | 14 | #include <linux/frontswap.h> |
18 | #endif | ||
19 | 15 | ||
20 | #include <xen/xen.h> | 16 | #include <xen/xen.h> |
21 | #include <xen/interface/xen.h> | 17 | #include <xen/interface/xen.h> |
@@ -24,6 +20,36 @@ | |||
24 | #include <asm/xen/hypervisor.h> | 20 | #include <asm/xen/hypervisor.h> |
25 | #include <xen/tmem.h> | 21 | #include <xen/tmem.h> |
26 | 22 | ||
23 | #ifndef CONFIG_XEN_TMEM_MODULE | ||
24 | bool __read_mostly tmem_enabled = false; | ||
25 | |||
26 | static int __init enable_tmem(char *s) | ||
27 | { | ||
28 | tmem_enabled = true; | ||
29 | return 1; | ||
30 | } | ||
31 | __setup("tmem", enable_tmem); | ||
32 | #endif | ||
33 | |||
34 | #ifdef CONFIG_CLEANCACHE | ||
35 | static bool cleancache __read_mostly = true; | ||
36 | module_param(cleancache, bool, S_IRUGO); | ||
37 | static bool selfballooning __read_mostly = true; | ||
38 | module_param(selfballooning, bool, S_IRUGO); | ||
39 | #endif /* CONFIG_CLEANCACHE */ | ||
40 | |||
41 | #ifdef CONFIG_FRONTSWAP | ||
42 | static bool frontswap __read_mostly = true; | ||
43 | module_param(frontswap, bool, S_IRUGO); | ||
44 | #else /* CONFIG_FRONTSWAP */ | ||
45 | #define frontswap (0) | ||
46 | #endif /* CONFIG_FRONTSWAP */ | ||
47 | |||
48 | #ifdef CONFIG_XEN_SELFBALLOONING | ||
49 | static bool selfshrinking __read_mostly = true; | ||
50 | module_param(selfshrinking, bool, S_IRUGO); | ||
51 | #endif /* CONFIG_XEN_SELFBALLOONING */ | ||
52 | |||
27 | #define TMEM_CONTROL 0 | 53 | #define TMEM_CONTROL 0 |
28 | #define TMEM_NEW_POOL 1 | 54 | #define TMEM_NEW_POOL 1 |
29 | #define TMEM_DESTROY_POOL 2 | 55 | #define TMEM_DESTROY_POOL 2 |
@@ -129,16 +155,6 @@ static int xen_tmem_flush_object(u32 pool_id, struct tmem_oid oid) | |||
129 | return xen_tmem_op(TMEM_FLUSH_OBJECT, pool_id, oid, 0, 0, 0, 0, 0); | 155 | return xen_tmem_op(TMEM_FLUSH_OBJECT, pool_id, oid, 0, 0, 0, 0, 0); |
130 | } | 156 | } |
131 | 157 | ||
132 | #ifndef CONFIG_XEN_TMEM_MODULE | ||
133 | bool __read_mostly tmem_enabled = false; | ||
134 | |||
135 | static int __init enable_tmem(char *s) | ||
136 | { | ||
137 | tmem_enabled = true; | ||
138 | return 1; | ||
139 | } | ||
140 | __setup("tmem", enable_tmem); | ||
141 | #endif | ||
142 | 158 | ||
143 | #ifdef CONFIG_CLEANCACHE | 159 | #ifdef CONFIG_CLEANCACHE |
144 | static int xen_tmem_destroy_pool(u32 pool_id) | 160 | static int xen_tmem_destroy_pool(u32 pool_id) |
@@ -230,20 +246,6 @@ static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize) | |||
230 | return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize); | 246 | return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize); |
231 | } | 247 | } |
232 | 248 | ||
233 | static bool disable_cleancache __read_mostly; | ||
234 | static bool disable_selfballooning __read_mostly; | ||
235 | #ifdef CONFIG_XEN_TMEM_MODULE | ||
236 | module_param(disable_cleancache, bool, S_IRUGO); | ||
237 | module_param(disable_selfballooning, bool, S_IRUGO); | ||
238 | #else | ||
239 | static int __init no_cleancache(char *s) | ||
240 | { | ||
241 | disable_cleancache = true; | ||
242 | return 1; | ||
243 | } | ||
244 | __setup("nocleancache", no_cleancache); | ||
245 | #endif | ||
246 | |||
247 | static struct cleancache_ops tmem_cleancache_ops = { | 249 | static struct cleancache_ops tmem_cleancache_ops = { |
248 | .put_page = tmem_cleancache_put_page, | 250 | .put_page = tmem_cleancache_put_page, |
249 | .get_page = tmem_cleancache_get_page, | 251 | .get_page = tmem_cleancache_get_page, |
@@ -361,20 +363,6 @@ static void tmem_frontswap_init(unsigned ignored) | |||
361 | xen_tmem_new_pool(private, TMEM_POOL_PERSIST, PAGE_SIZE); | 363 | xen_tmem_new_pool(private, TMEM_POOL_PERSIST, PAGE_SIZE); |
362 | } | 364 | } |
363 | 365 | ||
364 | static bool disable_frontswap __read_mostly; | ||
365 | static bool disable_frontswap_selfshrinking __read_mostly; | ||
366 | #ifdef CONFIG_XEN_TMEM_MODULE | ||
367 | module_param(disable_frontswap, bool, S_IRUGO); | ||
368 | module_param(disable_frontswap_selfshrinking, bool, S_IRUGO); | ||
369 | #else | ||
370 | static int __init no_frontswap(char *s) | ||
371 | { | ||
372 | disable_frontswap = true; | ||
373 | return 1; | ||
374 | } | ||
375 | __setup("nofrontswap", no_frontswap); | ||
376 | #endif | ||
377 | |||
378 | static struct frontswap_ops tmem_frontswap_ops = { | 366 | static struct frontswap_ops tmem_frontswap_ops = { |
379 | .store = tmem_frontswap_store, | 367 | .store = tmem_frontswap_store, |
380 | .load = tmem_frontswap_load, | 368 | .load = tmem_frontswap_load, |
@@ -382,8 +370,6 @@ static struct frontswap_ops tmem_frontswap_ops = { | |||
382 | .invalidate_area = tmem_frontswap_flush_area, | 370 | .invalidate_area = tmem_frontswap_flush_area, |
383 | .init = tmem_frontswap_init | 371 | .init = tmem_frontswap_init |
384 | }; | 372 | }; |
385 | #else /* CONFIG_FRONTSWAP */ | ||
386 | #define disable_frontswap_selfshrinking 1 | ||
387 | #endif | 373 | #endif |
388 | 374 | ||
389 | static int xen_tmem_init(void) | 375 | static int xen_tmem_init(void) |
@@ -391,12 +377,12 @@ static int xen_tmem_init(void) | |||
391 | if (!xen_domain()) | 377 | if (!xen_domain()) |
392 | return 0; | 378 | return 0; |
393 | #ifdef CONFIG_FRONTSWAP | 379 | #ifdef CONFIG_FRONTSWAP |
394 | if (tmem_enabled && !disable_frontswap) { | 380 | if (tmem_enabled && frontswap) { |
395 | char *s = ""; | 381 | char *s = ""; |
396 | struct frontswap_ops *old_ops = | 382 | struct frontswap_ops *old_ops; |
397 | frontswap_register_ops(&tmem_frontswap_ops); | ||
398 | 383 | ||
399 | tmem_frontswap_poolid = -1; | 384 | tmem_frontswap_poolid = -1; |
385 | old_ops = frontswap_register_ops(&tmem_frontswap_ops); | ||
400 | if (IS_ERR(old_ops) || old_ops) { | 386 | if (IS_ERR(old_ops) || old_ops) { |
401 | if (IS_ERR(old_ops)) | 387 | if (IS_ERR(old_ops)) |
402 | return PTR_ERR(old_ops); | 388 | return PTR_ERR(old_ops); |
@@ -408,7 +394,7 @@ static int xen_tmem_init(void) | |||
408 | #endif | 394 | #endif |
409 | #ifdef CONFIG_CLEANCACHE | 395 | #ifdef CONFIG_CLEANCACHE |
410 | BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid)); | 396 | BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid)); |
411 | if (tmem_enabled && !disable_cleancache) { | 397 | if (tmem_enabled && cleancache) { |
412 | char *s = ""; | 398 | char *s = ""; |
413 | struct cleancache_ops *old_ops = | 399 | struct cleancache_ops *old_ops = |
414 | cleancache_register_ops(&tmem_cleancache_ops); | 400 | cleancache_register_ops(&tmem_cleancache_ops); |
@@ -419,8 +405,15 @@ static int xen_tmem_init(void) | |||
419 | } | 405 | } |
420 | #endif | 406 | #endif |
421 | #ifdef CONFIG_XEN_SELFBALLOONING | 407 | #ifdef CONFIG_XEN_SELFBALLOONING |
422 | xen_selfballoon_init(!disable_selfballooning, | 408 | /* |
423 | !disable_frontswap_selfshrinking); | 409 | * There is no point of driving pages to the swap system if they |
410 | * aren't going anywhere in tmem universe. | ||
411 | */ | ||
412 | if (!frontswap) { | ||
413 | selfshrinking = false; | ||
414 | selfballooning = false; | ||
415 | } | ||
416 | xen_selfballoon_init(selfballooning, selfshrinking); | ||
424 | #endif | 417 | #endif |
425 | return 0; | 418 | return 0; |
426 | } | 419 | } |
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c index a2278ba7fb27..4e8ba38aa0c9 100644 --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c | |||
@@ -106,7 +106,7 @@ static void pcistub_device_release(struct kref *kref) | |||
106 | else | 106 | else |
107 | pci_restore_state(dev); | 107 | pci_restore_state(dev); |
108 | 108 | ||
109 | if (pci_find_capability(dev, PCI_CAP_ID_MSIX)) { | 109 | if (dev->msix_cap) { |
110 | struct physdev_pci_device ppdev = { | 110 | struct physdev_pci_device ppdev = { |
111 | .seg = pci_domain_nr(dev->bus), | 111 | .seg = pci_domain_nr(dev->bus), |
112 | .bus = dev->bus->number, | 112 | .bus = dev->bus->number, |
@@ -371,7 +371,7 @@ static int pcistub_init_device(struct pci_dev *dev) | |||
371 | if (err) | 371 | if (err) |
372 | goto config_release; | 372 | goto config_release; |
373 | 373 | ||
374 | if (pci_find_capability(dev, PCI_CAP_ID_MSIX)) { | 374 | if (dev->msix_cap) { |
375 | struct physdev_pci_device ppdev = { | 375 | struct physdev_pci_device ppdev = { |
376 | .seg = pci_domain_nr(dev->bus), | 376 | .seg = pci_domain_nr(dev->bus), |
377 | .bus = dev->bus->number, | 377 | .bus = dev->bus->number, |
diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c index f2ef569c7cc1..f70984a892aa 100644 --- a/drivers/xen/xen-selfballoon.c +++ b/drivers/xen/xen-selfballoon.c | |||
@@ -53,15 +53,12 @@ | |||
53 | * System configuration note: Selfballooning should not be enabled on | 53 | * System configuration note: Selfballooning should not be enabled on |
54 | * systems without a sufficiently large swap device configured; for best | 54 | * systems without a sufficiently large swap device configured; for best |
55 | * results, it is recommended that total swap be increased by the size | 55 | * results, it is recommended that total swap be increased by the size |
56 | * of the guest memory. Also, while technically not required to be | 56 | * of the guest memory. Note, that selfballooning should be disabled by default |
57 | * configured, it is highly recommended that frontswap also be configured | 57 | * if frontswap is not configured. Similarly selfballooning should be enabled |
58 | * and enabled when selfballooning is running. So, selfballooning | 58 | * by default if frontswap is configured and can be disabled with the |
59 | * is disabled by default if frontswap is not configured and can only | 59 | * "tmem.selfballooning=0" kernel boot option. Finally, when frontswap is |
60 | * be enabled with the "selfballooning" kernel boot option; similarly | 60 | * configured, frontswap-selfshrinking can be disabled with the |
61 | * selfballooning is enabled by default if frontswap is configured and | 61 | * "tmem.selfshrink=0" kernel boot option. |
62 | * can be disabled with the "noselfballooning" kernel boot option. Finally, | ||
63 | * when frontswap is configured, frontswap-selfshrinking can be disabled | ||
64 | * with the "noselfshrink" kernel boot option. | ||
65 | * | 62 | * |
66 | * Selfballooning is disallowed in domain0 and force-disabled. | 63 | * Selfballooning is disallowed in domain0 and force-disabled. |
67 | * | 64 | * |
@@ -120,9 +117,6 @@ static DECLARE_DELAYED_WORK(selfballoon_worker, selfballoon_process); | |||
120 | /* Enable/disable with sysfs. */ | 117 | /* Enable/disable with sysfs. */ |
121 | static bool frontswap_selfshrinking __read_mostly; | 118 | static bool frontswap_selfshrinking __read_mostly; |
122 | 119 | ||
123 | /* Enable/disable with kernel boot option. */ | ||
124 | static bool use_frontswap_selfshrink = true; | ||
125 | |||
126 | /* | 120 | /* |
127 | * The default values for the following parameters were deemed reasonable | 121 | * The default values for the following parameters were deemed reasonable |
128 | * by experimentation, may be workload-dependent, and can all be | 122 | * by experimentation, may be workload-dependent, and can all be |
@@ -176,35 +170,6 @@ static void frontswap_selfshrink(void) | |||
176 | frontswap_shrink(tgt_frontswap_pages); | 170 | frontswap_shrink(tgt_frontswap_pages); |
177 | } | 171 | } |
178 | 172 | ||
179 | static int __init xen_nofrontswap_selfshrink_setup(char *s) | ||
180 | { | ||
181 | use_frontswap_selfshrink = false; | ||
182 | return 1; | ||
183 | } | ||
184 | |||
185 | __setup("noselfshrink", xen_nofrontswap_selfshrink_setup); | ||
186 | |||
187 | /* Disable with kernel boot option. */ | ||
188 | static bool use_selfballooning = true; | ||
189 | |||
190 | static int __init xen_noselfballooning_setup(char *s) | ||
191 | { | ||
192 | use_selfballooning = false; | ||
193 | return 1; | ||
194 | } | ||
195 | |||
196 | __setup("noselfballooning", xen_noselfballooning_setup); | ||
197 | #else /* !CONFIG_FRONTSWAP */ | ||
198 | /* Enable with kernel boot option. */ | ||
199 | static bool use_selfballooning; | ||
200 | |||
201 | static int __init xen_selfballooning_setup(char *s) | ||
202 | { | ||
203 | use_selfballooning = true; | ||
204 | return 1; | ||
205 | } | ||
206 | |||
207 | __setup("selfballooning", xen_selfballooning_setup); | ||
208 | #endif /* CONFIG_FRONTSWAP */ | 173 | #endif /* CONFIG_FRONTSWAP */ |
209 | 174 | ||
210 | #define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) | 175 | #define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) |
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c index 61786be9138b..ec097d6f964d 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c | |||
@@ -534,7 +534,7 @@ static int xenbus_map_ring_valloc_hvm(struct xenbus_device *dev, | |||
534 | 534 | ||
535 | err = xenbus_map_ring(dev, gnt_ref, &node->handle, addr); | 535 | err = xenbus_map_ring(dev, gnt_ref, &node->handle, addr); |
536 | if (err) | 536 | if (err) |
537 | goto out_err; | 537 | goto out_err_free_ballooned_pages; |
538 | 538 | ||
539 | spin_lock(&xenbus_valloc_lock); | 539 | spin_lock(&xenbus_valloc_lock); |
540 | list_add(&node->next, &xenbus_valloc_pages); | 540 | list_add(&node->next, &xenbus_valloc_pages); |
@@ -543,8 +543,9 @@ static int xenbus_map_ring_valloc_hvm(struct xenbus_device *dev, | |||
543 | *vaddr = addr; | 543 | *vaddr = addr; |
544 | return 0; | 544 | return 0; |
545 | 545 | ||
546 | out_err: | 546 | out_err_free_ballooned_pages: |
547 | free_xenballooned_pages(1, &node->page); | 547 | free_xenballooned_pages(1, &node->page); |
548 | out_err: | ||
548 | kfree(node); | 549 | kfree(node); |
549 | return err; | 550 | return err; |
550 | } | 551 | } |
diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h index c8abd3b8a6c4..e74f9c1fbd80 100644 --- a/drivers/xen/xenbus/xenbus_comms.h +++ b/drivers/xen/xenbus/xenbus_comms.h | |||
@@ -45,6 +45,7 @@ int xb_wait_for_data_to_read(void); | |||
45 | int xs_input_avail(void); | 45 | int xs_input_avail(void); |
46 | extern struct xenstore_domain_interface *xen_store_interface; | 46 | extern struct xenstore_domain_interface *xen_store_interface; |
47 | extern int xen_store_evtchn; | 47 | extern int xen_store_evtchn; |
48 | extern enum xenstore_init xen_store_domain_type; | ||
48 | 49 | ||
49 | extern const struct file_operations xen_xenbus_fops; | 50 | extern const struct file_operations xen_xenbus_fops; |
50 | 51 | ||
diff --git a/drivers/xen/xenbus/xenbus_dev_backend.c b/drivers/xen/xenbus/xenbus_dev_backend.c index d73000800762..a6f42fc01407 100644 --- a/drivers/xen/xenbus/xenbus_dev_backend.c +++ b/drivers/xen/xenbus/xenbus_dev_backend.c | |||
@@ -70,22 +70,21 @@ static long xenbus_alloc(domid_t domid) | |||
70 | return err; | 70 | return err; |
71 | } | 71 | } |
72 | 72 | ||
73 | static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, unsigned long data) | 73 | static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, |
74 | unsigned long data) | ||
74 | { | 75 | { |
75 | if (!capable(CAP_SYS_ADMIN)) | 76 | if (!capable(CAP_SYS_ADMIN)) |
76 | return -EPERM; | 77 | return -EPERM; |
77 | 78 | ||
78 | switch (cmd) { | 79 | switch (cmd) { |
79 | case IOCTL_XENBUS_BACKEND_EVTCHN: | 80 | case IOCTL_XENBUS_BACKEND_EVTCHN: |
80 | if (xen_store_evtchn > 0) | 81 | if (xen_store_evtchn > 0) |
81 | return xen_store_evtchn; | 82 | return xen_store_evtchn; |
82 | return -ENODEV; | 83 | return -ENODEV; |
83 | 84 | case IOCTL_XENBUS_BACKEND_SETUP: | |
84 | case IOCTL_XENBUS_BACKEND_SETUP: | 85 | return xenbus_alloc(data); |
85 | return xenbus_alloc(data); | 86 | default: |
86 | 87 | return -ENOTTY; | |
87 | default: | ||
88 | return -ENOTTY; | ||
89 | } | 88 | } |
90 | } | 89 | } |
91 | 90 | ||
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 3325884c693f..56cfaaa9d006 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -69,6 +69,9 @@ EXPORT_SYMBOL_GPL(xen_store_evtchn); | |||
69 | struct xenstore_domain_interface *xen_store_interface; | 69 | struct xenstore_domain_interface *xen_store_interface; |
70 | EXPORT_SYMBOL_GPL(xen_store_interface); | 70 | EXPORT_SYMBOL_GPL(xen_store_interface); |
71 | 71 | ||
72 | enum xenstore_init xen_store_domain_type; | ||
73 | EXPORT_SYMBOL_GPL(xen_store_domain_type); | ||
74 | |||
72 | static unsigned long xen_store_mfn; | 75 | static unsigned long xen_store_mfn; |
73 | 76 | ||
74 | static BLOCKING_NOTIFIER_HEAD(xenstore_chain); | 77 | static BLOCKING_NOTIFIER_HEAD(xenstore_chain); |
@@ -719,17 +722,11 @@ static int __init xenstored_local_init(void) | |||
719 | return err; | 722 | return err; |
720 | } | 723 | } |
721 | 724 | ||
722 | enum xenstore_init { | ||
723 | UNKNOWN, | ||
724 | PV, | ||
725 | HVM, | ||
726 | LOCAL, | ||
727 | }; | ||
728 | static int __init xenbus_init(void) | 725 | static int __init xenbus_init(void) |
729 | { | 726 | { |
730 | int err = 0; | 727 | int err = 0; |
731 | enum xenstore_init usage = UNKNOWN; | ||
732 | uint64_t v = 0; | 728 | uint64_t v = 0; |
729 | xen_store_domain_type = XS_UNKNOWN; | ||
733 | 730 | ||
734 | if (!xen_domain()) | 731 | if (!xen_domain()) |
735 | return -ENODEV; | 732 | return -ENODEV; |
@@ -737,29 +734,29 @@ static int __init xenbus_init(void) | |||
737 | xenbus_ring_ops_init(); | 734 | xenbus_ring_ops_init(); |
738 | 735 | ||
739 | if (xen_pv_domain()) | 736 | if (xen_pv_domain()) |
740 | usage = PV; | 737 | xen_store_domain_type = XS_PV; |
741 | if (xen_hvm_domain()) | 738 | if (xen_hvm_domain()) |
742 | usage = HVM; | 739 | xen_store_domain_type = XS_HVM; |
743 | if (xen_hvm_domain() && xen_initial_domain()) | 740 | if (xen_hvm_domain() && xen_initial_domain()) |
744 | usage = LOCAL; | 741 | xen_store_domain_type = XS_LOCAL; |
745 | if (xen_pv_domain() && !xen_start_info->store_evtchn) | 742 | if (xen_pv_domain() && !xen_start_info->store_evtchn) |
746 | usage = LOCAL; | 743 | xen_store_domain_type = XS_LOCAL; |
747 | if (xen_pv_domain() && xen_start_info->store_evtchn) | 744 | if (xen_pv_domain() && xen_start_info->store_evtchn) |
748 | xenstored_ready = 1; | 745 | xenstored_ready = 1; |
749 | 746 | ||
750 | switch (usage) { | 747 | switch (xen_store_domain_type) { |
751 | case LOCAL: | 748 | case XS_LOCAL: |
752 | err = xenstored_local_init(); | 749 | err = xenstored_local_init(); |
753 | if (err) | 750 | if (err) |
754 | goto out_error; | 751 | goto out_error; |
755 | xen_store_interface = mfn_to_virt(xen_store_mfn); | 752 | xen_store_interface = mfn_to_virt(xen_store_mfn); |
756 | break; | 753 | break; |
757 | case PV: | 754 | case XS_PV: |
758 | xen_store_evtchn = xen_start_info->store_evtchn; | 755 | xen_store_evtchn = xen_start_info->store_evtchn; |
759 | xen_store_mfn = xen_start_info->store_mfn; | 756 | xen_store_mfn = xen_start_info->store_mfn; |
760 | xen_store_interface = mfn_to_virt(xen_store_mfn); | 757 | xen_store_interface = mfn_to_virt(xen_store_mfn); |
761 | break; | 758 | break; |
762 | case HVM: | 759 | case XS_HVM: |
763 | err = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN, &v); | 760 | err = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN, &v); |
764 | if (err) | 761 | if (err) |
765 | goto out_error; | 762 | goto out_error; |
diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h index bb4f92ed8730..146f857a36f8 100644 --- a/drivers/xen/xenbus/xenbus_probe.h +++ b/drivers/xen/xenbus/xenbus_probe.h | |||
@@ -47,6 +47,13 @@ struct xen_bus_type { | |||
47 | struct bus_type bus; | 47 | struct bus_type bus; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | enum xenstore_init { | ||
51 | XS_UNKNOWN, | ||
52 | XS_PV, | ||
53 | XS_HVM, | ||
54 | XS_LOCAL, | ||
55 | }; | ||
56 | |||
50 | extern struct device_attribute xenbus_dev_attrs[]; | 57 | extern struct device_attribute xenbus_dev_attrs[]; |
51 | 58 | ||
52 | extern int xenbus_match(struct device *_dev, struct device_driver *_drv); | 59 | extern int xenbus_match(struct device *_dev, struct device_driver *_drv); |
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 3159a37d966d..a7e25073de19 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include "xenbus_probe.h" | 29 | #include "xenbus_probe.h" |
30 | 30 | ||
31 | 31 | ||
32 | static struct workqueue_struct *xenbus_frontend_wq; | ||
33 | |||
32 | /* device/<type>/<id> => <type>-<id> */ | 34 | /* device/<type>/<id> => <type>-<id> */ |
33 | static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) | 35 | static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) |
34 | { | 36 | { |
@@ -89,9 +91,40 @@ static void backend_changed(struct xenbus_watch *watch, | |||
89 | xenbus_otherend_changed(watch, vec, len, 1); | 91 | xenbus_otherend_changed(watch, vec, len, 1); |
90 | } | 92 | } |
91 | 93 | ||
94 | static void xenbus_frontend_delayed_resume(struct work_struct *w) | ||
95 | { | ||
96 | struct xenbus_device *xdev = container_of(w, struct xenbus_device, work); | ||
97 | |||
98 | xenbus_dev_resume(&xdev->dev); | ||
99 | } | ||
100 | |||
101 | static int xenbus_frontend_dev_resume(struct device *dev) | ||
102 | { | ||
103 | /* | ||
104 | * If xenstored is running in this domain, we cannot access the backend | ||
105 | * state at the moment, so we need to defer xenbus_dev_resume | ||
106 | */ | ||
107 | if (xen_store_domain_type == XS_LOCAL) { | ||
108 | struct xenbus_device *xdev = to_xenbus_device(dev); | ||
109 | |||
110 | if (!xenbus_frontend_wq) { | ||
111 | pr_err("%s: no workqueue to process delayed resume\n", | ||
112 | xdev->nodename); | ||
113 | return -EFAULT; | ||
114 | } | ||
115 | |||
116 | INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); | ||
117 | queue_work(xenbus_frontend_wq, &xdev->work); | ||
118 | |||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | return xenbus_dev_resume(dev); | ||
123 | } | ||
124 | |||
92 | static const struct dev_pm_ops xenbus_pm_ops = { | 125 | static const struct dev_pm_ops xenbus_pm_ops = { |
93 | .suspend = xenbus_dev_suspend, | 126 | .suspend = xenbus_dev_suspend, |
94 | .resume = xenbus_dev_resume, | 127 | .resume = xenbus_frontend_dev_resume, |
95 | .freeze = xenbus_dev_suspend, | 128 | .freeze = xenbus_dev_suspend, |
96 | .thaw = xenbus_dev_cancel, | 129 | .thaw = xenbus_dev_cancel, |
97 | .restore = xenbus_dev_resume, | 130 | .restore = xenbus_dev_resume, |
@@ -440,6 +473,8 @@ static int __init xenbus_probe_frontend_init(void) | |||
440 | 473 | ||
441 | register_xenstore_notifier(&xenstore_notifier); | 474 | register_xenstore_notifier(&xenstore_notifier); |
442 | 475 | ||
476 | xenbus_frontend_wq = create_workqueue("xenbus_frontend"); | ||
477 | |||
443 | return 0; | 478 | return 0; |
444 | } | 479 | } |
445 | subsys_initcall(xenbus_probe_frontend_init); | 480 | subsys_initcall(xenbus_probe_frontend_init); |