diff mbox series

[v2,3/6] gpio: mxc_gpio: add OF_PLATDATA support

Message ID 20200722131438.12215-4-walter.lozano@collabora.com
State Superseded
Delegated to: Stefano Babic
Headers show
Series mx6cuboxi: enable OF_PLATDATA with MMC support | expand

Commit Message

Walter Lozano July 22, 2020, 1:14 p.m. UTC
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>
---

(no changes since v1)

 drivers/gpio/mxc_gpio.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Simon Glass July 26, 2020, 2:54 p.m. UTC | #1
On Wed, 22 Jul 2020 at 07:14, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> 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>
> ---
>
> (no changes since v1)
>
>  drivers/gpio/mxc_gpio.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Stefano Babic July 27, 2020, 12:10 p.m. UTC | #2
Hi Walter,

On 22.07.20 15:14, Walter Lozano wrote:
> 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>
> ---
> 

This conflicts with commit 6103e570cdd0d0e854b071ee17b14589356a82bd
Author: Ye Li <ye.li@nxp.com>
Date:   Tue Jun 9 20:29:51 2020 -0700

    gpio: mxc_gpio: Improve to use ofdata_to_platdata

already mainlined. Can you take a look ? Thanks !

Best regards,
Stefano

> (no changes since v1)
> 
>  drivers/gpio/mxc_gpio.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
> index 316dcc757b..fc49b5b577 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;
>  };
> @@ -306,8 +312,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_gpio_mxc *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)
> @@ -350,6 +364,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 },
>
Walter Lozano July 29, 2020, 3:32 p.m. UTC | #3
Hi Stefano,

On 27/7/20 09:10, Stefano Babic wrote:
> Hi Walter,
>
> On 22.07.20 15:14, Walter Lozano wrote:
>> 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>
>> ---
>>
> This conflicts with commit 6103e570cdd0d0e854b071ee17b14589356a82bd
> Author: Ye Li <ye.li@nxp.com>
> Date:   Tue Jun 9 20:29:51 2020 -0700
>
>      gpio: mxc_gpio: Improve to use ofdata_to_platdata
>
> already mainlined. Can you take a look ? Thanks !
>
Sure, thanks for pointing at the issue. I've already sent a new version.

Regards,

Walter

>> (no changes since v1)
>>
>>   drivers/gpio/mxc_gpio.c | 18 +++++++++++++++++-
>>   1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
>> index 316dcc757b..fc49b5b577 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;
>>   };
>> @@ -306,8 +312,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_gpio_mxc *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)
>> @@ -350,6 +364,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 },
>>
>
diff mbox series

Patch

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index 316dcc757b..fc49b5b577 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;
 };
@@ -306,8 +312,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_gpio_mxc *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)
@@ -350,6 +364,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 },