Ignore:
Timestamp:
2013-01-24T22:07:06Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
03362fbd, 3acd1bb, d59c046
Parents:
6218d4b (diff), 24bead17 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge arm improvements.

Speed up boot by enabling caches early (but disable before jumping to kernel).
Add cycle counters on armv7.
Move bbxm dispc driver to uspace.
Add arm PROCESSOR and PROCESSOR_ARCH defines.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/fb/amdm37x_dispc/amdm37x_dispc_regs.h

    r6218d4b r005b765  
    11/*
    2  * Copyright (c) 2012 Jan Vesely
     2 * Copyright (c) 2013 Jan Vesely
    33 * All rights reserved.
    44 *
     
    3434 */
    3535
    36 #ifndef KERN_AMDM37x_DISPC_H_
    37 #define KERN_AMDM37x_DISPC_H_
     36#ifndef AMDM37x_DISPC_REGS_H_
     37#define AMDM37x_DISPC_REGS_H_
    3838
    3939/* AMDM37x TRM p. 1813 */
     
    4141#define AMDM37x_DISPC_SIZE 1024
    4242
    43 #define __paddname(line) PADD32_ ## line
    44 #define _paddname(line) __paddname(line)
    45 #define PADD32(count) uint32_t _paddname(__LINE__)[count]
    46 
    47 #include <typedefs.h>
     43#include <macros.h>
    4844
    4945typedef struct {
     
    5147#define AMDM37X_DISPC_REVISION_MASK  0xff
    5248
    53         PADD32(3);
     49        PADD32[3];
    5450        ioport32_t sysconfig;
    5551#define AMDM37X_DISPC_SYSCONFIG_AUTOIDLE_FLAG  (1 << 0)
     
    8682#define AMDM37X_DISPC_IRQ_WAKEUP_FLAG  (1 << 16)
    8783
    88         PADD32(8);
     84        PADD32[8];
    8985        ioport32_t control;
    9086#define AMDM37X_DISPC_CONTROL_LCD_ENABLE_FLAG  (1 << 0)
     
    149145#define AMDM37X_DISPC_CONFIG_TVALPHABLENDERENABLE_FLAG  (1 << 19)
    150146
    151         PADD32(1);
     147        PADD32[1];
    152148        ioport32_t default_color[2];
    153149        ioport32_t trans_color[2];
     
    215211#define AMDM37X_DISPC_SIZE_HEIGHT_SHIFT  16
    216212
    217                 PADD32(4);
     213                PADD32[4];
    218214                ioport32_t attributes;
    219215#define AMDM37X_DISPC_GFX_ATTRIBUTES_ENABLE_FLAG  (1 << 0)
     
    266262                } fir_coef[8];
    267263                ioport32_t conv_coef[5];
    268                 PADD32(2);
     264                PADD32[2];
    269265        } vid[2];
    270266        /* 0x1d4 */
     
    273269        ioport32_t vid_fir_coef_v[8];
    274270        /* 0x200 */
    275         PADD32(8);
     271        PADD32[8];
    276272        /* 0x220 */
    277273        ioport32_t cpr_coef_r;
     
    283279        ioport32_t vid_preload[2];
    284280
    285 } __attribute__((packed)) amdm37x_dispc_regs_t;
    286 
    287 
    288 static inline void amdm37x_dispc_setup_fb(amdm37x_dispc_regs_t *regs,
    289     unsigned x, unsigned y, unsigned bpp, uintptr_t pa)
    290 {
    291         ASSERT(regs);
    292         /* Init sequence for dispc is in chapter 7.6.5.1.4 p. 1810,
    293          * no idea what parts of that work. */
    294 
    295         /* Disable all interrupts */
    296         regs->irqenable = 0;
    297 
    298         /* Pixel format specifics*/
    299         uint32_t attrib_pixel_format = 0;
    300         uint32_t control_data_lanes = 0;
    301         switch (bpp)
    302         {
    303         case 32:
    304                 attrib_pixel_format = AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGBX;
    305                 control_data_lanes = AMDM37X_DISPC_CONTROL_TFTDATALINES_24B;
    306                 break;
    307         case 24:
    308                 attrib_pixel_format = AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGB24;
    309                 control_data_lanes = AMDM37X_DISPC_CONTROL_TFTDATALINES_24B;
    310                 break;
    311         case 16:
    312                 attrib_pixel_format = AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGB16;
    313                 control_data_lanes = AMDM37X_DISPC_CONTROL_TFTDATALINES_16B;
    314                 break;
    315         default:
    316                 ASSERT(false);
    317         }
    318 
    319         /* Prepare sizes */
    320         const uint32_t size_reg =
    321             (((x - 1) & AMDM37X_DISPC_SIZE_WIDTH_MASK)
    322                 << AMDM37X_DISPC_SIZE_WIDTH_SHIFT) |
    323             (((y - 1) & AMDM37X_DISPC_SIZE_HEIGHT_MASK)
    324                 << AMDM37X_DISPC_SIZE_HEIGHT_SHIFT);
    325 
    326         /* modes taken from u-boot, for 1024x768 */
    327         // TODO replace magic values with actual correct values
    328 //      regs->timing_h = 0x1a4024c9;
    329 //      regs->timing_v = 0x02c00509;
    330 //      regs->pol_freq = 0x00007028;
    331 //      regs->divisor  = 0x00010001;
    332 
    333         /* setup output */
    334         regs->size_lcd = size_reg;
    335         regs->size_dig = size_reg;
    336 
    337         /* Nice blue default color */
    338         regs->default_color[0] = 0x0000ff;
    339         regs->default_color[1] = 0x0000ff;
    340 
    341         /* Setup control register */
    342         uint32_t control = 0 |
    343                 AMDM37X_DISPC_CONTROL_PCKFREEENABLE_FLAG |
    344                 (control_data_lanes << AMDM37X_DISPC_CONTROL_TFTDATALINES_SHIFT) |
    345                 AMDM37X_DISPC_CONTROL_GPOUT0_FLAG |
    346                 AMDM37X_DISPC_CONTROL_GPOUT1_FLAG;
    347         regs->control = control;
    348 
    349         /* No gamma stuff only data */
    350         uint32_t config = (AMDM37X_DISPC_CONFIG_LOADMODE_DATAEVERYFRAME
    351                     << AMDM37X_DISPC_CONFIG_LOADMODE_SHIFT);
    352         regs->config = config;
    353 
    354 
    355         /* Set framebuffer base address */
    356         regs->gfx.ba[0] = pa;
    357         regs->gfx.ba[1] = pa;
    358         regs->gfx.position = 0;
    359 
    360         /* Setup fb size */
    361         regs->gfx.size = size_reg;
    362 
    363         /* Set pixel format */
    364         uint32_t attribs = 0 |
    365             (attrib_pixel_format << AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_SHIFT);
    366         regs->gfx.attributes = attribs;
    367 
    368         /* 0x03ff03c0 is the default */
    369         regs->gfx.fifo_threshold = 0x03ff03c0;
    370         /* This value should be stride - width, 1 means next pixel i.e.
    371          * stride == width */
    372         regs->gfx.row_inc = 1;
    373         /* number of bytes to next pixel in BPP multiples */
    374         regs->gfx.pixel_inc = 1;
    375         /* only used if video is played over fb */
    376         regs->gfx.window_skip = 0;
    377         /* Gamma and palette table */
    378         regs->gfx.table_ba = 0;
    379 
    380         /* enable frame buffer graphics */
    381         regs->gfx.attributes |= AMDM37X_DISPC_GFX_ATTRIBUTES_ENABLE_FLAG;
    382         /* Update register values */
    383         regs->control |= AMDM37X_DISPC_CONTROL_GOLCD_FLAG;
    384         regs->control |= AMDM37X_DISPC_CONTROL_GODIGITAL_FLAG;
    385         /* Enable output */
    386         regs->control |= AMDM37X_DISPC_CONTROL_LCD_ENABLE_FLAG;
    387         regs->control |= AMDM37X_DISPC_CONTROL_DIGITAL_ENABLE_FLAG;
    388 }
     281} amdm37x_dispc_regs_t;
    389282
    390283
Note: See TracChangeset for help on using the changeset viewer.