/*clock-names = "clk_usbphy1", "hclk_usb1";*/
};
- usb2: usb@ff520000 {
- compatible = "rockchip,rk3288_rk_ohci_host";
- reg = <0xff520000 0x20000>;
- interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
+ usb2: usb@ff500000 {
+ compatible = "rockchip,rk3288_usbhs_host";
+ reg = <0xff500000 0x40000>;
/*clocks = <&clk_gates13 6>, <&clk_gates7 7>;*/
/*clock-names = "clk_usbphy2", "hclk_usb2";*/
- };
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
- usb3: usb@ff500000 {
- 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_usbphy3", "hclk_usb3";*/
+ 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>;
+ };
};
hsic: hsic@ff5c0000 {
/* other haredware init,include:
* DRV_VBUS GPIO init */
- gpio_direction_output(control_usb->otg_gpios->gpio, 0);
+ 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)
/* other haredware init,include:
* DRV_VBUS GPIO init */
- gpio_direction_output(control_usb->host_gpios->gpio, 1);
-
+ 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)
goto err2;
}
+ /* init host gpio */
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");
+ ret = -ENOMEM;
+ goto err2;
+ }
gpio = of_get_named_gpio(np, "gpios", 0);
if(!gpio_is_valid(gpio)){
ret = -EINVAL;
goto err2;
}
+
control_usb->host_gpios->gpio = gpio;
+
err = devm_gpio_request(&pdev->dev, gpio, "host_drv_gpio");
if (err) {
dev_err(&pdev->dev,
ret = err;
goto err2;
}
+ gpio_direction_output(control_usb->host_gpios->gpio, 1);
+ /* init otg gpio */
control_usb->otg_gpios = devm_kzalloc(&pdev->dev, sizeof(struct gpio), GFP_KERNEL);
+ if(!control_usb->otg_gpios){
+ dev_err(&pdev->dev, "unable to alloc memory for otg_gpios\n");
+ ret = -ENOMEM;
+ goto err2;
+ }
gpio = of_get_named_gpio(np, "gpios", 1);
if(!gpio_is_valid(gpio)){
ret = err;
goto err2;
}
+ gpio_direction_output(control_usb->otg_gpios->gpio, 0);
+
ret = otg_irq_detect_init(pdev);
if (ret < 0)
goto err2;
/* other haredware init,include:
* DRV_VBUS GPIO init */
-// gpio_direction_output(control_usb->otg_gpios->gpio, 0);
-
+ /*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)
/* other haredware init,include:
* DRV_VBUS GPIO init */
-// gpio_direction_output(control_usb->host_gpios->gpio, 1);
+ /*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)
#ifdef CONFIG_USB_EHCI_RK
static void rk_ehci_hw_init(void)
{
+ /* usb phy config init */
+ /* DRV_VBUS GPIO init */
+ /*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)
{
+/*
+ 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");
+ 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");
+ if (IS_ERR(phyclk)) {
+ dev_err(usbpdata->dev, "Failed to get clk_usbphy2\n");
+ return;
+ }
+ usbpdata->phyclk = phyclk;
+ usbpdata->ahbclk = ahbclk;
+*/
}
static void rk_ehci_clock_enable(void* pdata, int enable)
{
+/*
+ struct rkehci_platform_data *usbpdata=pdata;
+ if(enable == usbpdata->clk_status)
+ return;
+ if(enable){
+ clk_prepare_enable(usbpdata->ahbclk);
+ clk_prepare_enable(usbpdata->phyclk);
+ usbpdata->clk_status = 1;
+ }else{
+ clk_disable_unprepare(usbpdata->ahbclk);
+ clk_disable_unprepare(usbpdata->phyclk);
+ usbpdata->clk_status = 0;
+ }
+*/
}
static void rk_ehci_soft_reset(void)
#ifdef CONFIG_USB_OHCI_HCD_RK
static void rk_ohci_hw_init(void)
{
+ /* usb phy config init */
+
+ /* DRV_VBUS GPIO init */
+ /*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)
{
+/*
+ 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");
+ 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");
+ if (IS_ERR(phyclk)) {
+ dev_err(usbpdata->dev, "Failed to get clk_usbphy2\n");
+ return;
+ }
+
+ usbpdata->phyclk = phyclk;
+ usbpdata->ahbclk = ahbclk;
+*/
}
static void rk_ohci_clock_enable(void* pdata, int enable)
{
+/*
+ struct rkehci_platform_data *usbpdata=pdata;
+
+ if(enable == usbpdata->clk_status)
+ return;
+ if(enable){
+ clk_prepare_enable(usbpdata->ahbclk);
+ clk_prepare_enable(usbpdata->phyclk);
+ usbpdata->clk_status = 1;
+ }else{
+ clk_disable_unprepare(usbpdata->ahbclk);
+ clk_disable_unprepare(usbpdata->phyclk);
+ usbpdata->clk_status = 0;
+ }
+*/
}
static void rk_ohci_soft_reset(void)
}
/*
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");
+ ret = -ENOMEM;
+ goto err2;
+ }
gpio = of_get_named_gpio(np, "gpios", 0);
if(!gpio_is_valid(gpio)){
ret = err;
goto err2;
}
+ gpio_direction_output(control_usb->host_gpios->gpio, 1);
control_usb->otg_gpios = devm_kzalloc(&pdev->dev, sizeof(struct gpio), GFP_KERNEL);
+ if(!control_usb->otg_gpios){
+ dev_err(&pdev->dev, "unable to alloc memory for otg_gpios\n");
+ ret = -ENOMEM;
+ goto err2;
+ }
gpio = of_get_named_gpio(np, "gpios", 1);
if(!gpio_is_valid(gpio)){
ret = err;
goto err2;
}
+ gpio_direction_output(control_usb->otg_gpios->gpio, 0);
*/
/* disable for debug
ret = otg_irq_detect_init(pdev);