From 380dda2c521f2ac8b8ca51ae531c75fb26bfa728 Mon Sep 17 00:00:00 2001 From: Andrew_Mcfly <222248+steamfoundry@users.noreply.github.com> Date: Fri, 17 Mar 2023 07:19:15 +0000 Subject: [PATCH 1/4] Adding NXP NavQPlus to detected boardys (Uses an IMX8M SOC module so the chip is already detected) Future boards using the same SOC may need to edit the board name or detection line in bin/detect.py so it doesn't list it as an NXP NAVq board Original NavQ board not available to I couldn't add it too. Added for the Hovergames 3 Team Mcfly 2023 Changes to be committed: modified: adafruit_platformdetect/board.py modified: adafruit_platformdetect/constants/boards.py modified: bin/detect.py --- adafruit_platformdetect/board.py | 9 ++++++++- adafruit_platformdetect/constants/boards.py | 8 ++++++++ bin/detect.py | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index a16a3005..62709952 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -418,6 +418,8 @@ def _imx8mx_id(self) -> Optional[str]: return boards.MAAXBOARD if "Phanbell" in board_value: return boards.CORAL_EDGE_TPU_DEV + if "NXP i.MX8MPlus SOM " in board_value: + return boards.NXP_IMX8MPLUS_SOM return None def _imx6ull_id(self) -> Optional[str]: @@ -797,6 +799,11 @@ def any_libre_computer_board(self) -> bool: """Check whether the current board is any defined Libre Computer board.""" return self.id in boards._LIBRE_COMPUTER_IDS + @property + def any_nxp_navq_board(self) -> bool: + """Check whether the current board is any NXP NavQ board""" + return self.id in boards._NXP_SOM_IDS + @property def os_environ_board(self) -> bool: """Check whether the current board is an OS environment variable special case.""" @@ -851,7 +858,7 @@ def lazily_generate_conditions(): yield self.any_pcduino_board yield self.any_libre_computer_board yield self.generic_linux - + yield self.any_nxp_navq_board return any(condition for condition in lazily_generate_conditions()) @property diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index ea1211d6..e829e5f9 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -585,3 +585,11 @@ AML_S905X_CC, ROC_RK3328_CC, ) + +# NXP System on Module Computer boards +NXP_IMX8MPLUS_SOM = "NXP_IMX8MPLUS_SOM" + +_NXP_SOM_IDS = ( + NXP_IMX8MPLUS_SOM, +) + diff --git a/bin/detect.py b/bin/detect.py index 1723b892..86494bd2 100755 --- a/bin/detect.py +++ b/bin/detect.py @@ -111,3 +111,6 @@ if detector.board.any_siemens_simatic_iot2000: print("Siemens Simatic IOT2000 Gateway detected.") + +if detector.board.any_nxp_navq_board: + print("NXP NavQ board detected.") From 9fded76d75184a6171e791e72edb46178ca5b417 Mon Sep 17 00:00:00 2001 From: Andrew_Mcfly <222248+steamfoundry@users.noreply.github.com> Date: Fri, 17 Mar 2023 08:15:45 +0000 Subject: [PATCH 2/4] Fixing formatting with black before Pull request --- adafruit_platformdetect/__init__.py | 1 + adafruit_platformdetect/board.py | 1 + adafruit_platformdetect/constants/boards.py | 5 +---- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/adafruit_platformdetect/__init__.py b/adafruit_platformdetect/__init__.py index ddfdf803..29a81d1f 100644 --- a/adafruit_platformdetect/__init__.py +++ b/adafruit_platformdetect/__init__.py @@ -21,6 +21,7 @@ if sys.platform == "darwin": os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib/" + # Various methods here may retain state in future, so tell pylint not to worry # that they don't use self right now: # pylint: disable=no-self-use diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 62709952..ad9513ab 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -859,6 +859,7 @@ def lazily_generate_conditions(): yield self.any_libre_computer_board yield self.generic_linux yield self.any_nxp_navq_board + return any(condition for condition in lazily_generate_conditions()) @property diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index e829e5f9..69494662 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -589,7 +589,4 @@ # NXP System on Module Computer boards NXP_IMX8MPLUS_SOM = "NXP_IMX8MPLUS_SOM" -_NXP_SOM_IDS = ( - NXP_IMX8MPLUS_SOM, -) - +_NXP_SOM_IDS = (NXP_IMX8MPLUS_SOM,) From 385c5a216e65fe01527b919174dd9d0ffee36df2 Mon Sep 17 00:00:00 2001 From: Steamfoundry <222248+steamfoundry@users.noreply.github.com> Date: Fri, 17 Mar 2023 12:13:06 -0600 Subject: [PATCH 3/4] Refactor how I added the NXP i.MX8M Plus so it won't conflict definitions when I add it into Blinka Changes to be committed: modified: adafruit_platformdetect/board.py modified: adafruit_platformdetect/chip.py modified: adafruit_platformdetect/constants/chips.py --- adafruit_platformdetect/board.py | 9 ++++++++- adafruit_platformdetect/chip.py | 6 +++++- adafruit_platformdetect/constants/chips.py | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index ad9513ab..e8b55d02 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -81,6 +81,8 @@ def id(self) -> Optional[str]: board_id = self._sama5_id() elif chip_id == chips.IMX8MX: board_id = self._imx8mx_id() + elif chip_id == chips.IMX8MP: + board_id = self._imx8mp_id() elif chip_id == chips.IMX6ULL: board_id = self._imx6ull_id() elif chip_id == chips.S905Y2: @@ -418,7 +420,12 @@ def _imx8mx_id(self) -> Optional[str]: return boards.MAAXBOARD if "Phanbell" in board_value: return boards.CORAL_EDGE_TPU_DEV - if "NXP i.MX8MPlus SOM " in board_value: + return None + + def _imx8mp_id(self) -> Optional[str]: + """Check what type iMX8M board.""" + board_value = self.detector.get_device_model() + if "NXP i.MX8MPlus SOM" in board_value: return boards.NXP_IMX8MPLUS_SOM return None diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index eeea25e2..2f97dd25 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -311,7 +311,11 @@ def _linux_id(self) -> Optional[str]: elif "nvidia,tegra234" in compats: linux_id = chips.T234 if compatible and "imx8m" in compatible: - linux_id = chips.IMX8MX + compats = compatible.split("\x00") + if "imx8mp" in compats: + linux_id = chips.IMX8MP + else: + linux_id = chips.IMX8MX if compatible and "odroid-c2" in compatible: linux_id = chips.S905 if compatible and "amlogic" in compatible: diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 4dc2b9a8..2aa2b70d 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -10,6 +10,7 @@ TDA4VM = "TDA4VM" IMX6ULL = "IMX6ULL" IMX8MX = "IMX8MX" +IMX8MP = "IMX8MP" BCM2XXX = "BCM2XXX" ESP8266 = "ESP8266" EXYNOS5422 = "EXYNOS5422" From 61b2ae29922886881383fafc14653b61e18e7dc4 Mon Sep 17 00:00:00 2001 From: Steamfoundry <222248+steamfoundry@users.noreply.github.com> Date: Fri, 17 Mar 2023 15:59:37 -0600 Subject: [PATCH 4/4] fixing IMX8MP so it shows as a linux kernel --- adafruit_platformdetect/board.py | 2 +- adafruit_platformdetect/chip.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index e8b55d02..892cbb1c 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -421,7 +421,7 @@ def _imx8mx_id(self) -> Optional[str]: if "Phanbell" in board_value: return boards.CORAL_EDGE_TPU_DEV return None - + def _imx8mp_id(self) -> Optional[str]: """Check what type iMX8M board.""" board_value = self.detector.get_device_model() diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 2f97dd25..e3a5427c 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -269,6 +269,9 @@ def _linux_id(self) -> Optional[str]: if self.detector.check_dt_compatible_value("sun20i-d1"): return chips.D1_RISCV + if self.detector.check_dt_compatible_value("imx8mp"): + return chips.IMX8MP + if self.detector.check_dt_compatible_value("libretech,aml-s905x-cc"): return chips.S905X @@ -311,11 +314,7 @@ def _linux_id(self) -> Optional[str]: elif "nvidia,tegra234" in compats: linux_id = chips.T234 if compatible and "imx8m" in compatible: - compats = compatible.split("\x00") - if "imx8mp" in compats: - linux_id = chips.IMX8MP - else: - linux_id = chips.IMX8MX + linux_id = chips.IMX8MX if compatible and "odroid-c2" in compatible: linux_id = chips.S905 if compatible and "amlogic" in compatible: