blob: 4bcf2f4e4f939e71dae6ee49b6eddfa456cfde68 [file] [log] [blame]
Manuel Lauss63323ec2009-11-02 21:21:43 +01001/*
Manuel Lauss6f7c8622011-11-10 12:06:22 +00002 * DBAu1200/PBAu1200 board platform device registration
Manuel Lauss63323ec2009-11-02 21:21:43 +01003 *
Manuel Lauss7c4b24d2011-11-10 12:06:21 +00004 * Copyright (C) 2008-2011 Manuel Lauss
Manuel Lauss63323ec2009-11-02 21:21:43 +01005 *
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/dma-mapping.h>
22#include <linux/gpio.h>
23#include <linux/i2c.h>
24#include <linux/init.h>
Paul Gortmakerf9ded562012-02-28 19:24:46 -050025#include <linux/module.h>
Manuel Lauss7c4b24d2011-11-10 12:06:21 +000026#include <linux/interrupt.h>
Manuel Lauss63323ec2009-11-02 21:21:43 +010027#include <linux/io.h>
28#include <linux/leds.h>
29#include <linux/mmc/host.h>
30#include <linux/mtd/mtd.h>
31#include <linux/mtd/nand.h>
32#include <linux/mtd/partitions.h>
33#include <linux/platform_device.h>
34#include <linux/serial_8250.h>
35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h>
37#include <linux/smc91x.h>
Manuel Lauss7c4b24d2011-11-10 12:06:21 +000038#include <asm/mach-au1x00/au1000.h>
Manuel Lauss63323ec2009-11-02 21:21:43 +010039#include <asm/mach-au1x00/au1100_mmc.h>
40#include <asm/mach-au1x00/au1xxx_dbdma.h>
Manuel Laussa16afa52014-03-26 10:41:48 +010041#include <asm/mach-au1x00/au1xxx_psc.h>
Manuel Laussa9b71a82011-11-10 12:06:21 +000042#include <asm/mach-au1x00/au1200fb.h>
Manuel Lauss63323ec2009-11-02 21:21:43 +010043#include <asm/mach-au1x00/au1550_spi.h>
44#include <asm/mach-db1x00/bcsr.h>
Manuel Lauss63323ec2009-11-02 21:21:43 +010045
Manuel Lauss7c4b24d2011-11-10 12:06:21 +000046#include "platform.h"
47
Manuel Laussa16afa52014-03-26 10:41:48 +010048#define BCSR_INT_IDE 0x0001
49#define BCSR_INT_ETH 0x0002
50#define BCSR_INT_PC0 0x0004
51#define BCSR_INT_PC0STSCHG 0x0008
52#define BCSR_INT_PC1 0x0010
53#define BCSR_INT_PC1STSCHG 0x0020
54#define BCSR_INT_DC 0x0040
55#define BCSR_INT_FLASHBUSY 0x0080
56#define BCSR_INT_PC0INSERT 0x0100
57#define BCSR_INT_PC0EJECT 0x0200
58#define BCSR_INT_PC1INSERT 0x0400
59#define BCSR_INT_PC1EJECT 0x0800
60#define BCSR_INT_SD0INSERT 0x1000
61#define BCSR_INT_SD0EJECT 0x2000
62#define BCSR_INT_SD1INSERT 0x4000
63#define BCSR_INT_SD1EJECT 0x8000
64
65#define DB1200_IDE_PHYS_ADDR 0x18800000
66#define DB1200_IDE_REG_SHIFT 5
67#define DB1200_IDE_PHYS_LEN (16 << DB1200_IDE_REG_SHIFT)
68#define DB1200_ETH_PHYS_ADDR 0x19000300
69#define DB1200_NAND_PHYS_ADDR 0x20000000
70
71#define PB1200_IDE_PHYS_ADDR 0x0C800000
72#define PB1200_ETH_PHYS_ADDR 0x0D000300
73#define PB1200_NAND_PHYS_ADDR 0x1C000000
74
75#define DB1200_INT_BEGIN (AU1000_MAX_INTR + 1)
76#define DB1200_IDE_INT (DB1200_INT_BEGIN + 0)
77#define DB1200_ETH_INT (DB1200_INT_BEGIN + 1)
78#define DB1200_PC0_INT (DB1200_INT_BEGIN + 2)
79#define DB1200_PC0_STSCHG_INT (DB1200_INT_BEGIN + 3)
80#define DB1200_PC1_INT (DB1200_INT_BEGIN + 4)
81#define DB1200_PC1_STSCHG_INT (DB1200_INT_BEGIN + 5)
82#define DB1200_DC_INT (DB1200_INT_BEGIN + 6)
83#define DB1200_FLASHBUSY_INT (DB1200_INT_BEGIN + 7)
84#define DB1200_PC0_INSERT_INT (DB1200_INT_BEGIN + 8)
85#define DB1200_PC0_EJECT_INT (DB1200_INT_BEGIN + 9)
86#define DB1200_PC1_INSERT_INT (DB1200_INT_BEGIN + 10)
87#define DB1200_PC1_EJECT_INT (DB1200_INT_BEGIN + 11)
88#define DB1200_SD0_INSERT_INT (DB1200_INT_BEGIN + 12)
89#define DB1200_SD0_EJECT_INT (DB1200_INT_BEGIN + 13)
90#define PB1200_SD1_INSERT_INT (DB1200_INT_BEGIN + 14)
91#define PB1200_SD1_EJECT_INT (DB1200_INT_BEGIN + 15)
92#define DB1200_INT_END (DB1200_INT_BEGIN + 15)
93
Manuel Laussbd8510d2012-09-13 17:44:39 +020094const char *get_system_type(void);
Manuel Lauss7c4b24d2011-11-10 12:06:21 +000095
Manuel Laussbd8510d2012-09-13 17:44:39 +020096static int __init db1200_detect_board(void)
Manuel Lauss6f7c8622011-11-10 12:06:22 +000097{
98 int bid;
99
Manuel Laussf2711be2011-12-08 10:42:16 +0000100 /* try the DB1200 first */
101 bcsr_init(DB1200_BCSR_PHYS_ADDR,
102 DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS);
103 if (BCSR_WHOAMI_DB1200 == BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
104 unsigned short t = bcsr_read(BCSR_HEXLEDS);
105 bcsr_write(BCSR_HEXLEDS, ~t);
106 if (bcsr_read(BCSR_HEXLEDS) != t) {
107 bcsr_write(BCSR_HEXLEDS, t);
108 return 0;
109 }
110 }
111
112 /* okay, try the PB1200 then */
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000113 bcsr_init(PB1200_BCSR_PHYS_ADDR,
114 PB1200_BCSR_PHYS_ADDR + PB1200_BCSR_HEXLED_OFS);
115 bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
116 if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
Manuel Laussf2711be2011-12-08 10:42:16 +0000117 (bid == BCSR_WHOAMI_PB1200_DDR2)) {
118 unsigned short t = bcsr_read(BCSR_HEXLEDS);
119 bcsr_write(BCSR_HEXLEDS, ~t);
120 if (bcsr_read(BCSR_HEXLEDS) != t) {
121 bcsr_write(BCSR_HEXLEDS, t);
122 return 0;
123 }
124 }
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000125
Manuel Laussf2711be2011-12-08 10:42:16 +0000126 return 1; /* it's neither */
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000127}
128
Manuel Laussbd8510d2012-09-13 17:44:39 +0200129int __init db1200_board_setup(void)
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000130{
131 unsigned long freq0, clksrc, div, pfc;
132 unsigned short whoami;
133
Manuel Laussbd8510d2012-09-13 17:44:39 +0200134 if (db1200_detect_board())
135 return -ENODEV;
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000136
137 whoami = bcsr_read(BCSR_WHOAMI);
Manuel Lauss970e2682014-02-20 14:59:24 +0100138 switch (BCSR_WHOAMI_BOARD(whoami)) {
139 case BCSR_WHOAMI_PB1200_DDR1:
140 case BCSR_WHOAMI_PB1200_DDR2:
141 case BCSR_WHOAMI_DB1200:
142 break;
143 default:
144 return -ENODEV;
145 }
146
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000147 printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d"
Ralf Baechle70342282013-01-22 12:59:30 +0100148 " Board-ID %d Daughtercard ID %d\n", get_system_type(),
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000149 (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);
150
151 /* SMBus/SPI on PSC0, Audio on PSC1 */
152 pfc = __raw_readl((void __iomem *)SYS_PINFUNC);
153 pfc &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
154 pfc &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B | SYS_PINFUNC_FS3);
Ralf Baechle70342282013-01-22 12:59:30 +0100155 pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000156 __raw_writel(pfc, (void __iomem *)SYS_PINFUNC);
157 wmb();
158
159 /* Clock configurations: PSC0: ~50MHz via Clkgen0, derived from
160 * CPU clock; all other clock generators off/unused.
161 */
162 div = (get_au1x00_speed() + 25000000) / 50000000;
163 if (div & 1)
164 div++;
165 div = ((div >> 1) - 1) & 0xff;
166
167 freq0 = div << SYS_FC_FRDIV0_BIT;
168 __raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0);
169 wmb();
170 freq0 |= SYS_FC_FE0; /* enable F0 */
171 __raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0);
172 wmb();
173
174 /* psc0_intclk comes 1:1 from F0 */
175 clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT;
176 __raw_writel(clksrc, (void __iomem *)SYS_CLKSRC);
177 wmb();
Manuel Laussbd8510d2012-09-13 17:44:39 +0200178
179 return 0;
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000180}
181
182/******************************************************************************/
Manuel Lauss63323ec2009-11-02 21:21:43 +0100183
184static struct mtd_partition db1200_spiflash_parts[] = {
185 {
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000186 .name = "spi_flash",
Ralf Baechle70342282013-01-22 12:59:30 +0100187 .offset = 0,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100188 .size = MTDPART_SIZ_FULL,
189 },
190};
191
192static struct flash_platform_data db1200_spiflash_data = {
193 .name = "s25fl001",
194 .parts = db1200_spiflash_parts,
195 .nr_parts = ARRAY_SIZE(db1200_spiflash_parts),
196 .type = "m25p10",
197};
198
199static struct spi_board_info db1200_spi_devs[] __initdata = {
200 {
201 /* TI TMP121AIDBVR temp sensor */
202 .modalias = "tmp121",
203 .max_speed_hz = 2000000,
204 .bus_num = 0,
205 .chip_select = 0,
206 .mode = 0,
207 },
208 {
209 /* Spansion S25FL001D0FMA SPI flash */
210 .modalias = "m25p80",
211 .max_speed_hz = 50000000,
212 .bus_num = 0,
213 .chip_select = 1,
214 .mode = 0,
215 .platform_data = &db1200_spiflash_data,
216 },
217};
218
219static struct i2c_board_info db1200_i2c_devs[] __initdata = {
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000220 { I2C_BOARD_INFO("24c04", 0x52), }, /* AT24C04-10 I2C eeprom */
221 { I2C_BOARD_INFO("ne1619", 0x2d), }, /* adm1025-compat hwmon */
222 { I2C_BOARD_INFO("wm8731", 0x1b), }, /* I2S audio codec WM8731 */
Manuel Lauss63323ec2009-11-02 21:21:43 +0100223};
224
225/**********************************************************************/
226
227static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
228 unsigned int ctrl)
229{
230 struct nand_chip *this = mtd->priv;
231 unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
232
233 ioaddr &= 0xffffff00;
234
235 if (ctrl & NAND_CLE) {
236 ioaddr += MEM_STNAND_CMD;
237 } else if (ctrl & NAND_ALE) {
238 ioaddr += MEM_STNAND_ADDR;
239 } else {
240 /* assume we want to r/w real data by default */
241 ioaddr += MEM_STNAND_DATA;
242 }
243 this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
244 if (cmd != NAND_CMD_NONE) {
245 __raw_writeb(cmd, this->IO_ADDR_W);
246 wmb();
247 }
248}
249
250static int au1200_nand_device_ready(struct mtd_info *mtd)
251{
252 return __raw_readl((void __iomem *)MEM_STSTAT) & 1;
253}
254
Manuel Lauss63323ec2009-11-02 21:21:43 +0100255static struct mtd_partition db1200_nand_parts[] = {
256 {
257 .name = "NAND FS 0",
Ralf Baechle70342282013-01-22 12:59:30 +0100258 .offset = 0,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100259 .size = 8 * 1024 * 1024,
260 },
261 {
262 .name = "NAND FS 1",
Ralf Baechle70342282013-01-22 12:59:30 +0100263 .offset = MTDPART_OFS_APPEND,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100264 .size = MTDPART_SIZ_FULL
265 },
266};
267
268struct platform_nand_data db1200_nand_platdata = {
269 .chip = {
270 .nr_chips = 1,
271 .chip_offset = 0,
272 .nr_partitions = ARRAY_SIZE(db1200_nand_parts),
273 .partitions = db1200_nand_parts,
274 .chip_delay = 20,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100275 },
276 .ctrl = {
277 .dev_ready = au1200_nand_device_ready,
278 .cmd_ctrl = au1200_nand_cmd_ctrl,
279 },
280};
281
282static struct resource db1200_nand_res[] = {
283 [0] = {
284 .start = DB1200_NAND_PHYS_ADDR,
285 .end = DB1200_NAND_PHYS_ADDR + 0xff,
286 .flags = IORESOURCE_MEM,
287 },
288};
289
290static struct platform_device db1200_nand_dev = {
291 .name = "gen_nand",
292 .num_resources = ARRAY_SIZE(db1200_nand_res),
293 .resource = db1200_nand_res,
294 .id = -1,
295 .dev = {
296 .platform_data = &db1200_nand_platdata,
297 }
298};
299
300/**********************************************************************/
301
302static struct smc91x_platdata db1200_eth_data = {
303 .flags = SMC91X_NOWAIT | SMC91X_USE_16BIT,
304 .leda = RPC_LED_100_10,
305 .ledb = RPC_LED_TX_RX,
306};
307
308static struct resource db1200_eth_res[] = {
309 [0] = {
310 .start = DB1200_ETH_PHYS_ADDR,
311 .end = DB1200_ETH_PHYS_ADDR + 0xf,
312 .flags = IORESOURCE_MEM,
313 },
314 [1] = {
315 .start = DB1200_ETH_INT,
316 .end = DB1200_ETH_INT,
317 .flags = IORESOURCE_IRQ,
318 },
319};
320
321static struct platform_device db1200_eth_dev = {
322 .dev = {
323 .platform_data = &db1200_eth_data,
324 },
325 .name = "smc91x",
326 .id = -1,
327 .num_resources = ARRAY_SIZE(db1200_eth_res),
328 .resource = db1200_eth_res,
329};
330
331/**********************************************************************/
332
333static struct resource db1200_ide_res[] = {
334 [0] = {
335 .start = DB1200_IDE_PHYS_ADDR,
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000336 .end = DB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100337 .flags = IORESOURCE_MEM,
338 },
339 [1] = {
340 .start = DB1200_IDE_INT,
341 .end = DB1200_IDE_INT,
342 .flags = IORESOURCE_IRQ,
Manuel Laussd4f07ae2011-08-18 11:11:58 +0200343 },
344 [2] = {
Manuel Laussf2e442f2011-08-12 11:39:42 +0200345 .start = AU1200_DSCR_CMD0_DMA_REQ1,
346 .end = AU1200_DSCR_CMD0_DMA_REQ1,
Manuel Laussd4f07ae2011-08-18 11:11:58 +0200347 .flags = IORESOURCE_DMA,
348 },
Manuel Lauss63323ec2009-11-02 21:21:43 +0100349};
350
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000351static u64 au1200_ide_dmamask = DMA_BIT_MASK(32);
Manuel Lauss63323ec2009-11-02 21:21:43 +0100352
353static struct platform_device db1200_ide_dev = {
354 .name = "au1200-ide",
355 .id = 0,
356 .dev = {
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000357 .dma_mask = &au1200_ide_dmamask,
FUJITA Tomonori25c8f832010-06-24 01:26:09 +0900358 .coherent_dma_mask = DMA_BIT_MASK(32),
Manuel Lauss63323ec2009-11-02 21:21:43 +0100359 },
360 .num_resources = ARRAY_SIZE(db1200_ide_res),
361 .resource = db1200_ide_res,
362};
363
364/**********************************************************************/
365
Manuel Lauss63323ec2009-11-02 21:21:43 +0100366/* SD carddetects: they're supposed to be edge-triggered, but ack
367 * doesn't seem to work (CPLD Rev 2). Instead, the screaming one
368 * is disabled and its counterpart enabled. The 500ms timeout is
369 * because the carddetect isn't debounced in hardware.
370 */
371static irqreturn_t db1200_mmc_cd(int irq, void *ptr)
372{
373 void(*mmc_cd)(struct mmc_host *, unsigned long);
374
375 if (irq == DB1200_SD0_INSERT_INT) {
376 disable_irq_nosync(DB1200_SD0_INSERT_INT);
377 enable_irq(DB1200_SD0_EJECT_INT);
378 } else {
379 disable_irq_nosync(DB1200_SD0_EJECT_INT);
380 enable_irq(DB1200_SD0_INSERT_INT);
381 }
382
383 /* link against CONFIG_MMC=m */
384 mmc_cd = symbol_get(mmc_detect_change);
385 if (mmc_cd) {
386 mmc_cd(ptr, msecs_to_jiffies(500));
387 symbol_put(mmc_detect_change);
388 }
389
390 return IRQ_HANDLED;
391}
392
393static int db1200_mmc_cd_setup(void *mmc_host, int en)
394{
395 int ret;
396
397 if (en) {
398 ret = request_irq(DB1200_SD0_INSERT_INT, db1200_mmc_cd,
Yong Zhang8b5690f2011-11-22 14:38:03 +0000399 0, "sd_insert", mmc_host);
Manuel Lauss63323ec2009-11-02 21:21:43 +0100400 if (ret)
401 goto out;
402
403 ret = request_irq(DB1200_SD0_EJECT_INT, db1200_mmc_cd,
Yong Zhang8b5690f2011-11-22 14:38:03 +0000404 0, "sd_eject", mmc_host);
Manuel Lauss63323ec2009-11-02 21:21:43 +0100405 if (ret) {
406 free_irq(DB1200_SD0_INSERT_INT, mmc_host);
407 goto out;
408 }
409
410 if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT)
411 enable_irq(DB1200_SD0_EJECT_INT);
412 else
413 enable_irq(DB1200_SD0_INSERT_INT);
414
415 } else {
416 free_irq(DB1200_SD0_INSERT_INT, mmc_host);
417 free_irq(DB1200_SD0_EJECT_INT, mmc_host);
418 }
419 ret = 0;
420out:
421 return ret;
422}
423
424static void db1200_mmc_set_power(void *mmc_host, int state)
425{
426 if (state) {
427 bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD0PWR);
428 msleep(400); /* stabilization time */
429 } else
430 bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD0PWR, 0);
431}
432
433static int db1200_mmc_card_readonly(void *mmc_host)
434{
435 return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 1 : 0;
436}
437
438static int db1200_mmc_card_inserted(void *mmc_host)
439{
440 return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT) ? 1 : 0;
441}
442
443static void db1200_mmcled_set(struct led_classdev *led,
444 enum led_brightness brightness)
445{
446 if (brightness != LED_OFF)
447 bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0);
448 else
449 bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0);
450}
451
452static struct led_classdev db1200_mmc_led = {
Ralf Baechle70342282013-01-22 12:59:30 +0100453 .brightness_set = db1200_mmcled_set,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100454};
455
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000456/* -- */
457
458static irqreturn_t pb1200_mmc1_cd(int irq, void *ptr)
459{
460 void(*mmc_cd)(struct mmc_host *, unsigned long);
461
462 if (irq == PB1200_SD1_INSERT_INT) {
463 disable_irq_nosync(PB1200_SD1_INSERT_INT);
464 enable_irq(PB1200_SD1_EJECT_INT);
465 } else {
466 disable_irq_nosync(PB1200_SD1_EJECT_INT);
467 enable_irq(PB1200_SD1_INSERT_INT);
468 }
469
470 /* link against CONFIG_MMC=m */
471 mmc_cd = symbol_get(mmc_detect_change);
472 if (mmc_cd) {
473 mmc_cd(ptr, msecs_to_jiffies(500));
474 symbol_put(mmc_detect_change);
475 }
476
477 return IRQ_HANDLED;
478}
479
480static int pb1200_mmc1_cd_setup(void *mmc_host, int en)
481{
482 int ret;
483
484 if (en) {
485 ret = request_irq(PB1200_SD1_INSERT_INT, pb1200_mmc1_cd, 0,
486 "sd1_insert", mmc_host);
487 if (ret)
488 goto out;
489
490 ret = request_irq(PB1200_SD1_EJECT_INT, pb1200_mmc1_cd, 0,
491 "sd1_eject", mmc_host);
492 if (ret) {
493 free_irq(PB1200_SD1_INSERT_INT, mmc_host);
494 goto out;
495 }
496
497 if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT)
498 enable_irq(PB1200_SD1_EJECT_INT);
499 else
500 enable_irq(PB1200_SD1_INSERT_INT);
501
502 } else {
503 free_irq(PB1200_SD1_INSERT_INT, mmc_host);
504 free_irq(PB1200_SD1_EJECT_INT, mmc_host);
505 }
506 ret = 0;
507out:
508 return ret;
509}
510
511static void pb1200_mmc1led_set(struct led_classdev *led,
512 enum led_brightness brightness)
513{
514 if (brightness != LED_OFF)
515 bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED1, 0);
516 else
517 bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED1);
518}
519
520static struct led_classdev pb1200_mmc1_led = {
Ralf Baechle70342282013-01-22 12:59:30 +0100521 .brightness_set = pb1200_mmc1led_set,
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000522};
523
524static void pb1200_mmc1_set_power(void *mmc_host, int state)
525{
526 if (state) {
527 bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD1PWR);
528 msleep(400); /* stabilization time */
529 } else
530 bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD1PWR, 0);
531}
532
533static int pb1200_mmc1_card_readonly(void *mmc_host)
534{
535 return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD1WP) ? 1 : 0;
536}
537
538static int pb1200_mmc1_card_inserted(void *mmc_host)
539{
540 return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT) ? 1 : 0;
541}
542
543
544static struct au1xmmc_platform_data db1200_mmc_platdata[2] = {
545 [0] = {
546 .cd_setup = db1200_mmc_cd_setup,
547 .set_power = db1200_mmc_set_power,
548 .card_inserted = db1200_mmc_card_inserted,
549 .card_readonly = db1200_mmc_card_readonly,
550 .led = &db1200_mmc_led,
551 },
552 [1] = {
553 .cd_setup = pb1200_mmc1_cd_setup,
554 .set_power = pb1200_mmc1_set_power,
555 .card_inserted = pb1200_mmc1_card_inserted,
556 .card_readonly = pb1200_mmc1_card_readonly,
557 .led = &pb1200_mmc1_led,
558 },
Manuel Lauss3766386032011-08-12 11:39:45 +0200559};
560
561static struct resource au1200_mmc0_resources[] = {
Manuel Lauss63323ec2009-11-02 21:21:43 +0100562 [0] = {
Manuel Lauss3766386032011-08-12 11:39:45 +0200563 .start = AU1100_SD0_PHYS_ADDR,
564 .end = AU1100_SD0_PHYS_ADDR + 0xfff,
565 .flags = IORESOURCE_MEM,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100566 },
Manuel Lauss3766386032011-08-12 11:39:45 +0200567 [1] = {
568 .start = AU1200_SD_INT,
569 .end = AU1200_SD_INT,
570 .flags = IORESOURCE_IRQ,
571 },
572 [2] = {
573 .start = AU1200_DSCR_CMD0_SDMS_TX0,
574 .end = AU1200_DSCR_CMD0_SDMS_TX0,
575 .flags = IORESOURCE_DMA,
576 },
577 [3] = {
578 .start = AU1200_DSCR_CMD0_SDMS_RX0,
579 .end = AU1200_DSCR_CMD0_SDMS_RX0,
580 .flags = IORESOURCE_DMA,
581 }
582};
583
Ralf Baechle70342282013-01-22 12:59:30 +0100584static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32);
Manuel Lauss3766386032011-08-12 11:39:45 +0200585
586static struct platform_device db1200_mmc0_dev = {
587 .name = "au1xxx-mmc",
588 .id = 0,
589 .dev = {
590 .dma_mask = &au1xxx_mmc_dmamask,
591 .coherent_dma_mask = DMA_BIT_MASK(32),
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000592 .platform_data = &db1200_mmc_platdata[0],
Manuel Lauss3766386032011-08-12 11:39:45 +0200593 },
594 .num_resources = ARRAY_SIZE(au1200_mmc0_resources),
595 .resource = au1200_mmc0_resources,
596};
597
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000598static struct resource au1200_mmc1_res[] = {
599 [0] = {
600 .start = AU1100_SD1_PHYS_ADDR,
601 .end = AU1100_SD1_PHYS_ADDR + 0xfff,
602 .flags = IORESOURCE_MEM,
603 },
604 [1] = {
605 .start = AU1200_SD_INT,
606 .end = AU1200_SD_INT,
607 .flags = IORESOURCE_IRQ,
608 },
609 [2] = {
610 .start = AU1200_DSCR_CMD0_SDMS_TX1,
611 .end = AU1200_DSCR_CMD0_SDMS_TX1,
612 .flags = IORESOURCE_DMA,
613 },
614 [3] = {
615 .start = AU1200_DSCR_CMD0_SDMS_RX1,
616 .end = AU1200_DSCR_CMD0_SDMS_RX1,
617 .flags = IORESOURCE_DMA,
618 }
619};
620
621static struct platform_device pb1200_mmc1_dev = {
622 .name = "au1xxx-mmc",
623 .id = 1,
624 .dev = {
625 .dma_mask = &au1xxx_mmc_dmamask,
626 .coherent_dma_mask = DMA_BIT_MASK(32),
627 .platform_data = &db1200_mmc_platdata[1],
628 },
629 .num_resources = ARRAY_SIZE(au1200_mmc1_res),
630 .resource = au1200_mmc1_res,
631};
632
Manuel Lauss3766386032011-08-12 11:39:45 +0200633/**********************************************************************/
634
Manuel Laussa9b71a82011-11-10 12:06:21 +0000635static int db1200fb_panel_index(void)
636{
637 return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
638}
639
640static int db1200fb_panel_init(void)
641{
642 /* Apply power */
643 bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
644 BCSR_BOARD_LCDBL);
645 return 0;
646}
647
648static int db1200fb_panel_shutdown(void)
649{
650 /* Remove power */
651 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
652 BCSR_BOARD_LCDBL, 0);
653 return 0;
654}
655
656static struct au1200fb_platdata db1200fb_pd = {
657 .panel_index = db1200fb_panel_index,
658 .panel_init = db1200fb_panel_init,
Ralf Baechle70342282013-01-22 12:59:30 +0100659 .panel_shutdown = db1200fb_panel_shutdown,
Manuel Laussa9b71a82011-11-10 12:06:21 +0000660};
661
Manuel Lauss3766386032011-08-12 11:39:45 +0200662static struct resource au1200_lcd_res[] = {
663 [0] = {
664 .start = AU1200_LCD_PHYS_ADDR,
665 .end = AU1200_LCD_PHYS_ADDR + 0x800 - 1,
666 .flags = IORESOURCE_MEM,
667 },
668 [1] = {
669 .start = AU1200_LCD_INT,
670 .end = AU1200_LCD_INT,
671 .flags = IORESOURCE_IRQ,
672 }
673};
674
675static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32);
676
677static struct platform_device au1200_lcd_dev = {
678 .name = "au1200-lcd",
679 .id = 0,
680 .dev = {
681 .dma_mask = &au1200_lcd_dmamask,
682 .coherent_dma_mask = DMA_BIT_MASK(32),
Manuel Laussa9b71a82011-11-10 12:06:21 +0000683 .platform_data = &db1200fb_pd,
Manuel Lauss3766386032011-08-12 11:39:45 +0200684 },
685 .num_resources = ARRAY_SIZE(au1200_lcd_res),
686 .resource = au1200_lcd_res,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100687};
688
689/**********************************************************************/
690
691static struct resource au1200_psc0_res[] = {
692 [0] = {
Manuel Lauss7cc2e272011-08-12 11:39:40 +0200693 .start = AU1550_PSC0_PHYS_ADDR,
694 .end = AU1550_PSC0_PHYS_ADDR + 0xfff,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100695 .flags = IORESOURCE_MEM,
696 },
697 [1] = {
698 .start = AU1200_PSC0_INT,
699 .end = AU1200_PSC0_INT,
700 .flags = IORESOURCE_IRQ,
701 },
702 [2] = {
Manuel Laussf2e442f2011-08-12 11:39:42 +0200703 .start = AU1200_DSCR_CMD0_PSC0_TX,
704 .end = AU1200_DSCR_CMD0_PSC0_TX,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100705 .flags = IORESOURCE_DMA,
706 },
707 [3] = {
Manuel Laussf2e442f2011-08-12 11:39:42 +0200708 .start = AU1200_DSCR_CMD0_PSC0_RX,
709 .end = AU1200_DSCR_CMD0_PSC0_RX,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100710 .flags = IORESOURCE_DMA,
711 },
712};
713
714static struct platform_device db1200_i2c_dev = {
715 .name = "au1xpsc_smbus",
716 .id = 0, /* bus number */
717 .num_resources = ARRAY_SIZE(au1200_psc0_res),
718 .resource = au1200_psc0_res,
719};
720
721static void db1200_spi_cs_en(struct au1550_spi_info *spi, int cs, int pol)
722{
723 if (cs)
724 bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_SPISEL);
725 else
726 bcsr_mod(BCSR_RESETS, BCSR_RESETS_SPISEL, 0);
727}
728
729static struct au1550_spi_info db1200_spi_platdata = {
730 .mainclk_hz = 50000000, /* PSC0 clock */
731 .num_chipselect = 2,
732 .activate_cs = db1200_spi_cs_en,
733};
734
FUJITA Tomonori25c8f832010-06-24 01:26:09 +0900735static u64 spi_dmamask = DMA_BIT_MASK(32);
Manuel Lauss63323ec2009-11-02 21:21:43 +0100736
737static struct platform_device db1200_spi_dev = {
738 .dev = {
739 .dma_mask = &spi_dmamask,
FUJITA Tomonori25c8f832010-06-24 01:26:09 +0900740 .coherent_dma_mask = DMA_BIT_MASK(32),
Manuel Lauss63323ec2009-11-02 21:21:43 +0100741 .platform_data = &db1200_spi_platdata,
742 },
743 .name = "au1550-spi",
744 .id = 0, /* bus number */
745 .num_resources = ARRAY_SIZE(au1200_psc0_res),
746 .resource = au1200_psc0_res,
747};
748
Manuel Lauss05ae3232009-11-02 21:21:44 +0100749static struct resource au1200_psc1_res[] = {
750 [0] = {
Manuel Lauss7cc2e272011-08-12 11:39:40 +0200751 .start = AU1550_PSC1_PHYS_ADDR,
752 .end = AU1550_PSC1_PHYS_ADDR + 0xfff,
Manuel Lauss05ae3232009-11-02 21:21:44 +0100753 .flags = IORESOURCE_MEM,
754 },
755 [1] = {
756 .start = AU1200_PSC1_INT,
757 .end = AU1200_PSC1_INT,
758 .flags = IORESOURCE_IRQ,
759 },
760 [2] = {
Manuel Laussf2e442f2011-08-12 11:39:42 +0200761 .start = AU1200_DSCR_CMD0_PSC1_TX,
762 .end = AU1200_DSCR_CMD0_PSC1_TX,
Manuel Lauss05ae3232009-11-02 21:21:44 +0100763 .flags = IORESOURCE_DMA,
764 },
765 [3] = {
Manuel Laussf2e442f2011-08-12 11:39:42 +0200766 .start = AU1200_DSCR_CMD0_PSC1_RX,
767 .end = AU1200_DSCR_CMD0_PSC1_RX,
Manuel Lauss05ae3232009-11-02 21:21:44 +0100768 .flags = IORESOURCE_DMA,
769 },
770};
771
Manuel Laussadbc7a52011-07-25 13:45:03 +0200772/* AC97 or I2S device */
Manuel Lauss05ae3232009-11-02 21:21:44 +0100773static struct platform_device db1200_audio_dev = {
774 /* name assigned later based on switch setting */
775 .id = 1, /* PSC ID */
776 .num_resources = ARRAY_SIZE(au1200_psc1_res),
777 .resource = au1200_psc1_res,
778};
779
Manuel Laussadbc7a52011-07-25 13:45:03 +0200780/* DB1200 ASoC card device */
781static struct platform_device db1200_sound_dev = {
782 /* name assigned later based on switch setting */
783 .id = 1, /* PSC ID */
784};
785
Manuel Laussffc4fdb2010-08-26 14:53:51 +0200786static struct platform_device db1200_stac_dev = {
787 .name = "ac97-codec",
788 .id = 1, /* on PSC1 */
789};
790
Manuel Lauss5b0912b2011-07-25 13:45:02 +0200791static struct platform_device db1200_audiodma_dev = {
792 .name = "au1xpsc-pcm",
793 .id = 1, /* PSC ID */
794};
795
Manuel Lauss63323ec2009-11-02 21:21:43 +0100796static struct platform_device *db1200_devs[] __initdata = {
797 NULL, /* PSC0, selected by S6.8 */
798 &db1200_ide_dev,
Manuel Lauss3766386032011-08-12 11:39:45 +0200799 &db1200_mmc0_dev,
800 &au1200_lcd_dev,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100801 &db1200_eth_dev,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100802 &db1200_nand_dev,
Manuel Lauss5b0912b2011-07-25 13:45:02 +0200803 &db1200_audiodma_dev,
Manuel Lauss05ae3232009-11-02 21:21:44 +0100804 &db1200_audio_dev,
Manuel Laussffc4fdb2010-08-26 14:53:51 +0200805 &db1200_stac_dev,
Manuel Laussadbc7a52011-07-25 13:45:03 +0200806 &db1200_sound_dev,
Manuel Lauss63323ec2009-11-02 21:21:43 +0100807};
808
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000809static struct platform_device *pb1200_devs[] __initdata = {
810 &pb1200_mmc1_dev,
811};
812
813/* Some peripheral base addresses differ on the PB1200 */
814static int __init pb1200_res_fixup(void)
815{
816 /* CPLD Revs earlier than 4 cause problems */
817 if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) {
818 printk(KERN_ERR "WARNING!!!\n");
819 printk(KERN_ERR "WARNING!!!\n");
820 printk(KERN_ERR "PB1200 must be at CPLD rev 4. Please have\n");
821 printk(KERN_ERR "the board updated to latest revisions.\n");
822 printk(KERN_ERR "This software will not work reliably\n");
823 printk(KERN_ERR "on anything older than CPLD rev 4.!\n");
824 printk(KERN_ERR "WARNING!!!\n");
825 printk(KERN_ERR "WARNING!!!\n");
826 return 1;
827 }
828
829 db1200_nand_res[0].start = PB1200_NAND_PHYS_ADDR;
Ralf Baechle70342282013-01-22 12:59:30 +0100830 db1200_nand_res[0].end = PB1200_NAND_PHYS_ADDR + 0xff;
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000831 db1200_ide_res[0].start = PB1200_IDE_PHYS_ADDR;
Ralf Baechle70342282013-01-22 12:59:30 +0100832 db1200_ide_res[0].end = PB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1;
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000833 db1200_eth_res[0].start = PB1200_ETH_PHYS_ADDR;
Ralf Baechle70342282013-01-22 12:59:30 +0100834 db1200_eth_res[0].end = PB1200_ETH_PHYS_ADDR + 0xff;
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000835 return 0;
836}
837
Manuel Laussbd8510d2012-09-13 17:44:39 +0200838int __init db1200_dev_setup(void)
Manuel Lauss63323ec2009-11-02 21:21:43 +0100839{
840 unsigned long pfc;
841 unsigned short sw;
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000842 int swapped, bid;
843
844 bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
845 if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
846 (bid == BCSR_WHOAMI_PB1200_DDR2)) {
847 if (pb1200_res_fixup())
848 return -ENODEV;
849 }
Manuel Lauss63323ec2009-11-02 21:21:43 +0100850
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000851 /* GPIO7 is low-level triggered CPLD cascade */
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000852 irq_set_irq_type(AU1200_GPIO7_INT, IRQ_TYPE_LEVEL_LOW);
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000853 bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT);
854
Ralf Baechle70342282013-01-22 12:59:30 +0100855 /* insert/eject pairs: one of both is always screaming. To avoid
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000856 * issues they must not be automatically enabled when initially
857 * requested.
858 */
859 irq_set_status_flags(DB1200_SD0_INSERT_INT, IRQ_NOAUTOEN);
860 irq_set_status_flags(DB1200_SD0_EJECT_INT, IRQ_NOAUTOEN);
861 irq_set_status_flags(DB1200_PC0_INSERT_INT, IRQ_NOAUTOEN);
862 irq_set_status_flags(DB1200_PC0_EJECT_INT, IRQ_NOAUTOEN);
863 irq_set_status_flags(DB1200_PC1_INSERT_INT, IRQ_NOAUTOEN);
864 irq_set_status_flags(DB1200_PC1_EJECT_INT, IRQ_NOAUTOEN);
Manuel Lauss63323ec2009-11-02 21:21:43 +0100865
866 i2c_register_board_info(0, db1200_i2c_devs,
867 ARRAY_SIZE(db1200_i2c_devs));
868 spi_register_board_info(db1200_spi_devs,
869 ARRAY_SIZE(db1200_i2c_devs));
870
Ralf Baechle70342282013-01-22 12:59:30 +0100871 /* SWITCHES: S6.8 I2C/SPI selector (OFF=I2C ON=SPI)
Manuel Lauss05ae3232009-11-02 21:21:44 +0100872 * S6.7 AC97/I2S selector (OFF=AC97 ON=I2S)
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000873 * or S12 on the PB1200.
Manuel Lauss63323ec2009-11-02 21:21:43 +0100874 */
875
876 /* NOTE: GPIO215 controls OTG VBUS supply. In SPI mode however
877 * this pin is claimed by PSC0 (unused though, but pinmux doesn't
878 * allow to free it without crippling the SPI interface).
879 * As a result, in SPI mode, OTG simply won't work (PSC0 uses
880 * it as an input pin which is pulled high on the boards).
881 */
882 pfc = __raw_readl((void __iomem *)SYS_PINFUNC) & ~SYS_PINFUNC_P0A;
883
884 /* switch off OTG VBUS supply */
885 gpio_request(215, "otg-vbus");
886 gpio_direction_output(215, 1);
887
Manuel Laussbd8510d2012-09-13 17:44:39 +0200888 printk(KERN_INFO "%s device configuration:\n", get_system_type());
Manuel Lauss63323ec2009-11-02 21:21:43 +0100889
890 sw = bcsr_read(BCSR_SWITCHES);
891 if (sw & BCSR_SWITCHES_DIP_8) {
892 db1200_devs[0] = &db1200_i2c_dev;
893 bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0);
894
895 pfc |= (2 << 17); /* GPIO2 block owns GPIO215 */
896
897 printk(KERN_INFO " S6.8 OFF: PSC0 mode I2C\n");
898 printk(KERN_INFO " OTG port VBUS supply available!\n");
899 } else {
900 db1200_devs[0] = &db1200_spi_dev;
901 bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC0MUX);
902
903 pfc |= (1 << 17); /* PSC0 owns GPIO215 */
904
905 printk(KERN_INFO " S6.8 ON : PSC0 mode SPI\n");
906 printk(KERN_INFO " OTG port VBUS supply disabled\n");
907 }
908 __raw_writel(pfc, (void __iomem *)SYS_PINFUNC);
909 wmb();
910
Manuel Lauss05ae3232009-11-02 21:21:44 +0100911 /* Audio: DIP7 selects I2S(0)/AC97(1), but need I2C for I2S!
912 * so: DIP7=1 || DIP8=0 => AC97, DIP7=0 && DIP8=1 => I2S
913 */
914 sw &= BCSR_SWITCHES_DIP_8 | BCSR_SWITCHES_DIP_7;
915 if (sw == BCSR_SWITCHES_DIP_8) {
916 bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC1MUX);
917 db1200_audio_dev.name = "au1xpsc_i2s";
Manuel Laussadbc7a52011-07-25 13:45:03 +0200918 db1200_sound_dev.name = "db1200-i2s";
Manuel Lauss05ae3232009-11-02 21:21:44 +0100919 printk(KERN_INFO " S6.7 ON : PSC1 mode I2S\n");
920 } else {
921 bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC1MUX, 0);
922 db1200_audio_dev.name = "au1xpsc_ac97";
Manuel Laussadbc7a52011-07-25 13:45:03 +0200923 db1200_sound_dev.name = "db1200-ac97";
Manuel Lauss05ae3232009-11-02 21:21:44 +0100924 printk(KERN_INFO " S6.7 OFF: PSC1 mode AC97\n");
925 }
926
927 /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */
928 __raw_writel(PSC_SEL_CLK_SERCLK,
Manuel Lauss7c4b24d2011-11-10 12:06:21 +0000929 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
Manuel Lauss05ae3232009-11-02 21:21:44 +0100930 wmb();
931
Manuel Lauss7cc2e272011-08-12 11:39:40 +0200932 db1x_register_pcmcia_socket(
933 AU1000_PCMCIA_ATTR_PHYS_ADDR,
934 AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
935 AU1000_PCMCIA_MEM_PHYS_ADDR,
936 AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1,
937 AU1000_PCMCIA_IO_PHYS_ADDR,
938 AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1,
939 DB1200_PC0_INT, DB1200_PC0_INSERT_INT,
940 /*DB1200_PC0_STSCHG_INT*/0, DB1200_PC0_EJECT_INT, 0);
Manuel Lauss63323ec2009-11-02 21:21:43 +0100941
Manuel Lauss7cc2e272011-08-12 11:39:40 +0200942 db1x_register_pcmcia_socket(
943 AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000,
944 AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1,
945 AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000,
946 AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1,
947 AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000,
948 AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1,
949 DB1200_PC1_INT, DB1200_PC1_INSERT_INT,
950 /*DB1200_PC1_STSCHG_INT*/0, DB1200_PC1_EJECT_INT, 1);
Manuel Lauss63323ec2009-11-02 21:21:43 +0100951
952 swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT;
953 db1x_register_norflash(64 << 20, 2, swapped);
954
Manuel Lauss6f7c8622011-11-10 12:06:22 +0000955 platform_add_devices(db1200_devs, ARRAY_SIZE(db1200_devs));
956
957 /* PB1200 is a DB1200 with a 2nd MMC and Camera connector */
958 if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
959 (bid == BCSR_WHOAMI_PB1200_DDR2))
960 platform_add_devices(pb1200_devs, ARRAY_SIZE(pb1200_devs));
961
962 return 0;
Manuel Lauss63323ec2009-11-02 21:21:43 +0100963}