pmac_setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  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. static int current_root_goodness = -1;
  95. extern int pmac_newworld;
  96. #define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */
  97. extern void zs_kgdb_hook(int tty_num);
  98. static void ohare_init(void);
  99. #ifdef CONFIG_BOOTX_TEXT
  100. static void pmac_progress(char *s, unsigned short hex);
  101. #endif
  102. sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
  103. #ifdef CONFIG_SMP
  104. extern struct smp_ops_t psurge_smp_ops;
  105. extern struct smp_ops_t core99_smp_ops;
  106. #endif /* CONFIG_SMP */
  107. static int
  108. pmac_show_cpuinfo(struct seq_file *m)
  109. {
  110. struct device_node *np;
  111. char *pp;
  112. int plen;
  113. int mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO,
  114. NULL, PMAC_MB_INFO_MODEL, 0);
  115. unsigned int mbflags = (unsigned int)pmac_call_feature(PMAC_FTR_GET_MB_INFO,
  116. NULL, PMAC_MB_INFO_FLAGS, 0);
  117. char* mbname;
  118. if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME, (int)&mbname) != 0)
  119. mbname = "Unknown";
  120. /* find motherboard type */
  121. seq_printf(m, "machine\t\t: ");
  122. np = find_devices("device-tree");
  123. if (np != NULL) {
  124. pp = (char *) get_property(np, "model", NULL);
  125. if (pp != NULL)
  126. seq_printf(m, "%s\n", pp);
  127. else
  128. seq_printf(m, "PowerMac\n");
  129. pp = (char *) get_property(np, "compatible", &plen);
  130. if (pp != NULL) {
  131. seq_printf(m, "motherboard\t:");
  132. while (plen > 0) {
  133. int l = strlen(pp) + 1;
  134. seq_printf(m, " %s", pp);
  135. plen -= l;
  136. pp += l;
  137. }
  138. seq_printf(m, "\n");
  139. }
  140. } else
  141. seq_printf(m, "PowerMac\n");
  142. /* print parsed model */
  143. seq_printf(m, "detected as\t: %d (%s)\n", mbmodel, mbname);
  144. seq_printf(m, "pmac flags\t: %08x\n", mbflags);
  145. /* find l2 cache info */
  146. np = find_devices("l2-cache");
  147. if (np == 0)
  148. np = find_type_devices("cache");
  149. if (np != 0) {
  150. unsigned int *ic = (unsigned int *)
  151. get_property(np, "i-cache-size", NULL);
  152. unsigned int *dc = (unsigned int *)
  153. get_property(np, "d-cache-size", NULL);
  154. seq_printf(m, "L2 cache\t:");
  155. has_l2cache = 1;
  156. if (get_property(np, "cache-unified", NULL) != 0 && dc) {
  157. seq_printf(m, " %dK unified", *dc / 1024);
  158. } else {
  159. if (ic)
  160. seq_printf(m, " %dK instruction", *ic / 1024);
  161. if (dc)
  162. seq_printf(m, "%s %dK data",
  163. (ic? " +": ""), *dc / 1024);
  164. }
  165. pp = get_property(np, "ram-type", NULL);
  166. if (pp)
  167. seq_printf(m, " %s", pp);
  168. seq_printf(m, "\n");
  169. }
  170. /* find ram info */
  171. np = find_devices("memory");
  172. if (np != 0) {
  173. int n;
  174. struct reg_property *reg = (struct reg_property *)
  175. get_property(np, "reg", &n);
  176. if (reg != 0) {
  177. unsigned long total = 0;
  178. for (n /= sizeof(struct reg_property); n > 0; --n)
  179. total += (reg++)->size;
  180. seq_printf(m, "memory\t\t: %luMB\n", total >> 20);
  181. }
  182. }
  183. /* Checks "l2cr-value" property in the registry */
  184. np = find_devices("cpus");
  185. if (np == 0)
  186. np = find_type_devices("cpu");
  187. if (np != 0) {
  188. unsigned int *l2cr = (unsigned int *)
  189. get_property(np, "l2cr-value", NULL);
  190. if (l2cr != 0) {
  191. seq_printf(m, "l2cr override\t: 0x%x\n", *l2cr);
  192. }
  193. }
  194. /* Indicate newworld/oldworld */
  195. seq_printf(m, "pmac-generation\t: %s\n",
  196. pmac_newworld ? "NewWorld" : "OldWorld");
  197. return 0;
  198. }
  199. static int
  200. pmac_show_percpuinfo(struct seq_file *m, int i)
  201. {
  202. #ifdef CONFIG_CPU_FREQ_PMAC
  203. extern unsigned int pmac_get_one_cpufreq(int i);
  204. unsigned int freq = pmac_get_one_cpufreq(i);
  205. if (freq != 0) {
  206. seq_printf(m, "clock\t\t: %dMHz\n", freq/1000);
  207. return 0;
  208. }
  209. #endif /* CONFIG_CPU_FREQ_PMAC */
  210. return of_show_percpuinfo(m, i);
  211. }
  212. static volatile u32 *sysctrl_regs;
  213. void __init
  214. pmac_setup_arch(void)
  215. {
  216. struct device_node *cpu;
  217. int *fp;
  218. unsigned long pvr;
  219. pvr = PVR_VER(mfspr(SPRN_PVR));
  220. /* Set loops_per_jiffy to a half-way reasonable value,
  221. for use until calibrate_delay gets called. */
  222. cpu = find_type_devices("cpu");
  223. if (cpu != 0) {
  224. fp = (int *) get_property(cpu, "clock-frequency", NULL);
  225. if (fp != 0) {
  226. if (pvr == 4 || pvr >= 8)
  227. /* 604, G3, G4 etc. */
  228. loops_per_jiffy = *fp / HZ;
  229. else
  230. /* 601, 603, etc. */
  231. loops_per_jiffy = *fp / (2*HZ);
  232. } else
  233. loops_per_jiffy = 50000000 / HZ;
  234. }
  235. /* this area has the CPU identification register
  236. and some registers used by smp boards */
  237. sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000);
  238. ohare_init();
  239. /* Lookup PCI hosts */
  240. pmac_find_bridges();
  241. /* Checks "l2cr-value" property in the registry */
  242. if (cpu_has_feature(CPU_FTR_L2CR)) {
  243. struct device_node *np = find_devices("cpus");
  244. if (np == 0)
  245. np = find_type_devices("cpu");
  246. if (np != 0) {
  247. unsigned int *l2cr = (unsigned int *)
  248. get_property(np, "l2cr-value", NULL);
  249. if (l2cr != 0) {
  250. ppc_override_l2cr = 1;
  251. ppc_override_l2cr_value = *l2cr;
  252. _set_L2CR(0);
  253. _set_L2CR(ppc_override_l2cr_value);
  254. }
  255. }
  256. }
  257. if (ppc_override_l2cr)
  258. printk(KERN_INFO "L2CR overriden (0x%x), backside cache is %s\n",
  259. ppc_override_l2cr_value, (ppc_override_l2cr_value & 0x80000000)
  260. ? "enabled" : "disabled");
  261. #ifdef CONFIG_KGDB
  262. zs_kgdb_hook(0);
  263. #endif
  264. #ifdef CONFIG_ADB_CUDA
  265. find_via_cuda();
  266. #else
  267. if (find_devices("via-cuda")) {
  268. printk("WARNING ! Your machine is Cuda based but your kernel\n");
  269. printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n");
  270. }
  271. #endif
  272. #ifdef CONFIG_ADB_PMU
  273. find_via_pmu();
  274. #else
  275. if (find_devices("via-pmu")) {
  276. printk("WARNING ! Your machine is PMU based but your kernel\n");
  277. printk(" wasn't compiled with CONFIG_ADB_PMU option !\n");
  278. }
  279. #endif
  280. #ifdef CONFIG_NVRAM
  281. pmac_nvram_init();
  282. #endif
  283. #ifdef CONFIG_BLK_DEV_INITRD
  284. if (initrd_start)
  285. ROOT_DEV = Root_RAM0;
  286. else
  287. #endif
  288. ROOT_DEV = DEFAULT_ROOT_DEVICE;
  289. #ifdef CONFIG_SMP
  290. /* Check for Core99 */
  291. if (find_devices("uni-n") || find_devices("u3"))
  292. ppc_md.smp_ops = &core99_smp_ops;
  293. else
  294. ppc_md.smp_ops = &psurge_smp_ops;
  295. #endif /* CONFIG_SMP */
  296. pci_create_OF_bus_map();
  297. }
  298. static void __init ohare_init(void)
  299. {
  300. /*
  301. * Turn on the L2 cache.
  302. * We assume that we have a PSX memory controller iff
  303. * we have an ohare I/O controller.
  304. */
  305. if (find_devices("ohare") != NULL) {
  306. if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
  307. if (sysctrl_regs[4] & 0x10)
  308. sysctrl_regs[4] |= 0x04000020;
  309. else
  310. sysctrl_regs[4] |= 0x04000000;
  311. if(has_l2cache)
  312. printk(KERN_INFO "Level 2 cache enabled\n");
  313. }
  314. }
  315. }
  316. extern char *bootpath;
  317. extern char *bootdevice;
  318. void *boot_host;
  319. int boot_target;
  320. int boot_part;
  321. extern dev_t boot_dev;
  322. #ifdef CONFIG_SCSI
  323. void __init
  324. note_scsi_host(struct device_node *node, void *host)
  325. {
  326. int l;
  327. char *p;
  328. l = strlen(node->full_name);
  329. if (bootpath != NULL && bootdevice != NULL
  330. && strncmp(node->full_name, bootdevice, l) == 0
  331. && (bootdevice[l] == '/' || bootdevice[l] == 0)) {
  332. boot_host = host;
  333. /*
  334. * There's a bug in OF 1.0.5. (Why am I not surprised.)
  335. * If you pass a path like scsi/sd@1:0 to canon, it returns
  336. * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0
  337. * That is, the scsi target number doesn't get preserved.
  338. * So we pick the target number out of bootpath and use that.
  339. */
  340. p = strstr(bootpath, "/sd@");
  341. if (p != NULL) {
  342. p += 4;
  343. boot_target = simple_strtoul(p, NULL, 10);
  344. p = strchr(p, ':');
  345. if (p != NULL)
  346. boot_part = simple_strtoul(p + 1, NULL, 10);
  347. }
  348. }
  349. }
  350. #endif
  351. #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
  352. static dev_t __init
  353. find_ide_boot(void)
  354. {
  355. char *p;
  356. int n;
  357. dev_t __init pmac_find_ide_boot(char *bootdevice, int n);
  358. if (bootdevice == NULL)
  359. return 0;
  360. p = strrchr(bootdevice, '/');
  361. if (p == NULL)
  362. return 0;
  363. n = p - bootdevice;
  364. return pmac_find_ide_boot(bootdevice, n);
  365. }
  366. #endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
  367. static void __init
  368. find_boot_device(void)
  369. {
  370. #if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
  371. boot_dev = find_ide_boot();
  372. #endif
  373. }
  374. static int initializing = 1;
  375. /* TODO: Merge the suspend-to-ram with the common code !!!
  376. * currently, this is a stub implementation for suspend-to-disk
  377. * only
  378. */
  379. #ifdef CONFIG_SOFTWARE_SUSPEND
  380. static int pmac_pm_prepare(suspend_state_t state)
  381. {
  382. printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
  383. return 0;
  384. }
  385. static int pmac_pm_enter(suspend_state_t state)
  386. {
  387. printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
  388. /* Giveup the lazy FPU & vec so we don't have to back them
  389. * up from the low level code
  390. */
  391. enable_kernel_fp();
  392. #ifdef CONFIG_ALTIVEC
  393. if (cur_cpu_spec[0]->cpu_features & CPU_FTR_ALTIVEC)
  394. enable_kernel_altivec();
  395. #endif /* CONFIG_ALTIVEC */
  396. return 0;
  397. }
  398. static int pmac_pm_finish(suspend_state_t state)
  399. {
  400. printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
  401. /* Restore userland MMU context */
  402. set_context(current->active_mm->context, current->active_mm->pgd);
  403. return 0;
  404. }
  405. static struct pm_ops pmac_pm_ops = {
  406. .pm_disk_mode = PM_DISK_SHUTDOWN,
  407. .prepare = pmac_pm_prepare,
  408. .enter = pmac_pm_enter,
  409. .finish = pmac_pm_finish,
  410. };
  411. #endif /* CONFIG_SOFTWARE_SUSPEND */
  412. static int pmac_late_init(void)
  413. {
  414. initializing = 0;
  415. #ifdef CONFIG_SOFTWARE_SUSPEND
  416. pm_set_ops(&pmac_pm_ops);
  417. #endif /* CONFIG_SOFTWARE_SUSPEND */
  418. return 0;
  419. }
  420. late_initcall(pmac_late_init);
  421. /* can't be __init - can be called whenever a disk is first accessed */
  422. void
  423. note_bootable_part(dev_t dev, int part, int goodness)
  424. {
  425. static int found_boot = 0;
  426. char *p;
  427. if (!initializing)
  428. return;
  429. if ((goodness <= current_root_goodness) &&
  430. ROOT_DEV != DEFAULT_ROOT_DEVICE)
  431. return;
  432. p = strstr(saved_command_line, "root=");
  433. if (p != NULL && (p == saved_command_line || p[-1] == ' '))
  434. return;
  435. if (!found_boot) {
  436. find_boot_device();
  437. found_boot = 1;
  438. }
  439. if (!boot_dev || dev == boot_dev) {
  440. ROOT_DEV = dev + part;
  441. boot_dev = 0;
  442. current_root_goodness = goodness;
  443. }
  444. }
  445. static void
  446. pmac_restart(char *cmd)
  447. {
  448. #ifdef CONFIG_ADB_CUDA
  449. struct adb_request req;
  450. #endif /* CONFIG_ADB_CUDA */
  451. switch (sys_ctrler) {
  452. #ifdef CONFIG_ADB_CUDA
  453. case SYS_CTRLER_CUDA:
  454. cuda_request(&req, NULL, 2, CUDA_PACKET,
  455. CUDA_RESET_SYSTEM);
  456. for (;;)
  457. cuda_poll();
  458. break;
  459. #endif /* CONFIG_ADB_CUDA */
  460. #ifdef CONFIG_ADB_PMU
  461. case SYS_CTRLER_PMU:
  462. pmu_restart();
  463. break;
  464. #endif /* CONFIG_ADB_PMU */
  465. default: ;
  466. }
  467. }
  468. static void
  469. pmac_power_off(void)
  470. {
  471. #ifdef CONFIG_ADB_CUDA
  472. struct adb_request req;
  473. #endif /* CONFIG_ADB_CUDA */
  474. switch (sys_ctrler) {
  475. #ifdef CONFIG_ADB_CUDA
  476. case SYS_CTRLER_CUDA:
  477. cuda_request(&req, NULL, 2, CUDA_PACKET,
  478. CUDA_POWERDOWN);
  479. for (;;)
  480. cuda_poll();
  481. break;
  482. #endif /* CONFIG_ADB_CUDA */
  483. #ifdef CONFIG_ADB_PMU
  484. case SYS_CTRLER_PMU:
  485. pmu_shutdown();
  486. break;
  487. #endif /* CONFIG_ADB_PMU */
  488. default: ;
  489. }
  490. }
  491. static void
  492. pmac_halt(void)
  493. {
  494. pmac_power_off();
  495. }
  496. void __init
  497. pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
  498. unsigned long r6, unsigned long r7)
  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);