Revision cdbdb648 hw/pl110.c

b/hw/pl110.c
1 1
/* 
2 2
 * Arm PrimeCell PL110 Color LCD Controller
3 3
 *
4
 * Copyright (c) 2005 CodeSourcery, LLC.
4
 * Copyright (c) 2005-2006 CodeSourcery.
5 5
 * Written by Paul Brook
6 6
 *
7 7
 * This code is licenced under the GNU LGPL
......
27 27
typedef struct {
28 28
    uint32_t base;
29 29
    DisplayState *ds;
30
    /* The Versatile/PB uses a slightly modified PL110 controller.  */
31
    int versatile;
30 32
    void *pic;
31 33
    uint32_t timing[4];
32 34
    uint32_t cr;
......
46 48
static const unsigned char pl110_id[] =
47 49
{ 0x10, 0x11, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 };
48 50

  
51
/* The Arm documentation (DDI0224C) says the CLDC on the Versatile board
52
   has a different ID.  However Linux only looks for the normal ID.  */
53
#if 0
54
static const unsigned char pl110_versatile_id[] =
55
{ 0x93, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 };
56
#else
57
#define pl110_versatile_id pl110_id
58
#endif
59

  
49 60
static inline uint32_t rgb_to_pixel8(unsigned int r, unsigned int g, unsigned b)
50 61
{
51 62
    return ((r >> 5) << 5) | ((g >> 5) << 2) | (b >> 6);
......
101 112
    int src_width;
102 113
    uint8_t *dest;
103 114
    uint8_t *src;
104
    int first, last;
115
    int first, last = 0;
105 116
    int dirty, new_dirty;
106 117
    int i;
107 118

  
......
269 280

  
270 281
    offset -= s->base;
271 282
    if (offset >= 0xfe0 && offset < 0x1000) {
272
        return pl110_id[(offset - 0xfe0) >> 2];
283
        if (s->versatile)
284
            return pl110_versatile_id[(offset - 0xfe0) >> 2];
285
        else
286
            return pl110_id[(offset - 0xfe0) >> 2];
273 287
    }
274 288
    if (offset >= 0x200 && offset < 0x400) {
275 289
        return s->raw_pallette[(offset - 0x200) >> 2];
......
347 361
        s->lpbase = val;
348 362
        break;
349 363
    case 6: /* LCDIMSC */
364
        if (s->versatile)
365
            goto control;
366
    imsc:
350 367
        s->int_mask = val;
351 368
        pl110_update(s);
352 369
        break;
353 370
    case 7: /* LCDControl */
371
        if (s->versatile)
372
            goto imsc;
373
    control:
354 374
        s->cr = val;
355 375
        s->bpp = (val >> 1) & 7;
356 376
        if (pl110_enabled(s)) {
......
390 410
    cpu_register_physical_memory(base, 0x00000fff, iomemtype);
391 411
    s->base = base;
392 412
    s->ds = ds;
413
    s->versatile = versatile;
393 414
    s->pic = pic;
394 415
    s->irq = irq;
395 416
    graphic_console_init(ds, pl110_update_display, pl110_invalidate_display,

Also available in: Unified diff