diff options
| author | Ingo Molnar <mingo@kernel.org> | 2013-12-17 09:27:08 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2013-12-17 09:27:08 -0500 |
| commit | bb799d3b980eb803ca2da4a4eefbd9308f8d988a (patch) | |
| tree | 69fbe0cd6d47b23a50f5e1d87bf7489532fae149 /drivers/video/offb.c | |
| parent | 919fc6e34831d1c2b58bfb5ae261dc3facc9b269 (diff) | |
| parent | 319e2e3f63c348a9b66db4667efa73178e18b17d (diff) | |
Merge tag 'v3.13-rc4' into core/locking
Merge Linux 3.13-rc4, to refresh this rather old tree with the latest fixes.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/video/offb.c')
| -rw-r--r-- | drivers/video/offb.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 9dbea2223401..7d44d669d5b6 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
| @@ -91,6 +91,15 @@ extern boot_infos_t *boot_infos; | |||
| 91 | #define AVIVO_DC_LUTB_WHITE_OFFSET_GREEN 0x6cd4 | 91 | #define AVIVO_DC_LUTB_WHITE_OFFSET_GREEN 0x6cd4 |
| 92 | #define AVIVO_DC_LUTB_WHITE_OFFSET_RED 0x6cd8 | 92 | #define AVIVO_DC_LUTB_WHITE_OFFSET_RED 0x6cd8 |
| 93 | 93 | ||
| 94 | #define FB_RIGHT_POS(p, bpp) (fb_be_math(p) ? 0 : (32 - (bpp))) | ||
| 95 | |||
| 96 | static inline u32 offb_cmap_byteswap(struct fb_info *info, u32 value) | ||
| 97 | { | ||
| 98 | u32 bpp = info->var.bits_per_pixel; | ||
| 99 | |||
| 100 | return cpu_to_be32(value) >> FB_RIGHT_POS(info, bpp); | ||
| 101 | } | ||
| 102 | |||
| 94 | /* | 103 | /* |
| 95 | * Set a single color register. The values supplied are already | 104 | * Set a single color register. The values supplied are already |
| 96 | * rounded down to the hardware's capabilities (according to the | 105 | * rounded down to the hardware's capabilities (according to the |
| @@ -120,7 +129,7 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
| 120 | mask <<= info->var.transp.offset; | 129 | mask <<= info->var.transp.offset; |
| 121 | value |= mask; | 130 | value |= mask; |
| 122 | } | 131 | } |
| 123 | pal[regno] = value; | 132 | pal[regno] = offb_cmap_byteswap(info, value); |
| 124 | return 0; | 133 | return 0; |
| 125 | } | 134 | } |
| 126 | 135 | ||
| @@ -301,7 +310,7 @@ static struct fb_ops offb_ops = { | |||
| 301 | static void __iomem *offb_map_reg(struct device_node *np, int index, | 310 | static void __iomem *offb_map_reg(struct device_node *np, int index, |
| 302 | unsigned long offset, unsigned long size) | 311 | unsigned long offset, unsigned long size) |
| 303 | { | 312 | { |
| 304 | const u32 *addrp; | 313 | const __be32 *addrp; |
| 305 | u64 asize, taddr; | 314 | u64 asize, taddr; |
| 306 | unsigned int flags; | 315 | unsigned int flags; |
| 307 | 316 | ||
| @@ -369,7 +378,11 @@ static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp | |||
| 369 | } | 378 | } |
| 370 | of_node_put(pciparent); | 379 | of_node_put(pciparent); |
| 371 | } else if (dp && of_device_is_compatible(dp, "qemu,std-vga")) { | 380 | } else if (dp && of_device_is_compatible(dp, "qemu,std-vga")) { |
| 372 | const u32 io_of_addr[3] = { 0x01000000, 0x0, 0x0 }; | 381 | #ifdef __BIG_ENDIAN |
| 382 | const __be32 io_of_addr[3] = { 0x01000000, 0x0, 0x0 }; | ||
| 383 | #else | ||
| 384 | const __be32 io_of_addr[3] = { 0x00000001, 0x0, 0x0 }; | ||
| 385 | #endif | ||
| 373 | u64 io_addr = of_translate_address(dp, io_of_addr); | 386 | u64 io_addr = of_translate_address(dp, io_of_addr); |
| 374 | if (io_addr != OF_BAD_ADDR) { | 387 | if (io_addr != OF_BAD_ADDR) { |
| 375 | par->cmap_adr = ioremap(io_addr + 0x3c8, 2); | 388 | par->cmap_adr = ioremap(io_addr + 0x3c8, 2); |
| @@ -535,7 +548,7 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) | |||
| 535 | unsigned int flags, rsize, addr_prop = 0; | 548 | unsigned int flags, rsize, addr_prop = 0; |
| 536 | unsigned long max_size = 0; | 549 | unsigned long max_size = 0; |
| 537 | u64 rstart, address = OF_BAD_ADDR; | 550 | u64 rstart, address = OF_BAD_ADDR; |
| 538 | const u32 *pp, *addrp, *up; | 551 | const __be32 *pp, *addrp, *up; |
| 539 | u64 asize; | 552 | u64 asize; |
| 540 | int foreign_endian = 0; | 553 | int foreign_endian = 0; |
| 541 | 554 | ||
| @@ -551,25 +564,25 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) | |||
| 551 | if (pp == NULL) | 564 | if (pp == NULL) |
| 552 | pp = of_get_property(dp, "depth", &len); | 565 | pp = of_get_property(dp, "depth", &len); |
| 553 | if (pp && len == sizeof(u32)) | 566 | if (pp && len == sizeof(u32)) |
| 554 | depth = *pp; | 567 | depth = be32_to_cpup(pp); |
| 555 | 568 | ||
| 556 | pp = of_get_property(dp, "linux,bootx-width", &len); | 569 | pp = of_get_property(dp, "linux,bootx-width", &len); |
| 557 | if (pp == NULL) | 570 | if (pp == NULL) |
| 558 | pp = of_get_property(dp, "width", &len); | 571 | pp = of_get_property(dp, "width", &len); |
| 559 | if (pp && len == sizeof(u32)) | 572 | if (pp && len == sizeof(u32)) |
| 560 | width = *pp; | 573 | width = be32_to_cpup(pp); |
| 561 | 574 | ||
| 562 | pp = of_get_property(dp, "linux,bootx-height", &len); | 575 | pp = of_get_property(dp, "linux,bootx-height", &len); |
| 563 | if (pp == NULL) | 576 | if (pp == NULL) |
| 564 | pp = of_get_property(dp, "height", &len); | 577 | pp = of_get_property(dp, "height", &len); |
| 565 | if (pp && len == sizeof(u32)) | 578 | if (pp && len == sizeof(u32)) |
| 566 | height = *pp; | 579 | height = be32_to_cpup(pp); |
| 567 | 580 | ||
| 568 | pp = of_get_property(dp, "linux,bootx-linebytes", &len); | 581 | pp = of_get_property(dp, "linux,bootx-linebytes", &len); |
| 569 | if (pp == NULL) | 582 | if (pp == NULL) |
| 570 | pp = of_get_property(dp, "linebytes", &len); | 583 | pp = of_get_property(dp, "linebytes", &len); |
| 571 | if (pp && len == sizeof(u32) && (*pp != 0xffffffffu)) | 584 | if (pp && len == sizeof(u32) && (*pp != 0xffffffffu)) |
| 572 | pitch = *pp; | 585 | pitch = be32_to_cpup(pp); |
| 573 | else | 586 | else |
| 574 | pitch = width * ((depth + 7) / 8); | 587 | pitch = width * ((depth + 7) / 8); |
| 575 | 588 | ||
