pinctrl: ADI PIN control driver for the GPIO controller on bf54x and bf60x.
PATCH v2 1/3 pinctrl: ADI PIN control driver for the GPIO controller on bf54x and bf60x.
From: Sonic Zhang <[email protected]>
The new ADI GPIO2 controller was introduced since the BF548 and BF60x processors. It differs a lot from the old one on BF5xx processors. So, create a pinctrl driver under pinctrl framework.
- Define gpio ports and gpio interrupt controllers as individual platform devices.
- Register a pinctrl driver for the whole GPIO ports and GPIO interrupt devices.
- Probe pint devices before port devices. Put device instances into respective gpio and pint lists.
- Define peripheral, irq and gpio reservation bit masks for each gpio port as runtime resources.
- Save and restore gpio port and pint status MMRs in syscore PM functions.
- Add peripheral device groups and function data into machine portmux.h.
- Handle peripheral and gpio requests in pinctrl operation functions.
- Demux gpio IRQs via the irq_domain created by each GPIO port.
---
v2-changes:
- Remove unlinke() directive.
--- drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-adi2.c | 1545 ++++++++++++++++++++++++++++ include/linux/platform_data/pinctrl-adi2.h | 38 + 3 files changed, 1584 insertions(+) create mode 100644 drivers/pinctrl/pinctrl-adi2.c create mode 100644 include/linux/platform_data/pinctrl-adi2.h
drivers/pinctrl/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_PINCTRL_AB8500) += pinctrl-ab8500.o obj-$(CONFIG_PINCTRL_AB8540) += pinctrl-ab8540.o obj-$(CONFIG_PINCTRL_AB9540) += pinctrl-ab9540.o obj-$(CONFIG_PINCTRL_AB8505) += pinctrl-ab8505.o +obj-$(CONFIG_PINCTRL_ADI2) += pinctrl-adi2.o obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o obj-$(CONFIG_PINCTRL_IMX) += pinctrl-imx.o
drivers/pinctrl/pinctrl-adi2.c new file +1545 -0
1,545 lines not on this page · raw message
include/linux/platform_data/pinctrl-adi2.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Pinctrl Driver for ADI GPIO2 controller +* +* Copyright 2007-2013 Analog Devices Inc. +* +* Licensed under the GPLv2 or later +*/ + + +#ifndef PINCTRL_ADI2_H +#define PINCTRL_ADI2_H + +#include <linux/io.h> +#include <linux/platform_device.h> + +/** +* struct adi_pinctrl_gpio_platform_data - Pinctrl gpio platform data +* for ADI GPIO2 device. +* +* @port_pin_base: Optional global GPIO index of the GPIO bank. +* 0 means driver decides. +* @port_width: PIN number of the GPIO bank device +* @pint_id: GPIO PINT device id that this GPIO bank should map to. +* @pint_assign: The 32-bit GPIO PINT registers can be divided into 2 parts. A +* GPIO bank can be mapped into either low 16 bits[0] or high 16 +* bits[1] of each PINT register. +* @pint_map: GIOP bank mapping code in PINT device +*/ +struct adi_pinctrl_gpio_platform_data { +unsigned int port_pin_base; +unsigned int port_width; +u8 pinctrl_id; +u8 pint_id; +u8 pint_assign; +u8 pint_map; +}; + +#endif
Signature · 1 line
1.8.2.3
PATCH v2 2/3 blackfin: gpio: Remove none gpio lib code.
From: Sonic Zhang <[email protected]>
- Remove non gpio lib code from blackfin architecture.
- Limit the lagecy blackfin gpio driver to bf5xx processors only.
- Remove unused definition of the pint power functions.
--- arch/blackfin/Kconfig | 7 ++ arch/blackfin/include/asm/gpio.h | 157 +++++---------------------------------- arch/blackfin/kernel/Makefile | 3 +- 3 files changed, 29 insertions(+), 138 deletions(-)
arch/blackfin/Kconfig +7 -0
@@ -52,6 +52,9 @@ config GENERIC_BUG config ZONE_DMA def_bool y +config GENERIC_GPIO + def_bool y + config FORCE_MAX_ZONEORDER int default "14"
@@ -317,6 +320,10 @@ config BF53x depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537) default y +config GPIO_ADI + def_bool y + depends on (BF51x || BF52x || BF53x || BF538 || BF539 || BF561) + config MEM_MT48LC64M4A2FB_7E bool depends on (BFIN533_STAMP)
arch/blackfin/include/asm/gpio.h +20 -137
223 lines not on this page · raw message
arch/blackfin/kernel/Makefile +2 -1
@@ -7,7 +7,7 @@ extra-y := vmlinux.lds obj-y := \ entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \ sys_bfin.o traps.o irqchip.o dma-mapping.o flat.o \ - fixed_code.o reboot.o bfin_gpio.o bfin_dma.o \ + fixed_code.o reboot.o bfin_dma.o \ exception.o dumpstack.o ifeq ($(CONFIG_GENERIC_CLOCKEVENTS),y)
@@ -16,6 +16,7 @@ else obj-y += time.o endif +obj-$(CONFIG_GPIO_ADI) += bfin_gpio.o obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o obj-$(CONFIG_FUNCTION_TRACER) += ftrace-entry.o obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
Signature · 1 line
1.8.2.3
PATCH v2 3/3 blackfin: pinctrl-adi2: Add pin control device groups and function data.
In reply to Sonic ZhangFrom: Sonic Zhang <[email protected]>
Select PINCTRL_ADI2 for bf54x and bf60x by default.
--- arch/blackfin/Kconfig | 7 + arch/blackfin/include/asm/portmux.h | 14 +- arch/blackfin/mach-bf548/include/mach/portmux.h | 595 +++++++++++++++++++++++- arch/blackfin/mach-bf609/include/mach/portmux.h | 477 ++++++++++++++++++- 4 files changed, 1087 insertions(+), 6 deletions(-)
arch/blackfin/Kconfig +7 -0
@@ -324,6 +324,13 @@ config GPIO_ADI def_bool y depends on (BF51x || BF52x || BF53x || BF538 || BF539 || BF561) +config PINCTRL_ADI2 + def_bool y + depends on (BF54x || BF60x) + select PINCTRL + select PINMUX + select IRQ_DOMAIN + config MEM_MT48LC64M4A2FB_7E bool depends on (BFIN533_STAMP)
arch/blackfin/include/asm/portmux.h +12 -2
@@ -17,14 +17,24 @@#define P_MAYSHARE 0x2000#define P_DONTCARE 0x1000 - +#ifdef CONFIG_PINCTRL +#define peripheral_request (per, label) 0 +#define peripheral_free (per) +#define peripheral_request_list (per, label) \ + (pdev ? (IS_ERR(devm_pinctrl_get_select_default(&pdev->dev)) \ + ? -EINVAL : 0) : 0); +#define peripheral_free_list (per) +#else int peripheral_request (unsigned short per,const char *label);void peripheral_free (unsigned short per);int peripheral_request_list (const unsigned short per[],const char *label);void peripheral_free_list (const unsigned short per[]); +#endif -#include <asm/gpio.h> +#include <linux/err.h> +#include <linux/pinctrl/pinctrl.h> #include <mach/portmux.h> +#include <linux/gpio.h> #ifndef P_SPORT2_TFS #define P_SPORT2_TFS P_UNDEF
arch/blackfin/mach-bf548/include/mach/portmux.h +593 -2
605 lines not on this page · raw message
arch/blackfin/mach-bf609/include/mach/portmux.h +475 -2
487 lines not on this page · raw message
Signature · 1 line
1.8.2.3
Quoted 2 lines · Sonic Zhang
v2-changes:
- Removeunlinke()directive.
Fine, but now you also have all my other comments to take care of :-)
Yours,
Linus Walleij