Finally, I am relieved to talk about the debugging experience of the dm9000 driver under sate210 Android this week.

Source: Internet
Author: User

// Topic: I am relieved to talk about the debugging experience of the dm9000 driver under sate210 Android this week.

// By gooogleman

// Copyright: gooogleman

// Release Date: 2012.05.05
23: 00

// Last modification: 2012.05.06
19: 00

// Original address: http://blog.csdn.net/gooogleman/article/details/7538560

// Note: A commercial website cannot be reproduced without the consent of the author and cannot delete any part of the article. Otherwise, the website will be held accountable!

// Configure //-------------------------------------------------------------------------------------------------

Finally, I touched the door. First I posted some information and waited for it to be sorted out.

Hey, last night, the sate210 dm9000 network card was able to access the Internet. I 've been driving sate210, surfing the internet continuously, watching movies and playing online videos continuously. After one day and one night, my work was still good, and I was relieved. I am very happy this time. After this debugging and porting, I feel that the problem of converting my android development from wince is not too great. I am confident that I can take it to another level in three months, my R & D passion is not much different from my graduation. Now I know so many people and so many Android predecessors guide me. I think I should make better progress.

In middle April, I received a customer requirement and needed to help him debug the android wifi on sate210. So I arranged the android engineer to do this. We have already made mature products for this s5pv210 marvell8787 WiFi module, so it took about a day to transplant it to sate210. However, the customer's requirements are always changing. After a week, the customer said that he was about to change to dm9000, And wifi was about to be used as an alternative. I also fully agreed, because the dm9000 driver under my sate210 wince6.0 has long been working very stably, I have never shut down for a week and the network is still working normally, so I think it is only a small case in Android.
For a qualified Android engineer, there is no difficulty at all. But lucky things rarely happen to me. Our Android engineer has been debugging for a week and cannot make it happen. He started to ask me whether the wince driver works normally? Why is the int pin of this Nic always high ?! As a result, the xeint0 that we use as the NIC interrupt is continuously interrupted. Once the network cable sate210 is inserted, it will crash. Later, the android engineer had no direction, so he temporarily put down the android dm9000 driver and moved sate210 android4.0. Later, on the 5.1 Labor Day, the android driver engineer had a problem at home, I took a one-week leave and went back to my hometown, but 5.1
When the customer called me and asked me if the dm9000 under android2.3 had done a good job. I told him the current situation. This old man also understood it and urged me to do it as soon as possible, he wants to make the PCB of the bottom board. I am in a hurry, so this android cainiao decided to take a look and try to solve this android dm9000 driver problem.

First, I compared the dm9000 driver of the Samsung Official Development Board with the sate210 driver, and found that there is no difference between one character. It seems that this is an open source benefit and code is available everywhere.

Then look at the kernel_v210 \ arch \ Arm \ plat-s5p under the Devs. c file, found that still use the official circuit diagram xeint9

/* Dm9000 registrations */
# Ifdef config_dm9000
Static struct resource s5p_dm9000_resources [] = {
[0] = {
. Start = s5p_pa_dm9000,
. End = s5p_pa_dm9000,
. Flags = ioresource_mem,
},
[1] = {
# If defined (config_dm9000_16bit)
. Start = s5p_pa_dm9000 + 4,
. End = s5p_pa_dm9000 + 4,
. Flags = ioresource_mem,
# Else
. Start = s5p_pa_dm9000 + 1,
. End = s5p_pa_dm9000 + 1,
. Flags = ioresource_mem,
# Endif
},
[2] = {
.Start = irq_eint9,
. End = irq_eint9,

. Flags = ioresource_irq | ioresource_irq_highlevel,
}
};

And my circuit diagram is eint0. The circuit diagram is as follows:

Therefore, I should replace irq_eint9 with irq_eint0. cmd I connect xm0addr2, according to The dm9000 Data Manual.

The access address of dm9000 is determined by the connection methods of CMD and Cs #. Cs # Is the Chip Pin of dm9000. The cmd pin is described as follows in the chip manual:
CMD pin:
Command type
When high, the access of this command cycle is data port
When low, the access of this command cycle is index Port

So the following part does not need to be changed. It just corresponds to my hardware.

. Start = s5p_pa_dm9000 + 4,
. End = s5p_pa_dm9000 + 4,

This does not need to be changed. Let's talk about the problem here. Some people are right. end = s5p_pa_dm9000 + 4. end = s5p_pa_dm9000 + 7. Here I will explain my understanding. end = s5p_pa_dm9000 + 4, and. end = s5p_pa_dm9000 + 7, which can be used on sate210 because of this. end = s5p_pa_dm9000 + 4, but the address space is short. This dm9000 only needs to point to the data port address, if. end
= S5p_pa_dm9000 + 7 is a waste of memory space.

In addition, my dm9000 CS is connected to the xm0csn1 bus of s5pv210 and belongs to bank1 of srom.

According to the memory layout of s5pv210 (memory address map)

Sate210 dm9000 index port and data port are

Index port: 0x88000000

Data port: 0x88000004

Let's take a look at the value of s5p_pa_dm9000. If it does not meet our above standards, we need to modify it.

ARCH/ARM/mach-s5pv210/include/Mach/map. H has

# Define s5pv210_pa_dm9000 (0x88000300)
# Define s5p_pa_dm9000 s5pv210_pa_dm9000

Why is it 0x88000300? In general, 0x88000000 will be selected. I don't think it will matter if we replace it with 0x88000000, because the "3" that really decides the dm9000-related address is not. No matter what, try again.

Sure enough, change to # define s5pv210_pa_dm9000
(0x88000000) is the same as the original result. Once the network cable is plugged in, the dm9000 interruption occurs continuously.

# Define s5pv210_pa_dm9000 (0x88000300) is the same as # define s5pv210_pa_dm9000 (0x88000000.

Why is printing interrupted? Is my interrupt not set? Besides

. Start = irq_eint0,
. End = irq_eint0,
. Flags = ioresource_irq | ioresource_irq_highlevel,

Are there other settings to be set?

However, this configuration is sufficient for the days when I learned the android driver, because the irq_request function calls the interrupt number to go to the lower-layer configuration. The matrix keyboard driver on s5pv210 is clearly visible to me.

In order to confirm my idea, I went to xeint4 for the flying line dm9000 and changed the interruption

. Start = irq_eint4,
. End = irq_eint4,
. Flags = ioresource_irq | ioresource_irq_highlevel,

Magic! sate210 can access the internet. I changed it to xeint2, xeint9, and xeint5. If it is changed to xeint0, the network will be plugged in and the machine will crash. At this time, I felt that this should not be a problem with the dm9000 driver and configuration, but the program of the IRQ interrupt vector register of s5pv210 in Android. Is it a Samsung bug ?! My God, we have encountered too many such things. As long as we don't refer to the schematic design on the ghost official website, we will suffer a lot and it will take a long time to solve the problem that was originally easy. So I invited a friend who worked as an android expert to help me read the code. They helped me remotely get the result at one o'clock and didn't find the result. Later, the teacher said he would come over to help me Debug on Sunday, I don't know how to be a good person, but I don't know what to do if I am a business employee. I know that he has worked overtime all day and is not in Guangzhou. It's too far away. It's not suitable. He snatched people over the weekend. I still don't want to help me solve the problem. So I tried to read the code and find IRQ.
Some of the Code shows that my eyes are so angry that I don't find the problem. The more I get excited, the more I don't want to go home from work, in this situation, I clearly remember that I had just graduated from the University of wince. I was so happy that I finally came back.

It was a great tragedy. After watching the night, I still did not see anything. Then I was helpless. I took out the schematic diagram of the Samsung Official Development Board and found an amazing message: xeint0 marks a name pshold. What is this? Looking at the schematic diagram is just three plug-ins. Looking at Samsung's Official Development Board, there is a patch cap hanging on it, and there is nothing to pick up. The younger brother asked me via QQ at night: can I find it? I said it seemed a little eye-catching. Later, when he said that there was no way, he would look at the manual. So I checked the xeint0 word. s5pv210 didn't have it at all. I found it only when I looked for gph and other words. So I used xeint [0] To find the manual, an amazing page appears:

4.10.5.8 MISC register (ps_hold_control, R/W, address = 0xe010_e81c)
Ps_hold_control bit description initial state
Reserved [31: 12] reserved 0x00005
Reserved [11: 10] reserved 0
Dir [9] direction (0: input, 1: Output) 1
Data [8] driving value (0: low, 1: High) 0
Reserved [7:1] reserved 0x00
Ps_hold_out_en [0] xeint [0] pad is controlled by this Register values and
Values of control registers for xeint [0] of gpio
Chapter is ignored when this field is '1 '.
(0: disable, 1: Enable)
0
 
Ps_hold (muxed with xeint [0]) PIN value is kept up in any power mode. This register is in alive region and reset
By xnreset or power off only.
Confidentia

-- Fortunately, the English language is not very bad. I can see where I am wrong at first glance. Well, the manual didn't look at the details. This problem is actually very simple.

The above mentioned means that the xeint [0] pin of s5pv210 has the multiplexing function. This pin is a very special pin ps_hold which is actually used to control PMIC by s5pv210, in any s5pv210 power mode, this pin can hold the level we set for him.

Sure enough, it's in mach-smdk110.c.

Static void smdkc110_power_off (void)
{
/* Ps_hold output high --> low */
Writel (readl (s5pv210_ps_hold_control_reg) & 0 xfffffeff,
S5pv210_ps_hold_control_reg );

While (1 );
}

Also available under uboot

/* To hold max8698 output before releasing power on switch,
* Set ps_hold signal to high
*/
LDR r0, = 0xe010e81c/* ps_hold_control register */
LDR R1, = 0x00005301/* ps_hold output high */
STR R1, [R0]


Uboot has set the xeint [0] pin to the ps_hold function, and has it always output a high level.

It's no wonder that when I set xeint [0] In Devs. C to a high level to trigger an interruption, it will not stop interrupted! So it turns out! But I have a question. It is actually set to the ps_hold function. Why is the xeint [0] interrupted function still valid? Isn't that a trap? Fuck
Samsung! It's killing me.

Now I know how to solve the problem. Add the following to the smdkc110_dm9000_set (void) function:

Static void _ init smdkc110_dm9000_set (void)
{
Unsigned int TMP;

Writel (readl (s5pv210_ps_hold_control_reg) & 0x5000, s5pv210_ps_hold_control_reg );

TMP = (0 <28) | (3 <24) | (7 <16) | (1 <12) | (3 <8) | (6 <4) | (0 <0 ));
_ Raw_writel (TMP, (s5p_srom_bw + 0x08); // bank1

TMP = _ raw_readl (s5p_srom_bw );
TMP & = ~ (0xf <4 );

TMP | = (0x1 <4 );
TMP | = (0x2 <4 );

_ Raw_writel (TMP, s5p_srom_bw );

TMP = _ raw_readl (s5pv210_mp01con );
TMP & = ~ (0xf <4 );
TMP | = (2 <4 );

_ Raw_writel (TMP, s5pv210_mp01con );
}

Re-make, then write sate210 zimage in fastboot, and the interruption of dm9000 slowed down.

Go to the system and open the UC browser ~ Finally, I can access the internet. If I don't shut down for a day or a night, I can still access the Internet stably. It seems that the stability is good. The debugging of the sate210 Android dm9000 driver has come to an end.

This is the first time that this android cainiao has independently solved this bug. I am very happy to write down this debugging experience and give it a souvenir for myself. You are welcome to guide me by throwing bricks.

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.