toshiba_rbtx4927_setup.c 31 KB

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