Commit ff56bba2d6952176a826bddcd9baf84f61b419a3

Authored by Simon Glass
1 parent e33dc221f4

dm: spi: Correct handling of SPI chip selects in sandbox

This code was not updated when the chip select handling was adjusted. Fix
it to call the correct function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Acked-by: Heiko Schocher <hs@denx.de>

Showing 3 changed files with 12 additions and 11 deletions Side-by-side Diff

drivers/mtd/spi/sandbox.c
... ... @@ -602,7 +602,7 @@
602 602 spec, ret);
603 603 return ret;
604 604 }
605   - ret = device_find_child_by_seq(bus, cs, true, &slave);
  605 + ret = spi_find_chip_select(bus, cs, &slave);
606 606 if (!ret) {
607 607 printf("Chip select %d already exists for spec '%s'\n", cs,
608 608 spec);
drivers/spi/spi-uclass.c
... ... @@ -115,16 +115,7 @@
115 115 return slave ? slave->cs : -ENOENT;
116 116 }
117 117  
118   -/**
119   - * spi_find_chip_select() - Find the slave attached to chip select
120   - *
121   - * @bus: SPI bus to search
122   - * @cs: Chip select to look for
123   - * @devp: Returns the slave device if found
124   - * @return 0 if found, -ENODEV on error
125   - */
126   -static int spi_find_chip_select(struct udevice *bus, int cs,
127   - struct udevice **devp)
  118 +int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp)
128 119 {
129 120 struct udevice *dev;
130 121  
... ... @@ -534,6 +534,16 @@
534 534 int spi_chip_select(struct udevice *slave);
535 535  
536 536 /**
  537 + * spi_find_chip_select() - Find the slave attached to chip select
  538 + *
  539 + * @bus: SPI bus to search
  540 + * @cs: Chip select to look for
  541 + * @devp: Returns the slave device if found
  542 + * @return 0 if found, -ENODEV on error
  543 + */
  544 +int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp);
  545 +
  546 +/**
537 547 * spi_bind_device() - bind a device to a bus's chip select
538 548 *
539 549 * This binds a new device to an given chip select (which must be unused).