代码之家  ›  专栏  ›  技术社区  ›  Matthew

在带有DAS U-Boot的Raspberry Pi计算模块上使用GPIO关机关闭PSU

  •  0
  • Matthew  · 技术社区  · 9 年前

    dtoverlay=gpio-poweroff,gpiopin=6,active_low=1
    

    有了U-Boot,覆盆子皮靴可以正常工作,它甚至可以关机,但从不切换GPIO6。这使PSU保持运行,唯一的修复方法是按住电源按钮至少5秒钟。我知道dt blob。加载并应用bin,因为电路板有一个摄像头,只能与正确的dt blob一起工作。箱子

    在这一点上,我已经没有主意了。我尝试过:

    • 手动执行上述操作,并将反编译代码交织在一起。
    • fdt addr 和 fdt apply
    • 克隆linux/arch/arm/boot/dts,编写一个MakeFile并用我的更改编译它们,会导致U-boot加载,Raspbian加载,但gpio关闭不起作用。
    • 其他几乎不值得一提的尝试。

    我尝试的一切似乎都不管用,我也不知道该往哪里走。

    以下是一些正在使用的文件供参考:

    #Setting default bootargs
    setenv original_bootargs console=ttyS0 console=tty1 rootfstype=ext4 fsck.repair=yes hdmi.audio=0 disp.screen0_output_mode=1920x1080p60:1280x720p60:800x600p60:EDID rootwait panic=10 # console MUST be ttyS0 or it WILL NOT BOOT!
    
    # Identify if we are using partition 2 or 3
    if fatload mmc 0:1 ${loadaddr} swap; then echo "Using Partition 3"; setenv partition 3; else echo "Using Partition 2"; setenv partition 2; fi
    
    # Check for recovery
    if fatload mmc 0:1 ${loadaddr} recovery; then echo "Using Recovery Partition"; setenv partition 4; fi
    #if gpio input 32 || fatload mmc 0:1 ${loadaddr} recovery; then echo "Using Recovery Partition"; setenv partition 4; fi
    
    # Create an empty file to detect boot failures
    fatwrite mmc 0:1 ${kernel_addr_r} recovery 0
    
    # Set bootargs
    setenv bootargs "${original_bootargs} root=/dev/mmcblk0p${partition}"
    
    # Load the existing Linux kernel into RAM
    echo Loading partition ${partition}
    ext4load mmc 0:${partition} ${kernel_addr_r} kernel.img
    # Boot the kernel we have just loaded
    bootz ${kernel_addr_r} - ${fdt_addr}
    

    不知道为什么,但它以低分辨率启动,红色和蓝色互换。编译时使用 mkimage -A arm -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n "Boot Script" -d boot.cmd boot.scr

    # For more options and information see
    # http://rpf.io/configtxt
    # Some settings may impact device functionality. See link above for details
    
    # uncomment if you get no picture on HDMI for a default "safe" mode
    #hdmi_safe=1
    
    # uncomment this if your display has a black border of unused pixels visible
    # and your display can output without overscan
    disable_overscan=1
    
    # uncomment the following to adjust overscan. Use positive numbers if console
    # goes off screen, and negative if there is too much border
    #overscan_left=16
    #overscan_right=16
    #overscan_top=16
    #overscan_bottom=16
    
    # uncomment to force a console size. By default it will be display's size minus
    # overscan.
    #framebuffer_width=1280
    #framebuffer_height=720
    
    # uncomment if hdmi display is not detected and composite is being output
    #hdmi_force_hotplug=1
    
    # uncomment to force a specific HDMI mode (this will force VGA)
    #hdmi_group=1
    #hdmi_mode=1
    
    # uncomment to force a HDMI mode rather than DVI. This can make audio work in
    # DMT (computer monitor) modes
    #hdmi_drive=2
    
    # uncomment to increase signal to HDMI, if you have interference, blanking, or
    # no display
    #config_hdmi_boost=4
    
    # uncomment for composite PAL
    #sdtv_mode=2
    
    #uncomment to overclock the arm. 700 MHz is the default.
    #arm_freq=800
    
    # Uncomment some or all of these to enable the optional hardware interfaces
    dtparam=i2c_arm=on
    #dtparam=i2s=on
    #dtparam=spi=on
    
    # Uncomment this to enable the lirc-rpi module
    #dtoverlay=lirc-rpi
    
    # Additional overlays and parameters are documented /boot/overlays/README
    
    # Enable audio (loads snd_bcm2835)
    #dtparam=audio=on
    
    gpu_mem=128
    
    start_x=1
    
    dtoverlay=gpio-poweroff,gpiopin=6,active_low=1
    
    dtdebug=1
    
    2 回复  |  直到 9 年前
        1
  •  1
  •   Matthew    9 年前

    所以,我通过编译我自己的bcm27***多少修复了它。dtb文件,在其原始内容之后连接以下内容:

    / {
        compatible = "brcm,bcm2709";
    
       power_ctrl: power_ctrl {
           compatible = "gpio-poweroff";
           gpios = <&gpio 6 1>;
       };
    };
    

        2
  •  1
  •   Matthew    9 年前

    我做到了,答案如下:

    # Manually apply overlay
    setenv fdt_length 50000
    setexpr kernel_addr_r ${fdt_addr} + ${fdt_length}
    fdt addr ${fdt_addr} # Load the existing tree
    fdt boardsetup # Device specific setup
    fdt move ${fdt_addr} ${fdt_addr} ${fdt_length} # Resize the loaded fdt to ${fdt_length}
    fatload mmc 0:1 ${kernel_addr_r} overlays/gpio-poweroff.dtbo
    fdt apply ${kernel_addr_r} # Apply the overlay
    

    编辑默认设备树和dt blob。宾最终以徒劳告终。您需要做的是自己在uboot内手动应用覆盖。src。

    在应用覆盖之前,您需要使用 fdt move ,然后您可以从fat加载和应用。如果要应用更多覆盖,只需添加其他行,例如:

    fatload mmc 0:1 ${kernel_addr_r} overlays/rpi-tv.dtbo
    fdt apply ${kernel_addr_r} # Apply the overlay
    

    推荐文章