aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-05-23 09:37:01 -0400
committerTom Rini <trini@konsulko.com>2022-05-23 09:37:01 -0400
commit0d794c6f4dd8eb3368296eb746ac82b374a0fe4c (patch)
tree6f2400eadf598b14dd870d932474f889a8eb5503
parent004d30c786056d443d40428c4b1c11e2f8f0bc32 (diff)
parentc1abf7659c9b29874d9d718df6890de1638cedba (diff)
downloadu-boot-WIP/23May2022.zip
u-boot-WIP/23May2022.tar.gz
u-boot-WIP/23May2022.tar.bz2
Merge branch '2022-05-23-regression-fixes'WIP/23May2022
- Fix PowerPC NOR booting, important SPI uclass fixes/updates, gic_v2 fix when CPU is not in EL3, fsl_esdhc_spl fix, and squashfs fix for linking on some architectures.
-rw-r--r--Makefile2
-rw-r--r--arch/arm/lib/gic_64.S5
-rw-r--r--arch/powerpc/dts/u-boot.dtsi2
-rw-r--r--board/CZ.NIC/turris_mox/turris_mox.c6
-rw-r--r--cmd/sf.c15
-rw-r--r--cmd/spi.c4
-rw-r--r--drivers/mmc/fsl_esdhc_spl.c2
-rw-r--r--drivers/mtd/spi/sf-uclass.c33
-rw-r--r--drivers/net/fm/fm.c4
-rw-r--r--drivers/net/pfe_eth/pfe_firmware.c19
-rw-r--r--drivers/net/sni_netsec.c6
-rw-r--r--drivers/spi/spi-uclass.c66
-rw-r--r--drivers/usb/gadget/max3420_udc.c4
-rw-r--r--env/sf.c1
-rw-r--r--fs/squashfs/sqfs.c5
-rw-r--r--include/spi.h19
-rw-r--r--include/spi_flash.h1
-rw-r--r--test/dm/spi.c33
18 files changed, 148 insertions, 79 deletions
diff --git a/Makefile b/Makefile
index e3ce287..107685e 100644
--- a/Makefile
+++ b/Makefile
@@ -1263,7 +1263,7 @@ spl/u-boot-spl.srec: spl/u-boot-spl FORCE
OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
$(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
- $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -R .resetvec)
+ $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),$(if $(CONFIG_OF_EMBED),,-R .bootpg -R .resetvec))
binary_size_check: u-boot-nodtb.bin FORCE
@file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
diff --git a/arch/arm/lib/gic_64.S b/arch/arm/lib/gic_64.S
index 155212a..86cd882 100644
--- a/arch/arm/lib/gic_64.S
+++ b/arch/arm/lib/gic_64.S
@@ -40,6 +40,8 @@ ENTRY(gic_init_secure)
sub w10, w10, #0x1
cbnz w10, 0b
#elif defined(CONFIG_GICV2)
+ switch_el x1, 2f, 1f, 1f
+2:
mov w9, #0x3 /* EnableGrp0 | EnableGrp1 */
str w9, [x0, GICD_CTLR] /* Secure GICD_CTLR */
ldr w9, [x0, GICD_TYPER]
@@ -141,6 +143,8 @@ ENTRY(gic_init_secure_percpu)
* x0: Distributor Base
* x1: Cpu Interface Base
*/
+ switch_el x2, 4f, 5f, 5f
+4:
mov w9, #~0 /* Config SGIs and PPIs as Grp1 */
str w9, [x0, GICD_IGROUPRn] /* GICD_IGROUPR0 */
mov w9, #0x1 /* Enable SGI 0 */
@@ -155,6 +159,7 @@ ENTRY(gic_init_secure_percpu)
mov w9, #0x1 << 7 /* Non-Secure access to GICC_PMR */
str w9, [x1, GICC_PMR]
#endif
+5:
ret
ENDPROC(gic_init_secure_percpu)
diff --git a/arch/powerpc/dts/u-boot.dtsi b/arch/powerpc/dts/u-boot.dtsi
index 9661f4d..67de476 100644
--- a/arch/powerpc/dts/u-boot.dtsi
+++ b/arch/powerpc/dts/u-boot.dtsi
@@ -20,7 +20,7 @@
u-boot-dtb-with-ucode {
#ifdef CONFIG_MPC85xx
- align = <256>;
+ align = <4>;
#endif
};
#ifdef CONFIG_MPC85XX_HAVE_RESET_VECTOR
diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index a4738b3..68bc315 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -149,9 +149,9 @@ static int mox_do_spi(u8 *in, u8 *out, size_t size)
struct udevice *dev;
int ret;
- ret = spi_get_bus_and_cs(0, 1, 1000000, SPI_CPHA | SPI_CPOL,
- "spi_generic_drv", "moxtet@1", &dev,
- &slave);
+ ret = _spi_get_bus_and_cs(0, 1, 1000000, SPI_CPHA | SPI_CPOL,
+ "spi_generic_drv", "moxtet@1", &dev,
+ &slave);
if (ret)
goto fail;
diff --git a/cmd/sf.c b/cmd/sf.c
index 8bdebd9..8713736 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -91,6 +91,7 @@ static int do_spi_flash_probe(int argc, char *const argv[])
unsigned int speed = CONFIG_SF_DEFAULT_SPEED;
unsigned int mode = CONFIG_SF_DEFAULT_MODE;
char *endp;
+ bool use_dt = true;
#if CONFIG_IS_ENABLED(DM_SPI_FLASH)
struct udevice *new, *bus_dev;
int ret;
@@ -117,11 +118,13 @@ static int do_spi_flash_probe(int argc, char *const argv[])
speed = simple_strtoul(argv[2], &endp, 0);
if (*argv[2] == 0 || *endp != 0)
return -1;
+ use_dt = false;
}
if (argc >= 4) {
mode = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return -1;
+ use_dt = false;
}
#if CONFIG_IS_ENABLED(DM_SPI_FLASH)
@@ -131,14 +134,18 @@ static int do_spi_flash_probe(int argc, char *const argv[])
device_remove(new, DM_REMOVE_NORMAL);
}
flash = NULL;
- ret = spi_flash_probe_bus_cs(bus, cs, speed, mode, &new);
- if (ret) {
+ if (use_dt) {
+ spi_flash_probe_bus_cs(bus, cs, &new);
+ flash = dev_get_uclass_priv(new);
+ } else {
+ flash = spi_flash_probe(bus, cs, speed, mode);
+ }
+
+ if (!flash) {
printf("Failed to initialize SPI flash at %u:%u (error %d)\n",
bus, cs, ret);
return 1;
}
-
- flash = dev_get_uclass_priv(new);
#else
if (flash)
spi_flash_free(flash);
diff --git a/cmd/spi.c b/cmd/spi.c
index 6dc3267..454ebe3 100644
--- a/cmd/spi.c
+++ b/cmd/spi.c
@@ -46,8 +46,8 @@ static int do_spi_xfer(int bus, int cs)
str = strdup(name);
if (!str)
return -ENOMEM;
- ret = spi_get_bus_and_cs(bus, cs, freq, mode, "spi_generic_drv",
- str, &dev, &slave);
+ ret = _spi_get_bus_and_cs(bus, cs, freq, mode, "spi_generic_drv",
+ str, &dev, &slave);
if (ret)
return ret;
#else
diff --git a/drivers/mmc/fsl_esdhc_spl.c b/drivers/mmc/fsl_esdhc_spl.c
index ea8f4cd6..760f13d 100644
--- a/drivers/mmc/fsl_esdhc_spl.c
+++ b/drivers/mmc/fsl_esdhc_spl.c
@@ -106,7 +106,7 @@ again:
blk_off = (sector * 512) % mmc->read_bl_len;
blk_cnt = DIV_ROUND_UP(512, mmc->read_bl_len);
err = mmc->block_dev.block_read(&mmc->block_dev, blk_start, blk_cnt, tmp_buf);
- if (err != 1) {
+ if (err != blk_cnt) {
puts("spl: mmc read failed!!\n");
hang();
}
diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c
index 63d1629..e6e650e 100644
--- a/drivers/mtd/spi/sf-uclass.c
+++ b/drivers/mtd/spi/sf-uclass.c
@@ -46,25 +46,12 @@ int spl_flash_get_sw_write_prot(struct udevice *dev)
* TODO(sjg@chromium.org): This is an old-style function. We should remove
* it when all SPI flash drivers use dm
*/
-struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
+struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
unsigned int max_hz, unsigned int spi_mode)
{
- struct udevice *dev;
-
- if (spi_flash_probe_bus_cs(bus, cs, max_hz, spi_mode, &dev))
- return NULL;
-
- return dev_get_uclass_priv(dev);
-}
-
-int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
- unsigned int max_hz, unsigned int spi_mode,
- struct udevice **devp)
-{
struct spi_slave *slave;
struct udevice *bus;
char *str;
- int ret;
#if defined(CONFIG_SPL_BUILD) && CONFIG_IS_ENABLED(USE_TINY_PRINTF)
str = "spi_flash";
@@ -74,8 +61,22 @@ int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
snprintf(name, sizeof(name), "spi_flash@%d:%d", busnum, cs);
str = strdup(name);
#endif
- ret = spi_get_bus_and_cs(busnum, cs, max_hz, spi_mode,
- "jedec_spi_nor", str, &bus, &slave);
+
+ if (_spi_get_bus_and_cs(busnum, cs, max_hz, spi_mode,
+ "jedec_spi_nor", str, &bus, &slave))
+ return NULL;
+
+ return dev_get_uclass_priv(slave->dev);
+}
+
+int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
+ struct udevice **devp)
+{
+ struct spi_slave *slave;
+ struct udevice *bus;
+ int ret;
+
+ ret = spi_get_bus_and_cs(busnum, cs, &bus, &slave);
if (ret)
return ret;
diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c
index f825612..d0b492b 100644
--- a/drivers/net/fm/fm.c
+++ b/drivers/net/fm/fm.c
@@ -388,7 +388,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
/* speed and mode will be read from DT */
ret = spi_flash_probe_bus_cs(CONFIG_SF_DEFAULT_BUS,
- CONFIG_SF_DEFAULT_CS, 0, 0, &new);
+ CONFIG_SF_DEFAULT_CS, &new);
ucode_flash = dev_get_uclass_priv(new);
#else
@@ -475,7 +475,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
/* speed and mode will be read from DT */
ret = spi_flash_probe_bus_cs(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS,
- 0, 0, &new);
+ &new);
ucode_flash = dev_get_uclass_priv(new);
#else
diff --git a/drivers/net/pfe_eth/pfe_firmware.c b/drivers/net/pfe_eth/pfe_firmware.c
index 6669048..82a4aa8 100644
--- a/drivers/net/pfe_eth/pfe_firmware.c
+++ b/drivers/net/pfe_eth/pfe_firmware.c
@@ -172,31 +172,20 @@ static int pfe_fit_check(void)
int pfe_spi_flash_init(void)
{
struct spi_flash *pfe_flash;
- struct udevice *new;
int ret = 0;
void *addr = malloc(CONFIG_SYS_LS_PFE_FW_LENGTH);
if (!addr)
return -ENOMEM;
- ret = spi_flash_probe_bus_cs(CONFIG_SYS_FSL_PFE_SPI_BUS,
- CONFIG_SYS_FSL_PFE_SPI_CS,
- CONFIG_SYS_FSL_PFE_SPI_MAX_HZ,
- CONFIG_SYS_FSL_PFE_SPI_MODE,
- &new);
- if (ret) {
- printf("SF: failed to probe spi\n");
- free(addr);
- device_remove(new, DM_REMOVE_NORMAL);
- return ret;
- }
-
+ pfe_flash = spi_flash_probe(CONFIG_SYS_FSL_PFE_SPI_BUS,
+ CONFIG_SYS_FSL_PFE_SPI_CS,
+ CONFIG_SYS_FSL_PFE_SPI_MAX_HZ,
+ CONFIG_SYS_FSL_PFE_SPI_MODE);
- pfe_flash = dev_get_uclass_priv(new);
if (!pfe_flash) {
printf("SF: probe for pfe failed\n");
free(addr);
- device_remove(new, DM_REMOVE_NORMAL);
return -ENODEV;
}
diff --git a/drivers/net/sni_netsec.c b/drivers/net/sni_netsec.c
index 24caacf..9780f20 100644
--- a/drivers/net/sni_netsec.c
+++ b/drivers/net/sni_netsec.c
@@ -621,12 +621,10 @@ static int netsec_stop_gmac(struct netsec_priv *priv)
static void netsec_spi_read(char *buf, loff_t len, loff_t offset)
{
- struct udevice *new;
struct spi_flash *flash;
- spi_flash_probe_bus_cs(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS,
- CONFIG_SF_DEFAULT_SPEED, CONFIG_SF_DEFAULT_MODE, &new);
- flash = dev_get_uclass_priv(new);
+ flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS,
+ CONFIG_SF_DEFAULT_SPEED, CONFIG_SF_DEFAULT_MODE);
spi_flash_read(flash, offset, len, buf);
}
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index f8ec312..f2791c4 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -340,9 +340,65 @@ int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp,
return ret;
}
-int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
- const char *drv_name, const char *dev_name,
- struct udevice **busp, struct spi_slave **devp)
+int spi_get_bus_and_cs(int busnum, int cs, struct udevice **busp,
+ struct spi_slave **devp)
+{
+ struct udevice *bus, *dev;
+ struct dm_spi_bus *bus_data;
+ struct spi_slave *slave;
+ int ret;
+
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+ ret = uclass_first_device_err(UCLASS_SPI, &bus);
+#else
+ ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
+#endif
+ if (ret) {
+ log_err("Invalid bus %d (err=%d)\n", busnum, ret);
+ return ret;
+ }
+ ret = spi_find_chip_select(bus, cs, &dev);
+ if (ret) {
+ dev_err(bus, "Invalid chip select %d:%d (err=%d)\n", busnum, cs, ret);
+ return ret;
+ }
+
+ if (!device_active(dev)) {
+ struct spi_slave *slave;
+
+ ret = device_probe(dev);
+ if (ret)
+ goto err;
+ slave = dev_get_parent_priv(dev);
+ slave->dev = dev;
+ }
+
+ slave = dev_get_parent_priv(dev);
+ bus_data = dev_get_uclass_priv(bus);
+
+ /*
+ * In case the operation speed is not yet established by
+ * dm_spi_claim_bus() ensure the bus is configured properly.
+ */
+ if (!bus_data->speed) {
+ ret = spi_claim_bus(slave);
+ if (ret)
+ goto err;
+ }
+ *busp = bus;
+ *devp = slave;
+
+ return 0;
+
+err:
+ log_debug("%s: Error path, device '%s'\n", __func__, dev->name);
+
+ return ret;
+}
+
+int _spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
+ const char *drv_name, const char *dev_name,
+ struct udevice **busp, struct spi_slave **devp)
{
struct udevice *bus, *dev;
struct dm_spi_slave_plat *plat;
@@ -453,8 +509,8 @@ struct spi_slave *spi_setup_slave(unsigned int busnum, unsigned int cs,
struct udevice *dev;
int ret;
- ret = spi_get_bus_and_cs(busnum, cs, speed, mode, NULL, 0, &dev,
- &slave);
+ ret = _spi_get_bus_and_cs(busnum, cs, speed, mode, NULL, 0, &dev,
+ &slave);
if (ret)
return NULL;
diff --git a/drivers/usb/gadget/max3420_udc.c b/drivers/usb/gadget/max3420_udc.c
index a16095f..fa655c9 100644
--- a/drivers/usb/gadget/max3420_udc.c
+++ b/drivers/usb/gadget/max3420_udc.c
@@ -830,8 +830,8 @@ static int max3420_udc_probe(struct udevice *dev)
cs = slave_pdata->cs;
speed = slave_pdata->max_hz;
mode = slave_pdata->mode;
- spi_get_bus_and_cs(busnum, cs, speed, mode, "spi_generic_drv",
- NULL, &spid, &udc->slave);
+ _spi_get_bus_and_cs(busnum, cs, speed, mode, false, "spi_generic_drv",
+ NULL, &spid, &udc->slave);
udc->dev = dev;
udc->gadget.ep0 = &udc->ep[0].ep_usb;
diff --git a/env/sf.c b/env/sf.c
index d2c07cd..4b76854 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -48,7 +48,6 @@ static int setup_flash_device(struct spi_flash **env_flash)
/* speed and mode will be read from DT */
ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
- CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE,
&new);
if (ret) {
env_set_default("spi_flash_probe_bus_cs() failed", 0);
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index b07c41e..b4484fa 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -8,6 +8,7 @@
*/
#include <asm/unaligned.h>
+#include <div64.h>
#include <errno.h>
#include <fs.h>
#include <linux/types.h>
@@ -1442,7 +1443,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
for (j = 0; j < datablk_count; j++) {
char *data_buffer;
- start = data_offset / ctxt.cur_dev->blksz;
+ start = lldiv(data_offset, ctxt.cur_dev->blksz);
table_size = SQFS_BLOCK_SIZE(finfo.blk_sizes[j]);
table_offset = data_offset - (start * ctxt.cur_dev->blksz);
n_blks = DIV_ROUND_UP(table_size + table_offset,
@@ -1516,7 +1517,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
goto out;
}
- start = frag_entry.start / ctxt.cur_dev->blksz;
+ start = lldiv(frag_entry.start, ctxt.cur_dev->blksz);
table_size = SQFS_BLOCK_SIZE(frag_entry.size);
table_offset = frag_entry.start - (start * ctxt.cur_dev->blksz);
n_blks = DIV_ROUND_UP(table_size + table_offset, ctxt.cur_dev->blksz);
diff --git a/include/spi.h b/include/spi.h
index fa9ab12..9a8c1fb 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -572,6 +572,23 @@ int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp,
* Given a bus number and chip select, this finds the corresponding bus
* device and slave device.
*
+ * @busnum: SPI bus number
+ * @cs: Chip select to look for
+ * @busp: Returns bus device
+ * @devp: Return slave device
+ * @return 0 if found, -ve on error
+ */
+int spi_get_bus_and_cs(int busnum, int cs,
+ struct udevice **busp, struct spi_slave **devp);
+
+/**
+ * _spi_get_bus_and_cs() - Find and activate bus and slave devices by number
+ * As spi_flash_probe(), This is an old-style function. We should remove
+ * it when all SPI flash drivers use dm
+ *
+ * Given a bus number and chip select, this finds the corresponding bus
+ * device and slave device.
+ *
* If no such slave exists, and drv_name is not NULL, then a new slave device
* is automatically bound on this chip select with requested speed and mode.
*
@@ -588,7 +605,7 @@ int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp,
* @devp: Return slave device
* Return: 0 if found, -ve on error
*/
-int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
+int _spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
const char *drv_name, const char *dev_name,
struct udevice **busp, struct spi_slave **devp);
diff --git a/include/spi_flash.h b/include/spi_flash.h
index d33d0dd..10d19fd 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -102,7 +102,6 @@ int spl_flash_get_sw_write_prot(struct udevice *dev);
int spi_flash_std_probe(struct udevice *dev);
int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
- unsigned int max_hz, unsigned int spi_mode,
struct udevice **devp);
/* Compatibility function - this is the old U-Boot API */
diff --git a/test/dm/spi.c b/test/dm/spi.c
index ee4ad3a..325799b 100644
--- a/test/dm/spi.c
+++ b/test/dm/spi.c
@@ -46,19 +46,18 @@ static int dm_test_spi_find(struct unit_test_state *uts)
/* This finds nothing because we removed the device */
ut_asserteq(-ENODEV, spi_find_bus_and_cs(busnum, cs, &bus, &dev));
- ut_asserteq(-ENODEV, spi_get_bus_and_cs(busnum, cs, speed, mode,
- NULL, 0, &bus, &slave));
+ ut_asserteq(-ENODEV, spi_get_bus_and_cs(busnum, cs, &bus, &slave));
/*
* This forces the device to be re-added, but there is no emulation
* connected so the probe will fail. We require that bus is left
- * alone on failure, and that the spi_get_bus_and_cs() does not add
+ * alone on failure, and that the _spi_get_bus_and_cs() does not add
* a 'partially-inited' device.
*/
ut_asserteq(-ENODEV, spi_find_bus_and_cs(busnum, cs, &bus, &dev));
- ut_asserteq(-ENOENT, spi_get_bus_and_cs(busnum, cs, speed, mode,
- "jedec_spi_nor", "name", &bus,
- &slave));
+ ut_asserteq(-ENOENT, _spi_get_bus_and_cs(busnum, cs, speed, mode,
+ "jedec_spi_nor", "name", &bus,
+ &slave));
sandbox_sf_unbind_emul(state_get_current(), busnum, cs);
ut_assertok(spi_cs_info(bus, cs, &info));
ut_asserteq_ptr(NULL, info.dev);
@@ -67,8 +66,8 @@ static int dm_test_spi_find(struct unit_test_state *uts)
ut_assertok(sandbox_sf_bind_emul(state, busnum, cs, bus, node,
"name"));
ut_assertok(spi_find_bus_and_cs(busnum, cs, &bus, &dev));
- ut_assertok(spi_get_bus_and_cs(busnum, cs, speed, mode,
- "jedec_spi_nor", "name", &bus, &slave));
+ ut_assertok(_spi_get_bus_and_cs(busnum, cs, speed, mode,
+ "jedec_spi_nor", "name", &bus, &slave));
ut_assertok(spi_cs_info(bus, cs, &info));
ut_asserteq_ptr(info.dev, slave->dev);
@@ -76,8 +75,9 @@ static int dm_test_spi_find(struct unit_test_state *uts)
/* We should be able to add something to another chip select */
ut_assertok(sandbox_sf_bind_emul(state, busnum, cs_b, bus, node,
"name"));
- ut_asserteq(-EINVAL, spi_get_bus_and_cs(busnum, cs_b, speed, mode,
- "jedec_spi_nor", "name", &bus, &slave));
+ ut_asserteq(-EINVAL, _spi_get_bus_and_cs(busnum, cs_b, speed, mode,
+ "jedec_spi_nor", "name", &bus,
+ &slave));
ut_asserteq(-EINVAL, spi_cs_info(bus, cs_b, &info));
ut_asserteq_ptr(NULL, info.dev);
@@ -142,14 +142,12 @@ static int dm_test_spi_claim_bus(struct unit_test_state *uts)
struct udevice *bus;
struct spi_slave *slave_a, *slave_b;
struct dm_spi_slave_plat *slave_plat;
- const int busnum = 0, cs_a = 0, cs_b = 1, mode = 0;
+ const int busnum = 0, cs_a = 0, cs_b = 1;
/* Get spi slave on CS0 */
- ut_assertok(spi_get_bus_and_cs(busnum, cs_a, 1000000, mode, NULL, 0,
- &bus, &slave_a));
+ ut_assertok(spi_get_bus_and_cs(busnum, cs_a, &bus, &slave_a));
/* Get spi slave on CS1 */
- ut_assertok(spi_get_bus_and_cs(busnum, cs_b, 1000000, mode, NULL, 0,
- &bus, &slave_b));
+ ut_assertok(spi_get_bus_and_cs(busnum, cs_b, &bus, &slave_b));
/* Different max_hz, different mode. */
ut_assert(slave_a->max_hz != slave_b->max_hz);
@@ -178,12 +176,11 @@ static int dm_test_spi_xfer(struct unit_test_state *uts)
{
struct spi_slave *slave;
struct udevice *bus;
- const int busnum = 0, cs = 0, mode = 0;
+ const int busnum = 0, cs = 0;
const char dout[5] = {0x9f};
unsigned char din[5];
- ut_assertok(spi_get_bus_and_cs(busnum, cs, 1000000, mode, NULL, 0,
- &bus, &slave));
+ ut_assertok(spi_get_bus_and_cs(busnum, cs, &bus, &slave));
ut_assertok(spi_claim_bus(slave));
ut_assertok(spi_xfer(slave, 40, dout, din,
SPI_XFER_BEGIN | SPI_XFER_END));