greybus: connection: generalise CPortFlags handling

Generalise the svc connection-create helper to accept a cport-flags
argument and handle the flags in the connection code instead.

Note that the camera driver currently manages its data connection
directly. We keep E2EFC enabled for now even though it will soon need
to be disabled due to some pending firmware updates.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Johan Hovold 2016-03-03 13:34:38 +01:00 коммит произвёл Greg Kroah-Hartman
Родитель 34145b608d
Коммит 27f25c17ad
4 изменённых файлов: 24 добавлений и 15 удалений

Просмотреть файл

@ -817,6 +817,7 @@ static int gb_camera_connection_init(struct gb_connection *connection)
{
struct gb_svc *svc = connection->hd->svc;
struct gb_camera *gcam;
u8 cport_flags;
int ret;
gcam = kzalloc(sizeof(*gcam), GFP_KERNEL);
@ -830,9 +831,12 @@ static int gb_camera_connection_init(struct gb_connection *connection)
* Create the data connection between camera module CDSI0 and APB CDS1.
* The CPort IDs are hardcoded by the ES2 bridges.
*/
/* FIXME: remove E2EFC */
cport_flags = GB_SVC_CPORT_FLAG_E2EFC | GB_SVC_CPORT_FLAG_CSD_N |
GB_SVC_CPORT_FLAG_CSV_N;
ret = gb_svc_connection_create(svc, connection->intf->interface_id,
ES2_APB_CDSI0_CPORT, svc->ap_intf_id,
ES2_APB_CDSI1_CPORT, false);
ES2_APB_CDSI1_CPORT, cport_flags);
if (ret < 0)
goto error;

Просмотреть файл

@ -327,18 +327,29 @@ gb_connection_svc_connection_create(struct gb_connection *connection)
{
struct gb_host_device *hd = connection->hd;
struct gb_interface *intf;
u8 cport_flags;
int ret;
if (gb_connection_is_static(connection))
return gb_connection_hd_fct_flow_enable(connection);
intf = connection->intf;
/* The ES2/ES3 bootrom requires E2EFC, CSD and CSV to be disabled. */
cport_flags = GB_SVC_CPORT_FLAG_CSV_N;
if (intf->boot_over_unipro) {
cport_flags |= GB_SVC_CPORT_FLAG_CSD_N;
} else {
cport_flags |= GB_SVC_CPORT_FLAG_CSD_N |
GB_SVC_CPORT_FLAG_E2EFC;
}
ret = gb_svc_connection_create(hd->svc,
hd->svc->ap_intf_id,
connection->hd_cport_id,
intf->interface_id,
connection->intf_cport_id,
intf->boot_over_unipro);
cport_flags);
if (ret) {
dev_err(&connection->hd->dev,
"%s: failed to create svc connection: %d\n",

Просмотреть файл

@ -12,10 +12,6 @@
#include "greybus.h"
#define CPORT_FLAGS_E2EFC BIT(0)
#define CPORT_FLAGS_CSD_N BIT(1)
#define CPORT_FLAGS_CSV_N BIT(2)
#define SVC_KEY_ARA_BUTTON KEY_A
struct gb_svc_deferred_request {
@ -283,7 +279,7 @@ static int gb_svc_read_and_clear_module_boot_status(struct gb_interface *intf)
int gb_svc_connection_create(struct gb_svc *svc,
u8 intf1_id, u16 cport1_id,
u8 intf2_id, u16 cport2_id,
bool boot_over_unipro)
u8 cport_flags)
{
struct gb_svc_conn_create_request request;
@ -292,13 +288,7 @@ int gb_svc_connection_create(struct gb_svc *svc,
request.intf2_id = intf2_id;
request.cport2_id = cpu_to_le16(cport2_id);
request.tc = 0; /* TC0 */
/* The ES2/ES3 bootrom requires E2EFC, CSD and CSV to be disabled. */
request.flags = CPORT_FLAGS_CSV_N;
if (boot_over_unipro)
request.flags |= CPORT_FLAGS_CSD_N;
else
request.flags |= CPORT_FLAGS_CSD_N | CPORT_FLAGS_E2EFC;
request.flags = cport_flags;
return gb_operation_sync(svc->connection, GB_SVC_TYPE_CONN_CREATE,
&request, sizeof(request), NULL, 0);

Просмотреть файл

@ -10,6 +10,10 @@
#ifndef __SVC_H
#define __SVC_H
#define GB_SVC_CPORT_FLAG_E2EFC BIT(0)
#define GB_SVC_CPORT_FLAG_CSD_N BIT(1)
#define GB_SVC_CPORT_FLAG_CSV_N BIT(2)
enum gb_svc_state {
GB_SVC_STATE_RESET,
GB_SVC_STATE_PROTOCOL_VERSION,
@ -46,7 +50,7 @@ void gb_svc_put(struct gb_svc *svc);
int gb_svc_intf_reset(struct gb_svc *svc, u8 intf_id);
int gb_svc_connection_create(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
u8 intf2_id, u16 cport2_id, bool boot_over_unipro);
u8 intf2_id, u16 cport2_id, u8 cport_flags);
void gb_svc_connection_destroy(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
u8 intf2_id, u16 cport2_id);
int gb_svc_intf_eject(struct gb_svc *svc, u8 intf_id);