1f29dbc25Smrg/* Copyright (c) 2005 Advanced Micro Devices, Inc. 2f29dbc25Smrg * 3f29dbc25Smrg * Permission is hereby granted, free of charge, to any person obtaining a copy 4f29dbc25Smrg * of this software and associated documentation files (the "Software"), to 5f29dbc25Smrg * deal in the Software without restriction, including without limitation the 6f29dbc25Smrg * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7f29dbc25Smrg * sell copies of the Software, and to permit persons to whom the Software is 8f29dbc25Smrg * furnished to do so, subject to the following conditions: 9f29dbc25Smrg * 10f29dbc25Smrg * The above copyright notice and this permission notice shall be included in 11f29dbc25Smrg * all copies or substantial portions of the Software. 12f29dbc25Smrg * 13f29dbc25Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14f29dbc25Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15f29dbc25Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16f29dbc25Smrg * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17f29dbc25Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18f29dbc25Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19f29dbc25Smrg * IN THE SOFTWARE. 20f29dbc25Smrg * 21f29dbc25Smrg * Neither the name of the Advanced Micro Devices, Inc. nor the names of its 22f29dbc25Smrg * contributors may be used to endorse or promote products derived from this 23f29dbc25Smrg * software without specific prior written permission. 24f29dbc25Smrg * */ 25f29dbc25Smrg 26f29dbc25Smrg/* 27f29dbc25Smrg * File Contents: This file contains the panel functions to interface 28f29dbc25Smrg * the dorado platform. 29f29dbc25Smrg * 30f29dbc25Smrg * SubModule: Geode FlatPanel library 31f29dbc25Smrg * */ 32f29dbc25Smrg 33f29dbc25Smrg#include "dora9211.h" 34f29dbc25Smrg 35f29dbc25Smrgvoid 36f29dbc25SmrgDorado_Get_9211_Details(unsigned long flags, Pnl_PanelParams * pParam) 37f29dbc25Smrg{ 38f29dbc25Smrg unsigned long DPanelType; 39f29dbc25Smrg int i; 40f29dbc25Smrg 41f29dbc25Smrg for (i = 0; i < 0x7fff; i++) { 42f29dbc25Smrg } 43f29dbc25Smrg 44f29dbc25Smrg Dorado9211GpioInit(); 45f29dbc25Smrg 46f29dbc25Smrg for (i = 0; i < 5; i++) 47f29dbc25Smrg toggle_Centaurus_9211_clock(); 48f29dbc25Smrg 49f29dbc25Smrg if (flags & PNL_PANELCHIP) { 50f29dbc25Smrg DPanelType = Dorado9211ReadReg(0x430); 51f29dbc25Smrg 52f29dbc25Smrg if ((DPanelType & 0xFFFF0000) == 0x92110000) { /* found 9211 */ 53f29dbc25Smrg /* check the values for revision ID */ 54f29dbc25Smrg if (DPanelType >= 0x92110301) 55f29dbc25Smrg pParam->PanelChip = PNL_9211_C; 56f29dbc25Smrg else if ((DPanelType >= 0x92110101) && (DPanelType < 0x92110301)) 57f29dbc25Smrg pParam->PanelChip = PNL_9211_A; 58f29dbc25Smrg else 59f29dbc25Smrg pParam->PanelChip = PNL_UNKNOWN_CHIP; 6004007ebaSmrg } 6104007ebaSmrg else { /* no 9211 present */ 62f29dbc25Smrg pParam->PanelChip = PNL_UNKNOWN_CHIP; 63f29dbc25Smrg } 64f29dbc25Smrg } 65f29dbc25Smrg 66f29dbc25Smrg if ((pParam->PanelChip != PNL_UNKNOWN_CHIP) && (flags & PNL_PANELSTAT)) { 67f29dbc25Smrg unsigned long PanelTypeOrg; 68f29dbc25Smrg unsigned char Panel_2Byte; 69f29dbc25Smrg 70f29dbc25Smrg DPanelType = Dorado9211ReadReg(0x438); 71f29dbc25Smrg DPanelType &= 0x00e8e8e8; 72f29dbc25Smrg DPanelType |= 0x00170000; 73f29dbc25Smrg Dorado9211WriteReg(0x438, DPanelType); 74f29dbc25Smrg DPanelType = 0; 75f29dbc25Smrg 76f29dbc25Smrg DPanelType = Dorado9211ReadReg(0x434); 77f29dbc25Smrg DPanelType = (DPanelType >> (DRD_LCDRESGPIO1 + 1)); 78f29dbc25Smrg PanelTypeOrg = DPanelType >> 8; 7904007ebaSmrg Panel_2Byte = (unsigned char) PanelTypeOrg; 8004007ebaSmrg Panel_2Byte = (Panel_2Byte >> (DRD_LCDRESGPIO2 - DRD_LCDRESGPIO1 - 1)); 8104007ebaSmrg DPanelType = (DPanelType | ((unsigned int) Panel_2Byte << 8)); 82f29dbc25Smrg DPanelType = DPanelType >> 1; 83f29dbc25Smrg PanelTypeOrg = DPanelType >> 8; 8404007ebaSmrg Panel_2Byte = (unsigned char) PanelTypeOrg; 8504007ebaSmrg Panel_2Byte = (Panel_2Byte >> (DRD_LCDRESGPIO3 - DRD_LCDRESGPIO2 - 1)); 8604007ebaSmrg DPanelType = (DPanelType | ((unsigned int) Panel_2Byte << 8)); 87f29dbc25Smrg DPanelType = DPanelType >> 1; 88f29dbc25Smrg PanelTypeOrg = DPanelType >> 8; 8904007ebaSmrg Panel_2Byte = (unsigned char) PanelTypeOrg; 9004007ebaSmrg Panel_2Byte = (Panel_2Byte >> (DRD_LCDRESGPIO4 - DRD_LCDRESGPIO3 - 1)); 9104007ebaSmrg DPanelType = (DPanelType | ((unsigned int) Panel_2Byte << 8)); 92f29dbc25Smrg DPanelType = DPanelType >> 5; 93f29dbc25Smrg DPanelType &= 0xf; 94f29dbc25Smrg 95f29dbc25Smrg switch (DPanelType) { 96f29dbc25Smrg case 8: 97f29dbc25Smrg pParam->PanelStat.XRes = 800; 98f29dbc25Smrg pParam->PanelStat.YRes = 600; 99f29dbc25Smrg pParam->PanelStat.Depth = 18; 100f29dbc25Smrg pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; 101f29dbc25Smrg pParam->PanelStat.Type = PNL_TFT; 102f29dbc25Smrg break; 103f29dbc25Smrg 104f29dbc25Smrg case 9: 105f29dbc25Smrg pParam->PanelStat.XRes = 640; 106f29dbc25Smrg pParam->PanelStat.YRes = 480; 107f29dbc25Smrg pParam->PanelStat.Depth = 8; 108f29dbc25Smrg pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; 109f29dbc25Smrg pParam->PanelStat.Type = PNL_SSTN; 110f29dbc25Smrg break; 111f29dbc25Smrg 112f29dbc25Smrg case 10: 113f29dbc25Smrg pParam->PanelStat.XRes = 1024; 114f29dbc25Smrg pParam->PanelStat.YRes = 768; 115f29dbc25Smrg pParam->PanelStat.Depth = 18; 116f29dbc25Smrg pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; 117f29dbc25Smrg pParam->PanelStat.Type = PNL_TFT; 118f29dbc25Smrg break; 119f29dbc25Smrg case 0: 120f29dbc25Smrg case 1: 121f29dbc25Smrg case 2: 122f29dbc25Smrg case 3: 123f29dbc25Smrg case 4: 124f29dbc25Smrg case 5: 125f29dbc25Smrg case 6: 126f29dbc25Smrg case 7: 127f29dbc25Smrg case 11: 128f29dbc25Smrg pParam->PanelStat.XRes = 640; 129f29dbc25Smrg pParam->PanelStat.YRes = 480; 130f29dbc25Smrg pParam->PanelStat.Depth = 16; 131f29dbc25Smrg pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; 132f29dbc25Smrg pParam->PanelStat.Type = PNL_DSTN; 133f29dbc25Smrg break; 134f29dbc25Smrg case 12: 135f29dbc25Smrg pParam->PanelStat.XRes = 640; 136f29dbc25Smrg pParam->PanelStat.YRes = 480; 137f29dbc25Smrg pParam->PanelStat.Depth = 18; 138f29dbc25Smrg pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; 139f29dbc25Smrg pParam->PanelStat.Type = PNL_TFT; 140f29dbc25Smrg break; 141f29dbc25Smrg case 13: 142f29dbc25Smrg pParam->PanelStat.XRes = 1024; 143f29dbc25Smrg pParam->PanelStat.YRes = 768; 144f29dbc25Smrg pParam->PanelStat.Depth = 24; 145f29dbc25Smrg pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; 146f29dbc25Smrg pParam->PanelStat.Type = PNL_DSTN; 147f29dbc25Smrg break; 148f29dbc25Smrg case 14: 149f29dbc25Smrg pParam->PanelStat.XRes = 640; 150f29dbc25Smrg pParam->PanelStat.YRes = 480; 151f29dbc25Smrg pParam->PanelStat.Depth = 8; 152f29dbc25Smrg pParam->PanelStat.MonoColor = PNL_MONO_PANEL; 153f29dbc25Smrg pParam->PanelStat.Type = PNL_DSTN; 154f29dbc25Smrg break; 155f29dbc25Smrg case 15: 156f29dbc25Smrg pParam->PanelStat.XRes = 800; 157f29dbc25Smrg pParam->PanelStat.YRes = 600; 158f29dbc25Smrg pParam->PanelStat.Depth = 16; 159f29dbc25Smrg pParam->PanelStat.MonoColor = PNL_COLOR_PANEL; 160f29dbc25Smrg pParam->PanelStat.Type = PNL_DSTN; 161f29dbc25Smrg break; 162f29dbc25Smrg default: 163f29dbc25Smrg break; 164f29dbc25Smrg } 165f29dbc25Smrg } 166f29dbc25Smrg /* if block end */ 167f29dbc25Smrg} 168f29dbc25Smrg 169f29dbc25Smrgvoid 170f29dbc25SmrgDorado9211Init(Pnl_PanelStat * pstat) 171f29dbc25Smrg{ 172f29dbc25Smrg int mode; 173f29dbc25Smrg unsigned long orig_value, pm_value; 174f29dbc25Smrg 175f29dbc25Smrg gfx_delay_milliseconds(100); 176f29dbc25Smrg Dorado9211GpioInit(); 177f29dbc25Smrg 178f29dbc25Smrg Dorado9211ToggleClock(); 179f29dbc25Smrg Dorado9211ToggleClock(); 180f29dbc25Smrg Dorado9211ToggleClock(); 181f29dbc25Smrg Dorado9211ToggleClock(); 182f29dbc25Smrg Dorado9211ToggleClock(); 183f29dbc25Smrg 184f29dbc25Smrg gfx_delay_milliseconds(100); 185f29dbc25Smrg 186f29dbc25Smrg Dorado9211ToggleClock(); 187f29dbc25Smrg Dorado9211ToggleClock(); 188f29dbc25Smrg Dorado9211ToggleClock(); 189f29dbc25Smrg Dorado9211ToggleClock(); 190f29dbc25Smrg Dorado9211ToggleClock(); 191f29dbc25Smrg 192f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, 0x0); 193f29dbc25Smrg 194f29dbc25Smrg gfx_delay_milliseconds(100); 195f29dbc25Smrg gfx_delay_milliseconds(100); 196f29dbc25Smrg 197f29dbc25Smrg /* LOOP THROUGH THE AVAILABLE MODES TO FIND A MATCH */ 198f29dbc25Smrg for (mode = 0; mode < NUM_92XX_MODES; mode++) { 199f29dbc25Smrg if ((FPModeParams[mode].xres == pstat->XRes) && 200f29dbc25Smrg (FPModeParams[mode].yres == pstat->YRes) && 201f29dbc25Smrg (FPModeParams[mode].bpp == pstat->Depth) && 202f29dbc25Smrg (FPModeParams[mode].panel_type == pstat->Type) && 203f29dbc25Smrg (FPModeParams[mode].color_type == pstat->MonoColor)) { 204f29dbc25Smrg 205f29dbc25Smrg /* SET THE 92xx FOR THE SELECTED MODE */ 206f29dbc25Smrg CS92xx_MODE *pMode = &FPModeParams[mode]; 207f29dbc25Smrg 208f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING1, pMode->panel_timing1); 209f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING2, pMode->panel_timing2); 210f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_DITH_FR_CNTRL, 21104007ebaSmrg pMode->rev_C_dither_frc); 212f29dbc25Smrg Dorado9211WriteReg(CS92xx_BLUE_LSFR_SEED, pMode->blue_lsfr_seed); 213f29dbc25Smrg Dorado9211WriteReg(CS92xx_RED_GREEN_LSFR_SEED, 21404007ebaSmrg pMode->red_green_lsfr_seed); 215f29dbc25Smrg DoradoProgramFRMload(); 216f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_MEM_CNTRL, pMode->memory_control); 217f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, pMode->power_management); 218f29dbc25Smrg gfx_delay_milliseconds(100); 219f29dbc25Smrg gfx_delay_milliseconds(100); 220f29dbc25Smrg Dorado9211ClearCS(); 221f29dbc25Smrg 222f29dbc25Smrg /* This code is added to take care of Panel initialization. 223f29dbc25Smrg * Irrespective of Xpressrom is enabling the panel or not. 224f29dbc25Smrg */ 225f29dbc25Smrg orig_value = READ_VID32(0X04); 226f29dbc25Smrg WRITE_VID32(0x04, 0x00200141); 227f29dbc25Smrg gfx_delay_milliseconds(21); 228f29dbc25Smrg pm_value = gfx_ind(0x9030); 229f29dbc25Smrg 230f29dbc25Smrg pm_value |= 0x400; 231f29dbc25Smrg gfx_outd(0x9030, pm_value); 232f29dbc25Smrg gfx_delay_milliseconds(4); 233f29dbc25Smrg orig_value &= 0xfff1ffff; 234f29dbc25Smrg WRITE_VID32(0X4, orig_value); 235f29dbc25Smrg return; 23604007ebaSmrg } /*end if() */ 23704007ebaSmrg } /*end for() */ 238f29dbc25Smrg 239f29dbc25Smrg} 240f29dbc25Smrg 241f29dbc25Smrgvoid 242f29dbc25SmrgDorado9211SetCS(void) 243f29dbc25Smrg{ 244f29dbc25Smrg unsigned long value; 245f29dbc25Smrg 246f29dbc25Smrg value = gfx_ind(DRD_CSP9211IN); 247f29dbc25Smrg gfx_outd(DRD_CSP9211OUT, value | DRD_CS9211); 248f29dbc25Smrg} 249f29dbc25Smrg 250f29dbc25Smrgvoid 251f29dbc25SmrgDorado9211ClearCS(void) 252f29dbc25Smrg{ 253f29dbc25Smrg unsigned long value; 254f29dbc25Smrg 255f29dbc25Smrg value = gfx_ind(DRD_CSP9211IN); 256f29dbc25Smrg gfx_outd(DRD_CSP9211OUT, value & (~DRD_CS9211)); 257f29dbc25Smrg} 258f29dbc25Smrg 259f29dbc25Smrgvoid 260f29dbc25SmrgDorado9211SetDataOut(void) 261f29dbc25Smrg{ 262f29dbc25Smrg unsigned long value; 263f29dbc25Smrg 264f29dbc25Smrg value = gfx_ind(DRD_DATAOUTP9211IN); 265f29dbc25Smrg gfx_outd(DRD_DATAOUTP9211OUT, value | DRD_DATAIN9211); 266f29dbc25Smrg} 267f29dbc25Smrg 268f29dbc25Smrgvoid 269f29dbc25SmrgDorado9211ClearDataOut(void) 270f29dbc25Smrg{ 271f29dbc25Smrg unsigned long value; 272f29dbc25Smrg 273f29dbc25Smrg value = gfx_ind(DRD_DATAOUTP9211IN); 274f29dbc25Smrg gfx_outd(DRD_DATAOUTP9211OUT, value & (~DRD_DATAIN9211)); 275f29dbc25Smrg} 276f29dbc25Smrg 277f29dbc25Smrgunsigned char 278f29dbc25SmrgDorado9211ReadDataIn(void) 279f29dbc25Smrg{ 280f29dbc25Smrg unsigned char readdata = 0; 281f29dbc25Smrg unsigned long value; 282f29dbc25Smrg 283f29dbc25Smrg /* why to read 4 times ??? */ 284f29dbc25Smrg value = gfx_ind(DRD_DATAINP9211IN); 285f29dbc25Smrg value = gfx_ind(DRD_DATAINP9211IN); 286f29dbc25Smrg value = gfx_ind(DRD_DATAINP9211IN); 287f29dbc25Smrg value = gfx_ind(DRD_DATAINP9211IN); 288f29dbc25Smrg if (value & DRD_DATAOUT9211) 289f29dbc25Smrg readdata = 1; 290f29dbc25Smrg return (readdata); 291f29dbc25Smrg} 292f29dbc25Smrg 293f29dbc25Smrgvoid 294f29dbc25SmrgDorado9211ToggleClock(void) 295f29dbc25Smrg{ 296f29dbc25Smrg Dorado9211SetClock(); 297f29dbc25Smrg Dorado9211ClearClock(); 298f29dbc25Smrg} 299f29dbc25Smrg 300f29dbc25Smrgvoid 301f29dbc25SmrgDorado9211SetClock(void) 302f29dbc25Smrg{ 303f29dbc25Smrg unsigned long value; 304f29dbc25Smrg 305f29dbc25Smrg value = gfx_ind(DRD_CLOCKP9211IN); 306f29dbc25Smrg gfx_outd(DRD_CLOCKP9211OUT, value | DRD_CLOCK9211); 307f29dbc25Smrg} 308f29dbc25Smrg 309f29dbc25Smrgvoid 310f29dbc25SmrgDorado9211ClearClock(void) 311f29dbc25Smrg{ 312f29dbc25Smrg unsigned long value; 313f29dbc25Smrg 314f29dbc25Smrg value = gfx_ind(DRD_CLOCKP9211IN); 315f29dbc25Smrg gfx_outd(DRD_CLOCKP9211OUT, value & (~DRD_CLOCK9211)); 316f29dbc25Smrg} 317f29dbc25Smrg 318f29dbc25Smrgvoid 319f29dbc25SmrgDorado9211GpioInit(void) 320f29dbc25Smrg{ 321f29dbc25Smrg unsigned long value; 322f29dbc25Smrg 323f29dbc25Smrg /* set output enable on gpio 7, 9, 11 */ 324f29dbc25Smrg gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_CLOCK9211CFG); 325f29dbc25Smrg gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 3); 326f29dbc25Smrg /* set output enable on gpio 7, 9, 11 */ 327f29dbc25Smrg gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_CS9211CFG); 328f29dbc25Smrg gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 3); 329f29dbc25Smrg /* set output enable on gpio 7, 9, 18 */ 330f29dbc25Smrg gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_DATAIN9211CFG); 331f29dbc25Smrg gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 3); 332f29dbc25Smrg /* disable on gpio 11 - This is the output from the 9211 */ 333f29dbc25Smrg gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_SEL), DRD_DATAOUT9211CFG); 334f29dbc25Smrg gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPPIN_CFG), 0); 335f29dbc25Smrg /* Set all PINS low */ 336f29dbc25Smrg value = gfx_ind(DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDI0); 337f29dbc25Smrg value &= ~(DRD_CS9211 | DRD_CLOCK9211 | DRD_DATAIN9211); 338f29dbc25Smrg gfx_outd((DRD_GEODE_GPIO_BASE + DRD_GEODE_GPDO0), value); 339f29dbc25Smrg} 340f29dbc25Smrg 341f29dbc25Smrgunsigned long 342f29dbc25SmrgDorado9211ReadReg(unsigned short index) 343f29dbc25Smrg{ 344f29dbc25Smrg 345f29dbc25Smrg unsigned char i, readbit; 346f29dbc25Smrg unsigned long data; 347f29dbc25Smrg 348f29dbc25Smrg Dorado9211ClearDataOut(); 349f29dbc25Smrg 350f29dbc25Smrg Dorado9211SetCS(); 351f29dbc25Smrg Dorado9211ToggleClock(); 352f29dbc25Smrg 353f29dbc25Smrg Dorado9211SetDataOut(); 354f29dbc25Smrg Dorado9211ToggleClock(); 355f29dbc25Smrg 356f29dbc25Smrg for (i = 0; i < 12; i++) { 357f29dbc25Smrg if (index & 0x1) { 358f29dbc25Smrg Dorado9211SetDataOut(); 35904007ebaSmrg } 36004007ebaSmrg else { 361f29dbc25Smrg Dorado9211ClearDataOut(); 362f29dbc25Smrg } 363f29dbc25Smrg Dorado9211ToggleClock(); 364f29dbc25Smrg index >>= 1; 365f29dbc25Smrg } 366f29dbc25Smrg 367f29dbc25Smrg Dorado9211ClearDataOut(); 368f29dbc25Smrg Dorado9211ToggleClock(); 369f29dbc25Smrg 370f29dbc25Smrg /* Idle clock, 7 clocks, no data set */ 371f29dbc25Smrg 372f29dbc25Smrg Dorado9211ToggleClock(); 373f29dbc25Smrg Dorado9211ToggleClock(); 374f29dbc25Smrg Dorado9211ToggleClock(); 375f29dbc25Smrg Dorado9211ToggleClock(); 376f29dbc25Smrg Dorado9211ToggleClock(); 377f29dbc25Smrg Dorado9211ToggleClock(); 378f29dbc25Smrg Dorado9211ToggleClock(); 379f29dbc25Smrg 380f29dbc25Smrg data = 0; 381f29dbc25Smrg for (i = 0; i < 32; i++) { 382f29dbc25Smrg Dorado9211ToggleClock(); 383f29dbc25Smrg readbit = Dorado9211ReadDataIn(); 38404007ebaSmrg data |= (((unsigned long) readbit) << i); 385f29dbc25Smrg } 386f29dbc25Smrg 387f29dbc25Smrg Dorado9211ClearCS(); 388f29dbc25Smrg Dorado9211ToggleClock(); 389f29dbc25Smrg return (data); 390f29dbc25Smrg 391f29dbc25Smrg} 392f29dbc25Smrg 393f29dbc25Smrgvoid 394f29dbc25SmrgDorado9211WriteReg(unsigned short index, unsigned long data) 395f29dbc25Smrg{ 396f29dbc25Smrg 397f29dbc25Smrg unsigned char i; 398f29dbc25Smrg 399f29dbc25Smrg Dorado9211ClearDataOut(); 400f29dbc25Smrg Dorado9211SetDataOut(); 401f29dbc25Smrg Dorado9211SetCS(); 402f29dbc25Smrg Dorado9211ToggleClock(); 403f29dbc25Smrg Dorado9211SetDataOut(); 404f29dbc25Smrg Dorado9211ToggleClock(); 405f29dbc25Smrg 406f29dbc25Smrg for (i = 0; i < 12; i++) { 407f29dbc25Smrg if (index & 0x1) { 408f29dbc25Smrg Dorado9211SetDataOut(); 40904007ebaSmrg } 41004007ebaSmrg else { 411f29dbc25Smrg Dorado9211ClearDataOut(); 412f29dbc25Smrg } 413f29dbc25Smrg Dorado9211ToggleClock(); 414f29dbc25Smrg index >>= 1; 415f29dbc25Smrg } 416f29dbc25Smrg 417f29dbc25Smrg Dorado9211SetDataOut(); 418f29dbc25Smrg Dorado9211ToggleClock(); 419f29dbc25Smrg 420f29dbc25Smrg for (i = 0; i < 32; i++) { 421f29dbc25Smrg if (data & 0x1) { 422f29dbc25Smrg Dorado9211SetDataOut(); 42304007ebaSmrg } 42404007ebaSmrg else { 425f29dbc25Smrg Dorado9211ClearDataOut(); 426f29dbc25Smrg } 427f29dbc25Smrg Dorado9211ToggleClock(); 428f29dbc25Smrg data >>= 1; 429f29dbc25Smrg } 430f29dbc25Smrg 431f29dbc25Smrg Dorado9211ClearCS(); 432f29dbc25Smrg 433f29dbc25Smrg Dorado9211ToggleClock(); 434f29dbc25Smrg Dorado9211ToggleClock(); 435f29dbc25Smrg Dorado9211ToggleClock(); 436f29dbc25Smrg Dorado9211ToggleClock(); 437f29dbc25Smrg} 438f29dbc25Smrg 439f29dbc25Smrgvoid 440f29dbc25SmrgDoradoProgramFRMload(void) 441f29dbc25Smrg{ 442f29dbc25Smrg unsigned long DoradoFRMtable[] = { 443f29dbc25Smrg 444f29dbc25Smrg 0x00000000, 445f29dbc25Smrg 0x00000000, 446f29dbc25Smrg 0x01000100, 447f29dbc25Smrg 0x01000100, 448f29dbc25Smrg 0x01010101, 449f29dbc25Smrg 0x01010101, 450f29dbc25Smrg 0x02081041, 451f29dbc25Smrg 0x02081041, 452f29dbc25Smrg 0x10111111, 453f29dbc25Smrg 0x11111101, 454f29dbc25Smrg 0x49249241, 455f29dbc25Smrg 0x12412492, 456f29dbc25Smrg 0x92244891, 457f29dbc25Smrg 0x92244891, 458f29dbc25Smrg 0x22252525, 459f29dbc25Smrg 0x22252525, 460f29dbc25Smrg 0x528294a5, 461f29dbc25Smrg 0x2528494a, 462f29dbc25Smrg 0x294a5295, 463f29dbc25Smrg 0x294a5295, 464f29dbc25Smrg 0x54a54a95, 465f29dbc25Smrg 0x2952a52a, 466f29dbc25Smrg 0x2a552a55, 467f29dbc25Smrg 0x2a552a55, 468f29dbc25Smrg 0x554aa955, 469f29dbc25Smrg 0x2a9552aa, 470f29dbc25Smrg 0x2aaa5555, 471f29dbc25Smrg 0x2aaa5555, 472f29dbc25Smrg 0x55555555, 473f29dbc25Smrg 0x2aaaaaaa, 474f29dbc25Smrg 0x55555555, 475f29dbc25Smrg 0x55555555, 476f29dbc25Smrg 0xaaaaaaab, 477f29dbc25Smrg 0x55555555, 478f29dbc25Smrg 0x5555aaab, 479f29dbc25Smrg 0x5555aaab, 480f29dbc25Smrg 0xaab556ab, 481f29dbc25Smrg 0x556aad55, 482f29dbc25Smrg 0x55ab55ab, 483f29dbc25Smrg 0x55ab55ab, 484f29dbc25Smrg 0xab5ab56b, 485f29dbc25Smrg 0x56ad5ad5, 486f29dbc25Smrg 0x56b5ad6b, 487f29dbc25Smrg 0x56b5ad6b, 488f29dbc25Smrg 0xad6d6b5b, 489f29dbc25Smrg 0x5ad6b6b6, 490f29dbc25Smrg 0x5b5b5b5b, 491f29dbc25Smrg 0x5b5b5b5b, 492f29dbc25Smrg 0x5F6db6db, 493f29dbc25Smrg 0x5F6db6db, 494f29dbc25Smrg 0xF776F776, 495f29dbc25Smrg 0xF776F776, 496f29dbc25Smrg 0xFBDEFBDE, 497f29dbc25Smrg 0xFBDEFBDE, 498f29dbc25Smrg 0x7eFFBFF7, 499f29dbc25Smrg 0x7eFFBFF7, 500f29dbc25Smrg 0xFF7FF7F7, 501f29dbc25Smrg 0xFF7FF7F7, 502f29dbc25Smrg 0xFF7FFF7F, 503f29dbc25Smrg 0xFF7FFF7F, 504f29dbc25Smrg 0xFFF7FFFF, 505f29dbc25Smrg 0xFFF7FFFF, 506f29dbc25Smrg 0xFFFFFFFF, 507f29dbc25Smrg 0xFFFFFFFF, 508f29dbc25Smrg }; 509f29dbc25Smrg 510f29dbc25Smrg unsigned char i; 511f29dbc25Smrg unsigned short index; 512f29dbc25Smrg unsigned long data; 513f29dbc25Smrg 514f29dbc25Smrg Dorado9211WriteReg(CS92xx_FRM_MEMORY_INDEX, 0); 515f29dbc25Smrg index = CS92xx_FRM_MEMORY_DATA; 516f29dbc25Smrg for (i = 0; i < 64; i += 2) { 517f29dbc25Smrg data = DoradoFRMtable[i]; 518f29dbc25Smrg Dorado9211WriteReg(index, data); 519f29dbc25Smrg data = DoradoFRMtable[i + 1]; 520f29dbc25Smrg Dorado9211WriteReg(index, data); 521f29dbc25Smrg } 522f29dbc25Smrg 523f29dbc25Smrg/* 524f29dbc25Smrg * The first FRM location (64 bits) does not program correctly. 525f29dbc25Smrg * This location always reads back with the last value programmed. 526f29dbc25Smrg * ie. If 32 64-bit values are programmed, location 0 reads back as the 32nd 527f29dbc25Smrg * If 30 locations are programmed, location 0 reads back as the 30th, etc. 528f29dbc25Smrg * Fix this by re-writing location 0 after programming all 64 in the writeFRM 529f29dbc25Smrg * loop in RevCFrmload() in CS9211. 530f29dbc25Smrg */ 531f29dbc25Smrg 532f29dbc25Smrg Dorado9211WriteReg(CS92xx_FRM_MEMORY_INDEX, 0); 533f29dbc25Smrg Dorado9211WriteReg(CS92xx_FRM_MEMORY_DATA, 0); 534f29dbc25Smrg Dorado9211WriteReg(CS92xx_FRM_MEMORY_DATA, 0); 535f29dbc25Smrg 536f29dbc25Smrg} 537f29dbc25Smrg 538f29dbc25Smrg/***************************************************************************** 539f29dbc25Smrg * void Dorado_Enable_Power((void); 540f29dbc25Smrg * Enables the power of the CX9211 on Dorado board. 541f29dbc25Smrg ***************************************************************************** 542f29dbc25Smrg */ 543f29dbc25Smrg 544f29dbc25Smrgvoid 545f29dbc25SmrgDorado_Power_Up(void) 546f29dbc25Smrg{ 547f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, 0x01000000); 548f29dbc25Smrg return; 549f29dbc25Smrg 55004007ebaSmrg} /* disable_Centaurus_Power */ 551f29dbc25Smrg 552f29dbc25Smrg/***************************************************************************** 553f29dbc25Smrg * void Dorado_Disable_Power((void); 554f29dbc25Smrg * Disables the power of the CX9211 on Dorado board. 555f29dbc25Smrg ***************************************************************************** 556f29dbc25Smrg */ 557f29dbc25Smrg 558f29dbc25Smrgvoid 559f29dbc25SmrgDorado_Power_Down(void) 560f29dbc25Smrg{ 561f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, 0x0); 562f29dbc25Smrg return; 563f29dbc25Smrg 56404007ebaSmrg} /* disable_Centaurus_Power */ 565f29dbc25Smrg 566f29dbc25Smrgvoid 567f29dbc25SmrgDorado_Save_Panel_State(void) 568f29dbc25Smrg{ 569f29dbc25Smrg 570f29dbc25Smrg /* set 9211 registers using the desired panel settings */ 571f29dbc25Smrg cs9211_regs.panel_timing1 = Dorado9211ReadReg(CS92xx_LCD_PAN_TIMING1); 572f29dbc25Smrg cs9211_regs.panel_timing2 = Dorado9211ReadReg(CS92xx_LCD_PAN_TIMING2); 573f29dbc25Smrg 574f29dbc25Smrg cs9211_regs.dither_frc_ctrl = Dorado9211ReadReg(CS92xx_LCD_DITH_FR_CNTRL); 575f29dbc25Smrg cs9211_regs.blue_lsfr_seed = Dorado9211ReadReg(CS92xx_BLUE_LSFR_SEED); 576f29dbc25Smrg cs9211_regs.red_green_lsfr_seed = 577f29dbc25Smrg Dorado9211ReadReg(CS92xx_RED_GREEN_LSFR_SEED); 578f29dbc25Smrg 579f29dbc25Smrg /* CentaurusProgramFRMload(); */ 580f29dbc25Smrg cs9211_regs.memory_control = Dorado9211ReadReg(CS92xx_LCD_MEM_CNTRL); 581f29dbc25Smrg 582f29dbc25Smrg /* Set the power register last. This will turn the panel on at the 9211 */ 583f29dbc25Smrg cs9211_regs.power_management = Dorado9211ReadReg(CS92xx_LCD_PWR_MAN); 584f29dbc25Smrg cs9211_regs.panel_state = cs9211_regs.power_management; 585f29dbc25Smrg} 586f29dbc25Smrg 587f29dbc25Smrgvoid 588f29dbc25SmrgDorado_Restore_Panel_State(void) 589f29dbc25Smrg{ 590f29dbc25Smrg unsigned long off_data = 0; 591f29dbc25Smrg 592f29dbc25Smrg /* Before restoring the 9211 registers, power off the 9211. */ 593f29dbc25Smrg 594f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, off_data); 595f29dbc25Smrg 596f29dbc25Smrg /* set 9211 registers using the desired panel settings */ 597f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING1, cs9211_regs.panel_timing1); 598f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_PAN_TIMING2, cs9211_regs.panel_timing2); 599f29dbc25Smrg /* load the LSFR seeds */ 600f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_DITH_FR_CNTRL, cs9211_regs.dither_frc_ctrl); 601f29dbc25Smrg Dorado9211WriteReg(CS92xx_BLUE_LSFR_SEED, cs9211_regs.blue_lsfr_seed); 602f29dbc25Smrg Dorado9211WriteReg(CS92xx_RED_GREEN_LSFR_SEED, 60304007ebaSmrg cs9211_regs.red_green_lsfr_seed); 604f29dbc25Smrg 605f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_MEM_CNTRL, cs9211_regs.memory_control); 606f29dbc25Smrg /* Set the power register last. This will turn the panel on at the 9211 */ 607f29dbc25Smrg Dorado9211WriteReg(CS92xx_LCD_PWR_MAN, cs9211_regs.power_management); 608f29dbc25Smrg} 609