With dropping support for some boards and the deletion of some source files, it appears that both of these directories are now superfluous. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>master
parent
2507854e46
commit
367d789d87
@ -1,94 +0,0 @@ |
|||||||
(cpu/mpc7xxx/start.S) |
|
||||||
|
|
||||||
start: |
|
||||||
b boot_cold |
|
||||||
|
|
||||||
start_warm: |
|
||||||
b boot_warm |
|
||||||
|
|
||||||
|
|
||||||
boot_cold: |
|
||||||
boot_warm: |
|
||||||
clear bats |
|
||||||
init l2 (if enabled) |
|
||||||
init altivec (if enabled) |
|
||||||
invalidate l2 (if enabled) |
|
||||||
setup bats (from defines in config_EVB) |
|
||||||
enable_addr_trans: (if MMU enabled) |
|
||||||
enable MSR_IR and MSR_DR |
|
||||||
jump to in_flash |
|
||||||
|
|
||||||
in_flash: |
|
||||||
enable l1 dcache |
|
||||||
gal_low_init: (board/evb64260/sdram_init.S) |
|
||||||
config SDRAM (CFG, TIMING, DECODE) |
|
||||||
init scratch regs (810 + 814) |
|
||||||
|
|
||||||
detect DIMM0 (bank 0 only) |
|
||||||
config SDRAM_PARA0 to 256/512Mbit |
|
||||||
bl sdram_op_mode |
|
||||||
detect bank0 width |
|
||||||
write scratch reg 810 |
|
||||||
config SDRAM_PARA0 with results |
|
||||||
config SDRAM_PARA1 with results |
|
||||||
|
|
||||||
detect DIMM1 (bank 2 only) |
|
||||||
config SDRAM_PARA2 to 256/512Mbit |
|
||||||
detect bank2 width |
|
||||||
write scratch reg 814 |
|
||||||
config SDRAM_PARA2 with results |
|
||||||
config SDRAM_PARA3 with results |
|
||||||
|
|
||||||
setup device bus timings/width |
|
||||||
setup boot device timings/width |
|
||||||
|
|
||||||
setup CPU_CONF (0x0) |
|
||||||
setup cpu master control register 0x160 |
|
||||||
setup PCI0 TIMEOUT |
|
||||||
setup PCI1 TIMEOUT |
|
||||||
setup PCI0 BAR |
|
||||||
setup PCI1 BAR |
|
||||||
|
|
||||||
setup MPP control 0-3 |
|
||||||
setup GPP level control |
|
||||||
setup Serial ports multiplex |
|
||||||
|
|
||||||
setup stack pointer (r1) |
|
||||||
setup GOT |
|
||||||
call cpu_init_f |
|
||||||
debug leds |
|
||||||
board_init_f: (common/board.c) |
|
||||||
board_early_init_f: |
|
||||||
remap gt regs? |
|
||||||
map PCI mem/io |
|
||||||
map device space |
|
||||||
clear out interrupts |
|
||||||
init_timebase |
|
||||||
env_init |
|
||||||
serial_init |
|
||||||
console_init_f |
|
||||||
display_options |
|
||||||
initdram: (board/evb64260/evb64260.c) |
|
||||||
detect memory |
|
||||||
for each bank: |
|
||||||
dram_size() |
|
||||||
setup PCI slave memory mappings |
|
||||||
setup SCS |
|
||||||
setup monitor |
|
||||||
alloc board info struct |
|
||||||
init bd struct |
|
||||||
relocate_code: (cpu/mpc7xxx/start.S) |
|
||||||
copy,got,clearbss |
|
||||||
board_init_r(bd, dest_addr) (common/board.c) |
|
||||||
setup bd function pointers |
|
||||||
trap_init |
|
||||||
flash_init: (board/evb64260/flash.c) |
|
||||||
setup bd flash info |
|
||||||
cpu_init_r: (cpu/mpc7xxx/cpu_init.c) |
|
||||||
nothing |
|
||||||
mem_malloc_init |
|
||||||
malloc_bin_reloc |
|
||||||
spi_init (r or f)??? (CONFIG_ENV_IS_IN_EEPROM) |
|
||||||
env_relocated |
|
||||||
misc_init_r(bd): (board/evb64260/evb64260.c) |
|
||||||
mpsc_init2 |
|
@ -1,16 +0,0 @@ |
|||||||
/*
|
|
||||||
* (C) Copyright 2000 |
|
||||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
|
||||||
* |
|
||||||
* SPDX-License-Identifier: GPL-2.0+ |
|
||||||
* |
|
||||||
* Hacked for the DB64360 board by Ingo.Assmus@keymile.com |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef __I2C_H__ |
|
||||||
#define __I2C_H__ |
|
||||||
|
|
||||||
/* function declarations */ |
|
||||||
uchar i2c_read(uchar, unsigned int, int, uchar*, int); |
|
||||||
|
|
||||||
#endif |
|
@ -1,170 +0,0 @@ |
|||||||
/*
|
|
||||||
* (C) Copyright 2000 |
|
||||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
|
||||||
* |
|
||||||
* SPDX-License-Identifier: GPL-2.0+ |
|
||||||
* |
|
||||||
* Hacked for the marvell db64360 eval board by |
|
||||||
* Ingo Assmus <ingo.assmus@keymile.com> |
|
||||||
*/ |
|
||||||
|
|
||||||
/*************** DEFINES for Intel StrataFlash FLASH chip ********************/ |
|
||||||
|
|
||||||
/*
|
|
||||||
* acceptable chips types are: |
|
||||||
* |
|
||||||
* 28F320J5, 28F640J5, 28F320J3A, 28F640J3A and 28F128J3A |
|
||||||
*/ |
|
||||||
|
|
||||||
/* register addresses, valid only following an CHIP_CMD_RD_ID command */ |
|
||||||
#define CHIP_ADDR_REG_MAN 0x000000 /* manufacturer's id */ |
|
||||||
#define CHIP_ADDR_REG_DEV 0x000001 /* device id */ |
|
||||||
#define CHIP_ADDR_REG_CFGM 0x000003 /* master lock config */ |
|
||||||
#define CHIP_ADDR_REG_CFG(b) (((b)<<16)|2) /* lock config for block b */ |
|
||||||
|
|
||||||
/* Commands */ |
|
||||||
#define CHIP_CMD_RST 0xFF /* reset flash */ |
|
||||||
#define CHIP_CMD_RD_ID 0x90 /* read the id and lock bits */ |
|
||||||
#define CHIP_CMD_RD_QUERY 0x98 /* read device capabilities */ |
|
||||||
#define CHIP_CMD_RD_STAT 0x70 /* read the status register */ |
|
||||||
#define CHIP_CMD_CLR_STAT 0x50 /* clear the staus register */ |
|
||||||
#define CHIP_CMD_WR_BUF 0xE8 /* clear the staus register */ |
|
||||||
#define CHIP_CMD_PROG 0x40 /* program word command */ |
|
||||||
#define CHIP_CMD_ERASE1 0x20 /* 1st word for block erase */ |
|
||||||
#define CHIP_CMD_ERASE2 0xD0 /* 2nd word for block erase */ |
|
||||||
#define CHIP_CMD_ERASE_SUSP 0xB0 /* suspend block erase */ |
|
||||||
#define CHIP_CMD_LOCK 0x60 /* 1st word for all lock cmds */ |
|
||||||
#define CHIP_CMD_SET_LOCK_BLK 0x01 /* 2nd wrd set block lock bit */ |
|
||||||
#define CHIP_CMD_SET_LOCK_MSTR 0xF1 /* 2nd wrd set master lck bit */ |
|
||||||
#define CHIP_CMD_CLR_LOCK_BLK 0xD0 /* 2nd wrd clear blk lck bit */ |
|
||||||
|
|
||||||
/* status register bits */ |
|
||||||
#define CHIP_STAT_DPS 0x02 /* Device Protect Status */ |
|
||||||
#define CHIP_STAT_VPPS 0x08 /* VPP Status */ |
|
||||||
#define CHIP_STAT_PSLBS 0x10 /* Program+Set Lock Bit Stat */ |
|
||||||
#define CHIP_STAT_ECLBS 0x20 /* Erase+Clr Lock Bit Stat */ |
|
||||||
#define CHIP_STAT_ESS 0x40 /* Erase Suspend Status */ |
|
||||||
#define CHIP_STAT_RDY 0x80 /* WSM Mach Status, 1=rdy */ |
|
||||||
|
|
||||||
#define CHIP_STAT_ERR (CHIP_STAT_VPPS | CHIP_STAT_DPS | \ |
|
||||||
CHIP_STAT_ECLBS | CHIP_STAT_PSLBS) |
|
||||||
|
|
||||||
/* ID and Lock Configuration */ |
|
||||||
#define CHIP_RD_ID_LOCK 0x01 /* Bit 0 of each byte */ |
|
||||||
#define CHIP_RD_ID_MAN 0x89 /* Manufacturer code = 0x89 */ |
|
||||||
#define CHIP_RD_ID_DEV CONFIG_SYS_FLASH_ID |
|
||||||
|
|
||||||
/* dimensions */ |
|
||||||
#define CHIP_WIDTH 2 /* chips are in 16 bit mode */ |
|
||||||
#define CHIP_WSHIFT 1 /* (log2 of CHIP_WIDTH) */ |
|
||||||
#define CHIP_NBLOCKS 128 |
|
||||||
#define CHIP_BLKSZ (128 * 1024) /* of 128Kbytes each */ |
|
||||||
#define CHIP_SIZE (CHIP_BLKSZ * CHIP_NBLOCKS) |
|
||||||
|
|
||||||
/********************** DEFINES for Hymod Flash ******************************/ |
|
||||||
|
|
||||||
/*
|
|
||||||
* The hymod board has 2 x 28F320J5 chips running in |
|
||||||
* 16 bit mode, for a 32 bit wide bank. |
|
||||||
*/ |
|
||||||
|
|
||||||
typedef unsigned short bank_word_t; /* 8/16/32/64bit unsigned int */ |
|
||||||
typedef volatile bank_word_t *bank_addr_t; |
|
||||||
typedef unsigned long bank_size_t; /* want this big - >= 32 bit */ |
|
||||||
|
|
||||||
#define BANK_CHIP_WIDTH 1 /* each bank is 1 chip wide */ |
|
||||||
#define BANK_CHIP_WSHIFT 0 /* (log2 of BANK_CHIP_WIDTH) */ |
|
||||||
|
|
||||||
#define BANK_WIDTH (CHIP_WIDTH * BANK_CHIP_WIDTH) |
|
||||||
#define BANK_WSHIFT (CHIP_WSHIFT + BANK_CHIP_WSHIFT) |
|
||||||
#define BANK_NBLOCKS CHIP_NBLOCKS |
|
||||||
#define BANK_BLKSZ (CHIP_BLKSZ * BANK_CHIP_WIDTH) |
|
||||||
#define BANK_SIZE (CHIP_SIZE * BANK_CHIP_WIDTH) |
|
||||||
|
|
||||||
#define MAX_BANKS 1 /* only one bank possible */ |
|
||||||
|
|
||||||
/* align bank addresses and sizes to bank word boundaries */ |
|
||||||
#define BANK_ADDR_WORD_ALIGN(a) ((bank_addr_t)((bank_size_t)(a) \ |
|
||||||
& ~(BANK_WIDTH - 1))) |
|
||||||
#define BANK_SIZE_WORD_ALIGN(s) ((bank_size_t)BANK_ADDR_WORD_ALIGN( \ |
|
||||||
(bank_size_t)(s) + (BANK_WIDTH - 1))) |
|
||||||
|
|
||||||
/* align bank addresses and sizes to bank block boundaries */ |
|
||||||
#define BANK_ADDR_BLK_ALIGN(a) ((bank_addr_t)((bank_size_t)(a) \ |
|
||||||
& ~(BANK_BLKSZ - 1))) |
|
||||||
#define BANK_SIZE_BLK_ALIGN(s) ((bank_size_t)BANK_ADDR_BLK_ALIGN( \ |
|
||||||
(bank_size_t)(s) + (BANK_BLKSZ - 1))) |
|
||||||
|
|
||||||
/* align bank addresses and sizes to bank boundaries */ |
|
||||||
#define BANK_ADDR_BANK_ALIGN(a) ((bank_addr_t)((bank_size_t)(a) \ |
|
||||||
& ~(BANK_SIZE - 1))) |
|
||||||
#define BANK_SIZE_BANK_ALIGN(s) ((bank_size_t)BANK_ADDR_BANK_ALIGN( \ |
|
||||||
(bank_size_t)(s) + (BANK_SIZE - 1))) |
|
||||||
|
|
||||||
/* add an offset to a bank address */ |
|
||||||
#define BANK_ADDR_OFFSET(a, o) (bank_addr_t)((bank_size_t)(a) + \ |
|
||||||
(bank_size_t)(o)) |
|
||||||
|
|
||||||
/* get base address of bank b, given flash base address a */ |
|
||||||
#define BANK_ADDR_BASE(a, b) BANK_ADDR_OFFSET(BANK_ADDR_BANK_ALIGN(a), \ |
|
||||||
(bank_size_t)(b) * BANK_SIZE) |
|
||||||
|
|
||||||
/* adjust a bank address to start of next word, block or bank */ |
|
||||||
#define BANK_ADDR_NEXT_WORD(a) BANK_ADDR_OFFSET(BANK_ADDR_WORD_ALIGN(a), \ |
|
||||||
BANK_WIDTH) |
|
||||||
#define BANK_ADDR_NEXT_BLK(a) BANK_ADDR_OFFSET(BANK_ADDR_BLK_ALIGN(a), \ |
|
||||||
BANK_BLKSZ) |
|
||||||
#define BANK_ADDR_NEXT_BANK(a) BANK_ADDR_OFFSET(BANK_ADDR_BANK_ALIGN(a), \ |
|
||||||
BANK_SIZE) |
|
||||||
|
|
||||||
/* get bank address of chip register r given a bank base address a */ |
|
||||||
#define BANK_ADDR_REG(a, r) BANK_ADDR_OFFSET(BANK_ADDR_BANK_ALIGN(a), \ |
|
||||||
((bank_size_t)(r) << BANK_WSHIFT)) |
|
||||||
|
|
||||||
/* make a bank address for each chip register address */ |
|
||||||
|
|
||||||
#define BANK_ADDR_REG_MAN(a) BANK_ADDR_REG((a), CHIP_ADDR_REG_MAN) |
|
||||||
#define BANK_ADDR_REG_DEV(a) BANK_ADDR_REG((a), CHIP_ADDR_REG_DEV) |
|
||||||
#define BANK_ADDR_REG_CFGM(a) BANK_ADDR_REG((a), CHIP_ADDR_REG_CFGM) |
|
||||||
#define BANK_ADDR_REG_CFG(b,a) BANK_ADDR_REG((a), CHIP_ADDR_REG_CFG(b)) |
|
||||||
|
|
||||||
/*
|
|
||||||
* replicate a chip cmd/stat/rd value into each byte position within a word |
|
||||||
* so that multiple chips are accessed in a single word i/o operation |
|
||||||
* |
|
||||||
* this must be as wide as the bank_word_t type, and take into account the |
|
||||||
* chip width and bank layout |
|
||||||
*/ |
|
||||||
|
|
||||||
#define BANK_FILL_WORD(o) ((bank_word_t)(o)) |
|
||||||
|
|
||||||
/* make a bank word value for each chip cmd/stat/rd value */ |
|
||||||
|
|
||||||
/* Commands */ |
|
||||||
#define BANK_CMD_RST BANK_FILL_WORD(CHIP_CMD_RST) |
|
||||||
#define BANK_CMD_RD_ID BANK_FILL_WORD(CHIP_CMD_RD_ID) |
|
||||||
#define BANK_CMD_RD_STAT BANK_FILL_WORD(CHIP_CMD_RD_STAT) |
|
||||||
#define BANK_CMD_CLR_STAT BANK_FILL_WORD(CHIP_CMD_CLR_STAT) |
|
||||||
#define BANK_CMD_ERASE1 BANK_FILL_WORD(CHIP_CMD_ERASE1) |
|
||||||
#define BANK_CMD_ERASE2 BANK_FILL_WORD(CHIP_CMD_ERASE2) |
|
||||||
#define BANK_CMD_PROG BANK_FILL_WORD(CHIP_CMD_PROG) |
|
||||||
#define BANK_CMD_LOCK BANK_FILL_WORD(CHIP_CMD_LOCK) |
|
||||||
#define BANK_CMD_SET_LOCK_BLK BANK_FILL_WORD(CHIP_CMD_SET_LOCK_BLK) |
|
||||||
#define BANK_CMD_SET_LOCK_MSTR BANK_FILL_WORD(CHIP_CMD_SET_LOCK_MSTR) |
|
||||||
#define BANK_CMD_CLR_LOCK_BLK BANK_FILL_WORD(CHIP_CMD_CLR_LOCK_BLK) |
|
||||||
|
|
||||||
/* status register bits */ |
|
||||||
#define BANK_STAT_DPS BANK_FILL_WORD(CHIP_STAT_DPS) |
|
||||||
#define BANK_STAT_PSS BANK_FILL_WORD(CHIP_STAT_PSS) |
|
||||||
#define BANK_STAT_VPPS BANK_FILL_WORD(CHIP_STAT_VPPS) |
|
||||||
#define BANK_STAT_PSLBS BANK_FILL_WORD(CHIP_STAT_PSLBS) |
|
||||||
#define BANK_STAT_ECLBS BANK_FILL_WORD(CHIP_STAT_ECLBS) |
|
||||||
#define BANK_STAT_ESS BANK_FILL_WORD(CHIP_STAT_ESS) |
|
||||||
#define BANK_STAT_RDY BANK_FILL_WORD(CHIP_STAT_RDY) |
|
||||||
|
|
||||||
#define BANK_STAT_ERR BANK_FILL_WORD(CHIP_STAT_ERR) |
|
||||||
|
|
||||||
/* ID and Lock Configuration */ |
|
||||||
#define BANK_RD_ID_LOCK BANK_FILL_WORD(CHIP_RD_ID_LOCK) |
|
||||||
#define BANK_RD_ID_MAN BANK_FILL_WORD(CHIP_RD_ID_MAN) |
|
||||||
#define BANK_RD_ID_DEV BANK_FILL_WORD(CHIP_RD_ID_DEV) |
|
File diff suppressed because it is too large
Load Diff
@ -1,66 +0,0 @@ |
|||||||
/*
|
|
||||||
* COM1 NS16550 support |
|
||||||
* originally from linux source (arch/powerpc/boot/ns16550.c) |
|
||||||
* modified to use CONFIG_SYS_ISA_MEM and new defines |
|
||||||
* |
|
||||||
* further modified by Josh Huber <huber@mclx.com> to support |
|
||||||
* the DUART on the Galileo Eval board. (db64360) |
|
||||||
*/ |
|
||||||
|
|
||||||
#include <config.h> |
|
||||||
#include "ns16550.h" |
|
||||||
|
|
||||||
#ifdef ZUMA_NTL |
|
||||||
/* no 16550 device */ |
|
||||||
#else |
|
||||||
const NS16550_t COM_PORTS[] = { (NS16550_t) (CONFIG_SYS_DUART_IO + 0), |
|
||||||
(NS16550_t) (CONFIG_SYS_DUART_IO + 0x20) |
|
||||||
}; |
|
||||||
|
|
||||||
volatile struct NS16550 *NS16550_init (int chan, int baud_divisor) |
|
||||||
{ |
|
||||||
volatile struct NS16550 *com_port; |
|
||||||
|
|
||||||
com_port = (struct NS16550 *) COM_PORTS[chan]; |
|
||||||
com_port->ier = 0x00; |
|
||||||
com_port->lcr = LCR_BKSE; /* Access baud rate */ |
|
||||||
com_port->dll = baud_divisor & 0xff; /* 9600 baud */ |
|
||||||
com_port->dlm = (baud_divisor >> 8) & 0xff; |
|
||||||
com_port->lcr = LCR_8N1; /* 8 data, 1 stop, no parity */ |
|
||||||
com_port->mcr = MCR_DTR | MCR_RTS; /* RTS/DTR */ |
|
||||||
|
|
||||||
/* Clear & enable FIFOs */ |
|
||||||
com_port->fcr = FCR_FIFO_EN | FCR_RXSR | FCR_TXSR; |
|
||||||
return (com_port); |
|
||||||
} |
|
||||||
|
|
||||||
void NS16550_reinit (volatile struct NS16550 *com_port, int baud_divisor) |
|
||||||
{ |
|
||||||
com_port->ier = 0x00; |
|
||||||
com_port->lcr = LCR_BKSE; /* Access baud rate */ |
|
||||||
com_port->dll = baud_divisor & 0xff; /* 9600 baud */ |
|
||||||
com_port->dlm = (baud_divisor >> 8) & 0xff; |
|
||||||
com_port->lcr = LCR_8N1; /* 8 data, 1 stop, no parity */ |
|
||||||
com_port->mcr = MCR_DTR | MCR_RTS; /* RTS/DTR */ |
|
||||||
|
|
||||||
/* Clear & enable FIFOs */ |
|
||||||
com_port->fcr = FCR_FIFO_EN | FCR_RXSR | FCR_TXSR; |
|
||||||
} |
|
||||||
|
|
||||||
void NS16550_putc (volatile struct NS16550 *com_port, unsigned char c) |
|
||||||
{ |
|
||||||
while ((com_port->lsr & LSR_THRE) == 0); |
|
||||||
com_port->thr = c; |
|
||||||
} |
|
||||||
|
|
||||||
unsigned char NS16550_getc (volatile struct NS16550 *com_port) |
|
||||||
{ |
|
||||||
while ((com_port->lsr & LSR_DR) == 0); |
|
||||||
return (com_port->rbr); |
|
||||||
} |
|
||||||
|
|
||||||
int NS16550_tstc (volatile struct NS16550 *com_port) |
|
||||||
{ |
|
||||||
return ((com_port->lsr & LSR_DR) != 0); |
|
||||||
} |
|
||||||
#endif |
|
@ -1,102 +0,0 @@ |
|||||||
/*
|
|
||||||
* NS16550 Serial Port |
|
||||||
* originally from linux source (arch/powerpc/boot/ns16550.h) |
|
||||||
* modified slightly to |
|
||||||
* have addresses as offsets from CONFIG_SYS_ISA_BASE |
|
||||||
* added a few more definitions |
|
||||||
* added prototypes for ns16550.c |
|
||||||
* reduced no of com ports to 2 |
|
||||||
* modifications (c) Rob Taylor, Flying Pig Systems. 2000. |
|
||||||
* |
|
||||||
* further modified to support the DUART in the Galileo eval board |
|
||||||
* modifications (c) Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc. |
|
||||||
*/ |
|
||||||
|
|
||||||
#ifndef __NS16550_H__ |
|
||||||
#define __NS16550_H__ |
|
||||||
|
|
||||||
/* the padding is necessary because on the galileo board the UART is
|
|
||||||
wired in with the 3 address lines shifted over by 2 bits */ |
|
||||||
struct NS16550 |
|
||||||
{ |
|
||||||
unsigned char rbr; /* 0 = 0-3*/ |
|
||||||
int pad1:24; |
|
||||||
|
|
||||||
unsigned char ier; /* 1 = 4-7*/ |
|
||||||
int pad2:24; |
|
||||||
|
|
||||||
unsigned char fcr; /* 2 = 8-b*/ |
|
||||||
int pad3:24; |
|
||||||
|
|
||||||
unsigned char lcr; /* 3 = c-f*/ |
|
||||||
int pad4:24; |
|
||||||
|
|
||||||
unsigned char mcr; /* 4 = 10-13*/ |
|
||||||
int pad5:24; |
|
||||||
|
|
||||||
unsigned char lsr; /* 5 = 14-17*/ |
|
||||||
int pad6:24; |
|
||||||
|
|
||||||
unsigned char msr; /* 6 =18-1b*/ |
|
||||||
int pad7:24; |
|
||||||
|
|
||||||
unsigned char scr; /* 7 =1c-1f*/ |
|
||||||
int pad8:24; |
|
||||||
} __attribute__ ((packed)); |
|
||||||
|
|
||||||
/* aliases */ |
|
||||||
#define thr rbr |
|
||||||
#define iir fcr |
|
||||||
#define dll rbr |
|
||||||
#define dlm ier |
|
||||||
|
|
||||||
#define FCR_FIFO_EN 0x01 /*fifo enable*/ |
|
||||||
#define FCR_RXSR 0x02 /*receiver soft reset*/ |
|
||||||
#define FCR_TXSR 0x04 /*transmitter soft reset*/ |
|
||||||
|
|
||||||
|
|
||||||
#define MCR_DTR 0x01 |
|
||||||
#define MCR_RTS 0x02 |
|
||||||
#define MCR_DMA_EN 0x04 |
|
||||||
#define MCR_TX_DFR 0x08 |
|
||||||
|
|
||||||
|
|
||||||
#define LCR_WLS_MSK 0x03 /* character length slect mask*/ |
|
||||||
#define LCR_WLS_5 0x00 /* 5 bit character length */ |
|
||||||
#define LCR_WLS_6 0x01 /* 6 bit character length */ |
|
||||||
#define LCR_WLS_7 0x02 /* 7 bit character length */ |
|
||||||
#define LCR_WLS_8 0x03 /* 8 bit character length */ |
|
||||||
#define LCR_STB 0x04 /* Number of stop Bits, off = 1, on = 1.5 or 2) */ |
|
||||||
#define LCR_PEN 0x08 /* Parity eneble*/ |
|
||||||
#define LCR_EPS 0x10 /* Even Parity Select*/ |
|
||||||
#define LCR_STKP 0x20 /* Stick Parity*/ |
|
||||||
#define LCR_SBRK 0x40 /* Set Break*/ |
|
||||||
#define LCR_BKSE 0x80 /* Bank select enable*/ |
|
||||||
|
|
||||||
#define LSR_DR 0x01 /* Data ready */ |
|
||||||
#define LSR_OE 0x02 /* Overrun */ |
|
||||||
#define LSR_PE 0x04 /* Parity error */ |
|
||||||
#define LSR_FE 0x08 /* Framing error */ |
|
||||||
#define LSR_BI 0x10 /* Break */ |
|
||||||
#define LSR_THRE 0x20 /* Xmit holding register empty */ |
|
||||||
#define LSR_TEMT 0x40 /* Xmitter empty */ |
|
||||||
#define LSR_ERR 0x80 /* Error */ |
|
||||||
|
|
||||||
/* useful defaults for LCR*/ |
|
||||||
#define LCR_8N1 0x03 |
|
||||||
|
|
||||||
|
|
||||||
#define COM1 0x03F8 |
|
||||||
#define COM2 0x02F8 |
|
||||||
|
|
||||||
volatile struct NS16550 * NS16550_init(int chan, int baud_divisor); |
|
||||||
void NS16550_putc(volatile struct NS16550 *com_port, unsigned char c); |
|
||||||
unsigned char NS16550_getc(volatile struct NS16550 *com_port); |
|
||||||
int NS16550_tstc(volatile struct NS16550 *com_port); |
|
||||||
void NS16550_reinit(volatile struct NS16550 *com_port, int baud_divisor); |
|
||||||
|
|
||||||
typedef struct NS16550 *NS16550_t; |
|
||||||
|
|
||||||
extern const NS16550_t COM_PORTS[]; |
|
||||||
|
|
||||||
#endif |
|
@ -1,162 +0,0 @@ |
|||||||
/*
|
|
||||||
* (C) Copyright 2001 |
|
||||||
* Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc. |
|
||||||
* |
|
||||||
* modified for marvell db64360 eval board by |
|
||||||
* Ingo Assmus <ingo.assmus@keymile.com> |
|
||||||
* |
|
||||||
* SPDX-License-Identifier: GPL-2.0+ |
|
||||||
*/ |
|
||||||
|
|
||||||
/*
|
|
||||||
* serial.c - serial support for the gal ev board |
|
||||||
*/ |
|
||||||
|
|
||||||
/* supports both the 16650 duart and the MPSC */ |
|
||||||
|
|
||||||
#include <common.h> |
|
||||||
#include <command.h> |
|
||||||
#include <serial.h> |
|
||||||
#include <linux/compiler.h> |
|
||||||
|
|
||||||
#include "../include/memory.h" |
|
||||||
|
|
||||||
#include "ns16550.h" |
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR; |
|
||||||
|
|
||||||
#ifdef CONFIG_MPSC |
|
||||||
static int marvell_serial_init(void) |
|
||||||
{ |
|
||||||
#if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2) |
|
||||||
int clock_divisor = 230400 / gd->baudrate; |
|
||||||
#endif |
|
||||||
|
|
||||||
mpsc_init (gd->baudrate); |
|
||||||
|
|
||||||
/* init the DUART chans so that KGDB in the kernel can use them */ |
|
||||||
#ifdef CONFIG_SYS_INIT_CHAN1 |
|
||||||
NS16550_reinit (COM_PORTS[0], clock_divisor); |
|
||||||
#endif |
|
||||||
#ifdef CONFIG_SYS_INIT_CHAN2 |
|
||||||
NS16550_reinit (COM_PORTS[1], clock_divisor); |
|
||||||
#endif |
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
static void marvell_serial_putc(const char c) |
|
||||||
{ |
|
||||||
if (c == '\n') |
|
||||||
mpsc_putchar ('\r'); |
|
||||||
|
|
||||||
mpsc_putchar (c); |
|
||||||
} |
|
||||||
|
|
||||||
static int marvell_serial_getc(void) |
|
||||||
{ |
|
||||||
return mpsc_getchar (); |
|
||||||
} |
|
||||||
|
|
||||||
static int marvell_serial_tstc(void) |
|
||||||
{ |
|
||||||
return mpsc_test_char (); |
|
||||||
} |
|
||||||
|
|
||||||
static void marvell_serial_setbrg(void) |
|
||||||
{ |
|
||||||
galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate); |
|
||||||
} |
|
||||||
|
|
||||||
#else /* ! CONFIG_MPSC */ |
|
||||||
|
|
||||||
static int marvell_serial_init(void) |
|
||||||
{ |
|
||||||
int clock_divisor = 230400 / gd->baudrate; |
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_INIT_CHAN1 |
|
||||||
(void) NS16550_init (0, clock_divisor); |
|
||||||
#endif |
|
||||||
#ifdef CONFIG_SYS_INIT_CHAN2 |
|
||||||
(void) NS16550_init (1, clock_divisor); |
|
||||||
#endif |
|
||||||
return (0); |
|
||||||
} |
|
||||||
|
|
||||||
static void marvell_serial_putc(const char c) |
|
||||||
{ |
|
||||||
if (c == '\n') |
|
||||||
NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r'); |
|
||||||
|
|
||||||
NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c); |
|
||||||
} |
|
||||||
|
|
||||||
static int marvell_serial_getc(void) |
|
||||||
{ |
|
||||||
return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]); |
|
||||||
} |
|
||||||
|
|
||||||
static int marvell_serial_tstc(void) |
|
||||||
{ |
|
||||||
return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]); |
|
||||||
} |
|
||||||
|
|
||||||
static void marvell_serial_setbrg(void) |
|
||||||
{ |
|
||||||
int clock_divisor = 230400 / gd->baudrate; |
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_INIT_CHAN1 |
|
||||||
NS16550_reinit (COM_PORTS[0], clock_divisor); |
|
||||||
#endif |
|
||||||
#ifdef CONFIG_SYS_INIT_CHAN2 |
|
||||||
NS16550_reinit (COM_PORTS[1], clock_divisor); |
|
||||||
#endif |
|
||||||
} |
|
||||||
|
|
||||||
#endif /* CONFIG_MPSC */ |
|
||||||
|
|
||||||
static struct serial_device marvell_serial_drv = { |
|
||||||
.name = "marvell_serial", |
|
||||||
.start = marvell_serial_init, |
|
||||||
.stop = NULL, |
|
||||||
.setbrg = marvell_serial_setbrg, |
|
||||||
.putc = marvell_serial_putc, |
|
||||||
.puts = default_serial_puts, |
|
||||||
.getc = marvell_serial_getc, |
|
||||||
.tstc = marvell_serial_tstc, |
|
||||||
}; |
|
||||||
|
|
||||||
void marvell_serial_initialize(void) |
|
||||||
{ |
|
||||||
serial_register(&marvell_serial_drv); |
|
||||||
} |
|
||||||
|
|
||||||
__weak struct serial_device *default_serial_console(void) |
|
||||||
{ |
|
||||||
return &marvell_serial_drv; |
|
||||||
} |
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_KGDB) |
|
||||||
void kgdb_serial_init (void) |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
void putDebugChar (int c) |
|
||||||
{ |
|
||||||
serial_putc (c); |
|
||||||
} |
|
||||||
|
|
||||||
void putDebugStr (const char *str) |
|
||||||
{ |
|
||||||
serial_puts (str); |
|
||||||
} |
|
||||||
|
|
||||||
int getDebugChar (void) |
|
||||||
{ |
|
||||||
return serial_getc (); |
|
||||||
} |
|
||||||
|
|
||||||
void kgdb_interruptible (int yes) |
|
||||||
{ |
|
||||||
return; |
|
||||||
} |
|
||||||
#endif |
|
@ -1,173 +0,0 @@ |
|||||||
/* Memory.h - Memory mappings and remapping functions declarations */ |
|
||||||
|
|
||||||
/* Copyright - Galileo technology. */ |
|
||||||
|
|
||||||
#ifndef __INCmemoryh |
|
||||||
#define __INCmemoryh |
|
||||||
|
|
||||||
/* includes */ |
|
||||||
|
|
||||||
#include "core.h" |
|
||||||
|
|
||||||
/* defines */ |
|
||||||
|
|
||||||
#define DONT_MODIFY 0xffffffff |
|
||||||
#define PARITY_SUPPORT 0x40000000 |
|
||||||
#define MINIMUM_MEM_BANK_SIZE 0x10000 |
|
||||||
#define MINIMUM_DEVICE_WINDOW_SIZE 0x10000 |
|
||||||
#define MINIMUM_PCI_WINDOW_SIZE 0x10000 |
|
||||||
#define MINIMUM_ACCESS_WIN_SIZE 0x10000 |
|
||||||
|
|
||||||
#define _8BIT 0x00000000 |
|
||||||
#define _16BIT 0x00100000 |
|
||||||
#define _32BIT 0x00200000 |
|
||||||
#define _64BIT 0x00300000 |
|
||||||
|
|
||||||
/* typedefs */ |
|
||||||
|
|
||||||
typedef struct deviceParam |
|
||||||
{ /* boundary values */ |
|
||||||
unsigned int turnOff; /* 0x0 - 0xf */ |
|
||||||
unsigned int acc2First; /* 0x0 - 0x1f */ |
|
||||||
unsigned int acc2Next; /* 0x0 - 0x1f */ |
|
||||||
unsigned int ale2Wr; /* 0x0 - 0xf */ |
|
||||||
unsigned int wrLow; /* 0x0 - 0xf */ |
|
||||||
unsigned int wrHigh; /* 0x0 - 0xf */ |
|
||||||
unsigned int badrSkew; /* 0x0 - 0x2 */ |
|
||||||
unsigned int DPEn; /* 0x0 - 0x1 */ |
|
||||||
unsigned int deviceWidth; /* in Bytes */ |
|
||||||
} DEVICE_PARAM; |
|
||||||
|
|
||||||
|
|
||||||
typedef enum __memBank{BANK0,BANK1,BANK2,BANK3} MEMORY_BANK; |
|
||||||
typedef enum __memDevice{DEVICE0,DEVICE1,DEVICE2,DEVICE3,BOOT_DEVICE} DEVICE; |
|
||||||
|
|
||||||
/*typedef enum __memoryProtectRegion{MEM_REGION0,MEM_REGION1,MEM_REGION2, \
|
|
||||||
MEM_REGION3,MEM_REGION4,MEM_REGION5, \
|
|
||||||
MEM_REGION6,MEM_REGION7} \
|
|
||||||
MEMORY_PROTECT_REGION;*/ |
|
||||||
/* There are four possible windows that can be defined as protected */ |
|
||||||
typedef enum _memoryProtectWindow{MEM_WINDOW0,MEM_WINDOW1,MEM_WINDOW2, |
|
||||||
MEM_WINDOW3 |
|
||||||
} MEMORY_PROTECT_WINDOW; |
|
||||||
/* When defining a protected window , this paramter indicates whether it
|
|
||||||
is accessible or not */ |
|
||||||
typedef enum __memoryAccess{MEM_ACCESS_ALLOWED,MEM_ACCESS_FORBIDEN} \
|
|
||||||
MEMORY_ACCESS; |
|
||||||
typedef enum __memoryWrite{MEM_WRITE_ALLOWED,MEM_WRITE_FORBIDEN} \
|
|
||||||
MEMORY_ACCESS_WRITE; |
|
||||||
typedef enum __memoryCacheProtect{MEM_CACHE_ALLOWED,MEM_CACHE_FORBIDEN} \
|
|
||||||
MEMORY_CACHE_PROTECT; |
|
||||||
typedef enum __memorySnoopType{MEM_NO_SNOOP,MEM_SNOOP_WT,MEM_SNOOP_WB} \
|
|
||||||
MEMORY_SNOOP_TYPE; |
|
||||||
typedef enum __memorySnoopRegion{MEM_SNOOP_REGION0,MEM_SNOOP_REGION1, \
|
|
||||||
MEM_SNOOP_REGION2,MEM_SNOOP_REGION3} \
|
|
||||||
MEMORY_SNOOP_REGION; |
|
||||||
|
|
||||||
/* There are 21 memory windows dedicated for the varios interfaces (PCI,
|
|
||||||
devCS (devices), CS(DDR), interenal registers and SRAM) used by the CPU's |
|
||||||
address decoding mechanism. */ |
|
||||||
typedef enum _memoryWindow {CS_0_WINDOW = BIT0, CS_1_WINDOW = BIT1, |
|
||||||
CS_2_WINDOW = BIT2, CS_3_WINDOW = BIT3, |
|
||||||
DEVCS_0_WINDOW = BIT4, DEVCS_1_WINDOW = BIT5, |
|
||||||
DEVCS_2_WINDOW = BIT6, DEVCS_3_WINDOW = BIT7, |
|
||||||
BOOT_CS_WINDOW = BIT8, PCI_0_IO_WINDOW = BIT9, |
|
||||||
PCI_0_MEM0_WINDOW = BIT10, |
|
||||||
PCI_0_MEM1_WINDOW = BIT11, |
|
||||||
PCI_0_MEM2_WINDOW = BIT12, |
|
||||||
PCI_0_MEM3_WINDOW = BIT13, PCI_1_IO_WINDOW = BIT14, |
|
||||||
PCI_1_MEM0_WINDOW = BIT15, PCI_1_MEM1_WINDOW =BIT16, |
|
||||||
PCI_1_MEM2_WINDOW = BIT17, PCI_1_MEM3_WINDOW =BIT18, |
|
||||||
INTEGRATED_SRAM_WINDOW = BIT19, |
|
||||||
INTERNAL_SPACE_WINDOW = BIT20, |
|
||||||
ALL_WINDOWS = 0X1FFFFF |
|
||||||
} MEMORY_WINDOW; |
|
||||||
|
|
||||||
typedef enum _memoryWindowStatus {MEM_WINDOW_ENABLED,MEM_WINDOW_DISABLED |
|
||||||
} MEMORY_WINDOW_STATUS; |
|
||||||
|
|
||||||
|
|
||||||
typedef enum _pciMemWindow{PCI_0_IO,PCI_0_MEM0,PCI_0_MEM1,PCI_0_MEM2,PCI_0_MEM3 |
|
||||||
#ifdef INCLUDE_PCI_1 |
|
||||||
,PCI_1_IO,PCI_1_MEM0,PCI_1_MEM1,PCI_1_MEM2,PCI_1_MEM3 |
|
||||||
#endif /* INCLUDE_PCI_1 */ |
|
||||||
} PCI_MEM_WINDOW; |
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------------------------------*/ |
|
||||||
|
|
||||||
/* functions */ |
|
||||||
unsigned int memoryGetBankBaseAddress(MEMORY_BANK bank); |
|
||||||
unsigned int memoryGetDeviceBaseAddress(DEVICE device); |
|
||||||
/* New at MV6436x */ |
|
||||||
unsigned int MemoryGetPciBaseAddr(PCI_MEM_WINDOW pciWindow); |
|
||||||
unsigned int memoryGetBankSize(MEMORY_BANK bank); |
|
||||||
unsigned int memoryGetDeviceSize(DEVICE device); |
|
||||||
unsigned int memoryGetDeviceWidth(DEVICE device); |
|
||||||
/* New at MV6436x */ |
|
||||||
unsigned int gtMemoryGetPciWindowSize(PCI_MEM_WINDOW pciWindow); |
|
||||||
|
|
||||||
/* when given base Address and size Set new WINDOW for SCS_X. (X = 0,1,2 or 3*/ |
|
||||||
bool memoryMapBank(MEMORY_BANK bank, unsigned int bankBase,unsigned int bankLength); |
|
||||||
/* Set a new base and size for one of the memory banks (CS0 - CS3) */ |
|
||||||
bool gtMemorySetMemoryBank(MEMORY_BANK bank, unsigned int bankBase, |
|
||||||
unsigned int bankSize); |
|
||||||
bool memoryMapDeviceSpace(DEVICE device, unsigned int deviceBase,unsigned int deviceLength); |
|
||||||
|
|
||||||
/* Change the Internal Register Base Address to a new given Address. */ |
|
||||||
bool memoryMapInternalRegistersSpace(unsigned int internalRegBase); |
|
||||||
/* returns internal Register Space Base Address. */ |
|
||||||
unsigned int memoryGetInternalRegistersSpace(void); |
|
||||||
|
|
||||||
/* Returns the integrated SRAM Base Address. */ |
|
||||||
unsigned int memoryGetInternalSramBaseAddr(void); |
|
||||||
/* -------------------------------------------------------------------------------------------------*/ |
|
||||||
|
|
||||||
/* Set new base address for the integrated SRAM. */ |
|
||||||
void memorySetInternalSramBaseAddr(unsigned int sramBaseAddress); |
|
||||||
/* -------------------------------------------------------------------------------------------------*/ |
|
||||||
|
|
||||||
/* Delete a protection feature to a given space. */ |
|
||||||
void memoryDisableProtectRegion(MEMORY_PROTECT_WINDOW window); |
|
||||||
/* -------------------------------------------------------------------------------------------------*/ |
|
||||||
|
|
||||||
/* Writes a new remap value to the remap register */ |
|
||||||
unsigned int memorySetPciRemapValue(PCI_MEM_WINDOW memoryWindow, |
|
||||||
unsigned int remapValueHigh, |
|
||||||
unsigned int remapValueLow); |
|
||||||
/* -------------------------------------------------------------------------------------------------*/ |
|
||||||
|
|
||||||
/* Configurate the protection feature to a given space. */ |
|
||||||
bool memorySetProtectRegion(MEMORY_PROTECT_WINDOW window, |
|
||||||
MEMORY_ACCESS gtMemoryAccess, |
|
||||||
MEMORY_ACCESS_WRITE gtMemoryWrite, |
|
||||||
MEMORY_CACHE_PROTECT cacheProtection, |
|
||||||
unsigned int baseAddress, |
|
||||||
unsigned int size); |
|
||||||
|
|
||||||
/* Configurate the protection feature to a given space. */ |
|
||||||
/*bool memorySetProtectRegion(MEMORY_PROTECT_REGION region,
|
|
||||||
MEMORY_ACCESS memoryAccess, |
|
||||||
MEMORY_ACCESS_WRITE memoryWrite, |
|
||||||
MEMORY_CACHE_PROTECT cacheProtection, |
|
||||||
unsigned int baseAddress, |
|
||||||
unsigned int regionLength); */ |
|
||||||
/* Configurate the snoop feature to a given space. */ |
|
||||||
bool memorySetRegionSnoopMode(MEMORY_SNOOP_REGION region, |
|
||||||
MEMORY_SNOOP_TYPE snoopType, |
|
||||||
unsigned int baseAddress, |
|
||||||
unsigned int regionLength); |
|
||||||
|
|
||||||
bool memoryRemapAddress(unsigned int remapReg, unsigned int remapValue); |
|
||||||
bool memoryGetDeviceParam(DEVICE_PARAM *deviceParam, DEVICE deviceNum); |
|
||||||
bool memorySetDeviceParam(DEVICE_PARAM *deviceParam, DEVICE deviceNum); |
|
||||||
/* Set a new base and size for one of the PCI windows. */ |
|
||||||
bool memorySetPciWindow(PCI_MEM_WINDOW pciWindow, unsigned int pciWindowBase, |
|
||||||
unsigned int pciWindowSize); |
|
||||||
|
|
||||||
/* Disable or enable one of the 21 windows dedicated for the CPU's
|
|
||||||
address decoding mechanism */ |
|
||||||
void MemoryDisableWindow(MEMORY_WINDOW window); |
|
||||||
void MemoryEnableWindow (MEMORY_WINDOW window); |
|
||||||
MEMORY_WINDOW_STATUS MemoryGetMemWindowStatus(MEMORY_WINDOW window); |
|
||||||
#endif /* __INCmemoryh */ |
|
@ -1,293 +0,0 @@ |
|||||||
/* PCI.h - PCI functions header file */ |
|
||||||
|
|
||||||
/* Copyright - Galileo technology. */ |
|
||||||
|
|
||||||
#ifndef __INCpcih |
|
||||||
#define __INCpcih |
|
||||||
|
|
||||||
/* includes */ |
|
||||||
|
|
||||||
#include "core.h" |
|
||||||
#include "memory.h" |
|
||||||
|
|
||||||
/* According to PCI REV 2.1 MAX agents allowed on the bus are -21- */ |
|
||||||
#define PCI_MAX_DEVICES 22 |
|
||||||
|
|
||||||
|
|
||||||
/* Macros */ |
|
||||||
|
|
||||||
/* The next Macros configurate the initiator board (SELF) or any any agent on
|
|
||||||
the PCI to become: MASTER, response to MEMORY transactions , response to |
|
||||||
IO transactions or TWO both MEMORY_IO transactions. Those configuration |
|
||||||
are for both PCI0 and PCI1. */ |
|
||||||
|
|
||||||
#define PCI_MEMORY_ENABLE(host, deviceNumber) pciWriteConfigReg(host, \ |
|
||||||
PCI_STATUS_AND_COMMAND,deviceNumber,MEMORY_ENABLE | \
|
|
||||||
pciReadConfigReg(host, PCI_STATUS_AND_COMMAND,deviceNumber) ) |
|
||||||
|
|
||||||
#define PCI_IO_ENABLE(host, deviceNumber) pciWriteConfigReg(host, \ |
|
||||||
PCI_STATUS_AND_COMMAND,deviceNumber,I_O_ENABLE | \
|
|
||||||
pciReadConfigReg(host, PCI_STATUS_AND_COMMAND,deviceNumber) ) |
|
||||||
|
|
||||||
#define PCI_SLAVE_ENABLE(host, deviceNumber) pciWriteConfigReg(host, \ |
|
||||||
PCI_STATUS_AND_COMMAND,deviceNumber,MEMORY_ENABLE | I_O_ENABLE | \
|
|
||||||
pciReadConfigReg(host, PCI_STATUS_AND_COMMAND,deviceNumber) ) |
|
||||||
|
|
||||||
#define PCI_DISABLE(host, deviceNumber) pciWriteConfigReg(host, \ |
|
||||||
PCI_STATUS_AND_COMMAND,deviceNumber,0xfffffff8 & \
|
|
||||||
pciReadConfigReg(host, PCI_STATUS_AND_COMMAND,deviceNumber)) |
|
||||||
|
|
||||||
#define PCI_MASTER_ENABLE(host,deviceNumber) pciWriteConfigReg(host, \ |
|
||||||
PCI_STATUS_AND_COMMAND,deviceNumber,MASTER_ENABLE | \
|
|
||||||
pciReadConfigReg(host,PCI_STATUS_AND_COMMAND,deviceNumber) ) |
|
||||||
|
|
||||||
#define PCI_MASTER_DISABLE(deviceNumber) pciWriteConfigReg(host, \ |
|
||||||
PCI_STATUS_AND_COMMAND,deviceNumber,~MASTER_ENABLE & \
|
|
||||||
pciReadConfigReg(host,PCI_STATUS_AND_COMMAND,deviceNumber) ) |
|
||||||
|
|
||||||
#define MASTER_ENABLE BIT2 |
|
||||||
#define MEMORY_ENABLE BIT1 |
|
||||||
#define I_O_ENABLE BIT0 |
|
||||||
#define SELF 32 |
|
||||||
|
|
||||||
/* Agent on the PCI bus may have up to 6 BARS. */ |
|
||||||
#define BAR0 0x10 |
|
||||||
#define BAR1 0x14 |
|
||||||
#define BAR2 0x18 |
|
||||||
#define BAR3 0x1c |
|
||||||
#define BAR4 0x20 |
|
||||||
#define BAR5 0x24 |
|
||||||
#define BAR_SEL_MEM_IO BIT0 |
|
||||||
#define BAR_MEM_TYPE_32_BIT NO_BIT |
|
||||||
#define BAR_MEM_TYPE_BELOW_1M BIT1 |
|
||||||
#define BAR_MEM_TYPE_64_BIT BIT2 |
|
||||||
#define BAR_MEM_TYPE_RESERVED (BIT1 | BIT2) |
|
||||||
#define BAR_MEM_TYPE_MASK (BIT1 | BIT2) |
|
||||||
#define BAR_PREFETCHABLE BIT3 |
|
||||||
#define BAR_CONFIG_MASK (BIT0 | BIT1 | BIT2 | BIT3) |
|
||||||
|
|
||||||
/* Defines for the access regions. */ |
|
||||||
#define PREFETCH_ENABLE BIT12 |
|
||||||
#define PREFETCH_DISABLE NO_BIT |
|
||||||
#define DELAYED_READ_ENABLE BIT13 |
|
||||||
/* #define CACHING_ENABLE BIT14 */ |
|
||||||
/* aggressive prefetch: PCI slave prefetch two burst in advance*/ |
|
||||||
#define AGGRESSIVE_PREFETCH BIT16 |
|
||||||
/* read line aggresive prefetch: PCI slave prefetch two burst in advance*/ |
|
||||||
#define READ_LINE_AGGRESSIVE_PREFETCH BIT17 |
|
||||||
/* read multiple aggresive prefetch: PCI slave prefetch two burst in advance*/ |
|
||||||
#define READ_MULTI_AGGRESSIVE_PREFETCH BIT18 |
|
||||||
#define MAX_BURST_4 NO_BIT |
|
||||||
#define MAX_BURST_8 BIT20 /* Bits[21:20] = 01 */ |
|
||||||
#define MAX_BURST_16 BIT21 /* Bits[21:20] = 10 */ |
|
||||||
#define PCI_BYTE_SWAP NO_BIT /* Bits[25:24] = 00 */ |
|
||||||
#define PCI_NO_SWAP BIT24 /* Bits[25:24] = 01 */ |
|
||||||
#define PCI_BYTE_AND_WORD_SWAP BIT25 /* Bits[25:24] = 10 */ |
|
||||||
#define PCI_WORD_SWAP (BIT24 | BIT25) /* Bits[25:24] = 11 */ |
|
||||||
#define PCI_ACCESS_PROTECT BIT28 |
|
||||||
#define PCI_WRITE_PROTECT BIT29 |
|
||||||
|
|
||||||
/* typedefs */ |
|
||||||
|
|
||||||
typedef enum __pciAccessRegions{REGION0,REGION1,REGION2,REGION3,REGION4,REGION5, |
|
||||||
REGION6,REGION7} PCI_ACCESS_REGIONS; |
|
||||||
|
|
||||||
typedef enum __pciAgentPrio{LOW_AGENT_PRIO,HI_AGENT_PRIO} PCI_AGENT_PRIO; |
|
||||||
typedef enum __pciAgentPark{PARK_ON_AGENT,DONT_PARK_ON_AGENT} PCI_AGENT_PARK; |
|
||||||
|
|
||||||
typedef enum __pciSnoopType{PCI_NO_SNOOP,PCI_SNOOP_WT,PCI_SNOOP_WB} |
|
||||||
PCI_SNOOP_TYPE; |
|
||||||
typedef enum __pciSnoopRegion{PCI_SNOOP_REGION0,PCI_SNOOP_REGION1, |
|
||||||
PCI_SNOOP_REGION2,PCI_SNOOP_REGION3} |
|
||||||
PCI_SNOOP_REGION; |
|
||||||
|
|
||||||
typedef enum __memPciHost{PCI_HOST0,PCI_HOST1} PCI_HOST; |
|
||||||
typedef enum __memPciRegion{PCI_REGION0,PCI_REGION1, |
|
||||||
PCI_REGION2,PCI_REGION3, |
|
||||||
PCI_IO} |
|
||||||
PCI_REGION; |
|
||||||
|
|
||||||
/*ronen 7/Dec/03 */ |
|
||||||
typedef enum __pci_bar_windows{PCI_CS0_BAR, PCI_CS1_BAR, PCI_CS2_BAR, |
|
||||||
PCI_CS3_BAR, PCI_DEV_CS0_BAR, PCI_DEV_CS1_BAR, |
|
||||||
PCI_DEV_CS2_BAR, PCI_DEV_CS3_BAR, PCI_BOOT_CS_BAR, |
|
||||||
PCI_MEM_INT_REG_BAR, PCI_IO_INT_REG_BAR, |
|
||||||
PCI_P2P_MEM0_BAR, PCI_P2P_MEM1_BAR, |
|
||||||
PCI_P2P_IO_BAR, PCI_CPU_BAR, PCI_INT_SRAM_BAR, |
|
||||||
PCI_LAST_BAR} PCI_INTERNAL_BAR; |
|
||||||
|
|
||||||
typedef struct pciBar { |
|
||||||
unsigned int detectBase; |
|
||||||
unsigned int base; |
|
||||||
unsigned int size; |
|
||||||
unsigned int type; |
|
||||||
} PCI_BAR; |
|
||||||
|
|
||||||
typedef struct pciDevice { |
|
||||||
PCI_HOST host; |
|
||||||
char type[40]; |
|
||||||
unsigned int deviceNum; |
|
||||||
unsigned int venID; |
|
||||||
unsigned int deviceID; |
|
||||||
PCI_BAR bar[6]; |
|
||||||
} PCI_DEVICE; |
|
||||||
|
|
||||||
typedef struct pciSelfBars { |
|
||||||
unsigned int SCS0Base; |
|
||||||
unsigned int SCS0Size; |
|
||||||
unsigned int SCS1Base; |
|
||||||
unsigned int SCS1Size; |
|
||||||
unsigned int SCS2Base; |
|
||||||
unsigned int SCS2Size; |
|
||||||
unsigned int SCS3Base; |
|
||||||
unsigned int SCS3Size; |
|
||||||
unsigned int internalMemBase; |
|
||||||
unsigned int internalIOBase; |
|
||||||
unsigned int CS0Base; |
|
||||||
unsigned int CS0Size; |
|
||||||
unsigned int CS1Base; |
|
||||||
unsigned int CS1Size; |
|
||||||
unsigned int CS2Base; |
|
||||||
unsigned int CS2Size; |
|
||||||
unsigned int CS3Base; |
|
||||||
unsigned int CS3Size; |
|
||||||
unsigned int CSBootBase; |
|
||||||
unsigned int CSBootSize; |
|
||||||
unsigned int P2PMem0Base; |
|
||||||
unsigned int P2PMem0Size; |
|
||||||
unsigned int P2PMem1Base; |
|
||||||
unsigned int P2PMem1Size; |
|
||||||
unsigned int P2PIOBase; |
|
||||||
unsigned int P2PIOSize; |
|
||||||
unsigned int CPUBase; |
|
||||||
unsigned int CPUSize; |
|
||||||
} PCI_SELF_BARS; |
|
||||||
|
|
||||||
/* read/write configuration registers on local PCI bus. */ |
|
||||||
void pciWriteConfigReg(PCI_HOST host, unsigned int regOffset, |
|
||||||
unsigned int pciDevNum, unsigned int data); |
|
||||||
unsigned int pciReadConfigReg (PCI_HOST host, unsigned int regOffset, |
|
||||||
unsigned int pciDevNum); |
|
||||||
|
|
||||||
/* read/write configuration registers on another PCI bus. */ |
|
||||||
void pciOverBridgeWriteConfigReg(PCI_HOST host, |
|
||||||
unsigned int regOffset, |
|
||||||
unsigned int pciDevNum, |
|
||||||
unsigned int busNum,unsigned int data); |
|
||||||
unsigned int pciOverBridgeReadConfigReg(PCI_HOST host, |
|
||||||
unsigned int regOffset, |
|
||||||
unsigned int pciDevNum, |
|
||||||
unsigned int busNum); |
|
||||||
|
|
||||||
/* Performs full scane on both PCI and returns all detail possible on the
|
|
||||||
agents which exist on the bus. */ |
|
||||||
void pciScanDevices(PCI_HOST host, PCI_DEVICE *pci0Detect, |
|
||||||
unsigned int numberOfElment); |
|
||||||
|
|
||||||
/* Master`s memory space */ |
|
||||||
bool pciMapSpace(PCI_HOST host, PCI_REGION region, |
|
||||||
unsigned int remapBase, |
|
||||||
unsigned int deviceBase, |
|
||||||
unsigned int deviceLength); |
|
||||||
unsigned int pciGetSpaceBase(PCI_HOST host, PCI_REGION region); |
|
||||||
unsigned int pciGetSpaceSize(PCI_HOST host, PCI_REGION region); |
|
||||||
|
|
||||||
/* Slave`s memory space */ |
|
||||||
void pciMapMemoryBank(PCI_HOST host, MEMORY_BANK bank, |
|
||||||
unsigned int pci0Dram0Base, unsigned int pci0Dram0Size); |
|
||||||
|
|
||||||
#if 0 /* GARBAGE routines - dont use till they get cleaned up */
|
|
||||||
void pci0ScanSelfBars(PCI_SELF_BARS *pci0SelfBars); |
|
||||||
void pci1ScanSelfBars(PCI_SELF_BARS *pci1SelfBars); |
|
||||||
void pci0MapInternalRegSpace(unsigned int pci0InternalBase); |
|
||||||
void pci1MapInternalRegSpace(unsigned int pci1InternalBase); |
|
||||||
void pci0MapInternalRegIOSpace(unsigned int pci0InternalBase); |
|
||||||
void pci1MapInternalRegIOSpace(unsigned int pci1InternalBase); |
|
||||||
void pci0MapDevice0MemorySpace(unsigned int pci0Dev0Base, |
|
||||||
unsigned int pci0Dev0Length); |
|
||||||
void pci1MapDevice0MemorySpace(unsigned int pci1Dev0Base, |
|
||||||
unsigned int pci1Dev0Length); |
|
||||||
void pci0MapDevice1MemorySpace(unsigned int pci0Dev1Base, |
|
||||||
unsigned int pci0Dev1Length); |
|
||||||
void pci1MapDevice1MemorySpace(unsigned int pci1Dev1Base, |
|
||||||
unsigned int pci1Dev1Length); |
|
||||||
void pci0MapDevice2MemorySpace(unsigned int pci0Dev2Base, |
|
||||||
unsigned int pci0Dev2Length); |
|
||||||
void pci1MapDevice2MemorySpace(unsigned int pci1Dev2Base, |
|
||||||
unsigned int pci1Dev2Length); |
|
||||||
void pci0MapDevice3MemorySpace(unsigned int pci0Dev3Base, |
|
||||||
unsigned int pci0Dev3Length); |
|
||||||
void pci1MapDevice3MemorySpace(unsigned int pci1Dev3Base, |
|
||||||
unsigned int pci1Dev3Length); |
|
||||||
void pci0MapBootDeviceMemorySpace(unsigned int pci0DevBootBase, |
|
||||||
unsigned int pci0DevBootLength); |
|
||||||
void pci1MapBootDeviceMemorySpace(unsigned int pci1DevBootBase, |
|
||||||
unsigned int pci1DevBootLength); |
|
||||||
void pci0MapP2pMem0Space(unsigned int pci0P2pMem0Base, |
|
||||||
unsigned int pci0P2pMem0Length); |
|
||||||
void pci1MapP2pMem0Space(unsigned int pci1P2pMem0Base, |
|
||||||
unsigned int pci1P2pMem0Length); |
|
||||||
void pci0MapP2pMem1Space(unsigned int pci0P2pMem1Base, |
|
||||||
unsigned int pci0P2pMem1Length); |
|
||||||
void pci1MapP2pMem1Space(unsigned int pci1P2pMem1Base, |
|
||||||
unsigned int pci1P2pMem1Length); |
|
||||||
void pci0MapP2pIoSpace(unsigned int pci0P2pIoBase, |
|
||||||
unsigned int pci0P2pIoLength); |
|
||||||
void pci1MapP2pIoSpace(unsigned int pci1P2pIoBase, |
|
||||||
unsigned int pci1P2pIoLength); |
|
||||||
|
|
||||||
void pci0MapCPUspace(unsigned int pci0CpuBase, unsigned int pci0CpuLengs); |
|
||||||
void pci1MapCPUspace(unsigned int pci1CpuBase, unsigned int pci1CpuLengs); |
|
||||||
#endif |
|
||||||
|
|
||||||
/* PCI region options */ |
|
||||||
|
|
||||||
bool pciSetRegionFeatures(PCI_HOST host, PCI_ACCESS_REGIONS region, |
|
||||||
unsigned int features, unsigned int baseAddress, |
|
||||||
unsigned int regionLength); |
|
||||||
|
|
||||||
void pciDisableAccessRegion(PCI_HOST host, PCI_ACCESS_REGIONS region); |
|
||||||
|
|
||||||
/* PCI arbiter */ |
|
||||||
|
|
||||||
bool pciArbiterEnable(PCI_HOST host); |
|
||||||
bool pciArbiterDisable(PCI_HOST host); |
|
||||||
bool pciSetArbiterAgentsPriority(PCI_HOST host, PCI_AGENT_PRIO internalAgent, |
|
||||||
PCI_AGENT_PRIO externalAgent0, |
|
||||||
PCI_AGENT_PRIO externalAgent1, |
|
||||||
PCI_AGENT_PRIO externalAgent2, |
|
||||||
PCI_AGENT_PRIO externalAgent3, |
|
||||||
PCI_AGENT_PRIO externalAgent4, |
|
||||||
PCI_AGENT_PRIO externalAgent5); |
|
||||||
bool pciSetArbiterAgentsPriority(PCI_HOST host, PCI_AGENT_PRIO internalAgent, |
|
||||||
PCI_AGENT_PRIO externalAgent0, |
|
||||||
PCI_AGENT_PRIO externalAgent1, |
|
||||||
PCI_AGENT_PRIO externalAgent2, |
|
||||||
PCI_AGENT_PRIO externalAgent3, |
|
||||||
PCI_AGENT_PRIO externalAgent4, |
|
||||||
PCI_AGENT_PRIO externalAgent5); |
|
||||||
bool pciParkingDisable(PCI_HOST host, PCI_AGENT_PARK internalAgent, |
|
||||||
PCI_AGENT_PARK externalAgent0, |
|
||||||
PCI_AGENT_PARK externalAgent1, |
|
||||||
PCI_AGENT_PARK externalAgent2, |
|
||||||
PCI_AGENT_PARK externalAgent3, |
|
||||||
PCI_AGENT_PARK externalAgent4, |
|
||||||
PCI_AGENT_PARK externalAgent5); |
|
||||||
bool pciEnableBrokenAgentDetection(PCI_HOST host, unsigned char brokenValue); |
|
||||||
bool pciEnableBrokenAgentDetection(PCI_HOST host, unsigned char brokenValue); |
|
||||||
|
|
||||||
/* PCI-to-PCI (P2P) */ |
|
||||||
|
|
||||||
bool pciP2PConfig(PCI_HOST host, |
|
||||||
unsigned int SecondBusLow,unsigned int SecondBusHigh, |
|
||||||
unsigned int busNum,unsigned int devNum); |
|
||||||
/* PCI Cache-coherency */ |
|
||||||
|
|
||||||
bool pciSetRegionSnoopMode(PCI_HOST host, PCI_SNOOP_REGION region, |
|
||||||
PCI_SNOOP_TYPE snoopType, |
|
||||||
unsigned int baseAddress, |
|
||||||
unsigned int regionLength); |
|
||||||
|
|
||||||
PCI_DEVICE * pciFindDevice(unsigned short ven, unsigned short dev); |
|
||||||
|
|
||||||
#endif /* __INCpcih */ |
|
Loading…
Reference in new issue