linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] apf27: enable Ethernet PHY and add support of ds1374 rtc
@ 2012-11-25 20:17 Philippe Reynes
  2012-11-25 20:17 ` [PATCH 1/4] apf27: enable Ethernet PHY Philippe Reynes
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Philippe Reynes @ 2012-11-25 20:17 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: s.hauer, julien.boibessot, eric.jarrige, Philippe Reynes

This patch series enable Ethernet PHY at startup, and add
the support of ds1374 rtc on armadeus apf27.

Philippe Reynes (4):
  apf27: enable Ethernet PHY
  ds1374: add support of device tree
  imx27-dt: configure i2c1 gpio on armadeus apf27
  apf27: add rtc ds1374 to the device tree

 arch/arm/boot/dts/imx27-apf27.dts |   10 ++++++++++
 arch/arm/mach-imx/imx27-dt.c      |   26 ++++++++++++++++++++++++++
 drivers/rtc/rtc-ds1374.c          |    8 ++++++++
 3 files changed, 44 insertions(+), 0 deletions(-)

-- 
1.7.4.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] apf27: enable Ethernet PHY
  2012-11-25 20:17 [PATCH 0/4] apf27: enable Ethernet PHY and add support of ds1374 rtc Philippe Reynes
@ 2012-11-25 20:17 ` Philippe Reynes
  2012-11-25 20:17 ` [PATCH 2/4] ds1374: add support of device tree Philippe Reynes
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Philippe Reynes @ 2012-11-25 20:17 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: s.hauer, julien.boibessot, eric.jarrige, Philippe Reynes

At startup the Ethernet PHY is in power down mode, so we need
to force the "all capable" mode to activate it.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>
---
 arch/arm/mach-imx/imx27-dt.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index e80d523..f212f81 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -12,6 +12,8 @@
 #include <linux/irq.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
+#include <linux/delay.h>
+#include <linux/phy.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <mach/common.h>
@@ -32,8 +34,27 @@ static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
 	{ /* sentinel */ }
 };
 
+int apf27_lan8700_wakeup(struct phy_device *phydev)
+{
+	int rc = phy_read(phydev, MII_DCOUNTER);
+
+	phy_write(phydev, MII_DCOUNTER, rc | 0xE0);
+	phy_write(phydev, MII_BMCR, BMCR_RESET);
+	udelay(1000);
+
+	return 0;
+}
+
+static void __init apf27_init(void)
+{
+	phy_register_fixup_for_id("imx27-fec.0-1:1f", apf27_lan8700_wakeup);
+}
+
 static void __init imx27_dt_init(void)
 {
+	if (of_machine_is_compatible("armadeus,imx27-apf27"))
+		apf27_init();
+
 	of_platform_populate(NULL, of_default_bus_match_table,
 			     imx27_auxdata_lookup, NULL);
 }
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] ds1374: add support of device tree
  2012-11-25 20:17 [PATCH 0/4] apf27: enable Ethernet PHY and add support of ds1374 rtc Philippe Reynes
  2012-11-25 20:17 ` [PATCH 1/4] apf27: enable Ethernet PHY Philippe Reynes
@ 2012-11-25 20:17 ` Philippe Reynes
  2012-11-26  9:08   ` Thomas Petazzoni
  2012-11-25 20:17 ` [PATCH 3/4] imx27-dt: configure i2c1 gpio on armadeus apf27 Philippe Reynes
  2012-11-25 20:17 ` [PATCH 4/4] apf27: add rtc ds1374 to the device tree Philippe Reynes
  3 siblings, 1 reply; 8+ messages in thread
From: Philippe Reynes @ 2012-11-25 20:17 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: s.hauer, julien.boibessot, eric.jarrige, Philippe Reynes

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>
---
 drivers/rtc/rtc-ds1374.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index 9663160..174c532 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -49,6 +49,14 @@ static const struct i2c_device_id ds1374_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, ds1374_id);
 
+#ifdef CONFIG_OF
+static const struct of_device_id ds1374_of_match[] __devinitconst = {
+	{ .compatible = "dallas,ds1374" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, ds1374_of_match);
+#endif
+
 struct ds1374 {
 	struct i2c_client *client;
 	struct rtc_device *rtc;
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] imx27-dt: configure i2c1 gpio on armadeus apf27
  2012-11-25 20:17 [PATCH 0/4] apf27: enable Ethernet PHY and add support of ds1374 rtc Philippe Reynes
  2012-11-25 20:17 ` [PATCH 1/4] apf27: enable Ethernet PHY Philippe Reynes
  2012-11-25 20:17 ` [PATCH 2/4] ds1374: add support of device tree Philippe Reynes
@ 2012-11-25 20:17 ` Philippe Reynes
  2012-11-26  9:28   ` Thomas Petazzoni
  2012-11-25 20:17 ` [PATCH 4/4] apf27: add rtc ds1374 to the device tree Philippe Reynes
  3 siblings, 1 reply; 8+ messages in thread
From: Philippe Reynes @ 2012-11-25 20:17 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: s.hauer, julien.boibessot, eric.jarrige, Philippe Reynes

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>
---
 arch/arm/mach-imx/imx27-dt.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index f212f81..2eb7014 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -17,6 +17,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <mach/common.h>
+#include <mach/iomux-mx27.h>
 #include <mach/mx27.h>
 
 static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
@@ -48,6 +49,10 @@ int apf27_lan8700_wakeup(struct phy_device *phydev)
 static void __init apf27_init(void)
 {
 	phy_register_fixup_for_id("imx27-fec.0-1:1f", apf27_lan8700_wakeup);
+
+	/* configure i2c1 gpio */
+	mxc_gpio_mode((GPIO_PORTD | GPIO_OUT | GPIO_PF | 17));
+	mxc_gpio_mode((GPIO_PORTD | GPIO_OUT | GPIO_PF | 18));
 }
 
 static void __init imx27_dt_init(void)
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] apf27: add rtc ds1374 to the device tree
  2012-11-25 20:17 [PATCH 0/4] apf27: enable Ethernet PHY and add support of ds1374 rtc Philippe Reynes
                   ` (2 preceding siblings ...)
  2012-11-25 20:17 ` [PATCH 3/4] imx27-dt: configure i2c1 gpio on armadeus apf27 Philippe Reynes
@ 2012-11-25 20:17 ` Philippe Reynes
  3 siblings, 0 replies; 8+ messages in thread
From: Philippe Reynes @ 2012-11-25 20:17 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: s.hauer, julien.boibessot, eric.jarrige, Philippe Reynes

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>
---
 arch/arm/boot/dts/imx27-apf27.dts |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/imx27-apf27.dts b/arch/arm/boot/dts/imx27-apf27.dts
index c0327c0..20b8ef2 100644
--- a/arch/arm/boot/dts/imx27-apf27.dts
+++ b/arch/arm/boot/dts/imx27-apf27.dts
@@ -42,6 +42,16 @@
 			ethernet@1002b000 {
 				status = "okay";
 			};
+
+			i2c1: i2c@10012000 {
+				clock-frequency = <400000>;
+				status = "okay";
+
+				rtc@68 {
+					compatible = "dallas,ds1374";
+					reg = <0x68>;
+				};
+			};
 		};
 
 		nand@d8000000 {
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/4] ds1374: add support of device tree
  2012-11-25 20:17 ` [PATCH 2/4] ds1374: add support of device tree Philippe Reynes
@ 2012-11-26  9:08   ` Thomas Petazzoni
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2012-11-26  9:08 UTC (permalink / raw)
  To: Philippe Reynes
  Cc: linux-kernel, linux-arm-kernel, s.hauer, eric.jarrige, julien.boibessot

Dear Philippe Reynes,

On Sun, 25 Nov 2012 21:17:03 +0100, Philippe Reynes wrote:
> Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>
> ---
>  drivers/rtc/rtc-ds1374.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
> index 9663160..174c532 100644
> --- a/drivers/rtc/rtc-ds1374.c
> +++ b/drivers/rtc/rtc-ds1374.c
> @@ -49,6 +49,14 @@ static const struct i2c_device_id ds1374_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, ds1374_id);
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id ds1374_of_match[] __devinitconst = {
> +	{ .compatible = "dallas,ds1374" },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, ds1374_of_match);
> +#endif
> +

Don't we need a Device Tree binding documentation in
Documentation/devicetree/bindings/rtc/ ?

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] imx27-dt: configure i2c1 gpio on armadeus apf27
  2012-11-25 20:17 ` [PATCH 3/4] imx27-dt: configure i2c1 gpio on armadeus apf27 Philippe Reynes
@ 2012-11-26  9:28   ` Thomas Petazzoni
  2012-11-26  9:59     ` Sascha Hauer
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2012-11-26  9:28 UTC (permalink / raw)
  To: Philippe Reynes
  Cc: linux-kernel, linux-arm-kernel, s.hauer, eric.jarrige, julien.boibessot

Dear Philippe Reynes,

On Sun, 25 Nov 2012 21:17:04 +0100, Philippe Reynes wrote:

>  static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
> @@ -48,6 +49,10 @@ int apf27_lan8700_wakeup(struct phy_device *phydev)
>  static void __init apf27_init(void)
>  {
>  	phy_register_fixup_for_id("imx27-fec.0-1:1f", apf27_lan8700_wakeup);
> +
> +	/* configure i2c1 gpio */
> +	mxc_gpio_mode((GPIO_PORTD | GPIO_OUT | GPIO_PF | 17));
> +	mxc_gpio_mode((GPIO_PORTD | GPIO_OUT | GPIO_PF | 18));
>  }

I haven't followed i.MX 27 support lately, but this surely should be
done using a pinctrl driver. I see that there is a general pinctrl
driver for i.MX, but a drivers/pinctrl/pinctrl-imx27.c might be
missing. It would probably be a better idea to implement the missing
pinctrl driver, if not already available?

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] imx27-dt: configure i2c1 gpio on armadeus apf27
  2012-11-26  9:28   ` Thomas Petazzoni
@ 2012-11-26  9:59     ` Sascha Hauer
  0 siblings, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2012-11-26  9:59 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Philippe Reynes, linux-kernel, linux-arm-kernel, eric.jarrige,
	julien.boibessot

On Mon, Nov 26, 2012 at 10:28:58AM +0100, Thomas Petazzoni wrote:
> Dear Philippe Reynes,
> 
> On Sun, 25 Nov 2012 21:17:04 +0100, Philippe Reynes wrote:
> 
> >  static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
> > @@ -48,6 +49,10 @@ int apf27_lan8700_wakeup(struct phy_device *phydev)
> >  static void __init apf27_init(void)
> >  {
> >  	phy_register_fixup_for_id("imx27-fec.0-1:1f", apf27_lan8700_wakeup);
> > +
> > +	/* configure i2c1 gpio */
> > +	mxc_gpio_mode((GPIO_PORTD | GPIO_OUT | GPIO_PF | 17));
> > +	mxc_gpio_mode((GPIO_PORTD | GPIO_OUT | GPIO_PF | 18));
> >  }
> 
> I haven't followed i.MX 27 support lately, but this surely should be
> done using a pinctrl driver. I see that there is a general pinctrl
> driver for i.MX, but a drivers/pinctrl/pinctrl-imx27.c might be
> missing. It would probably be a better idea to implement the missing
> pinctrl driver, if not already available?

It's not available, and yes, it should be implemented. Adding the iomux
setup to a i.MX27 SoC specific file is not a good idea.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-11-26 10:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-25 20:17 [PATCH 0/4] apf27: enable Ethernet PHY and add support of ds1374 rtc Philippe Reynes
2012-11-25 20:17 ` [PATCH 1/4] apf27: enable Ethernet PHY Philippe Reynes
2012-11-25 20:17 ` [PATCH 2/4] ds1374: add support of device tree Philippe Reynes
2012-11-26  9:08   ` Thomas Petazzoni
2012-11-25 20:17 ` [PATCH 3/4] imx27-dt: configure i2c1 gpio on armadeus apf27 Philippe Reynes
2012-11-26  9:28   ` Thomas Petazzoni
2012-11-26  9:59     ` Sascha Hauer
2012-11-25 20:17 ` [PATCH 4/4] apf27: add rtc ds1374 to the device tree Philippe Reynes

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).