Lines Matching +full:24 +full:- +full:bit

1 // SPDX-License-Identifier: GPL-2.0
6 #include <linux/clk-provider.h>
23 #include "ccu-sun50i-a100.h"
25 #define SUN50I_A100_PLL_SDM_ENABLE BIT(24)
26 #define SUN50I_A100_PLL_OUTPUT_ENABLE BIT(27)
27 #define SUN50I_A100_PLL_LOCK BIT(28)
28 #define SUN50I_A100_PLL_LOCK_ENABLE BIT(29)
29 #define SUN50I_A100_PLL_ENABLE BIT(31)
50 .hw.init = CLK_HW_INIT("pll-cpux", "dcxo24M",
66 .hw.init = CLK_HW_INIT("pll-ddr0", "dcxo24M",
84 .hw.init = CLK_HW_INIT("pll-periph0", "dcxo24M",
101 .hw.init = CLK_HW_INIT("pll-periph1", "dcxo24M",
117 .hw.init = CLK_HW_INIT("pll-gpu", "dcxo24M",
137 .hw.init = CLK_HW_INIT("pll-video0", "dcxo24M",
153 .hw.init = CLK_HW_INIT("pll-video1", "dcxo24M",
169 .hw.init = CLK_HW_INIT("pll-video2", "dcxo24M",
184 .hw.init = CLK_HW_INIT("pll-ve", "dcxo24M",
205 .sdm = _SUNXI_CCU_SDM(pll_com_sdm_table, BIT(24),
206 0x160, BIT(31)),
210 .hw.init = CLK_HW_INIT("pll-com", "dcxo24M",
226 .hw.init = CLK_HW_INIT("pll-video3", "dcxo24M",
252 .sdm = _SUNXI_CCU_SDM(pll_audio_sdm_table, BIT(24),
253 0x178, BIT(31)),
258 .hw.init = CLK_HW_INIT("pll-audio", "dcxo24M",
265 "iosc", "pll-cpux",
266 "pll-periph0" };
268 0x500, 24, 3, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL);
270 static SUNXI_CCU_M(cpux_apb_clk, "cpux-apb", "cpux", 0x500, 8, 2, 0);
273 "iosc", "pll-periph0",
274 "pll-periph0-2x" };
275 static SUNXI_CCU_MP_WITH_MUX(psi_ahb1_ahb2_clk, "psi-ahb1-ahb2",
279 24, 3, /* mux */
283 "psi-ahb1-ahb2",
284 "pll-periph0",
285 "pll-periph0-2x" };
289 24, 3, /* mux */
295 24, 3, /* mux */
301 24, 3, /* mux */
304 static const char * const mbus_parents[] = { "dcxo24M", "pll-ddr0",
305 "pll-periph0",
306 "pll-periph0-2x" };
309 24, 2, /* mux */
310 BIT(31), /* gate */
313 static const char * const de_parents[] = { "pll-com", "pll-periph0-2x" };
316 24, 1, /* mux */
317 BIT(31), /* gate */
320 static SUNXI_CCU_GATE(bus_de_clk, "bus-de", "psi-ahb1-ahb2",
321 0x60c, BIT(0), 0);
323 static const char * const g2d_parents[] = { "pll-com", "pll-periph0-2x",
324 "pll-video0-2x", "pll-video1-2x",
325 "pll-video2-2x"};
330 24, 3, /* mux */
331 BIT(31), /* gate */
334 static SUNXI_CCU_GATE(bus_g2d_clk, "bus-g2d", "psi-ahb1-ahb2",
335 0x63c, BIT(0), 0);
337 static const char * const gpu_parents[] = { "pll-gpu" };
340 24, 1, /* mux */
341 BIT(31), /* gate */
344 static SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "psi-ahb1-ahb2",
345 0x67c, BIT(0), 0);
347 static const char * const ce_parents[] = { "dcxo24M", "pll-periph0-2x" };
351 24, 1, /* mux */
352 BIT(31), /* gate */
355 static SUNXI_CCU_GATE(bus_ce_clk, "bus-ce", "psi-ahb1-ahb2",
356 0x68c, BIT(0), 0);
358 static const char * const ve_parents[] = { "pll-ve" };
361 24, 1, /* mux */
362 BIT(31), /* gate */
365 static SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "psi-ahb1-ahb2",
366 0x69c, BIT(0), 0);
368 static SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "psi-ahb1-ahb2",
369 0x70c, BIT(0), 0);
371 static SUNXI_CCU_GATE(bus_msgbox_clk, "bus-msgbox", "psi-ahb1-ahb2",
372 0x71c, BIT(0), 0);
374 static SUNXI_CCU_GATE(bus_spinlock_clk, "bus-spinlock", "psi-ahb1-ahb2",
375 0x72c, BIT(0), 0);
377 static SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "psi-ahb1-ahb2",
378 0x73c, BIT(0), 0);
380 static SUNXI_CCU_GATE(avs_clk, "avs", "dcxo24M", 0x740, BIT(31), 0);
382 static SUNXI_CCU_GATE(bus_dbg_clk, "bus-dbg", "psi-ahb1-ahb2",
383 0x78c, BIT(0), 0);
385 static SUNXI_CCU_GATE(bus_psi_clk, "bus-psi", "psi-ahb1-ahb2",
386 0x79c, BIT(0), 0);
388 static SUNXI_CCU_GATE(bus_pwm_clk, "bus-pwm", "apb1", 0x7ac, BIT(0), 0);
390 static SUNXI_CCU_GATE(bus_iommu_clk, "bus-iommu", "apb1", 0x7bc, BIT(0), 0);
392 static SUNXI_CCU_GATE(mbus_dma_clk, "mbus-dma", "mbus",
393 0x804, BIT(0), 0);
394 static SUNXI_CCU_GATE(mbus_ve_clk, "mbus-ve", "mbus",
395 0x804, BIT(1), 0);
396 static SUNXI_CCU_GATE(mbus_ce_clk, "mbus-ce", "mbus",
397 0x804, BIT(2), 0);
398 static SUNXI_CCU_GATE(mbus_nand_clk, "mbus-nand", "mbus",
399 0x804, BIT(5), 0);
400 static SUNXI_CCU_GATE(mbus_csi_clk, "mbus-csi", "mbus",
401 0x804, BIT(8), 0);
402 static SUNXI_CCU_GATE(mbus_isp_clk, "mbus-isp", "mbus",
403 0x804, BIT(9), 0);
404 static SUNXI_CCU_GATE(mbus_g2d_clk, "mbus-g2d", "mbus",
405 0x804, BIT(10), 0);
407 static SUNXI_CCU_GATE(bus_dram_clk, "bus-dram", "psi-ahb1-ahb2",
408 0x80c, BIT(0), CLK_IS_CRITICAL);
411 "pll-periph0",
412 "pll-periph1",
413 "pll-periph0-2x",
414 "pll-periph1-2x" };
418 24, 3, /* mux */
419 BIT(31), /* gate */
425 24, 3, /* mux */
426 BIT(31), /* gate */
429 static SUNXI_CCU_GATE(bus_nand_clk, "bus-nand", "ahb3", 0x82c, BIT(0), 0);
431 static const char * const mmc_parents[] = { "dcxo24M", "pll-periph0-2x",
432 "pll-periph1-2x" };
436 24, 2, /* mux */
437 BIT(31), /* gate */
438 2, /* post-div */
444 24, 2, /* mux */
445 BIT(31), /* gate */
446 2, /* post-div */
452 24, 2, /* mux */
453 BIT(31), /* gate */
454 2, /* post-div */
457 static SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb3", 0x84c, BIT(0), 0);
458 static SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb3", 0x84c, BIT(1), 0);
459 static SUNXI_CCU_GATE(bus_mmc2_clk, "bus-mmc2", "ahb3", 0x84c, BIT(2), 0);
461 static SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2", 0x90c, BIT(0), 0);
462 static SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2", 0x90c, BIT(1), 0);
463 static SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb2", 0x90c, BIT(2), 0);
464 static SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb2", 0x90c, BIT(3), 0);
465 static SUNXI_CCU_GATE(bus_uart4_clk, "bus-uart4", "apb2", 0x90c, BIT(4), 0);
467 static SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2", 0x91c, BIT(0), 0);
468 static SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2", 0x91c, BIT(1), 0);
469 static SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb2", 0x91c, BIT(2), 0);
470 static SUNXI_CCU_GATE(bus_i2c3_clk, "bus-i2c3", "apb2", 0x91c, BIT(3), 0);
475 24, 3, /* mux */
476 BIT(31), /* gate */
482 24, 3, /* mux */
483 BIT(31), /* gate */
489 24, 3, /* mux */
490 BIT(31), /* gate */
493 static SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb3", 0x96c, BIT(0), 0);
494 static SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb3", 0x96c, BIT(1), 0);
495 static SUNXI_CCU_GATE(bus_spi2_clk, "bus-spi2", "ahb3", 0x96c, BIT(2), 0);
497 static SUNXI_CCU_GATE(emac_25m_clk, "emac-25m", "ahb3", 0x970,
498 BIT(31) | BIT(30), 0);
500 static SUNXI_CCU_GATE(bus_emac_clk, "bus-emac", "ahb3", 0x97c, BIT(0), 0);
503 "pll-periph0", "pll-periph1" };
504 static SUNXI_CCU_MP_WITH_MUX_GATE(ir_rx_clk, "ir-rx", ir_parents, 0x990,
507 24, 3, /* mux */
508 BIT(31), /* gate */
511 static SUNXI_CCU_GATE(bus_ir_rx_clk, "bus-ir-rx", "ahb3", 0x99c, BIT(0), 0);
513 static SUNXI_CCU_MP_WITH_MUX_GATE(ir_tx_clk, "ir-tx", ir_parents, 0x9c0,
516 24, 3, /* mux */
517 BIT(31), /* gate */
520 static SUNXI_CCU_GATE(bus_ir_tx_clk, "bus-ir-tx", "apb1", 0x9cc, BIT(0), 0);
522 static SUNXI_CCU_GATE(bus_gpadc_clk, "bus-gpadc", "apb1", 0x9ec, BIT(0), 0);
524 static SUNXI_CCU_GATE(bus_ths_clk, "bus-ths", "apb1", 0x9fc, BIT(0), 0);
526 static const char * const audio_parents[] = { "pll-audio", "pll-com-audio" };
528 .enable = BIT(31),
530 .mux = _SUNXI_CCU_MUX(24, 2),
541 .enable = BIT(31),
543 .mux = _SUNXI_CCU_MUX(24, 2),
554 .enable = BIT(31),
556 .mux = _SUNXI_CCU_MUX(24, 2),
567 .enable = BIT(31),
569 .mux = _SUNXI_CCU_MUX(24, 2),
579 static SUNXI_CCU_GATE(bus_i2s0_clk, "bus-i2s0", "apb1", 0xa20, BIT(0), 0);
580 static SUNXI_CCU_GATE(bus_i2s1_clk, "bus-i2s1", "apb1", 0xa20, BIT(1), 0);
581 static SUNXI_CCU_GATE(bus_i2s2_clk, "bus-i2s2", "apb1", 0xa20, BIT(2), 0);
582 static SUNXI_CCU_GATE(bus_i2s3_clk, "bus-i2s3", "apb1", 0xa20, BIT(3), 0);
585 .enable = BIT(31),
587 .mux = _SUNXI_CCU_MUX(24, 2),
597 static SUNXI_CCU_GATE(bus_spdif_clk, "bus-spdif", "apb1", 0xa2c, BIT(0), 0);
600 .enable = BIT(31),
602 .mux = _SUNXI_CCU_MUX(24, 2),
612 static SUNXI_CCU_GATE(bus_dmic_clk, "bus-dmic", "apb1", 0xa4c, BIT(0), 0);
614 static SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_dac_clk, "audio-codec-dac",
617 24, 2, /* mux */
618 BIT(31), /* gate */
621 static SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_adc_clk, "audio-codec-adc",
624 24, 2, /* mux */
625 BIT(31), /* gate */
628 static SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_4x_clk, "audio-codec-4x",
631 24, 2, /* mux */
632 BIT(31), /* gate */
635 static SUNXI_CCU_GATE(bus_audio_codec_clk, "bus-audio-codec", "apb1", 0xa5c,
636 BIT(0), 0);
645 static SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc12M", 0xa70, BIT(31), 0);
646 static SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "dcxo24M", 0xa70, BIT(29), 0);
648 static SUNXI_CCU_GATE(usb_ohci1_clk, "usb-ohci1", "osc12M", 0xa74, BIT(31), 0);
649 static SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "dcxo24M", 0xa74, BIT(29), 0);
651 static SUNXI_CCU_GATE(bus_ohci0_clk, "bus-ohci0", "ahb3", 0xa8c, BIT(0), 0);
652 static SUNXI_CCU_GATE(bus_ohci1_clk, "bus-ohci1", "ahb3", 0xa8c, BIT(1), 0);
653 static SUNXI_CCU_GATE(bus_ehci0_clk, "bus-ehci0", "ahb3", 0xa8c, BIT(4), 0);
654 static SUNXI_CCU_GATE(bus_ehci1_clk, "bus-ehci1", "ahb3", 0xa8c, BIT(5), 0);
655 static SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb3", 0xa8c, BIT(8), 0);
657 static SUNXI_CCU_GATE(bus_lradc_clk, "bus-lradc", "ahb3", 0xa9c, BIT(0), 0);
659 static SUNXI_CCU_GATE(bus_dpss_top0_clk, "bus-dpss-top0", "ahb3",
660 0xabc, BIT(0), 0);
662 static SUNXI_CCU_GATE(bus_dpss_top1_clk, "bus-dpss-top1", "ahb3",
663 0xacc, BIT(0), 0);
665 static const char * const mipi_dsi_parents[] = { "dcxo24M", "pll-periph0-2x",
666 "pll-periph0" };
667 static SUNXI_CCU_M_WITH_MUX_GATE(mipi_dsi_clk, "mipi-dsi",
671 24, 2, /* mux */
672 BIT(31), /* gate */
675 static SUNXI_CCU_GATE(bus_mipi_dsi_clk, "bus-mipi-dsi", "ahb3",
676 0xb4c, BIT(0), 0);
678 static const char * const tcon_lcd_parents[] = { "pll-video0-4x",
679 "pll-video1-4x",
680 "pll-video2-4x",
681 "pll-video3-4x",
682 "pll-periph0-2x" };
683 static SUNXI_CCU_MP_WITH_MUX_GATE(tcon_lcd_clk, "tcon-lcd0",
687 24, 3, /* mux */
688 BIT(31), /* gate */
691 static SUNXI_CCU_GATE(bus_tcon_lcd_clk, "bus-tcon-lcd0", "ahb3",
692 0xb7c, BIT(0), 0);
695 "pll-periph0" };
700 24, 3, /* mux */
701 BIT(31), /* gate */
704 static SUNXI_CCU_GATE(bus_ledc_clk, "bus-ledc", "ahb3", 0xbfc, BIT(0), 0);
706 static const char * const csi_top_parents[] = { "pll-periph0-2x",
707 "pll-video0-2x",
708 "pll-video1-2x",
709 "pll-video2-2x",
710 "pll-video3-2x" };
711 static SUNXI_CCU_M_WITH_MUX_GATE(csi_top_clk, "csi-top",
714 24, 3, /* mux */
715 BIT(31), /* gate */
718 static const char * const csi0_mclk_parents[] = { "dcxo24M", "pll-video2",
719 "pll-video3", "pll-video0",
720 "pll-video1" };
721 static SUNXI_CCU_M_WITH_MUX_GATE(csi0_mclk_clk, "csi0-mclk",
724 24, 3, /* mux */
725 BIT(31), /* gate */
728 static const char * const csi1_mclk_parents[] = { "dcxo24M", "pll-video3",
729 "pll-video0", "pll-video1",
730 "pll-video2" };
731 static SUNXI_CCU_M_WITH_MUX_GATE(csi1_mclk_clk, "csi1-mclk",
734 24, 3, /* mux */
735 BIT(31), /* gate */
738 static SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb3", 0xc1c, BIT(0), 0);
740 static const char * const csi_isp_parents[] = { "pll-periph0-2x",
741 "pll-video0-2x",
742 "pll-video1-2x",
743 "pll-video2-2x",
744 "pll-video3-2x" };
745 static SUNXI_CCU_M_WITH_MUX_GATE(csi_isp_clk, "csi-isp",
748 24, 3, /* mux */
749 BIT(31), /* gate */
755 static CLK_FIXED_FACTOR_HW(pll_com_audio_clk, "pll-com-audio",
759 static CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x",
763 static CLK_FIXED_FACTOR_HW(pll_periph1_2x_clk, "pll-periph1-2x",
770 static CLK_FIXED_FACTOR_HWS(pll_video0_4x_clk, "pll-video0-4x",
773 static CLK_FIXED_FACTOR_HWS(pll_video0_2x_clk, "pll-video0-2x",
780 static CLK_FIXED_FACTOR_HWS(pll_video1_4x_clk, "pll-video1-4x",
783 static CLK_FIXED_FACTOR_HWS(pll_video1_2x_clk, "pll-video1-2x",
790 static CLK_FIXED_FACTOR_HWS(pll_video2_4x_clk, "pll-video2-4x",
793 static CLK_FIXED_FACTOR_HWS(pll_video2_2x_clk, "pll-video2-2x",
800 static CLK_FIXED_FACTOR_HWS(pll_video3_4x_clk, "pll-video3-4x",
803 static CLK_FIXED_FACTOR_HWS(pll_video3_2x_clk, "pll-video3-2x",
1065 [RST_MBUS] = { 0x540, BIT(30) },
1067 [RST_BUS_DE] = { 0x60c, BIT(16) },
1068 [RST_BUS_G2D] = { 0x63c, BIT(16) },
1069 [RST_BUS_GPU] = { 0x67c, BIT(16) },
1070 [RST_BUS_CE] = { 0x68c, BIT(16) },
1071 [RST_BUS_VE] = { 0x69c, BIT(16) },
1072 [RST_BUS_DMA] = { 0x70c, BIT(16) },
1073 [RST_BUS_MSGBOX] = { 0x71c, BIT(16) },
1074 [RST_BUS_SPINLOCK] = { 0x72c, BIT(16) },
1075 [RST_BUS_HSTIMER] = { 0x73c, BIT(16) },
1076 [RST_BUS_DBG] = { 0x78c, BIT(16) },
1077 [RST_BUS_PSI] = { 0x79c, BIT(16) },
1078 [RST_BUS_PWM] = { 0x7ac, BIT(16) },
1079 [RST_BUS_DRAM] = { 0x80c, BIT(16) },
1080 [RST_BUS_NAND] = { 0x82c, BIT(16) },
1081 [RST_BUS_MMC0] = { 0x84c, BIT(16) },
1082 [RST_BUS_MMC1] = { 0x84c, BIT(17) },
1083 [RST_BUS_MMC2] = { 0x84c, BIT(18) },
1084 [RST_BUS_UART0] = { 0x90c, BIT(16) },
1085 [RST_BUS_UART1] = { 0x90c, BIT(17) },
1086 [RST_BUS_UART2] = { 0x90c, BIT(18) },
1087 [RST_BUS_UART3] = { 0x90c, BIT(19) },
1088 [RST_BUS_UART4] = { 0x90c, BIT(20) },
1089 [RST_BUS_I2C0] = { 0x91c, BIT(16) },
1090 [RST_BUS_I2C1] = { 0x91c, BIT(17) },
1091 [RST_BUS_I2C2] = { 0x91c, BIT(18) },
1092 [RST_BUS_I2C3] = { 0x91c, BIT(19) },
1093 [RST_BUS_SPI0] = { 0x96c, BIT(16) },
1094 [RST_BUS_SPI1] = { 0x96c, BIT(17) },
1095 [RST_BUS_SPI2] = { 0x96c, BIT(18) },
1096 [RST_BUS_EMAC] = { 0x97c, BIT(16) },
1097 [RST_BUS_IR_RX] = { 0x99c, BIT(16) },
1098 [RST_BUS_IR_TX] = { 0x9cc, BIT(16) },
1099 [RST_BUS_GPADC] = { 0x9ec, BIT(16) },
1100 [RST_BUS_THS] = { 0x9fc, BIT(16) },
1101 [RST_BUS_I2S0] = { 0xa20, BIT(16) },
1102 [RST_BUS_I2S1] = { 0xa20, BIT(17) },
1103 [RST_BUS_I2S2] = { 0xa20, BIT(18) },
1104 [RST_BUS_I2S3] = { 0xa20, BIT(19) },
1105 [RST_BUS_SPDIF] = { 0xa2c, BIT(16) },
1106 [RST_BUS_DMIC] = { 0xa4c, BIT(16) },
1107 [RST_BUS_AUDIO_CODEC] = { 0xa5c, BIT(16) },
1109 [RST_USB_PHY0] = { 0xa70, BIT(30) },
1110 [RST_USB_PHY1] = { 0xa74, BIT(30) },
1112 [RST_BUS_OHCI0] = { 0xa8c, BIT(16) },
1113 [RST_BUS_OHCI1] = { 0xa8c, BIT(17) },
1114 [RST_BUS_EHCI0] = { 0xa8c, BIT(20) },
1115 [RST_BUS_EHCI1] = { 0xa8c, BIT(21) },
1116 [RST_BUS_OTG] = { 0xa8c, BIT(24) },
1118 [RST_BUS_LRADC] = { 0xa9c, BIT(16) },
1119 [RST_BUS_DPSS_TOP0] = { 0xabc, BIT(16) },
1120 [RST_BUS_DPSS_TOP1] = { 0xacc, BIT(16) },
1121 [RST_BUS_MIPI_DSI] = { 0xb4c, BIT(16) },
1122 [RST_BUS_TCON_LCD] = { 0xb7c, BIT(16) },
1123 [RST_BUS_LVDS] = { 0xbac, BIT(16) },
1124 [RST_BUS_LEDC] = { 0xbfc, BIT(16) },
1125 [RST_BUS_CSI] = { 0xc1c, BIT(16) },
1126 [RST_BUS_CSI_ISP] = { 0xc2c, BIT(16) },
1169 .enable = BIT(27),
1170 .lock = BIT(28),
1219 * See the comment before pll-video0 definition for the reason. in sun50i_a100_ccu_probe()
1223 val &= ~BIT(0); in sun50i_a100_ccu_probe()
1230 * See the comment before pll-audio definition for the reason. in sun50i_a100_ccu_probe()
1233 val &= ~BIT(1); in sun50i_a100_ccu_probe()
1234 val |= BIT(0); in sun50i_a100_ccu_probe()
1245 val &= ~GENMASK(25, 24); in sun50i_a100_ccu_probe()
1249 ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_a100_ccu_desc); in sun50i_a100_ccu_probe()
1264 { .compatible = "allwinner,sun50i-a100-ccu" },
1271 .name = "sun50i-a100-ccu",