diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-05-10 18:15:50 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-05-10 18:15:50 +0200 |
commit | e7dad8c88a19e7130b4241bfe1f251620850ce4b (patch) | |
tree | a75ceec92f5e08744f09fc0a4acda4b21d3c21c4 /arch/arm/mach-layerscape/boot.c | |
parent | f33d27e9715a7ff077d603162b1def42cd408317 (diff) | |
parent | 51d850a0a8e736d6883f981bbea108dd9e110b0a (diff) | |
download | barebox-e7dad8c88a19e7130b4241bfe1f251620850ce4b.tar.gz barebox-e7dad8c88a19e7130b4241bfe1f251620850ce4b.tar.xz |
Merge branch 'for-next/layerscape'
Diffstat (limited to 'arch/arm/mach-layerscape/boot.c')
-rw-r--r-- | arch/arm/mach-layerscape/boot.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/arm/mach-layerscape/boot.c b/arch/arm/mach-layerscape/boot.c new file mode 100644 index 0000000000..c804977d22 --- /dev/null +++ b/arch/arm/mach-layerscape/boot.c @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <common.h> +#include <init.h> +#include <bootsource.h> +#include <mach/layerscape.h> +#include <soc/fsl/immap_lsch2.h> + +enum bootsource ls1046_bootsource_get(void) +{ + void __iomem *dcfg = IOMEM(LSCH2_DCFG_ADDR); + uint32_t rcw_src; + + rcw_src = in_be32(dcfg) >> 23; + + if (rcw_src == 0x40) + return BOOTSOURCE_MMC; + if ((rcw_src & 0x1fe) == 0x44) + return BOOTSOURCE_SPI_NOR; + if ((rcw_src & 0x1f0) == 0x10) + /* 8bit NOR Flash */ + return BOOTSOURCE_NOR; + if ((rcw_src & 0x1f0) == 0x20) + /* 16bit NOR Flash */ + return BOOTSOURCE_NOR; + + return BOOTSOURCE_UNKNOWN; +} + +static int ls1046a_bootsource_init(void) +{ + if (!of_machine_is_compatible("fsl,ls1046a")) + return 0; + + bootsource_set(ls1046_bootsource_get()); + + return 0; +} +coredevice_initcall(ls1046a_bootsource_init);
\ No newline at end of file |