From patchwork Fri Jul 1 09:46:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 102887 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3FC01B6F62 for ; Fri, 1 Jul 2011 19:47:23 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QcaJY-0004ld-CX; Fri, 01 Jul 2011 09:47:09 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QcaJX-0003Mr-T0; Fri, 01 Jul 2011 09:47:07 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QcaJL-0003K9-Uy for linux-arm-kernel@lists.infradead.org; Fri, 01 Jul 2011 09:46:57 +0000 Received: from octopus.hi.pengutronix.de ([2001:6f8:1178:2:215:17ff:fe12:23b0]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1QcaJI-0005JM-QG; Fri, 01 Jul 2011 11:46:52 +0200 Received: from ukl by octopus.hi.pengutronix.de with local (Exim 4.76) (envelope-from ) id 1QcaJI-00085F-EX; Fri, 01 Jul 2011 11:46:52 +0200 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 2/3] ARM: imx/mx31moboard: convert to new baseboard handling Date: Fri, 1 Jul 2011 11:46:33 +0200 Message-Id: <1309513594-31016-2-git-send-email-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 1.7.5.3 In-Reply-To: <1309513594-31016-1-git-send-email-u.kleine-koenig@pengutronix.de> References: <20110701094403.GT11559@pengutronix.de> <1309513594-31016-1-git-send-email-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:6f8:1178:2:215:17ff:fe12:23b0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110701_054656_428999_E2490475 X-CRM114-Status: GOOD ( 21.43 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Eric Miao , kernel@pengutronix.de, Marek Vasut , Daniel Mack , =?UTF-8?q?Philippe=20R=C3=A9tornaz?= , Valentin Longchamp X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org The old mx31moboard way to pass the board is still supported but will go away later saving aa few more lines. Signed-off-by: Uwe Kleine-König --- arch/arm/mach-imx/Kconfig | 1 + arch/arm/mach-imx/mach-mx31moboard.c | 48 +++++++++++++------- arch/arm/mach-imx/mx31moboard-devboard.c | 5 +- arch/arm/mach-imx/mx31moboard-marxbot.c | 5 +- arch/arm/mach-imx/mx31moboard-smartbot.c | 18 +++----- arch/arm/plat-mxc/include/mach/board-mx31moboard.h | 16 +++---- 6 files changed, 51 insertions(+), 42 deletions(-) diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 59c97a3..98bb0ca 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -463,6 +463,7 @@ config MACH_MX31_3DS_MXC_NAND_USE_BBT config MACH_MX31MOBOARD bool "Support mx31moboard platforms (EPFL Mobots group)" + select BASEBOARD select SOC_IMX31 select IMX_HAVE_PLATFORM_FSL_USB2_UDC select IMX_HAVE_PLATFORM_IMX_I2C diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c index eaa51e4..802595b 100644 --- a/arch/arm/mach-imx/mach-mx31moboard.c +++ b/arch/arm/mach-imx/mach-mx31moboard.c @@ -499,6 +499,31 @@ err: } +static const struct baseboard_entry + mx31moboard_baseboard_map[] __initconst = { + { + .name = "devboard", + .initfunc = mx31moboard_devboard_init, + }, { + .name = "eyebot", + .initfunc = mx31moboard_smartbot_init, + .initdata = (void *)MX31MOBOARD_SMARTBOT_USB_OTG, + }, { + .name = "marxbot", + .initfunc = mx31moboard_marxbot_init, + }, { + .name = "smartbot", + .initfunc = mx31moboard_smartbot_init, + }, +}; + +static const char *baseboardnames[] = { + "", + "devboard", + "marxbot", + "smartbot", + "eyebot", +}; static int mx31moboard_baseboard; core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444); @@ -534,23 +559,14 @@ static void __init mx31moboard_init(void) moboard_usbh2_init(); - switch (mx31moboard_baseboard) { - case MX31NOBOARD: - break; - case MX31DEVBOARD: - mx31moboard_devboard_init(); - break; - case MX31MARXBOT: - mx31moboard_marxbot_init(); - break; - case MX31SMARTBOT: - case MX31EYEBOT: - mx31moboard_smartbot_init(mx31moboard_baseboard); - break; - default: - printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n", - mx31moboard_baseboard); + if (mx31moboard_baseboard > 0 && + mx31moboard_baseboard < ARRAY_SIZE(baseboardnames)) { + pr_warn("mx31moboard_baseboard= is deprecated, use baseboard=\n"); + baseboard_select(baseboardnames[mx31moboard_baseboard]); } + + baseboard_setup(mx31moboard_baseboard_map, + ARRAY_SIZE(mx31moboard_baseboard_map)); } static void __init mx31moboard_timer_init(void) diff --git a/arch/arm/mach-imx/mx31moboard-devboard.c b/arch/arm/mach-imx/mx31moboard-devboard.c index 0aa2536..0fdb79d 100644 --- a/arch/arm/mach-imx/mx31moboard-devboard.c +++ b/arch/arm/mach-imx/mx31moboard-devboard.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "devices-imx31.h" @@ -223,7 +224,7 @@ static const struct fsl_usb2_platform_data usb_pdata __initconst = { /* * system init for baseboard usage. Will be called by mx31moboard init. */ -void __init mx31moboard_devboard_init(void) +int __init mx31moboard_devboard_init(const struct baseboard_entry *unused) { printk(KERN_INFO "Initializing mx31devboard peripherals\n"); @@ -238,5 +239,5 @@ void __init mx31moboard_devboard_init(void) imx31_add_fsl_usb2_udc(&usb_pdata); - devboard_usbh1_init(); + return devboard_usbh1_init(); } diff --git a/arch/arm/mach-imx/mx31moboard-marxbot.c b/arch/arm/mach-imx/mx31moboard-marxbot.c index bb639cb..ed943a1 100644 --- a/arch/arm/mach-imx/mx31moboard-marxbot.c +++ b/arch/arm/mach-imx/mx31moboard-marxbot.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -336,7 +337,7 @@ static const struct fsl_usb2_platform_data usb_pdata __initconst = { /* * system init for baseboard usage. Will be called by mx31moboard init. */ -void __init mx31moboard_marxbot_init(void) +int __init mx31moboard_marxbot_init(const struct baseboard_entry *unused) { printk(KERN_INFO "Initializing mx31marxbot peripherals\n"); @@ -362,5 +363,5 @@ void __init mx31moboard_marxbot_init(void) imx31_add_fsl_usb2_udc(&usb_pdata); - marxbot_usbh1_init(); + return marxbot_usbh1_init(); } diff --git a/arch/arm/mach-imx/mx31moboard-smartbot.c b/arch/arm/mach-imx/mx31moboard-smartbot.c index fabb801..9afc630 100644 --- a/arch/arm/mach-imx/mx31moboard-smartbot.c +++ b/arch/arm/mach-imx/mx31moboard-smartbot.c @@ -181,7 +181,7 @@ static void smartbot_resets_init(void) /* * system init for baseboard usage. Will be called by mx31moboard init. */ -void __init mx31moboard_smartbot_init(int board) +int __init mx31moboard_smartbot_init(const struct baseboard_entry *entry) { printk(KERN_INFO "Initializing mx31smartbot peripherals\n"); @@ -190,20 +190,14 @@ void __init mx31moboard_smartbot_init(int board) imx31_add_imx_uart1(&uart_pdata); - switch (board) { - case MX31SMARTBOT: - imx31_add_fsl_usb2_udc(&usb_pdata); - break; - case MX31EYEBOT: + if ((unsigned long)entry->initdata & MX31MOBOARD_SMARTBOT_USB_OTG) smartbot_otg_host_init(); - break; - default: - printk(KERN_WARNING "Unknown board %d, USB OTG not initialized", - board); - } + else + imx31_add_fsl_usb2_udc(&usb_pdata); smartbot_resets_init(); smartbot_cam_init(); - platform_add_devices(smartbot_cameras, ARRAY_SIZE(smartbot_cameras)); + return platform_add_devices(smartbot_cameras, + ARRAY_SIZE(smartbot_cameras)); } diff --git a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h index de14543..8d33d47 100644 --- a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h +++ b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h @@ -19,24 +19,20 @@ #ifndef __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__ #define __ASM_ARCH_MXC_BOARD_MX31MOBOARD_H__ +#include + #ifndef __ASSEMBLY__ -enum mx31moboard_boards { - MX31NOBOARD = 0, - MX31DEVBOARD = 1, - MX31MARXBOT = 2, - MX31SMARTBOT = 3, - MX31EYEBOT = 4, -}; +#define MX31MOBOARD_SMARTBOT_USB_OTG 1UL /* * This CPU module needs a baseboard to work. After basic initializing * its own devices, it calls the baseboard's init function. */ -extern void mx31moboard_devboard_init(void); -extern void mx31moboard_marxbot_init(void); -extern void mx31moboard_smartbot_init(int board); +int mx31moboard_devboard_init(const struct baseboard_entry *); +int mx31moboard_marxbot_init(const struct baseboard_entry *); +int mx31moboard_smartbot_init(const struct baseboard_entry *); #endif