linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oza Oza <oza.oza@broadcom.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	linux-gpio@vger.kernel.org
Subject: [RFC] drivers/gpio/gpio-pca953x.c broken for PCA9505 ?
Date: Thu, 20 Jul 2017 15:37:10 +0530	[thread overview]
Message-ID: <CAMSpPPdvrPfhSEMnzSntaUxt+VUhshYduE0EKvobeh_T1b7a1Q@mail.gmail.com> (raw)

Hi,

Our SOC has PCA9505 IO expander,
Basically I was implementing PCI hotplug, e.g. PCI present lines got
to IO expander.

I had to fix the driver at some places.
but I am not sure, if driver was written considering 9505 chip ?
in fact it declares 9505 as PCA953X_TYPE.

some of the fixes which I have made are

1) #define PCAL953X_INT_MASK       36  (it was 37 before)
pca953x_write_regs_24  has very odd way of calculating register offset.

int bank_shift = fls((chip->gpio_chip.ngpio - 1) / BANK_SZ);
i2c write to
reg << bank_shift

which was coming 37 << 3 as 0x128 and which is u8 data type.
will address 0x28 which is invalid locaiton.

36 << 3 as 0x120, which will address 0x20 correctly.
although again thsi is odd way of deriving offset.
I am following datasheet:
http://www.nxp.com/docs/en/data-sheet/PCA9505_9506.pdf

2) #define PCAL953X_IN_LATCH       34
above LATCH is not present.

3) #define PCAL953X_INT_STAT       38
above also points to indirect locaiton.

please suggest if this diver was written with 9505 in mind ?

Regards,
Oza.

             reply	other threads:[~2017-07-20 10:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20 10:07 Oza Oza [this message]
2017-07-20 12:46 ` [RFC] drivers/gpio/gpio-pca953x.c broken for PCA9505 ? Phil Reid

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=CAMSpPPdvrPfhSEMnzSntaUxt+VUhshYduE0EKvobeh_T1b7a1Q@mail.gmail.com \
    --to=oza.oza@broadcom.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).