void usb_phy_recover(void) { //usb phy initial sequence USB_PHY_Write_Register8(0x00, 0xFF); USB_PHY_Write_Register8(0x04, 0x61); USB_PHY_Write_Register8(0x00, 0x68); USB_PHY_Write_Register8(0x00, 0x6a); USB_PHY_Write_Register8(0x6e, 0x00); USB_PHY_Write_Register8(0x0c, 0x1b); USB_PHY_Write_Register8(0x44, 0x08); USB_PHY_Write_Register8(0x55, 0x11); USB_PHY_Write_Register8(0x68, 0x1a); USBPHY_CLR8(0x6a, 0xff); printk("[MUSB]addr: 0xFF, value: %x\n", USB_PHY_Read_Register8(0xFF)); printk("[MUSB]addr: 0x61, value: %x\n", USB_PHY_Read_Register8(0x61)); printk("[MUSB]addr: 0x68, value: %x\n", USB_PHY_Read_Register8(0x68)); printk("[MUSB]addr: 0x6a, value: %x\n", USB_PHY_Read_Register8(0x6a)); printk("[MUSB]addr: 0x00, value: %x\n", USB_PHY_Read_Register8(0x00)); printk("[MUSB]addr: 0x1b, value: %x\n", USB_PHY_Read_Register8(0x1b)); printk("[MUSB]addr: 0x08, value: %x\n", USB_PHY_Read_Register8(0x08)); printk("[MUSB]addr: 0x11, value: %x\n", USB_PHY_Read_Register8(0x11)); printk("[MUSB]addr: 0x1a, value: %x\n", USB_PHY_Read_Register8(0x1a)); printk("[MUSB]usb_phy_recover \n"); }
void usb_phy_switch_to_usb(void) { int var; /* Set RG_UART_EN to 0 */ var = USB_PHY_Read_Register8(0x6E); DBG(0, "[MUSB]addr: 0x6E, value: %x\n", var); USB_PHY_Write_Register8(var & ~0x01, 0x6E); DBG(0, "[MUSB]addr: 0x6E, value after: %x\n", USB_PHY_Read_Register8(0x6E)); /* Set RG_USB20_DM_100K_EN to 0 */ var = USB_PHY_Read_Register8(0x22); DBG(0, "[MUSB]addr: 0x22, value: %x\n", var); USB_PHY_Write_Register8(var & ~0x02, 0x22); DBG(0, "[MUSB]addr: 0x22, value after: %x\n", USB_PHY_Read_Register8(0x22)); var = DRV_Reg8(UART1_BASE + 0x90); DBG(0, "[MUSB]addr: 0x11002090 (UART1), value: %x\n", var); DRV_WriteReg8(UART1_BASE + 0x90, var & ~0x01); DBG(0, "[MUSB]addr: 0x11002090 (UART1), value after: %x\n\n", DRV_Reg8(UART1_BASE + 0x90)); #if 0 /* SW connect */ var = USB_PHY_Read_Register8(0x68); DBG(0, "[MUSB]addr: 0x68, value: %x\n", var); USB_PHY_Write_Register8(0x0, 0x68); DBG(0, "[MUSB]addr: 0x68, value after: %x\n", USB_PHY_Read_Register8(0x68)); var = USB_PHY_Read_Register8(0x6A); DBG(0, "[MUSB]addr: 0x6A, value: %x\n", var); USB_PHY_Write_Register8(0x0, 0x6A); DBG(0, "[MUSB]addr: 0x6A, value after: %x\n", USB_PHY_Read_Register8(0x6A)); /* SW connect */ #endif /* SW connect */ mt_usb_connect(); }
void usb_phy_switch_to_uart(void) { int var; #if 0 /* SW disconnect */ var = USB_PHY_Read_Register8(0x68); DBG(0, "[MUSB]addr: 0x68, value: %x\n", var); USB_PHY_Write_Register8(0x15, 0x68); DBG(0, "[MUSB]addr: 0x68, value after: %x\n", USB_PHY_Read_Register8(0x68)); var = USB_PHY_Read_Register8(0x6A); DBG(0, "[MUSB]addr: 0x6A, value: %x\n", var); USB_PHY_Write_Register8(0x0, 0x6A); DBG(0, "[MUSB]addr: 0x6A, value after: %x\n", USB_PHY_Read_Register8(0x6A)); /* SW disconnect */ #endif /* Set ru_uart_mode to 2'b01 */ var = USB_PHY_Read_Register8(0x6B); DBG(0, "[MUSB]addr: 0x6B, value: %x\n", var); USB_PHY_Write_Register8(var | 0x7C, 0x6B); DBG(0, "[MUSB]addr: 0x6B, value after: %x\n", USB_PHY_Read_Register8(0x6B)); /* Set RG_UART_EN to 1 */ var = USB_PHY_Read_Register8(0x6E); DBG(0, "[MUSB]addr: 0x6E, value: %x\n", var); USB_PHY_Write_Register8(var | 0x07, 0x6E); DBG(0, "[MUSB]addr: 0x6E, value after: %x\n", USB_PHY_Read_Register8(0x6E)); /* Set RG_USB20_DM_100K_EN to 1 */ var = USB_PHY_Read_Register8(0x22); DBG(0, "[MUSB]addr: 0x22, value: %x\n", var); USB_PHY_Write_Register8(var | 0x02, 0x22); DBG(0, "[MUSB]addr: 0x22, value after: %x\n", USB_PHY_Read_Register8(0x22)); var = DRV_Reg8(UART1_BASE + 0x90); DBG(0, "[MUSB]addr: 0x11002090 (UART1), value: %x\n", var); DRV_WriteReg8(UART1_BASE + 0x90, var | 0x01); DBG(0, "[MUSB]addr: 0x11002090 (UART1), value after: %x\n\n", DRV_Reg8(UART1_BASE + 0x90)); /* SW disconnect */ mt_usb_disconnect(); }
bool usb_phy_check_in_uart_mode(void) { UINT8 usb_port_mode; usb_enable_clock(true); udelay(50); usb_port_mode = USB_PHY_Read_Register8(0x6B); usb_enable_clock(false); if ((usb_port_mode == 0x5C) || (usb_port_mode == 0x5E)) return true; else return false; }
static int usb_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { printk("usb_i2c_probe, start\n"); usb_i2c_client = client; //disable usb mac suspend DRV_WriteReg8(0xF126086a, 0x00); //usb phy initial sequence USB_PHY_Write_Register8(0x00, 0xFF); USB_PHY_Write_Register8(0x04, 0x61); USB_PHY_Write_Register8(0x00, 0x68); USB_PHY_Write_Register8(0x00, 0x6a); USB_PHY_Write_Register8(0x6e, 0x00); USB_PHY_Write_Register8(0x0c, 0x1b); USB_PHY_Write_Register8(0x44, 0x08); USB_PHY_Write_Register8(0x55, 0x11); USB_PHY_Write_Register8(0x68, 0x1a); printk("addr: 0xFF, value: %x\n", USB_PHY_Read_Register8(0xFF)); printk("addr: 0x61, value: %x\n", USB_PHY_Read_Register8(0x61)); printk("addr: 0x68, value: %x\n", USB_PHY_Read_Register8(0x68)); printk("addr: 0x6a, value: %x\n", USB_PHY_Read_Register8(0x6a)); printk("addr: 0x00, value: %x\n", USB_PHY_Read_Register8(0x00)); printk("addr: 0x1b, value: %x\n", USB_PHY_Read_Register8(0x1b)); printk("addr: 0x08, value: %x\n", USB_PHY_Read_Register8(0x08)); printk("addr: 0x11, value: %x\n", USB_PHY_Read_Register8(0x11)); printk("addr: 0x1a, value: %x\n", USB_PHY_Read_Register8(0x1a)); printk("usb_i2c_probe, end\n"); return 0; }