2 * Copyright 2010 Freescale Semiconductor
3 * Author: Timur Tabi <timur@freescale.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
10 * This file provides support for the ngPIXIS, a board-specific FPGA used on
11 * some Freescale reference boards.
13 * A "switch" is black rectangular block on the motherboard. It contains
14 * eight "bits". The ngPIXIS has a set of memory-mapped registers (SWx) that
15 * shadow the actual physical switches. There is also another set of
16 * registers (ENx) that tell the ngPIXIS which bits of SWx should actually be
17 * used to override the values of the bits in the physical switches.
19 * The following macros need to be defined:
21 * PIXIS_BASE - The virtual address of the base of the PIXIS register map
23 * PIXIS_LBMAP_SWITCH - The switch number (i.e. the "x" in "SWx"). This value
24 * is used in the PIXIS_SW() macro to determine which offset in
25 * the PIXIS register map corresponds to the physical switch that controls
28 * PIXIS_LBMAP_MASK - A bit mask the defines which bits in SWx to use.
30 * PIXIS_LBMAP_SHIFT - The shift value that corresponds to PIXIS_LBMAP_MASK.
32 * PIXIS_LBMAP_ALTBANK - The value to program into SWx to tell the ngPIXIS to
33 * boot from the alternate bank.
39 #include <asm/cache.h>
45 * Reset the board. This ignores the ENx registers.
47 void pixis_reset(void)
49 out_8(&pixis->rst, 0);
55 * Reset the board. Like pixis_reset(), but it honors the ENx registers.
57 void pixis_bank_reset(void)
59 out_8(&pixis->vctl, 0);
60 out_8(&pixis->vctl, 1);
66 * Set the boot bank to the power-on default bank
68 void clear_altbank(void)
70 /* Tell the ngPIXIS to use this the bits in the physical switch for the
71 * boot bank value, instead of the SWx register. We need to be careful
72 * only to set the bits in SWx that correspond to the boot bank.
74 clrbits_8(&PIXIS_EN(PIXIS_LBMAP_SWITCH), PIXIS_LBMAP_MASK);
78 * Set the boot bank to the alternate bank
80 void set_altbank(void)
82 /* Program the alternate bank number into the SWx register.
84 clrsetbits_8(&PIXIS_SW(PIXIS_LBMAP_SWITCH), PIXIS_LBMAP_MASK,
87 /* Tell the ngPIXIS to use this the bits in the SWx register for the
88 * boot bank value, instead of the physical switch. We need to be
89 * careful only to set the bits in SWx that correspond to the boot bank.
91 setbits_8(&PIXIS_EN(PIXIS_LBMAP_SWITCH), PIXIS_LBMAP_MASK);
95 int pixis_reset_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
98 char *p_altbank = NULL;
99 char *unknown_param = NULL;
101 /* No args is a simple reset request.
106 for (i = 1; i < argc; i++) {
107 if (strcmp(argv[i], "altbank") == 0) {
112 unknown_param = argv[i];
116 printf("Invalid option: %s\n", unknown_param);
127 /* Shouldn't be reached. */
132 pixis_reset, CONFIG_SYS_MAXARGS, 1, pixis_reset_cmd,
133 "Reset the board using the FPGA sequencer",
134 "- hard reset to default bank\n"
135 "pixis_reset altbank - reset to alternate bank\n"