diff mbox

[RFC,3/3] arm: mach-mxs: make enabling enet_out a legacy function

Message ID 1359470773-14290-4-git-send-email-w.sang@pengutronix.de
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Wolfram Sang Jan. 29, 2013, 2:46 p.m. UTC
enet_out is now handled via the driver, so handling it in board init
will print a warning.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
 arch/arm/mach-mxs/mach-mxs.c |   24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

Comments

Shawn Guo Jan. 30, 2013, 5:48 a.m. UTC | #1
On Tue, Jan 29, 2013 at 03:46:13PM +0100, Wolfram Sang wrote:
> @@ -351,7 +359,7 @@ static void __init tx28_post_init(void)
>  	struct pinctrl *pctl;
>  	int ret;
>  
> -	enable_clk_enet_out();
> +	legacy_enable_clk_enet_out();

I think TX28 is the only case that really needs to turn on enet_out
clock at platform level, since it has some dirty work about PHY to do
here.  With with fec driver handling the clock, enable_clk_enet_out()
can just be removed for other boards.

Shawn

>  
>  	np = of_find_compatible_node(NULL, NULL, "fsl,imx28-fec");
>  	pdev = of_find_device_by_node(np);

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Jan. 30, 2013, 7:58 a.m. UTC | #2
On Wed, Jan 30, 2013 at 01:48:40PM +0800, Shawn Guo wrote:
> On Tue, Jan 29, 2013 at 03:46:13PM +0100, Wolfram Sang wrote:
> > @@ -351,7 +359,7 @@ static void __init tx28_post_init(void)
> >  	struct pinctrl *pctl;
> >  	int ret;
> >  
> > -	enable_clk_enet_out();
> > +	legacy_enable_clk_enet_out();
> 
> I think TX28 is the only case that really needs to turn on enet_out
> clock at platform level, since it has some dirty work about PHY to do
> here.  With with fec driver handling the clock, enable_clk_enet_out()
> can just be removed for other boards.

I would love to, but this will cause regression on boards which update
the kernel but not the devicetree (no third clock), or?
Shawn Guo Jan. 30, 2013, 12:29 p.m. UTC | #3
On Wed, Jan 30, 2013 at 08:58:32AM +0100, Wolfram Sang wrote:
> On Wed, Jan 30, 2013 at 01:48:40PM +0800, Shawn Guo wrote:
> > On Tue, Jan 29, 2013 at 03:46:13PM +0100, Wolfram Sang wrote:
> > > @@ -351,7 +359,7 @@ static void __init tx28_post_init(void)
> > >  	struct pinctrl *pctl;
> > >  	int ret;
> > >  
> > > -	enable_clk_enet_out();
> > > +	legacy_enable_clk_enet_out();
> > 
> > I think TX28 is the only case that really needs to turn on enet_out
> > clock at platform level, since it has some dirty work about PHY to do
> > here.  With with fec driver handling the clock, enable_clk_enet_out()
> > can just be removed for other boards.
> 
> I would love to, but this will cause regression on boards which update
> the kernel but not the devicetree (no third clock), or?
> 
Ah, that's the consideration.  When someday arch/arm/boot/dts gets
maintained outside kernel tree, we may be required to keep devicetree
compatibility to different kernel versions.  But we haven't got there
yet.  Today people are supposed to use devicetree matching kernel.

Shawn

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index c66129b..1f2e3bf 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -252,17 +252,25 @@  static void __init imx23_evk_init(void)
 	mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT;
 }
 
-static inline void enable_clk_enet_out(void)
+static inline void legacy_enable_clk_enet_out(void)
 {
-	struct clk *clk = clk_get_sys("enet_out", NULL);
+	struct device_node *np;
+	struct clk *clk;
+
+	for_each_compatible_node(np, NULL, "fsl,imx28-fec")
+		if (of_property_match_string(np, "clock-names", "enet_out") >= 0)
+			return;
+
+	WARN(1, "Please specify enet_out-clk in devicetree.\n");
 
+	clk = clk_get_sys("enet_out", NULL);
 	if (!IS_ERR(clk))
 		clk_prepare_enable(clk);
 }
 
 static void __init imx28_evk_init(void)
 {
-	enable_clk_enet_out();
+	legacy_enable_clk_enet_out();
 	update_fec_mac_prop(OUI_FSL);
 
 	mxsfb_pdata.mode_list = mx28evk_video_modes;
@@ -292,7 +300,7 @@  static void __init m28evk_init(void)
 
 static void __init sc_sps1_init(void)
 {
-	enable_clk_enet_out();
+	legacy_enable_clk_enet_out();
 }
 
 static int apx4devkit_phy_fixup(struct phy_device *phy)
@@ -303,7 +311,7 @@  static int apx4devkit_phy_fixup(struct phy_device *phy)
 
 static void __init apx4devkit_init(void)
 {
-	enable_clk_enet_out();
+	legacy_enable_clk_enet_out();
 
 	if (IS_BUILTIN(CONFIG_PHYLIB))
 		phy_register_fixup_for_uid(PHY_ID_KSZ8051, MICREL_PHY_ID_MASK,
@@ -351,7 +359,7 @@  static void __init tx28_post_init(void)
 	struct pinctrl *pctl;
 	int ret;
 
-	enable_clk_enet_out();
+	legacy_enable_clk_enet_out();
 
 	np = of_find_compatible_node(NULL, NULL, "fsl,imx28-fec");
 	pdev = of_find_device_by_node(np);
@@ -391,13 +399,13 @@  static void __init tx28_post_init(void)
 
 static void __init cfa10049_init(void)
 {
-	enable_clk_enet_out();
+	legacy_enable_clk_enet_out();
 	update_fec_mac_prop(OUI_CRYSTALFONTZ);
 }
 
 static void __init apf28_init(void)
 {
-	enable_clk_enet_out();
+	legacy_enable_clk_enet_out();
 
 	mxsfb_pdata.mode_list = apf28dev_video_modes;
 	mxsfb_pdata.mode_count = ARRAY_SIZE(apf28dev_video_modes);