diff --git a/arch/risc-v/src/mpfs/hardware/mpfs250t_484_pinmap.h b/arch/risc-v/src/mpfs/hardware/mpfs250t_484_pinmap.h index 23d010359c..04b0f5ece3 100644 --- a/arch/risc-v/src/mpfs/hardware/mpfs250t_484_pinmap.h +++ b/arch/risc-v/src/mpfs/hardware/mpfs250t_484_pinmap.h @@ -81,6 +81,7 @@ /* Default EC configuration for all GPIOS */ #define MSSIO_EC_DEFAULT (0x0428 << GPIO_EC_SHIFT) +#define MSSIO_EC_USB_DEFAULT (0x0829 << GPIO_EC_SHIFT) /* Basic GPIO definitions for MSSIO */ @@ -130,6 +131,21 @@ #define MSSIO_GPIO_PAD36_E3 (GPIO_BANK1 | GPIO_PIN22 | MSSIO_AF_GPIO | MSSIO_EC_DEFAULT) #define MSSIO_GPIO_PAD37_D4 (GPIO_BANK1 | GPIO_PIN23 | MSSIO_AF_GPIO | MSSIO_EC_DEFAULT) +/* USB pins */ + +#define MSSIO_USB_CLK (GPIO_BANK1 | GPIO_PIN0 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_DIR (GPIO_BANK1 | GPIO_PIN1 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_NXT (GPIO_BANK1 | GPIO_PIN2 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_STP (GPIO_BANK1 | GPIO_PIN3 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_DATA0 (GPIO_BANK1 | GPIO_PIN4 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_DATA1 (GPIO_BANK1 | GPIO_PIN5 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_DATA2 (GPIO_BANK1 | GPIO_PIN6 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_DATA3 (GPIO_BANK1 | GPIO_PIN7 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_DATA4 (GPIO_BANK1 | GPIO_PIN8 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_DATA5 (GPIO_BANK1 | GPIO_PIN9 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_DATA6 (GPIO_BANK1 | GPIO_PIN10 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) +#define MSSIO_USB_DATA7 (GPIO_BANK1 | GPIO_PIN11 | MSSIO_AF_USB | MSSIO_EC_USB_DEFAULT) + #endif #endif /* __ARCH_RISCV_SRC_MPFS_HARDWARE_MPFS250T_484_PINMAP_H */ diff --git a/arch/risc-v/src/mpfs/mpfs_usb.c b/arch/risc-v/src/mpfs/mpfs_usb.c index 229e8cbfd3..96229ee6a5 100755 --- a/arch/risc-v/src/mpfs/mpfs_usb.c +++ b/arch/risc-v/src/mpfs/mpfs_usb.c @@ -48,7 +48,6 @@ #include #include -#include #include "hardware/mpfs_usb.h" #include "riscv_arch.h" @@ -111,41 +110,6 @@ #define MPFS_PMPCFG_USB_2 (MPFS_MPUCFG_BASE + 0x610) #define MPFS_PMPCFG_USB_3 (MPFS_MPUCFG_BASE + 0x618) -/* IOMUX registers */ - -#define MPFS_SYSREG_IOMUX3 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_IOMUX3_CR_OFFSET) -#define MPFS_SYSREG_IOMUX4 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_IOMUX4_CR_OFFSET) - -#define MPFS_SYSREG_B2_CFG (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_CFG_CR) - -#define MPFS_SYSREG_B2_0_1 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_0_1_CR_OFFSET) -#define MPFS_SYSREG_B2_2_3 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_2_3_CR_OFFSET) -#define MPFS_SYSREG_B2_4_5 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_4_5_CR_OFFSET) -#define MPFS_SYSREG_B2_6_7 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_6_7_CR_OFFSET) -#define MPFS_SYSREG_B2_8_9 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_8_9_CR_OFFSET) -#define MPFS_SYSREG_B2_10_11 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_10_11_CR_OFFSET) -#define MPFS_SYSREG_B2_12_13 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_12_13_CR_OFFSET) -#define MPFS_SYSREG_B2_14_15 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_14_15_CR_OFFSET) -#define MPFS_SYSREG_B2_16_17 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_16_17_CR_OFFSET) -#define MPFS_SYSREG_B2_18_19 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_18_19_CR_OFFSET) -#define MPFS_SYSREG_B2_20_21 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_20_21_CR_OFFSET) -#define MPFS_SYSREG_B2_22_23 (MPFS_SYSREG_BASE + \ - MPFS_SYSREG_MSSIO_BANK2_IO_CFG_22_23_CR_OFFSET) - /* Reset and clock control registers */ #define MPFS_SYSREG_SOFT_RESET_CR (MPFS_SYSREG_BASE + \ @@ -3353,30 +3317,18 @@ static int mpfs_pullup(struct usbdev_s *dev, bool enable) static void mpfs_usb_iomux(void) { - putreg32(LIBERO_SETTING_IOMUX3_CR, MPFS_SYSREG_IOMUX3); - putreg32(LIBERO_SETTING_IOMUX4_CR, MPFS_SYSREG_IOMUX4); - - putreg32(LIBERO_SETTING_MSSIO_BANK2_CFG_CR, MPFS_SYSREG_B2_CFG); - - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_0_1_CR, MPFS_SYSREG_B2_0_1); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_2_3_CR, MPFS_SYSREG_B2_2_3); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_4_5_CR, MPFS_SYSREG_B2_4_5); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_6_7_CR, MPFS_SYSREG_B2_6_7); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_8_9_CR, MPFS_SYSREG_B2_8_9); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_10_11_CR, - MPFS_SYSREG_B2_10_11); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_12_13_CR, - MPFS_SYSREG_B2_12_13); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_14_15_CR, - MPFS_SYSREG_B2_14_15); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_16_17_CR, - MPFS_SYSREG_B2_16_17); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_18_19_CR, - MPFS_SYSREG_B2_18_19); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_20_21_CR, - MPFS_SYSREG_B2_20_21); - putreg32(LIBERO_SETTING_MSSIO_BANK2_IO_CFG_22_23_CR, - MPFS_SYSREG_B2_22_23); + mpfs_configgpio(MSSIO_USB_CLK); + mpfs_configgpio(MSSIO_USB_DIR); + mpfs_configgpio(MSSIO_USB_NXT); + mpfs_configgpio(MSSIO_USB_STP); + mpfs_configgpio(MSSIO_USB_DATA0); + mpfs_configgpio(MSSIO_USB_DATA1); + mpfs_configgpio(MSSIO_USB_DATA2); + mpfs_configgpio(MSSIO_USB_DATA3); + mpfs_configgpio(MSSIO_USB_DATA4); + mpfs_configgpio(MSSIO_USB_DATA5); + mpfs_configgpio(MSSIO_USB_DATA6); + mpfs_configgpio(MSSIO_USB_DATA7); #ifdef CONFIG_USBDEV_DMA /* DMA operations need to open the USB PMP registers for proper diff --git a/boards/risc-v/mpfs/icicle/include/board_liberodefs.h b/boards/risc-v/mpfs/icicle/include/board_liberodefs.h index d75d1cd9f6..e579195677 100644 --- a/boards/risc-v/mpfs/icicle/include/board_liberodefs.h +++ b/boards/risc-v/mpfs/icicle/include/board_liberodefs.h @@ -614,25 +614,4 @@ #define LIBERO_SETTING_L2_SHUTDOWN_CR 0x00000000 #define LIBERO_SETTING_WAY_ENABLE 0x0000000b -/* IOMUX3 and IOMUX4, 0x4 signifies USB */ - -#define LIBERO_SETTING_IOMUX3_CR 0x44444444 -#define LIBERO_SETTING_IOMUX4_CR 0x88cc4444 - -#define LIBERO_SETTING_MSSIO_BANK2_CFG_CR 0x00080907 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_0_1_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_2_3_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_4_5_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_6_7_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_8_9_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_10_11_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_12_13_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_14_15_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_16_17_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_18_19_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_20_21_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_22_23_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_VB2_CFG 0x00000828 -#define LIBERO_SETTING_MSSIO_VB4_CFG 0x00000828 - #endif /* __BOARDS_RISCV_MPFS_ICICLE_INCLUDE_BOARD_LIBERODEFS_H */ diff --git a/boards/risc-v/mpfs/m100pfsevp/include/board_liberodefs.h b/boards/risc-v/mpfs/m100pfsevp/include/board_liberodefs.h index 27eeb787fe..0d776674bb 100644 --- a/boards/risc-v/mpfs/m100pfsevp/include/board_liberodefs.h +++ b/boards/risc-v/mpfs/m100pfsevp/include/board_liberodefs.h @@ -610,25 +610,4 @@ #define LIBERO_SETTING_L2_SHUTDOWN_CR 0x00000000 #define LIBERO_SETTING_WAY_ENABLE 0x0000000b -/* IOMUX3 and IOMUX4, 0x4 signifies USB */ - -#define LIBERO_SETTING_IOMUX3_CR 0x44444444 -#define LIBERO_SETTING_IOMUX4_CR 0x88cc4444 - -#define LIBERO_SETTING_MSSIO_BANK2_CFG_CR 0x00080907 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_0_1_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_2_3_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_4_5_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_6_7_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_8_9_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_10_11_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_12_13_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_14_15_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_16_17_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_18_19_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_20_21_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_BANK2_IO_CFG_22_23_CR 0x08290829 -#define LIBERO_SETTING_MSSIO_VB2_CFG 0x00000828 -#define LIBERO_SETTING_MSSIO_VB4_CFG 0x00000828 - #endif /* __BOARDS_RISCV_MPFS_M100PFSEVP_INCLUDE_BOARD_LIBERODEFS_H */