]> Git Repo - J-u-boot.git/blobdiff - arch/arm/mach-imx/mx5/clock.c
command: Remove the cmd_tbl_t typedef
[J-u-boot.git] / arch / arm / mach-imx / mx5 / clock.c
index 284f6d4cde3d99b05e105b812a799f7187787551..09c4c89664749ef11949e79dca09d8df91bd966b 100644 (file)
@@ -1,13 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2007
  * Sascha Hauer, Pengutronix
  *
  * (C) Copyright 2009 Freescale Semiconductor, Inc.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <command.h>
 #include <asm/io.h>
 #include <linux/errno.h>
 #include <asm/arch/imx-regs.h>
@@ -839,6 +839,31 @@ static int config_ddr_clk(u32 emi_clk)
        return 0;
 }
 
+#ifdef CONFIG_MX53
+static int config_ldb_clk(u32 ref, u32 freq)
+{
+       int ret = 0;
+       struct pll_param pll_param;
+
+       memset(&pll_param, 0, sizeof(struct pll_param));
+
+       ret = calc_pll_params(ref, freq, &pll_param);
+       if (ret != 0) {
+               printf("Error:Can't find pll parameters: %d\n",
+                       ret);
+               return ret;
+       }
+
+       return config_pll_clk(PLL4_CLOCK, &pll_param);
+}
+#else
+static int config_ldb_clk(u32 ref, u32 freq)
+{
+       /* Platform not supported */
+       return -EINVAL;
+}
+#endif
+
 /*
  * This function assumes the expected core clock has to be changed by
  * modifying the PLL. This is NOT true always but for most of the times,
@@ -880,6 +905,10 @@ int mxc_set_clock(u32 ref, u32 freq, enum mxc_clock clk)
                if (config_nfc_clk(freq))
                        return -EINVAL;
                break;
+       case MXC_LDB_CLK:
+               if (config_ldb_clk(ref, freq))
+                       return -EINVAL;
+               break;
        default:
                printf("Warning:Unsupported or invalid clock type\n");
        }
@@ -915,7 +944,8 @@ void mxc_set_sata_internal_clock(void)
 /*
  * Dump some core clockes.
  */
-static int do_mx5_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mx5_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+                            char *const argv[])
 {
        u32 freq;
 
This page took 0.025898 seconds and 4 git commands to generate.