[PATCH 2/2] mtd: make spinand driver usable without CONFIG_DM

Jagan Teki jagan at amarulasolutions.com
Sat Jul 11 11:45:13 CEST 2020


On Sat, Jul 11, 2020 at 3:06 PM Mikhail Kshevetskiy
<mkshevetskiy at oktetlabs.ru> wrote:
>
> On Sat, 11 Jul 2020 14:16:23 +0530
> Jagan Teki <jagan at amarulasolutions.com> wrote:
>
> > On Mon, Jun 22, 2020 at 9:25 PM Mikhail Kshevetskiy
> > <mikhail.kshevetskiy at oktetlabs.ru> wrote:
> > >
> > > From: Mikhail Kshevetskiy <Mikhail.Kshevetskiy at oktetlabs.ru>
> > >
> > > Here is an example of spinand driver initialization without CONFIG_DM
> > > enabled:
> > >
> > > void board_nand_init(void)
> > > {
> > >         static struct spinand_device    spinand;
> > >         static struct mtd_info          mtd;
> > >         static struct spi_slave         *slave;
> > >         int                             ret;
> > >
> > >         memset(&spinand, 0, sizeof(spinand));
> > >         memset(&mtd, 0, sizeof(mtd));
> > >
> > >         slave = spi_setup_slave(BUS, CS, MAX_HZ, MODE);
> > >         if (!slave) {
> > >                 printf("SPI-NAND: Failed to set up SPI slave\n");
> > >                 return;
> > >         }
> > >
> > >         slave->mode |= (SPI_TX_BYTE | SPI_RX_SLOW);
> > >         slave->max_read_size = SPI_MAX_READ_SIZE;
> > >         slave->max_write_size = SPI_MAX_WRITE_SIZE;
> > >
> > >         ret = spinand_probe_no_dm(&spinand, slave, &mtd);
> > >         if (!ret)
> > >                 nand_register(0, &mtd);
> > > }
> > >
> > > Using of dual and quad wire transfer modes requires:
> > > * dual/quad speed capable hardware (both controller and flash)
> > > * physical presence of 4 data wires (quad mode only)
> > > * spi controller driver MUST supports slave->mem_ops.exec_op() operations
> > >   (spi_xfer() interface will suits for single speed data transfer mode
> > >   only)
> > >
> > > Signed-off-by: Mikhail Kshevetskiy <Mikhail.Kshevetskiy at oktetlabs.ru>
> > > ---
> >
> > Now it's time for dm only code, better not come up with nondm anymore
> > as possible, please.
> >
> > Jagan.
>
> I know about it. These patches were in the queue for upstreaming from the new
> year :-(
>
> We are using 2010 and 2016 year based u-boot in our projects and due to some
> reasons it's not easy to switch it to DM build. This two patches helps us with
> backporting of spinand driver from upsteam u-boot. I think we are not an only
> users of old u-boot in the world, so it maybe helpful for other people as well.

Yes, I agree with this point in terms of MTD code is a concern.
However, supporting nondm at this point look traversing in the reverse
direction as per as U-Boot development is a concern. I can guarantee
that the community is always helping to improve code if you wish to
use/migrate the mainline at any point.

>
> Just ignore these two patches if you think that NODM era is completely over.

Thanks.

Jagan.


More information about the U-Boot mailing list