[Armadeus-commitlog] armadeus branch, master, updated. armadeus-4.1-137-ga0c9ab8
Brought to you by:
sszy
|
From: Fabien M <fa...@us...> - 2012-03-15 09:08:38
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via a0c9ab8569ac894c9d23f522081c9077c7cd5bb7 (commit)
via df322cc8b405e0dc16f2829721d1ac911a86d2c0 (commit)
from 68d1c9ccd8222f200399922b5d1a1e7c3c2b53b7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a0c9ab8569ac894c9d23f522081c9077c7cd5bb7
Merge: df322cc 68d1c9c
Author: Fabien Marteau <fab...@ar...>
Date: Thu Mar 15 10:07:58 2012 +0100
Merge branch 'master' of ssh://armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit df322cc8b405e0dc16f2829721d1ac911a86d2c0
Author: Fabien Marteau <fab...@ar...>
Date: Thu Mar 15 10:07:17 2012 +0100
[FPGA] Clean spartan_loadsecond download driver
-----------------------------------------------------------------------
Summary of changes:
.../sploader/spartan_loadsecond.c | 107 +++-----------------
1 files changed, 13 insertions(+), 94 deletions(-)
diff --git a/target/linux/modules/fpga/virtual_components/sploader/spartan_loadsecond.c b/target/linux/modules/fpga/virtual_components/sploader/spartan_loadsecond.c
index 2e20238..9e1819c 100644
--- a/target/linux/modules/fpga/virtual_components/sploader/spartan_loadsecond.c
+++ b/target/linux/modules/fpga/virtual_components/sploader/spartan_loadsecond.c
@@ -28,7 +28,6 @@
Xilinx_desc *xil_desc;
-/* Timeout function */
static unsigned long get_timer(unsigned long initTime)
{
struct timeval tv;
@@ -42,21 +41,18 @@ static unsigned long get_timer(unsigned long initTime)
int fpga_spartan6_abort_fn(Xilinx_desc *desc, int cookie)
{
int config;
- //Xilinx_desc *desc = xil_desc; //apf27_fpga_get_desc(cookie);
- //config = ioread16(SELECTMAP_CONFIG_REG); /* read config */
+
config = readw(SELECTMAP_CONFIG_REG); /* read config */
config |= (1 << SELECTMAP_CONFIG_CLK); /* IP in clock mode */
- //iowrite16(config, SELECTMAP_CONFIG_REG); /* write config */
writew(config, SELECTMAP_CONFIG_REG); /* write config */
+
return cookie;
}
int fpga_spartan6_busy_fn(Xilinx_desc *desc, int cookie)
{
u16 status;
- //Xilinx_desc *desc = xil_desc; //apf27_fpga_get_desc(cookie);
- //status = ioread16(SELECTMAP_STATUS_REG); /* read config */
status = readw(SELECTMAP_STATUS_REG); /* read config */
return (((status & (1 << SELECTMAP_STATUS_BUSY)) != 0) ? 0 : 1);
@@ -65,7 +61,6 @@ int fpga_spartan6_busy_fn(Xilinx_desc *desc, int cookie)
int fpga_spartan6_post_fn(Xilinx_desc *desc, int cookie)
{
int config;
- //Xilinx_desc *desc = xil_desc; //apf27_fpga_get_desc(cookie);
config = readw(SELECTMAP_CONFIG_REG); /* read config */
config |= (1 << SELECTMAP_CONFIG_CLK); /* IP in clock mode */
@@ -83,35 +78,18 @@ int loadsecond(Xilinx_desc * desc)
fn = desc->iface_fns;
ret_val = FPGA_FAIL; /* assume the worst */
- //desc->ip_addr = ip_addr;
-
- printk("%s: start with interface functions @ 0x%p\n", __FUNCTION__, fn);
if (fn) {
int ret;
int cookie = desc->cookie; /* make a local copy */
unsigned long ts; /* timestamp */
-/* printk("%s: Function Table:\n"
- "ptr:\t0x%p\n struct: 0x%p\n pre: 0x%p\n"
- "pgm:\t0x%p\n init:\t0x%p\n err:\t0x%p\n"
- "clk:\t0x%p\n cs:\t0x%p\n wr:\t0x%p\n"
- "read data:\t0x%p\n write data:\t0x%p\n"
- "busy:\t0x%p\n abort:\t0x%p\n",
- "post:\t0x%p\n\n",
- __FUNCTION__, &fn, fn, fn->pre, fn->pgm, fn->init,
- fn->err, fn->clk, fn->cs, fn->wr, fn->rdata, fn->wdata,
- fn->busy, fn->abort, fn->post);
-*/
/*
* This code is designed to emulate the "Express Style"
* Continuous Data Loading in Slave Parallel Mode for
* the Spartan-VI Family.
- */
- printk("Loading FPGA Device %d...\n", cookie);
- /*
+ *
* Run the pre configuration function if there is one.
*/
- printk("Run pre function\n");
if (*fn->pre) {
ret = (*fn->pre) (desc, cookie);
if (ret < 0)
@@ -128,25 +106,18 @@ int loadsecond(Xilinx_desc * desc)
/* Wait for INIT_N low */
ts = get_timer(0); /* get current time */
- /* Now wait for INIT and BUSY to go high */
- printk("/* Now wait for INIT and BUSY to go high */\n");
do {
CONFIG_FPGA_DELAY();
if (get_timer(ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */
- printk
- ("** Timeout waiting for INIT to clear.\n");
+ printk ("** Timeout waiting for INIT to clear.\n");
(*fn->abort) (desc, cookie); /* abort the burn */
return FPGA_FAIL;
}
} while ((*fn->init) (desc, cookie) == FPGA_SUCCESS);
- printk("Assert write\n");
(*fn->wr) (desc, TRUE, TRUE, cookie); /* Assert write, commit */
-
- printk("ASSERT chip select\n");
(*fn->cs) (desc, TRUE, TRUE, cookie); /* Assert chip select, commit */
- printk("/* Load the data */\n");
}
return 0;
}
@@ -176,26 +147,22 @@ int end_load(Xilinx_desc * desc)
{
int ret_val = FPGA_FAIL; /* assume the worst */
Xilinx_Spartan6_Slave_SelectMap_fns *fn;
-// xil_desc = desc;
fn = desc->iface_fns;
ret_val = FPGA_FAIL; /* assume the worst */
if (fn) {
int cookie = desc->cookie; /* make a local copy */
- //size_t bytecount = 0;
- //unsigned char *data = (unsigned char *)buf;
unsigned long ts; /* timestamp */
+
/* now check for done signal */
- printk("/* now check for done signal */\n");
ts = get_timer(0); /* get current time */
ret_val = FPGA_SUCCESS;
while ((*fn->done) (desc, cookie) == FPGA_FAIL) {
/* XXX - we should have a check in here somewhere to
* make sure we aren't busy forever... */
- if (get_timer(ts) > 20000 /*CONFIG_SYS_FPGA_WAIT */ ) { /* check the time */
- printk
- ("** Timeout waiting for DONE to clear.\n");
+ if (get_timer(ts) > 20000 ) { /* check the time */
+ printk("** Timeout waiting for DONE to clear.\n");
(*fn->abort) (desc, cookie); /* abort the burn */
ret_val = FPGA_FAIL;
break;
@@ -203,9 +170,7 @@ int end_load(Xilinx_desc * desc)
}
CONFIG_FPGA_DELAY();
- printk("Deassert chip select\n");
(*fn->cs) (desc, FALSE, TRUE, cookie); /* Deassert the chip select */
- printk("Deassert write pin\n");
(*fn->wr) (desc, FALSE, TRUE, cookie); /* Deassert the write pin */
printk("\n"); /* terminate the dotted line */
@@ -230,40 +195,24 @@ int end_load(Xilinx_desc * desc)
int fpga_spartan6_init_fn(Xilinx_desc *desc, int cookie)
{
uint16_t status;
-// Xilinx_desc *desc = xil_desc;
status = readw(SELECTMAP_STATUS_REG);
- printk("%s:%d: INIT check", __FUNCTION__, __LINE__);
- printk("%d\n",
- (((status & (1 << SELECTMAP_STATUS_INIT_N)) == 0) ? 1 : 0));
- printk("\n");
-
return (((status & (1 << SELECTMAP_STATUS_INIT_N)) ==
0) ? FPGA_SUCCESS : FPGA_FAIL);
}
-/*
- * * Set the FPGA's active-high clock line to the specified level
- * */
+/* Set the FPGA's active-high clock line to the specified level */
int fpga_spartan6_clk_fn(Xilinx_desc *desc, int assert_clk, int flush, int cookie)
{
- printk("%s:%d: FPGA SET| CLOCK %s", __FUNCTION__, __LINE__,
- assert_clk ? "high" : "low");
- printk("\n");
-
/* clock pulse is generated when a data is wrote */
-
return assert_clk;
}
-/*
- * * Test the state of the active-high FPGA DONE pin
- * */
+/* Test the state of the active-high FPGA DONE pin */
int fpga_spartan6_done_fn(Xilinx_desc *desc, int cookie)
{
uint16_t status;
-// Xilinx_desc *desc = xil_desc;
status = readw(SELECTMAP_STATUS_REG);
return (((status & (1 << SELECTMAP_STATUS_DONE)) ==
@@ -273,8 +222,6 @@ int fpga_spartan6_done_fn(Xilinx_desc *desc, int cookie)
/* TODO: read/write in 16bits mode */
int fpga_spartan6_rdata_fn(Xilinx_desc *desc, unsigned char *data, int cookie)
{
-// Xilinx_desc *desc = xil_desc; //apf27_fpga_get_desc(cookie);
-
*data = (readw(SELECTMAP_DATA_REG) & 0xff);
printk(".");
@@ -285,26 +232,16 @@ int fpga_spartan6_wdata_fn(Xilinx_desc *desc, unsigned char data,
int flush, int cookie)
{
uint16_t val = data & 0x00ff;
-// Xilinx_desc *desc = xil_desc;
writew(val, SELECTMAP_DATA_REG);
return data;
}
-/* end of TODO */
-
-/*
- * * Set the FPGA's wr line to the specified level
- * */
+/* Set the FPGA's wr line to the specified level */
int fpga_spartan6_wr_fn(Xilinx_desc *desc, int assert_write, int flush, int cookie)
{
unsigned short config;
-// Xilinx_desc *desc = xil_desc;
-
- printk("%s:%d: FPGA SET| RW %s ", __FUNCTION__, __LINE__,
- assert_write ? "high" : "low");
- printk("\n");
config = readw(SELECTMAP_CONFIG_REG);
if (assert_write)
@@ -319,12 +256,6 @@ int fpga_spartan6_wr_fn(Xilinx_desc *desc, int assert_write, int flush, int cook
int fpga_spartan6_cs_fn(Xilinx_desc *desc, int assert_cs, int flush, int cookie)
{
int config;
-// Xilinx_desc *desc = xil_desc;
-
- printk("%s:%d: FPGA SET| CS %s ", __FUNCTION__, __LINE__,
- assert_cs ? "high" : "low");
- printk("\n");
-
config = readw(SELECTMAP_CONFIG_REG);
if (assert_cs)
config &= ~(1 << SELECTMAP_CONFIG_CSI_N);
@@ -335,16 +266,12 @@ int fpga_spartan6_cs_fn(Xilinx_desc *desc, int assert_cs, int flush, int cookie)
return assert_cs;
}
-/*
- * * Initialize FPGA before download
- * */
+/* Initialize FPGA before download */
int fpga_spartan6_pre_fn(Xilinx_desc *desc, int cookie)
{
int config;
-// Xilinx_desc *desc = xil_desc;
config = readw(SELECTMAP_CONFIG_REG);
- printk("config avant : %02x\n", config);
config &= ~(1 << SELECTMAP_CONFIG_CLK); /* IP in selectmap mode */
config |= (1 << SELECTMAP_CONFIG_OS); /* OS High */
config |= (1 << SELECTMAP_CONFIG_CSI_N); /* CSI_n High */
@@ -352,27 +279,19 @@ int fpga_spartan6_pre_fn(Xilinx_desc *desc, int cookie)
config |= (1 << SELECTMAP_CONFIG_RDWR_N); /* rdwr_n High */
writew(config, SELECTMAP_CONFIG_REG);
- printk("valeur a ecrire : %02x\n", config);
udelay(1); /*wait until supply started */
config = readw(SELECTMAP_CONFIG_REG);
- printk("valeur apres : %02x\n", config);
+
return cookie;
}
-/*
- * * Set the FPGA's active-low program line to the specified level
- * */
+/* Set the FPGA's active-low program line to the specified level */
int fpga_spartan6_pgm_fn(Xilinx_desc *desc, int assert, int flush, int cookie)
{
unsigned short config;
- //Xilinx_desc *desc = xil_desc;
config = readw(SELECTMAP_CONFIG_REG);
- printk("%s:%d: FPGA SET PROGRAM %s", __FUNCTION__, __LINE__,
- assert ? "high" : "low");
- printk("\n");
-
if (assert)
config &= ~(1 << SELECTMAP_CONFIG_PROGRAM_N);
else
hooks/post-receive
--
armadeus
|