Commit 640be08d authored by Komal Shah's avatar Komal Shah Committed by Tony Lindgren

[PATCH] ARM: OMAP: OMAP2: IrDA: cleanup

Remove debugging printks and few cosmetic changes.
Signed-off-by: default avatarKomal Shah <komal_shah802003@yahoo.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 2188a9c6
...@@ -129,70 +129,16 @@ struct omap_irda { ...@@ -129,70 +129,16 @@ struct omap_irda {
int rx_dma_channel; int rx_dma_channel;
int tx_dma_channel; int tx_dma_channel;
dma_addr_t rx_buf_dma_phys; /* Physical adress of RX DMA buffer */ dma_addr_t rx_buf_dma_phys; /* Physical address of RX DMA buffer */
dma_addr_t tx_buf_dma_phys; /* Physical adress of TX DMA buffer */ dma_addr_t tx_buf_dma_phys; /* Physical address of TX DMA buffer */
void *rx_buf_dma_virt; /* Virtual adress of RX DMA buffer */ void *rx_buf_dma_virt; /* Virtual address of RX DMA buffer */
void *tx_buf_dma_virt; /* Virtual adress of TX DMA buffer */ void *tx_buf_dma_virt; /* Virtual address of TX DMA buffer */
struct device *dev; struct device *dev;
struct omap_irda_config *pdata; struct omap_irda_config *pdata;
}; };
#define OMAP_IRDA_DEBUG 0
#if (OMAP_IRDA_DEBUG > 0)
#define DBG(format, args...) printk(KERN_ERR "%s(): " format, __FUNCTION__, ## args);
#define DBG_IRQ(format, args...) printk(KERN_ERR "%s(): " format, __FUNCTION__, ## args);
#else
#define DBG(format, args...)
#define DBG_IRQ(format, args...)
#endif
#if (OMAP_IRDA_DEBUG > 1)
#define __ECHO_IN printk(KERN_ERR "%s: enter\n",__FUNCTION__);
#define __ECHO_OUT printk(KERN_ERR "%s: exit\n",__FUNCTION__);
#else
#define __ECHO_IN
#define __ECHO_OUT
#endif
#ifdef OMAP1610_IR_HARDWARE_DEBUG_ENABLE
#define HDBG_DELAY 200
void hard_debug1(u16 i)
{
for (; i; i--) {
omap_writew(0x2000,
OMAP1610_GPIO1_BASE + OMAP1610_GPIO_CLEAR_DATAOUT);
udelay(HDBG_DELAY);
omap_writew(0x2000,
OMAP1610_GPIO1_BASE + OMAP1610_GPIO_SET_DATAOUT);
udelay(HDBG_DELAY);
}
}
void hard_debug2(u16 i)
{
for (; i; i--) {
omap_writew(0x8000,
OMAP1610_GPIO1_BASE + OMAP1610_GPIO_CLEAR_DATAOUT);
udelay(HDBG_DELAY);
omap_writew(0x8000,
OMAP1610_GPIO1_BASE + OMAP1610_GPIO_SET_DATAOUT);
udelay(HDBG_DELAY);
}
}
#define HDBG1(i) hard_debug1(i)
#define HDBG2(i) hard_debug2(i)
#else
#define HDBG1(i)
#define HDBG2(i)
#endif
static void inline uart_reg_out(int idx, u8 val) static void inline uart_reg_out(int idx, u8 val)
{ {
omap_writeb(val, idx); omap_writeb(val, idx);
...@@ -256,7 +202,6 @@ static void omap_start_tx_dma(struct omap_irda *si, int size) ...@@ -256,7 +202,6 @@ static void omap_start_tx_dma(struct omap_irda *si, int size)
trigger = OMAP24XX_DMA_UART3_TX; trigger = OMAP24XX_DMA_UART3_TX;
} }
__ECHO_IN;
/* Configure DMA */ /* Configure DMA */
omap_set_dma_dest_params(si->tx_dma_channel, 0x03, 0x0, omap_set_dma_dest_params(si->tx_dma_channel, 0x03, 0x0,
dest_start, 0, 0); dest_start, 0, 0);
...@@ -269,18 +214,12 @@ static void omap_start_tx_dma(struct omap_irda *si, int size) ...@@ -269,18 +214,12 @@ static void omap_start_tx_dma(struct omap_irda *si, int size)
omap_set_dma_transfer_params(si->tx_dma_channel, 0x0, size, 0x1, omap_set_dma_transfer_params(si->tx_dma_channel, 0x0, size, 0x1,
0x0, trigger, 0); 0x0, trigger, 0);
HDBG1(1);
/* Start DMA */ /* Start DMA */
omap_start_dma(si->tx_dma_channel); omap_start_dma(si->tx_dma_channel);
HDBG1(1);
__ECHO_OUT;
} }
/* DMA RX callback - normally, we should not go here, /* DMA RX callback - normally, we should not go here,
it calls only if something is going wrong * it calls only if something is going wrong
*/ */
static void omap_irda_rx_dma_callback(int lch, u16 ch_status, void *data) static void omap_irda_rx_dma_callback(int lch, u16 ch_status, void *data)
{ {
...@@ -298,34 +237,25 @@ static void omap_irda_rx_dma_callback(int lch, u16 ch_status, void *data) ...@@ -298,34 +237,25 @@ static void omap_irda_rx_dma_callback(int lch, u16 ch_status, void *data)
/* Re-init RX DMA */ /* Re-init RX DMA */
omap_irda_start_rx_dma(si); omap_irda_start_rx_dma(si);
} }
/* DMA TX callback - calling when frame transfer has been finished */ /* DMA TX callback - calling when frame transfer has been finished */
static void omap_irda_tx_dma_callback(int lch, u16 ch_status, void *data) static void omap_irda_tx_dma_callback(int lch, u16 ch_status, void *data)
{ {
struct net_device *dev = data; struct net_device *dev = data;
struct omap_irda *si = dev->priv; struct omap_irda *si = dev->priv;
__ECHO_IN;
/*Stop DMA controller */ /*Stop DMA controller */
omap_stop_dma(si->tx_dma_channel); omap_stop_dma(si->tx_dma_channel);
__ECHO_OUT;
} }
/* /*
* Set the IrDA communications speed. * Set the IrDA communications speed.
* Interrupt have to be disabled here. * Interrupt have to be disabled here.
*/ */
static int omap_irda_startup(struct net_device *dev) static int omap_irda_startup(struct net_device *dev)
{ {
struct omap_irda *si = dev->priv; struct omap_irda *si = dev->priv;
__ECHO_IN;
/* FIXME: use clk_* apis for UART3 clock*/ /* FIXME: use clk_* apis for UART3 clock*/
...@@ -395,10 +325,7 @@ static int omap_irda_startup(struct net_device *dev) ...@@ -395,10 +325,7 @@ static int omap_irda_startup(struct net_device *dev)
uart_reg_in(UART3_RESUME); uart_reg_in(UART3_RESUME);
__ECHO_OUT;
return 0; return 0;
} }
static int omap_irda_shutdown(struct omap_irda *si) static int omap_irda_shutdown(struct omap_irda *si)
...@@ -437,14 +364,11 @@ omap_irda_irq(int irq, void *dev_id, struct pt_regs *hw_regs) ...@@ -437,14 +364,11 @@ omap_irda_irq(int irq, void *dev_id, struct pt_regs *hw_regs)
u8 status; u8 status;
int w = 0; int w = 0;
__ECHO_IN;
/* Clear EOF interrupt */ /* Clear EOF interrupt */
status = uart_reg_in(UART3_IIR); status = uart_reg_in(UART3_IIR);
if (status & UART3_IIR_TX_STATUS) { if (status & UART3_IIR_TX_STATUS) {
u8 mdr2 = uart_reg_in(UART3_MDR2); u8 mdr2 = uart_reg_in(UART3_MDR2);
HDBG1(2);
if (mdr2 & UART3_MDR2_IRTX_UNDERRUN) if (mdr2 & UART3_MDR2_IRTX_UNDERRUN)
printk(KERN_ERR "IrDA Buffer underrun error\n"); printk(KERN_ERR "IrDA Buffer underrun error\n");
...@@ -511,8 +435,6 @@ omap_irda_irq(int irq, void *dev_id, struct pt_regs *hw_regs) ...@@ -511,8 +435,6 @@ omap_irda_irq(int irq, void *dev_id, struct pt_regs *hw_regs)
dev->last_rx = jiffies; dev->last_rx = jiffies;
__ECHO_OUT;
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -523,7 +445,6 @@ static int omap_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -523,7 +445,6 @@ static int omap_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
int mtt = irda_get_mtt(skb); int mtt = irda_get_mtt(skb);
int xbofs = irda_get_next_xbofs(skb); int xbofs = irda_get_next_xbofs(skb);
__ECHO_IN;
/* /*
* Does this packet contain a request to change the interface * Does this packet contain a request to change the interface
...@@ -575,8 +496,6 @@ static int omap_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -575,8 +496,6 @@ static int omap_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
dev->trans_start = jiffies; dev->trans_start = jiffies;
__ECHO_OUT;
return 0; return 0;
} }
...@@ -587,7 +506,6 @@ omap_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd) ...@@ -587,7 +506,6 @@ omap_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
struct omap_irda *si = dev->priv; struct omap_irda *si = dev->priv;
int ret = -EOPNOTSUPP; int ret = -EOPNOTSUPP;
__ECHO_IN;
switch (cmd) { switch (cmd) {
case SIOCSBANDWIDTH: case SIOCSBANDWIDTH:
...@@ -597,8 +515,8 @@ omap_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd) ...@@ -597,8 +515,8 @@ omap_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
* device is not running. * device is not running.
*/ */
if (si->open) { if (si->open) {
ret = ret = omap_irda_set_speed(dev,
omap_irda_set_speed(dev, rq->ifr_baudrate); rq->ifr_baudrate);
} else { } else {
printk(KERN_ERR "omap_irda_ioctl: SIOCSBANDWIDTH: !netif_running\n"); printk(KERN_ERR "omap_irda_ioctl: SIOCSBANDWIDTH: !netif_running\n");
ret = 0; ret = 0;
...@@ -622,8 +540,6 @@ omap_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd) ...@@ -622,8 +540,6 @@ omap_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
break; break;
} }
__ECHO_OUT;
return ret; return ret;
} }
...@@ -640,7 +556,6 @@ static int omap_irda_start(struct net_device *dev) ...@@ -640,7 +556,6 @@ static int omap_irda_start(struct net_device *dev)
int rx_channel = OMAP_DMA_NO_DEVICE; int rx_channel = OMAP_DMA_NO_DEVICE;
int tx_channel = OMAP_DMA_NO_DEVICE; int tx_channel = OMAP_DMA_NO_DEVICE;
__ECHO_IN;
si->speed = 9600; si->speed = 9600;
err = request_irq(dev->irq, omap_irda_irq, 0, dev->name, dev); err = request_irq(dev->irq, omap_irda_irq, 0, dev->name, dev);
...@@ -681,11 +596,13 @@ static int omap_irda_start(struct net_device *dev) ...@@ -681,11 +596,13 @@ static int omap_irda_start(struct net_device *dev)
/* Allocate TX and RX buffers for DMA channels */ /* Allocate TX and RX buffers for DMA channels */
si->rx_buf_dma_virt = si->rx_buf_dma_virt =
dma_alloc_coherent(NULL, IRDA_FRAME_SIZE_LIMIT, &(si->rx_buf_dma_phys), dma_alloc_coherent(NULL, IRDA_FRAME_SIZE_LIMIT,
&(si->rx_buf_dma_phys),
GFP_KERNEL); GFP_KERNEL);
si->tx_buf_dma_virt = si->tx_buf_dma_virt =
dma_alloc_coherent(NULL, IRDA_FRAME_SIZE_LIMIT, &(si->tx_buf_dma_phys), dma_alloc_coherent(NULL, IRDA_FRAME_SIZE_LIMIT,
&(si->tx_buf_dma_phys),
GFP_KERNEL); GFP_KERNEL);
/* /*
...@@ -719,8 +636,6 @@ static int omap_irda_start(struct net_device *dev) ...@@ -719,8 +636,6 @@ static int omap_irda_start(struct net_device *dev)
enable_irq(dev->irq); enable_irq(dev->irq);
netif_start_queue(dev); netif_start_queue(dev);
__ECHO_OUT;
return 0; return 0;
err_irlap: err_irlap:
...@@ -736,8 +651,6 @@ static int omap_irda_stop(struct net_device *dev) ...@@ -736,8 +651,6 @@ static int omap_irda_stop(struct net_device *dev)
{ {
struct omap_irda *si = dev->priv; struct omap_irda *si = dev->priv;
__ECHO_IN;
disable_irq(dev->irq); disable_irq(dev->irq);
netif_stop_queue(dev); netif_stop_queue(dev);
...@@ -767,8 +680,6 @@ static int omap_irda_stop(struct net_device *dev) ...@@ -767,8 +680,6 @@ static int omap_irda_stop(struct net_device *dev)
*/ */
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
__ECHO_OUT;
return 0; return 0;
} }
...@@ -778,8 +689,6 @@ static int omap_irda_set_speed(struct net_device *dev, int speed) ...@@ -778,8 +689,6 @@ static int omap_irda_set_speed(struct net_device *dev, int speed)
int divisor; int divisor;
unsigned long flags; unsigned long flags;
__ECHO_IN;
/* Set IrDA speed */ /* Set IrDA speed */
if (speed <= 115200) { if (speed <= 115200) {
...@@ -795,8 +704,6 @@ static int omap_irda_set_speed(struct net_device *dev, int speed) ...@@ -795,8 +704,6 @@ static int omap_irda_set_speed(struct net_device *dev, int speed)
divisor = 48000000 / (16 * speed); /* Base clock 48 MHz */ divisor = 48000000 / (16 * speed); /* Base clock 48 MHz */
HDBG2(1);
uart_reg_out(UART3_LCR, UART3_LCR_DIVEN); uart_reg_out(UART3_LCR, UART3_LCR_DIVEN);
uart_reg_out(UART3_DLL, (divisor & 0xff)); uart_reg_out(UART3_DLL, (divisor & 0xff));
uart_reg_out(UART3_DLH, (divisor >> 8)); uart_reg_out(UART3_DLH, (divisor >> 8));
...@@ -804,10 +711,7 @@ static int omap_irda_set_speed(struct net_device *dev, int speed) ...@@ -804,10 +711,7 @@ static int omap_irda_set_speed(struct net_device *dev, int speed)
uart_reg_out(UART3_MCR, 0); uart_reg_out(UART3_MCR, 0);
HDBG2(1);
local_irq_restore(flags); local_irq_restore(flags);
} else if (speed <= 1152000) { } else if (speed <= 1152000) {
local_irq_save(flags); local_irq_save(flags);
...@@ -829,7 +733,6 @@ static int omap_irda_set_speed(struct net_device *dev, int speed) ...@@ -829,7 +733,6 @@ static int omap_irda_set_speed(struct net_device *dev, int speed)
si->pdata->transceiver_mode(si->dev, IR_MIRMODE); si->pdata->transceiver_mode(si->dev, IR_MIRMODE);
local_irq_restore(flags); local_irq_restore(flags);
} else { } else {
local_irq_save(flags); local_irq_save(flags);
...@@ -845,10 +748,7 @@ static int omap_irda_set_speed(struct net_device *dev, int speed) ...@@ -845,10 +748,7 @@ static int omap_irda_set_speed(struct net_device *dev, int speed)
si->speed = speed; si->speed = speed;
__ECHO_OUT;
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
...@@ -1000,7 +900,7 @@ static struct platform_driver omapir_driver = { ...@@ -1000,7 +900,7 @@ static struct platform_driver omapir_driver = {
}, },
}; };
static char __initdata banner[] = "OMAP IrDA driver\n"; static char __initdata banner[] = KERN_INFO "OMAP IrDA driver\n";
static int __init omap_irda_init(void) static int __init omap_irda_init(void)
{ {
......
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