diff mbox series

[v6,5/5] soc: imx: imx6sx-gpr: Introduce a GPR driver

Message ID 20230522201404.660242-5-festevam@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v6,1/5] PCI: imx6: Use a more specific i.MX6SX GPR compatible | expand

Commit Message

Fabio Estevam May 22, 2023, 8:14 p.m. UTC
From: Fabio Estevam <festevam@denx.de>

The motivation for this imx6sx-gpr driver is to allow describing
the LVDS LDB bridge as a GPR subnode.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v5:
- None.

 drivers/soc/imx/Makefile     |  1 +
 drivers/soc/imx/imx6sx-gpr.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 drivers/soc/imx/imx6sx-gpr.c

Comments

Marek Vasut May 23, 2023, 2:30 a.m. UTC | #1
On 5/22/23 22:14, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> The motivation for this imx6sx-gpr driver is to allow describing
> the LVDS LDB bridge as a GPR subnode.
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---
> Changes since v5:
> - None.
> 
>   drivers/soc/imx/Makefile     |  1 +
>   drivers/soc/imx/imx6sx-gpr.c | 29 +++++++++++++++++++++++++++++
>   2 files changed, 30 insertions(+)
>   create mode 100644 drivers/soc/imx/imx6sx-gpr.c
> 
> diff --git a/drivers/soc/imx/Makefile b/drivers/soc/imx/Makefile
> index a28c44a1f16a..9840d4c41015 100644
> --- a/drivers/soc/imx/Makefile
> +++ b/drivers/soc/imx/Makefile
> @@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_MXC) += soc-imx.o
>   endif
>   obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
>   obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o
> +obj-$(CONFIG_SOC_IMX6SX) += imx6sx-gpr.o
>   obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o
>   obj-$(CONFIG_IMX8M_BLK_CTRL) += imx8m-blk-ctrl.o
>   obj-$(CONFIG_IMX8M_BLK_CTRL) += imx8mp-blk-ctrl.o
> diff --git a/drivers/soc/imx/imx6sx-gpr.c b/drivers/soc/imx/imx6sx-gpr.c
> new file mode 100644
> index 000000000000..7684acbe43ff
> --- /dev/null
> +++ b/drivers/soc/imx/imx6sx-gpr.c
> @@ -0,0 +1,29 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <linux/module.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +
> +static int imx6sx_gpr_probe(struct platform_device *pdev)
> +{
> +	return devm_of_platform_populate(&pdev->dev);
> +}
> +
> +static const struct of_device_id imx6sx_gpr_ids[] = {
> +	{ .compatible = "fsl,imx6sx-iomuxc-gpr" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, imx6sx_gpr_ids);
> +
> +static struct platform_driver imx6sx_gpr_driver = {
> +	.driver = {
> +		.name	= "imx6sx_gpr",
> +		.of_match_table = imx6sx_gpr_ids,
> +	},
> +	.probe = imx6sx_gpr_probe,
> +};
> +module_platform_driver(imx6sx_gpr_driver);

I feel inclined to ask -- do you think this could be something which 
could be added to core code ? It seems very generic.

Thoughts ?
Fabio Estevam May 23, 2023, 11:44 a.m. UTC | #2
On Mon, May 22, 2023 at 11:57 PM Marek Vasut <marex@denx.de> wrote:

> I feel inclined to ask -- do you think this could be something which
> could be added to core code ? It seems very generic.
>
> Thoughts ?

Yes, I think I can work on a more generic solution after this series gets in.

Just wanted to avoid it as a hard requirement right now, if you agree.
Marek Vasut May 23, 2023, 12:57 p.m. UTC | #3
On 5/23/23 13:44, Fabio Estevam wrote:
> On Mon, May 22, 2023 at 11:57 PM Marek Vasut <marex@denx.de> wrote:
> 
>> I feel inclined to ask -- do you think this could be something which
>> could be added to core code ? It seems very generic.
>>
>> Thoughts ?
> 
> Yes, I think I can work on a more generic solution after this series gets in.
> 
> Just wanted to avoid it as a hard requirement right now, if you agree.

It might be simple to add this functionality to the core, could you 
please take a quick look ?

Also, I might be wrong, so let's see what others think too.
Fabio Estevam May 23, 2023, 9:13 p.m. UTC | #4
Hi Marek,

On Tue, May 23, 2023 at 10:32 AM Marek Vasut <marex@denx.de> wrote:

> It might be simple to add this functionality to the core, could you
> please take a quick look ?

If I do the following change:

--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -842,7 +842,7 @@ iomuxc: pinctrl@20e0000 {
                        };

                        gpr: syscon@20e4000 {
-                               compatible = "fsl,imx6sx-iomuxc-gpr", "syscon";
+                               compatible = "fsl,imx6sx-iomuxc-gpr",
"syscon", "simple-mfd";
                                #address-cells = <1>;
                                #size-cells = <1>;
                                reg = <0x020e4000 0x4000>;

Then I can get rid of this drivers/soc/imx/imx6sx-gpr.c completely.

Would you agree with this approach?
Marek Vasut May 23, 2023, 11:30 p.m. UTC | #5
On 5/23/23 23:13, Fabio Estevam wrote:
> Hi Marek,

Hi,

> On Tue, May 23, 2023 at 10:32 AM Marek Vasut <marex@denx.de> wrote:
> 
>> It might be simple to add this functionality to the core, could you
>> please take a quick look ?
> 
> If I do the following change:
> 
> --- a/arch/arm/boot/dts/imx6sx.dtsi
> +++ b/arch/arm/boot/dts/imx6sx.dtsi
> @@ -842,7 +842,7 @@ iomuxc: pinctrl@20e0000 {
>                          };
> 
>                          gpr: syscon@20e4000 {
> -                               compatible = "fsl,imx6sx-iomuxc-gpr", "syscon";
> +                               compatible = "fsl,imx6sx-iomuxc-gpr",
> "syscon", "simple-mfd";
>                                  #address-cells = <1>;
>                                  #size-cells = <1>;
>                                  reg = <0x020e4000 0x4000>;
> 
> Then I can get rid of this drivers/soc/imx/imx6sx-gpr.c completely.
> 
> Would you agree with this approach?

Wasn't this already rejected by Krzysztof ?
Fabio Estevam May 23, 2023, 11:41 p.m. UTC | #6
On Tue, May 23, 2023 at 8:36 PM Marek Vasut <marex@denx.de> wrote:

> Wasn't this already rejected by Krzysztof ?

No, it was 'simple-bus' that was rejected.
diff mbox series

Patch

diff --git a/drivers/soc/imx/Makefile b/drivers/soc/imx/Makefile
index a28c44a1f16a..9840d4c41015 100644
--- a/drivers/soc/imx/Makefile
+++ b/drivers/soc/imx/Makefile
@@ -4,6 +4,7 @@  obj-$(CONFIG_ARCH_MXC) += soc-imx.o
 endif
 obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
 obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o
+obj-$(CONFIG_SOC_IMX6SX) += imx6sx-gpr.o
 obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o
 obj-$(CONFIG_IMX8M_BLK_CTRL) += imx8m-blk-ctrl.o
 obj-$(CONFIG_IMX8M_BLK_CTRL) += imx8mp-blk-ctrl.o
diff --git a/drivers/soc/imx/imx6sx-gpr.c b/drivers/soc/imx/imx6sx-gpr.c
new file mode 100644
index 000000000000..7684acbe43ff
--- /dev/null
+++ b/drivers/soc/imx/imx6sx-gpr.c
@@ -0,0 +1,29 @@ 
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+
+static int imx6sx_gpr_probe(struct platform_device *pdev)
+{
+	return devm_of_platform_populate(&pdev->dev);
+}
+
+static const struct of_device_id imx6sx_gpr_ids[] = {
+	{ .compatible = "fsl,imx6sx-iomuxc-gpr" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, imx6sx_gpr_ids);
+
+static struct platform_driver imx6sx_gpr_driver = {
+	.driver = {
+		.name	= "imx6sx_gpr",
+		.of_match_table = imx6sx_gpr_ids,
+	},
+	.probe = imx6sx_gpr_probe,
+};
+module_platform_driver(imx6sx_gpr_driver);
+
+MODULE_AUTHOR("Fabio Estevam <festevam@denx.de>");
+MODULE_DESCRIPTION("NXP i.MX6SX GPR driver");
+MODULE_LICENSE("GPL");