mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-10-03 12:52:07 +00:00
a8d9758d01
C29XPCIE board is a series of Freescale PCIe add-in cards to perform as public key crypto accelerator or secure key management module. It includes C293PCIE board, C293PCIE board and C291PCIE board. - 512KB platform SRAM in addition to 512K L2 Cache/SRAM - 512MB soldered DDR3 32bit memory - CPLD System Logic - 64MB x16 NOR flash and 4GB x8 NAND flash - 16MB SPI flash Signed-off-by: Mingkai Hu <Mingkai.Hu@freescale.com> Singed-off-by: Po Liu <Po.Liu@freescale.com> [yorksun: Fixup include/configs/C29XPCIE.h] Signed-off-by: York Sun <yorksun@freescale.com>
134 lines
3.6 KiB
C
134 lines
3.6 KiB
C
/**
|
|
* Copyright 2013 Freescale Semiconductor
|
|
* Author: Mingkai Hu <Mingkai.hu@freescale.com>
|
|
* Po Liu <Po.Liu@freescale.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
* Software Foundation; either version 2 of the License, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This file provides support for the board-specific CPLD used on some Freescale
|
|
* reference boards.
|
|
*
|
|
* The following macros need to be defined:
|
|
*
|
|
* CONFIG_SYS_CPLD_BASE - The virtual address of the base of the
|
|
* CPLD register map
|
|
*
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <command.h>
|
|
#include <asm/io.h>
|
|
|
|
#include "cpld.h"
|
|
/**
|
|
* Set the boot bank to the alternate bank
|
|
*/
|
|
void cpld_set_altbank(u8 banksel)
|
|
{
|
|
struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
|
|
u8 reg11;
|
|
|
|
reg11 = in_8(&cpld_data->flhcsr);
|
|
|
|
switch (banksel) {
|
|
case 1:
|
|
out_8(&cpld_data->flhcsr, (reg11 & CPLD_BANKSEL_MASK)
|
|
| CPLD_BANKSEL_EN | CPLD_SELECT_BANK1);
|
|
break;
|
|
case 2:
|
|
out_8(&cpld_data->flhcsr, (reg11 & CPLD_BANKSEL_MASK)
|
|
| CPLD_BANKSEL_EN | CPLD_SELECT_BANK2);
|
|
break;
|
|
case 3:
|
|
out_8(&cpld_data->flhcsr, (reg11 & CPLD_BANKSEL_MASK)
|
|
| CPLD_BANKSEL_EN | CPLD_SELECT_BANK3);
|
|
break;
|
|
case 4:
|
|
out_8(&cpld_data->flhcsr, (reg11 & CPLD_BANKSEL_MASK)
|
|
| CPLD_BANKSEL_EN | CPLD_SELECT_BANK4);
|
|
break;
|
|
default:
|
|
printf("Invalid value! [1-4]\n");
|
|
return;
|
|
}
|
|
|
|
udelay(100);
|
|
do_reset(NULL, 0, 0, NULL);
|
|
}
|
|
|
|
/**
|
|
* Set the boot bank to the default bank
|
|
*/
|
|
void cpld_set_defbank(void)
|
|
{
|
|
cpld_set_altbank(4);
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
static void cpld_dump_regs(void)
|
|
{
|
|
struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
|
|
|
|
printf("chipid1 = 0x%02x\n", in_8(&cpld_data->chipid1));
|
|
printf("chipid2 = 0x%02x\n", in_8(&cpld_data->chipid2));
|
|
printf("hwver = 0x%02x\n", in_8(&cpld_data->hwver));
|
|
printf("cpldver = 0x%02x\n", in_8(&cpld_data->cpldver));
|
|
printf("rstcon = 0x%02x\n", in_8(&cpld_data->rstcon));
|
|
printf("flhcsr = 0x%02x\n", in_8(&cpld_data->flhcsr));
|
|
printf("wdcsr = 0x%02x\n", in_8(&cpld_data->wdcsr));
|
|
printf("wdkick = 0x%02x\n", in_8(&cpld_data->wdkick));
|
|
printf("fancsr = 0x%02x\n", in_8(&cpld_data->fancsr));
|
|
printf("ledcsr = 0x%02x\n", in_8(&cpld_data->ledcsr));
|
|
printf("misc = 0x%02x\n", in_8(&cpld_data->misccsr));
|
|
printf("bootor = 0x%02x\n", in_8(&cpld_data->bootor));
|
|
printf("bootcfg1 = 0x%02x\n", in_8(&cpld_data->bootcfg1));
|
|
printf("bootcfg2 = 0x%02x\n", in_8(&cpld_data->bootcfg2));
|
|
printf("bootcfg3 = 0x%02x\n", in_8(&cpld_data->bootcfg3));
|
|
printf("bootcfg4 = 0x%02x\n", in_8(&cpld_data->bootcfg4));
|
|
putc('\n');
|
|
}
|
|
#endif
|
|
|
|
int cpld_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
{
|
|
int rc = 0;
|
|
unsigned char value;
|
|
|
|
if (argc <= 1)
|
|
return cmd_usage(cmdtp);
|
|
|
|
if (strcmp(argv[1], "reset") == 0) {
|
|
if (!strcmp(argv[2], "altbank") && argv[3]) {
|
|
value = (u8)simple_strtoul(argv[3], NULL, 16);
|
|
cpld_set_altbank(value);
|
|
} else if (!argv[2])
|
|
cpld_set_defbank();
|
|
else
|
|
cmd_usage(cmdtp);
|
|
#ifdef DEBUG
|
|
} else if (strcmp(argv[1], "dump") == 0) {
|
|
cpld_dump_regs();
|
|
#endif
|
|
} else
|
|
rc = cmd_usage(cmdtp);
|
|
|
|
return rc;
|
|
}
|
|
|
|
U_BOOT_CMD(
|
|
cpld_cmd, CONFIG_SYS_MAXARGS, 1, cpld_cmd,
|
|
"Reset the board using the CPLD sequencer",
|
|
"reset - hard reset to default bank 4\n"
|
|
"cpld_cmd reset altbank [bank]- reset to alternate bank\n"
|
|
" - [bank] bank value select 1-4\n"
|
|
" - bank 1 on the flash 0x0000000~0x0ffffff\n"
|
|
" - bank 2 on the flash 0x1000000~0x1ffffff\n"
|
|
" - bank 3 on the flash 0x2000000~0x2ffffff\n"
|
|
" - bank 4 on the flash 0x3000000~0x3ffffff\n"
|
|
#ifdef DEBUG
|
|
"cpld_cmd dump - display the CPLD registers\n"
|
|
#endif
|
|
);
|