Skip to contentSkip to conversation

spi: Add support for Amlogic Meson SPIFC

PATCH In review Beniamino Galvani 2 participants 8 messages Nov 22, 2014 – Nov 24, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover spi: Add support for Amlogic Meson SPIFC

Hi,

this patchset adds a driver for the SPIFC (SPI flash controller) available in Amlogic Meson6 and Meson8 SoCs. The driver has been tested on a Meson8 based device to communicate with a Macronix mx25l1606e serial flash.

Changes since v2 [ https://lkml.org/lkml/2014/11/17/669 ]:
- introduce spi_transfer_is_last() helper instead of using a flag in spi_transfer structure
- rebase DTS patch on arm-soc

Changes since v1 [ https://lkml.org/lkml/2014/11/9/35 ]:
- decrease busy wait timeout
- remove check on xfer->speed_hz value in meson_spifc_transfer_one()
- implement transfer_one() instead of transfer_one_message()
- remove useless memset of devdata
- use fixed regmap config
- implement PM operations
- don't set master->bus_num
- allow modular build of the driver

Beniamino Galvani (4):
spi: core: Add spi_transfer_is_last() helper
spi: meson: Add device tree bindings documentation for SPIFC
spi: meson: Add support for Amlogic Meson SPIFC
ARM: dts: meson: add node for SPIFC

 .../devicetree/bindings/spi/spi-meson.txt          |  22 +
 arch/arm/boot/dts/meson.dtsi                       |   9 +
 drivers/spi/Kconfig                                |   7 +
 drivers/spi/Makefile                               |   1 +
 drivers/spi/spi-meson-spifc.c                      | 462 +++++++++++++++++++++
 include/linux/spi/spi.h                            |   6 +
 6 files changed, 507 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-meson.txt
 create mode 100644 drivers/spi/spi-meson-spifc.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/4 spi: core: Add spi_transfer_is_last() helper

This adds the function spi_transfer_is_last() which can be used by drivers to know whether a given transfer is the last one in the current message.

---
 include/linux/spi/spi.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/spi/spi.h +6 -0
index 46d188a..a6ef2a8 100644
@@ -1049,4 +1049,10 @@ spi_unregister_device(struct spi_device *spi)
 extern const struct spi_device_id *
 spi_get_device_id(const struct spi_device *sdev);
 
+static inline bool
+spi_transfer_is_last(struct spi_master *master, struct spi_transfer *xfer)
+{
+	return list_is_last(&xfer->transfer_list, &master->cur_msg->transfers);
+}
+
 #endif /* __LINUX_SPI_H */
Signature · 1 line
1.9.1
maintainer
#2 lore raw

Re: [PATCH v3 1/4] spi: core: Add spi_transfer_is_last() helper

Quoted 3 lines · Beniamino Galvani

This adds the function spi_transfer_is_last() which can be used by drivers to know whether a given transfer is the last one in the current message.

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141124/d6850d0e/attachment.sig>

#3 lore raw

PATCH v3 2/4 spi: meson: Add device tree bindings documentation for SPIFC

In reply to Beniamino Galvani

This adds documentation of device tree bindings for the Amlogic Meson SPIFC (SPI Flash Controller).

---
 .../devicetree/bindings/spi/spi-meson.txt          | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-meson.txt
Documentation/devicetree/bindings/spi/spi-meson.txt new file +22 -0
new file mode 100644
index 0000000..bb52a86
@@ -0,0 +1,22 @@
+Amlogic Meson SPI controllers
+
+* SPIFC (SPI Flash Controller)
+
+The Meson SPIFC is a controller optimized for communication with SPI
+NOR memories, without DMA support and a 64-byte unified transmit /
+receive buffer.
+
+Required properties:
+ - compatible: should be "amlogic,meson6-spifc"
+ - reg: physical base address and length of the controller registers
+ - clocks: phandle of the input clock for the baud rate generator
+ - #address-cells: should be 1
+ - #size-cells: should be 0
+
+	spi at c1108c80 {
+		compatible = "amlogic,meson6-spifc";
+		reg = <0xc1108c80 0x80>;
+		clocks = <&clk81>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
Signature · 1 line
1.9.1
maintainer
#4 lore raw

Re: [PATCH v3 2/4] spi: meson: Add device tree bindings documentation for SPIFC

Quoted 2 lines · Beniamino Galvani

This adds documentation of device tree bindings for the Amlogic Meson SPIFC (SPI Flash Controller).

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141124/ef32a8cd/attachment.sig>

#5 lore raw

PATCH v3 3/4 spi: meson: Add support for Amlogic Meson SPIFC

In reply to Beniamino Galvani

This is a driver for the Amlogic Meson SPIFC (SPI flash controller), which is one of the two SPI controllers available on the SoC. It doesn't support DMA and has a 64-byte unified transmit/receive buffer.

The device is optimized for interfacing with SPI NOR memories and allows the execution of standard operations such as read, page program, sector erase, etc. in a simplified way, toggling a bit in a dedicated register. The driver doesn't use those predefined commands and relies only on custom transfers.

---
 drivers/spi/Kconfig           |   7 +
 drivers/spi/Makefile          |   1 +
 drivers/spi/spi-meson-spifc.c | 462 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 470 insertions(+)
 create mode 100644 drivers/spi/spi-meson-spifc.c
drivers/spi/Kconfig +7 -0
index 98de207..0373c37 100644
@@ -308,6 +308,13 @@ config SPI_FSL_ESPI
 	  From MPC8536, 85xx platform uses the controller, and all P10xx,
 	  P20xx, P30xx,P40xx, P50xx uses this controller.
 
+config SPI_MESON_SPIFC
+	tristate "Amlogic Meson SPIFC controller"
+	depends on ARCH_MESON || COMPILE_TEST
+	help
+	  This enables master mode support for the SPIFC (SPI flash
+	  controller) available in Amlogic Meson SoCs.
+
 config SPI_OC_TINY
 	tristate "OpenCores tiny SPI"
 	depends on GPIOLIB
drivers/spi/Makefile +1 -0
index 37dc2e7..6b9d2ac 100644
@@ -43,6 +43,7 @@ obj-$(CONFIG_SPI_GPIO)			+= spi-gpio.o
 obj-$(CONFIG_SPI_IMG_SPFI)		+= spi-img-spfi.o
 obj-$(CONFIG_SPI_IMX)			+= spi-imx.o
 obj-$(CONFIG_SPI_LM70_LLP)		+= spi-lm70llp.o
+obj-$(CONFIG_SPI_MESON_SPIFC)		+= spi-meson-spifc.o
 obj-$(CONFIG_SPI_MPC512x_PSC)		+= spi-mpc512x-psc.o
 obj-$(CONFIG_SPI_MPC52xx_PSC)		+= spi-mpc52xx-psc.o
 obj-$(CONFIG_SPI_MPC52xx)		+= spi-mpc52xx.o
drivers/spi/spi-meson-spifc.c new file +462 -0

462 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#6 lore raw

Re: [PATCH v3 3/4] spi: meson: Add support for Amlogic Meson SPIFC

Quoted 3 lines · Beniamino Galvani

This is a driver for the Amlogic Meson SPIFC (SPI flash controller), which is one of the two SPI controllers available on the SoC. It doesn't support DMA and has a 64-byte unified transmit/receive buffer.

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141124/2015c5a1/attachment.sig>

#7 lore raw

PATCH v3 4/4 ARM: dts: meson: add node for SPIFC

In reply to Beniamino Galvani

This adds a node for the SPI Flash Controller to the Amlogic Meson DTS.

---
 arch/arm/boot/dts/meson.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/boot/dts/meson.dtsi +9 -0
index b91e430..e26d37a 100644
@@ -135,5 +135,14 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 		};
+
+		spifc: spi at c1108c80 {
+			compatible = "amlogic,meson6-spifc";
+			reg = <0xc1108c80 0x80>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&clk81>;
+			status = "disabled";
+		};
 	};
 }; /* end of / */
Signature · 1 line
1.9.1