Merge remote-tracking branch 's5p/for-next'
[linux-2.6/next.git] / arch / mips / lantiq / devices.c
blob44a36771c819bebcb03732744566764c6d60b574
1 /*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License version 2 as published
4 * by the Free Software Foundation.
6 * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
7 */
9 #include <linux/init.h>
10 #include <linux/module.h>
11 #include <linux/types.h>
12 #include <linux/string.h>
13 #include <linux/kernel.h>
14 #include <linux/reboot.h>
15 #include <linux/platform_device.h>
16 #include <linux/leds.h>
17 #include <linux/etherdevice.h>
18 #include <linux/time.h>
19 #include <linux/io.h>
20 #include <linux/gpio.h>
22 #include <asm/bootinfo.h>
23 #include <asm/irq.h>
25 #include <lantiq_soc.h>
27 #include "devices.h"
29 /* nor flash */
30 static struct resource ltq_nor_resource = {
31 .name = "nor",
32 .start = LTQ_FLASH_START,
33 .end = LTQ_FLASH_START + LTQ_FLASH_MAX - 1,
34 .flags = IORESOURCE_MEM,
37 static struct platform_device ltq_nor = {
38 .name = "ltq_nor",
39 .resource = &ltq_nor_resource,
40 .num_resources = 1,
43 void __init ltq_register_nor(struct physmap_flash_data *data)
45 ltq_nor.dev.platform_data = data;
46 platform_device_register(&ltq_nor);
49 /* watchdog */
50 static struct resource ltq_wdt_resource = {
51 .name = "watchdog",
52 .start = LTQ_WDT_BASE_ADDR,
53 .end = LTQ_WDT_BASE_ADDR + LTQ_WDT_SIZE - 1,
54 .flags = IORESOURCE_MEM,
57 void __init ltq_register_wdt(void)
59 platform_device_register_simple("ltq_wdt", 0, &ltq_wdt_resource, 1);
62 /* asc ports */
63 static struct resource ltq_asc0_resources[] = {
65 .name = "asc0",
66 .start = LTQ_ASC0_BASE_ADDR,
67 .end = LTQ_ASC0_BASE_ADDR + LTQ_ASC_SIZE - 1,
68 .flags = IORESOURCE_MEM,
70 IRQ_RES(tx, LTQ_ASC_TIR(0)),
71 IRQ_RES(rx, LTQ_ASC_RIR(0)),
72 IRQ_RES(err, LTQ_ASC_EIR(0)),
75 static struct resource ltq_asc1_resources[] = {
77 .name = "asc1",
78 .start = LTQ_ASC1_BASE_ADDR,
79 .end = LTQ_ASC1_BASE_ADDR + LTQ_ASC_SIZE - 1,
80 .flags = IORESOURCE_MEM,
82 IRQ_RES(tx, LTQ_ASC_TIR(1)),
83 IRQ_RES(rx, LTQ_ASC_RIR(1)),
84 IRQ_RES(err, LTQ_ASC_EIR(1)),
87 void __init ltq_register_asc(int port)
89 switch (port) {
90 case 0:
91 platform_device_register_simple("ltq_asc", 0,
92 ltq_asc0_resources, ARRAY_SIZE(ltq_asc0_resources));
93 break;
94 case 1:
95 platform_device_register_simple("ltq_asc", 1,
96 ltq_asc1_resources, ARRAY_SIZE(ltq_asc1_resources));
97 break;
98 default:
99 break;
103 #ifdef CONFIG_PCI
104 /* pci */
105 static struct platform_device ltq_pci = {
106 .name = "ltq_pci",
107 .num_resources = 0,
110 void __init ltq_register_pci(struct ltq_pci_data *data)
112 ltq_pci.dev.platform_data = data;
113 platform_device_register(&ltq_pci);
115 #else
116 void __init ltq_register_pci(struct ltq_pci_data *data)
118 pr_err("kernel is compiled without PCI support\n");
120 #endif