Commit 3609699c authored by Ladislav Michl's avatar Ladislav Michl Committed by Greg Kroah-Hartman

usb: dwc3-am62: Rename private data

Rename dwc3_data to dwc3_am62 to make it consistent with other
glue drivers, it's clearer that this is am62's specific.
While there, do the same for data variable.
Signed-off-by: default avatarLadislav Michl <ladis@linux-mips.org>
Link: https://lore.kernel.org/r/ZLKoHhJvT+Y6aM+C@lenochSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 87ed257a
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
#define DWC3_AM62_AUTOSUSPEND_DELAY 100 #define DWC3_AM62_AUTOSUSPEND_DELAY 100
struct dwc3_data { struct dwc3_am62 {
struct device *dev; struct device *dev;
void __iomem *usbss; void __iomem *usbss;
struct clk *usb2_refclk; struct clk *usb2_refclk;
...@@ -129,19 +129,19 @@ static const int dwc3_ti_rate_table[] = { /* in KHZ */ ...@@ -129,19 +129,19 @@ static const int dwc3_ti_rate_table[] = { /* in KHZ */
52000, 52000,
}; };
static inline u32 dwc3_ti_readl(struct dwc3_data *data, u32 offset) static inline u32 dwc3_ti_readl(struct dwc3_am62 *am62, u32 offset)
{ {
return readl((data->usbss) + offset); return readl((am62->usbss) + offset);
} }
static inline void dwc3_ti_writel(struct dwc3_data *data, u32 offset, u32 value) static inline void dwc3_ti_writel(struct dwc3_am62 *am62, u32 offset, u32 value)
{ {
writel(value, (data->usbss) + offset); writel(value, (am62->usbss) + offset);
} }
static int phy_syscon_pll_refclk(struct dwc3_data *data) static int phy_syscon_pll_refclk(struct dwc3_am62 *am62)
{ {
struct device *dev = data->dev; struct device *dev = am62->dev;
struct device_node *node = dev->of_node; struct device_node *node = dev->of_node;
struct of_phandle_args args; struct of_phandle_args args;
struct regmap *syscon; struct regmap *syscon;
...@@ -153,16 +153,16 @@ static int phy_syscon_pll_refclk(struct dwc3_data *data) ...@@ -153,16 +153,16 @@ static int phy_syscon_pll_refclk(struct dwc3_data *data)
return PTR_ERR(syscon); return PTR_ERR(syscon);
} }
data->syscon = syscon; am62->syscon = syscon;
ret = of_parse_phandle_with_fixed_args(node, "ti,syscon-phy-pll-refclk", 1, ret = of_parse_phandle_with_fixed_args(node, "ti,syscon-phy-pll-refclk", 1,
0, &args); 0, &args);
if (ret) if (ret)
return ret; return ret;
data->offset = args.args[0]; am62->offset = args.args[0];
ret = regmap_update_bits(data->syscon, data->offset, PHY_PLL_REFCLK_MASK, data->rate_code); ret = regmap_update_bits(am62->syscon, am62->offset, PHY_PLL_REFCLK_MASK, am62->rate_code);
if (ret) { if (ret) {
dev_err(dev, "failed to set phy pll reference clock rate\n"); dev_err(dev, "failed to set phy pll reference clock rate\n");
return ret; return ret;
...@@ -175,32 +175,32 @@ static int dwc3_ti_probe(struct platform_device *pdev) ...@@ -175,32 +175,32 @@ static int dwc3_ti_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct dwc3_data *data; struct dwc3_am62 *am62;
int i, ret; int i, ret;
unsigned long rate; unsigned long rate;
u32 reg; u32 reg;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); am62 = devm_kzalloc(dev, sizeof(*am62), GFP_KERNEL);
if (!data) if (!am62)
return -ENOMEM; return -ENOMEM;
data->dev = dev; am62->dev = dev;
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, am62);
data->usbss = devm_platform_ioremap_resource(pdev, 0); am62->usbss = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(data->usbss)) { if (IS_ERR(am62->usbss)) {
dev_err(dev, "can't map IOMEM resource\n"); dev_err(dev, "can't map IOMEM resource\n");
return PTR_ERR(data->usbss); return PTR_ERR(am62->usbss);
} }
data->usb2_refclk = devm_clk_get(dev, "ref"); am62->usb2_refclk = devm_clk_get(dev, "ref");
if (IS_ERR(data->usb2_refclk)) { if (IS_ERR(am62->usb2_refclk)) {
dev_err(dev, "can't get usb2_refclk\n"); dev_err(dev, "can't get usb2_refclk\n");
return PTR_ERR(data->usb2_refclk); return PTR_ERR(am62->usb2_refclk);
} }
/* Calculate the rate code */ /* Calculate the rate code */
rate = clk_get_rate(data->usb2_refclk); rate = clk_get_rate(am62->usb2_refclk);
rate /= 1000; // To KHz rate /= 1000; // To KHz
for (i = 0; i < ARRAY_SIZE(dwc3_ti_rate_table); i++) { for (i = 0; i < ARRAY_SIZE(dwc3_ti_rate_table); i++) {
if (dwc3_ti_rate_table[i] == rate) if (dwc3_ti_rate_table[i] == rate)
...@@ -212,20 +212,20 @@ static int dwc3_ti_probe(struct platform_device *pdev) ...@@ -212,20 +212,20 @@ static int dwc3_ti_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
data->rate_code = i; am62->rate_code = i;
/* Read the syscon property and set the rate code */ /* Read the syscon property and set the rate code */
ret = phy_syscon_pll_refclk(data); ret = phy_syscon_pll_refclk(am62);
if (ret) if (ret)
return ret; return ret;
/* VBUS divider select */ /* VBUS divider select */
data->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider"); am62->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider");
reg = dwc3_ti_readl(data, USBSS_PHY_CONFIG); reg = dwc3_ti_readl(am62, USBSS_PHY_CONFIG);
if (data->vbus_divider) if (am62->vbus_divider)
reg |= 1 << USBSS_PHY_VBUS_SEL_SHIFT; reg |= 1 << USBSS_PHY_VBUS_SEL_SHIFT;
dwc3_ti_writel(data, USBSS_PHY_CONFIG, reg); dwc3_ti_writel(am62, USBSS_PHY_CONFIG, reg);
pm_runtime_set_active(dev); pm_runtime_set_active(dev);
pm_runtime_enable(dev); pm_runtime_enable(dev);
...@@ -233,7 +233,7 @@ static int dwc3_ti_probe(struct platform_device *pdev) ...@@ -233,7 +233,7 @@ static int dwc3_ti_probe(struct platform_device *pdev)
* Don't ignore its dependencies with its children * Don't ignore its dependencies with its children
*/ */
pm_suspend_ignore_children(dev, false); pm_suspend_ignore_children(dev, false);
clk_prepare_enable(data->usb2_refclk); clk_prepare_enable(am62->usb2_refclk);
pm_runtime_get_noresume(dev); pm_runtime_get_noresume(dev);
ret = of_platform_populate(node, NULL, NULL, dev); ret = of_platform_populate(node, NULL, NULL, dev);
...@@ -243,9 +243,9 @@ static int dwc3_ti_probe(struct platform_device *pdev) ...@@ -243,9 +243,9 @@ static int dwc3_ti_probe(struct platform_device *pdev)
} }
/* Set mode valid bit to indicate role is valid */ /* Set mode valid bit to indicate role is valid */
reg = dwc3_ti_readl(data, USBSS_MODE_CONTROL); reg = dwc3_ti_readl(am62, USBSS_MODE_CONTROL);
reg |= USBSS_MODE_VALID; reg |= USBSS_MODE_VALID;
dwc3_ti_writel(data, USBSS_MODE_CONTROL, reg); dwc3_ti_writel(am62, USBSS_MODE_CONTROL, reg);
/* Device has capability to wakeup system from sleep */ /* Device has capability to wakeup system from sleep */
device_set_wakeup_capable(dev, true); device_set_wakeup_capable(dev, true);
...@@ -261,7 +261,7 @@ static int dwc3_ti_probe(struct platform_device *pdev) ...@@ -261,7 +261,7 @@ static int dwc3_ti_probe(struct platform_device *pdev)
return 0; return 0;
err_pm_disable: err_pm_disable:
clk_disable_unprepare(data->usb2_refclk); clk_disable_unprepare(am62->usb2_refclk);
pm_runtime_disable(dev); pm_runtime_disable(dev);
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(dev);
return ret; return ret;
...@@ -278,18 +278,18 @@ static int dwc3_ti_remove_core(struct device *dev, void *c) ...@@ -278,18 +278,18 @@ static int dwc3_ti_remove_core(struct device *dev, void *c)
static void dwc3_ti_remove(struct platform_device *pdev) static void dwc3_ti_remove(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct dwc3_data *data = platform_get_drvdata(pdev); struct dwc3_am62 *am62 = platform_get_drvdata(pdev);
u32 reg; u32 reg;
device_for_each_child(dev, NULL, dwc3_ti_remove_core); device_for_each_child(dev, NULL, dwc3_ti_remove_core);
/* Clear mode valid bit */ /* Clear mode valid bit */
reg = dwc3_ti_readl(data, USBSS_MODE_CONTROL); reg = dwc3_ti_readl(am62, USBSS_MODE_CONTROL);
reg &= ~USBSS_MODE_VALID; reg &= ~USBSS_MODE_VALID;
dwc3_ti_writel(data, USBSS_MODE_CONTROL, reg); dwc3_ti_writel(am62, USBSS_MODE_CONTROL, reg);
pm_runtime_put_sync(dev); pm_runtime_put_sync(dev);
clk_disable_unprepare(data->usb2_refclk); clk_disable_unprepare(am62->usb2_refclk);
pm_runtime_disable(dev); pm_runtime_disable(dev);
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(dev);
...@@ -299,15 +299,15 @@ static void dwc3_ti_remove(struct platform_device *pdev) ...@@ -299,15 +299,15 @@ static void dwc3_ti_remove(struct platform_device *pdev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int dwc3_ti_suspend_common(struct device *dev) static int dwc3_ti_suspend_common(struct device *dev)
{ {
struct dwc3_data *data = dev_get_drvdata(dev); struct dwc3_am62 *am62 = dev_get_drvdata(dev);
u32 reg, current_prtcap_dir; u32 reg, current_prtcap_dir;
if (device_may_wakeup(dev)) { if (device_may_wakeup(dev)) {
reg = dwc3_ti_readl(data, USBSS_CORE_STAT); reg = dwc3_ti_readl(am62, USBSS_CORE_STAT);
current_prtcap_dir = (reg & USBSS_CORE_OPERATIONAL_MODE_MASK) current_prtcap_dir = (reg & USBSS_CORE_OPERATIONAL_MODE_MASK)
>> USBSS_CORE_OPERATIONAL_MODE_SHIFT; >> USBSS_CORE_OPERATIONAL_MODE_SHIFT;
/* Set wakeup config enable bits */ /* Set wakeup config enable bits */
reg = dwc3_ti_readl(data, USBSS_WAKEUP_CONFIG); reg = dwc3_ti_readl(am62, USBSS_WAKEUP_CONFIG);
if (current_prtcap_dir == DWC3_GCTL_PRTCAP_HOST) { if (current_prtcap_dir == DWC3_GCTL_PRTCAP_HOST) {
reg = USBSS_WAKEUP_CFG_LINESTATE_EN | USBSS_WAKEUP_CFG_OVERCURRENT_EN; reg = USBSS_WAKEUP_CFG_LINESTATE_EN | USBSS_WAKEUP_CFG_OVERCURRENT_EN;
} else { } else {
...@@ -317,30 +317,30 @@ static int dwc3_ti_suspend_common(struct device *dev) ...@@ -317,30 +317,30 @@ static int dwc3_ti_suspend_common(struct device *dev)
* and in U2/L3 state else it causes spurious wake-up. * and in U2/L3 state else it causes spurious wake-up.
*/ */
} }
dwc3_ti_writel(data, USBSS_WAKEUP_CONFIG, reg); dwc3_ti_writel(am62, USBSS_WAKEUP_CONFIG, reg);
/* clear wakeup status so we know what caused the wake up */ /* clear wakeup status so we know what caused the wake up */
dwc3_ti_writel(data, USBSS_WAKEUP_STAT, USBSS_WAKEUP_STAT_CLR); dwc3_ti_writel(am62, USBSS_WAKEUP_STAT, USBSS_WAKEUP_STAT_CLR);
} }
clk_disable_unprepare(data->usb2_refclk); clk_disable_unprepare(am62->usb2_refclk);
return 0; return 0;
} }
static int dwc3_ti_resume_common(struct device *dev) static int dwc3_ti_resume_common(struct device *dev)
{ {
struct dwc3_data *data = dev_get_drvdata(dev); struct dwc3_am62 *am62 = dev_get_drvdata(dev);
u32 reg; u32 reg;
clk_prepare_enable(data->usb2_refclk); clk_prepare_enable(am62->usb2_refclk);
if (device_may_wakeup(dev)) { if (device_may_wakeup(dev)) {
/* Clear wakeup config enable bits */ /* Clear wakeup config enable bits */
dwc3_ti_writel(data, USBSS_WAKEUP_CONFIG, USBSS_WAKEUP_CFG_NONE); dwc3_ti_writel(am62, USBSS_WAKEUP_CONFIG, USBSS_WAKEUP_CFG_NONE);
} }
reg = dwc3_ti_readl(data, USBSS_WAKEUP_STAT); reg = dwc3_ti_readl(am62, USBSS_WAKEUP_STAT);
data->wakeup_stat = reg; am62->wakeup_stat = reg;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment