blob: 629016bec8098d33fcd479018393f00ffd08a817 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/sh/boards/hp6xx/hp680/setup.c
3 *
4 * Copyright (C) 2002 Andriy Skulysh
5 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 * Setup code for an HP680 (internal peripherials only)
10 */
Paul Mundte5723e02006-09-27 17:38:11 +090011#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/init.h>
Paul Mundt00258352006-01-16 22:14:08 -080013#include <asm/hd64461.h>
Paul Mundte5723e02006-09-27 17:38:11 +090014#include <asm/io.h>
15#include <asm/irq.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <asm/hp6xx/hp6xx.h>
17#include <asm/cpu/dac.h>
18
Andriy Skulysh3aa770e2006-09-27 16:20:22 +090019#define SCPCR 0xa4000116
20#define SCPDR 0xa4000136
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022const char *get_system_type(void)
23{
Paul Mundt00258352006-01-16 22:14:08 -080024 return "HP6xx";
Linus Torvalds1da177e2005-04-16 15:20:36 -070025}
26
27int __init platform_setup(void)
28{
Paul Mundt00258352006-01-16 22:14:08 -080029 u8 v8;
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 u16 v;
Andriy Skulysh3aa770e2006-09-27 16:20:22 +090031
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 v = inw(HD64461_STBCR);
33 v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
34 HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
35 HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
36 HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST |
37 HD64461_STBCR_SAFECKE_IST;
Paul Mundt00258352006-01-16 22:14:08 -080038#ifndef CONFIG_HD64461_ENABLER
39 v |= HD64461_STBCR_SPC1ST;
40#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 outw(v, HD64461_STBCR);
42 v = inw(HD64461_GPADR);
43 v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
44 outw(v, HD64461_GPADR);
45
Paul Mundt00258352006-01-16 22:14:08 -080046 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR);
47
48#ifndef CONFIG_HD64461_ENABLER
49 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR);
50#endif
51
52 sh_dac_output(0, DAC_SPEAKER_VOLUME);
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 sh_dac_disable(DAC_SPEAKER_VOLUME);
Paul Mundt00258352006-01-16 22:14:08 -080054 v8 = ctrl_inb(DACR);
55 v8 &= ~DACR_DAE;
56 ctrl_outb(v8,DACR);
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Andriy Skulysh3aa770e2006-09-27 16:20:22 +090058 v8 = ctrl_inb(SCPDR);
59 v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y;
60 v8 &= ~SCPDR_TS_SCAN_ENABLE;
61 ctrl_outb(v8, SCPDR);
62
63 v = ctrl_inw(SCPCR);
64 v &= ~SCPCR_TS_MASK;
65 v |= SCPCR_TS_ENABLE;
66 ctrl_outw(v, SCPCR);
67
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 return 0;
69}