]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
apq8016: Add support for UART1 clocks and pinmux
authorSumit Garg <sumit.garg@linaro.org>
Fri, 12 Apr 2024 09:54:33 +0000 (15:24 +0530)
committerCaleb Connolly <caleb.connolly@linaro.org>
Tue, 23 Apr 2024 11:29:22 +0000 (13:29 +0200)
SE HMIBSC board uses UART1 as the main debug console, so add
corresponding clocks and pinmux support. Along with that update
instructions to enable clocks for debug UART support.

Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
drivers/clk/qcom/clock-apq8016.c
drivers/pinctrl/qcom/pinctrl-apq8016.c
drivers/serial/serial_msm.c

index 6210fba8798475fdf53cd8cada948310386865c0..d3b63b9c1ac5b440b32bab0bc9f7b1c9720c1c30 100644 (file)
@@ -31,7 +31,8 @@
 #define BLSP1_AHB_CBCR                 0x1008
 
 /* Uart clock control registers */
-#define BLSP1_UART2_BCR                        (0x3028)
+#define BLSP1_UART1_APPS_CBCR          (0x203C)
+#define BLSP1_UART1_APPS_CMD_RCGR      (0x2044)
 #define BLSP1_UART2_APPS_CBCR          (0x302C)
 #define BLSP1_UART2_APPS_CMD_RCGR      (0x3034)
 
@@ -52,7 +53,7 @@ static struct vote_clk gcc_blsp1_ahb_clk = {
 };
 
 /* SDHCI */
-static int clk_init_sdc(struct msm_clk_priv *priv, int slot, uint rate)
+static int apq8016_clk_init_sdc(struct msm_clk_priv *priv, int slot, uint rate)
 {
        int div = 15; /* 100MHz default */
 
@@ -70,20 +71,35 @@ static int clk_init_sdc(struct msm_clk_priv *priv, int slot, uint rate)
 }
 
 /* UART: 115200 */
-int apq8016_clk_init_uart(phys_addr_t base)
+int apq8016_clk_init_uart(phys_addr_t base, unsigned long id)
 {
+       u32 cmd_rcgr, apps_cbcr;
+
+       switch (id) {
+       case GCC_BLSP1_UART1_APPS_CLK:
+               cmd_rcgr = BLSP1_UART1_APPS_CMD_RCGR;
+               apps_cbcr = BLSP1_UART1_APPS_CBCR;
+               break;
+       case GCC_BLSP1_UART2_APPS_CLK:
+               cmd_rcgr = BLSP1_UART2_APPS_CMD_RCGR;
+               apps_cbcr = BLSP1_UART2_APPS_CBCR;
+               break;
+       default:
+               return 0;
+       }
+
        /* Enable AHB clock */
        clk_enable_vote_clk(base, &gcc_blsp1_ahb_clk);
 
        /* 7372800 uart block clock @ GPLL0 */
-       clk_rcg_set_rate_mnd(base, BLSP1_UART2_APPS_CMD_RCGR, 1, 144, 15625,
-                            CFG_CLK_SRC_GPLL0, 16);
+       clk_rcg_set_rate_mnd(base, cmd_rcgr, 1, 144, 15625, CFG_CLK_SRC_GPLL0,
+                            16);
 
        /* Vote for gpll0 clock */
        clk_enable_gpll0(base, &gpll0_vote_clk);
 
        /* Enable core clk */
-       clk_enable_cbc(base + BLSP1_UART2_APPS_CBCR);
+       clk_enable_cbc(base + apps_cbcr);
 
        return 0;
 }
@@ -94,13 +110,12 @@ static ulong apq8016_clk_set_rate(struct clk *clk, ulong rate)
 
        switch (clk->id) {
        case GCC_SDCC1_APPS_CLK: /* SDC1 */
-               return clk_init_sdc(priv, 0, rate);
-               break;
+               return apq8016_clk_init_sdc(priv, 0, rate);
        case GCC_SDCC2_APPS_CLK: /* SDC2 */
-               return clk_init_sdc(priv, 1, rate);
-               break;
+               return apq8016_clk_init_sdc(priv, 1, rate);
+       case GCC_BLSP1_UART1_APPS_CLK: /* UART1 */
        case GCC_BLSP1_UART2_APPS_CLK: /* UART2 */
-               apq8016_clk_init_uart(priv->base);
+               apq8016_clk_init_uart(priv->base, clk->id);
                return 7372800;
        default:
                return 0;
index a9a00f4b081952fd94aa6d3c7ada01ac08838d86..1ee8b7db1a23561fc43cd717926b5375ac889e1e 100644 (file)
@@ -29,6 +29,7 @@ static const char * const msm_pinctrl_pins[] = {
 };
 
 static const struct pinctrl_function msm_pinctrl_functions[] = {
+       {"blsp_uart1", 2},
        {"blsp_uart2", 2},
 };
 
index c05dda8bdb970b17ef83b93db3424bfa0dbf0fb2..06a948a2f643fdc635990ed9f793758787003d72 100644 (file)
@@ -300,12 +300,17 @@ static struct msm_serial_data init_serial_data = {
 #include <debug_uart.h>
 
 /* Uncomment to turn on UART clocks when debugging U-Boot as aboot on MSM8916 */
-//int apq8016_clk_init_uart(phys_addr_t gcc_base);
+//int apq8016_clk_init_uart(phys_addr_t gcc_base, unsigned long id);
 
 static inline void _debug_uart_init(void)
 {
-       /* Uncomment to turn on UART clocks when debugging U-Boot as aboot on MSM8916 */
-       //apq8016_clk_init_uart(0x1800000);
+       /*
+        * Uncomment to turn on UART clocks when debugging U-Boot as aboot
+        * on MSM8916. Supported debug UART clock IDs:
+        *   - db410c: GCC_BLSP1_UART2_APPS_CLK
+        *   - HMIBSC: GCC_BLSP1_UART1_APPS_CLK
+        */
+       //apq8016_clk_init_uart(0x1800000, <uart_clk_id>);
        uart_dm_init(&init_serial_data);
 }