greybus: interface: clean up ES2 VID/PID hack
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 29 Mar 2016 22:56:10 +0000 (18:56 -0400)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 30 Mar 2016 21:23:19 +0000 (14:23 -0700)
Clean up the ES2 VID/PID hack using a new quirk flag.

Note that the hack is now used if and only if the interface is a Toshiba
ES2 bridge (and not if the attributes read zero).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/firmware.c
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/interface.c
drivers/staging/greybus/interface.h
drivers/staging/greybus/svc.c

index b1188b2..b1e373c 100644 (file)
@@ -43,14 +43,7 @@ static void firmware_es2_fixup_vid_pid(struct gb_firmware *firmware)
        struct gb_interface *intf = connection->bundle->intf;
        int ret;
 
-       /*
-        * Use VID/PID specified at hotplug if:
-        * - Bridge ASIC chip isn't ES2
-        * - Received non-zero Vendor/Product ids
-        */
-       if (intf->ddbl1_manufacturer_id != ES2_DDBL1_MFR_ID ||
-           intf->ddbl1_product_id != ES2_DDBL1_PROD_ID ||
-           intf->vendor_id != 0 || intf->product_id != 0)
+       if (!(intf->quirks & GB_INTERFACE_QUIRK_NO_ARA_IDS))
                return;
 
        ret = gb_operation_sync(connection, GB_FIRMWARE_TYPE_GET_VID_PID,
index 0a7427e..bb7b01f 100644 (file)
@@ -226,10 +226,6 @@ struct gb_control_timesync_authoritative_request {
 #define GB_FIRMWARE_TYPE_AP_READY              0x05    /* Request with no-payload */
 #define GB_FIRMWARE_TYPE_GET_VID_PID           0x06    /* Request with no-payload */
 
-/* FIXME: remove all ES2-specific identifiers from the kernel */
-#define ES2_DDBL1_MFR_ID       0x00000126
-#define ES2_DDBL1_PROD_ID      0x00001000
-
 /* Greybus firmware boot stages */
 #define GB_FIRMWARE_BOOT_STAGE_ONE             0x01 /* Reserved for the boot ROM */
 #define GB_FIRMWARE_BOOT_STAGE_TWO             0x02 /* Firmware package to be loaded by the boot ROM */
index 767bf87..bf29831 100644 (file)
@@ -80,6 +80,7 @@ static int gb_interface_read_dme(struct gb_interface *intf)
 
        if (intf->ddbl1_manufacturer_id == TOSHIBA_DMID &&
                        intf->ddbl1_product_id == TOSHIBA_ES2_BRIDGE_DPID) {
+               intf->quirks |= GB_INTERFACE_QUIRK_NO_ARA_IDS;
                intf->quirks |= GB_INTERFACE_QUIRK_NO_INIT_STATUS;
        }
 
index 94eb36e..15c687f 100644 (file)
@@ -13,6 +13,7 @@
 #define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES           BIT(0)
 #define GB_INTERFACE_QUIRK_NO_INTERFACE_VERSION                BIT(1)
 #define GB_INTERFACE_QUIRK_NO_INIT_STATUS              BIT(2)
+#define GB_INTERFACE_QUIRK_NO_ARA_IDS                  BIT(3)
 
 struct gb_interface {
        struct device dev;
index 0659815..a19e575 100644 (file)
@@ -426,11 +426,7 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation)
 
        intf = gb_interface_find(hd, intf_id);
        if (intf) {
-               /*
-                * For ES2, we need to maintain the same vendor/product ids we
-                * got from bootrom, otherwise userspace can't distinguish
-                * between modules.
-                */
+               /* HACK: Save Ara VID/PID for ES2 hack below */
                vendor_id = intf->vendor_id;
                product_id = intf->product_id;
 
@@ -468,15 +464,11 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation)
        }
 
        /*
-        * Use VID/PID specified at hotplug if:
-        * - Bridge ASIC chip isn't ES2
-        * - Received non-zero Vendor/Product ids
+        * HACK: Use Ara VID/PID from earlier boot stage.
         *
-        * Otherwise, use the ids we received from bootrom.
+        * FIXME: remove quirk with ES2 support
         */
-       if (intf->ddbl1_manufacturer_id == ES2_DDBL1_MFR_ID &&
-           intf->ddbl1_product_id == ES2_DDBL1_PROD_ID &&
-           intf->vendor_id == 0 && intf->product_id == 0) {
+       if (intf->quirks & GB_INTERFACE_QUIRK_NO_ARA_IDS) {
                intf->vendor_id = vendor_id;
                intf->product_id = product_id;
        }