From patchwork Fri Jun 28 18:08:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B5B3BC2BD09 for ; Fri, 28 Jun 2024 18:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fVMwheqA5PLjXICrqtVucOfQhWX0Fpnfz1fEEhxd/KA=; b=yz1x3t+jje0p9ftNtLEBmX9xFW 9WtMMbr+EukAWw9HbcSFIDapXtco2arCffz+pit3Ar1rm42A/USn0tEKCe6G28t0GR5k1VC1Z4VOq EjghK/oVo6I9Qc7VBv5XVHM5khMbJ45bkda37tEd50rpGSr8DraxX43HJ4qyFrd0BvcNFO4UQNNPc jF2T8VedQFX6wOGpZ6A5ePccFbv3GcBMoq1s8qaMdfx9sSc7H2ul5Hy1JOZkP+L0m6p/KccBjLqKK mItSXDogpYWRf3dRUgnU26vqeqINS26vjrZfJukA92HuEfPv7HURGe0P9FXhpI4q8Zeqc+E4LxnZc 3vmJLvDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG2e-0000000EaYE-1wQH; Fri, 28 Jun 2024 18:09:48 +0000 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG20-0000000EaEe-2bNv for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:09 +0000 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3c9b94951cfso499982b6e.3 for ; Fri, 28 Jun 2024 11:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598147; x=1720202947; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fVMwheqA5PLjXICrqtVucOfQhWX0Fpnfz1fEEhxd/KA=; b=M8ancfvHRpc47pwKJ16Onz3fXnZcCKeBH+l06oustEa6dA3JKmaL9AOlyrdChnahbe 3eKBwOm2IPD+vh47mKJO1muicy7HFDbooLFCzQLlkyvHecAMh744dpX7uYkJRCn/0Nfb bAtb1Yyqqc85OotIqcg7CnYz+TYDBgqU0CBzJfaUp5KvfWKSiNelloyVE7cRFIOLppTT 1i2evr6zlHv/b0RciNrcky4HVs268VybZpMBQYLTuNYp/0AS1jEunWQ1vutqKtrUV7TP ORv6YlYwdgMq5hHEgPG0zE/BIIXqx/YeGYUjt4vAyM+2MUqAI3VcoBBxMPFCZK7WyiBC Pdrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598147; x=1720202947; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fVMwheqA5PLjXICrqtVucOfQhWX0Fpnfz1fEEhxd/KA=; b=UG+7IyoG8Jad1dpZaXV9scKG2QHFHrfDn5iHhnkEKo0X/3All7h8zUO2QBVtBX3M/e VM1l7l+FhVRw/1/3vzSc6pJa/CiDZxd22yEHpURUmS4Ad0L7su9AhiLXwda1vRJOvH8j pPm8p7+JG8hquXHlViPuFYTOFBJCxF9nXijKrgDOGJjjvJ6EElR2H0vKTxix/4Bbr0ZM jIqLo1Hjco8xE81fqJc/SYBfQD2Q9xKr9VFkbDYHyyF3wYB8DOzYNQ9PeWRoSe5d8aLk zpTk+RyMpaZXCH7XYLjOJXObw5lh7sAKwEG7eQyypi3FLCNgqfRaebqTGk2ipYqPG5jm 7ryA== X-Gm-Message-State: AOJu0Yykx5gdmRfQ35DhwuZAJYcxhtjp+xiu2Ya+vJF4q4ytzhmDycjU RCvhQu6JClTnZxpVlH11wtvXlHGGkXpVg6d71CHt9SNGip/V7T1WTQuafA== X-Google-Smtp-Source: AGHT+IGNZSGJXSF1ny8x7rMmOSnm4p25k/DcV8pt4n6UZoIc2gM1XH3BV8U4qDA1RrIettcCykcLqQ== X-Received: by 2002:a05:6808:2219:b0:3d2:212e:71a0 with SMTP id 5614622812f47-3d54594bcd4mr20676903b6e.6.1719598147504; Fri, 28 Jun 2024 11:09:07 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:c929:2998:720d:a104]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7080295d1f4sm1982911b3a.91.2024.06.28.11.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:07 -0700 (PDT) From: Dmitry Torokhov To: Haojian Zhuang , Daniel Mack , Robert Jarzmik , Arnd Bergmann , Linus Walleij , soc@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/10] ARM: spitz: Use software nodes to describe SPI CS lines Date: Fri, 28 Jun 2024 11:08:45 -0700 Message-ID: <20240628180852.1738922-6-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog In-Reply-To: <20240628180852.1738922-1-dmitry.torokhov@gmail.com> References: <20240628180852.1738922-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_110908_694129_2A0F7EAB X-CRM114-Status: GOOD ( 17.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Linus Walleij Convert the Spitz to use software nodes for specifying SPI CS. Because the SPI core can figure out the number of chipselects from the number of GPIO handles specified in properties, setting "num-cs" property is no longer needed. Signed-off-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/pxa27x.c | 1 + arch/arm/mach-pxa/spitz.c | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index b135b9ef665c..f8382477d629 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -341,6 +341,7 @@ static int __init pxa27x_init(void) register_syscore_ops(&pxa2xx_mfp_syscore_ops); if (!of_have_populated_dt()) { + software_node_register(&pxa2xx_gpiochip_node); pxa2xx_set_dmac_info(&pxa27x_dma_pdata); ret = platform_add_devices(devices, ARRAY_SIZE(devices)); diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index b14eb2a54f80..504d04bb2df7 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,7 @@ #include #include #include +#include #include #include @@ -128,7 +130,6 @@ static unsigned long spitz_pin_config[] __initdata = { GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ }; - /****************************************************************************** * Scoop GPIO expander ******************************************************************************/ @@ -565,18 +566,17 @@ static struct spi_board_info spitz_spi_devices[] = { }, }; -static struct gpiod_lookup_table spitz_spi_gpio_table = { - .dev_id = "spi2", - .table = { - GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_ADS7846_CS, "cs", 0, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_LCDCON_CS, "cs", 1, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_MAX1111_CS, "cs", 2, GPIO_ACTIVE_LOW), - { }, - }, +static const struct software_node_ref_args spitz_spi_gpio_refs[] = { + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_ADS7846_CS, + GPIO_ACTIVE_LOW), + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_LCDCON_CS, + GPIO_ACTIVE_LOW), + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_MAX1111_CS, + GPIO_ACTIVE_LOW), }; static const struct property_entry spitz_spi_properties[] = { - PROPERTY_ENTRY_U32("num-cs", 3), + PROPERTY_ENTRY_REF_ARRAY("gpios", spitz_spi_gpio_refs), { } }; @@ -598,7 +598,6 @@ static void __init spitz_spi_init(void) gpiod_add_lookup_table(&spitz_lcdcon_gpio_table); gpiod_add_lookup_table(&spitz_ads7846_gpio_table); - gpiod_add_lookup_table(&spitz_spi_gpio_table); pd = platform_device_register_full(&spitz_spi_device_info); err = PTR_ERR_OR_ZERO(pd);