From patchwork Tue Jun 13 20:24:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 9784591 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC54C60212 for ; Tue, 13 Jun 2017 20:25:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B991E1FFAE for ; Tue, 13 Jun 2017 20:25:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC3951FFC9; Tue, 13 Jun 2017 20:25:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0BC9E1FFAE for ; Tue, 13 Jun 2017 20:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=DBN4LkIOIAGtMF8/1ZNQy5pWDTRtOh0YLqCPu6a2R60=; b=W7UaZjtYGEMIMSwCazq7YcJ5b4 UkMpHwWKn+g3tBlepbJ98GdbYYkr7s6ba/w6ZLfuWegT6lVfNBiyPTIZO/iaqqtNehRwWlWPY+95N jvYoGp7IQwIEBkhoW4aZ3WXif7u8zBbImD+5IjOAPezSAcL7EYGTGQ5t6D31LKTzR1ybJ5fzQIrwd /lHwmn79ofWM51aUmxdMhAjUT7pmd8JN/tt0N3BQO9NpuAAYwl2iPrJ1RFVO4Ilx6AV2xprwfR13x cDWP0ZlXqSn3Nl4N4zhpnf3xsqGLeem9eYLBX0Y6gohtYBrMhP4Si2wIHORXYpH+7UhSrDESWIdat XJjpyIBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dKsNI-0004HV-7m; Tue, 13 Jun 2017 20:25:16 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dKsN4-0002sJ-Qn for linux-arm-kernel@lists.infradead.org; Tue, 13 Jun 2017 20:25:04 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 133B721D9F; Tue, 13 Jun 2017 22:24:42 +0200 (CEST) Received: from localhost (unknown [88.191.26.124]) by mail.free-electrons.com (Postfix) with ESMTPSA id DCD0F21D8A; Tue, 13 Jun 2017 22:24:41 +0200 (CEST) From: Alexandre Belloni To: Richard Genoud , Greg Kroah-Hartman Subject: [PATCH v2 2/2] tty/serial: atmel: make the driver DT only Date: Tue, 13 Jun 2017 22:24:39 +0200 Message-Id: <20170613202439.26369-2-alexandre.belloni@free-electrons.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170613202439.26369-1-alexandre.belloni@free-electrons.com> References: <20170613202439.26369-1-alexandre.belloni@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170613_132503_163897_D40C43E6 X-CRM114-Status: GOOD ( 16.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Alexandre Belloni , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Richard Genoud --- drivers/tty/serial/atmel_serial.c | 96 +++++++++++++------------------------ 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 906e2b91bf57..937d67f22fba 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1655,72 +1655,56 @@ static void atmel_init_property(struct atmel_uart_port *atmel_port, struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); - - if (np) { - /* DMA/PDC usage specification */ - if (of_property_read_bool(np, "atmel,use-dma-rx")) { - if (of_property_read_bool(np, "dmas")) { - atmel_port->use_dma_rx = true; - atmel_port->use_pdc_rx = false; - } else { - atmel_port->use_dma_rx = false; - atmel_port->use_pdc_rx = true; - } + + /* DMA/PDC usage specification */ + if (of_property_read_bool(np, "atmel,use-dma-rx")) { + if (of_property_read_bool(np, "dmas")) { + atmel_port->use_dma_rx = true; + atmel_port->use_pdc_rx = false; } else { atmel_port->use_dma_rx = false; - atmel_port->use_pdc_rx = false; + atmel_port->use_pdc_rx = true; } + } else { + atmel_port->use_dma_rx = false; + atmel_port->use_pdc_rx = false; + } - if (of_property_read_bool(np, "atmel,use-dma-tx")) { - if (of_property_read_bool(np, "dmas")) { - atmel_port->use_dma_tx = true; - atmel_port->use_pdc_tx = false; - } else { - atmel_port->use_dma_tx = false; - atmel_port->use_pdc_tx = true; - } + if (of_property_read_bool(np, "atmel,use-dma-tx")) { + if (of_property_read_bool(np, "dmas")) { + atmel_port->use_dma_tx = true; + atmel_port->use_pdc_tx = false; } else { atmel_port->use_dma_tx = false; - atmel_port->use_pdc_tx = false; + atmel_port->use_pdc_tx = true; } - } else { - atmel_port->use_pdc_rx = pdata->use_dma_rx; - atmel_port->use_pdc_tx = pdata->use_dma_tx; - atmel_port->use_dma_rx = false; atmel_port->use_dma_tx = false; + atmel_port->use_pdc_tx = false; } - } static void atmel_init_rs485(struct uart_port *port, struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); - - if (np) { - struct serial_rs485 *rs485conf = &port->rs485; - u32 rs485_delay[2]; - /* rs485 properties */ - if (of_property_read_u32_array(np, "rs485-rts-delay", - rs485_delay, 2) == 0) { - rs485conf->delay_rts_before_send = rs485_delay[0]; - rs485conf->delay_rts_after_send = rs485_delay[1]; - rs485conf->flags = 0; - } - if (of_get_property(np, "rs485-rx-during-tx", NULL)) - rs485conf->flags |= SER_RS485_RX_DURING_TX; + struct serial_rs485 *rs485conf = &port->rs485; + u32 rs485_delay[2]; - if (of_get_property(np, "linux,rs485-enabled-at-boot-time", - NULL)) - rs485conf->flags |= SER_RS485_ENABLED; - } else { - port->rs485 = pdata->rs485; + /* rs485 properties */ + if (of_property_read_u32_array(np, "rs485-rts-delay", + rs485_delay, 2) == 0) { + rs485conf->delay_rts_before_send = rs485_delay[0]; + rs485conf->delay_rts_after_send = rs485_delay[1]; + rs485conf->flags = 0; } + if (of_get_property(np, "rs485-rx-during-tx", NULL)) + rs485conf->flags |= SER_RS485_RX_DURING_TX; + + if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL)) + rs485conf->flags |= SER_RS485_ENABLED; } static void atmel_set_ops(struct uart_port *port) @@ -2402,7 +2386,6 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port, { int ret; struct uart_port *port = &atmel_port->uart; - struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); atmel_init_property(atmel_port, pdev); atmel_set_ops(port); @@ -2410,24 +2393,17 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port, atmel_init_rs485(port, pdev); port->iotype = UPIO_MEM; - port->flags = UPF_BOOT_AUTOCONF; + port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP; port->ops = &atmel_pops; port->fifosize = 1; port->dev = &pdev->dev; port->mapbase = pdev->resource[0].start; port->irq = pdev->resource[1].start; port->rs485_config = atmel_config_rs485; + port->membase = NULL; memset(&atmel_port->rx_ring, 0, sizeof(atmel_port->rx_ring)); - if (pdata && pdata->regs) { - /* Already mapped by setup code */ - port->membase = pdata->regs; - } else { - port->flags |= UPF_IOREMAP; - port->membase = NULL; - } - /* for console, the clock could already be configured */ if (!atmel_port->clk) { atmel_port->clk = clk_get(&pdev->dev, "usart"); @@ -2761,19 +2737,13 @@ static int atmel_serial_probe(struct platform_device *pdev) { struct atmel_uart_port *atmel_port; struct device_node *np = pdev->dev.of_node; - struct atmel_uart_data *pdata = dev_get_platdata(&pdev->dev); void *data; int ret = -ENODEV; bool rs485_enabled; BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1)); - if (np) - ret = of_alias_get_id(np, "serial"); - else - if (pdata) - ret = pdata->num; - + ret = of_alias_get_id(np, "serial"); if (ret < 0) /* port id not found in platform data nor device-tree aliases: * 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 @@ #include #include -#include /* Compact Flash */ struct at91_cf_data { @@ -42,15 +41,6 @@ struct atmel_nand_data { bool need_reset_workaround; }; - /* Serial */ -struct atmel_uart_data { - int num; /* port num */ - short use_dma_tx; /* use transmit DMA? */ - short use_dma_rx; /* use receive DMA? */ - void __iomem *regs; /* virt. base address, if any */ - struct serial_rs485 rs485; /* rs485 settings */ -}; - /* FIXME: this needs a better location, but gets stuff building again */ extern int at91_suspend_entering_slow_clock(void);