aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2008-04-30 03:52:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:32 -0400
commita7535ba730e13db037bd22c79c3805690d0945a2 (patch)
treee029246541524550ac3b7eba1f88d7af073481c9 /drivers/video
parent0454bd09de7380aac464c09018e6a533f7247b0d (diff)
pxafb: introduce lcd_{read,write}l() to wrap the __raw_{read,write}l()
using __raw_{read,write}l() everywhere looks messy, introduce lcd_{read,write}l() to get this cleaned up a bit Signed-off-by: eric miao <eric.miao@marvell.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/pxafb.c59
1 files changed, 35 insertions, 24 deletions
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 0031a5fefa26..417561779ec2 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -71,6 +71,18 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,
71 struct pxafb_info *); 71 struct pxafb_info *);
72static void set_ctrlr_state(struct pxafb_info *fbi, u_int state); 72static void set_ctrlr_state(struct pxafb_info *fbi, u_int state);
73 73
74static inline unsigned long
75lcd_readl(struct pxafb_info *fbi, unsigned int off)
76{
77 return __raw_readl(fbi->mmio_base + off);
78}
79
80static inline void
81lcd_writel(struct pxafb_info *fbi, unsigned int off, unsigned long val)
82{
83 __raw_writel(val, fbi->mmio_base + off);
84}
85
74static inline void pxafb_schedule_work(struct pxafb_info *fbi, u_int state) 86static inline void pxafb_schedule_work(struct pxafb_info *fbi, u_int state)
75{ 87{
76 unsigned long flags; 88 unsigned long flags;
@@ -684,8 +696,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,
684 fbi->reg_lccr1 = new_regs.lccr1; 696 fbi->reg_lccr1 = new_regs.lccr1;
685 fbi->reg_lccr2 = new_regs.lccr2; 697 fbi->reg_lccr2 = new_regs.lccr2;
686 fbi->reg_lccr3 = new_regs.lccr3; 698 fbi->reg_lccr3 = new_regs.lccr3;
687 fbi->reg_lccr4 = __raw_readl(fbi->mmio_base + LCCR4) & 699 fbi->reg_lccr4 = lcd_readl(fbi, LCCR4) & ~LCCR4_PAL_FOR_MASK;
688 (~LCCR4_PAL_FOR_MASK);
689 fbi->reg_lccr4 |= (fbi->lccr4 & LCCR4_PAL_FOR_MASK); 700 fbi->reg_lccr4 |= (fbi->lccr4 & LCCR4_PAL_FOR_MASK);
690 set_hsync_time(fbi, pcd); 701 set_hsync_time(fbi, pcd);
691 local_irq_restore(flags); 702 local_irq_restore(flags);
@@ -694,12 +705,12 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,
694 * Only update the registers if the controller is enabled 705 * Only update the registers if the controller is enabled
695 * and something has changed. 706 * and something has changed.
696 */ 707 */
697 if ((__raw_readl(fbi->mmio_base + LCCR0) != fbi->reg_lccr0) || 708 if ((lcd_readl(fbi, LCCR0) != fbi->reg_lccr0) ||
698 (__raw_readl(fbi->mmio_base + LCCR1) != fbi->reg_lccr1) || 709 (lcd_readl(fbi, LCCR1) != fbi->reg_lccr1) ||
699 (__raw_readl(fbi->mmio_base + LCCR2) != fbi->reg_lccr2) || 710 (lcd_readl(fbi, LCCR2) != fbi->reg_lccr2) ||
700 (__raw_readl(fbi->mmio_base + LCCR3) != fbi->reg_lccr3) || 711 (lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) ||
701 (__raw_readl(fbi->mmio_base + FDADR0) != fbi->fdadr[0]) || 712 (lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) ||
702 (__raw_readl(fbi->mmio_base + FDADR1) != fbi->fdadr[1])) 713 (lcd_readl(fbi, FDADR1) != fbi->fdadr[1]))
703 pxafb_schedule_work(fbi, C_REENABLE); 714 pxafb_schedule_work(fbi, C_REENABLE);
704 715
705 return 0; 716 return 0;
@@ -785,14 +796,14 @@ static void pxafb_enable_controller(struct pxafb_info *fbi)
785 clk_enable(fbi->clk); 796 clk_enable(fbi->clk);
786 797
787 /* Sequence from 11.7.10 */ 798 /* Sequence from 11.7.10 */
788 __raw_writel(fbi->reg_lccr3, fbi->mmio_base + LCCR3); 799 lcd_writel(fbi, LCCR3, fbi->reg_lccr3);
789 __raw_writel(fbi->reg_lccr2, fbi->mmio_base + LCCR2); 800 lcd_writel(fbi, LCCR2, fbi->reg_lccr2);
790 __raw_writel(fbi->reg_lccr1, fbi->mmio_base + LCCR1); 801 lcd_writel(fbi, LCCR1, fbi->reg_lccr1);
791 __raw_writel(fbi->reg_lccr0 & ~LCCR0_ENB, fbi->mmio_base + LCCR0); 802 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB);
792 803
793 __raw_writel(fbi->fdadr[0], fbi->mmio_base + FDADR0); 804 lcd_writel(fbi, FDADR0, fbi->fdadr[0]);
794 __raw_writel(fbi->fdadr[1], fbi->mmio_base + FDADR1); 805 lcd_writel(fbi, FDADR1, fbi->fdadr[1]);
795 __raw_writel(fbi->reg_lccr0 | LCCR0_ENB, fbi->mmio_base + LCCR0); 806 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB);
796} 807}
797 808
798static void pxafb_disable_controller(struct pxafb_info *fbi) 809static void pxafb_disable_controller(struct pxafb_info *fbi)
@@ -805,11 +816,11 @@ static void pxafb_disable_controller(struct pxafb_info *fbi)
805 add_wait_queue(&fbi->ctrlr_wait, &wait); 816 add_wait_queue(&fbi->ctrlr_wait, &wait);
806 817
807 /* Clear LCD Status Register */ 818 /* Clear LCD Status Register */
808 __raw_writel(0xffffffff, fbi->mmio_base + LCSR); 819 lcd_writel(fbi, LCSR, 0xffffffff);
809 820
810 lccr0 = __raw_readl(fbi->mmio_base + LCCR0) & ~LCCR0_LDM; 821 lccr0 = lcd_readl(fbi, LCCR0) & ~LCCR0_LDM;
811 __raw_writel(lccr0, fbi->mmio_base + LCCR0); 822 lcd_writel(fbi, LCCR0, lccr0);
812 __raw_writel(lccr0 | LCCR0_DIS, fbi->mmio_base + LCCR0); 823 lcd_writel(fbi, LCCR0, lccr0 | LCCR0_DIS);
813 824
814 schedule_timeout(200 * HZ / 1000); 825 schedule_timeout(200 * HZ / 1000);
815 remove_wait_queue(&fbi->ctrlr_wait, &wait); 826 remove_wait_queue(&fbi->ctrlr_wait, &wait);
@@ -824,15 +835,15 @@ static void pxafb_disable_controller(struct pxafb_info *fbi)
824static irqreturn_t pxafb_handle_irq(int irq, void *dev_id) 835static irqreturn_t pxafb_handle_irq(int irq, void *dev_id)
825{ 836{
826 struct pxafb_info *fbi = dev_id; 837 struct pxafb_info *fbi = dev_id;
827 unsigned int lccr0, lcsr = __raw_readl(fbi->mmio_base + LCSR); 838 unsigned int lccr0, lcsr = lcd_readl(fbi, LCSR);
828 839
829 if (lcsr & LCSR_LDD) { 840 if (lcsr & LCSR_LDD) {
830 lccr0 = __raw_readl(fbi->mmio_base + LCCR0) | LCCR0_LDM; 841 lccr0 = lcd_readl(fbi, LCCR0);
831 __raw_writel(lccr0, fbi->mmio_base + LCCR0); 842 lcd_writel(fbi, LCCR0, lccr0 | LCCR0_LDM);
832 wake_up(&fbi->ctrlr_wait); 843 wake_up(&fbi->ctrlr_wait);
833 } 844 }
834 845
835 __raw_writel(lcsr, fbi->mmio_base + LCSR); 846 lcd_writel(fbi, LCSR, lcsr);
836 return IRQ_HANDLED; 847 return IRQ_HANDLED;
837} 848}
838 849