Loading Documentation/devicetree/bindings/serial/atmel-usart.txt→Documentation/devicetree/bindings/mfd/atmel-usart.txt +23 −2 Original line number Diff line number Diff line * Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART) Required properties: Required properties for USART: - compatible: Should be "atmel,<chip>-usart" or "atmel,<chip>-dbgu" The compatible <chip> indicated will be the first SoC to support an additional mode or an USART new feature. Loading @@ -11,7 +11,13 @@ Required properties: Required elements: "usart" - clocks: phandles to input clocks. Optional properties: Required properties for USART in SPI mode: - #size-cells : Must be <0> - #address-cells : Must be <1> - cs-gpios: chipselects (internal cs not supported) - atmel,usart-mode : Must be <AT91_USART_MODE_SPI> (found in dt-bindings/mfd/at91-usart.h) Optional properties in serial mode: - atmel,use-dma-rx: use of PDC or DMA for receiving data - atmel,use-dma-tx: use of PDC or DMA for transmitting data - {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively. Loading Loading @@ -62,3 +68,18 @@ Example: dma-names = "tx", "rx"; atmel,fifo-size = <32>; }; - SPI mode: #include <dt-bindings/mfd/at91-usart.h> spi0: spi@f001c000 { #address-cells = <1>; #size-cells = <0>; compatible = "atmel,at91rm9200-usart", "atmel,at91sam9260-usart"; atmel,usart-mode = <AT91_USART_MODE_SPI>; reg = <0xf001c000 0x100>; interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>; clocks = <&usart0_clk>; clock-names = "usart"; cs-gpios = <&pioB 3 0>; }; MAINTAINERS +16 −0 Original line number Diff line number Diff line Loading @@ -9502,6 +9502,7 @@ M: Richard Genoud <richard.genoud@gmail.com> S: Maintained F: drivers/tty/serial/atmel_serial.c F: drivers/tty/serial/atmel_serial.h F: Documentation/devicetree/bindings/mfd/atmel-usart.txt MICROCHIP / ATMEL DMA DRIVER M: Ludovic Desroches <ludovic.desroches@microchip.com> Loading Loading @@ -9533,6 +9534,21 @@ S: Supported F: drivers/mtd/nand/raw/atmel/* F: Documentation/devicetree/bindings/mtd/atmel-nand.txt MICROCHIP AT91 USART MFD DRIVER M: Radu Pirea <radu_nicolae.pirea@upb.ro> L: linux-kernel@vger.kernel.org S: Supported F: drivers/mfd/at91-usart.c F: include/dt-bindings/mfd/at91-usart.h F: Documentation/devicetree/bindings/mfd/atmel-usart.txt MICROCHIP AT91 USART SPI DRIVER M: Radu Pirea <radu_nicolae.pirea@upb.ro> L: linux-spi@vger.kernel.org S: Supported F: drivers/spi/spi-at91-usart.c F: Documentation/devicetree/bindings/mfd/atmel-usart.txt MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER M: Woojung Huh <Woojung.Huh@microchip.com> M: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com> Loading drivers/mfd/Kconfig +9 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,15 @@ config MFD_AAT2870_CORE additional drivers must be enabled in order to use the functionality of the device. config MFD_AT91_USART tristate "AT91 USART Driver" select MFD_CORE help Select this to get support for AT91 USART IP. This is a wrapper over at91-usart-serial driver and usart-spi-driver. Only one function can be used at a time. The choice is done at boot time by the probe function of this MFD driver according to a device tree property. config MFD_ATMEL_FLEXCOM tristate "Atmel Flexcom (Flexible Serial Communication Unit)" select MFD_CORE Loading drivers/mfd/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,7 @@ obj-$(CONFIG_MFD_SPMI_PMIC) += qcom-spmi-pmic.o obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o obj-$(CONFIG_MFD_TPS65090) += tps65090.o obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o obj-$(CONFIG_MFD_AT91_USART) += at91-usart.o obj-$(CONFIG_MFD_ATMEL_FLEXCOM) += atmel-flexcom.o obj-$(CONFIG_MFD_ATMEL_HLCDC) += atmel-hlcdc.o obj-$(CONFIG_MFD_ATMEL_SMC) += atmel-smc.o Loading drivers/mfd/at91-usart.c 0 → 100644 +72 −0 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0 /* * Driver for AT91 USART * * Copyright (C) 2018 Microchip Technology * * Author: Radu Pirea <radu.pirea@microchip.com> * */ #include <dt-bindings/mfd/at91-usart.h> #include <linux/module.h> #include <linux/mfd/core.h> #include <linux/of.h> #include <linux/property.h> static struct mfd_cell at91_usart_spi_subdev = { .name = "at91_usart_spi", .of_compatible = "microchip,at91sam9g45-usart-spi", }; static struct mfd_cell at91_usart_serial_subdev = { .name = "atmel_usart_serial", .of_compatible = "atmel,at91rm9200-usart-serial", }; static int at91_usart_mode_probe(struct platform_device *pdev) { struct mfd_cell cell; u32 opmode = AT91_USART_MODE_SERIAL; device_property_read_u32(&pdev->dev, "atmel,usart-mode", &opmode); switch (opmode) { case AT91_USART_MODE_SPI: cell = at91_usart_spi_subdev; break; case AT91_USART_MODE_SERIAL: cell = at91_usart_serial_subdev; break; default: dev_err(&pdev->dev, "atmel,usart-mode has an invalid value %u\n", opmode); return -EINVAL; } return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, &cell, 1, NULL, 0, NULL); } static const struct of_device_id at91_usart_mode_of_match[] = { { .compatible = "atmel,at91rm9200-usart" }, { .compatible = "atmel,at91sam9260-usart" }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, at91_usart_mode_of_match); static struct platform_driver at91_usart_mfd = { .probe = at91_usart_mode_probe, .driver = { .name = "at91_usart_mode", .of_match_table = at91_usart_mode_of_match, }, }; module_platform_driver(at91_usart_mfd); MODULE_AUTHOR("Radu Pirea <radu.pirea@microchip.com>"); MODULE_DESCRIPTION("AT91 USART MFD driver"); MODULE_LICENSE("GPL v2"); Loading
Documentation/devicetree/bindings/serial/atmel-usart.txt→Documentation/devicetree/bindings/mfd/atmel-usart.txt +23 −2 Original line number Diff line number Diff line * Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART) Required properties: Required properties for USART: - compatible: Should be "atmel,<chip>-usart" or "atmel,<chip>-dbgu" The compatible <chip> indicated will be the first SoC to support an additional mode or an USART new feature. Loading @@ -11,7 +11,13 @@ Required properties: Required elements: "usart" - clocks: phandles to input clocks. Optional properties: Required properties for USART in SPI mode: - #size-cells : Must be <0> - #address-cells : Must be <1> - cs-gpios: chipselects (internal cs not supported) - atmel,usart-mode : Must be <AT91_USART_MODE_SPI> (found in dt-bindings/mfd/at91-usart.h) Optional properties in serial mode: - atmel,use-dma-rx: use of PDC or DMA for receiving data - atmel,use-dma-tx: use of PDC or DMA for transmitting data - {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively. Loading Loading @@ -62,3 +68,18 @@ Example: dma-names = "tx", "rx"; atmel,fifo-size = <32>; }; - SPI mode: #include <dt-bindings/mfd/at91-usart.h> spi0: spi@f001c000 { #address-cells = <1>; #size-cells = <0>; compatible = "atmel,at91rm9200-usart", "atmel,at91sam9260-usart"; atmel,usart-mode = <AT91_USART_MODE_SPI>; reg = <0xf001c000 0x100>; interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>; clocks = <&usart0_clk>; clock-names = "usart"; cs-gpios = <&pioB 3 0>; };
MAINTAINERS +16 −0 Original line number Diff line number Diff line Loading @@ -9502,6 +9502,7 @@ M: Richard Genoud <richard.genoud@gmail.com> S: Maintained F: drivers/tty/serial/atmel_serial.c F: drivers/tty/serial/atmel_serial.h F: Documentation/devicetree/bindings/mfd/atmel-usart.txt MICROCHIP / ATMEL DMA DRIVER M: Ludovic Desroches <ludovic.desroches@microchip.com> Loading Loading @@ -9533,6 +9534,21 @@ S: Supported F: drivers/mtd/nand/raw/atmel/* F: Documentation/devicetree/bindings/mtd/atmel-nand.txt MICROCHIP AT91 USART MFD DRIVER M: Radu Pirea <radu_nicolae.pirea@upb.ro> L: linux-kernel@vger.kernel.org S: Supported F: drivers/mfd/at91-usart.c F: include/dt-bindings/mfd/at91-usart.h F: Documentation/devicetree/bindings/mfd/atmel-usart.txt MICROCHIP AT91 USART SPI DRIVER M: Radu Pirea <radu_nicolae.pirea@upb.ro> L: linux-spi@vger.kernel.org S: Supported F: drivers/spi/spi-at91-usart.c F: Documentation/devicetree/bindings/mfd/atmel-usart.txt MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER M: Woojung Huh <Woojung.Huh@microchip.com> M: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com> Loading
drivers/mfd/Kconfig +9 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,15 @@ config MFD_AAT2870_CORE additional drivers must be enabled in order to use the functionality of the device. config MFD_AT91_USART tristate "AT91 USART Driver" select MFD_CORE help Select this to get support for AT91 USART IP. This is a wrapper over at91-usart-serial driver and usart-spi-driver. Only one function can be used at a time. The choice is done at boot time by the probe function of this MFD driver according to a device tree property. config MFD_ATMEL_FLEXCOM tristate "Atmel Flexcom (Flexible Serial Communication Unit)" select MFD_CORE Loading
drivers/mfd/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,7 @@ obj-$(CONFIG_MFD_SPMI_PMIC) += qcom-spmi-pmic.o obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o obj-$(CONFIG_MFD_TPS65090) += tps65090.o obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o obj-$(CONFIG_MFD_AT91_USART) += at91-usart.o obj-$(CONFIG_MFD_ATMEL_FLEXCOM) += atmel-flexcom.o obj-$(CONFIG_MFD_ATMEL_HLCDC) += atmel-hlcdc.o obj-$(CONFIG_MFD_ATMEL_SMC) += atmel-smc.o Loading
drivers/mfd/at91-usart.c 0 → 100644 +72 −0 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0 /* * Driver for AT91 USART * * Copyright (C) 2018 Microchip Technology * * Author: Radu Pirea <radu.pirea@microchip.com> * */ #include <dt-bindings/mfd/at91-usart.h> #include <linux/module.h> #include <linux/mfd/core.h> #include <linux/of.h> #include <linux/property.h> static struct mfd_cell at91_usart_spi_subdev = { .name = "at91_usart_spi", .of_compatible = "microchip,at91sam9g45-usart-spi", }; static struct mfd_cell at91_usart_serial_subdev = { .name = "atmel_usart_serial", .of_compatible = "atmel,at91rm9200-usart-serial", }; static int at91_usart_mode_probe(struct platform_device *pdev) { struct mfd_cell cell; u32 opmode = AT91_USART_MODE_SERIAL; device_property_read_u32(&pdev->dev, "atmel,usart-mode", &opmode); switch (opmode) { case AT91_USART_MODE_SPI: cell = at91_usart_spi_subdev; break; case AT91_USART_MODE_SERIAL: cell = at91_usart_serial_subdev; break; default: dev_err(&pdev->dev, "atmel,usart-mode has an invalid value %u\n", opmode); return -EINVAL; } return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, &cell, 1, NULL, 0, NULL); } static const struct of_device_id at91_usart_mode_of_match[] = { { .compatible = "atmel,at91rm9200-usart" }, { .compatible = "atmel,at91sam9260-usart" }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, at91_usart_mode_of_match); static struct platform_driver at91_usart_mfd = { .probe = at91_usart_mode_probe, .driver = { .name = "at91_usart_mode", .of_match_table = at91_usart_mode_of_match, }, }; module_platform_driver(at91_usart_mfd); MODULE_AUTHOR("Radu Pirea <radu.pirea@microchip.com>"); MODULE_DESCRIPTION("AT91 USART MFD driver"); MODULE_LICENSE("GPL v2");