This commit is contained in:
刘可亮
2024-06-04 19:00:30 +08:00
parent 990c72f5be
commit 0a13af6a1d
1668 changed files with 342810 additions and 37726 deletions

View File

@@ -380,7 +380,7 @@ config AIC_TSEN_DRV_VER
config AIC_TSEN_CH_NUM
int
default 1 if AIC_TSEN_DRV_V20
default 2 if AIC_TSEN_DRV_V20
#--------------------------------------------
# GPAI driver global option

Binary file not shown.

View File

@@ -11,64 +11,66 @@
extern "C" {
#endif
/* Fixed rate clock */
#define CLK_DUMMY 0
#define CLK_OSC24M 1
#define CLK_OSC32K 2
/* PLL clock */
#define CLK_PLL_INT0 3
#define CLK_PLL_INT1 4
#define CLK_PLL_FRA0 5
#define CLK_PLL_FRA2 6
/* fixed factor clock */
#define CLK_AXI_AHB_SRC1 7
#define CLK_APB0_SRC1 8
#define CLK_CPU_SRC1 9
/* system clock */
#define CLK_AXI0 10
#define CLK_AHB0 11
#define CLK_APB0 12
#define CLK_APB1 13
#define CLK_CPU 14
/* Peripheral clock */
#define CLK_WDT 15
#define CLK_DMA 16
#define CLK_DCE 17
#define CLK_XSPI 22
#define CLK_QSPI0 23
#define CLK_QSPI1 24
#define CLK_SDMC0 27
#define CLK_SDMC1 28
#define CLK_SYSCFG 30
#define CLK_SPIENC 31
#define CLK_MTOP 32
#define CLK_AUDIO_SCLK 33
#define CLK_CODEC 34
#define CLK_GPIO 35
#define CLK_UART0 36
#define CLK_UART1 37
#define CLK_UART2 38
#define CLK_UART3 39
#define CLK_RGB 44
#define CLK_DE 48
#define CLK_GE 49
#define CLK_VE 50
#define CLK_SID 51
#define CLK_GTC 53
#define CLK_I2C0 54
#define CLK_I2C1 55
#define CLK_CAN0 57
#define CLK_CAN1 58
#define CLK_PWM 59
#define CLK_ADCIM 60
#define CLK_GPAI 61
#define CLK_RTP 62
#define CLK_TSEN 63
#define CLK_CIR 65
/* Display clock */
#define CLK_PIX 66
#define CLK_SCLK 67
#define AIC_CLK_END 68
enum clk_id {
/* Fixed rate clock */
CLK_DUMMY,
CLK_OSC24M,
CLK_OSC32K,
/* PLL clock */
CLK_PLL_INT0,
CLK_PLL_INT1,
CLK_PLL_FRA0,
CLK_PLL_FRA2,
/* fixed factor clock */
CLK_AXI_AHB_SRC1,
CLK_APB0_SRC1,
CLK_CPU_SRC1,
/* system clock */
CLK_AXI0,
CLK_AHB0,
CLK_APB0,
CLK_APB1,
CLK_CPU,
/* Peripheral clock */
CLK_DMA,
CLK_DCE,
CLK_XSPI,
CLK_QSPI0,
CLK_QSPI1,
CLK_SDMC0,
CLK_SDMC1,
CLK_SYSCFG,
CLK_SPIENC,
CLK_AUDIO_SCLK,
CLK_CODEC,
CLK_RGB,
CLK_DE,
CLK_GE,
CLK_VE,
CLK_WDT,
CLK_SID,
CLK_GTC,
CLK_GPIO,
CLK_UART0,
CLK_UART1,
CLK_UART2,
CLK_UART3,
CLK_I2C0,
CLK_I2C1,
CLK_CAN0,
CLK_CAN1,
CLK_PWM,
CLK_ADCIM,
CLK_GPAI,
CLK_RTP,
CLK_TSEN,
CLK_CIR,
CLK_MTOP,
/* Display clock */
CLK_PIX,
CLK_SCLK,
AIC_CLK_NUM,
};
/* frequence */

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co.,Ltd
* Author: Xiong Hao <hao.xiong@artinchip.com>
*/
#ifndef __RAM_PARAM_H__
#define __RAM_PARAM_H__
u32 aic_get_ram_size(void);
#endif /* __RAM_PARAM_H__ */

View File

@@ -0,0 +1,90 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co.,Ltd
* Author: Xiong Hao <hao.xiong@artinchip.com>
*/
#include <stdio.h>
#include <aic_core.h>
#include <aic_common.h>
#include <ram_param.h>
#define PSRAM_SINGLE 0
#define PSRAM_PARALLEL 1
enum PSRAM_FUSE_ID {
APS3208K = 0x00,
SCKW18_12816O = 0x01,
APS12816O = 0x02,
};
struct _psram_id {
u8 psram_fuse_id;
u32 psram_chip_id;
};
struct _psram_info {
u8 mark_id;
u8 psram_num;
u32 psram_size;
struct _psram_id psram_id;
};
#define PSRAM_TABLE_INFO \
{ \
/* default 8M */ \
{0x00, PSRAM_PARALLEL, 0x800000, {APS3208K, 0x80c980c9}}, \
/* D122BAV 4M */ \
{0x01, PSRAM_SINGLE, 0x400000, {APS3208K, 0x80c980c9}}, \
/* D122BBV 8M */ \
{0x02, PSRAM_PARALLEL, 0x800000, {APS3208K, 0x80c980c9}}, \
/* D121BAV 4M */ \
{0x03, PSRAM_SINGLE, 0x400000, {APS3208K, 0x80c980c9}}, \
/* D121BBV 8M */ \
{0x04, PSRAM_PARALLEL, 0x800000, {APS3208K, 0x80c980c9}}, \
}
struct _psram_info psram_table_info[] = PSRAM_TABLE_INFO;
u8 psram_get_mark_id(void)
{
u32 fuse_218 = readl(0x19010218);
u8 mark_id = fuse_218 & 0xff;
pr_info("fuse_218(0x19010218)=0x%x, mark_id=0x%x\n", fuse_218, mark_id);
return mark_id;
}
u8 psram_get_psram_id(void)
{
u32 fuse_21c = readl(0x1901021c);
u8 psram_id = (fuse_21c & 0xff) >> 4;
pr_info("fuse_21c(0x1901021c)=0x%x, psram_id=0x%x\n", fuse_21c, psram_id);
return psram_id;
}
struct _psram_info *psram_get_info(u8 mark_id, u8 psram_fuse_id)
{
u32 len = ARRAY_SIZE(psram_table_info);
for (int i = 0; i < len; i++) {
if (((mark_id == psram_table_info[i].mark_id) &&
(psram_fuse_id == psram_table_info[i].psram_id.psram_fuse_id))) {
return &psram_table_info[i];
}
}
pr_info("can't get the psram table, return the default info.\n");
return &psram_table_info[0]; //if not find anyone, return the default info.
}
u32 aic_get_ram_size(void)
{
struct _psram_info *psram_info;
u8 mark_id, psram_id;
mark_id = psram_get_mark_id();
psram_id = psram_get_psram_id();
psram_info = psram_get_info(mark_id, psram_id);
return psram_info->psram_size;
}