Hi, On 20/02/20 1:43 am, Sergei Shtylyov wrote: [...] >>> +static const struct rpcif_op rpcif_op_tmpl = { >>> + .cmd = { >>> + .buswidth = 8, >>> + .ddr = true, >>> + }, >>> + .ocmd = { >>> + .buswidth = 8, >>> + .ddr = true, >>> + }, >>> + .addr = { >>> + .nbytes = 1, >>> + .buswidth = 8, >>> + .ddr = true, >>> + }, >>> + .data = { >>> + .buswidth = 8, >>> + .ddr = true, >>> + }, >>> +}; >>> + >> >> Looking around, there seems to be more than one SPI controllers, apart >> from Renesas, which also support SPI NOR and HyperFlash protocol within >> a single IP block. E.g.: Cadence xSPI controller [1]. Therefore, we need >> a generic framework to support these kind of controllers. > > We can use e.g. 'struct rpcif_op' as generic command description. > >> One way would be to extend spi_mem_op to support above template along >> with a new field to distinguish SPI NOR vs HyperFlash protocol. HyperBus >> core can then register a spi_device and use spi-mem ops to talk to >> controller driver. > > We have discussed this idea with Mark Brown, the SPI maintainer, and > he wasn't terribly impressed (I've invited him to #mtd -- his nick is > broonie and mine is headless, I'm also adding him to CC:). > I don't see HyperFlash to be very different than Octal DDR SPI NOR flashes. While Octal DDR mode has 2 byte opcode and 4 byte address phase, HF has 6 byte combined cmd-addr phase. There is no support for Octal DDR flash currently. But there have been multiple attempts to add Octal DDR mode support though: https://patchwork.ozlabs.org/patch/982913/ https://lkml.org/lkml/2019/11/15/254 https://patchwork.ozlabs.org/patch/1236285/ >> So, I suggest making Renesas RPC-IF backend a full fledged spi-mem >> driver (instead of driver/memory) and use extended spi_mem_op to support >> HyperFlash. > > I don't think cramming support for the different flash busses into > the SPI drivers is a good idea... I'm not against generalizing the > drivers/memory/ APIs though. > IMO, its easier to extend spi-mem to support HF by adding an additional field to indicate the protocol than creating a new one. But, I am open to other generic ways to support these controllers as well. >> [1] >> https://ip.cadence.com/uploads/1244/cdn-dsd-mem-fla-host-controller-ip-for-xspi-pdf > > Do they have the full datasheet available? I'll try looking at the driver > tomorrow... > I don't see a datasheet, you could probably ask on the patch adding the driver (using the mbox from here: https://patchwork.kernel.org/cover/11354193/). But above document indicates its supports both the flashes. Also have look at JEDEC xSPI spec that combines Octal DDR and HF into a single standard: https://www.jedec.org/standards-documents/docs/jesd251 So, I expect more controllers to support SPI/QSPI + Octal DDR SPI + HF with a single IP. -- Regards Vignesh ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/