summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-uclass.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-10-16 20:23:47 -0400
committerTom Rini <trini@konsulko.com>2022-10-16 20:23:47 -0400
commite2ff1d0fa777b11ad6b26432cb7613ab433b15d6 (patch)
tree905752b31d7b4161ed2f166b3d1ab0d98c07333c /drivers/spi/spi-uclass.c
parent0e49f5c26caf9972137a474065afd4bdfe5ec062 (diff)
parent70089c13a73f58315547982573be2016e7a70958 (diff)
Merge tag 'efi-2023-01-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2023-01-rc1-3 UEFI: * replace EFI_CALL() by internal functions * delete loadfile2 handle by uninstalling all protocols Other: * Provide spi_set_speed() needed for implementation of EFI SPI I/O protocol
Diffstat (limited to 'drivers/spi/spi-uclass.c')
-rw-r--r--drivers/spi/spi-uclass.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index f2791c4b88e..c929e7c1d0e 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -130,6 +130,21 @@ void spi_release_bus(struct spi_slave *slave)
dm_spi_release_bus(slave->dev);
}
+int spi_set_speed(struct spi_slave *slave, uint hz)
+{
+ struct dm_spi_ops *ops;
+ int ret;
+
+ ops = spi_get_ops(slave->dev->parent);
+ if (ops->set_speed)
+ ret = ops->set_speed(slave->dev->parent, hz);
+ else
+ ret = -EINVAL;
+ if (ret)
+ dev_err(slave->dev, "Cannot set speed (err=%d)\n", ret);
+ return ret;
+}
+
int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{