mbox series

[v3,00/10] Add Actions Semi S900 pinctrl and gpio support

Message ID 20180228181432.26847-1-manivannan.sadhasivam@linaro.org
Headers show
Series Add Actions Semi S900 pinctrl and gpio support | expand

Message

Manivannan Sadhasivam Feb. 28, 2018, 6:14 p.m. UTC
This patchset adds pinctrl and gpio support for Actions Semi S900 SoC.
Pinctrl and gpio subsystems share the common set of register range but
implemented as individual drivers for making it less complex.

Pinmux functions are only accessible for pin groups while pinconf
parameters are available for both pin groups and individual pins.

gpio-line-names has been added for the Bubblegum-96 board matching the
96Boards CE specification v1.0.

Both pinctrl and gpio drivers are verified using the Bubblegum-96 board.

This patchset depends on the clock driver which is still under review:
https://lkml.org/lkml/2018/2/9/831

There is also S500 pinctrl and gpio driver developed by Andreas Farber
independently to this patchset.
https://github.com/afaerber/linux/commits/bg96-next

If this patchseries seems to be good enough to add base OWL pinctrl and
gpio support. Then, we may decide on adding S500 support on top of this later
by reusing the pinctrl definitions from Andreas.

Thanks,
Mani

Changes in v3:

* Simplified owl_gpio_set_reg() with _relaxed functions
* Added interrupt controller properties to gpio node bindings as suggested
  by Rob
* Minor code cleanups

Changes in v2:

* Implemented each GPIO bank as its own gpio-controller
* Added gpio-ranges property
* Modified pin group to follow pad names instead of register names
* Incorporated review comments from Andy
* Incorporated review comments from Andreas
* Fixed the MODULE_LICENSE with respect to SPDX tag
* Added Reviewed by tag from Rob for pinctrl binding

Manivannan Sadhasivam (10):
  dt-bindings: pinctrl: Add bindings for Actions S900 SoC
  arm64: dts: actions: Add pinctrl node for S900
  arm64: actions: Enable PINCTRL in platforms Kconfig
  pinctrl: actions: Add Actions S900 pinctrl driver
  dt-bindings: gpio: Add gpio nodes for Actions S900 SoC
  arm64: dts: actions: Add S900 gpio nodes
  arm64: dts: actions: Add gpio line names to Bubblegum-96 board
  gpio: Add gpio driver for Actions OWL S900 SoC
  MAINTAINERS: Add reviewer for ACTIONS platforms
  MAINTAINERS: Add Actions Semi S900 pinctrl and gpio entries

 .../devicetree/bindings/gpio/actions,owl-gpio.txt  |   95 +
 .../bindings/pinctrl/actions,s900-pinctrl.txt      |  178 ++
 MAINTAINERS                                        |    5 +
 arch/arm64/Kconfig.platforms                       |    1 +
 arch/arm64/boot/dts/actions/s900-bubblegum-96.dts  |  201 ++
 arch/arm64/boot/dts/actions/s900.dtsi              |   54 +
 drivers/gpio/Kconfig                               |    8 +
 drivers/gpio/Makefile                              |    1 +
 drivers/gpio/gpio-owl.c                            |  218 ++
 drivers/pinctrl/Kconfig                            |    1 +
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/actions/Kconfig                    |   12 +
 drivers/pinctrl/actions/Makefile                   |    2 +
 drivers/pinctrl/actions/pinctrl-owl.c              |  571 +++++
 drivers/pinctrl/actions/pinctrl-owl.h              |  142 ++
 drivers/pinctrl/actions/pinctrl-s900.c             | 2505 ++++++++++++++++++++
 16 files changed, 3995 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/actions,owl-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/actions,s900-pinctrl.txt
 create mode 100644 drivers/gpio/gpio-owl.c
 create mode 100644 drivers/pinctrl/actions/Kconfig
 create mode 100644 drivers/pinctrl/actions/Makefile
 create mode 100644 drivers/pinctrl/actions/pinctrl-owl.c
 create mode 100644 drivers/pinctrl/actions/pinctrl-owl.h
 create mode 100644 drivers/pinctrl/actions/pinctrl-s900.c

-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Andy Shevchenko Feb. 28, 2018, 6:36 p.m. UTC | #1
On Wed, Feb 28, 2018 at 8:14 PM, Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
> Add pinctrl driver for Actions Semi S900 SoC. The driver supports

> pinctrl, pinmux and pinconf functionalities through a range of registers

> common to both gpio driver and pinctrl driver.

>

> Pinmux functionality is available only for the pin groups while the

> pinconf functionality is available for both pin groups and individual

> pins.


> +static int owl_set_mux(struct pinctrl_dev *pctrldev,

> +                               unsigned int function,

> +                               unsigned int group)

> +{


> +       mfpval = readl(pctrl->base + g->mfpctl_reg);

> +       mfpval &= ~mask;

> +       mfpval |= val;

> +       writel(mfpval, pctrl->base + g->mfpctl_reg);


This is called owl_update_bits().

> +static int owl_pin_config_set(struct pinctrl_dev *pctrldev,

> +                               unsigned int pin,

> +                               unsigned long *configs,

> +                               unsigned int num_configs)

> +{


> +       int ret = 0;


Redundant assignment?

> +               mask = (1 << width) - 1;

> +               mask = mask << bit;

> +               tmp = readl(pctrl->base + reg);

> +               tmp &= ~mask;

> +               tmp |= arg << bit;

> +               writel(tmp, pctrl->base + reg);


This is called owl_update_bits().

> +}


> +static int owl_group_pinconf_val2arg(const struct owl_pingroup *g,

> +                               unsigned int param,

> +                               u32 *arg)

> +{


> +       case PIN_CONFIG_SLEW_RATE:

> +               if (*arg)

> +                       *arg = 1;

> +               else

> +                       *arg = 0;


Doesn't slew rate allow a non-binary value?

> +       return 0;

> +}

> +

> +static int owl_group_config_get(struct pinctrl_dev *pctrldev,

> +                               unsigned int group,

> +                               unsigned long *config)

> +{

> +       int ret = 0;


Redundant assignment.

> +}


> +static int owl_group_config_set(struct pinctrl_dev *pctrldev,

> +                               unsigned int group,

> +                               unsigned long *configs,

> +                               unsigned int num_configs)

> +{

> +       int ret = 0;


Redundant assignment, see below.

> +               mask = (1 << width) - 1;

> +               mask = mask << bit;

> +               tmp = readl(pctrl->base + reg);

> +               tmp &= ~mask;

> +               tmp |= arg << bit;

> +               writel(tmp, pctrl->base + reg);


This is called owl_update_bits().

> +       return ret;


return 0; ?

> +}


> +int owl_pinctrl_probe(struct platform_device *pdev,

> +                               struct owl_pinctrl_soc_data *soc_data)

> +{


> +       clk_prepare_enable(pctrl->clk);


This can fail.

> +}


> +static const struct of_device_id s900_pinctrl_of_match[] = {

> +       { .compatible = "actions,s900-pinctrl", },


> +       { },


No comma needed.

> +};


-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Manivannan Sadhasivam March 1, 2018, 9:25 a.m. UTC | #2
Hi Linus,
On Thu, Mar 01, 2018 at 10:20:29AM +0100, Linus Walleij wrote:
> On Wed, Feb 28, 2018 at 7:14 PM, Manivannan Sadhasivam

> <manivannan.sadhasivam@linaro.org> wrote:

> 

> > Add pinctrl bindings for Actions Semi S900 SoC

> >

> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

> 

> The previous (v2) version had Rob's Review tag, did you just forget

> to add it or has something changed?

> 


My bad. Slipped through the cracks.

> If nothing is changed I can add his tag when applying.

>


I will send out a new version of the whole series, incorporating Andy's
pinctrl driver review.

Also, FYI this pacthseries depends on Clock driver patchset I have submitted
earlier. So far no reply from Stephen yet. He said that he is working on setting
up his new environment and will begin reviewing shortly.

Thanks,
Mani 
> Yours,

> Linus Walleij

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html