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 | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 30 | #include <linux/gpio.h> |
| 31 | #include <linux/i2c.h> |
| 32 | #include <linux/i2c-gpio.h> |
Hartley Sweeten | 583ddaf | 2009-07-06 17:39:50 +0100 | [diff] [blame] | 33 | |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 34 | #include <mach/hardware.h> |
Hartley Sweeten | 583ddaf | 2009-07-06 17:39:50 +0100 | [diff] [blame] | 35 | |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 36 | #include <asm/mach-types.h> |
| 37 | #include <asm/mach/arch.h> |
| 38 | |
Hartley Sweeten | 583ddaf | 2009-07-06 17:39:50 +0100 | [diff] [blame] | 39 | |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 40 | static void __init edb93xx_register_flash(void) |
| 41 | { |
| 42 | if (machine_is_edb9307() || machine_is_edb9312() || |
| 43 | machine_is_edb9315()) { |
Hartley Sweeten | 16bcf78 | 2010-06-10 16:19:08 +0100 | [diff] [blame] | 44 | ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M); |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 45 | } else { |
Hartley Sweeten | 16bcf78 | 2010-06-10 16:19:08 +0100 | [diff] [blame] | 46 | ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M); |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 47 | } |
| 48 | } |
| 49 | |
Hartley Sweeten | b370e08 | 2010-03-18 18:04:06 +0100 | [diff] [blame] | 50 | static struct ep93xx_eth_data __initdata edb93xx_eth_data = { |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 51 | .phy_id = 1, |
| 52 | }; |
| 53 | |
Hartley Sweeten | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 54 | |
| 55 | /************************************************************************* |
| 56 | * EDB93xx i2c peripheral handling |
| 57 | *************************************************************************/ |
Hartley Sweeten | b370e08 | 2010-03-18 18:04:06 +0100 | [diff] [blame] | 58 | static struct i2c_gpio_platform_data __initdata edb93xx_i2c_gpio_data = { |
Hartley Sweeten | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 59 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, |
| 60 | .sda_is_open_drain = 0, |
| 61 | .scl_pin = EP93XX_GPIO_LINE_EECLK, |
| 62 | .scl_is_open_drain = 0, |
| 63 | .udelay = 0, /* default to 100 kHz */ |
| 64 | .timeout = 0, /* default to 100 ms */ |
| 65 | }; |
| 66 | |
| 67 | static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = { |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 68 | { |
| 69 | I2C_BOARD_INFO("isl1208", 0x6f), |
| 70 | }, |
| 71 | }; |
| 72 | |
Hartley Sweeten | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 73 | static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = { |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 74 | { |
| 75 | I2C_BOARD_INFO("ds1337", 0x68), |
| 76 | }, |
| 77 | }; |
| 78 | |
| 79 | static void __init edb93xx_register_i2c(void) |
| 80 | { |
| 81 | if (machine_is_edb9302a() || machine_is_edb9307a() || |
| 82 | machine_is_edb9315a()) { |
Hartley Sweeten | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 83 | ep93xx_register_i2c(&edb93xx_i2c_gpio_data, |
| 84 | edb93xxa_i2c_board_info, |
| 85 | ARRAY_SIZE(edb93xxa_i2c_board_info)); |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 86 | } else if (machine_is_edb9307() || machine_is_edb9312() || |
| 87 | machine_is_edb9315()) { |
Hartley Sweeten | 3d977c0 | 2009-10-14 01:56:10 +0100 | [diff] [blame] | 88 | ep93xx_register_i2c(&edb93xx_i2c_gpio_data, |
Hartley Sweeten | 6531a99 | 2009-10-08 00:45:00 +0100 | [diff] [blame] | 89 | edb93xx_i2c_board_info, |
| 90 | ARRAY_SIZE(edb93xx_i2c_board_info)); |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 91 | } |
| 92 | } |
| 93 | |
Hartley Sweeten | 1fbd972 | 2010-01-11 21:38:00 +0100 | [diff] [blame] | 94 | |
| 95 | /************************************************************************* |
| 96 | * EDB93xx pwm |
| 97 | *************************************************************************/ |
| 98 | static void __init edb93xx_register_pwm(void) |
| 99 | { |
| 100 | if (machine_is_edb9301() || |
| 101 | machine_is_edb9302() || machine_is_edb9302a()) { |
| 102 | /* EP9301 and EP9302 only have pwm.1 (EGPIO14) */ |
| 103 | ep93xx_register_pwm(0, 1); |
| 104 | } else if (machine_is_edb9307() || machine_is_edb9307a()) { |
| 105 | /* EP9307 only has pwm.0 (PWMOUT) */ |
| 106 | ep93xx_register_pwm(1, 0); |
| 107 | } else { |
| 108 | /* EP9312 and EP9315 have both */ |
| 109 | ep93xx_register_pwm(1, 1); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 114 | static void __init edb93xx_init_machine(void) |
| 115 | { |
| 116 | ep93xx_init_devices(); |
| 117 | edb93xx_register_flash(); |
| 118 | ep93xx_register_eth(&edb93xx_eth_data, 1); |
| 119 | edb93xx_register_i2c(); |
Hartley Sweeten | 1fbd972 | 2010-01-11 21:38:00 +0100 | [diff] [blame] | 120 | edb93xx_register_pwm(); |
Hartley Sweeten | a2bd40d | 2009-05-04 19:09:25 +0100 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | |
| 124 | #ifdef CONFIG_MACH_EDB9301 |
| 125 | MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board") |
| 126 | /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */ |
| 127 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 128 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 129 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 130 | .map_io = ep93xx_map_io, |
| 131 | .init_irq = ep93xx_init_irq, |
| 132 | .timer = &ep93xx_timer, |
| 133 | .init_machine = edb93xx_init_machine, |
| 134 | MACHINE_END |
| 135 | #endif |
| 136 | |
| 137 | #ifdef CONFIG_MACH_EDB9302 |
| 138 | MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board") |
| 139 | /* Maintainer: George Kashperko <george@chas.com.ua> */ |
| 140 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 141 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 142 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 143 | .map_io = ep93xx_map_io, |
| 144 | .init_irq = ep93xx_init_irq, |
| 145 | .timer = &ep93xx_timer, |
| 146 | .init_machine = edb93xx_init_machine, |
| 147 | MACHINE_END |
| 148 | #endif |
| 149 | |
| 150 | #ifdef CONFIG_MACH_EDB9302A |
| 151 | MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board") |
| 152 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ |
| 153 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 154 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 155 | .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100, |
| 156 | .map_io = ep93xx_map_io, |
| 157 | .init_irq = ep93xx_init_irq, |
| 158 | .timer = &ep93xx_timer, |
| 159 | .init_machine = edb93xx_init_machine, |
| 160 | MACHINE_END |
| 161 | #endif |
| 162 | |
| 163 | #ifdef CONFIG_MACH_EDB9307 |
| 164 | MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board") |
| 165 | /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */ |
| 166 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 167 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 168 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 169 | .map_io = ep93xx_map_io, |
| 170 | .init_irq = ep93xx_init_irq, |
| 171 | .timer = &ep93xx_timer, |
| 172 | .init_machine = edb93xx_init_machine, |
| 173 | MACHINE_END |
| 174 | #endif |
| 175 | |
| 176 | #ifdef CONFIG_MACH_EDB9307A |
| 177 | MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board") |
| 178 | /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */ |
| 179 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 180 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 181 | .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100, |
| 182 | .map_io = ep93xx_map_io, |
| 183 | .init_irq = ep93xx_init_irq, |
| 184 | .timer = &ep93xx_timer, |
| 185 | .init_machine = edb93xx_init_machine, |
| 186 | MACHINE_END |
| 187 | #endif |
| 188 | |
| 189 | #ifdef CONFIG_MACH_EDB9312 |
| 190 | MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board") |
| 191 | /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */ |
| 192 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 193 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 194 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 195 | .map_io = ep93xx_map_io, |
| 196 | .init_irq = ep93xx_init_irq, |
| 197 | .timer = &ep93xx_timer, |
| 198 | .init_machine = edb93xx_init_machine, |
| 199 | MACHINE_END |
| 200 | #endif |
| 201 | |
| 202 | #ifdef CONFIG_MACH_EDB9315 |
| 203 | MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board") |
| 204 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ |
| 205 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 206 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 207 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 208 | .map_io = ep93xx_map_io, |
| 209 | .init_irq = ep93xx_init_irq, |
| 210 | .timer = &ep93xx_timer, |
| 211 | .init_machine = edb93xx_init_machine, |
| 212 | MACHINE_END |
| 213 | #endif |
| 214 | |
| 215 | #ifdef CONFIG_MACH_EDB9315A |
| 216 | MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board") |
| 217 | /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ |
| 218 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 219 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 220 | .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100, |
| 221 | .map_io = ep93xx_map_io, |
| 222 | .init_irq = ep93xx_init_irq, |
| 223 | .timer = &ep93xx_timer, |
| 224 | .init_machine = edb93xx_init_machine, |
| 225 | MACHINE_END |
| 226 | #endif |