mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
- Add imx7ulp support.
- Some tiny improvements, no function change. -----BEGIN PGP SIGNATURE----- iQEcBAABCAAGBQJdHrMsAAoJEEhZKYFQ1nG7jE0IAJXwiUh8Dd3IUkik8Nft3jGw wPkiYfs9LGyQ6sJ8l4TxrbVvsnEs0n9dsExXP03MK6ow6Mqen5lHsa0VHkPeZX4C +NyviJEH3BiY7jcWvhj8Sdp2/DBfulWPMTGZLncyNdinWGTrNQKzcDd7jzvp4Y1x ZZSly0E0m5uU7ZP1QOw+/142+Mi+ia9bKl+xqkeKTwsaykYaYstfuVrpabFJ50FL k8K1q0DCnF6G7aCGTBuVm0coe68TUcWIgl94BoZK6cSxEA4mJRU/VITYbR44dkBN wHBJKIZzie4jAKLVXuRWix1eMiIDkeS9qKRGnc72hrF3eADlaikk9fwWLOQFjLk= =hzIY -----END PGP SIGNATURE----- Merge tag 'usb-ci-v5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next - Add imx7ulp support. - Some tiny improvements, no function change. * tag 'usb-ci-v5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb: usb: chipidea: msm: Use devm_platform_ioremap_resource() usb: chipidea: imx: Use devm_platform_ioremap_resource() usb: chipidea: Use dev_err() instead of pr_err() usb: chipidea: imx: "fsl,usbphy" phandle is not mandatory now usb: chipidea: imx: add imx7ulp support
This commit is contained in:
commit
2bc8bb813c
5 changed files with 40 additions and 11 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <linux/usb/of.h>
|
#include <linux/usb/of.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/pinctrl/consumer.h>
|
#include <linux/pinctrl/consumer.h>
|
||||||
|
#include <linux/pm_qos.h>
|
||||||
|
|
||||||
#include "ci.h"
|
#include "ci.h"
|
||||||
#include "ci_hdrc_imx.h"
|
#include "ci_hdrc_imx.h"
|
||||||
|
@ -63,6 +64,11 @@ static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = {
|
||||||
.flags = CI_HDRC_SUPPORTS_RUNTIME_PM,
|
.flags = CI_HDRC_SUPPORTS_RUNTIME_PM,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct ci_hdrc_imx_platform_flag imx7ulp_usb_data = {
|
||||||
|
.flags = CI_HDRC_SUPPORTS_RUNTIME_PM |
|
||||||
|
CI_HDRC_PMQOS,
|
||||||
|
};
|
||||||
|
|
||||||
static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
|
static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
|
||||||
{ .compatible = "fsl,imx23-usb", .data = &imx23_usb_data},
|
{ .compatible = "fsl,imx23-usb", .data = &imx23_usb_data},
|
||||||
{ .compatible = "fsl,imx28-usb", .data = &imx28_usb_data},
|
{ .compatible = "fsl,imx28-usb", .data = &imx28_usb_data},
|
||||||
|
@ -72,6 +78,7 @@ static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
|
||||||
{ .compatible = "fsl,imx6sx-usb", .data = &imx6sx_usb_data},
|
{ .compatible = "fsl,imx6sx-usb", .data = &imx6sx_usb_data},
|
||||||
{ .compatible = "fsl,imx6ul-usb", .data = &imx6ul_usb_data},
|
{ .compatible = "fsl,imx6ul-usb", .data = &imx6ul_usb_data},
|
||||||
{ .compatible = "fsl,imx7d-usb", .data = &imx7d_usb_data},
|
{ .compatible = "fsl,imx7d-usb", .data = &imx7d_usb_data},
|
||||||
|
{ .compatible = "fsl,imx7ulp-usb", .data = &imx7ulp_usb_data},
|
||||||
{ /* sentinel */ }
|
{ /* sentinel */ }
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids);
|
MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids);
|
||||||
|
@ -93,6 +100,8 @@ struct ci_hdrc_imx_data {
|
||||||
struct clk *clk_ahb;
|
struct clk *clk_ahb;
|
||||||
struct clk *clk_per;
|
struct clk *clk_per;
|
||||||
/* --------------------------------- */
|
/* --------------------------------- */
|
||||||
|
struct pm_qos_request pm_qos_req;
|
||||||
|
const struct ci_hdrc_imx_platform_flag *plat_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Common functions shared by usbmisc drivers */
|
/* Common functions shared by usbmisc drivers */
|
||||||
|
@ -309,6 +318,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
|
||||||
if (!data)
|
if (!data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
data->plat_data = imx_platform_flag;
|
||||||
|
pdata.flags |= imx_platform_flag->flags;
|
||||||
platform_set_drvdata(pdev, data);
|
platform_set_drvdata(pdev, data);
|
||||||
data->usbmisc_data = usbmisc_get_init_data(dev);
|
data->usbmisc_data = usbmisc_get_init_data(dev);
|
||||||
if (IS_ERR(data->usbmisc_data))
|
if (IS_ERR(data->usbmisc_data))
|
||||||
|
@ -369,6 +380,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pdata.flags & CI_HDRC_PMQOS)
|
||||||
|
pm_qos_add_request(&data->pm_qos_req,
|
||||||
|
PM_QOS_CPU_DMA_LATENCY, 0);
|
||||||
|
|
||||||
ret = imx_get_clks(dev);
|
ret = imx_get_clks(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto disable_hsic_regulator;
|
goto disable_hsic_regulator;
|
||||||
|
@ -382,8 +398,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
|
||||||
ret = PTR_ERR(data->phy);
|
ret = PTR_ERR(data->phy);
|
||||||
/* Return -EINVAL if no usbphy is available */
|
/* Return -EINVAL if no usbphy is available */
|
||||||
if (ret == -ENODEV)
|
if (ret == -ENODEV)
|
||||||
ret = -EINVAL;
|
data->phy = NULL;
|
||||||
goto err_clk;
|
else
|
||||||
|
goto err_clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdata.usb_phy = data->phy;
|
pdata.usb_phy = data->phy;
|
||||||
|
@ -396,7 +413,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
|
||||||
usb_phy_init(pdata.usb_phy);
|
usb_phy_init(pdata.usb_phy);
|
||||||
}
|
}
|
||||||
|
|
||||||
pdata.flags |= imx_platform_flag->flags;
|
|
||||||
if (pdata.flags & CI_HDRC_SUPPORTS_RUNTIME_PM)
|
if (pdata.flags & CI_HDRC_SUPPORTS_RUNTIME_PM)
|
||||||
data->supports_runtime_pm = true;
|
data->supports_runtime_pm = true;
|
||||||
|
|
||||||
|
@ -439,6 +455,8 @@ err_clk:
|
||||||
disable_hsic_regulator:
|
disable_hsic_regulator:
|
||||||
if (data->hsic_pad_regulator)
|
if (data->hsic_pad_regulator)
|
||||||
ret = regulator_disable(data->hsic_pad_regulator);
|
ret = regulator_disable(data->hsic_pad_regulator);
|
||||||
|
if (pdata.flags & CI_HDRC_PMQOS)
|
||||||
|
pm_qos_remove_request(&data->pm_qos_req);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,6 +473,8 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev)
|
||||||
if (data->override_phy_control)
|
if (data->override_phy_control)
|
||||||
usb_phy_shutdown(data->phy);
|
usb_phy_shutdown(data->phy);
|
||||||
imx_disable_unprepare_clks(&pdev->dev);
|
imx_disable_unprepare_clks(&pdev->dev);
|
||||||
|
if (data->plat_data->flags & CI_HDRC_PMQOS)
|
||||||
|
pm_qos_remove_request(&data->pm_qos_req);
|
||||||
if (data->hsic_pad_regulator)
|
if (data->hsic_pad_regulator)
|
||||||
regulator_disable(data->hsic_pad_regulator);
|
regulator_disable(data->hsic_pad_regulator);
|
||||||
|
|
||||||
|
@ -480,6 +500,9 @@ static int __maybe_unused imx_controller_suspend(struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
imx_disable_unprepare_clks(dev);
|
imx_disable_unprepare_clks(dev);
|
||||||
|
if (data->plat_data->flags & CI_HDRC_PMQOS)
|
||||||
|
pm_qos_remove_request(&data->pm_qos_req);
|
||||||
|
|
||||||
data->in_lpm = true;
|
data->in_lpm = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -497,6 +520,10 @@ static int __maybe_unused imx_controller_resume(struct device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->plat_data->flags & CI_HDRC_PMQOS)
|
||||||
|
pm_qos_add_request(&data->pm_qos_req,
|
||||||
|
PM_QOS_CPU_DMA_LATENCY, 0);
|
||||||
|
|
||||||
ret = imx_prepare_enable_clks(dev);
|
ret = imx_prepare_enable_clks(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -175,7 +175,6 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
|
||||||
struct platform_device *plat_ci;
|
struct platform_device *plat_ci;
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
struct reset_control *reset;
|
struct reset_control *reset;
|
||||||
struct resource *res;
|
|
||||||
int ret;
|
int ret;
|
||||||
struct device_node *ulpi_node, *phy_node;
|
struct device_node *ulpi_node, *phy_node;
|
||||||
|
|
||||||
|
@ -209,8 +208,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
|
||||||
if (IS_ERR(clk))
|
if (IS_ERR(clk))
|
||||||
return PTR_ERR(clk);
|
return PTR_ERR(clk);
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
|
ci->base = devm_platform_ioremap_resource(pdev, 1);
|
||||||
ci->base = devm_ioremap_resource(&pdev->dev, res);
|
|
||||||
if (IS_ERR(ci->base))
|
if (IS_ERR(ci->base))
|
||||||
return PTR_ERR(ci->base);
|
return PTR_ERR(ci->base);
|
||||||
|
|
||||||
|
|
|
@ -523,8 +523,9 @@ int hw_device_reset(struct ci_hdrc *ci)
|
||||||
hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
|
hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
|
||||||
|
|
||||||
if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
|
if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
|
||||||
pr_err("cannot enter in %s device mode", ci_role(ci)->name);
|
dev_err(ci->dev, "cannot enter in %s device mode\n",
|
||||||
pr_err("lpm = %i", ci->hw_bank.lpm);
|
ci_role(ci)->name);
|
||||||
|
dev_err(ci->dev, "lpm = %i\n", ci->hw_bank.lpm);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -763,13 +763,16 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
|
||||||
.compatible = "fsl,imx7d-usbmisc",
|
.compatible = "fsl,imx7d-usbmisc",
|
||||||
.data = &imx7d_usbmisc_ops,
|
.data = &imx7d_usbmisc_ops,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.compatible = "fsl,imx7ulp-usbmisc",
|
||||||
|
.data = &imx7d_usbmisc_ops,
|
||||||
|
},
|
||||||
{ /* sentinel */ }
|
{ /* sentinel */ }
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
|
MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
|
||||||
|
|
||||||
static int usbmisc_imx_probe(struct platform_device *pdev)
|
static int usbmisc_imx_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct resource *res;
|
|
||||||
struct imx_usbmisc *data;
|
struct imx_usbmisc *data;
|
||||||
const struct of_device_id *of_id;
|
const struct of_device_id *of_id;
|
||||||
|
|
||||||
|
@ -783,8 +786,7 @@ static int usbmisc_imx_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
spin_lock_init(&data->lock);
|
spin_lock_init(&data->lock);
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
data->base = devm_platform_ioremap_resource(pdev, 0);
|
||||||
data->base = devm_ioremap_resource(&pdev->dev, res);
|
|
||||||
if (IS_ERR(data->base))
|
if (IS_ERR(data->base))
|
||||||
return PTR_ERR(data->base);
|
return PTR_ERR(data->base);
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ struct ci_hdrc_platform_data {
|
||||||
#define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */
|
#define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */
|
||||||
#define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13)
|
#define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13)
|
||||||
#define CI_HDRC_IMX_IS_HSIC BIT(14)
|
#define CI_HDRC_IMX_IS_HSIC BIT(14)
|
||||||
|
#define CI_HDRC_PMQOS BIT(15)
|
||||||
enum usb_dr_mode dr_mode;
|
enum usb_dr_mode dr_mode;
|
||||||
#define CI_HDRC_CONTROLLER_RESET_EVENT 0
|
#define CI_HDRC_CONTROLLER_RESET_EVENT 0
|
||||||
#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
|
#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue