mirror of
https://github.com/hardkernel/linux.git
synced 2026-04-10 15:08:06 +09:00
usb: dwc_otg: optimized grf and clk operation for rk336x board
Get grf offset form DT and optimize hclk_usb_peri clock process logic. Change-Id: I136970c7052e5d621fd10e5d2b90f0fdac620067 Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
This commit is contained in:
1
drivers/usb/dwc_otg_310/usbdev_rk.h
Executable file → Normal file
1
drivers/usb/dwc_otg_310/usbdev_rk.h
Executable file → Normal file
@@ -130,6 +130,7 @@ struct dwc_otg_control_usb {
|
||||
pGRF_SOC_STATUS19_RK3288 grf_soc_status19_rk3288;
|
||||
pGRF_SOC_STATUS21_RK3288 grf_soc_status21_rk3288;
|
||||
|
||||
u32 grf_otg_st_offset;
|
||||
struct regmap *grf;
|
||||
struct gpio *host_gpios;
|
||||
struct gpio *otg_gpios;
|
||||
|
||||
@@ -131,7 +131,7 @@ static void usb20otg_clock_enable(void *pdata, int enable)
|
||||
static int usb20otg_get_status(int id)
|
||||
{
|
||||
int ret = -1;
|
||||
u32 soc_status15 = uoc_read(0x4bc);
|
||||
u32 soc_status15 = uoc_read(control_usb->grf_otg_st_offset);
|
||||
|
||||
switch (id) {
|
||||
case USB_STATUS_BVABLID:
|
||||
@@ -402,6 +402,7 @@ static int dwc_otg_control_usb_probe(struct platform_device *pdev)
|
||||
struct clk *hclk_usb_peri;
|
||||
struct regmap *grf;
|
||||
int gpio, ret = 0;
|
||||
u32 offset;
|
||||
|
||||
control_usb = devm_kzalloc(dev, sizeof(*control_usb), GFP_KERNEL);
|
||||
if (!control_usb) {
|
||||
@@ -417,6 +418,14 @@ static int dwc_otg_control_usb_probe(struct platform_device *pdev)
|
||||
}
|
||||
control_usb->grf = grf;
|
||||
|
||||
/* get the reg offset of GRF_SOC_STATUS for USB2.0 OTG */
|
||||
if (of_property_read_u32(np, "grf-offset", &offset)) {
|
||||
dev_err(&pdev->dev, "missing reg property in node %s\n",
|
||||
np->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
control_usb->grf_otg_st_offset = offset;
|
||||
|
||||
/* Init Vbus-drv GPIOs */
|
||||
control_usb->host_gpios =
|
||||
devm_kzalloc(&pdev->dev, sizeof(struct gpio), GFP_KERNEL);
|
||||
@@ -466,8 +475,8 @@ static int dwc_otg_control_usb_probe(struct platform_device *pdev)
|
||||
/* Init hclk_usb_peri */
|
||||
hclk_usb_peri = devm_clk_get(&pdev->dev, "hclk_usb_peri");
|
||||
if (IS_ERR(hclk_usb_peri)) {
|
||||
dev_err(&pdev->dev, "Failed to get hclk_usb_peri\n");
|
||||
return PTR_ERR(hclk_usb_peri);
|
||||
dev_info(&pdev->dev, "no hclk_usb_peri clk specified\n");
|
||||
hclk_usb_peri = NULL;
|
||||
}
|
||||
control_usb->hclk_usb_peri = hclk_usb_peri;
|
||||
clk_prepare_enable(hclk_usb_peri);
|
||||
|
||||
Reference in New Issue
Block a user