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

greybus: interface: clean up DME attribute handling

Move all DME defines to the interface code and rename them using common
prefixes (e.g. DME_T and DME_TOSHIBA).

The DDB L1 attributes are defined by MIPI and the Ara attributes are
currently Toshiba specific so move them all out of the Greybus protocol
header.

Also rename the Greybus init-status values using a GB_INIT prefix.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent ac72cfbe
...@@ -884,18 +884,12 @@ struct gb_svc_dme_peer_set_response { ...@@ -884,18 +884,12 @@ struct gb_svc_dme_peer_set_response {
__le16 result_code; __le16 result_code;
} __packed; } __packed;
/* Attributes for peer get/set operations */ /* Greybus init-status values, currently retrieved using DME peer gets. */
#define DME_ATTR_SELECTOR_INDEX_NULL 0 #define GB_INIT_SPI_BOOT_STARTED 0x02
/* FIXME: remove ES2 support and DME_ATTR_T_TST_SRC_INCREMENT */ #define GB_INIT_TRUSTED_SPI_BOOT_FINISHED 0x03
#define DME_ATTR_T_TST_SRC_INCREMENT 0x4083 #define GB_INIT_UNTRUSTED_SPI_BOOT_FINISHED 0x04
#define DME_ATTR_ES3_INIT_STATUS 0x6101 #define GB_INIT_BOOTROM_UNIPRO_BOOT_STARTED 0x06
#define GB_INIT_BOOTROM_FALLBACK_UNIPRO_BOOT_STARTED 0x09
/* Return value from init-status attributes listed above */
#define DME_DIS_SPI_BOOT_STARTED 0x02
#define DME_DIS_TRUSTED_SPI_BOOT_FINISHED 0x03
#define DME_DIS_UNTRUSTED_SPI_BOOT_FINISHED 0x04
#define DME_DIS_BOOTROM_UNIPRO_BOOT_STARTED 0x06
#define DME_DIS_BOOTROM_FALLBACK_UNIPRO_BOOT_STARTED 0x09
struct gb_svc_route_create_request { struct gb_svc_route_create_request {
__u8 intf1_id; __u8 intf1_id;
......
...@@ -12,12 +12,19 @@ ...@@ -12,12 +12,19 @@
#define GB_INTERFACE_DEVICE_ID_BAD 0xff #define GB_INTERFACE_DEVICE_ID_BAD 0xff
/* Don't-care selector index */
#define DME_SELECTOR_INDEX_NULL 0
/* DME attributes */ /* DME attributes */
/* FIXME: remove ES2 support and DME_T_TST_SRC_INCREMENT */
#define DME_T_TST_SRC_INCREMENT 0x4083
#define DME_DDBL1_MANUFACTURERID 0x5003 #define DME_DDBL1_MANUFACTURERID 0x5003
#define DME_DDBL1_PRODUCTID 0x5004 #define DME_DDBL1_PRODUCTID 0x5004
#define DME_TOSHIBA_ARA_VID 0x6000 #define DME_TOSHIBA_ARA_VID 0x6000
#define DME_TOSHIBA_ARA_PID 0x6001 #define DME_TOSHIBA_ARA_PID 0x6001
#define DME_TOSHIBA_ARA_INIT_STATUS 0x6101
/* DDBL1 Manufacturer and Product ids */ /* DDBL1 Manufacturer and Product ids */
#define TOSHIBA_DMID 0x0126 #define TOSHIBA_DMID 0x0126
...@@ -30,8 +37,7 @@ static int gb_interface_dme_attr_get(struct gb_interface *intf, ...@@ -30,8 +37,7 @@ static int gb_interface_dme_attr_get(struct gb_interface *intf,
u16 attr, u32 *val) u16 attr, u32 *val)
{ {
return gb_svc_dme_peer_get(intf->hd->svc, intf->interface_id, return gb_svc_dme_peer_get(intf->hd->svc, intf->interface_id,
attr, DME_ATTR_SELECTOR_INDEX_NULL, attr, DME_SELECTOR_INDEX_NULL, val);
val);
} }
static int gb_interface_read_ara_dme(struct gb_interface *intf) static int gb_interface_read_ara_dme(struct gb_interface *intf)
...@@ -148,8 +154,8 @@ static void gb_interface_route_destroy(struct gb_interface *intf) ...@@ -148,8 +154,8 @@ static void gb_interface_route_destroy(struct gb_interface *intf)
/* /*
* T_TstSrcIncrement is written by the module on ES2 as a stand-in for the * T_TstSrcIncrement is written by the module on ES2 as a stand-in for the
* init-status attribute ES3_INIT_STATUS. The AP needs to read and clear it * init-status attribute DME_TOSHIBA_INIT_STATUS. The AP needs to read and
* after reading a non-zero value from it. * clear it after reading a non-zero value from it.
* *
* FIXME: This is module-hardware dependent and needs to be extended for every * FIXME: This is module-hardware dependent and needs to be extended for every
* type of module we want to support. * type of module we want to support.
...@@ -168,12 +174,12 @@ static int gb_interface_read_and_clear_init_status(struct gb_interface *intf) ...@@ -168,12 +174,12 @@ static int gb_interface_read_and_clear_init_status(struct gb_interface *intf)
* FIXME: Remove ES2 support * FIXME: Remove ES2 support
*/ */
if (intf->quirks & GB_INTERFACE_QUIRK_NO_INIT_STATUS) if (intf->quirks & GB_INTERFACE_QUIRK_NO_INIT_STATUS)
attr = DME_ATTR_T_TST_SRC_INCREMENT; attr = DME_T_TST_SRC_INCREMENT;
else else
attr = DME_ATTR_ES3_INIT_STATUS; attr = DME_TOSHIBA_ARA_INIT_STATUS;
ret = gb_svc_dme_peer_get(hd->svc, intf->interface_id, attr, ret = gb_svc_dme_peer_get(hd->svc, intf->interface_id, attr,
DME_ATTR_SELECTOR_INDEX_NULL, &value); DME_SELECTOR_INDEX_NULL, &value);
if (ret) if (ret)
return ret; return ret;
...@@ -205,8 +211,8 @@ static int gb_interface_read_and_clear_init_status(struct gb_interface *intf) ...@@ -205,8 +211,8 @@ static int gb_interface_read_and_clear_init_status(struct gb_interface *intf)
* support the interface-version request. * support the interface-version request.
*/ */
switch (init_status) { switch (init_status) {
case DME_DIS_BOOTROM_UNIPRO_BOOT_STARTED: case GB_INIT_BOOTROM_UNIPRO_BOOT_STARTED:
case DME_DIS_BOOTROM_FALLBACK_UNIPRO_BOOT_STARTED: case GB_INIT_BOOTROM_FALLBACK_UNIPRO_BOOT_STARTED:
intf->quirks |= GB_INTERFACE_QUIRK_NO_CPORT_FEATURES; intf->quirks |= GB_INTERFACE_QUIRK_NO_CPORT_FEATURES;
intf->quirks |= GB_INTERFACE_QUIRK_NO_INTERFACE_VERSION; intf->quirks |= GB_INTERFACE_QUIRK_NO_INTERFACE_VERSION;
break; break;
...@@ -214,7 +220,7 @@ static int gb_interface_read_and_clear_init_status(struct gb_interface *intf) ...@@ -214,7 +220,7 @@ static int gb_interface_read_and_clear_init_status(struct gb_interface *intf)
/* Clear the init status. */ /* Clear the init status. */
return gb_svc_dme_peer_set(hd->svc, intf->interface_id, attr, return gb_svc_dme_peer_set(hd->svc, intf->interface_id, attr,
DME_ATTR_SELECTOR_INDEX_NULL, 0); DME_SELECTOR_INDEX_NULL, 0);
} }
/* interface sysfs attributes */ /* interface sysfs attributes */
......
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