From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: "Théo Lebrun" <theo.lebrun@bootlin.com>,
"Gregory CLEMENT" <gregory.clement@bootlin.com>,
"Michael Turquette" <mturquette@baylibre.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Rafał Miłecki" <rafal@milecki.pl>,
"Philipp Zabel" <p.zabel@pengutronix.de>
Cc: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>,
linux-mips@vger.kernel.org, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Tawfik Bayouk <tawfik.bayouk@mobileye.com>,
linux-gpio@vger.kernel.org
Subject: Re: [PATCH v3 10/17] pinctrl: eyeq5: add platform driver
Date: Wed, 24 Jan 2024 08:03:52 +0100 [thread overview]
Message-ID: <5e06d14a-baa7-4e18-a731-6621e623565f@linaro.org> (raw)
In-Reply-To: <20240123-mbly-clk-v3-10-392b010b8281@bootlin.com>
On 23/01/2024 19:46, Théo Lebrun wrote:
> Add the Mobileye EyeQ5 pin controller driver. It might grow to add later
> support of other platforms from Mobileye. It belongs to a syscon region
> called OLB.
>
> Existing pins and their function live statically in the driver code
> rather than in the devicetree, see compatible match data.
>
...
> +static int eq5p_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct device_node *np = dev->of_node;
> + struct device_node *parent_np = of_get_parent(np);
> + const struct eq5p_match *match = of_device_get_match_data(dev);
> + struct pinctrl_dev *pctldev;
> + struct eq5p_pinctrl *pctrl;
> + int ret;
> +
> + pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL);
> + if (!pctrl)
> + return -ENOMEM;
> +
> + pctrl->olb = ERR_PTR(-ENODEV);
> + if (parent_np)
> + pctrl->olb = syscon_node_to_regmap(parent_np);
> + if (IS_ERR(pctrl->olb))
> + pctrl->olb = syscon_regmap_lookup_by_phandle(np, "mobileye,olb");
> + if (IS_ERR(pctrl->olb))
> + return PTR_ERR(pctrl->olb);
No, we talked about this, you got comments on this. There is no
mobileye,olb. You cannot have undocumented properties.
> +
> + pctrl->regs = match->regs;
> + pctrl->funcs = match->funcs;
> + pctrl->nfuncs = match->nfuncs;
> +
> + pctrl->desc.name = dev_name(dev);
> + pctrl->desc.pins = match->pins;
> + pctrl->desc.npins = match->npins;
> + pctrl->desc.pctlops = &eq5p_pinctrl_ops;
> + pctrl->desc.pmxops = &eq5p_pinmux_ops;
> + pctrl->desc.confops = &eq5p_pinconf_ops;
> + pctrl->desc.owner = THIS_MODULE;
> +
> + ret = devm_pinctrl_register_and_init(dev, &pctrl->desc, pctrl, &pctldev);
> + if (ret) {
> + dev_err(dev, "Failed registering pinctrl device: %d\n", ret);
> + return ret;
> + }
> +
> + ret = pinctrl_enable(pctldev);
> + if (ret) {
> + dev_err(dev, "Failed enabling pinctrl device: %d\n", ret);
> + return ret;
> + }
> +
> + dev_info(dev, "probed\n");
I am pretty sure you got comments for these. Drop such debugs from all
of your code. Current and future.
> +
> + return 0;
> +}
> +
> +static const struct eq5p_match eq5p_match_a = {
> + .regs = {
> + [EQ5P_PD] = 0x0C0,
> + [EQ5P_PU] = 0x0C4,
> + [EQ5P_DS_LOW] = 0x0D0,
> + [EQ5P_DS_HIGH] = 0x0D4,
> + [EQ5P_IOCR] = 0x0B0,
> + },
> + .pins = eq5p_pins_a,
> + .npins = ARRAY_SIZE(eq5p_pins_a),
> + .funcs = eq5p_functions_a,
> + .nfuncs = ARRAY_SIZE(eq5p_functions_a),
> +};
> +
> +static const struct eq5p_match eq5p_match_b = {
> + .regs = {
> + [EQ5P_PD] = 0x0C8,
> + [EQ5P_PU] = 0x0CC,
> + [EQ5P_DS_LOW] = 0x0D8,
> + [EQ5P_DS_HIGH] = 0x0DC,
> + [EQ5P_IOCR] = 0x0B4,
> + },
> + .pins = eq5p_pins_b,
> + .npins = ARRAY_SIZE(eq5p_pins_b),
> + .funcs = eq5p_functions_b,
> + .nfuncs = ARRAY_SIZE(eq5p_functions_b),
> +};
> +
> +static const struct of_device_id eq5p_match[] = {
> + { .compatible = "mobileye,eyeq5-a-pinctrl", .data = &eq5p_match_a },
> + { .compatible = "mobileye,eyeq5-b-pinctrl", .data = &eq5p_match_b },
> + {},
> +};
> +
> +static struct platform_driver eq5p_driver = {
> + .driver = {
> + .name = "eyeq5-pinctrl",
> + .of_match_table = eq5p_match,
> + },
> + .probe = eq5p_probe,
> +};
> +
> +static int __init eq5p_init(void)
> +{
> + return platform_driver_register(&eq5p_driver);
> +}
> +core_initcall(eq5p_init);
No, pins are not a core_initcall. This could be arch_initcall, but
considering you depend on the parent this must be module driver.
Even from this dependency point of view your initcalls are totally wrong
and will lead to issues.
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-01-24 7:03 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 18:46 [PATCH v3 00/17] Add support for Mobileye EyeQ5 system controller Théo Lebrun
2024-01-23 18:46 ` [PATCH v3 01/17] clk: fixed-factor: add optional accuracy support Théo Lebrun
2024-01-23 18:46 ` [PATCH v3 02/17] clk: fixed-factor: add fwname-based constructor functions Théo Lebrun
2024-01-23 18:46 ` [PATCH v3 03/17] dt-bindings: pinctrl: allow pin controller device without unit address Théo Lebrun
2024-01-23 20:57 ` Rob Herring
2024-01-23 18:46 ` [PATCH v3 04/17] dt-bindings: soc: mobileye: add EyeQ5 OLB system controller Théo Lebrun
2024-01-23 20:58 ` Rob Herring
2024-01-24 15:14 ` Rob Herring
2024-01-24 17:28 ` Théo Lebrun
2024-01-24 17:40 ` Théo Lebrun
2024-01-24 19:22 ` Rob Herring
2024-01-25 11:40 ` Théo Lebrun
2024-01-26 11:52 ` Krzysztof Kozlowski
2024-01-26 12:28 ` Théo Lebrun
2024-01-26 14:54 ` Krzysztof Kozlowski
2024-01-25 7:51 ` Krzysztof Kozlowski
2024-01-25 11:01 ` Théo Lebrun
2024-01-25 14:33 ` Andrew Davis
2024-01-25 14:49 ` Théo Lebrun
2024-01-25 15:11 ` Andrew Davis
2024-01-26 11:51 ` Krzysztof Kozlowski
2024-01-23 18:46 ` [PATCH v3 05/17] dt-bindings: clock: mobileye,eyeq5-clk: add bindings Théo Lebrun
2024-01-24 6:45 ` Krzysztof Kozlowski
2024-01-23 18:46 ` [PATCH v3 06/17] dt-bindings: reset: mobileye,eyeq5-reset: " Théo Lebrun
2024-01-24 6:47 ` Krzysztof Kozlowski
2024-01-23 18:46 ` [PATCH v3 07/17] dt-bindings: pinctrl: mobileye,eyeq5-pinctrl: " Théo Lebrun
2024-01-24 6:52 ` Krzysztof Kozlowski
2024-01-23 18:46 ` [PATCH v3 08/17] clk: eyeq5: add platform driver Théo Lebrun
2024-01-24 7:05 ` Krzysztof Kozlowski
2024-01-24 16:41 ` Théo Lebrun
2024-01-25 7:46 ` Krzysztof Kozlowski
2024-01-25 11:53 ` Théo Lebrun
2024-01-26 11:56 ` Krzysztof Kozlowski
2024-01-23 18:46 ` [PATCH v3 09/17] reset: " Théo Lebrun
2024-01-24 7:00 ` Krzysztof Kozlowski
2024-01-24 16:52 ` Théo Lebrun
2024-01-24 10:54 ` Philipp Zabel
2024-01-24 17:07 ` Théo Lebrun
2024-01-23 18:46 ` [PATCH v3 10/17] pinctrl: " Théo Lebrun
2024-01-24 7:03 ` Krzysztof Kozlowski [this message]
2024-01-24 16:55 ` Théo Lebrun
2024-01-24 15:19 ` Rob Herring
2024-01-24 17:31 ` Théo Lebrun
2024-01-23 18:46 ` [PATCH v3 11/17] MIPS: mobileye: eyeq5: rename olb@e00000 to system-controller@e00000 Théo Lebrun
2024-01-23 18:46 ` [PATCH v3 12/17] MIPS: mobileye: eyeq5: remove reg-io-width property from OLB syscon Théo Lebrun
2024-01-24 8:33 ` Sergei Shtylyov
2024-01-24 16:56 ` Théo Lebrun
2024-01-23 18:46 ` [PATCH v3 13/17] MIPS: mobileye: eyeq5: use OLB clocks controller Théo Lebrun
2024-01-23 18:46 ` [PATCH v3 14/17] MIPS: mobileye: eyeq5: add OLB reset controller node Théo Lebrun
2024-01-23 18:47 ` [PATCH v3 15/17] MIPS: mobileye: eyeq5: add reset properties to uarts Théo Lebrun
2024-01-23 18:47 ` [PATCH v3 16/17] MIPS: mobileye: eyeq5: add pinctrl nodes & pinmux function nodes Théo Lebrun
2024-01-23 18:47 ` [PATCH v3 17/17] MIPS: mobileye: eyeq5: add pinctrl properties to UART nodes Théo Lebrun
2024-01-24 6:43 ` [PATCH v3 00/17] Add support for Mobileye EyeQ5 system controller Krzysztof Kozlowski
2024-01-24 16:44 ` Théo Lebrun
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=5e06d14a-baa7-4e18-a731-6621e623565f@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregory.clement@bootlin.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=rafal@milecki.pl \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=tawfik.bayouk@mobileye.com \
--cc=theo.lebrun@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=tsbogend@alpha.franken.de \
--cc=vladimir.kondratiev@mobileye.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox