diff options
author | Tony Lindgren <tony@atomide.com> | 2013-05-30 15:53:07 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2013-05-30 16:09:31 -0400 |
commit | 82c5cde1c4b01a62c9a19c9118b4b434c333ce86 (patch) | |
tree | 5383349968d0092bda5ea1e0e7c75abf3fcad200 | |
parent | 608d19380c67d3a68ef53568a8ea4f82fefa618e (diff) |
ARM: OMAP2+: Remove omap4 ocp2scp pdata
This is omap4+ only and no longer needed as omap4+ can be booted
using device tree.
Also remove the related pdata handling from the driver and the
now unneeded platform_data/omap_ocp2scp.h.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Olof Johansson <olof@lixom.net>
Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap2/devices.c | 78 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 21 | ||||
-rw-r--r-- | drivers/bus/omap-ocp2scp.c | 60 | ||||
-rw-r--r-- | include/linux/platform_data/omap_ocp2scp.h | 31 |
4 files changed, 0 insertions, 190 deletions
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 350116906f18..721da484d8ec 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/of.h> | 20 | #include <linux/of.h> |
21 | #include <linux/pinctrl/machine.h> | 21 | #include <linux/pinctrl/machine.h> |
22 | #include <linux/platform_data/omap4-keypad.h> | 22 | #include <linux/platform_data/omap4-keypad.h> |
23 | #include <linux/platform_data/omap_ocp2scp.h> | ||
24 | #include <linux/wl12xx.h> | 23 | #include <linux/wl12xx.h> |
25 | 24 | ||
26 | #include <asm/mach-types.h> | 25 | #include <asm/mach-types.h> |
@@ -515,82 +514,6 @@ static void omap_init_vout(void) | |||
515 | static inline void omap_init_vout(void) {} | 514 | static inline void omap_init_vout(void) {} |
516 | #endif | 515 | #endif |
517 | 516 | ||
518 | #if defined(CONFIG_OMAP_OCP2SCP) || defined(CONFIG_OMAP_OCP2SCP_MODULE) | ||
519 | static int count_ocp2scp_devices(struct omap_ocp2scp_dev *ocp2scp_dev) | ||
520 | { | ||
521 | int cnt = 0; | ||
522 | |||
523 | while (ocp2scp_dev->drv_name != NULL) { | ||
524 | cnt++; | ||
525 | ocp2scp_dev++; | ||
526 | } | ||
527 | |||
528 | return cnt; | ||
529 | } | ||
530 | |||
531 | static void __init omap_init_ocp2scp(void) | ||
532 | { | ||
533 | struct omap_hwmod *oh; | ||
534 | struct platform_device *pdev; | ||
535 | int bus_id = -1, dev_cnt = 0, i; | ||
536 | struct omap_ocp2scp_dev *ocp2scp_dev; | ||
537 | const char *oh_name, *name; | ||
538 | struct omap_ocp2scp_platform_data *pdata; | ||
539 | |||
540 | if (!cpu_is_omap44xx()) | ||
541 | return; | ||
542 | |||
543 | oh_name = "ocp2scp_usb_phy"; | ||
544 | name = "omap-ocp2scp"; | ||
545 | |||
546 | oh = omap_hwmod_lookup(oh_name); | ||
547 | if (!oh) { | ||
548 | pr_err("%s: could not find omap_hwmod for %s\n", __func__, | ||
549 | oh_name); | ||
550 | return; | ||
551 | } | ||
552 | |||
553 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); | ||
554 | if (!pdata) { | ||
555 | pr_err("%s: No memory for ocp2scp pdata\n", __func__); | ||
556 | return; | ||
557 | } | ||
558 | |||
559 | ocp2scp_dev = oh->dev_attr; | ||
560 | dev_cnt = count_ocp2scp_devices(ocp2scp_dev); | ||
561 | |||
562 | if (!dev_cnt) { | ||
563 | pr_err("%s: No devices connected to ocp2scp\n", __func__); | ||
564 | kfree(pdata); | ||
565 | return; | ||
566 | } | ||
567 | |||
568 | pdata->devices = kzalloc(sizeof(struct omap_ocp2scp_dev *) | ||
569 | * dev_cnt, GFP_KERNEL); | ||
570 | if (!pdata->devices) { | ||
571 | pr_err("%s: No memory for ocp2scp pdata devices\n", __func__); | ||
572 | kfree(pdata); | ||
573 | return; | ||
574 | } | ||
575 | |||
576 | for (i = 0; i < dev_cnt; i++, ocp2scp_dev++) | ||
577 | pdata->devices[i] = ocp2scp_dev; | ||
578 | |||
579 | pdata->dev_cnt = dev_cnt; | ||
580 | |||
581 | pdev = omap_device_build(name, bus_id, oh, pdata, sizeof(*pdata)); | ||
582 | if (IS_ERR(pdev)) { | ||
583 | pr_err("Could not build omap_device for %s %s\n", | ||
584 | name, oh_name); | ||
585 | kfree(pdata->devices); | ||
586 | kfree(pdata); | ||
587 | return; | ||
588 | } | ||
589 | } | ||
590 | #else | ||
591 | static inline void omap_init_ocp2scp(void) { } | ||
592 | #endif | ||
593 | |||
594 | #if IS_ENABLED(CONFIG_WL12XX) | 517 | #if IS_ENABLED(CONFIG_WL12XX) |
595 | 518 | ||
596 | static struct wl12xx_platform_data wl12xx __initdata; | 519 | static struct wl12xx_platform_data wl12xx __initdata; |
@@ -655,7 +578,6 @@ static int __init omap2_init_devices(void) | |||
655 | omap_init_sti(); | 578 | omap_init_sti(); |
656 | omap_init_rng(); | 579 | omap_init_rng(); |
657 | omap_init_vout(); | 580 | omap_init_vout(); |
658 | omap_init_ocp2scp(); | ||
659 | 581 | ||
660 | return 0; | 582 | return 0; |
661 | } | 583 | } |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 848b6dc67590..d6dd70728c61 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <linux/platform_data/gpio-omap.h> | 22 | #include <linux/platform_data/gpio-omap.h> |
23 | #include <linux/power/smartreflex.h> | 23 | #include <linux/power/smartreflex.h> |
24 | #include <linux/platform_data/omap_ocp2scp.h> | ||
25 | #include <linux/i2c-omap.h> | 24 | #include <linux/i2c-omap.h> |
26 | 25 | ||
27 | #include <linux/omap-dma.h> | 26 | #include <linux/omap-dma.h> |
@@ -2695,25 +2694,6 @@ static struct omap_hwmod_class omap44xx_ocp2scp_hwmod_class = { | |||
2695 | .sysc = &omap44xx_ocp2scp_sysc, | 2694 | .sysc = &omap44xx_ocp2scp_sysc, |
2696 | }; | 2695 | }; |
2697 | 2696 | ||
2698 | /* ocp2scp dev_attr */ | ||
2699 | static struct resource omap44xx_usb_phy_and_pll_addrs[] = { | ||
2700 | { | ||
2701 | .name = "usb_phy", | ||
2702 | .start = 0x4a0ad080, | ||
2703 | .end = 0x4a0ae000, | ||
2704 | .flags = IORESOURCE_MEM, | ||
2705 | }, | ||
2706 | { } | ||
2707 | }; | ||
2708 | |||
2709 | static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = { | ||
2710 | { | ||
2711 | .drv_name = "omap-usb2", | ||
2712 | .res = omap44xx_usb_phy_and_pll_addrs, | ||
2713 | }, | ||
2714 | { } | ||
2715 | }; | ||
2716 | |||
2717 | /* ocp2scp_usb_phy */ | 2697 | /* ocp2scp_usb_phy */ |
2718 | static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { | 2698 | static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { |
2719 | .name = "ocp2scp_usb_phy", | 2699 | .name = "ocp2scp_usb_phy", |
@@ -2737,7 +2717,6 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { | |||
2737 | .modulemode = MODULEMODE_HWCTRL, | 2717 | .modulemode = MODULEMODE_HWCTRL, |
2738 | }, | 2718 | }, |
2739 | }, | 2719 | }, |
2740 | .dev_attr = ocp2scp_dev_attr, | ||
2741 | }; | 2720 | }; |
2742 | 2721 | ||
2743 | /* | 2722 | /* |
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 | */ | ||
34 | static 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 | ||
46 | static int ocp2scp_remove_devices(struct device *dev, void *c) | 26 | static 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) | |||
55 | static int omap_ocp2scp_probe(struct platform_device *pdev) | 35 | static 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 | ||
110 | err1: | ||
111 | platform_device_put(pdev_child); | ||
112 | |||
113 | err0: | 53 | err0: |
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/include/linux/platform_data/omap_ocp2scp.h b/include/linux/platform_data/omap_ocp2scp.h deleted file mode 100644 index 5c6c3939355f..000000000000 --- a/include/linux/platform_data/omap_ocp2scp.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * omap_ocp2scp.h -- ocp2scp header file | ||
3 | * | ||
4 | * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * Author: Kishon Vijay Abraham I <kishon@ti.com> | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef __DRIVERS_OMAP_OCP2SCP_H | ||
20 | #define __DRIVERS_OMAP_OCP2SCP_H | ||
21 | |||
22 | struct omap_ocp2scp_dev { | ||
23 | const char *drv_name; | ||
24 | struct resource *res; | ||
25 | }; | ||
26 | |||
27 | struct omap_ocp2scp_platform_data { | ||
28 | int dev_cnt; | ||
29 | struct omap_ocp2scp_dev **devices; | ||
30 | }; | ||
31 | #endif /* __DRIVERS_OMAP_OCP2SCP_H */ | ||