All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] mx31moboard: patches for next merge window v2
@ 2009-11-03 17:09 Valentin Longchamp
  2009-11-03 17:09 ` [PATCH 1/6] mx31: various pins used for mx31moboard Valentin Longchamp
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Valentin Longchamp @ 2009-11-03 17:09 UTC (permalink / raw)
  To: linux-arm-kernel

Here are the patches I would like to push during the next merge window for
the mx31moboard platform.

It consists of a fix for a small hardware design issue for the main serial
port, a few GPIOs used on the robots that are declared, camera support and
finally MC13783 support as it is now getting ready.

For MC13783, we need RTC as well, but it was not tested yet since it is not
in mainline yet.

The camera part works for one camera. The soc_camera needs some reworking
before we are able to support the two cameras we have on the robot

The main peripheral that we are using and that still is missing is the USB
host, but since the driver still needs a few improvements, I keep it aside
for now.

Changes since v1:
- changed the patches order
- support for a single camera
- corrected typos and comments from earlier version

Val

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/6] mx31: various pins used for mx31moboard
  2009-11-03 17:09 [PATCH 0/6] mx31moboard: patches for next merge window v2 Valentin Longchamp
@ 2009-11-03 17:09 ` Valentin Longchamp
  2009-11-03 17:09   ` [PATCH 2/6] mx31moboard: serial port fix Valentin Longchamp
  2009-11-05  7:29 ` [PATCH 0/6] mx31moboard: patches for next merge window v2 Sascha Hauer
  2009-11-05  7:40 ` Daniel Mack
  2 siblings, 1 reply; 14+ messages in thread
From: Valentin Longchamp @ 2009-11-03 17:09 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
---
 arch/arm/plat-mxc/include/mach/iomux-mx3.h |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx3.h b/arch/arm/plat-mxc/include/mach/iomux-mx3.h
index 446f867..0dcfb77 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx3.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx3.h
@@ -623,6 +623,8 @@ enum iomux_pins {
 #define MX31_PIN_GPIO3_0__GPIO3_0	IOMUX_MODE(MX31_PIN_GPIO3_0, IOMUX_CONFIG_GPIO)
 #define MX31_PIN_GPIO3_1__GPIO3_1	IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO)
 #define MX31_PIN_TXD2__GPIO1_28		IOMUX_MODE(MX31_PIN_TXD2, IOMUX_CONFIG_GPIO)
+#define MX31_PIN_CSI_D4__GPIO3_4	IOMUX_MODE(MX31_PIN_CSI_D4, IOMUX_CONFIG_GPIO)
+#define MX31_PIN_CSI_D5__GPIO3_5	IOMUX_MODE(MX31_PIN_CSI_D5, IOMUX_CONFIG_GPIO)
 #define MX31_PIN_USBOTG_DATA0__USBOTG_DATA0    IOMUX_MODE(MX31_PIN_USBOTG_DATA0, IOMUX_CONFIG_FUNC)
 #define MX31_PIN_USBOTG_DATA1__USBOTG_DATA1    IOMUX_MODE(MX31_PIN_USBOTG_DATA1, IOMUX_CONFIG_FUNC)
 #define MX31_PIN_USBOTG_DATA2__USBOTG_DATA2    IOMUX_MODE(MX31_PIN_USBOTG_DATA2, IOMUX_CONFIG_FUNC)
@@ -693,7 +695,11 @@ enum iomux_pins {
 #define MX31_PIN_DCD_DCE1__GPIO2_11	IOMUX_MODE(MX31_PIN_DCD_DCE1, IOMUX_CONFIG_GPIO)
 #define MX31_PIN_STXD5__GPIO1_21       IOMUX_MODE(MX31_PIN_STXD5, IOMUX_CONFIG_GPIO)
 #define MX31_PIN_SRXD5__GPIO1_22       IOMUX_MODE(MX31_PIN_SRXD5, IOMUX_CONFIG_GPIO)
-
+#define MX31_PIN_GPIO1_3__GPIO1_3	IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO)
+#define MX31_PIN_CSPI2_SS1__CSPI3_SS1	IOMUX_MODE(MX31_PIN_CSPI2_SS1, IOMUX_CONFIG_ALT1)
+#define MX31_PIN_RTS1__GPIO2_6		IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_GPIO)
+#define MX31_PIN_CTS1__GPIO2_7		IOMUX_MODE(MX31_PIN_CTS1, IOMUX_CONFIG_GPIO)
+#define MX31_PIN_LCS0__GPIO3_23		IOMUX_MODE(MX31_PIN_LCS0, IOMUX_CONFIG_GPIO)
 
 /*XXX: The SS0, SS1, SS2, SS3 lines of spi3 are multiplexed by cspi2_ss0, cspi2_ss1, cspi1_ss0
  * cspi1_ss1*/
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/6] mx31moboard: serial port fix
  2009-11-03 17:09 ` [PATCH 1/6] mx31: various pins used for mx31moboard Valentin Longchamp
@ 2009-11-03 17:09   ` Valentin Longchamp
  2009-11-03 17:09     ` [PATCH 3/6] mx31moboard: support for pin linked for battery presence check Valentin Longchamp
  0 siblings, 1 reply; 14+ messages in thread
From: Valentin Longchamp @ 2009-11-03 17:09 UTC (permalink / raw)
  To: linux-arm-kernel

We get rid of CTS/RTS lines on uart0 on our platform.
This is the port we use as main kernel console. We do not
want it to be blocking because of CTS/RTS signals, not allowing
the system to boot or print messages.

However we often use it with a bluetooth module needing CTS/RTS
lines as backup login in case of trouble. To be able to use it,
we assert CTS low so that the module can always send chars.

Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
---
 arch/arm/mach-mx3/mx31moboard.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index 9243de5..ff74fab 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -45,8 +45,8 @@
 
 static unsigned int moboard_pins[] = {
 	/* UART0 */
-	MX31_PIN_CTS1__CTS1, MX31_PIN_RTS1__RTS1,
 	MX31_PIN_TXD1__TXD1, MX31_PIN_RXD1__RXD1,
+	MX31_PIN_CTS1__GPIO2_7,
 	/* UART4 */
 	MX31_PIN_PC_RST__CTS5, MX31_PIN_PC_VS2__RTS5,
 	MX31_PIN_PC_BVD2__TXD5, MX31_PIN_PC_BVD1__RXD5,
@@ -101,7 +101,18 @@ static struct platform_device mx31moboard_flash = {
 	.num_resources = 1,
 };
 
-static struct imxuart_platform_data uart_pdata = {
+static int moboard_uart0_init(struct platform_device *pdev)
+{
+	gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack");
+	gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0);
+	return 0;
+}
+
+static struct imxuart_platform_data uart0_pdata = {
+	.init = moboard_uart0_init,
+};
+
+static struct imxuart_platform_data uart4_pdata = {
 	.flags = IMXUART_HAVE_RTSCTS,
 };
 
@@ -284,8 +295,9 @@ static void __init mxc_board_init(void)
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 
-	mxc_register_device(&mxc_uart_device0, &uart_pdata);
-	mxc_register_device(&mxc_uart_device4, &uart_pdata);
+	mxc_register_device(&mxc_uart_device0, &uart0_pdata);
+
+	mxc_register_device(&mxc_uart_device4, &uart4_pdata);
 
 	mx31moboard_init_sel_gpios();
 
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/6] mx31moboard: support for pin linked for battery presence check
  2009-11-03 17:09   ` [PATCH 2/6] mx31moboard: serial port fix Valentin Longchamp
@ 2009-11-03 17:09     ` Valentin Longchamp
  2009-11-03 17:09       ` [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support Valentin Longchamp
  0 siblings, 1 reply; 14+ messages in thread
From: Valentin Longchamp @ 2009-11-03 17:09 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
---
 arch/arm/mach-mx3/mx31moboard-marxbot.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 2bfaffb..6b06faf 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -49,6 +49,8 @@ static unsigned int marxbot_pins[] = {
 	MX31_PIN_TXD2__GPIO1_28,
 	/* dsPIC resets */
 	MX31_PIN_STXD5__GPIO1_21, MX31_PIN_SRXD5__GPIO1_22,
+	/*battery detection */
+	MX31_PIN_LCS0__GPIO3_23,
 };
 
 #define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR)
@@ -133,4 +135,9 @@ void __init mx31moboard_marxbot_init(void)
 	dspics_resets_init();
 
 	mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
+
+	/* battery present pin */
+	gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present");
+	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
+	gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false);
 }
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support
  2009-11-03 17:09     ` [PATCH 3/6] mx31moboard: support for pin linked for battery presence check Valentin Longchamp
@ 2009-11-03 17:09       ` Valentin Longchamp
  2009-11-03 17:09         ` [PATCH 5/6] mx31moboard: initialize ipu device for all the boards Valentin Longchamp
  2009-11-06 14:51         ` [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support Guennadi Liakhovetski
  0 siblings, 2 replies; 14+ messages in thread
From: Valentin Longchamp @ 2009-11-03 17:09 UTC (permalink / raw)
  To: linux-arm-kernel


Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
---
 arch/arm/mach-mx3/mx31moboard.c |  126 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 125 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index ff74fab..f3ab51b 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -26,6 +26,9 @@
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/partitions.h>
 #include <linux/platform_device.h>
+#include <linux/regulator/machine.h>
+#include <linux/mfd/mc13783.h>
+#include <linux/spi/spi.h>
 #include <linux/types.h>
 
 #include <asm/mach-types.h>
@@ -39,7 +42,8 @@
 #include <mach/iomux-mx3.h>
 #include <mach/i2c.h>
 #include <mach/mmc.h>
-#include <mach/mx31.h>
+#include <mach/mx3_camera.h>
+#include <mach/spi.h>
 
 #include "devices.h"
 
@@ -79,6 +83,16 @@ static unsigned int moboard_pins[] = {
 	/* SEL */
 	MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
 	MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
+	/* SPI1 */
+	MX31_PIN_CSPI2_MOSI__MOSI, MX31_PIN_CSPI2_MISO__MISO,
+	MX31_PIN_CSPI2_SCLK__SCLK, MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
+	MX31_PIN_CSPI2_SS0__SS0, MX31_PIN_CSPI2_SS2__SS2,
+	/* Atlas IRQ */
+	MX31_PIN_GPIO1_3__GPIO1_3,
+	/* SPI2 */
+	MX31_PIN_CSPI3_MOSI__MOSI, MX31_PIN_CSPI3_MISO__MISO,
+	MX31_PIN_CSPI3_SCLK__SCLK, MX31_PIN_CSPI3_SPI_RDY__SPI_RDY,
+	MX31_PIN_CSPI2_SS1__CSPI3_SS1,
 };
 
 static struct physmap_flash_data mx31moboard_flash_data = {
@@ -124,6 +138,108 @@ static struct imxi2c_platform_data moboard_i2c1_pdata = {
 	.bitrate = 100000,
 };
 
+static int moboard_spi1_cs[] = {
+	MXC_SPI_CS(0),
+	MXC_SPI_CS(2),
+};
+
+static struct spi_imx_master moboard_spi1_master = {
+	.chipselect	= moboard_spi1_cs,
+	.num_chipselect	= ARRAY_SIZE(moboard_spi1_cs),
+};
+
+static struct regulator_consumer_supply sdhc_consumers[] = {
+	{
+		.dev	= &mxcsdhc_device0.dev,
+		.supply	= "sdhc0_vcc",
+	},
+	{
+		.dev	= &mxcsdhc_device1.dev,
+		.supply	= "sdhc1_vcc",
+	},
+};
+
+static struct regulator_init_data sdhc_vreg_data = {
+	.constraints = {
+		.min_uV = 2700000,
+		.max_uV = 3000000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
+			REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
+		.valid_modes_mask = REGULATOR_MODE_NORMAL |
+			REGULATOR_MODE_FAST,
+		.always_on = 0,
+		.boot_on = 1,
+	},
+	.num_consumer_supplies = ARRAY_SIZE(sdhc_consumers),
+	.consumer_supplies = sdhc_consumers,
+};
+
+static struct regulator_consumer_supply cam_consumers[] = {
+	{
+		.dev	= &mx3_camera.dev,
+		.supply	= "cam_vcc",
+	},
+};
+
+static struct regulator_init_data cam_vreg_data = {
+	.constraints = {
+		.min_uV = 2700000,
+		.max_uV = 3000000,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
+			REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
+		.valid_modes_mask = REGULATOR_MODE_NORMAL |
+			REGULATOR_MODE_FAST,
+		.always_on = 0,
+		.boot_on = 1,
+	},
+	.num_consumer_supplies = ARRAY_SIZE(cam_consumers),
+	.consumer_supplies = cam_consumers,
+};
+
+static struct mc13783_regulator_init_data moboard_regulators[] = {
+	{
+		.id = MC13783_REGU_VMMC1,
+		.init_data = &sdhc_vreg_data,
+	},
+	{
+		.id = MC13783_REGU_VCAM,
+		.init_data = &cam_vreg_data,
+	},
+};
+
+static struct mc13783_platform_data moboard_pmic = {
+	.regulators = moboard_regulators,
+	.num_regulators = ARRAY_SIZE(moboard_regulators),
+	.flags = MC13783_USE_REGULATOR | MC13783_USE_RTC,
+};
+
+static struct spi_board_info moboard_spi_board_info[] __initdata = {
+	{
+		.modalias = "mc13783",
+		.irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
+		.max_speed_hz = 300000,
+		.bus_num = 1,
+		.chip_select = 0,
+		.platform_data = &moboard_pmic,
+		.mode = SPI_CS_HIGH,
+	},
+	{
+		.modalias = "spidev",
+		.max_speed_hz = 300000,
+		.bus_num = 1,
+		.chip_select = 1, /* according spi1_cs[] ! */
+	},
+};
+
+static int moboard_spi2_cs[] = {
+	MXC_SPI_CS(1),
+};
+
+static struct spi_imx_master moboard_spi2_master = {
+	.chipselect	= moboard_spi2_cs,
+	.num_chipselect	= ARRAY_SIZE(moboard_spi2_cs),
+};
+
 #define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0)
 #define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1)
 
@@ -304,6 +420,14 @@ static void __init mxc_board_init(void)
 	mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata);
 	mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata);
 
+	mxc_register_device(&mxc_spi_device1, &moboard_spi1_master);
+	mxc_register_device(&mxc_spi_device2, &moboard_spi2_master);
+
+	gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
+	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
+	spi_register_board_info(moboard_spi_board_info,
+		ARRAY_SIZE(moboard_spi_board_info));
+
 	mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
 
 	usb_xcvr_reset();
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/6] mx31moboard: initialize ipu device for all the boards
  2009-11-03 17:09       ` [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support Valentin Longchamp
@ 2009-11-03 17:09         ` Valentin Longchamp
  2009-11-03 17:09           ` [PATCH 6/6] mx31moboard: camera support Valentin Longchamp
  2009-11-06 14:49           ` [PATCH 5/6] mx31moboard: initialize ipu device for all the boards Guennadi Liakhovetski
  2009-11-06 14:51         ` [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support Guennadi Liakhovetski
  1 sibling, 2 replies; 14+ messages in thread
From: Valentin Longchamp @ 2009-11-03 17:09 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
---
 arch/arm/mach-mx3/mx31moboard.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index f3ab51b..2f95dcd 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -40,6 +40,7 @@
 #include <mach/hardware.h>
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
+#include <mach/ipu.h>
 #include <mach/i2c.h>
 #include <mach/mmc.h>
 #include <mach/mx3_camera.h>
@@ -393,6 +394,10 @@ static void mx31moboard_init_sel_gpios(void)
 	}
 }
 
+static struct ipu_platform_data mx3_ipu_data = {
+	.irq_base = MXC_IPU_IRQ_START,
+};
+
 static struct platform_device *devices[] __initdata = {
 	&mx31moboard_flash,
 	&mx31moboard_leds_device,
@@ -430,6 +435,8 @@ static void __init mxc_board_init(void)
 
 	mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
 
+	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
+
 	usb_xcvr_reset();
 
 	moboard_usbotg_init();
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/6] mx31moboard: camera support
  2009-11-03 17:09         ` [PATCH 5/6] mx31moboard: initialize ipu device for all the boards Valentin Longchamp
@ 2009-11-03 17:09           ` Valentin Longchamp
  2009-11-06 14:53             ` Guennadi Liakhovetski
  2009-11-06 14:49           ` [PATCH 5/6] mx31moboard: initialize ipu device for all the boards Guennadi Liakhovetski
  1 sibling, 1 reply; 14+ messages in thread
From: Valentin Longchamp @ 2009-11-03 17:09 UTC (permalink / raw)
  To: linux-arm-kernel

We have two mt9t031 cameras that have a muxed bus on the robot.
Only one is currently initialized because of limitations in
soc_camera that should be removed later.

Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
---
 arch/arm/mach-mx3/mx31moboard-marxbot.c |   86 ++++++++++++++++++++++++++++++-
 arch/arm/mach-mx3/mx31moboard.c         |   36 +++++++++++++
 2 files changed, 121 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 6b06faf..e4e344e 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -16,9 +16,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/delay.h>
 #include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/i2c.h>
 #include <linux/platform_device.h>
 #include <linux/types.h>
 
@@ -28,6 +30,8 @@
 #include <mach/iomux-mx3.h>
 #include <mach/mmc.h>
 
+#include <media/soc_camera.h>
+
 #include "devices.h"
 
 static unsigned int marxbot_pins[] = {
@@ -37,7 +41,6 @@ static unsigned int marxbot_pins[] = {
 	MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD,
 	MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29,
 	/* CSI */
-	MX31_PIN_CSI_D4__CSI_D4, MX31_PIN_CSI_D5__CSI_D5,
 	MX31_PIN_CSI_D6__CSI_D6, MX31_PIN_CSI_D7__CSI_D7,
 	MX31_PIN_CSI_D8__CSI_D8, MX31_PIN_CSI_D9__CSI_D9,
 	MX31_PIN_CSI_D10__CSI_D10, MX31_PIN_CSI_D11__CSI_D11,
@@ -45,6 +48,7 @@ static unsigned int marxbot_pins[] = {
 	MX31_PIN_CSI_D14__CSI_D14, MX31_PIN_CSI_D15__CSI_D15,
 	MX31_PIN_CSI_HSYNC__CSI_HSYNC, MX31_PIN_CSI_MCLK__CSI_MCLK,
 	MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC,
+	MX31_PIN_CSI_D4__GPIO3_4, MX31_PIN_CSI_D5__GPIO3_5,
 	MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1,
 	MX31_PIN_TXD2__GPIO1_28,
 	/* dsPIC resets */
@@ -122,6 +126,83 @@ static void dspics_resets_init(void)
 	}
 }
 
+#define TURRETCAM_POWER	IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)
+#define BASECAM_POWER	IOMUX_TO_GPIO(MX31_PIN_CSI_D5)
+#define TURRETCAM_RST_B	IOMUX_TO_GPIO(MX31_PIN_GPIO3_0)
+#define BASECAM_RST_B	IOMUX_TO_GPIO(MX31_PIN_CSI_D4)
+#define CAM_CHOICE	IOMUX_TO_GPIO(MX31_PIN_TXD2)
+
+static int marxbot_basecam_power(struct device *dev, int on)
+{
+	gpio_set_value(BASECAM_POWER, !on);
+	return 0;
+}
+
+static int marxbot_basecam_reset(struct device *dev)
+{
+	gpio_set_value(BASECAM_RST_B, 0);
+	udelay(100);
+	gpio_set_value(BASECAM_RST_B, 1);
+	return 0;
+}
+
+static struct i2c_board_info marxbot_i2c_devices[] = {
+	{
+		I2C_BOARD_INFO("mt9t031", 0x5d),
+	},
+};
+
+static struct soc_camera_link base_iclink = {
+	.bus_id		= 0,		/* Must match with the camera ID */
+	.power		= marxbot_basecam_power,
+	.reset		= marxbot_basecam_reset,
+	.board_info	= &marxbot_i2c_devices[0],
+	.i2c_adapter_id	= 0,
+	.module_name	= "mt9t031",
+};
+
+static struct platform_device marxbot_camera[] = {
+	{
+		.name	= "soc-camera-pdrv",
+		.id	= 0,
+		.dev	= {
+			.platform_data = &base_iclink,
+		},
+	},
+};
+
+static struct platform_device *marxbot_cameras[] __initdata = {
+	&marxbot_camera[0],
+};
+
+static int __init marxbot_cam_init(void)
+{
+	int ret = gpio_request(CAM_CHOICE, "cam-choice");
+	if (ret)
+		return ret;
+	gpio_direction_output(CAM_CHOICE, 1);
+
+	ret = gpio_request(BASECAM_RST_B, "basecam-reset");
+	if (ret)
+		return ret;
+	gpio_direction_output(BASECAM_RST_B, 1);
+	ret = gpio_request(BASECAM_POWER, "basecam-standby");
+	if (ret)
+		return ret;
+	gpio_direction_output(BASECAM_POWER, 0);
+
+	ret = gpio_request(TURRETCAM_RST_B, "turretcam-reset");
+	if (ret)
+		return ret;
+	gpio_direction_output(TURRETCAM_RST_B, 1);
+	ret = gpio_request(TURRETCAM_POWER, "turretcam-standby");
+	if (ret)
+		return ret;
+	gpio_direction_output(TURRETCAM_POWER, 0);
+
+	return 0;
+}
+
 /*
  * system init for baseboard usage. Will be called by mx31moboard init.
  */
@@ -136,6 +217,9 @@ void __init mx31moboard_marxbot_init(void)
 
 	mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
 
+	marxbot_cam_init();
+	platform_add_devices(marxbot_cameras, ARRAY_SIZE(marxbot_cameras));
+
 	/* battery present pin */
 	gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present");
 	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index 2f95dcd..b167f13 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -17,6 +17,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/dma-mapping.h>
 #include <linux/fsl_devices.h>
 #include <linux/gpio.h>
 #include <linux/init.h>
@@ -403,6 +404,39 @@ static struct platform_device *devices[] __initdata = {
 	&mx31moboard_leds_device,
 };
 
+static struct mx3_camera_pdata camera_pdata = {
+	.dma_dev	= &mx3_ipu.dev,
+	.flags		= MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10,
+	.mclk_10khz	= 4800,
+};
+
+#define CAMERA_BUF_SIZE	(4*1024*1024)
+
+static int __init mx31moboard_cam_alloc_dma(const size_t buf_size)
+{
+	dma_addr_t dma_handle;
+	void *buf;
+	int dma;
+
+	if (buf_size < 2 * 1024 * 1024)
+		return -EINVAL;
+
+	buf = dma_alloc_coherent(NULL, buf_size, &dma_handle, GFP_KERNEL);
+	if (!buf) {
+		pr_err("%s: cannot allocate camera buffer-memory\n", __func__);
+		return -ENOMEM;
+	}
+
+	memset(buf, 0, buf_size);
+
+	dma = dma_declare_coherent_memory(&mx3_camera.dev,
+					dma_handle, dma_handle, buf_size,
+					DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
+
+	/* The way we call dma_declare_coherent_memory only a malloc can fail */
+	return dma & DMA_MEMORY_MAP ? 0 : -ENOMEM;
+}
+
 static int mx31moboard_baseboard;
 core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
 
@@ -436,6 +470,8 @@ static void __init mxc_board_init(void)
 	mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
 
 	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
+	if (!mx31moboard_cam_alloc_dma(CAMERA_BUF_SIZE))
+		mxc_register_device(&mx3_camera, &camera_pdata);
 
 	usb_xcvr_reset();
 
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 0/6] mx31moboard: patches for next merge window v2
  2009-11-03 17:09 [PATCH 0/6] mx31moboard: patches for next merge window v2 Valentin Longchamp
  2009-11-03 17:09 ` [PATCH 1/6] mx31: various pins used for mx31moboard Valentin Longchamp
@ 2009-11-05  7:29 ` Sascha Hauer
  2009-11-05  7:40 ` Daniel Mack
  2 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2009-11-05  7:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Valentin,

On Tue, Nov 03, 2009 at 06:09:45PM +0100, Valentin Longchamp wrote:
> Here are the patches I would like to push during the next merge window for
> the mx31moboard platform.
> 
> It consists of a fix for a small hardware design issue for the main serial
> port, a few GPIOs used on the robots that are declared, camera support and
> finally MC13783 support as it is now getting ready.
> 
> For MC13783, we need RTC as well, but it was not tested yet since it is not
> in mainline yet.
> 
> The camera part works for one camera. The soc_camera needs some reworking
> before we are able to support the two cameras we have on the robot
> 
> The main peripheral that we are using and that still is missing is the USB
> host, but since the driver still needs a few improvements, I keep it aside
> for now.
> 
> Changes since v1:
> - changed the patches order
> - support for a single camera
> - corrected typos and comments from earlier version

ok, applied to mxc-master.

Sascha


-- 
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 |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 0/6] mx31moboard: patches for next merge window v2
  2009-11-03 17:09 [PATCH 0/6] mx31moboard: patches for next merge window v2 Valentin Longchamp
  2009-11-03 17:09 ` [PATCH 1/6] mx31: various pins used for mx31moboard Valentin Longchamp
  2009-11-05  7:29 ` [PATCH 0/6] mx31moboard: patches for next merge window v2 Sascha Hauer
@ 2009-11-05  7:40 ` Daniel Mack
  2009-11-05 11:33   ` Valentin Longchamp
  2 siblings, 1 reply; 14+ messages in thread
From: Daniel Mack @ 2009-11-05  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 03, 2009 at 06:09:45PM +0100, Valentin Longchamp wrote:
> The main peripheral that we are using and that still is missing is the USB
> host, but since the driver still needs a few improvements, I keep it aside
> for now.

It has been added to Greg's usb-linux tree now. And I posted some more
versions of the ulpi viewport support to Sascha and the linux-usb ML
(unfortunately, someone culled the arm-linux ML from Cc which I realized
way too late).

So, if Sascha applied the ulpi patch, all pieces should be on their way
to mainline now. Finally :)

Daniel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 0/6] mx31moboard: patches for next merge window v2
  2009-11-05  7:40 ` Daniel Mack
@ 2009-11-05 11:33   ` Valentin Longchamp
  0 siblings, 0 replies; 14+ messages in thread
From: Valentin Longchamp @ 2009-11-05 11:33 UTC (permalink / raw)
  To: linux-arm-kernel

Sacha,

Daniel Mack wrote:
> On Tue, Nov 03, 2009 at 06:09:45PM +0100, Valentin Longchamp wrote:
>> The main peripheral that we are using and that still is missing is the USB
>> host, but since the driver still needs a few improvements, I keep it aside
>> for now.
> 
> It has been added to Greg's usb-linux tree now. And I posted some more
> versions of the ulpi viewport support to Sascha and the linux-usb ML
> (unfortunately, someone culled the arm-linux ML from Cc which I realized
> way too late).
> 
> So, if Sascha applied the ulpi patch, all pieces should be on their way
> to mainline now. Finally :)
> 

Cool that all pieces now are on the way to mainline.

Since the ulpi patch is the only remaining part, are you going to push 
it for the next release ?

If yes I will add my mx31moboard USB patch to the ones that could be 
pushed for the next arm merge window.

Val

-- 
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
valentin.longchamp at epfl.ch, Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEA3485, Station 9, CH-1015 Lausanne

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 5/6] mx31moboard: initialize ipu device for all the boards
  2009-11-03 17:09         ` [PATCH 5/6] mx31moboard: initialize ipu device for all the boards Valentin Longchamp
  2009-11-03 17:09           ` [PATCH 6/6] mx31moboard: camera support Valentin Longchamp
@ 2009-11-06 14:49           ` Guennadi Liakhovetski
  1 sibling, 0 replies; 14+ messages in thread
From: Guennadi Liakhovetski @ 2009-11-06 14:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 3 Nov 2009, Valentin Longchamp wrote:

> Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>

I cannot judge whether you really need IPU support for "all" (mx31moboard) 
boards, and I also do not know how many of them you have in some 
development trees, so far I only see one CONFIG_MACH_MX31MOBOARD option in 
in a recent "next," but technically you can add

Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Thanks
Guennadi

> ---
>  arch/arm/mach-mx3/mx31moboard.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
> index f3ab51b..2f95dcd 100644
> --- a/arch/arm/mach-mx3/mx31moboard.c
> +++ b/arch/arm/mach-mx3/mx31moboard.c
> @@ -40,6 +40,7 @@
>  #include <mach/hardware.h>
>  #include <mach/imx-uart.h>
>  #include <mach/iomux-mx3.h>
> +#include <mach/ipu.h>
>  #include <mach/i2c.h>
>  #include <mach/mmc.h>
>  #include <mach/mx3_camera.h>
> @@ -393,6 +394,10 @@ static void mx31moboard_init_sel_gpios(void)
>  	}
>  }
>  
> +static struct ipu_platform_data mx3_ipu_data = {
> +	.irq_base = MXC_IPU_IRQ_START,
> +};
> +
>  static struct platform_device *devices[] __initdata = {
>  	&mx31moboard_flash,
>  	&mx31moboard_leds_device,
> @@ -430,6 +435,8 @@ static void __init mxc_board_init(void)
>  
>  	mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
>  
> +	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
> +
>  	usb_xcvr_reset();
>  
>  	moboard_usbotg_init();
> -- 
> 1.6.3.3
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support
  2009-11-03 17:09       ` [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support Valentin Longchamp
  2009-11-03 17:09         ` [PATCH 5/6] mx31moboard: initialize ipu device for all the boards Valentin Longchamp
@ 2009-11-06 14:51         ` Guennadi Liakhovetski
  2009-11-06 15:36           ` Valentin Longchamp
  1 sibling, 1 reply; 14+ messages in thread
From: Guennadi Liakhovetski @ 2009-11-06 14:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 3 Nov 2009, Valentin Longchamp wrote:

> 
> Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
> ---
>  arch/arm/mach-mx3/mx31moboard.c |  126 ++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 125 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
> index ff74fab..f3ab51b 100644
> --- a/arch/arm/mach-mx3/mx31moboard.c
> +++ b/arch/arm/mach-mx3/mx31moboard.c
> @@ -26,6 +26,9 @@
>  #include <linux/mtd/physmap.h>
>  #include <linux/mtd/partitions.h>
>  #include <linux/platform_device.h>
> +#include <linux/regulator/machine.h>
> +#include <linux/mfd/mc13783.h>
> +#include <linux/spi/spi.h>
>  #include <linux/types.h>
>  
>  #include <asm/mach-types.h>
> @@ -39,7 +42,8 @@
>  #include <mach/iomux-mx3.h>
>  #include <mach/i2c.h>
>  #include <mach/mmc.h>
> -#include <mach/mx31.h>
> +#include <mach/mx3_camera.h>

Yes, that's what I thought it would be: you added the mx3_camera.h header 
in a wrong patch. Don't know if this is bad enough to redo at least these 
two patches.

Thanks
Guennadi

> +#include <mach/spi.h>
>  
>  #include "devices.h"
>  
> @@ -79,6 +83,16 @@ static unsigned int moboard_pins[] = {
>  	/* SEL */
>  	MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
>  	MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
> +	/* SPI1 */
> +	MX31_PIN_CSPI2_MOSI__MOSI, MX31_PIN_CSPI2_MISO__MISO,
> +	MX31_PIN_CSPI2_SCLK__SCLK, MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
> +	MX31_PIN_CSPI2_SS0__SS0, MX31_PIN_CSPI2_SS2__SS2,
> +	/* Atlas IRQ */
> +	MX31_PIN_GPIO1_3__GPIO1_3,
> +	/* SPI2 */
> +	MX31_PIN_CSPI3_MOSI__MOSI, MX31_PIN_CSPI3_MISO__MISO,
> +	MX31_PIN_CSPI3_SCLK__SCLK, MX31_PIN_CSPI3_SPI_RDY__SPI_RDY,
> +	MX31_PIN_CSPI2_SS1__CSPI3_SS1,
>  };
>  
>  static struct physmap_flash_data mx31moboard_flash_data = {
> @@ -124,6 +138,108 @@ static struct imxi2c_platform_data moboard_i2c1_pdata = {
>  	.bitrate = 100000,
>  };
>  
> +static int moboard_spi1_cs[] = {
> +	MXC_SPI_CS(0),
> +	MXC_SPI_CS(2),
> +};
> +
> +static struct spi_imx_master moboard_spi1_master = {
> +	.chipselect	= moboard_spi1_cs,
> +	.num_chipselect	= ARRAY_SIZE(moboard_spi1_cs),
> +};
> +
> +static struct regulator_consumer_supply sdhc_consumers[] = {
> +	{
> +		.dev	= &mxcsdhc_device0.dev,
> +		.supply	= "sdhc0_vcc",
> +	},
> +	{
> +		.dev	= &mxcsdhc_device1.dev,
> +		.supply	= "sdhc1_vcc",
> +	},
> +};
> +
> +static struct regulator_init_data sdhc_vreg_data = {
> +	.constraints = {
> +		.min_uV = 2700000,
> +		.max_uV = 3000000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
> +			REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
> +		.valid_modes_mask = REGULATOR_MODE_NORMAL |
> +			REGULATOR_MODE_FAST,
> +		.always_on = 0,
> +		.boot_on = 1,
> +	},
> +	.num_consumer_supplies = ARRAY_SIZE(sdhc_consumers),
> +	.consumer_supplies = sdhc_consumers,
> +};
> +
> +static struct regulator_consumer_supply cam_consumers[] = {
> +	{
> +		.dev	= &mx3_camera.dev,
> +		.supply	= "cam_vcc",
> +	},
> +};
> +
> +static struct regulator_init_data cam_vreg_data = {
> +	.constraints = {
> +		.min_uV = 2700000,
> +		.max_uV = 3000000,
> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
> +			REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
> +		.valid_modes_mask = REGULATOR_MODE_NORMAL |
> +			REGULATOR_MODE_FAST,
> +		.always_on = 0,
> +		.boot_on = 1,
> +	},
> +	.num_consumer_supplies = ARRAY_SIZE(cam_consumers),
> +	.consumer_supplies = cam_consumers,
> +};
> +
> +static struct mc13783_regulator_init_data moboard_regulators[] = {
> +	{
> +		.id = MC13783_REGU_VMMC1,
> +		.init_data = &sdhc_vreg_data,
> +	},
> +	{
> +		.id = MC13783_REGU_VCAM,
> +		.init_data = &cam_vreg_data,
> +	},
> +};
> +
> +static struct mc13783_platform_data moboard_pmic = {
> +	.regulators = moboard_regulators,
> +	.num_regulators = ARRAY_SIZE(moboard_regulators),
> +	.flags = MC13783_USE_REGULATOR | MC13783_USE_RTC,
> +};
> +
> +static struct spi_board_info moboard_spi_board_info[] __initdata = {
> +	{
> +		.modalias = "mc13783",
> +		.irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
> +		.max_speed_hz = 300000,
> +		.bus_num = 1,
> +		.chip_select = 0,
> +		.platform_data = &moboard_pmic,
> +		.mode = SPI_CS_HIGH,
> +	},
> +	{
> +		.modalias = "spidev",
> +		.max_speed_hz = 300000,
> +		.bus_num = 1,
> +		.chip_select = 1, /* according spi1_cs[] ! */
> +	},
> +};
> +
> +static int moboard_spi2_cs[] = {
> +	MXC_SPI_CS(1),
> +};
> +
> +static struct spi_imx_master moboard_spi2_master = {
> +	.chipselect	= moboard_spi2_cs,
> +	.num_chipselect	= ARRAY_SIZE(moboard_spi2_cs),
> +};
> +
>  #define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0)
>  #define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1)
>  
> @@ -304,6 +420,14 @@ static void __init mxc_board_init(void)
>  	mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata);
>  	mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata);
>  
> +	mxc_register_device(&mxc_spi_device1, &moboard_spi1_master);
> +	mxc_register_device(&mxc_spi_device2, &moboard_spi2_master);
> +
> +	gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
> +	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
> +	spi_register_board_info(moboard_spi_board_info,
> +		ARRAY_SIZE(moboard_spi_board_info));
> +
>  	mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
>  
>  	usb_xcvr_reset();
> -- 
> 1.6.3.3
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 6/6] mx31moboard: camera support
  2009-11-03 17:09           ` [PATCH 6/6] mx31moboard: camera support Valentin Longchamp
@ 2009-11-06 14:53             ` Guennadi Liakhovetski
  0 siblings, 0 replies; 14+ messages in thread
From: Guennadi Liakhovetski @ 2009-11-06 14:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 3 Nov 2009, Valentin Longchamp wrote:

> We have two mt9t031 cameras that have a muxed bus on the robot.
> Only one is currently initialized because of limitations in
> soc_camera that should be removed later.
> 
> Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>

As mentioned in my reply to another patch (4/6) in this series, now this 
patch is missing the header include. But if Sascha is ready to get them 
with this small inaccuracy

Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Thanks
Guennadi

> ---
>  arch/arm/mach-mx3/mx31moboard-marxbot.c |   86 ++++++++++++++++++++++++++++++-
>  arch/arm/mach-mx3/mx31moboard.c         |   36 +++++++++++++
>  2 files changed, 121 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
> index 6b06faf..e4e344e 100644
> --- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
> +++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
> @@ -16,9 +16,11 @@
>   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>   */
>  
> +#include <linux/delay.h>
>  #include <linux/gpio.h>
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
> +#include <linux/i2c.h>
>  #include <linux/platform_device.h>
>  #include <linux/types.h>
>  
> @@ -28,6 +30,8 @@
>  #include <mach/iomux-mx3.h>
>  #include <mach/mmc.h>
>  
> +#include <media/soc_camera.h>
> +
>  #include "devices.h"
>  
>  static unsigned int marxbot_pins[] = {
> @@ -37,7 +41,6 @@ static unsigned int marxbot_pins[] = {
>  	MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD,
>  	MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29,
>  	/* CSI */
> -	MX31_PIN_CSI_D4__CSI_D4, MX31_PIN_CSI_D5__CSI_D5,
>  	MX31_PIN_CSI_D6__CSI_D6, MX31_PIN_CSI_D7__CSI_D7,
>  	MX31_PIN_CSI_D8__CSI_D8, MX31_PIN_CSI_D9__CSI_D9,
>  	MX31_PIN_CSI_D10__CSI_D10, MX31_PIN_CSI_D11__CSI_D11,
> @@ -45,6 +48,7 @@ static unsigned int marxbot_pins[] = {
>  	MX31_PIN_CSI_D14__CSI_D14, MX31_PIN_CSI_D15__CSI_D15,
>  	MX31_PIN_CSI_HSYNC__CSI_HSYNC, MX31_PIN_CSI_MCLK__CSI_MCLK,
>  	MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC,
> +	MX31_PIN_CSI_D4__GPIO3_4, MX31_PIN_CSI_D5__GPIO3_5,
>  	MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1,
>  	MX31_PIN_TXD2__GPIO1_28,
>  	/* dsPIC resets */
> @@ -122,6 +126,83 @@ static void dspics_resets_init(void)
>  	}
>  }
>  
> +#define TURRETCAM_POWER	IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)
> +#define BASECAM_POWER	IOMUX_TO_GPIO(MX31_PIN_CSI_D5)
> +#define TURRETCAM_RST_B	IOMUX_TO_GPIO(MX31_PIN_GPIO3_0)
> +#define BASECAM_RST_B	IOMUX_TO_GPIO(MX31_PIN_CSI_D4)
> +#define CAM_CHOICE	IOMUX_TO_GPIO(MX31_PIN_TXD2)
> +
> +static int marxbot_basecam_power(struct device *dev, int on)
> +{
> +	gpio_set_value(BASECAM_POWER, !on);
> +	return 0;
> +}
> +
> +static int marxbot_basecam_reset(struct device *dev)
> +{
> +	gpio_set_value(BASECAM_RST_B, 0);
> +	udelay(100);
> +	gpio_set_value(BASECAM_RST_B, 1);
> +	return 0;
> +}
> +
> +static struct i2c_board_info marxbot_i2c_devices[] = {
> +	{
> +		I2C_BOARD_INFO("mt9t031", 0x5d),
> +	},
> +};
> +
> +static struct soc_camera_link base_iclink = {
> +	.bus_id		= 0,		/* Must match with the camera ID */
> +	.power		= marxbot_basecam_power,
> +	.reset		= marxbot_basecam_reset,
> +	.board_info	= &marxbot_i2c_devices[0],
> +	.i2c_adapter_id	= 0,
> +	.module_name	= "mt9t031",
> +};
> +
> +static struct platform_device marxbot_camera[] = {
> +	{
> +		.name	= "soc-camera-pdrv",
> +		.id	= 0,
> +		.dev	= {
> +			.platform_data = &base_iclink,
> +		},
> +	},
> +};
> +
> +static struct platform_device *marxbot_cameras[] __initdata = {
> +	&marxbot_camera[0],
> +};
> +
> +static int __init marxbot_cam_init(void)
> +{
> +	int ret = gpio_request(CAM_CHOICE, "cam-choice");
> +	if (ret)
> +		return ret;
> +	gpio_direction_output(CAM_CHOICE, 1);
> +
> +	ret = gpio_request(BASECAM_RST_B, "basecam-reset");
> +	if (ret)
> +		return ret;
> +	gpio_direction_output(BASECAM_RST_B, 1);
> +	ret = gpio_request(BASECAM_POWER, "basecam-standby");
> +	if (ret)
> +		return ret;
> +	gpio_direction_output(BASECAM_POWER, 0);
> +
> +	ret = gpio_request(TURRETCAM_RST_B, "turretcam-reset");
> +	if (ret)
> +		return ret;
> +	gpio_direction_output(TURRETCAM_RST_B, 1);
> +	ret = gpio_request(TURRETCAM_POWER, "turretcam-standby");
> +	if (ret)
> +		return ret;
> +	gpio_direction_output(TURRETCAM_POWER, 0);
> +
> +	return 0;
> +}
> +
>  /*
>   * system init for baseboard usage. Will be called by mx31moboard init.
>   */
> @@ -136,6 +217,9 @@ void __init mx31moboard_marxbot_init(void)
>  
>  	mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
>  
> +	marxbot_cam_init();
> +	platform_add_devices(marxbot_cameras, ARRAY_SIZE(marxbot_cameras));
> +
>  	/* battery present pin */
>  	gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present");
>  	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
> diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
> index 2f95dcd..b167f13 100644
> --- a/arch/arm/mach-mx3/mx31moboard.c
> +++ b/arch/arm/mach-mx3/mx31moboard.c
> @@ -17,6 +17,7 @@
>   */
>  
>  #include <linux/delay.h>
> +#include <linux/dma-mapping.h>
>  #include <linux/fsl_devices.h>
>  #include <linux/gpio.h>
>  #include <linux/init.h>
> @@ -403,6 +404,39 @@ static struct platform_device *devices[] __initdata = {
>  	&mx31moboard_leds_device,
>  };
>  
> +static struct mx3_camera_pdata camera_pdata = {
> +	.dma_dev	= &mx3_ipu.dev,
> +	.flags		= MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10,
> +	.mclk_10khz	= 4800,
> +};
> +
> +#define CAMERA_BUF_SIZE	(4*1024*1024)
> +
> +static int __init mx31moboard_cam_alloc_dma(const size_t buf_size)
> +{
> +	dma_addr_t dma_handle;
> +	void *buf;
> +	int dma;
> +
> +	if (buf_size < 2 * 1024 * 1024)
> +		return -EINVAL;
> +
> +	buf = dma_alloc_coherent(NULL, buf_size, &dma_handle, GFP_KERNEL);
> +	if (!buf) {
> +		pr_err("%s: cannot allocate camera buffer-memory\n", __func__);
> +		return -ENOMEM;
> +	}
> +
> +	memset(buf, 0, buf_size);
> +
> +	dma = dma_declare_coherent_memory(&mx3_camera.dev,
> +					dma_handle, dma_handle, buf_size,
> +					DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
> +
> +	/* The way we call dma_declare_coherent_memory only a malloc can fail */
> +	return dma & DMA_MEMORY_MAP ? 0 : -ENOMEM;
> +}
> +
>  static int mx31moboard_baseboard;
>  core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
>  
> @@ -436,6 +470,8 @@ static void __init mxc_board_init(void)
>  	mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
>  
>  	mxc_register_device(&mx3_ipu, &mx3_ipu_data);
> +	if (!mx31moboard_cam_alloc_dma(CAMERA_BUF_SIZE))
> +		mxc_register_device(&mx3_camera, &camera_pdata);
>  
>  	usb_xcvr_reset();
>  
> -- 
> 1.6.3.3
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support
  2009-11-06 14:51         ` [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support Guennadi Liakhovetski
@ 2009-11-06 15:36           ` Valentin Longchamp
  0 siblings, 0 replies; 14+ messages in thread
From: Valentin Longchamp @ 2009-11-06 15:36 UTC (permalink / raw)
  To: linux-arm-kernel

Guennadi Liakhovetski wrote:
> On Tue, 3 Nov 2009, Valentin Longchamp wrote:
> 
>> Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
>> ---
>>  arch/arm/mach-mx3/mx31moboard.c |  126 ++++++++++++++++++++++++++++++++++++++-
>>  1 files changed, 125 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
>> index ff74fab..f3ab51b 100644
>> --- a/arch/arm/mach-mx3/mx31moboard.c
>> +++ b/arch/arm/mach-mx3/mx31moboard.c
>> @@ -26,6 +26,9 @@
>>  #include <linux/mtd/physmap.h>
>>  #include <linux/mtd/partitions.h>
>>  #include <linux/platform_device.h>
>> +#include <linux/regulator/machine.h>
>> +#include <linux/mfd/mc13783.h>
>> +#include <linux/spi/spi.h>
>>  #include <linux/types.h>
>>  
>>  #include <asm/mach-types.h>
>> @@ -39,7 +42,8 @@
>>  #include <mach/iomux-mx3.h>
>>  #include <mach/i2c.h>
>>  #include <mach/mmc.h>
>> -#include <mach/mx31.h>
>> +#include <mach/mx3_camera.h>
> 
> Yes, that's what I thought it would be: you added the mx3_camera.h header 
> in a wrong patch. Don't know if this is bad enough to redo at least these 
> two patches.

Sorry for this error, git rebase had me again (I watched out for 
dma-mapping.h but this one got though).

I have a small addition for this exact patch, I will redo them.

Thanks for the comments and review.

Val

> 
> Thanks
> Guennadi
> 
>> +#include <mach/spi.h>
>>  
>>  #include "devices.h"
>>  
>> @@ -79,6 +83,16 @@ static unsigned int moboard_pins[] = {
>>  	/* SEL */
>>  	MX31_PIN_DTR_DCE1__GPIO2_8, MX31_PIN_DSR_DCE1__GPIO2_9,
>>  	MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
>> +	/* SPI1 */
>> +	MX31_PIN_CSPI2_MOSI__MOSI, MX31_PIN_CSPI2_MISO__MISO,
>> +	MX31_PIN_CSPI2_SCLK__SCLK, MX31_PIN_CSPI2_SPI_RDY__SPI_RDY,
>> +	MX31_PIN_CSPI2_SS0__SS0, MX31_PIN_CSPI2_SS2__SS2,
>> +	/* Atlas IRQ */
>> +	MX31_PIN_GPIO1_3__GPIO1_3,
>> +	/* SPI2 */
>> +	MX31_PIN_CSPI3_MOSI__MOSI, MX31_PIN_CSPI3_MISO__MISO,
>> +	MX31_PIN_CSPI3_SCLK__SCLK, MX31_PIN_CSPI3_SPI_RDY__SPI_RDY,
>> +	MX31_PIN_CSPI2_SS1__CSPI3_SS1,
>>  };
>>  
>>  static struct physmap_flash_data mx31moboard_flash_data = {
>> @@ -124,6 +138,108 @@ static struct imxi2c_platform_data moboard_i2c1_pdata = {
>>  	.bitrate = 100000,
>>  };
>>  
>> +static int moboard_spi1_cs[] = {
>> +	MXC_SPI_CS(0),
>> +	MXC_SPI_CS(2),
>> +};
>> +
>> +static struct spi_imx_master moboard_spi1_master = {
>> +	.chipselect	= moboard_spi1_cs,
>> +	.num_chipselect	= ARRAY_SIZE(moboard_spi1_cs),
>> +};
>> +
>> +static struct regulator_consumer_supply sdhc_consumers[] = {
>> +	{
>> +		.dev	= &mxcsdhc_device0.dev,
>> +		.supply	= "sdhc0_vcc",
>> +	},
>> +	{
>> +		.dev	= &mxcsdhc_device1.dev,
>> +		.supply	= "sdhc1_vcc",
>> +	},
>> +};
>> +
>> +static struct regulator_init_data sdhc_vreg_data = {
>> +	.constraints = {
>> +		.min_uV = 2700000,
>> +		.max_uV = 3000000,
>> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
>> +			REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
>> +		.valid_modes_mask = REGULATOR_MODE_NORMAL |
>> +			REGULATOR_MODE_FAST,
>> +		.always_on = 0,
>> +		.boot_on = 1,
>> +	},
>> +	.num_consumer_supplies = ARRAY_SIZE(sdhc_consumers),
>> +	.consumer_supplies = sdhc_consumers,
>> +};
>> +
>> +static struct regulator_consumer_supply cam_consumers[] = {
>> +	{
>> +		.dev	= &mx3_camera.dev,
>> +		.supply	= "cam_vcc",
>> +	},
>> +};
>> +
>> +static struct regulator_init_data cam_vreg_data = {
>> +	.constraints = {
>> +		.min_uV = 2700000,
>> +		.max_uV = 3000000,
>> +		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
>> +			REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
>> +		.valid_modes_mask = REGULATOR_MODE_NORMAL |
>> +			REGULATOR_MODE_FAST,
>> +		.always_on = 0,
>> +		.boot_on = 1,
>> +	},
>> +	.num_consumer_supplies = ARRAY_SIZE(cam_consumers),
>> +	.consumer_supplies = cam_consumers,
>> +};
>> +
>> +static struct mc13783_regulator_init_data moboard_regulators[] = {
>> +	{
>> +		.id = MC13783_REGU_VMMC1,
>> +		.init_data = &sdhc_vreg_data,
>> +	},
>> +	{
>> +		.id = MC13783_REGU_VCAM,
>> +		.init_data = &cam_vreg_data,
>> +	},
>> +};
>> +
>> +static struct mc13783_platform_data moboard_pmic = {
>> +	.regulators = moboard_regulators,
>> +	.num_regulators = ARRAY_SIZE(moboard_regulators),
>> +	.flags = MC13783_USE_REGULATOR | MC13783_USE_RTC,
>> +};
>> +
>> +static struct spi_board_info moboard_spi_board_info[] __initdata = {
>> +	{
>> +		.modalias = "mc13783",
>> +		.irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
>> +		.max_speed_hz = 300000,
>> +		.bus_num = 1,
>> +		.chip_select = 0,
>> +		.platform_data = &moboard_pmic,
>> +		.mode = SPI_CS_HIGH,
>> +	},
>> +	{
>> +		.modalias = "spidev",
>> +		.max_speed_hz = 300000,
>> +		.bus_num = 1,
>> +		.chip_select = 1, /* according spi1_cs[] ! */
>> +	},
>> +};
>> +
>> +static int moboard_spi2_cs[] = {
>> +	MXC_SPI_CS(1),
>> +};
>> +
>> +static struct spi_imx_master moboard_spi2_master = {
>> +	.chipselect	= moboard_spi2_cs,
>> +	.num_chipselect	= ARRAY_SIZE(moboard_spi2_cs),
>> +};
>> +
>>  #define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0)
>>  #define SDHC1_WP IOMUX_TO_GPIO(MX31_PIN_ATA_CS1)
>>  
>> @@ -304,6 +420,14 @@ static void __init mxc_board_init(void)
>>  	mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata);
>>  	mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata);
>>  
>> +	mxc_register_device(&mxc_spi_device1, &moboard_spi1_master);
>> +	mxc_register_device(&mxc_spi_device2, &moboard_spi2_master);
>> +
>> +	gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
>> +	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
>> +	spi_register_board_info(moboard_spi_board_info,
>> +		ARRAY_SIZE(moboard_spi_board_info));
>> +
>>  	mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
>>  
>>  	usb_xcvr_reset();
>> -- 
>> 1.6.3.3
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>
> 
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/


-- 
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
valentin.longchamp at epfl.ch, Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEA3485, Station 9, CH-1015 Lausanne

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-11-06 15:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-03 17:09 [PATCH 0/6] mx31moboard: patches for next merge window v2 Valentin Longchamp
2009-11-03 17:09 ` [PATCH 1/6] mx31: various pins used for mx31moboard Valentin Longchamp
2009-11-03 17:09   ` [PATCH 2/6] mx31moboard: serial port fix Valentin Longchamp
2009-11-03 17:09     ` [PATCH 3/6] mx31moboard: support for pin linked for battery presence check Valentin Longchamp
2009-11-03 17:09       ` [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support Valentin Longchamp
2009-11-03 17:09         ` [PATCH 5/6] mx31moboard: initialize ipu device for all the boards Valentin Longchamp
2009-11-03 17:09           ` [PATCH 6/6] mx31moboard: camera support Valentin Longchamp
2009-11-06 14:53             ` Guennadi Liakhovetski
2009-11-06 14:49           ` [PATCH 5/6] mx31moboard: initialize ipu device for all the boards Guennadi Liakhovetski
2009-11-06 14:51         ` [PATCH 4/6] mx31moboard: SPI and MC13783 voltage regulator support Guennadi Liakhovetski
2009-11-06 15:36           ` Valentin Longchamp
2009-11-05  7:29 ` [PATCH 0/6] mx31moboard: patches for next merge window v2 Sascha Hauer
2009-11-05  7:40 ` Daniel Mack
2009-11-05 11:33   ` Valentin Longchamp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.