aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorSascha Hauer <sascha@saschahauer.de>2008-04-17 03:47:32 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-17 11:22:21 -0400
commit3d454446e2b83b4e1e2997b2c6e689c85ab61868 (patch)
treec56034720494798fd181ab8670259062172ff350 /drivers/serial
parent789d52589a0849004ced991549a61dd110dfeb10 (diff)
[ARM] 4998/1: <IMX UART>: do not use hardcoded io space size
Do not use hardcoded io space size. Instead use the information provided by the resource. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/imx.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index dd1e071834be..0ce2b4a45e6d 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -167,11 +167,6 @@
167#define MINOR_START 41 167#define MINOR_START 41
168 168
169/* 169/*
170 * This is the size of our serial port register set.
171 */
172#define UART_PORT_SIZE 0x100
173
174/*
175 * This determines how often we check the modem status signals 170 * This determines how often we check the modem status signals
176 * for any change. They generally aren't connected to an IRQ 171 * for any change. They generally aren't connected to an IRQ
177 * so we have to poll them. We also check immediately before 172 * so we have to poll them. We also check immediately before
@@ -721,9 +716,11 @@ static const char *imx_type(struct uart_port *port)
721 */ 716 */
722static void imx_release_port(struct uart_port *port) 717static void imx_release_port(struct uart_port *port)
723{ 718{
724 struct imx_port *sport = (struct imx_port *)port; 719 struct platform_device *pdev = to_platform_device(port->dev);
720 struct resource *mmres;
725 721
726 release_mem_region(sport->port.mapbase, UART_PORT_SIZE); 722 mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
723 release_mem_region(mmres->start, mmres->end - mmres->start + 1);
727} 724}
728 725
729/* 726/*
@@ -731,10 +728,18 @@ static void imx_release_port(struct uart_port *port)
731 */ 728 */
732static int imx_request_port(struct uart_port *port) 729static int imx_request_port(struct uart_port *port)
733{ 730{
734 struct imx_port *sport = (struct imx_port *)port; 731 struct platform_device *pdev = to_platform_device(port->dev);
732 struct resource *mmres;
733 void *ret;
734
735 mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
736 if (!mmres)
737 return -ENODEV;
738
739 ret = request_mem_region(mmres->start, mmres->end - mmres->start + 1,
740 "imx-uart");
735 741
736 return request_mem_region(sport->port.mapbase, UART_PORT_SIZE, 742 return ret ? 0 : -EBUSY;
737 "imx-uart") != NULL ? 0 : -EBUSY;
738} 743}
739 744
740/* 745/*