From: Przemyslaw Marczak <p.marczak@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v9 12/12] dm: exynos: gpio: Convert to driver model
Date: Mon, 20 Oct 2014 16:55:54 +0200 [thread overview]
Message-ID: <5445227A.2090102@samsung.com> (raw)
In-Reply-To: <1413362282-25451-13-git-send-email-sjg@chromium.org>
Hello Simon,
On 10/15/2014 10:38 AM, Simon Glass wrote:
> Convert the exynos GPIO driver to driver model. This implements the generic
> GPIO interface but not the extra Exynos-specific functions.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v9:
> - Add missing compatible strings from exynos_gpio_ids[]
>
> Changes in v8:
> - Enable driver model for smdkc100 and s5p_goni separately
>
> Changes in v7:
> - Bring in patches from the SPI series to move post-reloc DM init earlier
>
> Changes in v6: None
> Changes in v5:
> - Remove RFC label now that build errors are fixed
> - Tidy up and update cover letter message
> - Avoid reordering functions
>
> Changes in v4:
> - Add patches for exynos GPIO support
>
> drivers/gpio/s5p_gpio.c | 424 +++++++++++++++++++++++++++-------------
> include/configs/exynos-common.h | 4 +
> include/configs/s5p_goni.h | 3 +
> include/configs/smdkc100.h | 3 +
> 4 files changed, 298 insertions(+), 136 deletions(-)
>
> diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
> index 99f2dd8..13d74eb 100644
> --- a/drivers/gpio/s5p_gpio.c
> +++ b/drivers/gpio/s5p_gpio.c
> @@ -6,8 +6,15 @@
> */
>
..snip..
> +/**
> + * We have a top-level GPIO device with no actual GPIOs. It has a child
> + * device for each Exynos GPIO bank.
> + */
> +static int gpio_exynos_bind(struct udevice *parent)
> +{
> + struct exynos_gpio_platdata *plat = parent->platdata;
> + struct s5p_gpio_bank *bank, *base;
> + const void *blob = gd->fdt_blob;
> + int node;
> +
> + /* If this is a child device, there is nothing to do here */
> + if (plat)
> + return 0;
> +
> + base = (struct s5p_gpio_bank *)fdtdec_get_addr(gd->fdt_blob,
> + parent->of_offset, "reg");
> + for (node = fdt_first_subnode(blob, parent->of_offset), bank = base;
> + node > 0;
> + node = fdt_next_subnode(blob, node), bank++) {
Here (bank++) you assume, that order of subnodes of each pinctrl is the
same like in dts file - as I wrote in comment to patch 04 - it isn't.
> + struct exynos_gpio_platdata *plat;
> + struct udevice *dev;
> + fdt_addr_t reg;
> + int ret;
> +
> + if (!fdtdec_get_bool(blob, node, "gpio-controller"))
> + continue;
> + plat = calloc(1, sizeof(*plat));
> + if (!plat)
> + return -ENOMEM;
Some parts of GPIO banks, for which "reg" can be found are prober.
> + reg = fdtdec_get_addr(blob, node, "reg");
> + if (reg != FDT_ADDR_T_NONE)
> + bank = (struct s5p_gpio_bank *)((ulong)base + reg);
> + plat->bank = bank;
> + plat->bank_name = fdt_get_name(blob, node, NULL);
> + debug("dev at %p: %s\n", bank, plat->bank_name);
> +
> + ret = device_bind(parent, parent->driver,
> + plat->bank_name, plat, -1, &dev);
> + if (ret)
> + return ret;
> + dev->of_offset = parent->of_offset;
> + }
> +
> + return 0;
> +}
> +
> +static const struct udevice_id exynos_gpio_ids[] = {
> + { .compatible = "samsung,s5pc100-pinctrl" },
> + { .compatible = "samsung,s5pc110-pinctrl" },
> + { .compatible = "samsung,exynos4210-pinctrl" },
> + { .compatible = "samsung,exynos4x12-pinctrl" },
> + { .compatible = "samsung,exynos5250-pinctrl" },
> + { .compatible = "samsung,exynos5420-pinctrl" },
> + { }
... snip ...
And this is not the end of issues:)
Unfortunately Exynos4xxx has a gaps in GPIO bank address space, and the
big gpio enum lists includes that here:
arch/arm/include/asm/arch-exynos/gpio.h
This works for Exynos5, because it's enum list is linear.
And the driver gpio-uclass.c - assumes that the gpio numbers are linear.
When I removed the gaps in enum for 4x12 -then gpio is mapped good.
And after remove the enum gaps, it also requires fitting the gpios in
dts files, e.g. cd-gpio, pwr-gpios for sdhci host.
Sorry for such late reply in v9 but, before it seems working fine - I
didn't try to check the sd card before.
I hope that after that fixes, everything will work fine:)
Best Regards,
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
next prev parent reply other threads:[~2014-10-20 14:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 8:37 [U-Boot] [PATCH v9 0/12] Enable driver model for GPIOs on Tegra and Exynos Simon Glass
2014-10-15 8:37 ` [U-Boot] [PATCH v9 01/12] dm: exynos: dts: Convert /include/ to #include Simon Glass
2014-10-15 8:37 ` [U-Boot] [PATCH v9 02/12] dm: exynos: Bring in pinctrl dts files from Linux kernel Simon Glass
2014-10-15 8:37 ` [U-Boot] [PATCH v9 03/12] dm: exynos: dts: Remove unused pinctrl information to save space Simon Glass
2014-10-15 8:37 ` [U-Boot] [PATCH v9 04/12] dm: exynos: dts: Adjust device tree files for U-Boot Simon Glass
2014-10-20 14:55 ` Przemyslaw Marczak
2014-10-20 15:29 ` Simon Glass
2014-10-15 8:37 ` [U-Boot] [PATCH v9 05/12] dm: exynos: Add pinctrl settings for smdkc100 Simon Glass
2014-10-15 8:37 ` [U-Boot] [PATCH v9 06/12] dm: exynos: Add pinctrl settings for s5p_goni Simon Glass
2014-10-15 8:37 ` [U-Boot] [PATCH v9 07/12] dm: exynos: Move smdkc100 to generic board Simon Glass
2014-10-15 8:37 ` [U-Boot] [PATCH v9 08/12] dm: exynos: Move s5p_goni " Simon Glass
2014-10-15 8:37 ` [U-Boot] [PATCH v9 09/12] dm: exynos: Tidy up GPIO headers Simon Glass
2014-10-15 8:38 ` [U-Boot] [PATCH v9 10/12] dm: exynos: Tidy up GPIO defines Simon Glass
2014-10-15 8:38 ` [U-Boot] [PATCH v9 11/12] dm: exynos: Make sure that GPIOs are requested Simon Glass
2014-10-15 8:38 ` [U-Boot] [PATCH v9 12/12] dm: exynos: gpio: Convert to driver model Simon Glass
2014-10-20 14:55 ` Przemyslaw Marczak [this message]
2014-10-20 15:31 ` Simon Glass
2014-10-20 15:53 ` Przemyslaw Marczak
2014-10-20 16:06 ` Przemyslaw Marczak
2014-10-20 17:26 ` Simon Glass
2014-10-20 14:54 ` [U-Boot] [PATCH v9 0/12] Enable driver model for GPIOs on Tegra and Exynos Przemyslaw Marczak
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=5445227A.2090102@samsung.com \
--to=p.marczak@samsung.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.