Compare commits

..

No commits in common. "2016.05-am335x-netmodule" and "2016.05-am335x-netmodule-rfe63209" have entirely different histories.

26 changed files with 198 additions and 3153 deletions

View File

@ -414,14 +414,6 @@ config TARGET_AM335X_NRHW24
select DM_SERIAL select DM_SERIAL
select DM_GPIO 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 config TARGET_AM335X_SL50
bool "Support am335x_sl50" bool "Support am335x_sl50"
select CPU_V7 select CPU_V7
@ -923,7 +915,6 @@ source "board/nm/netbird_v2/Kconfig"
source "board/nm/nrhw20/Kconfig" source "board/nm/nrhw20/Kconfig"
source "board/nm/nmhw21/Kconfig" source "board/nm/nmhw21/Kconfig"
source "board/nm/nrhw24/Kconfig" source "board/nm/nrhw24/Kconfig"
source "board/nm/hw25/Kconfig"
source "board/olimex/mx23_olinuxino/Kconfig" source "board/olimex/mx23_olinuxino/Kconfig"
source "board/phytec/pcm051/Kconfig" source "board/phytec/pcm051/Kconfig"
source "board/phytec/pcm052/Kconfig" source "board/phytec/pcm052/Kconfig"

View File

@ -279,26 +279,6 @@ uint32_t bd_get_fpgainfo(void)
return fpgainfo; 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) int bd_get_pd_module(uint32_t slot, char *config, size_t len)
{ {
if ( !_get_string(BD_Pd_Module0 + slot, 0, config, len) ) { if ( !_get_string(BD_Pd_Module0 + slot, 0, config, len) ) {

View File

@ -22,8 +22,6 @@ void bd_get_hw_version(int* ver, int* rev);
void bd_get_hw_patch(int* patch); void bd_get_hw_patch(int* patch);
int bd_get_mac(int index, uint8_t *macaddr, size_t len); int bd_get_mac(int index, uint8_t *macaddr, size_t len);
uint32_t bd_get_fpgainfo(void); 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_pd_module(uint32_t slot, char *config, size_t len);
int bd_get_sim_config(char* simconfig, size_t len); int bd_get_sim_config(char* simconfig, size_t len);
int bd_get_devicetree(char* devicetreename, size_t len); int bd_get_devicetree(char* devicetreename, size_t len);

View File

@ -16,27 +16,9 @@
#define CONFIG_PMIC_I2C_ADDR 0x58 /* Pages 0 and 1, Pages 2 and 3 -> 0x59 */ #define CONFIG_PMIC_I2C_ADDR 0x58 /* Pages 0 and 1, Pages 2 and 3 -> 0x59 */
#define PMIC_REG_STATUS_A 0x01 /* Status of ON_KEY, WAKE, COMP1V2, DVC */ #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_REG_FAULT_LOG 0x05 /* PMIC fault log register, holding reset reason */
#define PMIC_FAULT_TWD_ERROR_MASK 0x01 /* Watchdog timeout detected */ #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_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_CONTROL_D 0x11 /* Control register for blink/watchdog */
#define PMIC_REG_GPIO14_15 0x1C /* Configuration of GPIO14/15 (mode, wake) */ #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_MODE0_7 0x1D /* Control register for GPIOs 0..7 */
@ -57,7 +39,6 @@
#define PMIC_LDOx_CONF_MASK 0x80 #define PMIC_LDOx_CONF_MASK 0x80
#define PMIC_REG_ID_4_3 0x84 #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_A 0x9A
#define PMIC_REG_BUCK_ILIM_B 0x9B #define PMIC_REG_BUCK_ILIM_B 0x9B
@ -83,9 +64,6 @@
#define PMIC_REG_TRIM_CLDR 0x120 /* Calendar Trim register, 2's complement, 1.9ppm per bit */ #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> */ #define PMIC_REG_CONFIG_ID 0x184 /* OTP Config ID <ver.rev> */

View File

@ -1,36 +0,0 @@
/*
* 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;
}

View File

@ -1,18 +0,0 @@
/*
* 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 */

View File

@ -1,26 +0,0 @@
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

View File

@ -1,13 +0,0 @@
#
# 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

View File

@ -1,26 +0,0 @@
/*
* 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

View File

@ -1,40 +0,0 @@
#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;
}

View File

@ -1,14 +0,0 @@
/**@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

View File

@ -1,223 +0,0 @@
/*
* 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);
}

View File

@ -1,158 +0,0 @@
/*
* 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*) }
}

View File

@ -10,4 +10,4 @@ ifeq ($(CONFIG_SKIP_LOWLEVEL_INIT),)
obj-y := mux.o obj-y := mux.o
endif endif
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 obj-y += board.o ../common/bdparser.o ../common/board_descriptor.o ../common/da9063.o fileaccess.o sja1105.o ui.o um.o

View File

@ -38,7 +38,6 @@
#include "../common/board_descriptor.h" #include "../common/board_descriptor.h"
#include "../common/da9063.h" #include "../common/da9063.h"
#include "board.h" #include "board.h"
#include "reset_reason.h"
#include "sja1105.h" #include "sja1105.h"
#include "ui.h" #include "ui.h"
#include "um.h" #include "um.h"
@ -48,13 +47,10 @@ DECLARE_GLOBAL_DATA_PTR;
/* /*
* CPU GPIOs * CPU GPIOs
* *
* (C15) GPIO0_6: MB_LED_PWM
* (V2) GPIO0_8: RS232_485n_SEL (V3.2)
* (V3) GPIO0_9: RS485_DE (V3.2)
* (J18) GPIO0_16: ETH_SW_RST~ (V2.0) * (J18) GPIO0_16: ETH_SW_RST~ (V2.0)
* (K15) GPIO0_17: CTRL.INT~ * (K15) GPIO0_17: CTRL.INT~
* (T10) GPIO0_23: CAN_TERM1~ (V1.0) * (T10) GPIO0_23: CAN_TERM1~ (V1.0)
* (T17) GPIO0_30: LED0.GN (<V3.2 only) * (T17) GPIO0_30: LED0.RD
* *
* (T12) GPIO1_12: SIM_SW * (T12) GPIO1_12: SIM_SW
* (V13) GPIO1_14: GNSS_RST~ * (V13) GPIO1_14: GNSS_RST~
@ -62,12 +58,11 @@ DECLARE_GLOBAL_DATA_PTR;
* (R14) GPIO1_20: BT_EN * (R14) GPIO1_20: BT_EN
* (V15) GPIO1_21: GSM_PWR_EN * (V15) GPIO1_21: GSM_PWR_EN
* (U15) GPIO1_22: LED1.RD * (U15) GPIO1_22: LED1.RD
* (T15) GPIO1_23: LED0.GN (V3.2)
* (V16) GPIO1_24: LED1.GN * (V16) GPIO1_24: LED1.GN
* (U16) GPIO1_25: RST_GSM * (U16) GPIO1_25: RST_GSM
* (T16) GPIO1_26: WLAN_EN * (T16) GPIO1_26: WLAN_EN
* (V17) GPIO1_27: WLAN_IRQ * (V17) GPIO1_27: WLAN_IRQ
* (U18) GPIO1_28: LED0.RD * (U18) GPIO1_28: LED0.GN
* *
* (U3) GPIO2_16: TIMEPULSE~ (HW26) * (U3) GPIO2_16: TIMEPULSE~ (HW26)
* (R6) GPIO2_25: RST_ETH~ * (R6) GPIO2_25: RST_ETH~
@ -81,9 +76,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio)) #define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
#define GPIO_LED_PWM_V32 GPIO_TO_PIN(0, 6) /* V3.2 LED brightness */ #define GPIO_LED0_GREEN GPIO_TO_PIN(0, 30)
#define GPIO_LED0_GREEN GPIO_TO_PIN(0, 30) /* <V3.2 */
#define GPIO_LED0_GREEN_V32 GPIO_TO_PIN(1, 23) /* V3.2 */
#define GPIO_LED0_RED GPIO_TO_PIN(1, 28) #define GPIO_LED0_RED GPIO_TO_PIN(1, 28)
#define GPIO_LED1_GREEN GPIO_TO_PIN(1, 24) #define GPIO_LED1_GREEN GPIO_TO_PIN(1, 24)
#define GPIO_LED1_RED GPIO_TO_PIN(1, 22) #define GPIO_LED1_RED GPIO_TO_PIN(1, 22)
@ -113,8 +106,6 @@ DECLARE_GLOBAL_DATA_PTR;
#define GPIO_UART2_RX GPIO_TO_PIN(0, 2) /* UART Rx Pin as GPIO */ #define GPIO_UART2_RX GPIO_TO_PIN(0, 2) /* UART Rx Pin as GPIO */
#define GPIO_RS232_RS485n_SEL GPIO_TO_PIN(0, 8)
#define GPIO_RS485_DE GPIO_TO_PIN(0, 9)
/* /*
* PMIC GPIOs * PMIC GPIOs
@ -150,13 +141,6 @@ DECLARE_GLOBAL_DATA_PTR;
#error Recovery boot time must be larger than factory reset + 1 second #error Recovery boot time must be larger than factory reset + 1 second
#endif #endif
/*
* CPU Reset Reason
*/
#define CPU_GLOBAL_COLD_RST 0x01
#define CPU_GLOBAL_WARM_SW_RST 0x02
#define CPU_WDT1_RESET 0x10
#if !defined(CONFIG_SPL_BUILD) #if !defined(CONFIG_SPL_BUILD)
@ -168,12 +152,8 @@ static int hw_type = -1;
static char hw_variant_name[64]; static char hw_variant_name[64];
#else #else
static int hw_type = -1; static int hw_type = -1;
static int hw_ver = -1;
static int hw_rev = -1;
static uint32_t sys_start_event = 0x0;
#endif #endif
#if !defined(CONFIG_SPL_BUILD) #if !defined(CONFIG_SPL_BUILD)
static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE; static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
#endif #endif
@ -230,24 +210,10 @@ err_free_gpio:
#define REQUEST_AND_CLEAR_GPIO(N) request_and_set_gpio(N, #N, 0); #define REQUEST_AND_CLEAR_GPIO(N) request_and_set_gpio(N, #N, 0);
static bool is_v32_or_newer(void)
{
int full_ver = hw_ver*256 + hw_rev;
bool res = full_ver >= 0x0302;
return res;
}
static void init_leds(void) static void init_leds(void)
{ {
REQUEST_AND_SET_GPIO(GPIO_LED0_RED); REQUEST_AND_SET_GPIO(GPIO_LED0_RED);
if (is_v32_or_newer()) {
REQUEST_AND_SET_GPIO(GPIO_LED_PWM_V32);
REQUEST_AND_SET_GPIO(GPIO_LED0_GREEN_V32);
}
else {
REQUEST_AND_SET_GPIO(GPIO_LED0_GREEN); REQUEST_AND_SET_GPIO(GPIO_LED0_GREEN);
}
REQUEST_AND_SET_GPIO(GPIO_LED1_RED); REQUEST_AND_SET_GPIO(GPIO_LED1_RED);
REQUEST_AND_SET_GPIO(GPIO_LED1_GREEN); REQUEST_AND_SET_GPIO(GPIO_LED1_GREEN);
} }
@ -255,12 +221,7 @@ static void init_leds(void)
static void set_status_led(int red, int green) static void set_status_led(int red, int green)
{ {
gpio_set_value(GPIO_LED0_RED, red); gpio_set_value(GPIO_LED0_RED, red);
if (is_v32_or_newer()) {
gpio_set_value(GPIO_LED0_GREEN_V32, green);
}
else {
gpio_set_value(GPIO_LED0_GREEN, green); gpio_set_value(GPIO_LED0_GREEN, green);
}
} }
static void set_indicator_led(int red, int green) static void set_indicator_led(int red, int green)
@ -454,24 +415,25 @@ static void pmic_disable_auto_mode(void)
} }
} }
static void pmic_gnss_pwr_sequence(void) static void pmic_ignition_gate_on(void)
{ {
int rc;
uint8_t val; uint8_t val;
/* /* Configure GPIO15 to permanent high, so that ignition sense signal is readable */
* GNSS 3.3V needs to start at same time as board 3.3V.
* Modify LDO6 configuration accordingly if not already done.
*/
rc = da9063_get_reg(PMIC_REG_ID_6_5, &val);
if (!rc && (val != 0x20)) {
(void)da9063_set_reg(PMIC_REG_ID_6_5, 0x20); /* Add LDO6 to sequencer, slot 2 */
(void)da9063_set_reg(PMIC_REG_CONFIG_G, 0x64); /* LDO6 automatic enable control by sequencer */
}
/* Enable +3V3_GNSS (LDO6) */ (void)da9063_set_reg(PMIC_REG_GPIO14_15, 0xCC); /* GPIO14/15 = Outputs open drain */
(void)da9063_set_reg(PMIC_REG_LDO6_CONT, PMIC_LDOx_EN_MASK);
mdelay(2); (void)da9063_get_reg(PMIC_REG_CONFIG_L, &val); /* Enable pull ups on GPIO14/15 */
val |= 0xC0;
(void)da9063_set_reg(PMIC_REG_CONFIG_L, val);
(void)da9063_get_reg(PMIC_REG_CONTROL_D, &val); /* No blinking, state selected by GPIOxx_MODE */
val &= ~0xF8;
(void)da9063_set_reg(PMIC_REG_CONTROL_D, val);
(void)da9063_get_reg(PMIC_REG_GPIO_MODE8_15, &val); /* Set to GPIO14,15 to high */
val |= 0xC0;
(void)da9063_set_reg(PMIC_REG_GPIO_MODE8_15, val);
} }
static void init_pmic_spl(void) static void init_pmic_spl(void)
@ -491,12 +453,16 @@ static void init_pmic_spl(void)
pmic_disable_auto_mode(); pmic_disable_auto_mode();
} }
pmic_gnss_pwr_sequence(); /* Enable +3V3_GNSS (LDO6) */
(void)da9063_set_reg(PMIC_REG_LDO6_CONT, PMIC_LDOx_EN_MASK);
mdelay(2);
/* Enable +5V_CAN (LDO11 Switch) */ /* Enable +5V_CAN (LDO11 Switch) */
(void)da9063_set_reg(PMIC_REG_LDO11_CONT, PMIC_LDOx_EN_MASK); (void)da9063_set_reg(PMIC_REG_LDO11_CONT, PMIC_LDOx_EN_MASK);
mdelay(2); mdelay(2);
pmic_ignition_gate_on();
if (hw_type == 21) { if (hw_type == 21) {
/* hw21: trim RTC to compensate +18ppm crystal deviation */ /* hw21: trim RTC to compensate +18ppm crystal deviation */
(void)da9063_set_reg(PMIC_REG_TRIM_CLDR, (-18*10)/19); (void)da9063_set_reg(PMIC_REG_TRIM_CLDR, (-18*10)/19);
@ -506,317 +472,76 @@ static void init_pmic_spl(void)
(void)da9063_set_reg(PMIC_REG_TRIM_CLDR, 0); (void)da9063_set_reg(PMIC_REG_TRIM_CLDR, 0);
} }
/* Mask unwanted IRQs to avoid accidental wakeup */
const uint8_t mask_a = PMIC_REG_EVENT_ONKEY_MASK |
PMIC_REG_EVENT_RTC_ALARM_MASK |
PMIC_REG_EVENT_RTC_TICK_MASK;
(void)da9063_set_reg(PMIC_REG_IRQ_MASK_A, ~(mask_a) & 0x1F);
(void)da9063_set_reg(PMIC_REG_IRQ_MASK_B, ~PMIC_REG_EVENT_COMP1V2_MASK);
(void)da9063_set_reg(PMIC_REG_IRQ_MASK_C, ~0x00);
(void)da9063_set_reg(PMIC_REG_IRQ_MASK_D, ~0x00);
da9063_release_i2c_bus(bus); da9063_release_i2c_bus(bus);
} }
static void check_reset_reason(unsigned int reset_reason_shm_location) struct reset_registers {
uint32_t value;
uint32_t value_crc;
};
#ifdef CONFIG_NRSW_BUILD
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; volatile struct reset_registers* reset_regs = (struct reset_registers*)reset_reason_shm_location;
uint32_t start_reason = 0;
uint32_t reset_reason = 0;
uint32_t cpu_reset_reason = 0;
uint8_t state = 0x00; uint8_t state = 0x00;
int bus; int bus;
int ret; int ret;
char strbuf[256];
bus = da9063_claim_i2c_bus(); bus = da9063_claim_i2c_bus();
/*
* Check/write boot marker to PMIC register GP_ID_1
* If this marker is not present, we have a power on reset
*/
ret = da9063_get_reg(PMIC_GP_ID_1, &state);
if ((ret == 0) && (state != 0xC5)) {
(void)da9063_set_reg(PMIC_GP_ID_1, 0xC5);
start_reason |= SR_POR;
}
/*
* Check Fault Log register for
* - Power On Reset: No Power, RTC Delivery -> requires removal of RTC battery
* - Watchdog
*/
ret = da9063_get_reg(PMIC_REG_FAULT_LOG, &state); ret = da9063_get_reg(PMIC_REG_FAULT_LOG, &state);
if ((ret == 0) && (state != 0)) { if ((ret == 0) && (state != 0)) {
/* clear pmic fault log by writing back all bits currently set */
(void)da9063_set_reg(PMIC_REG_FAULT_LOG, state);
/* PMIC Power On Reset (only when RTC battery is removed) */
if (state & PMIC_FAULT_POR_MASK) {
start_reason |= SR_POR;
}
/* PMIC Watchdog */
if (state & PMIC_FAULT_TWD_ERROR_MASK) { if (state & PMIC_FAULT_TWD_ERROR_MASK) {
start_reason |= SR_WATCHDOG; 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 */
* Check CPU reset reason register as the device can be reset da9063_set_reg(PMIC_REG_FAULT_LOG, state);
* by a CPU watchdog
*/
cpu_reset_reason = readl(PRM_RSTST);
if (cpu_reset_reason & CPU_WDT1_RESET) {
start_reason |= SR_WATCHDOG;
}
/* clear the CPU reset reason register */
writel((CPU_WDT1_RESET | CPU_GLOBAL_COLD_RST | CPU_GLOBAL_WARM_SW_RST), PRM_RSTST);
/*
* Check Wakeup Events
* Event Register A holds:
* - Event B, C Activity
* - nONKEY: Button
* - RTC Alarm
* - RTC Tick
* Event Register B
* - COMP 1V2: Ignition
*/
ret = da9063_get_reg(PMIC_REG_EVENT_A, &state);
if ((ret == 0) && (state != 0)) {
(void)da9063_set_reg(PMIC_REG_EVENT_A, state);
if (state & PMIC_REG_EVENT_ONKEY_MASK) {
start_reason |= (SR_WAKEUP | SR_EVT_BUTTON);
}
if (state & PMIC_REG_EVENT_RTC_ALARM_MASK) {
start_reason |= (SR_WAKEUP | SR_EVT_RTC_ALARM);
}
if (state & PMIC_REG_EVENT_RTC_TICK_MASK) {
start_reason |= (SR_WAKEUP | SR_EVT_RTC_TICK);
}
if (state & PMIC_REG_EVENT_EVENTS_B_MASK) {
uint8_t state_b;
ret = da9063_get_reg(PMIC_REG_EVENT_B, &state_b);
if ((ret == 0) && (state_b != 0)) {
(void)da9063_set_reg(PMIC_REG_EVENT_B, state_b);
if (state_b & PMIC_REG_EVENT_COMP1V2_MASK) {
start_reason |= (SR_WAKEUP | SR_EVT_IGNITION);
}
}
}
}
/*
* Check for software reboot indicated by OS via shared memory
* - checksum valid?
* - Reason == 'REBO' or 'OOPS'
*/
if (rr_is_reset_reason_valid(reset_regs))
{
if (reset_regs->rr_value == RR_REBOOT_PATTERN) {
start_reason |= SR_REBOOT;
}
else if (reset_regs->rr_value == RR_OOPS_PATTERN) {
/* Treat kernel oops as reboot */
start_reason |= SR_REBOOT;
}
else if (reset_regs->rr_value == RR_WAKE_PATTERN) {
start_reason |= SR_WAKEUP;
}
else {
/* Unknown reset reason */
}
}
/*
* Priority decoder for start and reset reason
*/
if (start_reason & SR_WATCHDOG) {
/* Watchdog has highest priority as it also sets POR and other events */
start_reason = SR_WATCHDOG;
reset_reason = RR_EXTERNAL_WATCHDOG_PATTERN;
}
else if (start_reason & SR_POR) {
start_reason = SR_POR;
reset_reason = RR_POWEROFF_PATTERN;
}
else if (start_reason & SR_WAKEUP) {
/* Include start events when wakeup is detected */
start_reason = SR_WAKEUP | (start_reason & SR_EVT_WAKE_MASK);
reset_reason = RR_WAKE_PATTERN;
}
else if (start_reason & SR_REBOOT) {
start_reason = SR_REBOOT;
reset_reason = reset_regs->rr_value;
}
else {
/* Unknown start reason, assume reboot */
start_reason = SR_REBOOT;
reset_reason = reset_regs->rr_value;
}
sys_start_event = start_reason;
rr_set_reset_reason(reset_regs, reset_reason);
rr_set_start_reason(reset_regs, start_reason);
da9063_release_i2c_bus(bus);
rr_start_reason_to_str(reset_regs->sr_events, strbuf, sizeof(strbuf));
printf("\nStart Events: %s\n", strbuf);
}
static void pmic_ignition_gate_on(void)
{
int bus;
uint8_t val;
bus = da9063_claim_i2c_bus();
/* Configure GPIO15 to permanent high, so that ignition sense signal is readable */
(void)da9063_set_reg(PMIC_REG_GPIO14_15, 0xCC); /* GPIO14/15 = Outputs open drain */
(void)da9063_get_reg(PMIC_REG_CONFIG_L, &val); /* Enable pull ups on GPIO14/15 */
val |= 0xC0;
(void)da9063_set_reg(PMIC_REG_CONFIG_L, val);
(void)da9063_set_reg(PMIC_REG_CONTROL_D, 0x00); /* No blinking, state selected by GPIOxx_MODE */
(void)da9063_get_reg(PMIC_REG_GPIO_MODE8_15, &val); /* Set to GPIO14,15 to high */
val |= 0xC0;
(void)da9063_set_reg(PMIC_REG_GPIO_MODE8_15, val);
/*
* Comparator input is debounced (10ms), see DA9063 datasheet 5.13.5
* Give enough time to stabilize input reading.
*/
mdelay(10+10);
da9063_release_i2c_bus(bus);
}
static void powerdown(void)
{
int bus;
bus = da9063_claim_i2c_bus();
/* Final call, will not return */
(void)da9063_set_reg(PMIC_REG_CONTROL_A, 0x00);
da9063_release_i2c_bus(bus);
puts("ERROR: PMIC power down failed\n");
for (;;) {}
}
static void reset(void)
{
/* Code copied from arm v7 lib */
udelay (50000);
disable_interrupts();
reset_misc();
reset_cpu(0);
puts("ERROR: Reset failed\n");
for (;;) {}
}
static void stop_if_ignition_is_off(void)
{
uint8_t state = 0x00;
int bus;
int ret;
bus = da9063_claim_i2c_bus();
ret = da9063_get_reg(PMIC_REG_STATUS_A, &state);
if (ret == 0) {
if ((state & PMIC_REG_STATUS_A_COMP1V2_MASK) == PMIC_REG_STATUS_A_COMP1V2_MASK) {
puts("Ignition : On\n");
}
else {
puts("Ignition : Off\n");
/*
* Ignition is off, if this is a power-on start, power down
* as this is considered an unwanted system start.
*/
/*
* There is a chance for a race condition, when ignition is enabled
* between the check above and here. In this case we should just reset
* not power down.
* Although the risk is minimal here due to the very short time interval
* we do the check. The same logic will have to be added in other
* components.
*/
ret = da9063_get_reg(PMIC_REG_EVENT_B, &state);
if ((ret == 0) && ((state & PMIC_REG_EVENT_COMP1V2_MASK) == 0)) {
powerdown();
}
else {
reset();
}
}
} }
da9063_release_i2c_bus(bus); da9063_release_i2c_bus(bus);
} }
#endif
static void init_bd_spl(void) static void init_bd_spl(void)
{ {
hw_type = 21; /* Assume hw21, unless BD tells different */ hw_type = 21; /* Assume hw21, unless BD tells different */
if (read_eeprom() >= 0) { if (read_eeprom() >= 0) {
int hw_type_from_bd = -1; bd_get_hw_type(&hw_type);
bd_get_hw_version(&hw_ver, &hw_rev);
/* If entry is found returns value, otherwise 0 */
bd_get_hw_type(&hw_type_from_bd);
if (hw_type_from_bd != 0) {
hw_type = hw_type_from_bd;
}
} }
else { else {
puts("Could not get board ID.\n"); puts("Could not get board ID.\n");
} }
} }
static void power_um(void)
{
int bus;
da9063_init(CONFIG_PMIC_I2C_BUS);
bus = da9063_claim_i2c_bus();
REQUEST_AND_CLEAR_GPIO(GPIO_RST_UM_N); /* Assert reset (active low) */
REQUEST_AND_CLEAR_GPIO(GPIO_CTRL_WDIS_N);
da9063_set_gpio(PMIC_UM_SUPPLY_EN_IO, 0); /* Switch Supply off */
mdelay(30); /* Give time to discharge output */
da9063_set_gpio(PMIC_UM_SUPPLY_VSEL_IO, 0); /* Set voltage to 3.3V */
mdelay(1);
da9063_set_gpio(PMIC_UM_SUPPLY_EN_IO, 1); /* Enable Supply */
mdelay(10);
da9063_release_i2c_bus(bus);
}
void am33xx_spl_board_init(void) void am33xx_spl_board_init(void)
{ {
/* Set CPU speed to 600 MHz (fix) */ /* Set CPU speed to 600 MHz (fix) */
@ -828,40 +553,12 @@ void am33xx_spl_board_init(void)
/* Configure both I2C buses used */ /* Configure both I2C buses used */
init_i2c(); init_i2c();
/* Power on Extension/User module, so it doesn't block I2C bus */
power_um();
/* Get board descriptor */ /* Get board descriptor */
init_bd_spl(); init_bd_spl();
/* Detect reset/Wakeup reason */
check_reset_reason(RESET_REASON_SHM_LOCATION);
/* Switch on ignition gate so we can read state later */
pmic_ignition_gate_on();
/* Setup PMIC */ /* Setup PMIC */
init_pmic_spl(); init_pmic_spl();
/*
* If this is a power-on start, see if ignition is active.
* If not, power down as this is considered an unwanted system start.
*/
if (sys_start_event & SR_POR) {
stop_if_ignition_is_off();
}
if (is_v32_or_newer()) {
enable_led_mux_v32();
enable_uart4_pin_mux();
REQUEST_AND_CLEAR_GPIO(GPIO_RS485_DE);
REQUEST_AND_CLEAR_GPIO(GPIO_RS232_RS485n_SEL);
}
else {
enable_led_mux();
}
init_leds(); init_leds();
set_status_led(1, 0); /* Red */ set_status_led(1, 0); /* Red */
set_indicator_led(1, 0); /* Red */ set_indicator_led(1, 0); /* Red */
@ -880,6 +577,10 @@ void am33xx_spl_board_init(void)
/* Set MPU Frequency to what we detected now that voltages are set */ /* Set MPU Frequency to what we detected now that voltages are set */
do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100); do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
#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 */ /* Debugger can place marker at end of SRAM to stop boot here */
if (is_jtag_boot(CONFIG_JTAG_MARKER_SPL)) if (is_jtag_boot(CONFIG_JTAG_MARKER_SPL))
{ {
@ -1071,14 +772,30 @@ static void init_usb_hub(void)
static void init_user_module(void) static void init_user_module(void)
{ {
int bus;
bus = da9063_claim_i2c_bus();
puts("UM: "); puts("UM: ");
REQUEST_AND_CLEAR_GPIO(GPIO_RST_UM_N); /* Assert reset (active low) */ REQUEST_AND_CLEAR_GPIO(GPIO_RST_UM_N); /* Assert reset (active low) */
REQUEST_AND_CLEAR_GPIO(GPIO_CTRL_WDIS_N); REQUEST_AND_CLEAR_GPIO(GPIO_CTRL_WDIS_N) /* TODO: CHECK */
/* TODO: Should this be done at first power up as well? */
da9063_set_gpio(PMIC_UM_SUPPLY_EN_IO, 0); /* Switch Supply off */
mdelay(30); /* Give time to discharge output */
da9063_set_gpio(PMIC_UM_SUPPLY_VSEL_IO, 0); /* Set voltage to 3.3V */
mdelay(1);
da9063_set_gpio(PMIC_UM_SUPPLY_EN_IO, 1); /* Enable Supply */
mdelay(10);
gpio_direction_input(GPIO_RST_UM_N); /* Release reset (open drain) */ gpio_direction_input(GPIO_RST_UM_N); /* Release reset (open drain) */
mdelay(10); mdelay(10);
da9063_release_i2c_bus(bus);
mdelay(200); /* Give module some time to boot */ mdelay(200); /* Give module some time to boot */
um_init(CONFIG_UM_I2C_BUS); /* Try to detect user module */ um_init(CONFIG_UM_I2C_BUS); /* Try to detect user module */
@ -1176,33 +893,12 @@ static void init_gsm(void)
#endif #endif
} }
static void init_gnss(uint32_t reset_reason_shm_location) static void init_gnss(void)
{ {
volatile struct reset_registers* reset_regs = (struct reset_registers*)reset_reason_shm_location;
bool do_reset = false;
/* /*
* Release GNSS reset line, so that module starts up early. * Release GNSS reset line, so that module starts up early
* Excpetion: If this is an initial power up, we reset the module to ensure defined operation.
* Reasoning: Some NEO-M9 modems start in Safe Boot mode, due to power sequencing.
*/ */
puts("GNSS: ");
if (rr_is_start_reason_valid(reset_regs)) {
if ((reset_regs->sr_events & SR_POR) == SR_POR) {
do_reset = true;
}
}
if (do_reset) {
puts("reset\n");
REQUEST_AND_CLEAR_GPIO(GPIO_RST_GNSS);
mdelay(110);
gpio_set_value(GPIO_RST_GNSS, 1);
} else {
puts("init\n");
REQUEST_AND_SET_GPIO(GPIO_RST_GNSS); REQUEST_AND_SET_GPIO(GPIO_RST_GNSS);
}
} }
static void init_timepulse(void) static void init_timepulse(void)
@ -1246,6 +942,16 @@ int board_init(void)
ui_init(CONFIG_UI_I2C_BUS); ui_init(CONFIG_UI_I2C_BUS);
#endif #endif
/* Let user know we're starting */
init_leds();
set_status_led(1, 1); /* Orange */
set_indicator_led(0, 0); /* Off */
#ifndef CONFIG_NRSW_BUILD
ui_set_status_led(1, 1); /* Orange */
ui_set_indicator_led(0, 0); /* Off */
#endif
printf("OSC: %lu MHz\n", get_osclk()/1000000); printf("OSC: %lu MHz\n", get_osclk()/1000000);
return 0; return 0;
@ -1529,6 +1235,9 @@ static int check_button(int time, bool button)
state = INIT; state = INIT;
} }
/* TODO: Remove printf, puts */
/* printf("button: state %d button %d -> ", state, button); */
switch (state) { switch (state) {
case INIT: case INIT:
if (button) { if (button) {
@ -1584,6 +1293,8 @@ static int check_button(int time, bool button)
break; break;
} }
/* printf("act %d\n", act); */
return act; return act;
} }
@ -1615,6 +1326,9 @@ static int check_break_length(int time, bool rx_line)
wait_time = BREAK_DEB_TIME; wait_time = BREAK_DEB_TIME;
} }
/* TODO: Remove */
/* printf("break length: state %d have_break_cond %d duration %d -> ", state, have_break_cond, duration); */
switch (state) { switch (state) {
case WAIT_BREAK: case WAIT_BREAK:
if (rx_line) { if (rx_line) {
@ -1684,6 +1398,8 @@ static int check_break_length(int time, bool rx_line)
break; break;
} }
/* printf("act %d\n", act); */
return act; return act;
} }
@ -1715,6 +1431,9 @@ static int check_break_command(int time, int has_input, int c)
static int wait_time; static int wait_time;
/* TODO: remove */
/* printf("break command: state %d, input %d %02x -> ", state, has_input, c); */
if (time == 0) { if (time == 0) {
state = WAIT_BREAK; state = WAIT_BREAK;
wait_time = BREAK_WAIT_TIME; wait_time = BREAK_WAIT_TIME;
@ -1783,11 +1502,13 @@ static int check_break_command(int time, int has_input, int c)
break; break;
} }
/* printf("act %d\n", act); */
return act; return act;
} }
static void check_reset_button(void) static void check_reset_button(void)
{ {
/* /*
* Runs state machines of all reset sources to find out if one detects * Runs state machines of all reset sources to find out if one detects
* an action. * an action.
@ -1816,16 +1537,12 @@ static void check_reset_button(void)
} }
/* run processing state machines */ /* run processing state machines */
a_[0] = check_button(counter, button); a_[0] = NONE;
if (hw_type == 26) {
/* break function are only present on hw26 */
a_[1] = check_break_length(counter, rx_line);
a_[2] = check_break_command(counter, has_input, c);
}
else {
a_[1] = NONE; a_[1] = NONE;
a_[2] = NONE; a_[2] = NONE;
} a_[0] = check_button(counter, button);
a_[1] = check_break_length(counter, rx_line);
a_[2] = check_break_command(counter, has_input, c);
/* if all SMs are sure there is not action, stop here */ /* if all SMs are sure there is not action, stop here */
if ((a_[0] == NONE) && (a_[1] == NONE) && (a_[2] == NONE)) { if ((a_[0] == NONE) && (a_[1] == NONE) && (a_[2] == NONE)) {
@ -1889,16 +1606,6 @@ int board_late_init(void)
get_hw_version(); get_hw_version();
get_pmic_version(); get_pmic_version();
/* Let user know we're starting */
init_leds();
set_status_led(1, 1); /* Orange */
set_indicator_led(0, 0); /* Off */
#ifndef CONFIG_NRSW_BUILD
ui_set_status_led(1, 1); /* Orange */
ui_set_indicator_led(0, 0); /* Off */
#endif
#ifdef CONFIG_NRSW_BUILD #ifdef CONFIG_NRSW_BUILD
set_root_partition(); set_root_partition();
set_devicetree_name(); set_devicetree_name();
@ -1958,7 +1665,7 @@ int board_late_init(void)
#endif #endif
init_sim_mux(); init_sim_mux();
init_gsm(); init_gsm();
init_gnss(RESET_REASON_SHM_LOCATION); init_gnss();
init_timepulse(); init_timepulse();
/* /*
@ -2145,85 +1852,6 @@ int board_fit_config_name_match(const char *name)
#if defined(CONFIG_OF_BOARD_SETUP) && !defined(CONFIG_SPL_BUILD) #if defined(CONFIG_OF_BOARD_SETUP) && !defined(CONFIG_SPL_BUILD)
static void ft_enable_node(void* blob, const char* name)
{
int node_ofs = -1;
node_ofs = fdt_path_offset(blob, name);
// printf("ft_enable_node %s -> %d\n", name, node_ofs);
if (node_ofs >= 0) {
fdt_setprop_string(blob, node_ofs, "status", "okay");
}
}
static void ft_disable_node(void* blob, const char* name)
{
int node_ofs = -1;
node_ofs = fdt_path_offset(blob, name);
// printf("ft_disable_node %s -> %d\n", name, node_ofs);
if (node_ofs >= 0) {
fdt_setprop_string(blob, node_ofs, "status", "disabled");
}
}
/*
* 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 < 0) {
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: ;
}
static void ft_bootloader_version(void *blob) static void ft_bootloader_version(void *blob)
{ {
int node_offset; int node_offset;
@ -2238,17 +1866,14 @@ static void ft_bootloader_version(void *blob)
static void ft_hw_info(void *blob) static void ft_hw_info(void *blob)
{ {
int node_offset; int node_offset;
char hw_version_str[16]; char hw_version[16];
char hw_type_str[8];
snprintf(hw_version_str, sizeof(hw_version_str), "%d.%d.%d", hw_ver, hw_rev, hw_patch); snprintf(hw_version, sizeof(hw_version), "%d.%d.%d", hw_ver, hw_rev, hw_patch);
snprintf(hw_type_str, sizeof(hw_type_str), "%d", hw_type);
node_offset = fdt_path_offset(blob, "/"); node_offset = fdt_path_offset(blob, "/");
if (node_offset != -1) { if (node_offset != -1) {
fdt_setprop_string(blob, node_offset, "model", hw_variant_name); fdt_setprop_string(blob, node_offset, "model", hw_variant_name);
fdt_setprop_string(blob, node_offset, "nm,carrierboard,version", hw_version_str); fdt_setprop_string(blob, node_offset, "nm,carrierboard,version", hw_version);
fdt_setprop_string(blob, node_offset, "nm,carrierboard,type", hw_type_str);
} }
} }
@ -2293,7 +1918,7 @@ static void ft_user_interface(void *blob)
if (ui_hw_version == 1) { if (ui_hw_version == 1) {
int node_offset; int node_offset;
node_offset = fdt_path_offset(blob, "ui_v1"); node_offset = fdt_path_offset(blob, "/ocp/i2c@4802a000/pca9539@74/");
if (node_offset != -1) { if (node_offset != -1) {
fdt_setprop_string(blob, node_offset, "status", "okay"); fdt_setprop_string(blob, node_offset, "status", "okay");
} }
@ -2318,7 +1943,7 @@ static void ft_user_interface(void *blob)
else if (ui_hw_version == 2) { else if (ui_hw_version == 2) {
int node_offset; int node_offset;
node_offset = fdt_path_offset(blob, "ui_v2"); node_offset = fdt_path_offset(blob, "/ocp/i2c@4802a000/pca9538@70/");
if (node_offset != -1) { if (node_offset != -1) {
fdt_setprop_string(blob, node_offset, "status", "okay"); fdt_setprop_string(blob, node_offset, "status", "okay");
} }
@ -2345,21 +1970,6 @@ static void ft_user_interface(void *blob)
} }
} }
static void ft_start_event(void *blob, uint32_t reset_reason_shm_location)
{
volatile struct reset_registers* reset_regs = (struct reset_registers*)reset_reason_shm_location;
if (rr_is_start_reason_valid(reset_regs)) {
int node_offset;
node_offset = fdt_path_offset(blob, "/sysstate-start/");
if (node_offset != -1) {
fdt_setprop_u32(blob, node_offset, "start-reason", reset_regs->sr_events);
}
}
}
#endif #endif
static void ft_eth(void *blob) static void ft_eth(void *blob)
@ -2376,13 +1986,13 @@ static void ft_eth(void *blob)
if (hw_ver == 1) { if (hw_ver == 1) {
int node_offset; int node_offset;
node_offset = fdt_path_offset(blob, "broadr1"); node_offset = fdt_path_offset(blob, "/ocp/ethernet@4a100000/mdio@4a101000/ethernet-phy@2/");
if (node_offset != -1) { if (node_offset != -1) {
fdt_setprop_u32(blob, node_offset, "<reg>", 7); fdt_setprop_u32(blob, node_offset, "<reg>", 7);
fdt_setprop_u32(blob, node_offset, "reg", 7); fdt_setprop_u32(blob, node_offset, "reg", 7);
} }
node_offset = fdt_path_offset(blob, "broadr0"); node_offset = fdt_path_offset(blob, "/ocp/ethernet@4a100000/mdio@4a101000/ethernet-phy@3/");
if (node_offset != -1) { if (node_offset != -1) {
fdt_setprop_u32(blob, node_offset, "<reg>", 6); fdt_setprop_u32(blob, node_offset, "<reg>", 6);
fdt_setprop_u32(blob, node_offset, "reg", 6); fdt_setprop_u32(blob, node_offset, "reg", 6);
@ -2390,35 +2000,6 @@ static void ft_eth(void *blob)
} }
} }
static void ft_uart4(void *blob)
{
/*
* V3.2 HW can feature uart4 as RS232/485 interface.
* TODO: Check product descriptor to see if interface is assembled?
*/
if (is_v32_or_newer()) {
ft_enable_node(blob, "serial4");
}
else {
/* If interface is not present, remove SEL_RS232_RS485n name from gpio0_8 */
ft_set_gpio_name(blob, "gpio0", 8, "");
}
}
static void ft_led(void *blob)
{
/*
* V3.2 HW has LED0 Green at GPIO1_23 instead of 0_30
* Link from SysState-LED Driver also needs to be adapted
*/
if (is_v32_or_newer()) {
ft_disable_node(blob, "status_led");
ft_disable_node(blob, "/sysstate-led");
ft_enable_node(blob, "status_led_v32");
ft_enable_node(blob, "/sysstate-led-v32");
}
}
int ft_board_setup(void *blob, bd_t *bd) int ft_board_setup(void *blob, bd_t *bd)
{ {
ft_bootloader_version(blob); ft_bootloader_version(blob);
@ -2428,9 +2009,6 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_user_module(blob); ft_user_module(blob);
#endif #endif
ft_eth(blob); ft_eth(blob);
ft_uart4(blob);
ft_led(blob);
ft_start_event(blob, RESET_REASON_SHM_LOCATION);
return 0; return 0;
} }

View File

@ -13,10 +13,8 @@
void enable_uart0_pin_mux(void); void enable_uart0_pin_mux(void);
void enable_uart2_pin_mux(void); void enable_uart2_pin_mux(void);
void enable_uart4_pin_mux(void);
void enable_spi1_mux(void); void enable_spi1_mux(void);
void enable_led_mux(void);
void enable_led_mux_v32(void);
void enable_board_pin_mux(void); void enable_board_pin_mux(void);
#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio)) #define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))

View File

@ -23,22 +23,24 @@
static struct module_pin_mux gpio_pin_mux[] = { 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) * (J18) GPIO0_16: ETH_SW_RST~ (V2.0)
* (K15) GPIO0_17: CTRL.INT~ * (K15) GPIO0_17: CTRL.INT~
* (T10) GPIO0_23: CAN_TERM1~ (V1.0) * (T10) GPIO0_23: CAN_TERM1~ (V1.0)
* (T17) GPIO0_30: LED0.GN
* *
* (T12) GPIO1_12: SIM_SW * (T12) GPIO1_12: SIM_SW
* (V13) GPIO1_14: GNSS_RST~ * (V13) GPIO1_14: GNSS_RST~
* (U13) GPIO1_15: CAN_TERM0~ (V1.0) * (U13) GPIO1_15: CAN_TERM0~ (V1.0)
* (R14) GPIO1_20: BT_EN * (R14) GPIO1_20: BT_EN
* (V15) GPIO1_21: GSM_PWR_EN * (V15) GPIO1_21: GSM_PWR_EN
* (U15) GPIO1_22: LED1.RD
* (V16) GPIO1_24: LED1.GN
* (U16) GPIO1_25: RST_GSM * (U16) GPIO1_25: RST_GSM
* (T16) GPIO1_26: WLAN_EN * (T16) GPIO1_26: WLAN_EN
* (V17) GPIO1_27: WLAN_IRQ * (V17) GPIO1_27: WLAN_IRQ
* (U18) GPIO1_28: LED0.RD
* *
* (U3) GPIO2_16: TIMEPULSE (HW26), see note [1] * (U3) GPIO2_16: TIMEPULSE (HW26)
* (R6) GPIO2_25: RST_ETH~ * (R6) GPIO2_25: RST_ETH~
* *
* (J17) GPIO3_4: GNSS_EXTINT * (J17) GPIO3_4: GNSS_EXTINT
@ -46,31 +48,47 @@ static struct module_pin_mux gpio_pin_mux[] = {
* (L18) GPIO3_10: CTRL.RST * (L18) GPIO3_10: CTRL.RST
* (C12) GPIO3_17: UI_RST~ * (C12) GPIO3_17: UI_RST~
* (A14) GPIO3_21: RST_HUB~ (USB) * (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 */ /* Bank 0 */
{OFFSET(mii1_txd3), (MODE(7) | PULLUDDIS)}, /* (J18) GPIO0_16: ETH_SW_RST~ (V2.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(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_ad9), (MODE(7) | PULLUDDIS)}, /* (T10) GPIO0_23: CAN_TERM1~ */
{OFFSET(gpmc_wait0), (MODE(7) | PULLUDDIS)}, /* (T17) GPIO0_30: LED0.GN */
/* Bank 1 */ /* Bank 1 */
{OFFSET(gpmc_ad12), (MODE(7) | PULLUDEN | PULLUP_EN)}, /* (T12) GPIO1_12: SIM_SW */ {OFFSET(gpmc_ad12), (MODE(7) | PULLUDDIS)}, /* (T12) GPIO1_12: SIM_SW */
{OFFSET(gpmc_ad14), (MODE(7) | PULLUDDIS)}, /* (V13) GPIO1_14: GNSS_RST~ */ {OFFSET(gpmc_ad14), (MODE(7) | PULLUDDIS)}, /* (V13) GPIO1_14: GNSS_RST~ */
{OFFSET(gpmc_ad15), (MODE(7) | PULLUDDIS)}, /* (U13) GPIO1_15: CAN_TERM0~ */ {OFFSET(gpmc_ad15), (MODE(7) | PULLUDDIS)}, /* (U13) GPIO1_15: CAN_TERM0~ */
{OFFSET(gpmc_a4), (MODE(7) | PULLUDDIS)}, /* (R14) gpio1_20: BT_EN */ {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_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_a9), (MODE(7) | PULLUDDIS)}, /* (U16) gpio1_25: RST_GSM */
{OFFSET(gpmc_a10), (MODE(7) | PULLUDDIS)}, /* (T16) gpio1_26: WLAN_EN */ {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_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 */ /* Bank 2 */
{OFFSET(lcd_data10), (MODE(7) | PULLUDDIS | RXACTIVE)}, /* (U3) GPIO2_16: TIMEPULSE */ {OFFSET(lcd_data10), (MODE(7) | PULLUDEN | PULLDOWN_EN | RXACTIVE)}, /* (U3) GPIO2_16: TIMEPULSE input */
{OFFSET(lcd_ac_bias_en), (MODE(7) | PULLUDDIS)}, /* (R6) GPIO2_25: RST_ETH~ */ {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 */ /* Bank 3 */
{OFFSET(mii1_rxdv), (MODE(7) | PULLUDDIS)}, /* (J17) GPIO3_4: GNSS_EXTINT */ {OFFSET(mii1_rxdv), (MODE(7) | PULLUDDIS)}, /* (J17) GPIO3_4: GNSS_EXTINT */
{OFFSET(mii1_txclk), (MODE(7) | PULLUDDIS)}, /* (K18) GPIO3_9: CTRL.W_DIS */ {OFFSET(mii1_txclk), (MODE(7) | PULLUDDIS)}, /* (K18) GPIO3_9: CTRL.W_DIS */
@ -80,39 +98,6 @@ static struct module_pin_mux gpio_pin_mux[] = {
{-1} {-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 */ /* I2C0 PMIC */
static struct module_pin_mux i2c0_pin_mux[] = { static struct module_pin_mux i2c0_pin_mux[] = {
{OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (C17) I2C0_SDA */ {OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | PULLUP_EN | SLEWCTRL)}, /* (C17) I2C0_SDA */
@ -218,22 +203,8 @@ static struct module_pin_mux uart2_pin_mux[] = {
/* UART3: GNSS */ /* UART3: GNSS */
static struct module_pin_mux uart3_pin_mux[] = { static struct module_pin_mux uart3_pin_mux[] = {
{OFFSET(mii1_rxd3), (MODE(1) | PULLUDDIS | RXACTIVE)}, /* (L17) UART3_RXD */ {OFFSET(mii1_rxd3), (MODE(1) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* (L17) UART3_RXD */
{OFFSET(mii1_rxd2), (MODE(1) | PULLUDDIS | SLEWCTRL)}, /* (L16) UART3_TXD */ {OFFSET(mii1_rxd2), (MODE(1) | PULLUDEN | PULLUP_EN | 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} {-1}
}; };
@ -297,22 +268,7 @@ void enable_uart2_pin_mux(void)
configure_module_pin_mux(uart2_pin_mux); 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) void enable_spi1_mux(void)
{ {
configure_module_pin_mux(spi1_pin_mux); 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);
}

View File

@ -1,81 +0,0 @@
/*
* 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;
}
}

View File

@ -1,60 +0,0 @@
/*
* 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 */

View File

@ -1330,10 +1330,10 @@ end: ;
static void ft_comio_gpios(void *blob) static void ft_comio_gpios(void *blob)
{ {
/* gpio0_7: COM/IO relay output */ /* gpio0_7: COM/IO relay output */
ft_set_gpio_name(blob, "gpio0", 7, "COMIO_OUT0"); ft_set_gpio_name(blob, "/ocp/gpio@44e07000", 7, "COMIO_OUT0");
/* gpio1_8: COM/IO digital input */ /* gpio1_8: COM/IO digital input */
ft_set_gpio_name(blob, "gpio1", 8, "COMIO_IN0"); ft_set_gpio_name(blob, "/ocp/gpio@4804c000", 8, "COMIO_IN0");
} }
static void ft_shields(void* blob) static void ft_shields(void* blob)
@ -1345,13 +1345,15 @@ static void ft_shields(void* blob)
case SHIELD_COM_IO: case SHIELD_COM_IO:
ft_comio_gpios(blob); ft_comio_gpios(blob);
ft_enable_node(blob, "/netbox_dio_comio"); ft_enable_node(blob, "/netbox_dio_comio");
ft_enable_node(blob, "serial0"); /* TODO: Should use alias serial0 */
ft_enable_node(blob, "/ocp/serial@44e09000");
break; break;
case SHIELD_DUALCAN: case SHIELD_DUALCAN:
case SHIELD_DUALCAN_PASSIVE: case SHIELD_DUALCAN_PASSIVE:
ft_enable_node(blob, "d-can0"); /* TODO: Should use alias d_can0, d_can1 */
ft_enable_node(blob, "d-can1"); ft_enable_node(blob, "/ocp/can@481cc000");
ft_enable_node(blob, "/ocp/can@481d0000");
break; break;
default: default:

View File

@ -1242,10 +1242,10 @@ end: ;
static void ft_comio_gpios(void *blob) static void ft_comio_gpios(void *blob)
{ {
/* gpio0_7: COM/IO relay output */ /* gpio0_7: COM/IO relay output */
ft_set_gpio_name(blob, "gpio0", 7, "COMIO_OUT0"); ft_set_gpio_name(blob, "/ocp/gpio@44e07000", 7, "COMIO_OUT0");
/* gpio1_8: COM/IO digital input */ /* gpio1_8: COM/IO digital input */
ft_set_gpio_name(blob, "gpio1", 8, "COMIO_IN0"); ft_set_gpio_name(blob, "/ocp/gpio@4804c000", 8, "COMIO_IN0");
} }
static void ft_shields(void* blob) static void ft_shields(void* blob)
@ -1257,13 +1257,15 @@ static void ft_shields(void* blob)
case SHIELD_COM_IO: case SHIELD_COM_IO:
ft_comio_gpios(blob); ft_comio_gpios(blob);
ft_enable_node(blob, "/netbox_dio_comio"); ft_enable_node(blob, "/netbox_dio_comio");
ft_enable_node(blob, "serial0"); /* TODO: Should use alias serial0 */
ft_enable_node(blob, "/ocp/serial@44e09000");
break; break;
case SHIELD_DUALCAN: case SHIELD_DUALCAN:
case SHIELD_DUALCAN_PASSIVE: case SHIELD_DUALCAN_PASSIVE:
ft_enable_node(blob, "d-can0"); /* TODO: Should use alias d_can0, d_can1 */
ft_enable_node(blob, "d-can1"); ft_enable_node(blob, "/ocp/can@481cc000");
ft_enable_node(blob, "/ocp/can@481d0000");
break; break;
default: default:
@ -1271,7 +1273,7 @@ static void ft_shields(void* blob)
* Enable uart1 (ttyS0) always as kernel needs it as fallback console, * Enable uart1 (ttyS0) always as kernel needs it as fallback console,
* if (ttyS1) is not available as console. * if (ttyS1) is not available as console.
*/ */
ft_enable_node(blob, "serial0"); ft_enable_node(blob, "/ocp/serial@44e09000");
break; break;
}; };

View File

@ -1,49 +0,0 @@
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

View File

@ -738,7 +738,7 @@ U_BOOT_I2C_ADAP_COMPLETE(omap24_1, omap24_i2c_init, omap24_i2c_probe,
#endif #endif
U_BOOT_I2C_ADAP_COMPLETE(omap24_2, omap24_i2c_init, omap24_i2c_probe, U_BOOT_I2C_ADAP_COMPLETE(omap24_2, omap24_i2c_init, omap24_i2c_probe,
omap24_i2c_read, omap24_i2c_write, omap24_i2c_setspeed, omap24_i2c_read, omap24_i2c_write, NULL,
CONFIG_SYS_OMAP24_I2C_SPEED2, CONFIG_SYS_OMAP24_I2C_SPEED2,
CONFIG_SYS_OMAP24_I2C_SLAVE2, CONFIG_SYS_OMAP24_I2C_SLAVE2,
2) 2)
@ -751,7 +751,7 @@ U_BOOT_I2C_ADAP_COMPLETE(omap24_2, omap24_i2c_init, omap24_i2c_probe,
#endif #endif
U_BOOT_I2C_ADAP_COMPLETE(omap24_3, omap24_i2c_init, omap24_i2c_probe, U_BOOT_I2C_ADAP_COMPLETE(omap24_3, omap24_i2c_init, omap24_i2c_probe,
omap24_i2c_read, omap24_i2c_write, omap24_i2c_setspeed, omap24_i2c_read, omap24_i2c_write, NULL,
CONFIG_SYS_OMAP24_I2C_SPEED3, CONFIG_SYS_OMAP24_I2C_SPEED3,
CONFIG_SYS_OMAP24_I2C_SLAVE3, CONFIG_SYS_OMAP24_I2C_SLAVE3,
3) 3)
@ -764,7 +764,7 @@ U_BOOT_I2C_ADAP_COMPLETE(omap24_3, omap24_i2c_init, omap24_i2c_probe,
#endif #endif
U_BOOT_I2C_ADAP_COMPLETE(omap24_4, omap24_i2c_init, omap24_i2c_probe, U_BOOT_I2C_ADAP_COMPLETE(omap24_4, omap24_i2c_init, omap24_i2c_probe,
omap24_i2c_read, omap24_i2c_write, omap24_i2c_setspeed, omap24_i2c_read, omap24_i2c_write, NULL,
CONFIG_SYS_OMAP24_I2C_SPEED4, CONFIG_SYS_OMAP24_I2C_SPEED4,
CONFIG_SYS_OMAP24_I2C_SLAVE4, CONFIG_SYS_OMAP24_I2C_SLAVE4,
4) 4)

View File

@ -1,320 +0,0 @@
/*
* 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 */

View File

@ -298,8 +298,11 @@ int eth_phy_timeout(void);
#define CONFIG_JTAG_MARKER_SPL 0x402FFF00 #define CONFIG_JTAG_MARKER_SPL 0x402FFF00
#define CONFIG_JTAG_MARKER_UBOOT 0x807FFF00 #define CONFIG_JTAG_MARKER_UBOOT 0x807FFF00
/* Reset and Start Reason */ /* NRSW PMIC Reset Reason */
#ifdef CONFIG_NRSW_BUILD
#define RESET_REASON_SHM_LOCATION 0x8e000000 #define RESET_REASON_SHM_LOCATION 0x8e000000
#define EXTERNAL_WATCHDOG_PATTERN 0x781f9ce2
#endif
/* SPL command is not needed */ /* SPL command is not needed */