pmac_setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. /*
  2. * arch/ppc/platforms/setup.c
  3. *
  4. * PowerPC version
  5. * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
  6. *
  7. * Adapted for Power Macintosh by Paul Mackerras
  8. * Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au)
  9. *
  10. * Derived from "arch/alpha/kernel/setup.c"
  11. * Copyright (C) 1995 Linus Torvalds
  12. *
  13. * Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org)
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License
  17. * as published by the Free Software Foundation; either version
  18. * 2 of the License, or (at your option) any later version.
  19. *
  20. */
  21. /*
  22. * bootup setup stuff..
  23. */
  24. #include <linux/config.h>
  25. #include <linux/init.h>
  26. #include <linux/errno.h>
  27. #include <linux/sched.h>
  28. #include <linux/kernel.h>
  29. #include <linux/mm.h>
  30. #include <linux/stddef.h>
  31. #include <linux/unistd.h>
  32. #include <linux/ptrace.h>
  33. #include <linux/slab.h>
  34. #include <linux/user.h>
  35. #include <linux/a.out.h>
  36. #include <linux/tty.h>
  37. #include <linux/string.h>
  38. #include <linux/delay.h>
  39. #include <linux/ioport.h>
  40. #include <linux/major.h>
  41. #include <linux/initrd.h>
  42. #include <linux/vt_kern.h>
  43. #include <linux/console.h>
  44. #include <linux/ide.h>
  45. #include <linux/pci.h>
  46. #include <linux/adb.h>
  47. #include <linux/cuda.h>
  48. #include <linux/pmu.h>
  49. #include <linux/irq.h>
  50. #include <linux/seq_file.h>
  51. #include <linux/root_dev.h>
  52. #include <linux/bitops.h>
  53. #include <linux/suspend.h>
  54. #include <asm/reg.h>
  55. #include <asm/sections.h>
  56. #include <asm/prom.h>
  57. #include <asm/system.h>
  58. #include <asm/pgtable.h>
  59. #include <asm/io.h>
  60. #include <asm/pci-bridge.h>
  61. #include <asm/ohare.h>
  62. #include <asm/mediabay.h>
  63. #include <asm/machdep.h>
  64. #include <asm/dma.h>
  65. #include <asm/bootx.h>
  66. #include <asm/cputable.h>
  67. #include <asm/btext.h>
  68. #include <asm/pmac_feature.h>
  69. #include <asm/time.h>
  70. #include <asm/of_device.h>
  71. #include <asm/mmu_context.h>
  72. #include "pmac_pic.h"
  73. #undef SHOW_GATWICK_IRQS
  74. extern long pmac_time_init(void);
  75. extern unsigned long pmac_get_rtc_time(void);
  76. extern int pmac_set_rtc_time(unsigned long nowtime);
  77. extern void pmac_read_rtc_time(void);
  78. extern void pmac_calibrate_decr(void);
  79. extern void pmac_pcibios_fixup(void);
  80. extern void pmac_find_bridges(void);
  81. extern unsigned long pmac_ide_get_base(int index);
  82. extern void pmac_ide_init_hwif_ports(hw_regs_t *hw,
  83. unsigned long data_port, unsigned long ctrl_port, int *irq);
  84. extern void pmac_nvram_update(void);
  85. extern unsigned char pmac_nvram_read_byte(int addr);
  86. extern void pmac_nvram_write_byte(int addr, unsigned char val);
  87. extern int pmac_pci_enable_device_hook(struct pci_dev *dev, int initial);
  88. extern void pmac_pcibios_after_init(void);
  89. extern int of_show_percpuinfo(struct seq_file *m, int i);
  90. unsigned char drive_info;
  91. int ppc_override_l2cr = 0;
  92. int ppc_override_l2cr_value;
  93. int has_l2cache = 0;
  94. int pmac_newworld = 1;
  95. static int current_root_goodness = -1;
  96. extern int pmac_newworld;
  97. #define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */
  98. extern void zs_kgdb_hook(int tty_num);
  99. static void ohare_init(void);
  100. #ifdef CONFIG_BOOTX_TEXT
  101. static void pmac_progress(char *s, unsigned short hex);
  102. #endif
  103. sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
  104. #ifdef CONFIG_SMP
  105. extern struct smp_ops_t psurge_smp_ops;
  106. extern struct smp_ops_t core99_smp_ops;
  107. #endif /* CONFIG_SMP */
  108. static int
  109. pmac_show_cpuinfo(struct seq_file *m)
  110. {
  111. struct device_node *np;
  112. char *pp;
  113. int plen;
  114. int mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO,
  115. NULL, PMAC_MB_INFO_MODEL, 0);
  116. unsigned int mbflags = (unsigned int)pmac_call_feature(PMAC_FTR_GET_MB_INFO,
  117. NULL, PMAC_MB_INFO_FLAGS, 0);
  118. char* mbname;
  119. if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME, (int)&mbname) != 0)
  120. mbname = "Unknown";
  121. /* find motherboard type */
  122. seq_printf(m, "machine\t\t: ");
  123. np = find_devices("device-tree");
  124. if (np != NULL) {
  125. pp = (char *) get_property(np, "model", NULL);
  126. if (pp != NULL)
  127. seq_printf(m, "%s\n", pp);
  128. else
  129. seq_printf(m, "PowerMac\n");
  130. pp = (char *) get_property(np, "compatible", &plen);
  131. if (pp != NULL) {
  132. seq_printf(m, "motherboard\t:");
  133. while (plen > 0) {
  134. int l = strlen(pp) + 1;
  135. seq_printf(m, " %s", pp);
  136. plen -= l;
  137. pp += l;
  138. }
  139. seq_printf(m, "\n");
  140. }
  141. } else
  142. seq_printf(m, "PowerMac\n");
  143. /* print parsed model */
  144. seq_printf(m, "detected as\t: %d (%s)\n", mbmodel, mbname);
  145. seq_printf(m, "pmac flags\t: %08x\n", mbflags);
  146. /* find l2 cache info */
  147. np = find_devices("l2-cache");
  148. if (np == 0)
  149. np = find_type_devices("cache");
  150. if (np != 0) {
  151. unsigned int *ic = (unsigned int *)
  152. get_property(np, "i-cache-size", NULL);
  153. unsigned int *dc = (unsigned int *)
  154. get_property(np, "d-cache-size", NULL);
  155. seq_printf(m, "L2 cache\t:");
  156. has_l2cache = 1;
  157. if (get_property(np, "cache-unified", NULL) != 0 && dc) {
  158. seq_printf(m, " %dK unified", *dc / 1024);
  159. } else {
  160. if (ic)
  161. seq_printf(m, " %dK instruction", *ic / 1024);
  162. if (dc)
  163. seq_printf(m, "%s %dK data",
  164. (ic? " +": ""), *dc / 1024);
  165. }
  166. pp = get_property(np, "ram-type", NULL);
  167. if (pp)
  168. seq_printf(m, " %s", pp);
  169. seq_printf(m, "\n");
  170. }
  171. /* find ram info */
  172. np = find_devices("memory");
  173. if (np != 0) {
  174. int n;
  175. struct reg_property *reg = (struct reg_property *)
  176. get_property(np, "reg", &n);
  177. if (reg != 0) {
  178. unsigned long total = 0;
  179. for (n /= sizeof(struct reg_property); n > 0; --n)
  180. total += (reg++)->size;
  181. seq_printf(m, "memory\t\t: %luMB\n", total >> 20);
  182. }
  183. }
  184. /* Checks "l2cr-value" property in the registry */
  185. np = find_devices("cpus");
  186. if (np == 0)
  187. np = find_type_devices("cpu");
  188. if (np != 0) {
  189. unsigned int *l2cr = (unsigned int *)
  190. get_property(np, "l2cr-value", NULL);
  191. if (l2cr != 0) {
  192. seq_printf(m, "l2cr override\t: 0x%x\n", *l2cr);
  193. }
  194. }
  195. /* Indicate newworld/oldworld */
  196. seq_printf(m, "pmac-generation\t: %s\n",
  197. pmac_newworld ? "NewWorld" : "OldWorld");
  198. return 0;
  199. }
  200. static int
  201. pmac_show_percpuinfo(struct seq_file *m, int i)
  202. {
  203. #ifdef CONFIG_CPU_FREQ_PMAC
  204. extern unsigned int pmac_get_one_cpufreq(int i);
  205. unsigned int freq = pmac_get_one_cpufreq(i);
  206. if (freq != 0) {
  207. seq_printf(m, "clock\t\t: %dMHz\n", freq/1000);
  208. return 0;
  209. }
  210. #endif /* CONFIG_CPU_FREQ_PMAC */
  211. return of_show_percpuinfo(m, i);
  212. }
  213. static volatile u32 *sysctrl_regs;
  214. void __init
  215. pmac_setup_arch(void)
  216. {
  217. struct device_node *cpu;
  218. int *fp;
  219. unsigned long pvr;
  220. pvr = PVR_VER(mfspr(SPRN_PVR));
  221. /* Set loops_per_jiffy to a half-way reasonable value,
  222. for use until calibrate_delay gets called. */
  223. cpu = find_type_devices("cpu");
  224. if (cpu != 0) {
  225. fp = (int *) get_property(cpu, "clock-frequency", NULL);
  226. if (fp != 0) {
  227. if (pvr == 4 || pvr >= 8)
  228. /* 604, G3, G4 etc. */
  229. loops_per_jiffy = *fp / HZ;
  230. else
  231. /* 601, 603, etc. */
  232. loops_per_jiffy = *fp / (2*HZ);
  233. } else
  234. loops_per_jiffy = 50000000 / HZ;
  235. }
  236. /* this area has the CPU identification register
  237. and some registers used by smp boards */
  238. sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000);
  239. ohare_init();
  240. /* Lookup PCI hosts */
  241. pmac_find_bridges();
  242. /* Checks "l2cr-value" property in the registry */
  243. if (cpu_has_feature(CPU_FTR_L2CR)) {
  244. struct device_node *np = find_devices("cpus");
  245. if (np == 0)
  246. np = find_type_devices("cpu");
  247. if (np != 0) {
  248. unsigned int *l2cr = (unsigned int *)
  249. get_property(np, "l2cr-value", NULL);
  250. if (l2cr != 0) {
  251. ppc_override_l2cr = 1;
  252. ppc_override_l2cr_value = *l2cr;
  253. _set_L2CR(0);
  254. _set_L2CR(ppc_override_l2cr_value);
  255. }
  256. }
  257. }
  258. if (ppc_override_l2cr)
  259. printk(KERN_INFO "L2CR overriden (0x%x), backside cache is %s\n",
  260. ppc_override_l2cr_value, (ppc_override_l2cr_value & 0x80000000)
  261. ? "enabled" : "disabled");
  262. #ifdef CONFIG_KGDB
  263. zs_kgdb_hook(0);
  264. #endif
  265. #ifdef CONFIG_ADB_CUDA
  266. find_via_cuda();
  267. #else
  268. if (find_devices("via-cuda")) {
  269. printk("WARNING ! Your machine is Cuda based but your kernel\n");
  270. printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n");
  271. }
  272. #endif
  273. #ifdef CONFIG_ADB_PMU
  274. find_via_pmu();
  275. #else
  276. if (find_devices("via-pmu")) {
  277. printk("WARNING ! Your machine is PMU based but your kernel\n");
  278. printk(" wasn't compiled with CONFIG_ADB_PMU option !\n");
  279. }
  280. #endif
  281. #ifdef CONFIG_NVRAM
  282. pmac_nvram_init();
  283. #endif
  284. #ifdef CONFIG_BLK_DEV_INITRD
  285. if (initrd_start)
  286. ROOT_DEV = Root_RAM0;
  287. else
  288. #endif
  289. ROOT_DEV = DEFAULT_ROOT_DEVICE;
  290. #ifdef CONFIG_SMP
  291. /* Check for Core99 */
  292. if (find_devices("uni-n") || find_devices("u3"))
  293. ppc_md.smp_ops = &core99_smp_ops;
  294. else
  295. ppc_md.smp_ops = &psurge_smp_ops;
  296. #endif /* CONFIG_SMP */
  297. pci_create_OF_bus_map();
  298. }
  299. static void __init ohare_init(void)
  300. {
  301. /*
  302. * Turn on the L2 cache.
  303. * We assume that we have a PSX memory controller iff
  304. * we have an ohare I/O controller.
  305. */
  306. if (find_devices("ohare") != NULL) {
  307. if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
  308. if (sysctrl_regs[4] & 0x10)
  309. sysctrl_regs[4] |= 0x04000020;
  310. else
  311. sysctrl_regs[4] |= 0x04000000;
  312. if(has_l2cache)
  313. printk(KERN_INFO "Level 2 cache enabled\n");
  314. }
  315. }
  316. }
  317. char *bootpath;
  318. char *bootdevice;
  319. void *boot_host;
  320. int boot_target;
  321. int boot_part;
  322. extern dev_t boot_dev;
  323. #ifdef CONFIG_SCSI
  324. void __init
  325. note_scsi_host(struct device_node *node, void *host)
  326. {
  327. int l;
  328. char *p;
  329. l = strlen(node->full_name);
  330. if (bootpath != NULL && bootdevice != NULL
  331. && strncmp(node->full_name, bootdevice, l) == 0
  332. && (bootdevice[l] == '/' || bootdevice[l] == 0)) {
  333. boot_host = host;
  334. /*
  335. * There's a bug in OF 1.0.5. (Why am I not surprised.)
  336. * If you pass a path like scsi/sd@1:0 to canon, it returns
  337. * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0
  338. * That is, the scsi target number doesn't get preserved.
  339. * So we pick the target number out of bootpath and use that.
  340. */
  341. p = strstr(bootpath, "/sd@");
  342. if (p != NULL) {
  343. p += 4;
  344. boot_target = simple_strtoul(p, NULL, 10);
  345. p = strchr(p, ':');
  346. if (p != NULL)
  347. boot_part = simple_strtoul(p + 1, NULL, 10);
  348. }
  349. }
  350. }
  351. EXPORT_SYMBOL(note_scsi_host);
  352. #endif
  353. #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
  354. static dev_t __init
  355. find_ide_boot(void)
  356. {
  357. char *p;
  358. int n;
  359. dev_t __init pmac_find_ide_boot(char *bootdevice, int n);
  360. if (bootdevice == NULL)
  361. return 0;
  362. p = strrchr(bootdevice, '/');
  363. if (p == NULL)
  364. return 0;
  365. n = p - bootdevice;
  366. return pmac_find_ide_boot(bootdevice, n);
  367. }
  368. #endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
  369. static void __init
  370. find_boot_device(void)
  371. {
  372. #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
  373. boot_dev = find_ide_boot();
  374. #endif
  375. }
  376. static int initializing = 1;
  377. /* TODO: Merge the suspend-to-ram with the common code !!!
  378. * currently, this is a stub implementation for suspend-to-disk
  379. * only
  380. */
  381. #ifdef CONFIG_SOFTWARE_SUSPEND
  382. static int pmac_pm_prepare(suspend_state_t state)
  383. {
  384. printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
  385. return 0;
  386. }
  387. static int pmac_pm_enter(suspend_state_t state)
  388. {
  389. printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
  390. /* Giveup the lazy FPU & vec so we don't have to back them
  391. * up from the low level code
  392. */
  393. enable_kernel_fp();
  394. #ifdef CONFIG_ALTIVEC
  395. if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC)
  396. enable_kernel_altivec();
  397. #endif /* CONFIG_ALTIVEC */
  398. return 0;
  399. }
  400. static int pmac_pm_finish(suspend_state_t state)
  401. {
  402. printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
  403. /* Restore userland MMU context */
  404. set_context(current->active_mm->context, current->active_mm->pgd);
  405. return 0;
  406. }
  407. static struct pm_ops pmac_pm_ops = {
  408. .pm_disk_mode = PM_DISK_SHUTDOWN,
  409. .prepare = pmac_pm_prepare,
  410. .enter = pmac_pm_enter,
  411. .finish = pmac_pm_finish,
  412. };
  413. #endif /* CONFIG_SOFTWARE_SUSPEND */
  414. static int pmac_late_init(void)
  415. {
  416. initializing = 0;
  417. #ifdef CONFIG_SOFTWARE_SUSPEND
  418. pm_set_ops(&pmac_pm_ops);
  419. #endif /* CONFIG_SOFTWARE_SUSPEND */
  420. return 0;
  421. }
  422. late_initcall(pmac_late_init);
  423. /* can't be __init - can be called whenever a disk is first accessed */
  424. void
  425. note_bootable_part(dev_t dev, int part, int goodness)
  426. {
  427. static int found_boot = 0;
  428. char *p;
  429. if (!initializing)
  430. return;
  431. if ((goodness <= current_root_goodness) &&
  432. ROOT_DEV != DEFAULT_ROOT_DEVICE)
  433. return;
  434. p = strstr(saved_command_line, "root=");
  435. if (p != NULL && (p == saved_command_line || p[-1] == ' '))
  436. return;
  437. if (!found_boot) {
  438. find_boot_device();
  439. found_boot = 1;
  440. }
  441. if (!boot_dev || dev == boot_dev) {
  442. ROOT_DEV = dev + part;
  443. boot_dev = 0;
  444. current_root_goodness = goodness;
  445. }
  446. }
  447. static void
  448. pmac_restart(char *cmd)
  449. {
  450. #ifdef CONFIG_ADB_CUDA
  451. struct adb_request req;
  452. #endif /* CONFIG_ADB_CUDA */
  453. switch (sys_ctrler) {
  454. #ifdef CONFIG_ADB_CUDA
  455. case SYS_CTRLER_CUDA:
  456. cuda_request(&req, NULL, 2, CUDA_PACKET,
  457. CUDA_RESET_SYSTEM);
  458. for (;;)
  459. cuda_poll();
  460. break;
  461. #endif /* CONFIG_ADB_CUDA */
  462. #ifdef CONFIG_ADB_PMU
  463. case SYS_CTRLER_PMU:
  464. pmu_restart();
  465. break;
  466. #endif /* CONFIG_ADB_PMU */
  467. default: ;
  468. }
  469. }
  470. static void
  471. pmac_power_off(void)
  472. {
  473. #ifdef CONFIG_ADB_CUDA
  474. struct adb_request req;
  475. #endif /* CONFIG_ADB_CUDA */
  476. switch (sys_ctrler) {
  477. #ifdef CONFIG_ADB_CUDA
  478. case SYS_CTRLER_CUDA:
  479. cuda_request(&req, NULL, 2, CUDA_PACKET,
  480. CUDA_POWERDOWN);
  481. for (;;)
  482. cuda_poll();
  483. break;
  484. #endif /* CONFIG_ADB_CUDA */
  485. #ifdef CONFIG_ADB_PMU
  486. case SYS_CTRLER_PMU:
  487. pmu_shutdown();
  488. break;
  489. #endif /* CONFIG_ADB_PMU */
  490. default: ;
  491. }
  492. }
  493. static void
  494. pmac_halt(void)
  495. {
  496. pmac_power_off();
  497. }
  498. void __init pmac_init(void)
  499. {
  500. /* isa_io_base gets set in pmac_find_bridges */
  501. isa_mem_base = PMAC_ISA_MEM_BASE;
  502. pci_dram_offset = PMAC_PCI_DRAM_OFFSET;
  503. ISA_DMA_THRESHOLD = ~0L;
  504. DMA_MODE_READ = 1;
  505. DMA_MODE_WRITE = 2;
  506. ppc_md.setup_arch = pmac_setup_arch;
  507. ppc_md.show_cpuinfo = pmac_show_cpuinfo;
  508. ppc_md.show_percpuinfo = pmac_show_percpuinfo;
  509. ppc_md.irq_canonicalize = NULL;
  510. ppc_md.init_IRQ = pmac_pic_init;
  511. ppc_md.get_irq = pmac_get_irq; /* Changed later on ... */
  512. ppc_md.pcibios_fixup = pmac_pcibios_fixup;
  513. ppc_md.pcibios_enable_device_hook = pmac_pci_enable_device_hook;
  514. ppc_md.pcibios_after_init = pmac_pcibios_after_init;
  515. ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
  516. ppc_md.restart = pmac_restart;
  517. ppc_md.power_off = pmac_power_off;
  518. ppc_md.halt = pmac_halt;
  519. ppc_md.time_init = pmac_time_init;
  520. ppc_md.set_rtc_time = pmac_set_rtc_time;
  521. ppc_md.get_rtc_time = pmac_get_rtc_time;
  522. ppc_md.calibrate_decr = pmac_calibrate_decr;
  523. ppc_md.feature_call = pmac_do_feature_call;
  524. #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
  525. #ifdef CONFIG_BLK_DEV_IDE_PMAC
  526. ppc_ide_md.ide_init_hwif = pmac_ide_init_hwif_ports;
  527. ppc_ide_md.default_io_base = pmac_ide_get_base;
  528. #endif /* CONFIG_BLK_DEV_IDE_PMAC */
  529. #endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
  530. #ifdef CONFIG_BOOTX_TEXT
  531. ppc_md.progress = pmac_progress;
  532. #endif /* CONFIG_BOOTX_TEXT */
  533. if (ppc_md.progress) ppc_md.progress("pmac_init(): exit", 0);
  534. }
  535. #ifdef CONFIG_BOOTX_TEXT
  536. static void __init
  537. pmac_progress(char *s, unsigned short hex)
  538. {
  539. if (boot_text_mapped) {
  540. btext_drawstring(s);
  541. btext_drawchar('\n');
  542. }
  543. }
  544. #endif /* CONFIG_BOOTX_TEXT */
  545. static int __init
  546. pmac_declare_of_platform_devices(void)
  547. {
  548. struct device_node *np;
  549. np = find_devices("uni-n");
  550. if (np) {
  551. for (np = np->child; np != NULL; np = np->sibling)
  552. if (strncmp(np->name, "i2c", 3) == 0) {
  553. of_platform_device_create(np, "uni-n-i2c",
  554. NULL);
  555. break;
  556. }
  557. }
  558. np = find_devices("u3");
  559. if (np) {
  560. for (np = np->child; np != NULL; np = np->sibling)
  561. if (strncmp(np->name, "i2c", 3) == 0) {
  562. of_platform_device_create(np, "u3-i2c",
  563. NULL);
  564. break;
  565. }
  566. }
  567. np = find_devices("valkyrie");
  568. if (np)
  569. of_platform_device_create(np, "valkyrie", NULL);
  570. np = find_devices("platinum");
  571. if (np)
  572. of_platform_device_create(np, "platinum", NULL);
  573. return 0;
  574. }
  575. device_initcall(pmac_declare_of_platform_devices);