diff options
| author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2017-06-13 16:24:39 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-06-14 06:48:48 -0400 |
| commit | 92c8f7c0e109d2fcff607a13dd7c1437d6c9f87a (patch) | |
| tree | 3c329324e18e45a1b366800067892201b7f98e45 | |
| parent | 274a5ed6d8ca16f65bccdce95a14ecf29ff81764 (diff) | |
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>
| -rw-r--r-- | drivers/tty/serial/atmel_serial.c | 96 | ||||
| -rw-r--r-- | include/linux/platform_data/atmel.h | 10 |
2 files changed, 33 insertions, 73 deletions
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index b8d9f8f06b85..7551cab438ff 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
| @@ -1638,72 +1638,56 @@ static void atmel_init_property(struct atmel_uart_port *atmel_port, | |||
| 1638 | struct platform_device *pdev) | 1638 | struct platform_device *pdev) |
| 1639 | { | 1639 | { |
| 1640 | struct device_node *np = pdev->dev.of_node; | 1640 | struct device_node *np = pdev->dev.of_node; |
| 1641 | struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); | 1641 | |
| 1642 | 1642 | /* DMA/PDC usage specification */ | |
| 1643 | if (np) { | 1643 | if (of_property_read_bool(np, "atmel,use-dma-rx")) { |
| 1644 | /* DMA/PDC usage specification */ | 1644 | if (of_property_read_bool(np, "dmas")) { |
| 1645 | if (of_property_read_bool(np, "atmel,use-dma-rx")) { | 1645 | atmel_port->use_dma_rx = true; |
| 1646 | if (of_property_read_bool(np, "dmas")) { | 1646 | atmel_port->use_pdc_rx = false; |
| 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 | } | ||
| 1653 | } else { | 1647 | } else { |
| 1654 | atmel_port->use_dma_rx = false; | 1648 | atmel_port->use_dma_rx = false; |
| 1655 | atmel_port->use_pdc_rx = false; | 1649 | atmel_port->use_pdc_rx = true; |
| 1656 | } | 1650 | } |
| 1651 | } else { | ||
| 1652 | atmel_port->use_dma_rx = false; | ||
| 1653 | atmel_port->use_pdc_rx = false; | ||
| 1654 | } | ||
| 1657 | 1655 | ||
| 1658 | if (of_property_read_bool(np, "atmel,use-dma-tx")) { | 1656 | if (of_property_read_bool(np, "atmel,use-dma-tx")) { |
| 1659 | if (of_property_read_bool(np, "dmas")) { | 1657 | if (of_property_read_bool(np, "dmas")) { |
| 1660 | atmel_port->use_dma_tx = true; | 1658 | atmel_port->use_dma_tx = true; |
| 1661 | atmel_port->use_pdc_tx = false; | 1659 | 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 { | 1660 | } else { |
| 1667 | atmel_port->use_dma_tx = false; | 1661 | atmel_port->use_dma_tx = false; |
| 1668 | atmel_port->use_pdc_tx = false; | 1662 | atmel_port->use_pdc_tx = true; |
| 1669 | } | 1663 | } |
| 1670 | |||
| 1671 | } else { | 1664 | } else { |
| 1672 | atmel_port->use_pdc_rx = pdata->use_dma_rx; | ||
| 1673 | atmel_port->use_pdc_tx = pdata->use_dma_tx; | ||
| 1674 | atmel_port->use_dma_rx = false; | ||
| 1675 | atmel_port->use_dma_tx = false; | 1665 | atmel_port->use_dma_tx = false; |
| 1666 | atmel_port->use_pdc_tx = false; | ||
| 1676 | } | 1667 | } |
| 1677 | |||
| 1678 | } | 1668 | } |
| 1679 | 1669 | ||
| 1680 | static void atmel_init_rs485(struct uart_port *port, | 1670 | static void atmel_init_rs485(struct uart_port *port, |
| 1681 | struct platform_device *pdev) | 1671 | struct platform_device *pdev) |
| 1682 | { | 1672 | { |
| 1683 | struct device_node *np = pdev->dev.of_node; | 1673 | struct device_node *np = pdev->dev.of_node; |
| 1684 | struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); | ||
| 1685 | |||
| 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 | } | ||
| 1696 | 1674 | ||
| 1697 | if (of_get_property(np, "rs485-rx-during-tx", NULL)) | 1675 | struct serial_rs485 *rs485conf = &port->rs485; |
| 1698 | rs485conf->flags |= SER_RS485_RX_DURING_TX; | 1676 | u32 rs485_delay[2]; |
| 1699 | 1677 | ||
| 1700 | if (of_get_property(np, "linux,rs485-enabled-at-boot-time", | 1678 | /* rs485 properties */ |
| 1701 | NULL)) | 1679 | if (of_property_read_u32_array(np, "rs485-rts-delay", |
| 1702 | rs485conf->flags |= SER_RS485_ENABLED; | 1680 | rs485_delay, 2) == 0) { |
| 1703 | } else { | 1681 | rs485conf->delay_rts_before_send = rs485_delay[0]; |
| 1704 | port->rs485 = pdata->rs485; | 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 | static void atmel_set_ops(struct uart_port *port) | 1693 | static void atmel_set_ops(struct uart_port *port) |
| @@ -2385,7 +2369,6 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port, | |||
| 2385 | { | 2369 | { |
| 2386 | int ret; | 2370 | int ret; |
| 2387 | struct uart_port *port = &atmel_port->uart; | 2371 | struct uart_port *port = &atmel_port->uart; |
| 2388 | struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); | ||
| 2389 | 2372 | ||
| 2390 | atmel_init_property(atmel_port, pdev); | 2373 | atmel_init_property(atmel_port, pdev); |
| 2391 | atmel_set_ops(port); | 2374 | atmel_set_ops(port); |
| @@ -2393,24 +2376,17 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port, | |||
| 2393 | atmel_init_rs485(port, pdev); | 2376 | atmel_init_rs485(port, pdev); |
| 2394 | 2377 | ||
| 2395 | port->iotype = UPIO_MEM; | 2378 | port->iotype = UPIO_MEM; |
| 2396 | port->flags = UPF_BOOT_AUTOCONF; | 2379 | port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP; |
| 2397 | port->ops = &atmel_pops; | 2380 | port->ops = &atmel_pops; |
| 2398 | port->fifosize = 1; | 2381 | port->fifosize = 1; |
| 2399 | port->dev = &pdev->dev; | 2382 | port->dev = &pdev->dev; |
| 2400 | port->mapbase = pdev->resource[0].start; | 2383 | port->mapbase = pdev->resource[0].start; |
| 2401 | port->irq = pdev->resource[1].start; | 2384 | port->irq = pdev->resource[1].start; |
| 2402 | port->rs485_config = atmel_config_rs485; | 2385 | port->rs485_config = atmel_config_rs485; |
| 2386 | port->membase = NULL; | ||
| 2403 | 2387 | ||
| 2404 | memset(&atmel_port->rx_ring, 0, sizeof(atmel_port->rx_ring)); | 2388 | memset(&atmel_port->rx_ring, 0, sizeof(atmel_port->rx_ring)); |
| 2405 | 2389 | ||
| 2406 | if (pdata && pdata->regs) { | ||
| 2407 | /* Already mapped by setup code */ | ||
| 2408 | port->membase = pdata->regs; | ||
| 2409 | } else { | ||
| 2410 | port->flags |= UPF_IOREMAP; | ||
| 2411 | port->membase = NULL; | ||
| 2412 | } | ||
| 2413 | |||
| 2414 | /* for console, the clock could already be configured */ | 2390 | /* for console, the clock could already be configured */ |
| 2415 | if (!atmel_port->clk) { | 2391 | if (!atmel_port->clk) { |
| 2416 | atmel_port->clk = clk_get(&pdev->dev, "usart"); | 2392 | atmel_port->clk = clk_get(&pdev->dev, "usart"); |
| @@ -2744,19 +2720,13 @@ static int atmel_serial_probe(struct platform_device *pdev) | |||
| 2744 | { | 2720 | { |
| 2745 | struct atmel_uart_port *atmel_port; | 2721 | struct atmel_uart_port *atmel_port; |
| 2746 | struct device_node *np = pdev->dev.of_node; | 2722 | struct device_node *np = pdev->dev.of_node; |
| 2747 | struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); | ||
| 2748 | void *data; | 2723 | void *data; |
| 2749 | int ret = -ENODEV; | 2724 | int ret = -ENODEV; |
| 2750 | bool rs485_enabled; | 2725 | bool rs485_enabled; |
| 2751 | 2726 | ||
| 2752 | BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1)); | 2727 | BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1)); |
| 2753 | 2728 | ||
| 2754 | if (np) | 2729 | ret = of_alias_get_id(np, "serial"); |
| 2755 | ret = of_alias_get_id(np, "serial"); | ||
| 2756 | else | ||
| 2757 | if (pdata) | ||
| 2758 | ret = pdata->num; | ||
| 2759 | |||
| 2760 | if (ret < 0) | 2730 | if (ret < 0) |
| 2761 | /* port id not found in platform data nor device-tree aliases: | 2731 | /* port id not found in platform data nor device-tree aliases: |
| 2762 | * auto-enumerate it */ | 2732 | * auto-enumerate it */ |
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h index 3c8825b67298..d36bc8d17e97 100644 --- a/include/linux/platform_data/atmel.h +++ b/include/linux/platform_data/atmel.h | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/mtd/nand.h> | 10 | #include <linux/mtd/nand.h> |
| 11 | #include <linux/mtd/partitions.h> | 11 | #include <linux/mtd/partitions.h> |
| 12 | #include <linux/serial.h> | ||
| 13 | 12 | ||
| 14 | /* Compact Flash */ | 13 | /* Compact Flash */ |
| 15 | struct at91_cf_data { | 14 | struct at91_cf_data { |
| @@ -42,15 +41,6 @@ struct atmel_nand_data { | |||
| 42 | bool need_reset_workaround; | 41 | bool need_reset_workaround; |
| 43 | }; | 42 | }; |
| 44 | 43 | ||
| 45 | /* Serial */ | ||
| 46 | struct atmel_uart_data { | ||
| 47 | int num; /* port num */ | ||
| 48 | short use_dma_tx; /* use transmit DMA? */ | ||
| 49 | short use_dma_rx; /* use receive DMA? */ | ||
| 50 | void __iomem *regs; /* virt. base address, if any */ | ||
| 51 | struct serial_rs485 rs485; /* rs485 settings */ | ||
| 52 | }; | ||
| 53 | |||
| 54 | /* FIXME: this needs a better location, but gets stuff building again */ | 44 | /* FIXME: this needs a better location, but gets stuff building again */ |
| 55 | extern int at91_suspend_entering_slow_clock(void); | 45 | extern int at91_suspend_entering_slow_clock(void); |
| 56 | 46 | ||
