summaryrefslogtreecommitdiffstats
path: root/commands/spi.c
diff options
context:
space:
mode:
authorSteffen Trumtrar <s.trumtrar@pengutronix.de>2019-05-03 11:33:52 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-05-08 10:52:51 +0200
commit812a9ddcdf211302a050cf8f61f7af577bc29a23 (patch)
tree430961178aa20b27359782cbec458bae105d1d5b /commands/spi.c
parent5085d2ef3fbfdf3a1834873d2655647ba46dbb03 (diff)
downloadbarebox-812a9ddcdf211302a050cf8f61f7af577bc29a23.tar.gz
barebox-812a9ddcdf211302a050cf8f61f7af577bc29a23.tar.xz
spi: Generalize SPI "master" to "controller"
Sync with Linux v5.1-rc1. This is the barebox adoption of the commit commit 8caab75fd2c2a92667cbb1cd315720bede3feaa9 Author: Geert Uytterhoeven <geert+renesas@glider.be> Date: Tue Jun 13 13:23:52 2017 +0200 spi: Generalize SPI "master" to "controller" Now struct spi_master is used for both SPI master and slave controllers, it makes sense to rename it to struct spi_controller, and replace "master" by "controller" where appropriate. For now this conversion is done for SPI core infrastructure only. Wrappers are provided for backwards compatibility, until all SPI drivers have been converted. Noteworthy details: - SPI_MASTER_GPIO_SS is retained, as it only makes sense for SPI master controllers, - spi_busnum_to_master() is retained, as it looks up masters only, - A new field spi_device.controller is added, but spi_device.master is retained for compatibility (both are always initialized by spi_alloc_device()), - spi_flash_read() is used by SPI masters only. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/spi.c')
-rw-r--r--commands/spi.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/commands/spi.c b/commands/spi.c
index 7bf193b0bb..55a0e255af 100644
--- a/commands/spi.c
+++ b/commands/spi.c
@@ -62,21 +62,21 @@ static int do_spi(int argc, char *argv[])
return COMMAND_ERROR_USAGE;
- spi.master = spi_get_master(bus);
- if (!spi.master) {
+ spi.controller = spi_get_controller(bus);
+ if (!spi.controller) {
printf("spi bus %d not found\n", bus);
return -ENODEV;
}
- if (spi.chip_select >= spi.master->num_chipselect) {
- printf("spi chip select (%d) >= master num chipselect (%d)\n",
- spi.chip_select, spi.master->num_chipselect);
+ if (spi.chip_select >= spi.controller->num_chipselect) {
+ printf("spi chip select (%d) >= controller num chipselect (%d)\n",
+ spi.chip_select, spi.controller->num_chipselect);
return -EINVAL;
}
- ret = spi.master->setup(&spi);
+ ret = spi.controller->setup(&spi);
if (ret) {
- printf("can not setup the master (%d)\n", ret);
+ printf("can not setup the controller (%d)\n", ret);
return ret;
}
@@ -93,7 +93,7 @@ static int do_spi(int argc, char *argv[])
byte_per_word = max(spi.bits_per_word / 8, 1);
if (verbose) {
printf("device config\n");
- printf(" bus_num = %d\n", spi.master->bus_num);
+ printf(" bus_num = %d\n", spi.controller->bus_num);
printf(" max_speed_hz = %d\n", spi.max_speed_hz);
printf(" chip_select = %d\n", spi.chip_select);
printf(" mode = 0x%x\n", spi.mode);