mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] more i.MX devicetree support
@ 2012-10-05 10:36 Sascha Hauer
  2012-10-05 10:36 ` [PATCH 1/3] serial i.MX: Use devtype data to determine uart version Sascha Hauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-10-05 10:36 UTC (permalink / raw)
  To: barebox

This adds devicetree support and more devtype based probing to
i.MX drivers.

----------------------------------------------------------------
Sascha Hauer (3):
      serial i.MX: Use devtype data to determine uart version
      net fec_imx: determine fec version based on device ids
      ARM i.MX: Add devicetree support to the ccm drivers

 arch/arm/boards/freescale-mx28-evk/mx28-evk.c  |    2 +-
 arch/arm/boards/karo-tx28/tx28-stk5.c          |    2 +-
 arch/arm/mach-imx/clk-imx1.c                   |    9 +++
 arch/arm/mach-imx/clk-imx21.c                  |    9 +++
 arch/arm/mach-imx/clk-imx25.c                  |    9 +++
 arch/arm/mach-imx/clk-imx27.c                  |    9 +++
 arch/arm/mach-imx/clk-imx31.c                  |    9 +++
 arch/arm/mach-imx/clk-imx35.c                  |    9 +++
 arch/arm/mach-imx/clk-imx5.c                   |   18 +++++
 arch/arm/mach-imx/clk-imx6.c                   |    9 +++
 arch/arm/mach-imx/devices.c                    |   18 ++++-
 arch/arm/mach-imx/include/mach/devices-imx1.h  |    4 +-
 arch/arm/mach-imx/include/mach/devices-imx21.h |    8 +-
 arch/arm/mach-imx/include/mach/devices-imx25.h |   12 +--
 arch/arm/mach-imx/include/mach/devices-imx27.h |   10 +--
 arch/arm/mach-imx/include/mach/devices-imx31.h |   10 +--
 arch/arm/mach-imx/include/mach/devices-imx35.h |    8 +-
 arch/arm/mach-imx/include/mach/devices-imx51.h |    8 +-
 arch/arm/mach-imx/include/mach/devices-imx53.h |    8 +-
 arch/arm/mach-imx/include/mach/devices-imx6.h  |   10 +--
 arch/arm/mach-imx/include/mach/devices.h       |    6 +-
 drivers/net/fec_imx.c                          |   68 +++++++++++++---
 drivers/net/fec_imx.h                          |   22 ++++++
 drivers/serial/serial_imx.c                    |   98 +++++++++++++-----------
 24 files changed, 273 insertions(+), 102 deletions(-)

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 1/3] serial i.MX: Use devtype data to determine uart version
  2012-10-05 10:36 [PATCH] more i.MX devicetree support Sascha Hauer
@ 2012-10-05 10:36 ` Sascha Hauer
  2012-10-05 10:36 ` [PATCH 2/3] net fec_imx: determine fec version based on device ids Sascha Hauer
  2012-10-05 10:36 ` [PATCH 3/3] ARM i.MX: Add devicetree support to the ccm drivers Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-10-05 10:36 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/devices.c                    |    9 ++-
 arch/arm/mach-imx/include/mach/devices-imx1.h  |    4 +-
 arch/arm/mach-imx/include/mach/devices-imx21.h |    8 +-
 arch/arm/mach-imx/include/mach/devices-imx25.h |   10 +--
 arch/arm/mach-imx/include/mach/devices-imx27.h |    8 +-
 arch/arm/mach-imx/include/mach/devices-imx31.h |   10 +--
 arch/arm/mach-imx/include/mach/devices-imx35.h |    6 +-
 arch/arm/mach-imx/include/mach/devices-imx51.h |    6 +-
 arch/arm/mach-imx/include/mach/devices-imx53.h |    6 +-
 arch/arm/mach-imx/include/mach/devices-imx6.h  |    8 +-
 arch/arm/mach-imx/include/mach/devices.h       |    3 +-
 drivers/serial/serial_imx.c                    |   98 +++++++++++++-----------
 12 files changed, 97 insertions(+), 79 deletions(-)

diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c
index 9fde84f..dcef576 100644
--- a/arch/arm/mach-imx/devices.c
+++ b/arch/arm/mach-imx/devices.c
@@ -23,9 +23,14 @@ struct device_d *imx_add_i2c(void *base, int id, struct i2c_platform_data *pdata
 	return imx_add_device("i2c-fsl", id, base, 0x1000, pdata);
 }
 
-struct device_d *imx_add_uart(void *base, int id)
+struct device_d *imx_add_uart_imx1(void *base, int id)
 {
-	return imx_add_device("imx_serial", id, base, 0x1000, NULL);
+	return imx_add_device("imx1-uart", id, base, 0x1000, NULL);
+}
+
+struct device_d *imx_add_uart_imx21(void *base, int id)
+{
+	return imx_add_device("imx21-uart", id, base, 0x1000, NULL);
 }
 
 struct device_d *imx_add_nand(void *base, struct imx_nand_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx1.h b/arch/arm/mach-imx/include/mach/devices-imx1.h
index c73113c..391c1a9 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx1.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx1.h
@@ -2,10 +2,10 @@
 
 static inline struct device_d *imx1_add_uart0(void)
 {
-	return imx_add_uart((void *)MX1_UART1_BASE_ADDR, 0);
+	return imx_add_uart_imx1((void *)MX1_UART1_BASE_ADDR, 0);
 }
 
 static inline struct device_d *imx1_add_uart1(void)
 {
-	return imx_add_uart((void *)MX1_UART2_BASE_ADDR, 1);
+	return imx_add_uart_imx1((void *)MX1_UART2_BASE_ADDR, 1);
 }
diff --git a/arch/arm/mach-imx/include/mach/devices-imx21.h b/arch/arm/mach-imx/include/mach/devices-imx21.h
index 31c5f8c..ad7ee5e 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx21.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx21.h
@@ -3,22 +3,22 @@
 
 static inline struct device_d *imx21_add_uart0(void)
 {
-	return imx_add_uart((void *)MX21_UART1_BASE_ADDR, 0);
+	return imx_add_uart_imx21((void *)MX21_UART1_BASE_ADDR, 0);
 }
 
 static inline struct device_d *imx21_add_uart1(void)
 {
-	return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 1);
+	return imx_add_uart_imx21((void *)MX21_UART2_BASE_ADDR, 1);
 }
 
 static inline struct device_d *imx21_add_uart2(void)
 {
-	return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 2);
+	return imx_add_uart_imx21((void *)MX21_UART2_BASE_ADDR, 2);
 }
 
 static inline struct device_d *imx21_add_uart3(void)
 {
-	return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 3);
+	return imx_add_uart_imx21((void *)MX21_UART2_BASE_ADDR, 3);
 }
 
 static inline struct device_d *imx21_add_nand(struct imx_nand_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx25.h b/arch/arm/mach-imx/include/mach/devices-imx25.h
index 86cda35..f082178 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx25.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx25.h
@@ -33,27 +33,27 @@ static inline struct device_d *imx25_add_spi2(struct spi_imx_master *pdata)
 
 static inline struct device_d *imx25_add_uart0(void)
 {
-	return imx_add_uart((void *)MX25_UART1_BASE_ADDR, 0);
+	return imx_add_uart_imx21((void *)MX25_UART1_BASE_ADDR, 0);
 }
 
 static inline struct device_d *imx25_add_uart1(void)
 {
-	return imx_add_uart((void *)MX25_UART2_BASE_ADDR, 1);
+	return imx_add_uart_imx21((void *)MX25_UART2_BASE_ADDR, 1);
 }
 
 static inline struct device_d *imx25_add_uart2(void)
 {
-	return imx_add_uart((void *)MX25_UART3_BASE_ADDR, 2);
+	return imx_add_uart_imx21((void *)MX25_UART3_BASE_ADDR, 2);
 }
 
 static inline struct device_d *imx25_add_uart3(void)
 {
-	return imx_add_uart((void *)MX25_UART4_BASE_ADDR, 3);
+	return imx_add_uart_imx21((void *)MX25_UART4_BASE_ADDR, 3);
 }
 
 static inline struct device_d *imx25_add_uart4(void)
 {
-	return imx_add_uart((void *)MX25_UART5_BASE_ADDR, 4);
+	return imx_add_uart_imx21((void *)MX25_UART5_BASE_ADDR, 4);
 }
 
 static inline struct device_d *imx25_add_nand(struct imx_nand_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx27.h b/arch/arm/mach-imx/include/mach/devices-imx27.h
index 2799343..f143785 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx27.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx27.h
@@ -23,22 +23,22 @@ static inline struct device_d *imx27_add_i2c1(struct i2c_platform_data *pdata)
 
 static inline struct device_d *imx27_add_uart0(void)
 {
-	return imx_add_uart((void *)MX27_UART1_BASE_ADDR, 0);
+	return imx_add_uart_imx21((void *)MX27_UART1_BASE_ADDR, 0);
 }
 
 static inline struct device_d *imx27_add_uart1(void)
 {
-	return imx_add_uart((void *)MX27_UART2_BASE_ADDR, 1);
+	return imx_add_uart_imx21((void *)MX27_UART2_BASE_ADDR, 1);
 }
 
 static inline struct device_d *imx27_add_uart2(void)
 {
-	return imx_add_uart((void *)MX27_UART3_BASE_ADDR, 2);
+	return imx_add_uart_imx21((void *)MX27_UART3_BASE_ADDR, 2);
 }
 
 static inline struct device_d *imx27_add_uart3(void)
 {
-	return imx_add_uart((void *)MX27_UART4_BASE_ADDR, 3);
+	return imx_add_uart_imx21((void *)MX27_UART4_BASE_ADDR, 3);
 }
 
 static inline struct device_d *imx27_add_nand(struct imx_nand_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx31.h b/arch/arm/mach-imx/include/mach/devices-imx31.h
index d45e4e1..72167b0 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx31.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx31.h
@@ -19,27 +19,27 @@ static inline struct device_d *imx31_add_spi2(struct spi_imx_master *pdata)
 
 static inline struct device_d *imx31_add_uart0(void)
 {
-	return imx_add_uart((void *)MX31_UART1_BASE_ADDR, 0);
+	return imx_add_uart_imx21((void *)MX31_UART1_BASE_ADDR, 0);
 }
 
 static inline struct device_d *imx31_add_uart1(void)
 {
-	return imx_add_uart((void *)MX31_UART2_BASE_ADDR, 1);
+	return imx_add_uart_imx21((void *)MX31_UART2_BASE_ADDR, 1);
 }
 
 static inline struct device_d *imx31_add_uart2(void)
 {
-	return imx_add_uart((void *)MX31_UART3_BASE_ADDR, 2);
+	return imx_add_uart_imx21((void *)MX31_UART3_BASE_ADDR, 2);
 }
 
 static inline struct device_d *imx31_add_uart3(void)
 {
-	return imx_add_uart((void *)MX31_UART4_BASE_ADDR, 3);
+	return imx_add_uart_imx21((void *)MX31_UART4_BASE_ADDR, 3);
 }
 
 static inline struct device_d *imx31_add_uart4(void)
 {
-	return imx_add_uart((void *)MX31_UART5_BASE_ADDR, 4);
+	return imx_add_uart_imx21((void *)MX31_UART5_BASE_ADDR, 4);
 }
 
 static inline struct device_d *imx31_add_nand(struct imx_nand_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx35.h b/arch/arm/mach-imx/include/mach/devices-imx35.h
index 27c49e7..06393d4 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx35.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx35.h
@@ -28,17 +28,17 @@ static inline struct device_d *imx35_add_spi(struct spi_imx_master *pdata)
 
 static inline struct device_d *imx35_add_uart0(void)
 {
-	return imx_add_uart((void *)MX35_UART1_BASE_ADDR, 0);
+	return imx_add_uart_imx21((void *)MX35_UART1_BASE_ADDR, 0);
 }
 
 static inline struct device_d *imx35_add_uart1(void)
 {
-	return imx_add_uart((void *)MX35_UART2_BASE_ADDR, 1);
+	return imx_add_uart_imx21((void *)MX35_UART2_BASE_ADDR, 1);
 }
 
 static inline struct device_d *imx35_add_uart2(void)
 {
-	return imx_add_uart((void *)MX35_UART3_BASE_ADDR, 2);
+	return imx_add_uart_imx21((void *)MX35_UART3_BASE_ADDR, 2);
 }
 
 static inline struct device_d *imx35_add_nand(struct imx_nand_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx51.h b/arch/arm/mach-imx/include/mach/devices-imx51.h
index 4b35c96..83b5a66 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx51.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx51.h
@@ -29,17 +29,17 @@ static inline struct device_d *imx51_add_i2c1(struct i2c_platform_data *pdata)
 
 static inline struct device_d *imx51_add_uart0(void)
 {
-	return imx_add_uart((void *)MX51_UART1_BASE_ADDR, 0);
+	return imx_add_uart_imx21((void *)MX51_UART1_BASE_ADDR, 0);
 }
 
 static inline struct device_d *imx51_add_uart1(void)
 {
-	return imx_add_uart((void *)MX51_UART2_BASE_ADDR, 1);
+	return imx_add_uart_imx21((void *)MX51_UART2_BASE_ADDR, 1);
 }
 
 static inline struct device_d *imx51_add_uart2(void)
 {
-	return imx_add_uart((void *)MX51_UART3_BASE_ADDR, 2);
+	return imx_add_uart_imx21((void *)MX51_UART3_BASE_ADDR, 2);
 }
 
 static inline struct device_d *imx51_add_fec(struct fec_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx53.h b/arch/arm/mach-imx/include/mach/devices-imx53.h
index 54d7b27..5c3c093 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx53.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx53.h
@@ -23,17 +23,17 @@ static inline struct device_d *imx53_add_i2c1(struct i2c_platform_data *pdata)
 
 static inline struct device_d *imx53_add_uart0(void)
 {
-	return imx_add_uart((void *)MX53_UART1_BASE_ADDR, 0);
+	return imx_add_uart_imx21((void *)MX53_UART1_BASE_ADDR, 0);
 }
 
 static inline struct device_d *imx53_add_uart1(void)
 {
-	return imx_add_uart((void *)MX53_UART2_BASE_ADDR, 1);
+	return imx_add_uart_imx21((void *)MX53_UART2_BASE_ADDR, 1);
 }
 
 static inline struct device_d *imx53_add_uart2(void)
 {
-	return imx_add_uart((void *)MX53_UART3_BASE_ADDR, 2);
+	return imx_add_uart_imx21((void *)MX53_UART3_BASE_ADDR, 2);
 }
 
 static inline struct device_d *imx53_add_fec(struct fec_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx6.h b/arch/arm/mach-imx/include/mach/devices-imx6.h
index c73e488..9310938 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx6.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx6.h
@@ -2,22 +2,22 @@
 
 static inline struct device_d *imx6_add_uart0(void)
 {
-	return imx_add_uart((void *)MX6_UART1_BASE_ADDR, 0);
+	return imx_add_uart_imx21((void *)MX6_UART1_BASE_ADDR, 0);
 }
 
 static inline struct device_d *imx6_add_uart1(void)
 {
-	return imx_add_uart((void *)MX6_UART2_BASE_ADDR, 1);
+	return imx_add_uart_imx21((void *)MX6_UART2_BASE_ADDR, 1);
 }
 
 static inline struct device_d *imx6_add_uart2(void)
 {
-	return imx_add_uart((void *)MX6_UART3_BASE_ADDR, 2);
+	return imx_add_uart_imx21((void *)MX6_UART3_BASE_ADDR, 2);
 }
 
 static inline struct device_d *imx6_add_uart3(void)
 {
-	return imx_add_uart((void *)MX6_UART4_BASE_ADDR, 3);
+	return imx_add_uart_imx21((void *)MX6_UART4_BASE_ADDR, 3);
 }
 
 static inline struct device_d *imx6_add_mmc0(struct esdhc_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices.h b/arch/arm/mach-imx/include/mach/devices.h
index da91646..8679ade 100644
--- a/arch/arm/mach-imx/include/mach/devices.h
+++ b/arch/arm/mach-imx/include/mach/devices.h
@@ -11,7 +11,8 @@
 struct device_d *imx_add_fec(void *base, struct fec_platform_data *pdata);
 struct device_d *imx_add_spi(void *base, int id, struct spi_imx_master *pdata);
 struct device_d *imx_add_i2c(void *base, int id, struct i2c_platform_data *pdata);
-struct device_d *imx_add_uart(void *base, int id);
+struct device_d *imx_add_uart_imx1(void *base, int id);
+struct device_d *imx_add_uart_imx21(void *base, int id);
 struct device_d *imx_add_nand(void *base, struct imx_nand_platform_data *pdata);
 struct device_d *imx_add_fb(void *base, struct imx_fb_platform_data *pdata);
 struct device_d *imx_add_ipufb(void *base, struct imx_ipu_fb_platform_data *pdata);
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index a711940..e3fe6ad 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -38,20 +38,6 @@
 #define UBIR	0xa4	/* BRM Incremental Register */
 #define UBMR	0xa8	/* BRM Modulator Register */
 #define UBRC	0xac	/* Baud Rate Count Register */
-#ifdef CONFIG_ARCH_IMX1
-#define BIPR1	0xb0	/* Incremental Preset Register 1 */
-#define BIPR2	0xb4	/* Incremental Preset Register 2 */
-#define BIPR3	0xb8	/* Incremental Preset Register 3 */
-#define BIPR4	0xbc	/* Incremental Preset Register 4 */
-#define BMPR1	0xc0	/* BRM Modulator Register 1 */
-#define BMPR2	0xc4	/* BRM Modulator Register 2 */
-#define BMPR3	0xc8	/* BRM Modulator Register 3 */
-#define BMPR4	0xcc	/* BRM Modulator Register 4 */
-#define UTS	0xd0	/* UART Test Register */
-#else
-#define ONEMS	0xb0 /* One Millisecond register */
-#define UTS	0xb4 /* UART Test Register */
-#endif
 
 /* UART Control Register Bit Fields.*/
 #define  URXD_CHARRDY    (1<<15)
@@ -148,23 +134,29 @@
 /*
  * create default values for different platforms
  */
-#ifdef CONFIG_ARCH_IMX1
-# define	UCR1_VAL (UCR1_UARTCLKEN)
-# define	UCR3_VAL 0
-# define	UCR4_VAL (UCR4_CTSTL_32 | UCR4_REF16)
-#endif
-#if defined CONFIG_ARCH_IMX21 || defined CONFIG_ARCH_IMX27
-# define	UCR1_VAL (UCR1_UARTCLKEN)
-# define	UCR3_VAL (0x700 | UCR3_RXDMUXSEL)
-# define	UCR4_VAL UCR4_CTSTL_32
-#endif
-#if defined CONFIG_ARCH_IMX31 || defined CONFIG_ARCH_IMX35 || \
-	defined CONFIG_ARCH_IMX25 || defined CONFIG_ARCH_IMX51 || \
-	defined CONFIG_ARCH_IMX53 || defined CONFIG_ARCH_IMX6
-# define	UCR1_VAL (0)
-# define	UCR3_VAL (0x700 | UCR3_RXDMUXSEL)
-# define	UCR4_VAL UCR4_CTSTL_32
-#endif
+struct imx_serial_devtype_data {
+	u32 ucr1_val;
+	u32 ucr3_val;
+	u32 ucr4_val;
+	u32 uts;
+	u32 onems;
+};
+
+struct imx_serial_devtype_data imx1_data = {
+	.ucr1_val = UCR1_UARTCLKEN,
+	.ucr3_val = 0,
+	.ucr4_val = UCR4_CTSTL_32 | UCR4_REF16,
+	.uts = 0xd0,
+	.onems = 0,
+};
+
+struct imx_serial_devtype_data imx21_data = {
+	.ucr1_val = 0,
+	.ucr3_val = 0x700 | UCR3_RXDMUXSEL,
+	.ucr4_val = UCR4_CTSTL_32,
+	.uts = 0xb4,
+	.onems = 0xb0,
+};
 
 struct imx_serial_priv {
 	struct console_device cdev;
@@ -172,6 +164,7 @@ struct imx_serial_priv {
 	struct notifier_block notify;
 	void __iomem *regs;
 	struct clk *clk;
+	struct imx_serial_devtype_data *devtype;
 };
 
 static int imx_serial_reffreq(struct imx_serial_priv *priv)
@@ -196,23 +189,23 @@ static int imx_serial_init_port(struct console_device *cdev)
 	void __iomem *regs = priv->regs;
 	uint32_t val;
 
-	writel(UCR1_VAL, regs + UCR1);
+	writel(priv->devtype->ucr1_val, regs + UCR1);
 	writel(UCR2_WS | UCR2_IRTS, regs + UCR2);
-	writel(UCR3_VAL, regs + UCR3);
-	writel(UCR4_VAL, regs + UCR4);
+	writel(priv->devtype->ucr3_val, regs + UCR3);
+	writel(priv->devtype->ucr4_val, regs + UCR4);
 	writel(0x0000002B, regs + UESC);
 	writel(0, regs + UTIM);
 	writel(0, regs + UBIR);
 	writel(0, regs + UBMR);
-	writel(0, regs + UTS);
+	writel(0, regs + priv->devtype->uts);
 
 
 	/* Configure FIFOs */
 	writel(0xa81, regs + UFCR);
 
-#ifdef ONEMS
-	writel(imx_serial_reffreq(priv) / 1000, regs + ONEMS);
-#endif
+
+	if (priv->devtype->onems)
+		writel(imx_serial_reffreq(priv) / 1000, regs + priv->devtype->onems);
 
 	/* Enable FIFOs */
 	val = readl(regs + UCR2);
@@ -240,7 +233,7 @@ static void imx_serial_putc(struct console_device *cdev, char c)
 					struct imx_serial_priv, cdev);
 
 	/* Wait for Tx FIFO not full */
-	while (readl(priv->regs + UTS) & UTS_TXFULL);
+	while (readl(priv->regs + priv->devtype->uts) & UTS_TXFULL);
 
         writel(c, priv->regs + URTX0);
 }
@@ -251,7 +244,7 @@ static int imx_serial_tstc(struct console_device *cdev)
 					struct imx_serial_priv, cdev);
 
 	/* If receive fifo is empty, return false */
-	if (readl(priv->regs + UTS) & UTS_RXEMPTY)
+	if (readl(priv->regs + priv->devtype->uts) & UTS_RXEMPTY)
 		return 0;
 	return 1;
 }
@@ -262,7 +255,7 @@ static int imx_serial_getc(struct console_device *cdev)
 					struct imx_serial_priv, cdev);
 	unsigned char ch;
 
-	while (readl(priv->regs + UTS) & UTS_RXEMPTY);
+	while (readl(priv->regs + priv->devtype->uts) & UTS_RXEMPTY);
 
 	ch = readl(priv->regs + URXD0);
 
@@ -318,9 +311,15 @@ static int imx_serial_probe(struct device_d *dev)
 	struct console_device *cdev;
 	struct imx_serial_priv *priv;
 	uint32_t val;
+	struct imx_serial_devtype_data *devtype;
 	int ret;
 
+	ret = dev_get_drvdata(dev, (unsigned long *)&devtype);
+	if (ret)
+		return ret;
+
 	priv = xzalloc(sizeof(*priv));
+	priv->devtype = devtype;
 	cdev = &priv->cdev;
 	dev->priv = priv;
 
@@ -371,20 +370,33 @@ static void imx_serial_remove(struct device_d *dev)
 static __maybe_unused struct of_device_id imx_serial_dt_ids[] = {
 	{
 		.compatible = "fsl,imx1-uart",
-		.data = 0,
+		.data = (unsigned long)&imx1_data,
 	}, {
 		.compatible = "fsl,imx21-uart",
-		.data = 1,
+		.data = (unsigned long)&imx21_data,
 	}, {
 		/* sentinel */
 	}
 };
 
+static struct platform_device_id imx_serial_ids[] = {
+	{
+		.name = "imx1-uart",
+		.driver_data = (unsigned long)&imx1_data,
+	}, {
+		.name = "imx21-uart",
+		.driver_data = (unsigned long)&imx21_data,
+	}, {
+		/* sentinel */
+	},
+};
+
 static struct driver_d imx_serial_driver = {
 	.name   = "imx_serial",
 	.probe  = imx_serial_probe,
 	.remove = imx_serial_remove,
 	.of_compatible = DRV_OF_COMPAT(imx_serial_dt_ids),
+	.id_table = imx_serial_ids,
 };
 
 static int imx_serial_init(void)
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/3] net fec_imx: determine fec version based on device ids
  2012-10-05 10:36 [PATCH] more i.MX devicetree support Sascha Hauer
  2012-10-05 10:36 ` [PATCH 1/3] serial i.MX: Use devtype data to determine uart version Sascha Hauer
@ 2012-10-05 10:36 ` Sascha Hauer
  2012-10-05 10:36 ` [PATCH 3/3] ARM i.MX: Add devicetree support to the ccm drivers Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-10-05 10:36 UTC (permalink / raw)
  To: barebox

This adds the device id mechanism to the i.MX fec driver and
uses it to determine the fec version. Also adds devicetree
probing support.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/freescale-mx28-evk/mx28-evk.c  |    2 +-
 arch/arm/boards/karo-tx28/tx28-stk5.c          |    2 +-
 arch/arm/mach-imx/devices.c                    |    9 +++-
 arch/arm/mach-imx/include/mach/devices-imx25.h |    2 +-
 arch/arm/mach-imx/include/mach/devices-imx27.h |    2 +-
 arch/arm/mach-imx/include/mach/devices-imx35.h |    2 +-
 arch/arm/mach-imx/include/mach/devices-imx51.h |    2 +-
 arch/arm/mach-imx/include/mach/devices-imx53.h |    2 +-
 arch/arm/mach-imx/include/mach/devices-imx6.h  |    2 +-
 arch/arm/mach-imx/include/mach/devices.h       |    3 +-
 drivers/net/fec_imx.c                          |   68 +++++++++++++++++++-----
 drivers/net/fec_imx.h                          |   22 ++++++++
 12 files changed, 95 insertions(+), 23 deletions(-)

diff --git a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
index 7cd61f9..5bcb24c 100644
--- a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
+++ b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
@@ -236,7 +236,7 @@ static int mx28_evk_devices_init(void)
 
 	imx_enable_enetclk();
 	mx28_evk_fec_reset();
-	add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0x4000,
+	add_generic_device("imx28-fec", 0, NULL, IMX_FEC0_BASE, 0x4000,
 			   IORESOURCE_MEM, &fec_info);
 
 	return 0;
diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c
index 9617876..766e77b 100644
--- a/arch/arm/boards/karo-tx28/tx28-stk5.c
+++ b/arch/arm/boards/karo-tx28/tx28-stk5.c
@@ -393,7 +393,7 @@ void base_board_init(void)
 	tx28_get_ethaddr();
 
 	imx_enable_enetclk();
-	add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0x4000,
+	add_generic_device("imx28-fec", 0, NULL, IMX_FEC0_BASE, 0x4000,
 			   IORESOURCE_MEM, &fec_info);
 
 	ret = register_persistent_environment();
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c
index dcef576..4ee4e6c 100644
--- a/arch/arm/mach-imx/devices.c
+++ b/arch/arm/mach-imx/devices.c
@@ -8,9 +8,14 @@ static inline struct device_d *imx_add_device(char *name, int id, void *base, in
 				  IORESOURCE_MEM, pdata);
 }
 
-struct device_d *imx_add_fec(void *base, struct fec_platform_data *pdata)
+struct device_d *imx_add_fec_imx27(void *base, struct fec_platform_data *pdata)
 {
-	return imx_add_device("fec_imx", -1, base, 0x1000, pdata);
+	return imx_add_device("imx27-fec", -1, base, 0x1000, pdata);
+}
+
+struct device_d *imx_add_fec_imx6(void *base, struct fec_platform_data *pdata)
+{
+	return imx_add_device("imx6-fec", -1, base, 0x1000, pdata);
 }
 
 struct device_d *imx_add_spi(void *base, int id, struct spi_imx_master *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx25.h b/arch/arm/mach-imx/include/mach/devices-imx25.h
index f082178..a655be9 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx25.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx25.h
@@ -68,7 +68,7 @@ static inline struct device_d *imx25_add_fb(struct imx_fb_platform_data *pdata)
 
 static inline struct device_d *imx25_add_fec(struct fec_platform_data *pdata)
 {
-	return imx_add_fec((void *)MX25_FEC_BASE_ADDR, pdata);
+	return imx_add_fec_imx27((void *)MX25_FEC_BASE_ADDR, pdata);
 }
 
 static inline struct device_d *imx25_add_mmc0(struct esdhc_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx27.h b/arch/arm/mach-imx/include/mach/devices-imx27.h
index f143785..79da935 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx27.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx27.h
@@ -53,7 +53,7 @@ static inline struct device_d *imx27_add_fb(struct imx_fb_platform_data *pdata)
 
 static inline struct device_d *imx27_add_fec(struct fec_platform_data *pdata)
 {
-	return imx_add_fec((void *)MX27_FEC_BASE_ADDR, pdata);
+	return imx_add_fec_imx27((void *)MX27_FEC_BASE_ADDR, pdata);
 }
 
 static inline struct device_d *imx27_add_mmc0(void *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx35.h b/arch/arm/mach-imx/include/mach/devices-imx35.h
index 06393d4..912c418 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx35.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx35.h
@@ -53,7 +53,7 @@ static inline struct device_d *imx35_add_fb(struct imx_ipu_fb_platform_data *pda
 
 static inline struct device_d *imx35_add_fec(struct fec_platform_data *pdata)
 {
-	return imx_add_fec((void *)MX35_FEC_BASE_ADDR, pdata);
+	return imx_add_fec_imx27((void *)MX35_FEC_BASE_ADDR, pdata);
 }
 
 static inline struct device_d *imx35_add_mmc0(struct esdhc_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx51.h b/arch/arm/mach-imx/include/mach/devices-imx51.h
index 83b5a66..8ee3c17 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx51.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx51.h
@@ -44,7 +44,7 @@ static inline struct device_d *imx51_add_uart2(void)
 
 static inline struct device_d *imx51_add_fec(struct fec_platform_data *pdata)
 {
-	return imx_add_fec((void *)MX51_MXC_FEC_BASE_ADDR, pdata);
+	return imx_add_fec_imx27((void *)MX51_MXC_FEC_BASE_ADDR, pdata);
 }
 
 static inline struct device_d *imx51_add_mmc0(struct esdhc_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx53.h b/arch/arm/mach-imx/include/mach/devices-imx53.h
index 5c3c093..5f967ea 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx53.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx53.h
@@ -38,7 +38,7 @@ static inline struct device_d *imx53_add_uart2(void)
 
 static inline struct device_d *imx53_add_fec(struct fec_platform_data *pdata)
 {
-	return imx_add_fec((void *)MX53_FEC_BASE_ADDR, pdata);
+	return imx_add_fec_imx27((void *)MX53_FEC_BASE_ADDR, pdata);
 }
 
 static inline struct device_d *imx53_add_mmc0(struct esdhc_platform_data *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices-imx6.h b/arch/arm/mach-imx/include/mach/devices-imx6.h
index 9310938..f8282e7 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx6.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx6.h
@@ -42,7 +42,7 @@ static inline struct device_d *imx6_add_mmc3(struct esdhc_platform_data *pdata)
 
 static inline struct device_d *imx6_add_fec(struct fec_platform_data *pdata)
 {
-	return imx_add_fec((void *)MX6_ENET_BASE_ADDR, pdata);
+	return imx_add_fec_imx6((void *)MX6_ENET_BASE_ADDR, pdata);
 }
 
 static inline struct device_d *imx6_add_spi0(struct spi_imx_master *pdata)
diff --git a/arch/arm/mach-imx/include/mach/devices.h b/arch/arm/mach-imx/include/mach/devices.h
index 8679ade..f7824f5 100644
--- a/arch/arm/mach-imx/include/mach/devices.h
+++ b/arch/arm/mach-imx/include/mach/devices.h
@@ -8,7 +8,8 @@
 #include <mach/imx-ipu-fb.h>
 #include <mach/esdhc.h>
 
-struct device_d *imx_add_fec(void *base, struct fec_platform_data *pdata);
+struct device_d *imx_add_fec_imx27(void *base, struct fec_platform_data *pdata);
+struct device_d *imx_add_fec_imx6(void *base, struct fec_platform_data *pdata);
 struct device_d *imx_add_spi(void *base, int id, struct spi_imx_master *pdata);
 struct device_d *imx_add_i2c(void *base, int id, struct i2c_platform_data *pdata);
 struct device_d *imx_add_uart_imx1(void *base, int id);
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index b95c4f0..89aaa64 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -310,7 +310,7 @@ static int fec_init(struct eth_device *dev)
 	}
 
 	if (fec->xcv_type == RMII) {
-		if (cpu_is_mx28()) {
+		if (fec_is_imx28(fec)) {
 			rcntl |= FEC_R_CNTRL_RMII_MODE | FEC_R_CNTRL_FCE |
 				FEC_R_CNTRL_NO_LGTH_CHECK;
 		} else {
@@ -340,7 +340,7 @@ static int fec_init(struct eth_device *dev)
 	xwmrk = 0x2;
 
 	/* set ENET tx at store and forward mode */
-	if (cpu_is_mx6())
+	if (fec_is_imx6(fec))
 		xwmrk |= 1 << 8;
 
 	writel(xwmrk, fec->regs + FEC_X_WMRK);
@@ -407,7 +407,7 @@ static int fec_open(struct eth_device *edev)
 	ecr = FEC_ECNTRL_ETHER_EN;
 
 	/* Enable Swap to support little-endian device */
-	if (cpu_is_mx6())
+	if (fec_is_imx6(fec))
 		ecr |= 0x100;
 
 	writel(ecr, fec->regs + FEC_ECNTRL);
@@ -481,7 +481,7 @@ static int fec_send(struct eth_device *dev, void *eth_data, int data_length)
 	 * Note: We are always using the first buffer for transmission,
 	 * the second will be empty and only used to stop the DMA engine
 	 */
-	if (cpu_is_mx28())
+	if (fec_is_imx28(fec))
 		eth_data = imx28_fix_endianess_wr(eth_data, (data_length + 3) >> 2);
 
 	writew(data_length, &fec->tbd_base[fec->tbd_index].data_length);
@@ -548,7 +548,7 @@ static int fec_recv(struct eth_device *dev)
 		printf("some error: 0x%08x\n", ievent);
 		return 0;
 	}
-	if (!cpu_is_mx28()) {
+	if (!fec_is_imx28(fec)) {
 		if (ievent & FEC_IEVENT_HBERR) {
 			/* Heartbeat error */
 			writel(readl(fec->regs + FEC_X_CNTRL) | 0x1,
@@ -574,7 +574,7 @@ static int fec_recv(struct eth_device *dev)
 		if ((bd_status & FEC_RBD_LAST) && !(bd_status & FEC_RBD_ERR) &&
 			((readw(&rbd->data_length) - 4) > 14)) {
 
-			if (cpu_is_mx28())
+			if (fec_is_imx28(fec))
 				imx28_fix_endianess_rd(
 					phys_to_virt(readl(&rbd->data_pointer)),
 					(readw(&rbd->data_length) + 3) >> 2);
@@ -628,10 +628,17 @@ static int fec_probe(struct device_d *dev)
 	struct fec_priv *fec;
 	void *base;
 	int ret;
+	enum fec_type type;
+
+	ret = dev_get_drvdata(dev, (unsigned long *)&type);
+	if (ret)
+		return ret;
+
 #ifdef CONFIG_ARCH_IMX27
 	PCCR0 |= PCCR0_FEC_EN;
 #endif
 	fec = xzalloc(sizeof(*fec));
+	fec->type = type;
 	edev = &fec->edev;
 	dev->priv = fec;
 	edev->priv = fec;
@@ -675,14 +682,19 @@ static int fec_probe(struct device_d *dev)
 
 	fec_alloc_receive_packets(fec, FEC_RBD_NUM, FEC_MAX_PKT_SIZE);
 
-	fec->xcv_type = pdata->xcv_type;
+	if (pdata) {
+		fec->xcv_type = pdata->xcv_type;
+		fec->phy_init = pdata->phy_init;
+		fec->phy_addr = pdata->phy_addr;
+	} else {
+		fec->xcv_type = MII100;
+		fec->phy_addr = -1;
+	}
 
 	if (fec->xcv_type != SEVENWIRE) {
-		fec->phy_init = pdata->phy_init;
 		fec->miibus.read = fec_miibus_read;
 		fec->miibus.write = fec_miibus_write;
-		fec->phy_addr = pdata->phy_addr;
-		switch (pdata->xcv_type) {
+		switch (fec->xcv_type) {
 		case RMII:
 			fec->interface = PHY_INTERFACE_MODE_RMII;
 			break;
@@ -719,13 +731,45 @@ static void fec_remove(struct device_d *dev)
 	fec_halt(&fec->edev);
 }
 
+static __maybe_unused struct of_device_id imx_fec_dt_ids[] = {
+	{
+		.compatible = "fsl,imx27-fec",
+		.data = FEC_TYPE_IMX27,
+	}, {
+		.compatible = "fsl,imx28-fec",
+		.data = FEC_TYPE_IMX28,
+	}, {
+		.compatible = "fsl,imx6q-fec",
+		.data = FEC_TYPE_IMX6,
+	}, {
+		/* sentinel */
+	}
+};
+
+static struct platform_device_id imx_fec_ids[] = {
+	{
+		.name = "imx27-fec",
+		.driver_data = (unsigned long)FEC_TYPE_IMX27,
+	}, {
+		.name = "imx28-fec",
+		.driver_data = (unsigned long)FEC_TYPE_IMX28,
+	}, {
+		.name = "imx6-fec",
+		.driver_data = (unsigned long)FEC_TYPE_IMX6,
+	}, {
+		/* sentinel */
+	},
+};
+
 /**
  * Driver description for registering
  */
 static struct driver_d fec_driver = {
-        .name   = "fec_imx",
-        .probe  = fec_probe,
+	.name   = "fec_imx",
+	.probe  = fec_probe,
 	.remove = fec_remove,
+	.of_compatible = DRV_OF_COMPAT(imx_fec_dt_ids),
+	.id_table = imx_fec_ids,
 };
 
 static int fec_register(void)
diff --git a/drivers/net/fec_imx.h b/drivers/net/fec_imx.h
index d147dca..1eb1eba 100644
--- a/drivers/net/fec_imx.h
+++ b/drivers/net/fec_imx.h
@@ -122,6 +122,12 @@ struct buffer_descriptor {
 	uint32_t data_pointer;		/**< payload's buffer address */
 };
 
+enum fec_type {
+	FEC_TYPE_IMX27,
+	FEC_TYPE_IMX28,
+	FEC_TYPE_IMX6,
+};
+
 /**
  * @brief i.MX27-FEC private structure
  */
@@ -139,8 +145,24 @@ struct fec_priv {
 	struct mii_bus miibus;
 	void (*phy_init)(struct phy_device *dev);
 	struct clk *clk;
+	enum fec_type type;
 };
 
+static inline int fec_is_imx27(struct fec_priv *priv)
+{
+	return priv->type == FEC_TYPE_IMX27;
+}
+
+static inline int fec_is_imx28(struct fec_priv *priv)
+{
+	return priv->type == FEC_TYPE_IMX28;
+}
+
+static inline int fec_is_imx6(struct fec_priv *priv)
+{
+	return priv->type == FEC_TYPE_IMX6;
+}
+
 /**
  * @brief Numbers of buffer descriptors for receiving
  *
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/3] ARM i.MX: Add devicetree support to the ccm drivers
  2012-10-05 10:36 [PATCH] more i.MX devicetree support Sascha Hauer
  2012-10-05 10:36 ` [PATCH 1/3] serial i.MX: Use devtype data to determine uart version Sascha Hauer
  2012-10-05 10:36 ` [PATCH 2/3] net fec_imx: determine fec version based on device ids Sascha Hauer
@ 2012-10-05 10:36 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-10-05 10:36 UTC (permalink / raw)
  To: barebox

This adds the compatible strings to the CCM drivers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/clk-imx1.c  |    9 +++++++++
 arch/arm/mach-imx/clk-imx21.c |    9 +++++++++
 arch/arm/mach-imx/clk-imx25.c |    9 +++++++++
 arch/arm/mach-imx/clk-imx27.c |    9 +++++++++
 arch/arm/mach-imx/clk-imx31.c |    9 +++++++++
 arch/arm/mach-imx/clk-imx35.c |    9 +++++++++
 arch/arm/mach-imx/clk-imx5.c  |   18 ++++++++++++++++++
 arch/arm/mach-imx/clk-imx6.c  |    9 +++++++++
 8 files changed, 81 insertions(+)

diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
index 45e9c66..0d04a92 100644
--- a/arch/arm/mach-imx/clk-imx1.c
+++ b/arch/arm/mach-imx/clk-imx1.c
@@ -96,9 +96,18 @@ static int imx1_ccm_probe(struct device_d *dev)
 	return 0;
 }
 
+static __maybe_unused struct of_device_id imx1_ccm_dt_ids[] = {
+	{
+		.compatible = "fsl,imx1-ccm",
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d imx1_ccm_driver = {
 	.probe	= imx1_ccm_probe,
 	.name	= "imx1-ccm",
+	.of_compatible = DRV_OF_COMPAT(imx1_ccm_dt_ids),
 };
 
 static int imx1_ccm_init(void)
diff --git a/arch/arm/mach-imx/clk-imx21.c b/arch/arm/mach-imx/clk-imx21.c
index 69aaa9e..a7c5732 100644
--- a/arch/arm/mach-imx/clk-imx21.c
+++ b/arch/arm/mach-imx/clk-imx21.c
@@ -107,9 +107,18 @@ static int imx21_ccm_probe(struct device_d *dev)
 	return 0;
 }
 
+static __maybe_unused struct of_device_id imx21_ccm_dt_ids[] = {
+	{
+		.compatible = "fsl,imx21-ccm",
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d imx21_ccm_driver = {
 	.probe	= imx21_ccm_probe,
 	.name	= "imx21-ccm",
+	.of_compatible = DRV_OF_COMPAT(imx21_ccm_dt_ids),
 };
 
 static int imx21_ccm_init(void)
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index 3b9588c..0a947a2 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -142,9 +142,18 @@ static int imx25_ccm_probe(struct device_d *dev)
 	return 0;
 }
 
+static __maybe_unused struct of_device_id imx25_ccm_dt_ids[] = {
+	{
+		.compatible = "fsl,imx25-ccm",
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d imx25_ccm_driver = {
 	.probe	= imx25_ccm_probe,
 	.name	= "imx25-ccm",
+	.of_compatible = DRV_OF_COMPAT(imx25_ccm_dt_ids),
 };
 
 static int imx25_ccm_init(void)
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index abfde0f..912d3f1 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -142,9 +142,18 @@ static int imx27_ccm_probe(struct device_d *dev)
 	return 0;
 }
 
+static __maybe_unused struct of_device_id imx27_ccm_dt_ids[] = {
+	{
+		.compatible = "fsl,imx27-ccm",
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d imx27_ccm_driver = {
 	.probe	= imx27_ccm_probe,
 	.name	= "imx27-ccm",
+	.of_compatible = DRV_OF_COMPAT(imx27_ccm_dt_ids),
 };
 
 static int imx27_ccm_init(void)
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index cf8963a..aa1b652 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -121,9 +121,18 @@ static int imx31_ccm_probe(struct device_d *dev)
 	return 0;
 }
 
+static __maybe_unused struct of_device_id imx31_ccm_dt_ids[] = {
+	{
+		.compatible = "fsl,imx31-ccm",
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d imx31_ccm_driver = {
 	.probe	= imx31_ccm_probe,
 	.name	= "imx31-ccm",
+	.of_compatible = DRV_OF_COMPAT(imx31_ccm_dt_ids),
 };
 
 static int imx31_ccm_init(void)
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index dfa7561..5b5a9e7 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -174,9 +174,18 @@ static int imx35_ccm_probe(struct device_d *dev)
 	return 0;
 }
 
+static __maybe_unused struct of_device_id imx35_ccm_dt_ids[] = {
+	{
+		.compatible = "fsl,imx35-ccm",
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d imx35_ccm_driver = {
 	.probe	= imx35_ccm_probe,
 	.name	= "imx35-ccm",
+	.of_compatible = DRV_OF_COMPAT(imx35_ccm_dt_ids),
 };
 
 static int imx35_ccm_init(void)
diff --git a/arch/arm/mach-imx/clk-imx5.c b/arch/arm/mach-imx/clk-imx5.c
index 365fcb3..03a1843 100644
--- a/arch/arm/mach-imx/clk-imx5.c
+++ b/arch/arm/mach-imx/clk-imx5.c
@@ -233,9 +233,18 @@ static int imx51_ccm_probe(struct device_d *dev)
 	return 0;
 }
 
+static __maybe_unused struct of_device_id imx51_ccm_dt_ids[] = {
+	{
+		.compatible = "fsl,imx51-ccm",
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d imx51_ccm_driver = {
 	.probe	= imx51_ccm_probe,
 	.name	= "imx51-ccm",
+	.of_compatible = DRV_OF_COMPAT(imx51_ccm_dt_ids),
 };
 
 static int imx51_ccm_init(void)
@@ -285,9 +294,18 @@ static int imx53_ccm_probe(struct device_d *dev)
 	return 0;
 }
 
+static __maybe_unused struct of_device_id imx53_ccm_dt_ids[] = {
+	{
+		.compatible = "fsl,imx53-ccm",
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d imx53_ccm_driver = {
 	.probe	= imx53_ccm_probe,
 	.name	= "imx53-ccm",
+	.of_compatible = DRV_OF_COMPAT(imx53_ccm_dt_ids),
 };
 
 static int imx53_ccm_init(void)
diff --git a/arch/arm/mach-imx/clk-imx6.c b/arch/arm/mach-imx/clk-imx6.c
index 19a8bc6..a1da47a 100644
--- a/arch/arm/mach-imx/clk-imx6.c
+++ b/arch/arm/mach-imx/clk-imx6.c
@@ -294,9 +294,18 @@ static int imx6_ccm_probe(struct device_d *dev)
 	return 0;
 }
 
+static __maybe_unused struct of_device_id imx6_ccm_dt_ids[] = {
+	{
+		.compatible = "fsl,imx6-ccm",
+	}, {
+		/* sentinel */
+	}
+};
+
 static struct driver_d imx6_ccm_driver = {
 	.probe	= imx6_ccm_probe,
 	.name	= "imx6-ccm",
+	.of_compatible = DRV_OF_COMPAT(imx6_ccm_dt_ids),
 };
 
 static int imx6_ccm_init(void)
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2012-10-05 10:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-05 10:36 [PATCH] more i.MX devicetree support Sascha Hauer
2012-10-05 10:36 ` [PATCH 1/3] serial i.MX: Use devtype data to determine uart version Sascha Hauer
2012-10-05 10:36 ` [PATCH 2/3] net fec_imx: determine fec version based on device ids Sascha Hauer
2012-10-05 10:36 ` [PATCH 3/3] ARM i.MX: Add devicetree support to the ccm drivers Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox