MIPS: Delete unused function add_temporary_entry.
[deliverable/linux.git] / arch / mips / alchemy / devboards / pb1550 / platform.c
1 /*
2 * Pb1550 board platform device registration
3 *
4 * Copyright (C) 2009 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/platform_device.h>
24 #include <asm/mach-au1x00/au1000.h>
25 #include <asm/mach-au1x00/au1xxx_dbdma.h>
26 #include <asm/mach-pb1x00/pb1550.h>
27 #include <asm/mach-db1x00/bcsr.h>
28
29 #include "../platform.h"
30
31 static int pb1550_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin)
32 {
33 if ((slot < 12) || (slot > 13) || pin == 0)
34 return -1;
35 if (slot == 12) {
36 switch (pin) {
37 case 1: return AU1500_PCI_INTB;
38 case 2: return AU1500_PCI_INTC;
39 case 3: return AU1500_PCI_INTD;
40 case 4: return AU1500_PCI_INTA;
41 }
42 }
43 if (slot == 13) {
44 switch (pin) {
45 case 1: return AU1500_PCI_INTA;
46 case 2: return AU1500_PCI_INTB;
47 case 3: return AU1500_PCI_INTC;
48 case 4: return AU1500_PCI_INTD;
49 }
50 }
51 return -1;
52 }
53
54 static struct resource alchemy_pci_host_res[] = {
55 [0] = {
56 .start = AU1500_PCI_PHYS_ADDR,
57 .end = AU1500_PCI_PHYS_ADDR + 0xfff,
58 .flags = IORESOURCE_MEM,
59 },
60 };
61
62 static struct alchemy_pci_platdata pb1550_pci_pd = {
63 .board_map_irq = pb1550_map_pci_irq,
64 };
65
66 static struct platform_device pb1550_pci_host = {
67 .dev.platform_data = &pb1550_pci_pd,
68 .name = "alchemy-pci",
69 .id = 0,
70 .num_resources = ARRAY_SIZE(alchemy_pci_host_res),
71 .resource = alchemy_pci_host_res,
72 };
73
74 static struct resource au1550_psc2_res[] = {
75 [0] = {
76 .start = AU1550_PSC2_PHYS_ADDR,
77 .end = AU1550_PSC2_PHYS_ADDR + 0xfff,
78 .flags = IORESOURCE_MEM,
79 },
80 [1] = {
81 .start = AU1550_PSC2_INT,
82 .end = AU1550_PSC2_INT,
83 .flags = IORESOURCE_IRQ,
84 },
85 [2] = {
86 .start = AU1550_DSCR_CMD0_PSC2_TX,
87 .end = AU1550_DSCR_CMD0_PSC2_TX,
88 .flags = IORESOURCE_DMA,
89 },
90 [3] = {
91 .start = AU1550_DSCR_CMD0_PSC2_RX,
92 .end = AU1550_DSCR_CMD0_PSC2_RX,
93 .flags = IORESOURCE_DMA,
94 },
95 };
96
97 static struct platform_device pb1550_i2c_dev = {
98 .name = "au1xpsc_smbus",
99 .id = 0, /* bus number */
100 .num_resources = ARRAY_SIZE(au1550_psc2_res),
101 .resource = au1550_psc2_res,
102 };
103
104 static int __init pb1550_dev_init(void)
105 {
106 int swapped;
107
108 /* Pb1550, like all others, also has statuschange irqs; however they're
109 * wired up on one of the Au1550's shared GPIO201_205 line, which also
110 * services the PCMCIA card interrupts. So we ignore statuschange and
111 * use the GPIO201_205 exclusively for card interrupts, since a) pcmcia
112 * drivers are used to shared irqs and b) statuschange isn't really use-
113 * ful anyway.
114 */
115 db1x_register_pcmcia_socket(
116 AU1000_PCMCIA_ATTR_PHYS_ADDR,
117 AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
118 AU1000_PCMCIA_MEM_PHYS_ADDR,
119 AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1,
120 AU1000_PCMCIA_IO_PHYS_ADDR,
121 AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1,
122 AU1550_GPIO201_205_INT, AU1550_GPIO0_INT, 0, 0, 0);
123
124 db1x_register_pcmcia_socket(
125 AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x008000000,
126 AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x008400000 - 1,
127 AU1000_PCMCIA_MEM_PHYS_ADDR + 0x008000000,
128 AU1000_PCMCIA_MEM_PHYS_ADDR + 0x008400000 - 1,
129 AU1000_PCMCIA_IO_PHYS_ADDR + 0x008000000,
130 AU1000_PCMCIA_IO_PHYS_ADDR + 0x008010000 - 1,
131 AU1550_GPIO201_205_INT, AU1550_GPIO1_INT, 0, 0, 1);
132
133 swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_PB1550_SWAPBOOT;
134 db1x_register_norflash(128 * 1024 * 1024, 4, swapped);
135 platform_device_register(&pb1550_pci_host);
136 platform_device_register(&pb1550_i2c_dev);
137
138 return 0;
139 }
140 arch_initcall(pb1550_dev_init);
This page took 0.032864 seconds and 5 git commands to generate.