From: David Daney <ddaney.cavm@gmail.com>
To: Florian Fainelli <florian@openwrt.org>
Cc: David Daney <ddaney.cavm@gmail.com>,
Grant Likely <grant.likely@secretlab.ca>,
ralf@linux-mips.org, linux-mips@linux-mips.org,
Linus Walleij <linus.walleij@stericsson.com>,
Rob Herring <rob.herring@calxeda.com>,
devicetree-discuss@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] gpio/MIPS/OCTEON: Add a driver for OCTEON's on-chip GPIO pins.
Date: Fri, 13 Apr 2012 09:17:09 -0700 [thread overview]
Message-ID: <4F885185.3070005@gmail.com> (raw)
In-Reply-To: <4F87F868.1080804@openwrt.org>
On 04/13/2012 02:56 AM, Florian Fainelli wrote:
> Hi David,
>
[...]
>> +/*
>> + * The address offset of the GPIO configuration register for a given
>> + * line.
>> + */
>> +static unsigned int bit_cfg_reg(unsigned int gpio)
>> +{
>> + if (gpio< 16)
>> + return 8 * gpio;
>> + else
>> + return 8 * (gpio - 16) + 0x100;
>> +}
>
> You could explicitely inline this one, though the compiler will
> certainly do it by itself.
>
I always let the compiler decide.
[...]
>> +
>> + if (OCTEON_IS_MODEL(OCTEON_CN66XX) ||
>> + OCTEON_IS_MODEL(OCTEON_CN61XX) ||
>> + OCTEON_IS_MODEL(OCTEON_CNF71XX))
>> + chip->ngpio = 20;
>> + else
>> + chip->ngpio = 16;
>
> What about getting the number of gpios from platform_data and/or device
> tree?
>
Actually I am thinking about just setting it to 20 unconditionally.
Anything requesting a non-present GPIO pin is buggy to begin with.
>> +
>> + chip->direction_input = octeon_gpio_dir_in;
>> + chip->get = octeon_gpio_get;
>> + chip->direction_output = octeon_gpio_dir_out;
>> + chip->set = octeon_gpio_set;
>> + err = gpiochip_add(chip);
>> + if (err)
>> + goto out;
>> +
>> + dev_info(&pdev->dev, "version: " DRV_VERSION "\n");
>> +out:
>> + return err;
>> +}
>> +
>> +static int __exit octeon_gpio_remove(struct platform_device *pdev)
>> +{
>> + struct gpio_chip *chip = pdev->dev.platform_data;
>> + return gpiochip_remove(chip);
>> +}
>> +
>> +static struct of_device_id octeon_gpio_match[] = {
>> + {
>> + .compatible = "cavium,octeon-3860-gpio",
>> + },
>> + {},
>> +};
>> +MODULE_DEVICE_TABLE(of, octeon_mgmt_match);
>
> You are using linux/of.h definitions here but you did not include it.
> Also, there is a typo, you want octeon_gpio_match instead.
>
Good catch. I will fix that. There is also a section mismatch I need
to fix.
next prev parent reply other threads:[~2012-04-13 16:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-13 0:10 [PATCH 0/2] gpio/MIPS/OCTEON: Add GPIO support for OCTEON David Daney
[not found] ` <1334275820-7791-1-git-send-email-ddaney.cavm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-13 0:10 ` [PATCH 1/2] MIPS: OCTEON: Select ARCH_REQUIRE_GPIOLIB David Daney
2012-04-13 0:10 ` [PATCH 2/2] gpio/MIPS/OCTEON: Add a driver for OCTEON's on-chip GPIO pins David Daney
2012-04-13 9:56 ` Florian Fainelli
2012-04-13 16:17 ` David Daney [this message]
2012-04-15 15:21 ` Florian Fainelli
2012-05-17 20:50 ` Grant Likely
2012-05-17 21:37 ` David Daney
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=4F885185.3070005@gmail.com \
--to=ddaney.cavm@gmail.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=florian@openwrt.org \
--cc=grant.likely@secretlab.ca \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=rob.herring@calxeda.com \
/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).