diff options
author | Alessandro Rubini <rubini@gnudd.com> | 2012-04-12 04:48:44 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-05-09 09:34:28 -0400 |
commit | 35bdd29095ad614c5fb4a934bfd4f57a94dfd395 (patch) | |
tree | 26db4b35f5f05d4a160235aa02ba5cb579c5f2f9 | |
parent | ceb57d27e28a8f979cbfd6391b7da6da51484059 (diff) |
mfd: Add driver for STA2X11 MFD block
This also introduces <asm/sta2x11.h> to export a function that is in
the base sta2x11 support patches. The header will increase with other
prototypes and constants over time.
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | arch/x86/include/asm/sta2x11.h | 12 | ||||
-rw-r--r-- | drivers/mfd/Kconfig | 5 | ||||
-rw-r--r-- | drivers/mfd/Makefile | 1 | ||||
-rw-r--r-- | drivers/mfd/sta2x11-mfd.c | 467 | ||||
-rw-r--r-- | include/linux/mfd/sta2x11-mfd.h | 324 |
5 files changed, 809 insertions, 0 deletions
diff --git a/arch/x86/include/asm/sta2x11.h b/arch/x86/include/asm/sta2x11.h new file mode 100644 index 000000000000..e9d32df89ccc --- /dev/null +++ b/arch/x86/include/asm/sta2x11.h | |||
@@ -0,0 +1,12 @@ | |||
1 | /* | ||
2 | * Header file for STMicroelectronics ConneXt (STA2X11) IOHub | ||
3 | */ | ||
4 | #ifndef __ASM_STA2X11_H | ||
5 | #define __ASM_STA2X11_H | ||
6 | |||
7 | #include <linux/pci.h> | ||
8 | |||
9 | /* This needs to be called from the MFD to configure its sub-devices */ | ||
10 | struct sta2x11_instance *sta2x11_get_instance(struct pci_dev *pdev); | ||
11 | |||
12 | #endif /* __ASM_STA2X11_H */ | ||
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index ef86a741b7e2..48eed22c65a5 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -906,6 +906,11 @@ config MFD_RC5T583 | |||
906 | Additional drivers must be enabled in order to use the | 906 | Additional drivers must be enabled in order to use the |
907 | different functionality of the device. | 907 | different functionality of the device. |
908 | 908 | ||
909 | config MFD_STA2X11 | ||
910 | bool "STA2X11 multi function device support" | ||
911 | depends on STA2X11 | ||
912 | select MFD_CORE | ||
913 | |||
909 | config MFD_ANATOP | 914 | config MFD_ANATOP |
910 | bool "Support for Freescale i.MX on-chip ANATOP controller" | 915 | bool "Support for Freescale i.MX on-chip ANATOP controller" |
911 | depends on SOC_IMX6Q | 916 | depends on SOC_IMX6Q |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 5dd6be7aa350..0dc55cbefa09 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -15,6 +15,7 @@ obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o | |||
15 | obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o | 15 | obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o |
16 | obj-$(CONFIG_MFD_TI_SSP) += ti-ssp.o | 16 | obj-$(CONFIG_MFD_TI_SSP) += ti-ssp.o |
17 | 17 | ||
18 | obj-$(CONFIG_MFD_STA2X11) += sta2x11-mfd.o | ||
18 | obj-$(CONFIG_MFD_STMPE) += stmpe.o | 19 | obj-$(CONFIG_MFD_STMPE) += stmpe.o |
19 | obj-$(CONFIG_STMPE_I2C) += stmpe-i2c.o | 20 | obj-$(CONFIG_STMPE_I2C) += stmpe-i2c.o |
20 | obj-$(CONFIG_STMPE_SPI) += stmpe-spi.o | 21 | obj-$(CONFIG_STMPE_SPI) += stmpe-spi.o |
diff --git a/drivers/mfd/sta2x11-mfd.c b/drivers/mfd/sta2x11-mfd.c new file mode 100644 index 000000000000..d31fed07aefb --- /dev/null +++ b/drivers/mfd/sta2x11-mfd.c | |||
@@ -0,0 +1,467 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2009-2011 Wind River Systems, Inc. | ||
3 | * Copyright (c) 2011 ST Microelectronics (Alessandro Rubini) | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | * See the GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/device.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/list.h> | ||
27 | #include <linux/io.h> | ||
28 | #include <linux/ioport.h> | ||
29 | #include <linux/pci.h> | ||
30 | #include <linux/debugfs.h> | ||
31 | #include <linux/seq_file.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | #include <linux/mfd/core.h> | ||
34 | #include <linux/mfd/sta2x11-mfd.h> | ||
35 | |||
36 | #include <asm/sta2x11.h> | ||
37 | |||
38 | /* This describes STA2X11 MFD chip for us, we may have several */ | ||
39 | struct sta2x11_mfd { | ||
40 | struct sta2x11_instance *instance; | ||
41 | spinlock_t lock; | ||
42 | struct list_head list; | ||
43 | void __iomem *sctl_regs; | ||
44 | void __iomem *apbreg_regs; | ||
45 | }; | ||
46 | |||
47 | static LIST_HEAD(sta2x11_mfd_list); | ||
48 | |||
49 | /* Three functions to act on the list */ | ||
50 | static struct sta2x11_mfd *sta2x11_mfd_find(struct pci_dev *pdev) | ||
51 | { | ||
52 | struct sta2x11_instance *instance; | ||
53 | struct sta2x11_mfd *mfd; | ||
54 | |||
55 | if (!pdev && !list_empty(&sta2x11_mfd_list)) { | ||
56 | pr_warning("%s: Unspecified device, " | ||
57 | "using first instance\n", __func__); | ||
58 | return list_entry(sta2x11_mfd_list.next, | ||
59 | struct sta2x11_mfd, list); | ||
60 | } | ||
61 | |||
62 | instance = sta2x11_get_instance(pdev); | ||
63 | if (!instance) | ||
64 | return NULL; | ||
65 | list_for_each_entry(mfd, &sta2x11_mfd_list, list) { | ||
66 | if (mfd->instance == instance) | ||
67 | return mfd; | ||
68 | } | ||
69 | return NULL; | ||
70 | } | ||
71 | |||
72 | static int __devinit sta2x11_mfd_add(struct pci_dev *pdev, gfp_t flags) | ||
73 | { | ||
74 | struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev); | ||
75 | struct sta2x11_instance *instance; | ||
76 | |||
77 | if (mfd) | ||
78 | return -EBUSY; | ||
79 | instance = sta2x11_get_instance(pdev); | ||
80 | if (!instance) | ||
81 | return -EINVAL; | ||
82 | mfd = kzalloc(sizeof(*mfd), flags); | ||
83 | if (!mfd) | ||
84 | return -ENOMEM; | ||
85 | INIT_LIST_HEAD(&mfd->list); | ||
86 | spin_lock_init(&mfd->lock); | ||
87 | mfd->instance = instance; | ||
88 | list_add(&mfd->list, &sta2x11_mfd_list); | ||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | static int __devexit mfd_remove(struct pci_dev *pdev) | ||
93 | { | ||
94 | struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev); | ||
95 | |||
96 | if (!mfd) | ||
97 | return -ENODEV; | ||
98 | list_del(&mfd->list); | ||
99 | kfree(mfd); | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | /* These two functions are exported and are not expected to fail */ | ||
104 | u32 sta2x11_sctl_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val) | ||
105 | { | ||
106 | struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev); | ||
107 | u32 r; | ||
108 | unsigned long flags; | ||
109 | |||
110 | if (!mfd) { | ||
111 | dev_warn(&pdev->dev, ": can't access sctl regs\n"); | ||
112 | return 0; | ||
113 | } | ||
114 | if (!mfd->sctl_regs) { | ||
115 | dev_warn(&pdev->dev, ": system ctl not initialized\n"); | ||
116 | return 0; | ||
117 | } | ||
118 | spin_lock_irqsave(&mfd->lock, flags); | ||
119 | r = readl(mfd->sctl_regs + reg); | ||
120 | r &= ~mask; | ||
121 | r |= val; | ||
122 | if (mask) | ||
123 | writel(r, mfd->sctl_regs + reg); | ||
124 | spin_unlock_irqrestore(&mfd->lock, flags); | ||
125 | return r; | ||
126 | } | ||
127 | EXPORT_SYMBOL(sta2x11_sctl_mask); | ||
128 | |||
129 | u32 sta2x11_apbreg_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val) | ||
130 | { | ||
131 | struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev); | ||
132 | u32 r; | ||
133 | unsigned long flags; | ||
134 | |||
135 | if (!mfd) { | ||
136 | dev_warn(&pdev->dev, ": can't access apb regs\n"); | ||
137 | return 0; | ||
138 | } | ||
139 | if (!mfd->apbreg_regs) { | ||
140 | dev_warn(&pdev->dev, ": apb bridge not initialized\n"); | ||
141 | return 0; | ||
142 | } | ||
143 | spin_lock_irqsave(&mfd->lock, flags); | ||
144 | r = readl(mfd->apbreg_regs + reg); | ||
145 | r &= ~mask; | ||
146 | r |= val; | ||
147 | if (mask) | ||
148 | writel(r, mfd->apbreg_regs + reg); | ||
149 | spin_unlock_irqrestore(&mfd->lock, flags); | ||
150 | return r; | ||
151 | } | ||
152 | EXPORT_SYMBOL(sta2x11_apbreg_mask); | ||
153 | |||
154 | /* Two debugfs files, for our registers (FIXME: one instance only) */ | ||
155 | #define REG(regname) {.name = #regname, .offset = SCTL_ ## regname} | ||
156 | static struct debugfs_reg32 sta2x11_sctl_regs[] = { | ||
157 | REG(SCCTL), REG(ARMCFG), REG(SCPLLCTL), REG(SCPLLFCTRL), | ||
158 | REG(SCRESFRACT), REG(SCRESCTRL1), REG(SCRESXTRL2), REG(SCPEREN0), | ||
159 | REG(SCPEREN1), REG(SCPEREN2), REG(SCGRST), REG(SCPCIPMCR1), | ||
160 | REG(SCPCIPMCR2), REG(SCPCIPMSR1), REG(SCPCIPMSR2), REG(SCPCIPMSR3), | ||
161 | REG(SCINTREN), REG(SCRISR), REG(SCCLKSTAT0), REG(SCCLKSTAT1), | ||
162 | REG(SCCLKSTAT2), REG(SCRSTSTA), | ||
163 | }; | ||
164 | #undef REG | ||
165 | |||
166 | static struct debugfs_regset32 sctl_regset = { | ||
167 | .regs = sta2x11_sctl_regs, | ||
168 | .nregs = ARRAY_SIZE(sta2x11_sctl_regs), | ||
169 | }; | ||
170 | |||
171 | #define REG(regname) {.name = #regname, .offset = regname} | ||
172 | static struct debugfs_reg32 sta2x11_apbreg_regs[] = { | ||
173 | REG(APBREG_BSR), REG(APBREG_PAER), REG(APBREG_PWAC), REG(APBREG_PRAC), | ||
174 | REG(APBREG_PCG), REG(APBREG_PUR), REG(APBREG_EMU_PCG), | ||
175 | }; | ||
176 | #undef REG | ||
177 | |||
178 | static struct debugfs_regset32 apbreg_regset = { | ||
179 | .regs = sta2x11_apbreg_regs, | ||
180 | .nregs = ARRAY_SIZE(sta2x11_apbreg_regs), | ||
181 | }; | ||
182 | |||
183 | static struct dentry *sta2x11_sctl_debugfs; | ||
184 | static struct dentry *sta2x11_apbreg_debugfs; | ||
185 | |||
186 | /* Probe for the two platform devices */ | ||
187 | static int sta2x11_sctl_probe(struct platform_device *dev) | ||
188 | { | ||
189 | struct pci_dev **pdev; | ||
190 | struct sta2x11_mfd *mfd; | ||
191 | struct resource *res; | ||
192 | |||
193 | pdev = dev->dev.platform_data; | ||
194 | mfd = sta2x11_mfd_find(*pdev); | ||
195 | if (!mfd) | ||
196 | return -ENODEV; | ||
197 | |||
198 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
199 | if (!res) | ||
200 | return -ENOMEM; | ||
201 | |||
202 | if (!request_mem_region(res->start, resource_size(res), | ||
203 | "sta2x11-sctl")) | ||
204 | return -EBUSY; | ||
205 | |||
206 | mfd->sctl_regs = ioremap(res->start, resource_size(res)); | ||
207 | if (!mfd->sctl_regs) { | ||
208 | release_mem_region(res->start, resource_size(res)); | ||
209 | return -ENOMEM; | ||
210 | } | ||
211 | sctl_regset.base = mfd->sctl_regs; | ||
212 | sta2x11_sctl_debugfs = debugfs_create_regset32("sta2x11-sctl", | ||
213 | S_IFREG | S_IRUGO, | ||
214 | NULL, &sctl_regset); | ||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | static int sta2x11_apbreg_probe(struct platform_device *dev) | ||
219 | { | ||
220 | struct pci_dev **pdev; | ||
221 | struct sta2x11_mfd *mfd; | ||
222 | struct resource *res; | ||
223 | |||
224 | pdev = dev->dev.platform_data; | ||
225 | dev_dbg(&dev->dev, "%s: pdata is %p\n", __func__, pdev); | ||
226 | dev_dbg(&dev->dev, "%s: *pdata is %p\n", __func__, *pdev); | ||
227 | |||
228 | mfd = sta2x11_mfd_find(*pdev); | ||
229 | if (!mfd) | ||
230 | return -ENODEV; | ||
231 | |||
232 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
233 | if (!res) | ||
234 | return -ENOMEM; | ||
235 | |||
236 | if (!request_mem_region(res->start, resource_size(res), | ||
237 | "sta2x11-apbreg")) | ||
238 | return -EBUSY; | ||
239 | |||
240 | mfd->apbreg_regs = ioremap(res->start, resource_size(res)); | ||
241 | if (!mfd->apbreg_regs) { | ||
242 | release_mem_region(res->start, resource_size(res)); | ||
243 | return -ENOMEM; | ||
244 | } | ||
245 | dev_dbg(&dev->dev, "%s: regbase %p\n", __func__, mfd->apbreg_regs); | ||
246 | |||
247 | apbreg_regset.base = mfd->apbreg_regs; | ||
248 | sta2x11_apbreg_debugfs = debugfs_create_regset32("sta2x11-apbreg", | ||
249 | S_IFREG | S_IRUGO, | ||
250 | NULL, &apbreg_regset); | ||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | /* The two platform drivers */ | ||
255 | static struct platform_driver sta2x11_sctl_platform_driver = { | ||
256 | .driver = { | ||
257 | .name = "sta2x11-sctl", | ||
258 | .owner = THIS_MODULE, | ||
259 | }, | ||
260 | .probe = sta2x11_sctl_probe, | ||
261 | }; | ||
262 | |||
263 | static int __init sta2x11_sctl_init(void) | ||
264 | { | ||
265 | pr_info("%s\n", __func__); | ||
266 | return platform_driver_register(&sta2x11_sctl_platform_driver); | ||
267 | } | ||
268 | |||
269 | static struct platform_driver sta2x11_platform_driver = { | ||
270 | .driver = { | ||
271 | .name = "sta2x11-apbreg", | ||
272 | .owner = THIS_MODULE, | ||
273 | }, | ||
274 | .probe = sta2x11_apbreg_probe, | ||
275 | }; | ||
276 | |||
277 | static int __init sta2x11_apbreg_init(void) | ||
278 | { | ||
279 | pr_info("%s\n", __func__); | ||
280 | return platform_driver_register(&sta2x11_platform_driver); | ||
281 | } | ||
282 | |||
283 | /* | ||
284 | * What follows is the PCI device that hosts the above two pdevs. | ||
285 | * Each logic block is 4kB and they are all consecutive: we use this info. | ||
286 | */ | ||
287 | |||
288 | /* Bar 0 */ | ||
289 | enum bar0_cells { | ||
290 | STA2X11_GPIO_0 = 0, | ||
291 | STA2X11_GPIO_1, | ||
292 | STA2X11_GPIO_2, | ||
293 | STA2X11_GPIO_3, | ||
294 | STA2X11_SCTL, | ||
295 | STA2X11_SCR, | ||
296 | STA2X11_TIME, | ||
297 | }; | ||
298 | /* Bar 1 */ | ||
299 | enum bar1_cells { | ||
300 | STA2X11_APBREG = 0, | ||
301 | }; | ||
302 | #define CELL_4K(_name, _cell) { \ | ||
303 | .name = _name, \ | ||
304 | .start = _cell * 4096, .end = _cell * 4096 + 4095, \ | ||
305 | .flags = IORESOURCE_MEM, \ | ||
306 | } | ||
307 | |||
308 | static const __devinitconst struct resource gpio_resources[] = { | ||
309 | { | ||
310 | .name = "sta2x11_gpio", /* 4 consecutive cells, 1 driver */ | ||
311 | .start = 0, | ||
312 | .end = (4 * 4096) - 1, | ||
313 | .flags = IORESOURCE_MEM, | ||
314 | } | ||
315 | }; | ||
316 | static const __devinitconst struct resource sctl_resources[] = { | ||
317 | CELL_4K("sta2x11-sctl", STA2X11_SCTL), | ||
318 | }; | ||
319 | static const __devinitconst struct resource scr_resources[] = { | ||
320 | CELL_4K("sta2x11-scr", STA2X11_SCR), | ||
321 | }; | ||
322 | static const __devinitconst struct resource time_resources[] = { | ||
323 | CELL_4K("sta2x11-time", STA2X11_TIME), | ||
324 | }; | ||
325 | |||
326 | static const __devinitconst struct resource apbreg_resources[] = { | ||
327 | CELL_4K("sta2x11-apbreg", STA2X11_APBREG), | ||
328 | }; | ||
329 | |||
330 | #define DEV(_name, _r) \ | ||
331 | { .name = _name, .num_resources = ARRAY_SIZE(_r), .resources = _r, } | ||
332 | |||
333 | static __devinitdata struct mfd_cell sta2x11_mfd_bar0[] = { | ||
334 | DEV("sta2x11-gpio", gpio_resources), /* offset 0: we add pdata later */ | ||
335 | DEV("sta2x11-sctl", sctl_resources), | ||
336 | DEV("sta2x11-scr", scr_resources), | ||
337 | DEV("sta2x11-time", time_resources), | ||
338 | }; | ||
339 | |||
340 | static __devinitdata struct mfd_cell sta2x11_mfd_bar1[] = { | ||
341 | DEV("sta2x11-apbreg", apbreg_resources), | ||
342 | }; | ||
343 | |||
344 | static int sta2x11_mfd_suspend(struct pci_dev *pdev, pm_message_t state) | ||
345 | { | ||
346 | pci_save_state(pdev); | ||
347 | pci_disable_device(pdev); | ||
348 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
349 | |||
350 | return 0; | ||
351 | } | ||
352 | |||
353 | static int sta2x11_mfd_resume(struct pci_dev *pdev) | ||
354 | { | ||
355 | int err; | ||
356 | |||
357 | pci_set_power_state(pdev, 0); | ||
358 | err = pci_enable_device(pdev); | ||
359 | if (err) | ||
360 | return err; | ||
361 | pci_restore_state(pdev); | ||
362 | |||
363 | return 0; | ||
364 | } | ||
365 | |||
366 | static int __devinit sta2x11_mfd_probe(struct pci_dev *pdev, | ||
367 | const struct pci_device_id *pci_id) | ||
368 | { | ||
369 | int err, i; | ||
370 | struct sta2x11_gpio_pdata *gpio_data; | ||
371 | |||
372 | dev_info(&pdev->dev, "%s\n", __func__); | ||
373 | |||
374 | err = pci_enable_device(pdev); | ||
375 | if (err) { | ||
376 | dev_err(&pdev->dev, "Can't enable device.\n"); | ||
377 | return err; | ||
378 | } | ||
379 | |||
380 | err = pci_enable_msi(pdev); | ||
381 | if (err) | ||
382 | dev_info(&pdev->dev, "Enable msi failed\n"); | ||
383 | |||
384 | /* Read gpio config data as pci device's platform data */ | ||
385 | gpio_data = dev_get_platdata(&pdev->dev); | ||
386 | if (!gpio_data) | ||
387 | dev_warn(&pdev->dev, "no gpio configuration\n"); | ||
388 | |||
389 | dev_dbg(&pdev->dev, "%s, gpio_data = %p (%p)\n", __func__, | ||
390 | gpio_data, &gpio_data); | ||
391 | dev_dbg(&pdev->dev, "%s, pdev = %p (%p)\n", __func__, | ||
392 | pdev, &pdev); | ||
393 | |||
394 | /* platform data is the pci device for all of them */ | ||
395 | for (i = 0; i < ARRAY_SIZE(sta2x11_mfd_bar0); i++) { | ||
396 | sta2x11_mfd_bar0[i].pdata_size = sizeof(pdev); | ||
397 | sta2x11_mfd_bar0[i].platform_data = &pdev; | ||
398 | } | ||
399 | sta2x11_mfd_bar1[0].pdata_size = sizeof(pdev); | ||
400 | sta2x11_mfd_bar1[0].platform_data = &pdev; | ||
401 | |||
402 | /* Record this pdev before mfd_add_devices: their probe looks for it */ | ||
403 | sta2x11_mfd_add(pdev, GFP_ATOMIC); | ||
404 | |||
405 | |||
406 | err = mfd_add_devices(&pdev->dev, -1, | ||
407 | sta2x11_mfd_bar0, | ||
408 | ARRAY_SIZE(sta2x11_mfd_bar0), | ||
409 | &pdev->resource[0], | ||
410 | 0); | ||
411 | if (err) { | ||
412 | dev_err(&pdev->dev, "mfd_add_devices[0] failed: %d\n", err); | ||
413 | goto err_disable; | ||
414 | } | ||
415 | |||
416 | err = mfd_add_devices(&pdev->dev, -1, | ||
417 | sta2x11_mfd_bar1, | ||
418 | ARRAY_SIZE(sta2x11_mfd_bar1), | ||
419 | &pdev->resource[1], | ||
420 | 0); | ||
421 | if (err) { | ||
422 | dev_err(&pdev->dev, "mfd_add_devices[1] failed: %d\n", err); | ||
423 | goto err_disable; | ||
424 | } | ||
425 | |||
426 | return 0; | ||
427 | |||
428 | err_disable: | ||
429 | mfd_remove_devices(&pdev->dev); | ||
430 | pci_disable_device(pdev); | ||
431 | pci_disable_msi(pdev); | ||
432 | return err; | ||
433 | } | ||
434 | |||
435 | static DEFINE_PCI_DEVICE_TABLE(sta2x11_mfd_tbl) = { | ||
436 | {PCI_DEVICE(PCI_VENDOR_ID_STMICRO, PCI_DEVICE_ID_STMICRO_GPIO)}, | ||
437 | {0,}, | ||
438 | }; | ||
439 | |||
440 | static struct pci_driver sta2x11_mfd_driver = { | ||
441 | .name = "sta2x11-mfd", | ||
442 | .id_table = sta2x11_mfd_tbl, | ||
443 | .probe = sta2x11_mfd_probe, | ||
444 | .suspend = sta2x11_mfd_suspend, | ||
445 | .resume = sta2x11_mfd_resume, | ||
446 | }; | ||
447 | |||
448 | static int __init sta2x11_mfd_init(void) | ||
449 | { | ||
450 | pr_info("%s\n", __func__); | ||
451 | return pci_register_driver(&sta2x11_mfd_driver); | ||
452 | } | ||
453 | |||
454 | /* | ||
455 | * All of this must be ready before "normal" devices like MMCI appear. | ||
456 | * But MFD (the pci device) can't be too early. The following choice | ||
457 | * prepares platform drivers very early and probe the PCI device later, | ||
458 | * but before other PCI devices. | ||
459 | */ | ||
460 | subsys_initcall(sta2x11_apbreg_init); | ||
461 | subsys_initcall(sta2x11_sctl_init); | ||
462 | rootfs_initcall(sta2x11_mfd_init); | ||
463 | |||
464 | MODULE_LICENSE("GPL v2"); | ||
465 | MODULE_AUTHOR("Wind River"); | ||
466 | MODULE_DESCRIPTION("STA2x11 mfd for GPIO, SCTL and APBREG"); | ||
467 | MODULE_DEVICE_TABLE(pci, sta2x11_mfd_tbl); | ||
diff --git a/include/linux/mfd/sta2x11-mfd.h b/include/linux/mfd/sta2x11-mfd.h new file mode 100644 index 000000000000..d179227e866f --- /dev/null +++ b/include/linux/mfd/sta2x11-mfd.h | |||
@@ -0,0 +1,324 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2009-2011 Wind River Systems, Inc. | ||
3 | * Copyright (c) 2011 ST Microelectronics (Alessandro Rubini) | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | * See the GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | * | ||
18 | * The STMicroelectronics ConneXt (STA2X11) chip has several unrelated | ||
19 | * functions in one PCI endpoint functions. This driver simply | ||
20 | * registers the platform devices in this iomemregion and exports a few | ||
21 | * functions to access common registers | ||
22 | */ | ||
23 | |||
24 | #ifndef __STA2X11_MFD_H | ||
25 | #define __STA2X11_MFD_H | ||
26 | #include <linux/types.h> | ||
27 | #include <linux/pci.h> | ||
28 | |||
29 | /* | ||
30 | * The MFD PCI block includes the GPIO peripherals and other register blocks. | ||
31 | * For GPIO, we have 32*4 bits (I use "gsta" for "gpio sta2x11".) | ||
32 | */ | ||
33 | #define GSTA_GPIO_PER_BLOCK 32 | ||
34 | #define GSTA_NR_BLOCKS 4 | ||
35 | #define GSTA_NR_GPIO (GSTA_GPIO_PER_BLOCK * GSTA_NR_BLOCKS) | ||
36 | |||
37 | /* Pinconfig is set by the board definition: altfunc, pull-up, pull-down */ | ||
38 | struct sta2x11_gpio_pdata { | ||
39 | unsigned pinconfig[GSTA_NR_GPIO]; | ||
40 | }; | ||
41 | |||
42 | /* Macros below lifted from sh_pfc.h, with minor differences */ | ||
43 | #define PINMUX_TYPE_NONE 0 | ||
44 | #define PINMUX_TYPE_FUNCTION 1 | ||
45 | #define PINMUX_TYPE_OUTPUT_LOW 2 | ||
46 | #define PINMUX_TYPE_OUTPUT_HIGH 3 | ||
47 | #define PINMUX_TYPE_INPUT 4 | ||
48 | #define PINMUX_TYPE_INPUT_PULLUP 5 | ||
49 | #define PINMUX_TYPE_INPUT_PULLDOWN 6 | ||
50 | |||
51 | /* Give names to GPIO pins, like PXA does, taken from the manual */ | ||
52 | #define STA2X11_GPIO0 0 | ||
53 | #define STA2X11_GPIO1 1 | ||
54 | #define STA2X11_GPIO2 2 | ||
55 | #define STA2X11_GPIO3 3 | ||
56 | #define STA2X11_GPIO4 4 | ||
57 | #define STA2X11_GPIO5 5 | ||
58 | #define STA2X11_GPIO6 6 | ||
59 | #define STA2X11_GPIO7 7 | ||
60 | #define STA2X11_GPIO8_RGBOUT_RED7 8 | ||
61 | #define STA2X11_GPIO9_RGBOUT_RED6 9 | ||
62 | #define STA2X11_GPIO10_RGBOUT_RED5 10 | ||
63 | #define STA2X11_GPIO11_RGBOUT_RED4 11 | ||
64 | #define STA2X11_GPIO12_RGBOUT_RED3 12 | ||
65 | #define STA2X11_GPIO13_RGBOUT_RED2 13 | ||
66 | #define STA2X11_GPIO14_RGBOUT_RED1 14 | ||
67 | #define STA2X11_GPIO15_RGBOUT_RED0 15 | ||
68 | #define STA2X11_GPIO16_RGBOUT_GREEN7 16 | ||
69 | #define STA2X11_GPIO17_RGBOUT_GREEN6 17 | ||
70 | #define STA2X11_GPIO18_RGBOUT_GREEN5 18 | ||
71 | #define STA2X11_GPIO19_RGBOUT_GREEN4 19 | ||
72 | #define STA2X11_GPIO20_RGBOUT_GREEN3 20 | ||
73 | #define STA2X11_GPIO21_RGBOUT_GREEN2 21 | ||
74 | #define STA2X11_GPIO22_RGBOUT_GREEN1 22 | ||
75 | #define STA2X11_GPIO23_RGBOUT_GREEN0 23 | ||
76 | #define STA2X11_GPIO24_RGBOUT_BLUE7 24 | ||
77 | #define STA2X11_GPIO25_RGBOUT_BLUE6 25 | ||
78 | #define STA2X11_GPIO26_RGBOUT_BLUE5 26 | ||
79 | #define STA2X11_GPIO27_RGBOUT_BLUE4 27 | ||
80 | #define STA2X11_GPIO28_RGBOUT_BLUE3 28 | ||
81 | #define STA2X11_GPIO29_RGBOUT_BLUE2 29 | ||
82 | #define STA2X11_GPIO30_RGBOUT_BLUE1 30 | ||
83 | #define STA2X11_GPIO31_RGBOUT_BLUE0 31 | ||
84 | #define STA2X11_GPIO32_RGBOUT_VSYNCH 32 | ||
85 | #define STA2X11_GPIO33_RGBOUT_HSYNCH 33 | ||
86 | #define STA2X11_GPIO34_RGBOUT_DEN 34 | ||
87 | #define STA2X11_GPIO35_ETH_CRS_DV 35 | ||
88 | #define STA2X11_GPIO36_ETH_TXD1 36 | ||
89 | #define STA2X11_GPIO37_ETH_TXD0 37 | ||
90 | #define STA2X11_GPIO38_ETH_TX_EN 38 | ||
91 | #define STA2X11_GPIO39_MDIO 39 | ||
92 | #define STA2X11_GPIO40_ETH_REF_CLK 40 | ||
93 | #define STA2X11_GPIO41_ETH_RXD1 41 | ||
94 | #define STA2X11_GPIO42_ETH_RXD0 42 | ||
95 | #define STA2X11_GPIO43_MDC 43 | ||
96 | #define STA2X11_GPIO44_CAN_TX 44 | ||
97 | #define STA2X11_GPIO45_CAN_RX 45 | ||
98 | #define STA2X11_GPIO46_MLB_DAT 46 | ||
99 | #define STA2X11_GPIO47_MLB_SIG 47 | ||
100 | #define STA2X11_GPIO48_SPI0_CLK 48 | ||
101 | #define STA2X11_GPIO49_SPI0_TXD 49 | ||
102 | #define STA2X11_GPIO50_SPI0_RXD 50 | ||
103 | #define STA2X11_GPIO51_SPI0_FRM 51 | ||
104 | #define STA2X11_GPIO52_SPI1_CLK 52 | ||
105 | #define STA2X11_GPIO53_SPI1_TXD 53 | ||
106 | #define STA2X11_GPIO54_SPI1_RXD 54 | ||
107 | #define STA2X11_GPIO55_SPI1_FRM 55 | ||
108 | #define STA2X11_GPIO56_SPI2_CLK 56 | ||
109 | #define STA2X11_GPIO57_SPI2_TXD 57 | ||
110 | #define STA2X11_GPIO58_SPI2_RXD 58 | ||
111 | #define STA2X11_GPIO59_SPI2_FRM 59 | ||
112 | #define STA2X11_GPIO60_I2C0_SCL 60 | ||
113 | #define STA2X11_GPIO61_I2C0_SDA 61 | ||
114 | #define STA2X11_GPIO62_I2C1_SCL 62 | ||
115 | #define STA2X11_GPIO63_I2C1_SDA 63 | ||
116 | #define STA2X11_GPIO64_I2C2_SCL 64 | ||
117 | #define STA2X11_GPIO65_I2C2_SDA 65 | ||
118 | #define STA2X11_GPIO66_I2C3_SCL 66 | ||
119 | #define STA2X11_GPIO67_I2C3_SDA 67 | ||
120 | #define STA2X11_GPIO68_MSP0_RCK 68 | ||
121 | #define STA2X11_GPIO69_MSP0_RXD 69 | ||
122 | #define STA2X11_GPIO70_MSP0_RFS 70 | ||
123 | #define STA2X11_GPIO71_MSP0_TCK 71 | ||
124 | #define STA2X11_GPIO72_MSP0_TXD 72 | ||
125 | #define STA2X11_GPIO73_MSP0_TFS 73 | ||
126 | #define STA2X11_GPIO74_MSP0_SCK 74 | ||
127 | #define STA2X11_GPIO75_MSP1_CK 75 | ||
128 | #define STA2X11_GPIO76_MSP1_RXD 76 | ||
129 | #define STA2X11_GPIO77_MSP1_FS 77 | ||
130 | #define STA2X11_GPIO78_MSP1_TXD 78 | ||
131 | #define STA2X11_GPIO79_MSP2_CK 79 | ||
132 | #define STA2X11_GPIO80_MSP2_RXD 80 | ||
133 | #define STA2X11_GPIO81_MSP2_FS 81 | ||
134 | #define STA2X11_GPIO82_MSP2_TXD 82 | ||
135 | #define STA2X11_GPIO83_MSP3_CK 83 | ||
136 | #define STA2X11_GPIO84_MSP3_RXD 84 | ||
137 | #define STA2X11_GPIO85_MSP3_FS 85 | ||
138 | #define STA2X11_GPIO86_MSP3_TXD 86 | ||
139 | #define STA2X11_GPIO87_MSP4_CK 87 | ||
140 | #define STA2X11_GPIO88_MSP4_RXD 88 | ||
141 | #define STA2X11_GPIO89_MSP4_FS 89 | ||
142 | #define STA2X11_GPIO90_MSP4_TXD 90 | ||
143 | #define STA2X11_GPIO91_MSP5_CK 91 | ||
144 | #define STA2X11_GPIO92_MSP5_RXD 92 | ||
145 | #define STA2X11_GPIO93_MSP5_FS 93 | ||
146 | #define STA2X11_GPIO94_MSP5_TXD 94 | ||
147 | #define STA2X11_GPIO95_SDIO3_DAT3 95 | ||
148 | #define STA2X11_GPIO96_SDIO3_DAT2 96 | ||
149 | #define STA2X11_GPIO97_SDIO3_DAT1 97 | ||
150 | #define STA2X11_GPIO98_SDIO3_DAT0 98 | ||
151 | #define STA2X11_GPIO99_SDIO3_CLK 99 | ||
152 | #define STA2X11_GPIO100_SDIO3_CMD 100 | ||
153 | #define STA2X11_GPIO101 101 | ||
154 | #define STA2X11_GPIO102 102 | ||
155 | #define STA2X11_GPIO103 103 | ||
156 | #define STA2X11_GPIO104 104 | ||
157 | #define STA2X11_GPIO105_SDIO2_DAT3 105 | ||
158 | #define STA2X11_GPIO106_SDIO2_DAT2 106 | ||
159 | #define STA2X11_GPIO107_SDIO2_DAT1 107 | ||
160 | #define STA2X11_GPIO108_SDIO2_DAT0 108 | ||
161 | #define STA2X11_GPIO109_SDIO2_CLK 109 | ||
162 | #define STA2X11_GPIO110_SDIO2_CMD 110 | ||
163 | #define STA2X11_GPIO111 111 | ||
164 | #define STA2X11_GPIO112 112 | ||
165 | #define STA2X11_GPIO113 113 | ||
166 | #define STA2X11_GPIO114 114 | ||
167 | #define STA2X11_GPIO115_SDIO1_DAT3 115 | ||
168 | #define STA2X11_GPIO116_SDIO1_DAT2 116 | ||
169 | #define STA2X11_GPIO117_SDIO1_DAT1 117 | ||
170 | #define STA2X11_GPIO118_SDIO1_DAT0 118 | ||
171 | #define STA2X11_GPIO119_SDIO1_CLK 119 | ||
172 | #define STA2X11_GPIO120_SDIO1_CMD 120 | ||
173 | #define STA2X11_GPIO121 121 | ||
174 | #define STA2X11_GPIO122 122 | ||
175 | #define STA2X11_GPIO123 123 | ||
176 | #define STA2X11_GPIO124 124 | ||
177 | #define STA2X11_GPIO125_UART2_TXD 125 | ||
178 | #define STA2X11_GPIO126_UART2_RXD 126 | ||
179 | #define STA2X11_GPIO127_UART3_TXD 127 | ||
180 | |||
181 | /* | ||
182 | * The APB bridge has its own registers, needed by our users as well. | ||
183 | * They are accessed with the following read/mask/write function. | ||
184 | */ | ||
185 | u32 sta2x11_apbreg_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val); | ||
186 | |||
187 | /* CAN and MLB */ | ||
188 | #define APBREG_BSR 0x00 /* Bridge Status Reg */ | ||
189 | #define APBREG_PAER 0x08 /* Peripherals Address Error Reg */ | ||
190 | #define APBREG_PWAC 0x20 /* Peripheral Write Access Control reg */ | ||
191 | #define APBREG_PRAC 0x40 /* Peripheral Read Access Control reg */ | ||
192 | #define APBREG_PCG 0x60 /* Peripheral Clock Gating Reg */ | ||
193 | #define APBREG_PUR 0x80 /* Peripheral Under Reset Reg */ | ||
194 | #define APBREG_EMU_PCG 0xA0 /* Emulator Peripheral Clock Gating Reg */ | ||
195 | |||
196 | #define APBREG_CAN (1 << 1) | ||
197 | #define APBREG_MLB (1 << 3) | ||
198 | |||
199 | /* SARAC */ | ||
200 | #define APBREG_BSR_SARAC 0x100 /* Bridge Status Reg */ | ||
201 | #define APBREG_PAER_SARAC 0x108 /* Peripherals Address Error Reg */ | ||
202 | #define APBREG_PWAC_SARAC 0x120 /* Peripheral Write Access Control reg */ | ||
203 | #define APBREG_PRAC_SARAC 0x140 /* Peripheral Read Access Control reg */ | ||
204 | #define APBREG_PCG_SARAC 0x160 /* Peripheral Clock Gating Reg */ | ||
205 | #define APBREG_PUR_SARAC 0x180 /* Peripheral Under Reset Reg */ | ||
206 | #define APBREG_EMU_PCG_SARAC 0x1A0 /* Emulator Peripheral Clock Gating Reg */ | ||
207 | |||
208 | #define APBREG_SARAC (1 << 2) | ||
209 | |||
210 | /* | ||
211 | * The system controller has its own registers. Some of these are accessed | ||
212 | * by out users as well, using the following read/mask/write/function | ||
213 | */ | ||
214 | u32 sta2x11_sctl_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val); | ||
215 | |||
216 | #define SCTL_SCCTL 0x00 /* System controller control register */ | ||
217 | #define SCTL_ARMCFG 0x04 /* ARM configuration register */ | ||
218 | #define SCTL_SCPLLCTL 0x08 /* PLL control status register */ | ||
219 | #define SCTL_SCPLLFCTRL 0x0c /* PLL frequency control register */ | ||
220 | #define SCTL_SCRESFRACT 0x10 /* PLL fractional input register */ | ||
221 | #define SCTL_SCRESCTRL1 0x14 /* Peripheral reset control 1 */ | ||
222 | #define SCTL_SCRESXTRL2 0x18 /* Peripheral reset control 2 */ | ||
223 | #define SCTL_SCPEREN0 0x1c /* Peripheral clock enable register 0 */ | ||
224 | #define SCTL_SCPEREN1 0x20 /* Peripheral clock enable register 1 */ | ||
225 | #define SCTL_SCPEREN2 0x24 /* Peripheral clock enable register 2 */ | ||
226 | #define SCTL_SCGRST 0x28 /* Peripheral global reset */ | ||
227 | #define SCTL_SCPCIPMCR1 0x30 /* PCI power management control 1 */ | ||
228 | #define SCTL_SCPCIPMCR2 0x34 /* PCI power management control 2 */ | ||
229 | #define SCTL_SCPCIPMSR1 0x38 /* PCI power management status 1 */ | ||
230 | #define SCTL_SCPCIPMSR2 0x3c /* PCI power management status 2 */ | ||
231 | #define SCTL_SCPCIPMSR3 0x40 /* PCI power management status 3 */ | ||
232 | #define SCTL_SCINTREN 0x44 /* Interrupt enable */ | ||
233 | #define SCTL_SCRISR 0x48 /* RAW interrupt status */ | ||
234 | #define SCTL_SCCLKSTAT0 0x4c /* Peripheral clocks status 0 */ | ||
235 | #define SCTL_SCCLKSTAT1 0x50 /* Peripheral clocks status 1 */ | ||
236 | #define SCTL_SCCLKSTAT2 0x54 /* Peripheral clocks status 2 */ | ||
237 | #define SCTL_SCRSTSTA 0x58 /* Reset status register */ | ||
238 | |||
239 | #define SCTL_SCRESCTRL1_USB_PHY_POR (1 << 0) | ||
240 | #define SCTL_SCRESCTRL1_USB_OTG (1 << 1) | ||
241 | #define SCTL_SCRESCTRL1_USB_HRST (1 << 2) | ||
242 | #define SCTL_SCRESCTRL1_USB_PHY_HOST (1 << 3) | ||
243 | #define SCTL_SCRESCTRL1_SATAII (1 << 4) | ||
244 | #define SCTL_SCRESCTRL1_VIP (1 << 5) | ||
245 | #define SCTL_SCRESCTRL1_PER_MMC0 (1 << 6) | ||
246 | #define SCTL_SCRESCTRL1_PER_MMC1 (1 << 7) | ||
247 | #define SCTL_SCRESCTRL1_PER_GPIO0 (1 << 8) | ||
248 | #define SCTL_SCRESCTRL1_PER_GPIO1 (1 << 9) | ||
249 | #define SCTL_SCRESCTRL1_PER_GPIO2 (1 << 10) | ||
250 | #define SCTL_SCRESCTRL1_PER_GPIO3 (1 << 11) | ||
251 | #define SCTL_SCRESCTRL1_PER_MTU0 (1 << 12) | ||
252 | #define SCTL_SCRESCTRL1_KER_SPI0 (1 << 13) | ||
253 | #define SCTL_SCRESCTRL1_KER_SPI1 (1 << 14) | ||
254 | #define SCTL_SCRESCTRL1_KER_SPI2 (1 << 15) | ||
255 | #define SCTL_SCRESCTRL1_KER_MCI0 (1 << 16) | ||
256 | #define SCTL_SCRESCTRL1_KER_MCI1 (1 << 17) | ||
257 | #define SCTL_SCRESCTRL1_PRE_HSI2C0 (1 << 18) | ||
258 | #define SCTL_SCRESCTRL1_PER_HSI2C1 (1 << 19) | ||
259 | #define SCTL_SCRESCTRL1_PER_HSI2C2 (1 << 20) | ||
260 | #define SCTL_SCRESCTRL1_PER_HSI2C3 (1 << 21) | ||
261 | #define SCTL_SCRESCTRL1_PER_MSP0 (1 << 22) | ||
262 | #define SCTL_SCRESCTRL1_PER_MSP1 (1 << 23) | ||
263 | #define SCTL_SCRESCTRL1_PER_MSP2 (1 << 24) | ||
264 | #define SCTL_SCRESCTRL1_PER_MSP3 (1 << 25) | ||
265 | #define SCTL_SCRESCTRL1_PER_MSP4 (1 << 26) | ||
266 | #define SCTL_SCRESCTRL1_PER_MSP5 (1 << 27) | ||
267 | #define SCTL_SCRESCTRL1_PER_MMC (1 << 28) | ||
268 | #define SCTL_SCRESCTRL1_KER_MSP0 (1 << 29) | ||
269 | #define SCTL_SCRESCTRL1_KER_MSP1 (1 << 30) | ||
270 | #define SCTL_SCRESCTRL1_KER_MSP2 (1 << 31) | ||
271 | |||
272 | #define SCTL_SCPEREN0_UART0 (1 << 0) | ||
273 | #define SCTL_SCPEREN0_UART1 (1 << 1) | ||
274 | #define SCTL_SCPEREN0_UART2 (1 << 2) | ||
275 | #define SCTL_SCPEREN0_UART3 (1 << 3) | ||
276 | #define SCTL_SCPEREN0_MSP0 (1 << 4) | ||
277 | #define SCTL_SCPEREN0_MSP1 (1 << 5) | ||
278 | #define SCTL_SCPEREN0_MSP2 (1 << 6) | ||
279 | #define SCTL_SCPEREN0_MSP3 (1 << 7) | ||
280 | #define SCTL_SCPEREN0_MSP4 (1 << 8) | ||
281 | #define SCTL_SCPEREN0_MSP5 (1 << 9) | ||
282 | #define SCTL_SCPEREN0_SPI0 (1 << 10) | ||
283 | #define SCTL_SCPEREN0_SPI1 (1 << 11) | ||
284 | #define SCTL_SCPEREN0_SPI2 (1 << 12) | ||
285 | #define SCTL_SCPEREN0_I2C0 (1 << 13) | ||
286 | #define SCTL_SCPEREN0_I2C1 (1 << 14) | ||
287 | #define SCTL_SCPEREN0_I2C2 (1 << 15) | ||
288 | #define SCTL_SCPEREN0_I2C3 (1 << 16) | ||
289 | #define SCTL_SCPEREN0_SVDO_LVDS (1 << 17) | ||
290 | #define SCTL_SCPEREN0_USB_HOST (1 << 18) | ||
291 | #define SCTL_SCPEREN0_USB_OTG (1 << 19) | ||
292 | #define SCTL_SCPEREN0_MCI0 (1 << 20) | ||
293 | #define SCTL_SCPEREN0_MCI1 (1 << 21) | ||
294 | #define SCTL_SCPEREN0_MCI2 (1 << 22) | ||
295 | #define SCTL_SCPEREN0_MCI3 (1 << 23) | ||
296 | #define SCTL_SCPEREN0_SATA (1 << 24) | ||
297 | #define SCTL_SCPEREN0_ETHERNET (1 << 25) | ||
298 | #define SCTL_SCPEREN0_VIC (1 << 26) | ||
299 | #define SCTL_SCPEREN0_DMA_AUDIO (1 << 27) | ||
300 | #define SCTL_SCPEREN0_DMA_SOC (1 << 28) | ||
301 | #define SCTL_SCPEREN0_RAM (1 << 29) | ||
302 | #define SCTL_SCPEREN0_VIP (1 << 30) | ||
303 | #define SCTL_SCPEREN0_ARM (1 << 31) | ||
304 | |||
305 | #define SCTL_SCPEREN1_UART0 (1 << 0) | ||
306 | #define SCTL_SCPEREN1_UART1 (1 << 1) | ||
307 | #define SCTL_SCPEREN1_UART2 (1 << 2) | ||
308 | #define SCTL_SCPEREN1_UART3 (1 << 3) | ||
309 | #define SCTL_SCPEREN1_MSP0 (1 << 4) | ||
310 | #define SCTL_SCPEREN1_MSP1 (1 << 5) | ||
311 | #define SCTL_SCPEREN1_MSP2 (1 << 6) | ||
312 | #define SCTL_SCPEREN1_MSP3 (1 << 7) | ||
313 | #define SCTL_SCPEREN1_MSP4 (1 << 8) | ||
314 | #define SCTL_SCPEREN1_MSP5 (1 << 9) | ||
315 | #define SCTL_SCPEREN1_SPI0 (1 << 10) | ||
316 | #define SCTL_SCPEREN1_SPI1 (1 << 11) | ||
317 | #define SCTL_SCPEREN1_SPI2 (1 << 12) | ||
318 | #define SCTL_SCPEREN1_I2C0 (1 << 13) | ||
319 | #define SCTL_SCPEREN1_I2C1 (1 << 14) | ||
320 | #define SCTL_SCPEREN1_I2C2 (1 << 15) | ||
321 | #define SCTL_SCPEREN1_I2C3 (1 << 16) | ||
322 | #define SCTL_SCPEREN1_USB_PHY (1 << 17) | ||
323 | |||
324 | #endif /* __STA2X11_MFD_H */ | ||