toshiba_rbtx4927_setup.c 32 KB

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