spi: bcm2835: add spi-bcm2835aux driver for the auxiliar spi1 and spi2
Subsystems (4)
PATCH v3 1/2 spi: bcm2835: add spi-bcm2835aux driver for the auxiliar spi1 and spi2
From: Martin Sperl <[email protected]>
This driver does NOT make use of native chip-selects but uses the generic cs-gpios facilities provided by the framework allowing for more than 3 chip-selects which is the HW limit.
For enabling/disabling spiX we need to use syscon/regmap to serialize access to the BCM2835AUX_ENABLE register (only needed during probe and remove).
This syscon needs to be configured in device-tree. A future AUX-UART1 would also need to use this interface to enable the uart1-HW block.
The interrupt handler works using a shared interrupt line (uses IRQF_SHARED flag to request the line), so that the serial8250 driver would only need to get compiled with CONFIG_SERIAL_8250_SHARE_IRQ option set to work as well with shared interrupts.
---
drivers/spi/Kconfig | 12 + drivers/spi/Makefile | 1 + drivers/spi/spi-bcm2835aux.c | 537 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 550 insertions(+) create mode 100644 drivers/spi/spi-bcm2835aux.c
Changelog:
V1->V2: none (changes to documentation)
V2->V3: implentation of enabling HW via regmapOnly tested spi1, as no Compute Module is available to me to test spi2.
drivers/spi/Kconfig +12 -0
@@ -88,6 +88,18 @@ config SPI_BCM2835 is for the regular SPI controller. Slave mode operation is not also not supported. +config SPI_BCM2835AUX + tristate "BCM2835 SPI auxiliar controller" + depends on ARCH_BCM2835 || COMPILE_TEST + depends on GPIOLIB + select MFD_SYSCON + help + This selects a driver for the Broadcom BCM2835 SPI aux master. + + The BCM2835 contains two types of SPI master controller; the + "universal SPI master", and the regular SPI controller. This driver + is for the universal/auxiliar SPI controller. + config SPI_BFIN5XX tristate "SPI controller driver for ADI Blackfin5xx" depends on BLACKFIN && !BF60x
drivers/spi/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_SPI_ATMEL) += spi-atmel.o obj-$(CONFIG_SPI_ATH79) += spi-ath79.o obj-$(CONFIG_SPI_AU1550) += spi-au1550.o obj-$(CONFIG_SPI_BCM2835) += spi-bcm2835.o +obj-$(CONFIG_SPI_BCM2835AUX) += spi-bcm2835aux.o obj-$(CONFIG_SPI_BCM53XX) += spi-bcm53xx.o obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o obj-$(CONFIG_SPI_BCM63XX_HSSPI) += spi-bcm63xx-hsspi.o
drivers/spi/spi-bcm2835aux.c new file +537 -0
537 lines not on this page · raw message
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1436663617-3056-1-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org
PATCH v3 2/2 dt: brcm,bcm2835-aux-spi: add binding documentation for new spi-bcm2835aux
From: Martin Sperl <[email protected]>
Document the necessary device-tree bindings of the spi-bcm2835aux driver.
---
.../bindings/spi/brcm,bcm2835-aux-spi.txt | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/brcm,bcm2835-aux-spi.txt
Changelog:
V1->V2: fixed typo
added cs-gpios
V2->V3: added reference to spi-bus in cs-gpios
added required additional config for sysconDocumentation/devicetree/bindings/spi/brcm,bcm2835-aux-spi.txt new file +46 -0
@@ -0,0 +1,46 @@ +Broadcom BCM2835 auxiliar SPI1/2 controller + +The BCM2835 contains two forms of SPI master controller, one known simply as +SPI0, and the other known as the "Universal SPI Master"; part of the +auxiliary block. This binding applies to the SPI1/2 controller. + +Required properties: +- compatible: Should be "brcm,bcm2835-aux-spi". +- reg: Should contain register location and length for the spi block + as well as for the common aux block control +- interrupts: Should contain shared interrupt of the aux block +- clocks: The clock feeding the SPI controller. +- cs-gpios: the cs-gpios (native cs is NOT supported) + see also spi-bus.txt +- syscon: the syscon config entry to handle the shared + register access by multiple drivers + +Example: + +spi1@7e215080 { + compatible = "brcm,bcm2835-aux-spi"; + reg = <0x7e215080 0x40>; + interrupts = <1 29>; + clocks = <&clk_spi>; + #address-cells = <1>; + #size-cells = <0>; + cs-gpios = <&gpio 18>, <&gpio 17>, <&gpio 16>; + syscon = <&aux_syscon>; +}; + +spi2@7e2150c0 { + compatible = "brcm,bcm2835-aux-spi"; + reg = <0x7e2150c0 0x40>; + interrupts = <1 29>; + clocks = <&clk_spi>; + #address-cells = <1>; + #size-cells = <0>; + cs-gpios = <&gpio 43>, <&gpio 44>, <&gpio 45>; + syscon = <&aux_syscon>; +}; + +/* the necessary syscon config referenced above */ +aux_syscon: aux_syscon@0x7e215000 { + compatible = "syscon"; + reg = <0x7e215000 0x08>; +};
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html