]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/spi/spi-uclass.c
Merge branch 'master' of git://git.denx.de/u-boot-usb
[karo-tx-uboot.git] / drivers / spi / spi-uclass.c
index 13c6b77d73df350f943b1dd3c77ce8c7e0fef0c3..7a57bceb260f1c3e79fc9ed4d735f1b27c45160b 100644 (file)
@@ -57,7 +57,7 @@ int spi_claim_bus(struct spi_slave *slave)
        speed = slave->max_hz;
        if (spi->max_hz) {
                if (speed)
-                       speed = min(speed, spi->max_hz);
+                       speed = min(speed, (int)spi->max_hz);
                else
                        speed = spi->max_hz;
        }
@@ -115,16 +115,7 @@ int spi_chip_select(struct udevice *dev)
        return slave ? slave->cs : -ENOENT;
 }
 
-/**
- * spi_find_chip_select() - Find the slave attached to chip select
- *
- * @bus:       SPI bus to search
- * @cs:                Chip select to look for
- * @devp:      Returns the slave device if found
- * @return 0 if found, -ENODEV on error
- */
-static int spi_find_chip_select(struct udevice *bus, int cs,
-                               struct udevice **devp)
+int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp)
 {
        struct udevice *dev;
 
@@ -197,27 +188,6 @@ int spi_cs_info(struct udevice *bus, uint cs, struct spi_cs_info *info)
        return -ENODEV;
 }
 
-int spi_bind_device(struct udevice *bus, int cs, const char *drv_name,
-                   const char *dev_name, struct udevice **devp)
-{
-       struct driver *drv;
-       int ret;
-
-       drv = lists_driver_lookup_name(drv_name);
-       if (!drv) {
-               printf("Cannot find driver '%s'\n", drv_name);
-               return -ENOENT;
-       }
-       ret = device_bind(bus, drv, dev_name, NULL, -1, devp);
-       if (ret) {
-               printf("Cannot create device named '%s' (err=%d)\n",
-                      dev_name, ret);
-               return ret;
-       }
-
-       return 0;
-}
-
 int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp,
                        struct udevice **devp)
 {
@@ -264,7 +234,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
        if (ret == -ENODEV && drv_name) {
                debug("%s: Binding new device '%s', busnum=%d, cs=%d, driver=%s\n",
                      __func__, dev_name, busnum, cs, drv_name);
-               ret = spi_bind_device(bus, cs, drv_name, dev_name, &dev);
+               ret = device_bind_driver(bus, drv_name, dev_name, &dev);
                if (ret)
                        return ret;
                created = true;