nrhw: sync with NRSW, dualcan-passive shield fixes
BugzId: 61778
This commit is contained in:
parent
41742d2865
commit
ce70a04c33
|
|
@ -11,10 +11,6 @@
|
||||||
#ifndef DA9063_H
|
#ifndef DA9063_H
|
||||||
#define DA9063_H
|
#define DA9063_H
|
||||||
|
|
||||||
/*
|
|
||||||
TODO: Add include for uint32_t (stdtypes.h)
|
|
||||||
#include <types.h>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CONFIG_PMIC_I2C_BUS 0
|
#define CONFIG_PMIC_I2C_BUS 0
|
||||||
#define CONFIG_PMIC_I2C_ADDR 0x58 /* Pages 0 and 1, Pages 2 and 3 -> 0x59 */
|
#define CONFIG_PMIC_I2C_ADDR 0x58 /* Pages 0 and 1, Pages 2 and 3 -> 0x59 */
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ config SYS_CONFIG_NAME
|
||||||
config CONS_INDEX
|
config CONS_INDEX
|
||||||
int "UART used for console"
|
int "UART used for console"
|
||||||
range 1 6
|
range 1 6
|
||||||
default 3
|
default 3
|
||||||
help
|
help
|
||||||
The AM335x SoC has a total of 6 UARTs (UART0 to UART5 as referenced
|
The AM335x SoC has a total of 6 UARTs (UART0 to UART5 as referenced
|
||||||
in documentation, etc) available to it. Depending on your specific
|
in documentation, etc) available to it. Depending on your specific
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,8 @@ static void set_indicator_led(int red, int green)
|
||||||
gpio_set_value(GPIO_LED1_GREEN, green);
|
gpio_set_value(GPIO_LED1_GREEN, green);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
|
|
||||||
static void ui_set_status_led(int red, int green)
|
static void ui_set_status_led(int red, int green)
|
||||||
{
|
{
|
||||||
ui_set_top_led(red, green);
|
ui_set_top_led(red, green);
|
||||||
|
|
@ -227,6 +229,8 @@ static void ui_set_indicator_led(int red, int green)
|
||||||
ui_set_bottom_led(red, green);
|
ui_set_bottom_led(red, green);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static void init_i2c(void)
|
static void init_i2c(void)
|
||||||
{
|
{
|
||||||
i2c_set_bus_num(0);
|
i2c_set_bus_num(0);
|
||||||
|
|
@ -253,6 +257,14 @@ static int _bd_init(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
/* TODO: Check if we can get rid of this descriptor and use eMMC partition table */
|
||||||
|
if (bd_get_context(&bdctx[2], BD_EEPROM_ADDR, PARTITION_ADDRESS) != 0) {
|
||||||
|
printf("%s() no valid partition table found\n", __func__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bd_register_context_list(bdctx, ARRAY_SIZE(bdctx));
|
bd_register_context_list(bdctx, ARRAY_SIZE(bdctx));
|
||||||
|
|
||||||
i2c_set_bus_num(old_bus);
|
i2c_set_bus_num(old_bus);
|
||||||
|
|
@ -515,12 +527,17 @@ void am33xx_spl_board_init(void)
|
||||||
set_status_led(1, 0); /* Red */
|
set_status_led(1, 0); /* Red */
|
||||||
set_indicator_led(1, 0); /* Red */
|
set_indicator_led(1, 0); /* Red */
|
||||||
|
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
|
|
||||||
/* UI detection */
|
/* UI detection */
|
||||||
REQUEST_AND_SET_GPIO(GPIO_RST_UI_N);
|
REQUEST_AND_SET_GPIO(GPIO_RST_UI_N);
|
||||||
ui_init(CONFIG_UI_I2C_BUS);
|
ui_init(CONFIG_UI_I2C_BUS);
|
||||||
|
|
||||||
ui_set_status_led(1, 0); /* Red */
|
ui_set_status_led(1, 0); /* Red */
|
||||||
ui_set_indicator_led(1, 0); /* Red */
|
ui_set_indicator_led(1, 0); /* Red */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set MPU Frequency to what we detected now that voltages are set */
|
/* Set MPU Frequency to what we detected now that voltages are set */
|
||||||
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
||||||
|
|
||||||
|
|
@ -715,6 +732,8 @@ static void init_usb_hub(void)
|
||||||
gpio_set_value(GPIO_RST_USB_HUB_N, 1);
|
gpio_set_value(GPIO_RST_USB_HUB_N, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
|
|
||||||
static void init_user_module(void)
|
static void init_user_module(void)
|
||||||
{
|
{
|
||||||
int bus;
|
int bus;
|
||||||
|
|
@ -756,10 +775,12 @@ static void init_user_module(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static void init_sim_mux(void)
|
static void init_sim_mux(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Switch onboard SIM to onboard modem (Mux = 1)
|
* Switch pluggable micro SIM to onboard modem (mux = 1)
|
||||||
*/
|
*/
|
||||||
REQUEST_AND_SET_GPIO(GPIO_SIM_SEL);
|
REQUEST_AND_SET_GPIO(GPIO_SIM_SEL);
|
||||||
|
|
||||||
|
|
@ -798,20 +819,50 @@ static void init_gsm(void)
|
||||||
* 4.2.8 PWR_ON pin
|
* 4.2.8 PWR_ON pin
|
||||||
* 4.2.9 RESET_N pin
|
* 4.2.9 RESET_N pin
|
||||||
*
|
*
|
||||||
* Functionality:
|
* Functionality Yocto:
|
||||||
* - Leave GSM power enable as is (default at power up = off)
|
* - Leave GSM power enable as is (default at power up = off)
|
||||||
* - Set reset line inactive (note: inverter logic in HW present)
|
* - Set reset line inactive (note: inverter logic in HW present)
|
||||||
* - Leave button unpressed (note: inverter logic in HW present)
|
* - Leave button unpressed (note: inverter logic in HW present)
|
||||||
* - Modem shall be enabled by Linux system by enabling GSM power
|
* - Modem shall be enabled by Linux system by enabling GSM power
|
||||||
* supply
|
* supply
|
||||||
*/
|
*/
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
int bus;
|
||||||
|
|
||||||
puts("GSM: ");
|
puts("GSM: ");
|
||||||
|
|
||||||
|
bus = da9063_claim_i2c_bus();
|
||||||
|
|
||||||
|
/* TODO: Keep Power-On and use GSM Modem Reset Signal to restart */
|
||||||
|
|
||||||
|
REQUEST_AND_SET_GPIO(GPIO_RST_GSM); /* Assert reset (active high) */
|
||||||
|
REQUEST_AND_CLEAR_GPIO(GPIO_PWR_GSM); /* Keep power switch inactive (released) */
|
||||||
|
|
||||||
|
da9063_set_gpio(PMIC_GSM_SUPPLY_EN_IO, 0); /* Switch GSM Supply off */
|
||||||
|
mdelay(30+100); /* Give time to discharge supply */
|
||||||
|
/* Keep of for 100ms, #3.3.2 */
|
||||||
|
|
||||||
|
da9063_set_gpio(PMIC_GSM_SUPPLY_EN_IO, 1); /* Enable GSM supply */
|
||||||
|
mdelay(10);
|
||||||
|
|
||||||
|
gpio_set_value(GPIO_RST_GSM, 0); /* Take modem out of reset */
|
||||||
|
mdelay(300); /* Wait for power to stabilizy, #3.4.2 */
|
||||||
|
|
||||||
|
gpio_set_value(GPIO_PWR_GSM, 1); /* Generate power on event, #3.4.2 */
|
||||||
|
mdelay(1200);
|
||||||
|
gpio_set_value(GPIO_PWR_GSM, 0);
|
||||||
|
|
||||||
|
da9063_release_i2c_bus(bus);
|
||||||
|
|
||||||
|
puts("ready\n");
|
||||||
|
#else
|
||||||
|
puts("GSM: ");
|
||||||
|
|
||||||
REQUEST_AND_CLEAR_GPIO(GPIO_RST_GSM); /* Set reset inactive (active high) */
|
REQUEST_AND_CLEAR_GPIO(GPIO_RST_GSM); /* Set reset inactive (active high) */
|
||||||
REQUEST_AND_CLEAR_GPIO(GPIO_PWR_GSM); /* Set power switch inactive/released (active high) */
|
REQUEST_AND_CLEAR_GPIO(GPIO_PWR_GSM); /* Set power switch inactive/released (active high) */
|
||||||
|
|
||||||
puts("init\n");
|
puts("init\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_gnss(void)
|
static void init_gnss(void)
|
||||||
|
|
@ -842,16 +893,21 @@ int board_init(void)
|
||||||
|
|
||||||
da9063_init(CONFIG_PMIC_I2C_BUS);
|
da9063_init(CONFIG_PMIC_I2C_BUS);
|
||||||
|
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
/* UI detection */
|
/* UI detection */
|
||||||
REQUEST_AND_SET_GPIO(GPIO_RST_UI_N);
|
REQUEST_AND_SET_GPIO(GPIO_RST_UI_N);
|
||||||
ui_init(CONFIG_UI_I2C_BUS);
|
ui_init(CONFIG_UI_I2C_BUS);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Let user know we're starting */
|
/* Let user know we're starting */
|
||||||
init_leds();
|
init_leds();
|
||||||
set_status_led(1, 1); /* Orange */
|
set_status_led(1, 1); /* Orange */
|
||||||
set_indicator_led(0, 0); /* Off */
|
set_indicator_led(0, 0); /* Off */
|
||||||
ui_set_status_led(1, 1); /* Orange */
|
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
|
ui_set_status_led(1, 1); /* Orange */
|
||||||
ui_set_indicator_led(0, 0); /* Off */
|
ui_set_indicator_led(0, 0); /* Off */
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("OSC: %lu MHz\n", get_osclk()/1000000);
|
printf("OSC: %lu MHz\n", get_osclk()/1000000);
|
||||||
|
|
||||||
|
|
@ -870,6 +926,37 @@ void set_console(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
|
||||||
|
static void set_devicetree_name(void)
|
||||||
|
{
|
||||||
|
char devicetreename[64];
|
||||||
|
|
||||||
|
/* add hardware versions to environment */
|
||||||
|
if (bd_get_devicetree(devicetreename, sizeof(devicetreename)) != 0) {
|
||||||
|
printf("Devicetree name not found, using default name\n");
|
||||||
|
strcpy(devicetreename, "am335x-nmhw21-prod1.dtb");
|
||||||
|
}
|
||||||
|
|
||||||
|
setenv("fdt_image", devicetreename);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_root_partition(void)
|
||||||
|
{
|
||||||
|
int boot_partition;
|
||||||
|
|
||||||
|
/* add active root partition to environment */
|
||||||
|
boot_partition = bd_get_boot_partition();
|
||||||
|
if (boot_partition > 1) {
|
||||||
|
boot_partition = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mmcblk1p1 => root0, mmcblk1p2 => root1 so +1 */
|
||||||
|
setenv_ulong("root_part", boot_partition + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static void get_variant_name(void)
|
static void get_variant_name(void)
|
||||||
{
|
{
|
||||||
bd_get_variantname(hw_variant_name, sizeof(hw_variant_name));
|
bd_get_variantname(hw_variant_name, sizeof(hw_variant_name));
|
||||||
|
|
@ -877,6 +964,26 @@ static void get_variant_name(void)
|
||||||
printf("SYS: %s\n", hw_variant_name);
|
printf("SYS: %s\n", hw_variant_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
|
||||||
|
static void get_hw_version(void)
|
||||||
|
{
|
||||||
|
char hw_versions[16];
|
||||||
|
char new_env[256]; /* current bootargs = 84 bytes */
|
||||||
|
|
||||||
|
bd_get_hw_version(&hw_ver, &hw_rev);
|
||||||
|
bd_get_hw_patch(&hw_patch);
|
||||||
|
|
||||||
|
printf("HW21: V%d.%d\n", hw_ver, hw_rev);
|
||||||
|
|
||||||
|
/* add hardware versions to environment */
|
||||||
|
snprintf(hw_versions, sizeof(hw_versions), "CP=%d.%d", hw_ver, hw_rev);
|
||||||
|
snprintf(new_env, sizeof(new_env), "setenv bootargs $bootargs %s", hw_versions);
|
||||||
|
setenv("add_version_bootargs", new_env);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
static void get_hw_version(void)
|
static void get_hw_version(void)
|
||||||
{
|
{
|
||||||
bd_get_hw_version(&hw_ver, &hw_rev);
|
bd_get_hw_version(&hw_ver, &hw_rev);
|
||||||
|
|
@ -885,6 +992,8 @@ static void get_hw_version(void)
|
||||||
printf("MB: V%d.%d\n", hw_ver, hw_rev);
|
printf("MB: V%d.%d\n", hw_ver, hw_rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static void get_pmic_version(void)
|
static void get_pmic_version(void)
|
||||||
{
|
{
|
||||||
uint8_t val = 0x00;
|
uint8_t val = 0x00;
|
||||||
|
|
@ -921,7 +1030,10 @@ static void get_pmic_version(void)
|
||||||
static void check_jtag_boot(void)
|
static void check_jtag_boot(void)
|
||||||
{
|
{
|
||||||
if (is_jtag_boot(CONFIG_JTAG_MARKER_UBOOT)) {
|
if (is_jtag_boot(CONFIG_JTAG_MARKER_UBOOT)) {
|
||||||
|
char *bootcmd = getenv("bootcmd");
|
||||||
setenv ("bootcmd", "");
|
setenv ("bootcmd", "");
|
||||||
|
/* Save original bootcmd in "bootcmd_orig" to allow manual boot */
|
||||||
|
setenv ("bootcmd_orig", bootcmd);
|
||||||
puts("Detected JTAG boot. Waiting on command line\n");
|
puts("Detected JTAG boot. Waiting on command line\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -970,21 +1082,31 @@ static void blink_led(int pulses)
|
||||||
{
|
{
|
||||||
const int pulse_width = 400*1000; /* 400ms */
|
const int pulse_width = 400*1000; /* 400ms */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
/* Assumes status LED is orange */
|
||||||
|
set_status_led(0, 0);
|
||||||
|
ui_set_top_led(0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
while (pulses) {
|
while (pulses) {
|
||||||
udelay(pulse_width);
|
udelay(pulse_width);
|
||||||
set_status_led(1, 1);
|
set_status_led(1, 1);
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
ui_set_status_led(1, 1);
|
ui_set_status_led(1, 1);
|
||||||
|
#endif
|
||||||
udelay(pulse_width);
|
udelay(pulse_width);
|
||||||
set_status_led(0, 0);
|
set_status_led(0, 0);
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
ui_set_status_led(0, 0);
|
ui_set_status_led(0, 0);
|
||||||
|
#endif
|
||||||
pulses--;
|
pulses--;
|
||||||
}
|
}
|
||||||
|
|
||||||
udelay(pulse_width);
|
udelay(pulse_width);
|
||||||
set_status_led(1, 1); /* Orange */
|
set_status_led(1, 1); /* Orange */
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
ui_set_status_led(1, 1);
|
ui_set_status_led(1, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_reset_button(void)
|
static void check_reset_button(void)
|
||||||
|
|
@ -1042,8 +1164,9 @@ static void check_reset_button(void)
|
||||||
int board_late_init(void)
|
int board_late_init(void)
|
||||||
{
|
{
|
||||||
#if !defined(CONFIG_SPL_BUILD)
|
#if !defined(CONFIG_SPL_BUILD)
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
int ui_ver = -1;
|
int ui_ver = -1;
|
||||||
|
#endif
|
||||||
if (read_eeprom() < 0) {
|
if (read_eeprom() < 0) {
|
||||||
puts("Could not get board ID.\n");
|
puts("Could not get board ID.\n");
|
||||||
}
|
}
|
||||||
|
|
@ -1052,6 +1175,11 @@ int board_late_init(void)
|
||||||
get_hw_version();
|
get_hw_version();
|
||||||
get_pmic_version();
|
get_pmic_version();
|
||||||
|
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
set_root_partition();
|
||||||
|
set_devicetree_name();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Initialize pins */
|
/* Initialize pins */
|
||||||
REQUEST_AND_CLEAR_GPIO(GPIO_WLAN_EN);
|
REQUEST_AND_CLEAR_GPIO(GPIO_WLAN_EN);
|
||||||
REQUEST_AND_CLEAR_GPIO(GPIO_BT_EN);
|
REQUEST_AND_CLEAR_GPIO(GPIO_BT_EN);
|
||||||
|
|
@ -1059,12 +1187,14 @@ int board_late_init(void)
|
||||||
REQUEST_AND_SET_GPIO(CAN0_TERM_N); /* Unused on V2.0 */
|
REQUEST_AND_SET_GPIO(CAN0_TERM_N); /* Unused on V2.0 */
|
||||||
REQUEST_AND_SET_GPIO(CAN1_TERM_N);
|
REQUEST_AND_SET_GPIO(CAN1_TERM_N);
|
||||||
|
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
ui_ver = ui_version();
|
ui_ver = ui_version();
|
||||||
switch (ui_ver) {
|
switch (ui_ver) {
|
||||||
case 1: puts("UI: V1.0\n"); break;
|
case 1: puts("UI: V1.0\n"); break;
|
||||||
case 2: puts("UI: V2.0\n"); break;
|
case 2: puts("UI: V2.0\n"); break;
|
||||||
default: puts("UI: N/A\n"); break;
|
default: puts("UI: N/A\n"); break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (hw_ver == 1) {
|
if (hw_ver == 1) {
|
||||||
/* On HW v1.0 switch and PHYs share the same reset line.
|
/* On HW v1.0 switch and PHYs share the same reset line.
|
||||||
|
|
@ -1099,7 +1229,9 @@ int board_late_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
init_usb_hub();
|
init_usb_hub();
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
init_user_module();
|
init_user_module();
|
||||||
|
#endif
|
||||||
init_sim_mux();
|
init_sim_mux();
|
||||||
init_gsm();
|
init_gsm();
|
||||||
init_gnss();
|
init_gnss();
|
||||||
|
|
@ -1113,8 +1245,10 @@ int board_late_init(void)
|
||||||
|
|
||||||
set_status_led(1, 1); /* Orange */
|
set_status_led(1, 1); /* Orange */
|
||||||
set_indicator_led(0, 0); /* Off */
|
set_indicator_led(0, 0); /* Off */
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
set_status_led(1, 1); /* Orange */
|
set_status_led(1, 1); /* Orange */
|
||||||
set_indicator_led(0, 0); /* Off */
|
set_indicator_led(0, 0); /* Off */
|
||||||
|
#endif
|
||||||
|
|
||||||
check_fct();
|
check_fct();
|
||||||
check_jtag_boot();
|
check_jtag_boot();
|
||||||
|
|
@ -1311,6 +1445,8 @@ static void ft_hw_info(void *blob)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
|
|
||||||
static void ft_user_module(void *blob)
|
static void ft_user_module(void *blob)
|
||||||
{
|
{
|
||||||
if (um_present()) {
|
if (um_present()) {
|
||||||
|
|
@ -1402,6 +1538,8 @@ static void ft_user_interface(void *blob)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static void ft_eth(void *blob)
|
static void ft_eth(void *blob)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
@ -1434,8 +1572,10 @@ int ft_board_setup(void *blob, bd_t *bd)
|
||||||
{
|
{
|
||||||
ft_bootloader_version(blob);
|
ft_bootloader_version(blob);
|
||||||
ft_hw_info(blob);
|
ft_hw_info(blob);
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
ft_user_interface(blob);
|
ft_user_interface(blob);
|
||||||
ft_user_module(blob);
|
ft_user_module(blob);
|
||||||
|
#endif
|
||||||
ft_eth(blob);
|
ft_eth(blob);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Board functions for Netmodule NRHW 20, based on AM335x EVB
|
* Board functions for Netmodule NRHW 20, based on AM335x EVB
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018-2019 NetModule AG - http://www.netmodule.com/
|
* Copyright (C) 2018-2020 NetModule AG - http://www.netmodule.com/
|
||||||
* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
|
* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0+
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
/* TODO: place in proper header file */
|
/* TODO: place in proper header file */
|
||||||
extern void serial_set_console_index(int index);
|
extern void serial_set_console_index(int index);
|
||||||
|
extern int console_init_f(void);
|
||||||
|
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
@ -137,6 +138,8 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
#define IOEXT_LED4_GREEN_MASK (1U << 9)
|
#define IOEXT_LED4_GREEN_MASK (1U << 9)
|
||||||
#define IOEXT_LEDS_ALL_MASK (0x03FF)
|
#define IOEXT_LEDS_ALL_MASK (0x03FF)
|
||||||
|
|
||||||
|
#define NUM_INDICATOR_LEDS 5
|
||||||
|
|
||||||
|
|
||||||
#define DDR3_CLOCK_FREQUENCY (400)
|
#define DDR3_CLOCK_FREQUENCY (400)
|
||||||
|
|
||||||
|
|
@ -218,7 +221,7 @@ static void set_status_led(int red, int green)
|
||||||
da9063_release_i2c_bus(bus);
|
da9063_release_i2c_bus(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_indicator(unsigned led, int red, int green)
|
static void set_indicator_led(unsigned led, int red, int green)
|
||||||
{
|
{
|
||||||
int old_bus;
|
int old_bus;
|
||||||
uint led_red_mask = 0x1U << (2*led);
|
uint led_red_mask = 0x1U << (2*led);
|
||||||
|
|
@ -321,8 +324,13 @@ struct serial_device *default_serial_console(void)
|
||||||
/* TODO: Sorry, what are we doing here.... */
|
/* TODO: Sorry, what are we doing here.... */
|
||||||
/* This is at least dangerous if not completely wrong */
|
/* This is at least dangerous if not completely wrong */
|
||||||
/* TODO: Using UART1 for moment until it is clear what to do */
|
/* TODO: Using UART1 for moment until it is clear what to do */
|
||||||
|
#if 0
|
||||||
|
enable_uart5_pin_mux();
|
||||||
|
return &eserial6_device;
|
||||||
|
#else
|
||||||
enable_uart1_pin_mux();
|
enable_uart1_pin_mux();
|
||||||
return &eserial2_device;
|
return &eserial2_device;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -473,10 +481,12 @@ void am33xx_spl_board_init(void)
|
||||||
init_pmic_spl();
|
init_pmic_spl();
|
||||||
|
|
||||||
init_leds();
|
init_leds();
|
||||||
#if 0 /* TODO: missing ? */
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
set_indicator_led(0, 1, 1); /* Orange */
|
||||||
|
#else
|
||||||
set_status_led(1, 0); /* Red */
|
set_status_led(1, 0); /* Red */
|
||||||
|
set_indicator_led(0, 1, 0); /* Red */
|
||||||
#endif
|
#endif
|
||||||
set_indicator(0, 1, 1); /* Orange */
|
|
||||||
|
|
||||||
/* Set MPU Frequency to what we detected now that voltages are set */
|
/* Set MPU Frequency to what we detected now that voltages are set */
|
||||||
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
||||||
|
|
@ -641,12 +651,6 @@ static void init_gsm(void)
|
||||||
* 4.2.8 PWR_ON pin
|
* 4.2.8 PWR_ON pin
|
||||||
* 4.2.9 RESET_N pin
|
* 4.2.9 RESET_N pin
|
||||||
*
|
*
|
||||||
* Functionality:
|
|
||||||
* - Leave GSM power enable as is (default at power up = off)
|
|
||||||
* - Set reset line inactive (note: inverter logic in HW present)
|
|
||||||
* - Leave button unpressed (note: inverter logic in HW present)
|
|
||||||
* - Modem shall be enabled by Linux system by enabling GSM power
|
|
||||||
* supply
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int bus;
|
int bus;
|
||||||
|
|
@ -710,9 +714,12 @@ int board_init(void)
|
||||||
|
|
||||||
/* Let user know we're starting */
|
/* Let user know we're starting */
|
||||||
init_leds();
|
init_leds();
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
set_status_led(1, 1); /* Orange */
|
set_status_led(1, 1); /* Orange */
|
||||||
/* TODO: Status LED correct? */
|
#else
|
||||||
|
set_status_led(1, 1); /* Orange */
|
||||||
|
set_indicator_led(0, 0, 0); /* Off */
|
||||||
|
#endif
|
||||||
printf("OSC: %lu MHz\n", get_osclk()/1000000);
|
printf("OSC: %lu MHz\n", get_osclk()/1000000);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -726,6 +733,7 @@ int board_init(void)
|
||||||
* - Available tty interfaces
|
* - Available tty interfaces
|
||||||
* - ttyS1: standard console (default)
|
* - ttyS1: standard console (default)
|
||||||
* - ttyS0: COM/IO shield
|
* - ttyS0: COM/IO shield
|
||||||
|
* - ttyNull0: Dummy device if no real UART is available
|
||||||
*/
|
*/
|
||||||
void set_console(void)
|
void set_console(void)
|
||||||
{
|
{
|
||||||
|
|
@ -752,6 +760,20 @@ void set_console(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If ttyS0 (COM_IO shield) is selected, make sure we really have
|
||||||
|
* a COM_IO shield. Otherwise use the dummy tty. Actually this should
|
||||||
|
* not happen. So it is just a sanity check to prevent the kernel from
|
||||||
|
* crashing due to missing console, if something is configured wrong.
|
||||||
|
* (Obviously thats just another hack, but there are no other options on
|
||||||
|
* this platform because of a lot of conflicts between pins and uarts.)
|
||||||
|
*/
|
||||||
|
if (strstr(defaultconsole, "ttyS0")) {
|
||||||
|
if (bd_get_shield(0) != SHIELD_COM_IO) {
|
||||||
|
setenv("defaultconsole", "ttyNull");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PRE_CONSOLE_BUFFER)
|
#if defined(CONFIG_PRE_CONSOLE_BUFFER)
|
||||||
defaultconsole = getenv("defaultconsole");
|
defaultconsole = getenv("defaultconsole");
|
||||||
|
|
||||||
|
|
@ -854,7 +876,10 @@ static void get_pmic_version(void)
|
||||||
static void check_jtag_boot(void)
|
static void check_jtag_boot(void)
|
||||||
{
|
{
|
||||||
if (is_jtag_boot(CONFIG_JTAG_MARKER_UBOOT)) {
|
if (is_jtag_boot(CONFIG_JTAG_MARKER_UBOOT)) {
|
||||||
|
char *bootcmd = getenv("bootcmd");
|
||||||
setenv ("bootcmd", "");
|
setenv ("bootcmd", "");
|
||||||
|
/* Save original bootcmd in "bootcmd_orig" to allow manual boot */
|
||||||
|
setenv ("bootcmd_orig", bootcmd);
|
||||||
puts("Detected JTAG boot. Waiting on command line\n");
|
puts("Detected JTAG boot. Waiting on command line\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -904,9 +929,9 @@ static struct shield_command known_shield_commands[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SHIELD_DUALCAN_PASSIVE,
|
SHIELD_DUALCAN_PASSIVE,
|
||||||
"dualcan",
|
"dualcan-passive",
|
||||||
"shield dualcan termination off off",
|
"shield dualcan-passive",
|
||||||
can_shield_init
|
can_shield_passive_init
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -985,25 +1010,24 @@ static bool get_button_state(void)
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blink_led(int pulses)
|
static void blink_led(int red, int green)
|
||||||
{
|
{
|
||||||
const int pulse_width = 400*1000; /* 400ms */
|
const int pulse_width = 400*1000; /* 400ms */
|
||||||
|
int i;
|
||||||
|
|
||||||
/* Assumes status led on, indicator off */
|
/* Assumes status led is on (green), indicator off */
|
||||||
set_status_led(0, 0);
|
/* udelay(pulse_width); */
|
||||||
|
set_status_led(red, green);
|
||||||
while (pulses) {
|
for (i=0; i<NUM_INDICATOR_LEDS; i++) {
|
||||||
udelay(pulse_width);
|
set_indicator_led(i, red, green);
|
||||||
set_status_led(1, 1);
|
|
||||||
|
|
||||||
udelay(pulse_width);
|
|
||||||
set_status_led(0, 0);
|
|
||||||
|
|
||||||
pulses--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
udelay(pulse_width);
|
udelay(pulse_width);
|
||||||
set_status_led(0, 1);
|
|
||||||
|
set_status_led(0, 1); /* Green */
|
||||||
|
for (i=0; i<NUM_INDICATOR_LEDS; i++) {
|
||||||
|
set_indicator_led(i, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_reset_button(void)
|
static void check_reset_button(void)
|
||||||
|
|
@ -1020,11 +1044,11 @@ static void check_reset_button(void)
|
||||||
|
|
||||||
if (counter == 2000) {
|
if (counter == 2000) {
|
||||||
/* Indicate factory reset threshold */
|
/* Indicate factory reset threshold */
|
||||||
blink_led(1);
|
blink_led(0, 1); /* Green */
|
||||||
}
|
}
|
||||||
else if (counter == 12000) {
|
else if (counter == 12000) {
|
||||||
/* Indicate recovery boot threshold */
|
/* Indicate recovery boot threshold */
|
||||||
blink_led(2);
|
blink_led(1, 0); /* Red */
|
||||||
}
|
}
|
||||||
} while (counter < 12000);
|
} while (counter < 12000);
|
||||||
|
|
||||||
|
|
@ -1096,9 +1120,8 @@ int board_late_init(void)
|
||||||
set_console();
|
set_console();
|
||||||
shield_init();
|
shield_init();
|
||||||
|
|
||||||
/* TODO: Check, correct? */
|
set_status_led(0, 0); /* WAN led off */
|
||||||
set_status_led(0, 1); /* Green */
|
set_indicator_led(0, 0, 1); /* Green */
|
||||||
set_indicator(0, 0, 1); /* Green */
|
|
||||||
|
|
||||||
check_fct();
|
check_fct();
|
||||||
check_jtag_boot();
|
check_jtag_boot();
|
||||||
|
|
@ -1258,6 +1281,8 @@ static void ft_set_gpio_name(void *blob, const char* gpio, int pin, const char*
|
||||||
int i;
|
int i;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
|
|
||||||
|
/* TODO: Determine number of entries from ngpios field */
|
||||||
|
|
||||||
for (i=0; i<32; i++) {
|
for (i=0; i<32; i++) {
|
||||||
if (i == pin) {
|
if (i == pin) {
|
||||||
/* Take provided name if GPIO pin is matched */
|
/* Take provided name if GPIO pin is matched */
|
||||||
|
|
@ -1348,7 +1373,6 @@ int ft_board_setup(void *blob, bd_t *bd)
|
||||||
|
|
||||||
ft_shields(blob);
|
ft_shields(blob);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ U_BOOT_CMD(
|
||||||
shield, 6, 1, do_shieldmode,
|
shield, 6, 1, do_shieldmode,
|
||||||
"Set the shield mode",
|
"Set the shield mode",
|
||||||
"dualcan termination [on|off] [on|off]\n"
|
"dualcan termination [on|off] [on|off]\n"
|
||||||
|
"shield dualcan-passive\n"
|
||||||
"shield comio mode [rs232|rs485] termination [on|off]\n"
|
"shield comio mode [rs232|rs485] termination [on|off]\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,8 +184,18 @@ static int set_shieldmode(char * const argv[], int argc)
|
||||||
return configure_shieldmode(get_mode_from_args(argv, argc));
|
return configure_shieldmode(get_mode_from_args(argv, argc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Static ? */
|
static int no_options(char * const argv[], int argc)
|
||||||
struct shield_t can_shield = {
|
{
|
||||||
|
if (argc != 0) {
|
||||||
|
debug("Too many arguments\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct shield_t can_shield = {
|
||||||
"dualcan", set_shieldmode
|
"dualcan", set_shieldmode
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -193,3 +203,12 @@ void can_shield_init(void)
|
||||||
{
|
{
|
||||||
shield_register(&can_shield);
|
shield_register(&can_shield);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct shield_t can_shield_passive = {
|
||||||
|
"dualcan-passive", no_options
|
||||||
|
};
|
||||||
|
|
||||||
|
void can_shield_passive_init(void)
|
||||||
|
{
|
||||||
|
shield_register(&can_shield_passive);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@ int shield_can_init(void);
|
||||||
int shield_can_setmode(int mode);
|
int shield_can_setmode(int mode);
|
||||||
|
|
||||||
void can_shield_init(void);
|
void can_shield_init(void);
|
||||||
|
void can_shield_passive_init(void);
|
||||||
|
|
||||||
#endif // SHIELD_CAN_H
|
#endif // SHIELD_CAN_H
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Board functions for Netmodule NRHW 24, based on AM335x EVB
|
* Board functions for Netmodule NRHW 24, based on AM335x EVB
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018-2019 NetModule AG - http://www.netmodule.com/
|
* Copyright (C) 2018-2020 NetModule AG - http://www.netmodule.com/
|
||||||
* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
|
* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-2.0+
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
/* TODO: place in proper header file */
|
/* TODO: place in proper header file */
|
||||||
extern void serial_set_console_index(int index);
|
extern void serial_set_console_index(int index);
|
||||||
|
extern int console_init_f(void);
|
||||||
|
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
@ -52,6 +53,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
*
|
*
|
||||||
* (A17) GPIO0_2: RST_GNSS~
|
* (A17) GPIO0_2: RST_GNSS~
|
||||||
* (A16) GPIO0_5: EXTINT_GNSS
|
* (A16) GPIO0_5: EXTINT_GNSS
|
||||||
|
* (C15) GPIO0_6: TIMEPULSE_GNSS
|
||||||
*
|
*
|
||||||
* (J18) GPIO0_16: RST_PHY~
|
* (J18) GPIO0_16: RST_PHY~
|
||||||
* (U12) GPIO0_27: RST_SHIELD~
|
* (U12) GPIO0_27: RST_SHIELD~
|
||||||
|
|
@ -148,6 +150,7 @@ err_free_gpio:
|
||||||
|
|
||||||
static void init_leds(void)
|
static void init_leds(void)
|
||||||
{
|
{
|
||||||
|
/* No init code required */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_status_led(int red, int green)
|
static void set_status_led(int red, int green)
|
||||||
|
|
@ -259,10 +262,8 @@ struct serial_device *default_serial_console(void)
|
||||||
|
|
||||||
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
|
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
|
||||||
|
|
||||||
// TODO: Double check !
|
|
||||||
static const struct ddr_data ddr3_data = {
|
static const struct ddr_data ddr3_data = {
|
||||||
/* Ratios were optimized by DDR3 training software from TI */
|
/* Ratios were optimized by DDR3 training software from TI */
|
||||||
/* TODO: Evaluate new values and update */
|
|
||||||
.datardsratio0 = 0x39, /* 0x39 */
|
.datardsratio0 = 0x39, /* 0x39 */
|
||||||
.datawdsratio0 = 0x3f, /* 0x40 */ /* 3f */
|
.datawdsratio0 = 0x3f, /* 0x40 */ /* 3f */
|
||||||
.datafwsratio0 = 0x98, /* 0x96 */ /* 98 */
|
.datafwsratio0 = 0x98, /* 0x96 */ /* 98 */
|
||||||
|
|
@ -410,8 +411,10 @@ void am33xx_spl_board_init(void)
|
||||||
init_pmic_spl();
|
init_pmic_spl();
|
||||||
|
|
||||||
init_leds();
|
init_leds();
|
||||||
|
#ifndef CONFIG_NRSW_BUILD
|
||||||
set_status_led(1, 0); /* Red */
|
set_status_led(1, 0); /* Red */
|
||||||
set_indicator_led(1, 0); /* Red */
|
set_indicator_led(1, 0); /* Red */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set MPU Frequency to what we detected now that voltages are set */
|
/* Set MPU Frequency to what we detected now that voltages are set */
|
||||||
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
||||||
|
|
@ -546,20 +549,50 @@ static void init_gsm(void)
|
||||||
* 4.2.8 PWR_ON pin
|
* 4.2.8 PWR_ON pin
|
||||||
* 4.2.9 RESET_N pin
|
* 4.2.9 RESET_N pin
|
||||||
*
|
*
|
||||||
* Functionality:
|
* Functionality Yocto:
|
||||||
* - Leave GSM power enable as is (default at power up = off)
|
* - Leave GSM power enable as is (default at power up = off)
|
||||||
* - Set reset line inactive (note: inverter logic in HW present)
|
* - Set reset line inactive (note: inverter logic in HW present)
|
||||||
* - Leave button unpressed (note: inverter logic in HW present)
|
* - Leave button unpressed (note: inverter logic in HW present)
|
||||||
* - Modem shall be enabled by Linux system by enabling GSM power
|
* - Modem shall be enabled by Linux system by enabling GSM power
|
||||||
* supply
|
* supply
|
||||||
*/
|
*/
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
int bus;
|
||||||
|
|
||||||
puts("GSM: ");
|
puts("GSM: ");
|
||||||
|
|
||||||
|
bus = da9063_claim_i2c_bus();
|
||||||
|
|
||||||
|
/* TODO: Keep Power-On and use GSM Modem Reset Signal to restart */
|
||||||
|
|
||||||
|
REQUEST_AND_SET_GPIO(GPIO_RST_GSM); /* Assert reset (active high) */
|
||||||
|
REQUEST_AND_CLEAR_GPIO(GPIO_PWR_GSM); /* Keep power switch inactive (released) */
|
||||||
|
|
||||||
|
da9063_set_gpio(PMIC_GSM_SUPPLY_EN_IO, 0); /* Switch GSM Supply off */
|
||||||
|
mdelay(30+100); /* Give time to discharge supply */
|
||||||
|
/* Keep of for 100ms, #3.3.2 */
|
||||||
|
|
||||||
|
da9063_set_gpio(PMIC_GSM_SUPPLY_EN_IO, 1); /* Enable GSM supply */
|
||||||
|
mdelay(10);
|
||||||
|
|
||||||
|
gpio_set_value(GPIO_RST_GSM, 0); /* Take modem out of reset */
|
||||||
|
mdelay(300); /* Wait for power to stabilizy, #3.4.2 */
|
||||||
|
|
||||||
|
gpio_set_value(GPIO_PWR_GSM, 1); /* Generate power on event, #3.4.2 */
|
||||||
|
mdelay(1200);
|
||||||
|
gpio_set_value(GPIO_PWR_GSM, 0);
|
||||||
|
|
||||||
|
da9063_release_i2c_bus(bus);
|
||||||
|
|
||||||
|
puts("ready\n");
|
||||||
|
#else
|
||||||
|
puts("GSM: ");
|
||||||
|
|
||||||
REQUEST_AND_CLEAR_GPIO(GPIO_RST_GSM); /* Set reset inactive (active high) */
|
REQUEST_AND_CLEAR_GPIO(GPIO_RST_GSM); /* Set reset inactive (active high) */
|
||||||
REQUEST_AND_CLEAR_GPIO(GPIO_PWR_GSM); /* Set power switch inactive/released (active high) */
|
REQUEST_AND_CLEAR_GPIO(GPIO_PWR_GSM); /* Set power switch inactive/released (active high) */
|
||||||
|
|
||||||
puts("init\n");
|
puts("init\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_gnss(void)
|
static void init_gnss(void)
|
||||||
|
|
@ -655,7 +688,7 @@ void set_console(void)
|
||||||
*/
|
*/
|
||||||
setenv("defaultconsole", "ttyS0");
|
setenv("defaultconsole", "ttyS0");
|
||||||
|
|
||||||
if (read_file("/root/boot/consoledev",buf, sizeof(buf)) > 3) {
|
if (read_file("/root/boot/consoledev", buf, sizeof(buf)) > 3) {
|
||||||
if (strstr(buf, "tty") == buf) {
|
if (strstr(buf, "tty") == buf) {
|
||||||
int i;
|
int i;
|
||||||
/* TODO: What is this code doing? */
|
/* TODO: What is this code doing? */
|
||||||
|
|
@ -755,7 +788,10 @@ static void get_pmic_version(void)
|
||||||
static void check_jtag_boot(void)
|
static void check_jtag_boot(void)
|
||||||
{
|
{
|
||||||
if (is_jtag_boot(CONFIG_JTAG_MARKER_UBOOT)) {
|
if (is_jtag_boot(CONFIG_JTAG_MARKER_UBOOT)) {
|
||||||
|
char *bootcmd = getenv("bootcmd");
|
||||||
setenv ("bootcmd", "");
|
setenv ("bootcmd", "");
|
||||||
|
/* Save original bootcmd in "bootcmd_orig" to allow manual boot */
|
||||||
|
setenv ("bootcmd_orig", bootcmd);
|
||||||
puts("Detected JTAG boot. Waiting on command line\n");
|
puts("Detected JTAG boot. Waiting on command line\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -805,9 +841,9 @@ static struct shield_command known_shield_commands[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SHIELD_DUALCAN_PASSIVE,
|
SHIELD_DUALCAN_PASSIVE,
|
||||||
"dualcan (passive)",
|
"dualcan-passive",
|
||||||
"shield dualcan termination off off",
|
"shield dualcan-passive",
|
||||||
can_shield_init
|
can_shield_passive_init
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1211,7 +1247,11 @@ static void ft_shields(void* blob)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ft_enable_node(blob, "/netbox_dio_default");
|
/*
|
||||||
|
* Enable uart1 (ttyS0) always as kernel needs it as fallback console,
|
||||||
|
* if (ttyS1) is not available as console.
|
||||||
|
*/
|
||||||
|
ft_enable_node(blob, "/ocp/serial@44e09000");
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1279,14 +1319,6 @@ int ft_board_setup(void *blob, bd_t *bd)
|
||||||
|
|
||||||
ft_shields(blob);
|
ft_shields(blob);
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable uart1 (ttyS0) always as kernel needs it as fallback console,
|
|
||||||
* if (ttyS1) is not available as console.
|
|
||||||
*/
|
|
||||||
/* TODO: This does not work, as pins are then blocked for CAN
|
|
||||||
* Double check with NRSW
|
|
||||||
*/
|
|
||||||
/* ft_enable_node(blob, "/ocp/serial@44e09000"); */
|
|
||||||
|
|
||||||
ft_override_thermal(blob);
|
ft_override_thermal(blob);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ U_BOOT_CMD(
|
||||||
shield, 6, 1, do_shieldmode,
|
shield, 6, 1, do_shieldmode,
|
||||||
"Set the shield mode",
|
"Set the shield mode",
|
||||||
"dualcan termination [on|off] [on|off]\n"
|
"dualcan termination [on|off] [on|off]\n"
|
||||||
|
"shield dualcan-passive\n"
|
||||||
"shield comio mode [rs232|rs485] termination [on|off]\n"
|
"shield comio mode [rs232|rs485] termination [on|off]\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,8 +184,18 @@ static int set_shieldmode(char * const argv[], int argc)
|
||||||
return configure_shieldmode(get_mode_from_args(argv, argc));
|
return configure_shieldmode(get_mode_from_args(argv, argc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Static ? */
|
static int no_options(char * const argv[], int argc)
|
||||||
struct shield_t can_shield = {
|
{
|
||||||
|
if (argc != 0) {
|
||||||
|
debug("Too many arguments\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct shield_t can_shield = {
|
||||||
"dualcan", set_shieldmode
|
"dualcan", set_shieldmode
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -193,3 +203,12 @@ void can_shield_init(void)
|
||||||
{
|
{
|
||||||
shield_register(&can_shield);
|
shield_register(&can_shield);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct shield_t can_shield_passive = {
|
||||||
|
"dualcan-passive", no_options
|
||||||
|
};
|
||||||
|
|
||||||
|
void can_shield_passive_init(void)
|
||||||
|
{
|
||||||
|
shield_register(&can_shield_passive);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@ int shield_can_init(void);
|
||||||
int shield_can_setmode(int mode);
|
int shield_can_setmode(int mode);
|
||||||
|
|
||||||
void can_shield_init(void);
|
void can_shield_init(void);
|
||||||
|
void can_shield_passive_init(void);
|
||||||
|
|
||||||
#endif // SHIELD_CAN_H
|
#endif // SHIELD_CAN_H
|
||||||
|
|
|
||||||
|
|
@ -113,19 +113,12 @@ int login (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* SHA1 */
|
/* SHA256 */
|
||||||
char *cp = sha_crypt(password, stored_pw_hash); /* TODO: Salt = PW? */
|
char *cp = sha_crypt(password, stored_pw_hash); /* TODO: Salt = PW? */
|
||||||
res = memcmp(cp, stored_pw_hash, actread);
|
res = memcmp(cp, stored_pw_hash, actread);
|
||||||
free(cp);
|
free(cp);
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
break;
|
break;
|
||||||
/*
|
|
||||||
if (memcmp(cp, stored_pw_hash, actread) == 0) {
|
|
||||||
free(cp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
free(cp);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: exponentional delay */
|
/* TODO: exponentional delay */
|
||||||
|
|
|
||||||
|
|
@ -458,9 +458,11 @@ void preloader_console_init(void)
|
||||||
gd->have_console = 1;
|
gd->have_console = 1;
|
||||||
|
|
||||||
#ifdef CONFIG_NRSW_BUILD
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
puts("\n" SPL_VERSION);
|
puts("\n" SPL_VERSION "\n");
|
||||||
|
#else
|
||||||
|
puts("\n");
|
||||||
#endif
|
#endif
|
||||||
puts("\nU-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
|
puts("U-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
|
||||||
U_BOOT_TIME ")\n");
|
U_BOOT_TIME ")\n");
|
||||||
#ifdef CONFIG_SPL_DISPLAY_PRINT
|
#ifdef CONFIG_SPL_DISPLAY_PRINT
|
||||||
spl_display_print();
|
spl_display_print();
|
||||||
|
|
|
||||||
|
|
@ -420,8 +420,10 @@ static int omap24_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr,
|
||||||
}
|
}
|
||||||
if (status == 0 || (status & I2C_STAT_NACK)) {
|
if (status == 0 || (status & I2C_STAT_NACK)) {
|
||||||
i2c_error = 1;
|
i2c_error = 1;
|
||||||
/*printf("i2c_read: error waiting for addr ACK (status=0x%x)\n",
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
status);*/
|
printf("i2c_read: error waiting for addr ACK (status=0x%x)\n",
|
||||||
|
status);
|
||||||
|
#endif
|
||||||
goto rd_exit;
|
goto rd_exit;
|
||||||
}
|
}
|
||||||
if (alen) {
|
if (alen) {
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,6 @@ static int console_index = CONFIG_CONS_INDEX - 1;
|
||||||
static int console_index = 0;
|
static int console_index = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TODO: Rename CONSOLE_INDEX to console_index, to make clear it
|
|
||||||
* is a variable now
|
|
||||||
*/
|
|
||||||
void serial_set_console_index(int index)
|
void serial_set_console_index(int index)
|
||||||
{
|
{
|
||||||
console_index = index;
|
console_index = index;
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,7 @@ int eth_phy_timeout(void);
|
||||||
"tftp_recovery=tftpboot $kernel_addr_r recovery-image; tftpboot $fdt_addr_r recovery-dtb; " \
|
"tftp_recovery=tftpboot $kernel_addr_r recovery-image; tftpboot $fdt_addr_r recovery-dtb; " \
|
||||||
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
|
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
|
||||||
"debug $ethopts; " \
|
"debug $ethopts; " \
|
||||||
|
"run shieldcmd; " \
|
||||||
"bootz $kernel_addr_r - $fdt_addr_r\0" /* kernel_addr_r */
|
"bootz $kernel_addr_r - $fdt_addr_r\0" /* kernel_addr_r */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -183,8 +184,8 @@ int eth_phy_timeout(void);
|
||||||
#define CONFIG_ZERO_BOOTDELAY_CHECK
|
#define CONFIG_ZERO_BOOTDELAY_CHECK
|
||||||
|
|
||||||
/* UART Configuration */
|
/* UART Configuration */
|
||||||
#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0: XModem Boot */
|
#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0: XModem Boot, Shield */
|
||||||
#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1: eMMC Boot, User UART */
|
#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1: Debug UART (Internal) */
|
||||||
|
|
||||||
#define CONFIG_I2C
|
#define CONFIG_I2C
|
||||||
#define CONFIG_I2C_MULTI_BUS
|
#define CONFIG_I2C_MULTI_BUS
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,25 @@
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
#include <version_autogenerated.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NRSW_BUILD
|
||||||
|
|
||||||
|
int display_options (void)
|
||||||
|
{
|
||||||
|
printf ("\n\n%s\n", UBOOT_VERSION);
|
||||||
|
#if defined(BUILD_TAG)
|
||||||
|
printf ("%s, Build: %s\n\n", version_string, BUILD_TAG);
|
||||||
|
#else
|
||||||
|
printf ("%s\n\n", version_string);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* CONFIG_NRSW_BUILD */
|
||||||
|
|
||||||
int display_options (void)
|
int display_options (void)
|
||||||
{
|
{
|
||||||
#if defined(BUILD_TAG)
|
#if defined(BUILD_TAG)
|
||||||
|
|
@ -23,6 +42,8 @@ int display_options (void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_NRSW_BUILD */
|
||||||
|
|
||||||
void print_freq(uint64_t freq, const char *s)
|
void print_freq(uint64_t freq, const char *s)
|
||||||
{
|
{
|
||||||
unsigned long m = 0;
|
unsigned long m = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue