From c9838c216160d8a102d49dfcdec08ecb988e266d Mon Sep 17 00:00:00 2001 From: songyanguang <345810377@qq.com> Date: Tue, 3 Sep 2024 16:26:48 +0800 Subject: [PATCH] Modify usb_check_phymode --- .../services/drivers/usb/usb_service/usb_host.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/usb_service/usb_host.c b/Ubiquitous/XiZi_AIoT/services/drivers/usb/usb_service/usb_host.c index 9939dcb78..d4e28569d 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/usb_service/usb_host.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/usb_service/usb_host.c @@ -82,10 +82,12 @@ static void usb_check_phymode(int id) #define PIPE_PHY_GRF0 0xFDC70000 #define PIPE_PHY_GRF1 0xFDC80000 #define PIPE_PHY_GRF_PIPE_CON0 0x00 +#define PIPE_PHY_GRF_PIPE_CON3 0x0C #define PIPE_PHY_GRF_VIRADDR_BASE 0x0000002100000000ULL void *base = (void *)PIPE_PHY_GRF0; void *base_vir = (void *)PIPE_PHY_GRF_VIRADDR_BASE; - uint32_t pipe_phymode; + uint32_t con0; + uint32_t con3; if (USB3_0_ID == id) { base = (void *)PIPE_PHY_GRF0; @@ -98,10 +100,11 @@ static void usb_check_phymode(int id) USB_LOG_ERR("usb_check_phy mmap fail\n"); } - pipe_phymode = readl ( base_vir + PIPE_PHY_GRF_PIPE_CON0 ); - USB_LOG_DBG("usb_check_phy PIPE_PHY_GRF_PIPE_CON0=%08X\n", pipe_phymode); - if ( (pipe_phymode & 0x000C) != 0x0004) { - USB_LOG_ERR("usb_check_phy PIPE_PHY_GRF_PIPE_CON0=%08X is not USB3 mode\n", pipe_phymode); + con0 = readl ( base_vir + PIPE_PHY_GRF_PIPE_CON0 ); + con3 = readl ( base_vir + PIPE_PHY_GRF_PIPE_CON3 ); + USB_LOG_DBG("usb_check_phy PIPE_PHY_GRF_PIPE_CON0=%08X PIPE_PHY_GRF_PIPE_CON3=%08X\n", con0, con3); + if ( !( (con0 & 0x000C) == 0x0004 && (con3 & 0x8000) == 0) ) { + USB_LOG_ERR("usb_check_phy PIPE_PHY_GRF_PIPE_CON0=%08X and CON3=%08X is not USB3 mode\n", con0, con3); } }