greybus: svc: Add support for the link config operation

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Laurent Pinchart 2015-12-18 21:23:22 +02:00 committed by Greg Kroah-Hartman
parent c6622216ff
commit 784f87614a
3 changed files with 36 additions and 0 deletions

View File

@ -726,6 +726,7 @@ struct gb_spi_transfer_response {
#define GB_SVC_TYPE_DME_PEER_SET 0x0a #define GB_SVC_TYPE_DME_PEER_SET 0x0a
#define GB_SVC_TYPE_ROUTE_CREATE 0x0b #define GB_SVC_TYPE_ROUTE_CREATE 0x0b
#define GB_SVC_TYPE_ROUTE_DESTROY 0x0c #define GB_SVC_TYPE_ROUTE_DESTROY 0x0c
#define GB_SVC_TYPE_LINK_CONFIG 0x0d
/* /*
* SVC version request/response has the same payload as * SVC version request/response has the same payload as
@ -806,6 +807,20 @@ struct gb_svc_dme_peer_set_response {
__le16 result_code; __le16 result_code;
} __packed; } __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 */ /* Attributes for peer get/set operations */
#define DME_ATTR_SELECTOR_INDEX 0 #define DME_ATTR_SELECTOR_INDEX 0
#define DME_ATTR_T_TST_SRC_INCREMENT 0x4083 #define DME_ATTR_T_TST_SRC_INCREMENT 0x4083

View File

@ -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) static int gb_svc_version_request(struct gb_operation *op)
{ {
struct gb_connection *connection = op->connection; struct gb_connection *connection = op->connection;

View File

@ -44,6 +44,9 @@ int gb_svc_dme_peer_get(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
u32 *value); u32 *value);
int gb_svc_dme_peer_set(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector, int gb_svc_dme_peer_set(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
u32 value); 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); int gb_svc_protocol_init(void);
void gb_svc_protocol_exit(void); void gb_svc_protocol_exit(void);