Skip to content

Commit 98ee83b

Browse files
authored
Merge pull request #153 from fede2cr/master
Adding support for Allwinner D1 with Xuantie-C906
2 parents 54358c4 + c9255ed commit 98ee83b

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def id(self):
113113
board_id = self._tegra_id()
114114
elif chip_id == chips.HFU540:
115115
board_id = self._sifive_id()
116+
elif chip_id == chips.C906:
117+
board_id = self._allwinner_id()
116118
elif chip_id == chips.MCP2221:
117119
board_id = boards.MICROCHIP_MCP2221
118120
elif chip_id == chips.BINHO:
@@ -342,6 +344,13 @@ def _sifive_id(self):
342344
return boards.SIFIVE_UNLEASHED
343345
return None
344346

347+
def _allwinner_id(self):
348+
"""Try to detect the id for Allwiner D1 board."""
349+
board_value = self.detector.get_device_model()
350+
if "sun20iw1p1" in board_value:
351+
return boards.ALLWINER_D1
352+
return None
353+
345354
def _pine64_id(self):
346355
"""Try to detect the id for Pine64 board or device."""
347356
board_value = self.detector.get_device_model()

adafruit_platformdetect/chip.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ def _linux_id(self):
162162
if self.detector.check_dt_compatible_value("fu500"):
163163
return chips.HFU540
164164

165+
if self.detector.check_dt_compatible_value("sun20iw1p1"):
166+
return chips.C906
167+
165168
if self.detector.check_dt_compatible_value("sun8i-a33"):
166169
return chips.A33
167170

adafruit_platformdetect/constants/boards.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@
109109

110110
SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"
111111

112+
ALLWINER_D1 = "ALLWINER_D1"
113+
112114
MICROCHIP_MCP2221 = "MICROCHIP_MCP2221"
113115

114116
# Raspberry Pi Pico with u2if firmware

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
FT232H = "FT232H"
2424
FT2232H = "FT2232H"
2525
HFU540 = "HFU540"
26+
C906 = "C906"
2627
MCP2221 = "MCP2221"
2728
BINHO = "BINHO"
2829
MIPS24KC = "MIPS24KC"

0 commit comments

Comments
 (0)