public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kory Maincent <kory.maincent@bootlin.com>
To: u-boot@lists.denx.de
Subject: [PATCH v5 09/10] arm: am335x: add support for i2c2 bus
Date: Tue,  4 May 2021 19:31:29 +0200	[thread overview]
Message-ID: <20210504173130.22869-10-kory.maincent@bootlin.com> (raw)
In-Reply-To: <20210504173130.22869-1-kory.maincent@bootlin.com>

The am335x from BeagleBone use i2c EEPROM to detect capes.
The memory is wired to i2c bus 2 therefore it need to be enabled.

Add i2c2 clock, pinmux description and pinmux enable function.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 arch/arm/mach-omap2/am33xx/clock_am33xx.c |  1 +
 board/ti/am335x/board.c                   |  2 ++
 board/ti/am335x/board.h                   |  1 +
 board/ti/am335x/mux.c                     | 15 +++++++++++++++
 4 files changed, 19 insertions(+)

diff --git a/arch/arm/mach-omap2/am33xx/clock_am33xx.c b/arch/arm/mach-omap2/am33xx/clock_am33xx.c
index cf71192360..3a7ac60264 100644
--- a/arch/arm/mach-omap2/am33xx/clock_am33xx.c
+++ b/arch/arm/mach-omap2/am33xx/clock_am33xx.c
@@ -220,6 +220,7 @@ void enable_basic_clocks(void)
 		&cmper->gpio2clkctrl,
 		&cmper->gpio3clkctrl,
 		&cmper->i2c1clkctrl,
+		&cmper->i2c2clkctrl,
 		&cmper->cpgmac0clkctrl,
 		&cmper->spi0clkctrl,
 		&cmrtc->rtcclkctrl,
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index bc1657e88f..c7476b3a8c 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -77,8 +77,10 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 void do_board_detect(void)
 {
 	enable_i2c0_pin_mux();
+	enable_i2c2_pin_mux();
 #if !CONFIG_IS_ENABLED(DM_I2C)
 	i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
+	i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED2, CONFIG_SYS_OMAP24_I2C_SLAVE2);
 #endif
 	if (ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
 				 CONFIG_EEPROM_CHIP_ADDRESS))
diff --git a/board/ti/am335x/board.h b/board/ti/am335x/board.h
index 48df914af9..c2962111c1 100644
--- a/board/ti/am335x/board.h
+++ b/board/ti/am335x/board.h
@@ -93,5 +93,6 @@ void enable_uart3_pin_mux(void);
 void enable_uart4_pin_mux(void);
 void enable_uart5_pin_mux(void);
 void enable_i2c0_pin_mux(void);
+void enable_i2c2_pin_mux(void);
 void enable_board_pin_mux(void);
 #endif
diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c
index 03adcd2b76..e450ff64d8 100644
--- a/board/ti/am335x/mux.c
+++ b/board/ti/am335x/mux.c
@@ -124,6 +124,14 @@ static struct module_pin_mux i2c1_pin_mux[] = {
 	{-1},
 };
 
+static struct module_pin_mux i2c2_pin_mux[] = {
+	{OFFSET(uart1_ctsn), (MODE(3) | RXACTIVE |
+			PULLUDEN | PULLUP_EN | SLEWCTRL)},	/* I2C_DATA */
+	{OFFSET(uart1_rtsn), (MODE(3) | RXACTIVE |
+			PULLUDEN | PULLUP_EN | SLEWCTRL)},	/* I2C_SCLK */
+	{-1},
+};
+
 static struct module_pin_mux spi0_pin_mux[] = {
 	{OFFSET(spi0_sclk), (MODE(0) | RXACTIVE | PULLUDEN)},	/* SPI0_SCLK */
 	{OFFSET(spi0_d0), (MODE(0) | RXACTIVE |
@@ -308,6 +316,11 @@ void enable_i2c0_pin_mux(void)
 	configure_module_pin_mux(i2c0_pin_mux);
 }
 
+void enable_i2c2_pin_mux(void)
+{
+	configure_module_pin_mux(i2c2_pin_mux);
+}
+
 /*
  * The AM335x GP EVM, if daughter card(s) are connected, can have 8
  * different profiles.  These profiles determine what peripherals are
@@ -367,6 +380,7 @@ void enable_board_pin_mux(void)
 #else
 		configure_module_pin_mux(mmc1_pin_mux);
 #endif
+		configure_module_pin_mux(i2c2_pin_mux);
 	} else if (board_is_gp_evm()) {
 		/* General Purpose EVM */
 		unsigned short profile = detect_daughter_board_profile();
@@ -411,6 +425,7 @@ void enable_board_pin_mux(void)
 #else
 		configure_module_pin_mux(mmc1_pin_mux);
 #endif
+		configure_module_pin_mux(i2c2_pin_mux);
 	} else if (board_is_pb()) {
 		configure_module_pin_mux(mii1_pin_mux);
 		configure_module_pin_mux(mmc0_pin_mux);
-- 
2.17.1

  parent reply	other threads:[~2021-05-04 17:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04 17:31 [PATCH v5 00/10] Add support for extension boards detection and DT overlays application Kory Maincent
2021-05-04 17:31 ` [PATCH v5 01/10] fdt_support: move fdt_valid from cmd_fdt.c to fdt_support.c Kory Maincent
2021-05-13 19:06   ` Tom Rini
2021-05-04 17:31 ` [PATCH v5 02/10] cmd: add support for a new "extension" command Kory Maincent
2021-05-13 19:06   ` Tom Rini
2021-05-04 17:31 ` [PATCH v5 03/10] pytest: add sandbox test for " Kory Maincent
2021-05-13 19:06   ` Tom Rini
2021-05-04 17:31 ` [PATCH v5 04/10] ti/common: add support for extension_scan_board function Kory Maincent
2021-05-13 19:06   ` Tom Rini
2021-05-04 17:31 ` [PATCH v5 05/10] am57xx: add support for cape detect functionality Kory Maincent
2021-05-13 19:06   ` Tom Rini
2021-05-04 17:31 ` [PATCH v5 06/10] w1: replace dt detection by automatic detection Kory Maincent
2021-05-13 19:06   ` Tom Rini
2021-05-04 17:31 ` [PATCH v5 07/10] arm: sunxi: add support for DIP detection to CHIP board Kory Maincent
2021-05-13 11:01   ` Andre Przywara
2021-05-13 19:06   ` Tom Rini
2021-05-04 17:31 ` [PATCH v5 08/10] configs: CHIP: add support for DIP detect functionality Kory Maincent
2021-05-13 11:03   ` Andre Przywara
2021-05-17 10:19     ` Köry Maincent
2021-05-13 19:06   ` Tom Rini
2021-05-04 17:31 ` Kory Maincent [this message]
2021-05-13 19:06   ` [PATCH v5 09/10] arm: am335x: add support for i2c2 bus Tom Rini
2021-05-04 17:31 ` [PATCH v5 10/10] am335x: add support for cape detect functionality Kory Maincent
2021-05-13 19:06   ` Tom Rini
2021-05-12 20:37 ` [PATCH v5 00/10] Add support for extension boards detection and DT overlays application Thomas Petazzoni
2021-05-13 12:18   ` Tom Rini
2021-05-13 12:29     ` Thomas Petazzoni

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=20210504173130.22869-10-kory.maincent@bootlin.com \
    --to=kory.maincent@bootlin.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox