Skip to content

arm nomadik: gpio and i2c

Heiko Schocher u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 2 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 2 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [U-Boot] [PATCH 0/2] arm nomadik: gpio and i2c

Hello Daniel,

Quoted 47 lines · Daniel Gorsulowski
Quoted 46 lines · Heiko Schocher

Hello Alessandro,

Quoted 11 lines · Alessandro Rubini

This adds gpio and i2c support for the Nomadik evaluation kit. They are needed to turn on the LCD backlight in order to later add LCD support.

I have one doubt and some questions on gpio:

To use soft_i2c I need to define some macros in the config file. Instead of writing hard numbers there I called the gpio functions, but the config file is inluded from asm sources as well. I don't think my approach is beautiful at all (both #ifndef __ASSEMBLY__ and #include "../board/"), but I didn't find a better solution.

Yes, thats a problem ... if we had a GPIO Framework it would be solved by including gpio.h ...

Or, maybe, we can make a soft_i2c.h which which gets only included if saying CONFIG_I2C_SOFT_INCLUDE is defined. soft_i2c.h defines for example:

#define I2C_SDA(x) i2c_soft_sda(bit)

void i2c_soft_sda(int pin);

and you can define this function i2c_soft_sda(int pin) in your board specific code ... maybe a cleaner option?

to speak in c, I tried the following patch on the suen3 plattform, where I have actually a similiar problem, and this worked fine :-)

[PATCH] i2c, soft: added soft_i2c.h

In case you must define functions for the I2C_XXX defines, it is necessary to have a soft_i2c.h, which defines functions for this macros. This functions can then be programmed in board specific code. To activate this it must be CONFIG_I2C_SOFT_INCLUDE defined in the board config file.

---
 drivers/i2c/soft_i2c.c |    3 +++
 include/soft_i2c.h     |   16 ++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
 create mode 100644 include/soft_i2c.h

[...]

Quoted 11 lines
Quoted 11 lines

-- 1.6.0.GIT Maybe you can try it too?

Quoted 6 lines

I would like to add a gpio command, and I've found no generic gpio stuff. Only one board (cm-bf527) has a gpio commands, but quite a few have similar commands to set leds or other bits. Is time ripe for a generic gpio driver with board-specific limits and operations? Would that be interesting for u-boot-next? Should I process with a board-specific gpio command by now?

I vote for making a gpio framework, but that will take a while I think ... Hmm.. maybe we use my proposal for such a soft_i2c.h, so I think, it is okay for such a board specific gpio (unless we have a gpio framework).

Quoted 7 lines
Quoted 2 lines

bye
Heiko

I tried your patch on AT91SAM9263EK based OTC-570 board (patch will come to ML within next merge window). It worked fine on it.
But some boards (the OTC-570 too) need a i2c_soft_init() function. So I extended your patch as follows:

[...]

OK, thanks, but this patch was just a fast thought, and as I wrote, I think, Wolfgang will not Ack this patch ... Wolfgang?

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany