Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-clps711x/cdb89712.c |
| 3 | * |
| 4 | * Copyright (C) 2000-2001 Deep Blue Solutions Ltd |
| 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 as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | #include <linux/kernel.h> |
| 21 | #include <linux/init.h> |
| 22 | #include <linux/types.h> |
| 23 | #include <linux/string.h> |
| 24 | #include <linux/mm.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 25 | #include <linux/io.h> |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 26 | #include <linux/interrupt.h> |
| 27 | #include <linux/platform_device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Alexander Shiyan | 8644933 | 2012-11-17 17:57:12 +0400 | [diff] [blame] | 29 | #include <linux/mtd/physmap.h> |
| 30 | #include <linux/mtd/plat-ram.h> |
| 31 | #include <linux/mtd/partitions.h> |
| 32 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 33 | #include <mach/hardware.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #include <asm/pgtable.h> |
| 35 | #include <asm/page.h> |
| 36 | #include <asm/setup.h> |
| 37 | #include <asm/mach-types.h> |
| 38 | #include <asm/mach/arch.h> |
| 39 | #include <asm/mach/map.h> |
| 40 | |
| 41 | #include "common.h" |
Alexander Shiyan | e328b88 | 2013-04-26 19:47:29 +0400 | [diff] [blame] | 42 | #include "devices.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 44 | #define CDB89712_CS8900_BASE (CS2_PHYS_BASE + 0x300) |
| 45 | #define CDB89712_CS8900_IRQ (IRQ_EINT3) |
| 46 | |
| 47 | static struct resource cdb89712_cs8900_resource[] __initdata = { |
| 48 | DEFINE_RES_MEM(CDB89712_CS8900_BASE, SZ_1K), |
| 49 | DEFINE_RES_IRQ(CDB89712_CS8900_IRQ), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | }; |
| 51 | |
Alexander Shiyan | 8644933 | 2012-11-17 17:57:12 +0400 | [diff] [blame] | 52 | static struct mtd_partition cdb89712_flash_partitions[] __initdata = { |
| 53 | { |
| 54 | .name = "Flash", |
| 55 | .offset = 0, |
| 56 | .size = MTDPART_SIZ_FULL, |
| 57 | }, |
| 58 | }; |
| 59 | |
| 60 | static struct physmap_flash_data cdb89712_flash_pdata __initdata = { |
| 61 | .width = 4, |
| 62 | .probe_type = "map_rom", |
| 63 | .parts = cdb89712_flash_partitions, |
| 64 | .nr_parts = ARRAY_SIZE(cdb89712_flash_partitions), |
| 65 | }; |
| 66 | |
| 67 | static struct resource cdb89712_flash_resources[] __initdata = { |
| 68 | DEFINE_RES_MEM(CS0_PHYS_BASE, SZ_8M), |
| 69 | }; |
| 70 | |
| 71 | static struct platform_device cdb89712_flash_pdev __initdata = { |
| 72 | .name = "physmap-flash", |
| 73 | .id = 0, |
| 74 | .resource = cdb89712_flash_resources, |
| 75 | .num_resources = ARRAY_SIZE(cdb89712_flash_resources), |
| 76 | .dev = { |
| 77 | .platform_data = &cdb89712_flash_pdata, |
| 78 | }, |
| 79 | }; |
| 80 | |
| 81 | static struct mtd_partition cdb89712_bootrom_partitions[] __initdata = { |
| 82 | { |
| 83 | .name = "BootROM", |
| 84 | .offset = 0, |
| 85 | .size = MTDPART_SIZ_FULL, |
| 86 | }, |
| 87 | }; |
| 88 | |
| 89 | static struct physmap_flash_data cdb89712_bootrom_pdata __initdata = { |
| 90 | .width = 4, |
| 91 | .probe_type = "map_rom", |
| 92 | .parts = cdb89712_bootrom_partitions, |
| 93 | .nr_parts = ARRAY_SIZE(cdb89712_bootrom_partitions), |
| 94 | }; |
| 95 | |
| 96 | static struct resource cdb89712_bootrom_resources[] __initdata = { |
| 97 | DEFINE_RES_NAMED(CS7_PHYS_BASE, SZ_128, "BOOTROM", IORESOURCE_MEM | |
| 98 | IORESOURCE_CACHEABLE | IORESOURCE_READONLY), |
| 99 | }; |
| 100 | |
| 101 | static struct platform_device cdb89712_bootrom_pdev __initdata = { |
| 102 | .name = "physmap-flash", |
| 103 | .id = 1, |
| 104 | .resource = cdb89712_bootrom_resources, |
| 105 | .num_resources = ARRAY_SIZE(cdb89712_bootrom_resources), |
| 106 | .dev = { |
| 107 | .platform_data = &cdb89712_bootrom_pdata, |
| 108 | }, |
| 109 | }; |
| 110 | |
| 111 | static struct platdata_mtd_ram cdb89712_sram_pdata __initdata = { |
| 112 | .bankwidth = 4, |
| 113 | }; |
| 114 | |
| 115 | static struct resource cdb89712_sram_resources[] __initdata = { |
| 116 | DEFINE_RES_MEM(CLPS711X_SRAM_BASE, CLPS711X_SRAM_SIZE), |
| 117 | }; |
| 118 | |
| 119 | static struct platform_device cdb89712_sram_pdev __initdata = { |
| 120 | .name = "mtd-ram", |
| 121 | .id = 0, |
| 122 | .resource = cdb89712_sram_resources, |
| 123 | .num_resources = ARRAY_SIZE(cdb89712_sram_resources), |
| 124 | .dev = { |
| 125 | .platform_data = &cdb89712_sram_pdata, |
| 126 | }, |
| 127 | }; |
| 128 | |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 129 | static void __init cdb89712_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | { |
Alexander Shiyan | e328b88 | 2013-04-26 19:47:29 +0400 | [diff] [blame] | 131 | clps711x_devices_init(); |
Alexander Shiyan | 8644933 | 2012-11-17 17:57:12 +0400 | [diff] [blame] | 132 | platform_device_register(&cdb89712_flash_pdev); |
| 133 | platform_device_register(&cdb89712_bootrom_pdev); |
| 134 | platform_device_register(&cdb89712_sram_pdev); |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 135 | platform_device_register_simple("cs89x0", 0, cdb89712_cs8900_resource, |
| 136 | ARRAY_SIZE(cdb89712_cs8900_resource)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | MACHINE_START(CDB89712, "Cirrus-CDB89712") |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 140 | /* Maintainer: Ray Lehtiniemi */ |
Nicolas Pitre | 6244fa9 | 2011-07-05 22:38:11 -0400 | [diff] [blame] | 141 | .atag_offset = 0x100, |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 142 | .map_io = clps711x_map_io, |
Alexander Shiyan | d0ad52a | 2013-05-13 21:07:31 +0400 | [diff] [blame] | 143 | .init_early = clps711x_init_early, |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 144 | .init_irq = clps711x_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 145 | .init_time = clps711x_timer_init, |
Alexander Shiyan | 200daa3 | 2012-11-17 17:57:07 +0400 | [diff] [blame] | 146 | .init_machine = cdb89712_init, |
Russell King | 6c00071 | 2011-11-05 17:41:52 +0000 | [diff] [blame] | 147 | .restart = clps711x_restart, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | MACHINE_END |