Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230911085451.628798-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
305a5dd7 064f3bb3

+17 -23
+17 -23
drivers/tty/serial/imx.c
··· 177 177 enum imx_uart_type { 178 178 IMX1_UART, 179 179 IMX21_UART, 180 - IMX53_UART, 181 - IMX6Q_UART, 182 180 }; 183 181 184 182 /* device type dependent stuff */ ··· 238 240 unsigned int ucr3; 239 241 }; 240 242 241 - static struct imx_uart_data imx_uart_devdata[] = { 242 - [IMX1_UART] = { 243 - .uts_reg = IMX1_UTS, 244 - .devtype = IMX1_UART, 245 - }, 246 - [IMX21_UART] = { 247 - .uts_reg = IMX21_UTS, 248 - .devtype = IMX21_UART, 249 - }, 250 - [IMX53_UART] = { 251 - .uts_reg = IMX21_UTS, 252 - .devtype = IMX53_UART, 253 - }, 254 - [IMX6Q_UART] = { 255 - .uts_reg = IMX21_UTS, 256 - .devtype = IMX6Q_UART, 257 - }, 243 + static const struct imx_uart_data imx_uart_imx1_devdata = { 244 + .uts_reg = IMX1_UTS, 245 + .devtype = IMX1_UART, 246 + }; 247 + 248 + static const struct imx_uart_data imx_uart_imx21_devdata = { 249 + .uts_reg = IMX21_UTS, 250 + .devtype = IMX21_UART, 258 251 }; 259 252 260 253 static const struct of_device_id imx_uart_dt_ids[] = { 261 - { .compatible = "fsl,imx6q-uart", .data = &imx_uart_devdata[IMX6Q_UART], }, 262 - { .compatible = "fsl,imx53-uart", .data = &imx_uart_devdata[IMX53_UART], }, 263 - { .compatible = "fsl,imx1-uart", .data = &imx_uart_devdata[IMX1_UART], }, 264 - { .compatible = "fsl,imx21-uart", .data = &imx_uart_devdata[IMX21_UART], }, 254 + /* 255 + * For reasons unknown to me, some UART devices (e.g. imx6ul's) are 256 + * compatible to fsl,imx6q-uart, but not fsl,imx21-uart, while the 257 + * original imx6q's UART is compatible to fsl,imx21-uart. This driver 258 + * doesn't make any distinction between these two variants. 259 + */ 260 + { .compatible = "fsl,imx6q-uart", .data = &imx_uart_imx21_devdata, }, 261 + { .compatible = "fsl,imx1-uart", .data = &imx_uart_imx1_devdata, }, 262 + { .compatible = "fsl,imx21-uart", .data = &imx_uart_imx21_devdata, }, 265 263 { /* sentinel */ } 266 264 }; 267 265 MODULE_DEVICE_TABLE(of, imx_uart_dt_ids);