From patchwork Fri May 11 10:38:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radu Pirea X-Patchwork-Id: 10393911 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 B32C760236 for ; Fri, 11 May 2018 10:42:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6B6A28E6E for ; Fri, 11 May 2018 10:42:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB21328E71; Fri, 11 May 2018 10:42:50 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 4308B28E6E for ; Fri, 11 May 2018 10:42:50 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=cySHvr2QdmXe14ms56Cw40i3sMfdC0MfrB1tSzqEIKo=; b=lxXHo5U9cPBM+z z23F05NzMna3DEyw6lRqIEd4M494+nFJzfbDrRLvb53VH5W06YsQYPu+uvo45XR5A6qqZzMzH10K2 /uUD/kZhMfeUHuJ6kxVhPj8Y1a6rHYOyabtDk85uudrogTy6VQMb0UmMh+67BUp35JBcpAZnUjHwh 5yurhWEENJ16U/611jYbPQJzzfrkoTY7Ad2lX5dqpD7QBBfS7kpyUg4CIg0M6E/9mebaULvj8nxcN 5/J161/QEjitL36OR32a40RuH3LULCOwFVOW1WCDl9GyeVJUJv7e+W9lxhysSa1ujm+6UWcOe7+1z ZZxhHgeXf6ETNEuPk8Fw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fH5VV-0006ZH-6l; Fri, 11 May 2018 10:42:37 +0000 Received: from esa6.microchip.iphmx.com ([216.71.154.253]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fH5Qv-0002yk-KG for linux-arm-kernel@lists.infradead.org; Fri, 11 May 2018 10:37:55 +0000 X-IronPort-AV: E=Sophos;i="5.49,388,1520924400"; d="scan'208";a="11427339" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 11 May 2018 03:37:42 -0700 Received: from m19893.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Fri, 11 May 2018 03:37:41 -0700 From: Radu Pirea To: , , , , Subject: [PATCH v3 6/6] tty/serial: atmel: changed the driver to work under at91-usart mfd Date: Fri, 11 May 2018 13:38:22 +0300 Message-ID: <20180511103822.31698-7-radu.pirea@microchip.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511103822.31698-1-radu.pirea@microchip.com> References: <20180511103822.31698-1-radu.pirea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180511_033753_784101_5F636190 X-CRM114-Status: GOOD ( 15.04 ) 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: mark.rutland@arm.com, alexandre.belloni@bootlin.com, richard.genoud@gmail.com, gregkh@linuxfoundation.org, broonie@kernel.org, robh+dt@kernel.org, jslaby@suse.com, Radu Pirea , lee.jones@linaro.org 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 This patch modifies the place where resources and device tree properties are searched. Signed-off-by: Radu Pirea --- drivers/tty/serial/Kconfig | 1 + drivers/tty/serial/atmel_serial.c | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 3682fd3e960c..25e55332f8b1 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -119,6 +119,7 @@ config SERIAL_ATMEL depends on ARCH_AT91 || COMPILE_TEST select SERIAL_CORE select SERIAL_MCTRL_GPIO if GPIOLIB + select MFD_AT91_USART help This enables the driver for the on-chip UARTs of the Atmel AT91 processors. diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index df46a9e88c34..6b4494352853 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -193,8 +193,8 @@ static struct console atmel_console; #if defined(CONFIG_OF) static const struct of_device_id atmel_serial_dt_ids[] = { - { .compatible = "atmel,at91rm9200-usart" }, - { .compatible = "atmel,at91sam9260-usart" }, + { .compatible = "atmel,at91rm9200-usart-serial" }, + { .compatible = "atmel,at91sam9260-usart-serial" }, { /* sentinel */ } }; #endif @@ -1631,7 +1631,7 @@ static void atmel_tasklet_tx_func(unsigned long data) static void atmel_init_property(struct atmel_uart_port *atmel_port, struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.parent->of_node; /* DMA/PDC usage specification */ if (of_property_read_bool(np, "atmel,use-dma-rx")) { @@ -2223,7 +2223,8 @@ static const char *atmel_type(struct uart_port *port) static void atmel_release_port(struct uart_port *port) { struct platform_device *pdev = to_platform_device(port->dev); - int size = pdev->resource[0].end - pdev->resource[0].start + 1; + int size = to_platform_device(pdev->dev.parent)->resource[0].end - + to_platform_device(pdev->dev.parent)->resource[0].start + 1; release_mem_region(port->mapbase, size); @@ -2239,7 +2240,8 @@ static void atmel_release_port(struct uart_port *port) static int atmel_request_port(struct uart_port *port) { struct platform_device *pdev = to_platform_device(port->dev); - int size = pdev->resource[0].end - pdev->resource[0].start + 1; + int size = to_platform_device(pdev->dev.parent)->resource[0].end - + to_platform_device(pdev->dev.parent)->resource[0].start + 1; if (!request_mem_region(port->mapbase, size, "atmel_serial")) return -EBUSY; @@ -2345,23 +2347,23 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port, atmel_init_property(atmel_port, pdev); atmel_set_ops(port); - uart_get_rs485_mode(&pdev->dev, &port->rs485); + uart_get_rs485_mode(pdev->dev.parent, &port->rs485); port->iotype = UPIO_MEM; 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->mapbase = to_platform_device(pdev->dev.parent)->resource[0].start; + port->irq = to_platform_device(pdev->dev.parent)->resource[1].start; port->rs485_config = atmel_config_rs485; - port->membase = NULL; + port->membase = NULL; memset(&atmel_port->rx_ring, 0, sizeof(atmel_port->rx_ring)); /* for console, the clock could already be configured */ if (!atmel_port->clk) { - atmel_port->clk = clk_get(&pdev->dev, "usart"); + atmel_port->clk = clk_get(pdev->dev.parent, "usart"); if (IS_ERR(atmel_port->clk)) { ret = PTR_ERR(atmel_port->clk); atmel_port->clk = NULL; @@ -2656,7 +2658,7 @@ static void atmel_serial_probe_fifos(struct atmel_uart_port *atmel_port, atmel_port->rts_low = 0; atmel_port->rts_high = 0; - if (of_property_read_u32(pdev->dev.of_node, + if (of_property_read_u32(pdev->dev.parent->of_node, "atmel,fifo-size", &atmel_port->fifo_size)) return; @@ -2694,11 +2696,10 @@ static void atmel_serial_probe_fifos(struct atmel_uart_port *atmel_port, static int atmel_serial_probe(struct platform_device *pdev) { struct atmel_uart_port *atmel_port; - struct device_node *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.parent->of_node; void *data; int ret = -ENODEV; bool rs485_enabled; - BUILD_BUG_ON(ATMEL_SERIAL_RINGSIZE & (ATMEL_SERIAL_RINGSIZE - 1)); ret = of_alias_get_id(np, "serial"); @@ -2845,7 +2846,7 @@ static struct platform_driver atmel_serial_driver = { .suspend = atmel_serial_suspend, .resume = atmel_serial_resume, .driver = { - .name = "atmel_usart", + .name = "atmel_usart_serial", .of_match_table = of_match_ptr(atmel_serial_dt_ids), }, };