1/* 2 * arch/mips/emma2rh/markeins/platofrm.c 3 * This file sets up platform devices for EMMA2RH Mark-eins. 4 * 5 * Copyright(C) MontaVista Software Inc, 2006 6 * 7 * Author: dmitry pervushin <dpervushin@ru.mvista.com> 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23#include <linux/init.h> 24#include <linux/kernel.h> 25#include <linux/types.h> 26#include <linux/ioport.h> 27#include <linux/serial_8250.h> 28#include <linux/mtd/physmap.h> 29 30#include <asm/cpu.h> 31#include <asm/bootinfo.h> 32#include <asm/addrspace.h> 33#include <asm/time.h> 34#include <asm/bcache.h> 35#include <asm/irq.h> 36#include <asm/reboot.h> 37#include <asm/gdb-stub.h> 38#include <asm/traps.h> 39#include <asm/debug.h> 40 41#include <asm/emma2rh/emma2rh.h> 42 43 44#define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */ 45 46static struct resource i2c_emma_resources_0[] = { 47 { 48 .name = NULL, 49 .start = EMMA2RH_IRQ_PIIC0, 50 .end = EMMA2RH_IRQ_PIIC0, 51 .flags = IORESOURCE_IRQ 52 }, { 53 .name = NULL, 54 .start = EMMA2RH_PIIC0_BASE, 55 .end = EMMA2RH_PIIC0_BASE + 0x1000, 56 .flags = 0 57 }, 58}; 59 60struct resource i2c_emma_resources_1[] = { 61 { 62 .name = NULL, 63 .start = EMMA2RH_IRQ_PIIC1, 64 .end = EMMA2RH_IRQ_PIIC1, 65 .flags = IORESOURCE_IRQ 66 }, { 67 .name = NULL, 68 .start = EMMA2RH_PIIC1_BASE, 69 .end = EMMA2RH_PIIC1_BASE + 0x1000, 70 .flags = 0 71 }, 72}; 73 74struct resource i2c_emma_resources_2[] = { 75 { 76 .name = NULL, 77 .start = EMMA2RH_IRQ_PIIC2, 78 .end = EMMA2RH_IRQ_PIIC2, 79 .flags = IORESOURCE_IRQ 80 }, { 81 .name = NULL, 82 .start = EMMA2RH_PIIC2_BASE, 83 .end = EMMA2RH_PIIC2_BASE + 0x1000, 84 .flags = 0 85 }, 86}; 87 88struct platform_device i2c_emma_devices[] = { 89 [0] = { 90 .name = I2C_EMMA2RH, 91 .id = 0, 92 .resource = i2c_emma_resources_0, 93 .num_resources = ARRAY_SIZE(i2c_emma_resources_0), 94 }, 95 [1] = { 96 .name = I2C_EMMA2RH, 97 .id = 1, 98 .resource = i2c_emma_resources_1, 99 .num_resources = ARRAY_SIZE(i2c_emma_resources_1), 100 }, 101 [2] = { 102 .name = I2C_EMMA2RH, 103 .id = 2, 104 .resource = i2c_emma_resources_2, 105 .num_resources = ARRAY_SIZE(i2c_emma_resources_2), 106 }, 107}; 108 109#define EMMA2RH_SERIAL_CLOCK 18544000 110#define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST 111 112static struct plat_serial8250_port platform_serial_ports[] = { 113 [0] = { 114 .membase= (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3), 115 .irq = EMMA2RH_IRQ_PFUR0, 116 .uartclk = EMMA2RH_SERIAL_CLOCK, 117 .regshift = 4, 118 .iotype = UPIO_MEM, 119 .flags = EMMA2RH_SERIAL_FLAGS, 120 }, [1] = { 121 .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3), 122 .irq = EMMA2RH_IRQ_PFUR1, 123 .uartclk = EMMA2RH_SERIAL_CLOCK, 124 .regshift = 4, 125 .iotype = UPIO_MEM, 126 .flags = EMMA2RH_SERIAL_FLAGS, 127 }, [2] = { 128 .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR2_BASE + 3), 129 .irq = EMMA2RH_IRQ_PFUR2, 130 .uartclk = EMMA2RH_SERIAL_CLOCK, 131 .regshift = 4, 132 .iotype = UPIO_MEM, 133 .flags = EMMA2RH_SERIAL_FLAGS, 134 }, [3] = { 135 .flags = 0, 136 }, 137}; 138 139static struct platform_device serial_emma = { 140 .name = "serial8250", 141 .dev = { 142 .platform_data = &platform_serial_ports, 143 }, 144}; 145 146static struct platform_device *devices[] = { 147 &i2c_emma_devices[0], 148 &i2c_emma_devices[1], 149 &i2c_emma_devices[2], 150 &serial_emma, 151}; 152 153static struct mtd_partition markeins_parts[] = { 154 [0] = { 155 .name = "RootFS", 156 .offset = 0x00000000, 157 .size = 0x00c00000, 158 }, 159 [1] = { 160 .name = "boot code area", 161 .offset = MTDPART_OFS_APPEND, 162 .size = 0x00100000, 163 }, 164 [2] = { 165 .name = "kernel image", 166 .offset = MTDPART_OFS_APPEND, 167 .size = 0x00300000, 168 }, 169 [3] = { 170 .name = "RootFS2", 171 .offset = MTDPART_OFS_APPEND, 172 .size = 0x00c00000, 173 }, 174 [4] = { 175 .name = "boot code area2", 176 .offset = MTDPART_OFS_APPEND, 177 .size = 0x00100000, 178 }, 179 [5] = { 180 .name = "kernel image2", 181 .offset = MTDPART_OFS_APPEND, 182 .size = MTDPART_SIZ_FULL, 183 }, 184}; 185 186static int __init platform_devices_setup(void) 187{ 188 physmap_set_partitions(markeins_parts, ARRAY_SIZE(markeins_parts)); 189 return platform_add_devices(devices, ARRAY_SIZE(devices)); 190} 191 192arch_initcall(platform_devices_setup); 193