From: Thomas Chou Date: Tue, 22 Sep 2015 15:41:21 +0800 Subject: [U-Boot] [PATCH] spi: ignore set speed and mode if not available Message-ID: <1442907681-14489-1-git-send-email-thomas@wytron.com.tw> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Some cores, such as Altera SPI and QuadSPI, can not change speed and mode at runtime. Ignore the operation which is not available. Signed-off-by: Thomas Chou --- drivers/spi/spi-uclass.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index d666272..5298073 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -21,13 +21,11 @@ DECLARE_GLOBAL_DATA_PTR; static int spi_set_speed_mode(struct udevice *bus, int speed, int mode) { struct dm_spi_ops *ops; - int ret; + int ret = 0; ops = spi_get_ops(bus); if (ops->set_speed) ret = ops->set_speed(bus, speed); - else - ret = -EINVAL; if (ret) { printf("Cannot set speed (err=%d)\n", ret); return ret; @@ -35,8 +33,6 @@ static int spi_set_speed_mode(struct udevice *bus, int speed, int mode) if (ops->set_mode) ret = ops->set_mode(bus, mode); - else - ret = -EINVAL; if (ret) { printf("Cannot set mode (err=%d)\n", ret); return ret; -- 2.1.4