summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-07-05 10:02:45 +0200
committerRobert Schwebel <r.schwebel@pengutronix.de>2008-07-05 10:02:45 +0200
commit2582d8c1655f2eda42d5358a242b256fd6e88571 (patch)
tree4752d862dc8aa94d0a59f084106538850e09d5de
parent036bb15ec94216e28cb1550af0fdcdfb90c549df (diff)
IMX UART: Add board specific init/exit functions
Add platform specific init functions. Also rename the struct platform_device dev into pdev. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/serial/imx.c28
-rw-r--r--include/asm-arm/arch-imx/imx-uart.h2
2 files changed, 21 insertions, 9 deletions
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 6226e66c796..77968432b81 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -1078,30 +1078,40 @@ static int serial_imx_resume(struct platform_device *dev)
return 0;
}
-static int serial_imx_probe(struct platform_device *dev)
+static int serial_imx_probe(struct platform_device *pdev)
{
struct imxuart_platform_data *pdata;
- imx_ports[dev->id].port.dev = &dev->dev;
+ imx_ports[pdev->id].port.dev = &pdev->dev;
- pdata = (struct imxuart_platform_data *)dev->dev.platform_data;
+ pdata = pdev->dev.platform_data;
if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS))
- imx_ports[dev->id].have_rtscts = 1;
+ imx_ports[pdev->id].have_rtscts = 1;
+
+ if (pdata->init)
+ pdata->init(pdev);
+
+ uart_add_one_port(&imx_reg, &imx_ports[pdev->id].port);
+ platform_set_drvdata(pdev, &imx_ports[pdev->id]);
- uart_add_one_port(&imx_reg, &imx_ports[dev->id].port);
- platform_set_drvdata(dev, &imx_ports[dev->id]);
return 0;
}
-static int serial_imx_remove(struct platform_device *dev)
+static int serial_imx_remove(struct platform_device *pdev)
{
- struct imx_port *sport = platform_get_drvdata(dev);
+ struct imxuart_platform_data *pdata;
+ struct imx_port *sport = platform_get_drvdata(pdev);
- platform_set_drvdata(dev, NULL);
+ pdata = pdev->dev.platform_data;
+
+ platform_set_drvdata(pdev, NULL);
if (sport)
uart_remove_one_port(&imx_reg, &sport->port);
+ if (pdata->exit)
+ pdata->exit(pdev);
+
return 0;
}
diff --git a/include/asm-arm/arch-imx/imx-uart.h b/include/asm-arm/arch-imx/imx-uart.h
index 3a685e1780e..d54eb1d4802 100644
--- a/include/asm-arm/arch-imx/imx-uart.h
+++ b/include/asm-arm/arch-imx/imx-uart.h
@@ -4,6 +4,8 @@
#define IMXUART_HAVE_RTSCTS (1<<0)
struct imxuart_platform_data {
+ int (*init)(struct platform_device *pdev);
+ void (*exit)(struct platform_device *pdev);
unsigned int flags;
};