toshiba_rbtx4927_setup.c 32 KB

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