diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h index 770a162e55f3..a50823c9fae3 100644 --- a/drivers/staging/greybus/greybus_protocols.h +++ b/drivers/staging/greybus/greybus_protocols.h @@ -726,6 +726,7 @@ struct gb_spi_transfer_response { #define GB_SVC_TYPE_DME_PEER_SET 0x0a #define GB_SVC_TYPE_ROUTE_CREATE 0x0b #define GB_SVC_TYPE_ROUTE_DESTROY 0x0c +#define GB_SVC_TYPE_LINK_CONFIG 0x0d /* * SVC version request/response has the same payload as @@ -806,6 +807,20 @@ struct gb_svc_dme_peer_set_response { __le16 result_code; } __packed; +#define GB_SVC_LINK_CONFIG_BURST_PWM 0 +#define GB_SVC_LINK_CONFIG_BURST_HS_A 1 +#define GB_SVC_LINK_CONFIG_BURST_HS_B 2 +#define GB_SVC_LINK_CONFIG_FLAG_AUTO_SLEEP (1 << 0) + +struct gb_svc_link_config_request { + __u8 intf_id; + __u8 burst; + __u8 gear; + __u8 nlanes; + __u8 flags; +} __packed; +/* link config response has no payload */ + /* Attributes for peer get/set operations */ #define DME_ATTR_SELECTOR_INDEX 0 #define DME_ATTR_T_TST_SRC_INCREMENT 0x4083 diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index 5c4ca7938387..ff865b3b4825 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -270,6 +270,24 @@ static void gb_svc_route_destroy(struct gb_svc *svc, u8 intf1_id, u8 intf2_id) } } +/* Creates bi-directional routes between the devices */ +int gb_svc_link_config(struct gb_svc *svc, u8 intf_id, + unsigned int burst, unsigned int gear, + unsigned int nlanes, unsigned int flags) +{ + struct gb_svc_link_config_request request; + + request.intf_id = intf_id; + request.burst = burst; + request.gear = gear; + request.nlanes = nlanes; + request.flags = flags; + + return gb_operation_sync(svc->connection, GB_SVC_TYPE_LINK_CONFIG, + &request, sizeof(request), NULL, 0); +} +EXPORT_SYMBOL_GPL(gb_svc_link_config); + static int gb_svc_version_request(struct gb_operation *op) { struct gb_connection *connection = op->connection; diff --git a/drivers/staging/greybus/svc.h b/drivers/staging/greybus/svc.h index b7cb7e4c6cf5..23060357e3ad 100644 --- a/drivers/staging/greybus/svc.h +++ b/drivers/staging/greybus/svc.h @@ -44,6 +44,9 @@ int gb_svc_dme_peer_get(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector, u32 *value); int gb_svc_dme_peer_set(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector, u32 value); +int gb_svc_link_config(struct gb_svc *svc, u8 intf_id, unsigned int burst, + unsigned int gear, unsigned int nlanes, + unsigned int flags); int gb_svc_protocol_init(void); void gb_svc_protocol_exit(void);