void *req_handle);
extern void do_test_mode(void *data);
+extern int aml_new_usb_get_mode(void);
#ifdef CONFIG_AMLOGIC_USB3PHY
extern void set_usb_phy_device_tuning(int port, int default_val);
#endif
#ifdef CONFIG_AMLOGIC_USB3PHY
if (GET_CORE_IF(pcd)->phy_interface != 1) {
- speed = get_device_speed(GET_CORE_IF(pcd));
- if (speed != USB_SPEED_HIGH) {
- gintsts.d32 = 0;
- gintsts.b.enumdone = 1;
- DWC_WRITE_REG32(&GET_CORE_IF(pcd)->
- core_global_regs->gintsts, gintsts.d32);
- DWC_DEBUGPL(DBG_PCD, "false speed emun\n");
- return 1;
+ if (GET_CORE_IF(pcd)->controller_type == USB_OTG) {
+ speed = get_device_speed(GET_CORE_IF(pcd));
+ if ((speed != USB_SPEED_HIGH) &&
+ (aml_new_usb_get_mode() != 1)) {
+ gintsts.d32 = 0;
+ gintsts.b.enumdone = 1;
+ DWC_WRITE_REG32(&GET_CORE_IF(pcd)->
+ core_global_regs->gintsts, gintsts.d32);
+ DWC_DEBUGPL(DBG_PCD, "false speed emun\n");
+ return 1;
+ }
}
set_usb_phy_device_tuning(1, 0);
- }
+}
#endif
if (GET_CORE_IF(pcd)->snpsid >= OTG_CORE_REV_2_60a) {
}
break;
} else {
- *status = 0x1; /* Self powered */
+ *status = 0x0; /* bus powered */
+ //*status = 0x1; /* Self powered */
*status |= pcd->remote_wakeup_enable << 1;
break;
}
if (!g_phy2_v2)
return;
- if (g_phy2_v2->phy_version == 1)
+ if (g_phy2_v2->phy_version)
return;
if (port > g_phy2_v2->portnum)
if (!g_phy2_v2)
return;
- if (g_phy2_v2->phy_version == 1)
+ if (g_phy2_v2->phy_version)
return;
if (port > g_phy2_v2->portnum)
g_phy2_v2->phy_cfg_state[port] = default_val;
}
-
void set_usb_pll(struct amlogic_usb_v2 *phy, void __iomem *reg)
{
/* TO DO set usb PLL */
writel((0x10000000 | (phy->pll_setting[0])), reg + 0x40);
/* PHY Tune */
- writel(phy->pll_setting[3], reg + 0x50);
- writel(phy->pll_setting[4], reg + 0x10);
- /* Recovery analog status */
- writel(0, reg + 0x38);
- writel(phy->pll_setting[5], reg + 0x34);
+ if (g_phy2_v2) {
+ if (g_phy2_v2->phy_version == 2) {
+ /**g12b revB don't need set 0x10 ,0x38 and 0x34**/
+ writel(phy->pll_setting[3], reg + 0x50);
+ writel(0x70000, reg + 0x34);
+ } else {
+ writel(phy->pll_setting[3], reg + 0x50);
+ writel(phy->pll_setting[4], reg + 0x10);
+ writel(0, reg + 0x38);
+ writel(phy->pll_setting[5], reg + 0x34);
+ }
+ } else {
+ writel(phy->pll_setting[3], reg + 0x50);
+ writel(phy->pll_setting[4], reg + 0x10);
+ writel(0, reg + 0x38);
+ writel(phy->pll_setting[5], reg + 0x34);
+ }
writel(TUNING_DISCONNECT_THRESHOLD, reg + 0xC);
}
if (is_meson_g12b_cpu()) {
if (!is_meson_rev_a())
- phy_version = 1;
+ phy_version = 2;
}
phy_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
}
EXPORT_SYMBOL(aml_new_usb_v2_init);
+int aml_new_usb_get_mode(void)
+{
+ union usb_r5_v2 r5 = {.d32 = 0};
+
+ r5.d32 = readl(usb_new_aml_regs_v2.usb_r_v2[5]);
+ if (r5.b.iddig_curr == 0)
+ return 0;
+ else
+ return 1;
+}
+EXPORT_SYMBOL(aml_new_usb_get_mode);
+
+
static void cr_bus_addr(unsigned int addr)
{
union phy3_r4 phy_r4 = {.d32 = 0};
device_enable_async_suspend(&intf->dev);
ret = device_add(&intf->dev);
#ifdef CONFIG_AMLOGIC_USB
- if (((&intf->dev)->driver) == NULL)
- dev_err(&dev->dev, "Unsupported device\n");
+ if (((&intf->dev)->driver) == NULL) {
+ if (intf->cur_altsetting->desc.bInterfaceClass == 0x09)
+ dev_err(&dev->dev, "Unsupported the hub\n");
+ else
+ dev_err(&dev->dev, "Unsupported device\n");
+ }
#endif
if (ret != 0) {
dev_err(&dev->dev, "device_add(%s) --> %d\n",