author: Emil Renner Berthing <kernel@esmil.dk> 2021-05-05 20:03:04 +0200
committer: Emil Renner Berthing <kernel@esmil.dk> 2021-09-12 14:35:04 +0200
commit: 44d398faf45e09488f2ddf0813a85ce4b9c3cb42
parent: 633f8b0c0729804808e1c3d8f9d0b1e8adb4dcc7
Commit Summary:
Diffstat:
5 files changed, 424 insertions, 29 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 000000000000..3efcf7b312c3
--- /dev/null
+++ b/README.md
@@ -0,0 +1,133 @@
+# Linux kernel for the BeagleV Starlight
+
+## What is this?
+
+The [BeagleV Starlight][bborg] board is a new Linux-capable 64bit RISC-V
+development board. It has not shipped yet, but [beta versions][beta] are out to
+developers. Consequently the board is not yet supported by upstream Linux. This
+tree is meant to collect all the in-development patches for running Linux on
+the board.
+
+[bborg]: https://beagleboard.org/beaglev
+[beta]: https://github.com/beagleboard/beaglev-starlight
+
+## Cross-compiling
+
+Cross-compiling the Linux kernel is surprisingly easy since it doesn't depend
+on any (target) libraries and most distributions already have packages with a
+working cross-compiler. We'll also need a few other tools to build everything:
+```shell
+# Debian/Ubuntu
+sudo apt-get install libncurses-dev libssl-dev bc flex bison make gcc gcc-riscv64-linux-gnu
+# Fedora
+sudo dnf install ncurses-devel openssl openssl-devel bc flex bison make gcc gcc-riscv64-linux-gnu
+# Archlinux
+sudo pacman -S --needed ncurses openssl bc flex bison make gcc riscv64-linux-gnu-gcc
+```
+
+The build system needs to know that we want to cross-compile a kernel for
+RISC-V by setting `ARCH=riscv`. It also needs to know the prefix of our
+cross-compiler using `CROSS_COMPILE=riscv64-linux-gnu-`. Also let's assume
+we're building on an 8-core machine so compilation can be greatly sped up by
+telling make to use all 8 cores with `-j8`.
+
+First we need to configure the kernel though. Linux has a *very* extensive
+configuration system, but you can get a good baseline configuration for the
+board using:
+```shell
+make -j8 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- beaglev_defconfig
+```
+
+There is nothing magic about this configuration other than it has all the
+drivers enabled that are working for the hardware on the board. In fact it has
+very little extra features enabled which is great for compile times, but you
+are very much encouraged to add additional drivers and configure your kernel
+further using
+```shell
+make -j8 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- nconfig
+```
+
+Now compile the whole thing with
+```
+make -j8 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu-
+```
+
+
+## Installing
+
+Once the build has finished the resulting kernel can be found at
+```shell
+arch/riscv/boot/Image
+```
+You'll also need the matching device tree at
+```shell
+arch/riscv/boot/dts/starfive/jh7100-beaglev-starlight.dtb
+```
+These two files should be copied to the boot partition on the SD card. That is
+onto the same file system that contains the `extlinux/extlinux.conf`. On the
+default Fedora image this is mounted at `/boot`.
+
+Now add the following entry to the `extlinux/extlinux.conf` file:
+```
+label My New Kernel
+kernel /Image
+fdt /jh7100-beaglev-starlight.dtb
+append earlycon console=ttyS0,115200n8 root=/dev/mmcblk0p2 rootwait stmmac.chain_mode=1
+```
+
+This assumes your root file system is at `/dev/mmcblk0p2` which it is on the
+default Fedora image. Also if your kernel is very big it might be beneficial to
+use the compressed `Image.gz` rather than the uncompressed `Image`.
+
+The `beaglev_defconfig` doesn't enable modules, but if you enabled them in
+your build you'll also need to install them in `/lib/modules/` on the root file
+system. How to do that best is out of scope for this README though.
+
+
+## Status
+
+#### SoC
+
+- [x] Pinctrl/Pinmux
+- [x] GPIO
+- [x] Serial port
+- [x] I2C
+- [x] SPI
+- [x] MMC / SDIO / SD card
+- [x] Random number generator
+- [x] Temperature sensor
+- [x] Ethernet, though a little flaky and `stmmac.chain_mode=1` needed on the cmdline
+- [x] USB, USB 3.0 is broken with `CONFIG_PM` enabled
+- [x] Framebuffer, fbdev driver so not upstreamable
+- [x] NVDLA
+- [ ] Clock tree, statically set up by u-boot, WIP clock driver
+- [ ] Watchdog
+- [ ] Security Engine
+- [ ] MIPI-DSI
+- [ ] ISP
+- [ ] MIPI-CSI
+- [ ] Video Decode
+- [ ] Video Encode
+- [ ] NNE50
+- [ ] Vision DSP
+
+#### Board
+
+- [x] LED
+- [x] PMIC / Reboot
+- [x] Ethernet PHY
+- [x] HDMI, working with [some screens][hdmi]
+- [x] AP6236 Wifi
+- [ ] AP6236 Bluetooth
+- [ ] GD25LQ256D SPI flash
+
+[hdmi]: https://forum.beagleboard.org/t/hdmi-displays-compatible-list/
+
+## Contributing
+
+If you're working on cleaning up or upstreaming some of this or adding support
+for more of the SoC I'd very much like to incorporate it into this tree. Either
+send a pull request, mail or contact Esmil on IRC/Slack.
+
+Also I think of this tree mostly as a collection of patches that will hopefully
+mature enough to be submitted upstream. So expect regular rebases.
diff --git a/arch/riscv/configs/beaglev_defconfig b/arch/riscv/configs/beaglev_defconfig
new file mode 100644
index 000000000000..18e4bb4fc4e5
--- /dev/null
+++ b/arch/riscv/configs/beaglev_defconfig
@@ -0,0 +1,204 @@
+CONFIG_LOCALVERSION="-beaglev"
+CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_WATCH_QUEUE=y
+# CONFIG_CROSS_MEMORY_ATTACH is not set
+CONFIG_NO_HZ_IDLE=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_BPF_SYSCALL=y
+CONFIG_PSI=y
+# CONFIG_CPU_ISOLATION is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_CGROUPS=y
+CONFIG_CGROUP_SCHED=y
+CONFIG_CFS_BANDWIDTH=y
+CONFIG_CGROUP_PIDS=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_NAMESPACES=y
+CONFIG_BLK_DEV_INITRD=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_RD_XZ is not set
+# CONFIG_RD_LZO is not set
+# CONFIG_RD_LZ4 is not set
+CONFIG_EXPERT=y
+# CONFIG_SYSFS_SYSCALL is not set
+CONFIG_USERFAULTFD=y
+CONFIG_PERF_EVENTS=y
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_SLUB_DEBUG is not set
+CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
+CONFIG_SOC_STARFIVE_VIC7100=y
+CONFIG_SMP=y
+CONFIG_NR_CPUS=4
+# CONFIG_RISCV_SBI_V01 is not set
+CONFIG_JUMP_LABEL=y
+# CONFIG_STACKPROTECTOR is not set
+# CONFIG_GCC_PLUGINS is not set
+CONFIG_BLK_WBT=y
+# CONFIG_BLK_DEBUG_FS is not set
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_MQ_IOSCHED_DEADLINE is not set
+# CONFIG_MQ_IOSCHED_KYBER is not set
+CONFIG_IOSCHED_BFQ=y
+CONFIG_KSM=y
+CONFIG_CMA=y
+CONFIG_ZSMALLOC=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_ADVANCED_ROUTER=y
+CONFIG_IP_MULTIPLE_TABLES=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6_SIT is not set
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_NET_SCHED=y
+CONFIG_NET_SCH_FQ_CODEL=y
+CONFIG_CFG80211=y
+# CONFIG_CFG80211_DEFAULT_PS is not set
+CONFIG_RFKILL=y
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_STANDALONE is not set
+# CONFIG_PREVENT_FIRMWARE_BUILD is not set
+CONFIG_EXTRA_FIRMWARE="regulatory.db regulatory.db.p7s brcm/brcmfmac43430-sdio.bin brcm/brcmfmac43430-sdio.clm_blob brcm/brcmfmac43430-sdio.beagle,beaglev-starlight-jh7100.txt"
+CONFIG_EXTRA_FIRMWARE_DIR="firmware"
+CONFIG_MTD=y
+CONFIG_MTD_BLOCK=y
+CONFIG_MTD_PARTITIONED_MASTER=y
+CONFIG_MTD_SPI_NOR=y
+# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
+CONFIG_ZRAM=y
+CONFIG_ZRAM_MEMORY_TRACKING=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_LOOP_MIN_COUNT=1
+CONFIG_BLK_DEV_NBD=y
+CONFIG_SCSI=y
+# CONFIG_SCSI_PROC_FS is not set
+CONFIG_BLK_DEV_SD=y
+CONFIG_CHR_DEV_SG=y
+CONFIG_SCSI_CONSTANTS=y
+CONFIG_SCSI_SCAN_ASYNC=y
+# CONFIG_SCSI_LOWLEVEL is not set
+CONFIG_NETDEVICES=y
+CONFIG_WIREGUARD=y
+CONFIG_TUN=y
+CONFIG_STMMAC_ETH=y
+CONFIG_MICREL_PHY=y
+CONFIG_BRCMFMAC=y
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_LDISC_AUTOLOAD is not set
+CONFIG_SERIAL_8250=y
+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
+# CONFIG_SERIAL_8250_16550A_VARIANTS is not set
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_DW=y
+# CONFIG_DEVMEM is not set
+# CONFIG_I2C_COMPAT is not set
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_HELPER_AUTO is not set
+CONFIG_I2C_DESIGNWARE_PLATFORM=y
+CONFIG_SPI=y
+CONFIG_SPI_CADENCE_QUADSPI=y
+CONFIG_SPI_DESIGNWARE=y
+CONFIG_SPI_DW_DMA=y
+CONFIG_SPI_DW_MMIO=y
+CONFIG_SPI_SPIDEV=y
+# CONFIG_PTP_1588_CLOCK is not set
+CONFIG_GPIOLIB_FASTPATH_LIMIT=256
+CONFIG_GPIO_SYSFS=y
+CONFIG_GPIO_TPS65086=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_TPS65086=y
+CONFIG_SENSORS_SFCTEMP=y
+CONFIG_THERMAL=y
+CONFIG_THERMAL_NETLINK=y
+CONFIG_THERMAL_STATISTICS=y
+CONFIG_THERMAL_WRITABLE_TRIPS=y
+CONFIG_CPU_THERMAL=y
+CONFIG_MFD_TPS65086=y
+CONFIG_DRM=y
+CONFIG_FB=y
+CONFIG_FB_STARFIVE=y
+CONFIG_FB_STARFIVE_HDMI_TDA998X=y
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_USB=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+CONFIG_USB_MON=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DBGCAP=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_UAS=y
+CONFIG_USB_CDNS_SUPPORT=y
+CONFIG_USB_CDNS3=y
+CONFIG_USB_CDNS3_HOST=y
+CONFIG_MMC=y
+# CONFIG_PWRSEQ_EMMC is not set
+CONFIG_MMC_DW=y
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+CONFIG_DMADEVICES=y
+CONFIG_DW_AXI_DMAC=y
+CONFIG_DMABUF_HEAPS=y
+CONFIG_DMABUF_HEAPS_SYSTEM=y
+# CONFIG_VIRTIO_MENU is not set
+# CONFIG_VHOST_MENU is not set
+# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_PWM=y
+CONFIG_PWM_SIFIVE_PTC=y
+CONFIG_NVDLA=y
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_FS_POSIX_ACL=y
+CONFIG_EXT4_FS_SECURITY=y
+CONFIG_BTRFS_FS=y
+CONFIG_BTRFS_FS_POSIX_ACL=y
+# CONFIG_MANDATORY_FILE_LOCKING is not set
+# CONFIG_DNOTIFY is not set
+CONFIG_FANOTIFY=y
+CONFIG_AUTOFS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-15"
+CONFIG_FAT_DEFAULT_UTF8=y
+CONFIG_EXFAT_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_TMPFS=y
+CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NFS_FS=y
+CONFIG_ROOT_NFS=y
+CONFIG_NLS_DEFAULT="utf8"
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_ISO8859_15=y
+CONFIG_NLS_UTF8=y
+CONFIG_LSM=""
+CONFIG_CRYPTO_ZSTD=y
+# CONFIG_CRYPTO_HW is not set
+# CONFIG_RAID6_PQ_BENCHMARK is not set
+CONFIG_DMA_CMA=y
+# CONFIG_SYMBOLIC_ERRNAME is not set
+CONFIG_STRIP_ASM_SYMS=y
+# CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_DEBUG_MISC is not set
+CONFIG_DEBUG_RODATA_TEST=y
+CONFIG_DEBUG_WX=y
+CONFIG_SOFTLOCKUP_DETECTOR=y
+CONFIG_WQ_WATCHDOG=y
+# CONFIG_SCHED_DEBUG is not set
+CONFIG_STACKTRACE=y
+CONFIG_RCU_CPU_STALL_TIMEOUT=60
+# CONFIG_RCU_TRACE is not set
+# CONFIG_FTRACE is not set
+# CONFIG_RUNTIME_TESTING_MENU is not set
diff --git a/firmware/brcm/brcmfmac43430-sdio.AP6212.txt b/firmware/brcm/brcmfmac43430-sdio.AP6212.txt
new file mode 100644
index 000000000000..901854e67bb5
--- /dev/null
+++ b/firmware/brcm/brcmfmac43430-sdio.AP6212.txt
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: GPL-2.0+
+# (C) Copyright 2018 Linaro Ltd
+# NVRAM config file for the Ampak AP6212 43430 WiFi/BT module
+aa2g=1
+ag0=255
+AvVmid_c0=0x0,0xc8
+boardflags=0x00404201
+# boardflags3 is not set
+boardnum=22
+boardrev=0x1101
+boardtype=0x0726
+# btc_params is not set
+cckbw202gpo=0x5555
+cckpwroffset0=5
+ccode=ALL
+# cldo_pwm is not set
+deadman_to=0xffffffff
+devid=0x43e2
+extpagain2g=0
+il0macaddr=00:90:4c:c5:12:38
+legofdmbw202gpo=0x77777777
+macaddr=00:90:4c:c5:12:38
+manfid=0x2d0
+maxp2ga0=90
+mcsbw202gpo=0xaaaaaaaa
+muxenab=0x10
+nocrc=1
+ofdmdigfilttype=7
+# ofdmdigfilttypebe is not set
+pa0itssit=0x20
+pa2ga0=-168,7161,-820
+# pacalidx2g is not set
+# papdendidx is not set
+# papdepsoffset is not set
+papdmode=2
+# papdvalidtest is not set
+prodid=0x0726
+# propbw202gpois not set
+# spurconfig is not set
+sromrev=11
+txpwrbckof=6
+vendid=0x14e4
+wl0id=0x431b
+xtalfreq=26000
diff --git a/firmware/brcm/brcmfmac43430-sdio.beagle,beaglev-starlight-jh7100.txt b/firmware/brcm/brcmfmac43430-sdio.beagle,beaglev-starlight-jh7100.txt
new file mode 120000
index 000000000000..e06912f7d727
--- /dev/null
+++ b/firmware/brcm/brcmfmac43430-sdio.beagle,beaglev-starlight-jh7100.txt
@@ -0,0 +1 @@
+brcmfmac43430-sdio.AP6212.txt
\ No newline at end of file
diff --git a/firmware/brcm/brcmfmac43430-sdio.bin b/firmware/brcm/brcmfmac43430-sdio.bin
new file mode 100644
index 000000000000..bb9b19783fe2
Binary files /dev/null and b/firmware/brcm/brcmfmac43430-sdio.bin differ
diff --git a/firmware/brcm/brcmfmac43430-sdio.clm_blob b/firmware/brcm/brcmfmac43430-sdio.clm_blob
new file mode 100644
index 000000000000..69a3e57ae149
Binary files /dev/null and b/firmware/brcm/brcmfmac43430-sdio.clm_blob differ
diff --git a/firmware/brcm/nvram_ap6236.txt b/firmware/brcm/nvram_ap6236.txt
new file mode 100644
index 000000000000..1d7a6fc6e394
--- /dev/null
+++ b/firmware/brcm/nvram_ap6236.txt
@@ -0,0 +1,67 @@
+#AP6236_NVRAM_V1.1.2_20191121
+# NVRAM file for BCM943430WLPTH, Bx Chip
+# 2.4 GHz, 20 MHz BW mode
+
+# The following parameter values are just placeholders, need to be updated.
+manfid=0x2d0
+prodid=0x0727
+vendid=0x14e4
+devid=0x43e2
+boardtype=0x0727
+boardrev=0x1331
+boardnum=22
+macaddr=00:90:4c:c5:12:38
+sromrev=11
+boardflags=0x00404201
+boardflags3=0x08000000
+xtalfreq=26000
+nocrc=1
+ag0=255
+aa2g=1
+ccode=ALL
+
+pa0itssit=0x20
+extpagain2g=0
+#PA parameters for 2.4GHz, measured at CHIP OUTPUT
+pa2ga0=-202,5582,-671
+AvVmid_c0=0x0,0xc8
+cckpwroffset0=5
+
+# PPR params
+maxp2ga0=74
+txpwrbckof=6
+cckbw202gpo=0x2222
+legofdmbw202gpo=0x55555555
+mcsbw202gpo=0x76666666
+propbw202gpo=0xcc
+
+# OFDM IIR :
+ofdmdigfilttype=18
+ofdmdigfilttypebe=18
+# PAPD mode:
+papdmode=1
+pacalidx2g=42
+papdepsoffset=-22
+papdendidx=58
+
+# LTECX flags
+ltecxmux=0
+ltecxpadnum=0x0102
+ltecxfnsel=0x44
+ltecxgcigpio=0x01
+
+il0macaddr=00:90:4c:c5:12:38
+wl0id=0x431b
+
+deadman_to=0xffffffff
+# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG
+muxenab=0x10
+# CLDO PWM voltage settings - 0x4 - 1.1 volt
+#cldo_pwm=0x4
+
+#VCO freq 326.4MHz
+spurconfig=0x3
+
+AvVmidIQcal=0x2,0xa8
+glitch_based_crsmin=1
+noccpwrlmt=1
\ No newline at end of file
diff --git a/firmware/regulatory.db b/firmware/regulatory.db
new file mode 100644
index 000000000000..6019e8f1a7cf
Binary files /dev/null and b/firmware/regulatory.db differ
diff --git a/firmware/regulatory.db.p7s b/firmware/regulatory.db.p7s
new file mode 100644
index 000000000000..d04cb251fa41
Binary files /dev/null and b/firmware/regulatory.db.p7s differ