diff options
Diffstat (limited to 'arch/powerpc/sysdev')
| -rw-r--r-- | arch/powerpc/sysdev/dart_iommu.c | 2 | ||||
| -rw-r--r-- | arch/powerpc/sysdev/dcr.S | 2 | ||||
| -rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 292 | ||||
| -rw-r--r-- | arch/powerpc/sysdev/ipic.h | 2 |
4 files changed, 234 insertions, 64 deletions
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 6298264efe36..61d317428610 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c | |||
| @@ -194,8 +194,6 @@ static int dart_init(struct device_node *dart_node) | |||
| 194 | * prefetching into invalid pages and corrupting data | 194 | * prefetching into invalid pages and corrupting data |
| 195 | */ | 195 | */ |
| 196 | tmp = lmb_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE); | 196 | tmp = lmb_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE); |
| 197 | if (!tmp) | ||
| 198 | panic("DART: Cannot allocate spare page!"); | ||
| 199 | dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) & | 197 | dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) & |
| 200 | DARTMAP_RPNMASK); | 198 | DARTMAP_RPNMASK); |
| 201 | 199 | ||
diff --git a/arch/powerpc/sysdev/dcr.S b/arch/powerpc/sysdev/dcr.S index 895f10243a43..2078f39e2f17 100644 --- a/arch/powerpc/sysdev/dcr.S +++ b/arch/powerpc/sysdev/dcr.S | |||
| @@ -1,6 +1,4 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * arch/ppc/syslib/dcr.S | ||
| 3 | * | ||
| 4 | * "Indirect" DCR access | 2 | * "Indirect" DCR access |
| 5 | * | 3 | * |
| 6 | * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.net> | 4 | * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.net> |
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 064c9de47732..ceb584682fa3 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
| @@ -40,7 +40,7 @@ phys_addr_t get_immrbase(void) | |||
| 40 | return immrbase; | 40 | return immrbase; |
| 41 | 41 | ||
| 42 | soc = of_find_node_by_type(NULL, "soc"); | 42 | soc = of_find_node_by_type(NULL, "soc"); |
| 43 | if (soc != 0) { | 43 | if (soc) { |
| 44 | unsigned int size; | 44 | unsigned int size; |
| 45 | void *prop = get_property(soc, "reg", &size); | 45 | void *prop = get_property(soc, "reg", &size); |
| 46 | immrbase = of_translate_address(soc, prop); | 46 | immrbase = of_translate_address(soc, prop); |
| @@ -49,21 +49,20 @@ phys_addr_t get_immrbase(void) | |||
| 49 | 49 | ||
| 50 | return immrbase; | 50 | return immrbase; |
| 51 | } | 51 | } |
| 52 | EXPORT_SYMBOL(get_immrbase); | ||
| 53 | 52 | ||
| 54 | static const char * gfar_tx_intr = "tx"; | 53 | EXPORT_SYMBOL(get_immrbase); |
| 55 | static const char * gfar_rx_intr = "rx"; | ||
| 56 | static const char * gfar_err_intr = "error"; | ||
| 57 | 54 | ||
| 58 | static int __init gfar_of_init(void) | 55 | static int __init gfar_mdio_of_init(void) |
| 59 | { | 56 | { |
| 60 | struct device_node *np; | 57 | struct device_node *np; |
| 61 | unsigned int i; | 58 | unsigned int i; |
| 62 | struct platform_device *mdio_dev, *gfar_dev; | 59 | struct platform_device *mdio_dev; |
| 63 | struct resource res; | 60 | struct resource res; |
| 64 | int ret; | 61 | int ret; |
| 65 | 62 | ||
| 66 | for (np = NULL, i = 0; (np = of_find_compatible_node(np, "mdio", "gianfar")) != NULL; i++) { | 63 | for (np = NULL, i = 0; |
| 64 | (np = of_find_compatible_node(np, "mdio", "gianfar")) != NULL; | ||
| 65 | i++) { | ||
| 67 | int k; | 66 | int k; |
| 68 | struct device_node *child = NULL; | 67 | struct device_node *child = NULL; |
| 69 | struct gianfar_mdio_data mdio_data; | 68 | struct gianfar_mdio_data mdio_data; |
| @@ -73,12 +72,14 @@ static int __init gfar_of_init(void) | |||
| 73 | 72 | ||
| 74 | ret = of_address_to_resource(np, 0, &res); | 73 | ret = of_address_to_resource(np, 0, &res); |
| 75 | if (ret) | 74 | if (ret) |
| 76 | goto mdio_err; | 75 | goto err; |
| 77 | 76 | ||
| 78 | mdio_dev = platform_device_register_simple("fsl-gianfar_mdio", res.start, &res, 1); | 77 | mdio_dev = |
| 78 | platform_device_register_simple("fsl-gianfar_mdio", | ||
| 79 | res.start, &res, 1); | ||
| 79 | if (IS_ERR(mdio_dev)) { | 80 | if (IS_ERR(mdio_dev)) { |
| 80 | ret = PTR_ERR(mdio_dev); | 81 | ret = PTR_ERR(mdio_dev); |
| 81 | goto mdio_err; | 82 | goto err; |
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | for (k = 0; k < 32; k++) | 85 | for (k = 0; k < 32; k++) |
| @@ -86,17 +87,44 @@ static int __init gfar_of_init(void) | |||
| 86 | 87 | ||
| 87 | while ((child = of_get_next_child(np, child)) != NULL) { | 88 | while ((child = of_get_next_child(np, child)) != NULL) { |
| 88 | if (child->n_intrs) { | 89 | if (child->n_intrs) { |
| 89 | u32 *id = (u32 *) get_property(child, "reg", NULL); | 90 | u32 *id = |
| 91 | (u32 *) get_property(child, "reg", NULL); | ||
| 90 | mdio_data.irq[*id] = child->intrs[0].line; | 92 | mdio_data.irq[*id] = child->intrs[0].line; |
| 91 | } | 93 | } |
| 92 | } | 94 | } |
| 93 | 95 | ||
| 94 | ret = platform_device_add_data(mdio_dev, &mdio_data, sizeof(struct gianfar_mdio_data)); | 96 | ret = |
| 97 | platform_device_add_data(mdio_dev, &mdio_data, | ||
| 98 | sizeof(struct gianfar_mdio_data)); | ||
| 95 | if (ret) | 99 | if (ret) |
| 96 | goto mdio_unreg; | 100 | goto unreg; |
| 97 | } | 101 | } |
| 98 | 102 | ||
| 99 | for (np = NULL, i = 0; (np = of_find_compatible_node(np, "network", "gianfar")) != NULL; i++) { | 103 | return 0; |
| 104 | |||
| 105 | unreg: | ||
| 106 | platform_device_unregister(mdio_dev); | ||
| 107 | err: | ||
| 108 | return ret; | ||
| 109 | } | ||
| 110 | |||
| 111 | arch_initcall(gfar_mdio_of_init); | ||
| 112 | |||
| 113 | static const char *gfar_tx_intr = "tx"; | ||
| 114 | static const char *gfar_rx_intr = "rx"; | ||
| 115 | static const char *gfar_err_intr = "error"; | ||
| 116 | |||
| 117 | static int __init gfar_of_init(void) | ||
| 118 | { | ||
| 119 | struct device_node *np; | ||
| 120 | unsigned int i; | ||
| 121 | struct platform_device *gfar_dev; | ||
| 122 | struct resource res; | ||
| 123 | int ret; | ||
| 124 | |||
| 125 | for (np = NULL, i = 0; | ||
| 126 | (np = of_find_compatible_node(np, "network", "gianfar")) != NULL; | ||
| 127 | i++) { | ||
| 100 | struct resource r[4]; | 128 | struct resource r[4]; |
| 101 | struct device_node *phy, *mdio; | 129 | struct device_node *phy, *mdio; |
| 102 | struct gianfar_platform_data gfar_data; | 130 | struct gianfar_platform_data gfar_data; |
| @@ -110,7 +138,7 @@ static int __init gfar_of_init(void) | |||
| 110 | 138 | ||
| 111 | ret = of_address_to_resource(np, 0, &r[0]); | 139 | ret = of_address_to_resource(np, 0, &r[0]); |
| 112 | if (ret) | 140 | if (ret) |
| 113 | goto gfar_err; | 141 | goto err; |
| 114 | 142 | ||
| 115 | r[1].start = np->intrs[0].line; | 143 | r[1].start = np->intrs[0].line; |
| 116 | r[1].end = np->intrs[0].line; | 144 | r[1].end = np->intrs[0].line; |
| @@ -133,11 +161,13 @@ static int __init gfar_of_init(void) | |||
| 133 | r[3].flags = IORESOURCE_IRQ; | 161 | r[3].flags = IORESOURCE_IRQ; |
| 134 | } | 162 | } |
| 135 | 163 | ||
| 136 | gfar_dev = platform_device_register_simple("fsl-gianfar", i, &r[0], np->n_intrs + 1); | 164 | gfar_dev = |
| 165 | platform_device_register_simple("fsl-gianfar", i, &r[0], | ||
| 166 | np->n_intrs + 1); | ||
| 137 | 167 | ||
| 138 | if (IS_ERR(gfar_dev)) { | 168 | if (IS_ERR(gfar_dev)) { |
| 139 | ret = PTR_ERR(gfar_dev); | 169 | ret = PTR_ERR(gfar_dev); |
| 140 | goto gfar_err; | 170 | goto err; |
| 141 | } | 171 | } |
| 142 | 172 | ||
| 143 | mac_addr = get_property(np, "address", NULL); | 173 | mac_addr = get_property(np, "address", NULL); |
| @@ -145,26 +175,26 @@ static int __init gfar_of_init(void) | |||
| 145 | 175 | ||
| 146 | if (model && !strcasecmp(model, "TSEC")) | 176 | if (model && !strcasecmp(model, "TSEC")) |
| 147 | gfar_data.device_flags = | 177 | gfar_data.device_flags = |
| 148 | FSL_GIANFAR_DEV_HAS_GIGABIT | | 178 | FSL_GIANFAR_DEV_HAS_GIGABIT | |
| 149 | FSL_GIANFAR_DEV_HAS_COALESCE | | 179 | FSL_GIANFAR_DEV_HAS_COALESCE | |
| 150 | FSL_GIANFAR_DEV_HAS_RMON | | 180 | FSL_GIANFAR_DEV_HAS_RMON | |
| 151 | FSL_GIANFAR_DEV_HAS_MULTI_INTR; | 181 | FSL_GIANFAR_DEV_HAS_MULTI_INTR; |
| 152 | if (model && !strcasecmp(model, "eTSEC")) | 182 | if (model && !strcasecmp(model, "eTSEC")) |
| 153 | gfar_data.device_flags = | 183 | gfar_data.device_flags = |
| 154 | FSL_GIANFAR_DEV_HAS_GIGABIT | | 184 | FSL_GIANFAR_DEV_HAS_GIGABIT | |
| 155 | FSL_GIANFAR_DEV_HAS_COALESCE | | 185 | FSL_GIANFAR_DEV_HAS_COALESCE | |
| 156 | FSL_GIANFAR_DEV_HAS_RMON | | 186 | FSL_GIANFAR_DEV_HAS_RMON | |
| 157 | FSL_GIANFAR_DEV_HAS_MULTI_INTR | | 187 | FSL_GIANFAR_DEV_HAS_MULTI_INTR | |
| 158 | FSL_GIANFAR_DEV_HAS_CSUM | | 188 | FSL_GIANFAR_DEV_HAS_CSUM | |
| 159 | FSL_GIANFAR_DEV_HAS_VLAN | | 189 | FSL_GIANFAR_DEV_HAS_VLAN | |
| 160 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; | 190 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; |
| 161 | 191 | ||
| 162 | ph = (phandle *) get_property(np, "phy-handle", NULL); | 192 | ph = (phandle *) get_property(np, "phy-handle", NULL); |
| 163 | phy = of_find_node_by_phandle(*ph); | 193 | phy = of_find_node_by_phandle(*ph); |
| 164 | 194 | ||
| 165 | if (phy == NULL) { | 195 | if (phy == NULL) { |
| 166 | ret = -ENODEV; | 196 | ret = -ENODEV; |
| 167 | goto gfar_unreg; | 197 | goto unreg; |
| 168 | } | 198 | } |
| 169 | 199 | ||
| 170 | mdio = of_get_parent(phy); | 200 | mdio = of_get_parent(phy); |
| @@ -174,7 +204,7 @@ static int __init gfar_of_init(void) | |||
| 174 | if (ret) { | 204 | if (ret) { |
| 175 | of_node_put(phy); | 205 | of_node_put(phy); |
| 176 | of_node_put(mdio); | 206 | of_node_put(mdio); |
| 177 | goto gfar_unreg; | 207 | goto unreg; |
| 178 | } | 208 | } |
| 179 | 209 | ||
| 180 | gfar_data.phy_id = *id; | 210 | gfar_data.phy_id = *id; |
| @@ -183,23 +213,22 @@ static int __init gfar_of_init(void) | |||
| 183 | of_node_put(phy); | 213 | of_node_put(phy); |
| 184 | of_node_put(mdio); | 214 | of_node_put(mdio); |
| 185 | 215 | ||
| 186 | ret = platform_device_add_data(gfar_dev, &gfar_data, sizeof(struct gianfar_platform_data)); | 216 | ret = |
| 217 | platform_device_add_data(gfar_dev, &gfar_data, | ||
| 218 | sizeof(struct | ||
| 219 | gianfar_platform_data)); | ||
| 187 | if (ret) | 220 | if (ret) |
| 188 | goto gfar_unreg; | 221 | goto unreg; |
| 189 | } | 222 | } |
| 190 | 223 | ||
| 191 | return 0; | 224 | return 0; |
| 192 | 225 | ||
| 193 | mdio_unreg: | 226 | unreg: |
| 194 | platform_device_unregister(mdio_dev); | ||
| 195 | mdio_err: | ||
| 196 | return ret; | ||
| 197 | |||
| 198 | gfar_unreg: | ||
| 199 | platform_device_unregister(gfar_dev); | 227 | platform_device_unregister(gfar_dev); |
| 200 | gfar_err: | 228 | err: |
| 201 | return ret; | 229 | return ret; |
| 202 | } | 230 | } |
| 231 | |||
| 203 | arch_initcall(gfar_of_init); | 232 | arch_initcall(gfar_of_init); |
| 204 | 233 | ||
| 205 | static int __init fsl_i2c_of_init(void) | 234 | static int __init fsl_i2c_of_init(void) |
| @@ -209,17 +238,19 @@ static int __init fsl_i2c_of_init(void) | |||
| 209 | struct platform_device *i2c_dev; | 238 | struct platform_device *i2c_dev; |
| 210 | int ret; | 239 | int ret; |
| 211 | 240 | ||
| 212 | for (np = NULL, i = 0; (np = of_find_compatible_node(np, "i2c", "fsl-i2c")) != NULL; i++) { | 241 | for (np = NULL, i = 0; |
| 242 | (np = of_find_compatible_node(np, "i2c", "fsl-i2c")) != NULL; | ||
| 243 | i++) { | ||
| 213 | struct resource r[2]; | 244 | struct resource r[2]; |
| 214 | struct fsl_i2c_platform_data i2c_data; | 245 | struct fsl_i2c_platform_data i2c_data; |
| 215 | unsigned char * flags = NULL; | 246 | unsigned char *flags = NULL; |
| 216 | 247 | ||
| 217 | memset(&r, 0, sizeof(r)); | 248 | memset(&r, 0, sizeof(r)); |
| 218 | memset(&i2c_data, 0, sizeof(i2c_data)); | 249 | memset(&i2c_data, 0, sizeof(i2c_data)); |
| 219 | 250 | ||
| 220 | ret = of_address_to_resource(np, 0, &r[0]); | 251 | ret = of_address_to_resource(np, 0, &r[0]); |
| 221 | if (ret) | 252 | if (ret) |
| 222 | goto i2c_err; | 253 | goto err; |
| 223 | 254 | ||
| 224 | r[1].start = np->intrs[0].line; | 255 | r[1].start = np->intrs[0].line; |
| 225 | r[1].end = np->intrs[0].line; | 256 | r[1].end = np->intrs[0].line; |
| @@ -228,7 +259,7 @@ static int __init fsl_i2c_of_init(void) | |||
| 228 | i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2); | 259 | i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2); |
| 229 | if (IS_ERR(i2c_dev)) { | 260 | if (IS_ERR(i2c_dev)) { |
| 230 | ret = PTR_ERR(i2c_dev); | 261 | ret = PTR_ERR(i2c_dev); |
| 231 | goto i2c_err; | 262 | goto err; |
| 232 | } | 263 | } |
| 233 | 264 | ||
| 234 | i2c_data.device_flags = 0; | 265 | i2c_data.device_flags = 0; |
| @@ -240,18 +271,22 @@ static int __init fsl_i2c_of_init(void) | |||
| 240 | if (flags) | 271 | if (flags) |
| 241 | i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200; | 272 | i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200; |
| 242 | 273 | ||
| 243 | ret = platform_device_add_data(i2c_dev, &i2c_data, sizeof(struct fsl_i2c_platform_data)); | 274 | ret = |
| 275 | platform_device_add_data(i2c_dev, &i2c_data, | ||
| 276 | sizeof(struct | ||
| 277 | fsl_i2c_platform_data)); | ||
| 244 | if (ret) | 278 | if (ret) |
| 245 | goto i2c_unreg; | 279 | goto unreg; |
| 246 | } | 280 | } |
| 247 | 281 | ||
| 248 | return 0; | 282 | return 0; |
| 249 | 283 | ||
| 250 | i2c_unreg: | 284 | unreg: |
| 251 | platform_device_unregister(i2c_dev); | 285 | platform_device_unregister(i2c_dev); |
| 252 | i2c_err: | 286 | err: |
| 253 | return ret; | 287 | return ret; |
| 254 | } | 288 | } |
| 289 | |||
| 255 | arch_initcall(fsl_i2c_of_init); | 290 | arch_initcall(fsl_i2c_of_init); |
| 256 | 291 | ||
| 257 | #ifdef CONFIG_PPC_83xx | 292 | #ifdef CONFIG_PPC_83xx |
| @@ -267,51 +302,192 @@ static int __init mpc83xx_wdt_init(void) | |||
| 267 | 302 | ||
| 268 | if (!np) { | 303 | if (!np) { |
| 269 | ret = -ENODEV; | 304 | ret = -ENODEV; |
| 270 | goto mpc83xx_wdt_nodev; | 305 | goto nodev; |
| 271 | } | 306 | } |
| 272 | 307 | ||
| 273 | soc = of_find_node_by_type(NULL, "soc"); | 308 | soc = of_find_node_by_type(NULL, "soc"); |
| 274 | 309 | ||
| 275 | if (!soc) { | 310 | if (!soc) { |
| 276 | ret = -ENODEV; | 311 | ret = -ENODEV; |
| 277 | goto mpc83xx_wdt_nosoc; | 312 | goto nosoc; |
| 278 | } | 313 | } |
| 279 | 314 | ||
| 280 | freq = (unsigned int *)get_property(soc, "bus-frequency", NULL); | 315 | freq = (unsigned int *)get_property(soc, "bus-frequency", NULL); |
| 281 | if (!freq) { | 316 | if (!freq) { |
| 282 | ret = -ENODEV; | 317 | ret = -ENODEV; |
| 283 | goto mpc83xx_wdt_err; | 318 | goto err; |
| 284 | } | 319 | } |
| 285 | 320 | ||
| 286 | memset(&r, 0, sizeof(r)); | 321 | memset(&r, 0, sizeof(r)); |
| 287 | 322 | ||
| 288 | ret = of_address_to_resource(np, 0, &r); | 323 | ret = of_address_to_resource(np, 0, &r); |
| 289 | if (ret) | 324 | if (ret) |
| 290 | goto mpc83xx_wdt_err; | 325 | goto err; |
| 291 | 326 | ||
| 292 | dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1); | 327 | dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1); |
| 293 | if (IS_ERR(dev)) { | 328 | if (IS_ERR(dev)) { |
| 294 | ret = PTR_ERR(dev); | 329 | ret = PTR_ERR(dev); |
| 295 | goto mpc83xx_wdt_err; | 330 | goto err; |
| 296 | } | 331 | } |
| 297 | 332 | ||
| 298 | ret = platform_device_add_data(dev, freq, sizeof(int)); | 333 | ret = platform_device_add_data(dev, freq, sizeof(int)); |
| 299 | if (ret) | 334 | if (ret) |
| 300 | goto mpc83xx_wdt_unreg; | 335 | goto unreg; |
| 301 | 336 | ||
| 302 | of_node_put(soc); | 337 | of_node_put(soc); |
| 303 | of_node_put(np); | 338 | of_node_put(np); |
| 304 | 339 | ||
| 305 | return 0; | 340 | return 0; |
| 306 | 341 | ||
| 307 | mpc83xx_wdt_unreg: | 342 | unreg: |
| 308 | platform_device_unregister(dev); | 343 | platform_device_unregister(dev); |
| 309 | mpc83xx_wdt_err: | 344 | err: |
| 310 | of_node_put(soc); | 345 | of_node_put(soc); |
| 311 | mpc83xx_wdt_nosoc: | 346 | nosoc: |
| 312 | of_node_put(np); | 347 | of_node_put(np); |
| 313 | mpc83xx_wdt_nodev: | 348 | nodev: |
| 314 | return ret; | 349 | return ret; |
| 315 | } | 350 | } |
| 351 | |||
| 316 | arch_initcall(mpc83xx_wdt_init); | 352 | arch_initcall(mpc83xx_wdt_init); |
| 317 | #endif | 353 | #endif |
| 354 | |||
| 355 | static enum fsl_usb2_phy_modes determine_usb_phy(char * phy_type) | ||
| 356 | { | ||
| 357 | if (!phy_type) | ||
| 358 | return FSL_USB2_PHY_NONE; | ||
| 359 | if (!strcasecmp(phy_type, "ulpi")) | ||
| 360 | return FSL_USB2_PHY_ULPI; | ||
| 361 | if (!strcasecmp(phy_type, "utmi")) | ||
| 362 | return FSL_USB2_PHY_UTMI; | ||
| 363 | if (!strcasecmp(phy_type, "utmi_wide")) | ||
| 364 | return FSL_USB2_PHY_UTMI_WIDE; | ||
| 365 | if (!strcasecmp(phy_type, "serial")) | ||
| 366 | return FSL_USB2_PHY_SERIAL; | ||
| 367 | |||
| 368 | return FSL_USB2_PHY_NONE; | ||
| 369 | } | ||
| 370 | |||
| 371 | static int __init fsl_usb_of_init(void) | ||
| 372 | { | ||
| 373 | struct device_node *np; | ||
| 374 | unsigned int i; | ||
| 375 | struct platform_device *usb_dev; | ||
| 376 | int ret; | ||
| 377 | |||
| 378 | for (np = NULL, i = 0; | ||
| 379 | (np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL; | ||
| 380 | i++) { | ||
| 381 | struct resource r[2]; | ||
| 382 | struct fsl_usb2_platform_data usb_data; | ||
| 383 | unsigned char *prop = NULL; | ||
| 384 | |||
| 385 | memset(&r, 0, sizeof(r)); | ||
| 386 | memset(&usb_data, 0, sizeof(usb_data)); | ||
| 387 | |||
| 388 | ret = of_address_to_resource(np, 0, &r[0]); | ||
| 389 | if (ret) | ||
| 390 | goto err; | ||
| 391 | |||
| 392 | r[1].start = np->intrs[0].line; | ||
| 393 | r[1].end = np->intrs[0].line; | ||
| 394 | r[1].flags = IORESOURCE_IRQ; | ||
| 395 | |||
| 396 | usb_dev = | ||
| 397 | platform_device_register_simple("fsl-usb2-mph", i, r, 2); | ||
| 398 | if (IS_ERR(usb_dev)) { | ||
| 399 | ret = PTR_ERR(usb_dev); | ||
| 400 | goto err; | ||
| 401 | } | ||
| 402 | |||
| 403 | usb_dev->dev.coherent_dma_mask = 0xffffffffUL; | ||
| 404 | usb_dev->dev.dma_mask = &usb_dev->dev.coherent_dma_mask; | ||
| 405 | |||
| 406 | usb_data.operating_mode = FSL_USB2_MPH_HOST; | ||
| 407 | |||
| 408 | prop = get_property(np, "port0", NULL); | ||
| 409 | if (prop) | ||
| 410 | usb_data.port_enables |= FSL_USB2_PORT0_ENABLED; | ||
| 411 | |||
| 412 | prop = get_property(np, "port1", NULL); | ||
| 413 | if (prop) | ||
| 414 | usb_data.port_enables |= FSL_USB2_PORT1_ENABLED; | ||
| 415 | |||
| 416 | prop = get_property(np, "phy_type", NULL); | ||
| 417 | usb_data.phy_mode = determine_usb_phy(prop); | ||
| 418 | |||
| 419 | ret = | ||
| 420 | platform_device_add_data(usb_dev, &usb_data, | ||
| 421 | sizeof(struct | ||
| 422 | fsl_usb2_platform_data)); | ||
| 423 | if (ret) | ||
| 424 | goto unreg; | ||
| 425 | } | ||
| 426 | |||
| 427 | return 0; | ||
| 428 | |||
| 429 | unreg: | ||
| 430 | platform_device_unregister(usb_dev); | ||
| 431 | err: | ||
| 432 | return ret; | ||
| 433 | } | ||
| 434 | |||
| 435 | arch_initcall(fsl_usb_of_init); | ||
| 436 | |||
| 437 | static int __init fsl_usb_dr_of_init(void) | ||
| 438 | { | ||
| 439 | struct device_node *np; | ||
| 440 | unsigned int i; | ||
| 441 | struct platform_device *usb_dev; | ||
| 442 | int ret; | ||
| 443 | |||
| 444 | for (np = NULL, i = 0; | ||
| 445 | (np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL; | ||
| 446 | i++) { | ||
| 447 | struct resource r[2]; | ||
| 448 | struct fsl_usb2_platform_data usb_data; | ||
| 449 | unsigned char *prop = NULL; | ||
| 450 | |||
| 451 | memset(&r, 0, sizeof(r)); | ||
| 452 | memset(&usb_data, 0, sizeof(usb_data)); | ||
| 453 | |||
| 454 | ret = of_address_to_resource(np, 0, &r[0]); | ||
| 455 | if (ret) | ||
| 456 | goto err; | ||
| 457 | |||
| 458 | r[1].start = np->intrs[0].line; | ||
| 459 | r[1].end = np->intrs[0].line; | ||
| 460 | r[1].flags = IORESOURCE_IRQ; | ||
| 461 | |||
| 462 | usb_dev = | ||
| 463 | platform_device_register_simple("fsl-usb2-dr", i, r, 2); | ||
| 464 | if (IS_ERR(usb_dev)) { | ||
| 465 | ret = PTR_ERR(usb_dev); | ||
| 466 | goto err; | ||
| 467 | } | ||
| 468 | |||
| 469 | usb_dev->dev.coherent_dma_mask = 0xffffffffUL; | ||
| 470 | usb_dev->dev.dma_mask = &usb_dev->dev.coherent_dma_mask; | ||
| 471 | |||
| 472 | usb_data.operating_mode = FSL_USB2_DR_HOST; | ||
| 473 | |||
| 474 | prop = get_property(np, "phy_type", NULL); | ||
| 475 | usb_data.phy_mode = determine_usb_phy(prop); | ||
| 476 | |||
| 477 | ret = | ||
| 478 | platform_device_add_data(usb_dev, &usb_data, | ||
| 479 | sizeof(struct | ||
| 480 | fsl_usb2_platform_data)); | ||
| 481 | if (ret) | ||
| 482 | goto unreg; | ||
| 483 | } | ||
| 484 | |||
| 485 | return 0; | ||
| 486 | |||
| 487 | unreg: | ||
| 488 | platform_device_unregister(usb_dev); | ||
| 489 | err: | ||
| 490 | return ret; | ||
| 491 | } | ||
| 492 | |||
| 493 | arch_initcall(fsl_usb_dr_of_init); | ||
diff --git a/arch/powerpc/sysdev/ipic.h b/arch/powerpc/sysdev/ipic.h index a7ce7da8785c..a60c9d18bb7f 100644 --- a/arch/powerpc/sysdev/ipic.h +++ b/arch/powerpc/sysdev/ipic.h | |||
| @@ -1,6 +1,4 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * arch/ppc/kernel/ipic.h | ||
| 3 | * | ||
| 4 | * IPIC private definitions and structure. | 2 | * IPIC private definitions and structure. |
| 5 | * | 3 | * |
| 6 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> | 4 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> |
