forked from Xilinx/u-boot-xlnx
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARM: zynq: Add Adapteva Parallella board
This adds support for all current Adapteva Parallella boards: P1600 - "Micro-server" P1601 - "Desktop Computer" P1602 - "Embedded Platform" The same defconfig can be used for all boards. Link with xilinx/zynq/board.o and reuse as large portion as possible. The ISL9305 mini-PMIC that controls various voltage levels is programmed via I2C. I2C is connected via EMIO on the Zynq on our boards. Therefore the programmable logic needs to be initialized before power_init_board() is called. The easiest way to achieve that is to load the bitstream from QSPI. For simplicity (e.g., zynq qspi driver is not in upstream yet) let FSBL do that for us and don't support SPL for now. Boot from SD-card if inserted, otherwise boot from TFTP. SD-boot: If uEnv.txt is present on SD-card add its content to the environment and "run sdboot". Otherwise, use old boot method (hardcoded paths). TFTP: Load uEnv.txt from server 10.11.12.1 and "run tftpboot_stage2". Signed-off-by: Ola Jeppsson <[email protected]>
- Loading branch information
Showing
8 changed files
with
305 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
if TARGET_ADAPTEVA_PARALLELLA | ||
|
||
config SYS_BOARD | ||
default "parallella" | ||
|
||
config SYS_VENDOR | ||
default "adapteva" | ||
|
||
config SYS_SOC | ||
default "zynq" | ||
|
||
config SYS_CONFIG_NAME | ||
default "adapteva_parallella" | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Adapteva boards | ||
M: Ola Jeppsson <[email protected]> | ||
S: Maintained | ||
F: board/adapteva/ | ||
F: include/configs/adapteva_*.h | ||
F: configs/adapteva_*_defconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# (C) Copyright 2000-2006 | ||
# Wolfgang Denk, DENX Software Engineering, [email protected]. | ||
# | ||
# SPDX-License-Identifier: GPL-2.0+ | ||
# | ||
|
||
# Piggy-back on Xilinx board. | ||
obj-y := board.o ../../xilinx/zynq/board.o | ||
|
||
# We need I2C to configure the PMIC. I2C is hooked up via EMIO so we need to | ||
# have the PL initialized *before* we can configure voltage levels in U-BOOT. | ||
# So it's hard for us to support SPL. | ||
|
||
# Please copy ps7_init_gpl.c/h from hw project to this directory | ||
obj-$(CONFIG_SPL_BUILD) += \ | ||
$(if $(wildcard $(srctree)/$(src)/ps7_init_gpl.c), ps7_init_gpl.o, \ | ||
$(if $(wildcard $(srctree)/$(src)/ps7_init.c), ps7_init.o legacy.o)) | ||
|
||
# Suppress "warning: function declaration isn't a prototype" | ||
CFLAGS_REMOVE_ps7_init_gpl.o := -Wstrict-prototypes | ||
CFLAGS_REMOVE_ps7_init.o := -Wstrict-prototypes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
* Copyright (C) 2015 Adapteva, Inc. | ||
* | ||
* Author: Ola Jeppsson <[email protected]> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
#define pr_fmt(fmt) "adapteva-parallella: " fmt | ||
|
||
#include <common.h> | ||
#include <i2c.h> | ||
#include <asm/io.h> | ||
#include <fpga.h> | ||
#include <xilinx.h> | ||
|
||
DECLARE_GLOBAL_DATA_PTR; | ||
|
||
#define ISL9305_I2C_ADDR 0x68 /* PMIC */ | ||
|
||
void green_led_on(void) | ||
{ | ||
writel(0xff7f0080, 0xe000a000); | ||
} | ||
|
||
void green_led_off(void) | ||
{ | ||
/* Clear mask/data to make GPIO[7] LOW */ | ||
writel(0xff7f0000, 0xe000a000); | ||
} | ||
|
||
void __led_toggle(led_id_t mask) | ||
{ | ||
bool toggled = readl(0xe000a040) & 0x00000080; | ||
|
||
if (toggled) | ||
green_led_off(); | ||
else | ||
green_led_on(); | ||
} | ||
|
||
void __led_set(led_id_t mask, int state) | ||
{ | ||
if (state == STATUS_LED_OFF) | ||
green_led_off(); | ||
else | ||
green_led_on(); | ||
} | ||
|
||
void __led_init(led_id_t mask, int state) | ||
{ | ||
/* 1. Turn GPIO[7] to output | ||
* 2. Enable GPIO[7] */ | ||
writel(0x00000080, 0xe000a204); | ||
writel(0x00000080, 0xe000a208); | ||
|
||
__led_set(mask, state); | ||
} | ||
|
||
static inline void led_blink(led_id_t mask, int n) | ||
{ | ||
for (n = n * 2; n > 0; n--) { | ||
udelay(75000); | ||
__led_toggle(mask); | ||
} | ||
} | ||
|
||
static inline void green_led_blink(int n) | ||
{ | ||
led_blink(STATUS_LED_BIT, n); | ||
} | ||
|
||
static inline int isl9305_probe(void) | ||
{ | ||
return i2c_probe(ISL9305_I2C_ADDR); | ||
} | ||
|
||
static inline void isl9305_write(uint8_t reg, uint8_t val) | ||
{ | ||
i2c_reg_write(ISL9305_I2C_ADDR, reg, val); | ||
} | ||
|
||
int power_init_board(void) | ||
{ | ||
if (isl9305_probe()) | ||
panic("power_init_board: Failed probing ISL9305 PMIC\n"); | ||
|
||
debug("power_init_board: Programming ISL9305 PMIC\n"); | ||
|
||
/* R.T. ISL9305H I2C programming */ | ||
|
||
/* 1. DCD1 set to 1.1V (Epiphany VDD_DSP) */ | ||
isl9305_write(0x0, 0x0b); | ||
|
||
/* 2. DCD2 set to 1.35V (DDR3L) */ | ||
isl9305_write(0x1, 0x15); | ||
|
||
/* 3. LD01 set to 3.3V (PEC_POWER) */ | ||
isl9305_write(0x2, 0x30); | ||
|
||
/* 4. LD02 set to 2.5V (HDMI_GPIO) */ | ||
isl9305_write(0x3, 0x20); | ||
|
||
/* 5. Enable the change by writing to SYS_PARAMETER */ | ||
isl9305_write(0x5, 0x6f); | ||
|
||
udelay(50000); | ||
|
||
debug("power_init_board: Done\n"); | ||
|
||
return 0; | ||
} | ||
|
||
int board_late_init(void) | ||
{ | ||
const fpga_desc *desc; | ||
xilinx_desc *desc_xilinx; | ||
|
||
green_led_blink(1); | ||
|
||
desc = fpga_get_desc(0); | ||
if (!desc) { | ||
green_led_off(); | ||
panic("board_late_init: No FPGA found.\n"); | ||
} | ||
|
||
desc_xilinx = desc->devdesc; | ||
if (!desc_xilinx || desc_xilinx->family != xilinx_zynq || | ||
!desc_xilinx->name) { | ||
green_led_off(); | ||
panic("board_late_init: Unsupported FPGA found.\n"); | ||
} | ||
|
||
green_led_blink(4); | ||
|
||
setenv("fpga_model", desc_xilinx->name); | ||
|
||
return 0; | ||
} | ||
|
||
#ifdef CONFIG_DISPLAY_BOARDINFO | ||
int checkboard(void) | ||
{ | ||
puts("Board:\tAdapteva Parallella\n"); | ||
return 0; | ||
} | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
#warning usage of ps7_init files is deprecated please use ps7_init_gpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# We need I2C to configure the PMIC. I2C is hooked up via EMIO so we need to | ||
# have the PL initialized *before* U-BOOT is started. So no SPL for us :( | ||
CONFIG_SPL=n | ||
CONFIG_ARM=y | ||
CONFIG_ZYNQ=y | ||
CONFIG_TARGET_ADAPTEVA_PARALLELLA=y | ||
CONFIG_OF_CONTROL=n | ||
CONFIG_DEFAULT_DEVICE_TREE="zynq-parallella" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright (C) 2013-2015 Adapteva, Inc. | ||
* | ||
* Authors: | ||
* Roman Trogan <[email protected]> | ||
* Ola Jeppsson <[email protected]> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
|
||
#ifndef __CONFIG_ADAPTEVA_PARALLELLA_H | ||
#define __CONFIG_ADAPTEVA_PARALLELLA_H | ||
|
||
#define CONFIG_SYS_SDRAM_SIZE (1024 * 1024 * 1024) | ||
#define CONFIG_SYS_MEM_TOP_HIDE 0x02000000 | ||
|
||
#define CONFIG_ZYNQ_SERIAL_UART1 | ||
|
||
#define CONFIG_ZYNQ_SDHCI1 | ||
|
||
#define CONFIG_ZYNQ_QSPI | ||
|
||
#define CONFIG_ZYNQ_GEM0 | ||
#define CONFIG_ZYNQ_GEM_PHY_ADDR0 0 | ||
|
||
#define CONFIG_ZYNQ_BOOT_FREEBSD | ||
|
||
#define CONFIG_BOARD_LATE_INIT | ||
|
||
#define CONFIG_CMD_MEMTEST | ||
#define CONFIG_CMD_SETEXPR | ||
|
||
#define CONFIG_SYS_NO_FLASH | ||
#define CONFIG_ZYNQ_QSPI | ||
#define CONFIG_ENV_OFFSET 0x004E0000 | ||
|
||
|
||
#define CONFIG_BOOTDELAY 1 | ||
|
||
#define CONFIG_PREBOOT | ||
#define CONFIG_EXTRA_ENV_SETTINGS \ | ||
"ethaddr=04:4f:8b:00:00:00\0" \ | ||
"ipaddr=10.11.12.13\0" \ | ||
"serverip=10.11.12.1\0" \ | ||
"bootenv=uEnv.txt\0" \ | ||
"fdt_high=0x20000000\0" \ | ||
"kernel_image=uImage\0" \ | ||
"old_bitstream_image=parallella.bit.bin\0" \ | ||
"old_devicetree_image=devicetree.dtb\0" \ | ||
"loadbootenv_addr=0x2000000\0" \ | ||
"loadbootenv=load mmc 0 ${loadbootenv_addr} ${bootenv}\0" \ | ||
"slowblink=" \ | ||
"led 0 toggle && sleep 1 && led 0 toggle && sleep 1 || true\0" \ | ||
"importbootenv=echo Importing environment from SD ...; " \ | ||
"env import -t ${loadbootenv_addr} $filesize\0" \ | ||
"importbootenvtftp=echo Importing environment from TFTP ...; " \ | ||
"env import -t ${loadbootenv_addr} $filesize\0" \ | ||
"preboot=if mmcinfo; then " \ | ||
"led 0 on; " \ | ||
"run slowblink; " \ | ||
"env set modeboot sdboot_old; " \ | ||
"run loadbootenv && " \ | ||
"run importbootenv && " \ | ||
"env set modeboot sdboot; " \ | ||
"else " \ | ||
"led 0 off; " \ | ||
"env set modeboot tftpboot; " \ | ||
"fi; \0" \ | ||
"sdboot_old=" \ | ||
"echo Legacy boot from SD card...; " \ | ||
"load mmc 0 0x4000000 ${old_bitstream_image} && " \ | ||
"fpga load 0 0x4000000 $filesize && " \ | ||
"run slowblink; " \ | ||
"load mmc 0 0x3000000 ${kernel_image} && " \ | ||
"load mmc 0 0x2A00000 ${old_devicetree_image} && " \ | ||
"run slowblink && " \ | ||
"bootm 0x3000000 - 0x2A00000; " \ | ||
"led 0 off\0" \ | ||
"tftpboot=while true; do " \ | ||
"echo TFTPing second stage boot script... && " \ | ||
"tftpboot ${loadbootenv_addr} ${bootenv} && " \ | ||
"run importbootenvtftp && " \ | ||
"run tftpboot_stage2; " \ | ||
"done\0" | ||
|
||
|
||
#include <configs/zynq-common.h> | ||
|
||
|
||
/* LEDS */ | ||
#define CONFIG_CMD_LED | ||
#define CONFIG_BOARD_SPECIFIC_LED | ||
#define CONFIG_STATUS_LED | ||
#define STATUS_LED_BIT 0 | ||
#define STATUS_LED_STATE STATUS_LED_OFF | ||
#define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 5) /* 5 Hz */ | ||
#define STATUS_LED_BOOT 0 | ||
|
||
|
||
#endif /* __CONFIG_ADAPTEVA_PARALLELLA_H */ |