1
0
Fork 0
Commit Graph

133 Commits (b933bd3200196d247184b26f10472f08b0036d0f)

Author SHA1 Message Date
Geert Uytterhoeven b933bd3200 serial: sh-sci: Drop path in reference to serial_core.c
serial_core.c was moved from drivers/serial/ to drivers/tty/serial/ a
while ago. Remove the path to make it move-proof.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04 17:33:48 +01:00
Geert Uytterhoeven 2944a331b7 serial: sh-sci: Use SCSMR_CKS instead of hardcoded literal 3
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04 17:33:48 +01:00
Geert Uytterhoeven 54af5001e1 serial: sh-sci: Use SCIF_DR instead of hardcoded literal 1
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04 17:33:48 +01:00
Geert Uytterhoeven 5da0f46874 serial: sh-sci: Correct SCIF_ERROR_CLEAR for plain SCIF
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-04 17:33:48 +01:00
Geert Uytterhoeven a1b5b43ffb serial: sh-sci: Replace buggy big #ifdef by runtime logic
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-10-04 17:33:48 +01:00
Linus Torvalds 8c7febe839 TTY/Serial driver patches for 4.2-rc1
Here's the tty and serial driver patches for 4.2-rc1.
 
 A number of individual driver updates, some code cleanups, and other
 minor things, full details in the shortlog.
 
 All have been in linux-next for a while with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlWNoSAACgkQMUfUDdst+ymxNQCguSEmkAYNDdLyYhdcOqSxJt9u
 U1gAoMThUDoomkx6CTDMU1wn53hxgMk9
 =eCUS
 -----END PGP SIGNATURE-----

Merge tag 'tty-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial driver updates from Greg KH:
 "Here's the tty and serial driver patches for 4.2-rc1.

  A number of individual driver updates, some code cleanups, and other
  minor things, full details in the shortlog.

  All have been in linux-next for a while with no reported issues"

* tag 'tty-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (152 commits)
  Doc: serial-rs485.txt: update RS485 driver interface
  Doc: tty.txt: remove mention of the BKL
  MAINTAINERS: tty: add serial docs directory
  serial: sprd: check for NULL after calling devm_clk_get
  serial: 8250_pci: Correct uartclk for xr17v35x expansion chips
  serial: 8250_pci: Add support for 12 port Exar boards
  serial: 8250_uniphier: add bindings document for UniPhier UART
  serial: core: cleanup in uart_get_baud_rate()
  serial: stm32-usart: Add STM32 USART Driver
  tty/serial: kill off set_irq_flags usage
  tty: move linux/gsmmux.h to uapi
  doc: dt: add documentation for nxp,lpc1850-uart
  serial: 8250: add LPC18xx/43xx UART driver
  serial: 8250_uniphier: add UniPhier serial driver
  serial: 8250_dw: support ACPI platforms with integrated DMA engine
  serial: of_serial: check the return value of clk_prepare_enable()
  serial: of_serial: use devm_clk_get() instead of clk_get()
  serial: earlycon: Add support for big-endian MMIO accesses
  serial: sirf: use hrtimer for data rx
  serial: sirf: correct the fifo empty_bit
  ...
2015-06-26 15:53:22 -07:00
Yoshinori Sato e4d6f911a7 sh-sci: Get register size from platform device
There is much SCI of SoC having within,
and the register size is also different in everyone.
So get from platform device.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Acked-by: by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
2015-06-23 13:35:59 +09:00
Yoshinori Sato e1d0be6161 sh-sci: Add h8300 SCI
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
2015-06-23 13:35:48 +09:00
Geert Uytterhoeven 99fb215eea serial: sh-sci: Remove obsolete comment about overrun detection
The code it refers to was removed in commit b545e4f406 ("serial:
sh-sci: Compute overrun_bit without using baud rate algo").

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10 19:06:39 +02:00
Geert Uytterhoeven afd66db613 serial: sh-sci: Don't set SCLSR bits in the SCxSR error mask
error_mask is the union of all error indicating bits in the SCxSR
register, while overrun_mask may apply to a different register (SCLSR),
depending on the SCI variant.

Hence overrun_mask should only be ORed into error_mask 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-05-10 19:06:39 +02:00
Geert Uytterhoeven 2e0842a154 serial: sh-sci: Use the correct register for overrun checks
The various SCI implementations use 3 different methods to signal
overrun errors:
  - Bit SCI_ORER in register SCxSR on SCI,
  - Bit SCIFA_ORER in register SCxSR on SCIFA and SCIFB, and SCIF on
    SH7705/SH7720/SH7721,
  - Bit SCLSR_ORER in (optional!) register SCLSR on (H)SCIF.

However:
  1. sci_handle_fifo_overrun()
       a. handles (H)SCIF and SCIFA/SCIFB only,
       b. treats SCIF on SH7705/SH7720/SH7721 incorrectly,
  2. sci_mpxed_interrupt()
       a. treats SCIF on SH7705/SH7720/SH7721 incorrectly,
       b. ignores that not all SCIFs have the SCLSR register, causing
	  "Invalid register access" WARN()ings.

To fix the above:
  1. Determine and store the correct register enum during
     initialization,
  2. Replace the duplicated buggy switch statements by using the stored
     register enum,
  3. Add the missing existence check to  sci_mpxed_interrupt().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10 19:06:39 +02:00
Geert Uytterhoeven 75c249fd7c serial: sh-sci: Replace hardcoded overrun bit values
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-10 19:06:39 +02:00
Geert Uytterhoeven c097abc33f serial: sh-sci: Add SCIFA/B SCPCR register definitions
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-10 19:06:38 +02:00
Nobuhiro Iwamatsu 5f6d851564 serial: sh-sci: Update calculation of timeout for DMA
The current calculation method in the case of 9600bps, rounding error occurs
has become setting that occur timeout faster than the required time. When we
use 9600bps, 32byte buffer, 10 bit (CS8) and 100 HZ, it becomes 3 jiffies
(30msec). In fact it is necessary 33msec. This updates to the calculation
that are not actually less than the value set by the rounding error.
Also, this is nothing will be calculated value when there is no load. If there
are a lot of case load, overrun error will occur immediately.
This is by the buffer size to be calculated twice the DMA buffer, and add the
change of setting a sufficient time-out value.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-26 22:42:27 +01:00
Nobuhiro Iwamatsu cb772fe75f serial: sh-sci: Add overrun handling of SCIFA and SCIFB
SCIFA and SCIFB can detect the overrun, but it does not support.
This adds overrun handling of SCIFA and SCIFB.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-26 22:42:27 +01:00
Hisashi Nakamura 8b6ff84c2d serial: sh-sci: Fix R-Car SCIF and HSCIF overrun handling
When fifo overrun happened, the interrupt status refers to
SCLSR register in R-Car SCIF and HSCIF.
Thus, overrun handling takes SCLSR register into account.

Signed-off-by: Hisashi Nakamura <hisashi.nakamura.ak@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-02 10:11:26 -08:00
Yoshihiro Kaneko 51b31f1c6b serial: sh-sci: Use dev_dbg() to log an error message
Since the driver cannot return from overrun error if characters
are output during overrun process, use dev_dbg() instead of
dev_notice() to log the error message of overrun in syslog.

Based on a patch by Hisashi Nakamura.

Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-02 10:11:26 -08:00
Sergei Shtylyov cb87634172 sh-sci: extend PM methods
In order to make it possible to restore from hibernation not only in Linux but
also in e.g. U-Boot, we have to use sci_{suspend|remove}() for the PM {freeze|
thaw|restore}() methods.  It's handy to achieve this by using SIMPLE_DEV_PM_OPS()
macro, however we have to annotate sci_{suspend|remove}() with '__maybe_unused'
in order to avoid compilation warnings when CONFIG_PM_SLEEP is undefined.

Based on orignal patch by Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-02 10:11:25 -08:00
Linus Torvalds e6b5be2be4 Driver core patches for 3.19-rc1
Here's the set of driver core patches for 3.19-rc1.
 
 They are dominated by the removal of the .owner field in platform
 drivers.  They touch a lot of files, but they are "simple" changes, just
 removing a line in a structure.
 
 Other than that, a few minor driver core and debugfs changes.  There are
 some ath9k patches coming in through this tree that have been acked by
 the wireless maintainers as they relied on the debugfs changes.
 
 Everything has been in linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSOD20ACgkQMUfUDdst+ylLPACg2QrW1oHhdTMT9WI8jihlHVRM
 53kAoLeteByQ3iVwWurwwseRPiWa8+MI
 =OVRS
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core update from Greg KH:
 "Here's the set of driver core patches for 3.19-rc1.

  They are dominated by the removal of the .owner field in platform
  drivers.  They touch a lot of files, but they are "simple" changes,
  just removing a line in a structure.

  Other than that, a few minor driver core and debugfs changes.  There
  are some ath9k patches coming in through this tree that have been
  acked by the wireless maintainers as they relied on the debugfs
  changes.

  Everything has been in linux-next for a while"

* tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
  Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
  fs: debugfs: add forward declaration for struct device type
  firmware class: Deletion of an unnecessary check before the function call "vunmap"
  firmware loader: fix hung task warning dump
  devcoredump: provide a one-way disable function
  device: Add dev_<level>_once variants
  ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
  ath: use seq_file api for ath9k debugfs files
  debugfs: add helper function to create device related seq_file
  drivers/base: cacheinfo: remove noisy error boot message
  Revert "core: platform: add warning if driver has no owner"
  drivers: base: support cpu cache information interface to userspace via sysfs
  drivers: base: add cpu_device_create to support per-cpu devices
  topology: replace custom attribute macros with standard DEVICE_ATTR*
  cpumask: factor out show_cpumap into separate helper function
  driver core: Fix unbalanced device reference in drivers_probe
  driver core: fix race with userland in device_add()
  sysfs/kernfs: make read requests on pre-alloc files use the buffer.
  sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
  fs: sysfs: return EGBIG on write if offset is larger than file size
  ...
2014-12-14 16:10:09 -08:00
Nobuhiro Iwamatsu f53297fb99 serial: sh-sci: Change checking for error rate of HSCIF
This changes negative values of error rate to be checked, because these
values are valid as error rate. And this changes in the process of adopting
a value close to 0.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-25 17:06:38 -08:00
Wolfram Sang 9144b3cded tty: serial: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:21:45 +02:00
Vinod Koul 2bcd90d56c serial: sh-sci: use dmaengine_terminate_all() API
The drivers should use dmaengine_terminate_all() API instead of
accessing the device_control which will be deprecated soon

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-10-15 21:31:00 +05:30
Nobuhiro Iwamatsu 730c4e782c serial: sh-sci: Add calculation recive margin for HSCIF
When the error of the same bit rate is detected, we will need to select
the recive margin is large. Current code holds the minimum error, it does
not have to check the recive margin. This adds this calculation.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17 18:14:44 -07:00
Nobuhiro Iwamatsu bcb9973a60 serial: sh-sci: Fix range check of bit-rate for HSCIF
If bit-rate calculation result of HSCIF is expect 255 from 0,
driver does not calculate error bit. However, we need to round
the value to calculate error bit in the case of negative value.
This rounds the value of bit-rate using clamp(), and bit-rate is the
case of negative value, it enables the calculation of the error bit.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17 18:14:44 -07:00
Nobuhiro Iwamatsu b7d66397f4 serial: sh-sci: Updated calculation of bit error rate and bit rate
Currently, the decimal point is discarded calculation of BRR.
Therefore, it can not calculate a value close to the correct value.
This patch fixes this problem by using DIV_ROUND_CLOSEST.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17 18:14:44 -07:00
Alexander Shiyan 8b152f1096 serial: treewide: Remove empty implementations of enable_ms()
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 17:29:38 -07:00
Linus Torvalds cb15955638 TTY/Serial driver update for 3.15-rc1
Here's the big tty/serial driver update for 3.15-rc1.
 
 Nothing major, a number of serial driver updates and a few tty core
 fixes as well.
 
 All have been in linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iEYEABECAAYFAlM7CWAACgkQMUfUDdst+ylDXACg0vZ+J+5OXbbE3lywVCAebjhB
 XzkAn1lz7JRIils7IlckAJ2w/m50b174
 =M+8c
 -----END PGP SIGNATURE-----

Merge tag 'tty-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial driver update from Greg KH:
 "Here's the big tty/serial driver update for 3.15-rc1.

  Nothing major, a number of serial driver updates and a few tty core
  fixes as well.

  All have been in linux-next for a while"

* tag 'tty-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (71 commits)
  tty/serial: omap: empty the RX FIFO at the end of half-duplex TX
  tty/serial: omap: fix RX interrupt enable/disable in half-duplex TX
  serial: sh-sci: Neaten dev_<level> uses
  serial: sh-sci: Replace hardcoded 3 by UART_PM_STATE_OFF
  serial: sh-sci: Add more register documentation
  serial: sh-sci: Remove useless casts
  serial: sh-sci: Replace printk() by pr_*()
  serial_core: Avoid NULL pointer dereference in uart_close()
  serial_core: Get a reference for port->tty in uart_remove_one_port()
  serial: clps711x: Give a chance to perform useful tasks during wait loop
  serial_core: Grammar s/ports/port's/
  serial_core: Spelling s/contro/control/
  serial: efm32: properly namespace location property
  serial: max310x: Add missing #include <linux/uaccess.h>
  synclink: fix info leak in ioctl
  serial: 8250: Clean up the locking for -rt
  serial: 8250_pci: change BayTrail default uartclk
  serial: 8250_pci: more BayTrail error-free bauds
  serial: sh-sci: Add missing call to uart_remove_one_port() in failure path
  serial_core: Unregister console in uart_remove_one_port()
  ...
2014-04-01 16:55:57 -07:00
Viresh Kumar 0b443ead71 cpufreq: remove unused notifier: CPUFREQ_{SUSPENDCHANGE|RESUMECHANGE}
Two cpufreq notifiers CPUFREQ_RESUMECHANGE and CPUFREQ_SUSPENDCHANGE have
not been used for some time, so remove them to clean up code a bit.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-19 14:10:24 +01:00
Joe Perches 9b971cd206 serial: sh-sci: Neaten dev_<level> uses
Add missing newlines and coalesce formats.
Realign arguments.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 16:20:49 -07:00
Geert Uytterhoeven d3dfe5d9b4 serial: sh-sci: Replace hardcoded 3 by UART_PM_STATE_OFF
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Simon Horman <horms@verge.net.au>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 16:20:49 -07:00
Geert Uytterhoeven 26de4f1b2f serial: sh-sci: Add more register documentation
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Simon Horman <horms@verge.net.au>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 16:20:49 -07:00
Geert Uytterhoeven ff43da00e0 serial: sh-sci: Remove useless casts
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Simon Horman <horms@verge.net.au>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 16:20:49 -07:00
Geert Uytterhoeven 6c13d5d27c serial: sh-sci: Replace printk() by pr_*()
Make banner const while we're at it

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Simon Horman <horms@verge.net.au>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17 16:20:49 -07:00
Geert Uytterhoeven bf13c9a894 serial: sh-sci: Add missing call to uart_remove_one_port() in failure path
If cpufreq_register_notifier() fails, we have to remove the port added by
sci_probe_single(), which is not done by sci_cleanup_single().

Else the serial port stays active from the point of view of the serial
subsystem, and it may crash when userspace getty is started, or when the
loadable driver module is unloaded.

This was introduced by commit 6dae14216c
("serial: sh-sci: Fix probe error paths").

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-28 16:39:38 -08:00
Jingoo Han 3af4e960b8 serial: sh-sci: Fix cast warning
Fix the following compile warning about cast to pointer from
integer of different size.

drivers/tty/serial/sh-sci.c:2021:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-13 09:17:31 -08:00
Bastian Hecht 20bdcab826 serial: sh-sci: Add OF support
Extend the driver to with support for SCIx device tree bindings. A
minimal set of features is supported, additional properties can be added
later should the need to describe more device features arise.

Signed-off-by: Bastian Hecht <hechtb+renesas@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2013-12-24 21:50:54 +09:00
Laurent Pinchart 89b5c1ab94 serial: sh-sci: Remove platform data mapbase and irqs fields
The fields are not used anymore by board files, remove them.

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-12-24 21:50:54 +09:00
Laurent Pinchart 878fbb9139 serial: sh-sci: Remove platform data scbrr_algo_id field
The field isn't set by any board, remote it.

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-12-24 21:50:54 +09:00
Laurent Pinchart ec09c5eb49 serial: sh-sci: Rework baud rate calculation
Computing the baud rate register value requires knowledge of the
hardware sampling rate. This information is currently encoded in a baud
rate calculation algorithm ID passed through platform data. However, it
can be derived from the port type directly in most cases.

Compute the sampling rate internally in the driver if the baud rate
calculation algorithm ID isn't specified, and allow platforms to
override the sampling rate through platform data in special cases (this
is only required for SCIFA ports on sh7723 and sh7724, the reason needs
to be investigated).

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-12-24 11:17:53 +09:00
Laurent Pinchart b545e4f406 serial: sh-sci: Compute overrun_bit without using baud rate algo
The overrun bit index is a property of the hardware. It's currently
computed based on a different and unrelated hardware property, the baud
rate calculation algorithm. Compute it using hardware identification
information only.

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-12-24 11:17:52 +09:00
Laurent Pinchart 520402bbc6 serial: sh-sci: Remove unused GPIO request code
The driver requests at initialization time GPIOs passed through platform
data. No platform makes use of this feature, remove it.

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-12-24 11:17:50 +09:00
Laurent Pinchart 3ae988d97b 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>
2013-12-24 11:17:48 +09:00
Laurent Pinchart 1fcc91a607 serial: sh-sci: Support resources passed through platform resources
Memory and IRQ resources are currently passed to the driver through
platform data. Support passing them through the standard platform
resources mechanism instead. This deprecates platform data resources.

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-12-24 11:17:44 +09:00
Laurent Pinchart bc14e00672 serial: sh-sci: Don't check IRQ in verify port operation
The IRQ number can't be modified by the user as the port is fixed.
There's no need to check the new IRQ number as it will be ignored by the
core.

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-12-24 11:17:41 +09:00
Laurent Pinchart b6e4a3f18c serial: sh-sci: Set the UPF_FIXED_PORT flag
The base address, IRQ and baud rate generator parent clock rate can't be
changed by userspace. Mark the port as fixed.

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-12-24 11:17:38 +09:00
Laurent Pinchart b5e17b71c6 serial: sh-sci: Remove duplicate interrupt check in verify port op
The driver checks if the interrupt number is greater than nr_irqs and
returns an error in that case. The same check is already performed by
the caller, remove it.

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-12-24 11:17:36 +09:00
Laurent Pinchart 6557b1f69e serial: sh-sci: Simplify baud rate calculation algorithms
Rewrite the baud rate register value calculations in easier to read
forms. The computed value isn't modified.

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-12-24 11:17:33 +09:00
Laurent Pinchart 6db201da25 serial: sh-sci: Remove baud rate calculation algorithm 5
The algorithm isn't used, remove it.

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-12-24 11:17:30 +09:00
Laurent Pinchart 8fb9631c51 serial: sh-sci: Sort headers alphabetically
This helps locating duplicates.

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-12-24 11:17:25 +09:00
Laurent Pinchart b016b646e8 serial: sh-sci: Convert to clk_prepare/unprepare
Turn clk_enable() and clk_disable() calls into clk_prepare_enable() and
clk_disable_unprepare() to get ready for the migration to the common
clock framework.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Magnus Damm <damm@opensource.se>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2013-12-14 09:59:31 +09:00