Commit 0e9b41ab authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

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: default avatarJohan Hovold <johan@hovoldconsulting.com>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 501cc8bd
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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 |
+7 −0
Original line number Diff line number Diff line
@@ -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;