| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/drivers/video/w100fb.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 17 | 18 | * |
|---|
| 18 | 19 | * Hardware acceleration support by Alberto Mardegan |
|---|
| 19 | 20 | * <mardy@users.sourceforge.net> |
|---|
| 20 | | - * |
|---|
| 21 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 22 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 23 | | - * published by the Free Software Foundation. |
|---|
| 24 | | - * |
|---|
| 25 | 21 | */ |
|---|
| 26 | 22 | |
|---|
| 27 | 23 | #include <linux/delay.h> |
|---|
| .. | .. |
|---|
| 65 | 61 | #define BITS_PER_PIXEL 16 |
|---|
| 66 | 62 | |
|---|
| 67 | 63 | /* Remapped addresses for base cfg, memmapped regs and the frame buffer itself */ |
|---|
| 68 | | -static void *remapped_base; |
|---|
| 69 | | -static void *remapped_regs; |
|---|
| 70 | | -static void *remapped_fbuf; |
|---|
| 64 | +static void __iomem *remapped_base; |
|---|
| 65 | +static void __iomem *remapped_regs; |
|---|
| 66 | +static void __iomem *remapped_fbuf; |
|---|
| 71 | 67 | |
|---|
| 72 | 68 | #define REMAPPED_FB_LEN 0x15ffff |
|---|
| 73 | 69 | |
|---|
| .. | .. |
|---|
| 167 | 163 | } |
|---|
| 168 | 164 | |
|---|
| 169 | 165 | static DEVICE_ATTR_RW(fastpllclk); |
|---|
| 166 | + |
|---|
| 167 | +static struct attribute *w100fb_attrs[] = { |
|---|
| 168 | + &dev_attr_fastpllclk.attr, |
|---|
| 169 | + &dev_attr_reg_read.attr, |
|---|
| 170 | + &dev_attr_reg_write.attr, |
|---|
| 171 | + &dev_attr_flip.attr, |
|---|
| 172 | + NULL, |
|---|
| 173 | +}; |
|---|
| 174 | +ATTRIBUTE_GROUPS(w100fb); |
|---|
| 170 | 175 | |
|---|
| 171 | 176 | /* |
|---|
| 172 | 177 | * Some touchscreens need hsync information from the video driver to |
|---|
| .. | .. |
|---|
| 544 | 549 | /* |
|---|
| 545 | 550 | * Frame buffer operations |
|---|
| 546 | 551 | */ |
|---|
| 547 | | -static struct fb_ops w100fb_ops = { |
|---|
| 552 | +static const struct fb_ops w100fb_ops = { |
|---|
| 548 | 553 | .owner = THIS_MODULE, |
|---|
| 549 | 554 | .fb_check_var = w100fb_check_var, |
|---|
| 550 | 555 | .fb_set_par = w100fb_set_par, |
|---|
| .. | .. |
|---|
| 632 | 637 | #endif |
|---|
| 633 | 638 | |
|---|
| 634 | 639 | |
|---|
| 635 | | -int w100fb_probe(struct platform_device *pdev) |
|---|
| 640 | +static int w100fb_probe(struct platform_device *pdev) |
|---|
| 636 | 641 | { |
|---|
| 637 | 642 | int err = -EIO; |
|---|
| 638 | 643 | struct w100fb_mach_info *inf; |
|---|
| .. | .. |
|---|
| 645 | 650 | return -EINVAL; |
|---|
| 646 | 651 | |
|---|
| 647 | 652 | /* Remap the chip base address */ |
|---|
| 648 | | - remapped_base = ioremap_nocache(mem->start+W100_CFG_BASE, W100_CFG_LEN); |
|---|
| 653 | + remapped_base = ioremap(mem->start+W100_CFG_BASE, W100_CFG_LEN); |
|---|
| 649 | 654 | if (remapped_base == NULL) |
|---|
| 650 | 655 | goto out; |
|---|
| 651 | 656 | |
|---|
| 652 | 657 | /* Map the register space */ |
|---|
| 653 | | - remapped_regs = ioremap_nocache(mem->start+W100_REG_BASE, W100_REG_LEN); |
|---|
| 658 | + remapped_regs = ioremap(mem->start+W100_REG_BASE, W100_REG_LEN); |
|---|
| 654 | 659 | if (remapped_regs == NULL) |
|---|
| 655 | 660 | goto out; |
|---|
| 656 | 661 | |
|---|
| .. | .. |
|---|
| 669 | 674 | printk(" at 0x%08lx.\n", (unsigned long) mem->start+W100_CFG_BASE); |
|---|
| 670 | 675 | |
|---|
| 671 | 676 | /* Remap the framebuffer */ |
|---|
| 672 | | - remapped_fbuf = ioremap_nocache(mem->start+MEM_WINDOW_BASE, MEM_WINDOW_SIZE); |
|---|
| 677 | + remapped_fbuf = ioremap(mem->start+MEM_WINDOW_BASE, MEM_WINDOW_SIZE); |
|---|
| 673 | 678 | if (remapped_fbuf == NULL) |
|---|
| 674 | 679 | goto out; |
|---|
| 675 | 680 | |
|---|
| .. | .. |
|---|
| 758 | 763 | goto out; |
|---|
| 759 | 764 | } |
|---|
| 760 | 765 | |
|---|
| 761 | | - err = device_create_file(&pdev->dev, &dev_attr_fastpllclk); |
|---|
| 762 | | - err |= device_create_file(&pdev->dev, &dev_attr_reg_read); |
|---|
| 763 | | - err |= device_create_file(&pdev->dev, &dev_attr_reg_write); |
|---|
| 764 | | - err |= device_create_file(&pdev->dev, &dev_attr_flip); |
|---|
| 765 | | - |
|---|
| 766 | | - if (err != 0) |
|---|
| 767 | | - fb_warn(info, "failed to register attributes (%d)\n", err); |
|---|
| 768 | | - |
|---|
| 769 | 766 | fb_info(info, "%s frame buffer device\n", info->fix.id); |
|---|
| 770 | 767 | return 0; |
|---|
| 771 | 768 | out: |
|---|
| .. | .. |
|---|
| 773 | 770 | fb_dealloc_cmap(&info->cmap); |
|---|
| 774 | 771 | kfree(info->pseudo_palette); |
|---|
| 775 | 772 | } |
|---|
| 776 | | - if (remapped_fbuf != NULL) |
|---|
| 773 | + if (remapped_fbuf != NULL) { |
|---|
| 777 | 774 | iounmap(remapped_fbuf); |
|---|
| 778 | | - if (remapped_regs != NULL) |
|---|
| 775 | + remapped_fbuf = NULL; |
|---|
| 776 | + } |
|---|
| 777 | + if (remapped_regs != NULL) { |
|---|
| 779 | 778 | iounmap(remapped_regs); |
|---|
| 780 | | - if (remapped_base != NULL) |
|---|
| 779 | + remapped_regs = NULL; |
|---|
| 780 | + } |
|---|
| 781 | + if (remapped_base != NULL) { |
|---|
| 781 | 782 | iounmap(remapped_base); |
|---|
| 783 | + remapped_base = NULL; |
|---|
| 784 | + } |
|---|
| 782 | 785 | if (info) |
|---|
| 783 | 786 | framebuffer_release(info); |
|---|
| 784 | 787 | return err; |
|---|
| .. | .. |
|---|
| 790 | 793 | struct fb_info *info = platform_get_drvdata(pdev); |
|---|
| 791 | 794 | struct w100fb_par *par=info->par; |
|---|
| 792 | 795 | |
|---|
| 793 | | - device_remove_file(&pdev->dev, &dev_attr_fastpllclk); |
|---|
| 794 | | - device_remove_file(&pdev->dev, &dev_attr_reg_read); |
|---|
| 795 | | - device_remove_file(&pdev->dev, &dev_attr_reg_write); |
|---|
| 796 | | - device_remove_file(&pdev->dev, &dev_attr_flip); |
|---|
| 797 | | - |
|---|
| 798 | 796 | unregister_framebuffer(info); |
|---|
| 799 | 797 | |
|---|
| 800 | 798 | vfree(par->saved_intmem); |
|---|
| .. | .. |
|---|
| 803 | 801 | fb_dealloc_cmap(&info->cmap); |
|---|
| 804 | 802 | |
|---|
| 805 | 803 | iounmap(remapped_base); |
|---|
| 804 | + remapped_base = NULL; |
|---|
| 806 | 805 | iounmap(remapped_regs); |
|---|
| 806 | + remapped_regs = NULL; |
|---|
| 807 | 807 | iounmap(remapped_fbuf); |
|---|
| 808 | + remapped_fbuf = NULL; |
|---|
| 808 | 809 | |
|---|
| 809 | 810 | framebuffer_release(info); |
|---|
| 810 | 811 | |
|---|
| .. | .. |
|---|
| 817 | 818 | |
|---|
| 818 | 819 | static void w100_soft_reset(void) |
|---|
| 819 | 820 | { |
|---|
| 820 | | - u16 val = readw((u16 *) remapped_base + cfgSTATUS); |
|---|
| 821 | | - writew(val | 0x08, (u16 *) remapped_base + cfgSTATUS); |
|---|
| 821 | + u16 val = readw((u16 __iomem *)remapped_base + cfgSTATUS); |
|---|
| 822 | + |
|---|
| 823 | + writew(val | 0x08, (u16 __iomem *)remapped_base + cfgSTATUS); |
|---|
| 822 | 824 | udelay(100); |
|---|
| 823 | | - writew(0x00, (u16 *) remapped_base + cfgSTATUS); |
|---|
| 825 | + writew(0x00, (u16 __iomem *)remapped_base + cfgSTATUS); |
|---|
| 824 | 826 | udelay(100); |
|---|
| 825 | 827 | } |
|---|
| 826 | 828 | |
|---|
| .. | .. |
|---|
| 1032 | 1034 | return pll_entry->pll_table; |
|---|
| 1033 | 1035 | pll_entry++; |
|---|
| 1034 | 1036 | } while (pll_entry->xtal_freq); |
|---|
| 1035 | | - return 0; |
|---|
| 1037 | + |
|---|
| 1038 | + return NULL; |
|---|
| 1036 | 1039 | } |
|---|
| 1037 | 1040 | |
|---|
| 1038 | 1041 | |
|---|
| .. | .. |
|---|
| 1631 | 1634 | .resume = w100fb_resume, |
|---|
| 1632 | 1635 | .driver = { |
|---|
| 1633 | 1636 | .name = "w100fb", |
|---|
| 1637 | + .dev_groups = w100fb_groups, |
|---|
| 1634 | 1638 | }, |
|---|
| 1635 | 1639 | }; |
|---|
| 1636 | 1640 | |
|---|