summaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_ns16550.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* include: Move ns16550 serial platform_data to include/platform_dataSascha Hauer2016-04-151-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-071-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 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>
* 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>
* of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-301-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'for-next/tegra'Sascha Hauer2014-11-051-0/+12
|\
| * serial: ns16550: add Tegra supportLucas Stach2014-11-041-0/+11
| | | | | | | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * serial: ns16550: enable clock if availableLucas Stach2014-11-041-0/+1
| | | | | | | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial: ns16550: Remove unused fields from NS16550_plat structureAlexander Shiyan2014-11-031-4/+1
|/ | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let request_ioport_region return an error pointerSascha Hauer2014-09-161-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let dev_request_mem_region return an error pointerSascha Hauer2014-09-161-0/+2
| | | | | | For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let dev_get_resource return an error pointerSascha Hauer2014-09-161-4/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: Add register read/write function pointers to private dataSascha Hauer2014-07-141-114/+120
| | | | | | | Makes the code a bit cleaner. This also avoids casting from a pointer to a 32bit integer which may produce compiler warnings. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: Add mmiobase to private dataSascha Hauer2014-07-141-9/+8
| | | | | | | We have a private data struct, so use it for storing the base address instead of abusing the dev->priv field. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ioresource'Sascha Hauer2014-05-051-16/+107
|\
| * x86: ns16550: Rework driver to allow for x86 I/O spaceMichel Stam2014-04-091-16/+107
| | | | | | | | | | | | | | | | | | | | | | | | The current implementation fakes a memory-mapped I/O device at 0x3f8 and 0x2f8, then uses platform read/write functions to do the actual reading and writing. These platform functions only exist for the x86 platform; better to move the I/O routines into the driver and have the driver request I/O ports using request_ioport_region. Signed-off-by: Michel Stam <michel@reverze.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial: ns16550: omap: set register shift from codeSascha Hauer2014-04-281-0/+4
|/ | | | | | | | The upstream dts files do not contain the register shift. As we have Omap specific init code anyway we can just set the register shift from there instead of relying on the devicetree properties. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: add compatible entry for "ingenic,jz4740-uart"Antony Pavlov2014-03-261-0/+20
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: add compatible entry for "ns16450"Antony Pavlov2014-03-261-0/+16
| | | | | | | "ns16450" uses the same code as "ns16550a" but with FIFO disabled. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: make FCR setup value part of struct ns16550_privAntony Pavlov2014-03-261-6/+7
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: fix whitespacesAntony Pavlov2014-03-261-1/+1
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* console: Set Linux console parameter automaticallySascha Hauer2014-01-221-0/+3
| | | | | | | | | | | | | | | | | | | | | Linux specifies the linux,stdout-path property in the /chosen node in the devicetree. Unfortunately this is ignored in most cases. For cases in which barebox uses this property for its own use we translate this into a Linux boot arg with: - the console name provided by the serial driver - the the instance from the 'serial' alias - the baudrate from the actual baudrate. So with this it's for devicetee enabled boards no longer necessary to manually assign a console= parameter. Should a user not want to use the automatically assigned parameter it should do: global.linux.bootargs.console= in the environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: Add device ids for omapSascha Hauer2013-11-221-8/+54
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/socfpga'Sascha Hauer2013-10-071-0/+2
|\ | | | | | | | | Conflicts: scripts/Makefile
| * serial: ns16550: Add compatible entry for snps,dw-apb-uartSascha Hauer2013-09-231-0/+2
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | serial: do not set default baudrate at initJean-Christophe PLAGNIOL-VILLARD2013-09-221-2/+0
| | | | | | | | | | | | | | this will be done at activation Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | console: drop f_caps and check the function pointer getc/putc insteadJean-Christophe PLAGNIOL-VILLARD2013-09-211-1/+0
|/ | | | | | | | | | None of the driver make the difference between STDOUT and STDERR. So we just need to check if putc or getc are filled in the console_device save 32 bytes on versatilepb Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: fill cdev just-in-timeAntony Pavlov2013-07-241-2/+1
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: get clock-frequency from dtAntony Pavlov2013-07-241-0/+6
| | | | | | | | | This patch helps clk-less boards to use device tree for clock frequency probing (taken from linux.git/drivers/tty/serial/of_serial.c). Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: Add devicetree probe supportSascha Hauer2013-07-231-1/+24
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: Add clk support and make platform_data optionalSascha Hauer2013-07-231-3/+23
| | | | | | | | The clockrate was the only really needed field from platform data. Add clk support to retrieve the clockrate and make platform data optional. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: remove f_caps from platform_dataSascha Hauer2013-07-231-4/+1
| | | | | | | So far no user had the need to set the flags, so just remove them from platform data. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: introduce private structSascha Hauer2013-07-231-9/+28
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial: ns16550: reorder functions to avoid forward declarationSascha Hauer2013-07-231-31/+28
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Introduce console_platform_driver() macro and use it for serial driversAlexander Shiyan2013-03-141-12/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* switch all platform_bus device/driver registering to ↵Jean-Christophe PLAGNIOL-VILLARD2012-10-041-2/+2
| | | | | | | | platform_driver/device_register now register_driver and register_device are for bus only usage. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial_ns16550: change the driver's nameAntony Pavlov2012-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The name "serial_ns16550" is not handy because the devices will have the names like "serial_ns165500", "serial_ns165501", "serial_ns165502" etc. The names like "ns16550_serial0" and "ns16550_serial1" look much better. Also it is reasonable to make serial driver's names unification. E.g. see the names for drivers in drivers/serial directory: "netx_serial", "mpc5xxx_serial", "altera_serial", "s3c_serial", "imx_serial", "pxa_serial", "blackfin_serial", "stm_serial", "pl010_serial", and even "g_serial" in ./drivers/usb/gadget/serial.c Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial drivers: remove unused type_dataSascha Hauer2012-02-251-1/+0
| | | | | | | Several serial drivers set the type_data field without ever using it, so just remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ns16550: fix ier selectionAntony Pavlov2012-01-191-0/+2
| | | | | | | | | | | | | | The document "PC16550D Universal Asynchronous Receiver Transmitter with FIFOs" (vers. June 1995, http://www.national.com/ds/PC/PC16550D.pdf) states that IER (Interrupt Enable Register) is accessible if the bit DLAB = 0 (DLAB is bit 7 in LCR; in barebox DLAB known as LCR_BKSE). So before IER access we need set DLAB to 0. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ns16550: write zero to ier only onceAntony Pavlov2012-01-191-1/+0
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ns16550: make ns16550_serial_init_port() shorterAntony Pavlov2012-01-191-17/+3
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ns16550: support for UART with broken FIFOAntony Pavlov2012-01-191-2/+16
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* introduce io.hSascha Hauer2011-09-221-1/+1
| | | | | | | To allow for some generic io accessors introduce io.h and use this instead of asm/io.h throughout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial_ns16550: drop the non working checkJean-Christophe PLAGNIOL-VILLARD2011-08-041-3/+0
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ns16550: switch to resourceJean-Christophe PLAGNIOL-VILLARD2011-08-011-37/+89
| | | | | | | use generic read/write depending on the memory size if no reg_read/write defined Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* ns16550: if not specific f_caps defined use default stdin, stdout, stderrJean-Christophe PLAGNIOL-VILLARD2011-07-301-1/+4
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* serial_ns16550: remove legacy code copied from U-Boot v1Antony Pavlov2011-07-171-19/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* serial 16550: use xzallocSascha Hauer2011-04-111-3/+1
| | | | | | | No need to check for the result and increases the chance that we build a binary without the rarely used calloc function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>