Skip to contentSkip to conversation

MXC: mach-mx31_3ds: Patch series that enable the support for Freescale i.MX31 3-Stack development board.

PATCH New Alberto Panizzo 4 participants 18 messages Mar 23, 2010 – May 17, 2010

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

cover MXC: mach-mx31_3ds: Patch series that enable the support for Freescale i.MX31 3-Stack development board.

This series build the mainline architecture support for the Freescale i.MX31 3-Stack development board since all the drivers needed are merged in mainline from the first 2.6.34 release candidate.

[PATCH 1/8] MXC: mach-mx31_3ds: Update variable names over recent mach name modification.

[PATCH 2/8] MXC: mach-mx31_3ds: Add support for on board NAND Flash.

[PATCH 3/8] MXC: mach-mx31_3ds: Add SPI1 device support.

[PATCH 4/8] MXC: mach-mx31_3ds: add support for freescale mc13783 power management device.

[PATCH 5/8] MXC: mach-mx31_3ds: Add support for SD card slot in the personality board.

[PATCH 6/8] MXC: mach-mx31_3ds: Add support for framebuffer and lcd.

[PATCH 7/8] MXC: mach-mx31_3ds: Add support for the keypad.

[PATCH 8/8] MXC: mach-mx31_3ds: enable mc13783 touchscreen interface.

Comments and/or suggestion are welcome.

Best Regards,

Signature · 4 lines
Alberto!

        Be Persistent!
                - Greg Kroah-Hartman (FOSDEM 2010)
#1 lore raw

cover MXC: mach-mx31_3ds: Patch series that enable the support for Freescale i.MX31 3-Stack development board.

Quoted 1 line

From c6d0b6f134ea1d78f782a2057f17315e6fd6b5d1 Mon Sep 17 00:00:00 2001

From: Alberto Panizzo <[email protected]>
Date: Tue, 19 Jan 2010 16:43:45 +0100
Subject: [PATCH 1/8] MXC: mach-mx31_3ds: Update variable names over recent mach name modification.

---
 arch/arm/mach-mx3/mach-mx31_3ds.c               |   38 +++++++-------
 arch/arm/plat-mxc/include/mach/board-mx31_3ds.h |   59 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/board-mx31pdk.h  |   59 -----------------------
 3 files changed, 78 insertions(+), 78 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/board-mx31_3ds.h
 delete mode 100644 arch/arm/plat-mxc/include/mach/board-mx31pdk.h
arch/arm/mach-mx3/mach-mx31_3ds.c +19 -19
index b88c18a..4a94c3c 100644
@@ -31,20 +31,20 @@
 #include <asm/memory.h>
 #include <asm/mach/map.h>
 #include <mach/common.h>
-#include <mach/board-mx31pdk.h>
+#include <mach/board-mx31_3ds.h>
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
 #include "devices.h"
 
 /*!
- * @file mx31pdk.c
+ * @file mx31_3ds.c
  *
  * @brief This file contains the board-specific initialization routines.
  *
  * @ingroup System
  */
 
-static int mx31pdk_pins[] = {
+static int mx31_3ds_pins[] = {
 	/* UART1 */
 	MX31_PIN_CTS1__CTS1,
 	MX31_PIN_RTS1__RTS1,
@@ -95,7 +95,7 @@ static struct platform_device smsc911x_device = {
  * LEDs, switches, interrupts for Ethernet.
  */
 
-static void mx31pdk_expio_irq_handler(uint32_t irq, struct irq_desc *desc)
+static void mx31_3ds_expio_irq_handler(uint32_t irq, struct irq_desc *desc)
 {
 	uint32_t imr_val;
 	uint32_t int_valid;
@@ -163,7 +163,7 @@ static struct irq_chip expio_irq_chip = {
 	.unmask = expio_unmask_irq,
 };
 
-static int __init mx31pdk_init_expio(void)
+static int __init mx31_3ds_init_expio(void)
 {
 	int i;
 	int ret;
@@ -176,7 +176,7 @@ static int __init mx31pdk_init_expio(void)
 		return -ENODEV;
 	}
 
-	pr_info("i.MX31PDK Debug board detected, rev = 0x%04X\n",
+	pr_info("i.MX31 3DS Debug board detected, rev = 0x%04X\n",
 		__raw_readw(CPLD_CODE_VER_REG));
 
 	/*
@@ -201,7 +201,7 @@ static int __init mx31pdk_init_expio(void)
 		set_irq_flags(i, IRQF_VALID);
 	}
 	set_irq_type(EXPIO_PARENT_INT, IRQ_TYPE_LEVEL_LOW);
-	set_irq_chained_handler(EXPIO_PARENT_INT, mx31pdk_expio_irq_handler);
+	set_irq_chained_handler(EXPIO_PARENT_INT, mx31_3ds_expio_irq_handler);
 
 	return 0;
 }
@@ -209,7 +209,7 @@ static int __init mx31pdk_init_expio(void)
 /*
  * This structure defines the MX31 memory map.
  */
-static struct map_desc mx31pdk_io_desc[] __initdata = {
+static struct map_desc mx31_3ds_io_desc[] __initdata = {
 	{
 		.virtual = MX31_CS5_BASE_ADDR_VIRT,
 		.pfn = __phys_to_pfn(MX31_CS5_BASE_ADDR),
@@ -221,10 +221,10 @@ static struct map_desc mx31pdk_io_desc[] __initdata = {
 /*
  * Set up static virtual mappings.
  */
-static void __init mx31pdk_map_io(void)
+static void __init mx31_3ds_map_io(void)
 {
 	mx31_map_io();
-	iotable_init(mx31pdk_io_desc, ARRAY_SIZE(mx31pdk_io_desc));
+	iotable_init(mx31_3ds_io_desc, ARRAY_SIZE(mx31_3ds_io_desc));
 }
 
 /*!
@@ -232,35 +232,35 @@ static void __init mx31pdk_map_io(void)
  */
 static void __init mxc_board_init(void)
 {
-	mxc_iomux_setup_multiple_pins(mx31pdk_pins, ARRAY_SIZE(mx31pdk_pins),
-				      "mx31pdk");
+	mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins),
+				      "mx31_3ds");
 
 	mxc_register_device(&mxc_uart_device0, &uart_pdata);
 
-	if (!mx31pdk_init_expio())
+	if (!mx31_3ds_init_expio())
 		platform_device_register(&smsc911x_device);
 }
 
-static void __init mx31pdk_timer_init(void)
+static void __init mx31_3ds_timer_init(void)
 {
 	mx31_clocks_init(26000000);
 }
 
-static struct sys_timer mx31pdk_timer = {
-	.init	= mx31pdk_timer_init,
+static struct sys_timer mx31_3ds_timer = {
+	.init	= mx31_3ds_timer_init,
 };
 
 /*
  * The following uses standard kernel macros defined in arch.h in order to
- * initialize __mach_desc_MX31PDK data structure.
+ * initialize __mach_desc_MX31_3DS data structure.
  */
 MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)")
 	/* Maintainer: Freescale Semiconductor, Inc. */
 	.phys_io	= MX31_AIPS1_BASE_ADDR,
 	.io_pg_offst	= (MX31_AIPS1_BASE_ADDR_VIRT >> 18) & 0xfffc,
 	.boot_params    = MX3x_PHYS_OFFSET + 0x100,
-	.map_io         = mx31pdk_map_io,
+	.map_io         = mx31_3ds_map_io,
 	.init_irq       = mx31_init_irq,
 	.init_machine   = mxc_board_init,
-	.timer          = &mx31pdk_timer,
+	.timer          = &mx31_3ds_timer,
 MACHINE_END
arch/arm/plat-mxc/include/mach/board-mx31_3ds.h new file +59 -0

59 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/board-mx31pdk.h deleted +0 -59

59 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#2 lore raw

cover MXC: mach-mx31_3ds: Patch series that enable the support for Freescale i.MX31 3-Stack development board.

junk

#3 lore raw

PATCH 1/8 MXC: mach-mx31_3ds: Update variable names over recent mach name modification.

In reply to Alberto Panizzo
---
 arch/arm/mach-mx3/mach-mx31_3ds.c               |   38 +++++++-------
 arch/arm/plat-mxc/include/mach/board-mx31_3ds.h |   59 +++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/board-mx31pdk.h  |   59 -----------------------
 3 files changed, 78 insertions(+), 78 deletions(-)
 create mode 100644 arch/arm/plat-mxc/include/mach/board-mx31_3ds.h
 delete mode 100644 arch/arm/plat-mxc/include/mach/board-mx31pdk.h
arch/arm/mach-mx3/mach-mx31_3ds.c +19 -19
index b88c18a..4a94c3c 100644
@@ -31,20 +31,20 @@
 #include <asm/memory.h>
 #include <asm/mach/map.h>
 #include <mach/common.h>
-#include <mach/board-mx31pdk.h>
+#include <mach/board-mx31_3ds.h>
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
 #include "devices.h"
 
 /*!
- * @file mx31pdk.c
+ * @file mx31_3ds.c
  *
  * @brief This file contains the board-specific initialization routines.
  *
  * @ingroup System
  */
 
-static int mx31pdk_pins[] = {
+static int mx31_3ds_pins[] = {
 	/* UART1 */
 	MX31_PIN_CTS1__CTS1,
 	MX31_PIN_RTS1__RTS1,
@@ -95,7 +95,7 @@ static struct platform_device smsc911x_device = {
  * LEDs, switches, interrupts for Ethernet.
  */
 
-static void mx31pdk_expio_irq_handler(uint32_t irq, struct irq_desc *desc)
+static void mx31_3ds_expio_irq_handler(uint32_t irq, struct irq_desc *desc)
 {
 	uint32_t imr_val;
 	uint32_t int_valid;
@@ -163,7 +163,7 @@ static struct irq_chip expio_irq_chip = {
 	.unmask = expio_unmask_irq,
 };
 
-static int __init mx31pdk_init_expio(void)
+static int __init mx31_3ds_init_expio(void)
 {
 	int i;
 	int ret;
@@ -176,7 +176,7 @@ static int __init mx31pdk_init_expio(void)
 		return -ENODEV;
 	}
 
-	pr_info("i.MX31PDK Debug board detected, rev = 0x%04X\n",
+	pr_info("i.MX31 3DS Debug board detected, rev = 0x%04X\n",
 		__raw_readw(CPLD_CODE_VER_REG));
 
 	/*
@@ -201,7 +201,7 @@ static int __init mx31pdk_init_expio(void)
 		set_irq_flags(i, IRQF_VALID);
 	}
 	set_irq_type(EXPIO_PARENT_INT, IRQ_TYPE_LEVEL_LOW);
-	set_irq_chained_handler(EXPIO_PARENT_INT, mx31pdk_expio_irq_handler);
+	set_irq_chained_handler(EXPIO_PARENT_INT, mx31_3ds_expio_irq_handler);
 
 	return 0;
 }
@@ -209,7 +209,7 @@ static int __init mx31pdk_init_expio(void)
 /*
  * This structure defines the MX31 memory map.
  */
-static struct map_desc mx31pdk_io_desc[] __initdata = {
+static struct map_desc mx31_3ds_io_desc[] __initdata = {
 	{
 		.virtual = MX31_CS5_BASE_ADDR_VIRT,
 		.pfn = __phys_to_pfn(MX31_CS5_BASE_ADDR),
@@ -221,10 +221,10 @@ static struct map_desc mx31pdk_io_desc[] __initdata = {
 /*
  * Set up static virtual mappings.
  */
-static void __init mx31pdk_map_io(void)
+static void __init mx31_3ds_map_io(void)
 {
 	mx31_map_io();
-	iotable_init(mx31pdk_io_desc, ARRAY_SIZE(mx31pdk_io_desc));
+	iotable_init(mx31_3ds_io_desc, ARRAY_SIZE(mx31_3ds_io_desc));
 }
 
 /*!
@@ -232,35 +232,35 @@ static void __init mx31pdk_map_io(void)
  */
 static void __init mxc_board_init(void)
 {
-	mxc_iomux_setup_multiple_pins(mx31pdk_pins, ARRAY_SIZE(mx31pdk_pins),
-				      "mx31pdk");
+	mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins),
+				      "mx31_3ds");
 
 	mxc_register_device(&mxc_uart_device0, &uart_pdata);
 
-	if (!mx31pdk_init_expio())
+	if (!mx31_3ds_init_expio())
 		platform_device_register(&smsc911x_device);
 }
 
-static void __init mx31pdk_timer_init(void)
+static void __init mx31_3ds_timer_init(void)
 {
 	mx31_clocks_init(26000000);
 }
 
-static struct sys_timer mx31pdk_timer = {
-	.init	= mx31pdk_timer_init,
+static struct sys_timer mx31_3ds_timer = {
+	.init	= mx31_3ds_timer_init,
 };
 
 /*
  * The following uses standard kernel macros defined in arch.h in order to
- * initialize __mach_desc_MX31PDK data structure.
+ * initialize __mach_desc_MX31_3DS data structure.
  */
 MACHINE_START(MX31_3DS, "Freescale MX31PDK (3DS)")
 	/* Maintainer: Freescale Semiconductor, Inc. */
 	.phys_io	= MX31_AIPS1_BASE_ADDR,
 	.io_pg_offst	= (MX31_AIPS1_BASE_ADDR_VIRT >> 18) & 0xfffc,
 	.boot_params    = MX3x_PHYS_OFFSET + 0x100,
-	.map_io         = mx31pdk_map_io,
+	.map_io         = mx31_3ds_map_io,
 	.init_irq       = mx31_init_irq,
 	.init_machine   = mxc_board_init,
-	.timer          = &mx31pdk_timer,
+	.timer          = &mx31_3ds_timer,
 MACHINE_END
arch/arm/plat-mxc/include/mach/board-mx31_3ds.h new file +59 -0

59 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/board-mx31pdk.h deleted +0 -59

59 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#4 lore raw

PATCH 2/8 MXC: mach-mx31_3ds: Add support for on board NAND Flash.

Since the using of Bad Block Table is not constantly a good behave I had made it configurable.

---
 arch/arm/mach-mx3/Kconfig         |    9 +++++++++
 arch/arm/mach-mx3/mach-mx31_3ds.c |   13 +++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/Kconfig +9 -0
index 3872af1..9a2911e 100644
@@ -62,6 +62,15 @@ config MACH_MX31_3DS
 	  Include support for MX31PDK (3DS) platform. This includes specific
 	  configurations for the board and its peripherals.
 
+config MACH_MX31_3DS_MXC_NAND_USE_BBT
+	bool "Make the MXC NAND driver use the in flash Bad Block Table"
+	depends on MACH_MX31_3DS
+	depends on MTD_NAND_MXC
+	help
+	  Enable this if you want that the MXC NAND driver uses the in flash
+	  Bad Block Table to know what blocks are bad instead of scanning the
+	  entire flash looking for bad block markers.
+
 config MACH_MX31MOBOARD
 	bool "Support mx31moboard platforms (EPFL Mobots group)"
 	select ARCH_MX31
arch/arm/mach-mx3/mach-mx31_3ds.c +13 -0
index 4a94c3c..bf1f54a 100644
@@ -34,6 +34,7 @@
 #include <mach/board-mx31_3ds.h>
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
+#include <mach/mxc_nand.h>
 #include "devices.h"
 
 /*!
@@ -53,6 +54,17 @@ static int mx31_3ds_pins[] = {
 	IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO),
 };
 
+/*
+ * NAND Flash
+ */
+static struct mxc_nand_platform_data imx31_3ds_nand_flash_pdata = {
+	.width		= 1,
+	.hw_ecc		= 1,
+#ifdef MACH_MX31_3DS_MXC_NAND_USE_BBT
+	.flash_bbt	= 1,
+#endif
+};
+
 static struct imxuart_platform_data uart_pdata = {
 	.flags = IMXUART_HAVE_RTSCTS,
 };
@@ -236,6 +248,7 @@ static void __init mxc_board_init(void)
 				      "mx31_3ds");
 
 	mxc_register_device(&mxc_uart_device0, &uart_pdata);
+	mxc_register_device(&mxc_nand_device, &imx31_3ds_nand_flash_pdata);
 
 	if (!mx31_3ds_init_expio())
 		platform_device_register(&smsc911x_device);
Signature · 1 line
1.6.3.3
#5 lore raw

PATCH 3/8 MXC: mach-mx31_3ds: Add SPI1 device support.

---
 arch/arm/mach-mx3/mach-mx31_3ds.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mach-mx31_3ds.c +20 -0
index bf1f54a..80179cf 100644
@@ -35,6 +35,7 @@
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
 #include <mach/mxc_nand.h>
+#include <mach/spi.h>
 #include "devices.h"
 
 /*!
@@ -52,6 +53,24 @@ static int mx31_3ds_pins[] = {
 	MX31_PIN_TXD1__TXD1,
 	MX31_PIN_RXD1__RXD1,
 	IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO),
+	/* SPI 1 */
+	MX31_PIN_CSPI2_SCLK__SCLK,
+	MX31_PIN_CSPI2_MOSI__MOSI,
+	MX31_PIN_CSPI2_MISO__MISO,
+	MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
+	MX31_PIN_CSPI2_SS0__SS0,
+	MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */
+};
+
+/* SPI */
+static int spi1_internal_chipselect[] = {
+	MXC_SPI_CS(0),
+	MXC_SPI_CS(2),
+};
+
+static struct spi_imx_master spi1_pdata = {
+	.chipselect	= spi1_internal_chipselect,
+	.num_chipselect	= ARRAY_SIZE(spi1_internal_chipselect),
 };
 
 /*
@@ -249,6 +268,7 @@ static void __init mxc_board_init(void)
 
 	mxc_register_device(&mxc_uart_device0, &uart_pdata);
 	mxc_register_device(&mxc_nand_device, &imx31_3ds_nand_flash_pdata);
+	mxc_register_device(&mxc_spi_device1, &spi1_pdata);
 
 	if (!mx31_3ds_init_expio())
 		platform_device_register(&smsc911x_device);
Signature · 1 line
1.6.3.3
#6 lore raw

PATCH 4/8 MXC: mach-mx31_3ds: add support for freescale mc13783 power management device.

Power Gates must to be always enabled.

---
 arch/arm/mach-mx3/mach-mx31_3ds.c |   45 +++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mach-mx31_3ds.c +45 -0
index 80179cf..f54af1e 100644
@@ -23,6 +23,9 @@
 #include <linux/gpio.h>
 #include <linux/smsc911x.h>
 #include <linux/platform_device.h>
+#include <linux/mfd/mc13783.h>
+#include <linux/spi/spi.h>
+#include <linux/regulator/machine.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -60,6 +63,33 @@ static int mx31_3ds_pins[] = {
 	MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
 	MX31_PIN_CSPI2_SS0__SS0,
 	MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */
+	/* MC13783 IRQ */
+	IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO),
+};
+
+/* Regulators */
+static struct regulator_init_data pwgtx_init = {
+	.constraints = {
+		.boot_on	= 1,
+		.always_on	= 1,
+	},
+};
+
+static struct mc13783_regulator_init_data mx31_3ds_regulators[] = {
+	{
+		.id = MC13783_REGU_PWGT1SPI, /* Power Gate for ARM core. */
+		.init_data = &pwgtx_init,
+	}, {
+		.id = MC13783_REGU_PWGT2SPI, /* Power Gate for L2 Cache. */
+		.init_data = &pwgtx_init,
+	},
+};
+
+/* MC13783 */
+static struct mc13783_platform_data mc13783_pdata __initdata = {
+	.regulators = mx31_3ds_regulators,
+	.num_regulators = ARRAY_SIZE(mx31_3ds_regulators),
+	.flags  = MC13783_USE_REGULATOR,
 };
 
 /* SPI */
@@ -73,6 +103,18 @@ static struct spi_imx_master spi1_pdata = {
 	.num_chipselect	= ARRAY_SIZE(spi1_internal_chipselect),
 };
 
+static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
+	{
+		.modalias	= "mc13783",
+		.max_speed_hz	= 1000000,
+		.bus_num	= 1,
+		.chip_select	= 1, /* SS2 */
+		.platform_data	= &mc13783_pdata,
+		.irq		= IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
+		.mode = SPI_CS_HIGH,
+	},
+};
+
 /*
  * NAND Flash
  */
@@ -268,7 +310,10 @@ static void __init mxc_board_init(void)
 
 	mxc_register_device(&mxc_uart_device0, &uart_pdata);
 	mxc_register_device(&mxc_nand_device, &imx31_3ds_nand_flash_pdata);
+
 	mxc_register_device(&mxc_spi_device1, &spi1_pdata);
+	spi_register_board_info(mx31_3ds_spi_devs,
+						ARRAY_SIZE(mx31_3ds_spi_devs));
 
 	if (!mx31_3ds_init_expio())
 		platform_device_register(&smsc911x_device);
Signature · 1 line
1.6.3.3
#7 lore raw

PATCH 5/8 MXC: mach-mx31_3ds: Add support for SD card slot in the personality board.

The lock detection goes through the pmic and need to be implemented.

---
 arch/arm/mach-mx3/mach-mx31_3ds.c |  164 +++++++++++++++++++++++++++++++++++++
 1 files changed, 164 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mach-mx31_3ds.c +164 -0
index f54af1e..51e060c 100644
@@ -26,6 +26,9 @@
 #include <linux/mfd/mc13783.h>
 #include <linux/spi/spi.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/consumer.h>
+#include <linux/log2.h>
+#include <linux/err.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -39,6 +42,7 @@
 #include <mach/iomux-mx3.h>
 #include <mach/mxc_nand.h>
 #include <mach/spi.h>
+#include <mach/mmc.h>
 #include "devices.h"
 
 /*!
@@ -65,6 +69,112 @@ static int mx31_3ds_pins[] = {
 	MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */
 	/* MC13783 IRQ */
 	IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO),
+	/* SDHC1 */
+	MX31_PIN_SD1_DATA3__SD1_DATA3,
+	MX31_PIN_SD1_DATA2__SD1_DATA2,
+	MX31_PIN_SD1_DATA1__SD1_DATA1,
+	MX31_PIN_SD1_DATA0__SD1_DATA0,
+	MX31_PIN_SD1_CLK__SD1_CLK,
+	MX31_PIN_SD1_CMD__SD1_CMD,
+	MX31_PIN_GPIO3_0__GPIO3_0, /*OE*/
+};
+
+/*
+ * Support for SD card slot in personality board
+ */
+static struct regulator *vmmc_reg;
+
+static int mx31_3ds_sd1_init(struct device *dev,
+				   irq_handler_t detect_irq, void *data)
+{
+	int ret;
+	int gpio_det, gpio_bus_en;
+
+	gpio_det = IOMUX_TO_GPIO(MX31_PIN_GPIO3_1);
+	gpio_bus_en = IOMUX_TO_GPIO(MX31_PIN_GPIO3_0);
+
+	ret = gpio_request(gpio_det, "sd1-card-detect");
+	if (ret) {
+		pr_warning("Unable to request sd card detect gpio.\n");
+		return ret;
+	}
+
+	ret = gpio_request(gpio_bus_en, "sd1-bus-enable");
+	if (ret) {
+		pr_warning("Unable to request sd card bus enable gpio.\n");
+		goto gpio_free;
+	}
+
+	gpio_direction_input(gpio_det);
+	ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
+			  detect_irq, IRQF_DISABLED |
+			  IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
+			  "sd1-detect", data);
+
+	if (ret) {
+		pr_warning("Unable to request sd card detect irq.\n");
+		goto gpio_free_all;
+	}
+
+	vmmc_reg = regulator_get(dev, "sd1_vdd");
+
+	if (IS_ERR(vmmc_reg)) {
+		pr_err("%s: Unable to get VMMC2 regulator\n", __func__);
+		goto gpio_free_all;
+	}
+
+	return 0;
+
+gpio_free_all:
+	gpio_free(gpio_bus_en);
+gpio_free:
+	gpio_free(gpio_det);
+	return ret;
+}
+
+static void mx31_3ds_sd1_exit(struct device *dev, void *data)
+{
+	/* Free SD regulator, CardDetect irq and gpio */
+	regulator_put(vmmc_reg);
+	free_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), data);
+	gpio_free(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
+	gpio_free(IOMUX_TO_GPIO(MX31_PIN_GPIO3_0));
+}
+
+static void mx31_3ds_setpower(struct device *dev, unsigned int vdd)
+{
+	int voltage = 0;
+
+	if (vdd <= ilog2(MMC_VDD_165_195))
+		voltage = 1800000;
+	else if (vdd == ilog2(MMC_VDD_20_21))
+		voltage = 2000000;
+	else
+		voltage = 2000000 + (vdd - 7) * 100000;
+
+	pr_debug("%s: vdd = %d -> REGU_VMMC2 = %d\n", __func__, vdd, voltage);
+
+	regulator_set_voltage(vmmc_reg, voltage, voltage);
+
+	/*
+	 * Active the Buffer Enable Pin only if there is
+	 * a card in slot.
+	 * To fix the card voltage issue caused by
+	 * bi-directional chip TXB0108 on 3Stack
+	 */
+	if (voltage > 1800000)
+		gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_GPIO3_0), 1);
+	else
+		gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_GPIO3_0), 0);
+}
+
+static struct imxmmc_platform_data sdhc1_pdata = {
+	.init	= mx31_3ds_sd1_init,
+	.exit	= mx31_3ds_sd1_exit,
+	.ocr_avail = MMC_VDD_165_195 | MMC_VDD_20_21 | MMC_VDD_25_26 |
+		     MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
+		     MMC_VDD_29_30,
+	.setpower = mx31_3ds_setpower,
 };
 
 /* Regulators */
@@ -75,6 +185,46 @@ static struct regulator_init_data pwgtx_init = {
 	},
 };
 
+static struct regulator_init_data gpo1_init = {
+	.constraints = {
+		.boot_on	= 1,
+		.always_on	= 1,
+	},
+};
+
+static struct regulator_consumer_supply gpo3_consumers[] = {
+	{
+		.dev	= &mxcsdhc_device0.dev,
+		.supply	= "vdd_sd1_io",
+	},
+};
+
+static struct regulator_init_data gpo3_init = {
+	.constraints = {
+		.boot_on	= 1,
+		.always_on	= 1,
+	},
+	.num_consumer_supplies = ARRAY_SIZE(gpo3_consumers),
+	.consumer_supplies = gpo3_consumers,
+};
+
+static struct regulator_consumer_supply vmmc2_consumers[] = {
+	{
+		.dev	= &mxcsdhc_device0.dev,
+		.supply	= "sd1_vdd",
+	},
+};
+
+static struct regulator_init_data vmmc2_init = {
+	.constraints = {
+		.min_uV = 1600000,
+		.max_uV = 3000000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+	},
+	.num_consumer_supplies = ARRAY_SIZE(vmmc2_consumers),
+	.consumer_supplies = vmmc2_consumers,
+};
+
 static struct mc13783_regulator_init_data mx31_3ds_regulators[] = {
 	{
 		.id = MC13783_REGU_PWGT1SPI, /* Power Gate for ARM core. */
@@ -82,6 +232,18 @@ static struct mc13783_regulator_init_data mx31_3ds_regulators[] = {
 	}, {
 		.id = MC13783_REGU_PWGT2SPI, /* Power Gate for L2 Cache. */
 		.init_data = &pwgtx_init,
+	}, {
+		.id = MC13783_REGU_GPO1, /* GPO1 -> enables 3v
+					  * for personality. */
+		.init_data = &gpo1_init,
+	}, {
+		.id = MC13783_REGU_GPO3, /* GPO3 -> enables SW2B 1.8V out
+					  * this becomes 1V8 on personality
+					  * board. */
+		.init_data = &gpo3_init,
+	}, {
+		.id = MC13783_REGU_VMMC2,
+		.init_data = &vmmc2_init,
 	},
 };
 
@@ -315,6 +477,8 @@ static void __init mxc_board_init(void)
 	spi_register_board_info(mx31_3ds_spi_devs,
 						ARRAY_SIZE(mx31_3ds_spi_devs));
 
+	mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
+
 	if (!mx31_3ds_init_expio())
 		platform_device_register(&smsc911x_device);
 }
Signature · 1 line
1.6.3.3
#8 lore raw

PATCH 6/8 MXC: mach-mx31_3ds: Add support for framebuffer and lcd.

---
 arch/arm/mach-mx3/mach-mx31_3ds.c |  130 +++++++++++++++++++++++++++++++++++++
 1 files changed, 130 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mach-mx31_3ds.c +130 -0
index 51e060c..46ccb6c 100644
@@ -25,6 +25,7 @@
 #include <linux/platform_device.h>
 #include <linux/mfd/mc13783.h>
 #include <linux/spi/spi.h>
+#include <linux/spi/l4f00242t03.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/consumer.h>
 #include <linux/log2.h>
@@ -43,6 +44,8 @@
 #include <mach/mxc_nand.h>
 #include <mach/spi.h>
 #include <mach/mmc.h>
+#include <mach/ipu.h>
+#include <mach/mx3fb.h>
 #include "devices.h"
 
 /*!
@@ -60,6 +63,12 @@ static int mx31_3ds_pins[] = {
 	MX31_PIN_TXD1__TXD1,
 	MX31_PIN_RXD1__RXD1,
 	IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO),
+	/*SPI0*/
+	MX31_PIN_CSPI1_SCLK__SCLK,
+	MX31_PIN_CSPI1_MOSI__MOSI,
+	MX31_PIN_CSPI1_MISO__MISO,
+	MX31_PIN_CSPI1_SPI_RDY__SPI_RDY,
+	MX31_PIN_CSPI1_SS2__SS2, /*CS for LCD */
 	/* SPI 1 */
 	MX31_PIN_CSPI2_SCLK__SCLK,
 	MX31_PIN_CSPI2_MOSI__MOSI,
@@ -77,6 +86,70 @@ static int mx31_3ds_pins[] = {
 	MX31_PIN_SD1_CLK__SD1_CLK,
 	MX31_PIN_SD1_CMD__SD1_CMD,
 	MX31_PIN_GPIO3_0__GPIO3_0, /*OE*/
+	/* Framebuffer */
+	MX31_PIN_LD0__LD0,
+	MX31_PIN_LD1__LD1,
+	MX31_PIN_LD2__LD2,
+	MX31_PIN_LD3__LD3,
+	MX31_PIN_LD4__LD4,
+	MX31_PIN_LD5__LD5,
+	MX31_PIN_LD6__LD6,
+	MX31_PIN_LD7__LD7,
+	MX31_PIN_LD8__LD8,
+	MX31_PIN_LD9__LD9,
+	MX31_PIN_LD10__LD10,
+	MX31_PIN_LD11__LD11,
+	MX31_PIN_LD12__LD12,
+	MX31_PIN_LD13__LD13,
+	MX31_PIN_LD14__LD14,
+	MX31_PIN_LD15__LD15,
+	MX31_PIN_LD16__LD16,
+	MX31_PIN_LD17__LD17,
+	MX31_PIN_VSYNC3__VSYNC3,
+	MX31_PIN_HSYNC__HSYNC,
+	MX31_PIN_FPSHIFT__FPSHIFT,
+	MX31_PIN_CONTRAST__CONTRAST,
+};
+
+/*
+ * FB support
+ */
+static const struct fb_videomode fb_modedb[] = {
+	{	/* 480x640 @ 60 Hz */
+		.name		= "Epson-VGA",
+		.refresh	= 60,
+		.xres		= 480,
+		.yres		= 640,
+		.pixclock	= 41701,
+		.left_margin	= 20,
+		.right_margin	= 41,
+		.upper_margin	= 10,
+		.lower_margin	= 5,
+		.hsync_len	= 20,
+		.vsync_len	= 10,
+		.sync		= FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
+		.vmode		= FB_VMODE_NONINTERLACED,
+		.flag		= 0,
+	},
+};
+
+static struct ipu_platform_data mx3_ipu_data = {
+	.irq_base = MXC_IPU_IRQ_START,
+};
+
+static struct mx3fb_platform_data mx3fb_pdata = {
+	.dma_dev	= &mx3_ipu.dev,
+	.name		= "Epson-VGA",
+	.mode		= fb_modedb,
+	.num_modes	= ARRAY_SIZE(fb_modedb),
+};
+
+/* LCD */
+static struct l4f00242t03_pdata mx31_3ds_l4f00242t03_pdata = {
+	.reset_gpio =		IOMUX_TO_GPIO(MX31_PIN_LCS1),
+	.data_enable_gpio =	IOMUX_TO_GPIO(MX31_PIN_SER_RS),
+	.core_supply =		"lcd_2v8",
+	.io_supply =		"vdd_lcdio",
 };
 
 /*
@@ -225,6 +298,38 @@ static struct regulator_init_data vmmc2_init = {
 	.consumer_supplies = vmmc2_consumers,
 };
 
+static struct regulator_consumer_supply vmmc1_consumers[] = {
+	{
+		.supply	= "lcd_2v8",
+	},
+};
+
+static struct regulator_init_data vmmc1_init = {
+	.constraints = {
+		.min_uV = 2800000,
+		.max_uV = 2800000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+	},
+	.num_consumer_supplies = ARRAY_SIZE(vmmc1_consumers),
+	.consumer_supplies = vmmc1_consumers,
+};
+
+static struct regulator_consumer_supply vgen_consumers[] = {
+	{
+		.supply	= "vdd_lcdio",
+	},
+};
+
+static struct regulator_init_data vgen_init = {
+	.constraints = {
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
+	},
+	.num_consumer_supplies = ARRAY_SIZE(vgen_consumers),
+	.consumer_supplies = vgen_consumers,
+};
+
 static struct mc13783_regulator_init_data mx31_3ds_regulators[] = {
 	{
 		.id = MC13783_REGU_PWGT1SPI, /* Power Gate for ARM core. */
@@ -244,6 +349,12 @@ static struct mc13783_regulator_init_data mx31_3ds_regulators[] = {
 	}, {
 		.id = MC13783_REGU_VMMC2,
 		.init_data = &vmmc2_init,
+	}, {
+		.id = MC13783_REGU_VMMC1,
+		.init_data = &vmmc1_init,
+	}, {
+		.id = MC13783_REGU_VGEN,
+		.init_data = &vgen_init,
 	},
 };
 
@@ -255,6 +366,15 @@ static struct mc13783_platform_data mc13783_pdata __initdata = {
 };
 
 /* SPI */
+static int spi0_internal_chipselect[] = {
+	MXC_SPI_CS(2),
+};
+
+static struct spi_imx_master spi0_pdata = {
+	.chipselect	= spi0_internal_chipselect,
+	.num_chipselect	= ARRAY_SIZE(spi0_internal_chipselect),
+};
+
 static int spi1_internal_chipselect[] = {
 	MXC_SPI_CS(0),
 	MXC_SPI_CS(2),
@@ -274,6 +394,12 @@ static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
 		.platform_data	= &mc13783_pdata,
 		.irq		= IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
 		.mode = SPI_CS_HIGH,
+	}, {
+		.modalias	= "l4f00242t03",
+		.max_speed_hz	= 5000000,
+		.bus_num	= 0,
+		.chip_select	= 0, /* SS2 */
+		.platform_data	= &mx31_3ds_l4f00242t03_pdata,
 	},
 };
 
@@ -479,6 +605,10 @@ static void __init mxc_board_init(void)
 
 	mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
 
+	mxc_register_device(&mxc_spi_device0, &spi0_pdata);
+	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
+	mxc_register_device(&mx3_fb, &mx3fb_pdata);
+
 	if (!mx31_3ds_init_expio())
 		platform_device_register(&smsc911x_device);
 }
Signature · 1 line
1.6.3.3
#9 lore raw

PATCH 7/8 MXC: mach-mx31_3ds: Add support for the keypad.

The kpp device is not a board private one, so it have to be defined in devices.c

---
 arch/arm/mach-mx3/devices.c       |   19 +++++++++++++++++++
 arch/arm/mach-mx3/devices.h       |    1 +
 arch/arm/mach-mx3/mach-mx31_3ds.c |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/devices.c +19 -0
index 6adb586..539a08d 100644
@@ -575,6 +575,25 @@ struct platform_device imx_ssi_device1 = {
 	.resource = imx_ssi_resources1,
 };
 
+static struct resource imx_kpp_resources[] = {
+	{
+		.start	= MX3x_KPP_BASE_ADDR,
+		.end	= MX3x_KPP_BASE_ADDR + 0xf,
+		.flags	= IORESOURCE_MEM
+	}, {
+		.start	= MX3x_INT_KPP,
+		.end	= MX3x_INT_KPP,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device imx_kpp_device = {
+	.name = "imx-keypad",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(imx_kpp_resources),
+	.resource = imx_kpp_resources,
+};
+
 static int mx3_devices_init(void)
 {
 	if (cpu_is_mx31()) {
arch/arm/mach-mx3/devices.h +1 -0
index 42cf175..4ca2a18 100644
@@ -25,4 +25,5 @@ extern struct platform_device mxc_spi_device1;
 extern struct platform_device mxc_spi_device2;
 extern struct platform_device imx_ssi_device0;
 extern struct platform_device imx_ssi_device1;
+extern struct platform_device imx_kpp_device;
 
arch/arm/mach-mx3/mach-mx31_3ds.c +32 -0
index 46ccb6c..258e8d1 100644
@@ -30,6 +30,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/log2.h>
 #include <linux/err.h>
+#include <linux/input/matrix_keypad.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -109,6 +110,35 @@ static int mx31_3ds_pins[] = {
 	MX31_PIN_HSYNC__HSYNC,
 	MX31_PIN_FPSHIFT__FPSHIFT,
 	MX31_PIN_CONTRAST__CONTRAST,
+	/*Keyboard*/
+	IOMUX_MODE(MX31_PIN_KEY_ROW0, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_ROW1, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_ROW2, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL0, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL1, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL2, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL3, IOMUX_CONFIG_FUNC),
+};
+
+/*
+ * Matrix keyboard
+ */
+
+static const uint32_t mx31_3ds_keymap[] = {
+	KEY(0, 0, KEY_UP),
+	KEY(0, 1, KEY_DOWN),
+	KEY(1, 0, KEY_RIGHT),
+	KEY(1, 1, KEY_LEFT),
+	KEY(1, 2, KEY_ENTER),
+	KEY(2, 0, KEY_F6),
+	KEY(2, 1, KEY_F8),
+	KEY(2, 2, KEY_F9),
+	KEY(2, 3, KEY_F10),
+};
+
+static struct matrix_keymap_data mx31_3ds_keymap_data = {
+	.keymap		= mx31_3ds_keymap,
+	.keymap_size	= ARRAY_SIZE(mx31_3ds_keymap),
 };
 
 /*
@@ -609,6 +639,8 @@ static void __init mxc_board_init(void)
 	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
 	mxc_register_device(&mx3_fb, &mx3fb_pdata);
 
+	mxc_register_device(&imx_kpp_device, &mx31_3ds_keymap_data);
+
 	if (!mx31_3ds_init_expio())
 		platform_device_register(&smsc911x_device);
 }
Signature · 1 line
1.6.3.3
#10 lore raw

PATCH 8/8 MXC: mach-mx31_3ds: enable mc13783 touchscreen interface.

---
 arch/arm/mach-mx3/mach-mx31_3ds.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-mx3/mach-mx31_3ds.c +1 -1
index 258e8d1..a430b5b 100644
@@ -392,7 +392,7 @@ static struct mc13783_regulator_init_data mx31_3ds_regulators[] = {
 static struct mc13783_platform_data mc13783_pdata __initdata = {
 	.regulators = mx31_3ds_regulators,
 	.num_regulators = ARRAY_SIZE(mx31_3ds_regulators),
-	.flags  = MC13783_USE_REGULATOR,
+	.flags  = MC13783_USE_REGULATOR | MC13783_USE_TOUCHSCREEN,
 };
 
 /* SPI */
Signature · 1 line
1.6.3.3
#11 lore raw

PATCH 7/8 MXC: mach-mx31_3ds: Add support for the keypad.

In reply to Alberto Panizzo

Hi

Sascha, perhaps it's time to apply this patch now? I was very close to submit a very similar patch a few moments ago (based on the current Linus git tree) but found this post in the archive.

Regrds, Magnus

Quoted 107 lines · Alberto Panizzo

The kpp device is not a board private one, so it have to be defined in devices.c

---
 arch/arm/mach-mx3/devices.c       |   19 +++++++++++++++++++
 arch/arm/mach-mx3/devices.h       |    1 +
 arch/arm/mach-mx3/mach-mx31_3ds.c |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/devices.c +19 -0
index 6adb586..539a08d 100644
@@ -575,6 +575,25 @@ struct platform_device imx_ssi_device1 = {
 	.resource = imx_ssi_resources1,
 };
 
+static struct resource imx_kpp_resources[] = {
+	{
+		.start	= MX3x_KPP_BASE_ADDR,
+		.end	= MX3x_KPP_BASE_ADDR + 0xf,
+		.flags	= IORESOURCE_MEM
+	}, {
+		.start	= MX3x_INT_KPP,
+		.end	= MX3x_INT_KPP,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device imx_kpp_device = {
+	.name = "imx-keypad",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(imx_kpp_resources),
+	.resource = imx_kpp_resources,
+};
+
 static int mx3_devices_init(void)
 {
 	if (cpu_is_mx31()) {
arch/arm/mach-mx3/devices.h +1 -0
index 42cf175..4ca2a18 100644
@@ -25,4 +25,5 @@ extern struct platform_device mxc_spi_device1;
 extern struct platform_device mxc_spi_device2;
 extern struct platform_device imx_ssi_device0;
 extern struct platform_device imx_ssi_device1;
+extern struct platform_device imx_kpp_device;
 
arch/arm/mach-mx3/mach-mx31_3ds.c +32 -0
index 46ccb6c..258e8d1 100644
@@ -30,6 +30,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/log2.h>
 #include <linux/err.h>
+#include <linux/input/matrix_keypad.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -109,6 +110,35 @@ static int mx31_3ds_pins[] = {
 	MX31_PIN_HSYNC__HSYNC,
 	MX31_PIN_FPSHIFT__FPSHIFT,
 	MX31_PIN_CONTRAST__CONTRAST,
+	/*Keyboard*/
+	IOMUX_MODE(MX31_PIN_KEY_ROW0, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_ROW1, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_ROW2, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL0, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL1, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL2, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL3, IOMUX_CONFIG_FUNC),
+};
+
+/*
+ * Matrix keyboard
+ */
+
+static const uint32_t mx31_3ds_keymap[] = {
+	KEY(0, 0, KEY_UP),
+	KEY(0, 1, KEY_DOWN),
+	KEY(1, 0, KEY_RIGHT),
+	KEY(1, 1, KEY_LEFT),
+	KEY(1, 2, KEY_ENTER),
+	KEY(2, 0, KEY_F6),
+	KEY(2, 1, KEY_F8),
+	KEY(2, 2, KEY_F9),
+	KEY(2, 3, KEY_F10),
+};
+
+static struct matrix_keymap_data mx31_3ds_keymap_data = {
+	.keymap		= mx31_3ds_keymap,
+	.keymap_size	= ARRAY_SIZE(mx31_3ds_keymap),
 };
 
 /*
@@ -609,6 +639,8 @@ static void __init mxc_board_init(void)
 	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
 	mxc_register_device(&mx3_fb, &mx3fb_pdata);
 
+	mxc_register_device(&imx_kpp_device, &mx31_3ds_keymap_data);
+
 	if (!mx31_3ds_init_expio())
 		platform_device_register(&smsc911x_device);
 }
#12 lore raw

PATCH 7/8 MXC: mach-mx31_3ds: Add support for the keypad.

Quoted 7 lines · Magnus Lilja

Hi

Sascha, perhaps it's time to apply this patch now? I was very close to submit a very similar patch a few moments ago (based on the current Linus git tree) but found this post in the archive.

Regrds, Magnus

I apologize for my delay in serving the issues raised in this thread. Mangus, if you solve the problem (regulators handling support in imxmmc as pxamci do) you could then post an acceptable version of this patch. It is easy, really a bit of lines, but I do not have time now...

Then the rest of the thread can be rebased and applied.

Regards,
Alberto!

#13 lore raw

PATCH 7/8 MXC: mach-mx31_3ds: Add support for the keypad.

Hi

Quoted 7 lines · Alberto Panizzo
Quoted 6 lines · Magnus Lilja

Hi

Sascha, perhaps it's time to apply this patch now? I was very close to submit a very similar patch a few moments ago (based on the current Linus git tree) but found this post in the archive.

Quoted 6 lines
Quoted 1 line

Regrds, Magnus

I apologize for my delay in serving the issues raised in this thread. Mangus, if you solve the problem (regulators handling support in imxmmc as pxamci do) you could then post an acceptable version of this patch. It is easy, really a bit of lines, but I do not have time now...

I had only the keypad-patch in mind, I have not worked with, or plan to do so, with SD-card or MMC. The keypad patch should be ready to be appled, I didn't see any comments on that.

Regards, Magnus

maintainer
#14 lore raw

PATCH 7/8 MXC: mach-mx31_3ds: Add support for the keypad.

In reply to Magnus Lilja
Quoted 6 lines · Magnus Lilja

Hi

Sascha, perhaps it's time to apply this patch now? I was very close to submit a very similar patch a few moments ago (based on the current Linus git tree) but found this post in the archive.

This patch combines 3ds platform support with the mx3 support. Can you please send a patch with mx3 support only?

Sascha

Quoted 114 lines

Regrds, Magnus

Quoted 107 lines · Alberto Panizzo

The kpp device is not a board private one, so it have to be defined in devices.c

---
 arch/arm/mach-mx3/devices.c       |   19 +++++++++++++++++++
 arch/arm/mach-mx3/devices.h       |    1 +
 arch/arm/mach-mx3/mach-mx31_3ds.c |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/devices.c +19 -0
index 6adb586..539a08d 100644
@@ -575,6 +575,25 @@ struct platform_device imx_ssi_device1 = {
 	.resource = imx_ssi_resources1,
 };
 
+static struct resource imx_kpp_resources[] = {
+	{
+		.start	= MX3x_KPP_BASE_ADDR,
+		.end	= MX3x_KPP_BASE_ADDR + 0xf,
+		.flags	= IORESOURCE_MEM
+	}, {
+		.start	= MX3x_INT_KPP,
+		.end	= MX3x_INT_KPP,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device imx_kpp_device = {
+	.name = "imx-keypad",
+	.id = -1,
+	.num_resources = ARRAY_SIZE(imx_kpp_resources),
+	.resource = imx_kpp_resources,
+};
+
 static int mx3_devices_init(void)
 {
 	if (cpu_is_mx31()) {
arch/arm/mach-mx3/devices.h +1 -0
index 42cf175..4ca2a18 100644
@@ -25,4 +25,5 @@ extern struct platform_device mxc_spi_device1;
 extern struct platform_device mxc_spi_device2;
 extern struct platform_device imx_ssi_device0;
 extern struct platform_device imx_ssi_device1;
+extern struct platform_device imx_kpp_device;
 
arch/arm/mach-mx3/mach-mx31_3ds.c +32 -0
index 46ccb6c..258e8d1 100644
@@ -30,6 +30,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/log2.h>
 #include <linux/err.h>
+#include <linux/input/matrix_keypad.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -109,6 +110,35 @@ static int mx31_3ds_pins[] = {
 	MX31_PIN_HSYNC__HSYNC,
 	MX31_PIN_FPSHIFT__FPSHIFT,
 	MX31_PIN_CONTRAST__CONTRAST,
+	/*Keyboard*/
+	IOMUX_MODE(MX31_PIN_KEY_ROW0, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_ROW1, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_ROW2, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL0, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL1, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL2, IOMUX_CONFIG_FUNC),
+	IOMUX_MODE(MX31_PIN_KEY_COL3, IOMUX_CONFIG_FUNC),
+};
+
+/*
+ * Matrix keyboard
+ */
+
+static const uint32_t mx31_3ds_keymap[] = {
+	KEY(0, 0, KEY_UP),
+	KEY(0, 1, KEY_DOWN),
+	KEY(1, 0, KEY_RIGHT),
+	KEY(1, 1, KEY_LEFT),
+	KEY(1, 2, KEY_ENTER),
+	KEY(2, 0, KEY_F6),
+	KEY(2, 1, KEY_F8),
+	KEY(2, 2, KEY_F9),
+	KEY(2, 3, KEY_F10),
+};
+
+static struct matrix_keymap_data mx31_3ds_keymap_data = {
+	.keymap		= mx31_3ds_keymap,
+	.keymap_size	= ARRAY_SIZE(mx31_3ds_keymap),
 };
 
 /*
@@ -609,6 +639,8 @@ static void __init mxc_board_init(void)
 	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
 	mxc_register_device(&mx3_fb, &mx3fb_pdata);
 
+	mxc_register_device(&imx_kpp_device, &mx31_3ds_keymap_data);
+
 	if (!mx31_3ds_init_expio())
 		platform_device_register(&smsc911x_device);
 }
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 |
#15 lore raw

PATCH 7/8 MXC: mach-mx31_3ds: Add support for the keypad.

Quoted 6 lines · Sascha Hauer

This patch combines 3ds platform support with the mx3 support. Can you please send a patch with mx3 support only?

Sascha

Sorry for overlaps.
Soon the two divided patches.

Signature · 4 lines
Alberto!

        Be Persistent!
                - Greg Kroah-Hartman (FOSDEM 2010)
#16 lore raw

PATCH 5/8 MXC: mach-mx31_3ds: Add support for SD card slot in the personality board.

In reply to Alberto Panizzo
Quoted 4 lines · Alberto Panizzo
arch/arm/mach-mx3/mach-mx31_3ds.c +4 -0
+static void mx31_3ds_setpower(struct device *dev, unsigned int vdd)
+{
+	int voltage = 0;
+

arch/arm/mach-mx3/mach-mx31_3ds.c static int mx31_3ds_pins[] = { · line 157

Quoted 10 lines
arch/arm/mach-mx3/mach-mx31_3ds.c +10 -0
+	if (vdd <= ilog2(MMC_VDD_165_195))
+		voltage = 1800000;
+	else if (vdd == ilog2(MMC_VDD_20_21))
+		voltage = 2000000;
+	else
+		voltage = 2000000 + (vdd - 7) * 100000;
+
+	pr_debug("%s: vdd = %d -> REGU_VMMC2 = %d\n", __func__, vdd, voltage);
+
+	regulator_set_voltage(vmmc_reg, voltage, voltage);

This code looks wrong - the MMC core is requesting voltage ranges but these are being non-linearly translated into specific voltages. I rather suspect that the standard mmc_regulator_set_ocr() function ought to be able to cope with this, in conjunction with a regulator constraint limiting the minimum voltage to 1.8V. If not, some comments explaining what's going on would really help.

arch/arm/mach-mx3/mach-mx31_3ds.c static struct regulator_init_data pwgtx_init = { · line 197

Quoted 3 lines
arch/arm/mach-mx3/mach-mx31_3ds.c +3 -0
+static struct regulator_consumer_supply gpo3_consumers[] = {
+	{
+		.dev	= &mxcsdhc_device0.dev,

Use dev_name, not dev.

maintainer
#17 lore raw

PATCH 5/8 MXC: mach-mx31_3ds: Add support for SD card slot in the personality board.

In reply to Alberto Panizzo
Quoted 71 lines · Alberto Panizzo

The lock detection goes through the pmic and need to be implemented.

---
 arch/arm/mach-mx3/mach-mx31_3ds.c |  164 +++++++++++++++++++++++++++++++++++++
 1 files changed, 164 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mach-mx31_3ds.c +42 -0
index f54af1e..51e060c 100644
@@ -26,6 +26,9 @@
 #include <linux/mfd/mc13783.h>
 #include <linux/spi/spi.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/consumer.h>
+#include <linux/log2.h>
+#include <linux/err.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -39,6 +42,7 @@
 #include <mach/iomux-mx3.h>
 #include <mach/mxc_nand.h>
 #include <mach/spi.h>
+#include <mach/mmc.h>
 #include "devices.h"
 
 /*!
@@ -65,6 +69,112 @@ static int mx31_3ds_pins[] = {
 	MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */
 	/* MC13783 IRQ */
 	IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO),
+	/* SDHC1 */
+	MX31_PIN_SD1_DATA3__SD1_DATA3,
+	MX31_PIN_SD1_DATA2__SD1_DATA2,
+	MX31_PIN_SD1_DATA1__SD1_DATA1,
+	MX31_PIN_SD1_DATA0__SD1_DATA0,
+	MX31_PIN_SD1_CLK__SD1_CLK,
+	MX31_PIN_SD1_CMD__SD1_CMD,
+	MX31_PIN_GPIO3_0__GPIO3_0, /*OE*/
+};
+
+/*
+ * Support for SD card slot in personality board
+ */
+static struct regulator *vmmc_reg;
+
+static int mx31_3ds_sd1_init(struct device *dev,
+				   irq_handler_t detect_irq, void *data)
+{
+	int ret;
+	int gpio_det, gpio_bus_en;
+
+	gpio_det = IOMUX_TO_GPIO(MX31_PIN_GPIO3_1);
+	gpio_bus_en = IOMUX_TO_GPIO(MX31_PIN_GPIO3_0);
+
+	ret = gpio_request(gpio_det, "sd1-card-detect");
+	if (ret) {
+		pr_warning("Unable to request sd card detect gpio.\n");
+		return ret;
+	}
+
+	ret = gpio_request(gpio_bus_en, "sd1-bus-enable");
+	if (ret) {
+		pr_warning("Unable to request sd card bus enable gpio.\n");
+		goto gpio_free;
+	}
+
+	gpio_direction_input(gpio_det);
+	ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),

arch/arm/mach-mx3/mach-mx31_3ds.c static int mx31_3ds_pins[] = { · line 119

Quoted 10 lines
arch/arm/mach-mx3/mach-mx31_3ds.c +10 -0
+			  detect_irq, IRQF_DISABLED |
+			  IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
+			  "sd1-detect", data);
+
+	if (ret) {
+		pr_warning("Unable to request sd card detect irq.\n");
+		goto gpio_free_all;
+	}
+
+	vmmc_reg = regulator_get(dev, "sd1_vdd");

I think the driver should handle the regulator stuff, not the platform. drivers/mmc/host/pxamci.c looks like a good example.

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 |