Skip to contentSkip to conversation

efikamx support improvements - take 3

PATCH Superseded Arnaud Patard (Rtp) 5 participants 22 messages Oct 26, 2010 – Nov 2, 2010

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover efikamx support improvements - take 3

Hi,

This patchset aims at improving current efikamx support. It adds support for :
- board id detection
- sdhc
- leds
- power button
- spi nor
- reset

I also had to fix/improve some imx51 iomux header so there are patches for iomux-mx51.h.

v3:
- use imx51_add_gpio_keys
- fix patch description for power key patch

v2:
- split iomux patch 3 into 2 patches
- reorder patches
- fix space comment
- fix Amit's comments
- decrease board id msleep

Arnaud

#2 lore raw

PATCH v3 1/10 efikamx: read board id

Hi,

Quoted 1 line

-----Original Message-----

From: [email protected] [mailto:linux-arm-kernel-

Quoted 6 lines

bounces at lists.infradead.org] On Behalf Of Arnaud Patard
Sent: Tuesday, October 26, 2010 3:07 PM
To: linux-arm-kernel at lists.infradead.org
Cc: matt at genesi-usa.com; Sascha Hauer; Arnaud Patard; Amit Kucheria
Subject: [patch v3 01/10] efikamx: read board id

Quoted 6 lines

read board id value from the GPIO3_16/17/11

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================
--- linux-2.6-submit.orig/arch/arm/mach-mx5/board-mx51_efikamx.c

2010-10-21 08:29:23.000000000 +0200
Quoted 1 line

+++ linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c

2010-10-21 08:29:46.000000000 +0200

Review line 46

Quoted 9 lines
(quoted diff) +5 -0
@@ -39,12 +39,26 @@
 
 #define	MX51_USB_PLL_DIV_24_MHZ	0x01
 
+#define EFIKAMX_PCBID0		(2*32 + 16)
+#define EFIKAMX_PCBID1		(2*32 + 17)
+#define EFIKAMX_PCBID2		(2*32 + 11)
+
+/* the pci ids pin have pull up. they're driven low according to board

id */

Review line 47

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID0	IOMUX_PAD(0x518, 0x130, 3, 0x0,   0,

PAD_CTL_PUS_100K_UP)

Review line 48

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID1	IOMUX_PAD(0x51C, 0x134, 3, 0x0,   0,

PAD_CTL_PUS_100K_UP)

Review line 49

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID2	IOMUX_PAD(0x504, 0x128, 3, 0x0,   0,

PAD_CTL_PUS_100K_UP)

Review line 50

Quoted 1 line
(quoted diff) +1 -0
+

Seems a bit wasteful to redefine the IOMUX definitions. Couldn't you just do something like this?

static struct pad_desc mx51efikamx_board_id[] = {
	MX51_PAD_NANDF_CS0__GPIO_3_16,
	MX51_PAD_NANDF_CS1__GPIO_3_17,
	MX51_PAD_NANDF_RB3__GPIO_3_11
}
Quoted 63 lines
(quoted diff) +50 -0
 static struct pad_desc mx51efikamx_pads[] = {
 	/* UART1 */
 	MX51_PAD_UART1_RXD__UART1_RXD,
 	MX51_PAD_UART1_TXD__UART1_TXD,
 	MX51_PAD_UART1_RTS__UART1_RTS,
 	MX51_PAD_UART1_CTS__UART1_CTS,
+
+	/* board id */
+	MX51_PAD_PCBID0,
+	MX51_PAD_PCBID1,
+	MX51_PAD_PCBID2,
 };
 
 /* Serial ports */
@@ -92,10 +106,62 @@
 	.flags  = MXC_EHCI_INTERNAL_PHY,
 };
 
+/*   PCBID2  PCBID1 PCBID0  STATE
+	1       1      1    ER1:rev1.1
+	1       1      0    ER2:rev1.2
+	1       0      1    ER3:rev1.3
+	1       0      0    ER4:rev1.4
+*/
+static void __init mx51_efikamx_board_id(void)
+{
+	int id;
+
+	/* things are taking time to settle */
+	msleep(150);
+
+	gpio_request(EFIKAMX_PCBID0, "pcbid0");
+	gpio_direction_input(EFIKAMX_PCBID0);
+	gpio_request(EFIKAMX_PCBID1, "pcbid1");
+	gpio_direction_input(EFIKAMX_PCBID1);
+	gpio_request(EFIKAMX_PCBID2, "pcbid2");
+	gpio_direction_input(EFIKAMX_PCBID2);
+
+	id = gpio_get_value(EFIKAMX_PCBID0);
+	id |= gpio_get_value(EFIKAMX_PCBID1) << 1;
+	id |= gpio_get_value(EFIKAMX_PCBID2) << 2;
+
+	switch (id) {
+	case 7:
+		system_rev = 0x11;
+		break;
+	case 6:
+		system_rev = 0x12;
+		break;
+	case 5:
+		system_rev = 0x13;
+		break;
+	case 4:
+		system_rev = 0x14;
+		break;
+	default:
+		system_rev = 0x10;
+		break;
+	}
+
+	if ((system_rev == 0x10)
+		|| (system_rev == 0x12)
+		|| (system_rev == 0x14)) {

Review line 163

Quoted 10 lines
(quoted diff) +6 -0
+		printk(KERN_WARNING
+			"EfikaMX: Unsupported board revision 1.%u!\n",
+			system_rev & 0xf);
+	}
+}
+
 static void __init mxc_board_init(void)
 {
 	mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads,
 					ARRAY_SIZE(mx51efikamx_pads));
	for(i=0;i < ARRAY_SIZE(mx51efikamx_board_id);i++)
                mx51efikamx_board_id [i].pad_ctrl = PAD_CTL_PUS_100K_UP;
	mxc_iomux_v3_setup_multiple_pads(mx51efikamx_board_id,

ARRAY_SIZE(mx51efikamx_board_id));

Quoted 11 lines
(quoted diff) +1 -0
+	mx51_efikamx_board_id();
 	mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
 	mxc_init_imx_uart();
 }

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Thanks,
Dinh

#3 lore raw

PATCH v3 1/10 efikamx: read board id

I agree wholeheartedly with this.

Signature · 6 lines
Matt Sealey <[email protected]>
Product Development Analyst, Genesi USA, Inc.



On Mon, Nov 1, 2010 at 10:24 AM, Nguyen Dinh-R00091
Quoted 145 lines · <[email protected]> wrote:

Hi,

Quoted 2 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org

[mailto:linux-arm-kernel-

Quoted 6 lines

bounces at lists.infradead.org] On Behalf Of Arnaud Patard
Sent: Tuesday, October 26, 2010 3:07 PM
To: linux-arm-kernel at lists.infradead.org
Cc: matt at genesi-usa.com; Sascha Hauer; Arnaud Patard; Amit Kucheria
Subject: [patch v3 01/10] efikamx: read board id

Quoted 6 lines

read board id value from the GPIO3_16/17/11

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================
--- linux-2.6-submit.orig/arch/arm/mach-mx5/board-mx51_efikamx.c

2010-10-21 08:29:23.000000000 +0200
Quoted 1 line

+++ linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c

2010-10-21 08:29:46.000000000 +0200

Review line 46

Quoted 9 lines
(quoted diff) +5 -0
@@ -39,12 +39,26 @@
 
 #define ? ? ? MX51_USB_PLL_DIV_24_MHZ 0x01
 
+#define EFIKAMX_PCBID0 ? ? ? ? ? ? ? ?(2*32 + 16)
+#define EFIKAMX_PCBID1 ? ? ? ? ? ? ? ?(2*32 + 17)
+#define EFIKAMX_PCBID2 ? ? ? ? ? ? ? ?(2*32 + 11)
+
+/* the pci ids pin have pull up. they're driven low according to board

id */

Review line 47

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID0 ? ? ? IOMUX_PAD(0x518, 0x130, 3, 0x0, ? 0,

PAD_CTL_PUS_100K_UP)

Review line 48

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID1 ? ? ? IOMUX_PAD(0x51C, 0x134, 3, 0x0, ? 0,

PAD_CTL_PUS_100K_UP)

Review line 49

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID2 ? ? ? IOMUX_PAD(0x504, 0x128, 3, 0x0, ? 0,

PAD_CTL_PUS_100K_UP)

Review line 50

Quoted 1 line
(quoted diff) +1 -0
+

Seems a bit wasteful to redefine the IOMUX definitions. Couldn't you just do something like this?

static struct pad_desc mx51efikamx_board_id[] = {
? ? ? ?MX51_PAD_NANDF_CS0__GPIO_3_16,
? ? ? ?MX51_PAD_NANDF_CS1__GPIO_3_17,
? ? ? ?MX51_PAD_NANDF_RB3__GPIO_3_11
}

Quoted 63 lines
(quoted diff) +0 -0
 static struct pad_desc mx51efikamx_pads[] = {

? ? ? /* UART1 */
? ? ? MX51_PAD_UART1_RXD__UART1_RXD,
? ? ? MX51_PAD_UART1_TXD__UART1_TXD,
? ? ? MX51_PAD_UART1_RTS__UART1_RTS,
? ? ? MX51_PAD_UART1_CTS__UART1_CTS,
+
+ ? ? ?/* board id */
+ ? ? ?MX51_PAD_PCBID0,
+ ? ? ?MX51_PAD_PCBID1,
+ ? ? ?MX51_PAD_PCBID2,
};

/* Serial ports */

(quoted diff) +45 -0
@@ -92,10 +106,62 @@
 ? ? ? .flags ?= MXC_EHCI_INTERNAL_PHY,
 };
 
+/* ? PCBID2 ?PCBID1 PCBID0 ?STATE
+ ? ? ?1 ? ? ? 1 ? ? ?1 ? ?ER1:rev1.1
+ ? ? ?1 ? ? ? 1 ? ? ?0 ? ?ER2:rev1.2
+ ? ? ?1 ? ? ? 0 ? ? ?1 ? ?ER3:rev1.3
+ ? ? ?1 ? ? ? 0 ? ? ?0 ? ?ER4:rev1.4
+*/
+static void __init mx51_efikamx_board_id(void)
+{
+ ? ? ?int id;
+
+ ? ? ?/* things are taking time to settle */
+ ? ? ?msleep(150);
+
+ ? ? ?gpio_request(EFIKAMX_PCBID0, "pcbid0");
+ ? ? ?gpio_direction_input(EFIKAMX_PCBID0);
+ ? ? ?gpio_request(EFIKAMX_PCBID1, "pcbid1");
+ ? ? ?gpio_direction_input(EFIKAMX_PCBID1);
+ ? ? ?gpio_request(EFIKAMX_PCBID2, "pcbid2");
+ ? ? ?gpio_direction_input(EFIKAMX_PCBID2);
+
+ ? ? ?id = gpio_get_value(EFIKAMX_PCBID0);
+ ? ? ?id |= gpio_get_value(EFIKAMX_PCBID1) << 1;
+ ? ? ?id |= gpio_get_value(EFIKAMX_PCBID2) << 2;
+
+ ? ? ?switch (id) {
+ ? ? ?case 7:
+ ? ? ? ? ? ? ?system_rev = 0x11;
+ ? ? ? ? ? ? ?break;
+ ? ? ?case 6:
+ ? ? ? ? ? ? ?system_rev = 0x12;
+ ? ? ? ? ? ? ?break;
+ ? ? ?case 5:
+ ? ? ? ? ? ? ?system_rev = 0x13;
+ ? ? ? ? ? ? ?break;
+ ? ? ?case 4:
+ ? ? ? ? ? ? ?system_rev = 0x14;
+ ? ? ? ? ? ? ?break;
+ ? ? ?default:
+ ? ? ? ? ? ? ?system_rev = 0x10;
+ ? ? ? ? ? ? ?break;
+ ? ? ?}
+
+ ? ? ?if ((system_rev == 0x10)
+ ? ? ? ? ? ? ?|| (system_rev == 0x12)
+ ? ? ? ? ? ? ?|| (system_rev == 0x14)) {

Review line 163

Quoted 10 lines
(quoted diff) +6 -0
+ ? ? ? ? ? ? ?printk(KERN_WARNING
+ ? ? ? ? ? ? ? ? ? ? ?"EfikaMX: Unsupported board revision 1.%u!\n",
+ ? ? ? ? ? ? ? ? ? ? ?system_rev & 0xf);
+ ? ? ?}
+}
+
 static void __init mxc_board_init(void)
 {
 ? ? ? mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARRAY_SIZE(mx51efikamx_pads));

? ? ? ?for(i=0;i < ARRAY_SIZE(mx51efikamx_board_id);i++)
? ? ? ? ? ? ? ?mx51efikamx_board_id [i].pad_ctrl = PAD_CTL_PUS_100K_UP; ? ? ? ?mxc_iomux_v3_setup_multiple_pads(mx51efikamx_board_id,

ARRAY_SIZE(mx51efikamx_board_id));

Quoted 11 lines
(quoted diff) +1 -0
+ ? ? ?mx51_efikamx_board_id();
 ? ? ? mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
 ? ? ? mxc_init_imx_uart();
 }

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Thanks,
Dinh

#4 lore raw

PATCH v3 1/10 efikamx: read board id

In reply to Nguyen Dinh-R00091

Nguyen Dinh-R00091 <[email protected]> writes:

Hi,

Quoted 32 lines

Hi,

Quoted 2 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org

[mailto:linux-arm-kernel-

Quoted 6 lines

bounces at lists.infradead.org] On Behalf Of Arnaud Patard
Sent: Tuesday, October 26, 2010 3:07 PM
To: linux-arm-kernel at lists.infradead.org
Cc: matt at genesi-usa.com; Sascha Hauer; Arnaud Patard; Amit Kucheria
Subject: [patch v3 01/10] efikamx: read board id

Quoted 6 lines

read board id value from the GPIO3_16/17/11

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================
--- linux-2.6-submit.orig/arch/arm/mach-mx5/board-mx51_efikamx.c

2010-10-21 08:29:23.000000000 +0200
Quoted 1 line

+++ linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c

2010-10-21 08:29:46.000000000 +0200

Review line 46

Quoted 9 lines
(quoted diff) +5 -0
@@ -39,12 +39,26 @@
 
 #define	MX51_USB_PLL_DIV_24_MHZ	0x01
 
+#define EFIKAMX_PCBID0		(2*32 + 16)
+#define EFIKAMX_PCBID1		(2*32 + 17)
+#define EFIKAMX_PCBID2		(2*32 + 11)
+
+/* the pci ids pin have pull up. they're driven low according to board

id */

Review line 47

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID0	IOMUX_PAD(0x518, 0x130, 3, 0x0,   0,

PAD_CTL_PUS_100K_UP)

Quoted 8 lines

Review line 48

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID1	IOMUX_PAD(0x51C, 0x134, 3, 0x0,   0,

PAD_CTL_PUS_100K_UP)

Review line 49

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID2	IOMUX_PAD(0x504, 0x128, 3, 0x0,   0,

PAD_CTL_PUS_100K_UP)

Review line 50

Quoted 1 line
(quoted diff) +1 -0
+

Seems a bit wasteful to redefine the IOMUX definitions. Couldn't you just do something like this?

With a define, you have only 1 place to look at when debugging and configuring the pad requires only to put it in the list like any other pad. With your approach, we need to change the pad control and then call mxc_iomux_v3_setup_multiple_pads() separately. It's making extra-step in the process.
Also, such a specific treatment for configuring theses GPIOs means for me more errors/bugs possible.

Arnaud

#5 lore raw

PATCH v3 1/10 efikamx: read board id

Hello,

Quoted 45 lines · Arnaud Patard

Nguyen Dinh-R00091 <[email protected]> writes:

Hi,

Quoted 32 lines

Hi,

Quoted 2 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org

[mailto:linux-arm-kernel-

Quoted 6 lines

bounces at lists.infradead.org] On Behalf Of Arnaud Patard
Sent: Tuesday, October 26, 2010 3:07 PM
To: linux-arm-kernel at lists.infradead.org
Cc: matt at genesi-usa.com; Sascha Hauer; Arnaud Patard; Amit Kucheria
Subject: [patch v3 01/10] efikamx: read board id

Quoted 6 lines

read board id value from the GPIO3_16/17/11

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================
--- linux-2.6-submit.orig/arch/arm/mach-mx5/board-mx51_efikamx.c

2010-10-21 08:29:23.000000000 +0200
Quoted 1 line

+++ linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c

2010-10-21 08:29:46.000000000 +0200

Review line 46

Quoted 9 lines
(quoted diff) +5 -0
@@ -39,12 +39,26 @@
 
 #define	MX51_USB_PLL_DIV_24_MHZ	0x01
 
+#define EFIKAMX_PCBID0		(2*32 + 16)
+#define EFIKAMX_PCBID1		(2*32 + 17)
+#define EFIKAMX_PCBID2		(2*32 + 11)
+
+/* the pci ids pin have pull up. they're driven low according to board

id */

Review line 47

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID0	IOMUX_PAD(0x518, 0x130, 3, 0x0,   0,

PAD_CTL_PUS_100K_UP)

Quoted 8 lines

Review line 48

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID1	IOMUX_PAD(0x51C, 0x134, 3, 0x0,   0,

PAD_CTL_PUS_100K_UP)

Review line 49

Quoted 1 line
(quoted diff) +1 -0
+#define MX51_PAD_PCBID2	IOMUX_PAD(0x504, 0x128, 3, 0x0,   0,

PAD_CTL_PUS_100K_UP)

Review line 50

Quoted 1 line
(quoted diff) +1 -0
+

Seems a bit wasteful to redefine the IOMUX definitions. Couldn't you just do something like this?

Quoted 7 lines

With a define, you have only 1 place to look at when debugging and configuring the pad requires only to put it in the list like any other pad. With your approach, we need to change the pad control and then call mxc_iomux_v3_setup_multiple_pads() separately. It's making extra-step in the process.
Also, such a specific treatment for configuring theses GPIOs means for me more errors/bugs possible.

I suggest to just use one of the two possibilies for now (I don't have a strong preference here). Hopefully Lothar's patch that makes the pad definitions use a bit field[1] is merged soon and then this can become:

	#define MX51_PAD_PCBID0	(MX51_PAD_GPIOXY | PAD_CTL_PUS_100K_UP)

which is pretty and easy.

Best regards
Uwe

[1] http://thread.gmane.org/gmane.linux.kernel/1052626/focus=94463

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#6 lore raw

PATCH v3 1/10 efikamx: read board id

Quoted 8 lines · Uwe Kleine-K?nig

Hello,

Quoted 2 lines

Also, such a specific treatment for configuring theses GPIOs means for me more errors/bugs possible.

I suggest to just use one of the two possibilies for now (I don't have a strong preference here). Hopefully Lothar's patch that makes the pad definitions use a bit field[1] is merged soon and then this can become:

	#define MX51_PAD_PCBID0	(MX51_PAD_GPIOXY | PAD_CTL_PUS_100K_UP)

I just opened up a imx-for-2.6.38 branch which contains Lothars patch, so give it a try.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#10 lore raw

PATCH v3 4/10 efikamx: add mmc support

Quoted 38 lines · Arnaud Patard

The efika mx is using a esdhc host for mmc support. Now that the sdhci has support for it, enable it.

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================

arch/arm/mach-mx5/board-mx51_efikamx.c +22 -0
@@ -59,6 +59,28 @@
 	MX51_PAD_PCBID0,
 	MX51_PAD_PCBID1,
 	MX51_PAD_PCBID2,
+
+	/* SD 1 */
+	MX51_PAD_SD1_CMD__SD1_CMD,
+	MX51_PAD_SD1_CLK__SD1_CLK,
+	MX51_PAD_SD1_DATA0__SD1_DATA0,
+	MX51_PAD_SD1_DATA1__SD1_DATA1,
+	MX51_PAD_SD1_DATA2__SD1_DATA2,
+	MX51_PAD_SD1_DATA3__SD1_DATA3,
+
+	/* SD 2 */
+	MX51_PAD_SD2_CMD__SD2_CMD,
+	MX51_PAD_SD2_CLK__SD2_CLK,
+	MX51_PAD_SD2_DATA0__SD2_DATA0,
+	MX51_PAD_SD2_DATA1__SD2_DATA1,
+	MX51_PAD_SD2_DATA2__SD2_DATA2,
+	MX51_PAD_SD2_DATA3__SD2_DATA3,
+
+	/* SD/MMC WP/CD */
+	MX51_PAD_GPIO_1_0__ESDHC1_CD,
+	MX51_PAD_GPIO_1_1__ESDHC1_WP,
+	MX51_PAD_GPIO_1_7__ESDHC2_WP,
+	MX51_PAD_GPIO_1_8__ESDHC2_CD,
 };
 
 /* Serial ports */

arch/arm/mach-mx5/board-mx51_efikamx.c line 191

Quoted 6 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +3 -0
@@ -164,6 +186,11 @@
 	mx51_efikamx_board_id();
 	mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
 	mxc_init_imx_uart();
+	imx51_add_esdhc(0, NULL);
+
+	/* on < 1.2 boards the 2 SD controller are used */

s/the 2/both/ ?

Quoted 10 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +2 -0
+	if (system_rev < 0x12)
+		imx51_add_esdhc(1, NULL);
 }
 
 static void __init mx51_efikamx_timer_init(void)

Index: linux-2.6-submit/arch/arm/mach-mx5/Kconfig
===================================================================

arch/arm/mach-mx5/Kconfig line 83

Quoted 4 lines
arch/arm/mach-mx5/Kconfig +1 -0
@@ -80,6 +80,7 @@
 config MACH_MX51_EFIKAMX
 	bool "Support MX51 Genesi Efika MX nettop"
 	select IMX_HAVE_PLATFORM_IMX_UART
+	select IMX_HAVE_PLATFORM_ESDHC

Can you keep these flags sorted alphabetically please?

Quoted 11 lines
arch/arm/mach-mx5/Kconfig +0 -0
 	help
 	  Include support for Genesi Efika MX nettop. This includes specific
 	  configurations for the board and its peripherals.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#14 lore raw

PATCH v3 7/10 efikamx: add support for power key

Quoted 10 lines · Arnaud Patard

This patch adds support for power key button of the efika mx. It's connected on GPIO 2 31.

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================

arch/arm/mach-mx5/board-mx51_efikamx.c line 22

Quoted 4 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +1 -0
@@ -19,6 +19,8 @@
 #include <linux/i2c.h>
 #include <linux/gpio.h>
 #include <linux/leds.h>
+#include <linux/input.h>

Do you really need linux/input.h?

arch/arm/mach-mx5/board-mx51_efikamx.c line 23

Quoted 1 line
arch/arm/mach-mx5/board-mx51_efikamx.c +1 -0
+#include <linux/gpio_keys.h>

this is included by devices-common.h (which is included by devices-imx51.h). So you can drop this.

Quoted 28 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +6 -0
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/fsl_devices.h>
@@ -48,10 +50,13 @@
 #define EFIKAMX_GREEN_LED	(2*32 + 14)
 #define EFIKAMX_RED_LED		(2*32 + 15)
 
+#define EFIKAMX_POWER_KEY	(1*32 + 31)
+
 /* the pci ids pin have pull up. they're driven low according to board id */
 #define MX51_PAD_PCBID0	IOMUX_PAD(0x518, 0x130, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
 #define MX51_PAD_PCBID1	IOMUX_PAD(0x51C, 0x134, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
 #define MX51_PAD_PCBID2	IOMUX_PAD(0x504, 0x128, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
+#define MX51_PAD_PWRKEY	IOMUX_PAD(0x48c, 0x0f8, 1, 0x0,   0, PAD_CTL_PUS_100K_UP | PAD_CTL_PKE)
 
 static struct pad_desc mx51efikamx_pads[] = {
 	/* UART1 */
@@ -91,6 +96,9 @@
 	MX51_PAD_CSI1_D9__GPIO_3_13,
 	MX51_PAD_CSI1_VSYNC__GPIO_3_14,
 	MX51_PAD_CSI1_HSYNC__GPIO_3_15,
+
+	/* power key */
+	MX51_PAD_PWRKEY,
 };
 
 /* Serial ports */

arch/arm/mach-mx5/board-mx51_efikamx.c line 231

Quoted 4 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +1 -0
@@ -220,6 +228,22 @@
 	},
 };
 
+static struct gpio_keys_button mx51_efikamx_powerkey[] = {

this should be const and __initconst

arch/arm/mach-mx5/board-mx51_efikamx.c line 240

Quoted 9 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +9 -0
+	{
+		.code   = KEY_POWER,
+		.gpio   = EFIKAMX_POWER_KEY,
+		.type   = EV_PWR,
+		.desc   = "Power Button (CM)",
+		.wakeup = 1,
+		.debounce_interval = 10, /* ms */
+	},
+};

I'd prefer s/ *=/ =/ here. The equal signs are not aligned anyhow because of the last line.

Quoted 25 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +7 -0
+
+static struct gpio_keys_platform_data mx51_efikamx_powerkey_data = {
+	.buttons = mx51_efikamx_powerkey,
+	.nbuttons = ARRAY_SIZE(mx51_efikamx_powerkey),
+};
+
 static void __init mxc_board_init(void)
 {
 	mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads,
@@ -236,6 +260,7 @@
 	}
 
 	platform_device_register(&mx51_efikamx_leds_device);
+	imx51_add_gpio_keys(&mx51_efikamx_powerkey_data);
 }
 
 static void __init mx51_efikamx_timer_init(void)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#15 lore raw

PATCH v3 7/10 efikamx: add support for power key

Quoted 6 lines · Uwe Kleine-K?nig
Quoted 5 lines · Arnaud Patard

This patch adds support for power key button of the efika mx. It's connected on GPIO 2 31.

Quoted 11 lines

arch/arm/mach-mx5/board-mx51_efikamx.c line 22

Quoted 9 lines

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================

arch/arm/mach-mx5/board-mx51_efikamx.c +1 -0
@@ -19,6 +19,8 @@
 #include <linux/i2c.h>
 #include <linux/gpio.h>
 #include <linux/leds.h>
+#include <linux/input.h>

Do you really need linux/input.h?

You need it if you want to have KEY_POWER and EV_POWER definitions

Quoted 30 lines

arch/arm/mach-mx5/board-mx51_efikamx.c line 23

Quoted 1 line
arch/arm/mach-mx5/board-mx51_efikamx.c +1 -0
+#include <linux/gpio_keys.h>

this is included by devices-common.h (which is included by devices-imx51.h). So you can drop this.

Quoted 26 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +6 -0
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/fsl_devices.h>
@@ -48,10 +50,13 @@
 #define EFIKAMX_GREEN_LED	(2*32 + 14)
 #define EFIKAMX_RED_LED		(2*32 + 15)
 
+#define EFIKAMX_POWER_KEY	(1*32 + 31)
+
 /* the pci ids pin have pull up. they're driven low according to board id */
 #define MX51_PAD_PCBID0	IOMUX_PAD(0x518, 0x130, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
 #define MX51_PAD_PCBID1	IOMUX_PAD(0x51C, 0x134, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
 #define MX51_PAD_PCBID2	IOMUX_PAD(0x504, 0x128, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
+#define MX51_PAD_PWRKEY	IOMUX_PAD(0x48c, 0x0f8, 1, 0x0,   0, PAD_CTL_PUS_100K_UP | PAD_CTL_PKE)
 
 static struct pad_desc mx51efikamx_pads[] = {
 	/* UART1 */
@@ -91,6 +96,9 @@
 	MX51_PAD_CSI1_D9__GPIO_3_13,
 	MX51_PAD_CSI1_VSYNC__GPIO_3_14,
 	MX51_PAD_CSI1_HSYNC__GPIO_3_15,
+
+	/* power key */
+	MX51_PAD_PWRKEY,
 };
 
Quoted 7 lines

arch/arm/mach-mx5/board-mx51_efikamx.c line 231

Quoted 6 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +1 -0
 /* Serial ports */
@@ -220,6 +228,22 @@
 	},
 };
 
+static struct gpio_keys_button mx51_efikamx_powerkey[] = {

this should be const and __initconst

I guess you meant this for the gpio_keys_platform_data struct instead of this one ?

Quoted 13 lines

arch/arm/mach-mx5/board-mx51_efikamx.c line 240

Quoted 10 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +9 -0
+	{
+		.code   = KEY_POWER,
+		.gpio   = EFIKAMX_POWER_KEY,
+		.type   = EV_PWR,
+		.desc   = "Power Button (CM)",
+		.wakeup = 1,
+		.debounce_interval = 10, /* ms */
+	},
+};

I'd prefer s/ *=/ =/ here. The equal signs are not aligned anyhow because of the last line.

I find this more readable but I've no strong pref. Will change.

Arnaud

#16 lore raw

PATCH v3 7/10 efikamx: add support for power key

Quoted 20 lines · Arnaud Patard
Quoted 6 lines · Uwe Kleine-K?nig
Quoted 5 lines · Arnaud Patard

This patch adds support for power key button of the efika mx. It's connected on GPIO 2 31.

Quoted 11 lines

arch/arm/mach-mx5/board-mx51_efikamx.c line 22

Quoted 9 lines

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================

arch/arm/mach-mx5/board-mx51_efikamx.c +1 -0
@@ -19,6 +19,8 @@
 #include <linux/i2c.h>
 #include <linux/gpio.h>
 #include <linux/leds.h>
+#include <linux/input.h>

Do you really need linux/input.h?

Quoted 1 line

You need it if you want to have KEY_POWER and EV_POWER definitions

ah, I see.

Quoted 35 lines
Quoted 35 lines

arch/arm/mach-mx5/board-mx51_efikamx.c line 23

Quoted 1 line
arch/arm/mach-mx5/board-mx51_efikamx.c +1 -0
+#include <linux/gpio_keys.h>

this is included by devices-common.h (which is included by devices-imx51.h). So you can drop this.

Quoted 31 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +6 -0
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/fsl_devices.h>
@@ -48,10 +50,13 @@
 #define EFIKAMX_GREEN_LED	(2*32 + 14)
 #define EFIKAMX_RED_LED		(2*32 + 15)
 
+#define EFIKAMX_POWER_KEY	(1*32 + 31)
+
 /* the pci ids pin have pull up. they're driven low according to board id */
 #define MX51_PAD_PCBID0	IOMUX_PAD(0x518, 0x130, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
 #define MX51_PAD_PCBID1	IOMUX_PAD(0x51C, 0x134, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
 #define MX51_PAD_PCBID2	IOMUX_PAD(0x504, 0x128, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
+#define MX51_PAD_PWRKEY	IOMUX_PAD(0x48c, 0x0f8, 1, 0x0,   0, PAD_CTL_PUS_100K_UP | PAD_CTL_PKE)
 
 static struct pad_desc mx51efikamx_pads[] = {
 	/* UART1 */
@@ -91,6 +96,9 @@
 	MX51_PAD_CSI1_D9__GPIO_3_13,
 	MX51_PAD_CSI1_VSYNC__GPIO_3_14,
 	MX51_PAD_CSI1_HSYNC__GPIO_3_15,
+
+	/* power key */
+	MX51_PAD_PWRKEY,
 };
 
 /* Serial ports */
@@ -220,6 +228,22 @@
 	},
 };
 
Quoted 5 lines
Quoted 2 lines

arch/arm/mach-mx5/board-mx51_efikamx.c line 231

Quoted 1 line
arch/arm/mach-mx5/board-mx51_efikamx.c +1 -0
+static struct gpio_keys_button mx51_efikamx_powerkey[] = {

this should be const and __initconst

I guess you meant this for the gpio_keys_platform_data struct instead of this one ?

oh, you're right. Conceptually mx51_efikamx_powerkey should be const, but probably marking it accordingly generates a compiler warning.

I assume there are no other keys on your machine? If there are, you might want to rename mx51_efikamx_powerkey_data and mx51_efikamx_powerkey to something that doesn't include "power".

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#20 lore raw

PATCH v3 10/10 efikamx: add reset

Quoted 9 lines · Arnaud Patard

The efikamx board is using a gpio to reset the board so add support for it

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================

arch/arm/mach-mx5/board-mx51_efikamx.c line 61

Quoted 5 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +2 -0
@@ -57,6 +57,9 @@
 #define EFIKAMX_SPI_CS0		(3*32 + 24)
 #define EFIKAMX_SPI_CS1		(3*32 + 25)
 
+#define EFIKAMX_RESET1_1	(2*32 + 2)
+#define EFIKAMX_RESET		(0*32 + 4)

Maybe add a comment here about the difference. When I first read that it looked strange.

Quoted 31 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +13 -0
+
 /* the pci ids pin have pull up. they're driven low according to board id */
 #define MX51_PAD_PCBID0	IOMUX_PAD(0x518, 0x130, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
 #define MX51_PAD_PCBID1	IOMUX_PAD(0x51C, 0x134, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
@@ -112,6 +115,10 @@
 	MX51_PAD_CSPI1_SS1__GPIO_4_25,
 	MX51_PAD_CSPI1_RDY__ECSPI1_RDY,
 	MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
+
+	/* reset */
+	MX51_PAD_DI1_PIN13__GPIO_3_2,
+	MX51_PAD_GPIO_1_4__GPIO_1_4,
 };
 
 /* Serial ports */
@@ -306,6 +313,14 @@
 	.num_chipselect = ARRAY_SIZE(mx51_efikamx_spi_cs),
 };
 
+void mx51_efikamx_reset(void)
+{
+	if (system_rev == 0x11)
+		gpio_direction_output(EFIKAMX_RESET1_1, 0);
+	else
+		gpio_direction_output(EFIKAMX_RESET, 0);
+}
+
 static void __init mxc_board_init(void)
 {
 	mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads,

arch/arm/mach-mx5/board-mx51_efikamx.c line 349

Quoted 8 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +5 -0
@@ -327,6 +342,11 @@
 	spi_register_board_info(mx51_efikamx_spi_board_info,
 		ARRAY_SIZE(mx51_efikamx_spi_board_info));
 	imx51_add_ecspi(0, &mx51_efikamx_spi_pdata);
+
+	if (system_rev == 0x11)
+		gpio_request(EFIKAMX_RESET1_1, "reset");
+	else
+		gpio_request(EFIKAMX_RESET, "reset");

gpio_direction_output(..., 1)?

Quoted 27 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +0 -0
 }
 
 static void __init mx51_efikamx_timer_init(void)

Index: linux-2.6-submit/arch/arm/plat-mxc/include/mach/common.h
===================================================================

arch/arm/plat-mxc/include/mach/common.h +1 -1
@@ -50,5 +50,5 @@
 extern void mxc91231_power_off(void);
 extern void mxc91231_arch_reset(int, const char *);
 extern void mxc91231_prepare_idle(void);
-
+extern void mx51_efikamx_reset(void);
 #endif

Index: linux-2.6-submit/arch/arm/plat-mxc/system.c
===================================================================

arch/arm/plat-mxc/system.c +1 -0
@@ -26,6 +26,7 @@
 #include <mach/common.h>
 #include <asm/proc-fns.h>
 #include <asm/system.h>
+#include <asm/mach-types.h>
 
 static void __iomem *wdog_base;
 

arch/arm/plat-mxc/system.c line 49

Quoted 7 lines
arch/arm/plat-mxc/system.c +4 -0
@@ -42,6 +43,11 @@
 		return;
 	}
 #endif
+#ifdef CONFIG_MACH_MX51_EFIKAMX
+	if (machine_is_mx51_efikamx())
+		mx51_efikamx_reset();
+#endif

Depending on how fast the reset occurs mx51_efikamx_reset returns and the processor continues to execute the watchdog reset. Is this intended?

arch/arm/plat-mxc/system.c line 53

Quoted 4 lines
arch/arm/plat-mxc/system.c +1 -0
+
 	if (cpu_is_mx1()) {
 		wcr_enable = (1 << 0);
 	} else {

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#21 lore raw

PATCH v3 10/10 efikamx: add reset

Quoted 13 lines · Uwe Kleine-K?nig
Quoted 12 lines · Arnaud Patard

The efikamx board is using a gpio to reset the board so add support for it

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================

arch/arm/mach-mx5/board-mx51_efikamx.c +0 -0
@@ -57,6 +57,9 @@
 #define EFIKAMX_SPI_CS0		(3*32 + 24)
 #define EFIKAMX_SPI_CS1		(3*32 + 25)
 
Quoted 4 lines

arch/arm/mach-mx5/board-mx51_efikamx.c line 61

Quoted 2 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +2 -0
+#define EFIKAMX_RESET1_1	(2*32 + 2)
+#define EFIKAMX_RESET		(0*32 + 4)

Maybe add a comment here about the difference. When I first read that it looked strange.

ok

Quoted 33 lines
Quoted 33 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +13 -0
+
 /* the pci ids pin have pull up. they're driven low according to board id */
 #define MX51_PAD_PCBID0	IOMUX_PAD(0x518, 0x130, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
 #define MX51_PAD_PCBID1	IOMUX_PAD(0x51C, 0x134, 3, 0x0,   0, PAD_CTL_PUS_100K_UP)
@@ -112,6 +115,10 @@
 	MX51_PAD_CSPI1_SS1__GPIO_4_25,
 	MX51_PAD_CSPI1_RDY__ECSPI1_RDY,
 	MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
+
+	/* reset */
+	MX51_PAD_DI1_PIN13__GPIO_3_2,
+	MX51_PAD_GPIO_1_4__GPIO_1_4,
 };
 
 /* Serial ports */
@@ -306,6 +313,14 @@
 	.num_chipselect = ARRAY_SIZE(mx51_efikamx_spi_cs),
 };
 
+void mx51_efikamx_reset(void)
+{
+	if (system_rev == 0x11)
+		gpio_direction_output(EFIKAMX_RESET1_1, 0);
+	else
+		gpio_direction_output(EFIKAMX_RESET, 0);
+}
+
 static void __init mxc_board_init(void)
 {
 	mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads,
@@ -327,6 +342,11 @@
 	spi_register_board_info(mx51_efikamx_spi_board_info,
Quoted 8 lines

arch/arm/mach-mx5/board-mx51_efikamx.c line 349

Quoted 7 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +5 -0
 		ARRAY_SIZE(mx51_efikamx_spi_board_info));
 	imx51_add_ecspi(0, &mx51_efikamx_spi_pdata);
+
+	if (system_rev == 0x11)
+		gpio_request(EFIKAMX_RESET1_1, "reset");
+	else
+		gpio_request(EFIKAMX_RESET, "reset");

gpio_direction_output(..., 1)?

default setting is fine but adding this will not harm. Will change.

Quoted 27 lines
Quoted 27 lines
arch/arm/mach-mx5/board-mx51_efikamx.c +0 -0
 }
 
 static void __init mx51_efikamx_timer_init(void)

Index: linux-2.6-submit/arch/arm/plat-mxc/include/mach/common.h
===================================================================

arch/arm/plat-mxc/include/mach/common.h +1 -1
@@ -50,5 +50,5 @@
 extern void mxc91231_power_off(void);
 extern void mxc91231_arch_reset(int, const char *);
 extern void mxc91231_prepare_idle(void);
-
+extern void mx51_efikamx_reset(void);
 #endif

Index: linux-2.6-submit/arch/arm/plat-mxc/system.c
===================================================================

arch/arm/plat-mxc/system.c +1 -0
@@ -26,6 +26,7 @@
 #include <mach/common.h>
 #include <asm/proc-fns.h>
 #include <asm/system.h>
+#include <asm/mach-types.h>
 
 static void __iomem *wdog_base;
 
Quoted 11 lines

arch/arm/plat-mxc/system.c line 49

Quoted 8 lines
arch/arm/plat-mxc/system.c +4 -0
@@ -42,6 +43,11 @@
 		return;
 	}
 #endif
+#ifdef CONFIG_MACH_MX51_EFIKAMX
+	if (machine_is_mx51_efikamx())
+		mx51_efikamx_reset();
+#endif

Depending on how fast the reset occurs mx51_efikamx_reset returns and the processor continues to execute the watchdog reset. Is this intended?

hmm... sticking to the original code, a return is needed. As the system was rebooting fine, I didn't notice that. I'm going to test if it's still working without the watchdog reset and update my patch accordingly.

Arnaud