Files

49 lines
2.0 KiB
Plaintext

# overlays fixup script
# implements (or rather substitutes) overlay arguments functionality
# using u-boot scripting, environment variables and "fdt" command
if test -n "${param_spinor_spi_bus}"; then
test "${param_spinor_spi_bus}" = "0" && setenv tmp_spi_path "spi@1c05000"
test "${param_spinor_spi_bus}" = "1" && setenv tmp_spi_path "spi@1c06000"
test "${param_spinor_spi_bus}" = "2" && setenv tmp_spi_path "spi@1c17000"
fdt set /soc/${tmp_spi_path} status "okay"
fdt set /soc/${tmp_spi_path}/spiflash status "okay"
if test -n "${param_spinor_max_freq}"; then
fdt set /soc/${tmp_spi_path}/spiflash spi-max-frequency "<${param_spinor_max_freq}>"
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@1c05000"
test "${param_spidev_spi_bus}" = "1" && setenv tmp_spi_path "spi@1c06000"
test "${param_spidev_spi_bus}" = "2" && setenv tmp_spi_path "spi@1c17000"
fdt set /soc/${tmp_spi_path} status "okay"
fdt set /soc/${tmp_spi_path}/spidev status "okay"
if test -n "${param_spidev_max_freq}"; then
fdt set /soc/${tmp_spi_path}/spidev spi-max-frequency "<${param_spidev_max_freq}>"
fi
env delete tmp_spi_path
fi
if test "${param_uart1_pins}" = "b"; then
fdt get value tmp_phandle /soc/pinctrl@1c28400/uart1@1 phandle
fdt set /soc/serial@1c28400 pinctrl-0 "<${tmp_phandle}>"
env delete tmp_phandle
fi
if test "${param_uart2_rtscts}" = "1"; then
fdt get value tmp_phandle1 /soc/pinctrl@1c20800/uart2@0 phandle
fdt get value tmp_phandle2 /soc/pinctrl@1c20800/uart2-cts-rts@0 phandle
fdt set /soc/serial@1c28800 pinctrl-0 "<${tmp_phandle1}>, <${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
fi
if test "${param_uart3_rtscts}" = "1"; then
fdt get value tmp_phandle1 /soc/pinctrl@1c20800/uart3@0 phandle
fdt get value tmp_phandle2 /soc/pinctrl@1c20800/uart3-cts-rts@0 phandle
fdt set /soc/serial@1c28c00 pinctrl-names "default" "default"
fdt set /soc/serial@1c28c00 pinctrl-0 "<${tmp_phandle1}>, <${tmp_phandle2}>"
env delete tmp_phandle1 tmp_phandle2
fi