usb: add usb otg driver support for g12a

PD#156734: usb: add usb otg driver support for g12a

Change-Id: I1af8d290568bca947a6612f31cef3b640c7cd927
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
This commit is contained in:
Yue Wang
2018-02-03 14:34:18 +08:00
committed by Yixun Lan
parent 8bbcb53bd6
commit db6ee12c58
3 changed files with 30 additions and 5 deletions

View File

@@ -511,10 +511,14 @@
reg = <0x0 0xffe09080 0x0 0x20>;
phy-reg = <0xff646000>;
phy-reg-size = <0x4>;
usb2-phy-reg = <0xffe09000>;
usb2-phy-reg-size = <0x80>;
interrupts = <0 16 4>;
otg = <0>;
otg = <1>;
clocks = <&clkc CLKID_PCIE_PLL>;
clock-names = "pcie_refpll";
gpio-vbus-power = "GPIOH_6";
gpios = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
};
dwc2_a {
@@ -535,7 +539,7 @@
usb-fifo = <728>;
cpu-type = "v2";
/** 0: normal, 1: otg+dwc3 host only, 2: otg+dwc3 device only*/
controller-type = <1>;
controller-type = <3>;
phy-reg = <0xffe09000>;
phy-reg-size = <0xa0>;
/** phy-interface: 0x0: amlogic phy, 0x1: synopsys phy **/

View File

@@ -106,8 +106,8 @@ static void amlogic_new_usb3phy_shutdown(struct usb_phy *x)
void aml_new_usb_v2_init(void)
{
union usb_r5_v2 r5 = {.d32 = 0};
unsigned long reg_addr = ((unsigned long)
usb_new_aml_regs_v2.usb_r_v2[0] - 0x80);
unsigned long reg_addr = (unsigned long)
g_phy_v2->usb2_phy_cfg;
r5.d32 = readl(usb_new_aml_regs_v2.usb_r_v2[5]);
if (r5.b.iddig_curr == 0) {
@@ -223,7 +223,7 @@ static void amlogic_gxl_work(struct work_struct *work)
struct amlogic_usb_v2 *phy =
container_of(work, struct amlogic_usb_v2, work.work);
union usb_r5_v2 r5 = {.d32 = 0};
unsigned long reg_addr = ((unsigned long)phy->regs - 0x80);
unsigned long reg_addr = ((unsigned long)phy->usb2_phy_cfg);
r5.d32 = readl(usb_new_aml_regs_v2.usb_r_v2[5]);
if (r5.b.iddig_curr == 0) {
@@ -282,6 +282,9 @@ static int amlogic_new_usb3_v2_probe(struct platform_device *pdev)
void __iomem *phy3_base;
unsigned int phy3_mem;
unsigned int phy3_mem_size = 0;
void __iomem *usb2_phy_base;
unsigned int usb2_phy_mem;
unsigned int usb2_phy_mem_size = 0;
const char *gpio_name = NULL;
struct gpio_desc *usb_gd = NULL;
const void *prop;
@@ -342,6 +345,22 @@ static int amlogic_new_usb3_v2_probe(struct platform_device *pdev)
if (!phy3_base)
return -ENOMEM;
retval = of_property_read_u32
(dev->of_node, "usb2-phy-reg", &usb2_phy_mem);
if (retval < 0)
return -EINVAL;
retval = of_property_read_u32
(dev->of_node, "usb2-phy-reg-size", &usb2_phy_mem_size);
if (retval < 0)
return -EINVAL;
usb2_phy_base = devm_ioremap_nocache
(&(pdev->dev), (resource_size_t)usb2_phy_mem,
(unsigned long)usb2_phy_mem_size);
if (!usb2_phy_base)
return -ENOMEM;
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
if (!phy)
return -ENOMEM;
@@ -367,6 +386,7 @@ static int amlogic_new_usb3_v2_probe(struct platform_device *pdev)
phy->dev = dev;
phy->regs = phy_base;
phy->phy3_cfg = phy3_base;
phy->usb2_phy_cfg = usb2_phy_base;
phy->portnum = portnum;
phy->suspend_flag = 0;
phy->phy.dev = phy->dev;

View File

@@ -164,6 +164,7 @@ struct amlogic_usb_v2 {
void __iomem *reset_regs;
void __iomem *phy_cfg[4];
void __iomem *phy3_cfg;
void __iomem *usb2_phy_cfg;
/* Set VBus Power though GPIO */
int vbus_power_pin;
int vbus_power_pin_work_mask;