Skip to contentSkip to conversation

ARM: pxa: Prepare pxa2xx pcmcia for pxa320

PATCH New Marek Vasut 2 participants 28 messages Sep 16, 2010 – Oct 1, 2010

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

PATCH 1/11 ARM: pxa: Prepare pxa2xx pcmcia for pxa320

PXA320 also supports PCMCIA/CF interface. This patch generalizes register access in pxa2xx_pcmcia so the pxa320 is now supported as well.

---
 drivers/pcmcia/pxa2xx_base.c |   91 ++++++++++++++++++++++++++++++++----------
 1 files changed, 70 insertions(+), 21 deletions(-)
drivers/pcmcia/pxa2xx_base.c +70 -21
index ae07b4d..3eb76c8 100644
@@ -84,6 +84,16 @@
 #define MCXX_ASST_SHIFT     (7)
 #define MCXX_HOLD_SHIFT     (14)
 
+#define	PXA2XX_SMC_BASE		(0x48000000)
+#define	PXA3XX_SMC_BASE		(0x4a000000)
+#define	MECR_OFFSET		(0x14)
+#define	MCMEM_OFFSET		(0x28)
+#define	MCATT_OFFSET		(0x30)
+#define	MCIO_OFFSET		(0x38)
+#define	MCIO_OFFSET		(0x38)
+
+static void __iomem *base;
+
 static inline u_int pxa2xx_mcxx_hold(u_int pcmcia_cycle_ns,
 				     u_int mem_clk_10khz)
 {
@@ -114,39 +124,57 @@ static inline u_int pxa2xx_pcmcia_cmd_time(u_int mem_clk_10khz,
 	return (300000 * (pcmcia_mcxx_asst + 1) / mem_clk_10khz);
 }
 
+static inline void pxa2xx_pcmcia_set_reg( uint32_t reg, uint32_t sock,
+					uint32_t val )
+{
+	writel(val, base + reg + (sock << 4));
+}
+
 static int pxa2xx_pcmcia_set_mcmem( int sock, int speed, int clock )
 {
-	MCMEM(sock) = ((pxa2xx_mcxx_setup(speed, clock)
+	uint32_t val;
+
+	val = ((pxa2xx_mcxx_setup(speed, clock)
 		& MCXX_SETUP_MASK) << MCXX_SETUP_SHIFT)
 		| ((pxa2xx_mcxx_asst(speed, clock)
 		& MCXX_ASST_MASK) << MCXX_ASST_SHIFT)
 		| ((pxa2xx_mcxx_hold(speed, clock)
 		& MCXX_HOLD_MASK) << MCXX_HOLD_SHIFT);
 
+	pxa2xx_pcmcia_set_reg(MCMEM_OFFSET, sock, val);
+
 	return 0;
 }
 
 static int pxa2xx_pcmcia_set_mcio( int sock, int speed, int clock )
 {
-	MCIO(sock) = ((pxa2xx_mcxx_setup(speed, clock)
+	uint32_t val;
+
+	val = ((pxa2xx_mcxx_setup(speed, clock)
 		& MCXX_SETUP_MASK) << MCXX_SETUP_SHIFT)
 		| ((pxa2xx_mcxx_asst(speed, clock)
 		& MCXX_ASST_MASK) << MCXX_ASST_SHIFT)
 		| ((pxa2xx_mcxx_hold(speed, clock)
 		& MCXX_HOLD_MASK) << MCXX_HOLD_SHIFT);
 
+	pxa2xx_pcmcia_set_reg(MCIO_OFFSET, sock, val);
+
 	return 0;
 }
 
 static int pxa2xx_pcmcia_set_mcatt( int sock, int speed, int clock )
 {
-	MCATT(sock) = ((pxa2xx_mcxx_setup(speed, clock)
+	uint32_t val;
+
+	val = ((pxa2xx_mcxx_setup(speed, clock)
 		& MCXX_SETUP_MASK) << MCXX_SETUP_SHIFT)
 		| ((pxa2xx_mcxx_asst(speed, clock)
 		& MCXX_ASST_MASK) << MCXX_ASST_SHIFT)
 		| ((pxa2xx_mcxx_hold(speed, clock)
 		& MCXX_HOLD_MASK) << MCXX_HOLD_SHIFT);
 
+	pxa2xx_pcmcia_set_reg(MCATT_OFFSET, sock, val);
+
 	return 0;
 }
 
@@ -205,19 +233,18 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
 static void pxa2xx_configure_sockets(struct device *dev)
 {
 	struct pcmcia_low_level *ops = dev->platform_data;
-
 	/*
 	 * We have at least one socket, so set MECR:CIT
 	 * (Card Is There)
 	 */
-	MECR |= MECR_CIT;
+	uint32_t mecr = MECR_CIT;
 
 	/* Set MECR:NOS (Number Of Sockets) */
 	if ((ops->first + ops->nr) > 1 ||
 	    machine_is_viper() || machine_is_arcom_zeus())
-		MECR |= MECR_NOS;
-	else
-		MECR &= ~MECR_NOS;
+		mecr |= MECR_NOS;
+
+	pxa2xx_pcmcia_set_reg(MECR_OFFSET, 0, mecr);
 }
 
 static const char *skt_names[] = {
@@ -270,16 +297,34 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
 	struct pcmcia_low_level *ops;
 	struct skt_dev_info *sinfo;
 	struct soc_pcmcia_socket *skt;
+	uint32_t smc_addr;
 
 	ops = (struct pcmcia_low_level *)dev->dev.platform_data;
-	if (!ops)
-		return -ENODEV;
+	if (!ops) {
+		ret = -ENODEV;
+		goto err0;
+	}
+
+	if (cpu_is_pxa320() && ops->nr > 1) {
+		dev_err(&dev->dev, "pxa320 supports only one pcmcia slot");
+		ret = -EINVAL;
+		goto err0;
+	}
 
 	pxa2xx_drv_pcmcia_ops(ops);
 
+	smc_addr = cpu_is_pxa320() ? PXA3XX_SMC_BASE : PXA2XX_SMC_BASE;
+	base = ioremap(smc_addr, 0x100);
+	if (!base) {
+		ret = -ENOMEM;
+		goto err0;
+	}
+
 	sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL);
-	if (!sinfo)
-		return -ENOMEM;
+	if (!sinfo) {
+		ret = -ENOMEM;
+		goto err1;
+	}
 
 	sinfo->nskt = ops->nr;
 
@@ -295,18 +340,21 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
 
 		ret = pxa2xx_drv_pcmcia_add_one(skt);
 		if (ret)
-			break;
+			goto err2;
 	}
 
-	if (ret) {
-		while (--i >= 0)
-			soc_pcmcia_remove_one(&sinfo->skt[i]);
-		kfree(sinfo);
-	} else {
-		pxa2xx_configure_sockets(&dev->dev);
-		dev_set_drvdata(&dev->dev, sinfo);
-	}
+	pxa2xx_configure_sockets(&dev->dev);
+	dev_set_drvdata(&dev->dev, sinfo);
+
+	return 0;
 
+err2:
+	while (--i >= 0)
+		soc_pcmcia_remove_one(&sinfo->skt[i]);
+	kfree(sinfo);
+err1:
+	iounmap(base);
+err0:
 	return ret;
 }
 
@@ -321,6 +369,7 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)
 		soc_pcmcia_remove_one(&sinfo->skt[i]);
 
 	kfree(sinfo);
+	iounmap(base);
 	return 0;
 }
 
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/11 ARM: pxa: Toradex Colibri PXA270 CF support

This driver also contains structures to eventually support PXA320. This is planned to be added in a later patch.

---
 arch/arm/mach-pxa/colibri-pxa270-evalboard.c |   18 ++
 drivers/pcmcia/Kconfig                       |    2 +-
 drivers/pcmcia/Makefile                      |    1 +
 drivers/pcmcia/pxa2xx_colibri.c              |  214 ++++++++++++++++++++++++++
 4 files changed, 234 insertions(+), 1 deletions(-)
 create mode 100644 drivers/pcmcia/pxa2xx_colibri.c
arch/arm/mach-pxa/colibri-pxa270-evalboard.c +18 -0
index 0f3b632..6177ff5 100644
@@ -51,6 +51,24 @@ static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
 	GPIO89_USBH1_PEN,
 	GPIO119_USBH2_PWR,
 	GPIO120_USBH2_PEN,
+
+	/* PCMCIA */
+	GPIO85_nPCE_1,
+	GPIO54_nPCE_2,
+	GPIO55_nPREG,
+	GPIO50_nPIOR,
+	GPIO51_nPIOW,
+	GPIO49_nPWE,
+	GPIO48_nPOE,
+	GPIO57_nIOIS16,
+	GPIO56_nPWAIT,
+	GPIO104_PSKTSEL,
+	GPIO53_GPIO,	/* RESET */
+	GPIO83_GPIO,	/* BVD1 */
+	GPIO82_GPIO,	/* BVD2 */
+	GPIO1_GPIO,	/* READY */
+	GPIO84_GPIO,	/* DETECT */
+	GPIO107_GPIO,	/* PPEN */
 };
 
 /******************************************************************************
drivers/pcmcia/Kconfig +1 -1
index c80a7a6..e9acf03 100644
@@ -215,7 +215,7 @@ config PCMCIA_PXA2XX
 	depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
 		    || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
 		    || ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2 \
-		    || MACH_VPAC270 || MACH_BALLOON3)
+		    || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI)
 	select PCMCIA_SOC_COMMON
 	help
 	  Say Y here to include support for the PXA2xx PCMCIA controller
drivers/pcmcia/Makefile +1 -0
index 8d9386a..2fee7ef 100644
@@ -70,6 +70,7 @@ pxa2xx-obj-$(CONFIG_MACH_E740)			+= pxa2xx_e740.o
 pxa2xx-obj-$(CONFIG_MACH_STARGATE2)		+= pxa2xx_stargate2.o
 pxa2xx-obj-$(CONFIG_MACH_VPAC270)		+= pxa2xx_vpac270.o
 pxa2xx-obj-$(CONFIG_MACH_BALLOON3)		+= pxa2xx_balloon3.o
+pxa2xx-obj-$(CONFIG_MACH_COLIBRI)		+= pxa2xx_colibri.o
 
 obj-$(CONFIG_PCMCIA_PXA2XX)			+= pxa2xx_base.o $(pxa2xx-obj-y)
 
drivers/pcmcia/pxa2xx_colibri.c new file +214 -0

214 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/11 ARM: pxa: Toradex Colibri PXA270 CF support

Quoted 175 lines · Marek Vasut

This driver also contains structures to eventually support PXA320. This is planned to be added in a later patch.

---

?arch/arm/mach-pxa/colibri-pxa270-evalboard.c | ? 18 ++
?drivers/pcmcia/Kconfig ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +-
?drivers/pcmcia/Makefile ? ? ? ? ? ? ? ? ? ? ?| ? ?1 +
?drivers/pcmcia/pxa2xx_colibri.c ? ? ? ? ? ? ?| ?214 ++++++++++++++++++++++++++

?4 files changed, 234 insertions(+), 1 deletions(-) ?create mode 100644 drivers/pcmcia/pxa2xx_colibri.c

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +18 -0
index 0f3b632..6177ff5 100644
@@ -51,6 +51,24 @@ static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
 ? ? ? ?GPIO89_USBH1_PEN,
 ? ? ? ?GPIO119_USBH2_PWR,
 ? ? ? ?GPIO120_USBH2_PEN,
+
+ ? ? ? /* PCMCIA */
+ ? ? ? GPIO85_nPCE_1,
+ ? ? ? GPIO54_nPCE_2,
+ ? ? ? GPIO55_nPREG,
+ ? ? ? GPIO50_nPIOR,
+ ? ? ? GPIO51_nPIOW,
+ ? ? ? GPIO49_nPWE,
+ ? ? ? GPIO48_nPOE,
+ ? ? ? GPIO57_nIOIS16,
+ ? ? ? GPIO56_nPWAIT,
+ ? ? ? GPIO104_PSKTSEL,
+ ? ? ? GPIO53_GPIO, ? ?/* RESET */
+ ? ? ? GPIO83_GPIO, ? ?/* BVD1 */
+ ? ? ? GPIO82_GPIO, ? ?/* BVD2 */
+ ? ? ? GPIO1_GPIO, ? ? /* READY */
+ ? ? ? GPIO84_GPIO, ? ?/* DETECT */
+ ? ? ? GPIO107_GPIO, ? /* PPEN */
 ?};
 

?/******************************************************************************

drivers/pcmcia/Kconfig +1 -1
index c80a7a6..e9acf03 100644
@@ -215,7 +215,7 @@ config PCMCIA_PXA2XX
 ? ? ? ?depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
 ? ? ? ? ? ? ? ? ? ?|| MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
 ? ? ? ? ? ? ? ? ? ?|| ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2 \
- ? ? ? ? ? ? ? ? ? || MACH_VPAC270 || MACH_BALLOON3)
+ ? ? ? ? ? ? ? ? ? || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI)

? ? ? ?select PCMCIA_SOC_COMMON
? ? ? ?help
? ? ? ? ?Say Y here to include support for the PXA2xx PCMCIA controller

drivers/pcmcia/Makefile +0 -0
index 8d9386a..2fee7ef 100644
@@ -70,6 +70,7 @@ pxa2xx-obj-$(CONFIG_MACH_E740) ? ? ? ? ? ? ? ? ? ? ? ?+= pxa2xx_e740.o

?pxa2xx-obj-$(CONFIG_MACH_STARGATE2) ? ? ? ? ? ?+= pxa2xx_stargate2.o ?pxa2xx-obj-$(CONFIG_MACH_VPAC270) ? ? ? ? ? ? ?+= pxa2xx_vpac270.o ?pxa2xx-obj-$(CONFIG_MACH_BALLOON3) ? ? ? ? ? ? += pxa2xx_balloon3.o +pxa2xx-obj-$(CONFIG_MACH_COLIBRI) ? ? ? ? ? ? ?+= pxa2xx_colibri.o

?obj-$(CONFIG_PCMCIA_PXA2XX) ? ? ? ? ? ? ? ? ? ?+= pxa2xx_base.o $(pxa2xx-obj-y)

drivers/pcmcia/pxa2xx_colibri.c new file +102 -0
new file mode 100644
index 0000000..4ed876c
@@ -0,0 +1,214 @@
+/*
+ * linux/drivers/pcmcia/pxa2xx_colibri.c
+ *
+ * Driver for Toradex Colibri PXA270 CF socket
+ *
+ * Copyright (C) 2010 Marek Vasut <[email protected]>
+ *
+ * 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 <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+
+#include <asm/mach-types.h>
+
+#include "soc_common.h"
+
+#define ? ? ? ?COLIBRI270_RESET_GPIO ? 53
+#define ? ? ? ?COLIBRI270_PPEN_GPIO ? ?107
+#define ? ? ? ?COLIBRI270_BVD1_GPIO ? ?83
+#define ? ? ? ?COLIBRI270_BVD2_GPIO ? ?82
+#define ? ? ? ?COLIBRI270_DETECT_GPIO ?84
+#define ? ? ? ?COLIBRI270_READY_GPIO ? 1
+
+static struct {
+ ? ? ? int ? ? reset_gpio;
+ ? ? ? int ? ? ppen_gpio;
+ ? ? ? int ? ? bvd1_gpio;
+ ? ? ? int ? ? bvd2_gpio;
+ ? ? ? int ? ? detect_gpio;
+ ? ? ? int ? ? ready_gpio;
+} colibri_pcmcia_gpio;
+
+static struct pcmcia_irqs colibri_irqs[] = {
+ ? ? ? {
+ ? ? ? ? ? ? ? .sock = 0,
+ ? ? ? ? ? ? ? .str ?= "PCMCIA CD"
+ ? ? ? },
+};
+
+static int colibri_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
+{
+ ? ? ? int ret;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.detect_gpio, "DETECT");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err1;
+ ? ? ? ret = gpio_direction_input(colibri_pcmcia_gpio.detect_gpio);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err2;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.ready_gpio, "READY");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err2;
+ ? ? ? ret = gpio_direction_input(colibri_pcmcia_gpio.ready_gpio);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err3;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.bvd1_gpio, "BVD1");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err3;
+ ? ? ? ret = gpio_direction_input(colibri_pcmcia_gpio.bvd1_gpio);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err4;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.bvd2_gpio, "BVD2");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err4;
+ ? ? ? ret = gpio_direction_input(colibri_pcmcia_gpio.bvd2_gpio);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err5;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.ppen_gpio, "PPEN");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err5;
+ ? ? ? ret = gpio_direction_output(colibri_pcmcia_gpio.ppen_gpio, 0);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err6;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.reset_gpio, "RESET");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err6;
+ ? ? ? ret = gpio_direction_output(colibri_pcmcia_gpio.reset_gpio, 1);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err7;
+
+ ? ? ? colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpio.detect_gpio);
+ ? ? ? skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpio.ready_gpio);
+
+ ? ? ? return soc_pcmcia_request_irqs(skt, colibri_irqs,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARRAY_SIZE(colibri_irqs));
+
+err7:
+ ? ? ? gpio_free(colibri_pcmcia_gpio.detect_gpio);
+err6:
+ ? ? ? gpio_free(colibri_pcmcia_gpio.ready_gpio);
+err5:

drivers/pcmcia/pxa2xx_colibri.c line 112

Quoted 10 lines
drivers/pcmcia/pxa2xx_colibri.c new file +10 -0
+ ? ? ? gpio_free(colibri_pcmcia_gpio.bvd1_gpio);
+err4:
+ ? ? ? gpio_free(colibri_pcmcia_gpio.bvd2_gpio);
+err3:
+ ? ? ? gpio_free(colibri_pcmcia_gpio.reset_gpio);
+err2:
+ ? ? ? gpio_free(colibri_pcmcia_gpio.ppen_gpio);
+err1:
+ ? ? ? return ret;
+}

I'd like to advocate for my newly introduced API for such usage:

gpio_request_array() in include/asm-generic/gpio.h

Quoted 9 lines
drivers/pcmcia/pxa2xx_colibri.c new file +9 -0
+
+static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
+{
+ ? ? ? gpio_free(colibri_pcmcia_gpio.detect_gpio);
+ ? ? ? gpio_free(colibri_pcmcia_gpio.ready_gpio);
+ ? ? ? gpio_free(colibri_pcmcia_gpio.bvd1_gpio);
+ ? ? ? gpio_free(colibri_pcmcia_gpio.bvd2_gpio);
+ ? ? ? gpio_free(colibri_pcmcia_gpio.reset_gpio);
+ ? ? ? gpio_free(colibri_pcmcia_gpio.ppen_gpio);

drivers/pcmcia/pxa2xx_colibri.c line 131

Quoted 10 lines
drivers/pcmcia/pxa2xx_colibri.c new file +10 -0
+}
+
+static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct pcmcia_state *state)
+{
+
+ ? ? ? state->detect = !!gpio_get_value(colibri_pcmcia_gpio.detect_gpio);
+ ? ? ? state->ready ?= !!gpio_get_value(colibri_pcmcia_gpio.ready_gpio);
+ ? ? ? state->bvd1 ? = !!gpio_get_value(colibri_pcmcia_gpio.bvd1_gpio);
+ ? ? ? state->bvd2 ? = !!gpio_get_value(colibri_pcmcia_gpio.bvd2_gpio);

Can we make colibri_pcmcia_gpio some part of the *skt private data?

Quoted 87 lines
drivers/pcmcia/pxa2xx_colibri.c new file +83 -1
+ ? ? ? state->wrprot = 0;
+ ? ? ? state->vs_3v ?= 1;
+ ? ? ? state->vs_Xv ?= 0;
+}
+
+static int
+colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const socket_state_t *state)
+{
+ ? ? ? gpio_set_value(colibri_pcmcia_gpio.ppen_gpio,
+ ? ? ? ? ? ? ? ? ? ? ? !(state->Vcc == 33 && state->Vpp < 50));
+ ? ? ? gpio_set_value(colibri_pcmcia_gpio.reset_gpio, state->flags & SS_RESET);
+ ? ? ? return 0;
+}
+
+static void colibri_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
+{
+}
+
+static void colibri_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
+{
+}
+
+static struct pcmcia_low_level colibri_pcmcia_ops = {
+ ? ? ? .owner ? ? ? ? ? ? ? ? ?= THIS_MODULE,
+
+ ? ? ? .first ? ? ? ? ? ? ? ? ?= 0,
+ ? ? ? .nr ? ? ? ? ? ? ? ? ? ? = 1,
+
+ ? ? ? .hw_init ? ? ? ? ? ? ? ?= colibri_pcmcia_hw_init,
+ ? ? ? .hw_shutdown ? ? ? ? ? ?= colibri_pcmcia_hw_shutdown,
+
+ ? ? ? .socket_state ? ? ? ? ? = colibri_pcmcia_socket_state,
+ ? ? ? .configure_socket ? ? ? = colibri_pcmcia_configure_socket,
+
+ ? ? ? .socket_init ? ? ? ? ? ?= colibri_pcmcia_socket_init,
+ ? ? ? .socket_suspend ? ? ? ? = colibri_pcmcia_socket_suspend,
+};
+
+static struct platform_device *colibri_pcmcia_device;
+
+static int __init colibri_pcmcia_init(void)
+{
+ ? ? ? int ret;
+
+ ? ? ? colibri_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
+ ? ? ? if (!colibri_pcmcia_device)
+ ? ? ? ? ? ? ? return -ENOMEM;
+
+ ? ? ? /* Colibri PXA270 */
+ ? ? ? if (machine_is_colibri()) {
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.reset_gpio ?= COLIBRI270_RESET_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.ppen_gpio ? = COLIBRI270_PPEN_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.bvd1_gpio ? = COLIBRI270_BVD1_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.bvd2_gpio ? = COLIBRI270_BVD2_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.detect_gpio = COLIBRI270_DETECT_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.ready_gpio ?= COLIBRI270_READY_GPIO;
+ ? ? ? }
+
+ ? ? ? ret = platform_device_add_data(colibri_pcmcia_device,
+ ? ? ? ? ? ? ? &colibri_pcmcia_ops, sizeof(colibri_pcmcia_ops));
+
+ ? ? ? if (!ret)
+ ? ? ? ? ? ? ? ret = platform_device_add(colibri_pcmcia_device);
+
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? platform_device_put(colibri_pcmcia_device);
+
+ ? ? ? return ret;
+}
+
+static void __exit colibri_pcmcia_exit(void)
+{
+ ? ? ? platform_device_unregister(colibri_pcmcia_device);
+}
+
+module_init(colibri_pcmcia_init);
+module_exit(colibri_pcmcia_exit);
+
+MODULE_AUTHOR("Marek Vasut <[email protected]>");
+MODULE_DESCRIPTION("PCMCIA support for Toradex Colibri PXA270");
+MODULE_ALIAS("platform:pxa2xx-pcmcia");
+MODULE_LICENSE("GPL");
--

1.7.1

#3 lore raw

PATCH 2/11 ARM: pxa: Toradex Colibri PXA270 CF support

Quoted 189 lines · Eric Miao
Quoted 175 lines · Marek Vasut

This driver also contains structures to eventually support PXA320. This is planned to be added in a later patch.

---

?arch/arm/mach-pxa/colibri-pxa270-evalboard.c | ? 18 ++
?drivers/pcmcia/Kconfig ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +-
?drivers/pcmcia/Makefile ? ? ? ? ? ? ? ? ? ? ?| ? ?1 +
?drivers/pcmcia/pxa2xx_colibri.c ? ? ? ? ? ? ?| ?214 ++++++++++++++++++++++++++

?4 files changed, 234 insertions(+), 1 deletions(-) ?create mode 100644 drivers/pcmcia/pxa2xx_colibri.c

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +18 -0
index 0f3b632..6177ff5 100644
@@ -51,6 +51,24 @@ static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
 ? ? ? ?GPIO89_USBH1_PEN,
 ? ? ? ?GPIO119_USBH2_PWR,
 ? ? ? ?GPIO120_USBH2_PEN,
+
+ ? ? ? /* PCMCIA */
+ ? ? ? GPIO85_nPCE_1,
+ ? ? ? GPIO54_nPCE_2,
+ ? ? ? GPIO55_nPREG,
+ ? ? ? GPIO50_nPIOR,
+ ? ? ? GPIO51_nPIOW,
+ ? ? ? GPIO49_nPWE,
+ ? ? ? GPIO48_nPOE,
+ ? ? ? GPIO57_nIOIS16,
+ ? ? ? GPIO56_nPWAIT,
+ ? ? ? GPIO104_PSKTSEL,
+ ? ? ? GPIO53_GPIO, ? ?/* RESET */
+ ? ? ? GPIO83_GPIO, ? ?/* BVD1 */
+ ? ? ? GPIO82_GPIO, ? ?/* BVD2 */
+ ? ? ? GPIO1_GPIO, ? ? /* READY */
+ ? ? ? GPIO84_GPIO, ? ?/* DETECT */
+ ? ? ? GPIO107_GPIO, ? /* PPEN */
 ?};
 

?/******************************************************************************

drivers/pcmcia/Kconfig +1 -1
index c80a7a6..e9acf03 100644
@@ -215,7 +215,7 @@ config PCMCIA_PXA2XX
 ? ? ? ?depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
 ? ? ? ? ? ? ? ? ? ?|| MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
 ? ? ? ? ? ? ? ? ? ?|| ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2 \
- ? ? ? ? ? ? ? ? ? || MACH_VPAC270 || MACH_BALLOON3)
+ ? ? ? ? ? ? ? ? ? || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI)

? ? ? ?select PCMCIA_SOC_COMMON
? ? ? ?help
? ? ? ? ?Say Y here to include support for the PXA2xx PCMCIA controller

drivers/pcmcia/Makefile +0 -0
index 8d9386a..2fee7ef 100644
@@ -70,6 +70,7 @@ pxa2xx-obj-$(CONFIG_MACH_E740) ? ? ? ? ? ? ? ? ? ? ? ?+= pxa2xx_e740.o

?pxa2xx-obj-$(CONFIG_MACH_STARGATE2) ? ? ? ? ? ?+= pxa2xx_stargate2.o ?pxa2xx-obj-$(CONFIG_MACH_VPAC270) ? ? ? ? ? ? ?+= pxa2xx_vpac270.o ?pxa2xx-obj-$(CONFIG_MACH_BALLOON3) ? ? ? ? ? ? += pxa2xx_balloon3.o +pxa2xx-obj-$(CONFIG_MACH_COLIBRI) ? ? ? ? ? ? ?+= pxa2xx_colibri.o

?obj-$(CONFIG_PCMCIA_PXA2XX) ? ? ? ? ? ? ? ? ? ?+= pxa2xx_base.o $(pxa2xx-obj-y)

drivers/pcmcia/pxa2xx_colibri.c new file +102 -0
new file mode 100644
index 0000000..4ed876c
@@ -0,0 +1,214 @@
+/*
+ * linux/drivers/pcmcia/pxa2xx_colibri.c
+ *
+ * Driver for Toradex Colibri PXA270 CF socket
+ *
+ * Copyright (C) 2010 Marek Vasut <[email protected]>
+ *
+ * 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 <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+
+#include <asm/mach-types.h>
+
+#include "soc_common.h"
+
+#define ? ? ? ?COLIBRI270_RESET_GPIO ? 53
+#define ? ? ? ?COLIBRI270_PPEN_GPIO ? ?107
+#define ? ? ? ?COLIBRI270_BVD1_GPIO ? ?83
+#define ? ? ? ?COLIBRI270_BVD2_GPIO ? ?82
+#define ? ? ? ?COLIBRI270_DETECT_GPIO ?84
+#define ? ? ? ?COLIBRI270_READY_GPIO ? 1
+
+static struct {
+ ? ? ? int ? ? reset_gpio;
+ ? ? ? int ? ? ppen_gpio;
+ ? ? ? int ? ? bvd1_gpio;
+ ? ? ? int ? ? bvd2_gpio;
+ ? ? ? int ? ? detect_gpio;
+ ? ? ? int ? ? ready_gpio;
+} colibri_pcmcia_gpio;
+
+static struct pcmcia_irqs colibri_irqs[] = {
+ ? ? ? {
+ ? ? ? ? ? ? ? .sock = 0,
+ ? ? ? ? ? ? ? .str ?= "PCMCIA CD"
+ ? ? ? },
+};
+
+static int colibri_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
+{
+ ? ? ? int ret;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.detect_gpio, "DETECT");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err1;
+ ? ? ? ret = gpio_direction_input(colibri_pcmcia_gpio.detect_gpio);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err2;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.ready_gpio, "READY");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err2;
+ ? ? ? ret = gpio_direction_input(colibri_pcmcia_gpio.ready_gpio);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err3;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.bvd1_gpio, "BVD1");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err3;
+ ? ? ? ret = gpio_direction_input(colibri_pcmcia_gpio.bvd1_gpio);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err4;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.bvd2_gpio, "BVD2");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err4;
+ ? ? ? ret = gpio_direction_input(colibri_pcmcia_gpio.bvd2_gpio);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err5;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.ppen_gpio, "PPEN");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err5;
+ ? ? ? ret = gpio_direction_output(colibri_pcmcia_gpio.ppen_gpio, 0);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err6;
+
+ ? ? ? ret = gpio_request(colibri_pcmcia_gpio.reset_gpio, "RESET");
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err6;
+ ? ? ? ret = gpio_direction_output(colibri_pcmcia_gpio.reset_gpio, 1);
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? goto err7;
+
+ ? ? ? colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpio.detect_gpio);
+ ? ? ? skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpio.ready_gpio);
+
+ ? ? ? return soc_pcmcia_request_irqs(skt, colibri_irqs,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARRAY_SIZE(colibri_irqs));
+
+err7:
+ ? ? ? gpio_free(colibri_pcmcia_gpio.detect_gpio);
+err6:
+ ? ? ? gpio_free(colibri_pcmcia_gpio.ready_gpio);
+err5:

drivers/pcmcia/pxa2xx_colibri.c line 112

Quoted 10 lines
drivers/pcmcia/pxa2xx_colibri.c new file +10 -0
+ ? ? ? gpio_free(colibri_pcmcia_gpio.bvd1_gpio);
+err4:
+ ? ? ? gpio_free(colibri_pcmcia_gpio.bvd2_gpio);
+err3:
+ ? ? ? gpio_free(colibri_pcmcia_gpio.reset_gpio);
+err2:
+ ? ? ? gpio_free(colibri_pcmcia_gpio.ppen_gpio);
+err1:
+ ? ? ? return ret;
+}

I'd like to advocate for my newly introduced API for such usage:

Quoted 2 lines

gpio_request_array() in include/asm-generic/gpio.h

Basically, you can define an array like this:

static struct gpio colibri270_pcmcia_gpios[] = {
	{ COLIBRI270_RESET_GPIO, GPIOF_OUT_INIT_HIGH, "RESET" },
	{ COLIBRI270_PPEN_GPIO,  GPIOF_OUT_INIT_LOW,  "PPEN" },
	...

or

	{
		.label	= "RESET",
		.gpio	= COLIBRI270_RESET_GPIO,
		.flags	= GPIOF_OUT_INIT_HIGH,
	}, {
		.label	= "PPEN",
		.gpio	= COLIBRI270_PPEN_GPIO,
		.flags	= GPIOF_OUT_INIT_LOW,
	},
	...
};
Quoted 110 lines
Quoted 9 lines
drivers/pcmcia/pxa2xx_colibri.c new file +9 -0
+
+static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
+{
+ ? ? ? gpio_free(colibri_pcmcia_gpio.detect_gpio);
+ ? ? ? gpio_free(colibri_pcmcia_gpio.ready_gpio);
+ ? ? ? gpio_free(colibri_pcmcia_gpio.bvd1_gpio);
+ ? ? ? gpio_free(colibri_pcmcia_gpio.bvd2_gpio);
+ ? ? ? gpio_free(colibri_pcmcia_gpio.reset_gpio);
+ ? ? ? gpio_free(colibri_pcmcia_gpio.ppen_gpio);

drivers/pcmcia/pxa2xx_colibri.c line 131

Quoted 10 lines
drivers/pcmcia/pxa2xx_colibri.c new file +10 -0
+}
+
+static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct pcmcia_state *state)
+{
+
+ ? ? ? state->detect = !!gpio_get_value(colibri_pcmcia_gpio.detect_gpio);
+ ? ? ? state->ready ?= !!gpio_get_value(colibri_pcmcia_gpio.ready_gpio);
+ ? ? ? state->bvd1 ? = !!gpio_get_value(colibri_pcmcia_gpio.bvd1_gpio);
+ ? ? ? state->bvd2 ? = !!gpio_get_value(colibri_pcmcia_gpio.bvd2_gpio);

Can we make colibri_pcmcia_gpio some part of the *skt private data?

Quoted 87 lines
drivers/pcmcia/pxa2xx_colibri.c new file +83 -1
+ ? ? ? state->wrprot = 0;
+ ? ? ? state->vs_3v ?= 1;
+ ? ? ? state->vs_Xv ?= 0;
+}
+
+static int
+colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const socket_state_t *state)
+{
+ ? ? ? gpio_set_value(colibri_pcmcia_gpio.ppen_gpio,
+ ? ? ? ? ? ? ? ? ? ? ? !(state->Vcc == 33 && state->Vpp < 50));
+ ? ? ? gpio_set_value(colibri_pcmcia_gpio.reset_gpio, state->flags & SS_RESET);
+ ? ? ? return 0;
+}
+
+static void colibri_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
+{
+}
+
+static void colibri_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
+{
+}
+
+static struct pcmcia_low_level colibri_pcmcia_ops = {
+ ? ? ? .owner ? ? ? ? ? ? ? ? ?= THIS_MODULE,
+
+ ? ? ? .first ? ? ? ? ? ? ? ? ?= 0,
+ ? ? ? .nr ? ? ? ? ? ? ? ? ? ? = 1,
+
+ ? ? ? .hw_init ? ? ? ? ? ? ? ?= colibri_pcmcia_hw_init,
+ ? ? ? .hw_shutdown ? ? ? ? ? ?= colibri_pcmcia_hw_shutdown,
+
+ ? ? ? .socket_state ? ? ? ? ? = colibri_pcmcia_socket_state,
+ ? ? ? .configure_socket ? ? ? = colibri_pcmcia_configure_socket,
+
+ ? ? ? .socket_init ? ? ? ? ? ?= colibri_pcmcia_socket_init,
+ ? ? ? .socket_suspend ? ? ? ? = colibri_pcmcia_socket_suspend,
+};
+
+static struct platform_device *colibri_pcmcia_device;
+
+static int __init colibri_pcmcia_init(void)
+{
+ ? ? ? int ret;
+
+ ? ? ? colibri_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
+ ? ? ? if (!colibri_pcmcia_device)
+ ? ? ? ? ? ? ? return -ENOMEM;
+
+ ? ? ? /* Colibri PXA270 */
+ ? ? ? if (machine_is_colibri()) {
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.reset_gpio ?= COLIBRI270_RESET_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.ppen_gpio ? = COLIBRI270_PPEN_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.bvd1_gpio ? = COLIBRI270_BVD1_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.bvd2_gpio ? = COLIBRI270_BVD2_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.detect_gpio = COLIBRI270_DETECT_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.ready_gpio ?= COLIBRI270_READY_GPIO;
+ ? ? ? }
+
+ ? ? ? ret = platform_device_add_data(colibri_pcmcia_device,
+ ? ? ? ? ? ? ? &colibri_pcmcia_ops, sizeof(colibri_pcmcia_ops));
+
+ ? ? ? if (!ret)
+ ? ? ? ? ? ? ? ret = platform_device_add(colibri_pcmcia_device);
+
+ ? ? ? if (ret)
+ ? ? ? ? ? ? ? platform_device_put(colibri_pcmcia_device);
+
+ ? ? ? return ret;
+}
+
+static void __exit colibri_pcmcia_exit(void)
+{
+ ? ? ? platform_device_unregister(colibri_pcmcia_device);
+}
+
+module_init(colibri_pcmcia_init);
+module_exit(colibri_pcmcia_exit);
+
+MODULE_AUTHOR("Marek Vasut <[email protected]>");
+MODULE_DESCRIPTION("PCMCIA support for Toradex Colibri PXA270");
+MODULE_ALIAS("platform:pxa2xx-pcmcia");
+MODULE_LICENSE("GPL");
--

1.7.1

#4 lore raw

PATCH 2/11 ARM: pxa: Toradex Colibri PXA270 CF support

In reply to Eric Miao

Dne Po 20. z??? 2010 16:16:54 Eric Miao napsal(a):

Quoted 193 lines · Marek Vasut
Quoted 179 lines

This driver also contains structures to eventually support PXA320. This is planned to be added in a later patch.

---
 arch/arm/mach-pxa/colibri-pxa270-evalboard.c |   18 ++
 drivers/pcmcia/Kconfig                       |    2 +-
 drivers/pcmcia/Makefile                      |    1 +
 drivers/pcmcia/pxa2xx_colibri.c              |  214
++++++++++++++++++++++++++ 4 files changed, 234 insertions(+), 1
deletions(-)
 create mode 100644 drivers/pcmcia/pxa2xx_colibri.c
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa270-evalboard.c index 0f3b632..6177ff5 100644

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +18 -0
@@ -51,6 +51,24 @@ static mfp_cfg_t colibri_pxa270_evalboard_pin_config[]
 __initdata = { GPIO89_USBH1_PEN,
       GPIO119_USBH2_PWR,
       GPIO120_USBH2_PEN,
+
+       /* PCMCIA */
+       GPIO85_nPCE_1,
+       GPIO54_nPCE_2,
+       GPIO55_nPREG,
+       GPIO50_nPIOR,
+       GPIO51_nPIOW,
+       GPIO49_nPWE,
+       GPIO48_nPOE,
+       GPIO57_nIOIS16,
+       GPIO56_nPWAIT,
+       GPIO104_PSKTSEL,
+       GPIO53_GPIO,    /* RESET */
+       GPIO83_GPIO,    /* BVD1 */
+       GPIO82_GPIO,    /* BVD2 */
+       GPIO1_GPIO,     /* READY */
+       GPIO84_GPIO,    /* DETECT */
+       GPIO107_GPIO,   /* PPEN */
 };
 
 /***********************************************************************

******* diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index c80a7a6..e9acf03 100644

drivers/pcmcia/Kconfig +1 -0
@@ -215,7 +215,7 @@ config PCMCIA_PXA2XX
       depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
                   || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
                   || ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2
 \ -                   || MACH_VPAC270 || MACH_BALLOON3)
+                   || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI)
       select PCMCIA_SOC_COMMON
       help
         Say Y here to include support for the PXA2xx PCMCIA controller
drivers/pcmcia/Makefile +0 -0
index 8d9386a..2fee7ef 100644
@@ -70,6 +70,7 @@ pxa2xx-obj-$(CONFIG_MACH_E740)                      
 += pxa2xx_e740.o pxa2xx-obj-$(CONFIG_MACH_STARGATE2)            +=

pxa2xx_stargate2.o pxa2xx-obj-$(CONFIG_MACH_VPAC270) +=
pxa2xx_vpac270.o pxa2xx-obj-$(CONFIG_MACH_BALLOON3) +=
pxa2xx_balloon3.o +pxa2xx-obj-$(CONFIG_MACH_COLIBRI) +=
pxa2xx_colibri.o

obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_base.o
$(pxa2xx-obj-y)

(quoted diff) +0 -0

b/drivers/pcmcia/pxa2xx_colibri.c new file mode 100644 index 0000000..4ed876c

drivers/pcmcia/pxa2xx_colibri.c new file +92 -0
@@ -0,0 +1,214 @@
+/*
+ * linux/drivers/pcmcia/pxa2xx_colibri.c
+ *
+ * Driver for Toradex Colibri PXA270 CF socket
+ *
+ * Copyright (C) 2010 Marek Vasut <[email protected]>
+ *
+ * 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 <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+
+#include <asm/mach-types.h>
+
+#include "soc_common.h"
+
+#define        COLIBRI270_RESET_GPIO   53
+#define        COLIBRI270_PPEN_GPIO    107
+#define        COLIBRI270_BVD1_GPIO    83
+#define        COLIBRI270_BVD2_GPIO    82
+#define        COLIBRI270_DETECT_GPIO  84
+#define        COLIBRI270_READY_GPIO   1
+
+static struct {
+       int     reset_gpio;
+       int     ppen_gpio;
+       int     bvd1_gpio;
+       int     bvd2_gpio;
+       int     detect_gpio;
+       int     ready_gpio;
+} colibri_pcmcia_gpio;
+
+static struct pcmcia_irqs colibri_irqs[] = {
+       {
+               .sock = 0,
+               .str  = "PCMCIA CD"
+       },
+};
+
+static int colibri_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
+{
+       int ret;
+
+       ret = gpio_request(colibri_pcmcia_gpio.detect_gpio, "DETECT");
+       if (ret)
+               goto err1;
+       ret = gpio_direction_input(colibri_pcmcia_gpio.detect_gpio);
+       if (ret)
+               goto err2;
+
+       ret = gpio_request(colibri_pcmcia_gpio.ready_gpio, "READY");
+       if (ret)
+               goto err2;
+       ret = gpio_direction_input(colibri_pcmcia_gpio.ready_gpio);
+       if (ret)
+               goto err3;
+
+       ret = gpio_request(colibri_pcmcia_gpio.bvd1_gpio, "BVD1");
+       if (ret)
+               goto err3;
+       ret = gpio_direction_input(colibri_pcmcia_gpio.bvd1_gpio);
+       if (ret)
+               goto err4;
+
+       ret = gpio_request(colibri_pcmcia_gpio.bvd2_gpio, "BVD2");
+       if (ret)
+               goto err4;
+       ret = gpio_direction_input(colibri_pcmcia_gpio.bvd2_gpio);
+       if (ret)
+               goto err5;
+
+       ret = gpio_request(colibri_pcmcia_gpio.ppen_gpio, "PPEN");
+       if (ret)
+               goto err5;
+       ret = gpio_direction_output(colibri_pcmcia_gpio.ppen_gpio, 0);
+       if (ret)
+               goto err6;
+
+       ret = gpio_request(colibri_pcmcia_gpio.reset_gpio, "RESET");
+       if (ret)
+               goto err6;
+       ret = gpio_direction_output(colibri_pcmcia_gpio.reset_gpio, 1);
+       if (ret)
+               goto err7;
+
+       colibri_irqs[0].irq =

gpio_to_irq(colibri_pcmcia_gpio.detect_gpio); + skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpio.ready_gpio); +

drivers/pcmcia/pxa2xx_colibri.c new file +8 -0
+       return soc_pcmcia_request_irqs(skt, colibri_irqs,
+                                       ARRAY_SIZE(colibri_irqs));
+
+err7:
+       gpio_free(colibri_pcmcia_gpio.detect_gpio);
+err6:
+       gpio_free(colibri_pcmcia_gpio.ready_gpio);
+err5:

drivers/pcmcia/pxa2xx_colibri.c line 112

Quoted 10 lines
drivers/pcmcia/pxa2xx_colibri.c new file +10 -0
+       gpio_free(colibri_pcmcia_gpio.bvd1_gpio);
+err4:
+       gpio_free(colibri_pcmcia_gpio.bvd2_gpio);
+err3:
+       gpio_free(colibri_pcmcia_gpio.reset_gpio);
+err2:
+       gpio_free(colibri_pcmcia_gpio.ppen_gpio);
+err1:
+       return ret;
+}

I'd like to advocate for my newly introduced API for such usage:

Quoted 1 line

gpio_request_array() in include/asm-generic/gpio.h

Can we do this in a separate patch?

Quoted 15 lines
Quoted 15 lines
drivers/pcmcia/pxa2xx_colibri.c new file +14 -0
+
+static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
+{
+       gpio_free(colibri_pcmcia_gpio.detect_gpio);
+       gpio_free(colibri_pcmcia_gpio.ready_gpio);
+       gpio_free(colibri_pcmcia_gpio.bvd1_gpio);
+       gpio_free(colibri_pcmcia_gpio.bvd2_gpio);
+       gpio_free(colibri_pcmcia_gpio.reset_gpio);
+       gpio_free(colibri_pcmcia_gpio.ppen_gpio);
+}
+
+static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+                                       struct pcmcia_state *state)
+{
Quoted 8 lines
Quoted 6 lines
drivers/pcmcia/pxa2xx_colibri.c new file +2 -0
+
+       state->detect =

!!gpio_get_value(colibri_pcmcia_gpio.detect_gpio); + state->ready
= !!gpio_get_value(colibri_pcmcia_gpio.ready_gpio); + state->bvd1
= !!gpio_get_value(colibri_pcmcia_gpio.bvd1_gpio); + state->bvd2
= !!gpio_get_value(colibri_pcmcia_gpio.bvd2_gpio);

Can we make colibri_pcmcia_gpio some part of the *skt private data?

I looked and didn't see anything, if you have anything specific in mind, can you point me to it ?

Quoted 86 lines
Quoted 86 lines
drivers/pcmcia/pxa2xx_colibri.c new file +12 -0
+       state->wrprot = 0;
+       state->vs_3v  = 1;
+       state->vs_Xv  = 0;
+}
+
+static int
+colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
+                               const socket_state_t *state)
+{
+       gpio_set_value(colibri_pcmcia_gpio.ppen_gpio,
+                       !(state->Vcc == 33 && state->Vpp < 50));
+       gpio_set_value(colibri_pcmcia_gpio.reset_gpio, state->flags &

SS_RESET); + return 0;

drivers/pcmcia/pxa2xx_colibri.c new file +69 -2
+}
+
+static void colibri_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
+{
+}
+
+static void colibri_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
+{
+}
+
+static struct pcmcia_low_level colibri_pcmcia_ops = {
+       .owner                  = THIS_MODULE,
+
+       .first                  = 0,
+       .nr                     = 1,
+
+       .hw_init                = colibri_pcmcia_hw_init,
+       .hw_shutdown            = colibri_pcmcia_hw_shutdown,
+
+       .socket_state           = colibri_pcmcia_socket_state,
+       .configure_socket       = colibri_pcmcia_configure_socket,
+
+       .socket_init            = colibri_pcmcia_socket_init,
+       .socket_suspend         = colibri_pcmcia_socket_suspend,
+};
+
+static struct platform_device *colibri_pcmcia_device;
+
+static int __init colibri_pcmcia_init(void)
+{
+       int ret;
+
+       colibri_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia",
-1); +       if (!colibri_pcmcia_device)
+               return -ENOMEM;
+
+       /* Colibri PXA270 */
+       if (machine_is_colibri()) {
+               colibri_pcmcia_gpio.reset_gpio  = COLIBRI270_RESET_GPIO;
+               colibri_pcmcia_gpio.ppen_gpio   = COLIBRI270_PPEN_GPIO;
+               colibri_pcmcia_gpio.bvd1_gpio   = COLIBRI270_BVD1_GPIO;
+               colibri_pcmcia_gpio.bvd2_gpio   = COLIBRI270_BVD2_GPIO;
+               colibri_pcmcia_gpio.detect_gpio = COLIBRI270_DETECT_GPIO;
+               colibri_pcmcia_gpio.ready_gpio  = COLIBRI270_READY_GPIO;
+       }
+
+       ret = platform_device_add_data(colibri_pcmcia_device,
+               &colibri_pcmcia_ops, sizeof(colibri_pcmcia_ops));
+
+       if (!ret)
+               ret = platform_device_add(colibri_pcmcia_device);
+
+       if (ret)
+               platform_device_put(colibri_pcmcia_device);
+
+       return ret;
+}
+
+static void __exit colibri_pcmcia_exit(void)
+{
+       platform_device_unregister(colibri_pcmcia_device);
+}
+
+module_init(colibri_pcmcia_init);
+module_exit(colibri_pcmcia_exit);
+
+MODULE_AUTHOR("Marek Vasut <[email protected]>");
+MODULE_DESCRIPTION("PCMCIA support for Toradex Colibri PXA270");
+MODULE_ALIAS("platform:pxa2xx-pcmcia");
+MODULE_LICENSE("GPL");
--

1.7.1

#5 lore raw

PATCH 3/11 ARM: pxa: Push Colibri evalboard MFP into module files

In reply to Marek Vasut

This change -- pushing the MFP configuration back into Module files -- is necessary because some evalboards can be used with multiple modules, where MFP differs from module to module. Therefore MFP isn't board-specific, but module-specific and the module should preconfigure itself for the board.

(And there is also the C preprocesor limitation and conflicting #define-s)

---
 arch/arm/mach-pxa/Kconfig                    |    8 +-
 arch/arm/mach-pxa/colibri-pxa270-evalboard.c |   61 ++++-----------
 arch/arm/mach-pxa/colibri-pxa270-income.c    |   47 -----------
 arch/arm/mach-pxa/colibri-pxa270.c           |   96 ++++++++++++++++++++++
 arch/arm/mach-pxa/colibri-pxa300.c           |   61 ++++++---------
 arch/arm/mach-pxa/colibri-pxa320.c           |  112 ++++++++++----------------
 arch/arm/mach-pxa/colibri-pxa3xx.c           |   49 -----------
 arch/arm/mach-pxa/include/mach/colibri.h     |    6 ++
 8 files changed, 188 insertions(+), 252 deletions(-)
arch/arm/mach-pxa/Kconfig +4 -4
index dd235ec..b44d613 100644
@@ -232,10 +232,6 @@ config MACH_COLIBRI
 	bool "Toradex Colibri PXA270"
 	select PXA27x
 
-config MACH_COLIBRI_PXA270_EVALBOARD
-	bool "Toradex Colibri Evaluation Carrier Board support (PXA270)"
-	depends on MACH_COLIBRI
-
 config MACH_COLIBRI_PXA270_INCOME
 	bool "Income s.r.o. PXA270 SBC"
 	depends on MACH_COLIBRI
@@ -253,6 +249,10 @@ config MACH_COLIBRI320
 	select PXA3xx
 	select CPU_PXA320
 
+config MACH_COLIBRI_PXA270_EVALBOARD
+	bool "Toradex Colibri Evaluation Carrier Board support"
+	depends on MACH_COLIBRI || MACH_COLIBRI300 || MACH_COLIBRI320
+
 config MACH_VPAC270
 	bool "Voipac PXA270"
 	select PXA27x
arch/arm/mach-pxa/colibri-pxa270-evalboard.c +15 -46

100 lines not on this page · raw message

arch/arm/mach-pxa/colibri-pxa270-income.c +0 -47

59 lines not on this page · raw message

arch/arm/mach-pxa/colibri-pxa270.c +96 -0

111 lines not on this page · raw message

arch/arm/mach-pxa/colibri-pxa300.c +24 -37

86 lines not on this page · raw message

arch/arm/mach-pxa/colibri-pxa320.c +43 -69

146 lines not on this page · raw message

arch/arm/mach-pxa/colibri-pxa3xx.c +0 -49

55 lines not on this page · raw message

arch/arm/mach-pxa/include/mach/colibri.h +6 -0
index 58dada1..63a948a 100644
@@ -59,5 +59,11 @@ static inline void colibri_pxa3xx_init_nand(void) {}
 #define GPIO0_COLIBRI_PXA270_SD_DETECT	0
 #define GPIO113_COLIBRI_PXA270_TS_IRQ	113
 
+/* GPIO definitions for Colibri PXA300/310 */
+#define GPIO39_COLIBRI_PXA300_SD_DETECT	39
+
+/* GPIO definitions for Colibri PXA320 */
+#define GPIO28_COLIBRI_PXA320_SD_DETECT	28
+
 #endif /* _COLIBRI_H_ */
 
Signature · 1 line
1.7.1
#6 lore raw

PATCH 3/11 ARM: pxa: Push Colibri evalboard MFP into module files

Quoted 107 lines · Marek Vasut

This change -- pushing the MFP configuration back into Module files -- is necessary because some evalboards can be used with multiple modules, where MFP differs from module to module. Therefore MFP isn't board-specific, but module-specific and the module should preconfigure itself for the board.

(And there is also the C preprocesor limitation and conflicting #define-s)

---

?arch/arm/mach-pxa/Kconfig ? ? ? ? ? ? ? ? ? ?| ? ?8 +-
?arch/arm/mach-pxa/colibri-pxa270-evalboard.c | ? 61 ++++-----------
?arch/arm/mach-pxa/colibri-pxa270-income.c ? ?| ? 47 -----------
?arch/arm/mach-pxa/colibri-pxa270.c ? ? ? ? ? | ? 96 ++++++++++++++++++++++
?arch/arm/mach-pxa/colibri-pxa300.c ? ? ? ? ? | ? 61 ++++++---------
?arch/arm/mach-pxa/colibri-pxa320.c ? ? ? ? ? | ?112 ++++++++++----------------
?arch/arm/mach-pxa/colibri-pxa3xx.c ? ? ? ? ? | ? 49 -----------
?arch/arm/mach-pxa/include/mach/colibri.h ? ? | ? ?6 ++

?8 files changed, 188 insertions(+), 252 deletions(-)

arch/arm/mach-pxa/Kconfig +0 -0
index dd235ec..b44d613 100644
@@ -232,10 +232,6 @@ config MACH_COLIBRI

? ? ? ?bool "Toradex Colibri PXA270"
? ? ? ?select PXA27x

arch/arm/mach-pxa/Kconfig +0 -4
-config MACH_COLIBRI_PXA270_EVALBOARD
- ? ? ? bool "Toradex Colibri Evaluation Carrier Board support (PXA270)"
- ? ? ? depends on MACH_COLIBRI
-

?config MACH_COLIBRI_PXA270_INCOME
? ? ? ?bool "Income s.r.o. PXA270 SBC"
? ? ? ?depends on MACH_COLIBRI

arch/arm/mach-pxa/Kconfig +0 -0
@@ -253,6 +249,10 @@ config MACH_COLIBRI320

? ? ? ?select PXA3xx
? ? ? ?select CPU_PXA320

arch/arm/mach-pxa/Kconfig +4 -0
+config MACH_COLIBRI_PXA270_EVALBOARD
+ ? ? ? bool "Toradex Colibri Evaluation Carrier Board support"
+ ? ? ? depends on MACH_COLIBRI || MACH_COLIBRI300 || MACH_COLIBRI320
+

?config MACH_VPAC270
? ? ? ?bool "Voipac PXA270"
? ? ? ?select PXA27x

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +0 -0
index 6177ff5..e1a2b52 100644
@@ -30,61 +30,28 @@

?#include "devices.h"

?/******************************************************************************
- * Pin configuration
- ******************************************************************************/

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +0 -40
-static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
- ? ? ? /* MMC */
- ? ? ? GPIO32_MMC_CLK,
- ? ? ? GPIO92_MMC_DAT_0,
- ? ? ? GPIO109_MMC_DAT_1,
- ? ? ? GPIO110_MMC_DAT_2,
- ? ? ? GPIO111_MMC_DAT_3,
- ? ? ? GPIO112_MMC_CMD,
- ? ? ? GPIO0_GPIO, ? ? /* SD detect */
-
- ? ? ? /* FFUART */
- ? ? ? GPIO39_FFUART_TXD,
- ? ? ? GPIO34_FFUART_RXD,
-
- ? ? ? /* UHC */
- ? ? ? GPIO88_USBH1_PWR,
- ? ? ? GPIO89_USBH1_PEN,
- ? ? ? GPIO119_USBH2_PWR,
- ? ? ? GPIO120_USBH2_PEN,
-
- ? ? ? /* PCMCIA */
- ? ? ? GPIO85_nPCE_1,
- ? ? ? GPIO54_nPCE_2,
- ? ? ? GPIO55_nPREG,
- ? ? ? GPIO50_nPIOR,
- ? ? ? GPIO51_nPIOW,
- ? ? ? GPIO49_nPWE,
- ? ? ? GPIO48_nPOE,
- ? ? ? GPIO57_nIOIS16,
- ? ? ? GPIO56_nPWAIT,
- ? ? ? GPIO104_PSKTSEL,
- ? ? ? GPIO53_GPIO, ? ?/* RESET */
- ? ? ? GPIO83_GPIO, ? ?/* BVD1 */
- ? ? ? GPIO82_GPIO, ? ?/* BVD2 */
- ? ? ? GPIO1_GPIO, ? ? /* READY */
- ? ? ? GPIO84_GPIO, ? ?/* DETECT */
- ? ? ? GPIO107_GPIO, ? /* PPEN */
-};
-
-/******************************************************************************

?* SD/MMC card controller ?******************************************************************************/ ?#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) ?static struct pxamci_platform_data colibri_pxa270_mci_platform_data = { ? ? ? ?.ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
? ? ? ?.gpio_power ? ? ? ? ? ? = -1,
- ? ? ? .gpio_card_detect ? ? ? = GPIO0_COLIBRI_PXA270_SD_DETECT,
? ? ? ?.gpio_card_ro ? ? ? ? ? = -1,
? ? ? ?.detect_delay_ms ? ? ? ?= 200,
?};

Quoted 12 lines

?static void __init colibri_pxa270_mmc_init(void)
?{
+ ? ? ? if (machine_is_colibri()) ? ? ? /* PXA270 Colibri */
+ ? ? ? ? ? ? ? colibri_pxa270_mci_platform_data.gpio_card_detect =
+ ? ? ? ? ? ? ? ? ? ? ? GPIO0_COLIBRI_PXA270_SD_DETECT;
+ ? ? ? if (machine_is_colibri300()) ? ?/* PXA300 Colibri */
+ ? ? ? ? ? ? ? colibri_pxa270_mci_platform_data.gpio_card_detect =
+ ? ? ? ? ? ? ? ? ? ? ? GPIO39_COLIBRI_PXA300_SD_DETECT;
+ ? ? ? else ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* PXA320 Colibri */
+ ? ? ? ? ? ? ? colibri_pxa270_mci_platform_data.gpio_card_detect =
+ ? ? ? ? ? ? ? ? ? ? ? GPIO28_COLIBRI_PXA320_SD_DETECT; +

It's a bit confusing here in a file called colibri-pxa270-evalboard.c but pxa300 and
pxa320 code are there. And until I looked behind and saw the rename patch I came to know how it's working.

Wouldn't be better to rename before change?

Quoted 544 lines

? ? ? ?pxa_set_mci_info(&colibri_pxa270_mci_platform_data); ?}
?#else

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +5 -1
@@ -103,13 +70,17 @@ static int colibri_pxa270_ohci_init(struct device *dev)
 
 ?static struct pxaohci_platform_data colibri_pxa270_ohci_info = {
 ? ? ? ?.port_mode ? ? ?= PMM_PERPORT_MODE,
- ? ? ? .flags ? ? ? ? ?= ENABLE_PORT1 | ENABLE_PORT2 |
+ ? ? ? .flags ? ? ? ? ?= ENABLE_PORT1 |
 ? ? ? ? ? ? ? ? ? ? ? ? ?POWER_CONTROL_LOW | POWER_SENSE_LOW,
 ? ? ? ?.init ? ? ? ? ? = colibri_pxa270_ohci_init,
 ?};
 
 ?static void __init colibri_pxa270_uhc_init(void)
 ?{
+ ? ? ? /* Colibri PXA270 has two usb ports, TBA for 320 */
+ ? ? ? if (machine_is_colibri())
+ ? ? ? ? ? ? ? colibri_pxa270_ohci_info.flags ?|= ENABLE_PORT2;
+
 ? ? ? ?pxa_set_ohci_info(&colibri_pxa270_ohci_info);
 ?}

?#else

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +0 -2
@@ -118,7 +89,6 @@ static inline void colibri_pxa270_uhc_init(void) {}
 
 ?void __init colibri_pxa270_evalboard_init(void)
 ?{
- ? ? ? pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_evalboard_pin_config));
 ? ? ? ?pxa_set_ffuart_info(NULL);
 ? ? ? ?pxa_set_btuart_info(NULL);
 ? ? ? ?pxa_set_stuart_info(NULL);
@@ -126,4 +96,3 @@ void __init colibri_pxa270_evalboard_init(void)
 ? ? ? ?colibri_pxa270_mmc_init();
 ? ? ? ?colibri_pxa270_uhc_init();
 ?}
-
arch/arm/mach-pxa/colibri-pxa270-income.c +0 -0
index 37f0f3e..07b62a0 100644
@@ -46,52 +46,6 @@
 ?#define GPIO113_INCOME_TS_IRQ ? (113)
 

?/******************************************************************************
- * Pin configuration
- ******************************************************************************/

arch/arm/mach-pxa/colibri-pxa270-income.c +0 -44
-static mfp_cfg_t income_pin_config[] __initdata = {
- ? ? ? /* MMC */
- ? ? ? GPIO32_MMC_CLK,
- ? ? ? GPIO92_MMC_DAT_0,
- ? ? ? GPIO109_MMC_DAT_1,
- ? ? ? GPIO110_MMC_DAT_2,
- ? ? ? GPIO111_MMC_DAT_3,
- ? ? ? GPIO112_MMC_CMD,
- ? ? ? GPIO0_GPIO, ? ? /* SD detect */
- ? ? ? GPIO1_GPIO, ? ? /* SD read-only */
-
- ? ? ? /* FFUART */
- ? ? ? GPIO39_FFUART_TXD,
- ? ? ? GPIO34_FFUART_RXD,
-
- ? ? ? /* BFUART */
- ? ? ? GPIO42_BTUART_RXD,
- ? ? ? GPIO43_BTUART_TXD,
- ? ? ? GPIO45_BTUART_RTS,
-
- ? ? ? /* STUART */
- ? ? ? GPIO46_STUART_RXD,
- ? ? ? GPIO47_STUART_TXD,
-
- ? ? ? /* UHC */
- ? ? ? GPIO88_USBH1_PWR,
- ? ? ? GPIO89_USBH1_PEN,
-
- ? ? ? /* LCD */
- ? ? ? GPIOxx_LCD_TFT_16BPP,
-
- ? ? ? /* PWM */
- ? ? ? GPIO16_PWM0_OUT,
-
- ? ? ? /* I2C */
- ? ? ? GPIO117_I2C_SCL,
- ? ? ? GPIO118_I2C_SDA,
-
- ? ? ? /* LED */
- ? ? ? GPIO54_GPIO, ? ?/* LED A */
- ? ? ? GPIO55_GPIO, ? ?/* LED B */
-};
-
-/******************************************************************************

?* SD/MMC card controller ?******************************************************************************/ ?#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)

arch/arm/mach-pxa/colibri-pxa270-income.c +0 -1
@@ -257,7 +211,6 @@ static inline void income_pwm_init(void) {}
 
 ?void __init colibri_pxa270_income_boardinit(void)
 ?{
- ? ? ? pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));
 ? ? ? ?pxa_set_ffuart_info(NULL);
 ? ? ? ?pxa_set_btuart_info(NULL);
 ? ? ? ?pxa_set_stuart_info(NULL);
arch/arm/mach-pxa/colibri-pxa270.c +0 -0
index 98673ac..8488dfe 100644
@@ -33,6 +33,99 @@

?#include "generic.h"

?/******************************************************************************
+ * Evaluation board MFP
+ ******************************************************************************/

arch/arm/mach-pxa/colibri-pxa270.c +91 -0
+#ifdef ?CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
+ ? ? ? /* MMC */
+ ? ? ? GPIO32_MMC_CLK,
+ ? ? ? GPIO92_MMC_DAT_0,
+ ? ? ? GPIO109_MMC_DAT_1,
+ ? ? ? GPIO110_MMC_DAT_2,
+ ? ? ? GPIO111_MMC_DAT_3,
+ ? ? ? GPIO112_MMC_CMD,
+ ? ? ? GPIO0_GPIO, ? ? /* SD detect */
+
+ ? ? ? /* FFUART */
+ ? ? ? GPIO39_FFUART_TXD,
+ ? ? ? GPIO34_FFUART_RXD,
+
+ ? ? ? /* UHC */
+ ? ? ? GPIO88_USBH1_PWR,
+ ? ? ? GPIO89_USBH1_PEN,
+ ? ? ? GPIO119_USBH2_PWR,
+ ? ? ? GPIO120_USBH2_PEN,
+
+ ? ? ? /* PCMCIA */
+ ? ? ? GPIO85_nPCE_1,
+ ? ? ? GPIO54_nPCE_2,
+ ? ? ? GPIO55_nPREG,
+ ? ? ? GPIO50_nPIOR,
+ ? ? ? GPIO51_nPIOW,
+ ? ? ? GPIO49_nPWE,
+ ? ? ? GPIO48_nPOE,
+ ? ? ? GPIO57_nIOIS16,
+ ? ? ? GPIO56_nPWAIT,
+ ? ? ? GPIO104_PSKTSEL,
+ ? ? ? GPIO53_GPIO, ? ?/* RESET */
+ ? ? ? GPIO83_GPIO, ? ?/* BVD1 */
+ ? ? ? GPIO82_GPIO, ? ?/* BVD2 */
+ ? ? ? GPIO1_GPIO, ? ? /* READY */
+ ? ? ? GPIO84_GPIO, ? ?/* DETECT */
+ ? ? ? GPIO107_GPIO, ? /* PPEN */
+};
+#else
+static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {};
+#endif
+
+#ifdef CONFIG_MACH_COLIBRI_PXA270_INCOME
+static mfp_cfg_t income_pin_config[] __initdata = {
+ ? ? ? /* MMC */
+ ? ? ? GPIO32_MMC_CLK,
+ ? ? ? GPIO92_MMC_DAT_0,
+ ? ? ? GPIO109_MMC_DAT_1,
+ ? ? ? GPIO110_MMC_DAT_2,
+ ? ? ? GPIO111_MMC_DAT_3,
+ ? ? ? GPIO112_MMC_CMD,
+ ? ? ? GPIO0_GPIO, ? ? /* SD detect */
+ ? ? ? GPIO1_GPIO, ? ? /* SD read-only */
+
+ ? ? ? /* FFUART */
+ ? ? ? GPIO39_FFUART_TXD,
+ ? ? ? GPIO34_FFUART_RXD,
+
+ ? ? ? /* BFUART */
+ ? ? ? GPIO42_BTUART_RXD,
+ ? ? ? GPIO43_BTUART_TXD,
+ ? ? ? GPIO45_BTUART_RTS,
+
+ ? ? ? /* STUART */
+ ? ? ? GPIO46_STUART_RXD,
+ ? ? ? GPIO47_STUART_TXD,
+
+ ? ? ? /* UHC */
+ ? ? ? GPIO88_USBH1_PWR,
+ ? ? ? GPIO89_USBH1_PEN,
+
+ ? ? ? /* LCD */
+ ? ? ? GPIOxx_LCD_TFT_16BPP,
+
+ ? ? ? /* PWM */
+ ? ? ? GPIO16_PWM0_OUT,
+
+ ? ? ? /* I2C */
+ ? ? ? GPIO117_I2C_SCL,
+ ? ? ? GPIO118_I2C_SDA,
+
+ ? ? ? /* LED */
+ ? ? ? GPIO54_GPIO, ? ?/* LED A */
+ ? ? ? GPIO55_GPIO, ? ?/* LED B */
+};
+#else
+static mfp_cfg_t income_pin_config[] __initdata = {};
+#endif
+
+/******************************************************************************

?* Pin configuration ?******************************************************************************/ ?static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {

arch/arm/mach-pxa/colibri-pxa270.c +0 -0
@@ -185,9 +278,12 @@ static void __init colibri_pxa270_init(void)
 
 ? ? ? ?switch (colibri_pxa270_baseboard) {

? ? ? ?case COLIBRI_PXA270_EVALBOARD:
+ ? ? ? ? ? ? ? pxa2xx_mfp_config(ARRAY_AND_SIZE(
+ ? ? ? ? ? ? ? ? ? ? ? colibri_pxa270_evalboard_pin_config)); ? ? ? ? ? ? ? ?colibri_pxa270_evalboard_init();
? ? ? ? ? ? ? ?break;
? ? ? ?case COLIBRI_PXA270_INCOME:
+ ? ? ? ? ? ? ? pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config)); ? ? ? ? ? ? ? ?colibri_pxa270_income_boardinit();
? ? ? ? ? ? ? ?break;
? ? ? ?default:

arch/arm/mach-pxa/colibri-pxa300.c +0 -0
index 40b6ac2..dab49ce 100644
@@ -31,9 +31,28 @@

?#include "generic.h"
?#include "devices.h"

arch/arm/mach-pxa/colibri-pxa300.c +20 -0
+
+#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
+ ? ? ? /* MMC */
+ ? ? ? GPIO7_MMC1_CLK,
+ ? ? ? GPIO14_MMC1_CMD,
+ ? ? ? GPIO3_MMC1_DAT0,
+ ? ? ? GPIO4_MMC1_DAT1,
+ ? ? ? GPIO5_MMC1_DAT2,
+ ? ? ? GPIO6_MMC1_DAT3,
+ ? ? ? GPIO39_GPIO, ? ?/* SD detect */
+
+ ? ? ? /* UHC */
+ ? ? ? GPIO0_2_USBH_PEN,
+ ? ? ? GPIO1_2_USBH_PWR,
+};
+#else
+static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
+#endif
+

?#if defined(CONFIG_AX88796)
?#define COLIBRI_ETH_IRQ_GPIO ? mfp_to_gpio(GPIO26_GPIO) -
?/*
?* Asix AX88796 Ethernet
?*/

arch/arm/mach-pxa/colibri-pxa300.c +0 -0
@@ -80,35 +99,6 @@ static void __init colibri_pxa300_init_eth(void)
 ?static inline void __init colibri_pxa300_init_eth(void) {}

?#endif /* CONFIG_AX88796 */

arch/arm/mach-pxa/colibri-pxa300.c +0 -29
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = {
- ? ? ? GPIO0_2_USBH_PEN,
- ? ? ? GPIO1_2_USBH_PWR,
-};
-
-static struct pxaohci_platform_data colibri_pxa300_ohci_info = {
- ? ? ? .port_mode ? ? ?= PMM_GLOBAL_MODE,
- ? ? ? .flags ? ? ? ? ?= ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
-};
-
-void __init colibri_pxa300_init_ohci(void)
-{
- ? ? ? pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config));
- ? ? ? pxa_set_ohci_info(&colibri_pxa300_ohci_info);
-}
-#else
-static inline void colibri_pxa300_init_ohci(void) {}
-#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
-
-static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = {
- ? ? ? GPIO7_MMC1_CLK,
- ? ? ? GPIO14_MMC1_CMD,
- ? ? ? GPIO3_MMC1_DAT0,
- ? ? ? GPIO4_MMC1_DAT1,
- ? ? ? GPIO5_MMC1_DAT2,
- ? ? ? GPIO6_MMC1_DAT3,
-};
-

?#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) ?static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = { ? ? ? ?GPIO54_LCD_LDD_0,

arch/arm/mach-pxa/colibri-pxa300.c +4 -7
@@ -171,18 +161,15 @@ static inline void colibri_pxa310_init_ac97(void) {}
 
 ?void __init colibri_pxa300_init(void)
 ?{
- ? ? ? pxa_set_ffuart_info(NULL);
- ? ? ? pxa_set_btuart_info(NULL);
- ? ? ? pxa_set_stuart_info(NULL);
-
 ? ? ? ?colibri_pxa300_init_eth();
- ? ? ? colibri_pxa300_init_ohci();
 ? ? ? ?colibri_pxa3xx_init_nand();
 ? ? ? ?colibri_pxa300_init_lcd();
 ? ? ? ?colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
 ? ? ? ?colibri_pxa310_init_ac97();
- ? ? ? colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config),
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mfp_to_gpio(MFP_PIN_GPIO13));
+
+ ? ? ? /* Evalboard init */
+ ? ? ? pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
+ ? ? ? colibri_pxa270_evalboard_init();
 ?}
 
 ?MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
arch/arm/mach-pxa/colibri-pxa320.c +0 -0
index 99e850d..e886ab2 100644
@@ -35,9 +35,47 @@

?#include "generic.h"
?#include "devices.h"

arch/arm/mach-pxa/colibri-pxa320.c +39 -0
+#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {
+ ? ? ? /* MMC */
+ ? ? ? GPIO22_MMC1_CLK,
+ ? ? ? GPIO23_MMC1_CMD,
+ ? ? ? GPIO18_MMC1_DAT0,
+ ? ? ? GPIO19_MMC1_DAT1,
+ ? ? ? GPIO20_MMC1_DAT2,
+ ? ? ? GPIO21_MMC1_DAT3,
+ ? ? ? GPIO28_GPIO, ? ?/* SD detect */
+
+ ? ? ? /* UART 1 configuration (may be set by bootloader) */
+ ? ? ? GPIO99_UART1_CTS,
+ ? ? ? GPIO104_UART1_RTS,
+ ? ? ? GPIO97_UART1_RXD,
+ ? ? ? GPIO98_UART1_TXD,
+ ? ? ? GPIO101_UART1_DTR,
+ ? ? ? GPIO103_UART1_DSR,
+ ? ? ? GPIO100_UART1_DCD,
+ ? ? ? GPIO102_UART1_RI,
+
+ ? ? ? /* UART 2 configuration */
+ ? ? ? GPIO109_UART2_CTS,
+ ? ? ? GPIO112_UART2_RTS,
+ ? ? ? GPIO110_UART2_RXD,
+ ? ? ? GPIO111_UART2_TXD,
+
+ ? ? ? /* UART 3 configuration */
+ ? ? ? GPIO30_UART3_RXD,
+ ? ? ? GPIO31_UART3_TXD,
+
+ ? ? ? /* UHC */
+ ? ? ? GPIO2_2_USBH_PEN,
+ ? ? ? GPIO3_2_USBH_PWR,
+};
+#else
+static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {};
+#endif
+

?#if defined(CONFIG_AX88796)
?#define COLIBRI_ETH_IRQ_GPIO ? mfp_to_gpio(GPIO36_GPIO) -
?/*
?* Asix AX88796 Ethernet
?*/

arch/arm/mach-pxa/colibri-pxa320.c +0 -0
@@ -84,26 +122,6 @@ static void __init colibri_pxa320_init_eth(void)
 ?static inline void __init colibri_pxa320_init_eth(void) {}

?#endif /* CONFIG_AX88796 */

arch/arm/mach-pxa/colibri-pxa320.c +0 -20
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = {
- ? ? ? GPIO2_2_USBH_PEN,
- ? ? ? GPIO3_2_USBH_PWR,
-};
-
-static struct pxaohci_platform_data colibri_pxa320_ohci_info = {
- ? ? ? .port_mode ? ? ?= PMM_GLOBAL_MODE,
- ? ? ? .flags ? ? ? ? ?= ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
-};
-
-void __init colibri_pxa320_init_ohci(void)
-{
- ? ? ? pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config));
- ? ? ? pxa_set_ohci_info(&colibri_pxa320_ohci_info);
-}
-#else
-static inline void colibri_pxa320_init_ohci(void) {}
-#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
-

?#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE) ?static struct gpio_vbus_mach_info colibri_pxa320_gpio_vbus_info = { ? ? ? ?.gpio_vbus ? ? ? ? ? ? ?= mfp_to_gpio(MFP_PIN_GPIO96),

arch/arm/mach-pxa/colibri-pxa320.c +0 -0
@@ -140,15 +158,6 @@ static void __init colibri_pxa320_init_udc(void)
 ?static inline void colibri_pxa320_init_udc(void) {}

?#endif

arch/arm/mach-pxa/colibri-pxa320.c +0 -9
-static mfp_cfg_t colibri_pxa320_mmc_pin_config[] __initdata = {
- ? ? ? GPIO22_MMC1_CLK,
- ? ? ? GPIO23_MMC1_CMD,
- ? ? ? GPIO18_MMC1_DAT0,
- ? ? ? GPIO19_MMC1_DAT1,
- ? ? ? GPIO20_MMC1_DAT2,
- ? ? ? GPIO21_MMC1_DAT3
-};
-

?#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) ?static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = { ? ? ? ?GPIO6_2_LCD_LDD_0,

arch/arm/mach-pxa/colibri-pxa320.c +0 -0
@@ -205,53 +214,18 @@ static inline void __init colibri_pxa320_init_ac97(void)
 ?static inline void colibri_pxa320_init_ac97(void) {}

?#endif

arch/arm/mach-pxa/colibri-pxa320.c +0 -31
-/*
- * The following configuration is verified to work with the Toradex Orchid
- * carrier board
- */
-static mfp_cfg_t colibri_pxa320_uart_pin_config[] __initdata = {
- ? ? ? /* UART 1 configuration (may be set by bootloader) */
- ? ? ? GPIO99_UART1_CTS,
- ? ? ? GPIO104_UART1_RTS,
- ? ? ? GPIO97_UART1_RXD,
- ? ? ? GPIO98_UART1_TXD,
- ? ? ? GPIO101_UART1_DTR,
- ? ? ? GPIO103_UART1_DSR,
- ? ? ? GPIO100_UART1_DCD,
- ? ? ? GPIO102_UART1_RI,
-
- ? ? ? /* UART 2 configuration */
- ? ? ? GPIO109_UART2_CTS,
- ? ? ? GPIO112_UART2_RTS,
- ? ? ? GPIO110_UART2_RXD,
- ? ? ? GPIO111_UART2_TXD,
-
- ? ? ? /* UART 3 configuration */
- ? ? ? GPIO30_UART3_RXD,
- ? ? ? GPIO31_UART3_TXD,
-};
-
-static void __init colibri_pxa320_init_uart(void)
-{
- ? ? ? pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_uart_pin_config));
-}
-

?void __init colibri_pxa320_init(void)
?{
- ? ? ? pxa_set_ffuart_info(NULL);
- ? ? ? pxa_set_btuart_info(NULL);
- ? ? ? pxa_set_stuart_info(NULL);
-
? ? ? ?colibri_pxa320_init_eth();
- ? ? ? colibri_pxa320_init_ohci();
? ? ? ?colibri_pxa3xx_init_nand();
? ? ? ?colibri_pxa320_init_lcd();
? ? ? ?colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
? ? ? ?colibri_pxa320_init_ac97();
- ? ? ? colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config),
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mfp_to_gpio(MFP_PIN_GPIO28));
- ? ? ? colibri_pxa320_init_uart();
? ? ? ?colibri_pxa320_init_udc();
+
+ ? ? ? /* Evalboard init */
+ ? ? ? pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_evalboard_pin_config));
+ ? ? ? colibri_pxa270_evalboard_init();
?}

?MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")

arch/arm/mach-pxa/colibri-pxa3xx.c +0 -0
index 199afa2..96b2d9f 100644
@@ -64,55 +64,6 @@ void __init colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data)
 ?}

?#endif

arch/arm/mach-pxa/colibri-pxa3xx.c +0 -49
-#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
-static int mmc_detect_pin;
-
-static int colibri_pxa3xx_mci_init(struct device *dev,
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?irq_handler_t colibri_mmc_detect_int,
- ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?void *data)
-{
- ? ? ? int ret;
-
- ? ? ? ret = gpio_request(mmc_detect_pin, "mmc card detect");
- ? ? ? if (ret)
- ? ? ? ? ? ? ? return ret;
-
- ? ? ? gpio_direction_input(mmc_detect_pin);
- ? ? ? ret = request_irq(gpio_to_irq(mmc_detect_pin), colibri_mmc_detect_int,
- ? ? ? ? ? ? ? ? ? ? ? ? IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
- ? ? ? ? ? ? ? ? ? ? ? ? "MMC card detect", data);
- ? ? ? if (ret) {
- ? ? ? ? ? ? ? gpio_free(mmc_detect_pin);
- ? ? ? ? ? ? ? return ret;
- ? ? ? }
-
- ? ? ? return 0;
-}
-
-static void colibri_pxa3xx_mci_exit(struct device *dev, void *data)
-{
- ? ? ? free_irq(mmc_detect_pin, data);
- ? ? ? gpio_free(gpio_to_irq(mmc_detect_pin));
-}
-
-static struct pxamci_platform_data colibri_pxa3xx_mci_platform_data = {
- ? ? ? .detect_delay_ms ? ? ? ?= 200,
- ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
- ? ? ? .init ? ? ? ? ? ? ? ? ? = colibri_pxa3xx_mci_init,
- ? ? ? .exit ? ? ? ? ? ? ? ? ? = colibri_pxa3xx_mci_exit,
- ? ? ? .gpio_card_detect ? ? ? = -1,
- ? ? ? .gpio_card_ro ? ? ? ? ? = -1,
- ? ? ? .gpio_power ? ? ? ? ? ? = -1,
-};
-
-void __init colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin)
-{
- ? ? ? pxa3xx_mfp_config(pins, len);
- ? ? ? mmc_detect_pin = detect_pin;
- ? ? ? pxa_set_mci_info(&colibri_pxa3xx_mci_platform_data);
-}
-#endif /* CONFIG_MMC_PXA || CONFIG_MMC_PXA_MODULE */
-

?#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) ?static int lcd_bl_pin;

arch/arm/mach-pxa/include/mach/colibri.h +0 -0
index 58dada1..63a948a 100644
@@ -59,5 +59,11 @@ static inline void colibri_pxa3xx_init_nand(void) {}

?#define GPIO0_COLIBRI_PXA270_SD_DETECT 0
?#define GPIO113_COLIBRI_PXA270_TS_IRQ ?113

arch/arm/mach-pxa/include/mach/colibri.h +6 -0
+/* GPIO definitions for Colibri PXA300/310 */
+#define GPIO39_COLIBRI_PXA300_SD_DETECT ? ? ? ?39
+
+/* GPIO definitions for Colibri PXA320 */
+#define GPIO28_COLIBRI_PXA320_SD_DETECT ? ? ? ?28
+

?#endif /* _COLIBRI_H_ */

--
1.7.1

#7 lore raw

PATCH 3/11 ARM: pxa: Push Colibri evalboard MFP into module files

Dne Po 20. z??? 2010 16:29:39 Eric Miao napsal(a):

Quoted 122 lines · Marek Vasut
Quoted 121 lines

This change -- pushing the MFP configuration back into Module files -- is necessary because some evalboards can be used with multiple modules, where MFP differs from module to module. Therefore MFP isn't board-specific, but module-specific and the module should preconfigure itself for the board.

(And there is also the C preprocesor limitation and conflicting #define-s)

---
 arch/arm/mach-pxa/Kconfig                    |    8 +-
 arch/arm/mach-pxa/colibri-pxa270-evalboard.c |   61 ++++-----------
 arch/arm/mach-pxa/colibri-pxa270-income.c    |   47 -----------
 arch/arm/mach-pxa/colibri-pxa270.c           |   96

++++++++++++++++++++++ arch/arm/mach-pxa/colibri-pxa300.c |
61 ++++++--------- arch/arm/mach-pxa/colibri-pxa320.c | 112
++++++++++---------------- arch/arm/mach-pxa/colibri-pxa3xx.c
| 49 ----------- arch/arm/mach-pxa/include/mach/colibri.h | 6
++

 8 files changed, 188 insertions(+), 252 deletions(-)
arch/arm/mach-pxa/Kconfig +4 -4
index dd235ec..b44d613 100644
@@ -232,10 +232,6 @@ config MACH_COLIBRI
       bool "Toradex Colibri PXA270"
       select PXA27x
 
-config MACH_COLIBRI_PXA270_EVALBOARD
-       bool "Toradex Colibri Evaluation Carrier Board support (PXA270)"
-       depends on MACH_COLIBRI
-
 config MACH_COLIBRI_PXA270_INCOME
       bool "Income s.r.o. PXA270 SBC"
       depends on MACH_COLIBRI
@@ -253,6 +249,10 @@ config MACH_COLIBRI320
       select PXA3xx
       select CPU_PXA320
 
+config MACH_COLIBRI_PXA270_EVALBOARD
+       bool "Toradex Colibri Evaluation Carrier Board support"
+       depends on MACH_COLIBRI || MACH_COLIBRI300 || MACH_COLIBRI320
+
 config MACH_VPAC270
       bool "Voipac PXA270"
       select PXA27x
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa270-evalboard.c index 6177ff5..e1a2b52 100644

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +0 -1
@@ -30,61 +30,28 @@
 #include "devices.h"
 
 /***********************************************************************
 ******* - * Pin configuration
-
 ************************************************************************
 ******/ -static mfp_cfg_t colibri_pxa270_evalboard_pin_config[]

__initdata = { - /* MMC */

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +0 -38
-       GPIO32_MMC_CLK,
-       GPIO92_MMC_DAT_0,
-       GPIO109_MMC_DAT_1,
-       GPIO110_MMC_DAT_2,
-       GPIO111_MMC_DAT_3,
-       GPIO112_MMC_CMD,
-       GPIO0_GPIO,     /* SD detect */
-
-       /* FFUART */
-       GPIO39_FFUART_TXD,
-       GPIO34_FFUART_RXD,
-
-       /* UHC */
-       GPIO88_USBH1_PWR,
-       GPIO89_USBH1_PEN,
-       GPIO119_USBH2_PWR,
-       GPIO120_USBH2_PEN,
-
-       /* PCMCIA */
-       GPIO85_nPCE_1,
-       GPIO54_nPCE_2,
-       GPIO55_nPREG,
-       GPIO50_nPIOR,
-       GPIO51_nPIOW,
-       GPIO49_nPWE,
-       GPIO48_nPOE,
-       GPIO57_nIOIS16,
-       GPIO56_nPWAIT,
-       GPIO104_PSKTSEL,
-       GPIO53_GPIO,    /* RESET */
-       GPIO83_GPIO,    /* BVD1 */
-       GPIO82_GPIO,    /* BVD2 */
-       GPIO1_GPIO,     /* READY */
-       GPIO84_GPIO,    /* DETECT */
-       GPIO107_GPIO,   /* PPEN */
-};
-
-/***********************************************************************

******* * SD/MMC card controller
************************************************************************
******/ #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
static struct pxamci_platform_data colibri_pxa270_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
.gpio_power = -1,

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +7 -1
-       .gpio_card_detect       = GPIO0_COLIBRI_PXA270_SD_DETECT,
       .gpio_card_ro           = -1,
       .detect_delay_ms        = 200,
 };
 
 static void __init colibri_pxa270_mmc_init(void)
 {
+       if (machine_is_colibri())       /* PXA270 Colibri */
+               colibri_pxa270_mci_platform_data.gpio_card_detect =
+                       GPIO0_COLIBRI_PXA270_SD_DETECT;
+       if (machine_is_colibri300())    /* PXA300 Colibri */
+               colibri_pxa270_mci_platform_data.gpio_card_detect =
+                       GPIO39_COLIBRI_PXA300_SD_DETECT;
+       else                            /* PXA320 Colibri */
Quoted 8 lines

arch/arm/mach-pxa/colibri-pxa270-evalboard.c line 54

Quoted 3 lines
arch/arm/mach-pxa/colibri-pxa270-evalboard.c +3 -0
+               colibri_pxa270_mci_platform_data.gpio_card_detect =
+                       GPIO28_COLIBRI_PXA320_SD_DETECT;
+

It's a bit confusing here in a file called colibri-pxa270-evalboard.c but pxa300 and
pxa320 code are there. And until I looked behind and saw the rename patch I came to know how it's working.

Yes, but I don't feel like reordering to patches. The gain is minimal and it's very error-prone.

Quoted 558 lines

Wouldn't be better to rename before change?

Quoted 555 lines
       pxa_set_mci_info(&colibri_pxa270_mci_platform_data);

}
#else

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +5 -1
@@ -103,13 +70,17 @@ static int colibri_pxa270_ohci_init(struct device
 *dev)
 
 static struct pxaohci_platform_data colibri_pxa270_ohci_info = {
       .port_mode      = PMM_PERPORT_MODE,
-       .flags          = ENABLE_PORT1 | ENABLE_PORT2 |
+       .flags          = ENABLE_PORT1 |
                         POWER_CONTROL_LOW | POWER_SENSE_LOW,
       .init           = colibri_pxa270_ohci_init,
 };
 
 static void __init colibri_pxa270_uhc_init(void)
 {
+       /* Colibri PXA270 has two usb ports, TBA for 320 */
+       if (machine_is_colibri())
+               colibri_pxa270_ohci_info.flags  |= ENABLE_PORT2;
+
       pxa_set_ohci_info(&colibri_pxa270_ohci_info);
 }

#else

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +0 -1
@@ -118,7 +89,6 @@ static inline void colibri_pxa270_uhc_init(void) {}
 
 void __init colibri_pxa270_evalboard_init(void)
 {
-      
 pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_evalboard_pin_config));
 pxa_set_ffuart_info(NULL);
       pxa_set_btuart_info(NULL);
       pxa_set_stuart_info(NULL);
arch/arm/mach-pxa/colibri-pxa270-evalboard.c +0 -1
@@ -126,4 +96,3 @@ void __init colibri_pxa270_evalboard_init(void)
       colibri_pxa270_mmc_init();
       colibri_pxa270_uhc_init();
 }
-
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa270-income.c index 37f0f3e..07b62a0 100644

arch/arm/mach-pxa/colibri-pxa270-income.c +0 -44
@@ -46,52 +46,6 @@
 #define GPIO113_INCOME_TS_IRQ   (113)
 
 /***********************************************************************
 ******* - * Pin configuration
-
 ************************************************************************
 ******/ -static mfp_cfg_t income_pin_config[] __initdata = {
-       /* MMC */
-       GPIO32_MMC_CLK,
-       GPIO92_MMC_DAT_0,
-       GPIO109_MMC_DAT_1,
-       GPIO110_MMC_DAT_2,
-       GPIO111_MMC_DAT_3,
-       GPIO112_MMC_CMD,
-       GPIO0_GPIO,     /* SD detect */
-       GPIO1_GPIO,     /* SD read-only */
-
-       /* FFUART */
-       GPIO39_FFUART_TXD,
-       GPIO34_FFUART_RXD,
-
-       /* BFUART */
-       GPIO42_BTUART_RXD,
-       GPIO43_BTUART_TXD,
-       GPIO45_BTUART_RTS,
-
-       /* STUART */
-       GPIO46_STUART_RXD,
-       GPIO47_STUART_TXD,
-
-       /* UHC */
-       GPIO88_USBH1_PWR,
-       GPIO89_USBH1_PEN,
-
-       /* LCD */
-       GPIOxx_LCD_TFT_16BPP,
-
-       /* PWM */
-       GPIO16_PWM0_OUT,
-
-       /* I2C */
-       GPIO117_I2C_SCL,
-       GPIO118_I2C_SDA,
-
-       /* LED */
-       GPIO54_GPIO,    /* LED A */
-       GPIO55_GPIO,    /* LED B */
-};
-
-/***********************************************************************

******* * SD/MMC card controller
************************************************************************
******/ #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)

arch/arm/mach-pxa/colibri-pxa270-income.c +0 -1
@@ -257,7 +211,6 @@ static inline void income_pwm_init(void) {}
 
 void __init colibri_pxa270_income_boardinit(void)
 {
-       pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));
       pxa_set_ffuart_info(NULL);
       pxa_set_btuart_info(NULL);
       pxa_set_stuart_info(NULL);
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa270.c index 98673ac..8488dfe 100644

arch/arm/mach-pxa/colibri-pxa270.c +91 -0
@@ -33,6 +33,99 @@
 #include "generic.h"
 
 /***********************************************************************
 ******* + * Evaluation board MFP
+
 ************************************************************************
 ******/ +#ifdef  CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
+       /* MMC */
+       GPIO32_MMC_CLK,
+       GPIO92_MMC_DAT_0,
+       GPIO109_MMC_DAT_1,
+       GPIO110_MMC_DAT_2,
+       GPIO111_MMC_DAT_3,
+       GPIO112_MMC_CMD,
+       GPIO0_GPIO,     /* SD detect */
+
+       /* FFUART */
+       GPIO39_FFUART_TXD,
+       GPIO34_FFUART_RXD,
+
+       /* UHC */
+       GPIO88_USBH1_PWR,
+       GPIO89_USBH1_PEN,
+       GPIO119_USBH2_PWR,
+       GPIO120_USBH2_PEN,
+
+       /* PCMCIA */
+       GPIO85_nPCE_1,
+       GPIO54_nPCE_2,
+       GPIO55_nPREG,
+       GPIO50_nPIOR,
+       GPIO51_nPIOW,
+       GPIO49_nPWE,
+       GPIO48_nPOE,
+       GPIO57_nIOIS16,
+       GPIO56_nPWAIT,
+       GPIO104_PSKTSEL,
+       GPIO53_GPIO,    /* RESET */
+       GPIO83_GPIO,    /* BVD1 */
+       GPIO82_GPIO,    /* BVD2 */
+       GPIO1_GPIO,     /* READY */
+       GPIO84_GPIO,    /* DETECT */
+       GPIO107_GPIO,   /* PPEN */
+};
+#else
+static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {};
+#endif
+
+#ifdef CONFIG_MACH_COLIBRI_PXA270_INCOME
+static mfp_cfg_t income_pin_config[] __initdata = {
+       /* MMC */
+       GPIO32_MMC_CLK,
+       GPIO92_MMC_DAT_0,
+       GPIO109_MMC_DAT_1,
+       GPIO110_MMC_DAT_2,
+       GPIO111_MMC_DAT_3,
+       GPIO112_MMC_CMD,
+       GPIO0_GPIO,     /* SD detect */
+       GPIO1_GPIO,     /* SD read-only */
+
+       /* FFUART */
+       GPIO39_FFUART_TXD,
+       GPIO34_FFUART_RXD,
+
+       /* BFUART */
+       GPIO42_BTUART_RXD,
+       GPIO43_BTUART_TXD,
+       GPIO45_BTUART_RTS,
+
+       /* STUART */
+       GPIO46_STUART_RXD,
+       GPIO47_STUART_TXD,
+
+       /* UHC */
+       GPIO88_USBH1_PWR,
+       GPIO89_USBH1_PEN,
+
+       /* LCD */
+       GPIOxx_LCD_TFT_16BPP,
+
+       /* PWM */
+       GPIO16_PWM0_OUT,
+
+       /* I2C */
+       GPIO117_I2C_SCL,
+       GPIO118_I2C_SDA,
+
+       /* LED */
+       GPIO54_GPIO,    /* LED A */
+       GPIO55_GPIO,    /* LED B */
+};
+#else
+static mfp_cfg_t income_pin_config[] __initdata = {};
+#endif
+
+/***********************************************************************

******* * Pin configuration
************************************************************************
******/ static mfp_cfg_t colibri_pxa270_pin_config[] __initdata = {

arch/arm/mach-pxa/colibri-pxa270.c +3 -0
@@ -185,9 +278,12 @@ static void __init colibri_pxa270_init(void)
 
       switch (colibri_pxa270_baseboard) {
       case COLIBRI_PXA270_EVALBOARD:
+               pxa2xx_mfp_config(ARRAY_AND_SIZE(
+                       colibri_pxa270_evalboard_pin_config));
               colibri_pxa270_evalboard_init();
               break;
       case COLIBRI_PXA270_INCOME:
+               pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));
               colibri_pxa270_income_boardinit();
               break;
       default:
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa300.c index 40b6ac2..dab49ce 100644

arch/arm/mach-pxa/colibri-pxa300.c +20 -35
@@ -31,9 +31,28 @@
 #include "generic.h"
 #include "devices.h"
 
+
+#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
+       /* MMC */
+       GPIO7_MMC1_CLK,
+       GPIO14_MMC1_CMD,
+       GPIO3_MMC1_DAT0,
+       GPIO4_MMC1_DAT1,
+       GPIO5_MMC1_DAT2,
+       GPIO6_MMC1_DAT3,
+       GPIO39_GPIO,    /* SD detect */
+
+       /* UHC */
+       GPIO0_2_USBH_PEN,
+       GPIO1_2_USBH_PWR,
+};
+#else
+static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
+#endif
+
 #if defined(CONFIG_AX88796)
 #define COLIBRI_ETH_IRQ_GPIO   mfp_to_gpio(GPIO26_GPIO)
-
 /*
 * Asix AX88796 Ethernet
 */
@@ -80,35 +99,6 @@ static void __init colibri_pxa300_init_eth(void)
 static inline void __init colibri_pxa300_init_eth(void) {}
 #endif /* CONFIG_AX88796 */
 
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-static mfp_cfg_t colibri_pxa300_usb_pin_config[] __initdata = {
-       GPIO0_2_USBH_PEN,
-       GPIO1_2_USBH_PWR,
-};
-
-static struct pxaohci_platform_data colibri_pxa300_ohci_info = {
-       .port_mode      = PMM_GLOBAL_MODE,
-       .flags          = ENABLE_PORT1 | POWER_CONTROL_LOW |
 POWER_SENSE_LOW, -};
-
-void __init colibri_pxa300_init_ohci(void)
-{
-       pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_usb_pin_config));
-       pxa_set_ohci_info(&colibri_pxa300_ohci_info);
-}
-#else
-static inline void colibri_pxa300_init_ohci(void) {}
-#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
-
-static mfp_cfg_t colibri_pxa300_mmc_pin_config[] __initdata = {
-       GPIO7_MMC1_CLK,
-       GPIO14_MMC1_CMD,
-       GPIO3_MMC1_DAT0,
-       GPIO4_MMC1_DAT1,
-       GPIO5_MMC1_DAT2,
-       GPIO6_MMC1_DAT3,
-};
-
 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
 static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
       GPIO54_LCD_LDD_0,
@@ -171,18 +161,15 @@ static inline void colibri_pxa310_init_ac97(void)
 {}
 
 void __init colibri_pxa300_init(void)
 {
-       pxa_set_ffuart_info(NULL);
-       pxa_set_btuart_info(NULL);
-       pxa_set_stuart_info(NULL);
-
       colibri_pxa300_init_eth();
-       colibri_pxa300_init_ohci();
       colibri_pxa3xx_init_nand();
       colibri_pxa300_init_lcd();
       colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
       colibri_pxa310_init_ac97();
-      

colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa300_mmc_pin_config), -

                              mfp_to_gpio(MFP_PIN_GPIO13));
arch/arm/mach-pxa/colibri-pxa300.c +3 -0
+
+       /* Evalboard init */
+      

pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));

arch/arm/mach-pxa/colibri-pxa300.c +1 -0
+       colibri_pxa270_evalboard_init();
 }
 
 MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa320.c index 99e850d..e886ab2 100644

arch/arm/mach-pxa/colibri-pxa320.c +39 -20
@@ -35,9 +35,47 @@
 #include "generic.h"
 #include "devices.h"
 
+#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {
+       /* MMC */
+       GPIO22_MMC1_CLK,
+       GPIO23_MMC1_CMD,
+       GPIO18_MMC1_DAT0,
+       GPIO19_MMC1_DAT1,
+       GPIO20_MMC1_DAT2,
+       GPIO21_MMC1_DAT3,
+       GPIO28_GPIO,    /* SD detect */
+
+       /* UART 1 configuration (may be set by bootloader) */
+       GPIO99_UART1_CTS,
+       GPIO104_UART1_RTS,
+       GPIO97_UART1_RXD,
+       GPIO98_UART1_TXD,
+       GPIO101_UART1_DTR,
+       GPIO103_UART1_DSR,
+       GPIO100_UART1_DCD,
+       GPIO102_UART1_RI,
+
+       /* UART 2 configuration */
+       GPIO109_UART2_CTS,
+       GPIO112_UART2_RTS,
+       GPIO110_UART2_RXD,
+       GPIO111_UART2_TXD,
+
+       /* UART 3 configuration */
+       GPIO30_UART3_RXD,
+       GPIO31_UART3_TXD,
+
+       /* UHC */
+       GPIO2_2_USBH_PEN,
+       GPIO3_2_USBH_PWR,
+};
+#else
+static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {};
+#endif
+
 #if defined(CONFIG_AX88796)
 #define COLIBRI_ETH_IRQ_GPIO   mfp_to_gpio(GPIO36_GPIO)
-
 /*
 * Asix AX88796 Ethernet
 */
@@ -84,26 +122,6 @@ static void __init colibri_pxa320_init_eth(void)
 static inline void __init colibri_pxa320_init_eth(void) {}
 #endif /* CONFIG_AX88796 */
 
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = {
-       GPIO2_2_USBH_PEN,
-       GPIO3_2_USBH_PWR,
-};
-
-static struct pxaohci_platform_data colibri_pxa320_ohci_info = {
-       .port_mode      = PMM_GLOBAL_MODE,
-       .flags          = ENABLE_PORT1 | POWER_CONTROL_LOW |
 POWER_SENSE_LOW, -};
-
-void __init colibri_pxa320_init_ohci(void)
-{
-       pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config));
-       pxa_set_ohci_info(&colibri_pxa320_ohci_info);
-}
-#else
-static inline void colibri_pxa320_init_ohci(void) {}
-#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
-
 #if

defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODU LE) static struct gpio_vbus_mach_info colibri_pxa320_gpio_vbus_info = {
.gpio_vbus = mfp_to_gpio(MFP_PIN_GPIO96),

arch/arm/mach-pxa/colibri-pxa320.c +0 -9
@@ -140,15 +158,6 @@ static void __init colibri_pxa320_init_udc(void)
 static inline void colibri_pxa320_init_udc(void) {}
 #endif
 
-static mfp_cfg_t colibri_pxa320_mmc_pin_config[] __initdata = {
-       GPIO22_MMC1_CLK,
-       GPIO23_MMC1_CMD,
-       GPIO18_MMC1_DAT0,
-       GPIO19_MMC1_DAT1,
-       GPIO20_MMC1_DAT2,
-       GPIO21_MMC1_DAT3
-};
-
 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
 static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = {
       GPIO6_2_LCD_LDD_0,
@@ -205,53 +214,18 @@ static inline void __init

colibri_pxa320_init_ac97(void) static inline void
colibri_pxa320_init_ac97(void) {}
#endif

-/*
- * The following configuration is verified to work with the Toradex Orchid - * carrier board
- */

arch/arm/mach-pxa/colibri-pxa320.c +0 -25
-static mfp_cfg_t colibri_pxa320_uart_pin_config[] __initdata = {
-       /* UART 1 configuration (may be set by bootloader) */
-       GPIO99_UART1_CTS,
-       GPIO104_UART1_RTS,
-       GPIO97_UART1_RXD,
-       GPIO98_UART1_TXD,
-       GPIO101_UART1_DTR,
-       GPIO103_UART1_DSR,
-       GPIO100_UART1_DCD,
-       GPIO102_UART1_RI,
-
-       /* UART 2 configuration */
-       GPIO109_UART2_CTS,
-       GPIO112_UART2_RTS,
-       GPIO110_UART2_RXD,
-       GPIO111_UART2_TXD,
-
-       /* UART 3 configuration */
-       GPIO30_UART3_RXD,
-       GPIO31_UART3_TXD,
-};
-
-static void __init colibri_pxa320_init_uart(void)
-{
-      

pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_uart_pin_config)); -}

arch/arm/mach-pxa/colibri-pxa320.c +0 -7
-
 void __init colibri_pxa320_init(void)
 {
-       pxa_set_ffuart_info(NULL);
-       pxa_set_btuart_info(NULL);
-       pxa_set_stuart_info(NULL);
-
       colibri_pxa320_init_eth();
-       colibri_pxa320_init_ohci();
       colibri_pxa3xx_init_nand();
       colibri_pxa320_init_lcd();
       colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
       colibri_pxa320_init_ac97();
-      

colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config), -

                              mfp_to_gpio(MFP_PIN_GPIO28));
arch/arm/mach-pxa/colibri-pxa320.c +3 -1
-       colibri_pxa320_init_uart();
       colibri_pxa320_init_udc();
+
+       /* Evalboard init */
+      

pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_evalboard_pin_config));

arch/arm/mach-pxa/colibri-pxa320.c +1 -0
+       colibri_pxa270_evalboard_init();
 }
 
 MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa3xx.c index 199afa2..96b2d9f 100644

arch/arm/mach-pxa/colibri-pxa3xx.c +0 -15
@@ -64,55 +64,6 @@ void __init colibri_pxa3xx_init_eth(struct
 ax_plat_data *plat_data) }
 #endif
 
-#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
-static int mmc_detect_pin;
-
-static int colibri_pxa3xx_mci_init(struct device *dev,
-                                  irq_handler_t colibri_mmc_detect_int,
-                                  void *data)
-{
-       int ret;
-
-       ret = gpio_request(mmc_detect_pin, "mmc card detect");
-       if (ret)
-               return ret;
-
-       gpio_direction_input(mmc_detect_pin);
-       ret = request_irq(gpio_to_irq(mmc_detect_pin),

colibri_mmc_detect_int, - IRQF_TRIGGER_RISING |
IRQF_TRIGGER_FALLING, - "MMC card detect",
data);

arch/arm/mach-pxa/colibri-pxa3xx.c +0 -25
-       if (ret) {
-               gpio_free(mmc_detect_pin);
-               return ret;
-       }
-
-       return 0;
-}
-
-static void colibri_pxa3xx_mci_exit(struct device *dev, void *data)
-{
-       free_irq(mmc_detect_pin, data);
-       gpio_free(gpio_to_irq(mmc_detect_pin));
-}
-
-static struct pxamci_platform_data colibri_pxa3xx_mci_platform_data = {
-       .detect_delay_ms        = 200,
-       .ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
-       .init                   = colibri_pxa3xx_mci_init,
-       .exit                   = colibri_pxa3xx_mci_exit,
-       .gpio_card_detect       = -1,
-       .gpio_card_ro           = -1,
-       .gpio_power             = -1,
-};
-
-void __init colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int

detect_pin) -{

arch/arm/mach-pxa/colibri-pxa3xx.c +0 -6
-       pxa3xx_mfp_config(pins, len);
-       mmc_detect_pin = detect_pin;
-       pxa_set_mci_info(&colibri_pxa3xx_mci_platform_data);
-}
-#endif /* CONFIG_MMC_PXA || CONFIG_MMC_PXA_MODULE */
-
 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
 static int lcd_bl_pin;
(quoted diff) +0 -0

b/arch/arm/mach-pxa/include/mach/colibri.h index 58dada1..63a948a 100644

arch/arm/mach-pxa/include/mach/colibri.h +6 -1
@@ -59,5 +59,11 @@ static inline void colibri_pxa3xx_init_nand(void) {}
 #define GPIO0_COLIBRI_PXA270_SD_DETECT 0
 #define GPIO113_COLIBRI_PXA270_TS_IRQ  113
 
+/* GPIO definitions for Colibri PXA300/310 */
+#define GPIO39_COLIBRI_PXA300_SD_DETECT        39
+
+/* GPIO definitions for Colibri PXA320 */
+#define GPIO28_COLIBRI_PXA320_SD_DETECT        28
+
 #endif /* _COLIBRI_H_ */
 
--

1.7.1

#8 lore raw

PATCH 4/11 ARM: pxa: Add M41T00 RTC support into Colibri evalboard

In reply to Marek Vasut
---
 arch/arm/mach-pxa/colibri-pxa270-evalboard.c |   23 +++++++++++++++++++++++
 arch/arm/mach-pxa/colibri-pxa270.c           |    4 ++++
 arch/arm/mach-pxa/colibri-pxa300.c           |    4 ++++
 arch/arm/mach-pxa/colibri-pxa320.c           |    4 ++++
 4 files changed, 35 insertions(+), 0 deletions(-)
arch/arm/mach-pxa/colibri-pxa270-evalboard.c +23 -0
index e1a2b52..7f27aec 100644
@@ -19,6 +19,7 @@
 #include <asm/mach-types.h>
 #include <mach/hardware.h>
 #include <asm/mach/arch.h>
+#include <linux/i2c.h>
 
 #include <mach/pxa27x.h>
 #include <mach/colibri.h>
@@ -26,6 +27,8 @@
 #include <mach/ohci.h>
 #include <mach/pxa27x-udc.h>
 
+#include <plat/i2c.h>
+
 #include "generic.h"
 #include "devices.h"
 
@@ -87,6 +90,25 @@ static void __init colibri_pxa270_uhc_init(void)
 static inline void colibri_pxa270_uhc_init(void) {}
 #endif
 
+/******************************************************************************
+ * I2C RTC
+ ******************************************************************************/
+#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
+static struct i2c_board_info __initdata colibri_pxa270_i2c_devs[] = {
+	{
+		I2C_BOARD_INFO("m41t00", 0x68),
+	},
+};
+
+static void __init colibri_pxa270_rtc_init(void)
+{
+	pxa_set_i2c_info(NULL);
+	i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_pxa270_i2c_devs));
+}
+#else
+static inline void colibri_pxa270_rtc_init(void) {}
+#endif
+
 void __init colibri_pxa270_evalboard_init(void)
 {
 	pxa_set_ffuart_info(NULL);
@@ -95,4 +117,5 @@ void __init colibri_pxa270_evalboard_init(void)
 
 	colibri_pxa270_mmc_init();
 	colibri_pxa270_uhc_init();
+	colibri_pxa270_rtc_init();
 }
arch/arm/mach-pxa/colibri-pxa270.c +4 -0
index 8488dfe..1024da5 100644
@@ -73,6 +73,10 @@ static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
 	GPIO1_GPIO,	/* READY */
 	GPIO84_GPIO,	/* DETECT */
 	GPIO107_GPIO,	/* PPEN */
+
+	/* I2C */
+	GPIO117_I2C_SCL,
+	GPIO118_I2C_SDA,
 };
 #else
 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {};
arch/arm/mach-pxa/colibri-pxa300.c +4 -0
index dab49ce..5bf8055 100644
@@ -46,6 +46,10 @@ static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
 	/* UHC */
 	GPIO0_2_USBH_PEN,
 	GPIO1_2_USBH_PWR,
+
+	/* I2C */
+	GPIO21_I2C_SCL,
+	GPIO22_I2C_SDA,
 };
 #else
 static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
arch/arm/mach-pxa/colibri-pxa320.c +4 -0
index e886ab2..4257382 100644
@@ -69,6 +69,10 @@ static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {
 	/* UHC */
 	GPIO2_2_USBH_PEN,
 	GPIO3_2_USBH_PWR,
+
+	/* I2C */
+	GPIO32_I2C_SCL,
+	GPIO33_I2C_SDA,
 };
 #else
 static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {};
Signature · 1 line
1.7.1
#9 lore raw

PATCH 4/11 ARM: pxa: Add M41T00 RTC support into Colibri evalboard

Quoted 2 lines · Marek Vasut

OK.

Quoted 109 lines

---

?arch/arm/mach-pxa/colibri-pxa270-evalboard.c | ? 23 +++++++++++++++++++++++
?arch/arm/mach-pxa/colibri-pxa270.c ? ? ? ? ? | ? ?4 ++++
?arch/arm/mach-pxa/colibri-pxa300.c ? ? ? ? ? | ? ?4 ++++
?arch/arm/mach-pxa/colibri-pxa320.c ? ? ? ? ? | ? ?4 ++++

?4 files changed, 35 insertions(+), 0 deletions(-)

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +0 -0
index e1a2b52..7f27aec 100644
@@ -19,6 +19,7 @@

?#include <asm/mach-types.h>
?#include <mach/hardware.h>
?#include <asm/mach/arch.h>
+#include <linux/i2c.h>

?#include <mach/pxa27x.h>
?#include <mach/colibri.h>

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +0 -0
@@ -26,6 +27,8 @@

?#include <mach/ohci.h>
?#include <mach/pxa27x-udc.h>

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +2 -0
+#include <plat/i2c.h>
+

?#include "generic.h"
?#include "devices.h"

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +0 -0
@@ -87,6 +90,25 @@ static void __init colibri_pxa270_uhc_init(void)
 ?static inline void colibri_pxa270_uhc_init(void) {}

?#endif

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +19 -0
+/******************************************************************************
+ * I2C RTC
+ ******************************************************************************/
+#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
+static struct i2c_board_info __initdata colibri_pxa270_i2c_devs[] = {
+ ? ? ? {
+ ? ? ? ? ? ? ? I2C_BOARD_INFO("m41t00", 0x68),
+ ? ? ? },
+};
+
+static void __init colibri_pxa270_rtc_init(void)
+{
+ ? ? ? pxa_set_i2c_info(NULL);
+ ? ? ? i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_pxa270_i2c_devs));
+}
+#else
+static inline void colibri_pxa270_rtc_init(void) {}
+#endif
+

?void __init colibri_pxa270_evalboard_init(void)
?{
? ? ? ?pxa_set_ffuart_info(NULL);

arch/arm/mach-pxa/colibri-pxa270-evalboard.c +1 -0
@@ -95,4 +117,5 @@ void __init colibri_pxa270_evalboard_init(void)
 
 ? ? ? ?colibri_pxa270_mmc_init();
 ? ? ? ?colibri_pxa270_uhc_init();
+ ? ? ? colibri_pxa270_rtc_init();
 ?}
arch/arm/mach-pxa/colibri-pxa270.c +0 -0
index 8488dfe..1024da5 100644
@@ -73,6 +73,10 @@ static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {

? ? ? ?GPIO1_GPIO, ? ? /* READY */
? ? ? ?GPIO84_GPIO, ? ?/* DETECT */
? ? ? ?GPIO107_GPIO, ? /* PPEN */
+
+ ? ? ? /* I2C */
+ ? ? ? GPIO117_I2C_SCL,
+ ? ? ? GPIO118_I2C_SDA,
?};
?#else
?static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {};

arch/arm/mach-pxa/colibri-pxa300.c +0 -0
index dab49ce..5bf8055 100644
@@ -46,6 +46,10 @@ static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {

? ? ? ?/* UHC */
? ? ? ?GPIO0_2_USBH_PEN,
? ? ? ?GPIO1_2_USBH_PWR,
+
+ ? ? ? /* I2C */
+ ? ? ? GPIO21_I2C_SCL,
+ ? ? ? GPIO22_I2C_SDA,
?};
?#else
?static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};

arch/arm/mach-pxa/colibri-pxa320.c +0 -0
index e886ab2..4257382 100644
@@ -69,6 +69,10 @@ static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {

? ? ? ?/* UHC */
? ? ? ?GPIO2_2_USBH_PEN,
? ? ? ?GPIO3_2_USBH_PWR,
+
+ ? ? ? /* I2C */
+ ? ? ? GPIO32_I2C_SCL,
+ ? ? ? GPIO33_I2C_SDA,
?};
?#else
?static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {}; --
1.7.1

#10 lore raw

PATCH 5/11 ARM: pxa: Rename Colibri evalboard

In reply to Marek Vasut

Rename colibri-pxa270-evalboard to colibri-evalboard as this board is used with all Colibri modules.

---
 arch/arm/mach-pxa/Kconfig                    |    2 +-
 arch/arm/mach-pxa/Makefile                   |    2 +-
 arch/arm/mach-pxa/colibri-evalboard.c        |  121 ++++++++++++++++++++++++++
 arch/arm/mach-pxa/colibri-pxa270-evalboard.c |  121 --------------------------
 arch/arm/mach-pxa/colibri-pxa270.c           |    6 +-
 arch/arm/mach-pxa/colibri-pxa300.c           |    4 +-
 arch/arm/mach-pxa/colibri-pxa320.c           |    4 +-
 arch/arm/mach-pxa/include/mach/colibri.h     |    8 +-
 8 files changed, 134 insertions(+), 134 deletions(-)
 create mode 100644 arch/arm/mach-pxa/colibri-evalboard.c
 delete mode 100644 arch/arm/mach-pxa/colibri-pxa270-evalboard.c
arch/arm/mach-pxa/Kconfig +1 -1
index b44d613..e0ac5aa 100644
@@ -249,7 +249,7 @@ config MACH_COLIBRI320
 	select PXA3xx
 	select CPU_PXA320
 
-config MACH_COLIBRI_PXA270_EVALBOARD
+config MACH_COLIBRI_EVALBOARD
 	bool "Toradex Colibri Evaluation Carrier Board support"
 	depends on MACH_COLIBRI || MACH_COLIBRI300 || MACH_COLIBRI320
 
arch/arm/mach-pxa/Makefile +1 -1
index e2f89c2..3197756 100644
@@ -60,7 +60,7 @@ obj-$(CONFIG_MACH_LOGICPD_PXA270)	+= lpd270.o
 obj-$(CONFIG_MACH_PCM027)		+= pcm027.o
 obj-$(CONFIG_MACH_PCM990_BASEBOARD)	+= pcm990-baseboard.o
 obj-$(CONFIG_MACH_COLIBRI)			+= colibri-pxa270.o
-obj-$(CONFIG_MACH_COLIBRI_PXA270_EVALBOARD)	+= colibri-pxa270-evalboard.o
+obj-$(CONFIG_MACH_COLIBRI_EVALBOARD)	+= colibri-evalboard.o
 obj-$(CONFIG_MACH_COLIBRI_PXA270_INCOME)	+= colibri-pxa270-income.o
 obj-$(CONFIG_MACH_COLIBRI300)	+= colibri-pxa3xx.o colibri-pxa300.o
 obj-$(CONFIG_MACH_COLIBRI320)	+= colibri-pxa3xx.o colibri-pxa320.o
arch/arm/mach-pxa/colibri-evalboard.c new file +121 -0

121 lines not on this page · raw message

arch/arm/mach-pxa/colibri-pxa270-evalboard.c deleted +0 -121

121 lines not on this page · raw message

arch/arm/mach-pxa/colibri-pxa270.c +3 -3
index 1024da5..dc05af4 100644
@@ -35,7 +35,7 @@
 /******************************************************************************
  * Evaluation board MFP
  ******************************************************************************/
-#ifdef	 CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+#ifdef	 CONFIG_MACH_COLIBRI_EVALBOARD
 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
 	/* MMC */
 	GPIO32_MMC_CLK,
@@ -281,10 +281,10 @@ static void __init colibri_pxa270_init(void)
 	colibri_pxa270_tsc_init();
 
 	switch (colibri_pxa270_baseboard) {
-	case COLIBRI_PXA270_EVALBOARD:
+	case COLIBRI_EVALBOARD:
 		pxa2xx_mfp_config(ARRAY_AND_SIZE(
 			colibri_pxa270_evalboard_pin_config));
-		colibri_pxa270_evalboard_init();
+		colibri_evalboard_init();
 		break;
 	case COLIBRI_PXA270_INCOME:
 		pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));
arch/arm/mach-pxa/colibri-pxa300.c +2 -2
index 5bf8055..77e760f 100644
@@ -32,7 +32,7 @@
 #include "devices.h"
 
 
-#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+#ifdef CONFIG_MACH_COLIBRI_EVALBOARD
 static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
 	/* MMC */
 	GPIO7_MMC1_CLK,
@@ -173,7 +173,7 @@ void __init colibri_pxa300_init(void)
 
 	/* Evalboard init */
 	pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
-	colibri_pxa270_evalboard_init();
+	colibri_evalboard_init();
 }
 
 MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
arch/arm/mach-pxa/colibri-pxa320.c +2 -2
index 4257382..7c003cd 100644
@@ -35,7 +35,7 @@
 #include "generic.h"
 #include "devices.h"
 
-#ifdef	CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+#ifdef	CONFIG_MACH_COLIBRI_EVALBOARD
 static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {
 	/* MMC */
 	GPIO22_MMC1_CLK,
@@ -229,7 +229,7 @@ void __init colibri_pxa320_init(void)
 
 	/* Evalboard init */
 	pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_evalboard_pin_config));
-	colibri_pxa270_evalboard_init();
+	colibri_evalboard_init();
 }
 
 MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
arch/arm/mach-pxa/include/mach/colibri.h +4 -4
index 63a948a..388a96f 100644
@@ -9,14 +9,14 @@
  */
 
 enum {
-	COLIBRI_PXA270_EVALBOARD = 0,
+	COLIBRI_EVALBOARD = 0,
 	COLIBRI_PXA270_INCOME,
 };
 
-#if defined(CONFIG_MACH_COLIBRI_PXA270_EVALBOARD)
-extern void colibri_pxa270_evalboard_init(void);
+#if defined(CONFIG_MACH_COLIBRI_EVALBOARD)
+extern void colibri_evalboard_init(void);
 #else
-static inline void colibri_pxa270_evalboard_init(void) {}
+static inline void colibri_evalboard_init(void) {}
 #endif
 
 #if defined(CONFIG_MACH_COLIBRI_PXA270_INCOME)
Signature · 1 line
1.7.1
#11 lore raw

PATCH 5/11 ARM: pxa: Rename Colibri evalboard

Quoted 2 lines · Marek Vasut

Rename colibri-pxa270-evalboard to colibri-evalboard as this board is used with all Colibri modules.

As mentioned, would be more straight-forward if this rename happens first?

Quoted 393 lines

---

?arch/arm/mach-pxa/Kconfig ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-pxa/Makefile ? ? ? ? ? ? ? ? ? | ? ?2 +-
?arch/arm/mach-pxa/colibri-evalboard.c ? ? ? ?| ?121 ++++++++++++++++++++++++++
?arch/arm/mach-pxa/colibri-pxa270-evalboard.c | ?121 --------------------------
?arch/arm/mach-pxa/colibri-pxa270.c ? ? ? ? ? | ? ?6 +-
?arch/arm/mach-pxa/colibri-pxa300.c ? ? ? ? ? | ? ?4 +-
?arch/arm/mach-pxa/colibri-pxa320.c ? ? ? ? ? | ? ?4 +-
?arch/arm/mach-pxa/include/mach/colibri.h ? ? | ? ?8 +-

?8 files changed, 134 insertions(+), 134 deletions(-) ?create mode 100644 arch/arm/mach-pxa/colibri-evalboard.c ?delete mode 100644 arch/arm/mach-pxa/colibri-pxa270-evalboard.c

arch/arm/mach-pxa/Kconfig +0 -0
index b44d613..e0ac5aa 100644
@@ -249,7 +249,7 @@ config MACH_COLIBRI320

? ? ? ?select PXA3xx
? ? ? ?select CPU_PXA320

arch/arm/mach-pxa/Kconfig +1 -1
-config MACH_COLIBRI_PXA270_EVALBOARD
+config MACH_COLIBRI_EVALBOARD

? ? ? ?bool "Toradex Colibri Evaluation Carrier Board support" ? ? ? ?depends on MACH_COLIBRI || MACH_COLIBRI300 || MACH_COLIBRI320

arch/arm/mach-pxa/Makefile +0 -0
index e2f89c2..3197756 100644
@@ -60,7 +60,7 @@ obj-$(CONFIG_MACH_LOGICPD_PXA270) ? ? += lpd270.o

?obj-$(CONFIG_MACH_PCM027) ? ? ? ? ? ? ?+= pcm027.o ?obj-$(CONFIG_MACH_PCM990_BASEBOARD) ? ?+= pcm990-baseboard.o ?obj-$(CONFIG_MACH_COLIBRI) ? ? ? ? ? ? ? ? ? ? += colibri-pxa270.o

arch/arm/mach-pxa/Makefile +1 -1
-obj-$(CONFIG_MACH_COLIBRI_PXA270_EVALBOARD) ? ?+= colibri-pxa270-evalboard.o
+obj-$(CONFIG_MACH_COLIBRI_EVALBOARD) ? += colibri-evalboard.o

?obj-$(CONFIG_MACH_COLIBRI_PXA270_INCOME) ? ? ? += colibri-pxa270-income.o ?obj-$(CONFIG_MACH_COLIBRI300) ?+= colibri-pxa3xx.o colibri-pxa300.o ?obj-$(CONFIG_MACH_COLIBRI320) ?+= colibri-pxa3xx.o colibri-pxa320.o

arch/arm/mach-pxa/colibri-evalboard.c new file +121 -0
new file mode 100644
index 0000000..6b2c800
@@ -0,0 +1,121 @@
+/*
+ * ?linux/arch/arm/mach-pxa/colibri-evalboard.c
+ *
+ * ?Support for Toradex Colibri Evaluation Carrier Board
+ * ?Daniel Mack <[email protected]>
+ * ?Marek Vasut <[email protected]>
+ *
+ * ?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 <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/sysdev.h>
+#include <linux/interrupt.h>
+#include <linux/gpio.h>
+#include <asm/mach-types.h>
+#include <mach/hardware.h>
+#include <asm/mach/arch.h>
+#include <linux/i2c.h>
+
+#include <mach/pxa27x.h>
+#include <mach/colibri.h>
+#include <mach/mmc.h>
+#include <mach/ohci.h>
+#include <mach/pxa27x-udc.h>
+
+#include <plat/i2c.h>
+
+#include "generic.h"
+#include "devices.h"
+
+/******************************************************************************
+ * SD/MMC card controller
+ ******************************************************************************/
+#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
+static struct pxamci_platform_data colibri_mci_platform_data = {
+ ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
+ ? ? ? .gpio_power ? ? ? ? ? ? = -1,
+ ? ? ? .gpio_card_ro ? ? ? ? ? = -1,
+ ? ? ? .detect_delay_ms ? ? ? ?= 200,
+};
+
+static void __init colibri_mmc_init(void)
+{
+ ? ? ? if (machine_is_colibri()) ? ? ? /* PXA270 Colibri */
+ ? ? ? ? ? ? ? colibri_mci_platform_data.gpio_card_detect =
+ ? ? ? ? ? ? ? ? ? ? ? GPIO0_COLIBRI_PXA270_SD_DETECT;
+ ? ? ? if (machine_is_colibri300()) ? ?/* PXA300 Colibri */
+ ? ? ? ? ? ? ? colibri_mci_platform_data.gpio_card_detect =
+ ? ? ? ? ? ? ? ? ? ? ? GPIO39_COLIBRI_PXA300_SD_DETECT;
+ ? ? ? else ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* PXA320 Colibri */
+ ? ? ? ? ? ? ? colibri_mci_platform_data.gpio_card_detect =
+ ? ? ? ? ? ? ? ? ? ? ? GPIO28_COLIBRI_PXA320_SD_DETECT;
+
+ ? ? ? pxa_set_mci_info(&colibri_mci_platform_data);
+}
+#else
+static inline void colibri_mmc_init(void) {}
+#endif
+
+/******************************************************************************
+ * USB Host
+ ******************************************************************************/
+#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
+static int colibri_ohci_init(struct device *dev)
+{
+ ? ? ? UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
+ ? ? ? return 0;
+}
+
+static struct pxaohci_platform_data colibri_ohci_info = {
+ ? ? ? .port_mode ? ? ?= PMM_PERPORT_MODE,
+ ? ? ? .flags ? ? ? ? ?= ENABLE_PORT1 |
+ ? ? ? ? ? ? ? ? ? ? ? ? POWER_CONTROL_LOW | POWER_SENSE_LOW,
+ ? ? ? .init ? ? ? ? ? = colibri_ohci_init,
+};
+
+static void __init colibri_uhc_init(void)
+{
+ ? ? ? /* Colibri PXA270 has two usb ports, TBA for 320 */
+ ? ? ? if (machine_is_colibri())
+ ? ? ? ? ? ? ? colibri_ohci_info.flags |= ENABLE_PORT2;
+
+ ? ? ? pxa_set_ohci_info(&colibri_ohci_info);
+}
+#else
+static inline void colibri_uhc_init(void) {}
+#endif
+
+/******************************************************************************
+ * I2C RTC
+ ******************************************************************************/
+#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
+static struct i2c_board_info __initdata colibri_i2c_devs[] = {
+ ? ? ? {
+ ? ? ? ? ? ? ? I2C_BOARD_INFO("m41t00", 0x68),
+ ? ? ? },
+};
+
+static void __init colibri_rtc_init(void)
+{
+ ? ? ? pxa_set_i2c_info(NULL);
+ ? ? ? i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
+}
+#else
+static inline void colibri_rtc_init(void) {}
+#endif
+
+void __init colibri_evalboard_init(void)
+{
+ ? ? ? pxa_set_ffuart_info(NULL);
+ ? ? ? pxa_set_btuart_info(NULL);
+ ? ? ? pxa_set_stuart_info(NULL);
+
+ ? ? ? colibri_mmc_init();
+ ? ? ? colibri_uhc_init();
+ ? ? ? colibri_rtc_init();
+}
arch/arm/mach-pxa/colibri-pxa270-evalboard.c deleted +0 -121
deleted file mode 100644
index 7f27aec..0000000
@@ -1,121 +0,0 @@
-/*
- * ?linux/arch/arm/mach-pxa/colibri-pxa270-evalboard.c
- *
- * ?Support for Toradex PXA270 based Colibri Evaluation Carrier Board
- * ?Daniel Mack <[email protected]>
- * ?Marek Vasut <[email protected]>
- *
- * ?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 <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/sysdev.h>
-#include <linux/interrupt.h>
-#include <linux/gpio.h>
-#include <asm/mach-types.h>
-#include <mach/hardware.h>
-#include <asm/mach/arch.h>
-#include <linux/i2c.h>
-
-#include <mach/pxa27x.h>
-#include <mach/colibri.h>
-#include <mach/mmc.h>
-#include <mach/ohci.h>
-#include <mach/pxa27x-udc.h>
-
-#include <plat/i2c.h>
-
-#include "generic.h"
-#include "devices.h"
-
-/******************************************************************************
- * SD/MMC card controller
- ******************************************************************************/
-#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
-static struct pxamci_platform_data colibri_pxa270_mci_platform_data = {
- ? ? ? .ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
- ? ? ? .gpio_power ? ? ? ? ? ? = -1,
- ? ? ? .gpio_card_ro ? ? ? ? ? = -1,
- ? ? ? .detect_delay_ms ? ? ? ?= 200,
-};
-
-static void __init colibri_pxa270_mmc_init(void)
-{
- ? ? ? if (machine_is_colibri()) ? ? ? /* PXA270 Colibri */
- ? ? ? ? ? ? ? colibri_pxa270_mci_platform_data.gpio_card_detect =
- ? ? ? ? ? ? ? ? ? ? ? GPIO0_COLIBRI_PXA270_SD_DETECT;
- ? ? ? if (machine_is_colibri300()) ? ?/* PXA300 Colibri */
- ? ? ? ? ? ? ? colibri_pxa270_mci_platform_data.gpio_card_detect =
- ? ? ? ? ? ? ? ? ? ? ? GPIO39_COLIBRI_PXA300_SD_DETECT;
- ? ? ? else ? ? ? ? ? ? ? ? ? ? ? ? ? ?/* PXA320 Colibri */
- ? ? ? ? ? ? ? colibri_pxa270_mci_platform_data.gpio_card_detect =
- ? ? ? ? ? ? ? ? ? ? ? GPIO28_COLIBRI_PXA320_SD_DETECT;
-
- ? ? ? pxa_set_mci_info(&colibri_pxa270_mci_platform_data);
-}
-#else
-static inline void colibri_pxa270_mmc_init(void) {}
-#endif
-
-/******************************************************************************
- * USB Host
- ******************************************************************************/
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-static int colibri_pxa270_ohci_init(struct device *dev)
-{
- ? ? ? UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
- ? ? ? return 0;
-}
-
-static struct pxaohci_platform_data colibri_pxa270_ohci_info = {
- ? ? ? .port_mode ? ? ?= PMM_PERPORT_MODE,
- ? ? ? .flags ? ? ? ? ?= ENABLE_PORT1 |
- ? ? ? ? ? ? ? ? ? ? ? ? POWER_CONTROL_LOW | POWER_SENSE_LOW,
- ? ? ? .init ? ? ? ? ? = colibri_pxa270_ohci_init,
-};
-
-static void __init colibri_pxa270_uhc_init(void)
-{
- ? ? ? /* Colibri PXA270 has two usb ports, TBA for 320 */
- ? ? ? if (machine_is_colibri())
- ? ? ? ? ? ? ? colibri_pxa270_ohci_info.flags ?|= ENABLE_PORT2;
-
- ? ? ? pxa_set_ohci_info(&colibri_pxa270_ohci_info);
-}
-#else
-static inline void colibri_pxa270_uhc_init(void) {}
-#endif
-
-/******************************************************************************
- * I2C RTC
- ******************************************************************************/
-#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE)
-static struct i2c_board_info __initdata colibri_pxa270_i2c_devs[] = {
- ? ? ? {
- ? ? ? ? ? ? ? I2C_BOARD_INFO("m41t00", 0x68),
- ? ? ? },
-};
-
-static void __init colibri_pxa270_rtc_init(void)
-{
- ? ? ? pxa_set_i2c_info(NULL);
- ? ? ? i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_pxa270_i2c_devs));
-}
-#else
-static inline void colibri_pxa270_rtc_init(void) {}
-#endif
-
-void __init colibri_pxa270_evalboard_init(void)
-{
- ? ? ? pxa_set_ffuart_info(NULL);
- ? ? ? pxa_set_btuart_info(NULL);
- ? ? ? pxa_set_stuart_info(NULL);
-
- ? ? ? colibri_pxa270_mmc_init();
- ? ? ? colibri_pxa270_uhc_init();
- ? ? ? colibri_pxa270_rtc_init();
-}
arch/arm/mach-pxa/colibri-pxa270.c +0 -0
index 1024da5..dc05af4 100644
@@ -35,7 +35,7 @@

?/****************************************************************************** ?* Evaluation board MFP ?******************************************************************************/

arch/arm/mach-pxa/colibri-pxa270.c +1 -1
-#ifdef ?CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+#ifdef ?CONFIG_MACH_COLIBRI_EVALBOARD

?static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = { ? ? ? ?/* MMC */
? ? ? ?GPIO32_MMC_CLK,

arch/arm/mach-pxa/colibri-pxa270.c +1 -1
@@ -281,10 +281,10 @@ static void __init colibri_pxa270_init(void)
 ? ? ? ?colibri_pxa270_tsc_init();
 
 ? ? ? ?switch (colibri_pxa270_baseboard) {
- ? ? ? case COLIBRI_PXA270_EVALBOARD:
+ ? ? ? case COLIBRI_EVALBOARD:

? ? ? ? ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(
? ? ? ? ? ? ? ? ? ? ? ?colibri_pxa270_evalboard_pin_config));
- ? ? ? ? ? ? ? colibri_pxa270_evalboard_init();
+ ? ? ? ? ? ? ? colibri_evalboard_init();
? ? ? ? ? ? ? ?break;
? ? ? ?case COLIBRI_PXA270_INCOME:
? ? ? ? ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));

arch/arm/mach-pxa/colibri-pxa300.c +0 -0
index 5bf8055..77e760f 100644
@@ -32,7 +32,7 @@

?#include "devices.h"

arch/arm/mach-pxa/colibri-pxa300.c +1 -1
-#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+#ifdef CONFIG_MACH_COLIBRI_EVALBOARD

?static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = { ? ? ? ?/* MMC */
? ? ? ?GPIO7_MMC1_CLK,

arch/arm/mach-pxa/colibri-pxa300.c +0 -0
@@ -173,7 +173,7 @@ void __init colibri_pxa300_init(void)
 

? ? ? ?/* Evalboard init */
? ? ? ?pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
- ? ? ? colibri_pxa270_evalboard_init();
+ ? ? ? colibri_evalboard_init();
?}

?MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")

arch/arm/mach-pxa/colibri-pxa320.c +0 -0
index 4257382..7c003cd 100644
@@ -35,7 +35,7 @@

?#include "generic.h"
?#include "devices.h"

arch/arm/mach-pxa/colibri-pxa320.c +1 -1
-#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+#ifdef CONFIG_MACH_COLIBRI_EVALBOARD

?static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = { ? ? ? ?/* MMC */
? ? ? ?GPIO22_MMC1_CLK,

arch/arm/mach-pxa/colibri-pxa320.c +0 -0
@@ -229,7 +229,7 @@ void __init colibri_pxa320_init(void)
 

? ? ? ?/* Evalboard init */
? ? ? ?pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_evalboard_pin_config));
- ? ? ? colibri_pxa270_evalboard_init();
+ ? ? ? colibri_evalboard_init();
?}

?MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")

arch/arm/mach-pxa/include/mach/colibri.h +0 -0
index 63a948a..388a96f 100644
@@ -9,14 +9,14 @@

?*/

?enum {
- ? ? ? COLIBRI_PXA270_EVALBOARD = 0,
+ ? ? ? COLIBRI_EVALBOARD = 0,
? ? ? ?COLIBRI_PXA270_INCOME,
?};

arch/arm/mach-pxa/include/mach/colibri.h +2 -2
-#if defined(CONFIG_MACH_COLIBRI_PXA270_EVALBOARD)
-extern void colibri_pxa270_evalboard_init(void);
+#if defined(CONFIG_MACH_COLIBRI_EVALBOARD)
+extern void colibri_evalboard_init(void);

?#else

arch/arm/mach-pxa/include/mach/colibri.h +1 -1
-static inline void colibri_pxa270_evalboard_init(void) {}
+static inline void colibri_evalboard_init(void) {}

?#endif

?#if defined(CONFIG_MACH_COLIBRI_PXA270_INCOME)
--
1.7.1

#12 lore raw

PATCH 5/11 ARM: pxa: Rename Colibri evalboard

Dne Po 20. z??? 2010 16:41:48 Eric Miao napsal(a):

Quoted 6 lines · Marek Vasut
Quoted 2 lines

Rename colibri-pxa270-evalboard to colibri-evalboard as this board is used with all Colibri modules.

As mentioned, would be more straight-forward if this rename happens first?

You might be right, but I think it's ok either way.

Quoted 405 lines
Quoted 405 lines
---
 arch/arm/mach-pxa/Kconfig                    |    2 +-
 arch/arm/mach-pxa/Makefile                   |    2 +-
 arch/arm/mach-pxa/colibri-evalboard.c        |  121
++++++++++++++++++++++++++ arch/arm/mach-pxa/colibri-pxa270-evalboard.c
|  121 -------------------------- arch/arm/mach-pxa/colibri-pxa270.c    
      |    6 +-
 arch/arm/mach-pxa/colibri-pxa300.c           |    4 +-
 arch/arm/mach-pxa/colibri-pxa320.c           |    4 +-
 arch/arm/mach-pxa/include/mach/colibri.h     |    8 +-
 8 files changed, 134 insertions(+), 134 deletions(-)
 create mode 100644 arch/arm/mach-pxa/colibri-evalboard.c
 delete mode 100644 arch/arm/mach-pxa/colibri-pxa270-evalboard.c
arch/arm/mach-pxa/Kconfig +1 -1
index b44d613..e0ac5aa 100644
@@ -249,7 +249,7 @@ config MACH_COLIBRI320
       select PXA3xx
       select CPU_PXA320
 
-config MACH_COLIBRI_PXA270_EVALBOARD
+config MACH_COLIBRI_EVALBOARD
       bool "Toradex Colibri Evaluation Carrier Board support"
       depends on MACH_COLIBRI || MACH_COLIBRI300 || MACH_COLIBRI320
 
arch/arm/mach-pxa/Makefile +0 -1
index e2f89c2..3197756 100644
@@ -60,7 +60,7 @@ obj-$(CONFIG_MACH_LOGICPD_PXA270)     += lpd270.o
 obj-$(CONFIG_MACH_PCM027)              += pcm027.o
 obj-$(CONFIG_MACH_PCM990_BASEBOARD)    += pcm990-baseboard.o
 obj-$(CONFIG_MACH_COLIBRI)                     += colibri-pxa270.o
-obj-$(CONFIG_MACH_COLIBRI_PXA270_EVALBOARD)    +=

colibri-pxa270-evalboard.o +obj-$(CONFIG_MACH_COLIBRI_EVALBOARD) +=
colibri-evalboard.o
obj-$(CONFIG_MACH_COLIBRI_PXA270_INCOME) +=
colibri-pxa270-income.o obj-$(CONFIG_MACH_COLIBRI300) += colibri-pxa3xx.o colibri-pxa300.o obj-$(CONFIG_MACH_COLIBRI320) += colibri-pxa3xx.o colibri-pxa320.o diff --git a/arch/arm/mach-pxa/colibri-evalboard.c b/arch/arm/mach-pxa/colibri-evalboard.c new file mode 100644 index 0000000..6b2c800

arch/arm/mach-pxa/colibri-evalboard.c new file +35 -0
@@ -0,0 +1,121 @@
+/*
+ *  linux/arch/arm/mach-pxa/colibri-evalboard.c
+ *
+ *  Support for Toradex Colibri Evaluation Carrier Board
+ *  Daniel Mack <[email protected]>
+ *  Marek Vasut <[email protected]>
+ *
+ *  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 <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/sysdev.h>
+#include <linux/interrupt.h>
+#include <linux/gpio.h>
+#include <asm/mach-types.h>
+#include <mach/hardware.h>
+#include <asm/mach/arch.h>
+#include <linux/i2c.h>
+
+#include <mach/pxa27x.h>
+#include <mach/colibri.h>
+#include <mach/mmc.h>
+#include <mach/ohci.h>
+#include <mach/pxa27x-udc.h>
+
+#include <plat/i2c.h>
+
+#include "generic.h"
+#include "devices.h"
+
+/***********************************************************************

******* + * SD/MMC card controller
+
************************************************************************
******/ +#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)

arch/arm/mach-pxa/colibri-evalboard.c new file +26 -0
+static struct pxamci_platform_data colibri_mci_platform_data = {
+       .ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
+       .gpio_power             = -1,
+       .gpio_card_ro           = -1,
+       .detect_delay_ms        = 200,
+};
+
+static void __init colibri_mmc_init(void)
+{
+       if (machine_is_colibri())       /* PXA270 Colibri */
+               colibri_mci_platform_data.gpio_card_detect =
+                       GPIO0_COLIBRI_PXA270_SD_DETECT;
+       if (machine_is_colibri300())    /* PXA300 Colibri */
+               colibri_mci_platform_data.gpio_card_detect =
+                       GPIO39_COLIBRI_PXA300_SD_DETECT;
+       else                            /* PXA320 Colibri */
+               colibri_mci_platform_data.gpio_card_detect =
+                       GPIO28_COLIBRI_PXA320_SD_DETECT;
+
+       pxa_set_mci_info(&colibri_mci_platform_data);
+}
+#else
+static inline void colibri_mmc_init(void) {}
+#endif
+
+/***********************************************************************

******* + * USB Host
+
************************************************************************
******/ +#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) +static int colibri_ohci_init(struct device *dev)

arch/arm/mach-pxa/colibri-evalboard.c new file +25 -0
+{
+       UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
+       return 0;
+}
+
+static struct pxaohci_platform_data colibri_ohci_info = {
+       .port_mode      = PMM_PERPORT_MODE,
+       .flags          = ENABLE_PORT1 |
+                         POWER_CONTROL_LOW | POWER_SENSE_LOW,
+       .init           = colibri_ohci_init,
+};
+
+static void __init colibri_uhc_init(void)
+{
+       /* Colibri PXA270 has two usb ports, TBA for 320 */
+       if (machine_is_colibri())
+               colibri_ohci_info.flags |= ENABLE_PORT2;
+
+       pxa_set_ohci_info(&colibri_ohci_info);
+}
+#else
+static inline void colibri_uhc_init(void) {}
+#endif
+
+/***********************************************************************

******* + * I2C RTC
+
************************************************************************
******/ +#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE) +static struct i2c_board_info __initdata colibri_i2c_devs[] = {

arch/arm/mach-pxa/colibri-evalboard.c new file +24 -0
+       {
+               I2C_BOARD_INFO("m41t00", 0x68),
+       },
+};
+
+static void __init colibri_rtc_init(void)
+{
+       pxa_set_i2c_info(NULL);
+       i2c_register_board_info(0, ARRAY_AND_SIZE(colibri_i2c_devs));
+}
+#else
+static inline void colibri_rtc_init(void) {}
+#endif
+
+void __init colibri_evalboard_init(void)
+{
+       pxa_set_ffuart_info(NULL);
+       pxa_set_btuart_info(NULL);
+       pxa_set_stuart_info(NULL);
+
+       colibri_mmc_init();
+       colibri_uhc_init();
+       colibri_rtc_init();
+}
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa270-evalboard.c deleted file mode 100644 index 7f27aec..0000000

arch/arm/mach-pxa/colibri-pxa270-evalboard.c deleted +0 -35
@@ -1,121 +0,0 @@
-/*
- *  linux/arch/arm/mach-pxa/colibri-pxa270-evalboard.c
- *
- *  Support for Toradex PXA270 based Colibri Evaluation Carrier Board
- *  Daniel Mack <[email protected]>
- *  Marek Vasut <[email protected]>
- *
- *  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 <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/sysdev.h>
-#include <linux/interrupt.h>
-#include <linux/gpio.h>
-#include <asm/mach-types.h>
-#include <mach/hardware.h>
-#include <asm/mach/arch.h>
-#include <linux/i2c.h>
-
-#include <mach/pxa27x.h>
-#include <mach/colibri.h>
-#include <mach/mmc.h>
-#include <mach/ohci.h>
-#include <mach/pxa27x-udc.h>
-
-#include <plat/i2c.h>
-
-#include "generic.h"
-#include "devices.h"
-
-/***********************************************************************

******* - * SD/MMC card controller
-
************************************************************************
******/ -#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)

arch/arm/mach-pxa/colibri-pxa270-evalboard.c deleted +0 -26
-static struct pxamci_platform_data colibri_pxa270_mci_platform_data = {
-       .ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
-       .gpio_power             = -1,
-       .gpio_card_ro           = -1,
-       .detect_delay_ms        = 200,
-};
-
-static void __init colibri_pxa270_mmc_init(void)
-{
-       if (machine_is_colibri())       /* PXA270 Colibri */
-               colibri_pxa270_mci_platform_data.gpio_card_detect =
-                       GPIO0_COLIBRI_PXA270_SD_DETECT;
-       if (machine_is_colibri300())    /* PXA300 Colibri */
-               colibri_pxa270_mci_platform_data.gpio_card_detect =
-                       GPIO39_COLIBRI_PXA300_SD_DETECT;
-       else                            /* PXA320 Colibri */
-               colibri_pxa270_mci_platform_data.gpio_card_detect =
-                       GPIO28_COLIBRI_PXA320_SD_DETECT;
-
-       pxa_set_mci_info(&colibri_pxa270_mci_platform_data);
-}
-#else
-static inline void colibri_pxa270_mmc_init(void) {}
-#endif
-
-/***********************************************************************

******* - * USB Host
-
************************************************************************
******/ -#if defined(CONFIG_USB_OHCI_HCD) ||
defined(CONFIG_USB_OHCI_HCD_MODULE) -static int
colibri_pxa270_ohci_init(struct device *dev)

arch/arm/mach-pxa/colibri-pxa270-evalboard.c deleted +0 -25
-{
-       UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
-       return 0;
-}
-
-static struct pxaohci_platform_data colibri_pxa270_ohci_info = {
-       .port_mode      = PMM_PERPORT_MODE,
-       .flags          = ENABLE_PORT1 |
-                         POWER_CONTROL_LOW | POWER_SENSE_LOW,
-       .init           = colibri_pxa270_ohci_init,
-};
-
-static void __init colibri_pxa270_uhc_init(void)
-{
-       /* Colibri PXA270 has two usb ports, TBA for 320 */
-       if (machine_is_colibri())
-               colibri_pxa270_ohci_info.flags  |= ENABLE_PORT2;
-
-       pxa_set_ohci_info(&colibri_pxa270_ohci_info);
-}
-#else
-static inline void colibri_pxa270_uhc_init(void) {}
-#endif
-
-/***********************************************************************

******* - * I2C RTC
-
************************************************************************
******/ -#if defined(CONFIG_RTC_DRV_DS1307) || defined(CONFIG_RTC_DRV_DS1307_MODULE) -static struct i2c_board_info
__initdata colibri_pxa270_i2c_devs[] = { - {

arch/arm/mach-pxa/colibri-pxa270-evalboard.c deleted +0 -8
-               I2C_BOARD_INFO("m41t00", 0x68),
-       },
-};
-
-static void __init colibri_pxa270_rtc_init(void)
-{
-       pxa_set_i2c_info(NULL);
-       i2c_register_board_info(0,

ARRAY_AND_SIZE(colibri_pxa270_i2c_devs)); -}

arch/arm/mach-pxa/colibri-pxa270-evalboard.c deleted +0 -14
-#else
-static inline void colibri_pxa270_rtc_init(void) {}
-#endif
-
-void __init colibri_pxa270_evalboard_init(void)
-{
-       pxa_set_ffuart_info(NULL);
-       pxa_set_btuart_info(NULL);
-       pxa_set_stuart_info(NULL);
-
-       colibri_pxa270_mmc_init();
-       colibri_pxa270_uhc_init();
-       colibri_pxa270_rtc_init();
-}
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa270.c index 1024da5..dc05af4 100644

arch/arm/mach-pxa/colibri-pxa270.c +3 -2
@@ -35,7 +35,7 @@
 /***********************************************************************
 ******* * Evaluation board MFP
 ************************************************************************
 ******/ -#ifdef  CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+#ifdef  CONFIG_MACH_COLIBRI_EVALBOARD
 static mfp_cfg_t colibri_pxa270_evalboard_pin_config[] __initdata = {
       /* MMC */
       GPIO32_MMC_CLK,
@@ -281,10 +281,10 @@ static void __init colibri_pxa270_init(void)
       colibri_pxa270_tsc_init();
 
       switch (colibri_pxa270_baseboard) {
-       case COLIBRI_PXA270_EVALBOARD:
+       case COLIBRI_EVALBOARD:
               pxa2xx_mfp_config(ARRAY_AND_SIZE(
                       colibri_pxa270_evalboard_pin_config));
-               colibri_pxa270_evalboard_init();
+               colibri_evalboard_init();
               break;
       case COLIBRI_PXA270_INCOME:
               pxa2xx_mfp_config(ARRAY_AND_SIZE(income_pin_config));
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa300.c index 5bf8055..77e760f 100644

arch/arm/mach-pxa/colibri-pxa300.c +2 -2
@@ -32,7 +32,7 @@
 #include "devices.h"
 
 
-#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+#ifdef CONFIG_MACH_COLIBRI_EVALBOARD
 static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
       /* MMC */
       GPIO7_MMC1_CLK,
@@ -173,7 +173,7 @@ void __init colibri_pxa300_init(void)
 
       /* Evalboard init */
 
 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
-       colibri_pxa270_evalboard_init();
+       colibri_evalboard_init();
 }
 

MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")

(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa320.c index 4257382..7c003cd 100644

arch/arm/mach-pxa/colibri-pxa320.c +2 -2
@@ -35,7 +35,7 @@
 #include "generic.h"
 #include "devices.h"
 
-#ifdef CONFIG_MACH_COLIBRI_PXA270_EVALBOARD
+#ifdef CONFIG_MACH_COLIBRI_EVALBOARD
 static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {
       /* MMC */
       GPIO22_MMC1_CLK,
@@ -229,7 +229,7 @@ void __init colibri_pxa320_init(void)
 
       /* Evalboard init */
 
 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_evalboard_pin_config));
-       colibri_pxa270_evalboard_init();
+       colibri_evalboard_init();
 }
 

MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")

(quoted diff) +0 -0

b/arch/arm/mach-pxa/include/mach/colibri.h index 63a948a..388a96f 100644

arch/arm/mach-pxa/include/mach/colibri.h +4 -5
@@ -9,14 +9,14 @@
 */
 
 enum {
-       COLIBRI_PXA270_EVALBOARD = 0,
+       COLIBRI_EVALBOARD = 0,
       COLIBRI_PXA270_INCOME,
 };
 
-#if defined(CONFIG_MACH_COLIBRI_PXA270_EVALBOARD)
-extern void colibri_pxa270_evalboard_init(void);
+#if defined(CONFIG_MACH_COLIBRI_EVALBOARD)
+extern void colibri_evalboard_init(void);
 #else
-static inline void colibri_pxa270_evalboard_init(void) {}
+static inline void colibri_evalboard_init(void) {}
 #endif
 
 #if defined(CONFIG_MACH_COLIBRI_PXA270_INCOME)
--

1.7.1

#13 lore raw

PATCH 6/11 ARM: pxa: Colibri PXA320 PCMCIA driver

In reply to Marek Vasut
---
 arch/arm/mach-pxa/colibri-pxa320.c |   21 +++++++++++++++++++++
 drivers/pcmcia/Kconfig             |    3 ++-
 drivers/pcmcia/Makefile            |    1 +
 drivers/pcmcia/pxa2xx_colibri.c    |   17 ++++++++++++++++-
 4 files changed, 40 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/colibri-pxa320.c +21 -0
index 7c003cd..6cd83fa 100644
@@ -73,6 +73,27 @@ static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {
 	/* I2C */
 	GPIO32_I2C_SCL,
 	GPIO33_I2C_SDA,
+
+	/* PCMCIA */
+	MFP_CFG(GPIO59, AF7),	/* PRST ; AF7 to tristate */
+	MFP_CFG(GPIO61, AF7),	/* PCE1 ; AF7 to tristate */
+	MFP_CFG(GPIO60, AF7),	/* PCE2 ; AF7 to tristate */
+	MFP_CFG(GPIO62, AF7),	/* PCD ; AF7 to tristate */
+	MFP_CFG(GPIO56, AF7),	/* PSKTSEL ; AF7 to tristate */
+	GPIO27_GPIO,		/* RDnWR ; input/tristate */
+	GPIO50_GPIO,		/* PREG ; input/tristate */
+	GPIO2_RDY,
+	GPIO5_NPIOR,
+	GPIO6_NPIOW,
+	GPIO7_NPIOS16,
+	GPIO8_NPWAIT,
+	GPIO29_GPIO,		/* PRDY (READY GPIO) */
+	GPIO57_GPIO,		/* PPEN (POWER GPIO) */
+	GPIO81_GPIO,		/* PCD (DETECT GPIO) */
+	GPIO77_GPIO,		/* PRST (RESET GPIO) */
+	GPIO53_GPIO,		/* PBVD1 */
+	GPIO79_GPIO,		/* PBVD2 */
+	GPIO54_GPIO,		/* POE */
 };
 #else
 static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {};
drivers/pcmcia/Kconfig +2 -1
index e9acf03..de886f3 100644
@@ -215,7 +215,8 @@ config PCMCIA_PXA2XX
 	depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
 		    || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
 		    || ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2 \
-		    || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI)
+		    || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI \
+		    || MACH_COLIBRI320)
 	select PCMCIA_SOC_COMMON
 	help
 	  Say Y here to include support for the PXA2xx PCMCIA controller
drivers/pcmcia/Makefile +1 -0
index 2fee7ef..9a44a90 100644
@@ -71,6 +71,7 @@ pxa2xx-obj-$(CONFIG_MACH_STARGATE2)		+= pxa2xx_stargate2.o
 pxa2xx-obj-$(CONFIG_MACH_VPAC270)		+= pxa2xx_vpac270.o
 pxa2xx-obj-$(CONFIG_MACH_BALLOON3)		+= pxa2xx_balloon3.o
 pxa2xx-obj-$(CONFIG_MACH_COLIBRI)		+= pxa2xx_colibri.o
+pxa2xx-obj-$(CONFIG_MACH_COLIBRI320)		+= pxa2xx_colibri.o
 
 obj-$(CONFIG_PCMCIA_PXA2XX)			+= pxa2xx_base.o $(pxa2xx-obj-y)
 
drivers/pcmcia/pxa2xx_colibri.c +16 -1
index 4ed876c..c3f7219 100644
@@ -27,6 +27,13 @@
 #define	COLIBRI270_DETECT_GPIO	84
 #define	COLIBRI270_READY_GPIO	1
 
+#define	COLIBRI320_RESET_GPIO	77
+#define	COLIBRI320_PPEN_GPIO	57
+#define	COLIBRI320_BVD1_GPIO	53
+#define	COLIBRI320_BVD2_GPIO	79
+#define	COLIBRI320_DETECT_GPIO	81
+#define	COLIBRI320_READY_GPIO	29
+
 static struct {
 	int	reset_gpio;
 	int	ppen_gpio;
@@ -186,6 +193,14 @@ static int __init colibri_pcmcia_init(void)
 		colibri_pcmcia_gpio.bvd2_gpio	= COLIBRI270_BVD2_GPIO;
 		colibri_pcmcia_gpio.detect_gpio	= COLIBRI270_DETECT_GPIO;
 		colibri_pcmcia_gpio.ready_gpio	= COLIBRI270_READY_GPIO;
+	/* Colibri PXA320 */
+	} else if (machine_is_colibri320()) {
+		colibri_pcmcia_gpio.reset_gpio	= COLIBRI320_RESET_GPIO;
+		colibri_pcmcia_gpio.ppen_gpio	= COLIBRI320_PPEN_GPIO;
+		colibri_pcmcia_gpio.bvd1_gpio	= COLIBRI320_BVD1_GPIO;
+		colibri_pcmcia_gpio.bvd2_gpio	= COLIBRI320_BVD2_GPIO;
+		colibri_pcmcia_gpio.detect_gpio	= COLIBRI320_DETECT_GPIO;
+		colibri_pcmcia_gpio.ready_gpio	= COLIBRI320_READY_GPIO;
 	}
 
 	ret = platform_device_add_data(colibri_pcmcia_device,
@@ -209,6 +224,6 @@ module_init(colibri_pcmcia_init);
 module_exit(colibri_pcmcia_exit);
 
 MODULE_AUTHOR("Marek Vasut <[email protected]>");
-MODULE_DESCRIPTION("PCMCIA support for Toradex Colibri PXA270");
+MODULE_DESCRIPTION("PCMCIA support for Toradex Colibri PXA270/PXA320");
 MODULE_ALIAS("platform:pxa2xx-pcmcia");
 MODULE_LICENSE("GPL");
Signature · 1 line
1.7.1
#14 lore raw

PATCH 6/11 ARM: pxa: Colibri PXA320 PCMCIA driver

Quoted 16 lines · Marek Vasut

---

?arch/arm/mach-pxa/colibri-pxa320.c | ? 21 +++++++++++++++++++++
?drivers/pcmcia/Kconfig ? ? ? ? ? ? | ? ?3 ++-
?drivers/pcmcia/Makefile ? ? ? ? ? ?| ? ?1 +
?drivers/pcmcia/pxa2xx_colibri.c ? ?| ? 17 ++++++++++++++++-

?4 files changed, 40 insertions(+), 2 deletions(-)

arch/arm/mach-pxa/colibri-pxa320.c +0 -0
index 7c003cd..6cd83fa 100644
@@ -73,6 +73,27 @@ static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {

? ? ? ?/* I2C */
? ? ? ?GPIO32_I2C_SCL,

Quoted 8 lines

? ? ? ?GPIO33_I2C_SDA,
+
+ ? ? ? /* PCMCIA */
+ ? ? ? MFP_CFG(GPIO59, AF7), ? /* PRST ; AF7 to tristate */
+ ? ? ? MFP_CFG(GPIO61, AF7), ? /* PCE1 ; AF7 to tristate */
+ ? ? ? MFP_CFG(GPIO60, AF7), ? /* PCE2 ; AF7 to tristate */
+ ? ? ? MFP_CFG(GPIO62, AF7), ? /* PCD ; AF7 to tristate */
+ ? ? ? MFP_CFG(GPIO56, AF7), ? /* PSKTSEL ; AF7 to tristate */

If this is useful for other platforms, making them macros would be helpful.

And using MFP_CFG() directly is not encouraged, any specific reason to use this?

Quoted 88 lines

+ ? ? ? GPIO27_GPIO, ? ? ? ? ? ?/* RDnWR ; input/tristate */
+ ? ? ? GPIO50_GPIO, ? ? ? ? ? ?/* PREG ; input/tristate */
+ ? ? ? GPIO2_RDY,
+ ? ? ? GPIO5_NPIOR,
+ ? ? ? GPIO6_NPIOW,
+ ? ? ? GPIO7_NPIOS16,
+ ? ? ? GPIO8_NPWAIT,
+ ? ? ? GPIO29_GPIO, ? ? ? ? ? ?/* PRDY (READY GPIO) */
+ ? ? ? GPIO57_GPIO, ? ? ? ? ? ?/* PPEN (POWER GPIO) */
+ ? ? ? GPIO81_GPIO, ? ? ? ? ? ?/* PCD (DETECT GPIO) */
+ ? ? ? GPIO77_GPIO, ? ? ? ? ? ?/* PRST (RESET GPIO) */
+ ? ? ? GPIO53_GPIO, ? ? ? ? ? ?/* PBVD1 */
+ ? ? ? GPIO79_GPIO, ? ? ? ? ? ?/* PBVD2 */
+ ? ? ? GPIO54_GPIO, ? ? ? ? ? ?/* POE */
?};
?#else
?static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {};

drivers/pcmcia/Kconfig +2 -1
index e9acf03..de886f3 100644
@@ -215,7 +215,8 @@ config PCMCIA_PXA2XX
 ? ? ? ?depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
 ? ? ? ? ? ? ? ? ? ?|| MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
 ? ? ? ? ? ? ? ? ? ?|| ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2 \
- ? ? ? ? ? ? ? ? ? || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI)
+ ? ? ? ? ? ? ? ? ? || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI \
+ ? ? ? ? ? ? ? ? ? || MACH_COLIBRI320)

? ? ? ?select PCMCIA_SOC_COMMON
? ? ? ?help
? ? ? ? ?Say Y here to include support for the PXA2xx PCMCIA controller

drivers/pcmcia/Makefile +0 -0
index 2fee7ef..9a44a90 100644
@@ -71,6 +71,7 @@ pxa2xx-obj-$(CONFIG_MACH_STARGATE2) ? ? ? ? ? += pxa2xx_stargate2.o

?pxa2xx-obj-$(CONFIG_MACH_VPAC270) ? ? ? ? ? ? ?+= pxa2xx_vpac270.o ?pxa2xx-obj-$(CONFIG_MACH_BALLOON3) ? ? ? ? ? ? += pxa2xx_balloon3.o ?pxa2xx-obj-$(CONFIG_MACH_COLIBRI) ? ? ? ? ? ? ?+= pxa2xx_colibri.o +pxa2xx-obj-$(CONFIG_MACH_COLIBRI320) ? ? ? ? ? += pxa2xx_colibri.o

?obj-$(CONFIG_PCMCIA_PXA2XX) ? ? ? ? ? ? ? ? ? ?+= pxa2xx_base.o $(pxa2xx-obj-y)

drivers/pcmcia/pxa2xx_colibri.c +0 -0
index 4ed876c..c3f7219 100644
@@ -27,6 +27,13 @@

?#define ? ? ? ?COLIBRI270_DETECT_GPIO ?84
?#define ? ? ? ?COLIBRI270_READY_GPIO ? 1

drivers/pcmcia/pxa2xx_colibri.c +7 -0
+#define ? ? ? ?COLIBRI320_RESET_GPIO ? 77
+#define ? ? ? ?COLIBRI320_PPEN_GPIO ? ?57
+#define ? ? ? ?COLIBRI320_BVD1_GPIO ? ?53
+#define ? ? ? ?COLIBRI320_BVD2_GPIO ? ?79
+#define ? ? ? ?COLIBRI320_DETECT_GPIO ?81
+#define ? ? ? ?COLIBRI320_READY_GPIO ? 29
+

?static struct {
? ? ? ?int ? ? reset_gpio;
? ? ? ?int ? ? ppen_gpio;

drivers/pcmcia/pxa2xx_colibri.c +9 -2
@@ -186,6 +193,14 @@ static int __init colibri_pcmcia_init(void)
 ? ? ? ? ? ? ? ?colibri_pcmcia_gpio.bvd2_gpio ? = COLIBRI270_BVD2_GPIO;
 ? ? ? ? ? ? ? ?colibri_pcmcia_gpio.detect_gpio = COLIBRI270_DETECT_GPIO;
 ? ? ? ? ? ? ? ?colibri_pcmcia_gpio.ready_gpio ?= COLIBRI270_READY_GPIO;
+ ? ? ? /* Colibri PXA320 */
+ ? ? ? } else if (machine_is_colibri320()) {
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.reset_gpio ?= COLIBRI320_RESET_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.ppen_gpio ? = COLIBRI320_PPEN_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.bvd1_gpio ? = COLIBRI320_BVD1_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.bvd2_gpio ? = COLIBRI320_BVD2_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.detect_gpio = COLIBRI320_DETECT_GPIO;
+ ? ? ? ? ? ? ? colibri_pcmcia_gpio.ready_gpio ?= COLIBRI320_READY_GPIO;
 ? ? ? ?}
 
 ? ? ? ?ret = platform_device_add_data(colibri_pcmcia_device,
@@ -209,6 +224,6 @@ module_init(colibri_pcmcia_init);
 ?module_exit(colibri_pcmcia_exit);
 
 ?MODULE_AUTHOR("Marek Vasut <[email protected]>");
-MODULE_DESCRIPTION("PCMCIA support for Toradex Colibri PXA270");
+MODULE_DESCRIPTION("PCMCIA support for Toradex Colibri PXA270/PXA320");
 ?MODULE_ALIAS("platform:pxa2xx-pcmcia");
 ?MODULE_LICENSE("GPL");
--

1.7.1

#15 lore raw

PATCH 6/11 ARM: pxa: Colibri PXA320 PCMCIA driver

Dne Po 20. z??? 2010 16:43:33 Eric Miao napsal(a):

Quoted 28 lines · Marek Vasut
Quoted 17 lines
---
 arch/arm/mach-pxa/colibri-pxa320.c |   21 +++++++++++++++++++++
 drivers/pcmcia/Kconfig             |    3 ++-
 drivers/pcmcia/Makefile            |    1 +
 drivers/pcmcia/pxa2xx_colibri.c    |   17 ++++++++++++++++-
 4 files changed, 40 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-pxa/colibri-pxa320.c index 7c003cd..6cd83fa 100644

arch/arm/mach-pxa/colibri-pxa320.c +0 -0
@@ -73,6 +73,27 @@ static mfp_cfg_t colibri_pxa320_evalboard_pin_config[]

__initdata = { /* I2C */

       GPIO32_I2C_SCL,
       GPIO33_I2C_SDA,

arch/arm/mach-pxa/colibri-pxa320.c static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = { · line 82

Quoted 7 lines
arch/arm/mach-pxa/colibri-pxa320.c +7 -0
+
+       /* PCMCIA */
+       MFP_CFG(GPIO59, AF7),   /* PRST ; AF7 to tristate */
+       MFP_CFG(GPIO61, AF7),   /* PCE1 ; AF7 to tristate */
+       MFP_CFG(GPIO60, AF7),   /* PCE2 ; AF7 to tristate */
+       MFP_CFG(GPIO62, AF7),   /* PCD ; AF7 to tristate */
+       MFP_CFG(GPIO56, AF7),   /* PSKTSEL ; AF7 to tristate */

If this is useful for other platforms, making them macros would be helpful.

Quoted 2 lines

And using MFP_CFG() directly is not encouraged, any specific reason to use this?

Because the board is fuxed. This is really a board specific thing, that's why it's done in this obscure way. It's done according to my discussion with Tdex.

Cheers

Quoted 89 lines
Quoted 89 lines
arch/arm/mach-pxa/colibri-pxa320.c +14 -0
+       GPIO27_GPIO,            /* RDnWR ; input/tristate */
+       GPIO50_GPIO,            /* PREG ; input/tristate */
+       GPIO2_RDY,
+       GPIO5_NPIOR,
+       GPIO6_NPIOW,
+       GPIO7_NPIOS16,
+       GPIO8_NPWAIT,
+       GPIO29_GPIO,            /* PRDY (READY GPIO) */
+       GPIO57_GPIO,            /* PPEN (POWER GPIO) */
+       GPIO81_GPIO,            /* PCD (DETECT GPIO) */
+       GPIO77_GPIO,            /* PRST (RESET GPIO) */
+       GPIO53_GPIO,            /* PBVD1 */
+       GPIO79_GPIO,            /* PBVD2 */
+       GPIO54_GPIO,            /* POE */
 };
 #else
 static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {};
drivers/pcmcia/Kconfig +1 -0
index e9acf03..de886f3 100644
@@ -215,7 +215,8 @@ config PCMCIA_PXA2XX
       depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
                   || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
                   || ARCOM_PCMCIA || ARCH_PXA_ESERIES || MACH_STARGATE2
 \ -                   || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI)
+                   || MACH_VPAC270 || MACH_BALLOON3 || MACH_COLIBRI \ +
                  || MACH_COLIBRI320)
       select PCMCIA_SOC_COMMON
       help

Say Y here to include support for the PXA2xx PCMCIA controller

drivers/pcmcia/Makefile +0 -0
index 2fee7ef..9a44a90 100644
@@ -71,6 +71,7 @@ pxa2xx-obj-$(CONFIG_MACH_STARGATE2)           +=

pxa2xx_stargate2.o pxa2xx-obj-$(CONFIG_MACH_VPAC270) +=
pxa2xx_vpac270.o pxa2xx-obj-$(CONFIG_MACH_BALLOON3) +=
pxa2xx_balloon3.o pxa2xx-obj-$(CONFIG_MACH_COLIBRI) +=
pxa2xx_colibri.o +pxa2xx-obj-$(CONFIG_MACH_COLIBRI320) +=
pxa2xx_colibri.o

obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_base.o
$(pxa2xx-obj-y)

(quoted diff) +0 -0

b/drivers/pcmcia/pxa2xx_colibri.c index 4ed876c..c3f7219 100644

drivers/pcmcia/pxa2xx_colibri.c +16 -2
@@ -27,6 +27,13 @@
 #define        COLIBRI270_DETECT_GPIO  84
 #define        COLIBRI270_READY_GPIO   1
 
+#define        COLIBRI320_RESET_GPIO   77
+#define        COLIBRI320_PPEN_GPIO    57
+#define        COLIBRI320_BVD1_GPIO    53
+#define        COLIBRI320_BVD2_GPIO    79
+#define        COLIBRI320_DETECT_GPIO  81
+#define        COLIBRI320_READY_GPIO   29
+
 static struct {
       int     reset_gpio;
       int     ppen_gpio;
@@ -186,6 +193,14 @@ static int __init colibri_pcmcia_init(void)
               colibri_pcmcia_gpio.bvd2_gpio   = COLIBRI270_BVD2_GPIO;
               colibri_pcmcia_gpio.detect_gpio = COLIBRI270_DETECT_GPIO;
               colibri_pcmcia_gpio.ready_gpio  = COLIBRI270_READY_GPIO;
+       /* Colibri PXA320 */
+       } else if (machine_is_colibri320()) {
+               colibri_pcmcia_gpio.reset_gpio  = COLIBRI320_RESET_GPIO;
+               colibri_pcmcia_gpio.ppen_gpio   = COLIBRI320_PPEN_GPIO;
+               colibri_pcmcia_gpio.bvd1_gpio   = COLIBRI320_BVD1_GPIO;
+               colibri_pcmcia_gpio.bvd2_gpio   = COLIBRI320_BVD2_GPIO;
+               colibri_pcmcia_gpio.detect_gpio = COLIBRI320_DETECT_GPIO;
+               colibri_pcmcia_gpio.ready_gpio  = COLIBRI320_READY_GPIO;
       }
 
       ret = platform_device_add_data(colibri_pcmcia_device,
@@ -209,6 +224,6 @@ module_init(colibri_pcmcia_init);
 module_exit(colibri_pcmcia_exit);
 
 MODULE_AUTHOR("Marek Vasut <[email protected]>");
-MODULE_DESCRIPTION("PCMCIA support for Toradex Colibri PXA270");
+MODULE_DESCRIPTION("PCMCIA support for Toradex Colibri PXA270/PXA320");
 MODULE_ALIAS("platform:pxa2xx-pcmcia");
 MODULE_LICENSE("GPL");
--

1.7.1

#16 lore raw

PATCH 7/11 ARM: pxa: Modularize Palm Tungsten|C

In reply to Marek Vasut
---
 arch/arm/mach-pxa/palmtc.c |  147 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 116 insertions(+), 31 deletions(-)
arch/arm/mach-pxa/palmtc.c +116 -31
index ce1104d..7f868d4 100644
@@ -25,6 +25,7 @@
 #include <linux/power_supply.h>
 #include <linux/gpio_keys.h>
 #include <linux/mtd/physmap.h>
+#include <linux/usb/gpio_vbus.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -116,6 +117,7 @@ static unsigned long palmtc_pin_config[] __initdata = {
 /******************************************************************************
  * SD/MMC card controller
  ******************************************************************************/
+#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
 static struct pxamci_platform_data palmtc_mci_platform_data = {
 	.ocr_mask		= MMC_VDD_32_33 | MMC_VDD_33_34,
 	.gpio_power		= GPIO_NR_PALMTC_SD_POWER,
@@ -124,9 +126,18 @@ static struct pxamci_platform_data palmtc_mci_platform_data = {
 	.detect_delay_ms	= 200,
 };
 
+static void __init palmtc_mmc_init(void)
+{
+	pxa_set_mci_info(&palmtc_mci_platform_data);
+}
+#else
+static inline void palmtc_mmc_init(void) {}
+#endif
+
 /******************************************************************************
  * GPIO keys
  ******************************************************************************/
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
 static struct gpio_keys_button palmtc_pxa_buttons[] = {
 	{KEY_F8, GPIO_NR_PALMTC_HOTSYNC_BUTTON, 1, "HotSync Button", EV_KEY, 1},
 };
@@ -144,9 +155,18 @@ static struct platform_device palmtc_pxa_keys = {
 	},
 };
 
+static void __init palmtc_keys_init(void)
+{
+	platform_device_register(&palmtc_pxa_keys);
+}
+#else
+static inline void palmtc_keys_init(void) {}
+#endif
+
 /******************************************************************************
  * Backlight
  ******************************************************************************/
+#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
 static int palmtc_backlight_init(struct device *dev)
 {
 	int ret;
@@ -196,17 +216,35 @@ static struct platform_device palmtc_backlight = {
 	},
 };
 
+static void __init palmtc_pwm_init(void)
+{
+	platform_device_register(&palmtc_backlight);
+}
+#else
+static inline void palmtc_pwm_init(void) {}
+#endif
+
 /******************************************************************************
  * IrDA
  ******************************************************************************/
+#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
 static struct pxaficp_platform_data palmtc_ficp_platform_data = {
 	.gpio_pwdown		= GPIO_NR_PALMTC_IR_DISABLE,
 	.transceiver_cap	= IR_SIRMODE | IR_OFF,
 };
 
+static void __init palmtc_irda_init(void)
+{
+	pxa_set_ficp_info(&palmtc_ficp_platform_data);
+}
+#else
+static inline void palmtc_irda_init(void) {}
+#endif
+
 /******************************************************************************
  * Keyboard
  ******************************************************************************/
+#if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
 static const uint32_t palmtc_matrix_keys[] = {
 	KEY(0, 0, KEY_F1),
 	KEY(0, 1, KEY_X),
@@ -290,27 +328,63 @@ static struct platform_device palmtc_keyboard = {
 		.platform_data = &palmtc_keypad_platform_data,
 	},
 };
+static void __init palmtc_mkp_init(void)
+{
+	platform_device_register(&palmtc_keyboard);
+}
+#else
+static inline void palmtc_mkp_init(void) {}
+#endif
 
 /******************************************************************************
  * UDC
  ******************************************************************************/
-static struct pxa2xx_udc_mach_info palmtc_udc_info __initdata = {
+#if defined(CONFIG_USB_GADGET_PXA25X)||defined(CONFIG_USB_GADGET_PXA25X_MODULE)
+static struct gpio_vbus_mach_info palmtc_udc_info = {
 	.gpio_vbus		= GPIO_NR_PALMTC_USB_DETECT_N,
 	.gpio_vbus_inverted	= 1,
 	.gpio_pullup		= GPIO_NR_PALMTC_USB_POWER,
 };
 
+static struct platform_device palmtc_gpio_vbus = {
+	.name	= "gpio-vbus",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &palmtc_udc_info,
+	},
+};
+
+static void __init palmtc_udc_init(void)
+{
+	platform_device_register(&palmtc_gpio_vbus);
+};
+#else
+static inline void palmtc_udc_init(void) {}
+#endif
+
 /******************************************************************************
  * Touchscreen / Battery / GPIO-extender
  ******************************************************************************/
-static struct platform_device palmtc_ucb1400_core = {
+#if	defined(CONFIG_TOUCHSCREEN_UCB1400) || \
+	defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
+static struct platform_device palmtc_ucb1400_device = {
 	.name	= "ucb1400_core",
 	.id	= -1,
 };
 
+static void __init palmtc_ts_init(void)
+{
+	pxa_set_ac97_info(NULL);
+	platform_device_register(&palmtc_ucb1400_device);
+}
+#else
+static inline void palmtc_ts_init(void) {}
+#endif
+
 /******************************************************************************
  * NOR Flash
  ******************************************************************************/
+#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
 static struct resource palmtc_flash_resource = {
 	.start	= PXA_CS0_PHYS,
 	.end	= PXA_CS0_PHYS + SZ_16M - 1,
@@ -356,24 +430,33 @@ static struct platform_device palmtc_flash = {
 	},
 };
 
+static void __init palmtc_nor_init(void)
+{
+	platform_device_register(&palmtc_flash);
+}
+#else
+static inline void palmtc_nor_init(void) {}
+#endif
+
 /******************************************************************************
  * Framebuffer
  ******************************************************************************/
+#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
 static struct pxafb_mode_info palmtc_lcd_modes[] = {
-{
-	.pixclock	= 115384,
-	.xres		= 320,
-	.yres		= 320,
-	.bpp		= 16,
-
-	.left_margin	= 27,
-	.right_margin	= 7,
-	.upper_margin	= 7,
-	.lower_margin	= 8,
-
-	.hsync_len	= 6,
-	.vsync_len	= 1,
-},
+	{
+		.pixclock	= 115384,
+		.xres		= 320,
+		.yres		= 320,
+		.bpp		= 16,
+
+		.left_margin	= 27,
+		.right_margin	= 7,
+		.upper_margin	= 7,
+		.lower_margin	= 8,
+
+		.hsync_len	= 6,
+		.vsync_len	= 1,
+	},
 };
 
 static struct pxafb_mach_info palmtc_lcd_screen = {
@@ -382,17 +465,17 @@ static struct pxafb_mach_info palmtc_lcd_screen = {
 	.lcd_conn		= LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
 };
 
+static void __init palmtc_lcd_init(void)
+{
+	set_pxa_fb_info(&palmtc_lcd_screen);
+}
+#else
+static inline void palmtc_lcd_init(void) {}
+#endif
+
 /******************************************************************************
  * Machine init
  ******************************************************************************/
-static struct platform_device *devices[] __initdata = {
-	&palmtc_backlight,
-	&palmtc_ucb1400_core,
-	&palmtc_keyboard,
-	&palmtc_pxa_keys,
-	&palmtc_flash,
-};
-
 static void __init palmtc_init(void)
 {
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtc_pin_config));
@@ -402,13 +485,15 @@ static void __init palmtc_init(void)
 	pxa_set_stuart_info(NULL);
 	pxa_set_hwuart_info(NULL);
 
-	set_pxa_fb_info(&palmtc_lcd_screen);
-	pxa_set_mci_info(&palmtc_mci_platform_data);
-	pxa_set_udc_info(&palmtc_udc_info);
-	pxa_set_ac97_info(NULL);
-	pxa_set_ficp_info(&palmtc_ficp_platform_data);
-
-	platform_add_devices(devices, ARRAY_SIZE(devices));
+	palmtc_mmc_init();
+	palmtc_keys_init();
+	palmtc_pwm_init();
+	palmtc_irda_init();
+	palmtc_mkp_init();
+	palmtc_udc_init();
+	palmtc_ts_init();
+	palmtc_nor_init();
+	palmtc_lcd_init();
 };
 
 MACHINE_START(PALMTC, "Palm Tungsten|C")
Signature · 1 line
1.7.1
#17 lore raw

PATCH 7/11 ARM: pxa: Modularize Palm Tungsten|C

Looks good.

Quoted 266 lines · Marek Vasut

---
?arch/arm/mach-pxa/palmtc.c | ?147 ++++++++++++++++++++++++++++++++++--------- ?1 files changed, 116 insertions(+), 31 deletions(-)

arch/arm/mach-pxa/palmtc.c +0 -0
index ce1104d..7f868d4 100644
@@ -25,6 +25,7 @@

?#include <linux/power_supply.h>
?#include <linux/gpio_keys.h>
?#include <linux/mtd/physmap.h>
+#include <linux/usb/gpio_vbus.h>

?#include <asm/mach-types.h>
?#include <asm/mach/arch.h>

arch/arm/mach-pxa/palmtc.c +0 -0
@@ -116,6 +117,7 @@ static unsigned long palmtc_pin_config[] __initdata = {

?/****************************************************************************** ?* SD/MMC card controller ?******************************************************************************/ +#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) ?static struct pxamci_platform_data palmtc_mci_platform_data = {
? ? ? ?.ocr_mask ? ? ? ? ? ? ? = MMC_VDD_32_33 | MMC_VDD_33_34,
? ? ? ?.gpio_power ? ? ? ? ? ? = GPIO_NR_PALMTC_SD_POWER,

arch/arm/mach-pxa/palmtc.c +8 -0
@@ -124,9 +126,18 @@ static struct pxamci_platform_data palmtc_mci_platform_data = {
 ? ? ? ?.detect_delay_ms ? ? ? ?= 200,
 ?};
 
+static void __init palmtc_mmc_init(void)
+{
+ ? ? ? pxa_set_mci_info(&palmtc_mci_platform_data);
+}
+#else
+static inline void palmtc_mmc_init(void) {}
+#endif
+

?/****************************************************************************** ?* GPIO keys ?******************************************************************************/ +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) ?static struct gpio_keys_button palmtc_pxa_buttons[] = {
? ? ? ?{KEY_F8, GPIO_NR_PALMTC_HOTSYNC_BUTTON, 1, "HotSync Button", EV_KEY, 1}, ?};

arch/arm/mach-pxa/palmtc.c +8 -0
@@ -144,9 +155,18 @@ static struct platform_device palmtc_pxa_keys = {
 ? ? ? ?},
 ?};
 
+static void __init palmtc_keys_init(void)
+{
+ ? ? ? platform_device_register(&palmtc_pxa_keys);
+}
+#else
+static inline void palmtc_keys_init(void) {}
+#endif
+

?/****************************************************************************** ?* Backlight ?******************************************************************************/ +#if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) ?static int palmtc_backlight_init(struct device *dev)
?{
? ? ? ?int ret;

arch/arm/mach-pxa/palmtc.c +8 -0
@@ -196,17 +216,35 @@ static struct platform_device palmtc_backlight = {
 ? ? ? ?},
 ?};
 
+static void __init palmtc_pwm_init(void)
+{
+ ? ? ? platform_device_register(&palmtc_backlight);
+}
+#else
+static inline void palmtc_pwm_init(void) {}
+#endif
+

?/****************************************************************************** ?* IrDA ?******************************************************************************/ +#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
?static struct pxaficp_platform_data palmtc_ficp_platform_data = { ? ? ? ?.gpio_pwdown ? ? ? ? ? ?= GPIO_NR_PALMTC_IR_DISABLE,
? ? ? ?.transceiver_cap ? ? ? ?= IR_SIRMODE | IR_OFF,
?};

arch/arm/mach-pxa/palmtc.c +8 -0
+static void __init palmtc_irda_init(void)
+{
+ ? ? ? pxa_set_ficp_info(&palmtc_ficp_platform_data);
+}
+#else
+static inline void palmtc_irda_init(void) {}
+#endif
+

?/****************************************************************************** ?* Keyboard ?******************************************************************************/ +#if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) ?static const uint32_t palmtc_matrix_keys[] = {
? ? ? ?KEY(0, 0, KEY_F1),
? ? ? ?KEY(0, 1, KEY_X),

arch/arm/mach-pxa/palmtc.c +7 -0
@@ -290,27 +328,63 @@ static struct platform_device palmtc_keyboard = {
 ? ? ? ? ? ? ? ?.platform_data = &palmtc_keypad_platform_data,
 ? ? ? ?},
 ?};
+static void __init palmtc_mkp_init(void)
+{
+ ? ? ? platform_device_register(&palmtc_keyboard);
+}
+#else
+static inline void palmtc_mkp_init(void) {}
+#endif
 

?/****************************************************************************** ?* UDC ?******************************************************************************/

arch/arm/mach-pxa/palmtc.c +2 -1
-static struct pxa2xx_udc_mach_info palmtc_udc_info __initdata = {
+#if defined(CONFIG_USB_GADGET_PXA25X)||defined(CONFIG_USB_GADGET_PXA25X_MODULE)
+static struct gpio_vbus_mach_info palmtc_udc_info = {

? ? ? ?.gpio_vbus ? ? ? ? ? ? ?= GPIO_NR_PALMTC_USB_DETECT_N, ? ? ? ?.gpio_vbus_inverted ? ? = 1,
? ? ? ?.gpio_pullup ? ? ? ? ? ?= GPIO_NR_PALMTC_USB_POWER, ?};

arch/arm/mach-pxa/palmtc.c +16 -0
+static struct platform_device palmtc_gpio_vbus = {
+ ? ? ? .name ? = "gpio-vbus",
+ ? ? ? .id ? ? = -1,
+ ? ? ? .dev ? ?= {
+ ? ? ? ? ? ? ? .platform_data ?= &palmtc_udc_info,
+ ? ? ? },
+};
+
+static void __init palmtc_udc_init(void)
+{
+ ? ? ? platform_device_register(&palmtc_gpio_vbus);
+};
+#else
+static inline void palmtc_udc_init(void) {}
+#endif
+

?/****************************************************************************** ?* Touchscreen / Battery / GPIO-extender ?******************************************************************************/

arch/arm/mach-pxa/palmtc.c +3 -1
-static struct platform_device palmtc_ucb1400_core = {
+#if ? ?defined(CONFIG_TOUCHSCREEN_UCB1400) || \
+ ? ? ? defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
+static struct platform_device palmtc_ucb1400_device = {

? ? ? ?.name ? = "ucb1400_core",
? ? ? ?.id ? ? = -1,
?};

arch/arm/mach-pxa/palmtc.c +9 -0
+static void __init palmtc_ts_init(void)
+{
+ ? ? ? pxa_set_ac97_info(NULL);
+ ? ? ? platform_device_register(&palmtc_ucb1400_device);
+}
+#else
+static inline void palmtc_ts_init(void) {}
+#endif
+

?/****************************************************************************** ?* NOR Flash ?******************************************************************************/ +#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) ?static struct resource palmtc_flash_resource = {
? ? ? ?.start ?= PXA_CS0_PHYS,
? ? ? ?.end ? ?= PXA_CS0_PHYS + SZ_16M - 1,

arch/arm/mach-pxa/palmtc.c +8 -0
@@ -356,24 +430,33 @@ static struct platform_device palmtc_flash = {
 ? ? ? ?},
 ?};
 
+static void __init palmtc_nor_init(void)
+{
+ ? ? ? platform_device_register(&palmtc_flash);
+}
+#else
+static inline void palmtc_nor_init(void) {}
+#endif
+

?/****************************************************************************** ?* Framebuffer ?******************************************************************************/ +#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) ?static struct pxafb_mode_info palmtc_lcd_modes[] = {

arch/arm/mach-pxa/palmtc.c +14 -14
-{
- ? ? ? .pixclock ? ? ? = 115384,
- ? ? ? .xres ? ? ? ? ? = 320,
- ? ? ? .yres ? ? ? ? ? = 320,
- ? ? ? .bpp ? ? ? ? ? ?= 16,
-
- ? ? ? .left_margin ? ?= 27,
- ? ? ? .right_margin ? = 7,
- ? ? ? .upper_margin ? = 7,
- ? ? ? .lower_margin ? = 8,
-
- ? ? ? .hsync_len ? ? ?= 6,
- ? ? ? .vsync_len ? ? ?= 1,
-},
+ ? ? ? {
+ ? ? ? ? ? ? ? .pixclock ? ? ? = 115384,
+ ? ? ? ? ? ? ? .xres ? ? ? ? ? = 320,
+ ? ? ? ? ? ? ? .yres ? ? ? ? ? = 320,
+ ? ? ? ? ? ? ? .bpp ? ? ? ? ? ?= 16,
+
+ ? ? ? ? ? ? ? .left_margin ? ?= 27,
+ ? ? ? ? ? ? ? .right_margin ? = 7,
+ ? ? ? ? ? ? ? .upper_margin ? = 7,
+ ? ? ? ? ? ? ? .lower_margin ? = 8,
+
+ ? ? ? ? ? ? ? .hsync_len ? ? ?= 6,
+ ? ? ? ? ? ? ? .vsync_len ? ? ?= 1,
+ ? ? ? },

?};

?static struct pxafb_mach_info palmtc_lcd_screen = {

arch/arm/mach-pxa/palmtc.c +8 -0
@@ -382,17 +465,17 @@ static struct pxafb_mach_info palmtc_lcd_screen = {
 ? ? ? ?.lcd_conn ? ? ? ? ? ? ? = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
 ?};
 
+static void __init palmtc_lcd_init(void)
+{
+ ? ? ? set_pxa_fb_info(&palmtc_lcd_screen);
+}
+#else
+static inline void palmtc_lcd_init(void) {}
+#endif
+

?/****************************************************************************** ?* Machine init ?******************************************************************************/

arch/arm/mach-pxa/palmtc.c +0 -8
-static struct platform_device *devices[] __initdata = {
- ? ? ? &palmtc_backlight,
- ? ? ? &palmtc_ucb1400_core,
- ? ? ? &palmtc_keyboard,
- ? ? ? &palmtc_pxa_keys,
- ? ? ? &palmtc_flash,
-};
-

?static void __init palmtc_init(void)
?{
? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtc_pin_config));

arch/arm/mach-pxa/palmtc.c +9 -8
@@ -402,13 +485,15 @@ static void __init palmtc_init(void)
 ? ? ? ?pxa_set_stuart_info(NULL);
 ? ? ? ?pxa_set_hwuart_info(NULL);
 
- ? ? ? set_pxa_fb_info(&palmtc_lcd_screen);
- ? ? ? pxa_set_mci_info(&palmtc_mci_platform_data);
- ? ? ? pxa_set_udc_info(&palmtc_udc_info);
- ? ? ? pxa_set_ac97_info(NULL);
- ? ? ? pxa_set_ficp_info(&palmtc_ficp_platform_data);
-
- ? ? ? platform_add_devices(devices, ARRAY_SIZE(devices));
+ ? ? ? palmtc_mmc_init();
+ ? ? ? palmtc_keys_init();
+ ? ? ? palmtc_pwm_init();
+ ? ? ? palmtc_irda_init();
+ ? ? ? palmtc_mkp_init();
+ ? ? ? palmtc_udc_init();
+ ? ? ? palmtc_ts_init();
+ ? ? ? palmtc_nor_init();
+ ? ? ? palmtc_lcd_init();
 ?};
 
 ?MACHINE_START(PALMTC, "Palm Tungsten|C")
--

1.7.1

#18 lore raw

PATCH 8/11 UCB1400: Pass ucb1400-gpio data through ac97 bus

In reply to Marek Vasut
---
 drivers/gpio/ucb1400_gpio.c |   19 ++++++-------------
 drivers/mfd/ucb1400_core.c  |    5 +++++
 include/linux/ucb1400.h     |   19 ++++++-------------
 3 files changed, 17 insertions(+), 26 deletions(-)
drivers/gpio/ucb1400_gpio.c +6 -13
index 50e6bd1..fba45a5 100644
@@ -12,8 +12,6 @@
 #include <linux/module.h>
 #include <linux/ucb1400.h>
 
-struct ucb1400_gpio_data *ucbdata;
-
 static int ucb1400_gpio_dir_in(struct gpio_chip *gc, unsigned off)
 {
 	struct ucb1400_gpio *gpio;
@@ -50,7 +48,7 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
 	struct ucb1400_gpio *ucb = dev->dev.platform_data;
 	int err = 0;
 
-	if (!(ucbdata && ucbdata->gpio_offset)) {
+	if (!(ucb && ucb->gpio_offset)) {
 		err = -EINVAL;
 		goto err;
 	}
@@ -58,7 +56,7 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
 	platform_set_drvdata(dev, ucb);
 
 	ucb->gc.label = "ucb1400_gpio";
-	ucb->gc.base = ucbdata->gpio_offset;
+	ucb->gc.base = ucb->gpio_offset;
 	ucb->gc.ngpio = 10;
 	ucb->gc.owner = THIS_MODULE;
 
@@ -72,8 +70,8 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
 	if (err)
 		goto err;
 
-	if (ucbdata && ucbdata->gpio_setup)
-		err = ucbdata->gpio_setup(&dev->dev, ucb->gc.ngpio);
+	if (ucb && ucb->gpio_setup)
+		err = ucb->gpio_setup(&dev->dev, ucb->gc.ngpio);
 
 err:
 	return err;
@@ -85,8 +83,8 @@ static int ucb1400_gpio_remove(struct platform_device *dev)
 	int err = 0;
 	struct ucb1400_gpio *ucb = platform_get_drvdata(dev);
 
-	if (ucbdata && ucbdata->gpio_teardown) {
-		err = ucbdata->gpio_teardown(&dev->dev, ucb->gc.ngpio);
+	if (ucb && ucb->gpio_teardown) {
+		err = ucb->gpio_teardown(&dev->dev, ucb->gc.ngpio);
 		if (err)
 			return err;
 	}
@@ -113,11 +111,6 @@ static void __exit ucb1400_gpio_exit(void)
 	platform_driver_unregister(&ucb1400_gpio_driver);
 }
 
-void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data)
-{
-	ucbdata = data;
-}
-
 module_init(ucb1400_gpio_init);
 module_exit(ucb1400_gpio_exit);
 
drivers/mfd/ucb1400_core.c +5 -0
index d73f84b..63f4969 100644
@@ -75,6 +75,11 @@ static int ucb1400_core_probe(struct device *dev)
 
 	/* GPIO */
 	ucb_gpio.ac97 = ac97;
+	if (pdata) {
+		ucb_gpio.gpio_setup = pdata->gpio_setup;
+		ucb_gpio.gpio_teardown = pdata->gpio_teardown;
+		ucb_gpio.gpio_offset = pdata->gpio_offset;
+	}
 	ucb->ucb1400_gpio = platform_device_alloc("ucb1400_gpio", -1);
 	if (!ucb->ucb1400_gpio) {
 		err = -ENOMEM;
include/linux/ucb1400.h +6 -13
index 1b47909..1a6bfdd 100644
@@ -83,15 +83,12 @@
 #define UCB_ID			0x7e
 #define UCB_ID_1400             0x4304
 
-struct ucb1400_gpio_data {
-	int gpio_offset;
-	int (*gpio_setup)(struct device *dev, int ngpio);
-	int (*gpio_teardown)(struct device *dev, int ngpio);
-};
-
 struct ucb1400_gpio {
 	struct gpio_chip	gc;
 	struct snd_ac97		*ac97;
+	int			gpio_offset;
+	int (*gpio_setup)(struct device *dev, int ngpio);
+	int (*gpio_teardown)(struct device *dev, int ngpio);
 };
 
 struct ucb1400_ts {
@@ -112,6 +109,9 @@ struct ucb1400 {
 
 struct ucb1400_pdata {
 	int	irq;
+	int	gpio_offset;
+	int (*gpio_setup)(struct device *dev, int ngpio);
+	int (*gpio_teardown)(struct device *dev, int ngpio);
 };
 
 static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
@@ -163,11 +163,4 @@ static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
 
 unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
 			      int adcsync);
-
-#ifdef CONFIG_GPIO_UCB1400
-void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data);
-#else
-static inline void ucb1400_gpio_set_data(struct ucb1400_gpio_data *data) {}
-#endif
-
 #endif
Signature · 1 line
1.7.1
#19 lore raw

PATCH 8/11 UCB1400: Pass ucb1400-gpio data through ac97 bus

Cc'ed David.

David,

Do you mind it goes through my tree as there is subsequent patches following that have dependency? In that case, your Ack is mostly welcome.

Quoted 137 lines · Marek Vasut

---

?drivers/gpio/ucb1400_gpio.c | ? 19 ++++++-------------
?drivers/mfd/ucb1400_core.c ?| ? ?5 +++++
?include/linux/ucb1400.h ? ? | ? 19 ++++++-------------

?3 files changed, 17 insertions(+), 26 deletions(-)

drivers/gpio/ucb1400_gpio.c +0 -0
index 50e6bd1..fba45a5 100644
@@ -12,8 +12,6 @@

?#include <linux/module.h>
?#include <linux/ucb1400.h>

drivers/gpio/ucb1400_gpio.c +0 -2
-struct ucb1400_gpio_data *ucbdata;
-

?static int ucb1400_gpio_dir_in(struct gpio_chip *gc, unsigned off) ?{
? ? ? ?struct ucb1400_gpio *gpio;

drivers/gpio/ucb1400_gpio.c +4 -4
@@ -50,7 +48,7 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
 ? ? ? ?struct ucb1400_gpio *ucb = dev->dev.platform_data;
 ? ? ? ?int err = 0;
 
- ? ? ? if (!(ucbdata && ucbdata->gpio_offset)) {
+ ? ? ? if (!(ucb && ucb->gpio_offset)) {
 ? ? ? ? ? ? ? ?err = -EINVAL;
 ? ? ? ? ? ? ? ?goto err;
 ? ? ? ?}
@@ -58,7 +56,7 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
 ? ? ? ?platform_set_drvdata(dev, ucb);
 
 ? ? ? ?ucb->gc.label = "ucb1400_gpio";
- ? ? ? ucb->gc.base = ucbdata->gpio_offset;
+ ? ? ? ucb->gc.base = ucb->gpio_offset;
 ? ? ? ?ucb->gc.ngpio = 10;
 ? ? ? ?ucb->gc.owner = THIS_MODULE;
 
@@ -72,8 +70,8 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
 ? ? ? ?if (err)
 ? ? ? ? ? ? ? ?goto err;
 
- ? ? ? if (ucbdata && ucbdata->gpio_setup)
- ? ? ? ? ? ? ? err = ucbdata->gpio_setup(&dev->dev, ucb->gc.ngpio);
+ ? ? ? if (ucb && ucb->gpio_setup)
+ ? ? ? ? ? ? ? err = ucb->gpio_setup(&dev->dev, ucb->gc.ngpio);
 

?err:
? ? ? ?return err;

drivers/gpio/ucb1400_gpio.c +2 -7
@@ -85,8 +83,8 @@ static int ucb1400_gpio_remove(struct platform_device *dev)
 ? ? ? ?int err = 0;
 ? ? ? ?struct ucb1400_gpio *ucb = platform_get_drvdata(dev);
 
- ? ? ? if (ucbdata && ucbdata->gpio_teardown) {
- ? ? ? ? ? ? ? err = ucbdata->gpio_teardown(&dev->dev, ucb->gc.ngpio);
+ ? ? ? if (ucb && ucb->gpio_teardown) {
+ ? ? ? ? ? ? ? err = ucb->gpio_teardown(&dev->dev, ucb->gc.ngpio);
 ? ? ? ? ? ? ? ?if (err)
 ? ? ? ? ? ? ? ? ? ? ? ?return err;
 ? ? ? ?}
@@ -113,11 +111,6 @@ static void __exit ucb1400_gpio_exit(void)
 ? ? ? ?platform_driver_unregister(&ucb1400_gpio_driver);
 ?}
 
-void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data)
-{
- ? ? ? ucbdata = data;
-}
-
 ?module_init(ucb1400_gpio_init);
 ?module_exit(ucb1400_gpio_exit);
 
drivers/mfd/ucb1400_core.c +0 -0
index d73f84b..63f4969 100644
@@ -75,6 +75,11 @@ static int ucb1400_core_probe(struct device *dev)
 

? ? ? ?/* GPIO */
? ? ? ?ucb_gpio.ac97 = ac97;
+ ? ? ? if (pdata) {
+ ? ? ? ? ? ? ? ucb_gpio.gpio_setup = pdata->gpio_setup;
+ ? ? ? ? ? ? ? ucb_gpio.gpio_teardown = pdata->gpio_teardown;
+ ? ? ? ? ? ? ? ucb_gpio.gpio_offset = pdata->gpio_offset;
+ ? ? ? }
? ? ? ?ucb->ucb1400_gpio = platform_device_alloc("ucb1400_gpio", -1); ? ? ? ?if (!ucb->ucb1400_gpio) {
? ? ? ? ? ? ? ?err = -ENOMEM;

include/linux/ucb1400.h +0 -0
index 1b47909..1a6bfdd 100644
@@ -83,15 +83,12 @@

?#define UCB_ID ? ? ? ? ? ? ? ? 0x7e
?#define UCB_ID_1400 ? ? ? ? ? ? 0x4304

include/linux/ucb1400.h +0 -6
-struct ucb1400_gpio_data {
- ? ? ? int gpio_offset;
- ? ? ? int (*gpio_setup)(struct device *dev, int ngpio);
- ? ? ? int (*gpio_teardown)(struct device *dev, int ngpio);
-};
-

?struct ucb1400_gpio {
? ? ? ?struct gpio_chip ? ? ? ?gc;
? ? ? ?struct snd_ac97 ? ? ? ? *ac97;
+ ? ? ? int ? ? ? ? ? ? ? ? ? ? gpio_offset;
+ ? ? ? int (*gpio_setup)(struct device *dev, int ngpio);
+ ? ? ? int (*gpio_teardown)(struct device *dev, int ngpio); ?};

?struct ucb1400_ts {

include/linux/ucb1400.h +3 -7
@@ -112,6 +109,9 @@ struct ucb1400 {
 
 ?struct ucb1400_pdata {
 ? ? ? ?int ? ? irq;
+ ? ? ? int ? ? gpio_offset;
+ ? ? ? int (*gpio_setup)(struct device *dev, int ngpio);
+ ? ? ? int (*gpio_teardown)(struct device *dev, int ngpio);
 ?};
 
 ?static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
@@ -163,11 +163,4 @@ static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
 
 ?unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?int adcsync);
-
-#ifdef CONFIG_GPIO_UCB1400
-void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data);
-#else
-static inline void ucb1400_gpio_set_data(struct ucb1400_gpio_data *data) {}
-#endif
-

?#endif
--
1.7.1

#20 lore raw

PATCH 8/11 UCB1400: Pass ucb1400-gpio data through ac97 bus

Dne Po 20. z??? 2010 16:45:59 Eric Miao napsal(a):

Quoted 8 lines

Cc'ed David.

David,

Do you mind it goes through my tree as there is subsequent patches following that have dependency? In that case, your Ack is mostly welcome.

Any updates?

Quoted 137 lines · Marek Vasut
Quoted 136 lines
---
 drivers/gpio/ucb1400_gpio.c |   19 ++++++-------------
 drivers/mfd/ucb1400_core.c  |    5 +++++
 include/linux/ucb1400.h     |   19 ++++++-------------
 3 files changed, 17 insertions(+), 26 deletions(-)
drivers/gpio/ucb1400_gpio.c +6 -13
index 50e6bd1..fba45a5 100644
@@ -12,8 +12,6 @@
 #include <linux/module.h>
 #include <linux/ucb1400.h>
 
-struct ucb1400_gpio_data *ucbdata;
-
 static int ucb1400_gpio_dir_in(struct gpio_chip *gc, unsigned off)
 {
       struct ucb1400_gpio *gpio;
@@ -50,7 +48,7 @@ static int ucb1400_gpio_probe(struct platform_device
 *dev) struct ucb1400_gpio *ucb = dev->dev.platform_data;
       int err = 0;
 
-       if (!(ucbdata && ucbdata->gpio_offset)) {
+       if (!(ucb && ucb->gpio_offset)) {
               err = -EINVAL;
               goto err;
       }
@@ -58,7 +56,7 @@ static int ucb1400_gpio_probe(struct platform_device
 *dev) platform_set_drvdata(dev, ucb);
 
       ucb->gc.label = "ucb1400_gpio";
-       ucb->gc.base = ucbdata->gpio_offset;
+       ucb->gc.base = ucb->gpio_offset;
       ucb->gc.ngpio = 10;
       ucb->gc.owner = THIS_MODULE;
 
@@ -72,8 +70,8 @@ static int ucb1400_gpio_probe(struct platform_device
 *dev) if (err)
               goto err;
 
-       if (ucbdata && ucbdata->gpio_setup)
-               err = ucbdata->gpio_setup(&dev->dev, ucb->gc.ngpio);
+       if (ucb && ucb->gpio_setup)
+               err = ucb->gpio_setup(&dev->dev, ucb->gc.ngpio);
 
 err:
       return err;
@@ -85,8 +83,8 @@ static int ucb1400_gpio_remove(struct platform_device
 *dev) int err = 0;
       struct ucb1400_gpio *ucb = platform_get_drvdata(dev);
 
-       if (ucbdata && ucbdata->gpio_teardown) {
-               err = ucbdata->gpio_teardown(&dev->dev, ucb->gc.ngpio);
+       if (ucb && ucb->gpio_teardown) {
+               err = ucb->gpio_teardown(&dev->dev, ucb->gc.ngpio);
               if (err)
                       return err;
       }
@@ -113,11 +111,6 @@ static void __exit ucb1400_gpio_exit(void)
       platform_driver_unregister(&ucb1400_gpio_driver);
 }
 
-void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data)
-{
-       ucbdata = data;
-}
-
 module_init(ucb1400_gpio_init);
 module_exit(ucb1400_gpio_exit);
 
drivers/mfd/ucb1400_core.c +5 -0
index d73f84b..63f4969 100644
@@ -75,6 +75,11 @@ static int ucb1400_core_probe(struct device *dev)
 
       /* GPIO */
       ucb_gpio.ac97 = ac97;
+       if (pdata) {
+               ucb_gpio.gpio_setup = pdata->gpio_setup;
+               ucb_gpio.gpio_teardown = pdata->gpio_teardown;
+               ucb_gpio.gpio_offset = pdata->gpio_offset;
+       }
       ucb->ucb1400_gpio = platform_device_alloc("ucb1400_gpio", -1);
       if (!ucb->ucb1400_gpio) {
               err = -ENOMEM;
include/linux/ucb1400.h +6 -11
index 1b47909..1a6bfdd 100644
@@ -83,15 +83,12 @@
 #define UCB_ID                 0x7e
 #define UCB_ID_1400             0x4304
 
-struct ucb1400_gpio_data {
-       int gpio_offset;
-       int (*gpio_setup)(struct device *dev, int ngpio);
-       int (*gpio_teardown)(struct device *dev, int ngpio);
-};
-
 struct ucb1400_gpio {
       struct gpio_chip        gc;
       struct snd_ac97         *ac97;
+       int                     gpio_offset;
+       int (*gpio_setup)(struct device *dev, int ngpio);
+       int (*gpio_teardown)(struct device *dev, int ngpio);
 };
 
 struct ucb1400_ts {
@@ -112,6 +109,9 @@ struct ucb1400 {
 
 struct ucb1400_pdata {
       int     irq;
+       int     gpio_offset;
+       int (*gpio_setup)(struct device *dev, int ngpio);
+       int (*gpio_teardown)(struct device *dev, int ngpio);
 };
 
 static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
@@ -163,11 +163,4 @@ static inline void ucb1400_adc_disable(struct
 snd_ac97 *ac97)
 
 unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
                             int adcsync);
-
-#ifdef CONFIG_GPIO_UCB1400
-void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data);
-#else
-static inline void ucb1400_gpio_set_data(struct ucb1400_gpio_data *data)

{} -#endif
-
#endif
--
1.7.1

#21 lore raw

PATCH 9/11 ARM: pxa: Correct touch IRQ passing to UCB1400 on vpac270

In reply to Marek Vasut
---
 arch/arm/mach-pxa/vpac270.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
arch/arm/mach-pxa/vpac270.c +5 -7
index c9b747c..e851d13 100644
@@ -429,20 +429,18 @@ static inline void vpac270_eth_init(void) {}
  ******************************************************************************/
 #if	defined(CONFIG_TOUCHSCREEN_UCB1400) || \
 	defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
-static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
-	.reset_gpio	= 95,
-};
-
 static struct ucb1400_pdata vpac270_ucb1400_pdata = {
 	.irq		= IRQ_GPIO(GPIO113_VPAC270_TS_IRQ),
 };
 
+static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
+	.reset_gpio	= 95,
+	.codec_pdata	= { &vpac270_ucb1400_pdata, },
+};
+
 static struct platform_device vpac270_ucb1400_device = {
 	.name		= "ucb1400_core",
 	.id		= -1,
-	.dev		= {
-		.platform_data = &vpac270_ucb1400_pdata,
-	},
 };
 
 static void __init vpac270_ts_init(void)
Signature · 1 line
1.7.1
#22 lore raw

PATCH 9/11 ARM: pxa: Correct touch IRQ passing to UCB1400 on vpac270

Quoted 34 lines · Marek Vasut

---
?arch/arm/mach-pxa/vpac270.c | ? 12 +++++-------
?1 files changed, 5 insertions(+), 7 deletions(-)

arch/arm/mach-pxa/vpac270.c +0 -0
index c9b747c..e851d13 100644
@@ -429,20 +429,18 @@ static inline void vpac270_eth_init(void) {}

?******************************************************************************/ ?#if ? ?defined(CONFIG_TOUCHSCREEN_UCB1400) || \
? ? ? ?defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)

arch/arm/mach-pxa/vpac270.c +0 -4
-static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
- ? ? ? .reset_gpio ? ? = 95,
-};
-

?static struct ucb1400_pdata vpac270_ucb1400_pdata = { ? ? ? ?.irq ? ? ? ? ? ?= IRQ_GPIO(GPIO113_VPAC270_TS_IRQ), ?};

arch/arm/mach-pxa/vpac270.c +5 -0
+static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
+ ? ? ? .reset_gpio ? ? = 95,
+ ? ? ? .codec_pdata ? ?= { &vpac270_ucb1400_pdata, },
+};
+

?static struct platform_device vpac270_ucb1400_device = { ? ? ? ?.name ? ? ? ? ? = "ucb1400_core",
? ? ? ?.id ? ? ? ? ? ? = -1,
- ? ? ? .dev ? ? ? ? ? ?= {
- ? ? ? ? ? ? ? .platform_data = &vpac270_ucb1400_pdata,
- ? ? ? },
?};

Quoted 5 lines

?static void __init vpac270_ts_init(void)
--
1.7.1

Looks good to me.

#23 lore raw

PATCH 10/11 ARM: pxa: Pass GPIO offset to ucb1400-gpio on PalmTC

In reply to Marek Vasut
---
 arch/arm/mach-pxa/palmtc.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/palmtc.c +9 -1
index 7f868d4..9c74ce9 100644
@@ -367,6 +367,14 @@ static inline void palmtc_udc_init(void) {}
  ******************************************************************************/
 #if	defined(CONFIG_TOUCHSCREEN_UCB1400) || \
 	defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
+static struct ucb1400_pdata palmtc_ucb1400_pdata = {
+	.gpio_offset	= PALMTC_UCB1400_GPIO_OFFSET,
+};
+
+static pxa2xx_audio_ops_t palmtc_ac97_pdata = {
+	.codec_pdata	= { &palmtc_ucb1400_pdata, },
+};
+
 static struct platform_device palmtc_ucb1400_device = {
 	.name	= "ucb1400_core",
 	.id	= -1,
@@ -374,7 +382,7 @@ static struct platform_device palmtc_ucb1400_device = {
 
 static void __init palmtc_ts_init(void)
 {
-	pxa_set_ac97_info(NULL);
+	pxa_set_ac97_info(&palmtc_ac97_pdata);
 	platform_device_register(&palmtc_ucb1400_device);
 }
 #else
Signature · 1 line
1.7.1
#24 lore raw

PATCH 10/11 ARM: pxa: Pass GPIO offset to ucb1400-gpio on PalmTC

Quoted 32 lines · Marek Vasut

---
?arch/arm/mach-pxa/palmtc.c | ? 10 +++++++++-
?1 files changed, 9 insertions(+), 1 deletions(-)

arch/arm/mach-pxa/palmtc.c +0 -0
index 7f868d4..9c74ce9 100644
@@ -367,6 +367,14 @@ static inline void palmtc_udc_init(void) {}

?******************************************************************************/ ?#if ? ?defined(CONFIG_TOUCHSCREEN_UCB1400) || \
? ? ? ?defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)

arch/arm/mach-pxa/palmtc.c +8 -0
+static struct ucb1400_pdata palmtc_ucb1400_pdata = {
+ ? ? ? .gpio_offset ? ?= PALMTC_UCB1400_GPIO_OFFSET,
+};
+
+static pxa2xx_audio_ops_t palmtc_ac97_pdata = {
+ ? ? ? .codec_pdata ? ?= { &palmtc_ucb1400_pdata, },
+};
+

?static struct platform_device palmtc_ucb1400_device = { ? ? ? ?.name ? = "ucb1400_core",
? ? ? ?.id ? ? = -1,

arch/arm/mach-pxa/palmtc.c +1 -1
@@ -374,7 +382,7 @@ static struct platform_device palmtc_ucb1400_device = {
 
 ?static void __init palmtc_ts_init(void)
 ?{
- ? ? ? pxa_set_ac97_info(NULL);
+ ? ? ? pxa_set_ac97_info(&palmtc_ac97_pdata);
 ? ? ? ?platform_device_register(&palmtc_ucb1400_device);
 ?}
Quoted 5 lines

?#else
--
1.7.1

OK.

#25 lore raw

PATCH 11/11 ARM: pxa: Add gpio-leds and vibrator support to PalmTC

In reply to Marek Vasut
---
 arch/arm/mach-pxa/palmtc.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)
arch/arm/mach-pxa/palmtc.c +41 -0
index 9c74ce9..ccefc4e 100644
@@ -390,6 +390,46 @@ static inline void palmtc_ts_init(void) {}
 #endif
 
 /******************************************************************************
+ * LEDs
+ ******************************************************************************/
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
+struct gpio_led palmtc_gpio_leds[] = {
+{
+	.name			= "palmtc:green:user",
+	.default_trigger	= "none",
+	.gpio			= GPIO_NR_PALMTC_LED_POWER,
+	.active_low		= 1,
+}, {
+	.name			= "palmtc:vibra:vibra",
+	.default_trigger	= "none",
+	.gpio			= GPIO_NR_PALMTC_VIBRA_POWER,
+	.active_low		= 1,
+}
+
+};
+
+static struct gpio_led_platform_data palmtc_gpio_led_info = {
+	.leds		= palmtc_gpio_leds,
+	.num_leds	= ARRAY_SIZE(palmtc_gpio_leds),
+};
+
+static struct platform_device palmtc_leds = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &palmtc_gpio_led_info,
+	}
+};
+
+static void __init palmtc_leds_init(void)
+{
+	platform_device_register(&palmtc_leds);
+}
+#else
+static inline void palmtc_leds_init(void) {}
+#endif
+
+/******************************************************************************
  * NOR Flash
  ******************************************************************************/
 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
@@ -502,6 +542,7 @@ static void __init palmtc_init(void)
 	palmtc_ts_init();
 	palmtc_nor_init();
 	palmtc_lcd_init();
+	palmtc_leds_init();
 };
 
 MACHINE_START(PALMTC, "Palm Tungsten|C")
Signature · 1 line
1.7.1
#26 lore raw

PATCH 11/11 ARM: pxa: Add gpio-leds and vibrator support to PalmTC

Quoted 65 lines · Marek Vasut

---
?arch/arm/mach-pxa/palmtc.c | ? 41 +++++++++++++++++++++++++++++++++++++++++ ?1 files changed, 41 insertions(+), 0 deletions(-)

arch/arm/mach-pxa/palmtc.c +0 -0
index 9c74ce9..ccefc4e 100644
@@ -390,6 +390,46 @@ static inline void palmtc_ts_init(void) {}

?#endif

?/******************************************************************************
+ * LEDs
+ ******************************************************************************/

arch/arm/mach-pxa/palmtc.c +38 -0
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
+struct gpio_led palmtc_gpio_leds[] = {
+{
+ ? ? ? .name ? ? ? ? ? ? ? ? ? = "palmtc:green:user",
+ ? ? ? .default_trigger ? ? ? ?= "none",
+ ? ? ? .gpio ? ? ? ? ? ? ? ? ? = GPIO_NR_PALMTC_LED_POWER,
+ ? ? ? .active_low ? ? ? ? ? ? = 1,
+}, {
+ ? ? ? .name ? ? ? ? ? ? ? ? ? = "palmtc:vibra:vibra",
+ ? ? ? .default_trigger ? ? ? ?= "none",
+ ? ? ? .gpio ? ? ? ? ? ? ? ? ? = GPIO_NR_PALMTC_VIBRA_POWER,
+ ? ? ? .active_low ? ? ? ? ? ? = 1,
+}
+
+};
+
+static struct gpio_led_platform_data palmtc_gpio_led_info = {
+ ? ? ? .leds ? ? ? ? ? = palmtc_gpio_leds,
+ ? ? ? .num_leds ? ? ? = ARRAY_SIZE(palmtc_gpio_leds),
+};
+
+static struct platform_device palmtc_leds = {
+ ? ? ? .name ? = "leds-gpio",
+ ? ? ? .id ? ? = -1,
+ ? ? ? .dev ? ?= {
+ ? ? ? ? ? ? ? .platform_data ?= &palmtc_gpio_led_info,
+ ? ? ? }
+};
+
+static void __init palmtc_leds_init(void)
+{
+ ? ? ? platform_device_register(&palmtc_leds);
+}
+#else
+static inline void palmtc_leds_init(void) {}
+#endif
+
+/******************************************************************************

?* NOR Flash ?******************************************************************************/ ?#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)

arch/arm/mach-pxa/palmtc.c +1 -1
@@ -502,6 +542,7 @@ static void __init palmtc_init(void)
 ? ? ? ?palmtc_ts_init();
 ? ? ? ?palmtc_nor_init();
 ? ? ? ?palmtc_lcd_init();
+ ? ? ? palmtc_leds_init();
 ?};
 
 ?MACHINE_START(PALMTC, "Palm Tungsten|C")
--
Quoted 3 lines

1.7.1

OK.

#27 lore raw

PATCH 1/11 ARM: pxa: Prepare pxa2xx pcmcia for pxa320

In reply to Marek Vasut
Quoted 14 lines · Marek Vasut

PXA320 also supports PCMCIA/CF interface. This patch generalizes register access in pxa2xx_pcmcia so the pxa320 is now supported as well.

---
?drivers/pcmcia/pxa2xx_base.c | ? 91 ++++++++++++++++++++++++++++++++---------- ?1 files changed, 70 insertions(+), 21 deletions(-)

drivers/pcmcia/pxa2xx_base.c +0 -0
index ae07b4d..3eb76c8 100644
@@ -84,6 +84,16 @@
 ?#define MCXX_ASST_SHIFT ? ? (7)

drivers/pcmcia/pxa2xx_base.c line 94

Quoted 10 lines
drivers/pcmcia/pxa2xx_base.c +8 -0
 ?#define MCXX_HOLD_SHIFT ? ? (14)
 
+#define ? ? ? ?PXA2XX_SMC_BASE ? ? ? ? (0x48000000)
+#define ? ? ? ?PXA3XX_SMC_BASE ? ? ? ? (0x4a000000)
+#define ? ? ? ?MECR_OFFSET ? ? ? ? ? ? (0x14)
+#define ? ? ? ?MCMEM_OFFSET ? ? ? ? ? ?(0x28)
+#define ? ? ? ?MCATT_OFFSET ? ? ? ? ? ?(0x30)
+#define ? ? ? ?MCIO_OFFSET ? ? ? ? ? ? (0x38)
+#define ? ? ? ?MCIO_OFFSET ? ? ? ? ? ? (0x38)
+

Since the SMC registers could be accessed by multiple entities, not only the PCMCIA but also other drivers/setup code, e.g. NOR flash timing, and considering the register offsets are almost same between PXA2xx and PXA3xx (only differs in the starting base), I'd expect the register definitions being separated into something like regs-smc.h

#define SMC_VIRT_BASE (xxxxx)
#define SMC_REG(x) (SMC_VIRT_BASE + x)

#define MECR SMC_REG(0x014)
#define MCMEM SMC_REG(0x028)
....

And possibly separating pxa_map_io() into pxa2xx_map_io() and pxa3xx_map_io(), where each maps their different SMC into the same virtual address. And use MECR/MCMEM in __raw_{read,write}l() directly instead of doing ioremap() everywhere.

See arch/arm/mach-pxa/smemc.c, there should be some common register definitions.

Quoted 6 lines
drivers/pcmcia/pxa2xx_base.c +2 -0
+static void __iomem *base;
+
 ?static inline u_int pxa2xx_mcxx_hold(u_int pcmcia_cycle_ns,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u_int mem_clk_10khz)
 ?{

drivers/pcmcia/pxa2xx_base.c static inline u_int pxa2xx_pcmcia_cmd_time(u_int mem_clk_10khz, · line 131

Quoted 8 lines
drivers/pcmcia/pxa2xx_base.c +5 -0
@@ -114,39 +124,57 @@ static inline u_int pxa2xx_pcmcia_cmd_time(u_int mem_clk_10khz,
 ? ? ? ?return (300000 * (pcmcia_mcxx_asst + 1) / mem_clk_10khz);
 ?}
 
+static inline void pxa2xx_pcmcia_set_reg( uint32_t reg, uint32_t sock,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? uint32_t val )
+{
+ ? ? ? writel(val, base + reg + (sock << 4));
+}

I'd prefer __raw_{read,write}l() variants here since it's known that this cannot be PCI accesses. And this function doesn't seem to be very essential, ain't

	__raw_writel(val, MCMEM(sock));

looks simpler and cleaner?

Quoted 57 lines
drivers/pcmcia/pxa2xx_base.c +16 -4
+
 ?static int pxa2xx_pcmcia_set_mcmem( int sock, int speed, int clock )
 ?{
- ? ? ? MCMEM(sock) = ((pxa2xx_mcxx_setup(speed, clock)
+ ? ? ? uint32_t val;
+
+ ? ? ? val = ((pxa2xx_mcxx_setup(speed, clock)
 ? ? ? ? ? ? ? ?& MCXX_SETUP_MASK) << MCXX_SETUP_SHIFT)
 ? ? ? ? ? ? ? ?| ((pxa2xx_mcxx_asst(speed, clock)
 ? ? ? ? ? ? ? ?& MCXX_ASST_MASK) << MCXX_ASST_SHIFT)
 ? ? ? ? ? ? ? ?| ((pxa2xx_mcxx_hold(speed, clock)
 ? ? ? ? ? ? ? ?& MCXX_HOLD_MASK) << MCXX_HOLD_SHIFT);
 
+ ? ? ? pxa2xx_pcmcia_set_reg(MCMEM_OFFSET, sock, val);
+
 ? ? ? ?return 0;
 ?}
 
 ?static int pxa2xx_pcmcia_set_mcio( int sock, int speed, int clock )
 ?{
- ? ? ? MCIO(sock) = ((pxa2xx_mcxx_setup(speed, clock)
+ ? ? ? uint32_t val;
+
+ ? ? ? val = ((pxa2xx_mcxx_setup(speed, clock)
 ? ? ? ? ? ? ? ?& MCXX_SETUP_MASK) << MCXX_SETUP_SHIFT)
 ? ? ? ? ? ? ? ?| ((pxa2xx_mcxx_asst(speed, clock)
 ? ? ? ? ? ? ? ?& MCXX_ASST_MASK) << MCXX_ASST_SHIFT)
 ? ? ? ? ? ? ? ?| ((pxa2xx_mcxx_hold(speed, clock)
 ? ? ? ? ? ? ? ?& MCXX_HOLD_MASK) << MCXX_HOLD_SHIFT);
 
+ ? ? ? pxa2xx_pcmcia_set_reg(MCIO_OFFSET, sock, val);
+
 ? ? ? ?return 0;
 ?}
 
 ?static int pxa2xx_pcmcia_set_mcatt( int sock, int speed, int clock )
 ?{
- ? ? ? MCATT(sock) = ((pxa2xx_mcxx_setup(speed, clock)
+ ? ? ? uint32_t val;
+
+ ? ? ? val = ((pxa2xx_mcxx_setup(speed, clock)
 ? ? ? ? ? ? ? ?& MCXX_SETUP_MASK) << MCXX_SETUP_SHIFT)
 ? ? ? ? ? ? ? ?| ((pxa2xx_mcxx_asst(speed, clock)
 ? ? ? ? ? ? ? ?& MCXX_ASST_MASK) << MCXX_ASST_SHIFT)
 ? ? ? ? ? ? ? ?| ((pxa2xx_mcxx_hold(speed, clock)
 ? ? ? ? ? ? ? ?& MCXX_HOLD_MASK) << MCXX_HOLD_SHIFT);
 
+ ? ? ? pxa2xx_pcmcia_set_reg(MCATT_OFFSET, sock, val);
+
 ? ? ? ?return 0;
 ?}
 
@@ -205,19 +233,18 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
 ?static void pxa2xx_configure_sockets(struct device *dev)
 ?{
 ? ? ? ?struct pcmcia_low_level *ops = dev->platform_data;
-
Quoted 6 lines

? ? ? ?/*
? ? ? ? * We have at least one socket, so set MECR:CIT ? ? ? ? * (Card Is There)
? ? ? ? */
- ? ? ? MECR |= MECR_CIT;
+ ? ? ? uint32_t mecr = MECR_CIT;

I hope this doesn't change the original semantics.

Quoted 32 lines

? ? ? ?/* Set MECR:NOS (Number Of Sockets) */
? ? ? ?if ((ops->first + ops->nr) > 1 ||
? ? ? ? ? ?machine_is_viper() || machine_is_arcom_zeus())
- ? ? ? ? ? ? ? MECR |= MECR_NOS;
- ? ? ? else
- ? ? ? ? ? ? ? MECR &= ~MECR_NOS;
+ ? ? ? ? ? ? ? mecr |= MECR_NOS;
+
+ ? ? ? pxa2xx_pcmcia_set_reg(MECR_OFFSET, 0, mecr); ?}

?static const char *skt_names[] = {

drivers/pcmcia/pxa2xx_base.c +11 -2
@@ -270,16 +297,34 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
 ? ? ? ?struct pcmcia_low_level *ops;
 ? ? ? ?struct skt_dev_info *sinfo;
 ? ? ? ?struct soc_pcmcia_socket *skt;
+ ? ? ? uint32_t smc_addr;
 
 ? ? ? ?ops = (struct pcmcia_low_level *)dev->dev.platform_data;
- ? ? ? if (!ops)
- ? ? ? ? ? ? ? return -ENODEV;
+ ? ? ? if (!ops) {
+ ? ? ? ? ? ? ? ret = -ENODEV;
+ ? ? ? ? ? ? ? goto err0;
+ ? ? ? }
+
+ ? ? ? if (cpu_is_pxa320() && ops->nr > 1) {
+ ? ? ? ? ? ? ? dev_err(&dev->dev, "pxa320 supports only one pcmcia slot");
+ ? ? ? ? ? ? ? ret = -EINVAL;
+ ? ? ? ? ? ? ? goto err0;
+ ? ? ? }

drivers/pcmcia/pxa2xx_base.c static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) · line 322

Quoted 10 lines
drivers/pcmcia/pxa2xx_base.c +7 -0
 
 ? ? ? ?pxa2xx_drv_pcmcia_ops(ops);
 
+ ? ? ? smc_addr = cpu_is_pxa320() ? PXA3XX_SMC_BASE : PXA2XX_SMC_BASE;
+ ? ? ? base = ioremap(smc_addr, 0x100);
+ ? ? ? if (!base) {
+ ? ? ? ? ? ? ? ret = -ENOMEM;
+ ? ? ? ? ? ? ? goto err0;
+ ? ? ? }
+

This isn't good.

Quoted 53 lines
drivers/pcmcia/pxa2xx_base.c +17 -12
 ? ? ? ?sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL);
- ? ? ? if (!sinfo)
- ? ? ? ? ? ? ? return -ENOMEM;
+ ? ? ? if (!sinfo) {
+ ? ? ? ? ? ? ? ret = -ENOMEM;
+ ? ? ? ? ? ? ? goto err1;
+ ? ? ? }
 
 ? ? ? ?sinfo->nskt = ops->nr;
 
@@ -295,18 +340,21 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
 
 ? ? ? ? ? ? ? ?ret = pxa2xx_drv_pcmcia_add_one(skt);
 ? ? ? ? ? ? ? ?if (ret)
- ? ? ? ? ? ? ? ? ? ? ? break;
+ ? ? ? ? ? ? ? ? ? ? ? goto err2;
 ? ? ? ?}
 
- ? ? ? if (ret) {
- ? ? ? ? ? ? ? while (--i >= 0)
- ? ? ? ? ? ? ? ? ? ? ? soc_pcmcia_remove_one(&sinfo->skt[i]);
- ? ? ? ? ? ? ? kfree(sinfo);
- ? ? ? } else {
- ? ? ? ? ? ? ? pxa2xx_configure_sockets(&dev->dev);
- ? ? ? ? ? ? ? dev_set_drvdata(&dev->dev, sinfo);
- ? ? ? }
+ ? ? ? pxa2xx_configure_sockets(&dev->dev);
+ ? ? ? dev_set_drvdata(&dev->dev, sinfo);
+
+ ? ? ? return 0;
 
+err2:
+ ? ? ? while (--i >= 0)
+ ? ? ? ? ? ? ? soc_pcmcia_remove_one(&sinfo->skt[i]);
+ ? ? ? kfree(sinfo);
+err1:
+ ? ? ? iounmap(base);
+err0:
 ? ? ? ?return ret;
 ?}
 
@@ -321,6 +369,7 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)
 ? ? ? ? ? ? ? ?soc_pcmcia_remove_one(&sinfo->skt[i]);
 
 ? ? ? ?kfree(sinfo);
+ ? ? ? iounmap(base);
 ? ? ? ?return 0;
 ?}
 
--

1.7.1