NUC977 解決GPIO被複用

在使用NUC977遇到gpio(GPB12)被複用,調試信息如下所示

[ 3.730000] Please Check GPIOB12's multi-function = 0xb 
[    3.760000] ------------[ cut here ]------------
[    3.760000] WARNING: at drivers/gpio/gpiolib.c:160 gpio_ensure_requested+0x6c/0xd8()
[    3.760000] autorequest GPIO-44
[    3.760000] Modules linked in: nuc970_lcd_matrix_ctrl(+)
[    3.760000] CPU: 0 PID: 396 Comm: insmod Not tainted 3.10.101 #209
[    3.760000] Backtrace: 
[    3.760000] [<c0011f34>] (dump_backtrace+0x0/0x10c) from [<c0012148>] (show_stack+0x18/0x1c)
[    3.760000]  r6:c01abd40 r5:00000009 r4:c3aebd68 r3:00000000
[    3.760000] [<c0012130>] (show_stack+0x0/0x1c) from [<c030b750>] (dump_stack+0x20/0x28)
[    3.760000] [<c030b730>] (dump_stack+0x0/0x28) from [<c001cba0>] (warn_slowpath_common+0x54/0x70)
[    3.760000] [<c001cb4c>] (warn_slowpath_common+0x0/0x70) from [<c001cbf4>] (warn_slowpath_fmt+0x38/0x40)
[    3.760000]  r8:00000001 r7:60000013 r6:0000002c r5:c041f2e8 r4:c0459ecc
r3:00000009
[    3.760000] [<c001cbbc>] (warn_slowpath_fmt+0x0/0x40) from [<c01abd40>] (gpio_ensure_requested+0x6c/0xd8)
[    3.760000]  r3:0000002c r2:c039ec3c
[    3.760000] [<c01abcd4>] (gpio_ensure_requested+0x0/0xd8) from [<c01abfbc>] (gpiod_direction_output+0x80/0x1a4)
[    3.760000]  r6:c3aea028 r5:c041f2e8 r4:c0459ecc r3:c01ad170
[    3.760000] [<c01abf3c>] (gpiod_direction_output+0x0/0x1a4) from [<c01ac0fc>] (gpio_direction_output+0x1c/0x20)
[    3.760000]  r8:c042ffe0 r7:00000000 r6:c3aea000 r5:bf000c14 r4:00000001
[    3.760000] [<c01ac0e0>] (gpio_direction_output+0x0/0x20) from [<bf003130>] (MatrixLcd_init+0x130/0x1a4 [nuc970_lcd_matrix_ctrl])
[    3.760000]  r4:00000000 r3:00000000
[    3.760000] [<bf003000>] (MatrixLcd_init+0x0/0x1a4 [nuc970_lcd_matrix_ctrl]) from [<c0008880>] (do_one_initcall+0x104/0x170)
[    3.760000]  r4:c3aebf44
[    3.760000] [<c000877c>] (do_one_initcall+0x0/0x170) from [<c005d708>] (load_module+0x1634/0x1d78)
[    3.760000] [<c005c0d4>] (load_module+0x0/0x1d78) from [<c005df30>] (SyS_init_module+0xe4/0xf8)
[    3.760000] [<c005de4c>] (SyS_init_module+0x0/0xf8) from [<c000ec60>] (ret_fast_syscall+0x0/0x34)
[    3.760000]  r6:bea1ce88 r5:00000000 r4:00000000
[    3.760000] ---[ end trace 297a8d8c3d2fba72 ]---
[    4.170000] Please Check GPIOB12's multi-function = 0xb 

解決方法
修改pinctrl-nuc970.c,如SPI做主機用,可屏蔽spi從機CS腳
//static const unsigned spi1_0_pins[] = {0x1C, 0x1D, 0x1E, 0x1F};
static const unsigned spi1_0_pins[] = {0x1D, 0x1E, 0x1F};

發佈了36 篇原創文章 · 獲贊 23 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章