avionic design with actual uboot and tooling
submodule of avionic design uboot bootloader and with included tools to get you started , read readme.md and readme-tk1-loader.md
This commit is contained in:
25
u-boot/board/tqc/tqm5200/Kconfig
Normal file
25
u-boot/board/tqc/tqm5200/Kconfig
Normal file
@@ -0,0 +1,25 @@
|
||||
if TARGET_CHARON
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm5200"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "charon"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM5200
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm5200"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM5200"
|
||||
|
||||
endif
|
||||
23
u-boot/board/tqc/tqm5200/MAINTAINERS
Normal file
23
u-boot/board/tqc/tqm5200/MAINTAINERS
Normal file
@@ -0,0 +1,23 @@
|
||||
TQM5200 BOARD
|
||||
#M: -
|
||||
S: Maintained
|
||||
F: board/tqc/tqm5200/
|
||||
F: include/configs/aev.h
|
||||
F: configs/aev_defconfig
|
||||
F: include/configs/TQM5200.h
|
||||
F: configs/cam5200_defconfig
|
||||
F: configs/cam5200_niosflash_defconfig
|
||||
F: configs/fo300_defconfig
|
||||
F: configs/MiniFAP_defconfig
|
||||
F: configs/TQM5200_defconfig
|
||||
F: configs/TQM5200_B_defconfig
|
||||
F: configs/TQM5200_B_HIGHBOOT_defconfig
|
||||
F: configs/TQM5200_STK100_defconfig
|
||||
F: configs/TQM5200S_defconfig
|
||||
F: configs/TQM5200S_HIGHBOOT_defconfig
|
||||
|
||||
CHARON BOARD
|
||||
M: Heiko Schocher <hs@denx.de>
|
||||
S: Maintained
|
||||
F: include/configs/charon.h
|
||||
F: configs/charon_defconfig
|
||||
8
u-boot/board/tqc/tqm5200/Makefile
Normal file
8
u-boot/board/tqc/tqm5200/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# (C) Copyright 2003-2006
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y := tqm5200.o cmd_stk52xx.o cam5200_flash.o
|
||||
768
u-boot/board/tqc/tqm5200/cam5200_flash.c
Normal file
768
u-boot/board/tqc/tqm5200/cam5200_flash.c
Normal file
@@ -0,0 +1,768 @@
|
||||
/*
|
||||
* (C) Copyright 2006
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xxx.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#if defined(CONFIG_CAM5200) && defined(CONFIG_CAM5200_NIOSFLASH)
|
||||
|
||||
#if 0
|
||||
#define DEBUGF(x...) printf(x)
|
||||
#else
|
||||
#define DEBUGF(x...)
|
||||
#endif
|
||||
|
||||
#define swap16(x) __swab16(x)
|
||||
|
||||
flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/*
|
||||
* CAM5200 is a TQM5200B based board. Additionally it also features
|
||||
* a NIOS cpu. The NIOS CPU peripherals are accessible through MPC5xxx
|
||||
* Local Bus on CS5. This includes 32 bit wide RAM and SRAM as well as
|
||||
* 16 bit wide flash device. Big Endian order on a 32 bit CS5 makes
|
||||
* access to flash chip slightly more complicated as additional byte
|
||||
* swapping is necessary within each 16 bit wide flash 'word'.
|
||||
*
|
||||
* This driver's task is to handle both flash devices: 32 bit TQM5200B
|
||||
* flash chip and 16 bit NIOS cpu flash chip. In the below
|
||||
* flash_addr_table table we use least significant address bit to mark
|
||||
* 16 bit flash bank and two sets of routines *_32 and *_16 to handle
|
||||
* specifics of both flashes.
|
||||
*/
|
||||
static unsigned long flash_addr_table[][CONFIG_SYS_MAX_FLASH_BANKS] = {
|
||||
{CONFIG_SYS_BOOTCS_START, CONFIG_SYS_CS5_START | 1}
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static int write_word(flash_info_t * info, ulong dest, ulong data);
|
||||
#ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV
|
||||
static int write_word_32(flash_info_t * info, ulong dest, ulong data);
|
||||
static int write_word_16(flash_info_t * info, ulong dest, ulong data);
|
||||
static int flash_erase_32(flash_info_t * info, int s_first, int s_last);
|
||||
static int flash_erase_16(flash_info_t * info, int s_first, int s_last);
|
||||
static ulong flash_get_size_32(vu_long * addr, flash_info_t * info);
|
||||
static ulong flash_get_size_16(vu_long * addr, flash_info_t * info);
|
||||
#endif
|
||||
|
||||
void flash_print_info(flash_info_t * info)
|
||||
{
|
||||
int i, k;
|
||||
int size, erased;
|
||||
volatile unsigned long *flash;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD:
|
||||
printf("AMD ");
|
||||
break;
|
||||
case FLASH_MAN_FUJ:
|
||||
printf("FUJITSU ");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_S29GL128N:
|
||||
printf ("S29GL128N (256 Mbit, uniform sector size)\n");
|
||||
break;
|
||||
case FLASH_AM320B:
|
||||
printf ("29LV320B (32 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM320T:
|
||||
printf ("29LV320T (32 Mbit, top boot sect)\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" Size: %ld KB in %d Sectors\n",
|
||||
info->size >> 10, info->sector_count);
|
||||
|
||||
printf(" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
/*
|
||||
* Check if whole sector is erased
|
||||
*/
|
||||
if (i != (info->sector_count - 1))
|
||||
size = info->start[i + 1] - info->start[i];
|
||||
else
|
||||
size = info->start[0] + info->size - info->start[i];
|
||||
|
||||
erased = 1;
|
||||
flash = (volatile unsigned long *)info->start[i];
|
||||
size = size >> 2; /* divide by 4 for longword access */
|
||||
|
||||
for (k = 0; k < size; k++) {
|
||||
if (*flash++ != 0xffffffff) {
|
||||
erased = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((i % 5) == 0)
|
||||
printf("\n ");
|
||||
|
||||
printf(" %08lX%s%s", info->start[i],
|
||||
erased ? " E" : " ",
|
||||
info->protect[i] ? "RO " : " ");
|
||||
}
|
||||
printf("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
#ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV
|
||||
static ulong flash_get_size(vu_long * addr, flash_info_t * info)
|
||||
{
|
||||
|
||||
DEBUGF("get_size: FLASH ADDR %08lx\n", addr);
|
||||
|
||||
/* bit 0 used for big flash marking */
|
||||
if ((ulong)addr & 0x1)
|
||||
return flash_get_size_16((vu_long *)((ulong)addr & 0xfffffffe), info);
|
||||
else
|
||||
return flash_get_size_32(addr, info);
|
||||
}
|
||||
|
||||
static ulong flash_get_size_32(vu_long * addr, flash_info_t * info)
|
||||
#else
|
||||
static ulong flash_get_size(vu_long * addr, flash_info_t * info)
|
||||
#endif
|
||||
{
|
||||
short i;
|
||||
CONFIG_SYS_FLASH_WORD_SIZE value;
|
||||
ulong base = (ulong) addr;
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) addr;
|
||||
|
||||
DEBUGF("get_size32: FLASH ADDR: %08x\n", (unsigned)addr);
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00900090;
|
||||
udelay(1000);
|
||||
|
||||
value = addr2[0];
|
||||
DEBUGF("FLASH MANUFACT: %x\n", value);
|
||||
|
||||
switch (value) {
|
||||
case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr2[1]; /* device ID */
|
||||
DEBUGF("\nFLASH DEVICEID: %x\n", value);
|
||||
|
||||
switch (value) {
|
||||
case AMD_ID_MIRROR:
|
||||
DEBUGF("Mirror Bit flash: addr[14] = %08lX addr[15] = %08lX\n",
|
||||
addr[14], addr[15]);
|
||||
switch(addr[14]) {
|
||||
case AMD_ID_GL128N_2:
|
||||
if (addr[15] != AMD_ID_GL128N_3) {
|
||||
DEBUGF("Chip: S29GL128N -> unknown\n");
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
} else {
|
||||
DEBUGF("Chip: S29GL128N\n");
|
||||
info->flash_id += FLASH_S29GL128N;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x02000000;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return(0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
}
|
||||
|
||||
/* set up sector start address table */
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
info->start[i] = base + (i * 0x00040000);
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr2 = (volatile CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[i]);
|
||||
|
||||
info->protect[i] = addr2[2] & 1;
|
||||
}
|
||||
|
||||
/* issue bank reset to return to read mode */
|
||||
addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00F000F0;
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
static int wait_for_DQ7_32(flash_info_t * info, int sect)
|
||||
{
|
||||
ulong start, now, last;
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *addr =
|
||||
(CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
|
||||
start = get_timer(0);
|
||||
last = start;
|
||||
while ((addr[0] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) !=
|
||||
(CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) {
|
||||
if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
|
||||
printf("Timeout\n");
|
||||
return -1;
|
||||
}
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV
|
||||
int flash_erase(flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) {
|
||||
return flash_erase_16(info, s_first, s_last);
|
||||
} else {
|
||||
return flash_erase_32(info, s_first, s_last);
|
||||
}
|
||||
}
|
||||
|
||||
static int flash_erase_32(flash_info_t * info, int s_first, int s_last)
|
||||
#else
|
||||
int flash_erase(flash_info_t * info, int s_first, int s_last)
|
||||
#endif
|
||||
{
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2;
|
||||
int flag, prot, sect;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN)
|
||||
printf("- missing\n");
|
||||
else
|
||||
printf("- no sectors to erase\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("Can't erase unknown flash type - aborted\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect])
|
||||
prot++;
|
||||
}
|
||||
|
||||
if (prot)
|
||||
printf("- Warning: %d protected sectors will not be erased!", prot);
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
|
||||
addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055;
|
||||
addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080;
|
||||
addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00300030; /* sector erase */
|
||||
|
||||
/*
|
||||
* Wait for each sector to complete, it's more
|
||||
* reliable. According to AMD Spec, you must
|
||||
* issue all erase commands within a specified
|
||||
* timeout. This has been seen to fail, especially
|
||||
* if printf()s are included (for debug)!!
|
||||
*/
|
||||
wait_for_DQ7_32(info, sect);
|
||||
}
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay(1000);
|
||||
|
||||
/* reset to read mode */
|
||||
addr = (CONFIG_SYS_FLASH_WORD_SIZE *) info->start[0];
|
||||
addr[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */
|
||||
|
||||
printf(" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp, data;
|
||||
int i, l, rc;
|
||||
|
||||
wp = (addr & ~3); /* get lower word aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp)
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
|
||||
for (; i < 4 && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
|
||||
for (; cnt == 0 && i < 4; ++i, ++cp)
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0)
|
||||
return (rc);
|
||||
|
||||
wp += 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
while (cnt >= 4) {
|
||||
data = 0;
|
||||
for (i = 0; i < 4; ++i)
|
||||
data = (data << 8) | *src++;
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0)
|
||||
return (rc);
|
||||
|
||||
wp += 4;
|
||||
cnt -= 4;
|
||||
}
|
||||
|
||||
if (cnt == 0)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < 4 && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < 4; ++i, ++cp)
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
|
||||
return (write_word(info, wp, data));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
#ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV
|
||||
static int write_word(flash_info_t * info, ulong dest, ulong data)
|
||||
{
|
||||
if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) {
|
||||
return write_word_16(info, dest, data);
|
||||
} else {
|
||||
return write_word_32(info, dest, data);
|
||||
}
|
||||
}
|
||||
|
||||
static int write_word_32(flash_info_t * info, ulong dest, ulong data)
|
||||
#else
|
||||
static int write_word(flash_info_t * info, ulong dest, ulong data)
|
||||
#endif
|
||||
{
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *) dest;
|
||||
ulong *datap = &data;
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 =
|
||||
(volatile CONFIG_SYS_FLASH_WORD_SIZE *)datap;
|
||||
ulong start;
|
||||
int i, flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((vu_long *)dest) & data) != data)
|
||||
return (2);
|
||||
|
||||
for (i = 0; i < 4 / sizeof(CONFIG_SYS_FLASH_WORD_SIZE); i++) {
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x00A000A0;
|
||||
|
||||
dest2[i] = data2[i];
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer(0);
|
||||
while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080) !=
|
||||
(data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x00800080)) {
|
||||
|
||||
if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT)
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYS_FLASH_2ND_16BIT_DEV
|
||||
|
||||
#undef CONFIG_SYS_FLASH_WORD_SIZE
|
||||
#define CONFIG_SYS_FLASH_WORD_SIZE unsigned short
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size_16(vu_long * addr, flash_info_t * info)
|
||||
{
|
||||
short i;
|
||||
CONFIG_SYS_FLASH_WORD_SIZE value;
|
||||
ulong base = (ulong) addr;
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) addr;
|
||||
|
||||
DEBUGF("get_size16: FLASH ADDR: %08x\n", (unsigned)addr);
|
||||
|
||||
/* issue bank reset to return to read mode */
|
||||
addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xF000F000;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xAA00AA00;
|
||||
addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x55005500;
|
||||
addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x90009000;
|
||||
udelay(1000);
|
||||
|
||||
value = swap16(addr2[0]);
|
||||
DEBUGF("FLASH MANUFACT: %x\n", value);
|
||||
|
||||
switch (value) {
|
||||
case (CONFIG_SYS_FLASH_WORD_SIZE) AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case (CONFIG_SYS_FLASH_WORD_SIZE) FUJ_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = swap16(addr2[1]); /* device ID */
|
||||
DEBUGF("\nFLASH DEVICEID: %x\n", value);
|
||||
|
||||
switch (value) {
|
||||
case (CONFIG_SYS_FLASH_WORD_SIZE)AMD_ID_LV320B:
|
||||
info->flash_id += FLASH_AM320B;
|
||||
info->sector_count = 71;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
case (CONFIG_SYS_FLASH_WORD_SIZE)AMD_ID_LV320T:
|
||||
info->flash_id += FLASH_AM320T;
|
||||
info->sector_count = 71;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
}
|
||||
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00002000;
|
||||
info->start[2] = base + 0x00004000;
|
||||
info->start[3] = base + 0x00006000;
|
||||
info->start[4] = base + 0x00008000;
|
||||
info->start[5] = base + 0x0000a000;
|
||||
info->start[6] = base + 0x0000c000;
|
||||
info->start[7] = base + 0x0000e000;
|
||||
|
||||
for (i = 8; i < info->sector_count; i++)
|
||||
info->start[i] = base + (i * 0x00010000) - 0x00070000;
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00002000;
|
||||
info->start[i--] = base + info->size - 0x00004000;
|
||||
info->start[i--] = base + info->size - 0x00006000;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
info->start[i--] = base + info->size - 0x0000a000;
|
||||
info->start[i--] = base + info->size - 0x0000c000;
|
||||
info->start[i--] = base + info->size - 0x0000e000;
|
||||
|
||||
for (; i >= 0; i--)
|
||||
info->start[i] = base + i * 0x00010000;
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr2 = (volatile CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[i]);
|
||||
|
||||
info->protect[i] = addr2[2] & 1;
|
||||
}
|
||||
|
||||
/* issue bank reset to return to read mode */
|
||||
addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xF000F000;
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
static int wait_for_DQ7_16(flash_info_t * info, int sect)
|
||||
{
|
||||
ulong start, now, last;
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *addr =
|
||||
(CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
|
||||
start = get_timer(0);
|
||||
last = start;
|
||||
while ((addr[0] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x80008000) !=
|
||||
(CONFIG_SYS_FLASH_WORD_SIZE) 0x80008000) {
|
||||
if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
|
||||
printf("Timeout\n");
|
||||
return -1;
|
||||
}
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int flash_erase_16(flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2;
|
||||
int flag, prot, sect;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN)
|
||||
printf("- missing\n");
|
||||
else
|
||||
printf("- no sectors to erase\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("Can't erase unknown flash type - aborted\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect])
|
||||
prot++;
|
||||
}
|
||||
|
||||
if (prot)
|
||||
printf("- Warning: %d protected sectors will not be erased!", prot);
|
||||
|
||||
printf("\n");
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
|
||||
addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xAA00AA00;
|
||||
addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x55005500;
|
||||
addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x80008000;
|
||||
addr[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xAA00AA00;
|
||||
addr[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x55005500;
|
||||
addr2[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x30003000; /* sector erase */
|
||||
|
||||
/*
|
||||
* Wait for each sector to complete, it's more
|
||||
* reliable. According to AMD Spec, you must
|
||||
* issue all erase commands within a specified
|
||||
* timeout. This has been seen to fail, especially
|
||||
* if printf()s are included (for debug)!!
|
||||
*/
|
||||
wait_for_DQ7_16(info, sect);
|
||||
}
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay(1000);
|
||||
|
||||
/* reset to read mode */
|
||||
addr = (CONFIG_SYS_FLASH_WORD_SIZE *) info->start[0];
|
||||
addr[0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xF000F000; /* reset bank */
|
||||
|
||||
printf(" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int write_word_16(flash_info_t * info, ulong dest, ulong data)
|
||||
{
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *) dest;
|
||||
ulong *datap = &data;
|
||||
volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 =
|
||||
(volatile CONFIG_SYS_FLASH_WORD_SIZE *)datap;
|
||||
ulong start;
|
||||
int i;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
for (i = 0; i < 4 / sizeof(CONFIG_SYS_FLASH_WORD_SIZE); i++) {
|
||||
if ((dest2[i] & swap16(data2[i])) != swap16(data2[i]))
|
||||
return (2);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4 / sizeof(CONFIG_SYS_FLASH_WORD_SIZE); i++) {
|
||||
int flag;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xAA00AA00;
|
||||
addr2[CONFIG_SYS_FLASH_ADDR1] = (CONFIG_SYS_FLASH_WORD_SIZE) 0x55005500;
|
||||
addr2[CONFIG_SYS_FLASH_ADDR0] = (CONFIG_SYS_FLASH_WORD_SIZE) 0xA000A000;
|
||||
|
||||
dest2[i] = swap16(data2[i]);
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer(0);
|
||||
while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE) 0x80008000) !=
|
||||
(swap16(data2[i]) & (CONFIG_SYS_FLASH_WORD_SIZE) 0x80008000)) {
|
||||
|
||||
if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* CONFIG_SYS_FLASH_2ND_16BIT_DEV */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size(vu_long * addr, flash_info_t * info);
|
||||
static int write_word(flash_info_t * info, ulong dest, ulong data);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init(void)
|
||||
{
|
||||
unsigned long total_b = 0;
|
||||
unsigned long size_b[CONFIG_SYS_MAX_FLASH_BANKS];
|
||||
unsigned short index = 0;
|
||||
int i;
|
||||
|
||||
DEBUGF("\n");
|
||||
DEBUGF("FLASH: Index: %d\n", index);
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
flash_info[i].sector_count = -1;
|
||||
flash_info[i].size = 0;
|
||||
|
||||
/* check whether the address is 0 */
|
||||
if (flash_addr_table[index][i] == 0)
|
||||
continue;
|
||||
|
||||
/* call flash_get_size() to initialize sector address */
|
||||
size_b[i] = flash_get_size((vu_long *) flash_addr_table[index][i],
|
||||
&flash_info[i]);
|
||||
|
||||
flash_info[i].size = size_b[i];
|
||||
|
||||
if (flash_info[i].flash_id == FLASH_UNKNOWN) {
|
||||
printf("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n",
|
||||
i+1, size_b[i], size_b[i] << 20);
|
||||
flash_info[i].sector_count = -1;
|
||||
flash_info[i].size = 0;
|
||||
}
|
||||
|
||||
/* Monitor protection ON by default */
|
||||
(void)flash_protect(FLAG_PROTECT_SET, CONFIG_SYS_MONITOR_BASE,
|
||||
CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN - 1,
|
||||
&flash_info[i]);
|
||||
#if defined(CONFIG_ENV_IS_IN_FLASH)
|
||||
(void)flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR,
|
||||
CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1,
|
||||
&flash_info[i]);
|
||||
#if defined(CONFIG_ENV_ADDR_REDUND)
|
||||
(void)flash_protect(FLAG_PROTECT_SET, CONFIG_ENV_ADDR_REDUND,
|
||||
CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1,
|
||||
&flash_info[i]);
|
||||
#endif
|
||||
#endif
|
||||
total_b += flash_info[i].size;
|
||||
}
|
||||
|
||||
return total_b;
|
||||
}
|
||||
#endif /* if defined(CONFIG_CAM5200) && defined(CONFIG_CAM5200_NIOSFLASH) */
|
||||
1228
u-boot/board/tqc/tqm5200/cmd_stk52xx.c
Normal file
1228
u-boot/board/tqc/tqm5200/cmd_stk52xx.c
Normal file
File diff suppressed because it is too large
Load Diff
18
u-boot/board/tqc/tqm5200/mt48lc16m16a2-75.h
Normal file
18
u-boot/board/tqc/tqm5200/mt48lc16m16a2-75.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#define SDRAM_DDR 0 /* is SDR */
|
||||
|
||||
/* Settings for XLB = 132 MHz */
|
||||
#define SDRAM_MODE 0x00CD0000
|
||||
/* #define SDRAM_MODE 0x008D0000 */ /* CAS latency 2 */
|
||||
#define SDRAM_CONTROL 0x504F0000
|
||||
#define SDRAM_CONFIG1 0xD2322800
|
||||
/* #define SDRAM_CONFIG1 0xD2222800 */ /* CAS latency 2 */
|
||||
/*#define SDRAM_CONFIG1 0xD7322800 */ /* SDRAM controller bug workaround */
|
||||
#define SDRAM_CONFIG2 0x8AD70000
|
||||
/*#define SDRAM_CONFIG2 0xDDD70000 */ /* SDRAM controller bug workaround */
|
||||
882
u-boot/board/tqc/tqm5200/tqm5200.c
Normal file
882
u-boot/board/tqc/tqm5200/tqm5200.c
Normal file
@@ -0,0 +1,882 @@
|
||||
/*
|
||||
* (C) Copyright 2003-2006
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
|
||||
*
|
||||
* (C) Copyright 2004-2006
|
||||
* Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <console.h>
|
||||
#include <mpc5xxx.h>
|
||||
#include <pci.h>
|
||||
#include <asm/processor.h>
|
||||
#include <libfdt.h>
|
||||
#include <netdev.h>
|
||||
|
||||
#ifdef CONFIG_VIDEO_SM501
|
||||
#include <sm501.h>
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MPC5200_DDR)
|
||||
#include "mt46v16m16-75.h"
|
||||
#else
|
||||
#include "mt48lc16m16a2-75.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_OF_LIBFDT
|
||||
#include <fdt_support.h>
|
||||
#endif /* CONFIG_OF_LIBFDT */
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#ifdef CONFIG_PS2MULT
|
||||
void ps2mult_early_init(void);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) && \
|
||||
defined(CONFIG_VIDEO)
|
||||
/*
|
||||
* EDID block has been generated using Phoenix EDID Designer 1.3.
|
||||
* This tool creates a text file containing:
|
||||
*
|
||||
* EDID BYTES:
|
||||
*
|
||||
* 0x 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||
* ------------------------------------------------
|
||||
* 00 | 00 FF FF FF FF FF FF 00 04 21 00 00 00 00 00 00
|
||||
* 10 | 01 00 01 03 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
* 20 | 00 00 00 21 00 00 01 01 01 01 01 01 01 01 01 01
|
||||
* 30 | 01 01 01 01 01 01 64 00 00 00 00 00 00 00 00 00
|
||||
* 40 | 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00
|
||||
* 50 | 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00
|
||||
* 60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10
|
||||
* 70 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17
|
||||
*
|
||||
* Then this data has been manually converted to the char
|
||||
* array below.
|
||||
*/
|
||||
static unsigned char edid_buf[128] = {
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
|
||||
0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x64, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SYS_RAMBOOT
|
||||
static void sdram_start (int hi_addr)
|
||||
{
|
||||
long hi_addr_bit = hi_addr ? 0x01000000 : 0;
|
||||
|
||||
/* unlock mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 |
|
||||
hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
|
||||
hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
#if SDRAM_DDR
|
||||
/* set mode register: extended mode */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* set mode register: reset DLL */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
|
||||
__asm__ volatile ("sync");
|
||||
#endif
|
||||
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 |
|
||||
hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* auto refresh */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 |
|
||||
hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* set mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* normal operation */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ATTENTION: Although partially referenced initdram does NOT make real use
|
||||
* use of CONFIG_SYS_SDRAM_BASE. The code does not work if CONFIG_SYS_SDRAM_BASE
|
||||
* is something else than 0x00000000.
|
||||
*/
|
||||
|
||||
phys_size_t initdram (int board_type)
|
||||
{
|
||||
ulong dramsize = 0;
|
||||
ulong dramsize2 = 0;
|
||||
uint svr, pvr;
|
||||
|
||||
#ifndef CONFIG_SYS_RAMBOOT
|
||||
ulong test1, test2;
|
||||
|
||||
/* setup SDRAM chip selects */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001c; /* 512MB at 0x0 */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x40000000; /* disabled */
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
#if SDRAM_DDR
|
||||
/* set tap delay */
|
||||
*(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
|
||||
__asm__ volatile ("sync");
|
||||
#endif
|
||||
|
||||
/* find RAM size using SDRAM CS0 only */
|
||||
sdram_start(0);
|
||||
test1 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x20000000);
|
||||
sdram_start(1);
|
||||
test2 = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, 0x20000000);
|
||||
if (test1 > test2) {
|
||||
sdram_start(0);
|
||||
dramsize = test1;
|
||||
} else {
|
||||
dramsize = test2;
|
||||
}
|
||||
|
||||
/* memory smaller than 1MB is impossible */
|
||||
if (dramsize < (1 << 20)) {
|
||||
dramsize = 0;
|
||||
}
|
||||
|
||||
/* set SDRAM CS0 size according to the amount of RAM found */
|
||||
if (dramsize > 0) {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 +
|
||||
__builtin_ffs(dramsize >> 20) - 1;
|
||||
} else {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
|
||||
}
|
||||
|
||||
/* let SDRAM CS1 start right after CS0 */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001c; /* 512MB */
|
||||
|
||||
/* find RAM size using SDRAM CS1 only */
|
||||
if (!dramsize)
|
||||
sdram_start(0);
|
||||
test2 = test1 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x20000000);
|
||||
if (!dramsize) {
|
||||
sdram_start(1);
|
||||
test2 = get_ram_size((long *)(CONFIG_SYS_SDRAM_BASE + dramsize), 0x20000000);
|
||||
}
|
||||
if (test1 > test2) {
|
||||
sdram_start(0);
|
||||
dramsize2 = test1;
|
||||
} else {
|
||||
dramsize2 = test2;
|
||||
}
|
||||
|
||||
/* memory smaller than 1MB is impossible */
|
||||
if (dramsize2 < (1 << 20)) {
|
||||
dramsize2 = 0;
|
||||
}
|
||||
|
||||
/* set SDRAM CS1 size according to the amount of RAM found */
|
||||
if (dramsize2 > 0) {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize
|
||||
| (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
|
||||
} else {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
|
||||
}
|
||||
|
||||
#else /* CONFIG_SYS_RAMBOOT */
|
||||
|
||||
/* retrieve size of memory connected to SDRAM CS0 */
|
||||
dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
|
||||
if (dramsize >= 0x13) {
|
||||
dramsize = (1 << (dramsize - 0x13)) << 20;
|
||||
} else {
|
||||
dramsize = 0;
|
||||
}
|
||||
|
||||
/* retrieve size of memory connected to SDRAM CS1 */
|
||||
dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF;
|
||||
if (dramsize2 >= 0x13) {
|
||||
dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
|
||||
} else {
|
||||
dramsize2 = 0;
|
||||
}
|
||||
#endif /* CONFIG_SYS_RAMBOOT */
|
||||
|
||||
/*
|
||||
* On MPC5200B we need to set the special configuration delay in the
|
||||
* DDR controller. Please refer to Freescale's AN3221 "MPC5200B SDRAM
|
||||
* Initialization and Configuration", 3.3.1 SDelay--MBAR + 0x0190:
|
||||
*
|
||||
* "The SDelay should be written to a value of 0x00000004. It is
|
||||
* required to account for changes caused by normal wafer processing
|
||||
* parameters."
|
||||
*/
|
||||
svr = get_svr();
|
||||
pvr = get_pvr();
|
||||
if ((SVR_MJREV(svr) >= 2) &&
|
||||
(PVR_MAJ(pvr) == 1) && (PVR_MIN(pvr) == 4)) {
|
||||
|
||||
*(vu_long *)MPC5XXX_SDRAM_SDELAY = 0x04;
|
||||
__asm__ volatile ("sync");
|
||||
}
|
||||
|
||||
#if defined(CONFIG_TQM5200_B)
|
||||
return dramsize + dramsize2;
|
||||
#else
|
||||
return dramsize;
|
||||
#endif /* CONFIG_TQM5200_B */
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
#if defined(CONFIG_TQM5200S)
|
||||
# define MODULE_NAME "TQM5200S"
|
||||
#else
|
||||
# define MODULE_NAME "TQM5200"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STK52XX)
|
||||
# define CARRIER_NAME "STK52xx"
|
||||
#elif defined(CONFIG_CAM5200)
|
||||
# define CARRIER_NAME "CAM5200"
|
||||
#elif defined(CONFIG_FO300)
|
||||
# define CARRIER_NAME "FO300"
|
||||
#elif defined(CONFIG_CHARON)
|
||||
# define CARRIER_NAME "CHARON"
|
||||
#else
|
||||
# error "UNKNOWN"
|
||||
#endif
|
||||
|
||||
puts ( "Board: " MODULE_NAME " (TQ-Components GmbH)\n"
|
||||
" on a " CARRIER_NAME " carrier board\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef MODULE_NAME
|
||||
#undef CARRIER_NAME
|
||||
|
||||
void flash_preinit(void)
|
||||
{
|
||||
/*
|
||||
* Now, when we are in RAM, enable flash write
|
||||
* access for detection process.
|
||||
* Note that CS_BOOT cannot be cleared when
|
||||
* executing in flash.
|
||||
*/
|
||||
*(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
static struct pci_controller hose;
|
||||
|
||||
extern void pci_mpc5xxx_init(struct pci_controller *);
|
||||
|
||||
void pci_init_board(void)
|
||||
{
|
||||
pci_mpc5xxx_init(&hose);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET)
|
||||
|
||||
#if defined (CONFIG_MINIFAP)
|
||||
#define SM501_POWER_MODE0_GATE 0x00000040UL
|
||||
#define SM501_POWER_MODE1_GATE 0x00000048UL
|
||||
#define POWER_MODE_GATE_GPIO_PWM_I2C 0x00000040UL
|
||||
#define SM501_GPIO_DATA_DIR_HIGH 0x0001000CUL
|
||||
#define SM501_GPIO_DATA_HIGH 0x00010004UL
|
||||
#define SM501_GPIO_51 0x00080000UL
|
||||
#endif /* CONFIG MINIFAP */
|
||||
|
||||
void init_ide_reset (void)
|
||||
{
|
||||
debug ("init_ide_reset\n");
|
||||
|
||||
#if defined (CONFIG_MINIFAP)
|
||||
/* Configure GPIO_51 of the SM501 grafic controller as ATA reset */
|
||||
|
||||
/* enable GPIO control (in both power modes) */
|
||||
*(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE0_GATE) |=
|
||||
POWER_MODE_GATE_GPIO_PWM_I2C;
|
||||
*(vu_long *) (SM501_MMIO_BASE+SM501_POWER_MODE1_GATE) |=
|
||||
POWER_MODE_GATE_GPIO_PWM_I2C;
|
||||
/* configure GPIO51 as output */
|
||||
*(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_DIR_HIGH) |=
|
||||
SM501_GPIO_51;
|
||||
#else
|
||||
/* Configure PSC1_4 as GPIO output for ATA reset */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||
|
||||
/* by default the ATA reset is de-asserted */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ide_set_reset (int idereset)
|
||||
{
|
||||
debug ("ide_reset(%d)\n", idereset);
|
||||
|
||||
#if defined (CONFIG_MINIFAP)
|
||||
if (idereset) {
|
||||
*(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) &=
|
||||
~SM501_GPIO_51;
|
||||
} else {
|
||||
*(vu_long *) (SM501_MMIO_BASE+SM501_GPIO_DATA_HIGH) |=
|
||||
SM501_GPIO_51;
|
||||
}
|
||||
#else
|
||||
if (idereset) {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA_O &= ~GPIO_PSC1_4;
|
||||
} else {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA_O |= GPIO_PSC1_4;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
/*
|
||||
* Reads GPIO pin PSC6_3. A keypress is reported, if PSC6_3 is low. If PSC6_3
|
||||
* is left open, no keypress is detected.
|
||||
*/
|
||||
int post_hotkeys_pressed(void)
|
||||
{
|
||||
#ifdef CONFIG_STK52XX
|
||||
struct mpc5xxx_gpio *gpio;
|
||||
|
||||
gpio = (struct mpc5xxx_gpio*) MPC5XXX_GPIO;
|
||||
|
||||
/*
|
||||
* Configure PSC6_0 through PSC6_3 as GPIO.
|
||||
*/
|
||||
gpio->port_config &= ~(0x00700000);
|
||||
|
||||
/* Enable GPIO for GPIO_IRDA_1 (IR_USB_CLK pin) = PSC6_3 */
|
||||
gpio->simple_gpioe |= 0x20000000;
|
||||
|
||||
/* Configure GPIO_IRDA_1 as input */
|
||||
gpio->simple_ddr &= ~(0x20000000);
|
||||
|
||||
return ((gpio->simple_ival & 0x20000000) ? 0 : 1);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOARD_EARLY_INIT_R
|
||||
int board_early_init_r (void)
|
||||
{
|
||||
|
||||
extern int usb_cpu_init(void);
|
||||
|
||||
#ifdef CONFIG_PS2MULT
|
||||
ps2mult_early_init();
|
||||
#endif /* CONFIG_PS2MULT */
|
||||
|
||||
#if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
|
||||
/* Low level USB init, required for proper kernel operation */
|
||||
usb_cpu_init();
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FO300
|
||||
int silent_boot (void)
|
||||
{
|
||||
vu_long timer3_status;
|
||||
|
||||
/* Configure GPT3 as GPIO input */
|
||||
*(vu_long *)MPC5XXX_GPT3_ENABLE = 0x00000004;
|
||||
|
||||
/* Read in TIMER_3 pin status */
|
||||
timer3_status = *(vu_long *)MPC5XXX_GPT3_STATUS;
|
||||
|
||||
#ifdef FO300_SILENT_CONSOLE_WHEN_S1_CLOSED
|
||||
/* Force silent console mode if S1 switch
|
||||
* is in closed position (TIMER_3 pin status is LOW). */
|
||||
if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 0)
|
||||
return 1;
|
||||
#else
|
||||
/* Force silent console mode if S1 switch
|
||||
* is in open position (TIMER_3 pin status is HIGH). */
|
||||
if (MPC5XXX_GPT_GPIO_PIN(timer3_status) == 1)
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_early_init_f (void)
|
||||
{
|
||||
if (silent_boot())
|
||||
gd->flags |= GD_FLG_SILENT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_FO300 */
|
||||
|
||||
#if defined(CONFIG_CHARON)
|
||||
#include <i2c.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
/* The TFP410 registers */
|
||||
#define TFP410_REG_VEN_ID_L 0x00
|
||||
#define TFP410_REG_VEN_ID_H 0x01
|
||||
#define TFP410_REG_DEV_ID_L 0x02
|
||||
#define TFP410_REG_DEV_ID_H 0x03
|
||||
#define TFP410_REG_REV_ID 0x04
|
||||
|
||||
#define TFP410_REG_CTL_1_MODE 0x08
|
||||
#define TFP410_REG_CTL_2_MODE 0x09
|
||||
#define TFP410_REG_CTL_3_MODE 0x0A
|
||||
|
||||
#define TFP410_REG_CFG 0x0B
|
||||
|
||||
#define TFP410_REG_DE_DLY 0x32
|
||||
#define TFP410_REG_DE_CTL 0x33
|
||||
#define TFP410_REG_DE_TOP 0x34
|
||||
#define TFP410_REG_DE_CNT_L 0x36
|
||||
#define TFP410_REG_DE_CNT_H 0x37
|
||||
#define TFP410_REG_DE_LIN_L 0x38
|
||||
#define TFP410_REG_DE_LIN_H 0x39
|
||||
|
||||
#define TFP410_REG_H_RES_L 0x3A
|
||||
#define TFP410_REG_H_RES_H 0x3B
|
||||
#define TFP410_REG_V_RES_L 0x3C
|
||||
#define TFP410_REG_V_RES_H 0x3D
|
||||
|
||||
static int tfp410_read_reg(int reg, uchar *buf)
|
||||
{
|
||||
if (i2c_read(CONFIG_SYS_TFP410_ADDR, reg, 1, buf, 1) != 0) {
|
||||
puts ("Error reading the chip.\n");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tfp410_write_reg(int reg, uchar buf)
|
||||
{
|
||||
if (i2c_write(CONFIG_SYS_TFP410_ADDR, reg, 1, &buf, 1) != 0) {
|
||||
puts ("Error writing the chip.\n");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct _tfp410_config {
|
||||
int reg;
|
||||
uchar val;
|
||||
}TFP410_CONFIG;
|
||||
|
||||
static TFP410_CONFIG tfp410_configtbl[] = {
|
||||
{TFP410_REG_CTL_1_MODE, 0x37},
|
||||
{TFP410_REG_CTL_2_MODE, 0x20},
|
||||
{TFP410_REG_CTL_3_MODE, 0x80},
|
||||
{TFP410_REG_DE_DLY, 0x90},
|
||||
{TFP410_REG_DE_CTL, 0x00},
|
||||
{TFP410_REG_DE_TOP, 0x23},
|
||||
{TFP410_REG_DE_CNT_H, 0x02},
|
||||
{TFP410_REG_DE_CNT_L, 0x80},
|
||||
{TFP410_REG_DE_LIN_H, 0x01},
|
||||
{TFP410_REG_DE_LIN_L, 0xe0},
|
||||
{-1, 0},
|
||||
};
|
||||
|
||||
static int charon_last_stage_init(void)
|
||||
{
|
||||
volatile struct mpc5xxx_lpb *lpb =
|
||||
(struct mpc5xxx_lpb *) MPC5XXX_LPB;
|
||||
int oldbus = i2c_get_bus_num();
|
||||
uchar buf;
|
||||
int i = 0;
|
||||
|
||||
i2c_set_bus_num(CONFIG_SYS_TFP410_BUS);
|
||||
|
||||
/* check version */
|
||||
if (tfp410_read_reg(TFP410_REG_DEV_ID_H, &buf) != 0)
|
||||
return -1;
|
||||
if (!(buf & 0x04))
|
||||
return -1;
|
||||
if (tfp410_read_reg(TFP410_REG_DEV_ID_L, &buf) != 0)
|
||||
return -1;
|
||||
if (!(buf & 0x10))
|
||||
return -1;
|
||||
/* OK, now init the chip */
|
||||
while (tfp410_configtbl[i].reg != -1) {
|
||||
int ret;
|
||||
|
||||
ret = tfp410_write_reg(tfp410_configtbl[i].reg,
|
||||
tfp410_configtbl[i].val);
|
||||
if (ret != 0)
|
||||
return -1;
|
||||
i++;
|
||||
}
|
||||
printf("TFP410 initialized.\n");
|
||||
i2c_set_bus_num(oldbus);
|
||||
|
||||
/* set deadcycle for cs3 to 0 */
|
||||
setbits_be32(&lpb->cs_deadcycle, 0xffffcfff);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int last_stage_init (void)
|
||||
{
|
||||
/*
|
||||
* auto scan for really existing devices and re-set chip select
|
||||
* configuration.
|
||||
*/
|
||||
u16 save, tmp;
|
||||
int restore;
|
||||
|
||||
/*
|
||||
* Check for SRAM and SRAM size
|
||||
*/
|
||||
|
||||
/* save original SRAM content */
|
||||
save = *(volatile u16 *)CONFIG_SYS_CS2_START;
|
||||
restore = 1;
|
||||
|
||||
/* write test pattern to SRAM */
|
||||
*(volatile u16 *)CONFIG_SYS_CS2_START = 0xA5A5;
|
||||
__asm__ volatile ("sync");
|
||||
/*
|
||||
* Put a different pattern on the data lines: otherwise they may float
|
||||
* long enough to read back what we wrote.
|
||||
*/
|
||||
tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE;
|
||||
if (tmp == 0xA5A5)
|
||||
puts ("!! possible error in SRAM detection\n");
|
||||
|
||||
if (*(volatile u16 *)CONFIG_SYS_CS2_START != 0xA5A5) {
|
||||
/* no SRAM at all, disable cs */
|
||||
*(vu_long *)MPC5XXX_ADDECR &= ~(1 << 18);
|
||||
*(vu_long *)MPC5XXX_CS2_START = 0x0000FFFF;
|
||||
*(vu_long *)MPC5XXX_CS2_STOP = 0x0000FFFF;
|
||||
restore = 0;
|
||||
__asm__ volatile ("sync");
|
||||
} else if (*(volatile u16 *)(CONFIG_SYS_CS2_START + (1<<19)) == 0xA5A5) {
|
||||
/* make sure that we access a mirrored address */
|
||||
*(volatile u16 *)CONFIG_SYS_CS2_START = 0x1111;
|
||||
__asm__ volatile ("sync");
|
||||
if (*(volatile u16 *)(CONFIG_SYS_CS2_START + (1<<19)) == 0x1111) {
|
||||
/* SRAM size = 512 kByte */
|
||||
*(vu_long *)MPC5XXX_CS2_STOP = STOP_REG(CONFIG_SYS_CS2_START,
|
||||
0x80000);
|
||||
__asm__ volatile ("sync");
|
||||
puts ("SRAM: 512 kB\n");
|
||||
}
|
||||
else
|
||||
puts ("!! possible error in SRAM detection\n");
|
||||
} else {
|
||||
puts ("SRAM: 1 MB\n");
|
||||
}
|
||||
/* restore origianl SRAM content */
|
||||
if (restore) {
|
||||
*(volatile u16 *)CONFIG_SYS_CS2_START = save;
|
||||
__asm__ volatile ("sync");
|
||||
}
|
||||
|
||||
#ifndef CONFIG_TQM5200S /* The TQM5200S has no SM501 grafic controller */
|
||||
/*
|
||||
* Check for Grafic Controller
|
||||
*/
|
||||
|
||||
/* save origianl FB content */
|
||||
save = *(volatile u16 *)CONFIG_SYS_CS1_START;
|
||||
restore = 1;
|
||||
|
||||
/* write test pattern to FB memory */
|
||||
*(volatile u16 *)CONFIG_SYS_CS1_START = 0xA5A5;
|
||||
__asm__ volatile ("sync");
|
||||
/*
|
||||
* Put a different pattern on the data lines: otherwise they may float
|
||||
* long enough to read back what we wrote.
|
||||
*/
|
||||
tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE;
|
||||
if (tmp == 0xA5A5)
|
||||
puts ("!! possible error in grafic controller detection\n");
|
||||
|
||||
if (*(volatile u16 *)CONFIG_SYS_CS1_START != 0xA5A5) {
|
||||
/* no grafic controller at all, disable cs */
|
||||
*(vu_long *)MPC5XXX_ADDECR &= ~(1 << 17);
|
||||
*(vu_long *)MPC5XXX_CS1_START = 0x0000FFFF;
|
||||
*(vu_long *)MPC5XXX_CS1_STOP = 0x0000FFFF;
|
||||
restore = 0;
|
||||
__asm__ volatile ("sync");
|
||||
} else {
|
||||
puts ("VGA: SMI501 (Voyager) with 8 MB\n");
|
||||
}
|
||||
/* restore origianl FB content */
|
||||
if (restore) {
|
||||
*(volatile u16 *)CONFIG_SYS_CS1_START = save;
|
||||
__asm__ volatile ("sync");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FO300
|
||||
if (silent_boot()) {
|
||||
setenv("bootdelay", "0");
|
||||
disable_ctrlc(1);
|
||||
}
|
||||
#endif
|
||||
#endif /* !CONFIG_TQM5200S */
|
||||
|
||||
#if defined(CONFIG_CHARON)
|
||||
charon_last_stage_init();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_SM501
|
||||
|
||||
#ifdef CONFIG_FO300
|
||||
#define DISPLAY_WIDTH 800
|
||||
#else
|
||||
#define DISPLAY_WIDTH 640
|
||||
#endif
|
||||
#define DISPLAY_HEIGHT 480
|
||||
|
||||
#ifdef CONFIG_VIDEO_SM501_8BPP
|
||||
#error CONFIG_VIDEO_SM501_8BPP not supported.
|
||||
#endif /* CONFIG_VIDEO_SM501_8BPP */
|
||||
|
||||
#ifdef CONFIG_VIDEO_SM501_16BPP
|
||||
#error CONFIG_VIDEO_SM501_16BPP not supported.
|
||||
#endif /* CONFIG_VIDEO_SM501_16BPP */
|
||||
#ifdef CONFIG_VIDEO_SM501_32BPP
|
||||
static const SMI_REGS init_regs [] =
|
||||
{
|
||||
#if 0 /* CRT only */
|
||||
{0x00004, 0x0},
|
||||
{0x00048, 0x00021807},
|
||||
{0x0004C, 0x10090a01},
|
||||
{0x00054, 0x1},
|
||||
{0x00040, 0x00021807},
|
||||
{0x00044, 0x10090a01},
|
||||
{0x00054, 0x0},
|
||||
{0x80200, 0x00010000},
|
||||
{0x80204, 0x0},
|
||||
{0x80208, 0x0A000A00},
|
||||
{0x8020C, 0x02fa027f},
|
||||
{0x80210, 0x004a028b},
|
||||
{0x80214, 0x020c01df},
|
||||
{0x80218, 0x000201e9},
|
||||
{0x80200, 0x00013306},
|
||||
#else /* panel + CRT */
|
||||
#ifdef CONFIG_FO300
|
||||
{0x00004, 0x0},
|
||||
{0x00048, 0x00021807},
|
||||
{0x0004C, 0x301a0a01},
|
||||
{0x00054, 0x1},
|
||||
{0x00040, 0x00021807},
|
||||
{0x00044, 0x091a0a01},
|
||||
{0x00054, 0x0},
|
||||
{0x80000, 0x0f013106},
|
||||
{0x80004, 0xc428bb17},
|
||||
{0x8000C, 0x00000000},
|
||||
{0x80010, 0x0C800C80},
|
||||
{0x80014, 0x03200000},
|
||||
{0x80018, 0x01e00000},
|
||||
{0x8001C, 0x00000000},
|
||||
{0x80020, 0x01e00320},
|
||||
{0x80024, 0x042a031f},
|
||||
{0x80028, 0x0086034a},
|
||||
{0x8002C, 0x020c01df},
|
||||
{0x80030, 0x000201ea},
|
||||
{0x80200, 0x00010000},
|
||||
#else
|
||||
{0x00004, 0x0},
|
||||
{0x00048, 0x00021807},
|
||||
{0x0004C, 0x091a0a01},
|
||||
{0x00054, 0x1},
|
||||
{0x00040, 0x00021807},
|
||||
{0x00044, 0x091a0a01},
|
||||
{0x00054, 0x0},
|
||||
{0x80000, 0x0f013106},
|
||||
{0x80004, 0xc428bb17},
|
||||
{0x8000C, 0x00000000},
|
||||
{0x80010, 0x0a000a00},
|
||||
{0x80014, 0x02800000},
|
||||
{0x80018, 0x01e00000},
|
||||
{0x8001C, 0x00000000},
|
||||
{0x80020, 0x01e00280},
|
||||
{0x80024, 0x02fa027f},
|
||||
{0x80028, 0x004a028b},
|
||||
{0x8002C, 0x020c01df},
|
||||
{0x80030, 0x000201e9},
|
||||
{0x80200, 0x00010000},
|
||||
#endif /* #ifdef CONFIG_FO300 */
|
||||
#endif
|
||||
{0, 0}
|
||||
};
|
||||
#endif /* CONFIG_VIDEO_SM501_32BPP */
|
||||
|
||||
#ifdef CONFIG_CONSOLE_EXTRA_INFO
|
||||
/*
|
||||
* Return text to be printed besides the logo.
|
||||
*/
|
||||
void video_get_info_str (int line_number, char *info)
|
||||
{
|
||||
if (line_number == 1) {
|
||||
strcpy (info, " Board: TQM5200 (TQ-Components GmbH)");
|
||||
#if defined (CONFIG_CHARON) || defined (CONFIG_FO300) || \
|
||||
defined(CONFIG_STK52XX)
|
||||
} else if (line_number == 2) {
|
||||
#if defined (CONFIG_CHARON)
|
||||
strcpy (info, " on a CHARON carrier board");
|
||||
#endif
|
||||
#if defined (CONFIG_STK52XX)
|
||||
strcpy (info, " on a STK52xx carrier board");
|
||||
#endif
|
||||
#if defined (CONFIG_FO300)
|
||||
strcpy (info, " on a FO300 carrier board");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
info [0] = '\0';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Returns SM501 register base address. First thing called in the
|
||||
* driver. Checks if SM501 is physically present.
|
||||
*/
|
||||
unsigned int board_video_init (void)
|
||||
{
|
||||
u16 save, tmp;
|
||||
int restore, ret;
|
||||
|
||||
/*
|
||||
* Check for Grafic Controller
|
||||
*/
|
||||
|
||||
/* save origianl FB content */
|
||||
save = *(volatile u16 *)CONFIG_SYS_CS1_START;
|
||||
restore = 1;
|
||||
|
||||
/* write test pattern to FB memory */
|
||||
*(volatile u16 *)CONFIG_SYS_CS1_START = 0xA5A5;
|
||||
__asm__ volatile ("sync");
|
||||
/*
|
||||
* Put a different pattern on the data lines: otherwise they may float
|
||||
* long enough to read back what we wrote.
|
||||
*/
|
||||
tmp = *(volatile u16 *)CONFIG_SYS_FLASH_BASE;
|
||||
if (tmp == 0xA5A5)
|
||||
puts ("!! possible error in grafic controller detection\n");
|
||||
|
||||
if (*(volatile u16 *)CONFIG_SYS_CS1_START != 0xA5A5) {
|
||||
/* no grafic controller found */
|
||||
restore = 0;
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = SM501_MMIO_BASE;
|
||||
}
|
||||
|
||||
if (restore) {
|
||||
*(volatile u16 *)CONFIG_SYS_CS1_START = save;
|
||||
__asm__ volatile ("sync");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns SM501 framebuffer address
|
||||
*/
|
||||
unsigned int board_video_get_fb (void)
|
||||
{
|
||||
return SM501_FB_BASE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Called after initializing the SM501 and before clearing the screen.
|
||||
*/
|
||||
void board_validate_screen (unsigned int base)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a pointer to the initialization sequence.
|
||||
*/
|
||||
const SMI_REGS *board_get_regs (void)
|
||||
{
|
||||
return init_regs;
|
||||
}
|
||||
|
||||
int board_get_width (void)
|
||||
{
|
||||
return DISPLAY_WIDTH;
|
||||
}
|
||||
|
||||
int board_get_height (void)
|
||||
{
|
||||
return DISPLAY_HEIGHT;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_VIDEO_SM501 */
|
||||
|
||||
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
|
||||
int ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
ft_cpu_setup(blob, bd);
|
||||
#if defined(CONFIG_VIDEO)
|
||||
fdt_add_edid(blob, "smi,sm501", edid_buf);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
|
||||
|
||||
#if defined(CONFIG_RESET_PHY_R)
|
||||
#include <miiphy.h>
|
||||
|
||||
void reset_phy(void)
|
||||
{
|
||||
/* init Micrel KSZ8993 PHY */
|
||||
miiphy_write("FEC", CONFIG_PHY_ADDR, 0x01, 0x09);
|
||||
}
|
||||
#endif
|
||||
|
||||
int board_eth_init(bd_t *bis)
|
||||
{
|
||||
cpu_eth_init(bis); /* Built in FEC comes first */
|
||||
return pci_eth_init(bis);
|
||||
}
|
||||
12
u-boot/board/tqc/tqm834x/Kconfig
Normal file
12
u-boot/board/tqc/tqm834x/Kconfig
Normal file
@@ -0,0 +1,12 @@
|
||||
if TARGET_TQM834X
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm834x"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM834x"
|
||||
|
||||
endif
|
||||
6
u-boot/board/tqc/tqm834x/MAINTAINERS
Normal file
6
u-boot/board/tqc/tqm834x/MAINTAINERS
Normal file
@@ -0,0 +1,6 @@
|
||||
TQM834X BOARD
|
||||
#M: -
|
||||
S: Maintained
|
||||
F: board/tqc/tqm834x/
|
||||
F: include/configs/TQM834x.h
|
||||
F: configs/TQM834x_defconfig
|
||||
11
u-boot/board/tqc/tqm834x/Makefile
Normal file
11
u-boot/board/tqc/tqm834x/Makefile
Normal file
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# (C) Copyright 2006
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# Copyright 2004 Freescale Semiconductor, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y += tqm834x.o
|
||||
obj-$(CONFIG_PCI) += pci.o
|
||||
99
u-boot/board/tqc/tqm834x/pci.c
Normal file
99
u-boot/board/tqc/tqm834x/pci.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* (C) Copyright 2005
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* Copyright (C) 2006-2009 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <asm/mmu.h>
|
||||
#include <asm/io.h>
|
||||
#include <common.h>
|
||||
#include <mpc83xx.h>
|
||||
#include <pci.h>
|
||||
#include <i2c.h>
|
||||
#include <asm/fsl_i2c.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static struct pci_region pci1_regions[] = {
|
||||
{
|
||||
bus_start: CONFIG_SYS_PCI1_MEM_BASE,
|
||||
phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
|
||||
size: CONFIG_SYS_PCI1_MEM_SIZE,
|
||||
flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
|
||||
},
|
||||
{
|
||||
bus_start: CONFIG_SYS_PCI1_IO_BASE,
|
||||
phys_start: CONFIG_SYS_PCI1_IO_PHYS,
|
||||
size: CONFIG_SYS_PCI1_IO_SIZE,
|
||||
flags: PCI_REGION_IO
|
||||
},
|
||||
{
|
||||
bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
|
||||
phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
|
||||
size: CONFIG_SYS_PCI1_MMIO_SIZE,
|
||||
flags: PCI_REGION_MEM
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* pci_init_board()
|
||||
*
|
||||
* NOTICE: MPC8349 internally has two PCI controllers (PCI1 and PCI2) but since
|
||||
* per TQM834x design physical connections to external devices (PCI sockets)
|
||||
* are routed only to the PCI1 we do not account for the second one - this code
|
||||
* supports PCI1 module only. Should support for the PCI2 be required in the
|
||||
* future it needs a separate pci_controller structure (above) and handling -
|
||||
* please refer to other boards' implementation for dual PCI host controllers,
|
||||
* for example board/Marvell/db64360/pci.c, pci_init_board()
|
||||
*
|
||||
*/
|
||||
void
|
||||
pci_init_board(void)
|
||||
{
|
||||
volatile immap_t *immr = (volatile immap_t *)CONFIG_SYS_IMMR;
|
||||
volatile clk83xx_t *clk = (volatile clk83xx_t *)&immr->clk;
|
||||
volatile law83xx_t *pci_law = immr->sysconf.pcilaw;
|
||||
struct pci_region *reg[] = { pci1_regions };
|
||||
u32 reg32;
|
||||
|
||||
/*
|
||||
* Configure PCI controller and PCI_CLK_OUTPUT
|
||||
*
|
||||
* WARNING! only PCI_CLK_OUTPUT1 is enabled here as this is the one
|
||||
* line actually used for clocking all external PCI devices in TQM83xx.
|
||||
* Enabling other PCI_CLK_OUTPUT lines may lead to board's hang for
|
||||
* unknown reasons - particularly PCI_CLK_OUTPUT6 and PCI_CLK_OUTPUT7
|
||||
* are known to hang the board; this issue is under investigation
|
||||
* (13 oct 05)
|
||||
*/
|
||||
reg32 = OCCR_PCICOE1;
|
||||
#if 0
|
||||
/* enabling all PCI_CLK_OUTPUT lines HANGS the board... */
|
||||
reg32 = 0xff000000;
|
||||
#endif
|
||||
if (clk->spmr & SPMR_CKID) {
|
||||
/* PCI Clock is half CONFIG_83XX_CLKIN so need to set up OCCR
|
||||
* fields accordingly */
|
||||
reg32 |= (OCCR_PCI1CR | OCCR_PCI2CR);
|
||||
|
||||
reg32 |= (OCCR_PCICD0 | OCCR_PCICD1 | OCCR_PCICD2 \
|
||||
| OCCR_PCICD3 | OCCR_PCICD4 | OCCR_PCICD5 \
|
||||
| OCCR_PCICD6 | OCCR_PCICD7);
|
||||
}
|
||||
|
||||
clk->occr = reg32;
|
||||
udelay(2000);
|
||||
|
||||
/* Configure PCI Local Access Windows */
|
||||
pci_law[0].bar = CONFIG_SYS_PCI1_MEM_PHYS & LAWBAR_BAR;
|
||||
pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_512M;
|
||||
|
||||
pci_law[1].bar = CONFIG_SYS_PCI1_IO_PHYS & LAWBAR_BAR;
|
||||
pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_16M;
|
||||
|
||||
udelay(2000);
|
||||
|
||||
mpc83xx_pci_init(1, reg);
|
||||
}
|
||||
427
u-boot/board/tqc/tqm834x/tqm834x.c
Normal file
427
u-boot/board/tqc/tqm834x/tqm834x.c
Normal file
@@ -0,0 +1,427 @@
|
||||
/*
|
||||
* (C) Copyright 2005
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <ioports.h>
|
||||
#include <mpc83xx.h>
|
||||
#include <asm/mpc8349_pci.h>
|
||||
#include <i2c.h>
|
||||
#include <miiphy.h>
|
||||
#include <asm/mmu.h>
|
||||
#include <pci.h>
|
||||
#include <flash.h>
|
||||
#include <mtd/cfi_flash.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#define IOSYNC asm("eieio")
|
||||
#define ISYNC asm("isync")
|
||||
#define SYNC asm("sync")
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define DDR_MAX_SIZE_PER_CS 0x20000000
|
||||
|
||||
#if defined(DDR_CASLAT_20)
|
||||
#define TIMING_CASLAT TIMING_CFG1_CASLAT_20
|
||||
#define MODE_CASLAT DDR_MODE_CASLAT_20
|
||||
#else
|
||||
#define TIMING_CASLAT TIMING_CFG1_CASLAT_25
|
||||
#define MODE_CASLAT DDR_MODE_CASLAT_25
|
||||
#endif
|
||||
|
||||
#define INITIAL_CS_CONFIG (CSCONFIG_EN | CSCONFIG_ROW_BIT_12 | \
|
||||
CSCONFIG_COL_BIT_9)
|
||||
|
||||
/* External definitions */
|
||||
ulong flash_get_size (ulong base, int banknum);
|
||||
|
||||
/* Local functions */
|
||||
static int detect_num_flash_banks(void);
|
||||
static long int get_ddr_bank_size(short cs, long *base);
|
||||
static void set_cs_bounds(short cs, ulong base, ulong size);
|
||||
static void set_cs_config(short cs, long config);
|
||||
static void set_ddr_config(void);
|
||||
|
||||
/* Local variable */
|
||||
static volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
|
||||
|
||||
/**************************************************************************
|
||||
* Board initialzation after relocation to RAM. Used to detect the number
|
||||
* of Flash banks on TQM834x.
|
||||
*/
|
||||
int board_early_init_r (void) {
|
||||
/* sanity check, IMMARBAR should be mirrored at offset zero of IMMR */
|
||||
if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32)im)
|
||||
return 0;
|
||||
|
||||
/* detect the number of Flash banks */
|
||||
return detect_num_flash_banks();
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* DRAM initalization and size detection
|
||||
*/
|
||||
phys_size_t initdram (int board_type)
|
||||
{
|
||||
long bank_size;
|
||||
long size;
|
||||
int cs;
|
||||
|
||||
/* during size detection, set up the max DDRLAW size */
|
||||
im->sysconf.ddrlaw[0].bar = CONFIG_SYS_DDR_BASE;
|
||||
im->sysconf.ddrlaw[0].ar = (LAWAR_EN | LAWAR_SIZE_2G);
|
||||
|
||||
/* set CS bounds to maximum size */
|
||||
for(cs = 0; cs < 4; ++cs) {
|
||||
set_cs_bounds(cs,
|
||||
CONFIG_SYS_DDR_BASE + (cs * DDR_MAX_SIZE_PER_CS),
|
||||
DDR_MAX_SIZE_PER_CS);
|
||||
|
||||
set_cs_config(cs, INITIAL_CS_CONFIG);
|
||||
}
|
||||
|
||||
/* configure ddr controller */
|
||||
set_ddr_config();
|
||||
|
||||
udelay(200);
|
||||
|
||||
/* enable DDR controller */
|
||||
im->ddr.sdram_cfg = (SDRAM_CFG_MEM_EN |
|
||||
SDRAM_CFG_SREN |
|
||||
SDRAM_CFG_SDRAM_TYPE_DDR1);
|
||||
SYNC;
|
||||
|
||||
/* size detection */
|
||||
debug("\n");
|
||||
size = 0;
|
||||
for(cs = 0; cs < 4; ++cs) {
|
||||
debug("\nDetecting Bank%d\n", cs);
|
||||
|
||||
bank_size = get_ddr_bank_size(cs,
|
||||
(long *)(CONFIG_SYS_DDR_BASE + size));
|
||||
size += bank_size;
|
||||
|
||||
debug("DDR Bank%d size: %ld MiB\n\n", cs, bank_size >> 20);
|
||||
|
||||
/* exit if less than one bank */
|
||||
if(size < DDR_MAX_SIZE_PER_CS) break;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* checkboard()
|
||||
*/
|
||||
int checkboard (void)
|
||||
{
|
||||
puts("Board: TQM834x\n");
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
volatile immap_t * immr;
|
||||
u32 w, f;
|
||||
|
||||
immr = (immap_t *)CONFIG_SYS_IMMR;
|
||||
if (!(immr->reset.rcwh & HRCWH_PCI_HOST)) {
|
||||
printf("PCI: NOT in host mode..?!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get bus width */
|
||||
w = 32;
|
||||
if (immr->reset.rcwh & HRCWH_64_BIT_PCI)
|
||||
w = 64;
|
||||
|
||||
/* get clock */
|
||||
f = gd->pci_clk;
|
||||
|
||||
printf("PCI1: %d bit, %d MHz\n", w, f / 1000000);
|
||||
#else
|
||||
printf("PCI: disabled\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Local functions
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
* Detect the number of flash banks (1 or 2). Store it in
|
||||
* a global variable tqm834x_num_flash_banks.
|
||||
* Bank detection code based on the Monitor code.
|
||||
*/
|
||||
static int detect_num_flash_banks(void)
|
||||
{
|
||||
typedef unsigned long FLASH_PORT_WIDTH;
|
||||
typedef volatile unsigned long FLASH_PORT_WIDTHV;
|
||||
FPWV *bank1_base;
|
||||
FPWV *bank2_base;
|
||||
FPW bank1_read;
|
||||
FPW bank2_read;
|
||||
ulong bank1_size;
|
||||
ulong bank2_size;
|
||||
ulong total_size;
|
||||
|
||||
cfi_flash_num_flash_banks = 2; /* assume two banks */
|
||||
|
||||
/* Get bank 1 and 2 information */
|
||||
bank1_size = flash_get_size(CONFIG_SYS_FLASH_BASE, 0);
|
||||
debug("Bank1 size: %lu\n", bank1_size);
|
||||
bank2_size = flash_get_size(CONFIG_SYS_FLASH_BASE + bank1_size, 1);
|
||||
debug("Bank2 size: %lu\n", bank2_size);
|
||||
total_size = bank1_size + bank2_size;
|
||||
|
||||
if (bank2_size > 0) {
|
||||
/* Seems like we've got bank 2, but maybe it's mirrored 1 */
|
||||
|
||||
/* Set the base addresses */
|
||||
bank1_base = (FPWV *) (CONFIG_SYS_FLASH_BASE);
|
||||
bank2_base = (FPWV *) (CONFIG_SYS_FLASH_BASE + bank1_size);
|
||||
|
||||
/* Put bank 2 into CFI command mode and read */
|
||||
bank2_base[0x55] = 0x00980098;
|
||||
IOSYNC;
|
||||
ISYNC;
|
||||
bank2_read = bank2_base[0x10];
|
||||
|
||||
/* Read from bank 1 (it's in read mode) */
|
||||
bank1_read = bank1_base[0x10];
|
||||
|
||||
/* Reset Flash */
|
||||
bank1_base[0] = 0x00F000F0;
|
||||
bank2_base[0] = 0x00F000F0;
|
||||
|
||||
if (bank2_read == bank1_read) {
|
||||
/*
|
||||
* Looks like just one bank, but not sure yet. Let's
|
||||
* read from bank 2 in autosoelect mode.
|
||||
*/
|
||||
bank2_base[0x0555] = 0x00AA00AA;
|
||||
bank2_base[0x02AA] = 0x00550055;
|
||||
bank2_base[0x0555] = 0x00900090;
|
||||
IOSYNC;
|
||||
ISYNC;
|
||||
bank2_read = bank2_base[0x10];
|
||||
|
||||
/* Read from bank 1 (it's in read mode) */
|
||||
bank1_read = bank1_base[0x10];
|
||||
|
||||
/* Reset Flash */
|
||||
bank1_base[0] = 0x00F000F0;
|
||||
bank2_base[0] = 0x00F000F0;
|
||||
|
||||
if (bank2_read == bank1_read) {
|
||||
/*
|
||||
* In both CFI command and autoselect modes,
|
||||
* we got the some data reading from Flash.
|
||||
* There is only one mirrored bank.
|
||||
*/
|
||||
cfi_flash_num_flash_banks = 1;
|
||||
total_size = bank1_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
debug("Number of flash banks detected: %d\n", cfi_flash_num_flash_banks);
|
||||
|
||||
/* set OR0 and BR0 */
|
||||
set_lbc_or(0, CONFIG_SYS_OR_TIMING_FLASH |
|
||||
(-(total_size) & OR_GPCM_AM));
|
||||
set_lbc_br(0, (CONFIG_SYS_FLASH_BASE & BR_BA) |
|
||||
(BR_MS_GPCM | BR_PS_32 | BR_V));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Detect the size of a ddr bank. Sets CS bounds and CS config accordingly.
|
||||
*/
|
||||
static long int get_ddr_bank_size(short cs, long *base)
|
||||
{
|
||||
/* This array lists all valid DDR SDRAM configurations, with
|
||||
* Bank sizes in bytes. (Refer to Table 9-27 in the MPC8349E RM).
|
||||
* The last entry has to to have size equal 0 and is igonred during
|
||||
* autodection. Bank sizes must be in increasing order of size
|
||||
*/
|
||||
struct {
|
||||
long row;
|
||||
long col;
|
||||
long size;
|
||||
} conf[] = {
|
||||
{CSCONFIG_ROW_BIT_12, CSCONFIG_COL_BIT_8, 32 << 20},
|
||||
{CSCONFIG_ROW_BIT_12, CSCONFIG_COL_BIT_9, 64 << 20},
|
||||
{CSCONFIG_ROW_BIT_12, CSCONFIG_COL_BIT_10, 128 << 20},
|
||||
{CSCONFIG_ROW_BIT_13, CSCONFIG_COL_BIT_9, 128 << 20},
|
||||
{CSCONFIG_ROW_BIT_13, CSCONFIG_COL_BIT_10, 256 << 20},
|
||||
{CSCONFIG_ROW_BIT_13, CSCONFIG_COL_BIT_11, 512 << 20},
|
||||
{CSCONFIG_ROW_BIT_14, CSCONFIG_COL_BIT_10, 512 << 20},
|
||||
{CSCONFIG_ROW_BIT_14, CSCONFIG_COL_BIT_11, 1024 << 20},
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
int i;
|
||||
int detected;
|
||||
long size;
|
||||
|
||||
detected = -1;
|
||||
for(i = 0; conf[i].size != 0; ++i) {
|
||||
|
||||
/* set sdram bank configuration */
|
||||
set_cs_config(cs, CSCONFIG_EN | conf[i].col | conf[i].row);
|
||||
|
||||
debug("Getting RAM size...\n");
|
||||
size = get_ram_size(base, DDR_MAX_SIZE_PER_CS);
|
||||
|
||||
if((size == conf[i].size) && (i == detected + 1))
|
||||
detected = i;
|
||||
|
||||
debug("Trying %ld x %ld (%ld MiB) at addr %p, detected: %ld MiB\n",
|
||||
conf[i].row,
|
||||
conf[i].col,
|
||||
conf[i].size >> 20,
|
||||
base,
|
||||
size >> 20);
|
||||
}
|
||||
|
||||
if(detected == -1){
|
||||
/* disable empty cs */
|
||||
debug("\nNo valid configurations for CS%d, disabling...\n", cs);
|
||||
set_cs_config(cs, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
debug("\nDetected configuration %ld x %ld (%ld MiB) at addr %p\n",
|
||||
conf[detected].row, conf[detected].col, conf[detected].size >> 20, base);
|
||||
|
||||
/* configure cs ro detected params */
|
||||
set_cs_config(cs, CSCONFIG_EN | conf[detected].row |
|
||||
conf[detected].col);
|
||||
|
||||
set_cs_bounds(cs, (long)base, conf[detected].size);
|
||||
|
||||
return(conf[detected].size);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Sets DDR bank CS bounds.
|
||||
*/
|
||||
static void set_cs_bounds(short cs, ulong base, ulong size)
|
||||
{
|
||||
debug("Setting bounds %08lx, %08lx for cs %d\n", base, size, cs);
|
||||
if(size == 0){
|
||||
im->ddr.csbnds[cs].csbnds = 0x00000000;
|
||||
} else {
|
||||
im->ddr.csbnds[cs].csbnds =
|
||||
((base >> CSBNDS_SA_SHIFT) & CSBNDS_SA) |
|
||||
(((base + size - 1) >> CSBNDS_EA_SHIFT) &
|
||||
CSBNDS_EA);
|
||||
}
|
||||
SYNC;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Sets DDR banks CS configuration.
|
||||
* config == 0x00000000 disables the CS.
|
||||
*/
|
||||
static void set_cs_config(short cs, long config)
|
||||
{
|
||||
debug("Setting config %08lx for cs %d\n", config, cs);
|
||||
im->ddr.cs_config[cs] = config;
|
||||
SYNC;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Sets DDR clocks, timings and configuration.
|
||||
*/
|
||||
static void set_ddr_config(void) {
|
||||
/* clock control */
|
||||
im->ddr.sdram_clk_cntl = DDR_SDRAM_CLK_CNTL_SS_EN |
|
||||
DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05;
|
||||
SYNC;
|
||||
|
||||
/* timing configuration */
|
||||
im->ddr.timing_cfg_1 =
|
||||
(4 << TIMING_CFG1_PRETOACT_SHIFT) |
|
||||
(7 << TIMING_CFG1_ACTTOPRE_SHIFT) |
|
||||
(4 << TIMING_CFG1_ACTTORW_SHIFT) |
|
||||
(5 << TIMING_CFG1_REFREC_SHIFT) |
|
||||
(3 << TIMING_CFG1_WRREC_SHIFT) |
|
||||
(3 << TIMING_CFG1_ACTTOACT_SHIFT) |
|
||||
(1 << TIMING_CFG1_WRTORD_SHIFT) |
|
||||
(TIMING_CFG1_CASLAT & TIMING_CASLAT);
|
||||
|
||||
im->ddr.timing_cfg_2 =
|
||||
TIMING_CFG2_CPO_DEF |
|
||||
(2 << TIMING_CFG2_WR_DATA_DELAY_SHIFT);
|
||||
SYNC;
|
||||
|
||||
/* don't enable DDR controller yet */
|
||||
im->ddr.sdram_cfg =
|
||||
SDRAM_CFG_SREN |
|
||||
SDRAM_CFG_SDRAM_TYPE_DDR1;
|
||||
SYNC;
|
||||
|
||||
/* Set SDRAM mode */
|
||||
im->ddr.sdram_mode =
|
||||
((DDR_MODE_EXT_MODEREG | DDR_MODE_WEAK) <<
|
||||
SDRAM_MODE_ESD_SHIFT) |
|
||||
((DDR_MODE_MODEREG | DDR_MODE_BLEN_4) <<
|
||||
SDRAM_MODE_SD_SHIFT) |
|
||||
((DDR_MODE_CASLAT << SDRAM_MODE_SD_SHIFT) &
|
||||
MODE_CASLAT);
|
||||
SYNC;
|
||||
|
||||
/* Set fast SDRAM refresh rate */
|
||||
im->ddr.sdram_interval =
|
||||
(DDR_REFINT_166MHZ_7US << SDRAM_INTERVAL_REFINT_SHIFT) |
|
||||
(DDR_BSTOPRE << SDRAM_INTERVAL_BSTOPRE_SHIFT);
|
||||
SYNC;
|
||||
|
||||
/* Workaround for DDR6 Erratum
|
||||
* see MPC8349E Device Errata Rev.8, 2/2006
|
||||
* This workaround influences the MPC internal "input enables"
|
||||
* dependent on CAS latency and MPC revision. According to errata
|
||||
* sheet the internal reserved registers for this workaround are
|
||||
* not available from revision 2.0 and up.
|
||||
*/
|
||||
|
||||
/* Get REVID from register SPRIDR. Skip workaround if rev >= 2.0
|
||||
* (0x200)
|
||||
*/
|
||||
if ((im->sysconf.spridr & SPRIDR_REVID) < 0x200) {
|
||||
|
||||
/* There is a internal reserved register at IMMRBAR+0x2F00
|
||||
* which has to be written with a certain value defined by
|
||||
* errata sheet.
|
||||
*/
|
||||
u32 *reserved_p = (u32 *)((u8 *)im + 0x2f00);
|
||||
|
||||
#if defined(DDR_CASLAT_20)
|
||||
*reserved_p = 0x201c0000;
|
||||
#else
|
||||
*reserved_p = 0x202c0000;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF_BOARD_SETUP
|
||||
int ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
ft_cpu_setup(blob, bd);
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
ft_pci_setup(blob, bd);
|
||||
#endif /* CONFIG_PCI */
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_OF_BOARD_SETUP */
|
||||
155
u-boot/board/tqc/tqm8xx/Kconfig
Normal file
155
u-boot/board/tqc/tqm8xx/Kconfig
Normal file
@@ -0,0 +1,155 @@
|
||||
if TARGET_TQM823L
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM823L"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM823M
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM823M"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM850L
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM850L"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM850M
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM850M"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM855L
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM855L"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM855M
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM855M"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM860L
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM860L"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM860M
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM860M"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM862L
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM862L"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM862M
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM862M"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM866M
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM866M"
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_TQM885D
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqm8xx"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "TQM885D"
|
||||
|
||||
endif
|
||||
31
u-boot/board/tqc/tqm8xx/MAINTAINERS
Normal file
31
u-boot/board/tqc/tqm8xx/MAINTAINERS
Normal file
@@ -0,0 +1,31 @@
|
||||
TQM8XX BOARD
|
||||
M: Wolfgang Denk <wd@denx.de>
|
||||
S: Maintained
|
||||
F: board/tqc/tqm8xx/
|
||||
F: include/configs/TQM823L.h
|
||||
F: configs/TQM823L_defconfig
|
||||
F: configs/TQM823L_LCD_defconfig
|
||||
F: include/configs/TQM823M.h
|
||||
F: configs/TQM823M_defconfig
|
||||
F: include/configs/TQM850L.h
|
||||
F: configs/TQM850L_defconfig
|
||||
F: include/configs/TQM850M.h
|
||||
F: configs/TQM850M_defconfig
|
||||
F: include/configs/TQM855L.h
|
||||
F: configs/TQM855L_defconfig
|
||||
F: include/configs/TQM855M.h
|
||||
F: configs/TQM855M_defconfig
|
||||
F: include/configs/TQM860L.h
|
||||
F: configs/TQM860L_defconfig
|
||||
F: include/configs/TQM860M.h
|
||||
F: configs/TQM860M_defconfig
|
||||
F: include/configs/TQM862L.h
|
||||
F: configs/TQM862L_defconfig
|
||||
F: include/configs/TQM862M.h
|
||||
F: configs/TQM862M_defconfig
|
||||
F: include/configs/TQM866M.h
|
||||
F: configs/TQM866M_defconfig
|
||||
F: include/configs/TQM885D.h
|
||||
F: configs/TQM885D_defconfig
|
||||
F: configs/TTTech_defconfig
|
||||
F: configs/wtk_defconfig
|
||||
8
u-boot/board/tqc/tqm8xx/Makefile
Normal file
8
u-boot/board/tqc/tqm8xx/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# (C) Copyright 2000-2006
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y = tqm8xx.o load_sernum_ethaddr.o
|
||||
89
u-boot/board/tqc/tqm8xx/load_sernum_ethaddr.c
Normal file
89
u-boot/board/tqc/tqm8xx/load_sernum_ethaddr.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* (C) Copyright 2000, 2001, 2002
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Process Hardware Information Block:
|
||||
*
|
||||
* If we boot on a system fresh from factory, check if the Hardware
|
||||
* Information Block exists and save the information it contains.
|
||||
*
|
||||
* The TQM8xxL / TQM82xx Hardware Information Block is defined as
|
||||
* follows:
|
||||
* - located in first flash bank
|
||||
* - starts at offset 0x0003FFC0
|
||||
* - size 0x00000040
|
||||
*
|
||||
* Internal structure:
|
||||
* - sequence of ASCII character strings
|
||||
* - fields separated by a single space character (0x20)
|
||||
* - last field terminated by NUL character (0x00)
|
||||
* - remaining space filled with NUL characters (0x00)
|
||||
*
|
||||
* Fields in Hardware Information Block:
|
||||
* 1) Module Type
|
||||
* 2) Serial Number
|
||||
* 3) First MAC Address
|
||||
* 4) Number of additional MAC addresses
|
||||
*/
|
||||
|
||||
void load_sernum_ethaddr (void)
|
||||
{
|
||||
unsigned char *hwi;
|
||||
unsigned char serial [CONFIG_SYS_HWINFO_SIZE];
|
||||
unsigned char ethaddr[CONFIG_SYS_HWINFO_SIZE];
|
||||
unsigned short ih, is, ie, part;
|
||||
|
||||
hwi = (unsigned char *)(CONFIG_SYS_FLASH_BASE + CONFIG_SYS_HWINFO_OFFSET);
|
||||
ih = is = ie = 0;
|
||||
|
||||
if (*((unsigned long *)hwi) != (unsigned long)CONFIG_SYS_HWINFO_MAGIC) {
|
||||
return;
|
||||
}
|
||||
|
||||
part = 1;
|
||||
|
||||
/* copy serial # / MAC address */
|
||||
while ((hwi[ih] != '\0') && (ih < CONFIG_SYS_HWINFO_SIZE)) {
|
||||
if (hwi[ih] < ' ' || hwi[ih] > '~') { /* ASCII strings! */
|
||||
return;
|
||||
}
|
||||
switch (part) {
|
||||
default: /* Copy serial # */
|
||||
if (hwi[ih] == ' ') {
|
||||
++part;
|
||||
}
|
||||
serial[is++] = hwi[ih];
|
||||
break;
|
||||
case 3: /* Copy MAC address */
|
||||
if (hwi[ih] == ' ') {
|
||||
++part;
|
||||
break;
|
||||
}
|
||||
ethaddr[ie++] = hwi[ih];
|
||||
if ((ie % 3) == 2)
|
||||
ethaddr[ie++] = ':';
|
||||
break;
|
||||
}
|
||||
++ih;
|
||||
}
|
||||
serial[is] = '\0';
|
||||
if (ie && ethaddr[ie-1] == ':')
|
||||
--ie;
|
||||
ethaddr[ie] = '\0';
|
||||
|
||||
/* set serial# and ethaddr if not yet defined */
|
||||
if (getenv("serial#") == NULL) {
|
||||
setenv ((char *)"serial#", (char *)serial);
|
||||
}
|
||||
|
||||
if (getenv("ethaddr") == NULL) {
|
||||
setenv ((char *)"ethaddr", (char *)ethaddr);
|
||||
}
|
||||
}
|
||||
674
u-boot/board/tqc/tqm8xx/tqm8xx.c
Normal file
674
u-boot/board/tqc/tqm8xx/tqm8xx.c
Normal file
@@ -0,0 +1,674 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2008
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <hwconfig.h>
|
||||
#include <mpc8xx.h>
|
||||
#ifdef CONFIG_PS2MULT
|
||||
#include <ps2mult.h>
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
|
||||
#include <libfdt.h>
|
||||
#endif
|
||||
|
||||
extern flash_info_t flash_info[]; /* FLASH chips info */
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static long int dram_size (long int, long int *, long int);
|
||||
|
||||
#define _NOT_USED_ 0xFFFFFFFF
|
||||
|
||||
/* UPM initialization table for SDRAM: 40, 50, 66 MHz CLKOUT @ CAS latency 2, tWR=2 */
|
||||
const uint sdram_table[] =
|
||||
{
|
||||
/*
|
||||
* Single Read. (Offset 0 in UPMA RAM)
|
||||
*/
|
||||
0x1F0DFC04, 0xEEAFBC04, 0x11AF7C04, 0xEFBAFC00,
|
||||
0x1FF5FC47, /* last */
|
||||
/*
|
||||
* SDRAM Initialization (offset 5 in UPMA RAM)
|
||||
*
|
||||
* This is no UPM entry point. The following definition uses
|
||||
* the remaining space to establish an initialization
|
||||
* sequence, which is executed by a RUN command.
|
||||
*
|
||||
*/
|
||||
0x1FF5FC34, 0xEFEABC34, 0x1FB57C35, /* last */
|
||||
/*
|
||||
* Burst Read. (Offset 8 in UPMA RAM)
|
||||
*/
|
||||
0x1F0DFC04, 0xEEAFBC04, 0x10AF7C04, 0xF0AFFC00,
|
||||
0xF0AFFC00, 0xF1AFFC00, 0xEFBAFC00, 0x1FF5FC47, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
/*
|
||||
* Single Write. (Offset 18 in UPMA RAM)
|
||||
*/
|
||||
0x1F0DFC04, 0xEEABBC00, 0x11B77C04, 0xEFFAFC44,
|
||||
0x1FF5FC47, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
/*
|
||||
* Burst Write. (Offset 20 in UPMA RAM)
|
||||
*/
|
||||
0x1F0DFC04, 0xEEABBC00, 0x10A77C00, 0xF0AFFC00,
|
||||
0xF0AFFC00, 0xF0AFFC04, 0xE1BAFC44, 0x1FF5FC47, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
/*
|
||||
* Refresh (Offset 30 in UPMA RAM)
|
||||
*/
|
||||
0x1FFD7C84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
|
||||
0xFFFFFC84, 0xFFFFFC07, /* last */
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
/*
|
||||
* Exception. (Offset 3c in UPMA RAM)
|
||||
*/
|
||||
0xFFFFFC07, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/*
|
||||
* Check Board Identity:
|
||||
*
|
||||
* Test TQ ID string (TQM8xx...)
|
||||
* If present, check for "L" type (no second DRAM bank),
|
||||
* otherwise "L" type is assumed as default.
|
||||
*
|
||||
* Set board_type to 'L' for "L" type, 'M' for "M" type, 0 else.
|
||||
*/
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
char buf[64];
|
||||
int i;
|
||||
int l = getenv_f("serial#", buf, sizeof(buf));
|
||||
|
||||
puts ("Board: ");
|
||||
|
||||
if (l < 0 || strncmp(buf, "TQM8", 4)) {
|
||||
puts ("### No HW ID - assuming TQM8xxL\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
if ((buf[6] == 'L')) { /* a TQM8xxL type */
|
||||
gd->board_type = 'L';
|
||||
}
|
||||
|
||||
if ((buf[6] == 'M')) { /* a TQM8xxM type */
|
||||
gd->board_type = 'M';
|
||||
}
|
||||
|
||||
if ((buf[6] == 'D')) { /* a TQM885D type */
|
||||
gd->board_type = 'D';
|
||||
}
|
||||
|
||||
for (i = 0; i < l; ++i) {
|
||||
if (buf[i] == ' ')
|
||||
break;
|
||||
putc (buf[i]);
|
||||
}
|
||||
|
||||
putc ('\n');
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
phys_size_t initdram (int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
long int size8, size9, size10;
|
||||
long int size_b0 = 0;
|
||||
long int size_b1 = 0;
|
||||
|
||||
upmconfig (UPMA, (uint *) sdram_table,
|
||||
sizeof (sdram_table) / sizeof (uint));
|
||||
|
||||
/*
|
||||
* Preliminary prescaler for refresh (depends on number of
|
||||
* banks): This value is selected for four cycles every 62.4 us
|
||||
* with two SDRAM banks or four cycles every 31.2 us with one
|
||||
* bank. It will be adjusted after memory sizing.
|
||||
*/
|
||||
memctl->memc_mptpr = CONFIG_SYS_MPTPR_2BK_8K;
|
||||
|
||||
/*
|
||||
* The following value is used as an address (i.e. opcode) for
|
||||
* the LOAD MODE REGISTER COMMAND during SDRAM initialisation. If
|
||||
* the port size is 32bit the SDRAM does NOT "see" the lower two
|
||||
* address lines, i.e. mar=0x00000088 -> opcode=0x00000022 for
|
||||
* MICRON SDRAMs:
|
||||
* -> 0 00 010 0 010
|
||||
* | | | | +- Burst Length = 4
|
||||
* | | | +----- Burst Type = Sequential
|
||||
* | | +------- CAS Latency = 2
|
||||
* | +----------- Operating Mode = Standard
|
||||
* +-------------- Write Burst Mode = Programmed Burst Length
|
||||
*/
|
||||
memctl->memc_mar = 0x00000088;
|
||||
|
||||
/*
|
||||
* Map controller banks 2 and 3 to the SDRAM banks 2 and 3 at
|
||||
* preliminary addresses - these have to be modified after the
|
||||
* SDRAM size has been determined.
|
||||
*/
|
||||
memctl->memc_or2 = CONFIG_SYS_OR2_PRELIM;
|
||||
memctl->memc_br2 = CONFIG_SYS_BR2_PRELIM;
|
||||
|
||||
#ifndef CONFIG_CAN_DRIVER
|
||||
if ((board_type != 'L') &&
|
||||
(board_type != 'M') &&
|
||||
(board_type != 'D') ) { /* only one SDRAM bank on L, M and D modules */
|
||||
memctl->memc_or3 = CONFIG_SYS_OR3_PRELIM;
|
||||
memctl->memc_br3 = CONFIG_SYS_BR3_PRELIM;
|
||||
}
|
||||
#endif /* CONFIG_CAN_DRIVER */
|
||||
|
||||
memctl->memc_mamr = CONFIG_SYS_MAMR_8COL & (~(MAMR_PTAE)); /* no refresh yet */
|
||||
|
||||
udelay (200);
|
||||
|
||||
/* perform SDRAM initializsation sequence */
|
||||
|
||||
memctl->memc_mcr = 0x80004105; /* SDRAM bank 0 */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x80004230; /* SDRAM bank 0 - execute twice */
|
||||
udelay (1);
|
||||
|
||||
#ifndef CONFIG_CAN_DRIVER
|
||||
if ((board_type != 'L') &&
|
||||
(board_type != 'M') &&
|
||||
(board_type != 'D') ) { /* only one SDRAM bank on L, M and D modules */
|
||||
memctl->memc_mcr = 0x80006105; /* SDRAM bank 1 */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x80006230; /* SDRAM bank 1 - execute twice */
|
||||
udelay (1);
|
||||
}
|
||||
#endif /* CONFIG_CAN_DRIVER */
|
||||
|
||||
memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/*
|
||||
* Check Bank 0 Memory Size for re-configuration
|
||||
*
|
||||
* try 8 column mode
|
||||
*/
|
||||
size8 = dram_size (CONFIG_SYS_MAMR_8COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
|
||||
debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size8 >> 20);
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/*
|
||||
* try 9 column mode
|
||||
*/
|
||||
size9 = dram_size (CONFIG_SYS_MAMR_9COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
|
||||
debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size9 >> 20);
|
||||
|
||||
udelay(1000);
|
||||
|
||||
#if defined(CONFIG_SYS_MAMR_10COL)
|
||||
/*
|
||||
* try 10 column mode
|
||||
*/
|
||||
size10 = dram_size (CONFIG_SYS_MAMR_10COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
|
||||
debug ("SDRAM Bank 0 in 10 column mode: %ld MB\n", size10 >> 20);
|
||||
#else
|
||||
size10 = 0;
|
||||
#endif /* CONFIG_SYS_MAMR_10COL */
|
||||
|
||||
if ((size8 < size10) && (size9 < size10)) {
|
||||
size_b0 = size10;
|
||||
} else if ((size8 < size9) && (size10 < size9)) {
|
||||
size_b0 = size9;
|
||||
memctl->memc_mamr = CONFIG_SYS_MAMR_9COL;
|
||||
udelay (500);
|
||||
} else {
|
||||
size_b0 = size8;
|
||||
memctl->memc_mamr = CONFIG_SYS_MAMR_8COL;
|
||||
udelay (500);
|
||||
}
|
||||
debug ("SDRAM Bank 0: %ld MB\n", size_b0 >> 20);
|
||||
|
||||
#ifndef CONFIG_CAN_DRIVER
|
||||
if ((board_type != 'L') &&
|
||||
(board_type != 'M') &&
|
||||
(board_type != 'D') ) { /* only one SDRAM bank on L, M and D modules */
|
||||
/*
|
||||
* Check Bank 1 Memory Size
|
||||
* use current column settings
|
||||
* [9 column SDRAM may also be used in 8 column mode,
|
||||
* but then only half the real size will be used.]
|
||||
*/
|
||||
size_b1 = dram_size (memctl->memc_mamr, (long int *)SDRAM_BASE3_PRELIM,
|
||||
SDRAM_MAX_SIZE);
|
||||
debug ("SDRAM Bank 1: %ld MB\n", size_b1 >> 20);
|
||||
} else {
|
||||
size_b1 = 0;
|
||||
}
|
||||
#endif /* CONFIG_CAN_DRIVER */
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/*
|
||||
* Adjust refresh rate depending on SDRAM type, both banks
|
||||
* For types > 128 MBit leave it at the current (fast) rate
|
||||
*/
|
||||
if ((size_b0 < 0x02000000) && (size_b1 < 0x02000000)) {
|
||||
/* reduce to 15.6 us (62.4 us / quad) */
|
||||
memctl->memc_mptpr = CONFIG_SYS_MPTPR_2BK_4K;
|
||||
udelay (1000);
|
||||
}
|
||||
|
||||
/*
|
||||
* Final mapping: map bigger bank first
|
||||
*/
|
||||
if (size_b1 > size_b0) { /* SDRAM Bank 1 is bigger - map first */
|
||||
|
||||
memctl->memc_or3 = ((-size_b1) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
|
||||
memctl->memc_br3 = (CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
|
||||
|
||||
if (size_b0 > 0) {
|
||||
/*
|
||||
* Position Bank 0 immediately above Bank 1
|
||||
*/
|
||||
memctl->memc_or2 = ((-size_b0) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
|
||||
memctl->memc_br2 = ((CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V)
|
||||
+ size_b1;
|
||||
} else {
|
||||
unsigned long reg;
|
||||
|
||||
/*
|
||||
* No bank 0
|
||||
*
|
||||
* invalidate bank
|
||||
*/
|
||||
memctl->memc_br2 = 0;
|
||||
|
||||
/* adjust refresh rate depending on SDRAM type, one bank */
|
||||
reg = memctl->memc_mptpr;
|
||||
reg >>= 1; /* reduce to CONFIG_SYS_MPTPR_1BK_8K / _4K */
|
||||
memctl->memc_mptpr = reg;
|
||||
}
|
||||
|
||||
} else { /* SDRAM Bank 0 is bigger - map first */
|
||||
|
||||
memctl->memc_or2 = ((-size_b0) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
|
||||
memctl->memc_br2 =
|
||||
(CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
|
||||
|
||||
if (size_b1 > 0) {
|
||||
/*
|
||||
* Position Bank 1 immediately above Bank 0
|
||||
*/
|
||||
memctl->memc_or3 =
|
||||
((-size_b1) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
|
||||
memctl->memc_br3 =
|
||||
((CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V)
|
||||
+ size_b0;
|
||||
} else {
|
||||
unsigned long reg;
|
||||
|
||||
#ifndef CONFIG_CAN_DRIVER
|
||||
/*
|
||||
* No bank 1
|
||||
*
|
||||
* invalidate bank
|
||||
*/
|
||||
memctl->memc_br3 = 0;
|
||||
#endif /* CONFIG_CAN_DRIVER */
|
||||
|
||||
/* adjust refresh rate depending on SDRAM type, one bank */
|
||||
reg = memctl->memc_mptpr;
|
||||
reg >>= 1; /* reduce to CONFIG_SYS_MPTPR_1BK_8K / _4K */
|
||||
memctl->memc_mptpr = reg;
|
||||
}
|
||||
}
|
||||
|
||||
udelay (10000);
|
||||
|
||||
#ifdef CONFIG_CAN_DRIVER
|
||||
/* UPM initialization for CAN @ CLKOUT <= 66 MHz */
|
||||
|
||||
/* Initialize OR3 / BR3 */
|
||||
memctl->memc_or3 = CONFIG_SYS_OR3_CAN;
|
||||
memctl->memc_br3 = CONFIG_SYS_BR3_CAN;
|
||||
|
||||
/* Initialize MBMR */
|
||||
memctl->memc_mbmr = MBMR_GPL_B4DIS; /* GPL_B4 ouput line Disable */
|
||||
|
||||
/* Initialize UPMB for CAN: single read */
|
||||
memctl->memc_mdr = 0xFFFFCC04;
|
||||
memctl->memc_mcr = 0x0100 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0x0FFFD004;
|
||||
memctl->memc_mcr = 0x0101 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0x0FFFC000;
|
||||
memctl->memc_mcr = 0x0102 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0x3FFFC004;
|
||||
memctl->memc_mcr = 0x0103 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0xFFFFDC07;
|
||||
memctl->memc_mcr = 0x0104 | UPMB;
|
||||
|
||||
/* Initialize UPMB for CAN: single write */
|
||||
memctl->memc_mdr = 0xFFFCCC04;
|
||||
memctl->memc_mcr = 0x0118 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0xCFFCDC04;
|
||||
memctl->memc_mcr = 0x0119 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0x3FFCC000;
|
||||
memctl->memc_mcr = 0x011A | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0xFFFCC004;
|
||||
memctl->memc_mcr = 0x011B | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0xFFFDC405;
|
||||
memctl->memc_mcr = 0x011C | UPMB;
|
||||
#endif /* CONFIG_CAN_DRIVER */
|
||||
|
||||
#ifdef CONFIG_ISP1362_USB
|
||||
/* Initialize OR5 / BR5 */
|
||||
memctl->memc_or5 = CONFIG_SYS_OR5_ISP1362;
|
||||
memctl->memc_br5 = CONFIG_SYS_BR5_ISP1362;
|
||||
#endif /* CONFIG_ISP1362_USB */
|
||||
return (size_b0 + size_b1);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Check memory range for valid RAM. A simple memory test determines
|
||||
* the actually available RAM size between addresses `base' and
|
||||
* `base + maxsize'. Some (not all) hardware errors are detected:
|
||||
* - short between address lines
|
||||
* - short between data lines
|
||||
*/
|
||||
|
||||
static long int dram_size (long int mamr_value, long int *base, long int maxsize)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
|
||||
memctl->memc_mamr = mamr_value;
|
||||
|
||||
return (get_ram_size(base, maxsize));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_MISC_INIT_R
|
||||
extern void load_sernum_ethaddr(void);
|
||||
int misc_init_r (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
|
||||
load_sernum_ethaddr();
|
||||
|
||||
#ifdef CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ
|
||||
int scy, trlx, flash_or_timing, clk_diff;
|
||||
|
||||
scy = (CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ & OR_SCY_MSK) >> 4;
|
||||
if (CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ & OR_TRLX) {
|
||||
trlx = OR_TRLX;
|
||||
scy *= 2;
|
||||
} else {
|
||||
trlx = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* We assume that each 10MHz of bus clock require 1-clk SCY
|
||||
* adjustment.
|
||||
*/
|
||||
clk_diff = (gd->bus_clk / 1000000) - 50;
|
||||
|
||||
/*
|
||||
* We need proper rounding here. This is what the "+5" and "-5"
|
||||
* are here for.
|
||||
*/
|
||||
if (clk_diff >= 0)
|
||||
scy += (clk_diff + 5) / 10;
|
||||
else
|
||||
scy += (clk_diff - 5) / 10;
|
||||
|
||||
/*
|
||||
* For bus frequencies above 50MHz, we want to use relaxed timing
|
||||
* (OR_TRLX).
|
||||
*/
|
||||
if (gd->bus_clk >= 50000000)
|
||||
trlx = OR_TRLX;
|
||||
else
|
||||
trlx = 0;
|
||||
|
||||
if (trlx)
|
||||
scy /= 2;
|
||||
|
||||
if (scy > 0xf)
|
||||
scy = 0xf;
|
||||
if (scy < 1)
|
||||
scy = 1;
|
||||
|
||||
flash_or_timing = (scy << 4) | trlx |
|
||||
(CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ & ~(OR_TRLX | OR_SCY_MSK));
|
||||
|
||||
memctl->memc_or0 =
|
||||
flash_or_timing | (-flash_info[0].size & OR_AM_MSK);
|
||||
#else
|
||||
memctl->memc_or0 =
|
||||
CONFIG_SYS_OR_TIMING_FLASH | (-flash_info[0].size & OR_AM_MSK);
|
||||
#endif
|
||||
memctl->memc_br0 = (CONFIG_SYS_FLASH_BASE & BR_BA_MSK) | BR_MS_GPCM | BR_V;
|
||||
|
||||
debug ("## BR0: 0x%08x OR0: 0x%08x\n",
|
||||
memctl->memc_br0, memctl->memc_or0);
|
||||
|
||||
if (flash_info[1].size) {
|
||||
#ifdef CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ
|
||||
memctl->memc_or1 = flash_or_timing |
|
||||
(-flash_info[1].size & 0xFFFF8000);
|
||||
#else
|
||||
memctl->memc_or1 = CONFIG_SYS_OR_TIMING_FLASH |
|
||||
(-flash_info[1].size & 0xFFFF8000);
|
||||
#endif
|
||||
memctl->memc_br1 =
|
||||
((CONFIG_SYS_FLASH_BASE +
|
||||
flash_info[0].
|
||||
size) & BR_BA_MSK) | BR_MS_GPCM | BR_V;
|
||||
|
||||
debug ("## BR1: 0x%08x OR1: 0x%08x\n",
|
||||
memctl->memc_br1, memctl->memc_or1);
|
||||
} else {
|
||||
memctl->memc_br1 = 0; /* invalidate bank */
|
||||
|
||||
debug ("## DISABLE BR1: 0x%08x OR1: 0x%08x\n",
|
||||
memctl->memc_br1, memctl->memc_or1);
|
||||
}
|
||||
|
||||
# ifdef CONFIG_IDE_LED
|
||||
/* Configure PA15 as output port */
|
||||
immap->im_ioport.iop_padir |= 0x0001;
|
||||
immap->im_ioport.iop_paodr |= 0x0001;
|
||||
immap->im_ioport.iop_papar &= ~0x0001;
|
||||
immap->im_ioport.iop_padat &= ~0x0001; /* turn it off */
|
||||
# endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* CONFIG_MISC_INIT_R */
|
||||
|
||||
|
||||
# ifdef CONFIG_IDE_LED
|
||||
void ide_led (uchar led, uchar status)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
|
||||
|
||||
/* We have one led for both pcmcia slots */
|
||||
if (status) { /* led on */
|
||||
immap->im_ioport.iop_padat |= 0x0001;
|
||||
} else {
|
||||
immap->im_ioport.iop_padat &= ~0x0001;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
#ifdef CONFIG_LCD_INFO
|
||||
#include <lcd.h>
|
||||
#include <version.h>
|
||||
#include <timestamp.h>
|
||||
|
||||
void lcd_show_board_info(void)
|
||||
{
|
||||
char temp[32];
|
||||
|
||||
lcd_printf ("%s (%s - %s)\n", U_BOOT_VERSION, U_BOOT_DATE, U_BOOT_TIME);
|
||||
lcd_printf ("(C) 2008 DENX Software Engineering GmbH\n");
|
||||
lcd_printf (" Wolfgang DENK, wd@denx.de\n");
|
||||
#ifdef CONFIG_LCD_INFO_BELOW_LOGO
|
||||
lcd_printf ("MPC823 CPU at %s MHz\n",
|
||||
strmhz(temp, gd->cpu_clk));
|
||||
lcd_printf (" %ld MB RAM, %ld MB Flash\n",
|
||||
gd->ram_size >> 20,
|
||||
gd->bd->bi_flashsize >> 20 );
|
||||
#else
|
||||
/* leave one blank line */
|
||||
lcd_printf ("\nMPC823 CPU at %s MHz, %ld MB RAM, %ld MB Flash\n",
|
||||
strmhz(temp, gd->cpu_clk),
|
||||
gd->ram_size >> 20,
|
||||
gd->bd->bi_flashsize >> 20 );
|
||||
#endif /* CONFIG_LCD_INFO_BELOW_LOGO */
|
||||
}
|
||||
#endif /* CONFIG_LCD_INFO */
|
||||
|
||||
/*
|
||||
* Device Tree Support
|
||||
*/
|
||||
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
|
||||
int fdt_set_node_and_value (void *blob,
|
||||
char *nodename,
|
||||
char *regname,
|
||||
void *var,
|
||||
int size)
|
||||
{
|
||||
int ret = 0;
|
||||
int nodeoffset = 0;
|
||||
|
||||
nodeoffset = fdt_path_offset (blob, nodename);
|
||||
if (nodeoffset >= 0) {
|
||||
ret = fdt_setprop (blob, nodeoffset, regname, var,
|
||||
size);
|
||||
if (ret < 0) {
|
||||
printf("ft_blob_update(): "
|
||||
"cannot set %s/%s property; err: %s\n",
|
||||
nodename, regname, fdt_strerror (ret));
|
||||
}
|
||||
} else {
|
||||
printf("ft_blob_update(): "
|
||||
"cannot find %s node err:%s\n",
|
||||
nodename, fdt_strerror (nodeoffset));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int fdt_del_node_name (void *blob, char *nodename)
|
||||
{
|
||||
int ret = 0;
|
||||
int nodeoffset = 0;
|
||||
|
||||
nodeoffset = fdt_path_offset (blob, nodename);
|
||||
if (nodeoffset >= 0) {
|
||||
ret = fdt_del_node (blob, nodeoffset);
|
||||
if (ret < 0) {
|
||||
printf("%s: cannot delete %s; err: %s\n",
|
||||
__func__, nodename, fdt_strerror (ret));
|
||||
}
|
||||
} else {
|
||||
printf("%s: cannot find %s node err:%s\n",
|
||||
__func__, nodename, fdt_strerror (nodeoffset));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int fdt_del_prop_name (void *blob, char *nodename, char *propname)
|
||||
{
|
||||
int ret = 0;
|
||||
int nodeoffset = 0;
|
||||
|
||||
nodeoffset = fdt_path_offset (blob, nodename);
|
||||
if (nodeoffset >= 0) {
|
||||
ret = fdt_delprop (blob, nodeoffset, propname);
|
||||
if (ret < 0) {
|
||||
printf("%s: cannot delete %s %s; err: %s\n",
|
||||
__func__, nodename, propname,
|
||||
fdt_strerror (ret));
|
||||
}
|
||||
} else {
|
||||
printf("%s: cannot find %s node err:%s\n",
|
||||
__func__, nodename, fdt_strerror (nodeoffset));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* update "brg" property in the blob
|
||||
*/
|
||||
void ft_blob_update (void *blob, bd_t *bd)
|
||||
{
|
||||
uchar enetaddr[6];
|
||||
ulong brg_data = 0;
|
||||
|
||||
/* BRG */
|
||||
brg_data = cpu_to_be32(bd->bi_busfreq);
|
||||
fdt_set_node_and_value(blob,
|
||||
"/soc/cpm", "brg-frequency",
|
||||
&brg_data, sizeof(brg_data));
|
||||
|
||||
/* MAC addr */
|
||||
if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
|
||||
fdt_set_node_and_value(blob,
|
||||
"ethernet0", "local-mac-address",
|
||||
enetaddr, sizeof(u8) * 6);
|
||||
}
|
||||
|
||||
if (hwconfig_arg_cmp("fec", "off")) {
|
||||
/* no FEC on this plattform, delete DTS nodes */
|
||||
fdt_del_node_name (blob, "ethernet1");
|
||||
fdt_del_node_name (blob, "mdio1");
|
||||
/* also the aliases entries */
|
||||
fdt_del_prop_name (blob, "/aliases", "ethernet1");
|
||||
fdt_del_prop_name (blob, "/aliases", "mdio1");
|
||||
} else {
|
||||
/* adjust local-mac-address for FEC ethernet */
|
||||
if (eth_getenv_enetaddr("eth1addr", enetaddr)) {
|
||||
fdt_set_node_and_value(blob,
|
||||
"ethernet1", "local-mac-address",
|
||||
enetaddr, sizeof(u8) * 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
ft_cpu_setup(blob, bd);
|
||||
ft_blob_update(blob, bd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
|
||||
94
u-boot/board/tqc/tqm8xx/u-boot.lds
Normal file
94
u-boot/board/tqc/tqm8xx/u-boot.lds
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2012
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
arch/powerpc/cpu/mpc8xx/start.o (.text*)
|
||||
arch/powerpc/cpu/mpc8xx/traps.o (.text*)
|
||||
arch/powerpc/cpu/mpc8xx/built-in.o (.text*)
|
||||
arch/powerpc/lib/built-in.o (.text*)
|
||||
board/tqc/tqm8xx/built-in.o (.text*)
|
||||
disk/built-in.o (.text*)
|
||||
drivers/net/built-in.o (.text*)
|
||||
drivers/built-in.o (.text.pcmcia_on)
|
||||
drivers/built-in.o (.text.pcmcia_hardware_enable)
|
||||
|
||||
. = DEFINED(env_offset) ? env_offset : .;
|
||||
common/env_embedded.o (.ppcenv*)
|
||||
|
||||
*(.text*)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
|
||||
}
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x00FF) & 0xFFFFFF00;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
_GOT2_TABLE_ = .;
|
||||
KEEP(*(.got2))
|
||||
KEEP(*(.got))
|
||||
_FIXUP_TABLE_ = .;
|
||||
KEEP(*(.fixup))
|
||||
}
|
||||
__got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data*)
|
||||
*(.sdata*)
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
. = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.u_boot_list : {
|
||||
KEEP(*(SORT(.u_boot_list*)));
|
||||
}
|
||||
|
||||
|
||||
. = .;
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(256);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(256);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss (NOLOAD) :
|
||||
{
|
||||
*(.bss*)
|
||||
*(.sbss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
}
|
||||
__bss_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
75
u-boot/board/tqc/tqma6/Kconfig
Normal file
75
u-boot/board/tqc/tqma6/Kconfig
Normal file
@@ -0,0 +1,75 @@
|
||||
if TARGET_TQMA6
|
||||
|
||||
config SYS_BOARD
|
||||
default "tqma6"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "tqc"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "tqma6"
|
||||
|
||||
choice
|
||||
prompt "TQMa6 SoC variant"
|
||||
default TQMA6Q
|
||||
help
|
||||
select the TQMa6 module variant. The variants differing in the used
|
||||
i.MX6 CPU type and DRAM
|
||||
|
||||
config TQMA6Q
|
||||
bool "TQMa6Q / TQMa6D"
|
||||
select MX6Q
|
||||
help
|
||||
select TQMa6Q / TQMa6D with i.MX6Q/D and 1GiB DRAM
|
||||
|
||||
config TQMA6S
|
||||
bool "TQMa6S"
|
||||
select MX6S
|
||||
help
|
||||
select TQMa6S with i.MX6S and 512 MiB DRAM
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "TQMa6 boot configuration"
|
||||
default TQMA6X_MMC_BOOT
|
||||
help
|
||||
Configure boot device. This is also used to implement environment
|
||||
location.
|
||||
|
||||
config TQMA6X_MMC_BOOT
|
||||
bool "MMC / SD Boot"
|
||||
help
|
||||
Boot from eMMC / SD Card
|
||||
|
||||
config TQMA6X_SPI_BOOT
|
||||
bool "SPI NOR Boot"
|
||||
help
|
||||
Boot from on board SPI NOR flash
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "TQMa6 base board variant"
|
||||
default MBA6
|
||||
help
|
||||
Select base board for TQMa6
|
||||
|
||||
config MBA6
|
||||
bool "TQMa6 on MBa6 Starterkit"
|
||||
help
|
||||
Select the MBa6 starterkit. This features a GigE Phy, USB, SD-Card
|
||||
etc.
|
||||
|
||||
config WRU4
|
||||
bool "OHB WRU-IV"
|
||||
help
|
||||
Select the OHB Systems AG WRU-IV baseboard.
|
||||
|
||||
endchoice
|
||||
|
||||
config IMX_CONFIG
|
||||
default "board/tqc/tqma6/tqma6q.cfg" if TQMA6Q
|
||||
default "board/tqc/tqma6/tqma6s.cfg" if TQMA6S
|
||||
|
||||
endif
|
||||
6
u-boot/board/tqc/tqma6/MAINTAINERS
Normal file
6
u-boot/board/tqc/tqma6/MAINTAINERS
Normal file
@@ -0,0 +1,6 @@
|
||||
TQ SYSTEMS TQMA6 BOARD
|
||||
M: Markus Niebel <Markus.Niebel@tq-group.com>
|
||||
S: Maintained
|
||||
F: board/tqc/tqma6/
|
||||
F: include/configs/tqma6.h
|
||||
F: configs/tqma6*_defconfig
|
||||
10
u-boot/board/tqc/tqma6/Makefile
Normal file
10
u-boot/board/tqc/tqma6/Makefile
Normal file
@@ -0,0 +1,10 @@
|
||||
#
|
||||
# Copyright (C) 2014, Markus Niebel <Markus.Niebel@tq-group.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y := tqma6.o
|
||||
|
||||
obj-$(CONFIG_MBA6) += tqma6_mba6.o
|
||||
obj-$(CONFIG_WRU4) += tqma6_wru4.o
|
||||
35
u-boot/board/tqc/tqma6/README
Normal file
35
u-boot/board/tqc/tqma6/README
Normal file
@@ -0,0 +1,35 @@
|
||||
U-Boot for the TQ Systems TQMa6 modules
|
||||
|
||||
This file contains information for the port of
|
||||
U-Boot to the TQ Systems TQMa6 modules.
|
||||
|
||||
1. Boot source
|
||||
--------------
|
||||
|
||||
The following boot source is supported:
|
||||
|
||||
- SD/eMMC
|
||||
- SPI NOR
|
||||
|
||||
2. Building
|
||||
------------
|
||||
|
||||
To build U-Boot for the TQ Systems TQMa6 modules:
|
||||
|
||||
make tqma6<x>_<baseboard>_<boot>_config
|
||||
make
|
||||
|
||||
x is a placeholder for the CPU variant
|
||||
q - means i.MX6Q/D: TQMa6Q (i.MX6Q) and TQMa6D (i.MX6D)
|
||||
s - means i.MX6S: TQMa6S (i.MX6S)
|
||||
|
||||
baseboard is a placeholder for the boot device
|
||||
mmc - means eMMC
|
||||
spi - mean SPI NOR
|
||||
|
||||
This gives the following configurations:
|
||||
|
||||
tqma6q_mba6_mmc_config
|
||||
tqma6q_mba6_spi_config
|
||||
tqma6s_mba6_mmc_config
|
||||
tqma6s_mba6_spi_config
|
||||
24
u-boot/board/tqc/tqma6/clocks.cfg
Normal file
24
u-boot/board/tqc/tqma6/clocks.cfg
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Boundary Devices
|
||||
* Copyright (C) 2013, 2014 Markus Niebel <Markus.Niebel@tq-group.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*
|
||||
* Refer doc/README.imximage for more details about how-to configure
|
||||
* and create imximage boot image
|
||||
*/
|
||||
|
||||
/* set the default clock gate to save power */
|
||||
DATA 4, CCM_CCGR0, 0x00C03F3F
|
||||
DATA 4, CCM_CCGR1, 0x0030FC03
|
||||
DATA 4, CCM_CCGR2, 0x0FFFC000
|
||||
DATA 4, CCM_CCGR3, 0x3FF00000
|
||||
DATA 4, CCM_CCGR4, 0x00FFF300
|
||||
DATA 4, CCM_CCGR5, 0x0F0000C3
|
||||
DATA 4, CCM_CCGR6, 0x000003FF
|
||||
|
||||
/* enable AXI cache for VDOA/VPU/IPU */
|
||||
DATA 4, MX6_IOMUXC_GPR4, 0xF00000CF
|
||||
/* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
|
||||
DATA 4, MX6_IOMUXC_GPR6, 0x007F007F
|
||||
DATA 4, MX6_IOMUXC_GPR7, 0x007F007F
|
||||
280
u-boot/board/tqc/tqma6/tqma6.c
Normal file
280
u-boot/board/tqc/tqma6/tqma6.c
Normal file
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Freescale Semiconductor, Inc.
|
||||
* Author: Fabio Estevam <fabio.estevam@freescale.com>
|
||||
*
|
||||
* Copyright (C) 2013, 2014 TQ Systems (ported SabreSD to TQMa6x)
|
||||
* Author: Markus Niebel <markus.niebel@tq-group.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/arch/mx6-pins.h>
|
||||
#include <asm/arch/imx-regs.h>
|
||||
#include <asm/arch/iomux.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#include <asm/errno.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/imx-common/mxc_i2c.h>
|
||||
#include <asm/imx-common/spi.h>
|
||||
#include <common.h>
|
||||
#include <fsl_esdhc.h>
|
||||
#include <libfdt.h>
|
||||
#include <i2c.h>
|
||||
#include <mmc.h>
|
||||
#include <power/pfuze100_pmic.h>
|
||||
#include <power/pmic.h>
|
||||
#include <spi_flash.h>
|
||||
|
||||
#include "tqma6_bb.h"
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#define USDHC_CLK_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
|
||||
|
||||
#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
|
||||
|
||||
#define GPIO_OUT_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
|
||||
|
||||
#define GPIO_IN_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
|
||||
|
||||
#define SPI_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
|
||||
PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
|
||||
|
||||
#define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
|
||||
PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
|
||||
PAD_CTL_ODE | PAD_CTL_SRE_FAST)
|
||||
|
||||
int dram_init(void)
|
||||
{
|
||||
gd->ram_size = imx_ddr_size();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const uint16_t tqma6_emmc_dsr = 0x0100;
|
||||
|
||||
/* eMMC on USDHCI3 always present */
|
||||
static iomux_v3_cfg_t const tqma6_usdhc3_pads[] = {
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_CLK__SD3_CLK, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_CMD__SD3_CMD, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_DAT0__SD3_DATA0, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_DAT1__SD3_DATA1, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_DAT2__SD3_DATA2, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_DAT3__SD3_DATA3, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_DAT4__SD3_DATA4, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_DAT5__SD3_DATA5, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_DAT6__SD3_DATA6, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_DAT7__SD3_DATA7, USDHC_PAD_CTRL),
|
||||
/* eMMC reset */
|
||||
NEW_PAD_CTRL(MX6_PAD_SD3_RST__SD3_RESET, GPIO_OUT_PAD_CTRL),
|
||||
};
|
||||
|
||||
/*
|
||||
* According to board_mmc_init() the following map is done:
|
||||
* (U-Boot device node) (Physical Port)
|
||||
* mmc0 eMMC (SD3) on TQMa6
|
||||
* mmc1 .. n optional slots used on baseboard
|
||||
*/
|
||||
struct fsl_esdhc_cfg tqma6_usdhc_cfg = {
|
||||
.esdhc_base = USDHC3_BASE_ADDR,
|
||||
.max_bus_width = 8,
|
||||
};
|
||||
|
||||
int board_mmc_getcd(struct mmc *mmc)
|
||||
{
|
||||
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
|
||||
int ret = 0;
|
||||
|
||||
if (cfg->esdhc_base == USDHC3_BASE_ADDR)
|
||||
/* eMMC/uSDHC3 is always present */
|
||||
ret = 1;
|
||||
else
|
||||
ret = tqma6_bb_board_mmc_getcd(mmc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int board_mmc_getwp(struct mmc *mmc)
|
||||
{
|
||||
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
|
||||
int ret = 0;
|
||||
|
||||
if (cfg->esdhc_base == USDHC3_BASE_ADDR)
|
||||
/* eMMC/uSDHC3 is always present */
|
||||
ret = 0;
|
||||
else
|
||||
ret = tqma6_bb_board_mmc_getwp(mmc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int board_mmc_init(bd_t *bis)
|
||||
{
|
||||
imx_iomux_v3_setup_multiple_pads(tqma6_usdhc3_pads,
|
||||
ARRAY_SIZE(tqma6_usdhc3_pads));
|
||||
tqma6_usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
|
||||
if (fsl_esdhc_initialize(bis, &tqma6_usdhc_cfg)) {
|
||||
puts("Warning: failed to initialize eMMC dev\n");
|
||||
} else {
|
||||
struct mmc *mmc = find_mmc_device(0);
|
||||
if (mmc)
|
||||
mmc_set_dsr(mmc, tqma6_emmc_dsr);
|
||||
}
|
||||
|
||||
tqma6_bb_board_mmc_init(bis);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static iomux_v3_cfg_t const tqma6_ecspi1_pads[] = {
|
||||
/* SS1 */
|
||||
NEW_PAD_CTRL(MX6_PAD_EIM_D19__GPIO3_IO19, SPI_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_EIM_D16__ECSPI1_SCLK, SPI_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_EIM_D17__ECSPI1_MISO, SPI_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_EIM_D18__ECSPI1_MOSI, SPI_PAD_CTRL),
|
||||
};
|
||||
|
||||
#define TQMA6_SF_CS_GPIO IMX_GPIO_NR(3, 19)
|
||||
|
||||
static unsigned const tqma6_ecspi1_cs[] = {
|
||||
TQMA6_SF_CS_GPIO,
|
||||
};
|
||||
|
||||
__weak void tqma6_iomuxc_spi(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tqma6_ecspi1_cs); ++i)
|
||||
gpio_direction_output(tqma6_ecspi1_cs[i], 1);
|
||||
imx_iomux_v3_setup_multiple_pads(tqma6_ecspi1_pads,
|
||||
ARRAY_SIZE(tqma6_ecspi1_pads));
|
||||
}
|
||||
|
||||
int board_spi_cs_gpio(unsigned bus, unsigned cs)
|
||||
{
|
||||
return ((bus == CONFIG_SF_DEFAULT_BUS) &&
|
||||
(cs == CONFIG_SF_DEFAULT_CS)) ? TQMA6_SF_CS_GPIO : -1;
|
||||
}
|
||||
|
||||
static struct i2c_pads_info tqma6_i2c3_pads = {
|
||||
/* I2C3: on board LM75, M24C64, */
|
||||
.scl = {
|
||||
.i2c_mode = NEW_PAD_CTRL(MX6_PAD_GPIO_5__I2C3_SCL,
|
||||
I2C_PAD_CTRL),
|
||||
.gpio_mode = NEW_PAD_CTRL(MX6_PAD_GPIO_5__GPIO1_IO05,
|
||||
I2C_PAD_CTRL),
|
||||
.gp = IMX_GPIO_NR(1, 5)
|
||||
},
|
||||
.sda = {
|
||||
.i2c_mode = NEW_PAD_CTRL(MX6_PAD_GPIO_6__I2C3_SDA,
|
||||
I2C_PAD_CTRL),
|
||||
.gpio_mode = NEW_PAD_CTRL(MX6_PAD_GPIO_6__GPIO1_IO06,
|
||||
I2C_PAD_CTRL),
|
||||
.gp = IMX_GPIO_NR(1, 6)
|
||||
}
|
||||
};
|
||||
|
||||
static void tqma6_setup_i2c(void)
|
||||
{
|
||||
int ret;
|
||||
/*
|
||||
* use logical index for bus, e.g. I2C1 -> 0
|
||||
* warn on error
|
||||
*/
|
||||
ret = setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &tqma6_i2c3_pads);
|
||||
if (ret)
|
||||
printf("setup I2C3 failed: %d\n", ret);
|
||||
}
|
||||
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
return tqma6_bb_board_early_init_f();
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
/* address of boot parameters */
|
||||
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
|
||||
|
||||
tqma6_iomuxc_spi();
|
||||
tqma6_setup_i2c();
|
||||
|
||||
tqma6_bb_board_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *tqma6_get_boardname(void)
|
||||
{
|
||||
u32 cpurev = get_cpu_rev();
|
||||
|
||||
switch ((cpurev & 0xFF000) >> 12) {
|
||||
case MXC_CPU_MX6SOLO:
|
||||
return "TQMa6S";
|
||||
break;
|
||||
case MXC_CPU_MX6DL:
|
||||
return "TQMa6DL";
|
||||
break;
|
||||
case MXC_CPU_MX6D:
|
||||
return "TQMa6D";
|
||||
break;
|
||||
case MXC_CPU_MX6Q:
|
||||
return "TQMa6Q";
|
||||
break;
|
||||
default:
|
||||
return "??";
|
||||
};
|
||||
}
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
struct pmic *p;
|
||||
u32 reg;
|
||||
|
||||
setenv("board_name", tqma6_get_boardname());
|
||||
|
||||
/*
|
||||
* configure PFUZE100 PMIC:
|
||||
* TODO: should go to power_init_board if bus switching is
|
||||
* fixed in generic power code
|
||||
*/
|
||||
power_pfuze100_init(TQMA6_PFUZE100_I2C_BUS);
|
||||
p = pmic_get("PFUZE100");
|
||||
if (p && !pmic_probe(p)) {
|
||||
pmic_reg_read(p, PFUZE100_DEVICEID, ®);
|
||||
printf("PMIC: PFUZE100 ID=0x%02x\n", reg);
|
||||
}
|
||||
|
||||
tqma6_bb_board_late_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int checkboard(void)
|
||||
{
|
||||
printf("Board: %s on a %s\n", tqma6_get_boardname(),
|
||||
tqma6_bb_get_boardname());
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Device Tree Support
|
||||
*/
|
||||
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
|
||||
int ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
/* bring in eMMC dsr settings */
|
||||
do_fixup_by_path_u32(blob,
|
||||
"/soc/aips-bus@02100000/usdhc@02198000",
|
||||
"dsr", tqma6_emmc_dsr, 2);
|
||||
tqma6_bb_ft_board_setup(blob, bd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
|
||||
30
u-boot/board/tqc/tqma6/tqma6_bb.h
Normal file
30
u-boot/board/tqc/tqma6/tqma6_bb.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2013, 2014 TQ Systems
|
||||
* Author: Markus Niebel <markus.niebel@tq-group.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __TQMA6_BB__
|
||||
#define __TQMA6_BB__
|
||||
|
||||
#include <common.h>
|
||||
|
||||
int tqma6_bb_board_mmc_getwp(struct mmc *mmc);
|
||||
int tqma6_bb_board_mmc_getcd(struct mmc *mmc);
|
||||
int tqma6_bb_board_mmc_init(bd_t *bis);
|
||||
|
||||
int tqma6_bb_board_early_init_f(void);
|
||||
int tqma6_bb_board_init(void);
|
||||
int tqma6_bb_board_late_init(void);
|
||||
int tqma6_bb_checkboard(void);
|
||||
|
||||
const char *tqma6_bb_get_boardname(void);
|
||||
/*
|
||||
* Device Tree Support
|
||||
*/
|
||||
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
|
||||
void tqma6_bb_ft_board_setup(void *blob, bd_t *bd);
|
||||
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
|
||||
|
||||
#endif
|
||||
369
u-boot/board/tqc/tqma6/tqma6_mba6.c
Normal file
369
u-boot/board/tqc/tqma6/tqma6_mba6.c
Normal file
@@ -0,0 +1,369 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Freescale Semiconductor, Inc.
|
||||
* Author: Fabio Estevam <fabio.estevam@freescale.com>
|
||||
*
|
||||
* Copyright (C) 2013, 2014 TQ Systems (ported SabreSD to TQMa6x)
|
||||
* Author: Markus Niebel <markus.niebel@tq-group.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/arch/mx6-pins.h>
|
||||
#include <asm/arch/imx-regs.h>
|
||||
#include <asm/arch/iomux.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#include <asm/errno.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/imx-common/mxc_i2c.h>
|
||||
|
||||
#include <common.h>
|
||||
#include <fsl_esdhc.h>
|
||||
#include <libfdt.h>
|
||||
#include <malloc.h>
|
||||
#include <i2c.h>
|
||||
#include <micrel.h>
|
||||
#include <miiphy.h>
|
||||
#include <mmc.h>
|
||||
#include <netdev.h>
|
||||
|
||||
#include "tqma6_bb.h"
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
|
||||
PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
|
||||
|
||||
#define USDHC_CLK_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
|
||||
|
||||
#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
|
||||
|
||||
#define GPIO_OUT_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
|
||||
|
||||
#define GPIO_IN_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
|
||||
|
||||
#define SPI_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
|
||||
PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
|
||||
|
||||
#define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
|
||||
PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
|
||||
PAD_CTL_ODE | PAD_CTL_SRE_FAST)
|
||||
|
||||
#if defined(CONFIG_MX6Q)
|
||||
|
||||
#define IOMUX_SW_PAD_CTRL_GRP_DDR_TYPE_RGMII 0x02e0790
|
||||
#define IOMUX_SW_PAD_CTRL_GRP_RGMII_TERM 0x02e07ac
|
||||
|
||||
#elif defined(CONFIG_MX6S)
|
||||
|
||||
#define IOMUX_SW_PAD_CTRL_GRP_DDR_TYPE_RGMII 0x02e0768
|
||||
#define IOMUX_SW_PAD_CTRL_GRP_RGMII_TERM 0x02e0788
|
||||
|
||||
#else
|
||||
|
||||
#error "need to define target CPU"
|
||||
|
||||
#endif
|
||||
|
||||
#define ENET_RX_PAD_CTRL (PAD_CTL_DSE_34ohm)
|
||||
#define ENET_TX_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_DSE_34ohm)
|
||||
#define ENET_CLK_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_HIGH | \
|
||||
PAD_CTL_DSE_34ohm)
|
||||
#define ENET_MDIO_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
|
||||
PAD_CTL_DSE_60ohm)
|
||||
|
||||
/* disable on die termination for RGMII */
|
||||
#define IOMUX_SW_PAD_CTRL_GRP_RGMII_TERM_DISABLE 0x00000000
|
||||
/* optimised drive strength for 1.0 .. 1.3 V signal on RGMII */
|
||||
#define IOMUX_SW_PAD_CTRL_GRP_DDR_TYPE_RGMII_1P2V 0x00080000
|
||||
/* optimised drive strength for 1.3 .. 2.5 V signal on RGMII */
|
||||
#define IOMUX_SW_PAD_CTRL_GRP_DDR_TYPE_RGMII_1P5V 0x000C0000
|
||||
|
||||
#define ENET_PHY_RESET_GPIO IMX_GPIO_NR(1, 25)
|
||||
|
||||
static iomux_v3_cfg_t const mba6_enet_pads[] = {
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_MDIO__ENET_MDIO, ENET_MDIO_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_MDC__ENET_MDC, ENET_MDIO_PAD_CTRL),
|
||||
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_TXC__RGMII_TXC, ENET_TX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_TD0__RGMII_TD0, ENET_TX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_TD1__RGMII_TD1, ENET_TX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_TD2__RGMII_TD2, ENET_TX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_TD3__RGMII_TD3, ENET_TX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL,
|
||||
ENET_TX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_REF_CLK__ENET_TX_CLK, ENET_CLK_PAD_CTRL),
|
||||
/*
|
||||
* these pins are also used for config strapping by phy
|
||||
*/
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_RD0__RGMII_RD0, ENET_RX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_RD1__RGMII_RD1, ENET_RX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_RD2__RGMII_RD2, ENET_RX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_RD3__RGMII_RD3, ENET_RX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_RXC__RGMII_RXC, ENET_RX_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL,
|
||||
ENET_RX_PAD_CTRL),
|
||||
/* KSZ9031 PHY Reset */
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_CRS_DV__GPIO1_IO25, GPIO_OUT_PAD_CTRL),
|
||||
};
|
||||
|
||||
static void mba6_setup_iomuxc_enet(void)
|
||||
{
|
||||
__raw_writel(IOMUX_SW_PAD_CTRL_GRP_RGMII_TERM_DISABLE,
|
||||
(void *)IOMUX_SW_PAD_CTRL_GRP_RGMII_TERM);
|
||||
__raw_writel(IOMUX_SW_PAD_CTRL_GRP_DDR_TYPE_RGMII_1P5V,
|
||||
(void *)IOMUX_SW_PAD_CTRL_GRP_DDR_TYPE_RGMII);
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(mba6_enet_pads,
|
||||
ARRAY_SIZE(mba6_enet_pads));
|
||||
|
||||
/* Reset PHY */
|
||||
gpio_direction_output(ENET_PHY_RESET_GPIO , 0);
|
||||
/* Need delay 10ms after power on according to KSZ9031 spec */
|
||||
udelay(1000 * 10);
|
||||
gpio_set_value(ENET_PHY_RESET_GPIO, 1);
|
||||
/*
|
||||
* KSZ9031 manual: 100 usec wait time after reset before communication
|
||||
* over MDIO
|
||||
* BUGBUG: hardware has an RC const that needs > 10 msec from 0->1 on
|
||||
* reset before the phy sees a high level
|
||||
*/
|
||||
udelay(200);
|
||||
}
|
||||
|
||||
static iomux_v3_cfg_t const mba6_uart2_pads[] = {
|
||||
NEW_PAD_CTRL(MX6_PAD_SD4_DAT4__UART2_RX_DATA, UART_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD4_DAT7__UART2_TX_DATA, UART_PAD_CTRL),
|
||||
};
|
||||
|
||||
static void mba6_setup_iomuxc_uart(void)
|
||||
{
|
||||
imx_iomux_v3_setup_multiple_pads(mba6_uart2_pads,
|
||||
ARRAY_SIZE(mba6_uart2_pads));
|
||||
}
|
||||
|
||||
#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4)
|
||||
#define USDHC2_WP_GPIO IMX_GPIO_NR(1, 2)
|
||||
|
||||
int tqma6_bb_board_mmc_getcd(struct mmc *mmc)
|
||||
{
|
||||
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
|
||||
int ret = 0;
|
||||
|
||||
if (cfg->esdhc_base == USDHC2_BASE_ADDR)
|
||||
ret = !gpio_get_value(USDHC2_CD_GPIO);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tqma6_bb_board_mmc_getwp(struct mmc *mmc)
|
||||
{
|
||||
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
|
||||
int ret = 0;
|
||||
|
||||
if (cfg->esdhc_base == USDHC2_BASE_ADDR)
|
||||
ret = gpio_get_value(USDHC2_WP_GPIO);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct fsl_esdhc_cfg mba6_usdhc_cfg = {
|
||||
.esdhc_base = USDHC2_BASE_ADDR,
|
||||
.max_bus_width = 4,
|
||||
};
|
||||
|
||||
static iomux_v3_cfg_t const mba6_usdhc2_pads[] = {
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_CLK__SD2_CLK, USDHC_CLK_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_CMD__SD2_CMD, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_DAT0__SD2_DATA0, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_DAT1__SD2_DATA1, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_DAT2__SD2_DATA2, USDHC_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_DAT3__SD2_DATA3, USDHC_PAD_CTRL),
|
||||
/* CD */
|
||||
NEW_PAD_CTRL(MX6_PAD_GPIO_4__GPIO1_IO04, GPIO_IN_PAD_CTRL),
|
||||
/* WP */
|
||||
NEW_PAD_CTRL(MX6_PAD_GPIO_2__GPIO1_IO02, GPIO_IN_PAD_CTRL),
|
||||
};
|
||||
|
||||
int tqma6_bb_board_mmc_init(bd_t *bis)
|
||||
{
|
||||
imx_iomux_v3_setup_multiple_pads(mba6_usdhc2_pads,
|
||||
ARRAY_SIZE(mba6_usdhc2_pads));
|
||||
gpio_direction_input(USDHC2_CD_GPIO);
|
||||
gpio_direction_input(USDHC2_WP_GPIO);
|
||||
|
||||
mba6_usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
|
||||
if (fsl_esdhc_initialize(bis, &mba6_usdhc_cfg))
|
||||
puts("Warning: failed to initialize SD\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_pads_info mba6_i2c1_pads = {
|
||||
/* I2C1: MBa6x */
|
||||
.scl = {
|
||||
.i2c_mode = NEW_PAD_CTRL(MX6_PAD_CSI0_DAT9__I2C1_SCL,
|
||||
I2C_PAD_CTRL),
|
||||
.gpio_mode = NEW_PAD_CTRL(MX6_PAD_CSI0_DAT9__GPIO5_IO27,
|
||||
I2C_PAD_CTRL),
|
||||
.gp = IMX_GPIO_NR(5, 27)
|
||||
},
|
||||
.sda = {
|
||||
.i2c_mode = NEW_PAD_CTRL(MX6_PAD_CSI0_DAT8__I2C1_SDA,
|
||||
I2C_PAD_CTRL),
|
||||
.gpio_mode = NEW_PAD_CTRL(MX6_PAD_CSI0_DAT8__GPIO5_IO26,
|
||||
I2C_PAD_CTRL),
|
||||
.gp = IMX_GPIO_NR(5, 26)
|
||||
}
|
||||
};
|
||||
|
||||
static void mba6_setup_i2c(void)
|
||||
{
|
||||
int ret;
|
||||
/*
|
||||
* use logical index for bus, e.g. I2C1 -> 0
|
||||
* warn on error
|
||||
*/
|
||||
ret = setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &mba6_i2c1_pads);
|
||||
if (ret)
|
||||
printf("setup I2C1 failed: %d\n", ret);
|
||||
}
|
||||
|
||||
|
||||
static iomux_v3_cfg_t const mba6_ecspi1_pads[] = {
|
||||
NEW_PAD_CTRL(MX6_PAD_EIM_D24__GPIO3_IO24, SPI_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_EIM_D25__GPIO3_IO25, SPI_PAD_CTRL),
|
||||
};
|
||||
|
||||
static unsigned const mba6_ecspi1_cs[] = {
|
||||
IMX_GPIO_NR(3, 24),
|
||||
IMX_GPIO_NR(3, 25),
|
||||
};
|
||||
|
||||
static void mba6_setup_iomuxc_spi(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mba6_ecspi1_cs); ++i)
|
||||
gpio_direction_output(mba6_ecspi1_cs[i], 1);
|
||||
imx_iomux_v3_setup_multiple_pads(mba6_ecspi1_pads,
|
||||
ARRAY_SIZE(mba6_ecspi1_pads));
|
||||
}
|
||||
|
||||
int board_phy_config(struct phy_device *phydev)
|
||||
{
|
||||
/*
|
||||
* optimized pad skew values depends on CPU variant on the TQMa6x module:
|
||||
* i.MX6Q/D or i.MX6DL/S
|
||||
*/
|
||||
#if defined(CONFIG_MX6Q) || defined(CONFIG_MX6Q)
|
||||
#define MBA6X_KSZ9031_CTRL_SKEW 0x0032
|
||||
#define MBA6X_KSZ9031_CLK_SKEW 0x03ff
|
||||
#define MBA6X_KSZ9031_RX_SKEW 0x3333
|
||||
#define MBA6X_KSZ9031_TX_SKEW 0x2036
|
||||
#elif defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
|
||||
#define MBA6X_KSZ9031_CTRL_SKEW 0x0030
|
||||
#define MBA6X_KSZ9031_CLK_SKEW 0x03ff
|
||||
#define MBA6X_KSZ9031_RX_SKEW 0x3333
|
||||
#define MBA6X_KSZ9031_TX_SKEW 0x2052
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
/* min rx/tx ctrl delay */
|
||||
ksz9031_phy_extended_write(phydev, 2,
|
||||
MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW,
|
||||
MII_KSZ9031_MOD_DATA_NO_POST_INC,
|
||||
MBA6X_KSZ9031_CTRL_SKEW);
|
||||
/* min rx delay */
|
||||
ksz9031_phy_extended_write(phydev, 2,
|
||||
MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW,
|
||||
MII_KSZ9031_MOD_DATA_NO_POST_INC,
|
||||
MBA6X_KSZ9031_RX_SKEW);
|
||||
/* max tx delay */
|
||||
ksz9031_phy_extended_write(phydev, 2,
|
||||
MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW,
|
||||
MII_KSZ9031_MOD_DATA_NO_POST_INC,
|
||||
MBA6X_KSZ9031_TX_SKEW);
|
||||
/* rx/tx clk skew */
|
||||
ksz9031_phy_extended_write(phydev, 2,
|
||||
MII_KSZ9031_EXT_RGMII_CLOCK_SKEW,
|
||||
MII_KSZ9031_MOD_DATA_NO_POST_INC,
|
||||
MBA6X_KSZ9031_CLK_SKEW);
|
||||
|
||||
phydev->drv->config(phydev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_eth_init(bd_t *bis)
|
||||
{
|
||||
uint32_t base = IMX_FEC_BASE;
|
||||
struct mii_dev *bus = NULL;
|
||||
struct phy_device *phydev = NULL;
|
||||
int ret;
|
||||
|
||||
bus = fec_get_miibus(base, -1);
|
||||
if (!bus)
|
||||
return -EINVAL;
|
||||
/* scan phy */
|
||||
phydev = phy_find_by_mask(bus, (0xf << CONFIG_FEC_MXC_PHYADDR),
|
||||
PHY_INTERFACE_MODE_RGMII);
|
||||
|
||||
if (!phydev) {
|
||||
ret = -EINVAL;
|
||||
goto free_bus;
|
||||
}
|
||||
ret = fec_probe(bis, -1, base, bus, phydev);
|
||||
if (ret)
|
||||
goto free_phydev;
|
||||
|
||||
return 0;
|
||||
|
||||
free_phydev:
|
||||
free(phydev);
|
||||
free_bus:
|
||||
free(bus);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tqma6_bb_board_early_init_f(void)
|
||||
{
|
||||
mba6_setup_iomuxc_uart();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tqma6_bb_board_init(void)
|
||||
{
|
||||
mba6_setup_i2c();
|
||||
mba6_setup_iomuxc_spi();
|
||||
/* do it here - to have reset completed */
|
||||
mba6_setup_iomuxc_enet();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tqma6_bb_board_late_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *tqma6_bb_get_boardname(void)
|
||||
{
|
||||
return "MBa6x";
|
||||
}
|
||||
|
||||
/*
|
||||
* Device Tree Support
|
||||
*/
|
||||
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
|
||||
void tqma6_bb_ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
/* TBD */
|
||||
}
|
||||
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
|
||||
346
u-boot/board/tqc/tqma6/tqma6_wru4.c
Normal file
346
u-boot/board/tqc/tqma6/tqma6_wru4.c
Normal file
@@ -0,0 +1,346 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Freescale Semiconductor, Inc.
|
||||
* Author: Fabio Estevam <fabio.estevam@freescale.com>
|
||||
*
|
||||
* Copyright (C) 2013, 2014 TQ Systems (ported SabreSD to TQMa6x)
|
||||
* Author: Markus Niebel <markus.niebel@tq-group.com>
|
||||
*
|
||||
* Copyright (C) 2015 Stefan Roese <sr@denx.de>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/arch/mx6-pins.h>
|
||||
#include <asm/arch/imx-regs.h>
|
||||
#include <asm/arch/iomux.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#include <asm/errno.h>
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/imx-common/boot_mode.h>
|
||||
#include <asm/imx-common/mxc_i2c.h>
|
||||
|
||||
#include <common.h>
|
||||
#include <fsl_esdhc.h>
|
||||
#include <libfdt.h>
|
||||
#include <malloc.h>
|
||||
#include <i2c.h>
|
||||
#include <micrel.h>
|
||||
#include <miiphy.h>
|
||||
#include <mmc.h>
|
||||
#include <netdev.h>
|
||||
|
||||
#include "tqma6_bb.h"
|
||||
|
||||
/* UART */
|
||||
#define UART4_PAD_CTRL ( \
|
||||
PAD_CTL_HYS | \
|
||||
PAD_CTL_PUS_100K_UP | \
|
||||
PAD_CTL_PUE | \
|
||||
PAD_CTL_PKE | \
|
||||
PAD_CTL_SPEED_MED | \
|
||||
PAD_CTL_DSE_40ohm | \
|
||||
PAD_CTL_SRE_SLOW \
|
||||
)
|
||||
|
||||
static iomux_v3_cfg_t const uart4_pads[] = {
|
||||
NEW_PAD_CTRL(MX6_PAD_CSI0_DAT17__UART4_CTS_B, UART4_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_CSI0_DAT16__UART4_RTS_B, UART4_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_CSI0_DAT13__UART4_RX_DATA, UART4_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_CSI0_DAT12__UART4_TX_DATA, UART4_PAD_CTRL),
|
||||
};
|
||||
|
||||
static void setup_iomuxc_uart4(void)
|
||||
{
|
||||
imx_iomux_v3_setup_multiple_pads(uart4_pads, ARRAY_SIZE(uart4_pads));
|
||||
}
|
||||
|
||||
/* MMC */
|
||||
#define USDHC2_PAD_CTRL ( \
|
||||
PAD_CTL_HYS | \
|
||||
PAD_CTL_PUS_47K_UP | \
|
||||
PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_80ohm | \
|
||||
PAD_CTL_SRE_FAST \
|
||||
)
|
||||
|
||||
#define USDHC2_CLK_PAD_CTRL ( \
|
||||
PAD_CTL_HYS | \
|
||||
PAD_CTL_PUS_47K_UP | \
|
||||
PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_40ohm | \
|
||||
PAD_CTL_SRE_FAST \
|
||||
)
|
||||
|
||||
static iomux_v3_cfg_t const usdhc2_pads[] = {
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_CLK__SD2_CLK, USDHC2_CLK_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_CMD__SD2_CMD, USDHC2_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_DAT0__SD2_DATA0, USDHC2_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_DAT1__SD2_DATA1, USDHC2_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_DAT2__SD2_DATA2, USDHC2_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_SD2_DAT3__SD2_DATA3, USDHC2_PAD_CTRL),
|
||||
|
||||
NEW_PAD_CTRL(MX6_PAD_GPIO_4__GPIO1_IO04, USDHC2_PAD_CTRL), /* CD */
|
||||
NEW_PAD_CTRL(MX6_PAD_GPIO_2__SD2_WP, USDHC2_PAD_CTRL), /* WP */
|
||||
};
|
||||
|
||||
#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4)
|
||||
#define USDHC2_WP_GPIO IMX_GPIO_NR(1, 2)
|
||||
|
||||
static struct fsl_esdhc_cfg usdhc2_cfg = {
|
||||
.esdhc_base = USDHC2_BASE_ADDR,
|
||||
.max_bus_width = 4,
|
||||
};
|
||||
|
||||
int tqma6_bb_board_mmc_getcd(struct mmc *mmc)
|
||||
{
|
||||
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
|
||||
int ret = 0;
|
||||
|
||||
if (cfg->esdhc_base == USDHC2_BASE_ADDR)
|
||||
ret = !gpio_get_value(USDHC2_CD_GPIO);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tqma6_bb_board_mmc_getwp(struct mmc *mmc)
|
||||
{
|
||||
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
|
||||
int ret = 0;
|
||||
|
||||
if (cfg->esdhc_base == USDHC2_BASE_ADDR)
|
||||
ret = gpio_get_value(USDHC2_WP_GPIO);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tqma6_bb_board_mmc_init(bd_t *bis)
|
||||
{
|
||||
int ret;
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
|
||||
|
||||
ret = gpio_request(USDHC2_CD_GPIO, "mmc-cd");
|
||||
if (!ret)
|
||||
gpio_direction_input(USDHC2_CD_GPIO);
|
||||
ret = gpio_request(USDHC2_WP_GPIO, "mmc-wp");
|
||||
if (!ret)
|
||||
gpio_direction_input(USDHC2_WP_GPIO);
|
||||
|
||||
usdhc2_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
|
||||
if(fsl_esdhc_initialize(bis, &usdhc2_cfg))
|
||||
puts("WARNING: failed to initialize SD\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Ethernet */
|
||||
#define ENET_PAD_CTRL ( \
|
||||
PAD_CTL_HYS | \
|
||||
PAD_CTL_PUS_100K_UP | \
|
||||
PAD_CTL_PUE | \
|
||||
PAD_CTL_PKE | \
|
||||
PAD_CTL_SPEED_MED | \
|
||||
PAD_CTL_DSE_40ohm | \
|
||||
PAD_CTL_SRE_SLOW \
|
||||
)
|
||||
|
||||
static iomux_v3_cfg_t const enet_pads[] = {
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_MDC__ENET_MDC, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_MDIO__ENET_MDIO, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_GPIO_16__ENET_REF_CLK, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_RXD0__ENET_RX_DATA0, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_RXD1__ENET_RX_DATA1, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_CRS_DV__ENET_RX_EN, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_RX_ER__ENET_RX_ER, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_TXD0__ENET_TX_DATA0, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_TXD1__ENET_TX_DATA1, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_ENET_TX_EN__ENET_TX_EN, ENET_PAD_CTRL),
|
||||
NEW_PAD_CTRL(MX6_PAD_GPIO_19__ENET_TX_ER, ENET_PAD_CTRL),
|
||||
|
||||
/* ENET1 reset */
|
||||
NEW_PAD_CTRL(MX6_PAD_GPIO_8__GPIO1_IO08, ENET_PAD_CTRL),
|
||||
/* ENET1 interrupt */
|
||||
NEW_PAD_CTRL(MX6_PAD_GPIO_9__GPIO1_IO09, ENET_PAD_CTRL),
|
||||
};
|
||||
|
||||
#define ENET_PHY_RESET_GPIO IMX_GPIO_NR(1, 8)
|
||||
|
||||
static void setup_iomuxc_enet(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
|
||||
|
||||
/* Reset LAN8720 PHY */
|
||||
ret = gpio_request(ENET_PHY_RESET_GPIO, "phy-reset");
|
||||
if (!ret)
|
||||
gpio_direction_output(ENET_PHY_RESET_GPIO , 0);
|
||||
udelay(25000);
|
||||
gpio_set_value(ENET_PHY_RESET_GPIO, 1);
|
||||
}
|
||||
|
||||
int board_eth_init(bd_t *bis)
|
||||
{
|
||||
return cpu_eth_init(bis);
|
||||
}
|
||||
|
||||
/* GPIO */
|
||||
#define GPIO_PAD_CTRL ( \
|
||||
PAD_CTL_HYS | \
|
||||
PAD_CTL_PUS_100K_UP | \
|
||||
PAD_CTL_PUE | \
|
||||
PAD_CTL_SPEED_MED | \
|
||||
PAD_CTL_DSE_40ohm | \
|
||||
PAD_CTL_SRE_SLOW \
|
||||
)
|
||||
|
||||
#define GPIO_OD_PAD_CTRL ( \
|
||||
PAD_CTL_HYS | \
|
||||
PAD_CTL_PUS_100K_UP | \
|
||||
PAD_CTL_PUE | \
|
||||
PAD_CTL_ODE | \
|
||||
PAD_CTL_SPEED_MED | \
|
||||
PAD_CTL_DSE_40ohm | \
|
||||
PAD_CTL_SRE_SLOW \
|
||||
)
|
||||
|
||||
static iomux_v3_cfg_t const gpio_pads[] = {
|
||||
/* USB_H_PWR */
|
||||
NEW_PAD_CTRL(MX6_PAD_GPIO_0__GPIO1_IO00, GPIO_PAD_CTRL),
|
||||
/* USB_OTG_PWR */
|
||||
NEW_PAD_CTRL(MX6_PAD_EIM_D22__GPIO3_IO22, GPIO_PAD_CTRL),
|
||||
/* PCIE_RST */
|
||||
NEW_PAD_CTRL(MX6_PAD_NANDF_CLE__GPIO6_IO07, GPIO_OD_PAD_CTRL),
|
||||
/* UART1_PWRON */
|
||||
NEW_PAD_CTRL(MX6_PAD_DISP0_DAT14__GPIO5_IO08, GPIO_PAD_CTRL),
|
||||
/* UART2_PWRON */
|
||||
NEW_PAD_CTRL(MX6_PAD_DISP0_DAT16__GPIO5_IO10, GPIO_PAD_CTRL),
|
||||
/* UART3_PWRON */
|
||||
NEW_PAD_CTRL(MX6_PAD_DISP0_DAT18__GPIO5_IO12, GPIO_PAD_CTRL),
|
||||
};
|
||||
|
||||
#define GPIO_USB_H_PWR IMX_GPIO_NR(1, 0)
|
||||
#define GPIO_USB_OTG_PWR IMX_GPIO_NR(3, 22)
|
||||
#define GPIO_PCIE_RST IMX_GPIO_NR(6, 7)
|
||||
#define GPIO_UART1_PWRON IMX_GPIO_NR(5, 8)
|
||||
#define GPIO_UART2_PWRON IMX_GPIO_NR(5, 10)
|
||||
#define GPIO_UART3_PWRON IMX_GPIO_NR(5, 12)
|
||||
|
||||
static void gpio_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(gpio_pads, ARRAY_SIZE(gpio_pads));
|
||||
|
||||
ret = gpio_request(GPIO_USB_H_PWR, "usb-h-pwr");
|
||||
if (!ret)
|
||||
gpio_direction_output(GPIO_USB_H_PWR, 1);
|
||||
ret = gpio_request(GPIO_USB_OTG_PWR, "usb-otg-pwr");
|
||||
if (!ret)
|
||||
gpio_direction_output(GPIO_USB_OTG_PWR, 1);
|
||||
ret = gpio_request(GPIO_PCIE_RST, "pcie-reset");
|
||||
if (!ret)
|
||||
gpio_direction_output(GPIO_PCIE_RST, 1);
|
||||
ret = gpio_request(GPIO_UART1_PWRON, "uart1-pwr");
|
||||
if (!ret)
|
||||
gpio_direction_output(GPIO_UART1_PWRON, 0);
|
||||
ret = gpio_request(GPIO_UART2_PWRON, "uart2-pwr");
|
||||
if (!ret)
|
||||
gpio_direction_output(GPIO_UART2_PWRON, 0);
|
||||
ret = gpio_request(GPIO_UART3_PWRON, "uart3-pwr");
|
||||
if (!ret)
|
||||
gpio_direction_output(GPIO_UART3_PWRON, 0);
|
||||
}
|
||||
|
||||
void tqma6_iomuxc_spi(void)
|
||||
{
|
||||
/* No SPI on this baseboard */
|
||||
}
|
||||
|
||||
int tqma6_bb_board_early_init_f(void)
|
||||
{
|
||||
setup_iomuxc_uart4();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tqma6_bb_board_init(void)
|
||||
{
|
||||
setup_iomuxc_enet();
|
||||
|
||||
gpio_init();
|
||||
|
||||
/* Turn the UART-couplers on one-after-another */
|
||||
gpio_set_value(GPIO_UART1_PWRON, 1);
|
||||
mdelay(10);
|
||||
gpio_set_value(GPIO_UART2_PWRON, 1);
|
||||
mdelay(10);
|
||||
gpio_set_value(GPIO_UART3_PWRON, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tqma6_bb_board_late_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *tqma6_bb_get_boardname(void)
|
||||
{
|
||||
return "WRU-IV";
|
||||
}
|
||||
|
||||
static const struct boot_mode board_boot_modes[] = {
|
||||
/* 4 bit bus width */
|
||||
{"sd2", MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)},
|
||||
/* 8 bit bus width */
|
||||
{"emmc", MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)},
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
int misc_init_r(void)
|
||||
{
|
||||
add_board_boot_modes(board_boot_modes);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define WRU4_USB_H1_PWR IMX_GPIO_NR(1, 0)
|
||||
#define WRU4_USB_OTG_PWR IMX_GPIO_NR(3, 22)
|
||||
|
||||
int board_ehci_hcd_init(int port)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = gpio_request(WRU4_USB_H1_PWR, "usb-h1-pwr");
|
||||
if (!ret)
|
||||
gpio_direction_output(WRU4_USB_H1_PWR, 1);
|
||||
|
||||
ret = gpio_request(WRU4_USB_OTG_PWR, "usb-OTG-pwr");
|
||||
if (!ret)
|
||||
gpio_direction_output(WRU4_USB_OTG_PWR, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_ehci_power(int port, int on)
|
||||
{
|
||||
if (port)
|
||||
gpio_set_value(WRU4_USB_OTG_PWR, on);
|
||||
else
|
||||
gpio_set_value(WRU4_USB_H1_PWR, on);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Device Tree Support
|
||||
*/
|
||||
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
|
||||
void tqma6_bb_ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
/* TBD */
|
||||
}
|
||||
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
|
||||
125
u-boot/board/tqc/tqma6/tqma6q.cfg
Normal file
125
u-boot/board/tqc/tqma6/tqma6q.cfg
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2013, 2014 Markus Niebel <Markus.Niebel@tq-group.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*
|
||||
* Refer doc/README.imximage for more details about how-to configure
|
||||
* and create imximage boot image
|
||||
*
|
||||
* The syntax is taken as close as possible with the kwbimage
|
||||
*/
|
||||
|
||||
/* image version */
|
||||
IMAGE_VERSION 2
|
||||
|
||||
#define __ASSEMBLY__
|
||||
#include <config.h>
|
||||
|
||||
/*
|
||||
* Boot Device : one of
|
||||
* spi, sd (the board has no nand neither onenand)
|
||||
*/
|
||||
#if defined(CONFIG_TQMA6X_MMC_BOOT)
|
||||
BOOT_FROM sd
|
||||
#elif defined(CONFIG_TQMA6X_SPI_BOOT)
|
||||
BOOT_FROM spi
|
||||
#endif
|
||||
|
||||
#include "asm/arch/mx6-ddr.h"
|
||||
#include "asm/arch/iomux.h"
|
||||
#include "asm/arch/crm_regs.h"
|
||||
|
||||
/* TQMa6Q/D DDR config Rev. 0100B */
|
||||
/* IOMUX configuration */
|
||||
DATA 4, MX6_IOM_GRP_DDR_TYPE, 0x000C0000
|
||||
DATA 4, MX6_IOM_GRP_DDRPKE, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_SDCLK_0, 0x00008030
|
||||
DATA 4, MX6_IOM_DRAM_SDCLK_1, 0x00008030
|
||||
DATA 4, MX6_IOM_DRAM_CAS, 0x00008030
|
||||
DATA 4, MX6_IOM_DRAM_RAS, 0x00008030
|
||||
DATA 4, MX6_IOM_GRP_ADDDS, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_RESET, 0x000C3030
|
||||
DATA 4, MX6_IOM_DRAM_SDCKE0, 0x00003000
|
||||
DATA 4, MX6_IOM_DRAM_SDCKE1, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_SDBA2, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_SDODT0, 0x00003030
|
||||
DATA 4, MX6_IOM_DRAM_SDODT1, 0x00003030
|
||||
DATA 4, MX6_IOM_GRP_CTLDS, 0x00000030
|
||||
DATA 4, MX6_IOM_DDRMODE_CTL, 0x00020000
|
||||
DATA 4, MX6_IOM_DRAM_SDQS0, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS1, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS2, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS3, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS4, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS5, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS6, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS7, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_DDRMODE, 0x00020000
|
||||
DATA 4, MX6_IOM_GRP_B0DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B1DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B2DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B3DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B4DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B5DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B6DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B7DS, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM0, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM1, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM2, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM3, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM4, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM5, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM6, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM7, 0x00000030
|
||||
|
||||
/* memory interface calibration values */
|
||||
DATA 4, MX6_MMDC_P0_MPZQHWCTRL, 0xA1390003
|
||||
DATA 4, MX6_MMDC_P1_MPZQHWCTRL, 0xA1390003
|
||||
DATA 4, MX6_MMDC_P0_MPWLDECTRL0, 0x001B0013
|
||||
DATA 4, MX6_MMDC_P0_MPWLDECTRL1, 0x0018001B
|
||||
DATA 4, MX6_MMDC_P1_MPWLDECTRL0, 0x001B0016
|
||||
DATA 4, MX6_MMDC_P1_MPWLDECTRL1, 0x0012001C
|
||||
DATA 4, MX6_MMDC_P0_MPDGCTRL0, 0x43400350
|
||||
DATA 4, MX6_MMDC_P0_MPDGCTRL1, 0x023E032C
|
||||
DATA 4, MX6_MMDC_P1_MPDGCTRL0, 0x43400348
|
||||
DATA 4, MX6_MMDC_P1_MPDGCTRL1, 0x03300304
|
||||
DATA 4, MX6_MMDC_P0_MPRDDLCTL, 0x3C323436
|
||||
DATA 4, MX6_MMDC_P1_MPRDDLCTL, 0x38383242
|
||||
DATA 4, MX6_MMDC_P0_MPWRDLCTL, 0x3E3C4440
|
||||
DATA 4, MX6_MMDC_P1_MPWRDLCTL, 0x4236483E
|
||||
DATA 4, MX6_MMDC_P0_MPRDDQBY0DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P0_MPRDDQBY1DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P0_MPRDDQBY2DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P0_MPRDDQBY3DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P1_MPRDDQBY0DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P1_MPRDDQBY1DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P1_MPRDDQBY2DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P1_MPRDDQBY3DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P0_MPMUR0, 0x00000800
|
||||
DATA 4, MX6_MMDC_P1_MPMUR0, 0x00000800
|
||||
|
||||
/* configure memory interface */
|
||||
DATA 4, MX6_MMDC_P0_MDPDC, 0x00020036
|
||||
DATA 4, MX6_MMDC_P0_MDOTC, 0x09444040
|
||||
DATA 4, MX6_MMDC_P0_MDCFG0, 0x545A79B4
|
||||
DATA 4, MX6_MMDC_P0_MDCFG1, 0xDB538F64
|
||||
DATA 4, MX6_MMDC_P0_MDCFG2, 0x01FF00DB
|
||||
DATA 4, MX6_MMDC_P0_MDMISC, 0x00001740
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x00008000
|
||||
DATA 4, MX6_MMDC_P0_MDRWD, 0x000026D2
|
||||
DATA 4, MX6_MMDC_P0_MDOR, 0x005A1023
|
||||
DATA 4, MX6_MMDC_P0_MDASP, 0x00000027
|
||||
DATA 4, MX6_MMDC_P0_MDCTL, 0x831A0000
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x00088032
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x00008033
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x00048031
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x09308030
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x04008040
|
||||
DATA 4, MX6_MMDC_P0_MDREF, 0x00005800
|
||||
DATA 4, MX6_MMDC_P0_MPODTCTRL, 0x00022222
|
||||
DATA 4, MX6_MMDC_P1_MPODTCTRL, 0x00022222
|
||||
DATA 4, MX6_MMDC_P0_MDPDC, 0x00025536
|
||||
DATA 4, MX6_MMDC_P0_MAPSR, 0x00001006
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x00000000
|
||||
|
||||
#include "clocks.cfg"
|
||||
125
u-boot/board/tqc/tqma6/tqma6s.cfg
Normal file
125
u-boot/board/tqc/tqma6/tqma6s.cfg
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2013, 2014 Markus Niebel <Markus.Niebel@tq-group.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*
|
||||
* Refer doc/README.imximage for more details about how-to configure
|
||||
* and create imximage boot image
|
||||
*
|
||||
* The syntax is taken as close as possible with the kwbimage
|
||||
*/
|
||||
|
||||
/* image version */
|
||||
IMAGE_VERSION 2
|
||||
|
||||
#define __ASSEMBLY__
|
||||
#include <config.h>
|
||||
|
||||
/*
|
||||
* Boot Device : one of
|
||||
* spi, sd (the board has no nand neither onenand)
|
||||
*/
|
||||
#if defined(CONFIG_TQMA6X_MMC_BOOT)
|
||||
BOOT_FROM sd
|
||||
#elif defined(CONFIG_TQMA6X_SPI_BOOT)
|
||||
BOOT_FROM spi
|
||||
#endif
|
||||
|
||||
#include "asm/arch/mx6-ddr.h"
|
||||
#include "asm/arch/iomux.h"
|
||||
#include "asm/arch/crm_regs.h"
|
||||
|
||||
/* TQMa6S DDR config Rev. 0100B */
|
||||
/* IOMUX configuration */
|
||||
DATA 4, MX6_IOM_GRP_DDR_TYPE, 0x000C0000
|
||||
DATA 4, MX6_IOM_GRP_DDRPKE, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_SDCLK_0, 0x00008000
|
||||
DATA 4, MX6_IOM_DRAM_SDCLK_1, 0x00008030
|
||||
DATA 4, MX6_IOM_DRAM_CAS, 0x00008030
|
||||
DATA 4, MX6_IOM_DRAM_RAS, 0x00008030
|
||||
DATA 4, MX6_IOM_GRP_ADDDS, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_RESET, 0x000C3030
|
||||
DATA 4, MX6_IOM_DRAM_SDCKE0, 0x00003000
|
||||
DATA 4, MX6_IOM_DRAM_SDCKE1, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_SDBA2, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_SDODT0, 0x00003030
|
||||
DATA 4, MX6_IOM_DRAM_SDODT1, 0x00003030
|
||||
DATA 4, MX6_IOM_GRP_CTLDS, 0x00000030
|
||||
DATA 4, MX6_IOM_DDRMODE_CTL, 0x00020000
|
||||
DATA 4, MX6_IOM_DRAM_SDQS0, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS1, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS2, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS3, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_SDQS4, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_SDQS5, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_SDQS6, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_SDQS7, 0x00000000
|
||||
DATA 4, MX6_IOM_GRP_DDRMODE, 0x00020000
|
||||
DATA 4, MX6_IOM_GRP_B0DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B1DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B2DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B3DS, 0x00000030
|
||||
DATA 4, MX6_IOM_GRP_B4DS, 0x00000000
|
||||
DATA 4, MX6_IOM_GRP_B5DS, 0x00000000
|
||||
DATA 4, MX6_IOM_GRP_B6DS, 0x00000000
|
||||
DATA 4, MX6_IOM_GRP_B7DS, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_DQM0, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM1, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM2, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM3, 0x00000030
|
||||
DATA 4, MX6_IOM_DRAM_DQM4, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_DQM5, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_DQM6, 0x00000000
|
||||
DATA 4, MX6_IOM_DRAM_DQM7, 0x00000000
|
||||
|
||||
/* memory interface calibration values */
|
||||
DATA 4, MX6_MMDC_P0_MPZQHWCTRL, 0xA1390003
|
||||
DATA 4, MX6_MMDC_P1_MPZQHWCTRL, 0xA1380000
|
||||
DATA 4, MX6_MMDC_P0_MPWLDECTRL0, 0x0014000E
|
||||
DATA 4, MX6_MMDC_P0_MPWLDECTRL1, 0x00120014
|
||||
DATA 4, MX6_MMDC_P1_MPWLDECTRL0, 0x00000000
|
||||
DATA 4, MX6_MMDC_P1_MPWLDECTRL1, 0x00000000
|
||||
DATA 4, MX6_MMDC_P0_MPDGCTRL0, 0x0240023C
|
||||
DATA 4, MX6_MMDC_P0_MPDGCTRL1, 0x0228022C
|
||||
DATA 4, MX6_MMDC_P1_MPDGCTRL0, 0x00000000
|
||||
DATA 4, MX6_MMDC_P1_MPDGCTRL1, 0x00000000
|
||||
DATA 4, MX6_MMDC_P0_MPRDDLCTL, 0x4A4A4E4A
|
||||
DATA 4, MX6_MMDC_P1_MPRDDLCTL, 0x00000000
|
||||
DATA 4, MX6_MMDC_P0_MPWRDLCTL, 0x36362A32
|
||||
DATA 4, MX6_MMDC_P1_MPWRDLCTL, 0x00000000
|
||||
DATA 4, MX6_MMDC_P0_MPRDDQBY0DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P0_MPRDDQBY1DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P0_MPRDDQBY2DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P0_MPRDDQBY3DL, 0x33333333
|
||||
DATA 4, MX6_MMDC_P1_MPRDDQBY0DL, 0x00000000
|
||||
DATA 4, MX6_MMDC_P1_MPRDDQBY1DL, 0x00000000
|
||||
DATA 4, MX6_MMDC_P1_MPRDDQBY2DL, 0x00000000
|
||||
DATA 4, MX6_MMDC_P1_MPRDDQBY3DL, 0x00000000
|
||||
DATA 4, MX6_MMDC_P0_MPMUR0, 0x00000800
|
||||
DATA 4, MX6_MMDC_P1_MPMUR0, 0x00000000
|
||||
|
||||
/* configure memory interface */
|
||||
DATA 4, MX6_MMDC_P0_MDPDC, 0x0002002D
|
||||
DATA 4, MX6_MMDC_P0_MDOTC, 0x00333030
|
||||
DATA 4, MX6_MMDC_P0_MDCFG0, 0x3F435333
|
||||
DATA 4, MX6_MMDC_P0_MDCFG1, 0xB68E8B63
|
||||
DATA 4, MX6_MMDC_P0_MDCFG2, 0x01FF00DB
|
||||
DATA 4, MX6_MMDC_P0_MDMISC, 0x00001740
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x00008000
|
||||
DATA 4, MX6_MMDC_P0_MDRWD, 0x000026D2
|
||||
DATA 4, MX6_MMDC_P0_MDOR, 0x00431023
|
||||
DATA 4, MX6_MMDC_P0_MDASP, 0x00000017
|
||||
DATA 4, MX6_MMDC_P0_MDCTL, 0x83190000
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x00008032
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x00008033
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x00048031
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x05208030
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x04008040
|
||||
DATA 4, MX6_MMDC_P0_MDREF, 0x00005800
|
||||
DATA 4, MX6_MMDC_P0_MPODTCTRL, 0x00022222
|
||||
DATA 4, MX6_MMDC_P1_MPODTCTRL, 0x00000000
|
||||
DATA 4, MX6_MMDC_P0_MDPDC, 0x0002552D
|
||||
DATA 4, MX6_MMDC_P0_MAPSR, 0x00001006
|
||||
DATA 4, MX6_MMDC_P0_MDSCR, 0x00000000
|
||||
|
||||
#include "clocks.cfg"
|
||||
Reference in New Issue
Block a user