1# Copyright (c) 2015 ARM Limited 2# All rights reserved 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license 9# terms below provided that you ensure that this notice is replicated 10# unmodified and in its entirety in all distributions of the software, 11# modified or unmodified, in source code or in binary form. 12# 13# Redistribution and use in source and binary forms, with or without 14# modification, are permitted provided that the following conditions are 15# met: redistributions of source code must retain the above copyright 16# notice, this list of conditions and the following disclaimer; 17# redistributions in binary form must reproduce the above copyright 18# notice, this list of conditions and the following disclaimer in the 19# documentation and/or other materials provided with the distribution; 20# neither the name of the copyright holders nor the names of its 21# contributors may be used to endorse or promote products derived from 22# this software without specific prior written permission. 23# 24# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35# 36# Authors: Andreas Sandberg 37# 38 39def upgrader(cpt): 40 """HDLCD controller rewrite. Converted checkpoints cause the HDLCD 41 model to start a new screen refresh and FIFO buffer fill immediately 42 after they are loaded. Expect some timing differences.""" 43 44 import re 45 if cpt.get('root','isa') != 'arm': 46 return 47 48 option_names = { 49 "int_rawstat" : "int_rawstat_serial", 50 "int_mask" : "int_mask_serial", 51 "fb_base" : "fb_base", 52 "fb_line_length" : "fb_line_length", 53 "fb_line_count" : "fb_line_count_serial", 54 "fb_line_pitch" : "fb_line_pitch", 55 "bus_options" : "bus_options_serial", 56 57 "v_sync" : "v_sync_serial", 58 "v_back_porch" : "v_back_porch_serial", 59 "v_data" : "v_data_serial", 60 "v_front_porch" : "v_front_porch_serial", 61 62 "h_sync" : "h_sync_serial", 63 "h_back_porch" : "h_back_porch_serial", 64 "h_data" : "h_data_serial", 65 "h_front_porch" : "h_front_porch_serial", 66 67 "polarities" : "polarities_serial", 68 69 "command" : "command_serial", 70 "pixel_format" : "pixel_format_serial", 71 "red_select" : "red_select_serial", 72 "green_select" : "green_select_serial", 73 "blue_select" : "blue_select_serial", 74 } 75 76 for sec in cpt.sections(): 77 if re.search('.*\.hdlcd$', sec): 78 options = {} 79 for new, old in option_names.items(): 80 options[new] = cpt.get(sec, old) 81 82 cpt.remove_section(sec) 83 cpt.add_section(sec) 84 for key, value in options.items(): 85 cpt.set(sec, key, value) 86 87 # Create a DMA engine section. The LCD controller will 88 # initialize the DMA it after the next VSync, so we don't 89 # care about the actual values 90 sec_dma = "%s.dmaEngine" % sec 91 cpt.add_section(sec_dma) 92 cpt.set(sec_dma, "nextLineAddr", "0") 93 cpt.set(sec_dma, "frameEnd", "0") 94 cpt.set(sec_dma, "startAddr", "0") 95 cpt.set(sec_dma, "endAddr", "0") 96 cpt.set(sec_dma, "nextAddr", "0") 97 cpt.set(sec_dma, "buffer", "") 98 99 100 print "Warning: Assuming that the HDLCD pixel clock and global frequency " \ 101 "are still using their default values." 102 sec_osc = "system.realview.realview_io.osc_pxl" 103 global_tick = 1E12 104 pxl_freq = 137E6 105 pxl_ticks = global_tick / pxl_freq 106 if not cpt.has_section(sec_osc): 107 cpt.add_section(sec_osc) 108 cpt.set(sec_osc, "type", "RealViewOsc") 109 cpt.set(sec_osc, "_clockPeriod", "%i" % pxl_ticks) 110