Skip to content

support renesas rzv2h/rzv2n, bananapi ai2h/ai2n board #384

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 1 commit into from
May 14, 2025
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
24 changes: 24 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ def id(self) -> Optional[str]:
board_id = self._clockwork_pi_id()
elif chip_id == chips.K1:
board_id = self._armbian_id() or self._spacemit_variants_id()
elif chip_id == chips.RZV2N:
board_id = self._armbian_id() or self._renesas_variants_id()
elif chip_id == chips.RZV2H:
board_id = self._armbian_id() or self._renesas_variants_id()
elif chip_id == chips.RK3308:
board_id = self._rock_pi_id()
elif chip_id == chips.RK3399:
Expand Down Expand Up @@ -454,6 +458,10 @@ def _armbian_id(self) -> Optional[str]:
board = boards.BANANA_PI_F3
elif board_value == "bananapif5":
board = boards.BANANA_PI_F5
elif board_value == "bananapiai2n":
board = boards.BANANA_PI_AI2N
elif board_value == "bananapiai2h":
board = boards.BANANA_PI_AI2H
elif board_value == "orangepizeroplus2-h5":
board = boards.ORANGE_PI_ZERO_PLUS_2H5
elif board_value == "orangepizeroplus":
Expand Down Expand Up @@ -847,6 +855,22 @@ def _spacemit_variants_id(self) -> Optional[str]:

return board

def _renesas_variants_id(self) -> Optional[str]:
"""Try to detect the id of renesas based board. (bananapi)"""
board_value = self.detector.get_device_model()
board = None
if not board_value:
return board
board_value = board_value.lower()

if any(x in board_value for x in ("banana pi", "bananapi")):
if "bpi-ai2n" in board_value:
board = boards.BANANA_PI_AI2N
if "bpi-ai2h" in board_value:
board = boards.BANANA_PI_AI2H

return board

def _repka_variants_id(self) -> Optional[str]:
board_value = self.detector.get_device_model()
board = None
Expand Down
6 changes: 6 additions & 0 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ def _linux_id(self) -> Optional[str]:
if self.detector.check_dt_compatible_value("spacemit,k1-x"):
return chips.K1

if self.detector.check_dt_compatible_value("renesas,r9a09g056"):
return chips.RZV2N

if self.detector.check_dt_compatible_value("renesas,r9a09g057"):
return chips.RZV2H

if self.detector.check_dt_compatible_value("mediatek,mt8167"):
return chips.MT8167

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 @@ -84,6 +84,8 @@
BANANA_PI_M5 = "BANANA_PI_M5"
BANANA_PI_F3 = "BANANA_PI_F3"
BANANA_PI_F5 = "BANANA_PI_F5"
BANANA_PI_AI2N = "BANANA_PI_AI2N"
BANANA_PI_AI2H = "BANANA_PI_AI2H"

# LeMaker boards
LEMAKER_BANANA_PRO = "LEMAKER_BANANA_PRO"
Expand Down Expand Up @@ -330,6 +332,8 @@
BANANA_PI_M5,
BANANA_PI_F3,
BANANA_PI_F5,
BANANA_PI_AI2N,
BANANA_PI_AI2H,
)

# LeMaker
Expand Down
2 changes: 2 additions & 0 deletions adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
ATOM_J4105 = "ATOM_J4105"
TH1520 = "TH1520"
K1 = "K1"
RZV2N = "RZV2N"
RZV2H = "RZV2H"
SUNRISE_X3 = "SUNRISE_X3"

BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2712", "BCM2835", "BCM2837"}
Expand Down
Loading