Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 87d80bf

Browse files
andy-shevgregkh
authored andcommitted
serial: 8250_dw: Don't use struct dw8250_data outside of 8250_dw
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: 593dea0 ("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>
1 parent b19ab7e commit 87d80bf

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

drivers/tty/serial/8250/8250_dw.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#define DW_UART_QUIRK_SKIP_SET_RATE BIT(2)
5656
#define DW_UART_QUIRK_IS_DMA_FC BIT(3)
5757
#define DW_UART_QUIRK_APMC0D08 BIT(4)
58+
#define DW_UART_QUIRK_CPR_VALUE BIT(5)
5859

5960
static inline struct dw8250_data *clk_to_dw8250_data(struct notifier_block *nb)
6061
{
@@ -432,6 +433,10 @@ static void dw8250_prepare_rx_dma(struct uart_8250_port *p)
432433
static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
433434
{
434435
unsigned int quirks = data->pdata ? data->pdata->quirks : 0;
436+
u32 cpr_value = data->pdata ? data->pdata->cpr_value : 0;
437+
438+
if (quirks & DW_UART_QUIRK_CPR_VALUE)
439+
data->data.cpr_value = cpr_value;
435440

436441
#ifdef CONFIG_64BIT
437442
if (quirks & DW_UART_QUIRK_OCTEON) {
@@ -714,8 +719,8 @@ static const struct dw8250_platform_data dw8250_armada_38x_data = {
714719

715720
static const struct dw8250_platform_data dw8250_renesas_rzn1_data = {
716721
.usr_reg = DW_UART_USR,
717-
.cpr_val = 0x00012f32,
718-
.quirks = DW_UART_QUIRK_IS_DMA_FC,
722+
.cpr_value = 0x00012f32,
723+
.quirks = DW_UART_QUIRK_CPR_VALUE | DW_UART_QUIRK_IS_DMA_FC,
719724
};
720725

721726
static const struct dw8250_platform_data dw8250_starfive_jh7100_data = {

drivers/tty/serial/8250/8250_dwlib.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ static const struct serial_rs485 dw8250_rs485_supported = {
242242
void dw8250_setup_port(struct uart_port *p)
243243
{
244244
struct dw8250_port_data *pd = p->private_data;
245-
struct dw8250_data *data = to_dw8250_data(pd);
246245
struct uart_8250_port *up = up_to_u8250p(p);
247246
u32 reg, old_dlf;
248247

@@ -278,7 +277,7 @@ void dw8250_setup_port(struct uart_port *p)
278277

279278
reg = dw8250_readl_ext(p, DW_UART_CPR);
280279
if (!reg) {
281-
reg = data->pdata->cpr_val;
280+
reg = pd->cpr_value;
282281
dev_dbg(p->dev, "CPR is not available, using 0x%08x instead\n", reg);
283282
}
284283
if (!reg)

drivers/tty/serial/8250/8250_dwlib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct dw8250_port_data {
1919
struct uart_8250_dma dma;
2020

2121
/* Hardware configuration */
22+
u32 cpr_value;
2223
u8 dlf_size;
2324

2425
/* RS485 variables */
@@ -27,7 +28,7 @@ struct dw8250_port_data {
2728

2829
struct dw8250_platform_data {
2930
u8 usr_reg;
30-
u32 cpr_val;
31+
u32 cpr_value;
3132
unsigned int quirks;
3233
};
3334

0 commit comments

Comments
 (0)