Compare commits
74 Commits
2016.05-am
...
2016.05-am
| Author | SHA1 | Date |
|---|---|---|
|
|
cd55d2932a | |
|
|
f47237771c | |
|
|
69e9c386dd | |
|
|
4e67fc3997 | |
|
|
4bbdb87d6b | |
|
|
e1069f6d23 | |
|
|
a9e615e7ae | |
|
|
7b4add1789 | |
|
|
4832ca022a | |
|
|
2fa18965e6 | |
|
|
a6b26419bc | |
|
|
6cc285809d | |
|
|
3a9ef955c2 | |
|
|
a39cba028a | |
|
|
2997b916c1 | |
|
|
e8475b4f80 | |
|
|
088d4c7ddf | |
|
|
3b18df525d | |
|
|
24c0d5539e | |
|
|
6ca8df40e6 | |
|
|
6f10e899b1 | |
|
|
e85e9ffa83 | |
|
|
0330a6b94f | |
|
|
7e9ca6d8fa | |
|
|
f5b16d4cf7 | |
|
|
f82ac7239a | |
|
|
dc6ed546db | |
|
|
55332e5582 | |
|
|
1de7ebd031 | |
|
|
d3f9300741 | |
|
|
50dbe9d830 | |
|
|
820db26639 | |
|
|
5e1b277281 | |
|
|
9f0dd0d481 | |
|
|
c8a4189cd1 | |
|
|
29a9c27aa3 | |
|
|
14cbc05115 | |
|
|
2bc5815cb6 | |
|
|
13b003ae3b | |
|
|
1ac538b956 | |
|
|
f89b5527b7 | |
|
|
08e8a21515 | |
|
|
9b04a8130e | |
|
|
93a35c7311 | |
|
|
567a630018 | |
|
|
3d8a85df86 | |
|
|
e2bf817634 | |
|
|
e0f24ed684 | |
|
|
7336361d5c | |
|
|
a02c9b9da3 | |
|
|
f51b3b4fc3 | |
|
|
7b1000b59d | |
|
|
a3fd0500ec | |
|
|
2844abe1c2 | |
|
|
a583bb6eea | |
|
|
ce70a04c33 | |
|
|
41742d2865 | |
|
|
6fabed9c5d | |
|
|
7c3defb4e0 | |
|
|
3274638d7d | |
|
|
7620f09ce4 | |
|
|
a93f6f3874 | |
|
|
e940bb1802 | |
|
|
cac1b16a16 | |
|
|
0530de83a0 | |
|
|
0cde66a780 | |
|
|
1ada49ca8c | |
|
|
05e24f04fe | |
|
|
19271e52e9 | |
|
|
64a2a57636 | |
|
|
da716b9200 | |
|
|
4d9788bdc8 | |
|
|
ace146330e | |
|
|
bb120c7271 |
|
|
@ -414,6 +414,14 @@ config TARGET_AM335X_NRHW24
|
|||
select DM_SERIAL
|
||||
select DM_GPIO
|
||||
|
||||
config TARGET_AM335X_HW25
|
||||
bool "Support am335x_hw25"
|
||||
select CPU_V7
|
||||
select SUPPORT_SPL
|
||||
select DM
|
||||
select DM_SERIAL
|
||||
select DM_GPIO
|
||||
|
||||
config TARGET_AM335X_SL50
|
||||
bool "Support am335x_sl50"
|
||||
select CPU_V7
|
||||
|
|
@ -915,6 +923,7 @@ source "board/nm/netbird_v2/Kconfig"
|
|||
source "board/nm/nrhw20/Kconfig"
|
||||
source "board/nm/nmhw21/Kconfig"
|
||||
source "board/nm/nrhw24/Kconfig"
|
||||
source "board/nm/hw25/Kconfig"
|
||||
source "board/olimex/mx23_olinuxino/Kconfig"
|
||||
source "board/phytec/pcm051/Kconfig"
|
||||
source "board/phytec/pcm052/Kconfig"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
* Fixed wrong sizeof type in GetPartition()
|
||||
* Changed 64 bit type to "long long" from struct
|
||||
* Added BD_VerifySha1Hmac() function
|
||||
* 20200615 rs Added BD_Hw_Type tag
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -160,7 +162,8 @@ typedef enum _BD_Tags
|
|||
|
||||
BD_BOM_Patch = 33, /**< "UInt8" -> Hardware BOM patch of the equipment (BOM changes, same PCB, not SW relevant) */
|
||||
BD_Prod_Variant_Name = 34, /**< "String" -> Product variant */
|
||||
|
||||
BD_Hw_Type = 35, /*<< "UInt16" -> Hardware Type, e.g. 24 for HW24, 26 for HW26 */
|
||||
|
||||
BD_Ui_Adapter_Type = 4096, /**< "UInt16" -> IV OG2 UI adapterboard type (0 = not present) */
|
||||
BD_Voltage = 4098, /**< "UInt8" -> Primary Voltage (1=12-60V, 2=40-160V, 3=24-60V, 4=?, 5=12-24V) */
|
||||
|
||||
|
|
@ -181,10 +184,10 @@ typedef enum _BD_Tags
|
|||
BD_Patch = 4126, /**< "UInt8" -> Board patch level (after production) */
|
||||
BD_Pd_Phy2 = 4127, /**< "String" -> */
|
||||
PD_SerDes = 4128, /**< "UInt16" -> SERDES Configuration (e.g. NB1800) */
|
||||
PD_Shield = 4129, /**< "UInt16" -> Assembled Shield (0=COM/IO, 1=DualCAN) */
|
||||
PD_Shield = 4129, /**< "UInt16" -> Assembled Shield (0=COM/IO, 1=DualCAN), 2=CAN/GNSS, 3=DualCAN Passive */
|
||||
|
||||
/* project specific tags */
|
||||
BD_BootPart = 32768, /**< "UInt8" */
|
||||
BD_BootPart = 32768, /**< "UInt8" */
|
||||
|
||||
BD_None_Type = 65535, /**< "Void" -> None */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
* code cleanup (tabs/indentation)
|
||||
* 20110211 rs partition table handling
|
||||
* 20190330 rs cleanup after years of chaotic development
|
||||
* 20200615 rs added bd_get_hw_type()
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <common.h>
|
||||
|
|
@ -217,6 +218,16 @@ int bd_get_variantname(char *variantname, size_t len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void bd_get_hw_type(int* type)
|
||||
{
|
||||
uint16_t hwtype = 0;
|
||||
|
||||
if ( !_get_uint16( BD_Hw_Type, 0, &hwtype) )
|
||||
debug("%s() no Hw Type found\n", __func__);
|
||||
|
||||
*type = hwtype;
|
||||
}
|
||||
|
||||
void bd_get_hw_version(int* ver, int* rev)
|
||||
{
|
||||
uint8_t hwver = 0;
|
||||
|
|
@ -268,6 +279,26 @@ uint32_t bd_get_fpgainfo(void)
|
|||
return fpgainfo;
|
||||
}
|
||||
|
||||
int bd_get_pd_dio(char *config, size_t len)
|
||||
{
|
||||
if ( !_get_string(BD_Pd_DIO, 0, config, len) ) {
|
||||
debug("%s() no DIO info\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bd_get_pd_serial(char *config, size_t len)
|
||||
{
|
||||
if ( !_get_string(BD_Pd_Serial, 0, config, len) ) {
|
||||
debug("%s() no serial port info\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bd_get_pd_module(uint32_t slot, char *config, size_t len)
|
||||
{
|
||||
if ( !_get_string(BD_Pd_Module0 + slot, 0, config, len) ) {
|
||||
|
|
|
|||
|
|
@ -17,10 +17,13 @@ int bd_get_context(BD_Context *bdctx, uint32_t i2caddress, uint32_t offset);
|
|||
|
||||
int bd_get_prodname(char *prodname, size_t len);
|
||||
int bd_get_variantname(char *variantname, size_t len);
|
||||
void bd_get_hw_type(int* type);
|
||||
void bd_get_hw_version(int* ver, int* rev);
|
||||
void bd_get_hw_patch(int* patch);
|
||||
int bd_get_mac(int index, uint8_t *macaddr, size_t len);
|
||||
uint32_t bd_get_fpgainfo(void);
|
||||
int bd_get_pd_dio(char *config, size_t len);
|
||||
int bd_get_pd_serial(char *config, size_t len);
|
||||
int bd_get_pd_module(uint32_t slot, char *config, size_t len);
|
||||
int bd_get_sim_config(char* simconfig, size_t len);
|
||||
int bd_get_devicetree(char* devicetreename, size_t len);
|
||||
|
|
|
|||
|
|
@ -11,20 +11,34 @@
|
|||
#ifndef 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_ADDR 0x58 /* Pages 0 and 1, Pages 2 and 3 -> 0x59 */
|
||||
|
||||
#define PMIC_REG_STATUS_A 0x01 /* Status of ON_KEY, WAKE, COMP1V2, DVC */
|
||||
#define PMIC_REG_STATUS_A_COMP1V2_MASK 0x08
|
||||
|
||||
#define PMIC_REG_FAULT_LOG 0x05 /* PMIC fault log register, holding reset reason */
|
||||
#define PMIC_FAULT_TWD_ERROR_MASK 0x01 /* Watchdog timeout detected */
|
||||
#define PMIC_FAULT_POR_MASK 0x02 /* Startup from No-Power/RTC/Delivery mode */
|
||||
|
||||
#define PMIC_REG_CONTROL_D 0x11 /* Control register for blink/watchdog */
|
||||
#define PMIC_REG_GPIO14_15 0x1C /* Configuration of GPIO14/15 (mode, wake) */
|
||||
#define PMIC_REG_EVENT_A 0x06
|
||||
#define PMIC_REG_EVENT_ONKEY_MASK 0x01
|
||||
#define PMIC_REG_EVENT_RTC_ALARM_MASK 0x02
|
||||
#define PMIC_REG_EVENT_RTC_TICK_MASK 0x04
|
||||
#define PMIC_REG_EVENT_EVENTS_B_MASK 0x20
|
||||
|
||||
#define PMIC_REG_EVENT_B 0x07
|
||||
#define PMIC_REG_EVENT_COMP1V2_MASK 0x04
|
||||
|
||||
#define PMIC_REG_IRQ_MASK_A 0x0A
|
||||
#define PMIC_REG_IRQ_MASK_B 0x0B
|
||||
#define PMIC_REG_IRQ_MASK_C 0x0C
|
||||
#define PMIC_REG_IRQ_MASK_D 0x0D
|
||||
|
||||
#define PMIC_REG_CONTROL_A 0x0E /* Control register for power states */
|
||||
#define PMIC_REG_CONTROL_D 0x11 /* Control register for blink/watchdog */
|
||||
#define PMIC_REG_GPIO14_15 0x1C /* Configuration of GPIO14/15 (mode, wake) */
|
||||
#define PMIC_REG_GPIO_MODE0_7 0x1D /* Control register for GPIOs 0..7 */
|
||||
#define PMIC_REG_GPIO_MODE8_15 0x1E /* Control register for GPIOs 8..15 */
|
||||
|
||||
|
|
@ -43,6 +57,7 @@ TODO: Add include for uint32_t (stdtypes.h)
|
|||
#define PMIC_LDOx_CONF_MASK 0x80
|
||||
|
||||
#define PMIC_REG_ID_4_3 0x84
|
||||
#define PMIC_REG_ID_6_5 0x85
|
||||
|
||||
#define PMIC_REG_BUCK_ILIM_A 0x9A
|
||||
#define PMIC_REG_BUCK_ILIM_B 0x9B
|
||||
|
|
@ -68,6 +83,9 @@ TODO: Add include for uint32_t (stdtypes.h)
|
|||
|
||||
#define PMIC_REG_TRIM_CLDR 0x120 /* Calendar Trim register, 2's complement, 1.9ppm per bit */
|
||||
|
||||
#define PMIC_GP_ID_0 0x121 /* General purpose ID 0 (R/W) */
|
||||
#define PMIC_GP_ID_1 0x122 /* General purpose ID 1 (R/W) */
|
||||
|
||||
#define PMIC_REG_CONFIG_ID 0x184 /* OTP Config ID <ver.rev> */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* ether_crc.c
|
||||
*
|
||||
* Ethernet CRC computation
|
||||
*
|
||||
* Copyright (C) 2018-2020 NetModule AG - http://www.netmodule.com/
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#include "ether_crc.h"
|
||||
|
||||
|
||||
uint32_t ether_crc(size_t len, uint8_t const *p)
|
||||
{
|
||||
uint32_t crc;
|
||||
unsigned i;
|
||||
|
||||
crc = ~0;
|
||||
while (len--) {
|
||||
crc ^= *p++;
|
||||
for (i = 0; i < 8; i++)
|
||||
crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0);
|
||||
}
|
||||
|
||||
/* an reverse the bits, cuz of way they arrive -- last-first */
|
||||
crc = (crc >> 16) | (crc << 16);
|
||||
crc = (crc >> 8 & 0x00ff00ff) | (crc << 8 & 0xff00ff00);
|
||||
crc = (crc >> 4 & 0x0f0f0f0f) | (crc << 4 & 0xf0f0f0f0);
|
||||
crc = (crc >> 2 & 0x33333333) | (crc << 2 & 0xcccccccc);
|
||||
crc = (crc >> 1 & 0x55555555) | (crc << 1 & 0xaaaaaaaa);
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* ether_crc.h
|
||||
*
|
||||
* Ethernet CRC computation
|
||||
*
|
||||
* Copyright (C) 2018-2020 NetModule AG - http://www.netmodule.com/
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef ETHER_CRC_H
|
||||
#define ETHER_CRC_H
|
||||
|
||||
|
||||
extern uint32_t ether_crc(size_t len, uint8_t const *p);
|
||||
|
||||
|
||||
#endif /* ETHER_CRC_H */
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
if TARGET_AM335X_HW25
|
||||
|
||||
config SYS_BOARD
|
||||
default "hw25"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "nm"
|
||||
|
||||
config SYS_SOC
|
||||
default "am33xx"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "am335x_hw25"
|
||||
|
||||
config CONS_INDEX
|
||||
int "UART used for console"
|
||||
range 1 6
|
||||
default 1
|
||||
help
|
||||
The AM335x SoC has a total of 6 UARTs (UART0 to UART5 as referenced
|
||||
in documentation, etc) available to it. Depending on your specific
|
||||
board you may want something other than UART0 as for example the IDK
|
||||
uses UART3 so enter 4 here.
|
||||
|
||||
endif
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
# Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
ifeq ($(CONFIG_SKIP_LOWLEVEL_INIT),)
|
||||
obj-y := mux.o
|
||||
endif
|
||||
|
||||
obj-y += board.o ../common/bdparser.o ../common/board_descriptor.o ../common/da9063.o ../common/ether_crc.o fileaccess.o
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* board.h
|
||||
*
|
||||
* TI AM335x boards information header
|
||||
*
|
||||
* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* We have three pin mux functions that must exist. We must be able to enable
|
||||
* uart0, for initial output and i2c2 to read the main EEPROM. We then have a
|
||||
* main pinmux function that can be overridden to enable all other pinmux that
|
||||
* is required on the board.
|
||||
*/
|
||||
void enable_uart0_pin_mux(void);
|
||||
|
||||
void enable_board_pin_mux(void);
|
||||
|
||||
#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#include <common.h>
|
||||
#include <fs.h>
|
||||
|
||||
#define BLOCK_DEVICE "mmc"
|
||||
#define OVERLAY_PART "1:3"
|
||||
|
||||
int read_file(const char* filename, char *buf, int size)
|
||||
{
|
||||
loff_t filesize = 0;
|
||||
loff_t len;
|
||||
int ret;
|
||||
|
||||
if (fs_set_blk_dev(BLOCK_DEVICE, OVERLAY_PART, FS_TYPE_EXT) != 0) {
|
||||
puts("Error, can not set blk device\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Read at most file size bytes */
|
||||
if (fs_size(filename, &filesize)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (filesize < size)
|
||||
size = filesize;
|
||||
|
||||
/* For very unclear reasons the block device needs to be set again after the call to fs_size() */
|
||||
if (fs_set_blk_dev(BLOCK_DEVICE, OVERLAY_PART, FS_TYPE_EXT) != 0) {
|
||||
puts("Error, can not set blk device\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((ret = fs_read(filename, (ulong)buf, 0, size, &len))) {
|
||||
printf("Can't read file %s (size %d, len %lld, ret %d)\n", filename, size, len, ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
buf[len] = 0;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
/**@file /home/eichenberger/projects/nbhw16/u-boot/board/nm/netbird_v2/fileaccess.h
|
||||
* @author eichenberger
|
||||
* @version 704
|
||||
* @date
|
||||
* Created: Tue 06 Jun 2017 02:02:33 PM CEST \n
|
||||
* Last Update: Tue 06 Jun 2017 02:02:33 PM CEST
|
||||
*/
|
||||
#ifndef FILEACCESS_H
|
||||
#define FILEACCESS_H
|
||||
|
||||
void fs_set_console(void);
|
||||
int read_file(const char* filename, char *buf, int size);
|
||||
|
||||
#endif // FILEACCESS_H
|
||||
|
|
@ -0,0 +1,223 @@
|
|||
/*
|
||||
* mux.c
|
||||
*
|
||||
* Copyright (C) 2018-2019 NetModule AG - http://www.netmodule.com/
|
||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation version 2.
|
||||
*
|
||||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
||||
* kind, whether express or implied; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#include <asm/arch/hardware.h>
|
||||
#include <asm/arch/mux.h>
|
||||
#include <asm/io.h>
|
||||
#include "board.h"
|
||||
|
||||
static struct module_pin_mux gpio_pin_mux[] = {
|
||||
/*
|
||||
* CPU GPIOs
|
||||
*
|
||||
* (J18) GPIO0_16: RST_PHY~
|
||||
* (U10) GPIO0_22: SEL_RS232/RS485~
|
||||
* (T10) GPIO0_23: EN_RS485_TERM~
|
||||
* (T11) GPIO0_26: IO_OUT1
|
||||
* (U12) GPIO0_27: IO_OUT2
|
||||
*
|
||||
* (T12) GPIO1_12: IO_IN0
|
||||
* (T13) GPIO1_13: IO_IN1
|
||||
* (T14) GPIO1_14: IO_IN2
|
||||
* (T15) GPIO1_15: IO_IN3
|
||||
*
|
||||
* (T13) GPIO2_0: RST_SDCARD~
|
||||
* (L17) GPIO2_18: GSM_PWR_EN
|
||||
* (L16) GPIO2_19: RST_GSM
|
||||
*
|
||||
* (K18) GPIO3_9: WLAN_IRQ
|
||||
* (L18) GPIO3_10: WLAN_EN
|
||||
* (C12) GPIO3_17: SIM_SEL
|
||||
*/
|
||||
|
||||
/* Bank 0 */
|
||||
{OFFSET(mii1_txd3), (MODE(7) | PULLUDDIS)}, /* (J18) gpio0[16] */ /* RST_PHY~ */
|
||||
{OFFSET(gpmc_ad8), (MODE(7) | PULLUDDIS)}, /* (U10) gpio0[22] */ /* SEL_RS232/RS485~ */
|
||||
{OFFSET(gpmc_ad9), (MODE(7) | PULLUDDIS)}, /* (T10) gpio0[23] */ /* EN_RS485_TERM~ */
|
||||
{OFFSET(gpmc_ad10), (MODE(7) | PULLUDDIS)}, /* (T11) gpio0[26] */ /* IO_OUT1 */
|
||||
{OFFSET(gpmc_ad11), (MODE(7) | PULLUDDIS)}, /* (U12) gpio0[27] */ /* IO_OUT2 */
|
||||
|
||||
/* Bank 1 */
|
||||
{OFFSET(gpmc_ad12), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (T12) gpio1[12] */ /* IO_IN0 */
|
||||
{OFFSET(gpmc_ad13), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (R12) gpio1[13] */ /* IO_IN1 */
|
||||
{OFFSET(gpmc_ad14), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (V13) gpio1[14] */ /* IO_IN2 */
|
||||
{OFFSET(gpmc_ad15), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (U13) gpio1[15] */ /* IO_IN3 */
|
||||
|
||||
/* TODO: What about all the unused GPMC pins ? */
|
||||
|
||||
/* Bank 2 */
|
||||
{OFFSET(gpmc_be1n), (MODE(7) | PULLUDDIS)}, /* (T13) gpio2[0] */ /* RST_SDCARD~ */
|
||||
{OFFSET(mii1_rxd3), (MODE(7) | PULLUDDIS)}, /* (L17) gpio2[18] */ /* GSM_PWR_EN */
|
||||
{OFFSET(mii1_rxd2), (MODE(7) | PULLUDDIS)}, /* (L16) gpio2[19] */ /* RST_GSM */
|
||||
|
||||
|
||||
#if 0
|
||||
/* TODO: What is this meant for? */
|
||||
{OFFSET(lcd_data3), (MODE(7) | PULLUDEN | PULLUP_EN)}, /* (R4) gpio2[9] */ /* SYSBOOT_3 */
|
||||
{OFFSET(lcd_data4), (MODE(7) | PULLUDEN | PULLUP_EN)}, /* (T1) gpio2[10] */ /* SYSBOOT_4 */
|
||||
|
||||
/* TODO: Check other unued pins from sysboot block */
|
||||
/* Ensure PU/PD does not work against external signal */
|
||||
/*
|
||||
* SYSBOOT 0,1,5,12,13 = Low
|
||||
* SYSBOOT 2 = High
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* Bank 3 */
|
||||
{OFFSET(mii1_txclk), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (K18) gpio3[9] */ /* WLAN_IRQ */
|
||||
{OFFSET(mii1_rxclk), (MODE(7) | PULLUDDIS)}, /* (L18) gpio3[10] */ /* WLAN_EN */
|
||||
{OFFSET(mcasp0_ahclkr), (MODE(7) | PULLUDEN | PULLDOWN_EN)}, /* (C12) gpio3[17] */ /* SIM_SEL */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* I2C0 PMIC */
|
||||
static struct module_pin_mux i2c0_pin_mux[] = {
|
||||
{OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (C17) I2C0_SDA */
|
||||
{OFFSET(i2c0_scl), (MODE(0) | RXACTIVE | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (C16) I2C0_SCL */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* I2C2 System */
|
||||
static struct module_pin_mux i2c2_pin_mux[] = {
|
||||
{OFFSET(uart1_rtsn), (MODE(3) | RXACTIVE | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (D17) I2C2_SCL */
|
||||
{OFFSET(uart1_ctsn), (MODE(3) | RXACTIVE | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (D18) I2C2_SDA */
|
||||
{-1},
|
||||
};
|
||||
|
||||
/* RMII1: Ethernet */
|
||||
static struct module_pin_mux rmii1_pin_mux[] = {
|
||||
/* RMII */
|
||||
{OFFSET(mii1_crs), MODE(1) | PULLUDDIS | RXACTIVE}, /* (H17) rmii1_crs */
|
||||
{OFFSET(mii1_rxerr), MODE(7) | PULLUDEN | PULLDOWN_EN | RXACTIVE}, /* (J15) gpio (rxerr) */
|
||||
{OFFSET(mii1_rxd0), MODE(1) | PULLUDDIS | RXACTIVE}, /* (M16) rmii1_rxd0 */
|
||||
{OFFSET(mii1_rxd1), MODE(1) | PULLUDDIS | RXACTIVE}, /* (L15) rmii1_rxd1 */
|
||||
{OFFSET(mii1_txen), MODE(1) | PULLUDDIS}, /* (J16) rmii1_txen */
|
||||
{OFFSET(mii1_txd0), MODE(1) | PULLUDDIS}, /* (K17) rmii1_txd0 */
|
||||
{OFFSET(mii1_txd1), MODE(1) | PULLUDDIS}, /* (K16) rmii1_txd1 */
|
||||
{OFFSET(rmii1_refclk), MODE(0) | PULLUDDIS | RXACTIVE}, /* (H18) rmii1_refclk */
|
||||
|
||||
/* SMI */
|
||||
{OFFSET(mdio_clk), MODE(0) | PULLUDDIS}, /* (M18) mdio_clk */
|
||||
{OFFSET(mdio_data), MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE}, /* (M17) mdio_data */
|
||||
|
||||
/* 25MHz Clock Output */
|
||||
{OFFSET(xdma_event_intr0), MODE(3)}, /* (A15) clkout1 (25 MHz clk for PHY) */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* RMII2: Ethernet */
|
||||
static struct module_pin_mux rmii2_pin_mux[] = {
|
||||
/* RMII */
|
||||
{OFFSET(gpmc_a9), MODE(3) | PULLUDDIS | RXACTIVE}, /* (U16) rmii2_crs */
|
||||
{OFFSET(gpmc_wpn), MODE(7) | PULLUDEN | PULLDOWN_EN | RXACTIVE}, /* (U17) gpio (rxerr) */
|
||||
{OFFSET(gpmc_a11), MODE(3) | PULLUDDIS | RXACTIVE}, /* (V17) rmii2_rxd0 */
|
||||
{OFFSET(gpmc_a10), MODE(3) | PULLUDDIS | RXACTIVE}, /* (T16) rmii2_rxd1 */
|
||||
{OFFSET(gpmc_a0), MODE(3) | PULLUDDIS}, /* (R13) rmii2_txen */
|
||||
{OFFSET(gpmc_a5), MODE(3) | PULLUDDIS}, /* (V15) rmii2_txd0 */
|
||||
{OFFSET(gpmc_a4), MODE(3) | PULLUDDIS}, /* (R14) rmii2_txd1 */
|
||||
{OFFSET(mii1_col), MODE(1) | PULLUDDIS | RXACTIVE}, /* (H16) rmii2_refclk */
|
||||
{-1},
|
||||
};
|
||||
|
||||
/* MMC0: WiFi */
|
||||
static struct module_pin_mux mmc0_sdio_pin_mux[] = {
|
||||
{OFFSET(mmc0_clk), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G17) MMC0_CLK */
|
||||
{OFFSET(mmc0_cmd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G18) MMC0_CMD */
|
||||
{OFFSET(mmc0_dat0), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G16) MMC0_DAT0 */
|
||||
{OFFSET(mmc0_dat1), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G15) MMC0_DAT1 */
|
||||
{OFFSET(mmc0_dat2), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (F18) MMC0_DAT2 */
|
||||
{OFFSET(mmc0_dat3), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (F17) MMC0_DAT3 */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* MMC1: eMMC */
|
||||
static struct module_pin_mux mmc1_emmc_pin_mux[] = {
|
||||
{OFFSET(gpmc_csn1), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U9) MMC1_CLK */
|
||||
{OFFSET(gpmc_csn2), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (V9) MMC1_CMD */
|
||||
{OFFSET(gpmc_ad0), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U7) MMC1_DAT0 */
|
||||
{OFFSET(gpmc_ad1), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (V7) MMC1_DAT1 */
|
||||
{OFFSET(gpmc_ad2), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (R8) MMC1_DAT2 */
|
||||
{OFFSET(gpmc_ad3), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (T8) MMC1_DAT3 */
|
||||
{OFFSET(gpmc_ad4), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U8) MMC1_DAT4 */
|
||||
{OFFSET(gpmc_ad5), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (V8) MMC1_DAT5 */
|
||||
{OFFSET(gpmc_ad6), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (R9) MMC1_DAT6 */
|
||||
{OFFSET(gpmc_ad7), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (T9) MMC1_DAT7 */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* USB_DRVBUS not used -> configure as GPIO */
|
||||
static struct module_pin_mux usb_pin_mux[] = {
|
||||
{OFFSET(usb0_drvvbus), (MODE(7) | PULLUDDIS)}, /* (F16) USB0_DRVVBUS */
|
||||
{OFFSET(usb1_drvvbus), (MODE(7) | PULLUDDIS)}, /* (F15) USB1_DRVVBUS */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* UART0: User (Debug/Console) */
|
||||
static struct module_pin_mux uart0_pin_mux[] = {
|
||||
{OFFSET(uart0_rxd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (E15) UART0_RXD */
|
||||
{OFFSET(uart0_txd), (MODE(0) | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (E16) UART0_TXD */
|
||||
{-1},
|
||||
};
|
||||
|
||||
/* UART5: RS232/RS485 */
|
||||
/* CTS is unused - set to GPIO mode */
|
||||
static struct module_pin_mux uart5_pin_mux[] = {
|
||||
{OFFSET(lcd_data9), (MODE(4) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U2) UART5_RXD */
|
||||
{OFFSET(lcd_data8), (MODE(4) | PULLUDEN | PULLUP_EN)}, /* (U1) UART5_TXD */
|
||||
{OFFSET(lcd_data14), (MODE(7) | PULLUDEN | PULLDOWN_EN)}, /* (V4) uart5_ctsn */
|
||||
{OFFSET(lcd_data15), (MODE(6) | PULLUDEN | PULLUP_EN)}, /* (T5) uart5_rtsn */
|
||||
{-1}
|
||||
};
|
||||
|
||||
static struct module_pin_mux unused_pin_mux[] = {
|
||||
/* SYSBOOT6, 7, 10, 11: Not used pulldown active, receiver disabled */
|
||||
{OFFSET(lcd_data6), (MODE(7) | PULLUDEN | PULLDOWN_EN)},
|
||||
{OFFSET(lcd_data7), (MODE(7) | PULLUDEN | PULLDOWN_EN)},
|
||||
{OFFSET(lcd_data10), (MODE(7) | PULLUDEN | PULLDOWN_EN)},
|
||||
{OFFSET(lcd_data11), (MODE(7) | PULLUDEN | PULLDOWN_EN)},
|
||||
|
||||
/* TODO: GPMCA1..3, A6..8 */
|
||||
|
||||
{-1}
|
||||
};
|
||||
|
||||
|
||||
void enable_board_pin_mux(void)
|
||||
{
|
||||
configure_module_pin_mux(gpio_pin_mux);
|
||||
|
||||
configure_module_pin_mux(rmii1_pin_mux);
|
||||
configure_module_pin_mux(rmii2_pin_mux);
|
||||
configure_module_pin_mux(mmc0_sdio_pin_mux);
|
||||
configure_module_pin_mux(mmc1_emmc_pin_mux);
|
||||
configure_module_pin_mux(usb_pin_mux);
|
||||
|
||||
configure_module_pin_mux(i2c0_pin_mux);
|
||||
configure_module_pin_mux(i2c2_pin_mux);
|
||||
|
||||
configure_module_pin_mux(uart5_pin_mux);
|
||||
|
||||
configure_module_pin_mux(unused_pin_mux);
|
||||
}
|
||||
|
||||
void enable_uart0_pin_mux(void)
|
||||
{
|
||||
configure_module_pin_mux(uart0_pin_mux);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2008 Texas Instruments
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
*(.__image_copy_start)
|
||||
*(.vectors)
|
||||
CPUDIR/start.o (.text*)
|
||||
board/nm/hw25/built-in.o (.text*)
|
||||
*(.text*)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : {
|
||||
*(.data*)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
. = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.u_boot_list : {
|
||||
KEEP(*(SORT(.u_boot_list*)));
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
.__efi_runtime_start : {
|
||||
*(.__efi_runtime_start)
|
||||
}
|
||||
|
||||
.efi_runtime : {
|
||||
*(efi_runtime_text)
|
||||
*(efi_runtime_data)
|
||||
}
|
||||
|
||||
.__efi_runtime_stop : {
|
||||
*(.__efi_runtime_stop)
|
||||
}
|
||||
|
||||
.efi_runtime_rel_start :
|
||||
{
|
||||
*(.__efi_runtime_rel_start)
|
||||
}
|
||||
|
||||
.efi_runtime_rel : {
|
||||
*(.relefi_runtime_text)
|
||||
*(.relefi_runtime_data)
|
||||
}
|
||||
|
||||
.efi_runtime_rel_stop :
|
||||
{
|
||||
*(.__efi_runtime_rel_stop)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
|
||||
.image_copy_end :
|
||||
{
|
||||
*(.__image_copy_end)
|
||||
}
|
||||
|
||||
.rel_dyn_start :
|
||||
{
|
||||
*(.__rel_dyn_start)
|
||||
}
|
||||
|
||||
.rel.dyn : {
|
||||
*(.rel*)
|
||||
}
|
||||
|
||||
.rel_dyn_end :
|
||||
{
|
||||
*(.__rel_dyn_end)
|
||||
}
|
||||
|
||||
.hash : { *(.hash*) }
|
||||
|
||||
.end :
|
||||
{
|
||||
*(.__end)
|
||||
}
|
||||
|
||||
_image_binary_end = .;
|
||||
|
||||
/*
|
||||
* Deprecated: this MMU section is used by pxa at present but
|
||||
* should not be used by new boards/CPUs.
|
||||
*/
|
||||
. = ALIGN(4096);
|
||||
.mmutable : {
|
||||
*(.mmutable)
|
||||
}
|
||||
|
||||
/*
|
||||
* Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
|
||||
* __bss_base and __bss_limit are for linker only (overlay ordering)
|
||||
*/
|
||||
|
||||
.bss_start __rel_dyn_start (OVERLAY) : {
|
||||
KEEP(*(.__bss_start));
|
||||
__bss_base = .;
|
||||
}
|
||||
|
||||
.bss __bss_base (OVERLAY) : {
|
||||
*(.bss*)
|
||||
. = ALIGN(4);
|
||||
__bss_limit = .;
|
||||
}
|
||||
|
||||
.bss_end __bss_limit (OVERLAY) : {
|
||||
KEEP(*(.__bss_end));
|
||||
}
|
||||
|
||||
.dynsym _image_binary_end : { *(.dynsym) }
|
||||
.dynbss : { *(.dynbss) }
|
||||
.dynstr : { *(.dynstr*) }
|
||||
.dynamic : { *(.dynamic*) }
|
||||
.gnu.hash : { *(.gnu.hash) }
|
||||
.plt : { *(.plt*) }
|
||||
.interp : { *(.interp*) }
|
||||
.gnu : { *(.gnu*) }
|
||||
.ARM.exidx : { *(.ARM.exidx*) }
|
||||
}
|
||||
|
|
@ -80,8 +80,6 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
|
|||
|
||||
static BD_Context bdctx[3]; /* The descriptor context */
|
||||
|
||||
#define SHIELD_COM_IO 0
|
||||
#define SHIELD_DUALCAN 1
|
||||
|
||||
static int _bd_init(void)
|
||||
{
|
||||
|
|
@ -591,6 +589,16 @@ static struct shield_command known_shield_commands[] = {
|
|||
"fdt set $can1 status okay;",
|
||||
can_shield_init
|
||||
},
|
||||
{
|
||||
SHIELD_DUALCAN_PASSIVE,
|
||||
"dualcan",
|
||||
"shield dualcan termination off off",
|
||||
"fdt get value can0 /aliases d_can0;" \
|
||||
"fdt get value can1 /aliases d_can1;" \
|
||||
"fdt set $can0 status okay;" \
|
||||
"fdt set $can1 status okay;",
|
||||
can_shield_init
|
||||
}
|
||||
};
|
||||
|
||||
static const struct shield_command* get_shield_command(int shield_id)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@
|
|||
#ifndef SHIELD_H
|
||||
#define SHIELD_H
|
||||
|
||||
#define SHIELD_COM_IO 0
|
||||
#define SHIELD_DUALCAN 1
|
||||
#define SHIELD_CAN_GNSS 2
|
||||
#define SHIELD_DUALCAN_PASSIVE 3
|
||||
|
||||
struct shield_t{
|
||||
char name[64];
|
||||
int (*setmode)(char * const argv[], int argc);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#define NETBIRD_GPIO_RST_SHIELD_N GPIO_TO_PIN(0, 27)
|
||||
#define NETBIRD_GPIO_LATCH GPIO_TO_PIN(0, 7)
|
||||
#define NETBIRD_GPIO_MODE_0 GPIO_TO_PIN(1, 8)
|
||||
#define NETBIRD_GPIO_MODE_1 GPIO_TO_PIN(1, 10)
|
||||
#define NETBIRD_GPIO_MODE_0 GPIO_TO_PIN(1, 10)
|
||||
#define NETBIRD_GPIO_MODE_1 GPIO_TO_PIN(1, 8)
|
||||
|
||||
|
||||
static int shield_slot_initialized = 0;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ config SYS_CONFIG_NAME
|
|||
config CONS_INDEX
|
||||
int "UART used for console"
|
||||
range 1 6
|
||||
default 3
|
||||
default 3
|
||||
help
|
||||
The AM335x SoC has a total of 6 UARTs (UART0 to UART5 as referenced
|
||||
in documentation, etc) available to it. Depending on your specific
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@ ifeq ($(CONFIG_SKIP_LOWLEVEL_INIT),)
|
|||
obj-y := mux.o
|
||||
endif
|
||||
|
||||
obj-y += board.o ../common/bdparser.o ../common/board_descriptor.o ../common/da9063.o fileaccess.o sja1105.o ui.o um.o
|
||||
obj-y += board.o ../common/bdparser.o ../common/board_descriptor.o ../common/da9063.o ../common/ether_crc.o fileaccess.o sja1105.o ui.o um.o reset_reason.o
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -13,8 +13,10 @@
|
|||
|
||||
void enable_uart0_pin_mux(void);
|
||||
void enable_uart2_pin_mux(void);
|
||||
void enable_uart4_pin_mux(void);
|
||||
void enable_spi1_mux(void);
|
||||
|
||||
void enable_led_mux(void);
|
||||
void enable_led_mux_v32(void);
|
||||
void enable_board_pin_mux(void);
|
||||
|
||||
#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <common.h>
|
||||
#include <fs.h>
|
||||
|
||||
#define BLOCK_DEVICE "mmc"
|
||||
#define OVERLAY_PART "1:3"
|
||||
|
||||
int read_file(const char* filename, char *buf, int size)
|
||||
|
|
@ -9,14 +10,12 @@ int read_file(const char* filename, char *buf, int size)
|
|||
loff_t len;
|
||||
int ret;
|
||||
|
||||
/* If consoldev is set take this as productive conosle instead of default console */
|
||||
if (fs_set_blk_dev("mmc", OVERLAY_PART, FS_TYPE_EXT) != 0) {
|
||||
if (fs_set_blk_dev(BLOCK_DEVICE, OVERLAY_PART, FS_TYPE_EXT) != 0) {
|
||||
puts("Error, can not set blk device\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* File does not exist, do not print an error message */
|
||||
/* Read at most file size bytes */
|
||||
if (fs_size(filename, &filesize)) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -24,13 +23,12 @@ int read_file(const char* filename, char *buf, int size)
|
|||
if (filesize < size)
|
||||
size = filesize;
|
||||
|
||||
/* If consoldev is set take this as productive conosle instead of default console */
|
||||
if (fs_set_blk_dev("mmc", OVERLAY_PART, FS_TYPE_EXT) != 0) {
|
||||
/* For very unclear reasons the block device needs to be set again after the call to fs_size() */
|
||||
if (fs_set_blk_dev(BLOCK_DEVICE, OVERLAY_PART, FS_TYPE_EXT) != 0) {
|
||||
puts("Error, can not set blk device\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if ((ret = fs_read(filename, (ulong)buf, 0, size, &len))) {
|
||||
printf("Can't read file %s (size %d, len %lld, ret %d)\n", filename, size, len, ret);
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* mux.c
|
||||
*
|
||||
* Copyright (C) 2018 NetModule AG - http://www.netmodule.com/
|
||||
* Copyright (C) 2018-2019 NetModule AG - http://www.netmodule.com/
|
||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
|
@ -23,24 +23,22 @@
|
|||
|
||||
static struct module_pin_mux gpio_pin_mux[] = {
|
||||
/*
|
||||
* (V2) GPIO0_8: RS232_485n_SEL (V3.2)
|
||||
* (V3) GPIO0_9: RS485_DE (V3.2)
|
||||
* (J18) GPIO0_16: ETH_SW_RST~ (V2.0)
|
||||
* (K15) GPIO0_17: CTRL.INT~
|
||||
* (T10) GPIO0_23: CAN_TERM1~ (V1.0)
|
||||
* (T17) GPIO0_30: LED0.GN
|
||||
*
|
||||
* (T12) GPIO1_12: SIM_SW
|
||||
* (V13) GPIO1_14: GNSS_RST~
|
||||
* (U13) GPIO1_15: CAN_TERM0~ (V1.0)
|
||||
* (R14) GPIO1_20: BT_EN
|
||||
* (V15) GPIO1_21: GSM_PWR_EN
|
||||
* (U15) GPIO1_22: LED1.RD
|
||||
* (V16) GPIO1_24: LED1.GN
|
||||
* (U16) GPIO1_25: RST_GSM
|
||||
* (T16) GPIO1_26: WLAN_EN
|
||||
* (V17) GPIO1_27: WLAN_IRQ
|
||||
* (U18) GPIO1_28: LED0.RD
|
||||
*
|
||||
* (U3) GPIO2_16: SIM_PRES~ (V2.0)
|
||||
* (U3) GPIO2_16: TIMEPULSE (HW26), see note [1]
|
||||
* (R6) GPIO2_25: RST_ETH~
|
||||
*
|
||||
* (J17) GPIO3_4: GNSS_EXTINT
|
||||
|
|
@ -48,47 +46,31 @@ static struct module_pin_mux gpio_pin_mux[] = {
|
|||
* (L18) GPIO3_10: CTRL.RST
|
||||
* (C12) GPIO3_17: UI_RST~
|
||||
* (A14) GPIO3_21: RST_HUB~ (USB)
|
||||
*
|
||||
* [1] No PU/PD allowed as TIMEPULSE is internally connected with SAFEBOOT_N.
|
||||
* SAFEBOOT_N must be left open/floating.
|
||||
*/
|
||||
|
||||
/* Bank 0 */
|
||||
{OFFSET(mii1_txd3), (MODE(7) | PULLUDDIS)}, /* (J18) GPIO0_16: ETH_SW_RST~ (V2.0) */
|
||||
{OFFSET(mii1_txd2), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (K15) GPIO0_17: CTRL.INT~ */
|
||||
{OFFSET(gpmc_ad9), (MODE(7) | PULLUDDIS)}, /* (T10) GPIO0_23: CAN_TERM1~ */
|
||||
{OFFSET(gpmc_wait0), (MODE(7) | PULLUDDIS)}, /* (T17) GPIO0_30: LED0.GN */
|
||||
|
||||
/* Bank 1 */
|
||||
{OFFSET(gpmc_ad12), (MODE(7) | PULLUDDIS)}, /* (T12) GPIO1_12: SIM_SW */
|
||||
{OFFSET(gpmc_ad12), (MODE(7) | PULLUDEN | PULLUP_EN)}, /* (T12) GPIO1_12: SIM_SW */
|
||||
{OFFSET(gpmc_ad14), (MODE(7) | PULLUDDIS)}, /* (V13) GPIO1_14: GNSS_RST~ */
|
||||
{OFFSET(gpmc_ad15), (MODE(7) | PULLUDDIS)}, /* (U13) GPIO1_15: CAN_TERM0~ */
|
||||
|
||||
{OFFSET(gpmc_a4), (MODE(7) | PULLUDDIS)}, /* (R14) gpio1_20: BT_EN */
|
||||
{OFFSET(gpmc_a5), (MODE(7) | PULLUDDIS)}, /* (V15) gpio1_21: GSM_PWR_EN */
|
||||
{OFFSET(gpmc_a6), (MODE(7) | PULLUDDIS)}, /* (U15) GPIO1_22: LED1.RD */
|
||||
{OFFSET(gpmc_a8), (MODE(7) | PULLUDDIS)}, /* (V16) GPIO1_24: LED1.GN */
|
||||
{OFFSET(gpmc_a9), (MODE(7) | PULLUDDIS)}, /* (U16) gpio1_25: RST_GSM */
|
||||
{OFFSET(gpmc_a10), (MODE(7) | PULLUDDIS)}, /* (T16) gpio1_26: WLAN_EN */
|
||||
{OFFSET(gpmc_a11), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (V17) gpio1_27: WLAN_IRQ */
|
||||
{OFFSET(gpmc_be1n), (MODE(7) | PULLUDDIS)}, /* (U18) GPIO1_28: LED0.RD */
|
||||
|
||||
/* TODO: What about all the unused GPMC pins ? */
|
||||
|
||||
/* Bank 2 */
|
||||
{OFFSET(lcd_data10), (MODE(7) | PULLUDDIS)}, /* (U3) GPIO2_16: SIM_PRES~ */
|
||||
{OFFSET(lcd_data10), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (U3) GPIO2_16: TIMEPULSE */
|
||||
{OFFSET(lcd_ac_bias_en), (MODE(7) | PULLUDDIS)}, /* (R6) GPIO2_25: RST_ETH~ */
|
||||
|
||||
#if 0
|
||||
/* TODO: What is this meant for? */
|
||||
{OFFSET(lcd_data3), (MODE(7) | PULLUDEN | PULLUP_EN)}, /* (R4) gpio2[9] */ /* SYSBOOT_3 */
|
||||
{OFFSET(lcd_data4), (MODE(7) | PULLUDEN | PULLUP_EN)}, /* (T1) gpio2[10] */ /* SYSBOOT_4 */
|
||||
|
||||
/* TODO: Check other unued pins from sysboot block */
|
||||
/* Ensure PU/PD does not work against external signal */
|
||||
/*
|
||||
* SYSBOOT 0,1,5,12,13 = Low
|
||||
* SYSBOOT 2 = High
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* Bank 3 */
|
||||
{OFFSET(mii1_rxdv), (MODE(7) | PULLUDDIS)}, /* (J17) GPIO3_4: GNSS_EXTINT */
|
||||
{OFFSET(mii1_txclk), (MODE(7) | PULLUDDIS)}, /* (K18) GPIO3_9: CTRL.W_DIS */
|
||||
|
|
@ -98,6 +80,39 @@ static struct module_pin_mux gpio_pin_mux[] = {
|
|||
{-1}
|
||||
};
|
||||
|
||||
static struct module_pin_mux led_pin_mux[] = {
|
||||
/*
|
||||
* (T17) GPIO0_30: LED0.GN
|
||||
* (U15) GPIO1_22: LED1.RD
|
||||
* (V16) GPIO1_24: LED1.GN
|
||||
* (U18) GPIO1_28: LED0.RD
|
||||
*/
|
||||
|
||||
{OFFSET(gpmc_wait0), (MODE(7) | PULLUDDIS)}, /* (T17) GPIO0_30: LED0.GN */
|
||||
{OFFSET(gpmc_a6), (MODE(7) | PULLUDDIS)}, /* (U15) GPIO1_22: LED1.RD */
|
||||
{OFFSET(gpmc_a8), (MODE(7) | PULLUDDIS)}, /* (V16) GPIO1_24: LED1.GN */
|
||||
{OFFSET(gpmc_be1n), (MODE(7) | PULLUDDIS)}, /* (U18) GPIO1_28: LED0.RD */
|
||||
{-1}
|
||||
};
|
||||
|
||||
static struct module_pin_mux led_pin_mux_v32[] = {
|
||||
/*
|
||||
* (C15) GPIO0_6: MB_LED_PWM
|
||||
* (U15) GPIO1_22: LED1.RD
|
||||
* (T15) GPIO1_23: LED0.GN (formerly: (T17) GPIO0_30)
|
||||
* (V16) GPIO1_24: LED1.GN
|
||||
* (U18) GPIO1_28: LED0.RD
|
||||
*/
|
||||
|
||||
{OFFSET(spi0_cs1), (MODE(7) | PULLUDDIS)}, /* (C15) GPIO0_6: MB_LED_PWM */
|
||||
{OFFSET(gpmc_a6), (MODE(7) | PULLUDDIS)}, /* (U15) GPIO1_22: LED1.RD */
|
||||
{OFFSET(gpmc_a7), (MODE(7) | PULLUDDIS)}, /* (T15) GPIO1_23: LED0.GN */
|
||||
{OFFSET(gpmc_a8), (MODE(7) | PULLUDDIS)}, /* (V16) GPIO1_24: LED1.GN */
|
||||
{OFFSET(gpmc_be1n), (MODE(7) | PULLUDDIS)}, /* (U18) GPIO1_28: LED0.RD */
|
||||
{-1}
|
||||
};
|
||||
|
||||
|
||||
/* I2C0 PMIC */
|
||||
static struct module_pin_mux i2c0_pin_mux[] = {
|
||||
{OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (C17) I2C0_SDA */
|
||||
|
|
@ -129,33 +144,33 @@ static struct module_pin_mux rmii1_pin_mux[] = {
|
|||
{OFFSET(mdio_data), MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE}, /* (M17) mdio_data */
|
||||
|
||||
/* 25MHz Clock Output */
|
||||
{OFFSET(xdma_event_intr0), MODE(3)}, /* OK (A15) clkout1 (25 MHz clk for Switch) */
|
||||
{OFFSET(xdma_event_intr0), MODE(3)}, /* (A15) clkout1 (25 MHz clk for Switch) */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* MMC0: WiFi */
|
||||
static struct module_pin_mux mmc0_sdio_pin_mux[] = {
|
||||
{OFFSET(mmc0_clk), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_CLK */
|
||||
{OFFSET(mmc0_cmd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_CMD */
|
||||
{OFFSET(mmc0_dat0), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_DAT0 */
|
||||
{OFFSET(mmc0_dat1), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_DAT1 */
|
||||
{OFFSET(mmc0_dat2), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_DAT2 */
|
||||
{OFFSET(mmc0_dat3), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_DAT3 */
|
||||
{OFFSET(mmc0_clk), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G17) MMC0_CLK */
|
||||
{OFFSET(mmc0_cmd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G18) MMC0_CMD */
|
||||
{OFFSET(mmc0_dat0), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G16) MMC0_DAT0 */
|
||||
{OFFSET(mmc0_dat1), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G15) MMC0_DAT1 */
|
||||
{OFFSET(mmc0_dat2), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (F18) MMC0_DAT2 */
|
||||
{OFFSET(mmc0_dat3), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (F17) MMC0_DAT3 */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* MMC1: eMMC */
|
||||
static struct module_pin_mux mmc1_emmc_pin_mux[] = {
|
||||
{OFFSET(gpmc_csn1), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_CLK */
|
||||
{OFFSET(gpmc_csn2), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_CMD */
|
||||
{OFFSET(gpmc_ad0), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT0 */
|
||||
{OFFSET(gpmc_ad1), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT1 */
|
||||
{OFFSET(gpmc_ad2), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT2 */
|
||||
{OFFSET(gpmc_ad3), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT3 */
|
||||
{OFFSET(gpmc_ad4), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT4 */
|
||||
{OFFSET(gpmc_ad5), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT5 */
|
||||
{OFFSET(gpmc_ad6), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT6 */
|
||||
{OFFSET(gpmc_ad7), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT7 */
|
||||
{OFFSET(gpmc_csn1), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U9) MMC1_CLK */
|
||||
{OFFSET(gpmc_csn2), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (V9) MMC1_CMD */
|
||||
{OFFSET(gpmc_ad0), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U7) MMC1_DAT0 */
|
||||
{OFFSET(gpmc_ad1), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (V7) MMC1_DAT1 */
|
||||
{OFFSET(gpmc_ad2), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (R8) MMC1_DAT2 */
|
||||
{OFFSET(gpmc_ad3), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (T8) MMC1_DAT3 */
|
||||
{OFFSET(gpmc_ad4), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U8) MMC1_DAT4 */
|
||||
{OFFSET(gpmc_ad5), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (V8) MMC1_DAT5 */
|
||||
{OFFSET(gpmc_ad6), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (R9) MMC1_DAT6 */
|
||||
{OFFSET(gpmc_ad7), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (T9) MMC1_DAT7 */
|
||||
{-1}
|
||||
};
|
||||
|
||||
|
|
@ -203,8 +218,22 @@ static struct module_pin_mux uart2_pin_mux[] = {
|
|||
|
||||
/* UART3: GNSS */
|
||||
static struct module_pin_mux uart3_pin_mux[] = {
|
||||
{OFFSET(mii1_rxd3), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (L17) UART3_RXD */
|
||||
{OFFSET(mii1_rxd2), (MODE(1) | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (L16) UART3_TXD */
|
||||
{OFFSET(mii1_rxd3), (MODE(1) | PULLUDDIS | RXACTIVE)}, /* (L17) UART3_RXD */
|
||||
{OFFSET(mii1_rxd2), (MODE(1) | PULLUDDIS | SLEWCTRL)}, /* (L16) UART3_TXD */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* UART4: User RS232/485 (V3.2 only) */
|
||||
static struct module_pin_mux uart4_pin_mux[] = {
|
||||
/*
|
||||
* CTSn = SEL_RS232/RS485~: Default = Low -> RS485 mode
|
||||
* RTSn = RS485_DE: Default = Low -> RS485 transmitter disabled
|
||||
* Configure as GPIO in U-Boot to keep disabled, Linux will change to RTSn
|
||||
*/
|
||||
{OFFSET(gpmc_wait0), (MODE(6) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (T17) UART4_RXD */
|
||||
{OFFSET(gpmc_wpn), (MODE(6) | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (U17) UART4_TXD */
|
||||
{OFFSET(lcd_data12), (MODE(7) | PULLUDEN | PULLDOWN_EN)}, /* (V2) uart4_ctsn */
|
||||
{OFFSET(lcd_data13), (MODE(7) | PULLUDEN | PULLDOWN_EN)}, /* (V3) uart4_rtsn */
|
||||
{-1}
|
||||
};
|
||||
|
||||
|
|
@ -268,10 +297,22 @@ void enable_uart2_pin_mux(void)
|
|||
configure_module_pin_mux(uart2_pin_mux);
|
||||
}
|
||||
|
||||
void enable_uart4_pin_mux(void)
|
||||
{
|
||||
configure_module_pin_mux(uart4_pin_mux);
|
||||
}
|
||||
|
||||
void enable_spi1_mux(void)
|
||||
{
|
||||
configure_module_pin_mux(spi1_pin_mux);
|
||||
}
|
||||
|
||||
void enable_led_mux(void)
|
||||
{
|
||||
configure_module_pin_mux(led_pin_mux);
|
||||
}
|
||||
|
||||
|
||||
void enable_led_mux_v32(void)
|
||||
{
|
||||
configure_module_pin_mux(led_pin_mux_v32);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* reset_reason.c
|
||||
*
|
||||
* Reset/start reason handling
|
||||
*
|
||||
* Copyright (C) 2021 NetModule AG - https://www.netmodule.com/
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
#include <common.h>
|
||||
#include "../common/ether_crc.h"
|
||||
#include "reset_reason.h"
|
||||
|
||||
|
||||
void rr_set_reset_reason(volatile struct reset_registers* reset_regs, uint32_t reason)
|
||||
{
|
||||
reset_regs->rr_value = reason;
|
||||
reset_regs->rr_value_crc = ether_crc(sizeof(reset_regs->rr_value),
|
||||
(const uint8_t*)&(reset_regs->rr_value));
|
||||
}
|
||||
|
||||
bool rr_is_reset_reason_valid(volatile const struct reset_registers* reset_regs)
|
||||
{
|
||||
const uint32_t crc = ether_crc(sizeof(reset_regs->rr_value),
|
||||
(const uint8_t*)&(reset_regs->rr_value));
|
||||
return crc == reset_regs->rr_value_crc;
|
||||
}
|
||||
|
||||
void rr_set_start_reason(volatile struct reset_registers* reset_regs, uint32_t event)
|
||||
{
|
||||
/* Store start events in shared memory region for OS */
|
||||
reset_regs->sr_magic = SR_MAGIC;
|
||||
reset_regs->sr_events = event;
|
||||
reset_regs->sr_checksum = ether_crc(sizeof(reset_regs->sr_events),
|
||||
(const uint8_t*)&(reset_regs->sr_events));
|
||||
}
|
||||
|
||||
bool rr_is_start_reason_valid(volatile const struct reset_registers* reset_regs)
|
||||
{
|
||||
if (reset_regs->sr_magic == SR_MAGIC) {
|
||||
const uint32_t crc = ether_crc(sizeof(reset_regs->sr_events),
|
||||
(const uint8_t*)&(reset_regs->sr_events));
|
||||
if (crc == reset_regs->sr_checksum) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void rr_start_reason_to_str(uint32_t events, char* buffer, size_t bufsize)
|
||||
{
|
||||
if (events == 0) {
|
||||
strncpy(buffer, "-\n", bufsize);
|
||||
}
|
||||
else {
|
||||
buffer[0] = 0;
|
||||
if (events & SR_POR)
|
||||
strncat(buffer, "PowerOn, ", bufsize);
|
||||
if (events & SR_WATCHDOG)
|
||||
strncat(buffer, "Watchdog, ", bufsize);
|
||||
if (events & SR_REBOOT)
|
||||
strncat(buffer, "Reboot, ", bufsize);
|
||||
if (events & SR_WAKEUP)
|
||||
strncat(buffer, "Wakeup, ", bufsize);
|
||||
|
||||
if (events & SR_EVT_IGNITION)
|
||||
strncat(buffer, "Ignition, ", bufsize);
|
||||
if (events & SR_EVT_RTC_ALARM)
|
||||
strncat(buffer, "RTC, ", bufsize);
|
||||
if (events & SR_EVT_RTC_TICK)
|
||||
strncat(buffer, "Tick, ", bufsize);
|
||||
if (events & SR_EVT_GPI)
|
||||
strncat(buffer, "GPI, ", bufsize);
|
||||
if (events & SR_EVT_BUTTON)
|
||||
strncat(buffer, "Button, ", bufsize);
|
||||
|
||||
/* Trim last comma, no 0 len check required, at least one entry is present */
|
||||
buffer[strlen(buffer)-2] = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* reset_reason.h
|
||||
*
|
||||
* Reset/start reason handling
|
||||
*
|
||||
* Copyright (C) 2021 NetModule AG - https://www.netmodule.com/
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef RESET_REASON_H
|
||||
#define RESET_REASON_H
|
||||
|
||||
struct reset_registers {
|
||||
/* Reboot Reasons, set by OS, expect watchdog set by bootloader */
|
||||
uint32_t rr_value;
|
||||
uint32_t rr_value_crc;
|
||||
|
||||
/* Start Reasons as determined by hardware */
|
||||
uint32_t sr_magic; /* Token to check presence of following fields */
|
||||
uint32_t sr_events; /* Events bitmask, see SE_... defines */
|
||||
uint32_t sr_checksum; /* Checksum over se_events */
|
||||
};
|
||||
|
||||
/* Watchdog reboot reason event */
|
||||
#define RR_POWEROFF_PATTERN 0x00000000
|
||||
#define RR_EXTERNAL_WATCHDOG_PATTERN 0x781f9ce2
|
||||
#define RR_BOOT_PATTERN 0x424f4f54 /* ‘BOOT’, 0xb9808470 */
|
||||
#define RR_REBOOT_PATTERN 0x5245424f /* ‘REBO’, 0x7d5d9d66 */
|
||||
#define RR_OOPS_PATTERN 0x4F4F5053 /* ‘OOPS’, 0x2b85bc5f */
|
||||
#define RR_WAKE_PATTERN 0x57414B45 /* 'WAKE', 0x7b0acb48 */
|
||||
|
||||
/* Start reason token 'SRTE' */
|
||||
#define SR_MAGIC 0x53525445
|
||||
|
||||
/* Possible start events (see sr_events) */
|
||||
#define SR_POR 0x00000001
|
||||
#define SR_WATCHDOG 0x00000010
|
||||
#define SR_REBOOT 0x00000020
|
||||
#define SR_WAKEUP 0x00000080 /* See SR_EVT_xx bits */
|
||||
|
||||
/* In case of wake-up, these are the events that caused the start */
|
||||
#define SR_EVT_IGNITION 0x00000100
|
||||
#define SR_EVT_RTC_ALARM 0x00000200 /* RTC date/time alarm */
|
||||
#define SR_EVT_RTC_TICK 0x00000400 /* RTC tick based alarm */
|
||||
#define SR_EVT_GPI 0x00000800 /* General purpose input(s) */
|
||||
#define SR_EVT_BUTTON 0x00001000
|
||||
#define SR_EVT_WAKE_MASK 0x00001F00
|
||||
|
||||
|
||||
|
||||
extern void rr_set_reset_reason(volatile struct reset_registers* reset_regs, uint32_t reason);
|
||||
extern bool rr_is_reset_reason_valid(volatile const struct reset_registers* reset_regs);
|
||||
|
||||
extern void rr_set_start_reason(volatile struct reset_registers* reset_regs, uint32_t event);
|
||||
extern bool rr_is_start_reason_valid(volatile const struct reset_registers* reset_regs);
|
||||
extern void rr_start_reason_to_str(uint32_t events, char* buffer, size_t bufsize);
|
||||
|
||||
|
||||
#endif /* RESET_REASON_H */
|
||||
|
|
@ -90,10 +90,10 @@ void sja1105_write_reg(uint32_t address, uint32_t data)
|
|||
|
||||
void sja1105_configure_firmware(void)
|
||||
{
|
||||
static const uint8_t config_data_0[] = { 0x80, 0x20, 0x00, 0x00, 0x9E, 0x00, 0x03, 0x0E, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x21, 0x6F, 0x25, 0x6B, 0xFE, 0xF7, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF };
|
||||
static const uint8_t config_data_1[] = { 0x80, 0x20, 0x04, 0x00, 0xFE, 0xF7, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF7, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFA, 0x2E, 0x19, 0xF8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x7D, 0x0B, 0xCB, 0xF2, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x31, 0x80, 0x7F, 0x09, 0x52, 0x68, 0x0D, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x6A, 0xF6, 0x23, 0x53, 0x10, 0x00, 0x00, 0x00, 0xF7, 0xBD, 0xF5, 0x8D, 0x10, 0x00, 0x00, 0x00, 0xEF, 0x7B, 0xF5, 0x8D, 0x10, 0x00, 0x00, 0x00, 0xDE, 0xF7, 0xF5, 0x8D, 0x10, 0x00, 0x00, 0x00, 0xBD, 0xEF, 0xF5, 0x8D, 0x10, 0x00, 0x00, 0x00, 0x7B, 0xDF, 0xF5, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x04, 0xA6, 0x06, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0xDA, 0xB5, 0xBD, 0xC8, 0x00, 0x3F, 0xFC, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
static const uint8_t config_data_2[] = { 0x80, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x75, 0xF9, 0x8D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x25, 0x0E, 0x7C, 0xBD, 0x00, 0x01, 0x25, 0xC0, 0x70, 0x94, 0x84, 0x50, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xC8, 0xA7, 0xCE, 0xE6, 0x00, 0x71, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0xF7, 0x04, 0xB9, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x57, 0x1F, 0x81, 0x3F, 0x06, 0x44, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x0D, 0xB0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x5A, 0x9C, 0x37, 0x20, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3A, 0x5D, 0x5E, 0x24, 0xA4, 0x9A, 0x00, 0x00, 0x7B, 0x51, 0xDA, 0x7D, 0x00, 0x00, 0x00, 0x00 };
|
||||
static const uint8_t config_data_3[] = { 0x80, 0x20, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x6E, 0x02, 0x8B };
|
||||
static const uint8_t config_data_0[] = { 0x80, 0x20, 0x00, 0x00, 0x9E, 0x00, 0x03, 0x0E, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x21, 0x6F, 0x25, 0x6B, 0xFE, 0xF9, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0B, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF };
|
||||
static const uint8_t config_data_1[] = { 0x80, 0x20, 0x04, 0x00, 0xFE, 0xF9, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0xFE, 0xF9, 0x00, 0x00, 0x13, 0xFF, 0xFF, 0xFF, 0x03, 0x68, 0x8B, 0xEA, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x7D, 0x0B, 0xCB, 0xF2, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x31, 0x80, 0x7F, 0x09, 0x52, 0x68, 0x0D, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x6A, 0xF6, 0x23, 0x53, 0x10, 0x00, 0x00, 0x00, 0xF7, 0xBD, 0xF5, 0x8D, 0x10, 0x00, 0x00, 0x00, 0xEF, 0x7B, 0xF5, 0x8D, 0x10, 0x00, 0x00, 0x00, 0xDE, 0xF7, 0xF5, 0x8D, 0x10, 0x00, 0x00, 0x00, 0xBD, 0xEF, 0xF5, 0x8D, 0x10, 0x00, 0x00, 0x00, 0x7B, 0xDF, 0xF5, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x04, 0xA6, 0x06, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0xDA, 0xB5, 0xBD, 0xC8, 0x00, 0x3F, 0xFC, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
static const uint8_t config_data_2[] = { 0x80, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFC, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x75, 0xF9, 0x8D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x25, 0x0E, 0x7C, 0xBD, 0x00, 0x01, 0x25, 0xC0, 0x70, 0x94, 0x84, 0x50, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xC8, 0xA7, 0xCE, 0xE6, 0x00, 0x71, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0xF7, 0x04, 0xB9, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x57, 0x1F, 0x81, 0x3F, 0x06, 0x44, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x0D, 0xB0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x5A, 0x9C, 0x37, 0x20, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3A, 0x5D, 0x5E, 0x24, 0xA4, 0x9A, 0x00, 0x00, 0x7B, 0x51, 0xDA, 0x7D, 0x00, 0x00, 0x00, 0x00 };
|
||||
static const uint8_t config_data_3[] = { 0x80, 0x20, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x6E, 0x02, 0x8B };
|
||||
|
||||
uint32_t val;
|
||||
int rc;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* 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/
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
|
|
@ -40,6 +40,12 @@
|
|||
#include "shield_comio.h"
|
||||
#include "fileaccess.h"
|
||||
|
||||
|
||||
/* TODO: place in proper header file */
|
||||
extern void serial_set_console_index(int index);
|
||||
extern int console_init_f(void);
|
||||
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/*
|
||||
|
|
@ -132,6 +138,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||
#define IOEXT_LED4_GREEN_MASK (1U << 9)
|
||||
#define IOEXT_LEDS_ALL_MASK (0x03FF)
|
||||
|
||||
#define NUM_INDICATOR_LEDS 5
|
||||
|
||||
|
||||
#define DDR3_CLOCK_FREQUENCY (400)
|
||||
|
|
@ -155,10 +162,6 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
|
|||
#define PD_ADDRESS (0x0200) /* Product descriptor */
|
||||
#define PARTITION_ADDRESS (0x0600) /* Partition Table */
|
||||
|
||||
#define SHIELD_COM_IO 0
|
||||
#define SHIELD_DUALCAN 1
|
||||
|
||||
|
||||
static BD_Context bdctx[3]; /* The descriptor contexts */
|
||||
|
||||
|
||||
|
|
@ -218,7 +221,7 @@ static void set_status_led(int red, int green)
|
|||
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;
|
||||
uint led_red_mask = 0x1U << (2*led);
|
||||
|
|
@ -305,21 +308,29 @@ static inline int __maybe_unused read_eeprom(void)
|
|||
*/
|
||||
struct serial_device *default_serial_console(void)
|
||||
{
|
||||
/* Mux pins for selected UART properly.
|
||||
* Note: uart indexes start at 0 while
|
||||
* eserial indexes start at 1.
|
||||
/*
|
||||
* Mux pins for selected UART properly.
|
||||
* Note: UART indexes start at 0 while eserial indexes start at 1.
|
||||
*
|
||||
* Provide console on internal UART1 regardless of boot mode.
|
||||
* This only has a side effect when using X-Modem boot
|
||||
*/
|
||||
|
||||
if ((spl_boot_device() == BOOT_DEVICE_UART) ||
|
||||
(spl_boot_device() == BOOT_DEVICE_JTAG)) {
|
||||
if (spl_boot_device() == BOOT_DEVICE_UART) {
|
||||
/* Continue booting from UART in case of serial (xmodem) boot */
|
||||
enable_uart0_pin_mux();
|
||||
return &eserial1_device;
|
||||
} else {
|
||||
/* Use bluetooth uart, if no ouput shall be seen. */
|
||||
/* TODO: Sorry, what are we doing here.... */
|
||||
/* This is at least dangerous if not completely wrong */
|
||||
/* 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();
|
||||
return &eserial2_device;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -371,8 +382,6 @@ static void init_pmic_spl(void)
|
|||
|
||||
bus = da9063_claim_i2c_bus();
|
||||
|
||||
/* TODO: Move to init_pmic_spl() */
|
||||
|
||||
/* Configure default PMIC current limits. Will be overridden in Linux.
|
||||
* MEM = 1.5A (0.55A)
|
||||
* IO = 1.5A (0.5A)
|
||||
|
|
@ -385,26 +394,78 @@ static void init_pmic_spl(void)
|
|||
(void)da9063_set_reg(PMIC_REG_BUCK_ILIM_B, 0x50);
|
||||
(void)da9063_set_reg(PMIC_REG_BUCK_ILIM_C, 0xFF);
|
||||
|
||||
/* TODO: C comments, not C++ */
|
||||
// FB 57727 Use synchronous mode for buck converters
|
||||
// This solves the occasional rail lock up problem
|
||||
/*
|
||||
* FB 57727 Use synchronous mode for buck converters
|
||||
* This solves the occasional rail lock up problem
|
||||
*/
|
||||
(void)da9063_set_reg(PMIC_REG_BCORE1_CONF, 0x81);
|
||||
(void)da9063_set_reg(PMIC_REG_BCORE2_CONF, 0x81);
|
||||
(void)da9063_set_reg(PMIC_REG_BIO_CONF, 0x81);
|
||||
(void)da9063_set_reg(PMIC_REG_BMEM_CONF, 0x81);
|
||||
(void)da9063_set_reg(PMIC_REG_BPERI_CONF, 0x81);
|
||||
|
||||
/* TODO: Enable later */
|
||||
/* da9063_reset_reason_update(RESET_REASON_SHM_LOCATION); */
|
||||
/* TODO: Move code from below to here */
|
||||
|
||||
/* Enable charging of RTC backup capacitor (1mA, 3.1V) */
|
||||
(void)da9063_set_reg(PMIC_REG_BBAT_CONT, 0xCF);
|
||||
/* TODO: Check documentation 1 mA correct ? */
|
||||
(void)da9063_set_reg(PMIC_REG_BBAT_CONT, 0xAF);
|
||||
|
||||
da9063_release_i2c_bus(bus);
|
||||
}
|
||||
|
||||
struct reset_registers {
|
||||
uint32_t value;
|
||||
uint32_t value_crc;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
|
||||
/* TODO: Move ethernet crc to dedicated file */
|
||||
static uint32_t ether_crc(size_t len, uint8_t const *p)
|
||||
{
|
||||
uint32_t crc;
|
||||
unsigned i;
|
||||
|
||||
crc = ~0;
|
||||
while (len--) {
|
||||
crc ^= *p++;
|
||||
for (i = 0; i < 8; i++)
|
||||
crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0);
|
||||
}
|
||||
|
||||
/* an reverse the bits, cuz of way they arrive -- last-first */
|
||||
crc = (crc >> 16) | (crc << 16);
|
||||
crc = (crc >> 8 & 0x00ff00ff) | (crc << 8 & 0xff00ff00);
|
||||
crc = (crc >> 4 & 0x0f0f0f0f) | (crc << 4 & 0xf0f0f0f0);
|
||||
crc = (crc >> 2 & 0x33333333) | (crc << 2 & 0xcccccccc);
|
||||
crc = (crc >> 1 & 0x55555555) | (crc << 1 & 0xaaaaaaaa);
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
void check_pmic_reset_reason(unsigned int reset_reason_shm_location)
|
||||
{
|
||||
volatile struct reset_registers* reset_regs = (struct reset_registers*)reset_reason_shm_location;
|
||||
uint8_t state = 0x00;
|
||||
int bus;
|
||||
int ret;
|
||||
|
||||
bus = da9063_claim_i2c_bus();
|
||||
|
||||
ret = da9063_get_reg(PMIC_REG_FAULT_LOG, &state);
|
||||
if ((ret == 0) && (state != 0)) {
|
||||
if (state & PMIC_FAULT_TWD_ERROR_MASK) {
|
||||
reset_regs->value = EXTERNAL_WATCHDOG_PATTERN;
|
||||
reset_regs->value_crc = ether_crc(sizeof(reset_regs->value),
|
||||
(const uint8_t*)&(reset_regs->value));
|
||||
}
|
||||
|
||||
/* clear pmic fault log by writing back all bits currently set */
|
||||
da9063_set_reg(PMIC_REG_FAULT_LOG, state);
|
||||
}
|
||||
|
||||
da9063_release_i2c_bus(bus);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void am33xx_spl_board_init(void)
|
||||
{
|
||||
/* Set CPU speed to 600 MHz (fix) */
|
||||
|
|
@ -420,14 +481,20 @@ void am33xx_spl_board_init(void)
|
|||
init_pmic_spl();
|
||||
|
||||
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_indicator_led(0, 1, 0); /* Red */
|
||||
#endif
|
||||
set_indicator(0, 1, 1); /* Orange */
|
||||
|
||||
/* Set MPU Frequency to what we detected now that voltages are set */
|
||||
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
||||
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
check_pmic_reset_reason(RESET_REASON_SHM_LOCATION);
|
||||
#endif
|
||||
|
||||
/* Debugger can place marker at end of SRAM to stop boot here */
|
||||
if (is_jtag_boot(CONFIG_JTAG_MARKER_SPL))
|
||||
{
|
||||
|
|
@ -560,18 +627,32 @@ static void init_pcie_slot(void)
|
|||
|
||||
static void init_gsm(void)
|
||||
{
|
||||
/* TODO: Check and update for Toby-L2 */
|
||||
/*
|
||||
* Perform power up sequence for Huawei ME909s.
|
||||
*
|
||||
* Modem is initially disabled and does not start automatically.
|
||||
* Enable power and start modem by "pressing" POWER_ON_OFF input for 1.0s.
|
||||
*
|
||||
* Perform power up sequence for TOBY-L2 modem.
|
||||
*
|
||||
* TOBY-L2 series can be switched on in one of the following ways:
|
||||
* - Rising edge on the VCC pin to a valid voltage for module supply,
|
||||
* i.e. applying module supply
|
||||
* - Low level on the PWR_ON pin, which is normally set high by an
|
||||
* internal pull-up, for a valid time period when the applied VCC
|
||||
* voltage is within the valid operating range (see section 4.2.8).
|
||||
* - Low level on the RESET_N pin, which is normally set high by an
|
||||
* internal pull-up, for a valid time period when the applied VCC
|
||||
* voltage is within the valid operating range (see section 4.2.9).
|
||||
*
|
||||
* PWR_ON low time: 5 ms - Low time to switch-on the module
|
||||
* RESET_N low time: 18..800 ms - Low time to switch-on the module
|
||||
* 2.1..15 s - Low time to reset the module
|
||||
* 16 s - Low time to switch-off the module
|
||||
*
|
||||
* References:
|
||||
* - HUAWEI ME909s Series LTE LGA Module Hardware Guide, Issue 02, Date 2016-02-20
|
||||
* 3.3.2 Power Supply VBAT Interface
|
||||
* 3.4.2 Power-on/off Pin, Figure 3.7
|
||||
* - uBlox TOBY-L2 Datasheet UBX-13004573 - R24
|
||||
* 2.3.1 Module power-on
|
||||
* 4.2.8 PWR_ON pin
|
||||
* 4.2.9 RESET_N pin
|
||||
*
|
||||
*/
|
||||
|
||||
int bus;
|
||||
|
||||
puts("GSM: ");
|
||||
|
|
@ -633,9 +714,12 @@ int board_init(void)
|
|||
|
||||
/* Let user know we're starting */
|
||||
init_leds();
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
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);
|
||||
|
||||
return 0;
|
||||
|
|
@ -643,16 +727,13 @@ int board_init(void)
|
|||
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
|
||||
/* TODO: Move to top of file or place into header file */
|
||||
extern int console_init_f(void);
|
||||
extern void serial_set_console_index(int index);
|
||||
|
||||
/*
|
||||
* Set Linux console based on
|
||||
* - Selection in /root/boot/consoledev
|
||||
* - Available tty interfaces
|
||||
* - ttyS1: standard console (default)
|
||||
* - ttyS0: COM/IO shield
|
||||
* - ttyNull0: Dummy device if no real UART is available
|
||||
*/
|
||||
void set_console(void)
|
||||
{
|
||||
|
|
@ -678,7 +759,21 @@ void set_console(void)
|
|||
setenv("defaultconsole", buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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)
|
||||
defaultconsole = getenv("defaultconsole");
|
||||
|
||||
|
|
@ -736,19 +831,22 @@ static void get_variant_name(void)
|
|||
|
||||
static void get_hw_version(void)
|
||||
{
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
char hw_versions[16];
|
||||
char new_env[256]; /* current bootargs = 84 bytes */
|
||||
#endif
|
||||
|
||||
bd_get_hw_version(&hw_ver, &hw_rev);
|
||||
bd_get_hw_patch(&hw_patch);
|
||||
|
||||
printf("HW20: V%d.%d\n", hw_ver, hw_rev);
|
||||
|
||||
/* TODO: Check if this can be removed eventually */
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
/* 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void get_pmic_version(void)
|
||||
|
|
@ -778,7 +876,10 @@ static void get_pmic_version(void)
|
|||
static void check_jtag_boot(void)
|
||||
{
|
||||
if (is_jtag_boot(CONFIG_JTAG_MARKER_UBOOT)) {
|
||||
char *bootcmd = getenv("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");
|
||||
}
|
||||
}
|
||||
|
|
@ -826,6 +927,12 @@ static struct shield_command known_shield_commands[] = {
|
|||
"shield dualcan termination off off",
|
||||
can_shield_init
|
||||
},
|
||||
{
|
||||
SHIELD_DUALCAN_PASSIVE,
|
||||
"dualcan-passive",
|
||||
"shield dualcan-passive",
|
||||
can_shield_passive_init
|
||||
}
|
||||
};
|
||||
|
||||
static const struct shield_command* get_shield_command(int shield_id)
|
||||
|
|
@ -846,20 +953,20 @@ static void shield_config(void)
|
|||
#define MAX_SHIELD_CMD_LEN 128
|
||||
|
||||
char shieldcmd_linux[MAX_SHIELD_CMD_LEN];
|
||||
const char *shieldcmd;
|
||||
const char *shieldcmd = ";"; /* default shield command is empty */
|
||||
const struct shield_command *cmd;
|
||||
int len;
|
||||
|
||||
int shield_id = bd_get_shield(0);
|
||||
if (shield_id < 0) {
|
||||
debug("No shield found in bd\n");
|
||||
return;
|
||||
goto end;
|
||||
}
|
||||
|
||||
cmd = get_shield_command(shield_id);
|
||||
if (cmd == NULL) {
|
||||
printf ("Unknown shield id %d\n", shield_id);
|
||||
return;
|
||||
goto end;
|
||||
}
|
||||
|
||||
printf("Shield:%s\n", cmd->name);
|
||||
|
|
@ -876,6 +983,7 @@ static void shield_config(void)
|
|||
shieldcmd = shieldcmd_linux;
|
||||
}
|
||||
|
||||
end:
|
||||
setenv("shieldcmd", shieldcmd);
|
||||
}
|
||||
|
||||
|
|
@ -902,16 +1010,24 @@ static bool get_button_state(void)
|
|||
return pressed;
|
||||
}
|
||||
|
||||
static void blink_led(void)
|
||||
static void blink_led(int red, int green)
|
||||
{
|
||||
const int pulse_width = 400*1000; /* 400ms */
|
||||
int i;
|
||||
|
||||
/* Assumes green status LED is on */
|
||||
udelay(pulse_width);
|
||||
set_status_led(0, 0); /* Off */
|
||||
/* Assumes status led is on (green), indicator off */
|
||||
/* udelay(pulse_width); */
|
||||
set_status_led(red, green);
|
||||
for (i=0; i<NUM_INDICATOR_LEDS; i++) {
|
||||
set_indicator_led(i, red, green);
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
@ -928,12 +1044,11 @@ static void check_reset_button(void)
|
|||
|
||||
if (counter == 2000) {
|
||||
/* Indicate factory reset threshold */
|
||||
blink_led();
|
||||
blink_led(0, 1); /* Green */
|
||||
}
|
||||
else if (counter == 12000) {
|
||||
/* Indicate recovery boot threshold */
|
||||
blink_led();
|
||||
blink_led();
|
||||
blink_led(1, 0); /* Red */
|
||||
}
|
||||
} while (counter < 12000);
|
||||
|
||||
|
|
@ -1005,8 +1120,8 @@ int board_late_init(void)
|
|||
set_console();
|
||||
shield_init();
|
||||
|
||||
set_status_led(0, 1); /* Green */
|
||||
set_indicator(0, 0, 1); /* Green */
|
||||
set_status_led(0, 0); /* WAN led off */
|
||||
set_indicator_led(0, 0, 1); /* Green */
|
||||
|
||||
check_fct();
|
||||
check_jtag_boot();
|
||||
|
|
@ -1152,46 +1267,98 @@ static void ft_enable_node(void* blob, const char* name)
|
|||
}
|
||||
}
|
||||
|
||||
static void ft_dio(void *blob, int shield_type)
|
||||
/*
|
||||
* Modify the name of a gpio in a gpio-line-names string list.
|
||||
*/
|
||||
static void ft_set_gpio_name(void *blob, const char* gpio, int pin, const char* name)
|
||||
{
|
||||
int node_ofs = fdt_path_offset(blob, gpio);
|
||||
int gpios = -1;
|
||||
const char* text;
|
||||
int pos = 0;
|
||||
int i;
|
||||
char buffer[512];
|
||||
|
||||
if (node_ofs == -1) {
|
||||
printf("Can't find node %s\n", gpio);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* get number of IOs in node */
|
||||
gpios = fdt_getprop_u32_default_node(blob, node_ofs, 0, "ngpios", -1);
|
||||
if (gpios == -1 || gpios > 64) {
|
||||
printf("Illegal number of gpios %d\n", gpios);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* get string array with names */
|
||||
const struct fdt_property* prop = fdt_get_property(blob, node_ofs, "gpio-line-names", NULL);
|
||||
if (prop == NULL) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* modify given name */
|
||||
for (i=0; i<gpios; i++) {
|
||||
if (i == pin) {
|
||||
/* Take provided name if GPIO pin is matched */
|
||||
text = name;
|
||||
}
|
||||
else {
|
||||
/* Take existing name from string list */
|
||||
(void)fdt_get_string_index(blob, node_ofs, "gpio-line-names", i, &text);
|
||||
}
|
||||
|
||||
/* Add name to new string list */
|
||||
if ((pos + strlen(text) + 1) < sizeof(buffer)) {
|
||||
strncpy(buffer+pos, text, sizeof(buffer)-pos);
|
||||
pos += strlen(text) + 1;
|
||||
}
|
||||
else {
|
||||
printf("ft_set_gpio_name() Buffer too small\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
(void)fdt_setprop(blob, node_ofs, "gpio-line-names", buffer, pos);
|
||||
|
||||
end: ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable digital IOs provided by COM/IO shield in gpio nodes
|
||||
*/
|
||||
static void ft_comio_gpios(void *blob)
|
||||
{
|
||||
/* gpio0_7: COM/IO relay output */
|
||||
ft_set_gpio_name(blob, "gpio0", 7, "COMIO_OUT0");
|
||||
|
||||
/* gpio1_8: COM/IO digital input */
|
||||
ft_set_gpio_name(blob, "gpio1", 8, "COMIO_IN0");
|
||||
}
|
||||
|
||||
static void ft_shields(void* blob)
|
||||
{
|
||||
int shield_type = -1;
|
||||
|
||||
shield_type = bd_get_shield(0);
|
||||
switch (shield_type) {
|
||||
/* If COM/IO shield is present enable its I/Os */
|
||||
case SHIELD_COM_IO:
|
||||
ft_comio_gpios(blob);
|
||||
ft_enable_node(blob, "/netbox_dio_comio");
|
||||
ft_enable_node(blob, "serial0");
|
||||
break;
|
||||
|
||||
case SHIELD_DUALCAN:
|
||||
case SHIELD_DUALCAN_PASSIVE:
|
||||
ft_enable_node(blob, "d-can0");
|
||||
ft_enable_node(blob, "d-can1");
|
||||
break;
|
||||
|
||||
default:
|
||||
ft_enable_node(blob, "/netbox_dio_default");
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static void ft_serial(void *blob, int shield_type)
|
||||
{
|
||||
switch (shield_type) {
|
||||
/* Enable uart1 (ttyS0) always as kernel needs it as fallback
|
||||
console, if (ttyS1) is not available as console. */
|
||||
|
||||
default:
|
||||
/* TODO: Should use alias serial0 */
|
||||
ft_enable_node(blob, "/ocp/serial@44e09000");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void ft_dcan(void *blob, int shield_type)
|
||||
{
|
||||
switch (shield_type) {
|
||||
/* If Dual CAN shield is present enable dcan0, dcan1N1 */
|
||||
case SHIELD_DUALCAN:
|
||||
/* TODO: Should use alias d_can0, d_can1 */
|
||||
ft_enable_node(blob, "/ocp/can@481cc000");
|
||||
ft_enable_node(blob, "/ocp/can@481d0000");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void ft_bootloader_version(void *blob)
|
||||
|
|
@ -1221,16 +1388,10 @@ static void ft_hw_info(void *blob)
|
|||
|
||||
int ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
int shield_type = -1;
|
||||
|
||||
ft_bootloader_version(blob);
|
||||
ft_hw_info(blob);
|
||||
|
||||
shield_type = bd_get_shield(0);
|
||||
|
||||
ft_dio(blob, shield_type);
|
||||
ft_serial(blob, shield_type);
|
||||
ft_dcan(blob, shield_type);
|
||||
ft_shields(blob);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*
|
||||
* We have three pin mux functions that must exist. We must be able to enable
|
||||
* uart0, for initial output and i2c2 to read the main EEPROM. We then have a
|
||||
|
|
@ -19,12 +20,9 @@
|
|||
void enable_uart0_pin_mux(void);
|
||||
void disable_uart0_pin_mux(void);
|
||||
void enable_uart1_pin_mux(void);
|
||||
void enable_uart3_pin_mux(void);
|
||||
void enable_uart5_pin_mux(void);
|
||||
|
||||
void enable_i2c0_pin_mux(void);
|
||||
void enable_i2c2_pin_mux(void);
|
||||
void enable_board_pin_mux(void);
|
||||
|
||||
#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* mux.c
|
||||
*
|
||||
* Copyright (C) 2018 NetModule AG - http://www.netmodule.com/
|
||||
* Copyright (C) 2018-2019 NetModule AG - http://www.netmodule.com/
|
||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
|
@ -23,50 +23,52 @@
|
|||
|
||||
static struct module_pin_mux gpio_pin_mux[] = {
|
||||
/*
|
||||
* GPIO0_2: RST_GNSS~
|
||||
* GPIO0_3: GEOFENCE_GNSS
|
||||
* GPIO0_4: RTK_STAT_GNSS
|
||||
* GPIO0_5: EXTINT_GNSS
|
||||
* GPIO0_6: TIMEPULSE_GNSS
|
||||
* GPIO0_7: PWM / SHIELD LATCH
|
||||
* GPIO0_16: RST_PHY~
|
||||
* GPIO0_17: PMIC FAULT
|
||||
* GPIO0_27: RST_SHIELD~
|
||||
* CPU GPIOs
|
||||
*
|
||||
* GPIO1_14: DIG_OUT
|
||||
* GPIO1_15: DIG_IN
|
||||
* GPIO1_20: BT_EN
|
||||
* GPIO1_21: GSM_PWR_EN
|
||||
* GPIO1_25: RST_GSM
|
||||
* GPIO1_26: WLAN_EN
|
||||
* GPIO1_27: WLAN_IRQ
|
||||
* (A17) GPIO0_2: RST_GNSS~
|
||||
* (B17) GPIO0_3: GEOFENCE_GNSS
|
||||
* (B16) GPIO0_4: RTK_STAT_GNSS
|
||||
* (A16) GPIO0_5: EXTINT_GNSS
|
||||
* (C15) GPIO0_6: TIMEPULSE
|
||||
* (C18) GPIO0_7: PWM / SHIELD LATCH
|
||||
* (J18) GPIO0_16: RST_PHY~
|
||||
* (K15) GPIO0_17: PMIC FAULT
|
||||
* (U12) GPIO0_27: RST_SHIELD~
|
||||
*
|
||||
* GPIO3_4: PCIe_IO.WAKE
|
||||
* GPIO3_9: PCIe_IO.W_DIS
|
||||
* GPIO3_10: PCIe_IO.RST
|
||||
* GPIO3_17: SIM_SEL
|
||||
* GPIO3_21: RST_HUB~ (USB)
|
||||
* (V13) GPIO1_14: DIG_OUT
|
||||
* (U13) GPIO1_15: DIG_IN
|
||||
* (R14) GPIO1_20: BT_EN
|
||||
* (V15) GPIO1_21: GSM_PWR_EN
|
||||
* (U16) GPIO1_25: RST_GSM
|
||||
* (T16) GPIO1_26: WLAN_EN
|
||||
* (V17) GPIO1_27: WLAN_IRQ
|
||||
*
|
||||
* (J17) GPIO3_4: PCIe_IO.WAKE
|
||||
* (K18) GPIO3_9: PCIe_IO.W_DIS
|
||||
* (L18) GPIO3_10: PCIe_IO.RST
|
||||
* (C12) GPIO3_17: SIM_SEL
|
||||
* (A14) GPIO3_21: RST_HUB~ (USB)
|
||||
*/
|
||||
|
||||
/* Bank 0 */
|
||||
{OFFSET(spi0_sclk), (MODE(7) | PULLUDDIS)}, /* (A17) gpio0[2] */ /* RST_GNSS */
|
||||
{OFFSET(spi0_d0), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (B17) gpio0[3] */ /* GEOFENCE_GNSS */
|
||||
{OFFSET(spi0_d1), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (B16) gpio0[4] */ /* RTK_STAT_GNSS */
|
||||
{OFFSET(spi0_cs0), (MODE(7) | PULLUDEN | PULLDOWN_EN)}, /* (A16) gpio0[5] */ /* EXTINT_GNSS */
|
||||
{OFFSET(spi0_cs1), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)},/* (C15) gpio0[6] */ /* TIMEPULSE_GNSS */
|
||||
{OFFSET(ecap0_in_pwm0_out), (MODE(7) | PULLUDEN | PULLUP_EN)}, /* (C18) gpio0[7] */ /* IO_SHIELD */
|
||||
{OFFSET(mii1_txd3), (MODE(7) | PULLUDDIS)}, /* (J18) gpio0[16] */ /* RST_PHY~ */
|
||||
{OFFSET(mii1_txd2), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (K15) gpio0[17] */ /* PMIC_FAULT */
|
||||
{OFFSET(gpmc_ad11), (MODE(7) | PULLUDDIS)}, /* (U12) gpio0[27] */ /* RST_SHIELD~ */
|
||||
{OFFSET(spi0_sclk), (MODE(7) | PULLUDDIS)}, /* (A17) gpio0[2] */ /* RST_GNSS */
|
||||
{OFFSET(spi0_d0), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (B17) gpio0[3] */ /* GEOFENCE_GNSS */
|
||||
{OFFSET(spi0_d1), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (B16) gpio0[4] */ /* RTK_STAT_GNSS */
|
||||
{OFFSET(spi0_cs0), (MODE(7) | PULLUDEN | PULLDOWN_EN)}, /* (A16) gpio0[5] */ /* EXTINT_GNSS */
|
||||
{OFFSET(spi0_cs1), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (C15) gpio0[6] */ /* TIMEPULSE */
|
||||
{OFFSET(ecap0_in_pwm0_out), (MODE(7) | PULLUDEN | PULLUP_EN)}, /* (C18) gpio0[7] */ /* IO_SHIELD */
|
||||
{OFFSET(mii1_txd3), (MODE(7) | PULLUDDIS)}, /* (J18) gpio0[16] */ /* RST_PHY~ */
|
||||
{OFFSET(mii1_txd2), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (K15) gpio0[17] */ /* PMIC_FAULT */
|
||||
{OFFSET(gpmc_ad11), (MODE(7) | PULLUDDIS)}, /* (U12) gpio0[27] */ /* RST_SHIELD~ */
|
||||
|
||||
/* Bank 1 */
|
||||
{OFFSET(gpmc_ad14), (MODE(7) | PULLUDDIS)}, /* (V13) gpio1[14] */ /* DIG_OUT */
|
||||
{OFFSET(gpmc_ad15), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)},/* (U13) gpio1[15] */ /* DIG_IN */
|
||||
{OFFSET(gpmc_a4), (MODE(7) | PULLUDDIS)}, /* (R14) gpio1[20] */ /* BT_EN */
|
||||
{OFFSET(gpmc_a5), (MODE(7) | PULLUDDIS)}, /* (V15) gpio1[21] */ /* GSM_PWR_EN */
|
||||
{OFFSET(gpmc_a9), (MODE(7) | PULLUDDIS)}, /* (U16) gpio1[25] */ /* RST_GSM */
|
||||
{OFFSET(gpmc_a10), (MODE(7) | PULLUDDIS)}, /* (T16) gpio1[26] */ /* WLAN_EN */
|
||||
{OFFSET(gpmc_a11), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (V17) gpio1[27] */ /* WLAN_IRQ */
|
||||
{OFFSET(gpmc_ad14), (MODE(7) | PULLUDDIS)}, /* (V13) gpio1[14] */ /* DIG_OUT */
|
||||
{OFFSET(gpmc_ad15), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U13) gpio1[15] */ /* DIG_IN */
|
||||
{OFFSET(gpmc_a4), (MODE(7) | PULLUDDIS)}, /* (R14) gpio1[20] */ /* BT_EN */
|
||||
{OFFSET(gpmc_a5), (MODE(7) | PULLUDDIS)}, /* (V15) gpio1[21] */ /* GSM_PWR_EN */
|
||||
{OFFSET(gpmc_a9), (MODE(7) | PULLUDDIS)}, /* (U16) gpio1[25] */ /* RST_GSM */
|
||||
{OFFSET(gpmc_a10), (MODE(7) | PULLUDDIS)}, /* (T16) gpio1[26] */ /* WLAN_EN */
|
||||
{OFFSET(gpmc_a11), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (V17) gpio1[27] */ /* WLAN_IRQ */
|
||||
|
||||
/* TODO: What about all the unused GPMC pins ? */
|
||||
|
||||
|
|
@ -85,20 +87,20 @@ static struct module_pin_mux gpio_pin_mux[] = {
|
|||
#endif
|
||||
|
||||
/* Bank 3 */
|
||||
{OFFSET(mii1_col), (MODE(7) | PULLUDEN | PULLUP_EN)}, /* (H16) gpio3[0] */ /* BUTTON */
|
||||
{OFFSET(mii1_rxdv), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)},/* (J17) gpio3[4] */ /* PCIe_IO.WAKE */
|
||||
{OFFSET(mii1_txclk), (MODE(7) | PULLUDDIS)}, /* (K18) gpio3[9] */ /* PCIe_IO.W_DIS */
|
||||
{OFFSET(mii1_rxclk), (MODE(7) | PULLUDDIS)}, /* (L18) gpio3[10] */ /* PCIe_IO.RST */
|
||||
{OFFSET(mcasp0_ahclkr), (MODE(7) | PULLUDEN | PULLDOWN_EN)}, /* (C12) gpio3[17] */ /* SIM_SEL */
|
||||
{OFFSET(mcasp0_ahclkx), (MODE(7) | PULLUDEN)}, /* (A14) gpio3[21] */ /* RST_HUB~ */
|
||||
{-1},
|
||||
{OFFSET(mii1_col), (MODE(7) | PULLUDEN | PULLUP_EN)}, /* (H16) gpio3[0] */ /* BUTTON */
|
||||
{OFFSET(mii1_rxdv), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (J17) gpio3[4] */ /* PCIe_IO.WAKE */
|
||||
{OFFSET(mii1_txclk), (MODE(7) | PULLUDDIS)}, /* (K18) gpio3[9] */ /* PCIe_IO.W_DIS */
|
||||
{OFFSET(mii1_rxclk), (MODE(7) | PULLUDDIS)}, /* (L18) gpio3[10] */ /* PCIe_IO.RST */
|
||||
{OFFSET(mcasp0_ahclkr), (MODE(7) | PULLUDEN | PULLDOWN_EN)}, /* (C12) gpio3[17] */ /* SIM_SEL */
|
||||
{OFFSET(mcasp0_ahclkx), (MODE(7) | PULLUDEN)}, /* (A14) gpio3[21] */ /* RST_HUB~ */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* I2C0 PMIC */
|
||||
static struct module_pin_mux i2c0_pin_mux[] = {
|
||||
{OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (C17) I2C0_SDA */
|
||||
{OFFSET(i2c0_scl), (MODE(0) | RXACTIVE | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (C16) I2C0_SCL */
|
||||
{-1},
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* I2C2 System */
|
||||
|
|
@ -126,40 +128,40 @@ static struct module_pin_mux rmii1_pin_mux[] = {
|
|||
|
||||
/* 25MHz Clock Output */
|
||||
{OFFSET(xdma_event_intr0), MODE(3)}, /* (A15) clkout1 (25 MHz clk for Switch) */
|
||||
{-1},
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* MMC0: WiFi */
|
||||
static struct module_pin_mux mmc0_sdio_pin_mux[] = {
|
||||
{OFFSET(mmc0_clk), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_CLK */
|
||||
{OFFSET(mmc0_cmd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_CMD */
|
||||
{OFFSET(mmc0_dat0), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_DAT0 */
|
||||
{OFFSET(mmc0_dat1), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_DAT1 */
|
||||
{OFFSET(mmc0_dat2), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_DAT2 */
|
||||
{OFFSET(mmc0_dat3), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC0_DAT3 */
|
||||
{-1},
|
||||
{OFFSET(mmc0_clk), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G17) MMC0_CLK */
|
||||
{OFFSET(mmc0_cmd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G18) MMC0_CMD */
|
||||
{OFFSET(mmc0_dat0), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G16) MMC0_DAT0 */
|
||||
{OFFSET(mmc0_dat1), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (G15) MMC0_DAT1 */
|
||||
{OFFSET(mmc0_dat2), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (F18) MMC0_DAT2 */
|
||||
{OFFSET(mmc0_dat3), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (F17) MMC0_DAT3 */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* MMC1: eMMC */
|
||||
static struct module_pin_mux mmc1_emmc_pin_mux[] = {
|
||||
{OFFSET(gpmc_csn1), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_CLK */
|
||||
{OFFSET(gpmc_csn2), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_CMD */
|
||||
{OFFSET(gpmc_ad0), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT0 */
|
||||
{OFFSET(gpmc_ad1), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT1 */
|
||||
{OFFSET(gpmc_ad2), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT2 */
|
||||
{OFFSET(gpmc_ad3), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT3 */
|
||||
{OFFSET(gpmc_ad4), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT4 */
|
||||
{OFFSET(gpmc_ad5), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT5 */
|
||||
{OFFSET(gpmc_ad6), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT6 */
|
||||
{OFFSET(gpmc_ad7), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* MMC1_DAT7 */
|
||||
{-1},
|
||||
{OFFSET(gpmc_csn1), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U9) MMC1_CLK */
|
||||
{OFFSET(gpmc_csn2), (MODE(2) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (V9) MMC1_CMD */
|
||||
{OFFSET(gpmc_ad0), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U7) MMC1_DAT0 */
|
||||
{OFFSET(gpmc_ad1), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (V7) MMC1_DAT1 */
|
||||
{OFFSET(gpmc_ad2), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (R8) MMC1_DAT2 */
|
||||
{OFFSET(gpmc_ad3), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (T8) MMC1_DAT3 */
|
||||
{OFFSET(gpmc_ad4), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (U8) MMC1_DAT4 */
|
||||
{OFFSET(gpmc_ad5), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (V8) MMC1_DAT5 */
|
||||
{OFFSET(gpmc_ad6), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (R9) MMC1_DAT6 */
|
||||
{OFFSET(gpmc_ad7), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (T9) MMC1_DAT7 */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* USB_DRVBUS not used -> configure as GPIO */
|
||||
static struct module_pin_mux usb_pin_mux[] = {
|
||||
{OFFSET(usb0_drvvbus), (MODE(7) | PULLUDDIS)}, /* (F16) USB0_DRVVBUS */
|
||||
{OFFSET(usb1_drvvbus), (MODE(7) | PULLUDDIS)}, /* (F15) USB1_DRVVBUS */
|
||||
{-1},
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* UART0: RS232/RS485 shield mode */
|
||||
|
|
@ -191,7 +193,7 @@ static struct module_pin_mux uart1_pin_mux[] = {
|
|||
static struct module_pin_mux uart3_pin_mux[] = {
|
||||
{OFFSET(mii1_rxd3), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (L17) UART3_RXD */
|
||||
{OFFSET(mii1_rxd2), (MODE(1) | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (L16) UART3_TXD */
|
||||
{-1},
|
||||
{-1}
|
||||
};
|
||||
|
||||
/* UART5: Highspeed UART for Bluetooth (no SLEWCTRL) */
|
||||
|
|
@ -200,7 +202,7 @@ static struct module_pin_mux uart5_pin_mux[] = {
|
|||
{OFFSET(lcd_data8), (MODE(4) | PULLUDEN | PULLUP_EN)}, /* (U1) UART5_TXD */
|
||||
{OFFSET(lcd_data14), (MODE(6) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (V4) uart5_ctsn */
|
||||
{OFFSET(lcd_data15), (MODE(6) | PULLUDEN | PULLUP_EN)}, /* (T5) uart5_rtsn */
|
||||
{-1},
|
||||
{-1}
|
||||
};
|
||||
|
||||
static struct module_pin_mux unused_pin_mux[] = {
|
||||
|
|
@ -212,7 +214,7 @@ static struct module_pin_mux unused_pin_mux[] = {
|
|||
|
||||
/* TODO: GPMCA1..3, A6..8 */
|
||||
|
||||
{-1},
|
||||
{-1}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -248,13 +250,3 @@ void enable_uart1_pin_mux(void)
|
|||
{
|
||||
configure_module_pin_mux(uart1_pin_mux);
|
||||
}
|
||||
|
||||
void enable_uart3_pin_mux(void)
|
||||
{
|
||||
configure_module_pin_mux(uart3_pin_mux);
|
||||
}
|
||||
|
||||
void enable_uart5_pin_mux(void)
|
||||
{
|
||||
configure_module_pin_mux(uart5_pin_mux);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ U_BOOT_CMD(
|
|||
shield, 6, 1, do_shieldmode,
|
||||
"Set the shield mode",
|
||||
"dualcan termination [on|off] [on|off]\n"
|
||||
"shield dualcan-passive\n"
|
||||
"shield comio mode [rs232|rs485] termination [on|off]\n"
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@
|
|||
#ifndef SHIELD_H
|
||||
#define SHIELD_H
|
||||
|
||||
#define SHIELD_COM_IO 0
|
||||
#define SHIELD_DUALCAN 1
|
||||
#define SHIELD_CAN_GNSS 2
|
||||
#define SHIELD_DUALCAN_PASSIVE 3
|
||||
|
||||
struct shield_t{
|
||||
char name[64];
|
||||
int (*setmode)(char * const argv[], int argc);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
#define NETBIRD_GPIO_RST_SHIELD_N GPIO_TO_PIN(0, 27)
|
||||
#define NETBIRD_GPIO_LATCH GPIO_TO_PIN(0, 7)
|
||||
#define NETBIRD_GPIO_MODE_0 GPIO_TO_PIN(1, 8)
|
||||
#define NETBIRD_GPIO_MODE_1 GPIO_TO_PIN(1, 10)
|
||||
#define NETBIRD_GPIO_MODE_0 GPIO_TO_PIN(1, 10)
|
||||
#define NETBIRD_GPIO_MODE_1 GPIO_TO_PIN(1, 8)
|
||||
|
||||
|
||||
static int shield_slot_initialized = 0;
|
||||
|
|
@ -184,8 +184,18 @@ static int set_shieldmode(char * const argv[], int argc)
|
|||
return configure_shieldmode(get_mode_from_args(argv, argc));
|
||||
}
|
||||
|
||||
/* TODO: Static ? */
|
||||
struct shield_t can_shield = {
|
||||
static int no_options(char * const argv[], int argc)
|
||||
{
|
||||
if (argc != 0) {
|
||||
debug("Too many arguments\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct shield_t can_shield = {
|
||||
"dualcan", set_shieldmode
|
||||
};
|
||||
|
||||
|
|
@ -193,3 +203,12 @@ void can_shield_init(void)
|
|||
{
|
||||
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);
|
||||
|
||||
void can_shield_init(void);
|
||||
void can_shield_passive_init(void);
|
||||
|
||||
#endif // SHIELD_CAN_H
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* 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/
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
|
|
@ -40,6 +40,12 @@
|
|||
#include "shield_comio.h"
|
||||
#include "fileaccess.h"
|
||||
|
||||
|
||||
/* TODO: place in proper header file */
|
||||
extern void serial_set_console_index(int index);
|
||||
extern int console_init_f(void);
|
||||
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/*
|
||||
|
|
@ -47,6 +53,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||
*
|
||||
* (A17) GPIO0_2: RST_GNSS~
|
||||
* (A16) GPIO0_5: EXTINT_GNSS
|
||||
* (C15) GPIO0_6: TIMEPULSE_GNSS
|
||||
*
|
||||
* (J18) GPIO0_16: RST_PHY~
|
||||
* (U12) GPIO0_27: RST_SHIELD~
|
||||
|
|
@ -109,10 +116,6 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
|
|||
#define PD_ADDRESS (0x0200) /* Product descriptor */
|
||||
#define PARTITION_ADDRESS (0x0600) /* Partition Table */
|
||||
|
||||
#define SHIELD_COM_IO 0
|
||||
#define SHIELD_DUALCAN 1
|
||||
|
||||
|
||||
static BD_Context bdctx[3]; /* The descriptor contexts */
|
||||
|
||||
|
||||
|
|
@ -147,6 +150,7 @@ err_free_gpio:
|
|||
|
||||
static void init_leds(void)
|
||||
{
|
||||
/* No init code required */
|
||||
}
|
||||
|
||||
static void set_status_led(int red, int green)
|
||||
|
|
@ -238,34 +242,28 @@ static inline int __maybe_unused read_eeprom(void)
|
|||
*/
|
||||
struct serial_device *default_serial_console(void)
|
||||
{
|
||||
/* Mux pins for selected UART properly.
|
||||
* Note: uart indexes start at 0 while
|
||||
* eserial indexes start at 1.
|
||||
/*
|
||||
* Mux pins for selected UART properly.
|
||||
* Note: UART indexes start at 0 while eserial indexes start at 1.
|
||||
*
|
||||
* Provide console on internal UART1 regardless of boot mode.
|
||||
* This only has a side effect when using X-Modem boot
|
||||
*/
|
||||
|
||||
/* Provide UART on UART2 regardless of boot mode */
|
||||
enable_uart1_pin_mux();
|
||||
return &eserial2_device;
|
||||
|
||||
#if 0 /* TODO: Check whether really required */
|
||||
if ((spl_boot_device() == BOOT_DEVICE_UART) ||
|
||||
(spl_boot_device() == BOOT_DEVICE_JTAG)) {
|
||||
if (spl_boot_device() == BOOT_DEVICE_UART) {
|
||||
/* Continue booting from UART in case of serial (xmodem) boot */
|
||||
enable_uart0_pin_mux();
|
||||
return &eserial1_device;
|
||||
} else {
|
||||
/* Use internal uart, if no output shall be seen. */
|
||||
/* Regular and JTAG boot use internal UART1 */
|
||||
enable_uart1_pin_mux();
|
||||
return &eserial2_device;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
|
||||
|
||||
// TODO: Double check !
|
||||
static const struct ddr_data ddr3_data = {
|
||||
/* Ratios were optimized by DDR3 training software from TI */
|
||||
/* TODO: Evaluate new values and update */
|
||||
.datardsratio0 = 0x39, /* 0x39 */
|
||||
.datawdsratio0 = 0x3f, /* 0x40 */ /* 3f */
|
||||
.datafwsratio0 = 0x98, /* 0x96 */ /* 98 */
|
||||
|
|
@ -347,6 +345,8 @@ struct reset_registers {
|
|||
uint32_t value_crc;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
|
||||
/* TODO: Move ethernet crc to dedicated file */
|
||||
static uint32_t ether_crc(size_t len, uint8_t const *p)
|
||||
{
|
||||
|
|
@ -394,6 +394,8 @@ void check_pmic_reset_reason(unsigned int reset_reason_shm_location)
|
|||
da9063_release_i2c_bus(bus);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void am33xx_spl_board_init(void)
|
||||
{
|
||||
/* Set CPU speed to 600 MHz (fix) */
|
||||
|
|
@ -409,13 +411,17 @@ void am33xx_spl_board_init(void)
|
|||
init_pmic_spl();
|
||||
|
||||
init_leds();
|
||||
#ifndef CONFIG_NRSW_BUILD
|
||||
set_status_led(1, 0); /* Red */
|
||||
set_indicator_led(1, 0); /* Red */
|
||||
#endif
|
||||
|
||||
/* Set MPU Frequency to what we detected now that voltages are set */
|
||||
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
|
||||
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
check_pmic_reset_reason(RESET_REASON_SHM_LOCATION);
|
||||
#endif
|
||||
|
||||
/* Debugger can place marker at end of SRAM to stop boot here */
|
||||
if (is_jtag_boot(CONFIG_JTAG_MARKER_SPL))
|
||||
|
|
@ -543,20 +549,50 @@ static void init_gsm(void)
|
|||
* 4.2.8 PWR_ON pin
|
||||
* 4.2.9 RESET_N pin
|
||||
*
|
||||
* Functionality:
|
||||
* Functionality Yocto:
|
||||
* - 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
|
||||
*/
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
int bus;
|
||||
|
||||
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_PWR_GSM); /* Set power switch inactive/released (active high) */
|
||||
|
||||
puts("init\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void init_gnss(void)
|
||||
|
|
@ -567,6 +603,7 @@ static void init_gnss(void)
|
|||
REQUEST_AND_SET_GPIO(GPIO_RST_GNSS);
|
||||
}
|
||||
|
||||
/* TODO: Double Check - WiFi is enabled by sequencer already */
|
||||
static void init_wifi(void)
|
||||
{
|
||||
int bus;
|
||||
|
|
@ -600,7 +637,7 @@ int board_init(void)
|
|||
/* Let user know we're starting */
|
||||
init_leds();
|
||||
set_status_led(1, 1); /* Orange */
|
||||
set_indicator_led(1, 1); /* Orange */
|
||||
set_indicator_led(0, 0); /* Off */
|
||||
|
||||
printf("OSC: %lu MHz\n", get_osclk()/1000000);
|
||||
|
||||
|
|
@ -609,32 +646,31 @@ int board_init(void)
|
|||
|
||||
#if !defined(CONFIG_SPL_BUILD)
|
||||
|
||||
/* TODO: Move to top of file or place into header file */
|
||||
extern int console_init_f(void);
|
||||
extern void serial_set_console_index(int index);
|
||||
|
||||
/*
|
||||
* Set Linux console based on
|
||||
* - Selection in /root/boot/consoledev
|
||||
* - Available tty interfaces
|
||||
* - ttyS1: standard console (default, internal only)
|
||||
* - ttyS0: COMIO shield (or used as console by kernel,
|
||||
* - ttyS0: COM/IO shield (or used as console by kernel,
|
||||
* when no other console available)
|
||||
* - ttyNull0: Dummy device if no real UART is available
|
||||
*/
|
||||
void set_console(void)
|
||||
{
|
||||
const char *defaultconsole = getenv("defaultconsole");
|
||||
int shield_id = bd_get_shield(0);
|
||||
|
||||
/* Set default console to ttyS1 if not yet defined in env */
|
||||
if (defaultconsole == 0) {
|
||||
setenv("defaultconsole", "ttyS1");
|
||||
}
|
||||
|
||||
/* Always use internal console for u-boot
|
||||
as comio shield is not ready at that time.
|
||||
(Needs to be initialized first using the
|
||||
shieldcmd that is run by bootcmd.) */
|
||||
/*
|
||||
* Always use internal console for u-boot
|
||||
* as COM/IO shield is not ready at that time.
|
||||
* (Needs to be initialized first using the
|
||||
* shieldcmd that is run by bootcmd.)
|
||||
*/
|
||||
serial_set_console_index(1);
|
||||
|
||||
#if defined(CONFIG_PRE_CONSOLE_BUFFER)
|
||||
|
|
@ -642,31 +678,33 @@ void set_console(void)
|
|||
console_init_f(); /* stage 1 init of console */
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (shield_id != SHIELD_COM_IO) {
|
||||
/* Don't allow changing to ttyS0 for the kernel console, because
|
||||
* ttyS0 is not available if no comio shield is populated. */
|
||||
return;
|
||||
}
|
||||
if (shield_id == SHIELD_COM_IO) {
|
||||
char buf[20];
|
||||
|
||||
/* With comio shield the defaultconsole for the kernel should
|
||||
be ttyS0 and not ttyS1 */
|
||||
setenv("defaultconsole", "ttyS0");
|
||||
/*
|
||||
* With COM/IO shield the defaultconsole for the kernel should
|
||||
* be ttyS0 (external port).
|
||||
* If consoledev file is present, take the tty defined in it as console
|
||||
*/
|
||||
setenv("defaultconsole", "ttyS0");
|
||||
|
||||
/* If consoledev file is present, take the tty defined in it as console */
|
||||
if (read_file("/root/boot/consoledev",buf, sizeof(buf)) > 3) {
|
||||
if (strstr(buf, "tty") == buf) {
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
for (i=0; i<sizeof(buf); i++) {
|
||||
if (buf[i]<=' ') {
|
||||
buf[i] = 0;
|
||||
break;
|
||||
if (read_file("/root/boot/consoledev", buf, sizeof(buf)) > 3) {
|
||||
if (strstr(buf, "tty") == buf) {
|
||||
int i;
|
||||
/* TODO: What is this code doing? */
|
||||
/* Truncating after whitespace? */
|
||||
/* are there broken consoledev files around ? */
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
for (i=0; i<sizeof(buf); i++) {
|
||||
if (buf[i] <= ' ') {
|
||||
buf[i] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
setenv("defaultconsole", buf);
|
||||
}
|
||||
setenv("defaultconsole", buf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void set_devicetree_name(void)
|
||||
|
|
@ -705,10 +743,22 @@ static void get_variant_name(void)
|
|||
|
||||
static void get_hw_version(void)
|
||||
{
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
char hw_versions[16];
|
||||
char new_env[256]; /* current bootargs = 84 bytes */
|
||||
#endif
|
||||
|
||||
bd_get_hw_version(&hw_ver, &hw_rev);
|
||||
bd_get_hw_patch(&hw_patch);
|
||||
|
||||
printf("HW24: V%d.%d\n", hw_ver, hw_rev);
|
||||
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
/* 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void get_pmic_version(void)
|
||||
|
|
@ -738,7 +788,10 @@ static void get_pmic_version(void)
|
|||
static void check_jtag_boot(void)
|
||||
{
|
||||
if (is_jtag_boot(CONFIG_JTAG_MARKER_UBOOT)) {
|
||||
char *bootcmd = getenv("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");
|
||||
}
|
||||
}
|
||||
|
|
@ -786,6 +839,12 @@ static struct shield_command known_shield_commands[] = {
|
|||
"shield dualcan termination off off",
|
||||
can_shield_init
|
||||
},
|
||||
{
|
||||
SHIELD_DUALCAN_PASSIVE,
|
||||
"dualcan-passive",
|
||||
"shield dualcan-passive",
|
||||
can_shield_passive_init
|
||||
}
|
||||
};
|
||||
|
||||
static const struct shield_command* get_shield_command(int shield_id)
|
||||
|
|
@ -806,20 +865,20 @@ static void shield_config(void)
|
|||
#define MAX_SHIELD_CMD_LEN 128
|
||||
|
||||
char shieldcmd_linux[MAX_SHIELD_CMD_LEN];
|
||||
const char *shieldcmd;
|
||||
const char *shieldcmd = ";"; /* default shield command is empty */
|
||||
const struct shield_command *cmd;
|
||||
int len;
|
||||
|
||||
int shield_id = bd_get_shield(0);
|
||||
if (shield_id < 0) {
|
||||
debug("No shield found in bd\n");
|
||||
return;
|
||||
goto end;
|
||||
}
|
||||
|
||||
cmd = get_shield_command(shield_id);
|
||||
if (cmd == NULL) {
|
||||
printf ("Unknown shield id %d\n", shield_id);
|
||||
return;
|
||||
goto end;
|
||||
}
|
||||
|
||||
printf("Shield:%s\n", cmd->name);
|
||||
|
|
@ -836,6 +895,7 @@ static void shield_config(void)
|
|||
shieldcmd = shieldcmd_linux;
|
||||
}
|
||||
|
||||
end:
|
||||
setenv("shieldcmd", shieldcmd);
|
||||
}
|
||||
|
||||
|
|
@ -862,13 +922,24 @@ static bool get_button_state(void)
|
|||
return pressed;
|
||||
}
|
||||
|
||||
static void blink_led(void)
|
||||
static void blink_led(int pulses)
|
||||
{
|
||||
const int pulse_width = 400*1000; /* 400ms */
|
||||
|
||||
/* Assumes status LED is orange */
|
||||
udelay(pulse_width);
|
||||
set_status_led(0, 0); /* Off */
|
||||
/* Assumes status led on, indicator off */
|
||||
set_status_led(0, 0);
|
||||
|
||||
while (pulses) {
|
||||
udelay(pulse_width);
|
||||
set_status_led(1, 1);
|
||||
set_indicator_led(1, 1);
|
||||
|
||||
udelay(pulse_width);
|
||||
set_status_led(0, 0);
|
||||
set_indicator_led(0, 0);
|
||||
|
||||
pulses--;
|
||||
}
|
||||
|
||||
udelay(pulse_width);
|
||||
set_status_led(1, 1); /* Orange */
|
||||
|
|
@ -888,12 +959,11 @@ static void check_reset_button(void)
|
|||
|
||||
if (counter == 2000) {
|
||||
/* Indicate factory reset threshold */
|
||||
blink_led();
|
||||
blink_led(1);
|
||||
}
|
||||
else if (counter == 12000) {
|
||||
/* Indicate recovery boot threshold */
|
||||
blink_led();
|
||||
blink_led();
|
||||
blink_led(2);
|
||||
}
|
||||
} while (counter < 12000);
|
||||
|
||||
|
|
@ -920,6 +990,7 @@ static void check_reset_button(void)
|
|||
/* Boot into recovery for duration > 12s */
|
||||
puts("Booting recovery image...\n");
|
||||
|
||||
/* TODO: ... internal .. port on HW24 */
|
||||
/* Set consoledev to external port */
|
||||
setenv("defaultconsole", "ttyS1");
|
||||
|
||||
|
|
@ -964,9 +1035,6 @@ int board_late_init(void)
|
|||
set_console();
|
||||
shield_init();
|
||||
|
||||
set_status_led(1, 1); /* Orange */
|
||||
set_indicator_led(0, 0); /* Off */
|
||||
|
||||
check_fct();
|
||||
check_jtag_boot();
|
||||
#endif
|
||||
|
|
@ -1111,6 +1179,75 @@ static void ft_enable_node(void* blob, const char* name)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Modify the name of a gpio in a gpio-line-names string list.
|
||||
*/
|
||||
static void ft_set_gpio_name(void *blob, const char* gpio, int pin, const char* name)
|
||||
{
|
||||
int node_ofs = fdt_path_offset(blob, gpio);
|
||||
int gpios = -1;
|
||||
const char* text;
|
||||
int pos = 0;
|
||||
int i;
|
||||
char buffer[512];
|
||||
|
||||
if (node_ofs == -1) {
|
||||
printf("Can't find node %s\n", gpio);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* get number of IOs in node */
|
||||
gpios = fdt_getprop_u32_default_node(blob, node_ofs, 0, "ngpios", -1);
|
||||
if (gpios == -1 || gpios > 64) {
|
||||
printf("Illegal number of gpios %d\n", gpios);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* get string array with names */
|
||||
const struct fdt_property* prop = fdt_get_property(blob, node_ofs, "gpio-line-names", NULL);
|
||||
if (prop == NULL) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* modify given name */
|
||||
for (i=0; i<gpios; i++) {
|
||||
if (i == pin) {
|
||||
/* Take provided name if GPIO pin is matched */
|
||||
text = name;
|
||||
}
|
||||
else {
|
||||
/* Take existing name from string list */
|
||||
(void)fdt_get_string_index(blob, node_ofs, "gpio-line-names", i, &text);
|
||||
}
|
||||
|
||||
/* Add name to new string list */
|
||||
if ((pos + strlen(text) + 1) < sizeof(buffer)) {
|
||||
strncpy(buffer+pos, text, sizeof(buffer)-pos);
|
||||
pos += strlen(text) + 1;
|
||||
}
|
||||
else {
|
||||
printf("ft_set_gpio_name() Buffer too small\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
(void)fdt_setprop(blob, node_ofs, "gpio-line-names", buffer, pos);
|
||||
|
||||
end: ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable digital IOs provided by COM/IO shield in gpio nodes
|
||||
*/
|
||||
static void ft_comio_gpios(void *blob)
|
||||
{
|
||||
/* gpio0_7: COM/IO relay output */
|
||||
ft_set_gpio_name(blob, "gpio0", 7, "COMIO_OUT0");
|
||||
|
||||
/* gpio1_8: COM/IO digital input */
|
||||
ft_set_gpio_name(blob, "gpio1", 8, "COMIO_IN0");
|
||||
}
|
||||
|
||||
static void ft_shields(void* blob)
|
||||
{
|
||||
int shield_type = -1;
|
||||
|
|
@ -1118,19 +1255,23 @@ static void ft_shields(void* blob)
|
|||
shield_type = bd_get_shield(0);
|
||||
switch (shield_type) {
|
||||
case SHIELD_COM_IO:
|
||||
ft_comio_gpios(blob);
|
||||
ft_enable_node(blob, "/netbox_dio_comio");
|
||||
/* TODO: Should use alias serial0 */
|
||||
ft_enable_node(blob, "/ocp/serial@44e09000");
|
||||
ft_enable_node(blob, "serial0");
|
||||
break;
|
||||
|
||||
case SHIELD_DUALCAN:
|
||||
/* TODO: Should use alias d_can0, d_can1 */
|
||||
ft_enable_node(blob, "/ocp/can@481cc000");
|
||||
ft_enable_node(blob, "/ocp/can@481d0000");
|
||||
case SHIELD_DUALCAN_PASSIVE:
|
||||
ft_enable_node(blob, "d-can0");
|
||||
ft_enable_node(blob, "d-can1");
|
||||
break;
|
||||
|
||||
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, "serial0");
|
||||
break;
|
||||
};
|
||||
|
||||
|
|
@ -1161,12 +1302,46 @@ static void ft_hw_info(void *blob)
|
|||
}
|
||||
}
|
||||
|
||||
static void ft_override_thermal(void *blob)
|
||||
{
|
||||
const char* temp_alert0 = getenv("temp_alert0");
|
||||
if (temp_alert0 != NULL) {
|
||||
int node_ofs = -1;
|
||||
int temp_in_degs = 0;
|
||||
|
||||
temp_in_degs = simple_strtoul(temp_alert0, NULL, 10);
|
||||
if (temp_in_degs == 0) {
|
||||
temp_in_degs = 95;
|
||||
} else if (temp_in_degs < 20) {
|
||||
temp_in_degs = 20;
|
||||
} else if (temp_in_degs > 120) {
|
||||
temp_in_degs = 120;
|
||||
}
|
||||
|
||||
printf("WARNING: Overriding CPU thermal alert to %d°C, critical to 125°C\n", temp_in_degs);
|
||||
|
||||
node_ofs = fdt_path_offset(blob, "/thermal-zones/cpu-thermal/trips/cpu-alert0");
|
||||
if (node_ofs >= 0) {
|
||||
fdt_setprop_inplace_u32(blob, node_ofs, "temperature", temp_in_degs*1000);
|
||||
}
|
||||
|
||||
node_ofs = fdt_path_offset(blob, "/thermal-zones/cpu-thermal/trips/cpu-crit");
|
||||
if (node_ofs >= 0) {
|
||||
fdt_setprop_inplace_u32(blob, node_ofs, "temperature", 125*1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
ft_bootloader_version(blob);
|
||||
ft_hw_info(blob);
|
||||
|
||||
ft_shields(blob);
|
||||
|
||||
|
||||
ft_override_thermal(blob);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ U_BOOT_CMD(
|
|||
shield, 6, 1, do_shieldmode,
|
||||
"Set the shield mode",
|
||||
"dualcan termination [on|off] [on|off]\n"
|
||||
"shield dualcan-passive\n"
|
||||
"shield comio mode [rs232|rs485] termination [on|off]\n"
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@
|
|||
#ifndef SHIELD_H
|
||||
#define SHIELD_H
|
||||
|
||||
#define SHIELD_COM_IO 0
|
||||
#define SHIELD_DUALCAN 1
|
||||
#define SHIELD_CAN_GNSS 2
|
||||
#define SHIELD_DUALCAN_PASSIVE 3
|
||||
|
||||
struct shield_t{
|
||||
char name[64];
|
||||
int (*setmode)(char * const argv[], int argc);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
#define NETBIRD_GPIO_RST_SHIELD_N GPIO_TO_PIN(0, 27)
|
||||
#define NETBIRD_GPIO_LATCH GPIO_TO_PIN(0, 7)
|
||||
#define NETBIRD_GPIO_MODE_0 GPIO_TO_PIN(1, 8)
|
||||
#define NETBIRD_GPIO_MODE_1 GPIO_TO_PIN(1, 10)
|
||||
#define NETBIRD_GPIO_MODE_0 GPIO_TO_PIN(1, 10)
|
||||
#define NETBIRD_GPIO_MODE_1 GPIO_TO_PIN(1, 8)
|
||||
|
||||
|
||||
static int shield_slot_initialized = 0;
|
||||
|
|
@ -184,8 +184,18 @@ static int set_shieldmode(char * const argv[], int argc)
|
|||
return configure_shieldmode(get_mode_from_args(argv, argc));
|
||||
}
|
||||
|
||||
/* TODO: Static ? */
|
||||
struct shield_t can_shield = {
|
||||
static int no_options(char * const argv[], int argc)
|
||||
{
|
||||
if (argc != 0) {
|
||||
debug("Too many arguments\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct shield_t can_shield = {
|
||||
"dualcan", set_shieldmode
|
||||
};
|
||||
|
||||
|
|
@ -193,3 +203,12 @@ void can_shield_init(void)
|
|||
{
|
||||
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);
|
||||
|
||||
void can_shield_init(void);
|
||||
void can_shield_passive_init(void);
|
||||
|
||||
#endif // SHIELD_CAN_H
|
||||
|
|
|
|||
|
|
@ -18,6 +18,15 @@
|
|||
#include <u-boot/md5.h>
|
||||
#include <malloc.h>
|
||||
#include <crypt.h>
|
||||
|
||||
/* Set defaults for passwd file location */
|
||||
#ifndef CONFIG_NM_LOGIN_PART
|
||||
#define CONFIG_NM_LOGIN_PART "1:3"
|
||||
#endif
|
||||
#ifndef CONFIG_NM_LOGIN_PASSWD
|
||||
#define CONFIG_NM_LOGIN_PASSWD "/root/boot/bootpass"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
|
@ -62,12 +71,12 @@ int login (void)
|
|||
|
||||
/* Try to get password hash file */
|
||||
memset(stored_pw_hash, 0x0, sizeof(stored_pw_hash));
|
||||
if (fs_set_blk_dev("mmc", "1:3", FS_TYPE_EXT) != 0) {
|
||||
if (fs_set_blk_dev("mmc", CONFIG_NM_LOGIN_PART, FS_TYPE_EXT) != 0) {
|
||||
puts("Error, can not set blk device\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
res = fs_read("/root/boot/bootpass", (ulong)stored_pw_hash, 0, sizeof(stored_pw_hash), &actread);
|
||||
res = fs_read(CONFIG_NM_LOGIN_PASSWD, (ulong)stored_pw_hash, 0, sizeof(stored_pw_hash), &actread);
|
||||
if ((res != 0) || (actread <= 0)) {
|
||||
/* no file or hash found -> allow login w/o password */
|
||||
puts("Login succeeded\n\n");
|
||||
|
|
@ -104,19 +113,12 @@ int login (void)
|
|||
}
|
||||
}
|
||||
else {
|
||||
/* SHA1 */
|
||||
/* SHA256 */
|
||||
char *cp = sha_crypt(password, stored_pw_hash); /* TODO: Salt = PW? */
|
||||
res = memcmp(cp, stored_pw_hash, actread);
|
||||
free(cp);
|
||||
if (res == 0)
|
||||
break;
|
||||
/*
|
||||
if (memcmp(cp, stored_pw_hash, actread) == 0) {
|
||||
free(cp);
|
||||
break;
|
||||
}
|
||||
free(cp);
|
||||
*/
|
||||
}
|
||||
|
||||
/* TODO: exponentional delay */
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@
|
|||
#include <dm/root.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
#include <spl_version_autogenerated.h>
|
||||
#endif
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#ifndef CONFIG_SYS_UBOOT_START
|
||||
|
|
@ -453,7 +457,12 @@ void preloader_console_init(void)
|
|||
|
||||
gd->have_console = 1;
|
||||
|
||||
puts("\nU-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
puts("\n" SPL_VERSION "\n");
|
||||
#else
|
||||
puts("\n");
|
||||
#endif
|
||||
puts("U-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
|
||||
U_BOOT_TIME ")\n");
|
||||
#ifdef CONFIG_SPL_DISPLAY_PRINT
|
||||
spl_display_print();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||
#define UBOOT_MIN_SIZE_BYTES (128*1024)
|
||||
#define UBOOT_MAX_SIZE_BYTES (2500*1024)
|
||||
|
||||
#if defined(CONFIG_NM_BOOTLOADER_FORMAT)
|
||||
|
||||
static int image_nm_header_ok(const struct nm_header *header)
|
||||
{
|
||||
|
|
@ -133,6 +134,8 @@ end:
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NM_BOOTLOADER_FORMAT) */
|
||||
|
||||
static int mmc_load_legacy(struct mmc *mmc, ulong sector,
|
||||
struct image_header *header)
|
||||
{
|
||||
|
|
@ -485,23 +488,27 @@ int spl_mmc_load_image(u32 boot_device)
|
|||
return err;
|
||||
|
||||
#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR)
|
||||
|
||||
#if defined(CONFIG_NM_BOOTLOADER_FORMAT)
|
||||
/* Try to load NetModule packed bootloader from main location */
|
||||
err = mmc_load_image_raw_sector_netmodule(mmc,
|
||||
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
|
||||
if (!err)
|
||||
return err; /* found -> ok */
|
||||
|
||||
#endif
|
||||
/* Try to load bootloader from main location */
|
||||
err = mmc_load_image_raw_sector(mmc,
|
||||
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
|
||||
if (!err)
|
||||
return err; /* found -> ok */
|
||||
|
||||
#if defined(CONFIG_NM_BOOTLOADER_FORMAT)
|
||||
/* Try to load NetModule packed bootloader from alternate location */
|
||||
err = mmc_load_image_raw_sector_netmodule(mmc,
|
||||
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR_ALTERNATE);
|
||||
if (!err)
|
||||
return err; /* found -> ok */
|
||||
#endif
|
||||
|
||||
/* Try to load regular bootloader from alternate location */
|
||||
err = mmc_load_image_raw_sector(mmc,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
CONFIG_ARM=y
|
||||
CONFIG_TARGET_AM335X_HW25=y
|
||||
CONFIG_SPL_STACK_R_ADDR=0x82000000
|
||||
CONFIG_SPL=y
|
||||
CONFIG_SPL_STACK_R=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT"
|
||||
CONFIG_HUSH_PARSER=y
|
||||
CONFIG_AUTOBOOT_KEYED=y
|
||||
CONFIG_AUTOBOOT_PROMPT="Press s to abort autoboot in %d seconds\n"
|
||||
CONFIG_AUTOBOOT_STOP_STR="s"
|
||||
CONFIG_CMD_BOOTZ=y
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
CONFIG_CMD_ASKENV=y
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_I2C=y
|
||||
CONFIG_CMD_USB=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_CMD_DHCP=y
|
||||
CONFIG_CMD_MII=y
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_EXT2=y
|
||||
CONFIG_CMD_EXT4=y
|
||||
CONFIG_CMD_EXT4_WRITE=y
|
||||
CONFIG_CMD_FAT=y
|
||||
CONFIG_CMD_FS_GENERIC=y
|
||||
CONFIG_DFU_TFTP=y
|
||||
CONFIG_SYS_NS16550=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_MUSB_HOST=y
|
||||
CONFIG_USB_MUSB_GADGET=y
|
||||
CONFIG_USB_GADGET=y
|
||||
CONFIG_USB_GADGET_DOWNLOAD=y
|
||||
CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
|
||||
CONFIG_G_DNL_VENDOR_NUM=0x0451
|
||||
CONFIG_G_DNL_PRODUCT_NUM=0xd022
|
||||
CONFIG_OF_LIBFDT=y
|
||||
# CONFIG_BOOTP_PXE_CLIENTARCH is not set
|
||||
# CONFIG_CMD_PXE is not set
|
||||
# CONFIG_CMD_BOOTEFI is not set
|
||||
# CONFIG_CMD_XIMG is not set
|
||||
# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_FPGA is not set
|
||||
# CONFIG_CMD_FPGA is not set
|
||||
# CONFIG_CMD_PMIC is not set
|
||||
# CONFIG_EFI_LOADER is not set
|
||||
# CONFIG_CMD_LOADB is not set
|
||||
# CONFIG_CMD_LOADS is not set
|
||||
|
|
@ -420,8 +420,10 @@ static int omap24_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr,
|
|||
}
|
||||
if (status == 0 || (status & I2C_STAT_NACK)) {
|
||||
i2c_error = 1;
|
||||
/*printf("i2c_read: error waiting for addr ACK (status=0x%x)\n",
|
||||
status);*/
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
printf("i2c_read: error waiting for addr ACK (status=0x%x)\n",
|
||||
status);
|
||||
#endif
|
||||
goto rd_exit;
|
||||
}
|
||||
if (alen) {
|
||||
|
|
@ -736,7 +738,7 @@ U_BOOT_I2C_ADAP_COMPLETE(omap24_1, omap24_i2c_init, omap24_i2c_probe,
|
|||
#endif
|
||||
|
||||
U_BOOT_I2C_ADAP_COMPLETE(omap24_2, omap24_i2c_init, omap24_i2c_probe,
|
||||
omap24_i2c_read, omap24_i2c_write, NULL,
|
||||
omap24_i2c_read, omap24_i2c_write, omap24_i2c_setspeed,
|
||||
CONFIG_SYS_OMAP24_I2C_SPEED2,
|
||||
CONFIG_SYS_OMAP24_I2C_SLAVE2,
|
||||
2)
|
||||
|
|
@ -749,7 +751,7 @@ U_BOOT_I2C_ADAP_COMPLETE(omap24_2, omap24_i2c_init, omap24_i2c_probe,
|
|||
#endif
|
||||
|
||||
U_BOOT_I2C_ADAP_COMPLETE(omap24_3, omap24_i2c_init, omap24_i2c_probe,
|
||||
omap24_i2c_read, omap24_i2c_write, NULL,
|
||||
omap24_i2c_read, omap24_i2c_write, omap24_i2c_setspeed,
|
||||
CONFIG_SYS_OMAP24_I2C_SPEED3,
|
||||
CONFIG_SYS_OMAP24_I2C_SLAVE3,
|
||||
3)
|
||||
|
|
@ -762,7 +764,7 @@ U_BOOT_I2C_ADAP_COMPLETE(omap24_3, omap24_i2c_init, omap24_i2c_probe,
|
|||
#endif
|
||||
|
||||
U_BOOT_I2C_ADAP_COMPLETE(omap24_4, omap24_i2c_init, omap24_i2c_probe,
|
||||
omap24_i2c_read, omap24_i2c_write, NULL,
|
||||
omap24_i2c_read, omap24_i2c_write, omap24_i2c_setspeed,
|
||||
CONFIG_SYS_OMAP24_I2C_SPEED4,
|
||||
CONFIG_SYS_OMAP24_I2C_SLAVE4,
|
||||
4)
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@ static int console_index = CONFIG_CONS_INDEX - 1;
|
|||
static int console_index = 0;
|
||||
#endif
|
||||
|
||||
/* TODO: Rename CONSOLE_INDEX to console_index, to make clear it
|
||||
* is a variable now
|
||||
*/
|
||||
void serial_set_console_index(int index)
|
||||
{
|
||||
console_index = index;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,320 @@
|
|||
/*
|
||||
* am335x_hw25.h
|
||||
*
|
||||
* Copyright (C) 2018-2019 NetModule AG - http://www.netmodule.com/
|
||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation version 2.
|
||||
*
|
||||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
||||
* kind, whether express or implied; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_AM335X_HW25_H
|
||||
#define __CONFIG_AM335X_HW25_H
|
||||
|
||||
#include <configs/ti_am335x_common.h>
|
||||
|
||||
/* Disable U-Boot load from filesystems, to save around 10 kB SPL image size */
|
||||
#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
|
||||
# undef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
|
||||
#endif
|
||||
|
||||
#undef CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
|
||||
|
||||
#undef CONFIG_HW_WATCHDOG
|
||||
#undef CONFIG_OMPAP_WATCHDOG
|
||||
#undef CONFIG_SPL_WATCHDOG_SUPPORT
|
||||
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
# define CONFIG_TIMESTAMP
|
||||
# define CONFIG_LZO
|
||||
#endif
|
||||
|
||||
#define CONFIG_SYS_BOOTM_LEN (16 << 20)
|
||||
|
||||
#define MACH_TYPE_TIAM335EVM 3589 /* Until the next sync */
|
||||
#define CONFIG_MACH_TYPE MACH_TYPE_TIAM335EVM
|
||||
#define CONFIG_BOARD_LATE_INIT
|
||||
|
||||
/* TODO: It could be preconsole buffer is not properly working in SPL
|
||||
* Observed lock ups when printing too much text.
|
||||
#define CONFIG_PRE_CONSOLE_BUFFER
|
||||
#define CONFIG_PRE_CON_BUF_ADDR 0x80000000
|
||||
#define CONFIG_PRE_CON_BUF_SZ 64*1024
|
||||
*/
|
||||
|
||||
/* Clock Defines */
|
||||
#define V_OSCK 0 /* 0 means detect from sysboot1 config */
|
||||
#define V_SCLK (V_OSCK)
|
||||
|
||||
#include <config_distro_bootcmd.h>
|
||||
|
||||
/* Dynamic override for PHY_ANEG_TIMEOUT value */
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
# ifndef __ASSEMBLER__
|
||||
int eth_phy_timeout(void);
|
||||
# endif
|
||||
#endif
|
||||
#define PHY_ANEG_TIMEOUT eth_phy_timeout()
|
||||
#define PHY_ANEG_DEFAULT_TIMEOUT 5000
|
||||
|
||||
#define CONFIG_ARP_TIMEOUT 200
|
||||
#undef CONFIG_NET_RETRY_COUNT
|
||||
#define CONFIG_NET_RETRY_COUNT 5
|
||||
#define CONFIG_BOOTP_MAY_FAIL
|
||||
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
|
||||
/*
|
||||
* Memory map for booting Linux
|
||||
*
|
||||
* 0x80000000 32MB KERNEL_ADDR (kernel_addr), kernel execution address
|
||||
* 0x82000000 190MB KERNEL_ADDR_R (kernel_addr_r), FIT image/kernel loading address
|
||||
* kernel will be relocated kernel_addr
|
||||
* for FIT images, ramdisc and dtb will be relocated to
|
||||
* top of bootmemory (0x8e000000 downwards)
|
||||
* 0x8BE00000 1MB FDT_ADDR_R (fdt_addr_r), device tree if separate from kernel/FIT
|
||||
* 0x8BF00000 1MB PXE_ADDR (pxefile_addr_r), pxe configuration file (pxe get command)
|
||||
* 0x8C000000 32MB LOAD_ADDR (load_addr), loading address for generic files
|
||||
* <end of boot memory>
|
||||
* 0x8E000000 4B NRSW reset reason
|
||||
* 32MB <>, Free space
|
||||
* 0x90000000 256MB <>, Free space, 512MB systems
|
||||
* 0xA0000000 512MB <>, Free space, 1GB systems only
|
||||
* 0xC0000000 End of RAM
|
||||
*/
|
||||
|
||||
#define KERNEL_ADDR "0x80000000"
|
||||
#define KERNEL_ADDR_R "0x82000000"
|
||||
#define FDT_ADDR_R "0x8BE00000"
|
||||
#define PXE_ADDR "0x8BF00000"
|
||||
#define LOAD_ADDR "0x8C000000"
|
||||
|
||||
/*
|
||||
* Limit boot memory to 256 MBytes to comply with kernel initial memory layout
|
||||
* This is the official way to restrict image load addresses.
|
||||
* Don't use xx_high_addr variables.
|
||||
*/
|
||||
#define BOOTM_SIZE "0x0E000000"
|
||||
|
||||
/* Set boot command depending of software environment */
|
||||
#ifndef CONFIG_NRSW_BUILD
|
||||
/* Yocto/OSTree boot command */
|
||||
#define MAIN_BOOTCMD "run boot_ostree"
|
||||
#else
|
||||
/* NRSW boot command */
|
||||
#define MAIN_BOOTCMD "run sdboot"
|
||||
#endif
|
||||
|
||||
/* TODO: Might need to check ti_cpsw.rx_packet_max when running on top of AM335x switch */
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
/* Memory Adresses */ \
|
||||
"fdt_addr_r=" FDT_ADDR_R "\0" \
|
||||
"kernel_addr=" KERNEL_ADDR "\0" /* NRSW only */ \
|
||||
"kernel_addr_r=" KERNEL_ADDR_R "\0" \
|
||||
"load_addr=" LOAD_ADDR "\0" \
|
||||
"pxefile_addr_r=" PXE_ADDR "\0" \
|
||||
"bootm_size=" BOOTM_SIZE "\0" \
|
||||
\
|
||||
/* Misc */ \
|
||||
"defaultconsole=ttyS0\0" \
|
||||
"fdt_skip_update=yes\0" \
|
||||
"bootdelay=0\0" \
|
||||
\
|
||||
/* Networking */ \
|
||||
"ethprime=cpsw\0" \
|
||||
"ethopts=ti_cpsw.rx_packet_max=1526\0" \
|
||||
"ipaddr=192.168.1.1\0" \
|
||||
"serverip=192.168.1.254\0" \
|
||||
"tftptimeout=2000\0" \
|
||||
"tftptimeoutcountmax=5\0" \
|
||||
"bootpretryperiod=10000\0" \
|
||||
"autoload=false\0" \
|
||||
\
|
||||
/* OSTree boot */ \
|
||||
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \
|
||||
"setenv bootargs_prev $bootargs; " \
|
||||
"env import -t $load_addr $filesize; setenv bootargs $bootargs_prev $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \
|
||||
"$ethopts rw ostree_root=/dev/mmcblk1p1\0" \
|
||||
"bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \
|
||||
"bootm $kernel_addr_r\0" \
|
||||
"boot_ostree=run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
|
||||
\
|
||||
/* NRSW boot */ \
|
||||
"root_part=1\0" /* from NRSW, required here? set from board.c */ \
|
||||
"kernel_image=kernel.bin\0" \
|
||||
"fdt_image=am335x-hw25-prod1.dtb\0" \
|
||||
"add_sd_bootargs=setenv bootargs $bootargs root=/dev/${mmc_dev}p$root_part rootfstype=ext4 " \
|
||||
"console=$defaultconsole,115200 rootwait loglevel=4 ti_cpsw.rx_packet_max=1526\0" \
|
||||
"add_version_bootargs=setenv bootargs $bootargs\0" \
|
||||
"sdbringup=echo Try bringup boot && ext4load mmc 1:$root_part $kernel_addr /boot/zImage && " \
|
||||
"ext4load mmc 1:$root_part $fdt_addr /boot/$fdt_image && setenv bootargs $bootargs rw;\0" \
|
||||
"sdprod=ext4load mmc 1:$root_part $kernel_addr /boot/$kernel_image && " \
|
||||
"ext4load mmc 1:$root_part $fdt_addr /boot/$fdt_image && setenv bootargs $bootargs ro;\0" \
|
||||
"sdboot=env set fdt_addr " FDT_ADDR_R "; "\
|
||||
"if mmc dev 1; then echo Copying Linux from SD to RAM...; "\
|
||||
"if test -e mmc 1:$root_part /boot/$kernel_image; then run sdprod; " \
|
||||
"else run sdbringup; fi; " \
|
||||
/* For v4.19 kernel $mmc_dev should be "mmcblk1" (read from DT), for v3.18 kernel: "mmcblk0" */ \
|
||||
"fdt addr $fdt_addr;if fdt get value mmc_dev /nm_env nm,mmc-dev;then;else setenv mmc_dev mmcblk0;fi;" \
|
||||
"run add_sd_bootargs; run add_version_bootargs; " \
|
||||
"bootz $kernel_addr - $fdt_addr; fi\0" \
|
||||
\
|
||||
/* Boot command */ \
|
||||
"bootcmd=" MAIN_BOOTCMD "\0" \
|
||||
\
|
||||
/* Recovery boot (same for OSTree and NRSW) */ \
|
||||
"recovery=run pxe_recovery || setenv ipaddr $ipaddr; setenv serverip $serverip; run tftp_recovery\0" \
|
||||
/* setenv ipaddr and serverip is necessary, because dhclient destroys the IPs internally */ \
|
||||
"pxe_recovery=mdio up $ethprime && dhcp && pxe get && pxe boot\0" \
|
||||
"tftp_recovery=tftpboot $kernel_addr_r recovery-image; tftpboot $fdt_addr_r recovery-dtb; " \
|
||||
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
|
||||
"debug $ethopts; " \
|
||||
"bootz $kernel_addr_r - $fdt_addr_r\0" /* kernel_addr_r */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* TODO: Check if ok for NRSW? */
|
||||
#define CONFIG_ZERO_BOOTDELAY_CHECK
|
||||
|
||||
/* UART Configuration */
|
||||
#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0: XModem Boot, Debug UART */
|
||||
|
||||
/* TODO: Preparation in case UART5 shall be used later */
|
||||
#if 0
|
||||
#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1: Unused, see note below */
|
||||
#define CONFIG_SYS_NS16550_COM3 0x48024000 /* UART2: Unused, see note below */
|
||||
/* NOTE: NS16550 definitions are cumulative, need to set COM2 to have COM3 */
|
||||
#define CONFIG_SYS_NS16550_COM4 0x481A6000 /* UART3: - */
|
||||
#define CONFIG_SYS_NS16550_COM5 0x481A8000 /* UART4: - */
|
||||
#define CONFIG_SYS_NS16550_COM6 0x481AA000 /* UART5: User UART */
|
||||
#endif
|
||||
|
||||
#define CONFIG_I2C
|
||||
#define CONFIG_I2C_MULTI_BUS
|
||||
|
||||
#define CONFIG_CMD_EEPROM
|
||||
#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* Main EEPROM */
|
||||
#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
|
||||
#define CONFIG_SYS_I2C_SPEED 100000
|
||||
#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4
|
||||
#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 50 /* TODO: Can this be reduced to 20ms */
|
||||
|
||||
/* Put Environment in eMMC */
|
||||
#define CONFIG_ENV_OFFSET (512 * 128) /* @ 512*256 SPL starts */
|
||||
#define CONFIG_ENV_SIZE (4 * 1024)
|
||||
#define CONFIG_ENV_IS_IN_MMC
|
||||
#define CONFIG_SYS_MMC_ENV_DEV 1
|
||||
|
||||
#undef CONFIG_SPL_ENV_SUPPORT
|
||||
#undef CONFIG_SPL_NAND_SUPPORT
|
||||
#undef CONFIG_SPL_ONENAND_SUPPORT
|
||||
|
||||
/* We need to disable SPI to not confuse the eeprom env driver */
|
||||
#undef CONFIG_SPI
|
||||
#undef CONFIG_SPI_BOOT
|
||||
#undef CONFIG_SPL_OS_BOOT
|
||||
|
||||
#define CONFIG_SPL_YMODEM_SUPPORT
|
||||
|
||||
#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/am33xx/u-boot-spl.lds"
|
||||
|
||||
#define CONFIG_SUPPORT_EMMC_BOOT
|
||||
|
||||
/*
|
||||
* USB configuration. We enable MUSB support, both for host and for
|
||||
* gadget. We set USB0 as peripheral and USB1 as host, based on the
|
||||
* board schematic and physical port wired to each. Then for host we
|
||||
* add mass storage support and for gadget we add both RNDIS ethernet
|
||||
* and DFU.
|
||||
*/
|
||||
#define CONFIG_USB_MUSB_DSPS
|
||||
#define CONFIG_ARCH_MISC_INIT
|
||||
#define CONFIG_USB_MUSB_PIO_ONLY
|
||||
#define CONFIG_USB_MUSB_DISABLE_BULK_COMBINE_SPLIT
|
||||
#define CONFIG_AM335X_USB0
|
||||
#define CONFIG_AM335X_USB0_MODE MUSB_HOST
|
||||
|
||||
/* To support eMMC booting */
|
||||
#define CONFIG_STORAGE_EMMC
|
||||
#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1
|
||||
|
||||
#ifdef CONFIG_USB_MUSB_HOST
|
||||
#define CONFIG_USB_STORAGE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_MUSB_GADGET
|
||||
/* Removing USB gadget and can be enabled adter adding support usb DM */
|
||||
#ifndef CONFIG_DM_ETH
|
||||
#define CONFIG_USB_ETHER
|
||||
#define CONFIG_USB_ETH_RNDIS
|
||||
#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
|
||||
#endif /* CONFIG_DM_ETH */
|
||||
#endif /* CONFIG_USB_MUSB_GADGET */
|
||||
|
||||
|
||||
/*
|
||||
* Disable MMC DM for SPL build and can be re-enabled after adding
|
||||
* DM support in SPL
|
||||
*/
|
||||
#ifdef CONFIG_SPL_BUILD
|
||||
#undef CONFIG_DM_MMC
|
||||
#undef CONFIG_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SPL_BUILD)
|
||||
/* Remove other SPL modes. */
|
||||
#undef CONFIG_SPL_NAND_SUPPORT
|
||||
#define CONFIG_ENV_IS_NOWHERE
|
||||
#undef CONFIG_PARTITION_UUIDS
|
||||
#undef CONFIG_EFI_PARTITION
|
||||
#endif
|
||||
|
||||
/* Network. */
|
||||
#define CONFIG_IP_DEFRAG /* so we can use large tftp blocks */
|
||||
#define CONFIG_TFTP_TSIZE /* tftp transfer size, progress bar */
|
||||
|
||||
#define CONFIG_PHYLIB
|
||||
#define CONFIG_PHY_SMSC
|
||||
|
||||
#define CONFIG_CMD_MEMTEST
|
||||
#define CONFIG_SYS_MEMTEST_START 0x84000000
|
||||
#define CONFIG_SYS_MEMTEST_END 0x87900000
|
||||
|
||||
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
/* support for NM packed bootloader */
|
||||
#define CONFIG_NM_BOOTLOADER_FORMAT
|
||||
|
||||
/* password protected login */
|
||||
#define CONFIG_CRYPT
|
||||
#define CONFIG_NM_LOGIN
|
||||
#define CONFIG_NM_LOGIN_PART "1:3" /* TODO: Define location of file for OSTree/Yocto */
|
||||
#define CONFIG_NM_LOGIN_PASSWD "/root/boot/bootpass"
|
||||
#endif
|
||||
|
||||
#define CONFIG_CMD_PXE
|
||||
|
||||
#define CONFIG_OF_BOARD_SETUP
|
||||
|
||||
#define CONFIG_JTAG_MARKER_SPL 0x402FFF00
|
||||
#define CONFIG_JTAG_MARKER_UBOOT 0x807FFF00
|
||||
|
||||
/* NRSW PMIC Reset Reason */
|
||||
#define RESET_REASON_SHM_LOCATION 0x8e000000
|
||||
|
||||
|
||||
/* SPL command is not needed */
|
||||
#undef CONFIG_CMD_SPL
|
||||
|
||||
/* Never enable ISO it is broken and can lead to a crash */
|
||||
#undef CONFIG_ISO_PARTITION
|
||||
|
||||
#endif /* ! __CONFIG_AM335X_HW25_H */
|
||||
|
|
@ -90,7 +90,9 @@
|
|||
"tftp_recovery=tftpboot $kernel_addr recovery-image; tftpboot $fdt_addr recovery-dtb; setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 debug; run shieldcmd; run modifyfdtcmd; bootz $kernel_addr - $fdt_addr\0" \
|
||||
"pxe_recovery=sleep 3 && dhcp && pxe get && pxe boot\0" \
|
||||
"recovery=run pxe_recovery || setenv ipaddr $ipaddr; setenv serverip $serverip; run tftp_recovery\0" /* setenv ipaddr and serverip is necessary, because dhclient can destroy the IPs inernally */ \
|
||||
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; env import -t $load_addr $filesize; setenv bootargs $bootargs root=/dev/ram0 console=$defaultconsole,115200 rw ostree_root=/dev/mmcblk1p1\0" \
|
||||
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \
|
||||
"setenv bootargs_prev $bootargs; " \
|
||||
"env import -t $load_addr $filesize; setenv bootargs $bootargs_prev $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \
|
||||
"bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; bootm $kernel_addr_r#conf@am335x-nrhw16-prod4.dtb\0" \
|
||||
"fdt_high=0xffffffff\0" \
|
||||
"initrd_high=0xffffffff\0"
|
||||
|
|
|
|||
|
|
@ -63,70 +63,112 @@ int eth_phy_timeout(void);
|
|||
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
|
||||
|
||||
/*
|
||||
* Memory map for booting Linux
|
||||
*
|
||||
* 0x80000000 63MB KERNEL_ADDR (kernel_addr), kernel execution address
|
||||
* 0x83F00000 1MB FDT_ADDR (fdt_addr_r), device tree loading address if not included in kernel
|
||||
* 0x84000000 126MB RD_ADDR (ramdisk_addr_r), ramdisc loading address
|
||||
* 0x8BE00000 2MB PXE_ADDR (pxefile_addr_r), pxe configuration file (pxe get command)
|
||||
* 0x8C000000 1MB LOAD_ADDR (load_addr), loading address for generic files
|
||||
* 0x8C100000 63MB KERNEL_ADDR_R (kernel_addr_r), kernel loading address (will be relocated to kernel_addr)
|
||||
* 0x90000000 256MB <>, Free space 512MB systems
|
||||
* 0x80000000 32MB KERNEL_ADDR (kernel_addr), kernel execution address
|
||||
* 0x82000000 190MB KERNEL_ADDR_R (kernel_addr_r), FIT image/kernel loading address
|
||||
* kernel will be relocated kernel_addr
|
||||
* for FIT images, ramdisc and dtb will be relocated to
|
||||
* top of bootmemory (0x8e000000 downwards)
|
||||
* 0x8BE00000 1MB FDT_ADDR_R (fdt_addr_r), device tree if separate from kernel/FIT
|
||||
* 0x8BF00000 1MB PXE_ADDR (pxefile_addr_r), pxe configuration file (pxe get command)
|
||||
* 0x8C000000 32MB LOAD_ADDR (load_addr), loading address for generic files
|
||||
* <end of boot memory>
|
||||
* 0x8E000000 4B NRSW reset reason
|
||||
* 32MB <>, Free space
|
||||
* 0x90000000 256MB <>, Free space, 512MB systems
|
||||
* 0xA0000000 512MB <>, Free space, 1GB systems only
|
||||
* 0xC0000000 End of RAM
|
||||
*/
|
||||
|
||||
#define KERNEL_ADDR "0x80000000"
|
||||
#define FDT_ADDR "0x83F00000"
|
||||
#define RD_ADDR "0x84000000"
|
||||
#define PXE_ADDR "0x8BE00000"
|
||||
#define KERNEL_ADDR_R "0x82000000"
|
||||
#define FDT_ADDR_R "0x8BE00000"
|
||||
#define PXE_ADDR "0x8BF00000"
|
||||
#define LOAD_ADDR "0x8C000000"
|
||||
#define KERNEL_ADDR_R "0x8C100000"
|
||||
|
||||
/*
|
||||
* Avoid copying ramdisc and dtb above 512MB, as it breaks Linux boot.
|
||||
* -1 means "do not copy" to high address, use in place.
|
||||
* Limit boot memory to 256 MBytes to comply with kernel initial memory layout
|
||||
* This is the official way to restrict image load addresses.
|
||||
* Don't use xx_high_addr variables.
|
||||
*/
|
||||
#define INITRD_HIGH_ADDR "0x84000000"
|
||||
#define FDT_HIGH_ADDR "0xffffffff"
|
||||
#define BOOTM_SIZE "0x0E000000"
|
||||
|
||||
/* Set boot command depending of software environment */
|
||||
#ifndef CONFIG_NRSW_BUILD
|
||||
/* Yocto/OSTree boot command */
|
||||
#define MAIN_BOOTCMD "run boot_ostree"
|
||||
#else
|
||||
/* NRSW boot command */
|
||||
#define MAIN_BOOTCMD "run sdboot"
|
||||
#endif
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
"fdt_image=am335x-nmhw21-prod1.dtb\0" \
|
||||
"fdt_addr_r=" FDT_ADDR "\0" \
|
||||
"fdt_high=" FDT_HIGH_ADDR "\0" \
|
||||
"initrd_high=" INITRD_HIGH_ADDR "\0" \
|
||||
"kernel_addr=" KERNEL_ADDR "\0" \
|
||||
/* Memory Adresses */ \
|
||||
"fdt_addr_r=" FDT_ADDR_R "\0" \
|
||||
"kernel_addr=" KERNEL_ADDR "\0" /* NRSW only */ \
|
||||
"kernel_addr_r=" KERNEL_ADDR_R "\0" \
|
||||
"load_addr=" LOAD_ADDR "\0" \
|
||||
"pxefile_addr_r=" PXE_ADDR "\0" \
|
||||
"ramdisk_addr_r=" RD_ADDR "\0" \
|
||||
"bootm_size=" BOOTM_SIZE "\0" \
|
||||
\
|
||||
/* Misc */ \
|
||||
"defaultconsole=ttyS2\0" \
|
||||
"fdt_skip_update=yes\0" \
|
||||
"bootdelay=0\0" \
|
||||
\
|
||||
/* Networking */ \
|
||||
"ethprime=cpsw\0" \
|
||||
"ethopts=ti_cpsw.rx_packet_max=1526\0" \
|
||||
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \
|
||||
"env import -t $load_addr $filesize; " \
|
||||
"setenv bootargs $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \
|
||||
"$ethopts rw ostree_root=/dev/mmcblk1p1\0" \
|
||||
"bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \
|
||||
"bootm $kernel_addr_r\0" \
|
||||
"bootcmd=run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
|
||||
"bootdelay=0\0" \
|
||||
"ipaddr=192.168.1.1\0" \
|
||||
"serverip=192.168.1.254\0" \
|
||||
"tftptimeout=2000\0" \
|
||||
"tftptimeoutcountmax=5\0" \
|
||||
"bootpretryperiod=10000\0" \
|
||||
"bootpretryperiod=10000\0" /* 2000 */ \
|
||||
"autoload=false\0" \
|
||||
"tftp_recovery=tftpboot $kernel_addr recovery-image; tftpboot $fdt_addr_r recovery-dtb; " \
|
||||
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
|
||||
"debug ethopts; " \
|
||||
"bootz $kernel_addr - $fdt_addr_r\0" \
|
||||
"pxe_recovery=mdio up $ethprime && dhcp && pxe get && pxe boot\0" \
|
||||
\
|
||||
/* OSTree boot */ \
|
||||
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \
|
||||
"setenv bootargs_prev $bootargs; " \
|
||||
"env import -t $load_addr $filesize; setenv bootargs $bootargs_prev $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \
|
||||
"$ethopts rw ostree_root=/dev/mmcblk1p1\0" \
|
||||
"bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \
|
||||
"bootm $kernel_addr_r\0" \
|
||||
"boot_ostree=run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
|
||||
\
|
||||
/* NRSW boot */ \
|
||||
"root_part=1\0" /* from NRSW, required here? set from board.c */ \
|
||||
"kernel_image=kernel.bin\0" \
|
||||
"fdt_image=am335x-nmhw21-prod1.dtb\0" \
|
||||
"add_sd_bootargs=setenv bootargs $bootargs root=/dev/${mmc_dev}p$root_part rootfstype=ext4 " \
|
||||
"console=$defaultconsole,115200 rootwait loglevel=4 ti_cpsw.rx_packet_max=1526\0" \
|
||||
"add_version_bootargs=setenv bootargs $bootargs\0" \
|
||||
"sdbringup=echo Try bringup boot && ext4load mmc 1:$root_part $kernel_addr /boot/zImage && " \
|
||||
"ext4load mmc 1:$root_part $fdt_addr /boot/$fdt_image && setenv bootargs $bootargs rw;\0" \
|
||||
"sdprod=ext4load mmc 1:$root_part $kernel_addr /boot/$kernel_image && " \
|
||||
"ext4load mmc 1:$root_part $fdt_addr /boot/$fdt_image && setenv bootargs $bootargs ro;\0" \
|
||||
"sdboot=env set fdt_addr " FDT_ADDR_R "; "\
|
||||
"if mmc dev 1; then echo Copying Linux from SD to RAM...; "\
|
||||
"if test -e mmc 1:$root_part /boot/$kernel_image; then run sdprod; " \
|
||||
"else run sdbringup; fi; " \
|
||||
/* For v4.19 kernel $mmc_dev should be "mmcblk1" (read from DT), for v3.18 kernel: "mmcblk0" */ \
|
||||
"fdt addr $fdt_addr;if fdt get value mmc_dev /nm_env nm,mmc-dev;then;else setenv mmc_dev mmcblk0;fi;" \
|
||||
"run add_sd_bootargs; run add_version_bootargs; " \
|
||||
"bootz $kernel_addr - $fdt_addr; fi\0" \
|
||||
\
|
||||
/* Boot command */ \
|
||||
"bootcmd=" MAIN_BOOTCMD "\0" \
|
||||
\
|
||||
/* Recovery boot (same for OSTree and NRSW) */ \
|
||||
"recovery=run pxe_recovery || setenv ipaddr $ipaddr; setenv serverip $serverip; run tftp_recovery\0" \
|
||||
/* setenv ipaddr and serverip is necessary, because dhclient can destroy the IPs internally */
|
||||
/* setenv ipaddr and serverip is necessary, because dhclient destroys the IPs internally */ \
|
||||
"pxe_recovery=mdio up $ethprime && dhcp && pxe get && pxe boot\0" \
|
||||
"tftp_recovery=tftpboot $kernel_addr_r recovery-image; tftpboot $fdt_addr_r recovery-dtb; " \
|
||||
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
|
||||
"debug $ethopts; " \
|
||||
"bootz $kernel_addr_r - $fdt_addr_r\0" /* kernel_addr_r */
|
||||
|
||||
#endif
|
||||
|
||||
#define CONFIG_ZERO_BOOTDELAY_CHECK
|
||||
|
|
@ -227,6 +269,9 @@ int eth_phy_timeout(void);
|
|||
#endif
|
||||
|
||||
/* Network. */
|
||||
#define CONFIG_IP_DEFRAG /* so we can use large tftp blocks */
|
||||
#define CONFIG_TFTP_TSIZE /* tftp transfer size, progress bar */
|
||||
|
||||
#define CONFIG_PHYLIB
|
||||
#define CONFIG_PHY_SMSC
|
||||
|
||||
|
|
@ -234,6 +279,18 @@ int eth_phy_timeout(void);
|
|||
#define CONFIG_SYS_MEMTEST_START 0x84000000
|
||||
#define CONFIG_SYS_MEMTEST_END 0x87900000
|
||||
|
||||
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
/* support for NM packed bootloader */
|
||||
#define CONFIG_NM_BOOTLOADER_FORMAT
|
||||
|
||||
/* password protected login */
|
||||
#define CONFIG_CRYPT
|
||||
#define CONFIG_NM_LOGIN
|
||||
#define CONFIG_NM_LOGIN_PART "1:3" /* TODO: Define location of file for OSTree/Yocto */
|
||||
#define CONFIG_NM_LOGIN_PASSWD "/root/boot/bootpass"
|
||||
#endif
|
||||
|
||||
#define CONFIG_CMD_PXE
|
||||
|
||||
#define CONFIG_OF_BOARD_SETUP
|
||||
|
|
@ -241,6 +298,10 @@ int eth_phy_timeout(void);
|
|||
#define CONFIG_JTAG_MARKER_SPL 0x402FFF00
|
||||
#define CONFIG_JTAG_MARKER_UBOOT 0x807FFF00
|
||||
|
||||
/* Reset and Start Reason */
|
||||
#define RESET_REASON_SHM_LOCATION 0x8e000000
|
||||
|
||||
|
||||
/* SPL command is not needed */
|
||||
#undef CONFIG_CMD_SPL
|
||||
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@
|
|||
|
||||
/* TODO: It could be preconsole buffer is not properly working in SPL
|
||||
* Observed lock ups when printing too much text.
|
||||
#define CONFIG_PRE_CONSOLE_BUFFER 1
|
||||
#define CONFIG_PRE_CON_BUF_ADDR 0x80000000
|
||||
#define CONFIG_PRE_CON_BUF_SZ 64*1024
|
||||
#define CONFIG_PRE_CONSOLE_BUFFER
|
||||
#define CONFIG_PRE_CON_BUF_ADDR 0x80000000
|
||||
#define CONFIG_PRE_CON_BUF_SZ 64*1024
|
||||
*/
|
||||
|
||||
/* Clock Defines */
|
||||
|
|
@ -71,69 +71,123 @@ int eth_phy_timeout(void);
|
|||
#define CONFIG_BOOTP_MAY_FAIL
|
||||
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
#define KERNEL_ADDR "0x80000000"
|
||||
#define LOAD_ADDR "0x83000000"
|
||||
#define FDT_ADDR "0x82000000"
|
||||
#define PXE_ADDR "0x82800000"
|
||||
#define FDT_HIGH_ADDR "0x87000000"
|
||||
#define INIT_RD_ADDR "0x88000000"
|
||||
|
||||
/*
|
||||
* Memory map for booting Linux
|
||||
*
|
||||
* 0x80000000 32MB KERNEL_ADDR (kernel_addr), kernel execution address
|
||||
* 0x82000000 190MB KERNEL_ADDR_R (kernel_addr_r), FIT image/kernel loading address
|
||||
* kernel will be relocated kernel_addr
|
||||
* for FIT images, ramdisc and dtb will be relocated to
|
||||
* top of bootmemory (0x8e000000 downwards)
|
||||
* 0x8BE00000 1MB FDT_ADDR_R (fdt_addr_r), device tree if separate from kernel/FIT
|
||||
* 0x8BF00000 1MB PXE_ADDR (pxefile_addr_r), pxe configuration file (pxe get command)
|
||||
* 0x8C000000 32MB LOAD_ADDR (load_addr), loading address for generic files
|
||||
* <end of boot memory>
|
||||
* 0x8E000000 4B NRSW reset reason
|
||||
* 32MB <>, Free space
|
||||
* 0x90000000 256MB <>, Free space, 512MB systems
|
||||
* 0xA0000000 512MB <>, Free space, 1GB systems only
|
||||
* 0xC0000000 End of RAM
|
||||
*/
|
||||
|
||||
#define KERNEL_ADDR "0x80000000"
|
||||
#define KERNEL_ADDR_R "0x82000000"
|
||||
#define FDT_ADDR_R "0x8BE00000"
|
||||
#define PXE_ADDR "0x8BF00000"
|
||||
#define LOAD_ADDR "0x8C000000"
|
||||
|
||||
/*
|
||||
* Limit boot memory to 256 MBytes to comply with kernel initial memory layout
|
||||
* This is the official way to restrict image load addresses.
|
||||
* Don't use xx_high_addr variables.
|
||||
*/
|
||||
#define BOOTM_SIZE "0x0E000000"
|
||||
|
||||
/* Set boot command depending of software environment */
|
||||
#ifndef CONFIG_NRSW_BUILD
|
||||
/* Yocto/OSTree boot command */
|
||||
#define MAIN_BOOTCMD "run boot_ostree"
|
||||
#else
|
||||
/* NRSW boot command */
|
||||
#define MAIN_BOOTCMD "run sdboot"
|
||||
#endif
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
"kernel_image=kernel.bin\0" \
|
||||
"fdt_image=openwrt-nrhw20-nb1601.dtb\0"\
|
||||
"modeboot=sdboot\0" \
|
||||
"fdt_addr=" FDT_ADDR "\0" \
|
||||
"kernel_addr=" KERNEL_ADDR "\0" \
|
||||
/* Memory Adresses */ \
|
||||
"fdt_addr_r=" FDT_ADDR_R "\0" \
|
||||
"kernel_addr=" KERNEL_ADDR "\0" /* NRSW only */ \
|
||||
"kernel_addr_r=" KERNEL_ADDR_R "\0" \
|
||||
"load_addr=" LOAD_ADDR "\0" \
|
||||
"root_part=1\0" /* Default root partition, overwritten in board file */ \
|
||||
"defaultconsole=ttyS1\0" /* Default output console */ \
|
||||
"add_sd_bootargs=setenv bootargs $bootargs root=/dev/mmcblk1p$root_part rootfstype=ext4 " \
|
||||
"pxefile_addr_r=" PXE_ADDR "\0" \
|
||||
"bootm_size=" BOOTM_SIZE "\0" \
|
||||
\
|
||||
/* Misc */ \
|
||||
"defaultconsole=ttyS1\0" \
|
||||
"fdt_skip_update=yes\0" \
|
||||
"bootdelay=0\0" \
|
||||
\
|
||||
/* Networking */ \
|
||||
"ethprime=cpsw\0" \
|
||||
"ethopts=ti_cpsw.rx_packet_max=1526\0" \
|
||||
"ipaddr=192.168.1.1\0" \
|
||||
"serverip=192.168.1.254\0" \
|
||||
"tftptimeout=2000\0" \
|
||||
"tftptimeoutcountmax=5\0" \
|
||||
"bootpretryperiod=10000\0" /* 2000 */ \
|
||||
"autoload=false\0" \
|
||||
\
|
||||
/* OSTree boot */ \
|
||||
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \
|
||||
"setenv bootargs_prev $bootargs; " \
|
||||
"env import -t $load_addr $filesize; setenv bootargs $bootargs_prev $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \
|
||||
"$ethopts rw ostree_root=/dev/mmcblk1p1\0" \
|
||||
"bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \
|
||||
"bootm $kernel_addr_r\0" \
|
||||
"boot_ostree=run shieldcmd; run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
|
||||
\
|
||||
/* NRSW boot */ \
|
||||
"root_part=1\0" /* from NRSW, required here? set from board.c */ \
|
||||
"kernel_image=kernel.bin\0" \
|
||||
"fdt_image=am335x-nmhw24-prod1.dtb\0" /* diff, openwrt-nrhw24-nb801.dtb, not relevant as it will be overwritten */ \
|
||||
"add_sd_bootargs=setenv bootargs $bootargs root=/dev/${mmc_dev}p$root_part rootfstype=ext4 " \
|
||||
"console=$defaultconsole,115200 rootwait loglevel=4 ti_cpsw.rx_packet_max=1526\0" \
|
||||
"add_version_bootargs=setenv bootargs $bootargs\0" \
|
||||
"fdt_skip_update=yes\0" \
|
||||
"ethprime=cpsw\0" \
|
||||
"sdbringup=echo Try bringup boot && ext4load mmc 1:$root_part $kernel_addr /boot/zImage && " \
|
||||
"ext4load mmc 1:$root_part $fdt_addr /boot/$fdt_image && setenv bootargs $bootargs rw;\0" \
|
||||
"sdprod=ext4load mmc 1:$root_part $kernel_addr /boot/$kernel_image && " \
|
||||
"ext4load mmc 1:$root_part $fdt_addr /boot/$fdt_image && setenv bootargs $bootargs ro;\0" \
|
||||
"sdboot=if mmc dev 1; then echo Copying Linux from SD to RAM...; "\
|
||||
"sdboot=env set fdt_addr " FDT_ADDR_R "; "\
|
||||
"if mmc dev 1; then echo Copying Linux from SD to RAM...; "\
|
||||
"if test -e mmc 1:$root_part /boot/$kernel_image; then run sdprod; " \
|
||||
"else run sdbringup; fi; " \
|
||||
/* For v4.19 kernel $mmc_dev should be "mmcblk1" (read from DT), for v3.18 kernel: "mmcblk0" */ \
|
||||
"fdt addr $fdt_addr;if fdt get value mmc_dev /nm_env nm,mmc-dev;then;else setenv mmc_dev mmcblk0;fi;" \
|
||||
"run add_sd_bootargs; run add_version_bootargs; run shieldcmd; " \
|
||||
"bootz $kernel_addr - $fdt_addr; fi\0" \
|
||||
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \
|
||||
"env import -t $load_addr $filesize; " \
|
||||
"setenv bootargs $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \
|
||||
"$ethopts rw ostree_root=/dev/mmcblk1p1\0" \
|
||||
"bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \
|
||||
"bootm $kernel_addr_r\0" \
|
||||
"bootcmd=run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
|
||||
"ipaddr=192.168.1.1\0" \
|
||||
"serverip=192.168.1.254\0" \
|
||||
"pxefile_addr_r=" PXE_ADDR "\0" \
|
||||
"fdt_addr_r=" FDT_ADDR "\0" \
|
||||
"fdt_high=" FDT_HIGH_ADDR "\0" \
|
||||
"kernel_addr_r=" KERNEL_ADDR "\0" \
|
||||
"ramdisk_addr_r=" LOAD_ADDR "\0" \
|
||||
"initrd_high=" INIT_RD_ADDR "\0" \
|
||||
"bootpretryperiod=1000\0" \
|
||||
"tftptimeout=2000\0" \
|
||||
"tftptimeoutcountmax=5\0" \
|
||||
"bootpretryperiod=2000\0" \
|
||||
"autoload=false\0" \
|
||||
"shieldcmd=\0" \
|
||||
"tftp_recovery=tftpboot $kernel_addr recovery-image; tftpboot $fdt_addr recovery-dtb; " \
|
||||
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
|
||||
"debug ti_cpsw.rx_packet_max=1526; run shieldcmd; " \
|
||||
"bootz $kernel_addr - $fdt_addr\0" \
|
||||
"pxe_recovery=sleep 3 && dhcp && pxe get && pxe boot\0" \
|
||||
\
|
||||
/* Boot command */ \
|
||||
"bootcmd=" MAIN_BOOTCMD "\0" \
|
||||
\
|
||||
/* Recovery boot (same for OSTree and NRSW) */ \
|
||||
"recovery=run pxe_recovery || setenv ipaddr $ipaddr; setenv serverip $serverip; run tftp_recovery\0" \
|
||||
/* setenv ipaddr and serverip is necessary, because dhclient can destroy the IPs inernally */
|
||||
/* setenv ipaddr and serverip is necessary, because dhclient destroys the IPs internally */ \
|
||||
"pxe_recovery=mdio up $ethprime && dhcp && pxe get && pxe boot\0" \
|
||||
"tftp_recovery=tftpboot $kernel_addr_r recovery-image; tftpboot $fdt_addr_r recovery-dtb; " \
|
||||
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
|
||||
"debug $ethopts; " \
|
||||
"bootz $kernel_addr_r - $fdt_addr_r\0" /* kernel_addr_r */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* TODO: Check if ok for NRSW? */
|
||||
#define CONFIG_ZERO_BOOTDELAY_CHECK
|
||||
|
||||
/* UART Configuration */
|
||||
#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0: XModem Boot, Shield */
|
||||
#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1: eMMC Boot, User UART */
|
||||
/* TODO: Can the following be removed, as they shouldn't be required for bootloader */
|
||||
#define CONFIG_SYS_NS16550_COM3 0x48024000 /* Unused */
|
||||
#define CONFIG_SYS_NS16550_COM4 0x481A6000 /* GNSS */
|
||||
#define CONFIG_SYS_NS16550_COM5 0x481A8000 /* Unused */
|
||||
|
|
@ -172,7 +226,6 @@ int eth_phy_timeout(void);
|
|||
#undef CONFIG_SPI_BOOT
|
||||
#undef CONFIG_SPL_OS_BOOT
|
||||
|
||||
#define CONFIG_SPL_POWER_SUPPORT /* TODO: Check */
|
||||
#define CONFIG_SPL_YMODEM_SUPPORT
|
||||
|
||||
#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/am33xx/u-boot-spl.lds"
|
||||
|
|
@ -193,16 +246,6 @@ int eth_phy_timeout(void);
|
|||
#define CONFIG_AM335X_USB0
|
||||
#define CONFIG_AM335X_USB0_MODE MUSB_HOST
|
||||
|
||||
/* TODO: remove */
|
||||
#if 0
|
||||
/* Fastboot */
|
||||
#define CONFIG_USB_FUNCTION_FASTBOOT
|
||||
#define CONFIG_CMD_FASTBOOT
|
||||
#define CONFIG_ANDROID_BOOT_IMAGE
|
||||
#define CONFIG_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR
|
||||
#define CONFIG_FASTBOOT_BUF_SIZE 0x07000000
|
||||
#endif
|
||||
|
||||
/* To support eMMC booting */
|
||||
#define CONFIG_STORAGE_EMMC
|
||||
#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1
|
||||
|
|
@ -239,6 +282,9 @@ int eth_phy_timeout(void);
|
|||
#endif
|
||||
|
||||
/* Network. */
|
||||
#define CONFIG_IP_DEFRAG /* so we can use large tftp blocks */
|
||||
#define CONFIG_TFTP_TSIZE /* tftp transfer size, progress bar */
|
||||
|
||||
#define CONFIG_PHYLIB
|
||||
|
||||
/* Ethernet Switch Support */
|
||||
|
|
@ -247,13 +293,21 @@ int eth_phy_timeout(void);
|
|||
#define CONFIG_MV88E60XX_CPU_PORT 5
|
||||
|
||||
|
||||
#define CONFIG_SYS_MEMTEST_START 0x80000000
|
||||
#define CONFIG_CMD_MEMTEST
|
||||
#define CONFIG_SYS_MEMTEST_START 0x84000000
|
||||
#define CONFIG_SYS_MEMTEST_END 0x87900000
|
||||
|
||||
/* Enable for NRSW support
|
||||
#define CONFIG_NM_LOGIN
|
||||
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
/* support for NM packed bootloader */
|
||||
#define CONFIG_NM_BOOTLOADER_FORMAT
|
||||
|
||||
/* password protected login */
|
||||
#define CONFIG_CRYPT
|
||||
*/
|
||||
#define CONFIG_NM_LOGIN
|
||||
#define CONFIG_NM_LOGIN_PART "1:3" /* TODO: Define location of file for OSTree/Yocto */
|
||||
#define CONFIG_NM_LOGIN_PASSWD "/root/boot/bootpass"
|
||||
#endif
|
||||
|
||||
#define CONFIG_CMD_PXE
|
||||
|
||||
|
|
@ -262,6 +316,13 @@ int eth_phy_timeout(void);
|
|||
#define CONFIG_JTAG_MARKER_SPL 0x402FFF00
|
||||
#define CONFIG_JTAG_MARKER_UBOOT 0x807FFF00
|
||||
|
||||
/* NRSW PMIC Reset Reason */
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
#define RESET_REASON_SHM_LOCATION 0x8e000000
|
||||
#define EXTERNAL_WATCHDOG_PATTERN 0x781f9ce2
|
||||
#endif
|
||||
|
||||
|
||||
/* SPL command is not needed */
|
||||
#undef CONFIG_CMD_SPL
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,6 @@
|
|||
|
||||
#include <configs/ti_am335x_common.h>
|
||||
|
||||
/* TODO: Inject via build system */
|
||||
#define CONFIG_NRSW
|
||||
|
||||
|
||||
|
||||
/* Disable U-Boot load from filesystems, to save around 10 kB SPL image size */
|
||||
#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
|
||||
# undef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
|
||||
|
|
@ -75,48 +70,45 @@ int eth_phy_timeout(void);
|
|||
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
|
||||
|
||||
/*
|
||||
* Memory map for booting Linux
|
||||
*
|
||||
* 0x80000000 63MB KERNEL_ADDR (kernel_addr), kernel execution address
|
||||
* 0x83F00000 1MB FDT_ADDR_R (fdt_addr_r), device tree loading address if not included in kernel
|
||||
* 126MB INIT_RD_HIGH (initrd_high), ramdisc top address for relocation
|
||||
* 0x8BE00000 2MB PXE_ADDR (pxefile_addr_r), pxe configuration file (pxe get command)
|
||||
* 0x8C000000 1MB LOAD_ADDR (load_addr), loading address for generic files
|
||||
* 0x8C100000 31MB KERNEL_ADDR_R (kernel_addr_r), kernel loading address (will be relocated to kernel_addr)
|
||||
* 0x80000000 32MB KERNEL_ADDR (kernel_addr), kernel execution address
|
||||
* 0x82000000 190MB KERNEL_ADDR_R (kernel_addr_r), FIT image/kernel loading address
|
||||
* kernel will be relocated kernel_addr
|
||||
* for FIT images, ramdisc and dtb will be relocated to
|
||||
* top of bootmemory (0x8e000000 downwards)
|
||||
* 0x8BE00000 1MB FDT_ADDR_R (fdt_addr_r), device tree if separate from kernel/FIT
|
||||
* 0x8BF00000 1MB PXE_ADDR (pxefile_addr_r), pxe configuration file (pxe get command)
|
||||
* 0x8C000000 32MB LOAD_ADDR (load_addr), loading address for generic files
|
||||
* <end of boot memory>
|
||||
* 0x8E000000 4B NRSW reset reason
|
||||
* 0x90000000 256MB <>, Free space 512MB systems
|
||||
* 32MB <>, Free space
|
||||
* 0x90000000 256MB <>, Free space, 512MB systems
|
||||
* 0xA0000000 512MB <>, Free space, 1GB systems only
|
||||
* 0xC0000000 End of RAM
|
||||
*
|
||||
* ((0x84000000 126MB RD_ADDR (ramdisk_addr_r), ramdisc loading address))
|
||||
*/
|
||||
|
||||
#define KERNEL_ADDR "0x80000000"
|
||||
/*#define FDT_ADDR "0x82000000" /* /* NRSW, trying to use FDT_ADDR_R = 0x83F00000 instead */
|
||||
#define FDT_ADDR_R "0x83F00000"
|
||||
#define PXE_ADDR "0x8BE00000"
|
||||
#define KERNEL_ADDR_R "0x82000000"
|
||||
#define FDT_ADDR_R "0x8BE00000"
|
||||
#define PXE_ADDR "0x8BF00000"
|
||||
#define LOAD_ADDR "0x8C000000"
|
||||
#define KERNEL_ADDR_R "0x8C100000"
|
||||
|
||||
/* TODO: Check this with 1 GByte system */
|
||||
/* Most likely ramdisk and FDT will be loaded to too high adresses and boot will fail */
|
||||
#if 0
|
||||
/*
|
||||
* Avoid copying ramdisc and dtb above 512MB, as it breaks Linux boot.
|
||||
* -1 means "do not copy" to high address, use in place.
|
||||
* Limit boot memory to 256 MBytes to comply with kernel initial memory layout
|
||||
* This is the official way to restrict image load addresses.
|
||||
* Don't use xx_high_addr variables.
|
||||
*/
|
||||
#define INITRD_HIGH_ADDR "0x8BE0000"
|
||||
#define RD_ADDR "0x84000000"
|
||||
#define FDT_HIGH_ADDR "0x87000000"
|
||||
#define FDT_HIGH_ADDR "0xffffffff"
|
||||
|
||||
"fdt_high=" FDT_HIGH_ADDR "\0" /* Breaks NRSW, required by Yocto ! */ \
|
||||
"fdt_addr=" FDT_ADDR "\0" /* NRSW only, breaks yocto, can we move that to fdt_addr_r ? */ \
|
||||
"initrd_high=" INITRD_HIGH_ADDR "\0" /* (0x84000000) -> INIT_RD_ADDR (0x88000000) */ \
|
||||
"ramdisk_addr_r=" RD_ADDR "\0" \
|
||||
#define BOOTM_SIZE "0x0E000000"
|
||||
|
||||
/* Set boot command depending of software environment */
|
||||
#ifndef CONFIG_NRSW_BUILD
|
||||
/* Yocto/OSTree boot command */
|
||||
#define MAIN_BOOTCMD "run boot_ostree"
|
||||
#else
|
||||
/* NRSW boot command */
|
||||
#define MAIN_BOOTCMD "run sdboot"
|
||||
#endif
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
|
|
@ -126,6 +118,7 @@ int eth_phy_timeout(void);
|
|||
"kernel_addr_r=" KERNEL_ADDR_R "\0" \
|
||||
"load_addr=" LOAD_ADDR "\0" \
|
||||
"pxefile_addr_r=" PXE_ADDR "\0" \
|
||||
"bootm_size=" BOOTM_SIZE "\0" \
|
||||
\
|
||||
/* Misc */ \
|
||||
"defaultconsole=ttyS1\0" \
|
||||
|
|
@ -144,12 +137,12 @@ int eth_phy_timeout(void);
|
|||
\
|
||||
/* OSTree boot */ \
|
||||
"bootcmd_otenv=ext4load mmc 1:1 $load_addr /boot/loader/uEnv.txt; " \
|
||||
"env import -t $load_addr $filesize; " \
|
||||
"setenv bootargs $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \
|
||||
"setenv bootargs_prev $bootargs; " \
|
||||
"env import -t $load_addr $filesize; setenv bootargs $bootargs_prev $bootargs root=/dev/ram0 console=$defaultconsole,115200 " \
|
||||
"$ethopts rw ostree_root=/dev/mmcblk1p1\0" \
|
||||
"bootcmd_rd_in_mmc=ext4load mmc 1:1 $kernel_addr_r /boot$kernel_image; " \
|
||||
"bootm $kernel_addr_r\0" \
|
||||
"bootcmd=run shieldcmd; run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
|
||||
"boot_ostree=run shieldcmd; run bootcmd_otenv; run bootcmd_rd_in_mmc\0" \
|
||||
\
|
||||
/* NRSW boot */ \
|
||||
"root_part=1\0" /* from NRSW, required here? set from board.c */ \
|
||||
|
|
@ -170,15 +163,18 @@ int eth_phy_timeout(void);
|
|||
"fdt addr $fdt_addr;if fdt get value mmc_dev /nm_env nm,mmc-dev;then;else setenv mmc_dev mmcblk0;fi;" \
|
||||
"run add_sd_bootargs; run add_version_bootargs; run shieldcmd; " \
|
||||
"bootz $kernel_addr - $fdt_addr; fi\0" \
|
||||
/* "bootcmd=run sdboot\0" */ \
|
||||
\
|
||||
/* Recovery boot */ \
|
||||
/* Boot command */ \
|
||||
"bootcmd=" MAIN_BOOTCMD "\0" \
|
||||
\
|
||||
/* Recovery boot (same for OSTree and NRSW) */ \
|
||||
"recovery=run pxe_recovery || setenv ipaddr $ipaddr; setenv serverip $serverip; run tftp_recovery\0" \
|
||||
/* setenv ipaddr and serverip is necessary, because dhclient can destroy the IPs internally */ \
|
||||
/* setenv ipaddr and serverip is necessary, because dhclient destroys the IPs internally */ \
|
||||
"pxe_recovery=mdio up $ethprime && dhcp && pxe get && pxe boot\0" \
|
||||
"tftp_recovery=tftpboot $kernel_addr_r recovery-image; tftpboot $fdt_addr_r recovery-dtb; " /* kernel_addr_r ? */ \
|
||||
"tftp_recovery=tftpboot $kernel_addr_r recovery-image; tftpboot $fdt_addr_r recovery-dtb; " \
|
||||
"setenv bootargs rdinit=/etc/preinit console=$defaultconsole,115200 " \
|
||||
"debug $ethopts; " \
|
||||
"run shieldcmd; " \
|
||||
"bootz $kernel_addr_r - $fdt_addr_r\0" /* kernel_addr_r */
|
||||
|
||||
#endif
|
||||
|
|
@ -188,8 +184,8 @@ int eth_phy_timeout(void);
|
|||
#define CONFIG_ZERO_BOOTDELAY_CHECK
|
||||
|
||||
/* UART Configuration */
|
||||
#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0: XModem Boot */
|
||||
#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1: eMMC Boot, User UART */
|
||||
#define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0: XModem Boot, Shield */
|
||||
#define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1: Debug UART (Internal) */
|
||||
|
||||
#define CONFIG_I2C
|
||||
#define CONFIG_I2C_MULTI_BUS
|
||||
|
|
@ -272,6 +268,9 @@ int eth_phy_timeout(void);
|
|||
#endif
|
||||
|
||||
/* Network. */
|
||||
#define CONFIG_IP_DEFRAG /* so we can use large tftp blocks */
|
||||
#define CONFIG_TFTP_TSIZE /* tftp transfer size, progress bar */
|
||||
|
||||
#define CONFIG_PHYLIB
|
||||
#define CONFIG_PHY_SMSC
|
||||
|
||||
|
|
@ -279,10 +278,16 @@ int eth_phy_timeout(void);
|
|||
#define CONFIG_SYS_MEMTEST_START 0x84000000
|
||||
#define CONFIG_SYS_MEMTEST_END 0x87900000
|
||||
|
||||
/* NRSW password protected login */
|
||||
#ifdef CONFIG_NRSW
|
||||
#define CONFIG_NM_LOGIN
|
||||
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
/* support for NM packed bootloader */
|
||||
#define CONFIG_NM_BOOTLOADER_FORMAT
|
||||
|
||||
/* password protected login */
|
||||
#define CONFIG_CRYPT
|
||||
#define CONFIG_NM_LOGIN
|
||||
#define CONFIG_NM_LOGIN_PART "1:3" /* TODO: Define location of file for OSTree/Yocto */
|
||||
#define CONFIG_NM_LOGIN_PASSWD "/root/boot/bootpass"
|
||||
#endif
|
||||
|
||||
#define CONFIG_CMD_PXE
|
||||
|
|
@ -293,7 +298,7 @@ int eth_phy_timeout(void);
|
|||
#define CONFIG_JTAG_MARKER_UBOOT 0x807FFF00
|
||||
|
||||
/* NRSW PMIC Reset Reason */
|
||||
#ifdef CONFIG_NRSW
|
||||
#ifdef CONFIG_NRSW_BUILD
|
||||
#define RESET_REASON_SHM_LOCATION 0x8e000000
|
||||
#define EXTERNAL_WATCHDOG_PATTERN 0x781f9ce2
|
||||
#endif
|
||||
|
|
|
|||
230
lib/crypt.c
230
lib/crypt.c
|
|
@ -1,26 +1,20 @@
|
|||
#include <common.h>
|
||||
#include <u-boot/sha256.h>
|
||||
#include <malloc.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/* The crypt source code was ported from busybox sources pw_crypt */
|
||||
|
||||
/* Used by pw_encrypt_XXX.c */
|
||||
static const uint8_t ascii64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
static char*
|
||||
to64(char *s, unsigned v, int n)
|
||||
{
|
||||
while (--n >= 0) {
|
||||
*s++ = ascii64[v & 0x3f];
|
||||
v >>= 6;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
/*
|
||||
* The crypt source code was ported from busybox sources pw_crypt, file
|
||||
* libbb/pw_encrypt_sha.c
|
||||
*
|
||||
* 20191108rs: Update to Busybox commit 49ecee0 (Jan 24, 2017)
|
||||
* Major cleanup, provide missing functions
|
||||
*/
|
||||
|
||||
/* SHA256 and SHA512-based Unix crypt implementation.
|
||||
* Released into the Public Domain by Ulrich Drepper <drepper@redhat.com>.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <u-boot/sha256.h>
|
||||
#include <malloc.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Prefix for optional rounds specification. */
|
||||
static const char str_rounds[] = "rounds=%u$";
|
||||
|
||||
|
|
@ -33,50 +27,111 @@ static const char str_rounds[] = "rounds=%u$";
|
|||
/* Maximum number of rounds. */
|
||||
#define ROUNDS_MAX 999999999
|
||||
|
||||
char *sha_crypt(const char *key_data, const char *salt_data)
|
||||
|
||||
/* Missing busybox functions */
|
||||
|
||||
static char* to64(char *s, unsigned v, int n)
|
||||
{
|
||||
static const uint8_t ascii64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
while (--n >= 0) {
|
||||
*s++ = ascii64[v & 0x3f];
|
||||
v >>= 6;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void* xzalloc(size_t size)
|
||||
{
|
||||
void *ptr = malloc(size);
|
||||
/* note: error check left out */
|
||||
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static char *xstrdup(const char *s)
|
||||
{
|
||||
size_t len = strlen (s) + 1;
|
||||
char *ret = malloc (len);
|
||||
/* note: error check left out */
|
||||
|
||||
memcpy (ret, s, len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0 /* currently not required, see note below */
|
||||
static char *xstrndup(const char *s, size_t n)
|
||||
{
|
||||
char *result;
|
||||
size_t len = strlen (s);
|
||||
|
||||
if (n < len)
|
||||
len = n;
|
||||
|
||||
printf("allocating %d bytes\n", len+1);
|
||||
|
||||
result = malloc (len + 1);
|
||||
/* note: error check left out */
|
||||
|
||||
result[len] = '\0';
|
||||
memcpy (result, s, len);
|
||||
return (char *)result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *strchrnul(const char *s, int c)
|
||||
{
|
||||
while (*s && *s != (char)c)
|
||||
s++;
|
||||
return (char *)s;
|
||||
}
|
||||
|
||||
|
||||
char *sha_crypt(/*const*/ char *key_data, /*const*/ char *salt_data)
|
||||
{
|
||||
void (*sha_begin)(void *ctx);
|
||||
void (*sha_hash)(void *ctx, const void *buffer, size_t len);
|
||||
void* (*sha_end)( void *ctx, void *resbuf);
|
||||
void (*sha_end)(void *ctx, void *resbuf);
|
||||
int _32or64;
|
||||
|
||||
char *result, *resptr;
|
||||
|
||||
/* btw, sha256 needs [32] and uint32_t only */
|
||||
unsigned char alt_result[64] __attribute__((__aligned__(__alignof__(uint64_t))));
|
||||
unsigned char temp_result[64] __attribute__((__aligned__(__alignof__(uint64_t))));
|
||||
union {
|
||||
sha256_context x;
|
||||
#if 0
|
||||
sha512_ctx_t y;
|
||||
#endif
|
||||
} ctx;
|
||||
union {
|
||||
sha256_context x;
|
||||
#if 0
|
||||
sha512_ctx_t y;
|
||||
#endif
|
||||
} alt_ctx;
|
||||
struct {
|
||||
unsigned char alt_result[64];
|
||||
unsigned char temp_result[64];
|
||||
union {
|
||||
sha256_context x;
|
||||
/* sha512_ctx_t y; */
|
||||
} ctx;
|
||||
union {
|
||||
sha256_context x;
|
||||
/* sha512_ctx_t y; */
|
||||
} alt_ctx;
|
||||
} L;
|
||||
#define alt_result (L.alt_result )
|
||||
#define temp_result (L.temp_result)
|
||||
#define ctx (L.ctx )
|
||||
#define alt_ctx (L.alt_ctx )
|
||||
unsigned salt_len;
|
||||
unsigned key_len;
|
||||
unsigned cnt;
|
||||
unsigned rounds;
|
||||
char *cp;
|
||||
char is_sha512;
|
||||
char *tmp;
|
||||
|
||||
/* Analyze salt, construct already known part of result */
|
||||
cnt = strlen(salt_data) + 1 + 43 + 1;
|
||||
is_sha512 = salt_data[1];
|
||||
if (is_sha512 == '6') {
|
||||
printf("SHA-512 is not supported yet");
|
||||
return 0;
|
||||
/* cnt += 43; */
|
||||
}
|
||||
result = resptr = malloc(cnt); /* will provide NUL terminator */
|
||||
memset(result, 0, cnt);
|
||||
_32or64 = 32;
|
||||
if (salt_data[1] == '6') { /* sha512 */
|
||||
_32or64 *= 2; /*64*/
|
||||
cnt += 43;
|
||||
puts("SHA-512 is not supported");
|
||||
return 0;
|
||||
}
|
||||
result = resptr = xzalloc(cnt); /* will provide NUL terminator */
|
||||
*resptr++ = '$';
|
||||
*resptr++ = is_sha512;
|
||||
*resptr++ = salt_data[1];
|
||||
*resptr++ = '$';
|
||||
rounds = ROUNDS_DEFAULT;
|
||||
salt_data += 3;
|
||||
|
|
@ -95,47 +150,39 @@ char *sha_crypt(const char *key_data, const char *salt_data)
|
|||
resptr += sprintf(resptr, str_rounds, rounds);
|
||||
}
|
||||
}
|
||||
{
|
||||
char *salt_end = strchr(salt_data, '$');
|
||||
if (salt_end != 0) {
|
||||
salt_len = salt_end - salt_data;
|
||||
}
|
||||
else {
|
||||
salt_len = strnlen(salt_data, SALT_LEN_MAX);
|
||||
}
|
||||
}
|
||||
// salt_len = (int)strchrnul(salt_data, '$') - (int)salt_data;
|
||||
|
||||
salt_len = (int)strchrnul(salt_data, '$') - (int)salt_data;
|
||||
if (salt_len > SALT_LEN_MAX)
|
||||
salt_len = SALT_LEN_MAX;
|
||||
/* xstrdup assures suitable alignment; also we will use it
|
||||
as a scratch space later. */
|
||||
tmp = malloc(strnlen(salt_data, 128));
|
||||
memcpy(tmp, salt_data, strnlen(salt_data, 128));
|
||||
salt_data = tmp;
|
||||
//salt_data = xstrndup(salt_data, salt_len);
|
||||
|
||||
/* NOTE: Something is wrong here.
|
||||
* when <salt_len> bytes are reserved there is a problem later in
|
||||
* the code and computations are incorrect.
|
||||
* So far it is not clear what the root problem is.
|
||||
* By not truncating the buffer the code works fine
|
||||
*/
|
||||
/* salt_data = xstrndup(salt_data, salt_len); */
|
||||
salt_data = xstrdup(salt_data);
|
||||
/* add "salt$" to result */
|
||||
strcpy(resptr, salt_data);
|
||||
resptr += salt_len;
|
||||
*resptr++ = '$';
|
||||
/* key data doesn't need much processing */
|
||||
key_len = strlen(key_data);
|
||||
tmp = malloc(strnlen(key_data, 256));
|
||||
memcpy(tmp, key_data, strnlen(key_data, 256));
|
||||
key_data = tmp;
|
||||
// key_data = xstrdup(key_data);
|
||||
key_data = xstrdup(key_data);
|
||||
|
||||
/* Which flavor of SHAnnn ops to use? */
|
||||
sha_begin = (void*)sha256_starts;
|
||||
sha_hash = (void*)sha256_update;
|
||||
sha_end = (void*)sha256_finish;
|
||||
_32or64 = 32;
|
||||
/* Not supported */
|
||||
#if 0
|
||||
if (is_sha512 == '6') {
|
||||
/* SHA512 not supported */
|
||||
if (_32or64 != 32) {
|
||||
sha_begin = (void*)sha512_begin;
|
||||
sha_hash = (void*)sha512_hash;
|
||||
sha_end = (void*)sha512_end;
|
||||
_32or64 = 64;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -230,35 +277,30 @@ char *sha_crypt(const char *key_data, const char *salt_data)
|
|||
sha_end(&ctx, alt_result);
|
||||
}
|
||||
|
||||
|
||||
/* Append encrypted password to result buffer */
|
||||
//TODO: replace with something like
|
||||
// bb_uuencode(cp, src, length, bb_uuenc_tbl_XXXbase64);
|
||||
#define b64_from_24bit(B2, B1, B0, N) \
|
||||
do { \
|
||||
unsigned w = ((B2) << 16) | ((B1) << 8) | (B0); \
|
||||
resptr = to64(resptr, w, N); \
|
||||
do { \
|
||||
unsigned w = ((B2) << 16) | ((B1) << 8) | (B0); \
|
||||
resptr = to64(resptr, w, N); \
|
||||
} while (0)
|
||||
if (is_sha512 == '5') {
|
||||
if (_32or64 == 32) { /* sha256 */
|
||||
unsigned i = 0;
|
||||
unsigned j = 10;
|
||||
unsigned k = 20;
|
||||
/* strange swap of one byte (see below why) */
|
||||
unsigned char alt_result_31 = alt_result[31];
|
||||
alt_result[31] = alt_result[1];
|
||||
while (1) {
|
||||
unsigned j = i + 10;
|
||||
unsigned k = i + 20;
|
||||
if (j >= 30) j -= 30;
|
||||
if (k >= 30) k -= 30;
|
||||
b64_from_24bit(alt_result[i], alt_result[j], alt_result[k], 4);
|
||||
if (i == 9)
|
||||
if (k == 29)
|
||||
break;
|
||||
i += 21; i = (((i >> 4) & 2) + i) & 0x1f;
|
||||
j += 21; j = (((j >> 4) & 2) + j) & 0x1f;
|
||||
k += 21; k = (((k >> 4) & 2) + k) & 0x1f;
|
||||
i = k + 1;
|
||||
}
|
||||
b64_from_24bit(0, alt_result_31, alt_result[30], 3);
|
||||
b64_from_24bit(0, alt_result[31], alt_result[30], 3);
|
||||
/* was:
|
||||
b64_from_24bit(alt_result[0], alt_result[10], alt_result[20], 4);
|
||||
b64_from_24bit(alt_result[21], alt_result[1], alt_result[11], 4);
|
||||
...............................^^^^^^^^^^^^^ why [1] and not [31]?
|
||||
b64_from_24bit(alt_result[12], alt_result[22], alt_result[2], 4);
|
||||
b64_from_24bit(alt_result[3], alt_result[13], alt_result[23], 4);
|
||||
b64_from_24bit(alt_result[24], alt_result[4], alt_result[14], 4);
|
||||
|
|
@ -271,15 +313,15 @@ do { \
|
|||
*/
|
||||
} else {
|
||||
unsigned i = 0;
|
||||
unsigned j = 21;
|
||||
unsigned k = 42;
|
||||
while (1) {
|
||||
unsigned j = i + 21;
|
||||
unsigned k = i + 42;
|
||||
if (j >= 63) j -= 63;
|
||||
if (k >= 63) k -= 63;
|
||||
b64_from_24bit(alt_result[i], alt_result[j], alt_result[k], 4);
|
||||
if (i == 62)
|
||||
if (j == 20)
|
||||
break;
|
||||
i += 22; i = ((i >> 6) + i) & 0x3f;
|
||||
j += 22; j = ((j >> 6) + j) & 0x3f;
|
||||
k += 22; k = ((k >> 6) + k) & 0x3f;
|
||||
i = j + 1;
|
||||
}
|
||||
b64_from_24bit(0, 0, alt_result[63], 2);
|
||||
/* was:
|
||||
|
|
@ -313,10 +355,7 @@ do { \
|
|||
/* Clear the buffer for the intermediate result so that people
|
||||
attaching to processes or reading core dumps cannot get any
|
||||
information. */
|
||||
memset(temp_result, 0, sizeof(temp_result));
|
||||
memset(alt_result, 0, sizeof(alt_result));
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
memset(&alt_ctx, 0, sizeof(alt_ctx));
|
||||
memset(&L, 0, sizeof(L)); /* [alt]_ctx and XXX_result buffers */
|
||||
memset(key_data, 0, key_len); /* also p_bytes */
|
||||
memset(salt_data, 0, salt_len); /* also s_bytes */
|
||||
free(key_data);
|
||||
|
|
@ -325,5 +364,8 @@ do { \
|
|||
#undef s_bytes
|
||||
|
||||
return result;
|
||||
#undef alt_result
|
||||
#undef temp_result
|
||||
#undef ctx
|
||||
#undef alt_ctx
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,25 @@
|
|||
#include <linux/ctype.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)
|
||||
{
|
||||
#if defined(BUILD_TAG)
|
||||
|
|
@ -23,6 +42,8 @@ int display_options (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NRSW_BUILD */
|
||||
|
||||
void print_freq(uint64_t freq, const char *s)
|
||||
{
|
||||
unsigned long m = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue