* [PATCH 1/8] dmaengine: sa11x0: add DMA filters
2016-08-29 11:25 ` [PATCH 0/8] SA11x0 DMA engine/IrDA updates Russell King - ARM Linux
@ 2016-08-29 11:26 ` Russell King
2016-08-30 15:57 ` Vinod Koul
2016-08-29 11:26 ` [PATCH 2/8] net: irda/sa1100_ir: convert to dma_request_slave_channel() Russell King
` (6 subsequent siblings)
7 siblings, 1 reply; 11+ messages in thread
From: Russell King @ 2016-08-29 11:26 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, netdev
Cc: Dan Williams, Samuel Ortiz, Vinod Koul
Add DMA filters for the sa11x0 DMA channels. This will allow us to
migrate away from directly using the DMA filter function in drivers.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/dma/sa11x0-dma.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/dma/sa11x0-dma.c b/drivers/dma/sa11x0-dma.c
index 43db255050d2..565bc67fac7e 100644
--- a/drivers/dma/sa11x0-dma.c
+++ b/drivers/dma/sa11x0-dma.c
@@ -823,6 +823,13 @@ static const struct sa11x0_dma_channel_desc chan_desc[] = {
CD(Ser4SSPRc, DDAR_RW),
};
+static const struct dma_slave_map sa11x0_dma_map[] = {
+ { "sa11x0-ir", "tx", "Ser2ICPTr" },
+ { "sa11x0-ir", "rx", "Ser2ICPRc" },
+ { "sa11x0-ssp", "tx", "Ser4SSPTr" },
+ { "sa11x0-ssp", "rx", "Ser4SSPRc" },
+};
+
static int sa11x0_dma_init_dmadev(struct dma_device *dmadev,
struct device *dev)
{
@@ -909,6 +916,10 @@ static int sa11x0_dma_probe(struct platform_device *pdev)
spin_lock_init(&d->lock);
INIT_LIST_HEAD(&d->chan_pending);
+ d->slave.filter.fn = sa11x0_dma_filter_fn;
+ d->slave.filter.mapcnt = ARRAY_SIZE(sa11x0_dma_map);
+ d->slave.filter.map = sa11x0_dma_map;
+
d->base = ioremap(res->start, resource_size(res));
if (!d->base) {
ret = -ENOMEM;
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/8] net: irda/sa1100_ir: convert to dma_request_slave_channel()
2016-08-29 11:25 ` [PATCH 0/8] SA11x0 DMA engine/IrDA updates Russell King - ARM Linux
2016-08-29 11:26 ` [PATCH 1/8] dmaengine: sa11x0: add DMA filters Russell King
@ 2016-08-29 11:26 ` Russell King
2016-08-29 11:26 ` [PATCH 3/8] net: irda/sa1100_ir: add gpiod APIs for controlling IrDA transceiver Russell King
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Russell King @ 2016-08-29 11:26 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, netdev
Cc: Dan Williams, Samuel Ortiz, Vinod Koul
Convert the sa11x0 irda driver to use the more modern
dma_request_slave_channel() method to get the DMA channel, rather than
using dma_request_channel() with a filter function exported by DMA
driver. This allows us to get rid of the sa11x0-dma.h include.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/irda/sa1100_ir.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index b6e44ff4e373..7bc9c2955d4b 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -31,7 +31,6 @@
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
-#include <linux/sa11x0-dma.h>
#include <net/irda/irda.h>
#include <net/irda/wrapper.h>
@@ -124,7 +123,7 @@ static int sa1100_irda_dma_request(struct device *dev, struct sa1100_buf *buf,
dma_cap_zero(m);
dma_cap_set(DMA_SLAVE, m);
- buf->chan = dma_request_channel(m, sa11x0_dma_filter_fn, (void *)name);
+ buf->chan = dma_request_slave_channel(dev, name);
if (!buf->chan) {
dev_err(dev, "unable to request DMA channel for %s\n",
name);
@@ -797,12 +796,12 @@ static int sa1100_irda_start(struct net_device *dev)
si->speed = 9600;
- err = sa1100_irda_dma_request(si->dev, &si->dma_rx, "Ser2ICPRc",
+ err = sa1100_irda_dma_request(si->dev, &si->dma_rx, "rx",
&sa1100_irda_fir_rx);
if (err)
goto err_rx_dma;
- err = sa1100_irda_dma_request(si->dev, &si->dma_tx, "Ser2ICPTr",
+ err = sa1100_irda_dma_request(si->dev, &si->dma_tx, "tx",
&sa1100_irda_sir_tx);
if (err)
goto err_tx_dma;
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/8] net: irda/sa1100_ir: add gpiod APIs for controlling IrDA transceiver
2016-08-29 11:25 ` [PATCH 0/8] SA11x0 DMA engine/IrDA updates Russell King - ARM Linux
2016-08-29 11:26 ` [PATCH 1/8] dmaengine: sa11x0: add DMA filters Russell King
2016-08-29 11:26 ` [PATCH 2/8] net: irda/sa1100_ir: convert to dma_request_slave_channel() Russell King
@ 2016-08-29 11:26 ` Russell King
2016-08-29 11:26 ` [PATCH 4/8] dmaengine: sa11x0: unexport sa11x0_dma_filter_fn and clean up Russell King
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Russell King @ 2016-08-29 11:26 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, netdev
Cc: Dan Williams, Samuel Ortiz, Vinod Koul
Add GPIO support using the gpiod APIs for controlling the IrDA
transceiver modes (FIR vs SIR), power and range.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/irda/sa1100_ir.c | 58 ++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 56 insertions(+), 2 deletions(-)
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index 7bc9c2955d4b..25c63c9ff33c 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -23,6 +23,7 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/errno.h>
+#include <linux/gpio/consumer.h>
#include <linux/netdevice.h>
#include <linux/slab.h>
#include <linux/rtnetlink.h>
@@ -72,6 +73,10 @@ struct sa1100_irda {
int (*tx_start)(struct sk_buff *, struct net_device *, struct sa1100_irda *);
irqreturn_t (*irq)(struct net_device *, struct sa1100_irda *);
+
+ struct gpio_desc *fsel_gpio;
+ struct gpio_desc *pwr_gpio;
+ struct gpio_desc *md_gpio[2];
};
static int sa1100_irda_set_speed(struct sa1100_irda *, int);
@@ -574,6 +579,8 @@ static int sa1100_irda_set_speed(struct sa1100_irda *si, int speed)
if (si->pdata->set_speed)
si->pdata->set_speed(si->dev, speed);
+ if (si->fsel_gpio)
+ gpiod_set_value(si->fsel_gpio, 0);
si->speed = speed;
si->tx_start = sa1100_irda_sir_tx_start;
@@ -600,6 +607,8 @@ static int sa1100_irda_set_speed(struct sa1100_irda *si, int speed)
if (si->pdata->set_speed)
si->pdata->set_speed(si->dev, speed);
+ if (si->fsel_gpio)
+ gpiod_set_value(si->fsel_gpio, 1);
sa1100_irda_rx_alloc(si);
sa1100_irda_rx_dma_start(si);
@@ -629,9 +638,19 @@ static int
__sa1100_irda_set_power(struct sa1100_irda *si, unsigned int state)
{
int ret = 0;
- if (si->pdata->set_power)
+ if (si->pdata->set_power) {
ret = si->pdata->set_power(si->dev, state);
- return ret;
+ } else if (si->pwr_gpio) {
+ gpiod_set_value_cansleep(si->pwr_gpio, state);
+ } else if (si->md_gpio[0] && si->md_gpio[1]) {
+ int vals[2];
+
+ vals[0] = state < 2;
+ vals[1] = state == 1 || state == 2;
+
+ gpiod_set_array_value_cansleep(2, si->md_gpio, vals);
+ }
+ return 0;
}
static inline int
@@ -914,6 +933,21 @@ static const struct net_device_ops sa1100_irda_netdev_ops = {
.ndo_do_ioctl = sa1100_irda_ioctl,
};
+static int sa1100_irda_get_gpio(struct device *dev, struct gpio_desc **descp,
+ const char *name, enum gpiod_flags flags)
+{
+ struct gpio_desc *desc = devm_gpiod_get_optional(dev, name, flags);
+
+ if (IS_ERR(desc)) {
+ int err = PTR_ERR(desc);
+ dev_err(dev, "unable to get %s gpio: %d\n", name, err);
+ return err;
+ }
+
+ *descp = desc;
+ return 0;
+}
+
static int sa1100_irda_probe(struct platform_device *pdev)
{
struct net_device *dev;
@@ -950,6 +984,26 @@ static int sa1100_irda_probe(struct platform_device *pdev)
si->dev = &pdev->dev;
si->pdata = pdev->dev.platform_data;
+ err = sa1100_irda_get_gpio(&pdev->dev, &si->fsel_gpio, "ir-fsel",
+ GPIOD_OUT_LOW);
+ if (err)
+ goto err_mem_5;
+
+ err = sa1100_irda_get_gpio(&pdev->dev, &si->pwr_gpio, "ir-power",
+ GPIOD_OUT_LOW);
+ if (err)
+ goto err_mem_5;
+
+ err = sa1100_irda_get_gpio(&pdev->dev, &si->md_gpio[0], "ir-md0",
+ GPIOD_OUT_HIGH);
+ if (err)
+ goto err_mem_5;
+
+ err = sa1100_irda_get_gpio(&pdev->dev, &si->md_gpio[1], "ir-md1",
+ GPIOD_OUT_LOW);
+ if (err)
+ goto err_mem_5;
+
sg_init_table(&si->dma_rx.sg, 1);
sg_init_table(&si->dma_tx.sg, 1);
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/8] dmaengine: sa11x0: unexport sa11x0_dma_filter_fn and clean up
2016-08-29 11:25 ` [PATCH 0/8] SA11x0 DMA engine/IrDA updates Russell King - ARM Linux
` (2 preceding siblings ...)
2016-08-29 11:26 ` [PATCH 3/8] net: irda/sa1100_ir: add gpiod APIs for controlling IrDA transceiver Russell King
@ 2016-08-29 11:26 ` Russell King
2016-08-30 15:58 ` Vinod Koul
2016-08-29 11:26 ` [PATCH 5/8] ARM: sa1100/assabet: switch assabet IrDA to use gpiod APIs Russell King
` (3 subsequent siblings)
7 siblings, 1 reply; 11+ messages in thread
From: Russell King @ 2016-08-29 11:26 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, netdev
Cc: Dan Williams, Samuel Ortiz, Vinod Koul
As we now have no users of sa11x0_dma_filter_fn() in the tree, we can
unexport this function, and remove the now unused header file.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/dma/sa11x0-dma.c | 21 ++++++++-------------
include/linux/sa11x0-dma.h | 24 ------------------------
2 files changed, 8 insertions(+), 37 deletions(-)
delete mode 100644 include/linux/sa11x0-dma.h
diff --git a/drivers/dma/sa11x0-dma.c b/drivers/dma/sa11x0-dma.c
index 565bc67fac7e..6d942b8c4097 100644
--- a/drivers/dma/sa11x0-dma.c
+++ b/drivers/dma/sa11x0-dma.c
@@ -17,7 +17,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
-#include <linux/sa11x0-dma.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -830,6 +829,14 @@ static const struct dma_slave_map sa11x0_dma_map[] = {
{ "sa11x0-ssp", "rx", "Ser4SSPRc" },
};
+static bool sa11x0_dma_filter_fn(struct dma_chan *chan, void *param)
+{
+ struct sa11x0_dma_chan *c = to_sa11x0_dma_chan(chan);
+ const char *p = param;
+
+ return !strcmp(c->name, p);
+}
+
static int sa11x0_dma_init_dmadev(struct dma_device *dmadev,
struct device *dev)
{
@@ -1087,18 +1094,6 @@ static struct platform_driver sa11x0_dma_driver = {
.remove = sa11x0_dma_remove,
};
-bool sa11x0_dma_filter_fn(struct dma_chan *chan, void *param)
-{
- if (chan->device->dev->driver == &sa11x0_dma_driver.driver) {
- struct sa11x0_dma_chan *c = to_sa11x0_dma_chan(chan);
- const char *p = param;
-
- return !strcmp(c->name, p);
- }
- return false;
-}
-EXPORT_SYMBOL(sa11x0_dma_filter_fn);
-
static int __init sa11x0_dma_init(void)
{
return platform_driver_register(&sa11x0_dma_driver);
diff --git a/include/linux/sa11x0-dma.h b/include/linux/sa11x0-dma.h
deleted file mode 100644
index 65839a58b8e5..000000000000
--- a/include/linux/sa11x0-dma.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SA11x0 DMA Engine support
- *
- * Copyright (C) 2012 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __LINUX_SA11X0_DMA_H
-#define __LINUX_SA11X0_DMA_H
-
-struct dma_chan;
-
-#if defined(CONFIG_DMA_SA11X0) || defined(CONFIG_DMA_SA11X0_MODULE)
-bool sa11x0_dma_filter_fn(struct dma_chan *, void *);
-#else
-static inline bool sa11x0_dma_filter_fn(struct dma_chan *c, void *d)
-{
- return false;
-}
-#endif
-
-#endif
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 4/8] dmaengine: sa11x0: unexport sa11x0_dma_filter_fn and clean up
2016-08-29 11:26 ` [PATCH 4/8] dmaengine: sa11x0: unexport sa11x0_dma_filter_fn and clean up Russell King
@ 2016-08-30 15:58 ` Vinod Koul
0 siblings, 0 replies; 11+ messages in thread
From: Vinod Koul @ 2016-08-30 15:58 UTC (permalink / raw)
To: Russell King
Cc: dmaengine, linux-arm-kernel, netdev, Dan Williams, Samuel Ortiz
On Mon, Aug 29, 2016 at 12:26:20PM +0100, Russell King wrote:
> As we now have no users of sa11x0_dma_filter_fn() in the tree, we can
> unexport this function, and remove the now unused header file.
Acked-by: Vinod Koul <vinod.koul@intel.com>
--
~Vinod
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 5/8] ARM: sa1100/assabet: switch assabet IrDA to use gpiod APIs
2016-08-29 11:25 ` [PATCH 0/8] SA11x0 DMA engine/IrDA updates Russell King - ARM Linux
` (3 preceding siblings ...)
2016-08-29 11:26 ` [PATCH 4/8] dmaengine: sa11x0: unexport sa11x0_dma_filter_fn and clean up Russell King
@ 2016-08-29 11:26 ` Russell King
2016-08-29 11:26 ` [PATCH 6/8] ARM: sa1100/collie: switch collie " Russell King
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Russell King @ 2016-08-29 11:26 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, netdev
Cc: Dan Williams, Samuel Ortiz, Vinod Koul
Switch the IrDA code to use the gpiod APIs rather than platform data
with function callbacks.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
arch/arm/mach-sa1100/assabet.c | 42 +++++++++++++-----------------------------
1 file changed, 13 insertions(+), 29 deletions(-)
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index af5cea464a10..ba180eebd6ab 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -303,36 +303,18 @@ static struct resource assabet_flash_resources[] = {
};
-/*
- * Assabet IrDA support code.
- */
-
-static int assabet_irda_set_power(struct device *dev, unsigned int state)
-{
- static unsigned int bcr_state[4] = {
- ASSABET_BCR_IRDA_MD0,
- ASSABET_BCR_IRDA_MD1|ASSABET_BCR_IRDA_MD0,
- ASSABET_BCR_IRDA_MD1,
- 0
- };
-
- if (state < 4)
- ASSABET_BCR_frob(ASSABET_BCR_IRDA_MD1 | ASSABET_BCR_IRDA_MD0,
- bcr_state[state]);
- return 0;
-}
-
-static void assabet_irda_set_speed(struct device *dev, unsigned int speed)
-{
- if (speed < 4000000)
- ASSABET_BCR_clear(ASSABET_BCR_IRDA_FSEL);
- else
- ASSABET_BCR_set(ASSABET_BCR_IRDA_FSEL);
-}
-
static struct irda_platform_data assabet_irda_data = {
- .set_power = assabet_irda_set_power,
- .set_speed = assabet_irda_set_speed,
+};
+
+/* IrDA GPIO mappings */
+static struct gpiod_lookup_table assabet_irda_gpio_table = {
+ .dev_id = "sa11x0-ir",
+ .table = {
+ GPIO_LOOKUP("assabet", 3, "ir-fsel", GPIO_ACTIVE_HIGH),
+ GPIO_LOOKUP("assabet", 4, "ir-md0", GPIO_ACTIVE_HIGH),
+ GPIO_LOOKUP("assabet", 5, "ir-md1", GPIO_ACTIVE_HIGH),
+ { },
+ },
};
static struct ucb1x00_plat_data assabet_ucb1x00_data = {
@@ -539,6 +521,8 @@ static const struct gpio_keys_platform_data assabet_keys_pdata = {
static void __init assabet_init(void)
{
+ gpiod_add_lookup_table(&assabet_irda_gpio_table);
+
/*
* Ensure that the power supply is in "high power" mode.
*/
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/8] ARM: sa1100/collie: switch collie IrDA to use gpiod APIs
2016-08-29 11:25 ` [PATCH 0/8] SA11x0 DMA engine/IrDA updates Russell King - ARM Linux
` (4 preceding siblings ...)
2016-08-29 11:26 ` [PATCH 5/8] ARM: sa1100/assabet: switch assabet IrDA to use gpiod APIs Russell King
@ 2016-08-29 11:26 ` Russell King
2016-08-29 11:26 ` [PATCH 7/8] ARM: sa1100/h3xxx: switch h3xxx " Russell King
2016-08-29 11:26 ` [PATCH 8/8] net: irda/sa1100_ir: remove sa11x0 irda platform data Russell King
7 siblings, 0 replies; 11+ messages in thread
From: Russell King @ 2016-08-29 11:26 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, netdev
Cc: Dan Williams, Samuel Ortiz, Vinod Koul
Switch the IrDA code to use the gpiod APIs rather than platform data
with function callbacks.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
arch/arm/mach-sa1100/collie.c | 40 ++++++++++++----------------------------
1 file changed, 12 insertions(+), 28 deletions(-)
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 3cc2b71e16f0..8ed0cbfaa0f4 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -21,6 +21,7 @@
#include <linux/kernel.h>
#include <linux/tty.h>
#include <linux/delay.h>
+#include <linux/gpio/machine.h>
#include <linux/platform_data/sa11x0-serial.h>
#include <linux/platform_device.h>
#include <linux/mfd/ucb1x00.h>
@@ -97,35 +98,16 @@ static struct mcp_plat_data collie_mcp_data = {
.codec_pdata = &collie_ucb1x00_data,
};
-static int collie_ir_startup(struct device *dev)
-{
- int rc = gpio_request(COLLIE_GPIO_IR_ON, "IrDA");
- if (rc)
- return rc;
- rc = gpio_direction_output(COLLIE_GPIO_IR_ON, 1);
-
- if (!rc)
- return 0;
-
- gpio_free(COLLIE_GPIO_IR_ON);
- return rc;
-}
-
-static void collie_ir_shutdown(struct device *dev)
-{
- gpio_free(COLLIE_GPIO_IR_ON);
-}
-
-static int collie_ir_set_power(struct device *dev, unsigned int state)
-{
- gpio_set_value(COLLIE_GPIO_IR_ON, !state);
- return 0;
-}
-
static struct irda_platform_data collie_ir_data = {
- .startup = collie_ir_startup,
- .shutdown = collie_ir_shutdown,
- .set_power = collie_ir_set_power,
+};
+
+/* IrDA GPIO mappings */
+static struct gpiod_lookup_table collie_irda_gpio_table = {
+ .dev_id = "sa11x0-ir",
+ .table = {
+ GPIO_LOOKUP("ucb1x00", 3, "ir-power", GPIO_ACTIVE_LOW),
+ { },
+ },
};
/*
@@ -357,6 +339,8 @@ static void __init collie_init(void)
{
int ret = 0;
+ gpiod_add_lookup_table(&collie_irda_gpio_table);
+
/* cpu initialize */
GAFR = GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SSP_CLK |
GPIO_MCP_CLK | GPIO_32_768kHz;
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 7/8] ARM: sa1100/h3xxx: switch h3xxx IrDA to use gpiod APIs
2016-08-29 11:25 ` [PATCH 0/8] SA11x0 DMA engine/IrDA updates Russell King - ARM Linux
` (5 preceding siblings ...)
2016-08-29 11:26 ` [PATCH 6/8] ARM: sa1100/collie: switch collie " Russell King
@ 2016-08-29 11:26 ` Russell King
2016-08-29 11:26 ` [PATCH 8/8] net: irda/sa1100_ir: remove sa11x0 irda platform data Russell King
7 siblings, 0 replies; 11+ messages in thread
From: Russell King @ 2016-08-29 11:26 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, netdev
Cc: Dan Williams, Samuel Ortiz, Vinod Koul
Switch the IrDA code to use the gpiod APIs rather than platform data
with function callbacks.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
arch/arm/mach-sa1100/h3100.c | 44 ++++++++++++--------------------------------
arch/arm/mach-sa1100/h3600.c | 44 ++++++++++++--------------------------------
2 files changed, 24 insertions(+), 64 deletions(-)
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c
index c6b412054a3c..9930e8a6cd43 100644
--- a/arch/arm/mach-sa1100/h3100.c
+++ b/arch/arm/mach-sa1100/h3100.c
@@ -13,6 +13,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
#include <video/sa1100fb.h>
@@ -86,44 +87,23 @@ static void __init h3100_map_io(void)
GAFR &= ~0x000001fb;
}
-/*
- * This turns the IRDA power on or off on the Compaq H3100
- */
-static struct gpio h3100_irda_gpio[] = {
- { H3100_GPIO_IR_ON, GPIOF_OUT_INIT_LOW, "IrDA power" },
- { H3100_GPIO_IR_FSEL, GPIOF_OUT_INIT_LOW, "IrDA fsel" },
+static struct irda_platform_data h3100_irda_data = {
};
-static int h3100_irda_set_power(struct device *dev, unsigned int state)
-{
- gpio_set_value(H3100_GPIO_IR_ON, state);
- return 0;
-}
-
-static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
-{
- gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
-}
-
-static int h3100_irda_startup(struct device *dev)
-{
- return gpio_request_array(h3100_irda_gpio, sizeof(h3100_irda_gpio));
-}
-
-static void h3100_irda_shutdown(struct device *dev)
-{
- return gpio_free_array(h3100_irda_gpio, sizeof(h3100_irda_gpio));
-}
-
-static struct irda_platform_data h3100_irda_data = {
- .set_power = h3100_irda_set_power,
- .set_speed = h3100_irda_set_speed,
- .startup = h3100_irda_startup,
- .shutdown = h3100_irda_shutdown,
+/* IrDA GPIO mappings */
+static struct gpiod_lookup_table h3100_irda_gpio_table = {
+ .dev_id = "sa11x0-ir",
+ .table = {
+ GPIO_LOOKUP("gpio", 8, "ir-power", GPIO_ACTIVE_HIGH),
+ GPIO_LOOKUP("gpio", 9, "ir-fsel", GPIO_ACTIVE_HIGH),
+ { },
+ },
};
static void __init h3100_mach_init(void)
{
+ gpiod_add_lookup_table(&h3100_irda_gpio_table);
+
h3xxx_mach_init();
sa11x0_register_lcd(&h3100_lcd_info);
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index 118338efd790..1a925ab9aa51 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -13,6 +13,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
#include <video/sa1100fb.h>
@@ -94,44 +95,23 @@ static void __init h3600_map_io(void)
h3xxx_map_io();
}
-/*
- * This turns the IRDA power on or off on the Compaq H3600
- */
-static struct gpio h3600_irda_gpio[] = {
- { H3600_EGPIO_IR_ON, GPIOF_OUT_INIT_LOW, "IrDA power" },
- { H3600_EGPIO_IR_FSEL, GPIOF_OUT_INIT_LOW, "IrDA fsel" },
+static struct irda_platform_data h3600_irda_data = {
};
-static int h3600_irda_set_power(struct device *dev, unsigned int state)
-{
- gpio_set_value(H3600_EGPIO_IR_ON, state);
- return 0;
-}
-
-static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
-{
- gpio_set_value(H3600_EGPIO_IR_FSEL, !(speed < 4000000));
-}
-
-static int h3600_irda_startup(struct device *dev)
-{
- return gpio_request_array(h3600_irda_gpio, sizeof(h3600_irda_gpio));
-}
-
-static void h3600_irda_shutdown(struct device *dev)
-{
- return gpio_free_array(h3600_irda_gpio, sizeof(h3600_irda_gpio));
-}
-
-static struct irda_platform_data h3600_irda_data = {
- .set_power = h3600_irda_set_power,
- .set_speed = h3600_irda_set_speed,
- .startup = h3600_irda_startup,
- .shutdown = h3600_irda_shutdown,
+/* IrDA GPIO mappings */
+static struct gpiod_lookup_table h3600_irda_gpio_table = {
+ .dev_id = "sa11x0-ir",
+ .table = {
+ GPIO_LOOKUP("htc-egpio", 9, "ir-power", GPIO_ACTIVE_HIGH),
+ GPIO_LOOKUP("htc-egpio", 13, "ir-fsel", GPIO_ACTIVE_HIGH),
+ { },
+ },
};
static void __init h3600_mach_init(void)
{
+ gpiod_add_lookup_table(&h3600_irda_gpio_table);
+
h3xxx_mach_init();
sa11x0_register_lcd(&h3600_lcd_info);
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 8/8] net: irda/sa1100_ir: remove sa11x0 irda platform data
2016-08-29 11:25 ` [PATCH 0/8] SA11x0 DMA engine/IrDA updates Russell King - ARM Linux
` (6 preceding siblings ...)
2016-08-29 11:26 ` [PATCH 7/8] ARM: sa1100/h3xxx: switch h3xxx " Russell King
@ 2016-08-29 11:26 ` Russell King
7 siblings, 0 replies; 11+ messages in thread
From: Russell King @ 2016-08-29 11:26 UTC (permalink / raw)
To: dmaengine, linux-arm-kernel, netdev
Cc: Dan Williams, Samuel Ortiz, Vinod Koul
There is now no need for the sa11x0 IrDA platform data, so remove
the header file and all locations that include it.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
arch/arm/mach-sa1100/assabet.c | 6 +-----
arch/arm/mach-sa1100/collie.c | 6 +-----
arch/arm/mach-sa1100/generic.c | 4 ++--
arch/arm/mach-sa1100/generic.h | 3 +--
arch/arm/mach-sa1100/h3100.c | 6 +-----
arch/arm/mach-sa1100/h3600.c | 6 +-----
drivers/net/irda/sa1100_ir.c | 30 +-----------------------------
include/linux/platform_data/irda-sa11x0.h | 20 --------------------
8 files changed, 8 insertions(+), 73 deletions(-)
delete mode 100644 include/linux/platform_data/irda-sa11x0.h
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index ba180eebd6ab..14a75735e9d0 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -42,7 +42,6 @@
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
-#include <linux/platform_data/irda-sa11x0.h>
#include <asm/mach/map.h>
#include <mach/assabet.h>
#include <linux/platform_data/mfd-mcp-sa11x0.h>
@@ -303,9 +302,6 @@ static struct resource assabet_flash_resources[] = {
};
-static struct irda_platform_data assabet_irda_data = {
-};
-
/* IrDA GPIO mappings */
static struct gpiod_lookup_table assabet_irda_gpio_table = {
.dev_id = "sa11x0-ir",
@@ -586,7 +582,7 @@ static void __init assabet_init(void)
#endif
sa11x0_register_mtd(&assabet_flash_data, assabet_flash_resources,
ARRAY_SIZE(assabet_flash_resources));
- sa11x0_register_irda(&assabet_irda_data);
+ sa11x0_register_irda();
sa11x0_register_mcp(&assabet_mcp_data);
if (!machine_has_neponset())
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 8ed0cbfaa0f4..5f1549ed19d2 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -44,7 +44,6 @@
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
#include <asm/mach/map.h>
-#include <linux/platform_data/irda-sa11x0.h>
#include <asm/hardware/scoop.h>
#include <asm/mach/sharpsl_param.h>
@@ -98,9 +97,6 @@ static struct mcp_plat_data collie_mcp_data = {
.codec_pdata = &collie_ucb1x00_data,
};
-static struct irda_platform_data collie_ir_data = {
-};
-
/* IrDA GPIO mappings */
static struct gpiod_lookup_table collie_irda_gpio_table = {
.dev_id = "sa11x0-ir",
@@ -379,7 +375,7 @@ static void __init collie_init(void)
sa11x0_register_mtd(&collie_flash_data, collie_flash_resources,
ARRAY_SIZE(collie_flash_resources));
sa11x0_register_mcp(&collie_mcp_data);
- sa11x0_register_irda(&collie_ir_data);
+ sa11x0_register_irda();
sharpsl_save_param();
}
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index a005eef1a24e..5d2e68984303 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -274,9 +274,9 @@ static struct platform_device sa11x0ir_device = {
.resource = sa11x0ir_resources,
};
-void sa11x0_register_irda(struct irda_platform_data *irda)
+void sa11x0_register_irda(void)
{
- sa11x0_register_device(&sa11x0ir_device, irda);
+ sa11x0_register_device(&sa11x0ir_device, NULL);
}
static struct resource sa1100_rtc_resources[] = {
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index 22c432979150..b733c98214bd 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -29,8 +29,7 @@ struct resource;
void sa11x0_register_mtd(struct flash_platform_data *flash,
struct resource *res, int nr);
-struct irda_platform_data;
-void sa11x0_register_irda(struct irda_platform_data *irda);
+void sa11x0_register_irda(void);
struct mcp_plat_data;
void sa11x0_ppc_configure_mcp(void);
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c
index 9930e8a6cd43..8c1a105ba2d1 100644
--- a/arch/arm/mach-sa1100/h3100.c
+++ b/arch/arm/mach-sa1100/h3100.c
@@ -19,7 +19,6 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
-#include <linux/platform_data/irda-sa11x0.h>
#include <mach/h3xxx.h>
#include <mach/irqs.h>
@@ -87,9 +86,6 @@ static void __init h3100_map_io(void)
GAFR &= ~0x000001fb;
}
-static struct irda_platform_data h3100_irda_data = {
-};
-
/* IrDA GPIO mappings */
static struct gpiod_lookup_table h3100_irda_gpio_table = {
.dev_id = "sa11x0-ir",
@@ -107,7 +103,7 @@ static void __init h3100_mach_init(void)
h3xxx_mach_init();
sa11x0_register_lcd(&h3100_lcd_info);
- sa11x0_register_irda(&h3100_irda_data);
+ sa11x0_register_irda();
}
MACHINE_START(H3100, "Compaq iPAQ H3100")
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index 1a925ab9aa51..14a7ad77b076 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -19,7 +19,6 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
-#include <linux/platform_data/irda-sa11x0.h>
#include <mach/h3xxx.h>
#include <mach/irqs.h>
@@ -95,9 +94,6 @@ static void __init h3600_map_io(void)
h3xxx_map_io();
}
-static struct irda_platform_data h3600_irda_data = {
-};
-
/* IrDA GPIO mappings */
static struct gpiod_lookup_table h3600_irda_gpio_table = {
.dev_id = "sa11x0-ir",
@@ -115,7 +111,7 @@ static void __init h3600_mach_init(void)
h3xxx_mach_init();
sa11x0_register_lcd(&h3600_lcd_info);
- sa11x0_register_irda(&h3600_irda_data);
+ sa11x0_register_irda();
}
MACHINE_START(H3600, "Compaq iPAQ H3600")
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index 25c63c9ff33c..3a8b9d5d61d1 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -38,7 +38,6 @@
#include <net/irda/irda_device.h>
#include <mach/hardware.h>
-#include <linux/platform_data/irda-sa11x0.h>
static int power_level = 3;
static int tx_lpm;
@@ -64,7 +63,6 @@ struct sa1100_irda {
struct sa1100_buf dma_tx;
struct device *dev;
- struct irda_platform_data *pdata;
struct irlap_cb *irlap;
struct qos_info qos;
@@ -577,8 +575,6 @@ static int sa1100_irda_set_speed(struct sa1100_irda *si, int speed)
Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID;
Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE;
- if (si->pdata->set_speed)
- si->pdata->set_speed(si->dev, speed);
if (si->fsel_gpio)
gpiod_set_value(si->fsel_gpio, 0);
@@ -605,8 +601,6 @@ static int sa1100_irda_set_speed(struct sa1100_irda *si, int speed)
si->tx_start = sa1100_irda_fir_tx_start;
si->irq = sa1100_irda_fir_irq;
- if (si->pdata->set_speed)
- si->pdata->set_speed(si->dev, speed);
if (si->fsel_gpio)
gpiod_set_value(si->fsel_gpio, 1);
@@ -637,10 +631,7 @@ static int sa1100_irda_set_speed(struct sa1100_irda *si, int speed)
static int
__sa1100_irda_set_power(struct sa1100_irda *si, unsigned int state)
{
- int ret = 0;
- if (si->pdata->set_power) {
- ret = si->pdata->set_power(si->dev, state);
- } else if (si->pwr_gpio) {
+ if (si->pwr_gpio) {
gpiod_set_value_cansleep(si->pwr_gpio, state);
} else if (si->md_gpio[0] && si->md_gpio[1]) {
int vals[2];
@@ -750,15 +741,6 @@ static int sa1100_irda_startup(struct sa1100_irda *si)
int ret;
/*
- * Ensure that the ports for this device are setup correctly.
- */
- if (si->pdata->startup) {
- ret = si->pdata->startup(si->dev);
- if (ret)
- return ret;
- }
-
- /*
* Configure PPC for IRDA - we want to drive TXD2 low.
* We also want to drive this pin low during sleep.
*/
@@ -784,9 +766,6 @@ static int sa1100_irda_startup(struct sa1100_irda *si)
if (ret) {
Ser2UTCR3 = 0;
Ser2HSCR0 = 0;
-
- if (si->pdata->shutdown)
- si->pdata->shutdown(si->dev);
}
return ret;
@@ -803,9 +782,6 @@ static void sa1100_irda_shutdown(struct sa1100_irda *si)
/* Disable the port. */
Ser2UTCR3 = 0;
Ser2HSCR0 = 0;
-
- if (si->pdata->shutdown)
- si->pdata->shutdown(si->dev);
}
static int sa1100_irda_start(struct net_device *dev)
@@ -955,9 +931,6 @@ static int sa1100_irda_probe(struct platform_device *pdev)
unsigned int baudrate_mask;
int err, irq;
- if (!pdev->dev.platform_data)
- return -EINVAL;
-
irq = platform_get_irq(pdev, 0);
if (irq <= 0)
return irq < 0 ? irq : -ENXIO;
@@ -982,7 +955,6 @@ static int sa1100_irda_probe(struct platform_device *pdev)
si = netdev_priv(dev);
si->dev = &pdev->dev;
- si->pdata = pdev->dev.platform_data;
err = sa1100_irda_get_gpio(&pdev->dev, &si->fsel_gpio, "ir-fsel",
GPIOD_OUT_LOW);
diff --git a/include/linux/platform_data/irda-sa11x0.h b/include/linux/platform_data/irda-sa11x0.h
deleted file mode 100644
index 38f77b5e56cf..000000000000
--- a/include/linux/platform_data/irda-sa11x0.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * arch/arm/include/asm/mach/irda.h
- *
- * Copyright (C) 2004 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __ASM_ARM_MACH_IRDA_H
-#define __ASM_ARM_MACH_IRDA_H
-
-struct irda_platform_data {
- int (*startup)(struct device *);
- void (*shutdown)(struct device *);
- int (*set_power)(struct device *, unsigned int state);
- void (*set_speed)(struct device *, unsigned int speed);
-};
-
-#endif
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread