aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/meson_uart.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-01-18tty: serial: meson: if no alias specified use an available idLoys Ollivier1-1/+12
At probe, the uart driver tries to get an id from a device tree alias. When no alias was specified, the driver would return an error and probing would fail. Providing an alias for registering a serial device should not be mandatory. If the device tree does not specify an alias, provide an id from a reserved range so that the probing can continue. Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Loys Ollivier <lollivier@baylibre.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28tty: serial: meson: fix typo in the "stop bit" register definitionMartin Blumenstingl1-6/+6
This simply fixes a typo in the preprocessor macros. No functional changes intended. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28tty: serial: meson: merge the two register sections for AML_UART_CONTROLMartin Blumenstingl1-9/+7
In the code there are two separate sections which each describe some of the bits in the AML_UART_CONTROL register. Merge these into one section to make the code easier to read. No functional changes intended. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28tty: serial: meson: remove duplicate "clear error" bit definitionMartin Blumenstingl1-5/+4
The "clear error" bit in the AML_UART_CONTROL register is defined twice. Remove the AML_UART_CLR_ERR definition and replace it with AML_UART_CLEAR_ERR. AML_UART_CLEAR_ERR was chosen to be kept since the datasheet's description for this bit is "Clear Error" (so developer's don't have to translate this to "CLR_ERR"). No functional changes intended. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: serial: meson: allow baud-rates lower than 9600Thomas Rohloff1-1/+1
Devices like DCF77 receivers need the baud-rate to be as low as 50. I have tested this on a Meson GXL device with uart_A. Cc: Jiri Slaby <jslaby@suse.com> Cc: Carlo Caione <carlo@caione.org> Cc: Kevin Hilman <khilman@baylibre.com> Cc: linux-amlogic@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Thomas Rohloff <v10lator@myway.de> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: serial: Remove redundant license textGreg Kroah-Hartman1-10/+0
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>
2017-11-08tty: add SPDX identifiers to all remaining files in drivers/tty/Greg Kroah-Hartman1-0/+1
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>
2017-09-18serial: meson: add Magic SysRq supportYixun Lan1-2/+16
This dirver try to implement the Magic SysRq support[1] for Amlogic Inc's meson platfo >From the hardware perspective, the UART IP can't detect the 'BREAK' command clearly via the status register. Instead, we rely on the combination of 'FRAME_ERR bit && ch == 0', and it works fine. [1] Documentation/admin-guide/sysrq.rst Signed-off-by: Yixun Lan <dlan@gentoo.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: meson: constify uart_ops structuresJulia Lawall1-1/+1
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>
2017-06-20tty/serial: meson_uart: update to stable bindingsHelmut Klein1-6/+84
This patch handle the stable UART bindings but also keeps compatibility with the legacy non-stable bindings until all boards uses them. Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Helmut Klein <hgkr.klein@gmail.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-24serial: meson: hide an unused functionArnd Bergmann1-9/+8
The newly added meson_uart_enable_tx_engine function is only called from the console setup, not the runtime uart, which has an open-coded version of the same register access. This produces a harmless warning when the console code is disabled: drivers/tty/serial/meson_uart.c:127:13: error: 'meson_uart_enable_tx_engine' defined but not used [-Werror=unused-function] Let's move the function inside of the #ifdef to avoid the warning. Fixes: ba50f1df13c8 ("serial: meson: remove unneeded variable assignment in meson_serial_port_write") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: meson: change interrupt description to tty nameHeiner Kallweit1-1/+1
Change interrupt description from driver name to tty name (e.g. ttyAML0). If multiple serial ports are enabled this allows to determine which interrupt belongs to which port in /proc/interrupts. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: meson: remove use of flag UPF_IOREMAPHeiner Kallweit1-14/+8
Flag UPF_IOREMAP is used by the 8250 subsystem only, it's not used by the serial core. Therefore I don't see any benefit in using it here. In addition fix the order of calls in meson_uart_release_port. Unmapping needs to be done first, reversing call order in meson_uart_request_port. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: meson: make use of uart_port member mapsizeHeiner Kallweit1-24/+5
Member mapsize of struct uart_port is meant to store the resource size. By using it we can get rid of meson_uart_res_size(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: meson: remove dead code in meson_uart_change_speedHeiner Kallweit1-2/+0
val is set in both branches of the if clause, therefore the two removed lines are dead code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: meson: remove unneeded variable assignment in meson_serial_port_writeHeiner Kallweit1-1/+12
There's no need to set AML_UART_TX_EN in each call to meson_serial_port_write. In addition to meson_uart_startup set this flag in meson_serial_console_setup and meson_serial_early_console_setup. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: meson: fix setting number of stop bitsHeiner Kallweit1-1/+1
The stop bit value as to be or'ed, so far this worked only just by chance because AML_UART_STOP_BIN_1SB is 0. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19tty: serial: meson: allow baud-rates higher than 115200Martin Blumenstingl1-1/+1
The vendor driver allows setting baud-rates higher than 115200 baud. There is a check in the vendor driver which prevents using more than 115200 baud during startup, however it does not have such a check in .set_termios. Higher baud-rates are often used by the bluetooth modules embedded into the SDIO wifi chips (Amlogic devices use brcmfmac based wifi chips quite often, 2000000 baud seems to be a common value for the UART baud-rate in Amlogic's "libbt"). I have tested this on a Meson GXL device with uart_A (to which the bluetooth module is connected, where initialization times out with 115200 baud) and uart_AO (which I manually set to 2000000 baud and then connected with my USB UART adapter to that). Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Acked-by: Kevin Hilman <khilman@baylibre.com> Tested-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30tty: serial: meson: Implement earlycon supportAndreas Färber1-7/+35
Split off the bulk of the existing meson_serial_console_write() implementation into meson_serial_port_write() for implementing meson_serial_early_console_write(). Use "meson" as the earlycon driver name, courtesy of Nicolas. Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com> Acked-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14tty: serial: meson: Add support for XTAL clock inputAndreas Färber1-1/+7
Fix the baudrate calculation for 24 MHz XTAL clock found on gxbb platforms. Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13ARM: meson: serial: check for tx-irq enabled in irq codeBen Dooks1-2/+4
Ensure that if the interrupt handler is entered then only try and do tx work if the tx irq is enabled. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13ARM: meson: serial: ensure tx irq on if more work to doBen Dooks1-0/+7
The tx_stop() call turns the interrupt off, but the tx_start() does not check if the interrupt is enabled. Switch it back on if there is more work to do. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13ARM: meson: serial: disable rx/tx irqs during console writeBen Dooks1-2/+5
As an attempt to stop issues with bad console output, ensure that both the rx and tx interrupts are disabled during the console write to avoid any problems with console and non-console being called together. This should help with the SMP case as it should stop other cores being signalled during the console write. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13ARM: meson: serial: use meson_uart_tx_empty() to wait for emptyBen Dooks1-1/+1
Use the meson_uart_tx_empty() instead of a direct read of the status register. This is easier to read and will ensure the UART's transmit state machine is idle when trying to update the baud rate. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13ARM: meson: serial: only disable tx irq on stopBen Dooks1-2/+2
Since disabling the transmit state machine still allows characters to be transmitted when written to the UART write FIFO, simply disable the transmit interrupt when the UART port is stopped. This has not shown an improvement with the console issues when running systemd, but seems like it should be done. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reported-by: Edward Cragg <ed.cragg@codethink.co.uk> Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13ARM: meson: serial: ensure console port uart enabledBen Dooks1-0/+4
Ensure the UART's transmitter is enabled when meson_console_putchar is called. If not, then the console output is corrupt (the hardware seems to try and send /something/ even if the TX is disabled). This fixes corrupt console output on events such as trying to reboot the system since the console tx may be called after drivers shutdown method has been called. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reported-by: Edward Cragg <edward.cragg@codethink.co.uk> Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13ARM: meson: serial: tx_empty fails to check for transmitter busyBen Dooks1-1/+3
The tx_empty() uart_op should only return empty if both the transmit fifo and the transmit state-machine are both idle. Add a test for the hardware's XMIT_BUSY flag. Note, this is possibly related to an issue where the port is being shutdown with paritally transmitted characters in it. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reported-by: Edward Cragg <edward.cragg@codethink.co.uk> Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13ARM: meson: serial: don't reset port on uart startupBen Dooks1-2/+19
When the uart startup entry is called, do not reset the port as this could cause issues with anything left in the FIFO from a previous operation such as a console write. Move the hardware reset to probe time and simply clear the errors before enabling the port. This fixes the issue where the console could become corrupted as there where characters left in the output or output fifo when a user process such as systemd would open/close the uart to transmit characters. For example, you get: [ 3.252263] systemd[1]: Dete instead of: [ 3.338801] systemd[1]: Detected architecture arm. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13ARM: meson: serial: release region on port releaseBen Dooks1-9/+20
The meson_uart_release_port() unmaps the register area but does not release it. The meson_uart_request_port() calls devm_request_mem_region so the release should call devm_release_mem_region() for that area so that anyt subsequent use of these calls will work. This fixes an issue where the addition of reset code before registering the uart stops the console from working. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06ARM: meson: serial: convert iounmap to devm_iounmapFiro Yang1-1/+1
The function meson_uart_release_port() inappropriately try to iounmap() a resource managed by devm_ioremap_nocache(). The function meson_uart_release_port() maybe called by uart_ioctl() that means meson_uart_release_port() is not called from within a probe or remove function, for safety, I convert iounmap() to devm_iounmap(). Signed-off-by: Firo Yang <firogm@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20tty: serial: drop owner assignment from platform_driversWolfram Sang1-1/+0
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-09-08ARM: meson: serial: add MesonX SoC on-chip uart driverCarlo Caione1-0/+634
The SoC has four fully functional UARTs which use the same programming model. They are named UART_A, UART_B, UART_C and UART_AO (Always-On) which cannot be powered off. Signed-off-by: Carlo Caione <carlo@caione.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>