<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/tty/serial/sh-sci.c, branch v3.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2012-11-21T23:22:52Z</updated>
<entry>
<title>tty: remove use of __devinit</title>
<updated>2012-11-21T23:22:52Z</updated>
<author>
<name>Bill Pemberton</name>
<email>wfp5p@virginia.edu</email>
</author>
<published>2012-11-19T18:21:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9671f09921d93e722a28ae9610d478e092ac5466'/>
<id>urn:sha1:9671f09921d93e722a28ae9610d478e092ac5466</id>
<content type='text'>
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton &lt;wfp5p@virginia.edu&gt;
Cc: Jiri Slaby &lt;jirislaby@gmail.com&gt;
Cc: Alan Cox &lt;alan@linux.intel.com&gt;
Cc: Lucas Tavares &lt;lucaskt@linux.vnet.ibm.com&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Peter Korsgaard &lt;jacmet@sunsite.dk&gt;
Cc: Tony Prisk &lt;linux@prisktech.co.nz&gt;
Acked-by: Tobias Klauser &lt;tklauser@distanz.ch&gt;
Acked-by: Nicolas Ferre &lt;nicolas.ferre@atmel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: sh-sci: fix possible race cases on SCSCR register accesses</title>
<updated>2012-11-16T02:02:51Z</updated>
<author>
<name>Shinya Kuribayashi</name>
<email>shinya.kuribayashi.px@renesas.com</email>
</author>
<published>2012-11-16T01:54:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=33b48e1633f738c5ae78234c2dd5e3a9ba115437'/>
<id>urn:sha1:33b48e1633f738c5ae78234c2dd5e3a9ba115437</id>
<content type='text'>
In the previous commit, console write function (serial_console_write)
is changed to disable SCI interrupts while printing console strings.
This introduces possible race cases in the serial startup / shutdown
functions on SMP systems.

This patch fixes the sh-sci in the same way as commit 9ec1882df2
(tty: serial: imx: console write routing is unsafe on SMP, from
Xinyu Chen &lt;xinyu.chen@freescale.com&gt;, 2012-08-27) did.

There could be several consumers of the console,
* the kernel printk
* the init process using /dev/kmsg to call printk to show log
* shell, which opens /dev/console and writes with sys_write()

The shell goes into the normal UART open() and write() system calls,
while the other two go into the console operations.  The open() call
invokes serial startup function (sci_startup), which will write to
the SCSCR register (to enable or disable SCI interrupts) without any
locking.  This will conflict with the console serial function.

Add spinlock protections in sci_startup() and sci_shutdown() properly.

Signed-off-by: Shinya Kuribayashi &lt;shinya.kuribayashi.px@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: sh-sci: add locking to console write function to avoid SMP lockup</title>
<updated>2012-11-16T02:02:51Z</updated>
<author>
<name>Shinya Kuribayashi</name>
<email>shinya.kuribayashi.px@renesas.com</email>
</author>
<published>2012-11-16T01:54:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=40f70c03e33a1eed3f3fcd13418e76abad77d117'/>
<id>urn:sha1:40f70c03e33a1eed3f3fcd13418e76abad77d117</id>
<content type='text'>
Symptom:

When entering the suspend with Android logcat running, printk() call
gets stuck and never returns.  The issue can be observed at printk()s
on nonboot CPUs when going to offline with their interrupts disabled,
and never seen at boot CPU (core0 in our case).

Details:

serial_console_write() lacks of appropriate spinlock handling.

In SMP systems, as long as sci_transmit_chars() is being processed
at one CPU core, serial_console_write() can stuck at the other CPU
core(s), when it tries to access to the same serial port _without_
a proper locking.  serial_console_write() waits for the transmit FIFO
getting empty, while sci_transmit_chars() writes data to the FIFO.

In general, peripheral interrupts are routed to boot CPU (core0) by
Linux ARM standard affinity settings.  SCI(F) interrupts are handled
by core0, so sci_transmit_chars() is processed on core0 as well.

When logcat is running, it writes enormous log data to the kernel at
every moment, forever.  So core0 can repeatedly continue to process
sci_transmit_chars() in its interrupt handler, which eventually makes
the other CPU core(s) stuck at serial_console_write().

Looking at serial/8250.c, this is a known console write lockup issue
with SMP kernels.  Fix the sh-sci driver in the same way 8250.c does.

Signed-off-by: Shinya Kuribayashi &lt;shinya.kuribayashi.px@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: sh-sci: fix common SCIFB regmap definition</title>
<updated>2012-11-16T02:02:51Z</updated>
<author>
<name>Takashi Yoshii</name>
<email>takashi.yoshii.zj@renesas.com</email>
</author>
<published>2012-11-16T01:53:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c66d6d2a1a572768616ddca2c3863384b14d846'/>
<id>urn:sha1:8c66d6d2a1a572768616ddca2c3863384b14d846</id>
<content type='text'>
About FIFO count, there are two variants of SCIFs which show
a) TX count in upper, RX count in lower byte of FDR register
b) TX count in TFDR register, RX count in RFDR register

Common SCIFB regmap in current source code is defined as "a".
At least 7372 and 73a0 HW manual say their SICFB are "b".

This patch alters the definition to "b", considering the current
one has come from a mistake. The reason is as follows.

The flag SCIFB sh-sci driver means it has 256 byte FIFO.
The count is from 0(empty) to 256(full), that makes 9-bit.
Because FDR is 16-bit register, it can not hold two 9-bits.
That's why, SCIFB can not be "a".

Signed-off-by: Takashi Yoshii &lt;takashi.yoshii.zj@renesas.com&gt;
Signed-off-by: Shinya Kuribayashi &lt;shinya.kuribayashi.px@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: sh-sci: mask SCTFDR/RFDR according to fifosize</title>
<updated>2012-11-16T02:02:37Z</updated>
<author>
<name>Takashi Yoshii</name>
<email>takashi.yoshii.zj@renesas.com</email>
</author>
<published>2012-11-16T01:53:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=63f7ad115ef35b711f3ae2b46a07acbf1ca3bdfd'/>
<id>urn:sha1:63f7ad115ef35b711f3ae2b46a07acbf1ca3bdfd</id>
<content type='text'>
Current mask 0xff to SCTFDR/RFDR damages SCIFB, because the
registers on SCIFB have 9-bit data (0 to 256).

This patch changes the mask according to port-&gt;fifosize.
Though I'm not sure if the mask is really needed (I don't know if
there are variants which have non-zero upper bits), it is safer.

Signed-off-by: Takashi Yoshii &lt;takashi.yoshii.zj@renesas.com&gt;
Signed-off-by: Shinya Kuribayashi &lt;shinya.kuribayashi.px@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: sh-sci: support lower baud rate</title>
<updated>2012-11-16T02:02:37Z</updated>
<author>
<name>Takashi Yoshii</name>
<email>takashi.yoshii.zj@renesas.com</email>
</author>
<published>2012-11-16T01:52:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9d482cc353bd0391730730b26e4c2938dc90e477'/>
<id>urn:sha1:9d482cc353bd0391730730b26e4c2938dc90e477</id>
<content type='text'>
Support prescaler 1/16 and 1/64, in addition to current 1 and 1/4.

Supporting below 2400bps was dropped long time ago in mainline.
Since then, setting lower rate has been resulting in erroneous
register value, without indicating any errors through API.

This patch adds more prescaler to support lower rates again.
This still doesn't check range, but we won't hit the case because
even 50bps at 48MHz clock is now supported.

Signed-off-by: Takashi Yoshii &lt;takashi.yoshii.zj@renesas.com&gt;
Signed-off-by: Shinya Kuribayashi &lt;shinya.kuribayashi.px@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: sh-sci: fix condition test to set SCBRR</title>
<updated>2012-11-16T02:02:37Z</updated>
<author>
<name>Takashi Yoshii</name>
<email>takashi.yoshii.zj@renesas.com</email>
</author>
<published>2012-11-16T01:52:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4ffc3cdb642823ebee84538addac7cde1174e314'/>
<id>urn:sha1:4ffc3cdb642823ebee84538addac7cde1174e314</id>
<content type='text'>
SCBRR == 0 is valid value (divide by 1).

Signed-off-by: Takashi Yoshii &lt;takashi.yoshii.zj@renesas.com&gt;
Signed-off-by: Shinya Kuribayashi &lt;shinya.kuribayashi.px@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: sh-sci: console runtime PM support (revisit)</title>
<updated>2012-11-16T02:02:36Z</updated>
<author>
<name>Teppei Kamijou</name>
<email>teppei.kamijou.yb@renesas.com</email>
</author>
<published>2012-11-16T01:51:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0174e5ca82ba6bd62ab870e5781b72bd5397f1c3'/>
<id>urn:sha1:0174e5ca82ba6bd62ab870e5781b72bd5397f1c3</id>
<content type='text'>
The commit 1ba7622094 (serial: sh-sci: console Runtime PM support,
from Magnus Damm &lt;damm@opensource.se&gt;, 2011-08-03), tried to support
console runtime PM, but unfortunately it didn't work for us for some
reason.  We did not investigated further at that time, instead would
like to propose a different approach.

In Linux tty/serial world, to get console PM work properly, a serial
client driver does not have to maintain .runtime_suspend()/..resume()
calls itself, but can leave console power power management handling to
the serial core driver.

This patch moves the sh-sci driver in that direction.

Notes:

* There is room to optimize console runtime PM more aggressively by
  maintaining additional local runtime PM calls, but as a first step
  having .pm() operation would suffice.

* We still have a couple of direct calls to sci_port_enable/..disable
  left in the driver.  We have to live with them, because they're out
  of serial core's help.

Signed-off-by: Teppei Kamijou &lt;teppei.kamijou.yb@renesas.com&gt;
Signed-off-by: Shinya Kuribayashi &lt;shinya.kuribayashi.px@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Partially revert "serial: sh-sci: console Runtime PM support"</title>
<updated>2012-11-16T02:02:36Z</updated>
<author>
<name>Shinya Kuribayashi</name>
<email>shinya.kuribayashi.px@renesas.com</email>
</author>
<published>2012-11-16T01:51:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=00cadbfd1e73fb9951da7d2358c39b561c017ea3'/>
<id>urn:sha1:00cadbfd1e73fb9951da7d2358c39b561c017ea3</id>
<content type='text'>
This partially reverts commit 1ba7622094 (serial: sh-sci: console
Runtime PM support, from Magnus Damm &lt;damm@opensource.se&gt;, 2011-08-03).

The generic 'serial_core' can take care of console PM maintenance,
so all (or at least the first thing) we have to do to get console PM
work properly, is to implement uart_ops -&gt;pm() operation in the sh-sci
serial client driver.

This patch partially reverts the commit above, but leaving sci_reset()
change in place, because sci_reset() is already part of another commit
(73c3d53f38 serial: sh-sci: Avoid FIFO clear for MCE toggle.).

A revised version of console PM support follows next.

Signed-off-by: Shinya Kuribayashi &lt;shinya.kuribayashi.px@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "sh-sci / PM: Use power.irq_safe"</title>
<updated>2012-11-16T02:02:04Z</updated>
<author>
<name>Shinya Kuribayashi</name>
<email>shinya.kuribayashi.px@renesas.com</email>
</author>
<published>2012-11-16T01:51:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8807ec6c707802cabadc0fe1b035ffefa27f1719'/>
<id>urn:sha1:8807ec6c707802cabadc0fe1b035ffefa27f1719</id>
<content type='text'>
This reverts commit 5a50a01bf0 (sh-sci / PM: Use power.irq_safe, from
Rafael J. Wysocki &lt;rjw@sisk.pl&gt;, 2011-08-24).

In order to get console PM work properly, we should implement uart_ops
-&gt;pm() operation, rather than sprinkle band-ading runtime PM calls in
the driver.

Signed-off-by: Shinya Kuribayashi &lt;shinya.kuribayashi.px@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
