cpc925_edac.c 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  1. /*
  2. * cpc925_edac.c, EDAC driver for IBM CPC925 Bridge and Memory Controller.
  3. *
  4. * Copyright (c) 2008 Wind River Systems, Inc.
  5. *
  6. * Authors: Cao Qingtao <qingtao.cao@windriver.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #include <linux/module.h>
  22. #include <linux/init.h>
  23. #include <linux/io.h>
  24. #include <linux/edac.h>
  25. #include <linux/of.h>
  26. #include <linux/platform_device.h>
  27. #include <linux/gfp.h>
  28. #include "edac_core.h"
  29. #include "edac_module.h"
  30. #define CPC925_EDAC_REVISION " Ver: 1.0.0"
  31. #define CPC925_EDAC_MOD_STR "cpc925_edac"
  32. #define cpc925_printk(level, fmt, arg...) \
  33. edac_printk(level, "CPC925", fmt, ##arg)
  34. #define cpc925_mc_printk(mci, level, fmt, arg...) \
  35. edac_mc_chipset_printk(mci, level, "CPC925", fmt, ##arg)
  36. /*
  37. * CPC925 registers are of 32 bits with bit0 defined at the
  38. * most significant bit and bit31 at that of least significant.
  39. */
  40. #define CPC925_BITS_PER_REG 32
  41. #define CPC925_BIT(nr) (1UL << (CPC925_BITS_PER_REG - 1 - nr))
  42. /*
  43. * EDAC device names for the error detections of
  44. * CPU Interface and Hypertransport Link.
  45. */
  46. #define CPC925_CPU_ERR_DEV "cpu"
  47. #define CPC925_HT_LINK_DEV "htlink"
  48. /* Suppose DDR Refresh cycle is 15.6 microsecond */
  49. #define CPC925_REF_FREQ 0xFA69
  50. #define CPC925_SCRUB_BLOCK_SIZE 64 /* bytes */
  51. #define CPC925_NR_CSROWS 8
  52. /*
  53. * All registers and bits definitions are taken from
  54. * "CPC925 Bridge and Memory Controller User Manual, SA14-2761-02".
  55. */
  56. /*
  57. * CPU and Memory Controller Registers
  58. */
  59. /************************************************************
  60. * Processor Interface Exception Mask Register (APIMASK)
  61. ************************************************************/
  62. #define REG_APIMASK_OFFSET 0x30070
  63. enum apimask_bits {
  64. APIMASK_DART = CPC925_BIT(0), /* DART Exception */
  65. APIMASK_ADI0 = CPC925_BIT(1), /* Handshake Error on PI0_ADI */
  66. APIMASK_ADI1 = CPC925_BIT(2), /* Handshake Error on PI1_ADI */
  67. APIMASK_STAT = CPC925_BIT(3), /* Status Exception */
  68. APIMASK_DERR = CPC925_BIT(4), /* Data Error Exception */
  69. APIMASK_ADRS0 = CPC925_BIT(5), /* Addressing Exception on PI0 */
  70. APIMASK_ADRS1 = CPC925_BIT(6), /* Addressing Exception on PI1 */
  71. /* BIT(7) Reserved */
  72. APIMASK_ECC_UE_H = CPC925_BIT(8), /* UECC upper */
  73. APIMASK_ECC_CE_H = CPC925_BIT(9), /* CECC upper */
  74. APIMASK_ECC_UE_L = CPC925_BIT(10), /* UECC lower */
  75. APIMASK_ECC_CE_L = CPC925_BIT(11), /* CECC lower */
  76. CPU_MASK_ENABLE = (APIMASK_DART | APIMASK_ADI0 | APIMASK_ADI1 |
  77. APIMASK_STAT | APIMASK_DERR | APIMASK_ADRS0 |
  78. APIMASK_ADRS1),
  79. ECC_MASK_ENABLE = (APIMASK_ECC_UE_H | APIMASK_ECC_CE_H |
  80. APIMASK_ECC_UE_L | APIMASK_ECC_CE_L),
  81. };
  82. #define APIMASK_ADI(n) CPC925_BIT(((n)+1))
  83. /************************************************************
  84. * Processor Interface Exception Register (APIEXCP)
  85. ************************************************************/
  86. #define REG_APIEXCP_OFFSET 0x30060
  87. enum apiexcp_bits {
  88. APIEXCP_DART = CPC925_BIT(0), /* DART Exception */
  89. APIEXCP_ADI0 = CPC925_BIT(1), /* Handshake Error on PI0_ADI */
  90. APIEXCP_ADI1 = CPC925_BIT(2), /* Handshake Error on PI1_ADI */
  91. APIEXCP_STAT = CPC925_BIT(3), /* Status Exception */
  92. APIEXCP_DERR = CPC925_BIT(4), /* Data Error Exception */
  93. APIEXCP_ADRS0 = CPC925_BIT(5), /* Addressing Exception on PI0 */
  94. APIEXCP_ADRS1 = CPC925_BIT(6), /* Addressing Exception on PI1 */
  95. /* BIT(7) Reserved */
  96. APIEXCP_ECC_UE_H = CPC925_BIT(8), /* UECC upper */
  97. APIEXCP_ECC_CE_H = CPC925_BIT(9), /* CECC upper */
  98. APIEXCP_ECC_UE_L = CPC925_BIT(10), /* UECC lower */
  99. APIEXCP_ECC_CE_L = CPC925_BIT(11), /* CECC lower */
  100. CPU_EXCP_DETECTED = (APIEXCP_DART | APIEXCP_ADI0 | APIEXCP_ADI1 |
  101. APIEXCP_STAT | APIEXCP_DERR | APIEXCP_ADRS0 |
  102. APIEXCP_ADRS1),
  103. UECC_EXCP_DETECTED = (APIEXCP_ECC_UE_H | APIEXCP_ECC_UE_L),
  104. CECC_EXCP_DETECTED = (APIEXCP_ECC_CE_H | APIEXCP_ECC_CE_L),
  105. ECC_EXCP_DETECTED = (UECC_EXCP_DETECTED | CECC_EXCP_DETECTED),
  106. };
  107. /************************************************************
  108. * Memory Bus Configuration Register (MBCR)
  109. ************************************************************/
  110. #define REG_MBCR_OFFSET 0x2190
  111. #define MBCR_64BITCFG_SHIFT 23
  112. #define MBCR_64BITCFG_MASK (1UL << MBCR_64BITCFG_SHIFT)
  113. #define MBCR_64BITBUS_SHIFT 22
  114. #define MBCR_64BITBUS_MASK (1UL << MBCR_64BITBUS_SHIFT)
  115. /************************************************************
  116. * Memory Bank Mode Register (MBMR)
  117. ************************************************************/
  118. #define REG_MBMR_OFFSET 0x21C0
  119. #define MBMR_MODE_MAX_VALUE 0xF
  120. #define MBMR_MODE_SHIFT 25
  121. #define MBMR_MODE_MASK (MBMR_MODE_MAX_VALUE << MBMR_MODE_SHIFT)
  122. #define MBMR_BBA_SHIFT 24
  123. #define MBMR_BBA_MASK (1UL << MBMR_BBA_SHIFT)
  124. /************************************************************
  125. * Memory Bank Boundary Address Register (MBBAR)
  126. ************************************************************/
  127. #define REG_MBBAR_OFFSET 0x21D0
  128. #define MBBAR_BBA_MAX_VALUE 0xFF
  129. #define MBBAR_BBA_SHIFT 24
  130. #define MBBAR_BBA_MASK (MBBAR_BBA_MAX_VALUE << MBBAR_BBA_SHIFT)
  131. /************************************************************
  132. * Memory Scrub Control Register (MSCR)
  133. ************************************************************/
  134. #define REG_MSCR_OFFSET 0x2400
  135. #define MSCR_SCRUB_MOD_MASK 0xC0000000 /* scrub_mod - bit0:1*/
  136. #define MSCR_BACKGR_SCRUB 0x40000000 /* 01 */
  137. #define MSCR_SI_SHIFT 16 /* si - bit8:15*/
  138. #define MSCR_SI_MAX_VALUE 0xFF
  139. #define MSCR_SI_MASK (MSCR_SI_MAX_VALUE << MSCR_SI_SHIFT)
  140. /************************************************************
  141. * Memory Scrub Range Start Register (MSRSR)
  142. ************************************************************/
  143. #define REG_MSRSR_OFFSET 0x2410
  144. /************************************************************
  145. * Memory Scrub Range End Register (MSRER)
  146. ************************************************************/
  147. #define REG_MSRER_OFFSET 0x2420
  148. /************************************************************
  149. * Memory Scrub Pattern Register (MSPR)
  150. ************************************************************/
  151. #define REG_MSPR_OFFSET 0x2430
  152. /************************************************************
  153. * Memory Check Control Register (MCCR)
  154. ************************************************************/
  155. #define REG_MCCR_OFFSET 0x2440
  156. enum mccr_bits {
  157. MCCR_ECC_EN = CPC925_BIT(0), /* ECC high and low check */
  158. };
  159. /************************************************************
  160. * Memory Check Range End Register (MCRER)
  161. ************************************************************/
  162. #define REG_MCRER_OFFSET 0x2450
  163. /************************************************************
  164. * Memory Error Address Register (MEAR)
  165. ************************************************************/
  166. #define REG_MEAR_OFFSET 0x2460
  167. #define MEAR_BCNT_MAX_VALUE 0x3
  168. #define MEAR_BCNT_SHIFT 30
  169. #define MEAR_BCNT_MASK (MEAR_BCNT_MAX_VALUE << MEAR_BCNT_SHIFT)
  170. #define MEAR_RANK_MAX_VALUE 0x7
  171. #define MEAR_RANK_SHIFT 27
  172. #define MEAR_RANK_MASK (MEAR_RANK_MAX_VALUE << MEAR_RANK_SHIFT)
  173. #define MEAR_COL_MAX_VALUE 0x7FF
  174. #define MEAR_COL_SHIFT 16
  175. #define MEAR_COL_MASK (MEAR_COL_MAX_VALUE << MEAR_COL_SHIFT)
  176. #define MEAR_BANK_MAX_VALUE 0x3
  177. #define MEAR_BANK_SHIFT 14
  178. #define MEAR_BANK_MASK (MEAR_BANK_MAX_VALUE << MEAR_BANK_SHIFT)
  179. #define MEAR_ROW_MASK 0x00003FFF
  180. /************************************************************
  181. * Memory Error Syndrome Register (MESR)
  182. ************************************************************/
  183. #define REG_MESR_OFFSET 0x2470
  184. #define MESR_ECC_SYN_H_MASK 0xFF00
  185. #define MESR_ECC_SYN_L_MASK 0x00FF
  186. /************************************************************
  187. * Memory Mode Control Register (MMCR)
  188. ************************************************************/
  189. #define REG_MMCR_OFFSET 0x2500
  190. enum mmcr_bits {
  191. MMCR_REG_DIMM_MODE = CPC925_BIT(3),
  192. };
  193. /*
  194. * HyperTransport Link Registers
  195. */
  196. /************************************************************
  197. * Error Handling/Enumeration Scratch Pad Register (ERRCTRL)
  198. ************************************************************/
  199. #define REG_ERRCTRL_OFFSET 0x70140
  200. enum errctrl_bits { /* nonfatal interrupts for */
  201. ERRCTRL_SERR_NF = CPC925_BIT(0), /* system error */
  202. ERRCTRL_CRC_NF = CPC925_BIT(1), /* CRC error */
  203. ERRCTRL_RSP_NF = CPC925_BIT(2), /* Response error */
  204. ERRCTRL_EOC_NF = CPC925_BIT(3), /* End-Of-Chain error */
  205. ERRCTRL_OVF_NF = CPC925_BIT(4), /* Overflow error */
  206. ERRCTRL_PROT_NF = CPC925_BIT(5), /* Protocol error */
  207. ERRCTRL_RSP_ERR = CPC925_BIT(6), /* Response error received */
  208. ERRCTRL_CHN_FAL = CPC925_BIT(7), /* Sync flooding detected */
  209. HT_ERRCTRL_ENABLE = (ERRCTRL_SERR_NF | ERRCTRL_CRC_NF |
  210. ERRCTRL_RSP_NF | ERRCTRL_EOC_NF |
  211. ERRCTRL_OVF_NF | ERRCTRL_PROT_NF),
  212. HT_ERRCTRL_DETECTED = (ERRCTRL_RSP_ERR | ERRCTRL_CHN_FAL),
  213. };
  214. /************************************************************
  215. * Link Configuration and Link Control Register (LINKCTRL)
  216. ************************************************************/
  217. #define REG_LINKCTRL_OFFSET 0x70110
  218. enum linkctrl_bits {
  219. LINKCTRL_CRC_ERR = (CPC925_BIT(22) | CPC925_BIT(23)),
  220. LINKCTRL_LINK_FAIL = CPC925_BIT(27),
  221. HT_LINKCTRL_DETECTED = (LINKCTRL_CRC_ERR | LINKCTRL_LINK_FAIL),
  222. };
  223. /************************************************************
  224. * Link FreqCap/Error/Freq/Revision ID Register (LINKERR)
  225. ************************************************************/
  226. #define REG_LINKERR_OFFSET 0x70120
  227. enum linkerr_bits {
  228. LINKERR_EOC_ERR = CPC925_BIT(17), /* End-Of-Chain error */
  229. LINKERR_OVF_ERR = CPC925_BIT(18), /* Receive Buffer Overflow */
  230. LINKERR_PROT_ERR = CPC925_BIT(19), /* Protocol error */
  231. HT_LINKERR_DETECTED = (LINKERR_EOC_ERR | LINKERR_OVF_ERR |
  232. LINKERR_PROT_ERR),
  233. };
  234. /************************************************************
  235. * Bridge Control Register (BRGCTRL)
  236. ************************************************************/
  237. #define REG_BRGCTRL_OFFSET 0x70300
  238. enum brgctrl_bits {
  239. BRGCTRL_DETSERR = CPC925_BIT(0), /* SERR on Secondary Bus */
  240. BRGCTRL_SECBUSRESET = CPC925_BIT(9), /* Secondary Bus Reset */
  241. };
  242. /* Private structure for edac memory controller */
  243. struct cpc925_mc_pdata {
  244. void __iomem *vbase;
  245. unsigned long total_mem;
  246. const char *name;
  247. int edac_idx;
  248. };
  249. /* Private structure for common edac device */
  250. struct cpc925_dev_info {
  251. void __iomem *vbase;
  252. struct platform_device *pdev;
  253. char *ctl_name;
  254. int edac_idx;
  255. struct edac_device_ctl_info *edac_dev;
  256. void (*init)(struct cpc925_dev_info *dev_info);
  257. void (*exit)(struct cpc925_dev_info *dev_info);
  258. void (*check)(struct edac_device_ctl_info *edac_dev);
  259. };
  260. /* Get total memory size from Open Firmware DTB */
  261. static void get_total_mem(struct cpc925_mc_pdata *pdata)
  262. {
  263. struct device_node *np = NULL;
  264. const unsigned int *reg, *reg_end;
  265. int len, sw, aw;
  266. unsigned long start, size;
  267. np = of_find_node_by_type(NULL, "memory");
  268. if (!np)
  269. return;
  270. aw = of_n_addr_cells(np);
  271. sw = of_n_size_cells(np);
  272. reg = (const unsigned int *)of_get_property(np, "reg", &len);
  273. reg_end = reg + len/4;
  274. pdata->total_mem = 0;
  275. do {
  276. start = of_read_number(reg, aw);
  277. reg += aw;
  278. size = of_read_number(reg, sw);
  279. reg += sw;
  280. debugf1("%s: start 0x%lx, size 0x%lx\n", __func__,
  281. start, size);
  282. pdata->total_mem += size;
  283. } while (reg < reg_end);
  284. of_node_put(np);
  285. debugf0("%s: total_mem 0x%lx\n", __func__, pdata->total_mem);
  286. }
  287. static void cpc925_init_csrows(struct mem_ctl_info *mci)
  288. {
  289. struct cpc925_mc_pdata *pdata = mci->pvt_info;
  290. struct csrow_info *csrow;
  291. struct dimm_info *dimm;
  292. int index, j;
  293. u32 mbmr, mbbar, bba;
  294. unsigned long row_size, nr_pages, last_nr_pages = 0;
  295. get_total_mem(pdata);
  296. for (index = 0; index < mci->nr_csrows; index++) {
  297. mbmr = __raw_readl(pdata->vbase + REG_MBMR_OFFSET +
  298. 0x20 * index);
  299. mbbar = __raw_readl(pdata->vbase + REG_MBBAR_OFFSET +
  300. 0x20 + index);
  301. bba = (((mbmr & MBMR_BBA_MASK) >> MBMR_BBA_SHIFT) << 8) |
  302. ((mbbar & MBBAR_BBA_MASK) >> MBBAR_BBA_SHIFT);
  303. if (bba == 0)
  304. continue; /* not populated */
  305. csrow = &mci->csrows[index];
  306. row_size = bba * (1UL << 28); /* 256M */
  307. csrow->first_page = last_nr_pages;
  308. nr_pages = row_size >> PAGE_SHIFT;
  309. csrow->last_page = csrow->first_page + nr_pages - 1;
  310. last_nr_pages = csrow->last_page + 1;
  311. for (j = 0; j < csrow->nr_channels; j++) {
  312. dimm = csrow->channels[j].dimm;
  313. dimm->nr_pages = nr_pages / csrow->nr_channels;
  314. dimm->mtype = MEM_RDDR;
  315. dimm->edac_mode = EDAC_SECDED;
  316. switch (csrow->nr_channels) {
  317. case 1: /* Single channel */
  318. dimm->grain = 32; /* four-beat burst of 32 bytes */
  319. break;
  320. case 2: /* Dual channel */
  321. default:
  322. dimm->grain = 64; /* four-beat burst of 64 bytes */
  323. break;
  324. }
  325. switch ((mbmr & MBMR_MODE_MASK) >> MBMR_MODE_SHIFT) {
  326. case 6: /* 0110, no way to differentiate X8 VS X16 */
  327. case 5: /* 0101 */
  328. case 8: /* 1000 */
  329. dimm->dtype = DEV_X16;
  330. break;
  331. case 7: /* 0111 */
  332. case 9: /* 1001 */
  333. dimm->dtype = DEV_X8;
  334. break;
  335. default:
  336. dimm->dtype = DEV_UNKNOWN;
  337. break;
  338. }
  339. }
  340. }
  341. }
  342. /* Enable memory controller ECC detection */
  343. static void cpc925_mc_init(struct mem_ctl_info *mci)
  344. {
  345. struct cpc925_mc_pdata *pdata = mci->pvt_info;
  346. u32 apimask;
  347. u32 mccr;
  348. /* Enable various ECC error exceptions */
  349. apimask = __raw_readl(pdata->vbase + REG_APIMASK_OFFSET);
  350. if ((apimask & ECC_MASK_ENABLE) == 0) {
  351. apimask |= ECC_MASK_ENABLE;
  352. __raw_writel(apimask, pdata->vbase + REG_APIMASK_OFFSET);
  353. }
  354. /* Enable ECC detection */
  355. mccr = __raw_readl(pdata->vbase + REG_MCCR_OFFSET);
  356. if ((mccr & MCCR_ECC_EN) == 0) {
  357. mccr |= MCCR_ECC_EN;
  358. __raw_writel(mccr, pdata->vbase + REG_MCCR_OFFSET);
  359. }
  360. }
  361. /* Disable memory controller ECC detection */
  362. static void cpc925_mc_exit(struct mem_ctl_info *mci)
  363. {
  364. /*
  365. * WARNING:
  366. * We are supposed to clear the ECC error detection bits,
  367. * and it will be no problem to do so. However, once they
  368. * are cleared here if we want to re-install CPC925 EDAC
  369. * module later, setting them up in cpc925_mc_init() will
  370. * trigger machine check exception.
  371. * Also, it's ok to leave ECC error detection bits enabled,
  372. * since they are reset to 1 by default or by boot loader.
  373. */
  374. return;
  375. }
  376. /*
  377. * Revert DDR column/row/bank addresses into page frame number and
  378. * offset in page.
  379. *
  380. * Suppose memory mode is 0x0111(128-bit mode, identical DIMM pairs),
  381. * physical address(PA) bits to column address(CA) bits mappings are:
  382. * CA 0 1 2 3 4 5 6 7 8 9 10
  383. * PA 59 58 57 56 55 54 53 52 51 50 49
  384. *
  385. * physical address(PA) bits to bank address(BA) bits mappings are:
  386. * BA 0 1
  387. * PA 43 44
  388. *
  389. * physical address(PA) bits to row address(RA) bits mappings are:
  390. * RA 0 1 2 3 4 5 6 7 8 9 10 11 12
  391. * PA 36 35 34 48 47 46 45 40 41 42 39 38 37
  392. */
  393. static void cpc925_mc_get_pfn(struct mem_ctl_info *mci, u32 mear,
  394. unsigned long *pfn, unsigned long *offset, int *csrow)
  395. {
  396. u32 bcnt, rank, col, bank, row;
  397. u32 c;
  398. unsigned long pa;
  399. int i;
  400. bcnt = (mear & MEAR_BCNT_MASK) >> MEAR_BCNT_SHIFT;
  401. rank = (mear & MEAR_RANK_MASK) >> MEAR_RANK_SHIFT;
  402. col = (mear & MEAR_COL_MASK) >> MEAR_COL_SHIFT;
  403. bank = (mear & MEAR_BANK_MASK) >> MEAR_BANK_SHIFT;
  404. row = mear & MEAR_ROW_MASK;
  405. *csrow = rank;
  406. #ifdef CONFIG_EDAC_DEBUG
  407. if (mci->csrows[rank].first_page == 0) {
  408. cpc925_mc_printk(mci, KERN_ERR, "ECC occurs in a "
  409. "non-populated csrow, broken hardware?\n");
  410. return;
  411. }
  412. #endif
  413. /* Revert csrow number */
  414. pa = mci->csrows[rank].first_page << PAGE_SHIFT;
  415. /* Revert column address */
  416. col += bcnt;
  417. for (i = 0; i < 11; i++) {
  418. c = col & 0x1;
  419. col >>= 1;
  420. pa |= c << (14 - i);
  421. }
  422. /* Revert bank address */
  423. pa |= bank << 19;
  424. /* Revert row address, in 4 steps */
  425. for (i = 0; i < 3; i++) {
  426. c = row & 0x1;
  427. row >>= 1;
  428. pa |= c << (26 - i);
  429. }
  430. for (i = 0; i < 3; i++) {
  431. c = row & 0x1;
  432. row >>= 1;
  433. pa |= c << (21 + i);
  434. }
  435. for (i = 0; i < 4; i++) {
  436. c = row & 0x1;
  437. row >>= 1;
  438. pa |= c << (18 - i);
  439. }
  440. for (i = 0; i < 3; i++) {
  441. c = row & 0x1;
  442. row >>= 1;
  443. pa |= c << (29 - i);
  444. }
  445. *offset = pa & (PAGE_SIZE - 1);
  446. *pfn = pa >> PAGE_SHIFT;
  447. debugf0("%s: ECC physical address 0x%lx\n", __func__, pa);
  448. }
  449. static int cpc925_mc_find_channel(struct mem_ctl_info *mci, u16 syndrome)
  450. {
  451. if ((syndrome & MESR_ECC_SYN_H_MASK) == 0)
  452. return 0;
  453. if ((syndrome & MESR_ECC_SYN_L_MASK) == 0)
  454. return 1;
  455. cpc925_mc_printk(mci, KERN_INFO, "Unexpected syndrome value: 0x%x\n",
  456. syndrome);
  457. return 1;
  458. }
  459. /* Check memory controller registers for ECC errors */
  460. static void cpc925_mc_check(struct mem_ctl_info *mci)
  461. {
  462. struct cpc925_mc_pdata *pdata = mci->pvt_info;
  463. u32 apiexcp;
  464. u32 mear;
  465. u32 mesr;
  466. u16 syndrome;
  467. unsigned long pfn = 0, offset = 0;
  468. int csrow = 0, channel = 0;
  469. /* APIEXCP is cleared when read */
  470. apiexcp = __raw_readl(pdata->vbase + REG_APIEXCP_OFFSET);
  471. if ((apiexcp & ECC_EXCP_DETECTED) == 0)
  472. return;
  473. mesr = __raw_readl(pdata->vbase + REG_MESR_OFFSET);
  474. syndrome = mesr | (MESR_ECC_SYN_H_MASK | MESR_ECC_SYN_L_MASK);
  475. mear = __raw_readl(pdata->vbase + REG_MEAR_OFFSET);
  476. /* Revert column/row addresses into page frame number, etc */
  477. cpc925_mc_get_pfn(mci, mear, &pfn, &offset, &csrow);
  478. if (apiexcp & CECC_EXCP_DETECTED) {
  479. cpc925_mc_printk(mci, KERN_INFO, "DRAM CECC Fault\n");
  480. channel = cpc925_mc_find_channel(mci, syndrome);
  481. edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci,
  482. pfn, offset, syndrome,
  483. csrow, channel, -1,
  484. mci->ctl_name, "", NULL);
  485. }
  486. if (apiexcp & UECC_EXCP_DETECTED) {
  487. cpc925_mc_printk(mci, KERN_INFO, "DRAM UECC Fault\n");
  488. edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci,
  489. pfn, offset, 0,
  490. csrow, -1, -1,
  491. mci->ctl_name, "", NULL);
  492. }
  493. cpc925_mc_printk(mci, KERN_INFO, "Dump registers:\n");
  494. cpc925_mc_printk(mci, KERN_INFO, "APIMASK 0x%08x\n",
  495. __raw_readl(pdata->vbase + REG_APIMASK_OFFSET));
  496. cpc925_mc_printk(mci, KERN_INFO, "APIEXCP 0x%08x\n",
  497. apiexcp);
  498. cpc925_mc_printk(mci, KERN_INFO, "Mem Scrub Ctrl 0x%08x\n",
  499. __raw_readl(pdata->vbase + REG_MSCR_OFFSET));
  500. cpc925_mc_printk(mci, KERN_INFO, "Mem Scrub Rge Start 0x%08x\n",
  501. __raw_readl(pdata->vbase + REG_MSRSR_OFFSET));
  502. cpc925_mc_printk(mci, KERN_INFO, "Mem Scrub Rge End 0x%08x\n",
  503. __raw_readl(pdata->vbase + REG_MSRER_OFFSET));
  504. cpc925_mc_printk(mci, KERN_INFO, "Mem Scrub Pattern 0x%08x\n",
  505. __raw_readl(pdata->vbase + REG_MSPR_OFFSET));
  506. cpc925_mc_printk(mci, KERN_INFO, "Mem Chk Ctrl 0x%08x\n",
  507. __raw_readl(pdata->vbase + REG_MCCR_OFFSET));
  508. cpc925_mc_printk(mci, KERN_INFO, "Mem Chk Rge End 0x%08x\n",
  509. __raw_readl(pdata->vbase + REG_MCRER_OFFSET));
  510. cpc925_mc_printk(mci, KERN_INFO, "Mem Err Address 0x%08x\n",
  511. mesr);
  512. cpc925_mc_printk(mci, KERN_INFO, "Mem Err Syndrome 0x%08x\n",
  513. syndrome);
  514. }
  515. /******************** CPU err device********************************/
  516. static u32 cpc925_cpu_mask_disabled(void)
  517. {
  518. struct device_node *cpus;
  519. struct device_node *cpunode = NULL;
  520. static u32 mask = 0;
  521. /* use cached value if available */
  522. if (mask != 0)
  523. return mask;
  524. mask = APIMASK_ADI0 | APIMASK_ADI1;
  525. cpus = of_find_node_by_path("/cpus");
  526. if (cpus == NULL) {
  527. cpc925_printk(KERN_DEBUG, "No /cpus node !\n");
  528. return 0;
  529. }
  530. while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
  531. const u32 *reg = of_get_property(cpunode, "reg", NULL);
  532. if (strcmp(cpunode->type, "cpu")) {
  533. cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n", cpunode->name);
  534. continue;
  535. }
  536. if (reg == NULL || *reg > 2) {
  537. cpc925_printk(KERN_ERR, "Bad reg value at %s\n", cpunode->full_name);
  538. continue;
  539. }
  540. mask &= ~APIMASK_ADI(*reg);
  541. }
  542. if (mask != (APIMASK_ADI0 | APIMASK_ADI1)) {
  543. /* We assume that each CPU sits on it's own PI and that
  544. * for present CPUs the reg property equals to the PI
  545. * interface id */
  546. cpc925_printk(KERN_WARNING,
  547. "Assuming PI id is equal to CPU MPIC id!\n");
  548. }
  549. of_node_put(cpunode);
  550. of_node_put(cpus);
  551. return mask;
  552. }
  553. /* Enable CPU Errors detection */
  554. static void cpc925_cpu_init(struct cpc925_dev_info *dev_info)
  555. {
  556. u32 apimask;
  557. u32 cpumask;
  558. apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
  559. cpumask = cpc925_cpu_mask_disabled();
  560. if (apimask & cpumask) {
  561. cpc925_printk(KERN_WARNING, "CPU(s) not present, "
  562. "but enabled in APIMASK, disabling\n");
  563. apimask &= ~cpumask;
  564. }
  565. if ((apimask & CPU_MASK_ENABLE) == 0)
  566. apimask |= CPU_MASK_ENABLE;
  567. __raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
  568. }
  569. /* Disable CPU Errors detection */
  570. static void cpc925_cpu_exit(struct cpc925_dev_info *dev_info)
  571. {
  572. /*
  573. * WARNING:
  574. * We are supposed to clear the CPU error detection bits,
  575. * and it will be no problem to do so. However, once they
  576. * are cleared here if we want to re-install CPC925 EDAC
  577. * module later, setting them up in cpc925_cpu_init() will
  578. * trigger machine check exception.
  579. * Also, it's ok to leave CPU error detection bits enabled,
  580. * since they are reset to 1 by default.
  581. */
  582. return;
  583. }
  584. /* Check for CPU Errors */
  585. static void cpc925_cpu_check(struct edac_device_ctl_info *edac_dev)
  586. {
  587. struct cpc925_dev_info *dev_info = edac_dev->pvt_info;
  588. u32 apiexcp;
  589. u32 apimask;
  590. /* APIEXCP is cleared when read */
  591. apiexcp = __raw_readl(dev_info->vbase + REG_APIEXCP_OFFSET);
  592. if ((apiexcp & CPU_EXCP_DETECTED) == 0)
  593. return;
  594. if ((apiexcp & ~cpc925_cpu_mask_disabled()) == 0)
  595. return;
  596. apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
  597. cpc925_printk(KERN_INFO, "Processor Interface Fault\n"
  598. "Processor Interface register dump:\n");
  599. cpc925_printk(KERN_INFO, "APIMASK 0x%08x\n", apimask);
  600. cpc925_printk(KERN_INFO, "APIEXCP 0x%08x\n", apiexcp);
  601. edac_device_handle_ue(edac_dev, 0, 0, edac_dev->ctl_name);
  602. }
  603. /******************** HT Link err device****************************/
  604. /* Enable HyperTransport Link Error detection */
  605. static void cpc925_htlink_init(struct cpc925_dev_info *dev_info)
  606. {
  607. u32 ht_errctrl;
  608. ht_errctrl = __raw_readl(dev_info->vbase + REG_ERRCTRL_OFFSET);
  609. if ((ht_errctrl & HT_ERRCTRL_ENABLE) == 0) {
  610. ht_errctrl |= HT_ERRCTRL_ENABLE;
  611. __raw_writel(ht_errctrl, dev_info->vbase + REG_ERRCTRL_OFFSET);
  612. }
  613. }
  614. /* Disable HyperTransport Link Error detection */
  615. static void cpc925_htlink_exit(struct cpc925_dev_info *dev_info)
  616. {
  617. u32 ht_errctrl;
  618. ht_errctrl = __raw_readl(dev_info->vbase + REG_ERRCTRL_OFFSET);
  619. ht_errctrl &= ~HT_ERRCTRL_ENABLE;
  620. __raw_writel(ht_errctrl, dev_info->vbase + REG_ERRCTRL_OFFSET);
  621. }
  622. /* Check for HyperTransport Link errors */
  623. static void cpc925_htlink_check(struct edac_device_ctl_info *edac_dev)
  624. {
  625. struct cpc925_dev_info *dev_info = edac_dev->pvt_info;
  626. u32 brgctrl = __raw_readl(dev_info->vbase + REG_BRGCTRL_OFFSET);
  627. u32 linkctrl = __raw_readl(dev_info->vbase + REG_LINKCTRL_OFFSET);
  628. u32 errctrl = __raw_readl(dev_info->vbase + REG_ERRCTRL_OFFSET);
  629. u32 linkerr = __raw_readl(dev_info->vbase + REG_LINKERR_OFFSET);
  630. if (!((brgctrl & BRGCTRL_DETSERR) ||
  631. (linkctrl & HT_LINKCTRL_DETECTED) ||
  632. (errctrl & HT_ERRCTRL_DETECTED) ||
  633. (linkerr & HT_LINKERR_DETECTED)))
  634. return;
  635. cpc925_printk(KERN_INFO, "HT Link Fault\n"
  636. "HT register dump:\n");
  637. cpc925_printk(KERN_INFO, "Bridge Ctrl 0x%08x\n",
  638. brgctrl);
  639. cpc925_printk(KERN_INFO, "Link Config Ctrl 0x%08x\n",
  640. linkctrl);
  641. cpc925_printk(KERN_INFO, "Error Enum and Ctrl 0x%08x\n",
  642. errctrl);
  643. cpc925_printk(KERN_INFO, "Link Error 0x%08x\n",
  644. linkerr);
  645. /* Clear by write 1 */
  646. if (brgctrl & BRGCTRL_DETSERR)
  647. __raw_writel(BRGCTRL_DETSERR,
  648. dev_info->vbase + REG_BRGCTRL_OFFSET);
  649. if (linkctrl & HT_LINKCTRL_DETECTED)
  650. __raw_writel(HT_LINKCTRL_DETECTED,
  651. dev_info->vbase + REG_LINKCTRL_OFFSET);
  652. /* Initiate Secondary Bus Reset to clear the chain failure */
  653. if (errctrl & ERRCTRL_CHN_FAL)
  654. __raw_writel(BRGCTRL_SECBUSRESET,
  655. dev_info->vbase + REG_BRGCTRL_OFFSET);
  656. if (errctrl & ERRCTRL_RSP_ERR)
  657. __raw_writel(ERRCTRL_RSP_ERR,
  658. dev_info->vbase + REG_ERRCTRL_OFFSET);
  659. if (linkerr & HT_LINKERR_DETECTED)
  660. __raw_writel(HT_LINKERR_DETECTED,
  661. dev_info->vbase + REG_LINKERR_OFFSET);
  662. edac_device_handle_ce(edac_dev, 0, 0, edac_dev->ctl_name);
  663. }
  664. static struct cpc925_dev_info cpc925_devs[] = {
  665. {
  666. .ctl_name = CPC925_CPU_ERR_DEV,
  667. .init = cpc925_cpu_init,
  668. .exit = cpc925_cpu_exit,
  669. .check = cpc925_cpu_check,
  670. },
  671. {
  672. .ctl_name = CPC925_HT_LINK_DEV,
  673. .init = cpc925_htlink_init,
  674. .exit = cpc925_htlink_exit,
  675. .check = cpc925_htlink_check,
  676. },
  677. {0}, /* Terminated by NULL */
  678. };
  679. /*
  680. * Add CPU Err detection and HyperTransport Link Err detection
  681. * as common "edac_device", they have no corresponding device
  682. * nodes in the Open Firmware DTB and we have to add platform
  683. * devices for them. Also, they will share the MMIO with that
  684. * of memory controller.
  685. */
  686. static void cpc925_add_edac_devices(void __iomem *vbase)
  687. {
  688. struct cpc925_dev_info *dev_info;
  689. if (!vbase) {
  690. cpc925_printk(KERN_ERR, "MMIO not established yet\n");
  691. return;
  692. }
  693. for (dev_info = &cpc925_devs[0]; dev_info->init; dev_info++) {
  694. dev_info->vbase = vbase;
  695. dev_info->pdev = platform_device_register_simple(
  696. dev_info->ctl_name, 0, NULL, 0);
  697. if (IS_ERR(dev_info->pdev)) {
  698. cpc925_printk(KERN_ERR,
  699. "Can't register platform device for %s\n",
  700. dev_info->ctl_name);
  701. continue;
  702. }
  703. /*
  704. * Don't have to allocate private structure but
  705. * make use of cpc925_devs[] instead.
  706. */
  707. dev_info->edac_idx = edac_device_alloc_index();
  708. dev_info->edac_dev =
  709. edac_device_alloc_ctl_info(0, dev_info->ctl_name,
  710. 1, NULL, 0, 0, NULL, 0, dev_info->edac_idx);
  711. if (!dev_info->edac_dev) {
  712. cpc925_printk(KERN_ERR, "No memory for edac device\n");
  713. goto err1;
  714. }
  715. dev_info->edac_dev->pvt_info = dev_info;
  716. dev_info->edac_dev->dev = &dev_info->pdev->dev;
  717. dev_info->edac_dev->ctl_name = dev_info->ctl_name;
  718. dev_info->edac_dev->mod_name = CPC925_EDAC_MOD_STR;
  719. dev_info->edac_dev->dev_name = dev_name(&dev_info->pdev->dev);
  720. if (edac_op_state == EDAC_OPSTATE_POLL)
  721. dev_info->edac_dev->edac_check = dev_info->check;
  722. if (dev_info->init)
  723. dev_info->init(dev_info);
  724. if (edac_device_add_device(dev_info->edac_dev) > 0) {
  725. cpc925_printk(KERN_ERR,
  726. "Unable to add edac device for %s\n",
  727. dev_info->ctl_name);
  728. goto err2;
  729. }
  730. debugf0("%s: Successfully added edac device for %s\n",
  731. __func__, dev_info->ctl_name);
  732. continue;
  733. err2:
  734. if (dev_info->exit)
  735. dev_info->exit(dev_info);
  736. edac_device_free_ctl_info(dev_info->edac_dev);
  737. err1:
  738. platform_device_unregister(dev_info->pdev);
  739. }
  740. }
  741. /*
  742. * Delete the common "edac_device" for CPU Err Detection
  743. * and HyperTransport Link Err Detection
  744. */
  745. static void cpc925_del_edac_devices(void)
  746. {
  747. struct cpc925_dev_info *dev_info;
  748. for (dev_info = &cpc925_devs[0]; dev_info->init; dev_info++) {
  749. if (dev_info->edac_dev) {
  750. edac_device_del_device(dev_info->edac_dev->dev);
  751. edac_device_free_ctl_info(dev_info->edac_dev);
  752. platform_device_unregister(dev_info->pdev);
  753. }
  754. if (dev_info->exit)
  755. dev_info->exit(dev_info);
  756. debugf0("%s: Successfully deleted edac device for %s\n",
  757. __func__, dev_info->ctl_name);
  758. }
  759. }
  760. /* Convert current back-ground scrub rate into byte/sec bandwidth */
  761. static int cpc925_get_sdram_scrub_rate(struct mem_ctl_info *mci)
  762. {
  763. struct cpc925_mc_pdata *pdata = mci->pvt_info;
  764. int bw;
  765. u32 mscr;
  766. u8 si;
  767. mscr = __raw_readl(pdata->vbase + REG_MSCR_OFFSET);
  768. si = (mscr & MSCR_SI_MASK) >> MSCR_SI_SHIFT;
  769. debugf0("%s, Mem Scrub Ctrl Register 0x%x\n", __func__, mscr);
  770. if (((mscr & MSCR_SCRUB_MOD_MASK) != MSCR_BACKGR_SCRUB) ||
  771. (si == 0)) {
  772. cpc925_mc_printk(mci, KERN_INFO, "Scrub mode not enabled\n");
  773. bw = 0;
  774. } else
  775. bw = CPC925_SCRUB_BLOCK_SIZE * 0xFA67 / si;
  776. return bw;
  777. }
  778. /* Return 0 for single channel; 1 for dual channel */
  779. static int cpc925_mc_get_channels(void __iomem *vbase)
  780. {
  781. int dual = 0;
  782. u32 mbcr;
  783. mbcr = __raw_readl(vbase + REG_MBCR_OFFSET);
  784. /*
  785. * Dual channel only when 128-bit wide physical bus
  786. * and 128-bit configuration.
  787. */
  788. if (((mbcr & MBCR_64BITCFG_MASK) == 0) &&
  789. ((mbcr & MBCR_64BITBUS_MASK) == 0))
  790. dual = 1;
  791. debugf0("%s: %s channel\n", __func__,
  792. (dual > 0) ? "Dual" : "Single");
  793. return dual;
  794. }
  795. static int __devinit cpc925_probe(struct platform_device *pdev)
  796. {
  797. static int edac_mc_idx;
  798. struct mem_ctl_info *mci;
  799. struct edac_mc_layer layers[2];
  800. void __iomem *vbase;
  801. struct cpc925_mc_pdata *pdata;
  802. struct resource *r;
  803. int res = 0, nr_channels;
  804. debugf0("%s: %s platform device found!\n", __func__, pdev->name);
  805. if (!devres_open_group(&pdev->dev, cpc925_probe, GFP_KERNEL)) {
  806. res = -ENOMEM;
  807. goto out;
  808. }
  809. r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  810. if (!r) {
  811. cpc925_printk(KERN_ERR, "Unable to get resource\n");
  812. res = -ENOENT;
  813. goto err1;
  814. }
  815. if (!devm_request_mem_region(&pdev->dev,
  816. r->start,
  817. resource_size(r),
  818. pdev->name)) {
  819. cpc925_printk(KERN_ERR, "Unable to request mem region\n");
  820. res = -EBUSY;
  821. goto err1;
  822. }
  823. vbase = devm_ioremap(&pdev->dev, r->start, resource_size(r));
  824. if (!vbase) {
  825. cpc925_printk(KERN_ERR, "Unable to ioremap device\n");
  826. res = -ENOMEM;
  827. goto err2;
  828. }
  829. nr_channels = cpc925_mc_get_channels(vbase) + 1;
  830. layers[0].type = EDAC_MC_LAYER_CHIP_SELECT;
  831. layers[0].size = CPC925_NR_CSROWS;
  832. layers[0].is_virt_csrow = true;
  833. layers[1].type = EDAC_MC_LAYER_CHANNEL;
  834. layers[1].size = nr_channels;
  835. layers[1].is_virt_csrow = false;
  836. mci = edac_mc_alloc(edac_mc_idx, ARRAY_SIZE(layers), layers,
  837. sizeof(struct cpc925_mc_pdata));
  838. if (!mci) {
  839. cpc925_printk(KERN_ERR, "No memory for mem_ctl_info\n");
  840. res = -ENOMEM;
  841. goto err2;
  842. }
  843. pdata = mci->pvt_info;
  844. pdata->vbase = vbase;
  845. pdata->edac_idx = edac_mc_idx++;
  846. pdata->name = pdev->name;
  847. mci->dev = &pdev->dev;
  848. platform_set_drvdata(pdev, mci);
  849. mci->dev_name = dev_name(&pdev->dev);
  850. mci->mtype_cap = MEM_FLAG_RDDR | MEM_FLAG_DDR;
  851. mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED;
  852. mci->edac_cap = EDAC_FLAG_SECDED;
  853. mci->mod_name = CPC925_EDAC_MOD_STR;
  854. mci->mod_ver = CPC925_EDAC_REVISION;
  855. mci->ctl_name = pdev->name;
  856. if (edac_op_state == EDAC_OPSTATE_POLL)
  857. mci->edac_check = cpc925_mc_check;
  858. mci->ctl_page_to_phys = NULL;
  859. mci->scrub_mode = SCRUB_SW_SRC;
  860. mci->set_sdram_scrub_rate = NULL;
  861. mci->get_sdram_scrub_rate = cpc925_get_sdram_scrub_rate;
  862. cpc925_init_csrows(mci);
  863. /* Setup memory controller registers */
  864. cpc925_mc_init(mci);
  865. if (edac_mc_add_mc(mci) > 0) {
  866. cpc925_mc_printk(mci, KERN_ERR, "Failed edac_mc_add_mc()\n");
  867. goto err3;
  868. }
  869. cpc925_add_edac_devices(vbase);
  870. /* get this far and it's successful */
  871. debugf0("%s: success\n", __func__);
  872. res = 0;
  873. goto out;
  874. err3:
  875. cpc925_mc_exit(mci);
  876. edac_mc_free(mci);
  877. err2:
  878. devm_release_mem_region(&pdev->dev, r->start, resource_size(r));
  879. err1:
  880. devres_release_group(&pdev->dev, cpc925_probe);
  881. out:
  882. return res;
  883. }
  884. static int cpc925_remove(struct platform_device *pdev)
  885. {
  886. struct mem_ctl_info *mci = platform_get_drvdata(pdev);
  887. /*
  888. * Delete common edac devices before edac mc, because
  889. * the former share the MMIO of the latter.
  890. */
  891. cpc925_del_edac_devices();
  892. cpc925_mc_exit(mci);
  893. edac_mc_del_mc(&pdev->dev);
  894. edac_mc_free(mci);
  895. return 0;
  896. }
  897. static struct platform_driver cpc925_edac_driver = {
  898. .probe = cpc925_probe,
  899. .remove = cpc925_remove,
  900. .driver = {
  901. .name = "cpc925_edac",
  902. }
  903. };
  904. static int __init cpc925_edac_init(void)
  905. {
  906. int ret = 0;
  907. printk(KERN_INFO "IBM CPC925 EDAC driver " CPC925_EDAC_REVISION "\n");
  908. printk(KERN_INFO "\t(c) 2008 Wind River Systems, Inc\n");
  909. /* Only support POLL mode so far */
  910. edac_op_state = EDAC_OPSTATE_POLL;
  911. ret = platform_driver_register(&cpc925_edac_driver);
  912. if (ret) {
  913. printk(KERN_WARNING "Failed to register %s\n",
  914. CPC925_EDAC_MOD_STR);
  915. }
  916. return ret;
  917. }
  918. static void __exit cpc925_edac_exit(void)
  919. {
  920. platform_driver_unregister(&cpc925_edac_driver);
  921. }
  922. module_init(cpc925_edac_init);
  923. module_exit(cpc925_edac_exit);
  924. MODULE_LICENSE("GPL");
  925. MODULE_AUTHOR("Cao Qingtao <qingtao.cao@windriver.com>");
  926. MODULE_DESCRIPTION("IBM CPC925 Bridge and MC EDAC kernel module");