From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver
Date: Wed, 23 Nov 2011 11:59:47 +0100 [thread overview]
Message-ID: <201111231159.47291.marek.vasut@gmail.com> (raw)
In-Reply-To: <A6AA9BEC-D7FE-4CA6-8F24-DA0EDBB3DC92@Delien.nl>
> > Careful here !!
> >
> > The driver _should_ work for MX233 too! What I'd like to see is you
> > introducing a function like:
> >
> > int mxs_gpio_is_valid(gpio)
> > {
> > char mxs_banks[PINCTRL_BANKS] = PINCTRL_BANK_COUNTS;
> >
> > if (PAD_PIN(gpio) > mxs_bank[PAD_BANK(gpio)])
> > return -EINVAL;
> >
> > return 0;
> > }
>
> There's a bit of a paradox here: If a name is translated into a pin, bank
> numbers above 7 and pin numbers above 31 will have wrapped around in
> translation and won't be caught here. I could check for wrapping in the
> translating function and check for valid numbers within the assigned bit
> range here, but I'd rather not see validity check spread over two
> functions.
>
> > And define PINCTRL_BANK_COUNTS in the section of mxs_gpio.c where all the
> > remaining mx28 and mx233 specific defines are hoarded (near the top of
> > the file).
>
> At that spot I've put in Mike's (very similar) solution now:
> static const int mxs_bank_pins[] = {
> MXS_BANK0_PINS,
> MXS_BANK1_PINS,
> MXS_BANK2_PINS,
> #ifdef(CONFIG_MX28)
> MXS_BANK3_PINS,
> MXS_BANK4_PINS,
> #endif
> };
>
> I'm considering to remove the macro PINCTRL_BANKS now, and use
> ARRAY_SIZE(mxs_bank_pins) instead, as it yields the same number and leads
> to a single point of definition.
And are you sure the amound of pins in bank 0, 1, 2 is the same on mx233 and
mx28 ?
next prev parent reply other threads:[~2011-11-23 10:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 14:41 [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver Robert Deliën
2011-11-22 14:49 ` Marek Vasut
[not found] ` <B4232BD0-3457-4DC5-9A4A-4E16719BA157@delien.nl>
2011-11-22 15:25 ` Marek Vasut
2011-11-22 16:48 ` Robert Deliën
2011-11-22 18:08 ` Marek Vasut
2011-11-22 18:20 ` Marek Vasut
2011-11-22 19:24 ` Robert Deliën
2011-11-22 22:36 ` Marek Vasut
2011-11-23 10:47 ` Robert Deliën
2011-11-23 10:59 ` Marek Vasut [this message]
2011-11-23 12:36 ` Robert Deliën
2011-11-22 21:09 ` Mike Frysinger
2011-11-22 21:16 ` Robert Deliën
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=201111231159.47291.marek.vasut@gmail.com \
--to=marek.vasut@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.