Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10335743ybi; Thu, 11 Jul 2019 03:39:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxP1ou8Z7m6kgv6bUYREZxNrSclKhNeX/e6i6e1LIW+hhdjvN/8R9yyiwVrTnwwSZepF9nu X-Received: by 2002:a17:90a:cf8f:: with SMTP id i15mr3919660pju.110.1562841574109; Thu, 11 Jul 2019 03:39:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562841574; cv=none; d=google.com; s=arc-20160816; b=hk6pEIMp3pwV1iI0nitj6nqpxT6KkNFLqG/fSTuHQDHAB7/w2YnFanqoNgJlU0zzWu 6kMSWtFoLYqDzL3R4o8XaWGjMJ83FSPs9ZAscu1FI/YF5HTrc6kRNakii9gSctxFq0jD uL0AaeMWzAVT54+bryqc0beOUXt57mJXGp9Vr0xFI18a8F12anONmOOSMVpIuI7OBgjj nqODi+0KxqRl3M6rhPC+896/2td8v18wd1/0PvrJrJh82Msj4Lytiay8HCJo9Lzg7wxz ZDQGy5v3txoXv6uAcJPe7GtpRpkcE7DKq3t2JaBEpTpS+/S9JTlYjrTTlocenNwWV7Gx 47LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Bl7GsOW2/HwtjHHz13ENYw6zCuw54PVv5Dmg98M5uYU=; b=VmuWsUGQlBm6ge+uMaUR5A9Fl2fpC98yXanHJe2GKFtFxN+L8cfNFG1owZ0glkfDus pUAH9D5Ep6/IcMcv5klk8c7+8qb2ZpYeH9c8BMjCWXQIyTmlyVvlLSeQF58ocnpdnpKV 4ffSMdNso2jT8wtPKIu9CvuZFUaEDX4/MjvMFuHGJ/5J1B9hoKIep7XFPacFng4g0Lp2 znHC2bWaB/5UKq5K21zUBsP+FF9hJpaBrRTWlE1km6IVYN4Z5hkKS7j1X6Kuy6tllYwl nCJYbiGazoCjGxJCUDJO9s92KlAFisE5o79WfmWMeigAB8wvWS8gJiWU0HkrwckoU3x7 26Ew== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si4441414plo.396.2019.07.11.03.39.18; Thu, 11 Jul 2019 03:39:34 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728380AbfGKKfT (ORCPT + 99 others); Thu, 11 Jul 2019 06:35:19 -0400 Received: from inva020.nxp.com ([92.121.34.13]:40838 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725962AbfGKKfT (ORCPT ); Thu, 11 Jul 2019 06:35:19 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id CBF531A0191; Thu, 11 Jul 2019 12:35:16 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 4C4811A099D; Thu, 11 Jul 2019 12:35:10 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 78CD7402DB; Thu, 11 Jul 2019 18:35:02 +0800 (SGT) From: Chuanhua Han To: rjw@rjwysocki.net, lenb@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, leoyang.li@nxp.com, Chuanhua Han , Meenakshi Aggarwal , Udit Kumar Subject: [PATCH] ACPI: support for NXP i2c controller Date: Thu, 11 Jul 2019 18:26:01 +0800 Message-Id: <20190711102601.20582-1-chuanhua.han@nxp.com> X-Mailer: git-send-email 2.9.5 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Enable NXP i2c controller to boot with ACPI Signed-off-by: Meenakshi Aggarwal Signed-off-by: Udit Kumar Signed-off-by: Chuanhua Han --- drivers/acpi/acpi_apd.c | 6 ++++++ drivers/i2c/busses/i2c-imx.c | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c index ff47317..cf8566c 100644 --- a/drivers/acpi/acpi_apd.c +++ b/drivers/acpi/acpi_apd.c @@ -165,6 +165,11 @@ static const struct apd_device_desc thunderx2_i2c_desc = { .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 +243,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 b1b8b93..99f9b96 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -44,6 +44,7 @@ #include #include #include +#include /* This will be the driver name the kernel reports */ #define DRIVER_NAME "imx-i2c" @@ -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; @@ -1052,6 +1059,9 @@ 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); + const struct acpi_device_id *acpi_id = + acpi_match_device(i2c_imx_acpi_ids, + &pdev->dev); struct imx_i2c_struct *i2c_imx; struct resource *res; struct imxi2c_platform_data *pdata = dev_get_platdata(&pdev->dev); @@ -1079,6 +1089,9 @@ static int i2c_imx_probe(struct platform_device *pdev) if (of_id) i2c_imx->hwdata = of_id->data; + else if (acpi_id) + i2c_imx->hwdata = (struct imx_i2c_hwdata *) + acpi_id->driver_data; else i2c_imx->hwdata = (struct imx_i2c_hwdata *) platform_get_device_id(pdev)->driver_data; @@ -1091,6 +1104,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); @@ -1253,6 +1267,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 = ACPI_PTR(i2c_imx_acpi_ids), }, .id_table = imx_i2c_devtype, }; -- 2.9.5