#include <linux/console.h>
#include <linux/sysrq.h>
#include <linux/irq.h>
+#include <linux/platform_device.h>
#include <asm/system.h>
#include <asm/io.h>
#define SERIAL_AMAZONASC_NR UART_NR
static void amazonasc_tx_chars(struct uart_port *port);
-extern void prom_printf(const char * fmt, ...);
static struct uart_port amazonasc_ports[UART_NR];
static struct uart_driver amazonasc_reg;
static unsigned int uartclk = 0;
-extern unsigned int amazon_get_fpi_hz(void);
static void amazonasc_stop_tx(struct uart_port *port)
{
return;
}
+#include <linux/version.h>
+
static void
amazonasc_rx_chars(struct uart_port *port)
{
- struct tty_struct *tty = port->info->tty;
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31))
+ struct tty_struct *tty = port->state->port.tty;
+#else
+ struct tty_struct *tty = port->info->port.tty;
+#endif
unsigned int ch = 0, rsr = 0, fifocnt;
fifocnt = amazon_readl(AMAZON_ASC_FSTAT) & ASCFSTAT_RXFFLMASK;
static void amazonasc_tx_chars(struct uart_port *port)
{
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31))
+ struct circ_buf *xmit = &port->state->xmit;
+#else
struct circ_buf *xmit = &port->info->xmit;
+#endif
if (uart_tx_stopped(port)) {
amazonasc_stop_tx(port);
data: &amazonasc_reg,
};
-static int __init amazonasc_console_init(void)
-{
- register_console(&amazonasc_console);
- return 0;
-}
-console_initcall(amazonasc_console_init);
-
static struct uart_driver amazonasc_reg = {
.owner = THIS_MODULE,
.driver_name = "serial",
.cons = &amazonasc_console,
};
-static int __init amazonasc_init(void)
+static int __init amazon_asc_probe(struct platform_device *dev)
{
unsigned char res;
uart_register_driver(&amazonasc_reg);
return res;
}
-static void __exit amazonasc_exit(void)
+static int amazon_asc_remove(struct platform_device *dev)
{
uart_unregister_driver(&amazonasc_reg);
+ return 0;
}
-module_init(amazonasc_init);
-module_exit(amazonasc_exit);
+static struct platform_driver amazon_asc_driver = {
+ .probe = amazon_asc_probe,
+ .remove = amazon_asc_remove,
+ .driver = {
+ .name = "amazon_asc",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init amazon_asc_init(void)
+{
+ int ret = platform_driver_register(&amazon_asc_driver);
+ if (ret)
+ printk(KERN_WARNING "amazon_asc: error registering platfom driver!\n");
+ return ret;
+}
+
+static void __exit amazon_asc_cleanup(void)
+{
+ platform_driver_unregister(&amazon_asc_driver);
+}
+
+module_init(amazon_asc_init);
+module_exit(amazon_asc_cleanup);
MODULE_AUTHOR("Gary Jennejohn, Felix Fietkau, John Crispin");
MODULE_DESCRIPTION("MIPS AMAZONASC serial port driver");
MODULE_LICENSE("GPL");
+