From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mikhail Kshevetskiy Date: Sat, 11 Jul 2020 12:36:26 +0300 Subject: [PATCH 2/2] mtd: make spinand driver usable without CONFIG_DM In-Reply-To: References: <20200622155431.2825878-1-mikhail.kshevetskiy@oktetlabs.ru> <20200622155431.2825878-2-mikhail.kshevetskiy@oktetlabs.ru> Message-ID: <20200711123626.1c068778@laska.lan> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sat, 11 Jul 2020 14:16:23 +0530 Jagan Teki wrote: > On Mon, Jun 22, 2020 at 9:25 PM Mikhail Kshevetskiy > wrote: > > > > From: Mikhail Kshevetskiy > > > > 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 > > --- > > 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. Just ignore these two patches if you think that NODM era is completely over. Mikhail.