Path: blob/master/arch/sh/boards/mach-se/7343/setup.c
15162 views
#include <linux/init.h>1#include <linux/platform_device.h>2#include <linux/mtd/physmap.h>3#include <linux/serial_8250.h>4#include <linux/serial_reg.h>5#include <linux/usb/isp116x.h>6#include <linux/delay.h>7#include <asm/machvec.h>8#include <mach-se/mach/se7343.h>9#include <asm/heartbeat.h>10#include <asm/irq.h>11#include <asm/io.h>1213static struct resource heartbeat_resource = {14.start = PA_LED,15.end = PA_LED,16.flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,17};1819static struct platform_device heartbeat_device = {20.name = "heartbeat",21.id = -1,22.num_resources = 1,23.resource = &heartbeat_resource,24};2526static struct mtd_partition nor_flash_partitions[] = {27{28.name = "loader",29.offset = 0x00000000,30.size = 128 * 1024,31},32{33.name = "rootfs",34.offset = MTDPART_OFS_APPEND,35.size = 31 * 1024 * 1024,36},37{38.name = "data",39.offset = MTDPART_OFS_APPEND,40.size = MTDPART_SIZ_FULL,41},42};4344static struct physmap_flash_data nor_flash_data = {45.width = 2,46.parts = nor_flash_partitions,47.nr_parts = ARRAY_SIZE(nor_flash_partitions),48};4950static struct resource nor_flash_resources[] = {51[0] = {52.start = 0x00000000,53.end = 0x01ffffff,54.flags = IORESOURCE_MEM,55}56};5758static struct platform_device nor_flash_device = {59.name = "physmap-flash",60.dev = {61.platform_data = &nor_flash_data,62},63.num_resources = ARRAY_SIZE(nor_flash_resources),64.resource = nor_flash_resources,65};6667#define ST16C2550C_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP)6869static struct plat_serial8250_port serial_platform_data[] = {70[0] = {71.iotype = UPIO_MEM,72.mapbase = 0x16000000,73.regshift = 1,74.flags = ST16C2550C_FLAGS,75.uartclk = 7372800,76},77[1] = {78.iotype = UPIO_MEM,79.mapbase = 0x17000000,80.regshift = 1,81.flags = ST16C2550C_FLAGS,82.uartclk = 7372800,83},84{ },85};8687static struct platform_device uart_device = {88.name = "serial8250",89.id = PLAT8250_DEV_PLATFORM,90.dev = {91.platform_data = serial_platform_data,92},93};9495static void isp116x_delay(struct device *dev, int delay)96{97ndelay(delay);98}99100static struct resource usb_resources[] = {101[0] = {102.start = 0x11800000,103.end = 0x11800001,104.flags = IORESOURCE_MEM,105},106[1] = {107.start = 0x11800002,108.end = 0x11800003,109.flags = IORESOURCE_MEM,110},111[2] = {112/* Filled in later */113.flags = IORESOURCE_IRQ,114},115};116117static struct isp116x_platform_data usb_platform_data = {118.sel15Kres = 1,119.oc_enable = 1,120.int_act_high = 0,121.int_edge_triggered = 0,122.remote_wakeup_enable = 0,123.delay = isp116x_delay,124};125126static struct platform_device usb_device = {127.name = "isp116x-hcd",128.id = -1,129.num_resources = ARRAY_SIZE(usb_resources),130.resource = usb_resources,131.dev = {132.platform_data = &usb_platform_data,133},134135};136137static struct platform_device *sh7343se_platform_devices[] __initdata = {138&heartbeat_device,139&nor_flash_device,140&uart_device,141&usb_device,142};143144static int __init sh7343se_devices_setup(void)145{146/* Wire-up dynamic vectors */147serial_platform_data[0].irq = se7343_fpga_irq[SE7343_FPGA_IRQ_UARTA];148serial_platform_data[1].irq = se7343_fpga_irq[SE7343_FPGA_IRQ_UARTB];149150usb_resources[2].start = usb_resources[2].end =151se7343_fpga_irq[SE7343_FPGA_IRQ_USB];152153return platform_add_devices(sh7343se_platform_devices,154ARRAY_SIZE(sh7343se_platform_devices));155}156device_initcall(sh7343se_devices_setup);157158/*159* Initialize the board160*/161static void __init sh7343se_setup(char **cmdline_p)162{163__raw_writew(0xf900, FPGA_OUT); /* FPGA */164165__raw_writew(0x0002, PORT_PECR); /* PORT E 1 = IRQ5 */166__raw_writew(0x0020, PORT_PSELD);167168printk(KERN_INFO "MS7343CP01 Setup...done\n");169}170171/*172* The Machine Vector173*/174static struct sh_machine_vector mv_7343se __initmv = {175.mv_name = "SolutionEngine 7343",176.mv_setup = sh7343se_setup,177.mv_init_irq = init_7343se_IRQ,178};179180181