usb-ohci-s3c2410.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:2k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/drivers/usb/usb-ohci-s3c2410.c
  3.  *
  4.  *  OHCI r1.0 compatible, CPU embedded USB host controller
  5.  *
  6.  */
  7. #include <linux/module.h>
  8. #include <linux/init.h>
  9. #include <linux/sched.h>
  10. #include <linux/ioport.h>
  11. #include <linux/interrupt.h>
  12. #include <linux/slab.h>
  13. #include <linux/usb.h>
  14. #include <linux/pci.h>
  15. #include <asm/hardware.h>
  16. #include <asm/irq.h>
  17. #include <asm/io.h>
  18. #define OHCI_HW_DRIVER 1
  19. #include "usb-ohci.h"
  20. /*
  21.  * S3C2410 user's guide 俊 乐绰 1厘 楼府 汲疙俊 狼窍搁,
  22.  * OHCI 龋券捞扼绊 茄促.
  23.  *
  24.  * UPLL 汲沥苞 MISC 饭瘤胶磐俊辑 器飘 磷捞绊 混府绊 窍绰 巴阑 哗冈瘤 富 巴.
  25.  *
  26.  * 弊府绊, s3c2410 俊辑 USB slave 甫 静妨搁 host 器飘 窍唱甫 磷咯具 茄促绰 巴
  27.  * 镭瘤 富 巴.
  28.  * 窍瘤父, 捞犯霸 秦档 slave 脚龋啊 root hub 率俊 林绰 康氢阑 阜阑 规过捞 绝促.
  29.  * hub.c 甫 绊媚辑 root hub 捞绊, 1 host port 肺 config 沁阑 版快,
  30.  * 滴 锅掳 器飘甫 酒抗 媚促档 焊瘤 臼档废 沁栏聪 曼绊且 巴.
  31.  */
  32. int __devinit
  33. hc_add_ohci(struct pci_dev *dev, int irq, void *membase, unsigned long flags,
  34.     ohci_t **ohci, const char *name, const char *slot_name);
  35. extern void hc_remove_ohci(ohci_t *ohci);
  36. static ohci_t *s3c2410_ohci;
  37. static void __init s3c2410_ohci_configure(void)
  38. {
  39. #if CONFIG_MAX_ROOT_PORTS < 2
  40. /* 1 host port, 1 slave port*/
  41. MISCCR &= ~MISCCR_USBPAD;
  42. #if 0 // confused - bushi
  43. /* wakeup port 0 */
  44. MISCCR &= ~MISCCR_USB0_SUSPEND;
  45. /* sleep port 1 */
  46. MISCCR |= MISCCR_USB1_SUSPEND;
  47. #endif
  48. #else
  49. /* 2 host port */
  50. MISCCR |= MISCCR_USBPAD;
  51. #if 0 // confused - bushi
  52. /* wakeup port 0 */
  53. MISCCR &= ~MISCCR_USB0_SUSPEND;
  54. /* wakeup port 1 */
  55. MISCCR &= ~MISCCR_USB1_SUSPEND;
  56. #endif
  57. #endif
  58. /* UPLLCON */
  59. UPLLCON = FInsrt(0x78, fPLL_MDIV) | FInsrt(0x02, fPLL_PDIV) 
  60. | FInsrt(0x03, fPLL_SDIV);
  61. /* CLKCON */
  62. CLKCON |= CLKCON_USBH;
  63. udelay(11);
  64. }
  65. static int __init s3c2410_ohci_init(void)
  66. {
  67. int ret;
  68. s3c2410_ohci_configure();
  69. /*
  70.  * Initialise the generic OHCI driver.
  71.  */
  72. // FIXME : io_p2v() ?
  73. ret = hc_add_ohci((struct pci_dev *)1, IRQ_USBH,
  74.   (void *)(io_p2v(USBHOST_CTL_BASE)), 0, &s3c2410_ohci,
  75.   "usb-ohci", "s3c2410");
  76. return ret;
  77. }
  78. static void __exit s3c2410_ohci_exit(void)
  79. {
  80. hc_remove_ohci(s3c2410_ohci);
  81. /*
  82.  * Stop the USB clock.
  83.  */
  84. CLKCON &= ~CLKCON_USBH;
  85. }
  86. module_init(s3c2410_ohci_init);
  87. module_exit(s3c2410_ohci_exit);