Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 Mundt | e5723e0 | 2006-09-27 17:38:11 +0900 | [diff] [blame] | 11 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/init.h> |
Paul Mundt | 0025835 | 2006-01-16 22:14:08 -0800 | [diff] [blame] | 13 | #include <asm/hd64461.h> |
Paul Mundt | e5723e0 | 2006-09-27 17:38:11 +0900 | [diff] [blame] | 14 | #include <asm/io.h> |
| 15 | #include <asm/irq.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <asm/hp6xx/hp6xx.h> |
| 17 | #include <asm/cpu/dac.h> |
| 18 | |
Andriy Skulysh | 3aa770e | 2006-09-27 16:20:22 +0900 | [diff] [blame] | 19 | #define SCPCR 0xa4000116 |
| 20 | #define SCPDR 0xa4000136 |
| 21 | |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 22 | static void __init hp6xx_setup(char **cmdline_p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | { |
Paul Mundt | 0025835 | 2006-01-16 22:14:08 -0800 | [diff] [blame] | 24 | u8 v8; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | u16 v; |
Andriy Skulysh | 3aa770e | 2006-09-27 16:20:22 +0900 | [diff] [blame] | 26 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | v = inw(HD64461_STBCR); |
| 28 | v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST | |
| 29 | HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST | |
| 30 | HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST | |
| 31 | HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST | |
| 32 | HD64461_STBCR_SAFECKE_IST; |
Paul Mundt | 0025835 | 2006-01-16 22:14:08 -0800 | [diff] [blame] | 33 | #ifndef CONFIG_HD64461_ENABLER |
| 34 | v |= HD64461_STBCR_SPC1ST; |
| 35 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | outw(v, HD64461_STBCR); |
| 37 | v = inw(HD64461_GPADR); |
| 38 | v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0; |
| 39 | outw(v, HD64461_GPADR); |
| 40 | |
Paul Mundt | 0025835 | 2006-01-16 22:14:08 -0800 | [diff] [blame] | 41 | outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR); |
| 42 | |
| 43 | #ifndef CONFIG_HD64461_ENABLER |
| 44 | outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR); |
| 45 | #endif |
| 46 | |
| 47 | sh_dac_output(0, DAC_SPEAKER_VOLUME); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | sh_dac_disable(DAC_SPEAKER_VOLUME); |
Paul Mundt | 0025835 | 2006-01-16 22:14:08 -0800 | [diff] [blame] | 49 | v8 = ctrl_inb(DACR); |
| 50 | v8 &= ~DACR_DAE; |
| 51 | ctrl_outb(v8,DACR); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Andriy Skulysh | 3aa770e | 2006-09-27 16:20:22 +0900 | [diff] [blame] | 53 | v8 = ctrl_inb(SCPDR); |
| 54 | v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y; |
| 55 | v8 &= ~SCPDR_TS_SCAN_ENABLE; |
| 56 | ctrl_outb(v8, SCPDR); |
| 57 | |
| 58 | v = ctrl_inw(SCPCR); |
| 59 | v &= ~SCPCR_TS_MASK; |
| 60 | v |= SCPCR_TS_ENABLE; |
| 61 | ctrl_outw(v, SCPCR); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | } |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 63 | |
| 64 | /* |
| 65 | * XXX: This is stupid, we should have a generic machine vector for the cchips |
| 66 | * and just wrap the platform setup code in to this, as it's the only thing |
| 67 | * that ends up being different. |
| 68 | */ |
| 69 | struct sh_machine_vector mv_hp6xx __initmv = { |
| 70 | .mv_name = "hp6xx", |
| 71 | .mv_setup = hp6xx_setup, |
| 72 | .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM, |
| 73 | |
| 74 | .mv_inb = hd64461_inb, |
| 75 | .mv_inw = hd64461_inw, |
| 76 | .mv_inl = hd64461_inl, |
| 77 | .mv_outb = hd64461_outb, |
| 78 | .mv_outw = hd64461_outw, |
| 79 | .mv_outl = hd64461_outl, |
| 80 | |
| 81 | .mv_inb_p = hd64461_inb_p, |
| 82 | .mv_inw_p = hd64461_inw, |
| 83 | .mv_inl_p = hd64461_inl, |
| 84 | .mv_outb_p = hd64461_outb_p, |
| 85 | .mv_outw_p = hd64461_outw, |
| 86 | .mv_outl_p = hd64461_outl, |
| 87 | |
| 88 | .mv_insb = hd64461_insb, |
| 89 | .mv_insw = hd64461_insw, |
| 90 | .mv_insl = hd64461_insl, |
| 91 | .mv_outsb = hd64461_outsb, |
| 92 | .mv_outsw = hd64461_outsw, |
| 93 | .mv_outsl = hd64461_outsl, |
| 94 | |
| 95 | .mv_readw = hd64461_readw, |
| 96 | .mv_writew = hd64461_writew, |
| 97 | |
| 98 | .mv_irq_demux = hd64461_irq_demux, |
| 99 | }; |
| 100 | ALIAS_MV(hp6xx) |