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