Commit 4683fa27 authored by Komal Shah's avatar Komal Shah Committed by Kevin Hilman

ARM: DaVinci: McBSP: Cleanup code

- Use kernel coding style and cosmetic changes.
Signed-off-by: default avatarKomal Shah <komal_shah802003@yahoo.com>
parent e7c8fcc7
...@@ -110,7 +110,7 @@ void DAVINCI_MCBSP_WRITE(int base, int reg, unsigned short val) ...@@ -110,7 +110,7 @@ void DAVINCI_MCBSP_WRITE(int base, int reg, unsigned short val)
outl(data, p); outl(data, p);
} }
} }
#if 0
static void davinci_mcbsp_dump_reg(u8 id) static void davinci_mcbsp_dump_reg(u8 id)
{ {
DBG("**** MCBSP%d regs ****\n", mcbsp[id].id); DBG("**** MCBSP%d regs ****\n", mcbsp[id].id);
...@@ -125,9 +125,7 @@ static void davinci_mcbsp_dump_reg(u8 id) ...@@ -125,9 +125,7 @@ static void davinci_mcbsp_dump_reg(u8 id)
DBG("SRGR1: 0x%04x\n", DAVINCI_MCBSP_READ(mcbsp[id].io_base, SRGR1)); DBG("SRGR1: 0x%04x\n", DAVINCI_MCBSP_READ(mcbsp[id].io_base, SRGR1));
DBG("PCR0: 0x%04x\n", DAVINCI_MCBSP_READ(mcbsp[id].io_base, PCR0)); DBG("PCR0: 0x%04x\n", DAVINCI_MCBSP_READ(mcbsp[id].io_base, PCR0));
DBG("***********************\n"); DBG("***********************\n");
} }
#endif
static void davinci_mcbsp_tx_dma_callback(int lch, u16 ch_status, void *data) static void davinci_mcbsp_tx_dma_callback(int lch, u16 ch_status, void *data)
{ {
...@@ -187,8 +185,6 @@ void davinci_mcbsp_config(unsigned int id, ...@@ -187,8 +185,6 @@ void davinci_mcbsp_config(unsigned int id,
/* We write the given config */ /* We write the given config */
DAVINCI_MCBSP_WRITE(io_base, SPCR2, config->spcr2); DAVINCI_MCBSP_WRITE(io_base, SPCR2, config->spcr2);
DAVINCI_MCBSP_WRITE(io_base, SPCR1, config->spcr1); DAVINCI_MCBSP_WRITE(io_base, SPCR1, config->spcr1);
return;
} }
static int davinci_mcbsp_check(unsigned int id) static int davinci_mcbsp_check(unsigned int id)
...@@ -216,7 +212,6 @@ int davinci_mcbsp_request(unsigned int id) ...@@ -216,7 +212,6 @@ int davinci_mcbsp_request(unsigned int id)
spin_unlock(&mcbsp[id].lock); spin_unlock(&mcbsp[id].lock);
return 0; return 0;
} }
void davinci_mcbsp_free(unsigned int id) void davinci_mcbsp_free(unsigned int id)
...@@ -274,7 +269,8 @@ void davinci_mcbsp_start(unsigned int id) ...@@ -274,7 +269,8 @@ void davinci_mcbsp_start(unsigned int id)
w = DAVINCI_MCBSP_READ(io_base, SPCR2); w = DAVINCI_MCBSP_READ(io_base, SPCR2);
DAVINCI_MCBSP_WRITE(io_base, SPCR2, w | (1 << 7)); DAVINCI_MCBSP_WRITE(io_base, SPCR2, w | (1 << 7));
return; /* Dump mcbsp reg */
davinci_mcbsp_dump_reg(id);
} }
void davinci_mcbsp_stop(unsigned int id) void davinci_mcbsp_stop(unsigned int id)
...@@ -302,8 +298,6 @@ void davinci_mcbsp_stop(unsigned int id) ...@@ -302,8 +298,6 @@ void davinci_mcbsp_stop(unsigned int id)
/* Reset the frame sync generator */ /* Reset the frame sync generator */
w = DAVINCI_MCBSP_READ(io_base, SPCR2); w = DAVINCI_MCBSP_READ(io_base, SPCR2);
DAVINCI_MCBSP_WRITE(io_base, SPCR2, w & ~(1 << 7)); DAVINCI_MCBSP_WRITE(io_base, SPCR2, w & ~(1 << 7));
return;
} }
/* /*
...@@ -320,14 +314,9 @@ void davinci_mcbsp_xmit_word(unsigned int id, u32 word) ...@@ -320,14 +314,9 @@ void davinci_mcbsp_xmit_word(unsigned int id, u32 word)
io_base = mcbsp[id].io_base; io_base = mcbsp[id].io_base;
DBG(" io_base = 0x%x\n", io_base); if (word_length > DAVINCI_MCBSP_WORD_16)
if (word_length > DAVINCI_MCBSP_WORD_16) {
DBG(" writing DXR2 register \n");
DAVINCI_MCBSP_WRITE(io_base, DXR2, word >> 16); DAVINCI_MCBSP_WRITE(io_base, DXR2, word >> 16);
}
DBG(" writing DXR1 register \n");
DAVINCI_MCBSP_WRITE(io_base, DXR1, word & 0xffff); DAVINCI_MCBSP_WRITE(io_base, DXR1, word & 0xffff);
} }
u32 davinci_mcbsp_recv_word(unsigned int id) u32 davinci_mcbsp_recv_word(unsigned int id)
...@@ -348,7 +337,6 @@ u32 davinci_mcbsp_recv_word(unsigned int id) ...@@ -348,7 +337,6 @@ u32 davinci_mcbsp_recv_word(unsigned int id)
word_lsb = DAVINCI_MCBSP_READ(io_base, DRR1); word_lsb = DAVINCI_MCBSP_READ(io_base, DRR1);
return (word_lsb | (word_msb << 16)); return (word_lsb | (word_msb << 16));
} }
/* /*
...@@ -370,8 +358,8 @@ int davinci_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, ...@@ -370,8 +358,8 @@ int davinci_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer,
if (davinci_request_dma if (davinci_request_dma
(mcbsp[id].dma_tx_sync, "McBSP TX", davinci_mcbsp_tx_dma_callback, (mcbsp[id].dma_tx_sync, "McBSP TX", davinci_mcbsp_tx_dma_callback,
&mcbsp[id], &dma_tx_ch, &tcc, EVENTQ_0)) { &mcbsp[id], &dma_tx_ch, &tcc, EVENTQ_0)) {
DBG("DAVINCI-McBSP: Unable to request DMA channel for McBSP%d TX. Trying IRQ based TX\n", DBG("DAVINCI-McBSP: Unable to request DMA channel for McBSP%d TX."
id + 1); "Trying IRQ based TX\n", id + 1);
return -EAGAIN; return -EAGAIN;
} }
...@@ -408,8 +396,8 @@ int davinci_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, ...@@ -408,8 +396,8 @@ int davinci_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer,
if (davinci_request_dma if (davinci_request_dma
(mcbsp[id].dma_rx_sync, "McBSP RX", davinci_mcbsp_rx_dma_callback, (mcbsp[id].dma_rx_sync, "McBSP RX", davinci_mcbsp_rx_dma_callback,
&mcbsp[id], &dma_rx_ch, &tcc, EVENTQ_0)) { &mcbsp[id], &dma_rx_ch, &tcc, EVENTQ_0)) {
DBG("Unable to request DMA channel for McBSP%d RX. Trying IRQ based RX\n", DBG("Unable to request DMA channel for McBSP%d RX."
id + 1); "Trying IRQ based RX\n", id + 1);
return -EAGAIN; return -EAGAIN;
} }
mcbsp[id].dma_rx_lch = dma_rx_ch; mcbsp[id].dma_rx_lch = dma_rx_ch;
...@@ -433,7 +421,6 @@ int davinci_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, ...@@ -433,7 +421,6 @@ int davinci_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer,
davinci_start_dma(mcbsp[id].dma_rx_lch); davinci_start_dma(mcbsp[id].dma_rx_lch);
wait_for_completion(&(mcbsp[id].rx_dma_completion)); wait_for_completion(&(mcbsp[id].rx_dma_completion));
DBG(" davinci_mcbsp_recv_buffer: after wait_for_completion\n");
return 0; return 0;
} }
...@@ -449,7 +436,7 @@ struct davinci_mcbsp_info { ...@@ -449,7 +436,7 @@ struct davinci_mcbsp_info {
}; };
static const struct davinci_mcbsp_info mcbsp_davinci[] = { static const struct davinci_mcbsp_info mcbsp_davinci[] = {
[0] = {.virt_base = IO_ADDRESS(DAVINCI_MCBSP1_BASE), [0] = { .virt_base = IO_ADDRESS(DAVINCI_MCBSP1_BASE),
.dma_rx_sync = DAVINCI_DMA_MCBSP1_RX, .dma_rx_sync = DAVINCI_DMA_MCBSP1_RX,
.dma_tx_sync = DAVINCI_DMA_MCBSP1_TX, .dma_tx_sync = DAVINCI_DMA_MCBSP1_TX,
.rx_irq = DAVINCI_McBSP1RX, .rx_irq = DAVINCI_McBSP1RX,
...@@ -462,14 +449,16 @@ static int __init davinci_mcbsp_init(void) ...@@ -462,14 +449,16 @@ static int __init davinci_mcbsp_init(void)
static const struct davinci_mcbsp_info *mcbsp_info; static const struct davinci_mcbsp_info *mcbsp_info;
struct clk *clkp; struct clk *clkp;
printk(KERN_INFO "Initializing DaVinci McBSP system\n");
clkp = clk_get (NULL, "McBSPCLK"); clkp = clk_get (NULL, "McBSPCLK");
if (IS_ERR(clkp)) { if (IS_ERR(clkp)) {
return -1; printk(KERN_ERR "mcbsp: could not acquire McBSP clk\n");
return PTR_ERR(clkp);
} }
else else {
{
mbspclk = clkp; mbspclk = clkp;
clk_enable (mbspclk); clk_enable(mbspclk);
mcbsp_info = mcbsp_davinci; mcbsp_info = mcbsp_davinci;
mcbsp_count = ARRAY_SIZE(mcbsp_davinci); mcbsp_count = ARRAY_SIZE(mcbsp_davinci);
...@@ -500,7 +489,7 @@ static void __exit davinci_mcbsp_exit(void) ...@@ -500,7 +489,7 @@ static void __exit davinci_mcbsp_exit(void)
{ {
int i; int i;
for( i = 0; i < DAVINCI_MAX_MCBSP_COUNT; i++) { for (i = 0; i < DAVINCI_MAX_MCBSP_COUNT; i++) {
mcbsp[i].free = 0; mcbsp[i].free = 0;
mcbsp[i].dma_tx_lch = -1; mcbsp[i].dma_tx_lch = -1;
mcbsp[i].dma_rx_lch = -1; mcbsp[i].dma_rx_lch = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment