Add some TZ1090 SoC infrastructure
Subsystems (4)
v2 cover Add some TZ1090 SoC infrastructure
The Toumaz Xenif TZ1090 SoC (AKA Comet) contains a 2-threaded Linux-capable HTP (Meta 2), and is found in a number of development boards and digital radios, such as the Minimorph Development Platform.
This patchset adds some core infrastructure for the TZ1090, including drivers for the powerdown controller (PDC) irqchip, general/PDC pin controllers, and general/PDC GPIO controllers. It's not yet enough to get the UARTs going (no common clock framework) so JTAG/QEMU with DA TTY is still needed to get a shell.
A QEMU with a Meta frontend and some TZ1090 emulation, and the SoC Technical Reference Manual which documents the registers used by both GPIO drivers and both pin control drivers can be downloaded from the Minimorph SDK (registration of a Minimorph is currently required):
http://imgtec.com/meta_insider/metaflow-sdk.asp
Changes in v2:
There've been plenty of changes since v1 (thanks for all the feedback!) so I think it's time for v2. I believe the only feedback not yet addressed is changing irq-imgpdc driver to use generic irqchip.
- rebased on v3.10-rc2
- removed arch/metag/soc/ directory
- removed arch/metag/include/asm/soc-tz1090/gpio.h
- irq-imgpdc: use cached versions of irq_en and irq_route registers
- irq-imgpdc: switch to using raw_spinlock
- irq-imgpdc: (not had time to switch to generic irqchip yet)
- add drive strength to generic pinconf debugfs output (patch 4)
- add BIAS_BUS_HOLD generic pinconf (patch 5)
- pinctrl-tz1090: switched to generic pinconf (a previous patch adds the BIAS_BUS_HOLD generic pinconf)
- pinctrl-tz1090: changed device tree bindings to more closely match generic pinconf (separate tristate, pull-up, pull-down, bus-hold flags instead of pull=<X>, drive-strength measured in mA)
- pinctrl-tz1090: removed "select" pinconf. Instead pins in a pin group have their own individual pin groups and can be individually muxed. Different pins in same pin mux group muxed to different functions is disallowed. Pin switched to peripheral mode when mux enabled.
- pinctrl-tz1090: make use of BIT() from linux/bitops.h
- pinctrl-tz1090: add a whole bunch of comments
- gpio-tz1090: remove references to Linux flags in dt bindings
- gpio-tz1090: make use of BIT() from linux/bitops.h
- gpio-tz1090: make register accessors inline to match pinctrl
- gpio-tz1090: update gpio-ranges to use 3 cells after recent ABI breakage
- pinctrl-tz1090-pdc: switched to generic pinconf (a previous patch adds the BIAS_BUS_HOLD generic pinconf)
- pinctrl-tz1090-pdc: changed device tree bindings to more closely match generic pinconf (separate tristate, pull-up, pull-down, bus-hold flags instead of pull=<X>, drive-strength measured in mA)
- pinctrl-tz1090-pdc: make use of BIT() from linux/bitops.h
- pinctrl-tz1090-pdc: add a whole bunch of comments
- gpio-tz1090-pdc: remove references to Linux flags in dt bindings
- gpio-tz1090-pdc: make use of BIT() from linux/bitops.h
- gpio-tz1090-pdc: make register accessors inline to match pinctrl
- gpio-tz1090-pdc: update gpio-ranges to use 3 cells after recent ABI breakage
James Hogan (9):
metag: of_platform_populate from arch generic code
metag: minimal TZ1090 (Comet) SoC infrastructure
irq-imgpdc: add ImgTec PDC irqchip driver
pinconf-generic: add drive strength to debugfs output
pinconf-generic: add BIAS_BUS_HOLD pinconf
pinctrl-tz1090: add TZ1090 pinctrl driver
gpio-tz1090: add TZ1090 gpio driver
pinctrl-tz1090-pdc: add TZ1090 PDC pinctrl driver
gpio-tz1090-pdc: add TZ1090 PDC gpio driver
.../devicetree/bindings/gpio/gpio-tz1090-pdc.txt | 41 + .../devicetree/bindings/gpio/gpio-tz1090.txt | 83 + .../devicetree/bindings/metag/pdc-intc.txt | 112 + .../bindings/pinctrl/img,tz1090-pdc-pinctrl.txt | 128 ++ .../bindings/pinctrl/img,tz1090-pinctrl.txt | 223 ++ .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/metag/Kconfig.soc | 14 + arch/metag/Makefile | 2 +- arch/metag/boot/dts/Makefile | 2 + arch/metag/boot/dts/tz1090.dtsi | 106 + arch/metag/boot/dts/tz1090_generic.dts | 10 + arch/metag/configs/tz1090_defconfig | 42 + arch/metag/kernel/setup.c | 4 + drivers/gpio/Kconfig | 14 + drivers/gpio/Makefile | 2 + drivers/gpio/gpio-tz1090-pdc.c | 242 +++ drivers/gpio/gpio-tz1090.c | 629 ++++++ drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-imgpdc.c | 541 +++++ drivers/pinctrl/Kconfig | 12 + drivers/pinctrl/Makefile | 2 + drivers/pinctrl/pinconf-generic.c | 2 + drivers/pinctrl/pinctrl-tz1090-pdc.c | 1105 ++++++++++ drivers/pinctrl/pinctrl-tz1090.c | 2150 ++++++++++++++++++++ include/linux/pinctrl/pinconf-generic.h | 6 + 26 files changed, 5477 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt create mode 100644 Documentation/devicetree/bindings/gpio/gpio-tz1090.txt create mode 100644 Documentation/devicetree/bindings/metag/pdc-intc.txt create mode 100644 Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt create mode 100644 Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt create mode 100644 arch/metag/boot/dts/tz1090.dtsi create mode 100644 arch/metag/boot/dts/tz1090_generic.dts create mode 100644 arch/metag/configs/tz1090_defconfig create mode 100644 drivers/gpio/gpio-tz1090-pdc.c create mode 100644 drivers/gpio/gpio-tz1090.c create mode 100644 drivers/irqchip/irq-imgpdc.c create mode 100644 drivers/pinctrl/pinctrl-tz1090-pdc.c create mode 100644 drivers/pinctrl/pinctrl-tz1090.c
Signature · 1 line
1.8.1.2
PATCH v2 1/9 metag: of_platform_populate from arch generic code
If no init_machine callback is provided, call of_platform_populate() instead. This allows a board/SoC that only needs to call of_platform_populate to omit the callback altogether.
--- arch/metag/kernel/setup.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/metag/kernel/setup.c +4 -0
@@ -20,6 +20,7 @@#include <linux/memblock.h> #include <linux/mm.h> #include <linux/of_fdt.h> +#include <linux/of_platform.h> #include <linux/pfn.h> #include <linux/root_dev.h> #include <linux/sched.h>
@@ -424,6 +425,9 @@ static int __init customize_machine(void)/* customizes platform devices, or adds new ones */ if (machine_desc->init_machine) machine_desc->init_machine (); +else +of_platform_populate (NULL , of_default_bus_match_table,NULL , +NULL );return 0 ; }arch_initcall (customize_machine);
Signature · 1 line
1.8.1.2
Re: [PATCH v2 1/9] metag: of_platform_populate from arch generic code
Quoted 9 lines · James Hogan
If no
init_machinecallback is provided, callof_platform_populate()instead. This allows a board/SoC that only needs to callof_platform_populateto omit the callback altogether.Signed-off-by James Hogan <[email protected]>Cc Grant Likely <[email protected]>Cc Rob Herring <[email protected]>Cc Arnd Bergmann <[email protected]>
I've applied this patch for v3.11
Cheers
James
Quoted 27 lines
--- arch/metag/kernel/setup.c | 4 ++++ 1 file changed, 4 insertions(+)arch/metag/kernel/setup.c +4
-0@@ -20,6 +20,7 @@#include <linux/memblock.h> #include <linux/mm.h> #include <linux/of_fdt.h> +#include <linux/of_platform.h> #include <linux/pfn.h> #include <linux/root_dev.h> #include <linux/sched.h> @@ -424,6 +425,9 @@ static int __init customize_machine(void)/* customizes platform devices, or adds new ones */ if (machine_desc->init_machine) machine_desc->init_machine (); +else +of_platform_populate (NULL , of_default_bus_match_table,NULL , +NULL );return 0 ; }arch_initcall (customize_machine);
PATCH v2 2/9 metag: minimal TZ1090 (Comet) SoC infrastructure
In reply to James HoganAdd really minimal support for Toumaz Xenif TZ1090 SoC (A.K.A. Comet). This consists of minimal build infrastructure, device tree files, and a defconfig based on meta2_defconfig.
This SoC contains a 2-threaded HTP (Meta 2) as the main application processor, and is found in a number of development boards and digital radios, such as the Minimorph Development Platform.
---
Changes in v2:
- removed arch/metag/soc/ directory
.../devicetree/bindings/vendor-prefixes.txt | 1 + arch/metag/Kconfig.soc | 9 +++++ arch/metag/Makefile | 2 +- arch/metag/boot/dts/Makefile | 2 ++ arch/metag/boot/dts/tz1090.dtsi | 29 +++++++++++++++ arch/metag/boot/dts/tz1090_generic.dts | 10 ++++++ arch/metag/configs/tz1090_defconfig | 42 ++++++++++++++++++++++ 7 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 arch/metag/boot/dts/tz1090.dtsi create mode 100644 arch/metag/boot/dts/tz1090_generic.dts create mode 100644 arch/metag/configs/tz1090_defconfig
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -57,6 +57,7 @@ snps Synopsys, Inc. st STMicroelectronics ste ST-Ericsson stericsson ST-Ericsson +toumaz Toumaz ti Texas Instruments toshiba Toshiba Corporation via VIA Technologies, Inc.
arch/metag/Kconfig.soc +9 -0
@@ -14,6 +14,15 @@ config META21_FPGA help This is a Meta 2.1 FPGA bitstream, just a bare CPU. +config SOC_TZ1090 + bool "Toumaz Xenif TZ1090 SoC (Comet)" + select METAG_LNKGET_AROUND_CACHE + select METAG_META21 + select METAG_SMP_WRITE_REORDERING + help + This is a Toumaz Technology Xenif TZ1090 (A.K.A. Comet) SoC containing + a 2-threaded HTP. + endchoice menu "SoC configuration"
arch/metag/Makefile +1 -1
@@ -20,7 +20,7 @@ checkflags-$(CONFIG_METAG_META12) += -DMETAC_1_2 checkflags-$(CONFIG_METAG_META21) += -DMETAC_2_1 CHECKFLAGS += -D__metag__ $(checkflags-y) -KBUILD_DEFCONFIG := meta2_defconfig +KBUILD_DEFCONFIG := tz1090_defconfig sflags-$(CONFIG_METAG_META12) += -mmetac=1.2 ifeq ($(CONFIG_METAG_META12),y)
arch/metag/boot/dts/Makefile +2 -0
@@ -1,7 +1,9 @@ dtb-y += skeleton.dtb +dtb-y += tz1090_generic.dtb # Built-in dtb builtindtb-y := skeleton +builtindtb-$(CONFIG_SOC_TZ1090) := tz1090_generic ifneq ($(CONFIG_METAG_BUILTIN_DTB_NAME),"") builtindtb-y := $(patsubst "%",%,$(CONFIG_METAG_BUILTIN_DTB_NAME))
arch/metag/boot/dts/tz1090.dtsi new file +29 -0
@@ -0,0 +1,29 @@ +/* + * Copyright (C) 2012 Imagination Technologies Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/include/ "skeleton.dtsi" + +/ { + compatible = "toumaz,tz1090", "img,meta"; + + interrupt-parent = <&intc>; + + intc: interrupt-controller { + compatible = "img,meta-intc"; + interrupt-controller; + #interrupt-cells = <2>; + num-banks = <2>; + }; + + soc { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + }; +};
arch/metag/boot/dts/tz1090_generic.dts new file +10 -0
@@ -0,0 +1,10 @@ +/* + * Copyright (C) 2012 Imagination Technologies Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +/dts-v1/; + +/include/ "tz1090.dtsi"
arch/metag/configs/tz1090_defconfig new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.8.1.2
Re: [PATCH v2 2/9] metag: minimal TZ1090 (Comet) SoC infrastructure
Quoted 15 lines · James Hogan
Add really minimal support for Toumaz Xenif TZ1090 SoC (A.K.A. Comet). This consists of minimal build infrastructure, device tree files, and a defconfig based on
meta2_defconfig.This SoC contains a 2-threaded HTP (Meta 2) as the main application processor, and is found in a number of development boards and digital radios, such as the Minimorph Development Platform.
Signed-off-by James Hogan <[email protected]>Cc Grant Likely <[email protected]>Cc Rob Herring <[email protected]>Cc Rob Landley <[email protected]>Cc Arnd Bergmann <[email protected]>
Quoted 3 lines
---
Changes in v2:
- removedarch/metag/soc/directory
I've applied this patch for v3.11
Cheers
James
Quoted 172 lines
.../devicetree/bindings/vendor-prefixes.txt | 1 + arch/metag/Kconfig.soc | 9 +++++ arch/metag/Makefile | 2 +- arch/metag/boot/dts/Makefile | 2 ++ arch/metag/boot/dts/tz1090.dtsi | 29 +++++++++++++++ arch/metag/boot/dts/tz1090_generic.dts | 10 ++++++ arch/metag/configs/tz1090_defconfig | 42 ++++++++++++++++++++++ 7 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 arch/metag/boot/dts/tz1090.dtsi create mode 100644 arch/metag/boot/dts/tz1090_generic.dts create mode 100644 arch/metag/configs/tz1090_defconfigDocumentation/devicetree/bindings/vendor-prefixes.txt +1
-0@@ -57,6 +57,7 @@ snps Synopsys, Inc. st STMicroelectronics ste ST-Ericsson stericsson ST-Ericsson +toumaz Toumaz ti Texas Instruments toshiba Toshiba Corporation via VIA Technologies, Inc.arch/metag/Kconfig.soc +9
-0@@ -14,6 +14,15 @@ config META21_FPGA help This is a Meta 2.1 FPGA bitstream, just a bare CPU. +config SOC_TZ1090 + bool "Toumaz Xenif TZ1090 SoC (Comet)" + select METAG_LNKGET_AROUND_CACHE + select METAG_META21 + select METAG_SMP_WRITE_REORDERING + help + This is a Toumaz Technology Xenif TZ1090 (A.K.A. Comet) SoC containing + a 2-threaded HTP. + endchoice menu "SoC configuration"arch/metag/Makefile +1
-1@@ -20,7 +20,7 @@ checkflags-$(CONFIG_METAG_META12) += -DMETAC_1_2 checkflags-$(CONFIG_METAG_META21) += -DMETAC_2_1 CHECKFLAGS += -D__metag__ $(checkflags-y) -KBUILD_DEFCONFIG := meta2_defconfig +KBUILD_DEFCONFIG := tz1090_defconfig sflags-$(CONFIG_METAG_META12) += -mmetac=1.2 ifeq ($(CONFIG_METAG_META12),y)arch/metag/boot/dts/Makefile +2
-0@@ -1,7 +1,9 @@ dtb-y += skeleton.dtb +dtb-y += tz1090_generic.dtb # Built-in dtb builtindtb-y := skeleton +builtindtb-$(CONFIG_SOC_TZ1090) := tz1090_generic ifneq ($(CONFIG_METAG_BUILTIN_DTB_NAME),"") builtindtb-y := $(patsubst "%",%,$(CONFIG_METAG_BUILTIN_DTB_NAME))arch/metag/boot/dts/tz1090.dtsi new file +29
-0@@ -0,0 +1,29 @@ +/* + * Copyright (C) 2012 Imagination Technologies Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/include/ "skeleton.dtsi" + +/ { + compatible = "toumaz,tz1090", "img,meta"; + + interrupt-parent = <&intc>; + + intc: interrupt-controller { + compatible = "img,meta-intc"; + interrupt-controller; + #interrupt-cells = <2>; + num-banks = <2>; + }; + + soc { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + }; +};arch/metag/boot/dts/tz1090_generic.dts new file +10
-0@@ -0,0 +1,10 @@ +/* + * Copyright (C) 2012 Imagination Technologies Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +/dts-v1/; + +/include/ "tz1090.dtsi"arch/metag/configs/tz1090_defconfig new file +42
-0@@ -0,0 +1,42 @@ +# CONFIG_LOCALVERSION_AUTO is not set +# CONFIG_SWAP is not set +CONFIG_SYSVIPC=y +CONFIG_SYSFS_DEPRECATED=y +CONFIG_SYSFS_DEPRECATED_V2=y +CONFIG_KALLSYMS_ALL=y +# CONFIG_ELF_CORE is not set +CONFIG_SLAB=y +# CONFIG_BLK_DEV_BSG is not set +CONFIG_PARTITION_ADVANCED=y +# CONFIG_MSDOS_PARTITION is not set +# CONFIG_IOSCHED_DEADLINE is not set +# CONFIG_IOSCHED_CFQ is not set +CONFIG_FLATMEM_MANUAL=y +CONFIG_SOC_TZ1090=y +CONFIG_METAG_HALT_ON_PANIC=y +# CONFIG_METAG_FPU is not set +CONFIG_METAG_DA=y +CONFIG_HZ_100=y +CONFIG_DEVTMPFS=y +# CONFIG_STANDALONE is not set +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +# CONFIG_FW_LOADER is not set +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=1 +CONFIG_BLK_DEV_RAM_SIZE=16384 +# CONFIG_INPUT is not set +# CONFIG_SERIO is not set +# CONFIG_VT is not set +# CONFIG_LEGACY_PTYS is not set +CONFIG_DA_TTY=y +CONFIG_DA_CONSOLE=y +# CONFIG_DEVKMEM is not set +# CONFIG_HW_RANDOM is not set +CONFIG_GPIOLIB=y +# CONFIG_HWMON is not set +# CONFIG_USB_SUPPORT is not set +# CONFIG_DNOTIFY is not set +CONFIG_TMPFS=y +# CONFIG_MISC_FILESYSTEMS is not set +# CONFIG_SCHED_DEBUG is not set +CONFIG_DEBUG_INFO=y
PATCH v2 3/9 irq-imgpdc: add ImgTec PDC irqchip driver
In reply to James HoganAdd irqchip driver for the ImgTec PowerDown Controller (PDC) as found in the TZ1090. The PDC has a number of general system wakeup (SysWake) interrupts (which would for example be connected to a power button or an external peripheral), and a number of peripheral interrupts which can also wake the system but are connected straight to specific low-power peripherals (such as RTC or Infrared). It has a single interrupt output for SysWakes, and individual interrupt outputs for each peripheral.
The driver demuxes the SysWake interrupt line, and passes the peripheral interrupts straight through. It also handles the set_wake interrupt operation to enable/disable the appropriate wake event bits.
---
Changes in v2:
- irq-imgpdc: use cached versions of irq_en and irq_route registers
- irq-imgpdc: switch to using raw_spinlock
- irq-imgpdc: (not had time to switch to generic irqchip yet)
.../devicetree/bindings/metag/pdc-intc.txt | 112 +++++ arch/metag/Kconfig.soc | 1 + arch/metag/boot/dts/tz1090.dtsi | 16 + drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-imgpdc.c | 541 +++++++++++++++++++++ 6 files changed, 675 insertions(+) create mode 100644 Documentation/devicetree/bindings/metag/pdc-intc.txt create mode 100644 drivers/irqchip/irq-imgpdc.c
Documentation/devicetree/bindings/metag/pdc-intc.txt new file +112 -0
@@ -0,0 +1,112 @@ +* ImgTec Powerdown Controller (PDC) Interrupt Controller Binding + +This binding specifies what properties must be available in the device tree +representation of a PDC IRQ controller. This has a number of input interrupt +lines which can wake the system, and are passed on through output interrupt +lines. + +Required properties: + + - compatible: Specifies the compatibility list for the interrupt controller. + The type shall be <string> and the value shall include "img,pdc-intc". + + - reg: Specifies the base PDC physical address(s) and size(s) of the + addressable register space. The type shall be <prop-encoded-array>. + + - interrupt-controller: The presence of this property identifies the node + as an interrupt controller. No property value shall be defined. + + - #interrupt-cells: Specifies the number of cells needed to encode an + interrupt source. The type shall be a <u32> and the value shall be 3. + + - num-perips: Number of waking peripherals. + + - num-syswakes: Number of SysWake inputs. + + - interrupts: List of interrupt specifiers. The first specifier shall be the + shared SysWake interrupt, and remaining specifies shall be PDC peripheral + interrupts in order. + +* Interrupt Specifier Definition + + Interrupt specifiers consists of 3 cells encoded as follows: + + - <1st-cell>: The type of interrupt: + 0 = peripheral interrupt + 1 = SysWake interrupt + + - <1st-cell>: The interrupt-number that identifies the interrupt source. + + - <3rd-cell>: The level-sense information, encoded using the Linux interrupt + flags as follows (only 4 valid for peripheral interrupts): + 1 = low-to-high edge triggered + 2 = high-to-low edge triggered + 3 = both edge triggered + 4 = active-high level-sensitive (required for perip irqs) + 8 = active-low level-sensitive + +* Examples + +Example 1: + + /* + * TZ1090 PDC block + */ + pdc: pdc@0x02006000 { + // This is an interrupt controller node. + interrupt-controller; + + // Three cells to encode interrupt sources. + #interrupt-cells = <3>; + + // Offset address of 0x02006000 and size of 0x1000. + reg = <0x02006000 0x1000>; + + // Compatible with Meta hardware trigger block. + compatible = "img,pdc-intc"; + + // Three peripherals are connected. + num-perips = <3>; + + // Four SysWakes are connected. + num-syswakes = <4>; + + interrupts = <18 4 /* level */>, /* Syswakes */ + <30 4 /* level */>, /* Peripheral 0 (RTC) */ + <29 4 /* level */>, /* Peripheral 1 (IR) */ + <31 4 /* level */>; /* Peripheral 2 (WDT) */ + }; + +Example 2: + + /* + * An SoC peripheral that is wired through the PDC. + */ + rtc0 { + // The interrupt controller that this device is wired to. + interrupt-parent = <&pdc>; + + // Interrupt source Peripheral 0 + // Note that there are three cells as specified in the interrupt + // parent's '#interrupt-cells' property. + interrupts = <1 /* Peripheral */ + 0 /* Peripheral 0 (RTC) */ + 4> /* IRQ_TYPE_LEVEL_HIGH */ + }; + +Example 3: + + /* + * An interrupt generating device that is wired to a SysWake pin. + */ + touchscreen0 { + // The interrupt controller that this device is wired to. + interrupt-parent = <&pdc>; + + // Interrupt source SysWake 0 that is active-low level-sensitive + // Note that there are three cells as specified in the interrupt + // parent's '#interrupt-cells' property. + interrupts = <1 /* Syswake */ + 0 /* SysWake0 */ + 8 /* IRQ_TYPE_LEVEL_LOW */>; + };
arch/metag/Kconfig.soc +1 -0
@@ -16,6 +16,7 @@ config META21_FPGA config SOC_TZ1090 bool "Toumaz Xenif TZ1090 SoC (Comet)" + select IMGPDC_IRQ select METAG_LNKGET_AROUND_CACHE select METAG_META21 select METAG_SMP_WRITE_REORDERING
arch/metag/boot/dts/tz1090.dtsi +16 -0
@@ -25,5 +25,21 @@ #address-cells = <1>; #size-cells = <1>; ranges; + + pdc: pdc@0x02006000 { + interrupt-controller; + #interrupt-cells = <3>; + + reg = <0x02006000 0x1000>; + compatible = "img,pdc-intc"; + + num-perips = <3>; + num-syswakes = <3>; + + interrupts = <18 4 /* level */>, /* Syswakes */ + <30 4 /* level */>, /* Perip 0 (RTC) */ + <29 4 /* level */>, /* Perip 1 (IR) */ + <31 4 /* level */>; /* Perip 2 (WDT) */ + }; }; };
drivers/irqchip/Kconfig +4 -0
@@ -25,6 +25,10 @@ config ARM_VIC_NR The maximum number of VICs available in the system, for power management. +config IMGPDC_IRQ + bool + select IRQ_DOMAIN + config RENESAS_INTC_IRQPIN bool select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o obj-$(CONFIG_ARM_GIC) += irq-gic.o obj-$(CONFIG_ARM_VIC) += irq-vic.o +obj-$(CONFIG_IMGPDC_IRQ) += irq-imgpdc.o obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o
drivers/irqchip/irq-imgpdc.c new file +541 -0
541 lines not on this page · raw message
Signature · 1 line
1.8.1.2
PATCH v2 4/9 pinconf-generic: add drive strength to debugfs output
In reply to James HoganAdd the drive strength pinconf to debugfs output (with the unit "mA").
---
Changes in v2:
- add drive strength to generic pinconf debugfs output (patch 4)
drivers/pinctrl/pinconf-generic.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/pinconf-generic.c +1 -0
@@ -42,6 +42,7 @@ static struct pin_config_item conf_items[] = {PCONFDUMP (PIN_CONFIG_DRIVE_PUSH_PULL ,"output drive push pull" ,NULL ),PCONFDUMP (PIN_CONFIG_DRIVE_OPEN_DRAIN ,"output drive open drain" ,NULL ),PCONFDUMP (PIN_CONFIG_DRIVE_OPEN_SOURCE ,"output drive open source" ,NULL ), +PCONFDUMP (PIN_CONFIG_DRIVE_STRENGTH ,"output drive strength" ,"mA" ),PCONFDUMP (PIN_CONFIG_INPUT_SCHMITT_ENABLE ,"input schmitt enabled" ,NULL ),PCONFDUMP (PIN_CONFIG_INPUT_SCHMITT ,"input schmitt trigger" ,NULL ), PCONFDUMP(PIN_CONFIG_INPUT_DEBOUNCE, "input debounce", "time units"),
Signature · 1 line
1.8.1.2
Re: [PATCH v2 4/9] pinconf-generic: add drive strength to debugfs output
Quoted 7 lines · James Hogan
Add the drive strength pinconf to debugfs output (with the unit "mA").
Signed-off-by James Hogan <[email protected]>Cc Linus Walleij <[email protected]>---
Changes in v2:
- add drive strength to generic pinconf debugfs output (patch 4)
This is fine.
Yours,
Linus Walleij
Re: [PATCH v2 4/9] pinconf-generic: add drive strength to debugfs output
In reply to James HoganQuoted 7 lines · James Hogan
Add the drive strength pinconf to debugfs output (with the unit "mA").
Signed-off-by James Hogan <[email protected]>Cc Linus Walleij <[email protected]>---
Changes in v2:
- add drive strength to generic pinconf debugfs output (patch 4)
Patch applied for v3.11.
Yours,
Linus Walleij
PATCH v2 5/9 pinconf-generic: add BIAS_BUS_HOLD pinconf
In reply to James HoganAdd a new PIN_CONFIG_BIAS_BUS_HOLD pin configuration for a bus holder pin mode (also known as bus keeper, or repeater). This is a weak latch which drives the last value on a tristate bus. Another device on the bus can drive the bus high or low before going tristate to change the value driven by the pin.
---
Changes in v2:
- add BIAS_BUS_HOLD generic pinconf (patch 5)
drivers/pinctrl/pinconf-generic.c | 1 + include/linux/pinctrl/pinconf-generic.h | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/pinctrl/pinconf-generic.c +1 -0
@@ -37,6 +37,7 @@ struct pin_config_item {static struct pin_config_item conf_items[] = {PCONFDUMP (PIN_CONFIG_BIAS_DISABLE ,"input bias disabled" ,NULL ),PCONFDUMP (PIN_CONFIG_BIAS_HIGH_IMPEDANCE ,"input bias high impedance" ,NULL ), +PCONFDUMP (PIN_CONFIG_BIAS_BUS_HOLD ,"input bias bus hold" ,NULL ),PCONFDUMP (PIN_CONFIG_BIAS_PULL_UP ,"input bias pull up" ,NULL ),PCONFDUMP (PIN_CONFIG_BIAS_PULL_DOWN ,"input bias pull down" ,NULL ),PCONFDUMP (PIN_CONFIG_DRIVE_PUSH_PULL ,"output drive push pull" ,NULL ),
include/linux/pinctrl/pinconf-generic.h +6 -0
@@ -29,6 +29,11 @@* if for example some other pin is going to drive the signal connected * to it for a while. Pins used for input are usually always high * impedance. +* @PIN_CONFIG_BIAS_BUS_HOLD: the pin will be set to weakly latch so that it +* weakly drives the last value on a tristate bus, also known as a "bus +* holder", "bus keeper" or "repeater". This allows another device on the +* bus to change the value by driving the bus high or low and switching to +* tristate. The argument is ignored. * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high * impedance to VDD). If the argument is != 0 pull-up is enabled, * if it is 0, pull-up is disabled.
@@ -78,6 +83,7 @@enum pin_config_param {PIN_CONFIG_BIAS_DISABLE ,PIN_CONFIG_BIAS_HIGH_IMPEDANCE , +PIN_CONFIG_BIAS_BUS_HOLD ,PIN_CONFIG_BIAS_PULL_UP ,PIN_CONFIG_BIAS_PULL_DOWN ,PIN_CONFIG_DRIVE_PUSH_PULL ,
Signature · 1 line
1.8.1.2
Re: [PATCH v2 5/9] pinconf-generic: add BIAS_BUS_HOLD pinconf
Quoted 11 lines · James Hogan
Add a new
PIN_CONFIG_BIAS_BUS_HOLDpin configuration for a bus holder pin mode (also known as bus keeper, or repeater). This is a weak latch which drives the last value on a tristate bus. Another device on the bus can drive the bus high or low before going tristate to change the value driven by the pin.Signed-off-by James Hogan <[email protected]>Cc Linus Walleij <[email protected]>---
Changes in v2:
- addBIAS_BUS_HOLDgeneric pinconf (patch 5)
This is fine:
Yours,
Linus Walleij
Re: [PATCH v2 5/9] pinconf-generic: add BIAS_BUS_HOLD pinconf
In reply to James HoganQuoted 11 lines · James Hogan
Add a new
PIN_CONFIG_BIAS_BUS_HOLDpin configuration for a bus holder pin mode (also known as bus keeper, or repeater). This is a weak latch which drives the last value on a tristate bus. Another device on the bus can drive the bus high or low before going tristate to change the value driven by the pin.Signed-off-by James Hogan <[email protected]>Cc Linus Walleij <[email protected]>---
Changes in v2:
- addBIAS_BUS_HOLDgeneric pinconf (patch 5)
Patch applied for v3.11.
Yours,
Linus Walleij
PATCH v2 6/9 pinctrl-tz1090: add TZ1090 pinctrl driver
In reply to James HoganAdd a pin control driver for the main pins on the TZ1090 SoC. This doesn't include the low-power pins as they're controlled separately via the Powerdown Controller (PDC) registers.
---
Changes in v2:
- pinctrl-tz1090: switched to generic pinconf (a previous patch adds the BIAS_BUS_HOLD generic pinconf)
- pinctrl-tz1090: changed device tree bindings to more closely match generic pinconf (separate tristate, pull-up, pull-down, bus-hold flags instead of pull=<X>, drive-strength measured in mA)
- pinctrl-tz1090: removed "select" pinconf. Instead pins in a pin group have their own individual pin groups and can be individually muxed. Different pins in same pin mux group muxed to different functions is disallowed. Pin switched to peripheral mode when mux enabled.
- pinctrl-tz1090: make use of BIT() from linux/bitops.h
- pinctrl-tz1090: add a whole bunch of comments
.../bindings/pinctrl/img,tz1090-pinctrl.txt | 223 ++ arch/metag/Kconfig.soc | 2 + arch/metag/boot/dts/tz1090.dtsi | 6 + drivers/pinctrl/Kconfig | 6 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-tz1090.c | 2150 ++++++++++++++++++++ 6 files changed, 2388 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt create mode 100644 drivers/pinctrl/pinctrl-tz1090.c
Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt new file +223 -0
@@ -0,0 +1,223 @@ +ImgTec TZ1090 pin controller + +Required properties: +- compatible: "img,tz1090-pinctrl" +- reg: Should contain the register physical address and length of the pad + configuration registers (CR_PADS_* and CR_IF_CTL0). + +Please refer to pinctrl-bindings.txt in this directory for details of the +common pinctrl bindings used by client devices, including the meaning of the +phrase "pin configuration node". + +TZ1090's pin configuration nodes act as a container for an abitrary number of +subnodes. Each of these subnodes represents some desired configuration for a +pin, a group, or a list of pins or groups. This configuration can include the +mux function to select on those pin(s)/group(s), and various pin configuration +parameters, such as pull-up, drive strength, etc. + +The name of each subnode is not important; all subnodes should be enumerated +and processed purely based on their content. + +Each subnode only affects those parameters that are explicitly listed. In +other words, a subnode that lists a mux function but no pin configuration +parameters implies no information about any pin configuration parameters. +Similarly, a pin subnode that describes a pullup parameter implies no +information about e.g. the mux function. For this reason, even seemingly boolean +values are actually tristates in this binding: unspecified, off, or on. +Unspecified is represented as an absent property, and off/on are represented as +integer values 0 and 1. + +Required subnode-properties: +- pins : An array of strings. Each string contains the name of a pin or group. + Valid values for these names are listed below. + +Optional subnode-properties: +- function: A string containing the name of the function to mux to the pin or + group. Valid values for function names are listed below, including which + pingroups can be muxed to them. +- tristate: Flag, put pin into high impedance state. +- pull-up: Flag, pull pin high. +- pull-down: Flag, pull pin low. +- bus-hold: Flag, weak latch last value on tristate bus. +- schmitt: Integer, enable or disable Schmitt trigger mode for the pins. + 0: no hysteresis + 1: schmitt trigger +- slew-rate: Integer, control slew rate of pins. + 0: slow (half frequency) + 1: fast +- drive-strength: Integer, control drive strength of pins in mA. + 2: 2mA + 4: 4mA + 8: 8mA + 12: 12mA + +Note that many of these properties are only valid for certain specific pins +or groups. See the TZ1090 TRM for complete details regarding which groups +support which functionality. The Linux pinctrl driver may also be a useful +reference. + +Valid values for pin and group names are: + + gpio pins: + + These all support tristate, pull-up, pull-down, and bus-hold (which can also + be provided to any of the groups below to set it for all pins in that + group). + + They also all support the some form of muxing. Any pins which are contained + in one of the mux groups (see below) can be muxed only to the functions + supported by the mux group. All other pins can be muxed to the "perip" + function which which enables them with their intended peripheral. + + Different pins in the same mux group cannot be muxed to different functions, + however it is possible to mux only a subset of the pins in a mux group to a + particular function and leave the remaining pins unmuxed. This is useful if + the board connects certain pins in a group to other devices to be controlled + by GPIO, and you don't want the usual peripheral to have any control of the + pin. + + ant_sel0, ant_sel1, gain0, gain1, gain2, gain3, gain4, gain5, gain6, gain7, + i2s_bclk_out, i2s_din, i2s_dout0, i2s_dout1, i2s_dout2, i2s_lrclk_out, + i2s_mclk, pa_on, pdm_a, pdm_b, pdm_c, pdm_d, pll_on, rx_hp, rx_on, + scb0_sclk, scb0_sdat, scb1_sclk, scb1_sdat, scb2_sclk, scb2_sdat, sdh_cd, + sdh_clk_in, sdh_wp, sdio_clk, sdio_cmd, sdio_d0, sdio_d1, sdio_d2, sdio_d3, + spi0_cs0, spi0_cs1, spi0_cs2, spi0_din, spi0_dout, spi0_mclk, spi1_cs0, + spi1_cs1, spi1_cs2, spi1_din, spi1_dout, spi1_mclk, tft_blank_ls, tft_blue0, + tft_blue1, tft_blue2, tft_blue3, tft_blue4, tft_blue5, tft_blue6, tft_blue7, + tft_green0, tft_green1, tft_green2, tft_green3, tft_green4, tft_green5, + tft_green6, tft_green7, tft_hsync_nr, tft_panelclk, tft_pwrsave, tft_red0, + tft_red1, tft_red2, tft_red3, tft_red4, tft_red5, tft_red6, tft_red7, + tft_vd12acb, tft_vdden_gd, tft_vsync_ns, tx_on, uart0_cts, uart0_rts, + uart0_rxd, uart0_txd, uart1_rxd, uart1_txd. + + tristate: supported. + pull-up: supported. + pull-down: supported. + bus-hold: supported. + function: perip or those supported by pin's mux group. + + other pins: + + These other pins are part of various pin groups below, but can't be + controlled as GPIOs. They do however support tristate, pull-up, pull-down, + and bus-hold (which can also be provided to any of the groups below to set + it for all pins in that group). + + clk_out0, clk_out1, tck, tdi, tdo, tms, trst. + + tristate: supported. + pull-up: supported. + pull-down: supported. + bus-hold: supported. + + mux groups: + + These all support function, and some support drive configs. + + afe + pins: tx_on, rx_on, pll_on, pa_on, rx_hp, ant_sel0, ant_sel1, + gain0, gain1, gain2, gain3, gain4, gain5, gain6, gain7. + function: afe, ts_out_0. + schmitt: supported. + slew-rate: supported. + drive-strength: supported. + pdm_d + pins: pdm_d. + function: pdm_dac, usb_vbus. + sdh + pins: sdh_cd, sdh_wp, sdh_clk_in. + function: sdh, sdio. + sdio + pins: sdio_clk, sdio_cmd, sdio_d0, sdio_d1, sdio_d2, sdio_d3. + function: sdio, sdh. + spi1_cs2 + pins: spi1_cs2. + function: spi1_cs2, usb_vbus. + tft + pins: tft_red0, tft_red1, tft_red2, tft_red3, + tft_red4, tft_red5, tft_red6, tft_red7, + tft_green0, tft_green1, tft_green2, tft_green3, + tft_green4, tft_green5, tft_green6, tft_green7, + tft_blue0, tft_blue1, tft_blue2, tft_blue3, + tft_blue4, tft_blue5, tft_blue6, tft_blue7, + tft_vdden_gd, tft_panelclk, tft_blank_ls, tft_vsync_ns, + tft_hsync_nr, tft_vd12acb, tft_pwrsave. + function: tft, ext_dac, not_iqadc_stb, iqdac_stb, ts_out_1, + lcd_trace, phy_ringosc. + schmitt: supported. + slew-rate: supported. + drive-strength: supported. + + drive groups: + + These all support schmitt, slew-rate, and drive-strength. + + jtag + pins: tck, trst, tdi, tdo, tms. + scb1 + pins: scb1_sdat, scb1_sclk. + scb2 + pins: scb2_sdat, scb2_sclk. + spi0 + pins: spi0_mclk, spi0_cs0, spi0_cs1, spi0_cs2, spi0_dout, spi0_din. + spi1 + pins: spi1_mclk, spi1_cs0, spi1_cs1, spi1_cs2, spi1_dout, spi1_din. + uart + pins: uart0_txd, uart0_rxd, uart0_rts, uart0_cts, + uart1_txd, uart1_rxd. + drive_i2s + pins: clk_out1, i2s_din, i2s_dout0, i2s_dout1, i2s_dout2, + i2s_lrclk_out, i2s_bclk_out, i2s_mclk. + drive_pdm + pins: clk_out0, pdm_b, pdm_a. + drive_scb0 + pins: scb0_sclk, scb0_sdat, pdm_d, pdm_c. + drive_sdio + pins: sdio_clk, sdio_cmd, sdio_d0, sdio_d1, sdio_d2, sdio_d3, + sdh_wp, sdh_cd, sdh_clk_in. + + convenience groups: + + These are just convenient groupings of pins and don't support any drive + configs. + + uart0 + pins: uart0_cts, uart0_rts, uart0_rxd, uart0_txd. + uart1 + pins: uart1_rxd, uart1_txd. + scb0 + pins: scb0_sclk, scb0_sdat. + i2s + pins: i2s_bclk_out, i2s_din, i2s_dout0, i2s_dout1, i2s_dout2, + i2s_lrclk_out, i2s_mclk. + +Example: + + pinctrl: pinctrl@02005800 { + #gpio-range-cells = <3>; + compatible = "img,tz1090-pinctrl"; + reg = <0x02005800 0xe4>; + }; + +Example board file extract: + + &pinctrl { + uart0_default: uart0 { + uart0_cfg { + pins = "uart0_rxd", + "uart0_txd"; + function = "perip"; + }; + }; + tft_default: tft { + tft_cfg { + pins = "tft"; + function = "tft"; + }; + }; + }; + + uart@02004b00 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_default>; + };
arch/metag/Kconfig.soc +2 -0
@@ -20,6 +20,8 @@ config SOC_TZ1090 select METAG_LNKGET_AROUND_CACHE select METAG_META21 select METAG_SMP_WRITE_REORDERING + select PINCTRL + select PINCTRL_TZ1090 help This is a Toumaz Technology Xenif TZ1090 (A.K.A. Comet) SoC containing a 2-threaded HTP.
arch/metag/boot/dts/tz1090.dtsi +6 -0
@@ -41,5 +41,11 @@ <29 4 /* level */>, /* Perip 1 (IR) */ <31 4 /* level */>; /* Perip 2 (WDT) */ }; + + pinctrl: pinctrl@02005800 { + #gpio-range-cells = <3>; + compatible = "img,tz1090-pinctrl"; + reg = <0x02005800 0xe4>; + }; }; };
drivers/pinctrl/Kconfig +6 -0
@@ -186,6 +186,12 @@ config PINCTRL_TEGRA114 bool select PINCTRL_TEGRA +config PINCTRL_TZ1090 + bool "Toumaz Xenif TZ1090 pin control driver" + depends on SOC_TZ1090 + select PINMUX + select GENERIC_PINCONF + config PINCTRL_U300 bool "U300 pin controller driver" depends on ARCH_U300
drivers/pinctrl/Makefile +1 -0
@@ -37,6 +37,7 @@ obj-$(CONFIG_PINCTRL_TEGRA) += pinctrl-tegra.o obj-$(CONFIG_PINCTRL_TEGRA20) += pinctrl-tegra20.o obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o obj-$(CONFIG_PINCTRL_TEGRA114) += pinctrl-tegra114.o +obj-$(CONFIG_PINCTRL_TZ1090) += pinctrl-tz1090.o obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o obj-$(CONFIG_PINCTRL_SAMSUNG) += pinctrl-samsung.o
drivers/pinctrl/pinctrl-tz1090.c new file +2150 -0
2,150 lines not on this page · raw message
Signature · 1 line
1.8.1.2
Re: [PATCH v2 6/9] pinctrl-tz1090: add TZ1090 pinctrl driver
Hi James, I want to route this patch by Laurent Pinchart, as he's also adding device tree support for a SoC using generic pinconf.
Creating new bindings for every pin controller defining the same thing and implementing the same OF parsers is not sane.
We need to:
- Define generic pinconf bindings
- Implement a common parser for these in drivers/pinctrl/pinconf-generic.c
I'll merge your patches to <linux/pinctrl/pinctrl-generic.h> as a baseline.
On Fri, May 24, 2013 at 6:21 PM, James Hogan <[email protected]> wrote:
(...)
Quoted 9 lines
Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt new file +9
-0+Optional subnode-properties: +- function: A string containing the name of the function to mux to the pin or + group. Valid values for function names are listed below, including which + pingroups can be muxed to them. +- tristate: Flag, put pin into high impedance state. +- pull-up: Flag, pull pin high. +- pull-down: Flag, pull pin low. +- bus-hold: Flag, weak latch last value on tristate bus. +- schmitt: Integer, enable or disable Schmitt trigger mode for the pins.
Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt line 52
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt new file +10
-0+ 0: no hysteresis + 1: schmitt trigger +- slew-rate: Integer, control slew rate of pins. + 0: slow (half frequency) + 1: fast +- drive-strength: Integer, control drive strength of pins in mA. + 2: 2mA + 4: 4mA + 8: 8mA + 12: 12mA
So if you want to use these names they shall be made generic.
Else you have to prefix everything with "tz1090,<property>"
Quoted 88 lines
drivers/pinctrl/pinctrl-tz1090.c new file +88
-0+/* Describes pinconf properties/flags available from device tree */ +static const struct cfg_param { +const char *property; +enum pin_config_param param; +bool flag; +} cfg_params[] = { + {"tristate" ,PIN_CONFIG_BIAS_HIGH_IMPEDANCE , true}, + {"pull-up" ,PIN_CONFIG_BIAS_PULL_UP , true}, + {"pull-down" ,PIN_CONFIG_BIAS_PULL_DOWN , true}, + {"bus-hold" ,PIN_CONFIG_BIAS_BUS_HOLD , true}, + {"schmitt" ,PIN_CONFIG_INPUT_SCHMITT_ENABLE , true}, + {"slew-rate" ,PIN_CONFIG_SLEW_RATE , false}, + {"drive-strength" ,PIN_CONFIG_DRIVE_STRENGTH , false}, +}; + +int tz1090_pinctrl_dt_subnode_to_map (struct device *dev, +struct device_node *np, +struct pinctrl_map **map, +unsigned *reserved_maps, +unsigned *num_maps) +{ +int ret, i; +const char *function; +u32 val; +unsigned long config; +unsigned long *configs =NULL ; +unsigned num_configs =0 ; +unsigned reserve; +struct property *prop; +const char *group; + + ret =of_property_read_string (np,"function" , &function); +if (ret <0 ) { +/* EINVAL=missing, which is fine since it's optional */ +if (ret != -EINVAL ) +dev_err (dev,"could not parse property function\n" ); + function =NULL ; + } + +for (i =0 ; i <ARRAY_SIZE (cfg_params); i++) { + ret =of_property_read_u32 (np, cfg_params[i].property, &val); +/* flags don't have to have a value */ +if (ret == -EOVERFLOW && cfg_params[i].flag) { + val =1 ; + ret =0 ; + } +if (!ret) { + config =pinconf_to_config_packed (cfg_params[i].param, + val); + ret =add_config (dev, &configs, &num_configs, config); +if (ret <0 ) + goto exit; +/* EINVAL=missing, which is fine since it's optional */ + }else if (ret != -EINVAL ) { +dev_err (dev,"could not parse property %s (%d)\n" , + cfg_params[i].property, ret); + } + } + + reserve =0 ; +if (function !=NULL ) + reserve++; +if (num_configs) + reserve++; + ret =of_property_count_strings (np,"pins" ); +if (ret <0 ) { +dev_err (dev,"could not parse property pins\n" ); + goto exit; + } + reserve *= ret; + + ret =reserve_map (dev, map, reserved_maps, num_maps, reserve); +if (ret <0 ) + goto exit; + +of_property_for_each_string (np,"pins" , prop, group) { +if (function) { + ret =add_map_mux (map, reserved_maps, num_maps, + group, function); +if (ret <0 ) + goto exit; + } + +if (num_configs) { + ret =add_map_configs (dev, map, reserved_maps, + num_maps, group, configs, + num_configs); +if (ret <0 )
drivers/pinctrl/pinctrl-tz1090.c line 1229
Quoted 10 lines
drivers/pinctrl/pinctrl-tz1090.c new file +10
-0+ goto exit; + } + } + + ret =0 ; + +exit: +kfree (configs); +return ret; +}
This is looking good. Can you split out the pin config mapping in some way and put that into pinconf-generic.c?
Yours,
Linus Walleij
PATCH v2 7/9 gpio-tz1090: add TZ1090 gpio driver
In reply to James HoganAdd a GPIO driver for the main GPIOs found in the TZ1090 (Comet) SoC. This doesn't include low-power GPIOs as they're controlled separately via the Powerdown Controller (PDC) registers.
The driver is instantiated by device tree and supports interrupts for all GPIOs.
---
Changes in v2:
- gpio-tz1090: remove references to Linux flags in dt bindings
- gpio-tz1090: make use of BIT() from linux/bitops.h
- gpio-tz1090: make register accessors inline to match pinctrl
- gpio-tz1090: update gpio-ranges to use 3 cells after recent ABI breakage
.../devicetree/bindings/gpio/gpio-tz1090.txt | 83 +++ arch/metag/Kconfig.soc | 1 + arch/metag/boot/dts/tz1090.dtsi | 35 ++ drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tz1090.c | 629 +++++++++++++++++++++ 6 files changed, 756 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-tz1090.txt create mode 100644 drivers/gpio/gpio-tz1090.c
Documentation/devicetree/bindings/gpio/gpio-tz1090.txt new file +83 -0
@@ -0,0 +1,83 @@ +ImgTec TZ1090 GPIO Controller + +Required properties: +- compatible: Compatible property value should be "img,tz1090-gpio>". + +- reg: Physical base address of the controller and length of memory mapped + region. + +- #address-cells: Should be 1 (for bank subnodes) + +- #size-cells: Should be 0 (for bank subnodes) + +- Each bank of GPIOs should have a subnode to represent it. + + Bank subnode required properties: + - reg: Index of bank in the range 0 to 2. + + - gpio-controller: Specifies that the node is a gpio controller. + + - #gpio-cells: Should be 2. The syntax of the gpio specifier used by client + nodes should have the following values. + <[phandle of the gpio controller node] + [gpio number within the gpio bank] + [gpio flags]> + + Values for gpio specifier: + - GPIO number: a value in the range 0 to 29. + - GPIO flags: bit field of flags: + 1: active low + + Bank subnode optional properties: + - gpio-ranges: Mapping to pin controller pins + + - interrupts: Interrupt for the entire bank + + - interrupt-controller: Specifies that the node is an interrupt controller + + - #interrupt-cells: Should be 2. The syntax of the interrupt specifier used by + client nodes should have the following values. + <[phandle of the interurupt controller] + [gpio number within the gpio bank] + [irq flags]> + + Values for irq specifier: + - GPIO number: a value in the range 0 to 29 + - IRQ flags: value to describe edge and level triggering + 1: trigger on rising edge + 2: trigger on falling edge + 3: trigger on both rising and falling edges + 4: trigger when high + 8: trigger when low + + + +Example: + + gpios: gpio-controller@02005800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "img,tz1090-gpio"; + reg = <0x02005800 0x90>; + + /* bank 0 with an interrupt */ + gpios0: bank@0 { + #gpio-cells = <2>; + #interrupt-cells = <2>; + reg = <0>; + interrupts = <13 4 /* level */>; + gpio-controller; + gpio-ranges = <&pinctrl 0 30>; + interrupt-controller; + }; + + /* bank 2 without interrupt */ + gpios2: bank@2 { + #gpio-cells = <2>; + reg = <2>; + gpio-controller; + gpio-ranges = <&pinctrl 60 30>; + }; + }; + +
arch/metag/Kconfig.soc +1 -0
@@ -16,6 +16,7 @@ config META21_FPGA config SOC_TZ1090 bool "Toumaz Xenif TZ1090 SoC (Comet)" + select ARCH_WANT_OPTIONAL_GPIOLIB select IMGPDC_IRQ select METAG_LNKGET_AROUND_CACHE select METAG_META21
arch/metag/boot/dts/tz1090.dtsi +35 -0
@@ -47,5 +47,40 @@ compatible = "img,tz1090-pinctrl"; reg = <0x02005800 0xe4>; }; + + gpios: gpios@02005800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "img,tz1090-gpio"; + reg = <0x02005800 0x90>; + + gpios0: bank@0 { + gpio-controller; + interrupt-controller; + #gpio-cells = <2>; + #interrupt-cells = <2>; + reg = <0>; + interrupts = <13 4 /* level */>; + gpio-ranges = <&pinctrl 0 0 30>; + }; + gpios1: bank@1 { + gpio-controller; + interrupt-controller; + #gpio-cells = <2>; + #interrupt-cells = <2>; + reg = <1>; + interrupts = <14 4 /* level */>; + gpio-ranges = <&pinctrl 0 30 30>; + }; + gpios2: bank@2 { + gpio-controller; + interrupt-controller; + #gpio-cells = <2>; + #interrupt-cells = <2>; + reg = <2>; + interrupts = <15 4 /* level */>; + gpio-ranges = <&pinctrl 0 60 30>; + }; + }; }; };
drivers/gpio/Kconfig +7 -0
@@ -232,6 +232,13 @@ config GPIO_TS5500 blocks of the TS-5500: DIO1, DIO2 and the LCD port, and the TS-5600 LCD port. +config GPIO_TZ1090 + bool "Toumaz Xenif TZ1090 GPIO support" + depends on SOC_TZ1090 + default y + help + Say yes here to support Toumaz Xenif TZ1090 GPIOs. + config GPIO_XILINX bool "Xilinx GPIO support" depends on PPC_OF || MICROBLAZE
drivers/gpio/Makefile +1 -0
@@ -79,6 +79,7 @@ obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o obj-$(CONFIG_GPIO_TS5500) += gpio-ts5500.o obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o +obj-$(CONFIG_GPIO_TZ1090) += gpio-tz1090.o obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o
drivers/gpio/gpio-tz1090.c new file +629 -0
629 lines not on this page · raw message
Signature · 1 line
1.8.1.2
Re: [PATCH v2 7/9] gpio-tz1090: add TZ1090 gpio driver
Quoted 6 lines · James Hogan
Add a GPIO driver for the main GPIOs found in the TZ1090 (Comet) SoC. This doesn't include low-power GPIOs as they're controlled separately via the Powerdown Controller (PDC) registers.
The driver is instantiated by device tree and supports interrupts for all GPIOs.
(...)
This is looking much better.
However I have some more improvement comments, due to new knowledge. I am sorry about the moving target but it's not my fault...
Basically you should adopt the new style of referencing flags using the preprocessor.
The examples can be found in the linux-next tree.
Quoted 1 line
+++
b/Documentation/devicetree/bindings/gpio/gpio-tz1090.txt
(...)
Documentation/devicetree/bindings/gpio/gpio-tz1090.txt line 29
Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090.txt new file +10
-0+ - #gpio-cells: Should be 2. The syntax of the gpio specifier used by client + nodes should have the following values. + <[phandle of the gpio controller node] + [gpio number within the gpio bank] + [gpio flags]> + + Values for gpio specifier: + - GPIO number: a value in the range 0 to 29. + - GPIO flags: bit field of flags: + 1: active low
Reference flags from
#include <dt-bindings/gpio/gpio.h>
Then you can use the named constants:GPIO_ACTIVE_HIGH, GPIO_ACTIVE_LOW
(...)
Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090.txt new file +4
-0+ - #interrupt-cells: Should be 2. The syntax of the interrupt specifier used by + client nodes should have the following values. + <[phandle of the interurupt controller] + [gpio number within the gpio bank]
Documentation/devicetree/bindings/gpio/gpio-tz1090.txt line 51
Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090.txt new file +10
-0+ [irq flags]> + + Values for irq specifier: + - GPIO number: a value in the range 0 to 29 + - IRQ flags: value to describe edge and level triggering + 1: trigger on rising edge + 2: trigger on falling edge + 3: trigger on both rising and falling edges + 4: trigger when high + 8: trigger when low
This goes here as well.
#include <dt-bindings/interrupt-controller/irq.h>
Then you can use:IRQ_TYPE_NONE. IRQ_TYPE_EDGE_RISING (etc)
Documentation/devicetree/bindings/gpio/gpio-tz1090.txt line 68
Quoted 12 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090.txt new file +12
-0+ gpios: gpio-controller@02005800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "img,tz1090-gpio"; + reg = <0x02005800 0x90>; + + /* bank 0 with an interrupt */ + gpios0: bank@0 { + #gpio-cells = <2>; + #interrupt-cells = <2>; + reg = <0>; + interrupts = <13 4 /* level */>;
And it will look like:
interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
Which is way easier to understand and you no longer need to insert comments to explain things.
(...)
Quoted 1 line
+++
b/drivers/gpio/gpio-tz1090.c
(...)
drivers/gpio/gpio-tz1090.c line 44
Quoted 7 lines
drivers/gpio/gpio-tz1090.c new file +7
-0+/* REG_GPIO_IRQ_PLRT */ +#define GPIO_POLARITY_LOW 0 +#define GPIO_POLARITY_HIGH 1 + +/* REG_GPIO_IRQ_TYPE */ +#define GPIO_LEVEL_TRIGGERED 0 +#define GPIO_EDGE_TRIGGERED 1
Why does the comment start with REG_* but not the actual definition?
(...)
drivers/gpio/gpio-tz1090.c line 161
Quoted 11 lines
drivers/gpio/gpio-tz1090.c new file +11
-0+/* caller must hold LOCK2 */ +static inline void _tz1090_gpio_mod_bit (struct tz1090_gpio_bank *bank, +unsigned int reg_offs, +unsigned int offset, +int val) +{ +u32 value; + + value =tz1090_gpio_read (bank, reg_offs); + value &= ~BIT (offset); + value |= !!val << offset;
I can't parse that last line, it is equivalent to writing:
if (val)
value |= BIT(offset);
Which I think is easier to understand.
drivers/gpio/gpio-tz1090.c line 310
Quoted 9 lines
drivers/gpio/gpio-tz1090.c new file +9
-0+/* set polarity to trigger on next edge, whether rising or falling */ +static void tz1090_gpio_irq_next_edge (struct tz1090_gpio_bank *bank, +unsigned int offset) +{ +unsigned int value_p, value_i; +int lstat; + +__global_lock2 (lstat); +/* irq_polarity[offset] = !input[offset] */
This comments probably need to be a bit more verbose, like explain to readers what is happening here.
drivers/gpio/gpio-tz1090.c line 317
Quoted 7 lines
drivers/gpio/gpio-tz1090.c new file +7
-0+ value_i = ~tz1090_gpio_read (bank,REG_GPIO_DIN ); + value_p =tz1090_gpio_read (bank,REG_GPIO_IRQ_PLRT ); + value_p &= ~BIT (offset); + value_p |= value_i &BIT (offset); +tz1090_gpio_write (bank,REG_GPIO_IRQ_PLRT , value_p); +__global_unlock2 (lstat); +}
This looks like it'll work though, nice!
(...)
Quoted 4 lines
drivers/gpio/gpio-tz1090.c new file +4
-0+static struct of_device_id tz1090_gpio_of_match[] = { + { .compatible ="img,tz1090-gpio" }, + { }, +};
(...)
Quoted 1 line
+postcore_initcall(tz1090_gpio_init);
Is it really necessary to have this so early?
Apart from these remarks it is looking very good.
Yours,
Linus Walleij
Re: [PATCH v2 7/9] gpio-tz1090: add TZ1090 gpio driver
Quoted 9 lines · Linus Walleij
Quoted 6 lines · James Hogan
Add a GPIO driver for the main GPIOs found in the TZ1090 (Comet) SoC. This doesn't include low-power GPIOs as they're controlled separately via the Powerdown Controller (PDC) registers.
The driver is instantiated by device tree and supports interrupts for all GPIOs.
Quoted 6 lines
(...)
This is looking much better.
However I have some more improvement comments, due to new knowledge. I am sorry about the moving target but it's not my fault...
No worries :-)
Quoted 5 lines
And it will look like:
interrupts = <13IRQ_TYPE_LEVEL_HIGH>;Which is way easier to understand and you no longer need to insert comments to explain things.
Very nice. I like this. Thanks.
Quoted 10 lines
drivers/gpio/gpio-tz1090.c line 44
Quoted 7 lines
drivers/gpio/gpio-tz1090.c new file +7
-0+/* REG_GPIO_IRQ_PLRT */ +#define GPIO_POLARITY_LOW 0 +#define GPIO_POLARITY_HIGH 1 + +/* REG_GPIO_IRQ_TYPE */ +#define GPIO_LEVEL_TRIGGERED 0 +#define GPIO_EDGE_TRIGGERED 1Why does the comment start with REG_* but not the actual definition?
Legacy reasons (those constants were originally in that <asm/soc-tz1090/gpio.h> header). I'll clean up the naming.
Quoted 16 lines
(...)
drivers/gpio/gpio-tz1090.c line 161
Quoted 11 lines
drivers/gpio/gpio-tz1090.c new file +11
-0+/* caller must hold LOCK2 */ +static inline void _tz1090_gpio_mod_bit (struct tz1090_gpio_bank *bank, +unsigned int reg_offs, +unsigned int offset, +int val) +{ +u32 value; + + value =tz1090_gpio_read (bank, reg_offs); + value &= ~BIT (offset); + value |= !!val << offset;I can't parse that last line, it is equivalent to writing:
Quoted 4 lines
if (val)
value |= BIT(offset);Which I think is easier to understand.
Apparently I was demonstrating how premature optimisation is the root of all evil (as disassembling it testifies) :-). I'll stop doing this.
Quoted 14 lines
drivers/gpio/gpio-tz1090.c line 310
Quoted 11 lines
drivers/gpio/gpio-tz1090.c new file +9
-0+/* set polarity to trigger on next edge, whether rising or falling */ +static void tz1090_gpio_irq_next_edge (struct tz1090_gpio_bank *bank, +unsigned int offset) +{ +unsigned int value_p, value_i; +int lstat; + +__global_lock2 (lstat); +/* irq_polarity[offset] = !input[offset] */ This comments probably need to be a bit more verbose, like explain to readers what is happening here.
Okay
Quoted 3 lines
Quoted 1 line
+postcore_initcall(tz1090_gpio_init);
Is it really necessary to have this so early?
It was necessary when I wanted GPIO setup to precede platform code that hadn't been converted to DT yet but messed with GPIOs. For upstream I think I can change it to subsys_initcall to match the majority of other gpio drivers.
(for the record, in drivers/gpio/*.c:
1 core_initcall
1 device_initcall
1 late_initcall
2 pure_initcall
3 arch_initcall
14 postcore_initcall
29 subsys_initcall)
Quoted 1 line
Apart from these remarks it is looking very good.
Thanks for reviewing.
Cheers
James
Re: [PATCH v2 7/9] gpio-tz1090: add TZ1090 gpio driver
Quoted 3 lines · James Hogan
(for the record, in
drivers/gpio/*.c:
1core_initcall
1device_initcall
I think this one should go to the subsys_initicall (I didn't check, but I recall that is gpio-langwell driver).
Quoted 5 lines
1
late_initcall
2pure_initcall
3arch_initcall
14postcore_initcall
29subsys_initcall)
--
With Best Regards,
Andy Shevchenko
PATCH v2 8/9 pinctrl-tz1090-pdc: add TZ1090 PDC pinctrl driver
In reply to James HoganAdd a pin control driver for the TZ1090's low power pins via the powerdown controller SOC_GPIO_CONTROL registers.
These pins have individually controlled pull-up, and group controlled schmitt, slew-rate, drive-strength, and power-on-start (pos).
The pdc_gpio0 and pdc_gpio1 pins can also be muxed onto the ir_mod_stable_out and ir_mod_power_out functions respectively. If no function is set they remain in GPIO mode. These muxes can be overridden by requesting them as GPIOs.
---
Changes in v2:
- pinctrl-tz1090-pdc: switched to generic pinconf (a previous patch adds the BIAS_BUS_HOLD generic pinconf)
- pinctrl-tz1090-pdc: changed device tree bindings to more closely match generic pinconf (separate tristate, pull-up, pull-down, bus-hold flags instead of pull=<X>, drive-strength measured in mA)
- pinctrl-tz1090-pdc: make use of BIT() from linux/bitops.h
- pinctrl-tz1090-pdc: add a whole bunch of comments
.../bindings/pinctrl/img,tz1090-pdc-pinctrl.txt | 128 +++ arch/metag/Kconfig.soc | 1 + arch/metag/boot/dts/tz1090.dtsi | 6 + drivers/pinctrl/Kconfig | 6 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-tz1090-pdc.c | 1105 ++++++++++++++++++++ 6 files changed, 1247 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt create mode 100644 drivers/pinctrl/pinctrl-tz1090-pdc.c
Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt new file +128 -0
@@ -0,0 +1,128 @@ +ImgTec TZ1090 PDC pin controller + +Required properties: +- compatible: "img,tz1090-pdc-pinctrl" +- reg: Should contain the register physical address and length of the + SOC_GPIO_CONTROL registers in the PDC register region. + +Please refer to pinctrl-bindings.txt in this directory for details of the +common pinctrl bindings used by client devices, including the meaning of the +phrase "pin configuration node". + +TZ1090-PDC's pin configuration nodes act as a container for an abitrary number +of subnodes. Each of these subnodes represents some desired configuration for a +pin, a group, or a list of pins or groups. This configuration can include the +mux function to select on those pin(s)/group(s), and various pin configuration +parameters, such as pull-up, drive strength, etc. + +The name of each subnode is not important; all subnodes should be enumerated +and processed purely based on their content. + +Each subnode only affects those parameters that are explicitly listed. In +other words, a subnode that lists a mux function but no pin configuration +parameters implies no information about any pin configuration parameters. +Similarly, a pin subnode that describes a pullup parameter implies no +information about e.g. the mux function. For this reason, even seemingly boolean +values are actually tristates in this binding: unspecified, off, or on. +Unspecified is represented as an absent property, and off/on are represented as +integer values 0 and 1. + +Required subnode-properties: +- pins : An array of strings. Each string contains the name of a pin or group. + Valid values for these names are listed below. + +Optional subnode-properties: +- function: A string containing the name of the function to mux to the pin or + group. Valid values for function names are listed below, including which + pingroups can be muxed to them. +- tristate: Flag, put pin into high impedance state. +- pull-up: Flag, pull pin high. +- pull-down: Flag: pull pin low. +- bus-hold: Flag, weak latch last value on tristate bus. +- schmitt: Integer, enable or disable Schmitt trigger mode for the pins. + 0: no hysteresis + 1: schmitt trigger +- slew-rate: Integer, control slew rate of pins. + 0: slow (half frequency) + 1: fast +- drive-strength: Integer, control drive strength of pins in mA. + 2: 2mA + 4: 4mA + 8: 8mA + 12: 12mA +- power-on-start: Integer, power on start value of pins + 0: weak pull-down disabled + 1: weak pull-down for invalid power + +Note that many of these properties are only valid for certain specific pins +or groups. See the TZ1090 TRM for complete details regarding which groups +support which functionality. The Linux pinctrl driver may also be a useful +reference. + +Valid values for pin and group names are: + + pins: + + These all support tristate, pull-up, pull-down, and bus-hold (which can also + be provided to any of the groups below to set it for all gpio pins in that + group). + + gpio0, gpio1, sys_wake0, sys_wake1, sys_wake2, ir_data, ext_power. + + mux groups: + + These all support function. + + gpio0 + pins: gpio0. + function: ir_mod_stable_out. + gpio1 + pins: gpio1. + function: ir_mod_power_out. + + drive groups: + + These support schmitt, slew-rate, drive-strength, and power-on-start. + + pdc + pins: gpio0, gpio1, sys_wake0, sys_wake1, sys_wake2, ir_data, + ext_power. + +Example: + + pinctrl_pdc: pinctrl@02006500 { + #gpio-range-cells = <3>; + compatible = "img,tz1090-pdc-pinctrl"; + reg = <0x02006500 0x100>; + }; + +Example board file extracts: + + &pinctrl_pdc { + pinctrl-names = "default"; + pinctrl-0 = <&syswake_default>; + + syswake_default: syswakes { + syswake_cfg { + pins = "sys_wake0", + "sys_wake1", + "sys_wake2"; + pull-up; + }; + }; + irmod_default: irmod { + gpio0_cfg { + pins = "gpio0"; + function = "ir_mod_stable_out"; + }; + gpio1_cfg { + pins = "gpio1"; + function = "ir_mod_power_out"; + }; + }; + }; + + ir: ir@02006200 { + pinctrl-names = "default"; + pinctrl-0 = <&irmod_default>; + };
arch/metag/Kconfig.soc +1 -0
@@ -23,6 +23,7 @@ config SOC_TZ1090 select METAG_SMP_WRITE_REORDERING select PINCTRL select PINCTRL_TZ1090 + select PINCTRL_TZ1090_PDC help This is a Toumaz Technology Xenif TZ1090 (A.K.A. Comet) SoC containing a 2-threaded HTP.
arch/metag/boot/dts/tz1090.dtsi +6 -0
@@ -48,6 +48,12 @@ reg = <0x02005800 0xe4>; }; + pdc_pinctrl: pinctrl@02006500 { + #gpio-range-cells = <3>; + compatible = "img,tz1090-pdc-pinctrl"; + reg = <0x02006500 0x100>; + }; + gpios: gpios@02005800 { #address-cells = <1>; #size-cells = <0>;
drivers/pinctrl/Kconfig +6 -0
@@ -192,6 +192,12 @@ config PINCTRL_TZ1090 select PINMUX select GENERIC_PINCONF +config PINCTRL_TZ1090_PDC + bool "Toumaz Xenif TZ1090 PDC pin control driver" + depends on SOC_TZ1090 + select PINMUX + select PINCONF + config PINCTRL_U300 bool "U300 pin controller driver" depends on ARCH_U300
drivers/pinctrl/Makefile +1 -0
@@ -38,6 +38,7 @@ obj-$(CONFIG_PINCTRL_TEGRA20) += pinctrl-tegra20.o obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o obj-$(CONFIG_PINCTRL_TEGRA114) += pinctrl-tegra114.o obj-$(CONFIG_PINCTRL_TZ1090) += pinctrl-tz1090.o +obj-$(CONFIG_PINCTRL_TZ1090_PDC) += pinctrl-tz1090-pdc.o obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o obj-$(CONFIG_PINCTRL_SAMSUNG) += pinctrl-samsung.o
drivers/pinctrl/pinctrl-tz1090-pdc.c new file +1105 -0
1,105 lines not on this page · raw message
Signature · 1 line
1.8.1.2
Re: [PATCH v2 8/9] pinctrl-tz1090-pdc: add TZ1090 PDC pinctrl driver
Quoted 14 lines · James Hogan
+++
b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txtDocumentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt new file +12
-0+Optional subnode-properties: +- function: A string containing the name of the function to mux to the pin or + group. Valid values for function names are listed below, including which + pingroups can be muxed to them. +- tristate: Flag, put pin into high impedance state. +- pull-up: Flag, pull pin high. +- pull-down: Flag: pull pin low. +- bus-hold: Flag, weak latch last value on tristate bus. +- schmitt: Integer, enable or disable Schmitt trigger mode for the pins. + 0: no hysteresis + 1: schmitt trigger +- slew-rate: Integer, control slew rate of pins.
Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt line 55
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt new file +10
-0+ 0: slow (half frequency) + 1: fast +- drive-strength: Integer, control drive strength of pins in mA. + 2: 2mA + 4: 4mA + 8: 8mA + 12: 12mA +- power-on-start: Integer, power on start value of pins + 0: weak pull-down disabled + 1: weak pull-down for invalid power
Like on the first pinctrl patch, this needs to be genercized and moved to the core, you're even adding code duplication between two drivers here, so we really need to do something about it.
(...)
Quoted 6 lines
drivers/pinctrl/pinctrl-tz1090-pdc.c new file +6
-0+/* Describes pinconf properties/flags available from device tree */ +static const struct cfg_param { +const char *property; +enum pin_config_param param; +bool flag; +} cfg_params[] = {
drivers/pinctrl/pinctrl-tz1090-pdc.c line 430
Quoted 10 lines
drivers/pinctrl/pinctrl-tz1090-pdc.c new file +10
-0+ {"tristate", PIN_CONFIG_BIAS_HIGH_IMPEDANCE, true}, + {"pull-up", PIN_CONFIG_BIAS_PULL_UP, true}, + {"pull-down", PIN_CONFIG_BIAS_PULL_DOWN, true}, + {"bus-hold", PIN_CONFIG_BIAS_BUS_HOLD, true}, + {"power-on-start", PIN_CONFIG_LOW_POWER_MODE, true}, + {"schmitt", PIN_CONFIG_INPUT_SCHMITT_ENABLE, true}, + {"slew-rate", PIN_CONFIG_SLEW_RATE, false}, + {"drive-strength", PIN_CONFIG_DRIVE_STRENGTH, false}, + +};
Like this is looking very familiar.
Apart from that is it looking nice.
Yours,
Linus Walleij
PATCH v2 9/9 gpio-tz1090-pdc: add TZ1090 PDC gpio driver
In reply to James HoganAdd a GPIO driver for the low-power Powerdown Controller GPIOs in the TZ1090 SoC.
The driver is instantiated by device tree and supports interrupts for the SysWake GPIOs only.
---
Changes in v2:
- gpio-tz1090-pdc: remove references to Linux flags in dt bindings
- gpio-tz1090-pdc: make use of BIT() from linux/bitops.h
- gpio-tz1090-pdc: make register accessors inline to match pinctrl
- gpio-tz1090-pdc: update gpio-ranges to use 3 cells after recent ABI breakage
.../devicetree/bindings/gpio/gpio-tz1090-pdc.txt | 41 ++++ arch/metag/boot/dts/tz1090.dtsi | 14 ++ drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tz1090-pdc.c | 242 +++++++++++++++++++++ 5 files changed, 305 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt create mode 100644 drivers/gpio/gpio-tz1090-pdc.c
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt new file +41 -0
@@ -0,0 +1,41 @@ +ImgTec TZ1090 PDC GPIO Controller + +Required properties: +- compatible: Compatible property value should be "img,tz1090-pdc-gpio>". + +- reg: Physical base address of the controller and length of memory mapped + region. This starts at and cover the SOC_GPIO_CONTROL registers. + +- gpio-controller: Specifies that the node is a gpio controller. + +- #gpio-cells: Should be 2. The syntax of the gpio specifier used by client + nodes should have the following values. + <[phandle of the gpio controller node] + [PDC gpio number] + [gpio flags]> + + Values for gpio specifier: + - GPIO number: a value in the range 0 to 6. + - GPIO flags: bit field of flags: + 1: active low + +Optional properties: +- gpio-ranges: Mapping to pin controller pins + +- interrupts: Individual syswake interrupts (other GPIOs cannot interrupt) + + +Example: + + pdc_gpios: gpio-controller@02006500 { + gpio-controller; + #gpio-cells = <2>; + + compatible = "img,tz1090-pdc-gpio"; + reg = <0x02006500 0x100>; + + interrupt-parent = <&pdc>; + interrupts = <1 0 0>, /* Syswake 0 */ + <1 1 0>, /* Syswake 1 */ + <1 2 0>; /* Syswake 2 */ + };
arch/metag/boot/dts/tz1090.dtsi +14 -0
@@ -88,5 +88,19 @@ gpio-ranges = <&pinctrl 0 60 30>; }; }; + + pdc_gpios: gpios@02006500 { + gpio-controller; + #gpio-cells = <2>; + + compatible = "img,tz1090-pdc-gpio"; + reg = <0x02006500 0x100>; + + interrupt-parent = <&pdc>; + interrupts = <1 0 0>, /* Syswake 0 */ + <1 1 0>, /* Syswake 1 */ + <1 2 0>; /* Syswake 2 */ + gpio-ranges = <&pdc_pinctrl 0 0 7>; + }; }; };
drivers/gpio/Kconfig +7 -0
@@ -239,6 +239,13 @@ config GPIO_TZ1090 help Say yes here to support Toumaz Xenif TZ1090 GPIOs. +config GPIO_TZ1090_PDC + bool "Toumaz Xenif TZ1090 PDC GPIO support" + depends on SOC_TZ1090 + default y + help + Say yes here to support Toumaz Xenif TZ1090 PDC GPIOs. + config GPIO_XILINX bool "Xilinx GPIO support" depends on PPC_OF || MICROBLAZE
drivers/gpio/Makefile +1 -0
@@ -80,6 +80,7 @@ obj-$(CONFIG_GPIO_TS5500) += gpio-ts5500.o obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o obj-$(CONFIG_GPIO_TZ1090) += gpio-tz1090.o +obj-$(CONFIG_GPIO_TZ1090_PDC) += gpio-tz1090-pdc.o obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o
drivers/gpio/gpio-tz1090-pdc.c new file +242 -0
242 lines not on this page · raw message
Signature · 1 line
1.8.1.2
Re: [PATCH v2 9/9] gpio-tz1090-pdc: add TZ1090 PDC gpio driver
Quoted 2 lines · James Hogan
Add a GPIO driver for the low-power Powerdown Controller GPIOs in the TZ1090 SoC.
(...)
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt line 20
Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt new file +4
-0+ Values for gpio specifier: + - GPIO number: a value in the range 0 to 6. + - GPIO flags: bit field of flags: + 1: active low
Use #include <dt-bindings/gpio/gpio.h>
for flags and symbolic names.
Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt new file +10
-0+Optional properties: +- gpio-ranges: Mapping to pin controller pins + +- interrupts: Individual syswake interrupts (other GPIOs cannot interrupt) + + +Example: + + pdc_gpios: gpio-controller@02006500 { + gpio-controller;
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt line 41
Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt new file +10
-0+ #gpio-cells = <2>; + + compatible = "img,tz1090-pdc-gpio"; + reg = <0x02006500 0x100>; + + interrupt-parent = <&pdc>; + interrupts = <1 0 0>, /* Syswake 0 */ + <1 1 0>, /* Syswake 1 */ + <1 2 0>; /* Syswake 2 */ + };
Interrupt flags seem to be undocumented here.
Apart from this it's looking nice.
Yours,
Linus Walleij
Re: [PATCH v2 9/9] gpio-tz1090-pdc: add TZ1090 PDC gpio driver
Quoted 15 lines · Linus Walleij
Quoted 14 lines · James Hogan
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt new file +14
-0+Optional properties: +- gpio-ranges: Mapping to pin controller pins + +- interrupts: Individual syswake interrupts (other GPIOs cannot interrupt) + + +Example: + + pdc_gpios: gpio-controller@02006500 { + gpio-controller; + #gpio-cells = <2>; + + compatible = "img,tz1090-pdc-gpio"; + reg = <0x02006500 0x100>;
Quoted 8 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt line 41
Quoted 6 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt new file +6
-0+ + interrupt-parent = <&pdc>; + interrupts = <1 0 0>, /* Syswake 0 */ + <1 1 0>, /* Syswake 1 */ + <1 2 0>; /* Syswake 2 */ + };Interrupt flags seem to be undocumented here.
Hmmm yes, good spot.
Thanks
James
Re: [PATCH v2 9/9] gpio-tz1090-pdc: add TZ1090 PDC gpio driver
Quoted 25 lines · James Hogan
Quoted 15 lines · Linus Walleij
Quoted 14 lines · James Hogan
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt new file +14
-0+Optional properties: +- gpio-ranges: Mapping to pin controller pins + +- interrupts: Individual syswake interrupts (other GPIOs cannot interrupt) + + +Example: + + pdc_gpios: gpio-controller@02006500 { + gpio-controller; + #gpio-cells = <2>; + + compatible = "img,tz1090-pdc-gpio"; + reg = <0x02006500 0x100>;Quoted 8 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt line 41
Quoted 6 lines
Documentation/devicetree/bindings/gpio/gpio-tz1090-pdc.txt new file +6
-0+ + interrupt-parent = <&pdc>; + interrupts = <1 0 0>, /* Syswake 0 */ + <1 1 0>, /* Syswake 1 */ + <1 2 0>; /* Syswake 2 */ + };Interrupt flags seem to be undocumented here.
Quoted 1 line
Hmmm yes, good spot.
Looking again at this, the driver doesn't expose any new interrupts. These 3 interrupts are simply passed on by the gpio chip's to_irq() callback. The flags in the example depend entirely on the interrupt parent, in this case the PDC irq driver in patch 2, so they don't need documenting here.
Cheers
James