[U-Boot] [PATCH v2 1/6] sunxi: add pinctrl (UCLASS_PINCTRL) support for sunxi

Maxime Ripard maxime.ripard at free-electrons.com
Thu Feb 23 18:10:31 UTC 2017


On Thu, Feb 23, 2017 at 11:54:15AM +0800, Chen-Yu Tsai wrote:
> On Thu, Feb 23, 2017 at 7:18 AM, Maxime Ripard
> <maxime.ripard at free-electrons.com> wrote:
> > On Wed, Feb 22, 2017 at 09:47:27PM +0100, Philipp Tomsich wrote:
> >> This change adds a full device-model pinctrl driver for sunxi (tested with
> >> sun50iw1p1) based on the support available in Linux.
> >>
> >> Details are:
> >>  * implements a driver for pinctrl devices and assigns sun50i-a64-pinctrl
> >>    and sun50i-a64-r-pinctrl to it
> >>  * dynamically creates the driver_data for a sunxi_gpio (see sunxi_gpio.c)
> >>    driver and binds it to the same device-tree node
> >>  * lifts and reuses the pinctrl-sunxi.h and pinctrl-sun50i-a64.c files from
> >>    Linux (thanks to Maxime and Andre) and adds a pinctrl-sun50i-a64-r.c (to
> >>    be picked up for inclusion into Linux again)
> >>
> >> Signed-off-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
> >> ---
> >>  arch/arm/include/asm/arch-sunxi/gpio-internal.h    |  19 +
> >>  .../pinctrl/allwinner,pinctrl.txt                  |  65 +++
> >>  drivers/gpio/sunxi_gpio.c                          |  15 +-
> >>  drivers/pinctrl/Kconfig                            |  10 +
> >>  drivers/pinctrl/Makefile                           |   2 +
> >>  drivers/pinctrl/sunxi/Makefile                     |  10 +
> >>  drivers/pinctrl/sunxi/pinctrl-sun50i-a64-r.c       |  92 ++++
> >>  drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c         | 577 +++++++++++++++++++++
> >>  drivers/pinctrl/sunxi/pinctrl-sunxi.c              | 317 +++++++++++
> >>  drivers/pinctrl/sunxi/pinctrl-sunxi.h              | 311 +++++++++++
> >>  10 files changed, 1411 insertions(+), 7 deletions(-)
> >>  create mode 100644 arch/arm/include/asm/arch-sunxi/gpio-internal.h
> >>  create mode 100644 doc/device-tree-bindings/pinctrl/allwinner,pinctrl.txt
> >>  create mode 100644 drivers/pinctrl/sunxi/Makefile
> >>  create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun50i-a64-r.c
> >>  create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c
> >>  create mode 100644 drivers/pinctrl/sunxi/pinctrl-sunxi.c
> >>  create mode 100644 drivers/pinctrl/sunxi/pinctrl-sunxi.h
> >>
> >> diff --git a/arch/arm/include/asm/arch-sunxi/gpio-internal.h b/arch/arm/include/asm/arch-sunxi/gpio-internal.h
> >> new file mode 100644
> >> index 0000000..4dcdd34
> >> --- /dev/null
> >> +++ b/arch/arm/include/asm/arch-sunxi/gpio-internal.h
> >> @@ -0,0 +1,19 @@
> >> +/*
> >> + * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
> >> + *
> >> + * SPDX-License-Identifier:  GPL-2.0+
> >> + */
> >> +
> >> +
> >> +#ifndef _SUNXI_GPIO_INTERNAL_H
> >> +#define _SUNXI_GPIO_INTERNAL_H
> >> +
> >> +/* This data structure is shared between the sunxi_gpio driver and
> >> + * the sunxi_pinctrl driver.
> >> + */
> >> +struct sunxi_gpio_soc_data {
> >> +     int start;
> >> +     int no_banks;
> >> +};
> >> +
> >> +#endif
> >> diff --git a/doc/device-tree-bindings/pinctrl/allwinner,pinctrl.txt b/doc/device-tree-bindings/pinctrl/allwinner,pinctrl.txt
> >> new file mode 100644
> >> index 0000000..946831f
> >> --- /dev/null
> >> +++ b/doc/device-tree-bindings/pinctrl/allwinner,pinctrl.txt
> >> @@ -0,0 +1,65 @@
> >> +* Allwinner Pinmux Controller
> >> +
> >> +Allwinner integrates multiple banks (of 32 pins each) of pin-muxing,
> >> +GPIO functionality and (optional) external interrupt functionality
> >> +into a single controller.
> >> +
> >> +For each configurable pad (certain driver-cells, such as the IO from
> >> +integrated USB PHYs or DRAM, have a fixed function and can not be
> >> +configured), the muxing options (input, output or one of the several
> >> +functions) can be selected.
> >> +
> >> +Properties for the pinctrl node:
> >> + - compatible: should be "allwinner,sun50i-pinctrl"
> >
> > There's a typo here, the compatible is sun50i-a64-pinctrl
> >
> >> + - reg: address and length of the register set for the device.
> >> + - interrupts: interrupt for the device
> >> + - clocks: A phandle to the reference clock for this device
> >
> > (and ideally, this would take three clocks: the bus gate + the two
> > oscillators).
> >
> >> +
> >> +Properties for the pinconfig sub-nodes:
> >> + - allwinner,pins: a list of pins (e.g. "PH2", "PH3") to configure
> >> + - allwinner,function: the name of pinmux function (e.g. "mmc2")
> >
> > allwinner,pins and allwinner,function are also deprecated in favour of
> > pins and function.
> >
> >> + - drive-strength: a drive-stength setting of 10, 20, 30 or 40 mA
> >> + - bias-pull-up
> >> + - bias-pull-down
> >> + - bias-disable (default)
> >
> > The default is not bias-disable, but to keep the current configuration
> 
> Shouldn't we just copy the binding docs from the Linux kernel?
> Afterall they are supposed to be the same.

Yep, that would probably be the easiest.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170223/ccf5b85f/attachment-0001.sig>


More information about the U-Boot mailing list