1 #include <linux/init.h>
2 #include <linux/module.h>
3 #include <linux/types.h>
4 #include <linux/string.h>
5 #include <linux/mtd/physmap.h>
6 #include <linux/kernel.h>
7 #include <linux/reboot.h>
8 #include <linux/platform_device.h>
9 #include <linux/leds.h>
10 #include <linux/etherdevice.h>
11 #include <linux/reboot.h>
12 #include <linux/time.h>
14 #include <linux/gpio.h>
15 #include <linux/leds.h>
17 #include <asm/bootinfo.h>
21 #include <ifxmips_irq.h>
22 #include <ifxmips_pmu.h>
23 #include <ifxmips_led.h>
28 static struct resource danube_asc0_resources
[] =
31 .start
= (IFXMIPS_ASC_BASE_ADDR
& ~KSEG1
),
32 .end
= (IFXMIPS_ASC_BASE_ADDR
& ~KSEG1
) + 0x100 - 1,
33 .flags
= IORESOURCE_MEM
,
36 .start
= IFXMIPSASC_TIR(0),
37 .end
= IFXMIPSASC_TIR(0)+3,
38 .flags
= IORESOURCE_IRQ
,
42 static struct resource danube_asc1_resources
[] =
45 .start
= (IFXMIPS_ASC_BASE_ADDR
& ~KSEG1
) + IFXMIPS_ASC_BASE_DIFF
,
46 .end
= (IFXMIPS_ASC_BASE_ADDR
& ~KSEG1
) + IFXMIPS_ASC_BASE_DIFF
+ 0x100 - 1,
47 .flags
= IORESOURCE_MEM
,
50 .start
= IFXMIPSASC_TIR(1),
51 .end
= IFXMIPSASC_TIR(1)+3,
52 .flags
= IORESOURCE_IRQ
,
56 void __init
danube_register_asc(int port
)
60 platform_device_register_simple("ifxmips_asc", 0,
61 danube_asc0_resources
, ARRAY_SIZE(danube_asc0_resources
));
64 platform_device_register_simple("ifxmips_asc", 1,
65 danube_asc1_resources
, ARRAY_SIZE(danube_asc1_resources
));
73 static struct platform_device ifxmips_ebu_gpio
=
75 .name
= "ifxmips_ebu",
80 danube_register_ebu_gpio(struct resource
*resource
, u32 value
)
82 ifxmips_ebu_gpio
.resource
= resource
;
83 ifxmips_ebu_gpio
.dev
.platform_data
= (void*)value
;
84 platform_device_register(&ifxmips_ebu_gpio
);
88 unsigned char ifxmips_ethaddr
[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
89 static struct resource danube_ethernet_resources
=
91 .start
= IFXMIPS_PPE32_BASE_ADDR
,
92 .end
= IFXMIPS_PPE32_BASE_ADDR
+ IFXMIPS_PPE32_SIZE
- 1,
93 .flags
= IORESOURCE_MEM
,
96 static struct platform_device danube_ethernet
=
98 .name
= "ifxmips_mii0",
99 .resource
= &danube_ethernet_resources
,
102 .platform_data
= ifxmips_ethaddr
,
107 danube_register_ethernet(unsigned char *mac
, int mii_mode
)
109 struct ifxmips_eth_data
*eth
= kmalloc(sizeof(struct ifxmips_eth_data
), GFP_KERNEL
);
110 memset(eth
, 0, sizeof(struct ifxmips_eth_data
));
114 eth
->mac
= ifxmips_ethaddr
;
115 eth
->mii_mode
= mii_mode
;
116 danube_ethernet
.dev
.platform_data
= eth
;
117 platform_device_register(&danube_ethernet
);
121 extern int ifxmips_pci_external_clock
;
122 extern int ifxmips_pci_req_mask
;
125 danube_register_pci(int clock
, int irq_mask
)
127 ifxmips_pci_external_clock
= clock
;
129 ifxmips_pci_req_mask
= irq_mask
;
133 static struct resource mps_resources
[] = {
136 .flags
= IORESOURCE_MEM
,
142 .flags
= IORESOURCE_MEM
,
148 static struct platform_device mps_device
= {
150 .resource
= mps_resources
,
151 .num_resources
= ARRAY_SIZE(mps_resources
),
154 static struct platform_device vmmc_device
= {
157 .parent
= &mps_device
.dev
,
162 danube_register_tapi(void)
164 #define CP1_SIZE (1 << 20)
166 mps_device
.dev
.platform_data
= CPHYSADDR(dma_alloc_coherent(NULL
, CP1_SIZE
, &dma
, GFP_ATOMIC
));
167 platform_device_register(&mps_device
);
168 platform_device_register(&vmmc_device
);