gb_request_handler_t handler;
unsigned long flags;
- u8 module_major;
- u8 module_minor;
-
struct mutex mutex;
spinlock_t lock;
enum gb_connection_state state;
}
EXPORT_SYMBOL_GPL(gb_gbphy_deregister_driver);
-int gb_gbphy_get_version(struct gb_connection *connection)
-{
- struct gb_protocol_version_request request;
- struct gb_protocol_version_response response;
- int retval;
-
- request.major = 1;
- request.minor = 0;
-
- retval = gb_operation_sync(connection, GB_REQUEST_TYPE_PROTOCOL_VERSION,
- &request, sizeof(request), &response,
- sizeof(response));
- if (retval)
- return retval;
-
- /* FIXME - do proper version negotiation here someday... */
-
- connection->module_major = response.major;
- connection->module_minor = response.minor;
-
- dev_dbg(&connection->hd->dev, "%s: v%u.%u\n", connection->name,
- response.major, response.minor);
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(gb_gbphy_get_version);
-
static struct gbphy_device *gb_gbphy_create_dev(struct gb_bundle *bundle,
struct greybus_descriptor_cport *cport_desc)
{
};
#define to_gbphy_driver(d) container_of(d, struct gbphy_driver, driver)
-int gb_gbphy_get_version(struct gb_connection *connection);
int gb_gbphy_register_driver(struct gbphy_driver *driver,
struct module *owner, const char *mod_name);
void gb_gbphy_deregister_driver(struct gbphy_driver *driver);
if (ret)
goto exit_connection_destroy;
- ret = gb_gbphy_get_version(connection);
- if (ret)
- goto exit_connection_disable;
-
ret = gb_gpio_controller_setup(ggc);
if (ret)
goto exit_connection_disable;
/* Generic request types */
#define GB_REQUEST_TYPE_PING 0x00
-#define GB_REQUEST_TYPE_PROTOCOL_VERSION 0x01
#define GB_REQUEST_TYPE_INVALID 0x7f
struct gb_protocol_version_request {
/* I2C */
-/* Version of the Greybus i2c protocol we support */
-#define GB_I2C_VERSION_MAJOR 0x00
-#define GB_I2C_VERSION_MINOR 0x01
-
/* Greybus i2c request types */
#define GB_I2C_TYPE_FUNCTIONALITY 0x02
#define GB_I2C_TYPE_TRANSFER 0x05
/* GPIO */
-/* Version of the Greybus GPIO protocol we support */
-#define GB_GPIO_VERSION_MAJOR 0x00
-#define GB_GPIO_VERSION_MINOR 0x01
-
/* Greybus GPIO request types */
#define GB_GPIO_TYPE_LINE_COUNT 0x02
#define GB_GPIO_TYPE_ACTIVATE 0x03
/* PWM */
-/* Version of the Greybus PWM protocol we support */
-#define GB_PWM_VERSION_MAJOR 0x00
-#define GB_PWM_VERSION_MINOR 0x01
-
/* Greybus PWM operation types */
#define GB_PWM_TYPE_PWM_COUNT 0x02
#define GB_PWM_TYPE_ACTIVATE 0x03
/* SPI */
-/* Version of the Greybus spi protocol we support */
-#define GB_SPI_VERSION_MAJOR 0x00
-#define GB_SPI_VERSION_MINOR 0x01
-
/* Should match up with modes in linux/spi/spi.h */
#define GB_SPI_MODE_CPHA 0x01 /* clock phase */
#define GB_SPI_MODE_CPOL 0x02 /* clock polarity */
/* UART */
-/* Version of the Greybus UART protocol we support */
-#define GB_UART_VERSION_MAJOR 0x00
-#define GB_UART_VERSION_MINOR 0x01
-
/* Greybus UART operation types */
#define GB_UART_TYPE_SEND_DATA 0x02
#define GB_UART_TYPE_RECEIVE_DATA 0x03 /* Unsolicited data */
} __packed;
/* SDIO */
-/* Version of the Greybus sdio protocol we support */
-#define GB_SDIO_VERSION_MAJOR 0x00
-#define GB_SDIO_VERSION_MINOR 0x01
-
/* Greybus SDIO operation types */
#define GB_SDIO_TYPE_GET_CAPABILITIES 0x02
#define GB_SDIO_TYPE_SET_IOS 0x03
if (ret)
goto exit_connection_destroy;
- ret = gb_gbphy_get_version(connection);
- if (ret)
- goto exit_connection_disable;
-
ret = gb_i2c_device_setup(gb_i2c_dev);
if (ret)
goto exit_connection_disable;
if (ret)
goto exit_connection_destroy;
- ret = gb_gbphy_get_version(connection);
- if (ret)
- goto exit_connection_disable;
-
/* Query number of pwms present */
ret = gb_pwm_count_operation(pwmc);
if (ret)
if (ret)
goto exit_connection_destroy;
- ret = gb_gbphy_get_version(connection);
- if (ret)
- goto exit_connection_disable;
-
ret = gb_sdio_get_caps(host);
if (ret < 0)
goto exit_connection_disable;
if (ret)
goto exit_connection_destroy;
- ret = gb_gbphy_get_version(connection);
- if (ret)
- goto exit_connection_disable;
-
ret = gb_spilib_master_init(connection, &gbphy_dev->dev);
if (ret)
goto exit_connection_disable;
if (retval)
goto exit_release_minor;
- retval = gb_gbphy_get_version(connection);
- if (retval)
- goto exit_connection_disable;
-
send_control(gb_tty, gb_tty->ctrlout);
/* initialize the uart to be 9600n81 */
if (retval)
goto exit_connection_destroy;
- retval = gb_gbphy_get_version(connection);
- if (retval)
- goto exit_connection_disable;
-
/*
* FIXME: The USB bridged-PHY protocol driver depends on changes to
* USB core which are not yet upstream.