阳初论坛帖子的地址: 关于阳初2440超值版只能使用一个usb host问题的解决
第一篇: 原文网址
修改linux-2.6.20.3/drivers/usb/host/Kconfig,添加:
config MAX_ROOT_PORTS
int "Maximum port(s) of RootHub"
depends on USB_OHCI_HCD && ARCH_S3C2410
default 1
---help---
pls select usb host number,default one host and one device.so We select one normally
修改/linux-2.6.20.3/drivers/usb/host/ohci-s3c2410.c
static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
struct platform_device *dev)
{
struct usb_hcd *hcd = NULL;
int retval;
//add by hiboy
unsigned long tmp;
#if CONFIG_MAX_ROOT_PORTS < 2
/* 1 host port, 1 slave port*/
tmp = __raw_readl(S3C2410_MISCCR);
tmp &= ~S3C2410_MISCCR_USBHOST;
__raw_writel(tmp, S3C2410_MISCCR);
s3c2410_usb_set_power(dev->dev.platform_data, 1, 1);
#else
/* 2 host port */
tmp = __raw_readl(S3C2410_MISCCR);
tmp |= S3C2410_MISCCR_USBHOST;
__raw_writel(tmp, S3C2410_MISCCR);
s3c2410_usb_set_power(dev->dev.platform_data, 1, 1);
s3c2410_usb_set_power(dev->dev.platform_data, 2, 1);
#endif
//s3c2410_usb_set_power(dev->dev.platform_data, 1, 1);
//s3c2410_usb_set_power(dev->dev.platform_data, 2, 1);
......
修改/linux-2.6.20.3/drivers/usb/core/hub.c
static int hub_configure(struct usb_hub *hub,
struct usb_endpoint_descriptor *endpoint)
{
struct usb_device *hdev = hub->hdev;
struct device *hub_dev = hub->intfdev;
u16 hubstatus, hubchange;
u16 wHubCharacteristics;
unsigned int pipe;
int maxp, ret;
char *message;
hub->buffer = usb_buffer_alloc(hdev, sizeof(*hub->buffer), GFP_KERNEL,
&hub->buffer_dma);
if (!hub->buffer) {
message = "can't allocate hub irq buffer";
ret = -ENOMEM;
goto fail;
}
hub->status = kmalloc(sizeof(*hub->status), GFP_KERNEL);
if (!hub->status) {
message = "can't 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 = "can't 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 = "can't 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 */
}