Skip to content

Commit 479dbdd

Browse files
committed
Merge branch 'at91-4.9-trunk/spi' into linux-4.9-at91
2 parents 4b622d6 + ceb8ebe commit 479dbdd

File tree

11 files changed

+663
-21
lines changed

11 files changed

+663
-21
lines changed

Documentation/devicetree/bindings/serial/atmel-usart.txt renamed to Documentation/devicetree/bindings/mfd/atmel-usart.txt

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
* Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)
22

3-
Required properties:
3+
Required properties for USART:
44
- compatible: Should be "atmel,<chip>-usart" or "atmel,<chip>-dbgu"
55
The compatible <chip> indicated will be the first SoC to support an
66
additional mode or an USART new feature.
@@ -11,7 +11,13 @@ Required properties:
1111
Required elements: "usart"
1212
- clocks: phandles to input clocks.
1313

14-
Optional properties:
14+
Required properties for USART in SPI mode:
15+
- #size-cells : Must be <0>
16+
- #address-cells : Must be <1>
17+
- cs-gpios: chipselects (internal cs not supported)
18+
- atmel,usart-mode : Must be <AT91_USART_MODE_SPI> (found in dt-bindings/mfd/at91-usart.h)
19+
20+
Optional properties in serial mode:
1521
- atmel,use-dma-rx: use of PDC or DMA for receiving data
1622
- atmel,use-dma-tx: use of PDC or DMA for transmitting data
1723
- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively.
@@ -61,3 +67,18 @@ Example:
6167
dma-names = "tx", "rx";
6268
atmel,fifo-size = <32>;
6369
};
70+
71+
- SPI mode:
72+
#include <dt-bindings/mfd/at91-usart.h>
73+
74+
spi0: spi@f001c000 {
75+
#address-cells = <1>;
76+
#size-cells = <0>;
77+
compatible = "atmel,at91rm9200-usart", "atmel,at91sam9260-usart";
78+
atmel,usart-mode = <AT91_USART_MODE_SPI>;
79+
reg = <0xf001c000 0x100>;
80+
interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
81+
clocks = <&usart0_clk>;
82+
clock-names = "usart";
83+
cs-gpios = <&pioB 3 0>;
84+
};

MAINTAINERS

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8004,6 +8004,22 @@ M: Richard Genoud <richard.genoud@gmail.com>
80048004
S: Maintained
80058005
F: drivers/tty/serial/atmel_serial.c
80068006
F: include/linux/atmel_serial.h
8007+
F: Documentation/devicetree/bindings/mfd/atmel-usart.txt
8008+
8009+
MICROCHIP / ATMEL DMA DRIVER
8010+
M: Ludovic Desroches <ludovic.desroches@microchip.com>
8011+
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
8012+
L: dmaengine@vger.kernel.org
8013+
S: Supported
8014+
F: drivers/dma/at_hdmac.c
8015+
F: drivers/dma/at_hdmac_regs.h
8016+
F: include/linux/platform_data/dma-atmel.h
8017+
8018+
MICROCHIP / ATMEL ECC DRIVER
8019+
M: Tudor Ambarus <tudor.ambarus@microchip.com>
8020+
L: linux-crypto@vger.kernel.org
8021+
S: Maintained
8022+
F: drivers/crypto/atmel-ecc.*
80078023

80088024
MICROCHIP / ATMEL ISC DRIVER
80098025
M: Songjun Wu <songjun.wu@microchip.com>
@@ -8013,6 +8029,59 @@ F: drivers/media/platform/atmel/atmel-isc.c
80138029
F: drivers/media/platform/atmel/atmel-isc-regs.h
80148030
F: devicetree/bindings/media/atmel-isc.txt
80158031

8032+
MICROCHIP / ATMEL NAND DRIVER
8033+
M: Wenyou Yang <wenyou.yang@microchip.com>
8034+
M: Josh Wu <rainyfeeling@outlook.com>
8035+
L: linux-mtd@lists.infradead.org
8036+
S: Supported
8037+
F: drivers/mtd/nand/raw/atmel/*
8038+
F: Documentation/devicetree/bindings/mtd/atmel-nand.txt
8039+
8040+
MICROCHIP AT91 USART MFD DRIVER
8041+
M: Radu Pirea <radu.pirea@microchip.com>
8042+
L: linux-kernel@vger.kernel.org
8043+
S: Supported
8044+
F: drivers/mfd/at91-usart.c
8045+
F: include/dt-bindings/mfd/at91-usart.h
8046+
F: Documentation/devicetree/bindings/mfd/atmel-usart.txt
8047+
8048+
MICROCHIP AT91 USART SPI DRIVER
8049+
M: Radu Pirea <radu.pirea@microchip.com>
8050+
L: linux-spi@vger.kernel.org
8051+
S: Supported
8052+
F: drivers/spi/spi-at91-usart.c
8053+
F: Documentation/devicetree/bindings/mfd/atmel-usart.txt
8054+
8055+
MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER
8056+
M: Woojung Huh <Woojung.Huh@microchip.com>
8057+
M: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
8058+
L: netdev@vger.kernel.org
8059+
S: Maintained
8060+
F: net/dsa/tag_ksz.c
8061+
F: drivers/net/dsa/microchip/*
8062+
F: include/linux/platform_data/microchip-ksz.h
8063+
F: Documentation/devicetree/bindings/net/dsa/ksz.txt
8064+
8065+
MICROCHIP USB251XB DRIVER
8066+
M: Richard Leitner <richard.leitner@skidata.com>
8067+
L: linux-usb@vger.kernel.org
8068+
S: Maintained
8069+
F: drivers/usb/misc/usb251xb.c
8070+
F: Documentation/devicetree/bindings/usb/usb251xb.txt
8071+
8072+
MICROSEMI SMART ARRAY SMARTPQI DRIVER (smartpqi)
8073+
M: Don Brace <don.brace@microsemi.com>
8074+
L: esc.storagedev@microsemi.com
8075+
L: linux-scsi@vger.kernel.org
8076+
S: Supported
8077+
F: drivers/scsi/smartpqi/smartpqi*.[ch]
8078+
F: drivers/scsi/smartpqi/Kconfig
8079+
F: drivers/scsi/smartpqi/Makefile
8080+
F: include/linux/cciss*.h
8081+
F: include/uapi/linux/cciss*.h
8082+
F: Documentation/scsi/smartpqi.txt
8083+
8084+
>>>>>>> f8582c09dccd... MAINTAINERS: add at91 usart mfd driver
80168085
MICROSOFT SURFACE PRO 3 BUTTON DRIVER
80178086
M: Chen Yu <yu.c.chen@intel.com>
80188087
L: platform-driver-x86@vger.kernel.org

drivers/mfd/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ config MFD_AAT2870_CORE
8282
additional drivers must be enabled in order to use the
8383
functionality of the device.
8484

85+
config MFD_AT91_USART
86+
tristate "AT91 USART Driver"
87+
select MFD_CORE
88+
help
89+
Select this to get support for AT91 USART IP. This is a wrapper
90+
over at91-usart-serial driver and usart-spi-driver. Only one function
91+
can be used at a time. The choice is done at boot time by the probe
92+
function of this MFD driver according to a device tree property.
93+
8594
config MFD_ATMEL_FLEXCOM
8695
tristate "Atmel Flexcom (Flexible Serial Communication Unit)"
8796
select MFD_CORE

drivers/mfd/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ obj-$(CONFIG_MFD_SPMI_PMIC) += qcom-spmi-pmic.o
178178
obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o
179179
obj-$(CONFIG_MFD_TPS65090) += tps65090.o
180180
obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o
181+
obj-$(CONFIG_MFD_AT91_USART) += at91-usart.o
181182
obj-$(CONFIG_MFD_ATMEL_FLEXCOM) += atmel-flexcom.o
182183
obj-$(CONFIG_MFD_ATMEL_HLCDC) += atmel-hlcdc.o
183184
obj-$(CONFIG_MFD_INTEL_LPSS) += intel-lpss.o

drivers/mfd/at91-usart.c

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Driver for AT91 USART
4+
*
5+
* Copyright (C) 2018 Microchip Technology
6+
*
7+
* Author: Radu Pirea <radu.pirea@microchip.com>
8+
*
9+
*/
10+
11+
#include <dt-bindings/mfd/at91-usart.h>
12+
13+
#include <linux/module.h>
14+
#include <linux/mfd/core.h>
15+
#include <linux/property.h>
16+
17+
static struct mfd_cell at91_usart_spi_subdev = {
18+
.name = "at91_usart_spi",
19+
.of_compatible = "microchip,at91sam9g45-usart-spi",
20+
};
21+
22+
static struct mfd_cell at91_usart_serial_subdev = {
23+
.name = "atmel_usart_serial",
24+
.of_compatible = "atmel,at91rm9200-usart-serial",
25+
};
26+
27+
static int at91_usart_mode_probe(struct platform_device *pdev)
28+
{
29+
struct mfd_cell cell;
30+
u32 opmode = AT91_USART_MODE_SERIAL;
31+
32+
device_property_read_u32(&pdev->dev, "atmel,usart-mode", &opmode);
33+
34+
switch (opmode) {
35+
case AT91_USART_MODE_SPI:
36+
cell = at91_usart_spi_subdev;
37+
break;
38+
case AT91_USART_MODE_SERIAL:
39+
cell = at91_usart_serial_subdev;
40+
break;
41+
default:
42+
dev_err(&pdev->dev, "atmel,usart-mode has an invalid value %u\n",
43+
opmode);
44+
return -EINVAL;
45+
}
46+
47+
return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, &cell, 1,
48+
NULL, 0, NULL);
49+
}
50+
51+
static const struct of_device_id at91_usart_mode_of_match[] = {
52+
{ .compatible = "atmel,at91rm9200-usart" },
53+
{ .compatible = "atmel,at91sam9260-usart" },
54+
{ /* sentinel */ }
55+
};
56+
57+
MODULE_DEVICE_TABLE(of, at91_flexcom_of_match);
58+
59+
static struct platform_driver at91_usart_mfd = {
60+
.probe = at91_usart_mode_probe,
61+
.driver = {
62+
.name = "at91_usart_mode",
63+
.of_match_table = at91_usart_mode_of_match,
64+
},
65+
};
66+
67+
module_platform_driver(at91_usart_mfd);
68+
69+
MODULE_AUTHOR("Radu Pirea <radu.pirea@microchip.com>");
70+
MODULE_DESCRIPTION("AT91 USART MFD driver");
71+
MODULE_LICENSE("GPL v2");

drivers/spi/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ config SPI_ATMEL
7575
This selects a driver for the Atmel SPI Controller, present on
7676
many AT32 (AVR32) and AT91 (ARM) chips.
7777

78+
config SPI_AT91_USART
79+
tristate "Atmel USART Controller SPI driver"
80+
depends on HAS_DMA
81+
depends on (ARCH_AT91 || COMPILE_TEST)
82+
select MFD_AT91_USART
83+
help
84+
This selects a driver for the AT91 USART Controller as SPI Master,
85+
present on AT91 and SAMA5 SoC series.
86+
7887
config SPI_AU1550
7988
tristate "Au1550/Au1200/Au1300 SPI Controller"
8089
depends on MIPS_ALCHEMY

drivers/spi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ obj-$(CONFIG_SPI_LOOPBACK_TEST) += spi-loopback-test.o
1313
# SPI master controller drivers (bus)
1414
obj-$(CONFIG_SPI_ALTERA) += spi-altera.o
1515
obj-$(CONFIG_SPI_ATMEL) += spi-atmel.o
16+
obj-$(CONFIG_SPI_AT91_USART) += spi-at91-usart.o
1617
obj-$(CONFIG_SPI_ATH79) += spi-ath79.o
1718
obj-$(CONFIG_SPI_AU1550) += spi-au1550.o
1819
obj-$(CONFIG_SPI_AXI_SPI_ENGINE) += spi-axi-spi-engine.o

0 commit comments

Comments
 (0)