epd_display_init: Specify mmc partition to use
The mmc device and partition settings are global in uboot. When other parts of the code uses the mmc, the splash_init is unable to find the zplash file. This patch specifies which device and partition to use, so that it can run independant of what has been set before.zero-sugar
parent
57673afb8d
commit
0253dcb0e9
|
@ -10,6 +10,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fat.h>
|
#include <fat.h>
|
||||||
#include <memalign.h>
|
#include <memalign.h>
|
||||||
|
#include <mmc.h>
|
||||||
|
|
||||||
static int epd_splash(void);
|
static int epd_splash(void);
|
||||||
static int splash_init(void);
|
static int splash_init(void);
|
||||||
|
@ -92,14 +93,44 @@ struct splash_functions {
|
||||||
int (*blit_gc)(uint32_t*, const uint8_t*, int, int, int, int, int);
|
int (*blit_gc)(uint32_t*, const uint8_t*, int, int, int, int, int);
|
||||||
}splash;
|
}splash;
|
||||||
|
|
||||||
|
static bool mmc_set_dev_part(int dev, int part)
|
||||||
|
{
|
||||||
|
struct mmc *mmc;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
mmc = find_mmc_device(dev);
|
||||||
|
if (!mmc) {
|
||||||
|
printf("%s: no mmc device at slot %x\n", __func__, dev);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
mmc->has_init = 0;
|
||||||
|
|
||||||
|
if (mmc_init(mmc)) {
|
||||||
|
printf("%s: Unable to initialize mmc\n", __func__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = blk_select_hwpart_devnum(IF_TYPE_MMC, dev, part);
|
||||||
|
if (ret) {
|
||||||
|
printf("%s: Unable to switch partition, returned %d\n", __func__, ret);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static int splash_init(void)
|
static int splash_init(void)
|
||||||
{
|
{
|
||||||
// Load main.gz to 0x1C000000
|
|
||||||
const char *filename = "zplash";
|
const char *filename = "zplash";
|
||||||
|
const int mmc_dev = 0;
|
||||||
|
const int mmc_part = 0;
|
||||||
const u32 max_inflated_size = 100*1024;
|
const u32 max_inflated_size = 100*1024;
|
||||||
void *addr = (void*)0x80300000;
|
void *addr = (void*)0x80300000;
|
||||||
|
|
||||||
// Check if it exists
|
if (!mmc_set_dev_part(mmc_dev, mmc_part))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
// Check if splash file exists
|
||||||
if (!fat_exists(filename)) {
|
if (!fat_exists(filename)) {
|
||||||
printf("%s: %s not found\n", __func__, filename);
|
printf("%s: %s not found\n", __func__, filename);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue