toshiba_rbtx4927_setup.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  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. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  479. "setup pci_io_resource to 0x%08lx 0x%08lx\n",
  480. pci_io_resource.start,
  481. pci_io_resource.end);
  482. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  483. "setup pci_mem_resource to 0x%08lx 0x%08lx\n",
  484. pci_mem_resource.start,
  485. pci_mem_resource.end);
  486. if (!called) {
  487. printk
  488. ("TX4927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n",
  489. (unsigned short) (tx4927_pcicptr->pciid >> 16),
  490. (unsigned short) (tx4927_pcicptr->pciid & 0xffff),
  491. (unsigned short) (tx4927_pcicptr->pciccrev & 0xff),
  492. (!(tx4927_ccfgptr->
  493. ccfg & TX4927_CCFG_PCIXARB)) ? "External" :
  494. "Internal");
  495. called = 1;
  496. }
  497. printk("%s PCIC --%s PCICLK:",toshiba_name,
  498. (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : "");
  499. if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) {
  500. int pciclk = 0;
  501. switch ((unsigned long) tx4927_ccfgptr->
  502. ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
  503. case TX4927_CCFG_PCIDIVMODE_2_5:
  504. pciclk = tx4927_cpu_clock * 2 / 5;
  505. break;
  506. case TX4927_CCFG_PCIDIVMODE_3:
  507. pciclk = tx4927_cpu_clock / 3;
  508. break;
  509. case TX4927_CCFG_PCIDIVMODE_5:
  510. pciclk = tx4927_cpu_clock / 5;
  511. break;
  512. case TX4927_CCFG_PCIDIVMODE_6:
  513. pciclk = tx4927_cpu_clock / 6;
  514. break;
  515. }
  516. printk("Internal(%dMHz)", pciclk / 1000000);
  517. } else {
  518. int pciclk = 0;
  519. int pciclk_setting = *tx4927_pci_clk_ptr;
  520. switch (pciclk_setting & TX4927_PCI_CLK_MASK) {
  521. case TX4927_PCI_CLK_33:
  522. pciclk = 33333333;
  523. break;
  524. case TX4927_PCI_CLK_25:
  525. pciclk = 25000000;
  526. break;
  527. case TX4927_PCI_CLK_66:
  528. pciclk = 66666666;
  529. break;
  530. case TX4927_PCI_CLK_50:
  531. pciclk = 50000000;
  532. break;
  533. }
  534. printk("External(%dMHz)", pciclk / 1000000);
  535. }
  536. printk("\n");
  537. /* GB->PCI mappings */
  538. tx4927_pcicptr->g2piomask = (mips_pci_io_size - 1) >> 4;
  539. tx4927_pcicptr->g2piogbase = mips_pci_io_base |
  540. #ifdef __BIG_ENDIAN
  541. TX4927_PCIC_G2PIOGBASE_ECHG
  542. #else
  543. TX4927_PCIC_G2PIOGBASE_BSDIS
  544. #endif
  545. ;
  546. tx4927_pcicptr->g2piopbase = 0;
  547. tx4927_pcicptr->g2pmmask[0] = (mips_pci_mem_size - 1) >> 4;
  548. tx4927_pcicptr->g2pmgbase[0] = mips_pci_mem_base |
  549. #ifdef __BIG_ENDIAN
  550. TX4927_PCIC_G2PMnGBASE_ECHG
  551. #else
  552. TX4927_PCIC_G2PMnGBASE_BSDIS
  553. #endif
  554. ;
  555. tx4927_pcicptr->g2pmpbase[0] = mips_pci_mem_base;
  556. tx4927_pcicptr->g2pmmask[1] = 0;
  557. tx4927_pcicptr->g2pmgbase[1] = 0;
  558. tx4927_pcicptr->g2pmpbase[1] = 0;
  559. tx4927_pcicptr->g2pmmask[2] = 0;
  560. tx4927_pcicptr->g2pmgbase[2] = 0;
  561. tx4927_pcicptr->g2pmpbase[2] = 0;
  562. /* PCI->GB mappings (I/O 256B) */
  563. tx4927_pcicptr->p2giopbase = 0; /* 256B */
  564. /* PCI->GB mappings (MEM 512MB) M0 gets all of memory */
  565. tx4927_pcicptr->p2gm0plbase = 0;
  566. tx4927_pcicptr->p2gm0pubase = 0;
  567. tx4927_pcicptr->p2gmgbase[0] = 0 | TX4927_PCIC_P2GMnGBASE_TMEMEN |
  568. #ifdef __BIG_ENDIAN
  569. TX4927_PCIC_P2GMnGBASE_TECHG
  570. #else
  571. TX4927_PCIC_P2GMnGBASE_TBSDIS
  572. #endif
  573. ;
  574. /* PCI->GB mappings (MEM 16MB) -not used */
  575. tx4927_pcicptr->p2gm1plbase = 0xffffffff;
  576. #ifdef CONFIG_TX4927BUG_WORKAROUND
  577. /*
  578. * TX4927-PCIC-BUG: P2GM1PUBASE must be 0
  579. * if P2GM0PUBASE was 0.
  580. */
  581. tx4927_pcicptr->p2gm1pubase = 0;
  582. #else
  583. tx4927_pcicptr->p2gm1pubase = 0xffffffff;
  584. #endif
  585. tx4927_pcicptr->p2gmgbase[1] = 0;
  586. /* PCI->GB mappings (MEM 1MB) -not used */
  587. tx4927_pcicptr->p2gm2pbase = 0xffffffff;
  588. tx4927_pcicptr->p2gmgbase[2] = 0;
  589. /* Enable Initiator Memory 0 Space, I/O Space, Config */
  590. tx4927_pcicptr->pciccfg &= TX4927_PCIC_PCICCFG_LBWC_MASK;
  591. tx4927_pcicptr->pciccfg |=
  592. TX4927_PCIC_PCICCFG_IMSE0 | TX4927_PCIC_PCICCFG_IISE |
  593. TX4927_PCIC_PCICCFG_ICAE | TX4927_PCIC_PCICCFG_ATR;
  594. /* Do not use MEMMUL, MEMINF: YMFPCI card causes M_ABORT. */
  595. tx4927_pcicptr->pcicfg1 = 0;
  596. if (tx4927_pcic_trdyto >= 0) {
  597. tx4927_pcicptr->g2ptocnt &= ~0xff;
  598. tx4927_pcicptr->g2ptocnt |= (tx4927_pcic_trdyto & 0xff);
  599. }
  600. /* Clear All Local Bus Status */
  601. tx4927_pcicptr->pcicstatus = TX4927_PCIC_PCICSTATUS_ALL;
  602. /* Enable All Local Bus Interrupts */
  603. tx4927_pcicptr->pcicmask = TX4927_PCIC_PCICSTATUS_ALL;
  604. /* Clear All Initiator Status */
  605. tx4927_pcicptr->g2pstatus = TX4927_PCIC_G2PSTATUS_ALL;
  606. /* Enable All Initiator Interrupts */
  607. tx4927_pcicptr->g2pmask = TX4927_PCIC_G2PSTATUS_ALL;
  608. /* Clear All PCI Status Error */
  609. tx4927_pcicptr->pcistatus =
  610. (tx4927_pcicptr->pcistatus & 0x0000ffff) |
  611. (TX4927_PCIC_PCISTATUS_ALL << 16);
  612. /* Enable All PCI Status Error Interrupts */
  613. tx4927_pcicptr->pcimask = TX4927_PCIC_PCISTATUS_ALL;
  614. /* PCIC Int => IRC IRQ16 */
  615. tx4927_pcicptr->pcicfg2 =
  616. (tx4927_pcicptr->pcicfg2 & 0xffffff00) | TX4927_IR_PCIC;
  617. if (!(tx4927_ccfgptr->ccfg & TX4927_CCFG_PCIXARB)) {
  618. /* XXX */
  619. } else {
  620. /* Reset Bus Arbiter */
  621. tx4927_pcicptr->pbacfg = TX4927_PCIC_PBACFG_RPBA;
  622. /* Enable Bus Arbiter */
  623. tx4927_pcicptr->pbacfg = TX4927_PCIC_PBACFG_PBAEN;
  624. }
  625. tx4927_pcicptr->pcistatus = PCI_COMMAND_MASTER |
  626. PCI_COMMAND_MEMORY |
  627. PCI_COMMAND_PARITY | PCI_COMMAND_SERR;
  628. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2,
  629. ":pci setup complete:\n");
  630. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, "+\n");
  631. }
  632. #endif /* CONFIG_PCI */
  633. void toshiba_rbtx4927_restart(char *command)
  634. {
  635. printk(KERN_NOTICE "System Rebooting...\n");
  636. /* enable the s/w reset register */
  637. reg_wr08(RBTX4927_SW_RESET_ENABLE, RBTX4927_SW_RESET_ENABLE_SET);
  638. /* wait for enable to be seen */
  639. while ((reg_rd08(RBTX4927_SW_RESET_ENABLE) &
  640. RBTX4927_SW_RESET_ENABLE_SET) == 0x00);
  641. /* do a s/w reset */
  642. reg_wr08(RBTX4927_SW_RESET_DO, RBTX4927_SW_RESET_DO_SET);
  643. /* do something passive while waiting for reset */
  644. local_irq_disable();
  645. while (1)
  646. asm_wait();
  647. /* no return */
  648. }
  649. void toshiba_rbtx4927_halt(void)
  650. {
  651. printk(KERN_NOTICE "System Halted\n");
  652. local_irq_disable();
  653. while (1) {
  654. asm_wait();
  655. }
  656. /* no return */
  657. }
  658. void toshiba_rbtx4927_power_off(void)
  659. {
  660. toshiba_rbtx4927_halt();
  661. /* no return */
  662. }
  663. void __init toshiba_rbtx4927_setup(void)
  664. {
  665. vu32 cp0_config;
  666. char *argptr;
  667. printk("CPU is %s\n", toshiba_name);
  668. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  669. "-\n");
  670. /* f/w leaves this on at startup */
  671. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  672. ":Clearing STO_ERL.\n");
  673. clear_c0_status(ST0_ERL);
  674. /* enable caches -- HCP5 does this, pmon does not */
  675. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  676. ":Enabling TX49_CONF_IC,TX49_CONF_DC.\n");
  677. cp0_config = read_c0_config();
  678. cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC);
  679. write_c0_config(cp0_config);
  680. #ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
  681. {
  682. extern void dump_cp0(char *);
  683. dump_cp0("toshiba_rbtx4927_early_fw_fixup");
  684. }
  685. #endif
  686. /* setup irq stuff */
  687. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  688. ":Setting up tx4927 pic.\n");
  689. TX4927_WR(0xff1ff604, 0x00000400); /* irq trigger */
  690. TX4927_WR(0xff1ff608, 0x00000000); /* irq trigger */
  691. /* setup serial stuff */
  692. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  693. ":Setting up tx4927 sio.\n");
  694. TX4927_WR(0xff1ff314, 0x00000000); /* h/w flow control off */
  695. TX4927_WR(0xff1ff414, 0x00000000); /* h/w flow control off */
  696. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  697. "+\n");
  698. set_io_port_base(KSEG1 + TBTX4927_ISA_IO_OFFSET);
  699. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  700. ":mips_io_port_base=0x%08lx\n",
  701. mips_io_port_base);
  702. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  703. ":Resource\n");
  704. ioport_resource.end = 0xffffffff;
  705. iomem_resource.end = 0xffffffff;
  706. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  707. ":ResetRoutines\n");
  708. _machine_restart = toshiba_rbtx4927_restart;
  709. _machine_halt = toshiba_rbtx4927_halt;
  710. pm_power_off = toshiba_rbtx4927_power_off;
  711. #ifdef CONFIG_PCI
  712. /* PCIC */
  713. /*
  714. * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
  715. * PCIDIVMODE[12:11]'s initial value are given by S9[4:3] (ON:0, OFF:1).
  716. * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5)
  717. * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3)
  718. * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5)
  719. * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6)
  720. * i.e. S9[3]: ON (83MHz), OFF (100MHz)
  721. */
  722. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
  723. "ccfg is %lx, DIV is %x\n",
  724. (unsigned long) tx4927_ccfgptr->
  725. ccfg, TX4927_CCFG_PCIDIVMODE_MASK);
  726. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
  727. "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n",
  728. (unsigned long) tx4927_ccfgptr->
  729. ccfg & TX4927_CCFG_PCI66,
  730. (unsigned long) tx4927_ccfgptr->
  731. ccfg & TX4927_CCFG_PCIMIDE,
  732. (unsigned long) tx4927_ccfgptr->
  733. ccfg & TX4927_CCFG_PCIXARB);
  734. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1,
  735. "PCIDIVMODE is %lx\n",
  736. (unsigned long) tx4927_ccfgptr->
  737. ccfg & TX4927_CCFG_PCIDIVMODE_MASK);
  738. switch ((unsigned long) tx4927_ccfgptr->
  739. ccfg & TX4927_CCFG_PCIDIVMODE_MASK) {
  740. case TX4927_CCFG_PCIDIVMODE_2_5:
  741. case TX4927_CCFG_PCIDIVMODE_5:
  742. tx4927_cpu_clock = 166000000; /* 166MHz */
  743. break;
  744. default:
  745. tx4927_cpu_clock = 200000000; /* 200MHz */
  746. }
  747. /* CCFG */
  748. /* enable Timeout BusError */
  749. if (tx4927_ccfg_toeon)
  750. tx4927_ccfgptr->ccfg |= TX4927_CCFG_TOE;
  751. /* SDRAMC fixup */
  752. #ifdef CONFIG_TX4927BUG_WORKAROUND
  753. /*
  754. * TX4927-BUG: INF 01-01-18/ BUG 01-01-22
  755. * G-bus timeout error detection is incorrect
  756. */
  757. if (tx4927_ccfg_toeon)
  758. tx4927_sdramcptr->tr |= 0x02000000; /* RCD:3tck */
  759. #endif
  760. tx4927_pci_setup();
  761. if (tx4927_using_backplane == 1)
  762. printk("backplane board IS installed\n");
  763. else
  764. printk("No Backplane \n");
  765. /* this is on ISA bus behind PCI bus, so need PCI up first */
  766. #ifdef CONFIG_TOSHIBA_FPCIB0
  767. {
  768. if (tx4927_using_backplane) {
  769. TOSHIBA_RBTX4927_SETUP_DPRINTK
  770. (TOSHIBA_RBTX4927_SETUP_SETUP,
  771. ":fpcibo=yes\n");
  772. TOSHIBA_RBTX4927_SETUP_DPRINTK
  773. (TOSHIBA_RBTX4927_SETUP_SETUP,
  774. ":smsc_fdc37m81x_init()\n");
  775. smsc_fdc37m81x_init(0x3f0);
  776. TOSHIBA_RBTX4927_SETUP_DPRINTK
  777. (TOSHIBA_RBTX4927_SETUP_SETUP,
  778. ":smsc_fdc37m81x_config_beg()\n");
  779. smsc_fdc37m81x_config_beg();
  780. TOSHIBA_RBTX4927_SETUP_DPRINTK
  781. (TOSHIBA_RBTX4927_SETUP_SETUP,
  782. ":smsc_fdc37m81x_config_set(KBD)\n");
  783. smsc_fdc37m81x_config_set(SMSC_FDC37M81X_DNUM,
  784. SMSC_FDC37M81X_KBD);
  785. smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT, 1);
  786. smsc_fdc37m81x_config_set(SMSC_FDC37M81X_INT2, 12);
  787. smsc_fdc37m81x_config_set(SMSC_FDC37M81X_ACTIVE,
  788. 1);
  789. smsc_fdc37m81x_config_end();
  790. TOSHIBA_RBTX4927_SETUP_DPRINTK
  791. (TOSHIBA_RBTX4927_SETUP_SETUP,
  792. ":smsc_fdc37m81x_config_end()\n");
  793. } else {
  794. TOSHIBA_RBTX4927_SETUP_DPRINTK
  795. (TOSHIBA_RBTX4927_SETUP_SETUP,
  796. ":fpcibo=not_found\n");
  797. }
  798. }
  799. #else
  800. {
  801. TOSHIBA_RBTX4927_SETUP_DPRINTK
  802. (TOSHIBA_RBTX4927_SETUP_SETUP, ":fpcibo=no\n");
  803. }
  804. #endif
  805. #endif /* CONFIG_PCI */
  806. #ifdef CONFIG_SERIAL_TXX9
  807. {
  808. extern int early_serial_txx9_setup(struct uart_port *port);
  809. int i;
  810. struct uart_port req;
  811. for(i = 0; i < 2; i++) {
  812. memset(&req, 0, sizeof(req));
  813. req.line = i;
  814. req.iotype = UPIO_MEM;
  815. req.membase = (char *)(0xff1ff300 + i * 0x100);
  816. req.mapbase = 0xff1ff300 + i * 0x100;
  817. req.irq = 32 + i;
  818. req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
  819. req.uartclk = 50000000;
  820. early_serial_txx9_setup(&req);
  821. }
  822. }
  823. #ifdef CONFIG_SERIAL_TXX9_CONSOLE
  824. argptr = prom_getcmdline();
  825. if (strstr(argptr, "console=") == NULL) {
  826. strcat(argptr, " console=ttyS0,38400");
  827. }
  828. #endif
  829. #endif
  830. #ifdef CONFIG_ROOT_NFS
  831. argptr = prom_getcmdline();
  832. if (strstr(argptr, "root=") == NULL) {
  833. strcat(argptr, " root=/dev/nfs rw");
  834. }
  835. #endif
  836. #ifdef CONFIG_IP_PNP
  837. argptr = prom_getcmdline();
  838. if (strstr(argptr, "ip=") == NULL) {
  839. strcat(argptr, " ip=any");
  840. }
  841. #endif
  842. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_SETUP,
  843. "+\n");
  844. }
  845. #ifdef CONFIG_RTC_DS1742
  846. extern unsigned long rtc_ds1742_get_time(void);
  847. extern int rtc_ds1742_set_time(unsigned long);
  848. extern void rtc_ds1742_wait(void);
  849. #endif
  850. void __init
  851. toshiba_rbtx4927_time_init(void)
  852. {
  853. u32 c1;
  854. u32 c2;
  855. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n");
  856. #ifdef CONFIG_RTC_DS1742
  857. rtc_get_time = rtc_ds1742_get_time;
  858. rtc_set_time = rtc_ds1742_set_time;
  859. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  860. ":rtc_ds1742_init()-\n");
  861. rtc_ds1742_init(0xbc010000);
  862. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  863. ":rtc_ds1742_init()+\n");
  864. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  865. ":Calibrate mips_hpt_frequency-\n");
  866. rtc_ds1742_wait();
  867. /* get the count */
  868. c1 = read_c0_count();
  869. /* wait for the seconds to change again */
  870. rtc_ds1742_wait();
  871. /* get the count again */
  872. c2 = read_c0_count();
  873. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  874. ":Calibrate mips_hpt_frequency+\n");
  875. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  876. ":c1=%12u\n", c1);
  877. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  878. ":c2=%12u\n", c2);
  879. /* this diff is as close as we are going to get to counter ticks per sec */
  880. mips_hpt_frequency = abs(c2 - c1);
  881. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  882. ":f1=%12u\n", mips_hpt_frequency);
  883. /* round to 1/10th of a MHz */
  884. mips_hpt_frequency /= (100 * 1000);
  885. mips_hpt_frequency *= (100 * 1000);
  886. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
  887. ":f2=%12u\n", mips_hpt_frequency);
  888. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_INFO,
  889. ":mips_hpt_frequency=%uHz (%uMHz)\n",
  890. mips_hpt_frequency,
  891. mips_hpt_frequency / 1000000);
  892. #else
  893. mips_hpt_frequency = 100000000;
  894. #endif
  895. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n");
  896. }
  897. void __init toshiba_rbtx4927_timer_setup(struct irqaction *irq)
  898. {
  899. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP,
  900. "-\n");
  901. TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP,
  902. "+\n");
  903. }