1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
|
/*
* UFS Host Controller driver for Exynos specific extensions
*
* Copyright (C) 2013-2014 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/clk.h>
#include <linux/smc.h>
#include <soc/samsung/exynos-pm.h>
#include <soc/samsung/exynos-powermode.h>
#include "ufshcd.h"
#include "unipro.h"
#include "mphy.h"
#include "ufshcd-pltfrm.h"
#include "ufs-exynos.h"
#include <crypto/fmp.h>
#include "ufs-exynos-fmp.h"
#include "ufs-exynos-smu.h"
/*
* Unipro attribute value
*/
#define TXTRAILINGCLOCKS 0x10
#define TACTIVATE_10_USEC 400 /* unit: 10us */
/* Device ID */
#define DEV_ID 0x00
#define PEER_DEV_ID 0x01
#define PEER_CPORT_ID 0x00
#define TRAFFIC_CLASS 0x00
#define IATOVAL_NSEC 20000 /* unit: ns */
/* UFS CAL interface */
/*
* Debugging information, SFR/attributes/misc
*/
static struct exynos_ufs *ufs_host_backup[1];
static int ufs_host_index = 0;
static struct exynos_ufs_sfr_log ufs_log_std_sfr[] = {
{"CAPABILITIES" , REG_CONTROLLER_CAPABILITIES, 0},
{"UFS VERSION" , REG_UFS_VERSION, 0},
{"PRODUCT ID" , REG_CONTROLLER_DEV_ID, 0},
{"MANUFACTURE ID" , REG_CONTROLLER_PROD_ID, 0},
{"INTERRUPT STATUS" , REG_INTERRUPT_STATUS, 0},
{"INTERRUPT ENABLE" , REG_INTERRUPT_ENABLE, 0},
{"CONTROLLER STATUS" , REG_CONTROLLER_STATUS, 0},
{"CONTROLLER ENABLE" , REG_CONTROLLER_ENABLE, 0},
{"UTP TRANSF REQ INT AGG CNTRL" , REG_UTP_TRANSFER_REQ_INT_AGG_CONTROL, 0},
{"UTP TRANSF REQ LIST BASE L" , REG_UTP_TRANSFER_REQ_LIST_BASE_L, 0},
{"UTP TRANSF REQ LIST BASE H" , REG_UTP_TRANSFER_REQ_LIST_BASE_H, 0},
{"UTP TRANSF REQ DOOR BELL" , REG_UTP_TRANSFER_REQ_DOOR_BELL, 0},
{"UTP TRANSF REQ LIST CLEAR" , REG_UTP_TRANSFER_REQ_LIST_CLEAR, 0},
{"UTP TRANSF REQ LIST RUN STOP" , REG_UTP_TRANSFER_REQ_LIST_RUN_STOP, 0},
{"UTP TASK REQ LIST BASE L" , REG_UTP_TASK_REQ_LIST_BASE_L, 0},
{"UTP TASK REQ LIST BASE H" , REG_UTP_TASK_REQ_LIST_BASE_H, 0},
{"UTP TASK REQ DOOR BELL" , REG_UTP_TASK_REQ_DOOR_BELL, 0},
{"UTP TASK REQ LIST CLEAR" , REG_UTP_TASK_REQ_LIST_CLEAR, 0},
{"UTP TASK REQ LIST RUN STOP" , REG_UTP_TASK_REQ_LIST_RUN_STOP, 0},
{"UIC COMMAND" , REG_UIC_COMMAND, 0},
{"UIC COMMAND ARG1" , REG_UIC_COMMAND_ARG_1, 0},
{"UIC COMMAND ARG2" , REG_UIC_COMMAND_ARG_2, 0},
{"UIC COMMAND ARG3" , REG_UIC_COMMAND_ARG_3, 0},
{},
};
/* Helper for UFS CAL interface */
static inline int ufs_init_cal(struct exynos_ufs *ufs, int idx,
struct platform_device *pdev)
{
int ret = 0;
struct device *dev = &pdev->dev;
struct ufs_cal_param *p = NULL;
p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL);
if (!p) {
dev_err(ufs->dev, "cannot allocate mem for cal param\n");
return -ENOMEM;
}
ufs->cal_param = p;
p->host = ufs;
p->board = 0; /* ken: need a dt node for board */
if ((ret = ufs_cal_init(p, idx)) != UFS_CAL_NO_ERROR) {
dev_err(ufs->dev, "ufs_init_cal = %d!!!\n", ret);
return -EPERM;
}
return 0;
}
static inline int ufs_pre_link(struct exynos_ufs *ufs)
{
int ret = 0;
struct ufs_cal_param *p = ufs->cal_param;
p->mclk_rate = ufs->mclk_rate;
p->target_lane = ufs->num_rx_lanes;
p->available_lane = ufs->num_rx_lanes;
if ((ret = ufs_cal_pre_link(p)) != UFS_CAL_NO_ERROR) {
dev_err(ufs->dev, "ufs_pre_link = %d!!!\n", ret);
return -EPERM;
}
return 0;
}
static inline int ufs_post_link(struct exynos_ufs *ufs)
{
int ret = 0;
if ((ret = ufs_cal_post_link(ufs->cal_param)) != UFS_CAL_NO_ERROR) {
dev_err(ufs->dev, "ufs_post_link = %d!!!\n", ret);
return -EPERM;
}
return 0;
}
static inline int ufs_pre_gear_change(struct exynos_ufs *ufs,
struct uic_pwr_mode *pmd)
{
struct ufs_cal_param *p = ufs->cal_param;
int ret = 0;
p->pmd = pmd;
p->target_lane = pmd->lane;
if ((ret = ufs_cal_pre_pmc(p)) != UFS_CAL_NO_ERROR) {
dev_err(ufs->dev, "ufs_pre_gear_change = %d!!!\n", ret);
return -EPERM;
}
return 0;
}
static inline int ufs_post_gear_change(struct exynos_ufs *ufs)
{
int ret = 0;
if ((ret = ufs_cal_post_pmc(ufs->cal_param)) != UFS_CAL_NO_ERROR) {
dev_err(ufs->dev, "ufs_post_gear_change = %d!!!\n", ret);
return -EPERM;
}
return 0;
}
static inline int ufs_post_h8_enter(struct exynos_ufs *ufs)
{
int ret = 0;
if ((ret = ufs_cal_post_h8_enter(ufs->cal_param)) != UFS_CAL_NO_ERROR) {
dev_err(ufs->dev, "ufs_post_h8_enter = %d!!!\n", ret);
return -EPERM;
}
return 0;
}
static inline int ufs_pre_h8_exit(struct exynos_ufs *ufs)
{
int ret = 0;
if ((ret = ufs_cal_pre_h8_exit(ufs->cal_param)) != UFS_CAL_NO_ERROR) {
dev_err(ufs->dev, "ufs_pre_h8_exit = %d!!!\n", ret);
return -EPERM;
}
return 0;
}
/* Adaptor for UFS CAL */
void ufs_lld_dme_set(void *h, u32 addr, u32 val)
{
ufshcd_dme_set(((struct exynos_ufs *)h)->hba, addr, val);
}
void ufs_lld_dme_get(void *h, u32 addr, u32 *val)
{
ufshcd_dme_get(((struct exynos_ufs *)h)->hba, addr, val);
}
void ufs_lld_dme_peer_set(void *h, u32 addr, u32 val)
{
ufshcd_dme_peer_set(((struct exynos_ufs *)h)->hba, addr, val);
}
void ufs_lld_pma_write(void *h, u32 val, u32 addr)
{
phy_pma_writel((struct exynos_ufs *)h, val, addr);
}
u32 ufs_lld_pma_read(void *h, u32 addr)
{
return phy_pma_readl((struct exynos_ufs *)h, addr);
}
void ufs_lld_unipro_write(void *h, u32 val, u32 addr)
{
unipro_writel((struct exynos_ufs *)h, val, addr);
}
void ufs_lld_udelay(u32 val)
{
udelay(val);
}
void ufs_lld_usleep_delay(u32 min, u32 max)
{
usleep_range(min, max);
}
unsigned long ufs_lld_get_time_count(unsigned long offset)
{
return jiffies;
}
unsigned long ufs_lld_calc_timeout(const unsigned int ms)
{
return msecs_to_jiffies(ms);
}
static inline void exynos_ufs_ctrl_phy_pwr(struct exynos_ufs *ufs, bool en)
{
u32 reg;
reg = readl(ufs->phy.reg_pmu);
if (en)
writel(reg | BIT(0), ufs->phy.reg_pmu);
else
writel(reg & ~(BIT(0)), ufs->phy.reg_pmu);
}
#ifndef __EXYNOS_UFS_VS_DEBUG__
static void exynos_ufs_dump_std_sfr(struct ufs_hba *hba)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
struct exynos_ufs_sfr_log* cfg = ufs->debug.std_sfr;
dev_err(hba->dev, ": --------------------------------------------------- \n");
dev_err(hba->dev, ": \t\tREGISTER DUMP\n");
dev_err(hba->dev, ": --------------------------------------------------- \n");
while(cfg) {
if (!cfg->name)
break;
cfg->val = ufshcd_readl(hba, cfg->offset);
/* Dump */
dev_err(hba->dev, ": %s(0x%04x):\t\t\t\t0x%08x\n",
cfg->name, cfg->offset, cfg->val);
/* Next SFR */
cfg++;
}
}
#endif
/*
* Exynos debugging main function
*/
static void exynos_ufs_dump_debug_info(struct ufs_hba *hba)
{
#ifdef __EXYNOS_UFS_VS_DEBUG__
exynos_ufs_get_uic_info(hba);
#else
exynos_ufs_dump_std_sfr(hba);
#endif
#if defined(CONFIG_SCSI_UFS_TEST_MODE)
exynos_ufs_show_uic_info(hba);
/* do not recover system if test mode is enabled */
BUG();
#endif
}
static void exynos_ufs_select_refclk(struct exynos_ufs *ufs, bool en)
{
u32 reg;
if (ufs->hw_rev != UFS_VER_0004)
return;
/*
* true : alternative clock path, false : active clock path
*/
reg = hci_readl(ufs, HCI_MPHY_REFCLK_SEL);
if (en)
hci_writel(ufs, reg | MPHY_REFCLK_SEL, HCI_MPHY_REFCLK_SEL);
else
hci_writel(ufs, reg & ~MPHY_REFCLK_SEL, HCI_MPHY_REFCLK_SEL);
}
inline void exynos_ufs_set_hwacg_control(struct exynos_ufs *ufs, bool en)
{
u32 reg;
if ((ufs->hw_rev != UFS_VER_0004) && (ufs->hw_rev != UFS_VER_0005))
return;
/*
* default value 1->0 at KC. so,
* need to set "1(disable HWACG)" during UFS init
*/
reg = hci_readl(ufs, HCI_UFS_ACG_DISABLE);
if (en)
hci_writel(ufs, reg & (~HCI_UFS_ACG_DISABLE_EN), HCI_UFS_ACG_DISABLE);
else
hci_writel(ufs, reg | HCI_UFS_ACG_DISABLE_EN, HCI_UFS_ACG_DISABLE);
}
inline void exynos_ufs_ctrl_auto_hci_clk(struct exynos_ufs *ufs, bool en)
{
u32 reg = hci_readl(ufs, HCI_FORCE_HCS);
if (en)
hci_writel(ufs, reg | HCI_CORECLK_STOP_EN, HCI_FORCE_HCS);
else
hci_writel(ufs, reg & ~HCI_CORECLK_STOP_EN, HCI_FORCE_HCS);
}
static inline void exynos_ufs_ctrl_clk(struct exynos_ufs *ufs, bool en)
{
u32 reg = hci_readl(ufs, HCI_FORCE_HCS);
if (en)
hci_writel(ufs, reg | CLK_STOP_CTRL_EN_ALL, HCI_FORCE_HCS);
else
hci_writel(ufs, reg & ~CLK_STOP_CTRL_EN_ALL, HCI_FORCE_HCS);
}
static inline void exynos_ufs_gate_clk(struct exynos_ufs *ufs, bool en)
{
u32 reg = hci_readl(ufs, HCI_CLKSTOP_CTRL);
if (en)
hci_writel(ufs, reg | CLK_STOP_ALL, HCI_CLKSTOP_CTRL);
else
hci_writel(ufs, reg & ~CLK_STOP_ALL, HCI_CLKSTOP_CTRL);
}
static void exynos_ufs_set_unipro_mclk(struct exynos_ufs *ufs)
{
ufs->mclk_rate = (u32)clk_get_rate(ufs->clk_unipro);
}
static void exynos_ufs_fit_aggr_timeout(struct exynos_ufs *ufs)
{
u32 cnt_val;
unsigned long nVal;
/* IA_TICK_SEL : 1(1us_TO_CNT_VAL) */
nVal = hci_readl(ufs, HCI_UFSHCI_V2P1_CTRL);
nVal |= IA_TICK_SEL;
hci_writel(ufs, nVal, HCI_UFSHCI_V2P1_CTRL);
cnt_val = ufs->mclk_rate / 1000000 ;
hci_writel(ufs, cnt_val & CNT_VAL_1US_MASK, HCI_1US_TO_CNT_VAL);
}
static void exynos_ufs_init_pmc_req(struct ufs_hba *hba,
struct ufs_pa_layer_attr *pwr_max,
struct ufs_pa_layer_attr *pwr_req)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
struct uic_pwr_mode *req_pmd = &ufs->req_pmd_parm;
struct uic_pwr_mode *act_pmd = &ufs->act_pmd_parm;
/* update lane variable after link */
ufs->num_rx_lanes = pwr_max->lane_rx;
ufs->num_tx_lanes = pwr_max->lane_tx;
pwr_req->gear_rx
= act_pmd->gear= min_t(u8, pwr_max->gear_rx, req_pmd->gear);
pwr_req->gear_tx
= act_pmd->gear = min_t(u8, pwr_max->gear_tx, req_pmd->gear);
pwr_req->lane_rx
= act_pmd->lane = min_t(u8, pwr_max->lane_rx, req_pmd->lane);
pwr_req->lane_tx
= act_pmd->lane = min_t(u8, pwr_max->lane_tx, req_pmd->lane);
pwr_req->pwr_rx = act_pmd->mode = req_pmd->mode;
pwr_req->pwr_tx = act_pmd->mode = req_pmd->mode;
pwr_req->hs_rate = act_pmd->hs_series = req_pmd->hs_series;
}
static void exynos_ufs_config_intr(struct exynos_ufs *ufs, u32 errs, u8 index)
{
switch(index) {
case UNIP_PA_LYR:
hci_writel(ufs, DFES_ERR_EN | errs, HCI_ERROR_EN_PA_LAYER);
break;
case UNIP_DL_LYR:
hci_writel(ufs, DFES_ERR_EN | errs, HCI_ERROR_EN_DL_LAYER);
break;
case UNIP_N_LYR:
hci_writel(ufs, DFES_ERR_EN | errs, HCI_ERROR_EN_N_LAYER);
break;
case UNIP_T_LYR:
hci_writel(ufs, DFES_ERR_EN | errs, HCI_ERROR_EN_T_LAYER);
break;
case UNIP_DME_LYR:
hci_writel(ufs, DFES_ERR_EN | errs, HCI_ERROR_EN_DME_LAYER);
break;
}
}
static void exynos_ufs_dev_hw_reset(struct ufs_hba *hba)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
/* bit[1] for resetn */
hci_writel(ufs, 0 << 0, HCI_GPIO_OUT);
udelay(5);
hci_writel(ufs, 1 << 0, HCI_GPIO_OUT);
}
static void exynos_ufs_init_host(struct exynos_ufs *ufs)
{
u32 reg;
/* internal clock control */
exynos_ufs_ctrl_auto_hci_clk(ufs, false);
exynos_ufs_set_unipro_mclk(ufs);
/* period for interrupt aggregation */
exynos_ufs_fit_aggr_timeout(ufs);
/* misc HCI configurations */
hci_writel(ufs, 0xA, HCI_DATA_REORDER);
hci_writel(ufs, PRDT_PREFECT_EN | PRDT_SET_SIZE(12),
HCI_TXPRDT_ENTRY_SIZE);
hci_writel(ufs, PRDT_SET_SIZE(12), HCI_RXPRDT_ENTRY_SIZE);
hci_writel(ufs, 0xFFFFFFFF, HCI_UTRL_NEXUS_TYPE);
hci_writel(ufs, 0xFFFFFFFF, HCI_UTMRL_NEXUS_TYPE);
reg = hci_readl(ufs, HCI_AXIDMA_RWDATA_BURST_LEN) &
~BURST_LEN(0);
hci_writel(ufs, WLU_EN | BURST_LEN(3),
HCI_AXIDMA_RWDATA_BURST_LEN);
/*
* Enable HWAGC control by IOP
*
* default value 1->0 at KC.
* always "0"(controlled by UFS_ACG_DISABLE)
*/
reg = hci_readl(ufs, HCI_IOP_ACG_DISABLE);
hci_writel(ufs, reg & (~HCI_IOP_ACG_DISABLE_EN), HCI_IOP_ACG_DISABLE);
}
static void exynos_ufs_pre_hibern8(struct ufs_hba *hba, u8 enter)
{
}
static void exynos_ufs_post_hibern8(struct ufs_hba *hba, u8 enter)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
if (!enter) {
struct uic_pwr_mode *act_pmd = &ufs->act_pmd_parm;
u32 mode = 0;
ufshcd_dme_get(hba, UIC_ARG_MIB(PA_PWRMODE), &mode);
if (mode != (act_pmd->mode << 4 | act_pmd->mode)) {
dev_warn(hba->dev, "%s: power mode not matched, mode : 0x%x, act_mode : 0x%x\n",
__func__, mode, act_pmd->mode);
hba->pwr_info.pwr_rx = (mode >> 4) & 0xf;
hba->pwr_info.pwr_tx = mode & 0xf;
ufshcd_config_pwr_mode(hba, &hba->max_pwr_info.info);
}
}
}
static void exynos_ufs_modify_sysreg(struct exynos_ufs *ufs, int index)
{
struct exynos_ufs_sys *sys = &ufs->sys;
void __iomem *reg_sys = sys->reg_sys[index];
const char *const name[NUM_OF_SYSREG] = {
"ufs-io-coherency",
};
u32 reg;
if (!of_get_child_by_name(ufs->dev->of_node, name[index]))
return;
reg = readl(reg_sys);
writel((reg & ~(sys->mask[index])) | sys->bits[index], reg_sys);
}
static int exynos_ufs_init_system(struct exynos_ufs *ufs)
{
struct device *dev = ufs->dev;
int ret = 0;
/* PHY isolation bypass */
exynos_ufs_ctrl_phy_pwr(ufs, true);
/* IO cohernecy */
if (!of_get_child_by_name(dev->of_node, "ufs-io-coherency")) {
dev_err(dev, "Not configured to use IO coherency\n");
} else {
if (!of_find_property(dev->of_node, "dma-coherent", NULL))
BUG();
exynos_ufs_modify_sysreg(ufs, 0);
}
return ret;
}
static int exynos_ufs_get_clks(struct ufs_hba *hba)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
struct list_head *head = &hba->clk_list_head;
struct ufs_clk_info *clki;
ufs_host_backup[ufs_host_index++] = ufs;
ufs->debug.std_sfr = ufs_log_std_sfr;
if (!head || list_empty(head))
goto out;
list_for_each_entry(clki, head, list) {
if (!IS_ERR_OR_NULL(clki->clk)) {
if (!strcmp(clki->name, "GATE_UFS_EMBD"))
ufs->clk_hci = clki->clk;
if (!strcmp(clki->name, "UFS_EMBD")) {
ufs->clk_unipro = clki->clk;
}
}
}
out:
if (!ufs->clk_hci || !ufs->clk_unipro)
return -EINVAL;
return 0;
}
static void exynos_ufs_set_features(struct ufs_hba *hba, u32 hw_rev)
{
/* caps */
hba->caps = UFSHCD_CAP_CLK_GATING |
UFSHCD_CAP_HIBERN8_WITH_CLK_GATING |
UFSHCD_CAP_INTR_AGGR;
/* quirks of common driver */
hba->quirks = UFSHCD_QUIRK_PRDT_BYTE_GRAN |
UFSHCI_QUIRK_SKIP_INTR_AGGR |
UFSHCD_QUIRK_UNRESET_INTR_AGGR |
UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR;
hba->quirks |= UFSHCD_QUIRK_GET_UPMCRS_DIRECT |
UFSHCD_QUIRK_GET_GENERRCODE_DIRECT;
/* quirks of exynos-specific driver */
}
/*
* Exynos-specific callback functions
*
* init | Pure SW init & system-related init
* host_reset | Host SW reset & init
* pre_setup_clocks | specific power down
* setup_clocks | specific power up
* ...
*
* Initializations for software, host controller and system
* should be contained only in ->host_reset() as possible.
*/
static int exynos_ufs_init(struct ufs_hba *hba)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
int ret;
/* set features, such as caps or quirks */
exynos_ufs_set_features(hba, ufs->hw_rev);
/* get some clock sources and debug infomation structures */
ret = exynos_ufs_get_clks(hba);
if (ret)
return ret;
/* system init */
ret = exynos_ufs_init_system(ufs);
if (ret)
return ret;
ret = exynos_ufs_smu_get_dev(ufs);
if (ret == -EPROBE_DEFER) {
dev_err(ufs->dev, "%s: SMU device not probed yet (%d)\n",
__func__, ret);
return ret;
} else if (ret) {
dev_err(ufs->dev, "%s, Fail to get SMU device (%d)\n",
__func__, ret);
return ret;
}
/* FMPSECURITY & SMU */
exynos_ufs_smu_sec_cfg(ufs);
exynos_ufs_smu_init(ufs);
/* Enable log */
ret = exynos_ufs_init_dbg(hba);
if (ret)
return ret;
ufs->misc_flags = EXYNOS_UFS_MISC_TOGGLE_LOG;
return 0;
}
static void exynos_ufs_host_reset(struct ufs_hba *hba)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
unsigned long timeout = jiffies + msecs_to_jiffies(1);
exynos_ufs_ctrl_auto_hci_clk(ufs, false);
hci_writel(ufs, UFS_SW_RST_MASK, HCI_SW_RST);
do {
if (!(hci_readl(ufs, HCI_SW_RST) & UFS_SW_RST_MASK))
goto success;
} while (time_before(jiffies, timeout));
dev_err(ufs->dev, "timeout host sw-reset\n");
exynos_ufs_dump_uic_info(hba);
goto out;
success:
/* host init */
exynos_ufs_init_host(ufs);
/* device reset */
exynos_ufs_dev_hw_reset(hba);
/* secure log */
exynos_smc(SMC_CMD_UFS_LOG, 0, 0, 0);
out:
return;
}
static inline void exynos_ufs_dev_reset_ctrl(struct exynos_ufs *ufs, bool en)
{
if (en)
hci_writel(ufs, 1 << 0, HCI_GPIO_OUT);
else
hci_writel(ufs, 0 << 0, HCI_GPIO_OUT);
}
static int exynos_ufs_pre_setup_clocks(struct ufs_hba *hba, bool on)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
int ret = 0;
if (on) {
#ifdef CONFIG_CPU_IDLE
exynos_update_ip_idle_status(ufs->idle_ip_index, 0);
#endif
/*
* Now all used blocks would not be turned off in a host.
*/
exynos_ufs_ctrl_auto_hci_clk(ufs, false);
exynos_ufs_gate_clk(ufs, false);
/* HWAGC disable */
exynos_ufs_set_hwacg_control(ufs, false);
} else {
pm_qos_update_request(&ufs->pm_qos_fsys0, 0);
}
return ret;
}
static int exynos_ufs_setup_clocks(struct ufs_hba *hba, bool on)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
int ret = 0;
if (on) {
pm_qos_update_request(&ufs->pm_qos_fsys0, ufs->pm_qos_fsys0_value);
} else {
/*
* Now all used blocks would be turned off in a host.
*/
exynos_ufs_gate_clk(ufs, true);
exynos_ufs_ctrl_auto_hci_clk(ufs, true);
/* HWAGC enable */
exynos_ufs_set_hwacg_control(ufs, true);
#ifdef CONFIG_CPU_IDLE
exynos_update_ip_idle_status(ufs->idle_ip_index, 1);
#endif
}
return ret;
}
static int exynos_ufs_link_startup_notify(struct ufs_hba *hba,
enum ufs_notify_change_status status)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
int ret = 0;
switch (status) {
case PRE_CHANGE:
/* refer to hba */
ufs->hba = hba;
/* hci */
exynos_ufs_config_intr(ufs, DFES_DEF_DL_ERRS, UNIP_DL_LYR);
exynos_ufs_config_intr(ufs, DFES_DEF_N_ERRS, UNIP_N_LYR);
exynos_ufs_config_intr(ufs, DFES_DEF_T_ERRS, UNIP_T_LYR);
exynos_ufs_ctrl_clk(ufs, true);
exynos_ufs_select_refclk(ufs, true);
exynos_ufs_gate_clk(ufs, false);
exynos_ufs_set_hwacg_control(ufs, false);
if (ufs->num_rx_lanes == 0 || ufs->num_tx_lanes == 0) {
ufshcd_dme_get(hba, UIC_ARG_MIB(PA_AVAILRXDATALANES),
&ufs->num_rx_lanes);
ufshcd_dme_get(hba, UIC_ARG_MIB(PA_AVAILTXDATALANES),
&ufs->num_tx_lanes);
WARN(ufs->num_rx_lanes != ufs->num_tx_lanes,
"available data lane is not equal(rx:%d, tx:%d)\n",
ufs->num_rx_lanes, ufs->num_tx_lanes);
}
ufs->mclk_rate = clk_get_rate(ufs->clk_unipro);
ret = ufs_pre_link(ufs);
break;
case POST_CHANGE:
/* UIC configuration table after link startup */
ret = ufs_post_link(ufs);
break;
default:
break;
}
return ret;
}
static int exynos_ufs_pwr_change_notify(struct ufs_hba *hba,
enum ufs_notify_change_status status,
struct ufs_pa_layer_attr *pwr_max,
struct ufs_pa_layer_attr *pwr_req)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
struct uic_pwr_mode *act_pmd = &ufs->act_pmd_parm;
int ret = 0;
switch (status) {
case PRE_CHANGE:
/* Set PMC parameters to be requested */
exynos_ufs_init_pmc_req(hba, pwr_max, pwr_req);
/* UIC configuration table before power mode change */
ret = ufs_pre_gear_change(ufs, act_pmd);
break;
case POST_CHANGE:
/* UIC configuration table after power mode change */
ret = ufs_post_gear_change(ufs);
dev_info(ufs->dev,
"Power mode change(%d): M(%d)G(%d)L(%d)HS-series(%d)\n",
ret, act_pmd->mode, act_pmd->gear,
act_pmd->lane, act_pmd->hs_series);
break;
default:
break;
}
return ret;
}
static void exynos_ufs_set_nexus_t_xfer_req(struct ufs_hba *hba,
int tag, struct scsi_cmnd *cmd)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
u32 type;
type = hci_readl(ufs, HCI_UTRL_NEXUS_TYPE);
if (cmd)
type |= (1 << tag);
else
type &= ~(1 << tag);
hci_writel(ufs, type, HCI_UTRL_NEXUS_TYPE);
}
static void exynos_ufs_set_nexus_t_task_mgmt(struct ufs_hba *hba, int tag, u8 tm_func)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
u32 type;
type = hci_readl(ufs, HCI_UTMRL_NEXUS_TYPE);
switch (tm_func) {
case UFS_ABORT_TASK:
case UFS_QUERY_TASK:
type |= (1 << tag);
break;
case UFS_ABORT_TASK_SET:
case UFS_CLEAR_TASK_SET:
case UFS_LOGICAL_RESET:
case UFS_QUERY_TASK_SET:
type &= ~(1 << tag);
break;
}
hci_writel(ufs, type, HCI_UTMRL_NEXUS_TYPE);
}
static void exynos_ufs_hibern8_notify(struct ufs_hba *hba,
u8 enter, bool notify)
{
switch (notify) {
case PRE_CHANGE:
exynos_ufs_pre_hibern8(hba, enter);
break;
case POST_CHANGE:
exynos_ufs_post_hibern8(hba, enter);
break;
default:
break;
}
}
static int exynos_ufs_hibern8_prepare(struct ufs_hba *hba,
u8 enter, bool notify)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
int ret = 0;
switch (notify) {
case PRE_CHANGE:
if(!enter)
ret = ufs_pre_h8_exit(ufs);
break;
case POST_CHANGE:
if (enter)
ret = ufs_post_h8_enter(ufs);
break;
default:
break;
}
return ret;
}
static int __exynos_ufs_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
pm_qos_update_request(&ufs->pm_qos_fsys0, 0);
exynos_ufs_dev_reset_ctrl(ufs, false);
exynos_ufs_ctrl_phy_pwr(ufs, false);
return 0;
}
static int __exynos_ufs_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
int ret = 0;
exynos_ufs_ctrl_phy_pwr(ufs, true);
/* system init */
ret = exynos_ufs_init_system(ufs);
if (ret)
return ret;
if (ufshcd_is_clkgating_allowed(hba))
clk_prepare_enable(ufs->clk_hci);
exynos_ufs_ctrl_auto_hci_clk(ufs, false);
/* FMPSECURITY & SMU resume */
exynos_ufs_smu_sec_cfg(ufs);
exynos_ufs_smu_resume(ufs);
/* secure log */
exynos_smc(SMC_CMD_UFS_LOG, 0, 0, 0);
if (ufshcd_is_clkgating_allowed(hba))
clk_disable_unprepare(ufs->clk_hci);
return 0;
}
static u8 exynos_ufs_get_unipro_direct(struct ufs_hba *hba, int num)
{
u32 offset[] = {
UNIP_DME_LINKSTARTUP_CNF_RESULT,
UNIP_DME_HIBERN8_ENTER_CNF_RESULT,
UNIP_DME_HIBERN8_EXIT_CNF_RESULT,
UNIP_DME_PWR_IND_RESULT,
UNIP_DME_HIBERN8_ENTER_IND_RESULT,
UNIP_DME_HIBERN8_EXIT_IND_RESULT
};
struct exynos_ufs *ufs = to_exynos_ufs(hba);
return unipro_readl(ufs, offset[num]);
}
static int exynos_ufs_crypto_engine_cfg(struct ufs_hba *hba,
struct ufshcd_lrb *lrbp,
struct scatterlist *sg, int index,
int sector_offset)
{
return exynos_ufs_fmp_cfg(hba, lrbp, sg, index, sector_offset);
}
static int exynos_ufs_crypto_engine_clear(struct ufs_hba *hba,
struct ufshcd_lrb *lrbp)
{
return exynos_ufs_fmp_clear(hba, lrbp);
}
static int exynos_ufs_access_control_abort(struct ufs_hba *hba)
{
struct exynos_ufs *ufs = to_exynos_ufs(hba);
return exynos_ufs_smu_abort(ufs);
}
static struct ufs_hba_variant_ops exynos_ufs_ops = {
.init = exynos_ufs_init,
.host_reset = exynos_ufs_host_reset,
.pre_setup_clocks = exynos_ufs_pre_setup_clocks,
.setup_clocks = exynos_ufs_setup_clocks,
.link_startup_notify = exynos_ufs_link_startup_notify,
.pwr_change_notify = exynos_ufs_pwr_change_notify,
.set_nexus_t_xfer_req = exynos_ufs_set_nexus_t_xfer_req,
.set_nexus_t_task_mgmt = exynos_ufs_set_nexus_t_task_mgmt,
.hibern8_notify = exynos_ufs_hibern8_notify,
.hibern8_prepare = exynos_ufs_hibern8_prepare,
.dbg_register_dump = exynos_ufs_dump_debug_info,
.suspend = __exynos_ufs_suspend,
.resume = __exynos_ufs_resume,
.get_unipro_result = exynos_ufs_get_unipro_direct,
.crypto_engine_cfg = exynos_ufs_crypto_engine_cfg,
.crypto_engine_clear = exynos_ufs_crypto_engine_clear,
.access_control_abort = exynos_ufs_access_control_abort,
};
static int exynos_ufs_populate_dt_sys_per_feature(struct device *dev,
struct exynos_ufs *ufs, int index)
{
struct device_node *np;
struct exynos_ufs_sys *sys = &ufs->sys;
struct resource io_res;
int ret;
const char *const name[NUM_OF_SYSREG] = {
"ufs-io-coherency",
};
np = of_get_child_by_name(dev->of_node, name[index]);
if (!np) {
dev_err(dev, "failed to get ufs-sys node\n");
return -ENODEV;
}
ret = of_address_to_resource(np, 0, &io_res);
if (ret) {
dev_err(dev, "failed to get i/o address %s\n", name[index]);
if (ret == -EINVAL)
ret = 0;
} else {
sys->reg_sys[index] = devm_ioremap_resource(dev, &io_res);
if (IS_ERR(sys->reg_sys[index])) {
dev_err(dev, "failed to ioremap sysreg\n");
ret = -ENOMEM;
} else {
ret = of_property_read_u32(np, "mask",
&sys->mask[index]);
ret = of_property_read_u32(np, "bits",
&sys->bits[index]);
if (ret)
ret = -EINVAL;
}
}
of_node_put(np);
return ret;
}
static int exynos_ufs_populate_dt_sys(struct device *dev, struct exynos_ufs *ufs)
{
int i = 0;
int ret;
for (i = 0 ; i < NUM_OF_SYSREG ; i++) {
ret = exynos_ufs_populate_dt_sys_per_feature(dev, ufs, i);
if (ret && ret != -ENODEV)
break;
}
return ret;
}
static int exynos_ufs_populate_dt_phy(struct device *dev, struct exynos_ufs *ufs)
{
struct device_node *ufs_phy, *phy_sys;
struct exynos_ufs_phy *phy = &ufs->phy;
struct resource io_res;
int ret;
ufs_phy = of_get_child_by_name(dev->of_node, "ufs-phy");
if (!ufs_phy) {
dev_err(dev, "failed to get ufs-phy node\n");
return -ENODEV;
}
ret = of_address_to_resource(ufs_phy, 0, &io_res);
if (ret) {
dev_err(dev, "failed to get i/o address phy pma\n");
goto err_0;
}
phy->reg_pma = devm_ioremap_resource(dev, &io_res);
if (!phy->reg_pma) {
dev_err(dev, "failed to ioremap for phy pma\n");
ret = -ENOMEM;
goto err_0;
}
phy_sys = of_get_child_by_name(ufs_phy, "ufs-phy-sys");
if (!phy_sys) {
dev_err(dev, "failed to get ufs-phy-sys node\n");
ret = -ENODEV;
goto err_0;
}
ret = of_address_to_resource(phy_sys, 0, &io_res);
if (ret) {
dev_err(dev, "failed to get i/o address ufs-phy pmu\n");
goto err_1;
}
phy->reg_pmu = devm_ioremap_resource(dev, &io_res);
if (!phy->reg_pmu) {
dev_err(dev, "failed to ioremap for ufs-phy pmu\n");
ret = -ENOMEM;
}
err_1:
of_node_put(phy_sys);
err_0:
of_node_put(ufs_phy);
return ret;
}
static int exynos_ufs_get_pwr_mode(struct device_node *np,
struct exynos_ufs *ufs)
{
struct uic_pwr_mode *pmd = &ufs->req_pmd_parm;
pmd->mode = FAST_MODE;
if (of_property_read_u8(np, "ufs,pmd-attr-lane", &pmd->lane))
pmd->lane = 1;
if (of_property_read_u8(np, "ufs,pmd-attr-gear", &pmd->gear))
pmd->gear = 1;
pmd->hs_series = PA_HS_MODE_B;
return 0;
}
static int exynos_ufs_populate_dt(struct device *dev, struct exynos_ufs *ufs)
{
struct device_node *np = dev->of_node;
int ret;
/* Get exynos-specific version for featuring */
if (of_property_read_u32(np, "hw-rev", &ufs->hw_rev))
ufs->hw_rev = UFS_VER_0004;
ret = exynos_ufs_populate_dt_phy(dev, ufs);
if (ret) {
dev_err(dev, "failed to populate dt-phy\n");
goto out;
}
ret = exynos_ufs_populate_dt_sys(dev, ufs);
if (ret)
dev_err(dev, "failed to populate ufs-sys\n");
exynos_ufs_get_pwr_mode(np, ufs);
if (of_property_read_u8(np, "brd-for-cal", &ufs->cal_param->board))
ufs->cal_param->board = 0;
if (of_property_read_u32(np, "ufs-pm-qos-int", &ufs->pm_qos_int_value))
ufs->pm_qos_int_value = 0;
if (of_property_read_u32(np, "ufs-pm-qos-fsys0", &ufs->pm_qos_fsys0_value))
ufs->pm_qos_fsys0_value = 0;
out:
return ret;
}
static u64 exynos_ufs_dma_mask = DMA_BIT_MASK(32);
static int exynos_ufs_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct exynos_ufs *ufs;
struct resource *res;
int ret;
ufs = devm_kzalloc(dev, sizeof(*ufs), GFP_KERNEL);
if (!ufs) {
dev_err(dev, "cannot allocate mem for exynos-ufs\n");
return -ENOMEM;
}
/* exynos-specific hci */
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
ufs->reg_hci = devm_ioremap_resource(dev, res);
if (!ufs->reg_hci) {
dev_err(dev, "cannot ioremap for hci vendor register\n");
return -ENOMEM;
}
/* unipro */
res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
ufs->reg_unipro = devm_ioremap_resource(dev, res);
if (!ufs->reg_unipro) {
dev_err(dev, "cannot ioremap for unipro register\n");
return -ENOMEM;
}
/* ufs protector */
res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
ufs->reg_ufsp = devm_ioremap_resource(dev, res);
if (!ufs->reg_ufsp) {
dev_err(dev, "cannot ioremap for ufs protector register\n");
return -ENOMEM;
}
/* This must be before calling exynos_ufs_populate_dt */
ret = ufs_init_cal(ufs, ufs_host_index, pdev);
if (ret)
return ret;
ret = exynos_ufs_populate_dt(dev, ufs);
if (ret) {
dev_err(dev, "failed to get dt info.\n");
return ret;
}
#ifdef CONFIG_CPU_IDLE
ufs->idle_ip_index = exynos_get_idle_ip_index(dev_name(&pdev->dev));
exynos_update_ip_idle_status(ufs->idle_ip_index, 0);
#endif
ufs->dev = dev;
dev->platform_data = ufs;
dev->dma_mask = &exynos_ufs_dma_mask;
pm_qos_add_request(&ufs->pm_qos_fsys0, PM_QOS_FSYS0_THROUGHPUT, 0);
ret = ufshcd_pltfrm_init(pdev, &exynos_ufs_ops);
return ret;
}
static int exynos_ufs_remove(struct platform_device *pdev)
{
struct exynos_ufs *ufs = dev_get_platdata(&pdev->dev);
ufshcd_pltfrm_exit(pdev);
pm_qos_remove_request(&ufs->pm_qos_fsys0);
ufs->misc_flags = EXYNOS_UFS_MISC_TOGGLE_LOG;
exynos_ufs_ctrl_phy_pwr(ufs, false);
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int exynos_ufs_suspend(struct device *dev)
{
struct ufs_hba *hba = dev_get_drvdata(dev);
return ufshcd_system_suspend(hba);
}
static int exynos_ufs_resume(struct device *dev)
{
struct ufs_hba *hba = dev_get_drvdata(dev);
return ufshcd_system_resume(hba);
}
#else
#define exynos_ufs_suspend NULL
#define exynos_ufs_resume NULL
#endif /* CONFIG_PM_SLEEP */
#ifdef CONFIG_PM_RUNTIME
static int exynos_ufs_runtime_suspend(struct device *dev)
{
return ufshcd_system_suspend(dev_get_drvdata(dev));
}
static int exynos_ufs_runtime_resume(struct device *dev)
{
return ufshcd_system_resume(dev_get_drvdata(dev));
}
static int exynos_ufs_runtime_idle(struct device *dev)
{
return ufshcd_runtime_idle(dev_get_drvdata(dev));
}
#else
#define exynos_ufs_runtime_suspend NULL
#define exynos_ufs_runtime_resume NULL
#define exynos_ufs_runtime_idle NULL
#endif /* CONFIG_PM_RUNTIME */
static void exynos_ufs_shutdown(struct platform_device *pdev)
{
ufshcd_shutdown((struct ufs_hba *)platform_get_drvdata(pdev));
}
static const struct dev_pm_ops exynos_ufs_dev_pm_ops = {
.suspend = exynos_ufs_suspend,
.resume = exynos_ufs_resume,
.runtime_suspend = exynos_ufs_runtime_suspend,
.runtime_resume = exynos_ufs_runtime_resume,
.runtime_idle = exynos_ufs_runtime_idle,
};
static const struct ufs_hba_variant exynos_ufs_drv_data = {
.ops = &exynos_ufs_ops,
};
static const struct of_device_id exynos_ufs_match[] = {
{ .compatible = "samsung,exynos-ufs", },
{},
};
MODULE_DEVICE_TABLE(of, exynos_ufs_match);
static struct platform_driver exynos_ufs_driver = {
.driver = {
.name = "exynos-ufs",
.owner = THIS_MODULE,
.pm = &exynos_ufs_dev_pm_ops,
.of_match_table = exynos_ufs_match,
.suppress_bind_attrs = true,
},
.probe = exynos_ufs_probe,
.remove = exynos_ufs_remove,
.shutdown = exynos_ufs_shutdown,
};
module_platform_driver(exynos_ufs_driver);
MODULE_DESCRIPTION("Exynos Specific UFSHCI driver");
MODULE_AUTHOR("Seungwon Jeon <tgih.jun@samsung.com>");
MODULE_AUTHOR("Kiwoong Kim <kwmad.kim@samsung.com>");
MODULE_LICENSE("GPL");
|