307 lines
7.5 KiB
Diff
307 lines
7.5 KiB
Diff
--- a/drivers/core/device.c
|
|
+++ b/drivers/core/device.c
|
|
@@ -8,6 +8,8 @@
|
|
* Pavel Herrmann <morpheus.ibis@gmail.com>
|
|
*/
|
|
|
|
+#define DEBUG
|
|
+
|
|
#include <common.h>
|
|
#include <cpu_func.h>
|
|
#include <event.h>
|
|
--- a/common/spl/spl_mmc.c
|
|
+++ b/common/spl/spl_mmc.c
|
|
@@ -5,6 +5,9 @@
|
|
*
|
|
* Aneesh V <aneesh@ti.com>
|
|
*/
|
|
+
|
|
+#define DEBUG
|
|
+
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <log.h>
|
|
@@ -155,6 +158,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
|
|
int err, mmc_dev;
|
|
|
|
mmc_dev = spl_mmc_get_device_index(boot_device);
|
|
+ printf("spl: mmc get device index : %d\n", mmc_dev);
|
|
if (mmc_dev < 0)
|
|
return mmc_dev;
|
|
|
|
@@ -423,10 +427,13 @@ int spl_mmc_load(struct spl_image_info *spl_image,
|
|
|
|
/* Perform peripheral init only once for an mmc device */
|
|
mmc_dev = spl_mmc_get_device_index(bootdev->boot_device);
|
|
+ printf("spl: mmc_dev: %d\n", mmc_dev);
|
|
if (!mmc || spl_mmc_get_mmc_devnum(mmc) != mmc_dev) {
|
|
err = spl_mmc_find_device(&mmc, bootdev->boot_device);
|
|
- if (err)
|
|
+ if (err) {
|
|
+ printf("spl: mmc find device failed: %d\n", err);
|
|
return err;
|
|
+ }
|
|
|
|
err = mmc_init(mmc);
|
|
if (err) {
|
|
@@ -438,6 +445,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
|
|
}
|
|
}
|
|
|
|
+ debug("spl: on passe par ici\n");
|
|
boot_mode = spl_mmc_boot_mode(mmc, bootdev->boot_device);
|
|
err = -EINVAL;
|
|
switch (boot_mode) {
|
|
--- a/drivers/mmc/mmc-uclass.c
|
|
+++ b/drivers/mmc/mmc-uclass.c
|
|
@@ -5,6 +5,8 @@
|
|
* Written by Simon Glass <sjg@chromium.org>
|
|
*/
|
|
|
|
+#define DEBUG
|
|
+
|
|
#define LOG_CATEGORY UCLASS_MMC
|
|
|
|
#include <common.h>
|
|
--- a/drivers/mmc/mmc.c
|
|
+++ b/drivers/mmc/mmc.c
|
|
@@ -7,6 +7,8 @@
|
|
* Based vaguely on the Linux code
|
|
*/
|
|
|
|
+#define DEBUG
|
|
+
|
|
#include <config.h>
|
|
#include <common.h>
|
|
#include <blk.h>
|
|
@@ -3105,11 +3107,14 @@ int mmc_init_device(int num)
|
|
struct udevice *dev;
|
|
struct mmc *m;
|
|
int ret;
|
|
-
|
|
+ debug("mmc_init_device: num: %d\n", num);
|
|
if (uclass_get_device_by_seq(UCLASS_MMC, num, &dev)) {
|
|
+ debug("mmc_init_device: uclass_get_device_by_seq\n");
|
|
ret = uclass_get_device(UCLASS_MMC, num, &dev);
|
|
- if (ret)
|
|
+ if (ret) {
|
|
+ debug("mmc_init_device: uclass_get_device ret : %d\n", ret);
|
|
return ret;
|
|
+ }
|
|
}
|
|
|
|
m = mmc_get_mmc_dev(dev);
|
|
--- a/drivers/core/uclass.c
|
|
+++ b/drivers/core/uclass.c
|
|
@@ -6,6 +6,8 @@
|
|
* Pavel Herrmann <morpheus.ibis@gmail.com>
|
|
*/
|
|
|
|
+#define DEBUG
|
|
+
|
|
#define LOG_CATEGORY LOGC_DM
|
|
|
|
#include <common.h>
|
|
@@ -29,12 +31,14 @@ struct uclass *uclass_find(enum uclass_id key)
|
|
|
|
if (!gd->dm_root)
|
|
return NULL;
|
|
+ log_debug("uclass_find, key: %d\n", key);
|
|
/*
|
|
* TODO(sjg@chromium.org): Optimise this, perhaps moving the found
|
|
* node to the start of the list, or creating a linear array mapping
|
|
* id to node.
|
|
*/
|
|
list_for_each_entry(uc, gd->uclass_root, sibling_node) {
|
|
+ log_debug("uclass_find, id: %d - key: %d\n", uc->uc_drv->id, key);
|
|
if (uc->uc_drv->id == key)
|
|
return uc;
|
|
}
|
|
@@ -57,6 +61,7 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp)
|
|
struct uclass *uc;
|
|
int ret;
|
|
|
|
+ log_debug("uclass_add, id: %d\n", id);
|
|
*ucp = NULL;
|
|
uc_drv = lists_uclass_lookup(id);
|
|
if (!uc_drv) {
|
|
@@ -69,14 +74,19 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp)
|
|
*/
|
|
return -EPFNOSUPPORT;
|
|
}
|
|
+ log_debug("uclass_add, uclass_driver name: %s - id: %d\n", uc_drv->name, uc_drv->id);
|
|
uc = calloc(1, sizeof(*uc));
|
|
- if (!uc)
|
|
+ if (!uc) {
|
|
+ log_debug("uclass_add, calloc failed\n");
|
|
return -ENOMEM;
|
|
+ }
|
|
if (uc_drv->priv_auto) {
|
|
void *ptr;
|
|
+ log_debug("uclass_add, priv_auto\n");
|
|
|
|
ptr = calloc(1, uc_drv->priv_auto);
|
|
if (!ptr) {
|
|
+ log_debug("uclass_add, priv_auto calloc failed\n");
|
|
ret = -ENOMEM;
|
|
goto fail_mem;
|
|
}
|
|
@@ -85,22 +95,28 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp)
|
|
uc->uc_drv = uc_drv;
|
|
INIT_LIST_HEAD(&uc->sibling_node);
|
|
INIT_LIST_HEAD(&uc->dev_head);
|
|
+ log_debug("uclass_add, list_add\n");
|
|
list_add(&uc->sibling_node, DM_UCLASS_ROOT_NON_CONST);
|
|
|
|
if (uc_drv->init) {
|
|
+ log_debug("uclass_add, uc_drv->init exists ...\n");
|
|
ret = uc_drv->init(uc);
|
|
- if (ret)
|
|
+ if (ret) {
|
|
+ log_debug("uclass_add, uc_drv->init() failed (%d)\n", ret);
|
|
goto fail;
|
|
+ }
|
|
}
|
|
|
|
*ucp = uc;
|
|
|
|
+ log_debug("uclass_add, ends ...\n");
|
|
return 0;
|
|
fail:
|
|
if (uc_drv->priv_auto) {
|
|
free(uclass_get_priv(uc));
|
|
uclass_set_priv(uc, NULL);
|
|
}
|
|
+ log_debug("uclass_add, destroy list ...\n");
|
|
list_del(&uc->sibling_node);
|
|
fail_mem:
|
|
free(uc);
|
|
@@ -146,12 +162,14 @@ int uclass_get(enum uclass_id id, struct uclass **ucp)
|
|
{
|
|
struct uclass *uc;
|
|
|
|
+ log_debug("uclass_get, id: %d\n", id);
|
|
/* Immediately fail if driver model is not set up */
|
|
if (!gd->uclass_root)
|
|
return -EDEADLK;
|
|
*ucp = NULL;
|
|
uc = uclass_find(id);
|
|
if (!uc) {
|
|
+ log_debug("uclass_get, not find\n");
|
|
if (CONFIG_IS_ENABLED(OF_PLATDATA_INST))
|
|
return -ENOENT;
|
|
return uclass_add(id, ucp);
|
|
@@ -228,19 +246,26 @@ int uclass_find_device(enum uclass_id id, int index, struct udevice **devp)
|
|
int ret;
|
|
|
|
*devp = NULL;
|
|
+ log_debug("uclass_find_device, id: %d, index: %d\n", id, index);
|
|
ret = uclass_get(id, &uc);
|
|
- if (ret)
|
|
+ if (ret) {
|
|
+ log_debug("uclass_find_device, ret: %d\n", ret);
|
|
return ret;
|
|
- if (list_empty(&uc->dev_head))
|
|
+ }
|
|
+ if (list_empty(&uc->dev_head)) {
|
|
+ log_debug("uclass_find_device, list_empty - ENODEV\n");
|
|
return -ENODEV;
|
|
+ }
|
|
|
|
uclass_foreach_dev(dev, uc) {
|
|
if (!index--) {
|
|
*devp = dev;
|
|
+ log_debug("uclass_find_device, OK\n");
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
+ log_debug("uclass_find_device, return ENODEV\n");
|
|
return -ENODEV;
|
|
}
|
|
|
|
@@ -335,7 +360,7 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq, struct udevice **devp)
|
|
int ret;
|
|
|
|
*devp = NULL;
|
|
- log_debug("%d\n", seq);
|
|
+ log_debug("uclass_find_device_by_seq, id : %d - seq: %d\n", id, seq);
|
|
if (seq == -1)
|
|
return -ENODEV;
|
|
ret = uclass_get(id, &uc);
|
|
@@ -483,6 +508,7 @@ int uclass_get_device(enum uclass_id id, int index, struct udevice **devp)
|
|
int ret;
|
|
|
|
*devp = NULL;
|
|
+ log_debug("uclass_get_device, id: %d, index: %d\n", id, index);
|
|
ret = uclass_find_device(id, index, &dev);
|
|
return uclass_get_device_tail(dev, ret, devp);
|
|
}
|
|
@@ -504,6 +530,7 @@ int uclass_get_device_by_seq(enum uclass_id id, int seq, struct udevice **devp)
|
|
int ret;
|
|
|
|
*devp = NULL;
|
|
+ log_debug("uclass_get_device_by_seq, id: %d, seq: %d\n", id, seq);
|
|
ret = uclass_find_device_by_seq(id, seq, &dev);
|
|
|
|
return uclass_get_device_tail(dev, ret, devp);
|
|
--- a/drivers/core/root.c
|
|
+++ b/drivers/core/root.c
|
|
@@ -6,6 +6,8 @@
|
|
* Pavel Herrmann <morpheus.ibis@gmail.com>
|
|
*/
|
|
|
|
+#define DEBUG
|
|
+
|
|
#define LOG_CATEGORY UCLASS_ROOT
|
|
|
|
#include <common.h>
|
|
@@ -170,6 +172,7 @@ int dm_init(bool of_live)
|
|
{
|
|
int ret;
|
|
|
|
+ log_debug("dm_init\n");
|
|
if (gd->dm_root) {
|
|
dm_warn("Virtual root driver already exists!\n");
|
|
return -EINVAL;
|
|
@@ -207,6 +210,7 @@ int dm_init(bool of_live)
|
|
|
|
INIT_LIST_HEAD((struct list_head *)&gd->dmtag_list);
|
|
|
|
+ log_debug("dm_init ends\n");
|
|
return 0;
|
|
}
|
|
|
|
@@ -397,6 +401,7 @@ static int dm_scan(bool pre_reloc_only)
|
|
{
|
|
int ret;
|
|
|
|
+ log_debug("dm_scan\n");
|
|
ret = dm_scan_plat(pre_reloc_only);
|
|
if (ret) {
|
|
debug("dm_scan_plat() failed: %d\n", ret);
|
|
@@ -415,6 +420,7 @@ static int dm_scan(bool pre_reloc_only)
|
|
if (ret)
|
|
return ret;
|
|
|
|
+ log_debug("dm_scan ends\n");
|
|
return dm_probe_devices(gd->dm_root, pre_reloc_only);
|
|
}
|
|
|
|
@@ -422,6 +428,7 @@ int dm_init_and_scan(bool pre_reloc_only)
|
|
{
|
|
int ret;
|
|
|
|
+ log_debug("dm_init_and_scan\n");
|
|
ret = dm_init(CONFIG_IS_ENABLED(OF_LIVE));
|
|
if (ret) {
|
|
debug("dm_init() failed: %d\n", ret);
|
|
@@ -440,6 +447,7 @@ int dm_init_and_scan(bool pre_reloc_only)
|
|
return log_msg_ret("ev", ret);
|
|
}
|
|
|
|
+ log_debug("dm_init_and_scan ends ...\n");
|
|
return 0;
|
|
}
|
|
|