aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sm501fb.c
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2011-01-24 04:57:20 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-03-22 04:16:34 -0400
commitbf5f0019046d596d613caf74722ba4994e153899 (patch)
treece5829b518467cfd08344a48f6587b7012eb5eac /drivers/video/sm501fb.c
parentdfc906daeec03b3f2d306ae260d398d97ba232c5 (diff)
video, sm501: add I/O functions for use on powerpc
- add read/write functions for using this driver also on powerpc plattforms Signed-off-by: Heiko Schocher <hs@denx.de> cc: linux-fbdev@vger.kernel.org cc: devicetree-discuss@ozlabs.org cc: Ben Dooks <ben@simtec.co.uk> cc: Vincent Sanders <vince@simtec.co.uk> cc: Samuel Ortiz <sameo@linux.intel.com> cc: linux-kernel@vger.kernel.org cc: Randy Dunlap <rdunlap@xenotime.net> cc: Paul Mundt <lethal@linux-sh.org> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video/sm501fb.c')
-rw-r--r--drivers/video/sm501fb.c172
1 files changed, 90 insertions, 82 deletions
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index bcb44a594ebc..5df406c87c50 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -117,7 +117,7 @@ static inline int v_total(struct fb_var_screeninfo *var)
117 117
118static inline void sm501fb_sync_regs(struct sm501fb_info *info) 118static inline void sm501fb_sync_regs(struct sm501fb_info *info)
119{ 119{
120 readl(info->regs); 120 smc501_readl(info->regs);
121} 121}
122 122
123/* sm501_alloc_mem 123/* sm501_alloc_mem
@@ -262,7 +262,7 @@ static void sm501fb_setup_gamma(struct sm501fb_info *fbi,
262 262
263 /* set gamma values */ 263 /* set gamma values */
264 for (offset = 0; offset < 256 * 4; offset += 4) { 264 for (offset = 0; offset < 256 * 4; offset += 4) {
265 writel(value, fbi->regs + palette + offset); 265 smc501_writel(value, fbi->regs + palette + offset);
266 value += 0x010101; /* Advance RGB by 1,1,1.*/ 266 value += 0x010101; /* Advance RGB by 1,1,1.*/
267 } 267 }
268} 268}
@@ -476,7 +476,8 @@ static int sm501fb_set_par_common(struct fb_info *info,
476 476
477 /* set start of framebuffer to the screen */ 477 /* set start of framebuffer to the screen */
478 478
479 writel(par->screen.sm_addr | SM501_ADDR_FLIP, fbi->regs + head_addr); 479 smc501_writel(par->screen.sm_addr | SM501_ADDR_FLIP,
480 fbi->regs + head_addr);
480 481
481 /* program CRT clock */ 482 /* program CRT clock */
482 483
@@ -519,7 +520,7 @@ static void sm501fb_set_par_geometry(struct fb_info *info,
519 reg = info->fix.line_length; 520 reg = info->fix.line_length;
520 reg |= ((var->xres * var->bits_per_pixel)/8) << 16; 521 reg |= ((var->xres * var->bits_per_pixel)/8) << 16;
521 522
522 writel(reg, fbi->regs + (par->head == HEAD_CRT ? 523 smc501_writel(reg, fbi->regs + (par->head == HEAD_CRT ?
523 SM501_DC_CRT_FB_OFFSET : SM501_DC_PANEL_FB_OFFSET)); 524 SM501_DC_CRT_FB_OFFSET : SM501_DC_PANEL_FB_OFFSET));
524 525
525 /* program horizontal total */ 526 /* program horizontal total */
@@ -527,27 +528,27 @@ static void sm501fb_set_par_geometry(struct fb_info *info,
527 reg = (h_total(var) - 1) << 16; 528 reg = (h_total(var) - 1) << 16;
528 reg |= (var->xres - 1); 529 reg |= (var->xres - 1);
529 530
530 writel(reg, base + SM501_OFF_DC_H_TOT); 531 smc501_writel(reg, base + SM501_OFF_DC_H_TOT);
531 532
532 /* program horizontal sync */ 533 /* program horizontal sync */
533 534
534 reg = var->hsync_len << 16; 535 reg = var->hsync_len << 16;
535 reg |= var->xres + var->right_margin - 1; 536 reg |= var->xres + var->right_margin - 1;
536 537
537 writel(reg, base + SM501_OFF_DC_H_SYNC); 538 smc501_writel(reg, base + SM501_OFF_DC_H_SYNC);
538 539
539 /* program vertical total */ 540 /* program vertical total */
540 541
541 reg = (v_total(var) - 1) << 16; 542 reg = (v_total(var) - 1) << 16;
542 reg |= (var->yres - 1); 543 reg |= (var->yres - 1);
543 544
544 writel(reg, base + SM501_OFF_DC_V_TOT); 545 smc501_writel(reg, base + SM501_OFF_DC_V_TOT);
545 546
546 /* program vertical sync */ 547 /* program vertical sync */
547 reg = var->vsync_len << 16; 548 reg = var->vsync_len << 16;
548 reg |= var->yres + var->lower_margin - 1; 549 reg |= var->yres + var->lower_margin - 1;
549 550
550 writel(reg, base + SM501_OFF_DC_V_SYNC); 551 smc501_writel(reg, base + SM501_OFF_DC_V_SYNC);
551} 552}
552 553
553/* sm501fb_pan_crt 554/* sm501fb_pan_crt
@@ -566,15 +567,15 @@ static int sm501fb_pan_crt(struct fb_var_screeninfo *var,
566 567
567 xoffs = var->xoffset * bytes_pixel; 568 xoffs = var->xoffset * bytes_pixel;
568 569
569 reg = readl(fbi->regs + SM501_DC_CRT_CONTROL); 570 reg = smc501_readl(fbi->regs + SM501_DC_CRT_CONTROL);
570 571
571 reg &= ~SM501_DC_CRT_CONTROL_PIXEL_MASK; 572 reg &= ~SM501_DC_CRT_CONTROL_PIXEL_MASK;
572 reg |= ((xoffs & 15) / bytes_pixel) << 4; 573 reg |= ((xoffs & 15) / bytes_pixel) << 4;
573 writel(reg, fbi->regs + SM501_DC_CRT_CONTROL); 574 smc501_writel(reg, fbi->regs + SM501_DC_CRT_CONTROL);
574 575
575 reg = (par->screen.sm_addr + xoffs + 576 reg = (par->screen.sm_addr + xoffs +
576 var->yoffset * info->fix.line_length); 577 var->yoffset * info->fix.line_length);
577 writel(reg | SM501_ADDR_FLIP, fbi->regs + SM501_DC_CRT_FB_ADDR); 578 smc501_writel(reg | SM501_ADDR_FLIP, fbi->regs + SM501_DC_CRT_FB_ADDR);
578 579
579 sm501fb_sync_regs(fbi); 580 sm501fb_sync_regs(fbi);
580 return 0; 581 return 0;
@@ -593,10 +594,10 @@ static int sm501fb_pan_pnl(struct fb_var_screeninfo *var,
593 unsigned long reg; 594 unsigned long reg;
594 595
595 reg = var->xoffset | (var->xres_virtual << 16); 596 reg = var->xoffset | (var->xres_virtual << 16);
596 writel(reg, fbi->regs + SM501_DC_PANEL_FB_WIDTH); 597 smc501_writel(reg, fbi->regs + SM501_DC_PANEL_FB_WIDTH);
597 598
598 reg = var->yoffset | (var->yres_virtual << 16); 599 reg = var->yoffset | (var->yres_virtual << 16);
599 writel(reg, fbi->regs + SM501_DC_PANEL_FB_HEIGHT); 600 smc501_writel(reg, fbi->regs + SM501_DC_PANEL_FB_HEIGHT);
600 601
601 sm501fb_sync_regs(fbi); 602 sm501fb_sync_regs(fbi);
602 return 0; 603 return 0;
@@ -622,7 +623,7 @@ static int sm501fb_set_par_crt(struct fb_info *info)
622 /* enable CRT DAC - note 0 is on!*/ 623 /* enable CRT DAC - note 0 is on!*/
623 sm501_misc_control(fbi->dev->parent, 0, SM501_MISC_DAC_POWER); 624 sm501_misc_control(fbi->dev->parent, 0, SM501_MISC_DAC_POWER);
624 625
625 control = readl(fbi->regs + SM501_DC_CRT_CONTROL); 626 control = smc501_readl(fbi->regs + SM501_DC_CRT_CONTROL);
626 627
627 control &= (SM501_DC_CRT_CONTROL_PIXEL_MASK | 628 control &= (SM501_DC_CRT_CONTROL_PIXEL_MASK |
628 SM501_DC_CRT_CONTROL_GAMMA | 629 SM501_DC_CRT_CONTROL_GAMMA |
@@ -684,7 +685,7 @@ static int sm501fb_set_par_crt(struct fb_info *info)
684 out_update: 685 out_update:
685 dev_dbg(fbi->dev, "new control is %08lx\n", control); 686 dev_dbg(fbi->dev, "new control is %08lx\n", control);
686 687
687 writel(control, fbi->regs + SM501_DC_CRT_CONTROL); 688 smc501_writel(control, fbi->regs + SM501_DC_CRT_CONTROL);
688 sm501fb_sync_regs(fbi); 689 sm501fb_sync_regs(fbi);
689 690
690 return 0; 691 return 0;
@@ -696,18 +697,18 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
696 void __iomem *ctrl_reg = fbi->regs + SM501_DC_PANEL_CONTROL; 697 void __iomem *ctrl_reg = fbi->regs + SM501_DC_PANEL_CONTROL;
697 struct sm501_platdata_fbsub *pd = fbi->pdata->fb_pnl; 698 struct sm501_platdata_fbsub *pd = fbi->pdata->fb_pnl;
698 699
699 control = readl(ctrl_reg); 700 control = smc501_readl(ctrl_reg);
700 701
701 if (to && (control & SM501_DC_PANEL_CONTROL_VDD) == 0) { 702 if (to && (control & SM501_DC_PANEL_CONTROL_VDD) == 0) {
702 /* enable panel power */ 703 /* enable panel power */
703 704
704 control |= SM501_DC_PANEL_CONTROL_VDD; /* FPVDDEN */ 705 control |= SM501_DC_PANEL_CONTROL_VDD; /* FPVDDEN */
705 writel(control, ctrl_reg); 706 smc501_writel(control, ctrl_reg);
706 sm501fb_sync_regs(fbi); 707 sm501fb_sync_regs(fbi);
707 mdelay(10); 708 mdelay(10);
708 709
709 control |= SM501_DC_PANEL_CONTROL_DATA; /* DATA */ 710 control |= SM501_DC_PANEL_CONTROL_DATA; /* DATA */
710 writel(control, ctrl_reg); 711 smc501_writel(control, ctrl_reg);
711 sm501fb_sync_regs(fbi); 712 sm501fb_sync_regs(fbi);
712 mdelay(10); 713 mdelay(10);
713 714
@@ -719,7 +720,7 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
719 else 720 else
720 control |= SM501_DC_PANEL_CONTROL_BIAS; 721 control |= SM501_DC_PANEL_CONTROL_BIAS;
721 722
722 writel(control, ctrl_reg); 723 smc501_writel(control, ctrl_reg);
723 sm501fb_sync_regs(fbi); 724 sm501fb_sync_regs(fbi);
724 mdelay(10); 725 mdelay(10);
725 } 726 }
@@ -730,7 +731,7 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
730 else 731 else
731 control |= SM501_DC_PANEL_CONTROL_FPEN; 732 control |= SM501_DC_PANEL_CONTROL_FPEN;
732 733
733 writel(control, ctrl_reg); 734 smc501_writel(control, ctrl_reg);
734 sm501fb_sync_regs(fbi); 735 sm501fb_sync_regs(fbi);
735 mdelay(10); 736 mdelay(10);
736 } 737 }
@@ -742,7 +743,7 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
742 else 743 else
743 control &= ~SM501_DC_PANEL_CONTROL_FPEN; 744 control &= ~SM501_DC_PANEL_CONTROL_FPEN;
744 745
745 writel(control, ctrl_reg); 746 smc501_writel(control, ctrl_reg);
746 sm501fb_sync_regs(fbi); 747 sm501fb_sync_regs(fbi);
747 mdelay(10); 748 mdelay(10);
748 } 749 }
@@ -753,18 +754,18 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
753 else 754 else
754 control &= ~SM501_DC_PANEL_CONTROL_BIAS; 755 control &= ~SM501_DC_PANEL_CONTROL_BIAS;
755 756
756 writel(control, ctrl_reg); 757 smc501_writel(control, ctrl_reg);
757 sm501fb_sync_regs(fbi); 758 sm501fb_sync_regs(fbi);
758 mdelay(10); 759 mdelay(10);
759 } 760 }
760 761
761 control &= ~SM501_DC_PANEL_CONTROL_DATA; 762 control &= ~SM501_DC_PANEL_CONTROL_DATA;
762 writel(control, ctrl_reg); 763 smc501_writel(control, ctrl_reg);
763 sm501fb_sync_regs(fbi); 764 sm501fb_sync_regs(fbi);
764 mdelay(10); 765 mdelay(10);
765 766
766 control &= ~SM501_DC_PANEL_CONTROL_VDD; 767 control &= ~SM501_DC_PANEL_CONTROL_VDD;
767 writel(control, ctrl_reg); 768 smc501_writel(control, ctrl_reg);
768 sm501fb_sync_regs(fbi); 769 sm501fb_sync_regs(fbi);
769 mdelay(10); 770 mdelay(10);
770 } 771 }
@@ -799,7 +800,7 @@ static int sm501fb_set_par_pnl(struct fb_info *info)
799 800
800 /* update control register */ 801 /* update control register */
801 802
802 control = readl(fbi->regs + SM501_DC_PANEL_CONTROL); 803 control = smc501_readl(fbi->regs + SM501_DC_PANEL_CONTROL);
803 control &= (SM501_DC_PANEL_CONTROL_GAMMA | 804 control &= (SM501_DC_PANEL_CONTROL_GAMMA |
804 SM501_DC_PANEL_CONTROL_VDD | 805 SM501_DC_PANEL_CONTROL_VDD |
805 SM501_DC_PANEL_CONTROL_DATA | 806 SM501_DC_PANEL_CONTROL_DATA |
@@ -833,16 +834,16 @@ static int sm501fb_set_par_pnl(struct fb_info *info)
833 BUG(); 834 BUG();
834 } 835 }
835 836
836 writel(0x0, fbi->regs + SM501_DC_PANEL_PANNING_CONTROL); 837 smc501_writel(0x0, fbi->regs + SM501_DC_PANEL_PANNING_CONTROL);
837 838
838 /* panel plane top left and bottom right location */ 839 /* panel plane top left and bottom right location */
839 840
840 writel(0x00, fbi->regs + SM501_DC_PANEL_TL_LOC); 841 smc501_writel(0x00, fbi->regs + SM501_DC_PANEL_TL_LOC);
841 842
842 reg = var->xres - 1; 843 reg = var->xres - 1;
843 reg |= (var->yres - 1) << 16; 844 reg |= (var->yres - 1) << 16;
844 845
845 writel(reg, fbi->regs + SM501_DC_PANEL_BR_LOC); 846 smc501_writel(reg, fbi->regs + SM501_DC_PANEL_BR_LOC);
846 847
847 /* program panel control register */ 848 /* program panel control register */
848 849
@@ -855,7 +856,7 @@ static int sm501fb_set_par_pnl(struct fb_info *info)
855 if ((var->sync & FB_SYNC_VERT_HIGH_ACT) == 0) 856 if ((var->sync & FB_SYNC_VERT_HIGH_ACT) == 0)
856 control |= SM501_DC_PANEL_CONTROL_VSP; 857 control |= SM501_DC_PANEL_CONTROL_VSP;
857 858
858 writel(control, fbi->regs + SM501_DC_PANEL_CONTROL); 859 smc501_writel(control, fbi->regs + SM501_DC_PANEL_CONTROL);
859 sm501fb_sync_regs(fbi); 860 sm501fb_sync_regs(fbi);
860 861
861 /* ensure the panel interface is not tristated at this point */ 862 /* ensure the panel interface is not tristated at this point */
@@ -924,7 +925,7 @@ static int sm501fb_setcolreg(unsigned regno,
924 val |= (green >> 8) << 8; 925 val |= (green >> 8) << 8;
925 val |= blue >> 8; 926 val |= blue >> 8;
926 927
927 writel(val, base + (regno * 4)); 928 smc501_writel(val, base + (regno * 4));
928 } 929 }
929 930
930 break; 931 break;
@@ -980,7 +981,7 @@ static int sm501fb_blank_crt(int blank_mode, struct fb_info *info)
980 981
981 dev_dbg(fbi->dev, "%s(mode=%d, %p)\n", __func__, blank_mode, info); 982 dev_dbg(fbi->dev, "%s(mode=%d, %p)\n", __func__, blank_mode, info);
982 983
983 ctrl = readl(fbi->regs + SM501_DC_CRT_CONTROL); 984 ctrl = smc501_readl(fbi->regs + SM501_DC_CRT_CONTROL);
984 985
985 switch (blank_mode) { 986 switch (blank_mode) {
986 case FB_BLANK_POWERDOWN: 987 case FB_BLANK_POWERDOWN:
@@ -1004,7 +1005,7 @@ static int sm501fb_blank_crt(int blank_mode, struct fb_info *info)
1004 1005
1005 } 1006 }
1006 1007
1007 writel(ctrl, fbi->regs + SM501_DC_CRT_CONTROL); 1008 smc501_writel(ctrl, fbi->regs + SM501_DC_CRT_CONTROL);
1008 sm501fb_sync_regs(fbi); 1009 sm501fb_sync_regs(fbi);
1009 1010
1010 return 0; 1011 return 0;
@@ -1041,12 +1042,14 @@ static int sm501fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1041 if (cursor->image.depth > 1) 1042 if (cursor->image.depth > 1)
1042 return -EINVAL; 1043 return -EINVAL;
1043 1044
1044 hwc_addr = readl(base + SM501_OFF_HWC_ADDR); 1045 hwc_addr = smc501_readl(base + SM501_OFF_HWC_ADDR);
1045 1046
1046 if (cursor->enable) 1047 if (cursor->enable)
1047 writel(hwc_addr | SM501_HWC_EN, base + SM501_OFF_HWC_ADDR); 1048 smc501_writel(hwc_addr | SM501_HWC_EN,
1049 base + SM501_OFF_HWC_ADDR);
1048 else 1050 else
1049 writel(hwc_addr & ~SM501_HWC_EN, base + SM501_OFF_HWC_ADDR); 1051 smc501_writel(hwc_addr & ~SM501_HWC_EN,
1052 base + SM501_OFF_HWC_ADDR);
1050 1053
1051 /* set data */ 1054 /* set data */
1052 if (cursor->set & FB_CUR_SETPOS) { 1055 if (cursor->set & FB_CUR_SETPOS) {
@@ -1060,7 +1063,7 @@ static int sm501fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1060 1063
1061 //y += cursor->image.height; 1064 //y += cursor->image.height;
1062 1065
1063 writel(x | (y << 16), base + SM501_OFF_HWC_LOC); 1066 smc501_writel(x | (y << 16), base + SM501_OFF_HWC_LOC);
1064 } 1067 }
1065 1068
1066 if (cursor->set & FB_CUR_SETCMAP) { 1069 if (cursor->set & FB_CUR_SETCMAP) {
@@ -1080,8 +1083,8 @@ static int sm501fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1080 1083
1081 dev_dbg(fbi->dev, "fgcol %08lx, bgcol %08lx\n", fg, bg); 1084 dev_dbg(fbi->dev, "fgcol %08lx, bgcol %08lx\n", fg, bg);
1082 1085
1083 writel(bg, base + SM501_OFF_HWC_COLOR_1_2); 1086 smc501_writel(bg, base + SM501_OFF_HWC_COLOR_1_2);
1084 writel(fg, base + SM501_OFF_HWC_COLOR_3); 1087 smc501_writel(fg, base + SM501_OFF_HWC_COLOR_3);
1085 } 1088 }
1086 1089
1087 if (cursor->set & FB_CUR_SETSIZE || 1090 if (cursor->set & FB_CUR_SETSIZE ||
@@ -1102,7 +1105,7 @@ static int sm501fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1102 __func__, cursor->image.width, cursor->image.height); 1105 __func__, cursor->image.width, cursor->image.height);
1103 1106
1104 for (op = 0; op < (64*64*2)/8; op+=4) 1107 for (op = 0; op < (64*64*2)/8; op+=4)
1105 writel(0x0, dst + op); 1108 smc501_writel(0x0, dst + op);
1106 1109
1107 for (y = 0; y < cursor->image.height; y++) { 1110 for (y = 0; y < cursor->image.height; y++) {
1108 for (x = 0; x < cursor->image.width; x++) { 1111 for (x = 0; x < cursor->image.width; x++) {
@@ -1141,7 +1144,7 @@ static ssize_t sm501fb_crtsrc_show(struct device *dev,
1141 struct sm501fb_info *info = dev_get_drvdata(dev); 1144 struct sm501fb_info *info = dev_get_drvdata(dev);
1142 unsigned long ctrl; 1145 unsigned long ctrl;
1143 1146
1144 ctrl = readl(info->regs + SM501_DC_CRT_CONTROL); 1147 ctrl = smc501_readl(info->regs + SM501_DC_CRT_CONTROL);
1145 ctrl &= SM501_DC_CRT_CONTROL_SEL; 1148 ctrl &= SM501_DC_CRT_CONTROL_SEL;
1146 1149
1147 return snprintf(buf, PAGE_SIZE, "%s\n", ctrl ? "crt" : "panel"); 1150 return snprintf(buf, PAGE_SIZE, "%s\n", ctrl ? "crt" : "panel");
@@ -1172,7 +1175,7 @@ static ssize_t sm501fb_crtsrc_store(struct device *dev,
1172 1175
1173 dev_info(dev, "setting crt source to head %d\n", head); 1176 dev_info(dev, "setting crt source to head %d\n", head);
1174 1177
1175 ctrl = readl(info->regs + SM501_DC_CRT_CONTROL); 1178 ctrl = smc501_readl(info->regs + SM501_DC_CRT_CONTROL);
1176 1179
1177 if (head == HEAD_CRT) { 1180 if (head == HEAD_CRT) {
1178 ctrl |= SM501_DC_CRT_CONTROL_SEL; 1181 ctrl |= SM501_DC_CRT_CONTROL_SEL;
@@ -1184,7 +1187,7 @@ static ssize_t sm501fb_crtsrc_store(struct device *dev,
1184 ctrl &= ~SM501_DC_CRT_CONTROL_TE; 1187 ctrl &= ~SM501_DC_CRT_CONTROL_TE;
1185 } 1188 }
1186 1189
1187 writel(ctrl, info->regs + SM501_DC_CRT_CONTROL); 1190 smc501_writel(ctrl, info->regs + SM501_DC_CRT_CONTROL);
1188 sm501fb_sync_regs(info); 1191 sm501fb_sync_regs(info);
1189 1192
1190 return len; 1193 return len;
@@ -1205,7 +1208,8 @@ static int sm501fb_show_regs(struct sm501fb_info *info, char *ptr,
1205 unsigned int reg; 1208 unsigned int reg;
1206 1209
1207 for (reg = start; reg < (len + start); reg += 4) 1210 for (reg = start; reg < (len + start); reg += 4)
1208 ptr += sprintf(ptr, "%08x = %08x\n", reg, readl(mem + reg)); 1211 ptr += sprintf(ptr, "%08x = %08x\n", reg,
1212 smc501_readl(mem + reg));
1209 1213
1210 return ptr - buf; 1214 return ptr - buf;
1211} 1215}
@@ -1257,7 +1261,7 @@ static int sm501fb_sync(struct fb_info *info)
1257 1261
1258 /* wait for the 2d engine to be ready */ 1262 /* wait for the 2d engine to be ready */
1259 while ((count > 0) && 1263 while ((count > 0) &&
1260 (readl(fbi->regs + SM501_SYSTEM_CONTROL) & 1264 (smc501_readl(fbi->regs + SM501_SYSTEM_CONTROL) &
1261 SM501_SYSCTRL_2D_ENGINE_STATUS) != 0) 1265 SM501_SYSCTRL_2D_ENGINE_STATUS) != 0)
1262 count--; 1266 count--;
1263 1267
@@ -1312,45 +1316,46 @@ static void sm501fb_copyarea(struct fb_info *info, const struct fb_copyarea *are
1312 return; 1316 return;
1313 1317
1314 /* set the base addresses */ 1318 /* set the base addresses */
1315 writel(par->screen.sm_addr, fbi->regs2d + SM501_2D_SOURCE_BASE); 1319 smc501_writel(par->screen.sm_addr, fbi->regs2d + SM501_2D_SOURCE_BASE);
1316 writel(par->screen.sm_addr, fbi->regs2d + SM501_2D_DESTINATION_BASE); 1320 smc501_writel(par->screen.sm_addr,
1321 fbi->regs2d + SM501_2D_DESTINATION_BASE);
1317 1322
1318 /* set the window width */ 1323 /* set the window width */
1319 writel((info->var.xres << 16) | info->var.xres, 1324 smc501_writel((info->var.xres << 16) | info->var.xres,
1320 fbi->regs2d + SM501_2D_WINDOW_WIDTH); 1325 fbi->regs2d + SM501_2D_WINDOW_WIDTH);
1321 1326
1322 /* set window stride */ 1327 /* set window stride */
1323 writel((info->var.xres_virtual << 16) | info->var.xres_virtual, 1328 smc501_writel((info->var.xres_virtual << 16) | info->var.xres_virtual,
1324 fbi->regs2d + SM501_2D_PITCH); 1329 fbi->regs2d + SM501_2D_PITCH);
1325 1330
1326 /* set data format */ 1331 /* set data format */
1327 switch (info->var.bits_per_pixel) { 1332 switch (info->var.bits_per_pixel) {
1328 case 8: 1333 case 8:
1329 writel(0, fbi->regs2d + SM501_2D_STRETCH); 1334 smc501_writel(0, fbi->regs2d + SM501_2D_STRETCH);
1330 break; 1335 break;
1331 case 16: 1336 case 16:
1332 writel(0x00100000, fbi->regs2d + SM501_2D_STRETCH); 1337 smc501_writel(0x00100000, fbi->regs2d + SM501_2D_STRETCH);
1333 break; 1338 break;
1334 case 32: 1339 case 32:
1335 writel(0x00200000, fbi->regs2d + SM501_2D_STRETCH); 1340 smc501_writel(0x00200000, fbi->regs2d + SM501_2D_STRETCH);
1336 break; 1341 break;
1337 } 1342 }
1338 1343
1339 /* 2d compare mask */ 1344 /* 2d compare mask */
1340 writel(0xffffffff, fbi->regs2d + SM501_2D_COLOR_COMPARE_MASK); 1345 smc501_writel(0xffffffff, fbi->regs2d + SM501_2D_COLOR_COMPARE_MASK);
1341 1346
1342 /* 2d mask */ 1347 /* 2d mask */
1343 writel(0xffffffff, fbi->regs2d + SM501_2D_MASK); 1348 smc501_writel(0xffffffff, fbi->regs2d + SM501_2D_MASK);
1344 1349
1345 /* source and destination x y */ 1350 /* source and destination x y */
1346 writel((sx << 16) | sy, fbi->regs2d + SM501_2D_SOURCE); 1351 smc501_writel((sx << 16) | sy, fbi->regs2d + SM501_2D_SOURCE);
1347 writel((dx << 16) | dy, fbi->regs2d + SM501_2D_DESTINATION); 1352 smc501_writel((dx << 16) | dy, fbi->regs2d + SM501_2D_DESTINATION);
1348 1353
1349 /* w/h */ 1354 /* w/h */
1350 writel((width << 16) | height, fbi->regs2d + SM501_2D_DIMENSION); 1355 smc501_writel((width << 16) | height, fbi->regs2d + SM501_2D_DIMENSION);
1351 1356
1352 /* do area move */ 1357 /* do area move */
1353 writel(0x800000cc | rtl, fbi->regs2d + SM501_2D_CONTROL); 1358 smc501_writel(0x800000cc | rtl, fbi->regs2d + SM501_2D_CONTROL);
1354} 1359}
1355 1360
1356static void sm501fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) 1361static void sm501fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
@@ -1372,47 +1377,49 @@ static void sm501fb_fillrect(struct fb_info *info, const struct fb_fillrect *rec
1372 return; 1377 return;
1373 1378
1374 /* set the base addresses */ 1379 /* set the base addresses */
1375 writel(par->screen.sm_addr, fbi->regs2d + SM501_2D_SOURCE_BASE); 1380 smc501_writel(par->screen.sm_addr, fbi->regs2d + SM501_2D_SOURCE_BASE);
1376 writel(par->screen.sm_addr, fbi->regs2d + SM501_2D_DESTINATION_BASE); 1381 smc501_writel(par->screen.sm_addr,
1382 fbi->regs2d + SM501_2D_DESTINATION_BASE);
1377 1383
1378 /* set the window width */ 1384 /* set the window width */
1379 writel((info->var.xres << 16) | info->var.xres, 1385 smc501_writel((info->var.xres << 16) | info->var.xres,
1380 fbi->regs2d + SM501_2D_WINDOW_WIDTH); 1386 fbi->regs2d + SM501_2D_WINDOW_WIDTH);
1381 1387
1382 /* set window stride */ 1388 /* set window stride */
1383 writel((info->var.xres_virtual << 16) | info->var.xres_virtual, 1389 smc501_writel((info->var.xres_virtual << 16) | info->var.xres_virtual,
1384 fbi->regs2d + SM501_2D_PITCH); 1390 fbi->regs2d + SM501_2D_PITCH);
1385 1391
1386 /* set data format */ 1392 /* set data format */
1387 switch (info->var.bits_per_pixel) { 1393 switch (info->var.bits_per_pixel) {
1388 case 8: 1394 case 8:
1389 writel(0, fbi->regs2d + SM501_2D_STRETCH); 1395 smc501_writel(0, fbi->regs2d + SM501_2D_STRETCH);
1390 break; 1396 break;
1391 case 16: 1397 case 16:
1392 writel(0x00100000, fbi->regs2d + SM501_2D_STRETCH); 1398 smc501_writel(0x00100000, fbi->regs2d + SM501_2D_STRETCH);
1393 break; 1399 break;
1394 case 32: 1400 case 32:
1395 writel(0x00200000, fbi->regs2d + SM501_2D_STRETCH); 1401 smc501_writel(0x00200000, fbi->regs2d + SM501_2D_STRETCH);
1396 break; 1402 break;
1397 } 1403 }
1398 1404
1399 /* 2d compare mask */ 1405 /* 2d compare mask */
1400 writel(0xffffffff, fbi->regs2d + SM501_2D_COLOR_COMPARE_MASK); 1406 smc501_writel(0xffffffff, fbi->regs2d + SM501_2D_COLOR_COMPARE_MASK);
1401 1407
1402 /* 2d mask */ 1408 /* 2d mask */
1403 writel(0xffffffff, fbi->regs2d + SM501_2D_MASK); 1409 smc501_writel(0xffffffff, fbi->regs2d + SM501_2D_MASK);
1404 1410
1405 /* colour */ 1411 /* colour */
1406 writel(rect->color, fbi->regs2d + SM501_2D_FOREGROUND); 1412 smc501_writel(rect->color, fbi->regs2d + SM501_2D_FOREGROUND);
1407 1413
1408 /* x y */ 1414 /* x y */
1409 writel((rect->dx << 16) | rect->dy, fbi->regs2d + SM501_2D_DESTINATION); 1415 smc501_writel((rect->dx << 16) | rect->dy,
1416 fbi->regs2d + SM501_2D_DESTINATION);
1410 1417
1411 /* w/h */ 1418 /* w/h */
1412 writel((width << 16) | height, fbi->regs2d + SM501_2D_DIMENSION); 1419 smc501_writel((width << 16) | height, fbi->regs2d + SM501_2D_DIMENSION);
1413 1420
1414 /* do rectangle fill */ 1421 /* do rectangle fill */
1415 writel(0x800100cc, fbi->regs2d + SM501_2D_CONTROL); 1422 smc501_writel(0x800100cc, fbi->regs2d + SM501_2D_CONTROL);
1416} 1423}
1417 1424
1418 1425
@@ -1470,11 +1477,12 @@ static int sm501_init_cursor(struct fb_info *fbi, unsigned int reg_base)
1470 1477
1471 /* initialise the colour registers */ 1478 /* initialise the colour registers */
1472 1479
1473 writel(par->cursor.sm_addr, par->cursor_regs + SM501_OFF_HWC_ADDR); 1480 smc501_writel(par->cursor.sm_addr,
1481 par->cursor_regs + SM501_OFF_HWC_ADDR);
1474 1482
1475 writel(0x00, par->cursor_regs + SM501_OFF_HWC_LOC); 1483 smc501_writel(0x00, par->cursor_regs + SM501_OFF_HWC_LOC);
1476 writel(0x00, par->cursor_regs + SM501_OFF_HWC_COLOR_1_2); 1484 smc501_writel(0x00, par->cursor_regs + SM501_OFF_HWC_COLOR_1_2);
1477 writel(0x00, par->cursor_regs + SM501_OFF_HWC_COLOR_3); 1485 smc501_writel(0x00, par->cursor_regs + SM501_OFF_HWC_COLOR_3);
1478 sm501fb_sync_regs(info); 1486 sm501fb_sync_regs(info);
1479 1487
1480 return 0; 1488 return 0;
@@ -1581,7 +1589,7 @@ static int sm501fb_start(struct sm501fb_info *info,
1581 1589
1582 /* clear palette ram - undefined at power on */ 1590 /* clear palette ram - undefined at power on */
1583 for (k = 0; k < (256 * 3); k++) 1591 for (k = 0; k < (256 * 3); k++)
1584 writel(0, info->regs + SM501_DC_PANEL_PALETTE + (k * 4)); 1592 smc501_writel(0, info->regs + SM501_DC_PANEL_PALETTE + (k * 4));
1585 1593
1586 /* enable display controller */ 1594 /* enable display controller */
1587 sm501_unit_power(dev->parent, SM501_GATE_DISPLAY, 1); 1595 sm501_unit_power(dev->parent, SM501_GATE_DISPLAY, 1);
@@ -1649,20 +1657,20 @@ static int sm501fb_init_fb(struct fb_info *fb,
1649 switch (head) { 1657 switch (head) {
1650 case HEAD_CRT: 1658 case HEAD_CRT:
1651 pd = info->pdata->fb_crt; 1659 pd = info->pdata->fb_crt;
1652 ctrl = readl(info->regs + SM501_DC_CRT_CONTROL); 1660 ctrl = smc501_readl(info->regs + SM501_DC_CRT_CONTROL);
1653 enable = (ctrl & SM501_DC_CRT_CONTROL_ENABLE) ? 1 : 0; 1661 enable = (ctrl & SM501_DC_CRT_CONTROL_ENABLE) ? 1 : 0;
1654 1662
1655 /* ensure we set the correct source register */ 1663 /* ensure we set the correct source register */
1656 if (info->pdata->fb_route != SM501_FB_CRT_PANEL) { 1664 if (info->pdata->fb_route != SM501_FB_CRT_PANEL) {
1657 ctrl |= SM501_DC_CRT_CONTROL_SEL; 1665 ctrl |= SM501_DC_CRT_CONTROL_SEL;
1658 writel(ctrl, info->regs + SM501_DC_CRT_CONTROL); 1666 smc501_writel(ctrl, info->regs + SM501_DC_CRT_CONTROL);
1659 } 1667 }
1660 1668
1661 break; 1669 break;
1662 1670
1663 case HEAD_PANEL: 1671 case HEAD_PANEL:
1664 pd = info->pdata->fb_pnl; 1672 pd = info->pdata->fb_pnl;
1665 ctrl = readl(info->regs + SM501_DC_PANEL_CONTROL); 1673 ctrl = smc501_readl(info->regs + SM501_DC_PANEL_CONTROL);
1666 enable = (ctrl & SM501_DC_PANEL_CONTROL_EN) ? 1 : 0; 1674 enable = (ctrl & SM501_DC_PANEL_CONTROL_EN) ? 1 : 0;
1667 break; 1675 break;
1668 1676
@@ -1680,7 +1688,7 @@ static int sm501fb_init_fb(struct fb_info *fb,
1680 1688
1681 if (head == HEAD_CRT && info->pdata->fb_route == SM501_FB_CRT_PANEL) { 1689 if (head == HEAD_CRT && info->pdata->fb_route == SM501_FB_CRT_PANEL) {
1682 ctrl &= ~SM501_DC_CRT_CONTROL_SEL; 1690 ctrl &= ~SM501_DC_CRT_CONTROL_SEL;
1683 writel(ctrl, info->regs + SM501_DC_CRT_CONTROL); 1691 smc501_writel(ctrl, info->regs + SM501_DC_CRT_CONTROL);
1684 enable = 0; 1692 enable = 0;
1685 } 1693 }
1686 1694
@@ -2085,7 +2093,7 @@ static int sm501fb_suspend(struct platform_device *pdev, pm_message_t state)
2085 struct sm501fb_info *info = platform_get_drvdata(pdev); 2093 struct sm501fb_info *info = platform_get_drvdata(pdev);
2086 2094
2087 /* store crt control to resume with */ 2095 /* store crt control to resume with */
2088 info->pm_crt_ctrl = readl(info->regs + SM501_DC_CRT_CONTROL); 2096 info->pm_crt_ctrl = smc501_readl(info->regs + SM501_DC_CRT_CONTROL);
2089 2097
2090 sm501fb_suspend_fb(info, HEAD_CRT); 2098 sm501fb_suspend_fb(info, HEAD_CRT);
2091 sm501fb_suspend_fb(info, HEAD_PANEL); 2099 sm501fb_suspend_fb(info, HEAD_PANEL);
@@ -2109,10 +2117,10 @@ static int sm501fb_resume(struct platform_device *pdev)
2109 2117
2110 /* restore the items we want to be saved for crt control */ 2118 /* restore the items we want to be saved for crt control */
2111 2119
2112 crt_ctrl = readl(info->regs + SM501_DC_CRT_CONTROL); 2120 crt_ctrl = smc501_readl(info->regs + SM501_DC_CRT_CONTROL);
2113 crt_ctrl &= ~SM501_CRT_CTRL_SAVE; 2121 crt_ctrl &= ~SM501_CRT_CTRL_SAVE;
2114 crt_ctrl |= info->pm_crt_ctrl & SM501_CRT_CTRL_SAVE; 2122 crt_ctrl |= info->pm_crt_ctrl & SM501_CRT_CTRL_SAVE;
2115 writel(crt_ctrl, info->regs + SM501_DC_CRT_CONTROL); 2123 smc501_writel(crt_ctrl, info->regs + SM501_DC_CRT_CONTROL);
2116 2124
2117 sm501fb_resume_fb(info, HEAD_CRT); 2125 sm501fb_resume_fb(info, HEAD_CRT);
2118 sm501fb_resume_fb(info, HEAD_PANEL); 2126 sm501fb_resume_fb(info, HEAD_PANEL);