Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: meson: axg_audio: add sm1 support

Add sm1 support the axg audio clock controllers. This new version is
indeed derived from the previous generation, as always, adding a few
new clocks to the mix.

The number of gates now exceeds 32 and do not fit in a single register.
Unfortunately, designers chose to introduce the new gate register
immediately after the original one, at the beginning of the register
space, shifting all the master clock register offsets.

The sm1 also introduce a few mux and divider on the top clock path,
possibly to lower the peripheral clocks of the audio blocks if
necessary.

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>

+574 -30
+554 -28
drivers/clk/meson/axg-audio.c
··· 66 66 }, \ 67 67 } 68 68 69 - #define AUD_PCLK_GATE(_name, _bit) { \ 69 + #define AUD_PCLK_GATE(_name, _reg, _bit) { \ 70 70 .data = &(struct clk_regmap_gate_data){ \ 71 - .offset = (AUDIO_CLK_GATE_EN), \ 71 + .offset = (_reg), \ 72 72 .bit_idx = (_bit), \ 73 73 }, \ 74 74 .hw.init = &(struct clk_init_data) { \ ··· 290 290 }; 291 291 292 292 #define AUD_TDM_PAD_CTRL(_name, _reg, _shift, _parents) \ 293 - AUD_MUX(tdm_##_name, _reg, 0x7, _shift, 0, _parents, \ 293 + AUD_MUX(_name, _reg, 0x7, _shift, 0, _parents, \ 294 294 CLK_SET_RATE_NO_REPARENT) 295 295 296 296 /* Common Clocks */ 297 - static struct clk_regmap ddr_arb = AUD_PCLK_GATE(ddr_arb, 0); 298 - static struct clk_regmap pdm = AUD_PCLK_GATE(pdm, 1); 299 - static struct clk_regmap tdmin_a = AUD_PCLK_GATE(tdmin_a, 2); 300 - static struct clk_regmap tdmin_b = AUD_PCLK_GATE(tdmin_b, 3); 301 - static struct clk_regmap tdmin_c = AUD_PCLK_GATE(tdmin_c, 4); 302 - static struct clk_regmap tdmin_lb = AUD_PCLK_GATE(tdmin_lb, 5); 303 - static struct clk_regmap tdmout_a = AUD_PCLK_GATE(tdmout_a, 6); 304 - static struct clk_regmap tdmout_b = AUD_PCLK_GATE(tdmout_b, 7); 305 - static struct clk_regmap tdmout_c = AUD_PCLK_GATE(tdmout_c, 8); 306 - static struct clk_regmap frddr_a = AUD_PCLK_GATE(frddr_a, 9); 307 - static struct clk_regmap frddr_b = AUD_PCLK_GATE(frddr_b, 10); 308 - static struct clk_regmap frddr_c = AUD_PCLK_GATE(frddr_c, 11); 309 - static struct clk_regmap toddr_a = AUD_PCLK_GATE(toddr_a, 12); 310 - static struct clk_regmap toddr_b = AUD_PCLK_GATE(toddr_b, 13); 311 - static struct clk_regmap toddr_c = AUD_PCLK_GATE(toddr_c, 14); 312 - static struct clk_regmap loopback = AUD_PCLK_GATE(loopback, 15); 313 - static struct clk_regmap spdifin = AUD_PCLK_GATE(spdifin, 16); 314 - static struct clk_regmap spdifout = AUD_PCLK_GATE(spdifout, 17); 315 - static struct clk_regmap resample = AUD_PCLK_GATE(resample, 18); 316 - static struct clk_regmap power_detect = AUD_PCLK_GATE(power_detect, 19); 297 + static struct clk_regmap ddr_arb = 298 + AUD_PCLK_GATE(ddr_arb, AUDIO_CLK_GATE_EN, 0); 299 + static struct clk_regmap pdm = 300 + AUD_PCLK_GATE(pdm, AUDIO_CLK_GATE_EN, 1); 301 + static struct clk_regmap tdmin_a = 302 + AUD_PCLK_GATE(tdmin_a, AUDIO_CLK_GATE_EN, 2); 303 + static struct clk_regmap tdmin_b = 304 + AUD_PCLK_GATE(tdmin_b, AUDIO_CLK_GATE_EN, 3); 305 + static struct clk_regmap tdmin_c = 306 + AUD_PCLK_GATE(tdmin_c, AUDIO_CLK_GATE_EN, 4); 307 + static struct clk_regmap tdmin_lb = 308 + AUD_PCLK_GATE(tdmin_lb, AUDIO_CLK_GATE_EN, 5); 309 + static struct clk_regmap tdmout_a = 310 + AUD_PCLK_GATE(tdmout_a, AUDIO_CLK_GATE_EN, 6); 311 + static struct clk_regmap tdmout_b = 312 + AUD_PCLK_GATE(tdmout_b, AUDIO_CLK_GATE_EN, 7); 313 + static struct clk_regmap tdmout_c = 314 + AUD_PCLK_GATE(tdmout_c, AUDIO_CLK_GATE_EN, 8); 315 + static struct clk_regmap frddr_a = 316 + AUD_PCLK_GATE(frddr_a, AUDIO_CLK_GATE_EN, 9); 317 + static struct clk_regmap frddr_b = 318 + AUD_PCLK_GATE(frddr_b, AUDIO_CLK_GATE_EN, 10); 319 + static struct clk_regmap frddr_c = 320 + AUD_PCLK_GATE(frddr_c, AUDIO_CLK_GATE_EN, 11); 321 + static struct clk_regmap toddr_a = 322 + AUD_PCLK_GATE(toddr_a, AUDIO_CLK_GATE_EN, 12); 323 + static struct clk_regmap toddr_b = 324 + AUD_PCLK_GATE(toddr_b, AUDIO_CLK_GATE_EN, 13); 325 + static struct clk_regmap toddr_c = 326 + AUD_PCLK_GATE(toddr_c, AUDIO_CLK_GATE_EN, 14); 327 + static struct clk_regmap loopback = 328 + AUD_PCLK_GATE(loopback, AUDIO_CLK_GATE_EN, 15); 329 + static struct clk_regmap spdifin = 330 + AUD_PCLK_GATE(spdifin, AUDIO_CLK_GATE_EN, 16); 331 + static struct clk_regmap spdifout = 332 + AUD_PCLK_GATE(spdifout, AUDIO_CLK_GATE_EN, 17); 333 + static struct clk_regmap resample = 334 + AUD_PCLK_GATE(resample, AUDIO_CLK_GATE_EN, 18); 335 + static struct clk_regmap power_detect = 336 + AUD_PCLK_GATE(power_detect, AUDIO_CLK_GATE_EN, 19); 317 337 318 338 static struct clk_regmap spdifout_clk_sel = 319 339 AUD_MST_MCLK_MUX(spdifout_clk, AUDIO_CLK_SPDIFOUT_CTRL); ··· 592 572 sclk_pad_2, AUDIO_MST_PAD_CTRL1, 8, sclk_pad_ctrl_parent_data); 593 573 594 574 /* G12a/SM1 clocks */ 595 - static struct clk_regmap spdifout_b = AUD_PCLK_GATE(spdifout_b, 21); 575 + static struct clk_regmap toram = 576 + AUD_PCLK_GATE(toram, AUDIO_CLK_GATE_EN, 20); 577 + static struct clk_regmap spdifout_b = 578 + AUD_PCLK_GATE(spdifout_b, AUDIO_CLK_GATE_EN, 21); 579 + static struct clk_regmap eqdrc = 580 + AUD_PCLK_GATE(eqdrc, AUDIO_CLK_GATE_EN, 22); 581 + 582 + /* SM1 Clocks */ 583 + static struct clk_regmap sm1_clk81_en = { 584 + .data = &(struct clk_regmap_gate_data){ 585 + .offset = AUDIO_CLK81_EN, 586 + .bit_idx = 31, 587 + }, 588 + .hw.init = &(struct clk_init_data) { 589 + .name = "aud_clk81_en", 590 + .ops = &clk_regmap_gate_ops, 591 + .parent_data = &(const struct clk_parent_data) { 592 + .fw_name = "pclk", 593 + }, 594 + .num_parents = 1, 595 + }, 596 + }; 597 + 598 + static struct clk_regmap sm1_sysclk_a_div = { 599 + .data = &(struct clk_regmap_div_data){ 600 + .offset = AUDIO_CLK81_CTRL, 601 + .shift = 0, 602 + .width = 8, 603 + }, 604 + .hw.init = &(struct clk_init_data) { 605 + .name = "aud_sysclk_a_div", 606 + .ops = &clk_regmap_divider_ops, 607 + .parent_hws = (const struct clk_hw *[]) { 608 + &sm1_clk81_en.hw, 609 + }, 610 + .num_parents = 1, 611 + .flags = CLK_SET_RATE_PARENT, 612 + }, 613 + }; 614 + 615 + static struct clk_regmap sm1_sysclk_a_en = { 616 + .data = &(struct clk_regmap_gate_data){ 617 + .offset = AUDIO_CLK81_CTRL, 618 + .bit_idx = 8, 619 + }, 620 + .hw.init = &(struct clk_init_data) { 621 + .name = "aud_sysclk_a_en", 622 + .ops = &clk_regmap_gate_ops, 623 + .parent_hws = (const struct clk_hw *[]) { 624 + &sm1_sysclk_a_div.hw, 625 + }, 626 + .num_parents = 1, 627 + .flags = CLK_SET_RATE_PARENT, 628 + }, 629 + }; 630 + 631 + static struct clk_regmap sm1_sysclk_b_div = { 632 + .data = &(struct clk_regmap_div_data){ 633 + .offset = AUDIO_CLK81_CTRL, 634 + .shift = 16, 635 + .width = 8, 636 + }, 637 + .hw.init = &(struct clk_init_data) { 638 + .name = "aud_sysclk_b_div", 639 + .ops = &clk_regmap_divider_ops, 640 + .parent_hws = (const struct clk_hw *[]) { 641 + &sm1_clk81_en.hw, 642 + }, 643 + .num_parents = 1, 644 + .flags = CLK_SET_RATE_PARENT, 645 + }, 646 + }; 647 + 648 + static struct clk_regmap sm1_sysclk_b_en = { 649 + .data = &(struct clk_regmap_gate_data){ 650 + .offset = AUDIO_CLK81_CTRL, 651 + .bit_idx = 24, 652 + }, 653 + .hw.init = &(struct clk_init_data) { 654 + .name = "aud_sysclk_b_en", 655 + .ops = &clk_regmap_gate_ops, 656 + .parent_hws = (const struct clk_hw *[]) { 657 + &sm1_sysclk_b_div.hw, 658 + }, 659 + .num_parents = 1, 660 + .flags = CLK_SET_RATE_PARENT, 661 + }, 662 + }; 663 + 664 + static const struct clk_hw *sm1_aud_top_parents[] = { 665 + &sm1_sysclk_a_en.hw, 666 + &sm1_sysclk_b_en.hw, 667 + }; 668 + 669 + static struct clk_regmap sm1_aud_top = { 670 + .data = &(struct clk_regmap_mux_data){ 671 + .offset = AUDIO_CLK81_CTRL, 672 + .mask = 0x1, 673 + .shift = 31, 674 + }, 675 + .hw.init = &(struct clk_init_data){ 676 + .name = "aud_top", 677 + .ops = &clk_regmap_mux_ops, 678 + .parent_hws = sm1_aud_top_parents, 679 + .num_parents = ARRAY_SIZE(sm1_aud_top_parents), 680 + .flags = CLK_SET_RATE_NO_REPARENT, 681 + }, 682 + }; 683 + 684 + static struct clk_regmap resample_b = 685 + AUD_PCLK_GATE(resample_b, AUDIO_CLK_GATE_EN, 26); 686 + static struct clk_regmap tovad = 687 + AUD_PCLK_GATE(tovad, AUDIO_CLK_GATE_EN, 27); 688 + static struct clk_regmap locker = 689 + AUD_PCLK_GATE(locker, AUDIO_CLK_GATE_EN, 28); 690 + static struct clk_regmap spdifin_lb = 691 + AUD_PCLK_GATE(spdifin_lb, AUDIO_CLK_GATE_EN, 29); 692 + static struct clk_regmap frddr_d = 693 + AUD_PCLK_GATE(frddr_d, AUDIO_CLK_GATE_EN1, 0); 694 + static struct clk_regmap toddr_d = 695 + AUD_PCLK_GATE(toddr_d, AUDIO_CLK_GATE_EN1, 1); 696 + static struct clk_regmap loopback_b = 697 + AUD_PCLK_GATE(loopback_b, AUDIO_CLK_GATE_EN1, 2); 698 + 699 + static struct clk_regmap sm1_mst_a_mclk_sel = 700 + AUD_MST_MCLK_MUX(mst_a_mclk, AUDIO_SM1_MCLK_A_CTRL); 701 + static struct clk_regmap sm1_mst_b_mclk_sel = 702 + AUD_MST_MCLK_MUX(mst_b_mclk, AUDIO_SM1_MCLK_B_CTRL); 703 + static struct clk_regmap sm1_mst_c_mclk_sel = 704 + AUD_MST_MCLK_MUX(mst_c_mclk, AUDIO_SM1_MCLK_C_CTRL); 705 + static struct clk_regmap sm1_mst_d_mclk_sel = 706 + AUD_MST_MCLK_MUX(mst_d_mclk, AUDIO_SM1_MCLK_D_CTRL); 707 + static struct clk_regmap sm1_mst_e_mclk_sel = 708 + AUD_MST_MCLK_MUX(mst_e_mclk, AUDIO_SM1_MCLK_E_CTRL); 709 + static struct clk_regmap sm1_mst_f_mclk_sel = 710 + AUD_MST_MCLK_MUX(mst_f_mclk, AUDIO_SM1_MCLK_F_CTRL); 711 + 712 + static struct clk_regmap sm1_mst_a_mclk_div = 713 + AUD_MST_MCLK_DIV(mst_a_mclk, AUDIO_SM1_MCLK_A_CTRL); 714 + static struct clk_regmap sm1_mst_b_mclk_div = 715 + AUD_MST_MCLK_DIV(mst_b_mclk, AUDIO_SM1_MCLK_B_CTRL); 716 + static struct clk_regmap sm1_mst_c_mclk_div = 717 + AUD_MST_MCLK_DIV(mst_c_mclk, AUDIO_SM1_MCLK_C_CTRL); 718 + static struct clk_regmap sm1_mst_d_mclk_div = 719 + AUD_MST_MCLK_DIV(mst_d_mclk, AUDIO_SM1_MCLK_D_CTRL); 720 + static struct clk_regmap sm1_mst_e_mclk_div = 721 + AUD_MST_MCLK_DIV(mst_e_mclk, AUDIO_SM1_MCLK_E_CTRL); 722 + static struct clk_regmap sm1_mst_f_mclk_div = 723 + AUD_MST_MCLK_DIV(mst_f_mclk, AUDIO_SM1_MCLK_F_CTRL); 724 + 725 + static struct clk_regmap sm1_mst_a_mclk = 726 + AUD_MST_MCLK_GATE(mst_a_mclk, AUDIO_SM1_MCLK_A_CTRL); 727 + static struct clk_regmap sm1_mst_b_mclk = 728 + AUD_MST_MCLK_GATE(mst_b_mclk, AUDIO_SM1_MCLK_B_CTRL); 729 + static struct clk_regmap sm1_mst_c_mclk = 730 + AUD_MST_MCLK_GATE(mst_c_mclk, AUDIO_SM1_MCLK_C_CTRL); 731 + static struct clk_regmap sm1_mst_d_mclk = 732 + AUD_MST_MCLK_GATE(mst_d_mclk, AUDIO_SM1_MCLK_D_CTRL); 733 + static struct clk_regmap sm1_mst_e_mclk = 734 + AUD_MST_MCLK_GATE(mst_e_mclk, AUDIO_SM1_MCLK_E_CTRL); 735 + static struct clk_regmap sm1_mst_f_mclk = 736 + AUD_MST_MCLK_GATE(mst_f_mclk, AUDIO_SM1_MCLK_F_CTRL); 737 + 738 + static struct clk_regmap sm1_tdm_mclk_pad_0 = AUD_TDM_PAD_CTRL( 739 + tdm_mclk_pad_0, AUDIO_SM1_MST_PAD_CTRL0, 0, mclk_pad_ctrl_parent_data); 740 + static struct clk_regmap sm1_tdm_mclk_pad_1 = AUD_TDM_PAD_CTRL( 741 + tdm_mclk_pad_1, AUDIO_SM1_MST_PAD_CTRL0, 4, mclk_pad_ctrl_parent_data); 742 + static struct clk_regmap sm1_tdm_lrclk_pad_0 = AUD_TDM_PAD_CTRL( 743 + tdm_lrclk_pad_0, AUDIO_SM1_MST_PAD_CTRL1, 16, lrclk_pad_ctrl_parent_data); 744 + static struct clk_regmap sm1_tdm_lrclk_pad_1 = AUD_TDM_PAD_CTRL( 745 + tdm_lrclk_pad_1, AUDIO_SM1_MST_PAD_CTRL1, 20, lrclk_pad_ctrl_parent_data); 746 + static struct clk_regmap sm1_tdm_lrclk_pad_2 = AUD_TDM_PAD_CTRL( 747 + tdm_lrclk_pad_2, AUDIO_SM1_MST_PAD_CTRL1, 24, lrclk_pad_ctrl_parent_data); 748 + static struct clk_regmap sm1_tdm_sclk_pad_0 = AUD_TDM_PAD_CTRL( 749 + tdm_sclk_pad_0, AUDIO_SM1_MST_PAD_CTRL1, 0, sclk_pad_ctrl_parent_data); 750 + static struct clk_regmap sm1_tdm_sclk_pad_1 = AUD_TDM_PAD_CTRL( 751 + tdm_sclk_pad_1, AUDIO_SM1_MST_PAD_CTRL1, 4, sclk_pad_ctrl_parent_data); 752 + static struct clk_regmap sm1_tdm_sclk_pad_2 = AUD_TDM_PAD_CTRL( 753 + tdm_sclk_pad_2, AUDIO_SM1_MST_PAD_CTRL1, 8, sclk_pad_ctrl_parent_data); 596 754 597 755 /* 598 756 * Array of all clocks provided by this provider ··· 1050 852 .num = NR_CLKS, 1051 853 }; 1052 854 855 + /* 856 + * Array of all SM1 clocks provided by this provider 857 + * The input clocks of the controller will be populated at runtime 858 + */ 859 + static struct clk_hw_onecell_data sm1_audio_hw_onecell_data = { 860 + .hws = { 861 + [AUD_CLKID_DDR_ARB] = &ddr_arb.hw, 862 + [AUD_CLKID_PDM] = &pdm.hw, 863 + [AUD_CLKID_TDMIN_A] = &tdmin_a.hw, 864 + [AUD_CLKID_TDMIN_B] = &tdmin_b.hw, 865 + [AUD_CLKID_TDMIN_C] = &tdmin_c.hw, 866 + [AUD_CLKID_TDMIN_LB] = &tdmin_lb.hw, 867 + [AUD_CLKID_TDMOUT_A] = &tdmout_a.hw, 868 + [AUD_CLKID_TDMOUT_B] = &tdmout_b.hw, 869 + [AUD_CLKID_TDMOUT_C] = &tdmout_c.hw, 870 + [AUD_CLKID_FRDDR_A] = &frddr_a.hw, 871 + [AUD_CLKID_FRDDR_B] = &frddr_b.hw, 872 + [AUD_CLKID_FRDDR_C] = &frddr_c.hw, 873 + [AUD_CLKID_TODDR_A] = &toddr_a.hw, 874 + [AUD_CLKID_TODDR_B] = &toddr_b.hw, 875 + [AUD_CLKID_TODDR_C] = &toddr_c.hw, 876 + [AUD_CLKID_LOOPBACK] = &loopback.hw, 877 + [AUD_CLKID_SPDIFIN] = &spdifin.hw, 878 + [AUD_CLKID_SPDIFOUT] = &spdifout.hw, 879 + [AUD_CLKID_RESAMPLE] = &resample.hw, 880 + [AUD_CLKID_SPDIFOUT_B] = &spdifout_b.hw, 881 + [AUD_CLKID_MST_A_MCLK_SEL] = &sm1_mst_a_mclk_sel.hw, 882 + [AUD_CLKID_MST_B_MCLK_SEL] = &sm1_mst_b_mclk_sel.hw, 883 + [AUD_CLKID_MST_C_MCLK_SEL] = &sm1_mst_c_mclk_sel.hw, 884 + [AUD_CLKID_MST_D_MCLK_SEL] = &sm1_mst_d_mclk_sel.hw, 885 + [AUD_CLKID_MST_E_MCLK_SEL] = &sm1_mst_e_mclk_sel.hw, 886 + [AUD_CLKID_MST_F_MCLK_SEL] = &sm1_mst_f_mclk_sel.hw, 887 + [AUD_CLKID_MST_A_MCLK_DIV] = &sm1_mst_a_mclk_div.hw, 888 + [AUD_CLKID_MST_B_MCLK_DIV] = &sm1_mst_b_mclk_div.hw, 889 + [AUD_CLKID_MST_C_MCLK_DIV] = &sm1_mst_c_mclk_div.hw, 890 + [AUD_CLKID_MST_D_MCLK_DIV] = &sm1_mst_d_mclk_div.hw, 891 + [AUD_CLKID_MST_E_MCLK_DIV] = &sm1_mst_e_mclk_div.hw, 892 + [AUD_CLKID_MST_F_MCLK_DIV] = &sm1_mst_f_mclk_div.hw, 893 + [AUD_CLKID_MST_A_MCLK] = &sm1_mst_a_mclk.hw, 894 + [AUD_CLKID_MST_B_MCLK] = &sm1_mst_b_mclk.hw, 895 + [AUD_CLKID_MST_C_MCLK] = &sm1_mst_c_mclk.hw, 896 + [AUD_CLKID_MST_D_MCLK] = &sm1_mst_d_mclk.hw, 897 + [AUD_CLKID_MST_E_MCLK] = &sm1_mst_e_mclk.hw, 898 + [AUD_CLKID_MST_F_MCLK] = &sm1_mst_f_mclk.hw, 899 + [AUD_CLKID_SPDIFOUT_CLK_SEL] = &spdifout_clk_sel.hw, 900 + [AUD_CLKID_SPDIFOUT_CLK_DIV] = &spdifout_clk_div.hw, 901 + [AUD_CLKID_SPDIFOUT_CLK] = &spdifout_clk.hw, 902 + [AUD_CLKID_SPDIFOUT_B_CLK_SEL] = &spdifout_b_clk_sel.hw, 903 + [AUD_CLKID_SPDIFOUT_B_CLK_DIV] = &spdifout_b_clk_div.hw, 904 + [AUD_CLKID_SPDIFOUT_B_CLK] = &spdifout_b_clk.hw, 905 + [AUD_CLKID_SPDIFIN_CLK_SEL] = &spdifin_clk_sel.hw, 906 + [AUD_CLKID_SPDIFIN_CLK_DIV] = &spdifin_clk_div.hw, 907 + [AUD_CLKID_SPDIFIN_CLK] = &spdifin_clk.hw, 908 + [AUD_CLKID_PDM_DCLK_SEL] = &pdm_dclk_sel.hw, 909 + [AUD_CLKID_PDM_DCLK_DIV] = &pdm_dclk_div.hw, 910 + [AUD_CLKID_PDM_DCLK] = &pdm_dclk.hw, 911 + [AUD_CLKID_PDM_SYSCLK_SEL] = &pdm_sysclk_sel.hw, 912 + [AUD_CLKID_PDM_SYSCLK_DIV] = &pdm_sysclk_div.hw, 913 + [AUD_CLKID_PDM_SYSCLK] = &pdm_sysclk.hw, 914 + [AUD_CLKID_MST_A_SCLK_PRE_EN] = &mst_a_sclk_pre_en.hw, 915 + [AUD_CLKID_MST_B_SCLK_PRE_EN] = &mst_b_sclk_pre_en.hw, 916 + [AUD_CLKID_MST_C_SCLK_PRE_EN] = &mst_c_sclk_pre_en.hw, 917 + [AUD_CLKID_MST_D_SCLK_PRE_EN] = &mst_d_sclk_pre_en.hw, 918 + [AUD_CLKID_MST_E_SCLK_PRE_EN] = &mst_e_sclk_pre_en.hw, 919 + [AUD_CLKID_MST_F_SCLK_PRE_EN] = &mst_f_sclk_pre_en.hw, 920 + [AUD_CLKID_MST_A_SCLK_DIV] = &mst_a_sclk_div.hw, 921 + [AUD_CLKID_MST_B_SCLK_DIV] = &mst_b_sclk_div.hw, 922 + [AUD_CLKID_MST_C_SCLK_DIV] = &mst_c_sclk_div.hw, 923 + [AUD_CLKID_MST_D_SCLK_DIV] = &mst_d_sclk_div.hw, 924 + [AUD_CLKID_MST_E_SCLK_DIV] = &mst_e_sclk_div.hw, 925 + [AUD_CLKID_MST_F_SCLK_DIV] = &mst_f_sclk_div.hw, 926 + [AUD_CLKID_MST_A_SCLK_POST_EN] = &mst_a_sclk_post_en.hw, 927 + [AUD_CLKID_MST_B_SCLK_POST_EN] = &mst_b_sclk_post_en.hw, 928 + [AUD_CLKID_MST_C_SCLK_POST_EN] = &mst_c_sclk_post_en.hw, 929 + [AUD_CLKID_MST_D_SCLK_POST_EN] = &mst_d_sclk_post_en.hw, 930 + [AUD_CLKID_MST_E_SCLK_POST_EN] = &mst_e_sclk_post_en.hw, 931 + [AUD_CLKID_MST_F_SCLK_POST_EN] = &mst_f_sclk_post_en.hw, 932 + [AUD_CLKID_MST_A_SCLK] = &mst_a_sclk.hw, 933 + [AUD_CLKID_MST_B_SCLK] = &mst_b_sclk.hw, 934 + [AUD_CLKID_MST_C_SCLK] = &mst_c_sclk.hw, 935 + [AUD_CLKID_MST_D_SCLK] = &mst_d_sclk.hw, 936 + [AUD_CLKID_MST_E_SCLK] = &mst_e_sclk.hw, 937 + [AUD_CLKID_MST_F_SCLK] = &mst_f_sclk.hw, 938 + [AUD_CLKID_MST_A_LRCLK_DIV] = &mst_a_lrclk_div.hw, 939 + [AUD_CLKID_MST_B_LRCLK_DIV] = &mst_b_lrclk_div.hw, 940 + [AUD_CLKID_MST_C_LRCLK_DIV] = &mst_c_lrclk_div.hw, 941 + [AUD_CLKID_MST_D_LRCLK_DIV] = &mst_d_lrclk_div.hw, 942 + [AUD_CLKID_MST_E_LRCLK_DIV] = &mst_e_lrclk_div.hw, 943 + [AUD_CLKID_MST_F_LRCLK_DIV] = &mst_f_lrclk_div.hw, 944 + [AUD_CLKID_MST_A_LRCLK] = &mst_a_lrclk.hw, 945 + [AUD_CLKID_MST_B_LRCLK] = &mst_b_lrclk.hw, 946 + [AUD_CLKID_MST_C_LRCLK] = &mst_c_lrclk.hw, 947 + [AUD_CLKID_MST_D_LRCLK] = &mst_d_lrclk.hw, 948 + [AUD_CLKID_MST_E_LRCLK] = &mst_e_lrclk.hw, 949 + [AUD_CLKID_MST_F_LRCLK] = &mst_f_lrclk.hw, 950 + [AUD_CLKID_TDMIN_A_SCLK_SEL] = &tdmin_a_sclk_sel.hw, 951 + [AUD_CLKID_TDMIN_B_SCLK_SEL] = &tdmin_b_sclk_sel.hw, 952 + [AUD_CLKID_TDMIN_C_SCLK_SEL] = &tdmin_c_sclk_sel.hw, 953 + [AUD_CLKID_TDMIN_LB_SCLK_SEL] = &tdmin_lb_sclk_sel.hw, 954 + [AUD_CLKID_TDMOUT_A_SCLK_SEL] = &tdmout_a_sclk_sel.hw, 955 + [AUD_CLKID_TDMOUT_B_SCLK_SEL] = &tdmout_b_sclk_sel.hw, 956 + [AUD_CLKID_TDMOUT_C_SCLK_SEL] = &tdmout_c_sclk_sel.hw, 957 + [AUD_CLKID_TDMIN_A_SCLK_PRE_EN] = &tdmin_a_sclk_pre_en.hw, 958 + [AUD_CLKID_TDMIN_B_SCLK_PRE_EN] = &tdmin_b_sclk_pre_en.hw, 959 + [AUD_CLKID_TDMIN_C_SCLK_PRE_EN] = &tdmin_c_sclk_pre_en.hw, 960 + [AUD_CLKID_TDMIN_LB_SCLK_PRE_EN] = &tdmin_lb_sclk_pre_en.hw, 961 + [AUD_CLKID_TDMOUT_A_SCLK_PRE_EN] = &tdmout_a_sclk_pre_en.hw, 962 + [AUD_CLKID_TDMOUT_B_SCLK_PRE_EN] = &tdmout_b_sclk_pre_en.hw, 963 + [AUD_CLKID_TDMOUT_C_SCLK_PRE_EN] = &tdmout_c_sclk_pre_en.hw, 964 + [AUD_CLKID_TDMIN_A_SCLK_POST_EN] = &tdmin_a_sclk_post_en.hw, 965 + [AUD_CLKID_TDMIN_B_SCLK_POST_EN] = &tdmin_b_sclk_post_en.hw, 966 + [AUD_CLKID_TDMIN_C_SCLK_POST_EN] = &tdmin_c_sclk_post_en.hw, 967 + [AUD_CLKID_TDMIN_LB_SCLK_POST_EN] = &tdmin_lb_sclk_post_en.hw, 968 + [AUD_CLKID_TDMOUT_A_SCLK_POST_EN] = &tdmout_a_sclk_post_en.hw, 969 + [AUD_CLKID_TDMOUT_B_SCLK_POST_EN] = &tdmout_b_sclk_post_en.hw, 970 + [AUD_CLKID_TDMOUT_C_SCLK_POST_EN] = &tdmout_c_sclk_post_en.hw, 971 + [AUD_CLKID_TDMIN_A_SCLK] = &tdmin_a_sclk.hw, 972 + [AUD_CLKID_TDMIN_B_SCLK] = &tdmin_b_sclk.hw, 973 + [AUD_CLKID_TDMIN_C_SCLK] = &tdmin_c_sclk.hw, 974 + [AUD_CLKID_TDMIN_LB_SCLK] = &tdmin_lb_sclk.hw, 975 + [AUD_CLKID_TDMOUT_A_SCLK] = &tdmout_a_sclk.hw, 976 + [AUD_CLKID_TDMOUT_B_SCLK] = &tdmout_b_sclk.hw, 977 + [AUD_CLKID_TDMOUT_C_SCLK] = &tdmout_c_sclk.hw, 978 + [AUD_CLKID_TDMIN_A_LRCLK] = &tdmin_a_lrclk.hw, 979 + [AUD_CLKID_TDMIN_B_LRCLK] = &tdmin_b_lrclk.hw, 980 + [AUD_CLKID_TDMIN_C_LRCLK] = &tdmin_c_lrclk.hw, 981 + [AUD_CLKID_TDMIN_LB_LRCLK] = &tdmin_lb_lrclk.hw, 982 + [AUD_CLKID_TDMOUT_A_LRCLK] = &tdmout_a_lrclk.hw, 983 + [AUD_CLKID_TDMOUT_B_LRCLK] = &tdmout_b_lrclk.hw, 984 + [AUD_CLKID_TDMOUT_C_LRCLK] = &tdmout_c_lrclk.hw, 985 + [AUD_CLKID_TDM_MCLK_PAD0] = &sm1_tdm_mclk_pad_0.hw, 986 + [AUD_CLKID_TDM_MCLK_PAD1] = &sm1_tdm_mclk_pad_1.hw, 987 + [AUD_CLKID_TDM_LRCLK_PAD0] = &sm1_tdm_lrclk_pad_0.hw, 988 + [AUD_CLKID_TDM_LRCLK_PAD1] = &sm1_tdm_lrclk_pad_1.hw, 989 + [AUD_CLKID_TDM_LRCLK_PAD2] = &sm1_tdm_lrclk_pad_2.hw, 990 + [AUD_CLKID_TDM_SCLK_PAD0] = &sm1_tdm_sclk_pad_0.hw, 991 + [AUD_CLKID_TDM_SCLK_PAD1] = &sm1_tdm_sclk_pad_1.hw, 992 + [AUD_CLKID_TDM_SCLK_PAD2] = &sm1_tdm_sclk_pad_2.hw, 993 + [AUD_CLKID_TOP] = &sm1_aud_top.hw, 994 + [AUD_CLKID_TORAM] = &toram.hw, 995 + [AUD_CLKID_EQDRC] = &eqdrc.hw, 996 + [AUD_CLKID_RESAMPLE_B] = &resample_b.hw, 997 + [AUD_CLKID_TOVAD] = &tovad.hw, 998 + [AUD_CLKID_LOCKER] = &locker.hw, 999 + [AUD_CLKID_SPDIFIN_LB] = &spdifin_lb.hw, 1000 + [AUD_CLKID_FRDDR_D] = &frddr_d.hw, 1001 + [AUD_CLKID_TODDR_D] = &toddr_d.hw, 1002 + [AUD_CLKID_LOOPBACK_B] = &loopback_b.hw, 1003 + [AUD_CLKID_CLK81_EN] = &sm1_clk81_en.hw, 1004 + [AUD_CLKID_SYSCLK_A_DIV] = &sm1_sysclk_a_div.hw, 1005 + [AUD_CLKID_SYSCLK_A_EN] = &sm1_sysclk_a_en.hw, 1006 + [AUD_CLKID_SYSCLK_B_DIV] = &sm1_sysclk_b_div.hw, 1007 + [AUD_CLKID_SYSCLK_B_EN] = &sm1_sysclk_b_en.hw, 1008 + [NR_CLKS] = NULL, 1009 + }, 1010 + .num = NR_CLKS, 1011 + }; 1012 + 1013 + 1053 1014 /* Convenience table to populate regmap in .probe() 1054 1015 * Note that this table is shared between both AXG and G12A, 1055 1016 * with spdifout_b clocks being exclusive to G12A. Since those 1056 1017 * clocks are not declared within the AXG onecell table, we do not 1057 1018 * feel the need to have separate AXG/G12A regmap tables. 1058 1019 */ 1059 - static struct clk_regmap *const aud_clk_regmaps[] = { 1020 + static struct clk_regmap *const axg_clk_regmaps[] = { 1060 1021 &ddr_arb, 1061 1022 &pdm, 1062 1023 &tdmin_a, ··· 1349 992 &g12a_tdm_sclk_pad_0, 1350 993 &g12a_tdm_sclk_pad_1, 1351 994 &g12a_tdm_sclk_pad_2, 995 + &toram, 996 + &eqdrc, 997 + }; 998 + 999 + static struct clk_regmap *const sm1_clk_regmaps[] = { 1000 + &ddr_arb, 1001 + &pdm, 1002 + &tdmin_a, 1003 + &tdmin_b, 1004 + &tdmin_c, 1005 + &tdmin_lb, 1006 + &tdmout_a, 1007 + &tdmout_b, 1008 + &tdmout_c, 1009 + &frddr_a, 1010 + &frddr_b, 1011 + &frddr_c, 1012 + &toddr_a, 1013 + &toddr_b, 1014 + &toddr_c, 1015 + &loopback, 1016 + &spdifin, 1017 + &spdifout, 1018 + &resample, 1019 + &spdifout_b, 1020 + &sm1_mst_a_mclk_sel, 1021 + &sm1_mst_b_mclk_sel, 1022 + &sm1_mst_c_mclk_sel, 1023 + &sm1_mst_d_mclk_sel, 1024 + &sm1_mst_e_mclk_sel, 1025 + &sm1_mst_f_mclk_sel, 1026 + &sm1_mst_a_mclk_div, 1027 + &sm1_mst_b_mclk_div, 1028 + &sm1_mst_c_mclk_div, 1029 + &sm1_mst_d_mclk_div, 1030 + &sm1_mst_e_mclk_div, 1031 + &sm1_mst_f_mclk_div, 1032 + &sm1_mst_a_mclk, 1033 + &sm1_mst_b_mclk, 1034 + &sm1_mst_c_mclk, 1035 + &sm1_mst_d_mclk, 1036 + &sm1_mst_e_mclk, 1037 + &sm1_mst_f_mclk, 1038 + &spdifout_clk_sel, 1039 + &spdifout_clk_div, 1040 + &spdifout_clk, 1041 + &spdifin_clk_sel, 1042 + &spdifin_clk_div, 1043 + &spdifin_clk, 1044 + &pdm_dclk_sel, 1045 + &pdm_dclk_div, 1046 + &pdm_dclk, 1047 + &pdm_sysclk_sel, 1048 + &pdm_sysclk_div, 1049 + &pdm_sysclk, 1050 + &mst_a_sclk_pre_en, 1051 + &mst_b_sclk_pre_en, 1052 + &mst_c_sclk_pre_en, 1053 + &mst_d_sclk_pre_en, 1054 + &mst_e_sclk_pre_en, 1055 + &mst_f_sclk_pre_en, 1056 + &mst_a_sclk_div, 1057 + &mst_b_sclk_div, 1058 + &mst_c_sclk_div, 1059 + &mst_d_sclk_div, 1060 + &mst_e_sclk_div, 1061 + &mst_f_sclk_div, 1062 + &mst_a_sclk_post_en, 1063 + &mst_b_sclk_post_en, 1064 + &mst_c_sclk_post_en, 1065 + &mst_d_sclk_post_en, 1066 + &mst_e_sclk_post_en, 1067 + &mst_f_sclk_post_en, 1068 + &mst_a_sclk, 1069 + &mst_b_sclk, 1070 + &mst_c_sclk, 1071 + &mst_d_sclk, 1072 + &mst_e_sclk, 1073 + &mst_f_sclk, 1074 + &mst_a_lrclk_div, 1075 + &mst_b_lrclk_div, 1076 + &mst_c_lrclk_div, 1077 + &mst_d_lrclk_div, 1078 + &mst_e_lrclk_div, 1079 + &mst_f_lrclk_div, 1080 + &mst_a_lrclk, 1081 + &mst_b_lrclk, 1082 + &mst_c_lrclk, 1083 + &mst_d_lrclk, 1084 + &mst_e_lrclk, 1085 + &mst_f_lrclk, 1086 + &tdmin_a_sclk_sel, 1087 + &tdmin_b_sclk_sel, 1088 + &tdmin_c_sclk_sel, 1089 + &tdmin_lb_sclk_sel, 1090 + &tdmout_a_sclk_sel, 1091 + &tdmout_b_sclk_sel, 1092 + &tdmout_c_sclk_sel, 1093 + &tdmin_a_sclk_pre_en, 1094 + &tdmin_b_sclk_pre_en, 1095 + &tdmin_c_sclk_pre_en, 1096 + &tdmin_lb_sclk_pre_en, 1097 + &tdmout_a_sclk_pre_en, 1098 + &tdmout_b_sclk_pre_en, 1099 + &tdmout_c_sclk_pre_en, 1100 + &tdmin_a_sclk_post_en, 1101 + &tdmin_b_sclk_post_en, 1102 + &tdmin_c_sclk_post_en, 1103 + &tdmin_lb_sclk_post_en, 1104 + &tdmout_a_sclk_post_en, 1105 + &tdmout_b_sclk_post_en, 1106 + &tdmout_c_sclk_post_en, 1107 + &tdmin_a_sclk, 1108 + &tdmin_b_sclk, 1109 + &tdmin_c_sclk, 1110 + &tdmin_lb_sclk, 1111 + &tdmout_a_sclk, 1112 + &tdmout_b_sclk, 1113 + &tdmout_c_sclk, 1114 + &tdmin_a_lrclk, 1115 + &tdmin_b_lrclk, 1116 + &tdmin_c_lrclk, 1117 + &tdmin_lb_lrclk, 1118 + &tdmout_a_lrclk, 1119 + &tdmout_b_lrclk, 1120 + &tdmout_c_lrclk, 1121 + &spdifout_b_clk_sel, 1122 + &spdifout_b_clk_div, 1123 + &spdifout_b_clk, 1124 + &sm1_tdm_mclk_pad_0, 1125 + &sm1_tdm_mclk_pad_1, 1126 + &sm1_tdm_lrclk_pad_0, 1127 + &sm1_tdm_lrclk_pad_1, 1128 + &sm1_tdm_lrclk_pad_2, 1129 + &sm1_tdm_sclk_pad_0, 1130 + &sm1_tdm_sclk_pad_1, 1131 + &sm1_tdm_sclk_pad_2, 1132 + &sm1_aud_top, 1133 + &toram, 1134 + &eqdrc, 1135 + &resample_b, 1136 + &tovad, 1137 + &locker, 1138 + &spdifin_lb, 1139 + &frddr_d, 1140 + &toddr_d, 1141 + &loopback_b, 1142 + &sm1_clk81_en, 1143 + &sm1_sysclk_a_div, 1144 + &sm1_sysclk_a_en, 1145 + &sm1_sysclk_b_div, 1146 + &sm1_sysclk_b_en, 1352 1147 }; 1353 1148 1354 1149 static int devm_clk_get_enable(struct device *dev, char *id) ··· 1619 1110 }; 1620 1111 1621 1112 struct audioclk_data { 1113 + struct clk_regmap *const *regmap_clks; 1114 + unsigned int regmap_clk_num; 1622 1115 struct clk_hw_onecell_data *hw_onecell_data; 1623 1116 unsigned int reset_offset; 1624 1117 unsigned int reset_num; ··· 1664 1153 } 1665 1154 1666 1155 /* Populate regmap for the regmap backed clocks */ 1667 - for (i = 0; i < ARRAY_SIZE(aud_clk_regmaps); i++) 1668 - aud_clk_regmaps[i]->map = map; 1156 + for (i = 0; i < data->regmap_clk_num; i++) 1157 + data->regmap_clks[i]->map = map; 1669 1158 1670 1159 /* Take care to skip the registered input clocks */ 1671 1160 for (i = AUD_CLKID_DDR_ARB; i < data->hw_onecell_data->num; i++) { ··· 1709 1198 } 1710 1199 1711 1200 static const struct audioclk_data axg_audioclk_data = { 1201 + .regmap_clks = axg_clk_regmaps, 1202 + .regmap_clk_num = ARRAY_SIZE(axg_clk_regmaps), 1712 1203 .hw_onecell_data = &axg_audio_hw_onecell_data, 1713 1204 }; 1714 1205 1715 1206 static const struct audioclk_data g12a_audioclk_data = { 1207 + .regmap_clks = axg_clk_regmaps, 1208 + .regmap_clk_num = ARRAY_SIZE(axg_clk_regmaps), 1716 1209 .hw_onecell_data = &g12a_audio_hw_onecell_data, 1717 1210 .reset_offset = AUDIO_SW_RESET, 1718 1211 .reset_num = 26, 1212 + }; 1213 + 1214 + static const struct audioclk_data sm1_audioclk_data = { 1215 + .regmap_clks = sm1_clk_regmaps, 1216 + .regmap_clk_num = ARRAY_SIZE(sm1_clk_regmaps), 1217 + .hw_onecell_data = &sm1_audio_hw_onecell_data, 1218 + .reset_offset = AUDIO_SM1_SW_RESET0, 1219 + .reset_num = 39, 1719 1220 }; 1720 1221 1721 1222 static const struct of_device_id clkc_match_table[] = { ··· 1737 1214 }, { 1738 1215 .compatible = "amlogic,g12a-audio-clkc", 1739 1216 .data = &g12a_audioclk_data 1217 + }, { 1218 + .compatible = "amlogic,sm1-audio-clkc", 1219 + .data = &sm1_audioclk_data 1740 1220 }, {} 1741 1221 }; 1742 1222 MODULE_DEVICE_TABLE(of, clkc_match_table); ··· 1753 1227 }; 1754 1228 module_platform_driver(axg_audio_driver); 1755 1229 1756 - MODULE_DESCRIPTION("Amlogic AXG/G12A Audio Clock driver"); 1230 + MODULE_DESCRIPTION("Amlogic AXG/G12A/SM1 Audio Clock driver"); 1757 1231 MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>"); 1758 1232 MODULE_LICENSE("GPL v2");
+20 -2
drivers/clk/meson/axg-audio.h
··· 50 50 #define AUDIO_CLK_PDMIN_CTRL1 0x0B0 51 51 #define AUDIO_CLK_SPDIFOUT_B_CTRL 0x0B4 52 52 53 + /* SM1 introduce new register and some shifts :( */ 54 + #define AUDIO_CLK_GATE_EN1 0x004 55 + #define AUDIO_SM1_MCLK_A_CTRL 0x008 56 + #define AUDIO_SM1_MCLK_B_CTRL 0x00C 57 + #define AUDIO_SM1_MCLK_C_CTRL 0x010 58 + #define AUDIO_SM1_MCLK_D_CTRL 0x014 59 + #define AUDIO_SM1_MCLK_E_CTRL 0x018 60 + #define AUDIO_SM1_MCLK_F_CTRL 0x01C 61 + #define AUDIO_SM1_MST_PAD_CTRL0 0x020 62 + #define AUDIO_SM1_MST_PAD_CTRL1 0x024 63 + #define AUDIO_SM1_SW_RESET0 0x028 64 + #define AUDIO_SM1_SW_RESET1 0x02C 65 + #define AUDIO_CLK81_CTRL 0x030 66 + #define AUDIO_CLK81_EN 0x034 53 67 /* 54 68 * CLKID index values 55 69 * These indices are entirely contrived and do not map onto the hardware. ··· 129 115 #define AUD_CLKID_TDMOUT_C_SCLK_POST_EN 150 130 116 #define AUD_CLKID_SPDIFOUT_B_CLK_SEL 153 131 117 #define AUD_CLKID_SPDIFOUT_B_CLK_DIV 154 132 - 118 + #define AUD_CLKID_CLK81_EN 173 119 + #define AUD_CLKID_SYSCLK_A_DIV 174 120 + #define AUD_CLKID_SYSCLK_B_DIV 175 121 + #define AUD_CLKID_SYSCLK_A_EN 176 122 + #define AUD_CLKID_SYSCLK_B_EN 177 133 123 134 124 /* include the CLKIDs which are part of the DT bindings */ 135 125 #include <dt-bindings/clock/axg-audio-clkc.h> 136 126 137 - #define NR_CLKS 164 127 + #define NR_CLKS 178 138 128 139 129 #endif /*__AXG_AUDIO_CLKC_H */