2 * Author: Armin Kuster <akuster@mvista.com>
4 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
5 * the terms of the GNU General Public License version 2. This program
6 * is licensed "as is" without any warranty of any kind, whether express
10 #include <linux/init.h>
11 #include <linux/pagemap.h>
12 #include <linux/platform_device.h>
13 #include <linux/ioport.h>
15 #include <asm/ppc4xx_pic.h>
16 #include <linux/delay.h>
17 #include <asm/machdep.h>
20 * Define external IRQ senses and polarities.
22 unsigned char ppc4xx_uic_ext_irq_cfg
[] __initdata
= {
23 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* Ext Int 7 */
24 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* Ext Int 8 */
25 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* Ext Int 9 */
26 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* Ext Int 0 */
27 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* Ext Int 1 */
28 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* Ext Int 2 */
29 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* Ext Int 3 */
30 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* Ext Int 4 */
31 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* Ext Int 5 */
32 (IRQ_SENSE_LEVEL
| IRQ_POLARITY_NEGATIVE
), /* Ext Int 6 */
35 static struct resource smc91x_resources
[] = {
37 .start
= SMC91111_BASE_ADDR
,
38 .end
= SMC91111_BASE_ADDR
+ SMC91111_REG_SIZE
- 1,
39 .flags
= IORESOURCE_MEM
,
42 .start
= SMC91111_IRQ
,
44 .flags
= IORESOURCE_IRQ
,
48 static struct platform_device smc91x_device
= {
51 .num_resources
= ARRAY_SIZE(smc91x_resources
),
52 .resource
= smc91x_resources
,
55 static struct platform_device
*redwood6_devs
[] __initdata
= {
60 redwood6_platform_add_devices(void)
62 return platform_add_devices(redwood6_devs
, ARRAY_SIZE(redwood6_devs
));
67 redwood6_setup_arch(void)
70 void *xilinx
, *xilinx_1
, *xilinx_2
;
71 unsigned short us_reg5
;
77 xilinx
= (unsigned long) ioremap(IDE_XLINUX_MUX_BASE
, 0x10);
78 /* init xilinx control registers - enable ide mux, clear reset bit */
81 "redwood6_setup_arch() xilinxi ioremap failed\n");
84 xilinx_1
= xilinx
+ 0xa;
85 xilinx_2
= xilinx
+ 0xe;
87 us_reg5
= readb(xilinx_1
);
88 writeb(0x01d1, xilinx_1
);
89 writeb(0x0008, xilinx_2
);
93 writeb(0x01d1, xilinx_1
);
94 writeb(0x0008, xilinx_2
);
98 bd_t
*bip
= (bd_t
*) __res
;
100 printk("machine\t: %s\n", PPC4xx_MACHINE_NAME
);
102 printk("bi_s_version\t %s\n", bip
->bi_s_version
);
103 printk("bi_r_version\t %s\n", bip
->bi_r_version
);
104 printk("bi_memsize\t 0x%8.8x\t %dMBytes\n", bip
->bi_memsize
,
105 bip
->bi_memsize
/ (1024 * 1000));
106 printk("bi_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", 0,
107 bip
->bi_enetaddr
[0], bip
->bi_enetaddr
[1], bip
->bi_enetaddr
[2],
108 bip
->bi_enetaddr
[3], bip
->bi_enetaddr
[4], bip
->bi_enetaddr
[5]);
110 printk("bi_intfreq\t 0x%8.8x\t clock:\t %dMhz\n",
111 bip
->bi_intfreq
, bip
->bi_intfreq
/ 1000000);
113 printk("bi_busfreq\t 0x%8.8x\t plb bus clock:\t %dMHz\n",
114 bip
->bi_busfreq
, bip
->bi_busfreq
/ 1000000);
115 printk("bi_tbfreq\t 0x%8.8x\t TB freq:\t %dMHz\n",
116 bip
->bi_tbfreq
, bip
->bi_tbfreq
/ 1000000);
121 /* Identify the system */
122 printk(KERN_INFO
"IBM Redwood6 (STBx25XX) Platform\n");
124 "Port by MontaVista Software, Inc. (source@mvista.com)\n");
126 device_initcall(redwood6_platform_add_devices
);
130 redwood6_map_io(void)
135 for (i
= 0; i
< 16; i
++) {
138 /* 0x400x0000 -> 0xe00x0000 */
139 p
= 0x40000000 | (i
<< 16);
140 v
= STBx25xx_IO_BASE
| (i
<< 16);
142 io_block_mapping(v
, p
, PAGE_SIZE
,
143 _PAGE_NO_CACHE
| pgprot_val(PAGE_KERNEL
) |
149 platform_init(unsigned long r3
, unsigned long r4
, unsigned long r5
,
150 unsigned long r6
, unsigned long r7
)
152 ppc4xx_init(r3
, r4
, r5
, r6
, r7
);
154 ppc_md
.setup_arch
= redwood6_setup_arch
;
155 ppc_md
.setup_io_mappings
= redwood6_map_io
;