Yusuke Goda | 04e917b | 2008-06-06 17:03:23 +0900 | [diff] [blame^] | 1 | /* |
| 2 | * Renesas - AP-325RXA |
| 3 | * (Compatible with Algo System ., LTD. - AP-320A) |
| 4 | * |
| 5 | * Copyright (C) 2008 Renesas Solutions Corp. |
| 6 | * Author : Yusuke Goda <goda.yuske@renesas.com> |
| 7 | * |
| 8 | * This file is subject to the terms and conditions of the GNU General Public |
| 9 | * License. See the file "COPYING" in the main directory of this archive |
| 10 | * for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/device.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/mtd/physmap.h> |
| 17 | #include <linux/delay.h> |
| 18 | #include <asm/io.h> |
| 19 | |
| 20 | static struct resource smc9118_resources[] = { |
| 21 | [0] = { |
| 22 | .start = 0xb6080000, |
| 23 | .end = 0xb60fffff, |
| 24 | .flags = IORESOURCE_MEM, |
| 25 | }, |
| 26 | [1] = { |
| 27 | .start = 35, |
| 28 | .end = 35, |
| 29 | .flags = IORESOURCE_IRQ, |
| 30 | } |
| 31 | }; |
| 32 | |
| 33 | static struct platform_device smc9118_device = { |
| 34 | .name = "smc911x", |
| 35 | .id = -1, |
| 36 | .num_resources = ARRAY_SIZE(smc9118_resources), |
| 37 | .resource = smc9118_resources, |
| 38 | }; |
| 39 | |
| 40 | static struct mtd_partition ap325rxa_nor_flash_partitions[] = { |
| 41 | { |
| 42 | .name = "uboot", |
| 43 | .offset = 0, |
| 44 | .size = (1 * 1024 * 1024), |
| 45 | .mask_flags = MTD_WRITEABLE, /* Read-only */ |
| 46 | }, { |
| 47 | .name = "kernel", |
| 48 | .offset = MTDPART_OFS_APPEND, |
| 49 | .size = (2 * 1024 * 1024), |
| 50 | }, { |
| 51 | .name = "other", |
| 52 | .offset = MTDPART_OFS_APPEND, |
| 53 | .size = MTDPART_SIZ_FULL, |
| 54 | }, |
| 55 | }; |
| 56 | |
| 57 | static struct physmap_flash_data ap325rxa_nor_flash_data = { |
| 58 | .width = 2, |
| 59 | .parts = ap325rxa_nor_flash_partitions, |
| 60 | .nr_parts = ARRAY_SIZE(ap325rxa_nor_flash_partitions), |
| 61 | }; |
| 62 | |
| 63 | static struct resource ap325rxa_nor_flash_resources[] = { |
| 64 | [0] = { |
| 65 | .name = "NOR Flash", |
| 66 | .start = 0x00000000, |
| 67 | .end = 0x00ffffff, |
| 68 | .flags = IORESOURCE_MEM, |
| 69 | } |
| 70 | }; |
| 71 | |
| 72 | static struct platform_device ap325rxa_nor_flash_device = { |
| 73 | .name = "physmap-flash", |
| 74 | .resource = ap325rxa_nor_flash_resources, |
| 75 | .num_resources = ARRAY_SIZE(ap325rxa_nor_flash_resources), |
| 76 | .dev = { |
| 77 | .platform_data = &ap325rxa_nor_flash_data, |
| 78 | }, |
| 79 | }; |
| 80 | |
| 81 | static struct platform_device *ap325rxa_devices[] __initdata = { |
| 82 | &smc9118_device, |
| 83 | &ap325rxa_nor_flash_device |
| 84 | }; |
| 85 | |
| 86 | static int __init ap325rxa_devices_setup(void) |
| 87 | { |
| 88 | return platform_add_devices(ap325rxa_devices, |
| 89 | ARRAY_SIZE(ap325rxa_devices)); |
| 90 | } |
| 91 | device_initcall(ap325rxa_devices_setup); |
| 92 | |
| 93 | #define MSTPCR0 (0xA4150030) |
| 94 | #define MSTPCR2 (0xA4150038) |
| 95 | |
| 96 | static void __init ap325rxa_setup(char **cmdline_p) |
| 97 | { |
| 98 | /* enable VEU0 + VEU1 */ |
| 99 | ctrl_outl(ctrl_inl(MSTPCR2) & ~0x00000044, MSTPCR2); /* bit 2 + 6 */ |
| 100 | |
| 101 | /* enable MERAM */ |
| 102 | ctrl_outl(ctrl_inl(MSTPCR0) & ~0x00000001, MSTPCR0); /* bit 0 */ |
| 103 | } |
| 104 | |
| 105 | static struct sh_machine_vector mv_ap325rxa __initmv = { |
| 106 | .mv_name = "AP-325RXA", |
| 107 | .mv_setup = ap325rxa_setup, |
| 108 | }; |