From 624a40d5808447122fb6f15cb0c10a281f09e9ec Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:20:48 +0300 Subject: [PATCH] added JH7110 RISC-V chip and STARFIVE VISIONFIVE2 board --- adafruit_platformdetect/board.py | 9 ++++++++- adafruit_platformdetect/chip.py | 3 ++- adafruit_platformdetect/constants/boards.py | 5 +++++ adafruit_platformdetect/constants/chips.py | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 0358b5f..87a29c4 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -63,6 +63,8 @@ class Board: if chip_id == chips.H3: board_id = self._armbian_id() or self._allwinner_variants_id() + elif chip_id == chips.JH7110: + board_id = self._starfive_id() elif chip_id == chips.BCM2XXX: board_id = self._pi_id() elif chip_id == chips.OS_AGNOSTIC: @@ -226,7 +228,12 @@ class Board: return board_id # pylint: enable=invalid-name - + def _starfive_id(self) -> Optional[str]: + model = None + board_value = self.detector.get_device_compatible() + if "visionfive-v2starfive" in board_value: + model = boards.VISIONFIVE2 + return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" # Check for Pi boards: diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 9958823..c5670c5 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -223,7 +223,8 @@ class Chip: # Newer Builds if self.detector.check_dt_compatible_value("jh7100"): return chips.JH71X0 - + if self.detector.check_dt_compatible_value("jh7110"): + return chips.JH7110 if self.detector.check_dt_compatible_value("sun8i-a33"): return chips.A33 diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 23daaa2..d684c6f 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -4,6 +4,7 @@ """Definition of boards and/or ids""" # Allow for aligned constant definitions: +VISIONFIVE2 = "VISIONFIVE2" BEAGLE_PLAY = "BEAGLE_PLAY" BEAGLEBONE_AI64 = "BEAGLEBONE_AI64" BEAGLEBONE = "BEAGLEBONE" @@ -243,6 +244,10 @@ LUCKFOX_PICO_MAX = "LUCKFOX_PICO_MAX" LUCKFOX_PICO_MINI = "LUCKFOX_PICO_MINI" LUCKFOX_PICO_PLUS = "LUCKFOX_PICO_PLUS" +# StarFive boards +_STARFIVE_BOARD_IDS = ( + VISIONFIVE2, +) # Asus Tinkerboard _ASUS_TINKER_BOARD_IDS = ( ASUS_TINKER_BOARD, diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index fee4260..3210724 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -41,6 +41,7 @@ FT2232H = "FT2232H" HFU540 = "HFU540" C906 = "C906" JH71X0 = "JH71X0" +JH7110 = "JH7110" MCP2221 = "MCP2221" BINHO = "BINHO" MIPS24KC = "MIPS24KC"