Message ID | 20200330033158.26751-6-walter.lozano@collabora.com |
---|---|
State | RFC |
Delegated to: | Stefano Babic |
Headers | show |
Series | mx6cuboxi: enable OF_PLATDATA with MMC support | expand |
Hi Walter, On Sun, 29 Mar 2020 at 21:32, Walter Lozano <walter.lozano@collabora.com> wrote: > > Signed-off-by: Walter Lozano <walter.lozano@collabora.com> > --- > drivers/gpio/mxc_gpio.c | 27 ++++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c > index c924e52f07..ba63c0b76a 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_fsl_imx6q_gpio dtplat; > +#endif > int bank_index; > struct gpio_regs *regs; > }; > @@ -303,8 +309,16 @@ static int mxc_gpio_bind(struct udevice *dev) > * is statically initialized in U_BOOT_DEVICES.Here > * will return. > */ > - if (plat) > + > + if (plat) { > +#if CONFIG_IS_ENABLED(OF_PLATDATA) > + struct dtd_fsl_imx6q_gpio *dtplat = &plat->dtplat; > + > + plat->regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]); > + plat->bank_index = dev->req_seq; > +#endif > return 0; > + } > > addr = devfdt_get_addr(dev); > if (addr == FDT_ADDR_T_NONE) > @@ -347,6 +361,17 @@ U_BOOT_DRIVER(gpio_mxc) = { > .bind = mxc_gpio_bind, > }; > > +#if CONFIG_IS_ENABLED(OF_PLATDATA) > +U_BOOT_DRIVER(fsl_imx6q_gpio) = { Please drop this and find a way to use the existing U_BOOT_DRIVER() declaration. > + .name = "fsl_imx6q_gpio", > + .id = UCLASS_GPIO, > + .ops = &gpio_mxc_ops, > + .probe = mxc_gpio_probe, > + .priv_auto_alloc_size = sizeof(struct mxc_bank_info), > + .bind = mxc_gpio_bind, > +}; > +#endif > + > #if !CONFIG_IS_ENABLED(OF_CONTROL) > static const struct mxc_gpio_plat mxc_plat[] = { > { 0, (struct gpio_regs *)GPIO1_BASE_ADDR }, > -- > 2.20.1 > Regards, Simon
Hi Simon, On 6/4/20 00:42, Simon Glass wrote: > Hi Walter, > > On Sun, 29 Mar 2020 at 21:32, Walter Lozano<walter.lozano@collabora.com> wrote: >> Signed-off-by: Walter Lozano<walter.lozano@collabora.com> >> --- >> drivers/gpio/mxc_gpio.c | 27 ++++++++++++++++++++++++++- >> 1 file changed, 26 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c >> index c924e52f07..ba63c0b76a 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_fsl_imx6q_gpio dtplat; >> +#endif >> int bank_index; >> struct gpio_regs *regs; >> }; >> @@ -303,8 +309,16 @@ static int mxc_gpio_bind(struct udevice *dev) >> * is statically initialized in U_BOOT_DEVICES.Here >> * will return. >> */ >> - if (plat) >> + >> + if (plat) { >> +#if CONFIG_IS_ENABLED(OF_PLATDATA) >> + struct dtd_fsl_imx6q_gpio *dtplat = &plat->dtplat; >> + >> + plat->regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]); >> + plat->bank_index = dev->req_seq; >> +#endif >> return 0; >> + } >> >> addr = devfdt_get_addr(dev); >> if (addr == FDT_ADDR_T_NONE) >> @@ -347,6 +361,17 @@ U_BOOT_DRIVER(gpio_mxc) = { >> .bind = mxc_gpio_bind, >> }; >> >> +#if CONFIG_IS_ENABLED(OF_PLATDATA) >> +U_BOOT_DRIVER(fsl_imx6q_gpio) = { > Please drop this and find a way to use the existing U_BOOT_DRIVER() declaration. Thanks for pointing it. This discussion already began in a previous patch from this series, so probably the best way to accomplish this will be discussed there. >> + .name = "fsl_imx6q_gpio", >> + .id = UCLASS_GPIO, >> + .ops = &gpio_mxc_ops, >> + .probe = mxc_gpio_probe, >> + .priv_auto_alloc_size = sizeof(struct mxc_bank_info), >> + .bind = mxc_gpio_bind, >> +}; >> +#endif >> + >> #if !CONFIG_IS_ENABLED(OF_CONTROL) >> static const struct mxc_gpio_plat mxc_plat[] = { >> { 0, (struct gpio_regs *)GPIO1_BASE_ADDR }, >> -- >> 2.20.1 >> > Regards, > Simon
diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c index c924e52f07..ba63c0b76a 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_fsl_imx6q_gpio dtplat; +#endif int bank_index; struct gpio_regs *regs; }; @@ -303,8 +309,16 @@ static int mxc_gpio_bind(struct udevice *dev) * is statically initialized in U_BOOT_DEVICES.Here * will return. */ - if (plat) + + if (plat) { +#if CONFIG_IS_ENABLED(OF_PLATDATA) + struct dtd_fsl_imx6q_gpio *dtplat = &plat->dtplat; + + plat->regs = map_sysmem(dtplat->reg[0], dtplat->reg[1]); + plat->bank_index = dev->req_seq; +#endif return 0; + } addr = devfdt_get_addr(dev); if (addr == FDT_ADDR_T_NONE) @@ -347,6 +361,17 @@ U_BOOT_DRIVER(gpio_mxc) = { .bind = mxc_gpio_bind, }; +#if CONFIG_IS_ENABLED(OF_PLATDATA) +U_BOOT_DRIVER(fsl_imx6q_gpio) = { + .name = "fsl_imx6q_gpio", + .id = UCLASS_GPIO, + .ops = &gpio_mxc_ops, + .probe = mxc_gpio_probe, + .priv_auto_alloc_size = sizeof(struct mxc_bank_info), + .bind = mxc_gpio_bind, +}; +#endif + #if !CONFIG_IS_ENABLED(OF_CONTROL) static const struct mxc_gpio_plat mxc_plat[] = { { 0, (struct gpio_regs *)GPIO1_BASE_ADDR },
Signed-off-by: Walter Lozano <walter.lozano@collabora.com> --- drivers/gpio/mxc_gpio.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)