toshiba_rbtx4927_setup.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047
  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. */
  45. #include <linux/config.h>
  46. #include <linux/init.h>
  47. #include <linux/kernel.h>
  48. #include <linux/types.h>
  49. #include <linux/mm.h>
  50. #include <linux/swap.h>
  51. #include <linux/ioport.h>
  52. #include <linux/sched.h>
  53. #include <linux/interrupt.h>
  54. #include <linux/pci.h>
  55. #include <linux/timex.h>
  56. #include <asm/bootinfo.h>
  57. #include <asm/page.h>
  58. #include <asm/io.h>
  59. #include <asm/irq.h>
  60. #include <asm/processor.h>
  61. #include <asm/ptrace.h>
  62. #include <asm/reboot.h>
  63. #include <asm/time.h>
  64. #include <linux/bootmem.h>
  65. #include <linux/blkdev.h>
  66. #ifdef CONFIG_RTC_DS1742
  67. #include <linux/ds1742rtc.h>
  68. #endif
  69. #ifdef CONFIG_TOSHIBA_FPCIB0
  70. #include <asm/tx4927/smsc_fdc37m81x.h>
  71. #endif
  72. #include <asm/tx4927/toshiba_rbtx4927.h>
  73. #ifdef CONFIG_PCI
  74. #include <asm/tx4927/tx4927_pci.h>
  75. #endif
  76. #ifdef CONFIG_BLK_DEV_IDEPCI
  77. #include <linux/hdreg.h>
  78. #include <linux/ide.h>
  79. #endif
  80. #ifdef CONFIG_SERIAL_TXX9
  81. #include <linux/tty.h>
  82. #include <linux/serial.h>
  83. #include <linux/serial_core.h>
  84. #endif
  85. #undef TOSHIBA_RBTX4927_SETUP_DEBUG
  86. #ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
  87. #define TOSHIBA_RBTX4927_SETUP_NONE 0x00000000
  88. #define TOSHIBA_RBTX4927_SETUP_INFO ( 1 << 0 )
  89. #define TOSHIBA_RBTX4927_SETUP_WARN ( 1 << 1 )
  90. #define TOSHIBA_RBTX4927_SETUP_EROR ( 1 << 2 )
  91. #define TOSHIBA_RBTX4927_SETUP_EFWFU ( 1 << 3 )
  92. #define TOSHIBA_RBTX4927_SETUP_SETUP ( 1 << 4 )
  93. #define TOSHIBA_RBTX4927_SETUP_TIME_INIT ( 1 << 5 )
  94. #define TOSHIBA_RBTX4927_SETUP_TIMER_SETUP ( 1 << 6 )
  95. #define TOSHIBA_RBTX4927_SETUP_PCIBIOS ( 1 << 7 )
  96. #define TOSHIBA_RBTX4927_SETUP_PCI1 ( 1 << 8 )
  97. #define TOSHIBA_RBTX4927_SETUP_PCI2 ( 1 << 9 )
  98. #define TOSHIBA_RBTX4927_SETUP_PCI66 ( 1 << 10 )
  99. #define TOSHIBA_RBTX4927_SETUP_ALL 0xffffffff
  100. #endif
  101. #ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
  102. static const u32 toshiba_rbtx4927_setup_debug_flag =
  103. (TOSHIBA_RBTX4927_SETUP_NONE | TOSHIBA_RBTX4927_SETUP_INFO |
  104. TOSHIBA_RBTX4927_SETUP_WARN | TOSHIBA_RBTX4927_SETUP_EROR |
  105. TOSHIBA_RBTX4927_SETUP_EFWFU | TOSHIBA_RBTX4927_SETUP_SETUP |
  106. TOSHIBA_RBTX4927_SETUP_TIME_INIT | TOSHIBA_RBTX4927_SETUP_TIMER_SETUP
  107. | TOSHIBA_RBTX4927_SETUP_PCIBIOS | TOSHIBA_RBTX4927_SETUP_PCI1 |
  108. TOSHIBA_RBTX4927_SETUP_PCI2 | TOSHIBA_RBTX4927_SETUP_PCI66);
  109. #endif
  110. #ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
  111. #define TOSHIBA_RBTX4927_SETUP_DPRINTK(flag,str...) \
  112. if ( (toshiba_rbtx4927_setup_debug_flag) & (flag) ) \
  113. { \
  114. char tmp[100]; \
  115. sprintf( tmp, str ); \
  116. printk( "%s(%s:%u)::%s", __FUNCTION__, __FILE__, __LINE__, tmp ); \
  117. }
  118. #else
  119. #define TOSHIBA_RBTX4927_SETUP_DPRINTK(flag,str...)
  120. #endif
  121. /* These functions are used for rebooting or halting the machine*/
  122. extern void toshiba_rbtx4927_restart(char *command);
  123. extern void toshiba_rbtx4927_halt(void);
  124. extern void toshiba_rbtx4927_power_off(void);
  125. int tx4927_using_backplane = 0;
  126. extern void gt64120_time_init(void);
  127. extern void toshiba_rbtx4927_irq_setup(void);
  128. #ifdef CONFIG_PCI
  129. #define CONFIG_TX4927BUG_WORKAROUND
  130. #undef TX4927_SUPPORT_COMMAND_IO
  131. #undef TX4927_SUPPORT_PCI_66
  132. int tx4927_cpu_clock = 100000000; /* 100MHz */
  133. unsigned long mips_pci_io_base;
  134. unsigned long mips_pci_io_size;
  135. unsigned long mips_pci_mem_base;
  136. unsigned long mips_pci_mem_size;
  137. /* for legacy I/O, PCI I/O PCI Bus address must be 0 */
  138. unsigned long mips_pci_io_pciaddr = 0;
  139. unsigned long mips_memory_upper;
  140. static int tx4927_ccfg_toeon = 1;
  141. static int tx4927_pcic_trdyto = 0; /* default: disabled */
  142. unsigned long tx4927_ce_base[8];
  143. void tx4927_pci_setup(void);
  144. void tx4927_reset_pci_pcic(void);
  145. int tx4927_pci66 = 0; /* 0:auto */
  146. #endif
  147. char *toshiba_name = "";
  148. #ifdef CONFIG_PCI
  149. static void tx4927_pcierr_interrupt(int irq, void *dev_id,
  150. struct pt_regs *regs)
  151. {
  152. #ifdef CONFIG_BLK_DEV_IDEPCI
  153. /* ignore MasterAbort for ide probing... */
  154. if (irq == TX4927_IRQ_IRC_PCIERR &&
  155. ((tx4927_pcicptr->pcistatus >> 16) & 0xf900) ==
  156. PCI_STATUS_REC_MASTER_ABORT) {
  157. tx4927_pcicptr->pcistatus =
  158. (tx4927_pcicptr->
  159. pcistatus & 0x0000ffff) | (PCI_STATUS_REC_MASTER_ABORT
  160. << 16);
  161. return;
  162. }
  163. #endif
  164. printk("PCI error interrupt (irq 0x%x).\n", irq);
  165. printk("pcistat:%04x, g2pstatus:%08lx, pcicstatus:%08lx\n",
  166. (unsigned short) (tx4927_pcicptr->pcistatus >> 16),
  167. tx4927_pcicptr->g2pstatus, tx4927_pcicptr->pcicstatus);
  168. printk("ccfg:%08lx, tear:%02lx_%08lx\n",
  169. (unsigned long) tx4927_ccfgptr->ccfg,
  170. (unsigned long) (tx4927_ccfgptr->tear >> 32),
  171. (unsigned long) tx4927_ccfgptr->tear);
  172. show_regs(regs);
  173. }
  174. void __init toshiba_rbtx4927_pci_irq_init(void)
  175. {
  176. return;
  177. }
  178. void tx4927_reset_pci_pcic(void)
  179. {
  180. /* Reset PCI Bus */
  181. *tx4927_pcireset_ptr = 1;
  182. /* Reset PCIC */
  183. tx4927_ccfgptr->clkctr |= TX4927_CLKCTR_PCIRST;
  184. udelay(10000);
  185. /* clear PCIC reset */
  186. tx4927_ccfgptr->clkctr &= ~TX4927_CLKCTR_PCIRST;
  187. *tx4927_pcireset_ptr = 0;
  188. }
  189. #endif /* CONFIG_PCI */
  190. #ifdef CONFIG_PCI
  191. void print_pci_status(void)
  192. {
  193. printk("PCI STATUS %lx\n", tx4927_pcicptr->pcistatus);
  194. printk("PCIC STATUS %lx\n", tx4927_pcicptr->pcicstatus);
  195. }
  196. extern struct pci_controller tx4927_controller;
  197. static struct pci_dev *fake_pci_dev(struct pci_controller *hose,
  198. int top_bus, int busnr, int devfn)
  199. {
  200. static struct pci_dev dev;
  201. static struct pci_bus bus;
  202. dev.sysdata = (void *)hose;
  203. dev.devfn = devfn;
  204. bus.number = busnr;
  205. bus.ops = hose->pci_ops;
  206. bus.parent = NULL;
  207. dev.bus = &bus;
  208. return &dev;
  209. }
  210. #define EARLY_PCI_OP(rw, size, type) \
  211. static int early_##rw##_config_##size(struct pci_controller *hose, \
  212. int top_bus, int bus, int devfn, int offset, type value) \
  213. { \
  214. return pci_##rw##_config_##size( \
  215. fake_pci_dev(hose, top_bus, bus, devfn), \
  216. offset, value); \
  217. }
  218. EARLY_PCI_OP(read, byte, u8 *)
  219. EARLY_PCI_OP(read, word, u16 *)
  220. EARLY_PCI_OP(read, dword, u32 *)
  221. EARLY_PCI_OP(write, byte, u8)
  222. EARLY_PCI_OP(write, word, u16)
  223. EARLY_PCI_OP(write, dword, u32)
  224. static int __init tx4927_pcibios_init(void)
  225. {
  226. unsigned int id;
  227. u32 pci_devfn;
  228. int devfn_start = 0;
  229. int devfn_stop = 0xff;
  230. int busno = 0; /* One bus on the Toshiba */
  231. struct pci_controller *hose = &tx4927_controller;
  232. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  233. "-\n");
  234. for (pci_devfn = devfn_start; pci_devfn < devfn_stop; pci_devfn++) {
  235. early_read_config_dword(hose, busno, busno, pci_devfn,
  236. PCI_VENDOR_ID, &id);
  237. if (id == 0xffffffff) {
  238. continue;
  239. }
  240. if (id == 0x94601055) {
  241. u8 v08_64;
  242. u32 v32_b0;
  243. u8 v08_e1;
  244. char *s = " sb/isa --";
  245. TOSHIBA_RBTX4927_SETUP_DPRINTK
  246. (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s beg\n",
  247. s);
  248. early_read_config_byte(hose, busno, busno,
  249. pci_devfn, 0x64, &v08_64);
  250. early_read_config_dword(hose, busno, busno,
  251. pci_devfn, 0xb0, &v32_b0);
  252. early_read_config_byte(hose, busno, busno,
  253. pci_devfn, 0xe1, &v08_e1);
  254. TOSHIBA_RBTX4927_SETUP_DPRINTK
  255. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  256. ":%s beg 0x64 = 0x%02x\n", s, v08_64);
  257. TOSHIBA_RBTX4927_SETUP_DPRINTK
  258. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  259. ":%s beg 0xb0 = 0x%02x\n", s, v32_b0);
  260. TOSHIBA_RBTX4927_SETUP_DPRINTK
  261. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  262. ":%s beg 0xe1 = 0x%02x\n", s, v08_e1);
  263. /* serial irq control */
  264. v08_64 = 0xd0;
  265. /* serial irq pin */
  266. v32_b0 |= 0x00010000;
  267. /* ide irq on isa14 */
  268. v08_e1 &= 0xf0;
  269. v08_e1 |= 0x0d;
  270. TOSHIBA_RBTX4927_SETUP_DPRINTK
  271. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  272. ":%s mid 0x64 = 0x%02x\n", s, v08_64);
  273. TOSHIBA_RBTX4927_SETUP_DPRINTK
  274. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  275. ":%s mid 0xb0 = 0x%02x\n", s, v32_b0);
  276. TOSHIBA_RBTX4927_SETUP_DPRINTK
  277. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  278. ":%s mid 0xe1 = 0x%02x\n", s, v08_e1);
  279. early_write_config_byte(hose, busno, busno,
  280. pci_devfn, 0x64, v08_64);
  281. early_write_config_dword(hose, busno, busno,
  282. pci_devfn, 0xb0, v32_b0);
  283. early_write_config_byte(hose, busno, busno,
  284. pci_devfn, 0xe1, v08_e1);
  285. #ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
  286. {
  287. early_read_config_byte(hose, busno, busno,
  288. pci_devfn, 0x64,
  289. &v08_64);
  290. early_read_config_dword(hose, busno, busno,
  291. pci_devfn, 0xb0,
  292. &v32_b0);
  293. early_read_config_byte(hose, busno, busno,
  294. pci_devfn, 0xe1,
  295. &v08_e1);
  296. TOSHIBA_RBTX4927_SETUP_DPRINTK
  297. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  298. ":%s end 0x64 = 0x%02x\n", s, v08_64);
  299. TOSHIBA_RBTX4927_SETUP_DPRINTK
  300. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  301. ":%s end 0xb0 = 0x%02x\n", s, v32_b0);
  302. TOSHIBA_RBTX4927_SETUP_DPRINTK
  303. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  304. ":%s end 0xe1 = 0x%02x\n", s, v08_e1);
  305. }
  306. #endif
  307. TOSHIBA_RBTX4927_SETUP_DPRINTK
  308. (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s end\n",
  309. s);
  310. }
  311. if (id == 0x91301055) {
  312. u8 v08_04;
  313. u8 v08_09;
  314. u8 v08_41;
  315. u8 v08_43;
  316. u8 v08_5c;
  317. char *s = " sb/ide --";
  318. TOSHIBA_RBTX4927_SETUP_DPRINTK
  319. (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s beg\n",
  320. s);
  321. early_read_config_byte(hose, busno, busno,
  322. pci_devfn, 0x04, &v08_04);
  323. early_read_config_byte(hose, busno, busno,
  324. pci_devfn, 0x09, &v08_09);
  325. early_read_config_byte(hose, busno, busno,
  326. pci_devfn, 0x41, &v08_41);
  327. early_read_config_byte(hose, busno, busno,
  328. pci_devfn, 0x43, &v08_43);
  329. early_read_config_byte(hose, busno, busno,
  330. pci_devfn, 0x5c, &v08_5c);
  331. TOSHIBA_RBTX4927_SETUP_DPRINTK
  332. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  333. ":%s beg 0x04 = 0x%02x\n", s, v08_04);
  334. TOSHIBA_RBTX4927_SETUP_DPRINTK
  335. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  336. ":%s beg 0x09 = 0x%02x\n", s, v08_09);
  337. TOSHIBA_RBTX4927_SETUP_DPRINTK
  338. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  339. ":%s beg 0x41 = 0x%02x\n", s, v08_41);
  340. TOSHIBA_RBTX4927_SETUP_DPRINTK
  341. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  342. ":%s beg 0x43 = 0x%02x\n", s, v08_43);
  343. TOSHIBA_RBTX4927_SETUP_DPRINTK
  344. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  345. ":%s beg 0x5c = 0x%02x\n", s, v08_5c);
  346. /* enable ide master/io */
  347. v08_04 |= (PCI_COMMAND_MASTER | PCI_COMMAND_IO);
  348. /* enable ide native mode */
  349. v08_09 |= 0x05;
  350. /* enable primary ide */
  351. v08_41 |= 0x80;
  352. /* enable secondary ide */
  353. v08_43 |= 0x80;
  354. /*
  355. * !!! DO NOT REMOVE THIS COMMENT IT IS REQUIRED BY SMSC !!!
  356. *
  357. * This line of code is intended to provide the user with a work
  358. * around solution to the anomalies cited in SMSC's anomaly sheet
  359. * entitled, "SLC90E66 Functional Rev.J_0.1 Anomalies"".
  360. *
  361. * !!! DO NOT REMOVE THIS COMMENT IT IS REQUIRED BY SMSC !!!
  362. */
  363. v08_5c |= 0x01;
  364. TOSHIBA_RBTX4927_SETUP_DPRINTK
  365. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  366. ":%s mid 0x04 = 0x%02x\n", s, v08_04);
  367. TOSHIBA_RBTX4927_SETUP_DPRINTK
  368. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  369. ":%s mid 0x09 = 0x%02x\n", s, v08_09);
  370. TOSHIBA_RBTX4927_SETUP_DPRINTK
  371. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  372. ":%s mid 0x41 = 0x%02x\n", s, v08_41);
  373. TOSHIBA_RBTX4927_SETUP_DPRINTK
  374. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  375. ":%s mid 0x43 = 0x%02x\n", s, v08_43);
  376. TOSHIBA_RBTX4927_SETUP_DPRINTK
  377. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  378. ":%s mid 0x5c = 0x%02x\n", s, v08_5c);
  379. early_write_config_byte(hose, busno, busno,
  380. pci_devfn, 0x5c, v08_5c);
  381. early_write_config_byte(hose, busno, busno,
  382. pci_devfn, 0x04, v08_04);
  383. early_write_config_byte(hose, busno, busno,
  384. pci_devfn, 0x09, v08_09);
  385. early_write_config_byte(hose, busno, busno,
  386. pci_devfn, 0x41, v08_41);
  387. early_write_config_byte(hose, busno, busno,
  388. pci_devfn, 0x43, v08_43);
  389. #ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
  390. {
  391. early_read_config_byte(hose, busno, busno,
  392. pci_devfn, 0x04,
  393. &v08_04);
  394. early_read_config_byte(hose, busno, busno,
  395. pci_devfn, 0x09,
  396. &v08_09);
  397. early_read_config_byte(hose, busno, busno,
  398. pci_devfn, 0x41,
  399. &v08_41);
  400. early_read_config_byte(hose, busno, busno,
  401. pci_devfn, 0x43,
  402. &v08_43);
  403. early_read_config_byte(hose, busno, busno,
  404. pci_devfn, 0x5c,
  405. &v08_5c);
  406. TOSHIBA_RBTX4927_SETUP_DPRINTK
  407. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  408. ":%s end 0x04 = 0x%02x\n", s, v08_04);
  409. TOSHIBA_RBTX4927_SETUP_DPRINTK
  410. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  411. ":%s end 0x09 = 0x%02x\n", s, v08_09);
  412. TOSHIBA_RBTX4927_SETUP_DPRINTK
  413. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  414. ":%s end 0x41 = 0x%02x\n", s, v08_41);
  415. TOSHIBA_RBTX4927_SETUP_DPRINTK
  416. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  417. ":%s end 0x43 = 0x%02x\n", s, v08_43);
  418. TOSHIBA_RBTX4927_SETUP_DPRINTK
  419. (TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  420. ":%s end 0x5c = 0x%02x\n", s, v08_5c);
  421. }
  422. #endif
  423. TOSHIBA_RBTX4927_SETUP_DPRINTK
  424. (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s end\n",
  425. s);
  426. }
  427. }
  428. register_pci_controller(&tx4927_controller);
  429. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCIBIOS,
  430. "+\n");
  431. return 0;
  432. }
  433. arch_initcall(tx4927_pcibios_init);
  434. extern struct resource pci_io_resource;
  435. extern struct resource pci_mem_resource;
  436. void tx4927_pci_setup(void)
  437. {
  438. static int called = 0;
  439. extern unsigned int tx4927_get_mem_size(void);
  440. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, "-\n");
  441. mips_memory_upper = tx4927_get_mem_size() << 20;
  442. mips_memory_upper += KSEG0;
  443. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  444. "0x%08lx=mips_memory_upper\n",
  445. mips_memory_upper);
  446. mips_pci_io_base = TX4927_PCIIO;
  447. mips_pci_io_size = TX4927_PCIIO_SIZE;
  448. mips_pci_mem_base = TX4927_PCIMEM;
  449. mips_pci_mem_size = TX4927_PCIMEM_SIZE;
  450. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  451. "0x%08lx=mips_pci_io_base\n",
  452. mips_pci_io_base);
  453. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  454. "0x%08lx=mips_pci_io_size\n",
  455. mips_pci_io_size);
  456. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  457. "0x%08lx=mips_pci_mem_base\n",
  458. mips_pci_mem_base);
  459. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  460. "0x%08lx=mips_pci_mem_size\n",
  461. mips_pci_mem_size);
  462. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  463. "0x%08lx=pci_io_resource.start\n",
  464. pci_io_resource.start);
  465. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  466. "0x%08lx=pci_io_resource.end\n",
  467. pci_io_resource.end);
  468. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  469. "0x%08lx=pci_mem_resource.start\n",
  470. pci_mem_resource.start);
  471. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  472. "0x%08lx=pci_mem_resource.end\n",
  473. pci_mem_resource.end);
  474. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  475. "0x%08lx=mips_io_port_base",
  476. mips_io_port_base);
  477. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  478. "setup pci_io_resource to 0x%08lx 0x%08lx\n",
  479. pci_io_resource.start,
  480. pci_io_resource.end);
  481. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  482. "setup pci_mem_resource to 0x%08lx 0x%08lx\n",
  483. pci_mem_resource.start,
  484. pci_mem_resource.end);
  485. if (!called) {
  486. printk
  487. ("TX4927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n",
  488. (unsigned short) (tx4927_pcicptr->pciid >> 16),
  489. (unsigned short) (tx4927_pcicptr->pciid & 0xffff),
  490. (unsigned short) (tx4927_pcicptr->pciccrev & 0xff),
  491. (!(tx4927_ccfgptr->
  492. ccfg & TX4927_CCFG_PCIXARB)) ? "External" :
  493. "Internal");
  494. called = 1;
  495. }
  496. printk("%s PCIC --%s PCICLK:",toshiba_name,
  497. (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : "");
  498. if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) {
  499. int pciclk = 0;
  500. switch ((unsigned long) tx4927_ccfgptr->
  501. ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
  502. case TX4927_CCFG_PCIDIVMODE_2_5:
  503. pciclk = tx4927_cpu_clock * 2 / 5;
  504. break;
  505. case TX4927_CCFG_PCIDIVMODE_3:
  506. pciclk = tx4927_cpu_clock / 3;
  507. break;
  508. case TX4927_CCFG_PCIDIVMODE_5:
  509. pciclk = tx4927_cpu_clock / 5;
  510. break;
  511. case TX4927_CCFG_PCIDIVMODE_6:
  512. pciclk = tx4927_cpu_clock / 6;
  513. break;
  514. }
  515. printk("Internal(%dMHz)", pciclk / 1000000);
  516. } else {
  517. int pciclk = 0;
  518. int pciclk_setting = *tx4927_pci_clk_ptr;
  519. switch (pciclk_setting & TX4927_PCI_CLK_MASK) {
  520. case TX4927_PCI_CLK_33:
  521. pciclk = 33333333;
  522. break;
  523. case TX4927_PCI_CLK_25:
  524. pciclk = 25000000;
  525. break;
  526. case TX4927_PCI_CLK_66:
  527. pciclk = 66666666;
  528. break;
  529. case TX4927_PCI_CLK_50:
  530. pciclk = 50000000;
  531. break;
  532. }
  533. printk("External(%dMHz)", pciclk / 1000000);
  534. }
  535. printk("\n");
  536. /* GB->PCI mappings */
  537. tx4927_pcicptr->g2piomask = (mips_pci_io_size - 1) >> 4;
  538. tx4927_pcicptr->g2piogbase = mips_pci_io_base |
  539. #ifdef __BIG_ENDIAN
  540. TX4927_PCIC_G2PIOGBASE_ECHG
  541. #else
  542. TX4927_PCIC_G2PIOGBASE_BSDIS
  543. #endif
  544. ;
  545. tx4927_pcicptr->g2piopbase = 0;
  546. tx4927_pcicptr->g2pmmask[0] = (mips_pci_mem_size - 1) >> 4;
  547. tx4927_pcicptr->g2pmgbase[0] = mips_pci_mem_base |
  548. #ifdef __BIG_ENDIAN
  549. TX4927_PCIC_G2PMnGBASE_ECHG
  550. #else
  551. TX4927_PCIC_G2PMnGBASE_BSDIS
  552. #endif
  553. ;
  554. tx4927_pcicptr->g2pmpbase[0] = mips_pci_mem_base;
  555. tx4927_pcicptr->g2pmmask[1] = 0;
  556. tx4927_pcicptr->g2pmgbase[1] = 0;
  557. tx4927_pcicptr->g2pmpbase[1] = 0;
  558. tx4927_pcicptr->g2pmmask[2] = 0;
  559. tx4927_pcicptr->g2pmgbase[2] = 0;
  560. tx4927_pcicptr->g2pmpbase[2] = 0;
  561. /* PCI->GB mappings (I/O 256B) */
  562. tx4927_pcicptr->p2giopbase = 0; /* 256B */
  563. /* PCI->GB mappings (MEM 512MB) M0 gets all of memory */
  564. tx4927_pcicptr->p2gm0plbase = 0;
  565. tx4927_pcicptr->p2gm0pubase = 0;
  566. tx4927_pcicptr->p2gmgbase[0] = 0 | TX4927_PCIC_P2GMnGBASE_TMEMEN |
  567. #ifdef __BIG_ENDIAN
  568. TX4927_PCIC_P2GMnGBASE_TECHG
  569. #else
  570. TX4927_PCIC_P2GMnGBASE_TBSDIS
  571. #endif
  572. ;
  573. /* PCI->GB mappings (MEM 16MB) -not used */
  574. tx4927_pcicptr->p2gm1plbase = 0xffffffff;
  575. #ifdef CONFIG_TX4927BUG_WORKAROUND
  576. /*
  577. * TX4927-PCIC-BUG: P2GM1PUBASE must be 0
  578. * if P2GM0PUBASE was 0.
  579. */
  580. tx4927_pcicptr->p2gm1pubase = 0;
  581. #else
  582. tx4927_pcicptr->p2gm1pubase = 0xffffffff;
  583. #endif
  584. tx4927_pcicptr->p2gmgbase[1] = 0;
  585. /* PCI->GB mappings (MEM 1MB) -not used */
  586. tx4927_pcicptr->p2gm2pbase = 0xffffffff;
  587. tx4927_pcicptr->p2gmgbase[2] = 0;
  588. /* Enable Initiator Memory 0 Space, I/O Space, Config */
  589. tx4927_pcicptr->pciccfg &= TX4927_PCIC_PCICCFG_LBWC_MASK;
  590. tx4927_pcicptr->pciccfg |=
  591. TX4927_PCIC_PCICCFG_IMSE0 | TX4927_PCIC_PCICCFG_IISE |
  592. TX4927_PCIC_PCICCFG_ICAE | TX4927_PCIC_PCICCFG_ATR;
  593. /* Do not use MEMMUL, MEMINF: YMFPCI card causes M_ABORT. */
  594. tx4927_pcicptr->pcicfg1 = 0;
  595. if (tx4927_pcic_trdyto >= 0) {
  596. tx4927_pcicptr->g2ptocnt &= ~0xff;
  597. tx4927_pcicptr->g2ptocnt |= (tx4927_pcic_trdyto & 0xff);
  598. }
  599. /* Clear All Local Bus Status */
  600. tx4927_pcicptr->pcicstatus = TX4927_PCIC_PCICSTATUS_ALL;
  601. /* Enable All Local Bus Interrupts */
  602. tx4927_pcicptr->pcicmask = TX4927_PCIC_PCICSTATUS_ALL;
  603. /* Clear All Initiator Status */
  604. tx4927_pcicptr->g2pstatus = TX4927_PCIC_G2PSTATUS_ALL;
  605. /* Enable All Initiator Interrupts */
  606. tx4927_pcicptr->g2pmask = TX4927_PCIC_G2PSTATUS_ALL;
  607. /* Clear All PCI Status Error */
  608. tx4927_pcicptr->pcistatus =
  609. (tx4927_pcicptr->pcistatus & 0x0000ffff) |
  610. (TX4927_PCIC_PCISTATUS_ALL << 16);
  611. /* Enable All PCI Status Error Interrupts */
  612. tx4927_pcicptr->pcimask = TX4927_PCIC_PCISTATUS_ALL;
  613. /* PCIC Int => IRC IRQ16 */
  614. tx4927_pcicptr->pcicfg2 =
  615. (tx4927_pcicptr->pcicfg2 & 0xffffff00) | TX4927_IR_PCIC;
  616. if (!(tx4927_ccfgptr->ccfg & TX4927_CCFG_PCIXARB)) {
  617. /* XXX */
  618. } else {
  619. /* Reset Bus Arbiter */
  620. tx4927_pcicptr->pbacfg = TX4927_PCIC_PBACFG_RPBA;
  621. /* Enable Bus Arbiter */
  622. tx4927_pcicptr->pbacfg = TX4927_PCIC_PBACFG_PBAEN;
  623. }
  624. tx4927_pcicptr->pcistatus = PCI_COMMAND_MASTER |
  625. PCI_COMMAND_MEMORY |
  626. PCI_COMMAND_PARITY | PCI_COMMAND_SERR;
  627. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  628. ":pci setup complete:\n");
  629. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, "+\n");
  630. }
  631. #endif /* CONFIG_PCI */
  632. void toshiba_rbtx4927_restart(char *command)
  633. {
  634. printk(KERN_NOTICE "System Rebooting...\n");
  635. /* enable the s/w reset register */
  636. reg_wr08(RBTX4927_SW_RESET_ENABLE, RBTX4927_SW_RESET_ENABLE_SET);
  637. /* wait for enable to be seen */
  638. while ((reg_rd08(RBTX4927_SW_RESET_ENABLE) &
  639. RBTX4927_SW_RESET_ENABLE_SET) == 0x00);
  640. /* do a s/w reset */
  641. reg_wr08(RBTX4927_SW_RESET_DO, RBTX4927_SW_RESET_DO_SET);
  642. /* do something passive while waiting for reset */
  643. local_irq_disable();
  644. while (1)
  645. asm_wait();
  646. /* no return */
  647. }
  648. void toshiba_rbtx4927_halt(void)
  649. {
  650. printk(KERN_NOTICE "System Halted\n");
  651. local_irq_disable();
  652. while (1) {
  653. asm_wait();
  654. }
  655. /* no return */
  656. }
  657. void toshiba_rbtx4927_power_off(void)
  658. {
  659. toshiba_rbtx4927_halt();
  660. /* no return */
  661. }
  662. void __init toshiba_rbtx4927_setup(void)
  663. {
  664. vu32 cp0_config;
  665. char *argptr;
  666. printk("CPU is %s\n", toshiba_name);
  667. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  668. "-\n");
  669. /* f/w leaves this on at startup */
  670. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  671. ":Clearing STO_ERL.\n");
  672. clear_c0_status(ST0_ERL);
  673. /* enable caches -- HCP5 does this, pmon does not */
  674. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  675. ":Enabling TX49_CONF_IC,TX49_CONF_DC.\n");
  676. cp0_config = read_c0_config();
  677. cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC);
  678. write_c0_config(cp0_config);
  679. #ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
  680. {
  681. extern void dump_cp0(char *);
  682. dump_cp0("toshiba_rbtx4927_early_fw_fixup");
  683. }
  684. #endif
  685. /* setup irq stuff */
  686. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  687. ":Setting up tx4927 pic.\n");
  688. TX4927_WR(0xff1ff604, 0x00000400); /* irq trigger */
  689. TX4927_WR(0xff1ff608, 0x00000000); /* irq trigger */
  690. /* setup serial stuff */
  691. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  692. ":Setting up tx4927 sio.\n");
  693. TX4927_WR(0xff1ff314, 0x00000000); /* h/w flow control off */
  694. TX4927_WR(0xff1ff414, 0x00000000); /* h/w flow control off */
  695. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  696. "+\n");
  697. set_io_port_base(KSEG1 + TBTX4927_ISA_IO_OFFSET);
  698. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  699. ":mips_io_port_base=0x%08lx\n",
  700. mips_io_port_base);
  701. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  702. ":Resource\n");
  703. ioport_resource.end = 0xffffffff;
  704. iomem_resource.end = 0xffffffff;
  705. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  706. ":ResetRoutines\n");
  707. _machine_restart = toshiba_rbtx4927_restart;
  708. _machine_halt = toshiba_rbtx4927_halt;
  709. _machine_power_off = toshiba_rbtx4927_power_off;
  710. #ifdef CONFIG_PCI
  711. /* PCIC */
  712. /*
  713. * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
  714. * PCIDIVMODE[12:11]'s initial value are given by S9[4:3] (ON:0, OFF:1).
  715. * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5)
  716. * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3)
  717. * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5)
  718. * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6)
  719. * i.e. S9[3]: ON (83MHz), OFF (100MHz)
  720. */
  721. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
  722. "ccfg is %lx, DIV is %x\n",
  723. (unsigned long) tx4927_ccfgptr->
  724. ccfg, TX4927_CCFG_PCIDIVMODE_MASK);
  725. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
  726. "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n",
  727. (unsigned long) tx4927_ccfgptr->
  728. ccfg & TX4927_CCFG_PCI66,
  729. (unsigned long) tx4927_ccfgptr->
  730. ccfg & TX4927_CCFG_PCIMIDE,
  731. (unsigned long) tx4927_ccfgptr->
  732. ccfg & TX4927_CCFG_PCIXARB);
  733. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
  734. "PCIDIVMODE is %lx\n",
  735. (unsigned long) tx4927_ccfgptr->
  736. ccfg & TX4927_CCFG_PCIDIVMODE_MASK);
  737. switch ((unsigned long) tx4927_ccfgptr->
  738. ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
  739. case TX4927_CCFG_PCIDIVMODE_2_5:
  740. case TX4927_CCFG_PCIDIVMODE_5:
  741. tx4927_cpu_clock = 166000000; /* 166MHz */
  742. break;
  743. default:
  744. tx4927_cpu_clock = 200000000; /* 200MHz */
  745. }
  746. /* CCFG */
  747. /* enable Timeout BusError */
  748. if (tx4927_ccfg_toeon)
  749. tx4927_ccfgptr->ccfg |= TX4927_CCFG_TOE;
  750. /* SDRAMC fixup */
  751. #ifdef CONFIG_TX4927BUG_WORKAROUND
  752. /*
  753. * TX4927-BUG: INF 01-01-18/ BUG 01-01-22
  754. * G-bus timeout error detection is incorrect
  755. */
  756. if (tx4927_ccfg_toeon)
  757. tx4927_sdramcptr->tr |= 0x02000000; /* RCD:3tck */
  758. #endif
  759. tx4927_pci_setup();
  760. if (tx4927_using_backplane == 1)
  761. printk("backplane board IS installed\n");
  762. else
  763. printk("No Backplane \n");
  764. /* this is on ISA bus behind PCI bus, so need PCI up first */
  765. #ifdef CONFIG_TOSHIBA_FPCIB0
  766. {
  767. if (tx4927_using_backplane) {
  768. TOSHIBA_RBTX4927_SETUP_DPRINTK
  769. (TOSHIBA_RBTX4927_SETUP_SETUP,
  770. ":fpcibo=yes\n");
  771. TOSHIBA_RBTX4927_SETUP_DPRINTK
  772. (TOSHIBA_RBTX4927_SETUP_SETUP,
  773. ":smsc_fdc37m81x_init()\n");
  774. smsc_fdc37m81x_init(0x3f0);
  775. TOSHIBA_RBTX4927_SETUP_DPRINTK
  776. (TOSHIBA_RBTX4927_SETUP_SETUP,
  777. ":smsc_fdc37m81x_config_beg()\n");
  778. smsc_fdc37m81x_config_beg();
  779. TOSHIBA_RBTX4927_SETUP_DPRINTK
  780. (TOSHIBA_RBTX4927_SETUP_SETUP,
  781. ":smsc_fdc37m81x_config_set(KBD)\n");
  782. smsc_fdc37m81x_config_set(SMSC_FDC37M81X_DNUM,
  783. SMSC_FDC37M81X_KBD);
  784. smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT, 1);
  785. smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT2, 12);
  786. smsc_fdc37m81x_config_set(SMSC_FDC37M81X_ACTIVE,
  787. 1);
  788. smsc_fdc37m81x_config_end();
  789. TOSHIBA_RBTX4927_SETUP_DPRINTK
  790. (TOSHIBA_RBTX4927_SETUP_SETUP,
  791. ":smsc_fdc37m81x_config_end()\n");
  792. } else {
  793. TOSHIBA_RBTX4927_SETUP_DPRINTK
  794. (TOSHIBA_RBTX4927_SETUP_SETUP,
  795. ":fpcibo=not_found\n");
  796. }
  797. }
  798. #else
  799. {
  800. TOSHIBA_RBTX4927_SETUP_DPRINTK
  801. (TOSHIBA_RBTX4927_SETUP_SETUP, ":fpcibo=no\n");
  802. }
  803. #endif
  804. #endif /* CONFIG_PCI */
  805. #ifdef CONFIG_SERIAL_TXX9
  806. {
  807. extern int early_serial_txx9_setup(struct uart_port *port);
  808. int i;
  809. struct uart_port req;
  810. for(i = 0; i < 2; i++) {
  811. memset(&req, 0, sizeof(req));
  812. req.line = i;
  813. req.iotype = UPIO_MEM;
  814. req.membase = (char *)(0xff1ff300 + i * 0x100);
  815. req.mapbase = 0xff1ff300 + i * 0x100;
  816. req.irq = 32 + i;
  817. req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
  818. req.uartclk = 50000000;
  819. early_serial_txx9_setup(&req);
  820. }
  821. }
  822. #ifdef CONFIG_SERIAL_TXX9_CONSOLE
  823. argptr = prom_getcmdline();
  824. if (strstr(argptr, "console=") == NULL) {
  825. strcat(argptr, " console=ttyS0,38400");
  826. }
  827. #endif
  828. #endif
  829. #ifdef CONFIG_ROOT_NFS
  830. argptr = prom_getcmdline();
  831. if (strstr(argptr, "root=") == NULL) {
  832. strcat(argptr, " root=/dev/nfs rw");
  833. }
  834. #endif
  835. #ifdef CONFIG_IP_PNP
  836. argptr = prom_getcmdline();
  837. if (strstr(argptr, "ip=") == NULL) {
  838. strcat(argptr, " ip=any");
  839. }
  840. #endif
  841. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  842. "+\n");
  843. }
  844. #ifdef CONFIG_RTC_DS1742
  845. extern unsigned long rtc_ds1742_get_time(void);
  846. extern int rtc_ds1742_set_time(unsigned long);
  847. extern void rtc_ds1742_wait(void);
  848. #endif
  849. void __init
  850. toshiba_rbtx4927_time_init(void)
  851. {
  852. u32 c1;
  853. u32 c2;
  854. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n");
  855. #ifdef CONFIG_RTC_DS1742
  856. rtc_get_time = rtc_ds1742_get_time;
  857. rtc_set_time = rtc_ds1742_set_time;
  858. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  859. ":rtc_ds1742_init()-\n");
  860. rtc_ds1742_init(0xbc010000);
  861. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  862. ":rtc_ds1742_init()+\n");
  863. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  864. ":Calibrate mips_hpt_frequency-\n");
  865. rtc_ds1742_wait();
  866. /* get the count */
  867. c1 = read_c0_count();
  868. /* wait for the seconds to change again */
  869. rtc_ds1742_wait();
  870. /* get the count again */
  871. c2 = read_c0_count();
  872. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  873. ":Calibrate mips_hpt_frequency+\n");
  874. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  875. ":c1=%12u\n", c1);
  876. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  877. ":c2=%12u\n", c2);
  878. /* this diff is as close as we are going to get to counter ticks per sec */
  879. mips_hpt_frequency = abs(c2 - c1);
  880. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  881. ":f1=%12u\n", mips_hpt_frequency);
  882. /* round to 1/10th of a MHz */
  883. mips_hpt_frequency /= (100 * 1000);
  884. mips_hpt_frequency *= (100 * 1000);
  885. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  886. ":f2=%12u\n", mips_hpt_frequency);
  887. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_INFO,
  888. ":mips_hpt_frequency=%uHz (%uMHz)\n",
  889. mips_hpt_frequency,
  890. mips_hpt_frequency / 1000000);
  891. #else
  892. mips_hpt_frequency = 100000000;
  893. #endif
  894. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n");
  895. }
  896. void __init toshiba_rbtx4927_timer_setup(struct irqaction *irq)
  897. {
  898. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP,
  899. "-\n");
  900. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP,
  901. "+\n");
  902. }