请问 uboot 不能驱动PWM7 (PD22) 是什么原因呢?
-
uboot-board.dts:
&pwm7_pin_a { pins = "PD22"; function = "pwm7"; allwinner,muxsel = <5>; drive-strength = <10>; bias-pull-up; }; &pwm7_pin_b { pins = "PD22"; muxsel = <0>; function = "gpio_in"; }; &pwm7 { pinctrl-names = "active", "sleep"; pinctrl-0 = <&pwm7_pin_a>; pinctrl-1 = <&pwm7_pin_b>; status = "okay"; };
或者:
&pio { pwm7_pin_a: pwm7@0 { pins = "PD22"; function = "pwm7"; drive-strength = <10>; bias-pull-up; }; pwm7_pin_b: pwm7@1 { pins = "PD22"; function = "gpio_in"; }; }; &pwm7 { pinctrl-names = "active", "sleep"; pinctrl-0 = <&pwm7_pin_a>; pinctrl-1 = <&pwm7_pin_b>; status = "okay"; };
LCD0配置:
&lcd0 { ... lcd_backlight = <100>; lcd_pwm_used = <1>; lcd_pwm_ch = <7>; lcd_pwm_freq = <9000>; lcd_pwm_pol = <1>; ... }
日志:
U-Boot 2018.05-g0a88ac9-dirty-config-dirty (Jan 14 2022 - 08:49:40 +0800) Allwinner Technology [00.273]DRAM: 64 MiB [00.275]Relocation Offset is: 01f02000 [00.279]secure enable bit: 0 [00.282]CPU=1008 MHz,PLL6=600 Mhz,AHB=200 Mhz, APB1=100Mhz MBus=300Mhz [00.288]flash init start [00.290]workmode = 0,storage type = 1 [00.294][mmc]: mmc driver ver uboot2018:2021-04-16 14:23:00-1 [00.299][mmc]: get sdc_type fail and use default host:tm1. [00.306][mmc]: can't find node "mmc0",will add new node [00.310][mmc]: fdt err returned <no error> [00.314][mmc]: Using default timing para [00.318][mmc]: SUNXI SDMMC Controller Version:0x50310 [00.336][mmc]: card_caps:0x3000000a [00.339][mmc]: host_caps:0x3000003f [00.343]sunxi flash init ok [00.345]line:714 init_clocks __clk_init: clk pll_periph0x2 already initialized register fix_factor clk error [00.355]drv_disp_init request pwm success, pwm7:pwm7:0x2000c00. [00.370]###LCD init [00.372]drv_disp_init finish [00.374]boot_gui_init:start [00.377]set disp.dev2_output_type fail. using defval=0 [00.382]I80_HX8537 NO info[00.386]I80_HX8537 POWER ON[00.408]boot_gui_init:finish [00.578]I80_HX8537 INITED ![00.757]hx8357 inited[00.759]hx8357 inited[00.761]hx8357 inited[00.763]hx8357 inited[00.764]hx8357 inited[00.766]hx8357 initedpartno erro : can't find partition bootloader 54 bytes read in 2 ms (26.4 KiB/s) [00.784]bmp_name=bootlogo.bmp size 307254 307254 bytes read in 15 ms (19.5 MiB/s) [00.823]Loading Environment from SUNXI_FLASH... OK [00.843]out of usb burn from boot: not need burn key root_partition is rootfs set root to /dev/mmcblk0p5 [00.853]update part info [00.857]update bootcmd [00.860]change working_fdt 0x42ac1da8 to 0x42aa1da8 [00.882]update dts Hit any key to stop autoboot: 0 FDT ERROR:get muxsel err returned FDT_ERR_INTERNAL sunxi_pwm_pin_set_state, fdt_set_all_pin, ret=-1 [00.929]I80_HX8537 BL OPEN ![00.932]LCD open finish Android's image name: d1-whycanpi0a_hx No reserved memory region found in source FDT [01.314] Starting kernel ...
都是这个错误:
FDT ERROR:get muxsel err returned FDT_ERR_INTERNAL sunxi_pwm_pin_set_state, fdt_set_all_pin, ret=-1
引脚设置复用失败?
-
然后死马做活马医, 改成gpio配置背光:
&lcd0 { ... lcd_gpio_1 = <&pio PD 22 1 0 3 1>; ... }
然后 lcd驱动里面:
static void LCD_power_on(u32 sel) { sunxi_lcd_pin_cfg(sel, 1); sunxi_lcd_delay_ms(20); sunxi_lcd_gpio_set_value(sel, 1, 1);//backlight on }
这样背光正常了。
-
u-boot 命令行读 PD_CFG2 的寄存器内容是 :
=> mm 0x02000098 02000098: 0f222222
说明 PD22_SELECT 是 1111 (IO disable)
那是dts配错了,还是u-boot有 bug 呢?
-
root@TinaLinux:/# devmem 0x02000098 0x05222222
进入Linux 之后,读出 PD22_SELECT 是 0101,
刚好是 PWM 复用。 -
按住 s 上电启动可以进入u-boot命令行,输入两行命令可以把PD22拉高:
mw 0x02000098 0x01222222 mw 0x020000A0 0x00400000
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号