diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2008-01-25 00:25:31 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2008-01-26 17:26:01 -0500 |
commit | 66ffbe490b6156898364b3f20a571a78f8d77bc8 (patch) | |
tree | b750ed935f43464d03d9d350e68c1aedc4fea0ee /arch/powerpc/platforms/52xx | |
parent | 82e30140fff8b49bc4459aecad68e5eae824d223 (diff) |
[POWERPC] mpc5200: normalize compatible property bindings
Update MPC5200 drivers to also look for compatible properties in the
form "fsl,mpc5200-*" to better conform to open firmware generic names
recommended practice as published here:
http://www.openfirmware.org/1275/practice/gnames/gnamv14a.html
This patch should *not* break compatibility with older device trees
which do not use the 'fsl,' prefix. The drivers will still bind against
the older names also.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'arch/powerpc/platforms/52xx')
-rw-r--r-- | arch/powerpc/platforms/52xx/lite5200.c | 18 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/lite5200_pm.c | 9 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/mpc52xx_common.c | 60 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/mpc52xx_pci.c | 10 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/mpc52xx_pic.c | 16 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/mpc52xx_pm.c | 9 |
6 files changed, 87 insertions, 35 deletions
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c index 5a8d190f53e4..fb35b285a146 100644 --- a/arch/powerpc/platforms/52xx/lite5200.c +++ b/arch/powerpc/platforms/52xx/lite5200.c | |||
@@ -32,6 +32,19 @@ | |||
32 | * | 32 | * |
33 | */ | 33 | */ |
34 | 34 | ||
35 | /* mpc5200 device tree match tables */ | ||
36 | static struct of_device_id mpc5200_cdm_ids[] __initdata = { | ||
37 | { .compatible = "fsl,mpc5200-cdm", }, | ||
38 | { .compatible = "mpc5200-cdm", }, | ||
39 | {} | ||
40 | }; | ||
41 | |||
42 | static struct of_device_id mpc5200_gpio_ids[] __initdata = { | ||
43 | { .compatible = "fsl,mpc5200-gpio", }, | ||
44 | { .compatible = "mpc5200-gpio", }, | ||
45 | {} | ||
46 | }; | ||
47 | |||
35 | /* | 48 | /* |
36 | * Fix clock configuration. | 49 | * Fix clock configuration. |
37 | * | 50 | * |
@@ -44,9 +57,8 @@ lite5200_fix_clock_config(void) | |||
44 | { | 57 | { |
45 | struct device_node *np; | 58 | struct device_node *np; |
46 | struct mpc52xx_cdm __iomem *cdm; | 59 | struct mpc52xx_cdm __iomem *cdm; |
47 | |||
48 | /* Map zones */ | 60 | /* Map zones */ |
49 | np = of_find_compatible_node(NULL, NULL, "mpc5200-cdm"); | 61 | np = of_find_matching_node(NULL, mpc5200_cdm_ids); |
50 | cdm = of_iomap(np, 0); | 62 | cdm = of_iomap(np, 0); |
51 | of_node_put(np); | 63 | of_node_put(np); |
52 | if (!cdm) { | 64 | if (!cdm) { |
@@ -81,7 +93,7 @@ lite5200_fix_port_config(void) | |||
81 | struct mpc52xx_gpio __iomem *gpio; | 93 | struct mpc52xx_gpio __iomem *gpio; |
82 | u32 port_config; | 94 | u32 port_config; |
83 | 95 | ||
84 | np = of_find_compatible_node(NULL, NULL, "mpc5200-gpio"); | 96 | np = of_find_matching_node(NULL, mpc5200_gpio_ids); |
85 | gpio = of_iomap(np, 0); | 97 | gpio = of_iomap(np, 0); |
86 | of_node_put(np); | 98 | of_node_put(np); |
87 | if (!gpio) { | 99 | if (!gpio) { |
diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c b/arch/powerpc/platforms/52xx/lite5200_pm.c index c3ada1e340d2..c0f13e8deb0b 100644 --- a/arch/powerpc/platforms/52xx/lite5200_pm.c +++ b/arch/powerpc/platforms/52xx/lite5200_pm.c | |||
@@ -43,6 +43,13 @@ static int lite5200_pm_set_target(suspend_state_t state) | |||
43 | static int lite5200_pm_prepare(void) | 43 | static int lite5200_pm_prepare(void) |
44 | { | 44 | { |
45 | struct device_node *np; | 45 | struct device_node *np; |
46 | const struct of_device_id immr_ids[] = { | ||
47 | { .compatible = "fsl,mpc5200-immr", }, | ||
48 | { .compatible = "fsl,mpc5200b-immr", }, | ||
49 | { .type = "soc", .compatible = "mpc5200", }, /* lite5200 */ | ||
50 | { .type = "builtin", .compatible = "mpc5200", }, /* efika */ | ||
51 | {} | ||
52 | }; | ||
46 | 53 | ||
47 | /* deep sleep? let mpc52xx code handle that */ | 54 | /* deep sleep? let mpc52xx code handle that */ |
48 | if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) | 55 | if (lite5200_pm_target_state == PM_SUSPEND_STANDBY) |
@@ -52,7 +59,7 @@ static int lite5200_pm_prepare(void) | |||
52 | return -EINVAL; | 59 | return -EINVAL; |
53 | 60 | ||
54 | /* map registers */ | 61 | /* map registers */ |
55 | np = of_find_compatible_node(NULL, NULL, "mpc5200"); | 62 | np = of_find_matching_node(NULL, immr_ids); |
56 | mbar = of_iomap(np, 0); | 63 | mbar = of_iomap(np, 0); |
57 | of_node_put(np); | 64 | of_node_put(np); |
58 | if (!mbar) { | 65 | if (!mbar) { |
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c index 66955937be2a..744eb3a34ec9 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_common.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c | |||
@@ -18,6 +18,23 @@ | |||
18 | #include <asm/prom.h> | 18 | #include <asm/prom.h> |
19 | #include <asm/mpc52xx.h> | 19 | #include <asm/mpc52xx.h> |
20 | 20 | ||
21 | /* MPC5200 device tree match tables */ | ||
22 | static struct of_device_id mpc52xx_xlb_ids[] __initdata = { | ||
23 | { .compatible = "fsl,mpc5200-xlb", }, | ||
24 | { .compatible = "mpc5200-xlb", }, | ||
25 | {} | ||
26 | }; | ||
27 | static struct of_device_id mpc52xx_bus_ids[] __initdata = { | ||
28 | { .compatible = "fsl,mpc5200-immr", }, | ||
29 | { .compatible = "fsl,mpc5200b-immr", }, | ||
30 | { .compatible = "fsl,lpb", }, | ||
31 | |||
32 | /* depreciated matches; shouldn't be used in new device trees */ | ||
33 | { .type = "builtin", .compatible = "mpc5200", }, /* efika */ | ||
34 | { .type = "soc", .compatible = "mpc5200", }, /* lite5200 */ | ||
35 | {} | ||
36 | }; | ||
37 | |||
21 | /* | 38 | /* |
22 | * This variable is mapped in mpc52xx_map_wdt() and used in mpc52xx_restart(). | 39 | * This variable is mapped in mpc52xx_map_wdt() and used in mpc52xx_restart(). |
23 | * Permanent mapping is required because mpc52xx_restart() can be called | 40 | * Permanent mapping is required because mpc52xx_restart() can be called |
@@ -65,7 +82,7 @@ mpc5200_setup_xlb_arbiter(void) | |||
65 | struct device_node *np; | 82 | struct device_node *np; |
66 | struct mpc52xx_xlb __iomem *xlb; | 83 | struct mpc52xx_xlb __iomem *xlb; |
67 | 84 | ||
68 | np = of_find_compatible_node(NULL, NULL, "mpc5200-xlb"); | 85 | np = of_find_matching_node(NULL, mpc52xx_xlb_ids); |
69 | xlb = of_iomap(np, 0); | 86 | xlb = of_iomap(np, 0); |
70 | of_node_put(np); | 87 | of_node_put(np); |
71 | if (!xlb) { | 88 | if (!xlb) { |
@@ -88,16 +105,11 @@ mpc5200_setup_xlb_arbiter(void) | |||
88 | iounmap(xlb); | 105 | iounmap(xlb); |
89 | } | 106 | } |
90 | 107 | ||
91 | static struct of_device_id mpc52xx_bus_ids[] __initdata= { | 108 | /** |
92 | { .compatible = "fsl,mpc5200-immr", }, | 109 | * mpc52xx_declare_of_platform_devices: register internal devices and children |
93 | { .compatible = "fsl,lpb", }, | 110 | * of the localplus bus to the of_platform |
94 | 111 | * bus. | |
95 | /* depreciated matches; shouldn't be used in new device trees */ | 112 | */ |
96 | { .type = "builtin", .compatible = "mpc5200", }, /* efika */ | ||
97 | { .type = "soc", .compatible = "mpc5200", }, /* lite5200 */ | ||
98 | {}, | ||
99 | }; | ||
100 | |||
101 | void __init | 113 | void __init |
102 | mpc52xx_declare_of_platform_devices(void) | 114 | mpc52xx_declare_of_platform_devices(void) |
103 | { | 115 | { |
@@ -107,33 +119,31 @@ mpc52xx_declare_of_platform_devices(void) | |||
107 | "Error while probing of_platform bus\n"); | 119 | "Error while probing of_platform bus\n"); |
108 | } | 120 | } |
109 | 121 | ||
122 | /* | ||
123 | * match tables used by mpc52xx_map_wdt() | ||
124 | */ | ||
125 | static struct of_device_id mpc52xx_gpt_ids[] __initdata = { | ||
126 | { .compatible = "fsl,mpc5200-gpt", }, | ||
127 | { .compatible = "mpc5200-gpt", }, /* old */ | ||
128 | {} | ||
129 | }; | ||
130 | |||
110 | void __init | 131 | void __init |
111 | mpc52xx_map_wdt(void) | 132 | mpc52xx_map_wdt(void) |
112 | { | 133 | { |
113 | const void *has_wdt; | ||
114 | struct device_node *np; | 134 | struct device_node *np; |
115 | |||
116 | /* mpc52xx_wdt is mapped here and used in mpc52xx_restart, | 135 | /* mpc52xx_wdt is mapped here and used in mpc52xx_restart, |
117 | * possibly from a interrupt context. wdt is only implement | 136 | * possibly from a interrupt context. wdt is only implement |
118 | * on a gpt0, so check has-wdt property before mapping. | 137 | * on a gpt0, so check has-wdt property before mapping. |
119 | */ | 138 | */ |
120 | for_each_compatible_node(np, NULL, "fsl,mpc5200-gpt") { | 139 | for_each_matching_node(np, mpc52xx_gpt_ids) { |
121 | has_wdt = of_get_property(np, "fsl,has-wdt", NULL); | 140 | if (of_get_property(np, "fsl,has-wdt", NULL) || |
122 | if (has_wdt) { | 141 | of_get_property(np, "has-wdt", NULL)) { |
123 | mpc52xx_wdt = of_iomap(np, 0); | 142 | mpc52xx_wdt = of_iomap(np, 0); |
124 | of_node_put(np); | 143 | of_node_put(np); |
125 | return; | 144 | return; |
126 | } | 145 | } |
127 | } | 146 | } |
128 | for_each_compatible_node(np, NULL, "mpc5200-gpt") { | ||
129 | has_wdt = of_get_property(np, "has-wdt", NULL); | ||
130 | if (has_wdt) { | ||
131 | mpc52xx_wdt = of_iomap(np, 0); | ||
132 | of_node_put(np); | ||
133 | return; | ||
134 | } | ||
135 | |||
136 | } | ||
137 | } | 147 | } |
138 | 148 | ||
139 | void | 149 | void |
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c index 4b79398b2e40..e3428ddd9040 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c | |||
@@ -99,6 +99,12 @@ struct mpc52xx_pci { | |||
99 | u8 reserved6[4]; /* PCI + 0xFC */ | 99 | u8 reserved6[4]; /* PCI + 0xFC */ |
100 | }; | 100 | }; |
101 | 101 | ||
102 | /* MPC5200 device tree match tables */ | ||
103 | const struct of_device_id mpc52xx_pci_ids[] __initdata = { | ||
104 | { .type = "pci", .compatible = "fsl,mpc5200-pci", }, | ||
105 | { .type = "pci", .compatible = "mpc5200-pci", }, | ||
106 | {} | ||
107 | }; | ||
102 | 108 | ||
103 | /* ======================================================================== */ | 109 | /* ======================================================================== */ |
104 | /* PCI configuration acess */ | 110 | /* PCI configuration acess */ |
@@ -411,9 +417,7 @@ void __init mpc52xx_setup_pci(void) | |||
411 | { | 417 | { |
412 | struct device_node *pci; | 418 | struct device_node *pci; |
413 | 419 | ||
414 | pci = of_find_compatible_node(NULL, NULL, "fsl,mpc5200-pci"); | 420 | pci = of_find_matching_node(NULL, mpc52xx_pci_ids); |
415 | if (!pci) | ||
416 | pci = of_find_compatible_node(NULL, NULL, "mpc5200-pci"); | ||
417 | if (!pci) | 421 | if (!pci) |
418 | return; | 422 | return; |
419 | 423 | ||
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c index 07e89876d582..d0dead8b9a95 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c | |||
@@ -29,6 +29,18 @@ | |||
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | 31 | ||
32 | /* MPC5200 device tree match tables */ | ||
33 | static struct of_device_id mpc52xx_pic_ids[] __initdata = { | ||
34 | { .compatible = "fsl,mpc5200-pic", }, | ||
35 | { .compatible = "mpc5200-pic", }, | ||
36 | {} | ||
37 | }; | ||
38 | static struct of_device_id mpc52xx_sdma_ids[] __initdata = { | ||
39 | { .compatible = "fsl,mpc5200-bestcomm", }, | ||
40 | { .compatible = "mpc5200-bestcomm", }, | ||
41 | {} | ||
42 | }; | ||
43 | |||
32 | static struct mpc52xx_intr __iomem *intr; | 44 | static struct mpc52xx_intr __iomem *intr; |
33 | static struct mpc52xx_sdma __iomem *sdma; | 45 | static struct mpc52xx_sdma __iomem *sdma; |
34 | static struct irq_host *mpc52xx_irqhost = NULL; | 46 | static struct irq_host *mpc52xx_irqhost = NULL; |
@@ -367,13 +379,13 @@ void __init mpc52xx_init_irq(void) | |||
367 | struct device_node *np; | 379 | struct device_node *np; |
368 | 380 | ||
369 | /* Remap the necessary zones */ | 381 | /* Remap the necessary zones */ |
370 | picnode = of_find_compatible_node(NULL, NULL, "mpc5200-pic"); | 382 | picnode = of_find_matching_node(NULL, mpc52xx_pic_ids); |
371 | intr = of_iomap(picnode, 0); | 383 | intr = of_iomap(picnode, 0); |
372 | if (!intr) | 384 | if (!intr) |
373 | panic(__FILE__ ": find_and_map failed on 'mpc5200-pic'. " | 385 | panic(__FILE__ ": find_and_map failed on 'mpc5200-pic'. " |
374 | "Check node !"); | 386 | "Check node !"); |
375 | 387 | ||
376 | np = of_find_compatible_node(NULL, NULL, "mpc5200-bestcomm"); | 388 | np = of_find_matching_node(NULL, mpc52xx_sdma_ids); |
377 | sdma = of_iomap(np, 0); | 389 | sdma = of_iomap(np, 0); |
378 | of_node_put(np); | 390 | of_node_put(np); |
379 | if (!sdma) | 391 | if (!sdma) |
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pm.c b/arch/powerpc/platforms/52xx/mpc52xx_pm.c index 52f027789c8f..c72d3304387f 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pm.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pm.c | |||
@@ -60,9 +60,16 @@ int mpc52xx_set_wakeup_gpio(u8 pin, u8 level) | |||
60 | int mpc52xx_pm_prepare(void) | 60 | int mpc52xx_pm_prepare(void) |
61 | { | 61 | { |
62 | struct device_node *np; | 62 | struct device_node *np; |
63 | const struct of_device_id immr_ids[] = { | ||
64 | { .compatible = "fsl,mpc5200-immr", }, | ||
65 | { .compatible = "fsl,mpc5200b-immr", }, | ||
66 | { .type = "soc", .compatible = "mpc5200", }, /* lite5200 */ | ||
67 | { .type = "builtin", .compatible = "mpc5200", }, /* efika */ | ||
68 | {} | ||
69 | }; | ||
63 | 70 | ||
64 | /* map the whole register space */ | 71 | /* map the whole register space */ |
65 | np = of_find_compatible_node(NULL, NULL, "mpc5200"); | 72 | np = of_find_matching_node(NULL, immr_ids); |
66 | mbar = of_iomap(np, 0); | 73 | mbar = of_iomap(np, 0); |
67 | of_node_put(np); | 74 | of_node_put(np); |
68 | if (!mbar) { | 75 | if (!mbar) { |