summaryrefslogtreecommitdiffstats
path: root/drivers/serial
Commit message (Collapse)AuthorAgeFilesLines
* serial_ns16550: add raspberry pi compatible and initRouven Czerwinski2019-02-051-0/+28
| | | | | | | | Add the compatible for the Raspberry Pi AUX UART and an init function which enables it via the aux register and configures the correct shift value. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial_ns16550: handle default reg-io-widthRouven Czerwinski2019-02-051-23/+23
| | | | | | | | | | According to the device tree bindings for 8250, width is an optional property. Default to 1 which is the same default value as used by the kernel. Before this change the driver would not work for device trees which do not include the optional binding. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/missing-prototypes'Sascha Hauer2019-01-151-1/+1
|\
| * serial: amba-pl011: fix "no previous prototype for 'pl011_init_port'" warningAntony Pavlov2019-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | The patch fixes the following compiler's warning: drivers/serial/amba-pl011.c:151:5: warning: no previous prototype for ‘pl011_init_port’ [-Wmissing-prototypes] int pl011_init_port (struct console_device *cdev) ^~~~~~~~~~~~~~~ Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-01-151-1/+1
|\ \
| * | serial: amba-pl011: Fix regulator_get() return checkAndrey Smirnov2018-12-171-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | NULL is used to designate a dummy regulator, so it it should be safe to use against regulator_enable(). Any value that would retrun true for IS_ERR(), OTOH, is not. Such value would also pass "if (r)" check without any problems. Fix the code to use !IS_ERR() instead. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial: clps711x: Determine device name from device treeAlexander Shiyan2018-12-201-0/+9
| | | | | | | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial: clps711x: Use DIV_ROUND_CLOSEST() for baudrate calculationAlexander Shiyan2018-12-201-1/+1
| | | | | | | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial: clps711x: Switch to SPDX identifierAlexander Shiyan2018-12-201-10/+2
| | | | | | | | | | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial: clps711x: Change compatible stringAlexander Shiyan2018-12-201-1/+1
|/ | | | | | | | This patch changes compatible string for CLPS711X serial driver to "cirrus,ep7209-uart" for conform with linux kernel. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serdev: select POLLERLucas Stach2018-12-041-0/+1
| | | | | | | | A lot of the inner working of the serdev framework depend on the poller, so there is no point in allowing to build without poller support. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: lpuart: Avoid division by zero when requested baudrate isAndrey Smirnov2018-08-131-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | With serdev device support added there's now a corner case where: 1. There is a DT node for a serdev device on one of the UARTs 2. There is no driver that binds against serdev device's compatibility string with 1 and 2 being true it is possible to end up in a situation where a particualr UART has not been initalized to any baudrate when clock_notifier_call_chain() gets called. This effectively translates to set_baudrate(uart, 0); which for LPUART driver result in a division by zero. To avoid this problem, convert lpuart_serial_setbaudrate() to treat zero baudrate as a request to disable the UART. While we are at it add a BUG_ON() to lpuart_setbrg() to simplify finding any future bugs. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: i.MX: Add i.MX8 supportSascha Hauer2018-06-111-1/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/serdev'Sascha Hauer2018-05-099-82/+6
|\
| * serial: Drop .remove functions from all driversAndrey Smirnov2018-04-178-82/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Depending on specifics, some 'serdev' devices might need prevent parent console device from being removed and corresponding memory deallocated to properly function until the very end of Barebox's execution. An example of such a use-case would be a reset handler relying on a serdev device for transport. To avoid having to develop complicatione reference counting/ownership scheme drop all of the code that calls console_unregister() and frees the memory effectively making the problem above impossible to arise. All of the de-initialization that serial drivers were doing in their .remove functions was somewhat superflous anyway, so this change should be pretty harmless. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * console: Add simplified 'serdev' framework from Linux kernelAndrey Smirnov2018-04-171-0/+6
| | | | | | | | | | | | | | | | | | Port 'serdev' UART-slave deivce framework found in recent Linux kernels (post 4.13) in order to be able to port 'serdev' slave drivers from Linux. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial/lpuart: Do not enable UART FIFOAndrey Smirnov2018-04-161-3/+1
|/ | | | | | | | | | Using FIFO in LPUART results in subtle serial input draining issues which are quite difficult to reproduce and troubleshoot. Since the change offered only moderate performance gain revert the code to operate in no-FIFO mode to avoid FIFO-related problems alltogether. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: provide big-endian supportOleksij Rempel2017-09-081-2/+17
| | | | | | | we need it at least for QCA AR9344 Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: emit an error message if getting the clock failsUwe Kleine-König2017-06-191-0/+1
| | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: fix registering multiple consolesAleksander Morgado2017-06-011-0/+3
| | | | | | | | | | | | | | | | | | Consoles need to be registered with the "console" device name so that they are probed by the correct driver. The barebox_register_console() was already forcing this as it was overwriting the name that was being passed as argument, but it was failing to provide a unique id for each new console, so the underlying register_device() would just return an error when wanting to re-register a device with device name "console" and id 0. We remove the unused name parameter from barebox_register_console() as it is really nowhere used, and also specify DEVICE_ID_DYNAMIC as id, so that a new unique device id is given to each newly registered console device. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: atmel: Add DT compatibility tableAndrey Smirnov2017-03-301-0/+7
| | | | | | Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/efi'Sascha Hauer2017-03-134-2/+228
|\
| * efi: add serial driver supportJean-Christophe PLAGNIOL-VILLARD2017-03-093-0/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | | So now we can stop to use the efi-stdio as this driver print on the Framebuffer and the serial at the same time. This is specially usefull if we want to use the framebuffer via efi-gop for something else. Do not forget to disable the efi-stdio device before enabling the console otherwise you will get double printing. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * efi: move x86 efi boot support to x86 archJean-Christophe PLAGNIOL-VILLARD2017-02-271-1/+1
| | | | | | | | | | | | | | prepare to drop the efi arch as efi boot up is not arch sepecific Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * efi: move bus driver to driver/efiJean-Christophe PLAGNIOL-VILLARD2017-02-241-1/+1
| | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial: atmel: Check result of clk_get()Andrey Smirnov2017-03-091-0/+5
|/ | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2017-02-131-0/+4
|\
| * serial: i.MX: add i.MX7 supportJuergen Borleis2017-01-191-0/+3
| | | | | | | | | | Signed-off-by Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * serial: i.MX: Enable clockSascha Hauer2017-01-191-0/+1
| | | | | | | | | | | | For architectures which do not enable all clocks during initialization. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/efi'Sascha Hauer2017-02-131-1/+2
|\ \
| * | serial: efi: improve input handlingMichael Olbrich2017-01-241-1/+2
| |/ | | | | | | | | | | | | | | | | 0x08 is the scan-code for 'backspace' not 'delete'. 0x17 indicates the start of an escape sequence, such as "[3~" for 'delete'. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / serial: ns16550: Set read/write functions depending on reg-io-widthWadim Egorov2017-02-101-0/+19
|/ | | | | | | | Set proper register read/write functions depending on reg-io-width device tree property. Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX: Add 'lpuart' serial driverAndrey Smirnov2017-01-113-0/+223
| | | | | | | Add 'lpuart' serial driver, based on analogous driver from U-Boot Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: i.MX: Add i.MX6ul supportSascha Hauer2016-11-081-0/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: arm_dcc: depend on !CPU_V8Lucas Stach2016-10-041-1/+1
| | | | | | | | The DCC console uses coprocessor registers registers accesses, the implementation of those for ARMv8 is currently missing. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/include-pdata'Sascha Hauer2016-05-091-1/+1
|\
| * include: Move ns16550 serial platform_data to include/platform_dataSascha Hauer2016-04-151-1/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial_auart: make dt awareUwe Kleine-König2016-04-271-0/+9
|/ | | | | | | | This allows to instantiate devices from an oftree and so allows to select the console using /chosen/stdout-path. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/driver'Sascha Hauer2016-03-1114-26/+70
|\
| * driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-0714-26/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial: imx: Support DTE modeSascha Hauer2016-02-261-2/+9
|/ | | | | | Based on Kernel commit 20ff2fe60a: serial: imx: add support for DTE mode Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: Set linux_console_nameSascha Hauer2015-08-261-0/+2
| | | | | | | The regular ns16450/ns16550 devices get the console name "ttyS" under Linux. Add this to the driver data. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PPC/MPC52xx: unify header file name for clock APIJuergen Borleis2015-08-031-1/+1
| | | | | | | | In preparation to re-use the i.MX I2C driver for the MPC5200 SoC use clock.h instead of clocks.h for the clock API. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: Fix reading clock-frequency propertySascha Hauer2015-06-261-7/+2
| | | | | | | | | The clock-frequency property is never read because the driver bails out earlier when it is unable to clk_get the clk. Move the clock-frequency read out to the dt setup code which is executed before the driver bails out due to the missing clk. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2015-06-091-2/+2
|\
| * Abolish cpu_read* and cpu_write* accessorsMasahiro Yamada2015-05-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 2e6a88f2101d (add cpu native ordered io accessors) introduced these macros and then commit be57f20cdd7d (Fix big endian MMIO primitives) figured out they are equivalent to __raw_{read,write}*. They turned out unnecessary after all. Anyway, most source files use __raw_read* and __raw_write*. Let's replace a few remaining references and abolish them. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial: i.MX: Write settings to a correct registerAndrey Smirnov2015-05-151-2/+2
| | | | | | | | | | | | | | | | Fix what looks like a copy and past error, where settings for USR1 register were being written to USR2. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i.MX: serial: Add baud rate calculation convenience functionsAndrey Smirnov2015-05-071-2/+2
| | | | | | | | | | | | | | | | | | | | Add two functions to calculate values for UBMR and UBIR registers. This way both early serial initalization code and serial_imx.c can use them and not duplicate the code. Singed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i.MX: Move UART definitions into a separate fileAndrey Smirnov2015-05-071-107/+1
|/ | | | | | | | | Move UART definitions into a separate file to avoid redefinition in <mach/debug_ll.h> and magical constants in low level UART initialization code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-303-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>