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