blob: 11e70a926fc84eb4f4cd152b8c6e8b8e6f5de2f4 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada063eb1e2016-04-21 14:43:18 +09002/*
Masahiro Yamada31649052017-01-21 18:05:26 +09003 * Copyright (C) 2016-2017 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada063eb1e2016-04-21 14:43:18 +09005 */
6
7#include <common.h>
8#include <spl.h>
9#include <linux/io.h>
Masahiro Yamadafb092032017-02-14 01:24:26 +090010#include <linux/kernel.h>
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090011
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090012#include "boot-device.h"
13
Masahiro Yamadafb092032017-02-14 01:24:26 +090014const struct uniphier_boot_device uniphier_ld11_boot_device_table[] = {
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090015 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, EraseSize 128KB, Addr 4)"},
16 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, EraseSize 128KB, Addr 4)"},
17 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, EraseSize 128KB, Addr 5)"},
18 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, EraseSize 128KB, Addr 5)"},
19 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, EraseSize 256KB, Addr 5)"},
20 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, EraseSize 256KB, Addr 5)"},
21 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, EraseSize 512KB, Addr 5)"},
22 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, EraseSize 512KB, Addr 5)"},
23 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, EraseSize 128KB, Addr 4)"},
24 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, EraseSize 128KB, Addr 4)"},
25 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, EraseSize 128KB, Addr 5)"},
26 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, EraseSize 128KB, Addr 5)"},
27 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, EraseSize 256KB, Addr 5)"},
28 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, EraseSize 256KB, Addr 5)"},
29 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, EraseSize 512KB, Addr 5)"},
30 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, EraseSize 512KB, Addr 5)"},
31 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, ONFI, Addr 4)"},
32 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, ONFI, Addr 4)"},
33 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, ONFI, Addr 5)"},
34 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, ONFI, Addr 5)"},
35 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, ONFI Addr 4)"},
36 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, ONFI Addr 4)"},
37 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, ONFI Addr 5)"},
38 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, ONFI Addr 5)"},
39 {BOOT_DEVICE_MMC1, "eMMC (Legacy, 4bit, 1.8V, Training Off)"},
40 {BOOT_DEVICE_MMC1, "eMMC (Legacy, 4bit, 1.8V, Training On)"},
41 {BOOT_DEVICE_MMC1, "eMMC (Legacy, 8bit, 1.8V, Training Off)"},
42 {BOOT_DEVICE_MMC1, "eMMC (Legacy, 8bit, 1.8V, Training On)"},
43 {BOOT_DEVICE_MMC1, "eMMC (High Speed SDR, 8bit, 1.8V, Training Off)"},
44 {BOOT_DEVICE_MMC1, "eMMC (High Speed SDR, 8bit, 1.8V, Training On)"},
45 {BOOT_DEVICE_MMC1, "eMMC (Legacy, 4bit, 1.8V, Training Off)"},
Masahiro Yamadafd9256d2016-05-24 21:13:58 +090046 {BOOT_DEVICE_NOR, "NOR (XECS1)"},
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090047};
48
Masahiro Yamadafb092032017-02-14 01:24:26 +090049const unsigned uniphier_ld11_boot_device_count =
50 ARRAY_SIZE(uniphier_ld11_boot_device_table);
51
52int uniphier_ld11_boot_device_is_usb(u32 pinmon)
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090053{
Masahiro Yamadafb092032017-02-14 01:24:26 +090054 return !!(~pinmon & 0x00000080);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090055}
56
Masahiro Yamadafb092032017-02-14 01:24:26 +090057int uniphier_ld20_boot_device_is_usb(u32 pinmon)
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090058{
Masahiro Yamadafb092032017-02-14 01:24:26 +090059 return !!(~pinmon & 0x00000780);
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090060}