diff options
| author | Luis R. Rodriguez <mcgrof@suse.com> | 2015-06-04 12:44:46 -0400 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2015-06-16 02:42:11 -0400 |
| commit | 87b81762a893319921405ad6932f220c02ca88a7 (patch) | |
| tree | 7bf4ad9442a24c31b99b64133df9959f1b0fa2b2 | |
| parent | 99e62ef2edcc8f088bbc33e4e855d974898424b6 (diff) | |
video: fbdev: vesafb: only support MTRR_TYPE_WRCOMB
No other video driver uses MTRR types except for MTRR_TYPE_WRCOMB,
the other MTRR types were implemented and supported here but with
no real good reason. The ioremap() APIs are architecture agnostic and
at least on x86 PAT is a new design that extends MTRRs and
can replace it in a much cleaner way, where so long as the
proper ioremap_wc() or variant API is used the right thing will
be done behind the scenes. This is the only driver left using the
other MTRR types -- and since there is no good reason for it now
rip them out.
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: Suresh Siddha <sbsiddha@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Juergen Gross <jgross@suse.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-fbdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
| -rw-r--r-- | drivers/video/fbdev/vesafb.c | 62 |
1 files changed, 16 insertions, 46 deletions
diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c index d79a0ac49fc7..191156bdf638 100644 --- a/drivers/video/fbdev/vesafb.c +++ b/drivers/video/fbdev/vesafb.c | |||
| @@ -404,60 +404,30 @@ static int vesafb_probe(struct platform_device *dev) | |||
| 404 | * region already (FIXME) */ | 404 | * region already (FIXME) */ |
| 405 | request_region(0x3c0, 32, "vesafb"); | 405 | request_region(0x3c0, 32, "vesafb"); |
| 406 | 406 | ||
| 407 | if (mtrr == 3) { | ||
| 407 | #ifdef CONFIG_MTRR | 408 | #ifdef CONFIG_MTRR |
| 408 | if (mtrr) { | ||
| 409 | unsigned int temp_size = size_total; | 409 | unsigned int temp_size = size_total; |
| 410 | unsigned int type = 0; | 410 | int rc; |
| 411 | 411 | ||
| 412 | switch (mtrr) { | 412 | /* Find the largest power-of-two */ |
| 413 | case 1: | 413 | temp_size = roundup_pow_of_two(temp_size); |
| 414 | type = MTRR_TYPE_UNCACHABLE; | ||
| 415 | break; | ||
| 416 | case 2: | ||
| 417 | type = MTRR_TYPE_WRBACK; | ||
| 418 | break; | ||
| 419 | case 3: | ||
| 420 | type = MTRR_TYPE_WRCOMB; | ||
| 421 | break; | ||
| 422 | case 4: | ||
| 423 | type = MTRR_TYPE_WRTHROUGH; | ||
| 424 | break; | ||
| 425 | default: | ||
| 426 | type = 0; | ||
| 427 | break; | ||
| 428 | } | ||
| 429 | |||
| 430 | if (type) { | ||
| 431 | int rc; | ||
| 432 | |||
| 433 | /* Find the largest power-of-two */ | ||
| 434 | temp_size = roundup_pow_of_two(temp_size); | ||
| 435 | 414 | ||
| 436 | /* Try and find a power of two to add */ | 415 | /* Try and find a power of two to add */ |
| 437 | do { | 416 | do { |
| 438 | rc = mtrr_add(vesafb_fix.smem_start, temp_size, | 417 | rc = mtrr_add(vesafb_fix.smem_start, temp_size, |
| 439 | type, 1); | 418 | MTRR_TYPE_WRCOMB, 1); |
| 440 | temp_size >>= 1; | 419 | temp_size >>= 1; |
| 441 | } while (temp_size >= PAGE_SIZE && rc == -EINVAL); | 420 | } while (temp_size >= PAGE_SIZE && rc == -EINVAL); |
| 442 | } | ||
| 443 | } | ||
| 444 | #endif | 421 | #endif |
| 445 | |||
| 446 | switch (mtrr) { | ||
| 447 | case 1: /* uncachable */ | ||
| 448 | info->screen_base = ioremap_nocache(vesafb_fix.smem_start, vesafb_fix.smem_len); | ||
| 449 | break; | ||
| 450 | case 2: /* write-back */ | ||
| 451 | info->screen_base = ioremap_cache(vesafb_fix.smem_start, vesafb_fix.smem_len); | ||
| 452 | break; | ||
| 453 | case 3: /* write-combining */ | ||
| 454 | info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len); | 422 | info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len); |
| 455 | break; | 423 | } else { |
| 456 | case 4: /* write-through */ | 424 | #ifdef CONFIG_MTRR |
| 457 | default: | 425 | if (mtrr && mtrr != 3) |
| 426 | WARN_ONCE(1, "Only MTRR_TYPE_WRCOMB (3) make sense\n"); | ||
| 427 | #endif | ||
| 458 | info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len); | 428 | info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len); |
| 459 | break; | ||
| 460 | } | 429 | } |
| 430 | |||
| 461 | if (!info->screen_base) { | 431 | if (!info->screen_base) { |
| 462 | printk(KERN_ERR | 432 | printk(KERN_ERR |
| 463 | "vesafb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n", | 433 | "vesafb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n", |
