* [PATCH] usb: phy: tegra: make the code simple by devm_platform_ioremap_resource()
@ 2020-01-27 13:58 Dejin Zheng
[not found] ` <20200127135841.17935-1-zhengdejin5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Dejin Zheng @ 2020-01-27 13:58 UTC (permalink / raw)
To: gregkh, thierry.reding, jonathanh
Cc: linux-usb, linux-tegra, linux-kernel, Dejin Zheng
make the code simple by use devm_platform_ioremap_resource() function
to replace platform_get_resource() and devm_ioremap().
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
drivers/usb/phy/phy-tegra-usb.c | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index ea7ef1dc0b42..8220bb4ce1ed 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -944,20 +944,12 @@ static int read_utmi_param(struct platform_device *pdev, const char *param,
static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
struct platform_device *pdev)
{
- struct resource *res;
int err;
struct tegra_utmip_config *config;
tegra_phy->is_ulpi_phy = false;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!res) {
- dev_err(&pdev->dev, "Failed to get UTMI pad regs\n");
- return -ENXIO;
- }
-
- tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
- resource_size(res));
+ tegra_phy->pad_regs = devm_platform_ioremap_resource(pdev, 1);
if (!tegra_phy->pad_regs) {
dev_err(&pdev->dev, "Failed to remap UTMI pad regs\n");
return -ENOMEM;
@@ -1054,7 +1046,6 @@ MODULE_DEVICE_TABLE(of, tegra_usb_phy_id_table);
static int tegra_usb_phy_probe(struct platform_device *pdev)
{
const struct of_device_id *match;
- struct resource *res;
struct tegra_usb_phy *tegra_phy = NULL;
struct device_node *np = pdev->dev.of_node;
enum usb_phy_interface phy_type;
@@ -1071,14 +1062,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
}
tegra_phy->soc_config = match->data;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "Failed to get I/O memory\n");
- return -ENXIO;
- }
-
- tegra_phy->regs = devm_ioremap(&pdev->dev, res->start,
- resource_size(res));
+ tegra_phy->regs = devm_platform_ioremap_resource(pdev, 0);
if (!tegra_phy->regs) {
dev_err(&pdev->dev, "Failed to remap I/O memory\n");
return -ENOMEM;
--
2.25.0
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <20200127135841.17935-1-zhengdejin5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] usb: phy: tegra: make the code simple by devm_platform_ioremap_resource() [not found] ` <20200127135841.17935-1-zhengdejin5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2020-01-27 19:47 ` Dmitry Osipenko [not found] ` <ebb395ec-89ef-12e9-b3a9-2fc35f764ee2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2020-01-31 13:21 ` Felipe Balbi 1 sibling, 1 reply; 4+ messages in thread From: Dmitry Osipenko @ 2020-01-27 19:47 UTC (permalink / raw) To: Dejin Zheng, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, thierry.reding-Re5JQEeQqe8AvxtiuMwx3w, jonathanh-DDmLM1+adcrQT0dZR+AlfA Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA 27.01.2020 16:58, Dejin Zheng пишет: > make the code simple by use devm_platform_ioremap_resource() function > to replace platform_get_resource() and devm_ioremap(). > > Signed-off-by: Dejin Zheng <zhengdejin5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > --- > drivers/usb/phy/phy-tegra-usb.c | 20 ++------------------ > 1 file changed, 2 insertions(+), 18 deletions(-) > > diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c > index ea7ef1dc0b42..8220bb4ce1ed 100644 > --- a/drivers/usb/phy/phy-tegra-usb.c > +++ b/drivers/usb/phy/phy-tegra-usb.c > @@ -944,20 +944,12 @@ static int read_utmi_param(struct platform_device *pdev, const char *param, > static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy, > struct platform_device *pdev) > { > - struct resource *res; > int err; > struct tegra_utmip_config *config; > > tegra_phy->is_ulpi_phy = false; > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > - if (!res) { > - dev_err(&pdev->dev, "Failed to get UTMI pad regs\n"); > - return -ENXIO; > - } > - > - tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start, > - resource_size(res)); > + tegra_phy->pad_regs = devm_platform_ioremap_resource(pdev, 1); > if (!tegra_phy->pad_regs) { > dev_err(&pdev->dev, "Failed to remap UTMI pad regs\n"); > return -ENOMEM; > @@ -1054,7 +1046,6 @@ MODULE_DEVICE_TABLE(of, tegra_usb_phy_id_table); > static int tegra_usb_phy_probe(struct platform_device *pdev) > { > const struct of_device_id *match; > - struct resource *res; > struct tegra_usb_phy *tegra_phy = NULL; > struct device_node *np = pdev->dev.of_node; > enum usb_phy_interface phy_type; > @@ -1071,14 +1062,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) > } > tegra_phy->soc_config = match->data; > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - if (!res) { > - dev_err(&pdev->dev, "Failed to get I/O memory\n"); > - return -ENXIO; > - } > - > - tegra_phy->regs = devm_ioremap(&pdev->dev, res->start, > - resource_size(res)); > + tegra_phy->regs = devm_platform_ioremap_resource(pdev, 0); > if (!tegra_phy->regs) { > dev_err(&pdev->dev, "Failed to remap I/O memory\n"); > return -ENOMEM; > Hello Dejin, Unfortunately this is not a correct change because registers are shared by both PHY and USB controllers on Tegra SoCs. The devm_platform_ioremap_resource() can't be used here because it makes the mapping exclusive for a single driver, while it should be shared. ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <ebb395ec-89ef-12e9-b3a9-2fc35f764ee2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] usb: phy: tegra: make the code simple by devm_platform_ioremap_resource() [not found] ` <ebb395ec-89ef-12e9-b3a9-2fc35f764ee2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2020-01-28 5:06 ` Dejin Zheng 0 siblings, 0 replies; 4+ messages in thread From: Dejin Zheng @ 2020-01-28 5:06 UTC (permalink / raw) To: Dmitry Osipenko Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, thierry.reding-Re5JQEeQqe8AvxtiuMwx3w, jonathanh-DDmLM1+adcrQT0dZR+AlfA, linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, Jan 27, 2020 at 10:47:36PM +0300, Dmitry Osipenko wrote: > 27.01.2020 16:58, Dejin Zheng пишет: > > make the code simple by use devm_platform_ioremap_resource() function > > to replace platform_get_resource() and devm_ioremap(). > > > > Signed-off-by: Dejin Zheng <zhengdejin5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > --- > > drivers/usb/phy/phy-tegra-usb.c | 20 ++------------------ > > 1 file changed, 2 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c > > index ea7ef1dc0b42..8220bb4ce1ed 100644 > > --- a/drivers/usb/phy/phy-tegra-usb.c > > +++ b/drivers/usb/phy/phy-tegra-usb.c > > @@ -944,20 +944,12 @@ static int read_utmi_param(struct platform_device *pdev, const char *param, > > static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy, > > struct platform_device *pdev) > > { > > - struct resource *res; > > int err; > > struct tegra_utmip_config *config; > > > > tegra_phy->is_ulpi_phy = false; > > > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > > - if (!res) { > > - dev_err(&pdev->dev, "Failed to get UTMI pad regs\n"); > > - return -ENXIO; > > - } > > - > > - tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start, > > - resource_size(res)); > > + tegra_phy->pad_regs = devm_platform_ioremap_resource(pdev, 1); > > if (!tegra_phy->pad_regs) { > > dev_err(&pdev->dev, "Failed to remap UTMI pad regs\n"); > > return -ENOMEM; > > @@ -1054,7 +1046,6 @@ MODULE_DEVICE_TABLE(of, tegra_usb_phy_id_table); > > static int tegra_usb_phy_probe(struct platform_device *pdev) > > { > > const struct of_device_id *match; > > - struct resource *res; > > struct tegra_usb_phy *tegra_phy = NULL; > > struct device_node *np = pdev->dev.of_node; > > enum usb_phy_interface phy_type; > > @@ -1071,14 +1062,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) > > } > > tegra_phy->soc_config = match->data; > > > > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > - if (!res) { > > - dev_err(&pdev->dev, "Failed to get I/O memory\n"); > > - return -ENXIO; > > - } > > - > > - tegra_phy->regs = devm_ioremap(&pdev->dev, res->start, > > - resource_size(res)); > > + tegra_phy->regs = devm_platform_ioremap_resource(pdev, 0); > > if (!tegra_phy->regs) { > > dev_err(&pdev->dev, "Failed to remap I/O memory\n"); > > return -ENOMEM; > > > > Hello Dejin, > > Unfortunately this is not a correct change because registers are shared > by both PHY and USB controllers on Tegra SoCs. The > devm_platform_ioremap_resource() can't be used here because it makes the > mapping exclusive for a single driver, while it should be shared. Dmitry, Thanks a lot for your comment! and abandon this commit. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: phy: tegra: make the code simple by devm_platform_ioremap_resource() [not found] ` <20200127135841.17935-1-zhengdejin5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2020-01-27 19:47 ` Dmitry Osipenko @ 2020-01-31 13:21 ` Felipe Balbi 1 sibling, 0 replies; 4+ messages in thread From: Felipe Balbi @ 2020-01-31 13:21 UTC (permalink / raw) To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, thierry.reding-Re5JQEeQqe8AvxtiuMwx3w, jonathanh-DDmLM1+adcrQT0dZR+AlfA Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Dejin Zheng [-- Attachment #1: Type: text/plain, Size: 502 bytes --] Hi, Dejin Zheng <zhengdejin5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > make the code simple by use devm_platform_ioremap_resource() function > to replace platform_get_resource() and devm_ioremap(). > > Signed-off-by: Dejin Zheng <zhengdejin5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> checking file drivers/usb/phy/phy-tegra-usb.c Hunk #1 FAILED at 944. Hunk #2 FAILED at 1054. Hunk #3 FAILED at 1071. 3 out of 3 hunks FAILED unfortunately, it doesn't apply. -- balbi [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-31 13:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-27 13:58 [PATCH] usb: phy: tegra: make the code simple by devm_platform_ioremap_resource() Dejin Zheng
[not found] ` <20200127135841.17935-1-zhengdejin5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-01-27 19:47 ` Dmitry Osipenko
[not found] ` <ebb395ec-89ef-12e9-b3a9-2fc35f764ee2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-01-28 5:06 ` Dejin Zheng
2020-01-31 13:21 ` Felipe Balbi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).