Repository URL to install this package:
|
Version:
5.37 ▾
|
'V)%UZg/ å VHÊn Ý # overlays fixup script
# implements (or rather substitutes) overlay arguments functionality
# using u-boot scripting, environment variables and "fdt" command
# setexpr test_var ${tmp_bank} - A
# works only for hex numbers (A-F)
setenv decompose_pin 'setexpr tmp_bank sub "P(B|C|D|E|G|H|I)\\d+" "\\1";
setexpr tmp_pin sub "P\\S(\\d+)" "\\1";
test "${tmp_bank}" = "B" && setenv tmp_bank 1;
test "${tmp_bank}" = "C" && setenv tmp_bank 2;
test "${tmp_bank}" = "D" && setenv tmp_bank 3;
test "${tmp_bank}" = "E" && setenv tmp_bank 4;
test "${tmp_bank}" = "G" && setenv tmp_bank 6;
test "${tmp_bank}" = "H" && setenv tmp_bank 7;
test "${tmp_bank}" = "I" && setenv tmp_bank 8'
if test -n "${param_spinor_spi_bus}"; then
test "${param_spinor_spi_bus}" = "0" && setenv tmp_spi_path "spi@01c05000"
test "${param_spinor_spi_bus}" = "1" && setenv tmp_spi_path "spi@01c06000"
test "${param_spinor_spi_bus}" = "2" && setenv tmp_spi_path "spi@01c17000"
fdt set /soc@01c00000/${tmp_spi_path} status "okay"
fdt set /soc@01c00000/${tmp_spi_path}/spiflash status "okay"
if test -n "${param_spinor_max_freq}"; then
fdt set /soc@01c00000/${tmp_spi_path}/spiflash spi-max-frequency "<${param_spinor_max_freq}>"
fi
if test "${param_spinor_spi_bus}" = "0" && test "${param_spinor_spi_cs}" = "1"; then
fdt set /soc@01c00000/${tmp_spi_path}/spiflash reg "<1>"
fi
env delete tmp_spi_path
fi
if test -n "${param_spidev_spi_bus}"; then
test "${param_spidev_spi_bus}" = "0" && setenv tmp_spi_path "spi@01c05000"
test "${param_spidev_spi_bus}" = "1" && setenv tmp_spi_path "spi@01c06000"
test "${param_spidev_spi_bus}" = "2" && setenv tmp_spi_path "spi@01c17000"
fdt set /soc@01c00000/${tmp_spi_path} status "okay"
fdt set /soc@01c00000/${tmp_spi_path}/spidev status "okay"
if test -n "${param_spidev_max_freq}"; then
fdt set /soc@01c00000/${tmp_spi_path}/spidev spi-max-frequency "<${param_spidev_max_freq}>"
fi
if test "${param_spidev_spi_bus}" = "0" && test "${param_spidev_spi_cs}" = "1"; then
fdt set /soc@01c00000/${tmp_spi_path}/spidev reg "<1>"
fi
env delete tmp_spi_path
fi
if test "${param_spi2_bus_pins}" = "b"; then
fdt get value tmp_phandle1 /soc@01c00000/pinctrl@01c20800/spi2@1 phandle
fdt get value tmp_phandle2 /soc@01c00000/pinctrl@01c20800/spi2_cs0@1 phandle
fdt set /soc@01c00000/spi@01c17000 pinctrl-0 "<${tmp_phandle1}>"
fdt set /soc@01c00000/spi@01c17000 pinctrl-1 "<${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
fi
if test -n "${param_pps_pin}"; then
setenv tmp_bank "${param_pps_pin}"
setenv tmp_pin "${param_pps_pin}"
run decompose_pin
fdt set /soc@01c00000/pinctrl@01c20800/pps_pins pins "${param_pps_pin}"
fdt get value tmp_phandle /soc@01c00000/pinctrl@01c20800 phandle
fdt set /pps@0 gpios "<${tmp_phandle} ${tmp_bank} ${tmp_pin} 0>"
env delete tmp_pin tmp_bank tmp_phandle
fi
if test "${param_pps_falling_edge}" = "1"; then
fdt set /pps@0 assert-falling-edge
fi
if test "${param_pwm_pins}" = "0"; then
fdt get value tmp_phandle /soc@01c00000/pinctrl@01c20800/pwm0@0
fdt set /soc@01c00000/pwm@01c20e00 pinctrl-0 "<${tmp_phandle}>"
env delete tmp_phandle
fi
if test "${param_pwm_pins}" = "1"; then
fdt get value tmp_phandle /soc@01c00000/pinctrl@01c20800/pwm1@0
fdt set /soc@01c00000/pwm@01c20e00 pinctrl-0 "<${tmp_phandle}>"
env delete tmp_phandle
fi
if test -n "${param_w1_pin}"; then
setenv tmp_bank "${param_w1_pin}"
setenv tmp_pin "${param_w1_pin}"
run decompose_pin
fdt set /soc@01c00000/pinctrl@01c20800/w1_pins pins "${param_w1_pin}"
fdt get value tmp_phandle /soc@01c00000/pinctrl@01c20800 phandle
fdt set /onewire@0 gpios "<${tmp_phandle} ${tmp_bank} ${tmp_pin} 0>"
env delete tmp_pin tmp_bank tmp_phandle
fi
if test -n "${param_mmc2_cd_pin}"; then
setenv tmp_bank "${param_mmc2_cd_pin}"
setenv tmp_pin "${param_mmc2_cd_pin}"
run decompose_pin
fdt get value tmp_phandle /soc@01c00000/pinctrl@01c20800 phandle
fdt set /soc@01c00000/mmc@01c11000 cd-gpios "<${tmp_phandle} ${tmp_bank} ${tmp_pin} 1>"
fi
if test "${param_mmc2_non_removable}" = "1"; then
fdt rm /soc@01c00000/mmc@01c11000 cd-gpios
fdt set /soc@01c00000/mmc@01c11000 non-removable
fi
if test "${param_w1_pin_int_pullup}" = "1"; then
fdt set /soc@01c00000/pinctrl@01c20800/w1_pins bias-pull-up
fi
if test "${param_uart2_rtscts}" = "1"; then
fdt get value tmp_phandle /soc@01c00000/pinctrl@01c20800/uart2@0 phandle
fdt set /soc@01c00000/serial@01c28800 pinctrl-0 "<${tmp_phandle}>"
env delete tmp_phandle
fi
if test "${param_uart3_pins}" = "b"; then
if test "${param_uart3_rtscts}" = "1"; then
fdt get value tmp_phandle1 /soc@01c00000/pinctrl@01c20800/uart3_pins_b phandle
fdt get value tmp_phandle2 /soc@01c00000/pinctrl@01c20800/uart3_pins_b_rts_cts phandle
fdt set /soc@01c00000/serial@01c28c00 pinctrl-names "default" "default"
fdt set /soc@01c00000/serial@01c28c00 pinctrl-0 "<${tmp_phandle1}>"
fdt set /soc@01c00000/serial@01c28c00 pinctrl-1 "<${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
else
fdt get value tmp_phandle /soc@01c00000/pinctrl@01c20800/uart3_pins_b phandle
fdt set /soc@01c00000/serial@01c28c00 pinctrl-0 "<${tmp_phandle}>"
env delete tmp_phandle
fi
else
if test "${param_uart3_rtscts}" = "1"; then
fdt get value tmp_phandle1 /soc@01c00000/pinctrl@01c20800/uart3_pins_a_2 phandle
fdt get value tmp_phandle2 /soc@01c00000/pinctrl@01c20800/uart3_pins_a_rts_cts phandle
fdt set /soc@01c00000/serial@01c28c00 pinctrl-names "default" "default"
fdt set /soc@01c00000/serial@01c28c00 pinctrl-0 "<${tmp_phandle1}>"
fdt set /soc@01c00000/serial@01c28c00 pinctrl-1 "<${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
fi
fi
if test "${param_uart4_pins}" = "b"; then
fdt get value tmp_phandle /soc@01c00000/pinctrl@01c20800/uart4@1 phandle
fdt set /soc@01c00000/serial@01c29000 pinctrl-0 "<${tmp_phandle}>"
env delete tmp_phandle
fi