{\r
struct spi_fpga_port *port =\r
container_of(work, struct spi_fpga_port, fpga_trans_work);\r
-\r
+ unsigned long flags;\r
+ spin_lock_irqsave(&port->work_lock, flags);\r
while (!list_empty(&port->trans_queue)) \r
{\r
- struct spi_fpga_transfer *t = NULL;\r
- list_for_each_entry(t, &port->trans_queue, queue)\r
+ struct spi_fpga_transfer *t = NULL, *tmp;\r
+ list_for_each_entry_safe(t, tmp, &port->trans_queue, queue)\r
{\r
\r
if (t->id == 0) \r
break;\r
\r
}\r
- kfree(t);\r
kfree(t->txbuf);\r
+ kfree(t);\r
}\r
list_del_init(&port->trans_queue);\r
}\r
+ spin_unlock_irqrestore(&port->work_lock, flags);\r
\r
}\r
\r
}\r
\r
\r
-static int spi_open_sysclk(int set)\r
+static int spi_set_sysclk(int set)\r
{\r
int ret;\r
ret = gpio_request(SPI_FPGA_STANDBY_PIN, NULL);\r
mutex_init(&port->spi_lock);\r
spin_lock_init(&port->work_lock);\r
\r
- spi_open_sysclk(GPIO_HIGH);\r
+ spi_set_sysclk(GPIO_HIGH);\r
\r
#if SPI_FPGA_TRANS_WORK\r
init_waitqueue_head(&port->wait_wq);\r
port->write_en = TRUE;\r
port->read_en = TRUE;\r
sprintf(b, "fpga_trans_workqueue");\r
- port->fpga_trans_workqueue = create_freezeable_workqueue(b);\r
+ port->fpga_trans_workqueue = create_rt_workqueue(b);\r
if (!port->fpga_trans_workqueue) {\r
printk("cannot create workqueue\n");\r
return -EBUSY;\r
\r
//spi_fpga_rst();\r
sprintf(b, "fpga_irq_workqueue");\r
- port->fpga_irq_workqueue = create_freezeable_workqueue(b);\r
+ port->fpga_irq_workqueue = create_rt_workqueue(b);\r
if (!port->fpga_irq_workqueue) {\r
printk("cannot create workqueue\n");\r
return -EBUSY;\r
spi_out(port,reg,len,SEL_I2C);\r
\r
#if SPI_FPGA_I2C_EVENT\r
- wait_event_timeout(port->i2c.wait_r, port->i2c.interrupt == INT_I2C_READ_ACK, msecs_to_jiffies(30)); \r
+ ret = wait_event_timeout(port->i2c.wait_r, port->i2c.interrupt == INT_I2C_READ_ACK, msecs_to_jiffies(60)); \r
+ if(ret == 0)\r
+ {\r
+ printk("%s:60ms time out!\n",__FUNCTION__);\r
+ return -1;\r
+ }\r
for(i = 0;i<len;i++)\r
{\r
result = spi_in(port,channel,SEL_I2C);\r
reg = channel|ICE_SEL_I2C_STOP;\r
spi_out(port,reg,pmsg->buf[i],SEL_I2C);\r
#if SPI_FPGA_I2C_EVENT\r
- wait_event_timeout(port->i2c.wait_w, port->i2c.interrupt == INT_I2C_WRITE_ACK, msecs_to_jiffies(30));\r
+ ret = wait_event_timeout(port->i2c.wait_w, port->i2c.interrupt == INT_I2C_WRITE_ACK, msecs_to_jiffies(60));\r
+ if(ret == 0)\r
+ {\r
+ printk("%s:60ms time out!\n",__FUNCTION__);\r
+ return -1;\r
+ }\r
spin_lock(&port->i2c.i2c_lock);\r
port->i2c.interrupt &= INT_I2C_WRITE_MASK;\r
spin_unlock(&port->i2c.i2c_lock);\r