From patchwork Thu Mar 4 06:05:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 393027 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 C1CD4C433DB for ; Thu, 4 Mar 2021 06:07:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7958664EF6 for ; Thu, 4 Mar 2021 06:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233603AbhCDGGR (ORCPT ); Thu, 4 Mar 2021 01:06:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233609AbhCDGGP (ORCPT ); Thu, 4 Mar 2021 01:06:15 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2301C06175F for ; Wed, 3 Mar 2021 22:05:34 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id d12so15604465pfo.7 for ; Wed, 03 Mar 2021 22:05:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z8RUAsOxRMOpgK0k+D8Q9aGesIbnggJxLwFflwjLlcE=; b=it9UPNgFAIzPg4fVSgc7O0kA3WSkr3mcFUJUgL3CdAk9vcpuQS0aL4SNlGWFypGHmB Ndd3pKGbZiUntLVpDtHZ8A98VfzEw/Dg7E2yhsms5Cb9nNFYY6ygUAE5I3fhStVUNcdL d5RgQ/Ax9KBxnbPrnlXjh09DgithJCw9Ih4WIj3FVINHffzuNPejqTKmI2TJz6a/vIpB X54TwDc0LSp/PRXIlMYkVXfe+ygaiS3Vz4u/Pie0Sn+Ak8vishj1v/pCmA0wfirTSIlo xct19DLrL2Kk6yAUn7w5bo8a96KRz3iYoZizwrDSPltIfzA8jlYjzVMMpNe0SCpVG0iz cguQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z8RUAsOxRMOpgK0k+D8Q9aGesIbnggJxLwFflwjLlcE=; b=oXkIK8jXQmCL/qkFYM1OOFCD8DvLBibgQ7E6xLuMNLx2hEqQBsGL/S+T+GDjwyuzb7 pXRCZsyai2KdQKi6v6IZnes3MoYC5v8KwwGkWzuBPvYqpE6waIwylXvSXMOHlmISSTQa LTsrHChwxn+XGfe1Si3yNypQvhsMhA3wH2em+Kj+y+hIFHPA1g8E3edYNoznL0hEA/0d gYKCsBzXVrj6OuhAwb7z79teQAZ7iVBH1yiLx/AQGGoIblN91GX4LmQbtBgWKIxPPfb/ 4mfYciGIYPIvsiGeiBgiKAMIaFCKyR+zqNXdF8kLvNa4jQCFoT3mKxFkPoZ/14iQDGct HKNQ== X-Gm-Message-State: AOAM533cZqO6v/6eoFZBhul7e/9ypTCZbRBgTcT4L9a2Pj1TwVV/f3gG yq5J+/aWY/a3dPkH18dsq6sW8Q== X-Google-Smtp-Source: ABdhPJyreUBTtF030QQECYO3aAtKwXhfu5J12DNEA44oSodIQR88JnlIxhZOGWZV+zLQWLmgE4VvJw== X-Received: by 2002:aa7:808d:0:b029:1ed:993c:3922 with SMTP id v13-20020aa7808d0000b02901ed993c3922mr2522172pff.75.1614837934575; Wed, 03 Mar 2021 22:05:34 -0800 (PST) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id j2sm776386pgh.39.2021.03.03.22.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 22:05:34 -0800 (PST) From: Shawn Guo To: Linus Walleij Cc: Bjorn Andersson , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-arm-msm@vger.kernel.org, Shawn Guo Subject: [PATCH v3 1/2] pinctrl: qcom: sc8180x: drop the use of tiles Date: Thu, 4 Mar 2021 14:05:19 +0800 Message-Id: <20210304060520.24975-2-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304060520.24975-1-shawn.guo@linaro.org> References: <20210304060520.24975-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org To support both ACPI and DT, it makes more sense to not use tiles for pinctrl-sc8180x driver, as ACPI table describes TLMM block with one single memory resource. Since DTS of SC8180X hasn't landed, there is still chance to align DT description with ACPI. Signed-off-by: Shawn Guo --- drivers/pinctrl/qcom/pinctrl-sc8180x.c | 41 +++++++++----------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-sc8180x.c b/drivers/pinctrl/qcom/pinctrl-sc8180x.c index b765bf667574..66f76ed22200 100644 --- a/drivers/pinctrl/qcom/pinctrl-sc8180x.c +++ b/drivers/pinctrl/qcom/pinctrl-sc8180x.c @@ -11,17 +11,9 @@ #include "pinctrl-msm.h" -static const char * const sc8180x_tiles[] = { - "south", - "east", - "west" -}; - -enum { - SOUTH, - EAST, - WEST -}; +#define WEST 0x00100000 +#define EAST 0x00500000 +#define SOUTH 0x00d00000 #define FUNCTION(fname) \ [msm_mux_##fname] = { \ @@ -31,7 +23,7 @@ enum { } #define REG_SIZE 0x1000 -#define PINGROUP_OFFSET(id, _tile, offset, f1, f2, f3, f4, f5, f6, f7, f8, f9) \ +#define PINGROUP_OFFSET(id, base, offset, f1, f2, f3, f4, f5, f6, f7, f8, f9) \ { \ .name = "gpio" #id, \ .pins = gpio##id##_pins, \ @@ -49,12 +41,11 @@ enum { msm_mux_##f9 \ }, \ .nfuncs = 10, \ - .ctl_reg = REG_SIZE * id + offset, \ - .io_reg = REG_SIZE * id + 0x4 + offset, \ - .intr_cfg_reg = REG_SIZE * id + 0x8 + offset, \ - .intr_status_reg = REG_SIZE * id + 0xc + offset,\ - .intr_target_reg = REG_SIZE * id + 0x8 + offset,\ - .tile = _tile, \ + .ctl_reg = base + REG_SIZE * id + offset, \ + .io_reg = base + REG_SIZE * id + 0x4 + offset, \ + .intr_cfg_reg = base + REG_SIZE * id + 0x8 + offset, \ + .intr_status_reg = base + REG_SIZE * id + 0xc + offset, \ + .intr_target_reg = base + REG_SIZE * id + 0x8 + offset, \ .mux_bit = 2, \ .pull_bit = 0, \ .drv_bit = 6, \ @@ -71,20 +62,19 @@ enum { .intr_detection_width = 2, \ } -#define PINGROUP(id, _tile, f1, f2, f3, f4, f5, f6, f7, f8, f9) \ - PINGROUP_OFFSET(id, _tile, 0x0, f1, f2, f3, f4, f5, f6, f7, f8, f9) +#define PINGROUP(id, base, f1, f2, f3, f4, f5, f6, f7, f8, f9) \ + PINGROUP_OFFSET(id, base, 0x0, f1, f2, f3, f4, f5, f6, f7, f8, f9) #define SDC_QDSD_PINGROUP(pg_name, ctl, pull, drv) \ { \ .name = #pg_name, \ .pins = pg_name##_pins, \ .npins = (unsigned int)ARRAY_SIZE(pg_name##_pins), \ - .ctl_reg = ctl, \ + .ctl_reg = EAST + ctl, \ .io_reg = 0, \ .intr_cfg_reg = 0, \ .intr_status_reg = 0, \ .intr_target_reg = 0, \ - .tile = EAST, \ .mux_bit = -1, \ .pull_bit = pull, \ .drv_bit = drv, \ @@ -105,12 +95,11 @@ enum { .name = #pg_name, \ .pins = pg_name##_pins, \ .npins = (unsigned int)ARRAY_SIZE(pg_name##_pins), \ - .ctl_reg = 0xb6000, \ - .io_reg = 0xb6004, \ + .ctl_reg = SOUTH + 0xb6000, \ + .io_reg = SOUTH + 0xb6004, \ .intr_cfg_reg = 0, \ .intr_status_reg = 0, \ .intr_target_reg = 0, \ - .tile = SOUTH, \ .mux_bit = -1, \ .pull_bit = 3, \ .drv_bit = 0, \ @@ -1575,8 +1564,6 @@ static const struct msm_gpio_wakeirq_map sc8180x_pdc_map[] = { }; static struct msm_pinctrl_soc_data sc8180x_pinctrl = { - .tiles = sc8180x_tiles, - .ntiles = ARRAY_SIZE(sc8180x_tiles), .pins = sc8180x_pins, .npins = ARRAY_SIZE(sc8180x_pins), .functions = sc8180x_functions, From patchwork Thu Mar 4 06:05:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 392736 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp349241jai; Thu, 4 Mar 2021 14:17:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/zW5VE/jFb466SiwNvBjg9fd0oub4k1RsjAl9WMW7oUUv1TVaGFYkdxiPVDlEqnrUMHMi X-Received: by 2002:a17:907:9862:: with SMTP id ko2mr6436161ejc.222.1614896240901; Thu, 04 Mar 2021 14:17:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614896240; cv=none; d=google.com; s=arc-20160816; b=KdhP98X8XQWTa9/VibphUJ5t3d3DRhrlX+c7ilx/f1ixQKrhEUZDk6dnNLetNyQZ+I DK4edNhXVpSirBIwSJyU2of/U4J2P/8upVtkekPu1Y3szgjQ1w2T9S4RPg4QohkOD9SP z1FTpIvcufQ7q/OWGH1wz4GJ866s1VdOldlbxvL83dHOJsHXntn5l0vmN+243t6fdJW8 DBk7N9pXn7fSOyPxRumlb1yOwPYv5g+NmXbgY8kPvM1HTqXDId+PY7mybrg+MqhD+jDl MD3cPlV4xmrWSo2gFjajjBcLKuFByzEjdR1OpPy9JUzmTkZ1Q4cp4xqiS+4Sgf25DwOK Nq6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=16vaBi9BzoVqThTIqrJL3mXUcHy/6vtFy3wsh3+qlT8=; b=t8EDGHx0Jv40eQJHfaiTlz2ReF3yoQxdv2GrQ9M0S7fw3VHpJKX/8j/ZFzm8uMEgQM ne20LIFUYaut/d6Si35Sp55Ed9GIAbYV3LloRwpMcA5Atjy3PzQ49R4qPMyDu+Rn4HFo Mc4pHbow4kdB82M+NNK1hrc7WDfcOJKnvWamfD2lAun2M2n2CNiG5bUfkv3cdtwgDfsx lfzjpxia3eUaU/HTSEu6XfvC5Ir29JJWuJZtEzxgWAuaOJnbD45l4rLgUgajtagmauwk vGM9raH0hh66b7JhCffqxPXEGuRzrUiPTLhTH7l3VSSkrTN5Dm1bywPGwdIJbkQeu3Be cSLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X838cOPD; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k6si527757edj.545.2021.03.04.14.17.20; Thu, 04 Mar 2021 14:17:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X838cOPD; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233968AbhCDGGt (ORCPT + 3 others); Thu, 4 Mar 2021 01:06:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233609AbhCDGGR (ORCPT ); Thu, 4 Mar 2021 01:06:17 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 592B7C061761 for ; Wed, 3 Mar 2021 22:05:37 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id cl21-20020a17090af695b02900c61ac0f0e9so99507pjb.1 for ; Wed, 03 Mar 2021 22:05:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=16vaBi9BzoVqThTIqrJL3mXUcHy/6vtFy3wsh3+qlT8=; b=X838cOPDjzVEHor9a7b5sUbkiMytH23o4H1juAyRZQ6FNdMCsCEXwGizeWS5VuI664 YE37gQsJumgrhtwXodPuRFyt2QkI+4fdjQEl+PSW2BVW9USrSB6kEPeb/t7J7aL/AwuJ YrNY6dg3aWU84S3oE0QNNZWPev1AcwCiWNvXSUJFsV1KH/JyObJyk9Y2EXjnKjU7mRC7 +GAefOg7bxy7I9gs12C5jxeygmknKvk0p0UR1r4fgd2k9uqvfoIi+1f1p8deRsgewIqm YbomJD+59jGPAlBI5tFI/DnM/mPiOf/a8aN7C2Kxgl1Lc+rPRslTJhqdRBxrJdvwJWKM PHgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=16vaBi9BzoVqThTIqrJL3mXUcHy/6vtFy3wsh3+qlT8=; b=hV4EMnlhl0A+krv+ZqBw9G8J2W3amZXVLIvoA7VMiQwkLrzCDSaCtmJWL/OKvPg6Pu htAvjUMWPelUP5MHAjOpi9h0P4KjQ91b3RIVHWziMo/4EfkuqZMWVeSxvPcmlozW9TsT jcxAvumK5XcIBDy3XHoc9tT1IYg3g9krrKhASkmLHp2ygcmkrC2DOhrxVfNCJ/E/TeIB iFFRCjxhPoKlLaPomteSTpm6ntofEzaqLkp05jtLmjVSMrESPcDcb7IfjWIbJaXfLsRS FlrGU+caTKpCpTzEXg01fJEbH09GIr9dcX5hmmnmt7E9xomaXg6i0jXmwZOg0fTfYLEY +2Rw== X-Gm-Message-State: AOAM532v1ksHg11jqRyiF+rKoomsKRjgPUxWSEgScswQ9T6i3GU+2d1f sGoBm/DkBSZqY5lzk6OL262fwQ== X-Received: by 2002:a17:90a:4a8c:: with SMTP id f12mr2836821pjh.71.1614837936954; Wed, 03 Mar 2021 22:05:36 -0800 (PST) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id j2sm776386pgh.39.2021.03.03.22.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 22:05:36 -0800 (PST) From: Shawn Guo To: Linus Walleij Cc: Bjorn Andersson , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-arm-msm@vger.kernel.org, Shawn Guo Subject: [PATCH v3 2/2] pinctrl: qcom: sc8180x: add ACPI probe support Date: Thu, 4 Mar 2021 14:05:20 +0800 Message-Id: <20210304060520.24975-3-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304060520.24975-1-shawn.guo@linaro.org> References: <20210304060520.24975-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org It adds ACPI probe support for pinctrl-sc8180x driver. Signed-off-by: Shawn Guo --- drivers/pinctrl/qcom/Kconfig | 2 +- drivers/pinctrl/qcom/pinctrl-sc8180x.c | 39 ++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig index 6853a896c476..9f0218c4f9b3 100644 --- a/drivers/pinctrl/qcom/Kconfig +++ b/drivers/pinctrl/qcom/Kconfig @@ -222,7 +222,7 @@ config PINCTRL_SC7280 config PINCTRL_SC8180X tristate "Qualcomm Technologies Inc SC8180x pin controller driver" - depends on GPIOLIB && OF + depends on GPIOLIB && (OF || ACPI) select PINCTRL_MSM help This is the pinctrl, pinmux, pinconf and gpiolib driver for the diff --git a/drivers/pinctrl/qcom/pinctrl-sc8180x.c b/drivers/pinctrl/qcom/pinctrl-sc8180x.c index 66f76ed22200..45ecb4a022ca 100644 --- a/drivers/pinctrl/qcom/pinctrl-sc8180x.c +++ b/drivers/pinctrl/qcom/pinctrl-sc8180x.c @@ -1546,6 +1546,13 @@ static const struct msm_pingroup sc8180x_groups[] = { [193] = SDC_QDSD_PINGROUP(sdc2_data, 0x4b2000, 9, 0), }; +static const int sc8180x_acpi_reserved_gpios[] = { + 0, 1, 2, 3, + 47, 48, 49, 50, + 126, 127, 128, 129, + -1 /* terminator */ +}; + static const struct msm_gpio_wakeirq_map sc8180x_pdc_map[] = { { 3, 31 }, { 5, 32 }, { 8, 33 }, { 9, 34 }, { 10, 100 }, { 12, 104 }, { 24, 37 }, { 26, 38 }, { 27, 41 }, { 28, 42 }, { 30, 39 }, { 36, 43 }, @@ -1575,13 +1582,40 @@ static struct msm_pinctrl_soc_data sc8180x_pinctrl = { .nwakeirq_map = ARRAY_SIZE(sc8180x_pdc_map), }; +static const struct msm_pinctrl_soc_data sc8180x_acpi_pinctrl = { + .pins = sc8180x_pins, + .npins = ARRAY_SIZE(sc8180x_pins), + .groups = sc8180x_groups, + .ngroups = ARRAY_SIZE(sc8180x_groups), + .reserved_gpios = sc8180x_acpi_reserved_gpios, + .ngpios = 191, +}; + static int sc8180x_pinctrl_probe(struct platform_device *pdev) { - return msm_pinctrl_probe(pdev, &sc8180x_pinctrl); + const struct msm_pinctrl_soc_data *soc_data; + + soc_data = device_get_match_data(&pdev->dev); + if (!soc_data) + return -EINVAL; + + return msm_pinctrl_probe(pdev, soc_data); } +static const struct acpi_device_id sc8180x_pinctrl_acpi_match[] = { + { + .id = "QCOM040D", + .driver_data = (kernel_ulong_t) &sc8180x_acpi_pinctrl, + }, + { } +}; +MODULE_DEVICE_TABLE(acpi, sc8180x_pinctrl_acpi_match); + static const struct of_device_id sc8180x_pinctrl_of_match[] = { - { .compatible = "qcom,sc8180x-tlmm", }, + { + .compatible = "qcom,sc8180x-tlmm", + .data = &sc8180x_pinctrl, + }, { }, }; MODULE_DEVICE_TABLE(of, sc8180x_pinctrl_of_match); @@ -1590,6 +1624,7 @@ static struct platform_driver sc8180x_pinctrl_driver = { .driver = { .name = "sc8180x-pinctrl", .of_match_table = sc8180x_pinctrl_of_match, + .acpi_match_table = sc8180x_pinctrl_acpi_match, }, .probe = sc8180x_pinctrl_probe, .remove = msm_pinctrl_remove,