[PATCH 27/90] ARM: OMAP: Add minimal OMAP2430 support

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Cc: Syed Mohammed Khasim <x0khasim@...>, Tony Lindgren <tony@...>
Date: Wednesday, April 4, 2007 - 2:05 pm

From: Syed Mohammed Khasim <x0khasim@ti.com>

This patch adds minimal OMAP2430 support to get the kernel booting on 2430SDP.

Signed-off-by: Syed Mohammed Khasim <x0khasim@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/Kconfig               |    8 +
 arch/arm/mach-omap2/Makefile              |    1 +
 arch/arm/mach-omap2/board-2430sdp.c       |  226 +++++++++++++++++++++++++++++
 arch/arm/mach-omap2/devices.c             |    2 +-
 arch/arm/mach-omap2/gpmc.c                |    7 +
 arch/arm/mach-omap2/id.c                  |    6 +
 arch/arm/mach-omap2/io.c                  |   20 +++
 include/asm-arm/arch-omap/board-2430sdp.h |   41 +++++
 include/asm-arm/arch-omap/hardware.h      |    4 +
 include/asm-arm/arch-omap/io.h            |   10 ++
 include/asm-arm/arch-omap/irqs.h          |    1 +
 include/asm-arm/arch-omap/omap24xx.h      |   12 ++
 12 files changed, 337 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 4c90cc7..47c8b57 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -10,6 +10,10 @@ config ARCH_OMAP2420
 	depends on ARCH_OMAP24XX
 	select OMAP_DM_TIMER
 
+config ARCH_OMAP2430
+	bool "OMAP2430 support"
+	depends on ARCH_OMAP24XX
+
 comment "OMAP Board Type"
 	depends on ARCH_OMAP2
 
@@ -25,3 +29,7 @@ config MACH_OMAP_H4
 config MACH_OMAP_APOLLON
 	bool "OMAP 2420 Apollon board"
 	depends on ARCH_OMAP2 && ARCH_OMAP24XX
+
+config MACH_OMAP_2430SDP
+	bool "OMAP 2430 SDP board"
+	depends on ARCH_OMAP2 && ARCH_OMAP24XX
\ No newline at end of file
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 266d88e..b05b738 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -14,5 +14,6 @@ obj-$(CONFIG_PM) += pm.o pm-domain.o sleep.o
 # Specific board support
 obj-$(CONFIG_MACH_OMAP_GENERIC)		+= board-generic.o
 obj-$(CONFIG_MACH_OMAP_H4)		+= board-h4.o
+obj-$(CONFIG_MACH_OMAP_2430SDP)		+= board-2430sdp.o
 obj-$(CONFIG_MACH_OMAP_APOLLON)		+= board-apollon.o
 
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
new file mode 100644
index 0000000..77e77c1
--- /dev/null
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -0,0 +1,226 @@
+/*
+ * linux/arch/arm/mach-omap/omap2/board-2430sdp.c
+ *
+ * Copyright (C) 2006 Texas Instruments
+ *
+ * Modified from mach-omap2/board-generic.c
+ *
+ * Initial Code : Based on a patch from Komal Shah and Richard Woodruff
+ * Updated the Code for 2430 SDP : Syed Mohammed Khasim
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/delay.h>
+#include <linux/workqueue.h>
+#include <linux/input.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+
+#include <asm/hardware.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/flash.h>
+
+#include <asm/arch/gpio.h>
+#include <asm/arch/gpioexpander.h>
+#include <asm/arch/mux.h>
+#include <asm/arch/usb.h>
+#include <asm/arch/irda.h>
+#include <asm/arch/board.h>
+#include <asm/arch/common.h>
+#include <asm/arch/keypad.h>
+#include <asm/arch/menelaus.h>
+#include <asm/arch/dma.h>
+#include <asm/arch/gpmc.h>
+#include "prcm-regs.h"
+
+#include <asm/io.h>
+
+
+#define	SDP2430_FLASH_CS	0
+#define	SDP2430_SMC91X_CS	5
+
+static struct mtd_partition sdp2430_partitions[] = {
+	/* bootloader (U-Boot, etc) in first sector */
+	{
+		.name		= "bootloader",
+		.offset		= 0,
+		.size		= SZ_256K,
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	 },
+	/* bootloader params in the next sector */
+	{
+		.name		= "params",
+		.offset		= MTDPART_OFS_APPEND,
+		.size		= SZ_128K,
+		.mask_flags	= 0,
+	 },
+	/* kernel */
+	{
+		.name		= "kernel",
+		.offset		= MTDPART_OFS_APPEND,
+		.size		= SZ_2M,
+		.mask_flags	= 0
+	},
+	/* file system */
+	{
+		.name		= "filesystem",
+		.offset		= MTDPART_OFS_APPEND,
+		.size		= MTDPART_SIZ_FULL,
+		.mask_flags	= 0
+	}
+};
+
+static struct flash_platform_data sdp2430_flash_data = {
+	.map_name	= "cfi_probe",
+	.width		= 2,
+	.parts		= sdp2430_partitions,
+	.nr_parts	= ARRAY_SIZE(sdp2430_partitions),
+};
+
+static struct resource sdp2430_flash_resource = {
+	.start		= SDP2430_CS0_BASE,
+	.end		= SDP2430_CS0_BASE + SZ_64M - 1,
+	.flags		= IORESOURCE_MEM,
+};
+
+static struct platform_device sdp2430_flash_device = {
+	.name		= "omapflash",
+	.id		= 0,
+	.dev = {
+		.platform_data	= &sdp2430_flash_data,
+	},
+	.num_resources	= 1,
+	.resource	= &sdp2430_flash_resource,
+};
+
+static struct resource sdp2430_smc91x_resources[] = {
+	[0] = {
+		.start	= SDP2430_CS0_BASE,
+		.end	= SDP2430_CS0_BASE + SZ_64M - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
+		.end	= OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device sdp2430_smc91x_device = {
+	.name		= "smc91x",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(sdp2430_smc91x_resources),
+	.resource	= sdp2430_smc91x_resources,
+};
+
+static struct platform_device *sdp2430_devices[] __initdata = {
+	&sdp2430_smc91x_device,
+	&sdp2430_flash_device,
+};
+
+static inline void __init sdp2430_init_smc91x(void)
+{
+	int eth_cs;
+	unsigned long cs_mem_base;
+	unsigned int rate;
+	struct clk *l3ck;
+
+	eth_cs = SDP2430_SMC91X_CS;
+
+	l3ck = clk_get(NULL, "core_l3_ck");
+	if (IS_ERR(l3ck))
+		rate = 100000000;
+	else
+		rate = clk_get_rate(l3ck);
+
+	/* Make sure CS1 timings are correct, for 2430 always muxed */
+	gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200);
+
+	if (rate >= 160000000) {
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4);
+	} else if (rate >= 130000000) {
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4);
+	} else { /* rate = 100000000 */
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F);
+		gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2);
+	}
+
+	if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
+		printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
+		return;
+	}
+
+	sdp2430_smc91x_resources[0].start = cs_mem_base + 0x300;
+	sdp2430_smc91x_resources[0].end = cs_mem_base + 0x30f;
+	udelay(100);
+
+	if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) {
+		printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
+			OMAP24XX_ETHR_GPIO_IRQ);
+		gpmc_cs_free(eth_cs);
+		return;
+	}
+	omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1);
+
+}
+
+static void __init omap_2430sdp_init_irq(void)
+{
+	omap2_init_common_hw();
+	omap_init_irq();
+	omap_gpio_init();
+	sdp2430_init_smc91x();
+}
+
+static struct omap_uart_config sdp2430_uart_config __initdata = {
+	.enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
+};
+
+static struct omap_board_config_kernel sdp2430_config[] = {
+	{OMAP_TAG_UART, &sdp2430_uart_config},
+};
+
+static void __init omap_2430sdp_init(void)
+{
+	platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
+	omap_board_config = sdp2430_config;
+	omap_board_config_size = ARRAY_SIZE(sdp2430_config);
+	omap_serial_init();
+}
+
+static void __init omap_2430sdp_map_io(void)
+{
+	omap2_map_common_io();
+}
+
+MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
+	/* Maintainer: Syed Khasim - Texas Instruments Inc */
+	.phys_io	= 0x48000000,
+	.io_pg_offst	= ((0xd8000000) >> 18) & 0xfffc,
+	.boot_params	= 0x80000100,
+	.map_io		= omap_2430sdp_map_io,
+	.init_irq	= omap_2430sdp_init_irq,
+	.init_machine	= omap_2430sdp_init,
+	.timer		= &omap_timer,
+MACHINE_END
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index aa43224..cb5e775 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -52,7 +52,7 @@ static struct platform_device omap_i2c_device2 = {
 static void omap_init_i2c(void)
 {
 	/* REVISIT: Second I2C not in use on H4? */
-	if (machine_is_omap_h4())
+	if (machine_is_omap_h4() || machine_is_omap_2430sdp())
 		return;
 
 	omap_cfg_reg(J15_24XX_I2C2_SCL);
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 3236e12..032c20d 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -22,7 +22,14 @@
 
 #undef DEBUG
 
+#ifdef CONFIG_ARCH_OMAP2420
 #define GPMC_BASE		0x6800a000
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2430
+#define GPMC_BASE		0x6E000000
+#endif
+
 #define GPMC_REVISION		0x00
 #define GPMC_SYSCONFIG		0x10
 #define GPMC_SYSSTATUS		0x14
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 871ace4..4dfd878 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -17,7 +17,13 @@
 
 #include <asm/io.h>
 
+#if defined(CONFIG_ARCH_OMAP2420)
 #define OMAP24XX_TAP_BASE	io_p2v(0x48014000)
+#endif
+
+#if defined(CONFIG_ARCH_OMAP2430)
+#define OMAP24XX_TAP_BASE	io_p2v(0x4900A000)
+#endif
 
 #define OMAP_TAP_IDCODE		0x0204
 #define OMAP_TAP_PROD_ID	0x0208
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 748920f..af4b6e4 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -5,6 +5,7 @@
  *
  * Copyright (C) 2005 Nokia Corporation
  * Author: Juha Yrj
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 20/90] ARM: OMAP: gpio init section cleanups, Tony Lindgren, (Wed Apr 4, 2:04 pm)
[PATCH 21/90] ARM: OMAP: gpio object shrinkage, cleanup, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 23/90] ARM: OMAP: PalmZ71 extra brace fix, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 24/90] ARM: OMAP: Fix typo in gpio, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, Tony Lindgren, (Wed Apr 4, 2:05 pm)
Re: [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, Dmitry Torokhov, (Wed Apr 4, 4:47 pm)
Re: [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, David Brownell, (Wed Apr 4, 4:59 pm)
Re: [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, Jan Engelhardt, (Wed Apr 4, 4:06 pm)
Re: [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, David Brownell, (Wed Apr 4, 4:51 pm)
Re: [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, Jan Engelhardt, (Wed Apr 4, 10:15 pm)
Re: [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, Randy Dunlap, (Thu Apr 5, 12:18 am)
Re: [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, David Brownell, (Thu Apr 5, 2:19 pm)
Re: [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, Jan Engelhardt, (Thu Apr 5, 4:35 pm)
Re: coding style for long conditions, Junio C Hamano, (Sat Apr 7, 4:01 am)
Re: coding style for long conditions, David Brownell, (Mon Apr 9, 11:14 am)
Re: coding style for long conditions, Roland Dreier, (Fri Apr 6, 5:38 pm)
Re: coding style for long conditions, Scott Preece, (Mon Apr 9, 11:45 am)
Re: coding style for long conditions, David Brownell, (Fri Apr 6, 6:05 pm)
Re: coding style for long conditions, Jan Engelhardt, (Fri Apr 6, 6:07 pm)
Re: coding style for long conditions, David Brownell, (Fri Apr 6, 6:43 pm)
Re: coding style for long conditions, Zan Lynx, (Fri Apr 6, 5:50 pm)
Re: coding style for long conditions (WAS: Re: [PATCH 25/90]..., Jeremy Fitzhardinge, (Fri Apr 6, 5:37 pm)
Re: [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, Dmitry Torokhov, (Wed Apr 4, 4:42 pm)
Re: [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!!, David Brownell, (Wed Apr 4, 3:13 pm)
[PATCH 27/90] ARM: OMAP: Add minimal OMAP2430 support, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 28/90] ARM: OMAP: USB peripheral support on H4, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 29/90] ARM: OMAP: Palm Tungsten|T support, Tony Lindgren, (Wed Apr 4, 2:05 pm)
Re: [PATCH 29/90] ARM: OMAP: Palm Tungsten|T support, Pavel Machek, (Fri Apr 6, 8:09 am)
Re: [PATCH 29/90] ARM: OMAP: Palm Tungsten|T support, Russell King, (Sun Apr 8, 8:07 am)
Re: [PATCH 29/90] ARM: OMAP: Palm Tungsten|T support, Pavel Machek, (Sun Apr 8, 8:12 am)
Re: [PATCH 29/90] ARM: OMAP: Palm Tungsten|T support, Russell King, (Sun Apr 8, 10:40 am)
Re: [PATCH 29/90] ARM: OMAP: Palm Tungsten|T support, Pavel Machek, (Mon Apr 9, 7:13 am)
Re: [PATCH 29/90] ARM: OMAP: Palm Tungsten|T support, Russell King, (Sun Apr 8, 9:58 am)
Re: [PATCH 29/90] ARM: OMAP: Palm Tungsten|T support, Dagfinn Ilmari , (Sun Apr 8, 8:31 am)
[PATCH 30/90] ARM: OMAP: Palm Zire71 minor fixes, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 31/90] ARM: OMAP: plat-omap changes for 2430 SDP, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 32/90] ARM: OMAP: Basic support for siemens sx1, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 35/90] ARM: OMAP: speed up gpio irq handling, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 36/90] ARM: OMAP: Fix typo in board-h4.h, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 37/90] ARM: OMAP: MPUIO wake updates, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 38/90] ARM: OMAP: Sync headers with linux-omap, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 39/90] ARM: OMAP: Sync core code with linux-omap, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 42/90] ARM: OMAP: Tabify mux.c, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 43/90] ARM: OMAP: TUSB EVM init, Tony Lindgren, (Wed Apr 4, 2:05 pm)
Re: [PATCH 43/90] ARM: OMAP: TUSB EVM init, Randy Dunlap, (Wed Apr 4, 2:44 pm)
Re: [PATCH 43/90] ARM: OMAP: TUSB EVM init, Tony Lindgren, (Thu Apr 5, 10:42 am)
[PATCH 44/90] ARM: OMAP: Add mailbox support for IVA, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 45/90] ARM: OMAP: Update omap h2 defconfig, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 46/90] ARM: OMAP: Add omap osk defconfig, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 47/90] ARM: OMAP: Fix gpmc header, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 48/90] ARM: OMAP: I2C-1 init fix for 2430, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 52/90] ARM: OMAP: cleanup apollon board, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 53/90] ARM: OMAP: Fix warning in timer32k.c, Tony Lindgren, (Wed Apr 4, 2:05 pm)
Re: [PATCH 53/90] ARM: OMAP: Fix warning in timer32k.c, Randy Dunlap, (Wed Apr 4, 3:14 pm)
Re: [PATCH 53/90] ARM: OMAP: Fix warning in timer32k.c, Tony Lindgren, (Thu Apr 5, 11:15 am)
[PATCH 54/90] ARM: OMAP: Update timer32k.c to compile, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 55/90] ARM: OMAP: H3 workqueue fixes, Tony Lindgren, (Wed Apr 4, 2:05 pm)
Re: [PATCH 55/90] ARM: OMAP: H3 workqueue fixes, Tony Lindgren, (Thu Apr 5, 11:17 am)
[PATCH 63/90] ARM: OMAP: Merge PM code from N800 tree, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 64/90] ARM: OMAP: Fix warning in pm.c, Tony Lindgren, (Wed Apr 4, 2:05 pm)
Re: [PATCH 64/90] ARM: OMAP: Fix warning in pm.c, Tony Lindgren, (Thu Apr 5, 11:18 am)
[PATCH 69/90] ARM: OMAP: add SoSSI clock, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 79/90] ARM: OMAP: fix H4 dependencies again, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 80/90] ARM: OMAP: partial LED fixes, Tony Lindgren, (Wed Apr 4, 2:05 pm)
[PATCH 81/90] ARM: OMAP: omap2/pm.c build fix, Tony Lindgren, (Wed Apr 4, 2:06 pm)
[PATCH 82/90] ARM: OMAP: restore CONFIG_GENERIC_TIME, Tony Lindgren, (Wed Apr 4, 2:06 pm)
[PATCH 88/90] ARM: OMAP: OSK led fixes, Tony Lindgren, (Wed Apr 4, 2:06 pm)