platform.c 6.7 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10
/*
 * Platform device support for Au1x00 SoCs.
 *
 * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */
#include <linux/device.h>
11
#include <linux/platform_device.h>
L
Linus Torvalds 已提交
12 13 14 15
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/resource.h>

P
Pete Popov 已提交
16
#include <asm/mach-au1x00/au1xxx.h>
L
Linus Torvalds 已提交
17

P
Pete Popov 已提交
18
/* OHCI (USB full speed host controller) */
L
Linus Torvalds 已提交
19 20 21
static struct resource au1xxx_usb_ohci_resources[] = {
	[0] = {
		.start		= USB_OHCI_BASE,
J
Jordan Crouse 已提交
22
		.end		= USB_OHCI_BASE + USB_OHCI_LEN - 1,
L
Linus Torvalds 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
		.flags		= IORESOURCE_MEM,
	},
	[1] = {
		.start		= AU1000_USB_HOST_INT,
		.end		= AU1000_USB_HOST_INT,
		.flags		= IORESOURCE_IRQ,
	},
};

/* The dmamask must be set for OHCI to work */
static u64 ohci_dmamask = ~(u32)0;

static struct platform_device au1xxx_usb_ohci_device = {
	.name		= "au1xxx-ohci",
	.id		= 0,
	.dev = {
		.dma_mask		= &ohci_dmamask,
		.coherent_dma_mask	= 0xffffffff,
	},
	.num_resources	= ARRAY_SIZE(au1xxx_usb_ohci_resources),
	.resource	= au1xxx_usb_ohci_resources,
};

P
Pete Popov 已提交
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
/*** AU1100 LCD controller ***/

#ifdef CONFIG_FB_AU1100
static struct resource au1100_lcd_resources[] = {
	[0] = {
		.start          = LCD_PHYS_ADDR,
		.end            = LCD_PHYS_ADDR + 0x800 - 1,
		.flags          = IORESOURCE_MEM,
	},
	[1] = {
		.start          = AU1100_LCD_INT,
		.end            = AU1100_LCD_INT,
		.flags          = IORESOURCE_IRQ,
	}
};

static u64 au1100_lcd_dmamask = ~(u32)0;

static struct platform_device au1100_lcd_device = {
	.name           = "au1100-lcd",
	.id             = 0,
	.dev = {
		.dma_mask               = &au1100_lcd_dmamask,
		.coherent_dma_mask      = 0xffffffff,
	},
	.num_resources  = ARRAY_SIZE(au1100_lcd_resources),
	.resource       = au1100_lcd_resources,
};
#endif

P
Pete Popov 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
#ifdef CONFIG_SOC_AU1200
/* EHCI (USB high speed host controller) */
static struct resource au1xxx_usb_ehci_resources[] = {
	[0] = {
		.start		= USB_EHCI_BASE,
		.end		= USB_EHCI_BASE + USB_EHCI_LEN - 1,
		.flags		= IORESOURCE_MEM,
	},
	[1] = {
		.start		= AU1000_USB_HOST_INT,
		.end		= AU1000_USB_HOST_INT,
		.flags		= IORESOURCE_IRQ,
	},
};

static u64 ehci_dmamask = ~(u32)0;

static struct platform_device au1xxx_usb_ehci_device = {
	.name		= "au1xxx-ehci",
	.id		= 0,
	.dev = {
		.dma_mask		= &ehci_dmamask,
		.coherent_dma_mask	= 0xffffffff,
	},
	.num_resources	= ARRAY_SIZE(au1xxx_usb_ehci_resources),
	.resource	= au1xxx_usb_ehci_resources,
};

/* Au1200 UDC (USB gadget controller) */
static struct resource au1xxx_usb_gdt_resources[] = {
	[0] = {
		.start		= USB_UDC_BASE,
		.end		= USB_UDC_BASE + USB_UDC_LEN - 1,
		.flags		= IORESOURCE_MEM,
	},
	[1] = {
		.start		= AU1200_USB_INT,
		.end		= AU1200_USB_INT,
		.flags		= IORESOURCE_IRQ,
	},
};

118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
static struct resource au1xxx_mmc_resources[] = {
	[0] = {
		.start          = SD0_PHYS_ADDR,
		.end            = SD0_PHYS_ADDR + 0x40,
		.flags          = IORESOURCE_MEM,
	},
	[1] = {
		.start		= SD1_PHYS_ADDR,
		.end 		= SD1_PHYS_ADDR + 0x40,
		.flags		= IORESOURCE_MEM,
	},
	[2] = {
		.start          = AU1200_SD_INT,
		.end            = AU1200_SD_INT,
		.flags          = IORESOURCE_IRQ,
	}
};

P
Pete Popov 已提交
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
static u64 udc_dmamask = ~(u32)0;

static struct platform_device au1xxx_usb_gdt_device = {
	.name		= "au1xxx-udc",
	.id		= 0,
	.dev = {
		.dma_mask		= &udc_dmamask,
		.coherent_dma_mask	= 0xffffffff,
	},
	.num_resources	= ARRAY_SIZE(au1xxx_usb_gdt_resources),
	.resource	= au1xxx_usb_gdt_resources,
};

/* Au1200 UOC (USB OTG controller) */
static struct resource au1xxx_usb_otg_resources[] = {
	[0] = {
		.start		= USB_UOC_BASE,
		.end		= USB_UOC_BASE + USB_UOC_LEN - 1,
		.flags		= IORESOURCE_MEM,
	},
	[1] = {
		.start		= AU1200_USB_INT,
		.end		= AU1200_USB_INT,
		.flags		= IORESOURCE_IRQ,
	},
};

static u64 uoc_dmamask = ~(u32)0;

static struct platform_device au1xxx_usb_otg_device = {
	.name		= "au1xxx-uoc",
	.id		= 0,
	.dev = {
		.dma_mask		= &uoc_dmamask,
		.coherent_dma_mask	= 0xffffffff,
	},
	.num_resources	= ARRAY_SIZE(au1xxx_usb_otg_resources),
	.resource	= au1xxx_usb_otg_resources,
};

static struct resource au1200_lcd_resources[] = {
	[0] = {
		.start          = LCD_PHYS_ADDR,
		.end            = LCD_PHYS_ADDR + 0x800 - 1,
		.flags          = IORESOURCE_MEM,
	},
	[1] = {
		.start          = AU1200_LCD_INT,
		.end            = AU1200_LCD_INT,
		.flags          = IORESOURCE_IRQ,
	}
};

P
Pete Popov 已提交
189 190 191 192 193 194 195 196 197 198 199 200 201
static struct resource au1200_ide0_resources[] = {
	[0] = {
		.start		= AU1XXX_ATA_PHYS_ADDR,
		.end 		= AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN,
		.flags		= IORESOURCE_MEM,
	},
	[1] = {
		.start		= AU1XXX_ATA_INT,
		.end		= AU1XXX_ATA_INT,
		.flags		= IORESOURCE_IRQ,
	}
};

P
Pete Popov 已提交
202 203 204 205 206 207 208 209 210 211 212 213
static u64 au1200_lcd_dmamask = ~(u32)0;

static struct platform_device au1200_lcd_device = {
	.name           = "au1200-lcd",
	.id             = 0,
	.dev = {
		.dma_mask               = &au1200_lcd_dmamask,
		.coherent_dma_mask      = 0xffffffff,
	},
	.num_resources  = ARRAY_SIZE(au1200_lcd_resources),
	.resource       = au1200_lcd_resources,
};
P
Pete Popov 已提交
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228


static u64 ide0_dmamask = ~(u32)0;

static struct platform_device au1200_ide0_device = {
	.name		= "au1200-ide",
	.id		= 0,
	.dev = {
		.dma_mask 		= &ide0_dmamask,
		.coherent_dma_mask	= 0xffffffff,
	},
	.num_resources = ARRAY_SIZE(au1200_ide0_resources),
	.resource	= au1200_ide0_resources,
};

229 230 231 232 233 234 235 236 237 238 239 240 241 242
static u64 au1xxx_mmc_dmamask =  ~(u32)0;

static struct platform_device au1xxx_mmc_device = {
	.name = "au1xxx-mmc",
	.id = 0,
	.dev = {
		.dma_mask               = &au1xxx_mmc_dmamask,
		.coherent_dma_mask      = 0xffffffff,
	},
	.num_resources  = ARRAY_SIZE(au1xxx_mmc_resources),
	.resource       = au1xxx_mmc_resources,
};
#endif /* #ifdef CONFIG_SOC_AU1200 */

243 244 245 246 247
static struct platform_device au1x00_pcmcia_device = {
	.name 		= "au1x00-pcmcia",
	.id 		= 0,
};

248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
#ifdef CONFIG_MIPS_DB1200

static struct resource smc91x_resources[] = {
	[0] = {
		.name	= "smc91x-regs",
		.start	= AU1XXX_SMC91111_PHYS_ADDR,
		.end	= AU1XXX_SMC91111_PHYS_ADDR + 0xfffff,
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= AU1XXX_SMC91111_IRQ,
		.end	= AU1XXX_SMC91111_IRQ,
		.flags	= IORESOURCE_IRQ,
	},
};

static struct platform_device smc91x_device = {
	.name		= "smc91x",
266
	.id		= -1,
267 268 269 270 271 272
	.num_resources	= ARRAY_SIZE(smc91x_resources),
	.resource	= smc91x_resources,
};

#endif

L
Linus Torvalds 已提交
273 274
static struct platform_device *au1xxx_platform_devices[] __initdata = {
	&au1xxx_usb_ohci_device,
275
	&au1x00_pcmcia_device,
P
Pete Popov 已提交
276 277 278
#ifdef CONFIG_FB_AU1100
	&au1100_lcd_device,
#endif
P
Pete Popov 已提交
279 280 281 282 283
#ifdef CONFIG_SOC_AU1200
	&au1xxx_usb_ehci_device,
	&au1xxx_usb_gdt_device,
	&au1xxx_usb_otg_device,
	&au1200_lcd_device,
P
Pete Popov 已提交
284
	&au1200_ide0_device,
285
	&au1xxx_mmc_device,
P
Pete Popov 已提交
286
#endif
287
#ifdef CONFIG_MIPS_DB1200
288
	&smc91x_device,
289
#endif
L
Linus Torvalds 已提交
290 291
};

292
int __init au1xxx_platform_init(void)
L
Linus Torvalds 已提交
293 294 295 296 297
{
	return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
}

arch_initcall(au1xxx_platform_init);