summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/sh-sci.h
AgeCommit message (Collapse)Author
2017-02-03serial: sh-sci: consider DR (data ready) bit adequatelyUlrich Hecht
To allow operation with a higher RX FIFO interrupt threshold in PIO mode, it is necessary to consider the DR bit ("FIFO not full, but no data received for 1.5 frames") as an indicator that data can be read. Otherwise the driver will let data rot in the FIFO until the threshold is reached. Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03serial: sh-sci: add FIFO trigger bitsUlrich Hecht
Defines the bits controlling FIFO thresholds, adds the additional HSCIF registers to the register map. Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19serial: sh-sci: Extend sci_port_params with more port parametersLaurent Pinchart
The fifo size, overrun register and mask, sampling rate mask and error mask all depend on the port type only and don't need to be computed at runtime. Add them to the sci_port_parameters structure. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: sh-sci: Clear (H)SCIF timeout and overrun during resetGeert Uytterhoeven
Add the missing timeout bit definition for (H)SCIF. Clear the timeout and overrun flag bits during UART reset, cfr. the initialization flowchart in the datasheet. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: sh-sci: Add more Serial Port Control/Data Register documentationGeert Uytterhoeven
Improve documentation for the SCIFA/SCIFB Serial Port Control and Data Registers: - State clearly that the RTS and CTS lines are active-low, - Document the bits related to the serial port's SCK, RXD, and TXD pins. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: sh-sci: Add more Serial Port Register documentationGeert Uytterhoeven
Improve documentation for the (H)SCIF Serial Port Register: - Make it clear the RTS and CTS lines are active-low, - Document the bits related to the serial port's clock pin. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-06serial: sh-sci: Add more Serial Mode Register documentationGeert Uytterhoeven
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-17serial: sh-sci: Add BRG register definitionsGeert Uytterhoeven
Add register definitions for the Baud Rate Generator for External Clock (BRG), as found in some SCIF and in HSCIF, including a new regtype for the "SH-4(A)"-derived SCIF variant with BRG. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Correct SCIF_ERROR_CLEAR for plain SCIFGeert Uytterhoeven
SCIF_ERROR_CLEAR includes SCIFA_ORER, which exists only on SCIFA/SCIFB and SCIF on sh7705/sh7720/sh7721. To fix this: 1. Remove SCIFA_ORER from the definition of SCIF_ERROR_CLEAR, 2. During initialization, store the error clear mask to use, incorporating the overrun bit only if it applies to the SCxSR register. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Prevent compiler warnings on 64-bitGeert Uytterhoeven
Expressions involving "BIT(...)" create values of type "long", which is 64-bit on 64-bit. Hence "~BIT(...)" no longer fits in 32-bit, which will cause future compiler warnings when assigning to 32-bit variables: drivers/tty/serial/sh-sci.c: In function 'sci_init_single': drivers/tty/serial/sh-sci.h:58:25: warning: large integer implicitly truncated to unsigned type [-Woverflow] #define SCI_ERROR_CLEAR ~(SCI_RESERVED | SCI_PER | SCI_FER | SCI_ORER) ^ drivers/tty/serial/sh-sci.c:2325:27: note: in expansion of macro 'SCI_ERROR_CLEAR' sci_port->error_clear = SCI_ERROR_CLEAR; As these values are (at most) 32-bit register values anyway, cast them to "u32" at the definition level to prevent such compiler warnings. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Replace buggy big #ifdef by runtime logicGeert Uytterhoeven
The #ifdef logic to clear SCxSR bits using RMW on SCIFA/SCIFB and SCIF variants with some SCIFA features (sh7705/SH7720/sh7721) has several drawbacks: - It wasn't updated for newer R-Mobile variants (APE6), - It doesn't correctly handle SoCs with both SCIF and SCIFA/B (e.g. R-Car Gen2, but also legacy sh7723/sh7724), - It doesn't play well with ARM multi-platform kernels: on R-Car Gen2, SCIF/SCIFA/SCIFB/HSCIF were handled differently, depending on whether r8a7740 or sh73a0 support was enabled or not, Replace the #ifdef logic by runtime logic to fix this. SCIFA/SCIFB and SCIF on sh7705/sh7720/sh7721 use RMW to clear error bits, other variants use plain stores, as before. Note that this changes behavior for SCIFA on sh7723/sh7724 (these SoCs have both SCIF and SCIFA), which didn't use RMW before. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10serial: sh-sci: Replace hardcoded overrun bit valuesGeert Uytterhoeven
Add the missing overrun bit definition for (H)SCIF. Replace overrun_bit by overrun_mask, so we can use the existing defines instead of hardcoded values. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10serial: sh-sci: Replace hardcoded values in SCxSR_*_CLEAR macrosGeert Uytterhoeven
Add the missing overrun error bit in SCxSR on SCIFA/SCIFB and SCIF on SH7705/SH7720/SH7721. Document what the corresponding bit(s) on plain SCIF are used for. Sort the components of SCIF_DEFAULT_ERROR_MASK by reverse definition order. Replace the hardcoded values in the SCxSR_*_CLEAR macros by proper defines. Use bit masks (negations of sets of bits) to make it more obvious which bits are being cleared. Assembler output (on sh) was compared before and after this commit: - For the first branch of the big "#if defined(...) || ..." construct, the code has changed slightly, as 32-bit bitmasks can be loaded in a single instruction, unlike the old large 16-bit constants (the SCxSR register is 16 bit, so we don't care about the top 16 bits), - For the second branch, the generated code is identical. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10serial: sh-sci: Standardize on using the BIT() macro to define register bitsGeert Uytterhoeven
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10serial: sh-sci: Document remaining FIFO Control Register bitsGeert Uytterhoeven
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10serial: sh-sci: Add SCIFA/B SCPCR register definitionsGeert Uytterhoeven
Add the register definitions for the Serial Port Control and Data Registers on SCIFA/SCIFB, which are needed for RTS/CTS pin control. Extracted from patches by Magnus Damm <damm+renesas@opensource.se>. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10serial: sh-sci: Add (H)SCIF RTS/CTS pin data register bit definitionsGeert Uytterhoeven
Add the missing register bit definitions to set the RTS pin and read the CTS pin on (H)SCIF. Extracted from patches by Magnus Damm <damm+renesas@opensource.se>. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10serial: sh-sci: Move private definitions to private header fileGeert Uytterhoeven
Move private register definitions and enums from the public <linux/serial_sci.h> header file to the driver private "sh-sci.h" header file. The common Serial Control Register definitions are left in the public header file, as they're needed to fill in plat_sci_port.scscr on legacy systems not using DT. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06drivers/tty/serial/sh-sci.h: remove dead reference on ARCH_SH7372Valentin Rothberg
The Kconfig option ARCH_SH7372 has been removed by commit 59b89af1d555 ("ARM: shmobile: sh7372: Remove Legacy C SoC code"). This patch removes the last reference on this Kconfig option. Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-24serial: sh-sci: Move overrun_bit and error_mask fields out of pdataLaurent Pinchart
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>
2013-03-25serial: sh-sci: remove obsolete Kconfig macrosPaul Bolle
Support for SH7367 and SH7377 got removed in v3.8. Now remove their last Kconfig macros. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-30serial: sh-sci: use serial_port_in/out vs sci_in/out.Paul Mundt
Follows the 8250 change for pretty much the same rationale. See commit "serial: use serial_port_in/out vs serial_in/out in 8250". Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-11ARM: mach-shmobile: R-Mobile A1 support.Kuninori Morimoto
This adds preliminary support for the R8A7740 (R-Mobile A1) CPU Timer, serial, gic, clock are supported at this point. This patch is based on v0.1 manual Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-14serial: sh-sci: FIFO sizing helper consolidation.Paul Mundt
This consolidates all of the TX/RX fill/room nonsense in to a single set of fairly heavyweight definitions. The implementation goes in descending order of complexity, testing the register map for capabilities until we run out of options and do it the legacy SCI way. Masks are derived directly from the per-port FIFO size, meaning that platforms with FIFO sizes not matching the standard port types will still need to manually fix them up. This also fixes up a number of issues such as tx_empty being completely bogus for SCI and IrDA ports, some ports using masks smaller or greater than their FIFO size, and so forth. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-14serial: sh-sci: Abstract register maps.Paul Mundt
This takes a bit of a sledgehammer to the horribly CPU subtype ifdef-ridden header and abstracts all of the different register layouts in to distinct types which in turn can be overriden on a per-port basis, or permitted to default to the map matching the port type at probe time. In the process this ultimately fixes up inumerable bugs with mismatches on various CPU types (particularly the legacy ones that were obviously broken years ago and no one noticed) and provides a more tightly coupled and consolidated platform for extending and implementing generic features. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-08serial: sh-sci: More unused define purging.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-08serial: sh-sci: Consolidate RXD pin handling.Paul Mundt
Non-SCI parts do not have the special port reg necessary for cases where the RX and SCI pins are muxed and need to be manually polled, so these like always fall back on the normal FIFO processing paths. SH7760 is in a class in and of itself with regards to mapping its SIM card interface via the SCI port class despite not having any of the RXD lines wired up and so implicitly behaving more like a SCIF in this regard. Out of the other CPUs, some support the port check via the same block while others do it through an external SuperI/O, so it's not even possible to perform the check relative to the ioremapped cookie offset, so the separate read semantics are preserved here, too. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-08serial: sh-sci: Generalize overrun handling.Paul Mundt
This consolidates all of the broken out overrun handling and ensures that we have sensible defaults per-port type, in addition to making sure that overruns are flagged appropriately in the error mask for parts that haven't explicitly disabled support for it. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-08serial: sh-sci: Kill off some more unused definitions.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-08serial: sh-sci: Tidy up ioread/write wrappers, kill off unused SCI helper.Paul Mundt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-06-06serial: sh-sci: Kill off bitrotted H8/300 support.Paul Mundt
h8300 has never been updated upstream to support the conversion to the driver model (which happened mid-2.5), and it doesn't seem likely that it ever will. Kill off the remaining bitrotted support to reduce the maintenance burden going forward. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-05-23sh: sh-sci: sh7377 and sh73a0 build fixesMagnus Damm
Fix sh7377 and sh73a0 build failure: drivers/tty/serial/sh-sci.c: In function 'scif_txfill': drivers/tty/serial/sh-sci.c:338: error: implicit declaration of function 'sci_SCTFDR_in' drivers/tty/serial/sh-sci.c: In function 'scif_rxfill': drivers/tty/serial/sh-sci.c:351: error: implicit declaration of function 'sci_SCRFDR_in' make[3]: *** [drivers/tty/serial/sh-sci.o] Error 1 make[2]: *** [drivers/tty/serial] Error 2 make[1]: *** [drivers/tty] Error 2 make: *** [drivers] Error 2 Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-01-26Merge branch 'master' of ↵Paul Mundt
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into common/serial-rework
2011-01-20Merge branch 'tty-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6 * 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: tty: update MAINTAINERS file due to driver movement tty: move drivers/serial/ to drivers/tty/serial/ tty: move hvc drivers to drivers/tty/hvc/
2011-01-13tty: move drivers/serial/ to drivers/tty/serial/Greg Kroah-Hartman
The serial drivers are really just tty drivers, so move them to drivers/tty/ to make things a bit neater overall. This is part of the tty/serial driver movement proceedure as proposed by Arnd Bergmann and approved by everyone involved a number of months ago. Cc: Arnd Bergmann <arnd@arndb.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Rogier Wolff <R.E.Wolff@bitwizard.nl> Cc: Michael H. Warfield <mhw@wittsend.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>