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>
        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,
 
 #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 */
 
 
        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;
        }
 
 
 #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;
 
 
        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;
 
        }
 
        /*
-        * 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;
        }