Skip to content

Commit 2d4dd0d

Browse files
seebegregkh
authored andcommitted
serial: sh-sci: Allow for compressed SCIF address
Some devices with SCIx_SH4_SCIF_REGTYPE have no space between registers. Use the register area size to determine the spacing between register. Signed-off-by: Chris Brandt <chris.brandt@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 70a15ff commit 2d4dd0d

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

drivers/tty/serial/sh-sci.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,15 @@ static const struct sci_port_params sci_port_params[SCIx_NR_REGTYPES] = {
348348
[SCIx_SH4_SCIF_REGTYPE] = {
349349
.regs = {
350350
[SCSMR] = { 0x00, 16 },
351-
[SCBRR] = { 0x04, 8 },
352-
[SCSCR] = { 0x08, 16 },
353-
[SCxTDR] = { 0x0c, 8 },
354-
[SCxSR] = { 0x10, 16 },
355-
[SCxRDR] = { 0x14, 8 },
356-
[SCFCR] = { 0x18, 16 },
357-
[SCFDR] = { 0x1c, 16 },
358-
[SCSPTR] = { 0x20, 16 },
359-
[SCLSR] = { 0x24, 16 },
351+
[SCBRR] = { 0x02, 8 },
352+
[SCSCR] = { 0x04, 16 },
353+
[SCxTDR] = { 0x06, 8 },
354+
[SCxSR] = { 0x08, 16 },
355+
[SCxRDR] = { 0x0a, 8 },
356+
[SCFCR] = { 0x0c, 16 },
357+
[SCFDR] = { 0x0e, 16 },
358+
[SCSPTR] = { 0x10, 16 },
359+
[SCLSR] = { 0x12, 16 },
360360
},
361361
.fifosize = 16,
362362
.overrun_reg = SCLSR,
@@ -2848,7 +2848,7 @@ static int sci_init_single(struct platform_device *dev,
28482848
{
28492849
struct uart_port *port = &sci_port->port;
28502850
const struct resource *res;
2851-
unsigned int i;
2851+
unsigned int i, regtype;
28522852
int ret;
28532853

28542854
sci_port->cfg = p;
@@ -2885,6 +2885,7 @@ static int sci_init_single(struct platform_device *dev,
28852885
if (unlikely(sci_port->params == NULL))
28862886
return -EINVAL;
28872887

2888+
regtype = sci_port->params - sci_port_params;
28882889
switch (p->type) {
28892890
case PORT_SCIFB:
28902891
sci_port->rx_trigger = 48;
@@ -2939,6 +2940,10 @@ static int sci_init_single(struct platform_device *dev,
29392940
port->regshift = 1;
29402941
}
29412942

2943+
if (regtype == SCIx_SH4_SCIF_REGTYPE)
2944+
if (sci_port->reg_size >= 0x20)
2945+
port->regshift = 1;
2946+
29422947
/*
29432948
* The UART port needs an IRQ value, so we peg this to the RX IRQ
29442949
* for the multi-IRQ ports, which is where we are primarily

0 commit comments

Comments
 (0)