diff options
| -rw-r--r-- | arch/arm/mach-imx/mach-mx31moboard.c | 21 | ||||
| -rw-r--r-- | drivers/tty/serial/imx.c | 27 | ||||
| -rw-r--r-- | include/linux/platform_data/serial-imx.h | 2 |
3 files changed, 7 insertions, 43 deletions
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c index b3738e616f19..8f45afe785f8 100644 --- a/arch/arm/mach-imx/mach-mx31moboard.c +++ b/arch/arm/mach-imx/mach-mx31moboard.c | |||
| @@ -128,27 +128,15 @@ static struct platform_device mx31moboard_flash = { | |||
| 128 | .num_resources = 1, | 128 | .num_resources = 1, |
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | static int moboard_uart0_init(struct platform_device *pdev) | 131 | static void __init moboard_uart0_init(void) |
| 132 | { | 132 | { |
| 133 | int ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack"); | 133 | if (!gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack")) { |
| 134 | if (ret) | 134 | gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0); |
| 135 | return ret; | ||
| 136 | |||
| 137 | ret = gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0); | ||
| 138 | if (ret) | ||
| 139 | gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1)); | 135 | gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1)); |
| 140 | 136 | } | |
| 141 | return ret; | ||
| 142 | } | ||
| 143 | |||
| 144 | static void moboard_uart0_exit(struct platform_device *pdev) | ||
| 145 | { | ||
| 146 | gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1)); | ||
| 147 | } | 137 | } |
| 148 | 138 | ||
| 149 | static const struct imxuart_platform_data uart0_pdata __initconst = { | 139 | static const struct imxuart_platform_data uart0_pdata __initconst = { |
| 150 | .init = moboard_uart0_init, | ||
| 151 | .exit = moboard_uart0_exit, | ||
| 152 | }; | 140 | }; |
| 153 | 141 | ||
| 154 | static const struct imxuart_platform_data uart4_pdata __initconst = { | 142 | static const struct imxuart_platform_data uart4_pdata __initconst = { |
| @@ -543,6 +531,7 @@ static void __init mx31moboard_init(void) | |||
| 543 | 531 | ||
| 544 | imx31_add_imx2_wdt(); | 532 | imx31_add_imx2_wdt(); |
| 545 | 533 | ||
| 534 | moboard_uart0_init(); | ||
| 546 | imx31_add_imx_uart0(&uart0_pdata); | 535 | imx31_add_imx_uart0(&uart0_pdata); |
| 547 | imx31_add_imx_uart4(&uart4_pdata); | 536 | imx31_add_imx_uart4(&uart4_pdata); |
| 548 | 537 | ||
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 37c39390efb7..3b6c1a2e25de 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
| @@ -1901,7 +1901,6 @@ static void serial_imx_probe_pdata(struct imx_port *sport, | |||
| 1901 | static int serial_imx_probe(struct platform_device *pdev) | 1901 | static int serial_imx_probe(struct platform_device *pdev) |
| 1902 | { | 1902 | { |
| 1903 | struct imx_port *sport; | 1903 | struct imx_port *sport; |
| 1904 | struct imxuart_platform_data *pdata; | ||
| 1905 | void __iomem *base; | 1904 | void __iomem *base; |
| 1906 | int ret = 0; | 1905 | int ret = 0; |
| 1907 | struct resource *res; | 1906 | struct resource *res; |
| @@ -1955,38 +1954,16 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
| 1955 | 1954 | ||
| 1956 | imx_ports[sport->port.line] = sport; | 1955 | imx_ports[sport->port.line] = sport; |
| 1957 | 1956 | ||
| 1958 | pdata = dev_get_platdata(&pdev->dev); | ||
| 1959 | if (pdata && pdata->init) { | ||
| 1960 | ret = pdata->init(pdev); | ||
| 1961 | if (ret) | ||
| 1962 | return ret; | ||
| 1963 | } | ||
| 1964 | |||
| 1965 | ret = uart_add_one_port(&imx_reg, &sport->port); | ||
| 1966 | if (ret) | ||
| 1967 | goto deinit; | ||
| 1968 | platform_set_drvdata(pdev, sport); | 1957 | platform_set_drvdata(pdev, sport); |
| 1969 | 1958 | ||
| 1970 | return 0; | 1959 | return uart_add_one_port(&imx_reg, &sport->port); |
| 1971 | deinit: | ||
| 1972 | if (pdata && pdata->exit) | ||
| 1973 | pdata->exit(pdev); | ||
| 1974 | return ret; | ||
| 1975 | } | 1960 | } |
| 1976 | 1961 | ||
| 1977 | static int serial_imx_remove(struct platform_device *pdev) | 1962 | static int serial_imx_remove(struct platform_device *pdev) |
| 1978 | { | 1963 | { |
| 1979 | struct imxuart_platform_data *pdata; | ||
| 1980 | struct imx_port *sport = platform_get_drvdata(pdev); | 1964 | struct imx_port *sport = platform_get_drvdata(pdev); |
| 1981 | 1965 | ||
| 1982 | pdata = dev_get_platdata(&pdev->dev); | 1966 | return uart_remove_one_port(&imx_reg, &sport->port); |
| 1983 | |||
| 1984 | uart_remove_one_port(&imx_reg, &sport->port); | ||
| 1985 | |||
| 1986 | if (pdata && pdata->exit) | ||
| 1987 | pdata->exit(pdev); | ||
| 1988 | |||
| 1989 | return 0; | ||
| 1990 | } | 1967 | } |
| 1991 | 1968 | ||
| 1992 | static struct platform_driver serial_imx_driver = { | 1969 | static struct platform_driver serial_imx_driver = { |
diff --git a/include/linux/platform_data/serial-imx.h b/include/linux/platform_data/serial-imx.h index 4adec9b154dd..3cc2e3c40914 100644 --- a/include/linux/platform_data/serial-imx.h +++ b/include/linux/platform_data/serial-imx.h | |||
| @@ -23,8 +23,6 @@ | |||
| 23 | #define IMXUART_IRDA (1<<1) | 23 | #define IMXUART_IRDA (1<<1) |
| 24 | 24 | ||
| 25 | struct imxuart_platform_data { | 25 | struct imxuart_platform_data { |
| 26 | int (*init)(struct platform_device *pdev); | ||
| 27 | void (*exit)(struct platform_device *pdev); | ||
| 28 | unsigned int flags; | 26 | unsigned int flags; |
| 29 | void (*irda_enable)(int enable); | 27 | void (*irda_enable)(int enable); |
| 30 | unsigned int irda_inv_rx:1; | 28 | unsigned int irda_inv_rx:1; |
