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> |
Magnus Damm | 026953d | 2008-07-05 12:32:44 +0900 | [diff] [blame] | 18 | #include <linux/i2c.h> |
Yusuke Goda | 04e917b | 2008-06-06 17:03:23 +0900 | [diff] [blame] | 19 | #include <asm/io.h> |
| 20 | |
| 21 | static struct resource smc9118_resources[] = { |
| 22 | [0] = { |
| 23 | .start = 0xb6080000, |
| 24 | .end = 0xb60fffff, |
| 25 | .flags = IORESOURCE_MEM, |
| 26 | }, |
| 27 | [1] = { |
| 28 | .start = 35, |
| 29 | .end = 35, |
| 30 | .flags = IORESOURCE_IRQ, |
| 31 | } |
| 32 | }; |
| 33 | |
| 34 | static struct platform_device smc9118_device = { |
| 35 | .name = "smc911x", |
| 36 | .id = -1, |
| 37 | .num_resources = ARRAY_SIZE(smc9118_resources), |
| 38 | .resource = smc9118_resources, |
| 39 | }; |
| 40 | |
| 41 | static struct mtd_partition ap325rxa_nor_flash_partitions[] = { |
| 42 | { |
| 43 | .name = "uboot", |
| 44 | .offset = 0, |
| 45 | .size = (1 * 1024 * 1024), |
| 46 | .mask_flags = MTD_WRITEABLE, /* Read-only */ |
| 47 | }, { |
| 48 | .name = "kernel", |
| 49 | .offset = MTDPART_OFS_APPEND, |
| 50 | .size = (2 * 1024 * 1024), |
| 51 | }, { |
| 52 | .name = "other", |
| 53 | .offset = MTDPART_OFS_APPEND, |
| 54 | .size = MTDPART_SIZ_FULL, |
| 55 | }, |
| 56 | }; |
| 57 | |
| 58 | static struct physmap_flash_data ap325rxa_nor_flash_data = { |
| 59 | .width = 2, |
| 60 | .parts = ap325rxa_nor_flash_partitions, |
| 61 | .nr_parts = ARRAY_SIZE(ap325rxa_nor_flash_partitions), |
| 62 | }; |
| 63 | |
| 64 | static struct resource ap325rxa_nor_flash_resources[] = { |
| 65 | [0] = { |
| 66 | .name = "NOR Flash", |
| 67 | .start = 0x00000000, |
| 68 | .end = 0x00ffffff, |
| 69 | .flags = IORESOURCE_MEM, |
| 70 | } |
| 71 | }; |
| 72 | |
| 73 | static struct platform_device ap325rxa_nor_flash_device = { |
| 74 | .name = "physmap-flash", |
| 75 | .resource = ap325rxa_nor_flash_resources, |
| 76 | .num_resources = ARRAY_SIZE(ap325rxa_nor_flash_resources), |
| 77 | .dev = { |
| 78 | .platform_data = &ap325rxa_nor_flash_data, |
| 79 | }, |
| 80 | }; |
| 81 | |
| 82 | static struct platform_device *ap325rxa_devices[] __initdata = { |
| 83 | &smc9118_device, |
| 84 | &ap325rxa_nor_flash_device |
| 85 | }; |
| 86 | |
Magnus Damm | 026953d | 2008-07-05 12:32:44 +0900 | [diff] [blame] | 87 | static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = { |
| 88 | }; |
| 89 | |
Yusuke Goda | 04e917b | 2008-06-06 17:03:23 +0900 | [diff] [blame] | 90 | static int __init ap325rxa_devices_setup(void) |
| 91 | { |
Magnus Damm | 026953d | 2008-07-05 12:32:44 +0900 | [diff] [blame] | 92 | i2c_register_board_info(0, ap325rxa_i2c_devices, |
| 93 | ARRAY_SIZE(ap325rxa_i2c_devices)); |
| 94 | |
Yusuke Goda | 04e917b | 2008-06-06 17:03:23 +0900 | [diff] [blame] | 95 | return platform_add_devices(ap325rxa_devices, |
| 96 | ARRAY_SIZE(ap325rxa_devices)); |
| 97 | } |
| 98 | device_initcall(ap325rxa_devices_setup); |
| 99 | |
Yusuke Goda | 04e917b | 2008-06-06 17:03:23 +0900 | [diff] [blame] | 100 | static void __init ap325rxa_setup(char **cmdline_p) |
| 101 | { |
Yusuke Goda | 04e917b | 2008-06-06 17:03:23 +0900 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | static struct sh_machine_vector mv_ap325rxa __initmv = { |
| 105 | .mv_name = "AP-325RXA", |
| 106 | .mv_setup = ap325rxa_setup, |
| 107 | }; |