Skip to content

Commit 184e5a9

Browse files
committed
Merge branch 'main' of https://github.com/adafruit/Adafruit_Python_PlatformDetect into debian_orange_pi
2 parents 0bcb1d0 + 69daccf commit 184e5a9

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

adafruit_platformdetect/board.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def id(self) -> Optional[str]:
6565
board_id = self._armbian_id() or self._allwinner_variants_id()
6666
elif chip_id == chips.BCM2XXX:
6767
board_id = self._pi_id()
68+
elif chip_id == chips.AM625X:
69+
board_id = self._beaglebone_id()
6870
elif chip_id == chips.AM33XX:
6971
board_id = self._beaglebone_id()
7072
elif chip_id == chips.AM65XX:
@@ -184,7 +186,7 @@ def id(self) -> Optional[str]:
184186
elif chip_id == chips.GENERIC_X86:
185187
board_id = boards.GENERIC_LINUX_PC
186188
elif chip_id == chips.TDA4VM:
187-
board_id = self._tisk_id()
189+
board_id = self._beaglebone_id() or self._tisk_id()
188190
elif chip_id == chips.D1_RISCV:
189191
board_id = self._armbian_id()
190192
elif chip_id == chips.S905X:
@@ -270,7 +272,12 @@ def _beaglebone_id(self) -> Optional[str]:
270272
with open("/sys/bus/nvmem/devices/0-00501/nvmem", "rb") as eeprom:
271273
eeprom_bytes = eeprom.read(16)
272274
except FileNotFoundError:
273-
return None
275+
try:
276+
# Special Case for AI64
277+
with open("/sys/bus/nvmem/devices/2-00500/nvmem", "rb") as eeprom:
278+
eeprom_bytes = eeprom.read(16)
279+
except FileNotFoundError:
280+
return None
274281

275282
if eeprom_bytes[:4] != b"\xaaU3\xee":
276283
return None
@@ -280,6 +287,14 @@ def _beaglebone_id(self) -> Optional[str]:
280287
if eeprom_bytes == b"\xaaU3\xeeA335BNLT\x1a\x00\x00\x00":
281288
return boards.BEAGLEBONE_GREEN
282289

290+
# BeaglePlay Special Condition
291+
# new Beagle EEPROM IDs are 24 Bit, so we need to verify full range
292+
if eeprom_bytes == b"\xaaU3\xee\x017\x00\x10.\x00BEAGLE":
293+
with open("/sys/bus/nvmem/devices/0-00500/nvmem", "rb") as eeprom:
294+
eeprom_bytes = eeprom.read(24)
295+
if eeprom_bytes == b"\xaaU3\xee\x017\x00\x10.\x00BEAGLEPLAY-A0-":
296+
return boards.BEAGLE_PLAY
297+
283298
id_string = eeprom_bytes[4:].decode("ascii")
284299
for model, bb_ids in boards._BEAGLEBONE_BOARD_IDS.items():
285300
for bb_id in bb_ids:

adafruit_platformdetect/chip.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ def _linux_id(self) -> Optional[str]:
178178
# pylint: disable=too-many-branches,too-many-statements
179179
# pylint: disable=too-many-return-statements
180180
"""Attempt to detect the CPU on a computer running the Linux kernel."""
181+
if self.detector.check_dt_compatible_value("ti,am625"):
182+
return chips.AM625X
181183
if self.detector.check_dt_compatible_value("ti,am654"):
182184
return chips.AM65XX
183185

adafruit_platformdetect/constants/boards.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
"""Definition of boards and/or ids"""
66
# Allow for aligned constant definitions:
7+
BEAGLE_PLAY = "BEAGLE_PLAY"
8+
BEAGLEBONE_AI64 = "BEAGLEBONE_AI64"
79
BEAGLEBONE = "BEAGLEBONE"
810
BEAGLEBONE_BLACK = "BEAGLEBONE_BLACK"
911
BEAGLEBONE_BLUE = "BEAGLEBONE_BLUE"
@@ -352,6 +354,8 @@
352354
)
353355

354356
_BEAGLEBONE_IDS = (
357+
BEAGLE_PLAY,
358+
BEAGLEBONE_AI64,
355359
BEAGLEBONE,
356360
BEAGLEBONE_BLACK,
357361
BEAGLEBONE_BLUE,
@@ -380,6 +384,8 @@
380384
# https://github.com/beagleboard/image-builder
381385
# Thanks to zmatt on freenode #beagle for pointers.
382386
_BEAGLEBONE_BOARD_IDS = {
387+
BEAGLE_PLAY: (("A0", "7.BEAGLE")),
388+
BEAGLEBONE_AI64: (("B0", "7.BBONEA")),
383389
# Original bone/white:
384390
BEAGLEBONE: (
385391
("A4", "A335BONE00A4"),

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""Definition of chips."""
66
A311D = "A311D"
77
AM33XX = "AM33XX"
8+
AM625X = "AM625X"
89
AM65XX = "AM65XX"
910
DRA74X = "DRA74X"
1011
TDA4VM = "TDA4VM"

0 commit comments

Comments
 (0)