From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DBAEC43331 for ; Fri, 6 Sep 2019 14:39:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A42F206A1 for ; Fri, 6 Sep 2019 14:39:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394504AbfIFOjv (ORCPT ); Fri, 6 Sep 2019 10:39:51 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:46065 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389288AbfIFOjs (ORCPT ); Fri, 6 Sep 2019 10:39:48 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1i6FOm-0005ih-UF; Fri, 06 Sep 2019 16:39:40 +0200 Received: from ore by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1i6FOk-0008Ns-3e; Fri, 06 Sep 2019 16:39:38 +0200 Date: Fri, 6 Sep 2019 16:39:38 +0200 From: Oleksij Rempel To: Biwen Li Cc: andy.shevchenko@gmail.com, rafael@kernel.org, leoyang.li@nxp.com, meenakshi.aggarwal@nxp.com, udit.kumar@nxp.com, wsa@the-dreams.de, rjw@rjwysocki.net, chuanhua.han@nxp.com, shawnguo@kernel.org, s.hauer@pengutronix.de, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [v2] ACPI: support for NXP i2c controller Message-ID: <20190906143938.weqs6rvdvlnrzpau@pengutronix.de> References: <20190906075319.21244-1-biwen.li@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190906075319.21244-1-biwen.li@nxp.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 16:09:03 up 111 days, 20:27, 66 users, load average: 0.07, 0.06, 0.01 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-acpi@vger.kernel.org Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Fri, Sep 06, 2019 at 03:53:19PM +0800, Biwen Li wrote: > From: Chuanhua Han > > Enable NXP i2c controller to boot with ACPI > > Signed-off-by: Meenakshi Aggarwal > Signed-off-by: Udit Kumar > Signed-off-by: Chuanhua Han > Signed-off-by: Biwen Li for i2c-imx.c: Acked-by: Oleksij Rempel Tested on iMX6Q SabreSD Tested-by: Oleksij Rempel > --- > Change in v2: > - Simplify code > - Adjust header file order > - Not use ACPI_PTR() > > drivers/acpi/acpi_apd.c | 7 +++++++ > drivers/i2c/busses/i2c-imx.c | 17 +++++++++++++---- > 2 files changed, 20 insertions(+), 4 deletions(-) > > diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c > index 7cd0c9ac71ea..71511ae2dfcd 100644 > --- a/drivers/acpi/acpi_apd.c > +++ b/drivers/acpi/acpi_apd.c > @@ -160,11 +160,17 @@ static const struct apd_device_desc hip08_i2c_desc = { > .setup = acpi_apd_setup, > .fixed_clk_rate = 250000000, > }; > + > static const struct apd_device_desc thunderx2_i2c_desc = { > .setup = acpi_apd_setup, > .fixed_clk_rate = 125000000, > }; > > +static const struct apd_device_desc nxp_i2c_desc = { > + .setup = acpi_apd_setup, > + .fixed_clk_rate = 350000000, > +}; > + > static const struct apd_device_desc hip08_spi_desc = { > .setup = acpi_apd_setup, > .fixed_clk_rate = 250000000, > @@ -238,6 +244,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = { > { "HISI02A1", APD_ADDR(hip07_i2c_desc) }, > { "HISI02A2", APD_ADDR(hip08_i2c_desc) }, > { "HISI0173", APD_ADDR(hip08_spi_desc) }, > + { "NXP0001", APD_ADDR(nxp_i2c_desc) }, > #endif > { } > }; > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c > index 15f6cde6452f..a3b61336fe55 100644 > --- a/drivers/i2c/busses/i2c-imx.c > +++ b/drivers/i2c/busses/i2c-imx.c > @@ -20,6 +20,7 @@ > * > */ > > +#include > #include > #include > #include > @@ -255,6 +256,12 @@ static const struct of_device_id i2c_imx_dt_ids[] = { > }; > MODULE_DEVICE_TABLE(of, i2c_imx_dt_ids); > > +static const struct acpi_device_id i2c_imx_acpi_ids[] = { > + {"NXP0001", .driver_data = (kernel_ulong_t)&vf610_i2c_hwdata}, > + { } > +}; > +MODULE_DEVICE_TABLE(acpi, i2c_imx_acpi_ids); > + > static inline int is_imx1_i2c(struct imx_i2c_struct *i2c_imx) > { > return i2c_imx->hwdata->devtype == IMX1_I2C; > @@ -1048,14 +1055,13 @@ static const struct i2c_algorithm i2c_imx_algo = { > > static int i2c_imx_probe(struct platform_device *pdev) > { > - const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids, > - &pdev->dev); > struct imx_i2c_struct *i2c_imx; > struct resource *res; > struct imxi2c_platform_data *pdata = dev_get_platdata(&pdev->dev); > void __iomem *base; > int irq, ret; > dma_addr_t phy_addr; > + const struct imx_i2c_hwdata *match; > > dev_dbg(&pdev->dev, "<%s>\n", __func__); > > @@ -1075,8 +1081,9 @@ static int i2c_imx_probe(struct platform_device *pdev) > if (!i2c_imx) > return -ENOMEM; > > - if (of_id) > - i2c_imx->hwdata = of_id->data; > + match = device_get_match_data(&pdev->dev); > + if (match) > + i2c_imx->hwdata = match; > else > i2c_imx->hwdata = (struct imx_i2c_hwdata *) > platform_get_device_id(pdev)->driver_data; > @@ -1089,6 +1096,7 @@ static int i2c_imx_probe(struct platform_device *pdev) > i2c_imx->adapter.nr = pdev->id; > i2c_imx->adapter.dev.of_node = pdev->dev.of_node; > i2c_imx->base = base; > + ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev)); > > /* Get I2C clock */ > i2c_imx->clk = devm_clk_get(&pdev->dev, NULL); > @@ -1247,6 +1255,7 @@ static struct platform_driver i2c_imx_driver = { > .name = DRIVER_NAME, > .pm = &i2c_imx_pm_ops, > .of_match_table = i2c_imx_dt_ids, > + .acpi_match_table = i2c_imx_acpi_ids, > }, > .id_table = imx_i2c_devtype, > }; > -- > 2.17.1 > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ED27C43331 for ; Fri, 6 Sep 2019 14:40:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 45CC2206A1 for ; Fri, 6 Sep 2019 14:40:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XZOiECq2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45CC2206A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HkM5tkwjkjwXSHurmSZAfZH9DKog/dTKmzKUz9G+2ow=; b=XZOiECq2FJ4ibR 8DMAJUJ5j7neMLewm2PiM/EDx7vfWfzhetgovEDZWCb81GZm+8AByaY2DOsyWbl3/pfpCKe6mV5zQ iKZ+aFKzZ4HPPh+u55NIwJXld2fi2YyEuiAFZTfyBxxsxuou/yNF/9pLFqQIGVIOkbCYYdB+vSE77 zTsi53r+fCDW6XFcrvAfa2ITYIfLvoxosga4ahvNHwv2npjZ1h+6Udvn+I7AIseKsYdKIcDOgX3zA PE3cyNE7wwL5bEii8Sl0WuFAXtuZjmy5rdaD14fnuto3J20/6FmuuZraap2eDm47A4+vfDva+8Z15 FPDWGhamGzetg3JcXUXg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i6FP1-0002EX-K2; Fri, 06 Sep 2019 14:39:55 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i6FOy-0002DT-2D for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2019 14:39:53 +0000 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1i6FOm-0005ih-UF; Fri, 06 Sep 2019 16:39:40 +0200 Received: from ore by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1i6FOk-0008Ns-3e; Fri, 06 Sep 2019 16:39:38 +0200 Date: Fri, 6 Sep 2019 16:39:38 +0200 From: Oleksij Rempel To: Biwen Li Subject: Re: [v2] ACPI: support for NXP i2c controller Message-ID: <20190906143938.weqs6rvdvlnrzpau@pengutronix.de> References: <20190906075319.21244-1-biwen.li@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190906075319.21244-1-biwen.li@nxp.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 16:09:03 up 111 days, 20:27, 66 users, load average: 0.07, 0.06, 0.01 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190906_073952_112181_7FE08EBC X-CRM114-Status: GOOD ( 17.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wsa@the-dreams.de, s.hauer@pengutronix.de, udit.kumar@nxp.com, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, leoyang.li@nxp.com, linux-acpi@vger.kernel.org, andy.shevchenko@gmail.com, meenakshi.aggarwal@nxp.com, linux-i2c@vger.kernel.org, chuanhua.han@nxp.com, rafael@kernel.org, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Sep 06, 2019 at 03:53:19PM +0800, Biwen Li wrote: > From: Chuanhua Han > > Enable NXP i2c controller to boot with ACPI > > Signed-off-by: Meenakshi Aggarwal > Signed-off-by: Udit Kumar > Signed-off-by: Chuanhua Han > Signed-off-by: Biwen Li for i2c-imx.c: Acked-by: Oleksij Rempel Tested on iMX6Q SabreSD Tested-by: Oleksij Rempel > --- > Change in v2: > - Simplify code > - Adjust header file order > - Not use ACPI_PTR() > > drivers/acpi/acpi_apd.c | 7 +++++++ > drivers/i2c/busses/i2c-imx.c | 17 +++++++++++++---- > 2 files changed, 20 insertions(+), 4 deletions(-) > > diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c > index 7cd0c9ac71ea..71511ae2dfcd 100644 > --- a/drivers/acpi/acpi_apd.c > +++ b/drivers/acpi/acpi_apd.c > @@ -160,11 +160,17 @@ static const struct apd_device_desc hip08_i2c_desc = { > .setup = acpi_apd_setup, > .fixed_clk_rate = 250000000, > }; > + > static const struct apd_device_desc thunderx2_i2c_desc = { > .setup = acpi_apd_setup, > .fixed_clk_rate = 125000000, > }; > > +static const struct apd_device_desc nxp_i2c_desc = { > + .setup = acpi_apd_setup, > + .fixed_clk_rate = 350000000, > +}; > + > static const struct apd_device_desc hip08_spi_desc = { > .setup = acpi_apd_setup, > .fixed_clk_rate = 250000000, > @@ -238,6 +244,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = { > { "HISI02A1", APD_ADDR(hip07_i2c_desc) }, > { "HISI02A2", APD_ADDR(hip08_i2c_desc) }, > { "HISI0173", APD_ADDR(hip08_spi_desc) }, > + { "NXP0001", APD_ADDR(nxp_i2c_desc) }, > #endif > { } > }; > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c > index 15f6cde6452f..a3b61336fe55 100644 > --- a/drivers/i2c/busses/i2c-imx.c > +++ b/drivers/i2c/busses/i2c-imx.c > @@ -20,6 +20,7 @@ > * > */ > > +#include > #include > #include > #include > @@ -255,6 +256,12 @@ static const struct of_device_id i2c_imx_dt_ids[] = { > }; > MODULE_DEVICE_TABLE(of, i2c_imx_dt_ids); > > +static const struct acpi_device_id i2c_imx_acpi_ids[] = { > + {"NXP0001", .driver_data = (kernel_ulong_t)&vf610_i2c_hwdata}, > + { } > +}; > +MODULE_DEVICE_TABLE(acpi, i2c_imx_acpi_ids); > + > static inline int is_imx1_i2c(struct imx_i2c_struct *i2c_imx) > { > return i2c_imx->hwdata->devtype == IMX1_I2C; > @@ -1048,14 +1055,13 @@ static const struct i2c_algorithm i2c_imx_algo = { > > static int i2c_imx_probe(struct platform_device *pdev) > { > - const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids, > - &pdev->dev); > struct imx_i2c_struct *i2c_imx; > struct resource *res; > struct imxi2c_platform_data *pdata = dev_get_platdata(&pdev->dev); > void __iomem *base; > int irq, ret; > dma_addr_t phy_addr; > + const struct imx_i2c_hwdata *match; > > dev_dbg(&pdev->dev, "<%s>\n", __func__); > > @@ -1075,8 +1081,9 @@ static int i2c_imx_probe(struct platform_device *pdev) > if (!i2c_imx) > return -ENOMEM; > > - if (of_id) > - i2c_imx->hwdata = of_id->data; > + match = device_get_match_data(&pdev->dev); > + if (match) > + i2c_imx->hwdata = match; > else > i2c_imx->hwdata = (struct imx_i2c_hwdata *) > platform_get_device_id(pdev)->driver_data; > @@ -1089,6 +1096,7 @@ static int i2c_imx_probe(struct platform_device *pdev) > i2c_imx->adapter.nr = pdev->id; > i2c_imx->adapter.dev.of_node = pdev->dev.of_node; > i2c_imx->base = base; > + ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev)); > > /* Get I2C clock */ > i2c_imx->clk = devm_clk_get(&pdev->dev, NULL); > @@ -1247,6 +1255,7 @@ static struct platform_driver i2c_imx_driver = { > .name = DRIVER_NAME, > .pm = &i2c_imx_pm_ops, > .of_match_table = i2c_imx_dt_ids, > + .acpi_match_table = i2c_imx_acpi_ids, > }, > .id_table = imx_i2c_devtype, > }; > -- > 2.17.1 > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel