/
usdhc.rs
2926 lines (2791 loc) · 115 KB
/
usdhc.rs
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
//! Ultra Secured Digital Host Controller (uSDHC) driver.
//!
//! # Resources
//!
//! Descriptions taken from
//! i.MX 8M Nano Applications Processor Reference Manual, Document Number: IMX8MNRM Rev. 2, 07/2022
use super::common::MMIODerefWrapper;
use crate::nxp::imx8mn::arch::cpu_core;
use crate::nxp::imx8mn::bsp::drivers::usdhc::INT_STATUS::DEBE;
use crate::{info, print, warn};
use core::fmt::Debug;
use tock_registers::{
interfaces::{ReadWriteable, Readable, Writeable},
register_bitfields, register_structs,
registers::{ReadOnly, ReadWrite, WriteOnly},
LocalRegisterCopy,
};
register_bitfields! {
u32,
/// This register contains the physical system memory address used for DMA transfers.
DS_ADDR [
/// DMA system address / argument 2
DS_ADDR OFFSET(2) NUMBITS(30) [],
/// Reserved - the least 2 bits are reserved, always 0
RESERVED OFFSET(0) NUMBITS(2) [],
],
/// This register is used to configure the number of data blocks and the number of bytes in
/// each block
BLK_ATT [
/// Transfer block size
///
/// This register specifies the block size for block data transfers. Values ranging from 1 byte up to the
/// maximum buffer size can be set. It can be accessed only when no transaction is executing (that is, after a
/// transaction has stopped). Read operations during transfers may return an invalid value, and write
/// operations are ignored.
///
/// Field Function
/// 0000000000000b - No data transfer
/// 0000000000001b - 1 byte
/// 0000000000010b - 2 bytes
/// 0000000000011b - 3 bytes
/// 0000000000100b - 4 bytes
/// 0000111111111b - 511 bytes
/// 0001000000000b - 512 bytes
/// 0100000000000b - 2048 bytes
/// 1000000000000b - 4096 byte
BLKSIZE OFFSET(0) NUMBITS(12) [],
RESERVED OFFSET(13) NUMBITS(3) [],
/// Blocks count for current transfer
///
/// This register is enabled when the Block Count Enable field in the Transfer Mode register is set to 1 and is
/// valid only for multiple block transfers. For single block transfer, this register always reads as 1. The host
/// driver sets this register to a value between 1 and the maximum block count. The uSDHC module
/// decrements the block count after each block transfer and stops when the count reaches zero. Setting the
/// block count to zero results in no data blocks being transferred
///
/// 0000000000000000b - Stop count
/// 0000000000000001b - 1 block
/// 0000000000000010b - 2 blocks
/// 1111111111111111b - 65535 blocks
BLKCNT OFFSET(16) NUMBITS(16) [],
],
/// This register contains the SD/MMC command argument.
CMD_ARG [
/// Command argument
///
/// The SD/MMC command argument is specified as bits 39-8 of the command format in the SD or MMC
/// specification. This register is write protected when the Command Inhibit (CMD) field in the Present State
/// register is set.
CMDARG OFFSET(0) NUMBITS(31) [],
],
/// This register is used to control the operation of data transfers.
CMD_XFR_TYP [
RESERVED0 OFFSET(0) NUMBITS(16) [],
/// Response type select
RSPTYP OFFSET(16) NUMBITS(2) [
/// - 0b00: no response
CMD_NO_RESP = 0b00,
/// - 0b01: Response length 136
CMD_136BIT_RESP = 0b01,
/// - 0b10: Response length 48
CMD_48BIT_RESP = 0b10,
/// - 0b11: Response length 48, check busy after response
CMD_BUSY48BIT_RESP = 0b11
],
RESERVED1 OFFSET(18) NUMBITS(1) [],
/// Command CRC check enable
///
/// If this field is set to 1, uSDHC checks the CRC field in the response. If an error is detected, it is reported
/// as a Command CRC Error. If this field is set to 0, the CRC field is not checked. The number of bits
/// checked by the CRC field value changes according to the length of the response.
///
/// Command Transfer Type (CMD_XFR_TYP).
/// 0b - Disables command CRC check
/// 1b - Enables command CRC check
CCCEN OFFSET(19) NUMBITS(1) [],
/// Command index check enable
///
/// If this field is set to 1, uSDHC checks the Index field in the response to see if it has the same value as the
/// command index. If it is not, it is reported as a Command Index Error. If this field is set to 0, the Index field
/// is not checked.
///
/// 0b - Disable command index check
/// 1b - Enables command index check
CICEN OFFSET(20) NUMBITS(1) [],
/// Data present select
///
/// This field is set to 1 to indicate that data is present and is transferred using the DATA line. It is set to 0 for
/// the following:
///
/// • Commands using only the CMD line (for example, CMD52)
/// • Commands with no data transfer, but using the busy signal on DATA0 line (R1b or R5b (for
/// example, CMD38))
///
/// 0b - No data present
/// 1b - Data present
DPSEL OFFSET(21) NUMBITS(1) [],
/// Command type
///
/// There are three types of special commands: Suspend, Resume, and Abort. These bits are set to 00b for
/// all other commands.
///
/// 00b - Normal other commands
/// 01b - Suspend CMD52 for writing bus suspend in CCCR
/// 10b - Resume CMD52 for writing function select in CCCR
/// 11b - Abort CMD12, CMD52 for writing I/O Abort in CCCR
CMDTYP OFFSET(22) NUMBITS(2) [],
/// Command index
///
/// These bits are set to the command number that is specified in bits 45-40 of the command-format in the
/// SD Memory Card Physical Layer Specification and SDIO Card Specification.
CMDINX OFFSET(24) NUMBITS(6) [],
RESERVED2 OFFSET(30) NUMBITS(2) [],
],
/// This register is used to store part 0 of the response bits from the card.
CMD_RSP0 [
/// Command response 0
///
/// See Command Response3 (CMD_RSP3) for the mapping of command responses from the SD bus to
/// this register for each response type
CMDRSP0 OFFSET(0) NUMBITS(31) [],
],
/// This register is used to store part 1 of the response bits from the card.
CMD_RSP1 [
/// Command response 1
///
/// See Command Response3 (CMD_RSP3) for the mapping of command responses from the SD bus to
/// this register for each response type
CMDRSP1 OFFSET(0) NUMBITS(31) [],
],
/// This register is used to store part 2 of the response bits from the card.
CMD_RSP2 [
/// Command response 2
///
/// See Command Response3 (CMD_RSP3) for the mapping of command responses from the SD bus to
/// this register for each response type
CMDRSP2 OFFSET(0) NUMBITS(31) [],
],
/// This register is used to store part 3 of the response bits from the card.
CMD_RSP3 [
/// Command response 3
///
/// See Command Response3 (CMD_RSP3) for the mapping of command responses from the SD bus to
/// this register for each response type
///
/// See Table 10-38. Response bit definition for each response type in i.MX8MNRM
CMDRSP3 OFFSET(0) NUMBITS(31) [],
],
/// This is a 32-bit data port register used to access the internal buffer.
DATA_BUFF_ACC_PORT [
/// Data content
///
/// The Buffer Data Port register is for 32-bit data access by the Arm platform or the external DMA. When the
/// internal DMA is enabled, any write to this register is ignored, and any read from this register always yields
/// 0s
DATCONT OFFSET(0) NUMBITS(31) [],
],
/// The host driver can get status of uSDHC from this 32-bit read only register
PRES_STATE [
/// Command inhibit (CMD)
///
/// If this status bit is 0, it indicates that the CMD line is not in use and uSDHC can issue a SD / MMC
/// command using the CMD line
///
/// 0b - Can issue command using only CMD line
/// 1b - Cannot issue command
CIHB OFFSET(0) NUMBITS(1) [],
/// Command inhibit (DATA)
///
/// This status field is generated if either the DAT Line Active or the Read Transfer Active is set to 1. If this
/// field is 0, it indicates that uSDHC can issue the next SD / MMC Command.
///
/// 0b - Can issue command that uses the DATA line
/// 1b - Cannot issue command that uses the DATA line
CDIHB OFFSET(1) NUMBITS(1) [],
/// Data line active
///
/// This status field indicates whether one of the DATA lines on the SD bus is in use
///
/// 0b - DATA line inactive
/// 1b - DATA line active
DLA OFFSET(2) NUMBITS(1) [],
/// SD clock stable
///
/// This status field indicates that the internal card clock is stable.
///
/// 0b - Clock is changing frequency and not stable.
/// 1b - Clock is stable.
SDSTB OFFSET(3) NUMBITS(1) [],
/// Peripheral clock gated off internally
///
/// This status field indicates that the peripheral clock is internally gated off. This field is for the host driver to
/// debug.
///
/// 0b - Peripheral clock is active.
/// 1b - Peripheral clock is gated off.
IPGOFF OFFSET(4) NUMBITS(1) [],
/// HCLK gated off internally
///
/// This status field indicates that the HCLK is internally gated off. This field is for the host driver to debug
/// during a data transfer.
///
/// 0b - HCLK is active.
/// 1b - HCLK is gated off.
HCKOFF OFFSET(5) NUMBITS(1) [],
/// IPG_PERCLK gated off internally
///
/// This status field indicates that the IPG_PERCLK is internally gated off. This field is for the host driver to
/// debug transaction on the SD bus. When IPG_CLK_SOFT_EN is cleared, IPG_PERCLK is gated off,
/// otherwise IPG_PERCLK is always active.
///
/// 0b - IPG_PERCLK is active.
/// 1b - IPG_PERCLK is gated off.
PEROFF OFFSET(6) NUMBITS(1) [],
/// SD clock gated off internally
///
/// This status field indicates that the SD clock is internally gated off, because of buffer over / under-run or
/// read pause without read wait assertion, or the driver set FRC_SDCLK_ON field is 0 to stop the SD clock
/// in idle status. This field is for the host driver to debug data transaction on the SD bus.
///
/// 0b - SD clock is active.
/// 1b - SD clock is gated off.
SDOFF OFFSET(7) NUMBITS(1) [],
/// Write transfer active
///
/// This status field indicates a write transfer is active.
///
/// 0b - No valid data
/// 1b - Transferring data
WTA OFFSET(8) NUMBITS(1) [],
/// Read transfer active
///
/// This status field is used for detecting completion of a read transfer.
///
/// 0b - No valid data
/// 1b - Transferring data
RTA OFFSET(9) NUMBITS(1) [],
/// Buffer write enable
///
/// This status field is used for non-DMA write transfers.
///
/// 0b - Write disable
/// 1b - Write enable
BWEN OFFSET(10) NUMBITS(1) [],
/// Buffer read enable
///
/// This status field is used for non-DMA read transfers.
///
/// 0b - Read disable
/// 1b - Read enable
BREN OFFSET(11) NUMBITS(1) [],
/// Re-Tuning Request (only for SD3.0 SDR104 mode and EMMC HS200 mode
RTR OFFSET(12) NUMBITS(1) [],
RESERVED0 OFFSET(13) NUMBITS(2) [],
/// Tape select change done
///
/// This field indicates the delay setting is effective after write CLK_TUNE_CTRL_STATUS register.
///
/// 0b - Delay cell select change is not finished.
/// 1b - Delay cell select change is finished.
TSCD OFFSET(15) NUMBITS(1) [],
/// Card inserted
///
/// This field indicates whether a card has been inserted.
///
/// 0b - Power on reset or no card
/// 1b - Card inserted
CINST OFFSET(16) NUMBITS(1) [],
RESERVED1 OFFSET(17) NUMBITS(1) [],
/// Card detect pin level
///
/// This field reflects the inverse value of the CD_B pin for the card socket. Debouncing is not performed on
/// this field.
///
/// 0b - No card present (CD_B = 1)
/// 1b - Card present (CD_B = 0)
CDPL OFFSET(18) NUMBITS(1) [],
/// Write protect switch pin level
///
/// The Write Protect switch is supported for memory and combo cards.
///
/// 0b - Write protected (WP = 1)
/// 1b - Write enabled (WP = 0)
WPSPL OFFSET(19) NUMBITS(1) [],
RESERVED2 OFFSET(20) NUMBITS(3) [],
/// CMD line signal level
///
/// This status is used to check the CMD line level to recover from errors, and for debugging.
CLSL OFFSET(23) NUMBITS(1) [],
/// DATA[7:0] line signal level
///
/// This status is used to check the DATA line level to recover from errors, and for debugging. This is
/// especially useful in detecting the busy signal level from DATA0.
///
/// 00000000b - Data 0 line signal level
/// 00000001b - Data 1 line signal level
/// 00000010b - Data 2 line signal level
/// 00000011b - Data 3 line signal level
/// 00000100b - Data 4 line signal level
/// 00000101b - Data 5 line signal level
/// 00000110b - Data 6 line signal level
/// 00000111b - Data 7 line signal level
DLSL OFFSET(24) NUMBITS(8) [],
],
/// There are three cases to restart the transfer after stop at the block gap.
///
/// Which case is appropriate depends on whether uSDHC issues a Suspend command or the SD card
/// accepts the Suspend command.
///
/// • If the host driver does not issue a Suspend command, the Continue request is used to
/// restart the transfer.
/// • If the host driver issues a Suspend command and the SD card accepts it, a Resume
/// command is used to restart the transfer.
/// • If the host driver issues a Suspend command and the SD card does not accept it, the
/// Continue request is used to restart the transfer.
PROT_CTRL [
/// LED control
///
/// This field, fully controlled by the host driver, is used to caution the user not to remove the card while the
/// card is being accessed. If the software is going to issue multiple SD commands, this field can be set
/// during all these transactions. It is not necessary to change for each transaction. When the software
/// issues multiple SD commands, setting the field once before the first command is sufficient: it is not
/// necessary to reset the bit between commands.
///
/// 0b - LED off
/// 1b - LED on
LCTL OFFSET(0) NUMBITS(1) [],
/// Data transfer width
///
/// This field selects the data width of the SD bus for a data transfer. The host driver sets it to match the data
/// width of the card. Possible data transfer width is 1-bit, 4-bits or 8-bits.
///
/// 00b - 1-bit mode
/// 01b - 4-bit mode
/// 10b - 8-bit mode
/// 11b - Reserved
DTW OFFSET(1) NUMBITS(2) [
OneBitWide = 0b00,
FourBitWide = 0b01,
EightBitWide = 0b10,
Reserved = 0b11,
],
/// DATA3 as card detection pin
///
/// If this field is set, DATA3 should be pulled down to act as a card detection pin. Be cautious when using
/// this feature, because DATA3 is also a chip-select for the SPI mode. A pull-down on this pin and CMD0
/// might set the card into the SPI mode, which uSDHC does not support.
///
/// 0b - DATA3 does not monitor card insertion
/// 1b - DATA3 as card detection pin
D3CD OFFSET(3) NUMBITS(1) [],
/// Endian mode
///
/// The uSDHC module supports all three endian modes in data transfer. See Data buffer for more details.
///
/// 00b - Big endian mode
/// 01b - Half word big endian mode
/// 10b - Little endian mode
/// 11b - Reserved
EMODE OFFSET(4) NUMBITS(2) [
BigEndianMode = 0b00,
HalfWordBigEndianMode = 0b01,
LittleEndianMode = 0b10,
Reserved = 0b11,
],
/// Card detect test level
///
/// This bit is enabled while the card detection signal selection is set to 1 and it indicates card insertion.
///
/// 0b - Card detect test level is 0, no card inserted
/// 1b - Card detect test level is 1, card inserted
CDTL OFFSET(6) NUMBITS(1) [],
/// Card detect signal selection
///
/// This field selects the source for the card detection.
///
/// 0b - Card detection level is selected (for normal purpose).
/// 1b - Card detection test level is selected (for test purpose).
CDSS OFFSET(7) NUMBITS(1) [],
/// DMA select
///
/// This field is valid while DMA (SDMA or ADMA) is enabled and selects the DMA operation.
///
/// 00b - No DMA or simple DMA is selected.
/// 01b - ADMA1 is selected.
/// 10b - ADMA2 is selected.
/// 11b - Reserved
DMASEL OFFSET(8) NUMBITS(2) [],
RESERVED0 OFFSET(10) NUMBITS(6) [],
/// Stop at block gap request
///
/// This field is used to stop executing a transaction at the next block gap for both DMA and non-DMA
/// transfers.
///
/// 0b - Transfer
/// 1b - Stop
SABGREQ OFFSET(16) NUMBITS(1) [],
/// Continue request
///
/// This field is used to restart a transaction which was stopped using the stop at block gap request.
///
/// 0b - No effect
/// 1b - Restart
CREQ OFFSET(17) NUMBITS(1) [],
/// Read wait control
///
/// The read wait function is optional for SDIO cards. If the card supports read wait, set this field to enable
/// use of the read wait protocol to stop read data using the DATA2 line.
///
/// 0b - Disables read wait control and stop SD clock at block gap when SABGREQ field is set
/// 1b - Enables read wait control and assert read wait without stopping SD clock at block gap when
/// SABGREQ field is set
RWCTL OFFSET(18) NUMBITS(1) [],
/// Interrupt at block gap
///
/// This field is valid only in 4-bit mode, of the SDIO card, and selects a sample point in the interrupt cycle.
/// Setting to 1 enables interrupt detection at the block gap for a multiple block transfer. Setting to 0 disables
/// interrupt detection during a multiple block transfer. If the SDIO card cannot signal an interrupt during a
/// multiple block transfer, this field should be set to 0 to avoid an inadvertent interrupt. When the host driver
/// detects an SDIO card insertion, it sets this field according to the CCCR of the card.
///
/// 0b - Disables interrupt at block gap
/// 1b - Enables interrupt at block gap
IABG OFFSET(19) NUMBITS(1) [],
/// Read performed number 8 clock
///
/// According to the SD/MMC spec, for read data transaction, 8 clocks are needed after the end field of the
/// last data block. So, by default(RD_DONE_NO_8CLK=0), 8 clocks are active after the end field of the last
/// read data transaction
///
/// In a summary, this field should be set only if the use case needs to use stop at block gap feature while
/// the device can't support the read wait feature.
RD_DONE_NO_8CLK OFFSET(20) NUMBITS(1) [],
RESERVED1 OFFSET(21) NUMBITS(2) [],
RESRW1C OFFSET(23) NUMBITS(1) [],
/// Wakeup event enable on card interrupt
///
/// This field enables a wakeup event, via a card interrupt, in the Interrupt Status register. This field can be
/// set to 1 if FN_WUS (Wake Up Support) in CIS is set to 1. When this field is set, the Card Interrupt Status
/// and uSDHC interrupt can be asserted without CLK toggling. When the wakeup feature is not enabled, the
/// CLK must be active to assert the Card Interrupt Status and uSDHC interrupt.
///
/// 0b - Disables wakeup event enable on card interrupt
/// 1b - Enables wakeup event enable on card interrupt
WECINT OFFSET(24) NUMBITS(1) [],
/// Wakeup event enable on SD card insertion
///
/// This field enables a wakeup event, via a card insertion, in the Interrupt Status register. FN_WUS (Wake
/// Up Support) in CIS does not affect this field. When this field is set, the Card Insertion Status and uSDHC
/// interrupt can be asserted without CLK toggling. When the wakeup feature is not enabled, the CLK must
/// be active to assert the Card Insertion Status and uSDHC interrupt.
///
/// 0b - Disable wakeup event enable on SD card insertion
/// 1b - Enable wakeup event enable on SD card insertion
WECINS OFFSET(25) NUMBITS(1) [],
/// Wakeup event enable on SD card removal
///
/// This field enables a wakeup event, via a card removal, in the Interrupt Status register. FN_WUS (Wake
/// Up Support) in CIS does not affect this field. When this field is set, the Card Removal Status and uSDHC
/// interrupt can be asserted without CLK toggling. When the wakeup feature is not enabled, the CLK must
/// be active to assert the Card Removal Status and uSDHC interrupt.
///
/// 0b - Disables wakeup event enable on SD card removal
/// 1b - Enables wakeup event enable on SD card remova
WECRM OFFSET(26) NUMBITS(1) [],
/// BURST length enable for INCR, INCR4 / INCR8 / INCR16, INCR4-WRAP / INCR8-WRAP / INCR16-
/// WRAP
///
/// This is used to enable / disable the burst length for the external AHB2AXI bridge.
///
/// 1xxb - Burst length is enabled for INCR4-WRAP / INCR8-WRAP / INCR16-WRAP.
/// x1xb - Burst length is enabled for INCR4 / INCR8 / INCR16.
/// xx1b - Burst length is enabled for INCR.
BURST_LEN_EN OFFSET(27) NUMBITS(3) [],
/// Non-exact block read
///
/// Current block read is non-exact block read. It is only used for SDIO.
///
/// 0b - The block read is exact block read. Host driver does not need to issue abort command to
/// terminate this multi-block read.
/// 1b - The block read is non-exact block read. Host driver needs to issue abort command to
/// terminate this multi-block read
NON_EXACT_BLK_RD OFFSET(30) NUMBITS(1) [],
RESERVED2 OFFSET(31) NUMBITS(1) [],
],
/// This register provides control of the system.
SYS_CTRL [
RESERVED0 OFFSET(0) NUMBITS(4) [],
/// Divisor
///
/// This register is used to provide a more exact divisor to generate the desired SD clock frequency. Note the
/// divider can even support odd divisors without deterioration of duty cycle.
/// Before changing clock divisor value (SDCLKFS or DVS), Host driver should make sure the SDSTB field is
/// high.
///
/// The settings are as follows:
/// 0000b - Divide-by-1
/// 0001b - Divide-by-2
/// 1110b - Divide-by-15
/// 1111b - Divide-by-16
DVS OFFSET(4) NUMBITS(4) [],
/// SDCLK frequency select
///
/// This register is used to select the frequency of the SDCLK pin. The frequency is not programmed directly,
/// rather this register holds the prescaler (this register) and divisor (next register) of the Base Clock
/// Frequency register.
///
/// See detail in the field description in reference manual
SDCLKFS OFFSET(8) NUMBITS(8) [],
/// Data timeout counter value
///
/// This value determines the interval by which DAT line timeouts are detected. See the Data Timeout Error
/// field in the Interrupt Status register for information on factors that dictate time-out generation. Time-out
/// clock frequency is generated by dividing the base clock SDCLK value by this value.
///
/// The host driver can clear the Data Timeout Error Status Enable (in the Interrupt Status Enable register) to
/// prevent inadvertent time-out events.
DTOCV OFFSET(16) NUMBITS(4) [],
RESERVED1 OFFSET(20) NUMBITS(3) [],
/// Hardware reset
///
/// This register's value is output to card through pad directly to hardware reset pin of the card if the card
/// supports this feature.
IPP_RST_N OFFSET(23) NUMBITS(1) [],
/// Software reset for all
///
/// This reset effects the entire host controller except for the card detection circuit.
RSTA OFFSET(24) NUMBITS(1) [
NoReset = 0,
Reset = 1,
],
/// Software reset for CMD line
///
/// Only part of the command circuit is reset. After this field is set, the software waits for self-clear.
/// The following registers and bits are cleared by this field:
/// • Present State Register Command Inhibit (CMD)
/// • Interrupt Status register Command Complete
///
/// 0b - No reset
/// 1b - Reset
RSTC OFFSET(25) NUMBITS(1) [],
/// Software reset for data line
///
/// Only part of the data circuit is reset. DMA circuit is also reset. After this field is set, the software waits for
/// self-clear.
RSTD OFFSET(26) NUMBITS(1) [],
/// Initialization active
///
/// When this field is set, 80 SD-clocks are sent to the card. After the 80 clocks are sent, this field is self
/// cleared. This field is very useful during the card power-up period when 74 SD-clocks are needed and the
/// clock auto gating feature is enabled
INITA OFFSET(27) NUMBITS(1) [],
/// Reset tuning
///
/// When set this field to 1, it resets tuning circuit. After tuning circuits are reset, bit value is 0. Clearing
/// execute_tuning field in AUTOCMD12_ERR_STATUS also sets this field to 1 to reset tuning circuit
RSTT OFFSET(28) NUMBITS(1) [],
RESERVED2 OFFSET(29) NUMBITS(3) [],
],
/// This register provides control of the system.
INT_STATUS [
/// Command complete
///
/// This field is set when you receive the end field of the command response (except auto CMD12). See the
/// Command Inhibit (CMD) in the Present State register.
///
/// This field is not asserted in tuning process.
/// 0b - Command not complete
/// 1b - Command complete
CC OFFSET(0) NUMBITS(1) [],
TC OFFSET(1) NUMBITS(1) [],
BGE OFFSET(2) NUMBITS(1) [],
DINT OFFSET(3) NUMBITS(1) [],
BWR OFFSET(4) NUMBITS(1) [],
BRR OFFSET(5) NUMBITS(1) [],
CINS OFFSET(6) NUMBITS(1) [],
CRM OFFSET(7) NUMBITS(1) [],
CINT OFFSET(8) NUMBITS(1) [],
RESERVED0 OFFSET(9) NUMBITS(3) [],
RTE OFFSET(12) NUMBITS(1) [],
TP OFFSET(13) NUMBITS(1) [],
CQI OFFSET(14) NUMBITS(1) [],
RESERVED1 OFFSET(15) NUMBITS(1) [],
CTOE OFFSET(16) NUMBITS(1) [],
CCE OFFSET(17) NUMBITS(1) [],
CEBE OFFSET(18) NUMBITS(1) [],
CIE OFFSET(19) NUMBITS(1) [],
DTOE OFFSET(20) NUMBITS(1) [],
DCE OFFSET(21) NUMBITS(1) [],
DEBE OFFSET(22) NUMBITS(1) [],
RESERVED2 OFFSET(23) NUMBITS(1) [],
AC12E OFFSET(24) NUMBITS(1) [],
RESERVED3 OFFSET(25) NUMBITS(1) [],
TNE OFFSET(26) NUMBITS(1) [],
RESERVED4 OFFSET(27) NUMBITS(1) [],
DMAE OFFSET(28) NUMBITS(1) [],
RESERVED5 OFFSET(29) NUMBITS(3) [],
],
/// Setting the fields in this register to 1 enables the corresponding Interrupt Status to be set
/// by the specified event.
INT_STATUS_EN [
CCSEN OFFSET(0) NUMBITS(1) [],
TCSEN OFFSET(1) NUMBITS(1) [],
BGESEN OFFSET(2) NUMBITS(1) [],
DINTSEN OFFSET(3) NUMBITS(1) [],
BWRSEN OFFSET(4) NUMBITS(1) [],
BRRSENN OFFSET(5) NUMBITS(1) [],
CINSSEN OFFSET(6) NUMBITS(1) [],
CRMSEN OFFSET(7) NUMBITS(1) [],
CINTSEN OFFSET(8) NUMBITS(1) [],
RESERVED0 OFFSET(9) NUMBITS(3) [],
RTESEN OFFSET(12) NUMBITS(1) [],
TPSEN OFFSET(13) NUMBITS(1) [],
CQISEN OFFSET(14) NUMBITS(1) [],
RESERVED1 OFFSET(15) NUMBITS(1) [],
CTOESEN OFFSET(16) NUMBITS(1) [],
CCESEN OFFSET(17) NUMBITS(1) [],
CEBESEN OFFSET(18) NUMBITS(1) [],
CIESEN OFFSET(19) NUMBITS(1) [],
DTOESEN OFFSET(20) NUMBITS(1) [],
DCESEN OFFSET(21) NUMBITS(1) [],
DEBESEN OFFSET(22) NUMBITS(1) [],
RESERVED2 OFFSET(23) NUMBITS(1) [],
AC12ESEN OFFSET(24) NUMBITS(1) [],
RESERVED3 OFFSET(25) NUMBITS(1) [],
TNESEN OFFSET(26) NUMBITS(1) [],
RESERVED4 OFFSET(27) NUMBITS(1) [],
DMAESEN OFFSET(28) NUMBITS(1) [],
RESERVED5 OFFSET(29) NUMBITS(3) [],
],
/// This register is used to select which interrupt status is indicated to the host system as the
/// interrupt. These status fields all share the same interrupt line. Setting any of these fields
/// to 1 enables interrupt generation. The corresponding Status register field generates an
/// interrupt when the corresponding interrupt signal enable field is set.
INT_SIGNAL_EN [
CCIEN OFFSET(0) NUMBITS(1) [],
TCIEN OFFSET(1) NUMBITS(1) [],
BGEIEN OFFSET(2) NUMBITS(1) [],
DINTIEN OFFSET(3) NUMBITS(1) [],
BWRIEN OFFSET(4) NUMBITS(1) [],
BRRIEN OFFSET(5) NUMBITS(1) [],
CINSIEN OFFSET(6) NUMBITS(1) [],
CRMIEN OFFSET(7) NUMBITS(1) [],
CINTIEN OFFSET(8) NUMBITS(1) [],
RESERVED0 OFFSET(9) NUMBITS(3) [],
RTEIEN OFFSET(12) NUMBITS(1) [],
TPIEN OFFSET(13) NUMBITS(1) [],
CQIIEN OFFSET(14) NUMBITS(1) [],
RESERVED1 OFFSET(15) NUMBITS(1) [],
CTOEIEN OFFSET(16) NUMBITS(1) [],
CCEIEN OFFSET(17) NUMBITS(1) [],
CEBEIEN OFFSET(18) NUMBITS(1) [],
CIEIEN OFFSET(19) NUMBITS(1) [],
DTOEIEN OFFSET(20) NUMBITS(1) [],
DCEIEN OFFSET(21) NUMBITS(1) [],
DEBEIEN OFFSET(22) NUMBITS(1) [],
RESERVED2 OFFSET(23) NUMBITS(1) [],
AC12EIEN OFFSET(24) NUMBITS(1) [],
RESERVED3 OFFSET(25) NUMBITS(1) [],
TNEIEN OFFSET(26) NUMBITS(1) [],
RESERVED4 OFFSET(27) NUMBITS(1) [],
DMAEIEN OFFSET(28) NUMBITS(1) [],
RESERVED5 OFFSET(29) NUMBITS(3) [],
],
/// This register provides the host driver with information specific to uSDHC
/// implementation. The value in this register is the power-on-reset value and does not
/// change with a software reset.
HOST_CTRL_CAP [
SDR50_SUPPORT OFFSET(0) NUMBITS(1) [],
SDR104_SUPPORT OFFSET(1) NUMBITS(1) [],
DDR50_SUPPORT OFFSET(2) NUMBITS(1) [],
RESERVED0 OFFSET(3) NUMBITS(5) [],
TIME_COUNT_RETUNING OFFSET(8) NUMBITS(4) [],
RESERVED1 OFFSET(12) NUMBITS(1) [],
USE_TUNING_SDR50 OFFSET(13) NUMBITS(1) [],
RETUNING_MODE OFFSET(14) NUMBITS(2) [],
MBL OFFSET(16) NUMBITS(3) [],
RESERVED2 OFFSET(19) NUMBITS(1) [],
ADMAS OFFSET(20) NUMBITS(1) [],
HSS OFFSET(21) NUMBITS(1) [],
DMAS OFFSET(22) NUMBITS(1) [],
SRS OFFSET(23) NUMBITS(1) [],
VS33 OFFSET(24) NUMBITS(1) [
NotSupported = 0,
Supported = 1,
],
VS30 OFFSET(25) NUMBITS(1) [
NotSupported = 0,
Supported = 1,
],
VS18 OFFSET(26) NUMBITS(1) [
NotSupported = 0,
Supported = 1,
],
RESERVED3 OFFSET(27) NUMBITS(5) [],
],
/// This register contains the MMC Fast Boot control register.
MMCBOOT [
DTOCV_ACK OFFSET(0) NUMBITS(4) [],
BOOT_ACK OFFSET(4) NUMBITS(1) [],
BOOT_MODE OFFSET(5) NUMBITS(1) [],
BOOT_EN OFFSET(6) NUMBITS(1) [],
AUTO_SABG_EN OFFSET(7) NUMBITS(1) [],
DISABLE_TIME_OUT OFFSET(8) NUMBITS(1) [],
RESERVED0 OFFSET(9) NUMBITS(7) [],
BOOT_BLK_CNT OFFSET(16) NUMBITS(16) [],
],
/// This register is used to DMA and data transfer. To prevent data loss, The software should
/// check if data transfer is active before writing this register. These fields are DPSEL,
/// MBSEL, DTDSEL, AC12EN, BCEN, and DMAEN
MIXCTRL [
DMAEN OFFSET(0) NUMBITS(1) [],
BCEN OFFSET(1) NUMBITS(1) [],
AC12EN OFFSET(2) NUMBITS(1) [],
DDR_EN OFFSET(3) NUMBITS(1) [],
DTDSEL OFFSET(4) NUMBITS(1) [],
MSBSEL OFFSET(5) NUMBITS(1) [],
NIBBLE_POS OFFSET(6) NUMBITS(1) [],
AC23EN OFFSET(7) NUMBITS(1) [],
RESERVED0 OFFSET(8) NUMBITS(14) [],
EXE_TUNE OFFSET(22) NUMBITS(1) [],
SMP_CLK_SEL OFFSET(23) NUMBITS(1) [],
AUTO_TUNE_EN OFFSET(24) NUMBITS(1) [],
FBCLK_SEL OFFSET(25) NUMBITS(1) [],
HS400_MODE OFFSET(26) NUMBITS(1) [],
EN_HS400_MODE OFFSET(27) NUMBITS(1) [],
RESERVED1 OFFSET(28) NUMBITS(1) [],
RESERVED2 OFFSET(29) NUMBITS(2) [],
RESERVED3 OFFSET(31) NUMBITS(1) [],
],
/// This register contains the Clock Tuning Control status information. All fields are read
/// only and reads the same as the power-reset value. This register is added to support SD3.0
/// UHS-I SDR104 mode and EMMC HS200 mode.
CLK_TUNE_CTRL_STS [
DLY_CELL_SET_POST OFFSET(0) NUMBITS(4) [],
DLY_CELL_SET_OUT OFFSET(4) NUMBITS(4) [],
DLY_CELL_SET_PRE OFFSET(8) NUMBITS(7) [],
NXT_ERR OFFSET(15) NUMBITS(1) [],
TAP_SEL_POST OFFSET(16) NUMBITS(4) [],
TAP_SEL_OUT OFFSET(20) NUMBITS(4) [],
TAP_SEL_PRE OFFSET(24) NUMBITS(7) [],
PRE_ERR OFFSET(31) NUMBITS(1) [],
],
/// This register contains control fields for DLL.
DLL_CTRL [
DLL_CTRL_EN OFFSET(0) NUMBITS(1) [],
DLL_CTRL_RST OFFSET(1) NUMBITS(1) [],
DLL_CTRL_SLV_FORCE_UPD OFFSET(2) NUMBITS(1) [],
DLL_CTRL_SLV_DLY_TARGET0 OFFSET(3) NUMBITS(4) [],
DLL_CTRL_GATE_UPDT OFFSET(7) NUMBITS(1) [],
DLL_CTRL_SLV_OVERRIDE OFFSET(8) NUMBITS(1) [],
DLL_CTRL_SLV_OVERRIDE_VAL OFFSET(9) NUMBITS(7) [],
DLL_CTRL_SLV_DLY_TARGET1 OFFSET(16) NUMBITS(3) [],
RESERVED0 OFFSET(19) NUMBITS(1) [],
DLL_CTRL_SLV_UPDT_INT OFFSET(20) NUMBITS(8) [],
DLL_CTRL_REF_UPDT_INT OFFSET(28) NUMBITS(4) [],
],
/// This register contains the vendor specific control / status register.
VEND_SPEC [
EXT_DMA_EN OFFSET(0) NUMBITS(1) [],
VSELECT OFFSET(1) NUMBITS(1) [],
CONFLICT_CHK_EN OFFSET(2) NUMBITS(1) [],
AC12_WR_CHKBUSY_EN OFFSET(3) NUMBITS(4) [],
RESERVED0 OFFSET(4) NUMBITS(4) [],
FRC_SDCLK_ON OFFSET(8) NUMBITS(1) [],
RESERVED1 OFFSET(9) NUMBITS(1) [],
RESERVED2 OFFSET(10) NUMBITS(1) [],
IPGEN OFFSET(11) NUMBITS(1) [],
HCKEN OFFSET(12) NUMBITS(1) [],
PEREN OFFSET(13) NUMBITS(1) [],
CKEN OFFSET(14) NUMBITS(1) [],
CRC_CHK_DIS OFFSET(15) NUMBITS(1) [],
RESERVED4 OFFSET(16) NUMBITS(8) [],
RESERVED5 OFFSET(24) NUMBITS(4) [],
RESERVED6 OFFSET(28) NUMBITS(1) [],
RSRV1 OFFSET(29) NUMBITS(1) [],
RESERVED8 OFFSET(30) NUMBITS(1) [],
CMD_BYTE_EN OFFSET(31) NUMBITS(1) [],
],
/// Both write and read watermark levels (FIFO threshold) are configurable. Their value can
/// range from 1 to 128 words. Both write and read burst lengths are also Configurable.
/// There value can range from 1 to 31 words.
WTMK_LVL [
RD_WML OFFSET(0) NUMBITS(8) [],
RD_BRST_LEN OFFSET(8) NUMBITS(5) [],
RESERVED0 OFFSET(13) NUMBITS(3) [],
WR_WML OFFSET(16) NUMBITS(8) [],
WR_BRST_LEN OFFSET(24) NUMBITS(5) [],
RESERVED1 OFFSET(29) NUMBITS(3) [],
],
TUNINIG_CTRL [
TUNING_START_TAP OFFSET(0) NUMBITS(8) [],
TUNING_COUNTER OFFSET(8) NUMBITS(8) [],
TUNING_STEP OFFSET(16) NUMBITS(3) [],
RESRV0 OFFSET(19) NUMBITS(1) [],
TUNING_WINDOW OFFSET(20) NUMBITS(3) [],
RESRV1 OFFSET(23) NUMBITS(1) [],
STD_TUNING_EN OFFSET(24) NUMBITS(1) [],
RESRV2 OFFSET(25) NUMBITS(7) [],
]
}
register_structs! {
#[allow(non_snake_case)]
pub RegisterBlock {
(0x00 => DS_ADDR: ReadWrite<u32, DS_ADDR::Register>),
(0x04 => BLK_ATT: ReadWrite<u32, BLK_ATT::Register>),
(0x08 => CMD_ARG: ReadWrite<u32, CMD_ARG::Register>),
(0x0c => CMD_XFR_TYPE: ReadWrite<u32, CMD_XFR_TYP::Register>),
(0x10 => CMD_RSP0: ReadOnly<u32, CMD_RSP0::Register>),
(0x14 => CMD_RSP1: ReadOnly<u32, CMD_RSP1::Register>),
(0x18 => CMD_RSP2: ReadOnly<u32, CMD_RSP2::Register>),
(0x1c => CMD_RSP3: ReadOnly<u32, CMD_RSP3::Register>),
(0x20 => DATA_BUFF_ACC_PORT: ReadWrite<u32, DATA_BUFF_ACC_PORT::Register>),
(0x24 => PRES_STATE: ReadOnly<u32, PRES_STATE::Register>),
(0x28 => PROT_CTRL: ReadWrite<u32, PROT_CTRL::Register>),
(0x2c => SYS_CTRL: ReadWrite<u32, SYS_CTRL::Register>),
(0x30 => INT_STATUS: ReadWrite<u32, INT_STATUS::Register>),
(0x34 => INT_STATUS_EN: ReadWrite<u32, INT_STATUS_EN::Register>),
(0x38 => INT_SIGNAL_EN: ReadWrite<u32, INT_SIGNAL_EN::Register>),
(0x3c => AUTOCMD12_ERR_STATUS),
(0x40 => HOST_CTRL_CAP: ReadWrite<u32, HOST_CTRL_CAP::Register>),
(0x44 => WTMK_LVL: ReadWrite<u32, WTMK_LVL::Register>),
(0x48 => MIXCTRL: ReadWrite<u32, MIXCTRL::Register>),
(0x4c => _reserved0),
(0x50 => FORCE_EVENT),
(0x54 => ADMA_ERR_STATUS),
(0x58 => ADMA_SYS_ADDR),
(0x5c => _reserved1),
(0x60 => DLL_CTRL: ReadWrite<u32, DLL_CTRL::Register>),
(0x64 => DLL_STATUS),
(0x68 => CLK_TUNE_CTRL_STS: ReadWrite<u32, CLK_TUNE_CTRL_STS::Register>),
(0x6c => _reserved2),
(0x70 => STROBE_DLL_CTRL),
(0x74 => STROBE_DLL_STATUS),
(0x78 => _reserved3),
(0xc0 => VEND_SPEC: ReadWrite<u32, VEND_SPEC::Register>),
(0xc4 => MMCBOOT: ReadWrite<u32, MMCBOOT::Register>),
(0xc8 => VEND_SPEC2),
(0xcc => TUNINIG_CTRL: ReadWrite<u32, TUNINIG_CTRL::Register>),
(0xd0 => _reserved4),
(0x100 => CQE),
(0x104 => @END),
}
}
use INT_STATUS_EN::*;
/// Abstraction for the associated uSDHC MMIO register block.
type UsdhcRegisters = MMIODerefWrapper<RegisterBlock>;
/*--------------------------------------------------------------------------
INTERNAL SD CARD REGISTER STRUCTURES AS PER SD CARD STANDARD
--------------------------------------------------------------------------*/
register_bitfields! {
u32,
/// SD CARD OCR register. The 32-bit Operation Conditions Register (OCR) stores the voltage profile of the card.
/// Additionally, this register includes status information bits. One status bit is set if the card power up
/// procedure has been finished. This register includes another status bit indicating the card capacity status
/// after set power up status bit. The OCR register shall be implemented by the cards.
OCR [
/// Write as zero read as don't care
_reserved OFFSET(0) NUMBITS(15) [],
/// Voltage window 2.7v to 2.8v
voltage2v7to2v8 OFFSET(15) NUMBITS(1) [],
/// Voltage window 2.8v to 2.9v
voltage2v8to2v9 OFFSET(16) NUMBITS(1) [],
/// Voltage window 2.9v to 3.0v
voltage2v9to3v0 OFFSET(17) NUMBITS(1) [],
/// Voltage window 3.0v to 3.1v
voltage3v0to3v1 OFFSET(18) NUMBITS(1) [],
/// Voltage window 3.1v to 3.2v
voltage3v1to3v2 OFFSET(19) NUMBITS(1) [],
/// Voltage window 3.2v to 3.3v
voltage3v2to3v3 OFFSET(20) NUMBITS(1) [],
/// Voltage window 3.3v to 3.4v
voltage3v3to3v4 OFFSET(21) NUMBITS(1) [],
/// Voltage window 3.4v to 3.5v
voltage3v4to3v5 OFFSET(22) NUMBITS(1) [],
/// Voltage window 3.5v to 3.6v
voltage3v5to3v6 OFFSET(23) NUMBITS(1) [],
/// Write as zero read as don't care
_reserved1 OFFSET(24) NUMBITS(6) [],
/// Card Capacity status
card_capacity OFFSET(30) NUMBITS(1) [],
/// Card power up status (busy)
card_power_up_busy OFFSET(31) NUMBITS(1) [],
],
}
register_bitfields! {
u64,
/// A configuration register named SD CARD Configuration Register (SCR). SCR provides
/// information on the microSD Memory Card's special features that can be configured into a card.
/// The size of SCR register is 64 bits. This register is set in the factory by the microSD Memory Card manufacturer.
SCR [
/// SD Memory Card Physical Layer Specification version
EMMC_SPEC OFFSET(0) NUMBITS(4) [
/// Version 1.0-1.01
EMMC_SPEC_1_101 = 0,
/// Version 1.10
EMMC_SPEC_11 = 1,
/// ersion 2.00 or Version 3.00 (check bit EMMC_SPEC3)
EMMC_SPEC_2_3 = 2,
],
/// SCR structure version
SCR_STRUCT OFFSET(4) NUMBITS(4) [
/// SCR version 1.0
SCR_VER_1 = 0,
],
/// SD Bus width
BUS_WIDTH OFFSET(8) NUMBITS(4) [
/// Card supports bus width 1
BUS_WIDTH_1 = 1,
/// Card supports bus width 4
BUS_WIDTH_4 = 4,
/// Card supports bus widths - 1 and 4
BUS_WIDTH_1_4 = 5,
],
/// Voltage window 2.9v to 3.0v
EMMC_SECURITY OFFSET(12) NUMBITS(3) [
/// No Security
EMMC_SEC_NONE = 0,
/// Security Not Used
EMMC_SEC_NOT_USED = 1,
/// SDSC Card (Security Version 1.01)
EMMC_SEC_101 = 2,
/// SDHC Card (Security Version 2.00)
EMMC_SEC_2 = 3,
/// SDXC Card (Security Version 3.xx)
EMMC_SEC_3 = 4,
],
/// Defines the data status after erase, whether it is 0 or 1
DATA_AFTER_ERASE OFFSET(15) NUMBITS(1) [],
/// Write as zero read as don't care
_reserved OFFSET(16) NUMBITS(3) [],
/// Extended security
EX_SECURITY OFFSET(19) NUMBITS(4) [
/// No extended Security
EX_SEC_NONE = 0,
],
/// Spec. Version 3.00 or higher
EMMC_SPEC3 OFFSET(23) NUMBITS(1) [],
/// CMD support
CMD_SUPPORT OFFSET(24) NUMBITS(2) [
CMD_SUPP_SPEED_CLASS = 1,
CMD_SUPP_SET_BLKCNT = 2,
],
/// Write as zero read as don't care
_reserved1 OFFSET(26) NUMBITS(38) [],
],
}
// The CID is Big Endian and the i.MX butchers it by not having CRC
// So the CID appears shifted 8 bits right with first 8 bits reading zero.
register_bitfields! {
u32,
/// The Card Identification (CID) register is 128 bits wide. It contains the card identification
/// information used during the card identification phase. Every individual Read/Write (R/W) card
/// has a unique identification number.
///
/// - CID_RAW32_0 represents the first 32 bits.
CID_RAW32_0 [
/// Identifies the card OEM. The OID is assigned by the SD-3C, LLC
OID_LO OFFSET(0) NUMBITS(8) [],
/// Identifies the card OEM. The OID is assigned by the SD-3C, LLC
OID_HI OFFSET(8) NUMBITS(8) [],
/// Manufacturer ID, assigned by the SD-3C, LLC
MID OFFSET(16) NUMBITS(8) [],
/// reserved
_reserved OFFSET(24) NUMBITS(8) [],
],