moved FPGA config GPIO initialization into init_fpga.c to enable external JTAG FPGA configuration
This commit is contained in:
@@ -28,13 +28,17 @@
|
||||
#ifndef __SYSINIT_H__
|
||||
#define __SYSINIT_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/* function(s) from init_fpga.c */
|
||||
extern void init_fpga(void);
|
||||
extern bool init_fpga(void);
|
||||
extern void init_usb(void);
|
||||
|
||||
/* fault_vectors */
|
||||
extern void setup_vectors(void);
|
||||
|
||||
extern bool fpga_configured;
|
||||
|
||||
#endif /* __SYSINIT_H__ */
|
||||
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
#define MCF_EPORT_EPFR __MBAR+0xF0C
|
||||
|
||||
#define MCF_GPIO_PODR_FEC1L __MBAR+0xA07
|
||||
|
||||
#define MCF_PSC0_PSCTB_8BIT __MBAR+0x860C
|
||||
|
||||
#define MCF_PSC3_PSCRB_8BIT __MBAR+0x890C
|
||||
|
||||
@@ -38,51 +38,41 @@ extern uint8_t _FPGA_FLASH_DATA[];
|
||||
extern uint8_t _FPGA_FLASH_DATA_SIZE[];
|
||||
#define FPGA_FLASH_DATA_SIZE ((uint32_t) &_FPGA_FLASH_DATA_SIZE[0])
|
||||
|
||||
|
||||
#ifdef _NOT_USED_
|
||||
void test_longword(void)
|
||||
void config_gpio_for_fpga_config(void)
|
||||
{
|
||||
uint32_t *fpga_data = (uint32_t *) FPGA_FLASH_DATA;
|
||||
const uint32_t *fpga_flash_data_end = (uint32_t *) FPGA_FLASH_DATA + FPGA_FLASH_DATA_SIZE;
|
||||
do
|
||||
{
|
||||
uint32_t value = *fpga_data++;
|
||||
xprintf("LONGWORDS: addr=%p, value=%08x\r", fpga_data, value);
|
||||
} while (fpga_data < fpga_flash_data_end);
|
||||
xprintf("finished. \r\n");
|
||||
#if defined(MACHINE_FIREBEE)
|
||||
/*
|
||||
* Configure GPIO FEC1L port directions (needed to load FPGA configuration)
|
||||
*/
|
||||
MCF_GPIO_PDDR_FEC1L = 0 | /* bit 7 = input */
|
||||
0 | /* bit 6 = input */
|
||||
0 | /* bit 5 = input */
|
||||
MCF_GPIO_PDDR_FEC1L_PDDR_FEC1L4 | /* bit 4 = LED => output */
|
||||
MCF_GPIO_PDDR_FEC1L_PDDR_FEC1L3 | /* bit 3 = PRG_DQ0 => output */
|
||||
MCF_GPIO_PDDR_FEC1L_PDDR_FEC1L2 | /* bit 2 = FPGA_CONFIG => output */
|
||||
MCF_GPIO_PDDR_FEC1L_PDDR_FEC1L1 | /* bit 1 = PRG_CLK (FPGA) => output */
|
||||
0; /* bit 0 => input */
|
||||
#endif /* MACHINE_FIREBEE */
|
||||
}
|
||||
|
||||
void test_word(void)
|
||||
void config_gpio_for_jtag_config(void)
|
||||
{
|
||||
uint16_t *fpga_data = (uint16_t *) FPGA_FLASH_DATA;
|
||||
const uint16_t *fpga_flash_data_end = (uint16_t *) FPGA_FLASH_DATA + FPGA_FLASH_DATA_SIZE;
|
||||
|
||||
do
|
||||
{
|
||||
uint16_t value = *fpga_data++;
|
||||
xprintf("WORDS: addr=%p, value=%04x\r", fpga_data, value);
|
||||
} while (fpga_data < fpga_flash_data_end);
|
||||
xprintf("finished. \r\n");
|
||||
/*
|
||||
* configure FEC1L port directions to enable external JTAG configuration download to FPGA
|
||||
*/
|
||||
MCF_GPIO_PDDR_FEC1L = 0 |
|
||||
MCF_GPIO_PDDR_FEC1L_PDDR_FEC1L4; /* bit 4 = LED => output */
|
||||
/* all other bits = input */
|
||||
/*
|
||||
* unfortunately, the GPIO module cannot trigger interrupts. That means FPGA_CONFIG needs to be polled to detect
|
||||
* external FPGA (re)configuration and reset the system in that case. Could be done from the OS as well...
|
||||
*/
|
||||
}
|
||||
|
||||
void test_byte(void)
|
||||
{
|
||||
uint8_t *fpga_data = (uint8_t *) FPGA_FLASH_DATA;
|
||||
const uint8_t *fpga_flash_data_end = (uint8_t *) FPGA_FLASH_DATA + FPGA_FLASH_DATA_SIZE;
|
||||
|
||||
do
|
||||
{
|
||||
uint8_t value = *fpga_data++;
|
||||
xprintf("LONGWORDS: addr=%p, value=%08x\r", fpga_data, value);
|
||||
} while (fpga_data < fpga_flash_data_end);
|
||||
xprintf("finished. \r\n");
|
||||
}
|
||||
#endif /* _NOT_USED_ */
|
||||
|
||||
/*
|
||||
* load FPGA
|
||||
*/
|
||||
void init_fpga(void)
|
||||
bool init_fpga(void)
|
||||
{
|
||||
uint8_t *fpga_data;
|
||||
volatile int32_t time, start, end;
|
||||
@@ -91,6 +81,7 @@ void init_fpga(void)
|
||||
xprintf("FPGA load config... ");
|
||||
start = MCF_SLT0_SCNT;
|
||||
|
||||
config_gpio_for_fpga_config();
|
||||
MCF_GPIO_PODR_FEC1L &= ~FPGA_CLOCK; /* FPGA clock => low */
|
||||
|
||||
/* pulling FPGA_CONFIG to low resets the FPGA */
|
||||
@@ -161,9 +152,10 @@ void init_fpga(void)
|
||||
time = (start - end) / (SYSCLK / 1000) / 1000;
|
||||
|
||||
xprintf("finished (took %f seconds).\r\n", time / 1000.0);
|
||||
config_gpio_for_jtag_config();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
xprintf("FAILED!\r\n");
|
||||
}
|
||||
config_gpio_for_jtag_config();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* This object file must be the first to be linked,
|
||||
* so it will be placed at the very beginning of the ROM.
|
||||
@@ -64,6 +65,3 @@ _rom_entry:
|
||||
|
||||
/* initialize any hardware specific issues */
|
||||
bra _initialize_hardware
|
||||
|
||||
|
||||
// vim: set syntax=asm68k :
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
|
||||
#define UNUSED(x) (void)(x) /* Unused variable */
|
||||
|
||||
bool fpga_configured = false; /* for FPGA JTAG configuration */
|
||||
|
||||
extern volatile long _VRAM; /* start address of video ram from linker script */
|
||||
|
||||
/*
|
||||
@@ -207,20 +209,6 @@ void init_gpio(void)
|
||||
MCF_PAD_PAR_TIMER_PAR_TOUT3 |
|
||||
MCF_PAD_PAR_TIMER_PAR_TIN2(MCF_PAD_PAR_TIMER_PAR_TIN2_IRQ2) |
|
||||
MCF_PAD_PAR_TIMER_PAR_TOUT2;
|
||||
|
||||
#if defined(MACHINE_FIREBEE)
|
||||
/*
|
||||
* Configure GPIO FEC1L port directions (needed to load FPGA configuration)
|
||||
*/
|
||||
MCF_GPIO_PDDR_FEC1L = 0 | /* bit 7 = input */
|
||||
0 | /* bit 6 = input */
|
||||
0 | /* bit 5 = input */
|
||||
MCF_GPIO_PDDR_FEC1L_PDDR_FEC1L4 | /* bit 4 = LED => output */
|
||||
MCF_GPIO_PDDR_FEC1L_PDDR_FEC1L3 | /* bit 3 = PRG_DQ0 => output */
|
||||
MCF_GPIO_PDDR_FEC1L_PDDR_FEC1L2 | /* bit 2 = FPGA_CONFIG => output */
|
||||
MCF_GPIO_PDDR_FEC1L_PDDR_FEC1L1 | /* bit 1 = PRG_CLK (FPGA) => output */
|
||||
0; /* bit 0 => input */
|
||||
#endif /* MACHINE_FIREBEE */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1109,34 +1097,12 @@ void initialize_hardware(void)
|
||||
#if MACHINE_FIREBEE
|
||||
if (coldboot) /* does not work with BDM */
|
||||
;
|
||||
init_fpga();
|
||||
fpga_configured = init_fpga();
|
||||
|
||||
init_pll();
|
||||
init_video_ddr();
|
||||
dvi_on();
|
||||
|
||||
#ifdef _NOT_USED_
|
||||
/* experimental */
|
||||
{
|
||||
int i;
|
||||
uint32_t *scradr = (uint32_t *) 0xd00000;
|
||||
|
||||
for (i = 0; i < 100; i++)
|
||||
{
|
||||
uint32_t *p = scradr;
|
||||
|
||||
for (p = scradr; p < scradr + 1024 * 150L; p++)
|
||||
{
|
||||
*p = 0xffffffff;
|
||||
}
|
||||
for (p = scradr; p < scradr + 1024 * 150L; p++)
|
||||
{
|
||||
*p = 0x0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* _NOT_USED_ */
|
||||
|
||||
#endif /* MACHINE_FIREBEE */
|
||||
driver_mem_init();
|
||||
init_pci();
|
||||
|
||||
Reference in New Issue
Block a user