···11* Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)2233-Required properties:33+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 an66 additional mode or an USART new feature.···1111 Required elements: "usart"1212- clocks: phandles to input clocks.13131414-Optional properties:1414+Required properties for USART in SPI mode:1515+- #size-cells : Must be <0>1616+- #address-cells : Must be <1>1717+- cs-gpios: chipselects (internal cs not supported)1818+- atmel,usart-mode : Must be <AT91_USART_MODE_SPI> (found in dt-bindings/mfd/at91-usart.h)1919+2020+Optional properties in serial mode:1521- atmel,use-dma-rx: use of PDC or DMA for receiving data1622- atmel,use-dma-tx: use of PDC or DMA for transmitting data1723- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively.···6761 <&dma0 2 0x204>;6862 dma-names = "tx", "rx";6963 atmel,fifo-size = <32>;6464+ };6565+6666+- SPI mode:6767+ #include <dt-bindings/mfd/at91-usart.h>6868+6969+ spi0: spi@f001c000 {7070+ #address-cells = <1>;7171+ #size-cells = <0>;7272+ compatible = "atmel,at91rm9200-usart", "atmel,at91sam9260-usart";7373+ atmel,usart-mode = <AT91_USART_MODE_SPI>;7474+ reg = <0xf001c000 0x100>;7575+ interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;7676+ clocks = <&usart0_clk>;7777+ clock-names = "usart";7878+ cs-gpios = <&pioB 3 0>;7079 };
···9999 additional drivers must be enabled in order to use the100100 functionality of the device.101101102102+config MFD_AT91_USART103103+ tristate "AT91 USART Driver"104104+ select MFD_CORE105105+ help106106+ Select this to get support for AT91 USART IP. This is a wrapper107107+ over at91-usart-serial driver and usart-spi-driver. Only one function108108+ can be used at a time. The choice is done at boot time by the probe109109+ function of this MFD driver according to a device tree property.110110+102111config MFD_ATMEL_FLEXCOM103112 tristate "Atmel Flexcom (Flexible Serial Communication Unit)"104113 select MFD_CORE
···10941094static inline void menelaus_rtc_init(struct menelaus_chip *m)10951095{10961096 int alarm = (m->client->irq > 0);10971097+ int err;1097109810981099 /* assume 32KDETEN pin is pulled high */10991100 if (!(menelaus_read_reg(MENELAUS_OSC_CTRL) & 0x80)) {11001101 dev_dbg(&m->client->dev, "no 32k oscillator\n");11011102 return;11021103 }11041104+11051105+ m->rtc = devm_rtc_allocate_device(&m->client->dev);11061106+ if (IS_ERR(m->rtc))11071107+ return;11081108+11091109+ m->rtc->ops = &menelaus_rtc_ops;1103111011041111 /* support RTC alarm; it can issue wakeups */11051112 if (alarm) {···11321125 menelaus_write_reg(MENELAUS_RTC_CTRL, m->rtc_control);11331126 }1134112711351135- m->rtc = rtc_device_register(DRIVER_NAME,11361136- &m->client->dev,11371137- &menelaus_rtc_ops, THIS_MODULE);11381138- if (IS_ERR(m->rtc)) {11281128+ err = rtc_register_device(m->rtc);11291129+ if (err) {11391130 if (alarm) {11401131 menelaus_remove_irq_work(MENELAUS_RTCALM_IRQ);11411132 device_init_wakeup(&m->client->dev, 0);
+8
drivers/spi/Kconfig
···8383 This selects a driver for the Atmel SPI Controller, present on8484 many AT91 ARM chips.85858686+config SPI_AT91_USART8787+ tristate "Atmel USART Controller SPI driver"8888+ depends on (ARCH_AT91 || COMPILE_TEST)8989+ depends on MFD_AT91_USART9090+ help9191+ This selects a driver for the AT91 USART Controller as SPI Master,9292+ present on AT91 and SAMA5 SoC series.9393+8694config SPI_AU15508795 tristate "Au1550/Au1200/Au1300 SPI Controller"8896 depends on MIPS_ALCHEMY
···118118 depends on ARCH_AT91 || COMPILE_TEST119119 select SERIAL_CORE120120 select SERIAL_MCTRL_GPIO if GPIOLIB121121+ select MFD_AT91_USART121122 help122123 This enables the driver for the on-chip UARTs of the Atmel123124 AT91 processors.
+27-15
drivers/tty/serial/atmel_serial.c
···193193194194#if defined(CONFIG_OF)195195static const struct of_device_id atmel_serial_dt_ids[] = {196196- { .compatible = "atmel,at91rm9200-usart" },197197- { .compatible = "atmel,at91sam9260-usart" },196196+ { .compatible = "atmel,at91rm9200-usart-serial" },198197 { /* sentinel */ }199198};200199#endif···914915static int atmel_prepare_tx_dma(struct uart_port *port)915916{916917 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);918918+ struct device *mfd_dev = port->dev->parent;917919 dma_cap_mask_t mask;918920 struct dma_slave_config config;919921 int ret, nent;···922922 dma_cap_zero(mask);923923 dma_cap_set(DMA_SLAVE, mask);924924925925- atmel_port->chan_tx = dma_request_slave_channel(port->dev, "tx");925925+ atmel_port->chan_tx = dma_request_slave_channel(mfd_dev, "tx");926926 if (atmel_port->chan_tx == NULL)927927 goto chan_err;928928 dev_info(port->dev, "using %s for tx DMA transfers\n",···10931093static int atmel_prepare_rx_dma(struct uart_port *port)10941094{10951095 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);10961096+ struct device *mfd_dev = port->dev->parent;10961097 struct dma_async_tx_descriptor *desc;10971098 dma_cap_mask_t mask;10981099 struct dma_slave_config config;···11051104 dma_cap_zero(mask);11061105 dma_cap_set(DMA_CYCLIC, mask);1107110611081108- atmel_port->chan_rx = dma_request_slave_channel(port->dev, "rx");11071107+ atmel_port->chan_rx = dma_request_slave_channel(mfd_dev, "rx");11091108 if (atmel_port->chan_rx == NULL)11101109 goto chan_err;11111110 dev_info(port->dev, "using %s for rx DMA transfers\n",···22232222 */22242223static void atmel_release_port(struct uart_port *port)22252224{22262226- struct platform_device *pdev = to_platform_device(port->dev);22272227- int size = pdev->resource[0].end - pdev->resource[0].start + 1;22252225+ struct platform_device *mpdev = to_platform_device(port->dev->parent);22262226+ int size = resource_size(mpdev->resource);2228222722292228 release_mem_region(port->mapbase, size);22302229···22392238 */22402239static int atmel_request_port(struct uart_port *port)22412240{22422242- struct platform_device *pdev = to_platform_device(port->dev);22432243- int size = pdev->resource[0].end - pdev->resource[0].start + 1;22412241+ struct platform_device *mpdev = to_platform_device(port->dev->parent);22422242+ int size = resource_size(mpdev->resource);2244224322452244 if (!request_mem_region(port->mapbase, size, "atmel_serial"))22462245 return -EBUSY;···23422341{23432342 int ret;23442343 struct uart_port *port = &atmel_port->uart;23442344+ struct platform_device *mpdev = to_platform_device(pdev->dev.parent);2345234523462346 atmel_init_property(atmel_port, pdev);23472347 atmel_set_ops(port);2348234823492349- uart_get_rs485_mode(&pdev->dev, &port->rs485);23492349+ uart_get_rs485_mode(&mpdev->dev, &port->rs485);2350235023512351 port->iotype = UPIO_MEM;23522352 port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP;23532353 port->ops = &atmel_pops;23542354 port->fifosize = 1;23552355 port->dev = &pdev->dev;23562356- port->mapbase = pdev->resource[0].start;23572357- port->irq = pdev->resource[1].start;23562356+ port->mapbase = mpdev->resource[0].start;23572357+ port->irq = mpdev->resource[1].start;23582358 port->rs485_config = atmel_config_rs485;23592359- port->membase = NULL;23592359+ port->membase = NULL;2360236023612361 memset(&atmel_port->rx_ring, 0, sizeof(atmel_port->rx_ring));2362236223632363 /* for console, the clock could already be configured */23642364 if (!atmel_port->clk) {23652365- atmel_port->clk = clk_get(&pdev->dev, "usart");23652365+ atmel_port->clk = clk_get(&mpdev->dev, "usart");23662366 if (IS_ERR(atmel_port->clk)) {23672367 ret = PTR_ERR(atmel_port->clk);23682368 atmel_port->clk = NULL;···26962694static int atmel_serial_probe(struct platform_device *pdev)26972695{26982696 struct atmel_uart_port *atmel_port;26992699- struct device_node *np = pdev->dev.of_node;26972697+ struct device_node *np = pdev->dev.parent->of_node;27002698 void *data;27012699 int ret = -ENODEV;27022700 bool rs485_enabled;2703270127042702 BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1));27032703+27042704+ /*27052705+ * In device tree there is no node with "atmel,at91rm9200-usart-serial"27062706+ * as compatible string. This driver is probed by at91-usart mfd driver27072707+ * which is just a wrapper over the atmel_serial driver and27082708+ * spi-at91-usart driver. All attributes needed by this driver are27092709+ * found in of_node of parent.27102710+ */27112711+ pdev->dev.of_node = np;2705271227062713 ret = of_alias_get_id(np, "serial");27072714 if (ret < 0)···2847283628482837 clk_put(atmel_port->clk);28492838 atmel_port->clk = NULL;28392839+ pdev->dev.of_node = NULL;2850284028512841 return ret;28522842}···28582846 .suspend = atmel_serial_suspend,28592847 .resume = atmel_serial_resume,28602848 .driver = {28612861- .name = "atmel_usart",28492849+ .name = "atmel_usart_serial",28622850 .of_match_table = of_match_ptr(atmel_serial_dt_ids),28632851 },28642852};
···148148 * @internal_dcvdd: true if DCVDD is supplied from the internal LDO1149149 * @pdata: our pdata150150 * @irq_dev: the irqchip child driver device151151+ * @irq_data: pointer to irqchip data for the child irqchip driver151152 * @irq: host irq number from SPI or I2C configuration152153 * @out_clamp: indicates output clamp state for each analogue output153154 * @out_shorted: indicates short circuit state for each analogue output···176175 struct madera_pdata pdata;177176178177 struct device *irq_dev;178178+ struct regmap_irq_chip_data *irq_data;179179 int irq;180180181181 unsigned int num_micbias;