From patchwork Fri Jun 28 18:08:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716496 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 62F64C30658 for ; Fri, 28 Jun 2024 18:10:22 +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=mZZQERlIGvlDT2ctdsAJWWSJ3qbII640NDh+Pz14HqU=; b=cL6kizAfP86ggMX61OQc/XRLB4 Ma1c57iczsyYDlBmmqtYK5dJ91pKMUt5j6oHXHdaN0QWyjKd6pkd3ceeXb0VB1GrDpBcboppngogC ACv5ZWMHEvsAQHLLwViXZFB8/M3Lv0D5rCitxyIClPtXkSvDUgACz5cD6boTDxCeZ4EC+326/Cksi 0TTk8hK+qQoZ5r5EFg2sfzJPmI3h+MDCAj3WgnALm1utHdukEENPftLnXvYkHix5OI6hMghnlWpgU pmBfCKmWFXFXo7oMHm3Gibz9poHb0zj3b7Ow9Jw5dSX8ukF+qbK6c+n/LhHPYI+yXkHQZH7NPRC+h vqKDGm/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG32-0000000Ean8-42vu; Fri, 28 Jun 2024 18:10:12 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG23-0000000EaG3-2ok3 for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:13 +0000 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-7180308e90bso646628a12.1 for ; Fri, 28 Jun 2024 11:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598151; x=1720202951; 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=mZZQERlIGvlDT2ctdsAJWWSJ3qbII640NDh+Pz14HqU=; b=dOjYZqnLODbexiaE77nJVfI53gCMEyeRCg4wB9xF3etD4Uw2Y8XgaUyeOuBRGzfpJp WET47ZUYyJVRZjEd7hu44VEqRUhzdENoZIUkt8iK7+I4k7gFSwR5jQWUJnsg6oDJW2+r dDbcykkhZHzv5Z8cPqJuw0vV+Nf91BaBSjr+rxRv4imU79Ed8in42OxHvhOZfyMF0/j0 9ekOtyeVFtzAKzwjI3BcakxK4LlK20nV4dOxdyaWMlfyEd54EkotHrx5CqAbP4dYMLG4 wuMzURKl3+yyV9tte/A+pqdE8pDT6oownjbjVD/nq1hzzNVz/ljV2rd3j7bov+b3U/yc i0Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598151; x=1720202951; 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=mZZQERlIGvlDT2ctdsAJWWSJ3qbII640NDh+Pz14HqU=; b=rq6Pgr05+ss5wYioqBEOcyrk7u76xh1DV6UaPp1BDJN/7UbrcNnILxCUOce5MxDq7x IVSr/mceLWOhKUmhDtjo5F7nzvZsKbUwWRlWFb9+11OiDQ5iqfcV2w4E5u9+TM2GPV3D 1m/SFADD/QW/1IGNdefJ5tlaZhwrfvEZdQvo8vSeV3gnK4cKHGTcr7RmxBVMxeCNV3dg cALhx0FnSLEZpSwIsdXPcxYmAyLJKjgiJSPGTb08oFoKkSTBiBXrdO9yc4UCojpCwt6r 2SSnOxktcZZ0Gp8aflTurDD0grwcVatyqx+W3Trd2kQnslBarAEryxLkLg2p4WJo8F7o tobw== X-Gm-Message-State: AOJu0Yx7ZKIOdb5Co9qO3NovX9hevKd2urRlotTWdAjfxNnxvM0/3VkU O4fe81bU7kv+oUpuSfwc/JfwrLda4EggHN+okgivSoiXTMc/jApB X-Google-Smtp-Source: AGHT+IHkQkSp58snm0J9lMaUMbDp2cIe5JR1UZf7YHJIVSCoCLZlR/SP/vAyS5cqOgnfslds0UlWUA== X-Received: by 2002:a05:6a20:1225:b0:1be:c7d9:ecc5 with SMTP id adf61e73a8af0-1bec7d9ef7bmr7626980637.19.1719598150756; Fri, 28 Jun 2024 11:09:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:10 -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 08/10] ARM: spitz: Use software nodes to describe MMC GPIOs Date: Fri, 28 Jun 2024 11:08:48 -0700 Message-ID: <20240628180852.1738922-9-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_110911_742619_87FBFF52 X-CRM114-Status: GOOD ( 20.08 ) 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 Convert Spitz to use software nodes for specifying GPIOs for the MMC. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/devices.c | 36 +++++++++++++----------- arch/arm/mach-pxa/devices.h | 1 - arch/arm/mach-pxa/gumstix.c | 2 +- arch/arm/mach-pxa/spitz.c | 18 +++++------- include/linux/platform_data/mmc-pxamci.h | 4 ++- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index e2758c94fd77..d050a4c78f97 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -48,7 +48,7 @@ struct platform_device pxa_device_pmu = { .num_resources = 1, }; -static struct resource pxamci_resources[] = { +static const struct resource pxamci_resources[] = { [0] = { .start = 0x41100000, .end = 0x41100fff, @@ -61,22 +61,26 @@ static struct resource pxamci_resources[] = { }, }; -static u64 pxamci_dmamask = 0xffffffffUL; - -struct platform_device pxa_device_mci = { - .name = "pxa2xx-mci", - .id = 0, - .dev = { - .dma_mask = &pxamci_dmamask, - .coherent_dma_mask = 0xffffffff, - }, - .num_resources = ARRAY_SIZE(pxamci_resources), - .resource = pxamci_resources, -}; - -void __init pxa_set_mci_info(struct pxamci_platform_data *info) +void __init pxa_set_mci_info(const struct pxamci_platform_data *info, + const struct property_entry *props) { - pxa_register_device(&pxa_device_mci, info); + const struct platform_device_info mci_info = { + .name = "pxa2xx-mci", + .id = 0, + .res = pxamci_resources, + .num_res = ARRAY_SIZE(pxamci_resources), + .data = info, + .size_data = sizeof(*info), + .dma_mask = 0xffffffffUL, + .properties = props, + }; + struct platform_device *mci_dev; + int err; + + mci_dev = platform_device_register_full(&mci_info); + err = PTR_ERR_OR_ZERO(mci_dev); + if (err) + pr_err("Unable to create mci device: %d\n", err); } static struct pxa2xx_udc_mach_info pxa_udc_info = { diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h index b7c0e138ef61..72c556ff67db 100644 --- a/arch/arm/mach-pxa/devices.h +++ b/arch/arm/mach-pxa/devices.h @@ -4,7 +4,6 @@ struct mmp_dma_platdata; extern struct platform_device pxa_device_pmu; -extern struct platform_device pxa_device_mci; extern struct platform_device pxa3xx_device_mci2; extern struct platform_device pxa3xx_device_mci3; extern struct platform_device pxa25x_device_udc; diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c index b9eddc691097..efa6faa62a2c 100644 --- a/arch/arm/mach-pxa/gumstix.c +++ b/arch/arm/mach-pxa/gumstix.c @@ -90,7 +90,7 @@ static struct pxamci_platform_data gumstix_mci_platform_data = { static void __init gumstix_mmc_init(void) { - pxa_set_mci_info(&gumstix_mci_platform_data); + pxa_set_mci_info(&gumstix_mci_platform_data, NULL); } #else static void __init gumstix_mmc_init(void) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index c79510185ce3..4720a40587f1 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -651,21 +651,17 @@ static struct pxamci_platform_data spitz_mci_platform_data = { .setpower = spitz_mci_setpower, }; -static struct gpiod_lookup_table spitz_mci_gpio_table = { - .dev_id = "pxa2xx-mci.0", - .table = { - GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_DETECT, - "cd", GPIO_ACTIVE_LOW), - GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_WP, - "wp", GPIO_ACTIVE_LOW), - { }, - }, +static const struct property_entry spitz_mci_props[] __initconst = { + PROPERTY_ENTRY_GPIO("cd-gpios", &pxa2xx_gpiochip_node, + SPITZ_GPIO_nSD_DETECT, GPIO_ACTIVE_LOW), + PROPERTY_ENTRY_GPIO("wp-gpios", &pxa2xx_gpiochip_node, + SPITZ_GPIO_nSD_WP, GPIO_ACTIVE_LOW), + { } }; static void __init spitz_mmc_init(void) { - gpiod_add_lookup_table(&spitz_mci_gpio_table); - pxa_set_mci_info(&spitz_mci_platform_data); + pxa_set_mci_info(&spitz_mci_platform_data, spitz_mci_props); } #else static inline void spitz_mmc_init(void) {} diff --git a/include/linux/platform_data/mmc-pxamci.h b/include/linux/platform_data/mmc-pxamci.h index 7e44e84e7150..652f323b5ecc 100644 --- a/include/linux/platform_data/mmc-pxamci.h +++ b/include/linux/platform_data/mmc-pxamci.h @@ -7,6 +7,7 @@ struct device; struct mmc_host; +struct property_entry; struct pxamci_platform_data { unsigned int ocr_mask; /* available voltages */ @@ -18,7 +19,8 @@ struct pxamci_platform_data { bool gpio_card_ro_invert; /* gpio ro is inverted */ }; -extern void pxa_set_mci_info(struct pxamci_platform_data *info); +extern void pxa_set_mci_info(const struct pxamci_platform_data *info, + const struct property_entry *props); extern void pxa3xx_set_mci2_info(struct pxamci_platform_data *info); extern void pxa3xx_set_mci3_info(struct pxamci_platform_data *info);