summaryrefslogtreecommitdiff
path: root/drivers/serial/ns16550.c
Commit message (Collapse)AuthorAgeLines
* dm: serial: ns16550: Update to support of-platdataSimon Glass2016-07-14-1/+3
| | | | | | | | | With of-platdata this driver cannot know the format of the of-platdata struct, so we cannot use generic code for accessing the of-platdata. Each SoC that uses this driver will need to set up ns16550's platdata for it. So don't compile in the generic code. Signed-off-by: Simon Glass <sjg@chromium.org>
* serial: 16550: Drop OMAP1510 supportMarek Vasut2016-06-02-17/+3
| | | | | | | | | | The CONFIG_OMAP1510 is no longer defined, so remove this dead code. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Nishanth Menon <nm@ti.com>
* serial: 16550: Make serial_io/out_shift available to debug modeMarek Vasut2016-06-02-6/+6
| | | | | | | | | | | | The ns16550 driver needs serial_in_shift() and serial_out_shift() when compiled in debug UART mode, so shift the DM_SERIAL check a little to make these functions available. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: ns16550: Don't map_physmem for I/O portsPaul Burton2016-05-26-2/+8
| | | | | | | | | | | If the UART is to be accessed using I/O port accessors (inb & outb) then using map_physmem doesn't make sense, since it operates in a different memory space. Remove the call to map_physmem when CONFIG_SYS_NS16550_PORT_MAPPED is defined, allowing I/O port addresses to not be mangled by the incorrect mapping. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
* dm: ns16550: Add support for reg-offset propertyMichal Simek2016-03-17-2/+4
| | | | | | | | | | | | reg-offset is the part of standard 8250 binding in the kernel. It is shifting start of address space by reg-offset. On Xilinx platform this offset is typically 0x1000. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Moved the new field to the end of the struct to avoid problems: Signed-off-by: Simon Glass <sjg@chromium.org>
* Revert "dm: ns16550: Add support for reg-offset property"Tom Rini2016-02-29-4/+2
| | | | | | | | | | | This reverts commit d9a3bec682f9756621615f4306718a356a3230e3. While this is a correct change to do long term it unfortunately breaks a number of platforms that are using pdata and not named struct members so they are getting all of their data after 'base' incorrect. Acked-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Tom Rini <trini@konsulko.com>
* dm: ns16550: Add support for reg-offset propertyMichal Simek2016-02-22-2/+4
| | | | | | | | | | reg-offset is the part of standard 8250 binding in the kernel. It is shifting start of address space by reg-offset. On Xilinx platform this offset is typically 0x1000. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* ns16550: zap the rockchip serial compatible stringThomas Chou2016-01-25-1/+5
| | | | | | | | Zap the rockchip serial compatible string, because rockchip serial has "snps,dw-apb-uart" compatible string in the dts. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Acked-by: Simon Glass <sjg@chromium.org>
* dm: ns16550: Allow the driver to be omitted if requestedSimon Glass2016-01-12-0/+2
| | | | | | | Allow the ns16550 debug UART to be used without the full driver. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Thomas Chou <thomas@wytron.com.tw>
* dm: serial: Convert ns16550 driver to use driver model PCI APISimon Glass2016-01-12-3/+2
| | | | | | | | | | | | | | | | | Use the driver model version of the function to find the BAR. This updates the fdtdec function, of which ns16550 is the only user. The fdtdec_get_pci_bdf() function is dropped for several reasons: - with driver model we should use 'struct udevice *' rather than passing the device tree offset explicitly - there are no other users in the tree - the function parses for information which is already available in the PCI device structure (specifically struct pci_child_platdata which is available at dev_get_parent_platdata(dev) Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
* dm: serial: ns16550: Add pre-reloc flag to the driverSimon Glass2015-12-05-0/+1
| | | | | | | | | | | For platforms that don't use device tree in SPL the only way to mark this driver as 'required by relocation' is with the DM_FLAG_PRE_RELOC flag. Add this to ensure that the driver is bound. Fixes: fde7e18938d8 ("dm: tegra: pci: Move CONFIG_PCI_TEGRA to Kconfig") Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Stephen Warren <swarren@nvidia.com> Acked-by: Thomas Chou <thomas@wytron.com.tw>
* ns16550: change reg-shift property default to zeroThomas Chou2015-12-05-1/+1
| | | | | | | | | | | | | | Change reg-shift property default to zero. When the integer property is missing, it should be taken as zero. This is consistent to Linux drivers/tty/serial/of_serial.c. The x86 and most powerpc use reg-shift of 0. Most others use reg-shift of 2. While reg-shift of 1 is rarely used. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com> Acked-by: Simon Glass <sjg@chromium.org>
* rockchip: serial driver support rk3036huang lin2015-12-01-0/+1
| | | | | Signed-off-by: Lin Huang <hl@rock-chips.com> Acked-by: Simon Glass <sjg@chromium.org>
* ns16550: zap CONFIG_NS16550_SERIALThomas Chou2015-11-21-4/+0
| | | | | | | | | Zap CONFIG_NS16550_SERIAL, as the unification of ns16550 drivers is completed. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* ns16550: add generic binding to unify the driversThomas Chou2015-11-20-0/+44
| | | | | | | | | | | | | | | | | | | | Add generic binding to unify ns16550 drivers. There are several drivers using almost the same code, such as serial_dw, serial_keystone, serial_omap, serial_ppc, serial_rockchip, serial_tegra.c, and serial_x86. But each is platform specific. The key difference between these drivers is the way to get input clock frequency. With this unified approach, fixed clock frequency should be extracted from "clock-frequency" property of device tree blob. If this property is not available, the macro CONFIG_SYS_NS16550_CLK will be used. It can be a constant or a function to get clock, eg, get_serial_clock(). Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Heiko Schocher <hs@denx.de> Acked-by: Simon Glass <sjg@chromium.org>
* ns16550: change map_sysmem to map_physmemThomas Chou2015-11-20-3/+2
| | | | | | | | | | | | | Change map_sysmem() to map_physmem(,,MAP_NOCACHE). Though map_sysmem() can be used to map system memory, it might be wrong to use it for I/O ports. The map_physmem() serves the same purpose to translate physical address to virtual address with the additional flag to take care of cache property. Most drivers use map_physmem() since I/O ports access should be uncached. As ns16550 is a driver, it should use map_physmem() rather than map_sysmem(). Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Acked-by: Simon Glass <sjg@chromium.org>
* debug_uart: Adjust the declaration of debug_uart_init()Simon Glass2015-10-21-1/+1
| | | | | | | | | | | We want to be able to add other common code to this function. So change the driver's version to have an underscore before it, just like _debug_uart_putc(). Define debug_uart_init() to call this version. Update all drivers to this new method. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: Use dev_get_addr() where possibleSimon Glass2015-08-31-1/+1
| | | | | | | | | | This is a convenient way for a driver to get the hardware address of a device, when regmap or syscon are not being used. Change existing callers to use it as an example to others. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Stephen Warren <swarren@wwwdotorg.org>
* of: clean up OF_CONTROL ifdef conditionalsMasahiro Yamada2015-08-18-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have flipped CONFIG_SPL_DISABLE_OF_CONTROL. We have cleansing devices, $(SPL_) and CONFIG_IS_ENABLED(), so we are ready to clear away the ugly logic in include/fdtdec.h: #ifdef CONFIG_OF_CONTROL # if defined(CONFIG_SPL_BUILD) && !defined(SPL_OF_CONTROL) # define OF_CONTROL 0 # else # define OF_CONTROL 1 # endif #else # define OF_CONTROL 0 #endif Now CONFIG_IS_ENABLED(OF_CONTROL) is the substitute. It refers to CONFIG_OF_CONTROL for U-boot proper and CONFIG_SPL_OF_CONTROL for SPL. Also, we no longer have to cancel CONFIG_OF_CONTROL in include/config_uncmd_spl.h and scripts/Makefile.spl. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Linus Walleij <linus.walleij@linaro.org>
* ns16550: Improve debug UART so it can work with 32-bit accessSimon Glass2015-07-21-15/+21
| | | | | | | Since Rockchip requires 32-bit serial access, add this to the driver. Refactor a little to make this easier. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: ns16550: Support CONFIG_SYS_NS16550_MEM32 with driver modelSimon Glass2015-06-10-0/+4
| | | | | | | | This option is used by some boards, so support it with driver model. This is really ugly - we should rewrite this driver once all users are moved to driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
* serial: ns16550: Remove hard-coded baud_divisor settingAxel Lin2015-04-28-1/+0
| | | | | | | | | This was accidentally added by commit dd0b0122bacc "serial: ns16550: Add an option to specify the debug UART register shift". Remove it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Simon Glass <sjg@chromium.org>
* serial: ns16550: Remove unnecessary init on UART setupSimon Glass2015-04-22-1/+0
| | | | | | | It is not necessary to write a zero baud rate to the device, and for some chips this will cause problems. Drop this code. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: ns16550: Support non-byte register spacing with driver modelSimon Glass2015-04-22-4/+6
| | | | | | | Allow this driver to support boards where the register shift is not 0. This fixes some compiler warnings which appear in that case. Signed-off-by: Simon Glass <sjg@chromium.org>
* serial: ns16550: Add an option to specify the debug UART register shiftSimon Glass2015-04-22-10/+15
| | | | | | | | This UART permits different register spacing. To support the debug UART on devices which have a spacing other than 1 byte, allow the shift value to be specified. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Make sure arch-specific map_sysmem() is definedJoe Hershberger2015-04-18-0/+1
| | | | | | | | | | | In the case where the arch defines a custom map_sysmem(), make sure that including just mapmem.h is sufficient to have these functions as they are when the arch does not override it. Also split the non-arch specific functions out of common.h Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* serial: ns16550: Fix build error due to a typoAxel Lin2015-03-02-1/+1
| | | | | | | Fix trivial typo. Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Axel Lin <axel.lin@ingics.com>
* serial: ns16550: Support debug UARTSimon Glass2015-02-19-2/+48
| | | | | | | | Add debug UART functions to permit ns16550 to provide an early debug UART. Try to avoid using the stack so that this can be called from assembler before a stack is set up (at least on ARM and PowerPC). Signed-off-by: Simon Glass <sjg@chromium.org>
* serial: ns16550: Add access functions that don't need platdataSimon Glass2015-02-19-18/+30
| | | | | | | | For the debug UART we need to be able to provide any parameters before driver model is set up. Add parameters to the low-level access functions to make this possible. Signed-off-by: Simon Glass <sjg@chromium.org>
* serial: ns16550: Support ns16550 compatible pci uart devicesBin Meng2015-01-13-0/+31
| | | | | | | | | | | | | | There are many pci uart devices which are ns16550 compatible. We can describe them in the board dts file and use it as the U-Boot serial console as specified in the chosen node 'stdout-path' property. Those pci uart devices can have their register be memory-mapped, or i/o-mapped. The driver will try to use the memory-mapped register if the reg property in the node has an entry to describe the memory-mapped register, otherwise i/o-mapped register will be used. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* ns16550.c: Fix for ns16550 driver hanging on OMAP4Gregoire Gentil2014-12-04-4/+5
| | | | | | | | The same problem that is seen on some OMAP3 is also seen on some OMAP4 so include them in the test in order to prevent some hangs during SPL. [trini: Re-word commit message, make apply cleanly] Signed-off-by: Tom Rini <trini@ti.com>
* dm: serial: ns16550: Add a cast to the I/O operationsSimon Glass2014-10-23-2/+2
| | | | | | | This generates a warning when driver model is enabled, so fix it by adding a cast. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: ns16550: Correct the probe logic for platform dataSimon Glass2014-10-23-2/+3
| | | | | | | | | | | | The probe logic sets up the pointer to the platform data in the device tree decode method. It should be done in the probe() method, and anyway the device tree decode method can't be used when CONFIG_OF_CONTROL is not enabled. Fix these two problems. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
* dm: ns16550: Use an address instead of a pointer for the uart baseSimon Glass2014-10-23-3/+3
| | | | | | | | | | | It is inconvenient to have to use casts when specifying platform data. Also it is not strictly correct, since we should use map_sysmem() to convert an address to a pointer. Adjust the platform data to use an address. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
* dm: serial: ns16550: Correct logic for checking for characterSimon Glass2014-10-23-1/+1
| | | | | | | | | There is a bug in the logic which checks for an available character. This can cause invalid characters to be received - this was noticed on beaglebone. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
* dm: serial: Add driver model support for ns16550Simon Glass2014-09-10-2/+154
| | | | | | | | | | Add driver model support so that ns16550 can support operation both with and without driver model. The driver needs a clock frequency so cannot stand alone unfortunately. The clock frequency must be provided by a separate driver. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: serial: Collect common baud rate code in ns16550Simon Glass2014-09-10-20/+13
| | | | | | | The same sequence is used in several places, so move it into a function. Note that UART_LCR_BKSE is an alias for UART_LCR_DLAB. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: serial: Move baud rate calculation to ns16550.cSimon Glass2014-09-10-1/+17
| | | | | | | Move the function that calculates the baud rate divisor into ns16550.c so it can be used by that file. Signed-off-by: Simon Glass <sjg@chromium.org>
* omap: clean-up dead configsMasahiro Yamada2014-08-09-1/+1
| | | | | | | | | | | | | | The following configs are not defined at all. - CONFIG_OMAP1510 - CONFIG_OMAP_1510P1 - CONFIG_OMAP_SX1 - CONFIG_OMAP3_DMA - CONFIG_OMAP3_ZOOM2 - CONFIG_OMAP_INNOVATOR Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Tom Rini <trini@ti.com>
* keystone2: use CONFIG_SOC_KEYSTONE in common placesKhoronzhuk, Ivan2014-07-25-2/+2
| | | | | | | | Use CONFIG_SOC_KEYSTONE in common places instead of defining a lot of "if def .. || if def " for different Keystone2 SoC types. Acked-by: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
* serial: nsl16550: add hw flow control supportKaricheri, Muralidharan2014-05-12-0/+6
| | | | | | | | keystone serial hw support hw flow control. This patch enables hw flow control for keystone EVMs as an optional feature based on CONFIG_SERIAL_HW_FLOW_CONTROL. Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
* k2hk: add support for k2hk SOC and EVMVitaly Andrianov2014-04-17-0/+8
| | | | | | | | | | | | | | k2hk EVM is based on Texas Instruments Keystone2 Hawking/Kepler SoC. Keystone2 SoC has ARM v7 Cortex-A15 MPCore processor. Please refer the ti/k2hk_evm/README for details on the board, build and other information. This patch add support for keystone architecture and k2hk evm. Signed-off-by: Vitaly Andrianov <vitalya@ti.com> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: WingMan Kwok <w-kwok2@ti.com> Signed-off-by: Sandeep Nair <sandeep_n@ti.com>
* TI:omap3: Drop omap3_zoom2Tom Rini2014-01-07-3/+2
| | | | | | | The omap3_zoom2 board has not been updated for a correct CONFIG_SYS_HZ and Tom Rix's email has long been bouncing. Signed-off-by: Tom Rini <trini@ti.com>
* Prepare for TI816X : reuse existing code from TI814XTENART Antoine2013-08-15-2/+2
| | | | | | | | Rename some CONFIG_TI814X to a more generic CONFIG_TI81XX Signed-off-by: Antoine Tenart <atenart@adeneo-embedded.com> [trini: Adapt for CONFIG_OMAP_COMMON changes, AM43XX] Signed-off-by: Tom Rini <trini@ti.com>
* ARM: AM43xx: Add build supportLokesh Vutla2013-08-15-2/+3
| | | | | | Add AM43xx support in the required places Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
* arm: Remove OMAP2420H4 and all omap24xx supportTom Rini2013-06-10-5/+0
| | | | | | | | | The omap2420H4 was the only mainline omap24xx board. Prior to being fixed by Jon Hunter in time for v2013.04 it had been functionally broken for a very long time. Remove this board as there's not been interest in it in U-Boot for quite a long time. Signed-off-by: Tom Rini <trini@ti.com>
* omap3_beagle: Flush UART3 xmit on enable if TEMT is brokenManfred Huber2013-04-08-2/+16
| | | | | | | | | | | | Flush UART3 xmit on enable if TEMT is broken On some OMAP3 devices when UART3 is configured for boot mode before SPL starts only THRE bit is set. We have to empty the transmitter before initialization starts. This patch avoids the use of CONFIG_SYS_NS16550_BROKEN_TEMT. Signed-off-by: Manfred Huber <man.huber@arcor.de> Tested-by: Javier Martinez Canillas <javier@dowhile0.org> Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
* ns16550: enable quirks for ti814xMatt Porter2013-03-24-2/+3
| | | | | | | TI814X requires the same quirks as AM33XX to be enabled. Signed-off-by: Matt Porter <mporter@ti.com> Reviewed-by: Tom Rini <trini@ti.com>
* serial: ns16550: Remove unwanted castSimon Glass2013-03-15-1/+1
| | | | | | | | | | | This cast does not seem correct, since we should be writing to a pointer, not a ulong. This fixes the following warning on nds32: -ns16550.c:49: warning: passing argument 2 of 'writeb' makes pointer from integer without a cast Signed-off-by: Simon Glass <sjg@chromium.org>
* serial/ns16550: add an option to avoid hanging on broken platformsJavier Martinez Canillas2013-01-10-0/+2
| | | | | | | | | | | | | | | | | | Some platforms (e.g. IGEPv2 board) has a broken ns16550 UART that does not set the TEMT bit when the transmitter is empty in SPL. This makes U-Boot to hang while waiting for TEMT to be set. Add a new option to avoid this: CONFIG_SYS_NS16550_BROKEN_TEMT 16550 UART set the Transmitter Empty (TEMT) Bit when all output has finished and the transmitter is totally empty. U-Boot waits for this bit to be set to initialize the serial console. On some broken platforms this bit is not set in SPL making U-Boot to hang while waiting for TEMT. Define this option to avoid it. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>