Add support for initializing MMC
PATCH 1/1 Add support for initializing MMC
From: Tien Fong Chee <[email protected]>
Firmware loader would encounter problem if the MMC is accessed before initializing it. This patch would adding the support of initializing MMC before the MMC is accessed by firmware loader.
--- drivers/misc/fs_loader.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
drivers/misc/fs_loader.c +31 -0
@@ -12,6 +12,7 @@#include <linux/string.h> #include <mapmem.h> #include <malloc.h> +#include <mmc.h> #include <spl.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -252,6 +253,36 @@ static int fs_loader_ofdata_to_platdata(struct udevice *dev)static int fs_loader_probe (struct udevice *dev) { +#ifdef CONFIG_MMC +int ret; +struct device_platdata *plat = dev->platdata; + + ret =mmc_initialize (NULL ); +if (ret) { +debug ("MMC: could not initialize mmc. error: %d\n" , ret); + +return ret; + } + +if (plat->phandlepart.phandle) { +ofnode node =ofnode_get_by_phandle (plat->phandlepart.phandle); + +struct udevice *mmc_dev =NULL ; + + ret =device_get_global_by_ofnode (node, &mmc_dev); +if (!ret) { +struct mmc *mmc =mmc_get_mmc_dev (mmc_dev); + + ret =mmc_init (mmc); +if (ret) { +debug ("MMC: mmc init failed with error: %d\n" , + ret); + +return ret; + } + } + } +#endif return 0 ; };
Signature · 1 line
1.7.7.4
Chee
PATCH 1/1 Add support for initializing MMC
Quoted 11 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Firmware loader would encounter problem if the MMC is accessed before initializing it. This patch would adding the support of initializing MMC before the MMC is accessed by firmware loader.
Signed-off-by Tien Fong Chee <[email protected]>---
drivers/misc/fs_loader.c | 31 +++++++++++++++++++++++++++++++1 files changed, 31 insertions(+), 0 deletions(-)
Any comment for this patch?
Quoted 53 lines
drivers/misc/fs_loader.c +1
-0@@ -12,6 +12,7 @@ #include <linux/string.h> #include <mapmem.h> #include <malloc.h> +#include <mmc.h> #include <spl.h>
DECLARE_GLOBAL_DATA_PTR;drivers/misc/fs_loader.c +0
-0@@ -252,6 +253,36 @@ static int fs_loader_ofdata_to_platdata(struct udevice *dev)
static intfs_loader_probe(struct udevice *dev)
{drivers/misc/fs_loader.c +7
-0+#ifdef CONFIG_MMC +int ret; +struct device_platdata *plat = dev->platdata; + + ret =mmc_initialize (NULL ); +if (ret) { + debug("MMC: could not initialize mmc. error: %d\n",ret);
drivers/misc/fs_loader.c +6
-0+ +return ret; + } + +if (plat->phandlepart.phandle) { + ofnode node = ofnode_get_by_phandle(plat-Quoted 1 line
phandlepart.phandle);
drivers/misc/fs_loader.c +10
-0+ +struct udevice *mmc_dev =NULL ; + + ret =device_get_global_by_ofnode (node, &mmc_dev); +if (!ret) { +struct mmc *mmc =mmc_get_mmc_dev (mmc_dev); + + ret =mmc_init (mmc); +if (ret) { + debug("MMC: mmc init failed witherror: %d\n",
drivers/misc/fs_loader.c +7
-0+ ret); + + return ret; + } + } + } +#endif return 0;
};
PATCH 1/1 Add support for initializing MMC
Hi,
Quoted 8 lines · Tien Fong
Quoted 6 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Firmware loader would encounter problem if the MMC is accessed before initializing it. This patch would adding the support of initializing MMC before the MMC is accessed by firmware loader.
Quoted 6 lines
Quoted 5 lines
Signed-off-by Tien Fong Chee <[email protected]>--- drivers/misc/fs_loader.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)Any comment for this patch?
This should not be needed with CONFIG_DM_MMC enabled as it should be enough to probe the mmc device. Is that right?
Regards,
Simon
Quoted 54 lines
Quoted 54 lines
drivers/misc/fs_loader.c +24
-0@@ -12,6 +12,7 @@#include <linux/string.h> #include <mapmem.h> #include <malloc.h> +#include <mmc.h> #include <spl.h> DECLARE_GLOBAL_DATA_PTR ;@@ -252,6 +253,36 @@ static int fs_loader_ofdata_to_platdata(struct udevice *dev)static int fs_loader_probe (struct udevice *dev) { +#ifdef CONFIG_MMC +int ret; +struct device_platdata *plat = dev->platdata; + + ret =mmc_initialize (NULL ); +if (ret) { +debug ("MMC: could not initialize mmc. error: %d\n" , ret); + +return ret; + } + +if (plat->phandlepart.phandle) { +ofnode node =ofnode_get_by_phandle (plat- >phandlepart.phandle); + +struct udevice *mmc_dev =NULL ; + + ret =device_get_global_by_ofnode (node, &mmc_dev); +if (!ret) { +struct mmc *mmc =mmc_get_mmc_dev (mmc_dev); + + ret =mmc_init (mmc); +if (ret) { + debug("MMC: mmc init failed witherror: %d\n",
drivers/misc/fs_loader.c +7
-0+ ret); + + return ret; + } + } + } +#endif return 0 ; };
Chee
PATCH 1/1 Add support for initializing MMC
Quoted 16 lines · Simon Glass
Hi,
Quoted 12 lines · Tien Fong
Quoted 9 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Firmware loader would encounter problem if the MMC is accessed before
initializing it. This patch would adding the support of initializing
MMC before the MMC is accessed by firmware loader.
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Signed-off-by Tien Fong Chee <[email protected]>---
drivers/misc/fs_loader.c | 31 +++++++++++++++++++++++++++++++1 files changed, 31 insertions(+), 0 deletions(-)Any comment for this patch?
This should not be needed with
CONFIG_DM_MMCenabled as it should be enough to probe the mmc device. Is that right?
No, CONFIG_DM_MMC is required, otherwise compiler would tell you error. This whole mechanism is always developed in DM context. What's your concern? You want me to add CONFIG_DM_MMC or replace with CONFIG_MMC? or You want to improve the document?
Quoted 62 lines
Regards,
SimonQuoted 58 lines
Quoted 58 lines
drivers/misc/fs_loader.c +1
-0@@ -12,6 +12,7 @@ #include <linux/string.h> #include <mapmem.h> #include <malloc.h> +#include <mmc.h> #include <spl.h> DECLARE_GLOBAL_DATA_PTR;@@ -252,6 +253,36 @@ static intfs_loader_ofdata_to_platdata(struct
udevice *dev)static int
fs_loader_probe(struct udevice *dev)
{drivers/misc/fs_loader.c +7
-0+#ifdef CONFIG_MMC + int ret; + struct device_platdata *plat = dev->platdata; + + ret = mmc_initialize(NULL); + if (ret) { + debug("MMC: could not initialize mmc. error: %d\n",ret);
drivers/misc/fs_loader.c +6
-0+ + return ret; + } + + if (plat->phandlepart.phandle) { + ofnode node = ofnode_get_by_phandle(plat-Quoted 2 lines
phandlepart.phandle);
drivers/misc/fs_loader.c +10
-0+ + struct udevice *mmc_dev = NULL; + + ret = device_get_global_by_ofnode(node, &mmc_dev); + if (!ret) { + struct mmc *mmc = mmc_get_mmc_dev(mmc_dev); + + ret = mmc_init(mmc); + if (ret) { + debug("MMC: mmc init failed witherror: %d\n",
+ ret);drivers/misc/fs_loader.c +6
-0+ + return ret; + } + } + } +#endif return 0;
};
PATCH 1/1 Add support for initializing MMC
Hi Tien,
Quoted 23 lines · Tien Fong
Quoted 21 lines · Simon Glass
Hi,
Quoted 17 lines · Tien Fong
Quoted 14 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Firmware loader would encounter problem if the MMC is accessed before
initializing it. This patch would adding the support of initializing
MMC before the MMC is accessed by firmware loader.Signed-off-by Tien Fong Chee <[email protected]>--- drivers/misc/fs_loader.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Any comment for this patch?
This should not be needed with
CONFIG_DM_MMCenabled as it should be enough to probe the mmc device. Is that right?No,
CONFIG_DM_MMCis required, otherwise compiler would tell you error. This whole mechanism is always developed in DM context. What's your concern? You want me to addCONFIG_DM_MMCor replace withCONFIG_MMC? or You want to improve the document?
Well, mmc_blk_probe() calls mmc_init() on the device. So instead of the code you have, would it be possible to probe the blk device? You can use device_find_first_child() for that. Perhaps write a function in blk.h which probes the first block device for a parent?
Regards,
Simon
Chee
PATCH 1/1 Add support for initializing MMC
Quoted 45 lines · Simon Glass
Hi Tien,
Quoted 35 lines · Tien Fong
Quoted 28 lines · Simon Glass
Hi,
Quoted 22 lines · Tien Fong
Quoted 17 lines · tien.fong.chee at intel.com
From: Tien Fong Chee <[email protected]>
Firmware loader would encounter problem if the MMC is accessed
before
initializing it. This patch would adding the support of initializing
MMC before the MMC is accessed by firmware loader.Signed-off-by Tien Fong Chee <[email protected]>---
drivers/misc/fs_loader.c | 31
+++++++++++++++++++++++++++++++1 files changed, 31 insertions(+), 0 deletions(-)Quoted 4 lines
Quoted 1 line
Any comment for this patch?
This should not be needed with
CONFIG_DM_MMCenabled as it should be
enough to probe the mmc device. Is that right?Quoted 6 lines
No,
CONFIG_DM_MMCis required, otherwise compiler would tell you error.
This whole mechanism is always developed in DM context. What's your concern? You want me to addCONFIG_DM_MMCor replace withCONFIG_MMC? or You want to improve the document?
Quoted 4 lines
Well,
mmc_blk_probe()callsmmc_init()on the device. So instead of the code you have, would it be possible to probe the blk device? You can usedevice_find_first_child()for that. Perhaps write a function inblk.hwhich probes the first block device for a parent?
Yeah, sure. Let me find out more info.
Quoted 3 lines
Regards,
Simon