diff --git a/board/raspberrypi/overlay/lib/firmware/BCM43430A1.hcd b/board/raspberrypi/overlay/lib/firmware/BCM43430A1.hcd deleted file mode 100644 index 162275ac0b..0000000000 Binary files a/board/raspberrypi/overlay/lib/firmware/BCM43430A1.hcd and /dev/null differ diff --git a/board/raspberrypi/overlay/lib/firmware/brcm/BCM43430A1.hcd b/board/raspberrypi/overlay/lib/firmware/brcm/BCM43430A1.hcd new file mode 100644 index 0000000000..9b087f1b6e Binary files /dev/null and b/board/raspberrypi/overlay/lib/firmware/brcm/BCM43430A1.hcd differ diff --git a/board/raspberrypi/overlay/lib/firmware/brcm/BCM4345C0.hcd b/board/raspberrypi/overlay/lib/firmware/brcm/BCM4345C0.hcd new file mode 100644 index 0000000000..4eab4c9655 Binary files /dev/null and b/board/raspberrypi/overlay/lib/firmware/brcm/BCM4345C0.hcd differ diff --git a/board/raspberrypi/overlay/lib/firmware/brcm/brcmfmac43430-sdio.txt b/board/raspberrypi/overlay/lib/firmware/brcm/brcmfmac43430-sdio.txt new file mode 100644 index 0000000000..25a4f9b6e9 --- /dev/null +++ b/board/raspberrypi/overlay/lib/firmware/brcm/brcmfmac43430-sdio.txt @@ -0,0 +1,64 @@ +# NVRAM file for BCM943430WLSELG +# 2.4 GHz, 20 MHz BW mode + +# The following parameter values are just placeholders, need to be updated. +manfid=0x2d0 +prodid=0x0726 +vendid=0x14e4 +devid=0x43e2 +boardtype=0x0726 +boardrev=0x1202 +boardnum=22 +macaddr=00:90:4c:c5:12:38 +sromrev=11 +boardflags=0x00404201 +boardflags3=0x08000000 +xtalfreq=37400 +#xtalfreq=19200 +nocrc=1 +ag0=255 +aa2g=1 +ccode=ALL + +pa0itssit=0x20 +extpagain2g=0 + +#PA parameters for 2.4GHz, measured at CHIP OUTPUT +pa2ga0=-168,7161,-820 +AvVmid_c0=0x0,0xc8 +cckpwroffset0=5 + +# PPR params +maxp2ga0=84 +txpwrbckof=6 +cckbw202gpo=0 +legofdmbw202gpo=0x66111111 +mcsbw202gpo=0x77711111 +propbw202gpo=0xdd + +# OFDM IIR : +ofdmdigfilttype=18 +ofdmdigfilttypebe=18 +# PAPD mode: +papdmode=1 +papdvalidtest=1 +pacalidx2g=32 +papdepsoffset=-36 +papdendidx=61 + +il0macaddr=00:90:4c:c5:12:38 +wl0id=0x431b + +deadman_to=0xffffffff +# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG +muxenab=0x1 +# CLDO PWM voltage settings - 0x4 - 1.1 volt +#cldo_pwm=0x4 + +#VCO freq 326.4MHz +spurconfig=0x3 + +# Improved Bluetooth coexistence parameters from Cypress +btc_mode=1 +btc_params8=0x4e20 +btc_params1=0x7530 diff --git a/board/raspberrypi/overlay/lib/firmware/brcm/brcmfmac43455-sdio.bin b/board/raspberrypi/overlay/lib/firmware/brcm/brcmfmac43455-sdio.bin new file mode 100644 index 0000000000..94f2add702 Binary files /dev/null and b/board/raspberrypi/overlay/lib/firmware/brcm/brcmfmac43455-sdio.bin differ diff --git a/board/raspberrypi/overlay/lib/firmware/brcm/brcmfmac43455-sdio.txt b/board/raspberrypi/overlay/lib/firmware/brcm/brcmfmac43455-sdio.txt new file mode 100644 index 0000000000..6801286179 --- /dev/null +++ b/board/raspberrypi/overlay/lib/firmware/brcm/brcmfmac43455-sdio.txt @@ -0,0 +1,97 @@ +# Cloned from bcm94345wlpagb_p2xx.txt +NVRAMRev=$Rev: 498373 $ +sromrev=11 +vendid=0x14e4 +devid=0x43ab +manfid=0x2d0 +prodid=0x06e4 +#macaddr=00:90:4c:c5:12:38 +macaddr=b8:27:eb:74:f2:6c +nocrc=1 +boardtype=0x6e4 +boardrev=0x1304 + +#XTAL 37.4MHz +xtalfreq=37400 + +btc_mode=1 +#------------------------------------------------------ +#boardflags: 5GHz eTR switch by default +# 2.4GHz eTR switch by default +# bit1 for btcoex +boardflags=0x00480201 +boardflags2=0x40800000 +boardflags3=0x44200100 +phycal_tempdelta=15 +rxchain=1 +txchain=1 +aa2g=1 +aa5g=1 +tssipos5g=1 +tssipos2g=1 +femctrl=0 +AvVmid_c0=1,165,2,100,2,100,2,100,2,100 +pa2ga0=-129,6525,-718 +pa2ga1=-149,4408,-601 +pa5ga0=-185,6836,-815,-186,6838,-815,-184,6859,-815,-184,6882,-818 +pa5ga1=-202,4285,-574,-201,4312,-578,-196,4391,-586,-201,4294,-575 +itrsw=1 +pdoffsetcckma0=2 +pdoffset2gperchan=0,-2,1,0,1,0,1,1,1,0,0,-1,-1,0 +pdoffset2g40ma0=16 +pdoffset40ma0=0x8888 +pdoffset80ma0=0x8888 +extpagain5g=2 +extpagain2g=2 +tworangetssi2g=1 +tworangetssi5g=1 +# LTECX flags +# WCI2 +ltecxmux=0 +ltecxpadnum=0x0504 +ltecxfnsel=0x22 +ltecxgcigpio=0x32 + +maxp2ga0=80 +ofdmlrbw202gpo=0x0022 +dot11agofdmhrbw202gpo=0x4442 +mcsbw202gpo=0x98444422 +mcsbw402gpo=0x98444422 +maxp5ga0=82,82,82,82 +mcsbw205glpo=0xb9555000 +mcsbw205gmpo=0xb9555000 +mcsbw205ghpo=0xb9555000 +mcsbw405glpo=0xb9555000 +mcsbw405gmpo=0xb9555000 +mcsbw405ghpo=0xb9555000 +mcsbw805glpo=0xb9555000 +mcsbw805gmpo=0xb9555000 +mcsbw805ghpo=0xb9555000 + +swctrlmap_2g=0x00000000,0x00000000,0x00000000,0x010000,0x3ff +swctrlmap_5g=0x00100010,0x00200020,0x00200020,0x010000,0x3fe +swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x3 +swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x3 + +vcodivmode=1 +deadman_to=481500000 + +ed_thresh2g=-54 +ed_thresh5g=-54 +eu_edthresh2g=-54 +eu_edthresh5g=-54 +ldo1=4 +rawtempsense=0x1ff +cckPwrIdxCorr=3 +cckTssiDelay=150 +ofdmTssiDelay=150 +txpwr2gAdcScale=1 +txpwr5gAdcScale=1 +dot11b_opts=0x3aa85 +cbfilttype=1 +fdsslevel_ch11=6 + +# Improved Bluetooth coexistence parameters from Cypress +btc_mode=1 +btc_params8=0x4e20 +btc_params1=0x7530 diff --git a/board/raspberrypi3/overlay/lib/firmware/BCM43430A1.hcd b/board/raspberrypi3/overlay/lib/firmware/BCM43430A1.hcd deleted file mode 100644 index 162275ac0b..0000000000 Binary files a/board/raspberrypi3/overlay/lib/firmware/BCM43430A1.hcd and /dev/null differ diff --git a/board/raspberrypi3/overlay/lib/firmware/brcm/BCM43430A1.hcd b/board/raspberrypi3/overlay/lib/firmware/brcm/BCM43430A1.hcd new file mode 100644 index 0000000000..9b087f1b6e Binary files /dev/null and b/board/raspberrypi3/overlay/lib/firmware/brcm/BCM43430A1.hcd differ diff --git a/board/raspberrypi3/overlay/lib/firmware/brcm/BCM4345C0.hcd b/board/raspberrypi3/overlay/lib/firmware/brcm/BCM4345C0.hcd new file mode 100644 index 0000000000..4eab4c9655 Binary files /dev/null and b/board/raspberrypi3/overlay/lib/firmware/brcm/BCM4345C0.hcd differ diff --git a/board/raspberrypi3/overlay/lib/firmware/brcm/brcmfmac43430-sdio.txt b/board/raspberrypi3/overlay/lib/firmware/brcm/brcmfmac43430-sdio.txt new file mode 100644 index 0000000000..25a4f9b6e9 --- /dev/null +++ b/board/raspberrypi3/overlay/lib/firmware/brcm/brcmfmac43430-sdio.txt @@ -0,0 +1,64 @@ +# NVRAM file for BCM943430WLSELG +# 2.4 GHz, 20 MHz BW mode + +# The following parameter values are just placeholders, need to be updated. +manfid=0x2d0 +prodid=0x0726 +vendid=0x14e4 +devid=0x43e2 +boardtype=0x0726 +boardrev=0x1202 +boardnum=22 +macaddr=00:90:4c:c5:12:38 +sromrev=11 +boardflags=0x00404201 +boardflags3=0x08000000 +xtalfreq=37400 +#xtalfreq=19200 +nocrc=1 +ag0=255 +aa2g=1 +ccode=ALL + +pa0itssit=0x20 +extpagain2g=0 + +#PA parameters for 2.4GHz, measured at CHIP OUTPUT +pa2ga0=-168,7161,-820 +AvVmid_c0=0x0,0xc8 +cckpwroffset0=5 + +# PPR params +maxp2ga0=84 +txpwrbckof=6 +cckbw202gpo=0 +legofdmbw202gpo=0x66111111 +mcsbw202gpo=0x77711111 +propbw202gpo=0xdd + +# OFDM IIR : +ofdmdigfilttype=18 +ofdmdigfilttypebe=18 +# PAPD mode: +papdmode=1 +papdvalidtest=1 +pacalidx2g=32 +papdepsoffset=-36 +papdendidx=61 + +il0macaddr=00:90:4c:c5:12:38 +wl0id=0x431b + +deadman_to=0xffffffff +# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG +muxenab=0x1 +# CLDO PWM voltage settings - 0x4 - 1.1 volt +#cldo_pwm=0x4 + +#VCO freq 326.4MHz +spurconfig=0x3 + +# Improved Bluetooth coexistence parameters from Cypress +btc_mode=1 +btc_params8=0x4e20 +btc_params1=0x7530 diff --git a/board/raspberrypi3/overlay/lib/firmware/brcm/brcmfmac43455-sdio.bin b/board/raspberrypi3/overlay/lib/firmware/brcm/brcmfmac43455-sdio.bin new file mode 100644 index 0000000000..94f2add702 Binary files /dev/null and b/board/raspberrypi3/overlay/lib/firmware/brcm/brcmfmac43455-sdio.bin differ diff --git a/board/raspberrypi3/overlay/lib/firmware/brcm/brcmfmac43455-sdio.txt b/board/raspberrypi3/overlay/lib/firmware/brcm/brcmfmac43455-sdio.txt new file mode 100644 index 0000000000..6801286179 --- /dev/null +++ b/board/raspberrypi3/overlay/lib/firmware/brcm/brcmfmac43455-sdio.txt @@ -0,0 +1,97 @@ +# Cloned from bcm94345wlpagb_p2xx.txt +NVRAMRev=$Rev: 498373 $ +sromrev=11 +vendid=0x14e4 +devid=0x43ab +manfid=0x2d0 +prodid=0x06e4 +#macaddr=00:90:4c:c5:12:38 +macaddr=b8:27:eb:74:f2:6c +nocrc=1 +boardtype=0x6e4 +boardrev=0x1304 + +#XTAL 37.4MHz +xtalfreq=37400 + +btc_mode=1 +#------------------------------------------------------ +#boardflags: 5GHz eTR switch by default +# 2.4GHz eTR switch by default +# bit1 for btcoex +boardflags=0x00480201 +boardflags2=0x40800000 +boardflags3=0x44200100 +phycal_tempdelta=15 +rxchain=1 +txchain=1 +aa2g=1 +aa5g=1 +tssipos5g=1 +tssipos2g=1 +femctrl=0 +AvVmid_c0=1,165,2,100,2,100,2,100,2,100 +pa2ga0=-129,6525,-718 +pa2ga1=-149,4408,-601 +pa5ga0=-185,6836,-815,-186,6838,-815,-184,6859,-815,-184,6882,-818 +pa5ga1=-202,4285,-574,-201,4312,-578,-196,4391,-586,-201,4294,-575 +itrsw=1 +pdoffsetcckma0=2 +pdoffset2gperchan=0,-2,1,0,1,0,1,1,1,0,0,-1,-1,0 +pdoffset2g40ma0=16 +pdoffset40ma0=0x8888 +pdoffset80ma0=0x8888 +extpagain5g=2 +extpagain2g=2 +tworangetssi2g=1 +tworangetssi5g=1 +# LTECX flags +# WCI2 +ltecxmux=0 +ltecxpadnum=0x0504 +ltecxfnsel=0x22 +ltecxgcigpio=0x32 + +maxp2ga0=80 +ofdmlrbw202gpo=0x0022 +dot11agofdmhrbw202gpo=0x4442 +mcsbw202gpo=0x98444422 +mcsbw402gpo=0x98444422 +maxp5ga0=82,82,82,82 +mcsbw205glpo=0xb9555000 +mcsbw205gmpo=0xb9555000 +mcsbw205ghpo=0xb9555000 +mcsbw405glpo=0xb9555000 +mcsbw405gmpo=0xb9555000 +mcsbw405ghpo=0xb9555000 +mcsbw805glpo=0xb9555000 +mcsbw805gmpo=0xb9555000 +mcsbw805ghpo=0xb9555000 + +swctrlmap_2g=0x00000000,0x00000000,0x00000000,0x010000,0x3ff +swctrlmap_5g=0x00100010,0x00200020,0x00200020,0x010000,0x3fe +swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x3 +swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x3 + +vcodivmode=1 +deadman_to=481500000 + +ed_thresh2g=-54 +ed_thresh5g=-54 +eu_edthresh2g=-54 +eu_edthresh5g=-54 +ldo1=4 +rawtempsense=0x1ff +cckPwrIdxCorr=3 +cckTssiDelay=150 +ofdmTssiDelay=150 +txpwr2gAdcScale=1 +txpwr5gAdcScale=1 +dot11b_opts=0x3aa85 +cbfilttype=1 +fdsslevel_ch11=6 + +# Improved Bluetooth coexistence parameters from Cypress +btc_mode=1 +btc_params8=0x4e20 +btc_params1=0x7530 diff --git a/board/raspberrypi4/cleanups.sh b/board/raspberrypi4/cleanups.sh new file mode 120000 index 0000000000..d9a8ba25c5 --- /dev/null +++ b/board/raspberrypi4/cleanups.sh @@ -0,0 +1 @@ +../raspberrypi/cleanups.sh \ No newline at end of file diff --git a/board/raspberrypi4/cmdline.txt b/board/raspberrypi4/cmdline.txt new file mode 100644 index 0000000000..16d676103d --- /dev/null +++ b/board/raspberrypi4/cmdline.txt @@ -0,0 +1 @@ +dwc_otg.fiq_fix_enable=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ro rootflags=noload panic=10 quiet loglevel=1 ipv6.disable=1 diff --git a/board/raspberrypi4/config.txt b/board/raspberrypi4/config.txt new file mode 100644 index 0000000000..b7f96a2ef7 --- /dev/null +++ b/board/raspberrypi4/config.txt @@ -0,0 +1,7 @@ +gpu_mem=128 + +dtparam=i2c_arm=on +dtparam=i2s=on +dtparam=spi=on +dtparam=audio=on + diff --git a/board/raspberrypi4/cpinitramfs.sh b/board/raspberrypi4/cpinitramfs.sh new file mode 120000 index 0000000000..be9760b343 --- /dev/null +++ b/board/raspberrypi4/cpinitramfs.sh @@ -0,0 +1 @@ +../raspberrypi/cpinitramfs.sh \ No newline at end of file diff --git a/board/raspberrypi4/initrd.gz b/board/raspberrypi4/initrd.gz new file mode 100644 index 0000000000..22060e53c9 Binary files /dev/null and b/board/raspberrypi4/initrd.gz differ diff --git a/board/raspberrypi4/mkimage.sh b/board/raspberrypi4/mkimage.sh new file mode 120000 index 0000000000..437f24e6f6 --- /dev/null +++ b/board/raspberrypi4/mkimage.sh @@ -0,0 +1 @@ +../raspberrypi/mkimage.sh \ No newline at end of file diff --git a/board/raspberrypi4/overlay/etc/board b/board/raspberrypi4/overlay/etc/board new file mode 100644 index 0000000000..976df614ed --- /dev/null +++ b/board/raspberrypi4/overlay/etc/board @@ -0,0 +1 @@ +raspberrypi4 diff --git a/board/raspberrypi4/overlay/etc/init.d/S05cpufreq b/board/raspberrypi4/overlay/etc/init.d/S05cpufreq new file mode 100755 index 0000000000..ed1d28f889 --- /dev/null +++ b/board/raspberrypi4/overlay/etc/init.d/S05cpufreq @@ -0,0 +1,37 @@ +#!/bin/bash + +GOV="ondemand" +CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq" +GOVDIR="/sys/devices/system/cpu/cpufreq/${GOV}" + + +test -n "${OS_VERSION}" || source /etc/init.d/base + +configure() { + echo ${GOV} > ${CPUFREQDIR}/scaling_governor + if [[ ${GOV} == "ondemand" ]]; then + echo 50 > ${GOVDIR}/up_threshold + echo 100000 > ${GOVDIR}/sampling_rate + echo 50 > ${GOVDIR}/sampling_down_factor + echo 1 > ${GOVDIR}/io_is_busy + fi +} + +case "$1" in + start) + msg_begin "Configuring CPU frequency" + configure + test $? == 0 && msg_done || msg_fail + ;; + + stop) + true + ;; + + *) + echo $"Usage: $0 {start}" + exit 1 +esac + +exit $? + diff --git a/board/raspberrypi4/overlay/etc/init.d/S11throttlewatch b/board/raspberrypi4/overlay/etc/init.d/S11throttlewatch new file mode 100755 index 0000000000..4f6a422152 --- /dev/null +++ b/board/raspberrypi4/overlay/etc/init.d/S11throttlewatch @@ -0,0 +1,65 @@ +#!/bin/bash + +CHECK_INTERVAL=30 + + +test -n "${OS_VERSION}" || source /etc/init.d/base + +get_throttled_now() { + t=$(vcgencmd get_throttled | cut -d '=' -f 2) + test $((t & 1)) -ne 0 && echo -n "under-voltage " + test $((t & 2)) -ne 0 && echo -n "arm-frequency-capped " + test $((t & 4)) -ne 0 && echo -n "throttled " +} + +get_throttled_since_boot() { + t=$(vcgencmd get_throttled | cut -d '=' -f 2) + test $((t & 65536)) -ne 0 && echo -n "under-voltage " + test $((t & 131072)) -ne 0 && echo -n "arm-frequency-capped " + test $((t & 262144)) -ne 0 && echo -n "throttled " +} + +watch_now() { + while true; do + t=$(get_throttled_now) + if [[ -n "${t}" ]]; then + logger -t throttlewatch -s "currently: ${t}" + fi + + sleep ${CHECK_INTERVAL} + done +} + +watch_since_boot() { + while true; do + t=$(get_throttled_since_boot) + if [[ -n "${t}" ]]; then + logger -t throttlewatch -s "since boot: ${t}" + break + fi + + sleep ${CHECK_INTERVAL} + done +} + +case "$1" in + start) + msg_begin "Starting throttle watcher" + watch_now & + watch_since_boot & + test $? == 0 && msg_done || msg_fail + ;; + + stop) + msg_begin "Stopping throttle watcher" + ps | grep throttlewatch | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill + test $? == 0 && msg_done || msg_fail + ;; + + *) + echo $"Usage: $0 {start|stop}" + exit 1 +esac + +exit $? + diff --git a/board/raspberrypi4/overlay/etc/init.d/S13btuart b/board/raspberrypi4/overlay/etc/init.d/S13btuart new file mode 100755 index 0000000000..0ad4deda81 --- /dev/null +++ b/board/raspberrypi4/overlay/etc/init.d/S13btuart @@ -0,0 +1,46 @@ +#!/bin/bash + +SYS_CONF="/etc/bluetooth.conf" +BOOT_CONF="/boot/bluetooth.conf" +CONF="/data/etc/bluetooth.conf" + + +test -f ${CONF} || test -f ${BOOT_CONF} || test -f ${SYS_CONF} || exit 0 + +test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected + +test -n "${OS_VERSION}" || source /etc/init.d/base + +function start() { + if [[ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ]] ; then + if [[ "$(wc -c /proc/device-tree/soc/gpio@7e200000/uart0_pins/brcm\,pins | cut -f 1 -d ' ')" = " 16" ]] ; then + /usr/bin/hciattach -t5 /dev/serial1 bcm43xx 3000000 flow - &>/dev/null + else + /usr/bin/hciattach -t5 /dev/serial1 bcm43xx 921600 noflow - &>/dev/null + fi + else + /usr/bin/hciattach -t5 /dev/serial1 bcm43xx 460800 noflow - &>/dev/null + fi +} + +case "$1" in + start) + msg_begin "Attaching UART bluetooth modem" + # for some reason, sometimes the hciattach command needs to be run twice + (start || start) &>/dev/null & + msg_background + ;; + + stop) + msg_begin "Detaching UART bluetooth modem" + killall hciattach &>/dev/null + test $? == 0 && msg_done || msg_fail + ;; + + *) + echo $"Usage: $0 {start}" + exit 1 +esac + +exit $? + diff --git a/board/raspberrypi4/overlay/etc/init.d/boardsn b/board/raspberrypi4/overlay/etc/init.d/boardsn new file mode 100755 index 0000000000..16881c26f7 --- /dev/null +++ b/board/raspberrypi4/overlay/etc/init.d/boardsn @@ -0,0 +1,5 @@ +#!/bin/bash + +sn=$(cat /proc/cpuinfo | grep Serial | tr -d ' ' | cut -d ':' -f 2) +echo ${sn: -8} + diff --git a/board/raspberrypi4/overlay/etc/ld.so.preload b/board/raspberrypi4/overlay/etc/ld.so.preload new file mode 100644 index 0000000000..863162b676 --- /dev/null +++ b/board/raspberrypi4/overlay/etc/ld.so.preload @@ -0,0 +1 @@ +/usr/lib/libarmmem.so diff --git a/board/raspberrypi4/overlay/etc/modprobe.d/blacklist-rtl8192cu.conf b/board/raspberrypi4/overlay/etc/modprobe.d/blacklist-rtl8192cu.conf new file mode 100644 index 0000000000..dc07e99662 --- /dev/null +++ b/board/raspberrypi4/overlay/etc/modprobe.d/blacklist-rtl8192cu.conf @@ -0,0 +1 @@ +blacklist rtl8192cu diff --git a/board/raspberrypi4/overlay/etc/modules b/board/raspberrypi4/overlay/etc/modules new file mode 100644 index 0000000000..d5499e6362 --- /dev/null +++ b/board/raspberrypi4/overlay/etc/modules @@ -0,0 +1,3 @@ +i2c-bcm2708 +i2c-dev + diff --git a/board/raspberrypi4/overlay/etc/udev/rules.d/99-com.rules b/board/raspberrypi4/overlay/etc/udev/rules.d/99-com.rules new file mode 100644 index 0000000000..a964057230 --- /dev/null +++ b/board/raspberrypi4/overlay/etc/udev/rules.d/99-com.rules @@ -0,0 +1,32 @@ +SUBSYSTEM=="input", GROUP="input", MODE="0660" +SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660" +SUBSYSTEM=="spidev", GROUP="spi", MODE="0660" +SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660" + +SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\ + chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\ + chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\ + chown -R root:gpio /sys$devpath && chmod -R 770 /sys$devpath\ +'" + +KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\ + ALIASES=/proc/device-tree/aliases; \ + if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \ + echo 0;\ + elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \ + echo 1; \ + else \ + exit 1; \ + fi\ +'", SYMLINK+="serial%c" + +KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\ + ALIASES=/proc/device-tree/aliases; \ + if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \ + echo 0; \ + elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \ + echo 1; \ + else \ + exit 1; \ + fi \ +'", SYMLINK+="serial%c" diff --git a/board/raspberrypi4/overlay/lib/firmware/brcm/BCM43430A1.hcd b/board/raspberrypi4/overlay/lib/firmware/brcm/BCM43430A1.hcd new file mode 100644 index 0000000000..9b087f1b6e Binary files /dev/null and b/board/raspberrypi4/overlay/lib/firmware/brcm/BCM43430A1.hcd differ diff --git a/board/raspberrypi4/overlay/lib/firmware/brcm/BCM4345C0.hcd b/board/raspberrypi4/overlay/lib/firmware/brcm/BCM4345C0.hcd new file mode 100644 index 0000000000..4eab4c9655 Binary files /dev/null and b/board/raspberrypi4/overlay/lib/firmware/brcm/BCM4345C0.hcd differ diff --git a/board/raspberrypi4/overlay/lib/firmware/brcm/brcmfmac43430-sdio.txt b/board/raspberrypi4/overlay/lib/firmware/brcm/brcmfmac43430-sdio.txt new file mode 100644 index 0000000000..25a4f9b6e9 --- /dev/null +++ b/board/raspberrypi4/overlay/lib/firmware/brcm/brcmfmac43430-sdio.txt @@ -0,0 +1,64 @@ +# NVRAM file for BCM943430WLSELG +# 2.4 GHz, 20 MHz BW mode + +# The following parameter values are just placeholders, need to be updated. +manfid=0x2d0 +prodid=0x0726 +vendid=0x14e4 +devid=0x43e2 +boardtype=0x0726 +boardrev=0x1202 +boardnum=22 +macaddr=00:90:4c:c5:12:38 +sromrev=11 +boardflags=0x00404201 +boardflags3=0x08000000 +xtalfreq=37400 +#xtalfreq=19200 +nocrc=1 +ag0=255 +aa2g=1 +ccode=ALL + +pa0itssit=0x20 +extpagain2g=0 + +#PA parameters for 2.4GHz, measured at CHIP OUTPUT +pa2ga0=-168,7161,-820 +AvVmid_c0=0x0,0xc8 +cckpwroffset0=5 + +# PPR params +maxp2ga0=84 +txpwrbckof=6 +cckbw202gpo=0 +legofdmbw202gpo=0x66111111 +mcsbw202gpo=0x77711111 +propbw202gpo=0xdd + +# OFDM IIR : +ofdmdigfilttype=18 +ofdmdigfilttypebe=18 +# PAPD mode: +papdmode=1 +papdvalidtest=1 +pacalidx2g=32 +papdepsoffset=-36 +papdendidx=61 + +il0macaddr=00:90:4c:c5:12:38 +wl0id=0x431b + +deadman_to=0xffffffff +# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG +muxenab=0x1 +# CLDO PWM voltage settings - 0x4 - 1.1 volt +#cldo_pwm=0x4 + +#VCO freq 326.4MHz +spurconfig=0x3 + +# Improved Bluetooth coexistence parameters from Cypress +btc_mode=1 +btc_params8=0x4e20 +btc_params1=0x7530 diff --git a/board/raspberrypi4/overlay/lib/firmware/brcm/brcmfmac43455-sdio.bin b/board/raspberrypi4/overlay/lib/firmware/brcm/brcmfmac43455-sdio.bin new file mode 100644 index 0000000000..94f2add702 Binary files /dev/null and b/board/raspberrypi4/overlay/lib/firmware/brcm/brcmfmac43455-sdio.bin differ diff --git a/board/raspberrypi4/overlay/lib/firmware/brcm/brcmfmac43455-sdio.txt b/board/raspberrypi4/overlay/lib/firmware/brcm/brcmfmac43455-sdio.txt new file mode 100644 index 0000000000..6801286179 --- /dev/null +++ b/board/raspberrypi4/overlay/lib/firmware/brcm/brcmfmac43455-sdio.txt @@ -0,0 +1,97 @@ +# Cloned from bcm94345wlpagb_p2xx.txt +NVRAMRev=$Rev: 498373 $ +sromrev=11 +vendid=0x14e4 +devid=0x43ab +manfid=0x2d0 +prodid=0x06e4 +#macaddr=00:90:4c:c5:12:38 +macaddr=b8:27:eb:74:f2:6c +nocrc=1 +boardtype=0x6e4 +boardrev=0x1304 + +#XTAL 37.4MHz +xtalfreq=37400 + +btc_mode=1 +#------------------------------------------------------ +#boardflags: 5GHz eTR switch by default +# 2.4GHz eTR switch by default +# bit1 for btcoex +boardflags=0x00480201 +boardflags2=0x40800000 +boardflags3=0x44200100 +phycal_tempdelta=15 +rxchain=1 +txchain=1 +aa2g=1 +aa5g=1 +tssipos5g=1 +tssipos2g=1 +femctrl=0 +AvVmid_c0=1,165,2,100,2,100,2,100,2,100 +pa2ga0=-129,6525,-718 +pa2ga1=-149,4408,-601 +pa5ga0=-185,6836,-815,-186,6838,-815,-184,6859,-815,-184,6882,-818 +pa5ga1=-202,4285,-574,-201,4312,-578,-196,4391,-586,-201,4294,-575 +itrsw=1 +pdoffsetcckma0=2 +pdoffset2gperchan=0,-2,1,0,1,0,1,1,1,0,0,-1,-1,0 +pdoffset2g40ma0=16 +pdoffset40ma0=0x8888 +pdoffset80ma0=0x8888 +extpagain5g=2 +extpagain2g=2 +tworangetssi2g=1 +tworangetssi5g=1 +# LTECX flags +# WCI2 +ltecxmux=0 +ltecxpadnum=0x0504 +ltecxfnsel=0x22 +ltecxgcigpio=0x32 + +maxp2ga0=80 +ofdmlrbw202gpo=0x0022 +dot11agofdmhrbw202gpo=0x4442 +mcsbw202gpo=0x98444422 +mcsbw402gpo=0x98444422 +maxp5ga0=82,82,82,82 +mcsbw205glpo=0xb9555000 +mcsbw205gmpo=0xb9555000 +mcsbw205ghpo=0xb9555000 +mcsbw405glpo=0xb9555000 +mcsbw405gmpo=0xb9555000 +mcsbw405ghpo=0xb9555000 +mcsbw805glpo=0xb9555000 +mcsbw805gmpo=0xb9555000 +mcsbw805ghpo=0xb9555000 + +swctrlmap_2g=0x00000000,0x00000000,0x00000000,0x010000,0x3ff +swctrlmap_5g=0x00100010,0x00200020,0x00200020,0x010000,0x3fe +swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x3 +swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x3 + +vcodivmode=1 +deadman_to=481500000 + +ed_thresh2g=-54 +ed_thresh5g=-54 +eu_edthresh2g=-54 +eu_edthresh5g=-54 +ldo1=4 +rawtempsense=0x1ff +cckPwrIdxCorr=3 +cckTssiDelay=150 +ofdmTssiDelay=150 +txpwr2gAdcScale=1 +txpwr5gAdcScale=1 +dot11b_opts=0x3aa85 +cbfilttype=1 +fdsslevel_ch11=6 + +# Improved Bluetooth coexistence parameters from Cypress +btc_mode=1 +btc_params8=0x4e20 +btc_params1=0x7530 diff --git a/board/raspberrypi4/overlay/usr/bin/hciattach b/board/raspberrypi4/overlay/usr/bin/hciattach new file mode 100755 index 0000000000..468a3342a6 Binary files /dev/null and b/board/raspberrypi4/overlay/usr/bin/hciattach differ diff --git a/board/raspberrypi4/overlay/usr/libexec/fw-prepare-boot b/board/raspberrypi4/overlay/usr/libexec/fw-prepare-boot new file mode 100755 index 0000000000..e372abdb87 --- /dev/null +++ b/board/raspberrypi4/overlay/usr/libexec/fw-prepare-boot @@ -0,0 +1,5 @@ +#!/bin/bash + +echo >> /boot/config.txt +echo "initramfs initrd.gz" >> /boot/config.txt + diff --git a/board/raspberrypi4/overlay/usr/libexec/fw-restore-boot-cfg b/board/raspberrypi4/overlay/usr/libexec/fw-restore-boot-cfg new file mode 100755 index 0000000000..a4cf5afe76 --- /dev/null +++ b/board/raspberrypi4/overlay/usr/libexec/fw-restore-boot-cfg @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Usage: $0 " 1>&2 + exit -1 +fi + +old_boot=$1 +cp ${old_boot}/config.txt /boot + diff --git a/board/raspberrypi4/postscript.sh b/board/raspberrypi4/postscript.sh new file mode 100755 index 0000000000..51e630b1d8 --- /dev/null +++ b/board/raspberrypi4/postscript.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +RPI_FW_DIR=${TARGET}/../images/rpi-firmware + +cp ${BOARD_DIR}/config.txt ${BOOT_DIR} +cp ${BOARD_DIR}/cmdline.txt ${BOOT_DIR} +cp ${BOARD_DIR}/initrd.gz ${BOOT_DIR} +cp ${IMG_DIR}/zImage ${BOOT_DIR}/kernel.img +cp ${IMG_DIR}/bcm2711-rpi-4-b.dtb ${BOOT_DIR} +cp ${RPI_FW_DIR}/bootcode.bin ${BOOT_DIR} +cp ${RPI_FW_DIR}/start4.elf ${BOOT_DIR} +cp ${RPI_FW_DIR}/fixup4.dat ${BOOT_DIR} diff --git a/configs/raspberrypi4_defconfig b/configs/raspberrypi4_defconfig new file mode 100644 index 0000000000..493cd0f637 --- /dev/null +++ b/configs/raspberrypi4_defconfig @@ -0,0 +1,80 @@ +BR2_arm=y +BR2_cortex_a7=y +BR2_ARM_FPU_NEON_VFPV4=y +BR2_CCACHE=y +BR2_CCACHE_DIR="$(TOPDIR)/.buildroot-ccache-raspberrypi4" +BR2_OPTIMIZE_2=y +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TARGET_OPTIMIZATION="-pipe" +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y +BR2_TARGET_TZ_INFO=y +BR2_ROOTFS_OVERLAY="board/common/overlay board/raspberrypi4/overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/common/postscript.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/raspberrypi/linux/archive/6e787b87ace9f945f17a9022288e2758ed281cf7.tar.gz" +BR2_LINUX_KERNEL_DEFCONFIG="bcm2711" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2711-rpi-4-b" +BR2_PACKAGE_BUSYBOX_CONFIG="board/common/busybox.config" +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +BR2_PACKAGE_ALSA_UTILS=y +BR2_PACKAGE_ALSA_UTILS_APLAY=y +BR2_PACKAGE_GZIP=y +BR2_PACKAGE_JQ=y +BR2_PACKAGE_E2FSPROGS=y +BR2_PACKAGE_NTFS_3G=y +BR2_PACKAGE_B43_FIRMWARE=y +BR2_PACKAGE_LINUX_FIRMWARE=y +BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_7010=y +BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9170=y +BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9271=y +BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XX=y +BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XXX=y +BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_USB8797=y +BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_USB8897=y +BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT61=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y +BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y +BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX=y +BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_X=y +BR2_PACKAGE_RPI_ARMMEM=y +BR2_PACKAGE_RPI_USERLAND=y +BR2_PACKAGE_USB_MODESWITCH_DATA=y +BR2_PACKAGE_CA_CERTIFICATES=y +BR2_PACKAGE_LIBSSH2=y +BR2_PACKAGE_LIBFUSE=y +BR2_PACKAGE_LIBCURL=y +BR2_PACKAGE_CURL=y +BR2_PACKAGE_LIBCAP=y +BR2_PACKAGE_PCRE=y +BR2_PACKAGE_PCRE_UCP=y +BR2_PACKAGE_AUTOSSH=y +BR2_PACKAGE_CRDA=y +BR2_PACKAGE_DHCP=y +BR2_PACKAGE_DHCP_CLIENT=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +BR2_PACKAGE_IPTABLES=y +BR2_PACKAGE_IW=y +BR2_PACKAGE_NETCAT=y +BR2_PACKAGE_NET_TOOLS=y +BR2_PACKAGE_NTP=y +BR2_PACKAGE_NTP_NTPDATE=y +BR2_PACKAGE_OPENSSH=y +BR2_PACKAGE_PPPD=y +BR2_PACKAGE_WIRELESS_TOOLS=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y +BR2_PACKAGE_WPA_SUPPLICANT_EAP=y +BR2_PACKAGE_WPA_SUPPLICANT_WPS=y +BR2_PACKAGE_WPA_SUPPLICANT_CLI=y +BR2_PACKAGE_BASH=y +BR2_PACKAGE_LOGROTATE=y +BR2_PACKAGE_TAR=y +BR2_PACKAGE_UTIL_LINUX_BINARIES=y +BR2_PACKAGE_UTIL_LINUX_PARTX=y +BR2_PACKAGE_NANO=y diff --git a/package/rpi-firmware/rpi-firmware.mk b/package/rpi-firmware/rpi-firmware.mk index 1cb7f1db69..2c79b82121 100644 --- a/package/rpi-firmware/rpi-firmware.mk +++ b/package/rpi-firmware/rpi-firmware.mk @@ -42,9 +42,17 @@ endef endif # INSTALL_VCDBG define RPI_FIRMWARE_INSTALL_IMAGES_CMDS + cp $(@D)/boot/fixup4cd.dat $(@D)/boot/fixup4_cd.dat + cp $(@D)/boot/fixup4x.dat $(@D)/boot/fixup4_x.dat + cp $(@D)/boot/fixup4db.dat $(@D)/boot/fixup4_db.dat + cp $(@D)/boot/start4cd.elf $(@D)/boot/start4_cd.elf + cp $(@D)/boot/start4x.elf $(@D)/boot/start4_x.elf + cp $(@D)/boot/start4db.elf $(@D)/boot/start4_db.elf $(INSTALL) -D -m 0644 $(@D)/boot/bootcode.bin $(BINARIES_DIR)/rpi-firmware/bootcode.bin $(INSTALL) -D -m 0644 $(@D)/boot/start$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf $(BINARIES_DIR)/rpi-firmware/start.elf $(INSTALL) -D -m 0644 $(@D)/boot/fixup$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat $(BINARIES_DIR)/rpi-firmware/fixup.dat + $(INSTALL) -D -m 0644 $(@D)/boot/start4$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf $(BINARIES_DIR)/rpi-firmware/start4.elf + $(INSTALL) -D -m 0644 $(@D)/boot/fixup4$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat $(BINARIES_DIR)/rpi-firmware/fixup4.dat $(INSTALL) -D -m 0644 package/rpi-firmware/config.txt $(BINARIES_DIR)/rpi-firmware/config.txt $(INSTALL) -D -m 0644 package/rpi-firmware/cmdline.txt $(BINARIES_DIR)/rpi-firmware/cmdline.txt $(RPI_FIRMWARE_INSTALL_DTB)