lauantai 22. maaliskuuta 2014 2.19.58 UTC+2 Joshua Datko kirjoitti:
>
> I am trying to enable the i2c-2 bus in mainline uBoot and having problems. 
>  I am building a cape that has a Trusted Platform Module (TPM) on pins 
> P9_19/20, i2c-2.  Using some creative wiring, when I connect the cape to 
> i2c-1, everything works fine.
>
> I added this in /board/ti/am225x/mux.c:
>
> static struct module_pin_mux i2c2_pin_mux[] = {
>     {OFFSET(uart1_ctsn), (MODE(3) | RXACTIVE |
>                        PULLUDEN | SLEWCTRL)}, /* I2C_DATA */
>     {OFFSET(uart1_rtsn), (MODE(3) | RXACTIVE |
> PULLUDEN | SLEWCTRL)}, /* I2C_SCLK */
>     {-1},
> };
>
> In enable_board_pin_mux, I put the following before any of the ifs:
>
> configure_module_pin_mux(i2c2_pin_mux);
>
> and added a puts after to ensure it was getting hit.
>
> When I break in uboot and try to switch to i2c-2, the BBB resets as 
> follows:
>
> U-Boot# i2c dev 2
> Setting bus to 2
> data abort
> pc : [<9f7745c4>]          lr : [<9f7745bc>]
> sp : 9f637dc0  ip : 00000000     fp : 9f638598
> r10: 9f7a7680  r9 : 9f637f28     r8 : 000186a0
> r7 : 00000001  r6 : 9f7a47d4     r5 : 000186a0  r4 : 00000001
> r3 : 0000002c  r2 : 00000001     r1 : 00000002  r0 : 4819c000
> Flags: nZCv  IRQs off  FIQs on  Mode SVC_32
> Resetting CPU ...
>
> I'm not quite sure where to go from here.  It appears, to me, that uBoot 
> has an issue with i2c-2 and any help would be appreciated.  I *could* 
> switch the TPM over to i2c-1 but I'd rather not change the hardware unless 
> using i2c-2 is impossible for some reason in uBoot.
>
> I have a rev B BeagleBone Black BTW.
>
> Josh
>

I found the solution. My problem was simple: BBB internal pull-up resistors 
were disabled.
I added PULLUP_EN -flag to i2c pins and boom, the bus is up and running.

So my new pin muxing is:

static struct module_pin_mux i2c2_pin_mux[] = {

  {OFFSET(uart1_ctsn), (MODE(3) | RXACTIVE |

                     PULLUP_EN | PULLUDEN | SLEWCTRL)},/* I2C_DATA */

  {OFFSET(uart1_rtsn), (MODE(3) | RXACTIVE |

                       PULLUP_EN | PULLUDEN | SLEWCTRL)},/* I2C_SCLK */

  {-1},

};
Flags are defined in arch/arm/include/asm/arch-am33xx/mux_am33xx.h
#define PULLUP_EN       (0x1 << 4) /* Pull Up Selection */

Descriptions of values can be found here (page 747):
http://phytec.com/wiki/images/7/72/AM335x_techincal_reference_manual.pdf

Hope this helps somebody :)
Jussi

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to