TI中文支持网
TI专业的中文技术问题搜集分享网站

AM335X adc 移植后系统出错

各位:

   我现在用am335x调试ADC,用adc进行数据采集,用的kernel里不支持adc,我将sdk6 中的\drivers\staging\iio\adc\ti_adc.c等文件移植到我目前的kernel中,并对board-am335xevm.c做了相应的修改(只加adc,没有加touchscreen部分),编译进内核,启动板子时,发现系统报错,系统不能启动,串口信息跟踪下来发现,错误出现在 tiadc_probe函数的

pdata = (struct mfd_tscadc_board *)tscadc_dev->dev->platform_data;
if (!pdata || !pdata->adc_init)  怀疑可能是pdata 指针的问题,有哪位遇到相同情况的吗?谢谢!

tiadc_probe
[ 2.217767] Unable to handle kernel NULL pointer dereference at virtual address 00000002
[ 2.226445] pgd = c0004000
[ 2.229276] [00000002] *pgd=00000000
[ 2.233034] Internal error: Oops: 5 [#1]
[ 2.237139] Modules linked in:
[ 2.240343] CPU: 0 Not tainted (3.2.0 #1)
[ 2.244926] PC is at dev_driver_string+0x18/0x44
[ 2.249764] LR is at __dev_printk+0x28/0x68
[ 2.254146] pc : [<c020c2dc>] lr : [<c020c3b0>] psr: 20000013
[ 2.254156] sp : cf01ddd0 ip : cf01dde0 fp : cf01dddc
[ 2.266172] r10: c05a6414 r9 : 00000000 r8 : 00000000
[ 2.271643] r7 : cf214200 r6 : cf01de10 r5 : c0502000 r4 : c06719d8
[ 2.278479] r3 : 00000002 r2 : cf01de10 r1 : c06719d8 r0 : c06719d8
[ 2.285318] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
[ 2.292973] Control: 10c5387d Table: 80004019 DAC: 00000015
[ 2.298990] Process swapper (pid: 1, stack limit = 0xcf01c2f0)
[ 2.305098] Stack: (0xcf01ddd0 to 0xcf01e000)
[ 2.309666] ddc0: cf01de04 cf01dde0 c020c3b0 c020c2d0
[ 2.318239] dde0: c00f93c0 cf214208 cf211440 cf214208 ffffffea c06a9988 cf01de28 cf01de08
[ 2.326811] de00: c020c508 c020c394 c040dd0c cf01de30 c054139c cf01de0c cf01de6c cf01de6c
[ 2.335384] de20: cf01de38 c040c098 c020c4d8 c054139c c0672c0c c0672c0c 00000000 c05a6414
[ 2.343956] de40: cf01de5c cf214208 c06d18f0 c06a9988 c069ce84 00000000 00000000 c05a6414
[ 2.352529] de60: cf01de7c cf01de70 c0210ec0 c040c05c cf01deac cf01de80 c020f8d4 c0210eb0
[ 2.361101] de80: cf01deac cf01de90 c0211754 cf214208 c069ce84 cf21423c cf237ac0 00000000
[ 2.369673] dea0: cf01decc cf01deb0 c020fb74 c020f82c c020fae0 00000000 c069ce84 c020fae0
[ 2.378245] dec0: cf01def4 cf01ded0 c020e630 c020faec cf006ef8 cf212970 c01b65d4 c069ce84
[ 2.386817] dee0: c069ce84 c068a048 cf01df04 cf01def8 c020f4fc c020e5f0 cf01df34 cf01df08
[ 2.395390] df00: c020f150 c020f4e4 c04eb63c cf01df18 c069ce84 c0650e90 c06af7c0 cf01c000
[ 2.403962] df20: 00000000 c05a6414 cf01df5c cf01df38 c0210090 c020efd4 c0650d90 c0650e90
[ 2.412534] df40: c06af7c0 cf01c000 00000000 c05a6414 cf01df6c cf01df60 c0211270 c021001c
[ 2.421105] df60: cf01df7c cf01df70 c05a6428 c0211230 cf01dfd4 cf01df80 c0008704 c05a6420
[ 2.429676] df80: c0072778 c00f127c 0000007f 00000000 cf01dfb4 32310ec0 00000037 00000000
[ 2.438249] dfa0: cf01dfbc 0000018c c067f920 c0650d90 c0650e90 c003ee54 00000013 00000000
[ 2.446821] dfc0: 00000000 00000000 cf01dff4 cf01dfd8 c058288c c00085e8 00000000 00000000
[ 2.455392] dfe0: 00000000 c0582808 00000000 cf01dff8 c003ee54 c0582814 efedffaf fffbfbbe
[ 2.463952] Backtrace:[ 2.466533] [<c020c2c4>] (dev_driver_string+0x0/0x44) from [<c020c3b0>] (__dev_printk+0x28/0x68)
[ 2.475746] [<c020c388>] (__dev_printk+0x0/0x68) from [<c020c508>] (dev_err+0x40/0x48)
[ 2.484036] r6:c06a9988 r5:ffffffea r4:cf214208

Jian Zhou:

首先明确下,你不是在SDK06上直接做的修改么,目前看到SDK06是提供ADC驱动的:

http://processors.wiki.ti.com/index.php/AM335x_ADC_Driver%27s_Guide

xmliu9826:

回复 Jian Zhou:

谢谢,不是在sdk6上直接做的修改,是按照您链接中的文章的指导方法,将我们kernel中缺少的ti_adc.c等文件移植到我们自己的kernel中,我们的板子直接用sdk6启动后会有问题。

Jian Zhou:

回复 xmliu9826:

你的kernel是什么版本的,是不是没有移植完整。

xmliu9826:

回复 Jian Zhou:

谢谢回复

我的kenel版本是3.2.0 我也怀疑有些文件没移植,麻烦帮我看下除了下面提到的文件,还需要哪些文件?

在\drivers\staging\iio\adc中加入了ti_adc.c 在\include\linux\platform_data下加入 ti_adc.h 

在\include\linux\mfd加入了ti_tscadc.h 在Device中加入了

int __init am33xx_register_mfd_tscadc(struct mfd_tscadc_board *pdata)

同时在board-am335xevm.c增加

static struct adc_data am335x_adc_data = { .adc_channels = 4,};

static struct mfd_tscadc_board tscadc = {//.tsc_init = &am335x_touchscreen_data, .adc_init = &am335x_adc_data,};

static void mfd_tscadc_init(int evm_id, int profile){ int err;

err = am33xx_register_mfd_tscadc(&tscadc); if (err) pr_err("failed to register touchscreen device\n");}

赞(0)
未经允许不得转载:TI中文支持网 » AM335X adc 移植后系统出错
分享到: 更多 (0)