Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp450688ybc; Tue, 19 Nov 2019 04:06:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwBCVMcXr2i4E2Icj69GUZRJgEn/bKxI2kob7bgxq9iZP0AAXAdqm1J+sUPrH+PVAJgwEhF X-Received: by 2002:a17:906:1cd8:: with SMTP id i24mr34471387ejh.149.1574165187919; Tue, 19 Nov 2019 04:06:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574165187; cv=none; d=google.com; s=arc-20160816; b=daRLh8qtBUVsuLf2VFRTp4wgTNOuZISbiEQ76O5U5lbRfM8EvRjYwRH8HBKZkweM/H Tspbb1styrMYoCrXFiIl4CLWBUaCVy1SgwlspTS+oiPi6tlkcgjyDm8e2lt1eZwHS+mM sBf8itvGD9vSGevjslwY3meOI7P86kQu0tw3zsk9K6WCXHLSc5n5YLnlaMRcaQsnWfnK 0QtvuBxGUj4hP6lpjWP8XF+jtcTKAjp5fxk3B8VE3+YM4FtO1tMAN9KapsejYdTyreW4 KPKarwQOh9xfx2AT3ExvOARSb4mTdmMxOXqr3f5awjdep1iGxBmXkvirMELLeAlKiEQV Jckw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=V37VOLVC6nZ7bOtXcoSScu2fdxthYnMNkBthP1SXCPs=; b=qRfvSZgYuQG3CmBWyBSkHABmUqfZwd1ur/nXs1FIk+QlG1mRb0MmJraNR2hn92jdvR h+Pb9IhvWEviUp5Qd0eNr7sqV64bgBP0RymfEu7JCny+WmzKUUPxWf+UHyHkpYfze4aP 5JXnpNJUGiQoa49U+HwKcRh7BT7rLJNZtnZ6lrkxf+k78UOCkY+cRnNWSwA3Nisa17Ma yrh60fkWik9iqdcCQx+Xq+WJ/2VUE2CS4tCQlss5w1+xAJpr2f4mco1W0Omgl9zgyVQA X0soZO2Tdso+0Phdwwl+dc3dZzZ34sIPh1zn9OMiEgMsokPeaK+uQh+OVA8yxRqys5cH ShzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oq69as9B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n27si15285764ejl.272.2019.11.19.04.06.02; Tue, 19 Nov 2019 04:06:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oq69as9B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727966AbfKSMBN (ORCPT + 99 others); Tue, 19 Nov 2019 07:01:13 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36163 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726351AbfKSMBM (ORCPT ); Tue, 19 Nov 2019 07:01:12 -0500 Received: by mail-wm1-f66.google.com with SMTP id c22so3271769wmd.1; Tue, 19 Nov 2019 04:01:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=V37VOLVC6nZ7bOtXcoSScu2fdxthYnMNkBthP1SXCPs=; b=oq69as9Bc4kYOs5o6p/Kei9PC3/vXLiG+jJ+jdbilJwBHqEv3kcsXBd4/i0MNd6Zvv 12ajbUizUEWFqcby6z19qiihS90G3aJA0dgKJVlWq+d2bD8LuTQXfsJOHgliVO8Ixpvp IARXXBa2sb50fKSYMu/5PXkmX/hQmCPe4T+rb37NIRCWru6DbMQO7VnZvL0/BdpeAWLR IhSkQqgaiiGfI9LdFkTaduio6G993kaI2tIq3dtDOSFiMYGxlfmM8AgWvu1jDMdJuG+b q6n30wQ8TITFwygmgknIcSg64jFY0b2Ow3pYUuVqtofIeU3GtgnpqF5qnZzKCtWeZ0xr aPmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=V37VOLVC6nZ7bOtXcoSScu2fdxthYnMNkBthP1SXCPs=; b=PnUxL87pEpQOqXPysT+qMYzxxKB+JwBU3S1aROAc6TPG/i/FIoDT25G99rsPI85DGe Xft0ausJlWKlqOpTMEyVycY50bqGfz9oMVQsdepgan387X6DU+oxw5xr6VJo6IEDG3iV RjuyeBFHzvwVtbplaRKAs3TN8Eq4oG4UcQqDlYIZKsAfIbboRuvg/27DeJeVxh3HKeON yWngAgNMl1IZDl8OpZ6WIBJzdaVBT+uff9QlT6YLVfKFPylx3EX2HLQgzQ/Cxda35Z9j /0EAcAY3d9VR2F8xBpoqT+Y8h568lCGLxkbH8BtHPLRAIMRP1osDSIZ2z75f2WQD62kk tK1Q== X-Gm-Message-State: APjAAAV6cyz0HTyOkX3n/KirQBAb92IlU1/RAjAXmAfRodE8PfwFVkMQ FfCBiclKTBdbC8qNGqOTJ7GpmWs2 X-Received: by 2002:a1c:dc09:: with SMTP id t9mr4964301wmg.65.1574164869407; Tue, 19 Nov 2019 04:01:09 -0800 (PST) Received: from [192.168.2.41] ([46.227.18.67]) by smtp.gmail.com with ESMTPSA id y8sm10850407wru.59.2019.11.19.04.01.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2019 04:01:08 -0800 (PST) Subject: Re: [PATCH 4.19 150/422] tty/serial: atmel: Change the driver to work under at91-usart MFD To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Nicolas Ferre , Radu Pirea Cc: "stable # 4 . 4+" , Andy Shevchenko , Richard Genoud , Lee Jones , Sasha Levin References: <20191119051400.261610025@linuxfoundation.org> <20191119051408.360814564@linuxfoundation.org> From: Richard Genoud Message-ID: <86754813-17ae-46c1-f222-1635c535668e@gmail.com> Date: Tue, 19 Nov 2019 13:01:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191119051408.360814564@linuxfoundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, Le 19/11/2019 à 06:15, Greg Kroah-Hartman a écrit : > From: Radu Pirea > > [ Upstream commit c24d25317a7c6bb3053d4c193b3cf57d1e9a3e4b ] > > This patch modifies the place where resources and device tree properties > are searched. Maybe I missed something, but I don't see why this is backported to stable. I don't think that this patch was send with a Cc: stable (I just came back from holidays, so I may be wrong :)) Moreover, it's part of a series that introduce "config MFD_AT91_USART", but grepping MFD_AT91_USART on stable-rc/linux-4.19.y only returns: drivers/tty/serial/Kconfig: select MFD_AT91_USART So I think this is a mistake (but how it got there ? it is by a bot or something ?) regards, Richard > > Signed-off-by: Radu Pirea > Reviewed-by: Andy Shevchenko > Acked-by: Richard Genoud > Acked-by: Nicolas Ferre > Acked-by: Greg Kroah-Hartman > Signed-off-by: Lee Jones > Signed-off-by: Sasha Levin > --- > drivers/tty/serial/Kconfig | 1 + > drivers/tty/serial/atmel_serial.c | 42 ++++++++++++++++++++----------- > 2 files changed, 28 insertions(+), 15 deletions(-) > > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig > index df8bd0c7b97db..32886c3046413 100644 > --- a/drivers/tty/serial/Kconfig > +++ b/drivers/tty/serial/Kconfig > @@ -118,6 +118,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 dd8949e8fcd7a..251f708f47f76 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -195,8 +195,7 @@ 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" }, > { /* sentinel */ } > }; > #endif > @@ -926,6 +925,7 @@ static void atmel_tx_dma(struct uart_port *port) > static int atmel_prepare_tx_dma(struct uart_port *port) > { > struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > + struct device *mfd_dev = port->dev->parent; > dma_cap_mask_t mask; > struct dma_slave_config config; > int ret, nent; > @@ -933,7 +933,7 @@ static int atmel_prepare_tx_dma(struct uart_port *port) > dma_cap_zero(mask); > dma_cap_set(DMA_SLAVE, mask); > > - atmel_port->chan_tx = dma_request_slave_channel(port->dev, "tx"); > + atmel_port->chan_tx = dma_request_slave_channel(mfd_dev, "tx"); > if (atmel_port->chan_tx == NULL) > goto chan_err; > dev_info(port->dev, "using %s for tx DMA transfers\n", > @@ -1104,6 +1104,7 @@ static void atmel_rx_from_dma(struct uart_port *port) > static int atmel_prepare_rx_dma(struct uart_port *port) > { > struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > + struct device *mfd_dev = port->dev->parent; > struct dma_async_tx_descriptor *desc; > dma_cap_mask_t mask; > struct dma_slave_config config; > @@ -1115,7 +1116,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port) > dma_cap_zero(mask); > dma_cap_set(DMA_CYCLIC, mask); > > - atmel_port->chan_rx = dma_request_slave_channel(port->dev, "rx"); > + atmel_port->chan_rx = dma_request_slave_channel(mfd_dev, "rx"); > if (atmel_port->chan_rx == NULL) > goto chan_err; > dev_info(port->dev, "using %s for rx DMA transfers\n", > @@ -2246,8 +2247,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; > + struct platform_device *mpdev = to_platform_device(port->dev->parent); > + int size = resource_size(mpdev->resource); > > release_mem_region(port->mapbase, size); > > @@ -2262,8 +2263,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; > + struct platform_device *mpdev = to_platform_device(port->dev->parent); > + int size = resource_size(mpdev->resource); > > if (!request_mem_region(port->mapbase, size, "atmel_serial")) > return -EBUSY; > @@ -2365,27 +2366,28 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port, > { > int ret; > struct uart_port *port = &atmel_port->uart; > + struct platform_device *mpdev = to_platform_device(pdev->dev.parent); > > atmel_init_property(atmel_port, pdev); > atmel_set_ops(port); > > - uart_get_rs485_mode(&pdev->dev, &port->rs485); > + uart_get_rs485_mode(&mpdev->dev, &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 = mpdev->resource[0].start; > + port->irq = mpdev->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(&mpdev->dev, "usart"); > if (IS_ERR(atmel_port->clk)) { > ret = PTR_ERR(atmel_port->clk); > atmel_port->clk = NULL; > @@ -2718,13 +2720,22 @@ 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)); > > + /* > + * In device tree there is no node with "atmel,at91rm9200-usart-serial" > + * as compatible string. This driver is probed by at91-usart mfd driver > + * which is just a wrapper over the atmel_serial driver and > + * spi-at91-usart driver. All attributes needed by this driver are > + * found in of_node of parent. > + */ > + pdev->dev.of_node = np; > + > ret = of_alias_get_id(np, "serial"); > if (ret < 0) > /* port id not found in platform data nor device-tree aliases: > @@ -2860,6 +2871,7 @@ static int atmel_serial_remove(struct platform_device *pdev) > > clk_put(atmel_port->clk); > atmel_port->clk = NULL; > + pdev->dev.of_node = NULL; > > return ret; > } > @@ -2870,7 +2882,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), > }, > }; >