All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mmc: Add support for checking device number against alias index
@ 2021-03-15 10:48 Aswath Govindraju
  2021-03-15 10:48 ` [PATCH 1/2] mmc: Check for device with a seq number equal to num before checking against index Aswath Govindraju
  2021-03-15 10:48 ` [PATCH 2/2] mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled Aswath Govindraju
  0 siblings, 2 replies; 8+ messages in thread
From: Aswath Govindraju @ 2021-03-15 10:48 UTC (permalink / raw)
  To: u-boot

The following series of patches,
- add support to check for a device with a sequence number equal to device
  number before looking for matching index
- assign device number based on node's alias index in SPL too.

Aswath Govindraju (2):
  mmc: Check for device with a seq number equal to num  before checking
    against index
  mmc: mmc-uclass: Assign devnum as alias index in SPL too  if
    CONFIG_SPL_DM_SEQ_ALIAS is enabled

 drivers/mmc/mmc-uclass.c | 10 +++++-----
 drivers/mmc/mmc.c        |  8 +++++---
 2 files changed, 10 insertions(+), 8 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] mmc: Check for device with a seq number equal to num before checking against index
  2021-03-15 10:48 [PATCH 0/2] mmc: Add support for checking device number against alias index Aswath Govindraju
@ 2021-03-15 10:48 ` Aswath Govindraju
  2021-03-16  5:48   ` Lokesh Vutla
  2021-03-16 21:40   ` Jaehoon Chung
  2021-03-15 10:48 ` [PATCH 2/2] mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled Aswath Govindraju
  1 sibling, 2 replies; 8+ messages in thread
From: Aswath Govindraju @ 2021-03-15 10:48 UTC (permalink / raw)
  To: u-boot

First check if there is an alias for the device tree node defined with the
given num before checking against device index.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
---
 drivers/mmc/mmc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b4c8e7f293bd..1e83007286b2 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -3052,9 +3052,11 @@ int mmc_init_device(int num)
 	struct mmc *m;
 	int ret;
 
-	ret = uclass_get_device(UCLASS_MMC, num, &dev);
-	if (ret)
-		return ret;
+	if (uclass_get_device_by_seq(UCLASS_MMC, num, &dev)) {
+		ret = uclass_get_device(UCLASS_MMC, num, &dev);
+		if (ret)
+			return ret;
+	}
 
 	m = mmc_get_mmc_dev(dev);
 	if (!m)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled
  2021-03-15 10:48 [PATCH 0/2] mmc: Add support for checking device number against alias index Aswath Govindraju
  2021-03-15 10:48 ` [PATCH 1/2] mmc: Check for device with a seq number equal to num before checking against index Aswath Govindraju
@ 2021-03-15 10:48 ` Aswath Govindraju
  2021-03-16  5:48   ` Lokesh Vutla
                     ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Aswath Govindraju @ 2021-03-15 10:48 UTC (permalink / raw)
  To: u-boot

Assign the nodes alias index as the device number in SPL too, if
CONFIG_SPL_DM_SEQ_ALIAS is enabled.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
---
 drivers/mmc/mmc-uclass.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 53eabc9e612d..67fcba3c207c 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -387,11 +387,11 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
 
 	if (!mmc_get_ops(dev))
 		return -ENOSYS;
-#ifndef CONFIG_SPL_BUILD
-	/* Use the fixed index with aliase node's index */
-	ret = dev_read_alias_seq(dev, &devnum);
-	debug("%s: alias ret=%d, devnum=%d\n", __func__, ret, devnum);
-#endif
+	if (IS_ENABLED(CONFIG_SPL_DM_SEQ_ALIAS)) {
+		/* Use the fixed index with aliase node's index */
+		ret = dev_read_alias_seq(dev, &devnum);
+		debug("%s: alias ret=%d, devnum=%d\n", __func__, ret, devnum);
+	}
 
 	ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC,
 			devnum, 512, 0, &bdev);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/2] mmc: Check for device with a seq number equal to num before checking against index
  2021-03-15 10:48 ` [PATCH 1/2] mmc: Check for device with a seq number equal to num before checking against index Aswath Govindraju
@ 2021-03-16  5:48   ` Lokesh Vutla
  2021-03-16 21:40   ` Jaehoon Chung
  1 sibling, 0 replies; 8+ messages in thread
From: Lokesh Vutla @ 2021-03-16  5:48 UTC (permalink / raw)
  To: u-boot



On 15/03/21 4:18 pm, Aswath Govindraju wrote:
> First check if there is an alias for the device tree node defined with the
> given num before checking against device index.
> 
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>

Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>

Thanks and regards,
Lokesh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled
  2021-03-15 10:48 ` [PATCH 2/2] mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled Aswath Govindraju
@ 2021-03-16  5:48   ` Lokesh Vutla
  2021-03-16 21:40   ` Jaehoon Chung
  2021-03-25  6:11   ` Aswath Govindraju
  2 siblings, 0 replies; 8+ messages in thread
From: Lokesh Vutla @ 2021-03-16  5:48 UTC (permalink / raw)
  To: u-boot



On 15/03/21 4:18 pm, Aswath Govindraju wrote:
> Assign the nodes alias index as the device number in SPL too, if
> CONFIG_SPL_DM_SEQ_ALIAS is enabled.
> 
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
> ---
>  drivers/mmc/mmc-uclass.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 53eabc9e612d..67fcba3c207c 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -387,11 +387,11 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
>  
>  	if (!mmc_get_ops(dev))
>  		return -ENOSYS;
> -#ifndef CONFIG_SPL_BUILD
> -	/* Use the fixed index with aliase node's index */
> -	ret = dev_read_alias_seq(dev, &devnum);
> -	debug("%s: alias ret=%d, devnum=%d\n", __func__, ret, devnum);
> -#endif
> +	if (IS_ENABLED(CONFIG_SPL_DM_SEQ_ALIAS)) {
> +		/* Use the fixed index with aliase node's index */
> +		ret = dev_read_alias_seq(dev, &devnum);
> +		debug("%s: alias ret=%d, devnum=%d\n", __func__, ret, devnum);
> +	}
>  


Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>

Thanks and regards,
Lokesh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] mmc: Check for device with a seq number equal to num before checking against index
  2021-03-15 10:48 ` [PATCH 1/2] mmc: Check for device with a seq number equal to num before checking against index Aswath Govindraju
  2021-03-16  5:48   ` Lokesh Vutla
@ 2021-03-16 21:40   ` Jaehoon Chung
  1 sibling, 0 replies; 8+ messages in thread
From: Jaehoon Chung @ 2021-03-16 21:40 UTC (permalink / raw)
  To: u-boot

On 3/15/21 7:48 PM, Aswath Govindraju wrote:
> First check if there is an alias for the device tree node defined with the
> given num before checking against device index.
> 
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>


Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/mmc.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index b4c8e7f293bd..1e83007286b2 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -3052,9 +3052,11 @@ int mmc_init_device(int num)
>  	struct mmc *m;
>  	int ret;
>  
> -	ret = uclass_get_device(UCLASS_MMC, num, &dev);
> -	if (ret)
> -		return ret;
> +	if (uclass_get_device_by_seq(UCLASS_MMC, num, &dev)) {
> +		ret = uclass_get_device(UCLASS_MMC, num, &dev);
> +		if (ret)
> +			return ret;
> +	}
>  
>  	m = mmc_get_mmc_dev(dev);
>  	if (!m)
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled
  2021-03-15 10:48 ` [PATCH 2/2] mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled Aswath Govindraju
  2021-03-16  5:48   ` Lokesh Vutla
@ 2021-03-16 21:40   ` Jaehoon Chung
  2021-03-25  6:11   ` Aswath Govindraju
  2 siblings, 0 replies; 8+ messages in thread
From: Jaehoon Chung @ 2021-03-16 21:40 UTC (permalink / raw)
  To: u-boot

On 3/15/21 7:48 PM, Aswath Govindraju wrote:
> Assign the nodes alias index as the device number in SPL too, if
> CONFIG_SPL_DM_SEQ_ALIAS is enabled.
> 
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>


Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/mmc-uclass.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 53eabc9e612d..67fcba3c207c 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -387,11 +387,11 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
>  
>  	if (!mmc_get_ops(dev))
>  		return -ENOSYS;
> -#ifndef CONFIG_SPL_BUILD
> -	/* Use the fixed index with aliase node's index */
> -	ret = dev_read_alias_seq(dev, &devnum);
> -	debug("%s: alias ret=%d, devnum=%d\n", __func__, ret, devnum);
> -#endif
> +	if (IS_ENABLED(CONFIG_SPL_DM_SEQ_ALIAS)) {
> +		/* Use the fixed index with aliase node's index */
> +		ret = dev_read_alias_seq(dev, &devnum);
> +		debug("%s: alias ret=%d, devnum=%d\n", __func__, ret, devnum);
> +	}
>  
>  	ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC,
>  			devnum, 512, 0, &bdev);
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled
  2021-03-15 10:48 ` [PATCH 2/2] mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled Aswath Govindraju
  2021-03-16  5:48   ` Lokesh Vutla
  2021-03-16 21:40   ` Jaehoon Chung
@ 2021-03-25  6:11   ` Aswath Govindraju
  2 siblings, 0 replies; 8+ messages in thread
From: Aswath Govindraju @ 2021-03-25  6:11 UTC (permalink / raw)
  To: u-boot

Hi all,

On 15/03/21 4:18 pm, Aswath Govindraju wrote:
> Assign the nodes alias index as the device number in SPL too, if
> CONFIG_SPL_DM_SEQ_ALIAS is enabled.
> 
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
> ---
>  drivers/mmc/mmc-uclass.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 53eabc9e612d..67fcba3c207c 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -387,11 +387,11 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
>  
>  	if (!mmc_get_ops(dev))
>  		return -ENOSYS;
> -#ifndef CONFIG_SPL_BUILD
> -	/* Use the fixed index with aliase node's index */
> -	ret = dev_read_alias_seq(dev, &devnum);
> -	debug("%s: alias ret=%d, devnum=%d\n", __func__, ret, devnum);
> -#endif
> +	if (IS_ENABLED(CONFIG_SPL_DM_SEQ_ALIAS)) {
> +		/* Use the fixed index with aliase node's index */
> +		ret = dev_read_alias_seq(dev, &devnum);
> +		debug("%s: alias ret=%d, devnum=%d\n", __func__, ret, devnum);
> +	}
>  
>  	ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC,
>  			devnum, 512, 0, &bdev);
> 

dev_read_alias_seq() has dependency on CONFIG_SPL_OF_LIBFDT. There is a
possiblility that CONFIG_SPL_OF_LIBFDT is disabled and
CONFIG_SPL_DM_SEQ_ALIAS is enabled, this would lead to break in builds.

To remove this dependency dev_seq() can be used instead of
dev_read_alias_seq(). I will be respining this series after making this
change.

Thanks,
Aswath

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-03-25  6:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 10:48 [PATCH 0/2] mmc: Add support for checking device number against alias index Aswath Govindraju
2021-03-15 10:48 ` [PATCH 1/2] mmc: Check for device with a seq number equal to num before checking against index Aswath Govindraju
2021-03-16  5:48   ` Lokesh Vutla
2021-03-16 21:40   ` Jaehoon Chung
2021-03-15 10:48 ` [PATCH 2/2] mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled Aswath Govindraju
2021-03-16  5:48   ` Lokesh Vutla
2021-03-16 21:40   ` Jaehoon Chung
2021-03-25  6:11   ` Aswath Govindraju

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.