mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
USB: Fix ehci bug and enable host and otg gpios to provide drv_vbus.
This commit is contained in:
@@ -849,8 +849,8 @@
|
||||
interrupt-names = "otg_id", "otg_bvalid",
|
||||
"otg_linestate", "host0_linestate",
|
||||
"host1_linestate";
|
||||
/*gpios = <&gpio0 GPIO_B6 GPIO_ACTIVE_LOW>,*//*HOST_VBUS_DRV*/
|
||||
/* <&gpio0 GPIO_B4 GPIO_ACTIVE_LOW>;*//*OTG_VBUS_DRV*/
|
||||
gpios = <&gpio0 GPIO_B6 GPIO_ACTIVE_LOW>,/*HOST_VBUS_DRV*/
|
||||
<&gpio0 GPIO_B4 GPIO_ACTIVE_LOW>;/*OTG_VBUS_DRV*/
|
||||
/*clocks = <&clk_gates7 9>;*/
|
||||
/*clock-names = "hclk_usb_peri";*/
|
||||
rockchip,remote_wakeup;
|
||||
@@ -887,27 +887,19 @@
|
||||
};
|
||||
|
||||
usb2: usb@ff500000 {
|
||||
compatible = "rockchip,rk3288_usbhs_host";
|
||||
reg = <0xff500000 0x40000>;
|
||||
compatible = "rockchip,rk3288_rk_ehci_host";
|
||||
reg = <0xff500000 0x20000>;
|
||||
interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
|
||||
/*clocks = <&clk_gates13 6>, <&clk_gates7 7>;*/
|
||||
/*clock-names = "clk_usbphy2", "hclk_usb2";*/
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
ranges;
|
||||
};
|
||||
|
||||
ehci: ehci@ff500000 {
|
||||
compatible = "rockchip,rk3288_rk_ehci_host";
|
||||
reg = <0xff500000 0x20000>;
|
||||
interrupt-parent = <&gic>;
|
||||
interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
|
||||
ohci: ohci@ff520000 {
|
||||
compatible = "rockchip,rk3288_rk_ohci_host";
|
||||
reg = <0xff520000 0x20000>;
|
||||
interrupt-parent = <&gic>;
|
||||
interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
usb3: usb@ff520000 {
|
||||
compatible = "rockchip,rk3288_rk_ohci_host";
|
||||
reg = <0xff520000 0x20000>;
|
||||
interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
|
||||
/*clocks = <&clk_gates13 6>, <&clk_gates7 7>;*/
|
||||
/*clock-names = "clk_usbphy3", "hclk_usb3";*/
|
||||
};
|
||||
|
||||
hsic: hsic@ff5c0000 {
|
||||
|
||||
@@ -19,9 +19,9 @@ static void usb20otg_hw_init(void)
|
||||
|
||||
/* other haredware init,include:
|
||||
* DRV_VBUS GPIO init */
|
||||
/*if(gpio_get_value(control_usb->otg_gpios->gpio)){
|
||||
if(gpio_get_value(control_usb->otg_gpios->gpio)){
|
||||
gpio_set_value(control_usb->otg_gpios->gpio, 0);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
static void usb20otg_phy_suspend(void* pdata, int suspend)
|
||||
@@ -130,12 +130,12 @@ static void dwc_otg_uart_mode(void* pdata, int enter_usb_uart_mode)
|
||||
#endif
|
||||
|
||||
static void usb20otg_power_enable(int enable)
|
||||
{ /*
|
||||
{
|
||||
if(0 == enable){//disable otg_drv power
|
||||
gpio_set_value(control_usb->otg_gpios->gpio, 0);
|
||||
}else if(1 == enable){//enable otg_drv power
|
||||
gpio_set_value(control_usb->otg_gpios->gpio, 1);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -167,9 +167,9 @@ static void usb20host_hw_init(void)
|
||||
|
||||
/* other haredware init,include:
|
||||
* DRV_VBUS GPIO init */
|
||||
/*if(!gpio_get_value(control_usb->host_gpios->gpio)){
|
||||
if(!gpio_get_value(control_usb->host_gpios->gpio)){
|
||||
gpio_set_value(control_usb->host_gpios->gpio, 1);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
static void usb20host_phy_suspend(void* pdata, int suspend)
|
||||
@@ -265,12 +265,12 @@ static int usb20host_get_status(int id)
|
||||
}
|
||||
|
||||
static void usb20host_power_enable(int enable)
|
||||
{ /*
|
||||
{
|
||||
if(0 == enable){//disable host_drv power
|
||||
//do not disable power in default
|
||||
}else if(1 == enable){//enable host_drv power
|
||||
gpio_set_value(control_usb->host_gpios->gpio, 1);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -393,9 +393,9 @@ static void rk_ehci_hw_init(void)
|
||||
/* usb phy config init */
|
||||
|
||||
/* DRV_VBUS GPIO init */
|
||||
/*if(!gpio_get_value(control_usb->host_gpios->gpio)){
|
||||
if(!gpio_get_value(control_usb->host_gpios->gpio)){
|
||||
gpio_set_value(control_usb->host_gpios->gpio, 1);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
static void rk_ehci_clock_init(void* pdata)
|
||||
@@ -404,13 +404,13 @@ static void rk_ehci_clock_init(void* pdata)
|
||||
struct rkehci_platform_data *usbpdata=pdata;
|
||||
struct clk* ahbclk,*phyclk;
|
||||
|
||||
ahbclk = of_clk_get_by_name(of_get_parent(usbpdata->dev.of_node), "hclk_usb2");
|
||||
ahbclk = devm_clk_get(usbpdata->dev, "hclk_usb2");
|
||||
if (IS_ERR(ahbclk)) {
|
||||
dev_err(usbpdata->dev, "Failed to get hclk_usb2\n");
|
||||
return;
|
||||
}
|
||||
|
||||
phyclk = of_clk_get_by_name(of_get_parent(usbpdata->dev.of_node), "clk_usbphy2");
|
||||
phyclk = devm_clk_get(usbpdata->dev, "clk_usbphy2");
|
||||
if (IS_ERR(phyclk)) {
|
||||
dev_err(usbpdata->dev, "Failed to get clk_usbphy2\n");
|
||||
return;
|
||||
@@ -462,9 +462,9 @@ static void rk_ohci_hw_init(void)
|
||||
/* usb phy config init */
|
||||
|
||||
/* DRV_VBUS GPIO init */
|
||||
/*if(!gpio_get_value(control_usb->host_gpios->gpio)){
|
||||
if(!gpio_get_value(control_usb->host_gpios->gpio)){
|
||||
gpio_set_value(control_usb->host_gpios->gpio, 1);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
static void rk_ohci_clock_init(void* pdata)
|
||||
@@ -473,15 +473,15 @@ static void rk_ohci_clock_init(void* pdata)
|
||||
struct rkehci_platform_data *usbpdata=pdata;
|
||||
struct clk* ahbclk,*phyclk;
|
||||
|
||||
ahbclk = of_clk_get_by_name(of_get_parent(usbpdata->dev.of_node), "hclk_usb2");
|
||||
ahbclk =devm_clk_get(usbpdata->dev, "hclk_usb3");
|
||||
if (IS_ERR(ahbclk)) {
|
||||
dev_err(usbpdata->dev, "Failed to get hclk_usb2\n");
|
||||
dev_err(usbpdata->dev, "Failed to get hclk_usb3\n");
|
||||
return;
|
||||
}
|
||||
|
||||
phyclk = of_clk_get_by_name(of_get_parent(usbpdata->dev.of_node), "clk_usbphy2");
|
||||
phyclk = devm_clk_get(usbpdata->dev, "clk_usbphy3");;
|
||||
if (IS_ERR(phyclk)) {
|
||||
dev_err(usbpdata->dev, "Failed to get clk_usbphy2\n");
|
||||
dev_err(usbpdata->dev, "Failed to get clk_usbphy3\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -845,7 +845,7 @@ static int dwc_otg_control_usb_probe(struct platform_device *pdev)
|
||||
dev_err(&pdev->dev, "Failed to ioremap usb grf\n");
|
||||
goto err2;
|
||||
}
|
||||
/*
|
||||
|
||||
control_usb->host_gpios = devm_kzalloc(&pdev->dev, sizeof(struct gpio), GFP_KERNEL);
|
||||
if(!control_usb->host_gpios){
|
||||
dev_err(&pdev->dev, "unable to alloc memory for host_gpios\n");
|
||||
@@ -893,7 +893,7 @@ static int dwc_otg_control_usb_probe(struct platform_device *pdev)
|
||||
goto err2;
|
||||
}
|
||||
gpio_direction_output(control_usb->otg_gpios->gpio, 0);
|
||||
*/
|
||||
|
||||
/* disable for debug
|
||||
ret = otg_irq_detect_init(pdev);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -139,9 +139,9 @@ static ssize_t ehci_power_store( struct device *_dev,
|
||||
pldata->soft_reset();
|
||||
usb_add_hcd(hcd, hcd->irq, IRQF_DISABLED | IRQF_SHARED);
|
||||
ehci_port_power(ehci, 1);
|
||||
writel_relaxed(0x1d4d ,hcd->regs +0x90);
|
||||
writel_relaxed(0x4 ,hcd->regs +0xa0);
|
||||
dsb();
|
||||
// writel_relaxed(0x1d4d ,hcd->regs +0x90);
|
||||
// writel_relaxed(0x4 ,hcd->regs +0xa0);
|
||||
// dsb();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -290,9 +290,9 @@ static int ehci_rk_probe(struct platform_device *pdev)
|
||||
|
||||
g_ehci = ehci;
|
||||
ehci_port_power(ehci, 1);
|
||||
writel_relaxed(0x1d4d ,hcd->regs +0x90);
|
||||
writel_relaxed(0x4 ,hcd->regs +0xa0);
|
||||
dsb();
|
||||
// writel_relaxed(0x1d4d ,hcd->regs +0x90);
|
||||
// writel_relaxed(0x4 ,hcd->regs +0xa0);
|
||||
// dsb();
|
||||
|
||||
printk("%s ok\n", __func__);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user