2440/2410上将usb device改成usb host
-ENOMEM;
goto fail;
}
hub->status = kmalloc(sizeof(*hub->status), GFP_KERNEL);
if (!hub->status) {
message = "cant kmalloc hub status buffer";
ret = -ENOMEM;
goto fail;
}
mutex_init(&hub->status_mutex);
hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_KERNEL);
if (!hub->descriptor) {
message = "cant kmalloc hub descriptor";
ret = -ENOMEM;
goto fail;
}
/* Request the entire hub descriptor.
* hub->descriptor can handle USB_MAXCHILDREN ports,
* but the hub can/will return fewer bytes here.
*/
ret = get_hub_descriptor(hdev, hub->descriptor,
sizeof(*hub->descriptor));
if (ret < 0) {
message = "cant read hub descriptor";
goto fail;
} else if (hub->descriptor->bNbrPorts > USB_MAXCHILDREN) {
message = "hub has too many ports!";
ret = -ENODEV;
goto fail;
}
/********************************************/
/*add by hiboy */
#ifdef CONFIG_ARCH_S3C2410
if ((hdev->devnum == 1) // Root Hub
&& hub->descriptor->bNbrPorts > CONFIG_MAX_ROOT_PORTS) {
int j;
for (j=hub->descriptor->bNbrPorts-1; j>=0; j--) {
printk("port #%d ", j);
if (j > CONFIG_MAX_ROOT_PORTS-1) {
printk("suspened!\n");
} else {
printk("alived!\n");
}
}
hub->descriptor->bNbrPorts = CONFIG_MAX_ROOT_PORTS;
}
#endif
/*********************************************/
第二篇:
是由于MISCCR寄存器没有正确设置的缘故,我在mach-2410.c中增加了设置MISCCR寄存器的内容,HOST0就可以正常使用了
/*add by seigpao*/
int usb_seigpao_init(void)
{
unsigned long upllvalue;
unsigned long misccr;
//设置UPLLCON
upllvalue = (0x78<12)|(0x02<4)|(0x03);
__raw_writel(upllvalue,S3C2410_UPLLCON);
//设置MISCCR
misccr = __raw_readl(S3C2410_MISCCR);
misccr |= S3C2410_MISCCR_USBHOST;
misccr &= ~(S3C2410_MISCCR_USBSUSPND0 | S3C2410_MISCCR_USBSUSPND1);
__raw_writel(misccr,S3C2410_MISCCR);
return 1;
}
/* end by seigpao */
static void __init smdk2410_map_io(void)
{
s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
s3c24xx_init_clocks(0);
s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
s3c24xx_set_board(&smdk2410_board);
/*add by seigpao*/
//设置2410触摸屏
set_s3c2410ts_info(&sbc2410_ts_cfg);
//设置USB相关寄存器
usb_seigpao_init();
/* end by seigpao */
}
不知道为什么会有第二篇,感觉不适合,所以又重网上找了另一篇文章。
修改ohci-s3c2440.c文件(含头文件):
#include
#include
#include
/*add here*/
#include
#include
#include
#include
/*end here*/
#define valid_port(idx) ((idx) == 1 || (idx) == 2)
/*add here*/
static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)
{
unsigned long upllvalue = (0x78<12)|(0x02<4)|(0x03); //add upllvalue
unsigned long misccr; //add misccr
struct s3c2410_hcd_info *info = dev->dev.platform_data;
while (upllvalue != __raw_readl(S3C2410_UPLLCON)) //setup UPLLCON
{
__raw_writel(upllvalue, S3C2410_UPLLCON);
mdelay(1);
}
misccr = __raw_readl(S3C2410_MISCCR); //MISCCR
misccr |= S3C2410_MISCCR_USBHOST;
misccr&=~(S3C2410_MISCCR_USBSUSPND0|S3C2410_MISCCR_USBSUSPND1);
__raw_writel(misccr,S3C2410_MISCCR);
dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
clk_enable(clk);
if (info != NULL) {
info->hcd = hcd;
info->report_oc = s3c2410_hcd_oc;
if (info->enable_oc != NULL) {
(info->enable_oc)(info, 1);
}
}
}
使用了这篇文章的改动。头文件位置可能根据内核不同做相应改动。我的2.6.29内核中的regs-clock.h和regs-gpio.h是在arch\arm\mach-s3c2410\include\mach中。我拷贝两个头文件到本地drivers/usb/host/,include 变成""。
然后make zImage,之后Kconfig会重新选择,
USB support (USB_SUPPORT) [Y/n/?] y
Support for Host-side USB (USB) [Y/n/m/?] y
USB verbose debug messages (USB_DEBUG) [N/y/?] n
USB announce new devices (USB_ANNOUNCE_NEW_DEVICES) [Y/n/?] y
*
* Miscellaneous USB options
*
USB device filesystem (USB_DEVICEFS) [Y/n/?] y
USB device class-de
24402410usbdevicehos 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)