blob: 4689ed79fdc8cf434ac4c674b3aeb3b9b40436da [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +09002/*
Masahiro Yamadae27d6c72017-01-21 18:05:26 +09003 * Copyright (C) 2016-2017 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +09005 */
6
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +09007#include <spl.h>
8#include <linux/io.h>
Masahiro Yamada784548e2017-02-14 01:24:26 +09009#include <linux/kernel.h>
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090010
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090011#include "boot-device.h"
12
Masahiro Yamada784548e2017-02-14 01:24:26 +090013const struct uniphier_boot_device uniphier_ld11_boot_device_table[] = {
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090014 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, EraseSize 128KB, Addr 4)"},
15 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, EraseSize 128KB, Addr 4)"},
16 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, EraseSize 128KB, Addr 5)"},
17 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, EraseSize 128KB, Addr 5)"},
18 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, EraseSize 256KB, Addr 5)"},
19 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, EraseSize 256KB, Addr 5)"},
20 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, EraseSize 512KB, Addr 5)"},
21 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, EraseSize 512KB, Addr 5)"},
22 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, EraseSize 128KB, Addr 4)"},
23 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, EraseSize 128KB, Addr 4)"},
24 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, EraseSize 128KB, Addr 5)"},
25 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, EraseSize 128KB, Addr 5)"},
26 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, EraseSize 256KB, Addr 5)"},
27 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, EraseSize 256KB, Addr 5)"},
28 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, EraseSize 512KB, Addr 5)"},
29 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, EraseSize 512KB, Addr 5)"},
30 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, ONFI, Addr 4)"},
31 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, ONFI, Addr 4)"},
32 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 8, ONFI, Addr 5)"},
33 {BOOT_DEVICE_NAND, "NAND (Mirror 8, ECC 16, ONFI, Addr 5)"},
34 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, ONFI Addr 4)"},
35 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, ONFI Addr 4)"},
36 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 8, ONFI Addr 5)"},
37 {BOOT_DEVICE_NAND, "NAND (Mirror 1, ECC 16, ONFI Addr 5)"},
38 {BOOT_DEVICE_MMC1, "eMMC (Legacy, 4bit, 1.8V, Training Off)"},
39 {BOOT_DEVICE_MMC1, "eMMC (Legacy, 4bit, 1.8V, Training On)"},
40 {BOOT_DEVICE_MMC1, "eMMC (Legacy, 8bit, 1.8V, Training Off)"},
41 {BOOT_DEVICE_MMC1, "eMMC (Legacy, 8bit, 1.8V, Training On)"},
42 {BOOT_DEVICE_MMC1, "eMMC (High Speed SDR, 8bit, 1.8V, Training Off)"},
43 {BOOT_DEVICE_MMC1, "eMMC (High Speed SDR, 8bit, 1.8V, Training On)"},
44 {BOOT_DEVICE_MMC1, "eMMC (Legacy, 4bit, 1.8V, Training Off)"},
Masahiro Yamada6a555b22016-05-24 21:13:58 +090045 {BOOT_DEVICE_NOR, "NOR (XECS1)"},
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090046};
47
Masahiro Yamada784548e2017-02-14 01:24:26 +090048const unsigned uniphier_ld11_boot_device_count =
49 ARRAY_SIZE(uniphier_ld11_boot_device_table);
50
51int uniphier_ld11_boot_device_is_usb(u32 pinmon)
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090052{
Masahiro Yamada784548e2017-02-14 01:24:26 +090053 return !!(~pinmon & 0x00000080);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090054}
55
Masahiro Yamada784548e2017-02-14 01:24:26 +090056int uniphier_ld20_boot_device_is_usb(u32 pinmon)
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090057{
Masahiro Yamada784548e2017-02-14 01:24:26 +090058 return !!(~pinmon & 0x00000780);
Masahiro Yamada9d0c2ce2016-04-21 14:43:18 +090059}