blob: a1d51d5fa925cbb56512a98cf913c2d40d27312b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* $Id: setup.c,v 1.1.2.4 2002/03/02 21:57:07 lethal Exp $
2 *
3 * linux/arch/sh/boards/se/770x/setup.c
4 *
5 * Copyright (C) 2000 Kazumoto Kojima
6 *
7 * Hitachi SolutionEngine Support.
8 *
9 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/init.h>
Paul Mundt2c7834a2006-09-27 18:17:31 +090011#include <asm/machvec.h>
Paul Mundt711fa802006-10-03 13:14:04 +090012#include <asm/se.h>
13#include <asm/io.h>
14#include <asm/smc37c93x.h>
Paul Mundt2c7834a2006-09-27 18:17:31 +090015
16void heartbeat_se(void);
17void init_se_IRQ(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
19/*
20 * Configure the Super I/O chip
21 */
22static void __init smsc_config(int index, int data)
23{
24 outb_p(index, INDEX_PORT);
25 outb_p(data, DATA_PORT);
26}
27
Paul Mundt2c7834a2006-09-27 18:17:31 +090028/* XXX: Another candidate for a more generic cchip machine vector */
29static void __init smsc_setup(char **cmdline_p)
Linus Torvalds1da177e2005-04-16 15:20:36 -070030{
31 outb_p(CONFIG_ENTER, CONFIG_PORT);
32 outb_p(CONFIG_ENTER, CONFIG_PORT);
33
34 /* FDC */
35 smsc_config(CURRENT_LDN_INDEX, LDN_FDC);
36 smsc_config(ACTIVATE_INDEX, 0x01);
37 smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */
38
39 /* IDE1 */
40 smsc_config(CURRENT_LDN_INDEX, LDN_IDE1);
41 smsc_config(ACTIVATE_INDEX, 0x01);
42 smsc_config(IRQ_SELECT_INDEX, 14); /* IRQ14 */
43
44 /* AUXIO (GPIO): to use IDE1 */
45 smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO);
46 smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */
47 smsc_config(GPIO47_INDEX, 0x00); /* nIOWOP */
48
49 /* COM1 */
50 smsc_config(CURRENT_LDN_INDEX, LDN_COM1);
51 smsc_config(ACTIVATE_INDEX, 0x01);
52 smsc_config(IO_BASE_HI_INDEX, 0x03);
53 smsc_config(IO_BASE_LO_INDEX, 0xf8);
54 smsc_config(IRQ_SELECT_INDEX, 4); /* IRQ4 */
55
56 /* COM2 */
57 smsc_config(CURRENT_LDN_INDEX, LDN_COM2);
58 smsc_config(ACTIVATE_INDEX, 0x01);
59 smsc_config(IO_BASE_HI_INDEX, 0x02);
60 smsc_config(IO_BASE_LO_INDEX, 0xf8);
61 smsc_config(IRQ_SELECT_INDEX, 3); /* IRQ3 */
62
63 /* RTC */
64 smsc_config(CURRENT_LDN_INDEX, LDN_RTC);
65 smsc_config(ACTIVATE_INDEX, 0x01);
66 smsc_config(IRQ_SELECT_INDEX, 8); /* IRQ8 */
67
68 /* XXX: PARPORT, KBD, and MOUSE will come here... */
69 outb_p(CONFIG_EXIT, CONFIG_PORT);
70}
71
Linus Torvalds1da177e2005-04-16 15:20:36 -070072/*
Paul Mundt2c7834a2006-09-27 18:17:31 +090073 * The Machine Vector
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 */
Paul Mundt2c7834a2006-09-27 18:17:31 +090075struct sh_machine_vector mv_se __initmv = {
76 .mv_name = "SolutionEngine",
77 .mv_setup = smsc_setup,
78#if defined(CONFIG_CPU_SH4)
79 .mv_nr_irqs = 48,
80#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
81 .mv_nr_irqs = 32,
82#elif defined(CONFIG_CPU_SUBTYPE_SH7709)
83 .mv_nr_irqs = 61,
84#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
85 .mv_nr_irqs = 86,
86#endif
87
88 .mv_inb = se_inb,
89 .mv_inw = se_inw,
90 .mv_inl = se_inl,
91 .mv_outb = se_outb,
92 .mv_outw = se_outw,
93 .mv_outl = se_outl,
94
95 .mv_inb_p = se_inb_p,
96 .mv_inw_p = se_inw,
97 .mv_inl_p = se_inl,
98 .mv_outb_p = se_outb_p,
99 .mv_outw_p = se_outw,
100 .mv_outl_p = se_outl,
101
102 .mv_insb = se_insb,
103 .mv_insw = se_insw,
104 .mv_insl = se_insl,
105 .mv_outsb = se_outsb,
106 .mv_outsw = se_outsw,
107 .mv_outsl = se_outsl,
108
109 .mv_init_irq = init_se_IRQ,
110#ifdef CONFIG_HEARTBEAT
111 .mv_heartbeat = heartbeat_se,
112#endif
113};
114ALIAS_MV(se)