Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty/serial: atmel: make the driver DT only

Now that AVR32 is gone, platform_data are not used to initialize the driver
anymore, remove that path from the driver. Also remove the now unused
struct atmel_uart_data.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alexandre Belloni and committed by
Greg Kroah-Hartman
92c8f7c0 274a5ed6

+35 -75
+35 -65
drivers/tty/serial/atmel_serial.c
··· 1638 1638 struct platform_device *pdev) 1639 1639 { 1640 1640 struct device_node *np = pdev->dev.of_node; 1641 - struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); 1642 1641 1643 - if (np) { 1644 - /* DMA/PDC usage specification */ 1645 - if (of_property_read_bool(np, "atmel,use-dma-rx")) { 1646 - if (of_property_read_bool(np, "dmas")) { 1647 - atmel_port->use_dma_rx = true; 1648 - atmel_port->use_pdc_rx = false; 1649 - } else { 1650 - atmel_port->use_dma_rx = false; 1651 - atmel_port->use_pdc_rx = true; 1652 - } 1642 + /* DMA/PDC usage specification */ 1643 + if (of_property_read_bool(np, "atmel,use-dma-rx")) { 1644 + if (of_property_read_bool(np, "dmas")) { 1645 + atmel_port->use_dma_rx = true; 1646 + atmel_port->use_pdc_rx = false; 1653 1647 } else { 1654 1648 atmel_port->use_dma_rx = false; 1655 - atmel_port->use_pdc_rx = false; 1649 + atmel_port->use_pdc_rx = true; 1656 1650 } 1657 - 1658 - if (of_property_read_bool(np, "atmel,use-dma-tx")) { 1659 - if (of_property_read_bool(np, "dmas")) { 1660 - atmel_port->use_dma_tx = true; 1661 - atmel_port->use_pdc_tx = false; 1662 - } else { 1663 - atmel_port->use_dma_tx = false; 1664 - atmel_port->use_pdc_tx = true; 1665 - } 1666 - } else { 1667 - atmel_port->use_dma_tx = false; 1668 - atmel_port->use_pdc_tx = false; 1669 - } 1670 - 1671 1651 } else { 1672 - atmel_port->use_pdc_rx = pdata->use_dma_rx; 1673 - atmel_port->use_pdc_tx = pdata->use_dma_tx; 1674 1652 atmel_port->use_dma_rx = false; 1675 - atmel_port->use_dma_tx = false; 1653 + atmel_port->use_pdc_rx = false; 1676 1654 } 1677 1655 1656 + if (of_property_read_bool(np, "atmel,use-dma-tx")) { 1657 + if (of_property_read_bool(np, "dmas")) { 1658 + atmel_port->use_dma_tx = true; 1659 + atmel_port->use_pdc_tx = false; 1660 + } else { 1661 + atmel_port->use_dma_tx = false; 1662 + atmel_port->use_pdc_tx = true; 1663 + } 1664 + } else { 1665 + atmel_port->use_dma_tx = false; 1666 + atmel_port->use_pdc_tx = false; 1667 + } 1678 1668 } 1679 1669 1680 1670 static void atmel_init_rs485(struct uart_port *port, 1681 1671 struct platform_device *pdev) 1682 1672 { 1683 1673 struct device_node *np = pdev->dev.of_node; 1684 - struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); 1685 1674 1686 - if (np) { 1687 - struct serial_rs485 *rs485conf = &port->rs485; 1688 - u32 rs485_delay[2]; 1689 - /* rs485 properties */ 1690 - if (of_property_read_u32_array(np, "rs485-rts-delay", 1691 - rs485_delay, 2) == 0) { 1692 - rs485conf->delay_rts_before_send = rs485_delay[0]; 1693 - rs485conf->delay_rts_after_send = rs485_delay[1]; 1694 - rs485conf->flags = 0; 1695 - } 1675 + struct serial_rs485 *rs485conf = &port->rs485; 1676 + u32 rs485_delay[2]; 1696 1677 1697 - if (of_get_property(np, "rs485-rx-during-tx", NULL)) 1698 - rs485conf->flags |= SER_RS485_RX_DURING_TX; 1699 - 1700 - if (of_get_property(np, "linux,rs485-enabled-at-boot-time", 1701 - NULL)) 1702 - rs485conf->flags |= SER_RS485_ENABLED; 1703 - } else { 1704 - port->rs485 = pdata->rs485; 1678 + /* rs485 properties */ 1679 + if (of_property_read_u32_array(np, "rs485-rts-delay", 1680 + rs485_delay, 2) == 0) { 1681 + rs485conf->delay_rts_before_send = rs485_delay[0]; 1682 + rs485conf->delay_rts_after_send = rs485_delay[1]; 1683 + rs485conf->flags = 0; 1705 1684 } 1706 1685 1686 + if (of_get_property(np, "rs485-rx-during-tx", NULL)) 1687 + rs485conf->flags |= SER_RS485_RX_DURING_TX; 1688 + 1689 + if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL)) 1690 + rs485conf->flags |= SER_RS485_ENABLED; 1707 1691 } 1708 1692 1709 1693 static void atmel_set_ops(struct uart_port *port) ··· 2369 2385 { 2370 2386 int ret; 2371 2387 struct uart_port *port = &atmel_port->uart; 2372 - struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); 2373 2388 2374 2389 atmel_init_property(atmel_port, pdev); 2375 2390 atmel_set_ops(port); ··· 2376 2393 atmel_init_rs485(port, pdev); 2377 2394 2378 2395 port->iotype = UPIO_MEM; 2379 - port->flags = UPF_BOOT_AUTOCONF; 2396 + port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP; 2380 2397 port->ops = &atmel_pops; 2381 2398 port->fifosize = 1; 2382 2399 port->dev = &pdev->dev; 2383 2400 port->mapbase = pdev->resource[0].start; 2384 2401 port->irq = pdev->resource[1].start; 2385 2402 port->rs485_config = atmel_config_rs485; 2403 + port->membase = NULL; 2386 2404 2387 2405 memset(&atmel_port->rx_ring, 0, sizeof(atmel_port->rx_ring)); 2388 - 2389 - if (pdata && pdata->regs) { 2390 - /* Already mapped by setup code */ 2391 - port->membase = pdata->regs; 2392 - } else { 2393 - port->flags |= UPF_IOREMAP; 2394 - port->membase = NULL; 2395 - } 2396 2406 2397 2407 /* for console, the clock could already be configured */ 2398 2408 if (!atmel_port->clk) { ··· 2720 2744 { 2721 2745 struct atmel_uart_port *atmel_port; 2722 2746 struct device_node *np = pdev->dev.of_node; 2723 - struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); 2724 2747 void *data; 2725 2748 int ret = -ENODEV; 2726 2749 bool rs485_enabled; 2727 2750 2728 2751 BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1)); 2729 2752 2730 - if (np) 2731 - ret = of_alias_get_id(np, "serial"); 2732 - else 2733 - if (pdata) 2734 - ret = pdata->num; 2735 - 2753 + ret = of_alias_get_id(np, "serial"); 2736 2754 if (ret < 0) 2737 2755 /* port id not found in platform data nor device-tree aliases: 2738 2756 * auto-enumerate it */
-10
include/linux/platform_data/atmel.h
··· 9 9 10 10 #include <linux/mtd/nand.h> 11 11 #include <linux/mtd/partitions.h> 12 - #include <linux/serial.h> 13 12 14 13 /* Compact Flash */ 15 14 struct at91_cf_data { ··· 39 40 40 41 /* default is false, only for at32ap7000 chip is true */ 41 42 bool need_reset_workaround; 42 - }; 43 - 44 - /* Serial */ 45 - struct atmel_uart_data { 46 - int num; /* port num */ 47 - short use_dma_tx; /* use transmit DMA? */ 48 - short use_dma_rx; /* use receive DMA? */ 49 - void __iomem *regs; /* virt. base address, if any */ 50 - struct serial_rs485 rs485; /* rs485 settings */ 51 43 }; 52 44 53 45 /* FIXME: this needs a better location, but gets stuff building again */