2
* Copyright 2014 Freescale Semiconductor
4
* SPDX-License-Identifier: GPL-2.0+
6
* Freescale T2080RDB board-specific CPLD controlling supports.
13
u8 cpld_read(unsigned int reg)
15
void *p = (void *)CONFIG_SYS_CPLD_BASE;
20
void cpld_write(unsigned int reg, u8 value)
22
void *p = (void *)CONFIG_SYS_CPLD_BASE;
24
out_8(p + reg, value);
27
/* Set the boot bank to the alternate bank */
28
void cpld_set_altbank(void)
30
u8 reg = CPLD_READ(flash_csr);
32
reg = (reg & ~CPLD_BANK_SEL_MASK) | CPLD_LBMAP_ALTBANK;
33
CPLD_WRITE(flash_csr, reg);
34
CPLD_WRITE(reset_ctl, CPLD_LBMAP_RESET);
37
/* Set the boot bank to the default bank */
38
void cpld_set_defbank(void)
40
u8 reg = CPLD_READ(flash_csr);
42
reg = (reg & ~CPLD_BANK_SEL_MASK) | CPLD_LBMAP_DFLTBANK;
43
CPLD_WRITE(flash_csr, reg);
44
CPLD_WRITE(reset_ctl, CPLD_LBMAP_RESET);
47
int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
52
return cmd_usage(cmdtp);
54
if (strcmp(argv[1], "reset") == 0) {
55
if (strcmp(argv[2], "altbank") == 0)
60
rc = cmd_usage(cmdtp);
67
cpld, CONFIG_SYS_MAXARGS, 1, do_cpld,
68
"Reset the board or alternate bank",
69
"reset: reset to default bank\n"
70
"cpld reset altbank: reset to alternate bank\n"