aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-02 16:25:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-02 16:25:35 -0400
commitd2033f2c1d1de2239ded15e478ddb4028f192a15 (patch)
treed60e4f447134ca008ef212c04f0e75256681ed04 /drivers
parent22237d5a588cfad92525d2998ff14d3666399dce (diff)
parent0ee8090c1d059eca4d60e8e473bee91fb5d1996b (diff)
Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups from Arnd Bergmann: "This contains cleanups as preparation for other branches adding new features, we pulled 16 branches for 9 platforms into this one. Most notable here is the removal of support for ATAGS based OMAP4 systems. Since all OMAP4 machines are fully functional with DT based booting in 3.10, we can remove a lot of code here. Also noteworthy is Maxime Ripard's cleanup of the machine descriptors, which means we need no machine descriptors in a lot more cases and can boot additional machines by just having the respective device drivers enabled." * tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (76 commits) ARM: picoxcell: remove .nr_irqs reference ARM: s5p64x0: avoid build warning for uncompress.h ARM: SAMSUNG: Remove unused plat/regs-watchdog.h header ARM: SAMSUNG: Remove legacy watchdog reset code ARM: SAMSUNG: Let platforms use the new watchdog reset driver ARM: SAMSUNG: Add watchdog reset driver ARM: SAMSUNG: Use local definitions of watchdog registers watchdog: s3c2410_wdt: Use local register definitions ARM: S5P64X0: Use common uncompress.h part for plat-samsung ARM: SAMSUNG: Consolidate uncompress subroutine ARM: at91: drop rm9200dk board support ARM: dts: msm: Fix merge resolution ARM: OMAP1: Remove dma.h ARM: OMAP1: Remove legacy irda.h and irda setup from board files ARM: OMAP1: Remove duplicated DMA channel definitions ARM: OMAP1: Remove McBSP DMA channel definitions ARM: OMAP2+: Remove dma.h ARM: OMAP2+: hwmod: Remove remaining DMA channel definitions ARM: OMAP2+: Remove duplicated DMA channel definitions ARM: OMAP2+: Remove AES crypto device DMA channel definitions ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bus/mvebu-mbus.c8
-rw-r--r--drivers/bus/omap-ocp2scp.c60
-rw-r--r--drivers/gpio/Kconfig2
-rw-r--r--drivers/gpio/gpio-msm-v2.c195
-rw-r--r--drivers/of/address.c67
-rw-r--r--drivers/of/of_pci.c59
-rw-r--r--drivers/ssbi/ssbi.c69
-rw-r--r--drivers/watchdog/s3c2410_wdt.c17
8 files changed, 266 insertions, 211 deletions
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 8740f46b4d0d..33c6947eebec 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -49,6 +49,8 @@
49 * configuration (file 'devices'). 49 * configuration (file 'devices').
50 */ 50 */
51 51
52#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
53
52#include <linux/kernel.h> 54#include <linux/kernel.h>
53#include <linux/module.h> 55#include <linux/module.h>
54#include <linux/init.h> 56#include <linux/init.h>
@@ -762,7 +764,7 @@ int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base,
762 break; 764 break;
763 765
764 if (!s->soc->map[i].name) { 766 if (!s->soc->map[i].name) {
765 pr_err("mvebu-mbus: unknown device '%s'\n", devname); 767 pr_err("unknown device '%s'\n", devname);
766 return -ENODEV; 768 return -ENODEV;
767 } 769 }
768 770
@@ -775,7 +777,7 @@ int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base,
775 attr |= 0x28; 777 attr |= 0x28;
776 778
777 if (!mvebu_mbus_window_conflicts(s, base, size, target, attr)) { 779 if (!mvebu_mbus_window_conflicts(s, base, size, target, attr)) {
778 pr_err("mvebu-mbus: cannot add window '%s', conflicts with another window\n", 780 pr_err("cannot add window '%s', conflicts with another window\n",
779 devname); 781 devname);
780 return -EINVAL; 782 return -EINVAL;
781 } 783 }
@@ -842,7 +844,7 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base,
842 break; 844 break;
843 845
844 if (!of_id->compatible) { 846 if (!of_id->compatible) {
845 pr_err("mvebu-mbus: could not find a matching SoC family\n"); 847 pr_err("could not find a matching SoC family\n");
846 return -ENODEV; 848 return -ENODEV;
847 } 849 }
848 850
diff --git a/drivers/bus/omap-ocp2scp.c b/drivers/bus/omap-ocp2scp.c
index fe7191663bbd..5511f9814ddd 100644
--- a/drivers/bus/omap-ocp2scp.c
+++ b/drivers/bus/omap-ocp2scp.c
@@ -22,26 +22,6 @@
22#include <linux/pm_runtime.h> 22#include <linux/pm_runtime.h>
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/platform_data/omap_ocp2scp.h>
26
27/**
28 * _count_resources - count for the number of resources
29 * @res: struct resource *
30 *
31 * Count and return the number of resources populated for the device that is
32 * connected to ocp2scp.
33 */
34static unsigned _count_resources(struct resource *res)
35{
36 int cnt = 0;
37
38 while (res->start != res->end) {
39 cnt++;
40 res++;
41 }
42
43 return cnt;
44}
45 25
46static int ocp2scp_remove_devices(struct device *dev, void *c) 26static int ocp2scp_remove_devices(struct device *dev, void *c)
47{ 27{
@@ -55,11 +35,7 @@ static int ocp2scp_remove_devices(struct device *dev, void *c)
55static int omap_ocp2scp_probe(struct platform_device *pdev) 35static int omap_ocp2scp_probe(struct platform_device *pdev)
56{ 36{
57 int ret; 37 int ret;
58 unsigned res_cnt, i;
59 struct device_node *np = pdev->dev.of_node; 38 struct device_node *np = pdev->dev.of_node;
60 struct platform_device *pdev_child;
61 struct omap_ocp2scp_platform_data *pdata = pdev->dev.platform_data;
62 struct omap_ocp2scp_dev *dev;
63 39
64 if (np) { 40 if (np) {
65 ret = of_platform_populate(np, NULL, NULL, &pdev->dev); 41 ret = of_platform_populate(np, NULL, NULL, &pdev->dev);
@@ -68,48 +44,12 @@ static int omap_ocp2scp_probe(struct platform_device *pdev)
68 "failed to add resources for ocp2scp child\n"); 44 "failed to add resources for ocp2scp child\n");
69 goto err0; 45 goto err0;
70 } 46 }
71 } else if (pdata) {
72 for (i = 0, dev = *pdata->devices; i < pdata->dev_cnt; i++,
73 dev++) {
74 res_cnt = _count_resources(dev->res);
75
76 pdev_child = platform_device_alloc(dev->drv_name,
77 PLATFORM_DEVID_AUTO);
78 if (!pdev_child) {
79 dev_err(&pdev->dev,
80 "failed to allocate mem for ocp2scp child\n");
81 goto err0;
82 }
83
84 ret = platform_device_add_resources(pdev_child,
85 dev->res, res_cnt);
86 if (ret) {
87 dev_err(&pdev->dev,
88 "failed to add resources for ocp2scp child\n");
89 goto err1;
90 }
91
92 pdev_child->dev.parent = &pdev->dev;
93
94 ret = platform_device_add(pdev_child);
95 if (ret) {
96 dev_err(&pdev->dev,
97 "failed to register ocp2scp child device\n");
98 goto err1;
99 }
100 }
101 } else {
102 dev_err(&pdev->dev, "OCP2SCP initialized without plat data\n");
103 return -EINVAL;
104 } 47 }
105 48
106 pm_runtime_enable(&pdev->dev); 49 pm_runtime_enable(&pdev->dev);
107 50
108 return 0; 51 return 0;
109 52
110err1:
111 platform_device_put(pdev_child);
112
113err0: 53err0:
114 device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices); 54 device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices);
115 55
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 573c449c49b9..847a6dc15a54 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -165,7 +165,7 @@ config GPIO_MSM_V1
165 165
166config GPIO_MSM_V2 166config GPIO_MSM_V2
167 tristate "Qualcomm MSM GPIO v2" 167 tristate "Qualcomm MSM GPIO v2"
168 depends on GPIOLIB && ARCH_MSM 168 depends on GPIOLIB && OF && ARCH_MSM
169 help 169 help
170 Say yes here to support the GPIO interface on ARM v7 based 170 Say yes here to support the GPIO interface on ARM v7 based
171 Qualcomm MSM chips. Most of the pins on the MSM can be 171 Qualcomm MSM chips. Most of the pins on the MSM can be
diff --git a/drivers/gpio/gpio-msm-v2.c b/drivers/gpio/gpio-msm-v2.c
index dd2eddeb1e0c..f4491a497cc8 100644
--- a/drivers/gpio/gpio-msm-v2.c
+++ b/drivers/gpio/gpio-msm-v2.c
@@ -19,18 +19,21 @@
19 19
20#include <linux/bitmap.h> 20#include <linux/bitmap.h>
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/err.h>
22#include <linux/gpio.h> 23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/interrupt.h> 25#include <linux/interrupt.h>
25#include <linux/io.h> 26#include <linux/io.h>
26#include <linux/irqchip/chained_irq.h> 27#include <linux/irqchip/chained_irq.h>
27#include <linux/irq.h> 28#include <linux/irq.h>
29#include <linux/irqdomain.h>
28#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/of_address.h>
29#include <linux/platform_device.h> 32#include <linux/platform_device.h>
30#include <linux/spinlock.h> 33#include <linux/spinlock.h>
34#include <linux/slab.h>
31 35
32#include <mach/msm_gpiomux.h> 36#define MAX_NR_GPIO 300
33#include <mach/msm_iomap.h>
34 37
35/* Bits of interest in the GPIO_IN_OUT register. 38/* Bits of interest in the GPIO_IN_OUT register.
36 */ 39 */
@@ -77,13 +80,6 @@ enum {
77 TARGET_PROC_NONE = 7, 80 TARGET_PROC_NONE = 7,
78}; 81};
79 82
80
81#define GPIO_INTR_CFG_SU(gpio) (MSM_TLMM_BASE + 0x0400 + (0x04 * (gpio)))
82#define GPIO_CONFIG(gpio) (MSM_TLMM_BASE + 0x1000 + (0x10 * (gpio)))
83#define GPIO_IN_OUT(gpio) (MSM_TLMM_BASE + 0x1004 + (0x10 * (gpio)))
84#define GPIO_INTR_CFG(gpio) (MSM_TLMM_BASE + 0x1008 + (0x10 * (gpio)))
85#define GPIO_INTR_STATUS(gpio) (MSM_TLMM_BASE + 0x100c + (0x10 * (gpio)))
86
87/** 83/**
88 * struct msm_gpio_dev: the MSM8660 SoC GPIO device structure 84 * struct msm_gpio_dev: the MSM8660 SoC GPIO device structure
89 * 85 *
@@ -102,11 +98,27 @@ enum {
102 */ 98 */
103struct msm_gpio_dev { 99struct msm_gpio_dev {
104 struct gpio_chip gpio_chip; 100 struct gpio_chip gpio_chip;
105 DECLARE_BITMAP(enabled_irqs, NR_GPIO_IRQS); 101 DECLARE_BITMAP(enabled_irqs, MAX_NR_GPIO);
106 DECLARE_BITMAP(wake_irqs, NR_GPIO_IRQS); 102 DECLARE_BITMAP(wake_irqs, MAX_NR_GPIO);
107 DECLARE_BITMAP(dual_edge_irqs, NR_GPIO_IRQS); 103 DECLARE_BITMAP(dual_edge_irqs, MAX_NR_GPIO);
104 struct irq_domain *domain;
105 unsigned int summary_irq;
106 void __iomem *msm_tlmm_base;
108}; 107};
109 108
109struct msm_gpio_dev msm_gpio;
110
111#define GPIO_INTR_CFG_SU(gpio) (msm_gpio.msm_tlmm_base + 0x0400 + \
112 (0x04 * (gpio)))
113#define GPIO_CONFIG(gpio) (msm_gpio.msm_tlmm_base + 0x1000 + \
114 (0x10 * (gpio)))
115#define GPIO_IN_OUT(gpio) (msm_gpio.msm_tlmm_base + 0x1004 + \
116 (0x10 * (gpio)))
117#define GPIO_INTR_CFG(gpio) (msm_gpio.msm_tlmm_base + 0x1008 + \
118 (0x10 * (gpio)))
119#define GPIO_INTR_STATUS(gpio) (msm_gpio.msm_tlmm_base + 0x100c + \
120 (0x10 * (gpio)))
121
110static DEFINE_SPINLOCK(tlmm_lock); 122static DEFINE_SPINLOCK(tlmm_lock);
111 123
112static inline struct msm_gpio_dev *to_msm_gpio_dev(struct gpio_chip *chip) 124static inline struct msm_gpio_dev *to_msm_gpio_dev(struct gpio_chip *chip)
@@ -159,37 +171,29 @@ static int msm_gpio_direction_output(struct gpio_chip *chip,
159 171
160static int msm_gpio_request(struct gpio_chip *chip, unsigned offset) 172static int msm_gpio_request(struct gpio_chip *chip, unsigned offset)
161{ 173{
162 return msm_gpiomux_get(chip->base + offset); 174 return 0;
163} 175}
164 176
165static void msm_gpio_free(struct gpio_chip *chip, unsigned offset) 177static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
166{ 178{
167 msm_gpiomux_put(chip->base + offset); 179 return;
168} 180}
169 181
170static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 182static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
171{ 183{
172 return MSM_GPIO_TO_INT(chip->base + offset); 184 struct msm_gpio_dev *g_dev = to_msm_gpio_dev(chip);
185 struct irq_domain *domain = g_dev->domain;
186
187 return irq_create_mapping(domain, offset);
173} 188}
174 189
175static inline int msm_irq_to_gpio(struct gpio_chip *chip, unsigned irq) 190static inline int msm_irq_to_gpio(struct gpio_chip *chip, unsigned irq)
176{ 191{
177 return irq - MSM_GPIO_TO_INT(chip->base); 192 struct irq_data *irq_data = irq_get_irq_data(irq);
193
194 return irq_data->hwirq;
178} 195}
179 196
180static struct msm_gpio_dev msm_gpio = {
181 .gpio_chip = {
182 .base = 0,
183 .ngpio = NR_GPIO_IRQS,
184 .direction_input = msm_gpio_direction_input,
185 .direction_output = msm_gpio_direction_output,
186 .get = msm_gpio_get,
187 .set = msm_gpio_set,
188 .to_irq = msm_gpio_to_irq,
189 .request = msm_gpio_request,
190 .free = msm_gpio_free,
191 },
192};
193 197
194/* For dual-edge interrupts in software, since the hardware has no 198/* For dual-edge interrupts in software, since the hardware has no
195 * such support: 199 * such support:
@@ -227,9 +231,9 @@ static void msm_gpio_update_dual_edge_pos(unsigned gpio)
227 if (intstat || val == val2) 231 if (intstat || val == val2)
228 return; 232 return;
229 } while (loop_limit-- > 0); 233 } while (loop_limit-- > 0);
230 pr_err("dual-edge irq failed to stabilize, " 234 pr_err("%s: dual-edge irq failed to stabilize, "
231 "interrupts dropped. %#08x != %#08x\n", 235 "interrupts dropped. %#08x != %#08x\n",
232 val, val2); 236 __func__, val, val2);
233} 237}
234 238
235static void msm_gpio_irq_ack(struct irq_data *d) 239static void msm_gpio_irq_ack(struct irq_data *d)
@@ -316,10 +320,10 @@ static void msm_summary_irq_handler(unsigned int irq, struct irq_desc *desc)
316 320
317 chained_irq_enter(chip, desc); 321 chained_irq_enter(chip, desc);
318 322
319 for_each_set_bit(i, msm_gpio.enabled_irqs, NR_GPIO_IRQS) { 323 for_each_set_bit(i, msm_gpio.enabled_irqs, MAX_NR_GPIO) {
320 if (readl(GPIO_INTR_STATUS(i)) & BIT(INTR_STATUS)) 324 if (readl(GPIO_INTR_STATUS(i)) & BIT(INTR_STATUS))
321 generic_handle_irq(msm_gpio_to_irq(&msm_gpio.gpio_chip, 325 generic_handle_irq(irq_find_mapping(msm_gpio.domain,
322 i)); 326 i));
323 } 327 }
324 328
325 chained_irq_exit(chip, desc); 329 chained_irq_exit(chip, desc);
@@ -330,13 +334,13 @@ static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
330 int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq); 334 int gpio = msm_irq_to_gpio(&msm_gpio.gpio_chip, d->irq);
331 335
332 if (on) { 336 if (on) {
333 if (bitmap_empty(msm_gpio.wake_irqs, NR_GPIO_IRQS)) 337 if (bitmap_empty(msm_gpio.wake_irqs, MAX_NR_GPIO))
334 irq_set_irq_wake(TLMM_SCSS_SUMMARY_IRQ, 1); 338 irq_set_irq_wake(msm_gpio.summary_irq, 1);
335 set_bit(gpio, msm_gpio.wake_irqs); 339 set_bit(gpio, msm_gpio.wake_irqs);
336 } else { 340 } else {
337 clear_bit(gpio, msm_gpio.wake_irqs); 341 clear_bit(gpio, msm_gpio.wake_irqs);
338 if (bitmap_empty(msm_gpio.wake_irqs, NR_GPIO_IRQS)) 342 if (bitmap_empty(msm_gpio.wake_irqs, MAX_NR_GPIO))
339 irq_set_irq_wake(TLMM_SCSS_SUMMARY_IRQ, 0); 343 irq_set_irq_wake(msm_gpio.summary_irq, 0);
340 } 344 }
341 345
342 return 0; 346 return 0;
@@ -351,30 +355,86 @@ static struct irq_chip msm_gpio_irq_chip = {
351 .irq_set_wake = msm_gpio_irq_set_wake, 355 .irq_set_wake = msm_gpio_irq_set_wake,
352}; 356};
353 357
354static int msm_gpio_probe(struct platform_device *dev) 358static struct lock_class_key msm_gpio_lock_class;
359
360static int msm_gpio_irq_domain_map(struct irq_domain *d, unsigned int irq,
361 irq_hw_number_t hwirq)
355{ 362{
356 int i, irq, ret; 363 irq_set_lockdep_class(irq, &msm_gpio_lock_class);
364 irq_set_chip_and_handler(irq, &msm_gpio_irq_chip,
365 handle_level_irq);
366 set_irq_flags(irq, IRQF_VALID);
367
368 return 0;
369}
370
371static const struct irq_domain_ops msm_gpio_irq_domain_ops = {
372 .xlate = irq_domain_xlate_twocell,
373 .map = msm_gpio_irq_domain_map,
374};
375
376static int msm_gpio_probe(struct platform_device *pdev)
377{
378 int ret, ngpio;
379 struct resource *res;
380
381 if (!of_property_read_u32(pdev->dev.of_node, "ngpio", &ngpio)) {
382 dev_err(&pdev->dev, "%s: ngpio property missing\n", __func__);
383 return -EINVAL;
384 }
385
386 if (ngpio > MAX_NR_GPIO)
387 WARN(1, "ngpio exceeds the MAX_NR_GPIO. Increase MAX_NR_GPIO\n");
388
389 bitmap_zero(msm_gpio.enabled_irqs, MAX_NR_GPIO);
390 bitmap_zero(msm_gpio.wake_irqs, MAX_NR_GPIO);
391 bitmap_zero(msm_gpio.dual_edge_irqs, MAX_NR_GPIO);
392
393 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
394 msm_gpio.msm_tlmm_base = devm_ioremap_resource(&pdev->dev, res);
395 if (IS_ERR(msm_gpio.msm_tlmm_base))
396 return PTR_ERR(msm_gpio.msm_tlmm_base);
397
398 msm_gpio.gpio_chip.ngpio = ngpio;
399 msm_gpio.gpio_chip.label = pdev->name;
400 msm_gpio.gpio_chip.dev = &pdev->dev;
401 msm_gpio.gpio_chip.base = 0;
402 msm_gpio.gpio_chip.direction_input = msm_gpio_direction_input;
403 msm_gpio.gpio_chip.direction_output = msm_gpio_direction_output;
404 msm_gpio.gpio_chip.get = msm_gpio_get;
405 msm_gpio.gpio_chip.set = msm_gpio_set;
406 msm_gpio.gpio_chip.to_irq = msm_gpio_to_irq;
407 msm_gpio.gpio_chip.request = msm_gpio_request;
408 msm_gpio.gpio_chip.free = msm_gpio_free;
357 409
358 bitmap_zero(msm_gpio.enabled_irqs, NR_GPIO_IRQS);
359 bitmap_zero(msm_gpio.wake_irqs, NR_GPIO_IRQS);
360 bitmap_zero(msm_gpio.dual_edge_irqs, NR_GPIO_IRQS);
361 msm_gpio.gpio_chip.label = dev->name;
362 ret = gpiochip_add(&msm_gpio.gpio_chip); 410 ret = gpiochip_add(&msm_gpio.gpio_chip);
363 if (ret < 0) 411 if (ret < 0) {
412 dev_err(&pdev->dev, "gpiochip_add failed with error %d\n", ret);
364 return ret; 413 return ret;
414 }
365 415
366 for (i = 0; i < msm_gpio.gpio_chip.ngpio; ++i) { 416 msm_gpio.summary_irq = platform_get_irq(pdev, 0);
367 irq = msm_gpio_to_irq(&msm_gpio.gpio_chip, i); 417 if (msm_gpio.summary_irq < 0) {
368 irq_set_chip_and_handler(irq, &msm_gpio_irq_chip, 418 dev_err(&pdev->dev, "No Summary irq defined for msmgpio\n");
369 handle_level_irq); 419 return msm_gpio.summary_irq;
370 set_irq_flags(irq, IRQF_VALID);
371 } 420 }
372 421
373 irq_set_chained_handler(TLMM_SCSS_SUMMARY_IRQ, 422 msm_gpio.domain = irq_domain_add_linear(pdev->dev.of_node, ngpio,
374 msm_summary_irq_handler); 423 &msm_gpio_irq_domain_ops,
424 &msm_gpio);
425 if (!msm_gpio.domain)
426 return -ENODEV;
427
428 irq_set_chained_handler(msm_gpio.summary_irq, msm_summary_irq_handler);
429
375 return 0; 430 return 0;
376} 431}
377 432
433static struct of_device_id msm_gpio_of_match[] = {
434 { .compatible = "qcom,msm-gpio", },
435 { },
436};
437
378static int msm_gpio_remove(struct platform_device *dev) 438static int msm_gpio_remove(struct platform_device *dev)
379{ 439{
380 int ret = gpiochip_remove(&msm_gpio.gpio_chip); 440 int ret = gpiochip_remove(&msm_gpio.gpio_chip);
@@ -382,7 +442,7 @@ static int msm_gpio_remove(struct platform_device *dev)
382 if (ret < 0) 442 if (ret < 0)
383 return ret; 443 return ret;
384 444
385 irq_set_handler(TLMM_SCSS_SUMMARY_IRQ, NULL); 445 irq_set_handler(msm_gpio.summary_irq, NULL);
386 446
387 return 0; 447 return 0;
388} 448}
@@ -393,36 +453,11 @@ static struct platform_driver msm_gpio_driver = {
393 .driver = { 453 .driver = {
394 .name = "msmgpio", 454 .name = "msmgpio",
395 .owner = THIS_MODULE, 455 .owner = THIS_MODULE,
456 .of_match_table = msm_gpio_of_match,
396 }, 457 },
397}; 458};
398 459
399static struct platform_device msm_device_gpio = { 460module_platform_driver(msm_gpio_driver)
400 .name = "msmgpio",
401 .id = -1,
402};
403
404static int __init msm_gpio_init(void)
405{
406 int rc;
407
408 rc = platform_driver_register(&msm_gpio_driver);
409 if (!rc) {
410 rc = platform_device_register(&msm_device_gpio);
411 if (rc)
412 platform_driver_unregister(&msm_gpio_driver);
413 }
414
415 return rc;
416}
417
418static void __exit msm_gpio_exit(void)
419{
420 platform_device_unregister(&msm_device_gpio);
421 platform_driver_unregister(&msm_gpio_driver);
422}
423
424postcore_initcall(msm_gpio_init);
425module_exit(msm_gpio_exit);
426 461
427MODULE_AUTHOR("Gregory Bean <gbean@codeaurora.org>"); 462MODULE_AUTHOR("Gregory Bean <gbean@codeaurora.org>");
428MODULE_DESCRIPTION("Driver for Qualcomm MSM TLMMv2 SoC GPIOs"); 463MODULE_DESCRIPTION("Driver for Qualcomm MSM TLMMv2 SoC GPIOs");
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 04da786c84d2..fdd0636a987d 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -227,6 +227,73 @@ int of_pci_address_to_resource(struct device_node *dev, int bar,
227 return __of_address_to_resource(dev, addrp, size, flags, NULL, r); 227 return __of_address_to_resource(dev, addrp, size, flags, NULL, r);
228} 228}
229EXPORT_SYMBOL_GPL(of_pci_address_to_resource); 229EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
230
231int of_pci_range_parser_init(struct of_pci_range_parser *parser,
232 struct device_node *node)
233{
234 const int na = 3, ns = 2;
235 int rlen;
236
237 parser->node = node;
238 parser->pna = of_n_addr_cells(node);
239 parser->np = parser->pna + na + ns;
240
241 parser->range = of_get_property(node, "ranges", &rlen);
242 if (parser->range == NULL)
243 return -ENOENT;
244
245 parser->end = parser->range + rlen / sizeof(__be32);
246
247 return 0;
248}
249EXPORT_SYMBOL_GPL(of_pci_range_parser_init);
250
251struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
252 struct of_pci_range *range)
253{
254 const int na = 3, ns = 2;
255
256 if (!range)
257 return NULL;
258
259 if (!parser->range || parser->range + parser->np > parser->end)
260 return NULL;
261
262 range->pci_space = parser->range[0];
263 range->flags = of_bus_pci_get_flags(parser->range);
264 range->pci_addr = of_read_number(parser->range + 1, ns);
265 range->cpu_addr = of_translate_address(parser->node,
266 parser->range + na);
267 range->size = of_read_number(parser->range + parser->pna + na, ns);
268
269 parser->range += parser->np;
270
271 /* Now consume following elements while they are contiguous */
272 while (parser->range + parser->np <= parser->end) {
273 u32 flags, pci_space;
274 u64 pci_addr, cpu_addr, size;
275
276 pci_space = be32_to_cpup(parser->range);
277 flags = of_bus_pci_get_flags(parser->range);
278 pci_addr = of_read_number(parser->range + 1, ns);
279 cpu_addr = of_translate_address(parser->node,
280 parser->range + na);
281 size = of_read_number(parser->range + parser->pna + na, ns);
282
283 if (flags != range->flags)
284 break;
285 if (pci_addr != range->pci_addr + range->size ||
286 cpu_addr != range->cpu_addr + range->size)
287 break;
288
289 range->size += size;
290 parser->range += parser->np;
291 }
292
293 return range;
294}
295EXPORT_SYMBOL_GPL(of_pci_range_parser_one);
296
230#endif /* CONFIG_PCI */ 297#endif /* CONFIG_PCI */
231 298
232/* 299/*
diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c
index 13e37e2d8ec1..42c687a820ac 100644
--- a/drivers/of/of_pci.c
+++ b/drivers/of/of_pci.c
@@ -5,14 +5,15 @@
5#include <asm/prom.h> 5#include <asm/prom.h>
6 6
7static inline int __of_pci_pci_compare(struct device_node *node, 7static inline int __of_pci_pci_compare(struct device_node *node,
8 unsigned int devfn) 8 unsigned int data)
9{ 9{
10 unsigned int size; 10 int devfn;
11 const __be32 *reg = of_get_property(node, "reg", &size);
12 11
13 if (!reg || size < 5 * sizeof(__be32)) 12 devfn = of_pci_get_devfn(node);
13 if (devfn < 0)
14 return 0; 14 return 0;
15 return ((be32_to_cpup(&reg[0]) >> 8) & 0xff) == devfn; 15
16 return devfn == data;
16} 17}
17 18
18struct device_node *of_pci_find_child_device(struct device_node *parent, 19struct device_node *of_pci_find_child_device(struct device_node *parent,
@@ -40,3 +41,51 @@ struct device_node *of_pci_find_child_device(struct device_node *parent,
40 return NULL; 41 return NULL;
41} 42}
42EXPORT_SYMBOL_GPL(of_pci_find_child_device); 43EXPORT_SYMBOL_GPL(of_pci_find_child_device);
44
45/**
46 * of_pci_get_devfn() - Get device and function numbers for a device node
47 * @np: device node
48 *
49 * Parses a standard 5-cell PCI resource and returns an 8-bit value that can
50 * be passed to the PCI_SLOT() and PCI_FUNC() macros to extract the device
51 * and function numbers respectively. On error a negative error code is
52 * returned.
53 */
54int of_pci_get_devfn(struct device_node *np)
55{
56 unsigned int size;
57 const __be32 *reg;
58
59 reg = of_get_property(np, "reg", &size);
60
61 if (!reg || size < 5 * sizeof(__be32))
62 return -EINVAL;
63
64 return (be32_to_cpup(reg) >> 8) & 0xff;
65}
66EXPORT_SYMBOL_GPL(of_pci_get_devfn);
67
68/**
69 * of_pci_parse_bus_range() - parse the bus-range property of a PCI device
70 * @node: device node
71 * @res: address to a struct resource to return the bus-range
72 *
73 * Returns 0 on success or a negative error-code on failure.
74 */
75int of_pci_parse_bus_range(struct device_node *node, struct resource *res)
76{
77 const __be32 *values;
78 int len;
79
80 values = of_get_property(node, "bus-range", &len);
81 if (!values || len < sizeof(*values) * 2)
82 return -EINVAL;
83
84 res->name = node->name;
85 res->start = be32_to_cpup(values++);
86 res->end = be32_to_cpup(values);
87 res->flags = IORESOURCE_BUS;
88
89 return 0;
90}
91EXPORT_SYMBOL_GPL(of_pci_parse_bus_range);
diff --git a/drivers/ssbi/ssbi.c b/drivers/ssbi/ssbi.c
index e561d3be54a5..102a22844297 100644
--- a/drivers/ssbi/ssbi.c
+++ b/drivers/ssbi/ssbi.c
@@ -268,35 +268,23 @@ static int ssbi_probe(struct platform_device *pdev)
268 struct device_node *np = pdev->dev.of_node; 268 struct device_node *np = pdev->dev.of_node;
269 struct resource *mem_res; 269 struct resource *mem_res;
270 struct ssbi *ssbi; 270 struct ssbi *ssbi;
271 int ret = 0;
272 const char *type; 271 const char *type;
273 272
274 ssbi = kzalloc(sizeof(struct ssbi), GFP_KERNEL); 273 ssbi = devm_kzalloc(&pdev->dev, sizeof(*ssbi), GFP_KERNEL);
275 if (!ssbi) { 274 if (!ssbi)
276 pr_err("can not allocate ssbi_data\n");
277 return -ENOMEM; 275 return -ENOMEM;
278 }
279 276
280 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 277 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
281 if (!mem_res) { 278 ssbi->base = devm_ioremap_resource(&pdev->dev, mem_res);
282 pr_err("missing mem resource\n"); 279 if (IS_ERR(ssbi->base))
283 ret = -EINVAL; 280 return PTR_ERR(ssbi->base);
284 goto err_get_mem_res;
285 }
286 281
287 ssbi->base = ioremap(mem_res->start, resource_size(mem_res));
288 if (!ssbi->base) {
289 pr_err("ioremap of 0x%p failed\n", (void *)mem_res->start);
290 ret = -EINVAL;
291 goto err_ioremap;
292 }
293 platform_set_drvdata(pdev, ssbi); 282 platform_set_drvdata(pdev, ssbi);
294 283
295 type = of_get_property(np, "qcom,controller-type", NULL); 284 type = of_get_property(np, "qcom,controller-type", NULL);
296 if (type == NULL) { 285 if (type == NULL) {
297 pr_err("Missing qcom,controller-type property\n"); 286 dev_err(&pdev->dev, "Missing qcom,controller-type property\n");
298 ret = -EINVAL; 287 return -EINVAL;
299 goto err_ssbi_controller;
300 } 288 }
301 dev_info(&pdev->dev, "SSBI controller type: '%s'\n", type); 289 dev_info(&pdev->dev, "SSBI controller type: '%s'\n", type);
302 if (strcmp(type, "ssbi") == 0) 290 if (strcmp(type, "ssbi") == 0)
@@ -306,9 +294,8 @@ static int ssbi_probe(struct platform_device *pdev)
306 else if (strcmp(type, "pmic-arbiter") == 0) 294 else if (strcmp(type, "pmic-arbiter") == 0)
307 ssbi->controller_type = MSM_SBI_CTRL_PMIC_ARBITER; 295 ssbi->controller_type = MSM_SBI_CTRL_PMIC_ARBITER;
308 else { 296 else {
309 pr_err("Unknown qcom,controller-type\n"); 297 dev_err(&pdev->dev, "Unknown qcom,controller-type\n");
310 ret = -EINVAL; 298 return -EINVAL;
311 goto err_ssbi_controller;
312 } 299 }
313 300
314 if (ssbi->controller_type == MSM_SBI_CTRL_PMIC_ARBITER) { 301 if (ssbi->controller_type == MSM_SBI_CTRL_PMIC_ARBITER) {
@@ -321,29 +308,7 @@ static int ssbi_probe(struct platform_device *pdev)
321 308
322 spin_lock_init(&ssbi->lock); 309 spin_lock_init(&ssbi->lock);
323 310
324 ret = of_platform_populate(np, NULL, NULL, &pdev->dev); 311 return of_platform_populate(np, NULL, NULL, &pdev->dev);
325 if (ret)
326 goto err_ssbi_controller;
327
328 return 0;
329
330err_ssbi_controller:
331 platform_set_drvdata(pdev, NULL);
332 iounmap(ssbi->base);
333err_ioremap:
334err_get_mem_res:
335 kfree(ssbi);
336 return ret;
337}
338
339static int ssbi_remove(struct platform_device *pdev)
340{
341 struct ssbi *ssbi = platform_get_drvdata(pdev);
342
343 platform_set_drvdata(pdev, NULL);
344 iounmap(ssbi->base);
345 kfree(ssbi);
346 return 0;
347} 312}
348 313
349static struct of_device_id ssbi_match_table[] = { 314static struct of_device_id ssbi_match_table[] = {
@@ -354,25 +319,13 @@ MODULE_DEVICE_TABLE(of, ssbi_match_table);
354 319
355static struct platform_driver ssbi_driver = { 320static struct platform_driver ssbi_driver = {
356 .probe = ssbi_probe, 321 .probe = ssbi_probe,
357 .remove = ssbi_remove,
358 .driver = { 322 .driver = {
359 .name = "ssbi", 323 .name = "ssbi",
360 .owner = THIS_MODULE, 324 .owner = THIS_MODULE,
361 .of_match_table = ssbi_match_table, 325 .of_match_table = ssbi_match_table,
362 }, 326 },
363}; 327};
364 328module_platform_driver(ssbi_driver);
365static int __init ssbi_init(void)
366{
367 return platform_driver_register(&ssbi_driver);
368}
369module_init(ssbi_init);
370
371static void __exit ssbi_exit(void)
372{
373 platform_driver_unregister(&ssbi_driver);
374}
375module_exit(ssbi_exit)
376 329
377MODULE_LICENSE("GPL v2"); 330MODULE_LICENSE("GPL v2");
378MODULE_VERSION("1.0"); 331MODULE_VERSION("1.0");
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index ee03135f5abd..3a9f6961db2d 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -42,12 +42,21 @@
42#include <linux/err.h> 42#include <linux/err.h>
43#include <linux/of.h> 43#include <linux/of.h>
44 44
45#include <mach/map.h> 45#define S3C2410_WTCON 0x00
46#define S3C2410_WTDAT 0x04
47#define S3C2410_WTCNT 0x08
46 48
47#undef S3C_VA_WATCHDOG 49#define S3C2410_WTCON_RSTEN (1 << 0)
48#define S3C_VA_WATCHDOG (0) 50#define S3C2410_WTCON_INTEN (1 << 2)
51#define S3C2410_WTCON_ENABLE (1 << 5)
49 52
50#include <plat/regs-watchdog.h> 53#define S3C2410_WTCON_DIV16 (0 << 3)
54#define S3C2410_WTCON_DIV32 (1 << 3)
55#define S3C2410_WTCON_DIV64 (2 << 3)
56#define S3C2410_WTCON_DIV128 (3 << 3)
57
58#define S3C2410_WTCON_PRESCALE(x) ((x) << 8)
59#define S3C2410_WTCON_PRESCALE_MASK (0xff << 8)
51 60
52#define CONFIG_S3C2410_WATCHDOG_ATBOOT (0) 61#define CONFIG_S3C2410_WATCHDOG_ATBOOT (0)
53#define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15) 62#define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15)