privide ns16550 support for AR9344
Subsystems (4)
cover privide ns16550 support for AR9344
changes:
v3:
- fix compile for ppc, arm and sandbox.
v2:
- fix compile if OF is not set.
- fix compile for x86
Oleksij Rempel (4):
of: base: port of_device_is_big_endian from linux
asm-generic: partially sync io.h with linux kernel
x86: asm: include asm-generic.h
serial: ns16550: provide big-endian support
arch/arm/include/asm/io.h | 4 +- arch/ppc/include/asm/io.h | 2 + arch/sandbox/include/asm/io.h | 3 +- arch/x86/include/asm/io.h | 15 +++ drivers/of/base.c | 23 ++++ drivers/serial/serial_ns16550.c | 19 +++- include/asm-generic/io.h | 245 +++++++++++++++++++++++++++++++++++----- include/of.h | 6 + 8 files changed, 284 insertions(+), 33 deletions(-)
Signature · 7 lines
2.11.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/4 of: base: port of_device_is_big_endian from linux
|commit 37786c7fee40771d13901de129af7e084ed48b55 |Author: Kevin Cernekee <[email protected]> |Date: Thu Apr 9 13:05:14 2015 -0700 | | of: Add helper function to check MMIO register endianness | | SoC peripherals can come in several different flavors: | | - little-endian: registers always need to be accessed in LE mode (so the | kernel should perform a swap if the CPU is running BE) | | - big-endian: registers always need to be accessed in BE mode (so the | kernel should perform a swap if the CPU is running LE) | | - native-endian: the bus will automatically swap accesses, so the kernel | should never swap | | Introduce a function that checks an OF device node to see whether it | contains a "big-endian" or "native-endian" property. For the former case, | always return true. For the latter case, return true iff the kernel was | built for BE (implying that the BE MMIO accessors do not perform a swap). | Otherwise return false, assuming LE registers. | | LE registers are assumed by default because most existing drivers (libahci, | serial8250, usb) always use readl/writel in the absence of instructions | to the contrary, so that will be our fallback.
--- drivers/of/base.c | 23 +++++++++++++++++++++++ include/of.h | 6 ++++++ 2 files changed, 29 insertions(+)
drivers/of/base.c +23 -0
@@ -1622,6 +1622,29 @@ int of_device_is_available(const struct device_node *device)EXPORT_SYMBOL (of_device_is_available);/** +* of_device_is_big_endian - check if a device has BE registers +* +* @device: Node to check for endianness +* +* Returns true if the device has a "big-endian" property, or if the kernel +* was compiled for BE *and* the device has a "native-endian" property. +* Returns false otherwise. +* +* Callers would nominally use ioread32be/iowrite32be if +* of_device_is_big_endian() == true, or readl/writel otherwise. +*/ +bool of_device_is_big_endian (const struct device_node *device) +{ +if (of_property_read_bool (device,"big-endian" )) +return true; +if (IS_ENABLED (CONFIG_CPU_BIG_ENDIAN ) && +of_property_read_bool (device,"native-endian" )) +return true; +return false; +} +EXPORT_SYMBOL (of_device_is_big_endian); + +/** * of_get_parent - Get a node's parent if any * @node: Node to get parent *
include/of.h +6 -0
@@ -150,6 +150,7 @@ extern int of_machine_is_compatible(const char *compat);extern int of_device_is_compatible (const struct device_node *device,const char *compat);extern int of_device_is_available (const struct device_node *device); +extern bool of_device_is_big_endian (const struct device_node *device);extern struct device_node *of_get_parent (const struct device_node *node); extern struct device_node *of_get_next_available_child(
@@ -595,6 +596,11 @@ static inline int of_device_is_available(const struct device_node *device)return 0 ; } +static inline bool of_device_is_big_endian (const struct device_node *device) +{ +return false; +} +static inline void of_alias_scan (void ) { }
Signature · 7 lines
2.11.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/4 asm-generic: partially sync io.h with linux kernel
In reply to Oleksij Rempel--- arch/arm/include/asm/io.h | 4 +- arch/ppc/include/asm/io.h | 2 + arch/sandbox/include/asm/io.h | 3 +- include/asm-generic/io.h | 245 +++++++++++++++++++++++++++++++++++++----- 4 files changed, 223 insertions(+), 31 deletions(-)
arch/arm/include/asm/io.h +2 -2
@@ -1,10 +1,10 @@#ifndef __ASM_ARM_IO_H#define __ASM_ARM_IO_H -#include <asm-generic/io.h> -#define IO_SPACE_LIMIT 0 +#include <asm-generic/io.h> +/* * String version of IO memory access ops: */
arch/ppc/include/asm/io.h +2 -0
@@ -244,4 +244,6 @@ void ppcDcbi(unsigned long value);void ppcSync (void );void ppcDcbz (unsigned long value); +#include <asm-generic/io.h> +#endif
arch/sandbox/include/asm/io.h +2 -1
@@ -1,7 +1,8 @@#ifndef __ASM_SANDBOX_IO_H#define __ASM_SANDBOX_IO_H -#include <asm-generic/io.h> #define IO_SPACE_LIMIT 0 +#include <asm-generic/io.h> +#endif /* __ASM_SANDBOX_IO_H */
include/asm-generic/io.h +217 -28
301 lines not on this page · raw message
Signature · 7 lines
2.11.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/4 x86: asm: include asm-generic.h
In reply to Oleksij Rempelmake io[read,write]* defines available on x86 platform
--- arch/x86/include/asm/io.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/x86/include/asm/io.h +15 -0
@@ -61,6 +61,19 @@ BUILDIO(b, b, char) BUILDIO(w, w, short) BUILDIO(l, , int) +#define outb outb +#define outw outw +#define outl outb +#define inb inb +#define inw inw +#define inl inl +#define outsb outsb +#define outsw outsw +#define outsl outsb +#define insb insb +#define insw insw +#define insl insl +#define IO_SPACE_LIMIT 0xffff/* do a tiny io delay */
@@ -69,4 +82,6 @@ static inline void io_delay(void) inb(0x80); } +#include <asm-generic/io.h> +#endif /* __ASM_X86_IO_H */
Signature · 7 lines
2.11.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/4 serial: ns16550: provide big-endian support
In reply to Oleksij Rempelwe need it at least for QCA AR9344
--- drivers/serial/serial_ns16550.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/serial/serial_ns16550.c +17 -2
@@ -94,6 +94,16 @@ static void ns16550_write_reg_mmio_32(struct ns16550_priv *priv, uint8_t val, unwritel (val, priv->mmiobase + offset); } +static uint8_t ns16550_read_reg_mmio_32be (struct ns16550_priv *priv,unsigned offset) +{ +return ioread32be (priv->mmiobase + offset); +} + +static void ns16550_write_reg_mmio_32be (struct ns16550_priv *priv,uint8_t val,unsigned offset) +{ +iowrite32be (val, priv->mmiobase + offset); +} +static uint8_t ns16550_read_reg_ioport_8 (struct ns16550_priv *priv,unsigned offset) {return inb (priv->iobase + offset);
@@ -305,8 +315,13 @@ static void ns16550_probe_dt(struct device_d *dev, struct ns16550_priv *priv) priv->write_reg = ns16550_write_reg_mmio_16;break ;case 4 : - priv->read_reg = ns16550_read_reg_mmio_32; - priv->write_reg = ns16550_write_reg_mmio_32; +if (of_device_is_big_endian (np)) { + priv->read_reg = ns16550_read_reg_mmio_32be; + priv->write_reg = ns16550_write_reg_mmio_32be; + }else { + priv->read_reg = ns16550_read_reg_mmio_32; + priv->write_reg = ns16550_write_reg_mmio_32; + }break ;default : dev_err(dev, "unsupported reg-io-width (%d)\n",
Signature · 7 lines
2.11.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Subject -> provide
~
Quoted 33 lines · Oleksij Rempel
changes:
v3:
- fix compile for ppc, arm and sandbox.v2:
- fix compile if OF is not set.
- fix compile for x86Oleksij Rempel (4):
of: base: portof_device_is_big_endianfrom linux
asm-generic: partially syncio.hwith linux kernel
x86: asm: includeasm-generic.h
serial: ns16550: provide big-endian supportarch/arm/include/asm/io.h | 4 +- arch/ppc/include/asm/io.h | 2 + arch/sandbox/include/asm/io.h | 3 +- arch/x86/include/asm/io.h | 15 +++ drivers/of/base.c | 23 ++++ drivers/serial/serial_ns16550.c | 19 +++- include/asm-generic/io.h | 245 +++++++++++++++++++++++++++++++++++----- include/of.h | 6 + 8 files changed, 284 insertions(+), 33 deletions(-)Signature · 7 lines
2.11.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 7 lines · Oleksij Rempel
changes:
v3:
- fix compile for ppc, arm and sandbox.v2:
- fix compile if OF is not set.
- fix compile for x86
Applied, thanks
Sascha
Quoted 26 lines
Oleksij Rempel (4):
of: base: portof_device_is_big_endianfrom linux
asm-generic: partially syncio.hwith linux kernel
x86: asm: includeasm-generic.h
serial: ns16550: provide big-endian supportarch/arm/include/asm/io.h | 4 +- arch/ppc/include/asm/io.h | 2 + arch/sandbox/include/asm/io.h | 3 +- arch/x86/include/asm/io.h | 15 +++ drivers/of/base.c | 23 ++++ drivers/serial/serial_ns16550.c | 19 +++- include/asm-generic/io.h | 245 +++++++++++++++++++++++++++++++++++----- include/of.h | 6 + 8 files changed, 284 insertions(+), 33 deletions(-)Signature · 7 lines
2.11.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox