Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 Renesas Solutions Corp. |
| 3 | * |
| 4 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> |
| 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 | |
| 11 | #include <linux/init.h> |
| 12 | #include <linux/device.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/mtd/physmap.h> |
| 15 | #include <linux/gpio.h> |
| 16 | #include <linux/interrupt.h> |
| 17 | #include <asm/io.h> |
| 18 | #include <asm/heartbeat.h> |
| 19 | #include <cpu/sh7724.h> |
| 20 | |
| 21 | /* |
Kuninori Morimoto | b7056bc | 2009-08-26 11:04:22 +0000 | [diff] [blame^] | 22 | * Address Interface BusWidth |
| 23 | *----------------------------------------- |
| 24 | * 0x0000_0000 uboot 16bit |
| 25 | * 0x0004_0000 Linux romImage 16bit |
| 26 | * 0x0014_0000 MTD for Linux 16bit |
| 27 | * 0x0400_0000 Internal I/O 16/32bit |
| 28 | * 0x0800_0000 DRAM 32bit |
| 29 | * 0x1800_0000 MFI 16bit |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 30 | */ |
| 31 | |
| 32 | /* Heartbeat */ |
| 33 | static unsigned char led_pos[] = { 0, 1, 2, 3 }; |
| 34 | static struct heartbeat_data heartbeat_data = { |
| 35 | .regsize = 8, |
| 36 | .nr_bits = 4, |
| 37 | .bit_pos = led_pos, |
| 38 | }; |
| 39 | |
| 40 | static struct resource heartbeat_resources[] = { |
| 41 | [0] = { |
| 42 | .start = 0xA405012C, /* PTG */ |
| 43 | .end = 0xA405012E - 1, |
| 44 | .flags = IORESOURCE_MEM, |
| 45 | }, |
| 46 | }; |
| 47 | |
| 48 | static struct platform_device heartbeat_device = { |
| 49 | .name = "heartbeat", |
| 50 | .id = -1, |
| 51 | .dev = { |
| 52 | .platform_data = &heartbeat_data, |
| 53 | }, |
| 54 | .num_resources = ARRAY_SIZE(heartbeat_resources), |
| 55 | .resource = heartbeat_resources, |
| 56 | }; |
| 57 | |
| 58 | /* MTD */ |
| 59 | static struct mtd_partition nor_flash_partitions[] = { |
| 60 | { |
Kuninori Morimoto | b7056bc | 2009-08-26 11:04:22 +0000 | [diff] [blame^] | 61 | .name = "boot loader", |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 62 | .offset = 0, |
Kuninori Morimoto | b7056bc | 2009-08-26 11:04:22 +0000 | [diff] [blame^] | 63 | .size = (5 * 1024 * 1024), |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 64 | .mask_flags = MTD_CAP_ROM, |
| 65 | }, { |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 66 | .name = "free-area", |
| 67 | .offset = MTDPART_OFS_APPEND, |
| 68 | .size = MTDPART_SIZ_FULL, |
| 69 | }, |
| 70 | }; |
| 71 | |
| 72 | static struct physmap_flash_data nor_flash_data = { |
| 73 | .width = 2, |
| 74 | .parts = nor_flash_partitions, |
| 75 | .nr_parts = ARRAY_SIZE(nor_flash_partitions), |
| 76 | }; |
| 77 | |
| 78 | static struct resource nor_flash_resources[] = { |
| 79 | [0] = { |
| 80 | .name = "NOR Flash", |
| 81 | .start = 0x00000000, |
| 82 | .end = 0x03ffffff, |
| 83 | .flags = IORESOURCE_MEM, |
| 84 | } |
| 85 | }; |
| 86 | |
| 87 | static struct platform_device nor_flash_device = { |
| 88 | .name = "physmap-flash", |
| 89 | .resource = nor_flash_resources, |
| 90 | .num_resources = ARRAY_SIZE(nor_flash_resources), |
| 91 | .dev = { |
| 92 | .platform_data = &nor_flash_data, |
| 93 | }, |
| 94 | }; |
| 95 | |
| 96 | static struct platform_device *ecovec_devices[] __initdata = { |
| 97 | &heartbeat_device, |
| 98 | &nor_flash_device, |
| 99 | }; |
| 100 | |
| 101 | static int __init devices_setup(void) |
| 102 | { |
| 103 | /* enable SCIFA0 */ |
| 104 | gpio_request(GPIO_FN_SCIF0_TXD, NULL); |
| 105 | gpio_request(GPIO_FN_SCIF0_RXD, NULL); |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 106 | |
| 107 | /* enable debug LED */ |
| 108 | gpio_request(GPIO_PTG0, NULL); |
| 109 | gpio_request(GPIO_PTG1, NULL); |
| 110 | gpio_request(GPIO_PTG2, NULL); |
| 111 | gpio_request(GPIO_PTG3, NULL); |
Kuninori Morimoto | b7056bc | 2009-08-26 11:04:22 +0000 | [diff] [blame^] | 112 | gpio_direction_output(GPIO_PTG0, 0); |
| 113 | gpio_direction_output(GPIO_PTG1, 0); |
| 114 | gpio_direction_output(GPIO_PTG2, 0); |
| 115 | gpio_direction_output(GPIO_PTG3, 0); |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 116 | |
| 117 | return platform_add_devices(ecovec_devices, |
| 118 | ARRAY_SIZE(ecovec_devices)); |
| 119 | } |
| 120 | device_initcall(devices_setup); |
| 121 | |
| 122 | static struct sh_machine_vector mv_ecovec __initmv = { |
| 123 | .mv_name = "R0P7724 (EcoVec)", |
| 124 | }; |