| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * linux/arch/arm/mach-omap/board-h3.c | 
 | 3 |  * | 
 | 4 |  * This file contains OMAP1710 H3 specific code. | 
 | 5 |  * | 
 | 6 |  * Copyright (C) 2004 Texas Instruments, Inc. | 
 | 7 |  * Copyright (C) 2002 MontaVista Software, Inc. | 
 | 8 |  * Copyright (C) 2001 RidgeRun, Inc. | 
 | 9 |  * Author: RidgeRun, Inc. | 
 | 10 |  *         Greg Lonnon (glonnon@ridgerun.com) or info@ridgerun.com | 
 | 11 |  * | 
 | 12 |  * This program is free software; you can redistribute it and/or modify | 
 | 13 |  * it under the terms of the GNU General Public License version 2 as | 
 | 14 |  * published by the Free Software Foundation. | 
 | 15 |  */ | 
 | 16 |  | 
 | 17 | #include <linux/config.h> | 
 | 18 | #include <linux/types.h> | 
 | 19 | #include <linux/init.h> | 
 | 20 | #include <linux/major.h> | 
 | 21 | #include <linux/kernel.h> | 
 | 22 | #include <linux/device.h> | 
 | 23 | #include <linux/errno.h> | 
 | 24 | #include <linux/mtd/mtd.h> | 
 | 25 | #include <linux/mtd/partitions.h> | 
 | 26 |  | 
 | 27 | #include <asm/setup.h> | 
 | 28 | #include <asm/page.h> | 
 | 29 | #include <asm/hardware.h> | 
 | 30 | #include <asm/mach-types.h> | 
 | 31 | #include <asm/mach/arch.h> | 
 | 32 | #include <asm/mach/flash.h> | 
 | 33 | #include <asm/mach/map.h> | 
 | 34 |  | 
 | 35 | #include <asm/arch/gpio.h> | 
 | 36 | #include <asm/arch/irqs.h> | 
 | 37 | #include <asm/arch/mux.h> | 
 | 38 | #include <asm/arch/tc.h> | 
 | 39 | #include <asm/arch/usb.h> | 
 | 40 |  | 
 | 41 | #include "common.h" | 
 | 42 |  | 
 | 43 | extern int omap_gpio_init(void); | 
 | 44 |  | 
 | 45 | static int __initdata h3_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1}; | 
 | 46 |  | 
 | 47 | static struct mtd_partition h3_partitions[] = { | 
 | 48 | 	/* bootloader (U-Boot, etc) in first sector */ | 
 | 49 | 	{ | 
 | 50 | 	      .name		= "bootloader", | 
 | 51 | 	      .offset		= 0, | 
 | 52 | 	      .size		= SZ_128K, | 
 | 53 | 	      .mask_flags	= MTD_WRITEABLE, /* force read-only */ | 
 | 54 | 	}, | 
 | 55 | 	/* bootloader params in the next sector */ | 
 | 56 | 	{ | 
 | 57 | 	      .name		= "params", | 
 | 58 | 	      .offset		= MTDPART_OFS_APPEND, | 
 | 59 | 	      .size		= SZ_128K, | 
 | 60 | 	      .mask_flags	= 0, | 
 | 61 | 	}, | 
 | 62 | 	/* kernel */ | 
 | 63 | 	{ | 
 | 64 | 	      .name		= "kernel", | 
 | 65 | 	      .offset		= MTDPART_OFS_APPEND, | 
 | 66 | 	      .size		= SZ_2M, | 
 | 67 | 	      .mask_flags	= 0 | 
 | 68 | 	}, | 
 | 69 | 	/* file system */ | 
 | 70 | 	{ | 
 | 71 | 	      .name		= "filesystem", | 
 | 72 | 	      .offset		= MTDPART_OFS_APPEND, | 
 | 73 | 	      .size		= MTDPART_SIZ_FULL, | 
 | 74 | 	      .mask_flags	= 0 | 
 | 75 | 	} | 
 | 76 | }; | 
 | 77 |  | 
 | 78 | static struct flash_platform_data h3_flash_data = { | 
 | 79 | 	.map_name	= "cfi_probe", | 
 | 80 | 	.width		= 2, | 
 | 81 | 	.parts		= h3_partitions, | 
 | 82 | 	.nr_parts	= ARRAY_SIZE(h3_partitions), | 
 | 83 | }; | 
 | 84 |  | 
 | 85 | static struct resource h3_flash_resource = { | 
 | 86 | 	.start		= OMAP_CS2B_PHYS, | 
 | 87 | 	.end		= OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1, | 
 | 88 | 	.flags		= IORESOURCE_MEM, | 
 | 89 | }; | 
 | 90 |  | 
 | 91 | static struct platform_device flash_device = { | 
 | 92 | 	.name		= "omapflash", | 
 | 93 | 	.id		= 0, | 
 | 94 | 	.dev		= { | 
 | 95 | 		.platform_data	= &h3_flash_data, | 
 | 96 | 	}, | 
 | 97 | 	.num_resources	= 1, | 
 | 98 | 	.resource	= &h3_flash_resource, | 
 | 99 | }; | 
 | 100 |  | 
 | 101 | static struct resource smc91x_resources[] = { | 
 | 102 | 	[0] = { | 
 | 103 | 		.start	= OMAP1710_ETHR_START,		/* Physical */ | 
 | 104 | 		.end	= OMAP1710_ETHR_START + 0xf, | 
 | 105 | 		.flags	= IORESOURCE_MEM, | 
 | 106 | 	}, | 
 | 107 | 	[1] = { | 
 | 108 | 		.start	= OMAP_GPIO_IRQ(40), | 
 | 109 | 		.end	= OMAP_GPIO_IRQ(40), | 
 | 110 | 		.flags	= IORESOURCE_IRQ, | 
 | 111 | 	}, | 
 | 112 | }; | 
 | 113 |  | 
 | 114 | static struct platform_device smc91x_device = { | 
 | 115 | 	.name		= "smc91x", | 
 | 116 | 	.id		= 0, | 
 | 117 | 	.num_resources	= ARRAY_SIZE(smc91x_resources), | 
 | 118 | 	.resource	= smc91x_resources, | 
 | 119 | }; | 
 | 120 |  | 
 | 121 | #define GPTIMER_BASE		0xFFFB1400 | 
 | 122 | #define GPTIMER_REGS(x)	(0xFFFB1400 + (x * 0x800)) | 
 | 123 | #define GPTIMER_REGS_SIZE	0x46 | 
 | 124 |  | 
 | 125 | static struct resource intlat_resources[] = { | 
 | 126 | 	[0] = { | 
 | 127 | 		.start  = GPTIMER_REGS(0),	      /* Physical */ | 
 | 128 | 		.end    = GPTIMER_REGS(0) + GPTIMER_REGS_SIZE, | 
 | 129 | 		.flags  = IORESOURCE_MEM, | 
 | 130 | 	}, | 
 | 131 | 	[1] = { | 
 | 132 | 		.start  = INT_1610_GPTIMER1, | 
 | 133 | 		.end    = INT_1610_GPTIMER1, | 
 | 134 | 		.flags  = IORESOURCE_IRQ, | 
 | 135 | 	}, | 
 | 136 | }; | 
 | 137 |  | 
 | 138 | static struct platform_device intlat_device = { | 
 | 139 | 	.name	   = "omap_intlat", | 
 | 140 | 	.id	     = 0, | 
 | 141 | 	.num_resources  = ARRAY_SIZE(intlat_resources), | 
 | 142 | 	.resource       = intlat_resources, | 
 | 143 | }; | 
 | 144 |  | 
 | 145 | static struct platform_device *devices[] __initdata = { | 
 | 146 | 	&flash_device, | 
 | 147 |         &smc91x_device, | 
 | 148 | 	&intlat_device, | 
 | 149 | }; | 
 | 150 |  | 
 | 151 | static struct omap_usb_config h3_usb_config __initdata = { | 
 | 152 | 	/* usb1 has a Mini-AB port and external isp1301 transceiver */ | 
 | 153 | 	.otg	    = 2, | 
 | 154 |  | 
 | 155 | #ifdef CONFIG_USB_GADGET_OMAP | 
 | 156 | 	.hmc_mode       = 19,   /* 0:host(off) 1:dev|otg 2:disabled */ | 
 | 157 | #elif  defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 
 | 158 | 	/* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */ | 
 | 159 | 	.hmc_mode       = 20,   /* 1:dev|otg(off) 1:host 2:disabled */ | 
 | 160 | #endif | 
 | 161 |  | 
 | 162 | 	.pins[1]	= 3, | 
 | 163 | }; | 
 | 164 |  | 
 | 165 | static struct omap_board_config_kernel h3_config[] = { | 
 | 166 | 	{ OMAP_TAG_USB,	 &h3_usb_config }, | 
 | 167 | }; | 
 | 168 |  | 
 | 169 | static void __init h3_init(void) | 
 | 170 | { | 
 | 171 | 	(void) platform_add_devices(devices, ARRAY_SIZE(devices)); | 
 | 172 | } | 
 | 173 |  | 
 | 174 | static void __init h3_init_smc91x(void) | 
 | 175 | { | 
 | 176 | 	omap_cfg_reg(W15_1710_GPIO40); | 
 | 177 | 	if (omap_request_gpio(40) < 0) { | 
 | 178 | 		printk("Error requesting gpio 40 for smc91x irq\n"); | 
 | 179 | 		return; | 
 | 180 | 	} | 
 | 181 | 	omap_set_gpio_edge_ctrl(40, OMAP_GPIO_FALLING_EDGE); | 
 | 182 | } | 
 | 183 |  | 
 | 184 | void h3_init_irq(void) | 
 | 185 | { | 
 | 186 | 	omap_init_irq(); | 
 | 187 | 	omap_gpio_init(); | 
 | 188 | 	h3_init_smc91x(); | 
 | 189 | } | 
 | 190 |  | 
 | 191 | static void __init h3_map_io(void) | 
 | 192 | { | 
 | 193 | 	omap_map_io(); | 
 | 194 | 	omap_serial_init(h3_serial_ports); | 
 | 195 | } | 
 | 196 |  | 
 | 197 | MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") | 
 | 198 | 	MAINTAINER("Texas Instruments, Inc.") | 
 | 199 | 	BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000) | 
 | 200 | 	BOOT_PARAMS(0x10000100) | 
 | 201 | 	MAPIO(h3_map_io) | 
 | 202 | 	INITIRQ(h3_init_irq) | 
 | 203 | 	INIT_MACHINE(h3_init) | 
 | 204 | 	.timer		= &omap_timer, | 
 | 205 | MACHINE_END |