Skip to content

Commit 305a5dd

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
serial: imx: Simplify compatibility handling
Three of the four entries of imx_uart_devdata[] use .uts_reg = IMX21_UTS. The difference in the .devtype member isn't relevant, the only thing that matters is if is equal to IMX1_UART. So use an entry with .devtype = IMX21_UART on all platforms but i.MX1. There is no need to have the dev types in an array, so split them up in two separate variables. The fsl,imx53-uart devinfo can go away because in the binding and also the dts files all fsl,imx53-uart devices also are compatible to fsl,imx21-uart. That's not the case for fsl,imx6q-uart (which is a bit strange IMHO), so the fsl,imx6q-uart must stay around. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 064f3bb commit 305a5dd

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

drivers/tty/serial/imx.c

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@
177177
enum imx_uart_type {
178178
IMX1_UART,
179179
IMX21_UART,
180-
IMX53_UART,
181-
IMX6Q_UART,
182180
};
183181

184182
/* device type dependent stuff */
@@ -240,30 +238,26 @@ struct imx_port_ucrs {
240238
unsigned int ucr3;
241239
};
242240

243-
static struct imx_uart_data imx_uart_devdata[] = {
244-
[IMX1_UART] = {
245-
.uts_reg = IMX1_UTS,
246-
.devtype = IMX1_UART,
247-
},
248-
[IMX21_UART] = {
249-
.uts_reg = IMX21_UTS,
250-
.devtype = IMX21_UART,
251-
},
252-
[IMX53_UART] = {
253-
.uts_reg = IMX21_UTS,
254-
.devtype = IMX53_UART,
255-
},
256-
[IMX6Q_UART] = {
257-
.uts_reg = IMX21_UTS,
258-
.devtype = IMX6Q_UART,
259-
},
241+
static const struct imx_uart_data imx_uart_imx1_devdata = {
242+
.uts_reg = IMX1_UTS,
243+
.devtype = IMX1_UART,
244+
};
245+
246+
static const struct imx_uart_data imx_uart_imx21_devdata = {
247+
.uts_reg = IMX21_UTS,
248+
.devtype = IMX21_UART,
260249
};
261250

262251
static const struct of_device_id imx_uart_dt_ids[] = {
263-
{ .compatible = "fsl,imx6q-uart", .data = &imx_uart_devdata[IMX6Q_UART], },
264-
{ .compatible = "fsl,imx53-uart", .data = &imx_uart_devdata[IMX53_UART], },
265-
{ .compatible = "fsl,imx1-uart", .data = &imx_uart_devdata[IMX1_UART], },
266-
{ .compatible = "fsl,imx21-uart", .data = &imx_uart_devdata[IMX21_UART], },
252+
/*
253+
* For reasons unknown to me, some UART devices (e.g. imx6ul's) are
254+
* compatible to fsl,imx6q-uart, but not fsl,imx21-uart, while the
255+
* original imx6q's UART is compatible to fsl,imx21-uart. This driver
256+
* doesn't make any distinction between these two variants.
257+
*/
258+
{ .compatible = "fsl,imx6q-uart", .data = &imx_uart_imx21_devdata, },
259+
{ .compatible = "fsl,imx1-uart", .data = &imx_uart_imx1_devdata, },
260+
{ .compatible = "fsl,imx21-uart", .data = &imx_uart_imx21_devdata, },
267261
{ /* sentinel */ }
268262
};
269263
MODULE_DEVICE_TABLE(of, imx_uart_dt_ids);

0 commit comments

Comments
 (0)