diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-12-06 04:59:17 -0500 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-12-23 21:17:48 -0500 |
commit | 3ae988d97b160c07463b980ccf26ed9226660fef (patch) | |
tree | 7f68ee23b390715f16e1af02db3a5fd12e29225e /drivers/tty/serial/sh-sci.c | |
parent | 1fcc91a607de0bf72d3a6073dfe459f7e9145ac5 (diff) |
serial: sh-sci: Move overrun_bit and error_mask fields out of pdata
None of the fields is ever set by board code, and both of them are set
in the driver at probe time. Move them out of struct plat_sci_port to
struct sci_port.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index e9c6e2339884..98b8e3c98586 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -64,6 +64,9 @@ struct sci_port { | |||
64 | 64 | ||
65 | /* Platform configuration */ | 65 | /* Platform configuration */ |
66 | struct plat_sci_port *cfg; | 66 | struct plat_sci_port *cfg; |
67 | int overrun_bit; | ||
68 | unsigned int error_mask; | ||
69 | |||
67 | 70 | ||
68 | /* Break timer */ | 71 | /* Break timer */ |
69 | struct timer_list break_timer; | 72 | struct timer_list break_timer; |
@@ -760,19 +763,15 @@ static int sci_handle_errors(struct uart_port *port) | |||
760 | struct tty_port *tport = &port->state->port; | 763 | struct tty_port *tport = &port->state->port; |
761 | struct sci_port *s = to_sci_port(port); | 764 | struct sci_port *s = to_sci_port(port); |
762 | 765 | ||
763 | /* | 766 | /* Handle overruns */ |
764 | * Handle overruns, if supported. | 767 | if (status & (1 << s->overrun_bit)) { |
765 | */ | 768 | port->icount.overrun++; |
766 | if (s->cfg->overrun_bit != SCIx_NOT_SUPPORTED) { | ||
767 | if (status & (1 << s->cfg->overrun_bit)) { | ||
768 | port->icount.overrun++; | ||
769 | 769 | ||
770 | /* overrun error */ | 770 | /* overrun error */ |
771 | if (tty_insert_flip_char(tport, 0, TTY_OVERRUN)) | 771 | if (tty_insert_flip_char(tport, 0, TTY_OVERRUN)) |
772 | copied++; | 772 | copied++; |
773 | 773 | ||
774 | dev_notice(port->dev, "overrun error"); | 774 | dev_notice(port->dev, "overrun error"); |
775 | } | ||
776 | } | 775 | } |
777 | 776 | ||
778 | if (status & SCxSR_FER(port)) { | 777 | if (status & SCxSR_FER(port)) { |
@@ -834,7 +833,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port) | |||
834 | if (!reg->size) | 833 | if (!reg->size) |
835 | return 0; | 834 | return 0; |
836 | 835 | ||
837 | if ((serial_port_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) { | 836 | if ((serial_port_in(port, SCLSR) & (1 << s->overrun_bit))) { |
838 | serial_port_out(port, SCLSR, 0); | 837 | serial_port_out(port, SCLSR, 0); |
839 | 838 | ||
840 | port->icount.overrun++; | 839 | port->icount.overrun++; |
@@ -2253,28 +2252,25 @@ static int sci_init_single(struct platform_device *dev, | |||
2253 | /* | 2252 | /* |
2254 | * Establish some sensible defaults for the error detection. | 2253 | * Establish some sensible defaults for the error detection. |
2255 | */ | 2254 | */ |
2256 | if (!p->error_mask) | 2255 | sci_port->error_mask = (p->type == PORT_SCI) ? |
2257 | p->error_mask = (p->type == PORT_SCI) ? | ||
2258 | SCI_DEFAULT_ERROR_MASK : SCIF_DEFAULT_ERROR_MASK; | 2256 | SCI_DEFAULT_ERROR_MASK : SCIF_DEFAULT_ERROR_MASK; |
2259 | 2257 | ||
2260 | /* | 2258 | /* |
2261 | * Establish sensible defaults for the overrun detection, unless | 2259 | * Establish sensible defaults for the overrun detection, unless |
2262 | * the part has explicitly disabled support for it. | 2260 | * the part has explicitly disabled support for it. |
2263 | */ | 2261 | */ |
2264 | if (p->overrun_bit != SCIx_NOT_SUPPORTED) { | 2262 | if (p->type == PORT_SCI) |
2265 | if (p->type == PORT_SCI) | 2263 | sci_port->overrun_bit = 5; |
2266 | p->overrun_bit = 5; | 2264 | else if (p->scbrr_algo_id == SCBRR_ALGO_4) |
2267 | else if (p->scbrr_algo_id == SCBRR_ALGO_4) | 2265 | sci_port->overrun_bit = 9; |
2268 | p->overrun_bit = 9; | 2266 | else |
2269 | else | 2267 | sci_port->overrun_bit = 0; |
2270 | p->overrun_bit = 0; | ||
2271 | 2268 | ||
2272 | /* | 2269 | /* |
2273 | * Make the error mask inclusive of overrun detection, if | 2270 | * Make the error mask inclusive of overrun detection, if |
2274 | * supported. | 2271 | * supported. |
2275 | */ | 2272 | */ |
2276 | p->error_mask |= (1 << p->overrun_bit); | 2273 | sci_port->error_mask |= 1 << sci_port->overrun_bit; |
2277 | } | ||
2278 | 2274 | ||
2279 | port->type = p->type; | 2275 | port->type = p->type; |
2280 | port->flags = UPF_FIXED_PORT | p->flags; | 2276 | port->flags = UPF_FIXED_PORT | p->flags; |