|
@@ -555,10 +555,9 @@ static struct uart_driver grlib_apbuart_driver = {
|
|
|
|
|
|
static int __devinit apbuart_probe(struct platform_device *op)
|
|
static int __devinit apbuart_probe(struct platform_device *op)
|
|
{
|
|
{
|
|
- int i = -1;
|
|
|
|
|
|
+ int i;
|
|
struct uart_port *port = NULL;
|
|
struct uart_port *port = NULL;
|
|
|
|
|
|
- i = 0;
|
|
|
|
for (i = 0; i < grlib_apbuart_port_nr; i++) {
|
|
for (i = 0; i < grlib_apbuart_port_nr; i++) {
|
|
if (op->dev.of_node == grlib_apbuart_nodes[i])
|
|
if (op->dev.of_node == grlib_apbuart_nodes[i])
|
|
break;
|
|
break;
|
|
@@ -566,6 +565,7 @@ static int __devinit apbuart_probe(struct platform_device *op)
|
|
|
|
|
|
port = &grlib_apbuart_ports[i];
|
|
port = &grlib_apbuart_ports[i];
|
|
port->dev = &op->dev;
|
|
port->dev = &op->dev;
|
|
|
|
+ port->irq = op->archdata.irqs[0];
|
|
|
|
|
|
uart_add_one_port(&grlib_apbuart_driver, (struct uart_port *) port);
|
|
uart_add_one_port(&grlib_apbuart_driver, (struct uart_port *) port);
|
|
|
|
|
|
@@ -598,24 +598,12 @@ static struct platform_driver grlib_apbuart_of_driver = {
|
|
|
|
|
|
static int grlib_apbuart_configure(void)
|
|
static int grlib_apbuart_configure(void)
|
|
{
|
|
{
|
|
- struct device_node *np, *rp;
|
|
|
|
- const u32 *prop;
|
|
|
|
- int freq_khz, line = 0;
|
|
|
|
-
|
|
|
|
- /* Get bus frequency */
|
|
|
|
- rp = of_find_node_by_path("/");
|
|
|
|
- if (!rp)
|
|
|
|
- return -ENODEV;
|
|
|
|
- rp = of_get_next_child(rp, NULL);
|
|
|
|
- if (!rp)
|
|
|
|
- return -ENODEV;
|
|
|
|
- prop = of_get_property(rp, "clock-frequency", NULL);
|
|
|
|
- if (!prop)
|
|
|
|
- return -ENODEV;
|
|
|
|
- freq_khz = *prop;
|
|
|
|
|
|
+ struct device_node *np;
|
|
|
|
+ int line = 0;
|
|
|
|
|
|
for_each_matching_node(np, apbuart_match) {
|
|
for_each_matching_node(np, apbuart_match) {
|
|
- const int *irqs, *ampopts;
|
|
|
|
|
|
+ const int *ampopts;
|
|
|
|
+ const u32 *freq_hz;
|
|
const struct amba_prom_registers *regs;
|
|
const struct amba_prom_registers *regs;
|
|
struct uart_port *port;
|
|
struct uart_port *port;
|
|
unsigned long addr;
|
|
unsigned long addr;
|
|
@@ -623,11 +611,11 @@ static int grlib_apbuart_configure(void)
|
|
ampopts = of_get_property(np, "ampopts", NULL);
|
|
ampopts = of_get_property(np, "ampopts", NULL);
|
|
if (ampopts && (*ampopts == 0))
|
|
if (ampopts && (*ampopts == 0))
|
|
continue; /* Ignore if used by another OS instance */
|
|
continue; /* Ignore if used by another OS instance */
|
|
-
|
|
|
|
- irqs = of_get_property(np, "interrupts", NULL);
|
|
|
|
regs = of_get_property(np, "reg", NULL);
|
|
regs = of_get_property(np, "reg", NULL);
|
|
|
|
+ /* Frequency of APB Bus is frequency of UART */
|
|
|
|
+ freq_hz = of_get_property(np, "freq", NULL);
|
|
|
|
|
|
- if (!irqs || !regs)
|
|
|
|
|
|
+ if (!regs || !freq_hz || (*freq_hz == 0))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
grlib_apbuart_nodes[line] = np;
|
|
grlib_apbuart_nodes[line] = np;
|
|
@@ -638,12 +626,12 @@ static int grlib_apbuart_configure(void)
|
|
|
|
|
|
port->mapbase = addr;
|
|
port->mapbase = addr;
|
|
port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map));
|
|
port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map));
|
|
- port->irq = *irqs;
|
|
|
|
|
|
+ port->irq = 0;
|
|
port->iotype = UPIO_MEM;
|
|
port->iotype = UPIO_MEM;
|
|
port->ops = &grlib_apbuart_ops;
|
|
port->ops = &grlib_apbuart_ops;
|
|
port->flags = UPF_BOOT_AUTOCONF;
|
|
port->flags = UPF_BOOT_AUTOCONF;
|
|
port->line = line;
|
|
port->line = line;
|
|
- port->uartclk = freq_khz * 1000;
|
|
|
|
|
|
+ port->uartclk = *freq_hz;
|
|
port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line);
|
|
port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line);
|
|
line++;
|
|
line++;
|
|
|
|
|