Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Uwe Zeisberger | f30c226 | 2006-10-03 23:01:26 +0200 | [diff] [blame] | 2 | * linux/arch/sh/boards/hp6xx/setup.c |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2002 Andriy Skulysh |
Kristoffer Ericson | 34a780a | 2007-04-10 07:45:08 +0900 | [diff] [blame] | 5 | * Copyright (C) 2007 Kristoffer Ericson <Kristoffer_e1@hotmail.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * |
| 7 | * May be copied or modified under the terms of the GNU General Public |
| 8 | * License. See linux/COPYING for more information. |
| 9 | * |
| 10 | * Setup code for an HP680 (internal peripherials only) |
| 11 | */ |
Paul Mundt | e5723e0 | 2006-09-27 17:38:11 +0900 | [diff] [blame] | 12 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/init.h> |
Kristoffer Ericson | 34a780a | 2007-04-10 07:45:08 +0900 | [diff] [blame] | 14 | #include <linux/platform_device.h> |
Paul Mundt | 0025835 | 2006-01-16 22:14:08 -0800 | [diff] [blame] | 15 | #include <asm/hd64461.h> |
Paul Mundt | e5723e0 | 2006-09-27 17:38:11 +0900 | [diff] [blame] | 16 | #include <asm/io.h> |
| 17 | #include <asm/irq.h> |
Paul Mundt | 082c44d | 2006-10-19 16:16:18 +0900 | [diff] [blame] | 18 | #include <asm/hp6xx.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #include <asm/cpu/dac.h> |
| 20 | |
Andriy Skulysh | 3aa770e | 2006-09-27 16:20:22 +0900 | [diff] [blame] | 21 | #define SCPCR 0xa4000116 |
| 22 | #define SCPDR 0xa4000136 |
| 23 | |
Kristoffer Ericson | 34a780a | 2007-04-10 07:45:08 +0900 | [diff] [blame] | 24 | /* CF Slot */ |
| 25 | static struct resource cf_ide_resources[] = { |
| 26 | [0] = { |
| 27 | .start = 0x15000000 + 0x1f0, |
| 28 | .end = 0x15000000 + 0x1f0 + 0x08 - 0x01, |
| 29 | .flags = IORESOURCE_MEM, |
| 30 | }, |
| 31 | [1] = { |
| 32 | .start = 0x15000000 + 0x1fe, |
| 33 | .end = 0x15000000 + 0x1fe + 0x01, |
| 34 | .flags = IORESOURCE_MEM, |
| 35 | }, |
| 36 | [2] = { |
Kristoffer Ericson | c9eaaa9 | 2007-09-11 12:51:02 +0900 | [diff] [blame^] | 37 | .start = 77, |
Kristoffer Ericson | 34a780a | 2007-04-10 07:45:08 +0900 | [diff] [blame] | 38 | .flags = IORESOURCE_IRQ, |
| 39 | }, |
| 40 | }; |
| 41 | |
| 42 | static struct platform_device cf_ide_device = { |
| 43 | .name = "pata_platform", |
| 44 | .id = -1, |
| 45 | .num_resources = ARRAY_SIZE(cf_ide_resources), |
| 46 | .resource = cf_ide_resources, |
| 47 | }; |
| 48 | |
| 49 | static struct platform_device *hp6xx_devices[] __initdata = { |
| 50 | &cf_ide_device, |
| 51 | }; |
| 52 | |
| 53 | static int __init hp6xx_devices_setup(void) |
| 54 | { |
| 55 | return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices)); |
| 56 | } |
| 57 | |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 58 | static void __init hp6xx_setup(char **cmdline_p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | { |
Paul Mundt | 0025835 | 2006-01-16 22:14:08 -0800 | [diff] [blame] | 60 | u8 v8; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | u16 v; |
Andriy Skulysh | 3aa770e | 2006-09-27 16:20:22 +0900 | [diff] [blame] | 62 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | v = inw(HD64461_STBCR); |
| 64 | v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST | |
| 65 | HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST | |
| 66 | HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST | |
| 67 | HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST | |
| 68 | HD64461_STBCR_SAFECKE_IST; |
Paul Mundt | 0025835 | 2006-01-16 22:14:08 -0800 | [diff] [blame] | 69 | #ifndef CONFIG_HD64461_ENABLER |
| 70 | v |= HD64461_STBCR_SPC1ST; |
| 71 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | outw(v, HD64461_STBCR); |
| 73 | v = inw(HD64461_GPADR); |
| 74 | v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0; |
| 75 | outw(v, HD64461_GPADR); |
| 76 | |
Paul Mundt | 0025835 | 2006-01-16 22:14:08 -0800 | [diff] [blame] | 77 | outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR); |
| 78 | |
| 79 | #ifndef CONFIG_HD64461_ENABLER |
| 80 | outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR); |
| 81 | #endif |
| 82 | |
| 83 | sh_dac_output(0, DAC_SPEAKER_VOLUME); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | sh_dac_disable(DAC_SPEAKER_VOLUME); |
Paul Mundt | 0025835 | 2006-01-16 22:14:08 -0800 | [diff] [blame] | 85 | v8 = ctrl_inb(DACR); |
| 86 | v8 &= ~DACR_DAE; |
| 87 | ctrl_outb(v8,DACR); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | |
Andriy Skulysh | 3aa770e | 2006-09-27 16:20:22 +0900 | [diff] [blame] | 89 | v8 = ctrl_inb(SCPDR); |
| 90 | v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y; |
| 91 | v8 &= ~SCPDR_TS_SCAN_ENABLE; |
| 92 | ctrl_outb(v8, SCPDR); |
| 93 | |
| 94 | v = ctrl_inw(SCPCR); |
| 95 | v &= ~SCPCR_TS_MASK; |
| 96 | v |= SCPCR_TS_ENABLE; |
| 97 | ctrl_outw(v, SCPCR); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | } |
Kristoffer Ericson | 34a780a | 2007-04-10 07:45:08 +0900 | [diff] [blame] | 99 | device_initcall(hp6xx_devices_setup); |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 100 | |
Paul Mundt | 82f81f4 | 2007-05-15 15:19:34 +0900 | [diff] [blame] | 101 | static struct sh_machine_vector mv_hp6xx __initmv = { |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 102 | .mv_name = "hp6xx", |
| 103 | .mv_setup = hp6xx_setup, |
| 104 | .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM, |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 105 | .mv_irq_demux = hd64461_irq_demux, |
| 106 | }; |