Hello! On 02/18/2020 07:00 AM, Vignesh Raghavendra wrote: >> Add the HyperFLash driver for the Renesas RPC-IF. It's the "front end" >> driver using the "back end" APIs in the main driver to talk to the real >> hardware. >> >> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@xxxxxxxxxxxxxxxxxx> [...] >> Index: linux/drivers/mtd/hyperbus/rpc-if.c >> =================================================================== >> --- /dev/null >> +++ linux/drivers/mtd/hyperbus/rpc-if.c >> @@ -0,0 +1,162 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * Linux driver for RPC-IF HyperFlash >> + * >> + * Copyright (C) 2019 Cogent Embedded, Inc. >> + */ >> + >> +#include <linux/err.h> >> +#include <linux/kernel.h> >> +#include <linux/module.h> >> +#include <linux/mtd/hyperbus.h> >> +#include <linux/mtd/mtd.h> >> +#include <linux/mux/consumer.h> >> +#include <linux/of.h> >> +#include <linux/platform_device.h> >> +#include <linux/types.h> >> + >> +#include <memory/renesas-rpc-if.h> >> + >> +struct rpcif_hyperbus { >> + struct rpcif rpc; >> + struct hyperbus_ctlr ctlr; >> + struct hyperbus_device hbdev; >> +}; >> + >> +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:). > 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. > [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... > Regards > Vignesh [removed the patch you haven't replied to] MBR, Sergei ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/