1 #ifndef DDK750_CHIP_H__
2 #define DDK750_CHIP_H__
3 #define DEFAULT_INPUT_CLOCK 14318181 /* Default reference clock */
4 #define SM750LE_REVISION_ID (char)0xfe
5 
6 /* This is all the chips recognized by this library */
7 typedef enum _logical_chip_type_t
8 {
9     SM_UNKNOWN,
10     SM718,
11     SM750,
12     SM750LE,
13 }
14 logical_chip_type_t;
15 
16 
17 typedef enum _clock_type_t
18 {
19 	MXCLK_PLL,
20 	PRIMARY_PLL,
21 	SECONDARY_PLL,
22 	VGA0_PLL,
23 	VGA1_PLL,
24 }
25 clock_type_t;
26 
27 typedef struct _pll_value_t
28 {
29     clock_type_t clockType;
30     unsigned long inputFreq; /* Input clock frequency to the PLL */
31 
32     /* Use this when clockType = PANEL_PLL */
33     unsigned long M;
34     unsigned long N;
35     unsigned long OD;
36     unsigned long POD;
37 }
38 pll_value_t;
39 
40 /* input struct to initChipParam() function */
41 typedef struct _initchip_param_t
42 {
43     unsigned short powerMode;    /* Use power mode 0 or 1 */
44     unsigned short chipClock;    /* Speed of main chip clock in MHz unit
45                                     0 = keep the current clock setting
46                                     Others = the new main chip clock
47                                   */
48     unsigned short memClock;     /* Speed of memory clock in MHz unit
49                                     0 = keep the current clock setting
50                                     Others = the new memory clock
51                                   */
52     unsigned short masterClock;  /* Speed of master clock in MHz unit
53                                     0 = keep the current clock setting
54                                     Others = the new master clock
55                                   */
56     unsigned short setAllEngOff; /* 0 = leave all engine state untouched.
57                                     1 = make sure they are off: 2D, Overlay,
58                                     video alpha, alpha, hardware cursors
59                                  */
60     unsigned char resetMemory;   /* 0 = Do not reset the memory controller
61                                     1 = Reset the memory controller
62                                   */
63 
64     /* More initialization parameter can be added if needed */
65 }
66 initchip_param_t;
67 
68 
69 logical_chip_type_t getChipType(void);
70 unsigned int calcPllValue(unsigned int request,pll_value_t *pll);
71 unsigned int calcPllValue2(unsigned int,pll_value_t *);
72 unsigned int formatPllReg(pll_value_t *pPLL);
73 void ddk750_set_mmio(volatile unsigned char *,unsigned short,char);
74 unsigned int ddk750_getVMSize(void);
75 int ddk750_initHw(initchip_param_t *);
76 unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL);
77 unsigned int getChipClock(void);
78 void setChipClock(unsigned int);
79 void setMemoryClock(unsigned int frequency);
80 void setMasterClock(unsigned int frequency);
81 
82 
83 #endif
84