p1022_ds.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /*
  2. * P1022DS board specific routines
  3. *
  4. * Authors: Travis Wheatley <travis.wheatley@freescale.com>
  5. * Dave Liu <daveliu@freescale.com>
  6. * Timur Tabi <timur@freescale.com>
  7. *
  8. * Copyright 2010 Freescale Semiconductor, Inc.
  9. *
  10. * This file is taken from the Freescale P1022DS BSP, with modifications:
  11. * 2) No AMP support
  12. * 3) No PCI endpoint support
  13. *
  14. * This file is licensed under the terms of the GNU General Public License
  15. * version 2. This program is licensed "as is" without any warranty of any
  16. * kind, whether express or implied.
  17. */
  18. #include <linux/pci.h>
  19. #include <linux/of_platform.h>
  20. #include <linux/memblock.h>
  21. #include <asm/div64.h>
  22. #include <asm/mpic.h>
  23. #include <asm/swiotlb.h>
  24. #include <sysdev/fsl_soc.h>
  25. #include <sysdev/fsl_pci.h>
  26. #include <asm/udbg.h>
  27. #include <asm/fsl_guts.h>
  28. #include <asm/fsl_lbc.h>
  29. #include "smp.h"
  30. #include "mpc85xx.h"
  31. #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
  32. #define PMUXCR_ELBCDIU_MASK 0xc0000000
  33. #define PMUXCR_ELBCDIU_NOR16 0x80000000
  34. #define PMUXCR_ELBCDIU_DIU 0x40000000
  35. /*
  36. * Board-specific initialization of the DIU. This code should probably be
  37. * executed when the DIU is opened, rather than in arch code, but the DIU
  38. * driver does not have a mechanism for this (yet).
  39. *
  40. * This is especially problematic on the P1022DS because the local bus (eLBC)
  41. * and the DIU video signals share the same pins, which means that enabling the
  42. * DIU will disable access to NOR flash.
  43. */
  44. /* DIU Pixel Clock bits of the CLKDVDR Global Utilities register */
  45. #define CLKDVDR_PXCKEN 0x80000000
  46. #define CLKDVDR_PXCKINV 0x10000000
  47. #define CLKDVDR_PXCKDLY 0x06000000
  48. #define CLKDVDR_PXCLK_MASK 0x00FF0000
  49. /* Some ngPIXIS register definitions */
  50. #define PX_CTL 3
  51. #define PX_BRDCFG0 8
  52. #define PX_BRDCFG1 9
  53. #define PX_BRDCFG0_ELBC_SPI_MASK 0xc0
  54. #define PX_BRDCFG0_ELBC_SPI_ELBC 0x00
  55. #define PX_BRDCFG0_ELBC_SPI_NULL 0xc0
  56. #define PX_BRDCFG0_ELBC_DIU 0x02
  57. #define PX_BRDCFG1_DVIEN 0x80
  58. #define PX_BRDCFG1_DFPEN 0x40
  59. #define PX_BRDCFG1_BACKLIGHT 0x20
  60. #define PX_BRDCFG1_DDCEN 0x10
  61. #define PX_CTL_ALTACC 0x80
  62. /*
  63. * DIU Area Descriptor
  64. *
  65. * Note that we need to byte-swap the value before it's written to the AD
  66. * register. So even though the registers don't look like they're in the same
  67. * bit positions as they are on the MPC8610, the same value is written to the
  68. * AD register on the MPC8610 and on the P1022.
  69. */
  70. #define AD_BYTE_F 0x10000000
  71. #define AD_ALPHA_C_MASK 0x0E000000
  72. #define AD_ALPHA_C_SHIFT 25
  73. #define AD_BLUE_C_MASK 0x01800000
  74. #define AD_BLUE_C_SHIFT 23
  75. #define AD_GREEN_C_MASK 0x00600000
  76. #define AD_GREEN_C_SHIFT 21
  77. #define AD_RED_C_MASK 0x00180000
  78. #define AD_RED_C_SHIFT 19
  79. #define AD_PALETTE 0x00040000
  80. #define AD_PIXEL_S_MASK 0x00030000
  81. #define AD_PIXEL_S_SHIFT 16
  82. #define AD_COMP_3_MASK 0x0000F000
  83. #define AD_COMP_3_SHIFT 12
  84. #define AD_COMP_2_MASK 0x00000F00
  85. #define AD_COMP_2_SHIFT 8
  86. #define AD_COMP_1_MASK 0x000000F0
  87. #define AD_COMP_1_SHIFT 4
  88. #define AD_COMP_0_MASK 0x0000000F
  89. #define AD_COMP_0_SHIFT 0
  90. #define MAKE_AD(alpha, red, blue, green, size, c0, c1, c2, c3) \
  91. cpu_to_le32(AD_BYTE_F | (alpha << AD_ALPHA_C_SHIFT) | \
  92. (blue << AD_BLUE_C_SHIFT) | (green << AD_GREEN_C_SHIFT) | \
  93. (red << AD_RED_C_SHIFT) | (c3 << AD_COMP_3_SHIFT) | \
  94. (c2 << AD_COMP_2_SHIFT) | (c1 << AD_COMP_1_SHIFT) | \
  95. (c0 << AD_COMP_0_SHIFT) | (size << AD_PIXEL_S_SHIFT))
  96. /**
  97. * p1022ds_get_pixel_format: return the Area Descriptor for a given pixel depth
  98. *
  99. * The Area Descriptor is a 32-bit value that determine which bits in each
  100. * pixel are to be used for each color.
  101. */
  102. static u32 p1022ds_get_pixel_format(enum fsl_diu_monitor_port port,
  103. unsigned int bits_per_pixel)
  104. {
  105. switch (bits_per_pixel) {
  106. case 32:
  107. /* 0x88883316 */
  108. return MAKE_AD(3, 2, 0, 1, 3, 8, 8, 8, 8);
  109. case 24:
  110. /* 0x88082219 */
  111. return MAKE_AD(4, 0, 1, 2, 2, 0, 8, 8, 8);
  112. case 16:
  113. /* 0x65053118 */
  114. return MAKE_AD(4, 2, 1, 0, 1, 5, 6, 5, 0);
  115. default:
  116. pr_err("fsl-diu: unsupported pixel depth %u\n", bits_per_pixel);
  117. return 0;
  118. }
  119. }
  120. /**
  121. * p1022ds_set_gamma_table: update the gamma table, if necessary
  122. *
  123. * On some boards, the gamma table for some ports may need to be modified.
  124. * This is not the case on the P1022DS, so we do nothing.
  125. */
  126. static void p1022ds_set_gamma_table(enum fsl_diu_monitor_port port,
  127. char *gamma_table_base)
  128. {
  129. }
  130. struct fsl_law {
  131. u32 lawbar;
  132. u32 reserved1;
  133. u32 lawar;
  134. u32 reserved[5];
  135. };
  136. #define LAWBAR_MASK 0x00F00000
  137. #define LAWBAR_SHIFT 12
  138. #define LAWAR_EN 0x80000000
  139. #define LAWAR_TGT_MASK 0x01F00000
  140. #define LAW_TRGT_IF_LBC (0x04 << 20)
  141. #define LAWAR_MASK (LAWAR_EN | LAWAR_TGT_MASK)
  142. #define LAWAR_MATCH (LAWAR_EN | LAW_TRGT_IF_LBC)
  143. #define BR_BA 0xFFFF8000
  144. /*
  145. * Map a BRx value to a physical address
  146. *
  147. * The localbus BRx registers only store the lower 32 bits of the address. To
  148. * obtain the upper four bits, we need to scan the LAW table. The entry which
  149. * maps to the localbus will contain the upper four bits.
  150. */
  151. static phys_addr_t lbc_br_to_phys(const void *ecm, unsigned int count, u32 br)
  152. {
  153. #ifndef CONFIG_PHYS_64BIT
  154. /*
  155. * If we only have 32-bit addressing, then the BRx address *is* the
  156. * physical address.
  157. */
  158. return br & BR_BA;
  159. #else
  160. const struct fsl_law *law = ecm + 0xc08;
  161. unsigned int i;
  162. for (i = 0; i < count; i++) {
  163. u64 lawbar = in_be32(&law[i].lawbar);
  164. u32 lawar = in_be32(&law[i].lawar);
  165. if ((lawar & LAWAR_MASK) == LAWAR_MATCH)
  166. /* Extract the upper four bits */
  167. return (br & BR_BA) | ((lawbar & LAWBAR_MASK) << 12);
  168. }
  169. return 0;
  170. #endif
  171. }
  172. /**
  173. * p1022ds_set_monitor_port: switch the output to a different monitor port
  174. */
  175. static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
  176. {
  177. struct device_node *guts_node;
  178. struct device_node *lbc_node = NULL;
  179. struct device_node *law_node = NULL;
  180. struct ccsr_guts __iomem *guts;
  181. struct fsl_lbc_regs *lbc = NULL;
  182. void *ecm = NULL;
  183. u8 __iomem *lbc_lcs0_ba = NULL;
  184. u8 __iomem *lbc_lcs1_ba = NULL;
  185. phys_addr_t cs0_addr, cs1_addr;
  186. u32 br0, or0, br1, or1;
  187. const __be32 *iprop;
  188. unsigned int num_laws;
  189. u8 b;
  190. /* Map the global utilities registers. */
  191. guts_node = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts");
  192. if (!guts_node) {
  193. pr_err("p1022ds: missing global utilties device node\n");
  194. return;
  195. }
  196. guts = of_iomap(guts_node, 0);
  197. if (!guts) {
  198. pr_err("p1022ds: could not map global utilties device\n");
  199. goto exit;
  200. }
  201. lbc_node = of_find_compatible_node(NULL, NULL, "fsl,p1022-elbc");
  202. if (!lbc_node) {
  203. pr_err("p1022ds: missing localbus node\n");
  204. goto exit;
  205. }
  206. lbc = of_iomap(lbc_node, 0);
  207. if (!lbc) {
  208. pr_err("p1022ds: could not map localbus node\n");
  209. goto exit;
  210. }
  211. law_node = of_find_compatible_node(NULL, NULL, "fsl,ecm-law");
  212. if (!law_node) {
  213. pr_err("p1022ds: missing local access window node\n");
  214. goto exit;
  215. }
  216. ecm = of_iomap(law_node, 0);
  217. if (!ecm) {
  218. pr_err("p1022ds: could not map local access window node\n");
  219. goto exit;
  220. }
  221. iprop = of_get_property(law_node, "fsl,num-laws", 0);
  222. if (!iprop) {
  223. pr_err("p1022ds: LAW node is missing fsl,num-laws property\n");
  224. goto exit;
  225. }
  226. num_laws = be32_to_cpup(iprop);
  227. /*
  228. * Indirect mode requires both BR0 and BR1 to be set to "GPCM",
  229. * otherwise writes to these addresses won't actually appear on the
  230. * local bus, and so the PIXIS won't see them.
  231. *
  232. * In FCM mode, writes go to the NAND controller, which does not pass
  233. * them to the localbus directly. So we force BR0 and BR1 into GPCM
  234. * mode, since we don't care about what's behind the localbus any
  235. * more.
  236. */
  237. br0 = in_be32(&lbc->bank[0].br);
  238. br1 = in_be32(&lbc->bank[1].br);
  239. or0 = in_be32(&lbc->bank[0].or);
  240. or1 = in_be32(&lbc->bank[1].or);
  241. /* Make sure CS0 and CS1 are programmed */
  242. if (!(br0 & BR_V) || !(br1 & BR_V)) {
  243. pr_err("p1022ds: CS0 and/or CS1 is not programmed\n");
  244. goto exit;
  245. }
  246. /*
  247. * Use the existing BRx/ORx values if it's already GPCM. Otherwise,
  248. * force the values to simple 32KB GPCM windows with the most
  249. * conservative timing.
  250. */
  251. if ((br0 & BR_MSEL) != BR_MS_GPCM) {
  252. br0 = (br0 & BR_BA) | BR_V;
  253. or0 = 0xFFFF8000 | 0xFF7;
  254. out_be32(&lbc->bank[0].br, br0);
  255. out_be32(&lbc->bank[0].or, or0);
  256. }
  257. if ((br1 & BR_MSEL) != BR_MS_GPCM) {
  258. br1 = (br1 & BR_BA) | BR_V;
  259. or1 = 0xFFFF8000 | 0xFF7;
  260. out_be32(&lbc->bank[1].br, br1);
  261. out_be32(&lbc->bank[1].or, or1);
  262. }
  263. cs0_addr = lbc_br_to_phys(ecm, num_laws, br0);
  264. if (!cs0_addr) {
  265. pr_err("p1022ds: could not determine physical address for CS0"
  266. " (BR0=%08x)\n", br0);
  267. goto exit;
  268. }
  269. cs1_addr = lbc_br_to_phys(ecm, num_laws, br1);
  270. if (!cs0_addr) {
  271. pr_err("p1022ds: could not determine physical address for CS1"
  272. " (BR1=%08x)\n", br1);
  273. goto exit;
  274. }
  275. lbc_lcs0_ba = ioremap(cs0_addr, 1);
  276. if (!lbc_lcs0_ba) {
  277. pr_err("p1022ds: could not ioremap CS0 address %llx\n",
  278. (unsigned long long)cs0_addr);
  279. goto exit;
  280. }
  281. lbc_lcs1_ba = ioremap(cs1_addr, 1);
  282. if (!lbc_lcs1_ba) {
  283. pr_err("p1022ds: could not ioremap CS1 address %llx\n",
  284. (unsigned long long)cs1_addr);
  285. goto exit;
  286. }
  287. /* Make sure we're in indirect mode first. */
  288. if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) !=
  289. PMUXCR_ELBCDIU_DIU) {
  290. struct device_node *pixis_node;
  291. void __iomem *pixis;
  292. pixis_node =
  293. of_find_compatible_node(NULL, NULL, "fsl,p1022ds-fpga");
  294. if (!pixis_node) {
  295. pr_err("p1022ds: missing pixis node\n");
  296. goto exit;
  297. }
  298. pixis = of_iomap(pixis_node, 0);
  299. of_node_put(pixis_node);
  300. if (!pixis) {
  301. pr_err("p1022ds: could not map pixis registers\n");
  302. goto exit;
  303. }
  304. /* Enable indirect PIXIS mode. */
  305. setbits8(pixis + PX_CTL, PX_CTL_ALTACC);
  306. iounmap(pixis);
  307. /* Switch the board mux to the DIU */
  308. out_8(lbc_lcs0_ba, PX_BRDCFG0); /* BRDCFG0 */
  309. b = in_8(lbc_lcs1_ba);
  310. b |= PX_BRDCFG0_ELBC_DIU;
  311. out_8(lbc_lcs1_ba, b);
  312. /* Set the chip mux to DIU mode. */
  313. clrsetbits_be32(&guts->pmuxcr, PMUXCR_ELBCDIU_MASK,
  314. PMUXCR_ELBCDIU_DIU);
  315. in_be32(&guts->pmuxcr);
  316. }
  317. switch (port) {
  318. case FSL_DIU_PORT_DVI:
  319. /* Enable the DVI port, disable the DFP and the backlight */
  320. out_8(lbc_lcs0_ba, PX_BRDCFG1);
  321. b = in_8(lbc_lcs1_ba);
  322. b &= ~(PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT);
  323. b |= PX_BRDCFG1_DVIEN;
  324. out_8(lbc_lcs1_ba, b);
  325. break;
  326. case FSL_DIU_PORT_LVDS:
  327. /*
  328. * LVDS also needs backlight enabled, otherwise the display
  329. * will be blank.
  330. */
  331. /* Enable the DFP port, disable the DVI and the backlight */
  332. out_8(lbc_lcs0_ba, PX_BRDCFG1);
  333. b = in_8(lbc_lcs1_ba);
  334. b &= ~PX_BRDCFG1_DVIEN;
  335. b |= PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT;
  336. out_8(lbc_lcs1_ba, b);
  337. break;
  338. default:
  339. pr_err("p1022ds: unsupported monitor port %i\n", port);
  340. }
  341. exit:
  342. if (lbc_lcs1_ba)
  343. iounmap(lbc_lcs1_ba);
  344. if (lbc_lcs0_ba)
  345. iounmap(lbc_lcs0_ba);
  346. if (lbc)
  347. iounmap(lbc);
  348. if (ecm)
  349. iounmap(ecm);
  350. if (guts)
  351. iounmap(guts);
  352. of_node_put(law_node);
  353. of_node_put(lbc_node);
  354. of_node_put(guts_node);
  355. }
  356. /**
  357. * p1022ds_set_pixel_clock: program the DIU's clock
  358. *
  359. * @pixclock: the wavelength, in picoseconds, of the clock
  360. */
  361. void p1022ds_set_pixel_clock(unsigned int pixclock)
  362. {
  363. struct device_node *guts_np = NULL;
  364. struct ccsr_guts __iomem *guts;
  365. unsigned long freq;
  366. u64 temp;
  367. u32 pxclk;
  368. /* Map the global utilities registers. */
  369. guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts");
  370. if (!guts_np) {
  371. pr_err("p1022ds: missing global utilties device node\n");
  372. return;
  373. }
  374. guts = of_iomap(guts_np, 0);
  375. of_node_put(guts_np);
  376. if (!guts) {
  377. pr_err("p1022ds: could not map global utilties device\n");
  378. return;
  379. }
  380. /* Convert pixclock from a wavelength to a frequency */
  381. temp = 1000000000000ULL;
  382. do_div(temp, pixclock);
  383. freq = temp;
  384. /*
  385. * 'pxclk' is the ratio of the platform clock to the pixel clock.
  386. * This number is programmed into the CLKDVDR register, and the valid
  387. * range of values is 2-255.
  388. */
  389. pxclk = DIV_ROUND_CLOSEST(fsl_get_sys_freq(), freq);
  390. pxclk = clamp_t(u32, pxclk, 2, 255);
  391. /* Disable the pixel clock, and set it to non-inverted and no delay */
  392. clrbits32(&guts->clkdvdr,
  393. CLKDVDR_PXCKEN | CLKDVDR_PXCKDLY | CLKDVDR_PXCLK_MASK);
  394. /* Enable the clock and set the pxclk */
  395. setbits32(&guts->clkdvdr, CLKDVDR_PXCKEN | (pxclk << 16));
  396. iounmap(guts);
  397. }
  398. /**
  399. * p1022ds_valid_monitor_port: set the monitor port for sysfs
  400. */
  401. enum fsl_diu_monitor_port
  402. p1022ds_valid_monitor_port(enum fsl_diu_monitor_port port)
  403. {
  404. switch (port) {
  405. case FSL_DIU_PORT_DVI:
  406. case FSL_DIU_PORT_LVDS:
  407. return port;
  408. default:
  409. return FSL_DIU_PORT_DVI; /* Dual-link LVDS is not supported */
  410. }
  411. }
  412. #endif
  413. void __init p1022_ds_pic_init(void)
  414. {
  415. struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
  416. MPIC_SINGLE_DEST_CPU,
  417. 0, 256, " OpenPIC ");
  418. BUG_ON(mpic == NULL);
  419. mpic_init(mpic);
  420. }
  421. #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
  422. /* TRUE if there is a "video=fslfb" command-line parameter. */
  423. static bool fslfb;
  424. /*
  425. * Search for a "video=fslfb" command-line parameter, and set 'fslfb' to
  426. * true if we find it.
  427. *
  428. * We need to use early_param() instead of __setup() because the normal
  429. * __setup() gets called to late. However, early_param() gets called very
  430. * early, before the device tree is unflattened, so all we can do now is set a
  431. * global variable. Later on, p1022_ds_setup_arch() will use that variable
  432. * to determine if we need to update the device tree.
  433. */
  434. static int __init early_video_setup(char *options)
  435. {
  436. fslfb = (strncmp(options, "fslfb:", 6) == 0);
  437. return 0;
  438. }
  439. early_param("video", early_video_setup);
  440. #endif
  441. /*
  442. * Setup the architecture
  443. */
  444. static void __init p1022_ds_setup_arch(void)
  445. {
  446. #ifdef CONFIG_PCI
  447. struct device_node *np;
  448. #endif
  449. dma_addr_t max = 0xffffffff;
  450. if (ppc_md.progress)
  451. ppc_md.progress("p1022_ds_setup_arch()", 0);
  452. #ifdef CONFIG_PCI
  453. for_each_compatible_node(np, "pci", "fsl,p1022-pcie") {
  454. struct resource rsrc;
  455. struct pci_controller *hose;
  456. of_address_to_resource(np, 0, &rsrc);
  457. if ((rsrc.start & 0xfffff) == 0x8000)
  458. fsl_add_bridge(np, 1);
  459. else
  460. fsl_add_bridge(np, 0);
  461. hose = pci_find_hose_for_OF_device(np);
  462. max = min(max, hose->dma_window_base_cur +
  463. hose->dma_window_size);
  464. }
  465. #endif
  466. #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
  467. diu_ops.get_pixel_format = p1022ds_get_pixel_format;
  468. diu_ops.set_gamma_table = p1022ds_set_gamma_table;
  469. diu_ops.set_monitor_port = p1022ds_set_monitor_port;
  470. diu_ops.set_pixel_clock = p1022ds_set_pixel_clock;
  471. diu_ops.valid_monitor_port = p1022ds_valid_monitor_port;
  472. /*
  473. * Disable the NOR and NAND flash nodes if there is video=fslfb...
  474. * command-line parameter. When the DIU is active, the localbus is
  475. * unavailable, so we have to disable these nodes before the MTD
  476. * driver loads.
  477. */
  478. if (fslfb) {
  479. struct device_node *np =
  480. of_find_compatible_node(NULL, NULL, "fsl,p1022-elbc");
  481. if (np) {
  482. struct device_node *np2;
  483. of_node_get(np);
  484. np2 = of_find_compatible_node(np, NULL, "cfi-flash");
  485. if (np2) {
  486. static struct property nor_status = {
  487. .name = "status",
  488. .value = "disabled",
  489. .length = sizeof("disabled"),
  490. };
  491. /*
  492. * prom_update_property() is called before
  493. * kmalloc() is available, so the 'new' object
  494. * should be allocated in the global area.
  495. * The easiest way is to do that is to
  496. * allocate one static local variable for each
  497. * call to this function.
  498. */
  499. pr_info("p1022ds: disabling %s node",
  500. np2->full_name);
  501. prom_update_property(np2, &nor_status);
  502. of_node_put(np2);
  503. }
  504. of_node_get(np);
  505. np2 = of_find_compatible_node(np, NULL,
  506. "fsl,elbc-fcm-nand");
  507. if (np2) {
  508. static struct property nand_status = {
  509. .name = "status",
  510. .value = "disabled",
  511. .length = sizeof("disabled"),
  512. };
  513. pr_info("p1022ds: disabling %s node",
  514. np2->full_name);
  515. prom_update_property(np2, &nand_status);
  516. of_node_put(np2);
  517. }
  518. of_node_put(np);
  519. }
  520. }
  521. #endif
  522. mpc85xx_smp_init();
  523. #ifdef CONFIG_SWIOTLB
  524. if ((memblock_end_of_DRAM() - 1) > max) {
  525. ppc_swiotlb_enable = 1;
  526. set_pci_dma_ops(&swiotlb_dma_ops);
  527. ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
  528. }
  529. #endif
  530. pr_info("Freescale P1022 DS reference board\n");
  531. }
  532. machine_device_initcall(p1022_ds, mpc85xx_common_publish_devices);
  533. machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier);
  534. /*
  535. * Called very early, device-tree isn't unflattened
  536. */
  537. static int __init p1022_ds_probe(void)
  538. {
  539. unsigned long root = of_get_flat_dt_root();
  540. return of_flat_dt_is_compatible(root, "fsl,p1022ds");
  541. }
  542. define_machine(p1022_ds) {
  543. .name = "P1022 DS",
  544. .probe = p1022_ds_probe,
  545. .setup_arch = p1022_ds_setup_arch,
  546. .init_IRQ = p1022_ds_pic_init,
  547. #ifdef CONFIG_PCI
  548. .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
  549. #endif
  550. .get_irq = mpic_get_irq,
  551. .restart = fsl_rstcr_restart,
  552. .calibrate_decr = generic_calibrate_decr,
  553. .progress = udbg_progress,
  554. };