setup_tx4939.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. /*
  2. * TX4939 setup routines
  3. * Based on linux/arch/mips/txx9/generic/setup_tx4938.c,
  4. * and RBTX49xx patch from CELF patch archive.
  5. *
  6. * 2003-2005 (c) MontaVista Software, Inc.
  7. * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007
  8. *
  9. * This file is subject to the terms and conditions of the GNU General Public
  10. * License. See the file "COPYING" in the main directory of this archive
  11. * for more details.
  12. */
  13. #include <linux/init.h>
  14. #include <linux/ioport.h>
  15. #include <linux/delay.h>
  16. #include <linux/netdevice.h>
  17. #include <linux/notifier.h>
  18. #include <linux/sysdev.h>
  19. #include <linux/ethtool.h>
  20. #include <linux/param.h>
  21. #include <linux/ptrace.h>
  22. #include <linux/mtd/physmap.h>
  23. #include <linux/platform_device.h>
  24. #include <asm/bootinfo.h>
  25. #include <asm/reboot.h>
  26. #include <asm/traps.h>
  27. #include <asm/txx9irq.h>
  28. #include <asm/txx9tmr.h>
  29. #include <asm/txx9/generic.h>
  30. #include <asm/txx9/tx4939.h>
  31. static void __init tx4939_wdr_init(void)
  32. {
  33. /* report watchdog reset status */
  34. if (____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_WDRST)
  35. pr_warning("Watchdog reset detected at 0x%lx\n",
  36. read_c0_errorepc());
  37. /* clear WatchDogReset (W1C) */
  38. tx4939_ccfg_set(TX4939_CCFG_WDRST);
  39. /* do reset on watchdog */
  40. tx4939_ccfg_set(TX4939_CCFG_WR);
  41. }
  42. void __init tx4939_wdt_init(void)
  43. {
  44. txx9_wdt_init(TX4939_TMR_REG(2) & 0xfffffffffULL);
  45. }
  46. static void tx4939_machine_restart(char *command)
  47. {
  48. local_irq_disable();
  49. pr_emerg("Rebooting (with %s watchdog reset)...\n",
  50. (____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_WDREXEN) ?
  51. "external" : "internal");
  52. /* clear watchdog status */
  53. tx4939_ccfg_set(TX4939_CCFG_WDRST); /* W1C */
  54. txx9_wdt_now(TX4939_TMR_REG(2) & 0xfffffffffULL);
  55. while (!(____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_WDRST))
  56. ;
  57. mdelay(10);
  58. if (____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_WDREXEN) {
  59. pr_emerg("Rebooting (with internal watchdog reset)...\n");
  60. /* External WDRST failed. Do internal watchdog reset */
  61. tx4939_ccfg_clear(TX4939_CCFG_WDREXEN);
  62. }
  63. /* fallback */
  64. (*_machine_halt)();
  65. }
  66. void show_registers(struct pt_regs *regs);
  67. static int tx4939_be_handler(struct pt_regs *regs, int is_fixup)
  68. {
  69. int data = regs->cp0_cause & 4;
  70. console_verbose();
  71. pr_err("%cBE exception at %#lx\n",
  72. data ? 'D' : 'I', regs->cp0_epc);
  73. pr_err("ccfg:%llx, toea:%llx\n",
  74. (unsigned long long)____raw_readq(&tx4939_ccfgptr->ccfg),
  75. (unsigned long long)____raw_readq(&tx4939_ccfgptr->toea));
  76. #ifdef CONFIG_PCI
  77. tx4927_report_pcic_status();
  78. #endif
  79. show_registers(regs);
  80. panic("BusError!");
  81. }
  82. static void __init tx4939_be_init(void)
  83. {
  84. board_be_handler = tx4939_be_handler;
  85. }
  86. static struct resource tx4939_sdram_resource[4];
  87. static struct resource tx4939_sram_resource;
  88. #define TX4939_SRAM_SIZE 0x800
  89. void __init tx4939_add_memory_regions(void)
  90. {
  91. int i;
  92. unsigned long start, size;
  93. u64 win;
  94. for (i = 0; i < 4; i++) {
  95. if (!((__u32)____raw_readq(&tx4939_ddrcptr->winen) & (1 << i)))
  96. continue;
  97. win = ____raw_readq(&tx4939_ddrcptr->win[i]);
  98. start = (unsigned long)(win >> 48);
  99. size = (((unsigned long)(win >> 32) & 0xffff) + 1) - start;
  100. add_memory_region(start << 20, size << 20, BOOT_MEM_RAM);
  101. }
  102. }
  103. void __init tx4939_setup(void)
  104. {
  105. int i;
  106. __u32 divmode;
  107. __u64 pcfg;
  108. int cpuclk = 0;
  109. txx9_reg_res_init(TX4939_REV_PCODE(), TX4939_REG_BASE,
  110. TX4939_REG_SIZE);
  111. set_c0_config(TX49_CONF_CWFON);
  112. /* SDRAMC,EBUSC are configured by PROM */
  113. for (i = 0; i < 4; i++) {
  114. if (!(TX4939_EBUSC_CR(i) & 0x8))
  115. continue; /* disabled */
  116. txx9_ce_res[i].start = (unsigned long)TX4939_EBUSC_BA(i);
  117. txx9_ce_res[i].end =
  118. txx9_ce_res[i].start + TX4939_EBUSC_SIZE(i) - 1;
  119. request_resource(&iomem_resource, &txx9_ce_res[i]);
  120. }
  121. /* clocks */
  122. if (txx9_master_clock) {
  123. /* calculate cpu_clock from master_clock */
  124. divmode = (__u32)____raw_readq(&tx4939_ccfgptr->ccfg) &
  125. TX4939_CCFG_MULCLK_MASK;
  126. cpuclk = txx9_master_clock * 20 / 2;
  127. switch (divmode) {
  128. case TX4939_CCFG_MULCLK_8:
  129. cpuclk = cpuclk / 3 * 4 /* / 6 * 8 */; break;
  130. case TX4939_CCFG_MULCLK_9:
  131. cpuclk = cpuclk / 2 * 3 /* / 6 * 9 */; break;
  132. case TX4939_CCFG_MULCLK_10:
  133. cpuclk = cpuclk / 3 * 5 /* / 6 * 10 */; break;
  134. case TX4939_CCFG_MULCLK_11:
  135. cpuclk = cpuclk / 6 * 11; break;
  136. case TX4939_CCFG_MULCLK_12:
  137. cpuclk = cpuclk * 2 /* / 6 * 12 */; break;
  138. case TX4939_CCFG_MULCLK_13:
  139. cpuclk = cpuclk / 6 * 13; break;
  140. case TX4939_CCFG_MULCLK_14:
  141. cpuclk = cpuclk / 3 * 7 /* / 6 * 14 */; break;
  142. case TX4939_CCFG_MULCLK_15:
  143. cpuclk = cpuclk / 2 * 5 /* / 6 * 15 */; break;
  144. }
  145. txx9_cpu_clock = cpuclk;
  146. } else {
  147. if (txx9_cpu_clock == 0)
  148. txx9_cpu_clock = 400000000; /* 400MHz */
  149. /* calculate master_clock from cpu_clock */
  150. cpuclk = txx9_cpu_clock;
  151. divmode = (__u32)____raw_readq(&tx4939_ccfgptr->ccfg) &
  152. TX4939_CCFG_MULCLK_MASK;
  153. switch (divmode) {
  154. case TX4939_CCFG_MULCLK_8:
  155. txx9_master_clock = cpuclk * 6 / 8; break;
  156. case TX4939_CCFG_MULCLK_9:
  157. txx9_master_clock = cpuclk * 6 / 9; break;
  158. case TX4939_CCFG_MULCLK_10:
  159. txx9_master_clock = cpuclk * 6 / 10; break;
  160. case TX4939_CCFG_MULCLK_11:
  161. txx9_master_clock = cpuclk * 6 / 11; break;
  162. case TX4939_CCFG_MULCLK_12:
  163. txx9_master_clock = cpuclk * 6 / 12; break;
  164. case TX4939_CCFG_MULCLK_13:
  165. txx9_master_clock = cpuclk * 6 / 13; break;
  166. case TX4939_CCFG_MULCLK_14:
  167. txx9_master_clock = cpuclk * 6 / 14; break;
  168. case TX4939_CCFG_MULCLK_15:
  169. txx9_master_clock = cpuclk * 6 / 15; break;
  170. }
  171. txx9_master_clock /= 10; /* * 2 / 20 */
  172. }
  173. /* calculate gbus_clock from cpu_clock */
  174. divmode = (__u32)____raw_readq(&tx4939_ccfgptr->ccfg) &
  175. TX4939_CCFG_YDIVMODE_MASK;
  176. txx9_gbus_clock = txx9_cpu_clock;
  177. switch (divmode) {
  178. case TX4939_CCFG_YDIVMODE_2:
  179. txx9_gbus_clock /= 2; break;
  180. case TX4939_CCFG_YDIVMODE_3:
  181. txx9_gbus_clock /= 3; break;
  182. case TX4939_CCFG_YDIVMODE_5:
  183. txx9_gbus_clock /= 5; break;
  184. case TX4939_CCFG_YDIVMODE_6:
  185. txx9_gbus_clock /= 6; break;
  186. }
  187. /* change default value to udelay/mdelay take reasonable time */
  188. loops_per_jiffy = txx9_cpu_clock / HZ / 2;
  189. /* CCFG */
  190. tx4939_wdr_init();
  191. /* clear BusErrorOnWrite flag (W1C) */
  192. tx4939_ccfg_set(TX4939_CCFG_WDRST | TX4939_CCFG_BEOW);
  193. /* enable Timeout BusError */
  194. if (txx9_ccfg_toeon)
  195. tx4939_ccfg_set(TX4939_CCFG_TOE);
  196. /* DMA selection */
  197. txx9_clear64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_DMASEL_ALL);
  198. /* Use external clock for external arbiter */
  199. if (!(____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_PCIARB))
  200. txx9_clear64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_PCICLKEN_ALL);
  201. pr_info("%s -- %dMHz(M%dMHz,G%dMHz) CRIR:%08x CCFG:%llx PCFG:%llx\n",
  202. txx9_pcode_str,
  203. (cpuclk + 500000) / 1000000,
  204. (txx9_master_clock + 500000) / 1000000,
  205. (txx9_gbus_clock + 500000) / 1000000,
  206. (__u32)____raw_readq(&tx4939_ccfgptr->crir),
  207. (unsigned long long)____raw_readq(&tx4939_ccfgptr->ccfg),
  208. (unsigned long long)____raw_readq(&tx4939_ccfgptr->pcfg));
  209. pr_info("%s DDRC -- EN:%08x", txx9_pcode_str,
  210. (__u32)____raw_readq(&tx4939_ddrcptr->winen));
  211. for (i = 0; i < 4; i++) {
  212. __u64 win = ____raw_readq(&tx4939_ddrcptr->win[i]);
  213. if (!((__u32)____raw_readq(&tx4939_ddrcptr->winen) & (1 << i)))
  214. continue; /* disabled */
  215. printk(KERN_CONT " #%d:%016llx", i, (unsigned long long)win);
  216. tx4939_sdram_resource[i].name = "DDR SDRAM";
  217. tx4939_sdram_resource[i].start =
  218. (unsigned long)(win >> 48) << 20;
  219. tx4939_sdram_resource[i].end =
  220. ((((unsigned long)(win >> 32) & 0xffff) + 1) <<
  221. 20) - 1;
  222. tx4939_sdram_resource[i].flags = IORESOURCE_MEM;
  223. request_resource(&iomem_resource, &tx4939_sdram_resource[i]);
  224. }
  225. printk(KERN_CONT "\n");
  226. /* SRAM */
  227. if (____raw_readq(&tx4939_sramcptr->cr) & 1) {
  228. unsigned int size = TX4939_SRAM_SIZE;
  229. tx4939_sram_resource.name = "SRAM";
  230. tx4939_sram_resource.start =
  231. (____raw_readq(&tx4939_sramcptr->cr) >> (39-11))
  232. & ~(size - 1);
  233. tx4939_sram_resource.end =
  234. tx4939_sram_resource.start + TX4939_SRAM_SIZE - 1;
  235. tx4939_sram_resource.flags = IORESOURCE_MEM;
  236. request_resource(&iomem_resource, &tx4939_sram_resource);
  237. }
  238. /* TMR */
  239. /* disable all timers */
  240. for (i = 0; i < TX4939_NR_TMR; i++)
  241. txx9_tmr_init(TX4939_TMR_REG(i) & 0xfffffffffULL);
  242. /* DMA */
  243. for (i = 0; i < 2; i++)
  244. ____raw_writeq(TX4938_DMA_MCR_MSTEN,
  245. (void __iomem *)(TX4939_DMA_REG(i) + 0x50));
  246. /* set PCIC1 reset (required to prevent hangup on BIST) */
  247. txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_PCI1RST);
  248. pcfg = ____raw_readq(&tx4939_ccfgptr->pcfg);
  249. if (pcfg & (TX4939_PCFG_ET0MODE | TX4939_PCFG_ET1MODE)) {
  250. mdelay(1); /* at least 128 cpu clock */
  251. /* clear PCIC1 reset */
  252. txx9_clear64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_PCI1RST);
  253. } else {
  254. pr_info("%s: stop PCIC1\n", txx9_pcode_str);
  255. /* stop PCIC1 */
  256. txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_PCI1CKD);
  257. }
  258. if (!(pcfg & TX4939_PCFG_ET0MODE)) {
  259. pr_info("%s: stop ETH0\n", txx9_pcode_str);
  260. txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_ETH0RST);
  261. txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_ETH0CKD);
  262. }
  263. if (!(pcfg & TX4939_PCFG_ET1MODE)) {
  264. pr_info("%s: stop ETH1\n", txx9_pcode_str);
  265. txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_ETH1RST);
  266. txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_ETH1CKD);
  267. }
  268. _machine_restart = tx4939_machine_restart;
  269. board_be_init = tx4939_be_init;
  270. }
  271. void __init tx4939_time_init(unsigned int tmrnr)
  272. {
  273. if (____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_TINTDIS)
  274. txx9_clockevent_init(TX4939_TMR_REG(tmrnr) & 0xfffffffffULL,
  275. TXX9_IRQ_BASE + TX4939_IR_TMR(tmrnr),
  276. TXX9_IMCLK);
  277. }
  278. void __init tx4939_sio_init(unsigned int sclk, unsigned int cts_mask)
  279. {
  280. int i;
  281. unsigned int ch_mask = 0;
  282. __u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg);
  283. cts_mask |= ~1; /* only SIO0 have RTS/CTS */
  284. if ((pcfg & TX4939_PCFG_SIO2MODE_MASK) != TX4939_PCFG_SIO2MODE_SIO0)
  285. cts_mask |= 1 << 0; /* disable SIO0 RTS/CTS by PCFG setting */
  286. if ((pcfg & TX4939_PCFG_SIO2MODE_MASK) != TX4939_PCFG_SIO2MODE_SIO2)
  287. ch_mask |= 1 << 2; /* disable SIO2 by PCFG setting */
  288. if (pcfg & TX4939_PCFG_SIO3MODE)
  289. ch_mask |= 1 << 3; /* disable SIO3 by PCFG setting */
  290. for (i = 0; i < 4; i++) {
  291. if ((1 << i) & ch_mask)
  292. continue;
  293. txx9_sio_init(TX4939_SIO_REG(i) & 0xfffffffffULL,
  294. TXX9_IRQ_BASE + TX4939_IR_SIO(i),
  295. i, sclk, (1 << i) & cts_mask);
  296. }
  297. }
  298. #if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE)
  299. static int tx4939_get_eth_speed(struct net_device *dev)
  300. {
  301. struct ethtool_cmd cmd = { ETHTOOL_GSET };
  302. int speed = 100; /* default 100Mbps */
  303. int err;
  304. if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
  305. return speed;
  306. err = dev->ethtool_ops->get_settings(dev, &cmd);
  307. if (err < 0)
  308. return speed;
  309. speed = cmd.speed == SPEED_100 ? 100 : 10;
  310. return speed;
  311. }
  312. static int tx4939_netdev_event(struct notifier_block *this,
  313. unsigned long event,
  314. void *ptr)
  315. {
  316. struct net_device *dev = ptr;
  317. if (event == NETDEV_CHANGE && netif_carrier_ok(dev)) {
  318. __u64 bit = 0;
  319. if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(0))
  320. bit = TX4939_PCFG_SPEED0;
  321. else if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(1))
  322. bit = TX4939_PCFG_SPEED1;
  323. if (bit) {
  324. int speed = tx4939_get_eth_speed(dev);
  325. if (speed == 100)
  326. txx9_set64(&tx4939_ccfgptr->pcfg, bit);
  327. else
  328. txx9_clear64(&tx4939_ccfgptr->pcfg, bit);
  329. }
  330. }
  331. return NOTIFY_DONE;
  332. }
  333. static struct notifier_block tx4939_netdev_notifier = {
  334. .notifier_call = tx4939_netdev_event,
  335. .priority = 1,
  336. };
  337. void __init tx4939_ethaddr_init(unsigned char *addr0, unsigned char *addr1)
  338. {
  339. u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg);
  340. if (addr0 && (pcfg & TX4939_PCFG_ET0MODE))
  341. txx9_ethaddr_init(TXX9_IRQ_BASE + TX4939_IR_ETH(0), addr0);
  342. if (addr1 && (pcfg & TX4939_PCFG_ET1MODE))
  343. txx9_ethaddr_init(TXX9_IRQ_BASE + TX4939_IR_ETH(1), addr1);
  344. register_netdevice_notifier(&tx4939_netdev_notifier);
  345. }
  346. #else
  347. void __init tx4939_ethaddr_init(unsigned char *addr0, unsigned char *addr1)
  348. {
  349. }
  350. #endif
  351. void __init tx4939_mtd_init(int ch)
  352. {
  353. struct physmap_flash_data pdata = {
  354. .width = TX4939_EBUSC_WIDTH(ch) / 8,
  355. };
  356. unsigned long start = txx9_ce_res[ch].start;
  357. unsigned long size = txx9_ce_res[ch].end - start + 1;
  358. if (!(TX4939_EBUSC_CR(ch) & 0x8))
  359. return; /* disabled */
  360. txx9_physmap_flash_init(ch, start, size, &pdata);
  361. }
  362. #define TX4939_ATA_REG_PHYS(ch) (TX4939_ATA_REG(ch) & 0xfffffffffULL)
  363. void __init tx4939_ata_init(void)
  364. {
  365. static struct resource ata0_res[] = {
  366. {
  367. .start = TX4939_ATA_REG_PHYS(0),
  368. .end = TX4939_ATA_REG_PHYS(0) + 0x1000 - 1,
  369. .flags = IORESOURCE_MEM,
  370. }, {
  371. .start = TXX9_IRQ_BASE + TX4939_IR_ATA(0),
  372. .flags = IORESOURCE_IRQ,
  373. },
  374. };
  375. static struct resource ata1_res[] = {
  376. {
  377. .start = TX4939_ATA_REG_PHYS(1),
  378. .end = TX4939_ATA_REG_PHYS(1) + 0x1000 - 1,
  379. .flags = IORESOURCE_MEM,
  380. }, {
  381. .start = TXX9_IRQ_BASE + TX4939_IR_ATA(1),
  382. .flags = IORESOURCE_IRQ,
  383. },
  384. };
  385. static struct platform_device ata0_dev = {
  386. .name = "tx4939ide",
  387. .id = 0,
  388. .num_resources = ARRAY_SIZE(ata0_res),
  389. .resource = ata0_res,
  390. };
  391. static struct platform_device ata1_dev = {
  392. .name = "tx4939ide",
  393. .id = 1,
  394. .num_resources = ARRAY_SIZE(ata1_res),
  395. .resource = ata1_res,
  396. };
  397. __u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg);
  398. if (pcfg & TX4939_PCFG_ATA0MODE)
  399. platform_device_register(&ata0_dev);
  400. if ((pcfg & (TX4939_PCFG_ATA1MODE |
  401. TX4939_PCFG_ET1MODE |
  402. TX4939_PCFG_ET0MODE)) == TX4939_PCFG_ATA1MODE)
  403. platform_device_register(&ata1_dev);
  404. }
  405. static void __init tx4939_stop_unused_modules(void)
  406. {
  407. __u64 pcfg, rst = 0, ckd = 0;
  408. char buf[128];
  409. buf[0] = '\0';
  410. local_irq_disable();
  411. pcfg = ____raw_readq(&tx4939_ccfgptr->pcfg);
  412. if ((pcfg & TX4939_PCFG_I2SMODE_MASK) !=
  413. TX4939_PCFG_I2SMODE_ACLC) {
  414. rst |= TX4939_CLKCTR_ACLRST;
  415. ckd |= TX4939_CLKCTR_ACLCKD;
  416. strcat(buf, " ACLC");
  417. }
  418. if ((pcfg & TX4939_PCFG_I2SMODE_MASK) !=
  419. TX4939_PCFG_I2SMODE_I2S &&
  420. (pcfg & TX4939_PCFG_I2SMODE_MASK) !=
  421. TX4939_PCFG_I2SMODE_I2S_ALT) {
  422. rst |= TX4939_CLKCTR_I2SRST;
  423. ckd |= TX4939_CLKCTR_I2SCKD;
  424. strcat(buf, " I2S");
  425. }
  426. if (!(pcfg & TX4939_PCFG_ATA0MODE)) {
  427. rst |= TX4939_CLKCTR_ATA0RST;
  428. ckd |= TX4939_CLKCTR_ATA0CKD;
  429. strcat(buf, " ATA0");
  430. }
  431. if (!(pcfg & TX4939_PCFG_ATA1MODE)) {
  432. rst |= TX4939_CLKCTR_ATA1RST;
  433. ckd |= TX4939_CLKCTR_ATA1CKD;
  434. strcat(buf, " ATA1");
  435. }
  436. if (pcfg & TX4939_PCFG_SPIMODE) {
  437. rst |= TX4939_CLKCTR_SPIRST;
  438. ckd |= TX4939_CLKCTR_SPICKD;
  439. strcat(buf, " SPI");
  440. }
  441. if (!(pcfg & (TX4939_PCFG_VSSMODE | TX4939_PCFG_VPSMODE))) {
  442. rst |= TX4939_CLKCTR_VPCRST;
  443. ckd |= TX4939_CLKCTR_VPCCKD;
  444. strcat(buf, " VPC");
  445. }
  446. if ((pcfg & TX4939_PCFG_SIO2MODE_MASK) != TX4939_PCFG_SIO2MODE_SIO2) {
  447. rst |= TX4939_CLKCTR_SIO2RST;
  448. ckd |= TX4939_CLKCTR_SIO2CKD;
  449. strcat(buf, " SIO2");
  450. }
  451. if (pcfg & TX4939_PCFG_SIO3MODE) {
  452. rst |= TX4939_CLKCTR_SIO3RST;
  453. ckd |= TX4939_CLKCTR_SIO3CKD;
  454. strcat(buf, " SIO3");
  455. }
  456. if (rst | ckd) {
  457. txx9_set64(&tx4939_ccfgptr->clkctr, rst);
  458. txx9_set64(&tx4939_ccfgptr->clkctr, ckd);
  459. }
  460. local_irq_enable();
  461. if (buf[0])
  462. pr_info("%s: stop%s\n", txx9_pcode_str, buf);
  463. }
  464. static int __init tx4939_late_init(void)
  465. {
  466. if (txx9_pcode != 0x4939)
  467. return -ENODEV;
  468. tx4939_stop_unused_modules();
  469. return 0;
  470. }
  471. late_initcall(tx4939_late_init);