* [PATCH 1/5] ARN: MX3: modularize 'mx31lite' code
@ 2009-11-18 13:41 Daniel Mack
2009-11-18 13:41 ` [PATCH 2/5] ARM: MX3: add MMC/SDHC support to mx31lite-db.c Daniel Mack
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Mack @ 2009-11-18 13:41 UTC (permalink / raw)
To: linux-arm-kernel
This commit splits the support code for LogicPD's mx31lite hardware
into module and board specific parts.
This introduces a new mandatory coreparam called 'mx31lite_baseboard'
which specifies the base board support to use. For now, only the LiteKit
development board is supported, and developers of own boards are
encouraged to use that as reference.
The UART support moved to the board code.
Some comments were amended along the way.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
---
arch/arm/mach-mx3/Makefile | 2 +-
arch/arm/mach-mx3/mx31lite-db.c | 71 +++++++++++++++++++++++
arch/arm/mach-mx3/mx31lite.c | 36 +++++------
arch/arm/plat-mxc/include/mach/board-mx31lite.h | 39 +++++++++++--
4 files changed, 121 insertions(+), 27 deletions(-)
create mode 100644 arch/arm/mach-mx3/mx31lite-db.c
diff --git a/arch/arm/mach-mx3/Makefile b/arch/arm/mach-mx3/Makefile
index be31a9f..68e66a8 100644
--- a/arch/arm/mach-mx3/Makefile
+++ b/arch/arm/mach-mx3/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_ARCH_MX31) += clock.o iomux.o
obj-$(CONFIG_ARCH_MX35) += clock-imx35.o
obj-$(CONFIG_MACH_MX31ADS) += mx31ads.o
obj-$(CONFIG_MACH_MX31LILLY) += mx31lilly.o mx31lilly-db.o
-obj-$(CONFIG_MACH_MX31LITE) += mx31lite.o
+obj-$(CONFIG_MACH_MX31LITE) += mx31lite.o mx31lite-db.o
obj-$(CONFIG_MACH_PCM037) += pcm037.o
obj-$(CONFIG_MACH_PCM037_EET) += pcm037_eet.o
obj-$(CONFIG_MACH_MX31_3DS) += mx31pdk.o
diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
new file mode 100644
index 0000000..751d15e
--- /dev/null
+++ b/arch/arm/mach-mx3/mx31lite-db.c
@@ -0,0 +1,71 @@
+/*
+ * LogicPD i.MX31 SOM-LV development board support
+ *
+ * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
+ *
+ * based on code for other MX31 boards,
+ *
+ * Copyright 2005-2007 Freescale Semiconductor
+ * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
+ * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include <mach/hardware.h>
+#include <mach/common.h>
+#include <mach/imx-uart.h>
+#include <mach/iomux-mx3.h>
+#include <mach/board-mx31lite.h>
+
+#include "devices.h"
+
+/*
+ * This file contains board-specific initialization routines for the
+ * LogicPD i.MX31 SOM-LV development board, aka 'LiteKit'.
+ * If you design an own baseboard for the module, use this file as base
+ * for support code.
+ */
+
+static unsigned int litekit_db_board_pins[] __initdata = {
+ /* UART1 */
+ MX31_PIN_CTS1__CTS1,
+ MX31_PIN_RTS1__RTS1,
+ MX31_PIN_TXD1__TXD1,
+ MX31_PIN_RXD1__RXD1,
+};
+
+/* UART */
+static struct imxuart_platform_data uart_pdata __initdata = {
+ .flags = IMXUART_HAVE_RTSCTS,
+};
+
+void __init mx31lite_db_init(void)
+{
+ mxc_iomux_setup_multiple_pins(litekit_db_board_pins,
+ ARRAY_SIZE(litekit_db_board_pins),
+ "development board pins");
+ mxc_register_device(&mxc_uart_device0, &uart_pdata);
+}
+
diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c
index a8d57de..dc993a8 100644
--- a/arch/arm/mach-mx3/mx31lite.c
+++ b/arch/arm/mach-mx3/mx31lite.c
@@ -42,23 +42,14 @@
#include "devices.h"
/*
- * This file contains the board-specific initialization routines.
+ * This file contains the module-specific initialization routines.
*/
static unsigned int mx31lite_pins[] = {
- /* UART1 */
- MX31_PIN_CTS1__CTS1,
- MX31_PIN_RTS1__RTS1,
- MX31_PIN_TXD1__TXD1,
- MX31_PIN_RXD1__RXD1,
/* LAN9117 IRQ pin */
IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO),
};
-static struct imxuart_platform_data uart_pdata = {
- .flags = IMXUART_HAVE_RTSCTS,
-};
-
static struct mxc_nand_platform_data mx31lite_nand_board_info = {
.width = 1,
.hw_ecc = 1,
@@ -118,17 +109,27 @@ void __init mx31lite_map_io(void)
iotable_init(mx31lite_io_desc, ARRAY_SIZE(mx31lite_io_desc));
}
-/*
- * Board specific initialization.
- */
+static int mx31lite_baseboard;
+core_param(mx31lite_baseboard, mx31lite_baseboard, int, 0444);
+
static void __init mxc_board_init(void)
{
int ret;
+ switch (mx31lite_baseboard) {
+ case MX31LITE_NOBOARD:
+ break;
+ case MX31LITE_DB:
+ mx31lite_db_init();
+ break;
+ default:
+ printk(KERN_ERR "Illegal mx31lite_baseboard type %d\n",
+ mx31lite_baseboard);
+ }
+
mxc_iomux_setup_multiple_pins(mx31lite_pins, ARRAY_SIZE(mx31lite_pins),
"mx31lite");
- mxc_register_device(&mxc_uart_device0, &uart_pdata);
mxc_register_device(&mxc_nand_device, &mx31lite_nand_board_info);
/* SMSC9117 IRQ pin */
@@ -150,12 +151,7 @@ struct sys_timer mx31lite_timer = {
.init = mx31lite_timer_init,
};
-/*
- * The following uses standard kernel macros defined in arch.h in order to
- * initialize __mach_desc_MX31LITE data structure.
- */
-
-MACHINE_START(MX31LITE, "LogicPD MX31 LITEKIT")
+MACHINE_START(MX31LITE, "LogicPD i.MX31 SOM")
/* Maintainer: Freescale Semiconductor, Inc. */
.phys_io = AIPS1_BASE_ADDR,
.io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31lite.h b/arch/arm/plat-mxc/include/mach/board-mx31lite.h
index 8e64325..0184b63 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31lite.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31lite.h
@@ -1,15 +1,42 @@
/*
* Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2009 Daniel Mack <daniel@caiaq.de>
+ *
+ * Based on code for mobots boards,
+ * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
*/
+#ifndef __ASM_ARCH_MXC_BOARD_MX31LITE_H__
+#define __ASM_ARCH_MXC_BOARD_MX31LITE_H__
+
+#ifndef __ASSEMBLY__
+
+enum mx31lilly_boards {
+ MX31LITE_NOBOARD = 0,
+ MX31LITE_DB = 1,
+};
+
/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * This CPU module needs a baseboard to work. After basic initializing
+ * its own devices, it calls baseboard's init function.
*/
-#ifndef __ASM_ARCH_MXC_BOARD_MX31LITE_H__
-#define __ASM_ARCH_MXC_BOARD_MX31LITE_H__
+extern void mx31lite_db_init(void);
-#endif /* __ASM_ARCH_MXC_BOARD_MX31LITE_H__ */
+#endif
+#endif /* __ASM_ARCH_MXC_BOARD_MX31LITE_H__ */
--
1.6.5.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/5] ARM: MX3: add MMC/SDHC support to mx31lite-db.c
2009-11-18 13:41 [PATCH 1/5] ARN: MX3: modularize 'mx31lite' code Daniel Mack
@ 2009-11-18 13:41 ` Daniel Mack
2009-11-18 13:41 ` [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite Daniel Mack
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Mack @ 2009-11-18 13:41 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Daniel Mack <daniel@caiaq.de>
---
arch/arm/mach-mx3/mx31lite-db.c | 70 +++++++++++++++++++++++++++++++++++++++
1 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
index 751d15e..45abae1 100644
--- a/arch/arm/mach-mx3/mx31lite-db.c
+++ b/arch/arm/mach-mx3/mx31lite-db.c
@@ -38,6 +38,7 @@
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>
#include <mach/board-mx31lite.h>
+#include <mach/mmc.h>
#include "devices.h"
@@ -61,11 +62,80 @@ static struct imxuart_platform_data uart_pdata __initdata = {
.flags = IMXUART_HAVE_RTSCTS,
};
+/* MMC */
+
+static int gpio_det, gpio_wp;
+
+#define MMC_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
+ PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
+
+static int mxc_mmc1_get_ro(struct device *dev)
+{
+ return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_LCS0));
+}
+
+static int mxc_mmc1_init(struct device *dev,
+ irq_handler_t detect_irq, void *data)
+{
+ int ret;
+
+ gpio_det = IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1);
+ gpio_wp = IOMUX_TO_GPIO(MX31_PIN_GPIO1_6);
+
+ mxc_iomux_set_pad(MX31_PIN_SD1_DATA0, MMC_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_SD1_DATA1, MMC_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_SD1_DATA2, MMC_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_SD1_DATA3, MMC_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_SD1_CLK, MMC_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_SD1_CMD, MMC_PAD_CFG);
+
+ ret = gpio_request(gpio_det, "MMC detect");
+ if (ret)
+ return ret;
+
+ ret = gpio_request(gpio_wp, "MMC w/p");
+ if (ret)
+ goto exit_free_det;
+
+ gpio_direction_input(gpio_det);
+ gpio_direction_input(gpio_wp);
+
+ ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_DCD_DCE1), detect_irq,
+ IRQF_DISABLED | IRQF_TRIGGER_FALLING,
+ "MMC detect", data);
+ if (ret)
+ goto exit_free_wp;
+
+ return 0;
+
+exit_free_wp:
+ gpio_free(gpio_wp);
+
+exit_free_det:
+ gpio_free(gpio_det);
+
+ return ret;
+}
+
+static void mxc_mmc1_exit(struct device *dev, void *data)
+{
+ gpio_free(gpio_det);
+ gpio_free(gpio_wp);
+ free_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO1_1), data);
+}
+
+static struct imxmmc_platform_data mmc_pdata = {
+ .get_ro = mxc_mmc1_get_ro,
+ .init = mxc_mmc1_init,
+ .exit = mxc_mmc1_exit,
+};
+
void __init mx31lite_db_init(void)
{
mxc_iomux_setup_multiple_pins(litekit_db_board_pins,
ARRAY_SIZE(litekit_db_board_pins),
"development board pins");
mxc_register_device(&mxc_uart_device0, &uart_pdata);
+ mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite
2009-11-18 13:41 ` [PATCH 2/5] ARM: MX3: add MMC/SDHC support to mx31lite-db.c Daniel Mack
@ 2009-11-18 13:41 ` Daniel Mack
2009-11-18 13:41 ` [PATCH 4/5] ARM: MX3: add USB functions for mx31litekit Daniel Mack
2009-11-18 15:37 ` [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite Sascha Hauer
0 siblings, 2 replies; 9+ messages in thread
From: Daniel Mack @ 2009-11-18 13:41 UTC (permalink / raw)
To: linux-arm-kernel
Some header files were reordered while I was at it.
The only device currently registered is the ATLAS PMIC chip.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
---
arch/arm/mach-mx3/mx31lite-db.c | 43 +++++++++++++++++++++++++++++++++++++++
arch/arm/mach-mx3/mx31lite.c | 36 ++++++++++++++++++++++++++++++-
2 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
index 45abae1..1ab92f6 100644
--- a/arch/arm/mach-mx3/mx31lite-db.c
+++ b/arch/arm/mach-mx3/mx31lite-db.c
@@ -28,6 +28,8 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/gpio.h>
+#include <linux/spi/spi.h>
+#include <linux/mfd/mc13783.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -39,6 +41,7 @@
#include <mach/iomux-mx3.h>
#include <mach/board-mx31lite.h>
#include <mach/mmc.h>
+#include <mach/spi.h>
#include "devices.h"
@@ -55,6 +58,14 @@ static unsigned int litekit_db_board_pins[] __initdata = {
MX31_PIN_RTS1__RTS1,
MX31_PIN_TXD1__TXD1,
MX31_PIN_RXD1__RXD1,
+ /* SPI 0 */
+ 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_SS0__SS0,
+ MX31_PIN_CSPI1_SS1__SS1,
+ MX31_PIN_CSPI1_SS2__SS2,
};
/* UART */
@@ -130,6 +141,35 @@ static struct imxmmc_platform_data mmc_pdata = {
.exit = mxc_mmc1_exit,
};
+/* SPI */
+
+static int spi_internal_chipselect[] = {
+ MXC_SPI_CS(0),
+ MXC_SPI_CS(1),
+ MXC_SPI_CS(2),
+};
+
+static struct spi_imx_master spi0_pdata = {
+ .chipselect = spi_internal_chipselect,
+ .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
+};
+
+static struct mc13783_platform_data mc13783_pdata __initdata = {
+ .flags = MC13783_USE_RTC |
+ MC13783_USE_REGULATOR,
+};
+
+static struct spi_board_info litekit_spi_devs[] __initdata = {
+ {
+ .modalias = "mc13783",
+ .max_speed_hz = 1000000,
+ .bus_num = 1,
+ .chip_select = 0,
+ .platform_data = &mc13783_pdata,
+ .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
+ },
+};
+
void __init mx31lite_db_init(void)
{
mxc_iomux_setup_multiple_pins(litekit_db_board_pins,
@@ -137,5 +177,8 @@ void __init mx31lite_db_init(void)
"development board pins");
mxc_register_device(&mxc_uart_device0, &uart_pdata);
mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
+ mxc_register_device(&mxc_spi_device0, &spi0_pdata);
+ spi_register_board_info(litekit_spi_devs,
+ ARRAY_SIZE(litekit_spi_devs));
}
diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c
index dc993a8..b8d8ee1 100644
--- a/arch/arm/mach-mx3/mx31lite.c
+++ b/arch/arm/mach-mx3/mx31lite.c
@@ -2,6 +2,7 @@
* Copyright (C) 2000 Deep Blue Solutions Ltd
* Copyright (C) 2002 Shane Nay (shane at minirl.com)
* Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2009 Daniel Mack <daniel@caiaq.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,19 +27,22 @@
#include <linux/gpio.h>
#include <linux/smsc911x.h>
-#include <mach/hardware.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
#include <asm/mach/map.h>
-#include <mach/common.h>
#include <asm/page.h>
#include <asm/setup.h>
+
+#include <mach/hardware.h>
+#include <mach/common.h>
#include <mach/board-mx31lite.h>
#include <mach/imx-uart.h>
#include <mach/iomux-mx3.h>
#include <mach/irqs.h>
#include <mach/mxc_nand.h>
+#include <mach/spi.h>
+
#include "devices.h"
/*
@@ -48,6 +52,14 @@
static unsigned int mx31lite_pins[] = {
/* LAN9117 IRQ pin */
IOMUX_MODE(MX31_PIN_SFS6, 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_SS1__SS1,
+ MX31_PIN_CSPI2_SS2__SS2,
};
static struct mxc_nand_platform_data mx31lite_nand_board_info = {
@@ -84,6 +96,25 @@ static struct platform_device smsc911x_device = {
};
/*
+ * SPI
+ *
+ * The MX13783 is hard-wired on the module, hence the corresponding
+ * bus is registered here and not in the board code, in contrast to
+ * the other SPI bus.
+ */
+
+static int spi_internal_chipselect[] = {
+ MXC_SPI_CS(0),
+ MXC_SPI_CS(1),
+ MXC_SPI_CS(2),
+};
+
+static struct spi_imx_master spi1_pdata = {
+ .chipselect = spi_internal_chipselect,
+ .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
+};
+
+/*
* This structure defines the MX31 memory map.
*/
static struct map_desc mx31lite_io_desc[] __initdata = {
@@ -131,6 +162,7 @@ static void __init mxc_board_init(void)
"mx31lite");
mxc_register_device(&mxc_nand_device, &mx31lite_nand_board_info);
+ mxc_register_device(&mxc_spi_device1, &spi1_pdata);
/* SMSC9117 IRQ pin */
ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
--
1.6.5.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 4/5] ARM: MX3: add USB functions for mx31litekit
2009-11-18 13:41 ` [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite Daniel Mack
@ 2009-11-18 13:41 ` Daniel Mack
2009-11-18 13:41 ` [PATCH 5/5] ARM: MX3: add support for GPIO LEDs on litekit db Daniel Mack
2009-11-18 15:37 ` [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite Sascha Hauer
1 sibling, 1 reply; 9+ messages in thread
From: Daniel Mack @ 2009-11-18 13:41 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Daniel Mack <daniel@caiaq.de>
---
arch/arm/mach-mx3/mx31lite.c | 60 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c
index b8d8ee1..82e0b0b 100644
--- a/arch/arm/mach-mx3/mx31lite.c
+++ b/arch/arm/mach-mx3/mx31lite.c
@@ -26,6 +26,8 @@
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/smsc911x.h>
+#include <linux/usb/otg.h>
+#include <linux/usb/ulpi.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -42,6 +44,8 @@
#include <mach/irqs.h>
#include <mach/mxc_nand.h>
#include <mach/spi.h>
+#include <mach/mxc_ehci.h>
+#include <mach/ulpi.h>
#include "devices.h"
@@ -115,6 +119,56 @@ static struct spi_imx_master spi1_pdata = {
};
/*
+ * USB
+ */
+
+#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
+ PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
+
+static int usbh2_init(struct platform_device *pdev)
+{
+ int pins[] = {
+ MX31_PIN_USBH2_DATA0__USBH2_DATA0,
+ MX31_PIN_USBH2_DATA1__USBH2_DATA1,
+ MX31_PIN_USBH2_CLK__USBH2_CLK,
+ MX31_PIN_USBH2_DIR__USBH2_DIR,
+ MX31_PIN_USBH2_NXT__USBH2_NXT,
+ MX31_PIN_USBH2_STP__USBH2_STP,
+ };
+
+ mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB H2");
+
+ mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
+ mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
+
+ mxc_iomux_set_gpr(MUX_PGP_UH2, true);
+
+ /* chip select */
+ mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO),
+ "USBH2_CS");
+ gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), "USBH2 CS");
+ gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), 0);
+
+ return 0;
+}
+
+static struct mxc_usbh_platform_data usbh2_pdata = {
+ .init = usbh2_init,
+ .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
+ .flags = MXC_EHCI_POWER_PINS_ENABLED,
+};
+
+/*
* This structure defines the MX31 memory map.
*/
static struct map_desc mx31lite_io_desc[] __initdata = {
@@ -164,6 +218,12 @@ static void __init mxc_board_init(void)
mxc_register_device(&mxc_nand_device, &mx31lite_nand_board_info);
mxc_register_device(&mxc_spi_device1, &spi1_pdata);
+ /* USB */
+ usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
+ USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
+
+ mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+
/* SMSC9117 IRQ pin */
ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
if (ret)
--
1.6.5.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 5/5] ARM: MX3: add support for GPIO LEDs on litekit db
2009-11-18 13:41 ` [PATCH 4/5] ARM: MX3: add USB functions for mx31litekit Daniel Mack
@ 2009-11-18 13:41 ` Daniel Mack
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Mack @ 2009-11-18 13:41 UTC (permalink / raw)
To: linux-arm-kernel
The names are chosen to match the silkscreen.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
---
arch/arm/mach-mx3/mx31lite-db.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
index 1ab92f6..b475634 100644
--- a/arch/arm/mach-mx3/mx31lite-db.c
+++ b/arch/arm/mach-mx3/mx31lite-db.c
@@ -30,6 +30,8 @@
#include <linux/gpio.h>
#include <linux/spi/spi.h>
#include <linux/mfd/mc13783.h>
+#include <linux/leds.h>
+#include <linux/platform_device.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -170,6 +172,36 @@ static struct spi_board_info litekit_spi_devs[] __initdata = {
},
};
+/* GPIO LEDs */
+
+static struct gpio_led litekit_leds[] = {
+ {
+ .name = "GPIO0",
+ .gpio = IOMUX_TO_GPIO(MX31_PIN_COMPARE),
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_OFF,
+ },
+ {
+ .name = "GPIO1",
+ .gpio = IOMUX_TO_GPIO(MX31_PIN_CAPTURE),
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_OFF,
+ }
+};
+
+static struct gpio_led_platform_data litekit_led_platform_data = {
+ .leds = litekit_leds,
+ .num_leds = ARRAY_SIZE(litekit_leds),
+};
+
+static struct platform_device litekit_led_device = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &litekit_led_platform_data,
+ },
+};
+
void __init mx31lite_db_init(void)
{
mxc_iomux_setup_multiple_pins(litekit_db_board_pins,
@@ -180,5 +212,6 @@ void __init mx31lite_db_init(void)
mxc_register_device(&mxc_spi_device0, &spi0_pdata);
spi_register_board_info(litekit_spi_devs,
ARRAY_SIZE(litekit_spi_devs));
+ platform_device_register(&litekit_led_device);
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite
2009-11-18 13:41 ` [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite Daniel Mack
2009-11-18 13:41 ` [PATCH 4/5] ARM: MX3: add USB functions for mx31litekit Daniel Mack
@ 2009-11-18 15:37 ` Sascha Hauer
2009-11-18 15:42 ` Daniel Mack
1 sibling, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2009-11-18 15:37 UTC (permalink / raw)
To: linux-arm-kernel
Hi Daniel,
On Wed, Nov 18, 2009 at 02:41:40PM +0100, Daniel Mack wrote:
> Some header files were reordered while I was at it.
> The only device currently registered is the ATLAS PMIC chip.
>
> Signed-off-by: Daniel Mack <daniel@caiaq.de>
> ---
> arch/arm/mach-mx3/mx31lite-db.c | 43 +++++++++++++++++++++++++++++++++++++++
> arch/arm/mach-mx3/mx31lite.c | 36 ++++++++++++++++++++++++++++++-
> 2 files changed, 77 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
> index 45abae1..1ab92f6 100644
> --- a/arch/arm/mach-mx3/mx31lite-db.c
> +++ b/arch/arm/mach-mx3/mx31lite-db.c
> @@ -28,6 +28,8 @@
> #include <linux/types.h>
> #include <linux/init.h>
> #include <linux/gpio.h>
> +#include <linux/spi/spi.h>
> +#include <linux/mfd/mc13783.h>
>
> #include <asm/mach-types.h>
> #include <asm/mach/arch.h>
> @@ -39,6 +41,7 @@
> #include <mach/iomux-mx3.h>
> #include <mach/board-mx31lite.h>
> #include <mach/mmc.h>
> +#include <mach/spi.h>
>
> #include "devices.h"
>
> @@ -55,6 +58,14 @@ static unsigned int litekit_db_board_pins[] __initdata = {
> MX31_PIN_RTS1__RTS1,
> MX31_PIN_TXD1__TXD1,
> MX31_PIN_RXD1__RXD1,
> + /* SPI 0 */
> + 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_SS0__SS0,
> + MX31_PIN_CSPI1_SS1__SS1,
> + MX31_PIN_CSPI1_SS2__SS2,
> };
>
> /* UART */
> @@ -130,6 +141,35 @@ static struct imxmmc_platform_data mmc_pdata = {
> .exit = mxc_mmc1_exit,
> };
>
> +/* SPI */
> +
> +static int spi_internal_chipselect[] = {
> + MXC_SPI_CS(0),
> + MXC_SPI_CS(1),
> + MXC_SPI_CS(2),
> +};
> +
> +static struct spi_imx_master spi0_pdata = {
> + .chipselect = spi_internal_chipselect,
> + .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
> +};
> +
> +static struct mc13783_platform_data mc13783_pdata __initdata = {
> + .flags = MC13783_USE_RTC |
> + MC13783_USE_REGULATOR,
> +};
> +
> +static struct spi_board_info litekit_spi_devs[] __initdata = {
> + {
> + .modalias = "mc13783",
> + .max_speed_hz = 1000000,
> + .bus_num = 1,
> + .chip_select = 0,
> + .platform_data = &mc13783_pdata,
> + .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
> + },
> +};
> +
> void __init mx31lite_db_init(void)
> {
> mxc_iomux_setup_multiple_pins(litekit_db_board_pins,
> @@ -137,5 +177,8 @@ void __init mx31lite_db_init(void)
> "development board pins");
> mxc_register_device(&mxc_uart_device0, &uart_pdata);
> mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
> + mxc_register_device(&mxc_spi_device0, &spi0_pdata);
> + spi_register_board_info(litekit_spi_devs,
> + ARRAY_SIZE(litekit_spi_devs));
> }
>
> diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c
> index dc993a8..b8d8ee1 100644
> --- a/arch/arm/mach-mx3/mx31lite.c
> +++ b/arch/arm/mach-mx3/mx31lite.c
> @@ -2,6 +2,7 @@
> * Copyright (C) 2000 Deep Blue Solutions Ltd
> * Copyright (C) 2002 Shane Nay (shane at minirl.com)
> * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
> + * Copyright (C) 2009 Daniel Mack <daniel@caiaq.de>
> *
> * This program is free software; you can redistribute it and/or modify
> * it under the terms of the GNU General Public License as published by
> @@ -26,19 +27,22 @@
> #include <linux/gpio.h>
> #include <linux/smsc911x.h>
>
> -#include <mach/hardware.h>
> #include <asm/mach-types.h>
> #include <asm/mach/arch.h>
> #include <asm/mach/time.h>
> #include <asm/mach/map.h>
> -#include <mach/common.h>
> #include <asm/page.h>
> #include <asm/setup.h>
> +
> +#include <mach/hardware.h>
> +#include <mach/common.h>
> #include <mach/board-mx31lite.h>
> #include <mach/imx-uart.h>
> #include <mach/iomux-mx3.h>
> #include <mach/irqs.h>
> #include <mach/mxc_nand.h>
> +#include <mach/spi.h>
> +
> #include "devices.h"
>
> /*
> @@ -48,6 +52,14 @@
> static unsigned int mx31lite_pins[] = {
> /* LAN9117 IRQ pin */
> IOMUX_MODE(MX31_PIN_SFS6, 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_SS1__SS1,
> + MX31_PIN_CSPI2_SS2__SS2,
> };
>
> static struct mxc_nand_platform_data mx31lite_nand_board_info = {
> @@ -84,6 +96,25 @@ static struct platform_device smsc911x_device = {
> };
>
> /*
> + * SPI
> + *
> + * The MX13783 is hard-wired on the module, hence the corresponding
> + * bus is registered here and not in the board code, in contrast to
> + * the other SPI bus.
> + */
The mc13783 bus is registered in the -db file, and not here. I think you
mixed something up here.
s/MX13783/MC13783/
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] 9+ messages in thread* [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite
2009-11-18 15:37 ` [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite Sascha Hauer
@ 2009-11-18 15:42 ` Daniel Mack
2009-11-19 8:38 ` Sascha Hauer
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Mack @ 2009-11-18 15:42 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Nov 18, 2009 at 04:37:08PM +0100, Sascha Hauer wrote:
> On Wed, Nov 18, 2009 at 02:41:40PM +0100, Daniel Mack wrote:
> > /*
> > + * SPI
> > + *
> > + * The MX13783 is hard-wired on the module, hence the corresponding
> > + * bus is registered here and not in the board code, in contrast to
> > + * the other SPI bus.
> > + */
>
>
> The mc13783 bus is registered in the -db file, and not here. I think you
> mixed something up here.
Hmm, no, that actually correct. The problem is that all devices on the
SPI bus have to be registered in one block via spi_register_board_info,
and as I don't know whether other boards will have more devices
connected, the registration is done in the board support file, not in
the module code.
The bus itself, however, is hardwired, so it makes no sense to add it
conditionally.
> s/MX13783/MC13783/
That's true :) Care to fix it on the fly or do you want me to resend?
There is btw another typo in the first mail of this series: In its
subject, it should have 'ARM' not 'ARN'.
The tradeoff of too small terminal fonts ;)
Daniel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite
2009-11-18 15:42 ` Daniel Mack
@ 2009-11-19 8:38 ` Sascha Hauer
2009-11-19 9:24 ` Daniel Mack
0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2009-11-19 8:38 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Nov 18, 2009 at 04:42:56PM +0100, Daniel Mack wrote:
> On Wed, Nov 18, 2009 at 04:37:08PM +0100, Sascha Hauer wrote:
> > On Wed, Nov 18, 2009 at 02:41:40PM +0100, Daniel Mack wrote:
> > > /*
> > > + * SPI
> > > + *
> > > + * The MX13783 is hard-wired on the module, hence the corresponding
> > > + * bus is registered here and not in the board code, in contrast to
> > > + * the other SPI bus.
> > > + */
> >
> >
> > The mc13783 bus is registered in the -db file, and not here. I think you
> > mixed something up here.
>
> Hmm, no, that actually correct. The problem is that all devices on the
> SPI bus have to be registered in one block via spi_register_board_info,
Looking at the SPI code I see no reason why it shouldn't be possible to call
spi_register_board_info multiple times.
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] 9+ messages in thread
* [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite
2009-11-19 8:38 ` Sascha Hauer
@ 2009-11-19 9:24 ` Daniel Mack
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Mack @ 2009-11-19 9:24 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Nov 19, 2009 at 09:38:25AM +0100, Sascha Hauer wrote:
> On Wed, Nov 18, 2009 at 04:42:56PM +0100, Daniel Mack wrote:
> > On Wed, Nov 18, 2009 at 04:37:08PM +0100, Sascha Hauer wrote:
> > > On Wed, Nov 18, 2009 at 02:41:40PM +0100, Daniel Mack wrote:
> > > > /*
> > > > + * SPI
> > > > + *
> > > > + * The MX13783 is hard-wired on the module, hence the corresponding
> > > > + * bus is registered here and not in the board code, in contrast to
> > > > + * the other SPI bus.
> > > > + */
> > >
> > >
> > > The mc13783 bus is registered in the -db file, and not here. I think you
> > > mixed something up here.
> >
> > Hmm, no, that actually correct. The problem is that all devices on the
> > SPI bus have to be registered in one block via spi_register_board_info,
>
> Looking at the SPI code I see no reason why it shouldn't be possible to call
> spi_register_board_info multiple times.
Hmm ok, I didn't know that. I changed that and rebased the patches on
top of this. I'll resend the whole series later.
Thanks,
Daniel
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-11-19 9:24 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-18 13:41 [PATCH 1/5] ARN: MX3: modularize 'mx31lite' code Daniel Mack
2009-11-18 13:41 ` [PATCH 2/5] ARM: MX3: add MMC/SDHC support to mx31lite-db.c Daniel Mack
2009-11-18 13:41 ` [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite Daniel Mack
2009-11-18 13:41 ` [PATCH 4/5] ARM: MX3: add USB functions for mx31litekit Daniel Mack
2009-11-18 13:41 ` [PATCH 5/5] ARM: MX3: add support for GPIO LEDs on litekit db Daniel Mack
2009-11-18 15:37 ` [PATCH 3/5] ARM: MX3: add SPI devices for mx31lite Sascha Hauer
2009-11-18 15:42 ` Daniel Mack
2009-11-19 8:38 ` Sascha Hauer
2009-11-19 9:24 ` Daniel Mack
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).