[PATCH v6] mtd: spi-nor: add hisilicon spi-nor flash controller driver
Ezequiel Garcia
ezequiel at vanguardiasur.com.ar
Fri Feb 5 07:26:18 PST 2016
On 4 February 2016 at 23:25, Jiancheng Xue <xuejiancheng at huawei.com> wrote:
> Add hisilicon spi-nor flash controller driver
>
> Signed-off-by: Jiancheng Xue <xuejiancheng at huawei.com>
> Acked-by: Rob Herring <robh at kernel.org>
> ---
> change log
> v6:
> Based on v4.5-rc2
> Fixed issues pointed by Ezequiel Garcia.
> v5:
> Fixed a compile error.
> v4:
> Rebased to v4.5-rc1
> v3:
> Added a compatible string "hisilicon,hi3519-sfc".
> v2:
> Fixed some compiling warings.
>
> .../devicetree/bindings/spi/spi-hisi-sfc.txt | 25 ++
> This file has already been acked by Rob Herring <robh at kernel.org>.
> drivers/mtd/spi-nor/Kconfig | 6 +
> drivers/mtd/spi-nor/Makefile | 1 +
> drivers/mtd/spi-nor/hisi-sfc.c | 494 +++++++++++++++++++++
> 4 files changed, 526 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/spi/spi-hisi-sfc.txt
> create mode 100644 drivers/mtd/spi-nor/hisi-sfc.c
>
> diff --git a/Documentation/devicetree/bindings/spi/spi-hisi-sfc.txt b/Documentation/devicetree/bindings/spi/spi-hisi-sfc.txt
> new file mode 100644
> index 0000000..7407147
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/spi-hisi-sfc.txt
> @@ -0,0 +1,25 @@
> +HiSilicon SPI-NOR Flash Controller
> +
> +Required properties:
> +- compatible : Should be "hisilicon,hisi-sfc" and one of the following strings:
> + "hisilicon,hi3519-sfc"
> +- address-cells : number of cells required to define a chip select
> + address on the SPI bus. Should be set to 1. See spi-bus.txt.
> +- size-cells : Should be 0.
> +- reg : Offset and length of the register set for the controller device.
> +- reg-names : Must include the following two entries: "control", "memory".
> +- clocks : handle to spi-nor flash controller clock.
> +
> +Example:
> +spi-nor-controller at 10000000 {
> + compatible = "hisilicon,hi3519-sfc", "hisilicon,hisi-sfc";
> + #address-cells = <1>;
> + #size-cells = <0>;
> + reg = <0x10000000 0x1000>, <0x14000000 0x1000000>;
> + reg-names = "control", "memory";
> + clocks = <&clock HI3519_FMC_CLK>;
> + spi-nor at 0 {
> + compatible = "jedec,spi-nor";
> + reg = <0>;
> + };
> +};
> diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
> index 0dc9275..763e48a 100644
> --- a/drivers/mtd/spi-nor/Kconfig
> +++ b/drivers/mtd/spi-nor/Kconfig
> @@ -37,6 +37,12 @@ config SPI_FSL_QUADSPI
> This controller does not support generic SPI. It only supports
> SPI NOR.
>
> +config SPI_HISI_SFC
> + tristate "Hisilicon SPI-NOR Flash Controller(SFC)"
> + depends on ARCH_HISI
I believe that using COMPILE_TEST would allow the build bots
to pick up your driver and report any issues.
See how NXP_SPIFI does it below.
> + help
> + This enables support for hisilicon SPI-NOR flash controller.
> +
> config SPI_NXP_SPIFI
> tristate "NXP SPI Flash Interface (SPIFI)"
> depends on OF && (ARCH_LPC18XX || COMPILE_TEST)
> diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
> index 0bf3a7f8..8a6fa69 100644
> --- a/drivers/mtd/spi-nor/Makefile
> +++ b/drivers/mtd/spi-nor/Makefile
> @@ -1,4 +1,5 @@
> obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o
> obj-$(CONFIG_SPI_FSL_QUADSPI) += fsl-quadspi.o
> +obj-$(CONFIG_SPI_HISI_SFC) += hisi-sfc.o
> obj-$(CONFIG_MTD_MT81xx_NOR) += mtk-quadspi.o
> obj-$(CONFIG_SPI_NXP_SPIFI) += nxp-spifi.o
[..]
> +
> + ret = mtd_device_register(mtd, NULL, 0);
> + if (ret)
> + goto fail;
> +
> + i++;
> + host->num_chip++;
> + if (i == HIFMC_MAX_CHIP_NUM) {
> + dev_dbg(dev, "Flash device number exceeds the maxinum chipselect number\n");
> + break;
Maybe dev_warn(FW_WARN ...) since it's a warning about a devicetree
(firmware) issue ?
Also: s/maxinum/maximum
Otherwise, looks fine:
Reviewed-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
--
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
More information about the linux-mtd
mailing list