1 #include <linux/init.h> 2 #include <linux/platform_device.h> 3 #include <linux/mtd/physmap.h> 4 #include <linux/serial_8250.h> 5 #include <linux/serial_reg.h> 6 #include <linux/usb/isp116x.h> 7 #include <linux/delay.h> 8 #include <asm/machvec.h> 9 #include <mach-se/mach/se7343.h> 10 #include <asm/heartbeat.h> 11 #include <asm/irq.h> 12 #include <asm/io.h> 13 14 static struct resource heartbeat_resources[] = { 15 [0] = { 16 .start = PA_LED, 17 .end = PA_LED, 18 .flags = IORESOURCE_MEM, 19 }, 20 }; 21 22 static struct heartbeat_data heartbeat_data = { 23 .regsize = 16, 24 }; 25 26 static struct platform_device heartbeat_device = { 27 .name = "heartbeat", 28 .id = -1, 29 .dev = { 30 .platform_data = &heartbeat_data, 31 }, 32 .num_resources = ARRAY_SIZE(heartbeat_resources), 33 .resource = heartbeat_resources, 34 }; 35 36 static struct mtd_partition nor_flash_partitions[] = { 37 { 38 .name = "loader", 39 .offset = 0x00000000, 40 .size = 128 * 1024, 41 }, 42 { 43 .name = "rootfs", 44 .offset = MTDPART_OFS_APPEND, 45 .size = 31 * 1024 * 1024, 46 }, 47 { 48 .name = "data", 49 .offset = MTDPART_OFS_APPEND, 50 .size = MTDPART_SIZ_FULL, 51 }, 52 }; 53 54 static struct physmap_flash_data nor_flash_data = { 55 .width = 2, 56 .parts = nor_flash_partitions, 57 .nr_parts = ARRAY_SIZE(nor_flash_partitions), 58 }; 59 60 static struct resource nor_flash_resources[] = { 61 [0] = { 62 .start = 0x00000000, 63 .end = 0x01ffffff, 64 .flags = IORESOURCE_MEM, 65 } 66 }; 67 68 static struct platform_device nor_flash_device = { 69 .name = "physmap-flash", 70 .dev = { 71 .platform_data = &nor_flash_data, 72 }, 73 .num_resources = ARRAY_SIZE(nor_flash_resources), 74 .resource = nor_flash_resources, 75 }; 76 77 #define ST16C2550C_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP) 78 79 static struct plat_serial8250_port serial_platform_data[] = { 80 [0] = { 81 .iotype = UPIO_MEM, 82 .mapbase = 0x16000000, 83 .regshift = 1, 84 .flags = ST16C2550C_FLAGS, 85 .irq = UARTA_IRQ, 86 .uartclk = 7372800, 87 }, 88 [1] = { 89 .iotype = UPIO_MEM, 90 .mapbase = 0x17000000, 91 .regshift = 1, 92 .flags = ST16C2550C_FLAGS, 93 .irq = UARTB_IRQ, 94 .uartclk = 7372800, 95 }, 96 { }, 97 }; 98 99 static struct platform_device uart_device = { 100 .name = "serial8250", 101 .id = PLAT8250_DEV_PLATFORM, 102 .dev = { 103 .platform_data = serial_platform_data, 104 }, 105 }; 106 107 static void isp116x_delay(struct device *dev, int delay) 108 { 109 ndelay(delay); 110 } 111 112 static struct resource usb_resources[] = { 113 [0] = { 114 .start = 0x11800000, 115 .end = 0x11800001, 116 .flags = IORESOURCE_MEM, 117 }, 118 [1] = { 119 .start = 0x11800002, 120 .end = 0x11800003, 121 .flags = IORESOURCE_MEM, 122 }, 123 [2] = { 124 .start = USB_IRQ, 125 .flags = IORESOURCE_IRQ, 126 }, 127 }; 128 129 static struct isp116x_platform_data usb_platform_data = { 130 .sel15Kres = 1, 131 .oc_enable = 1, 132 .int_act_high = 0, 133 .int_edge_triggered = 0, 134 .remote_wakeup_enable = 0, 135 .delay = isp116x_delay, 136 }; 137 138 static struct platform_device usb_device = { 139 .name = "isp116x-hcd", 140 .id = -1, 141 .num_resources = ARRAY_SIZE(usb_resources), 142 .resource = usb_resources, 143 .dev = { 144 .platform_data = &usb_platform_data, 145 }, 146 147 }; 148 149 static struct platform_device *sh7343se_platform_devices[] __initdata = { 150 &heartbeat_device, 151 &nor_flash_device, 152 &uart_device, 153 &usb_device, 154 }; 155 156 static int __init sh7343se_devices_setup(void) 157 { 158 return platform_add_devices(sh7343se_platform_devices, 159 ARRAY_SIZE(sh7343se_platform_devices)); 160 } 161 device_initcall(sh7343se_devices_setup); 162 163 /* 164 * Initialize the board 165 */ 166 static void __init sh7343se_setup(char **cmdline_p) 167 { 168 ctrl_outw(0xf900, FPGA_OUT); /* FPGA */ 169 170 ctrl_outw(0x0002, PORT_PECR); /* PORT E 1 = IRQ5 */ 171 ctrl_outw(0x0020, PORT_PSELD); 172 173 printk(KERN_INFO "MS7343CP01 Setup...done\n"); 174 } 175 176 /* 177 * The Machine Vector 178 */ 179 static struct sh_machine_vector mv_7343se __initmv = { 180 .mv_name = "SolutionEngine 7343", 181 .mv_setup = sh7343se_setup, 182 .mv_nr_irqs = SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_NR, 183 .mv_init_irq = init_7343se_IRQ, 184 }; 185