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 <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Johan Hovold 2016-03-29 18:56:10 -04:00 коммит произвёл Greg Kroah-Hartman
Родитель 7d7acc06a0
Коммит ac72cfbe69
5 изменённых файлов: 7 добавлений и 24 удалений

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;
}