diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2007-07-05 18:01:59 +0200 |
---|---|---|
committer | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-07-05 18:01:59 +0200 |
commit | 5735a344786aa5b266c4eeac9ba8ddf7a2650e7b (patch) | |
tree | 4e924a462c25ed6ab03b4856798f5b744a2ad741 /drivers | |
parent | 5bffd205f6a0ee9d5d63da22224bbd140eacdafe (diff) | |
download | barebox-5735a344786aa5b266c4eeac9ba8ddf7a2650e7b.tar.gz barebox-5735a344786aa5b266c4eeac9ba8ddf7a2650e7b.tar.xz |
svn_rev_501
move linux_console driver to drivers/serial
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/serial/Kconfig | 5 | ||||
-rw-r--r-- | drivers/serial/Makefile | 3 | ||||
-rw-r--r-- | drivers/serial/linux_console.c | 70 |
3 files changed, 77 insertions, 1 deletions
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 672773cc2f..c7cc6b63f3 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -5,4 +5,9 @@ config DRIVER_SERIAL_IMX default y bool "i.MX serial driver" +config DRIVER_SERIAL_LINUX_COMSOLE + depends on LINUX + default y + bool "linux console driver" + endmenu diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 1a8d887d73..56c75c4b97 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -5,4 +5,5 @@ # serial_pl010.o # serial_pl011.o # serial_xuartlite.o -obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o +obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o +obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.o
\ No newline at end of file diff --git a/drivers/serial/linux_console.c b/drivers/serial/linux_console.c new file mode 100644 index 0000000000..a7f9e8b12e --- /dev/null +++ b/drivers/serial/linux_console.c @@ -0,0 +1,70 @@ +#include <common.h> +#include <driver.h> +#include <init.h> +#include <asm/arch/linux.h> +#include <malloc.h> +#include <console.h> + +static void linux_console_putc(struct console_device *cdev, char c) +{ + linux_putc(c); +} + +static int linux_console_tstc(struct console_device *cdev) +{ + return linux_tstc(); +} + +static int linux_console_getc(struct console_device *cdev) +{ + return linux_getc(); +} + +static int linux_console_probe(struct device_d *dev) +{ + struct console_device *cdev; + + cdev = malloc(sizeof(struct console_device)); + dev->type_data = cdev; + cdev->dev = dev; + cdev->flags = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR; + cdev->tstc = linux_console_tstc; + cdev->putc = linux_console_putc; + cdev->getc = linux_console_getc; + + console_register(cdev); + + return 0; +} + + +static struct driver_d linux_console_driver = { + .name = "console", + .probe = linux_console_probe, + .type = DEVICE_TYPE_CONSOLE, +}; + +static struct device_d linux_console_device = { + .name = "console", + .id = "cs0", + .type = DEVICE_TYPE_CONSOLE, +}; + +#if 0 +static struct device_d linux_console_device1 = { + .name = "console", + .id = "cs1", + .type = DEVICE_TYPE_CONSOLE, +}; +#endif + +static int console_init(void) +{ + register_driver(&linux_console_driver); + register_device(&linux_console_device); +// register_device(&linux_console_device1); + return 0; +} + +console_initcall(console_init); + |