cpc925_edac.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097
  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. edac_dbg(1, "start 0x%lx, size 0x%lx\n", start, size);
  281. pdata->total_mem += size;
  282. } while (reg < reg_end);
  283. of_node_put(np);
  284. edac_dbg(0, "total_mem 0x%lx\n", pdata->total_mem);
  285. }
  286. static void cpc925_init_csrows(struct mem_ctl_info *mci)
  287. {
  288. struct cpc925_mc_pdata *pdata = mci->pvt_info;
  289. struct csrow_info *csrow;
  290. struct dimm_info *dimm;
  291. enum dev_type dtype;
  292. int index, j;
  293. u32 mbmr, mbbar, bba, grain;
  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. switch (csrow->nr_channels) {
  312. case 1: /* Single channel */
  313. grain = 32; /* four-beat burst of 32 bytes */
  314. break;
  315. case 2: /* Dual channel */
  316. default:
  317. grain = 64; /* four-beat burst of 64 bytes */
  318. break;
  319. }
  320. switch ((mbmr & MBMR_MODE_MASK) >> MBMR_MODE_SHIFT) {
  321. case 6: /* 0110, no way to differentiate X8 VS X16 */
  322. case 5: /* 0101 */
  323. case 8: /* 1000 */
  324. dtype = DEV_X16;
  325. break;
  326. case 7: /* 0111 */
  327. case 9: /* 1001 */
  328. dtype = DEV_X8;
  329. break;
  330. default:
  331. dtype = DEV_UNKNOWN;
  332. break;
  333. }
  334. for (j = 0; j < csrow->nr_channels; j++) {
  335. dimm = csrow->channels[j]->dimm;
  336. dimm->nr_pages = nr_pages / csrow->nr_channels;
  337. dimm->mtype = MEM_RDDR;
  338. dimm->edac_mode = EDAC_SECDED;
  339. dimm->grain = grain;
  340. dimm->dtype = dtype;
  341. }
  342. }
  343. }
  344. /* Enable memory controller ECC detection */
  345. static void cpc925_mc_init(struct mem_ctl_info *mci)
  346. {
  347. struct cpc925_mc_pdata *pdata = mci->pvt_info;
  348. u32 apimask;
  349. u32 mccr;
  350. /* Enable various ECC error exceptions */
  351. apimask = __raw_readl(pdata->vbase + REG_APIMASK_OFFSET);
  352. if ((apimask & ECC_MASK_ENABLE) == 0) {
  353. apimask |= ECC_MASK_ENABLE;
  354. __raw_writel(apimask, pdata->vbase + REG_APIMASK_OFFSET);
  355. }
  356. /* Enable ECC detection */
  357. mccr = __raw_readl(pdata->vbase + REG_MCCR_OFFSET);
  358. if ((mccr & MCCR_ECC_EN) == 0) {
  359. mccr |= MCCR_ECC_EN;
  360. __raw_writel(mccr, pdata->vbase + REG_MCCR_OFFSET);
  361. }
  362. }
  363. /* Disable memory controller ECC detection */
  364. static void cpc925_mc_exit(struct mem_ctl_info *mci)
  365. {
  366. /*
  367. * WARNING:
  368. * We are supposed to clear the ECC error detection bits,
  369. * and it will be no problem to do so. However, once they
  370. * are cleared here if we want to re-install CPC925 EDAC
  371. * module later, setting them up in cpc925_mc_init() will
  372. * trigger machine check exception.
  373. * Also, it's ok to leave ECC error detection bits enabled,
  374. * since they are reset to 1 by default or by boot loader.
  375. */
  376. return;
  377. }
  378. /*
  379. * Revert DDR column/row/bank addresses into page frame number and
  380. * offset in page.
  381. *
  382. * Suppose memory mode is 0x0111(128-bit mode, identical DIMM pairs),
  383. * physical address(PA) bits to column address(CA) bits mappings are:
  384. * CA 0 1 2 3 4 5 6 7 8 9 10
  385. * PA 59 58 57 56 55 54 53 52 51 50 49
  386. *
  387. * physical address(PA) bits to bank address(BA) bits mappings are:
  388. * BA 0 1
  389. * PA 43 44
  390. *
  391. * physical address(PA) bits to row address(RA) bits mappings are:
  392. * RA 0 1 2 3 4 5 6 7 8 9 10 11 12
  393. * PA 36 35 34 48 47 46 45 40 41 42 39 38 37
  394. */
  395. static void cpc925_mc_get_pfn(struct mem_ctl_info *mci, u32 mear,
  396. unsigned long *pfn, unsigned long *offset, int *csrow)
  397. {
  398. u32 bcnt, rank, col, bank, row;
  399. u32 c;
  400. unsigned long pa;
  401. int i;
  402. bcnt = (mear & MEAR_BCNT_MASK) >> MEAR_BCNT_SHIFT;
  403. rank = (mear & MEAR_RANK_MASK) >> MEAR_RANK_SHIFT;
  404. col = (mear & MEAR_COL_MASK) >> MEAR_COL_SHIFT;
  405. bank = (mear & MEAR_BANK_MASK) >> MEAR_BANK_SHIFT;
  406. row = mear & MEAR_ROW_MASK;
  407. *csrow = rank;
  408. #ifdef CONFIG_EDAC_DEBUG
  409. if (mci->csrows[rank]->first_page == 0) {
  410. cpc925_mc_printk(mci, KERN_ERR, "ECC occurs in a "
  411. "non-populated csrow, broken hardware?\n");
  412. return;
  413. }
  414. #endif
  415. /* Revert csrow number */
  416. pa = mci->csrows[rank]->first_page << PAGE_SHIFT;
  417. /* Revert column address */
  418. col += bcnt;
  419. for (i = 0; i < 11; i++) {
  420. c = col & 0x1;
  421. col >>= 1;
  422. pa |= c << (14 - i);
  423. }
  424. /* Revert bank address */
  425. pa |= bank << 19;
  426. /* Revert row address, in 4 steps */
  427. for (i = 0; i < 3; i++) {
  428. c = row & 0x1;
  429. row >>= 1;
  430. pa |= c << (26 - i);
  431. }
  432. for (i = 0; i < 3; i++) {
  433. c = row & 0x1;
  434. row >>= 1;
  435. pa |= c << (21 + i);
  436. }
  437. for (i = 0; i < 4; i++) {
  438. c = row & 0x1;
  439. row >>= 1;
  440. pa |= c << (18 - i);
  441. }
  442. for (i = 0; i < 3; i++) {
  443. c = row & 0x1;
  444. row >>= 1;
  445. pa |= c << (29 - i);
  446. }
  447. *offset = pa & (PAGE_SIZE - 1);
  448. *pfn = pa >> PAGE_SHIFT;
  449. edac_dbg(0, "ECC physical address 0x%lx\n", pa);
  450. }
  451. static int cpc925_mc_find_channel(struct mem_ctl_info *mci, u16 syndrome)
  452. {
  453. if ((syndrome & MESR_ECC_SYN_H_MASK) == 0)
  454. return 0;
  455. if ((syndrome & MESR_ECC_SYN_L_MASK) == 0)
  456. return 1;
  457. cpc925_mc_printk(mci, KERN_INFO, "Unexpected syndrome value: 0x%x\n",
  458. syndrome);
  459. return 1;
  460. }
  461. /* Check memory controller registers for ECC errors */
  462. static void cpc925_mc_check(struct mem_ctl_info *mci)
  463. {
  464. struct cpc925_mc_pdata *pdata = mci->pvt_info;
  465. u32 apiexcp;
  466. u32 mear;
  467. u32 mesr;
  468. u16 syndrome;
  469. unsigned long pfn = 0, offset = 0;
  470. int csrow = 0, channel = 0;
  471. /* APIEXCP is cleared when read */
  472. apiexcp = __raw_readl(pdata->vbase + REG_APIEXCP_OFFSET);
  473. if ((apiexcp & ECC_EXCP_DETECTED) == 0)
  474. return;
  475. mesr = __raw_readl(pdata->vbase + REG_MESR_OFFSET);
  476. syndrome = mesr | (MESR_ECC_SYN_H_MASK | MESR_ECC_SYN_L_MASK);
  477. mear = __raw_readl(pdata->vbase + REG_MEAR_OFFSET);
  478. /* Revert column/row addresses into page frame number, etc */
  479. cpc925_mc_get_pfn(mci, mear, &pfn, &offset, &csrow);
  480. if (apiexcp & CECC_EXCP_DETECTED) {
  481. cpc925_mc_printk(mci, KERN_INFO, "DRAM CECC Fault\n");
  482. channel = cpc925_mc_find_channel(mci, syndrome);
  483. edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1,
  484. pfn, offset, syndrome,
  485. csrow, channel, -1,
  486. mci->ctl_name, "");
  487. }
  488. if (apiexcp & UECC_EXCP_DETECTED) {
  489. cpc925_mc_printk(mci, KERN_INFO, "DRAM UECC Fault\n");
  490. edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1,
  491. pfn, offset, 0,
  492. csrow, -1, -1,
  493. mci->ctl_name, "");
  494. }
  495. cpc925_mc_printk(mci, KERN_INFO, "Dump registers:\n");
  496. cpc925_mc_printk(mci, KERN_INFO, "APIMASK 0x%08x\n",
  497. __raw_readl(pdata->vbase + REG_APIMASK_OFFSET));
  498. cpc925_mc_printk(mci, KERN_INFO, "APIEXCP 0x%08x\n",
  499. apiexcp);
  500. cpc925_mc_printk(mci, KERN_INFO, "Mem Scrub Ctrl 0x%08x\n",
  501. __raw_readl(pdata->vbase + REG_MSCR_OFFSET));
  502. cpc925_mc_printk(mci, KERN_INFO, "Mem Scrub Rge Start 0x%08x\n",
  503. __raw_readl(pdata->vbase + REG_MSRSR_OFFSET));
  504. cpc925_mc_printk(mci, KERN_INFO, "Mem Scrub Rge End 0x%08x\n",
  505. __raw_readl(pdata->vbase + REG_MSRER_OFFSET));
  506. cpc925_mc_printk(mci, KERN_INFO, "Mem Scrub Pattern 0x%08x\n",
  507. __raw_readl(pdata->vbase + REG_MSPR_OFFSET));
  508. cpc925_mc_printk(mci, KERN_INFO, "Mem Chk Ctrl 0x%08x\n",
  509. __raw_readl(pdata->vbase + REG_MCCR_OFFSET));
  510. cpc925_mc_printk(mci, KERN_INFO, "Mem Chk Rge End 0x%08x\n",
  511. __raw_readl(pdata->vbase + REG_MCRER_OFFSET));
  512. cpc925_mc_printk(mci, KERN_INFO, "Mem Err Address 0x%08x\n",
  513. mesr);
  514. cpc925_mc_printk(mci, KERN_INFO, "Mem Err Syndrome 0x%08x\n",
  515. syndrome);
  516. }
  517. /******************** CPU err device********************************/
  518. static u32 cpc925_cpu_mask_disabled(void)
  519. {
  520. struct device_node *cpus;
  521. struct device_node *cpunode = NULL;
  522. static u32 mask = 0;
  523. /* use cached value if available */
  524. if (mask != 0)
  525. return mask;
  526. mask = APIMASK_ADI0 | APIMASK_ADI1;
  527. cpus = of_find_node_by_path("/cpus");
  528. if (cpus == NULL) {
  529. cpc925_printk(KERN_DEBUG, "No /cpus node !\n");
  530. return 0;
  531. }
  532. while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
  533. const u32 *reg = of_get_property(cpunode, "reg", NULL);
  534. if (strcmp(cpunode->type, "cpu")) {
  535. cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n", cpunode->name);
  536. continue;
  537. }
  538. if (reg == NULL || *reg > 2) {
  539. cpc925_printk(KERN_ERR, "Bad reg value at %s\n", cpunode->full_name);
  540. continue;
  541. }
  542. mask &= ~APIMASK_ADI(*reg);
  543. }
  544. if (mask != (APIMASK_ADI0 | APIMASK_ADI1)) {
  545. /* We assume that each CPU sits on it's own PI and that
  546. * for present CPUs the reg property equals to the PI
  547. * interface id */
  548. cpc925_printk(KERN_WARNING,
  549. "Assuming PI id is equal to CPU MPIC id!\n");
  550. }
  551. of_node_put(cpunode);
  552. of_node_put(cpus);
  553. return mask;
  554. }
  555. /* Enable CPU Errors detection */
  556. static void cpc925_cpu_init(struct cpc925_dev_info *dev_info)
  557. {
  558. u32 apimask;
  559. u32 cpumask;
  560. apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
  561. cpumask = cpc925_cpu_mask_disabled();
  562. if (apimask & cpumask) {
  563. cpc925_printk(KERN_WARNING, "CPU(s) not present, "
  564. "but enabled in APIMASK, disabling\n");
  565. apimask &= ~cpumask;
  566. }
  567. if ((apimask & CPU_MASK_ENABLE) == 0)
  568. apimask |= CPU_MASK_ENABLE;
  569. __raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
  570. }
  571. /* Disable CPU Errors detection */
  572. static void cpc925_cpu_exit(struct cpc925_dev_info *dev_info)
  573. {
  574. /*
  575. * WARNING:
  576. * We are supposed to clear the CPU error detection bits,
  577. * and it will be no problem to do so. However, once they
  578. * are cleared here if we want to re-install CPC925 EDAC
  579. * module later, setting them up in cpc925_cpu_init() will
  580. * trigger machine check exception.
  581. * Also, it's ok to leave CPU error detection bits enabled,
  582. * since they are reset to 1 by default.
  583. */
  584. return;
  585. }
  586. /* Check for CPU Errors */
  587. static void cpc925_cpu_check(struct edac_device_ctl_info *edac_dev)
  588. {
  589. struct cpc925_dev_info *dev_info = edac_dev->pvt_info;
  590. u32 apiexcp;
  591. u32 apimask;
  592. /* APIEXCP is cleared when read */
  593. apiexcp = __raw_readl(dev_info->vbase + REG_APIEXCP_OFFSET);
  594. if ((apiexcp & CPU_EXCP_DETECTED) == 0)
  595. return;
  596. if ((apiexcp & ~cpc925_cpu_mask_disabled()) == 0)
  597. return;
  598. apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
  599. cpc925_printk(KERN_INFO, "Processor Interface Fault\n"
  600. "Processor Interface register dump:\n");
  601. cpc925_printk(KERN_INFO, "APIMASK 0x%08x\n", apimask);
  602. cpc925_printk(KERN_INFO, "APIEXCP 0x%08x\n", apiexcp);
  603. edac_device_handle_ue(edac_dev, 0, 0, edac_dev->ctl_name);
  604. }
  605. /******************** HT Link err device****************************/
  606. /* Enable HyperTransport Link Error detection */
  607. static void cpc925_htlink_init(struct cpc925_dev_info *dev_info)
  608. {
  609. u32 ht_errctrl;
  610. ht_errctrl = __raw_readl(dev_info->vbase + REG_ERRCTRL_OFFSET);
  611. if ((ht_errctrl & HT_ERRCTRL_ENABLE) == 0) {
  612. ht_errctrl |= HT_ERRCTRL_ENABLE;
  613. __raw_writel(ht_errctrl, dev_info->vbase + REG_ERRCTRL_OFFSET);
  614. }
  615. }
  616. /* Disable HyperTransport Link Error detection */
  617. static void cpc925_htlink_exit(struct cpc925_dev_info *dev_info)
  618. {
  619. u32 ht_errctrl;
  620. ht_errctrl = __raw_readl(dev_info->vbase + REG_ERRCTRL_OFFSET);
  621. ht_errctrl &= ~HT_ERRCTRL_ENABLE;
  622. __raw_writel(ht_errctrl, dev_info->vbase + REG_ERRCTRL_OFFSET);
  623. }
  624. /* Check for HyperTransport Link errors */
  625. static void cpc925_htlink_check(struct edac_device_ctl_info *edac_dev)
  626. {
  627. struct cpc925_dev_info *dev_info = edac_dev->pvt_info;
  628. u32 brgctrl = __raw_readl(dev_info->vbase + REG_BRGCTRL_OFFSET);
  629. u32 linkctrl = __raw_readl(dev_info->vbase + REG_LINKCTRL_OFFSET);
  630. u32 errctrl = __raw_readl(dev_info->vbase + REG_ERRCTRL_OFFSET);
  631. u32 linkerr = __raw_readl(dev_info->vbase + REG_LINKERR_OFFSET);
  632. if (!((brgctrl & BRGCTRL_DETSERR) ||
  633. (linkctrl & HT_LINKCTRL_DETECTED) ||
  634. (errctrl & HT_ERRCTRL_DETECTED) ||
  635. (linkerr & HT_LINKERR_DETECTED)))
  636. return;
  637. cpc925_printk(KERN_INFO, "HT Link Fault\n"
  638. "HT register dump:\n");
  639. cpc925_printk(KERN_INFO, "Bridge Ctrl 0x%08x\n",
  640. brgctrl);
  641. cpc925_printk(KERN_INFO, "Link Config Ctrl 0x%08x\n",
  642. linkctrl);
  643. cpc925_printk(KERN_INFO, "Error Enum and Ctrl 0x%08x\n",
  644. errctrl);
  645. cpc925_printk(KERN_INFO, "Link Error 0x%08x\n",
  646. linkerr);
  647. /* Clear by write 1 */
  648. if (brgctrl & BRGCTRL_DETSERR)
  649. __raw_writel(BRGCTRL_DETSERR,
  650. dev_info->vbase + REG_BRGCTRL_OFFSET);
  651. if (linkctrl & HT_LINKCTRL_DETECTED)
  652. __raw_writel(HT_LINKCTRL_DETECTED,
  653. dev_info->vbase + REG_LINKCTRL_OFFSET);
  654. /* Initiate Secondary Bus Reset to clear the chain failure */
  655. if (errctrl & ERRCTRL_CHN_FAL)
  656. __raw_writel(BRGCTRL_SECBUSRESET,
  657. dev_info->vbase + REG_BRGCTRL_OFFSET);
  658. if (errctrl & ERRCTRL_RSP_ERR)
  659. __raw_writel(ERRCTRL_RSP_ERR,
  660. dev_info->vbase + REG_ERRCTRL_OFFSET);
  661. if (linkerr & HT_LINKERR_DETECTED)
  662. __raw_writel(HT_LINKERR_DETECTED,
  663. dev_info->vbase + REG_LINKERR_OFFSET);
  664. edac_device_handle_ce(edac_dev, 0, 0, edac_dev->ctl_name);
  665. }
  666. static struct cpc925_dev_info cpc925_devs[] = {
  667. {
  668. .ctl_name = CPC925_CPU_ERR_DEV,
  669. .init = cpc925_cpu_init,
  670. .exit = cpc925_cpu_exit,
  671. .check = cpc925_cpu_check,
  672. },
  673. {
  674. .ctl_name = CPC925_HT_LINK_DEV,
  675. .init = cpc925_htlink_init,
  676. .exit = cpc925_htlink_exit,
  677. .check = cpc925_htlink_check,
  678. },
  679. { }
  680. };
  681. /*
  682. * Add CPU Err detection and HyperTransport Link Err detection
  683. * as common "edac_device", they have no corresponding device
  684. * nodes in the Open Firmware DTB and we have to add platform
  685. * devices for them. Also, they will share the MMIO with that
  686. * of memory controller.
  687. */
  688. static void cpc925_add_edac_devices(void __iomem *vbase)
  689. {
  690. struct cpc925_dev_info *dev_info;
  691. if (!vbase) {
  692. cpc925_printk(KERN_ERR, "MMIO not established yet\n");
  693. return;
  694. }
  695. for (dev_info = &cpc925_devs[0]; dev_info->init; dev_info++) {
  696. dev_info->vbase = vbase;
  697. dev_info->pdev = platform_device_register_simple(
  698. dev_info->ctl_name, 0, NULL, 0);
  699. if (IS_ERR(dev_info->pdev)) {
  700. cpc925_printk(KERN_ERR,
  701. "Can't register platform device for %s\n",
  702. dev_info->ctl_name);
  703. continue;
  704. }
  705. /*
  706. * Don't have to allocate private structure but
  707. * make use of cpc925_devs[] instead.
  708. */
  709. dev_info->edac_idx = edac_device_alloc_index();
  710. dev_info->edac_dev =
  711. edac_device_alloc_ctl_info(0, dev_info->ctl_name,
  712. 1, NULL, 0, 0, NULL, 0, dev_info->edac_idx);
  713. if (!dev_info->edac_dev) {
  714. cpc925_printk(KERN_ERR, "No memory for edac device\n");
  715. goto err1;
  716. }
  717. dev_info->edac_dev->pvt_info = dev_info;
  718. dev_info->edac_dev->dev = &dev_info->pdev->dev;
  719. dev_info->edac_dev->ctl_name = dev_info->ctl_name;
  720. dev_info->edac_dev->mod_name = CPC925_EDAC_MOD_STR;
  721. dev_info->edac_dev->dev_name = dev_name(&dev_info->pdev->dev);
  722. if (edac_op_state == EDAC_OPSTATE_POLL)
  723. dev_info->edac_dev->edac_check = dev_info->check;
  724. if (dev_info->init)
  725. dev_info->init(dev_info);
  726. if (edac_device_add_device(dev_info->edac_dev) > 0) {
  727. cpc925_printk(KERN_ERR,
  728. "Unable to add edac device for %s\n",
  729. dev_info->ctl_name);
  730. goto err2;
  731. }
  732. edac_dbg(0, "Successfully added edac device for %s\n",
  733. dev_info->ctl_name);
  734. continue;
  735. err2:
  736. if (dev_info->exit)
  737. dev_info->exit(dev_info);
  738. edac_device_free_ctl_info(dev_info->edac_dev);
  739. err1:
  740. platform_device_unregister(dev_info->pdev);
  741. }
  742. }
  743. /*
  744. * Delete the common "edac_device" for CPU Err Detection
  745. * and HyperTransport Link Err Detection
  746. */
  747. static void cpc925_del_edac_devices(void)
  748. {
  749. struct cpc925_dev_info *dev_info;
  750. for (dev_info = &cpc925_devs[0]; dev_info->init; dev_info++) {
  751. if (dev_info->edac_dev) {
  752. edac_device_del_device(dev_info->edac_dev->dev);
  753. edac_device_free_ctl_info(dev_info->edac_dev);
  754. platform_device_unregister(dev_info->pdev);
  755. }
  756. if (dev_info->exit)
  757. dev_info->exit(dev_info);
  758. edac_dbg(0, "Successfully deleted edac device for %s\n",
  759. dev_info->ctl_name);
  760. }
  761. }
  762. /* Convert current back-ground scrub rate into byte/sec bandwidth */
  763. static int cpc925_get_sdram_scrub_rate(struct mem_ctl_info *mci)
  764. {
  765. struct cpc925_mc_pdata *pdata = mci->pvt_info;
  766. int bw;
  767. u32 mscr;
  768. u8 si;
  769. mscr = __raw_readl(pdata->vbase + REG_MSCR_OFFSET);
  770. si = (mscr & MSCR_SI_MASK) >> MSCR_SI_SHIFT;
  771. edac_dbg(0, "Mem Scrub Ctrl Register 0x%x\n", mscr);
  772. if (((mscr & MSCR_SCRUB_MOD_MASK) != MSCR_BACKGR_SCRUB) ||
  773. (si == 0)) {
  774. cpc925_mc_printk(mci, KERN_INFO, "Scrub mode not enabled\n");
  775. bw = 0;
  776. } else
  777. bw = CPC925_SCRUB_BLOCK_SIZE * 0xFA67 / si;
  778. return bw;
  779. }
  780. /* Return 0 for single channel; 1 for dual channel */
  781. static int cpc925_mc_get_channels(void __iomem *vbase)
  782. {
  783. int dual = 0;
  784. u32 mbcr;
  785. mbcr = __raw_readl(vbase + REG_MBCR_OFFSET);
  786. /*
  787. * Dual channel only when 128-bit wide physical bus
  788. * and 128-bit configuration.
  789. */
  790. if (((mbcr & MBCR_64BITCFG_MASK) == 0) &&
  791. ((mbcr & MBCR_64BITBUS_MASK) == 0))
  792. dual = 1;
  793. edac_dbg(0, "%s channel\n", (dual > 0) ? "Dual" : "Single");
  794. return dual;
  795. }
  796. static int cpc925_probe(struct platform_device *pdev)
  797. {
  798. static int edac_mc_idx;
  799. struct mem_ctl_info *mci;
  800. struct edac_mc_layer layers[2];
  801. void __iomem *vbase;
  802. struct cpc925_mc_pdata *pdata;
  803. struct resource *r;
  804. int res = 0, nr_channels;
  805. edac_dbg(0, "%s platform device found!\n", pdev->name);
  806. if (!devres_open_group(&pdev->dev, cpc925_probe, GFP_KERNEL)) {
  807. res = -ENOMEM;
  808. goto out;
  809. }
  810. r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  811. if (!r) {
  812. cpc925_printk(KERN_ERR, "Unable to get resource\n");
  813. res = -ENOENT;
  814. goto err1;
  815. }
  816. if (!devm_request_mem_region(&pdev->dev,
  817. r->start,
  818. resource_size(r),
  819. pdev->name)) {
  820. cpc925_printk(KERN_ERR, "Unable to request mem region\n");
  821. res = -EBUSY;
  822. goto err1;
  823. }
  824. vbase = devm_ioremap(&pdev->dev, r->start, resource_size(r));
  825. if (!vbase) {
  826. cpc925_printk(KERN_ERR, "Unable to ioremap device\n");
  827. res = -ENOMEM;
  828. goto err2;
  829. }
  830. nr_channels = cpc925_mc_get_channels(vbase) + 1;
  831. layers[0].type = EDAC_MC_LAYER_CHIP_SELECT;
  832. layers[0].size = CPC925_NR_CSROWS;
  833. layers[0].is_virt_csrow = true;
  834. layers[1].type = EDAC_MC_LAYER_CHANNEL;
  835. layers[1].size = nr_channels;
  836. layers[1].is_virt_csrow = false;
  837. mci = edac_mc_alloc(edac_mc_idx, ARRAY_SIZE(layers), layers,
  838. sizeof(struct cpc925_mc_pdata));
  839. if (!mci) {
  840. cpc925_printk(KERN_ERR, "No memory for mem_ctl_info\n");
  841. res = -ENOMEM;
  842. goto err2;
  843. }
  844. pdata = mci->pvt_info;
  845. pdata->vbase = vbase;
  846. pdata->edac_idx = edac_mc_idx++;
  847. pdata->name = pdev->name;
  848. mci->pdev = &pdev->dev;
  849. platform_set_drvdata(pdev, mci);
  850. mci->dev_name = dev_name(&pdev->dev);
  851. mci->mtype_cap = MEM_FLAG_RDDR | MEM_FLAG_DDR;
  852. mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED;
  853. mci->edac_cap = EDAC_FLAG_SECDED;
  854. mci->mod_name = CPC925_EDAC_MOD_STR;
  855. mci->mod_ver = CPC925_EDAC_REVISION;
  856. mci->ctl_name = pdev->name;
  857. if (edac_op_state == EDAC_OPSTATE_POLL)
  858. mci->edac_check = cpc925_mc_check;
  859. mci->ctl_page_to_phys = NULL;
  860. mci->scrub_mode = SCRUB_SW_SRC;
  861. mci->set_sdram_scrub_rate = NULL;
  862. mci->get_sdram_scrub_rate = cpc925_get_sdram_scrub_rate;
  863. cpc925_init_csrows(mci);
  864. /* Setup memory controller registers */
  865. cpc925_mc_init(mci);
  866. if (edac_mc_add_mc(mci) > 0) {
  867. cpc925_mc_printk(mci, KERN_ERR, "Failed edac_mc_add_mc()\n");
  868. goto err3;
  869. }
  870. cpc925_add_edac_devices(vbase);
  871. /* get this far and it's successful */
  872. edac_dbg(0, "success\n");
  873. res = 0;
  874. goto out;
  875. err3:
  876. cpc925_mc_exit(mci);
  877. edac_mc_free(mci);
  878. err2:
  879. devm_release_mem_region(&pdev->dev, r->start, resource_size(r));
  880. err1:
  881. devres_release_group(&pdev->dev, cpc925_probe);
  882. out:
  883. return res;
  884. }
  885. static int cpc925_remove(struct platform_device *pdev)
  886. {
  887. struct mem_ctl_info *mci = platform_get_drvdata(pdev);
  888. /*
  889. * Delete common edac devices before edac mc, because
  890. * the former share the MMIO of the latter.
  891. */
  892. cpc925_del_edac_devices();
  893. cpc925_mc_exit(mci);
  894. edac_mc_del_mc(&pdev->dev);
  895. edac_mc_free(mci);
  896. return 0;
  897. }
  898. static struct platform_driver cpc925_edac_driver = {
  899. .probe = cpc925_probe,
  900. .remove = cpc925_remove,
  901. .driver = {
  902. .name = "cpc925_edac",
  903. }
  904. };
  905. static int __init cpc925_edac_init(void)
  906. {
  907. int ret = 0;
  908. printk(KERN_INFO "IBM CPC925 EDAC driver " CPC925_EDAC_REVISION "\n");
  909. printk(KERN_INFO "\t(c) 2008 Wind River Systems, Inc\n");
  910. /* Only support POLL mode so far */
  911. edac_op_state = EDAC_OPSTATE_POLL;
  912. ret = platform_driver_register(&cpc925_edac_driver);
  913. if (ret) {
  914. printk(KERN_WARNING "Failed to register %s\n",
  915. CPC925_EDAC_MOD_STR);
  916. }
  917. return ret;
  918. }
  919. static void __exit cpc925_edac_exit(void)
  920. {
  921. platform_driver_unregister(&cpc925_edac_driver);
  922. }
  923. module_init(cpc925_edac_init);
  924. module_exit(cpc925_edac_exit);
  925. MODULE_LICENSE("GPL");
  926. MODULE_AUTHOR("Cao Qingtao <qingtao.cao@windriver.com>");
  927. MODULE_DESCRIPTION("IBM CPC925 Bridge and MC EDAC kernel module");