Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arch/risc-v/src/mpfs: Set USB DMA upper addr offset #154

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions arch/risc-v/src/mpfs/hardware/mpfs_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@
#define MPFS_USB_C_T_HHSRTN_OFFSET 0x346
#define MPFS_USB_C_T_HSBT_OFFSET 0x348

#define MPFS_USB_DMA_ADDR_UPPER_REG_OFFSET 0x3FC

#define MPFS_USB_POWER (MPFS_USB_BASE + MPFS_USB_POWER_OFFSET)
#define MPFS_USB_POWER_ENABLE_SUSPENDM (1 << 0)
#define MPFS_USB_POWER_SUSPEND_MODE (1 << 1)
Expand Down Expand Up @@ -175,6 +177,12 @@
#define MPFS_USB_RX_DPBUF_DIS (MPFS_USB_BASE + MPFS_USB_RX_DPBUF_DIS_OFFSET)
#define MPFS_USB_TX_DPBUF_DIS (MPFS_USB_BASE + MPFS_USB_TX_DPBUF_DIS_OFFSET)

/* MPFS_USB_DMA_ADDR_UPPER_REG is used to set the upper 6-bits of
* the Address bus for USB DMA operations.
*/

#define MPFS_USB_DMA_ADDR_UPPER_REG (MPFS_USB_BASE + MPFS_USB_DMA_ADDR_UPPER_REG_OFFSET)

#define MPFS_USB_DMA_CHANNEL(n) (MPFS_USB_BASE + MPFS_USB_DMA_CHANNEL_OFFSET + MPFS_USB_DMA_CHANNEL_SIZE * n)

/****************************************************************************
Expand Down
8 changes: 8 additions & 0 deletions arch/risc-v/src/mpfs/mpfs_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@
# define MSB 1
#endif

#ifndef MPFS_USB_DMA_ADDR_UPPER_OFFSET
# define MPFS_USB_DMA_ADDR_UPPER_OFFSET 0x14u
jpaali marked this conversation as resolved.
Show resolved Hide resolved
#endif

#define MPFS_NUM_USB_PKT 1
#define MPFS_MIN_EP_FIFO_SIZE 8
#define MPFS_USB_REG_MAX 0x2000
Expand Down Expand Up @@ -3685,6 +3689,10 @@ static void mpfs_hw_setup(struct mpfs_usbdev_s *priv)
modifyreg32(MPFS_SYSREG_SOFT_RESET_CR, SYSREG_SOFT_RESET_CR_USB |
SYSREG_SOFT_RESET_CR_FPGA, 0);

/* Set USB upper address offset to enable USB DMA support for himen */

mpfs_putreg32(MPFS_USB_DMA_ADDR_UPPER_OFFSET, MPFS_USB_DMA_ADDR_UPPER_REG);

/* Reset the controller */

mpfs_putreg8(SOFT_RESET_REG_MASK, MPFS_USB_SOFT_RST);
Expand Down
2 changes: 2 additions & 0 deletions boards/risc-v/mpfs/icicle/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
# define MPFS_SD_CLOCK_4BIT MPFS_MMC_CLOCK_25MHZ
jpaali marked this conversation as resolved.
Show resolved Hide resolved
#endif

#define MPFS_USB_DMA_ADDR_UPPER_OFFSET 0x14u

/* Clocking TODO: */

#define MPFS_MSS_EXT_SGMII_REF_CLK (125000000UL)
Expand Down