* [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels
@ 2014-11-12 20:53 Kevin Cernekee
2014-11-12 20:53 ` [PATCH V2 01/10] tty: Fallback to use dynamic major number Kevin Cernekee
` (10 more replies)
0 siblings, 11 replies; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:53 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
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(-)
--
2.1.1
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH V2 01/10] tty: Fallback to use dynamic major number
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
@ 2014-11-12 20:53 ` Kevin Cernekee
2014-11-25 20:34 ` Greg KH
2014-11-12 20:53 ` [PATCH V2 02/10] serial: core: Add big-endian iotype Kevin Cernekee
` (9 subsequent siblings)
10 siblings, 1 reply; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:53 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
From: Tushar Behera <tushar.behera@linaro.org>
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.
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
[cernekee: fix checkpatch warnings]
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
drivers/tty/tty_io.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 0508a1d..a6d4d9a 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -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;
--
2.1.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH V2 02/10] serial: core: Add big-endian iotype
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
2014-11-12 20:53 ` [PATCH V2 01/10] tty: Fallback to use dynamic major number Kevin Cernekee
@ 2014-11-12 20:53 ` Kevin Cernekee
2014-11-12 20:54 ` [PATCH V2 03/10] of: Fix of_device_is_compatible() comment Kevin Cernekee
` (8 subsequent siblings)
10 siblings, 0 replies; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:53 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
Since 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).
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
drivers/tty/serial/serial_core.c | 2 ++
include/linux/serial_core.h | 13 +++++++------
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index eaeb9a0..ecc7d6c 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -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);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 21c2e05..d2d5bf6 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -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 */
--
2.1.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH V2 03/10] of: Fix of_device_is_compatible() comment
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
2014-11-12 20:53 ` [PATCH V2 01/10] tty: Fallback to use dynamic major number Kevin Cernekee
2014-11-12 20:53 ` [PATCH V2 02/10] serial: core: Add big-endian iotype Kevin Cernekee
@ 2014-11-12 20:54 ` Kevin Cernekee
2014-11-18 17:32 ` Grant Likely
2014-11-12 20:54 ` [PATCH V2 04/10] of: Change of_device_is_available() to return bool Kevin Cernekee
` (7 subsequent siblings)
10 siblings, 1 reply; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:54 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
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 <cernekee@gmail.com>
---
drivers/of/base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 3823edf..707395c 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -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)
--
2.1.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH V2 04/10] of: Change of_device_is_available() to return bool
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
` (2 preceding siblings ...)
2014-11-12 20:54 ` [PATCH V2 03/10] of: Fix of_device_is_compatible() comment Kevin Cernekee
@ 2014-11-12 20:54 ` Kevin Cernekee
2014-11-18 17:33 ` Grant Likely
2014-11-12 20:54 ` [PATCH V2 05/10] of: Add helper function to check MMIO register endianness Kevin Cernekee
` (6 subsequent siblings)
10 siblings, 1 reply; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:54 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
This function can only return true or false; using a bool makes it more
obvious to the reader.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
drivers/of/base.c | 22 +++++++++++-----------
include/linux/of.h | 6 +++---
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 707395c..81c095f 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -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);
diff --git a/include/linux/of.h b/include/linux/of.h
index 29f0adc..7aaaa59 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -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,
--
2.1.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH V2 05/10] of: Add helper function to check MMIO register endianness
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
` (3 preceding siblings ...)
2014-11-12 20:54 ` [PATCH V2 04/10] of: Change of_device_is_available() to return bool Kevin Cernekee
@ 2014-11-12 20:54 ` Kevin Cernekee
2014-11-18 21:47 ` Grant Likely
2014-11-12 20:54 ` [PATCH V2 06/10] serial: pxa: Add fifo-size and {big,native}-endian properties Kevin Cernekee
` (5 subsequent siblings)
10 siblings, 1 reply; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:54 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
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.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
drivers/of/base.c | 23 +++++++++++++++++++++++
include/linux/of.h | 6 ++++++
2 files changed, 29 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 81c095f..35d95a1 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -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
*
diff --git a/include/linux/of.h b/include/linux/of.h
index 7aaaa59..fc70b01 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -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)
--
2.1.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH V2 06/10] serial: pxa: Add fifo-size and {big,native}-endian properties
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
` (4 preceding siblings ...)
2014-11-12 20:54 ` [PATCH V2 05/10] of: Add helper function to check MMIO register endianness Kevin Cernekee
@ 2014-11-12 20:54 ` Kevin Cernekee
2014-11-19 14:49 ` Grant Likely
2014-11-12 20:54 ` [PATCH V2 07/10] serial: pxa: Make the driver buildable for BCM7xxx set-top platforms Kevin Cernekee
` (4 subsequent siblings)
10 siblings, 1 reply; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:54 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
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.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
drivers/tty/serial/pxa.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 21b7d8b..21406dc 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -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;
}
--
2.1.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH V2 07/10] serial: pxa: Make the driver buildable for BCM7xxx set-top platforms
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
` (5 preceding siblings ...)
2014-11-12 20:54 ` [PATCH V2 06/10] serial: pxa: Add fifo-size and {big,native}-endian properties Kevin Cernekee
@ 2014-11-12 20:54 ` Kevin Cernekee
2014-11-12 20:54 ` [PATCH V2 08/10] serial: pxa: Update DT binding documentation Kevin Cernekee
` (3 subsequent siblings)
10 siblings, 0 replies; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:54 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
Remove 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.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
drivers/tty/serial/Kconfig | 2 +-
drivers/tty/serial/pxa.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index fdd851e..2015057 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -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
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 21406dc..086b371 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -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);
--
2.1.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH V2 08/10] serial: pxa: Update DT binding documentation
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
` (6 preceding siblings ...)
2014-11-12 20:54 ` [PATCH V2 07/10] serial: pxa: Make the driver buildable for BCM7xxx set-top platforms Kevin Cernekee
@ 2014-11-12 20:54 ` Kevin Cernekee
2014-11-12 20:54 ` [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties Kevin Cernekee
` (2 subsequent siblings)
10 siblings, 0 replies; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:54 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
Add a couple of missing required properties; add the new optional
properties and an example.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
.../devicetree/bindings/serial/mrvl-serial.txt | 34 +++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/serial/mrvl-serial.txt b/Documentation/devicetree/bindings/serial/mrvl-serial.txt
index d744340..5bab455 100644
--- a/Documentation/devicetree/bindings/serial/mrvl-serial.txt
+++ b/Documentation/devicetree/bindings/serial/mrvl-serial.txt
@@ -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>;
+ };
--
2.1.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
` (7 preceding siblings ...)
2014-11-12 20:54 ` [PATCH V2 08/10] serial: pxa: Update DT binding documentation Kevin Cernekee
@ 2014-11-12 20:54 ` Kevin Cernekee
2014-11-18 21:50 ` Grant Likely
2014-11-19 3:16 ` Rob Herring
2014-11-12 20:54 ` [PATCH V2 10/10] serial: pxa: Add OF_EARLYCON support Kevin Cernekee
[not found] ` <1415825647-6024-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
10 siblings, 2 replies; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:54 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
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 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.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
drivers/of/fdt.c | 9 ++++++++-
drivers/tty/serial/earlycon.c | 4 ++--
include/linux/serial_core.h | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 30e97bc..15f80c9 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -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;
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index a514ee6..548f7d7 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -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);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index d2d5bf6..0d60c64 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -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
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH V2 10/10] serial: pxa: Add OF_EARLYCON support
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
` (8 preceding siblings ...)
2014-11-12 20:54 ` [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties Kevin Cernekee
@ 2014-11-12 20:54 ` Kevin Cernekee
[not found] ` <1415825647-6024-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
10 siblings, 0 replies; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-12 20:54 UTC (permalink / raw)
To: gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, grant.likely,
f.fainelli, mbizon, jogo, linux-mips, linux-serial, devicetree
Implement a bare bones earlycon; this assumes that the bootloader sets
up the tty parameters. Matches all three compatible strings.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
drivers/tty/serial/pxa.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 086b371..0140108 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -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
--
2.1.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels
[not found] ` <1415825647-6024-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-11-13 7:36 ` Robert Jarzmik
2014-11-13 16:39 ` Kevin Cernekee
0 siblings, 1 reply; 29+ messages in thread
From: Robert Jarzmik @ 2014-11-13 7:36 UTC (permalink / raw)
To: Kevin Cernekee
Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, jslaby-AlSwsSmVLrQ,
robh-DgEjT+Ai2ygdnm+yROfE0A, arnd-r2nGTMty4D4,
daniel-cYrQPVfZoowdnm+yROfE0A,
haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w,
grant.likely-QSEj5FYQhm4dnm+yROfE0A,
f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, mbizon-MmRyKUhfbQ9GWvitb5QawA,
jogo-p3rKhJxN3npAfugRpC6u6w, linux-mips-6z/3iImG2C8G8FEW9MqTrA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
Kevin Cernekee <cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> 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.
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels
2014-11-13 7:36 ` [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Robert Jarzmik
@ 2014-11-13 16:39 ` Kevin Cernekee
0 siblings, 0 replies; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-13 16:39 UTC (permalink / raw)
To: Robert Jarzmik
Cc: Greg KH, Jiri Slaby, Rob Herring, Arnd Bergmann, daniel,
Haojian Zhuang, Grant Likely, Florian Fainelli, Maxime Bizon,
Jonas Gorski, Linux MIPS Mailing List,
linux-serial@vger.kernel.org, devicetree@vger.kernel.org
On Wed, Nov 12, 2014 at 11:36 PM, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> Kevin Cernekee <cernekee@gmail.com> writes:
>
>> 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.
>
> 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:128
irq_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: 301
pid_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_ncm
ehci_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 detected
ohci_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:128
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)
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_ncm
ehci_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 detected
ohci_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#
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 03/10] of: Fix of_device_is_compatible() comment
2014-11-12 20:54 ` [PATCH V2 03/10] of: Fix of_device_is_compatible() comment Kevin Cernekee
@ 2014-11-18 17:32 ` Grant Likely
0 siblings, 0 replies; 29+ messages in thread
From: Grant Likely @ 2014-11-18 17:32 UTC (permalink / raw)
To: Kevin Cernekee, gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, f.fainelli, mbizon,
jogo, linux-mips, linux-serial, devicetree
On Wed, 12 Nov 2014 12:54:00 -0800
, Kevin Cernekee <cernekee@gmail.com>
wrote:
> 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 <cernekee@gmail.com>
Applied, thanks.
g.
> ---
> drivers/of/base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 3823edf..707395c 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -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)
> --
> 2.1.1
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 04/10] of: Change of_device_is_available() to return bool
2014-11-12 20:54 ` [PATCH V2 04/10] of: Change of_device_is_available() to return bool Kevin Cernekee
@ 2014-11-18 17:33 ` Grant Likely
0 siblings, 0 replies; 29+ messages in thread
From: Grant Likely @ 2014-11-18 17:33 UTC (permalink / raw)
To: Kevin Cernekee, gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, f.fainelli, mbizon,
jogo, linux-mips, linux-serial, devicetree
On Wed, 12 Nov 2014 12:54:01 -0800
, Kevin Cernekee <cernekee@gmail.com>
wrote:
> This function can only return true or false; using a bool makes it more
> obvious to the reader.
>
> Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Applied, thanks.
g.
> ---
> drivers/of/base.c | 22 +++++++++++-----------
> include/linux/of.h | 6 +++---
> 2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 707395c..81c095f 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -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);
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 29f0adc..7aaaa59 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -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,
> --
> 2.1.1
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 05/10] of: Add helper function to check MMIO register endianness
2014-11-12 20:54 ` [PATCH V2 05/10] of: Add helper function to check MMIO register endianness Kevin Cernekee
@ 2014-11-18 21:47 ` Grant Likely
0 siblings, 0 replies; 29+ messages in thread
From: Grant Likely @ 2014-11-18 21:47 UTC (permalink / raw)
To: Kevin Cernekee, gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, f.fainelli, mbizon,
jogo, linux-mips, linux-serial, devicetree
On Wed, 12 Nov 2014 12:54:02 -0800
, Kevin Cernekee <cernekee@gmail.com>
wrote:
> 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.
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.
>
> Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
> ---
> drivers/of/base.c | 23 +++++++++++++++++++++++
> include/linux/of.h | 6 ++++++
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 81c095f..35d95a1 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -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
> *
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 7aaaa59..fc70b01 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -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)
> --
> 2.1.1
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties
2014-11-12 20:54 ` [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties Kevin Cernekee
@ 2014-11-18 21:50 ` Grant Likely
2014-11-19 3:16 ` Rob Herring
1 sibling, 0 replies; 29+ messages in thread
From: Grant Likely @ 2014-11-18 21:50 UTC (permalink / raw)
To: Kevin Cernekee, gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, f.fainelli, mbizon,
jogo, linux-mips, linux-serial, devicetree
On Wed, 12 Nov 2014 12:54:06 -0800
, Kevin Cernekee <cernekee@gmail.com>
wrote:
> 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 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.
>
> Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
> ---
> drivers/of/fdt.c | 9 ++++++++-
> drivers/tty/serial/earlycon.c | 4 ++--
> include/linux/serial_core.h | 2 +-
> 3 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 30e97bc..15f80c9 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -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);
> + }
Perhaps also create an fdt_ version of the helper.
Otherwise looks good to me.
Acked-by: Grant Likely <grant.likely@linaro.org>
g.
> return 0;
> }
> return -ENODEV;
> diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
> index a514ee6..548f7d7 100644
> --- a/drivers/tty/serial/earlycon.c
> +++ b/drivers/tty/serial/earlycon.c
> @@ -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);
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index d2d5bf6..0d60c64 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -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
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties
2014-11-12 20:54 ` [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties Kevin Cernekee
2014-11-18 21:50 ` Grant Likely
@ 2014-11-19 3:16 ` Rob Herring
2014-11-19 14:43 ` Grant Likely
1 sibling, 1 reply; 29+ messages in thread
From: Rob Herring @ 2014-11-19 3:16 UTC (permalink / raw)
To: Kevin Cernekee
Cc: Greg Kroah-Hartman, Jiri Slaby, Arnd Bergmann, daniel,
haojian.zhuang, robert.jarzmik, Grant Likely, Florian Fainelli,
Maxime Bizon, Jonas Gorski, Linux-MIPS,
linux-serial@vger.kernel.org, devicetree@vger.kernel.org
On Wed, Nov 12, 2014 at 2:54 PM, Kevin Cernekee <cernekee@gmail.com> wrote:
> 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 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.
>
> Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
> ---
> drivers/of/fdt.c | 9 ++++++++-
> drivers/tty/serial/earlycon.c | 4 ++--
> include/linux/serial_core.h | 2 +-
> 3 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 30e97bc..15f80c9 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -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 native-endian documented?
> + 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);
> return 0;
> }
> return -ENODEV;
> diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
> index a514ee6..548f7d7 100644
> --- a/drivers/tty/serial/earlycon.c
> +++ b/drivers/tty/serial/earlycon.c
> @@ -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);
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index d2d5bf6..0d60c64 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -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
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties
2014-11-19 3:16 ` Rob Herring
@ 2014-11-19 14:43 ` Grant Likely
0 siblings, 0 replies; 29+ messages in thread
From: Grant Likely @ 2014-11-19 14:43 UTC (permalink / raw)
To: Rob Herring, Kevin Cernekee
Cc: Greg Kroah-Hartman, Jiri Slaby, Arnd Bergmann, daniel,
haojian.zhuang, robert.jarzmik, Florian Fainelli, Maxime Bizon,
Jonas Gorski, Linux-MIPS, linux-serial@vger.kernel.org,
devicetree@vger.kernel.org
On Tue, 18 Nov 2014 21:16:08 -0600
, Rob Herring <robh@kernel.org>
wrote:
> On Wed, Nov 12, 2014 at 2:54 PM, Kevin Cernekee <cernekee@gmail.com> wrote:
> > 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 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.
> >
> > Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
> > ---
> > drivers/of/fdt.c | 9 ++++++++-
> > drivers/tty/serial/earlycon.c | 4 ++--
> > include/linux/serial_core.h | 2 +-
> > 3 files changed, 11 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> > index 30e97bc..15f80c9 100644
> > --- a/drivers/of/fdt.c
> > +++ b/drivers/of/fdt.c
> > @@ -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 native-endian documented?
>
> > + 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);
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.
>
> > return 0;
> > }
> > return -ENODEV;
> > diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
> > index a514ee6..548f7d7 100644
> > --- a/drivers/tty/serial/earlycon.c
> > +++ b/drivers/tty/serial/earlycon.c
> > @@ -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);
> > diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> > index d2d5bf6..0d60c64 100644
> > --- a/include/linux/serial_core.h
> > +++ b/include/linux/serial_core.h
> > @@ -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
> >
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 06/10] serial: pxa: Add fifo-size and {big,native}-endian properties
2014-11-12 20:54 ` [PATCH V2 06/10] serial: pxa: Add fifo-size and {big,native}-endian properties Kevin Cernekee
@ 2014-11-19 14:49 ` Grant Likely
2014-11-19 16:23 ` Kevin Cernekee
0 siblings, 1 reply; 29+ messages in thread
From: Grant Likely @ 2014-11-19 14:49 UTC (permalink / raw)
To: Kevin Cernekee, gregkh, jslaby, robh
Cc: arnd, daniel, haojian.zhuang, robert.jarzmik, f.fainelli, mbizon,
jogo, linux-mips, linux-serial, devicetree
On Wed, 12 Nov 2014 12:54:03 -0800
, Kevin Cernekee <cernekee@gmail.com>
wrote:
> 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.
>
> Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
> ---
> drivers/tty/serial/pxa.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
> index 21b7d8b..21406dc 100644
> --- a/drivers/tty/serial/pxa.c
> +++ b/drivers/tty/serial/pxa.c
> @@ -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;
> }
>
> --
> 2.1.1
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 06/10] serial: pxa: Add fifo-size and {big,native}-endian properties
2014-11-19 14:49 ` Grant Likely
@ 2014-11-19 16:23 ` Kevin Cernekee
0 siblings, 0 replies; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-19 16:23 UTC (permalink / raw)
To: Grant Likely
Cc: Greg KH, Jiri Slaby, Rob Herring, Arnd Bergmann, daniel,
Haojian Zhuang, robert.jarzmik, Florian Fainelli, Maxime Bizon,
Jonas Gorski, Linux MIPS Mailing List,
linux-serial@vger.kernel.org, devicetree@vger.kernel.org
On Wed, Nov 19, 2014 at 6:49 AM, Grant Likely <grant.likely@linaro.org> wrote:
> On Wed, 12 Nov 2014 12:54:03 -0800
> , Kevin Cernekee <cernekee@gmail.com>
> wrote:
>> 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.
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:
http://www.spinics.net/lists/linux-serial/msg14811.html
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
2014-11-12 20:53 ` [PATCH V2 01/10] tty: Fallback to use dynamic major number Kevin Cernekee
@ 2014-11-25 20:34 ` Greg KH
2014-11-25 23:37 ` Kevin Cernekee
0 siblings, 1 reply; 29+ messages in thread
From: Greg KH @ 2014-11-25 20:34 UTC (permalink / raw)
To: Kevin Cernekee
Cc: jslaby, robh, arnd, daniel, haojian.zhuang, robert.jarzmik,
grant.likely, f.fainelli, mbizon, jogo, linux-mips, linux-serial,
devicetree
On Wed, Nov 12, 2014 at 12:53:58PM -0800, Kevin Cernekee wrote:
> From: Tushar Behera <tushar.behera@linaro.org>
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
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
2014-11-25 20:34 ` Greg KH
@ 2014-11-25 23:37 ` Kevin Cernekee
2014-11-25 23:49 ` Greg KH
2014-11-26 13:33 ` Grant Likely
0 siblings, 2 replies; 29+ messages in thread
From: Kevin Cernekee @ 2014-11-25 23:37 UTC (permalink / raw)
To: Greg KH
Cc: Jiri Slaby, Rob Herring, Arnd Bergmann, daniel, Haojian Zhuang,
Robert Jarzmik, Grant Likely, Florian Fainelli, Maxime Bizon,
Jonas Gorski, Linux MIPS Mailing List,
linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
tushar.b
On Tue, Nov 25, 2014 at 12:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Nov 12, 2014 at 12:53:58PM -0800, Kevin Cernekee wrote:
>> From: Tushar Behera <tushar.behera@linaro.org>
>
> 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?
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
2014-11-25 23:37 ` Kevin Cernekee
@ 2014-11-25 23:49 ` Greg KH
2014-11-26 13:33 ` Grant Likely
1 sibling, 0 replies; 29+ messages in thread
From: Greg KH @ 2014-11-25 23:49 UTC (permalink / raw)
To: Kevin Cernekee
Cc: Jiri Slaby, Rob Herring, Arnd Bergmann, daniel, Haojian Zhuang,
Robert Jarzmik, Grant Likely, Florian Fainelli, Maxime Bizon,
Jonas Gorski, Linux MIPS Mailing List,
linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
tushar.b
On Tue, Nov 25, 2014 at 03:37:16PM -0800, Kevin Cernekee wrote:
> On Tue, Nov 25, 2014 at 12:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Wed, Nov 12, 2014 at 12:53:58PM -0800, Kevin Cernekee wrote:
> >> From: Tushar Behera <tushar.behera@linaro.org>
> >
> > 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?
We can't do anything "at the expense of compatibility", sorry.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
2014-11-25 23:37 ` Kevin Cernekee
2014-11-25 23:49 ` Greg KH
@ 2014-11-26 13:33 ` Grant Likely
2014-11-26 14:34 ` Peter Hurley
1 sibling, 1 reply; 29+ messages in thread
From: Grant Likely @ 2014-11-26 13:33 UTC (permalink / raw)
To: Kevin Cernekee, Greg KH
Cc: Jiri Slaby, Rob Herring, Arnd Bergmann, daniel, Haojian Zhuang,
Robert Jarzmik, Florian Fainelli, Maxime Bizon, Jonas Gorski,
Linux MIPS Mailing List, linux-serial@vger.kernel.org,
devicetree@vger.kernel.org, tushar.b
On Tue, 25 Nov 2014 15:37:16 -0800
, Kevin Cernekee <cernekee@gmail.com>
wrote:
> On Tue, Nov 25, 2014 at 12:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Wed, Nov 12, 2014 at 12:53:58PM -0800, Kevin Cernekee wrote:
> >> From: Tushar Behera <tushar.behera@linaro.org>
> >
> > 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?
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.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
2014-11-26 13:33 ` Grant Likely
@ 2014-11-26 14:34 ` Peter Hurley
2014-11-27 11:10 ` Geert Uytterhoeven
2014-11-27 13:50 ` Grant Likely
0 siblings, 2 replies; 29+ messages in thread
From: Peter Hurley @ 2014-11-26 14:34 UTC (permalink / raw)
To: Grant Likely, Kevin Cernekee, Greg KH
Cc: Jiri Slaby, Rob Herring, Arnd Bergmann, daniel, Haojian Zhuang,
Robert Jarzmik, Florian Fainelli, Maxime Bizon, Jonas Gorski,
Linux MIPS Mailing List, linux-serial@vger.kernel.org,
devicetree@vger.kernel.org, tushar.b
On 11/26/2014 08:33 AM, Grant Likely wrote:
> On Tue, 25 Nov 2014 15:37:16 -0800
> , Kevin Cernekee <cernekee@gmail.com>
> wrote:
>> On Tue, Nov 25, 2014 at 12:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>> On Wed, Nov 12, 2014 at 12:53:58PM -0800, Kevin Cernekee wrote:
>>>> From: Tushar Behera <tushar.behera@linaro.org>
>>>
>>> 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?
>
> 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.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
2014-11-26 14:34 ` Peter Hurley
@ 2014-11-27 11:10 ` Geert Uytterhoeven
2014-11-27 13:50 ` Grant Likely
1 sibling, 0 replies; 29+ messages in thread
From: Geert Uytterhoeven @ 2014-11-27 11:10 UTC (permalink / raw)
To: Peter Hurley
Cc: Grant Likely, Kevin Cernekee, Greg KH, Jiri Slaby, Rob Herring,
Arnd Bergmann, daniel, Haojian Zhuang, Robert Jarzmik,
Florian Fainelli, Maxime Bizon, Jonas Gorski,
Linux MIPS Mailing List, linux-serial@vger.kernel.org,
devicetree@vger.kernel.org, tushar.b
On Wed, Nov 26, 2014 at 3:34 PM, Peter Hurley <peter@hurleysoftware.com> wrote:
> On 11/26/2014 08:33 AM, Grant Likely wrote:
>> On Tue, 25 Nov 2014 15:37:16 -0800
>> , Kevin Cernekee <cernekee@gmail.com>
>> wrote:
>>> On Tue, Nov 25, 2014 at 12:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>> On Wed, Nov 12, 2014 at 12:53:58PM -0800, Kevin Cernekee wrote:
>>>>> From: Tushar Behera <tushar.behera@linaro.org>
>>>>
>>>> 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?
>>
>> 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 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
2014-11-26 14:34 ` Peter Hurley
2014-11-27 11:10 ` Geert Uytterhoeven
@ 2014-11-27 13:50 ` Grant Likely
2014-11-27 14:33 ` Arnd Bergmann
1 sibling, 1 reply; 29+ messages in thread
From: Grant Likely @ 2014-11-27 13:50 UTC (permalink / raw)
To: Peter Hurley
Cc: Kevin Cernekee, Greg KH, Jiri Slaby, Rob Herring, Arnd Bergmann,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Florian Fainelli,
Maxime Bizon, Jonas Gorski, Linux MIPS Mailing List,
linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
tushar.b
On Wed, Nov 26, 2014 at 2:34 PM, Peter Hurley <peter@hurleysoftware.com> wrote:
> On 11/26/2014 08:33 AM, Grant Likely wrote:
>> On Tue, 25 Nov 2014 15:37:16 -0800
>> , Kevin Cernekee <cernekee@gmail.com>
>> wrote:
>>> On Tue, Nov 25, 2014 at 12:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>>> On Wed, Nov 12, 2014 at 12:53:58PM -0800, Kevin Cernekee wrote:
>>>>> From: Tushar Behera <tushar.behera@linaro.org>
>>>>
>>>> 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?
>>
>> 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.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH V2 01/10] tty: Fallback to use dynamic major number
2014-11-27 13:50 ` Grant Likely
@ 2014-11-27 14:33 ` Arnd Bergmann
0 siblings, 0 replies; 29+ messages in thread
From: Arnd Bergmann @ 2014-11-27 14:33 UTC (permalink / raw)
To: Grant Likely
Cc: Peter Hurley, Kevin Cernekee, Greg KH, Jiri Slaby, Rob Herring,
Daniel Mack, Haojian Zhuang, Robert Jarzmik, Florian Fainelli,
Maxime Bizon, Jonas Gorski, Linux MIPS Mailing List,
linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
tushar.b
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
^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2014-11-27 14:33 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-12 20:53 [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Kevin Cernekee
2014-11-12 20:53 ` [PATCH V2 01/10] tty: Fallback to use dynamic major number Kevin Cernekee
2014-11-25 20:34 ` Greg KH
2014-11-25 23:37 ` Kevin Cernekee
2014-11-25 23:49 ` Greg KH
2014-11-26 13:33 ` Grant Likely
2014-11-26 14:34 ` Peter Hurley
2014-11-27 11:10 ` Geert Uytterhoeven
2014-11-27 13:50 ` Grant Likely
2014-11-27 14:33 ` Arnd Bergmann
2014-11-12 20:53 ` [PATCH V2 02/10] serial: core: Add big-endian iotype Kevin Cernekee
2014-11-12 20:54 ` [PATCH V2 03/10] of: Fix of_device_is_compatible() comment Kevin Cernekee
2014-11-18 17:32 ` Grant Likely
2014-11-12 20:54 ` [PATCH V2 04/10] of: Change of_device_is_available() to return bool Kevin Cernekee
2014-11-18 17:33 ` Grant Likely
2014-11-12 20:54 ` [PATCH V2 05/10] of: Add helper function to check MMIO register endianness Kevin Cernekee
2014-11-18 21:47 ` Grant Likely
2014-11-12 20:54 ` [PATCH V2 06/10] serial: pxa: Add fifo-size and {big,native}-endian properties Kevin Cernekee
2014-11-19 14:49 ` Grant Likely
2014-11-19 16:23 ` Kevin Cernekee
2014-11-12 20:54 ` [PATCH V2 07/10] serial: pxa: Make the driver buildable for BCM7xxx set-top platforms Kevin Cernekee
2014-11-12 20:54 ` [PATCH V2 08/10] serial: pxa: Update DT binding documentation Kevin Cernekee
2014-11-12 20:54 ` [PATCH V2 09/10] serial: earlycon: Set UPIO_MEM32BE based on DT properties Kevin Cernekee
2014-11-18 21:50 ` Grant Likely
2014-11-19 3:16 ` Rob Herring
2014-11-19 14:43 ` Grant Likely
2014-11-12 20:54 ` [PATCH V2 10/10] serial: pxa: Add OF_EARLYCON support Kevin Cernekee
[not found] ` <1415825647-6024-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-13 7:36 ` [PATCH V2 00/10] UART driver support for BMIPS multiplatform kernels Robert Jarzmik
2014-11-13 16:39 ` Kevin Cernekee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).