blob: 19b4560494c7b7ec2e9d0a07c271bfae7b8726cc [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada81c847b2017-02-14 01:24:25 +09002/*
3 * Copyright (C) 2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada81c847b2017-02-14 01:24:25 +09005 */
6
7#include <common.h>
8#include <mmc.h>
9#include <spl.h>
10
11u32 spl_boot_mode(const u32 boot_device)
12{
13 struct mmc *mmc;
14
15 /*
Masahiro Yamada00aa4532017-08-13 09:01:13 +090016 * work around a bug in the Boot ROM of LD4, Pro4, and sLD8:
Masahiro Yamada81c847b2017-02-14 01:24:25 +090017 *
18 * The boot ROM in these SoCs breaks the PARTITION_CONFIG [179] of
19 * Extended CSD register; when switching to the Boot Partition 1, the
20 * Boot ROM should issue the SWITCH command (CMD6) with Set Bits for
21 * the Access Bits, but in fact it uses Write Byte for the Access Bits.
22 * As a result, the BOOT_PARTITION_ENABLE field of the PARTITION_CONFIG
23 * is lost. This bug was fixed for PH1-Pro5 and later SoCs.
24 *
25 * Fixup mmc->part_config here because it is used to determine the
26 * partition which the U-Boot image is read from.
27 */
28 mmc = find_mmc_device(0);
29 mmc->part_config &= ~EXT_CSD_BOOT_PART_NUM(PART_ACCESS_MASK);
30 mmc->part_config |= EXT_CSD_BOOT_PARTITION_ENABLE;
31
32 return MMCSD_MODE_EMMCBOOT;
33}