[U-Boot] [PATCH] spi : convert altera_spi to driver model

Marek Vasut marex at denx.de
Tue Sep 22 02:10:26 CEST 2015


On Monday, September 21, 2015 at 02:58:31 PM, Thomas Chou wrote:
> Convert altera_spi to driver model
> 
> Signed-off-by: Thomas Chou <thomas at wytron.com.tw>

Hi!

> ---
>  drivers/spi/Kconfig      |   8 ++
>  drivers/spi/altera_spi.c | 197
> ++++++++++++++++++++++++++--------------------- 2 files changed, 119
> insertions(+), 86 deletions(-)

[...]

> +
> +static int altera_spi_set_speed(struct udevice *bus, uint speed)
> +{
> +	return 0;
> +}
> +
> +static int altera_spi_set_mode(struct udevice *bus, uint mode)
> +{
> +	return 0;
> +}

I suspect you might want to tweak the core code to check if those
.set_speed and .set_mode are assigned in dm_spi_ops structure and
if not, don't call them.

> +static int altera_spi_probe(struct udevice *bus)
> +{
> +	struct altera_spi_platdata *plat = dev_get_platdata(bus);
> +	struct altera_spi_priv *priv = dev_get_priv(bus);
> +
> +	priv->regs = plat->regs;
> +
> +	return 0;
> +}
> +
> +static int altera_spi_ofdata_to_platdata(struct udevice *bus)
> +{
> +	struct altera_spi_platdata *plat = dev_get_platdata(bus);
> +
> +	plat->regs = ioremap(dev_get_addr(bus),
> +		sizeof(struct altera_spi_regs));

I guess the same thing about ioremap() and ranges applies here?

> +	return 0;
> +}

But all these are minor nits, thanks !

[...]


More information about the U-Boot mailing list