]> rtime.felk.cvut.cz Git - mcf548x/linux.git/blob - arch/m68k/coldfire/usb/otg_otg.c
Current (FEC from 2.6.31 port, no CAN, no I2C, no PCI)
[mcf548x/linux.git] / arch / m68k / coldfire / usb / otg_otg.c
1 /*
2  * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3  */
4
5 /*
6  * The code contained herein is licensed under the GNU General Public
7  * License. You may obtain a copy of the GNU General Public License
8  * Version 2 or later at the following locations:
9  *
10  * http://www.opensource.org/licenses/gpl-license.html
11  * http://www.gnu.org/copyleft/gpl.html
12  */
13
14 /*
15  * platform_device registration for ULPI OTG device
16  */
17
18 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/types.h>
21 #include <linux/errno.h>
22 #include <linux/init.h>
23 #include <linux/err.h>
24 #include <linux/platform_device.h>
25 #include <linux/fsl_devices.h>
26
27 #include <asm/mcfsim.h>
28
29 #define USB_OTGREGS_BASE MCF_REG32(0xFC0B0000)
30 #define INT_USB         (64 + 64 + 47)  /* INTC1:47 16.2.9.1 */
31 #define INT_UOCSR       (64 + 64 + 53)  /* INTC1:53 16.2.9.1 */
32
33 extern int usbotg_init(struct platform_device *pdev);
34 extern void usbotg_uninit(struct fsl_usb2_platform_data *pdata);
35 extern struct fsl_usb2_platform_data mxc_otg_config;
36
37 static void otg_otg_release(struct device *dev)
38 {
39         /* normally not freed */
40 }
41
42 /* *INDENT-OFF* */
43 static struct resource otg_otg_resources[] = {
44         [0] = {
45                 .start = (u32) (&USB_OTGREGS_BASE),
46                 .end   = (u32) (&USB_OTGREGS_BASE + 0x1ff),
47                 .flags = IORESOURCE_MEM,
48         },
49         [1] = {
50                 .start = INT_USB,
51                 .flags = IORESOURCE_IRQ,
52         },
53 };
54
55 /*!
56  * OTG device
57  */
58 static u64 otg_otg_dmamask = ~(u32) 0;
59 static struct platform_device otg_otg_device = {
60         .name = "fsl-usb2-otg",
61         .id   = -1,
62         .dev  = {
63                 .release           = otg_otg_release,
64                 .dma_mask          = &otg_otg_dmamask,
65                 .coherent_dma_mask = 0xffffffff,
66                 .platform_data     = &mxc_otg_config,
67         },
68         .resource = otg_otg_resources,
69         .num_resources = ARRAY_SIZE(otg_otg_resources),
70 };
71 /* *INDENT-ON* */
72
73 static int __init mx31_otg_otg_init(void)
74 {
75         int rc = 0;
76
77         pr_debug("register OTG otg res=0x%p, size=%d\n",
78                  otg_otg_device.resource, otg_otg_device.num_resources);
79
80         rc = platform_device_register(&otg_otg_device);
81         if (rc) {
82                 pr_debug("can't register ULPI OTG dvc, %d\n", rc);
83         } else {
84                 printk(KERN_INFO "usb: OTG ULPI transceiver registered\n");
85                 pr_debug("otg_otg_device=0x%p  resources=0x%p.\n",
86                          &otg_otg_device, otg_otg_device.resource);
87         }
88
89         return rc;
90 }
91
92 subsys_initcall(mx31_otg_otg_init);
93
94 MODULE_AUTHOR("Freescale Semiconductor, Inc.");
95 MODULE_DESCRIPTION("ULPI OTG device registration");
96 MODULE_LICENSE("GPL");