mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-18 02:38:56 +00:00
0f9b10aaba
This patch implements enable_adc1_clk() to enable or disable the ADC1 clock on i.MX8ULP. Reviewed-by: Ye Li <ye.li@nxp.com> Signed-off-by: Alice Guo <alice.guo@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
205 lines
4.9 KiB
C
205 lines
4.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* Copyright 2021 NXP
|
|
*/
|
|
|
|
#ifndef _ASM_ARCH_IMX8ULP_PCC_H
|
|
#define _ASM_ARCH_IMX8ULP_PCC_H
|
|
|
|
#include <asm/arch/cgc.h>
|
|
|
|
enum pcc1_entry {
|
|
ADC1_PCC1_SLOT = 34,
|
|
};
|
|
|
|
enum pcc3_entry {
|
|
DMA1_MP_PCC3_SLOT = 1,
|
|
DMA1_CH0_PCC3_SLOT = 2,
|
|
DMA1_CH1_PCC3_SLOT = 3,
|
|
DMA1_CH2_PCC3_SLOT = 4,
|
|
DMA1_CH3_PCC3_SLOT = 5,
|
|
DMA1_CH4_PCC3_SLOT = 6,
|
|
DMA1_CH5_PCC3_SLOT = 7,
|
|
DMA1_CH6_PCC3_SLOT = 8,
|
|
DMA1_CH7_PCC3_SLOT = 9,
|
|
DMA1_CH8_PCC3_SLOT = 10,
|
|
DMA1_CH9_PCC3_SLOT = 11,
|
|
DMA1_CH10_PCC3_SLOT = 12,
|
|
DMA1_CH11_PCC3_SLOT = 13,
|
|
DMA1_CH12_PCC3_SLOT = 14,
|
|
DMA1_CH13_PCC3_SLOT = 15,
|
|
DMA1_CH14_PCC3_SLOT = 16,
|
|
DMA1_CH15_PCC3_SLOT = 17,
|
|
DMA1_CH16_PCC3_SLOT = 18,
|
|
DMA1_CH17_PCC3_SLOT = 19,
|
|
DMA1_CH18_PCC3_SLOT = 20,
|
|
DMA1_CH19_PCC3_SLOT = 21,
|
|
DMA1_CH20_PCC3_SLOT = 22,
|
|
DMA1_CH21_P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
|
DMA2_CH24_PCC5_SLOT = 25,
|
|
DMA2_CH25_PCC5_SLOT = 26,
|
|
DMA2_CH26_PCC5_SLOT = 27,
|
|
DMA2_CH27_PCC5_SLOT = 28,
|
|
DMA2_CH28_PCC5_SLOT = 29,
|
|
DMA2_CH29_PCC5_SLOT = 30,
|
|
DMA2_CH30_PCC5_SLOT = 31,
|
|
DMA2_CH31_PCC5_SLOT = 32,
|
|
MU2_B_PCC5_SLOT = 33,
|
|
MU3_B_PCC5_SLOT = 34,
|
|
SEMA42_2_PCC5_SLOT = 35,
|
|
CMC2_PCC5_SLOT = 36,
|
|
AVD_SIM_PCC5_SLOT = 37,
|
|
LPAV_CGC_PCC5_SLOT = 38,
|
|
PCC5_PCC5_SLOT = 39,
|
|
TPM8_PCC5_SLOT = 40,
|
|
SAI6_PCC5_SLOT = 41,
|
|
SAI7_PCC5_SLOT = 42,
|
|
SPDIF_PCC5_SLOT = 43,
|
|
ISI_PCC5_SLOT = 44,
|
|
CSI_REGS_PCC5_SLOT = 45,
|
|
CSI_PCC5_SLOT = 47,
|
|
DSI_PCC5_SLOT = 48,
|
|
WDOG5_PCC5_SLOT = 50,
|
|
EPDC_PCC5_SLOT = 51,
|
|
PXP_PCC5_SLOT = 52,
|
|
SFA2_PCC5_SLOT = 53,
|
|
GPU2D_PCC5_SLOT = 60,
|
|
GPU3D_PCC5_SLOT = 61,
|
|
DCNANO_PCC5_SLOT = 62,
|
|
LPDDR4_PCC5_SLOT = 66,
|
|
CSI_CLK_UI_PCC5_SLOT = 67,
|
|
CSI_CLK_ESC_PCC5_SLOT = 68,
|
|
RGPIOD_PCC5_SLOT = 69,
|
|
};
|
|
|
|
/* PCC registers */
|
|
#define PCC_PR_OFFSET 31
|
|
#define PCC_PR_MASK (0x1 << PCC_PR_OFFSET)
|
|
#define PCC_CGC_OFFSET 30
|
|
#define PCC_CGC_MASK (0x1 << PCC_CGC_OFFSET)
|
|
#define PCC_INUSE_OFFSET 29
|
|
#define PCC_INUSE_MASK (0x1 << PCC_INUSE_OFFSET)
|
|
#define PCC_PCS_OFFSET 24
|
|
#define PCC_PCS_MASK (0x7 << PCC_PCS_OFFSET)
|
|
#define PCC_FRAC_OFFSET 3
|
|
#define PCC_FRAC_MASK (0x1 << PCC_FRAC_OFFSET)
|
|
#define PCC_PCD_OFFSET 0
|
|
#define PCC_PCD_MASK (0x7 << PCC_PCD_OFFSET)
|
|
|
|
enum pcc_clksrc_type {
|
|
CLKSRC_PER_PLAT = 0,
|
|
CLKSRC_PER_BUS = 1,
|
|
CLKSRC_NO_PCS = 2,
|
|
};
|
|
|
|
enum pcc_div_type {
|
|
PCC_HAS_DIV,
|
|
PCC_NO_DIV,
|
|
};
|
|
|
|
enum pcc_rst_b {
|
|
PCC_HAS_RST_B,
|
|
PCC_NO_RST_B,
|
|
};
|
|
|
|
/* This structure keeps info for each pcc slot */
|
|
struct pcc_entry {
|
|
u32 pcc_base;
|
|
u32 pcc_slot;
|
|
enum pcc_clksrc_type clksrc;
|
|
enum pcc_div_type div;
|
|
enum pcc_rst_b rst_b;
|
|
};
|
|
|
|
int pcc_clock_enable(int pcc_controller, int pcc_clk_slot, bool enable);
|
|
int pcc_clock_sel(int pcc_controller, int pcc_clk_slot, enum cgc_clk src);
|
|
int pcc_clock_div_config(int pcc_controller, int pcc_clk_slot, bool frac, u8 div);
|
|
bool pcc_clock_is_enable(int pcc_controller, int pcc_clk_slot);
|
|
int pcc_clock_get_clksrc(int pcc_controller, int pcc_clk_slot, enum cgc_clk *src);
|
|
int pcc_reset_peripheral(int pcc_controller, int pcc_clk_slot, bool reset);
|
|
u32 pcc_clock_get_rate(int pcc_controller, int pcc_clk_slot);
|
|
#endif
|