Skip to contentSkip to conversation

pinctrl: Add SPEAr pinctrl support

PATCH New Viresh Kumar 7 participants 17 messages Apr 16, 2012 – Apr 18, 2012 1 message not in the archive

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v4 cover pinctrl: Add SPEAr pinctrl support

This patchset replaces existing pinmux framework for SPEAr family of SoC with generic pinctrl framework.

V3->V4
- Introduced devm_of_iomap()
- placed spaces around = in dts files
- Updated groups and function names in pinctrl bindings for SPEAr

V2->V3
- Add DT bindings for pinmux mappings for SPEAr
- Pass pin maps from dtb instead of mach-spear3xx/spear3*0.c files
- use of_iomap() instead of devm_ioremap() and platform_get_resource()

V1->V2
- Earlier padmux support removed
- single patch for spear pinctrl drivers broken into two: one for spear and other for 3xx family
- add pinctrl support in arch/arm/mach-spear3xx/ and dts files
- pinctrl-spear.* made as library instead of platform driver
- pinctrl-spear300, spear310, spear320 are now platform drivers
- other minor fixes.

Viresh Kumar (5):
of: Implement managed of_iomap()
SPEAr: Remove existing padmux support for SPEAr
pinctrl: Add SPEAr pinctrl drivers
pinctrl: Add SPEAr3xx pinctrl drivers
SPEAr3xx: Add pinctrl support for boards

 .../devicetree/bindings/pinctrl/pinctrl_spear.txt  |  108 +
 Documentation/driver-model/devres.txt              |    1 +
 MAINTAINERS                                        |   23 +-
 arch/arm/boot/dts/spear300-evb.dts                 |   38 +
 arch/arm/boot/dts/spear300.dtsi                    |    5 +
 arch/arm/boot/dts/spear310-evb.dts                 |   61 +
 arch/arm/boot/dts/spear310.dtsi                    |    5 +
 arch/arm/boot/dts/spear320-evb.dts                 |   61 +
 arch/arm/boot/dts/spear320.dtsi                    |    7 +-
 arch/arm/mach-spear3xx/Kconfig                     |    3 +
 arch/arm/mach-spear3xx/include/mach/generic.h      |  128 -
 arch/arm/mach-spear3xx/spear300.c                  |  389 +---
 arch/arm/mach-spear3xx/spear310.c                  |  161 +-
 arch/arm/mach-spear3xx/spear320.c                  |  403 +---
 arch/arm/mach-spear3xx/spear3xx.c                  |  425 ---
 arch/arm/plat-spear/Kconfig                        |    1 +
 arch/arm/plat-spear/Makefile                       |    2 +-
 arch/arm/plat-spear/include/plat/padmux.h          |   92 -
 arch/arm/plat-spear/padmux.c                       |  164 -
 drivers/of/address.c                               |   22 +
 drivers/pinctrl/Kconfig                            |    2 +
 drivers/pinctrl/Makefile                           |    2 +
 drivers/pinctrl/spear/Kconfig                      |   34 +
 drivers/pinctrl/spear/Makefile                     |    7 +
 drivers/pinctrl/spear/pinctrl-spear.c              |  349 ++
 drivers/pinctrl/spear/pinctrl-spear.h              |  142 +
 drivers/pinctrl/spear/pinctrl-spear300.c           |  708 ++++
 drivers/pinctrl/spear/pinctrl-spear310.c           |  431 +++
 drivers/pinctrl/spear/pinctrl-spear320.c           | 3468 ++++++++++++++++++++
 drivers/pinctrl/spear/pinctrl-spear3xx.c           |  588 ++++
 drivers/pinctrl/spear/pinctrl-spear3xx.h           |   92 +
 include/linux/of_address.h                         |    5 +
 32 files changed, 6151 insertions(+), 1776 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt
 delete mode 100644 arch/arm/plat-spear/include/plat/padmux.h
 delete mode 100644 arch/arm/plat-spear/padmux.c
 create mode 100644 drivers/pinctrl/spear/Kconfig
 create mode 100644 drivers/pinctrl/spear/Makefile
 create mode 100644 drivers/pinctrl/spear/pinctrl-spear.c
 create mode 100644 drivers/pinctrl/spear/pinctrl-spear.h
 create mode 100644 drivers/pinctrl/spear/pinctrl-spear300.c
 create mode 100644 drivers/pinctrl/spear/pinctrl-spear310.c
 create mode 100644 drivers/pinctrl/spear/pinctrl-spear320.c
 create mode 100644 drivers/pinctrl/spear/pinctrl-spear3xx.c
 create mode 100644 drivers/pinctrl/spear/pinctrl-spear3xx.h
Signature · 1 line
1.7.9
#1 lore raw

PATCH v4 1/5 of: Implement managed of_iomap()

This simplifies cleanup paths of user code by providing managed version of of_iomap().

---
 Documentation/driver-model/devres.txt |    1 +
 drivers/of/address.c                  |   22 ++++++++++++++++++++++
 include/linux/of_address.h            |    5 +++++
 3 files changed, 28 insertions(+), 0 deletions(-)
Documentation/driver-model/devres.txt +1 -0
index 2a596a4..74f0f92 100644
@@ -266,6 +266,7 @@ IOMAP
   devm_ioremap()
   devm_ioremap_nocache()
   devm_iounmap()
+  devm_of_iomap()
   devm_request_and_ioremap() : checks resource, requests region, ioremaps
   pcim_iomap()
   pcim_iounmap()
drivers/of/address.c +22 -0
index 66d96f1..f58eb4c 100644
@@ -619,3 +619,25 @@ void __iomem *of_iomap(struct device_node *np, int index)
 	return ioremap(res.start, resource_size(&res));
 }
 EXPORT_SYMBOL(of_iomap);
+
+/**
+ * devm_of_iomap - Maps the managed memory mapped IO for a given device
+ * @dev:	the device whose io range will be mapped
+ * @index:	index of the io range
+ *
+ * Returns a pointer to the mapped memory
+ */
+void __iomem *devm_of_iomap(struct device *dev, int index)
+{
+	struct device_node *np = dev->of_node;
+	struct resource res;
+
+	if (!np)
+		return NULL;
+
+	if (of_address_to_resource(np, index, &res))
+		return NULL;
+
+	return devm_ioremap(dev, res.start, resource_size(&res));
+}
+EXPORT_SYMBOL(devm_of_iomap);
include/linux/of_address.h +5 -0
index 01b925a..5ba9ea8 100644
@@ -13,6 +13,7 @@ extern struct device_node *of_find_matching_node_by_address(
 					const struct of_device_id *matches,
 					u64 base_address);
 extern void __iomem *of_iomap(struct device_node *device, int index);
+extern void __iomem *devm_of_iomap(struct device *dev, int index);
 
 /* Extract an address from a device, returns the region size and
  * the address space flags too. The PCI version uses a BAR number
@@ -43,6 +44,10 @@ static inline void __iomem *of_iomap(struct device_node *device, int index)
 {
 	return NULL;
 }
+static inline void __iomem *devm_of_iomap(struct device *dev, int index)
+{
+	return NULL;
+}
 static inline const u32 *of_get_address(struct device_node *dev, int index,
 					u64 *size, unsigned int *flags)
 {
Signature · 1 line
1.7.9
#2 lore raw

PATCH v4 1/5 of: Implement managed of_iomap()

Quoted 5 lines · Viresh Kumar

This simplifies cleanup paths of user code by providing managed version of of_iomap().

Let's CC Rob Herring on this too in order not to overload Grant...

Yours,
Linus Walleij

#3 lore raw

PATCH v4 1/5 of: Implement managed of_iomap()

In reply to Viresh Kumar
Quoted 5 lines · Viresh Kumar

This simplifies cleanup paths of user code by providing managed version of of_iomap().

This one looks good,

but I wonder if we should also have a devm_of_request_and_ioremap (maybe with a shorter name) that combines this with request_resource.

Arnd

#4 lore raw

PATCH v4 1/5 of: Implement managed of_iomap()

Quoted 8 lines · Arnd Bergmann
Quoted 5 lines · Viresh Kumar

This simplifies cleanup paths of user code by providing managed version of of_iomap().

Quoted 6 lines

This one looks good,

but I wonder if we should also have a devm_of_request_and_ioremap (maybe with a shorter name) that combines this with request_resource.

Why is this function needed? I'm directing drivers away from using of_iomap now since the resource table is populated with the address ranges at device registration time now. New code should be using platform_get_resource() if it is a platform device.

g.

#5 lore raw

Re: [PATCH V4 1/5] of: Implement managed of_iomap()

Quoted 6 lines · Grant Likely

Why is this function needed? I'm directing drivers away from using of_iomap now since the resource table is populated with the address ranges at device registration time now. New code should be using platform_get_resource() if it is a platform device.

I thought we must call of_iomap for
DT only drivers.
Isn't that the case?

--
Viresh

_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

#6 lore raw

PATCH v4 1/5 of: Implement managed of_iomap()

Quoted 9 lines · viresh kumar
Quoted 6 lines · Grant Likely

Why is this function needed? ?I'm directing drivers away from using of_iomap now since the resource table is populated with the address ranges at device registration time now. ?New code should be using platform_get_resource() if it is a platform device.

Quoted 3 lines

I thought we must call of_iomap for
DT only drivers.
Isn't that the case?

It isn't recommended anymore. Use the bus_type specific helpers instead.

g.

#7 lore raw

PATCH v4 1/5 of: Implement managed of_iomap()

Quoted 1 line · Grant Likely

It isn't recommended anymore. Use the bus_type specific helpers instead.

Ok. So here is fixup for 3/5 of this patchset.

@Linus: I will merge this with PACH 3/5 and send pull request to Arnd.

fixup! pinctrl: Add SPEAr pinctrl drivers

---
 drivers/pinctrl/spear/pinctrl-spear.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/drivers/pinctrl/spear/pinctrl-spear.c
index ad70be7..3ec53df 100644

drivers/pinctrl/spear/pinctrl-spear.c +0 -0
@@ -289,18 +289,23 @@ int __devinit spear_pinctrl_probe(struct

platform_device *pdev,
struct spear_pinctrl_machdata *machdata)
{
struct device_node *np = pdev->dev.of_node;
+ struct resource *res;
struct spear_pmx *pmx;

if (!machdata)
return -ENODEV;

+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -EINVAL;
+
pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL); if (!pmx) {
dev_err(&pdev->dev, "Can't alloc spear_pmx\n"); return -ENOMEM;
}

- pmx->vbase = devm_of_iomap(&pdev->dev, 0);
+ pmx->vbase = devm_ioremap(&pdev->dev, res->start, resource_size(res));
if (!pmx->vbase) {
dev_err(&pdev->dev, "Couldn't ioremap at index 0\n"); return -ENODEV;

#8 lore raw

PATCH v4 1/5 of: Implement managed of_iomap()

Quoted 8 lines · viresh kumar
Quoted 1 line · Grant Likely

It isn't recommended anymore. Use the bus_type specific helpers instead.

Ok. So here is fixup for 3/5 of this patchset.

@Linus: I will merge this with PACH 3/5 and send pull request to Arnd.

fixup! pinctrl: Add SPEAr pinctrl drivers

Cool, thanks.

Now what you *could* do is something like devm_platform_ioremap() that gets the resource, does request_region() and ioremap(). That would cut a lot of boilerplate out of drivers. :-)

g.

A message that is not in the archive (sent off-list or not yet received): CACxGe6t9+M5jQKkRduup7_wk4SKYu1SuTz7wzf0MEvo0poojRw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#10 lore raw

Re: [PATCH V4 1/5] of: Implement managed of_iomap()

Quoted 7 lines · Grant Likely

Cool, thanks.

Now what you *could* do is something like devm_platform_ioremap() that gets the resource, does request_region() and ioremap(). That would cut a lot of boilerplate out of drivers. :-)

I wanted to, but i wasn't using request_region() so skipped it.
Will do that in a separate patch and send it to you.

Viresh

_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

#11 lore raw

PATCH v4 1/5 of: Implement managed of_iomap()

In reply to Grant Likely

Hello.

Quoted 6 lines · Grant Likely
Quoted 5 lines
Quoted 1 line

It isn't recommended anymore. Use the bus_type specific helpers instead.

Ok. So here is fixup for 3/5 of this patchset.

@Linus: I will merge this with PACH 3/5 and send pull request to Arnd.

Quoted 7 lines
Quoted 1 line

fixup! pinctrl: Add SPEAr pinctrl drivers

Cool, thanks.

Now what you *could* do is something like devm_platform_ioremap() that gets the resource, does request_region() and ioremap(). That would cut a lot of boilerplate out of drivers. :-)

That is already done, called devm_request_and_ioremap().

WRB, Sergei

#12 lore raw

PATCH v4 2/5 SPEAr: Remove existing padmux support for SPEAr

In reply to Viresh Kumar

We must use pinctrl framework instead of defining per SoC pinmux drivers. This patch removes existing padmux support present for SPEAr platform.

---
 arch/arm/mach-spear3xx/include/mach/generic.h |  128 --------
 arch/arm/mach-spear3xx/spear300.c             |  389 +----------------------
 arch/arm/mach-spear3xx/spear310.c             |  161 +----------
 arch/arm/mach-spear3xx/spear320.c             |  403 +-----------------------
 arch/arm/mach-spear3xx/spear3xx.c             |  425 -------------------------
 arch/arm/plat-spear/Makefile                  |    2 +-
 arch/arm/plat-spear/include/plat/padmux.h     |   92 ------
 arch/arm/plat-spear/padmux.c                  |  164 ----------
 8 files changed, 4 insertions(+), 1760 deletions(-)
 delete mode 100644 arch/arm/plat-spear/include/plat/padmux.h
 delete mode 100644 arch/arm/plat-spear/padmux.c
arch/arm/mach-spear3xx/include/mach/generic.h +0 -128
index a756958..9603bf4 100644
@@ -20,7 +20,6 @@
 #include <linux/amba/bus.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
-#include <plat/padmux.h>
 
 /* spear3xx declarations */
 /*
@@ -43,147 +42,20 @@ void __init spear3xx_dt_init_irq(void);
 
 void spear_restart(char, const char *);
 
-/* pad mux declarations */
-#define PMX_FIRDA_MASK		(1 << 14)
-#define PMX_I2C_MASK		(1 << 13)
-#define PMX_SSP_CS_MASK		(1 << 12)
-#define PMX_SSP_MASK		(1 << 11)
-#define PMX_MII_MASK		(1 << 10)
-#define PMX_GPIO_PIN0_MASK	(1 << 9)
-#define PMX_GPIO_PIN1_MASK	(1 << 8)
-#define PMX_GPIO_PIN2_MASK	(1 << 7)
-#define PMX_GPIO_PIN3_MASK	(1 << 6)
-#define PMX_GPIO_PIN4_MASK	(1 << 5)
-#define PMX_GPIO_PIN5_MASK	(1 << 4)
-#define PMX_UART0_MODEM_MASK	(1 << 3)
-#define PMX_UART0_MASK		(1 << 2)
-#define PMX_TIMER_3_4_MASK	(1 << 1)
-#define PMX_TIMER_1_2_MASK	(1 << 0)
-
-/* pad mux devices */
-extern struct pmx_dev spear3xx_pmx_firda;
-extern struct pmx_dev spear3xx_pmx_i2c;
-extern struct pmx_dev spear3xx_pmx_ssp_cs;
-extern struct pmx_dev spear3xx_pmx_ssp;
-extern struct pmx_dev spear3xx_pmx_mii;
-extern struct pmx_dev spear3xx_pmx_gpio_pin0;
-extern struct pmx_dev spear3xx_pmx_gpio_pin1;
-extern struct pmx_dev spear3xx_pmx_gpio_pin2;
-extern struct pmx_dev spear3xx_pmx_gpio_pin3;
-extern struct pmx_dev spear3xx_pmx_gpio_pin4;
-extern struct pmx_dev spear3xx_pmx_gpio_pin5;
-extern struct pmx_dev spear3xx_pmx_uart0_modem;
-extern struct pmx_dev spear3xx_pmx_uart0;
-extern struct pmx_dev spear3xx_pmx_timer_3_4;
-extern struct pmx_dev spear3xx_pmx_timer_1_2;
-
-#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
-/* padmux plgpio devices */
-extern struct pmx_dev spear3xx_pmx_plgpio_0_1;
-extern struct pmx_dev spear3xx_pmx_plgpio_2_3;
-extern struct pmx_dev spear3xx_pmx_plgpio_4_5;
-extern struct pmx_dev spear3xx_pmx_plgpio_6_9;
-extern struct pmx_dev spear3xx_pmx_plgpio_10_27;
-extern struct pmx_dev spear3xx_pmx_plgpio_28;
-extern struct pmx_dev spear3xx_pmx_plgpio_29;
-extern struct pmx_dev spear3xx_pmx_plgpio_30;
-extern struct pmx_dev spear3xx_pmx_plgpio_31;
-extern struct pmx_dev spear3xx_pmx_plgpio_32;
-extern struct pmx_dev spear3xx_pmx_plgpio_33;
-extern struct pmx_dev spear3xx_pmx_plgpio_34_36;
-extern struct pmx_dev spear3xx_pmx_plgpio_37_42;
-extern struct pmx_dev spear3xx_pmx_plgpio_43_44_47_48;
-extern struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50;
-#endif
-
 /* spear300 declarations */
 #ifdef CONFIG_MACH_SPEAR300
-/* pad mux modes */
-extern struct pmx_mode spear300_nand_mode;
-extern struct pmx_mode spear300_nor_mode;
-extern struct pmx_mode spear300_photo_frame_mode;
-extern struct pmx_mode spear300_lend_ip_phone_mode;
-extern struct pmx_mode spear300_hend_ip_phone_mode;
-extern struct pmx_mode spear300_lend_wifi_phone_mode;
-extern struct pmx_mode spear300_hend_wifi_phone_mode;
-extern struct pmx_mode spear300_ata_pabx_wi2s_mode;
-extern struct pmx_mode spear300_ata_pabx_i2s_mode;
-extern struct pmx_mode spear300_caml_lcdw_mode;
-extern struct pmx_mode spear300_camu_lcd_mode;
-extern struct pmx_mode spear300_camu_wlcd_mode;
-extern struct pmx_mode spear300_caml_lcd_mode;
-
-/* pad mux devices */
-extern struct pmx_dev spear300_pmx_fsmc_2_chips;
-extern struct pmx_dev spear300_pmx_fsmc_4_chips;
-extern struct pmx_dev spear300_pmx_keyboard;
-extern struct pmx_dev spear300_pmx_clcd;
-extern struct pmx_dev spear300_pmx_telecom_gpio;
-extern struct pmx_dev spear300_pmx_telecom_tdm;
-extern struct pmx_dev spear300_pmx_telecom_spi_cs_i2c_clk;
-extern struct pmx_dev spear300_pmx_telecom_camera;
-extern struct pmx_dev spear300_pmx_telecom_dac;
-extern struct pmx_dev spear300_pmx_telecom_i2s;
-extern struct pmx_dev spear300_pmx_telecom_boot_pins;
-extern struct pmx_dev spear300_pmx_telecom_sdhci_4bit;
-extern struct pmx_dev spear300_pmx_telecom_sdhci_8bit;
-extern struct pmx_dev spear300_pmx_gpio1;
-
-/* Add spear300 machine declarations here */
 void __init spear300_clk_init(void);
 
 #endif /* CONFIG_MACH_SPEAR300 */
 
 /* spear310 declarations */
 #ifdef CONFIG_MACH_SPEAR310
-/* pad mux devices */
-extern struct pmx_dev spear310_pmx_emi_cs_0_1_4_5;
-extern struct pmx_dev spear310_pmx_emi_cs_2_3;
-extern struct pmx_dev spear310_pmx_uart1;
-extern struct pmx_dev spear310_pmx_uart2;
-extern struct pmx_dev spear310_pmx_uart3_4_5;
-extern struct pmx_dev spear310_pmx_fsmc;
-extern struct pmx_dev spear310_pmx_rs485_0_1;
-extern struct pmx_dev spear310_pmx_tdm0;
-
-/* Add spear310 machine declarations here */
 void __init spear310_clk_init(void);
 
 #endif /* CONFIG_MACH_SPEAR310 */
 
 /* spear320 declarations */
 #ifdef CONFIG_MACH_SPEAR320
-/* pad mux modes */
-extern struct pmx_mode spear320_auto_net_smii_mode;
-extern struct pmx_mode spear320_auto_net_mii_mode;
-extern struct pmx_mode spear320_auto_exp_mode;
-extern struct pmx_mode spear320_small_printers_mode;
-
-/* pad mux devices */
-extern struct pmx_dev spear320_pmx_clcd;
-extern struct pmx_dev spear320_pmx_emi;
-extern struct pmx_dev spear320_pmx_fsmc;
-extern struct pmx_dev spear320_pmx_spp;
-extern struct pmx_dev spear320_pmx_sdhci;
-extern struct pmx_dev spear320_pmx_i2s;
-extern struct pmx_dev spear320_pmx_uart1;
-extern struct pmx_dev spear320_pmx_uart1_modem;
-extern struct pmx_dev spear320_pmx_uart2;
-extern struct pmx_dev spear320_pmx_touchscreen;
-extern struct pmx_dev spear320_pmx_can;
-extern struct pmx_dev spear320_pmx_sdhci_led;
-extern struct pmx_dev spear320_pmx_pwm0;
-extern struct pmx_dev spear320_pmx_pwm1;
-extern struct pmx_dev spear320_pmx_pwm2;
-extern struct pmx_dev spear320_pmx_pwm3;
-extern struct pmx_dev spear320_pmx_ssp1;
-extern struct pmx_dev spear320_pmx_ssp2;
-extern struct pmx_dev spear320_pmx_mii1;
-extern struct pmx_dev spear320_pmx_smii0;
-extern struct pmx_dev spear320_pmx_smii1;
-extern struct pmx_dev spear320_pmx_i2c1;
-
-/* Add spear320 machine declarations here */
 void __init spear320_clk_init(void);
 
 #endif /* CONFIG_MACH_SPEAR320 */
arch/arm/mach-spear3xx/spear300.c +1 -388

413 lines not on this page · raw message

arch/arm/mach-spear3xx/spear310.c +1 -160

185 lines not on this page · raw message

arch/arm/mach-spear3xx/spear320.c +1 -402

427 lines not on this page · raw message

arch/arm/mach-spear3xx/spear3xx.c +0 -425

431 lines not on this page · raw message

arch/arm/plat-spear/Makefile +1 -1
index 4af6258..7744802 100644
@@ -5,4 +5,4 @@
 # Common support
 obj-y	:= clock.o restart.o time.o pl080.o
 
-obj-$(CONFIG_ARCH_SPEAR3XX)	+= shirq.o padmux.o
+obj-$(CONFIG_ARCH_SPEAR3XX)	+= shirq.o
arch/arm/plat-spear/include/plat/padmux.h deleted +0 -92

92 lines not on this page · raw message

arch/arm/plat-spear/padmux.c deleted +0 -164

164 lines not on this page · raw message

Signature · 1 line
1.7.9
#13 lore raw

PATCH v4 3/5 pinctrl: Add SPEAr pinctrl drivers

In reply to Viresh Kumar

This adds pinctrl driver for SPEAr platform. It also updates MAINTAINERS file for SPEAr pinctrl drivers.

---
 MAINTAINERS                           |   23 +--
 drivers/pinctrl/Kconfig               |    2 +
 drivers/pinctrl/Makefile              |    2 +
 drivers/pinctrl/spear/Kconfig         |   14 ++
 drivers/pinctrl/spear/Makefile        |    3 +
 drivers/pinctrl/spear/pinctrl-spear.c |  349 +++++++++++++++++++++++++++++++++
 drivers/pinctrl/spear/pinctrl-spear.h |  142 +++++++++++++
 7 files changed, 520 insertions(+), 15 deletions(-)
 create mode 100644 drivers/pinctrl/spear/Kconfig
 create mode 100644 drivers/pinctrl/spear/Makefile
 create mode 100644 drivers/pinctrl/spear/pinctrl-spear.c
 create mode 100644 drivers/pinctrl/spear/pinctrl-spear.h
MAINTAINERS +8 -15
index 7e7ec09..1f2bc24 100644
@@ -5233,6 +5233,14 @@ M:	Linus Walleij <[email protected]>
 S:	Maintained
 F:	drivers/pinctrl/
 
+PIN CONTROLLER - ST SPEAR
+M:	Viresh Kumar <[email protected]>
+L:	spear-devel at list.st.com
+L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
+W:	http://www.st.com/spear
+S:	Maintained
+F:	driver/pinctrl/spear/
+
 PKTCDVD DRIVER
 M:	Peter Osterlund <[email protected]>
 S:	Maintained
@@ -6329,21 +6337,6 @@ F:	arch/arm/mach-spear*/clock.c
 F:	arch/arm/plat-spear/clock.c
 F:	arch/arm/plat-spear/include/plat/clock.h
 
-SPEAR PAD MULTIPLEXING SUPPORT
-M:	Viresh Kumar <[email protected]>
-L:	spear-devel at list.st.com
-L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
-W:	http://www.st.com/spear
-S:	Maintained
-F:	arch/arm/plat-spear/include/plat/padmux.h
-F:	arch/arm/plat-spear/padmux.c
-F:	arch/arm/mach-spear*/spear*xx.c
-F:	arch/arm/mach-spear*/include/mach/generic.h
-F:	arch/arm/mach-spear3xx/spear3*0.c
-F:	arch/arm/mach-spear3xx/spear3*0_evb.c
-F:	arch/arm/mach-spear6xx/spear600.c
-F:	arch/arm/mach-spear6xx/spear600_evb.c
-
 SPI SUBSYSTEM
 M:	Grant Likely <[email protected]>
 L:	spi-devel-general at lists.sourceforge.net
drivers/pinctrl/Kconfig +2 -0
index d68c878..9908bba 100644
@@ -89,6 +89,8 @@ config PINCTRL_COH901
 	  COH 901 335 and COH 901 571/3. They contain 3, 5 or 7
 	  ports of 8 GPIO pins each.
 
+source "drivers/pinctrl/spear/Kconfig"
+
 endmenu
 
 endif
drivers/pinctrl/Makefile +2 -0
index 5412f60..878a2dc 100644
@@ -17,3 +17,5 @@ obj-$(CONFIG_PINCTRL_TEGRA20)	+= pinctrl-tegra20.o
 obj-$(CONFIG_PINCTRL_TEGRA30)	+= pinctrl-tegra30.o
 obj-$(CONFIG_PINCTRL_U300)	+= pinctrl-u300.o
 obj-$(CONFIG_PINCTRL_COH901)	+= pinctrl-coh901.o
+
+obj-$(CONFIG_PLAT_SPEAR)	+= spear/
drivers/pinctrl/spear/Kconfig new file +14 -0
new file mode 100644
index 0000000..47a0e295
@@ -0,0 +1,14 @@
+#
+# ST Microelectronics SPEAr PINCTRL drivers
+#
+
+if PLAT_SPEAR
+
+config PINCTRL_SPEAR
+	bool
+	depends on OF
+	select PINMUX
+	help
+	  This enables pin control drivers for SPEAr Platform
+
+endif
drivers/pinctrl/spear/Makefile new file +3 -0
new file mode 100644
index 0000000..69c1a51
@@ -0,0 +1,3 @@
+# SPEAr pinmux support
+
+obj-$(CONFIG_PINCTRL_SPEAR)	+= pinctrl-spear.o
drivers/pinctrl/spear/pinctrl-spear.c new file +349 -0

349 lines not on this page · raw message

drivers/pinctrl/spear/pinctrl-spear.h new file +142 -0

142 lines not on this page · raw message

Signature · 1 line
1.7.9
#14 lore raw

PATCH v4 3/5 pinctrl: Add SPEAr pinctrl drivers

drivers/pinctrl/spear/pinctrl-spear.c line 155

Quoted 12 lines · Viresh KUMAR
drivers/pinctrl/spear/pinctrl-spear.c +9 -0
 
+int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
+				 struct device_node *np_config,
+				 struct pinctrl_map **map, unsigned *num_maps)
+{
 
+
+	*map = kzalloc(sizeof(*map) * count, GFP_KERNEL);
+	if (!*map)
+		return -ENOMEM;
+

Linus,

This was the place that caused crash for me.

I would apply following change in my patch before sending pull request to Arnd.

- *map = kzalloc(sizeof(*map) * count, GFP_KERNEL);
+ *map = kzalloc(sizeof(**map) * count, GFP_KERNEL);

--
viresh

#15 lore raw

PATCH v4 3/5 pinctrl: Add SPEAr pinctrl drivers

Quoted 7 lines · Viresh Kumar

This was the place that caused crash for me.

I would apply following change in my patch before sending pull request to Arnd.

- ? ? ? *map = kzalloc(sizeof(*map) * count, GFP_KERNEL);
+ ? ? ? *map = kzalloc(sizeof(**map) * count, GFP_KERNEL);

Ah, great you found it!

Thanks,
Linus Walleij

#16 lore raw

PATCH v4 5/5 SPEAr3xx: Add pinctrl support for boards

In reply to Viresh Kumar
---
 arch/arm/boot/dts/spear300-evb.dts |   38 ++++++++++++++++++++++
 arch/arm/boot/dts/spear300.dtsi    |    5 +++
 arch/arm/boot/dts/spear310-evb.dts |   61 ++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/spear310.dtsi    |    5 +++
 arch/arm/boot/dts/spear320-evb.dts |   61 ++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/spear320.dtsi    |    7 +++-
 arch/arm/mach-spear3xx/Kconfig     |    3 ++
 arch/arm/plat-spear/Kconfig        |    1 +
 8 files changed, 180 insertions(+), 1 deletions(-)
arch/arm/boot/dts/spear300-evb.dts +38 -0
index eaecc29..402ca0d 100644
@@ -25,6 +25,44 @@
 	};
 
 	ahb {
+		pinmux at 99000000 {
+			st,pinmux-mode = <2>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&state_default>;
+
+			state_default: pinmux {
+				i2c0 {
+					st,pins = "i2c0_grp";
+					st,function = "i2c0";
+				};
+				ssp0 {
+					st,pins = "ssp0_grp";
+					st,function = "ssp0";
+				};
+				mii0 {
+					st,pins = "mii0_grp";
+					st,function = "mii0";
+				};
+				uart0 {
+					st,pins = "uart0_grp";
+					st,function = "uart0";
+				};
+				clcd {
+					st,pins = "clcd_pfmode_grp";
+					st,function = "clcd";
+				};
+				sdhci {
+					st,pins = "sdhci_4bit_grp";
+					st,function = "sdhci";
+				};
+				gpio1 {
+					st,pins = "gpio1_4_to_7_grp",
+						"gpio1_0_to_3_grp";
+					st,function = "gpio1";
+				};
+			};
+		};
+
 		clcd at 60000000 {
 			status = "okay";
 		};
arch/arm/boot/dts/spear300.dtsi +5 -0
index f9fcbf4..01c5e35 100644
@@ -21,6 +21,11 @@
 		ranges = <0x60000000 0x60000000 0x50000000
 			  0xd0000000 0xd0000000 0x30000000>;
 
+		pinmux at 99000000 {
+			compatible = "st,spear300-pinmux";
+			reg = <0x99000000 0x1000>;
+		};
+
 		clcd at 60000000 {
 			compatible = "arm,clcd-pl110", "arm,primecell";
 			reg = <0x60000000 0x1000>;
arch/arm/boot/dts/spear310-evb.dts +61 -0

67 lines not on this page · raw message

arch/arm/boot/dts/spear310.dtsi +5 -0
index dc7fa14..e47081c 100644
@@ -22,6 +22,11 @@
 			  0xb0000000 0xb0000000 0x10000000
 			  0xd0000000 0xd0000000 0x30000000>;
 
+		pinmux at b4000000 {
+			compatible = "st,spear310-pinmux";
+			reg = <0xb4000000 0x1000>;
+		};
+
 		fsmc: flash at 44000000 {
 			compatible = "st,spear600-fsmc-nand";
 			#address-cells = <1>;
arch/arm/boot/dts/spear320-evb.dts +61 -0

67 lines not on this page · raw message

arch/arm/boot/dts/spear320.dtsi +6 -1
index 9a0267a..5372ca3 100644
@@ -18,9 +18,14 @@
 		#address-cells = <1>;
 		#size-cells = <1>;
 		compatible = "simple-bus";
-		ranges = <0x40000000 0x40000000 0x70000000
+		ranges = <0x40000000 0x40000000 0x80000000
 			  0xd0000000 0xd0000000 0x30000000>;
 
+		pinmux at b3000000 {
+			compatible = "st,spear320-pinmux";
+			reg = <0xb3000000 0x1000>;
+		};
+
 		clcd at 90000000 {
 			compatible = "arm,clcd-pl110", "arm,primecell";
 			reg = <0x90000000 0x1000>;
arch/arm/mach-spear3xx/Kconfig +3 -0
index d9fe11c..8bd3729 100644
@@ -7,16 +7,19 @@ if ARCH_SPEAR3XX
 menu "SPEAr3xx Implementations"
 config MACH_SPEAR300
 	bool "SPEAr300 Machine support with Device Tree"
+	select PINCTRL_SPEAR300
 	help
 	  Supports ST SPEAr300 machine configured via the device-tree
 
 config MACH_SPEAR310
 	bool "SPEAr310 Machine support with Device Tree"
+	select PINCTRL_SPEAR310
 	help
 	  Supports ST SPEAr310 machine configured via the device-tree
 
 config MACH_SPEAR320
 	bool "SPEAr320 Machine support with Device Tree"
+	select PINCTRL_SPEAR320
 	help
 	  Supports ST SPEAr320 machine configured via the device-tree
 endmenu
arch/arm/plat-spear/Kconfig +1 -0
index 6c066fc..387655b 100644
@@ -13,6 +13,7 @@ config ARCH_SPEAR3XX
 	select ARM_VIC
 	select CPU_ARM926T
 	select USE_OF
+	select PINCTRL
 	help
 	  Supports for ARM's SPEAR3XX family
 
Signature · 1 line
1.7.9
#17 lore raw

v4 cover pinctrl: Add SPEAr pinctrl support

In reply to Viresh Kumar
Quoted 2 lines · Viresh Kumar

This patchset replaces existing pinmux framework for SPEAr family of SoC with generic pinctrl framework.

Real nice work on this patchset Viresh, much appreciated!

We're going to establish a merge base with the latest pinctrl development in ARM-SoC I think, that would benefit all:
SPEAr, Tegra, Ux500 maybe i.MX too...

Yours,
Linus Walleij