sync hh.org
[hh.org.git] / arch / arm / mach-pxa / asus730 / a730_usb.c
blob2a1c65f42fc8c2e003cd38ba2c77c519b11f2f35
1 /*
2 * Use consistent with the GNU GPL is permitted,
3 * provided that this copyright notice is
4 * preserved in its entirety in all copies and derived works.
6 * History:
8 * 2005-03-26 Markus Wagner file created
9 */
12 #include <linux/init.h>
13 #include <linux/kernel.h>
14 #include <linux/ioport.h>
15 #include <linux/device.h>
17 #include <asm/mach-types.h>
18 #include <asm/hardware.h>
19 #include <asm/mach/arch.h>
21 #include <asm/arch/asus730-init.h>
22 #include <asm/arch/asus730-gpio.h>
23 #include <asm/arch/pxa-regs.h>
24 #include <asm/mach/map.h>
25 #include <asm/arch/udc.h>
26 #include <asm/arch/ohci.h>
27 #include <asm/arch/audio.h>
29 #include <linux/platform_device.h>
31 #include "../generic.h"
33 /* USB host */
35 static int a730_ohci_init(struct device *dev)
37 printk("%s\n", __FUNCTION__);
38 UHCHCON = (UHCHCON_HCFS_USBOPERATIONAL | /*UHCHCON_PLE |*/ UHCHCON_CLE | UHCHCON_CBSR41);//0x97 (USBOPERATIONAL | CLE(may be not set?) | PLE | CBSR=0x3)
39 UHCINTE = (UHCINT_MIE | UHCINT_RHSC | UHCINT_UE | UHCINT_WDH | UHCINT_SO);//0x80000053;// (MIE | RHSC | UE | WDH | SO)
40 UHCINTD = (UHCINT_MIE | UHCINT_RHSC | UHCINT_UE | UHCINT_WDH | UHCINT_SO);//0x80000053;// (MIE | RHSC | UE | WDH | SO)
41 UHCFMI = 0x27782edf;
42 //UHCFMR = 0x2d6b;// (no need to set ?)
43 //UHCFMN = 0xd1bc;// (no need to set ?)
44 //intel says typical val is 0x3e67. wince sets to 0x2a2f
45 UHCPERS = 0x3e67;//0x2a2f
46 UHCLS = 0x628;// (lsthreshold=0x628)
47 UHCRHDA = 0x4001a02;// (numberdownstreamports=1 | psm=1 | overcurrentprotection=1 | noovercurrentprotection=1 | powerontopowergoodtime(bit26)=1)
48 UHCRHDB = 0x0;
49 UHCRHS = 0x0;
50 UHCRHPS1 = 0x100;// (port power on)
51 UHCRHPS2 = 0x100;// (port power on)
52 UHCRHPS3 = 0x100;// (port power on)
53 UHCSTAT = 0x0;
54 UHCHR = (UHCHR_PCPL | UHCHR_CGR);//0x84 (power control polarity low | clock generation reset inactive)
55 UHCHIE = 0x0;
56 UHCHIT = 0x0;
58 SET_A730_GPIO(USB_HOST_EN, 0);
60 return 0;
63 static void a730_ohci_exit(struct device *dev)
65 printk("%s\n", __FUNCTION__);
66 SET_A730_GPIO(USB_HOST_EN, 1);
69 static struct pxaohci_platform_data a730_ohci_platform_data = {
70 .init = a730_ohci_init,
71 .exit = a730_ohci_exit,
72 .port_mode = /*PMM_NPS_MODE,//*/PMM_PERPORT_MODE,
75 static int __init a730_usb_init(void)
77 if (!machine_is_a730()) return -ENODEV;
79 printk("A730: Enabling USB-Host controller\n");
81 //driver_register(&a730_ohci_driver);
82 //platform_device_register(&a730_ohci);
83 //driver_create_file(&a730_ohci_driver, &driver_attr_power);
84 pxa_set_ohci_info(&a730_ohci_platform_data);
86 return 0;
89 static void __exit a730_usb_exit(void)
91 printk("A730: Disabling USB-Host controller\n");
93 //driver_remove_file(&a730_ohci_driver, &driver_attr_power);
94 //platform_device_unregister(&a730_ohci);
95 //driver_unregister(&a730_ohci_driver);
98 module_init(a730_usb_init);
99 module_exit(a730_usb_exit);
101 MODULE_AUTHOR("Markus Wagner <markus1108wagner@t-online.de");
102 MODULE_DESCRIPTION("Asus MyPal A730 USB Host status driver");
103 MODULE_LICENSE("GPL");