Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-ep93xx/edb93xx.c |
| 3 | * Cirrus Logic EDB93xx Development Board support. |
| 4 | * |
| 5 | * EDB93XX, EDB9301, EDB9307A |
| 6 | * Copyright (C) 2008-2009 H Hartley Sweeten <hsweeten@visionengravers.com> |
| 7 | * |
| 8 | * EDB9302 |
| 9 | * Copyright (C) 2006 George Kashperko <george@chas.com.ua> |
| 10 | * |
| 11 | * EDB9302A, EDB9315, EDB9315A |
| 12 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> |
| 13 | * |
| 14 | * EDB9307 |
| 15 | * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org> |
| 16 | * |
| 17 | * EDB9312 |
| 18 | * Copyright (C) 2006 Infosys Technologies Limited |
| 19 | * Toufeeq Hussain <toufeeq_hussain@infosys.com> |
| 20 | * |
| 21 | * This program is free software; you can redistribute it and/or modify |
| 22 | * it under the terms of the GNU General Public License as published by |
| 23 | * the Free Software Foundation; either version 2 of the License, or (at |
| 24 | * your option) any later version. |
| 25 | */ |
| 26 | |
| 27 | #include <linux/kernel.h> |
| 28 | #include <linux/init.h> |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 29 | #include <linux/platform_device.h> |
Hartley Sweeten | 583ddaf | 2009-07-06 17:39:50 +0100 | [diff] [blame] | 30 | #include <linux/mtd/physmap.h> |
Hartley Sweeten | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 31 | #include <linux/gpio.h> |
| 32 | #include <linux/i2c.h> |
| 33 | #include <linux/i2c-gpio.h> |
Hartley Sweeten | 583ddaf | 2009-07-06 17:39:50 +0100 | [diff] [blame] | 34 | |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 35 | #include <mach/hardware.h> |
Hartley Sweeten | 583ddaf | 2009-07-06 17:39:50 +0100 | [diff] [blame] | 36 | |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 37 | #include <asm/mach-types.h> |
| 38 | #include <asm/mach/arch.h> |
| 39 | |
Hartley Sweeten | 583ddaf | 2009-07-06 17:39:50 +0100 | [diff] [blame] | 40 | |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 41 | static struct physmap_flash_data edb93xx_flash_data; |
| 42 | |
| 43 | static struct resource edb93xx_flash_resource = { |
| 44 | .flags = IORESOURCE_MEM, |
| 45 | }; |
| 46 | |
| 47 | static struct platform_device edb93xx_flash = { |
| 48 | .name = "physmap-flash", |
| 49 | .id = 0, |
| 50 | .dev = { |
| 51 | .platform_data = &edb93xx_flash_data, |
| 52 | }, |
| 53 | .num_resources = 1, |
| 54 | .resource = &edb93xx_flash_resource, |
| 55 | }; |
| 56 | |
| 57 | static void __init __edb93xx_register_flash(unsigned int width, |
| 58 | resource_size_t start, resource_size_t size) |
| 59 | { |
| 60 | edb93xx_flash_data.width = width; |
| 61 | edb93xx_flash_resource.start = start; |
| 62 | edb93xx_flash_resource.end = start + size - 1; |
| 63 | |
| 64 | platform_device_register(&edb93xx_flash); |
| 65 | } |
| 66 | |
| 67 | static void __init edb93xx_register_flash(void) |
| 68 | { |
| 69 | if (machine_is_edb9307() || machine_is_edb9312() || |
| 70 | machine_is_edb9315()) { |
| 71 | __edb93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M); |
| 72 | } else { |
| 73 | __edb93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | static struct ep93xx_eth_data edb93xx_eth_data = { |
| 78 | .phy_id = 1, |
| 79 | }; |
| 80 | |
Hartley Sweeten | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 81 | |
| 82 | /************************************************************************* |
| 83 | * EDB93xx i2c peripheral handling |
| 84 | *************************************************************************/ |
| 85 | static struct i2c_gpio_platform_data edb93xx_i2c_gpio_data = { |
| 86 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, |
| 87 | .sda_is_open_drain = 0, |
| 88 | .scl_pin = EP93XX_GPIO_LINE_EECLK, |
| 89 | .scl_is_open_drain = 0, |
| 90 | .udelay = 0, /* default to 100 kHz */ |
| 91 | .timeout = 0, /* default to 100 ms */ |
| 92 | }; |
| 93 | |
| 94 | static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = { |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 95 | { |
| 96 | I2C_BOARD_INFO("isl1208", 0x6f), |
| 97 | }, |
| 98 | }; |
| 99 | |
Hartley Sweeten | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 100 | static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = { |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 101 | { |
| 102 | I2C_BOARD_INFO("ds1337", 0x68), |
| 103 | }, |
| 104 | }; |
| 105 | |
| 106 | static void __init edb93xx_register_i2c(void) |
| 107 | { |
| 108 | if (machine_is_edb9302a() || machine_is_edb9307a() || |
| 109 | machine_is_edb9315a()) { |
Hartley Sweeten | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 110 | ep93xx_register_i2c(&edb93xx_i2c_gpio_data, |
| 111 | edb93xxa_i2c_board_info, |
| 112 | ARRAY_SIZE(edb93xxa_i2c_board_info)); |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 113 | } else if (machine_is_edb9307() || machine_is_edb9312() || |
| 114 | machine_is_edb9315()) { |
Hartley Sweeten | 3d977c0 | 2009-10-14 01:56:10 +0100 | [diff] [blame] | 115 | ep93xx_register_i2c(&edb93xx_i2c_gpio_data, |
Hartley Sweeten | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 116 | edb93xx_i2c_board_info, |
| 117 | ARRAY_SIZE(edb93xx_i2c_board_info)); |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 118 | } |
| 119 | } |
| 120 | |
| 121 | static void __init edb93xx_init_machine(void) |
| 122 | { |
| 123 | ep93xx_init_devices(); |
| 124 | edb93xx_register_flash(); |
| 125 | ep93xx_register_eth(&edb93xx_eth_data, 1); |
| 126 | edb93xx_register_i2c(); |
| 127 | } |
| 128 | |
| 129 | |
| 130 | #ifdef CONFIG_MACH_EDB9301 |
| 131 | MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board") |
| 132 | /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */ |
| 133 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 134 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 135 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 136 | .map_io = ep93xx_map_io, |
| 137 | .init_irq = ep93xx_init_irq, |
| 138 | .timer = &ep93xx_timer, |
| 139 | .init_machine = edb93xx_init_machine, |
| 140 | MACHINE_END |
| 141 | #endif |
| 142 | |
| 143 | #ifdef CONFIG_MACH_EDB9302 |
| 144 | MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board") |
| 145 | /* Maintainer: George Kashperko <george@chas.com.ua> */ |
| 146 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 147 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 148 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 149 | .map_io = ep93xx_map_io, |
| 150 | .init_irq = ep93xx_init_irq, |
| 151 | .timer = &ep93xx_timer, |
| 152 | .init_machine = edb93xx_init_machine, |
| 153 | MACHINE_END |
| 154 | #endif |
| 155 | |
| 156 | #ifdef CONFIG_MACH_EDB9302A |
| 157 | MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board") |
| 158 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ |
| 159 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 160 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 161 | .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100, |
| 162 | .map_io = ep93xx_map_io, |
| 163 | .init_irq = ep93xx_init_irq, |
| 164 | .timer = &ep93xx_timer, |
| 165 | .init_machine = edb93xx_init_machine, |
| 166 | MACHINE_END |
| 167 | #endif |
| 168 | |
| 169 | #ifdef CONFIG_MACH_EDB9307 |
| 170 | MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board") |
| 171 | /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */ |
| 172 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 173 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 174 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 175 | .map_io = ep93xx_map_io, |
| 176 | .init_irq = ep93xx_init_irq, |
| 177 | .timer = &ep93xx_timer, |
| 178 | .init_machine = edb93xx_init_machine, |
| 179 | MACHINE_END |
| 180 | #endif |
| 181 | |
| 182 | #ifdef CONFIG_MACH_EDB9307A |
| 183 | MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board") |
| 184 | /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */ |
| 185 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 186 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 187 | .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100, |
| 188 | .map_io = ep93xx_map_io, |
| 189 | .init_irq = ep93xx_init_irq, |
| 190 | .timer = &ep93xx_timer, |
| 191 | .init_machine = edb93xx_init_machine, |
| 192 | MACHINE_END |
| 193 | #endif |
| 194 | |
| 195 | #ifdef CONFIG_MACH_EDB9312 |
| 196 | MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board") |
| 197 | /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */ |
| 198 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 199 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 200 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 201 | .map_io = ep93xx_map_io, |
| 202 | .init_irq = ep93xx_init_irq, |
| 203 | .timer = &ep93xx_timer, |
| 204 | .init_machine = edb93xx_init_machine, |
| 205 | MACHINE_END |
| 206 | #endif |
| 207 | |
| 208 | #ifdef CONFIG_MACH_EDB9315 |
| 209 | MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board") |
| 210 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ |
| 211 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 212 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 213 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 214 | .map_io = ep93xx_map_io, |
| 215 | .init_irq = ep93xx_init_irq, |
| 216 | .timer = &ep93xx_timer, |
| 217 | .init_machine = edb93xx_init_machine, |
| 218 | MACHINE_END |
| 219 | #endif |
| 220 | |
| 221 | #ifdef CONFIG_MACH_EDB9315A |
| 222 | MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board") |
| 223 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ |
| 224 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 225 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 226 | .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100, |
| 227 | .map_io = ep93xx_map_io, |
| 228 | .init_irq = ep93xx_init_irq, |
| 229 | .timer = &ep93xx_timer, |
| 230 | .init_machine = edb93xx_init_machine, |
| 231 | MACHINE_END |
| 232 | #endif |