cpc925_edac.c 32 KB

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