All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikita Kiryanov <nikita@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V4 07/19] i2c: imx: add macros to setup pads for multiple SoC types
Date: Wed, 20 Aug 2014 15:08:54 +0300	[thread overview]
Message-ID: <1408536546-15785-8-git-send-email-nikita@compulab.co.il> (raw)
In-Reply-To: <1408536546-15785-1-git-send-email-nikita@compulab.co.il>

Add macro which defines i2c_pads_info structs for multiple SoC types,
and a macro which selects the appropriate struct based on CPU type,
thus eliminating the need to manage multiple i2c pad configurations
manually when supporting multiple SoC types.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
Changes in V4:
	- No changes.

Changes in V3:
	- No changes.

Changes in V2:
	- No changes.

 arch/arm/include/asm/imx-common/mxc_i2c.h | 33 +++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/arch/arm/include/asm/imx-common/mxc_i2c.h b/arch/arm/include/asm/imx-common/mxc_i2c.h
index 47a9edc..182c2f3 100644
--- a/arch/arm/include/asm/imx-common/mxc_i2c.h
+++ b/arch/arm/include/asm/imx-common/mxc_i2c.h
@@ -19,6 +19,39 @@ struct i2c_pads_info {
 	struct i2c_pin_ctrl sda;
 };
 
+#if defined(CONFIG_MX6QDL)
+#define I2C_PADS(name, scl_i2c, scl_gpio, scl_gp, sda_i2c, sda_gpio, sda_gp) \
+	struct i2c_pads_info mx6q_##name = {		\
+		.scl = {				\
+			.i2c_mode = MX6Q_##scl_i2c,	\
+			.gpio_mode = MX6Q_##scl_gpio,	\
+			.gp = scl_gp,			\
+		},					\
+		.sda = {				\
+			.i2c_mode = MX6Q_##sda_i2c,	\
+			.gpio_mode = MX6Q_##sda_gpio,	\
+			.gp = sda_gp,			\
+		}					\
+	};						\
+	struct i2c_pads_info mx6s_##name = {		\
+		.scl = {				\
+			.i2c_mode = MX6DL_##scl_i2c,	\
+			.gpio_mode = MX6DL_##scl_gpio,	\
+			.gp = scl_gp,			\
+		},					\
+		.sda = {				\
+			.i2c_mode = MX6DL_##sda_i2c,	\
+			.gpio_mode = MX6DL_##sda_gpio,	\
+			.gp = sda_gp,			\
+		}					\
+	};
+
+
+#define I2C_PADS_INFO(name)	\
+	(is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D)) ? \
+					&mx6q_##name : &mx6s_##name
+#endif
+
 void setup_i2c(unsigned i2c_index, int speed, int slave_addr,
 		struct i2c_pads_info *p);
 void bus_i2c_init(void *base, int speed, int slave_addr,
-- 
1.9.1

  parent reply	other threads:[~2014-08-20 12:08 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 12:08 [U-Boot] [PATCH V4 00/19] Introduce cm-fx6 board Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 01/19] spl: replace CONFIG_SPL_SPI_* with CONFIG_SF_DEFAULT_* Nikita Kiryanov
2014-08-21  5:31   ` Jagan Teki
2014-08-23  7:23     ` Jagan Teki
2014-08-20 12:08 ` [U-Boot] [PATCH V4 02/19] mx6: add clock enabling functions Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 03/19] spi: mxc: fix sf probe when using mxc_spi Nikita Kiryanov
2014-08-23  7:24   ` Jagan Teki
2014-08-20 12:08 ` [U-Boot] [PATCH V4 04/19] mtd: spi: add support for M25PE16 and M25PX16 Nikita Kiryanov
2014-08-21  5:32   ` Jagan Teki
2014-08-23  7:23     ` Jagan Teki
2014-08-20 12:08 ` [U-Boot] [PATCH V4 05/19] compulab: eeprom: add support for defining eeprom i2c bus Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 06/19] sata: dwc_ahsata: implement sata_port_status Nikita Kiryanov
2014-08-20 12:08 ` Nikita Kiryanov [this message]
2014-08-20 12:08 ` [U-Boot] [PATCH V4 08/19] arm: mx6: ddr: cleanup Nikita Kiryanov
2014-09-07 15:58   ` [U-Boot] [PATCH V5 " Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 09/19] arm: mx6: ddr: do not write into reserved bit Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 10/19] arm: mx6: ddr: configure MMDC for slow_pd Nikita Kiryanov
2014-08-25 15:36   ` Nikita Kiryanov
2014-08-25 17:05     ` Tim Harvey
2014-08-20 12:08 ` [U-Boot] [PATCH V4 11/19] arm: mx6: ddr: fix cs0_end calculation Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 12/19] arm: mx6: add get_cpu_type() Nikita Kiryanov
2014-08-20 12:09 ` [U-Boot] [PATCH V4 13/19] arm: mx6: add support for Compulab cm-fx6 CoM Nikita Kiryanov
2014-09-07 15:59   ` [U-Boot] [PATCH V5 " Nikita Kiryanov
2014-09-07 22:32     ` Marek Vasut
2014-08-20 12:09 ` [U-Boot] [PATCH V4 14/19] arm: mx6: cm_fx6: add nand support Nikita Kiryanov
2014-08-20 12:09 ` [U-Boot] [PATCH V4 15/19] arm: mx6: cm_fx6: add ethernet support Nikita Kiryanov
2014-08-20 12:09 ` [U-Boot] [PATCH V4 16/19] arm: mx6: cm_fx6: add usb support Nikita Kiryanov
2014-08-20 12:09 ` [U-Boot] [PATCH V4 17/19] arm: mx6: cm_fx6: add i2c support Nikita Kiryanov
2014-08-20 12:09 ` [U-Boot] [PATCH V4 18/19] arm: mx6: cm_fx6: use eeprom Nikita Kiryanov
2014-08-20 12:09 ` [U-Boot] [PATCH V4 19/19] arm: mx6: cm_fx6: add sata support Nikita Kiryanov
2014-08-31  8:09 ` [U-Boot] [PATCH V4 00/19] Introduce cm-fx6 board Nikita Kiryanov
2014-09-06 10:50   ` Tom Rini
2014-09-09 13:45   ` Stefano Babic
2014-09-09 15:00     ` Nikita Kiryanov
2014-09-09 15:08       ` Stefano Babic

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=1408536546-15785-8-git-send-email-nikita@compulab.co.il \
    --to=nikita@compulab.co.il \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.