UART driver support for BMIPS multiplatform kernels
Subsystems (4)
v2 cover UART driver support for BMIPS multiplatform kernels
V1->V2:
Add a new UPIO_MEM32BE iotype instead of a separate big_endian flag.
Change some of the of_*_is_* APIs to return bool, where appropriate.
Fix a few minor comment issues.
Kevin Cernekee (9):
serial: core: Add big-endian iotype
of: Fix of_device_is_compatible() comment
of: Change of_device_is_available() to return bool
of: Add helper function to check MMIO register endianness
serial: pxa: Add fifo-size and {big,native}-endian properties
serial: pxa: Make the driver buildable for BCM7xxx set-top platforms
serial: pxa: Update DT binding documentation
serial: earlycon: Set UPIO_MEM32BE based on DT properties
serial: pxa: Add OF_EARLYCON support
Tushar Behera (1):
tty: Fallback to use dynamic major number
.../devicetree/bindings/serial/mrvl-serial.txt | 34 +++++++++++- drivers/of/base.c | 47 ++++++++++++---- drivers/of/fdt.c | 9 ++- drivers/tty/serial/Kconfig | 2 +- drivers/tty/serial/earlycon.c | 4 +- drivers/tty/serial/pxa.c | 64 +++++++++++++++++++++- drivers/tty/serial/serial_core.c | 2 + drivers/tty/tty_io.c | 19 ++++++- include/linux/of.h | 12 +++- include/linux/serial_core.h | 15 ++--- 10 files changed, 176 insertions(+), 32 deletions(-)
Signature · 1 line
2.1.1
PATCH v2 1/10 tty: Fallback to use dynamic major number
From: Tushar Behera <[email protected]>
In a multi-platform scenario, the hard-coded major/minor numbers in serial drivers may conflict with each other. A typical scenario is observed with amba-pl011 and samsung-uart drivers, both of these drivers use same set of major/minor numbers. If both of these drivers are enabled, probe of samsung-uart driver fails because the desired node is busy.
The issue is fixed by adding a fallback in driver core, so that we can use dynamic major number in case device node allocation fails for hard-coded major/minor number.
--- drivers/tty/tty_io.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/tty/tty_io.c +16 -3
@@ -3365,6 +3365,22 @@ int tty_register_driver(struct tty_driver *driver)dev_t dev;struct device *d; +if (driver->major) { + dev =MKDEV (driver->major, driver->minor_start); + error =register_chrdev_region (dev, driver->num, driver->name); +/* In case of error, fall back to dynamic allocation */ +if (error <0 ) { +pr_warn ("Default device node (%d:%d) for %s is busy, using dynamic major number\n" , + driver->major, driver->minor_start, + driver->name); + driver->major =0 ; + } + } + +/* +* Don't replace the following check with an else to above if statement, +* as it may also be called as a fallback. +*/ if (!driver->major) { error =alloc_chrdev_region (&dev, driver->minor_start, driver->num, driver->name);
@@ -3372,9 +3388,6 @@ int tty_register_driver(struct tty_driver *driver) driver->major =MAJOR (dev); driver->minor_start =MINOR (dev); } - }else { - dev =MKDEV (driver->major, driver->minor_start); - error =register_chrdev_region (dev, driver->num, driver->name); }if (error <0 ) goto err;
Signature · 1 line
2.1.1
Greg KH
maintainerRe: [PATCH V2 01/10] tty: Fallback to use dynamic major number
Quoted 1 line · Kevin Cernekee
From: Tushar Behera <[email protected]>
This email bounces, so I'm going to have to reject this patch. I can't accept a patch from a "fake" person, let alone something that touches core code like this.
Sorry, I can't accept anything in this series then.
greg k-h
Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
Quoted 8 lines · Greg KH
Quoted 1 line · Kevin Cernekee
From: Tushar Behera <[email protected]>
This email bounces, so I'm going to have to reject this patch. I can't accept a patch from a "fake" person, let alone something that touches core code like this.
Sorry, I can't accept anything in this series then.
Oops, guess I probably should have updated his address after the V1 emails bounced...
Before I send a new version, what do you think about the overall approach? Should we try to make serial8250 coexist with the other "ttyS / major 4 / minor 64" drivers (possibly at the expense of compatibility) or is it better to start with a simpler, cleaner driver like serial/pxa?
Greg KH
maintainerRe: [PATCH V2 01/10] tty: Fallback to use dynamic major number
Quoted 10 lines · Kevin Cernekee
Quoted 8 lines · Greg KH
Quoted 1 line · Kevin Cernekee
From: Tushar Behera <[email protected]>
This email bounces, so I'm going to have to reject this patch. I can't accept a patch from a "fake" person, let alone something that touches core code like this.
Sorry, I can't accept anything in this series then.
Quoted 8 lines
Oops, guess I probably should have updated his address after the V1 emails bounced...
Before I send a new version, what do you think about the overall approach? Should we try to make serial8250 coexist with the other "ttyS / major 4 / minor 64" drivers (possibly at the expense of compatibility) or is it better to start with a simpler, cleaner driver like serial/pxa?
We can't do anything "at the expense of compatibility", sorry.
Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
In reply to Kevin CernekeeQuoted 10 lines · Kevin Cernekee
Quoted 8 lines · Greg KH
Quoted 1 line · Kevin Cernekee
From: Tushar Behera <[email protected]>
This email bounces, so I'm going to have to reject this patch. I can't accept a patch from a "fake" person, let alone something that touches core code like this.
Sorry, I can't accept anything in this series then.
Quoted 8 lines
Oops, guess I probably should have updated his address after the V1 emails bounced...
Before I send a new version, what do you think about the overall approach? Should we try to make serial8250 coexist with the other "ttyS / major 4 / minor 64" drivers (possibly at the expense of compatibility) or is it better to start with a simpler, cleaner driver like serial/pxa?
Co-existing really needs to be fixed. The way to handle this might be to blacklist the creation of the first 4 8250 devices on certain platforms. It's going to be painful unfortunately.
g.
Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
Quoted 16 lines · Grant Likely
Quoted 13 lines · Kevin Cernekee
Quoted 8 lines · Greg KH
Quoted 1 line · Kevin Cernekee
From: Tushar Behera <[email protected]>
This email bounces, so I'm going to have to reject this patch. I can't accept a patch from a "fake" person, let alone something that touches core code like this.
Sorry, I can't accept anything in this series then.
Oops, guess I probably should have updated his address after the V1 emails bounced...
Quoted 7 lines
Quoted 5 lines
Before I send a new version, what do you think about the overall approach? Should we try to make serial8250 coexist with the other "ttyS / major 4 / minor 64" drivers (possibly at the expense of compatibility) or is it better to start with a simpler, cleaner driver like serial/pxa?
Co-existing really needs to be fixed.
What are the requirements for co-existence?
Is it sufficient to provide 1st come-1st served minor allocation?
Anything done should be designed to solve this name problem forever, not some expeditious band-aid.
Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
Quoted 23 lines · Peter Hurley
Quoted 22 lines · Grant Likely
Quoted 18 lines · Kevin Cernekee
Quoted 8 lines · Greg KH
Quoted 1 line · Kevin Cernekee
From: Tushar Behera <[email protected]>
This email bounces, so I'm going to have to reject this patch. I can't accept a patch from a "fake" person, let alone something that touches core code like this.
Sorry, I can't accept anything in this series then.
Oops, guess I probably should have updated his address after the V1 emails bounced...
Before I send a new version, what do you think about the overall approach? Should we try to make serial8250 coexist with the other "ttyS / major 4 / minor 64" drivers (possibly at the expense of compatibility) or is it better to start with a simpler, cleaner driver like serial/pxa?
Quoted 7 lines
Quoted 1 line
Co-existing really needs to be fixed.
What are the requirements for co-existence?
Is it sufficient to provide 1st come-1st served minor allocation?Anything done should be designed to solve this name problem forever, not some expeditious band-aid.
+1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
In reply to Peter HurleyQuoted 23 lines · Peter Hurley
Quoted 22 lines · Grant Likely
Quoted 18 lines · Kevin Cernekee
Quoted 8 lines · Greg KH
Quoted 1 line · Kevin Cernekee
From: Tushar Behera <[email protected]>
This email bounces, so I'm going to have to reject this patch. I can't accept a patch from a "fake" person, let alone something that touches core code like this.
Sorry, I can't accept anything in this series then.
Oops, guess I probably should have updated his address after the V1 emails bounced...
Before I send a new version, what do you think about the overall approach? Should we try to make serial8250 coexist with the other "ttyS / major 4 / minor 64" drivers (possibly at the expense of compatibility) or is it better to start with a simpler, cleaner driver like serial/pxa?
Quoted 4 lines
Quoted 1 line
Co-existing really needs to be fixed.
What are the requirements for co-existence?
Is it sufficient to provide 1st come-1st served minor allocation?
Should be sufficient. Basically, if the hardware doesn't exist, the driver shouldn't be trying to grab the minor numbers.
Also, on hardware where both exists, there should be some sane fallback so that all UARTs get assigned numbers. On DT systems we can also use /aliases to ensure consistent assignment of numbers.
g.
Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
Quoted 9 lines · On Thursday 27 November 2014 13:50:01 Grant Likely wrote:
Should be sufficient. Basically, if the hardware doesn't exist, the driver shouldn't be trying to grab the minor numbers.
Also, on hardware where both exists, there should be some sane fallback so that all UARTs get assigned numbers. On DT systems we can also use /aliases to ensure consistent assignment of numbers.
From what I can see, this is really the ISA compatibility code
in the 8250 driver, and we should be able to make that optional or even move it into a separate glue driver.
Basically the serial8250_init function tries to do a lot of things at once (skipping error handling):
serial8250_isa_init_ports();
ret = sunserial_register_minors(&serial8250_reg, UART_NR);
serial8250_reg.nr = UART_NR;
ret = uart_register_driver(&serial8250_reg);
ret = serial8250_pnp_init();
serial8250_isa_devs = platform_device_alloc("serial8250",
PLAT8250_DEV_LEGACY);
ret = platform_device_add(serial8250_isa_devs);
serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
ret = platform_driver_register(&serial8250_isa_driver);The only thing we want from this is the uart_register_driver() call, everything else is only needed together with the ISA support. The way that uart_register_driver() works unfortunately implies that you know the maximum number of ports at driver init time, which would need to be changed if you want to share the numbers.
One idea I had a few years ago when we discussed this was to treat the major 4 allocation differently so you could share it between all sorts of drivers as an opt-in, but could have all unmodified continue using their own device names and numbers.
Arnd
PATCH v2 2/10 serial: core: Add big-endian iotype
In reply to Kevin CernekeeSince most drivers interpret UPIO_MEM32 to mean "little-endian" and use readl/writel to access the registers, add a parallel UPIO_MEM32BE to request the use of big-endian MMIO accessors (ioread32be/iowrite32be).
--- drivers/tty/serial/serial_core.c | 2 ++ include/linux/serial_core.h | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/tty/serial/serial_core.c +2 -0
@@ -2092,6 +2092,7 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)break ;case UPIO_MEM :case UPIO_MEM32 : +case UPIO_MEM32BE :case UPIO_AU :case UPIO_TSI : snprintf(address, sizeof(address),
@@ -2736,6 +2737,7 @@ int uart_match_port(struct uart_port *port1, struct uart_port *port2) (port1->hub6 == port2->hub6);case UPIO_MEM :case UPIO_MEM32 : +case UPIO_MEM32BE :case UPIO_AU :case UPIO_TSI :return (port1->mapbase == port2->mapbase);
include/linux/serial_core.h +7 -6
@@ -140,12 +140,13 @@ struct uart_port {unsigned char iotype;/* io access style */ unsigned char unused1; -#define UPIO_PORT (0) -#define UPIO_HUB6 (1) -#define UPIO_MEM (2) -#define UPIO_MEM32 (3) -#define UPIO_AU (4)/* Au1x00 and RT288x type IO */ -#define UPIO_TSI (5)/* Tsi108/109 type IO */ +#define UPIO_PORT (0)/* 8b I/O port access */ +#define UPIO_HUB6 (1)/* Hub6 ISA card */ +#define UPIO_MEM (2)/* 8b MMIO access */ +#define UPIO_MEM32 (3)/* 32b little endian */ +#define UPIO_MEM32BE (4)/* 32b big endian */ +#define UPIO_AU (5)/* Au1x00 and RT288x type IO */ +#define UPIO_TSI (6)/* Tsi108/109 type IO */ unsigned int read_status_mask;/* driver specific */ unsigned int ignore_status_mask;/* driver specific */
Signature · 1 line
2.1.1
PATCH v2 3/10 of: Fix of_device_is_compatible() comment
In reply to Kevin CernekeeThis function passes back a value from __of_device_is_compatible(), which returns a score in the range 0..11, not a bool.
--- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/base.c +1 -1
@@ -485,7 +485,7 @@ EXPORT_SYMBOL(of_device_is_compatible);* of_machine_is_compatible - Test root of device tree for a given compatible value * @compat: compatible string to look for in root node's compatible property. * -* Returns true if the root node has the given value in its +* Returns a positive integer if the root node has the given value in its * compatible property. */ int of_machine_is_compatible (const char *compat)
Signature · 1 line
2.1.1
Grant Likely
AppliedRe: [PATCH V2 03/10] of: Fix of_device_is_compatible() comment
Quoted 4 lines · Kevin Cernekee
This function passes back a value from
__of_device_is_compatible(), which returns a score in the range 0..11, not a bool.Signed-off-by Kevin Cernekee <[email protected]>
Applied, thanks.
g.
Quoted 20 lines
--- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/of/base.c +1
-1@@ -485,7 +485,7 @@ EXPORT_SYMBOL(of_device_is_compatible);* of_machine_is_compatible - Test root of device tree for a given compatible value * @compat: compatible string to look for in root node's compatible property. * -* Returns true if the root node has the given value in its +* Returns a positive integer if the root node has the given value in its * compatible property. */ int of_machine_is_compatible (const char *compat)Signature · 1 line
2.1.1
PATCH v2 4/10 of: Change of_device_is_available() to return bool
In reply to Kevin CernekeeThis function can only return true or false; using a bool makes it more obvious to the reader.
--- drivers/of/base.c | 22 +++++++++++----------- include/linux/of.h | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/of/base.c +11 -11
@@ -507,27 +507,27 @@ EXPORT_SYMBOL(of_machine_is_compatible);* * @device: Node to check for availability, with locks already held * -* Returns 1 if the status property is absent or set to "okay" or "ok", -* 0 otherwise +* Returns true if the status property is absent or set to "okay" or "ok", +* false otherwise */ -static int __of_device_is_available (const struct device_node *device) +static bool __of_device_is_available (const struct device_node *device) {const char *status;int statlen;if (!device) -return 0 ; +return false; status =__of_get_property (device,"status" , &statlen);if (status ==NULL ) -return 1 ; +return true;if (statlen >0 ) {if (!strcmp (status,"okay" ) || !strcmp (status,"ok" )) -return 1 ; +return true; } -return 0 ; +return false; }/**
@@ -535,13 +535,13 @@ static int __of_device_is_available(const struct device_node *device)* * @device: Node to check for availability * -* Returns 1 if the status property is absent or set to "okay" or "ok", -* 0 otherwise +* Returns true if the status property is absent or set to "okay" or "ok", +* false otherwise */ -int of_device_is_available (const struct device_node *device) +bool of_device_is_available (const struct device_node *device) {unsigned long flags; -int res; +bool res;raw_spin_lock_irqsave (&devtree_lock, flags); res =__of_device_is_available (device);
include/linux/of.h +3 -3
@@ -275,7 +275,7 @@ extern int of_property_read_string_helper(struct device_node *np, const char **out_strs, size_t sz, int index);extern int of_device_is_compatible (const struct device_node *device,const char *); -extern int of_device_is_available (const struct device_node *device); +extern bool of_device_is_available (const struct device_node *device);extern const void *of_get_property (const struct device_node *node,const char *name,int *lenp);
@@ -426,9 +426,9 @@ static inline int of_device_is_compatible(const struct device_node *device,return 0 ; } -static inline int of_device_is_available (const struct device_node *device) +static inline bool of_device_is_available (const struct device_node *device) { -return 0 ; +return false; } static inline struct property *of_find_property(const struct device_node *np,
Signature · 1 line
2.1.1
Grant Likely
AppliedRe: [PATCH V2 04/10] of: Change of_device_is_available() to return bool
Quoted 4 lines · Kevin Cernekee
This function can only return true or false; using a bool makes it more obvious to the reader.
Signed-off-by Kevin Cernekee <[email protected]>
Applied, thanks.
g.
Quoted 90 lines
--- drivers/of/base.c | 22 +++++++++++----------- include/linux/of.h | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-)drivers/of/base.c +11
-11@@ -507,27 +507,27 @@ EXPORT_SYMBOL(of_machine_is_compatible);* * @device: Node to check for availability, with locks already held * -* Returns 1 if the status property is absent or set to "okay" or "ok", -* 0 otherwise +* Returns true if the status property is absent or set to "okay" or "ok", +* false otherwise */ -static int __of_device_is_available (const struct device_node *device) +static bool __of_device_is_available (const struct device_node *device) {const char *status;int statlen;if (!device) -return 0 ; +return false; status =__of_get_property (device,"status" , &statlen);if (status ==NULL ) -return 1 ; +return true;if (statlen >0 ) {if (!strcmp (status,"okay" ) || !strcmp (status,"ok" )) -return 1 ; +return true; } -return 0 ; +return false; }/** @@ -535,13 +535,13 @@ static int __of_device_is_available(const struct device_node *device)* * @device: Node to check for availability * -* Returns 1 if the status property is absent or set to "okay" or "ok", -* 0 otherwise +* Returns true if the status property is absent or set to "okay" or "ok", +* false otherwise */ -int of_device_is_available (const struct device_node *device) +bool of_device_is_available (const struct device_node *device) {unsigned long flags; -int res; +bool res;raw_spin_lock_irqsave (&devtree_lock, flags); res =__of_device_is_available (device);include/linux/of.h +3
-3@@ -275,7 +275,7 @@ extern int of_property_read_string_helper(struct device_node *np, const char **out_strs, size_t sz, int index);extern int of_device_is_compatible (const struct device_node *device,const char *); -extern int of_device_is_available (const struct device_node *device); +extern bool of_device_is_available (const struct device_node *device);extern const void *of_get_property (const struct device_node *node,const char *name,int *lenp);@@ -426,9 +426,9 @@ static inline int of_device_is_compatible(const struct device_node *device,return 0 ; } -static inline int of_device_is_available (const struct device_node *device) +static inline bool of_device_is_available (const struct device_node *device) { -return 0 ; +return false; } static inline struct property *of_find_property(const struct device_node *np,Signature · 1 line
2.1.1
PATCH v2 5/10 of: Add helper function to check MMIO register endianness
In reply to Kevin CernekeeSoC 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/linux/of.h | 6 ++++++ 2 files changed, 29 insertions(+)
drivers/of/base.c +23 -0
@@ -552,6 +552,29 @@ bool 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/linux/of.h +6 -0
@@ -276,6 +276,7 @@ extern int of_property_read_string_helper(struct device_node *np,extern int of_device_is_compatible (const struct device_node *device,const char *);extern bool of_device_is_available (const struct device_node *device); +extern bool of_device_is_big_endian (const struct device_node *device);extern const void *of_get_property (const struct device_node *node,const char *name,int *lenp);
@@ -431,6 +432,11 @@ static inline bool of_device_is_available(const struct device_node *device)return false; } +static inline bool of_device_is_big_endian (const struct device_node *device) +{ +return false; +} +static inline struct property *of_find_property (const struct device_node *np,const char *name,int *lenp)
Signature · 1 line
2.1.1
Re: [PATCH V2 05/10] of: Add helper function to check MMIO register endianness
Quoted 16 lines · Kevin Cernekee
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.
Quoted 3 lines
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.
This is proposing a new binding, or at least a common pattern to be used by other bindings. It should be documented under Documentation/devicetree/bindings/. I suggest creating a new file under bindings/common-properties.txt
Otherwise looks fine to me. We'll give it a week to see if there are any other comments, but I think this looks fine.
g.
Quoted 68 lines
Signed-off-by Kevin Cernekee <[email protected]>--- drivers/of/base.c | 23 +++++++++++++++++++++++ include/linux/of.h | 6 ++++++ 2 files changed, 29 insertions(+)drivers/of/base.c +23
-0@@ -552,6 +552,29 @@ bool 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/linux/of.h +6
-0@@ -276,6 +276,7 @@ extern int of_property_read_string_helper(struct device_node *np,extern int of_device_is_compatible (const struct device_node *device,const char *);extern bool of_device_is_available (const struct device_node *device); +extern bool of_device_is_big_endian (const struct device_node *device);extern const void *of_get_property (const struct device_node *node,const char *name,int *lenp);@@ -431,6 +432,11 @@ static inline bool of_device_is_available(const struct device_node *device)return false; } +static inline bool of_device_is_big_endian (const struct device_node *device) +{ +return false; +} +static inline struct property *of_find_property (const struct device_node *np,const char *name,int *lenp)Signature · 1 line
2.1.1
PATCH v2 6/10 serial: pxa: Add fifo-size and {big,native}-endian properties
In reply to Kevin CernekeeWith a few tweaks, the PXA serial driver can handle other 16550A clones. Add a fifo-size DT property to override the FIFO depth (BCM7xxx uses 32), and {native,big}-endian properties similar to regmap to support SoCs that have BE or "automagic endian" registers.
--- drivers/tty/serial/pxa.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/tty/serial/pxa.c +16 -2
@@ -60,13 +60,19 @@ struct uart_pxa_port {static inline unsigned int serial_in (struct uart_pxa_port *up,int offset) { offset <<=2 ; -return readl (up->port.membase + offset); +if (up->port.iotype ==UPIO_MEM32BE ) +return ioread32be (up->port.membase + offset); +else +return readl (up->port.membase + offset); }static inline void serial_out (struct uart_pxa_port *up,int offset,int value) { offset <<=2 ; -writel (value, up->port.membase + offset); +if (up->port.iotype ==UPIO_MEM32BE ) +iowrite32be (value, up->port.membase + offset); +else +writel (value, up->port.membase + offset); }static void serial_pxa_enable_ms (struct uart_port *port)
@@ -833,6 +839,7 @@ static int serial_pxa_probe_dt(struct platform_device *pdev, {struct device_node *np = pdev->dev.of_node;int ret; +u32 val;if (!np)return 1 ;
@@ -843,6 +850,13 @@ static int serial_pxa_probe_dt(struct platform_device *pdev,return ret; } sport->port.line = ret; + +if (of_property_read_u32 (np,"fifo-size" , &val) ==0 ) + sport->port.fifosize = val; + + sport->port.iotype = +of_device_is_big_endian (np) ?UPIO_MEM32BE :UPIO_MEM32 ; +return 0 ; }
Signature · 1 line
2.1.1
Re: [PATCH V2 06/10] serial: pxa: Add fifo-size and {big,native}-endian properties
Quoted 4 lines · Kevin Cernekee
With a few tweaks, the PXA serial driver can handle other 16550A clones. Add a fifo-size DT property to override the FIFO depth (BCM7xxx uses 32), and {native,big}-endian properties similar to regmap to support SoCs that have BE or "automagic endian" registers.
Hold the phone, if these are 16550A clone ports, then why is the pxa driver being adapted to drive them? I would expect the of_serial.c driver to be used. It's already got support for multiple variants of the 16550.
g.
Quoted 57 lines
Signed-off-by Kevin Cernekee <[email protected]>--- drivers/tty/serial/pxa.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)drivers/tty/serial/pxa.c +16
-2@@ -60,13 +60,19 @@ struct uart_pxa_port {static inline unsigned int serial_in (struct uart_pxa_port *up,int offset) { offset <<=2 ; -return readl (up->port.membase + offset); +if (up->port.iotype ==UPIO_MEM32BE ) +return ioread32be (up->port.membase + offset); +else +return readl (up->port.membase + offset); }static inline void serial_out (struct uart_pxa_port *up,int offset,int value) { offset <<=2 ; -writel (value, up->port.membase + offset); +if (up->port.iotype ==UPIO_MEM32BE ) +iowrite32be (value, up->port.membase + offset); +else +writel (value, up->port.membase + offset); }static void serial_pxa_enable_ms (struct uart_port *port)@@ -833,6 +839,7 @@ static int serial_pxa_probe_dt(struct platform_device *pdev, {struct device_node *np = pdev->dev.of_node;int ret; +u32 val;if (!np)return 1 ;@@ -843,6 +850,13 @@ static int serial_pxa_probe_dt(struct platform_device *pdev,return ret; } sport->port.line = ret; + +if (of_property_read_u32 (np,"fifo-size" , &val) ==0 ) + sport->port.fifosize = val; + + sport->port.iotype = +of_device_is_big_endian (np) ?UPIO_MEM32BE :UPIO_MEM32 ; +return 0 ; }Signature · 1 line
2.1.1
Re: [PATCH V2 06/10] serial: pxa: Add fifo-size and {big,native}-endian properties
Quoted 8 lines · Grant Likely
Quoted 4 lines · Kevin Cernekee
With a few tweaks, the PXA serial driver can handle other 16550A clones. Add a fifo-size DT property to override the FIFO depth (BCM7xxx uses 32), and {native,big}-endian properties similar to regmap to support SoCs that have BE or "automagic endian" registers.
Quoted 4 lines
Hold the phone, if these are 16550A clone ports, then why is the pxa driver being adapted to drive them? I would expect the
of_serial.cdriver to be used. It's already got support for multiple variants of the 16550.
Merely building serial8250 into a multiplatform kernel breaks every other serial driver that uses "ttyS" and major/minor 4/64. Even if an 8250/16550A device is never probed.
More discussion in this thread:
PATCH v2 7/10 serial: pxa: Make the driver buildable for BCM7xxx set-top platforms
In reply to Kevin CernekeeRemove the platform dependency in Kconfig and add an appropriate compatible string. Note that BCM7401 has one 16550A-compatible UART in the UPG uart_clk domain, and two proprietary UARTs in the 27 MHz clock domain. This driver handles the former one.
--- drivers/tty/serial/Kconfig | 2 +- drivers/tty/serial/pxa.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/Kconfig +1 -1
@@ -436,7 +436,7 @@ config SERIAL_MPSC_CONSOLE config SERIAL_PXA bool "PXA serial port support" - depends on ARCH_PXA || ARCH_MMP + depends on ARM || MIPS select SERIAL_CORE help If you have a machine based on an Intel XScale PXA2xx CPU you
drivers/tty/serial/pxa.c +1 -0
@@ -830,6 +830,7 @@ static const struct dev_pm_ops serial_pxa_pm_ops = {static struct of_device_id serial_pxa_dt_ids[] = { { .compatible ="mrvl,pxa-uart" , }, { .compatible ="mrvl,mmp-uart" , }, + { .compatible ="brcm,bcm7401-upg-uart" , }, {} };MODULE_DEVICE_TABLE (of, serial_pxa_dt_ids);
Signature · 1 line
2.1.1
PATCH v2 8/10 serial: pxa: Update DT binding documentation
In reply to Kevin CernekeeAdd a couple of missing required properties; add the new optional properties and an example.
--- .../devicetree/bindings/serial/mrvl-serial.txt | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/serial/mrvl-serial.txt +33 -1
@@ -1,4 +1,36 @@ PXA UART controller Required properties: -- compatible : should be "mrvl,mmp-uart" or "mrvl,pxa-uart". +- compatible : should be "mrvl,mmp-uart", "mrvl,pxa-uart", or + "brcm,bcm7401-uart". +- interrupts : a single interrupt specifier. +- clocks : phandle to a clock; used to compute the baud divisor. + +Optional properties: +- fifo-size : defaults to 64 bytes. +- big-endian : always use BE register accesses. +- native-endian : use BE register accesses if the kernel was built for BE, + otherwise use LE register accesses. + +Example: + + clocks { + #address-cells = <1>; + #size-cells = <0>; + + uart_clk: uart_clk@0 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <81000000>; + }; + }; + + uart0: serial@10406900 { + compatible = "brcm,bcm7401-upg-uart"; + reg = <0x10406900 0x20>; + native-endian; + fifo-size = <32>; + interrupt-parent = <&periph_intc>; + interrupts = <64>; + clocks = <&uart_clk>; + };
Signature · 1 line
2.1.1
PATCH v2 9/10 serial: earlycon: Set UPIO_MEM32BE based on DT properties
In reply to Kevin CernekeeIf an earlycon (stdout-path) node is being used, check for "big-endian" or "native-endian" properties and pass the appropriate iotype to the driver.
Note that LE sets UPIO_MEM (8-bit) but BE sets UPIO_MEM32BE (32-bit). The big-endian property only really makes sense in the context of 32-bit registers, since 8-bit accesses never require data swapping.
At some point, the of_earlycon code may want to pass in the reg-io-width, reg-offset, and reg-shift parameters too.
--- drivers/of/fdt.c | 9 ++++++++- drivers/tty/serial/earlycon.c | 4 ++-- include/linux/serial_core.h | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-)
drivers/of/fdt.c +8 -1
@@ -10,6 +10,7 @@*/ #include <linux/kernel.h> +#include <linux/kconfig.h> #include <linux/initrd.h> #include <linux/memblock.h> #include <linux/of.h>
@@ -784,7 +785,13 @@ int __init early_init_dt_scan_chosen_serial(void)if (!addr)return -ENXIO ; -of_setup_earlycon (addr, match->data); +if (fdt_getprop (fdt, offset,"big-endian" ,NULL ) || + (fdt_getprop (fdt, offset,"native-endian" ,NULL ) && +IS_ENABLED (CONFIG_CPU_BIG_ENDIAN ))) { +of_setup_earlycon (addr,UPIO_MEM32BE , match->data); + }else { +of_setup_earlycon (addr,UPIO_MEM , match->data); + }return 0 ; }return -ENODEV ;
drivers/tty/serial/earlycon.c +2 -2
@@ -148,13 +148,13 @@ int __init setup_earlycon(char *buf, const char *match,return 0 ; } -int __init of_setup_earlycon (unsigned long addr, +int __init of_setup_earlycon (unsigned long addr,unsigned char iotype,int (*setup)(struct earlycon_device *,const char *)) {int err;struct uart_port *port = &early_console_dev.port; - port->iotype =UPIO_MEM ; + port->iotype = iotype; port->mapbase = addr; port->uartclk =BASE_BAUD *16 ; port->membase =earlycon_map (addr,SZ_4K );
include/linux/serial_core.h +1 -1
@@ -310,7 +310,7 @@ struct earlycon_device {int setup_earlycon (char *buf,const char *match,int (*setup)(struct earlycon_device *,const char *)); -extern int of_setup_earlycon (unsigned long addr, +extern int of_setup_earlycon (unsigned long addr,unsigned char iotype,int (*setup)(struct earlycon_device *,const char *));#define EARLYCON_DECLARE (name, func) \
Signature · 1 line
2.1.1
Re: [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties
Quoted 32 lines · Kevin Cernekee
If an earlycon (stdout-path) node is being used, check for "big-endian" or "native-endian" properties and pass the appropriate iotype to the driver.
Note that LE sets
UPIO_MEM(8-bit) but BE setsUPIO_MEM32BE(32-bit). The big-endian property only really makes sense in the context of 32-bit registers, since 8-bit accesses never require data swapping.At some point, the
of_earlyconcode may want to pass in the reg-io-width, reg-offset, and reg-shift parameters too.Signed-off-by Kevin Cernekee <[email protected]>--- drivers/of/fdt.c | 9 ++++++++- drivers/tty/serial/earlycon.c | 4 ++-- include/linux/serial_core.h | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-)drivers/of/fdt.c +1
-0@@ -10,6 +10,7 @@*/ #include <linux/kernel.h> +#include <linux/kconfig.h> #include <linux/initrd.h> #include <linux/memblock.h> #include <linux/of.h> @@ -784,7 +785,13 @@ int __init early_init_dt_scan_chosen_serial(void)if (!addr)
drivers/of/fdt.c int __init early_init_dt_scan_chosen_serial(void) · line 794
Quoted 10 lines
drivers/of/fdt.c +7
-1return -ENXIO ; -of_setup_earlycon (addr, match->data); +if (fdt_getprop (fdt, offset,"big-endian" ,NULL ) || + (fdt_getprop (fdt, offset,"native-endian" ,NULL ) && +IS_ENABLED (CONFIG_CPU_BIG_ENDIAN ))) { +of_setup_earlycon (addr,UPIO_MEM32BE , match->data); + }else { +of_setup_earlycon (addr,UPIO_MEM , match->data); + }
Perhaps also create an fdt_ version of the helper.
Otherwise looks good to me.
g.
Quoted 39 lines
drivers/of/fdt.c +0
-0return 0 ; }return -ENODEV ;drivers/tty/serial/earlycon.c +2
-2@@ -148,13 +148,13 @@ int __init setup_earlycon(char *buf, const char *match,return 0 ; } -int __init of_setup_earlycon (unsigned long addr, +int __init of_setup_earlycon (unsigned long addr,unsigned char iotype,int (*setup)(struct earlycon_device *,const char *)) {int err;struct uart_port *port = &early_console_dev.port; - port->iotype =UPIO_MEM ; + port->iotype = iotype; port->mapbase = addr; port->uartclk =BASE_BAUD *16 ; port->membase =earlycon_map (addr,SZ_4K );include/linux/serial_core.h +1
-1@@ -310,7 +310,7 @@ struct earlycon_device {int setup_earlycon (char *buf,const char *match,int (*setup)(struct earlycon_device *,const char *)); -extern int of_setup_earlycon (unsigned long addr, +extern int of_setup_earlycon (unsigned long addr,unsigned char iotype,int (*setup)(struct earlycon_device *,const char *));#define EARLYCON_DECLARE (name, func) \Signature · 1 line
2.1.1
Rob Herring
maintainerRe: [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties
In reply to Kevin CernekeeQuoted 31 lines · Kevin Cernekee
If an earlycon (stdout-path) node is being used, check for "big-endian" or "native-endian" properties and pass the appropriate iotype to the driver.
Note that LE sets
UPIO_MEM(8-bit) but BE setsUPIO_MEM32BE(32-bit). The big-endian property only really makes sense in the context of 32-bit registers, since 8-bit accesses never require data swapping.At some point, the
of_earlyconcode may want to pass in the reg-io-width, reg-offset, and reg-shift parameters too.Signed-off-by Kevin Cernekee <[email protected]>--- drivers/of/fdt.c | 9 ++++++++- drivers/tty/serial/earlycon.c | 4 ++-- include/linux/serial_core.h | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-)drivers/of/fdt.c +1
-0@@ -10,6 +10,7 @@*/ #include <linux/kernel.h> +#include <linux/kconfig.h> #include <linux/initrd.h> #include <linux/memblock.h> #include <linux/of.h>
drivers/of/fdt.c int __init early_init_dt_scan_chosen_serial(void) · line 789
Quoted 6 lines
drivers/of/fdt.c +2
-1@@ -784,7 +785,13 @@ int __init early_init_dt_scan_chosen_serial(void)if (!addr)return -ENXIO ; -of_setup_earlycon (addr, match->data); + if (fdt_getprop(fdt, offset, "big-endian", NULL) || + (fdt_getprop(fdt, offset, "native-endian", NULL) &&
Is native-endian documented?
drivers/of/fdt.c int __init early_init_dt_scan_chosen_serial(void) · line 794
Quoted 5 lines
drivers/of/fdt.c +5
-0+ IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))) { + of_setup_earlycon(addr, UPIO_MEM32BE, match->data); + } else { +of_setup_earlycon (addr,UPIO_MEM , match->data); + }
I'd rather see something like this, so we can more easily add any other properties later:
iotype = 0;
if (fdt_getprop(fdt, offset, "big-endian", NULL) ||
(fdt_getprop(fdt, offset, "native-endian", NULL) &&
IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)))
iotype = UPIO_MEM32BE;
of_setup_earlycon(addr, iotype ? : UPIO_MEM, match->data);Quoted 39 lines
drivers/of/fdt.c +0
-0return 0 ; }return -ENODEV ;drivers/tty/serial/earlycon.c +2
-2@@ -148,13 +148,13 @@ int __init setup_earlycon(char *buf, const char *match,return 0 ; } -int __init of_setup_earlycon (unsigned long addr, +int __init of_setup_earlycon (unsigned long addr,unsigned char iotype,int (*setup)(struct earlycon_device *,const char *)) {int err;struct uart_port *port = &early_console_dev.port; - port->iotype =UPIO_MEM ; + port->iotype = iotype; port->mapbase = addr; port->uartclk =BASE_BAUD *16 ; port->membase =earlycon_map (addr,SZ_4K );include/linux/serial_core.h +1
-2@@ -310,7 +310,7 @@ struct earlycon_device {int setup_earlycon (char *buf,const char *match,int (*setup)(struct earlycon_device *,const char *)); -extern int of_setup_earlycon (unsigned long addr, +extern int of_setup_earlycon (unsigned long addr,unsigned char iotype,int (*setup)(struct earlycon_device *,const char *));#define EARLYCON_DECLARE (name, func) \ --2.1.1
Re: [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties
Quoted 50 lines · Rob Herring
Quoted 31 lines · Kevin Cernekee
If an earlycon (stdout-path) node is being used, check for "big-endian" or "native-endian" properties and pass the appropriate iotype to the driver.
Note that LE sets
UPIO_MEM(8-bit) but BE setsUPIO_MEM32BE(32-bit). The big-endian property only really makes sense in the context of 32-bit registers, since 8-bit accesses never require data swapping.At some point, the
of_earlyconcode may want to pass in the reg-io-width, reg-offset, and reg-shift parameters too.Signed-off-by Kevin Cernekee <[email protected]>--- drivers/of/fdt.c | 9 ++++++++- drivers/tty/serial/earlycon.c | 4 ++-- include/linux/serial_core.h | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-)drivers/of/fdt.c +1
-0@@ -10,6 +10,7 @@*/ #include <linux/kernel.h> +#include <linux/kconfig.h> #include <linux/initrd.h> #include <linux/memblock.h> #include <linux/of.h> drivers/of/fdt.c int __init early_init_dt_scan_chosen_serial(void) · line 789
Quoted 6 lines
drivers/of/fdt.c +2
-1@@ -784,7 +785,13 @@ int __init early_init_dt_scan_chosen_serial(void)if (!addr)return -ENXIO ; -of_setup_earlycon (addr, match->data); + if (fdt_getprop(fdt, offset, "big-endian", NULL) || + (fdt_getprop(fdt, offset, "native-endian", NULL) &&Is native-endian documented?
drivers/of/fdt.c int __init early_init_dt_scan_chosen_serial(void) · line 794
Quoted 5 lines
drivers/of/fdt.c +5
-0+ IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))) { + of_setup_earlycon(addr, UPIO_MEM32BE, match->data); + } else { +of_setup_earlycon (addr,UPIO_MEM , match->data); + }I'd rather see something like this, so we can more easily add any other properties later:
Quoted 7 lines
iotype = 0;
if (fdt_getprop(fdt, offset, "big-endian", NULL) ||
(fdt_getprop(fdt, offset, "native-endian", NULL) &&
IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)))
iotype = UPIO_MEM32BE;
of_setup_earlycon(addr, iotype ? : UPIO_MEM, match->data);or even initialize iotype to UPIO_MEM at the outset. :-)
I've also asked for the tests in an if to be wrapped up into a helper. I can foresee other code wanting to use this.
g.
Quoted 40 lines
Quoted 40 lines
drivers/of/fdt.c +0
-0return 0 ; }return -ENODEV ;drivers/tty/serial/earlycon.c +2
-2@@ -148,13 +148,13 @@ int __init setup_earlycon(char *buf, const char *match,return 0 ; } -int __init of_setup_earlycon (unsigned long addr, +int __init of_setup_earlycon (unsigned long addr,unsigned char iotype,int (*setup)(struct earlycon_device *,const char *)) {int err;struct uart_port *port = &early_console_dev.port; - port->iotype =UPIO_MEM ; + port->iotype = iotype; port->mapbase = addr; port->uartclk =BASE_BAUD *16 ; port->membase =earlycon_map (addr,SZ_4K );include/linux/serial_core.h +1
-2@@ -310,7 +310,7 @@ struct earlycon_device {int setup_earlycon (char *buf,const char *match,int (*setup)(struct earlycon_device *,const char *)); -extern int of_setup_earlycon (unsigned long addr, +extern int of_setup_earlycon (unsigned long addr,unsigned char iotype,int (*setup)(struct earlycon_device *,const char *));#define EARLYCON_DECLARE (name, func) \ --2.1.1
PATCH v2 10/10 serial: pxa: Add OF_EARLYCON support
In reply to Kevin CernekeeImplement a bare bones earlycon; this assumes that the bootloader sets up the tty parameters. Matches all three compatible strings.
--- drivers/tty/serial/pxa.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
drivers/tty/serial/pxa.c +45 -0
@@ -761,6 +761,51 @@ static struct console serial_pxa_console = { .data = &serial_pxa_reg, }; +static struct uart_pxa_port serial_pxa_early_port__initdata ; + +static void __init early_wait_for_xmitr (struct uart_pxa_port *up) +{ +/* it's unsafe to call udelay() in the "early" variant */ +while ((serial_in (up,UART_LSR ) &BOTH_EMPTY ) !=BOTH_EMPTY ) + ; +} + +static void __init serial_pxa_early_putchar (struct uart_port *port,int ch) +{ +struct uart_pxa_port *up = (struct uart_pxa_port *)port; + +early_wait_for_xmitr (up); +serial_out (up,UART_TX , ch); +} + +static void __init serial_pxa_early_write (struct console *con,const char *s, +unsigned n) +{ +uart_console_write (&serial_pxa_early_port.port, s, n, + serial_pxa_early_putchar); +early_wait_for_xmitr (&serial_pxa_early_port); +} + +static int __init serial_pxa_early_console_setup (struct earlycon_device *device, +const char *opt) +{ +if (!device->port.membase) +return -ENODEV ; + + serial_pxa_early_port.port.membase = device->port.membase; + serial_pxa_early_port.port.iotype = device->port.iotype; + + device->con->write = serial_pxa_early_write; +return 0 ; +} + +OF_EARLYCON_DECLARE (pxa_uart,"mrvl,pxa-uart" , + serial_pxa_early_console_setup); +OF_EARLYCON_DECLARE (mmp_uart,"mrvl,mmp-uart" , + serial_pxa_early_console_setup); +OF_EARLYCON_DECLARE (bcm7401_upg_uart,"brcm,bcm7401-upg-uart" , + serial_pxa_early_console_setup); +#define PXA_CONSOLE &serial_pxa_console#else #define PXA_CONSOLE NULL
Signature · 1 line
2.1.1
A message that is not in the archive (sent off-list or not yet received): 1415825647-6024-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 7 lines · Kevin Cernekee
V1->V2:Add a new
UPIO_MEM32BEiotype instead of a separatebig_endianflag.Change some of the of_*_is_* APIs to return bool, where appropriate.
Fix a few minor comment issues.
Hi Kevin,
I'll review the pxa part tonight or tomorrow, just a simple preliminary question : did you test this serie with the triple activation of DEBUG_UART, early console, and kernel console, all of them on the same tty ?
Cheers.
--
Robert
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Robert Jarzmik
Quoted 6 lines · Kevin Cernekee
V1->V2:Add a new
UPIO_MEM32BEiotype instead of a separatebig_endianflag.Change some of the of_*_is_* APIs to return bool, where appropriate.
Quoted 7 lines
Quoted 1 line
Fix a few minor comment issues.
Hi Kevin,
I'll review the pxa part tonight or tomorrow, just a simple preliminary question : did you test this serie with the triple activation of
DEBUG_UART, early console, and kernel console, all of them on the same tty ?
I originally tested with MIPS EARLY_PRINTK + earlycon + console=ttyS0,115200. arch/arm/kernel/early_printk.c and arch/mips/kernel/early_printk.c look very similar. Using EARLY_PRINTK
+ earlycon at the same time produces duplicate messages until the console switch occurs, so you'll probably want to disable ARM's DEBUG_UART if you add "earlycon" to the pxa boot command line.
Once earlycon was stable, I started running with EARLY_PRINTK disabled (and in fact, completely yanked the patch that was hardcoding the UART base address into the kernel).
FWIW here is a log showing EARLY_PRINTK + earlycon + console=ttyS0,115200:
Linux version 3.18.0-rc4+ (cernekee@vm9) (gcc version 4.8.4 20140811 (prerelease) (Broadcom stbgcc-4.8-1.0) ) #428 SMP Thu Nov 13 08:25:53 PST 2014
bootconsole [early0] enabled
CPU0 revision is: 00025a11 (Broadcom BMIPS5000)
FPU revision is: 00130001
MIPS: machine is Broadcom BCM97346DBSMB
Determined physical RAM map:
memory: 10000000 @ 00000000 (usable)
memory: 30000000 @ 20000000 (usable)
Linux version 3.18.0-rc4+ (cernekee@vm9) (gcc version 4.8.4 20140811 (prerelease) (Broadcom stbgcc-4.8-1.0) ) #428 SMP Thu Nov 13 08:25:53 PST 2014
bootconsole [early0] enabled
CPU0 revision is: 00025a11 (Broadcom BMIPS5000)
FPU revision is: 00130001
MIPS: machine is Broadcom BCM97346DBSMB
Determined physical RAM map:
memory: 10000000 @ 00000000 (usable)
memory: 30000000 @ 20000000 (usable)
bootconsole [uart0] enabled
bootconsole [uart0] enabled
Initrd not found or emptyInitrd not found or empty - disabling initrd
- disabling initrd
Zone ranges:
Zone ranges:
Normal Normal [mem 0x00000000-0x1fffffff]
[mem 0x00000000-0x1fffffff]
HighMem HighMem [mem 0x20000000-0x4fffffff]
[mem 0x20000000-0x4fffffff]
Movable zone start for each node
Movable zone start for each node
Early memory node ranges
Early memory node ranges
node 0: [mem 0x00000000-0x0fffffff] node 0: [mem 0x00000000-0x0fffffff] node 0: [mem 0x20000000-0x4fffffff] node 0: [mem 0x20000000-0x4fffffff]
Initmem setup node 0 [mem 0x00000000-0x4fffffff]
Initmem setup node 0 [mem 0x00000000-0x4fffffff]
Primary instruction cache 32kB, VIPT, 4-way, linesize 64 bytes. Primary instruction cache 32kB, VIPT, 4-way, linesize 64 bytes. Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes MIPS secondary cache 256kB, 8-way, linesize 128 bytes.
MIPS secondary cache 256kB, 8-way, linesize 128 bytes.
PERCPU: Embedded 7 pages/cpu @81a0d000 s6912 r0 d21760 u32768
PERCPU: Embedded 7 pages/cpu @81a0d000 s6912 r0 d21760 u32768 Built 1 zonelists in Zone order, mobility grouping on. Total pages: 261120 Built 1 zonelists in Zone order, mobility grouping on. Total pages: 261120 Kernel command line: console=ttyS0,115200 earlycon
Kernel command line: console=ttyS0,115200 earlycon
PID hash table entries: 1024 (order: 0, 4096 bytes)
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 1027712K/1048576K available (5010K kernel code, 183K rwdata, 684K rodata, 4096K init, 256K bss, 20864K reserved, 786432K highmem)
Memory: 1027712K/1048576K available (5010K kernel code, 183K rwdata, 684K rodata, 4096K init, 256K bss, 20864K reserved, 786432K highmem)
SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 Hierarchical RCU implementation.
Hierarchical RCU implementation.
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 NR_IRQS:128
NR_IRQS:128irq_bcm7038_l1: registered BCM7038 L1 intc (mem: 0xb0411400, parent IRQ: 2)irq_bcm7038_l1: registered BCM7038 L1 intc (mem: 0xb0411400, parent IRQ: 2)irq_bcm7120_l2: registered BCM7120 L2 intc (mem: 0xb0406780, parent IRQ(s): 1)irq_bcm7120_l2: registered BCM7120 L2 intc (mem: 0xb0406780, parent IRQ(s): 1) Calibrating delay loop... Calibrating delay loop... 866.30 BogoMIPS (lpj=1732608)
866.30 BogoMIPS (lpj=1732608)pid_max: default: 32768 minimum: 301pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
SMP: Booting CPU1...
SMP: Booting CPU1...
CPU1 revision is: 00025a11 (Broadcom BMIPS5000)
CPU1 revision is: 00025a11 (Broadcom BMIPS5000)
FPU revision is: 00130001
FPU revision is: 00130001
Primary instruction cache 32kB, VIPT, 4-way, linesize 64 bytes. Primary instruction cache 32kB, VIPT, 4-way, linesize 64 bytes. Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes MIPS secondary cache 256kB, 8-way, linesize 128 bytes.
MIPS secondary cache 256kB, 8-way, linesize 128 bytes. Synchronize counters for CPU 1: done.
Synchronize counters for CPU 1: done.
SMP: CPU1 is running
SMP: CPU1 is running
Brought up 2 CPUs
Brought up 2 CPUs
devtmpfs: initialized
devtmpfs: initialized
NET: Registered protocol family 16
NET: Registered protocol family 16
SCSI subsystem initialized
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
usbcore: registered new device driver usb
Switched to clocksource MIPS
Switched to clocksource MIPS
cfg80211: Calling CRDA to update world regulatory domain
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 1, 8192 bytes) TCP established hash table entries: 2048 (order: 1, 8192 bytes) TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
TCP: reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
futex hash table entries: 512 (order: 4, 65536 bytes)
futex hash table entries: 512 (order: 4, 65536 bytes)
fuse init (API version 7.23)
fuse init (API version 7.23)
bounce: pool size: 64 pages
bounce: pool size: 64 pages
io scheduler noop registered (default)
io scheduler noop registered (default)
pxa2xx-uart 10406900.serial: ttyS0 at MMIO 0x10406900 (irq = 64, base_baud = 5062500) is a UART1
pxa2xx-uart 10406900.serial: ttyS0 at MMIO 0x10406900 (irq = 64, base_baud = 5062500) is a UART1
console [ttyS0] enabled
console [ttyS0] enabled
console [ttyS0] enabled
bootconsole [early0] disabled
bootconsole [early0] disabled
bootconsole [early0] disabled
bootconsole [uart0] disabled
bootconsole [uart0] disabled
Default device node (4:64) for ttyS is busy, using dynamic major number
libphy: Fixed MDIO Bus: probed
bcmgenet 10430000.ethernet: failed to get enet clock
bcmgenet 10430000.ethernet: GENET 2.9 EPHY: 0x00b0
bcmgenet 10430000.ethernet: failed to get enet-wol clock
libphy: bcmgenet MII bus: probed
bcmgenet 10430000.ethernet: configuring instance for internal PHY attached PHY at address 1 [Broadcom BCM7XXX 40nm]
usbcore: registered new interface driver asix
usbcore: registered new interface driver ax88179_178a
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver net1080
usbcore: registered new interface driver cdc_subset
usbcore: registered new interface driver zaurus
usbcore: registered new interface driver cdc_ncmehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-platform: EHCI generic platform driver
ehci-platform 10480300.usb: EHCI Host Controller
ehci-platform 10480300.usb: new USB bus registered, assigned bus number 1 ehci-platform 10480300.usb: irq 68, io mem 0x10480300 ehci-platform 10480300.usb: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ehci-platform 10480500.usb: EHCI Host Controller
ehci-platform 10480500.usb: new USB bus registered, assigned bus number 2 ehci-platform 10480500.usb: irq 69, io mem 0x10480500 ehci-platform 10480500.usb: USB 2.0 started, EHCI 1.00
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
ehci-platform 10490300.usb: EHCI Host Controller
ehci-platform 10490300.usb: new USB bus registered, assigned bus number 3 ehci-platform 10490300.usb: irq 73, io mem 0x10490300 ehci-platform 10490300.usb: USB 2.0 started, EHCI 1.00
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 1 port detected
ehci-platform 10490500.usb: EHCI Host Controller
ehci-platform 10490500.usb: new USB bus registered, assigned bus number 4 ehci-platform 10490500.usb: irq 74, io mem 0x10490500 ehci-platform 10490500.usb: USB 2.0 started, EHCI 1.00
hub 4-0:1.0: USB hub found
hub 4-0:1.0: 1 port detectedohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-platform: OHCI generic platform driver
ohci-platform 10480400.usb: Generic Platform OHCI controller ohci-platform 10480400.usb: new USB bus registered, assigned bus number 5 ohci-platform 10480400.usb: irq 70, io mem 0x10480400
hub 5-0:1.0: USB hub found
hub 5-0:1.0: 1 port detected
ohci-platform 10480600.usb: Generic Platform OHCI controller ohci-platform 10480600.usb: new USB bus registered, assigned bus number 6 ohci-platform 10480600.usb: irq 71, io mem 0x10480600
hub 6-0:1.0: USB hub found
hub 6-0:1.0: 1 port detected
ohci-platform 10490400.usb: Generic Platform OHCI controller ohci-platform 10490400.usb: new USB bus registered, assigned bus number 7 ohci-platform 10490400.usb: irq 75, io mem 0x10490400
hub 7-0:1.0: USB hub found
hub 7-0:1.0: 1 port detected
ohci-platform 10490600.usb: Generic Platform OHCI controller ohci-platform 10490600.usb: new USB bus registered, assigned bus number 8 ohci-platform 10490600.usb: irq 76, io mem 0x10490600
hub 8-0:1.0: USB hub found
hub 8-0:1.0: 1 port detected
usbcore: registered new interface driver usb-storage
TCP: cubic registered
NET: Registered protocol family 10
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
Freeing unused kernel memory: 4096K (805d0000 - 809d0000) starting pid 830, tty '': '/etc/init.d/rcS'
Mounting virtual filesystems
Starting mdev
Configuring eth0 interface
bcmgenet 10430000.ethernet eth0: Link is Down
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Configuring lo interface
Configuring sit0 interface
Starting network services
starting pid 864, tty '': '/bin/cttyhack /bin/sh -l'
root@bmips#
And here's a log with "earlycon console=ttyS0,115200" and EARLY_PRINTK disabled:
Linux version 3.18.0-rc4+ (cernekee@vm9) (gcc version 4.8.4 20140811 (prerelease) (Broadcom stbgcc-4.8-1.0) ) #429 SMP Thu Nov 13 08:33:30 PST 2014
CPU0 revision is: 00025a11 (Broadcom BMIPS5000)
FPU revision is: 00130001
MIPS: machine is Broadcom BCM97346DBSMB
Determined physical RAM map:
memory: 10000000 @ 00000000 (usable)
memory: 30000000 @ 20000000 (usable)
bootconsole [uart0] enabled
Initrd not found or empty - disabling initrd
Zone ranges:
Normal [mem 0x00000000-0x1fffffff]
HighMem [mem 0x20000000-0x4fffffff]
Movable zone start for each node
Early memory node ranges
node 0: [mem 0x00000000-0x0fffffff]
node 0: [mem 0x20000000-0x4fffffff]
Initmem setup node 0 [mem 0x00000000-0x4fffffff]
Primary instruction cache 32kB, VIPT, 4-way, linesize 64 bytes. Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes MIPS secondary cache 256kB, 8-way, linesize 128 bytes.
PERCPU: Embedded 7 pages/cpu @81a0d000 s6912 r0 d21760 u32768 Built 1 zonelists in Zone order, mobility grouping on. Total pages: 261120 Kernel command line: console=ttyS0,115200 earlycon
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 1027712K/1048576K available (5010K kernel code, 183K rwdata, 684K rodata, 4096K init, 256K bss, 20864K reserved, 786432K highmem)
SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 Hierarchical RCU implementation.
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 NR_IRQS:128irq_bcm7038_l1: registered BCM7038 L1 intc (mem: 0xb0411400, parent IRQ: 2)irq_bcm7120_l2: registered BCM7120 L2 intc (mem: 0xb0406780, parent IRQ(s): 1) Calibrating delay loop... 866.30 BogoMIPS (lpj=1732608)pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
SMP: Booting CPU1...
CPU1 revision is: 00025a11 (Broadcom BMIPS5000)
FPU revision is: 00130001
Primary instruction cache 32kB, VIPT, 4-way, linesize 64 bytes. Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes MIPS secondary cache 256kB, 8-way, linesize 128 bytes. Synchronize counters for CPU 1: done.
SMP: CPU1 is running
Brought up 2 CPUs
devtmpfs: initialized
NET: Registered protocol family 16
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Calling CRDA to update world regulatory domain
Switched to clocksource MIPS
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 1, 8192 bytes) TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP: reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
futex hash table entries: 512 (order: 4, 65536 bytes)
fuse init (API version 7.23)
bounce: pool size: 64 pages
io scheduler noop registered (default)
pxa2xx-uart 10406900.serial: ttyS0 at MMIO 0x10406900 (irq = 64, base_baud = 5062500) is a UART1
console [ttyS0] enabled
console [ttyS0] enabled
bootconsole [uart0] disabled
bootconsole [uart0] disabled
Default device node (4:64) for ttyS is busy, using dynamic major number
libphy: Fixed MDIO Bus: probed
bcmgenet 10430000.ethernet: failed to get enet clock
bcmgenet 10430000.ethernet: GENET 2.9 EPHY: 0x00b0
bcmgenet 10430000.ethernet: failed to get enet-wol clock
libphy: bcmgenet MII bus: probed
bcmgenet 10430000.ethernet: configuring instance for internal PHY attached PHY at address 1 [Broadcom BCM7XXX 40nm]
usbcore: registered new interface driver asix
usbcore: registered new interface driver ax88179_178a
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver net1080
usbcore: registered new interface driver cdc_subset
usbcore: registered new interface driver zaurus
usbcore: registered new interface driver cdc_ncmehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-platform: EHCI generic platform driver
ehci-platform 10480300.usb: EHCI Host Controller
ehci-platform 10480300.usb: new USB bus registered, assigned bus number 1 ehci-platform 10480300.usb: irq 68, io mem 0x10480300 ehci-platform 10480300.usb: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ehci-platform 10480500.usb: EHCI Host Controller
ehci-platform 10480500.usb: new USB bus registered, assigned bus number 2 ehci-platform 10480500.usb: irq 69, io mem 0x10480500 ehci-platform 10480500.usb: USB 2.0 started, EHCI 1.00
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
ehci-platform 10490300.usb: EHCI Host Controller
ehci-platform 10490300.usb: new USB bus registered, assigned bus number 3 ehci-platform 10490300.usb: irq 73, io mem 0x10490300 ehci-platform 10490300.usb: USB 2.0 started, EHCI 1.00
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 1 port detected
ehci-platform 10490500.usb: EHCI Host Controller
ehci-platform 10490500.usb: new USB bus registered, assigned bus number 4 ehci-platform 10490500.usb: irq 74, io mem 0x10490500 ehci-platform 10490500.usb: USB 2.0 started, EHCI 1.00
hub 4-0:1.0: USB hub found
hub 4-0:1.0: 1 port detectedohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-platform: OHCI generic platform driver
ohci-platform 10480400.usb: Generic Platform OHCI controller ohci-platform 10480400.usb: new USB bus registered, assigned bus number 5 ohci-platform 10480400.usb: irq 70, io mem 0x10480400
hub 5-0:1.0: USB hub found
hub 5-0:1.0: 1 port detected
ohci-platform 10480600.usb: Generic Platform OHCI controller ohci-platform 10480600.usb: new USB bus registered, assigned bus number 6 ohci-platform 10480600.usb: irq 71, io mem 0x10480600
hub 6-0:1.0: USB hub found
hub 6-0:1.0: 1 port detected
ohci-platform 10490400.usb: Generic Platform OHCI controller ohci-platform 10490400.usb: new USB bus registered, assigned bus number 7 ohci-platform 10490400.usb: irq 75, io mem 0x10490400
hub 7-0:1.0: USB hub found
hub 7-0:1.0: 1 port detected
ohci-platform 10490600.usb: Generic Platform OHCI controller ohci-platform 10490600.usb: new USB bus registered, assigned bus number 8 ohci-platform 10490600.usb: irq 76, io mem 0x10490600
hub 8-0:1.0: USB hub found
hub 8-0:1.0: 1 port detected
usbcore: registered new interface driver usb-storage
TCP: cubic registered
NET: Registered protocol family 10
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
Freeing unused kernel memory: 4096K (805d0000 - 809d0000) starting pid 830, tty '': '/etc/init.d/rcS'
Mounting virtual filesystems
Starting mdev
Configuring eth0 interface
bcmgenet 10430000.ethernet eth0: Link is Down
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Configuring lo interface
Configuring sit0 interface
Starting network services
starting pid 864, tty '': '/bin/cttyhack /bin/sh -l'
root@bmips#