]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/ppc/platforms/4xx/ibm440ep.c
Create platform_device.h to contain all the platform device details.
[mirror_ubuntu-artful-kernel.git] / arch / ppc / platforms / 4xx / ibm440ep.c
1 /*
2 * arch/ppc/platforms/4xx/ibm440ep.c
3 *
4 * PPC440EP I/O descriptions
5 *
6 * Wade Farnsworth <wfarnsworth@mvista.com>
7 * Copyright 2004 MontaVista Software Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15 #include <linux/init.h>
16 #include <linux/module.h>
17 #include <linux/platform_device.h>
18 #include <platforms/4xx/ibm440ep.h>
19 #include <asm/ocp.h>
20 #include <asm/ppc4xx_pic.h>
21
22 static struct ocp_func_emac_data ibm440ep_emac0_def = {
23 .rgmii_idx = -1, /* No RGMII */
24 .rgmii_mux = -1, /* No RGMII */
25 .zmii_idx = 0, /* ZMII device index */
26 .zmii_mux = 0, /* ZMII input of this EMAC */
27 .mal_idx = 0, /* MAL device index */
28 .mal_rx_chan = 0, /* MAL rx channel number */
29 .mal_tx_chan = 0, /* MAL tx channel number */
30 .wol_irq = 61, /* WOL interrupt number */
31 .mdio_idx = -1, /* No shared MDIO */
32 .tah_idx = -1, /* No TAH */
33 };
34
35 static struct ocp_func_emac_data ibm440ep_emac1_def = {
36 .rgmii_idx = -1, /* No RGMII */
37 .rgmii_mux = -1, /* No RGMII */
38 .zmii_idx = 0, /* ZMII device index */
39 .zmii_mux = 1, /* ZMII input of this EMAC */
40 .mal_idx = 0, /* MAL device index */
41 .mal_rx_chan = 1, /* MAL rx channel number */
42 .mal_tx_chan = 2, /* MAL tx channel number */
43 .wol_irq = 63, /* WOL interrupt number */
44 .mdio_idx = -1, /* No shared MDIO */
45 .tah_idx = -1, /* No TAH */
46 };
47 OCP_SYSFS_EMAC_DATA()
48
49 static struct ocp_func_mal_data ibm440ep_mal0_def = {
50 .num_tx_chans = 4, /* Number of TX channels */
51 .num_rx_chans = 2, /* Number of RX channels */
52 .txeob_irq = 10, /* TX End Of Buffer IRQ */
53 .rxeob_irq = 11, /* RX End Of Buffer IRQ */
54 .txde_irq = 33, /* TX Descriptor Error IRQ */
55 .rxde_irq = 34, /* RX Descriptor Error IRQ */
56 .serr_irq = 32, /* MAL System Error IRQ */
57 .dcr_base = DCRN_MAL_BASE /* MAL0_CFG DCR number */
58 };
59 OCP_SYSFS_MAL_DATA()
60
61 static struct ocp_func_iic_data ibm440ep_iic0_def = {
62 .fast_mode = 0, /* Use standad mode (100Khz) */
63 };
64
65 static struct ocp_func_iic_data ibm440ep_iic1_def = {
66 .fast_mode = 0, /* Use standad mode (100Khz) */
67 };
68 OCP_SYSFS_IIC_DATA()
69
70 struct ocp_def core_ocp[] = {
71 { .vendor = OCP_VENDOR_IBM,
72 .function = OCP_FUNC_OPB,
73 .index = 0,
74 .paddr = 0x0EF600000ULL,
75 .irq = OCP_IRQ_NA,
76 .pm = OCP_CPM_NA,
77 },
78 { .vendor = OCP_VENDOR_IBM,
79 .function = OCP_FUNC_16550,
80 .index = 0,
81 .paddr = PPC440EP_UART0_ADDR,
82 .irq = UART0_INT,
83 .pm = IBM_CPM_UART0,
84 },
85 { .vendor = OCP_VENDOR_IBM,
86 .function = OCP_FUNC_16550,
87 .index = 1,
88 .paddr = PPC440EP_UART1_ADDR,
89 .irq = UART1_INT,
90 .pm = IBM_CPM_UART1,
91 },
92 { .vendor = OCP_VENDOR_IBM,
93 .function = OCP_FUNC_16550,
94 .index = 2,
95 .paddr = PPC440EP_UART2_ADDR,
96 .irq = UART2_INT,
97 .pm = IBM_CPM_UART2,
98 },
99 { .vendor = OCP_VENDOR_IBM,
100 .function = OCP_FUNC_16550,
101 .index = 3,
102 .paddr = PPC440EP_UART3_ADDR,
103 .irq = UART3_INT,
104 .pm = IBM_CPM_UART3,
105 },
106 { .vendor = OCP_VENDOR_IBM,
107 .function = OCP_FUNC_IIC,
108 .index = 0,
109 .paddr = 0x0EF600700ULL,
110 .irq = 2,
111 .pm = IBM_CPM_IIC0,
112 .additions = &ibm440ep_iic0_def,
113 .show = &ocp_show_iic_data
114 },
115 { .vendor = OCP_VENDOR_IBM,
116 .function = OCP_FUNC_IIC,
117 .index = 1,
118 .paddr = 0x0EF600800ULL,
119 .irq = 7,
120 .pm = IBM_CPM_IIC1,
121 .additions = &ibm440ep_iic1_def,
122 .show = &ocp_show_iic_data
123 },
124 { .vendor = OCP_VENDOR_IBM,
125 .function = OCP_FUNC_GPIO,
126 .index = 0,
127 .paddr = 0x0EF600B00ULL,
128 .irq = OCP_IRQ_NA,
129 .pm = IBM_CPM_GPIO0,
130 },
131 { .vendor = OCP_VENDOR_IBM,
132 .function = OCP_FUNC_GPIO,
133 .index = 1,
134 .paddr = 0x0EF600C00ULL,
135 .irq = OCP_IRQ_NA,
136 .pm = OCP_CPM_NA,
137 },
138 { .vendor = OCP_VENDOR_IBM,
139 .function = OCP_FUNC_MAL,
140 .paddr = OCP_PADDR_NA,
141 .irq = OCP_IRQ_NA,
142 .pm = OCP_CPM_NA,
143 .additions = &ibm440ep_mal0_def,
144 .show = &ocp_show_mal_data,
145 },
146 { .vendor = OCP_VENDOR_IBM,
147 .function = OCP_FUNC_EMAC,
148 .index = 0,
149 .paddr = 0x0EF600E00ULL,
150 .irq = 60,
151 .pm = OCP_CPM_NA,
152 .additions = &ibm440ep_emac0_def,
153 .show = &ocp_show_emac_data,
154 },
155 { .vendor = OCP_VENDOR_IBM,
156 .function = OCP_FUNC_EMAC,
157 .index = 1,
158 .paddr = 0x0EF600F00ULL,
159 .irq = 62,
160 .pm = OCP_CPM_NA,
161 .additions = &ibm440ep_emac1_def,
162 .show = &ocp_show_emac_data,
163 },
164 { .vendor = OCP_VENDOR_IBM,
165 .function = OCP_FUNC_ZMII,
166 .paddr = 0x0EF600D00ULL,
167 .irq = OCP_IRQ_NA,
168 .pm = OCP_CPM_NA,
169 },
170 { .vendor = OCP_VENDOR_INVALID
171 }
172 };
173
174 /* Polarity and triggering settings for internal interrupt sources */
175 struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
176 { .polarity = 0xffbffe03,
177 .triggering = 0xfffffe00,
178 .ext_irq_mask = 0x000001fc, /* IRQ0 - IRQ6 */
179 },
180 { .polarity = 0xffffc6ef,
181 .triggering = 0xffffc7ff,
182 .ext_irq_mask = 0x00003800, /* IRQ7 - IRQ9 */
183 },
184 };
185
186 static struct resource usb_gadget_resources[] = {
187 [0] = {
188 .start = 0x050000100ULL,
189 .end = 0x05000017FULL,
190 .flags = IORESOURCE_MEM,
191 },
192 [1] = {
193 .start = 55,
194 .end = 55,
195 .flags = IORESOURCE_IRQ,
196 },
197 };
198
199 static u64 dma_mask = 0xffffffffULL;
200
201 static struct platform_device usb_gadget_device = {
202 .name = "musbhsfc",
203 .id = 0,
204 .num_resources = ARRAY_SIZE(usb_gadget_resources),
205 .resource = usb_gadget_resources,
206 .dev = {
207 .dma_mask = &dma_mask,
208 .coherent_dma_mask = 0xffffffffULL,
209 }
210 };
211
212 static struct platform_device *ibm440ep_devs[] __initdata = {
213 &usb_gadget_device,
214 };
215
216 static int __init
217 ibm440ep_platform_add_devices(void)
218 {
219 return platform_add_devices(ibm440ep_devs, ARRAY_SIZE(ibm440ep_devs));
220 }
221 arch_initcall(ibm440ep_platform_add_devices);
222