sysmobts_v1: Add sysmobts_v1 changes to the UBL code.
This commit is contained in:
parent
4b779cf0d2
commit
d92d124eea
54
Makefile
54
Makefile
|
@ -15,63 +15,29 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
ifndef CROSS_COMPILE
|
||||
CROSS_COMPILE=arm-linux-
|
||||
endif
|
||||
CROSS_COMPILE=arm-none-linux-gnueabi-
|
||||
|
||||
.PHONY : clean check
|
||||
|
||||
CC=$(CROSS_COMPILE)gcc
|
||||
LD=$(CROSS_COMPILE)ld
|
||||
|
||||
CFLAGS := -c -Os -Wall
|
||||
CFLAGS := -c -Os -Wall -mabi=aapcs-linux
|
||||
LDFLAGS := -Map ubl.map -nostdlib
|
||||
|
||||
SOURCES := davinci.c uart.c uartboot.c ubl.c util.c gpio.c crc.c gunzip.c
|
||||
|
||||
# Boards setup
|
||||
ifeq ($(BOARD),dvevm)
|
||||
# EVM for DM6446
|
||||
PLATFORM := DM644x
|
||||
FLASH_TYPE := FLASH_TYPE_NAND
|
||||
DDR_TYPE := MICRON_MT47H64M16BT_3_162MHZ
|
||||
DDR_SIZE := 0x10000000 # 256MB
|
||||
endif
|
||||
ifeq ($(BOARD),sffsdr)
|
||||
ifeq ($(BOARD),sysmobts_v1)
|
||||
PLATFORM := DM644x
|
||||
FLASH_TYPE := FLASH_TYPE_NAND
|
||||
DDR_TYPE := MICRON_MT47H32M16BN_3_162MHZ
|
||||
DDR_SIZE := 0x08000000 # 128MB
|
||||
endif
|
||||
ifeq ($(BOARD),das)
|
||||
ifeq ($(BOARD),sffsdr)
|
||||
PLATFORM := DM644x
|
||||
FLASH_TYPE := FLASH_TYPE_NAND
|
||||
DDR_TYPE := MICRON_MT47H64M16HR_3_162MHZ
|
||||
DDR_SIZE := 0x10000000 # 256MB
|
||||
endif
|
||||
ifeq ($(BOARD),minidas)
|
||||
PLATFORM := DM35x
|
||||
FLASH_TYPE := FLASH_TYPE_NAND
|
||||
DDR_TYPE := MICRON_MT47H128M16HG_3IT_171MHZ
|
||||
DDR_SIZE := 0x10000000 # 256MB
|
||||
endif
|
||||
ifeq ($(BOARD),afeusb)
|
||||
PLATFORM := DM35x
|
||||
FLASH_TYPE := FLASH_TYPE_NAND
|
||||
DDR_TYPE := MICRON_MT47H32M16BN_3_171MHZ
|
||||
DDR_SIZE := 0x04000000 # 64MB
|
||||
endif
|
||||
ifeq ($(BOARD),dm355evm)
|
||||
PLATFORM := DM35x
|
||||
FLASH_TYPE := FLASH_TYPE_NAND
|
||||
DDR_TYPE := MICRON_MT47H64M16BT_37E_171MHZ
|
||||
DDR_SIZE := 0x08000000 # 128MB
|
||||
endif
|
||||
ifeq ($(BOARD),nor)
|
||||
# Only for testing NOR flash compilation
|
||||
PLATFORM := DM35x
|
||||
FLASH_TYPE := FLASH_TYPE_NOR
|
||||
DDR_TYPE := MICRON_MT47H64M16BT_37E_171MHZ
|
||||
DDR_TYPE := MICRON_MT47H32M16BN_3_162MHZ
|
||||
DDR_SIZE := 0x08000000 # 128MB
|
||||
endif
|
||||
|
||||
|
@ -94,12 +60,6 @@ ifeq ($(PLATFORM),DM644x)
|
|||
DRAM_START := 0x00008000
|
||||
DRAM_SIZE := 0x00004000
|
||||
endif
|
||||
ifeq ($(PLATFORM),DM35x)
|
||||
SOURCES += dm35x.c
|
||||
IRAM_SIZE := 0x00008000
|
||||
DRAM_START := 0x00010000
|
||||
DRAM_SIZE := 0x00008000
|
||||
endif
|
||||
|
||||
LDFLAGS += --defsym __DDR_SIZE=$(DDR_SIZE) \
|
||||
--defsym __IRAM_SIZE=$(IRAM_SIZE) \
|
||||
|
@ -116,7 +76,7 @@ ifeq ($(FLASH_TYPE),FLASH_TYPE_NOR)
|
|||
endif
|
||||
|
||||
OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
|
||||
EXECUTABLE := ubl.elf
|
||||
EXECUTABLE := ubl_$(BOARD).elf
|
||||
BINARY := $(EXECUTABLE)
|
||||
|
||||
DEPS_DIR := .deps
|
||||
|
@ -127,7 +87,7 @@ ifneq ($(MAKECMDGOALS),clean)
|
|||
ifndef BOARD
|
||||
all:
|
||||
@echo "You must select a board."
|
||||
@echo "List of supported boards: evmdm6446 sffsdr das minidas afeusb evmdm355"
|
||||
@echo "List of supported boards: sysmobts_v1 sffsdr"
|
||||
@echo "Example:"
|
||||
@echo " make BOARD=sffsdr"; exit 1
|
||||
else
|
||||
|
|
46
board.h
46
board.h
|
@ -27,50 +27,14 @@
|
|||
#include "common.h"
|
||||
#include "davinci.h"
|
||||
|
||||
#if defined(board_dvevm)
|
||||
# define PINMUX1_DEFAULT PINMUX1_UART0
|
||||
|
||||
#elif defined(board_sffsdr)
|
||||
#if defined(board_sffsdr)
|
||||
# define PINMUX1_DEFAULT PINMUX1_UART0 | PINMUX1_UART1 | PINMUX1_I2C | \
|
||||
PINMUX1_ASP
|
||||
#endif
|
||||
|
||||
#elif defined(board_das)
|
||||
# define PINMUX0_DEFAULT PINMUX0_VLYNQEN | VLYNQ_WIDTH_4
|
||||
# define PINMUX1_DEFAULT PINMUX1_UART0 | PINMUX1_UART2 | PINMUX1_I2C | \
|
||||
PINMUX1_SPI
|
||||
|
||||
#elif defined(board_dm355evm)
|
||||
# define PINMUX0_DEFAULT 0x00007F55 /* All Video Inputs */
|
||||
# define PINMUX1_DEFAULT 0x00145555 /* All Video Outputs */
|
||||
# define PINMUX2_DEFAULT 0x00000004 /* EMIFA */
|
||||
# define PINMUX3_DEFAULT 0x1BFF55FF /* SPI0, SPI1, UART1, I2C, SD0, SD1,
|
||||
* ASP0, CLKOUTs */
|
||||
# define PINMUX4_DEFAULT 0x00000000 /* MMC/SD0 instead of MS, SPI0 */
|
||||
|
||||
#elif defined(board_minidas)
|
||||
# define PINMUX0_DEFAULT 0x00005C00 /* 8-bits video input, rest is GPIOs. */
|
||||
# define PINMUX1_DEFAULT 0x00430000 /* All GPIOs (temporary: no PWM1 for buzzer) */
|
||||
# define PINMUX2_DEFAULT 0x00000C0A /* EMIF A3:13, CE0 & CE1. */
|
||||
# define PINMUX3_DEFAULT 0x0B7BAAC0 /* SPI0, SPI1, UART1, UART2, I2C, SD0,
|
||||
* CLKOUT1, CLKOUT2 */
|
||||
# define PINMUX4_DEFAULT 0x00000001 /* MMC/SD0 + SPI0_SDI */
|
||||
|
||||
/* Optional GPIO used as a status LED. Make sure to enable the corresponding
|
||||
* PINMUX bit. */
|
||||
#define STATUS_LED GPIO(71)
|
||||
#define DSP1_PWR_ENA GPIO(95)
|
||||
#define DSP2_PWR_ENA GPIO(94)
|
||||
#define HDD_ENA GPIO(96)
|
||||
#define FULL_ENA GPIO(68)
|
||||
#define ALCOHOL_ENA GPIO(73)
|
||||
#define CAMERA_RESETn GPIO(72)
|
||||
#define FAN GPIO(81)
|
||||
#define BUZZER GPIO(80)
|
||||
#define WIFI_RESETn GPIO(79)
|
||||
#define GPS_RESETn GPIO(78)
|
||||
#define CAN_RESETn GPIO(77)
|
||||
#define ATA_RESETn GPIO(76)
|
||||
|
||||
#if defined(board_sysmobts_v1)
|
||||
# define PINMUX1_DEFAULT PINMUX1_UART0 | PINMUX1_UART1 | PINMUX1_I2C | \
|
||||
PINMUX1_ASP
|
||||
#endif
|
||||
|
||||
#endif /* _BOARD_H_ */
|
||||
|
|
|
@ -455,7 +455,7 @@ davinci_platform_init(char *version)
|
|||
psc_init();
|
||||
|
||||
/* Disable ARM interrupts */
|
||||
AINTC->INTCTL = 0x4;
|
||||
AINTC->INTCTL = 0x0;
|
||||
AINTC->EABASE = 0x0;
|
||||
AINTC->EINT0 = 0x0;
|
||||
AINTC->EINT1 = 0x0;
|
||||
|
|
121
dm35x.c
121
dm35x.c
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* dm35x.c - DM35x specific platform initialization
|
||||
*
|
||||
* Copyright (C) 2008 Hugo Villeneuve <hugo@hugovil.com>
|
||||
*
|
||||
* Based on TI DaVinci Flash and Boot Utilities, original copyright follows:
|
||||
* Copyright 2008 Texas Instruments, Inc. <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; 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "davinci.h"
|
||||
#include "util.h"
|
||||
|
||||
#define DEVICE_VTPIOCR_PWRDN_MASK (0x00000040)
|
||||
#define DEVICE_VTPIOCR_LOCK_MASK (0x00000080)
|
||||
#define DEVICE_VTPIOCR_PWRSAVE_MASK (0x00000100)
|
||||
#define DEVICE_VTPIOCR_CLR_MASK (0x00002000)
|
||||
#define DEVICE_VTPIOCR_VTPIOREADY_MASK (0x00004000)
|
||||
#define DEVICE_VTPIOCR_READY_MASK (0x00008000)
|
||||
|
||||
/* List of modules to enable in the PSC */
|
||||
const int8_t lpsc_en_list[] = {
|
||||
LPSC_VPSS_MAST,
|
||||
LPSC_VPSS_SLV,
|
||||
LPSC_EDMACC,
|
||||
LPSC_EDMATC0,
|
||||
LPSC_EDMATC1,
|
||||
LPSC_TIMER3,
|
||||
LPSC_SPI1,
|
||||
LPSC_MMC_SD1,
|
||||
LPSC_ASP1,
|
||||
LPSC_USB,
|
||||
LPSC_PWM3,
|
||||
LPSC_SPI2,
|
||||
LPSC_RTO,
|
||||
LPSC_DDR2,
|
||||
LPSC_AEMIF,
|
||||
LPSC_MMC_SD0,
|
||||
LPSC_MEMSTK,
|
||||
LPSC_ASP0,
|
||||
LPSC_I2C,
|
||||
LPSC_UART0,
|
||||
LPSC_UART1,
|
||||
LPSC_UART2,
|
||||
LPSC_SPIO,
|
||||
LPSC_PWM0,
|
||||
LPSC_PWM1,
|
||||
LPSC_PWM2,
|
||||
LPSC_GPIO,
|
||||
LPSC_TIMER0,
|
||||
LPSC_TIMER1,
|
||||
LPSC_TIMER2,
|
||||
LPSC_SYSMOD,
|
||||
LPSC_ARM,
|
||||
LPSC_VPSS_DAC,
|
||||
};
|
||||
|
||||
const size_t lpsc_en_list_len = sizeof(lpsc_en_list) /
|
||||
sizeof(lpsc_en_list[0]);
|
||||
|
||||
/* List of modules for which to control EMURSTIE */
|
||||
const int8_t lpsc_emurstie_list[] = {
|
||||
LPSC_VPSS_MAST,
|
||||
LPSC_VPSS_SLV,
|
||||
LPSC_TIMER3,
|
||||
LPSC_SPI1,
|
||||
LPSC_USB,
|
||||
LPSC_PWM3,
|
||||
LPSC_DDR2,
|
||||
LPSC_AEMIF,
|
||||
LPSC_MMC_SD0,
|
||||
LPSC_ASP0,
|
||||
LPSC_GPIO,
|
||||
LPSC_VPSS_DAC,
|
||||
};
|
||||
|
||||
const size_t lpsc_emurstie_list_len = sizeof(lpsc_emurstie_list) /
|
||||
sizeof(lpsc_emurstie_list[0]);
|
||||
|
||||
/* DDR2 VTP Calibration */
|
||||
void
|
||||
ddr_vtp_calibration(void)
|
||||
{
|
||||
/* DO VTP calibration:
|
||||
* Clear CLR & PWRDN & LOCK bits */
|
||||
SYSTEM->VTPIOCR &= ~(DEVICE_VTPIOCR_PWRDN_MASK |
|
||||
DEVICE_VTPIOCR_LOCK_MASK |
|
||||
DEVICE_VTPIOCR_CLR_MASK);
|
||||
|
||||
/* Un-clear VTP */
|
||||
SYSTEM->VTPIOCR |= DEVICE_VTPIOCR_CLR_MASK;
|
||||
|
||||
/* Wait for ready */
|
||||
while (!(SYSTEM->VTPIOCR & DEVICE_VTPIOCR_READY_MASK));
|
||||
|
||||
/* Set bit VTP_IO_READY */
|
||||
SYSTEM->VTPIOCR |= DEVICE_VTPIOCR_VTPIOREADY_MASK;
|
||||
|
||||
/* Enable power save mode and lock impedance */
|
||||
SYSTEM->VTPIOCR |= (DEVICE_VTPIOCR_PWRSAVE_MASK |
|
||||
DEVICE_VTPIOCR_LOCK_MASK);
|
||||
|
||||
/* Powerdown VTP as it is locked */
|
||||
SYSTEM->VTPIOCR |= DEVICE_VTPIOCR_PWRDN_MASK;
|
||||
|
||||
/* Wait for calibration to complete */
|
||||
waitloop(150);
|
||||
}
|
64
dm35x.h
64
dm35x.h
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* dm35x.h - DM35x specific platform definitions
|
||||
*
|
||||
* Copyright (C) 2008 Hugo Villeneuve <hugo@hugovil.com>
|
||||
*
|
||||
* Based on TI DaVinci Flash and Boot Utilities, original copyright follows:
|
||||
* Copyright 2008 Texas Instruments, Inc. <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; 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _DM35X_H_
|
||||
#define _DM35X_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define SYSTEM_CLK_HZ 24000000
|
||||
|
||||
#define VPBE_CLK_HZ 27000000
|
||||
|
||||
#define PLL1_Mult 144 /* 216 MHz */
|
||||
|
||||
#define PLL2_Mult 114
|
||||
#define PLL2_Div1 2 /* Fixed */
|
||||
#define PLL2_Div2 -1 /* PLLDIV2 not used */
|
||||
|
||||
#define DEVICE_MISC_PLL1POSTDIV_MASK 0x00000002
|
||||
#define DEVICE_MISC_AIMWAITST_MASK 0x00000001
|
||||
#define DEVICE_MISC_TIMER2WDT_MASK 0x00000010
|
||||
|
||||
#define UBL_IMAGE_SIZE 0x7800 /* 30 kB UBL (2Kb reserved for RBL stack) */
|
||||
|
||||
/* Global Memory Timing and PLL Settings */
|
||||
static const uint8_t DDR_NM = 1; /* 16-bit bus width only on DM35x. */
|
||||
static const uint8_t DDR_PAGESIZE = 2; /* 1024-word page size. */
|
||||
|
||||
#define DDR_PBBPR_PR_OLD_COUNT 0x000000FE;
|
||||
|
||||
/* PINMUX2 register bit values */
|
||||
#define PINMUX2_EM_CLK (1 << 11)
|
||||
#define PINMUX2_EM_AVD (1 << 10)
|
||||
#define PINMUX2_EM_WAIT (1 << 9)
|
||||
#define PINMUX2_EM_WE_OE (1 << 8)
|
||||
#define PINMUX2_EM_CE1 (1 << 7)
|
||||
#define PINMUX2_EM_CE0 (1 << 6)
|
||||
#define PINMUX2_EM_D7_0 (1 << 5)
|
||||
#define PINMUX2_EM_D15_8 (1 << 4)
|
||||
#define PINMUX2_EM_BA0 (1 << 2)
|
||||
#define PINMUX2_EM_A0_BA1 (1 << 1)
|
||||
#define PINMUX2_EM_A13_3 (1 << 0)
|
||||
|
||||
#endif /* _DM35X_H_ */
|
13
ubl.c
13
ubl.c
|
@ -122,7 +122,7 @@ ubl_main(void)
|
|||
/* Copy binary application data from NAND to DDRAM */
|
||||
if (nand_copy(&jump_entry_point) != E_PASS) {
|
||||
log_info("Boot failed.");
|
||||
goto UARTBOOT;
|
||||
goto fallback;
|
||||
}
|
||||
break;
|
||||
#elif defined(FLASH_TYPE_NOR)
|
||||
|
@ -132,7 +132,7 @@ ubl_main(void)
|
|||
/* Copy binary application data from NOR to DDRAM */
|
||||
if (nor_copy() != E_PASS) {
|
||||
log_info("Boot failed.");
|
||||
goto UARTBOOT;
|
||||
goto fallback;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
@ -155,6 +155,15 @@ UARTBOOT:
|
|||
|
||||
return E_PASS;
|
||||
|
||||
fallback:
|
||||
/* Wait until the RBL is done using the UART. */
|
||||
while ((UART0->LSR & 0x40) == 0);
|
||||
|
||||
uart_send_str("BootMode = ");
|
||||
log_info("UART"); /* Report boot mode to host */
|
||||
|
||||
goto UARTBOOT;
|
||||
|
||||
error:
|
||||
jump_entry_point = 0; /* Reset */
|
||||
return E_FAIL;
|
||||
|
|
Loading…
Reference in New Issue