> -----Original Message-----
> From: york sun
> Sent: Thursday, July 28, 2016 1:35 AM
> To: Qianyu Gong <qianyu.g...@nxp.com>; u-boot@lists.denx.de; Prabhakar
> Kushwaha <prabhakar.kushw...@nxp.com>; Mingkai Hu <mingkai...@nxp.com>
> Cc: Shaohui Xie <shaohui....@nxp.com>; Zhiqiang Hou <zhiqiang....@nxp.com>;
> Wenbin Song <wenbin.s...@nxp.com>
> Subject: Re: [PATCH 1/2] net: fm: fix spi flash probe for using driver model
> 
> On 07/20/2016 03:51 AM, Gong Qianyu wrote:
> > The current code would always use the speed and mode set by
> > CONFIG_ENV_SPI_MAX_HZ and CONFIG_ENV_SPI_MODE. But if using SPI driver
> > model it should get the values from DT.
> >
> > Signed-off-by: Gong Qianyu <qianyu.g...@nxp.com>
> > ---
> >  drivers/net/fm/fm.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c index
> > 00cdfd4..6308d22 100644
> > --- a/drivers/net/fm/fm.c
> > +++ b/drivers/net/fm/fm.c
> > @@ -371,8 +371,18 @@ int fm_init_common(int index, struct ccsr_fman *reg)
> >     void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
> >     int ret = 0;
> >
> > +#ifdef CONFIG_DM_SPI_FLASH
> > +   struct udevice *new;
> > +
> > +   /* Will get the speed and mode from Device Tree */
> > +   ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS,
> CONFIG_ENV_SPI_CS,
> > +                                0, 0, &new);
> > +
> > +   ucode_flash = dev_get_uclass_priv(new); #else
> >     ucode_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS,
> CONFIG_ENV_SPI_CS,
> >                     CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
> > +#endif
> >     if (!ucode_flash)
> >             printf("SF: probe for ucode failed\n");
> >     else {
> >
> 
> Why not just use spi_flash_probe() with speed and mode passed as 0?
> 
> York

As Simon said spi_flash_probe() "is an old-style function and would be removed
when all SPI flash drivers use dm", so I think for dm spi_flash_probe_bus_cs()
should be used.


Regards,
Qianyu


_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to