diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-07-05 04:02:45 -0400 |
---|---|---|
committer | Robert Schwebel <r.schwebel@pengutronix.de> | 2008-07-05 04:02:45 -0400 |
commit | 2582d8c1655f2eda42d5358a242b256fd6e88571 (patch) | |
tree | 4752d862dc8aa94d0a59f084106538850e09d5de | |
parent | 036bb15ec94216e28cb1550af0fdcdfb90c549df (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.c | 28 | ||||
-rw-r--r-- | include/asm-arm/arch-imx/imx-uart.h | 2 |
2 files changed, 21 insertions, 9 deletions
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 6226e66c7966..77968432b81e 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -1078,30 +1078,40 @@ static int serial_imx_resume(struct platform_device *dev) | |||
1078 | return 0; | 1078 | return 0; |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | static int serial_imx_probe(struct platform_device *dev) | 1081 | static int serial_imx_probe(struct platform_device *pdev) |
1082 | { | 1082 | { |
1083 | struct imxuart_platform_data *pdata; | 1083 | struct imxuart_platform_data *pdata; |
1084 | 1084 | ||
1085 | imx_ports[dev->id].port.dev = &dev->dev; | 1085 | imx_ports[pdev->id].port.dev = &pdev->dev; |
1086 | 1086 | ||
1087 | pdata = (struct imxuart_platform_data *)dev->dev.platform_data; | 1087 | pdata = pdev->dev.platform_data; |
1088 | if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS)) | 1088 | if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS)) |
1089 | imx_ports[dev->id].have_rtscts = 1; | 1089 | imx_ports[pdev->id].have_rtscts = 1; |
1090 | |||
1091 | if (pdata->init) | ||
1092 | pdata->init(pdev); | ||
1093 | |||
1094 | uart_add_one_port(&imx_reg, &imx_ports[pdev->id].port); | ||
1095 | platform_set_drvdata(pdev, &imx_ports[pdev->id]); | ||
1090 | 1096 | ||
1091 | uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); | ||
1092 | platform_set_drvdata(dev, &imx_ports[dev->id]); | ||
1093 | return 0; | 1097 | return 0; |
1094 | } | 1098 | } |
1095 | 1099 | ||
1096 | static int serial_imx_remove(struct platform_device *dev) | 1100 | static int serial_imx_remove(struct platform_device *pdev) |
1097 | { | 1101 | { |
1098 | struct imx_port *sport = platform_get_drvdata(dev); | 1102 | struct imxuart_platform_data *pdata; |
1103 | struct imx_port *sport = platform_get_drvdata(pdev); | ||
1099 | 1104 | ||
1100 | platform_set_drvdata(dev, NULL); | 1105 | pdata = pdev->dev.platform_data; |
1106 | |||
1107 | platform_set_drvdata(pdev, NULL); | ||
1101 | 1108 | ||
1102 | if (sport) | 1109 | if (sport) |
1103 | uart_remove_one_port(&imx_reg, &sport->port); | 1110 | uart_remove_one_port(&imx_reg, &sport->port); |
1104 | 1111 | ||
1112 | if (pdata->exit) | ||
1113 | pdata->exit(pdev); | ||
1114 | |||
1105 | return 0; | 1115 | return 0; |
1106 | } | 1116 | } |
1107 | 1117 | ||
diff --git a/include/asm-arm/arch-imx/imx-uart.h b/include/asm-arm/arch-imx/imx-uart.h index 3a685e1780ea..d54eb1d48026 100644 --- a/include/asm-arm/arch-imx/imx-uart.h +++ b/include/asm-arm/arch-imx/imx-uart.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #define IMXUART_HAVE_RTSCTS (1<<0) | 4 | #define IMXUART_HAVE_RTSCTS (1<<0) |
5 | 5 | ||
6 | struct imxuart_platform_data { | 6 | struct imxuart_platform_data { |
7 | int (*init)(struct platform_device *pdev); | ||
8 | void (*exit)(struct platform_device *pdev); | ||
7 | unsigned int flags; | 9 | unsigned int flags; |
8 | }; | 10 | }; |
9 | 11 | ||