From: Walter Lozano <walter.lozano@collabora.com>
To: u-boot@lists.denx.de
Subject: [PATCH v3 3/6] gpio: mxc_gpio: add OF_PLATDATA support
Date: Wed, 29 Jul 2020 12:31:18 -0300 [thread overview]
Message-ID: <20200729153121.29548-4-walter.lozano@collabora.com> (raw)
In-Reply-To: <20200729153121.29548-1-walter.lozano@collabora.com>
Continuing with the OF_PLATADATA support for iMX6 to reduce SPL
footprint, add it to mxc_gpio. Thanks to this, it will be possible to
enable card detection on MMC driver.
Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---
Changes in v3:
- Rework to resolve merge conflicts
drivers/gpio/mxc_gpio.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index a16f5719ed..e7585fce7b 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -13,6 +13,8 @@
#include <asm/arch/imx-regs.h>
#include <asm/gpio.h>
#include <asm/io.h>
+#include <dt-structs.h>
+#include <mapmem.h>
enum mxc_gpio_direction {
MXC_GPIO_DIRECTION_IN,
@@ -22,6 +24,10 @@ enum mxc_gpio_direction {
#define GPIO_PER_BANK 32
struct mxc_gpio_plat {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+ /* Put this first since driver model will copy the data here */
+ struct dtd_gpio_mxc dtplat;
+#endif
int bank_index;
struct gpio_regs *regs;
};
@@ -280,6 +286,12 @@ static int mxc_gpio_probe(struct udevice *dev)
int banknum;
char name[18], *str;
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+ struct dtd_gpio_mxc *dtplat = &plat->dtplat;
+
+ plat->regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
+#endif
+
banknum = plat->bank_index;
if (IS_ENABLED(CONFIG_ARCH_IMX8))
sprintf(name, "GPIO%d_", banknum);
@@ -297,14 +309,16 @@ static int mxc_gpio_probe(struct udevice *dev)
static int mxc_gpio_ofdata_to_platdata(struct udevice *dev)
{
- fdt_addr_t addr;
struct mxc_gpio_plat *plat = dev_get_platdata(dev);
+ if (!CONFIG_IS_ENABLED(OF_PLATDATA)) {
+ fdt_addr_t addr;
- addr = dev_read_addr(dev);
- if (addr == FDT_ADDR_T_NONE)
- return -EINVAL;
+ addr = dev_read_addr(dev);
+ if (addr == FDT_ADDR_T_NONE)
+ return -EINVAL;
- plat->regs = (struct gpio_regs *)addr;
+ plat->regs = (struct gpio_regs *)addr;
+ }
plat->bank_index = dev->req_seq;
return 0;
@@ -332,6 +346,8 @@ U_BOOT_DRIVER(gpio_mxc) = {
.bind = mxc_gpio_bind,
};
+U_BOOT_DRIVER_ALIAS(gpio_mxc, fsl_imx6q_gpio)
+
#if !CONFIG_IS_ENABLED(OF_CONTROL)
static const struct mxc_gpio_plat mxc_plat[] = {
{ 0, (struct gpio_regs *)GPIO1_BASE_ADDR },
--
2.20.1
next prev parent reply other threads:[~2020-07-29 15:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 15:31 [PATCH v3 0/6] mx6cuboxi: enable OF_PLATDATA with MMC support Walter Lozano
2020-07-29 15:31 ` [PATCH v3 1/6] mmc: fsl_esdhc_imx: rename driver name to match ll_entry Walter Lozano
2020-08-04 8:52 ` sbabic at denx.de
2020-07-29 15:31 ` [PATCH v3 2/6] mmc: fsl_esdhc_imx: add OF_PLATDATA support Walter Lozano
2020-08-04 8:52 ` sbabic at denx.de
2020-07-29 15:31 ` Walter Lozano [this message]
2020-08-04 8:52 ` [PATCH v3 3/6] gpio: mxc_gpio: " sbabic at denx.de
2020-07-29 15:31 ` [PATCH v3 4/6] mmc: fsl_esdhc_imx: add CD support when OF_PLATDATA is enabled Walter Lozano
2020-08-04 8:52 ` sbabic at denx.de
2020-07-29 15:31 ` [PATCH v3 5/6] drivers: rename more drivers to match compatible string Walter Lozano
2020-08-04 8:52 ` sbabic at denx.de
2020-07-29 15:31 ` [PATCH v3 6/6] mx6cuboxi: enable OF_PLATDATA Walter Lozano
2020-08-04 8:52 ` sbabic at denx.de
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=20200729153121.29548-4-walter.lozano@collabora.com \
--to=walter.lozano@collabora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox