]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
powerpc/ps3: Add a sub-match id to ps3_system_bus
authorMasakazu Mokuno <mokuno@sm.sony.co.jp>
Wed, 16 Jul 2008 21:22:19 +0000 (07:22 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 22 Jul 2008 00:39:33 +0000 (10:39 +1000)
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>
arch/powerpc/platforms/ps3/device-init.c
arch/powerpc/platforms/ps3/system-bus.c
drivers/video/ps3fb.c
include/asm-powerpc/ps3.h

index 3866debfa3c41d0062851f0fcfdbb47ab7cc7c8e..ffdd8e963fbdf04032b79afcd640748c4f4b77a9 100644 (file)
@@ -486,6 +486,7 @@ static int __init ps3_register_graphics_devices(void)
                return -ENOMEM;
 
        p->dev.match_id = PS3_MATCH_ID_GRAPHICS;
+       p->dev.match_sub_id = PS3_MATCH_SUB_ID_FB;
        p->dev.dev_type = PS3_DEVICE_TYPE_IOC0;
 
        result = ps3_system_bus_device_register(&p->dev);
index d66c3628a1121919474dece2d123f15270ce5e84..280ee88cb0b001c21449c18694d498a9c58e6de0 100644 (file)
@@ -347,16 +347,23 @@ static int ps3_system_bus_match(struct device *_dev,
        struct ps3_system_bus_driver *drv = ps3_drv_to_system_bus_drv(_drv);
        struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
 
-       result = dev->match_id == drv->match_id;
+       if (!dev->match_sub_id)
+               result = dev->match_id == drv->match_id;
+       else
+               result = dev->match_sub_id == drv->match_sub_id &&
+                       dev->match_id == drv->match_id;
 
        if (result)
-               pr_info("%s:%d: dev=%u(%s), drv=%u(%s): match\n", __func__,
-                       __LINE__, dev->match_id, dev->core.bus_id,
-                       drv->match_id, drv->core.name);
+               pr_info("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): match\n",
+                       __func__, __LINE__,
+                       dev->match_id, dev->match_sub_id, dev->core.bus_id,
+                       drv->match_id, drv->match_sub_id, drv->core.name);
        else
-               pr_debug("%s:%d: dev=%u(%s), drv=%u(%s): miss\n", __func__,
-                       __LINE__, dev->match_id, dev->core.bus_id,
-                       drv->match_id, drv->core.name);
+               pr_debug("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): miss\n",
+                       __func__, __LINE__,
+                       dev->match_id, dev->match_sub_id, dev->core.bus_id,
+                       drv->match_id, drv->match_sub_id, drv->core.name);
+
        return result;
 }
 
index dc3af1c78c56ce2fff1fa32a5f8961ae727a496a..4b5d807719041e99aa7f1d70afb1b9a308c21fa6 100644 (file)
@@ -1297,6 +1297,7 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
 
 static struct ps3_system_bus_driver ps3fb_driver = {
        .match_id       = PS3_MATCH_ID_GRAPHICS,
+       .match_sub_id   = PS3_MATCH_SUB_ID_FB,
        .core.name      = DEVICE_NAME,
        .core.owner     = THIS_MODULE,
        .probe          = ps3fb_probe,
index 81ffe3b3c1ce771b29062d5111d1c23d5aa94875..f9e34c493cbbcb3764a7f584296ca5809cfa60a9 100644 (file)
@@ -337,12 +337,18 @@ enum ps3_system_bus_device_type {
        PS3_DEVICE_TYPE_LPM,
 };
 
+enum ps3_match_sub_id {
+       /* for PS3_MATCH_ID_GRAPHICS */
+       PS3_MATCH_SUB_ID_FB             = 1,
+};
+
 /**
  * struct ps3_system_bus_device - a device on the system bus
  */
 
 struct ps3_system_bus_device {
        enum ps3_match_id match_id;
+       enum ps3_match_sub_id match_sub_id;
        enum ps3_system_bus_device_type dev_type;
 
        u64 bus_id;                       /* SB */
@@ -371,6 +377,7 @@ int ps3_close_hv_device(struct ps3_system_bus_device *dev);
 
 struct ps3_system_bus_driver {
        enum ps3_match_id match_id;
+       enum ps3_match_sub_id match_sub_id;
        struct device_driver core;
        int (*probe)(struct ps3_system_bus_device *);
        int (*remove)(struct ps3_system_bus_device *);