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>
25 #include <linux/smc91x.h>
27 #include <asm/mach-au1x00/au1xxx.h>
28 #include <asm/mach-au1x00/au1100_mmc.h>
30 static int mmc_activity;
32 static void pb1200mmc0_set_power(void *mmc_host, int state)
35 bcsr->board |= BCSR_BOARD_SD0PWR;
37 bcsr->board &= ~BCSR_BOARD_SD0PWR;
42 static int pb1200mmc0_card_readonly(void *mmc_host)
44 return (bcsr->status & BCSR_STATUS_SD0WP) ? 1 : 0;
47 static int pb1200mmc0_card_inserted(void *mmc_host)
49 return (bcsr->sig_status & BCSR_INT_SD0INSERT) ? 1 : 0;
52 static void pb1200_mmcled_set(struct led_classdev *led,
53 enum led_brightness brightness)
55 if (brightness != LED_OFF) {
56 if (++mmc_activity == 1)
57 bcsr->disk_leds &= ~(1 << 8);
59 if (--mmc_activity == 0)
60 bcsr->disk_leds |= (1 << 8);
64 static struct led_classdev pb1200mmc_led = {
65 .brightness_set = pb1200_mmcled_set,
68 #ifndef CONFIG_MIPS_DB1200
69 static void pb1200mmc1_set_power(void *mmc_host, int state)
72 bcsr->board |= BCSR_BOARD_SD1PWR;
74 bcsr->board &= ~BCSR_BOARD_SD1PWR;
79 static int pb1200mmc1_card_readonly(void *mmc_host)
81 return (bcsr->status & BCSR_STATUS_SD1WP) ? 1 : 0;
84 static int pb1200mmc1_card_inserted(void *mmc_host)
86 return (bcsr->sig_status & BCSR_INT_SD1INSERT) ? 1 : 0;
90 const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
92 .set_power = pb1200mmc0_set_power,
93 .card_inserted = pb1200mmc0_card_inserted,
94 .card_readonly = pb1200mmc0_card_readonly,
95 .cd_setup = NULL, /* use poll-timer in driver */
96 .led = &pb1200mmc_led,
98 #ifndef CONFIG_MIPS_DB1200
100 .set_power = pb1200mmc1_set_power,
101 .card_inserted = pb1200mmc1_card_inserted,
102 .card_readonly = pb1200mmc1_card_readonly,
103 .cd_setup = NULL, /* use poll-timer in driver */
104 .led = &pb1200mmc_led,
109 static struct resource ide_resources[] = {
111 .start = IDE_PHYS_ADDR,
112 .end = IDE_PHYS_ADDR + IDE_PHYS_LEN - 1,
113 .flags = IORESOURCE_MEM
118 .flags = IORESOURCE_IRQ
122 static u64 ide_dmamask = DMA_BIT_MASK(32);
124 static struct platform_device ide_device = {
125 .name = "au1200-ide",
128 .dma_mask = &ide_dmamask,
129 .coherent_dma_mask = DMA_BIT_MASK(32),
131 .num_resources = ARRAY_SIZE(ide_resources),
132 .resource = ide_resources
135 static struct smc91x_platdata smc_data = {
136 .flags = SMC91X_NOWAIT | SMC91X_USE_16BIT,
137 .leda = RPC_LED_100_10,
138 .ledb = RPC_LED_TX_RX,
141 static struct resource smc91c111_resources[] = {
143 .name = "smc91x-regs",
144 .start = SMC91C111_PHYS_ADDR,
145 .end = SMC91C111_PHYS_ADDR + 0xf,
146 .flags = IORESOURCE_MEM
149 .start = SMC91C111_INT,
150 .end = SMC91C111_INT,
151 .flags = IORESOURCE_IRQ
155 static struct platform_device smc91c111_device = {
157 .platform_data = &smc_data,
161 .num_resources = ARRAY_SIZE(smc91c111_resources),
162 .resource = smc91c111_resources
165 static struct platform_device *board_platform_devices[] __initdata = {
170 static int __init board_register_devices(void)
172 return platform_add_devices(board_platform_devices,
173 ARRAY_SIZE(board_platform_devices));
176 arch_initcall(board_register_devices);