[PATCH 2/2] mtd: make spinand driver usable without CONFIG_DM
Jagan Teki
jagan at amarulasolutions.com
Sat Jul 11 10:46:23 CEST 2020
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.
More information about the U-Boot
mailing list