RK3128-android7.1-nt68661

1.首先了解一下6866这个芯片的功能是将HDMI转成LVDS

知道这一步,就要知道如何实现

 将 .bin 文件复制到ETC路径

 

然后加载.bin文件会在nt6866的驱动中下载到芯片内

\sdk\kernel\drivers\video\rockchip\hdmi\rockchip-hdmi-core.c

+    #ifdef CONFIG_NT68661
+	return ;
+	#endif

 \sdk\kernel\drivers\video\rockchip\hdmi\rockchip-hdmi-lcdc.c

+ #ifdef CONFIG_NT68661
+ struct rk_screen * rk_get_screen(void);
+ #endif


int hdmi_find_best_mode(struct hdmi *hdmi, int vic)
{
	struct list_head *pos, *head = &hdmi->edid.modelist;
	struct display_modelist *modelist = NULL;
	int found = 0;
+ #if CONFIG_NT68661
+	struct rk_screen *screen=NULL;
+	
+
+	  screen=rk_get_screen();
+
+      printk("x=%d y=%d \n",screen->mode.xres,screen->mode.yres);
+
+	printk("screen->face=%d screen->lvds_format=%d \n",screen->face,screen->lvds_format); 
+	
+	if(screen->mode.xres==1920&&screen->mode.yres==1080) return HDMI_1920X1080P_60HZ;
+	else if(screen->mode.xres==1366&&screen->mode.yres==768) return (HDMI_VIDEO_DMT | 6);
+	else if(screen->mode.xres==1280&&screen->mode.yres==1024) return (HDMI_VIDEO_DMT | 4);
+
+	return HDMI_1920X1080P_60HZ;// (HDMI_VIDEO_DMT | 4);
+ #else

 

 

// sdk\kernel\drivers\char\nt68661.c

#include <linux/delay.h>

#include <linux/slab.h>
#include <linux/gpio.h>
#include <linux/delay.h>


#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/fb.h>
#include <linux/rk_fb.h>



typedef unsigned char              Bit;
typedef unsigned char              Bool;

typedef unsigned char   Byte;
typedef unsigned short  Word;
typedef unsigned long	ULong;

#define LOG_TAG "nt68661"


#if 1 //def GSL_DEBUG 
#define debug(fmt, x...) printk("%s: %s() line: %d "fmt, LOG_TAG, __FUNCTION__, __LINE__, ##x);

#else
#define print_info(fmt, args...)
#endif


#define BIT0	0x01
#define BIT1	0x02
#define BIT2	0x04
#define BIT3	0x08
#define BIT4	0x10
#define BIT5	0x20
#define BIT6	0x40
#define BIT7	0x80

#define TARGET0 BIT7



#define NACK 1
#define ACK 0
#define FAIL 0
#define OK 1
#define EMPTY 2


typedef union{
	unsigned long l;
	Byte b[4];
}Union4;

typedef union{
	Word w;
	Byte b[2];	//0:H, 1:L
}Union2;

#define VERSION 17
#define OSC_CLK 12000000//unit Mhz
#define LOW_MCU_CLK OSC_CLK*1
#define MID_MCU_CLK OSC_CLK*3
#define HI_MCU_CLK OSC_CLK*8
#define LOW_SPEED 1
#define MID_SPEED 3
#define HI_SPEED 8

// FE2P mode
#define NORMAL_MODE 0
#define FE2P_MODE 1
#define DIRECT_FE2P_MODE 2



#define true 1
#define false 0
//   En   Name              Id     Pg CPUCLK IICSPD SpcCmd  NewProg Umb  Fe2p  60k  CoP   ExtFlash

typedef struct{
	Byte En;
	Byte Name[15];
	Word Id;
	Word page;
	Byte CpuClk;
	Byte IICSpeed;
	Byte SpcCmd;
	Byte NewProg;
	Byte Umb;
	Byte Fe2p;
	Byte s60k;
	Byte coP;
	Byte ExtFlash;
}MCU_DEF;

	
typedef struct{
	Byte En;
	Byte ID1;
	Byte ID2;
	Byte ID3;
	Byte FE2P;
	Byte ByteWrite;
	Byte SE_Code;
	Byte CE_Code;
	Word Page;
	Byte SE_Time;
	Word CE_Time;
	Byte Name[23];
}FLASH_DEF;

extern const Byte  McuRegTab[];
extern const FLASH_DEF  FlashIDTable[];
extern const MCU_DEF  McuTypeTable[];

#define _tNOVATEK 		0
#define _tFE2P			1
#define _tBLOCK_SAVE	2
#define _tENTER_ISP		3
#define _tCHIP_ERASE	4
#define _tBLCOK_ERASE	5
#define _tPROGRAM		6
#define _tEXIT_ISP		7
#define _tSOURCE_ISP	8
#define _tTARGET_FAIL	9
#define _tPROGRAM_START	10
#define _tPROGRAM_END	11
#define _tCHECK_SUM		12
#define _tFLASH_NAME	13
#define _tSOURCE_READ	14
#define _tFE2P_SUM		15

#define _tPASS			3
#define _tFAIL			4
#define _tON			1
#define _tOFF			2
#define _tFAIL_CH		5
#define _tCHECKSUM		6
#define _tFE2PSUM		7





#define comChipErase	0x1E
#define comBlockErase	0x2D    //new NT68631A
#define comWritePage24M	0x3C
#define comGetPage	    0x4B
#define comWriteOne	    0x5A
#define comGetDirect	0x69
#define comSetRegSRAM	0x78
#define comGetRegSRAM	0x87
#define comGetIntRAM	0x96
#define comGetPageNew   0x4A    //new NT68670&NT68631A
#define comGetCheckSum  0x36    //new NT68670&NT68631A
#define comSetExtendAddr 0x0f   //new NT68670
#define comGetVersion   0x11    //new NT68670&NT68631A
#define comMultiFunc    0x99
#define comSPICmd       0x53


extern Byte pFail;		//For Message process	
extern FLASH_DEF Flash;		//Flash Information
extern Byte McuGear;		//MCY clock ratio
extern Word Timer;			//System Timer
extern Word MaxPages;		//Max programming pages
extern Byte Fe2pMode;		// For FE2P Mode
extern Word DirFE2P_Offset;
Byte MultiID;
extern Word SPageSum;		//Source Page checksum
extern Byte  Buffer[512];
extern Word McuId;
extern Bit ErrorFlag;
Word usSPICmdBufAddr;
Byte ucSPI_BackUpBuf[7] = {0};

extern ULong WpDefine;
extern Byte Wp_PortE;
extern Byte Wp_PortF;
extern ULong Wp_PortG_J;
extern ULong Wp_PortK_M;

#if 1
#define SDA_PIN 7
#define SCL_PIN 6

#else
#define SDA_PIN 84
#define SCL_PIN 85

#endif
#define SET_SCL_H gpio_set_value(SCL_PIN,1)
#define SET_SCL_L   gpio_set_value(SCL_PIN,0)

#define SET_SDA_H gpio_set_value(SDA_PIN,1)
#define SET_SDA_L  gpio_set_value(SDA_PIN,0)

#define GET_SDA()  gpio_get_value(SDA_PIN)
#define GET_SCL()  gpio_get_value(SCL_PIN)

#define SET_SDA_INPUT gpio_direction_input(SDA_PIN)

#define SET_SCL_INPUT gpio_direction_input(SCL_PIN)


#define SET_SDA_OUTPUT {gpio_direction_output(SDA_PIN,1);SET_SDA_H;}

#define SET_SCL_OUTPUT gpio_direction_output(SCL_PIN,1)




Byte pFail;	//For Message process	
Byte McuGear;		//MCU clock ratio
Byte Bypass;		//ByPass Compare
Word Timer;			//System Timer
Word MaxPages;		//Max Flash pages
Word CodePages;     // f/w programming pages
Word FlashOffset;   // start page of Flash
Word SPageSum;		//Source Page checksum
Word McuId;
Byte Fe2pMode;		// For FE2P Mode
Word DirFE2P_Offset;
Word DirFE2P_Length;

#define TOTAL_PAGE_SIZE 200
Byte  BinFilePageBuffer[512] ;// 1024pages for 4M flash
FLASH_DEF Flash;
Bit ErrorFlag;

// please define the WP here(according bit set 1)
ULong WpDefine=0x02000000;
Byte Wp_PortE;
Byte Wp_PortF;
ULong Wp_PortG_J;
ULong Wp_PortK_M;

// Dual F/W
Bit DualFwEnable;



extern void Sleep(Word T);
extern void Sdelay(void);
extern void PulseDelay();

extern void T_CheckIIC(void);
extern void T_IIC_Start(void);
extern void T_IIC_Stop(void);
extern Byte T_IIC_Tx(Byte Data);
extern unsigned char T_IIC_Rx(Bit Ack);
extern void T_WaitSCL(void);
extern void T_HandShake(Word Timeout);
extern void T_ISPMode(Bit On);
extern void T_ISPStatusReply();
extern Byte T_GetPageData(Byte PageNo);
extern Byte T_ChipErase(void);
extern Byte T_ChipEraseReply(void);
extern Byte T_WritePagedata(Byte Pg);
extern void T_WritePageDataReply(void);
extern void T_SetRegSRAM(Byte AddrH,Byte AddrL,Byte Data);
extern void T_SetRegSRAMReply();
extern Byte T_GetCheckSum(Byte PageNo);
extern Byte T_GetCheckSumReply(void);
extern Bit T_GetMcuInformation(Word id);
extern Byte T_BlockErase(Byte From,Byte To);
extern Byte T_BlockEraseReply();
extern Byte T_SpiCommand(Byte *Data,Byte WLen,Byte RLen);
extern void T_GetVersion(void);
extern void T_GetRegSRAM(Byte AddrH,Byte AddrL);
extern unsigned long T_GetRegSRAMReply(void);
extern void Cmd_T_EnterIsp(void);
extern void Cmd_T_Erase(void);
extern void Cmd_T_Program(Byte Pg);
extern void Cmd_T_GetCheckSum(Byte Pg);
extern void Cmd_T_BlockErase();
extern Byte Cmd_T_SetExntend(Word Pg);
extern void Cmd_T_SendSpecialCommand();
extern void Cmd_T_WP_Enable(void);
extern void Cmd_T_BlockProtect(Bit Wp);
extern Bool CheckOverLap(Word PageNo);
extern void Fn68390ProgramEnable(Bit En);
extern void WpEnable(void);
extern void FnEraseIDSector(void);
extern Bit FnUpdateIDSector(void);

void Cmd_T_GetFlashID();
extern Word DirFE2P_Length;
extern Bit DualFwEnable,ErrorFlag;
extern Byte SearchFlashID(Byte *mcuFlashID);
void Cmd_T_BlockProtect0(void);



const MCU_DEF  McuTypeTable[]={
//   En   Name              Id     Pg CPUCLK IICSPD 	SpcCmd  NewProg Umb  Fe2p  60k  CoP   ExtFlash
    {true,"NT68360        ",        0xA536,256,0x50 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68169        ",        0xA569,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68661        ",        0xA561,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68850        ",        0xA585,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68770        ",        0xA577,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68655        ",        0xA555,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68150        ",        0xA515,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68370        ",        0xA537,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,true, true},
    {true,"NT68790        ",        0xA790,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68658        ",        0xA658,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68380        ",        0xA380,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,true, true},
    {true,"NT68390        ",        0xA390,256,0x40 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,true, true},
    {true,"NT68810        ",        0xA810,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68870        ",        0xA870,256,0x30 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
    {true,"NT68400        ",        0xA400,256,0x40 ,HI_SPEED  ,0x02   ,true ,true, true, false,false,true},
    {true,"NT68450        ",        0xA450,256,0x40 ,HI_SPEED  ,0x02   ,true ,true ,true ,false,false,true},
};


const FLASH_DEF  FlashIDTable[]={
//   En    ID1  ID2  ID3  FE2P  BYTE  SE   CE  PAGE SE_T CE_T  NAME
    {true ,0x55,0xaa,0x00,false,false,0xd7,0xc7,256 ,0   ,100 ,"Embeded/Unknown Flash "},
    {true ,0x9d,0x7f,0x7c,true ,false,0xd7,0xc7,256 ,70  ,100 ,"PMC Pm25LV010A 128KB "},
    {true ,0x9d,0x7f,0x7d,true ,false,0xd7,0xc7,512 ,70  ,100 ,"PMC Pm25LV020A 256KB "},
    {true ,0x9d,0x7f,0x7e,true ,false,0xd7,0xc7,1024,300  ,3000 ,"PMC Pm25LV040A 512KB "}, // modify SE_T, CE_T to be compatible with Pm25LQ040B because their flash ID are the same.
    {true ,0x9d,0x7f,0x10,true ,false,0xd7,0xc7,256 ,70  ,100 ,"PMC_Pm25LD010C 128KB "},
    {true ,0x9d,0x7f,0x11,true ,false,0xd7,0xc7,512 ,70  ,100 ,"PMC_Pm25LD020C 256KB "},
    {true ,0x9d,0x7f,0x12,true ,false,0xd7,0xc7,1024,70  ,100 ,"PMC_Pm25LD040C 512KB "},
    {true ,0x9d,0x40,0x11,true ,false,0xd7,0xc7,256,300  ,1500 ,"ISSI IS25LQ010B   1MB"},
    {true ,0x9d,0x60,0x14,true ,false,0xd7,0xc7,2048,300  ,6000 ,"ISSI IS25LP080D   1MB"},
    {true ,0xc2,0x20,0x11,true ,false,0x20,0xc7,256 ,120 ,2000,"MXIC MX25L1005 128K  "},
    {true ,0xc2,0x20,0x12,true ,false,0x20,0xc7,512 ,120 ,3000,"M
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

旋风旋风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值