blob: 5fc00f0727c4f620766a38e0f33a2de9600d7902 [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 */
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <asm/io.h>
Paul Mundt00258352006-01-16 22:14:08 -080014#include <asm/hd64461.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <asm/hp6xx/hp6xx.h>
16#include <asm/cpu/dac.h>
17
Andriy Skulysh3aa770e2006-09-27 16:20:22 +090018#define SCPCR 0xa4000116
19#define SCPDR 0xa4000136
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021const char *get_system_type(void)
22{
Paul Mundt00258352006-01-16 22:14:08 -080023 return "HP6xx";
Linus Torvalds1da177e2005-04-16 15:20:36 -070024}
25
26int __init platform_setup(void)
27{
Paul Mundt00258352006-01-16 22:14:08 -080028 u8 v8;
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 u16 v;
Andriy Skulysh3aa770e2006-09-27 16:20:22 +090030
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 v = inw(HD64461_STBCR);
32 v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
33 HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
34 HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
35 HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST |
36 HD64461_STBCR_SAFECKE_IST;
Paul Mundt00258352006-01-16 22:14:08 -080037#ifndef CONFIG_HD64461_ENABLER
38 v |= HD64461_STBCR_SPC1ST;
39#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 outw(v, HD64461_STBCR);
41 v = inw(HD64461_GPADR);
42 v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
43 outw(v, HD64461_GPADR);
44
Paul Mundt00258352006-01-16 22:14:08 -080045 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR);
46
47#ifndef CONFIG_HD64461_ENABLER
48 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR);
49#endif
50
51 sh_dac_output(0, DAC_SPEAKER_VOLUME);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 sh_dac_disable(DAC_SPEAKER_VOLUME);
Paul Mundt00258352006-01-16 22:14:08 -080053 v8 = ctrl_inb(DACR);
54 v8 &= ~DACR_DAE;
55 ctrl_outb(v8,DACR);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Andriy Skulysh3aa770e2006-09-27 16:20:22 +090057 v8 = ctrl_inb(SCPDR);
58 v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y;
59 v8 &= ~SCPDR_TS_SCAN_ENABLE;
60 ctrl_outb(v8, SCPDR);
61
62 v = ctrl_inw(SCPCR);
63 v &= ~SCPCR_TS_MASK;
64 v |= SCPCR_TS_ENABLE;
65 ctrl_outw(v, SCPCR);
66
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 return 0;
68}