⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb-ohci-s3c2410.c

📁 周立功magic2410实验箱源码 第6章Linux高级实验(part2) 6.9 IDE硬盘实验. 6.10 USB主机驱动编译与加载实验 6.11 U盘驱动程序编译与使用实验 6.12
💻 C
字号:
/* *  linux/drivers/usb/usb-ohci-s3c2410.c * *  OHCI r1.0 compatible, CPU embedded USB host controller * *  2003-09-03 kwanghyun la<nala.la@samsung.com> *  	- to get the USB CLOCK setting value & set register for s3c2410 */ #ifndef __KERNEL__    #define __KERNEL__#endif#ifndef MODULE    #define MODULE#endif//#include <linux/sched.h>//#include <linux/kernel.h>       /* printk() *///#include <linux/init.h>#include <linux/module.h>#include <linux/init.h>#include <linux/sched.h>#include <linux/ioport.h>#include <linux/interrupt.h>#include <linux/slab.h>#include <linux/usb.h>#include <linux/pci.h>#include <asm/hardware.h>#include <asm/irq.h>#include <asm/io.h>#define OHCI_HW_DRIVER 1#include "usb-ohci.h"int __devinithc_add_ohci(struct pci_dev *dev, int irq, void *membase, unsigned long flags,	    ohci_t **ohci, const char *name, const char *slot_name);extern void hc_remove_ohci(ohci_t *ohci);static ohci_t *s3c2410_ohci;				// 定一个控制器设备结构体指针/*********************************************************************************************************** Function name: s3c2410_ohci_configure** Descriptions:** Input:A:**       B:**       C:** Output 0:**        1:** Created by:** Created Date: **-------------------------------------------------------------------------------------------------------** Modified by:** Modified Date: **------------------------------------------------------------------------------------------------------********************************************************************************************************/static void __init s3c2410_ohci_configure(void){#if CONFIG_MAX_ROOT_PORTS < 2	/* 1 host port, 1 slave port*/	MISCCR &= ~MISCCR_USBPAD;#else	/* 2 host port */	MISCCR |= MISCCR_USBPAD;#endif	/* UPLLCON */// laputa for USB PLL setting value chaged input 12MHz --> output 48MHz 		UPLLCON = FInsrt(0x38, fPLL_MDIV) | FInsrt(0x02, fPLL_PDIV) 		| FInsrt(0x02, fPLL_SDIV);	/* CLKCON */	CLKCON  |= CLKCON_USBH;	//laputa append begine -->//	CLKSLOW &= ~(UCLK_ON | MPLL_OFF | SLOW_BIT); 	//laputa append end <--		udelay(11);}/*********************************************************************************************************** Function name: Fuction1** Descriptions:** Input:A:**       B:**       C:** Output 0:**        1:** Created by:** Created Date: **-------------------------------------------------------------------------------------------------------** Modified by:** Modified Date: **------------------------------------------------------------------------------------------------------********************************************************************************************************/static int __init s3c2410_ohci_init(void){	int ret;	s3c2410_ohci_configure();	/*	 * Initialise the generic OHCI driver.	 */	// FIXME : io_p2v() ?	ret = hc_add_ohci((struct pci_dev *)1, 										IRQ_USBH,			  (void *)(io_p2v(USBHOST_CTL_BASE)), 		// USB主机控制器基地址			  0, 																			//			  &s3c2410_ohci,													//			  "usb-ohci", 			  "s3c2410");	return ret;}/*********************************************************************************************************** Function name: s3c2410_ohci_exit** Descriptions: ** Input:A:**       B:**       C:** Output 0:**        1:** Created by:** Created Date: **-------------------------------------------------------------------------------------------------------** Modified by:** Modified Date: **------------------------------------------------------------------------------------------------------********************************************************************************************************/static void __exit s3c2410_ohci_exit(void){	hc_remove_ohci(s3c2410_ohci);							// 	/*	 * Stop the USB clock.	 */	CLKCON &= ~CLKCON_USBH;}module_init(s3c2410_ohci_init);module_exit(s3c2410_ohci_exit);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -