| .. | .. |
|---|
| 12 | 12 | #include <linux/delay.h> |
|---|
| 13 | 13 | #include <linux/device.h> |
|---|
| 14 | 14 | #include <linux/err.h> |
|---|
| 15 | +#include <linux/io.h> |
|---|
| 15 | 16 | #include <linux/of.h> |
|---|
| 16 | 17 | #include <linux/of_address.h> |
|---|
| 17 | 18 | #include <linux/of_device.h> |
|---|
| .. | .. |
|---|
| 52 | 53 | u32 fbdiv; |
|---|
| 53 | 54 | u32 odiv; |
|---|
| 54 | 55 | u32 band; |
|---|
| 56 | + u32 bypass; |
|---|
| 55 | 57 | }; |
|---|
| 56 | 58 | |
|---|
| 57 | 59 | static const struct hsdk_pll_cfg asdt_pll_cfg[] = { |
|---|
| 58 | | - { 100000000, 0, 11, 3, 0 }, |
|---|
| 59 | | - { 133000000, 0, 15, 3, 0 }, |
|---|
| 60 | | - { 200000000, 1, 47, 3, 0 }, |
|---|
| 61 | | - { 233000000, 1, 27, 2, 0 }, |
|---|
| 62 | | - { 300000000, 1, 35, 2, 0 }, |
|---|
| 63 | | - { 333000000, 1, 39, 2, 0 }, |
|---|
| 64 | | - { 400000000, 1, 47, 2, 0 }, |
|---|
| 65 | | - { 500000000, 0, 14, 1, 0 }, |
|---|
| 66 | | - { 600000000, 0, 17, 1, 0 }, |
|---|
| 67 | | - { 700000000, 0, 20, 1, 0 }, |
|---|
| 68 | | - { 800000000, 0, 23, 1, 0 }, |
|---|
| 69 | | - { 900000000, 1, 26, 0, 0 }, |
|---|
| 70 | | - { 1000000000, 1, 29, 0, 0 }, |
|---|
| 71 | | - { 1100000000, 1, 32, 0, 0 }, |
|---|
| 72 | | - { 1200000000, 1, 35, 0, 0 }, |
|---|
| 73 | | - { 1300000000, 1, 38, 0, 0 }, |
|---|
| 74 | | - { 1400000000, 1, 41, 0, 0 }, |
|---|
| 75 | | - { 1500000000, 1, 44, 0, 0 }, |
|---|
| 76 | | - { 1600000000, 1, 47, 0, 0 }, |
|---|
| 60 | + { 100000000, 0, 11, 3, 0, 0 }, |
|---|
| 61 | + { 133000000, 0, 15, 3, 0, 0 }, |
|---|
| 62 | + { 200000000, 1, 47, 3, 0, 0 }, |
|---|
| 63 | + { 233000000, 1, 27, 2, 0, 0 }, |
|---|
| 64 | + { 300000000, 1, 35, 2, 0, 0 }, |
|---|
| 65 | + { 333000000, 1, 39, 2, 0, 0 }, |
|---|
| 66 | + { 400000000, 1, 47, 2, 0, 0 }, |
|---|
| 67 | + { 500000000, 0, 14, 1, 0, 0 }, |
|---|
| 68 | + { 600000000, 0, 17, 1, 0, 0 }, |
|---|
| 69 | + { 700000000, 0, 20, 1, 0, 0 }, |
|---|
| 70 | + { 800000000, 0, 23, 1, 0, 0 }, |
|---|
| 71 | + { 900000000, 1, 26, 0, 0, 0 }, |
|---|
| 72 | + { 1000000000, 1, 29, 0, 0, 0 }, |
|---|
| 73 | + { 1100000000, 1, 32, 0, 0, 0 }, |
|---|
| 74 | + { 1200000000, 1, 35, 0, 0, 0 }, |
|---|
| 75 | + { 1300000000, 1, 38, 0, 0, 0 }, |
|---|
| 76 | + { 1400000000, 1, 41, 0, 0, 0 }, |
|---|
| 77 | + { 1500000000, 1, 44, 0, 0, 0 }, |
|---|
| 78 | + { 1600000000, 1, 47, 0, 0, 0 }, |
|---|
| 77 | 79 | {} |
|---|
| 78 | 80 | }; |
|---|
| 79 | 81 | |
|---|
| 80 | 82 | static const struct hsdk_pll_cfg hdmi_pll_cfg[] = { |
|---|
| 81 | | - { 297000000, 0, 21, 2, 0 }, |
|---|
| 82 | | - { 540000000, 0, 19, 1, 0 }, |
|---|
| 83 | | - { 594000000, 0, 21, 1, 0 }, |
|---|
| 83 | + { 27000000, 0, 0, 0, 0, 1 }, |
|---|
| 84 | + { 148500000, 0, 21, 3, 0, 0 }, |
|---|
| 85 | + { 297000000, 0, 21, 2, 0, 0 }, |
|---|
| 86 | + { 540000000, 0, 19, 1, 0, 0 }, |
|---|
| 87 | + { 594000000, 0, 21, 1, 0, 0 }, |
|---|
| 84 | 88 | {} |
|---|
| 85 | 89 | }; |
|---|
| 86 | 90 | |
|---|
| .. | .. |
|---|
| 133 | 137 | { |
|---|
| 134 | 138 | u32 val = 0; |
|---|
| 135 | 139 | |
|---|
| 136 | | - /* Powerdown and Bypass bits should be cleared */ |
|---|
| 137 | | - val |= cfg->idiv << CGU_PLL_CTRL_IDIV_SHIFT; |
|---|
| 138 | | - val |= cfg->fbdiv << CGU_PLL_CTRL_FBDIV_SHIFT; |
|---|
| 139 | | - val |= cfg->odiv << CGU_PLL_CTRL_ODIV_SHIFT; |
|---|
| 140 | | - val |= cfg->band << CGU_PLL_CTRL_BAND_SHIFT; |
|---|
| 140 | + if (cfg->bypass) { |
|---|
| 141 | + val = hsdk_pll_read(clk, CGU_PLL_CTRL); |
|---|
| 142 | + val |= CGU_PLL_CTRL_BYPASS; |
|---|
| 143 | + } else { |
|---|
| 144 | + /* Powerdown and Bypass bits should be cleared */ |
|---|
| 145 | + val |= cfg->idiv << CGU_PLL_CTRL_IDIV_SHIFT; |
|---|
| 146 | + val |= cfg->fbdiv << CGU_PLL_CTRL_FBDIV_SHIFT; |
|---|
| 147 | + val |= cfg->odiv << CGU_PLL_CTRL_ODIV_SHIFT; |
|---|
| 148 | + val |= cfg->band << CGU_PLL_CTRL_BAND_SHIFT; |
|---|
| 149 | + } |
|---|
| 141 | 150 | |
|---|
| 142 | 151 | dev_dbg(clk->dev, "write configuration: %#x\n", val); |
|---|
| 143 | 152 | |
|---|
| .. | .. |
|---|
| 171 | 180 | |
|---|
| 172 | 181 | dev_dbg(clk->dev, "current configuration: %#x\n", val); |
|---|
| 173 | 182 | |
|---|
| 174 | | - /* Check if PLL is disabled */ |
|---|
| 175 | | - if (val & CGU_PLL_CTRL_PD) |
|---|
| 176 | | - return 0; |
|---|
| 177 | | - |
|---|
| 178 | 183 | /* Check if PLL is bypassed */ |
|---|
| 179 | 184 | if (val & CGU_PLL_CTRL_BYPASS) |
|---|
| 180 | 185 | return parent_rate; |
|---|
| 186 | + |
|---|
| 187 | + /* Check if PLL is disabled */ |
|---|
| 188 | + if (val & CGU_PLL_CTRL_PD) |
|---|
| 189 | + return 0; |
|---|
| 181 | 190 | |
|---|
| 182 | 191 | /* input divider = reg.idiv + 1 */ |
|---|
| 183 | 192 | idiv = 1 + ((val & CGU_PLL_CTRL_IDIV_MASK) >> CGU_PLL_CTRL_IDIV_SHIFT); |
|---|
| .. | .. |
|---|
| 390 | 399 | |
|---|
| 391 | 400 | ret = clk_hw_register(NULL, &pll_clk->hw); |
|---|
| 392 | 401 | if (ret) { |
|---|
| 393 | | - pr_err("failed to register %s clock\n", node->name); |
|---|
| 402 | + pr_err("failed to register %pOFn clock\n", node); |
|---|
| 394 | 403 | goto err_unmap_spec_regs; |
|---|
| 395 | 404 | } |
|---|
| 396 | 405 | |
|---|
| 397 | 406 | ret = of_clk_add_hw_provider(node, of_clk_hw_simple_get, &pll_clk->hw); |
|---|
| 398 | 407 | if (ret) { |
|---|
| 399 | | - pr_err("failed to add hw provider for %s clock\n", node->name); |
|---|
| 408 | + pr_err("failed to add hw provider for %pOFn clock\n", node); |
|---|
| 400 | 409 | goto err_unmap_spec_regs; |
|---|
| 401 | 410 | } |
|---|
| 402 | 411 | |
|---|