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

Merge tag 'sunxi-clk-for-4.12' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux into clk-next

Pull Allwinner clock patches for 4.12 from Maxime Ripard:

Support for the new H5 SoC and the PRCM block found in a number of SoCs as
well, plus the usual chunk of fixes and minor enhancements.

* tag 'sunxi-clk-for-4.12' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux:
clk: sunxi-ng: Display index when clock registration fails
clk: sunxi-ng: a33: Add offset and minimum value for DDR1 PLL N factor
clk: sunxi-ng: a80: Remodel CPU cluster PLLs as N-type multiplier clocks
clk: sunxi-ng: mult: Support PLL lock detection
clk: sunxi-ng: add support for PRCM CCUs
dt-bindings: update device tree binding for Allwinner PRCM CCUs
clk: sunxi-ng: sun5i: Fix mux width for csi clock
clk: sunxi-ng: tighten SoC deps on explicit AllWinner SoCs
clk: sunxi-ng: add Allwinner H5 CCU support for H3 CCU driver
clk: sunxi-ng: gate: Support common pre-dividers

+832 -40
+17 -1
Documentation/devicetree/bindings/clock/sunxi-ccu.txt
··· 7 7 - "allwinner,sun8i-a23-ccu" 8 8 - "allwinner,sun8i-a33-ccu" 9 9 - "allwinner,sun8i-h3-ccu" 10 + - "allwinner,sun8i-h3-r-ccu" 10 11 - "allwinner,sun8i-v3s-ccu" 11 12 - "allwinner,sun9i-a80-ccu" 12 13 - "allwinner,sun50i-a64-ccu" 14 + - "allwinner,sun50i-a64-r-ccu" 15 + - "allwinner,sun50i-h5-ccu" 13 16 14 17 - reg: Must contain the registers base address and length 15 18 - clocks: phandle to the oscillators feeding the CCU. Two are needed: ··· 22 19 - #clock-cells : must contain 1 23 20 - #reset-cells : must contain 1 24 21 25 - Example: 22 + For the PRCM CCUs on H3/A64, one more clock is needed: 23 + - "iosc": the SoC's internal frequency oscillator 24 + 25 + Example for generic CCU: 26 26 ccu: clock@01c20000 { 27 27 compatible = "allwinner,sun8i-h3-ccu"; 28 28 reg = <0x01c20000 0x400>; 29 29 clocks = <&osc24M>, <&osc32k>; 30 30 clock-names = "hosc", "losc"; 31 + #clock-cells = <1>; 32 + #reset-cells = <1>; 33 + }; 34 + 35 + Example for PRCM CCU: 36 + r_ccu: clock@01f01400 { 37 + compatible = "allwinner,sun50i-a64-r-ccu"; 38 + reg = <0x01f01400 0x100>; 39 + clocks = <&osc24M>, <&osc32k>, <&iosc>; 40 + clock-names = "hosc", "losc", "iosc"; 31 41 #clock-cells = <1>; 32 42 #reset-cells = <1>; 33 43 };
+15 -1
drivers/clk/sunxi-ng/Kconfig
··· 64 64 select SUNXI_CCU_MP 65 65 select SUNXI_CCU_PHASE 66 66 default ARM64 && ARCH_SUNXI 67 + depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST 67 68 68 69 config SUN5I_CCU 69 70 bool "Support for the Allwinner sun5i family CCM" ··· 76 75 select SUNXI_CCU_MP 77 76 select SUNXI_CCU_PHASE 78 77 default MACH_SUN5I 78 + depends on MACH_SUN5I || COMPILE_TEST 79 79 80 80 config SUN6I_A31_CCU 81 81 bool "Support for the Allwinner A31/A31s CCU" ··· 88 86 select SUNXI_CCU_MP 89 87 select SUNXI_CCU_PHASE 90 88 default MACH_SUN6I 89 + depends on MACH_SUN6I || COMPILE_TEST 91 90 92 91 config SUN8I_A23_CCU 93 92 bool "Support for the Allwinner A23 CCU" ··· 101 98 select SUNXI_CCU_MP 102 99 select SUNXI_CCU_PHASE 103 100 default MACH_SUN8I 101 + depends on MACH_SUN8I || COMPILE_TEST 104 102 105 103 config SUN8I_A33_CCU 106 104 bool "Support for the Allwinner A33 CCU" ··· 114 110 select SUNXI_CCU_MP 115 111 select SUNXI_CCU_PHASE 116 112 default MACH_SUN8I 113 + depends on MACH_SUN8I || COMPILE_TEST 117 114 118 115 config SUN8I_H3_CCU 119 116 bool "Support for the Allwinner H3 CCU" ··· 125 120 select SUNXI_CCU_NM 126 121 select SUNXI_CCU_MP 127 122 select SUNXI_CCU_PHASE 128 - default MACH_SUN8I 123 + default MACH_SUN8I || (ARM64 && ARCH_SUNXI) 124 + depends on MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST 129 125 130 126 config SUN8I_V3S_CCU 131 127 bool "Support for the Allwinner V3s CCU" ··· 138 132 select SUNXI_CCU_MP 139 133 select SUNXI_CCU_PHASE 140 134 default MACH_SUN8I 135 + depends on MACH_SUN8I || COMPILE_TEST 141 136 142 137 config SUN9I_A80_CCU 143 138 bool "Support for the Allwinner A80 CCU" ··· 150 143 select SUNXI_CCU_MP 151 144 select SUNXI_CCU_PHASE 152 145 default MACH_SUN9I 146 + depends on MACH_SUN9I || COMPILE_TEST 147 + 148 + config SUN8I_R_CCU 149 + bool "Support for Allwinner SoCs' PRCM CCUs" 150 + select SUNXI_CCU_DIV 151 + select SUNXI_CCU_GATE 152 + default MACH_SUN8I || (ARCH_SUNXI && ARM64) 153 153 154 154 endif
+1
drivers/clk/sunxi-ng/Makefile
··· 25 25 obj-$(CONFIG_SUN8I_A33_CCU) += ccu-sun8i-a33.o 26 26 obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o 27 27 obj-$(CONFIG_SUN8I_V3S_CCU) += ccu-sun8i-v3s.o 28 + obj-$(CONFIG_SUN8I_R_CCU) += ccu-sun8i-r.o 28 29 obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80.o 29 30 obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-de.o 30 31 obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-usb.o
+1 -1
drivers/clk/sunxi-ng/ccu-sun5i.c
··· 469 469 static const u8 csi_table[] = { 0, 1, 2, 5, 6 }; 470 470 static SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi_clk, "csi", 471 471 csi_parents, csi_table, 472 - 0x134, 0, 5, 24, 2, BIT(31), 0); 472 + 0x134, 0, 5, 24, 3, BIT(31), 0); 473 473 474 474 static SUNXI_CCU_GATE(ve_clk, "ve", "pll-ve", 475 475 0x13c, BIT(31), CLK_SET_RATE_PARENT);
+11 -7
drivers/clk/sunxi-ng/ccu-sun8i-a33.c
··· 159 159 BIT(28), /* lock */ 160 160 CLK_SET_RATE_UNGATE); 161 161 162 - /* TODO: Fix N */ 163 - static SUNXI_CCU_N_WITH_GATE_LOCK(pll_ddr1_clk, "pll-ddr1", 164 - "osc24M", 0x04c, 165 - 8, 6, /* N */ 166 - BIT(31), /* gate */ 167 - BIT(28), /* lock */ 168 - CLK_SET_RATE_UNGATE); 162 + static struct ccu_mult pll_ddr1_clk = { 163 + .enable = BIT(31), 164 + .lock = BIT(28), 165 + .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 6, 0, 12, 0), 166 + .common = { 167 + .reg = 0x04c, 168 + .hw.init = CLK_HW_INIT("pll-ddr1", "osc24M", 169 + &ccu_mult_ops, 170 + CLK_SET_RATE_UNGATE), 171 + }, 172 + }; 169 173 170 174 static const char * const cpux_parents[] = { "osc32k", "osc24M", 171 175 "pll-cpux" , "pll-cpux" };
+320 -7
drivers/clk/sunxi-ng/ccu-sun8i-h3.c
··· 300 300 0x06c, BIT(18), 0); 301 301 static SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb2", 302 302 0x06c, BIT(19), 0); 303 - static SUNXI_CCU_GATE(bus_scr_clk, "bus-scr", "apb2", 303 + static SUNXI_CCU_GATE(bus_scr0_clk, "bus-scr0", "apb2", 304 304 0x06c, BIT(20), 0); 305 + static SUNXI_CCU_GATE(bus_scr1_clk, "bus-scr1", "apb2", 306 + 0x06c, BIT(21), 0); 305 307 306 308 static SUNXI_CCU_GATE(bus_ephy_clk, "bus-ephy", "ahb1", 307 309 0x070, BIT(0), 0); ··· 548 546 &bus_uart1_clk.common, 549 547 &bus_uart2_clk.common, 550 548 &bus_uart3_clk.common, 551 - &bus_scr_clk.common, 549 + &bus_scr0_clk.common, 552 550 &bus_ephy_clk.common, 553 551 &bus_dbg_clk.common, 554 552 &ths_clk.common, ··· 562 560 &mmc2_clk.common, 563 561 &mmc2_sample_clk.common, 564 562 &mmc2_output_clk.common, 563 + &ts_clk.common, 564 + &ce_clk.common, 565 + &spi0_clk.common, 566 + &spi1_clk.common, 567 + &i2s0_clk.common, 568 + &i2s1_clk.common, 569 + &i2s2_clk.common, 570 + &spdif_clk.common, 571 + &usb_phy0_clk.common, 572 + &usb_phy1_clk.common, 573 + &usb_phy2_clk.common, 574 + &usb_phy3_clk.common, 575 + &usb_ohci0_clk.common, 576 + &usb_ohci1_clk.common, 577 + &usb_ohci2_clk.common, 578 + &usb_ohci3_clk.common, 579 + &dram_clk.common, 580 + &dram_ve_clk.common, 581 + &dram_csi_clk.common, 582 + &dram_deinterlace_clk.common, 583 + &dram_ts_clk.common, 584 + &de_clk.common, 585 + &tcon_clk.common, 586 + &tve_clk.common, 587 + &deinterlace_clk.common, 588 + &csi_misc_clk.common, 589 + &csi_sclk_clk.common, 590 + &csi_mclk_clk.common, 591 + &ve_clk.common, 592 + &ac_dig_clk.common, 593 + &avs_clk.common, 594 + &hdmi_clk.common, 595 + &hdmi_ddc_clk.common, 596 + &mbus_clk.common, 597 + &gpu_clk.common, 598 + }; 599 + 600 + static struct ccu_common *sun50i_h5_ccu_clks[] = { 601 + &pll_cpux_clk.common, 602 + &pll_audio_base_clk.common, 603 + &pll_video_clk.common, 604 + &pll_ve_clk.common, 605 + &pll_ddr_clk.common, 606 + &pll_periph0_clk.common, 607 + &pll_gpu_clk.common, 608 + &pll_periph1_clk.common, 609 + &pll_de_clk.common, 610 + &cpux_clk.common, 611 + &axi_clk.common, 612 + &ahb1_clk.common, 613 + &apb1_clk.common, 614 + &apb2_clk.common, 615 + &ahb2_clk.common, 616 + &bus_ce_clk.common, 617 + &bus_dma_clk.common, 618 + &bus_mmc0_clk.common, 619 + &bus_mmc1_clk.common, 620 + &bus_mmc2_clk.common, 621 + &bus_nand_clk.common, 622 + &bus_dram_clk.common, 623 + &bus_emac_clk.common, 624 + &bus_ts_clk.common, 625 + &bus_hstimer_clk.common, 626 + &bus_spi0_clk.common, 627 + &bus_spi1_clk.common, 628 + &bus_otg_clk.common, 629 + &bus_ehci0_clk.common, 630 + &bus_ehci1_clk.common, 631 + &bus_ehci2_clk.common, 632 + &bus_ehci3_clk.common, 633 + &bus_ohci0_clk.common, 634 + &bus_ohci1_clk.common, 635 + &bus_ohci2_clk.common, 636 + &bus_ohci3_clk.common, 637 + &bus_ve_clk.common, 638 + &bus_tcon0_clk.common, 639 + &bus_tcon1_clk.common, 640 + &bus_deinterlace_clk.common, 641 + &bus_csi_clk.common, 642 + &bus_tve_clk.common, 643 + &bus_hdmi_clk.common, 644 + &bus_de_clk.common, 645 + &bus_gpu_clk.common, 646 + &bus_msgbox_clk.common, 647 + &bus_spinlock_clk.common, 648 + &bus_codec_clk.common, 649 + &bus_spdif_clk.common, 650 + &bus_pio_clk.common, 651 + &bus_ths_clk.common, 652 + &bus_i2s0_clk.common, 653 + &bus_i2s1_clk.common, 654 + &bus_i2s2_clk.common, 655 + &bus_i2c0_clk.common, 656 + &bus_i2c1_clk.common, 657 + &bus_i2c2_clk.common, 658 + &bus_uart0_clk.common, 659 + &bus_uart1_clk.common, 660 + &bus_uart2_clk.common, 661 + &bus_uart3_clk.common, 662 + &bus_scr0_clk.common, 663 + &bus_scr1_clk.common, 664 + &bus_ephy_clk.common, 665 + &bus_dbg_clk.common, 666 + &ths_clk.common, 667 + &nand_clk.common, 668 + &mmc0_clk.common, 669 + &mmc1_clk.common, 670 + &mmc2_clk.common, 565 671 &ts_clk.common, 566 672 &ce_clk.common, 567 673 &spi0_clk.common, ··· 787 677 [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 788 678 [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 789 679 [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 790 - [CLK_BUS_SCR] = &bus_scr_clk.common.hw, 680 + [CLK_BUS_SCR0] = &bus_scr0_clk.common.hw, 791 681 [CLK_BUS_EPHY] = &bus_ephy_clk.common.hw, 792 682 [CLK_BUS_DBG] = &bus_dbg_clk.common.hw, 793 683 [CLK_THS] = &ths_clk.common.hw, ··· 837 727 [CLK_MBUS] = &mbus_clk.common.hw, 838 728 [CLK_GPU] = &gpu_clk.common.hw, 839 729 }, 840 - .num = CLK_NUMBER, 730 + .num = CLK_NUMBER_H3, 731 + }; 732 + 733 + static struct clk_hw_onecell_data sun50i_h5_hw_clks = { 734 + .hws = { 735 + [CLK_PLL_CPUX] = &pll_cpux_clk.common.hw, 736 + [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 737 + [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 738 + [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 739 + [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 740 + [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, 741 + [CLK_PLL_VIDEO] = &pll_video_clk.common.hw, 742 + [CLK_PLL_VE] = &pll_ve_clk.common.hw, 743 + [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 744 + [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, 745 + [CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw, 746 + [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 747 + [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, 748 + [CLK_PLL_DE] = &pll_de_clk.common.hw, 749 + [CLK_CPUX] = &cpux_clk.common.hw, 750 + [CLK_AXI] = &axi_clk.common.hw, 751 + [CLK_AHB1] = &ahb1_clk.common.hw, 752 + [CLK_APB1] = &apb1_clk.common.hw, 753 + [CLK_APB2] = &apb2_clk.common.hw, 754 + [CLK_AHB2] = &ahb2_clk.common.hw, 755 + [CLK_BUS_CE] = &bus_ce_clk.common.hw, 756 + [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 757 + [CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw, 758 + [CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw, 759 + [CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw, 760 + [CLK_BUS_NAND] = &bus_nand_clk.common.hw, 761 + [CLK_BUS_DRAM] = &bus_dram_clk.common.hw, 762 + [CLK_BUS_EMAC] = &bus_emac_clk.common.hw, 763 + [CLK_BUS_TS] = &bus_ts_clk.common.hw, 764 + [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 765 + [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 766 + [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 767 + [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 768 + [CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw, 769 + [CLK_BUS_EHCI1] = &bus_ehci1_clk.common.hw, 770 + [CLK_BUS_EHCI2] = &bus_ehci2_clk.common.hw, 771 + [CLK_BUS_EHCI3] = &bus_ehci3_clk.common.hw, 772 + [CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw, 773 + [CLK_BUS_OHCI1] = &bus_ohci1_clk.common.hw, 774 + [CLK_BUS_OHCI2] = &bus_ohci2_clk.common.hw, 775 + [CLK_BUS_OHCI3] = &bus_ohci3_clk.common.hw, 776 + [CLK_BUS_VE] = &bus_ve_clk.common.hw, 777 + [CLK_BUS_TCON0] = &bus_tcon0_clk.common.hw, 778 + [CLK_BUS_TCON1] = &bus_tcon1_clk.common.hw, 779 + [CLK_BUS_DEINTERLACE] = &bus_deinterlace_clk.common.hw, 780 + [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 781 + [CLK_BUS_TVE] = &bus_tve_clk.common.hw, 782 + [CLK_BUS_HDMI] = &bus_hdmi_clk.common.hw, 783 + [CLK_BUS_DE] = &bus_de_clk.common.hw, 784 + [CLK_BUS_GPU] = &bus_gpu_clk.common.hw, 785 + [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 786 + [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 787 + [CLK_BUS_CODEC] = &bus_codec_clk.common.hw, 788 + [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw, 789 + [CLK_BUS_PIO] = &bus_pio_clk.common.hw, 790 + [CLK_BUS_THS] = &bus_ths_clk.common.hw, 791 + [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 792 + [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 793 + [CLK_BUS_I2S2] = &bus_i2s2_clk.common.hw, 794 + [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 795 + [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 796 + [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 797 + [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 798 + [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 799 + [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 800 + [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 801 + [CLK_BUS_SCR0] = &bus_scr0_clk.common.hw, 802 + [CLK_BUS_SCR1] = &bus_scr1_clk.common.hw, 803 + [CLK_BUS_EPHY] = &bus_ephy_clk.common.hw, 804 + [CLK_BUS_DBG] = &bus_dbg_clk.common.hw, 805 + [CLK_THS] = &ths_clk.common.hw, 806 + [CLK_NAND] = &nand_clk.common.hw, 807 + [CLK_MMC0] = &mmc0_clk.common.hw, 808 + [CLK_MMC1] = &mmc1_clk.common.hw, 809 + [CLK_MMC2] = &mmc2_clk.common.hw, 810 + [CLK_TS] = &ts_clk.common.hw, 811 + [CLK_CE] = &ce_clk.common.hw, 812 + [CLK_SPI0] = &spi0_clk.common.hw, 813 + [CLK_SPI1] = &spi1_clk.common.hw, 814 + [CLK_I2S0] = &i2s0_clk.common.hw, 815 + [CLK_I2S1] = &i2s1_clk.common.hw, 816 + [CLK_I2S2] = &i2s2_clk.common.hw, 817 + [CLK_SPDIF] = &spdif_clk.common.hw, 818 + [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 819 + [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 820 + [CLK_USB_PHY2] = &usb_phy2_clk.common.hw, 821 + [CLK_USB_PHY3] = &usb_phy3_clk.common.hw, 822 + [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, 823 + [CLK_USB_OHCI1] = &usb_ohci1_clk.common.hw, 824 + [CLK_USB_OHCI2] = &usb_ohci2_clk.common.hw, 825 + [CLK_USB_OHCI3] = &usb_ohci3_clk.common.hw, 826 + [CLK_DRAM] = &dram_clk.common.hw, 827 + [CLK_DRAM_VE] = &dram_ve_clk.common.hw, 828 + [CLK_DRAM_CSI] = &dram_csi_clk.common.hw, 829 + [CLK_DRAM_DEINTERLACE] = &dram_deinterlace_clk.common.hw, 830 + [CLK_DRAM_TS] = &dram_ts_clk.common.hw, 831 + [CLK_DE] = &de_clk.common.hw, 832 + [CLK_TCON0] = &tcon_clk.common.hw, 833 + [CLK_TVE] = &tve_clk.common.hw, 834 + [CLK_DEINTERLACE] = &deinterlace_clk.common.hw, 835 + [CLK_CSI_MISC] = &csi_misc_clk.common.hw, 836 + [CLK_CSI_SCLK] = &csi_sclk_clk.common.hw, 837 + [CLK_CSI_MCLK] = &csi_mclk_clk.common.hw, 838 + [CLK_VE] = &ve_clk.common.hw, 839 + [CLK_AC_DIG] = &ac_dig_clk.common.hw, 840 + [CLK_AVS] = &avs_clk.common.hw, 841 + [CLK_HDMI] = &hdmi_clk.common.hw, 842 + [CLK_HDMI_DDC] = &hdmi_ddc_clk.common.hw, 843 + [CLK_MBUS] = &mbus_clk.common.hw, 844 + [CLK_GPU] = &gpu_clk.common.hw, 845 + }, 846 + .num = CLK_NUMBER_H5, 841 847 }; 842 848 843 849 static struct ccu_reset_map sun8i_h3_ccu_resets[] = { ··· 1016 790 [RST_BUS_UART1] = { 0x2d8, BIT(17) }, 1017 791 [RST_BUS_UART2] = { 0x2d8, BIT(18) }, 1018 792 [RST_BUS_UART3] = { 0x2d8, BIT(19) }, 1019 - [RST_BUS_SCR] = { 0x2d8, BIT(20) }, 793 + [RST_BUS_SCR0] = { 0x2d8, BIT(20) }, 794 + }; 795 + 796 + static struct ccu_reset_map sun50i_h5_ccu_resets[] = { 797 + [RST_USB_PHY0] = { 0x0cc, BIT(0) }, 798 + [RST_USB_PHY1] = { 0x0cc, BIT(1) }, 799 + [RST_USB_PHY2] = { 0x0cc, BIT(2) }, 800 + [RST_USB_PHY3] = { 0x0cc, BIT(3) }, 801 + 802 + [RST_MBUS] = { 0x0fc, BIT(31) }, 803 + 804 + [RST_BUS_CE] = { 0x2c0, BIT(5) }, 805 + [RST_BUS_DMA] = { 0x2c0, BIT(6) }, 806 + [RST_BUS_MMC0] = { 0x2c0, BIT(8) }, 807 + [RST_BUS_MMC1] = { 0x2c0, BIT(9) }, 808 + [RST_BUS_MMC2] = { 0x2c0, BIT(10) }, 809 + [RST_BUS_NAND] = { 0x2c0, BIT(13) }, 810 + [RST_BUS_DRAM] = { 0x2c0, BIT(14) }, 811 + [RST_BUS_EMAC] = { 0x2c0, BIT(17) }, 812 + [RST_BUS_TS] = { 0x2c0, BIT(18) }, 813 + [RST_BUS_HSTIMER] = { 0x2c0, BIT(19) }, 814 + [RST_BUS_SPI0] = { 0x2c0, BIT(20) }, 815 + [RST_BUS_SPI1] = { 0x2c0, BIT(21) }, 816 + [RST_BUS_OTG] = { 0x2c0, BIT(23) }, 817 + [RST_BUS_EHCI0] = { 0x2c0, BIT(24) }, 818 + [RST_BUS_EHCI1] = { 0x2c0, BIT(25) }, 819 + [RST_BUS_EHCI2] = { 0x2c0, BIT(26) }, 820 + [RST_BUS_EHCI3] = { 0x2c0, BIT(27) }, 821 + [RST_BUS_OHCI0] = { 0x2c0, BIT(28) }, 822 + [RST_BUS_OHCI1] = { 0x2c0, BIT(29) }, 823 + [RST_BUS_OHCI2] = { 0x2c0, BIT(30) }, 824 + [RST_BUS_OHCI3] = { 0x2c0, BIT(31) }, 825 + 826 + [RST_BUS_VE] = { 0x2c4, BIT(0) }, 827 + [RST_BUS_TCON0] = { 0x2c4, BIT(3) }, 828 + [RST_BUS_TCON1] = { 0x2c4, BIT(4) }, 829 + [RST_BUS_DEINTERLACE] = { 0x2c4, BIT(5) }, 830 + [RST_BUS_CSI] = { 0x2c4, BIT(8) }, 831 + [RST_BUS_TVE] = { 0x2c4, BIT(9) }, 832 + [RST_BUS_HDMI0] = { 0x2c4, BIT(10) }, 833 + [RST_BUS_HDMI1] = { 0x2c4, BIT(11) }, 834 + [RST_BUS_DE] = { 0x2c4, BIT(12) }, 835 + [RST_BUS_GPU] = { 0x2c4, BIT(20) }, 836 + [RST_BUS_MSGBOX] = { 0x2c4, BIT(21) }, 837 + [RST_BUS_SPINLOCK] = { 0x2c4, BIT(22) }, 838 + [RST_BUS_DBG] = { 0x2c4, BIT(31) }, 839 + 840 + [RST_BUS_EPHY] = { 0x2c8, BIT(2) }, 841 + 842 + [RST_BUS_CODEC] = { 0x2d0, BIT(0) }, 843 + [RST_BUS_SPDIF] = { 0x2d0, BIT(1) }, 844 + [RST_BUS_THS] = { 0x2d0, BIT(8) }, 845 + [RST_BUS_I2S0] = { 0x2d0, BIT(12) }, 846 + [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, 847 + [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, 848 + 849 + [RST_BUS_I2C0] = { 0x2d8, BIT(0) }, 850 + [RST_BUS_I2C1] = { 0x2d8, BIT(1) }, 851 + [RST_BUS_I2C2] = { 0x2d8, BIT(2) }, 852 + [RST_BUS_UART0] = { 0x2d8, BIT(16) }, 853 + [RST_BUS_UART1] = { 0x2d8, BIT(17) }, 854 + [RST_BUS_UART2] = { 0x2d8, BIT(18) }, 855 + [RST_BUS_UART3] = { 0x2d8, BIT(19) }, 856 + [RST_BUS_SCR0] = { 0x2d8, BIT(20) }, 857 + [RST_BUS_SCR1] = { 0x2d8, BIT(20) }, 1020 858 }; 1021 859 1022 860 static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = { ··· 1093 803 .num_resets = ARRAY_SIZE(sun8i_h3_ccu_resets), 1094 804 }; 1095 805 806 + static const struct sunxi_ccu_desc sun50i_h5_ccu_desc = { 807 + .ccu_clks = sun50i_h5_ccu_clks, 808 + .num_ccu_clks = ARRAY_SIZE(sun50i_h5_ccu_clks), 809 + 810 + .hw_clks = &sun50i_h5_hw_clks, 811 + 812 + .resets = sun50i_h5_ccu_resets, 813 + .num_resets = ARRAY_SIZE(sun50i_h5_ccu_resets), 814 + }; 815 + 1096 816 static struct ccu_mux_nb sun8i_h3_cpu_nb = { 1097 817 .common = &cpux_clk.common, 1098 818 .cm = &cpux_clk.mux, ··· 1110 810 .bypass_index = 1, /* index of 24 MHz oscillator */ 1111 811 }; 1112 812 1113 - static void __init sun8i_h3_ccu_setup(struct device_node *node) 813 + static void __init sunxi_h3_h5_ccu_init(struct device_node *node, 814 + const struct sunxi_ccu_desc *desc) 1114 815 { 1115 816 void __iomem *reg; 1116 817 u32 val; ··· 1128 827 val &= ~GENMASK(19, 16); 1129 828 writel(val | (3 << 16), reg + SUN8I_H3_PLL_AUDIO_REG); 1130 829 1131 - sunxi_ccu_probe(node, reg, &sun8i_h3_ccu_desc); 830 + sunxi_ccu_probe(node, reg, desc); 1132 831 1133 832 ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, 1134 833 &sun8i_h3_cpu_nb); 1135 834 } 835 + 836 + static void __init sun8i_h3_ccu_setup(struct device_node *node) 837 + { 838 + sunxi_h3_h5_ccu_init(node, &sun8i_h3_ccu_desc); 839 + } 1136 840 CLK_OF_DECLARE(sun8i_h3_ccu, "allwinner,sun8i-h3-ccu", 1137 841 sun8i_h3_ccu_setup); 842 + 843 + static void __init sun50i_h5_ccu_setup(struct device_node *node) 844 + { 845 + sunxi_h3_h5_ccu_init(node, &sun50i_h5_ccu_desc); 846 + } 847 + CLK_OF_DECLARE(sun50i_h5_ccu, "allwinner,sun50i-h5-ccu", 848 + sun50i_h5_ccu_setup);
+2 -1
drivers/clk/sunxi-ng/ccu-sun8i-h3.h
··· 57 57 58 58 /* And the GPU module clock is exported */ 59 59 60 - #define CLK_NUMBER (CLK_GPU + 1) 60 + #define CLK_NUMBER_H3 (CLK_GPU + 1) 61 + #define CLK_NUMBER_H5 (CLK_BUS_SCR1 + 1) 61 62 62 63 #endif /* _CCU_SUN8I_H3_H_ */
+213
drivers/clk/sunxi-ng/ccu-sun8i-r.c
··· 1 + /* 2 + * Copyright (c) 2016 Icenowy Zheng <icenowy@aosc.xyz> 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #include <linux/clk-provider.h> 15 + #include <linux/of_address.h> 16 + #include <linux/platform_device.h> 17 + 18 + #include "ccu_common.h" 19 + #include "ccu_reset.h" 20 + 21 + #include "ccu_div.h" 22 + #include "ccu_gate.h" 23 + #include "ccu_mp.h" 24 + #include "ccu_nm.h" 25 + 26 + #include "ccu-sun8i-r.h" 27 + 28 + static const char * const ar100_parents[] = { "osc32k", "osc24M", 29 + "pll-periph0", "iosc" }; 30 + 31 + static struct ccu_div ar100_clk = { 32 + .div = _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO), 33 + 34 + .mux = { 35 + .shift = 16, 36 + .width = 2, 37 + 38 + .variable_prediv = { 39 + .index = 2, 40 + .shift = 8, 41 + .width = 5, 42 + }, 43 + }, 44 + 45 + .common = { 46 + .reg = 0x00, 47 + .features = CCU_FEATURE_VARIABLE_PREDIV, 48 + .hw.init = CLK_HW_INIT_PARENTS("ar100", 49 + ar100_parents, 50 + &ccu_div_ops, 51 + 0), 52 + }, 53 + }; 54 + 55 + static CLK_FIXED_FACTOR(ahb0_clk, "ahb0", "ar100", 1, 1, 0); 56 + 57 + static struct ccu_div apb0_clk = { 58 + .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 59 + 60 + .common = { 61 + .reg = 0x0c, 62 + .hw.init = CLK_HW_INIT("apb0", 63 + "ahb0", 64 + &ccu_div_ops, 65 + 0), 66 + }, 67 + }; 68 + 69 + static SUNXI_CCU_GATE(apb0_pio_clk, "apb0-pio", "apb0", 70 + 0x28, BIT(0), 0); 71 + static SUNXI_CCU_GATE(apb0_ir_clk, "apb0-ir", "apb0", 72 + 0x28, BIT(1), 0); 73 + static SUNXI_CCU_GATE(apb0_timer_clk, "apb0-timer", "apb0", 74 + 0x28, BIT(2), 0); 75 + static SUNXI_CCU_GATE(apb0_rsb_clk, "apb0-rsb", "apb0", 76 + 0x28, BIT(3), 0); 77 + static SUNXI_CCU_GATE(apb0_uart_clk, "apb0-uart", "apb0", 78 + 0x28, BIT(4), 0); 79 + static SUNXI_CCU_GATE(apb0_i2c_clk, "apb0-i2c", "apb0", 80 + 0x28, BIT(6), 0); 81 + static SUNXI_CCU_GATE(apb0_twd_clk, "apb0-twd", "apb0", 82 + 0x28, BIT(7), 0); 83 + 84 + static const char * const r_mod0_default_parents[] = { "osc32K", "osc24M" }; 85 + static SUNXI_CCU_MP_WITH_MUX_GATE(ir_clk, "ir", 86 + r_mod0_default_parents, 0x54, 87 + 0, 4, /* M */ 88 + 16, 2, /* P */ 89 + 24, 2, /* mux */ 90 + BIT(31), /* gate */ 91 + 0); 92 + 93 + static struct ccu_common *sun8i_h3_r_ccu_clks[] = { 94 + &ar100_clk.common, 95 + &apb0_clk.common, 96 + &apb0_pio_clk.common, 97 + &apb0_ir_clk.common, 98 + &apb0_timer_clk.common, 99 + &apb0_uart_clk.common, 100 + &apb0_i2c_clk.common, 101 + &apb0_twd_clk.common, 102 + &ir_clk.common, 103 + }; 104 + 105 + static struct ccu_common *sun50i_a64_r_ccu_clks[] = { 106 + &ar100_clk.common, 107 + &apb0_clk.common, 108 + &apb0_pio_clk.common, 109 + &apb0_ir_clk.common, 110 + &apb0_timer_clk.common, 111 + &apb0_rsb_clk.common, 112 + &apb0_uart_clk.common, 113 + &apb0_i2c_clk.common, 114 + &apb0_twd_clk.common, 115 + &ir_clk.common, 116 + }; 117 + 118 + static struct clk_hw_onecell_data sun8i_h3_r_hw_clks = { 119 + .hws = { 120 + [CLK_AR100] = &ar100_clk.common.hw, 121 + [CLK_AHB0] = &ahb0_clk.hw, 122 + [CLK_APB0] = &apb0_clk.common.hw, 123 + [CLK_APB0_PIO] = &apb0_pio_clk.common.hw, 124 + [CLK_APB0_IR] = &apb0_ir_clk.common.hw, 125 + [CLK_APB0_TIMER] = &apb0_timer_clk.common.hw, 126 + [CLK_APB0_UART] = &apb0_uart_clk.common.hw, 127 + [CLK_APB0_I2C] = &apb0_i2c_clk.common.hw, 128 + [CLK_APB0_TWD] = &apb0_twd_clk.common.hw, 129 + [CLK_IR] = &ir_clk.common.hw, 130 + }, 131 + .num = CLK_NUMBER, 132 + }; 133 + 134 + static struct clk_hw_onecell_data sun50i_a64_r_hw_clks = { 135 + .hws = { 136 + [CLK_AR100] = &ar100_clk.common.hw, 137 + [CLK_AHB0] = &ahb0_clk.hw, 138 + [CLK_APB0] = &apb0_clk.common.hw, 139 + [CLK_APB0_PIO] = &apb0_pio_clk.common.hw, 140 + [CLK_APB0_IR] = &apb0_ir_clk.common.hw, 141 + [CLK_APB0_TIMER] = &apb0_timer_clk.common.hw, 142 + [CLK_APB0_RSB] = &apb0_rsb_clk.common.hw, 143 + [CLK_APB0_UART] = &apb0_uart_clk.common.hw, 144 + [CLK_APB0_I2C] = &apb0_i2c_clk.common.hw, 145 + [CLK_APB0_TWD] = &apb0_twd_clk.common.hw, 146 + [CLK_IR] = &ir_clk.common.hw, 147 + }, 148 + .num = CLK_NUMBER, 149 + }; 150 + 151 + static struct ccu_reset_map sun8i_h3_r_ccu_resets[] = { 152 + [RST_APB0_IR] = { 0xb0, BIT(1) }, 153 + [RST_APB0_TIMER] = { 0xb0, BIT(2) }, 154 + [RST_APB0_UART] = { 0xb0, BIT(4) }, 155 + [RST_APB0_I2C] = { 0xb0, BIT(6) }, 156 + }; 157 + 158 + static struct ccu_reset_map sun50i_a64_r_ccu_resets[] = { 159 + [RST_APB0_IR] = { 0xb0, BIT(1) }, 160 + [RST_APB0_TIMER] = { 0xb0, BIT(2) }, 161 + [RST_APB0_RSB] = { 0xb0, BIT(3) }, 162 + [RST_APB0_UART] = { 0xb0, BIT(4) }, 163 + [RST_APB0_I2C] = { 0xb0, BIT(6) }, 164 + }; 165 + 166 + static const struct sunxi_ccu_desc sun8i_h3_r_ccu_desc = { 167 + .ccu_clks = sun8i_h3_r_ccu_clks, 168 + .num_ccu_clks = ARRAY_SIZE(sun8i_h3_r_ccu_clks), 169 + 170 + .hw_clks = &sun8i_h3_r_hw_clks, 171 + 172 + .resets = sun8i_h3_r_ccu_resets, 173 + .num_resets = ARRAY_SIZE(sun8i_h3_r_ccu_resets), 174 + }; 175 + 176 + static const struct sunxi_ccu_desc sun50i_a64_r_ccu_desc = { 177 + .ccu_clks = sun50i_a64_r_ccu_clks, 178 + .num_ccu_clks = ARRAY_SIZE(sun50i_a64_r_ccu_clks), 179 + 180 + .hw_clks = &sun50i_a64_r_hw_clks, 181 + 182 + .resets = sun50i_a64_r_ccu_resets, 183 + .num_resets = ARRAY_SIZE(sun50i_a64_r_ccu_resets), 184 + }; 185 + 186 + static void __init sunxi_r_ccu_init(struct device_node *node, 187 + const struct sunxi_ccu_desc *desc) 188 + { 189 + void __iomem *reg; 190 + 191 + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 192 + if (IS_ERR(reg)) { 193 + pr_err("%s: Could not map the clock registers\n", 194 + of_node_full_name(node)); 195 + return; 196 + } 197 + 198 + sunxi_ccu_probe(node, reg, desc); 199 + } 200 + 201 + static void __init sun8i_h3_r_ccu_setup(struct device_node *node) 202 + { 203 + sunxi_r_ccu_init(node, &sun8i_h3_r_ccu_desc); 204 + } 205 + CLK_OF_DECLARE(sun8i_h3_r_ccu, "allwinner,sun8i-h3-r-ccu", 206 + sun8i_h3_r_ccu_setup); 207 + 208 + static void __init sun50i_a64_r_ccu_setup(struct device_node *node) 209 + { 210 + sunxi_r_ccu_init(node, &sun50i_a64_r_ccu_desc); 211 + } 212 + CLK_OF_DECLARE(sun50i_a64_r_ccu, "allwinner,sun50i-a64-r-ccu", 213 + sun50i_a64_r_ccu_setup);
+27
drivers/clk/sunxi-ng/ccu-sun8i-r.h
··· 1 + /* 2 + * Copyright 2016 Icenowy <icenowy@aosc.xyz> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + */ 14 + 15 + #ifndef _CCU_SUN8I_R_H 16 + #define _CCU_SUN8I_R_H_ 17 + 18 + #include <dt-bindings/clock/sun8i-r-ccu.h> 19 + #include <dt-bindings/reset/sun8i-r-ccu.h> 20 + 21 + /* AHB/APB bus clocks are not exported */ 22 + #define CLK_AHB0 1 23 + #define CLK_APB0 2 24 + 25 + #define CLK_NUMBER (CLK_APB0_TWD + 1) 26 + 27 + #endif /* _CCU_SUN8I_R_H */
+52 -18
drivers/clk/sunxi-ng/ccu-sun9i-a80.c
··· 29 29 30 30 #define CCU_SUN9I_LOCK_REG 0x09c 31 31 32 - static struct clk_div_table pll_cpux_p_div_table[] = { 33 - { .val = 0, .div = 1 }, 34 - { .val = 1, .div = 4 }, 35 - { /* Sentinel */ }, 36 - }; 37 - 38 32 /* 39 - * The CPU PLLs are actually NP clocks, but P is /1 or /4, so here we 40 - * use the NM clocks with a divider table for M. 33 + * The CPU PLLs are actually NP clocks, with P being /1 or /4. However 34 + * P should only be used for output frequencies lower than 228 MHz. 35 + * Neither mainline Linux, U-boot, nor the vendor BSPs use these. 36 + * 37 + * For now we can just model it as a multiplier clock, and force P to /1. 41 38 */ 42 - static struct ccu_nm pll_c0cpux_clk = { 39 + #define SUN9I_A80_PLL_C0CPUX_REG 0x000 40 + #define SUN9I_A80_PLL_C1CPUX_REG 0x004 41 + 42 + static struct ccu_mult pll_c0cpux_clk = { 43 43 .enable = BIT(31), 44 44 .lock = BIT(0), 45 - .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 46 - .m = _SUNXI_CCU_DIV_TABLE(16, 1, pll_cpux_p_div_table), 45 + .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 47 46 .common = { 48 - .reg = 0x000, 47 + .reg = SUN9I_A80_PLL_C0CPUX_REG, 49 48 .lock_reg = CCU_SUN9I_LOCK_REG, 50 49 .features = CCU_FEATURE_LOCK_REG, 51 50 .hw.init = CLK_HW_INIT("pll-c0cpux", "osc24M", 52 - &ccu_nm_ops, CLK_SET_RATE_UNGATE), 51 + &ccu_mult_ops, 52 + CLK_SET_RATE_UNGATE), 53 53 }, 54 54 }; 55 55 56 - static struct ccu_nm pll_c1cpux_clk = { 56 + static struct ccu_mult pll_c1cpux_clk = { 57 57 .enable = BIT(31), 58 58 .lock = BIT(1), 59 - .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 60 - .m = _SUNXI_CCU_DIV_TABLE(16, 1, pll_cpux_p_div_table), 59 + .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 12, 0), 61 60 .common = { 62 - .reg = 0x004, 61 + .reg = SUN9I_A80_PLL_C1CPUX_REG, 63 62 .lock_reg = CCU_SUN9I_LOCK_REG, 64 63 .features = CCU_FEATURE_LOCK_REG, 65 64 .hw.init = CLK_HW_INIT("pll-c1cpux", "osc24M", 66 - &ccu_nm_ops, CLK_SET_RATE_UNGATE), 65 + &ccu_mult_ops, 66 + CLK_SET_RATE_UNGATE), 67 67 }, 68 68 }; 69 69 ··· 1189 1189 .num_resets = ARRAY_SIZE(sun9i_a80_ccu_resets), 1190 1190 }; 1191 1191 1192 + #define SUN9I_A80_PLL_P_SHIFT 16 1193 + #define SUN9I_A80_PLL_N_SHIFT 8 1194 + #define SUN9I_A80_PLL_N_WIDTH 8 1195 + 1196 + static void sun9i_a80_cpu_pll_fixup(void __iomem *reg) 1197 + { 1198 + u32 val = readl(reg); 1199 + 1200 + /* bail out if P divider is not used */ 1201 + if (!(val & BIT(SUN9I_A80_PLL_P_SHIFT))) 1202 + return; 1203 + 1204 + /* 1205 + * If P is used, output should be less than 288 MHz. When we 1206 + * set P to 1, we should also decrease the multiplier so the 1207 + * output doesn't go out of range, but not too much such that 1208 + * the multiplier stays above 12, the minimal operation value. 1209 + * 1210 + * To keep it simple, set the multiplier to 17, the reset value. 1211 + */ 1212 + val &= ~GENMASK(SUN9I_A80_PLL_N_SHIFT + SUN9I_A80_PLL_N_WIDTH - 1, 1213 + SUN9I_A80_PLL_N_SHIFT); 1214 + val |= 17 << SUN9I_A80_PLL_N_SHIFT; 1215 + 1216 + /* And clear P */ 1217 + val &= ~BIT(SUN9I_A80_PLL_P_SHIFT); 1218 + 1219 + writel(val, reg); 1220 + } 1221 + 1192 1222 static int sun9i_a80_ccu_probe(struct platform_device *pdev) 1193 1223 { 1194 1224 struct resource *res; ··· 1234 1204 val = readl(reg + SUN9I_A80_PLL_AUDIO_REG); 1235 1205 val &= (BIT(16) & BIT(18)); 1236 1206 writel(val, reg + SUN9I_A80_PLL_AUDIO_REG); 1207 + 1208 + /* Enforce P = 1 for both CPU cluster PLLs */ 1209 + sun9i_a80_cpu_pll_fixup(reg + SUN9I_A80_PLL_C0CPUX_REG); 1210 + sun9i_a80_cpu_pll_fixup(reg + SUN9I_A80_PLL_C1CPUX_REG); 1237 1211 1238 1212 return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun9i_a80_ccu_desc); 1239 1213 }
+2 -2
drivers/clk/sunxi-ng/ccu_common.c
··· 112 112 113 113 ret = clk_hw_register(NULL, hw); 114 114 if (ret) { 115 - pr_err("Couldn't register clock %s\n", 116 - clk_hw_get_name(hw)); 115 + pr_err("Couldn't register clock %d - %s\n", 116 + i, clk_hw_get_name(hw)); 117 117 goto err_clk_unreg; 118 118 } 119 119 }
+47
drivers/clk/sunxi-ng/ccu_gate.c
··· 75 75 return ccu_gate_helper_is_enabled(&cg->common, cg->enable); 76 76 } 77 77 78 + static unsigned long ccu_gate_recalc_rate(struct clk_hw *hw, 79 + unsigned long parent_rate) 80 + { 81 + struct ccu_gate *cg = hw_to_ccu_gate(hw); 82 + unsigned long rate = parent_rate; 83 + 84 + if (cg->common.features & CCU_FEATURE_ALL_PREDIV) 85 + rate /= cg->common.prediv; 86 + 87 + return rate; 88 + } 89 + 90 + static long ccu_gate_round_rate(struct clk_hw *hw, unsigned long rate, 91 + unsigned long *prate) 92 + { 93 + struct ccu_gate *cg = hw_to_ccu_gate(hw); 94 + int div = 1; 95 + 96 + if (cg->common.features & CCU_FEATURE_ALL_PREDIV) 97 + div = cg->common.prediv; 98 + 99 + if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { 100 + unsigned long best_parent = rate; 101 + 102 + if (cg->common.features & CCU_FEATURE_ALL_PREDIV) 103 + best_parent *= div; 104 + *prate = clk_hw_round_rate(clk_hw_get_parent(hw), best_parent); 105 + } 106 + 107 + return *prate / div; 108 + } 109 + 110 + static int ccu_gate_set_rate(struct clk_hw *hw, unsigned long rate, 111 + unsigned long parent_rate) 112 + { 113 + /* 114 + * We must report success but we can do so unconditionally because 115 + * clk_factor_round_rate returns values that ensure this call is a 116 + * nop. 117 + */ 118 + 119 + return 0; 120 + } 121 + 78 122 const struct clk_ops ccu_gate_ops = { 79 123 .disable = ccu_gate_disable, 80 124 .enable = ccu_gate_enable, 81 125 .is_enabled = ccu_gate_is_enabled, 126 + .round_rate = ccu_gate_round_rate, 127 + .set_rate = ccu_gate_set_rate, 128 + .recalc_rate = ccu_gate_recalc_rate, 82 129 };
+2
drivers/clk/sunxi-ng/ccu_mult.c
··· 137 137 138 138 spin_unlock_irqrestore(cm->common.lock, flags); 139 139 140 + ccu_helper_wait_for_lock(&cm->common, cm->lock); 141 + 140 142 return 0; 141 143 } 142 144
+2
drivers/clk/sunxi-ng/ccu_mult.h
··· 33 33 34 34 struct ccu_mult { 35 35 u32 enable; 36 + u32 lock; 36 37 37 38 struct ccu_frac_internal frac; 38 39 struct ccu_mult_internal mult; ··· 46 45 _flags) \ 47 46 struct ccu_mult _struct = { \ 48 47 .enable = _gate, \ 48 + .lock = _lock, \ 49 49 .mult = _SUNXI_CCU_MULT(_mshift, _mwidth), \ 50 50 .common = { \ 51 51 .reg = _reg, \
+4 -1
include/dt-bindings/clock/sun8i-h3-ccu.h
··· 91 91 #define CLK_BUS_UART1 63 92 92 #define CLK_BUS_UART2 64 93 93 #define CLK_BUS_UART3 65 94 - #define CLK_BUS_SCR 66 94 + #define CLK_BUS_SCR0 66 95 95 #define CLK_BUS_EPHY 67 96 96 #define CLK_BUS_DBG 68 97 97 ··· 141 141 #define CLK_HDMI_DDC 112 142 142 143 143 #define CLK_GPU 114 144 + 145 + /* New clocks imported in H5 */ 146 + #define CLK_BUS_SCR1 115 144 147 145 148 #endif /* _DT_BINDINGS_CLK_SUN8I_H3_H_ */
+59
include/dt-bindings/clock/sun8i-r-ccu.h
··· 1 + /* 2 + * Copyright (c) 2016 Icenowy Zheng <icenowy@aosc.xyz> 3 + * 4 + * This file is dual-licensed: you can use it either under the terms 5 + * of the GPL or the X11 license, at your option. Note that this dual 6 + * licensing only applies to this file, and not this project as a 7 + * whole. 8 + * 9 + * a) This file is free software; you can redistribute it and/or 10 + * modify it under the terms of the GNU General Public License as 11 + * published by the Free Software Foundation; either version 2 of the 12 + * License, or (at your option) any later version. 13 + * 14 + * This file is distributed in the hope that it will be useful, 15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 + * GNU General Public License for more details. 18 + * 19 + * Or, alternatively, 20 + * 21 + * b) Permission is hereby granted, free of charge, to any person 22 + * obtaining a copy of this software and associated documentation 23 + * files (the "Software"), to deal in the Software without 24 + * restriction, including without limitation the rights to use, 25 + * copy, modify, merge, publish, distribute, sublicense, and/or 26 + * sell copies of the Software, and to permit persons to whom the 27 + * Software is furnished to do so, subject to the following 28 + * conditions: 29 + * 30 + * The above copyright notice and this permission notice shall be 31 + * included in all copies or substantial portions of the Software. 32 + * 33 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 34 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 35 + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 36 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 37 + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 38 + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 39 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 40 + * OTHER DEALINGS IN THE SOFTWARE. 41 + */ 42 + 43 + #ifndef _DT_BINDINGS_CLK_SUN8I_R_CCU_H_ 44 + #define _DT_BINDINGS_CLK_SUN8I_R_CCU_H_ 45 + 46 + #define CLK_AR100 0 47 + 48 + #define CLK_APB0_PIO 3 49 + #define CLK_APB0_IR 4 50 + #define CLK_APB0_TIMER 5 51 + #define CLK_APB0_RSB 6 52 + #define CLK_APB0_UART 7 53 + /* 8 is reserved for CLK_APB0_W1 on A31 */ 54 + #define CLK_APB0_I2C 9 55 + #define CLK_APB0_TWD 10 56 + 57 + #define CLK_IR 11 58 + 59 + #endif /* _DT_BINDINGS_CLK_SUN8I_R_CCU_H_ */
+4 -1
include/dt-bindings/reset/sun8i-h3-ccu.h
··· 98 98 #define RST_BUS_UART1 50 99 99 #define RST_BUS_UART2 51 100 100 #define RST_BUS_UART3 52 101 - #define RST_BUS_SCR 53 101 + #define RST_BUS_SCR0 53 102 + 103 + /* New resets imported in H5 */ 104 + #define RST_BUS_SCR1 54 102 105 103 106 #endif /* _DT_BINDINGS_RST_SUN8I_H3_H_ */
+53
include/dt-bindings/reset/sun8i-r-ccu.h
··· 1 + /* 2 + * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz> 3 + * 4 + * This file is dual-licensed: you can use it either under the terms 5 + * of the GPL or the X11 license, at your option. Note that this dual 6 + * licensing only applies to this file, and not this project as a 7 + * whole. 8 + * 9 + * a) This file is free software; you can redistribute it and/or 10 + * modify it under the terms of the GNU General Public License as 11 + * published by the Free Software Foundation; either version 2 of the 12 + * License, or (at your option) any later version. 13 + * 14 + * This file is distributed in the hope that it will be useful, 15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 + * GNU General Public License for more details. 18 + * 19 + * Or, alternatively, 20 + * 21 + * b) Permission is hereby granted, free of charge, to any person 22 + * obtaining a copy of this software and associated documentation 23 + * files (the "Software"), to deal in the Software without 24 + * restriction, including without limitation the rights to use, 25 + * copy, modify, merge, publish, distribute, sublicense, and/or 26 + * sell copies of the Software, and to permit persons to whom the 27 + * Software is furnished to do so, subject to the following 28 + * conditions: 29 + * 30 + * The above copyright notice and this permission notice shall be 31 + * included in all copies or substantial portions of the Software. 32 + * 33 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 34 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 35 + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 36 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 37 + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 38 + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 39 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 40 + * OTHER DEALINGS IN THE SOFTWARE. 41 + */ 42 + 43 + #ifndef _DT_BINDINGS_RST_SUN8I_R_CCU_H_ 44 + #define _DT_BINDINGS_RST_SUN8I_R_CCU_H_ 45 + 46 + #define RST_APB0_IR 0 47 + #define RST_APB0_TIMER 1 48 + #define RST_APB0_RSB 2 49 + #define RST_APB0_UART 3 50 + /* 4 is reserved for RST_APB0_W1 on A31 */ 51 + #define RST_APB0_I2C 5 52 + 53 + #endif /* _DT_BINDINGS_RST_SUN8I_R_CCU_H_ */