Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题

11,368 Views
wangliang_nxp
Contributor II

我们采用imx6s+TW6865接收摄像头视频输入,linux内核是3.0.35。在驱动移植中遇到一些问题,不知道各位是否有遇到类似问题。

1:imx6s+TW6865通过pcie连接,原理图如下(6S和6Q pin2pin)。硬件工程师说pcie时钟信号正常。

195989_195989.pngQQ截图20170927100828.png

195990_195990.pngQQ截图20170927100931.png

 

2:配置文件和booting log如附件所示

 

3:移植步骤及问题如下:

(1)移植步骤

1 .  I add the patch file to the kernel, version is L3.0.35

2.   Change the kernel configure within make menuconfig to enable tw6865.

3.   Build the kernel and write it to emmc on board. I am using i.mx6S sabreSDB board.

 

(2)问题

log里面“IMX PCIe port: link up.”显示pcie启动正常,但是后面看不到tw6865设备的任何信息;

 

[ 2.046059] Linux video capture interface: v2.00
[ 2.050840] TW6868_: v4l2 driver version 2.0.1 loaded
[ 2.055895] pci register driver for TW6868
[ 2.060150] driver_register return for TW6868 is:0

从上面的log看我认为,TW6865驱动初始化时没有探测到设备,驱动和设备不能匹配。

 

系统启动后

root@freescale /sys/bus$ cd pci
root@freescale /sys/bus/pci$ ls
devices drivers_autoprobe rescan slots
drivers drivers_probe resource_alignment uevent
root@freescale /sys/bus/pci$ ls drivers
TW6868 ehci_hcd pci-stub pcieport
root@freescale /sys/bus/pci$ ls devices
0000:00:00.0

 

在/dev/下没有video0设备。如果我把改内核烧到pin2pin的6Q板子上,启动log中可以看到tw6865的打印信息,在/sys/bus/pci/devices除了0000:00:00.0 外还有一个0000:00:01.0,/dev/video0   也会出现。不知道什么原因,各位遇到类似问题请回复一下。

谢谢!

 

 

 

Original Attachment has been moved to: putty.log.zip

Original Attachment has been moved to: board_config.zip

Labels (1)
0 Kudos
18 Replies

9,629 Views
wangliang_nxp
Contributor II

I found another question about pcie selection in menuconfig . If i just select option "PCI Express support" not "EP mode "or "RC mode", the kernel booting was often blocked but display pcie link up. If option "PCI Express support" and "RC mode" are both select,  the kernel booting was rarely blocked but display pcie link up failed.pastedImage_1.png

I refer to the following web page PCIE link up failed when booting the kernel on IMX6QSD board 

I check the code and found the register "ANADIG_MISC1_REG" had been set in function "static int _clk_pcie_enable(struct clk *clk)" in the file "clock.c" .  So can i find the problem according to these steps described by other? 

0 Kudos

9,629 Views
b47504
NXP Employee
NXP Employee

Yes, you can try the method in other thread. RC mode option is for RC/EP validation system, and will not provide the clock to the ep devices. On the other hand, I also suggest you can try imx newer bsp release. And you can use dump_clock command to dump out the clock tree, and check if it was correct.

0 Kudos

9,629 Views
wangliang_nxp
Contributor II

Can you send me a newer bsp downloading link ? I want to try other kernel. You mentioned imx6 reference sdb board in last reply, can you send some information or webpage about it. Thanks!

0 Kudos

9,629 Views
b47504
NXP Employee
NXP Employee

You can follow this document(L4.1.15_2.0.0_LINUX_DOCS ) to setup the yocto build envionment for the new bsp:  

https://www.nxp.com/products/microcontrollers-and-processors/arm-based-processors-and-mcus/i.mx-appl...

0 Kudos

9,629 Views
wangliang_nxp
Contributor II

I tried RC mode selected when building kernel, and test pcie clock output from cpu pin, there was no waveform indeed. Then i modified clock.c file in function '_clk_pcie_enable' to output pcie clock even in RC mode, kernel booting process is often blocked and print 'IMX PCIe port: link up' in boot log but still no TW6865 device information. So i found that if pcie clock output of cpu is enable, kernel booting was often blocked or stoped. what 's the reason for that ?

0 Kudos

9,629 Views
b47504
NXP Employee
NXP Employee

I guess the tw6865 was not detected, so what's the msesage, when you using this command on the console:

# lspci -vv

9,629 Views
wangliang_nxp
Contributor II

kernel booting process was often blocked as below shown.

在2017年09月27 12时28分, "b47504"<admin@community.nxp.com>写道:

|

|

NXP Community

|

|

Re: Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题

reply from Yuan Zhao in i.MX Community - View the full discussion

I guess the tw6865 was not detected, so what's the msesage, when you using this command on the console:

  1. lspci -vv

Reply to this message by replying to this email, or go to the message on NXP Community

Start a new discussion in i.MX Community by email or at NXP Community

Following Re: Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题 in these streams: Inbox

This email was sent by NXP Community because you are a registered user.

You may unsubscribe instantly from NXP Community, or adjust email frequency in your email preferences

|

|

0 Kudos

9,629 Views
b47504
NXP Employee
NXP Employee

From your png image, the card was not dectected. Please try this change, if still not work please compare the hardware signals with 6dq which can work(power/clk/reset pin):

--- a/arch/arm/mach-mx6/board-mx6q_sabresd.c
+++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c
@@ -1913,6 +1913,15 @@ static void __init mx6_sabresd_board_init(void)
        pcie_3v3_reset();
 #endif

+       sata_clk = clk_get(dev, "imx_sata_clk");
+       if (IS_ERR(sata_clk)) {
+               dev_err(dev, "no sata clock.\n");
+       }
+       ret = clk_enable(sata_clk);
+       if (ret) {
+               dev_err(dev, "can't enable sata clock.\n");
+       }
+

0 Kudos

9,629 Views
wangliang_nxp
Contributor II

In your mail sata_clk = clk_get(dev, "imx_sata_clk");, I confused that we want test pcie clock but why the string argument is imx_sata_clk not pcie ?

在2017年09月27 15时16分, "b47504"<admin@community.nxp.com>写道:

|

|

NXP Community

|

|

Re: Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题

reply from Yuan Zhao in i.MX Community - View the full discussion

From your png image, the card was not dectected. Please try this change, if still not work please compare the hardware signals with 6dq which can work(power/clk/reset pin):

--- a/arch/arm/mach-mx6/board-mx6q_sabresd.c

+++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c

@@ -1913,6 +1913,15 @@ static void __init mx6_sabresd_board_init(void)

pcie_3v3_reset();

#endif

+ sata_clk = clk_get(dev, "imx_sata_clk");

+ if (IS_ERR(sata_clk)) {

+ dev_err(dev, "no sata clock.\n");

+ }

+ ret = clk_enable(sata_clk);

+ if (ret) {

+ dev_err(dev, "can't enable sata clock.\n");

+ }

+

Reply to this message by replying to this email, or go to the message on NXP Community

Start a new discussion in i.MX Community by email or at NXP Community

Following Re: Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题 in these streams: Inbox

This email was sent by NXP Community because you are a registered user.

You may unsubscribe instantly from NXP Community, or adjust email frequency in your email preferences

|

|

0 Kudos

9,629 Views
b47504
NXP Employee
NXP Employee

3.0.35 is too old, the lastest bsp version should be 4.1.xx. Sata 100Mhz clock also can be used as pcie phy reference clock. In some older version, we are using sata_reference clock as pcie phy reference clock. But 6dl/sl have no sata module, but the clock still can be there. So here I suggest you enable sata reference clock to exclude this kind of issue(pcie phy have no clock).

By the way, can you reproduce the issue with imx6 reference sdb board?

0 Kudos

9,629 Views
wangliang_nxp
Contributor II

what do you mean ' imx6 reference sdb board' ? I have imx6S and imx6Q boards, but they are designed by our engineers, we have no development board coming from Freescale or NXP. 

0 Kudos

9,629 Views
b47504
NXP Employee
NXP Employee

imx6s/q sdb borard is designed by nxp, and provide to the customer to refer. In general, the customer should try to reproduce the issue on the reference board firstly.

0 Kudos

9,629 Views
wangliang_nxp
Contributor II

in your reply, the code you pasted sata_clk = clk_get(dev, "imx_sata_clk"); the argument dev can be replaced with "NULL" ?

在2017年09月27 15时16分, "b47504"<admin@community.nxp.com>写道:

|

|

NXP Community

|

|

Re: Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题

reply from Yuan Zhao in i.MX Community - View the full discussion

From your png image, the card was not dectected. Please try this change, if still not work please compare the hardware signals with 6dq which can work(power/clk/reset pin):

--- a/arch/arm/mach-mx6/board-mx6q_sabresd.c

+++ b/arch/arm/mach-mx6/board-mx6q_sabresd.c

@@ -1913,6 +1913,15 @@ static void __init mx6_sabresd_board_init(void)

pcie_3v3_reset();

#endif

+ sata_clk = clk_get(dev, "imx_sata_clk");

+ if (IS_ERR(sata_clk)) {

+ dev_err(dev, "no sata clock.\n");

+ }

+ ret = clk_enable(sata_clk);

+ if (ret) {

+ dev_err(dev, "can't enable sata clock.\n");

+ }

+

Reply to this message by replying to this email, or go to the message on NXP Community

Start a new discussion in i.MX Community by email or at NXP Community

Following Re: Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题 in these streams: Inbox

This email was sent by NXP Community because you are a registered user.

You may unsubscribe instantly from NXP Community, or adjust email frequency in your email preferences

|

|

0 Kudos

9,629 Views
b47504
NXP Employee
NXP Employee

Yes, please use "NULL" instead.

0 Kudos

9,629 Views
wangliang_nxp
Contributor II

I added code you send, I can't find dev_err string in booting log, so is sata clock output normally? And next step, I need to compare pcie pins(pow/ret/clk)between board 6S and 6Q ?

Best regards!

在2017年09月27 16时37分, "b47504"<admin@community.nxp.com>写道:

|

|

NXP Community

|

|

Re: Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题

reply from Yuan Zhao in i.MX Community - View the full discussion

Yes, please use "NULL" instead.

Reply to this message by replying to this email, or go to the message on NXP Community

Start a new discussion in i.MX Community by email or at NXP Community

Following Re: Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题 in these streams: Inbox

This email was sent by NXP Community because you are a registered user.

You may unsubscribe instantly from NXP Community, or adjust email frequency in your email preferences

|

|

0 Kudos

9,629 Views
b47504
NXP Employee
NXP Employee

Yes, please compare the difference of HW signals with 6q, then can help narrow down where is the issue.

0 Kudos

9,629 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello wang liang,

    在I.MX6Q板子上没问题,说明你的内核是基于I.MX6Q进行移植的。而I.MX6Q和I.MX6D可以使用一样的代码;I.MX6DL和I.MX6S可以使用一样的代码。

    所以,你遇到的问题,是内核代码问题。你要在I.MX6DL的BSP代码基础上进行移植内核。如果你是I.MX6QDL的代码放在一起的,那么请检查一下6DL部分的代码是不是有失误的地方。


Have a great day,
TIC   Weidong Sun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

9,629 Views
wangliang_nxp
Contributor II

您好,

我用的配置文件是imx6_defconfig, 针对6S板子pin的设置在arch/arm/mach-mx6/board-mx6dl_sabresd.h 和board-mx6q_sabresd.c;而针对6Q板子设置对应文件arch/arm/mach-mx6/board-mx6q_sabresd.h和board-mx6q_sabresd.c。你邮件中意思是board-mx6q_sabresd.c文件中6Q的设置和6S的设置都在一起,可能6Q配置未必适合6S,检查这块代码是否有失误?如果我用的配置文件是imx6S_defconfig的话是不是可以避免这个问题?

谢谢!

在2017年09月27 11时39分, "Wigros Sun"<admin@community.nxp.com>写道:

|

|

NXP Community

|

|

You have been mentioned

by Wigros Sunin Re: Linux 3.0.35下移植TW6865驱动运行在imx6s上遇到问题 in NXP Community - View Wigros Sun's reference to you

Hello wang liang,

在I.MX6Q板子上没问题,说明你的内核是基于I.MX6Q进行移植的。而I.MX6Q和I.MX6D可以使用一样的代码;I.MX6DL和I.MX6S可以使用一样的代码。

所以,你遇到的问题,是内核代码问题。你要在I.MX6DL的BSP代码基础上进行移植内核。如果你是I.MX6QDL的代码放在一起的,那么请检查一下6DL部分的代码是不是有失误的地方。

Have a great day,

TIC Weidong Sun

0 Kudos