Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67505
b: refs/heads/master
c: 6b0b594
h: refs/heads/master
i:
  67503: 6f41c82
v: v3
  • Loading branch information
Timur Tabi authored and Kumar Gala committed Oct 8, 2007
1 parent 0a50be3 commit 7eb9895
Show file tree
Hide file tree
Showing 13 changed files with 432 additions and 413 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: 6039680705906f270411435c05c869ac4f59ef10
refs/heads/master: 6b0b594bb81f86dbc7b0829ee5102abaab242913
36 changes: 23 additions & 13 deletions trunk/arch/powerpc/sysdev/qe_lib/qe.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ EXPORT_SYMBOL(qe_issue_cmd);
* 16 BRGs, which can be connected to the QE channels or output
* as clocks. The BRGs are in two different block of internal
* memory mapped space.
* The baud rate clock is the system clock divided by something.
* The BRG clock is the QE clock divided by 2.
* It was set up long ago during the initial boot phase and is
* is given to us.
* Baud rate clocks are zero-based in the driver code (as that maps
Expand All @@ -165,28 +165,38 @@ unsigned int get_brg_clk(void)
return brg_clk;
}

/* This function is used by UARTS, or anything else that uses a 16x
* oversampled clock.
/* Program the BRG to the given sampling rate and multiplier
*
* @brg: the BRG, 1-16
* @rate: the desired sampling rate
* @multiplier: corresponds to the value programmed in GUMR_L[RDCR] or
* GUMR_L[TDCR]. E.g., if this BRG is the RX clock, and GUMR_L[RDCR]=01,
* then 'multiplier' should be 8.
*
* Also note that the value programmed into the BRGC register must be even.
*/
void qe_setbrg(u32 brg, u32 rate)
void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier)
{
volatile u32 *bp;
u32 divisor, tempval;
int div16 = 0;
u32 div16 = 0;

bp = &qe_immr->brg.brgc[brg];
divisor = get_brg_clk() / (rate * multiplier);

divisor = (get_brg_clk() / rate);
if (divisor > QE_BRGC_DIVISOR_MAX + 1) {
div16 = 1;
div16 = QE_BRGC_DIV16;
divisor /= 16;
}

tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | QE_BRGC_ENABLE;
if (div16)
tempval |= QE_BRGC_DIV16;
/* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says
that the BRG divisor must be even if you're not using divide-by-16
mode. */
if (!div16 && (divisor & 1))
divisor++;

tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) |
QE_BRGC_ENABLE | div16;

out_be32(bp, tempval);
out_be32(&qe_immr->brg.brgc[brg - 1], tempval);
}

/* Initialize SNUMs (thread serial numbers) according to
Expand Down
2 changes: 0 additions & 2 deletions trunk/arch/powerpc/sysdev/qe_lib/qe_ic.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,6 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags)
set_irq_data(qe_ic->virq_high, qe_ic);
set_irq_chained_handler(qe_ic->virq_high, qe_ic_cascade_high);
}

printk("QEIC (%d IRQ sources) at %p\n", NR_QE_IC_INTS, qe_ic->regs);
}

void qe_ic_set_highest_priority(unsigned int virq, int high)
Expand Down
35 changes: 14 additions & 21 deletions trunk/arch/powerpc/sysdev/qe_lib/qe_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,29 +195,22 @@ EXPORT_SYMBOL(par_io_of_config);
#ifdef DEBUG
static void dump_par_io(void)
{
int i;
unsigned int i;

printk(KERN_INFO "PAR IO registars:\n");
printk(KERN_INFO "Base address: 0x%08x\n", (u32) par_io);
printk(KERN_INFO "%s: par_io=%p\n", __FUNCTION__, par_io);
for (i = 0; i < num_par_io_ports; i++) {
printk(KERN_INFO "cpodr[%d] : addr - 0x%08x, val - 0x%08x\n",
i, (u32) & par_io[i].cpodr,
in_be32(&par_io[i].cpodr));
printk(KERN_INFO "cpdata[%d]: addr - 0x%08x, val - 0x%08x\n",
i, (u32) & par_io[i].cpdata,
in_be32(&par_io[i].cpdata));
printk(KERN_INFO "cpdir1[%d]: addr - 0x%08x, val - 0x%08x\n",
i, (u32) & par_io[i].cpdir1,
in_be32(&par_io[i].cpdir1));
printk(KERN_INFO "cpdir2[%d]: addr - 0x%08x, val - 0x%08x\n",
i, (u32) & par_io[i].cpdir2,
in_be32(&par_io[i].cpdir2));
printk(KERN_INFO "cppar1[%d]: addr - 0x%08x, val - 0x%08x\n",
i, (u32) & par_io[i].cppar1,
in_be32(&par_io[i].cppar1));
printk(KERN_INFO "cppar2[%d]: addr - 0x%08x, val - 0x%08x\n",
i, (u32) & par_io[i].cppar2,
in_be32(&par_io[i].cppar2));
printk(KERN_INFO " cpodr[%u]=%08x\n", i,
in_be32(&par_io[i].cpodr));
printk(KERN_INFO " cpdata[%u]=%08x\n", i,
in_be32(&par_io[i].cpdata));
printk(KERN_INFO " cpdir1[%u]=%08x\n", i,
in_be32(&par_io[i].cpdir1));
printk(KERN_INFO " cpdir2[%u]=%08x\n", i,
in_be32(&par_io[i].cpdir2));
printk(KERN_INFO " cppar1[%u]=%08x\n", i,
in_be32(&par_io[i].cppar1));
printk(KERN_INFO " cppar2[%u]=%08x\n", i,
in_be32(&par_io[i].cppar2));
}

}
Expand Down
Loading

0 comments on commit 7eb9895

Please sign in to comment.