diff options
author | Magnus Damm <damm@opensource.se> | 2010-11-17 01:44:25 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-11-19 03:02:35 -0500 |
commit | 71b146c815ed6034bc20a0ec265445bdf4bad78c (patch) | |
tree | 508debb0569c330851f79329cdddd2138b12872a /drivers/video/sh_mipi_dsi.c | |
parent | 0a5b871ea4c6bfb2723ac2ffc7ef5c32452abb89 (diff) |
fbdev: sh_mipi_dsi: Make use of register names
Keep MIPI-DSI registers in one place instead of
using magic values together with comments.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video/sh_mipi_dsi.c')
-rw-r--r-- | drivers/video/sh_mipi_dsi.c | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index 3f3d431033ca..8abab6d4264f 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c | |||
@@ -21,10 +21,26 @@ | |||
21 | #include <video/sh_mipi_dsi.h> | 21 | #include <video/sh_mipi_dsi.h> |
22 | #include <video/sh_mobile_lcdc.h> | 22 | #include <video/sh_mobile_lcdc.h> |
23 | 23 | ||
24 | #define CMTSRTCTR 0x80d0 | 24 | #define SYSCTRL 0x0000 |
25 | #define SYSCONF 0x0004 | ||
26 | #define TIMSET 0x0008 | ||
27 | #define RESREQSET0 0x0018 | ||
28 | #define RESREQSET1 0x001c | ||
29 | #define HSTTOVSET 0x0020 | ||
30 | #define LPRTOVSET 0x0024 | ||
31 | #define TATOVSET 0x0028 | ||
32 | #define PRTOVSET 0x002c | ||
33 | #define DSICTRL 0x0030 | ||
34 | #define DSIINTE 0x0060 | ||
35 | #define PHYCTRL 0x0070 | ||
36 | |||
37 | #define DTCTR 0x8000 | ||
38 | #define VMCTR1 0x8020 | ||
39 | #define VMCTR2 0x8024 | ||
40 | #define VMLEN1 0x8028 | ||
25 | #define CMTSRTREQ 0x8070 | 41 | #define CMTSRTREQ 0x8070 |
42 | #define CMTSRTCTR 0x80d0 | ||
26 | 43 | ||
27 | #define DSIINTE 0x0060 | ||
28 | 44 | ||
29 | /* E.g., sh7372 has 2 MIPI-DSIs - one for each LCDC */ | 45 | /* E.g., sh7372 has 2 MIPI-DSIs - one for each LCDC */ |
30 | #define MAX_SH_MIPI_DSI 2 | 46 | #define MAX_SH_MIPI_DSI 2 |
@@ -55,10 +71,10 @@ static int sh_mipi_send_short(struct sh_mipi *mipi, u8 dsi_cmd, | |||
55 | int cnt = 100; | 71 | int cnt = 100; |
56 | 72 | ||
57 | /* transmit a short packet to LCD panel */ | 73 | /* transmit a short packet to LCD panel */ |
58 | iowrite32(1 | data, mipi->base + 0x80d0); /* CMTSRTCTR */ | 74 | iowrite32(1 | data, mipi->base + CMTSRTCTR); |
59 | iowrite32(1, mipi->base + 0x8070); /* CMTSRTREQ */ | 75 | iowrite32(1, mipi->base + CMTSRTREQ); |
60 | 76 | ||
61 | while ((ioread32(mipi->base + 0x8070) & 1) && --cnt) | 77 | while ((ioread32(mipi->base + CMTSRTREQ) & 1) && --cnt) |
62 | udelay(1); | 78 | udelay(1); |
63 | 79 | ||
64 | return cnt ? 0 : -ETIMEDOUT; | 80 | return cnt ? 0 : -ETIMEDOUT; |
@@ -90,7 +106,7 @@ static void sh_mipi_dsi_enable(struct sh_mipi *mipi, bool enable) | |||
90 | * enable LCDC data tx, transition to LPS after completion of each HS | 106 | * enable LCDC data tx, transition to LPS after completion of each HS |
91 | * packet | 107 | * packet |
92 | */ | 108 | */ |
93 | iowrite32(0x00000002 | enable, mipi->base + 0x8000); /* DTCTR */ | 109 | iowrite32(0x00000002 | enable, mipi->base + DTCTR); |
94 | } | 110 | } |
95 | 111 | ||
96 | static void sh_mipi_shutdown(struct platform_device *pdev) | 112 | static void sh_mipi_shutdown(struct platform_device *pdev) |
@@ -223,10 +239,10 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, | |||
223 | return -EINVAL; | 239 | return -EINVAL; |
224 | 240 | ||
225 | /* reset DSI link */ | 241 | /* reset DSI link */ |
226 | iowrite32(0x00000001, base); /* SYSCTRL */ | 242 | iowrite32(0x00000001, base + SYSCTRL); |
227 | /* Hold reset for 100 cycles of the slowest of bus, HS byte and LP clock */ | 243 | /* Hold reset for 100 cycles of the slowest of bus, HS byte and LP clock */ |
228 | udelay(50); | 244 | udelay(50); |
229 | iowrite32(0x00000000, base); /* SYSCTRL */ | 245 | iowrite32(0x00000000, base + SYSCTRL); |
230 | 246 | ||
231 | /* setup DSI link */ | 247 | /* setup DSI link */ |
232 | 248 | ||
@@ -238,7 +254,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, | |||
238 | * ECC check enable | 254 | * ECC check enable |
239 | * additionally enable first two lanes | 255 | * additionally enable first two lanes |
240 | */ | 256 | */ |
241 | iowrite32(0x00003703, base + 0x04); /* SYSCONF */ | 257 | iowrite32(0x00003703, base + SYSCONF); |
242 | /* | 258 | /* |
243 | * T_wakeup = 0x7000 | 259 | * T_wakeup = 0x7000 |
244 | * T_hs-trail = 3 | 260 | * T_hs-trail = 3 |
@@ -246,28 +262,28 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, | |||
246 | * T_clk-trail = 3 | 262 | * T_clk-trail = 3 |
247 | * T_clk-prepare = 2 | 263 | * T_clk-prepare = 2 |
248 | */ | 264 | */ |
249 | iowrite32(0x70003332, base + 0x08); /* TIMSET */ | 265 | iowrite32(0x70003332, base + TIMSET); |
250 | /* no responses requested */ | 266 | /* no responses requested */ |
251 | iowrite32(0x00000000, base + 0x18); /* RESREQSET0 */ | 267 | iowrite32(0x00000000, base + RESREQSET0); |
252 | /* request response to packets of type 0x28 */ | 268 | /* request response to packets of type 0x28 */ |
253 | iowrite32(0x00000100, base + 0x1c); /* RESREQSET1 */ | 269 | iowrite32(0x00000100, base + RESREQSET1); |
254 | /* High-speed transmission timeout, default 0xffffffff */ | 270 | /* High-speed transmission timeout, default 0xffffffff */ |
255 | iowrite32(0x0fffffff, base + 0x20); /* HSTTOVSET */ | 271 | iowrite32(0x0fffffff, base + HSTTOVSET); |
256 | /* LP reception timeout, default 0xffffffff */ | 272 | /* LP reception timeout, default 0xffffffff */ |
257 | iowrite32(0x0fffffff, base + 0x24); /* LPRTOVSET */ | 273 | iowrite32(0x0fffffff, base + LPRTOVSET); |
258 | /* Turn-around timeout, default 0xffffffff */ | 274 | /* Turn-around timeout, default 0xffffffff */ |
259 | iowrite32(0x0fffffff, base + 0x28); /* TATOVSET */ | 275 | iowrite32(0x0fffffff, base + TATOVSET); |
260 | /* Peripheral reset timeout, default 0xffffffff */ | 276 | /* Peripheral reset timeout, default 0xffffffff */ |
261 | iowrite32(0x0fffffff, base + 0x2c); /* PRTOVSET */ | 277 | iowrite32(0x0fffffff, base + PRTOVSET); |
262 | /* Enable timeout counters */ | 278 | /* Enable timeout counters */ |
263 | iowrite32(0x00000f00, base + 0x30); /* DSICTRL */ | 279 | iowrite32(0x00000f00, base + DSICTRL); |
264 | /* Interrupts not used, disable all */ | 280 | /* Interrupts not used, disable all */ |
265 | iowrite32(0, base + DSIINTE); | 281 | iowrite32(0, base + DSIINTE); |
266 | /* DSI-Tx bias on */ | 282 | /* DSI-Tx bias on */ |
267 | iowrite32(0x00000001, base + 0x70); /* PHYCTRL */ | 283 | iowrite32(0x00000001, base + PHYCTRL); |
268 | udelay(200); | 284 | udelay(200); |
269 | /* Deassert resets, power on, set multiplier */ | 285 | /* Deassert resets, power on, set multiplier */ |
270 | iowrite32(0x03070b01, base + 0x70); /* PHYCTRL */ | 286 | iowrite32(0x03070b01, base + PHYCTRL); |
271 | 287 | ||
272 | /* setup l-bridge */ | 288 | /* setup l-bridge */ |
273 | 289 | ||
@@ -275,20 +291,20 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, | |||
275 | * Enable transmission of all packets, | 291 | * Enable transmission of all packets, |
276 | * transmit LPS after each HS packet completion | 292 | * transmit LPS after each HS packet completion |
277 | */ | 293 | */ |
278 | iowrite32(0x00000006, base + 0x8000); /* DTCTR */ | 294 | iowrite32(0x00000006, base + DTCTR); |
279 | /* VSYNC width = 2 (<< 17) */ | 295 | /* VSYNC width = 2 (<< 17) */ |
280 | iowrite32(0x00040000 | (pctype << 12) | datatype, base + 0x8020); /* VMCTR1 */ | 296 | iowrite32(0x00040000 | (pctype << 12) | datatype, base + VMCTR1); |
281 | /* | 297 | /* |
282 | * Non-burst mode with sync pulses: VSE and HSE are output, | 298 | * Non-burst mode with sync pulses: VSE and HSE are output, |
283 | * HSA period allowed, no commands in LP | 299 | * HSA period allowed, no commands in LP |
284 | */ | 300 | */ |
285 | iowrite32(0x00e00000, base + 0x8024); /* VMCTR2 */ | 301 | iowrite32(0x00e00000, base + VMCTR2); |
286 | /* | 302 | /* |
287 | * 0x660 = 1632 bytes per line (RGB24, 544 pixels: see | 303 | * 0x660 = 1632 bytes per line (RGB24, 544 pixels: see |
288 | * sh_mobile_lcdc_info.ch[0].lcd_cfg[0].xres), HSALEN = 1 - default | 304 | * sh_mobile_lcdc_info.ch[0].lcd_cfg[0].xres), HSALEN = 1 - default |
289 | * (unused, since VMCTR2[HSABM] = 0) | 305 | * (unused, since VMCTR2[HSABM] = 0) |
290 | */ | 306 | */ |
291 | iowrite32(1 | (linelength << 16), base + 0x8028); /* VMLEN1 */ | 307 | iowrite32(1 | (linelength << 16), base + VMLEN1); |
292 | 308 | ||
293 | msleep(5); | 309 | msleep(5); |
294 | 310 | ||