[U-Boot] [PATCH] spi: mxc_spi: support driver model
Jagan Teki
jagannadh.teki at gmail.com
Mon Mar 20 16:17:25 UTC 2017
On Sat, Mar 4, 2017 at 8:17 AM, Peng Fan <peng.fan at nxp.com> wrote:
> Add driver model support for mxc spi driver.
> Most functions are restructured to be reused by DM and non-DM.
> Tested on mx6slevk board.
>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> Cc: Jagan Teki <jagan at openedev.com>
> cc: Stefano Babic <sbabic at denx.de>
> ---
> drivers/spi/mxc_spi.c | 185 +++++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 152 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
> index fc2786e..431e042 100644
> --- a/drivers/spi/mxc_spi.c
> +++ b/drivers/spi/mxc_spi.c
> @@ -5,6 +5,7 @@
> */
>
> #include <common.h>
> +#include <dm.h>
> #include <malloc.h>
> #include <spi.h>
> #include <linux/errno.h>
> @@ -14,6 +15,8 @@
> #include <asm/arch/clock.h>
> #include <asm/imx-common/spi.h>
>
> +DECLARE_GLOBAL_DATA_PTR;
> +
> #ifdef CONFIG_MX27
> /* i.MX27 has a completely wrong register layout and register definitions in the
> * datasheet, the correct one is in the Freescale's Linux driver */
> @@ -22,10 +25,6 @@
> "See linux mxc_spi driver from Freescale for details."
> #endif
>
> -static unsigned long spi_bases[] = {
> - MXC_SPI_BASE_ADDRESSES
> -};
> -
> __weak int board_spi_cs_gpio(unsigned bus, unsigned cs)
> {
> return -1;
> @@ -40,6 +39,8 @@ __weak int board_spi_cs_gpio(unsigned bus, unsigned cs)
> #define CONFIG_SYS_SPI_MXC_WAIT (CONFIG_SYS_HZ/100) /* 10 ms */
> #endif
>
> +#define MXC_SPI_MAX_FREQ 20000000
This need to get it from dt and manuplutae the freq stuf in .set_speed
thanks!
--
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
More information about the U-Boot
mailing list