2 * Pb1200/DBAu1200 board platform device registration
4 * Copyright (C) 2008 MontaVista Software Inc. <source@mvista.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <linux/dma-mapping.h>
22 #include <linux/init.h>
23 #include <linux/leds.h>
24 #include <linux/platform_device.h>
26 #include <asm/mach-au1x00/au1xxx.h>
27 #include <asm/mach-au1x00/au1100_mmc.h>
29 static int mmc_activity;
31 static void pb1200mmc0_set_power(void *mmc_host, int state)
34 bcsr->board |= BCSR_BOARD_SD0PWR;
36 bcsr->board &= ~BCSR_BOARD_SD0PWR;
41 static int pb1200mmc0_card_readonly(void *mmc_host)
43 return (bcsr->status & BCSR_STATUS_SD0WP) ? 1 : 0;
46 static int pb1200mmc0_card_inserted(void *mmc_host)
48 return (bcsr->sig_status & BCSR_INT_SD0INSERT) ? 1 : 0;
51 static void pb1200_mmcled_set(struct led_classdev *led,
52 enum led_brightness brightness)
54 if (brightness != LED_OFF) {
55 if (++mmc_activity == 1)
56 bcsr->disk_leds &= ~(1 << 8);
58 if (--mmc_activity == 0)
59 bcsr->disk_leds |= (1 << 8);
63 static struct led_classdev pb1200mmc_led = {
64 .brightness_set = pb1200_mmcled_set,
67 #ifndef CONFIG_MIPS_DB1200
68 static void pb1200mmc1_set_power(void *mmc_host, int state)
71 bcsr->board |= BCSR_BOARD_SD1PWR;
73 bcsr->board &= ~BCSR_BOARD_SD1PWR;
78 static int pb1200mmc1_card_readonly(void *mmc_host)
80 return (bcsr->status & BCSR_STATUS_SD1WP) ? 1 : 0;
83 static int pb1200mmc1_card_inserted(void *mmc_host)
85 return (bcsr->sig_status & BCSR_INT_SD1INSERT) ? 1 : 0;
89 const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
91 .set_power = pb1200mmc0_set_power,
92 .card_inserted = pb1200mmc0_card_inserted,
93 .card_readonly = pb1200mmc0_card_readonly,
94 .cd_setup = NULL, /* use poll-timer in driver */
95 .led = &pb1200mmc_led,
97 #ifndef CONFIG_MIPS_DB1200
99 .set_power = pb1200mmc1_set_power,
100 .card_inserted = pb1200mmc1_card_inserted,
101 .card_readonly = pb1200mmc1_card_readonly,
102 .cd_setup = NULL, /* use poll-timer in driver */
103 .led = &pb1200mmc_led,
108 static struct resource ide_resources[] = {
110 .start = IDE_PHYS_ADDR,
111 .end = IDE_PHYS_ADDR + IDE_PHYS_LEN - 1,
112 .flags = IORESOURCE_MEM
117 .flags = IORESOURCE_IRQ
121 static u64 ide_dmamask = DMA_32BIT_MASK;
123 static struct platform_device ide_device = {
124 .name = "au1200-ide",
127 .dma_mask = &ide_dmamask,
128 .coherent_dma_mask = DMA_32BIT_MASK,
130 .num_resources = ARRAY_SIZE(ide_resources),
131 .resource = ide_resources
134 static struct resource smc91c111_resources[] = {
136 .name = "smc91x-regs",
137 .start = SMC91C111_PHYS_ADDR,
138 .end = SMC91C111_PHYS_ADDR + 0xf,
139 .flags = IORESOURCE_MEM
142 .start = SMC91C111_INT,
143 .end = SMC91C111_INT,
144 .flags = IORESOURCE_IRQ
148 static struct platform_device smc91c111_device = {
151 .num_resources = ARRAY_SIZE(smc91c111_resources),
152 .resource = smc91c111_resources
155 static struct platform_device *board_platform_devices[] __initdata = {
160 static int __init board_register_devices(void)
162 return platform_add_devices(board_platform_devices,
163 ARRAY_SIZE(board_platform_devices));
166 arch_initcall(board_register_devices);