Altera ASMI Parallel II IP Core
v3 cover Altera ASMI Parallel II IP Core
From: Matthew Gerlach <matthew.gerlach-VuQAYsv1563Yd54FQh9/[email protected]>
This patch set adds a spi-nor flash driver for the Altera ASMI Parallel II IP Core. This driver was created based on feedback from Marek Vasut, Cyrill Pitchen, and Michal Suchanek regarding Version 2 of the Altera Quadspi Controller: https://lkml.org/lkml/2017/6/26/518
The overall problem with Version 2 of the Altera Quadspi Controller and its driver was the fact that there was much duplication of code and logic with the spi-nor framework. This new combination of fpga hardware and software "gets out of the way" of the spi-nor framework. The result is a much simpler driver with the spi-nor framework performing the bulk of the work.
Patch 1 contains the device tree bindings for the driver for the Altera ASMI-Parallel II IP Core.
Patch 2 contains the driver code for the Altera ASMI-Parallel II IP Core. This driver supports being configured via a device tree or with platform data. In the later case, the memory for the registers has been remapped.
Matthew Gerlach (2):
dt-bindings: mtd: Altera ASMI Parallel II IP Core
mtd: spi-nor: Altera ASMI Parallel II IP Core
.../devicetree/bindings/mtd/altera-asmip2.txt | 15 + MAINTAINERS | 7 + drivers/mtd/spi-nor/Kconfig | 6 + drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/altera-asmip2.c | 494 +++++++++++++++++++++ include/linux/mtd/altera-asmip2.h | 25 ++ 6 files changed, 548 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/altera-asmip2.txt create mode 100644 drivers/mtd/spi-nor/altera-asmip2.c create mode 100644 include/linux/mtd/altera-asmip2.h
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 1/2 dt-bindings: mtd: Altera ASMI Parallel II IP Core
From: Matthew Gerlach <[email protected]>
Device Tree bindings for Altera ASMI Parallel II IP Core connected to a flash chip.
---
v2:
Made substitutions suggested by Rob Herring.
Emphasize driver expects controller is connected to spi-nor flash.
v3: add Acked-by: Rob Herring <[email protected]>
--- Documentation/devicetree/bindings/mtd/altera-asmip2.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/altera-asmip2.txt
Documentation/devicetree/bindings/mtd/altera-asmip2.txt new file +15 -0
@@ -0,0 +1,15 @@ +* Altera ASMI Parallel II IP Core + +Devicetree bindings for an Altera ASMI Parallel II IP core connected to a +spi-nor flash chip. + +Required properties: +- compatible : Should be "altr,asmi-parallel2-spi-nor". +- reg : A tuple consisting of a physical address and length. + +Example: + +qspi: spi@a0001000 { + compatible = "altr,asmi-parallel2-spi-nor"; + reg = <0xa0001000 0x10>; +};
Signature · 1 line
2.7.4
PATCH v3 2/2 mtd: spi-nor: Altera ASMI Parallel II IP Core
In reply to [email protected]From: Matthew Gerlach <[email protected]>
This patch adds support for a spi-nor, platform driver for the Altera ASMI Parallel II IP Core. The intended use case is to be able to update the flash used to load a FPGA at power up with mtd-utils.
---
v2:
minor checkpatch fixing by Wu Hao <[email protected]> Use read_dummy value as suggested by Cyrille Pitchen. Don't assume 4 byte addressing (Cryille Pichecn and Marek Vasut). Fixed #define indenting as suggested by Marek Vasut. Added units to timer values as suggested by Marek Vasut. Use io(read|write)8_rep() as suggested by Marek Vasut. Renamed function prefixed with __ as suggested by Marek Vasut.
v3: make timeout a function of clock frequency (Marek Vasut)
--- MAINTAINERS | 7 + drivers/mtd/spi-nor/Kconfig | 6 + drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/altera-asmip2.c | 494 ++++++++++++++++++++++++++++++++++++ include/linux/mtd/altera-asmip2.h | 25 ++ 5 files changed, 533 insertions(+) create mode 100644 drivers/mtd/spi-nor/altera-asmip2.c create mode 100644 include/linux/mtd/altera-asmip2.h
MAINTAINERS +7 -0
@@ -656,6 +656,13 @@ ALPS PS/2 TOUCHPAD DRIVER R: Pali Rohár <[email protected]> F: drivers/input/mouse/alps.* +ALTERA ASMI Parallel II Driver +M: Matthew Gerlach <[email protected]> +L: [email protected] +S: Maintained +F: drivers/mtd/spi-nor/altera-asmip2.c +F: inclulde/linux/mtd/altera-asmip2.h + ALTERA I2C CONTROLLER DRIVER M: Thor Thayer <[email protected]> S: Maintained
drivers/mtd/spi-nor/Kconfig +6 -0
@@ -129,4 +129,10 @@ config SPI_STM32_QUADSPI This enables support for the STM32 Quad SPI controller. We only connect the NOR to this controller. +config SPI_ALTERA_ASMIP2 + tristate "Altera ASMI Parallel II IP" + depends on OF && HAS_IOMEM + help + Enable support for Altera ASMI Parallel II. + endif # MTD_SPI_NOR
drivers/mtd/spi-nor/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o +obj-$(CONFIG_SPI_ALTERA_ASMIP2) += altera-asmip2.o obj-$(CONFIG_SPI_ASPEED_SMC) += aspeed-smc.o obj-$(CONFIG_SPI_ATMEL_QUADSPI) += atmel-quadspi.o obj-$(CONFIG_SPI_CADENCE_QUADSPI) += cadence-quadspi.o
drivers/mtd/spi-nor/altera-asmip2.c new file +494 -0
494 lines not on this page · raw message
include/linux/mtd/altera-asmip2.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* +* Copyright 2017 Intel Corporation, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#ifndef __ALTERA_QUADSPI_H +#define __ALTERA_QUADSPI_H + +#include <linux/device.h> + +#define ALTERA_ASMIP2_DRV_NAME "altr-asmip2" +#define ALTERA_ASMIP2_MAX_NUM_FLASH_CHIP 3 +#define ALTERA_ASMIP2_RESOURCE_SIZE 0x10 + +struct altera_asmip2_plat_data { +u64 clk_hz; +void __iomem *csr_base; +u32 num_chip_sel; +}; + +#endif
Signature · 1 line
2.7.4