Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1645729 > unrolled thread

[PATCH 7/9] pinctrl: mvebu: add driver for Armada AP806 pinctrl

Started byGregory CLEMENT <gregory.clement@free-electrons.com>
First post2017-05-19 18:10 +0200
Last post2017-05-22 16:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 7/9] pinctrl: mvebu: add driver for Armada AP806 pinctrl Gregory CLEMENT <gregory.clement@free-electrons.com> - 2017-05-19 18:10 +0200
    Re: [PATCH 7/9] pinctrl: mvebu: add driver for Armada AP806 pinctrl Paul Gortmaker <paul.gortmaker@windriver.com> - 2017-05-20 21:10 +0200
      Re: [PATCH 7/9] pinctrl: mvebu: add driver for Armada AP806 pinctrl Gregory CLEMENT <gregory.clement@free-electrons.com> - 2017-05-22 16:40 +0200

#1645729 — [PATCH 7/9] pinctrl: mvebu: add driver for Armada AP806 pinctrl

FromGregory CLEMENT <gregory.clement@free-electrons.com>
Date2017-05-19 18:10 +0200
Subject[PATCH 7/9] pinctrl: mvebu: add driver for Armada AP806 pinctrl
Message-ID<tISDw-4BS-33@gated-at.bofh.it>
From: Hanna Hawa <hannah@marvell.com>

This commit adds a pinctrl driver for the pin-muxing controller found in
the AP806 part of the Marvell Armada 7K and 8K SoCs. Its register
interface is compatible with the one used by previous mvebu pin
controllers, so the common logic in drivers/pinctrl/mvebu/pinctrl-mvebu.c
is used.

Signed-off-by: Hanna Hawa <hannah@marvell.com>
Reviewed-by: Shadi Ammouri <shadi@marvell.com>
[updated for mvebu pinctrl changes
 - converted to simple_mmio
 - removed unimplemented .remove function
 - removed DTS description
  - converted  to use syscon/regmap
 --rmk]
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 drivers/pinctrl/mvebu/Kconfig                |   4 +-
 drivers/pinctrl/mvebu/Makefile               |   1 +-
 drivers/pinctrl/mvebu/pinctrl-armada-ap806.c | 145 ++++++++++++++++++++-
 3 files changed, 150 insertions(+)
 create mode 100644 drivers/pinctrl/mvebu/pinctrl-armada-ap806.c

diff --git a/drivers/pinctrl/mvebu/Kconfig b/drivers/pinctrl/mvebu/Kconfig
index 8cb444b60ae9..0e0b009f2b71 100644
--- a/drivers/pinctrl/mvebu/Kconfig
+++ b/drivers/pinctrl/mvebu/Kconfig
@@ -28,6 +28,10 @@ config PINCTRL_ARMADA_39X
 	bool
 	select PINCTRL_MVEBU
 
+config PINCTRL_ARMADA_AP806
+	bool
+	select PINCTRL_MVEBU
+
 config PINCTRL_ARMADA_XP
 	bool
 	select PINCTRL_MVEBU
diff --git a/drivers/pinctrl/mvebu/Makefile b/drivers/pinctrl/mvebu/Makefile
index 60c245a60f39..455db274b53d 100644
--- a/drivers/pinctrl/mvebu/Makefile
+++ b/drivers/pinctrl/mvebu/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_PINCTRL_ARMADA_370) += pinctrl-armada-370.o
 obj-$(CONFIG_PINCTRL_ARMADA_375) += pinctrl-armada-375.o
 obj-$(CONFIG_PINCTRL_ARMADA_38X) += pinctrl-armada-38x.o
 obj-$(CONFIG_PINCTRL_ARMADA_39X) += pinctrl-armada-39x.o
+obj-$(CONFIG_PINCTRL_ARMADA_AP806) += pinctrl-armada-ap806.o
 obj-$(CONFIG_PINCTRL_ARMADA_XP)  += pinctrl-armada-xp.o
 obj-$(CONFIG_PINCTRL_ARMADA_37XX)  += pinctrl-armada-37xx.o
 obj-$(CONFIG_PINCTRL_ORION)  += pinctrl-orion.o
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-ap806.c b/drivers/pinctrl/mvebu/pinctrl-armada-ap806.c
new file mode 100644
index 000000000000..269b1c1f53b1
--- /dev/null
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-ap806.c
@@ -0,0 +1,145 @@
+/*
+ * Marvell Armada ap806 pinctrl driver based on mvebu pinctrl core
+ *
+ * Copyright (C) 2017 Marvell
+ *
+ * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ * Hanna Hawa <hannah@marvell.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/pinctrl/pinctrl.h>
+
+#include "pinctrl-mvebu.h"
+
+static struct mvebu_mpp_mode armada_ap806_mpp_modes[] = {
+	MPP_MODE(0,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "clk"),
+		 MPP_FUNCTION(3, "spi0",    "clk")),
+	MPP_MODE(1,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "cmd"),
+		 MPP_FUNCTION(3, "spi0",    "miso")),
+	MPP_MODE(2,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "d0"),
+		 MPP_FUNCTION(3, "spi0",    "mosi")),
+	MPP_MODE(3,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "d1"),
+		 MPP_FUNCTION(3, "spi0",    "cs0n")),
+	MPP_MODE(4,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "d2"),
+		 MPP_FUNCTION(3, "i2c0",    "sda")),
+	MPP_MODE(5,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "d3"),
+		 MPP_FUNCTION(3, "i2c0",    "sdk")),
+	MPP_MODE(6,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "ds")),
+	MPP_MODE(7,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "d4"),
+		 MPP_FUNCTION(3, "uart1",   "rxd")),
+	MPP_MODE(8,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "d5"),
+		 MPP_FUNCTION(3, "uart1",   "txd")),
+	MPP_MODE(9,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "d6"),
+		 MPP_FUNCTION(3, "spi0",    "cs1n")),
+	MPP_MODE(10,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "d7")),
+	MPP_MODE(11,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(3, "uart0",   "txd")),
+	MPP_MODE(12,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(1, "sdio",    "pw_off"),
+		 MPP_FUNCTION(2, "sdio",    "hw_rst")),
+	MPP_MODE(13,
+		 MPP_FUNCTION(0, "gpio",    NULL)),
+	MPP_MODE(14,
+		 MPP_FUNCTION(0, "gpio",    NULL)),
+	MPP_MODE(15,
+		 MPP_FUNCTION(0, "gpio",    NULL)),
+	MPP_MODE(16,
+		 MPP_FUNCTION(0, "gpio",    NULL)),
+	MPP_MODE(17,
+		 MPP_FUNCTION(0, "gpio",    NULL)),
+	MPP_MODE(18,
+		 MPP_FUNCTION(0, "gpio",    NULL)),
+	MPP_MODE(19,
+		 MPP_FUNCTION(0, "gpio",    NULL),
+		 MPP_FUNCTION(3, "uart0",   "rxd"),
+		 MPP_FUNCTION(4, "sdio",    "pw_off")),
+};
+
+static struct mvebu_pinctrl_soc_info armada_ap806_pinctrl_info;
+
+static const struct of_device_id armada_ap806_pinctrl_of_match[] = {
+	{
+		.compatible = "marvell,ap806-pinctrl",
+	},
+	{ },
+};
+
+static const struct mvebu_mpp_ctrl armada_ap806_mpp_controls[] = {
+	MPP_FUNC_CTRL(0, 19, NULL, mvebu_regmap_mpp_ctrl),
+};
+
+static struct pinctrl_gpio_range armada_ap806_mpp_gpio_ranges[] = {
+	MPP_GPIO_RANGE(0,   0,  0, 20),
+};
+
+static int armada_ap806_pinctrl_probe(struct platform_device *pdev)
+{
+	struct mvebu_pinctrl_soc_info *soc = &armada_ap806_pinctrl_info;
+	const struct of_device_id *match =
+		of_match_device(armada_ap806_pinctrl_of_match, &pdev->dev);
+
+	if (!match || !pdev->dev.parent)
+		return -ENODEV;
+
+	soc->variant = 0; /* no variants for Armada AP806 */
+	soc->controls = armada_ap806_mpp_controls;
+	soc->ncontrols = ARRAY_SIZE(armada_ap806_mpp_controls);
+	soc->gpioranges = armada_ap806_mpp_gpio_ranges;
+	soc->ngpioranges = ARRAY_SIZE(armada_ap806_mpp_gpio_ranges);
+	soc->modes = armada_ap806_mpp_modes;
+	soc->nmodes = armada_ap806_mpp_controls[0].npins;
+
+	pdev->dev.platform_data = soc;
+
+	return mvebu_pinctrl_simple_regmap_probe(pdev, pdev->dev.parent, 0);
+}
+
+static struct platform_driver armada_ap806_pinctrl_driver = {
+	.driver = {
+		.name = "armada-ap806-pinctrl",
+		.of_match_table = of_match_ptr(armada_ap806_pinctrl_of_match),
+	},
+	.probe = armada_ap806_pinctrl_probe,
+};
+
+module_platform_driver(armada_ap806_pinctrl_driver);
+
+MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
+MODULE_DESCRIPTION("Marvell Armada ap806 pinctrl driver");
+MODULE_LICENSE("GPL v2");
-- 
git-series 0.9.1

[toc] | [next] | [standalone]


#1646186

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2017-05-20 21:10 +0200
Message-ID<tJhVf-5rT-3@gated-at.bofh.it>
In reply to#1645729
On Fri, May 19, 2017 at 12:04 PM, Gregory CLEMENT
<gregory.clement@free-electrons.com> wrote:
> From: Hanna Hawa <hannah@marvell.com>
>
> This commit adds a pinctrl driver for the pin-muxing controller found in
> the AP806 part of the Marvell Armada 7K and 8K SoCs. Its register
> interface is compatible with the one used by previous mvebu pin
> controllers, so the common logic in drivers/pinctrl/mvebu/pinctrl-mvebu.c
> is used.
>
> Signed-off-by: Hanna Hawa <hannah@marvell.com>
> Reviewed-by: Shadi Ammouri <shadi@marvell.com>
> [updated for mvebu pinctrl changes
>  - converted to simple_mmio
>  - removed unimplemented .remove function
>  - removed DTS description
>   - converted  to use syscon/regmap
>  --rmk]
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> ---
>  drivers/pinctrl/mvebu/Kconfig                |   4 +-
>  drivers/pinctrl/mvebu/Makefile               |   1 +-
>  drivers/pinctrl/mvebu/pinctrl-armada-ap806.c | 145 ++++++++++++++++++++-
>  3 files changed, 150 insertions(+)
>  create mode 100644 drivers/pinctrl/mvebu/pinctrl-armada-ap806.c
>
> diff --git a/drivers/pinctrl/mvebu/Kconfig b/drivers/pinctrl/mvebu/Kconfig
> index 8cb444b60ae9..0e0b009f2b71 100644
> --- a/drivers/pinctrl/mvebu/Kconfig
> +++ b/drivers/pinctrl/mvebu/Kconfig
> @@ -28,6 +28,10 @@ config PINCTRL_ARMADA_39X
>         bool
>         select PINCTRL_MVEBU
>
> +config PINCTRL_ARMADA_AP806
> +       bool
> +       select PINCTRL_MVEBU

If this isn't going to be modular, can we remove all the uses
of module.h and MODULE_ etc.   I've nearly got all of these
cleaned up in pinctrl and it would be nice to not have new
ones creep back in.

Thanks,
Paul.
--

> +
>  config PINCTRL_ARMADA_XP
>         bool
>         select PINCTRL_MVEBU
> diff --git a/drivers/pinctrl/mvebu/Makefile b/drivers/pinctrl/mvebu/Makefile
> index 60c245a60f39..455db274b53d 100644
> --- a/drivers/pinctrl/mvebu/Makefile
> +++ b/drivers/pinctrl/mvebu/Makefile
> @@ -5,6 +5,7 @@ obj-$(CONFIG_PINCTRL_ARMADA_370) += pinctrl-armada-370.o
>  obj-$(CONFIG_PINCTRL_ARMADA_375) += pinctrl-armada-375.o
>  obj-$(CONFIG_PINCTRL_ARMADA_38X) += pinctrl-armada-38x.o
>  obj-$(CONFIG_PINCTRL_ARMADA_39X) += pinctrl-armada-39x.o
> +obj-$(CONFIG_PINCTRL_ARMADA_AP806) += pinctrl-armada-ap806.o
>  obj-$(CONFIG_PINCTRL_ARMADA_XP)  += pinctrl-armada-xp.o
>  obj-$(CONFIG_PINCTRL_ARMADA_37XX)  += pinctrl-armada-37xx.o
>  obj-$(CONFIG_PINCTRL_ORION)  += pinctrl-orion.o
> diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-ap806.c b/drivers/pinctrl/mvebu/pinctrl-armada-ap806.c
> new file mode 100644
> index 000000000000..269b1c1f53b1
> --- /dev/null
> +++ b/drivers/pinctrl/mvebu/pinctrl-armada-ap806.c
> @@ -0,0 +1,145 @@
> +/*
> + * Marvell Armada ap806 pinctrl driver based on mvebu pinctrl core
> + *
> + * Copyright (C) 2017 Marvell
> + *
> + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> + * Hanna Hawa <hannah@marvell.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/io.h>
> +#include <linux/module.h>

[...]

> +module_platform_driver(armada_ap806_pinctrl_driver);
> +
> +MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
> +MODULE_DESCRIPTION("Marvell Armada ap806 pinctrl driver");
> +MODULE_LICENSE("GPL v2");
> --
> git-series 0.9.1

[toc] | [prev] | [next] | [standalone]


#1646987

FromGregory CLEMENT <gregory.clement@free-electrons.com>
Date2017-05-22 16:40 +0200
Message-ID<tJWF4-6Ra-17@gated-at.bofh.it>
In reply to#1646186
Hi Paul,
 
 On sam., mai 20 2017, Paul Gortmaker <paul.gortmaker@windriver.com> wrote:

> On Fri, May 19, 2017 at 12:04 PM, Gregory CLEMENT
> <gregory.clement@free-electrons.com> wrote:
>> From: Hanna Hawa <hannah@marvell.com>
>>
>> This commit adds a pinctrl driver for the pin-muxing controller found in
>> the AP806 part of the Marvell Armada 7K and 8K SoCs. Its register
>> interface is compatible with the one used by previous mvebu pin
>> controllers, so the common logic in drivers/pinctrl/mvebu/pinctrl-mvebu.c
>> is used.
>>
>> Signed-off-by: Hanna Hawa <hannah@marvell.com>
>> Reviewed-by: Shadi Ammouri <shadi@marvell.com>
>> [updated for mvebu pinctrl changes
>>  - converted to simple_mmio
>>  - removed unimplemented .remove function
>>  - removed DTS description
>>   - converted  to use syscon/regmap
>>  --rmk]
>> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
>> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
>> ---
>>  drivers/pinctrl/mvebu/Kconfig                |   4 +-
>>  drivers/pinctrl/mvebu/Makefile               |   1 +-
>>  drivers/pinctrl/mvebu/pinctrl-armada-ap806.c | 145 ++++++++++++++++++++-
>>  3 files changed, 150 insertions(+)
>>  create mode 100644 drivers/pinctrl/mvebu/pinctrl-armada-ap806.c
>>
>> diff --git a/drivers/pinctrl/mvebu/Kconfig b/drivers/pinctrl/mvebu/Kconfig
>> index 8cb444b60ae9..0e0b009f2b71 100644
>> --- a/drivers/pinctrl/mvebu/Kconfig
>> +++ b/drivers/pinctrl/mvebu/Kconfig
>> @@ -28,6 +28,10 @@ config PINCTRL_ARMADA_39X
>>         bool
>>         select PINCTRL_MVEBU
>>
>> +config PINCTRL_ARMADA_AP806
>> +       bool
>> +       select PINCTRL_MVEBU
>
> If this isn't going to be modular, can we remove all the uses
> of module.h and MODULE_ etc.   I've nearly got all of these
> cleaned up in pinctrl and it would be nice to not have new
> ones creep back in.

Indeed it won't be modular, so I will remove it in this driver and the
next one.

Thanks,

Gregory

>
> Thanks,
> Paul.
> --
>
>> +
>>  config PINCTRL_ARMADA_XP
>>         bool
>>         select PINCTRL_MVEBU
>> diff --git a/drivers/pinctrl/mvebu/Makefile b/drivers/pinctrl/mvebu/Makefile
>> index 60c245a60f39..455db274b53d 100644
>> --- a/drivers/pinctrl/mvebu/Makefile
>> +++ b/drivers/pinctrl/mvebu/Makefile
>> @@ -5,6 +5,7 @@ obj-$(CONFIG_PINCTRL_ARMADA_370) += pinctrl-armada-370.o
>>  obj-$(CONFIG_PINCTRL_ARMADA_375) += pinctrl-armada-375.o
>>  obj-$(CONFIG_PINCTRL_ARMADA_38X) += pinctrl-armada-38x.o
>>  obj-$(CONFIG_PINCTRL_ARMADA_39X) += pinctrl-armada-39x.o
>> +obj-$(CONFIG_PINCTRL_ARMADA_AP806) += pinctrl-armada-ap806.o
>>  obj-$(CONFIG_PINCTRL_ARMADA_XP)  += pinctrl-armada-xp.o
>>  obj-$(CONFIG_PINCTRL_ARMADA_37XX)  += pinctrl-armada-37xx.o
>>  obj-$(CONFIG_PINCTRL_ORION)  += pinctrl-orion.o
>> diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-ap806.c b/drivers/pinctrl/mvebu/pinctrl-armada-ap806.c
>> new file mode 100644
>> index 000000000000..269b1c1f53b1
>> --- /dev/null
>> +++ b/drivers/pinctrl/mvebu/pinctrl-armada-ap806.c
>> @@ -0,0 +1,145 @@
>> +/*
>> + * Marvell Armada ap806 pinctrl driver based on mvebu pinctrl core
>> + *
>> + * Copyright (C) 2017 Marvell
>> + *
>> + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> + * Hanna Hawa <hannah@marvell.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> + */
>> +
>> +#include <linux/err.h>
>> +#include <linux/init.h>
>> +#include <linux/io.h>
>> +#include <linux/module.h>
>
> [...]
>
>> +module_platform_driver(armada_ap806_pinctrl_driver);
>> +
>> +MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
>> +MODULE_DESCRIPTION("Marvell Armada ap806 pinctrl driver");
>> +MODULE_LICENSE("GPL v2");
>> --
>> git-series 0.9.1

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web