History log of /linux-master/drivers/tty/serial/mpc52xx_uart.c
Revision Date Author Comments
# 4cf1dabe 10-Nov-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

serial: mpc52xx: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231110152927.70601-26-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f82723d0 14-Sep-2023 Thomas Gleixner <tglx@linutronix.de>

serial: mpc52xx: Use port lock wrappers

When a serial port is used for kernel console output, then all
modifications to the UART registers which are done from other contexts,
e.g. getty, termios, are interference points for the kernel console.

So far this has been ignored and the printk output is based on the
principle of hope. The rework of the console infrastructure which aims to
support threaded and atomic consoles, requires to mark sections which
modify the UART registers as unsafe. This allows the atomic write function
to make informed decisions and eventually to restore operational state. It
also allows to prevent the regular UART code from modifying UART registers
while printk output is in progress.

All modifications of UART registers are guarded by the UART port lock,
which provides an obvious synchronization point with the console
infrastructure.

To avoid adding this functionality to all UART drivers, wrap the
spin_[un]lock*() invocations for uart_port::lock into helper functions
which just contain the spin_[un]lock*() invocations for now. In a
subsequent step these helpers will gain the console synchronization
mechanisms.

Converted with coccinelle. No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Link: https://lore.kernel.org/r/20230914183831.587273-40-john.ogness@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 29e5c442 24-Jul-2023 Rob Herring <robh@kernel.org>

tty: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> # for imx
Link: https://lore.kernel.org/r/20230724205440.767071-1-robh@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2d141e68 03-Oct-2022 Jiri Slaby (SUSE) <jirislaby@kernel.org>

tty: serial: use uart_port_tx() helper

uart_port_tx() is a new helper to send characters to the device. Use it
in these drivers.

Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: Richard Genoud <richard.genoud@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20221004104927.14361-3-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8ca01f8f 19-Sep-2022 Jiri Slaby <jirislaby@kernel.org>

tty: serial: switch mpc52xx_uart_int_{r,t}x_chars() to bool

mpc52xx_uart_int_rx_chars() returns unsigned int.
mpc52xx_uart_int_tx_chars() returns int.

The both results are binary ORed to the "keepgoing" variable. Unify all
three to bool as the only interesting value is whether we should keep
looping (true/false).

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220920052049.20507-7-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bec5b814 16-Aug-2022 Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

serial: Make ->set_termios() old ktermios const

There should be no reason to adjust old ktermios which is going to get
discarded anyway.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220816115739.10928-7-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# de06fba6 07-May-2022 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

powerpc/mpc5xxx: Switch mpc5xxx_get_bus_frequency() to use fwnode

Switch mpc5xxx_get_bus_frequency() to use fwnode in order to help
cleaning up other parts of the kernel from OF specific code.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Chris Packham <chris.packham@alliedtelesis.co.nz> # for i2c-mpc
Acked-by: Wolfram Sang <wsa@kernel.org> # for the I2C part
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> # for mscan/mpc5xxx_can
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220507100147.5802-2-andriy.shevchenko@linux.intel.com


# 570f749f 01-Apr-2022 Christophe Leroy <christophe.leroy@csgroup.eu>

tty: serial: Prepare cleanup of powerpc's asm/prom.h

powerpc's asm/prom.h brings some headers that it doesn't
need itself.

In order to clean it up, first add missing headers in
users of asm/prom.h

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/49fc0d4b6446da630b1e9f29c4bab38f8ed087bf.1648833419.git.christophe.leroy@csgroup.eu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 83ead219 10-Apr-2022 Jiri Slaby <jirislaby@kernel.org>

tty: serial: mpc52xx_uart: remove double ifdeffery

The code now contains:
#ifdef CONFIG_PPC_MPC512x
...
#endif

#ifdef CONFIG_PPC_MPC512x
...
#endif

So remove the endif+ifdef from the middle, provided it's about the same
define.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220411104506.8990-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dbf3f093 03-Apr-2022 Jiri Slaby <jirislaby@kernel.org>

tty: serial: mpc52xx_uart: make rx/tx hooks return unsigned, part II.

The below commit changed types of some hooks in struct psc_ops. It also
changed the types of the functions which are referenced in the instances
of the above struct.

However the commit did so only for CONFIG_PPC_MPC52xx, but not for
CONFIG_PPC_MPC512x. This results in build errors like:
mpc52xx_uart.c:static unsigned int mpc52xx_psc_raw_tx_rdy(struct uart_port *port)
mpc52xx_uart.c:static int mpc512x_psc_raw_tx_rdy(struct uart_port *port)
^^^
mpc52xx_uart.c:static int mpc5125_psc_raw_tx_rdy(struct uart_port *port)
^^^

Therefore, fix the latter case now too.

Fixes: 18662a1d8f35 (tty: serial: mpc52xx_uart: make rx/tx hooks return unsigned)
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220404055122.31194-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 18662a1d 23-Feb-2022 Jiri Slaby <jirislaby@kernel.org>

tty: serial: mpc52xx_uart: make rx/tx hooks return unsigned

All these return bitmasks, so it makes more sense to return unsigned --
this is what a reader and also all the callers expect.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220224111028.20917-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6e560913 21-Apr-2021 Johan Hovold <johan@kernel.org>

serial: mpc52xx_uart: drop low-latency workaround

Commit fbe543b412ce ("Fix a potential issue in mpc52xx uart driver")
worked around the infamous low_latency behaviour of
tty_flip_buffer_push() by simply dropping and reacquiring the port lock
in the interrupt handler.

Since commit a9c3f68f3cd8 ("tty: Fix low_latency BUG"),
tty_flip_buffer_push() always schedules a work item to push data to the
line discipline and there's no need to keep any low_latency hacks around.

Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210421095509.3024-16-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7cbfd6a0 12-Dec-2019 Dmitry Safonov <0x7f454c46@gmail.com>

tty/serial: mpc52xx_uart: Don't zero port->sysrq

uart_handle_sysrq_char() already does it.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Link: https://lore.kernel.org/r/20191213000657.931618-25-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ba4508db 12-Dec-2019 Dmitry Safonov <0x7f454c46@gmail.com>

tty/serial: Migrate mpc52xx_uart to use has_sysrq

The SUPPORT_SYSRQ ifdeffery is not nice as:
- May create misunderstanding about sizeof(struct uart_port) between
different objects
- Prevents moving functions from serial_core.h
- Reduces readability (well, it's ifdeffery - it's hard to follow)

In order to remove SUPPORT_SYSRQ, has_sysrq variable has been added.
Initialise it in driver's probe and remove ifdeffery.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Link: https://lore.kernel.org/r/20191213000657.931618-24-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4793f2eb 06-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

tty: serial: Remove redundant license text

Now that the SPDX tag is in all tty files, that identifies the license
in a specific and legally-defined manner. So the extra GPL text wording
can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Jiri Slaby <jslaby@suse.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Richard Genoud <richard.genoud@gmail.com>
Cc: Alexander Shiyan <shc_work@mail.ru>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Pat Gefre <pfg@sgi.com>
Cc: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Sylvain Lemieux <slemieux.tyco@gmail.com>
Cc: Carlo Caione <carlo@caione.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Andy Gross <andy.gross@linaro.org>
Cc: David Brown <david.brown@linaro.org>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Peter Korsgaard <jacmet@sunsite.dk>
Cc: Timur Tabi <timur@tabi.org>
Cc: Tony Prisk <linux@prisktech.co.nz>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e3b3d0f5 06-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

tty: add SPDX identifiers to all remaining files in drivers/tty/

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/tty files files with the correct SPDX license
identifier based on the license text in the file itself. The SPDX
identifier is a legally binding shorthand, which can be used instead of
the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Jiri Slaby <jslaby@suse.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: David Sterba <dsterba@suse.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Richard Genoud <richard.genoud@gmail.com>
Cc: Alexander Shiyan <shc_work@mail.ru>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: "Uwe Kleine-König" <kernel@pengutronix.de>
Cc: Pat Gefre <pfg@sgi.com>
Cc: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Sylvain Lemieux <slemieux.tyco@gmail.com>
Cc: Carlo Caione <carlo@caione.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Andy Gross <andy.gross@linaro.org>
Cc: David Brown <david.brown@linaro.org>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Peter Korsgaard <jacmet@sunsite.dk>
Cc: Timur Tabi <timur@tabi.org>
Cc: Tony Prisk <linux@prisktech.co.nz>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Jiri Slaby <jslaby@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6f137a75 13-Aug-2017 Julia Lawall <Julia.Lawall@lip6.fr>

serial: mpc52xx: constify uart_ops structures

These uart_ops structures are only stored in the ops field of a
uart_port structure and this fields is const, so the uart_ops
structures can also be const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a73ee843 18-Jul-2017 Rob Herring <robh@kernel.org>

tty: Convert to using %pOF instead of full_name

Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-serial@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cc74bd1d 14-Dec-2015 Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>

tty: serial: constify psc_ops structs

Constifies psc_ops structures in tty's serial
port driver since they are not modified after
their initialization.

Detected and found using Coccinelle.

Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e4b4e317 24-Sep-2015 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

serial: mpc52xx: add delay after resetting transmitter to fix broken chars

This fixes receiving broken characters on the console from an MPC5125
system when systemd comes up which repeatedly opens and shuts down the
console device.

Trial and error with the needed interval showed that 500 us are good
enough most of the time when using 38400 Bd, so I think 1 ms is a good
compromise between fixing the issue and not penalize faster setups too
much.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7d07ada0 27-Jul-2015 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

serial: mpc52xx: let tx_empty callback return either 0 or TIOCSER_TEMT

Documenation/serial/driver requests that the tx_empty callback should
return 0 if there are still chars in the fifo or shifter or TIOCSER_TEMT
(0x01) if no character is pending to be sent.

Fix the mpc52xx serial driver to not return MPC52xx_PSC_SR_TXEMP (i.e.
0x0800) but TIOCSER_TEMT as documented.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5b84c967 12-Apr-2015 Valentin Rothberg <valentinrothberg@gmail.com>

drivers/tty/serial/mpc52xx_uart.c: fix typo in C comment

Fix reference on PPC_MPC52xx in C comment after #endif.

Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ed0bb232 16-Mar-2015 Fabian Frederick <fabf@skynet.be>

tty: constify of_device_id array

of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Acked-by: Peter Korsgaard <peter@korsgaard.com>
Acked-by: Timur Tabi <timur@tabi.org>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9144b3cd 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

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>


# 16f404e3 02-Sep-2014 Peter Hurley <peter@hurleysoftware.com>

serial: mpc52xx: Use default serial core x_char handler

mpc52xx_uart_send_xchar() is _identical_ to the default serial core
x_char handling behavior in uart_send_xchar().

Remove mpc52xx_uart_send_xchar().

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cb1ea812 30-Nov-2013 Gerhard Sittig <gsi@denx.de>

serial: mpc512x: setup the PSC FIFO clock as well

prepare and enable the FIFO clock upon PSC FIFO initialization,
check for and propagage errors when enabling the PSC FIFO clock,
disable and unprepare the FIFO clock upon PSC FIFO uninitialization

devm_{get,put}_clk() doesn't apply here, as the SoC provides a
single FIFO component which is shared among several PSC components,
thus the FIFO isn't associated with a device (while the PSCs are)

provide a fallback clock lookup approach in case the OF based clock
lookup for the PSC FIFO fails, this allows for successful operation in
the presence of an outdated device tree which lacks clock specs

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: linux-serial@vger.kernel.org
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Gerhard Sittig <gsi@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>


# e149b42b 30-Nov-2013 Gerhard Sittig <gsi@denx.de>

serial: mpc512x: adjust for OF based clock lookup

after device tree based clock lookup became available, the peripheral
driver need no longer construct clock names which include the PSC index,
remove the "psc%d_mclk" template and unconditionally use 'mclk'

acquire and release the "ipg" clock item for register access as well

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: linux-serial@vger.kernel.org
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Gerhard Sittig <gsi@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>


# c38c4454 15-Oct-2013 Linus Walleij <linus.walleij@linaro.org>

serial: mpc52xx: remove reference to .set_wake()

This callback is gone and not coming back, so will not be
supported later.

Cc: Gerhard Sittig <gsi@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4190390a 08-Sep-2013 Jingoo Han <jg1.han@samsung.com>

serial: mpc512x: Remove casting the return value which is a void pointer

Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2d30ccac 06-Aug-2013 Gerhard Sittig <gsi@denx.de>

serial: mpc512x: cleanup clock API use

cleanup the clock API use of the UART driver which is shared among the
MPC512x and the MPC5200 platforms
- get, prepare, and enable the MCLK during port allocation; disable,
unprepare and put the MCLK upon port release; hold a reference to the
clock over the period of use; check for and propagate enable errors
- fix a buffer overflow for clock names with two digit PSC index numbers
- stick with the PPC_CLOCK 'psc%d_mclk' name for clock lookup, only
switch to a fixed string later after device tree based clock lookup
will have become available

to achieve support for MPC512x which is neutral to MPC5200, the
modification was done as follows
- introduce "clock alloc" and "clock release" routines in addition to
the previous "clock enable/disable" routine in the psc_ops struct
- make the clock allocation a part of the port request (resource
allocation), and make clock release a part of the port release, such
that essential resources get allocated early
- just enable/disable the clock from within the .clock() callback
without any allocation or preparation as the former implementation
did, since this routine is called from within the startup and shutdown
callbacks
- all of the above remains a NOP for the MPC5200 platform (no callbacks
are provided on that platform)
- implementation note: the clock gets enabled upon allocation already
just in case the clock is not only required for bitrate generation but
for register access as well

Signed-off-by: Gerhard Sittig <gsi@denx.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>


# 8a29dfb8 12-Jun-2013 Matteo Facchinetti <matteo.facchinetti@sirius-es.it>

serial/mpc52xx_uart: fix kernel panic when system reboot

This bug appear when a second PSC based driver appends an interrupt
routine to the FIFO controller shared interrupt (like spi-mpc512x-psc).
When reboot, uart_shutdown() remove the serial console interrupt handler
while spi-mpc512x-psc isr is still activate and cause the following kernel
panic:

The system is going down for reboot NOW!rpc (ttyPSC0) (Mon Jun 10 12:26:07 20
INIT: Sending processirq 40: nobody cared (try booting with the "irqpoll" option)
CPU: 0 PID: 0 Comm: swapper Not tainted 3.10.0-rc4-next-20130607-00001-ga0bceb3-dirty #5
Call Trace:
[cfff9f00] [c0007910] show_stack+0x48/0x150 (unreliable)
[cfff9f40] [c005ae60] __report_bad_irq.isra.6+0x34/0xe0
[cfff9f60] [c005b194] note_interrupt+0x214/0x26c
[cfff9f90] [c00590fc] handle_irq_event_percpu+0xd0/0x1bc
[cfff9fd0] [c005921c] handle_irq_event+0x34/0x54
[cfff9fe0] [c005b8f4] handle_level_irq+0x90/0xf4
[cfff9ff0] [c000cb98] call_handle_irq+0x18/0x28
[c050dd60] [c000575c] do_IRQ+0xcc/0x124
[c050dd90] [c000eb04] ret_from_except+0x0/0x14

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1f48c499 24-May-2013 Matteo Facchinetti <matteo.facchinetti@sirius-es.it>

serial/mpc52xx_uart: add MPC5125 PSC support

Add MPC5125 PSC register layout structure, MPC5125 specific
psc_ops function set and the compatible string.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Signed-off-by: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2574b27e 24-May-2013 Matteo Facchinetti <matteo.facchinetti@sirius-es.it>

serial/mpc52xx_uart: prepare for adding MPC5125 PSC UART support

MPC5125 PSC controller has different register layout than MPC5121.
To support MPC5125 PSC in this driver we have to provide further
psc_ops functions for SoC specific register accesses.

Add new register access functions to the psc_ops structure and
provide MPC52xx and MPC512x specific implementation for them.
Then replace remaining direct register accesses in the driver by
appropriate psc_ops function calls. The subsequent patch can now
add MPC5125 specific set of psc_ops functions.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Signed-off-by: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 696faedd 23-May-2013 Jingoo Han <jg1.han@samsung.com>

serial: use platform_{get,set}_drvdata()

Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.

Also, unnecessary dev_set_drvdata() is removed, because the driver core
clears the driver data to NULL after device_release or on probe failure.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9bcc3278 25-Apr-2013 Wei Yongjun <yongjun_wei@trendmicro.com.cn>

tty: serial: mpc5xxx: fix error handing in mpc52xx_uart_init()

Add the missing uart_unregister_driver() and uninit before return
from mpc52xx_uart_init() in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cf0ebee0 15-May-2013 Sourav Poddar <sourav.poddar@ti.com>

serial: Move "uart_console" def to core header file.

Move "uart_console" definition to serial core header file, so that it can be
used by serial drivers.
Get rid of the uart_console defintion from mpc52xx_uart driver.

Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Rajendra nayak <rnayak@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Reviewed-by: Kevin Hilman <khilman@linaro.org>
Tested-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 09081e5b 08-Mar-2013 Anatolij Gustschin <agust@denx.de>

tty: serial: mpc5xxx: fix PSC clock name bug

mpc512x platform clock code names PSC clocks as "pscX_mclk" but
the driver tries to get "pscX_clk" clock and this results in
errors like:

mpc52xx-psc-uart 80011700.psc: Failed to get PSC clock entry!

The problem appears when opening ttyPSC devices other than the
system's serial console. Since getting and enabling the PSC clock
fails, uart port startup doesn't succeed and tty flag TTY_IO_ERROR
remains set causing further errors in tty ioctls, i.e.
'strace stty -F /dev/ttyPSC1' shows:

open("/dev/ttyPSC1", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 3
dup2(3, 0) = 0
close(3) = 0
fcntl64(0, F_GETFL) = 0x10800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE)
fcntl64(0, F_SETFL, O_RDONLY|O_LARGEFILE) = 0
ioctl(0, TCGETS, 0xbff89038) = -1 EIO (Input/output error)

Only request PSC clock names that the platform actually provides.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2e124b4a 03-Jan-2013 Jiri Slaby <jirislaby@kernel.org>

TTY: switch tty_flip_buffer_push

Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty in many
call sites. Only tty_port will needed and hence no more
tty_port_tty_get in those paths.

Now, the one where most of tty_port_tty_get gets removed:
tty_flip_buffer_push.

IOW we also closed all the races in drivers not using tty_port_tty_get
at all yet.

Also we move tty_flip_buffer_push declaration from include/linux/tty.h
to include/linux/tty_flip.h to all others while we are changing it
anyway.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 92a19f9c 03-Jan-2013 Jiri Slaby <jirislaby@kernel.org>

TTY: switch tty_insert_flip_char

Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty in many
call sites. Only tty_port will needed and hence no more
tty_port_tty_get in those paths.

tty_insert_flip_char is the next one to proceed. This one is used all
over the code, so the patch is huge.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9671f099 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

tty: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Lucas Tavares <lucaskt@linux.vnet.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Peter Korsgaard <jacmet@sunsite.dk>
Cc: Tony Prisk <linux@prisktech.co.nz>
Acked-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 76d28e44 21-May-2012 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

serial/mpc52xx_uart: add a const qualifier

This prepares *of_device_id.data becoming const. Without this change
the following warning would occur:

drivers/tty/serial/mpc52xx_uart.c: In function 'mpc52xx_uart_of_enumerate':
drivers/tty/serial/mpc52xx_uart.c:1440:11: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>


# d3dec96e 27-Aug-2012 Wolfram Sang <wsa@kernel.org>

tty: serial: mpc5xxx: add support for mark/space parity

Tested on a custom MPC5200B-board using some fancy industrial protocol.
Verified that MPC512x has identical bits, so should work there as well.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e0955ace 05-Mar-2012 Frank Benkert <frank.benkert@avat.de>

mpc5200b/uart: select more tolerant uart prescaler on low baudrates

In addition to the /32 prescaler, the MPC5200B supports a second
baudrate prescaler /4 to reach higher baudrates.

The current calculation (introduced with commit 0d1f22e4) in the kernel
preferes this low prescaler as often as possible, but with some
imprecise counterparts the communication on low baudrates fails.

According a support-mail from freescale the low prescaler (/4) allows
just 1% tolerance in bittiming in contrast to 4% of the high prescaler
(/32). The prescaler not only affects the baudrate-calculation, but
also the sampling of the bits on the wire.

With this patch, we use the slightly less precise, but higher tolerant
prescaler calculation on low baudrates up to (and including) 115200 baud
and the more precise calculation above.

Tested on a custom MPC5200B board with "fsl,mpc5200b-psc-uart".

Calculation Examples with prescaler (PS) 4 and 32 and divisor (DIV) on
various baudrates. Real stands for the real baudrate generated and Diff
for the differences between:
50 Baud PS 32 DIV 0xa122 Real 50 Diff 0.00%
75 Baud PS 32 DIV 0x6b6c Real 75 Diff 0.00%
110 Baud PS 32 DIV 0x493e Real 110 Diff 0.00%
134 Baud PS 32 DIV 0x3c20 Real 133 Diff 0.75%
150 Baud PS 32 DIV 0x35b6 Real 150 Diff 0.00%
200 Baud PS 32 DIV 0x2849 Real 199 Diff 0.50%
300 Baud PS 4 DIV 0xd6d8 Real 300 Diff 0.00%
PS 32 DIV 0x1adb Real 300 Diff 0.00%
600 Baud PS 4 DIV 0x6b6c Real 600 Diff 0.00%
PS 32 DIV 0x0d6e Real 599 Diff 0.17%
1200 Baud PS 4 DIV 0x35b6 Real 1200 Diff 0.00%
PS 32 DIV 0x06b7 Real 1199 Diff 0.08%
1800 Baud PS 4 DIV 0x23cf Real 1799 Diff 0.06%
PS 32 DIV 0x047a Real 1799 Diff 0.06%
2400 Baud PS 4 DIV 0x1adb Real 2400 Diff 0.00%
PS 32 DIV 0x035b Real 2401 Diff - 0.04%
4800 Baud PS 4 DIV 0x0d6e Real 4799 Diff 0.02%
PS 32 DIV 0x01ae Real 4796 Diff 0.08%
9600 Baud PS 4 DIV 0x06b7 Real 9598 Diff 0.02%
PS 32 DIV 0x00d7 Real 9593 Diff 0.07%
19200 Baud PS 4 DIV 0x035b Real 19208 Diff - 0.04%
PS 32 DIV 0x006b Real 19275 Diff - 0.39%
38400 Baud PS 4 DIV 0x01ae Real 38372 Diff 0.07%
PS 32 DIV 0x0036 Real 38194 Diff 0.54%
57600 Baud PS 4 DIV 0x011e Real 57692 Diff - 0.16%
PS 32 DIV 0x0024 Real 57291 Diff 0.54%
76800 Baud PS 4 DIV 0x00d7 Real 76744 Diff 0.07%
PS 32 DIV 0x001b Real 76388 Diff 0.54%
115200 Baud PS 4 DIV 0x008f Real 115384 Diff - 0.16%
PS 32 DIV 0x0012 Real 114583 Diff 0.54%
153600 Baud PS 4 DIV 0x006b Real 154205 Diff - 0.39%
PS 32 DIV 0x000d Real 158653 Diff - 3.29%
230400 Baud PS 4 DIV 0x0048 Real 229166 Diff 0.54%
PS 32 DIV 0x0009 Real 229166 Diff 0.54%
307200 Baud PS 4 DIV 0x0036 Real 305555 Diff 0.54%
PS 32 DIV 0x0007 Real 294642 Diff 4.09%
460800 Baud PS 4 DIV 0x0024 Real 458333 Diff 0.54%
PS 32 DIV 0x0005 Real 412500 Diff 10.48%
500000 Baud PS 4 DIV 0x0021 Real 500000 Diff 0.00%
PS 32 DIV 0x0004 Real 515625 Diff - 3.13%
576000 Baud PS 4 DIV 0x001d Real 568965 Diff 1.22%
PS 32 DIV 0x0004 Real 515625 Diff 10.48%
614400 Baud PS 4 DIV 0x001b Real 611111 Diff 0.54%
PS 32 DIV 0x0003 Real 687500 Diff -11.90%
921600 Baud PS 4 DIV 0x0012 Real 916666 Diff 0.54%
PS 32 DIV 0x0002 Real 1031250 Diff -11.90%
1000000 Baud PS 4 DIV 0x0011 Real 970588 Diff 2.94%
PS 32 DIV 0x0002 Real 1031250 Diff - 3.13%
1152000 Baud PS 4 DIV 0x000e Real 1178571 Diff - 2.31%
PS 32 DIV 0x0002 Real 1031250 Diff 10.48%
1500000 Baud PS 4 DIV 0x000b Real 1500000 Diff 0.00%
PS 32 DIV 0x0001 Real 2062500 Diff -37.50%
2000000 Baud PS 4 DIV 0x0008 Real 2062500 Diff - 3.13%
PS 32 DIV 0x0001 Real 2062500 Diff - 3.13%
2500000 Baud PS 4 DIV 0x0007 Real 2357142 Diff 5.71%
PS 32 DIV 0x0001 Real 2062500 Diff 17.50%
3000000 Baud PS 4 DIV 0x0006 Real 2750000 Diff 8.33%
PS 32 DIV 0x0001 Real 2062500 Diff 31.25%
3500000 Baud PS 4 DIV 0x0005 Real 3300000 Diff 5.71%
PS 32 DIV 0x0001 Real 2062500 Diff 41.07%
4000000 Baud PS 4 DIV 0x0004 Real 4125000 Diff - 3.13%
PS 32 DIV 0x0001 Real 2062500 Diff 48.44%

Signed-off-by: Frank Benkert <frank.benkert@avat.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d4e33fac 26-Jan-2012 Alan Cox <alan@linux.intel.com>

serial: Kill off NO_IRQ

We transform the offenders into a test of irq <= 0 which will be ok while
the ARM people get their platform sorted. Once that is done (or in a while
if they don't do it anyway) then we will change them all to !irq checks.

For arch specific drivers that are already using NO_IRQ = 0 we just test
against zero so we don't need to re-review them later.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 9cfb5c05 22-Sep-2011 Yong Zhang <yong.zhang0@gmail.com>

TTY: irq: Remove IRQF_DISABLED

Since commit [e58aa3d2: genirq: Run irq handlers with interrupts disabled],
We run all interrupt handlers with interrupts disabled
and we even check and yell when an interrupt handler
returns with interrupts enabled (see commit [b738a50a:
genirq: Warn when handler enables interrupts]).

So now this flag is a NOOP and can be removed.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Acked-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# ee160a38 01-Sep-2011 Jiri Slaby <jirislaby@kernel.org>

TTY: serial, fix includes in some drivers

linux/tty_flip.h is included in linux/serial_core.h. But this may (and
will) change in the future. Then we would get build errors such as:
.../tty/serial/max3107.c: In function ‘put_data_to_circ_buf’:
.../tty/serial/max3107.c:149:2: error: implicit declaration of function ‘tty_insert_flip_string’

So fix all the drviers which call tty flip buffer helpers to really
include linux/tty_flip.h. And also make sure that those include
linux/tty.h when operating with struct tty_struct.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 793218df 22-Feb-2011 Grant Likely <grant.likely@secretlab.ca>

dt/serial: Eliminate users of of_platform_{,un}register_driver

Get rid of users of of_platform_driver in drivers/serial. The
of_platform_{,un}register_driver functions are going away, so the
users need to be converted to using the platform_bus_type directly.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>


# ab4382d2 13-Jan-2011 Greg Kroah-Hartman <gregkh@suse.de>

tty: move drivers/serial/ to drivers/tty/serial/

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>