From patchwork Fri May 5 11:16:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 90413 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp322374vqo; Fri, 5 May 2023 04:22:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ikQhZmK16drEBQgcVDB4uWlaNV3DHfhbWmpcAnt+LQtfzgWx/okdFnspqx8pQmfc7QleV X-Received: by 2002:a05:6a00:148b:b0:63b:7a55:ae89 with SMTP id v11-20020a056a00148b00b0063b7a55ae89mr1951623pfu.27.1683285754095; Fri, 05 May 2023 04:22:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683285754; cv=none; d=google.com; s=arc-20160816; b=SYyy1vkeVMOAGC2tqbjDSiiMb0+M7gPlknrTt6tLtVBRitTO7+dHmG6sFyAdTkQRcv cER+iWDNq0eEbodqK4+AM2PdsggpCQysvycpqHffkVF9MxVOu++tmqMYdiw47MI0D1Pc fowk5NJcubcvu5hNdRqv78IyxNZL//UtMhRY8GrKrxfEqsWE3a6f6rr27V1keZIqNJ1a b4BsW7xHmyzmZ4Gr9afAaeiRf2Gka/obfvj3ZOckrhlDps0W7W5JKaHEf5o25o1HZg5S 9sJ61LfKS5D02Qk4PLXsr13F3KDbXFR2xEWK5FezLlavlpCf0LL8pFQzPtVknypx8ALx DsZQ== 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=g5G0cJUf9U5b39gQ8vAQOCiDix67GOEadK5YgCw6Yxo=; b=yk3gI3MqJFpLqIAiILIVwdXmMmNx+qZg+GyNaGYsgSNuMMBK6wkWGtVz/uNVEtRpnW J8RyGvhlAr85pzRwzu+gZ29pIq1Pa16JHsf7nXF4RWV9/Pbk5dFdrX15o6KBogWIjamC Mws2Fl0UjHpfNXqA8pR8UzyOM0Amqyh+JHekacelIpkywL3MiyTN3e6PpWAa6WjtGEzD 7RLwz+xq9kxOi+726Z9dwvY2EbUEnPuvp9vsy+Kq65gwQ+sxabMsQlmeOnZxkFofRJu8 7z/3wTTF3cqJzb3m5IRhdJaaproHFFmkyqLCv8pneAyuIjOJqMijwiV8nzNzVz9wkhLA uT+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wxs0KBb5; 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 n13-20020a63720d000000b00524f18e3d13si1726358pgc.35.2023.05.05.04.22.19; Fri, 05 May 2023 04:22:34 -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=wxs0KBb5; 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 S231974AbjEELR0 (ORCPT + 99 others); Fri, 5 May 2023 07:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231893AbjEELRN (ORCPT ); Fri, 5 May 2023 07:17:13 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D23A1A49C for ; Fri, 5 May 2023 04:17:05 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2ac88d9edf3so5825441fa.0 for ; Fri, 05 May 2023 04:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683285424; x=1685877424; 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=g5G0cJUf9U5b39gQ8vAQOCiDix67GOEadK5YgCw6Yxo=; b=wxs0KBb51JuDnKAnoY/S3edUOYpY0H+SPYPDCze+MDOmb+fhTmA3ahW60qWs3AFnGH 911gSlgSQEIzfQrJNnyKGa+PIe4bRd37U3qtqFPteIbRsyciY/cK+yMtEC/Is+6SlPiT WzEk5CTi7zst9SHIN/RzA6eYw7YYUHtyEYpa74TZC8pADhZhnC7DPfnp3wVbIQTMseYU DH0dWhGbt6ebD65TshcXAeX5Sb03CIaruIKr4kdzJ367KRYBIWCjHIa1roMUnEG/TbcL Qn1UkafJOEws6GtC5zpWOLbyq+Q82+2okDwrx8beJPqcP6cpQoX6Gf4eUGoaBcdMxFh2 4dYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683285424; x=1685877424; 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=g5G0cJUf9U5b39gQ8vAQOCiDix67GOEadK5YgCw6Yxo=; b=MieCwfWDo4mQzpNVwDd38GasqwirEqL8lxT6mEkYa5RUm2z/HbfPhhda+gQuyTXL2J gmnOWojVh2Iw0DQ3riYsP3L6LvYpHociJBOK4dQiMou22qChDUTuXseOkS8f97uqawrp 5QR24zDP5S8U2jGBJX6gZ204LWxTyM6ybU1fpgOQFUoh4baVjztMzJgenTiWAmJpDv1i azaLk/Hm832eIdRGKt1qBZ+1mXu1uMD4z1c6VfcOfibHmfGZBrdoqCgxuzgWQdvHN76a LMMSimrwDGMQUmLMHI03juxjpYVGXGlxKBhGwqPVJWONmtW/KmNl6kon6g6SN0jbAhtB nuNw== X-Gm-Message-State: AC+VfDw9t+J6+V6hP/2FIcrx+dc9SLQMns3/RyzwhCE1QzEvC0q2jOqS 33jliOwMjQV0WF9hqh9OAE2+7w== X-Received: by 2002:ac2:5d65:0:b0:4d8:8ad1:a05f with SMTP id h5-20020ac25d65000000b004d88ad1a05fmr456312lft.48.1683285423744; Fri, 05 May 2023 04:17:03 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id d7-20020a05651221c700b004edbf013fe7sm251665lft.49.2023.05.05.04.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 04:17:03 -0700 (PDT) From: Linus Walleij Date: Fri, 05 May 2023 13:16:57 +0200 Subject: [PATCH v3 3/3] ARM: omap1: Fix up the Nokia 770 board device IRQs MIME-Version: 1.0 Message-Id: <20230430-nokia770-regression-v3-3-a6d0a89ffa8b@linaro.org> References: <20230430-nokia770-regression-v3-0-a6d0a89ffa8b@linaro.org> In-Reply-To: <20230430-nokia770-regression-v3-0-a6d0a89ffa8b@linaro.org> To: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Russell King , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Thomas Bogendoerfer , Dmitry Torokhov , Mark Brown , Bartosz Golaszewski , Andreas Kemnade , Helge Deller , Ulf Hansson Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-input@vger.kernel.org, linux-spi@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mmc@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?1765053043021843691?= X-GMAIL-MSGID: =?utf-8?q?1765053043021843691?= The platform devices on the Nokia 770 is using some board-specific IRQs that get statically assigned to platform devices in the boardfile. This does not work with dynamic IRQ chip bases. Utilize the NULL device to define some board-specific GPIO lookups and use these to immediately look up the same GPIOs, convert to IRQ numbers and pass as resources to the devices. This is ugly but should work. Fixes: 92bf78b33b0b ("gpio: omap: use dynamic allocation of base") Signed-off-by: Linus Walleij --- arch/arm/mach-omap1/board-nokia770.c | 57 ++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index dc37ea30bbcf..27bd5522e1de 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c @@ -6,7 +6,7 @@ */ #include #include -#include +#include #include #include #include @@ -250,19 +250,25 @@ static struct i2c_board_info nokia770_i2c_board_info_2[] __initdata = { static void __init nokia770_cbus_init(void) { - const int retu_irq_gpio = 62; - const int tahvo_irq_gpio = 40; - - if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ")) - return; - if (gpio_request_one(tahvo_irq_gpio, GPIOF_IN, "Tahvo IRQ")) { - gpio_free(retu_irq_gpio); - return; + struct gpio_desc *d; + int irq; + + d = gpiod_get(NULL, "retu_irq", GPIOD_IN); + if (IS_ERR(d)) { + pr_err("Unable to get CBUS Retu IRQ GPIO descriptor\n"); + } else { + irq = gpiod_to_irq(d); + irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING); + nokia770_i2c_board_info_2[0].irq = irq; + } + d = gpiod_get(NULL, "tahvo_irq", GPIOD_IN); + if (IS_ERR(d)) { + pr_err("Unable to get CBUS Tahvo IRQ GPIO descriptor\n"); + } else { + irq = gpiod_to_irq(d); + irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING); + nokia770_i2c_board_info_2[1].irq = irq; } - irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING); - irq_set_irq_type(gpio_to_irq(tahvo_irq_gpio), IRQ_TYPE_EDGE_RISING); - nokia770_i2c_board_info_2[0].irq = gpio_to_irq(retu_irq_gpio); - nokia770_i2c_board_info_2[1].irq = gpio_to_irq(tahvo_irq_gpio); i2c_register_board_info(2, nokia770_i2c_board_info_2, ARRAY_SIZE(nokia770_i2c_board_info_2)); device_create_managed_software_node(&nokia770_cbus_device.dev, @@ -275,8 +281,25 @@ static void __init nokia770_cbus_init(void) } #endif /* CONFIG_I2C_CBUS_GPIO */ +static struct gpiod_lookup_table nokia770_irq_gpio_table = { + .dev_id = NULL, + .table = { + /* GPIO used by SPI device 1 */ + GPIO_LOOKUP("gpio-0-15", 15, "ads7846_irq", + GPIO_ACTIVE_HIGH), + /* GPIO used for retu IRQ */ + GPIO_LOOKUP("gpio-48-63", 15, "retu_irq", + GPIO_ACTIVE_HIGH), + /* GPIO used for tahvo IRQ */ + GPIO_LOOKUP("gpio-32-47", 8, "tahvo_irq", + GPIO_ACTIVE_HIGH), + }, +}; + static void __init omap_nokia770_init(void) { + struct gpio_desc *d; + /* On Nokia 770, the SleepX signal is masked with an * MPUIO line by default. It has to be unmasked for it * to become functional */ @@ -288,6 +311,14 @@ static void __init omap_nokia770_init(void) software_node_register_node_group(nokia770_gpiochip_nodes); platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices)); + + gpiod_add_lookup_table(&nokia770_irq_gpio_table); + d = gpiod_get(NULL, "ads7846_irq", GPIOD_IN); + if (IS_ERR(d)) + pr_err("Unable to get ADS7846 IRQ GPIO descriptor\n"); + else + nokia770_spi_board_info[1].irq = gpiod_to_irq(d); + spi_register_board_info(nokia770_spi_board_info, ARRAY_SIZE(nokia770_spi_board_info)); omap_serial_init();