toshiba_rbtx4927_setup.c 29 KB

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