blob: 8a6ee842624fb70830bda83e9093320439be7b2c [file] [log] [blame]
Magnus Damm70f784e2008-02-07 00:38:24 +09001/*
2 * Renesas System Solutions Asia Pte. Ltd - Migo-R
3 *
4 * Copyright (C) 2008 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/interrupt.h>
Magnus Damm92cfeb62008-03-04 15:23:45 -080013#include <linux/input.h>
Magnus Damm70f784e2008-02-07 00:38:24 +090014#include <asm/machvec.h>
15#include <asm/io.h>
Magnus Damm92cfeb62008-03-04 15:23:45 -080016#include <asm/sh_keysc.h>
Magnus Damm70f784e2008-02-07 00:38:24 +090017
18/* Address IRQ Size Bus Description
19 * 0x00000000 64MB 16 NOR Flash (SP29PL256N)
20 * 0x0c000000 64MB 64 SDRAM (2xK4M563233G)
21 * 0x10000000 IRQ0 16 Ethernet (SMC91C111)
22 * 0x14000000 IRQ4 16 USB 2.0 Host Controller (M66596)
23 * 0x18000000 8GB 8 NAND Flash (K9K8G08U0A)
24 */
25
26static struct resource smc91x_eth_resources[] = {
27 [0] = {
28 .name = "smc91x-regs" ,
29 .start = P2SEGADDR(0x10000300),
30 .end = P2SEGADDR(0x1000030f),
31 .flags = IORESOURCE_MEM,
32 },
33 [1] = {
34 .start = 32, /* IRQ0 */
35 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
36 },
37};
38
39static struct platform_device smc91x_eth_device = {
40 .name = "smc91x",
41 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
42 .resource = smc91x_eth_resources,
43};
44
Magnus Damm92cfeb62008-03-04 15:23:45 -080045static struct sh_keysc_info sh_keysc_info = {
46 .mode = SH_KEYSC_MODE_2, /* KEYOUT0->4, KEYIN1->5 */
47 .scan_timing = 3,
48 .delay = 5,
49 .keycodes = {
50 0, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_ENTER,
51 0, KEY_F, KEY_C, KEY_D, KEY_H, KEY_1,
52 0, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6,
53 0, KEY_7, KEY_8, KEY_9, KEY_S, KEY_0,
54 0, KEY_P, KEY_STOP, KEY_REWIND, KEY_PLAY, KEY_FASTFORWARD,
55 },
56};
57
58static struct resource sh_keysc_resources[] = {
59 [0] = {
60 .start = 0x044b0000,
61 .end = 0x044b000f,
62 .flags = IORESOURCE_MEM,
63 },
64 [1] = {
65 .start = 79,
66 .flags = IORESOURCE_IRQ,
67 },
68};
69
70static struct platform_device sh_keysc_device = {
71 .name = "sh_keysc",
72 .num_resources = ARRAY_SIZE(sh_keysc_resources),
73 .resource = sh_keysc_resources,
74 .dev = {
75 .platform_data = &sh_keysc_info,
76 },
77};
78
Magnus Damm70f784e2008-02-07 00:38:24 +090079static struct platform_device *migor_devices[] __initdata = {
80 &smc91x_eth_device,
Magnus Damm92cfeb62008-03-04 15:23:45 -080081 &sh_keysc_device,
Magnus Damm70f784e2008-02-07 00:38:24 +090082};
83
84static int __init migor_devices_setup(void)
85{
86 return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
87}
88__initcall(migor_devices_setup);
89
Magnus Damm92cfeb62008-03-04 15:23:45 -080090#define PORT_PJCR 0xA4050110UL
91#define PORT_PSELA 0xA405014EUL
92#define PORT_PYCR 0xA405014AUL
93#define PORT_PZCR 0xA405014CUL
94#define PORT_HIZCRA 0xA4050158UL
95#define PORT_HIZCRC 0xA405015CUL
96#define MSTPCR2 0xA4150038UL
97
Magnus Damm70f784e2008-02-07 00:38:24 +090098static void __init migor_setup(char **cmdline_p)
99{
Magnus Damm92cfeb62008-03-04 15:23:45 -0800100 /* SMC91C111 - Enable IRQ0 */
101 ctrl_outw(ctrl_inw(PORT_PJCR) & ~0x0003, PORT_PJCR);
102
103 /* KEYSC */
104 ctrl_outw(ctrl_inw(PORT_PYCR) & ~0x0fff, PORT_PYCR);
105 ctrl_outw(ctrl_inw(PORT_PZCR) & ~0x0ff0, PORT_PZCR);
106 ctrl_outw(ctrl_inw(PORT_PSELA) & ~0x4100, PORT_PSELA);
107 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
108 ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
109 ctrl_outl(ctrl_inl(MSTPCR2) & ~0x00004000, MSTPCR2);
Magnus Damm70f784e2008-02-07 00:38:24 +0900110}
111
112static struct sh_machine_vector mv_migor __initmv = {
113 .mv_name = "Migo-R",
114 .mv_setup = migor_setup,
115};