mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch][rfc] 8250_early: Too early for ioremap
@ 2006-01-01 15:12 Gyorgy Jeney
  2006-01-04 18:04 ` Russell King
  0 siblings, 1 reply; 2+ messages in thread
From: Gyorgy Jeney @ 2006-01-01 15:12 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-kernel, rmk+serial, linux-serial

From: Gyorgy Jeney

Let the individual architectures define the function to use to remap the mmio-
range that will be used by the 8250_early driver.  This is needed because, the
default, ioremap() is non-functional when the 8250_early driver initialises.

Signed-off-by: Gyorgy Jeney <nog.lkml@gmail.com>

---

The 8250_early driver gets used early in the boot process, when the full-blown
ioremap() function is still unavailible.  The logical looking solution would be
to simply s/ioremap/bt_ioremap/, s/iounmap/bt_iounmap/ but the only port in the
2.6.14 kernel that has that function is i386.  Those functions look pretty
generic so perhaps they could be moved to mm/bootmem.c or something but they
rely on fixmap to be availibe which is only availible on 9 out of 25 archs.
The best I could come up with is the attached "hack".

Since the mmio code does appear in 8250_early I'm guessing that it works for
someone out there, which means this change is wrong..  How do I get 8250_early
to use MMIO cleanly?

nog.

--- drivers/serial/8250_early.c	2005-10-28 02:02:08.000000000 +0200
+++ ../../linux-2.6.14/drivers/serial/8250_early.c	2006-01-01
14:40:28.000000000 +0100
@@ -34,6 +34,7 @@
 #include <linux/serial.h>
 #include <asm/io.h>
 #include <asm/serial.h>
+#include <linux/serial_8250.h>

 struct early_uart_device {
 	struct uart_port port;
@@ -148,7 +149,7 @@ static int __init parse_options(struct e
 	if (!strncmp(options, "mmio,", 5)) {
 		port->iotype = UPIO_MEM;
 		port->mapbase = simple_strtoul(options + 5, &options, 0);
-		port->membase = ioremap(port->mapbase, mapsize);
+		port->membase = early_8250_ioremap(port->mapbase, mapsize);
 		if (!port->membase) {
 			printk(KERN_ERR "%s: Couldn't ioremap 0x%lx\n",
 				__FUNCTION__, port->mapbase);
@@ -248,7 +249,7 @@ static int __init early_uart_console_swi

 	unregister_console(&early_uart_console);
 	if (mmio)
-		iounmap(port->membase);
+		early_8250_iounmap(port->membase, 64);

 	return 0;
 }
--- include/linux/serial_8250.h	2005-10-28 02:02:08.000000000 +0200
+++ ../../linux-2.6.14/include/linux/serial_8250.h	2006-01-01
14:42:39.000000000 +0100
@@ -57,4 +57,16 @@ void serial8250_unregister_port(int line
 void serial8250_suspend_port(int line);
 void serial8250_resume_port(int line);

+/*
+ * Default ioremapping functions to use in the 8250_early driver.  Individual
+ * architechtures may override these in include/asm/serial.h (to something more
+ * sane like bt_io{re,un}map).
+ */
+#ifndef early_8250_ioremap
+#define early_8250_ioremap(addr, len)	ioremap(addr, len)
+#endif
+#ifndef early_8250_iounmap
+#define early_8250_iounmap(addr, len)	iounmap(addr)
+#endif
+
 #endif

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch][rfc] 8250_early: Too early for ioremap
  2006-01-01 15:12 [patch][rfc] 8250_early: Too early for ioremap Gyorgy Jeney
@ 2006-01-04 18:04 ` Russell King
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King @ 2006-01-04 18:04 UTC (permalink / raw)
  To: Gyorgy Jeney; +Cc: Bjorn Helgaas, linux-kernel, linux-serial

On Sun, Jan 01, 2006 at 04:12:21PM +0100, Gyorgy Jeney wrote:
> Let the individual architectures define the function to use to remap the
> mmio-range that will be used by the 8250_early driver.  This is needed
> because, the default, ioremap() is non-functional when the 8250_early
> driver initialises.

Isn't there some other way this can be handled?  Can't this be hidden
in the architectures ioremap where it's a problem?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-01-04 18:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-01 15:12 [patch][rfc] 8250_early: Too early for ioremap Gyorgy Jeney
2006-01-04 18:04 ` Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome