]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
serial: 8250_dw: Don't use struct dw8250_data outside of 8250_dw
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 14 May 2024 19:05:53 +0000 (22:05 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Jun 2024 12:07:58 +0000 (14:07 +0200)
The container of the struct dw8250_port_data is private to the actual
driver. In particular, 8250_lpss and 8250_dw use different data types
that are assigned to the UART port private_data. Hence, it must not
be used outside the specific driver.

Currently the only cpr_val is required by the common code, make it
be available via struct dw8250_port_data.

This fixes the UART breakage on Intel Galileo boards.

Fixes: 593dea000bc1 ("serial: 8250: dw: Allow to use a fallback CPR value if not synthesized")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240514190730.2787071-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_dw.c
drivers/tty/serial/8250/8250_dwlib.c
drivers/tty/serial/8250/8250_dwlib.h

index ba9f4dc4e71da5e1431c31a7c5318e98dfe25543..667e16897bde7755811ccf722137fbc8857a4d51 100644 (file)
@@ -55,6 +55,7 @@
 #define DW_UART_QUIRK_SKIP_SET_RATE    BIT(2)
 #define DW_UART_QUIRK_IS_DMA_FC                BIT(3)
 #define DW_UART_QUIRK_APMC0D08         BIT(4)
+#define DW_UART_QUIRK_CPR_VALUE                BIT(5)
 
 static inline struct dw8250_data *clk_to_dw8250_data(struct notifier_block *nb)
 {
@@ -432,6 +433,10 @@ static void dw8250_prepare_rx_dma(struct uart_8250_port *p)
 static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
 {
        unsigned int quirks = data->pdata ? data->pdata->quirks : 0;
+       u32 cpr_value = data->pdata ? data->pdata->cpr_value : 0;
+
+       if (quirks & DW_UART_QUIRK_CPR_VALUE)
+               data->data.cpr_value = cpr_value;
 
 #ifdef CONFIG_64BIT
        if (quirks & DW_UART_QUIRK_OCTEON) {
@@ -714,8 +719,8 @@ static const struct dw8250_platform_data dw8250_armada_38x_data = {
 
 static const struct dw8250_platform_data dw8250_renesas_rzn1_data = {
        .usr_reg = DW_UART_USR,
-       .cpr_val = 0x00012f32,
-       .quirks = DW_UART_QUIRK_IS_DMA_FC,
+       .cpr_value = 0x00012f32,
+       .quirks = DW_UART_QUIRK_CPR_VALUE | DW_UART_QUIRK_IS_DMA_FC,
 };
 
 static const struct dw8250_platform_data dw8250_starfive_jh7100_data = {
index 3e33ddf7bc8007af3fc7a27ae6a8eda4f5499883..5a2520943dfd530a53fc938b183d732055e1284c 100644 (file)
@@ -242,7 +242,6 @@ static const struct serial_rs485 dw8250_rs485_supported = {
 void dw8250_setup_port(struct uart_port *p)
 {
        struct dw8250_port_data *pd = p->private_data;
-       struct dw8250_data *data = to_dw8250_data(pd);
        struct uart_8250_port *up = up_to_u8250p(p);
        u32 reg, old_dlf;
 
@@ -278,7 +277,7 @@ void dw8250_setup_port(struct uart_port *p)
 
        reg = dw8250_readl_ext(p, DW_UART_CPR);
        if (!reg) {
-               reg = data->pdata->cpr_val;
+               reg = pd->cpr_value;
                dev_dbg(p->dev, "CPR is not available, using 0x%08x instead\n", reg);
        }
        if (!reg)
index f13e91f2cace9ccb119745f803e5e7cf92065d9c..794a9014cdac1dcf13bf04d3db7fbf33d06f3ef2 100644 (file)
@@ -19,6 +19,7 @@ struct dw8250_port_data {
        struct uart_8250_dma    dma;
 
        /* Hardware configuration */
+       u32                     cpr_value;
        u8                      dlf_size;
 
        /* RS485 variables */
@@ -27,7 +28,7 @@ struct dw8250_port_data {
 
 struct dw8250_platform_data {
        u8 usr_reg;
-       u32 cpr_val;
+       u32 cpr_value;
        unsigned int quirks;
 };