mtd: rawnand: omap: Probe GPMC DM driver if enabled

GPMC is the parent of NAND controller. It needs to be probed
before NAND can work. Use uclass_get_device_by_driver() to
get and activate the GPMC driver.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
This commit is contained in:
Roger Quadros 2022-02-02 13:21:40 +02:00 committed by Praneeth Bajjuri
parent 7b569aafc9
commit 53b7e499f0
1 changed files with 12 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#include <nand.h> #include <nand.h>
#include <linux/mtd/omap_elm.h> #include <linux/mtd/omap_elm.h>
#include <soc.h> #include <soc.h>
#include <dm/uclass.h>
#define BADBLOCK_MARKER_LENGTH 2 #define BADBLOCK_MARKER_LENGTH 2
#define SECTOR_BYTES 512 #define SECTOR_BYTES 512
@ -1003,6 +1004,17 @@ int board_nand_init(struct nand_chip *nand)
int cs = cs_next++; int cs = cs_next++;
int err = 0; int err = 0;
struct omap_nand_info *info; struct omap_nand_info *info;
struct udevice *dev;
if (IS_ENABLED(CONFIG_TI_GPMC)) {
err = uclass_get_device_by_driver(UCLASS_SIMPLE_BUS,
DM_GET_DRIVER(ti_gpmc),
&dev);
if (err) {
printf("GPMC init failed: %d\n", err);
return err;
}
}
/* /*
* xloader/Uboot's gpmc configuration would have configured GPMC for * xloader/Uboot's gpmc configuration would have configured GPMC for