From: Johan Hovold Date: Wed, 11 May 2016 08:17:55 +0000 (+0200) Subject: greybus: connection: add no-flow-control connection flag X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0e9b41ab98ec8065263e6def8baebff1c1cd2c31;p=linux-beck.git greybus: connection: add no-flow-control connection flag Add a no-flow-control connection flag, which is set for connection that should not have any flow-control feature enabled. This flag is specifically set for all connections to the legacy ES3 bootrom, and will also be used by the camera driver eventually. Signed-off-by: Johan Hovold Reviewed-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 1564db84b4ed..9e8828109b1e 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -183,6 +183,8 @@ _gb_connection_create(struct gb_host_device *hd, int hd_cport_id, connection->bundle = bundle; connection->handler = handler; connection->flags = flags; + if (intf && (intf->quirks & GB_INTERFACE_QUIRK_NO_CPORT_FEATURES)) + connection->flags |= GB_CONNECTION_FLAG_NO_FLOWCTRL; connection->state = GB_CONNECTION_STATE_DISABLED; atomic_set(&connection->op_cycle, 0); @@ -338,11 +340,10 @@ gb_connection_svc_connection_create(struct gb_connection *connection) intf = connection->intf; /* - * Enable either E2EFC or CSD, unless the interface does not support - * any CPort features. + * Enable either E2EFC or CSD, unless no flow control is requested. */ cport_flags = GB_SVC_CPORT_FLAG_CSV_N; - if (intf->quirks & GB_INTERFACE_QUIRK_NO_CPORT_FEATURES) { + if (gb_connection_flow_control_disabled(connection)) { cport_flags |= GB_SVC_CPORT_FLAG_CSD_N; } else if (gb_connection_e2efc_enabled(connection)) { cport_flags |= GB_SVC_CPORT_FLAG_CSD_N | diff --git a/drivers/staging/greybus/connection.h b/drivers/staging/greybus/connection.h index 443d27bc3e35..bb25abf188f3 100644 --- a/drivers/staging/greybus/connection.h +++ b/drivers/staging/greybus/connection.h @@ -14,6 +14,7 @@ #include #define GB_CONNECTION_FLAG_CSD BIT(0) +#define GB_CONNECTION_FLAG_NO_FLOWCTRL BIT(1) enum gb_connection_state { GB_CONNECTION_STATE_INVALID = 0, @@ -88,6 +89,12 @@ static inline bool gb_connection_e2efc_enabled(struct gb_connection *connection) return !(connection->flags & GB_CONNECTION_FLAG_CSD); } +static inline bool +gb_connection_flow_control_disabled(struct gb_connection *connection) +{ + return connection->flags & GB_CONNECTION_FLAG_NO_FLOWCTRL; +} + static inline void *gb_connection_get_data(struct gb_connection *connection) { return connection->private;