All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: "Rob Herring" <robh@kernel.org>, "Rafał Miłecki" <rafal@milecki.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Tony Lindgren <tony@atomide.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Florian Fainelli <f.fainelli@gmail.com>,
	bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH V3 1/2] dt-bindings: pinctrl: support specifying pins, groups & functions
Date: Tue, 14 Dec 2021 22:50:35 +0100	[thread overview]
Message-ID: <e017f3b3-7ba9-6b5f-e18f-830ab717f026@gmail.com> (raw)
In-Reply-To: <756f55d2-f033-8066-7e51-005e1f0587ec@gmail.com>

On 14.12.2021 21:10, Rafał Miłecki wrote:
> On 14.12.2021 20:59, Rob Herring wrote:
>> On Sat, Dec 11, 2021 at 12:16:25PM +0100, Rafał Miłecki wrote:
>>> Rob: please kindly comment on this idea of storing pins/groups/functions
>>> in DT.
>>
>> I was never a fan of stuffing pin mux/ctrl into DT for what's mostly a
>> one time stuffing of register values. And given how many things run
>> before getting to the kernel, doing proper pin configuration in the
>> kernel is much too late (or redundant because it was actually already
>> done).
> 
> OK, thanks for sharing that. Given a pretty limited optimism on this
> approach I'll simply drop it and do things the old good way.

I feel I need to post one more comment though.

***

What I find a really clean DT code for defining some BCM4908 groups:

groups {
	led_0_grp {
		pins = <&pin0 3>;
	};

	led_1_grp {
		pins = <&pin1 3>;
	};

	nand_grp {
		pins = <&pin32 0>, <&pin33 0>, <&pin34 0>, <&pin43 0>, <&pin44 0>, <&pin45 0>, <&pin56 1>;
	};
};

***

Gets a bit cumbersome (for me) when using ANSI C structs. I remain
unconvinced about ANSI C being a good place for storing such data.

Maybe I'm just getting too old & grumpy ;)

struct bcm4908_pinctrl_pin_setup {
	unsigned number;
	unsigned function;
};

static const struct bcm4908_pinctrl_pin_setup led_0_pins[] = {
	{ 0, 3 },
};

static const struct bcm4908_pinctrl_pin_setup led_1_pins[] = {
	{ 0, 3 },
};

static const struct bcm4908_pinctrl_pin_setup nand_pins[] = {
	{ 32, 0 }, { 33, 0 }, { 34, 0 }, { 43, 0 }, { 44, 0 }, { 45, 0 }, { 56, 1 },
};

struct bcm4908_pinctrl_grp {
	const char *name;
	const struct bcm4908_pinctrl_pin_setup *pins;
	const unsigned int num_pins;
};

static const struct bcm4908_pinctrl_grp bcm4908_pinctrl_grps[] = {
	{ "led_0_grp", led_0_pins, ARRAY_SIZE(led_0_pins) },
	{ "led_1_grp", led_1_pins, ARRAY_SIZE(led_1_pins) },
	{ "nand_grp", nand_pins, ARRAY_SIZE(nand_pins) },
};

WARNING: multiple messages have this Message-ID (diff)
From: "Rafał Miłecki" <zajec5@gmail.com>
To: "Rob Herring" <robh@kernel.org>, "Rafał Miłecki" <rafal@milecki.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Tony Lindgren <tony@atomide.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Florian Fainelli <f.fainelli@gmail.com>,
	bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH V3 1/2] dt-bindings: pinctrl: support specifying pins, groups & functions
Date: Tue, 14 Dec 2021 22:50:35 +0100	[thread overview]
Message-ID: <e017f3b3-7ba9-6b5f-e18f-830ab717f026@gmail.com> (raw)
In-Reply-To: <756f55d2-f033-8066-7e51-005e1f0587ec@gmail.com>

On 14.12.2021 21:10, Rafał Miłecki wrote:
> On 14.12.2021 20:59, Rob Herring wrote:
>> On Sat, Dec 11, 2021 at 12:16:25PM +0100, Rafał Miłecki wrote:
>>> Rob: please kindly comment on this idea of storing pins/groups/functions
>>> in DT.
>>
>> I was never a fan of stuffing pin mux/ctrl into DT for what's mostly a
>> one time stuffing of register values. And given how many things run
>> before getting to the kernel, doing proper pin configuration in the
>> kernel is much too late (or redundant because it was actually already
>> done).
> 
> OK, thanks for sharing that. Given a pretty limited optimism on this
> approach I'll simply drop it and do things the old good way.

I feel I need to post one more comment though.

***

What I find a really clean DT code for defining some BCM4908 groups:

groups {
	led_0_grp {
		pins = <&pin0 3>;
	};

	led_1_grp {
		pins = <&pin1 3>;
	};

	nand_grp {
		pins = <&pin32 0>, <&pin33 0>, <&pin34 0>, <&pin43 0>, <&pin44 0>, <&pin45 0>, <&pin56 1>;
	};
};

***

Gets a bit cumbersome (for me) when using ANSI C structs. I remain
unconvinced about ANSI C being a good place for storing such data.

Maybe I'm just getting too old & grumpy ;)

struct bcm4908_pinctrl_pin_setup {
	unsigned number;
	unsigned function;
};

static const struct bcm4908_pinctrl_pin_setup led_0_pins[] = {
	{ 0, 3 },
};

static const struct bcm4908_pinctrl_pin_setup led_1_pins[] = {
	{ 0, 3 },
};

static const struct bcm4908_pinctrl_pin_setup nand_pins[] = {
	{ 32, 0 }, { 33, 0 }, { 34, 0 }, { 43, 0 }, { 44, 0 }, { 45, 0 }, { 56, 1 },
};

struct bcm4908_pinctrl_grp {
	const char *name;
	const struct bcm4908_pinctrl_pin_setup *pins;
	const unsigned int num_pins;
};

static const struct bcm4908_pinctrl_grp bcm4908_pinctrl_grps[] = {
	{ "led_0_grp", led_0_pins, ARRAY_SIZE(led_0_pins) },
	{ "led_1_grp", led_1_pins, ARRAY_SIZE(led_1_pins) },
	{ "nand_grp", nand_pins, ARRAY_SIZE(nand_pins) },
};

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-12-14 21:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10 11:42 [PATCH V3 0/2] dt-bindings: pinctrl: pins, groups & functions Rafał Miłecki
2021-12-10 11:42 ` Rafał Miłecki
2021-12-10 11:42 ` [PATCH V3 1/2] dt-bindings: pinctrl: support specifying " Rafał Miłecki
2021-12-10 11:42   ` Rafał Miłecki
2021-12-10 23:26   ` Linus Walleij
2021-12-10 23:26     ` Linus Walleij
2021-12-11 11:16     ` Rafał Miłecki
2021-12-11 11:16       ` Rafał Miłecki
2021-12-14 19:59       ` Rob Herring
2021-12-14 19:59         ` Rob Herring
2021-12-14 20:10         ` Rafał Miłecki
2021-12-14 20:10           ` Rafał Miłecki
2021-12-14 21:50           ` Rafał Miłecki [this message]
2021-12-14 21:50             ` Rafał Miłecki
2021-12-10 11:42 ` [PATCH V3 2/2] dt-bindings: pinctrl: brcm,ns-pinmux: describe " Rafał Miłecki
2021-12-10 11:42   ` [PATCH V3 2/2] dt-bindings: pinctrl: brcm, ns-pinmux: " Rafał Miłecki
2021-12-10 14:02   ` [PATCH V3 2/2] dt-bindings: pinctrl: brcm,ns-pinmux: " Rob Herring
2021-12-10 14:02     ` [PATCH V3 2/2] dt-bindings: pinctrl: brcm, ns-pinmux: " Rob Herring
2021-12-11  7:07   ` [PATCH V3 2/2] dt-bindings: pinctrl: brcm,ns-pinmux: " Tony Lindgren
2021-12-11  7:07     ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e017f3b3-7ba9-6b5f-e18f-830ab717f026@gmail.com \
    --to=zajec5@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=rafal@milecki.pl \
    --cc=robh@kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.