From: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
To: kishon-l0cyMroinI0@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
pawel.moll-5wv7dgnIgG8@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
rogerq-l0cyMroinI0@public.gmane.org,
nsekhar-l0cyMroinI0@public.gmane.org,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org,
t-kristo-l0cyMroinI0@public.gmane.org
Subject: [PATCH v3 3/9] phy: ti-pipe3: move sysctrl initialization to a separate function
Date: Tue, 15 Dec 2015 14:46:02 +0530 [thread overview]
Message-ID: <1450170968-11282-4-git-send-email-kishon@ti.com> (raw)
In-Reply-To: <1450170968-11282-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
No functional change. Moved sysctrl initialization done in probe to a
separate function as part of cleaning up ti_pipe3_probe.
Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
drivers/phy/phy-ti-pipe3.c | 78 +++++++++++++++++++++++++-------------------
1 file changed, 45 insertions(+), 33 deletions(-)
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 3379a4d..3154da0 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -376,6 +376,48 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
return 0;
}
+static int ti_pipe3_get_sysctrl(struct ti_pipe3 *phy)
+{
+ struct device *dev = phy->dev;
+ struct device_node *node = dev->of_node;
+ struct device_node *control_node;
+ struct platform_device *control_pdev;
+
+ control_node = of_parse_phandle(node, "ctrl-module", 0);
+ if (!control_node) {
+ dev_err(dev, "Failed to get control device phandle\n");
+ return -EINVAL;
+ }
+
+ control_pdev = of_find_device_by_node(control_node);
+ if (!control_pdev) {
+ dev_err(dev, "Failed to get control device\n");
+ return -EINVAL;
+ }
+
+ phy->control_dev = &control_pdev->dev;
+
+ if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) {
+ phy->dpll_reset_syscon = syscon_regmap_lookup_by_phandle(node,
+ "syscon-pllreset");
+ if (IS_ERR(phy->dpll_reset_syscon)) {
+ dev_info(dev,
+ "can't get syscon-pllreset, sata dpll won't idle\n");
+ phy->dpll_reset_syscon = NULL;
+ } else {
+ if (of_property_read_u32_index(node,
+ "syscon-pllreset", 1,
+ &phy->dpll_reset_reg)) {
+ dev_err(dev,
+ "couldn't get pllreset reg. offset\n");
+ return -EINVAL;
+ }
+ }
+ }
+
+ return 0;
+}
+
static int ti_pipe3_probe(struct platform_device *pdev)
{
struct ti_pipe3 *phy;
@@ -383,8 +425,6 @@ static int ti_pipe3_probe(struct platform_device *pdev)
struct phy_provider *phy_provider;
struct resource *res;
struct device_node *node = pdev->dev.of_node;
- struct device_node *control_node;
- struct platform_device *control_pdev;
const struct of_device_id *match;
struct device *dev = &pdev->dev;
int ret;
@@ -413,42 +453,14 @@ static int ti_pipe3_probe(struct platform_device *pdev)
return PTR_ERR(phy->pll_ctrl_base);
}
- if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) {
- phy->dpll_reset_syscon = syscon_regmap_lookup_by_phandle(node,
- "syscon-pllreset");
- if (IS_ERR(phy->dpll_reset_syscon)) {
- dev_info(dev,
- "can't get syscon-pllreset, sata dpll won't idle\n");
- phy->dpll_reset_syscon = NULL;
- } else {
- if (of_property_read_u32_index(node,
- "syscon-pllreset", 1,
- &phy->dpll_reset_reg)) {
- dev_err(dev,
- "couldn't get pllreset reg. offset\n");
- return -EINVAL;
- }
- }
- }
+ ret = ti_pipe3_get_sysctrl(phy);
+ if (ret)
+ return ret;
ret = ti_pipe3_get_clk(phy);
if (ret)
return ret;
- control_node = of_parse_phandle(node, "ctrl-module", 0);
- if (!control_node) {
- dev_err(dev, "Failed to get control device phandle\n");
- return -EINVAL;
- }
-
- control_pdev = of_find_device_by_node(control_node);
- if (!control_pdev) {
- dev_err(dev, "Failed to get control device\n");
- return -EINVAL;
- }
-
- phy->control_dev = &control_pdev->dev;
next prev parent reply other threads:[~2015-12-15 9:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 9:15 [PATCH v3 0/9] phy: use syscon framework APIs to set ctrl mod reg Kishon Vijay Abraham I
2015-12-15 9:16 ` [PATCH v3 1/9] phy: ti-pipe3: introduce local struct device* in probe Kishon Vijay Abraham I
2015-12-15 9:16 ` [PATCH v3 2/9] phy: ti-pipe3: move clk initialization to a separate function Kishon Vijay Abraham I
[not found] ` <1450170968-11282-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2015-12-15 9:16 ` Kishon Vijay Abraham I [this message]
2015-12-15 9:16 ` [PATCH v3 4/9] phy: ti-pipe3: move mem resource " Kishon Vijay Abraham I
2015-12-15 9:16 ` [PATCH v3 5/9] phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during probe Kishon Vijay Abraham I
2015-12-15 9:16 ` [PATCH v3 6/9] phy: ti-pipe3: use *syscon* framework API to power on/off the PHY Kishon Vijay Abraham I
2015-12-20 3:38 ` Rob Herring
2015-12-21 8:36 ` Kishon Vijay Abraham I
2015-12-15 9:16 ` [PATCH v3 7/9] phy: ti-pipe3: use *syscon* framework API to set PCS value of " Kishon Vijay Abraham I
2015-12-20 3:38 ` Rob Herring
2015-12-15 9:16 ` [PATCH v3 8/9] phy: omap-usb2: use omap_usb_power_off to power off the PHY during probe Kishon Vijay Abraham I
2015-12-15 9:16 ` [PATCH v3 9/9] phy: omap-usb2: use *syscon* framework API to power on/off the PHY Kishon Vijay Abraham I
2015-12-20 3:39 ` Rob Herring
2015-12-20 12:07 ` Kishon Vijay Abraham I
[not found] ` <56769A1F.3060607-l0cyMroinI0@public.gmane.org>
2015-12-22 18:19 ` Rob Herring
2015-12-15 10:56 ` [PATCH v3 0/9] phy: use syscon framework APIs to set ctrl mod reg Arnd Bergmann
2015-12-15 11:14 ` Kishon Vijay Abraham I
2015-12-15 11:55 ` Arnd Bergmann
2015-12-15 12:46 ` Kishon Vijay Abraham I
[not found] ` <56700BC0.7020007-l0cyMroinI0@public.gmane.org>
2015-12-15 15:26 ` Tony Lindgren
2015-12-18 10:16 ` Kishon Vijay Abraham I
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450170968-11282-4-git-send-email-kishon@ti.com \
--to=kishon-l0cymroini0@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=nsekhar-l0cyMroinI0@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=rogerq-l0cyMroinI0@public.gmane.org \
--cc=t-kristo-l0cyMroinI0@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).