linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: omap2: n8x0: move i2c devices to DT
@ 2014-09-16 20:31 Felipe Balbi
  2014-09-16 20:33 ` Felipe Balbi
  0 siblings, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2014-09-16 20:31 UTC (permalink / raw)
  To: linux-arm-kernel

By moving i2c devices to DT we can clean up
i2c_board_info and fix a problem with moving
INTC to irq domain where IRQs can be renumbered
on each boot.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/boot/dts/omap2420-n810.dts         |  7 +++++++
 arch/arm/boot/dts/omap2420-n8x0-common.dtsi |  6 ++++++
 arch/arm/mach-omap2/board-n8x0.c            | 26 +++-----------------------
 arch/arm/mach-omap2/common-board-devices.h  |  5 +++++
 arch/arm/mach-omap2/pdata-quirks.c          |  2 ++
 5 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/arch/arm/boot/dts/omap2420-n810.dts b/arch/arm/boot/dts/omap2420-n810.dts
index 21baec1..b604d26 100644
--- a/arch/arm/boot/dts/omap2420-n810.dts
+++ b/arch/arm/boot/dts/omap2420-n810.dts
@@ -6,3 +6,10 @@
 	model = "Nokia N810";
 	compatible = "nokia,n810", "nokia,n8x0", "ti,omap2420", "ti,omap2";
 };
+
+&i2c2 {
+	aic3x at 18 {
+		compatible = "tlv320aic3x";
+		reg = <0x18>;
+	};
+};
diff --git a/arch/arm/boot/dts/omap2420-n8x0-common.dtsi b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
index 89608b2..24c50db 100644
--- a/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
+++ b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
@@ -27,6 +27,12 @@
 
 &i2c1 {
 	clock-frequency = <400000>;
+
+	pmic at 72 {
+		compatible = "menelaus";
+		reg = <0x72>;
+		interrupts = <7 IRQ_TYPE_EDGE_RISING>;
+	};
 };
 
 &i2c2 {
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index aead77a..97767a2 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -33,6 +33,7 @@
 #include "mmc.h"
 #include "soc.h"
 #include "gpmc-onenand.h"
+#include "common-board-devices.h"
 
 #define TUSB6010_ASYNC_CS	1
 #define TUSB6010_SYNC_CS	4
@@ -568,29 +569,14 @@ static int n8x0_menelaus_late_init(struct device *dev)
 }
 #endif
 
-static struct menelaus_platform_data n8x0_menelaus_platform_data __initdata = {
+struct menelaus_platform_data n8x0_menelaus_platform_data __initdata = {
 	.late_init = n8x0_menelaus_late_init,
 };
 
-static struct i2c_board_info __initdata n8x0_i2c_board_info_1[] __initdata = {
-	{
-		I2C_BOARD_INFO("menelaus", 0x72),
-		.irq = 7 + OMAP_INTC_START,
-		.platform_data = &n8x0_menelaus_platform_data,
-	},
-};
-
-static struct aic3x_pdata n810_aic33_data __initdata = {
+struct aic3x_pdata n810_aic33_data __initdata = {
 	.gpio_reset = 118,
 };
 
-static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
-	{
-		I2C_BOARD_INFO("tlv320aic3x", 0x18),
-		.platform_data = &n810_aic33_data,
-	},
-};
-
 static int __init n8x0_late_initcall(void)
 {
 	if (!board_caps)
@@ -612,11 +598,5 @@ void * __init n8x0_legacy_init(void)
 	board_check_revision();
 	spi_register_board_info(n800_spi_board_info,
 				ARRAY_SIZE(n800_spi_board_info));
-	i2c_register_board_info(0, n8x0_i2c_board_info_1,
-				ARRAY_SIZE(n8x0_i2c_board_info_1));
-	if (board_is_n810())
-		i2c_register_board_info(1, n810_i2c_board_info_2,
-					ARRAY_SIZE(n810_i2c_board_info_2));
-
 	return &mmc1_data;
 }
diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
index f338177..07c88ae 100644
--- a/arch/arm/mach-omap2/common-board-devices.h
+++ b/arch/arm/mach-omap2/common-board-devices.h
@@ -1,6 +1,8 @@
 #ifndef __OMAP_COMMON_BOARD_DEVICES__
 #define __OMAP_COMMON_BOARD_DEVICES__
 
+#include <sound/tlv320aic3x.h>
+#include <linux/mfd/menelaus.h>
 #include "twl-common.h"
 
 #define NAND_BLOCK_SIZE	SZ_128K
@@ -12,4 +14,7 @@ void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
 		       struct ads7846_platform_data *board_pdata);
 void *n8x0_legacy_init(void);
 
+extern struct menelaus_platform_data n8x0_menelaus_platform_data;
+extern struct aic3x_pdata n810_aic33_data;
+
 #endif /* __OMAP_COMMON_BOARD_DEVICES__ */
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 8695fd4..06a0ccf 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -336,6 +336,8 @@ static struct pdata_init auxdata_quirks[] __initdata = {
 struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
 #ifdef CONFIG_MACH_NOKIA_N8X0
 	OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
+	OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data),
+	OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
 #endif
 #ifdef CONFIG_ARCH_OMAP3
 	OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata),
-- 
2.0.1.563.g66f467c

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

* [PATCH] arm: omap2: n8x0: move i2c devices to DT
  2014-09-16 20:31 [PATCH] arm: omap2: n8x0: move i2c devices to DT Felipe Balbi
@ 2014-09-16 20:33 ` Felipe Balbi
  2014-09-17 14:51   ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2014-09-16 20:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Sep 16, 2014 at 03:31:40PM -0500, Felipe Balbi wrote:
> By moving i2c devices to DT we can clean up
> i2c_board_info and fix a problem with moving
> INTC to irq domain where IRQs can be renumbered
> on each boot.
> 
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> Signed-off-by: Felipe Balbi <balbi@ti.com>

note that this only causes problem for N8x0 because it boots in kinda of
a hybrid way, where it uses DT but not all peripherals are created
through DT.

> ---
>  arch/arm/boot/dts/omap2420-n810.dts         |  7 +++++++
>  arch/arm/boot/dts/omap2420-n8x0-common.dtsi |  6 ++++++
>  arch/arm/mach-omap2/board-n8x0.c            | 26 +++-----------------------
>  arch/arm/mach-omap2/common-board-devices.h  |  5 +++++
>  arch/arm/mach-omap2/pdata-quirks.c          |  2 ++
>  5 files changed, 23 insertions(+), 23 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap2420-n810.dts b/arch/arm/boot/dts/omap2420-n810.dts
> index 21baec1..b604d26 100644
> --- a/arch/arm/boot/dts/omap2420-n810.dts
> +++ b/arch/arm/boot/dts/omap2420-n810.dts
> @@ -6,3 +6,10 @@
>  	model = "Nokia N810";
>  	compatible = "nokia,n810", "nokia,n8x0", "ti,omap2420", "ti,omap2";
>  };
> +
> +&i2c2 {
> +	aic3x at 18 {
> +		compatible = "tlv320aic3x";
> +		reg = <0x18>;
> +	};
> +};
> diff --git a/arch/arm/boot/dts/omap2420-n8x0-common.dtsi b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
> index 89608b2..24c50db 100644
> --- a/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
> +++ b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
> @@ -27,6 +27,12 @@
>  
>  &i2c1 {
>  	clock-frequency = <400000>;
> +
> +	pmic at 72 {
> +		compatible = "menelaus";
> +		reg = <0x72>;
> +		interrupts = <7 IRQ_TYPE_EDGE_RISING>;
> +	};
>  };
>  
>  &i2c2 {
> diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
> index aead77a..97767a2 100644
> --- a/arch/arm/mach-omap2/board-n8x0.c
> +++ b/arch/arm/mach-omap2/board-n8x0.c
> @@ -33,6 +33,7 @@
>  #include "mmc.h"
>  #include "soc.h"
>  #include "gpmc-onenand.h"
> +#include "common-board-devices.h"
>  
>  #define TUSB6010_ASYNC_CS	1
>  #define TUSB6010_SYNC_CS	4
> @@ -568,29 +569,14 @@ static int n8x0_menelaus_late_init(struct device *dev)
>  }
>  #endif
>  
> -static struct menelaus_platform_data n8x0_menelaus_platform_data __initdata = {
> +struct menelaus_platform_data n8x0_menelaus_platform_data __initdata = {
>  	.late_init = n8x0_menelaus_late_init,
>  };
>  
> -static struct i2c_board_info __initdata n8x0_i2c_board_info_1[] __initdata = {
> -	{
> -		I2C_BOARD_INFO("menelaus", 0x72),
> -		.irq = 7 + OMAP_INTC_START,
> -		.platform_data = &n8x0_menelaus_platform_data,
> -	},
> -};
> -
> -static struct aic3x_pdata n810_aic33_data __initdata = {
> +struct aic3x_pdata n810_aic33_data __initdata = {
>  	.gpio_reset = 118,
>  };
>  
> -static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
> -	{
> -		I2C_BOARD_INFO("tlv320aic3x", 0x18),
> -		.platform_data = &n810_aic33_data,
> -	},
> -};
> -
>  static int __init n8x0_late_initcall(void)
>  {
>  	if (!board_caps)
> @@ -612,11 +598,5 @@ void * __init n8x0_legacy_init(void)
>  	board_check_revision();
>  	spi_register_board_info(n800_spi_board_info,
>  				ARRAY_SIZE(n800_spi_board_info));
> -	i2c_register_board_info(0, n8x0_i2c_board_info_1,
> -				ARRAY_SIZE(n8x0_i2c_board_info_1));
> -	if (board_is_n810())
> -		i2c_register_board_info(1, n810_i2c_board_info_2,
> -					ARRAY_SIZE(n810_i2c_board_info_2));
> -
>  	return &mmc1_data;
>  }
> diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
> index f338177..07c88ae 100644
> --- a/arch/arm/mach-omap2/common-board-devices.h
> +++ b/arch/arm/mach-omap2/common-board-devices.h
> @@ -1,6 +1,8 @@
>  #ifndef __OMAP_COMMON_BOARD_DEVICES__
>  #define __OMAP_COMMON_BOARD_DEVICES__
>  
> +#include <sound/tlv320aic3x.h>
> +#include <linux/mfd/menelaus.h>
>  #include "twl-common.h"
>  
>  #define NAND_BLOCK_SIZE	SZ_128K
> @@ -12,4 +14,7 @@ void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
>  		       struct ads7846_platform_data *board_pdata);
>  void *n8x0_legacy_init(void);
>  
> +extern struct menelaus_platform_data n8x0_menelaus_platform_data;
> +extern struct aic3x_pdata n810_aic33_data;
> +
>  #endif /* __OMAP_COMMON_BOARD_DEVICES__ */
> diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
> index 8695fd4..06a0ccf 100644
> --- a/arch/arm/mach-omap2/pdata-quirks.c
> +++ b/arch/arm/mach-omap2/pdata-quirks.c
> @@ -336,6 +336,8 @@ static struct pdata_init auxdata_quirks[] __initdata = {
>  struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
>  #ifdef CONFIG_MACH_NOKIA_N8X0
>  	OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
> +	OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data),
> +	OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
>  #endif
>  #ifdef CONFIG_ARCH_OMAP3
>  	OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata),
> -- 
> 2.0.1.563.g66f467c
> 

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140916/9e14c03e/attachment-0001.sig>

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

* [PATCH] arm: omap2: n8x0: move i2c devices to DT
  2014-09-16 20:33 ` Felipe Balbi
@ 2014-09-17 14:51   ` Tony Lindgren
  2014-09-17 15:02     ` Felipe Balbi
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2014-09-17 14:51 UTC (permalink / raw)
  To: linux-arm-kernel

* Felipe Balbi <balbi@ti.com> [140916 13:34]:
> On Tue, Sep 16, 2014 at 03:31:40PM -0500, Felipe Balbi wrote:
> > By moving i2c devices to DT we can clean up
> > i2c_board_info and fix a problem with moving
> > INTC to irq domain where IRQs can be renumbered
> > on each boot.
> > 
> > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > Signed-off-by: Felipe Balbi <balbi@ti.com>
> 
> note that this only causes problem for N8x0 because it boots in kinda of
> a hybrid way, where it uses DT but not all peripherals are created
> through DT.

Thanks applying this into omap-for-v3.18/intc-v2.

Regards,

Tony

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

* [PATCH] arm: omap2: n8x0: move i2c devices to DT
  2014-09-17 14:51   ` Tony Lindgren
@ 2014-09-17 15:02     ` Felipe Balbi
  2014-09-17 15:08       ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2014-09-17 15:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 17, 2014 at 07:51:32AM -0700, Tony Lindgren wrote:
> * Felipe Balbi <balbi@ti.com> [140916 13:34]:
> > On Tue, Sep 16, 2014 at 03:31:40PM -0500, Felipe Balbi wrote:
> > > By moving i2c devices to DT we can clean up
> > > i2c_board_info and fix a problem with moving
> > > INTC to irq domain where IRQs can be renumbered
> > > on each boot.
> > > 
> > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > 
> > note that this only causes problem for N8x0 because it boots in kinda of
> > a hybrid way, where it uses DT but not all peripherals are created
> > through DT.
> 
> Thanks applying this into omap-for-v3.18/intc-v2.

it might be better to apply this on your DT branch and merge DT before
intc-v2, that might avoid a bisection problem.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140917/a8dc9f86/attachment.sig>

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

* [PATCH] arm: omap2: n8x0: move i2c devices to DT
  2014-09-17 15:02     ` Felipe Balbi
@ 2014-09-17 15:08       ` Tony Lindgren
  2014-09-17 15:45         ` Felipe Balbi
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2014-09-17 15:08 UTC (permalink / raw)
  To: linux-arm-kernel

* Felipe Balbi <balbi@ti.com> [140917 08:03]:
> On Wed, Sep 17, 2014 at 07:51:32AM -0700, Tony Lindgren wrote:
> > * Felipe Balbi <balbi@ti.com> [140916 13:34]:
> > > On Tue, Sep 16, 2014 at 03:31:40PM -0500, Felipe Balbi wrote:
> > > > By moving i2c devices to DT we can clean up
> > > > i2c_board_info and fix a problem with moving
> > > > INTC to irq domain where IRQs can be renumbered
> > > > on each boot.
> > > > 
> > > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > > 
> > > note that this only causes problem for N8x0 because it boots in kinda of
> > > a hybrid way, where it uses DT but not all peripherals are created
> > > through DT.
> > 
> > Thanks applying this into omap-for-v3.18/intc-v2.
> 
> it might be better to apply this on your DT branch and merge DT before
> intc-v2, that might avoid a bisection problem.

Yes it would have been nice to have this as a patch before preparing
for intc-v2, but I did not have my n8x0 booting reliably because of
xhci vs ehci issues on my PC and did not notice it early enough.

I've already sent a pull request for the first part of intc-v2, so
best to keep the related changes together in this case.

Regards,

Tony

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

* [PATCH] arm: omap2: n8x0: move i2c devices to DT
  2014-09-17 15:08       ` Tony Lindgren
@ 2014-09-17 15:45         ` Felipe Balbi
  0 siblings, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2014-09-17 15:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 17, 2014 at 08:08:18AM -0700, Tony Lindgren wrote:
> * Felipe Balbi <balbi@ti.com> [140917 08:03]:
> > On Wed, Sep 17, 2014 at 07:51:32AM -0700, Tony Lindgren wrote:
> > > * Felipe Balbi <balbi@ti.com> [140916 13:34]:
> > > > On Tue, Sep 16, 2014 at 03:31:40PM -0500, Felipe Balbi wrote:
> > > > > By moving i2c devices to DT we can clean up
> > > > > i2c_board_info and fix a problem with moving
> > > > > INTC to irq domain where IRQs can be renumbered
> > > > > on each boot.
> > > > > 
> > > > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > > > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > > > 
> > > > note that this only causes problem for N8x0 because it boots in kinda of
> > > > a hybrid way, where it uses DT but not all peripherals are created
> > > > through DT.
> > > 
> > > Thanks applying this into omap-for-v3.18/intc-v2.
> > 
> > it might be better to apply this on your DT branch and merge DT before
> > intc-v2, that might avoid a bisection problem.
> 
> Yes it would have been nice to have this as a patch before preparing
> for intc-v2, but I did not have my n8x0 booting reliably because of
> xhci vs ehci issues on my PC and did not notice it early enough.
> 
> I've already sent a pull request for the first part of intc-v2, so
> best to keep the related changes together in this case.

alright, no problems then.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140917/ab4f8573/attachment-0001.sig>

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

end of thread, other threads:[~2014-09-17 15:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-16 20:31 [PATCH] arm: omap2: n8x0: move i2c devices to DT Felipe Balbi
2014-09-16 20:33 ` Felipe Balbi
2014-09-17 14:51   ` Tony Lindgren
2014-09-17 15:02     ` Felipe Balbi
2014-09-17 15:08       ` Tony Lindgren
2014-09-17 15:45         ` 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).