Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 1 | #ifndef DDK750_CHIP_H__ |
| 2 | #define DDK750_CHIP_H__ |
| 3 | #define DEFAULT_INPUT_CLOCK 14318181 /* Default reference clock */ |
Sudip Mukherjee | 62fa8e1 | 2015-03-10 14:15:37 +0530 | [diff] [blame] | 4 | #ifndef SM750LE_REVISION_ID |
| 5 | #define SM750LE_REVISION_ID ((unsigned char)0xfe) |
| 6 | #endif |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 7 | |
Lorenzo Stoakes | f8b0dce | 2015-03-10 15:25:47 +0000 | [diff] [blame] | 8 | #include <linux/io.h> |
| 9 | |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 10 | /* This is all the chips recognized by this library */ |
Juston Li | 259fef3 | 2015-07-14 21:14:45 -0700 | [diff] [blame] | 11 | typedef enum _logical_chip_type_t { |
Isaac Assegai | 63de0eb | 2015-05-24 22:48:42 -0700 | [diff] [blame] | 12 | SM_UNKNOWN, |
| 13 | SM718, |
| 14 | SM750, |
| 15 | SM750LE, |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 16 | } |
| 17 | logical_chip_type_t; |
| 18 | |
Juston Li | 259fef3 | 2015-07-14 21:14:45 -0700 | [diff] [blame] | 19 | typedef enum _clock_type_t { |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 20 | MXCLK_PLL, |
| 21 | PRIMARY_PLL, |
| 22 | SECONDARY_PLL, |
| 23 | VGA0_PLL, |
| 24 | VGA1_PLL, |
| 25 | } |
| 26 | clock_type_t; |
| 27 | |
Juston Li | 259fef3 | 2015-07-14 21:14:45 -0700 | [diff] [blame] | 28 | typedef struct _pll_value_t { |
Isaac Assegai | 63de0eb | 2015-05-24 22:48:42 -0700 | [diff] [blame] | 29 | clock_type_t clockType; |
| 30 | unsigned long inputFreq; /* Input clock frequency to the PLL */ |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 31 | |
Isaac Assegai | 63de0eb | 2015-05-24 22:48:42 -0700 | [diff] [blame] | 32 | /* Use this when clockType = PANEL_PLL */ |
| 33 | unsigned long M; |
| 34 | unsigned long N; |
| 35 | unsigned long OD; |
| 36 | unsigned long POD; |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 37 | } |
| 38 | pll_value_t; |
| 39 | |
| 40 | /* input struct to initChipParam() function */ |
Juston Li | 259fef3 | 2015-07-14 21:14:45 -0700 | [diff] [blame] | 41 | typedef struct _initchip_param_t { |
Isaac Assegai | 63de0eb | 2015-05-24 22:48:42 -0700 | [diff] [blame] | 42 | unsigned short powerMode; /* Use power mode 0 or 1 */ |
| 43 | unsigned short chipClock; /** |
| 44 | * 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; /** |
| 49 | * Speed of memory clock in MHz unit |
| 50 | * 0 = keep the current clock setting |
| 51 | * Others = the new memory clock |
| 52 | */ |
| 53 | unsigned short masterClock; /** |
| 54 | * Speed of master clock in MHz unit |
| 55 | * 0 = keep the current clock setting |
| 56 | * Others = the new master clock |
| 57 | */ |
| 58 | unsigned short setAllEngOff; /** |
| 59 | * 0 = leave all engine state untouched. |
| 60 | * 1 = make sure they are off: 2D, Overlay, |
| 61 | * video alpha, alpha, hardware cursors |
| 62 | */ |
| 63 | unsigned char resetMemory; /** |
| 64 | * 0 = Do not reset the memory controller |
| 65 | * 1 = Reset the memory controller |
| 66 | */ |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 67 | |
Isaac Assegai | 63de0eb | 2015-05-24 22:48:42 -0700 | [diff] [blame] | 68 | /* More initialization parameter can be added if needed */ |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 69 | } |
| 70 | initchip_param_t; |
| 71 | |
Moshe Green | 06a4f42 | 2016-09-25 22:58:35 +0300 | [diff] [blame] | 72 | logical_chip_type_t sm750_get_chip_type(void); |
Isaac Assegai | 555a6b1 | 2015-06-02 03:14:24 -0700 | [diff] [blame] | 73 | unsigned int calcPllValue(unsigned int request, pll_value_t *pll); |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 74 | unsigned int formatPllReg(pll_value_t *pPLL); |
Isaac Assegai | 555a6b1 | 2015-06-02 03:14:24 -0700 | [diff] [blame] | 75 | void ddk750_set_mmio(void __iomem *, unsigned short, char); |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 76 | unsigned int ddk750_getVMSize(void); |
| 77 | int ddk750_initHw(initchip_param_t *); |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 78 | |
Sudip Mukherjee | 81dee67 | 2015-03-03 16:21:06 +0530 | [diff] [blame] | 79 | #endif |