diff options
Diffstat (limited to 'arch/ppc/platforms/4xx/redwood6.c')
-rw-r--r-- | arch/ppc/platforms/4xx/redwood6.c | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/arch/ppc/platforms/4xx/redwood6.c b/arch/ppc/platforms/4xx/redwood6.c new file mode 100644 index 000000000000..8b1012994dfc --- /dev/null +++ b/arch/ppc/platforms/4xx/redwood6.c | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * arch/ppc/platforms/4xx/redwood6.c | ||
3 | * | ||
4 | * Author: Armin Kuster <akuster@mvista.com> | ||
5 | * | ||
6 | * 2002 (c) MontaVista, Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/pagemap.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <linux/ioport.h> | ||
17 | #include <asm/io.h> | ||
18 | #include <asm/ppc4xx_pic.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <asm/machdep.h> | ||
21 | |||
22 | /* | ||
23 | * Define external IRQ senses and polarities. | ||
24 | */ | ||
25 | unsigned char ppc4xx_uic_ext_irq_cfg[] __initdata = { | ||
26 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 7 */ | ||
27 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 8 */ | ||
28 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 9 */ | ||
29 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 0 */ | ||
30 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 1 */ | ||
31 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 2 */ | ||
32 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 3 */ | ||
33 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 4 */ | ||
34 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 5 */ | ||
35 | (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext Int 6 */ | ||
36 | }; | ||
37 | |||
38 | static struct resource smc91x_resources[] = { | ||
39 | [0] = { | ||
40 | .start = SMC91111_BASE_ADDR, | ||
41 | .end = SMC91111_BASE_ADDR + SMC91111_REG_SIZE - 1, | ||
42 | .flags = IORESOURCE_MEM, | ||
43 | }, | ||
44 | [1] = { | ||
45 | .start = SMC91111_IRQ, | ||
46 | .end = SMC91111_IRQ, | ||
47 | .flags = IORESOURCE_IRQ, | ||
48 | }, | ||
49 | }; | ||
50 | |||
51 | static struct platform_device smc91x_device = { | ||
52 | .name = "smc91x", | ||
53 | .id = 0, | ||
54 | .num_resources = ARRAY_SIZE(smc91x_resources), | ||
55 | .resource = smc91x_resources, | ||
56 | }; | ||
57 | |||
58 | static struct platform_device *redwood6_devs[] __initdata = { | ||
59 | &smc91x_device, | ||
60 | }; | ||
61 | |||
62 | static int __init | ||
63 | redwood6_platform_add_devices(void) | ||
64 | { | ||
65 | return platform_add_devices(redwood6_devs, ARRAY_SIZE(redwood6_devs)); | ||
66 | } | ||
67 | |||
68 | |||
69 | void __init | ||
70 | redwood6_setup_arch(void) | ||
71 | { | ||
72 | #ifdef CONFIG_IDE | ||
73 | void *xilinx, *xilinx_1, *xilinx_2; | ||
74 | unsigned short us_reg5; | ||
75 | #endif | ||
76 | |||
77 | ppc4xx_setup_arch(); | ||
78 | |||
79 | #ifdef CONFIG_IDE | ||
80 | xilinx = (unsigned long) ioremap(IDE_XLINUX_MUX_BASE, 0x10); | ||
81 | /* init xilinx control registers - enable ide mux, clear reset bit */ | ||
82 | if (!xilinx) { | ||
83 | printk(KERN_CRIT | ||
84 | "redwood6_setup_arch() xilinxi ioremap failed\n"); | ||
85 | return; | ||
86 | } | ||
87 | xilinx_1 = xilinx + 0xa; | ||
88 | xilinx_2 = xilinx + 0xe; | ||
89 | |||
90 | us_reg5 = readb(xilinx_1); | ||
91 | writeb(0x01d1, xilinx_1); | ||
92 | writeb(0x0008, xilinx_2); | ||
93 | |||
94 | udelay(10 * 1000); | ||
95 | |||
96 | writeb(0x01d1, xilinx_1); | ||
97 | writeb(0x0008, xilinx_2); | ||
98 | #endif | ||
99 | |||
100 | #ifdef DEBUG_BRINGUP | ||
101 | bd_t *bip = (bd_t *) __res; | ||
102 | printk("\n"); | ||
103 | printk("machine\t: %s\n", PPC4xx_MACHINE_NAME); | ||
104 | printk("\n"); | ||
105 | printk("bi_s_version\t %s\n", bip->bi_s_version); | ||
106 | printk("bi_r_version\t %s\n", bip->bi_r_version); | ||
107 | printk("bi_memsize\t 0x%8.8x\t %dMBytes\n", bip->bi_memsize, | ||
108 | bip->bi_memsize / (1024 * 1000)); | ||
109 | printk("bi_enetaddr %d\t %2.2x%2.2x%2.2x-%2.2x%2.2x%2.2x\n", 0, | ||
110 | bip->bi_enetaddr[0], bip->bi_enetaddr[1], bip->bi_enetaddr[2], | ||
111 | bip->bi_enetaddr[3], bip->bi_enetaddr[4], bip->bi_enetaddr[5]); | ||
112 | |||
113 | printk("bi_intfreq\t 0x%8.8x\t clock:\t %dMhz\n", | ||
114 | bip->bi_intfreq, bip->bi_intfreq / 1000000); | ||
115 | |||
116 | printk("bi_busfreq\t 0x%8.8x\t plb bus clock:\t %dMHz\n", | ||
117 | bip->bi_busfreq, bip->bi_busfreq / 1000000); | ||
118 | printk("bi_tbfreq\t 0x%8.8x\t TB freq:\t %dMHz\n", | ||
119 | bip->bi_tbfreq, bip->bi_tbfreq / 1000000); | ||
120 | |||
121 | printk("\n"); | ||
122 | #endif | ||
123 | |||
124 | /* Identify the system */ | ||
125 | printk(KERN_INFO "IBM Redwood6 (STBx25XX) Platform\n"); | ||
126 | printk(KERN_INFO | ||
127 | "Port by MontaVista Software, Inc. (source@mvista.com)\n"); | ||
128 | |||
129 | device_initcall(redwood6_platform_add_devices); | ||
130 | } | ||
131 | |||
132 | void __init | ||
133 | redwood6_map_io(void) | ||
134 | { | ||
135 | int i; | ||
136 | |||
137 | ppc4xx_map_io(); | ||
138 | for (i = 0; i < 16; i++) { | ||
139 | unsigned long v, p; | ||
140 | |||
141 | /* 0x400x0000 -> 0xe00x0000 */ | ||
142 | p = 0x40000000 | (i << 16); | ||
143 | v = STBx25xx_IO_BASE | (i << 16); | ||
144 | |||
145 | io_block_mapping(v, p, PAGE_SIZE, | ||
146 | _PAGE_NO_CACHE | pgprot_val(PAGE_KERNEL) | | ||
147 | _PAGE_GUARDED); | ||
148 | } | ||
149 | } | ||
150 | |||
151 | void __init | ||
152 | platform_init(unsigned long r3, unsigned long r4, unsigned long r5, | ||
153 | unsigned long r6, unsigned long r7) | ||
154 | { | ||
155 | ppc4xx_init(r3, r4, r5, r6, r7); | ||
156 | |||
157 | ppc_md.setup_arch = redwood6_setup_arch; | ||
158 | ppc_md.setup_io_mappings = redwood6_map_io; | ||
159 | } | ||