mmc: Add support for checking device number against alias index
cover mmc: Add support for checking device number against alias index
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(-)
Signature · 1 line
2.17.1
PATCH 1/2 mmc: Check for device with a seq number equal to num before checking against index
First check if there is an alias for the device tree node defined with the given num before checking against device index.
--- drivers/mmc/mmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/mmc.c +5 -3
@@ -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)
Signature · 1 line
2.17.1
PATCH 1/2 mmc: Check for device with a seq number equal to num before checking against index
Quoted 4 lines · Aswath Govindraju
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 <[email protected]>
Thanks and regards,
Lokesh
PATCH 1/2 mmc: Check for device with a seq number equal to num before checking against index
In reply to Aswath GovindrajuQuoted 4 lines · Aswath Govindraju
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 <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 24 lines
--- drivers/mmc/mmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/mmc/mmc.c +5
-3@@ -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)
PATCH 2/2 mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled
In reply to Aswath GovindrajuAssign the nodes alias index as the device number in SPL too, if CONFIG_SPL_DM_SEQ_ALIAS is enabled.
--- drivers/mmc/mmc-uclass.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mmc/mmc-uclass.c +5 -5
@@ -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);
Signature · 1 line
2.17.1
PATCH 2/2 mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled
Quoted 17 lines · Aswath Govindraju
Assign the nodes alias index as the device number in SPL too, if
CONFIG_SPL_DM_SEQ_ALIASis enabled.Signed-off-by Aswath Govindraju <[email protected]>--- drivers/mmc/mmc-uclass.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/mmc/mmc-uclass.c +0
-1@@ -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
drivers/mmc/mmc-uclass.c int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg) · line 395
Quoted 10 lines
drivers/mmc/mmc-uclass.c +5
-4-/* 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); + }
Thanks and regards,
Lokesh
PATCH 2/2 mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled
In reply to Aswath GovindrajuQuoted 4 lines · Aswath Govindraju
Assign the nodes alias index as the device number in SPL too, if
CONFIG_SPL_DM_SEQ_ALIASis enabled.Signed-off-by Aswath Govindraju <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 26 lines
--- drivers/mmc/mmc-uclass.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/mmc/mmc-uclass.c +5
-5@@ -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);
PATCH 2/2 mmc: mmc-uclass: Assign devnum as alias index in SPL too if CONFIG_SPL_DM_SEQ_ALIAS is enabled
In reply to Aswath GovindrajuHi all,
Quoted 20 lines · Aswath Govindraju
Assign the nodes alias index as the device number in SPL too, if
CONFIG_SPL_DM_SEQ_ALIASis enabled.Signed-off-by Aswath Govindraju <[email protected]>--- drivers/mmc/mmc-uclass.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/mmc/mmc-uclass.c +0
-3@@ -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);
drivers/mmc/mmc-uclass.c int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg) · line 397
Quoted 10 lines
drivers/mmc/mmc-uclass.c +5
-2-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