Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50014e07 authored by Rui Miguel Silva's avatar Rui Miguel Silva Committed by Greg Kroah-Hartman
Browse files

greybus: spi: move chipselect to one byte size



Fixed in the specification, some values for chipselect count and index
were different in size, just fix that for all reference to chipselect
and move all to one byte size and remove byte order operations.

Signed-off-by: default avatarRui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent a75fd8ba
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -662,11 +662,11 @@ struct gb_spi_master_config_response {
	__le32	max_speed_hz;
	__le16	mode;
	__le16	flags;
	__le16	num_chipselect;
	__u8	num_chipselect;
} __packed;

struct gb_spi_device_config_request {
	__le16	chip_select;
	__u8	chip_select;
} __packed;

struct gb_spi_device_config_response {
+5 −5
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ struct gb_spi {
	u16			mode;
	u16			flags;
	u32			bits_per_word_mask;
	u16			num_chipselect;
	u8			num_chipselect;
	u32			min_speed_hz;
	u32			max_speed_hz;
	struct spi_device	*spi_devices;
@@ -270,7 +270,7 @@ static int gb_spi_get_master_config(struct gb_spi *spi)
	spi->flags = gb_spi_flags_map(flags);

	spi->bits_per_word_mask = le32_to_cpu(response.bits_per_word_mask);
	spi->num_chipselect = le16_to_cpu(response.num_chipselect);
	spi->num_chipselect = response.num_chipselect;

	spi->min_speed_hz = le32_to_cpu(response.min_speed_hz);
	spi->max_speed_hz = le32_to_cpu(response.max_speed_hz);
@@ -278,7 +278,7 @@ static int gb_spi_get_master_config(struct gb_spi *spi)
	return 0;
}

static int gb_spi_setup_device(struct gb_spi *spi, uint16_t cs)
static int gb_spi_setup_device(struct gb_spi *spi, u8 cs)
{
	struct spi_master *master = get_master_from_spi(spi);
	struct gb_spi_device_config_request request;
@@ -287,7 +287,7 @@ static int gb_spi_setup_device(struct gb_spi *spi, uint16_t cs)
	struct spi_device *spidev = &spi->spi_devices[cs];
	int ret;

	request.chip_select = cpu_to_le16(cs);
	request.chip_select = cs;

	ret = gb_operation_sync(spi->connection, GB_SPI_TYPE_DEVICE_CONFIG,
				&request, sizeof(request),
@@ -331,7 +331,7 @@ static int gb_spi_connection_init(struct gb_connection *connection)
	struct gb_spi *spi;
	struct spi_master *master;
	int ret;
	int i;
	u8 i;

	/* Allocate master with space for data */
	master = spi_alloc_master(&connection->bundle->dev, sizeof(*spi));