]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: am335x: add support for i2c2 bus
authorKory Maincent <kory.maincent@bootlin.com>
Tue, 4 May 2021 17:31:29 +0000 (19:31 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 13 May 2021 17:09:09 +0000 (13:09 -0400)
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
board/ti/am335x/board.c
board/ti/am335x/board.h
board/ti/am335x/mux.c

index cf7119236015d89363440927f3934bba86b3921f..3a7ac602640580848765adc53d4fcb518ae03993 100644 (file)
@@ -220,6 +220,7 @@ void enable_basic_clocks(void)
                &cmper->gpio2clkctrl,
                &cmper->gpio3clkctrl,
                &cmper->i2c1clkctrl,
+               &cmper->i2c2clkctrl,
                &cmper->cpgmac0clkctrl,
                &cmper->spi0clkctrl,
                &cmrtc->rtcclkctrl,
index bc1657e88fd7b6ee625709e7ccf35d0e8625d304..c7476b3a8cf062d09b4b094fe3f3bfa81ce207de 100644 (file)
@@ -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))
index 48df914af96cfdc4b05a4ef5bac552b3577bf2da..c2962111c1adfaa7dc99b9f6f7d18a5e1a9a73d1 100644 (file)
@@ -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
index 03adcd2b762a7d7c3e42cbf510ada870241f7a95..e450ff64d87b568ef94eea584b9cccf8270d3e5c 100644 (file)
@@ -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);