aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/cobalt_lcdfb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/cobalt_lcdfb.c')
-rw-r--r--drivers/video/cobalt_lcdfb.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/video/cobalt_lcdfb.c b/drivers/video/cobalt_lcdfb.c
index f56699d8122..eae46f6457e 100644
--- a/drivers/video/cobalt_lcdfb.c
+++ b/drivers/video/cobalt_lcdfb.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * Cobalt server LCD frame buffer driver. 2 * Cobalt/SEAD3 LCD frame buffer driver.
3 * 3 *
4 * Copyright (C) 2008 Yoichi Yuasa <yuasa@linux-mips.org> 4 * Copyright (C) 2008 Yoichi Yuasa <yuasa@linux-mips.org>
5 * Copyright (C) 2012 MIPS Technologies, Inc.
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -62,6 +63,7 @@
62#define LCD_CUR_POS(x) ((x) & LCD_CUR_POS_MASK) 63#define LCD_CUR_POS(x) ((x) & LCD_CUR_POS_MASK)
63#define LCD_TEXT_POS(x) ((x) | LCD_TEXT_MODE) 64#define LCD_TEXT_POS(x) ((x) | LCD_TEXT_MODE)
64 65
66#ifdef CONFIG_MIPS_COBALT
65static inline void lcd_write_control(struct fb_info *info, u8 control) 67static inline void lcd_write_control(struct fb_info *info, u8 control)
66{ 68{
67 writel((u32)control << 24, info->screen_base); 69 writel((u32)control << 24, info->screen_base);
@@ -81,6 +83,47 @@ static inline u8 lcd_read_data(struct fb_info *info)
81{ 83{
82 return readl(info->screen_base + LCD_DATA_REG_OFFSET) >> 24; 84 return readl(info->screen_base + LCD_DATA_REG_OFFSET) >> 24;
83} 85}
86#else
87
88#define LCD_CTL 0x00
89#define LCD_DATA 0x08
90#define CPLD_STATUS 0x10
91#define CPLD_DATA 0x18
92
93static inline void cpld_wait(struct fb_info *info)
94{
95 do {
96 } while (readl(info->screen_base + CPLD_STATUS) & 1);
97}
98
99static inline void lcd_write_control(struct fb_info *info, u8 control)
100{
101 cpld_wait(info);
102 writel(control, info->screen_base + LCD_CTL);
103}
104
105static inline u8 lcd_read_control(struct fb_info *info)
106{
107 cpld_wait(info);
108 readl(info->screen_base + LCD_CTL);
109 cpld_wait(info);
110 return readl(info->screen_base + CPLD_DATA) & 0xff;
111}
112
113static inline void lcd_write_data(struct fb_info *info, u8 data)
114{
115 cpld_wait(info);
116 writel(data, info->screen_base + LCD_DATA);
117}
118
119static inline u8 lcd_read_data(struct fb_info *info)
120{
121 cpld_wait(info);
122 readl(info->screen_base + LCD_DATA);
123 cpld_wait(info);
124 return readl(info->screen_base + CPLD_DATA) & 0xff;
125}
126#endif
84 127
85static int lcd_busy_wait(struct fb_info *info) 128static int lcd_busy_wait(struct fb_info *info)
86{ 129{