Skip to content

Commit 9c9fd12

Browse files
authored
Merge pull request #364 from DarkMechanikum/main
Added detection of Starfive JH7110 chip and Starfive VisionFive2 board
2 parents ba91425 + 55436d5 commit 9c9fd12

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

adafruit_platformdetect/board.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
from adafruit_platformdetect.constants import boards, chips
3232

33-
3433
__version__ = "0.0.0+auto.0"
3534
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git"
3635

@@ -63,6 +62,8 @@ def id(self) -> Optional[str]:
6362

6463
if chip_id == chips.H3:
6564
board_id = self._armbian_id() or self._allwinner_variants_id()
65+
elif chip_id == chips.JH7110:
66+
board_id = self._starfive_id()
6667
elif chip_id == chips.BCM2XXX:
6768
board_id = self._pi_id()
6869
elif chip_id == chips.OS_AGNOSTIC:
@@ -226,6 +227,12 @@ def id(self) -> Optional[str]:
226227
return board_id
227228

228229
# pylint: enable=invalid-name
230+
def _starfive_id(self) -> Optional[str]:
231+
model = None
232+
model_value = self.detector.get_device_model()
233+
if "VisionFive" in model_value and "V2" in model_value:
234+
model = boards.VISIONFIVE2
235+
return model
229236

230237
def _pi_id(self) -> Optional[str]:
231238
"""Try to detect id of a Raspberry Pi."""

adafruit_platformdetect/chip.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
2020
"""
2121

22-
2322
import os
2423
import sys
2524

@@ -30,7 +29,6 @@
3029

3130
from adafruit_platformdetect.constants import chips
3231

33-
3432
__version__ = "0.0.0+auto.0"
3533
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git"
3634

@@ -224,6 +222,9 @@ def _linux_id(self) -> Optional[str]:
224222
if self.detector.check_dt_compatible_value("jh7100"):
225223
return chips.JH71X0
226224

225+
if self.detector.check_dt_compatible_value("jh7110"):
226+
return chips.JH7110
227+
227228
if self.detector.check_dt_compatible_value("sun8i-a33"):
228229
return chips.A33
229230

adafruit_platformdetect/constants/boards.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
"""Definition of boards and/or ids"""
66
# Allow for aligned constant definitions:
7+
VISIONFIVE2 = "VISIONFIVE2"
78
BEAGLE_PLAY = "BEAGLE_PLAY"
89
BEAGLEBONE_AI64 = "BEAGLEBONE_AI64"
910
BEAGLEBONE = "BEAGLEBONE"
@@ -73,7 +74,6 @@
7374
NANOPI_NEO = "NANOPI_NEO"
7475
NANOPI_NEO_2 = "NANOPI_NEO_2"
7576

76-
7777
# Banana Pi boards
7878
BANANA_PI_M2_ZERO = "BANANA_PI_M2_ZERO"
7979
BANANA_PI_M2_PLUS = "BANANA_PI_M2_PLUS"
@@ -243,6 +243,8 @@
243243
LUCKFOX_PICO_MINI = "LUCKFOX_PICO_MINI"
244244
LUCKFOX_PICO_PLUS = "LUCKFOX_PICO_PLUS"
245245

246+
# StarFive boards
247+
_STARFIVE_BOARD_IDS = (VISIONFIVE2,)
246248
# Asus Tinkerboard
247249
_ASUS_TINKER_BOARD_IDS = (
248250
ASUS_TINKER_BOARD,

adafruit_platformdetect/constants/chips.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
HFU540 = "HFU540"
4242
C906 = "C906"
4343
JH71X0 = "JH71X0"
44+
JH7110 = "JH7110"
4445
MCP2221 = "MCP2221"
4546
BINHO = "BINHO"
4647
MIPS24KC = "MIPS24KC"

0 commit comments

Comments
 (0)