Staging: sep: clean up command sending
Split out the debug dumping functionality. Clean up the rest. For the moment leave the hideous cache flush in there as the code needs fixing to use the dma_map_sg interfaces not its own crazed table functions Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
6f9e0f60c4
commit
2e7dcc3bbf
1 changed files with 45 additions and 23 deletions
|
@ -461,7 +461,8 @@ static unsigned int sep_poll(struct file *filp, poll_table * wait)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
calculates time and sets it at the predefined address
|
calculates time and sets it at the predefined address. Called with the
|
||||||
|
mutex held.
|
||||||
*/
|
*/
|
||||||
static int sep_set_time(struct sep_device *sep, unsigned long *address_ptr, unsigned long *time_in_sec_ptr)
|
static int sep_set_time(struct sep_device *sep, unsigned long *address_ptr, unsigned long *time_in_sec_ptr)
|
||||||
{
|
{
|
||||||
|
@ -496,53 +497,74 @@ static int sep_set_time(struct sep_device *sep, unsigned long *address_ptr, unsi
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
This function raises interrupt to SEP that signals that is has a new
|
* sep_dump_message - dump the message that is pending
|
||||||
command from HOST
|
* @sep: sep device
|
||||||
|
*
|
||||||
|
* Dump out the message pending in the shared message area
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static void sep_dump_message(struct sep_device *sep)
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
for (count = 0; count < 12 * 4; count += 4)
|
||||||
|
edbg("Word %d of the message is %u\n", count, *((u32 *) (sep->shared_addr + count)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sep_send_command_handler - kick off a command
|
||||||
|
* @sep: sep being signalled
|
||||||
|
*
|
||||||
|
* This function raises interrupt to SEP that signals that is has a new
|
||||||
|
* command from the host
|
||||||
|
*/
|
||||||
|
|
||||||
static void sep_send_command_handler(struct sep_device *sep)
|
static void sep_send_command_handler(struct sep_device *sep)
|
||||||
{
|
{
|
||||||
unsigned long count;
|
dbg("sep:sep_send_command_handler start\n");
|
||||||
|
|
||||||
dbg("SEP Driver:--------> sep_send_command_handler start\n");
|
mutex_lock(&sep_mutex);
|
||||||
sep_set_time(sep, 0, 0);
|
sep_set_time(sep, 0, 0);
|
||||||
|
|
||||||
/* flash cache */
|
/* FIXME: flush cache */
|
||||||
flush_cache_all();
|
flush_cache_all();
|
||||||
|
|
||||||
for (count = 0; count < 12 * 4; count += 4)
|
sep_dump_message(sep);
|
||||||
edbg("Word %lu of the message is %lu\n", count, *((unsigned long *) (sep->shared_addr + count)));
|
|
||||||
|
|
||||||
/* update counter */
|
/* update counter */
|
||||||
sep->send_ct++;
|
sep->send_ct++;
|
||||||
/* send interrupt to SEP */
|
/* send interrupt to SEP */
|
||||||
sep_write_reg(sep, HW_HOST_HOST_SEP_GPR0_REG_ADDR, 0x2);
|
sep_write_reg(sep, HW_HOST_HOST_SEP_GPR0_REG_ADDR, 0x2);
|
||||||
dbg("SEP Driver:<-------- sep_send_command_handler end\n");
|
dbg("SEP Driver:<-------- sep_send_command_handler end\n");
|
||||||
|
mutex_unlock(&sep_mutex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
This function raises interrupt to SEPm that signals that is has a
|
* sep_send_reply_command_handler - kick off a command reply
|
||||||
new command from HOST
|
* @sep: sep being signalled
|
||||||
|
*
|
||||||
|
* This function raises interrupt to SEP that signals that is has a new
|
||||||
|
* command from the host
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void sep_send_reply_command_handler(struct sep_device *sep)
|
static void sep_send_reply_command_handler(struct sep_device *sep)
|
||||||
{
|
{
|
||||||
unsigned long count;
|
dbg("sep:sep_send_reply_command_handler start\n");
|
||||||
|
|
||||||
dbg("SEP Driver:--------> sep_send_reply_command_handler start\n");
|
|
||||||
|
|
||||||
/* flash cache */
|
/* flash cache */
|
||||||
flush_cache_all();
|
flush_cache_all();
|
||||||
for (count = 0; count < 12 * 4; count += 4)
|
|
||||||
edbg("Word %lu of the message is %lu\n", count, *((unsigned long *) (sep->shared_addr + count)));
|
sep_dump_message(sep);
|
||||||
/* update counter */
|
|
||||||
sep->send_ct++;
|
mutex_lock(&sep_mutex);
|
||||||
|
sep->send_ct++; /* update counter */
|
||||||
/* send the interrupt to SEP */
|
/* send the interrupt to SEP */
|
||||||
sep_write_reg(sep, HW_HOST_HOST_SEP_GPR2_REG_ADDR, sep->send_ct);
|
sep_write_reg(sep, HW_HOST_HOST_SEP_GPR2_REG_ADDR, sep->send_ct);
|
||||||
/* update both counters */
|
/* update both counters */
|
||||||
sep->send_ct++;
|
sep->send_ct++;
|
||||||
sep->reply_ct++;
|
sep->reply_ct++;
|
||||||
dbg("SEP Driver:<-------- sep_send_reply_command_handler end\n");
|
mutex_unlock(&sep_mutex);
|
||||||
|
dbg("sep: sep_send_reply_command_handler end\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue