1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef __USBPHY_H__ 5 #define __USBPHY_H__ 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 #include "plat_types.h" 12 #include "plat_addr_map.h" 13 #include CHIP_SPECIFIC_HDR(usbphy) 14 #include "hal_analogif.h" 15 #include "hal_phyif.h" 16 17 #ifdef SPIPHY_USB_REG 18 #define SPI_USBPHY_REG(reg) SPIPHY_USB_REG(reg) 19 #elif defined(ISPI_USBPHY_REG) 20 #define SPI_USBPHY_REG(reg) ISPI_USBPHY_REG(reg) 21 #else 22 #define SPI_USBPHY_REG(reg) (reg) 23 #endif 24 25 #ifdef CHIP_HAS_SPIPHY 26 #define usbphy_read(reg, val) hal_phyif_reg_read(SPI_USBPHY_REG(reg), val) 27 #define usbphy_write(reg, val) hal_phyif_reg_write(SPI_USBPHY_REG(reg), val) 28 #else 29 #define usbphy_read(reg, val) hal_analogif_reg_read(SPI_USBPHY_REG(reg), val) 30 #define usbphy_write(reg, val) hal_analogif_reg_write(SPI_USBPHY_REG(reg), val) 31 #endif 32 33 void usbphy_open(void); 34 35 void usbphy_close(void); 36 37 void usbphy_sleep(void); 38 39 void usbphy_wakeup(void); 40 41 #ifdef __cplusplus 42 } 43 #endif 44 45 #endif 46 47