Skip to content

Commit bd4ce2d

Browse files
committed
ARM: ux500: Convert power-domain code into a regular platform driver
To make the code more standalone and moveable, let's convert it into a platform driver. Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 444ffc8 commit bd4ce2d

File tree

3 files changed

+20
-27
lines changed

3 files changed

+20
-27
lines changed

arch/arm/mach-ux500/cpu-db8500.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include <asm/mach/map.h>
2727
#include <asm/mach/arch.h>
2828

29-
#include "pm_domains.h"
30-
3129
static int __init ux500_l2x0_unlock(void)
3230
{
3331
int i;
@@ -115,9 +113,6 @@ static const struct of_device_id u8500_local_bus_nodes[] = {
115113

116114
static void __init u8500_init_machine(void)
117115
{
118-
/* Initialize ux500 power domains */
119-
ux500_pm_domains_init();
120-
121116
of_platform_populate(NULL, u8500_local_bus_nodes,
122117
NULL, NULL);
123118
}

arch/arm/mach-ux500/pm_domains.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
*
77
* Implements PM domains using the generic PM domain for ux500.
88
*/
9+
#include <linux/device.h>
10+
#include <linux/kernel.h>
11+
#include <linux/platform_device.h>
912
#include <linux/printk.h>
1013
#include <linux/slab.h>
1114
#include <linux/err.h>
1215
#include <linux/of.h>
1316
#include <linux/pm_domain.h>
1417

1518
#include <dt-bindings/arm/ux500_pm_domains.h>
16-
#include "pm_domains.h"
1719

1820
static int pd_power_off(struct generic_pm_domain *domain)
1921
{
@@ -49,18 +51,17 @@ static struct generic_pm_domain *ux500_pm_domains[NR_DOMAINS] = {
4951
[DOMAIN_VAPE] = &ux500_pm_domain_vape,
5052
};
5153

52-
static const struct of_device_id ux500_pm_domain_matches[] __initconst = {
54+
static const struct of_device_id ux500_pm_domain_matches[] = {
5355
{ .compatible = "stericsson,ux500-pm-domains", },
5456
{ },
5557
};
5658

57-
int __init ux500_pm_domains_init(void)
59+
static int ux500_pm_domains_probe(struct platform_device *pdev)
5860
{
59-
struct device_node *np;
61+
struct device_node *np = pdev->dev.of_node;
6062
struct genpd_onecell_data *genpd_data;
6163
int i;
6264

63-
np = of_find_matching_node(NULL, ux500_pm_domain_matches);
6465
if (!np)
6566
return -ENODEV;
6667

@@ -77,3 +78,17 @@ int __init ux500_pm_domains_init(void)
7778
of_genpd_add_provider_onecell(np, genpd_data);
7879
return 0;
7980
}
81+
82+
static struct platform_driver ux500_pm_domains_driver = {
83+
.probe = ux500_pm_domains_probe,
84+
.driver = {
85+
.name = "ux500_pm_domains",
86+
.of_match_table = ux500_pm_domain_matches,
87+
},
88+
};
89+
90+
static int __init ux500_pm_domains_init(void)
91+
{
92+
return platform_driver_register(&ux500_pm_domains_driver);
93+
}
94+
arch_initcall(ux500_pm_domains_init);

arch/arm/mach-ux500/pm_domains.h

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)