public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] driver: irda support 3430
@ 2008-07-03  6:45 Girish. S. G.
  2008-07-03 10:37 ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Girish. S. G. @ 2008-07-03  6:45 UTC (permalink / raw)
  To: linux-omap

Irda driver changes to support on 3430

Signed-off-by: Girish S G <girishsg@ti.com>
---
 drivers/net/irda/omap-ir.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

Index: linux-omap-2.6_today/drivers/net/irda/omap-ir.c
===================================================================
--- linux-omap-2.6_today.orig/drivers/net/irda/omap-ir.c	2008-07-03
10:33:57.000000000 +0530
+++ linux-omap-2.6_today/drivers/net/irda/omap-ir.c	2008-07-03
10:35:30.000000000 +0530
@@ -217,7 +217,7 @@
 	struct net_device *dev = data;
 	struct omap_irda *omap_ir = netdev_priv(dev);

-	/*Stop DMA controller */
+	/* Stop DMA controller */
 	omap_stop_dma(omap_ir->tx_dma_channel);
 }

@@ -378,8 +378,12 @@

 		skb_reserve(skb, 1);

-		w = omap_get_dma_dst_pos(omap_ir->rx_dma_channel) -
-						omap_ir->rx_buf_dma_phys;
+		w = OMAP_DMA4_CDAC(omap_ir->rx_dma_channel);
+
+		if (cpu_is_omap16xx())
+			w -= OMAP1_DMA_CDSA_L(omap_ir->rx_dma_channel);
+		if (cpu_is_omap24xx() || cpu_is_omap34xx())
+			w -= OMAP_DMA4_CDSA(omap_ir->rx_dma_channel);

 		if (!IS_FIR(omap_ir))
 			/* Copy DMA buffer to skb */
@@ -604,6 +608,8 @@
 err_irlap:
 	omap_ir->open = 0;
 	omap_irda_shutdown(omap_ir);
+	if (omap_ir->pdata->select_irda)
+		omap_ir->pdata->select_irda(omap_ir->dev, ~IR_SEL);
 err_startup:
 	dma_free_coherent(NULL, IRDA_SIR_MAX_FRAME,
 			omap_ir->tx_buf_dma_virt, omap_ir->tx_buf_dma_phys);
@@ -636,6 +642,8 @@
 				omap_ir->tx_buf_dma_phys);

 	omap_irda_shutdown(omap_ir);
+	if (omap_ir->pdata->select_irda)
+		omap_ir->pdata->select_irda(omap_ir->dev, ~IR_SEL);

 	/* Stop IrLAP */
 	if (omap_ir->irlap) {


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] driver: irda support 3430
  2008-07-03  6:45 [PATCH 1/2] driver: irda support 3430 Girish. S. G.
@ 2008-07-03 10:37 ` Tony Lindgren
  2008-07-04 16:17   ` andrzej zaborowski
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Lindgren @ 2008-07-03 10:37 UTC (permalink / raw)
  To: Girish. S. G.; +Cc: linux-omap

Hi,

* Girish. S. G. <girishsg@ti.com> [080703 11:10]:
> Irda driver changes to support on 3430
> 
> Signed-off-by: Girish S G <girishsg@ti.com>
> ---
>  drivers/net/irda/omap-ir.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
> 
> Index: linux-omap-2.6_today/drivers/net/irda/omap-ir.c
> ===================================================================
> --- linux-omap-2.6_today.orig/drivers/net/irda/omap-ir.c	2008-07-03
> 10:33:57.000000000 +0530
> +++ linux-omap-2.6_today/drivers/net/irda/omap-ir.c	2008-07-03
> 10:35:30.000000000 +0530
> @@ -217,7 +217,7 @@
>  	struct net_device *dev = data;
>  	struct omap_irda *omap_ir = netdev_priv(dev);
> 
> -	/*Stop DMA controller */
> +	/* Stop DMA controller */
>  	omap_stop_dma(omap_ir->tx_dma_channel);
>  }
> 
> @@ -378,8 +378,12 @@
> 
>  		skb_reserve(skb, 1);
> 
> -		w = omap_get_dma_dst_pos(omap_ir->rx_dma_channel) -
> -						omap_ir->rx_buf_dma_phys;
> +		w = OMAP_DMA4_CDAC(omap_ir->rx_dma_channel);
> +
> +		if (cpu_is_omap16xx())
> +			w -= OMAP1_DMA_CDSA_L(omap_ir->rx_dma_channel);
> +		if (cpu_is_omap24xx() || cpu_is_omap34xx())
> +			w -= OMAP_DMA4_CDSA(omap_ir->rx_dma_channel);
> 
>  		if (!IS_FIR(omap_ir))
>  			/* Copy DMA buffer to skb */

Let's not tinker with the DMA registers again directly just as I
thought I got all that clean-up a bit! :)

Can you rather use the exported functions? If something is missing,
let's add it. But in the above case omap_set_dma_dest_params() and
omap_set_dma_src_params() should work I believe.

Regards,

Tony


> @@ -604,6 +608,8 @@
>  err_irlap:
>  	omap_ir->open = 0;
>  	omap_irda_shutdown(omap_ir);
> +	if (omap_ir->pdata->select_irda)
> +		omap_ir->pdata->select_irda(omap_ir->dev, ~IR_SEL);
>  err_startup:
>  	dma_free_coherent(NULL, IRDA_SIR_MAX_FRAME,
>  			omap_ir->tx_buf_dma_virt, omap_ir->tx_buf_dma_phys);
> @@ -636,6 +642,8 @@
>  				omap_ir->tx_buf_dma_phys);
> 
>  	omap_irda_shutdown(omap_ir);
> +	if (omap_ir->pdata->select_irda)
> +		omap_ir->pdata->select_irda(omap_ir->dev, ~IR_SEL);
> 
>  	/* Stop IrLAP */
>  	if (omap_ir->irlap) {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] driver: irda support 3430
  2008-07-03 10:37 ` Tony Lindgren
@ 2008-07-04 16:17   ` andrzej zaborowski
  0 siblings, 0 replies; 3+ messages in thread
From: andrzej zaborowski @ 2008-07-04 16:17 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Girish. S. G., linux-omap

2008/7/3 Tony Lindgren <tony@atomide.com>:
> Hi,
>
> * Girish. S. G. <girishsg@ti.com> [080703 11:10]:
>> Irda driver changes to support on 3430
>>
>> Signed-off-by: Girish S G <girishsg@ti.com>
>> ---
>>  drivers/net/irda/omap-ir.c |   14 +++++++++++---
>>  1 files changed, 11 insertions(+), 3 deletions(-)
>>
>> Index: linux-omap-2.6_today/drivers/net/irda/omap-ir.c
>> ===================================================================
>> --- linux-omap-2.6_today.orig/drivers/net/irda/omap-ir.c      2008-07-03
>> 10:33:57.000000000 +0530
>> +++ linux-omap-2.6_today/drivers/net/irda/omap-ir.c   2008-07-03
>> 10:35:30.000000000 +0530
>> @@ -217,7 +217,7 @@
>>       struct net_device *dev = data;
>>       struct omap_irda *omap_ir = netdev_priv(dev);
>>
>> -     /*Stop DMA controller */
>> +     /* Stop DMA controller */
>>       omap_stop_dma(omap_ir->tx_dma_channel);
>>  }
>>
>> @@ -378,8 +378,12 @@
>>
>>               skb_reserve(skb, 1);
>>
>> -             w = omap_get_dma_dst_pos(omap_ir->rx_dma_channel) -
>> -                                             omap_ir->rx_buf_dma_phys;
>> +             w = OMAP_DMA4_CDAC(omap_ir->rx_dma_channel);

Anything with DMA4 in the name won't work on OMAP1 and may return an
unspecified value I'm afraid.

>> +
>> +             if (cpu_is_omap16xx())
>> +                     w -= OMAP1_DMA_CDSA_L(omap_ir->rx_dma_channel);
>> +             if (cpu_is_omap24xx() || cpu_is_omap34xx())
>> +                     w -= OMAP_DMA4_CDSA(omap_ir->rx_dma_channel);
>>
>>               if (!IS_FIR(omap_ir))
>>                       /* Copy DMA buffer to skb */
>
> Let's not tinker with the DMA registers again directly just as I
> thought I got all that clean-up a bit! :)
>
> Can you rather use the exported functions? If something is missing,
> let's add it. But in the above case omap_set_dma_dest_params() and
> omap_set_dma_src_params() should work I believe.

Actually iirc omap_set_dma_dst_params() doesn't work on OMAP15xx,
because CDAC was added in DMA3.2 and OMAP15xx has DMA3.1. I had a
patch somewhere to use this IrDA driver on OMAP15xx and the main
change was this.

Regards

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-04 16:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-03  6:45 [PATCH 1/2] driver: irda support 3430 Girish. S. G.
2008-07-03 10:37 ` Tony Lindgren
2008-07-04 16:17   ` andrzej zaborowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox