Skip to content

Add Lechee RV SBC (D1 RISC-V Processor) #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ def id(self) -> Optional[str]:
board_id = boards.GENERIC_LINUX_PC
elif chip_id == chips.TDA4VM:
board_id = self._tisk_id()
elif chip_id == chips.D1_RISCV:
board_id = self._armbian_id()
self._board_id = board_id
return board_id

Expand Down Expand Up @@ -328,6 +330,8 @@ def _armbian_id(self) -> Optional[str]:
board = boards.NANOPI_DUO2
elif board_value == "nanopineo":
board = boards.NANOPI_NEO
elif board_value == "nezha":
board = boards.LICHEE_RV

return board

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

@property
def any_lichee_riscv_board(self) -> bool:
"""Check whether the current board is any defined Lichee RISC-V."""
return self.id in boards._LICHEE_RISCV_IDS

@property
def any_embedded_linux(self) -> bool:
"""Check whether the current board is any embedded Linux device."""
Expand Down Expand Up @@ -687,6 +696,7 @@ def any_embedded_linux(self) -> bool:
self.any_bananapi,
self.any_maaxboard,
self.any_tisk_board,
self.any_lichee_riscv_board,
]
)

Expand Down
3 changes: 3 additions & 0 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ def _linux_id(self) -> Optional[str]:
if self.detector.check_dt_compatible_value("ti,j721e"):
return chips.TDA4VM

if self.detector.check_dt_compatible_value("sun20i-d1"):
return chips.D1_RISCV

linux_id = None
hardware = self.detector.get_cpuinfo_field("Hardware")

Expand Down
4 changes: 4 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"

ALLWINER_D1 = "ALLWINER_D1"
LICHEE_RV = "LICHEE_RV"

MICROCHIP_MCP2221 = "MICROCHIP_MCP2221"

Expand Down Expand Up @@ -516,3 +517,6 @@

# MaaXBoard boards
_MAAXBOARD_IDS = ("MAAXBOARD", "MAAXBOARD_MINI")

# Lichee RISC-V boards
_LICHEE_RISCV_IDS = (LICHEE_RV,)
1 change: 1 addition & 0 deletions adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
MT8167 = "MT8167"
ATOM_X5_Z8350 = "X5-Z8350"
RP2040_U2IF = "RP2040_U2IF"
D1_RISCV = "D1_RISCV"


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