From patchwork Mon May 1 09:05:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 89011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2570620vqo; Mon, 1 May 2023 02:16:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ZgJ361jbOdPfXqhqj3d0Z78vwBOLm9AUkFGFBzcJuQ+we0WyuiUNbdX4Q5B6OQoh35zNd X-Received: by 2002:a17:902:e551:b0:19c:3d78:6a54 with SMTP id n17-20020a170902e55100b0019c3d786a54mr15844248plf.14.1682932595331; Mon, 01 May 2023 02:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682932595; cv=none; d=google.com; s=arc-20160816; b=s6OhC8sZOKOJ7GCXhv9IMvJBCXu+9cYv9a/yMBnEFW+f2e0/KQxmqckpc+GGZyEMtX 3dXE+/e2nhALzX0aqJoFdD1FWj6rUenmy4qE3h0rYyMb00LFeucPV5A2fOLa5Eq7QGy4 dYOVn1QMq6CLDWiQGvU43QpMaH8OF1cMHE1VRWL/IjtdeoUVo/8PqMf26BAHiTcDOoSO wKB1mwlkX449tXMBwGeHSG4k2CLz2V55WA9SPgQdypd3hdiGeMywd9UiQHiU980aroTW 7HWmE15pWSjNCk+CLxUV9okEuo9WVo9djSz2tz9Uev9PO7yCSW4hS/aLN/yuAVoFKzB9 WNUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=HQcL6JXC95b5fH8+n8D4snP5Hhmk4OL2MW3VW+pKJ0E=; b=jm9i6K7Kd9FMDOUAsLbxVPoWaqnQfnTqCWaiBpoChZXcZj8/W+pBba5kIQwH8W4a6m 2DvaVo5mFbwijT/SqFMEqtawcChOGuTwCsjm7M5HuJGnMXI1nsAu9oa+F+ZtYlHTllbn QkHEW8rsQaWBNffBDk3pbZg8V2YnXW8u3DgeZV83E6BrcQ3RnVTsiB3T7Xj6zOblCsdw qiwLjzsDVMix1Iq5viu2Ymcgk/leAPmhVf9qV+Hvp5Il9Eht80pd7YxglfcE0shdmT9I nDjd+7PQN9OyXoY1ANSh5eqRrcVtY3wdhmjKTuZ49nw5aEyyzcmCv34WjFXpzVsXq6Qx OSXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ryOVLyaX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be8-20020a170902aa0800b001a6f0e81ec7si13713010plb.237.2023.05.01.02.16.20; Mon, 01 May 2023 02:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ryOVLyaX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S232428AbjEAJFv (ORCPT + 99 others); Mon, 1 May 2023 05:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232351AbjEAJFm (ORCPT ); Mon, 1 May 2023 05:05:42 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A53671723 for ; Mon, 1 May 2023 02:05:28 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4efe8b3f3f7so2677072e87.2 for ; Mon, 01 May 2023 02:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682931927; x=1685523927; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HQcL6JXC95b5fH8+n8D4snP5Hhmk4OL2MW3VW+pKJ0E=; b=ryOVLyaXPO1JeeCNBToS55jlkVdWfQga1fn6f6J5KLa3q00WDmdYYzsPTn9DQ6kmNG AVLtk/TRhd3Z5K/d80x/Zy+QOUvnhh+LnMwePTkmwtdOzOWwZqxPVMYFxTo0u0cHj+pG ZQKzUIeBbUQQNL7L7M3s1OcyOuQM+lcKKvkc9fA5I8f4yTtf+KSVKvE8EB2JdaqaM9wf sy52vRUHo6d6/HRomTLnJ5TCWBpnqJqwSE8s+pHozwCOwTpSyjX2gR5VfBtV+nOK05xC JysLfxToT2GTYX1aOVewx89219wGbviaT/wvMyUw0L/DhXWZcjnJO6rjO4CF6Vmje1Rg BNOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682931927; x=1685523927; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HQcL6JXC95b5fH8+n8D4snP5Hhmk4OL2MW3VW+pKJ0E=; b=fWOdcGrgJU+s2CH8Oqfjr/c0FfCYwF22aOtV71TNYf11c8tc7ih2e3jrPc5eXdX9Eh 08lzjp7Ad97kUYBbTbUeOXvn4inBrT5M0Dw1KbytghDoFOr/kK2jS+kzvKZzJubzr/1F 2bqGBvyXWyUjqbsio5VUgH2TQ5hP4DiJwBTU/Fz85soiGn811P/Z3tCrZQgcpvA3jL1d bU001xQaX5nzZza+Qs2R3SJqcSrlgXR3ribMh2fOWr9FRbrsxojAT5d2up0YhMxiL9ww vXtq3MBAFlLCqikZKx2GzbhzCQJd35Zq5Lm4CfUmOgiHNuYr8szrHz7nODr0OJtBSxsB NTGA== X-Gm-Message-State: AC+VfDzYjT1Lb4YrqaltphnkUyDQZ3LcXHOEGoNrm5lewgTMO0uqk4/H sf11piSOphSBa1ojnu7UahNkng== X-Received: by 2002:ac2:5490:0:b0:4ed:d1d6:c595 with SMTP id t16-20020ac25490000000b004edd1d6c595mr3958731lfk.55.1682931926864; Mon, 01 May 2023 02:05:26 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id f21-20020ac251b5000000b004eb554a1711sm4601208lfk.51.2023.05.01.02.05.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 02:05:26 -0700 (PDT) From: Linus Walleij Date: Mon, 01 May 2023 11:05:23 +0200 Subject: [PATCH 3/3] ARM: omap2: Rewrite WLAN quirk to use GPIO descriptors MIME-Version: 1.0 Message-Id: <20230430-omap2-pdata-quirks-v1-3-e015f3a3ea46@linaro.org> References: <20230430-omap2-pdata-quirks-v1-0-e015f3a3ea46@linaro.org> In-Reply-To: <20230430-omap2-pdata-quirks-v1-0-e015f3a3ea46@linaro.org> To: Tony Lindgren , Russell King , Bartosz Golaszewski , Lee Jones , Andreas Kemnade Cc: Bartosz Golaszewski , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764682729274296928?= X-GMAIL-MSGID: =?utf-8?q?1764682729274296928?= The OMAP2 platform data quirk is using the global GPIO numberspace to obtain two WLAN GPIOs to drive power and xcvr reset GPIO lines during start-up. Rewrite the quirk to use a GPIO descriptor table so we avoid using global GPIO numbers. This gets rid of the final dependency on the legacy header from the OMAP2/3 platforms. Fixes: 92bf78b33b0b ("gpio: omap: use dynamic allocation of base") Signed-off-by: Linus Walleij --- arch/arm/mach-omap2/pdata-quirks.c | 41 ++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index 3264c4e77a8a..c1c0121f478d 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -178,25 +177,41 @@ static void __init am35xx_emac_reset(void) omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */ } -static struct gpio cm_t3517_wlan_gpios[] __initdata = { - { 56, GPIOF_OUT_INIT_HIGH, "wlan pwr" }, - { 4, GPIOF_OUT_INIT_HIGH, "xcvr noe" }, +static struct gpiod_lookup_table cm_t3517_wlan_gpio_table = { + .dev_id = NULL, + .table = { + GPIO_LOOKUP("gpio-48-53", 8, "power", + GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("gpio-0-15", 4, "noe", + GPIO_ACTIVE_HIGH), + { } + }, }; static void __init omap3_sbc_t3517_wifi_init(void) { - int err = gpio_request_array(cm_t3517_wlan_gpios, - ARRAY_SIZE(cm_t3517_wlan_gpios)); - if (err) { - pr_err("SBC-T3517: wl12xx gpios request failed: %d\n", err); - return; - } + struct gpio_desc *d; - gpiod_export(gpio_to_desc(cm_t3517_wlan_gpios[0].gpio), 0); - gpiod_export(gpio_to_desc(cm_t3517_wlan_gpios[1].gpio), 0); + gpiod_add_lookup_table(&cm_t3517_wlan_gpio_table); + /* This asserts the RESET line (reverse polarity) */ + d = gpiod_get(NULL, "power", GPIOD_OUT_HIGH); + if (IS_ERR(d)) { + pr_err("Unable to get CM T3517 WLAN power GPIO descriptor\n"); + } else { + gpiod_set_consumer_name(d, "wlan pwr"); + gpiod_export(d, 0); + } + + d = gpiod_get(NULL, "noe", GPIOD_OUT_HIGH); + if (IS_ERR(d)) { + pr_err("Unable to get CM T3517 WLAN XCVR NOE GPIO descriptor\n"); + } else { + gpiod_set_consumer_name(d, "xcvr noe"); + gpiod_export(d, 0); + } msleep(100); - gpio_set_value(cm_t3517_wlan_gpios[1].gpio, 0); + gpiod_set_value(d, 0); } static struct gpiod_lookup_table omap3_sbc_t3517_usb_gpio_table = {