Skip to content

Commit

Permalink
net: pxaficp_ir: add irq resources
Browse files Browse the repository at this point in the history
In order to remove dependency on mach/irqs.h, add platform device
resources for irqs.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Samuel Ortiz <samuel@sortiz.org>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: netdev@vger.kernel.org
Acked-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rob Herring committed Sep 14, 2012
1 parent ef61440 commit 121f3f9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
15 changes: 15 additions & 0 deletions arch/arm/mach-pxa/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,24 @@ struct platform_device pxa_device_asoc_platform = {

static u64 pxaficp_dmamask = ~(u32)0;

static struct resource pxa_ir_resources[] = {
[0] = {
.start = IRQ_STUART,
.end = IRQ_STUART,
.flags = IORESOURCE_IRQ,
},
[1] = {
.start = IRQ_ICP,
.end = IRQ_ICP,
.flags = IORESOURCE_IRQ,
},
};

struct platform_device pxa_device_ficp = {
.name = "pxa2xx-ir",
.id = -1,
.num_resources = ARRAY_SIZE(pxa_ir_resources),
.resource = pxa_ir_resources,
.dev = {
.dma_mask = &pxaficp_dmamask,
.coherent_dma_mask = 0xffffffff,
Expand Down
28 changes: 17 additions & 11 deletions drivers/net/irda/pxaficp_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

#include <mach/dma.h>
#include <mach/irda.h>
#include <mach/regs-uart.h>
#include <mach/regs-ost.h>
#include <mach/regs-uart.h>

#define FICP __REG(0x40800000) /* Start of FICP area */
#define ICCR0 __REG(0x40800000) /* ICP Control Register 0 */
Expand Down Expand Up @@ -112,6 +112,9 @@ struct pxa_irda {
int txdma;
int rxdma;

int uart_irq;
int icp_irq;

struct irlap_cb *irlap;
struct qos_info qos;

Expand Down Expand Up @@ -672,19 +675,19 @@ static int pxa_irda_start(struct net_device *dev)

si->speed = 9600;

err = request_irq(IRQ_STUART, pxa_irda_sir_irq, 0, dev->name, dev);
err = request_irq(si->uart_irq, pxa_irda_sir_irq, 0, dev->name, dev);
if (err)
goto err_irq1;

err = request_irq(IRQ_ICP, pxa_irda_fir_irq, 0, dev->name, dev);
err = request_irq(si->icp_irq, pxa_irda_fir_irq, 0, dev->name, dev);
if (err)
goto err_irq2;

/*
* The interrupt must remain disabled for now.
*/
disable_irq(IRQ_STUART);
disable_irq(IRQ_ICP);
disable_irq(si->uart_irq);
disable_irq(si->icp_irq);

err = -EBUSY;
si->rxdma = pxa_request_dma("FICP_RX",DMA_PRIO_LOW, pxa_irda_fir_dma_rx_irq, dev);
Expand Down Expand Up @@ -720,8 +723,8 @@ static int pxa_irda_start(struct net_device *dev)
/*
* Now enable the interrupt and start the queue
*/
enable_irq(IRQ_STUART);
enable_irq(IRQ_ICP);
enable_irq(si->uart_irq);
enable_irq(si->icp_irq);
netif_start_queue(dev);

printk(KERN_DEBUG "pxa_ir: irda driver opened\n");
Expand All @@ -738,9 +741,9 @@ static int pxa_irda_start(struct net_device *dev)
err_tx_dma:
pxa_free_dma(si->rxdma);
err_rx_dma:
free_irq(IRQ_ICP, dev);
free_irq(si->icp_irq, dev);
err_irq2:
free_irq(IRQ_STUART, dev);
free_irq(si->uart_irq, dev);
err_irq1:

return err;
Expand All @@ -760,8 +763,8 @@ static int pxa_irda_stop(struct net_device *dev)
si->irlap = NULL;
}

free_irq(IRQ_STUART, dev);
free_irq(IRQ_ICP, dev);
free_irq(si->uart_irq, dev);
free_irq(si->icp_irq, dev);

pxa_free_dma(si->rxdma);
pxa_free_dma(si->txdma);
Expand Down Expand Up @@ -851,6 +854,9 @@ static int pxa_irda_probe(struct platform_device *pdev)
si->dev = &pdev->dev;
si->pdata = pdev->dev.platform_data;

si->uart_irq = platform_get_irq(pdev, 0);
si->icp_irq = platform_get_irq(pdev, 1);

si->sir_clk = clk_get(&pdev->dev, "UARTCLK");
si->fir_clk = clk_get(&pdev->dev, "FICPCLK");
if (IS_ERR(si->sir_clk) || IS_ERR(si->fir_clk)) {
Expand Down

0 comments on commit 121f3f9

Please sign in to comment.