public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] gpio: tca642x: Add the tca642x gpio expander driver
Date: Tue, 9 Jul 2013 11:21:04 -0500	[thread overview]
Message-ID: <51DC3870.4080408@ti.com> (raw)
In-Reply-To: <51DC3790.60104@ti.com>

On 07/09/2013 11:17 AM, Dan Murphy wrote:

> On 07/08/2013 04:27 PM, Nishanth Menon wrote:
>> On 07/08/2013 03:53 PM, Dan Murphy wrote:
[...]
>>> +/* tca642x register address definitions */
>>> +struct tca642x_bank_info tca642x_banks[] = {
>>> +    {0x00, 0x04, 0x08, 0x0c},
>>> +    {0x01, 0x05, 0x09, 0x0d},
>>> +    {0x02, 0x06, 0x0a, 0x0e},
>> could we use explicit map of the struct params? helps any future
>> expansion.
>>
> Not sure what you are looking for here.  These are the register
> addresses within the chip.

something like
{.input_reg = 0x00, .polarity_reg = 0x04, ....

It helps readability and future modification to bank_info structure.

[..]
>>> +    int org_bus_num;
>>> +    int ret;
>>> +
>>> +    org_bus_num = i2c_get_bus_num();
>>> +    i2c_set_bus_num(CONFIG_SYS_I2C_TCA642X_BUS_NUM);
>>> +
>>> +    if (i2c_read(chip, addr, 1, (u8 *)&valw, 1)) {
>>> +        printf("Could not read before writing\n");
>>> +        ret = -1;
>>> +        goto error;
>>> +    }
>>> +    valw &= ~mask;
>> data &= mask ?
> Well in this case the mask is not being passed in.  The bit to flip is
> being passed and then the actual mask
> is created here.

reg_setbits? instead then? following the standard api convention - maybe 
make this as a i2c generic api?
-- 
Regards,
Nishanth Menon

      reply	other threads:[~2013-07-09 16:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-08 20:53 [U-Boot] [PATCH 1/2] gpio: tca642x: Add the tca642x gpio expander driver Dan Murphy
2013-07-08 20:54 ` [U-Boot] [PATCH 2/2] omap5: Configure the tca6424 gpio expander Dan Murphy
2013-07-08 21:19   ` Nishanth Menon
2013-07-09 16:20     ` Dan Murphy
2013-07-08 21:27 ` [U-Boot] [PATCH 1/2] gpio: tca642x: Add the tca642x gpio expander driver Nishanth Menon
2013-07-09 16:17   ` Dan Murphy
2013-07-09 16:21     ` Nishanth Menon [this message]

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=51DC3870.4080408@ti.com \
    --to=nm@ti.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