linux-3.0.x for AP-SH4A-0A Board
リビジョン | 5eeab97a80eeac006171b1ab907a1081439a4c33 (tree) |
---|---|
日時 | 2011-09-07 23:42:39 |
作者 | Sakae OTAKI <sakae_ohtaki@yoko...> |
コミッター | Sakae OTAKI |
APSH4A0A : Add minimal support for AP-SH4A-0A board
It's works with:
- serial-tty
- timer
- On board Nor-Flash ROM (MTD)
@@ -0,0 +1,135 @@ | ||
1 | +/* | |
2 | + * ALPHAPROJECT AP-SH4A-0A support. | |
3 | + * | |
4 | + * Copyright (C) 2010 Sakae OTAKI<sakae_ohtaki@yokogawa-digital.com> | |
5 | + * | |
6 | + * This program is free software; you can redistribute it and/or modify | |
7 | + * it under the terms of the GNU General Public License version 2 as | |
8 | + * published by the Free Software Foundation. | |
9 | + */ | |
10 | + | |
11 | +#include <linux/init.h> | |
12 | +#include <linux/platform_device.h> | |
13 | +#include <linux/io.h> | |
14 | +#include <linux/mtd/physmap.h> | |
15 | +#include <linux/delay.h> | |
16 | +#include <linux/i2c.h> | |
17 | +#include <linux/i2c-pca-platform.h> | |
18 | +#include <linux/i2c-algo-pca.h> | |
19 | +#include <linux/irq.h> | |
20 | +#include <linux/clk.h> | |
21 | +#include <asm/machvec.h> | |
22 | +#include <asm/sizes.h> | |
23 | +#include <asm/clock.h> | |
24 | +#include <asm/heartbeat.h> | |
25 | + | |
26 | +#define NOR_FLASH_ADDR 0xA0000000 | |
27 | +#define NOR_FLASH_SIZE 0x00800000 | |
28 | + | |
29 | +/* | |
30 | + * Heartbeat LED | |
31 | + */ | |
32 | +//static struct resource heartbeat_resources[] = { | |
33 | +// [0] = { | |
34 | +// .start = PLD_LEDCR, | |
35 | +// .end = PLD_LEDCR, | |
36 | +// .flags = IORESOURCE_MEM, | |
37 | +// }, | |
38 | +//}; | |
39 | +// | |
40 | +//static struct heartbeat_data heartbeat_data = { | |
41 | +// .regsize = 8, | |
42 | +//}; | |
43 | +// | |
44 | +//static struct platform_device heartbeat_device = { | |
45 | +// .name = "heartbeat", | |
46 | +// .id = -1, | |
47 | +// .dev = { | |
48 | +// .platform_data = &heartbeat_data, | |
49 | +// }, | |
50 | +// .num_resources = ARRAY_SIZE(heartbeat_resources), | |
51 | +// .resource = heartbeat_resources, | |
52 | +//}; | |
53 | + | |
54 | +static struct mtd_partition nor_flash_partitions[] = { | |
55 | + { | |
56 | + .name = "loader", | |
57 | + .offset = 0x00000000, | |
58 | + .size = 128 * 1024, | |
59 | + }, | |
60 | + { | |
61 | + .name = "loader.env", | |
62 | + .offset = MTDPART_OFS_APPEND, | |
63 | + .size = 128 * 1024, | |
64 | + }, | |
65 | + { | |
66 | + .name = "kernel", | |
67 | + .offset = MTDPART_OFS_APPEND, | |
68 | + .size = 2 * 1024 * 1024, | |
69 | + }, | |
70 | + { | |
71 | + .name = "rootfs", | |
72 | + .offset = MTDPART_OFS_APPEND, | |
73 | + .size = MTDPART_SIZ_FULL, | |
74 | + }, | |
75 | +}; | |
76 | + | |
77 | +static struct physmap_flash_data nor_flash_data = { | |
78 | + .width = 4, | |
79 | + .parts = nor_flash_partitions, | |
80 | + .nr_parts = ARRAY_SIZE(nor_flash_partitions), | |
81 | +}; | |
82 | + | |
83 | +static struct resource nor_flash_resources[] = { | |
84 | + [0] = { | |
85 | + .start = NOR_FLASH_ADDR, | |
86 | + .end = NOR_FLASH_ADDR + NOR_FLASH_SIZE - 1, | |
87 | + .flags = IORESOURCE_MEM, | |
88 | + } | |
89 | +}; | |
90 | + | |
91 | +static struct platform_device nor_flash_device = { | |
92 | + .name = "physmap-flash", | |
93 | + .dev = { | |
94 | + .platform_data = &nor_flash_data, | |
95 | + }, | |
96 | + .num_resources = ARRAY_SIZE(nor_flash_resources), | |
97 | + .resource = nor_flash_resources, | |
98 | +}; | |
99 | + | |
100 | +static struct platform_device *apsh4a0a_devices[] __initdata = { | |
101 | + //&heartbeat_device, | |
102 | + &nor_flash_device, | |
103 | +}; | |
104 | + | |
105 | +static int __init apsh4a0a_devices_setup(void) | |
106 | +{ | |
107 | + return platform_add_devices(apsh4a0a_devices, | |
108 | + ARRAY_SIZE(apsh4a0a_devices)); | |
109 | +} | |
110 | +__initcall(apsh4a0a_devices_setup); | |
111 | + | |
112 | +/* Initialize IRQ setting */ | |
113 | +void __init init_apsh4a0a_IRQ(void) | |
114 | +{ | |
115 | + plat_irq_setup_pins(IRQ_MODE_IRL3210_MASK); | |
116 | +} | |
117 | + | |
118 | +/* Initialize the board */ | |
119 | +static void __init apsh4a0a_setup(char **cmdline_p) | |
120 | +{ | |
121 | + printk(KERN_INFO "Alpha Project AP-SH4A-0A support:\n"); | |
122 | + | |
123 | + /* System FPGA configuration */ | |
124 | + // May be coded here. | |
125 | +} | |
126 | + | |
127 | +/* | |
128 | + * The Machine Vector | |
129 | + */ | |
130 | +static struct sh_machine_vector mv_apsh4a0a __initmv = { | |
131 | + .mv_name = "AP-SH4A-0A", | |
132 | + .mv_setup = apsh4a0a_setup, | |
133 | + .mv_init_irq = init_apsh4a0a_IRQ, | |
134 | +}; | |
135 | + |