summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/meson_uart.c
Commit message (Collapse)AuthorAgeFilesLines
* serial: meson: constify uart_ops structuresJulia Lawall2017-08-281-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>
* tty/serial: meson_uart: update to stable bindingsHelmut Klein2017-06-201-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>
* serial: meson: hide an unused functionArnd Bergmann2017-05-241-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>
* serial: meson: change interrupt description to tty nameHeiner Kallweit2017-05-181-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>
* serial: meson: remove use of flag UPF_IOREMAPHeiner Kallweit2017-05-181-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>
* serial: meson: make use of uart_port member mapsizeHeiner Kallweit2017-05-181-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>
* serial: meson: remove dead code in meson_uart_change_speedHeiner Kallweit2017-05-181-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>
* serial: meson: remove unneeded variable assignment in meson_serial_port_writeHeiner Kallweit2017-05-181-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>
* serial: meson: fix setting number of stop bitsHeiner Kallweit2017-05-181-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>
* tty: serial: meson: allow baud-rates higher than 115200Martin Blumenstingl2017-01-191-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>
* tty: serial: meson: Implement earlycon supportAndreas Färber2016-04-301-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>
* tty: serial: meson: Add support for XTAL clock inputAndreas Färber2016-02-141-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>
* ARM: meson: serial: check for tx-irq enabled in irq codeBen Dooks2015-12-131-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>
* ARM: meson: serial: ensure tx irq on if more work to doBen Dooks2015-12-131-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>
* ARM: meson: serial: disable rx/tx irqs during console writeBen Dooks2015-12-131-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>
* ARM: meson: serial: use meson_uart_tx_empty() to wait for emptyBen Dooks2015-12-131-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>
* ARM: meson: serial: only disable tx irq on stopBen Dooks2015-12-131-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>
* ARM: meson: serial: ensure console port uart enabledBen Dooks2015-12-131-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>
* ARM: meson: serial: tx_empty fails to check for transmitter busyBen Dooks2015-12-131-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>
* ARM: meson: serial: don't reset port on uart startupBen Dooks2015-12-131-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>
* ARM: meson: serial: release region on port releaseBen Dooks2015-12-131-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>
* ARM: meson: serial: convert iounmap to devm_iounmapFiro Yang2015-05-061-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>
* tty: serial: drop owner assignment from platform_driversWolfram Sang2014-10-201-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>
* ARM: meson: serial: add MesonX SoC on-chip uart driverCarlo Caione2014-09-081-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>