From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751709AbdEJGGc (ORCPT ); Wed, 10 May 2017 02:06:32 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:35860 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751121AbdEJGG3 (ORCPT ); Wed, 10 May 2017 02:06:29 -0400 MIME-Version: 1.0 In-Reply-To: <83e341e654f5e8e788ee684bf3de51e6@agner.ch> References: <1494316248-24052-1-git-send-email-aisheng.dong@nxp.com> <1494316248-24052-2-git-send-email-aisheng.dong@nxp.com> <83e341e654f5e8e788ee684bf3de51e6@agner.ch> From: Dong Aisheng Date: Wed, 10 May 2017 14:06:27 +0800 Message-ID: Subject: Re: [PATCH 1/6] tty: serial: lpuart: introduce lpuart_soc_data to represent SoC property To: Stefan Agner Cc: Dong Aisheng , linux-serial@vger.kernel.org, "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , gregkh , jslaby@suse.com, Fugang Duan , Mingkai.Hu@nxp.com, yangbo.lu@nxp.com Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stefan, On Wed, May 10, 2017 at 11:50 AM, Stefan Agner wrote: > On 2017-05-09 00:50, Dong Aisheng wrote: >> This is used to dynamically check the SoC specific lpuart properies. >> Currently only the checking of 32 bit register width is added which >> functions the same as before. More will be added later for supporting >> new chips. >> >> Cc: Greg Kroah-Hartman >> Cc: Jiri Slaby >> Cc: Fugang Duan >> Cc: Stefan Agner >> Cc: Mingkai Hu >> Cc: Yangbo Lu >> Signed-off-by: Dong Aisheng >> --- >> drivers/tty/serial/fsl_lpuart.c | 25 ++++++++++++++++++------- >> 1 file changed, 18 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c >> index 15df1ba7..cd4e905 100644 >> --- a/drivers/tty/serial/fsl_lpuart.c >> +++ b/drivers/tty/serial/fsl_lpuart.c >> @@ -258,13 +258,21 @@ struct lpuart_port { >> wait_queue_head_t dma_wait; >> }; >> >> +struct lpuart_soc_data { >> + bool is_32; >> +}; >> + >> +static struct lpuart_soc_data vf_data = { >> + .is_32 = false, >> +}; >> + >> +static struct lpuart_soc_data ls_data = { >> + .is_32 = true, >> +}; > > This could be const I guess? > Yes, of course. Thanks for the pointing out. Regards Dong Aisheng > -- > Stefan > >> + >> static const struct of_device_id lpuart_dt_ids[] = { >> - { >> - .compatible = "fsl,vf610-lpuart", >> - }, >> - { >> - .compatible = "fsl,ls1021a-lpuart", >> - }, >> + { .compatible = "fsl,vf610-lpuart", .data = &vf_data, }, >> + { .compatible = "fsl,ls1021a-lpuart", .data = &ls_data, }, >> { /* sentinel */ } >> }; >> MODULE_DEVICE_TABLE(of, lpuart_dt_ids); >> @@ -1971,6 +1979,9 @@ static struct uart_driver lpuart_reg = { >> >> static int lpuart_probe(struct platform_device *pdev) >> { >> + const struct of_device_id *of_id = of_match_device(lpuart_dt_ids, >> + &pdev->dev); >> + const struct lpuart_soc_data *sdata = of_id->data; >> struct device_node *np = pdev->dev.of_node; >> struct lpuart_port *sport; >> struct resource *res; >> @@ -1988,7 +1999,7 @@ static int lpuart_probe(struct platform_device *pdev) >> return ret; >> } >> sport->port.line = ret; >> - sport->lpuart32 = of_device_is_compatible(np, "fsl,ls1021a-lpuart"); >> + sport->lpuart32 = sdata->is_32; >> >> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> sport->port.membase = devm_ioremap_resource(&pdev->dev, res); From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dong Aisheng Subject: Re: [PATCH 1/6] tty: serial: lpuart: introduce lpuart_soc_data to represent SoC property Date: Wed, 10 May 2017 14:06:27 +0800 Message-ID: References: <1494316248-24052-1-git-send-email-aisheng.dong@nxp.com> <1494316248-24052-2-git-send-email-aisheng.dong@nxp.com> <83e341e654f5e8e788ee684bf3de51e6@agner.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <83e341e654f5e8e788ee684bf3de51e6@agner.ch> Sender: linux-kernel-owner@vger.kernel.org To: Stefan Agner Cc: Dong Aisheng , linux-serial@vger.kernel.org, "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , gregkh , jslaby@suse.com, Fugang Duan , Mingkai.Hu@nxp.com, yangbo.lu@nxp.com List-Id: linux-serial@vger.kernel.org Hi Stefan, On Wed, May 10, 2017 at 11:50 AM, Stefan Agner wrote: > On 2017-05-09 00:50, Dong Aisheng wrote: >> This is used to dynamically check the SoC specific lpuart properies. >> Currently only the checking of 32 bit register width is added which >> functions the same as before. More will be added later for supporting >> new chips. >> >> Cc: Greg Kroah-Hartman >> Cc: Jiri Slaby >> Cc: Fugang Duan >> Cc: Stefan Agner >> Cc: Mingkai Hu >> Cc: Yangbo Lu >> Signed-off-by: Dong Aisheng >> --- >> drivers/tty/serial/fsl_lpuart.c | 25 ++++++++++++++++++------- >> 1 file changed, 18 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c >> index 15df1ba7..cd4e905 100644 >> --- a/drivers/tty/serial/fsl_lpuart.c >> +++ b/drivers/tty/serial/fsl_lpuart.c >> @@ -258,13 +258,21 @@ struct lpuart_port { >> wait_queue_head_t dma_wait; >> }; >> >> +struct lpuart_soc_data { >> + bool is_32; >> +}; >> + >> +static struct lpuart_soc_data vf_data = { >> + .is_32 = false, >> +}; >> + >> +static struct lpuart_soc_data ls_data = { >> + .is_32 = true, >> +}; > > This could be const I guess? > Yes, of course. Thanks for the pointing out. Regards Dong Aisheng > -- > Stefan > >> + >> static const struct of_device_id lpuart_dt_ids[] = { >> - { >> - .compatible = "fsl,vf610-lpuart", >> - }, >> - { >> - .compatible = "fsl,ls1021a-lpuart", >> - }, >> + { .compatible = "fsl,vf610-lpuart", .data = &vf_data, }, >> + { .compatible = "fsl,ls1021a-lpuart", .data = &ls_data, }, >> { /* sentinel */ } >> }; >> MODULE_DEVICE_TABLE(of, lpuart_dt_ids); >> @@ -1971,6 +1979,9 @@ static struct uart_driver lpuart_reg = { >> >> static int lpuart_probe(struct platform_device *pdev) >> { >> + const struct of_device_id *of_id = of_match_device(lpuart_dt_ids, >> + &pdev->dev); >> + const struct lpuart_soc_data *sdata = of_id->data; >> struct device_node *np = pdev->dev.of_node; >> struct lpuart_port *sport; >> struct resource *res; >> @@ -1988,7 +1999,7 @@ static int lpuart_probe(struct platform_device *pdev) >> return ret; >> } >> sport->port.line = ret; >> - sport->lpuart32 = of_device_is_compatible(np, "fsl,ls1021a-lpuart"); >> + sport->lpuart32 = sdata->is_32; >> >> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> sport->port.membase = devm_ioremap_resource(&pdev->dev, res); From mboxrd@z Thu Jan 1 00:00:00 1970 From: dongas86@gmail.com (Dong Aisheng) Date: Wed, 10 May 2017 14:06:27 +0800 Subject: [PATCH 1/6] tty: serial: lpuart: introduce lpuart_soc_data to represent SoC property In-Reply-To: <83e341e654f5e8e788ee684bf3de51e6@agner.ch> References: <1494316248-24052-1-git-send-email-aisheng.dong@nxp.com> <1494316248-24052-2-git-send-email-aisheng.dong@nxp.com> <83e341e654f5e8e788ee684bf3de51e6@agner.ch> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Stefan, On Wed, May 10, 2017 at 11:50 AM, Stefan Agner wrote: > On 2017-05-09 00:50, Dong Aisheng wrote: >> This is used to dynamically check the SoC specific lpuart properies. >> Currently only the checking of 32 bit register width is added which >> functions the same as before. More will be added later for supporting >> new chips. >> >> Cc: Greg Kroah-Hartman >> Cc: Jiri Slaby >> Cc: Fugang Duan >> Cc: Stefan Agner >> Cc: Mingkai Hu >> Cc: Yangbo Lu >> Signed-off-by: Dong Aisheng >> --- >> drivers/tty/serial/fsl_lpuart.c | 25 ++++++++++++++++++------- >> 1 file changed, 18 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c >> index 15df1ba7..cd4e905 100644 >> --- a/drivers/tty/serial/fsl_lpuart.c >> +++ b/drivers/tty/serial/fsl_lpuart.c >> @@ -258,13 +258,21 @@ struct lpuart_port { >> wait_queue_head_t dma_wait; >> }; >> >> +struct lpuart_soc_data { >> + bool is_32; >> +}; >> + >> +static struct lpuart_soc_data vf_data = { >> + .is_32 = false, >> +}; >> + >> +static struct lpuart_soc_data ls_data = { >> + .is_32 = true, >> +}; > > This could be const I guess? > Yes, of course. Thanks for the pointing out. Regards Dong Aisheng > -- > Stefan > >> + >> static const struct of_device_id lpuart_dt_ids[] = { >> - { >> - .compatible = "fsl,vf610-lpuart", >> - }, >> - { >> - .compatible = "fsl,ls1021a-lpuart", >> - }, >> + { .compatible = "fsl,vf610-lpuart", .data = &vf_data, }, >> + { .compatible = "fsl,ls1021a-lpuart", .data = &ls_data, }, >> { /* sentinel */ } >> }; >> MODULE_DEVICE_TABLE(of, lpuart_dt_ids); >> @@ -1971,6 +1979,9 @@ static struct uart_driver lpuart_reg = { >> >> static int lpuart_probe(struct platform_device *pdev) >> { >> + const struct of_device_id *of_id = of_match_device(lpuart_dt_ids, >> + &pdev->dev); >> + const struct lpuart_soc_data *sdata = of_id->data; >> struct device_node *np = pdev->dev.of_node; >> struct lpuart_port *sport; >> struct resource *res; >> @@ -1988,7 +1999,7 @@ static int lpuart_probe(struct platform_device *pdev) >> return ret; >> } >> sport->port.line = ret; >> - sport->lpuart32 = of_device_is_compatible(np, "fsl,ls1021a-lpuart"); >> + sport->lpuart32 = sdata->is_32; >> >> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> sport->port.membase = devm_ioremap_resource(&pdev->dev, res);