From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89178200111; Tue, 18 Feb 2025 09:55:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.211.166.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739872548; cv=none; b=HeVONXgTDu7lm+TjIf347xyj/UhIVqDAu5qK/BgY7q+LIS//j0GeuKoIxoQwQ/viz5xxb107oiq06a3tbztg8gAj77dehh8a0n2j8A737TgWQnAgiQTC1iuR8YgymVvipTS9fjDTjKahnnwOKtOr7DwjE9jBe4MVTonhixwychE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739872548; c=relaxed/simple; bh=WuqhpzqD0eQ2AsQvz5im5Ud+8fEJv2LS6d10sJfVpis=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MXvfftGMkZY4Nc6nVBQFkiI+DBxGywtt334oMucoHtOI9tHQkZ4evhnmlxZb9bYcgLdV0xgrvtFqvWlBuueQmgvrWjGJkZl0pcQ0ABwQzg/Nu8o2Y+iof1eZ1VPgvdZEh4F4iLz/BAYyoYcD+XXnJCSahognh83XcoSItQ0nsAI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gentoo.org; spf=pass smtp.mailfrom=gentoo.org; arc=none smtp.client-ip=140.211.166.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gentoo.org Received: from localhost (unknown [180.172.76.141]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dlan) by smtp.gentoo.org (Postfix) with ESMTPSA id 0DE22343022; Tue, 18 Feb 2025 09:55:44 +0000 (UTC) Date: Tue, 18 Feb 2025 09:55:40 +0000 From: Yixun Lan To: Linus Walleij Cc: Rob Herring , Olof Johansson , Bartosz Golaszewski , Krzysztof Kozlowski , Conor Dooley , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Yangyu Chen , Jisheng Zhang , Jesse Taube , Inochi Amaoto , Icenowy Zheng , Meng Zhang , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v4 1/4] dt-bindings: gpio: spacemit: add support for K1 SoC Message-ID: <20250218095540-GYA29065@gentoo> References: <20250123113042-GYA38135@gentoo> <20250127181726.GA538260-robh@kernel.org> <20250128031712-GYB47737@gentoo> <20250206133156-GYA5687@gentoo> <20250214115410-GYA21743@gentoo> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hi Linus: On 10:44 Tue 18 Feb , Linus Walleij wrote: > On Fri, Feb 14, 2025 at 12:54 PM Yixun Lan wrote: > > > thanks for this very detail prototype! it works mostly, with one problem: > > > > how to map gpio correctly to the pin from pinctrl subsystem? > > > > for example, I specify gpio-ranges in dts, then > > gpio0: gpio@d4019000 { > > compatible = "spacemit,k1-gpio"; > > reg = <0x0 0xd4019000 0x0 0x100>; > > ... > > gpio-ranges = <&pinctrl 0 0 96>; > > }; > > > > foo-gpios = <&gpio0 2 28 GPIO_ACTIVE_LOW>; > > > > It should get GPIO_92 ( 92 = 2 * 32 + 28), but turns out GPIO_28 > > > > Probably there is something I missed... > > No it's just me missing the complexity! > > > to make the gpio part work, we need additional custom gpio-ranges parser, > > which should similar to of_gpiochip_add_pin_range() in gpiolib-of.c > > (at least gpio core need to adjust to call custom this function) > > Let me send a patch set to bring threecell into the core instead, > and see if it works for you! > > I will post it real soon. > can you check the v5 of the patch here [1]? which I just sent out yesterday it does 1) implement xlate() 2) instroduce custom add_pin_page() the gpio part works as I tested, the gpio irq probably need more testing > Yours, > Linus Walleij [1] https://lore.kernel.org/spacemit/20250217-03-k1-gpio-v5-0-2863ec3e7b67@gentoo.org/ -- Yixun Lan (dlan) Gentoo Linux Developer GPG Key ID AABEFD55