Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp604336lqt; Fri, 19 Apr 2024 05:35:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUkmCfaMN1r6DWYGqRVIVW0eBPj2T3M5Fp9KAMjlZolJf8FK66GZetltaxb7XRKSy0+uxxJLpTCTnaAiIT+HLBpf1WjV6dOPGZ8zIe/tA== X-Google-Smtp-Source: AGHT+IHzYTQhWV8X8Z2txycI5H9Lk1LoGppIVnj3b1X5dmFtvJr7LQycVj1acxkkVzICgOgwy6bx X-Received: by 2002:ad4:41d0:0:b0:6a0:6649:c7f3 with SMTP id a16-20020ad441d0000000b006a06649c7f3mr1007219qvq.41.1713530129202; Fri, 19 Apr 2024 05:35:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713530129; cv=pass; d=google.com; s=arc-20160816; b=ijW8BBnecoXlQlYcplkSrMsEcscUIMikd2mGbzYxQ/wGs667BwLu9E4qwseCAHv3Gf mAmyNzRnHokk8b17gLeRF8p0dxMtp/EdXRQLZd7HxkB0QO/OQ9ylyI2Kg8nHexhSJDk3 eAOffadvq2ScNzWOwwcQzQ4EpSinh+jdqVxzOa0jz2RvYCTLs9priJXXdfxJb+bZ2VmW fw4LNPQ7b42yB63LEOxraA/ybeB19WaJF7tKns9rLsTjNKK+ChWLMdW2n29KD1x1Bor6 Z2eeM1PCYWpPX1rXP4kSFDlgS4nDs/pxNqZcVJ59ykWLa6pzSxQ5rYOiPjrfZlJ2JLaB 5Dkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:mail-followup-to:message-id:subject:to:from:date; bh=j1in+7EuWrhLbsvCmgoSK3NJYGbhK7Fu34EVrpZC0d0=; fh=rpLxTo1K0+wHiaJyns7BfMIQGlToaMWxr2jzvmMuQ3w=; b=Hdd47Gw8djrQdrKFULMd14Y5uMsbJ1VNsNkCO7cYEucna3b8AlE4n9+mRCIjKJBrSh blJKwYtbkfAceLNhgCoV99gVmQtoTRvQxi54GQuvKy9PPrQt7LxOKO79garRayrjCIV/ fTRFXFkhAwdZo10MeTyWQI3XZX9fcIokPLZEFMXnX0QmlDbnMN2HW4FutnNPYXUEF9if 6Hgq1qmCM3IZxAI2AxD807bi7V/AkZ+VrqjNFHXwRwcrjvGH2Zk/ir5ADBnYCK2EGr02 reTuKELmRL+ycMy+iGZ6Czz56zitU1oXOtLhel8xL5f5G8sbhlu2Z28+WvVofhEHbJUk vN0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=free.fr dmarc=pass fromdomain=free.fr); spf=pass (google.com: domain of linux-kernel+bounces-151414-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151414-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=free.fr Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dv7-20020ad44ee7000000b0069cead049d3si3893328qvb.12.2024.04.19.05.35.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 05:35:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151414-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=free.fr dmarc=pass fromdomain=free.fr); spf=pass (google.com: domain of linux-kernel+bounces-151414-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151414-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=free.fr 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 BEF0A1C20CA1 for ; Fri, 19 Apr 2024 12:35:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BD5783A0E; Fri, 19 Apr 2024 12:35:22 +0000 (UTC) Received: from smtp2-g21.free.fr (smtp2-g21.free.fr [212.27.42.2]) (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 6D08F5812F; Fri, 19 Apr 2024 12:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.27.42.2 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713530121; cv=none; b=P5qhuBfEj0/joa1GqqsHRrhxgV0vcrHO0M4zyxtgQLO04IcAPe95wJ9ncmoeNTQ+BUG9pW4BnN1pRF/vuJEAHXVP8juAgqvOV1Ldnij2T/VOyVu8mNSjjaAX/1LfHEWrVQb8Pgecks09PoMZR3QVsulllfh2ZHexkqIqj34ffgo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713530121; c=relaxed/simple; bh=dxcXW3Z5o69jrxta3xxO8E57aeJDmyUL46fXb1HiMZg=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=cqbH3BrJBqww2Y5WWLW+TX2vZMOpkNGO3Pq95hH1h1pQNfq50gEjuLA+0h8hSRhP+D61IGNHGWr2E+T2rskWkjY5FIBv4PAoiyx8r293xuXZ9yRaUsS9uTbX6Lx82BQHWz3ciiZwjMuQPg0ML4zUunq1Ahr1YazbhFyzOcvoH8M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=free.fr; spf=pass smtp.mailfrom=free.fr; arc=none smtp.client-ip=212.27.42.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=free.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=free.fr Received: from localhost.localdomain (unknown [82.64.135.138]) by smtp2-g21.free.fr (Postfix) with ESMTPS id 29DC82003CC; Fri, 19 Apr 2024 14:35:08 +0200 (CEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 4D89840039; Fri, 19 Apr 2024 14:34:12 +0200 (CEST) Date: Fri, 19 Apr 2024 14:34:12 +0200 From: Etienne Buira To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, etienne.buira@free.fr Subject: [PATCH v2] gpio-syscon: do not report bogus error Message-ID: Mail-Followup-To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, etienne.buira@free.fr Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Do not issue "can't read the data register offset!" when gpio,syscon-dev is not set albeit unneeded. gpio-syscon is used with rk3328 chip, but this iomem region is documented in Documentation/devicetree/bindings/gpio/rockchip,rk3328-grf-gpio.yaml and does not require gpio,syscon-dev setting. It has been suggested to automatically detect if node has a valid parent, but that would defeat the purpose of error message, for example arch/arm/boot/dts/ti/keystone/keystone-k2g.dtsi could then be used without gpio,syscon-dev, and lead to funny results without error message. It has been tried to mandate use of gpio,syscon-dev, but that raised objection. So while this patch may be kludgy, it looks the less bad to address the spurious dev_err call. v2: - changed flag name Signed-off-by: Etienne Buira --- drivers/gpio/gpio-syscon.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c index 6e1a2581e6ae..4f103ce26019 100644 --- a/drivers/gpio/gpio-syscon.c +++ b/drivers/gpio/gpio-syscon.c @@ -13,9 +13,10 @@ #include #include -#define GPIO_SYSCON_FEAT_IN BIT(0) -#define GPIO_SYSCON_FEAT_OUT BIT(1) -#define GPIO_SYSCON_FEAT_DIR BIT(2) +#define GPIO_SYSCON_FEAT_IN BIT(0) +#define GPIO_SYSCON_FEAT_OUT BIT(1) +#define GPIO_SYSCON_FEAT_DIR BIT(2) +#define GPIO_SYSCON_FEAT_USE_PARENT BIT(3) /* SYSCON driver is designed to use 32-bit wide registers */ #define SYSCON_REG_SIZE (4) @@ -27,7 +28,9 @@ * @flags: Set of GPIO_SYSCON_FEAT_ flags: * GPIO_SYSCON_FEAT_IN: GPIOs supports input, * GPIO_SYSCON_FEAT_OUT: GPIOs supports output, - * GPIO_SYSCON_FEAT_DIR: GPIOs supports switch direction. + * GPIO_SYSCON_FEAT_DIR: GPIOs supports switch direction, + * GPIO_SYSCON_FEAT_USE_PARENT: gpio,syscon-dev do not + * have to be set, parent regspace will be used. * @bit_count: Number of bits used as GPIOs. * @dat_bit_offset: Offset (in bits) to the first GPIO bit. * @dir_bit_offset: Optional offset (in bits) to the first bit to switch @@ -149,7 +152,7 @@ static void rockchip_gpio_set(struct gpio_chip *chip, unsigned int offset, static const struct syscon_gpio_data rockchip_rk3328_gpio_mute = { /* RK3328 GPIO_MUTE is an output only pin at GRF_SOC_CON10[1] */ - .flags = GPIO_SYSCON_FEAT_OUT, + .flags = GPIO_SYSCON_FEAT_OUT | GPIO_SYSCON_FEAT_USE_PARENT, .bit_count = 1, .dat_bit_offset = 0x0428 * 8 + 1, .set = rockchip_gpio_set, @@ -221,19 +224,21 @@ static int syscon_gpio_probe(struct platform_device *pdev) if (IS_ERR(priv->syscon)) return PTR_ERR(priv->syscon); - ret = of_property_read_u32_index(np, "gpio,syscon-dev", 1, - &priv->dreg_offset); - if (ret) - dev_err(dev, "can't read the data register offset!\n"); + if (!(priv->data->flags & GPIO_SYSCON_FEAT_USE_PARENT)) { + ret = of_property_read_u32_index(np, "gpio,syscon-dev", 1, + &priv->dreg_offset); + if (ret) + dev_err(dev, "can't read the data register offset!\n"); - priv->dreg_offset <<= 3; + priv->dreg_offset <<= 3; - ret = of_property_read_u32_index(np, "gpio,syscon-dev", 2, - &priv->dir_reg_offset); - if (ret) - dev_dbg(dev, "can't read the dir register offset!\n"); + ret = of_property_read_u32_index(np, "gpio,syscon-dev", 2, + &priv->dir_reg_offset); + if (ret) + dev_dbg(dev, "can't read the dir register offset!\n"); - priv->dir_reg_offset <<= 3; + priv->dir_reg_offset <<= 3; + } priv->chip.parent = dev; priv->chip.owner = THIS_MODULE; base-commit: 4cece764965020c22cff7665b18a012006359095 -- 2.43.0