]> git.sur5r.net Git - u-boot/blobdiff - drivers/spi/altera_spi.c
ARM: sun6i: Add support for the power reset control module found on the A31
[u-boot] / drivers / spi / altera_spi.c
index 918b2235634d52e5320af1257428da8cf605be9b..5accbb5c22c1e88cd829078c7ad914584020e38d 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (c) 2005-2008 Analog Devices Inc.
  * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
  *
- * Licensed under the GPL-2 or later.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
 #include <asm/io.h>
@@ -70,6 +70,11 @@ void spi_init(void)
 {
 }
 
+void spi_set_speed(struct spi_slave *slave, uint hz)
+{
+       /* altera spi core does not support programmable speed */
+}
+
 struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
                                  unsigned int max_hz, unsigned int mode)
 {
@@ -78,12 +83,10 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
        if (!spi_cs_is_valid(bus, cs))
                return NULL;
 
-       altspi = malloc(sizeof(*altspi));
+       altspi = spi_alloc_slave(struct altera_spi_slave, bus, cs);
        if (!altspi)
                return NULL;
 
-       altspi->slave.bus = bus;
-       altspi->slave.cs = cs;
        altspi->base = altera_spi_base_list[bus];
        debug("%s: bus:%i cs:%i base:%lx\n", __func__,
                bus, cs, altspi->base);