diff --git a/drivers/serial/altera_jtaguart.c b/drivers/serial/altera_jtaguart.c
index f9b49b5..238348e 100644
--- a/drivers/serial/altera_jtaguart.c
+++ b/drivers/serial/altera_jtaguart.c
@@ -433,15 +433,33 @@ static int __devinit altera_jtaguart_probe(struct platform_device *pdev)
 	struct uart_port *port;
 	int i;
 
-	for (i = 0; i < ALTERA_JTAGUART_MAXPORTS && platp[i].mapbase; i++) {
+	for (i = 0; i < ALTERA_JTAGUART_MAXPORTS; i++) {
 		port = &altera_jtaguart_ports[i].port;
 
+		if(platp)
+		{
+			if(!platp[i].mapbase)
+				break;
+
+			port->mapbase = platp[i].mapbase;
+			port->irq = platp[i].irq;
+		} else {
+#ifdef CONFIG_OF
+			struct resource *res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+			struct resource *res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+			if((!res_mem) || (!res_irq))
+				break;
+
+			port->mapbase = res_mem->start;
+			port->irq = res_irq->start;
+#else
+			break;
+#endif
+		}
 		port->line = i;
 		port->type = PORT_ALTERA_JTAGUART;
-		port->mapbase = platp[i].mapbase;
 		port->membase = ioremap(port->mapbase, ALTERA_JTAGUART_SIZE);
 		port->iotype = SERIAL_IO_MEM;
-		port->irq = platp[i].irq;
 		port->ops = &altera_jtaguart_ops;
 		port->flags = ASYNC_BOOT_AUTOCONF;
 
@@ -464,6 +482,15 @@ static int __devexit altera_jtaguart_remove(struct platform_device *pdev)
 
 	return 0;
 }
+#ifdef CONFIG_OF
+static struct of_device_id altera_jtaguart_match[] = {
+	{ 
+		.compatible = "altera,altera_juart",
+	},
+	{},
+}
+MODULE_DEVICE_TABLE(of, altera_jtaguart_match);
+#endif /* CONFIG_OF */
 
 static struct platform_driver altera_jtaguart_platform_driver = {
 	.probe	= altera_jtaguart_probe,
@@ -471,6 +498,9 @@ static struct platform_driver altera_jtaguart_platform_driver = {
 	.driver	= {
 		.name	= DRV_NAME,
 		.owner	= THIS_MODULE,
+#ifdef CONFIG_OF
+		.of_match_table = altera_jtaguart_match,
+#endif
 	},
 };
 
