xref: /linux/arch/mips/alchemy/devboards/db1200.c (revision 415e0fec7a388dbe224057c1134737e23710aa9b)
17c4b24daSManuel Lauss /*
26f7c8623SManuel Lauss  * DBAu1200/PBAu1200 board platform device registration
37c4b24daSManuel Lauss  *
47c4b24daSManuel Lauss  * Copyright (C) 2008-2011 Manuel Lauss
57c4b24daSManuel Lauss  *
67c4b24daSManuel Lauss  * This program is free software; you can redistribute it and/or modify
77c4b24daSManuel Lauss  * it under the terms of the GNU General Public License as published by
87c4b24daSManuel Lauss  * the Free Software Foundation; either version 2 of the License, or
97c4b24daSManuel Lauss  * (at your option) any later version.
107c4b24daSManuel Lauss  *
117c4b24daSManuel Lauss  * This program is distributed in the hope that it will be useful,
127c4b24daSManuel Lauss  * but WITHOUT ANY WARRANTY; without even the implied warranty of
137c4b24daSManuel Lauss  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
147c4b24daSManuel Lauss  * GNU General Public License for more details.
157c4b24daSManuel Lauss  *
167c4b24daSManuel Lauss  * You should have received a copy of the GNU General Public License
177c4b24daSManuel Lauss  * along with this program; if not, write to the Free Software
187c4b24daSManuel Lauss  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
197c4b24daSManuel Lauss  */
207c4b24daSManuel Lauss 
21*415e0fecSManuel Lauss #include <linux/clk.h>
227c4b24daSManuel Lauss #include <linux/dma-mapping.h>
237c4b24daSManuel Lauss #include <linux/gpio.h>
247c4b24daSManuel Lauss #include <linux/i2c.h>
257c4b24daSManuel Lauss #include <linux/init.h>
26f9ded569SPaul Gortmaker #include <linux/module.h>
277c4b24daSManuel Lauss #include <linux/interrupt.h>
287c4b24daSManuel Lauss #include <linux/io.h>
297c4b24daSManuel Lauss #include <linux/leds.h>
307c4b24daSManuel Lauss #include <linux/mmc/host.h>
317c4b24daSManuel Lauss #include <linux/mtd/mtd.h>
327c4b24daSManuel Lauss #include <linux/mtd/nand.h>
337c4b24daSManuel Lauss #include <linux/mtd/partitions.h>
347c4b24daSManuel Lauss #include <linux/platform_device.h>
357c4b24daSManuel Lauss #include <linux/serial_8250.h>
367c4b24daSManuel Lauss #include <linux/spi/spi.h>
377c4b24daSManuel Lauss #include <linux/spi/flash.h>
387c4b24daSManuel Lauss #include <linux/smc91x.h>
3954ff4a1dSManuel Lauss #include <linux/ata_platform.h>
407c4b24daSManuel Lauss #include <asm/mach-au1x00/au1000.h>
417c4b24daSManuel Lauss #include <asm/mach-au1x00/au1100_mmc.h>
427c4b24daSManuel Lauss #include <asm/mach-au1x00/au1xxx_dbdma.h>
43a16afa53SManuel Lauss #include <asm/mach-au1x00/au1xxx_psc.h>
44a9b71a8fSManuel Lauss #include <asm/mach-au1x00/au1200fb.h>
457c4b24daSManuel Lauss #include <asm/mach-au1x00/au1550_spi.h>
467c4b24daSManuel Lauss #include <asm/mach-db1x00/bcsr.h>
477c4b24daSManuel Lauss 
487c4b24daSManuel Lauss #include "platform.h"
497c4b24daSManuel Lauss 
50a16afa53SManuel Lauss #define BCSR_INT_IDE		0x0001
51a16afa53SManuel Lauss #define BCSR_INT_ETH		0x0002
52a16afa53SManuel Lauss #define BCSR_INT_PC0		0x0004
53a16afa53SManuel Lauss #define BCSR_INT_PC0STSCHG	0x0008
54a16afa53SManuel Lauss #define BCSR_INT_PC1		0x0010
55a16afa53SManuel Lauss #define BCSR_INT_PC1STSCHG	0x0020
56a16afa53SManuel Lauss #define BCSR_INT_DC		0x0040
57a16afa53SManuel Lauss #define BCSR_INT_FLASHBUSY	0x0080
58a16afa53SManuel Lauss #define BCSR_INT_PC0INSERT	0x0100
59a16afa53SManuel Lauss #define BCSR_INT_PC0EJECT	0x0200
60a16afa53SManuel Lauss #define BCSR_INT_PC1INSERT	0x0400
61a16afa53SManuel Lauss #define BCSR_INT_PC1EJECT	0x0800
62a16afa53SManuel Lauss #define BCSR_INT_SD0INSERT	0x1000
63a16afa53SManuel Lauss #define BCSR_INT_SD0EJECT	0x2000
64a16afa53SManuel Lauss #define BCSR_INT_SD1INSERT	0x4000
65a16afa53SManuel Lauss #define BCSR_INT_SD1EJECT	0x8000
66a16afa53SManuel Lauss 
67a16afa53SManuel Lauss #define DB1200_IDE_PHYS_ADDR	0x18800000
68a16afa53SManuel Lauss #define DB1200_IDE_REG_SHIFT	5
69a16afa53SManuel Lauss #define DB1200_IDE_PHYS_LEN	(16 << DB1200_IDE_REG_SHIFT)
70a16afa53SManuel Lauss #define DB1200_ETH_PHYS_ADDR	0x19000300
71a16afa53SManuel Lauss #define DB1200_NAND_PHYS_ADDR	0x20000000
72a16afa53SManuel Lauss 
73a16afa53SManuel Lauss #define PB1200_IDE_PHYS_ADDR	0x0C800000
74a16afa53SManuel Lauss #define PB1200_ETH_PHYS_ADDR	0x0D000300
75a16afa53SManuel Lauss #define PB1200_NAND_PHYS_ADDR	0x1C000000
76a16afa53SManuel Lauss 
77a16afa53SManuel Lauss #define DB1200_INT_BEGIN	(AU1000_MAX_INTR + 1)
78a16afa53SManuel Lauss #define DB1200_IDE_INT		(DB1200_INT_BEGIN + 0)
79a16afa53SManuel Lauss #define DB1200_ETH_INT		(DB1200_INT_BEGIN + 1)
80a16afa53SManuel Lauss #define DB1200_PC0_INT		(DB1200_INT_BEGIN + 2)
81a16afa53SManuel Lauss #define DB1200_PC0_STSCHG_INT	(DB1200_INT_BEGIN + 3)
82a16afa53SManuel Lauss #define DB1200_PC1_INT		(DB1200_INT_BEGIN + 4)
83a16afa53SManuel Lauss #define DB1200_PC1_STSCHG_INT	(DB1200_INT_BEGIN + 5)
84a16afa53SManuel Lauss #define DB1200_DC_INT		(DB1200_INT_BEGIN + 6)
85a16afa53SManuel Lauss #define DB1200_FLASHBUSY_INT	(DB1200_INT_BEGIN + 7)
86a16afa53SManuel Lauss #define DB1200_PC0_INSERT_INT	(DB1200_INT_BEGIN + 8)
87a16afa53SManuel Lauss #define DB1200_PC0_EJECT_INT	(DB1200_INT_BEGIN + 9)
88a16afa53SManuel Lauss #define DB1200_PC1_INSERT_INT	(DB1200_INT_BEGIN + 10)
89a16afa53SManuel Lauss #define DB1200_PC1_EJECT_INT	(DB1200_INT_BEGIN + 11)
90a16afa53SManuel Lauss #define DB1200_SD0_INSERT_INT	(DB1200_INT_BEGIN + 12)
91a16afa53SManuel Lauss #define DB1200_SD0_EJECT_INT	(DB1200_INT_BEGIN + 13)
92a16afa53SManuel Lauss #define PB1200_SD1_INSERT_INT	(DB1200_INT_BEGIN + 14)
93a16afa53SManuel Lauss #define PB1200_SD1_EJECT_INT	(DB1200_INT_BEGIN + 15)
94a16afa53SManuel Lauss #define DB1200_INT_END		(DB1200_INT_BEGIN + 15)
95a16afa53SManuel Lauss 
96bd8510dfSManuel Lauss const char *get_system_type(void);
977c4b24daSManuel Lauss 
98bd8510dfSManuel Lauss static int __init db1200_detect_board(void)
996f7c8623SManuel Lauss {
1006f7c8623SManuel Lauss 	int bid;
1016f7c8623SManuel Lauss 
102f2711be0SManuel Lauss 	/* try the DB1200 first */
103f2711be0SManuel Lauss 	bcsr_init(DB1200_BCSR_PHYS_ADDR,
104f2711be0SManuel Lauss 		  DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS);
105f2711be0SManuel Lauss 	if (BCSR_WHOAMI_DB1200 == BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
106f2711be0SManuel Lauss 		unsigned short t = bcsr_read(BCSR_HEXLEDS);
107f2711be0SManuel Lauss 		bcsr_write(BCSR_HEXLEDS, ~t);
108f2711be0SManuel Lauss 		if (bcsr_read(BCSR_HEXLEDS) != t) {
109f2711be0SManuel Lauss 			bcsr_write(BCSR_HEXLEDS, t);
110f2711be0SManuel Lauss 			return 0;
111f2711be0SManuel Lauss 		}
112f2711be0SManuel Lauss 	}
113f2711be0SManuel Lauss 
114f2711be0SManuel Lauss 	/* okay, try the PB1200 then */
1156f7c8623SManuel Lauss 	bcsr_init(PB1200_BCSR_PHYS_ADDR,
1166f7c8623SManuel Lauss 		  PB1200_BCSR_PHYS_ADDR + PB1200_BCSR_HEXLED_OFS);
1176f7c8623SManuel Lauss 	bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
1186f7c8623SManuel Lauss 	if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
119f2711be0SManuel Lauss 	    (bid == BCSR_WHOAMI_PB1200_DDR2)) {
120f2711be0SManuel Lauss 		unsigned short t = bcsr_read(BCSR_HEXLEDS);
121f2711be0SManuel Lauss 		bcsr_write(BCSR_HEXLEDS, ~t);
122f2711be0SManuel Lauss 		if (bcsr_read(BCSR_HEXLEDS) != t) {
123f2711be0SManuel Lauss 			bcsr_write(BCSR_HEXLEDS, t);
1246f7c8623SManuel Lauss 			return 0;
125f2711be0SManuel Lauss 		}
126f2711be0SManuel Lauss 	}
1276f7c8623SManuel Lauss 
128f2711be0SManuel Lauss 	return 1;	/* it's neither */
1297c4b24daSManuel Lauss }
1307c4b24daSManuel Lauss 
131bd8510dfSManuel Lauss int __init db1200_board_setup(void)
1327c4b24daSManuel Lauss {
1337c4b24daSManuel Lauss 	unsigned short whoami;
1347c4b24daSManuel Lauss 
135bd8510dfSManuel Lauss 	if (db1200_detect_board())
136bd8510dfSManuel Lauss 		return -ENODEV;
1377c4b24daSManuel Lauss 
1387c4b24daSManuel Lauss 	whoami = bcsr_read(BCSR_WHOAMI);
139970e268dSManuel Lauss 	switch (BCSR_WHOAMI_BOARD(whoami)) {
140970e268dSManuel Lauss 	case BCSR_WHOAMI_PB1200_DDR1:
141970e268dSManuel Lauss 	case BCSR_WHOAMI_PB1200_DDR2:
142970e268dSManuel Lauss 	case BCSR_WHOAMI_DB1200:
143970e268dSManuel Lauss 		break;
144970e268dSManuel Lauss 	default:
145970e268dSManuel Lauss 		return -ENODEV;
146970e268dSManuel Lauss 	}
147970e268dSManuel Lauss 
1486f7c8623SManuel Lauss 	printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d"
149bd8510dfSManuel Lauss 		"  Board-ID %d	Daughtercard ID %d\n", get_system_type(),
1507c4b24daSManuel Lauss 		(whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);
1517c4b24daSManuel Lauss 
152bd8510dfSManuel Lauss 	return 0;
1537c4b24daSManuel Lauss }
1547c4b24daSManuel Lauss 
1557c4b24daSManuel Lauss /******************************************************************************/
1567c4b24daSManuel Lauss 
1577c4b24daSManuel Lauss static struct mtd_partition db1200_spiflash_parts[] = {
1587c4b24daSManuel Lauss 	{
1596f7c8623SManuel Lauss 		.name	= "spi_flash",
1607c4b24daSManuel Lauss 		.offset = 0,
1617c4b24daSManuel Lauss 		.size	= MTDPART_SIZ_FULL,
1627c4b24daSManuel Lauss 	},
1637c4b24daSManuel Lauss };
1647c4b24daSManuel Lauss 
1657c4b24daSManuel Lauss static struct flash_platform_data db1200_spiflash_data = {
1667c4b24daSManuel Lauss 	.name		= "s25fl001",
1677c4b24daSManuel Lauss 	.parts		= db1200_spiflash_parts,
1687c4b24daSManuel Lauss 	.nr_parts	= ARRAY_SIZE(db1200_spiflash_parts),
1697c4b24daSManuel Lauss 	.type		= "m25p10",
1707c4b24daSManuel Lauss };
1717c4b24daSManuel Lauss 
1727c4b24daSManuel Lauss static struct spi_board_info db1200_spi_devs[] __initdata = {
1737c4b24daSManuel Lauss 	{
1747c4b24daSManuel Lauss 		/* TI TMP121AIDBVR temp sensor */
1757c4b24daSManuel Lauss 		.modalias	= "tmp121",
1767c4b24daSManuel Lauss 		.max_speed_hz	= 2000000,
1777c4b24daSManuel Lauss 		.bus_num	= 0,
1787c4b24daSManuel Lauss 		.chip_select	= 0,
1797c4b24daSManuel Lauss 		.mode		= 0,
1807c4b24daSManuel Lauss 	},
1817c4b24daSManuel Lauss 	{
1827c4b24daSManuel Lauss 		/* Spansion S25FL001D0FMA SPI flash */
1837c4b24daSManuel Lauss 		.modalias	= "m25p80",
1847c4b24daSManuel Lauss 		.max_speed_hz	= 50000000,
1857c4b24daSManuel Lauss 		.bus_num	= 0,
1867c4b24daSManuel Lauss 		.chip_select	= 1,
1877c4b24daSManuel Lauss 		.mode		= 0,
1887c4b24daSManuel Lauss 		.platform_data	= &db1200_spiflash_data,
1897c4b24daSManuel Lauss 	},
1907c4b24daSManuel Lauss };
1917c4b24daSManuel Lauss 
1927c4b24daSManuel Lauss static struct i2c_board_info db1200_i2c_devs[] __initdata = {
1937c4b24daSManuel Lauss 	{ I2C_BOARD_INFO("24c04", 0x52),  }, /* AT24C04-10 I2C eeprom */
1947c4b24daSManuel Lauss 	{ I2C_BOARD_INFO("ne1619", 0x2d), }, /* adm1025-compat hwmon */
1957c4b24daSManuel Lauss 	{ I2C_BOARD_INFO("wm8731", 0x1b), }, /* I2S audio codec WM8731 */
1967c4b24daSManuel Lauss };
1977c4b24daSManuel Lauss 
1987c4b24daSManuel Lauss /**********************************************************************/
1997c4b24daSManuel Lauss 
2007c4b24daSManuel Lauss static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
2017c4b24daSManuel Lauss 				 unsigned int ctrl)
2027c4b24daSManuel Lauss {
2037c4b24daSManuel Lauss 	struct nand_chip *this = mtd->priv;
2047c4b24daSManuel Lauss 	unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
2057c4b24daSManuel Lauss 
2067c4b24daSManuel Lauss 	ioaddr &= 0xffffff00;
2077c4b24daSManuel Lauss 
2087c4b24daSManuel Lauss 	if (ctrl & NAND_CLE) {
2097c4b24daSManuel Lauss 		ioaddr += MEM_STNAND_CMD;
2107c4b24daSManuel Lauss 	} else if (ctrl & NAND_ALE) {
2117c4b24daSManuel Lauss 		ioaddr += MEM_STNAND_ADDR;
2127c4b24daSManuel Lauss 	} else {
2137c4b24daSManuel Lauss 		/* assume we want to r/w real data  by default */
2147c4b24daSManuel Lauss 		ioaddr += MEM_STNAND_DATA;
2157c4b24daSManuel Lauss 	}
2167c4b24daSManuel Lauss 	this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
2177c4b24daSManuel Lauss 	if (cmd != NAND_CMD_NONE) {
2187c4b24daSManuel Lauss 		__raw_writeb(cmd, this->IO_ADDR_W);
2197c4b24daSManuel Lauss 		wmb();
2207c4b24daSManuel Lauss 	}
2217c4b24daSManuel Lauss }
2227c4b24daSManuel Lauss 
2237c4b24daSManuel Lauss static int au1200_nand_device_ready(struct mtd_info *mtd)
2247c4b24daSManuel Lauss {
2259cf12167SManuel Lauss 	return alchemy_rdsmem(AU1000_MEM_STSTAT) & 1;
2267c4b24daSManuel Lauss }
2277c4b24daSManuel Lauss 
2287c4b24daSManuel Lauss static struct mtd_partition db1200_nand_parts[] = {
2297c4b24daSManuel Lauss 	{
2307c4b24daSManuel Lauss 		.name	= "NAND FS 0",
2317c4b24daSManuel Lauss 		.offset = 0,
2327c4b24daSManuel Lauss 		.size	= 8 * 1024 * 1024,
2337c4b24daSManuel Lauss 	},
2347c4b24daSManuel Lauss 	{
2357c4b24daSManuel Lauss 		.name	= "NAND FS 1",
2367c4b24daSManuel Lauss 		.offset = MTDPART_OFS_APPEND,
2377c4b24daSManuel Lauss 		.size	= MTDPART_SIZ_FULL
2387c4b24daSManuel Lauss 	},
2397c4b24daSManuel Lauss };
2407c4b24daSManuel Lauss 
2417c4b24daSManuel Lauss struct platform_nand_data db1200_nand_platdata = {
2427c4b24daSManuel Lauss 	.chip = {
2437c4b24daSManuel Lauss 		.nr_chips	= 1,
2447c4b24daSManuel Lauss 		.chip_offset	= 0,
2457c4b24daSManuel Lauss 		.nr_partitions	= ARRAY_SIZE(db1200_nand_parts),
2467c4b24daSManuel Lauss 		.partitions	= db1200_nand_parts,
2477c4b24daSManuel Lauss 		.chip_delay	= 20,
2487c4b24daSManuel Lauss 	},
2497c4b24daSManuel Lauss 	.ctrl = {
2507c4b24daSManuel Lauss 		.dev_ready	= au1200_nand_device_ready,
2517c4b24daSManuel Lauss 		.cmd_ctrl	= au1200_nand_cmd_ctrl,
2527c4b24daSManuel Lauss 	},
2537c4b24daSManuel Lauss };
2547c4b24daSManuel Lauss 
2557c4b24daSManuel Lauss static struct resource db1200_nand_res[] = {
2567c4b24daSManuel Lauss 	[0] = {
2577c4b24daSManuel Lauss 		.start	= DB1200_NAND_PHYS_ADDR,
2587c4b24daSManuel Lauss 		.end	= DB1200_NAND_PHYS_ADDR + 0xff,
2597c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
2607c4b24daSManuel Lauss 	},
2617c4b24daSManuel Lauss };
2627c4b24daSManuel Lauss 
2637c4b24daSManuel Lauss static struct platform_device db1200_nand_dev = {
2647c4b24daSManuel Lauss 	.name		= "gen_nand",
2657c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(db1200_nand_res),
2667c4b24daSManuel Lauss 	.resource	= db1200_nand_res,
2677c4b24daSManuel Lauss 	.id		= -1,
2687c4b24daSManuel Lauss 	.dev		= {
2697c4b24daSManuel Lauss 		.platform_data = &db1200_nand_platdata,
2707c4b24daSManuel Lauss 	}
2717c4b24daSManuel Lauss };
2727c4b24daSManuel Lauss 
2737c4b24daSManuel Lauss /**********************************************************************/
2747c4b24daSManuel Lauss 
2757c4b24daSManuel Lauss static struct smc91x_platdata db1200_eth_data = {
2767c4b24daSManuel Lauss 	.flags	= SMC91X_NOWAIT | SMC91X_USE_16BIT,
2777c4b24daSManuel Lauss 	.leda	= RPC_LED_100_10,
2787c4b24daSManuel Lauss 	.ledb	= RPC_LED_TX_RX,
2797c4b24daSManuel Lauss };
2807c4b24daSManuel Lauss 
2817c4b24daSManuel Lauss static struct resource db1200_eth_res[] = {
2827c4b24daSManuel Lauss 	[0] = {
2837c4b24daSManuel Lauss 		.start	= DB1200_ETH_PHYS_ADDR,
2847c4b24daSManuel Lauss 		.end	= DB1200_ETH_PHYS_ADDR + 0xf,
2857c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
2867c4b24daSManuel Lauss 	},
2877c4b24daSManuel Lauss 	[1] = {
2887c4b24daSManuel Lauss 		.start	= DB1200_ETH_INT,
2897c4b24daSManuel Lauss 		.end	= DB1200_ETH_INT,
2907c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
2917c4b24daSManuel Lauss 	},
2927c4b24daSManuel Lauss };
2937c4b24daSManuel Lauss 
2947c4b24daSManuel Lauss static struct platform_device db1200_eth_dev = {
2957c4b24daSManuel Lauss 	.dev	= {
2967c4b24daSManuel Lauss 		.platform_data	= &db1200_eth_data,
2977c4b24daSManuel Lauss 	},
2987c4b24daSManuel Lauss 	.name		= "smc91x",
2997c4b24daSManuel Lauss 	.id		= -1,
3007c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(db1200_eth_res),
3017c4b24daSManuel Lauss 	.resource	= db1200_eth_res,
3027c4b24daSManuel Lauss };
3037c4b24daSManuel Lauss 
3047c4b24daSManuel Lauss /**********************************************************************/
3057c4b24daSManuel Lauss 
30654ff4a1dSManuel Lauss static struct pata_platform_info db1200_ide_info = {
30754ff4a1dSManuel Lauss 	.ioport_shift	= DB1200_IDE_REG_SHIFT,
30854ff4a1dSManuel Lauss };
30954ff4a1dSManuel Lauss 
31054ff4a1dSManuel Lauss #define IDE_ALT_START	(14 << DB1200_IDE_REG_SHIFT)
3117c4b24daSManuel Lauss static struct resource db1200_ide_res[] = {
3127c4b24daSManuel Lauss 	[0] = {
3137c4b24daSManuel Lauss 		.start	= DB1200_IDE_PHYS_ADDR,
31454ff4a1dSManuel Lauss 		.end	= DB1200_IDE_PHYS_ADDR + IDE_ALT_START - 1,
3157c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
3167c4b24daSManuel Lauss 	},
3177c4b24daSManuel Lauss 	[1] = {
31854ff4a1dSManuel Lauss 		.start	= DB1200_IDE_PHYS_ADDR + IDE_ALT_START,
31954ff4a1dSManuel Lauss 		.end	= DB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1,
32054ff4a1dSManuel Lauss 		.flags	= IORESOURCE_MEM,
32154ff4a1dSManuel Lauss 	},
32254ff4a1dSManuel Lauss 	[2] = {
3237c4b24daSManuel Lauss 		.start	= DB1200_IDE_INT,
3247c4b24daSManuel Lauss 		.end	= DB1200_IDE_INT,
3257c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
3267c4b24daSManuel Lauss 	},
3277c4b24daSManuel Lauss };
3287c4b24daSManuel Lauss 
3297c4b24daSManuel Lauss static u64 au1200_ide_dmamask = DMA_BIT_MASK(32);
3307c4b24daSManuel Lauss 
3317c4b24daSManuel Lauss static struct platform_device db1200_ide_dev = {
33254ff4a1dSManuel Lauss 	.name		= "pata_platform",
3337c4b24daSManuel Lauss 	.id		= 0,
3347c4b24daSManuel Lauss 	.dev = {
3357c4b24daSManuel Lauss 		.dma_mask		= &au1200_ide_dmamask,
3367c4b24daSManuel Lauss 		.coherent_dma_mask	= DMA_BIT_MASK(32),
33754ff4a1dSManuel Lauss 		.platform_data		= &db1200_ide_info,
3387c4b24daSManuel Lauss 	},
3397c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(db1200_ide_res),
3407c4b24daSManuel Lauss 	.resource	= db1200_ide_res,
3417c4b24daSManuel Lauss };
3427c4b24daSManuel Lauss 
3437c4b24daSManuel Lauss /**********************************************************************/
3447c4b24daSManuel Lauss 
3457c4b24daSManuel Lauss /* SD carddetects:  they're supposed to be edge-triggered, but ack
3467c4b24daSManuel Lauss  * doesn't seem to work (CPLD Rev 2).  Instead, the screaming one
3477c4b24daSManuel Lauss  * is disabled and its counterpart enabled.  The 500ms timeout is
3487c4b24daSManuel Lauss  * because the carddetect isn't debounced in hardware.
3497c4b24daSManuel Lauss  */
3507c4b24daSManuel Lauss static irqreturn_t db1200_mmc_cd(int irq, void *ptr)
3517c4b24daSManuel Lauss {
3527c4b24daSManuel Lauss 	void(*mmc_cd)(struct mmc_host *, unsigned long);
3537c4b24daSManuel Lauss 
3547c4b24daSManuel Lauss 	if (irq == DB1200_SD0_INSERT_INT) {
3557c4b24daSManuel Lauss 		disable_irq_nosync(DB1200_SD0_INSERT_INT);
3567c4b24daSManuel Lauss 		enable_irq(DB1200_SD0_EJECT_INT);
3577c4b24daSManuel Lauss 	} else {
3587c4b24daSManuel Lauss 		disable_irq_nosync(DB1200_SD0_EJECT_INT);
3597c4b24daSManuel Lauss 		enable_irq(DB1200_SD0_INSERT_INT);
3607c4b24daSManuel Lauss 	}
3617c4b24daSManuel Lauss 
3627c4b24daSManuel Lauss 	/* link against CONFIG_MMC=m */
3637c4b24daSManuel Lauss 	mmc_cd = symbol_get(mmc_detect_change);
3647c4b24daSManuel Lauss 	if (mmc_cd) {
3657c4b24daSManuel Lauss 		mmc_cd(ptr, msecs_to_jiffies(500));
3667c4b24daSManuel Lauss 		symbol_put(mmc_detect_change);
3677c4b24daSManuel Lauss 	}
3687c4b24daSManuel Lauss 
3697c4b24daSManuel Lauss 	return IRQ_HANDLED;
3707c4b24daSManuel Lauss }
3717c4b24daSManuel Lauss 
3727c4b24daSManuel Lauss static int db1200_mmc_cd_setup(void *mmc_host, int en)
3737c4b24daSManuel Lauss {
3747c4b24daSManuel Lauss 	int ret;
3757c4b24daSManuel Lauss 
3767c4b24daSManuel Lauss 	if (en) {
3777c4b24daSManuel Lauss 		ret = request_irq(DB1200_SD0_INSERT_INT, db1200_mmc_cd,
3787a5c3b8cSRalf Baechle 				  0, "sd_insert", mmc_host);
3797c4b24daSManuel Lauss 		if (ret)
3807c4b24daSManuel Lauss 			goto out;
3817c4b24daSManuel Lauss 
3827c4b24daSManuel Lauss 		ret = request_irq(DB1200_SD0_EJECT_INT, db1200_mmc_cd,
3837a5c3b8cSRalf Baechle 				  0, "sd_eject", mmc_host);
3847c4b24daSManuel Lauss 		if (ret) {
3857c4b24daSManuel Lauss 			free_irq(DB1200_SD0_INSERT_INT, mmc_host);
3867c4b24daSManuel Lauss 			goto out;
3877c4b24daSManuel Lauss 		}
3887c4b24daSManuel Lauss 
3897c4b24daSManuel Lauss 		if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT)
3907c4b24daSManuel Lauss 			enable_irq(DB1200_SD0_EJECT_INT);
3917c4b24daSManuel Lauss 		else
3927c4b24daSManuel Lauss 			enable_irq(DB1200_SD0_INSERT_INT);
3937c4b24daSManuel Lauss 
3947c4b24daSManuel Lauss 	} else {
3957c4b24daSManuel Lauss 		free_irq(DB1200_SD0_INSERT_INT, mmc_host);
3967c4b24daSManuel Lauss 		free_irq(DB1200_SD0_EJECT_INT, mmc_host);
3977c4b24daSManuel Lauss 	}
3987c4b24daSManuel Lauss 	ret = 0;
3997c4b24daSManuel Lauss out:
4007c4b24daSManuel Lauss 	return ret;
4017c4b24daSManuel Lauss }
4027c4b24daSManuel Lauss 
4037c4b24daSManuel Lauss static void db1200_mmc_set_power(void *mmc_host, int state)
4047c4b24daSManuel Lauss {
4057c4b24daSManuel Lauss 	if (state) {
4067c4b24daSManuel Lauss 		bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD0PWR);
4077c4b24daSManuel Lauss 		msleep(400);	/* stabilization time */
4087c4b24daSManuel Lauss 	} else
4097c4b24daSManuel Lauss 		bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD0PWR, 0);
4107c4b24daSManuel Lauss }
4117c4b24daSManuel Lauss 
4127c4b24daSManuel Lauss static int db1200_mmc_card_readonly(void *mmc_host)
4137c4b24daSManuel Lauss {
4147c4b24daSManuel Lauss 	return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 1 : 0;
4157c4b24daSManuel Lauss }
4167c4b24daSManuel Lauss 
4177c4b24daSManuel Lauss static int db1200_mmc_card_inserted(void *mmc_host)
4187c4b24daSManuel Lauss {
4197c4b24daSManuel Lauss 	return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT) ? 1 : 0;
4207c4b24daSManuel Lauss }
4217c4b24daSManuel Lauss 
4227c4b24daSManuel Lauss static void db1200_mmcled_set(struct led_classdev *led,
4237c4b24daSManuel Lauss 			      enum led_brightness brightness)
4247c4b24daSManuel Lauss {
4257c4b24daSManuel Lauss 	if (brightness != LED_OFF)
4267c4b24daSManuel Lauss 		bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0);
4277c4b24daSManuel Lauss 	else
4287c4b24daSManuel Lauss 		bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0);
4297c4b24daSManuel Lauss }
4307c4b24daSManuel Lauss 
4317c4b24daSManuel Lauss static struct led_classdev db1200_mmc_led = {
4327c4b24daSManuel Lauss 	.brightness_set = db1200_mmcled_set,
4337c4b24daSManuel Lauss };
4347c4b24daSManuel Lauss 
4356f7c8623SManuel Lauss /* -- */
4366f7c8623SManuel Lauss 
4376f7c8623SManuel Lauss static irqreturn_t pb1200_mmc1_cd(int irq, void *ptr)
4386f7c8623SManuel Lauss {
4396f7c8623SManuel Lauss 	void(*mmc_cd)(struct mmc_host *, unsigned long);
4406f7c8623SManuel Lauss 
4416f7c8623SManuel Lauss 	if (irq == PB1200_SD1_INSERT_INT) {
4426f7c8623SManuel Lauss 		disable_irq_nosync(PB1200_SD1_INSERT_INT);
4436f7c8623SManuel Lauss 		enable_irq(PB1200_SD1_EJECT_INT);
4446f7c8623SManuel Lauss 	} else {
4456f7c8623SManuel Lauss 		disable_irq_nosync(PB1200_SD1_EJECT_INT);
4466f7c8623SManuel Lauss 		enable_irq(PB1200_SD1_INSERT_INT);
4476f7c8623SManuel Lauss 	}
4486f7c8623SManuel Lauss 
4496f7c8623SManuel Lauss 	/* link against CONFIG_MMC=m */
4506f7c8623SManuel Lauss 	mmc_cd = symbol_get(mmc_detect_change);
4516f7c8623SManuel Lauss 	if (mmc_cd) {
4526f7c8623SManuel Lauss 		mmc_cd(ptr, msecs_to_jiffies(500));
4536f7c8623SManuel Lauss 		symbol_put(mmc_detect_change);
4546f7c8623SManuel Lauss 	}
4556f7c8623SManuel Lauss 
4566f7c8623SManuel Lauss 	return IRQ_HANDLED;
4576f7c8623SManuel Lauss }
4586f7c8623SManuel Lauss 
4596f7c8623SManuel Lauss static int pb1200_mmc1_cd_setup(void *mmc_host, int en)
4606f7c8623SManuel Lauss {
4616f7c8623SManuel Lauss 	int ret;
4626f7c8623SManuel Lauss 
4636f7c8623SManuel Lauss 	if (en) {
4646f7c8623SManuel Lauss 		ret = request_irq(PB1200_SD1_INSERT_INT, pb1200_mmc1_cd, 0,
4656f7c8623SManuel Lauss 				  "sd1_insert", mmc_host);
4666f7c8623SManuel Lauss 		if (ret)
4676f7c8623SManuel Lauss 			goto out;
4686f7c8623SManuel Lauss 
4696f7c8623SManuel Lauss 		ret = request_irq(PB1200_SD1_EJECT_INT, pb1200_mmc1_cd, 0,
4706f7c8623SManuel Lauss 				  "sd1_eject", mmc_host);
4716f7c8623SManuel Lauss 		if (ret) {
4726f7c8623SManuel Lauss 			free_irq(PB1200_SD1_INSERT_INT, mmc_host);
4736f7c8623SManuel Lauss 			goto out;
4746f7c8623SManuel Lauss 		}
4756f7c8623SManuel Lauss 
4766f7c8623SManuel Lauss 		if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT)
4776f7c8623SManuel Lauss 			enable_irq(PB1200_SD1_EJECT_INT);
4786f7c8623SManuel Lauss 		else
4796f7c8623SManuel Lauss 			enable_irq(PB1200_SD1_INSERT_INT);
4806f7c8623SManuel Lauss 
4816f7c8623SManuel Lauss 	} else {
4826f7c8623SManuel Lauss 		free_irq(PB1200_SD1_INSERT_INT, mmc_host);
4836f7c8623SManuel Lauss 		free_irq(PB1200_SD1_EJECT_INT, mmc_host);
4846f7c8623SManuel Lauss 	}
4856f7c8623SManuel Lauss 	ret = 0;
4866f7c8623SManuel Lauss out:
4876f7c8623SManuel Lauss 	return ret;
4886f7c8623SManuel Lauss }
4896f7c8623SManuel Lauss 
4906f7c8623SManuel Lauss static void pb1200_mmc1led_set(struct led_classdev *led,
4916f7c8623SManuel Lauss 			enum led_brightness brightness)
4926f7c8623SManuel Lauss {
4936f7c8623SManuel Lauss 	if (brightness != LED_OFF)
4946f7c8623SManuel Lauss 			bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED1, 0);
4956f7c8623SManuel Lauss 	else
4966f7c8623SManuel Lauss 			bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED1);
4976f7c8623SManuel Lauss }
4986f7c8623SManuel Lauss 
4996f7c8623SManuel Lauss static struct led_classdev pb1200_mmc1_led = {
5006f7c8623SManuel Lauss 	.brightness_set = pb1200_mmc1led_set,
5016f7c8623SManuel Lauss };
5026f7c8623SManuel Lauss 
5036f7c8623SManuel Lauss static void pb1200_mmc1_set_power(void *mmc_host, int state)
5046f7c8623SManuel Lauss {
5056f7c8623SManuel Lauss 	if (state) {
5066f7c8623SManuel Lauss 		bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD1PWR);
5076f7c8623SManuel Lauss 		msleep(400);	/* stabilization time */
5086f7c8623SManuel Lauss 	} else
5096f7c8623SManuel Lauss 		bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD1PWR, 0);
5106f7c8623SManuel Lauss }
5116f7c8623SManuel Lauss 
5126f7c8623SManuel Lauss static int pb1200_mmc1_card_readonly(void *mmc_host)
5136f7c8623SManuel Lauss {
5146f7c8623SManuel Lauss 	return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD1WP) ? 1 : 0;
5156f7c8623SManuel Lauss }
5166f7c8623SManuel Lauss 
5176f7c8623SManuel Lauss static int pb1200_mmc1_card_inserted(void *mmc_host)
5186f7c8623SManuel Lauss {
5196f7c8623SManuel Lauss 	return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT) ? 1 : 0;
5206f7c8623SManuel Lauss }
5216f7c8623SManuel Lauss 
5226f7c8623SManuel Lauss 
5236f7c8623SManuel Lauss static struct au1xmmc_platform_data db1200_mmc_platdata[2] = {
5246f7c8623SManuel Lauss 	[0] = {
5257c4b24daSManuel Lauss 		.cd_setup	= db1200_mmc_cd_setup,
5267c4b24daSManuel Lauss 		.set_power	= db1200_mmc_set_power,
5277c4b24daSManuel Lauss 		.card_inserted	= db1200_mmc_card_inserted,
5287c4b24daSManuel Lauss 		.card_readonly	= db1200_mmc_card_readonly,
5297c4b24daSManuel Lauss 		.led		= &db1200_mmc_led,
5306f7c8623SManuel Lauss 	},
5316f7c8623SManuel Lauss 	[1] = {
5326f7c8623SManuel Lauss 		.cd_setup	= pb1200_mmc1_cd_setup,
5336f7c8623SManuel Lauss 		.set_power	= pb1200_mmc1_set_power,
5346f7c8623SManuel Lauss 		.card_inserted	= pb1200_mmc1_card_inserted,
5356f7c8623SManuel Lauss 		.card_readonly	= pb1200_mmc1_card_readonly,
5366f7c8623SManuel Lauss 		.led		= &pb1200_mmc1_led,
5376f7c8623SManuel Lauss 	},
5387c4b24daSManuel Lauss };
5397c4b24daSManuel Lauss 
5407c4b24daSManuel Lauss static struct resource au1200_mmc0_resources[] = {
5417c4b24daSManuel Lauss 	[0] = {
5427c4b24daSManuel Lauss 		.start	= AU1100_SD0_PHYS_ADDR,
5437c4b24daSManuel Lauss 		.end	= AU1100_SD0_PHYS_ADDR + 0xfff,
5447c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
5457c4b24daSManuel Lauss 	},
5467c4b24daSManuel Lauss 	[1] = {
5477c4b24daSManuel Lauss 		.start	= AU1200_SD_INT,
5487c4b24daSManuel Lauss 		.end	= AU1200_SD_INT,
5497c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
5507c4b24daSManuel Lauss 	},
5517c4b24daSManuel Lauss 	[2] = {
5527c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_SDMS_TX0,
5537c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_SDMS_TX0,
5547c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
5557c4b24daSManuel Lauss 	},
5567c4b24daSManuel Lauss 	[3] = {
5577c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_SDMS_RX0,
5587c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_SDMS_RX0,
5597c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
5607c4b24daSManuel Lauss 	}
5617c4b24daSManuel Lauss };
5627c4b24daSManuel Lauss 
5637c4b24daSManuel Lauss static u64 au1xxx_mmc_dmamask =	 DMA_BIT_MASK(32);
5647c4b24daSManuel Lauss 
5657c4b24daSManuel Lauss static struct platform_device db1200_mmc0_dev = {
5667c4b24daSManuel Lauss 	.name		= "au1xxx-mmc",
5677c4b24daSManuel Lauss 	.id		= 0,
5687c4b24daSManuel Lauss 	.dev = {
5697c4b24daSManuel Lauss 		.dma_mask		= &au1xxx_mmc_dmamask,
5707c4b24daSManuel Lauss 		.coherent_dma_mask	= DMA_BIT_MASK(32),
5716f7c8623SManuel Lauss 		.platform_data		= &db1200_mmc_platdata[0],
5727c4b24daSManuel Lauss 	},
5737c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_mmc0_resources),
5747c4b24daSManuel Lauss 	.resource	= au1200_mmc0_resources,
5757c4b24daSManuel Lauss };
5767c4b24daSManuel Lauss 
5776f7c8623SManuel Lauss static struct resource au1200_mmc1_res[] = {
5786f7c8623SManuel Lauss 	[0] = {
5796f7c8623SManuel Lauss 		.start	= AU1100_SD1_PHYS_ADDR,
5806f7c8623SManuel Lauss 		.end	= AU1100_SD1_PHYS_ADDR + 0xfff,
5816f7c8623SManuel Lauss 		.flags	= IORESOURCE_MEM,
5826f7c8623SManuel Lauss 	},
5836f7c8623SManuel Lauss 	[1] = {
5846f7c8623SManuel Lauss 		.start	= AU1200_SD_INT,
5856f7c8623SManuel Lauss 		.end	= AU1200_SD_INT,
5866f7c8623SManuel Lauss 		.flags	= IORESOURCE_IRQ,
5876f7c8623SManuel Lauss 	},
5886f7c8623SManuel Lauss 	[2] = {
5896f7c8623SManuel Lauss 		.start	= AU1200_DSCR_CMD0_SDMS_TX1,
5906f7c8623SManuel Lauss 		.end	= AU1200_DSCR_CMD0_SDMS_TX1,
5916f7c8623SManuel Lauss 		.flags	= IORESOURCE_DMA,
5926f7c8623SManuel Lauss 	},
5936f7c8623SManuel Lauss 	[3] = {
5946f7c8623SManuel Lauss 		.start	= AU1200_DSCR_CMD0_SDMS_RX1,
5956f7c8623SManuel Lauss 		.end	= AU1200_DSCR_CMD0_SDMS_RX1,
5966f7c8623SManuel Lauss 		.flags	= IORESOURCE_DMA,
5976f7c8623SManuel Lauss 	}
5986f7c8623SManuel Lauss };
5996f7c8623SManuel Lauss 
6006f7c8623SManuel Lauss static struct platform_device pb1200_mmc1_dev = {
6016f7c8623SManuel Lauss 	.name		= "au1xxx-mmc",
6026f7c8623SManuel Lauss 	.id		= 1,
6036f7c8623SManuel Lauss 	.dev = {
6046f7c8623SManuel Lauss 		.dma_mask		= &au1xxx_mmc_dmamask,
6056f7c8623SManuel Lauss 		.coherent_dma_mask	= DMA_BIT_MASK(32),
6066f7c8623SManuel Lauss 		.platform_data		= &db1200_mmc_platdata[1],
6076f7c8623SManuel Lauss 	},
6086f7c8623SManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_mmc1_res),
6096f7c8623SManuel Lauss 	.resource	= au1200_mmc1_res,
6106f7c8623SManuel Lauss };
6116f7c8623SManuel Lauss 
6127c4b24daSManuel Lauss /**********************************************************************/
6137c4b24daSManuel Lauss 
614a9b71a8fSManuel Lauss static int db1200fb_panel_index(void)
615a9b71a8fSManuel Lauss {
616a9b71a8fSManuel Lauss 	return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
617a9b71a8fSManuel Lauss }
618a9b71a8fSManuel Lauss 
619a9b71a8fSManuel Lauss static int db1200fb_panel_init(void)
620a9b71a8fSManuel Lauss {
621a9b71a8fSManuel Lauss 	/* Apply power */
622a9b71a8fSManuel Lauss 	bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
623a9b71a8fSManuel Lauss 				BCSR_BOARD_LCDBL);
624a9b71a8fSManuel Lauss 	return 0;
625a9b71a8fSManuel Lauss }
626a9b71a8fSManuel Lauss 
627a9b71a8fSManuel Lauss static int db1200fb_panel_shutdown(void)
628a9b71a8fSManuel Lauss {
629a9b71a8fSManuel Lauss 	/* Remove power */
630a9b71a8fSManuel Lauss 	bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
631a9b71a8fSManuel Lauss 			     BCSR_BOARD_LCDBL, 0);
632a9b71a8fSManuel Lauss 	return 0;
633a9b71a8fSManuel Lauss }
634a9b71a8fSManuel Lauss 
635a9b71a8fSManuel Lauss static struct au1200fb_platdata db1200fb_pd = {
636a9b71a8fSManuel Lauss 	.panel_index	= db1200fb_panel_index,
637a9b71a8fSManuel Lauss 	.panel_init	= db1200fb_panel_init,
638a9b71a8fSManuel Lauss 	.panel_shutdown = db1200fb_panel_shutdown,
639a9b71a8fSManuel Lauss };
640a9b71a8fSManuel Lauss 
6417c4b24daSManuel Lauss static struct resource au1200_lcd_res[] = {
6427c4b24daSManuel Lauss 	[0] = {
6437c4b24daSManuel Lauss 		.start	= AU1200_LCD_PHYS_ADDR,
6447c4b24daSManuel Lauss 		.end	= AU1200_LCD_PHYS_ADDR + 0x800 - 1,
6457c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
6467c4b24daSManuel Lauss 	},
6477c4b24daSManuel Lauss 	[1] = {
6487c4b24daSManuel Lauss 		.start	= AU1200_LCD_INT,
6497c4b24daSManuel Lauss 		.end	= AU1200_LCD_INT,
6507c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
6517c4b24daSManuel Lauss 	}
6527c4b24daSManuel Lauss };
6537c4b24daSManuel Lauss 
6547c4b24daSManuel Lauss static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32);
6557c4b24daSManuel Lauss 
6567c4b24daSManuel Lauss static struct platform_device au1200_lcd_dev = {
6577c4b24daSManuel Lauss 	.name		= "au1200-lcd",
6587c4b24daSManuel Lauss 	.id		= 0,
6597c4b24daSManuel Lauss 	.dev = {
6607c4b24daSManuel Lauss 		.dma_mask		= &au1200_lcd_dmamask,
6617c4b24daSManuel Lauss 		.coherent_dma_mask	= DMA_BIT_MASK(32),
662a9b71a8fSManuel Lauss 		.platform_data		= &db1200fb_pd,
6637c4b24daSManuel Lauss 	},
6647c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_lcd_res),
6657c4b24daSManuel Lauss 	.resource	= au1200_lcd_res,
6667c4b24daSManuel Lauss };
6677c4b24daSManuel Lauss 
6687c4b24daSManuel Lauss /**********************************************************************/
6697c4b24daSManuel Lauss 
6707c4b24daSManuel Lauss static struct resource au1200_psc0_res[] = {
6717c4b24daSManuel Lauss 	[0] = {
6727c4b24daSManuel Lauss 		.start	= AU1550_PSC0_PHYS_ADDR,
6737c4b24daSManuel Lauss 		.end	= AU1550_PSC0_PHYS_ADDR + 0xfff,
6747c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
6757c4b24daSManuel Lauss 	},
6767c4b24daSManuel Lauss 	[1] = {
6777c4b24daSManuel Lauss 		.start	= AU1200_PSC0_INT,
6787c4b24daSManuel Lauss 		.end	= AU1200_PSC0_INT,
6797c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
6807c4b24daSManuel Lauss 	},
6817c4b24daSManuel Lauss 	[2] = {
6827c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_PSC0_TX,
6837c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_PSC0_TX,
6847c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
6857c4b24daSManuel Lauss 	},
6867c4b24daSManuel Lauss 	[3] = {
6877c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_PSC0_RX,
6887c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_PSC0_RX,
6897c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
6907c4b24daSManuel Lauss 	},
6917c4b24daSManuel Lauss };
6927c4b24daSManuel Lauss 
6937c4b24daSManuel Lauss static struct platform_device db1200_i2c_dev = {
6947c4b24daSManuel Lauss 	.name		= "au1xpsc_smbus",
6957c4b24daSManuel Lauss 	.id		= 0,	/* bus number */
6967c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_psc0_res),
6977c4b24daSManuel Lauss 	.resource	= au1200_psc0_res,
6987c4b24daSManuel Lauss };
6997c4b24daSManuel Lauss 
7007c4b24daSManuel Lauss static void db1200_spi_cs_en(struct au1550_spi_info *spi, int cs, int pol)
7017c4b24daSManuel Lauss {
7027c4b24daSManuel Lauss 	if (cs)
7037c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_SPISEL);
7047c4b24daSManuel Lauss 	else
7057c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, BCSR_RESETS_SPISEL, 0);
7067c4b24daSManuel Lauss }
7077c4b24daSManuel Lauss 
7087c4b24daSManuel Lauss static struct au1550_spi_info db1200_spi_platdata = {
7097c4b24daSManuel Lauss 	.mainclk_hz	= 50000000,	/* PSC0 clock */
7107c4b24daSManuel Lauss 	.num_chipselect = 2,
7117c4b24daSManuel Lauss 	.activate_cs	= db1200_spi_cs_en,
7127c4b24daSManuel Lauss };
7137c4b24daSManuel Lauss 
7147c4b24daSManuel Lauss static u64 spi_dmamask = DMA_BIT_MASK(32);
7157c4b24daSManuel Lauss 
7167c4b24daSManuel Lauss static struct platform_device db1200_spi_dev = {
7177c4b24daSManuel Lauss 	.dev	= {
7187c4b24daSManuel Lauss 		.dma_mask		= &spi_dmamask,
7197c4b24daSManuel Lauss 		.coherent_dma_mask	= DMA_BIT_MASK(32),
7207c4b24daSManuel Lauss 		.platform_data		= &db1200_spi_platdata,
7217c4b24daSManuel Lauss 	},
7227c4b24daSManuel Lauss 	.name		= "au1550-spi",
7237c4b24daSManuel Lauss 	.id		= 0,	/* bus number */
7247c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_psc0_res),
7257c4b24daSManuel Lauss 	.resource	= au1200_psc0_res,
7267c4b24daSManuel Lauss };
7277c4b24daSManuel Lauss 
7287c4b24daSManuel Lauss static struct resource au1200_psc1_res[] = {
7297c4b24daSManuel Lauss 	[0] = {
7307c4b24daSManuel Lauss 		.start	= AU1550_PSC1_PHYS_ADDR,
7317c4b24daSManuel Lauss 		.end	= AU1550_PSC1_PHYS_ADDR + 0xfff,
7327c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
7337c4b24daSManuel Lauss 	},
7347c4b24daSManuel Lauss 	[1] = {
7357c4b24daSManuel Lauss 		.start	= AU1200_PSC1_INT,
7367c4b24daSManuel Lauss 		.end	= AU1200_PSC1_INT,
7377c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
7387c4b24daSManuel Lauss 	},
7397c4b24daSManuel Lauss 	[2] = {
7407c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_PSC1_TX,
7417c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_PSC1_TX,
7427c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
7437c4b24daSManuel Lauss 	},
7447c4b24daSManuel Lauss 	[3] = {
7457c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_PSC1_RX,
7467c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_PSC1_RX,
7477c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
7487c4b24daSManuel Lauss 	},
7497c4b24daSManuel Lauss };
7507c4b24daSManuel Lauss 
7517c4b24daSManuel Lauss /* AC97 or I2S device */
7527c4b24daSManuel Lauss static struct platform_device db1200_audio_dev = {
7537c4b24daSManuel Lauss 	/* name assigned later based on switch setting */
7547c4b24daSManuel Lauss 	.id		= 1,	/* PSC ID */
7557c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_psc1_res),
7567c4b24daSManuel Lauss 	.resource	= au1200_psc1_res,
7577c4b24daSManuel Lauss };
7587c4b24daSManuel Lauss 
7597c4b24daSManuel Lauss /* DB1200 ASoC card device */
7607c4b24daSManuel Lauss static struct platform_device db1200_sound_dev = {
7617c4b24daSManuel Lauss 	/* name assigned later based on switch setting */
7627c4b24daSManuel Lauss 	.id		= 1,	/* PSC ID */
7637c4b24daSManuel Lauss };
7647c4b24daSManuel Lauss 
7657c4b24daSManuel Lauss static struct platform_device db1200_stac_dev = {
7667c4b24daSManuel Lauss 	.name		= "ac97-codec",
7677c4b24daSManuel Lauss 	.id		= 1,	/* on PSC1 */
7687c4b24daSManuel Lauss };
7697c4b24daSManuel Lauss 
7707c4b24daSManuel Lauss static struct platform_device db1200_audiodma_dev = {
7717c4b24daSManuel Lauss 	.name		= "au1xpsc-pcm",
7727c4b24daSManuel Lauss 	.id		= 1,	/* PSC ID */
7737c4b24daSManuel Lauss };
7747c4b24daSManuel Lauss 
7757c4b24daSManuel Lauss static struct platform_device *db1200_devs[] __initdata = {
7767c4b24daSManuel Lauss 	NULL,		/* PSC0, selected by S6.8 */
7777c4b24daSManuel Lauss 	&db1200_ide_dev,
7787c4b24daSManuel Lauss 	&db1200_mmc0_dev,
7797c4b24daSManuel Lauss 	&au1200_lcd_dev,
7807c4b24daSManuel Lauss 	&db1200_eth_dev,
7817c4b24daSManuel Lauss 	&db1200_nand_dev,
7827c4b24daSManuel Lauss 	&db1200_audiodma_dev,
7837c4b24daSManuel Lauss 	&db1200_audio_dev,
7847c4b24daSManuel Lauss 	&db1200_stac_dev,
7857c4b24daSManuel Lauss 	&db1200_sound_dev,
7867c4b24daSManuel Lauss };
7877c4b24daSManuel Lauss 
7886f7c8623SManuel Lauss static struct platform_device *pb1200_devs[] __initdata = {
7896f7c8623SManuel Lauss 	&pb1200_mmc1_dev,
7906f7c8623SManuel Lauss };
7916f7c8623SManuel Lauss 
7926f7c8623SManuel Lauss /* Some peripheral base addresses differ on the PB1200 */
7936f7c8623SManuel Lauss static int __init pb1200_res_fixup(void)
7946f7c8623SManuel Lauss {
7956f7c8623SManuel Lauss 	/* CPLD Revs earlier than 4 cause problems */
7966f7c8623SManuel Lauss 	if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) {
7976f7c8623SManuel Lauss 		printk(KERN_ERR "WARNING!!!\n");
7986f7c8623SManuel Lauss 		printk(KERN_ERR "WARNING!!!\n");
7996f7c8623SManuel Lauss 		printk(KERN_ERR "PB1200 must be at CPLD rev 4. Please have\n");
8006f7c8623SManuel Lauss 		printk(KERN_ERR "the board updated to latest revisions.\n");
8016f7c8623SManuel Lauss 		printk(KERN_ERR "This software will not work reliably\n");
8026f7c8623SManuel Lauss 		printk(KERN_ERR "on anything older than CPLD rev 4.!\n");
8036f7c8623SManuel Lauss 		printk(KERN_ERR "WARNING!!!\n");
8046f7c8623SManuel Lauss 		printk(KERN_ERR "WARNING!!!\n");
8056f7c8623SManuel Lauss 		return 1;
8066f7c8623SManuel Lauss 	}
8076f7c8623SManuel Lauss 
8086f7c8623SManuel Lauss 	db1200_nand_res[0].start = PB1200_NAND_PHYS_ADDR;
8096f7c8623SManuel Lauss 	db1200_nand_res[0].end	 = PB1200_NAND_PHYS_ADDR + 0xff;
8106f7c8623SManuel Lauss 	db1200_ide_res[0].start = PB1200_IDE_PHYS_ADDR;
8116f7c8623SManuel Lauss 	db1200_ide_res[0].end	= PB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1;
8126f7c8623SManuel Lauss 	db1200_eth_res[0].start = PB1200_ETH_PHYS_ADDR;
8136f7c8623SManuel Lauss 	db1200_eth_res[0].end	= PB1200_ETH_PHYS_ADDR + 0xff;
8146f7c8623SManuel Lauss 	return 0;
8156f7c8623SManuel Lauss }
8166f7c8623SManuel Lauss 
817bd8510dfSManuel Lauss int __init db1200_dev_setup(void)
8187c4b24daSManuel Lauss {
8197c4b24daSManuel Lauss 	unsigned long pfc;
8207c4b24daSManuel Lauss 	unsigned short sw;
8216f7c8623SManuel Lauss 	int swapped, bid;
822*415e0fecSManuel Lauss 	struct clk *c;
8236f7c8623SManuel Lauss 
8246f7c8623SManuel Lauss 	bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
8256f7c8623SManuel Lauss 	if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
8266f7c8623SManuel Lauss 	    (bid == BCSR_WHOAMI_PB1200_DDR2)) {
8276f7c8623SManuel Lauss 		if (pb1200_res_fixup())
8286f7c8623SManuel Lauss 			return -ENODEV;
8296f7c8623SManuel Lauss 	}
8307c4b24daSManuel Lauss 
8317c4b24daSManuel Lauss 	/* GPIO7 is low-level triggered CPLD cascade */
8326f7c8623SManuel Lauss 	irq_set_irq_type(AU1200_GPIO7_INT, IRQ_TYPE_LEVEL_LOW);
8337c4b24daSManuel Lauss 	bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT);
8347c4b24daSManuel Lauss 
835*415e0fecSManuel Lauss 	/* SMBus/SPI on PSC0, Audio on PSC1 */
836*415e0fecSManuel Lauss 	pfc = alchemy_rdsys(AU1000_SYS_PINFUNC);
837*415e0fecSManuel Lauss 	pfc &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
838*415e0fecSManuel Lauss 	pfc &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B | SYS_PINFUNC_FS3);
839*415e0fecSManuel Lauss 	pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */
840*415e0fecSManuel Lauss 	alchemy_wrsys(pfc, AU1000_SYS_PINFUNC);
841*415e0fecSManuel Lauss 
842*415e0fecSManuel Lauss 	/* get 50MHz for I2C driver on PSC0 */
843*415e0fecSManuel Lauss 	c = clk_get(NULL, "psc0_intclk");
844*415e0fecSManuel Lauss 	if (!IS_ERR(c)) {
845*415e0fecSManuel Lauss 		pfc = clk_round_rate(c, 50000000);
846*415e0fecSManuel Lauss 		if ((pfc < 1) || (abs(50000000 - pfc) > 2500000))
847*415e0fecSManuel Lauss 			pr_warn("DB1200: cant get I2C close to 50MHz\n");
848*415e0fecSManuel Lauss 		else
849*415e0fecSManuel Lauss 			clk_set_rate(c, pfc);
850*415e0fecSManuel Lauss 		clk_put(c);
851*415e0fecSManuel Lauss 	}
852*415e0fecSManuel Lauss 
8537c4b24daSManuel Lauss 	/* insert/eject pairs: one of both is always screaming.	 To avoid
8547c4b24daSManuel Lauss 	 * issues they must not be automatically enabled when initially
8557c4b24daSManuel Lauss 	 * requested.
8567c4b24daSManuel Lauss 	 */
8577c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_SD0_INSERT_INT, IRQ_NOAUTOEN);
8587c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_SD0_EJECT_INT, IRQ_NOAUTOEN);
8597c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_PC0_INSERT_INT, IRQ_NOAUTOEN);
8607c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_PC0_EJECT_INT, IRQ_NOAUTOEN);
8617c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_PC1_INSERT_INT, IRQ_NOAUTOEN);
8627c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_PC1_EJECT_INT, IRQ_NOAUTOEN);
8637c4b24daSManuel Lauss 
8647c4b24daSManuel Lauss 	i2c_register_board_info(0, db1200_i2c_devs,
8657c4b24daSManuel Lauss 				ARRAY_SIZE(db1200_i2c_devs));
8667c4b24daSManuel Lauss 	spi_register_board_info(db1200_spi_devs,
8677c4b24daSManuel Lauss 				ARRAY_SIZE(db1200_i2c_devs));
8687c4b24daSManuel Lauss 
8697c4b24daSManuel Lauss 	/* SWITCHES:	S6.8 I2C/SPI selector  (OFF=I2C	 ON=SPI)
8707c4b24daSManuel Lauss 	 *		S6.7 AC97/I2S selector (OFF=AC97 ON=I2S)
8716f7c8623SManuel Lauss 	 *		or S12 on the PB1200.
8727c4b24daSManuel Lauss 	 */
8737c4b24daSManuel Lauss 
8747c4b24daSManuel Lauss 	/* NOTE: GPIO215 controls OTG VBUS supply.  In SPI mode however
8757c4b24daSManuel Lauss 	 * this pin is claimed by PSC0 (unused though, but pinmux doesn't
8767c4b24daSManuel Lauss 	 * allow to free it without crippling the SPI interface).
8777c4b24daSManuel Lauss 	 * As a result, in SPI mode, OTG simply won't work (PSC0 uses
8787c4b24daSManuel Lauss 	 * it as an input pin which is pulled high on the boards).
8797c4b24daSManuel Lauss 	 */
8801d09de7dSManuel Lauss 	pfc = alchemy_rdsys(AU1000_SYS_PINFUNC) & ~SYS_PINFUNC_P0A;
8817c4b24daSManuel Lauss 
8827c4b24daSManuel Lauss 	/* switch off OTG VBUS supply */
8837c4b24daSManuel Lauss 	gpio_request(215, "otg-vbus");
8847c4b24daSManuel Lauss 	gpio_direction_output(215, 1);
8857c4b24daSManuel Lauss 
886bd8510dfSManuel Lauss 	printk(KERN_INFO "%s device configuration:\n", get_system_type());
8877c4b24daSManuel Lauss 
8887c4b24daSManuel Lauss 	sw = bcsr_read(BCSR_SWITCHES);
8897c4b24daSManuel Lauss 	if (sw & BCSR_SWITCHES_DIP_8) {
8907c4b24daSManuel Lauss 		db1200_devs[0] = &db1200_i2c_dev;
8917c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0);
8927c4b24daSManuel Lauss 
8937c4b24daSManuel Lauss 		pfc |= (2 << 17);	/* GPIO2 block owns GPIO215 */
8947c4b24daSManuel Lauss 
8957c4b24daSManuel Lauss 		printk(KERN_INFO " S6.8 OFF: PSC0 mode I2C\n");
8967c4b24daSManuel Lauss 		printk(KERN_INFO "   OTG port VBUS supply available!\n");
8977c4b24daSManuel Lauss 	} else {
8987c4b24daSManuel Lauss 		db1200_devs[0] = &db1200_spi_dev;
8997c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC0MUX);
9007c4b24daSManuel Lauss 
9017c4b24daSManuel Lauss 		pfc |= (1 << 17);	/* PSC0 owns GPIO215 */
9027c4b24daSManuel Lauss 
9037c4b24daSManuel Lauss 		printk(KERN_INFO " S6.8 ON : PSC0 mode SPI\n");
9047c4b24daSManuel Lauss 		printk(KERN_INFO "   OTG port VBUS supply disabled\n");
9057c4b24daSManuel Lauss 	}
9061d09de7dSManuel Lauss 	alchemy_wrsys(pfc, AU1000_SYS_PINFUNC);
9077c4b24daSManuel Lauss 
9087c4b24daSManuel Lauss 	/* Audio: DIP7 selects I2S(0)/AC97(1), but need I2C for I2S!
9097c4b24daSManuel Lauss 	 * so: DIP7=1 || DIP8=0 => AC97, DIP7=0 && DIP8=1 => I2S
9107c4b24daSManuel Lauss 	 */
9117c4b24daSManuel Lauss 	sw &= BCSR_SWITCHES_DIP_8 | BCSR_SWITCHES_DIP_7;
9127c4b24daSManuel Lauss 	if (sw == BCSR_SWITCHES_DIP_8) {
9137c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC1MUX);
9147c4b24daSManuel Lauss 		db1200_audio_dev.name = "au1xpsc_i2s";
9157c4b24daSManuel Lauss 		db1200_sound_dev.name = "db1200-i2s";
9167c4b24daSManuel Lauss 		printk(KERN_INFO " S6.7 ON : PSC1 mode I2S\n");
9177c4b24daSManuel Lauss 	} else {
9187c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC1MUX, 0);
9197c4b24daSManuel Lauss 		db1200_audio_dev.name = "au1xpsc_ac97";
9207c4b24daSManuel Lauss 		db1200_sound_dev.name = "db1200-ac97";
9217c4b24daSManuel Lauss 		printk(KERN_INFO " S6.7 OFF: PSC1 mode AC97\n");
9227c4b24daSManuel Lauss 	}
9237c4b24daSManuel Lauss 
9247c4b24daSManuel Lauss 	/* Audio PSC clock is supplied externally. (FIXME: platdata!!) */
925*415e0fecSManuel Lauss 	c = clk_get(NULL, "psc1_intclk");
926*415e0fecSManuel Lauss 	if (!IS_ERR(c)) {
927*415e0fecSManuel Lauss 		clk_prepare_enable(c);
928*415e0fecSManuel Lauss 		clk_put(c);
929*415e0fecSManuel Lauss 	}
9307c4b24daSManuel Lauss 	__raw_writel(PSC_SEL_CLK_SERCLK,
9317c4b24daSManuel Lauss 	    (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
9327c4b24daSManuel Lauss 	wmb();
9337c4b24daSManuel Lauss 
9347c4b24daSManuel Lauss 	db1x_register_pcmcia_socket(
9357c4b24daSManuel Lauss 		AU1000_PCMCIA_ATTR_PHYS_ADDR,
9367c4b24daSManuel Lauss 		AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
9377c4b24daSManuel Lauss 		AU1000_PCMCIA_MEM_PHYS_ADDR,
9387c4b24daSManuel Lauss 		AU1000_PCMCIA_MEM_PHYS_ADDR  + 0x000400000 - 1,
9397c4b24daSManuel Lauss 		AU1000_PCMCIA_IO_PHYS_ADDR,
9407c4b24daSManuel Lauss 		AU1000_PCMCIA_IO_PHYS_ADDR   + 0x000010000 - 1,
9417c4b24daSManuel Lauss 		DB1200_PC0_INT, DB1200_PC0_INSERT_INT,
9427c4b24daSManuel Lauss 		/*DB1200_PC0_STSCHG_INT*/0, DB1200_PC0_EJECT_INT, 0);
9437c4b24daSManuel Lauss 
9447c4b24daSManuel Lauss 	db1x_register_pcmcia_socket(
9457c4b24daSManuel Lauss 		AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000,
9467c4b24daSManuel Lauss 		AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1,
9477c4b24daSManuel Lauss 		AU1000_PCMCIA_MEM_PHYS_ADDR  + 0x004000000,
9487c4b24daSManuel Lauss 		AU1000_PCMCIA_MEM_PHYS_ADDR  + 0x004400000 - 1,
9497c4b24daSManuel Lauss 		AU1000_PCMCIA_IO_PHYS_ADDR   + 0x004000000,
9507c4b24daSManuel Lauss 		AU1000_PCMCIA_IO_PHYS_ADDR   + 0x004010000 - 1,
9517c4b24daSManuel Lauss 		DB1200_PC1_INT, DB1200_PC1_INSERT_INT,
9527c4b24daSManuel Lauss 		/*DB1200_PC1_STSCHG_INT*/0, DB1200_PC1_EJECT_INT, 1);
9537c4b24daSManuel Lauss 
9547c4b24daSManuel Lauss 	swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT;
9557c4b24daSManuel Lauss 	db1x_register_norflash(64 << 20, 2, swapped);
9567c4b24daSManuel Lauss 
9576f7c8623SManuel Lauss 	platform_add_devices(db1200_devs, ARRAY_SIZE(db1200_devs));
9586f7c8623SManuel Lauss 
9596f7c8623SManuel Lauss 	/* PB1200 is a DB1200 with a 2nd MMC and Camera connector */
9606f7c8623SManuel Lauss 	if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
9616f7c8623SManuel Lauss 	    (bid == BCSR_WHOAMI_PB1200_DDR2))
9626f7c8623SManuel Lauss 		platform_add_devices(pb1200_devs, ARRAY_SIZE(pb1200_devs));
9636f7c8623SManuel Lauss 
9646f7c8623SManuel Lauss 	return 0;
9657c4b24daSManuel Lauss }
966