aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-13 12:49:04 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-13 12:49:04 -0400
commitdcf397f037f52add9945eced57ca300ab6a4413c (patch)
treee78767d164589e9097a54bf564b072fb01f80820 /drivers
parent6faf035cf9fdd8283c2b2b2c34b76b5445ec6fc4 (diff)
parent68ee0f9c98a42e36f9eab29155b2bb0e7e409ac6 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (124 commits) sh: allow building for both r2d boards in same binary. sh: fix r2d board detection sh: Discard .exit.text/.exit.data at runtime. sh: Fix up some section alignments in linker script. sh: Fix SH-4 DMAC CHCR masking. sh: Rip out left-over nommu cond syscall cruft. sh: Make kgdb i-cache flushing less inept. sh: kgdb section mismatches and tidying. sh: cleanup struct irqaction initializers. sh: early_printk tidying. video: pvr2fb: Add TV (RGB) support to Dreamcast PVR driver. sh: Conditionalize gUSA support. sh: Follow gUSA preempt changes in __switch_to(). sh: Tidy up gUSA preempt handling. sh: __copy_user() optimizations for small copies. sh: clkfwk: Support multi-level clock propagation. sh: Fix URAM start address on SH7785. sh: Use boot_cpu_data for CPU probe. sh: Support extended mode TLB on SH-X3. sh: Bump MAX_ACTIVE_REGIONS for SH7785. ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-sh.c51
-rw-r--r--drivers/serial/sh-sci.c39
-rw-r--r--drivers/serial/sh-sci.h34
-rw-r--r--drivers/sh/Makefile4
-rw-r--r--drivers/sh/maple/Makefile3
-rw-r--r--drivers/sh/maple/maple.c735
-rw-r--r--drivers/video/backlight/hp680_bl.c4
-rw-r--r--drivers/video/pvr2fb.c4
8 files changed, 839 insertions, 35 deletions
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index 93ee05eeaeba..78277a118b67 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SuperH On-Chip RTC Support 2 * SuperH On-Chip RTC Support
3 * 3 *
4 * Copyright (C) 2006 Paul Mundt 4 * Copyright (C) 2006, 2007 Paul Mundt
5 * Copyright (C) 2006 Jamie Lenehan 5 * Copyright (C) 2006 Jamie Lenehan
6 * 6 *
7 * Based on the old arch/sh/kernel/cpu/rtc.c by: 7 * Based on the old arch/sh/kernel/cpu/rtc.c by:
@@ -23,16 +23,19 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <asm/rtc.h>
26 27
27#define DRV_NAME "sh-rtc" 28#define DRV_NAME "sh-rtc"
28#define DRV_VERSION "0.1.2" 29#define DRV_VERSION "0.1.3"
29 30
30#ifdef CONFIG_CPU_SH3 31#ifdef CONFIG_CPU_SH3
31#define rtc_reg_size sizeof(u16) 32#define rtc_reg_size sizeof(u16)
32#define RTC_BIT_INVERTED 0 /* No bug on SH7708, SH7709A */ 33#define RTC_BIT_INVERTED 0 /* No bug on SH7708, SH7709A */
34#define RTC_DEF_CAPABILITIES 0UL
33#elif defined(CONFIG_CPU_SH4) 35#elif defined(CONFIG_CPU_SH4)
34#define rtc_reg_size sizeof(u32) 36#define rtc_reg_size sizeof(u32)
35#define RTC_BIT_INVERTED 0x40 /* bug on SH7750, SH7750S */ 37#define RTC_BIT_INVERTED 0x40 /* bug on SH7750, SH7750S */
38#define RTC_DEF_CAPABILITIES RTC_CAP_4_DIGIT_YEAR
36#endif 39#endif
37 40
38#define RTC_REG(r) ((r) * rtc_reg_size) 41#define RTC_REG(r) ((r) * rtc_reg_size)
@@ -80,6 +83,7 @@ struct sh_rtc {
80 struct rtc_device *rtc_dev; 83 struct rtc_device *rtc_dev;
81 spinlock_t lock; 84 spinlock_t lock;
82 int rearm_aie; 85 int rearm_aie;
86 unsigned long capabilities; /* See asm-sh/rtc.h for cap bits */
83}; 87};
84 88
85static irqreturn_t sh_rtc_interrupt(int irq, void *dev_id) 89static irqreturn_t sh_rtc_interrupt(int irq, void *dev_id)
@@ -319,14 +323,14 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)
319 tm->tm_mday = BCD2BIN(readb(rtc->regbase + RDAYCNT)); 323 tm->tm_mday = BCD2BIN(readb(rtc->regbase + RDAYCNT));
320 tm->tm_mon = BCD2BIN(readb(rtc->regbase + RMONCNT)) - 1; 324 tm->tm_mon = BCD2BIN(readb(rtc->regbase + RMONCNT)) - 1;
321 325
322#if defined(CONFIG_CPU_SH4) 326 if (rtc->capabilities & RTC_CAP_4_DIGIT_YEAR) {
323 yr = readw(rtc->regbase + RYRCNT); 327 yr = readw(rtc->regbase + RYRCNT);
324 yr100 = BCD2BIN(yr >> 8); 328 yr100 = BCD2BIN(yr >> 8);
325 yr &= 0xff; 329 yr &= 0xff;
326#else 330 } else {
327 yr = readb(rtc->regbase + RYRCNT); 331 yr = readb(rtc->regbase + RYRCNT);
328 yr100 = BCD2BIN((yr == 0x99) ? 0x19 : 0x20); 332 yr100 = BCD2BIN((yr == 0x99) ? 0x19 : 0x20);
329#endif 333 }
330 334
331 tm->tm_year = (yr100 * 100 + BCD2BIN(yr)) - 1900; 335 tm->tm_year = (yr100 * 100 + BCD2BIN(yr)) - 1900;
332 336
@@ -375,14 +379,14 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm)
375 writeb(BIN2BCD(tm->tm_mday), rtc->regbase + RDAYCNT); 379 writeb(BIN2BCD(tm->tm_mday), rtc->regbase + RDAYCNT);
376 writeb(BIN2BCD(tm->tm_mon + 1), rtc->regbase + RMONCNT); 380 writeb(BIN2BCD(tm->tm_mon + 1), rtc->regbase + RMONCNT);
377 381
378#ifdef CONFIG_CPU_SH3 382 if (rtc->capabilities & RTC_CAP_4_DIGIT_YEAR) {
379 year = tm->tm_year % 100; 383 year = (BIN2BCD((tm->tm_year + 1900) / 100) << 8) |
380 writeb(BIN2BCD(year), rtc->regbase + RYRCNT); 384 BIN2BCD(tm->tm_year % 100);
381#else 385 writew(year, rtc->regbase + RYRCNT);
382 year = (BIN2BCD((tm->tm_year + 1900) / 100) << 8) | 386 } else {
383 BIN2BCD(tm->tm_year % 100); 387 year = tm->tm_year % 100;
384 writew(year, rtc->regbase + RYRCNT); 388 writeb(BIN2BCD(year), rtc->regbase + RYRCNT);
385#endif 389 }
386 390
387 /* Start RTC */ 391 /* Start RTC */
388 tmp = readb(rtc->regbase + RCR2); 392 tmp = readb(rtc->regbase + RCR2);
@@ -589,6 +593,17 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev)
589 goto err_badmap; 593 goto err_badmap;
590 } 594 }
591 595
596 rtc->capabilities = RTC_DEF_CAPABILITIES;
597 if (pdev->dev.platform_data) {
598 struct sh_rtc_platform_info *pinfo = pdev->dev.platform_data;
599
600 /*
601 * Some CPUs have special capabilities in addition to the
602 * default set. Add those in here.
603 */
604 rtc->capabilities |= pinfo->capabilities;
605 }
606
592 platform_set_drvdata(pdev, rtc); 607 platform_set_drvdata(pdev, rtc);
593 608
594 return 0; 609 return 0;
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 053fca41b08a..73440e26834b 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -4,6 +4,7 @@
4 * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) 4 * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO)
5 * 5 *
6 * Copyright (C) 2002 - 2006 Paul Mundt 6 * Copyright (C) 2002 - 2006 Paul Mundt
7 * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007).
7 * 8 *
8 * based off of the old drivers/char/sh-sci.c by: 9 * based off of the old drivers/char/sh-sci.c by:
9 * 10 *
@@ -301,6 +302,38 @@ static void sci_init_pins_scif(struct uart_port* port, unsigned int cflag)
301 } 302 }
302 sci_out(port, SCFCR, fcr_val); 303 sci_out(port, SCFCR, fcr_val);
303} 304}
305#elif defined(CONFIG_CPU_SUBTYPE_SH7720)
306static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
307{
308 unsigned int fcr_val = 0;
309 unsigned short data;
310
311 if (cflag & CRTSCTS) {
312 /* enable RTS/CTS */
313 if (port->mapbase == 0xa4430000) { /* SCIF0 */
314 /* Clear PTCR bit 9-2; enable all scif pins but sck */
315 data = ctrl_inw(PORT_PTCR);
316 ctrl_outw((data & 0xfc03), PORT_PTCR);
317 } else if (port->mapbase == 0xa4438000) { /* SCIF1 */
318 /* Clear PVCR bit 9-2 */
319 data = ctrl_inw(PORT_PVCR);
320 ctrl_outw((data & 0xfc03), PORT_PVCR);
321 }
322 fcr_val |= SCFCR_MCE;
323 } else {
324 if (port->mapbase == 0xa4430000) { /* SCIF0 */
325 /* Clear PTCR bit 5-2; enable only tx and rx */
326 data = ctrl_inw(PORT_PTCR);
327 ctrl_outw((data & 0xffc3), PORT_PTCR);
328 } else if (port->mapbase == 0xa4438000) { /* SCIF1 */
329 /* Clear PVCR bit 5-2 */
330 data = ctrl_inw(PORT_PVCR);
331 ctrl_outw((data & 0xffc3), PORT_PVCR);
332 }
333 }
334 sci_out(port, SCFCR, fcr_val);
335}
336
304#elif defined(CONFIG_CPU_SH3) 337#elif defined(CONFIG_CPU_SH3)
305/* For SH7705, SH7706, SH7707, SH7709, SH7709A, SH7729 */ 338/* For SH7705, SH7706, SH7707, SH7709, SH7709A, SH7729 */
306static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) 339static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
@@ -1276,7 +1309,7 @@ static int __init sci_console_init(void)
1276console_initcall(sci_console_init); 1309console_initcall(sci_console_init);
1277#endif /* CONFIG_SERIAL_SH_SCI_CONSOLE */ 1310#endif /* CONFIG_SERIAL_SH_SCI_CONSOLE */
1278 1311
1279#ifdef CONFIG_SH_KGDB 1312#ifdef CONFIG_SH_KGDB_CONSOLE
1280/* 1313/*
1281 * FIXME: Most of this can go away.. at the moment, we rely on 1314 * FIXME: Most of this can go away.. at the moment, we rely on
1282 * arch/sh/kernel/setup.c to do the command line parsing for kgdb, though 1315 * arch/sh/kernel/setup.c to do the command line parsing for kgdb, though
@@ -1334,9 +1367,7 @@ int __init kgdb_console_setup(struct console *co, char *options)
1334 1367
1335 return uart_set_options(port, co, baud, parity, bits, flow); 1368 return uart_set_options(port, co, baud, parity, bits, flow);
1336} 1369}
1337#endif /* CONFIG_SH_KGDB */
1338 1370
1339#ifdef CONFIG_SH_KGDB_CONSOLE
1340static struct console kgdb_console = { 1371static struct console kgdb_console = {
1341 .name = "ttySC", 1372 .name = "ttySC",
1342 .device = uart_console_device, 1373 .device = uart_console_device,
@@ -1432,7 +1463,7 @@ static int __devinit sci_probe(struct platform_device *dev)
1432 1463
1433#ifdef CONFIG_CPU_FREQ 1464#ifdef CONFIG_CPU_FREQ
1434 cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER); 1465 cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER);
1435 dev_info(&dev->dev, "sci: CPU frequency notifier registered\n"); 1466 dev_info(&dev->dev, "CPU frequency notifier registered\n");
1436#endif 1467#endif
1437 1468
1438#ifdef CONFIG_SH_STANDARD_BIOS 1469#ifdef CONFIG_SH_STANDARD_BIOS
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index cf75466ebf57..e89ae29645d6 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -10,19 +10,19 @@
10 * Modified to support SH7300(SH-Mobile) SCIF. Takashi Kusuda (Jun 2003). 10 * Modified to support SH7300(SH-Mobile) SCIF. Takashi Kusuda (Jun 2003).
11 * Modified to support H8/300 Series Yoshinori Sato (Feb 2004). 11 * Modified to support H8/300 Series Yoshinori Sato (Feb 2004).
12 * Removed SH7300 support (Jul 2007). 12 * Removed SH7300 support (Jul 2007).
13 * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Aug 2007).
13 */ 14 */
14#include <linux/serial_core.h> 15#include <linux/serial_core.h>
15#include <asm/io.h> 16#include <asm/io.h>
16 17
17#if defined(__H8300H__) || defined(__H8300S__)
18#include <asm/gpio.h> 18#include <asm/gpio.h>
19
19#if defined(CONFIG_H83007) || defined(CONFIG_H83068) 20#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
20#include <asm/regs306x.h> 21#include <asm/regs306x.h>
21#endif 22#endif
22#if defined(CONFIG_H8S2678) 23#if defined(CONFIG_H8S2678)
23#include <asm/regs267x.h> 24#include <asm/regs267x.h>
24#endif 25#endif
25#endif
26 26
27#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \ 27#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
28 defined(CONFIG_CPU_SUBTYPE_SH7707) || \ 28 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
@@ -46,6 +46,10 @@
46 */ 46 */
47# define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0 47# define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0
48# define SCIF_ONLY 48# define SCIF_ONLY
49#elif defined(CONFIG_CPU_SUBTYPE_SH7720)
50# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */
51# define SCIF_ONLY
52#define SCIF_ORER 0x0200 /* overrun error bit */
49#elif defined(CONFIG_SH_RTS7751R2D) 53#elif defined(CONFIG_SH_RTS7751R2D)
50# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ 54# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
51# define SCIF_ORER 0x0001 /* overrun error bit */ 55# define SCIF_ORER 0x0001 /* overrun error bit */
@@ -217,7 +221,8 @@
217#define SCIF_RDF 0x0002 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */ 221#define SCIF_RDF 0x0002 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
218#define SCIF_DR 0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */ 222#define SCIF_DR 0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
219 223
220#if defined(CONFIG_CPU_SUBTYPE_SH7705) 224#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
225 defined(CONFIG_CPU_SUBTYPE_SH7720)
221#define SCIF_ORER 0x0200 226#define SCIF_ORER 0x0200
222#define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER) 227#define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER)
223#define SCIF_RFDC_MASK 0x007f 228#define SCIF_RFDC_MASK 0x007f
@@ -254,7 +259,8 @@
254# define SCxSR_FER(port) SCIF_FER 259# define SCxSR_FER(port) SCIF_FER
255# define SCxSR_PER(port) SCIF_PER 260# define SCxSR_PER(port) SCIF_PER
256# define SCxSR_BRK(port) SCIF_BRK 261# define SCxSR_BRK(port) SCIF_BRK
257#if defined(CONFIG_CPU_SUBTYPE_SH7705) 262#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
263 defined(CONFIG_CPU_SUBTYPE_SH7720)
258# define SCxSR_RDxF_CLEAR(port) (sci_in(port,SCxSR)&0xfffc) 264# define SCxSR_RDxF_CLEAR(port) (sci_in(port,SCxSR)&0xfffc)
259# define SCxSR_ERROR_CLEAR(port) (sci_in(port,SCxSR)&0xfd73) 265# define SCxSR_ERROR_CLEAR(port) (sci_in(port,SCxSR)&0xfd73)
260# define SCxSR_TDxE_CLEAR(port) (sci_in(port,SCxSR)&0xffdf) 266# define SCxSR_TDxE_CLEAR(port) (sci_in(port,SCxSR)&0xffdf)
@@ -362,7 +368,8 @@
362 CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size) 368 CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
363#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \ 369#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
364 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) 370 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
365#elif defined(CONFIG_CPU_SUBTYPE_SH7705) 371#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
372 defined(CONFIG_CPU_SUBTYPE_SH7720)
366#define SCIF_FNS(name, scif_offset, scif_size) \ 373#define SCIF_FNS(name, scif_offset, scif_size) \
367 CPU_SCIF_FNS(name, scif_offset, scif_size) 374 CPU_SCIF_FNS(name, scif_offset, scif_size)
368#else 375#else
@@ -388,7 +395,8 @@
388 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) 395 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
389#endif 396#endif
390 397
391#if defined(CONFIG_CPU_SUBTYPE_SH7705) 398#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
399 defined(CONFIG_CPU_SUBTYPE_SH7720)
392 400
393SCIF_FNS(SCSMR, 0x00, 16) 401SCIF_FNS(SCSMR, 0x00, 16)
394SCIF_FNS(SCBRR, 0x04, 8) 402SCIF_FNS(SCBRR, 0x04, 8)
@@ -510,7 +518,15 @@ static inline void set_sh771x_scif_pfc(struct uart_port *port)
510 return; 518 return;
511 } 519 }
512} 520}
513 521#elif defined(CONFIG_CPU_SUBTYPE_SH7720)
522static inline int sci_rxd_in(struct uart_port *port)
523{
524 if (port->mapbase == 0xa4430000)
525 return sci_in(port, SCxSR) & 0x0003 ? 1 : 0;
526 else if (port->mapbase == 0xa4438000)
527 return sci_in(port, SCxSR) & 0x0003 ? 1 : 0;
528 return 1;
529}
514#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \ 530#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
515 defined(CONFIG_CPU_SUBTYPE_SH7751) || \ 531 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
516 defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ 532 defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
@@ -653,6 +669,7 @@ static inline int sci_rxd_in(struct uart_port *port)
653 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 669 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
654 if (port->mapbase == 0xffc60000) 670 if (port->mapbase == 0xffc60000)
655 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 671 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
672 return 1;
656} 673}
657#endif 674#endif
658 675
@@ -691,7 +708,8 @@ static inline int sci_rxd_in(struct uart_port *port)
691#if defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 708#if defined(CONFIG_CPU_SUBTYPE_SH7780) || \
692 defined(CONFIG_CPU_SUBTYPE_SH7785) 709 defined(CONFIG_CPU_SUBTYPE_SH7785)
693#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1) 710#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
694#elif defined(CONFIG_CPU_SUBTYPE_SH7705) 711#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
712 defined(CONFIG_CPU_SUBTYPE_SH7720)
695#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) 713#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
696#elif defined(__H8300H__) || defined(__H8300S__) 714#elif defined(__H8300H__) || defined(__H8300S__)
697#define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1) 715#define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1)
diff --git a/drivers/sh/Makefile b/drivers/sh/Makefile
index 8a143894e33f..a96f4a8cfeb8 100644
--- a/drivers/sh/Makefile
+++ b/drivers/sh/Makefile
@@ -2,5 +2,5 @@
2# Makefile for the SuperH specific drivers. 2# Makefile for the SuperH specific drivers.
3# 3#
4 4
5obj-$(CONFIG_SUPERHYWAY) += superhyway/ 5obj-$(CONFIG_SUPERHYWAY) += superhyway/
6 6obj-$(CONFIG_MAPLE) += maple/
diff --git a/drivers/sh/maple/Makefile b/drivers/sh/maple/Makefile
new file mode 100644
index 000000000000..65dfeeb610ef
--- /dev/null
+++ b/drivers/sh/maple/Makefile
@@ -0,0 +1,3 @@
1# Makefile for Maple Bus
2
3obj-$(CONFIG_MAPLE) := maple.o
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
new file mode 100644
index 000000000000..161d1021b7eb
--- /dev/null
+++ b/drivers/sh/maple/maple.c
@@ -0,0 +1,735 @@
1/*
2 * Core maple bus functionality
3 *
4 * Copyright (C) 2007 Adrian McMenamin
5 *
6 * Based on 2.4 code by:
7 *
8 * Copyright (C) 2000-2001 YAEGASHI Takeshi
9 * Copyright (C) 2001 M. R. Brown
10 * Copyright (C) 2001 Paul Mundt
11 *
12 * and others.
13 *
14 * This file is subject to the terms and conditions of the GNU General Public
15 * License. See the file "COPYING" in the main directory of this archive
16 * for more details.
17 */
18#include <linux/init.h>
19#include <linux/kernel.h>
20#include <linux/device.h>
21#include <linux/module.h>
22#include <linux/interrupt.h>
23#include <linux/list.h>
24#include <linux/io.h>
25#include <linux/slab.h>
26#include <linux/maple.h>
27#include <linux/dma-mapping.h>
28#include <asm/cacheflush.h>
29#include <asm/dma.h>
30#include <asm/io.h>
31#include <asm/mach/dma.h>
32#include <asm/mach/sysasic.h>
33#include <asm/mach/maple.h>
34
35MODULE_AUTHOR("Yaegshi Takeshi, Paul Mundt, M.R. Brown, Adrian McMenamin");
36MODULE_DESCRIPTION("Maple bus driver for Dreamcast");
37MODULE_LICENSE("GPL v2");
38MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}");
39
40static void maple_dma_handler(struct work_struct *work);
41static void maple_vblank_handler(struct work_struct *work);
42
43static DECLARE_WORK(maple_dma_process, maple_dma_handler);
44static DECLARE_WORK(maple_vblank_process, maple_vblank_handler);
45
46static LIST_HEAD(maple_waitq);
47static LIST_HEAD(maple_sentq);
48
49static DEFINE_MUTEX(maple_list_lock);
50
51static struct maple_driver maple_dummy_driver;
52static struct device maple_bus;
53static int subdevice_map[MAPLE_PORTS];
54static unsigned long *maple_sendbuf, *maple_sendptr, *maple_lastptr;
55static unsigned long maple_pnp_time;
56static int started, scanning, liststatus;
57static struct kmem_cache *maple_queue_cache;
58
59struct maple_device_specify {
60 int port;
61 int unit;
62};
63
64/**
65 * maple_driver_register - register a device driver
66 * automatically makes the driver bus a maple bus
67 * @drv: the driver to be registered
68 */
69int maple_driver_register(struct device_driver *drv)
70{
71 if (!drv)
72 return -EINVAL;
73 drv->bus = &maple_bus_type;
74 return driver_register(drv);
75}
76EXPORT_SYMBOL_GPL(maple_driver_register);
77
78/* set hardware registers to enable next round of dma */
79static void maplebus_dma_reset(void)
80{
81 ctrl_outl(MAPLE_MAGIC, MAPLE_RESET);
82 /* set trig type to 0 for software trigger, 1 for hardware (VBLANK) */
83 ctrl_outl(1, MAPLE_TRIGTYPE);
84 ctrl_outl(MAPLE_2MBPS | MAPLE_TIMEOUT(50000), MAPLE_SPEED);
85 ctrl_outl(PHYSADDR(maple_sendbuf), MAPLE_DMAADDR);
86 ctrl_outl(1, MAPLE_ENABLE);
87}
88
89/**
90 * maple_getcond_callback - setup handling MAPLE_COMMAND_GETCOND
91 * @dev: device responding
92 * @callback: handler callback
93 * @interval: interval in jiffies between callbacks
94 * @function: the function code for the device
95 */
96void maple_getcond_callback(struct maple_device *dev,
97 void (*callback) (struct mapleq * mq),
98 unsigned long interval, unsigned long function)
99{
100 dev->callback = callback;
101 dev->interval = interval;
102 dev->function = cpu_to_be32(function);
103 dev->when = jiffies;
104}
105EXPORT_SYMBOL_GPL(maple_getcond_callback);
106
107static int maple_dma_done(void)
108{
109 return (ctrl_inl(MAPLE_STATE) & 1) == 0;
110}
111
112static void maple_release_device(struct device *dev)
113{
114 if (dev->type) {
115 kfree(dev->type->name);
116 kfree(dev->type);
117 }
118}
119
120/**
121 * maple_add_packet - add a single instruction to the queue
122 * @mq: instruction to add to waiting queue
123 */
124void maple_add_packet(struct mapleq *mq)
125{
126 mutex_lock(&maple_list_lock);
127 list_add(&mq->list, &maple_waitq);
128 mutex_unlock(&maple_list_lock);
129}
130EXPORT_SYMBOL_GPL(maple_add_packet);
131
132static struct mapleq *maple_allocq(struct maple_device *dev)
133{
134 struct mapleq *mq;
135
136 mq = kmalloc(sizeof(*mq), GFP_KERNEL);
137 if (!mq)
138 return NULL;
139
140 mq->dev = dev;
141 mq->recvbufdcsp = kmem_cache_zalloc(maple_queue_cache, GFP_KERNEL);
142 mq->recvbuf = (void *) P2SEGADDR(mq->recvbufdcsp);
143 if (!mq->recvbuf) {
144 kfree(mq);
145 return NULL;
146 }
147
148 return mq;
149}
150
151static struct maple_device *maple_alloc_dev(int port, int unit)
152{
153 struct maple_device *dev;
154
155 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
156 if (!dev)
157 return NULL;
158
159 dev->port = port;
160 dev->unit = unit;
161 dev->mq = maple_allocq(dev);
162
163 if (!dev->mq) {
164 kfree(dev);
165 return NULL;
166 }
167
168 return dev;
169}
170
171static void maple_free_dev(struct maple_device *mdev)
172{
173 if (!mdev)
174 return;
175 if (mdev->mq) {
176 kmem_cache_free(maple_queue_cache, mdev->mq->recvbufdcsp);
177 kfree(mdev->mq);
178 }
179 kfree(mdev);
180}
181
182/* process the command queue into a maple command block
183 * terminating command has bit 32 of first long set to 0
184 */
185static void maple_build_block(struct mapleq *mq)
186{
187 int port, unit, from, to, len;
188 unsigned long *lsendbuf = mq->sendbuf;
189
190 port = mq->dev->port & 3;
191 unit = mq->dev->unit;
192 len = mq->length;
193 from = port << 6;
194 to = (port << 6) | (unit > 0 ? (1 << (unit - 1)) & 0x1f : 0x20);
195
196 *maple_lastptr &= 0x7fffffff;
197 maple_lastptr = maple_sendptr;
198
199 *maple_sendptr++ = (port << 16) | len | 0x80000000;
200 *maple_sendptr++ = PHYSADDR(mq->recvbuf);
201 *maple_sendptr++ =
202 mq->command | (to << 8) | (from << 16) | (len << 24);
203
204 while (len-- > 0)
205 *maple_sendptr++ = *lsendbuf++;
206}
207
208/* build up command queue */
209static void maple_send(void)
210{
211 int i;
212 int maple_packets;
213 struct mapleq *mq, *nmq;
214
215 if (!list_empty(&maple_sentq))
216 return;
217 if (list_empty(&maple_waitq) || !maple_dma_done())
218 return;
219 maple_packets = 0;
220 maple_sendptr = maple_lastptr = maple_sendbuf;
221 list_for_each_entry_safe(mq, nmq, &maple_waitq, list) {
222 maple_build_block(mq);
223 list_move(&mq->list, &maple_sentq);
224 if (maple_packets++ > MAPLE_MAXPACKETS)
225 break;
226 }
227 if (maple_packets > 0) {
228 for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
229 dma_cache_sync(0, maple_sendbuf + i * PAGE_SIZE,
230 PAGE_SIZE, DMA_BIDIRECTIONAL);
231 }
232}
233
234static int attach_matching_maple_driver(struct device_driver *driver,
235 void *devptr)
236{
237 struct maple_driver *maple_drv;
238 struct maple_device *mdev;
239
240 mdev = devptr;
241 maple_drv = to_maple_driver(driver);
242 if (mdev->devinfo.function & be32_to_cpu(maple_drv->function)) {
243 if (maple_drv->connect(mdev) == 0) {
244 mdev->driver = maple_drv;
245 return 1;
246 }
247 }
248 return 0;
249}
250
251static void maple_detach_driver(struct maple_device *mdev)
252{
253 if (!mdev)
254 return;
255 if (mdev->driver) {
256 if (mdev->driver->disconnect)
257 mdev->driver->disconnect(mdev);
258 }
259 mdev->driver = NULL;
260 if (mdev->registered) {
261 maple_release_device(&mdev->dev);
262 device_unregister(&mdev->dev);
263 }
264 mdev->registered = 0;
265 maple_free_dev(mdev);
266}
267
268/* process initial MAPLE_COMMAND_DEVINFO for each device or port */
269static void maple_attach_driver(struct maple_device *dev)
270{
271 char *p;
272
273 char *recvbuf;
274 unsigned long function;
275 int matched, retval;
276
277 recvbuf = dev->mq->recvbuf;
278 memcpy(&dev->devinfo, recvbuf + 4, sizeof(dev->devinfo));
279 memcpy(dev->product_name, dev->devinfo.product_name, 30);
280 memcpy(dev->product_licence, dev->devinfo.product_licence, 60);
281 dev->product_name[30] = '\0';
282 dev->product_licence[60] = '\0';
283
284 for (p = dev->product_name + 29; dev->product_name <= p; p--)
285 if (*p == ' ')
286 *p = '\0';
287 else
288 break;
289
290 for (p = dev->product_licence + 59; dev->product_licence <= p; p--)
291 if (*p == ' ')
292 *p = '\0';
293 else
294 break;
295
296 function = be32_to_cpu(dev->devinfo.function);
297
298 if (function > 0x200) {
299 /* Do this silently - as not a real device */
300 function = 0;
301 dev->driver = &maple_dummy_driver;
302 sprintf(dev->dev.bus_id, "%d:0.port", dev->port);
303 } else {
304 printk(KERN_INFO
305 "Maple bus at (%d, %d): Connected function 0x%lX\n",
306 dev->port, dev->unit, function);
307
308 matched =
309 bus_for_each_drv(&maple_bus_type, NULL, dev,
310 attach_matching_maple_driver);
311
312 if (matched == 0) {
313 /* Driver does not exist yet */
314 printk(KERN_INFO
315 "No maple driver found for this device\n");
316 dev->driver = &maple_dummy_driver;
317 }
318
319 sprintf(dev->dev.bus_id, "%d:0%d.%lX", dev->port,
320 dev->unit, function);
321 }
322 dev->function = function;
323 dev->dev.bus = &maple_bus_type;
324 dev->dev.parent = &maple_bus;
325 dev->dev.release = &maple_release_device;
326 retval = device_register(&dev->dev);
327 if (retval) {
328 printk(KERN_INFO
329 "Maple bus: Attempt to register device (%x, %x) failed.\n",
330 dev->port, dev->unit);
331 maple_free_dev(dev);
332 }
333 dev->registered = 1;
334}
335
336/*
337 * if device has been registered for the given
338 * port and unit then return 1 - allows identification
339 * of which devices need to be attached or detached
340 */
341static int detach_maple_device(struct device *device, void *portptr)
342{
343 struct maple_device_specify *ds;
344 struct maple_device *mdev;
345
346 ds = portptr;
347 mdev = to_maple_dev(device);
348 if (mdev->port == ds->port && mdev->unit == ds->unit)
349 return 1;
350 return 0;
351}
352
353static int setup_maple_commands(struct device *device, void *ignored)
354{
355 struct maple_device *maple_dev = to_maple_dev(device);
356
357 if ((maple_dev->interval > 0)
358 && time_after(jiffies, maple_dev->when)) {
359 maple_dev->when = jiffies + maple_dev->interval;
360 maple_dev->mq->command = MAPLE_COMMAND_GETCOND;
361 maple_dev->mq->sendbuf = &maple_dev->function;
362 maple_dev->mq->length = 1;
363 maple_add_packet(maple_dev->mq);
364 liststatus++;
365 } else {
366 if (time_after(jiffies, maple_pnp_time)) {
367 maple_dev->mq->command = MAPLE_COMMAND_DEVINFO;
368 maple_dev->mq->length = 0;
369 maple_add_packet(maple_dev->mq);
370 liststatus++;
371 }
372 }
373
374 return 0;
375}
376
377/* VBLANK bottom half - implemented via workqueue */
378static void maple_vblank_handler(struct work_struct *work)
379{
380 if (!maple_dma_done())
381 return;
382 if (!list_empty(&maple_sentq))
383 return;
384 ctrl_outl(0, MAPLE_ENABLE);
385 liststatus = 0;
386 bus_for_each_dev(&maple_bus_type, NULL, NULL,
387 setup_maple_commands);
388 if (time_after(jiffies, maple_pnp_time))
389 maple_pnp_time = jiffies + MAPLE_PNP_INTERVAL;
390 if (liststatus && list_empty(&maple_sentq)) {
391 INIT_LIST_HEAD(&maple_sentq);
392 maple_send();
393 }
394 maplebus_dma_reset();
395}
396
397/* handle devices added via hotplugs - placing them on queue for DEVINFO*/
398static void maple_map_subunits(struct maple_device *mdev, int submask)
399{
400 int retval, k, devcheck;
401 struct maple_device *mdev_add;
402 struct maple_device_specify ds;
403
404 for (k = 0; k < 5; k++) {
405 ds.port = mdev->port;
406 ds.unit = k + 1;
407 retval =
408 bus_for_each_dev(&maple_bus_type, NULL, &ds,
409 detach_maple_device);
410 if (retval) {
411 submask = submask >> 1;
412 continue;
413 }
414 devcheck = submask & 0x01;
415 if (devcheck) {
416 mdev_add = maple_alloc_dev(mdev->port, k + 1);
417 if (!mdev_add)
418 return;
419 mdev_add->mq->command = MAPLE_COMMAND_DEVINFO;
420 mdev_add->mq->length = 0;
421 maple_add_packet(mdev_add->mq);
422 scanning = 1;
423 }
424 submask = submask >> 1;
425 }
426}
427
428/* mark a device as removed */
429static void maple_clean_submap(struct maple_device *mdev)
430{
431 int killbit;
432
433 killbit = (mdev->unit > 0 ? (1 << (mdev->unit - 1)) & 0x1f : 0x20);
434 killbit = ~killbit;
435 killbit &= 0xFF;
436 subdevice_map[mdev->port] = subdevice_map[mdev->port] & killbit;
437}
438
439/* handle empty port or hotplug removal */
440static void maple_response_none(struct maple_device *mdev,
441 struct mapleq *mq)
442{
443 if (mdev->unit != 0) {
444 list_del(&mq->list);
445 maple_clean_submap(mdev);
446 printk(KERN_INFO
447 "Maple bus device detaching at (%d, %d)\n",
448 mdev->port, mdev->unit);
449 maple_detach_driver(mdev);
450 return;
451 }
452 if (!started) {
453 printk(KERN_INFO "No maple devices attached to port %d\n",
454 mdev->port);
455 return;
456 }
457 maple_clean_submap(mdev);
458}
459
460/* preprocess hotplugs or scans */
461static void maple_response_devinfo(struct maple_device *mdev,
462 char *recvbuf)
463{
464 char submask;
465 if ((!started) || (scanning == 2)) {
466 maple_attach_driver(mdev);
467 return;
468 }
469 if (mdev->unit == 0) {
470 submask = recvbuf[2] & 0x1F;
471 if (submask ^ subdevice_map[mdev->port]) {
472 maple_map_subunits(mdev, submask);
473 subdevice_map[mdev->port] = submask;
474 }
475 }
476}
477
478/* maple dma end bottom half - implemented via workqueue */
479static void maple_dma_handler(struct work_struct *work)
480{
481 struct mapleq *mq, *nmq;
482 struct maple_device *dev;
483 char *recvbuf;
484 enum maple_code code;
485
486 if (!maple_dma_done())
487 return;
488 ctrl_outl(0, MAPLE_ENABLE);
489 if (!list_empty(&maple_sentq)) {
490 list_for_each_entry_safe(mq, nmq, &maple_sentq, list) {
491 recvbuf = mq->recvbuf;
492 code = recvbuf[0];
493 dev = mq->dev;
494 switch (code) {
495 case MAPLE_RESPONSE_NONE:
496 maple_response_none(dev, mq);
497 break;
498
499 case MAPLE_RESPONSE_DEVINFO:
500 maple_response_devinfo(dev, recvbuf);
501 break;
502
503 case MAPLE_RESPONSE_DATATRF:
504 if (dev->callback)
505 dev->callback(mq);
506 break;
507
508 case MAPLE_RESPONSE_FILEERR:
509 case MAPLE_RESPONSE_AGAIN:
510 case MAPLE_RESPONSE_BADCMD:
511 case MAPLE_RESPONSE_BADFUNC:
512 printk(KERN_DEBUG
513 "Maple non-fatal error 0x%X\n",
514 code);
515 break;
516
517 case MAPLE_RESPONSE_ALLINFO:
518 printk(KERN_DEBUG
519 "Maple - extended device information not supported\n");
520 break;
521
522 case MAPLE_RESPONSE_OK:
523 break;
524
525 default:
526 break;
527 }
528 }
529 INIT_LIST_HEAD(&maple_sentq);
530 if (scanning == 1) {
531 maple_send();
532 scanning = 2;
533 } else
534 scanning = 0;
535
536 if (started == 0)
537 started = 1;
538 }
539 maplebus_dma_reset();
540}
541
542static irqreturn_t maplebus_dma_interrupt(int irq, void *dev_id)
543{
544 /* Load everything into the bottom half */
545 schedule_work(&maple_dma_process);
546 return IRQ_HANDLED;
547}
548
549static irqreturn_t maplebus_vblank_interrupt(int irq, void *dev_id)
550{
551 schedule_work(&maple_vblank_process);
552 return IRQ_HANDLED;
553}
554
555static struct irqaction maple_dma_irq = {
556 .name = "maple bus DMA handler",
557 .handler = maplebus_dma_interrupt,
558 .flags = IRQF_SHARED,
559};
560
561static struct irqaction maple_vblank_irq = {
562 .name = "maple bus VBLANK handler",
563 .handler = maplebus_vblank_interrupt,
564 .flags = IRQF_SHARED,
565};
566
567static int maple_set_dma_interrupt_handler(void)
568{
569 return setup_irq(HW_EVENT_MAPLE_DMA, &maple_dma_irq);
570}
571
572static int maple_set_vblank_interrupt_handler(void)
573{
574 return setup_irq(HW_EVENT_VSYNC, &maple_vblank_irq);
575}
576
577static int maple_get_dma_buffer(void)
578{
579 maple_sendbuf =
580 (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO,
581 MAPLE_DMA_PAGES);
582 if (!maple_sendbuf)
583 return -ENOMEM;
584 return 0;
585}
586
587static int match_maple_bus_driver(struct device *devptr,
588 struct device_driver *drvptr)
589{
590 struct maple_driver *maple_drv;
591 struct maple_device *maple_dev;
592
593 maple_drv = container_of(drvptr, struct maple_driver, drv);
594 maple_dev = container_of(devptr, struct maple_device, dev);
595 /* Trap empty port case */
596 if (maple_dev->devinfo.function == 0xFFFFFFFF)
597 return 0;
598 else if (maple_dev->devinfo.function &
599 be32_to_cpu(maple_drv->function))
600 return 1;
601 return 0;
602}
603
604static int maple_bus_uevent(struct device *dev, char **envp,
605 int num_envp, char *buffer, int buffer_size)
606{
607 return 0;
608}
609
610static void maple_bus_release(struct device *dev)
611{
612}
613
614static struct maple_driver maple_dummy_driver = {
615 .drv = {
616 .name = "maple_dummy_driver",
617 .bus = &maple_bus_type,
618 },
619};
620
621struct bus_type maple_bus_type = {
622 .name = "maple",
623 .match = match_maple_bus_driver,
624 .uevent = maple_bus_uevent,
625};
626EXPORT_SYMBOL_GPL(maple_bus_type);
627
628static struct device maple_bus = {
629 .bus_id = "maple",
630 .release = maple_bus_release,
631};
632
633static int __init maple_bus_init(void)
634{
635 int retval, i;
636 struct maple_device *mdev[MAPLE_PORTS];
637 ctrl_outl(0, MAPLE_STATE);
638
639 retval = device_register(&maple_bus);
640 if (retval)
641 goto cleanup;
642
643 retval = bus_register(&maple_bus_type);
644 if (retval)
645 goto cleanup_device;
646
647 retval = driver_register(&maple_dummy_driver.drv);
648
649 if (retval)
650 goto cleanup_bus;
651
652 /* allocate memory for maple bus dma */
653 retval = maple_get_dma_buffer();
654 if (retval) {
655 printk(KERN_INFO
656 "Maple bus: Failed to allocate Maple DMA buffers\n");
657 goto cleanup_basic;
658 }
659
660 /* set up DMA interrupt handler */
661 retval = maple_set_dma_interrupt_handler();
662 if (retval) {
663 printk(KERN_INFO
664 "Maple bus: Failed to grab maple DMA IRQ\n");
665 goto cleanup_dma;
666 }
667
668 /* set up VBLANK interrupt handler */
669 retval = maple_set_vblank_interrupt_handler();
670 if (retval) {
671 printk(KERN_INFO "Maple bus: Failed to grab VBLANK IRQ\n");
672 goto cleanup_irq;
673 }
674
675 maple_queue_cache =
676 kmem_cache_create("maple_queue_cache", 0x400, 0,
677 SLAB_HWCACHE_ALIGN, NULL);
678
679 if (!maple_queue_cache)
680 goto cleanup_bothirqs;
681
682 /* setup maple ports */
683 for (i = 0; i < MAPLE_PORTS; i++) {
684 mdev[i] = maple_alloc_dev(i, 0);
685 if (!mdev[i]) {
686 while (i-- > 0)
687 maple_free_dev(mdev[i]);
688 goto cleanup_cache;
689 }
690 mdev[i]->registered = 0;
691 mdev[i]->mq->command = MAPLE_COMMAND_DEVINFO;
692 mdev[i]->mq->length = 0;
693 maple_attach_driver(mdev[i]);
694 maple_add_packet(mdev[i]->mq);
695 subdevice_map[i] = 0;
696 }
697
698 /* setup maplebus hardware */
699 maplebus_dma_reset();
700
701 /* initial detection */
702 maple_send();
703
704 maple_pnp_time = jiffies;
705
706 printk(KERN_INFO "Maple bus core now registered.\n");
707
708 return 0;
709
710cleanup_cache:
711 kmem_cache_destroy(maple_queue_cache);
712
713cleanup_bothirqs:
714 free_irq(HW_EVENT_VSYNC, 0);
715
716cleanup_irq:
717 free_irq(HW_EVENT_MAPLE_DMA, 0);
718
719cleanup_dma:
720 free_pages((unsigned long) maple_sendbuf, MAPLE_DMA_PAGES);
721
722cleanup_basic:
723 driver_unregister(&maple_dummy_driver.drv);
724
725cleanup_bus:
726 bus_unregister(&maple_bus_type);
727
728cleanup_device:
729 device_unregister(&maple_bus);
730
731cleanup:
732 printk(KERN_INFO "Maple bus registration failed\n");
733 return retval;
734}
735subsys_initcall(maple_bus_init);
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c
index 0899fccbd570..fbea2bd129c7 100644
--- a/drivers/video/backlight/hp680_bl.c
+++ b/drivers/video/backlight/hp680_bl.c
@@ -125,8 +125,8 @@ static int hp680bl_remove(struct platform_device *pdev)
125{ 125{
126 struct backlight_device *bd = platform_get_drvdata(pdev); 126 struct backlight_device *bd = platform_get_drvdata(pdev);
127 127
128 hp680bl_data.brightness = 0; 128 bd->props.brightness = 0;
129 hp680bl_data.power = 0; 129 bd->props.power = 0;
130 hp680bl_send_intensity(bd); 130 hp680bl_send_intensity(bd);
131 131
132 backlight_device_unregister(bd); 132 backlight_device_unregister(bd);
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c
index 7d6c29800d14..06805c9b237b 100644
--- a/drivers/video/pvr2fb.c
+++ b/drivers/video/pvr2fb.c
@@ -667,6 +667,8 @@ static int pvr2_init_cable(void)
667 related */ 667 related */
668 if (cable_type == CT_COMPOSITE) 668 if (cable_type == CT_COMPOSITE)
669 fb_writel(3 << 8, VOUTC); 669 fb_writel(3 << 8, VOUTC);
670 else if (cable_type == CT_RGB)
671 fb_writel(1 << 9, VOUTC);
670 else 672 else
671 fb_writel(0, VOUTC); 673 fb_writel(0, VOUTC);
672 674
@@ -890,7 +892,7 @@ static int __init pvr2fb_dc_init(void)
890 pvr2_fix.mmio_start = 0xa05f8000; /* registers start here */ 892 pvr2_fix.mmio_start = 0xa05f8000; /* registers start here */
891 pvr2_fix.mmio_len = 0x2000; 893 pvr2_fix.mmio_len = 0x2000;
892 894
893 if (request_irq(HW_EVENT_VSYNC, pvr2fb_interrupt, 0, 895 if (request_irq(HW_EVENT_VSYNC, pvr2fb_interrupt, IRQF_SHARED,
894 "pvr2 VBL handler", fb_info)) { 896 "pvr2 VBL handler", fb_info)) {
895 return -EBUSY; 897 return -EBUSY;
896 } 898 }