exynos4_bus.c 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154
  1. /* drivers/devfreq/exynos4210_memorybus.c
  2. *
  3. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com/
  5. * MyungJoo Ham <myungjoo.ham@samsung.com>
  6. *
  7. * EXYNOS4 - Memory/Bus clock frequency scaling support in DEVFREQ framework
  8. * This version supports EXYNOS4210 only. This changes bus frequencies
  9. * and vddint voltages. Exynos4412/4212 should be able to be supported
  10. * with minor modifications.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. *
  16. */
  17. #include <linux/io.h>
  18. #include <linux/slab.h>
  19. #include <linux/mutex.h>
  20. #include <linux/suspend.h>
  21. #include <linux/opp.h>
  22. #include <linux/devfreq.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/regulator/consumer.h>
  25. #include <linux/module.h>
  26. /* Exynos4 ASV has been in the mailing list, but not upstreamed, yet. */
  27. #ifdef CONFIG_EXYNOS_ASV
  28. extern unsigned int exynos_result_of_asv;
  29. #endif
  30. #include <mach/regs-clock.h>
  31. #include <plat/map-s5p.h>
  32. #define MAX_SAFEVOLT 1200000 /* 1.2V */
  33. enum exynos4_busf_type {
  34. TYPE_BUSF_EXYNOS4210,
  35. TYPE_BUSF_EXYNOS4x12,
  36. };
  37. /* Assume that the bus is saturated if the utilization is 40% */
  38. #define BUS_SATURATION_RATIO 40
  39. enum ppmu_counter {
  40. PPMU_PMNCNT0 = 0,
  41. PPMU_PMCCNT1,
  42. PPMU_PMNCNT2,
  43. PPMU_PMNCNT3,
  44. PPMU_PMNCNT_MAX,
  45. };
  46. struct exynos4_ppmu {
  47. void __iomem *hw_base;
  48. unsigned int ccnt;
  49. unsigned int event;
  50. unsigned int count[PPMU_PMNCNT_MAX];
  51. bool ccnt_overflow;
  52. bool count_overflow[PPMU_PMNCNT_MAX];
  53. };
  54. enum busclk_level_idx {
  55. LV_0 = 0,
  56. LV_1,
  57. LV_2,
  58. LV_3,
  59. LV_4,
  60. _LV_END
  61. };
  62. #define EX4210_LV_MAX LV_2
  63. #define EX4x12_LV_MAX LV_4
  64. #define EX4210_LV_NUM (LV_2 + 1)
  65. #define EX4x12_LV_NUM (LV_4 + 1)
  66. /**
  67. * struct busfreq_opp_info - opp information for bus
  68. * @rate: Frequency in hertz
  69. * @volt: Voltage in microvolts corresponding to this OPP
  70. */
  71. struct busfreq_opp_info {
  72. unsigned long rate;
  73. unsigned long volt;
  74. };
  75. struct busfreq_data {
  76. enum exynos4_busf_type type;
  77. struct device *dev;
  78. struct devfreq *devfreq;
  79. bool disabled;
  80. struct regulator *vdd_int;
  81. struct regulator *vdd_mif; /* Exynos4412/4212 only */
  82. struct busfreq_opp_info curr_oppinfo;
  83. struct exynos4_ppmu dmc[2];
  84. struct notifier_block pm_notifier;
  85. struct mutex lock;
  86. /* Dividers calculated at boot/probe-time */
  87. unsigned int dmc_divtable[_LV_END]; /* DMC0 */
  88. unsigned int top_divtable[_LV_END];
  89. };
  90. struct bus_opp_table {
  91. unsigned int idx;
  92. unsigned long clk;
  93. unsigned long volt;
  94. };
  95. /* 4210 controls clock of mif and voltage of int */
  96. static struct bus_opp_table exynos4210_busclk_table[] = {
  97. {LV_0, 400000, 1150000},
  98. {LV_1, 267000, 1050000},
  99. {LV_2, 133000, 1025000},
  100. {0, 0, 0},
  101. };
  102. /*
  103. * MIF is the main control knob clock for exynox4x12 MIF/INT
  104. * clock and voltage of both mif/int are controlled.
  105. */
  106. static struct bus_opp_table exynos4x12_mifclk_table[] = {
  107. {LV_0, 400000, 1100000},
  108. {LV_1, 267000, 1000000},
  109. {LV_2, 160000, 950000},
  110. {LV_3, 133000, 950000},
  111. {LV_4, 100000, 950000},
  112. {0, 0, 0},
  113. };
  114. /*
  115. * INT is not the control knob of 4x12. LV_x is not meant to represent
  116. * the current performance. (MIF does)
  117. */
  118. static struct bus_opp_table exynos4x12_intclk_table[] = {
  119. {LV_0, 200000, 1000000},
  120. {LV_1, 160000, 950000},
  121. {LV_2, 133000, 925000},
  122. {LV_3, 100000, 900000},
  123. {0, 0, 0},
  124. };
  125. /* TODO: asv volt definitions are "__initdata"? */
  126. /* Some chips have different operating voltages */
  127. static unsigned int exynos4210_asv_volt[][EX4210_LV_NUM] = {
  128. {1150000, 1050000, 1050000},
  129. {1125000, 1025000, 1025000},
  130. {1100000, 1000000, 1000000},
  131. {1075000, 975000, 975000},
  132. {1050000, 950000, 950000},
  133. };
  134. static unsigned int exynos4x12_mif_step_50[][EX4x12_LV_NUM] = {
  135. /* 400 267 160 133 100 */
  136. {1050000, 950000, 900000, 900000, 900000}, /* ASV0 */
  137. {1050000, 950000, 900000, 900000, 900000}, /* ASV1 */
  138. {1050000, 950000, 900000, 900000, 900000}, /* ASV2 */
  139. {1050000, 900000, 900000, 900000, 900000}, /* ASV3 */
  140. {1050000, 900000, 900000, 900000, 850000}, /* ASV4 */
  141. {1050000, 900000, 900000, 850000, 850000}, /* ASV5 */
  142. {1050000, 900000, 850000, 850000, 850000}, /* ASV6 */
  143. {1050000, 900000, 850000, 850000, 850000}, /* ASV7 */
  144. {1050000, 900000, 850000, 850000, 850000}, /* ASV8 */
  145. };
  146. static unsigned int exynos4x12_int_volt[][EX4x12_LV_NUM] = {
  147. /* 200 160 133 100 */
  148. {1000000, 950000, 925000, 900000}, /* ASV0 */
  149. {975000, 925000, 925000, 900000}, /* ASV1 */
  150. {950000, 925000, 900000, 875000}, /* ASV2 */
  151. {950000, 900000, 900000, 875000}, /* ASV3 */
  152. {925000, 875000, 875000, 875000}, /* ASV4 */
  153. {900000, 850000, 850000, 850000}, /* ASV5 */
  154. {900000, 850000, 850000, 850000}, /* ASV6 */
  155. {900000, 850000, 850000, 850000}, /* ASV7 */
  156. {900000, 850000, 850000, 850000}, /* ASV8 */
  157. };
  158. /*** Clock Divider Data for Exynos4210 ***/
  159. static unsigned int exynos4210_clkdiv_dmc0[][8] = {
  160. /*
  161. * Clock divider value for following
  162. * { DIVACP, DIVACP_PCLK, DIVDPHY, DIVDMC, DIVDMCD
  163. * DIVDMCP, DIVCOPY2, DIVCORE_TIMERS }
  164. */
  165. /* DMC L0: 400MHz */
  166. { 3, 1, 1, 1, 1, 1, 3, 1 },
  167. /* DMC L1: 266.7MHz */
  168. { 4, 1, 1, 2, 1, 1, 3, 1 },
  169. /* DMC L2: 133MHz */
  170. { 5, 1, 1, 5, 1, 1, 3, 1 },
  171. };
  172. static unsigned int exynos4210_clkdiv_top[][5] = {
  173. /*
  174. * Clock divider value for following
  175. * { DIVACLK200, DIVACLK100, DIVACLK160, DIVACLK133, DIVONENAND }
  176. */
  177. /* ACLK200 L0: 200MHz */
  178. { 3, 7, 4, 5, 1 },
  179. /* ACLK200 L1: 160MHz */
  180. { 4, 7, 5, 6, 1 },
  181. /* ACLK200 L2: 133MHz */
  182. { 5, 7, 7, 7, 1 },
  183. };
  184. static unsigned int exynos4210_clkdiv_lr_bus[][2] = {
  185. /*
  186. * Clock divider value for following
  187. * { DIVGDL/R, DIVGPL/R }
  188. */
  189. /* ACLK_GDL/R L1: 200MHz */
  190. { 3, 1 },
  191. /* ACLK_GDL/R L2: 160MHz */
  192. { 4, 1 },
  193. /* ACLK_GDL/R L3: 133MHz */
  194. { 5, 1 },
  195. };
  196. /*** Clock Divider Data for Exynos4212/4412 ***/
  197. static unsigned int exynos4x12_clkdiv_dmc0[][6] = {
  198. /*
  199. * Clock divider value for following
  200. * { DIVACP, DIVACP_PCLK, DIVDPHY, DIVDMC, DIVDMCD
  201. * DIVDMCP}
  202. */
  203. /* DMC L0: 400MHz */
  204. {3, 1, 1, 1, 1, 1},
  205. /* DMC L1: 266.7MHz */
  206. {4, 1, 1, 2, 1, 1},
  207. /* DMC L2: 160MHz */
  208. {5, 1, 1, 4, 1, 1},
  209. /* DMC L3: 133MHz */
  210. {5, 1, 1, 5, 1, 1},
  211. /* DMC L4: 100MHz */
  212. {7, 1, 1, 7, 1, 1},
  213. };
  214. static unsigned int exynos4x12_clkdiv_dmc1[][6] = {
  215. /*
  216. * Clock divider value for following
  217. * { G2DACP, DIVC2C, DIVC2C_ACLK }
  218. */
  219. /* DMC L0: 400MHz */
  220. {3, 1, 1},
  221. /* DMC L1: 266.7MHz */
  222. {4, 2, 1},
  223. /* DMC L2: 160MHz */
  224. {5, 4, 1},
  225. /* DMC L3: 133MHz */
  226. {5, 5, 1},
  227. /* DMC L4: 100MHz */
  228. {7, 7, 1},
  229. };
  230. static unsigned int exynos4x12_clkdiv_top[][5] = {
  231. /*
  232. * Clock divider value for following
  233. * { DIVACLK266_GPS, DIVACLK100, DIVACLK160,
  234. DIVACLK133, DIVONENAND }
  235. */
  236. /* ACLK_GDL/R L0: 200MHz */
  237. {2, 7, 4, 5, 1},
  238. /* ACLK_GDL/R L1: 200MHz */
  239. {2, 7, 4, 5, 1},
  240. /* ACLK_GDL/R L2: 160MHz */
  241. {4, 7, 5, 7, 1},
  242. /* ACLK_GDL/R L3: 133MHz */
  243. {4, 7, 5, 7, 1},
  244. /* ACLK_GDL/R L4: 100MHz */
  245. {7, 7, 7, 7, 1},
  246. };
  247. static unsigned int exynos4x12_clkdiv_lr_bus[][2] = {
  248. /*
  249. * Clock divider value for following
  250. * { DIVGDL/R, DIVGPL/R }
  251. */
  252. /* ACLK_GDL/R L0: 200MHz */
  253. {3, 1},
  254. /* ACLK_GDL/R L1: 200MHz */
  255. {3, 1},
  256. /* ACLK_GDL/R L2: 160MHz */
  257. {4, 1},
  258. /* ACLK_GDL/R L3: 133MHz */
  259. {5, 1},
  260. /* ACLK_GDL/R L4: 100MHz */
  261. {7, 1},
  262. };
  263. static unsigned int exynos4x12_clkdiv_sclkip[][3] = {
  264. /*
  265. * Clock divider value for following
  266. * { DIVMFC, DIVJPEG, DIVFIMC0~3}
  267. */
  268. /* SCLK_MFC: 200MHz */
  269. {3, 3, 4},
  270. /* SCLK_MFC: 200MHz */
  271. {3, 3, 4},
  272. /* SCLK_MFC: 160MHz */
  273. {4, 4, 5},
  274. /* SCLK_MFC: 133MHz */
  275. {5, 5, 5},
  276. /* SCLK_MFC: 100MHz */
  277. {7, 7, 7},
  278. };
  279. static int exynos4210_set_busclk(struct busfreq_data *data,
  280. struct busfreq_opp_info *oppi)
  281. {
  282. unsigned int index;
  283. unsigned int tmp;
  284. for (index = LV_0; index < EX4210_LV_NUM; index++)
  285. if (oppi->rate == exynos4210_busclk_table[index].clk)
  286. break;
  287. if (index == EX4210_LV_NUM)
  288. return -EINVAL;
  289. /* Change Divider - DMC0 */
  290. tmp = data->dmc_divtable[index];
  291. __raw_writel(tmp, EXYNOS4_CLKDIV_DMC0);
  292. do {
  293. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_DMC0);
  294. } while (tmp & 0x11111111);
  295. /* Change Divider - TOP */
  296. tmp = data->top_divtable[index];
  297. __raw_writel(tmp, EXYNOS4_CLKDIV_TOP);
  298. do {
  299. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_TOP);
  300. } while (tmp & 0x11111);
  301. /* Change Divider - LEFTBUS */
  302. tmp = __raw_readl(EXYNOS4_CLKDIV_LEFTBUS);
  303. tmp &= ~(EXYNOS4_CLKDIV_BUS_GDLR_MASK | EXYNOS4_CLKDIV_BUS_GPLR_MASK);
  304. tmp |= ((exynos4210_clkdiv_lr_bus[index][0] <<
  305. EXYNOS4_CLKDIV_BUS_GDLR_SHIFT) |
  306. (exynos4210_clkdiv_lr_bus[index][1] <<
  307. EXYNOS4_CLKDIV_BUS_GPLR_SHIFT));
  308. __raw_writel(tmp, EXYNOS4_CLKDIV_LEFTBUS);
  309. do {
  310. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_LEFTBUS);
  311. } while (tmp & 0x11);
  312. /* Change Divider - RIGHTBUS */
  313. tmp = __raw_readl(EXYNOS4_CLKDIV_RIGHTBUS);
  314. tmp &= ~(EXYNOS4_CLKDIV_BUS_GDLR_MASK | EXYNOS4_CLKDIV_BUS_GPLR_MASK);
  315. tmp |= ((exynos4210_clkdiv_lr_bus[index][0] <<
  316. EXYNOS4_CLKDIV_BUS_GDLR_SHIFT) |
  317. (exynos4210_clkdiv_lr_bus[index][1] <<
  318. EXYNOS4_CLKDIV_BUS_GPLR_SHIFT));
  319. __raw_writel(tmp, EXYNOS4_CLKDIV_RIGHTBUS);
  320. do {
  321. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_RIGHTBUS);
  322. } while (tmp & 0x11);
  323. return 0;
  324. }
  325. static int exynos4x12_set_busclk(struct busfreq_data *data,
  326. struct busfreq_opp_info *oppi)
  327. {
  328. unsigned int index;
  329. unsigned int tmp;
  330. for (index = LV_0; index < EX4x12_LV_NUM; index++)
  331. if (oppi->rate == exynos4x12_mifclk_table[index].clk)
  332. break;
  333. if (index == EX4x12_LV_NUM)
  334. return -EINVAL;
  335. /* Change Divider - DMC0 */
  336. tmp = data->dmc_divtable[index];
  337. __raw_writel(tmp, EXYNOS4_CLKDIV_DMC0);
  338. do {
  339. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_DMC0);
  340. } while (tmp & 0x11111111);
  341. /* Change Divider - DMC1 */
  342. tmp = __raw_readl(EXYNOS4_CLKDIV_DMC1);
  343. tmp &= ~(EXYNOS4_CLKDIV_DMC1_G2D_ACP_MASK |
  344. EXYNOS4_CLKDIV_DMC1_C2C_MASK |
  345. EXYNOS4_CLKDIV_DMC1_C2CACLK_MASK);
  346. tmp |= ((exynos4x12_clkdiv_dmc1[index][0] <<
  347. EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT) |
  348. (exynos4x12_clkdiv_dmc1[index][1] <<
  349. EXYNOS4_CLKDIV_DMC1_C2C_SHIFT) |
  350. (exynos4x12_clkdiv_dmc1[index][2] <<
  351. EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT));
  352. __raw_writel(tmp, EXYNOS4_CLKDIV_DMC1);
  353. do {
  354. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_DMC1);
  355. } while (tmp & 0x111111);
  356. /* Change Divider - TOP */
  357. tmp = __raw_readl(EXYNOS4_CLKDIV_TOP);
  358. tmp &= ~(EXYNOS4_CLKDIV_TOP_ACLK266_GPS_MASK |
  359. EXYNOS4_CLKDIV_TOP_ACLK100_MASK |
  360. EXYNOS4_CLKDIV_TOP_ACLK160_MASK |
  361. EXYNOS4_CLKDIV_TOP_ACLK133_MASK |
  362. EXYNOS4_CLKDIV_TOP_ONENAND_MASK);
  363. tmp |= ((exynos4x12_clkdiv_top[index][0] <<
  364. EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT) |
  365. (exynos4x12_clkdiv_top[index][1] <<
  366. EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT) |
  367. (exynos4x12_clkdiv_top[index][2] <<
  368. EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT) |
  369. (exynos4x12_clkdiv_top[index][3] <<
  370. EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT) |
  371. (exynos4x12_clkdiv_top[index][4] <<
  372. EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT));
  373. __raw_writel(tmp, EXYNOS4_CLKDIV_TOP);
  374. do {
  375. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_TOP);
  376. } while (tmp & 0x11111);
  377. /* Change Divider - LEFTBUS */
  378. tmp = __raw_readl(EXYNOS4_CLKDIV_LEFTBUS);
  379. tmp &= ~(EXYNOS4_CLKDIV_BUS_GDLR_MASK | EXYNOS4_CLKDIV_BUS_GPLR_MASK);
  380. tmp |= ((exynos4x12_clkdiv_lr_bus[index][0] <<
  381. EXYNOS4_CLKDIV_BUS_GDLR_SHIFT) |
  382. (exynos4x12_clkdiv_lr_bus[index][1] <<
  383. EXYNOS4_CLKDIV_BUS_GPLR_SHIFT));
  384. __raw_writel(tmp, EXYNOS4_CLKDIV_LEFTBUS);
  385. do {
  386. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_LEFTBUS);
  387. } while (tmp & 0x11);
  388. /* Change Divider - RIGHTBUS */
  389. tmp = __raw_readl(EXYNOS4_CLKDIV_RIGHTBUS);
  390. tmp &= ~(EXYNOS4_CLKDIV_BUS_GDLR_MASK | EXYNOS4_CLKDIV_BUS_GPLR_MASK);
  391. tmp |= ((exynos4x12_clkdiv_lr_bus[index][0] <<
  392. EXYNOS4_CLKDIV_BUS_GDLR_SHIFT) |
  393. (exynos4x12_clkdiv_lr_bus[index][1] <<
  394. EXYNOS4_CLKDIV_BUS_GPLR_SHIFT));
  395. __raw_writel(tmp, EXYNOS4_CLKDIV_RIGHTBUS);
  396. do {
  397. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_RIGHTBUS);
  398. } while (tmp & 0x11);
  399. /* Change Divider - MFC */
  400. tmp = __raw_readl(EXYNOS4_CLKDIV_MFC);
  401. tmp &= ~(EXYNOS4_CLKDIV_MFC_MASK);
  402. tmp |= ((exynos4x12_clkdiv_sclkip[index][0] <<
  403. EXYNOS4_CLKDIV_MFC_SHIFT));
  404. __raw_writel(tmp, EXYNOS4_CLKDIV_MFC);
  405. do {
  406. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_MFC);
  407. } while (tmp & 0x1);
  408. /* Change Divider - JPEG */
  409. tmp = __raw_readl(EXYNOS4_CLKDIV_CAM1);
  410. tmp &= ~(EXYNOS4_CLKDIV_CAM1_JPEG_MASK);
  411. tmp |= ((exynos4x12_clkdiv_sclkip[index][1] <<
  412. EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT));
  413. __raw_writel(tmp, EXYNOS4_CLKDIV_CAM1);
  414. do {
  415. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_CAM1);
  416. } while (tmp & 0x1);
  417. /* Change Divider - FIMC0~3 */
  418. tmp = __raw_readl(EXYNOS4_CLKDIV_CAM);
  419. tmp &= ~(EXYNOS4_CLKDIV_CAM_FIMC0_MASK | EXYNOS4_CLKDIV_CAM_FIMC1_MASK |
  420. EXYNOS4_CLKDIV_CAM_FIMC2_MASK | EXYNOS4_CLKDIV_CAM_FIMC3_MASK);
  421. tmp |= ((exynos4x12_clkdiv_sclkip[index][2] <<
  422. EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT) |
  423. (exynos4x12_clkdiv_sclkip[index][2] <<
  424. EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT) |
  425. (exynos4x12_clkdiv_sclkip[index][2] <<
  426. EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT) |
  427. (exynos4x12_clkdiv_sclkip[index][2] <<
  428. EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT));
  429. __raw_writel(tmp, EXYNOS4_CLKDIV_CAM);
  430. do {
  431. tmp = __raw_readl(EXYNOS4_CLKDIV_STAT_CAM1);
  432. } while (tmp & 0x1111);
  433. return 0;
  434. }
  435. static void busfreq_mon_reset(struct busfreq_data *data)
  436. {
  437. unsigned int i;
  438. for (i = 0; i < 2; i++) {
  439. void __iomem *ppmu_base = data->dmc[i].hw_base;
  440. /* Reset PPMU */
  441. __raw_writel(0x8000000f, ppmu_base + 0xf010);
  442. __raw_writel(0x8000000f, ppmu_base + 0xf050);
  443. __raw_writel(0x6, ppmu_base + 0xf000);
  444. __raw_writel(0x0, ppmu_base + 0xf100);
  445. /* Set PPMU Event */
  446. data->dmc[i].event = 0x6;
  447. __raw_writel(((data->dmc[i].event << 12) | 0x1),
  448. ppmu_base + 0xfc);
  449. /* Start PPMU */
  450. __raw_writel(0x1, ppmu_base + 0xf000);
  451. }
  452. }
  453. static void exynos4_read_ppmu(struct busfreq_data *data)
  454. {
  455. int i, j;
  456. for (i = 0; i < 2; i++) {
  457. void __iomem *ppmu_base = data->dmc[i].hw_base;
  458. u32 overflow;
  459. /* Stop PPMU */
  460. __raw_writel(0x0, ppmu_base + 0xf000);
  461. /* Update local data from PPMU */
  462. overflow = __raw_readl(ppmu_base + 0xf050);
  463. data->dmc[i].ccnt = __raw_readl(ppmu_base + 0xf100);
  464. data->dmc[i].ccnt_overflow = overflow & (1 << 31);
  465. for (j = 0; j < PPMU_PMNCNT_MAX; j++) {
  466. data->dmc[i].count[j] = __raw_readl(
  467. ppmu_base + (0xf110 + (0x10 * j)));
  468. data->dmc[i].count_overflow[j] = overflow & (1 << j);
  469. }
  470. }
  471. busfreq_mon_reset(data);
  472. }
  473. static int exynos4x12_get_intspec(unsigned long mifclk)
  474. {
  475. int i = 0;
  476. while (exynos4x12_intclk_table[i].clk) {
  477. if (exynos4x12_intclk_table[i].clk <= mifclk)
  478. return i;
  479. i++;
  480. }
  481. return -EINVAL;
  482. }
  483. static int exynos4_bus_setvolt(struct busfreq_data *data,
  484. struct busfreq_opp_info *oppi,
  485. struct busfreq_opp_info *oldoppi)
  486. {
  487. int err = 0, tmp;
  488. unsigned long volt = oppi->volt;
  489. switch (data->type) {
  490. case TYPE_BUSF_EXYNOS4210:
  491. /* OPP represents DMC clock + INT voltage */
  492. err = regulator_set_voltage(data->vdd_int, volt,
  493. MAX_SAFEVOLT);
  494. break;
  495. case TYPE_BUSF_EXYNOS4x12:
  496. /* OPP represents MIF clock + MIF voltage */
  497. err = regulator_set_voltage(data->vdd_mif, volt,
  498. MAX_SAFEVOLT);
  499. if (err)
  500. break;
  501. tmp = exynos4x12_get_intspec(oppi->rate);
  502. if (tmp < 0) {
  503. err = tmp;
  504. regulator_set_voltage(data->vdd_mif,
  505. oldoppi->volt,
  506. MAX_SAFEVOLT);
  507. break;
  508. }
  509. err = regulator_set_voltage(data->vdd_int,
  510. exynos4x12_intclk_table[tmp].volt,
  511. MAX_SAFEVOLT);
  512. /* Try to recover */
  513. if (err)
  514. regulator_set_voltage(data->vdd_mif,
  515. oldoppi->volt,
  516. MAX_SAFEVOLT);
  517. break;
  518. default:
  519. err = -EINVAL;
  520. }
  521. return err;
  522. }
  523. static int exynos4_bus_target(struct device *dev, unsigned long *_freq,
  524. u32 flags)
  525. {
  526. int err = 0;
  527. struct platform_device *pdev = container_of(dev, struct platform_device,
  528. dev);
  529. struct busfreq_data *data = platform_get_drvdata(pdev);
  530. struct opp *opp;
  531. unsigned long freq;
  532. unsigned long old_freq = data->curr_oppinfo.rate;
  533. struct busfreq_opp_info new_oppinfo;
  534. rcu_read_lock();
  535. opp = devfreq_recommended_opp(dev, _freq, flags);
  536. if (IS_ERR(opp)) {
  537. rcu_read_unlock();
  538. return PTR_ERR(opp);
  539. }
  540. new_oppinfo.rate = opp_get_freq(opp);
  541. new_oppinfo.volt = opp_get_voltage(opp);
  542. rcu_read_unlock();
  543. freq = new_oppinfo.rate;
  544. if (old_freq == freq)
  545. return 0;
  546. dev_dbg(dev, "targetting %lukHz %luuV\n", freq, new_oppinfo.volt);
  547. mutex_lock(&data->lock);
  548. if (data->disabled)
  549. goto out;
  550. if (old_freq < freq)
  551. err = exynos4_bus_setvolt(data, &new_oppinfo,
  552. &data->curr_oppinfo);
  553. if (err)
  554. goto out;
  555. if (old_freq != freq) {
  556. switch (data->type) {
  557. case TYPE_BUSF_EXYNOS4210:
  558. err = exynos4210_set_busclk(data, &new_oppinfo);
  559. break;
  560. case TYPE_BUSF_EXYNOS4x12:
  561. err = exynos4x12_set_busclk(data, &new_oppinfo);
  562. break;
  563. default:
  564. err = -EINVAL;
  565. }
  566. }
  567. if (err)
  568. goto out;
  569. if (old_freq > freq)
  570. err = exynos4_bus_setvolt(data, &new_oppinfo,
  571. &data->curr_oppinfo);
  572. if (err)
  573. goto out;
  574. data->curr_oppinfo = new_oppinfo;
  575. out:
  576. mutex_unlock(&data->lock);
  577. return err;
  578. }
  579. static int exynos4_get_busier_dmc(struct busfreq_data *data)
  580. {
  581. u64 p0 = data->dmc[0].count[0];
  582. u64 p1 = data->dmc[1].count[0];
  583. p0 *= data->dmc[1].ccnt;
  584. p1 *= data->dmc[0].ccnt;
  585. if (data->dmc[1].ccnt == 0)
  586. return 0;
  587. if (p0 > p1)
  588. return 0;
  589. return 1;
  590. }
  591. static int exynos4_bus_get_dev_status(struct device *dev,
  592. struct devfreq_dev_status *stat)
  593. {
  594. struct busfreq_data *data = dev_get_drvdata(dev);
  595. int busier_dmc;
  596. int cycles_x2 = 2; /* 2 x cycles */
  597. void __iomem *addr;
  598. u32 timing;
  599. u32 memctrl;
  600. exynos4_read_ppmu(data);
  601. busier_dmc = exynos4_get_busier_dmc(data);
  602. stat->current_frequency = data->curr_oppinfo.rate;
  603. if (busier_dmc)
  604. addr = S5P_VA_DMC1;
  605. else
  606. addr = S5P_VA_DMC0;
  607. memctrl = __raw_readl(addr + 0x04); /* one of DDR2/3/LPDDR2 */
  608. timing = __raw_readl(addr + 0x38); /* CL or WL/RL values */
  609. switch ((memctrl >> 8) & 0xf) {
  610. case 0x4: /* DDR2 */
  611. cycles_x2 = ((timing >> 16) & 0xf) * 2;
  612. break;
  613. case 0x5: /* LPDDR2 */
  614. case 0x6: /* DDR3 */
  615. cycles_x2 = ((timing >> 8) & 0xf) + ((timing >> 0) & 0xf);
  616. break;
  617. default:
  618. pr_err("%s: Unknown Memory Type(%d).\n", __func__,
  619. (memctrl >> 8) & 0xf);
  620. return -EINVAL;
  621. }
  622. /* Number of cycles spent on memory access */
  623. stat->busy_time = data->dmc[busier_dmc].count[0] / 2 * (cycles_x2 + 2);
  624. stat->busy_time *= 100 / BUS_SATURATION_RATIO;
  625. stat->total_time = data->dmc[busier_dmc].ccnt;
  626. /* If the counters have overflown, retry */
  627. if (data->dmc[busier_dmc].ccnt_overflow ||
  628. data->dmc[busier_dmc].count_overflow[0])
  629. return -EAGAIN;
  630. return 0;
  631. }
  632. static void exynos4_bus_exit(struct device *dev)
  633. {
  634. struct busfreq_data *data = dev_get_drvdata(dev);
  635. devfreq_unregister_opp_notifier(dev, data->devfreq);
  636. }
  637. static struct devfreq_dev_profile exynos4_devfreq_profile = {
  638. .initial_freq = 400000,
  639. .polling_ms = 50,
  640. .target = exynos4_bus_target,
  641. .get_dev_status = exynos4_bus_get_dev_status,
  642. .exit = exynos4_bus_exit,
  643. };
  644. static int exynos4210_init_tables(struct busfreq_data *data)
  645. {
  646. u32 tmp;
  647. int mgrp;
  648. int i, err = 0;
  649. tmp = __raw_readl(EXYNOS4_CLKDIV_DMC0);
  650. for (i = LV_0; i < EX4210_LV_NUM; i++) {
  651. tmp &= ~(EXYNOS4_CLKDIV_DMC0_ACP_MASK |
  652. EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK |
  653. EXYNOS4_CLKDIV_DMC0_DPHY_MASK |
  654. EXYNOS4_CLKDIV_DMC0_DMC_MASK |
  655. EXYNOS4_CLKDIV_DMC0_DMCD_MASK |
  656. EXYNOS4_CLKDIV_DMC0_DMCP_MASK |
  657. EXYNOS4_CLKDIV_DMC0_COPY2_MASK |
  658. EXYNOS4_CLKDIV_DMC0_CORETI_MASK);
  659. tmp |= ((exynos4210_clkdiv_dmc0[i][0] <<
  660. EXYNOS4_CLKDIV_DMC0_ACP_SHIFT) |
  661. (exynos4210_clkdiv_dmc0[i][1] <<
  662. EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT) |
  663. (exynos4210_clkdiv_dmc0[i][2] <<
  664. EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT) |
  665. (exynos4210_clkdiv_dmc0[i][3] <<
  666. EXYNOS4_CLKDIV_DMC0_DMC_SHIFT) |
  667. (exynos4210_clkdiv_dmc0[i][4] <<
  668. EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT) |
  669. (exynos4210_clkdiv_dmc0[i][5] <<
  670. EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT) |
  671. (exynos4210_clkdiv_dmc0[i][6] <<
  672. EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT) |
  673. (exynos4210_clkdiv_dmc0[i][7] <<
  674. EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT));
  675. data->dmc_divtable[i] = tmp;
  676. }
  677. tmp = __raw_readl(EXYNOS4_CLKDIV_TOP);
  678. for (i = LV_0; i < EX4210_LV_NUM; i++) {
  679. tmp &= ~(EXYNOS4_CLKDIV_TOP_ACLK200_MASK |
  680. EXYNOS4_CLKDIV_TOP_ACLK100_MASK |
  681. EXYNOS4_CLKDIV_TOP_ACLK160_MASK |
  682. EXYNOS4_CLKDIV_TOP_ACLK133_MASK |
  683. EXYNOS4_CLKDIV_TOP_ONENAND_MASK);
  684. tmp |= ((exynos4210_clkdiv_top[i][0] <<
  685. EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT) |
  686. (exynos4210_clkdiv_top[i][1] <<
  687. EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT) |
  688. (exynos4210_clkdiv_top[i][2] <<
  689. EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT) |
  690. (exynos4210_clkdiv_top[i][3] <<
  691. EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT) |
  692. (exynos4210_clkdiv_top[i][4] <<
  693. EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT));
  694. data->top_divtable[i] = tmp;
  695. }
  696. #ifdef CONFIG_EXYNOS_ASV
  697. tmp = exynos4_result_of_asv;
  698. #else
  699. tmp = 0; /* Max voltages for the reliability of the unknown */
  700. #endif
  701. pr_debug("ASV Group of Exynos4 is %d\n", tmp);
  702. /* Use merged grouping for voltage */
  703. switch (tmp) {
  704. case 0:
  705. mgrp = 0;
  706. break;
  707. case 1:
  708. case 2:
  709. mgrp = 1;
  710. break;
  711. case 3:
  712. case 4:
  713. mgrp = 2;
  714. break;
  715. case 5:
  716. case 6:
  717. mgrp = 3;
  718. break;
  719. case 7:
  720. mgrp = 4;
  721. break;
  722. default:
  723. pr_warn("Unknown ASV Group. Use max voltage.\n");
  724. mgrp = 0;
  725. }
  726. for (i = LV_0; i < EX4210_LV_NUM; i++)
  727. exynos4210_busclk_table[i].volt = exynos4210_asv_volt[mgrp][i];
  728. for (i = LV_0; i < EX4210_LV_NUM; i++) {
  729. err = opp_add(data->dev, exynos4210_busclk_table[i].clk,
  730. exynos4210_busclk_table[i].volt);
  731. if (err) {
  732. dev_err(data->dev, "Cannot add opp entries.\n");
  733. return err;
  734. }
  735. }
  736. return 0;
  737. }
  738. static int exynos4x12_init_tables(struct busfreq_data *data)
  739. {
  740. unsigned int i;
  741. unsigned int tmp;
  742. int ret;
  743. /* Enable pause function for DREX2 DVFS */
  744. tmp = __raw_readl(EXYNOS4_DMC_PAUSE_CTRL);
  745. tmp |= EXYNOS4_DMC_PAUSE_ENABLE;
  746. __raw_writel(tmp, EXYNOS4_DMC_PAUSE_CTRL);
  747. tmp = __raw_readl(EXYNOS4_CLKDIV_DMC0);
  748. for (i = 0; i < EX4x12_LV_NUM; i++) {
  749. tmp &= ~(EXYNOS4_CLKDIV_DMC0_ACP_MASK |
  750. EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK |
  751. EXYNOS4_CLKDIV_DMC0_DPHY_MASK |
  752. EXYNOS4_CLKDIV_DMC0_DMC_MASK |
  753. EXYNOS4_CLKDIV_DMC0_DMCD_MASK |
  754. EXYNOS4_CLKDIV_DMC0_DMCP_MASK);
  755. tmp |= ((exynos4x12_clkdiv_dmc0[i][0] <<
  756. EXYNOS4_CLKDIV_DMC0_ACP_SHIFT) |
  757. (exynos4x12_clkdiv_dmc0[i][1] <<
  758. EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT) |
  759. (exynos4x12_clkdiv_dmc0[i][2] <<
  760. EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT) |
  761. (exynos4x12_clkdiv_dmc0[i][3] <<
  762. EXYNOS4_CLKDIV_DMC0_DMC_SHIFT) |
  763. (exynos4x12_clkdiv_dmc0[i][4] <<
  764. EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT) |
  765. (exynos4x12_clkdiv_dmc0[i][5] <<
  766. EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT));
  767. data->dmc_divtable[i] = tmp;
  768. }
  769. #ifdef CONFIG_EXYNOS_ASV
  770. tmp = exynos4_result_of_asv;
  771. #else
  772. tmp = 0; /* Max voltages for the reliability of the unknown */
  773. #endif
  774. if (tmp > 8)
  775. tmp = 0;
  776. pr_debug("ASV Group of Exynos4x12 is %d\n", tmp);
  777. for (i = 0; i < EX4x12_LV_NUM; i++) {
  778. exynos4x12_mifclk_table[i].volt =
  779. exynos4x12_mif_step_50[tmp][i];
  780. exynos4x12_intclk_table[i].volt =
  781. exynos4x12_int_volt[tmp][i];
  782. }
  783. for (i = 0; i < EX4x12_LV_NUM; i++) {
  784. ret = opp_add(data->dev, exynos4x12_mifclk_table[i].clk,
  785. exynos4x12_mifclk_table[i].volt);
  786. if (ret) {
  787. dev_err(data->dev, "Fail to add opp entries.\n");
  788. return ret;
  789. }
  790. }
  791. return 0;
  792. }
  793. static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,
  794. unsigned long event, void *ptr)
  795. {
  796. struct busfreq_data *data = container_of(this, struct busfreq_data,
  797. pm_notifier);
  798. struct opp *opp;
  799. struct busfreq_opp_info new_oppinfo;
  800. unsigned long maxfreq = ULONG_MAX;
  801. int err = 0;
  802. switch (event) {
  803. case PM_SUSPEND_PREPARE:
  804. /* Set Fastest and Deactivate DVFS */
  805. mutex_lock(&data->lock);
  806. data->disabled = true;
  807. rcu_read_lock();
  808. opp = opp_find_freq_floor(data->dev, &maxfreq);
  809. if (IS_ERR(opp)) {
  810. rcu_read_unlock();
  811. dev_err(data->dev, "%s: unable to find a min freq\n",
  812. __func__);
  813. return PTR_ERR(opp);
  814. }
  815. new_oppinfo.rate = opp_get_freq(opp);
  816. new_oppinfo.volt = opp_get_voltage(opp);
  817. rcu_read_unlock();
  818. err = exynos4_bus_setvolt(data, &new_oppinfo,
  819. &data->curr_oppinfo);
  820. if (err)
  821. goto unlock;
  822. switch (data->type) {
  823. case TYPE_BUSF_EXYNOS4210:
  824. err = exynos4210_set_busclk(data, &new_oppinfo);
  825. break;
  826. case TYPE_BUSF_EXYNOS4x12:
  827. err = exynos4x12_set_busclk(data, &new_oppinfo);
  828. break;
  829. default:
  830. err = -EINVAL;
  831. }
  832. if (err)
  833. goto unlock;
  834. data->curr_oppinfo = new_oppinfo;
  835. unlock:
  836. mutex_unlock(&data->lock);
  837. if (err)
  838. return err;
  839. return NOTIFY_OK;
  840. case PM_POST_RESTORE:
  841. case PM_POST_SUSPEND:
  842. /* Reactivate */
  843. mutex_lock(&data->lock);
  844. data->disabled = false;
  845. mutex_unlock(&data->lock);
  846. return NOTIFY_OK;
  847. }
  848. return NOTIFY_DONE;
  849. }
  850. static __devinit int exynos4_busfreq_probe(struct platform_device *pdev)
  851. {
  852. struct busfreq_data *data;
  853. struct opp *opp;
  854. struct device *dev = &pdev->dev;
  855. int err = 0;
  856. data = devm_kzalloc(&pdev->dev, sizeof(struct busfreq_data), GFP_KERNEL);
  857. if (data == NULL) {
  858. dev_err(dev, "Cannot allocate memory.\n");
  859. return -ENOMEM;
  860. }
  861. data->type = pdev->id_entry->driver_data;
  862. data->dmc[0].hw_base = S5P_VA_DMC0;
  863. data->dmc[1].hw_base = S5P_VA_DMC1;
  864. data->pm_notifier.notifier_call = exynos4_busfreq_pm_notifier_event;
  865. data->dev = dev;
  866. mutex_init(&data->lock);
  867. switch (data->type) {
  868. case TYPE_BUSF_EXYNOS4210:
  869. err = exynos4210_init_tables(data);
  870. break;
  871. case TYPE_BUSF_EXYNOS4x12:
  872. err = exynos4x12_init_tables(data);
  873. break;
  874. default:
  875. dev_err(dev, "Cannot determine the device id %d\n", data->type);
  876. err = -EINVAL;
  877. }
  878. if (err)
  879. return err;
  880. data->vdd_int = devm_regulator_get(dev, "vdd_int");
  881. if (IS_ERR(data->vdd_int)) {
  882. dev_err(dev, "Cannot get the regulator \"vdd_int\"\n");
  883. return PTR_ERR(data->vdd_int);
  884. }
  885. if (data->type == TYPE_BUSF_EXYNOS4x12) {
  886. data->vdd_mif = devm_regulator_get(dev, "vdd_mif");
  887. if (IS_ERR(data->vdd_mif)) {
  888. dev_err(dev, "Cannot get the regulator \"vdd_mif\"\n");
  889. return PTR_ERR(data->vdd_mif);
  890. }
  891. }
  892. rcu_read_lock();
  893. opp = opp_find_freq_floor(dev, &exynos4_devfreq_profile.initial_freq);
  894. if (IS_ERR(opp)) {
  895. rcu_read_unlock();
  896. dev_err(dev, "Invalid initial frequency %lu kHz.\n",
  897. exynos4_devfreq_profile.initial_freq);
  898. return PTR_ERR(opp);
  899. }
  900. data->curr_oppinfo.rate = opp_get_freq(opp);
  901. data->curr_oppinfo.volt = opp_get_voltage(opp);
  902. rcu_read_unlock();
  903. platform_set_drvdata(pdev, data);
  904. busfreq_mon_reset(data);
  905. data->devfreq = devfreq_add_device(dev, &exynos4_devfreq_profile,
  906. "simple_ondemand", NULL);
  907. if (IS_ERR(data->devfreq))
  908. return PTR_ERR(data->devfreq);
  909. devfreq_register_opp_notifier(dev, data->devfreq);
  910. err = register_pm_notifier(&data->pm_notifier);
  911. if (err) {
  912. dev_err(dev, "Failed to setup pm notifier\n");
  913. devfreq_remove_device(data->devfreq);
  914. return err;
  915. }
  916. return 0;
  917. }
  918. static __devexit int exynos4_busfreq_remove(struct platform_device *pdev)
  919. {
  920. struct busfreq_data *data = platform_get_drvdata(pdev);
  921. unregister_pm_notifier(&data->pm_notifier);
  922. devfreq_remove_device(data->devfreq);
  923. return 0;
  924. }
  925. static int exynos4_busfreq_resume(struct device *dev)
  926. {
  927. struct busfreq_data *data = dev_get_drvdata(dev);
  928. busfreq_mon_reset(data);
  929. return 0;
  930. }
  931. static const struct dev_pm_ops exynos4_busfreq_pm = {
  932. .resume = exynos4_busfreq_resume,
  933. };
  934. static const struct platform_device_id exynos4_busfreq_id[] = {
  935. { "exynos4210-busfreq", TYPE_BUSF_EXYNOS4210 },
  936. { "exynos4412-busfreq", TYPE_BUSF_EXYNOS4x12 },
  937. { "exynos4212-busfreq", TYPE_BUSF_EXYNOS4x12 },
  938. { },
  939. };
  940. static struct platform_driver exynos4_busfreq_driver = {
  941. .probe = exynos4_busfreq_probe,
  942. .remove = __devexit_p(exynos4_busfreq_remove),
  943. .id_table = exynos4_busfreq_id,
  944. .driver = {
  945. .name = "exynos4-busfreq",
  946. .owner = THIS_MODULE,
  947. .pm = &exynos4_busfreq_pm,
  948. },
  949. };
  950. static int __init exynos4_busfreq_init(void)
  951. {
  952. return platform_driver_register(&exynos4_busfreq_driver);
  953. }
  954. late_initcall(exynos4_busfreq_init);
  955. static void __exit exynos4_busfreq_exit(void)
  956. {
  957. platform_driver_unregister(&exynos4_busfreq_driver);
  958. }
  959. module_exit(exynos4_busfreq_exit);
  960. MODULE_LICENSE("GPL");
  961. MODULE_DESCRIPTION("EXYNOS4 busfreq driver with devfreq framework");
  962. MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");