greybus: connection: add no-flow-control connection flag
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 11 May 2016 08:17:55 +0000 (10:17 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 13 May 2016 13:30:05 +0000 (15:30 +0200)
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 <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c
drivers/staging/greybus/connection.h

index 1564db8..9e88281 100644 (file)
@@ -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 |
index 443d27b..bb25abf 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/kfifo.h>
 
 #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;