mx31moboard: initial support for various baseboards
authorValentin Longchamp <valentin.longchamp@epfl.ch>
Mon, 16 Feb 2009 11:47:51 +0000 (12:47 +0100)
committerSascha Hauer <s.hauer@pengutronix.de>
Fri, 13 Mar 2009 09:34:21 +0000 (10:34 +0100)
This enables our mx31moboard to be used on the different baseboards that
we are developping according to the application needs. There are not
many differences between the boards for now, but when other peripherals
are available for mx31 the differences are going to grow.

v2: takes Sascha's comments into account

Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
arch/arm/mach-mx3/Makefile
arch/arm/mach-mx3/mx31moboard-devboard.c [new file with mode: 0644]
arch/arm/mach-mx3/mx31moboard-marxbot.c [new file with mode: 0644]
arch/arm/mach-mx3/mx31moboard.c
arch/arm/plat-mxc/include/mach/board-mx31moboard.h [new file with mode: 0644]

index 5a151540fe836ebeaa233ce873240dabc79aa243..d50d9878a654feca474a3a36d54dbb5787e406da 100644 (file)
@@ -9,4 +9,5 @@ obj-$(CONFIG_MACH_MX31ADS)      += mx31ads.o
 obj-$(CONFIG_MACH_MX31LITE)    += mx31lite.o
 obj-$(CONFIG_MACH_PCM037)      += pcm037.o
 obj-$(CONFIG_MACH_MX31_3DS)    += mx31pdk.o
-obj-$(CONFIG_MACH_MX31MOBOARD) += mx31moboard.o
+obj-$(CONFIG_MACH_MX31MOBOARD) += mx31moboard.o mx31moboard-devboard.o \
+                                  mx31moboard-marxbot.o
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
new file mode 100644 (file)
index 0000000..d080b4a
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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/types.h>
+#include <linux/init.h>
+
+#include <linux/platform_device.h>
+
+#include <mach/hardware.h>
+#include <mach/common.h>
+#include <mach/imx-uart.h>
+#include <mach/iomux-mx3.h>
+
+#include "devices.h"
+
+static struct imxuart_platform_data uart_pdata = {
+       .flags = IMXUART_HAVE_RTSCTS,
+};
+
+static int mxc_uart1_pins[] = {
+       MX31_PIN_CTS2__CTS2, MX31_PIN_RTS2__RTS2,
+       MX31_PIN_TXD2__TXD2, MX31_PIN_RXD2__RXD2,
+};
+
+/*
+ * system init for baseboard usage. Will be called by mx31moboard init.
+ */
+void __init mx31moboard_devboard_init(void)
+{
+       printk(KERN_INFO "Initializing mx31devboard peripherals\n");
+       mxc_iomux_setup_multiple_pins(mxc_uart1_pins, ARRAY_SIZE(mxc_uart1_pins), "uart1");
+       mxc_register_device(&mxc_uart_device1, &uart_pdata);
+}
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
new file mode 100644 (file)
index 0000000..9ef9566
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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/types.h>
+#include <linux/init.h>
+
+#include <linux/platform_device.h>
+
+#include <mach/hardware.h>
+#include <mach/common.h>
+#include <mach/imx-uart.h>
+#include <mach/iomux-mx3.h>
+
+#include "devices.h"
+
+/*
+ * system init for baseboard usage. Will be called by mx31moboard init.
+ */
+void __init mx31moboard_marxbot_init(void)
+{
+       printk(KERN_INFO "Initializing mx31marxbot peripherals\n");
+}
index f29c8782cffb8df461ab43b64bf29b061efcebcf..2d51739e24bf1d211a677e2953aa25a8b42c4c33 100644 (file)
@@ -32,6 +32,7 @@
 #include <mach/common.h>
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
+#include <mach/board-mx31moboard.h>
 
 #include "devices.h"
 
@@ -64,24 +65,17 @@ static struct platform_device *devices[] __initdata = {
 };
 
 static int mxc_uart0_pins[] = {
-       MX31_PIN_CTS1__CTS1,
-       MX31_PIN_RTS1__RTS1,
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1
-};
-static int mxc_uart1_pins[] = {
-       MX31_PIN_CTS2__CTS2,
-       MX31_PIN_RTS2__RTS2,
-       MX31_PIN_TXD2__TXD2,
-       MX31_PIN_RXD2__RXD2
+       MX31_PIN_CTS1__CTS1, MX31_PIN_RTS1__RTS1,
+       MX31_PIN_TXD1__TXD1, MX31_PIN_RXD1__RXD1,
 };
 static int mxc_uart4_pins[] = {
-       MX31_PIN_PC_RST__CTS5,
-       MX31_PIN_PC_VS2__RTS5,
-       MX31_PIN_PC_BVD2__TXD5,
-       MX31_PIN_PC_BVD1__RXD5
+       MX31_PIN_PC_RST__CTS5, MX31_PIN_PC_VS2__RTS5,
+       MX31_PIN_PC_BVD2__TXD5, MX31_PIN_PC_BVD1__RXD5,
 };
 
+static int mx31moboard_baseboard;
+core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
+
 /*
  * Board specific initialization.
  */
@@ -92,11 +86,22 @@ static void __init mxc_board_init(void)
        mxc_iomux_setup_multiple_pins(mxc_uart0_pins, ARRAY_SIZE(mxc_uart0_pins), "uart0");
        mxc_register_device(&mxc_uart_device0, &uart_pdata);
 
-       mxc_iomux_setup_multiple_pins(mxc_uart1_pins, ARRAY_SIZE(mxc_uart1_pins), "uart1");
-       mxc_register_device(&mxc_uart_device1, &uart_pdata);
-
        mxc_iomux_setup_multiple_pins(mxc_uart4_pins, ARRAY_SIZE(mxc_uart4_pins), "uart4");
        mxc_register_device(&mxc_uart_device4, &uart_pdata);
+
+       switch (mx31moboard_baseboard) {
+       case MX31NOBOARD:
+               break;
+       case MX31DEVBOARD:
+               mx31moboard_devboard_init();
+               break;
+       case MX31MARXBOT:
+               mx31moboard_marxbot_init();
+               break;
+       default:
+               printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n", mx31moboard_baseboard);
+       }
+
 }
 
 /*
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
new file mode 100644 (file)
index 0000000..f8aef1b
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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_MX31MOBOARD_H__
+#define __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__
+
+/* mandatory for CONFIG_LL_DEBUG */
+
+#define MXC_LL_UART_PADDR      UART1_BASE_ADDR
+#define MXC_LL_UART_VADDR      (AIPI_BASE_ADDR_VIRT + 0x0A000)
+
+#ifndef __ASSEMBLY__
+
+enum mx31moboard_boards {
+       MX31NOBOARD     = 0,
+       MX31DEVBOARD    = 1,
+       MX31MARXBOT     = 2,
+};
+
+/*
+ * This CPU module needs a baseboard to work. After basic initializing
+ * its own devices, it calls baseboard's init function.
+ */
+
+extern void mx31moboard_devboard_init(void);
+extern void mx31moboard_marxbot_init(void);
+
+#endif
+
+#endif /* __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__ */