Commit ac72cfbe authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

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: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 7d7acc06
...@@ -43,14 +43,7 @@ static void firmware_es2_fixup_vid_pid(struct gb_firmware *firmware) ...@@ -43,14 +43,7 @@ static void firmware_es2_fixup_vid_pid(struct gb_firmware *firmware)
struct gb_interface *intf = connection->bundle->intf; struct gb_interface *intf = connection->bundle->intf;
int ret; int ret;
/* if (!(intf->quirks & GB_INTERFACE_QUIRK_NO_ARA_IDS))
* 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)
return; return;
ret = gb_operation_sync(connection, GB_FIRMWARE_TYPE_GET_VID_PID, ret = gb_operation_sync(connection, GB_FIRMWARE_TYPE_GET_VID_PID,
......
...@@ -226,10 +226,6 @@ struct gb_control_timesync_authoritative_request { ...@@ -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_AP_READY 0x05 /* Request with no-payload */
#define GB_FIRMWARE_TYPE_GET_VID_PID 0x06 /* 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 */ /* Greybus firmware boot stages */
#define GB_FIRMWARE_BOOT_STAGE_ONE 0x01 /* Reserved for the boot ROM */ #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 */ #define GB_FIRMWARE_BOOT_STAGE_TWO 0x02 /* Firmware package to be loaded by the boot ROM */
......
...@@ -80,6 +80,7 @@ static int gb_interface_read_dme(struct gb_interface *intf) ...@@ -80,6 +80,7 @@ static int gb_interface_read_dme(struct gb_interface *intf)
if (intf->ddbl1_manufacturer_id == TOSHIBA_DMID && if (intf->ddbl1_manufacturer_id == TOSHIBA_DMID &&
intf->ddbl1_product_id == TOSHIBA_ES2_BRIDGE_DPID) { intf->ddbl1_product_id == TOSHIBA_ES2_BRIDGE_DPID) {
intf->quirks |= GB_INTERFACE_QUIRK_NO_ARA_IDS;
intf->quirks |= GB_INTERFACE_QUIRK_NO_INIT_STATUS; intf->quirks |= GB_INTERFACE_QUIRK_NO_INIT_STATUS;
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES BIT(0) #define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES BIT(0)
#define GB_INTERFACE_QUIRK_NO_INTERFACE_VERSION BIT(1) #define GB_INTERFACE_QUIRK_NO_INTERFACE_VERSION BIT(1)
#define GB_INTERFACE_QUIRK_NO_INIT_STATUS BIT(2) #define GB_INTERFACE_QUIRK_NO_INIT_STATUS BIT(2)
#define GB_INTERFACE_QUIRK_NO_ARA_IDS BIT(3)
struct gb_interface { struct gb_interface {
struct device dev; struct device dev;
......
...@@ -426,11 +426,7 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation) ...@@ -426,11 +426,7 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation)
intf = gb_interface_find(hd, intf_id); intf = gb_interface_find(hd, intf_id);
if (intf) { if (intf) {
/* /* HACK: Save Ara VID/PID for ES2 hack below */
* For ES2, we need to maintain the same vendor/product ids we
* got from bootrom, otherwise userspace can't distinguish
* between modules.
*/
vendor_id = intf->vendor_id; vendor_id = intf->vendor_id;
product_id = intf->product_id; product_id = intf->product_id;
...@@ -468,15 +464,11 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation) ...@@ -468,15 +464,11 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation)
} }
/* /*
* Use VID/PID specified at hotplug if: * HACK: Use Ara VID/PID from earlier boot stage.
* - Bridge ASIC chip isn't ES2
* - Received non-zero Vendor/Product ids
* *
* Otherwise, use the ids we received from bootrom. * FIXME: remove quirk with ES2 support
*/ */
if (intf->ddbl1_manufacturer_id == ES2_DDBL1_MFR_ID && if (intf->quirks & GB_INTERFACE_QUIRK_NO_ARA_IDS) {
intf->ddbl1_product_id == ES2_DDBL1_PROD_ID &&
intf->vendor_id == 0 && intf->product_id == 0) {
intf->vendor_id = vendor_id; intf->vendor_id = vendor_id;
intf->product_id = product_id; intf->product_id = product_id;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment