xref: /linux/arch/mips/alchemy/devboards/db1200.c (revision a16afa53277a961799130ab9189c84adc2d0467e)
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 
217c4b24daSManuel Lauss #include <linux/dma-mapping.h>
227c4b24daSManuel Lauss #include <linux/gpio.h>
237c4b24daSManuel Lauss #include <linux/i2c.h>
247c4b24daSManuel Lauss #include <linux/init.h>
25f9ded569SPaul Gortmaker #include <linux/module.h>
267c4b24daSManuel Lauss #include <linux/interrupt.h>
277c4b24daSManuel Lauss #include <linux/io.h>
287c4b24daSManuel Lauss #include <linux/leds.h>
297c4b24daSManuel Lauss #include <linux/mmc/host.h>
307c4b24daSManuel Lauss #include <linux/mtd/mtd.h>
317c4b24daSManuel Lauss #include <linux/mtd/nand.h>
327c4b24daSManuel Lauss #include <linux/mtd/partitions.h>
337c4b24daSManuel Lauss #include <linux/platform_device.h>
347c4b24daSManuel Lauss #include <linux/serial_8250.h>
357c4b24daSManuel Lauss #include <linux/spi/spi.h>
367c4b24daSManuel Lauss #include <linux/spi/flash.h>
377c4b24daSManuel Lauss #include <linux/smc91x.h>
387c4b24daSManuel Lauss #include <asm/mach-au1x00/au1000.h>
397c4b24daSManuel Lauss #include <asm/mach-au1x00/au1100_mmc.h>
407c4b24daSManuel Lauss #include <asm/mach-au1x00/au1xxx_dbdma.h>
41*a16afa53SManuel Lauss #include <asm/mach-au1x00/au1xxx_psc.h>
42a9b71a8fSManuel Lauss #include <asm/mach-au1x00/au1200fb.h>
437c4b24daSManuel Lauss #include <asm/mach-au1x00/au1550_spi.h>
447c4b24daSManuel Lauss #include <asm/mach-db1x00/bcsr.h>
457c4b24daSManuel Lauss 
467c4b24daSManuel Lauss #include "platform.h"
477c4b24daSManuel Lauss 
48*a16afa53SManuel Lauss #define BCSR_INT_IDE		0x0001
49*a16afa53SManuel Lauss #define BCSR_INT_ETH		0x0002
50*a16afa53SManuel Lauss #define BCSR_INT_PC0		0x0004
51*a16afa53SManuel Lauss #define BCSR_INT_PC0STSCHG	0x0008
52*a16afa53SManuel Lauss #define BCSR_INT_PC1		0x0010
53*a16afa53SManuel Lauss #define BCSR_INT_PC1STSCHG	0x0020
54*a16afa53SManuel Lauss #define BCSR_INT_DC		0x0040
55*a16afa53SManuel Lauss #define BCSR_INT_FLASHBUSY	0x0080
56*a16afa53SManuel Lauss #define BCSR_INT_PC0INSERT	0x0100
57*a16afa53SManuel Lauss #define BCSR_INT_PC0EJECT	0x0200
58*a16afa53SManuel Lauss #define BCSR_INT_PC1INSERT	0x0400
59*a16afa53SManuel Lauss #define BCSR_INT_PC1EJECT	0x0800
60*a16afa53SManuel Lauss #define BCSR_INT_SD0INSERT	0x1000
61*a16afa53SManuel Lauss #define BCSR_INT_SD0EJECT	0x2000
62*a16afa53SManuel Lauss #define BCSR_INT_SD1INSERT	0x4000
63*a16afa53SManuel Lauss #define BCSR_INT_SD1EJECT	0x8000
64*a16afa53SManuel Lauss 
65*a16afa53SManuel Lauss #define DB1200_IDE_PHYS_ADDR	0x18800000
66*a16afa53SManuel Lauss #define DB1200_IDE_REG_SHIFT	5
67*a16afa53SManuel Lauss #define DB1200_IDE_PHYS_LEN	(16 << DB1200_IDE_REG_SHIFT)
68*a16afa53SManuel Lauss #define DB1200_ETH_PHYS_ADDR	0x19000300
69*a16afa53SManuel Lauss #define DB1200_NAND_PHYS_ADDR	0x20000000
70*a16afa53SManuel Lauss 
71*a16afa53SManuel Lauss #define PB1200_IDE_PHYS_ADDR	0x0C800000
72*a16afa53SManuel Lauss #define PB1200_ETH_PHYS_ADDR	0x0D000300
73*a16afa53SManuel Lauss #define PB1200_NAND_PHYS_ADDR	0x1C000000
74*a16afa53SManuel Lauss 
75*a16afa53SManuel Lauss #define DB1200_INT_BEGIN	(AU1000_MAX_INTR + 1)
76*a16afa53SManuel Lauss #define DB1200_IDE_INT		(DB1200_INT_BEGIN + 0)
77*a16afa53SManuel Lauss #define DB1200_ETH_INT		(DB1200_INT_BEGIN + 1)
78*a16afa53SManuel Lauss #define DB1200_PC0_INT		(DB1200_INT_BEGIN + 2)
79*a16afa53SManuel Lauss #define DB1200_PC0_STSCHG_INT	(DB1200_INT_BEGIN + 3)
80*a16afa53SManuel Lauss #define DB1200_PC1_INT		(DB1200_INT_BEGIN + 4)
81*a16afa53SManuel Lauss #define DB1200_PC1_STSCHG_INT	(DB1200_INT_BEGIN + 5)
82*a16afa53SManuel Lauss #define DB1200_DC_INT		(DB1200_INT_BEGIN + 6)
83*a16afa53SManuel Lauss #define DB1200_FLASHBUSY_INT	(DB1200_INT_BEGIN + 7)
84*a16afa53SManuel Lauss #define DB1200_PC0_INSERT_INT	(DB1200_INT_BEGIN + 8)
85*a16afa53SManuel Lauss #define DB1200_PC0_EJECT_INT	(DB1200_INT_BEGIN + 9)
86*a16afa53SManuel Lauss #define DB1200_PC1_INSERT_INT	(DB1200_INT_BEGIN + 10)
87*a16afa53SManuel Lauss #define DB1200_PC1_EJECT_INT	(DB1200_INT_BEGIN + 11)
88*a16afa53SManuel Lauss #define DB1200_SD0_INSERT_INT	(DB1200_INT_BEGIN + 12)
89*a16afa53SManuel Lauss #define DB1200_SD0_EJECT_INT	(DB1200_INT_BEGIN + 13)
90*a16afa53SManuel Lauss #define PB1200_SD1_INSERT_INT	(DB1200_INT_BEGIN + 14)
91*a16afa53SManuel Lauss #define PB1200_SD1_EJECT_INT	(DB1200_INT_BEGIN + 15)
92*a16afa53SManuel Lauss #define DB1200_INT_END		(DB1200_INT_BEGIN + 15)
93*a16afa53SManuel Lauss 
94bd8510dfSManuel Lauss const char *get_system_type(void);
957c4b24daSManuel Lauss 
96bd8510dfSManuel Lauss static int __init db1200_detect_board(void)
976f7c8623SManuel Lauss {
986f7c8623SManuel Lauss 	int bid;
996f7c8623SManuel Lauss 
100f2711be0SManuel Lauss 	/* try the DB1200 first */
101f2711be0SManuel Lauss 	bcsr_init(DB1200_BCSR_PHYS_ADDR,
102f2711be0SManuel Lauss 		  DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS);
103f2711be0SManuel Lauss 	if (BCSR_WHOAMI_DB1200 == BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
104f2711be0SManuel Lauss 		unsigned short t = bcsr_read(BCSR_HEXLEDS);
105f2711be0SManuel Lauss 		bcsr_write(BCSR_HEXLEDS, ~t);
106f2711be0SManuel Lauss 		if (bcsr_read(BCSR_HEXLEDS) != t) {
107f2711be0SManuel Lauss 			bcsr_write(BCSR_HEXLEDS, t);
108f2711be0SManuel Lauss 			return 0;
109f2711be0SManuel Lauss 		}
110f2711be0SManuel Lauss 	}
111f2711be0SManuel Lauss 
112f2711be0SManuel Lauss 	/* okay, try the PB1200 then */
1136f7c8623SManuel Lauss 	bcsr_init(PB1200_BCSR_PHYS_ADDR,
1146f7c8623SManuel Lauss 		  PB1200_BCSR_PHYS_ADDR + PB1200_BCSR_HEXLED_OFS);
1156f7c8623SManuel Lauss 	bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
1166f7c8623SManuel Lauss 	if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
117f2711be0SManuel Lauss 	    (bid == BCSR_WHOAMI_PB1200_DDR2)) {
118f2711be0SManuel Lauss 		unsigned short t = bcsr_read(BCSR_HEXLEDS);
119f2711be0SManuel Lauss 		bcsr_write(BCSR_HEXLEDS, ~t);
120f2711be0SManuel Lauss 		if (bcsr_read(BCSR_HEXLEDS) != t) {
121f2711be0SManuel Lauss 			bcsr_write(BCSR_HEXLEDS, t);
1226f7c8623SManuel Lauss 			return 0;
123f2711be0SManuel Lauss 		}
124f2711be0SManuel Lauss 	}
1256f7c8623SManuel Lauss 
126f2711be0SManuel Lauss 	return 1;	/* it's neither */
1277c4b24daSManuel Lauss }
1287c4b24daSManuel Lauss 
129bd8510dfSManuel Lauss int __init db1200_board_setup(void)
1307c4b24daSManuel Lauss {
1317c4b24daSManuel Lauss 	unsigned long freq0, clksrc, div, pfc;
1327c4b24daSManuel Lauss 	unsigned short whoami;
1337c4b24daSManuel Lauss 
134bd8510dfSManuel Lauss 	if (db1200_detect_board())
135bd8510dfSManuel Lauss 		return -ENODEV;
1367c4b24daSManuel Lauss 
1377c4b24daSManuel Lauss 	whoami = bcsr_read(BCSR_WHOAMI);
138970e268dSManuel Lauss 	switch (BCSR_WHOAMI_BOARD(whoami)) {
139970e268dSManuel Lauss 	case BCSR_WHOAMI_PB1200_DDR1:
140970e268dSManuel Lauss 	case BCSR_WHOAMI_PB1200_DDR2:
141970e268dSManuel Lauss 	case BCSR_WHOAMI_DB1200:
142970e268dSManuel Lauss 		break;
143970e268dSManuel Lauss 	default:
144970e268dSManuel Lauss 		return -ENODEV;
145970e268dSManuel Lauss 	}
146970e268dSManuel Lauss 
1476f7c8623SManuel Lauss 	printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d"
148bd8510dfSManuel Lauss 		"  Board-ID %d	Daughtercard ID %d\n", get_system_type(),
1497c4b24daSManuel Lauss 		(whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);
1507c4b24daSManuel Lauss 
1517c4b24daSManuel Lauss 	/* SMBus/SPI on PSC0, Audio on PSC1 */
1527c4b24daSManuel Lauss 	pfc = __raw_readl((void __iomem *)SYS_PINFUNC);
1537c4b24daSManuel Lauss 	pfc &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
1547c4b24daSManuel Lauss 	pfc &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B | SYS_PINFUNC_FS3);
1557c4b24daSManuel Lauss 	pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */
1567c4b24daSManuel Lauss 	__raw_writel(pfc, (void __iomem *)SYS_PINFUNC);
1577c4b24daSManuel Lauss 	wmb();
1587c4b24daSManuel Lauss 
1597c4b24daSManuel Lauss 	/* Clock configurations: PSC0: ~50MHz via Clkgen0, derived from
1607c4b24daSManuel Lauss 	 * CPU clock; all other clock generators off/unused.
1617c4b24daSManuel Lauss 	 */
1627c4b24daSManuel Lauss 	div = (get_au1x00_speed() + 25000000) / 50000000;
1637c4b24daSManuel Lauss 	if (div & 1)
1647c4b24daSManuel Lauss 		div++;
1657c4b24daSManuel Lauss 	div = ((div >> 1) - 1) & 0xff;
1667c4b24daSManuel Lauss 
1677c4b24daSManuel Lauss 	freq0 = div << SYS_FC_FRDIV0_BIT;
1687c4b24daSManuel Lauss 	__raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0);
1697c4b24daSManuel Lauss 	wmb();
1707c4b24daSManuel Lauss 	freq0 |= SYS_FC_FE0;	/* enable F0 */
1717c4b24daSManuel Lauss 	__raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0);
1727c4b24daSManuel Lauss 	wmb();
1737c4b24daSManuel Lauss 
1747c4b24daSManuel Lauss 	/* psc0_intclk comes 1:1 from F0 */
1757c4b24daSManuel Lauss 	clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT;
1767c4b24daSManuel Lauss 	__raw_writel(clksrc, (void __iomem *)SYS_CLKSRC);
1777c4b24daSManuel Lauss 	wmb();
178bd8510dfSManuel Lauss 
179bd8510dfSManuel Lauss 	return 0;
1807c4b24daSManuel Lauss }
1817c4b24daSManuel Lauss 
1827c4b24daSManuel Lauss /******************************************************************************/
1837c4b24daSManuel Lauss 
1847c4b24daSManuel Lauss static struct mtd_partition db1200_spiflash_parts[] = {
1857c4b24daSManuel Lauss 	{
1866f7c8623SManuel Lauss 		.name	= "spi_flash",
1877c4b24daSManuel Lauss 		.offset = 0,
1887c4b24daSManuel Lauss 		.size	= MTDPART_SIZ_FULL,
1897c4b24daSManuel Lauss 	},
1907c4b24daSManuel Lauss };
1917c4b24daSManuel Lauss 
1927c4b24daSManuel Lauss static struct flash_platform_data db1200_spiflash_data = {
1937c4b24daSManuel Lauss 	.name		= "s25fl001",
1947c4b24daSManuel Lauss 	.parts		= db1200_spiflash_parts,
1957c4b24daSManuel Lauss 	.nr_parts	= ARRAY_SIZE(db1200_spiflash_parts),
1967c4b24daSManuel Lauss 	.type		= "m25p10",
1977c4b24daSManuel Lauss };
1987c4b24daSManuel Lauss 
1997c4b24daSManuel Lauss static struct spi_board_info db1200_spi_devs[] __initdata = {
2007c4b24daSManuel Lauss 	{
2017c4b24daSManuel Lauss 		/* TI TMP121AIDBVR temp sensor */
2027c4b24daSManuel Lauss 		.modalias	= "tmp121",
2037c4b24daSManuel Lauss 		.max_speed_hz	= 2000000,
2047c4b24daSManuel Lauss 		.bus_num	= 0,
2057c4b24daSManuel Lauss 		.chip_select	= 0,
2067c4b24daSManuel Lauss 		.mode		= 0,
2077c4b24daSManuel Lauss 	},
2087c4b24daSManuel Lauss 	{
2097c4b24daSManuel Lauss 		/* Spansion S25FL001D0FMA SPI flash */
2107c4b24daSManuel Lauss 		.modalias	= "m25p80",
2117c4b24daSManuel Lauss 		.max_speed_hz	= 50000000,
2127c4b24daSManuel Lauss 		.bus_num	= 0,
2137c4b24daSManuel Lauss 		.chip_select	= 1,
2147c4b24daSManuel Lauss 		.mode		= 0,
2157c4b24daSManuel Lauss 		.platform_data	= &db1200_spiflash_data,
2167c4b24daSManuel Lauss 	},
2177c4b24daSManuel Lauss };
2187c4b24daSManuel Lauss 
2197c4b24daSManuel Lauss static struct i2c_board_info db1200_i2c_devs[] __initdata = {
2207c4b24daSManuel Lauss 	{ I2C_BOARD_INFO("24c04", 0x52),  }, /* AT24C04-10 I2C eeprom */
2217c4b24daSManuel Lauss 	{ I2C_BOARD_INFO("ne1619", 0x2d), }, /* adm1025-compat hwmon */
2227c4b24daSManuel Lauss 	{ I2C_BOARD_INFO("wm8731", 0x1b), }, /* I2S audio codec WM8731 */
2237c4b24daSManuel Lauss };
2247c4b24daSManuel Lauss 
2257c4b24daSManuel Lauss /**********************************************************************/
2267c4b24daSManuel Lauss 
2277c4b24daSManuel Lauss static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
2287c4b24daSManuel Lauss 				 unsigned int ctrl)
2297c4b24daSManuel Lauss {
2307c4b24daSManuel Lauss 	struct nand_chip *this = mtd->priv;
2317c4b24daSManuel Lauss 	unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
2327c4b24daSManuel Lauss 
2337c4b24daSManuel Lauss 	ioaddr &= 0xffffff00;
2347c4b24daSManuel Lauss 
2357c4b24daSManuel Lauss 	if (ctrl & NAND_CLE) {
2367c4b24daSManuel Lauss 		ioaddr += MEM_STNAND_CMD;
2377c4b24daSManuel Lauss 	} else if (ctrl & NAND_ALE) {
2387c4b24daSManuel Lauss 		ioaddr += MEM_STNAND_ADDR;
2397c4b24daSManuel Lauss 	} else {
2407c4b24daSManuel Lauss 		/* assume we want to r/w real data  by default */
2417c4b24daSManuel Lauss 		ioaddr += MEM_STNAND_DATA;
2427c4b24daSManuel Lauss 	}
2437c4b24daSManuel Lauss 	this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
2447c4b24daSManuel Lauss 	if (cmd != NAND_CMD_NONE) {
2457c4b24daSManuel Lauss 		__raw_writeb(cmd, this->IO_ADDR_W);
2467c4b24daSManuel Lauss 		wmb();
2477c4b24daSManuel Lauss 	}
2487c4b24daSManuel Lauss }
2497c4b24daSManuel Lauss 
2507c4b24daSManuel Lauss static int au1200_nand_device_ready(struct mtd_info *mtd)
2517c4b24daSManuel Lauss {
2527c4b24daSManuel Lauss 	return __raw_readl((void __iomem *)MEM_STSTAT) & 1;
2537c4b24daSManuel Lauss }
2547c4b24daSManuel Lauss 
2557c4b24daSManuel Lauss static struct mtd_partition db1200_nand_parts[] = {
2567c4b24daSManuel Lauss 	{
2577c4b24daSManuel Lauss 		.name	= "NAND FS 0",
2587c4b24daSManuel Lauss 		.offset = 0,
2597c4b24daSManuel Lauss 		.size	= 8 * 1024 * 1024,
2607c4b24daSManuel Lauss 	},
2617c4b24daSManuel Lauss 	{
2627c4b24daSManuel Lauss 		.name	= "NAND FS 1",
2637c4b24daSManuel Lauss 		.offset = MTDPART_OFS_APPEND,
2647c4b24daSManuel Lauss 		.size	= MTDPART_SIZ_FULL
2657c4b24daSManuel Lauss 	},
2667c4b24daSManuel Lauss };
2677c4b24daSManuel Lauss 
2687c4b24daSManuel Lauss struct platform_nand_data db1200_nand_platdata = {
2697c4b24daSManuel Lauss 	.chip = {
2707c4b24daSManuel Lauss 		.nr_chips	= 1,
2717c4b24daSManuel Lauss 		.chip_offset	= 0,
2727c4b24daSManuel Lauss 		.nr_partitions	= ARRAY_SIZE(db1200_nand_parts),
2737c4b24daSManuel Lauss 		.partitions	= db1200_nand_parts,
2747c4b24daSManuel Lauss 		.chip_delay	= 20,
2757c4b24daSManuel Lauss 	},
2767c4b24daSManuel Lauss 	.ctrl = {
2777c4b24daSManuel Lauss 		.dev_ready	= au1200_nand_device_ready,
2787c4b24daSManuel Lauss 		.cmd_ctrl	= au1200_nand_cmd_ctrl,
2797c4b24daSManuel Lauss 	},
2807c4b24daSManuel Lauss };
2817c4b24daSManuel Lauss 
2827c4b24daSManuel Lauss static struct resource db1200_nand_res[] = {
2837c4b24daSManuel Lauss 	[0] = {
2847c4b24daSManuel Lauss 		.start	= DB1200_NAND_PHYS_ADDR,
2857c4b24daSManuel Lauss 		.end	= DB1200_NAND_PHYS_ADDR + 0xff,
2867c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
2877c4b24daSManuel Lauss 	},
2887c4b24daSManuel Lauss };
2897c4b24daSManuel Lauss 
2907c4b24daSManuel Lauss static struct platform_device db1200_nand_dev = {
2917c4b24daSManuel Lauss 	.name		= "gen_nand",
2927c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(db1200_nand_res),
2937c4b24daSManuel Lauss 	.resource	= db1200_nand_res,
2947c4b24daSManuel Lauss 	.id		= -1,
2957c4b24daSManuel Lauss 	.dev		= {
2967c4b24daSManuel Lauss 		.platform_data = &db1200_nand_platdata,
2977c4b24daSManuel Lauss 	}
2987c4b24daSManuel Lauss };
2997c4b24daSManuel Lauss 
3007c4b24daSManuel Lauss /**********************************************************************/
3017c4b24daSManuel Lauss 
3027c4b24daSManuel Lauss static struct smc91x_platdata db1200_eth_data = {
3037c4b24daSManuel Lauss 	.flags	= SMC91X_NOWAIT | SMC91X_USE_16BIT,
3047c4b24daSManuel Lauss 	.leda	= RPC_LED_100_10,
3057c4b24daSManuel Lauss 	.ledb	= RPC_LED_TX_RX,
3067c4b24daSManuel Lauss };
3077c4b24daSManuel Lauss 
3087c4b24daSManuel Lauss static struct resource db1200_eth_res[] = {
3097c4b24daSManuel Lauss 	[0] = {
3107c4b24daSManuel Lauss 		.start	= DB1200_ETH_PHYS_ADDR,
3117c4b24daSManuel Lauss 		.end	= DB1200_ETH_PHYS_ADDR + 0xf,
3127c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
3137c4b24daSManuel Lauss 	},
3147c4b24daSManuel Lauss 	[1] = {
3157c4b24daSManuel Lauss 		.start	= DB1200_ETH_INT,
3167c4b24daSManuel Lauss 		.end	= DB1200_ETH_INT,
3177c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
3187c4b24daSManuel Lauss 	},
3197c4b24daSManuel Lauss };
3207c4b24daSManuel Lauss 
3217c4b24daSManuel Lauss static struct platform_device db1200_eth_dev = {
3227c4b24daSManuel Lauss 	.dev	= {
3237c4b24daSManuel Lauss 		.platform_data	= &db1200_eth_data,
3247c4b24daSManuel Lauss 	},
3257c4b24daSManuel Lauss 	.name		= "smc91x",
3267c4b24daSManuel Lauss 	.id		= -1,
3277c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(db1200_eth_res),
3287c4b24daSManuel Lauss 	.resource	= db1200_eth_res,
3297c4b24daSManuel Lauss };
3307c4b24daSManuel Lauss 
3317c4b24daSManuel Lauss /**********************************************************************/
3327c4b24daSManuel Lauss 
3337c4b24daSManuel Lauss static struct resource db1200_ide_res[] = {
3347c4b24daSManuel Lauss 	[0] = {
3357c4b24daSManuel Lauss 		.start	= DB1200_IDE_PHYS_ADDR,
3367c4b24daSManuel Lauss 		.end	= DB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1,
3377c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
3387c4b24daSManuel Lauss 	},
3397c4b24daSManuel Lauss 	[1] = {
3407c4b24daSManuel Lauss 		.start	= DB1200_IDE_INT,
3417c4b24daSManuel Lauss 		.end	= DB1200_IDE_INT,
3427c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
3437c4b24daSManuel Lauss 	},
3447c4b24daSManuel Lauss 	[2] = {
3457c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_DMA_REQ1,
3467c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_DMA_REQ1,
3477c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
3487c4b24daSManuel Lauss 	},
3497c4b24daSManuel Lauss };
3507c4b24daSManuel Lauss 
3517c4b24daSManuel Lauss static u64 au1200_ide_dmamask = DMA_BIT_MASK(32);
3527c4b24daSManuel Lauss 
3537c4b24daSManuel Lauss static struct platform_device db1200_ide_dev = {
3547c4b24daSManuel Lauss 	.name		= "au1200-ide",
3557c4b24daSManuel Lauss 	.id		= 0,
3567c4b24daSManuel Lauss 	.dev = {
3577c4b24daSManuel Lauss 		.dma_mask		= &au1200_ide_dmamask,
3587c4b24daSManuel Lauss 		.coherent_dma_mask	= DMA_BIT_MASK(32),
3597c4b24daSManuel Lauss 	},
3607c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(db1200_ide_res),
3617c4b24daSManuel Lauss 	.resource	= db1200_ide_res,
3627c4b24daSManuel Lauss };
3637c4b24daSManuel Lauss 
3647c4b24daSManuel Lauss /**********************************************************************/
3657c4b24daSManuel Lauss 
3667c4b24daSManuel Lauss /* SD carddetects:  they're supposed to be edge-triggered, but ack
3677c4b24daSManuel Lauss  * doesn't seem to work (CPLD Rev 2).  Instead, the screaming one
3687c4b24daSManuel Lauss  * is disabled and its counterpart enabled.  The 500ms timeout is
3697c4b24daSManuel Lauss  * because the carddetect isn't debounced in hardware.
3707c4b24daSManuel Lauss  */
3717c4b24daSManuel Lauss static irqreturn_t db1200_mmc_cd(int irq, void *ptr)
3727c4b24daSManuel Lauss {
3737c4b24daSManuel Lauss 	void(*mmc_cd)(struct mmc_host *, unsigned long);
3747c4b24daSManuel Lauss 
3757c4b24daSManuel Lauss 	if (irq == DB1200_SD0_INSERT_INT) {
3767c4b24daSManuel Lauss 		disable_irq_nosync(DB1200_SD0_INSERT_INT);
3777c4b24daSManuel Lauss 		enable_irq(DB1200_SD0_EJECT_INT);
3787c4b24daSManuel Lauss 	} else {
3797c4b24daSManuel Lauss 		disable_irq_nosync(DB1200_SD0_EJECT_INT);
3807c4b24daSManuel Lauss 		enable_irq(DB1200_SD0_INSERT_INT);
3817c4b24daSManuel Lauss 	}
3827c4b24daSManuel Lauss 
3837c4b24daSManuel Lauss 	/* link against CONFIG_MMC=m */
3847c4b24daSManuel Lauss 	mmc_cd = symbol_get(mmc_detect_change);
3857c4b24daSManuel Lauss 	if (mmc_cd) {
3867c4b24daSManuel Lauss 		mmc_cd(ptr, msecs_to_jiffies(500));
3877c4b24daSManuel Lauss 		symbol_put(mmc_detect_change);
3887c4b24daSManuel Lauss 	}
3897c4b24daSManuel Lauss 
3907c4b24daSManuel Lauss 	return IRQ_HANDLED;
3917c4b24daSManuel Lauss }
3927c4b24daSManuel Lauss 
3937c4b24daSManuel Lauss static int db1200_mmc_cd_setup(void *mmc_host, int en)
3947c4b24daSManuel Lauss {
3957c4b24daSManuel Lauss 	int ret;
3967c4b24daSManuel Lauss 
3977c4b24daSManuel Lauss 	if (en) {
3987c4b24daSManuel Lauss 		ret = request_irq(DB1200_SD0_INSERT_INT, db1200_mmc_cd,
3997a5c3b8cSRalf Baechle 				  0, "sd_insert", mmc_host);
4007c4b24daSManuel Lauss 		if (ret)
4017c4b24daSManuel Lauss 			goto out;
4027c4b24daSManuel Lauss 
4037c4b24daSManuel Lauss 		ret = request_irq(DB1200_SD0_EJECT_INT, db1200_mmc_cd,
4047a5c3b8cSRalf Baechle 				  0, "sd_eject", mmc_host);
4057c4b24daSManuel Lauss 		if (ret) {
4067c4b24daSManuel Lauss 			free_irq(DB1200_SD0_INSERT_INT, mmc_host);
4077c4b24daSManuel Lauss 			goto out;
4087c4b24daSManuel Lauss 		}
4097c4b24daSManuel Lauss 
4107c4b24daSManuel Lauss 		if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT)
4117c4b24daSManuel Lauss 			enable_irq(DB1200_SD0_EJECT_INT);
4127c4b24daSManuel Lauss 		else
4137c4b24daSManuel Lauss 			enable_irq(DB1200_SD0_INSERT_INT);
4147c4b24daSManuel Lauss 
4157c4b24daSManuel Lauss 	} else {
4167c4b24daSManuel Lauss 		free_irq(DB1200_SD0_INSERT_INT, mmc_host);
4177c4b24daSManuel Lauss 		free_irq(DB1200_SD0_EJECT_INT, mmc_host);
4187c4b24daSManuel Lauss 	}
4197c4b24daSManuel Lauss 	ret = 0;
4207c4b24daSManuel Lauss out:
4217c4b24daSManuel Lauss 	return ret;
4227c4b24daSManuel Lauss }
4237c4b24daSManuel Lauss 
4247c4b24daSManuel Lauss static void db1200_mmc_set_power(void *mmc_host, int state)
4257c4b24daSManuel Lauss {
4267c4b24daSManuel Lauss 	if (state) {
4277c4b24daSManuel Lauss 		bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD0PWR);
4287c4b24daSManuel Lauss 		msleep(400);	/* stabilization time */
4297c4b24daSManuel Lauss 	} else
4307c4b24daSManuel Lauss 		bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD0PWR, 0);
4317c4b24daSManuel Lauss }
4327c4b24daSManuel Lauss 
4337c4b24daSManuel Lauss static int db1200_mmc_card_readonly(void *mmc_host)
4347c4b24daSManuel Lauss {
4357c4b24daSManuel Lauss 	return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 1 : 0;
4367c4b24daSManuel Lauss }
4377c4b24daSManuel Lauss 
4387c4b24daSManuel Lauss static int db1200_mmc_card_inserted(void *mmc_host)
4397c4b24daSManuel Lauss {
4407c4b24daSManuel Lauss 	return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT) ? 1 : 0;
4417c4b24daSManuel Lauss }
4427c4b24daSManuel Lauss 
4437c4b24daSManuel Lauss static void db1200_mmcled_set(struct led_classdev *led,
4447c4b24daSManuel Lauss 			      enum led_brightness brightness)
4457c4b24daSManuel Lauss {
4467c4b24daSManuel Lauss 	if (brightness != LED_OFF)
4477c4b24daSManuel Lauss 		bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0);
4487c4b24daSManuel Lauss 	else
4497c4b24daSManuel Lauss 		bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0);
4507c4b24daSManuel Lauss }
4517c4b24daSManuel Lauss 
4527c4b24daSManuel Lauss static struct led_classdev db1200_mmc_led = {
4537c4b24daSManuel Lauss 	.brightness_set = db1200_mmcled_set,
4547c4b24daSManuel Lauss };
4557c4b24daSManuel Lauss 
4566f7c8623SManuel Lauss /* -- */
4576f7c8623SManuel Lauss 
4586f7c8623SManuel Lauss static irqreturn_t pb1200_mmc1_cd(int irq, void *ptr)
4596f7c8623SManuel Lauss {
4606f7c8623SManuel Lauss 	void(*mmc_cd)(struct mmc_host *, unsigned long);
4616f7c8623SManuel Lauss 
4626f7c8623SManuel Lauss 	if (irq == PB1200_SD1_INSERT_INT) {
4636f7c8623SManuel Lauss 		disable_irq_nosync(PB1200_SD1_INSERT_INT);
4646f7c8623SManuel Lauss 		enable_irq(PB1200_SD1_EJECT_INT);
4656f7c8623SManuel Lauss 	} else {
4666f7c8623SManuel Lauss 		disable_irq_nosync(PB1200_SD1_EJECT_INT);
4676f7c8623SManuel Lauss 		enable_irq(PB1200_SD1_INSERT_INT);
4686f7c8623SManuel Lauss 	}
4696f7c8623SManuel Lauss 
4706f7c8623SManuel Lauss 	/* link against CONFIG_MMC=m */
4716f7c8623SManuel Lauss 	mmc_cd = symbol_get(mmc_detect_change);
4726f7c8623SManuel Lauss 	if (mmc_cd) {
4736f7c8623SManuel Lauss 		mmc_cd(ptr, msecs_to_jiffies(500));
4746f7c8623SManuel Lauss 		symbol_put(mmc_detect_change);
4756f7c8623SManuel Lauss 	}
4766f7c8623SManuel Lauss 
4776f7c8623SManuel Lauss 	return IRQ_HANDLED;
4786f7c8623SManuel Lauss }
4796f7c8623SManuel Lauss 
4806f7c8623SManuel Lauss static int pb1200_mmc1_cd_setup(void *mmc_host, int en)
4816f7c8623SManuel Lauss {
4826f7c8623SManuel Lauss 	int ret;
4836f7c8623SManuel Lauss 
4846f7c8623SManuel Lauss 	if (en) {
4856f7c8623SManuel Lauss 		ret = request_irq(PB1200_SD1_INSERT_INT, pb1200_mmc1_cd, 0,
4866f7c8623SManuel Lauss 				  "sd1_insert", mmc_host);
4876f7c8623SManuel Lauss 		if (ret)
4886f7c8623SManuel Lauss 			goto out;
4896f7c8623SManuel Lauss 
4906f7c8623SManuel Lauss 		ret = request_irq(PB1200_SD1_EJECT_INT, pb1200_mmc1_cd, 0,
4916f7c8623SManuel Lauss 				  "sd1_eject", mmc_host);
4926f7c8623SManuel Lauss 		if (ret) {
4936f7c8623SManuel Lauss 			free_irq(PB1200_SD1_INSERT_INT, mmc_host);
4946f7c8623SManuel Lauss 			goto out;
4956f7c8623SManuel Lauss 		}
4966f7c8623SManuel Lauss 
4976f7c8623SManuel Lauss 		if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT)
4986f7c8623SManuel Lauss 			enable_irq(PB1200_SD1_EJECT_INT);
4996f7c8623SManuel Lauss 		else
5006f7c8623SManuel Lauss 			enable_irq(PB1200_SD1_INSERT_INT);
5016f7c8623SManuel Lauss 
5026f7c8623SManuel Lauss 	} else {
5036f7c8623SManuel Lauss 		free_irq(PB1200_SD1_INSERT_INT, mmc_host);
5046f7c8623SManuel Lauss 		free_irq(PB1200_SD1_EJECT_INT, mmc_host);
5056f7c8623SManuel Lauss 	}
5066f7c8623SManuel Lauss 	ret = 0;
5076f7c8623SManuel Lauss out:
5086f7c8623SManuel Lauss 	return ret;
5096f7c8623SManuel Lauss }
5106f7c8623SManuel Lauss 
5116f7c8623SManuel Lauss static void pb1200_mmc1led_set(struct led_classdev *led,
5126f7c8623SManuel Lauss 			enum led_brightness brightness)
5136f7c8623SManuel Lauss {
5146f7c8623SManuel Lauss 	if (brightness != LED_OFF)
5156f7c8623SManuel Lauss 			bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED1, 0);
5166f7c8623SManuel Lauss 	else
5176f7c8623SManuel Lauss 			bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED1);
5186f7c8623SManuel Lauss }
5196f7c8623SManuel Lauss 
5206f7c8623SManuel Lauss static struct led_classdev pb1200_mmc1_led = {
5216f7c8623SManuel Lauss 	.brightness_set = pb1200_mmc1led_set,
5226f7c8623SManuel Lauss };
5236f7c8623SManuel Lauss 
5246f7c8623SManuel Lauss static void pb1200_mmc1_set_power(void *mmc_host, int state)
5256f7c8623SManuel Lauss {
5266f7c8623SManuel Lauss 	if (state) {
5276f7c8623SManuel Lauss 		bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD1PWR);
5286f7c8623SManuel Lauss 		msleep(400);	/* stabilization time */
5296f7c8623SManuel Lauss 	} else
5306f7c8623SManuel Lauss 		bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD1PWR, 0);
5316f7c8623SManuel Lauss }
5326f7c8623SManuel Lauss 
5336f7c8623SManuel Lauss static int pb1200_mmc1_card_readonly(void *mmc_host)
5346f7c8623SManuel Lauss {
5356f7c8623SManuel Lauss 	return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD1WP) ? 1 : 0;
5366f7c8623SManuel Lauss }
5376f7c8623SManuel Lauss 
5386f7c8623SManuel Lauss static int pb1200_mmc1_card_inserted(void *mmc_host)
5396f7c8623SManuel Lauss {
5406f7c8623SManuel Lauss 	return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT) ? 1 : 0;
5416f7c8623SManuel Lauss }
5426f7c8623SManuel Lauss 
5436f7c8623SManuel Lauss 
5446f7c8623SManuel Lauss static struct au1xmmc_platform_data db1200_mmc_platdata[2] = {
5456f7c8623SManuel Lauss 	[0] = {
5467c4b24daSManuel Lauss 		.cd_setup	= db1200_mmc_cd_setup,
5477c4b24daSManuel Lauss 		.set_power	= db1200_mmc_set_power,
5487c4b24daSManuel Lauss 		.card_inserted	= db1200_mmc_card_inserted,
5497c4b24daSManuel Lauss 		.card_readonly	= db1200_mmc_card_readonly,
5507c4b24daSManuel Lauss 		.led		= &db1200_mmc_led,
5516f7c8623SManuel Lauss 	},
5526f7c8623SManuel Lauss 	[1] = {
5536f7c8623SManuel Lauss 		.cd_setup	= pb1200_mmc1_cd_setup,
5546f7c8623SManuel Lauss 		.set_power	= pb1200_mmc1_set_power,
5556f7c8623SManuel Lauss 		.card_inserted	= pb1200_mmc1_card_inserted,
5566f7c8623SManuel Lauss 		.card_readonly	= pb1200_mmc1_card_readonly,
5576f7c8623SManuel Lauss 		.led		= &pb1200_mmc1_led,
5586f7c8623SManuel Lauss 	},
5597c4b24daSManuel Lauss };
5607c4b24daSManuel Lauss 
5617c4b24daSManuel Lauss static struct resource au1200_mmc0_resources[] = {
5627c4b24daSManuel Lauss 	[0] = {
5637c4b24daSManuel Lauss 		.start	= AU1100_SD0_PHYS_ADDR,
5647c4b24daSManuel Lauss 		.end	= AU1100_SD0_PHYS_ADDR + 0xfff,
5657c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
5667c4b24daSManuel Lauss 	},
5677c4b24daSManuel Lauss 	[1] = {
5687c4b24daSManuel Lauss 		.start	= AU1200_SD_INT,
5697c4b24daSManuel Lauss 		.end	= AU1200_SD_INT,
5707c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
5717c4b24daSManuel Lauss 	},
5727c4b24daSManuel Lauss 	[2] = {
5737c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_SDMS_TX0,
5747c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_SDMS_TX0,
5757c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
5767c4b24daSManuel Lauss 	},
5777c4b24daSManuel Lauss 	[3] = {
5787c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_SDMS_RX0,
5797c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_SDMS_RX0,
5807c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
5817c4b24daSManuel Lauss 	}
5827c4b24daSManuel Lauss };
5837c4b24daSManuel Lauss 
5847c4b24daSManuel Lauss static u64 au1xxx_mmc_dmamask =	 DMA_BIT_MASK(32);
5857c4b24daSManuel Lauss 
5867c4b24daSManuel Lauss static struct platform_device db1200_mmc0_dev = {
5877c4b24daSManuel Lauss 	.name		= "au1xxx-mmc",
5887c4b24daSManuel Lauss 	.id		= 0,
5897c4b24daSManuel Lauss 	.dev = {
5907c4b24daSManuel Lauss 		.dma_mask		= &au1xxx_mmc_dmamask,
5917c4b24daSManuel Lauss 		.coherent_dma_mask	= DMA_BIT_MASK(32),
5926f7c8623SManuel Lauss 		.platform_data		= &db1200_mmc_platdata[0],
5937c4b24daSManuel Lauss 	},
5947c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_mmc0_resources),
5957c4b24daSManuel Lauss 	.resource	= au1200_mmc0_resources,
5967c4b24daSManuel Lauss };
5977c4b24daSManuel Lauss 
5986f7c8623SManuel Lauss static struct resource au1200_mmc1_res[] = {
5996f7c8623SManuel Lauss 	[0] = {
6006f7c8623SManuel Lauss 		.start	= AU1100_SD1_PHYS_ADDR,
6016f7c8623SManuel Lauss 		.end	= AU1100_SD1_PHYS_ADDR + 0xfff,
6026f7c8623SManuel Lauss 		.flags	= IORESOURCE_MEM,
6036f7c8623SManuel Lauss 	},
6046f7c8623SManuel Lauss 	[1] = {
6056f7c8623SManuel Lauss 		.start	= AU1200_SD_INT,
6066f7c8623SManuel Lauss 		.end	= AU1200_SD_INT,
6076f7c8623SManuel Lauss 		.flags	= IORESOURCE_IRQ,
6086f7c8623SManuel Lauss 	},
6096f7c8623SManuel Lauss 	[2] = {
6106f7c8623SManuel Lauss 		.start	= AU1200_DSCR_CMD0_SDMS_TX1,
6116f7c8623SManuel Lauss 		.end	= AU1200_DSCR_CMD0_SDMS_TX1,
6126f7c8623SManuel Lauss 		.flags	= IORESOURCE_DMA,
6136f7c8623SManuel Lauss 	},
6146f7c8623SManuel Lauss 	[3] = {
6156f7c8623SManuel Lauss 		.start	= AU1200_DSCR_CMD0_SDMS_RX1,
6166f7c8623SManuel Lauss 		.end	= AU1200_DSCR_CMD0_SDMS_RX1,
6176f7c8623SManuel Lauss 		.flags	= IORESOURCE_DMA,
6186f7c8623SManuel Lauss 	}
6196f7c8623SManuel Lauss };
6206f7c8623SManuel Lauss 
6216f7c8623SManuel Lauss static struct platform_device pb1200_mmc1_dev = {
6226f7c8623SManuel Lauss 	.name		= "au1xxx-mmc",
6236f7c8623SManuel Lauss 	.id		= 1,
6246f7c8623SManuel Lauss 	.dev = {
6256f7c8623SManuel Lauss 		.dma_mask		= &au1xxx_mmc_dmamask,
6266f7c8623SManuel Lauss 		.coherent_dma_mask	= DMA_BIT_MASK(32),
6276f7c8623SManuel Lauss 		.platform_data		= &db1200_mmc_platdata[1],
6286f7c8623SManuel Lauss 	},
6296f7c8623SManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_mmc1_res),
6306f7c8623SManuel Lauss 	.resource	= au1200_mmc1_res,
6316f7c8623SManuel Lauss };
6326f7c8623SManuel Lauss 
6337c4b24daSManuel Lauss /**********************************************************************/
6347c4b24daSManuel Lauss 
635a9b71a8fSManuel Lauss static int db1200fb_panel_index(void)
636a9b71a8fSManuel Lauss {
637a9b71a8fSManuel Lauss 	return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
638a9b71a8fSManuel Lauss }
639a9b71a8fSManuel Lauss 
640a9b71a8fSManuel Lauss static int db1200fb_panel_init(void)
641a9b71a8fSManuel Lauss {
642a9b71a8fSManuel Lauss 	/* Apply power */
643a9b71a8fSManuel Lauss 	bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
644a9b71a8fSManuel Lauss 				BCSR_BOARD_LCDBL);
645a9b71a8fSManuel Lauss 	return 0;
646a9b71a8fSManuel Lauss }
647a9b71a8fSManuel Lauss 
648a9b71a8fSManuel Lauss static int db1200fb_panel_shutdown(void)
649a9b71a8fSManuel Lauss {
650a9b71a8fSManuel Lauss 	/* Remove power */
651a9b71a8fSManuel Lauss 	bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
652a9b71a8fSManuel Lauss 			     BCSR_BOARD_LCDBL, 0);
653a9b71a8fSManuel Lauss 	return 0;
654a9b71a8fSManuel Lauss }
655a9b71a8fSManuel Lauss 
656a9b71a8fSManuel Lauss static struct au1200fb_platdata db1200fb_pd = {
657a9b71a8fSManuel Lauss 	.panel_index	= db1200fb_panel_index,
658a9b71a8fSManuel Lauss 	.panel_init	= db1200fb_panel_init,
659a9b71a8fSManuel Lauss 	.panel_shutdown = db1200fb_panel_shutdown,
660a9b71a8fSManuel Lauss };
661a9b71a8fSManuel Lauss 
6627c4b24daSManuel Lauss static struct resource au1200_lcd_res[] = {
6637c4b24daSManuel Lauss 	[0] = {
6647c4b24daSManuel Lauss 		.start	= AU1200_LCD_PHYS_ADDR,
6657c4b24daSManuel Lauss 		.end	= AU1200_LCD_PHYS_ADDR + 0x800 - 1,
6667c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
6677c4b24daSManuel Lauss 	},
6687c4b24daSManuel Lauss 	[1] = {
6697c4b24daSManuel Lauss 		.start	= AU1200_LCD_INT,
6707c4b24daSManuel Lauss 		.end	= AU1200_LCD_INT,
6717c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
6727c4b24daSManuel Lauss 	}
6737c4b24daSManuel Lauss };
6747c4b24daSManuel Lauss 
6757c4b24daSManuel Lauss static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32);
6767c4b24daSManuel Lauss 
6777c4b24daSManuel Lauss static struct platform_device au1200_lcd_dev = {
6787c4b24daSManuel Lauss 	.name		= "au1200-lcd",
6797c4b24daSManuel Lauss 	.id		= 0,
6807c4b24daSManuel Lauss 	.dev = {
6817c4b24daSManuel Lauss 		.dma_mask		= &au1200_lcd_dmamask,
6827c4b24daSManuel Lauss 		.coherent_dma_mask	= DMA_BIT_MASK(32),
683a9b71a8fSManuel Lauss 		.platform_data		= &db1200fb_pd,
6847c4b24daSManuel Lauss 	},
6857c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_lcd_res),
6867c4b24daSManuel Lauss 	.resource	= au1200_lcd_res,
6877c4b24daSManuel Lauss };
6887c4b24daSManuel Lauss 
6897c4b24daSManuel Lauss /**********************************************************************/
6907c4b24daSManuel Lauss 
6917c4b24daSManuel Lauss static struct resource au1200_psc0_res[] = {
6927c4b24daSManuel Lauss 	[0] = {
6937c4b24daSManuel Lauss 		.start	= AU1550_PSC0_PHYS_ADDR,
6947c4b24daSManuel Lauss 		.end	= AU1550_PSC0_PHYS_ADDR + 0xfff,
6957c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
6967c4b24daSManuel Lauss 	},
6977c4b24daSManuel Lauss 	[1] = {
6987c4b24daSManuel Lauss 		.start	= AU1200_PSC0_INT,
6997c4b24daSManuel Lauss 		.end	= AU1200_PSC0_INT,
7007c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
7017c4b24daSManuel Lauss 	},
7027c4b24daSManuel Lauss 	[2] = {
7037c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_PSC0_TX,
7047c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_PSC0_TX,
7057c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
7067c4b24daSManuel Lauss 	},
7077c4b24daSManuel Lauss 	[3] = {
7087c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_PSC0_RX,
7097c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_PSC0_RX,
7107c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
7117c4b24daSManuel Lauss 	},
7127c4b24daSManuel Lauss };
7137c4b24daSManuel Lauss 
7147c4b24daSManuel Lauss static struct platform_device db1200_i2c_dev = {
7157c4b24daSManuel Lauss 	.name		= "au1xpsc_smbus",
7167c4b24daSManuel Lauss 	.id		= 0,	/* bus number */
7177c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_psc0_res),
7187c4b24daSManuel Lauss 	.resource	= au1200_psc0_res,
7197c4b24daSManuel Lauss };
7207c4b24daSManuel Lauss 
7217c4b24daSManuel Lauss static void db1200_spi_cs_en(struct au1550_spi_info *spi, int cs, int pol)
7227c4b24daSManuel Lauss {
7237c4b24daSManuel Lauss 	if (cs)
7247c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_SPISEL);
7257c4b24daSManuel Lauss 	else
7267c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, BCSR_RESETS_SPISEL, 0);
7277c4b24daSManuel Lauss }
7287c4b24daSManuel Lauss 
7297c4b24daSManuel Lauss static struct au1550_spi_info db1200_spi_platdata = {
7307c4b24daSManuel Lauss 	.mainclk_hz	= 50000000,	/* PSC0 clock */
7317c4b24daSManuel Lauss 	.num_chipselect = 2,
7327c4b24daSManuel Lauss 	.activate_cs	= db1200_spi_cs_en,
7337c4b24daSManuel Lauss };
7347c4b24daSManuel Lauss 
7357c4b24daSManuel Lauss static u64 spi_dmamask = DMA_BIT_MASK(32);
7367c4b24daSManuel Lauss 
7377c4b24daSManuel Lauss static struct platform_device db1200_spi_dev = {
7387c4b24daSManuel Lauss 	.dev	= {
7397c4b24daSManuel Lauss 		.dma_mask		= &spi_dmamask,
7407c4b24daSManuel Lauss 		.coherent_dma_mask	= DMA_BIT_MASK(32),
7417c4b24daSManuel Lauss 		.platform_data		= &db1200_spi_platdata,
7427c4b24daSManuel Lauss 	},
7437c4b24daSManuel Lauss 	.name		= "au1550-spi",
7447c4b24daSManuel Lauss 	.id		= 0,	/* bus number */
7457c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_psc0_res),
7467c4b24daSManuel Lauss 	.resource	= au1200_psc0_res,
7477c4b24daSManuel Lauss };
7487c4b24daSManuel Lauss 
7497c4b24daSManuel Lauss static struct resource au1200_psc1_res[] = {
7507c4b24daSManuel Lauss 	[0] = {
7517c4b24daSManuel Lauss 		.start	= AU1550_PSC1_PHYS_ADDR,
7527c4b24daSManuel Lauss 		.end	= AU1550_PSC1_PHYS_ADDR + 0xfff,
7537c4b24daSManuel Lauss 		.flags	= IORESOURCE_MEM,
7547c4b24daSManuel Lauss 	},
7557c4b24daSManuel Lauss 	[1] = {
7567c4b24daSManuel Lauss 		.start	= AU1200_PSC1_INT,
7577c4b24daSManuel Lauss 		.end	= AU1200_PSC1_INT,
7587c4b24daSManuel Lauss 		.flags	= IORESOURCE_IRQ,
7597c4b24daSManuel Lauss 	},
7607c4b24daSManuel Lauss 	[2] = {
7617c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_PSC1_TX,
7627c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_PSC1_TX,
7637c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
7647c4b24daSManuel Lauss 	},
7657c4b24daSManuel Lauss 	[3] = {
7667c4b24daSManuel Lauss 		.start	= AU1200_DSCR_CMD0_PSC1_RX,
7677c4b24daSManuel Lauss 		.end	= AU1200_DSCR_CMD0_PSC1_RX,
7687c4b24daSManuel Lauss 		.flags	= IORESOURCE_DMA,
7697c4b24daSManuel Lauss 	},
7707c4b24daSManuel Lauss };
7717c4b24daSManuel Lauss 
7727c4b24daSManuel Lauss /* AC97 or I2S device */
7737c4b24daSManuel Lauss static struct platform_device db1200_audio_dev = {
7747c4b24daSManuel Lauss 	/* name assigned later based on switch setting */
7757c4b24daSManuel Lauss 	.id		= 1,	/* PSC ID */
7767c4b24daSManuel Lauss 	.num_resources	= ARRAY_SIZE(au1200_psc1_res),
7777c4b24daSManuel Lauss 	.resource	= au1200_psc1_res,
7787c4b24daSManuel Lauss };
7797c4b24daSManuel Lauss 
7807c4b24daSManuel Lauss /* DB1200 ASoC card device */
7817c4b24daSManuel Lauss static struct platform_device db1200_sound_dev = {
7827c4b24daSManuel Lauss 	/* name assigned later based on switch setting */
7837c4b24daSManuel Lauss 	.id		= 1,	/* PSC ID */
7847c4b24daSManuel Lauss };
7857c4b24daSManuel Lauss 
7867c4b24daSManuel Lauss static struct platform_device db1200_stac_dev = {
7877c4b24daSManuel Lauss 	.name		= "ac97-codec",
7887c4b24daSManuel Lauss 	.id		= 1,	/* on PSC1 */
7897c4b24daSManuel Lauss };
7907c4b24daSManuel Lauss 
7917c4b24daSManuel Lauss static struct platform_device db1200_audiodma_dev = {
7927c4b24daSManuel Lauss 	.name		= "au1xpsc-pcm",
7937c4b24daSManuel Lauss 	.id		= 1,	/* PSC ID */
7947c4b24daSManuel Lauss };
7957c4b24daSManuel Lauss 
7967c4b24daSManuel Lauss static struct platform_device *db1200_devs[] __initdata = {
7977c4b24daSManuel Lauss 	NULL,		/* PSC0, selected by S6.8 */
7987c4b24daSManuel Lauss 	&db1200_ide_dev,
7997c4b24daSManuel Lauss 	&db1200_mmc0_dev,
8007c4b24daSManuel Lauss 	&au1200_lcd_dev,
8017c4b24daSManuel Lauss 	&db1200_eth_dev,
8027c4b24daSManuel Lauss 	&db1200_nand_dev,
8037c4b24daSManuel Lauss 	&db1200_audiodma_dev,
8047c4b24daSManuel Lauss 	&db1200_audio_dev,
8057c4b24daSManuel Lauss 	&db1200_stac_dev,
8067c4b24daSManuel Lauss 	&db1200_sound_dev,
8077c4b24daSManuel Lauss };
8087c4b24daSManuel Lauss 
8096f7c8623SManuel Lauss static struct platform_device *pb1200_devs[] __initdata = {
8106f7c8623SManuel Lauss 	&pb1200_mmc1_dev,
8116f7c8623SManuel Lauss };
8126f7c8623SManuel Lauss 
8136f7c8623SManuel Lauss /* Some peripheral base addresses differ on the PB1200 */
8146f7c8623SManuel Lauss static int __init pb1200_res_fixup(void)
8156f7c8623SManuel Lauss {
8166f7c8623SManuel Lauss 	/* CPLD Revs earlier than 4 cause problems */
8176f7c8623SManuel Lauss 	if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) {
8186f7c8623SManuel Lauss 		printk(KERN_ERR "WARNING!!!\n");
8196f7c8623SManuel Lauss 		printk(KERN_ERR "WARNING!!!\n");
8206f7c8623SManuel Lauss 		printk(KERN_ERR "PB1200 must be at CPLD rev 4. Please have\n");
8216f7c8623SManuel Lauss 		printk(KERN_ERR "the board updated to latest revisions.\n");
8226f7c8623SManuel Lauss 		printk(KERN_ERR "This software will not work reliably\n");
8236f7c8623SManuel Lauss 		printk(KERN_ERR "on anything older than CPLD rev 4.!\n");
8246f7c8623SManuel Lauss 		printk(KERN_ERR "WARNING!!!\n");
8256f7c8623SManuel Lauss 		printk(KERN_ERR "WARNING!!!\n");
8266f7c8623SManuel Lauss 		return 1;
8276f7c8623SManuel Lauss 	}
8286f7c8623SManuel Lauss 
8296f7c8623SManuel Lauss 	db1200_nand_res[0].start = PB1200_NAND_PHYS_ADDR;
8306f7c8623SManuel Lauss 	db1200_nand_res[0].end	 = PB1200_NAND_PHYS_ADDR + 0xff;
8316f7c8623SManuel Lauss 	db1200_ide_res[0].start = PB1200_IDE_PHYS_ADDR;
8326f7c8623SManuel Lauss 	db1200_ide_res[0].end	= PB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1;
8336f7c8623SManuel Lauss 	db1200_eth_res[0].start = PB1200_ETH_PHYS_ADDR;
8346f7c8623SManuel Lauss 	db1200_eth_res[0].end	= PB1200_ETH_PHYS_ADDR + 0xff;
8356f7c8623SManuel Lauss 	return 0;
8366f7c8623SManuel Lauss }
8376f7c8623SManuel Lauss 
838bd8510dfSManuel Lauss int __init db1200_dev_setup(void)
8397c4b24daSManuel Lauss {
8407c4b24daSManuel Lauss 	unsigned long pfc;
8417c4b24daSManuel Lauss 	unsigned short sw;
8426f7c8623SManuel Lauss 	int swapped, bid;
8436f7c8623SManuel Lauss 
8446f7c8623SManuel Lauss 	bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
8456f7c8623SManuel Lauss 	if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
8466f7c8623SManuel Lauss 	    (bid == BCSR_WHOAMI_PB1200_DDR2)) {
8476f7c8623SManuel Lauss 		if (pb1200_res_fixup())
8486f7c8623SManuel Lauss 			return -ENODEV;
8496f7c8623SManuel Lauss 	}
8507c4b24daSManuel Lauss 
8517c4b24daSManuel Lauss 	/* GPIO7 is low-level triggered CPLD cascade */
8526f7c8623SManuel Lauss 	irq_set_irq_type(AU1200_GPIO7_INT, IRQ_TYPE_LEVEL_LOW);
8537c4b24daSManuel Lauss 	bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT);
8547c4b24daSManuel Lauss 
8557c4b24daSManuel Lauss 	/* insert/eject pairs: one of both is always screaming.	 To avoid
8567c4b24daSManuel Lauss 	 * issues they must not be automatically enabled when initially
8577c4b24daSManuel Lauss 	 * requested.
8587c4b24daSManuel Lauss 	 */
8597c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_SD0_INSERT_INT, IRQ_NOAUTOEN);
8607c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_SD0_EJECT_INT, IRQ_NOAUTOEN);
8617c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_PC0_INSERT_INT, IRQ_NOAUTOEN);
8627c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_PC0_EJECT_INT, IRQ_NOAUTOEN);
8637c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_PC1_INSERT_INT, IRQ_NOAUTOEN);
8647c4b24daSManuel Lauss 	irq_set_status_flags(DB1200_PC1_EJECT_INT, IRQ_NOAUTOEN);
8657c4b24daSManuel Lauss 
8667c4b24daSManuel Lauss 	i2c_register_board_info(0, db1200_i2c_devs,
8677c4b24daSManuel Lauss 				ARRAY_SIZE(db1200_i2c_devs));
8687c4b24daSManuel Lauss 	spi_register_board_info(db1200_spi_devs,
8697c4b24daSManuel Lauss 				ARRAY_SIZE(db1200_i2c_devs));
8707c4b24daSManuel Lauss 
8717c4b24daSManuel Lauss 	/* SWITCHES:	S6.8 I2C/SPI selector  (OFF=I2C	 ON=SPI)
8727c4b24daSManuel Lauss 	 *		S6.7 AC97/I2S selector (OFF=AC97 ON=I2S)
8736f7c8623SManuel Lauss 	 *		or S12 on the PB1200.
8747c4b24daSManuel Lauss 	 */
8757c4b24daSManuel Lauss 
8767c4b24daSManuel Lauss 	/* NOTE: GPIO215 controls OTG VBUS supply.  In SPI mode however
8777c4b24daSManuel Lauss 	 * this pin is claimed by PSC0 (unused though, but pinmux doesn't
8787c4b24daSManuel Lauss 	 * allow to free it without crippling the SPI interface).
8797c4b24daSManuel Lauss 	 * As a result, in SPI mode, OTG simply won't work (PSC0 uses
8807c4b24daSManuel Lauss 	 * it as an input pin which is pulled high on the boards).
8817c4b24daSManuel Lauss 	 */
8827c4b24daSManuel Lauss 	pfc = __raw_readl((void __iomem *)SYS_PINFUNC) & ~SYS_PINFUNC_P0A;
8837c4b24daSManuel Lauss 
8847c4b24daSManuel Lauss 	/* switch off OTG VBUS supply */
8857c4b24daSManuel Lauss 	gpio_request(215, "otg-vbus");
8867c4b24daSManuel Lauss 	gpio_direction_output(215, 1);
8877c4b24daSManuel Lauss 
888bd8510dfSManuel Lauss 	printk(KERN_INFO "%s device configuration:\n", get_system_type());
8897c4b24daSManuel Lauss 
8907c4b24daSManuel Lauss 	sw = bcsr_read(BCSR_SWITCHES);
8917c4b24daSManuel Lauss 	if (sw & BCSR_SWITCHES_DIP_8) {
8927c4b24daSManuel Lauss 		db1200_devs[0] = &db1200_i2c_dev;
8937c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0);
8947c4b24daSManuel Lauss 
8957c4b24daSManuel Lauss 		pfc |= (2 << 17);	/* GPIO2 block owns GPIO215 */
8967c4b24daSManuel Lauss 
8977c4b24daSManuel Lauss 		printk(KERN_INFO " S6.8 OFF: PSC0 mode I2C\n");
8987c4b24daSManuel Lauss 		printk(KERN_INFO "   OTG port VBUS supply available!\n");
8997c4b24daSManuel Lauss 	} else {
9007c4b24daSManuel Lauss 		db1200_devs[0] = &db1200_spi_dev;
9017c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC0MUX);
9027c4b24daSManuel Lauss 
9037c4b24daSManuel Lauss 		pfc |= (1 << 17);	/* PSC0 owns GPIO215 */
9047c4b24daSManuel Lauss 
9057c4b24daSManuel Lauss 		printk(KERN_INFO " S6.8 ON : PSC0 mode SPI\n");
9067c4b24daSManuel Lauss 		printk(KERN_INFO "   OTG port VBUS supply disabled\n");
9077c4b24daSManuel Lauss 	}
9087c4b24daSManuel Lauss 	__raw_writel(pfc, (void __iomem *)SYS_PINFUNC);
9097c4b24daSManuel Lauss 	wmb();
9107c4b24daSManuel Lauss 
9117c4b24daSManuel Lauss 	/* Audio: DIP7 selects I2S(0)/AC97(1), but need I2C for I2S!
9127c4b24daSManuel Lauss 	 * so: DIP7=1 || DIP8=0 => AC97, DIP7=0 && DIP8=1 => I2S
9137c4b24daSManuel Lauss 	 */
9147c4b24daSManuel Lauss 	sw &= BCSR_SWITCHES_DIP_8 | BCSR_SWITCHES_DIP_7;
9157c4b24daSManuel Lauss 	if (sw == BCSR_SWITCHES_DIP_8) {
9167c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC1MUX);
9177c4b24daSManuel Lauss 		db1200_audio_dev.name = "au1xpsc_i2s";
9187c4b24daSManuel Lauss 		db1200_sound_dev.name = "db1200-i2s";
9197c4b24daSManuel Lauss 		printk(KERN_INFO " S6.7 ON : PSC1 mode I2S\n");
9207c4b24daSManuel Lauss 	} else {
9217c4b24daSManuel Lauss 		bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC1MUX, 0);
9227c4b24daSManuel Lauss 		db1200_audio_dev.name = "au1xpsc_ac97";
9237c4b24daSManuel Lauss 		db1200_sound_dev.name = "db1200-ac97";
9247c4b24daSManuel Lauss 		printk(KERN_INFO " S6.7 OFF: PSC1 mode AC97\n");
9257c4b24daSManuel Lauss 	}
9267c4b24daSManuel Lauss 
9277c4b24daSManuel Lauss 	/* Audio PSC clock is supplied externally. (FIXME: platdata!!) */
9287c4b24daSManuel Lauss 	__raw_writel(PSC_SEL_CLK_SERCLK,
9297c4b24daSManuel Lauss 	    (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
9307c4b24daSManuel Lauss 	wmb();
9317c4b24daSManuel Lauss 
9327c4b24daSManuel Lauss 	db1x_register_pcmcia_socket(
9337c4b24daSManuel Lauss 		AU1000_PCMCIA_ATTR_PHYS_ADDR,
9347c4b24daSManuel Lauss 		AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
9357c4b24daSManuel Lauss 		AU1000_PCMCIA_MEM_PHYS_ADDR,
9367c4b24daSManuel Lauss 		AU1000_PCMCIA_MEM_PHYS_ADDR  + 0x000400000 - 1,
9377c4b24daSManuel Lauss 		AU1000_PCMCIA_IO_PHYS_ADDR,
9387c4b24daSManuel Lauss 		AU1000_PCMCIA_IO_PHYS_ADDR   + 0x000010000 - 1,
9397c4b24daSManuel Lauss 		DB1200_PC0_INT, DB1200_PC0_INSERT_INT,
9407c4b24daSManuel Lauss 		/*DB1200_PC0_STSCHG_INT*/0, DB1200_PC0_EJECT_INT, 0);
9417c4b24daSManuel Lauss 
9427c4b24daSManuel Lauss 	db1x_register_pcmcia_socket(
9437c4b24daSManuel Lauss 		AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000,
9447c4b24daSManuel Lauss 		AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1,
9457c4b24daSManuel Lauss 		AU1000_PCMCIA_MEM_PHYS_ADDR  + 0x004000000,
9467c4b24daSManuel Lauss 		AU1000_PCMCIA_MEM_PHYS_ADDR  + 0x004400000 - 1,
9477c4b24daSManuel Lauss 		AU1000_PCMCIA_IO_PHYS_ADDR   + 0x004000000,
9487c4b24daSManuel Lauss 		AU1000_PCMCIA_IO_PHYS_ADDR   + 0x004010000 - 1,
9497c4b24daSManuel Lauss 		DB1200_PC1_INT, DB1200_PC1_INSERT_INT,
9507c4b24daSManuel Lauss 		/*DB1200_PC1_STSCHG_INT*/0, DB1200_PC1_EJECT_INT, 1);
9517c4b24daSManuel Lauss 
9527c4b24daSManuel Lauss 	swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT;
9537c4b24daSManuel Lauss 	db1x_register_norflash(64 << 20, 2, swapped);
9547c4b24daSManuel Lauss 
9556f7c8623SManuel Lauss 	platform_add_devices(db1200_devs, ARRAY_SIZE(db1200_devs));
9566f7c8623SManuel Lauss 
9576f7c8623SManuel Lauss 	/* PB1200 is a DB1200 with a 2nd MMC and Camera connector */
9586f7c8623SManuel Lauss 	if ((bid == BCSR_WHOAMI_PB1200_DDR1) ||
9596f7c8623SManuel Lauss 	    (bid == BCSR_WHOAMI_PB1200_DDR2))
9606f7c8623SManuel Lauss 		platform_add_devices(pb1200_devs, ARRAY_SIZE(pb1200_devs));
9616f7c8623SManuel Lauss 
9626f7c8623SManuel Lauss 	return 0;
9637c4b24daSManuel Lauss }
964