summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* printk: Add function to replay kernel log on consolesSreenath Vijayan2024-04-112-24/+57
| | | | | | | | | | | | | | | | | | | | | | | | Add a generic function console_replay_all() for replaying the kernel log on consoles, in any context. It would allow viewing the logs on an unresponsive terminal via sysrq. Reuse the existing code from console_flush_on_panic() for resetting the sequence numbers, by introducing a new helper function __console_rewind_all(). It is safe to be called under console_lock(). Try to acquire lock on the console subsystem without waiting. If successful, reset the sequence number to oldest available record on all consoles and call console_unlock() which will automatically flush the messages to the consoles. Suggested-by: John Ogness <john.ogness@linutronix.de> Suggested-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Shimoyashiki Taichi <taichi.shimoyashiki@sony.com> Reviewed-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Sreenath Vijayan <sreenath.vijayan@sony.com> Link: https://lore.kernel.org/r/90ee131c643a5033d117b556c0792de65129d4c3.1710220326.git.sreenath.vijayan@sony.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Convert to_max3100_port() to be static inlineAndy Shevchenko2024-04-111-1/+4
| | | | | | | | | | | | | | As Jiri rightfully pointed out the current to_max3100_port() macro implementation is fragile in a sense that it expects the variable name to be port, otherwise it blow up the build. Change this to be static inline to prevent bad compilation. Suggested-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240410141135.1378948-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: omap: remove redundant assignment to variable tmoutColin Ian King2024-04-111-1/+0
| | | | | | | | | | | | | | Variable tmout is being assigned a value that is never read, it is being re-assinged in the following for-loop statement. The assignment is redundant and can be removed. Cleans up clang scan warning: drivers/tty/serial/omap-serial.c:1096:3: warning: Value stored to 'tmout' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20240411085537.306020-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: 8250: Fix add preferred console for serial8250_isa_init_ports()Tony Lindgren2024-04-112-11/+10
| | | | | | | | | | | | | | | | | | We need to inline serial_base_add_isa_preferred_console() based on CONFIG_SERIAL_8250_CONSOLE and not based on CONFIG_SERIAL_CORE_CONSOLE. Otherwise we can get the follwoing error as noted by Stephen: ERROR: modpost: "serial_base_add_isa_preferred_console" [drivers/tty/serial/8250/8250.ko] undefined! We also have a duplicate inlined serial_base_add_isa_preferred_console(), in serial_base_bus.c added by the same commit by accident, let's drop it. Fixes: a8b04cfe7dad ("serial: 8250: Add preferred console in serial8250_isa_init_ports()") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20240411080622.11929-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: sc16is7xx: split into core and I2C/SPI parts (sc16is7xx_regcfg)Hugo Villeneuve2024-04-114-10/+16
| | | | | | | | | | | Since each I2C/SPI probe function can modify sc16is7xx_regcfg at the same time, change structure to be constant and do the required modifications on a local copy. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://lore.kernel.org/r/20240409154253.3043822-6-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: sc16is7xx: split into core and I2C/SPI parts (sc16is7xx_lines)Hugo Villeneuve2024-04-111-11/+21
| | | | | | | | | | | | | | | | | | | | | Before, sc16is7xx_lines was checked for a free (zero) bit first, and then later it was set only if UART port registration succeeded. Now that sc16is7xx_lines is shared for the I2C and SPI drivers, there is a possibility that the two drivers can simultaneously try to reserve the same line bit at the same time. To prevent this, make sure line allocation is reserved atomically, and use a new variable to hold the status of UART port registration. Now that we no longer need to search if a bit is set, it is now possible to simplify sc16is7xx_lines allocation by using the IDA framework. Link: https://lore.kernel.org/all/20231212150302.a9ec5d085a4ba65e89ca41af@hugovil.com/ Link: https://lore.kernel.org/all/CAHp75VebCZckUrNraYQj9k=Mrn2kbYs1Lx26f5-8rKJ3RXeh-w@mail.gmail.com/ Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20240409154253.3043822-5-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: sc16is7xx: split into core and I2C/SPI parts (core)Hugo Villeneuve2024-04-116-218/+248
| | | | | | | | | | | | | | | | | | | | | | Split the common code from sc16is7xx driver and move the I2C and SPI bus parts into interface-specific source files. sc16is7xx becomes the core functions which can support multiple bus interfaces like I2C and SPI. No functional changes intended. Also simplify and improve Kconfig entries. - Capitalize SPI keyword for consistency - Display list of supported ICs each on a separate line (and aligned) to facilitate locating a specific IC model - Add Manufacturer name at start of description string - Add UART keyword to description string Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20240409154253.3043822-4-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: sc16is7xx: unconditionally clear line bit in sc16is7xx_remove()Hugo Villeneuve2024-04-111-2/+2
| | | | | | | | | | | | There is no need to check for previous port registration in sc16is7xx_remove() because if sc16is7xx_probe() succeeded, we are guaranteed to have successfully registered both ports. We can thus unconditionally clear the line allocation bit in sc16is7xx_lines. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://lore.kernel.org/r/20240409154253.3043822-3-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: sc16is7xx: add proper sched.h include for sched_set_fifo()Hugo Villeneuve2024-04-111-1/+1
| | | | | | | | | | Replace incorrect include with the proper one for sched_set_fifo() declaration. Fixes: 28d2f209cd16 ("sched,serial: Convert to sched_set_fifo()") Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20240409154253.3043822-2-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: ar933x: Remove unneeded static structureLino Sanfilippo2024-04-091-2/+1
| | | | | | | | | | | In case that no RTS GPIO is available do not use a dedicated nullified serial_rs485 struct to disable RS485 support, but simply delete the SER_RS485_ENABLED flag in the ports rs485_supported struct. This make the structure superfluous and it can be removed. Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Link: https://lore.kernel.org/r/20240407002709.16224-5-l.sanfilippo@kunbus.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: 8250: Remove superfluous sanity checkLino Sanfilippo2024-04-091-7/+0
| | | | | | | | | The serial core already checks the RS485 RTS settings for sanity, so remove the superfluous check in serial8250_em485_config(). Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Link: https://lore.kernel.org/r/20240407002709.16224-4-l.sanfilippo@kunbus.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: amba-pl011: move variable into CONFIG_DMA_ENGINE conditionalLino Sanfilippo2024-04-091-1/+1
| | | | | | | | | Variable dmacr is only used if DMA is enabled, so move it into the CONFIG_DMA_ENGINE conditional. Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Link: https://lore.kernel.org/r/20240407002709.16224-3-l.sanfilippo@kunbus.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: amba-pl011: get rid of useless wrapper pl011_get_rs485_mode()Lino Sanfilippo2024-04-091-13/+1
| | | | | | | | | | | | Due to earlier code changes function pl011_get_rs485_mode() is now merely a wrapper for uart_get_rs485_mode() which does not add any further functionality. So remove it and instead call uart_get_rs485_mode() directly. Reviewed-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Link: https://lore.kernel.org/r/20240407002709.16224-2-l.sanfilippo@kunbus.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Sort headersAndy Shevchenko2024-04-091-3/+3
| | | | | | | | | Sort the headers in alphabetic order in order to ease the maintenance for this part. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240409144721.638326-9-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Extract to_max3100_port() helper macroAndy Shevchenko2024-04-091-48/+19
| | | | | | | | | | Instead of using container_of() explicitly, introduce a helper macro. This saves a lot of lines of code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20240409144721.638326-8-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Switch to DEFINE_SIMPLE_DEV_PM_OPS()Andy Shevchenko2024-04-091-9/+3
| | | | | | | | | | The SIMPLE_DEV_PM_OPS() is deprecated, replace it with the DEFINE_SIMPLE_DEV_PM_OPS() and use pm_sleep_ptr() for setting the driver's PM routines. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240409144721.638326-7-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Replace MODULE_ALIAS() with respective ID tablesAndy Shevchenko2024-04-091-1/+15
| | | | | | | | | MODULE_ALIAS() in most cases is a pure hack to avoid placing ID tables. Replace it with the respective ID tables. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240409144721.638326-6-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Switch to use dev_err_probe()Andy Shevchenko2024-04-091-9/+3
| | | | | | | | | Switch to use dev_err_probe() to simplify the error path and unify a message template. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240409144721.638326-5-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Remove duplicating irq fieldAndy Shevchenko2024-04-091-12/+10
| | | | | | | | | | The struct uart_port has a copy of the IRQ that is also stored in the private data structure. Remove the duplication in the latter one. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240409144721.638326-4-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Get crystal frequency via device propertyAndy Shevchenko2024-04-091-29/+20
| | | | | | | | | Get crystal frequency via device property instead of using a platform data. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240409144721.638326-3-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Enable TIOCM_LOOPAndy Shevchenko2024-04-091-12/+14
| | | | | | | | Enable or disable loopback at run-time. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240409144721.638326-2-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: sc16is7xx: convert to use maple tree register cachewangkaiyuan2024-04-091-1/+1
| | | | | | | | | | | The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: wangkaiyuan <wangkaiyuan@inspur.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240318064216.1765-1-wangkaiyuan@inspur.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: max310x: convert to use maple tree register cachewangkaiyuan2024-04-091-2/+2
| | | | | | | | | | | The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. Signed-off-by: wangkaiyuan <wangkaiyuan@inspur.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20240318064036.1656-1-wangkaiyuan@inspur.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Update Kconfig entryAndy Shevchenko2024-04-091-2/+5
| | | | | | | | | The driver actually supports more than one chip. Update Kconfig entry to list the supported chips. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240402195306.269276-17-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Remove unneeded forward declarationAndy Shevchenko2024-04-091-16/+14
| | | | | | | | | | | | There is no code using max3100_work() before the definition of it. Remove unneeded forward declaration. While at it, move max3100_dowork() and max3100_timeout() down in the code to be after actual max3100_work() implementation. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240402195306.269276-15-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Replace custom polling timeout with standard oneAndy Shevchenko2024-04-091-20/+5
| | | | | | | | | Serial core provides a standard timeout for polling modem state. Use it instead of a custom approach. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240402195306.269276-7-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Remove custom HW shutdown supportAndy Shevchenko2024-04-091-35/+7
| | | | | | | | | | | | | While there is no user of this callback in the kernel, it also breaks the relationship in the driver model. The correct implementation should be done via GPIO or regulator framework. Remove custom HW shutdown support for good and, if needed, we will implement it correctly later on. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240402195306.269276-6-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Make struct plat_max3100 localAndy Shevchenko2024-04-092-68/+18
| | | | | | | | | | There is no user of the struct plat_max3100 outside the driver. Inline its contents into the driver. While at it, drop outdated example in the comment. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240402195306.269276-5-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Fix bitwise typesAndy Shevchenko2024-04-091-1/+4
| | | | | | | | | | | | | | | | Sparse is not happy about misuse of bitwise types: .../max3100.c:194:13: warning: incorrect type in assignment (different base types) .../max3100.c:194:13: expected unsigned short [addressable] [usertype] etx .../max3100.c:194:13: got restricted __be16 [usertype] .../max3100.c:202:15: warning: cast to restricted __be16 Fix this by choosing proper types for the respective variables. Fixes: 7831d56b0a35 ("tty: MAX3100") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240402195306.269276-4-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Update uart_driver_registered on driver removalAndy Shevchenko2024-04-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The removal of the last MAX3100 device triggers the removal of the driver. However, code doesn't update the respective global variable and after insmod — rmmod — insmod cycle the kernel oopses: max3100 spi-PRP0001:01: max3100_probe: adding port 0 BUG: kernel NULL pointer dereference, address: 0000000000000408 ... RIP: 0010:serial_core_register_port+0xa0/0x840 ... max3100_probe+0x1b6/0x280 [max3100] spi_probe+0x8d/0xb0 Update the actual state so next time UART driver will be registered again. Hugo also noticed, that the error path in the probe also affected by having the variable set, and not cleared. Instead of clearing it move the assignment after the successfull uart_register_driver() call. Fixes: 7831d56b0a35 ("tty: MAX3100") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20240402195306.269276-3-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: max3100: Lock port->lock when calling uart_handle_cts_change()Andy Shevchenko2024-04-091-1/+12
| | | | | | | | | | | | | | | | | | | | uart_handle_cts_change() has to be called with port lock taken, Since we run it in a separate work, the lock may not be taken at the time of running. Make sure that it's taken by explicitly doing that. Without it we got a splat: WARNING: CPU: 0 PID: 10 at drivers/tty/serial/serial_core.c:3491 uart_handle_cts_change+0xa6/0xb0 ... Workqueue: max3100-0 max3100_work [max3100] RIP: 0010:uart_handle_cts_change+0xa6/0xb0 ... max3100_handlerx+0xc5/0x110 [max3100] max3100_work+0x12a/0x340 [max3100] Fixes: 7831d56b0a35 ("tty: MAX3100") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240402195306.269276-2-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: 8250_of: Add clock_notifierBastien Curutchet2024-04-091-0/+37
| | | | | | | | | | | | | | | | | | | The UART's input clock rate can change at runtime but this is not handled by the driver. Add a clock_notifier callback that updates the divisors when the input clock is updated. The serial8250_update_uartclk() is used to do so. PRE_RATE_CHANGE and ABORT_RATE_CHANGE notifications are ignored, only the POST_RATE_CHANGE is used. Not using PRE_RATE_CHANGE notification can result in a few corrupted bytes during frequency transitions but, IMHO, it can be acceptable in many use cases. It has been tested on a DAVINCI/OMAP-L138 processor. Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com> Reviewed-by: Herve Codina <herve.codina@bootlin.com> Link: https://lore.kernel.org/r/20240405120552.35991-1-bastien.curutchet@bootlin.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* dt-bindings: serial: actions,owl-uart: convert to dtschemaKanak Shilledar2024-04-092-16/+48
| | | | | | | | | | | | | Convert the Actions Semi Owl UART to newer DT schema. Created DT schema based on the .txt file which had `compatible`, `reg` and `interrupts` as the required properties. This binding is used by Actions S500, S700 and S900 SoC. S700 and S900 use the same UART compatible string. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Kanak Shilledar <kanakshilledar111@protonmail.com> Link: https://lore.kernel.org/r/20240405080235.11563-1-kanakshilledar@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: pmac_zilog: Drop usage of platform_driver_probe()Uwe Kleine-König2024-04-091-4/+5
| | | | | | | | | | | | | | | | | There are considerations to drop platform_driver_probe() as a concept that isn't relevant any more today. It comes with an added complexity that makes many users hold it wrong. (E.g. this driver should have marked the driver struct with __refdata to prevent the below mentioned false positive section mismatch warning.) This fixes a W=1 build warning: WARNING: modpost: drivers/tty/serial/pmac_zilog: section mismatch in reference: pmz_driver+0x8 (section: .data) -> pmz_detach (section: .exit.text) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/5ea3174616abc9fa256f115b4fb175d289ac1754.1711748999.git.u.kleine-koenig@pengutronix.de Tested-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: ami: Mark driver struct with __refdata to prevent section mismatchUwe Kleine-König2024-04-091-1/+7
| | | | | | | | | | | | | | As described in the added code comment, a reference to .exit.text is ok for drivers registered via module_platform_driver_probe(). Make this explicit to prevent the following section mismatch warning WARNING: modpost: drivers/tty/amiserial: section mismatch in reference: amiga_serial_driver+0x8 (section: .data) -> amiga_serial_remove (section: .exit.text) that triggers on an allmodconfig W=1 build. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/043afcbc94ad90079301f3c7738136a7993a1748.1711748999.git.u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: conmakehash: Don't mention the full path of the input in outputUwe Kleine-König2024-04-091-2/+13
| | | | | | | | | | | | | | | This change strips $abs_srctree of the input file containing the character mapping table in the generated output. The motivation for this change is Yocto emitting a build warning WARNING: linux-lxatac-6.7-r0 do_package_qa: QA Issue: File /usr/src/debug/linux-lxatac/6.7-r0/drivers/tty/vt/consolemap_deftbl.c in package linux-lxatac-src contains reference to TMPDIR So this change brings us one step closer to make the build result reproducible independent of the build path. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20240311113017.483101-2-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: n_gsm: replace deprecated strncpy with strscpyJustin Stitt2024-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. We expect nc->if_name to be NUL-terminated based on existing manual NUL-byte assignments and checks: | nc.if_name[IFNAMSIZ-1] = '\0'; ... | if (nc->if_name[0] != '\0') Let's use the new 2-argument strscpy() since it guarantees NUL-termination on the destination buffer while correctly using the destination buffers size to bound the operation. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Justin Stitt <justinstitt@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20240318-strncpy-drivers-tty-n_gsm-c-v1-1-da37a07c642e@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: hvc: Remove second semicolonColin Ian King2024-04-091-1/+1
| | | | | | | | | There is a statement with two semicolons. Remove the second one, it is redundant. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20240315091734.2430416-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* dt-bindings: serial: renesas,scif: Document r8a779h0 bindingsNghia Nguyen2024-04-091-0/+1
| | | | | | | | | | | R-Car V4M (R8A779H0) SoC has the R-Car Gen4 compatible SCIF ports, so document the SoC specific bindings. Signed-off-by: Nghia Nguyen <nghia.nguyen.jg@renesas.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/49b854603c2c3ed6b2edd441f1d55160e0453b70.1709741175.git.geert+renesas@glider.be Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: sifive: Remove 0 from fu540-c000-uart0 binding.Sebastian Andrzej Siewior2024-04-091-2/+2
| | | | | | | | | | | | | | | | | The driver is using "sifive,fu540-c000-uart0" as a binding. The device tree and documentation states "sifive,fu540-c000-uart" instead. This means the binding is not matched and not used. This did not cause any problems because the alternative binding, used in the device tree, "sifive,uart0" is not handling the hardware any different. Align the binding in the driver with the documentation. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20240307090950.eLELkuyK@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: pic32_uart: Replace of_gpio.h by proper oneAndy Shevchenko2024-04-091-1/+1
| | | | | | | | | | of_gpio.h is deprecated and subject to remove. The driver doesn't use it directly, replace it with what is really being used. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240307114243.3642832-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: 8250_omap: Remove unused of_gpio.hAndy Shevchenko2024-04-091-1/+0
| | | | | | | | | of_gpio.h is deprecated and subject to remove. The driver doesn't use it, simply remove the unused header. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240307114048.3642642-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Documentation: kernel-parameters: Add DEVNAME:0.0 format for serial portsTony Lindgren2024-04-091-0/+19
| | | | | | | | | | | Document the console option for DEVNAME:0.0 style addressing for serial ports. Suggested-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Link: https://lore.kernel.org/r/20240327110021.59793-8-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: 8250: Add preferred console in serial8250_isa_init_ports()Tony Lindgren2024-04-093-0/+34
| | | | | | | | | | | | | | | | | Prepare 8250 ISA ports to drop kernel command line serial console handling from console_setup(). We need to set the preferred console in serial8250_isa_init_ports() to drop a dependency to setup_console() handling the ttyS related quirks. Otherwise when console_setup() handles the ttyS related options, console gets enabled only at driver probe time. Note that this mostly affects x86 as this happens based on define SERIAL_PORT_DFNS. Signed-off-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20240327110021.59793-7-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: core: Handle serial console optionsTony Lindgren2024-04-091-0/+49
| | | | | | | | | | | | | | | In order to start moving the serial console quirks out of console_setup(), let's add parsing for the quirks to the serial core layer. We can use serial_base_add_one_prefcon() to handle the quirks. Note that eventually we may want to set up driver specific console quirk handling for the serial port device drivers to use. But we need to figure out which driver(s) need to call the quirk. So for now, we just handle the sparc quirk directly. Signed-off-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20240327110021.59793-6-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: core: Add support for DEVNAME:0.0 style naming for kernel consoleTony Lindgren2024-04-093-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can now add hardware based addressing for serial ports. Starting with commit 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM"), and all the related fixes to this commit, the serial core now knows to which serial port controller the ports are connected. The serial ports can be addressed with DEVNAME:0.0 style naming. The names are something like 00:04:0.0 for a serial port on qemu, and something like 2800000.serial:0.0 on platform device using systems like ARM64 for example. The DEVNAME is the unique serial port hardware controller device name, AKA the name for port->dev. The 0.0 are the serial core controller id and port id. Typically 0.0 are used for each controller and port instance unless the serial port hardware controller has multiple controllers or ports. Using DEVNAME:0.0 style naming actually solves two long term issues for addressing the serial ports: 1. According to Andy Shevchenko, using DEVNAME:0.0 style naming fixes an issue where depending on the BIOS settings, the kernel serial port ttyS instance number may change if HSUART is enabled 2. Device tree using architectures no longer necessarily need to specify aliases to find a specific serial port, and we can just allocate the ttyS instance numbers dynamically in whatever probe order To do this, let's match the hardware addressing style console name to the character device name used, and add a preferred console using the character device name. Note that when using console=DEVNAME:0.0 style kernel command line, the 8250 serial console gets enabled later compared to using console=ttyS naming for ISA ports. This is because the serial port DEVNAME to character device mapping is not known until the serial driver probe time. If used together with earlycon, this issue is avoided. Signed-off-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Link: https://lore.kernel.org/r/20240327110021.59793-5-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* printk: Flag register_console() if console is set on command lineTony Lindgren2024-04-091-1/+4
| | | | | | | | | | | | | If add_preferred_console() is not called early in setup_console(), we can end up having register_console() call try_enable_default_console() before a console device has called add_preferred_console(). Let's set console_set_on_cmdline flag in console_setup() to prevent this from happening. Signed-off-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20240327110021.59793-4-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* printk: Don't try to parse DEVNAME:0.0 console optionsTony Lindgren2024-04-091-0/+4
| | | | | | | | | | | Currently console_setup() tries to make a console index out of any digits passed in the kernel command line for console. In the DEVNAME:0.0 case, the name can contain a device IO address, so bail out on console names with a ':'. Signed-off-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20240327110021.59793-3-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* printk: Save console options for add_preferred_console_match()Tony Lindgren2024-04-095-4/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Driver subsystems may need to translate the preferred console name to the character device name used. We already do some of this in console_setup() with a few hardcoded names, but that does not scale well. The console options are parsed early in console_setup(), and the consoles are added with __add_preferred_console(). At this point we don't know much about the character device names and device drivers getting probed. To allow driver subsystems to set up a preferred console, let's save the kernel command line console options. To add a preferred console from a driver subsystem with optional character device name translation, let's add a new function add_preferred_console_match(). This allows the serial core layer to support console=DEVNAME:0.0 style hardware based addressing in addition to the current console=ttyS0 style naming. And we can start moving console_setup() character device parsing to the driver subsystem specific code. We use a separate array from the console_cmdline array as the character device name and index may be unknown at the console_setup() time. And eventually there's no need to call __add_preferred_console() until the subsystem is ready to handle the console. Adding the console name in addition to the character device name, and a flag for an added console, could be added to the struct console_cmdline. And the console_cmdline array handling could be modified accordingly. But that complicates things compared saving the console options, and then adding the consoles when the subsystems handling the consoles are ready. Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240327110021.59793-2-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: atmel_serial: use single DMA mapping for RXJiri Slaby (SUSE)2024-04-091-34/+22
| | | | | | | | | | | | | | | dma_map_single() provides much easier interface for simple mappings as used for RX in atmel_serial. So switch to that, removing all the s-g unnecessary handling. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> 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@tuxon.dev> Cc: linux-arm-kernel@lists.infradead.org Link: https://lore.kernel.org/r/20240405060826.2521-16-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>