public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/12] OMAP3430 support in mach-omap2 folder
@ 2007-05-31 17:58 Syed Mohammed, Khasim
  2007-06-01  6:21 ` Trilok Soni
  0 siblings, 1 reply; 6+ messages in thread
From: Syed Mohammed, Khasim @ 2007-05-31 17:58 UTC (permalink / raw)
  To: Linux OMAP

Adding OMAP 3430 support to arch/arm/mach-omap2

Signed-off-by: Syed Mohammed Khasim  <x0khasim@ti.com>

Files:
 Kconfig         |   14 ++
 Makefile        |    6 -
 board-3430sdp.c |  301
 clock.h         |    1
 gpmc.c          |    8 -
 id.c            |   23 ++--
 irq.c           |   20 ++-
 7 files changed, 350 insertions(+), 23 deletions(-)

=======================================================================
diff -purN linux-omap/arch/arm/mach-omap2/Kconfig val_3430_GIT/arch/arm/mach-omap2/Kconfig
--- linux-omap/arch/arm/mach-omap2/Kconfig	2007-04-02 02:29:57.000000000 -0500
+++ val_3430_GIT/arch/arm/mach-omap2/Kconfig	2007-05-28 12:47:12.000000000 -0500
@@ -5,6 +5,10 @@ config ARCH_OMAP24XX
 	bool "OMAP24xx Based System"
 	depends on ARCH_OMAP2
 
+config ARCH_OMAP34XX
+	bool "OMAP34xx Based System"
+	depends on ARCH_OMAP3
+
 config ARCH_OMAP2420
 	bool "OMAP2420 support"
 	depends on ARCH_OMAP24XX
@@ -15,8 +19,12 @@ config ARCH_OMAP2430
 	bool "OMAP2430 support"
 	depends on ARCH_OMAP24XX
 
+config ARCH_OMAP3430
+	bool "OMAP3430 support"
+	depends on ARCH_OMAP3 && ARCH_OMAP34XX
+
 comment "OMAP Board Type"
-	depends on ARCH_OMAP2
+	depends on ARCH_OMAP2 || ARCH_OMAP3
 
 config MACH_OMAP_GENERIC
 	bool "Generic OMAP board"
@@ -37,6 +45,10 @@ config MACH_OMAP_H4
 	select OMAP_DEBUG_DEVICES
 	select GPIOEXPANDER_OMAP
 
+
+config MACH_OMAP_3430SDP
+	bool "OMAP 3430 SDP board"
+	depends on ARCH_OMAP3 && ARCH_OMAP34XX
 config MACH_OMAP_H4_TUSB
 	bool "TUSB 6010 EVM board"
 	depends on MACH_OMAP_H4
diff -purN linux-omap/arch/arm/mach-omap2/Makefile val_3430_GIT/arch/arm/mach-omap2/Makefile
--- linux-omap/arch/arm/mach-omap2/Makefile	2007-05-16 14:32:40.000000000 -0500
+++ val_3430_GIT/arch/arm/mach-omap2/Makefile	2007-05-25 23:53:23.000000000 -0500
@@ -3,9 +3,12 @@
 #
 
 # Common support
-obj-y := irq.o id.o io.o sram-fn.o memory.o prcm.o clock.o mux.o devices.o \
+obj-y := irq.o id.o io.o sram-fn.o memory.o prcm.o mux.o devices.o \
 	 serial.o gpmc.o
 
+obj-$(CONFIG_ARCH_OMAP24XX) += clock.o
+obj-$(CONFIG_ARCH_OMAP34XX) += clock_34xx.o
+
 obj-$(CONFIG_OMAP_MPU_TIMER)		+= timer-gp.o
 
 # Power Management
@@ -23,6 +26,7 @@ obj-$(CONFIG_MACH_OMAP_H4)		+= board-h4.
 obj-$(CONFIG_MACH_OMAP_2430SDP)		+= board-2430sdp.o \
 					   board-2430sdp-flash.o \
 					   board-2430sdp-usb.o
+obj-$(CONFIG_MACH_OMAP_3430SDP)		+= board-3430sdp.o
 obj-$(CONFIG_MACH_OMAP_APOLLON)		+= board-apollon.o \
 					   board-apollon-keys.o
 obj-$(CONFIG_MACH_NOKIA_N800)		+= board-n800.o board-n800-flash.o \
diff -purN linux-omap/arch/arm/mach-omap2/board-3430sdp.c val_3430_GIT/arch/arm/mach-omap2/board-3430sdp.c
--- linux-omap/arch/arm/mach-omap2/board-3430sdp.c	1969-12-31 18:00:00.000000000 -0600
+++ val_3430_GIT/arch/arm/mach-omap2/board-3430sdp.c	2007-05-29 12:53:11.000000000 -0500
@@ -0,0 +1,301 @@
+/*
+ * linux/arch/arm/mach-omap2/board-3430sdp.c
+ *
+ * Copyright (C) 2007 Texas Instruments
+ *
+ * Modified from mach-omap2/board-generic.c
+ *
+ * Initial code: 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/mux.h>
+#include <asm/arch/usb.h>
+#include <asm/arch/board.h>
+#include <asm/arch/common.h>
+#include <asm/arch/keypad.h>
+#include <asm/arch/dma.h>
+#include <asm/arch/gpmc.h>
+
+#include <asm/io.h>
+#include <asm/delay.h>
+
+#define	SDP3430_FLASH_CS	0
+#define	SDP3430_SMC91X_CS	3
+
+#ifdef CONFIG_USB_MUSB_HDRC
+#include <linux/usb_musb.h>
+#endif
+
+static struct mtd_partition sdp3430_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 sdp3430_flash_data = {
+	.map_name	= "cfi_probe",
+	.width		= 2,
+	.parts		= sdp3430_partitions,
+	.nr_parts	= ARRAY_SIZE(sdp3430_partitions),
+};
+
+static struct resource sdp3430_flash_resource = {
+	.start		= FLASH_BASE,
+	.end		= FLASH_BASE + SZ_64M - 1,
+	.flags		= IORESOURCE_MEM,
+};
+
+static struct platform_device sdp3430_flash_device = {
+	.name		= "omapflash",
+	.id		= 0,
+	.dev		= {
+		.platform_data	= &sdp3430_flash_data,
+	},
+	.num_resources	= 1,
+	.resource	= &sdp3430_flash_resource,
+};
+
+static struct resource sdp3430_smc91x_resources[] = {
+	[0] = {
+		.start	= OMAP34XX_ETHR_START,
+		.end	= OMAP34XX_ETHR_START + SZ_4K,
+		.flags		= IORESOURCE_MEM,
+		  },
+	[1] = {
+		.start		= OMAP_GPIO_IRQ(OMAP34XX_ETHR_GPIO_IRQ),
+		.end	= 0,
+		.flags		= IORESOURCE_IRQ,
+		  },
+};
+
+static struct platform_device sdp3430_smc91x_device = {
+	.name		= "smc91x",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(sdp3430_smc91x_resources),
+	.resource	= sdp3430_smc91x_resources,
+};
+
+#ifdef CONFIG_USB_MUSB_HDRC
+static struct resource musb_resources[] = {
+	[0] = {
+		 .start	= OMAP343X_HS_BASE,
+		 .end	= OMAP343X_HS_BASE + SZ_8K,
+		 .flags	= IORESOURCE_MEM,
+		  },
+	[1] = {	/* general IRQ */
+		 .start	= INT_HS_USB_MC_NINT,
+		 .flags	= IORESOURCE_IRQ,
+		  },
+	[2] = {		/* DMA IRQ */
+		 .start	= INT_HS_USB_DMA_NINT,
+		 .flags	= IORESOURCE_IRQ,
+		  },
+};
+
+static struct musb_hdrc_platform_data musb_plat = {
+#ifdef CONFIG_USB_MUSB_OTG
+	.mode		= MUSB_OTG,
+#elif CONFIG_USB_MUSB_HDRC_HCD
+	.mode		= MUSB_HOST,
+#elif CONFIG_USB_GADGET_MUSB_HDRC
+	.mode		= MUSB_PERIPHERAL,
+#endif
+	.multipoint	= 1,
+};
+
+static u64 musb_dmamask = ~(u32)0;
+
+static struct platform_device musb_device = {
+	.name		= "musb_hdrc",
+	.id		= 0,
+	.dev = {
+		.dma_mask		= &musb_dmamask,
+		.coherent_dma_mask	= 0xffffffff,
+		.platform_data		= &musb_plat,
+	},
+	.num_resources	= ARRAY_SIZE(musb_resources),
+	.resource	= musb_resources,
+};
+#endif /* CONFIG_USB_MUSB_HDRC */
+static struct platform_device *sdp3430_devices[] __initdata = {
+	&sdp3430_smc91x_device,
+	&sdp3430_flash_device,
+#ifdef CONFIG_USB_MUSB_HDRC
+	&musb_device,
+#endif
+};
+#if 	defined(CONFIG_USB_OMAP24XX_FS_PORT0)
+static struct omap_usb_config fsusb_otg0_config __initdata = {
+	/* usb0 has a Mini-AB port and external isp1301 transceiver */
+	.otg		= 1,
+
+#ifdef	CONFIG_USB_GADGET_OMAP
+	.hmc_mode	= 0x0,	// 0:dev/otg 1:disabled 2:disabled
+
+#elif	defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
+	.hmc_mode	= 0x1,	// 0:host|otg 1:host 2:host
+#endif
+
+	.pins[0]	= 3,
+};
+
+#elif	defined(CONFIG_USB_OMAP24XX_FS_PORT1)
+static struct omap_usb_config fsusb_host1_config __initdata = {
+	.register_host	= 1,
+	.hmc_mode	= 0x1,	// 0:host|otg 1:host 2:host
+	.pins[1]	= 3,
+};
+#endif
+
+static inline void __init sdp3430_init_smc91x(void)
+{
+	int eth_cs;
+	unsigned long cs_mem_base;
+	unsigned int rate;
+	struct clk *l3ck;
+
+	eth_cs	= SDP3430_SMC91X_CS;
+
+	l3ck = clk_get(NULL, "core_l3_ck");
+	if (IS_ERR(l3ck))
+		rate = 100000000;
+	else
+		rate = clk_get_rate(l3ck);
+
+	if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
+		printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
+		return;
+	}
+
+	sdp3430_smc91x_resources[0].start = cs_mem_base + 0x0;
+	sdp3430_smc91x_resources[0].end   = cs_mem_base + 0xf;
+	udelay(100);
+	if (omap_request_gpio(OMAP34XX_ETHR_GPIO_IRQ) < 0) {
+		printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
+			OMAP34XX_ETHR_GPIO_IRQ);
+		return;
+	}
+	omap_set_gpio_direction(OMAP34XX_ETHR_GPIO_IRQ, 1);
+}
+
+static void __init sdp3430_init_flash(void)
+{
+	unsigned long base;
+
+	if (gpmc_cs_request(SDP3430_FLASH_CS, SZ_64M, &base) < 0) {
+		printk("Can't request GPMC CS for flash\n");
+		return;
+	}
+	sdp3430_flash_resource.start	= base;
+	sdp3430_flash_resource.end	= base + SZ_64M - 1;
+}
+
+static void __init omap_3430sdp_init_irq(void)
+{
+	omap2_init_common_hw();
+	omap_init_irq();
+	omap_gpio_init();
+	sdp3430_init_smc91x();
+}
+
+static struct omap_uart_config sdp3430_uart_config __initdata = {
+	.enabled_uarts	= ((1 << 0) | (1 << 1) | (1 << 2)),
+};
+
+static struct omap_mmc_config sdp3430_mmc_config __initdata = {
+	.mmc [0] = {
+		.enabled	= 1,
+		.wire4		= -1,
+		.wp_pin		= -1,
+		.power_pin	= -1,
+		.switch_pin	= 0,
+	},
+	.mmc [1] = {
+		.enabled	= 1,
+		.wire4		= -1,
+		.wp_pin		= -1,
+		.power_pin	= -1,
+		.switch_pin	= 1,
+	},
+};
+
+static struct omap_board_config_kernel sdp3430_config[] = {
+	{ OMAP_TAG_UART,	&sdp3430_uart_config },
+	{ OMAP_TAG_MMC,	&sdp3430_mmc_config },
+#if	defined(CONFIG_USB_OMAP24XX_FS_PORT0)
+	{ OMAP_TAG_USB,	&fsusb_otg0_config },
+#elif	defined(CONFIG_USB_OMAP24XX_FS_PORT1)
+	{ OMAP_TAG_USB,	&fsusb_host1_config },
+#endif
+};
+
+static void __init omap_3430sdp_init(void)
+{
+	platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices));
+	omap_board_config = sdp3430_config;
+	omap_board_config_size = ARRAY_SIZE(sdp3430_config);
+	omap_serial_init();
+}
+
+static void __init omap_3430sdp_map_io(void)
+{
+	omap2_map_common_io();
+}
+
+MACHINE_START(OMAP_SDP3430, "OMAP3430 sdp3430 board")
+	/* Maintainer: Syed Khasim - Texas Instruments Inc */
+	.phys_io	= 0x48000000,
+	.io_pg_offst	= ((0xd8000000) >> 18) & 0xfffc,
+	.boot_params	= 0x80000100,
+	.map_io		= omap_3430sdp_map_io,
+	.init_irq	= omap_3430sdp_init_irq,
+	.init_machine	= omap_3430sdp_init,
+	.timer		= &omap_timer,
+MACHINE_END
diff -purN linux-omap/arch/arm/mach-omap2/clock.h val_3430_GIT/arch/arm/mach-omap2/clock.h
--- linux-omap/arch/arm/mach-omap2/clock.h	2007-05-25 15:52:23.000000000 -0500
+++ val_3430_GIT/arch/arm/mach-omap2/clock.h	2007-05-28 12:47:13.000000000 -0500
@@ -39,6 +39,7 @@ static u32 omap2_clksel_get_divisor(stru
 
 #define RATE_IN_242X	(1 << 0)
 #define RATE_IN_243X	(1 << 1)
+#define RATE_IN_343X	(1 << 2)
 
 /* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
  * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP
diff -purN linux-omap/arch/arm/mach-omap2/gpmc.c val_3430_GIT/arch/arm/mach-omap2/gpmc.c
--- linux-omap/arch/arm/mach-omap2/gpmc.c	2007-05-16 14:32:40.000000000 -0500
+++ val_3430_GIT/arch/arm/mach-omap2/gpmc.c	2007-05-29 14:27:19.000000000 -0500
@@ -22,12 +22,10 @@
 
 #undef DEBUG
 
-#ifdef CONFIG_ARCH_OMAP2420
+#if defined(CONFIG_ARCH_OMAP2420)
 #define GPMC_BASE		0x6800a000
-#endif
-
-#ifdef CONFIG_ARCH_OMAP2430
-#define GPMC_BASE		0x6E000000
+#elif defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
+#define GPMC_BASE		0x6e000000
 #endif
 
 #define GPMC_REVISION		0x00
diff -purN linux-omap/arch/arm/mach-omap2/id.c val_3430_GIT/arch/arm/mach-omap2/id.c
--- linux-omap/arch/arm/mach-omap2/id.c	2006-11-20 21:54:01.000000000 -0600
+++ val_3430_GIT/arch/arm/mach-omap2/id.c	2007-05-30 17:44:54.000000000 -0500
@@ -18,11 +18,11 @@
 #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)
+#define TAP_BASE	io_p2v(0x48014000)
+#elif defined(CONFIG_ARCH_OMAP2430)
+#define TAP_BASE	io_p2v(0x4900A000)
+#elif defined(CONFIG_ARCH_OMAP34XX)
+#define TAP_BASE	io_p2v(0x54004000)
 #endif
 
 #define OMAP_TAP_IDCODE		0x0204
@@ -58,7 +58,7 @@ static struct omap_id omap_ids[] __initd
 
 static u32 __init read_tap_reg(int reg)
 {
-	return __raw_readl(OMAP24XX_TAP_BASE + reg);
+	return __raw_readl(TAP_BASE + reg);
 }
 
 void __init omap2_check_revision(void)
@@ -118,9 +118,16 @@ void __init omap2_check_revision(void)
 
 	system_rev |= rev << 8;
 
-	/* Add the cpu class info (24xx) */
-	system_rev |= 0x24;
+	/* REVISIT:
+	 * OMAP 3430 ES 1.0 does't populate IDCODE registers
+	 * Following lines have to be revisited for next version
+	 */
 
+#ifndef CONFIG_ARCH_OMAP3
+	system_rev |= 0x24;
+#else
+	system_rev |= 0x34;
+#endif
 	pr_info("OMAP%04x", system_rev >> 16);
 	if ((system_rev >> 8) & 0x0f)
 		printk("%x", (system_rev >> 8) & 0x0f);
diff -purN linux-omap/arch/arm/mach-omap2/irq.c val_3430_GIT/arch/arm/mach-omap2/irq.c
--- linux-omap/arch/arm/mach-omap2/irq.c	2007-01-08 18:55:58.000000000 -0600
+++ val_3430_GIT/arch/arm/mach-omap2/irq.c	2007-05-29 20:21:42.000000000 -0500
@@ -37,11 +37,9 @@ static struct omap_irq_bank {
 } __attribute__ ((aligned(4))) irq_banks[] = {
 	{
 		/* MPU INTC */
-		.base_reg	= IO_ADDRESS(OMAP24XX_IC_BASE),
+		.base_reg	= 0,
 		.nr_irqs	= 96,
-	}, {
-		/* XXX: DSP INTC */
-	}
+	},
 };
 
 /* XXX: FIQ and additional INTC support (only MPU at the moment) */
@@ -118,10 +116,16 @@ void __init omap_init_irq(void)
 	for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
 		struct omap_irq_bank *bank = irq_banks + i;
 
-		/* XXX */
-		if (!bank->base_reg)
-			continue;
-
+#ifdef CONFIG_ARCH_OMAP24XX
+		if (cpu_is_omap24xx()) {
+			bank->base_reg = IO_ADDRESS(OMAP24XX_IC_BASE);
+		}
+#endif
+#ifdef CONFIG_ARCH_OMAP34XX
+		if (cpu_is_omap34xx()) {
+			bank->base_reg = IO_ADDRESS(OMAP34XX_IC_BASE);
+		}
+#endif
 		omap_irq_bank_init_one(bank);
 
 		nr_irqs += bank->nr_irqs;

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

end of thread, other threads:[~2007-06-13  6:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-31 17:58 [PATCH 5/12] OMAP3430 support in mach-omap2 folder Syed Mohammed, Khasim
2007-06-01  6:21 ` Trilok Soni
2007-06-01 12:38   ` Syed Mohammed, Khasim
2007-06-12 18:23     ` Tony Lindgren
2007-06-13  3:47       ` Syed Mohammed, Khasim
2007-06-13  6:05         ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox