]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
serial: msm: fix clock handling and pinctrl
authorCaleb Connolly <caleb.connolly@linaro.org>
Mon, 26 Feb 2024 17:26:12 +0000 (17:26 +0000)
committerCaleb Connolly <caleb.connolly@linaro.org>
Fri, 1 Mar 2024 14:44:36 +0000 (14:44 +0000)
Use the modern helpers to fetch the clock and use the correct property
("clocks" instead of "clock"). Drop the call to pinctrl_select_state()
as no boards have a "uart" pinctrl state and this prints confusing
errors.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
arch/arm/dts/dragonboard410c.dts
arch/arm/dts/dragonboard820c.dts
drivers/serial/serial_msm.c

index 02c824d0226ca0d53122fba40b0d9d507fb27028..c395e6cc042736ae6dd7a4783fc00cb355d42ac2 100644 (file)
@@ -84,7 +84,8 @@
                serial@78b0000 {
                        compatible = "qcom,msm-uartdm-v1.4";
                        reg = <0x78b0000 0x200>;
-                       clock = <&clkc 4>;
+                       clocks = <&clkc 4>;
+                       clock-names = "core";
                        pinctrl-names = "uart";
                        pinctrl-0 = <&blsp1_uart>;
                };
index 146a0af8aafe024fd80c936018b032da0e240788..86b7f83d36d62b8d5f251d276871196d31447e87 100644 (file)
@@ -78,7 +78,8 @@
                blsp2_uart2: serial@75b0000 {
                        compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
                        reg = <0x75b0000 0x1000>;
-                       clock = <&gcc 4>;
+                       clocks = <&gcc 4>;
+                       clock-names = "core";
                        pinctrl-names = "uart";
                        pinctrl-0 = <&blsp8_uart>;
                };
index 44b93bd7ff2143591a3d81d586361144ad3b8a4d..ac4280c6c4c2e8b009d4bbb09671026106e521c4 100644 (file)
@@ -160,29 +160,14 @@ static int msm_uart_clk_init(struct udevice *dev)
 {
        uint clk_rate = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                        "clock-frequency", 115200);
-       uint clkd[2]; /* clk_id and clk_no */
-       int clk_offset;
-       struct udevice *clk_dev;
        struct clk clk;
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "clock",
-                                  clkd, 2);
-       if (ret)
-               return ret;
-
-       clk_offset = fdt_node_offset_by_phandle(gd->fdt_blob, clkd[0]);
-       if (clk_offset < 0)
-               return clk_offset;
-
-       ret = uclass_get_device_by_of_offset(UCLASS_CLK, clk_offset, &clk_dev);
-       if (ret)
-               return ret;
-
-       clk.id = clkd[1];
-       ret = clk_request(clk_dev, &clk);
-       if (ret < 0)
+       ret = clk_get_by_name(dev, "core", &clk);
+       if (ret < 0) {
+               pr_warn("%s: Failed to get clock: %d\n", __func__, ret);
                return ret;
+       }
 
        ret = clk_set_rate(&clk, clk_rate);
        if (ret < 0)
@@ -218,7 +203,6 @@ static int msm_serial_probe(struct udevice *dev)
        if (ret)
                return ret;
 
-       pinctrl_select_state(dev, "uart");
        uart_dm_init(priv);
 
        return 0;
@@ -251,6 +235,7 @@ U_BOOT_DRIVER(serial_msm) = {
        .priv_auto      = sizeof(struct msm_serial_data),
        .probe = msm_serial_probe,
        .ops    = &msm_serial_ops,
+       .flags = DM_FLAG_PRE_RELOC,
 };
 
 #ifdef CONFIG_DEBUG_UART_MSM