Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp633039lqg; Fri, 1 Mar 2024 16:44:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUj/tyy+AaXboQOZehpPt0B/NyBSqEx/twPIZc7oeNKVQMFLz4FCGOnxmG43S7KzK15RT8AI9n9WpKopjms9pVVYnbn2/DWn4twC2Wvaw== X-Google-Smtp-Source: AGHT+IFyg21pgjgVQ/hAQ5Y+DWN6ZQDFztrfBa6shNF7DEw4sCycEabSqxv7WB1GVnEQ+GHdLOLM X-Received: by 2002:a05:620a:5d85:b0:788:136e:e2e9 with SMTP id xx5-20020a05620a5d8500b00788136ee2e9mr1439330qkn.34.1709340295439; Fri, 01 Mar 2024 16:44:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709340295; cv=pass; d=google.com; s=arc-20160816; b=eRwkRiw8aFhnDEqbM07IehFH+0PQoOYA4HgZ6UbnWdGKaezab2v3YdktkwDK3QKHIG QtU4phPBJ1x5TOEyHUTW4eoKVPJZ6r+B4LteKwNL60pGdPVt0t3xevoalfmkkWjfQtxg CnxInLU1TnAfwzY/mS1CglTw/pK5QWXf0x3V/9ZrCec0x3Pr1AtYTQ8JPRO1yYDJK8VI vK0yOFqcwfotF1mQ8Ly6Y59WIL75QEks2sPK7Cl64u0w0vpE1Ew6l7X9iUeeyxlQNjE6 cas2KTsZodudEMJpQtHu7FRslPo2urDSNf91WESrETmMT6JlPA6JsElSsazy0EBciKtt r2Pw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=qEBybbc/04aAvrTiNzglQj/i3LXigsfKL9heDLM7cYo=; fh=N5Q6VNDAZj+MyOgbdzD6/v9z8jj4on5itGiYCVPmxck=; b=LqJtMjL4Nw5y/FjQQtZX3PIorYwYjkMTJru905P+mmtqRRprBdrgp+FmcLr69ZFJbH aRlxnG8WbY7+M8cctJYcmwxlbyExyQU0tGsoVFtsz0YZO+ZZaV5EZHiEY57B/nW+x+90 tmc0bF8JiLC9humzwXS4Asqnu64BztN2xMupfgNNqy50LUI4gEaRlCQ+KcXxIwHRmsKP RCgh4DQPobcGzYKKOZnul/WXKuXcEiG1AQYYnvdBw5VHwR2HOg1bcOrtbqZOgZGQ7l3u y5vLHj61Vr8tDe9BCKoUL3r9jc9JINFAax/FCf+cFVFYfnInWKfPpkDW79l9/ubUaJ9G 7zzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-89266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s15-20020a05620a29cf00b00787fc4de09dsi5017175qkp.232.2024.03.01.16.44.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 16:44:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-89266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1FA6C1C21D3A for ; Sat, 2 Mar 2024 00:44:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 50B1F23C9; Sat, 2 Mar 2024 00:44:47 +0000 (UTC) Received: from fgw20-7.mail.saunalahti.fi (fgw20-7.mail.saunalahti.fi [62.142.5.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15095EBE for ; Sat, 2 Mar 2024 00:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709340286; cv=none; b=Y4FSVhUoT5noNH6Ccdr6047Hfb3kwKbAxy44sR/jFY9MzlEHDxuSdiCBD82oQeXhhJMyE41UCGeMun8cntjjUgSo+ossHTymZvHIP/xTZ4Wdafiz/NvbxQNLd/keH+N7JP5l0NrQouLpZfVXHOXjRRPrHJgXxZnKq2ax9QEA+3w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709340286; c=relaxed/simple; bh=N7aLsipkDvipYuH/b5r8b2CKLMOVSg0u+ObIwgGk21s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MqT0emLYK3mdPM70WQMwhCatJ8m2KR3qsRyZ6ZCAKpkGMVyVeaw99CyLwS8koLk7Aqozcf6EzSLusrENd7AxGL+/LOvwrsqA2z/I1ctN0EVSCciF6nADVI/58fc5eDcxKVfqJGHVjLrJhBRA7YwlmHbO7nkdral4a9kXOLLFMds= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-217.elisa-laajakaista.fi [88.113.26.217]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id 0e94cdf9-d82e-11ee-b3cf-005056bd6ce9; Sat, 02 Mar 2024 02:44:42 +0200 (EET) From: Andy Shevchenko To: Bartosz Golaszewski , Linus Walleij , =?UTF-8?q?Th=C3=A9o=20Lebrun?= , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Bartosz Golaszewski , Andy Shevchenko Subject: [PATCH v2 1/1] gpio: nomadik: Finish conversion to use firmware node APIs Date: Sat, 2 Mar 2024 02:44:18 +0200 Message-ID: <20240302004439.197232-1-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Previously driver got a few updates in order to replace OF APIs by respective firmware node, however it was not finished to the logical end, e.g., some APIs that has been used are still require OF node to be passed. Finish that job by converting leftovers to use firmware node APIs. Signed-off-by: Andy Shevchenko --- v2: also update necessary parts in the respective pin control driver drivers/gpio/Kconfig | 1 - drivers/gpio/gpio-nomadik.c | 13 ++++++------ drivers/pinctrl/nomadik/pinctrl-nomadik.c | 25 +++++++++++------------ include/linux/gpio/gpio-nomadik.h | 4 +++- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index f633be517654..ef20ab921010 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -481,7 +481,6 @@ config GPIO_MXS config GPIO_NOMADIK bool "Nomadik GPIO driver" depends on ARCH_U8500 || ARCH_NOMADIK || MACH_EYEQ5 || COMPILE_TEST - depends on OF_GPIO select GPIOLIB_IRQCHIP help Say yes here to support the Nomadik SoC GPIO block. This block is also diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index c9fd6631e0aa..483086deb397 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c @@ -23,10 +23,10 @@ #include #include #include -#include -#include +#include #include #include +#include #include #include #include @@ -504,7 +504,7 @@ static inline void nmk_gpio_dbg_show_one(struct seq_file *s, * it is the pin controller or GPIO driver. However we need to use the right * platform device when looking up resources so pay attention to pdev. */ -struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np, +struct nmk_gpio_chip *nmk_gpio_populate_chip(struct fwnode_handle *fwnode, struct platform_device *pdev) { struct nmk_gpio_chip *nmk_chip; @@ -517,9 +517,9 @@ struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np, u32 id, ngpio; int ret; - gpio_dev = bus_find_device_by_of_node(&platform_bus_type, np); + gpio_dev = bus_find_device_by_fwnode(&platform_bus_type, fwnode); if (!gpio_dev) { - pr_err("populate \"%pOFn\": device not found\n", np); + dev_err(&pdev->dev, "populate \"%pfwP\": device not found\n", fwnode); return ERR_PTR(-ENODEV); } gpio_pdev = to_platform_device(gpio_dev); @@ -624,7 +624,6 @@ static const struct irq_chip nmk_irq_chip = { static int nmk_gpio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *np = dev->of_node; struct nmk_gpio_chip *nmk_chip; struct gpio_irq_chip *girq; bool supports_sleepmode; @@ -632,7 +631,7 @@ static int nmk_gpio_probe(struct platform_device *pdev) int irq; int ret; - nmk_chip = nmk_gpio_populate_chip(np, pdev); + nmk_chip = nmk_gpio_populate_chip(dev_fwnode(dev), pdev); if (IS_ERR(nmk_chip)) { dev_err(dev, "could not populate nmk chip struct\n"); return PTR_ERR(nmk_chip); diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index 7849144b3b80..b89b2609fdfd 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -1190,8 +1190,8 @@ static int nmk_pinctrl_resume(struct device *dev) static int nmk_pinctrl_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; - struct device_node *prcm_np; + struct device_node *fwnode = dev_fwnode(&pdev->dev); + struct device_node *prcm_fwnode; struct nmk_pinctrl *npct; uintptr_t version = 0; int i; @@ -1216,28 +1216,27 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) * or after this point: it shouldn't matter as the APIs are orthogonal. */ for (i = 0; i < NMK_MAX_BANKS; i++) { - struct device_node *gpio_np; + struct fwnode_handle *gpio_fwnode; struct nmk_gpio_chip *nmk_chip; - gpio_np = of_parse_phandle(np, "nomadik-gpio-chips", i); - if (!gpio_np) + gpio_fwnode = fwnode_find_reference(fwnode, "nomadik-gpio-chips", i); + if (IS_ERR(gpio_fwnode)) continue; - dev_info(&pdev->dev, "populate NMK GPIO %d \"%pOFn\"\n", - i, gpio_np); - nmk_chip = nmk_gpio_populate_chip(gpio_np, pdev); + dev_info(&pdev->dev, "populate NMK GPIO %d \"%pfwP\"\n", i, gpio_fwnode); + nmk_chip = nmk_gpio_populate_chip(gpio_fwnode, pdev); if (IS_ERR(nmk_chip)) dev_err(&pdev->dev, "could not populate nmk chip struct - continue anyway\n"); - of_node_put(gpio_np); + fwnode_handle_put(gpio_fwnode); /* We are NOT compatible with mobileye,eyeq5-gpio. */ BUG_ON(nmk_chip->is_mobileye_soc); } - prcm_np = of_parse_phandle(np, "prcm", 0); - if (prcm_np) { - npct->prcm_base = of_iomap(prcm_np, 0); - of_node_put(prcm_np); + prcm_fwnode = fwnode_find_reference(fwnode, "prcm", 0); + if (!IS_ERR(prcm_fwnode)) { + npct->prcm_base = fwnode_iomap(prcm_fwnode, 0); + fwnode_handle_put(prcm_fwnode); } if (!npct->prcm_base) { if (version == PINCTRL_NMK_STN8815) { diff --git a/include/linux/gpio/gpio-nomadik.h b/include/linux/gpio/gpio-nomadik.h index 9bdb09fda4c9..4a95ea7935fb 100644 --- a/include/linux/gpio/gpio-nomadik.h +++ b/include/linux/gpio/gpio-nomadik.h @@ -2,6 +2,8 @@ #ifndef __LINUX_GPIO_NOMADIK_H #define __LINUX_GPIO_NOMADIK_H +struct fwnode_handle; + /* Package definitions */ #define PINCTRL_NMK_STN8815 0 #define PINCTRL_NMK_DB8500 1 @@ -263,7 +265,7 @@ void __nmk_gpio_make_output(struct nmk_gpio_chip *nmk_chip, unsigned int offset, int val); void __nmk_gpio_set_slpm(struct nmk_gpio_chip *nmk_chip, unsigned int offset, enum nmk_gpio_slpm mode); -struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np, +struct nmk_gpio_chip *nmk_gpio_populate_chip(struct fwnode_handle *fwnode, struct platform_device *pdev); /* Symbols declared in pinctrl-nomadik used by gpio-nomadik. */ -- 2.44.0