diff options
author | Manuel Lauss <manuel.lauss@googlemail.com> | 2011-11-10 07:06:21 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-12-07 17:02:06 -0500 |
commit | 7c4b24da07d99b5473de7cc7ba3f67d85b889bc0 (patch) | |
tree | ec1369de73ee0e682c07377b933706600a6725ff /arch/mips/alchemy/devboards/pb1550.c | |
parent | 8e026910fcd46c3cfcdf5cff7ebba013bb8ec85c (diff) |
MIPS: Alchemy: merge devboard code into single per-board files.
Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2884/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/alchemy/devboards/pb1550.c')
-rw-r--r-- | arch/mips/alchemy/devboards/pb1550.c | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/arch/mips/alchemy/devboards/pb1550.c b/arch/mips/alchemy/devboards/pb1550.c new file mode 100644 index 000000000000..e4a00a56a20f --- /dev/null +++ b/arch/mips/alchemy/devboards/pb1550.c | |||
@@ -0,0 +1,178 @@ | |||
1 | /* | ||
2 | * Pb1550 board support. | ||
3 | * | ||
4 | * Copyright (C) 2009-2011 Manuel Lauss | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/dma-mapping.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <asm/mach-au1x00/au1000.h> | ||
26 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | ||
27 | #include <asm/mach-au1x00/gpio.h> | ||
28 | #include <asm/mach-db1x00/bcsr.h> | ||
29 | #include "platform.h" | ||
30 | |||
31 | const char *get_system_type(void) | ||
32 | { | ||
33 | return "PB1550"; | ||
34 | } | ||
35 | |||
36 | void __init board_setup(void) | ||
37 | { | ||
38 | u32 pin_func; | ||
39 | |||
40 | bcsr_init(PB1550_BCSR_PHYS_ADDR, | ||
41 | PB1550_BCSR_PHYS_ADDR + PB1550_BCSR_HEXLED_OFS); | ||
42 | |||
43 | alchemy_gpio2_enable(); | ||
44 | |||
45 | /* | ||
46 | * Enable PSC1 SYNC for AC'97. Normaly done in audio driver, | ||
47 | * but it is board specific code, so put it here. | ||
48 | */ | ||
49 | pin_func = au_readl(SYS_PINFUNC); | ||
50 | au_sync(); | ||
51 | pin_func |= SYS_PF_MUST_BE_SET | SYS_PF_PSC1_S1; | ||
52 | au_writel(pin_func, SYS_PINFUNC); | ||
53 | |||
54 | bcsr_write(BCSR_PCMCIA, 0); /* turn off PCMCIA power */ | ||
55 | |||
56 | printk(KERN_INFO "AMD Alchemy Pb1550 Board\n"); | ||
57 | } | ||
58 | |||
59 | /******************************************************************************/ | ||
60 | |||
61 | static int pb1550_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
62 | { | ||
63 | if ((slot < 12) || (slot > 13) || pin == 0) | ||
64 | return -1; | ||
65 | if (slot == 12) { | ||
66 | switch (pin) { | ||
67 | case 1: return AU1500_PCI_INTB; | ||
68 | case 2: return AU1500_PCI_INTC; | ||
69 | case 3: return AU1500_PCI_INTD; | ||
70 | case 4: return AU1500_PCI_INTA; | ||
71 | } | ||
72 | } | ||
73 | if (slot == 13) { | ||
74 | switch (pin) { | ||
75 | case 1: return AU1500_PCI_INTA; | ||
76 | case 2: return AU1500_PCI_INTB; | ||
77 | case 3: return AU1500_PCI_INTC; | ||
78 | case 4: return AU1500_PCI_INTD; | ||
79 | } | ||
80 | } | ||
81 | return -1; | ||
82 | } | ||
83 | |||
84 | static struct resource alchemy_pci_host_res[] = { | ||
85 | [0] = { | ||
86 | .start = AU1500_PCI_PHYS_ADDR, | ||
87 | .end = AU1500_PCI_PHYS_ADDR + 0xfff, | ||
88 | .flags = IORESOURCE_MEM, | ||
89 | }, | ||
90 | }; | ||
91 | |||
92 | static struct alchemy_pci_platdata pb1550_pci_pd = { | ||
93 | .board_map_irq = pb1550_map_pci_irq, | ||
94 | }; | ||
95 | |||
96 | static struct platform_device pb1550_pci_host = { | ||
97 | .dev.platform_data = &pb1550_pci_pd, | ||
98 | .name = "alchemy-pci", | ||
99 | .id = 0, | ||
100 | .num_resources = ARRAY_SIZE(alchemy_pci_host_res), | ||
101 | .resource = alchemy_pci_host_res, | ||
102 | }; | ||
103 | |||
104 | static struct resource au1550_psc2_res[] = { | ||
105 | [0] = { | ||
106 | .start = AU1550_PSC2_PHYS_ADDR, | ||
107 | .end = AU1550_PSC2_PHYS_ADDR + 0xfff, | ||
108 | .flags = IORESOURCE_MEM, | ||
109 | }, | ||
110 | [1] = { | ||
111 | .start = AU1550_PSC2_INT, | ||
112 | .end = AU1550_PSC2_INT, | ||
113 | .flags = IORESOURCE_IRQ, | ||
114 | }, | ||
115 | [2] = { | ||
116 | .start = AU1550_DSCR_CMD0_PSC2_TX, | ||
117 | .end = AU1550_DSCR_CMD0_PSC2_TX, | ||
118 | .flags = IORESOURCE_DMA, | ||
119 | }, | ||
120 | [3] = { | ||
121 | .start = AU1550_DSCR_CMD0_PSC2_RX, | ||
122 | .end = AU1550_DSCR_CMD0_PSC2_RX, | ||
123 | .flags = IORESOURCE_DMA, | ||
124 | }, | ||
125 | }; | ||
126 | |||
127 | static struct platform_device pb1550_i2c_dev = { | ||
128 | .name = "au1xpsc_smbus", | ||
129 | .id = 0, /* bus number */ | ||
130 | .num_resources = ARRAY_SIZE(au1550_psc2_res), | ||
131 | .resource = au1550_psc2_res, | ||
132 | }; | ||
133 | |||
134 | static int __init pb1550_dev_init(void) | ||
135 | { | ||
136 | int swapped; | ||
137 | |||
138 | irq_set_irq_type(AU1550_GPIO0_INT, IRQF_TRIGGER_LOW); | ||
139 | irq_set_irq_type(AU1550_GPIO1_INT, IRQF_TRIGGER_LOW); | ||
140 | irq_set_irq_type(AU1550_GPIO201_205_INT, IRQF_TRIGGER_HIGH); | ||
141 | |||
142 | /* enable both PCMCIA card irqs in the shared line */ | ||
143 | alchemy_gpio2_enable_int(201); | ||
144 | alchemy_gpio2_enable_int(202); | ||
145 | |||
146 | /* Pb1550, like all others, also has statuschange irqs; however they're | ||
147 | * wired up on one of the Au1550's shared GPIO201_205 line, which also | ||
148 | * services the PCMCIA card interrupts. So we ignore statuschange and | ||
149 | * use the GPIO201_205 exclusively for card interrupts, since a) pcmcia | ||
150 | * drivers are used to shared irqs and b) statuschange isn't really use- | ||
151 | * ful anyway. | ||
152 | */ | ||
153 | db1x_register_pcmcia_socket( | ||
154 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
155 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
156 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
157 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
158 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
159 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | ||
160 | AU1550_GPIO201_205_INT, AU1550_GPIO0_INT, 0, 0, 0); | ||
161 | |||
162 | db1x_register_pcmcia_socket( | ||
163 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x008000000, | ||
164 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x008400000 - 1, | ||
165 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x008000000, | ||
166 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x008400000 - 1, | ||
167 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x008000000, | ||
168 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x008010000 - 1, | ||
169 | AU1550_GPIO201_205_INT, AU1550_GPIO1_INT, 0, 0, 1); | ||
170 | |||
171 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_PB1550_SWAPBOOT; | ||
172 | db1x_register_norflash(128 * 1024 * 1024, 4, swapped); | ||
173 | platform_device_register(&pb1550_pci_host); | ||
174 | platform_device_register(&pb1550_i2c_dev); | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | arch_initcall(pb1550_dev_init); | ||