Path: blob/master/arch/sh/boards/mach-se/7722/setup.c
15162 views
/*1* linux/arch/sh/boards/se/7722/setup.c2*3* Copyright (C) 2007 Nobuhiro Iwamatsu4*5* Hitachi UL SolutionEngine 7722 Support.6*7* This file is subject to the terms and conditions of the GNU General Public8* License. See the file "COPYING" in the main directory of this archive9* for more details.10*11*/12#include <linux/init.h>13#include <linux/platform_device.h>14#include <linux/ata_platform.h>15#include <linux/input.h>16#include <linux/input/sh_keysc.h>17#include <linux/smc91x.h>18#include <mach-se/mach/se7722.h>19#include <mach-se/mach/mrshpc.h>20#include <asm/machvec.h>21#include <asm/clock.h>22#include <asm/io.h>23#include <asm/heartbeat.h>24#include <cpu/sh7722.h>2526/* Heartbeat */27static struct resource heartbeat_resource = {28.start = PA_LED,29.end = PA_LED,30.flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,31};3233static struct platform_device heartbeat_device = {34.name = "heartbeat",35.id = -1,36.num_resources = 1,37.resource = &heartbeat_resource,38};3940/* SMC91x */41static struct smc91x_platdata smc91x_info = {42.flags = SMC91X_USE_16BIT,43};4445static struct resource smc91x_eth_resources[] = {46[0] = {47.name = "smc91x-regs" ,48.start = PA_LAN + 0x300,49.end = PA_LAN + 0x300 + 0x10 ,50.flags = IORESOURCE_MEM,51},52[1] = {53/* Filled in later */54.flags = IORESOURCE_IRQ,55},56};5758static struct platform_device smc91x_eth_device = {59.name = "smc91x",60.id = 0,61.dev = {62.dma_mask = NULL, /* don't use dma */63.coherent_dma_mask = 0xffffffff,64.platform_data = &smc91x_info,65},66.num_resources = ARRAY_SIZE(smc91x_eth_resources),67.resource = smc91x_eth_resources,68};6970static struct resource cf_ide_resources[] = {71[0] = {72.start = PA_MRSHPC_IO + 0x1f0,73.end = PA_MRSHPC_IO + 0x1f0 + 8 ,74.flags = IORESOURCE_IO,75},76[1] = {77.start = PA_MRSHPC_IO + 0x1f0 + 0x206,78.end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,79.flags = IORESOURCE_IO,80},81[2] = {82/* Filled in later */83.flags = IORESOURCE_IRQ,84},85};8687static struct platform_device cf_ide_device = {88.name = "pata_platform",89.id = -1,90.num_resources = ARRAY_SIZE(cf_ide_resources),91.resource = cf_ide_resources,92};9394static struct sh_keysc_info sh_keysc_info = {95.mode = SH_KEYSC_MODE_1, /* KEYOUT0->5, KEYIN0->4 */96.scan_timing = 3,97.delay = 5,98.keycodes = { /* SW1 -> SW30 */99KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,100KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,101KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,102KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T,103KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y,104KEY_Z,105KEY_HOME, KEY_SLEEP, KEY_WAKEUP, KEY_COFFEE, /* life */106},107};108109static struct resource sh_keysc_resources[] = {110[0] = {111.start = 0x044b0000,112.end = 0x044b000f,113.flags = IORESOURCE_MEM,114},115[1] = {116.start = 79,117.flags = IORESOURCE_IRQ,118},119};120121static struct platform_device sh_keysc_device = {122.name = "sh_keysc",123.id = 0, /* "keysc0" clock */124.num_resources = ARRAY_SIZE(sh_keysc_resources),125.resource = sh_keysc_resources,126.dev = {127.platform_data = &sh_keysc_info,128},129.archdata = {130.hwblk_id = HWBLK_KEYSC,131},132};133134static struct platform_device *se7722_devices[] __initdata = {135&heartbeat_device,136&smc91x_eth_device,137&cf_ide_device,138&sh_keysc_device,139};140141static int __init se7722_devices_setup(void)142{143mrshpc_setup_windows();144145/* Wire-up dynamic vectors */146cf_ide_resources[2].start = cf_ide_resources[2].end =147se7722_fpga_irq[SE7722_FPGA_IRQ_MRSHPC0];148149smc91x_eth_resources[1].start = smc91x_eth_resources[1].end =150se7722_fpga_irq[SE7722_FPGA_IRQ_SMC];151152return platform_add_devices(se7722_devices, ARRAY_SIZE(se7722_devices));153}154device_initcall(se7722_devices_setup);155156static void __init se7722_setup(char **cmdline_p)157{158__raw_writew(0x010D, FPGA_OUT); /* FPGA */159160__raw_writew(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */161__raw_writew(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */162163/* LCDC I/O */164__raw_writew(0x0020, PORT_PSELD);165166/* SIOF1*/167__raw_writew(0x0003, PORT_PSELB);168__raw_writew(0xe000, PORT_PSELC);169__raw_writew(0x0000, PORT_PKCR);170171/* LCDC */172__raw_writew(0x4020, PORT_PHCR);173__raw_writew(0x0000, PORT_PLCR);174__raw_writew(0x0000, PORT_PMCR);175__raw_writew(0x0002, PORT_PRCR);176__raw_writew(0x0000, PORT_PXCR); /* LCDC,CS6A */177178/* KEYSC */179__raw_writew(0x0A10, PORT_PSELA); /* BS,SHHID2 */180__raw_writew(0x0000, PORT_PYCR);181__raw_writew(0x0000, PORT_PZCR);182__raw_writew(__raw_readw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);183__raw_writew(__raw_readw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);184}185186/*187* The Machine Vector188*/189static struct sh_machine_vector mv_se7722 __initmv = {190.mv_name = "Solution Engine 7722" ,191.mv_setup = se7722_setup ,192.mv_init_irq = init_se7722_IRQ,193};194195196