From: Johan Hovold Date: Tue, 29 Mar 2016 22:56:10 +0000 (-0400) Subject: greybus: interface: clean up ES2 VID/PID hack X-Git-Tag: v5.15~12752^2~378^2~21^2~554 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ac72cfbe6937f00c1fb334001c89ea26254ef430;p=platform%2Fkernel%2Flinux-starfive.git greybus: interface: clean up ES2 VID/PID hack 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/firmware.c b/drivers/staging/greybus/firmware.c index b1188b2..b1e373c 100644 --- a/drivers/staging/greybus/firmware.c +++ b/drivers/staging/greybus/firmware.c @@ -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, diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h index 0a7427e..bb7b01f 100644 --- a/drivers/staging/greybus/greybus_protocols.h +++ b/drivers/staging/greybus/greybus_protocols.h @@ -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 */ diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c index 767bf87b..bf29831 100644 --- a/drivers/staging/greybus/interface.c +++ b/drivers/staging/greybus/interface.c @@ -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; } diff --git a/drivers/staging/greybus/interface.h b/drivers/staging/greybus/interface.h index 94eb36e..15c687f 100644 --- a/drivers/staging/greybus/interface.h +++ b/drivers/staging/greybus/interface.h @@ -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; diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index 0659815..a19e575 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -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; }