summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgab-k <[email protected]>2025-12-10 23:04:39 +0100
committergab-k <[email protected]>2025-12-10 23:04:39 +0100
commita412a8e50d07fc789ea598f101a94570b1f33fc4 (patch)
tree0c5fc9f92f3239936516bf4f581b58b40a04333c
parentb05ec753f8aa8607b6e72ec7e3933935094e6906 (diff)
hw/mcu: add support for NXP RW612
-rw-r--r--README.rst4
-rw-r--r--src/common/tusb_mcu.h8
-rw-r--r--src/portable/chipidea/ci_hs/ci_hs_rw61x.h48
-rw-r--r--src/portable/chipidea/ci_hs/dcd_ci_hs.c3
-rw-r--r--src/portable/ehci/ehci.c2
-rw-r--r--src/tusb_option.h1
6 files changed, 64 insertions, 2 deletions
diff --git a/README.rst b/README.rst
index 6a6f07825..463cc8b42 100644
--- a/README.rst
+++ b/README.rst
@@ -208,7 +208,9 @@ Supported CPUs
| | MCX | N9 | ✔ | | ✔ | ci_fs, ci_hs, ehci | |
| | +-------------------+--------+------+-----------+------------------------+-------------------+
| | | A15 | ✔ | | | ci_fs | |
-+--------------+---------+-------------------+--------+------+-----------+------------------------+-------------------+
+| +---------+-------------------+--------+------+-----------+------------------------+-------------------+
+| | RW61x | ✔ | | ✔ | ci_hs, ehci | |
++--------------+-----------------------------+--------+------+-----------+------------------------+-------------------+
| Raspberry Pi | RP2040, RP2350 | ✔ | ✔ | ✖ | rp2040, pio_usb | |
+--------------+-----+-----------------------+--------+------+-----------+------------------------+-------------------+
| Renesas | RX | 63N, 65N, 72N | ✔ | ✔ | ✖ | rusb2 | |
diff --git a/src/common/tusb_mcu.h b/src/common/tusb_mcu.h
index 1e773bf96..89316ee77 100644
--- a/src/common/tusb_mcu.h
+++ b/src/common/tusb_mcu.h
@@ -111,6 +111,14 @@
#define TUP_DCD_ENDPOINT_MAX 16
+#elif TU_CHECK_MCU(OPT_MCU_RW61X)
+ // USB0 is chipidea HS
+ #define TUP_USBIP_CHIPIDEA_HS
+ #define TUP_USBIP_EHCI
+
+ #define TUP_DCD_ENDPOINT_MAX 8
+ #define TUP_RHPORT_HIGHSPEED 1
+
#elif TU_CHECK_MCU(OPT_MCU_MIMXRT1XXX)
#include "fsl_device_registers.h"
diff --git a/src/portable/chipidea/ci_hs/ci_hs_rw61x.h b/src/portable/chipidea/ci_hs/ci_hs_rw61x.h
new file mode 100644
index 000000000..114fe26c3
--- /dev/null
+++ b/src/portable/chipidea/ci_hs/ci_hs_rw61x.h
@@ -0,0 +1,48 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2021, Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * This file is part of the TinyUSB stack.
+ */
+
+#ifndef _CI_HS_RW61X_H_
+#define _CI_HS_RW61X_H_
+
+#include "fsl_device_registers.h"
+
+static const ci_hs_controller_t _ci_controller[] = {
+ {.reg_base = USBOTG_BASE, .irqnum = USB_IRQn}
+};
+
+TU_ATTR_ALWAYS_INLINE static inline ci_hs_regs_t* CI_HS_REG(uint8_t port) {
+ (void) port;
+ return ((ci_hs_regs_t*) _ci_controller[0].reg_base);
+}
+
+#define CI_DCD_INT_ENABLE(_p) do { (void) _p; NVIC_EnableIRQ (_ci_controller[0].irqnum); } while (0)
+#define CI_DCD_INT_DISABLE(_p) do { (void) _p; NVIC_DisableIRQ(_ci_controller[0].irqnum); } while (0)
+
+#define CI_HCD_INT_ENABLE(_p) NVIC_EnableIRQ (_ci_controller[_p].irqnum)
+#define CI_HCD_INT_DISABLE(_p) NVIC_DisableIRQ(_ci_controller[_p].irqnum)
+
+
+#endif
diff --git a/src/portable/chipidea/ci_hs/dcd_ci_hs.c b/src/portable/chipidea/ci_hs/dcd_ci_hs.c
index 4a5e5c91f..27298989c 100644
--- a/src/portable/chipidea/ci_hs/dcd_ci_hs.c
+++ b/src/portable/chipidea/ci_hs/dcd_ci_hs.c
@@ -55,6 +55,9 @@ bool dcd_dcache_clean_invalidate(void const* addr, uint32_t data_size) {
// MCX N9 only port 1 use this controller
#include "ci_hs_mcx.h"
+#elif TU_CHECK_MCU(OPT_MCU_RW61X)
+ #include "ci_hs_rw61x.h"
+
#else
#error "Unsupported MCUs"
#endif
diff --git a/src/portable/ehci/ehci.c b/src/portable/ehci/ehci.c
index c33c970e4..e604a0360 100644
--- a/src/portable/ehci/ehci.c
+++ b/src/portable/ehci/ehci.c
@@ -40,7 +40,7 @@
#include "ehci.h"
// NXP specific fixes
-#if TU_CHECK_MCU(OPT_MCU_MIMXRT1XXX, OPT_MCU_LPC55, OPT_MCU_MCXN9)
+#if TU_CHECK_MCU(OPT_MCU_MIMXRT1XXX, OPT_MCU_LPC55, OPT_MCU_MCXN9, OPT_MCU_RW61X)
#include "fsl_device_registers.h"
#endif
diff --git a/src/tusb_option.h b/src/tusb_option.h
index be954e01a..68f2d3598 100644
--- a/src/tusb_option.h
+++ b/src/tusb_option.h
@@ -199,6 +199,7 @@
// NXP LPC MCX
#define OPT_MCU_MCXN9 2300 ///< NXP MCX N9 Series
#define OPT_MCU_MCXA15 2301 ///< NXP MCX A15 Series
+#define OPT_MCU_RW61X 2302 ///< NXP RW61x Series
// Analog Devices
#define OPT_MCU_MAX32690 2400 ///< ADI MAX32690