Skip to content

Commit 212b754

Browse files
authored
Merge pull request #247 from alsprogrammer/main
Add Lechee RV SBC (D1 RISC-V Processor)
2 parents 5613f26 + 1f1e381 commit 212b754

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ def id(self) -> Optional[str]:
161161
board_id = boards.GENERIC_LINUX_PC
162162
elif chip_id == chips.TDA4VM:
163163
board_id = self._tisk_id()
164+
elif chip_id == chips.D1_RISCV:
165+
board_id = self._armbian_id()
164166
self._board_id = board_id
165167
return board_id
166168

@@ -332,6 +334,8 @@ def _armbian_id(self) -> Optional[str]:
332334
board = boards.NANOPI_DUO2
333335
elif board_value == "nanopineo":
334336
board = boards.NANOPI_NEO
337+
elif board_value == "nezha":
338+
board = boards.LICHEE_RV
335339

336340
return board
337341

@@ -662,6 +666,11 @@ def any_tisk_board(self) -> bool:
662666
"""Check whether the current board is any defined TI SK Board."""
663667
return self.id in [v[0] for v in boards._TI_SK_BOARD_IDS]
664668

669+
@property
670+
def any_lichee_riscv_board(self) -> bool:
671+
"""Check whether the current board is any defined Lichee RISC-V."""
672+
return self.id in boards._LICHEE_RISCV_IDS
673+
665674
@property
666675
def any_embedded_linux(self) -> bool:
667676
"""Check whether the current board is any embedded Linux device."""
@@ -691,6 +700,7 @@ def any_embedded_linux(self) -> bool:
691700
self.any_bananapi,
692701
self.any_maaxboard,
693702
self.any_tisk_board,
703+
self.any_lichee_riscv_board,
694704
]
695705
)
696706

adafruit_platformdetect/chip.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ def _linux_id(self) -> Optional[str]:
240240
if self.detector.check_dt_compatible_value("ti,j721e"):
241241
return chips.TDA4VM
242242

243+
if self.detector.check_dt_compatible_value("sun20i-d1"):
244+
return chips.D1_RISCV
245+
243246
linux_id = None
244247
hardware = self.detector.get_cpuinfo_field("Hardware")
245248

adafruit_platformdetect/constants/boards.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"
130130

131131
ALLWINER_D1 = "ALLWINER_D1"
132+
LICHEE_RV = "LICHEE_RV"
132133

133134
MICROCHIP_MCP2221 = "MICROCHIP_MCP2221"
134135

@@ -520,3 +521,6 @@
520521

521522
# MaaXBoard boards
522523
_MAAXBOARD_IDS = ("MAAXBOARD", "MAAXBOARD_MINI")
524+
525+
# Lichee RISC-V boards
526+
_LICHEE_RISCV_IDS = (LICHEE_RV,)

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
MT8167 = "MT8167"
5858
ATOM_X5_Z8350 = "X5-Z8350"
5959
RP2040_U2IF = "RP2040_U2IF"
60+
D1_RISCV = "D1_RISCV"
6061

6162

6263
BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"}

0 commit comments

Comments
 (0)