From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/6] sunxi: GPIO: introduce sunxi_gpio_setup_dt_pins()
Date: Mon, 27 Feb 2017 11:07:50 +0100 [thread overview]
Message-ID: <20170227100750.a4vkehnt2os7haei@lukather> (raw)
In-Reply-To: <1488155205-9305-2-git-send-email-andre.przywara@arm.com>
On Mon, Feb 27, 2017 at 12:26:40AM +0000, Andre Przywara wrote:
> Instead of hard-coding GPIO pins used for a certain peripheral, we
> should just use the pinctrl information from the DT.
> The sun8i-emac driver has some simple implementation of that, so
> let's just generalize this and move the code into a more common
> location.
> On the way we add support for the new, generic pinctrl binding now
> used by all Allwinner SoCs.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
> arch/arm/include/asm/arch-sunxi/gpio.h | 4 ++
> arch/arm/mach-sunxi/pinmux.c | 77 ++++++++++++++++++++++++++++++++++
> 2 files changed, 81 insertions(+)
>
> diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
> index 85a4ec3..ba8c661 100644
> --- a/arch/arm/include/asm/arch-sunxi/gpio.h
> +++ b/arch/arm/include/asm/arch-sunxi/gpio.h
> @@ -239,4 +239,8 @@ int axp_gpio_init(void);
> static inline int axp_gpio_init(void) { return 0; }
> #endif
>
> +int sunxi_gpio_parse_pin_name(const char *pin_name);
> +int sunxi_gpio_setup_dt_pins(const void * volatile fdt_blob, int node,
> + const char * mux_name, int mux_sel);
> +
> #endif /* _SUNXI_GPIO_H */
> diff --git a/arch/arm/mach-sunxi/pinmux.c b/arch/arm/mach-sunxi/pinmux.c
> index b026f78..f1e1e8f 100644
> --- a/arch/arm/mach-sunxi/pinmux.c
> +++ b/arch/arm/mach-sunxi/pinmux.c
> @@ -9,6 +9,9 @@
> #include <common.h>
> #include <asm/io.h>
> #include <asm/arch/gpio.h>
> +#include <fdtdec.h>
> +#include <fdt_support.h>
> +#include <dt-bindings/pinctrl/sun4i-a10.h>
>
> void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val)
> {
> @@ -69,3 +72,77 @@ int sunxi_gpio_set_pull(u32 pin, u32 val)
>
> return 0;
> }
> +
> +int sunxi_gpio_parse_pin_name(const char *pin_name)
> +{
> + int pin;
> +
> + if (pin_name[0] != 'P')
> + return -1;
> +
> + if (pin_name[1] < 'A' || pin_name[1] > 'Z')
> + return -1;
> +
> + pin = (pin_name[1] - 'A') << 5;
> + pin += simple_strtol(&pin_name[2], NULL, 10);
> +
> + return pin;
> +}
That function already exists, sunxi_name_to_gpio.
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/20170227/de627360/attachment.sig>
next prev parent reply other threads:[~2017-02-27 10:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 0:26 [U-Boot] [PATCH 0/6] sunxi: update Pine64/A64 DTs Andre Przywara
2017-02-27 0:26 ` [U-Boot] [PATCH 1/6] sunxi: GPIO: introduce sunxi_gpio_setup_dt_pins() Andre Przywara
2017-02-27 3:35 ` Chen-Yu Tsai
2017-02-27 10:07 ` Maxime Ripard [this message]
2017-02-27 11:20 ` Andre Przywara
2017-02-27 0:26 ` [U-Boot] [PATCH 2/6] net: sun8i-emac: use new, generic GPIO setup routine Andre Przywara
2017-02-27 0:26 ` [U-Boot] [PATCH 3/6] sunxi: dts: update sun50i-a64.dtsi from Linux Andre Przywara
2017-02-27 0:26 ` [U-Boot] [PATCH 4/6] sunxi: dts: update Pine64 .dts Andre Przywara
2017-02-27 0:26 ` [U-Boot] [PATCH 5/6] sunxi: dts: remove now obsolete pine64-common.dtsi Andre Przywara
2017-02-27 0:26 ` [U-Boot] [PATCH 6/6] sunxi: dts: add Bananapi M64 .dts Andre Przywara
2017-02-27 3:30 ` [U-Boot] [PATCH 0/6] sunxi: update Pine64/A64 DTs Chen-Yu Tsai
2017-02-27 9:53 ` Andre Przywara
2017-02-27 12:39 ` Chen-Yu Tsai
2017-05-02 10:39 ` Jagan Teki
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=20170227100750.a4vkehnt2os7haei@lukather \
--to=maxime.ripard@free-electrons.com \
--cc=u-boot@lists.denx.de \
/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