]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
tegra: add clock_ll_start_uart() to enable UART prior to reloc
authorSimon Glass <sjg@chromium.org>
Mon, 28 Nov 2011 15:04:37 +0000 (15:04 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 24 Dec 2011 09:23:32 +0000 (10:23 +0100)
Most boards will want to enable a UART early. This function provides
that feature in Tegra architecture code so the code does not need to be
copied on every board.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
arch/arm/cpu/armv7/tegra2/clock.c
arch/arm/include/asm/arch-tegra2/clock.h

index 03ac1e3ed0077d843e29e72a28f8077f73ef8b6b..11d2346d83b0fda80052b79f68ac3583779ba990 100644 (file)
@@ -904,6 +904,20 @@ static int clock_set_rate(enum clock_id clkid, u32 n, u32 m, u32 p, u32 cpcon)
        return 0;
 }
 
+void clock_ll_start_uart(enum periph_id periph_id)
+{
+       /* Assert UART reset and enable clock */
+       reset_set_enable(periph_id, 1);
+       clock_enable(periph_id);
+       clock_ll_set_source(periph_id, 0); /* UARTx_CLK_SRC = 00, PLLP_OUT0 */
+
+       /* wait for 2us */
+       udelay(2);
+
+       /* De-assert reset to UART */
+       reset_set_enable(periph_id, 0);
+}
+
 int clock_verify(void)
 {
        struct clk_pll *pll = get_pll(CLOCK_ID_PERIPH);
index 49e9904b57c126b273cb077d3b08f22fa98bead4..080ef18e81dec2602f031ad10f4745cfdbe3c4f0 100644 (file)
@@ -344,6 +344,17 @@ unsigned clock_adjust_periph_pll_div(enum periph_id periph_id,
  */
 unsigned clock_get_rate(enum clock_id clkid);
 
+/**
+ * Start up a UART using low-level calls
+ *
+ * Prior to relocation clock_start_periph_pll() cannot be called. This
+ * function provides a way to set up a UART using low-level calls which
+ * do not require BSS.
+ *
+ * @param periph_id    Peripheral ID of UART to enable (e,g, PERIPH_ID_UART1)
+ */
+void clock_ll_start_uart(enum periph_id periph_id);
+
 /*
  * Checks that clocks are valid and prints a warning if not
  *