Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 243574
b: refs/heads/master
c: c897dcf
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Hellstrom authored and David S. Miller committed Mar 30, 2011
1 parent 7d97ae6 commit ebd36f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 10544f128c338aeb7f63c002ad7eee67aa0e6acf
refs/heads/master: c897dcf6311ea9c8d24e96cc7f7fe9de58a0a6a2
24 changes: 7 additions & 17 deletions trunk/drivers/tty/serial/apbuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,24 +598,12 @@ static struct platform_driver grlib_apbuart_of_driver = {

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) {
const int *ampopts;
const u32 *freq_hz;
const struct amba_prom_registers *regs;
struct uart_port *port;
unsigned long addr;
Expand All @@ -624,8 +612,10 @@ static int grlib_apbuart_configure(void)
if (ampopts && (*ampopts == 0))
continue; /* Ignore if used by another OS instance */
regs = of_get_property(np, "reg", NULL);
/* Frequency of APB Bus is frequency of UART */
freq_hz = of_get_property(np, "freq", NULL);

if (!regs)
if (!regs || !freq_hz || (*freq_hz == 0))
continue;

grlib_apbuart_nodes[line] = np;
Expand All @@ -641,7 +631,7 @@ static int grlib_apbuart_configure(void)
port->ops = &grlib_apbuart_ops;
port->flags = UPF_BOOT_AUTOCONF;
port->line = line;
port->uartclk = freq_khz * 1000;
port->uartclk = *freq_hz;
port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line);
line++;

Expand Down

0 comments on commit ebd36f4

Please sign in to comment.