From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 01/15] Revert "pinctrl: single: support gpio request and free"
Date: Mon, 21 Jan 2013 08:56:41 -0800 [thread overview]
Message-ID: <20130121165640.GH15361@atomide.com> (raw)
In-Reply-To: <1358494279-16503-2-git-send-email-haojian.zhuang@linaro.org>
* Haojian Zhuang <haojian.zhuang@linaro.org> [130117 23:34]:
> This reverts commit 2e8b2eab94c35d83bb7da71c63b4695f32ddca88.
>
> Conflicts:
> drivers/pinctrl/pinctrl-single.c
>
> ERROR: "__aeabi_uldivmod" [drivers/pinctrl/pinctrl-single.ko]
> undefined!]
>
> On Fri, Jan 11, 2013 at 4:00 PM, Russell King wrote:
>
> > The above error happens in builds including pinctrl-single - the
> > reason
> > is this, where resource_size_t may be 64-bit.
> >
> > gpio->range.pin_base = (r.start - pcs->res->start) /
> > mux_bytes;
> > gpio->range.npins = (r.end - r.start) / mux_bytes + 1;
>
> The reason of not fixing this issue and reverting the patch instead is
> this patch can't handle another case. It's not easy to handle multiple
> gpios sharing one pin register. So this gpio range feature will be
> implemented by other patches.
Makes sense to me, I don't think we have any users yet for this:
Acked-by: Tony Lindgren <tony@atomide.com>
> ---
> drivers/pinctrl/pinctrl-single.c | 79 +-------------------------------------
> 1 file changed, 2 insertions(+), 77 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> index f6a360b..5c32e88 100644
> --- a/drivers/pinctrl/pinctrl-single.c
> +++ b/drivers/pinctrl/pinctrl-single.c
> @@ -30,7 +30,6 @@
> #define PCS_MUX_BITS_NAME "pinctrl-single,bits"
> #define PCS_REG_NAME_LEN ((sizeof(unsigned long) * 2) + 1)
> #define PCS_OFF_DISABLED ~0U
> -#define PCS_MAX_GPIO_VALUES 2
>
> /**
> * struct pcs_pingroup - pingroups for a function
> @@ -78,16 +77,6 @@ struct pcs_function {
> };
>
> /**
> - * struct pcs_gpio_range - pinctrl gpio range
> - * @range: subrange of the GPIO number space
> - * @gpio_func: gpio function value in the pinmux register
> - */
> -struct pcs_gpio_range {
> - struct pinctrl_gpio_range range;
> - int gpio_func;
> -};
> -
> -/**
> * struct pcs_data - wrapper for data needed by pinctrl framework
> * @pa: pindesc array
> * @cur: index to current element
> @@ -414,26 +403,9 @@ static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
> }
>
> static int pcs_request_gpio(struct pinctrl_dev *pctldev,
> - struct pinctrl_gpio_range *range, unsigned pin)
> + struct pinctrl_gpio_range *range, unsigned offset)
> {
> - struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
> - struct pcs_gpio_range *gpio = NULL;
> - int end, mux_bytes;
> - unsigned data;
> -
> - gpio = container_of(range, struct pcs_gpio_range, range);
> - end = range->pin_base + range->npins - 1;
> - if (pin < range->pin_base || pin > end) {
> - dev_err(pctldev->dev,
> - "pin %d isn't in the range of %d to %d\n",
> - pin, range->pin_base, end);
> - return -EINVAL;
> - }
> - mux_bytes = pcs->width / BITS_PER_BYTE;
> - data = pcs->read(pcs->base + pin * mux_bytes) & ~pcs->fmask;
> - data |= gpio->gpio_func;
> - pcs->write(data, pcs->base + pin * mux_bytes);
> - return 0;
> + return -ENOTSUPP;
> }
>
> static struct pinmux_ops pcs_pinmux_ops = {
> @@ -907,49 +879,6 @@ static void pcs_free_resources(struct pcs_device *pcs)
>
> static struct of_device_id pcs_of_match[];
>
> -static int pcs_add_gpio_range(struct device_node *node, struct pcs_device *pcs)
> -{
> - struct pcs_gpio_range *gpio;
> - struct device_node *child;
> - struct resource r;
> - const char name[] = "pinctrl-single";
> - u32 gpiores[PCS_MAX_GPIO_VALUES];
> - int ret, i = 0, mux_bytes = 0;
> -
> - for_each_child_of_node(node, child) {
> - ret = of_address_to_resource(child, 0, &r);
> - if (ret < 0)
> - continue;
> - memset(gpiores, 0, sizeof(u32) * PCS_MAX_GPIO_VALUES);
> - ret = of_property_read_u32_array(child, "pinctrl-single,gpio",
> - gpiores, PCS_MAX_GPIO_VALUES);
> - if (ret < 0)
> - continue;
> - gpio = devm_kzalloc(pcs->dev, sizeof(*gpio), GFP_KERNEL);
> - if (!gpio) {
> - dev_err(pcs->dev, "failed to allocate pcs gpio\n");
> - return -ENOMEM;
> - }
> - gpio->range.name = devm_kzalloc(pcs->dev, sizeof(name),
> - GFP_KERNEL);
> - if (!gpio->range.name) {
> - dev_err(pcs->dev, "failed to allocate range name\n");
> - return -ENOMEM;
> - }
> - memcpy((char *)gpio->range.name, name, sizeof(name));
> -
> - gpio->range.id = i++;
> - gpio->range.base = gpiores[0];
> - gpio->gpio_func = gpiores[1];
> - mux_bytes = pcs->width / BITS_PER_BYTE;
> - gpio->range.pin_base = (r.start - pcs->res->start) / mux_bytes;
> - gpio->range.npins = (r.end - r.start) / mux_bytes + 1;
> -
> - pinctrl_add_gpio_range(pcs->pctl, &gpio->range);
> - }
> - return 0;
> -}
> -
> static int pcs_probe(struct platform_device *pdev)
> {
> struct device_node *np = pdev->dev.of_node;
> @@ -1046,10 +975,6 @@ static int pcs_probe(struct platform_device *pdev)
> goto free;
> }
>
> - ret = pcs_add_gpio_range(np, pcs);
> - if (ret < 0)
> - goto free;
> -
> dev_info(pcs->dev, "%i pins at pa %p size %u\n",
> pcs->desc.npins, pcs->base, pcs->size);
>
> --
> 1.7.10.4
>
next prev parent reply other threads:[~2013-01-21 16:56 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 7:31 [PATCH v7 0/15] support pinconf in pinctrl single driver Haojian Zhuang
2013-01-18 7:31 ` [PATCH v7 01/15] Revert "pinctrl: single: support gpio request and free" Haojian Zhuang
2013-01-21 16:56 ` Tony Lindgren [this message]
2013-01-22 12:49 ` Linus Walleij
2013-01-18 7:31 ` [PATCH v7 02/15] pinctrl: core: get devname from pinctrl_dev Haojian Zhuang
2013-01-21 14:15 ` Linus Walleij
2013-01-18 7:31 ` [PATCH v7 03/15] gpio: use pinctrl device name for add range Haojian Zhuang
2013-01-21 14:20 ` Linus Walleij
2013-01-21 15:24 ` Haojian Zhuang
2013-01-18 7:31 ` [PATCH v7 04/15] gpio: set gpio range cells property as 3 Haojian Zhuang
2013-01-21 14:23 ` Linus Walleij
2013-01-18 7:31 ` [PATCH v7 05/15] gpio: fix wrong checking condition for gpio range Haojian Zhuang
2013-01-18 12:18 ` Sergei Shtylyov
2013-01-18 15:02 ` Haojian Zhuang
2013-01-18 12:21 ` Sergei Shtylyov
2013-01-18 7:31 ` [PATCH v7 06/15] gpio: find gpio base by ascend order Haojian Zhuang
2013-01-21 14:24 ` Linus Walleij
2013-02-09 13:45 ` Grant Likely
2013-02-09 17:15 ` Haojian Zhuang
2013-01-18 7:31 ` [PATCH v7 07/15] gpio: pl061: allocate irq dynamically Haojian Zhuang
2013-01-18 7:31 ` [PATCH v7 08/15] gpio: pl061: bind pinctrl by gpio request Haojian Zhuang
2013-01-21 14:37 ` Linus Walleij
2013-01-21 15:45 ` Haojian Zhuang
2013-01-22 9:10 ` Linus Walleij
2013-01-22 9:55 ` Haojian Zhuang
2013-01-22 10:10 ` Linus Walleij
2013-01-18 7:31 ` [PATCH v7 09/15] gpio: pl061: set initcall level to module init Haojian Zhuang
2013-01-21 14:41 ` Linus Walleij
2013-01-21 16:24 ` Pawel Moll
2013-01-21 20:20 ` Dinh Nguyen
2013-01-22 9:44 ` Linus Walleij
2013-01-22 15:47 ` Dinh Nguyen
2013-01-21 23:33 ` Haojian Zhuang
2013-01-22 10:21 ` Pawel Moll
2013-01-22 9:42 ` Linus Walleij
2013-01-22 10:13 ` Pawel Moll
2013-01-22 10:41 ` Russell King - ARM Linux
2013-01-22 12:55 ` Linus Walleij
2013-01-22 9:45 ` Linus Walleij
2013-01-18 7:31 ` [PATCH v7 10/15] pinctrl: single: create new gpio function range Haojian Zhuang
2013-01-18 7:31 ` [PATCH v7 11/15] pinctrl: generic: add slew rate config parameter Haojian Zhuang
2013-01-21 14:44 ` Linus Walleij
2013-01-18 7:31 ` [PATCH v7 12/15] pinctrl: generic: dump pin configuration Haojian Zhuang
2013-01-18 7:31 ` [PATCH v7 13/15] pinctrl: single: set function mask as optional Haojian Zhuang
2013-01-18 7:31 ` [PATCH v7 14/15] pinctrl: single: support generic pinconf Haojian Zhuang
2013-01-21 17:14 ` Tony Lindgren
2013-01-22 5:54 ` Haojian Zhuang
2013-01-22 18:55 ` Tony Lindgren
2013-01-18 7:31 ` [PATCH v7 15/15] ARM: hs: enable hi4511 with device tree Haojian Zhuang
2013-02-09 13:41 ` [PATCH v7 0/15] support pinconf in pinctrl single driver Grant Likely
2013-02-09 17:17 ` Haojian Zhuang
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=20130121165640.GH15361@atomide.com \
--to=tony@atomide.com \
--cc=linux-arm-kernel@lists.infradead.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 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.