Skip to content

Commit

Permalink
zynq: Add support to find bootmode
Browse files Browse the repository at this point in the history
Added support to find the bootmodes by reading
slcr bootmode register. this can be helpful to
autoboot the configurations w.r.t a specified bootmode.

Added this functionality on board_late_init as it's not
needed for normal initializtion part.

Signed-off-by: Jagannadha Sutradharudu Teki <[email protected]>
  • Loading branch information
Jagannadha Sutradharudu Teki authored and albert-aribaud-u-boot committed Jan 10, 2014
1 parent fe5eddb commit b3de924
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
6 changes: 6 additions & 0 deletions arch/arm/cpu/armv7/zynq/slcr.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ void zynq_slcr_devcfg_enable(void)
zynq_slcr_lock();
}

u32 zynq_slcr_get_boot_mode(void)
{
/* Get the bootmode register value */
return readl(&slcr_base->boot_mode);
}

u32 zynq_slcr_get_idcode(void)
{
return (readl(&slcr_base->pss_idcode) & SLCR_IDCODE_MASK) >>
Expand Down
1 change: 1 addition & 0 deletions arch/arm/include/asm/arch-zynq/sys_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extern void zynq_slcr_cpu_reset(void);
extern void zynq_slcr_gem_clk_setup(u32 gem_id, u32 rclk, u32 clk);
extern void zynq_slcr_devcfg_disable(void);
extern void zynq_slcr_devcfg_enable(void);
extern u32 zynq_slcr_get_boot_mode(void);
extern u32 zynq_slcr_get_idcode(void);
extern void zynq_ddrc_init(void);

Expand Down
25 changes: 25 additions & 0 deletions board/xilinx/zynq/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

DECLARE_GLOBAL_DATA_PTR;

/* Bootmode setting values */
#define ZYNQ_BM_MASK 0x0F
#define ZYNQ_BM_NOR 0x02
#define ZYNQ_BM_SD 0x05
#define ZYNQ_BM_JTAG 0x0

#ifdef CONFIG_FPGA
Xilinx_desc fpga;

Expand Down Expand Up @@ -59,6 +65,25 @@ int board_init(void)
return 0;
}

int board_late_init(void)
{
switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
case ZYNQ_BM_NOR:
setenv("modeboot", "norboot");
break;
case ZYNQ_BM_SD:
setenv("modeboot", "sdboot");
break;
case ZYNQ_BM_JTAG:
setenv("modeboot", "jtagboot");
break;
default:
setenv("modeboot", "");
break;
}

return 0;
}

#ifdef CONFIG_CMD_NET
int board_eth_init(bd_t *bis)
Expand Down
25 changes: 23 additions & 2 deletions doc/README.zynq
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,27 @@ and I/O programmability.
- zc770-xm012 (nor)
- zc770-xm013 (dual parallel qspi, gem1)

3. Mainline status
3. Bootmode

Zynq has a facility to read the bootmode from the slcr bootmode register
once user is setting through jumpers on the board - see page no:1546 on [5]

All possible bootmode values are defined in Table 6-2:Boot_Mode MIO Pins
on [5].

board_late_init() will read the bootmode values using slcr bootmode register
at runtime and assign the modeboot variable to specific bootmode string which
is intern used in autoboot.

SLCR bootmode register Bit[3:0] values
#define ZYNQ_BM_NOR 0x02
#define ZYNQ_BM_SD 0x05
#define ZYNQ_BM_JTAG 0x0

"modeboot" variable can assign any of "norboot", "sdboot" or "jtagboot"
bootmode strings at runtime.

4. Mainline status

- Added basic board configurations support.
- Added zynq u-boot bsp code - arch/arm/cpu/armv7/zynq
Expand All @@ -41,7 +61,7 @@ and I/O programmability.
spi- drivers/spi/zynq_spi.c
i2c - drivers/i2c/zynq_i2c.c

4. TODO
5. TODO

- Add zynq boards support - zc70x, zed, microzed, zc770
- Add zynq qspi controller driver
Expand All @@ -54,6 +74,7 @@ and I/O programmability.
[2] http://www.xilinx.com/products/boards-and-kits/EK-Z7-ZC706-G.htm
[3] http://zedboard.org/product/zedboard
[4] http://zedboard.org/product/microzed
[5] http://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf

--
Jagannadha Sutradharudu Teki <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions include/configs/zynq-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@

#define CONFIG_CMDLINE_EDITING
#define CONFIG_AUTO_COMPLETE
#define CONFIG_BOARD_LATE_INIT
#define CONFIG_SYS_LONGHELP
#define CONFIG_SYS_MAXARGS 15 /* max number of command args */
#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
Expand Down

0 comments on commit b3de924

Please sign in to comment.