Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Toshiba rbtx4927 specific setup |
| 3 | * |
| 4 | * Author: MontaVista Software, Inc. |
| 5 | * source@mvista.com |
| 6 | * |
| 7 | * Copyright 2001-2002 MontaVista Software Inc. |
| 8 | * |
| 9 | * Copyright (C) 1996, 97, 2001, 04 Ralf Baechle (ralf@linux-mips.org) |
| 10 | * Copyright (C) 2000 RidgeRun, Inc. |
| 11 | * Author: RidgeRun, Inc. |
| 12 | * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com |
| 13 | * |
| 14 | * Copyright 2001 MontaVista Software Inc. |
| 15 | * Author: jsun@mvista.com or jsun@junsun.net |
| 16 | * |
| 17 | * Copyright 2002 MontaVista Software Inc. |
| 18 | * Author: Michael Pruznick, michael_pruznick@mvista.com |
| 19 | * |
| 20 | * Copyright (C) 2000-2001 Toshiba Corporation |
| 21 | * |
| 22 | * Copyright (C) 2004 MontaVista Software Inc. |
| 23 | * Author: Manish Lachwani, mlachwani@mvista.com |
| 24 | * |
| 25 | * This program is free software; you can redistribute it and/or modify it |
| 26 | * under the terms of the GNU General Public License as published by the |
| 27 | * Free Software Foundation; either version 2 of the License, or (at your |
| 28 | * option) any later version. |
| 29 | * |
| 30 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 31 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 32 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 33 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 36 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 37 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
| 38 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
| 39 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 40 | * |
| 41 | * You should have received a copy of the GNU General Public License along |
| 42 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 43 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 44 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #include <linux/init.h> |
| 46 | #include <linux/kernel.h> |
| 47 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | #include <linux/ioport.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #include <linux/interrupt.h> |
Atsushi Nemoto | a0574e0 | 2007-03-01 00:40:21 +0900 | [diff] [blame] | 50 | #include <linux/platform_device.h> |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 51 | #include <linux/delay.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #include <asm/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | #include <asm/reboot.h> |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 54 | #include <asm/txx9/generic.h> |
| 55 | #include <asm/txx9/pci.h> |
Atsushi Nemoto | 22b1d70 | 2008-07-11 00:31:36 +0900 | [diff] [blame] | 56 | #include <asm/txx9/rbtx4927.h> |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 57 | #include <asm/txx9/tx4938.h> /* for TX4937 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | #ifdef CONFIG_PCI |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 60 | static void __init tx4927_pci_setup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | { |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 62 | int extarb = !(__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCIARB); |
| 63 | struct pci_controller *c = &txx9_primary_pcic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 65 | register_pci_controller(c); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 67 | if (__raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_PCI66) |
| 68 | txx9_pci_option = |
| 69 | (txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) | |
| 70 | TXX9_PCI_OPT_CLK_66; /* already configured */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 72 | /* Reset PCI Bus */ |
| 73 | writeb(1, rbtx4927_pcireset_addr); |
| 74 | /* Reset PCIC */ |
| 75 | txx9_set64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST); |
| 76 | if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) == |
| 77 | TXX9_PCI_OPT_CLK_66) |
| 78 | tx4927_pciclk66_setup(); |
| 79 | mdelay(10); |
| 80 | /* clear PCIC reset */ |
| 81 | txx9_clear64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST); |
| 82 | writeb(0, rbtx4927_pcireset_addr); |
| 83 | iob(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 85 | tx4927_report_pciclk(); |
| 86 | tx4927_pcic_setup(tx4927_pcicptr, c, extarb); |
| 87 | if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) == |
| 88 | TXX9_PCI_OPT_CLK_AUTO && |
| 89 | txx9_pci66_check(c, 0, 0)) { |
| 90 | /* Reset PCI Bus */ |
| 91 | writeb(1, rbtx4927_pcireset_addr); |
| 92 | /* Reset PCIC */ |
| 93 | txx9_set64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST); |
| 94 | tx4927_pciclk66_setup(); |
| 95 | mdelay(10); |
| 96 | /* clear PCIC reset */ |
| 97 | txx9_clear64(&tx4927_ccfgptr->clkctr, TX4927_CLKCTR_PCIRST); |
| 98 | writeb(0, rbtx4927_pcireset_addr); |
| 99 | iob(); |
| 100 | /* Reinitialize PCIC */ |
| 101 | tx4927_report_pciclk(); |
| 102 | tx4927_pcic_setup(tx4927_pcicptr, c, extarb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | } |
Atsushi Nemoto | 455cc25 | 2008-07-25 23:01:35 +0900 | [diff] [blame] | 104 | tx4927_setup_pcierr_irq(); |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 105 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 107 | static void __init tx4937_pci_setup(void) |
| 108 | { |
| 109 | int extarb = !(__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCIARB); |
| 110 | struct pci_controller *c = &txx9_primary_pcic; |
| 111 | |
| 112 | register_pci_controller(c); |
| 113 | |
| 114 | if (__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCI66) |
| 115 | txx9_pci_option = |
| 116 | (txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) | |
| 117 | TXX9_PCI_OPT_CLK_66; /* already configured */ |
| 118 | |
| 119 | /* Reset PCI Bus */ |
| 120 | writeb(1, rbtx4927_pcireset_addr); |
| 121 | /* Reset PCIC */ |
| 122 | txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); |
| 123 | if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) == |
| 124 | TXX9_PCI_OPT_CLK_66) |
| 125 | tx4938_pciclk66_setup(); |
| 126 | mdelay(10); |
| 127 | /* clear PCIC reset */ |
| 128 | txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); |
| 129 | writeb(0, rbtx4927_pcireset_addr); |
| 130 | iob(); |
| 131 | |
| 132 | tx4938_report_pciclk(); |
| 133 | tx4927_pcic_setup(tx4938_pcicptr, c, extarb); |
| 134 | if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) == |
| 135 | TXX9_PCI_OPT_CLK_AUTO && |
| 136 | txx9_pci66_check(c, 0, 0)) { |
| 137 | /* Reset PCI Bus */ |
| 138 | writeb(1, rbtx4927_pcireset_addr); |
| 139 | /* Reset PCIC */ |
| 140 | txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); |
| 141 | tx4938_pciclk66_setup(); |
| 142 | mdelay(10); |
| 143 | /* clear PCIC reset */ |
| 144 | txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); |
| 145 | writeb(0, rbtx4927_pcireset_addr); |
| 146 | iob(); |
| 147 | /* Reinitialize PCIC */ |
| 148 | tx4938_report_pciclk(); |
| 149 | tx4927_pcic_setup(tx4938_pcicptr, c, extarb); |
| 150 | } |
Atsushi Nemoto | 455cc25 | 2008-07-25 23:01:35 +0900 | [diff] [blame] | 151 | tx4938_setup_pcierr_irq(); |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 152 | } |
| 153 | |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 154 | static void __init rbtx4927_arch_init(void) |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 155 | { |
Yoichi Yuasa | a38c475 | 2008-07-13 20:01:04 +0900 | [diff] [blame] | 156 | tx4927_pci_setup(); |
| 157 | } |
| 158 | |
| 159 | static void __init rbtx4937_arch_init(void) |
| 160 | { |
| 161 | tx4937_pci_setup(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | } |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 163 | #else |
| 164 | #define rbtx4927_arch_init NULL |
Yoichi Yuasa | a38c475 | 2008-07-13 20:01:04 +0900 | [diff] [blame] | 165 | #define rbtx4937_arch_init NULL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | #endif /* CONFIG_PCI */ |
| 167 | |
Atsushi Nemoto | 7b22609 | 2008-07-14 00:15:04 +0900 | [diff] [blame] | 168 | static void toshiba_rbtx4927_restart(char *command) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | /* enable the s/w reset register */ |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 171 | writeb(1, rbtx4927_softresetlock_addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | |
| 173 | /* wait for enable to be seen */ |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 174 | while (!(readb(rbtx4927_softresetlock_addr) & 1)) |
| 175 | ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | |
| 177 | /* do a s/w reset */ |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 178 | writeb(1, rbtx4927_softreset_addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | |
Atsushi Nemoto | a49297e | 2008-07-24 00:25:17 +0900 | [diff] [blame^] | 180 | /* fallback */ |
| 181 | (*_machine_halt)(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | } |
| 183 | |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 184 | static void __init rbtx4927_clock_init(void); |
| 185 | static void __init rbtx4937_clock_init(void); |
| 186 | |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 187 | static void __init rbtx4927_mem_setup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | { |
Atsushi Nemoto | a02eb8d | 2007-08-28 00:28:09 +0900 | [diff] [blame] | 189 | u32 cp0_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | char *argptr; |
| 191 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | /* f/w leaves this on at startup */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | clear_c0_status(ST0_ERL); |
| 194 | |
| 195 | /* enable caches -- HCP5 does this, pmon does not */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | cp0_config = read_c0_config(); |
| 197 | cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC); |
| 198 | write_c0_config(cp0_config); |
| 199 | |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 200 | if (TX4927_REV_PCODE() == 0x4927) { |
| 201 | rbtx4927_clock_init(); |
| 202 | tx4927_setup(); |
| 203 | } else { |
| 204 | rbtx4937_clock_init(); |
| 205 | tx4938_setup(); |
| 206 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | _machine_restart = toshiba_rbtx4927_restart; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | |
| 210 | #ifdef CONFIG_PCI |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 211 | txx9_alloc_pci_controller(&txx9_primary_pcic, |
| 212 | RBTX4927_PCIMEM, RBTX4927_PCIMEM_SIZE, |
| 213 | RBTX4927_PCIIO, RBTX4927_PCIIO_SIZE); |
Atsushi Nemoto | 0751752 | 2008-07-24 00:25:15 +0900 | [diff] [blame] | 214 | txx9_board_pcibios_setup = tx4927_pcibios_setup; |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 215 | #else |
| 216 | set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET); |
| 217 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 219 | tx4927_setup_serial(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | #ifdef CONFIG_SERIAL_TXX9_CONSOLE |
| 221 | argptr = prom_getcmdline(); |
| 222 | if (strstr(argptr, "console=") == NULL) { |
| 223 | strcat(argptr, " console=ttyS0,38400"); |
| 224 | } |
| 225 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | |
| 227 | #ifdef CONFIG_ROOT_NFS |
| 228 | argptr = prom_getcmdline(); |
| 229 | if (strstr(argptr, "root=") == NULL) { |
| 230 | strcat(argptr, " root=/dev/nfs rw"); |
| 231 | } |
| 232 | #endif |
| 233 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | #ifdef CONFIG_IP_PNP |
| 235 | argptr = prom_getcmdline(); |
| 236 | if (strstr(argptr, "ip=") == NULL) { |
| 237 | strcat(argptr, " ip=any"); |
| 238 | } |
| 239 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | } |
| 241 | |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 242 | static void __init rbtx4927_clock_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | { |
Yoichi Yuasa | a00fb66 | 2008-07-13 19:54:08 +0900 | [diff] [blame] | 244 | /* |
| 245 | * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. |
| 246 | * |
| 247 | * For TX4927: |
| 248 | * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1). |
| 249 | * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) |
| 250 | * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) |
| 251 | * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) |
| 252 | * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) |
| 253 | * i.e. S9[3]: ON (83MHz), OFF (100MHz) |
Yoichi Yuasa | b6c4053 | 2008-07-13 20:02:13 +0900 | [diff] [blame] | 254 | */ |
| 255 | switch ((unsigned long)__raw_readq(&tx4927_ccfgptr->ccfg) & |
| 256 | TX4927_CCFG_PCIDIVMODE_MASK) { |
| 257 | case TX4927_CCFG_PCIDIVMODE_2_5: |
| 258 | case TX4927_CCFG_PCIDIVMODE_5: |
| 259 | txx9_cpu_clock = 166666666; /* 166MHz */ |
| 260 | break; |
| 261 | default: |
| 262 | txx9_cpu_clock = 200000000; /* 200MHz */ |
| 263 | } |
Yoichi Yuasa | b6c4053 | 2008-07-13 20:02:13 +0900 | [diff] [blame] | 264 | } |
| 265 | |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 266 | static void __init rbtx4937_clock_init(void) |
Yoichi Yuasa | b6c4053 | 2008-07-13 20:02:13 +0900 | [diff] [blame] | 267 | { |
| 268 | /* |
| 269 | * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. |
Yoichi Yuasa | a00fb66 | 2008-07-13 19:54:08 +0900 | [diff] [blame] | 270 | * |
| 271 | * For TX4937: |
| 272 | * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1) |
| 273 | * PCIDIVMODE[10] is 0. |
| 274 | * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8) |
| 275 | * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4) |
| 276 | * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9) |
| 277 | * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5) |
| 278 | * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10) |
| 279 | * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5) |
| 280 | */ |
Yoichi Yuasa | b6c4053 | 2008-07-13 20:02:13 +0900 | [diff] [blame] | 281 | switch ((unsigned long)__raw_readq(&tx4938_ccfgptr->ccfg) & |
| 282 | TX4938_CCFG_PCIDIVMODE_MASK) { |
| 283 | case TX4938_CCFG_PCIDIVMODE_8: |
| 284 | case TX4938_CCFG_PCIDIVMODE_4: |
| 285 | txx9_cpu_clock = 266666666; /* 266MHz */ |
| 286 | break; |
| 287 | case TX4938_CCFG_PCIDIVMODE_9: |
| 288 | case TX4938_CCFG_PCIDIVMODE_4_5: |
| 289 | txx9_cpu_clock = 300000000; /* 300MHz */ |
| 290 | break; |
| 291 | default: |
| 292 | txx9_cpu_clock = 333333333; /* 333MHz */ |
| 293 | } |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 294 | } |
Yoichi Yuasa | a00fb66 | 2008-07-13 19:54:08 +0900 | [diff] [blame] | 295 | |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 296 | static void __init rbtx4927_time_init(void) |
| 297 | { |
| 298 | tx4927_time_init(0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | } |
| 300 | |
Atsushi Nemoto | a0574e0 | 2007-03-01 00:40:21 +0900 | [diff] [blame] | 301 | static int __init toshiba_rbtx4927_rtc_init(void) |
| 302 | { |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 303 | struct resource res = { |
| 304 | .start = RBTX4927_BRAMRTC_BASE - IO_BASE, |
| 305 | .end = RBTX4927_BRAMRTC_BASE - IO_BASE + 0x800 - 1, |
Atsushi Nemoto | a0574e0 | 2007-03-01 00:40:21 +0900 | [diff] [blame] | 306 | .flags = IORESOURCE_MEM, |
| 307 | }; |
| 308 | struct platform_device *dev = |
Atsushi Nemoto | a95e23a | 2007-10-16 01:28:18 -0700 | [diff] [blame] | 309 | platform_device_register_simple("rtc-ds1742", -1, &res, 1); |
Atsushi Nemoto | a0574e0 | 2007-03-01 00:40:21 +0900 | [diff] [blame] | 310 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; |
| 311 | } |
Atsushi Nemoto | 57e386c | 2007-05-01 00:27:58 +0900 | [diff] [blame] | 312 | |
| 313 | static int __init rbtx4927_ne_init(void) |
| 314 | { |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 315 | struct resource res[] = { |
Atsushi Nemoto | 57e386c | 2007-05-01 00:27:58 +0900 | [diff] [blame] | 316 | { |
| 317 | .start = RBTX4927_RTL_8019_BASE, |
| 318 | .end = RBTX4927_RTL_8019_BASE + 0x20 - 1, |
| 319 | .flags = IORESOURCE_IO, |
| 320 | }, { |
| 321 | .start = RBTX4927_RTL_8019_IRQ, |
| 322 | .flags = IORESOURCE_IRQ, |
| 323 | } |
| 324 | }; |
| 325 | struct platform_device *dev = |
| 326 | platform_device_register_simple("ne", -1, |
| 327 | res, ARRAY_SIZE(res)); |
| 328 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; |
| 329 | } |
Atsushi Nemoto | 2064ba2 | 2007-11-24 01:20:27 +0900 | [diff] [blame] | 330 | |
| 331 | /* Watchdog support */ |
| 332 | |
| 333 | static int __init txx9_wdt_init(unsigned long base) |
| 334 | { |
| 335 | struct resource res = { |
| 336 | .start = base, |
| 337 | .end = base + 0x100 - 1, |
| 338 | .flags = IORESOURCE_MEM, |
| 339 | }; |
| 340 | struct platform_device *dev = |
| 341 | platform_device_register_simple("txx9wdt", -1, &res, 1); |
| 342 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; |
| 343 | } |
| 344 | |
| 345 | static int __init rbtx4927_wdt_init(void) |
| 346 | { |
| 347 | return txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL); |
| 348 | } |
Atsushi Nemoto | 2064ba2 | 2007-11-24 01:20:27 +0900 | [diff] [blame] | 349 | |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 350 | static void __init rbtx4927_device_init(void) |
Atsushi Nemoto | 2064ba2 | 2007-11-24 01:20:27 +0900 | [diff] [blame] | 351 | { |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 352 | toshiba_rbtx4927_rtc_init(); |
| 353 | rbtx4927_ne_init(); |
| 354 | rbtx4927_wdt_init(); |
Atsushi Nemoto | 2064ba2 | 2007-11-24 01:20:27 +0900 | [diff] [blame] | 355 | } |
Atsushi Nemoto | 2064ba2 | 2007-11-24 01:20:27 +0900 | [diff] [blame] | 356 | |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 357 | struct txx9_board_vec rbtx4927_vec __initdata = { |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 358 | .system = "Toshiba RBTX4927", |
| 359 | .prom_init = rbtx4927_prom_init, |
| 360 | .mem_setup = rbtx4927_mem_setup, |
| 361 | .irq_setup = rbtx4927_irq_setup, |
| 362 | .time_init = rbtx4927_time_init, |
| 363 | .device_init = rbtx4927_device_init, |
| 364 | .arch_init = rbtx4927_arch_init, |
| 365 | #ifdef CONFIG_PCI |
| 366 | .pci_map_irq = rbtx4927_pci_map_irq, |
| 367 | #endif |
| 368 | }; |
| 369 | struct txx9_board_vec rbtx4937_vec __initdata = { |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 370 | .system = "Toshiba RBTX4937", |
| 371 | .prom_init = rbtx4927_prom_init, |
| 372 | .mem_setup = rbtx4927_mem_setup, |
| 373 | .irq_setup = rbtx4927_irq_setup, |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 374 | .time_init = rbtx4927_time_init, |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 375 | .device_init = rbtx4927_device_init, |
Yoichi Yuasa | a38c475 | 2008-07-13 20:01:04 +0900 | [diff] [blame] | 376 | .arch_init = rbtx4937_arch_init, |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 377 | #ifdef CONFIG_PCI |
| 378 | .pci_map_irq = rbtx4927_pci_map_irq, |
| 379 | #endif |
| 380 | }; |