Linux USB Drivers Development __linux

Source: Internet
Author: User
Tags documentation
  hardware-driven--USB devices (upper) (Driver configuration section) under LinuxHttp://www.ibm.com/developerworks/cn/linux/l-usb/index1.html
  hardware-driven--USB devices under Linux (bottom) (Drive development section)Http://www.ibm.com/developerworks/cn/linux/l-usb/index2.html

on the problem of USB host controller driver in kernel2.6
2.6 The direct result of the USB host not working on the s3c2410 is the prompt 110 error:
USB 1-1: Device descriptor READ/64, error-110

Tracking the error code, let's see if we can find a clue to the error.

Include/asm-generic/errno.h
#define EPROTO/* PROTOCOL Error * *
#define EILSEQ/* Illegal byte sequence * *
#define ETIMEDOUT/* Connection timed out * *

Documentation/usb/error-codes.txt
-eproto (*, * *) a) Bitstuff error
b) No response packet received within the
Prescribed bus turn-around time
c) Unknown USB error

-EILSEQ (*, * *) a) CRC mismatch
b) No response packet received within the
Prescribed bus turn-around time
c) Unknown USB error

-etimedout (* *) No response packet received within the prescribed
Bus Turn-around time. This is the error may instead be
Reported As-eproto Or-eilseq.

From this we can judge that this error is related to the timeout of the USB device. Reporting this error in the Hub_port_init part of the DRIVERS/USB/CORE/HUB.C, a timeout occurred due to Usb_get_device_descriptor acquiring USB device information. This can basically determine three kinds of cases, 1, USB devices and interface problems, 2, USB core has problems, 3, USB driver have problems.
We can easily exclude 1 and 2 of the possibility that the problem should be caused by the USB driver implement part. USB driver 2.6 to the USB specification in the USB interface to the operation of the core, the implement for different devices are classified as host, Gadget, storage, and so on. The basic problem of certainty is in the ohci-s3c2410.c.

Tracking into the ohci-s3c2410.c, which mainly completes the s3c2410 USB host device initialization work, including power supplies, clocks, registers and so on.

In fact, many problems in the Internet has been encountered and resolved, we have to do is to refer to other people's successful experience, this can save time, at the same time can help us find some ideas. With Google's powerful wings, let's see what we can find:

Http://www.linux-usb.org/FAQ.html#ts6

Q:why doesn ' t USB work at all? I get "Device isn't accepting address".

A:You may have some problem with your PCI setup this ' s preventing your USB host controller from getting hardware Interrup Ts. When Linux submits a request, but never hears back to the controller, this are the diagnostic you ' LL. To the "if" to "problem, look at/proc/interrupts to" if "Interrupt count for your host controller driver ever Goes up. If it doesn ' t, this is the Problem:either your BIOS isn ' t telling the truth to Linux (ACPI sometimes confuses s, or setting the expected OS to Windows in your BIOS), or Linux doesn ' t understand what it ' s saying.

Sometimes a BIOS fix'll is available for your motherboard, and in other cases a more recent kernel would have a Linux fix . You are able to work around this by passing the noapic boot option to your kernel, or (where you ' re using a add-in PCI Card) Moving the "USB adapter to some" other PCI slot. If you are using a current kernel and BIOS, the "problem to" Linux-kernel mailing list with details about your m Otherboard and BIOS.

One suggestion for Google's return of a large number of results is to set the OLD_SCHEME_FIRST flag so that drivers prioritize devices that use older structures:
Set Old_scheme_first=y
The test results didn't help much, and that was not the reason.

Linux-usb-devel Mail list Ben's brother is constantly updating his ohci-s3c2410 driver, but it doesn't seem to have finished yet.
Http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg33670.html

Trace ohci-s3c2410.c, found to_s3c2410_info return null, it is obvious that platform_data is undefined, there are already struct in include/asm/arch/usb-control.h S3c2410_hcd_info, then imitate Simtec's usb-simtec.c, to construct own platform_data.

static struct S3c2410_hcd_info smdk2410_usbcfg = {
. port[0] = {
. Flags = s3c_hcdflg_used
},
};

And then complete the initialization in Smdk2410_init:

S3c_device_usb.dev.platform_data = &smdk2410_usbcfg;

Re-make zimage, the situation has changed:
A line of debug information is available during the initialization of the USB controller:
s3c2410-ohci:ctrl:typereq=0x2303 val=0x8 idx=0x1 len=0 ==>-115

Check out this error code in INCLUDE/ASM-GENERIC/ERRNO.H:
#define EINPROGRESS * * Operation now Progress * *

The explanation in the Documentation/usb/error-codes.txt is:
-einprogress URB still pending, no results yet
(which is, if drivers, the it ' s a bug.)

No matter what USB devices are plugged in, USB mouse, u disk, USB wireless network card, are reported:
<6>USB 1-1: New full speed USB device using S3C2410-OHCI and address 2
<7>S3C2410-OHCI s3c2410-ohci:urb c3c430c0 Path 1 ep0in 5ec20000 cc 5–> status-110

It appears that the two errors should be associated, that the previous 115 error caused the subsequent 110 error, and that 115 errors were generated during the tracing process, and from this point of view, the Getportstatus You can temporarily block the implementation of the Getportstatus in 0hci-s3c2410.c, continue to observe the changes, the result is 110 error, so you can rule out 115 caused 110 false assumptions.

Finally suspected that the clock set the problem, then refer to the 2.4.18 code in Clk_enable (CLK), followed by a udelay (11), but the error is not resolved.

Then need to ohci-s3c2410.c for detailed troubleshooting, 2.6 the system resources are detailed classification, which makes the driver to complete the initialization of the corresponding device registers, check the OHCI-S3C2410.C, unexpectedly did not set the code for S3C24102410 's Upllcon, the problem is very likely here, user manual said Upllcon need 48.00MHz output, so in S3c2410_start_ HC Increase:

__raw_writel ((0x78<<12) | ( 0X02&LT;&LT;4) | (0x03), S3c2410_upllcon);

Ok. USB host can work, but the first on the electricity will also appear 110 errors, reset can be normal, 2410 on this upllcon problem for a long time, 2.4 kernel also often appear, because the value of Upllcon is not set successfully, then you need to set the value of the check, Until it succeeds.

Change the above code to:
unsigned long upllvalue = (0x78<<12) | (0x02<<4) | (0x03);

while (Upllvalue!= __raw_readl (S3c2410_upllcon))
{
__raw_writel (Upllvalue, S3c2410_upllcon);
Mdelay (1);
}

Do not need to modify kconfig and makefile, put the ohci-s3c2410.c into the drivers/usb/host/directory, edit the DRIVERS/USB/HOST/OHCI-HCD.C, turn to the end to add the following red Section code:

#ifdef config_soc_au1x00
#include "ohci-au1xxx.c"
#endif

#ifdef config_arch_s3c2410
#include "ohci-s3c2410.c"
#endif


#if! (defined (CONFIG_PCI) \
|| Defined (config_sa1111) \
|| Defined (CONFIG_ARCH_OMAP) \
|| Defined (config_arch_lh7a404) \
|| Defined (config_pxa27x) \
|| Defined (config_soc_au1x00) \
|| Defined (config_arch_s3c2410) \
)
#error "Missing bus glue for OHCI-HCD"
#endif

After modification can find a USB device, but cannot mount, has the file system support compiled into the kernel, but still prompts the "Sda:unknown partition table", can not mount, this How to solve it?
Enable to Config_msdos_partition options

Thanks to the experience provided by Panjet, it is very helpful to me!

I followed your method to add s3c2410 OHCI driver to the Linux 2.6.14 kernel, and now there are some questions, please enlighten me.

> then complete the initialization in Smdk2410_init:
>s3c_device_usb.dev.platform_data = &smdk2410_usbcfg;
I've never found smdk2410_init this function, 2.6.11 's kernel has also been searched. In which file, please.
At present I put
S3c_device_usb.dev.platform_data = &smdk2410_usbcfg;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.