The USB driver of s3c2440 has better support in the newer LINUX kernel, and the code modification is less, but there are still some problems. The modification records are as follows:
1. Pay attention to selecting the following items in the compilation options, and the others can be selected according to actual conditions:
[*]USB support-à
<*> support for Host-side USB
[*] USB device filesystem
[*] USB device class-devices(DEPRECATED)
<*>OHCI HCD support
<*>USB Mass storage support
2. Modify drivers/usb/host/ohci-s3c2410.c (to solve error -62 when inserting USB device)
#include
#include
unsigned long upllvalue = (0x78<<12)|(0x02<<4)|(0x03); //add static void s3c2410_start_hc function
while (upllvalue !=__raw_readl(S3C2410_UPLLCON))
{
__raw_writel(upllvalue, S3C2410_UPLLCON);
mdelay(1);
}
Write S3C2410_UPLLCON register to set USB clock UPLL to 48MHz
If you still have problems, refer to the article by tpu boss:
Today, tpu took out a 2440 board for debugging and found that despite various measures, USBHOST would occasionally not work. UCLK was brought out through CLKOUT0 and checked with an oscilloscope. It was found that when it did not work, UCLK was not stable at all. So after careful consideration, there are several places that affect USB:
1. External crystal oscillator 16.9344Mhz
2. UPLL LOCKTIME of LOCKTIME register
3.UPLLCON
4. UPLL switch of CLKSLOW register
Next, exclude them one by one:
1. The crystal oscillator is shared by MPLL and UPLL. I have never heard of MPLL being unstable.
2. I suspect that LOCKTIME is too large (0xffff), but reducing it has no effect.
3. When UCLK is unstable, it is useless to repeatedly set UPLLCON.
4. When UCLK is unstable, switching UPLL is effective! When UCLK is stable, switching UPLL will also cause instability.
That is to say, UPLL may fail to synchronize when it starts. But why? UPLL and MPLL should have the same structure, and MPLL never has problems. UPLL just has a lower frequency than MPLL. Then let's look for it from the frequency.
Now set a relatively low frequency (such as 7Mhz) for UPLLCON. At this time, no matter how UPLL is turned on and off, UCLK is still not stable. Well, dawn has appeared! Then set a super high frequency (112Mhz). Haha, no matter how UPLL is turned on and off, or powered on, UCLK is very stable.
The problem can then be described as follows: UPLL cannot start reliably at low frequencies.
Solution to the problem: First give UPLL a higher frequency, and then set the required frequency after it works stably.
Note: If you want to turn on or off the UPLL switch in CLKSLOW, you must also follow this setting procedure.
After this modification, the TPU switched on and off for more than 100 times, and UCLK was always very stable. This is only the case for 2440, but it should also be applicable to 2410. You can actually test and verify it.
Change the s3c2410_start_hc function as follows:
static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)
{
struct s3c2410_hcd_info *info = dev->dev.platform_data;
//--------------------------------
unsigned long upllvalue = (0x69<<12)|(0x01<<4)|(0x02); //Set the higher frequency first
while (upllvalue != __raw_readl(S3C2410_UPLLCON))
{
__raw_writel(upllvalue, S3C2410_UPLLCON);
mdelay(1);
}
clk_enable(usb_clk);
mdelay(11);
clk_enable(clk);
mdelay(2);
clk_disable(usb_clk);
mdelay(11);
upllvalue = (0x78<<12)|(0x02<<4)|(0x03); //Change to 48MHz
while (upllvalue != __raw_readl(S3C2410_UPLLCON))
{
__raw_writel(upllvalue, S3C2410_UPLLCON);
mdelay(1);
}
//--------------------------------
dev_dbg(&dev->dev, "s3c2410_start_hc:/n");
clk_enable(usb_clk);
mdelay(2); /* let the bus clock stabilize */
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);
}
}
}
The problem is solved. I would like to express my highest respect to tpu boss here. The pursuit of knowledge will never end!
3. An error occurred when mounting the USB drive, saying that the device could not be found, but the ls /dev command showed that there was sda1
This is usually because the USB flash drive's file system is not supported, so support for VFAT and NTFS should be added when the kernel is compiled.
Previous article:Solution to USB driver failure under DNW
Next article:S3C2440 implements DM9000 network card driver transplantation
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- Compensation Method for High-Precision Temperature Measurement Using MSP430 Microcontroller
- Machine A sends control command characters
- [Review of Arteli Development Board AT32F421] + Raising a Watchdog
- Let's talk about five cents and share your experience in voltage regulation circuit design
- Share: A brief analysis of the access control system using RFID technology
- MicropyCli - Micropython project management automation
- 【AIoT Smart Smoke Detection System】System Design Overview
- Doping of semiconductors from the perspective of energy levels
- EEWORLD University - HDMI 2.1 Design and Testing Update
- Design of breathing light based on FPGA