avionic design with actual uboot and tooling
submodule of avionic design uboot bootloader and with included tools to get you started , read readme.md and readme-tk1-loader.md
This commit is contained in:
12
u-boot/board/LaCie/net2big_v2/Kconfig
Normal file
12
u-boot/board/LaCie/net2big_v2/Kconfig
Normal file
@@ -0,0 +1,12 @@
|
||||
if TARGET_NET2BIG_V2
|
||||
|
||||
config SYS_BOARD
|
||||
default "net2big_v2"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "LaCie"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "lacie_kw"
|
||||
|
||||
endif
|
||||
7
u-boot/board/LaCie/net2big_v2/MAINTAINERS
Normal file
7
u-boot/board/LaCie/net2big_v2/MAINTAINERS
Normal file
@@ -0,0 +1,7 @@
|
||||
NET2BIG_V2 BOARD
|
||||
M: Simon Guinot <simon.guinot@sequanux.org>
|
||||
S: Maintained
|
||||
F: board/LaCie/net2big_v2/
|
||||
F: include/configs/lacie_kw.h
|
||||
F: configs/d2net_v2_defconfig
|
||||
F: configs/net2big_v2_defconfig
|
||||
15
u-boot/board/LaCie/net2big_v2/Makefile
Normal file
15
u-boot/board/LaCie/net2big_v2/Makefile
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Copyright (C) 2011 Simon Guinot <sguinot@lacie.com>
|
||||
#
|
||||
# Based on Kirkwood support:
|
||||
# (C) Copyright 2009
|
||||
# Marvell Semiconductor <www.marvell.com>
|
||||
# Written-by: Prafulla Wadaskar <prafulla@marvell.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y := net2big_v2.o ../common/common.o
|
||||
ifneq ($(and $(CONFIG_KIRKWOOD_GPIO),$(CONFIG_NET2BIG_V2)),)
|
||||
obj-y += ../common/cpld-gpio-bus.o
|
||||
endif
|
||||
151
u-boot/board/LaCie/net2big_v2/kwbimage.cfg
Normal file
151
u-boot/board/LaCie/net2big_v2/kwbimage.cfg
Normal file
@@ -0,0 +1,151 @@
|
||||
#
|
||||
# Copyright (C) 2011 Simon Guinot <sguinot@lacie.com>
|
||||
#
|
||||
# Based on Kirkwood support:
|
||||
# (C) Copyright 2009
|
||||
# Marvell Semiconductor <www.marvell.com>
|
||||
# Written-by: Prafulla Wadaskar <prafulla@marvell.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# Refer doc/README.kwbimage for more details about how-to configure
|
||||
# and create kirkwood boot image
|
||||
#
|
||||
|
||||
# Boot Media configurations
|
||||
BOOT_FROM spi # Boot from SPI flash
|
||||
|
||||
# SOC registers configuration using bootrom header extension
|
||||
# Maximum KWBIMAGE_MAX_CONFIG configurations allowed
|
||||
|
||||
# Configure RGMII-0 interface pad voltage to 1.8V
|
||||
DATA 0xFFD100e0 0x1B1B1B9B
|
||||
|
||||
#Dram initalization for SINGLE x16 CL=5 @ 400MHz
|
||||
DATA 0xFFD01400 0x43000C30 # DDR Configuration register
|
||||
# bit13-0: 0xa00 (2560 DDR2 clks refresh rate)
|
||||
# bit23-14: zero
|
||||
# bit24: 1= enable exit self refresh mode on DDR access
|
||||
# bit25: 1 required
|
||||
# bit29-26: zero
|
||||
# bit31-30: 01
|
||||
|
||||
DATA 0xFFD01404 0x38743000 # DDR Controller Control Low
|
||||
# bit 4: 0=addr/cmd in smame cycle
|
||||
# bit 5: 0=clk is driven during self refresh, we don't care for APX
|
||||
# bit 6: 0=use recommended falling edge of clk for addr/cmd
|
||||
# bit14: 0=input buffer always powered up
|
||||
# bit18: 1=cpu lock transaction enabled
|
||||
# bit23-20: 5=recommended value for CL=5 and STARTBURST_DEL disabled bit31=0
|
||||
# bit27-24: 8= CL+3, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM
|
||||
# bit30-28: 3 required
|
||||
# bit31: 0=no additional STARTBURST delay
|
||||
|
||||
DATA 0xFFD01408 0x22125451 # DDR Timing (Low) (active cycles value +1)
|
||||
# bit7-4: TRCD
|
||||
# bit11- 8: TRP
|
||||
# bit15-12: TWR
|
||||
# bit19-16: TWTR
|
||||
# bit20: TRAS msb
|
||||
# bit23-21: 0x0
|
||||
# bit27-24: TRRD
|
||||
# bit31-28: TRTP
|
||||
|
||||
DATA 0xFFD0140C 0x00000A32 # DDR Timing (High)
|
||||
# bit6-0: TRFC
|
||||
# bit8-7: TR2R
|
||||
# bit10-9: TR2W
|
||||
# bit12-11: TW2W
|
||||
# bit31-13: zero required
|
||||
|
||||
DATA 0xFFD01410 0x0000CCCC # DDR Address Control
|
||||
# bit1-0: 01, Cs0width=x16
|
||||
# bit3-2: 11, Cs0size=1Gb
|
||||
# bit5-4: 00, Cs2width=nonexistent
|
||||
# bit7-6: 00, Cs1size =nonexistent
|
||||
# bit9-8: 00, Cs2width=nonexistent
|
||||
# bit11-10: 00, Cs2size =nonexistent
|
||||
# bit13-12: 00, Cs3width=nonexistent
|
||||
# bit15-14: 00, Cs3size =nonexistent
|
||||
# bit16: 0, Cs0AddrSel
|
||||
# bit17: 0, Cs1AddrSel
|
||||
# bit18: 0, Cs2AddrSel
|
||||
# bit19: 0, Cs3AddrSel
|
||||
# bit31-20: 0 required
|
||||
|
||||
DATA 0xFFD01414 0x00000000 # DDR Open Pages Control
|
||||
# bit0: 0, OpenPage enabled
|
||||
# bit31-1: 0 required
|
||||
|
||||
DATA 0xFFD01418 0x00000000 # DDR Operation
|
||||
# bit3-0: 0x0, DDR cmd
|
||||
# bit31-4: 0 required
|
||||
|
||||
DATA 0xFFD0141C 0x00000662 # DDR Mode
|
||||
# bit2-0: 2, BurstLen=2 required
|
||||
# bit3: 0, BurstType=0 required
|
||||
# bit6-4: 4, CL=5
|
||||
# bit7: 0, TestMode=0 normal
|
||||
# bit8: 0, DLL reset=0 normal
|
||||
# bit11-9: 6, auto-precharge write recovery ????????????
|
||||
# bit12: 0, PD must be zero
|
||||
# bit31-13: 0 required
|
||||
|
||||
DATA 0xFFD01420 0x00000044 # DDR Extended Mode
|
||||
# bit0: 0, DDR DLL enabled
|
||||
# bit1: 1, DDR drive strenght reduced
|
||||
# bit2: 1, DDR ODT control lsd enabled
|
||||
# bit5-3: 000, required
|
||||
# bit6: 1, DDR ODT control msb, enabled
|
||||
# bit9-7: 000, required
|
||||
# bit10: 0, differential DQS enabled
|
||||
# bit11: 0, required
|
||||
# bit12: 0, DDR output buffer enabled
|
||||
# bit31-13: 0 required
|
||||
|
||||
DATA 0xFFD01424 0x0000F17F # DDR Controller Control High
|
||||
# bit2-0: 111, required
|
||||
# bit3 : 1 , MBUS Burst Chop disabled
|
||||
# bit6-4: 111, required
|
||||
# bit7 : 1 , D2P Latency enabled
|
||||
# bit8 : 1 , add writepath sample stage, must be 1 for DDR freq >= 300MHz
|
||||
# bit9 : 0 , no half clock cycle addition to dataout
|
||||
# bit10 : 0 , 1/4 clock cycle skew enabled for addr/ctl signals
|
||||
# bit11 : 0 , 1/4 clock cycle skew disabled for write mesh
|
||||
# bit15-12: 1111 required
|
||||
# bit31-16: 0 required
|
||||
|
||||
DATA 0xFFD01428 0x00096630 # DDR2 ODT Read Timing (default values)
|
||||
DATA 0xFFD0147C 0x00009663 # DDR2 ODT Write Timing (default values)
|
||||
|
||||
DATA 0xFFD01500 0x00000000 # CS[0]n Base address to 0x0
|
||||
DATA 0xFFD01504 0x0FFFFFF1 # CS[0]n Size
|
||||
# bit0: 1, Window enabled
|
||||
# bit1: 0, Write Protect disabled
|
||||
# bit3-2: 00, CS0 hit selected
|
||||
# bit23-4: ones, required
|
||||
# bit31-24: 0x07, Size (i.e. 128MB)
|
||||
|
||||
DATA 0xFFD0150C 0x00000000 # CS[1]n Size, window disabled
|
||||
DATA 0xFFD01514 0x00000000 # CS[2]n Size, window disabled
|
||||
DATA 0xFFD0151C 0x00000000 # CS[3]n Size, window disabled
|
||||
|
||||
DATA 0xFFD01494 0x00010000 # DDR ODT Control (Low)
|
||||
# bit3-0: 1, ODT0Rd, MODT[0] asserted during read from DRAM CS0
|
||||
# bit19-16:1, ODT0Wr, MODT[0] asserted during write to DRAM CS0
|
||||
|
||||
DATA 0xFFD01498 0x00000000 # DDR ODT Control (High)
|
||||
# bit1-0: 00, ODT0 controlled by ODT Control (low) register above
|
||||
# bit3-2: 01, ODT1 active NEVER!
|
||||
# bit31-4: zero, required
|
||||
|
||||
DATA 0xFFD0149C 0x0000E40F # CPU ODT Control
|
||||
# bit3-0: 1, ODT0Rd, Internal ODT asserted during read from DRAM bank0
|
||||
# bit7-4: 1, ODT0Wr, Internal ODT asserted during write to DRAM bank0
|
||||
# bit11-10:1, DQ_ODTSel. ODT select turned on
|
||||
|
||||
DATA 0xFFD01480 0x00000001 # DDR Initialization Control
|
||||
#bit0=1, enable DDR init upon this register write
|
||||
|
||||
# End of Header extension
|
||||
DATA 0x0 0x0
|
||||
253
u-boot/board/LaCie/net2big_v2/net2big_v2.c
Normal file
253
u-boot/board/LaCie/net2big_v2/net2big_v2.c
Normal file
@@ -0,0 +1,253 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Simon Guinot <sguinot@lacie.com>
|
||||
*
|
||||
* Based on Kirkwood support:
|
||||
* (C) Copyright 2009
|
||||
* Marvell Semiconductor <www.marvell.com>
|
||||
* Written-by: Prafulla Wadaskar <prafulla@marvell.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <i2c.h>
|
||||
#include <asm/arch/cpu.h>
|
||||
#include <asm/arch/soc.h>
|
||||
#include <asm/arch/mpp.h>
|
||||
#include <asm/arch/gpio.h>
|
||||
|
||||
#include "net2big_v2.h"
|
||||
#include "../common/common.h"
|
||||
#include "../common/cpld-gpio-bus.h"
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
/* GPIO configuration */
|
||||
mvebu_config_gpio(NET2BIG_V2_OE_VAL_LOW, NET2BIG_V2_OE_VAL_HIGH,
|
||||
NET2BIG_V2_OE_LOW, NET2BIG_V2_OE_HIGH);
|
||||
|
||||
/* Multi-Purpose Pins Functionality configuration */
|
||||
static const u32 kwmpp_config[] = {
|
||||
MPP0_SPI_SCn,
|
||||
MPP1_SPI_MOSI,
|
||||
MPP2_SPI_SCK,
|
||||
MPP3_SPI_MISO,
|
||||
MPP6_SYSRST_OUTn,
|
||||
MPP7_GPO, /* Request power-off */
|
||||
MPP8_TW_SDA,
|
||||
MPP9_TW_SCK,
|
||||
MPP10_UART0_TXD,
|
||||
MPP11_UART0_RXD,
|
||||
MPP13_GPIO, /* Rear power switch (on|auto) */
|
||||
MPP14_GPIO, /* USB fuse alarm */
|
||||
MPP15_GPIO, /* Rear power switch (auto|off) */
|
||||
MPP16_GPIO, /* SATA HDD1 power */
|
||||
MPP17_GPIO, /* SATA HDD2 power */
|
||||
MPP20_SATA1_ACTn,
|
||||
MPP21_SATA0_ACTn,
|
||||
MPP24_GPIO, /* USB mode select */
|
||||
MPP26_GPIO, /* USB device vbus */
|
||||
MPP28_GPIO, /* USB enable host vbus */
|
||||
MPP29_GPIO, /* CPLD GPIO bus ALE */
|
||||
MPP34_GPIO, /* Rear Push button 0=on 1=off */
|
||||
MPP35_GPIO, /* Inhibit switch power-off */
|
||||
MPP36_GPIO, /* SATA HDD1 presence */
|
||||
MPP37_GPIO, /* SATA HDD2 presence */
|
||||
MPP40_GPIO, /* eSATA presence */
|
||||
MPP44_GPIO, /* CPLD GPIO bus (data 0) */
|
||||
MPP45_GPIO, /* CPLD GPIO bus (data 1) */
|
||||
MPP46_GPIO, /* CPLD GPIO bus (data 2) */
|
||||
MPP47_GPIO, /* CPLD GPIO bus (addr 0) */
|
||||
MPP48_GPIO, /* CPLD GPIO bus (addr 1) */
|
||||
MPP49_GPIO, /* CPLD GPIO bus (addr 2) */
|
||||
0
|
||||
};
|
||||
|
||||
kirkwood_mpp_conf(kwmpp_config, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
/* Machine number */
|
||||
gd->bd->bi_arch_number = MACH_TYPE_NET2BIG_V2;
|
||||
|
||||
/* Boot parameters address */
|
||||
gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_MISC_INIT_R)
|
||||
|
||||
#if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_G762_ADDR)
|
||||
/*
|
||||
* Start I2C fan (GMT G762 controller)
|
||||
*/
|
||||
static void init_fan(void)
|
||||
{
|
||||
u8 data;
|
||||
|
||||
i2c_set_bus_num(0);
|
||||
|
||||
/* Enable open-loop and PWM modes */
|
||||
data = 0x20;
|
||||
if (i2c_write(CONFIG_SYS_I2C_G762_ADDR,
|
||||
G762_REG_FAN_CMD1, 1, &data, 1) != 0)
|
||||
goto err;
|
||||
data = 0;
|
||||
if (i2c_write(CONFIG_SYS_I2C_G762_ADDR,
|
||||
G762_REG_SET_CNT, 1, &data, 1) != 0)
|
||||
goto err;
|
||||
/*
|
||||
* RPM to PWM (set_out register) fan speed conversion array:
|
||||
* 0 0x00
|
||||
* 1500 0x04
|
||||
* 2800 0x08
|
||||
* 3400 0x0C
|
||||
* 3700 0x10
|
||||
* 4400 0x20
|
||||
* 4700 0x30
|
||||
* 4800 0x50
|
||||
* 5200 0x80
|
||||
* 5400 0xC0
|
||||
* 5500 0xFF
|
||||
*
|
||||
* Start fan at low speed (2800 RPM):
|
||||
*/
|
||||
data = 0x08;
|
||||
if (i2c_write(CONFIG_SYS_I2C_G762_ADDR,
|
||||
G762_REG_SET_OUT, 1, &data, 1) != 0)
|
||||
goto err;
|
||||
|
||||
return;
|
||||
err:
|
||||
printf("Error: failed to start I2C fan @%02x\n",
|
||||
CONFIG_SYS_I2C_G762_ADDR);
|
||||
}
|
||||
#else
|
||||
static void init_fan(void) {}
|
||||
#endif /* CONFIG_CMD_I2C && CONFIG_SYS_I2C_G762_ADDR */
|
||||
|
||||
#if defined(CONFIG_NET2BIG_V2) && defined(CONFIG_KIRKWOOD_GPIO)
|
||||
/*
|
||||
* CPLD GPIO bus:
|
||||
*
|
||||
* - address register : bit [0-2] -> GPIO [47-49]
|
||||
* - data register : bit [0-2] -> GPIO [44-46]
|
||||
* - enable register : GPIO 29
|
||||
*/
|
||||
static unsigned cpld_gpio_bus_addr[] = { 47, 48, 49 };
|
||||
static unsigned cpld_gpio_bus_data[] = { 44, 45, 46 };
|
||||
|
||||
static struct cpld_gpio_bus cpld_gpio_bus = {
|
||||
.addr = cpld_gpio_bus_addr,
|
||||
.num_addr = ARRAY_SIZE(cpld_gpio_bus_addr),
|
||||
.data = cpld_gpio_bus_data,
|
||||
.num_data = ARRAY_SIZE(cpld_gpio_bus_data),
|
||||
.enable = 29,
|
||||
};
|
||||
|
||||
/*
|
||||
* LEDs configuration:
|
||||
*
|
||||
* The LEDs are controlled by a CPLD and can be configured through
|
||||
* the CPLD GPIO bus.
|
||||
*
|
||||
* Address register selection:
|
||||
*
|
||||
* addr | register
|
||||
* ----------------------------
|
||||
* 0 | front LED
|
||||
* 1 | front LED brightness
|
||||
* 2 | SATA LED brightness
|
||||
* 3 | SATA0 LED
|
||||
* 4 | SATA1 LED
|
||||
* 5 | SATA2 LED
|
||||
* 6 | SATA3 LED
|
||||
* 7 | SATA4 LED
|
||||
*
|
||||
* Data register configuration:
|
||||
*
|
||||
* data | LED brightness
|
||||
* -------------------------------------------------
|
||||
* 0 | min (off)
|
||||
* - | -
|
||||
* 7 | max
|
||||
*
|
||||
* data | front LED mode
|
||||
* -------------------------------------------------
|
||||
* 0 | fix off
|
||||
* 1 | fix blue on
|
||||
* 2 | fix red on
|
||||
* 3 | blink blue on=1 sec and blue off=1 sec
|
||||
* 4 | blink red on=1 sec and red off=1 sec
|
||||
* 5 | blink blue on=2.5 sec and red on=0.5 sec
|
||||
* 6 | blink blue on=1 sec and red on=1 sec
|
||||
* 7 | blink blue on=0.5 sec and blue off=2.5 sec
|
||||
*
|
||||
* data | SATA LED mode
|
||||
* -------------------------------------------------
|
||||
* 0 | fix off
|
||||
* 1 | SATA activity blink
|
||||
* 2 | fix red on
|
||||
* 3 | blink blue on=1 sec and blue off=1 sec
|
||||
* 4 | blink red on=1 sec and red off=1 sec
|
||||
* 5 | blink blue on=2.5 sec and red on=0.5 sec
|
||||
* 6 | blink blue on=1 sec and red on=1 sec
|
||||
* 7 | fix blue on
|
||||
*/
|
||||
static void init_leds(void)
|
||||
{
|
||||
/* Enable the front blue LED */
|
||||
cpld_gpio_bus_write(&cpld_gpio_bus, 0, 1);
|
||||
cpld_gpio_bus_write(&cpld_gpio_bus, 1, 3);
|
||||
|
||||
/* Configure SATA LEDs to blink in relation with the SATA activity */
|
||||
cpld_gpio_bus_write(&cpld_gpio_bus, 3, 1);
|
||||
cpld_gpio_bus_write(&cpld_gpio_bus, 4, 1);
|
||||
cpld_gpio_bus_write(&cpld_gpio_bus, 2, 3);
|
||||
}
|
||||
#else
|
||||
static void init_leds(void) {}
|
||||
#endif /* CONFIG_NET2BIG_V2 && CONFIG_KIRKWOOD_GPIO */
|
||||
|
||||
int misc_init_r(void)
|
||||
{
|
||||
init_fan();
|
||||
#if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
|
||||
if (!getenv("ethaddr")) {
|
||||
uchar mac[6];
|
||||
if (lacie_read_mac_address(mac) == 0)
|
||||
eth_setenv_enetaddr("ethaddr", mac);
|
||||
}
|
||||
#endif
|
||||
init_leds();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_MISC_INIT_R */
|
||||
|
||||
#if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
|
||||
/* Configure and initialize PHY */
|
||||
void reset_phy(void)
|
||||
{
|
||||
mv_phy_88e1116_init("egiga0", 8);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_KIRKWOOD_GPIO)
|
||||
/* Return GPIO push button status */
|
||||
static int
|
||||
do_read_push_button(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
return !kw_gpio_get_value(NET2BIG_V2_GPIO_PUSH_BUTTON);
|
||||
}
|
||||
|
||||
U_BOOT_CMD(button, 1, 1, do_read_push_button,
|
||||
"Return GPIO push button status 0=off 1=on", "");
|
||||
#endif
|
||||
29
u-boot/board/LaCie/net2big_v2/net2big_v2.h
Normal file
29
u-boot/board/LaCie/net2big_v2/net2big_v2.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Simon Guinot <sguinot@lacie.com>
|
||||
*
|
||||
* Based on Kirkwood support:
|
||||
* (C) Copyright 2009
|
||||
* Marvell Semiconductor <www.marvell.com>
|
||||
* Written-by: Prafulla Wadaskar <prafulla@marvell.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef NET2BIG_V2_H
|
||||
#define NET2BIG_V2_H
|
||||
|
||||
/* GPIO configuration */
|
||||
#define NET2BIG_V2_OE_LOW 0x0600E000
|
||||
#define NET2BIG_V2_OE_HIGH 0x00000134
|
||||
#define NET2BIG_V2_OE_VAL_LOW 0x10030000
|
||||
#define NET2BIG_V2_OE_VAL_HIGH 0x00000000
|
||||
|
||||
/* Buttons */
|
||||
#define NET2BIG_V2_GPIO_PUSH_BUTTON 34
|
||||
|
||||
/* GMT G762 registers (I2C fan controller) */
|
||||
#define G762_REG_SET_CNT 0x00
|
||||
#define G762_REG_SET_OUT 0x03
|
||||
#define G762_REG_FAN_CMD1 0x04
|
||||
|
||||
#endif /* NET2BIG_V2_H */
|
||||
Reference in New Issue
Block a user