aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasakazu Mokuno <mokuno@sm.sony.co.jp>2008-07-16 17:22:19 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-07-21 20:39:33 -0400
commit059e4938f8b060b10c4352e6c45739473bc73267 (patch)
tree27bd214190ba1a42b45fade9bbae310c2369d6cb
parent6e5f1537833a9fc8251157dff403231f5c89a894 (diff)
powerpc/ps3: Add a sub-match id to ps3_system_bus
Add sub match id for ps3 system bus so that two different system bus devices can be connected to a shared device. Signed-off-by: Masakazu Mokuno <mokuno@sm.sony.co.jp> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/platforms/ps3/device-init.c1
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c21
-rw-r--r--drivers/video/ps3fb.c1
-rw-r--r--include/asm-powerpc/ps3.h7
4 files changed, 23 insertions, 7 deletions
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index 3866debfa3c..ffdd8e963fb 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -486,6 +486,7 @@ static int __init ps3_register_graphics_devices(void)
486 return -ENOMEM; 486 return -ENOMEM;
487 487
488 p->dev.match_id = PS3_MATCH_ID_GRAPHICS; 488 p->dev.match_id = PS3_MATCH_ID_GRAPHICS;
489 p->dev.match_sub_id = PS3_MATCH_SUB_ID_FB;
489 p->dev.dev_type = PS3_DEVICE_TYPE_IOC0; 490 p->dev.dev_type = PS3_DEVICE_TYPE_IOC0;
490 491
491 result = ps3_system_bus_device_register(&p->dev); 492 result = ps3_system_bus_device_register(&p->dev);
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index d66c3628a11..280ee88cb0b 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -347,16 +347,23 @@ static int ps3_system_bus_match(struct device *_dev,
347 struct ps3_system_bus_driver *drv = ps3_drv_to_system_bus_drv(_drv); 347 struct ps3_system_bus_driver *drv = ps3_drv_to_system_bus_drv(_drv);
348 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); 348 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
349 349
350 result = dev->match_id == drv->match_id; 350 if (!dev->match_sub_id)
351 result = dev->match_id == drv->match_id;
352 else
353 result = dev->match_sub_id == drv->match_sub_id &&
354 dev->match_id == drv->match_id;
351 355
352 if (result) 356 if (result)
353 pr_info("%s:%d: dev=%u(%s), drv=%u(%s): match\n", __func__, 357 pr_info("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): match\n",
354 __LINE__, dev->match_id, dev->core.bus_id, 358 __func__, __LINE__,
355 drv->match_id, drv->core.name); 359 dev->match_id, dev->match_sub_id, dev->core.bus_id,
360 drv->match_id, drv->match_sub_id, drv->core.name);
356 else 361 else
357 pr_debug("%s:%d: dev=%u(%s), drv=%u(%s): miss\n", __func__, 362 pr_debug("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): miss\n",
358 __LINE__, dev->match_id, dev->core.bus_id, 363 __func__, __LINE__,
359 drv->match_id, drv->core.name); 364 dev->match_id, dev->match_sub_id, dev->core.bus_id,
365 drv->match_id, drv->match_sub_id, drv->core.name);
366
360 return result; 367 return result;
361} 368}
362 369
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index dc3af1c78c5..4b5d8077190 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -1297,6 +1297,7 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1297 1297
1298static struct ps3_system_bus_driver ps3fb_driver = { 1298static struct ps3_system_bus_driver ps3fb_driver = {
1299 .match_id = PS3_MATCH_ID_GRAPHICS, 1299 .match_id = PS3_MATCH_ID_GRAPHICS,
1300 .match_sub_id = PS3_MATCH_SUB_ID_FB,
1300 .core.name = DEVICE_NAME, 1301 .core.name = DEVICE_NAME,
1301 .core.owner = THIS_MODULE, 1302 .core.owner = THIS_MODULE,
1302 .probe = ps3fb_probe, 1303 .probe = ps3fb_probe,
diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h
index 81ffe3b3c1c..f9e34c493cb 100644
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -337,12 +337,18 @@ enum ps3_system_bus_device_type {
337 PS3_DEVICE_TYPE_LPM, 337 PS3_DEVICE_TYPE_LPM,
338}; 338};
339 339
340enum ps3_match_sub_id {
341 /* for PS3_MATCH_ID_GRAPHICS */
342 PS3_MATCH_SUB_ID_FB = 1,
343};
344
340/** 345/**
341 * struct ps3_system_bus_device - a device on the system bus 346 * struct ps3_system_bus_device - a device on the system bus
342 */ 347 */
343 348
344struct ps3_system_bus_device { 349struct ps3_system_bus_device {
345 enum ps3_match_id match_id; 350 enum ps3_match_id match_id;
351 enum ps3_match_sub_id match_sub_id;
346 enum ps3_system_bus_device_type dev_type; 352 enum ps3_system_bus_device_type dev_type;
347 353
348 u64 bus_id; /* SB */ 354 u64 bus_id; /* SB */
@@ -371,6 +377,7 @@ int ps3_close_hv_device(struct ps3_system_bus_device *dev);
371 377
372struct ps3_system_bus_driver { 378struct ps3_system_bus_driver {
373 enum ps3_match_id match_id; 379 enum ps3_match_id match_id;
380 enum ps3_match_sub_id match_sub_id;
374 struct device_driver core; 381 struct device_driver core;
375 int (*probe)(struct ps3_system_bus_device *); 382 int (*probe)(struct ps3_system_bus_device *);
376 int (*remove)(struct ps3_system_bus_device *); 383 int (*remove)(struct ps3_system_bus_device *);