sdmmc 0.1.0

A no_std SD/MMC/eMMC driver library for ARM64 platforms
Documentation
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
# SD/MMC ้ฉฑๅŠจๅบ“ ๐Ÿฆ€

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Rust](https://img.shields.io/badge/rust-2024+-orange.svg)](https://www.rust-lang.org/)
[![Platform](https://img.shields.io/badge/platform-ARM64-green.svg)](#)


## ๐Ÿ“‹ ็›ฎๅฝ•
- [้กน็›ฎ็ฎ€ไป‹](#้กน็›ฎ็ฎ€ไป‹)
- [ๅŠŸ่ƒฝ็‰นๆ€ง](#ๅŠŸ่ƒฝ็‰นๆ€ง)
- [ๅฟซ้€Ÿๅผ€ๅง‹](#ๅฟซ้€Ÿๅผ€ๅง‹)
  - [็Žฏๅขƒ่ฆๆฑ‚](#็Žฏๅขƒ่ฆๆฑ‚)
  - [ๅฎ‰่ฃ…ๆญฅ้ชค](#ๅฎ‰่ฃ…ๆญฅ้ชค)
  - [ๅŸบๆœฌไฝฟ็”จ](#ๅŸบๆœฌไฝฟ็”จ)
- [้กน็›ฎ็ป“ๆž„](#้กน็›ฎ็ป“ๆž„)
- [API ๆ–‡ๆกฃ](#api-ๆ–‡ๆกฃ)
  - [ๆ ธๅฟƒ็ป“ๆž„ไฝ“](#ๆ ธๅฟƒ็ป“ๆž„ไฝ“)
  - [ไธป่ฆๆŽฅๅฃ](#ไธป่ฆๆŽฅๅฃ)
  - [ๆ”ฏๆŒ็š„ไผ ่พ“ๆจกๅผ](#ๆ”ฏๆŒ็š„ไผ ่พ“ๆจกๅผ)
- [ไฝฟ็”จ็คบไพ‹](#ไฝฟ็”จ็คบไพ‹)
- [ๆต‹่ฏ•็ป“ๆžœ](#ๆต‹่ฏ•็ป“ๆžœ)
  - [่ฟ่กŒๆต‹่ฏ•](#่ฟ่กŒๆต‹่ฏ•)
  - [ๆต‹่ฏ•ๅŠŸ่ƒฝ่ฏดๆ˜Ž](#ๆต‹่ฏ•ๅŠŸ่ƒฝ่ฏดๆ˜Ž)
- [ๅผ€ๅ‘ๆฟๆ”ฏๆŒ](#ๅผ€ๅ‘ๆฟๆ”ฏๆŒ)
- [ๆ•…้šœๆŽ’้™ค](#ๆ•…้šœๆŽ’้™ค)
  - [ๅธธ่ง้—ฎ้ข˜](#ๅธธ่ง้—ฎ้ข˜)
  - [่ฐƒ่ฏ•ๆŠ€ๅทง](#่ฐƒ่ฏ•ๆŠ€ๅทง)
- [่ฎธๅฏ่ฏ](#่ฎธๅฏ่ฏ)

## ๐Ÿ“– ้กน็›ฎ็ฎ€ไป‹

SD/MMC ้ฉฑๅŠจๅบ“ๆ˜ฏไธ€ไธชไธ“ไธบ ARM64 ๅนณๅฐ่ฎพ่ฎก็š„ Rust SD/MMC ๆŽงๅˆถๅ™จ้ฉฑๅŠจๅบ“๏ผŒๆ”ฏๆŒ eMMCใ€SD ๅ’Œ SDIO ่ฎพๅค‡ใ€‚่ฏฅๅบ“ๆไพ›ไบ†ๅฎŒๆ•ด็š„ๅญ˜ๅ‚จๆŽงๅˆถๅ™จๅŠŸ่ƒฝ๏ผŒๅŒ…ๆ‹ฌๅ‘ฝไปคๅ‘้€ใ€ๆ—ถ้’Ÿ้…็ฝฎใ€ๅ—่ฏปๅ†™ๆ“ไฝœ็ญ‰ใ€‚

ๆœฌ้กน็›ฎ้‡‡็”จ `no_std` ่ฎพ่ฎก๏ผŒๅฎŒๅ…จ้€‚็”จไบŽ่ฃธๆœบๅ’ŒๅตŒๅ…ฅๅผ็Žฏๅขƒ๏ผŒ็‰นๅˆซ้’ˆๅฏน U-Boot ๅผ•ๅฏผๅŠ ่ฝฝ็จ‹ๅบ็Žฏๅขƒ่ฟ›่กŒไบ†ไผ˜ๅŒ–ใ€‚้€š่ฟ‡็ฑปๅž‹ๅฎ‰ๅ…จ็š„ๅฏ„ๅญ˜ๅ™จ่ฎฟ้—ฎ๏ผŒ็กฎไฟไบ†็กฌไปถๆ“ไฝœ็š„ๅฏ้ ๆ€งๅ’Œๅฎ‰ๅ…จๆ€งใ€‚

## โœจ ๅŠŸ่ƒฝ็‰นๆ€ง

- ๐Ÿง  **ๅฎŒๆ•ด็š„ MMC/eMMC ๆ”ฏๆŒ**: ๆ”ฏๆŒ eMMC 4.x/5.x ๆ ‡ๅ‡†๏ผŒๅŒ…ๆ‹ฌ้ซ˜้€Ÿๆจกๅผใ€DDR ๆจกๅผใ€HS200 ๅ’Œ HS400 ๆจกๅผ
- ๐Ÿ’ณ **SD/SDIO ๆ”ฏๆŒ**: ๆ”ฏๆŒ SD 1.0/2.0 ๆ ‡ๅ‡†ๅ’Œ SDIO ่ฎพๅค‡
- ๐Ÿš€ **ๅคš็งๆ•ฐๆฎไผ ่พ“ๆจกๅผ**: ๆ”ฏๆŒ PIO ๅ’Œ DMA ไธค็งๆ•ฐๆฎไผ ่พ“ๆจกๅผ
- ๐Ÿ” **Rockchip ๅนณๅฐไผ˜ๅŒ–**: ้’ˆๅฏน RK3568 ๅนณๅฐ่ฟ›่กŒไบ†ไธ“้—จไผ˜ๅŒ–๏ผŒๆ”ฏๆŒ DWCMSHC ๆŽงๅˆถๅ™จ
- ๐Ÿ”’ **็ฑปๅž‹ๅฎ‰ๅ…จๅฏ„ๅญ˜ๅ™จ่ฎฟ้—ฎ**: ๅŸบไบŽ็›ดๆŽฅๅ†…ๅญ˜่ฎฟ้—ฎๆไพ›็ฑปๅž‹ๅฎ‰ๅ…จ็š„็กฌไปถๅฏ„ๅญ˜ๅ™จๆ“ไฝœ
- ๐Ÿ“ฆ **no_std ๅ…ผๅฎน**: ๅฎŒๅ…จไธไพ่ต–ๆ ‡ๅ‡†ๅบ“๏ผŒ้€‚็”จไบŽ่ฃธๆœบๅ’ŒๅตŒๅ…ฅๅผ็Žฏๅขƒ
- โšก **ARM64 ๆžถๆž„ไผ˜ๅŒ–**: ไธ“้—จ้’ˆๅฏน ARM64 ๅนณๅฐ่ฟ›่กŒไผ˜ๅŒ–
- ๐Ÿ–ฅ **U-Boot ็Žฏๅขƒๆ”ฏๆŒ**: ๅœจ U-Boot ๅผ•ๅฏผ็Žฏๅขƒไธ‹ๆไพ›็จณๅฎšๅฏ้ ็š„ๅญ˜ๅ‚จ่ฎฟ้—ฎๅŠŸ่ƒฝ

## ๐Ÿš€ ๅฟซ้€Ÿๅผ€ๅง‹

### ๐Ÿ›  ็Žฏๅขƒ่ฆๆฑ‚

- Rust 2024 Edition
- ARM64 ๅผ€ๅ‘็Žฏๅขƒ
- ๆ”ฏๆŒ U-Boot ็š„ Rockchip RK3568 ็กฌไปถๅนณๅฐ
- ostool ๅทฅๅ…ท (็”จไบŽๆต‹่ฏ•)

### ๐Ÿ“ฆ ๅฎ‰่ฃ…ๆญฅ้ชค

1. ๅฎ‰่ฃ… `ostool` ไพ่ต–ๅทฅๅ…ท๏ผš

```bash
cargo install ostool
```

2. ๅฐ†้กน็›ฎๆทปๅŠ ๅˆฐ `Cargo.toml`๏ผš

```toml
[dependencies]
sdmmc = "0.1.0"
```

### ๐Ÿ“ ๅŸบๆœฌไฝฟ็”จ

```rust
use sdmmc::emmc::EMmcHost;
use core::ptr::NonNull;

// ๅˆ›ๅปบ EMMC ๆŽงๅˆถๅ™จๅฎžไพ‹
let emmc_addr = 0xfe2e0000; // RK3568 EMMC ๆŽงๅˆถๅ™จๅŸบๅœฐๅ€
let mut emmc = EMmcHost::new(emmc_addr);

// ๅˆๅง‹ๅŒ–ๆŽงๅˆถๅ™จๅ’Œๅญ˜ๅ‚จๅก
match emmc.init() {
    Ok(_) => {
        println!("EMMC ๅˆๅง‹ๅŒ–ๆˆๅŠŸ");
        
        // ่ฏปๅ–ๅญ˜ๅ‚จๅกไฟกๆฏ
        match emmc.get_card_info() {
            Ok(card_info) => {
                println!("ๅก็ฑปๅž‹: {:?}", card_info.card_type);
                println!("ๅฎน้‡: {} MB", card_info.capacity_bytes / (1024 * 1024));
            }
            Err(e) => println!("่Žทๅ–ๅกไฟกๆฏๅคฑ่ดฅ: {:?}", e),
        }
        
        // ่ฏปๅ–ๆ•ฐๆฎๅ—
        let mut buffer: [u8; 512] = [0; 512];
        match emmc.read_blocks(0, 1, &mut buffer) {
            Ok(_) => println!("่ฏปๅ–ๆ•ฐๆฎๅ—ๆˆๅŠŸ"),
            Err(e) => println!("่ฏปๅ–ๆ•ฐๆฎๅ—ๅคฑ่ดฅ: {:?}", e),
        }
    }
    Err(e) => println!("EMMC ๅˆๅง‹ๅŒ–ๅคฑ่ดฅ: {:?}", e),
}
```

## ๐Ÿ“ ้กน็›ฎ็ป“ๆž„

```
src/
โ”œโ”€โ”€ lib.rs              # ไธปๅ…ฅๅฃๅ’Œๆ ธๅฟƒๅŠŸ่ƒฝ
โ”œโ”€โ”€ err.rs              # ้”™่ฏฏ็ฑปๅž‹ๅฎšไน‰
โ””โ”€โ”€ emmc/
    โ”œโ”€โ”€ mod.rs          # EMMC ๆจกๅ—ไธปๆ–‡ไปถ
    โ”œโ”€โ”€ cmd.rs          # ๅ‘ฝไปคๅ‘้€ๅ’Œๅ“ๅบ”ๅค„็†
    โ”œโ”€โ”€ block.rs        # ๅ—่ฏปๅ†™ๆ“ไฝœ
    โ”œโ”€โ”€ regs.rs         # ๅฏ„ๅญ˜ๅ™จ่ฎฟ้—ฎๆŽฅๅฃ
    โ”œโ”€โ”€ constant.rs     # ็กฌไปถๅธธ้‡ๅฎšไน‰
    โ”œโ”€โ”€ clock.rs        # ๆ—ถ้’ŸๆŽงๅˆถๆŽฅๅฃ
    โ”œโ”€โ”€ rockchip.rs     # Rockchip ๅนณๅฐ็‰นๅฎšๅฎž็Žฐ
    โ”œโ”€โ”€ config.rs       # ๅนณๅฐ้…็ฝฎ
    โ”œโ”€โ”€ aux.rs          # ่พ…ๅŠฉๅ‡ฝๆ•ฐ
    โ””โ”€โ”€ info.rs         # ๅกไฟกๆฏๅค„็†

tests/
โ””โ”€โ”€ test.rs             # ้›†ๆˆๆต‹่ฏ•๏ผŒๅŒ…ๅซ EMMC ๅŠŸ่ƒฝๆต‹่ฏ•
```

## ๐Ÿ“š API ๆ–‡ๆกฃ

### ๐Ÿงฑ ๆ ธๅฟƒ็ป“ๆž„ไฝ“

| ็ป“ๆž„ไฝ“ | ๆ่ฟฐ |
|--------|------|
| **`EMmcHost`** | ไธป่ฆ็š„ EMMC ๆŽงๅˆถๅ™จๆŽฅๅฃ็ป“ๆž„ไฝ“๏ผŒๆไพ›ๆ‰€ๆœ‰ๅญ˜ๅ‚จๆŽงๅˆถๅŠŸ่ƒฝ |
| **`EMmcCard`** | ๅญ˜ๅ‚จๅกไฟกๆฏ็ป“ๆž„ไฝ“๏ผŒๅŒ…ๅซๅก็š„่ฏฆ็ป†ไฟกๆฏ |

### ๐Ÿ”ง ไธป่ฆๆŽฅๅฃ

#### ๐ŸŽ› EMMC ๆŽงๅˆถๅ™จ็ฎก็†

| ๆ–นๆณ• | ๆ่ฟฐ |
|------|------|
| `EMmcHost::new(addr)` | ๅˆ›ๅปบๆ–ฐ็š„ EMMC ๆŽงๅˆถๅ™จๅฎžไพ‹ |
| `EMmcHost::init()` | ๅˆๅง‹ๅŒ– EMMC ๆŽงๅˆถๅ™จๅ’Œๅญ˜ๅ‚จๅก |
| `EMmcHost::get_card_info()` | ่Žทๅ–ๅญ˜ๅ‚จๅกไฟกๆฏ |
| `EMmcHost::get_status()` | ่Žทๅ–ๆŽงๅˆถๅ™จ็Šถๆ€ |

#### ๐Ÿ’พ ๆ•ฐๆฎ่ฏปๅ†™ๆ“ไฝœ

| ๆ–นๆณ• | ๆ่ฟฐ |
|------|------|
| `EMmcHost::read_blocks(block_id, blocks, buffer)` | ่ฏปๅ–ๆ•ฐๆฎๅ— |
| `EMmcHost::write_blocks(block_id, blocks, buffer)` | ๅ†™ๅ…ฅๆ•ฐๆฎๅ— |

#### โฑ ๆ—ถ้’Ÿๅ’Œๆ€ป็บฟๆŽงๅˆถ

| ๆ–นๆณ• | ๆ่ฟฐ |
|------|------|
| `EMmcHost::mmc_set_clock(freq)` | ่ฎพ็ฝฎๆ—ถ้’Ÿ้ข‘็އ |
| `EMmcHost::mmc_set_bus_width(width)` | ่ฎพ็ฝฎๆ€ป็บฟๅฎฝๅบฆ |
| `EMmcHost::mmc_set_timing(timing)` | ่ฎพ็ฝฎๆ—ถๅบๆจกๅผ |

### ๐Ÿ”„ ๆ”ฏๆŒ็š„ไผ ่พ“ๆจกๅผ

| ๆจกๅผ | ๆ่ฟฐ |
|------|------|
| **PIO ๆจกๅผ** | ้ป˜่ฎคๅฏ็”จ๏ผŒ้€‚็”จไบŽๅฐๆ•ฐๆฎ้‡ไผ ่พ“ |
| **DMA ๆจกๅผ** | ้€š่ฟ‡ `dma` feature ๅฏ็”จ๏ผŒ้€‚็”จไบŽๅคงๆ•ฐๆฎ้‡ไผ ่พ“ |

## ๐Ÿ’ก ไฝฟ็”จ็คบไพ‹

### ๐Ÿ”ง EMMC ๅˆๅง‹ๅŒ–็คบไพ‹

```rust
use sdmmc::emmc::EMmcHost;
use core::ptr::NonNull;

fn init_emmc_controller(emmc_addr: usize) -> Result<(), &'static str> {
    // ๅˆ›ๅปบ EMMC ๆŽงๅˆถๅ™จๅฎžไพ‹
    let mut emmc = EMmcHost::new(emmc_addr);
    
    // ๅˆๅง‹ๅŒ–ๆŽงๅˆถๅ™จ
    match emmc.init() {
        Ok(_) => {
            println!("EMMC ๆŽงๅˆถๅ™จๅˆๅง‹ๅŒ–ๆˆๅŠŸ");
            
            // ่Žทๅ–ๅกไฟกๆฏ
            match emmc.get_card_info() {
                Ok(card_info) => {
                    println!("ๅก็ฑปๅž‹: {:?}", card_info.card_type);
                    println!("ๅˆถ้€ ๅ•† ID: 0x{:02X}", card_info.manufacturer_id);
                    println!("ๅฎน้‡: {} MB", card_info.capacity_bytes / (1024 * 1024));
                    println!("ๅ—ๅคงๅฐ: {} ๅญ—่Š‚", card_info.block_size);
                }
                Err(e) => {
                    println!("่Žทๅ–ๅกไฟกๆฏๅคฑ่ดฅ: {:?}", e);
                    return Err("่Žทๅ–ๅกไฟกๆฏๅคฑ่ดฅ");
                }
            }
            
            Ok(())
        }
        Err(e) => {
            println!("EMMC ๆŽงๅˆถๅ™จๅˆๅง‹ๅŒ–ๅคฑ่ดฅ: {:?}", e);
            Err("ๆŽงๅˆถๅ™จๅˆๅง‹ๅŒ–ๅคฑ่ดฅ")
        }
    }
}
```

### ๐Ÿ’พ ๆ•ฐๆฎ่ฏปๅ†™็คบไพ‹

```rust
use sdmmc::emmc::EMmcHost;

fn read_write_test(emmc: &mut EMmcHost) -> Result<(), &'static str> {
    // ่ฏปๅ–็ฌฌไธ€ไธชๆ•ฐๆฎๅ—
    let mut read_buffer: [u8; 512] = [0; 512];
    match emmc.read_blocks(0, 1, &mut read_buffer) {
        Ok(_) => {
            println!("่ฏปๅ–ๆ•ฐๆฎๅ—ๆˆๅŠŸ");
            println!("ๅ‰ 16 ๅญ—่Š‚: {:02X?}", &read_buffer[0..16]);
        }
        Err(e) => {
            println!("่ฏปๅ–ๆ•ฐๆฎๅ—ๅคฑ่ดฅ: {:?}", e);
            return Err("่ฏปๅ–ๅคฑ่ดฅ");
        }
    }
    
    // ๅ†™ๅ…ฅๆต‹่ฏ•ๆ•ฐๆฎๅˆฐ็ฌฌไธ‰ไธชๆ•ฐๆฎๅ—
    let mut write_buffer: [u8; 512] = [0; 512];
    // ๅกซๅ……ๆต‹่ฏ•ๆ•ฐๆฎ
    for i in 0..512 {
        write_buffer[i] = (i % 256) as u8;
    }
    
    match emmc.write_blocks(2, 1, &write_buffer) {
        Ok(_) => println!("ๅ†™ๅ…ฅๆ•ฐๆฎๅ—ๆˆๅŠŸ"),
        Err(e) => {
            println!("ๅ†™ๅ…ฅๆ•ฐๆฎๅ—ๅคฑ่ดฅ: {:?}", e);
            return Err("ๅ†™ๅ…ฅๅคฑ่ดฅ");
        }
    }
    
    // ่ฏปๅ›ž้ชŒ่ฏ
    let mut verify_buffer: [u8; 512] = [0; 512];
    match emmc.read_blocks(2, 1, &mut verify_buffer) {
        Ok(_) => {
            // ้ชŒ่ฏๆ•ฐๆฎไธ€่‡ดๆ€ง
            let mut data_match = true;
            for i in 0..512 {
                if write_buffer[i] != verify_buffer[i] {
                    data_match = false;
                    break;
                }
            }
            
            if data_match {
                println!("ๆ•ฐๆฎ้ชŒ่ฏๆˆๅŠŸ");
            } else {
                println!("ๆ•ฐๆฎ้ชŒ่ฏๅคฑ่ดฅ");
                return Err("ๆ•ฐๆฎ้ชŒ่ฏๅคฑ่ดฅ");
            }
        }
        Err(e) => {
            println!("้ชŒ่ฏ่ฏปๅ–ๅคฑ่ดฅ: {:?}", e);
            return Err("้ชŒ่ฏๅคฑ่ดฅ");
        }
    }
    
    Ok(())
}
```

### ๐ŸŽฏ ๅฎŒๆ•ดไฝฟ็”จ็คบไพ‹

```rust
use sdmmc::emmc::EMmcHost;
use core::ptr::NonNull;

fn main() -> Result<(), &'static str> {
    // EMMC ๆŽงๅˆถๅ™จๅŸบๅœฐๅ€ (RK3568)
    let emmc_addr = 0xfe2e0000;
    
    // ๅˆ›ๅปบๆŽงๅˆถๅ™จๅฎžไพ‹
    let mut emmc = EMmcHost::new(emmc_addr);
    
    // ๅˆๅง‹ๅŒ–ๆŽงๅˆถๅ™จ
    println!("ๅˆๅง‹ๅŒ– EMMC ๆŽงๅˆถๅ™จ...");
    if let Err(e) = emmc.init() {
        println!("EMMC ๆŽงๅˆถๅ™จๅˆๅง‹ๅŒ–ๅคฑ่ดฅ: {:?}", e);
        return Err("ๅˆๅง‹ๅŒ–ๅคฑ่ดฅ");
    }
    
    // ่Žทๅ–ๅกไฟกๆฏ
    println!("่Žทๅ–ๅญ˜ๅ‚จๅกไฟกๆฏ...");
    match emmc.get_card_info() {
        Ok(card_info) => {
            println!("ๅก็ฑปๅž‹: {:?}", card_info.card_type);
            println!("ๅˆถ้€ ๅ•† ID: 0x{:02X}", card_info.manufacturer_id);
            println!("ๅฎน้‡: {} MB", card_info.capacity_bytes / (1024 * 1024));
            println!("ๅ—ๅคงๅฐ: {} ๅญ—่Š‚", card_info.block_size);
        }
        Err(e) => {
            println!("่Žทๅ–ๅกไฟกๆฏๅคฑ่ดฅ: {:?}", e);
            return Err("่Žทๅ–ๅกไฟกๆฏๅคฑ่ดฅ");
        }
    }
    
    // ๆ‰ง่กŒ่ฏปๅ†™ๆต‹่ฏ•
    println!("ๆ‰ง่กŒ่ฏปๅ†™ๆต‹่ฏ•...");
    if let Err(e) = read_write_test(&mut emmc) {
        println!("่ฏปๅ†™ๆต‹่ฏ•ๅคฑ่ดฅ: {}", e);
        return Err(e);
    }
    
    println!("ๆ‰€ๆœ‰ๆต‹่ฏ•ๅฎŒๆˆ");
    Ok(())
}

fn read_write_test(emmc: &mut EMmcHost) -> Result<(), &'static str> {
    // ่ฏปๅ–็ฌฌไธ€ไธชๆ•ฐๆฎๅ—
    let mut read_buffer: [u8; 512] = [0; 512];
    match emmc.read_blocks(0, 1, &mut read_buffer) {
        Ok(_) => {
            println!("่ฏปๅ–ๆ•ฐๆฎๅ—ๆˆๅŠŸ");
            println!("ๅ‰ 16 ๅญ—่Š‚: {:02X?}", &read_buffer[0..16]);
        }
        Err(e) => {
            println!("่ฏปๅ–ๆ•ฐๆฎๅ—ๅคฑ่ดฅ: {:?}", e);
            return Err("่ฏปๅ–ๅคฑ่ดฅ");
        }
    }
    
    // ๅ†™ๅ…ฅๆต‹่ฏ•ๆ•ฐๆฎๅˆฐ็ฌฌไธ‰ไธชๆ•ฐๆฎๅ—
    let mut write_buffer: [u8; 512] = [0; 512];
    // ๅกซๅ……ๆต‹่ฏ•ๆ•ฐๆฎ
    for i in 0..512 {
        write_buffer[i] = (i % 256) as u8;
    }
    
    match emmc.write_blocks(2, 1, &write_buffer) {
        Ok(_) => println!("ๅ†™ๅ…ฅๆ•ฐๆฎๅ—ๆˆๅŠŸ"),
        Err(e) => {
            println!("ๅ†™ๅ…ฅๆ•ฐๆฎๅ—ๅคฑ่ดฅ: {:?}", e);
            return Err("ๅ†™ๅ…ฅๅคฑ่ดฅ");
        }
    }
    
    // ่ฏปๅ›ž้ชŒ่ฏ
    let mut verify_buffer: [u8; 512] = [0; 512];
    match emmc.read_blocks(2, 1, &mut verify_buffer) {
        Ok(_) => {
            // ้ชŒ่ฏๆ•ฐๆฎไธ€่‡ดๆ€ง
            let mut data_match = true;
            for i in 0..512 {
                if write_buffer[i] != verify_buffer[i] {
                    data_match = false;
                    break;
                }
            }
            
            if data_match {
                println!("ๆ•ฐๆฎ้ชŒ่ฏๆˆๅŠŸ");
            } else {
                println!("ๆ•ฐๆฎ้ชŒ่ฏๅคฑ่ดฅ");
                return Err("ๆ•ฐๆฎ้ชŒ่ฏๅคฑ่ดฅ");
            }
        }
        Err(e) => {
            println!("้ชŒ่ฏ่ฏปๅ–ๅคฑ่ดฅ: {:?}", e);
            return Err("้ชŒ่ฏๅคฑ่ดฅ");
        }
    }
    
    Ok(())
}
```

## ๐Ÿงช ๆต‹่ฏ•็ป“ๆžœ

### โ–ถ๏ธ ่ฟ่กŒๆต‹่ฏ•

#### ๐Ÿ”Œ ๅธฆU-Boot็Žฏๅขƒ็š„็กฌไปถๆต‹่ฏ•

```bash
# ๅธฆuboot็š„ๅผ€ๅ‘ๆฟๆต‹่ฏ•
make uboot
```

### ๆต‹่ฏ•่พ“ๅ‡บ็คบไพ‹

<details>
<summary>็‚นๅ‡ปๆŸฅ็œ‹ๆต‹่ฏ•็ป“ๆžœ</summary>

```
     _____                                         __
    / ___/ ____   ____ _ _____ _____ ___   ____ _ / /
    \__ \ / __ \ / __ `// ___// ___// _ \ / __ `// / 
   ___/ // /_/ // /_/ // /   / /   /  __// /_/ // /  
  /____// .___/ \__,_//_/   /_/    \___/ \__,_//_/   
/_/                                           

Version                       : 0.12.2
Platfrom                      : RK3588 OPi 5 Plus
Start CPU                     : 0x0
FDT                           : 0xffff900000f29000
๐Ÿ› 0.000ns    [sparreal_kernel::driver:16] add registers
๐Ÿ› 0.000ns    [rdrive::probe::fdt:168] Probe [interrupt-controller@fe600000]->[GICv3]
๐Ÿ› 0.000ns    [somehal::arch::mem::mmu:181] Map `iomap       `: RW- | [0xffff9000fe600000, 0xffff9000fe610000) -> [0xfe600000, 0xfe610000)
๐Ÿ› 0.000ns    [somehal::arch::mem::mmu:181] Map `iomap       `: RW- | [0xffff9000fe680000, 0xffff9000fe780000) -> [0xfe680000, 0xfe780000)
๐Ÿ› 0.000ns    [rdrive::probe::fdt:168] Probe [timer]->[ARMv8 Timer]
๐Ÿ› 0.000ns    [sparreal_rt::arch::timer:78] ARMv8 Timer IRQ: IrqConfig { irq: 0x1e, trigger: LevelHigh, is_private: true }
๐Ÿ› 0.000ns    [rdrive::probe::fdt:168] Probe [psci]->[ARM PSCI]
๐Ÿ› 0.000ns    [spar:power:76] PCSI [Smc]
๐Ÿ› 0.000ns    [sparreal_kernel::irq:39] [GICv3](405) open
๐Ÿ” 0.000ns    [arm_gic_driver::version::v3:342] Initializing GICv3 Distributor@0xffff9000fe600000, security state: NonSecure...
๐Ÿ” 0.000ns    [arm_gic_driver::version::v3:356] GICv3 Distributor disabled
๐Ÿ” 0.000ns    [arm_gic_driver::version::v3:865] CPU interface initialization for CPU: 0x0
๐Ÿ” 0.000ns    [arm_gic_driver::version::v3:921] CPU interface initialized successfully
๐Ÿ› 0.000ns    [sparreal_kernel::irq:64] [GICv3](405) init cpu: CPUHardId(0)
๐Ÿ› 0.000ns    [sparreal_rt::arch::timer:30] ARMv8 Timer: Enabled
๐Ÿ› 17.681s    [sparreal_kernel::irq:136] Enable irq 0x1e on chip 405
๐Ÿ› 17.681s    [sparreal_kernel::hal_al::run:33] Driver initialized
๐Ÿ› 18.304s    [rdrive:132] probe pci devices
begin test
Run test: test_platform
๐Ÿ’ก 18.358s    [test::tests:243] Found node: mmc@fe2e0000
๐Ÿ’ก 18.359s    [test::tests:248๐Ÿ’ก 18.390s    [test::tests:243] Found node: clock-controller@fd7c0000
๐Ÿ’ก 18.390s    [teests:48] clk ptr: 0xffff9000fd7c0000
๐Ÿ’ก 18.395s    [test::tests:53] emmc addr: 0xffff9000fe2e0000
๐Ÿ’ก 18.396s    [test::tests:54] clk addr: 0xffff9000fd7c0000
๐Ÿ’ก 18.397s    [sdmmc::emmc:74] EMMC Controller created: EMMC Controller { base_addr: 0xffff9000fe2e0000, card: None, caps: 0x226dc881, clock_base: 200000000 }
๐Ÿ’ก 18.398s    [sdmmc::emmc:91] Init EMMC Controller
๐Ÿ› 18.399s    [sdmmc::emmc:100] Card inserted: true
๐Ÿ’ก 18.399s    [sdmmc::emmc:105] EMMC Version: 0x5
๐Ÿ’ก 18.400s    [sdmmc::emmc:108] EMMC Capabilities 1: 0b100010011011011100100010000001
๐Ÿ’ก 18.401s    [sdmmc::emmc:114] EMMC Capabilities 2: 0b1000000000000000000000000111
๐Ÿ’ก 18.402s    [sdmmc::emmc:162] voltage range: 0x60000, 0x12
๐Ÿ’ก 18.402s    [sdmmc::emmc::rockchip:145] EMMC Power Control: 0xd
๐Ÿ› 18.413s    [sdmmc::emmc:974] Bus width set to 1
๐Ÿ› 18.414s    [sdmmc::emmc::rockchip:318] card_clock: 0, bus_width: 1, timing: 0
๐Ÿ’ก 18.415s    [sdmmc::emmc::rockchip:163] EMMC Clock Control: 0x0
๐Ÿ› 18.415s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x7
๐Ÿ’ก 18.416s    [sdmmc::emmc::rockchip:275] Clock 0x7
๐Ÿ› 18.417s    [sdmmc::emmc::rockchip:353] EMMC Host Control 1: 0x0
๐Ÿ› 18.417s    [sdmmc::emmc::rockchip:307] EMMC Host Control 2: 0x0
๐Ÿ› 18.418s    [sdmmc::emmc::rockchip:318] card_clock: 400000, bus_width: 1, timing: 0
๐Ÿ› 18.419s    [rk3588_clk:111] Setting clk_id 314 to rate 400000
๐Ÿ› 18.420s    [rk3588_clk:152] CCLK_EMMC: src_clk 2, div 60, new_value 0xbb00, final_value 0xff00bb00
๐Ÿ› 18.421s    [rk3588_clk:73] Getting clk_id 314
๐Ÿ’ก 18.421s    [sdmmc::emmc::rockchip:32] input_clk: 400000
๐Ÿ’ก 18.422s    [sdmmc::emmc::rockchip:42] EMMC Clock Mul: 0
๐Ÿ’ก 18.423s    [sdmmc::emmc::rockchip:78] EMMC Clock Divisor: 0x0
๐Ÿ› 18.423s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x7
๐Ÿ’ก 18.424s    [sdmmc::emmc::rockchip:163] EMMC Clock Control: 0x2
๐Ÿ› 18.425s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x7
๐Ÿ’ก 18.426s    [sdmmc::emmc::rockchip:275] Clock 0x7
๐Ÿ› 18.426s    [sdmmc::emmc::rockchip:353] EMMC Host Control 1: 0x0
๐Ÿ› 18.427s    [sdmmc::emmc::rockchip:307] EMMC Host Control 2: 0x0
๐Ÿ› 18.428s    [sdmmc::emmc::rockchip:318] card_clock: 400000, bus_width: 1, timing: 0
๐Ÿ› 18.428s    [rk3588_clk:111] Setting clk_id 314 to rate 400000
๐Ÿ› 18.429s    [rk3588_clk:152] CCLK_EMMC: src_clk 2, div 60, new_value 0xbb00, final_value 0xff00bb00
๐Ÿ› 18.430s    [rk3588_clk:73] Getting clk_id 314
๐Ÿ’ก 18.431s    [sdmmc::emmc::rockchip:32] input_clk: 400000
๐Ÿ’ก 18.431s    [sdmmc::emmc::rockchip:42] EMMC Clock Mul: 0
๐Ÿ’ก 18.432s    [sdmmc::emmc::rockchip:78] EMMC Clock Divisor: 0x0
๐Ÿ› 18.433s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x7
๐Ÿ’ก 18.434s    [sdmmc::emmc::rockchip:163] EMMC Clock Control: 0x2
๐Ÿ› 18.434s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x7
๐Ÿ’ก 18.435s    [sdmmc::emmc::rockchip:275] Clock 0x7
๐Ÿ› 18.436s    [sdmmc::emmc::rockchip:353] EMMC Host Control 1: 0x0
๐Ÿ› 18.436s    [sdmmc::emmc::rockchip:307] EMMC Host Control 2: 0x0
๐Ÿ’ก 18.437s    [sdmmc::emmc:226] eMMC initialization started
๐Ÿ” 18.438s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x0, arg=0x0, resp_type=0x0, command=0x0
๐Ÿ” 18.439s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.440s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.440s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ’ก 18.453s    [sdmmc::emmc::cmd:416] eMMC reset complete
๐Ÿ” 18.454s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x1, arg=0x0, resp_type=0x1, command=0x102
๐Ÿ” 18.455s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.455s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.456s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ’ก 18.469s    [sdmmc::emmc::cmd:431] eMMC first CMD1 response (no args): 0xff8080
๐Ÿ” 18.470s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x1, arg=0x40060000, resp_type=0x1, command=0x102
๐Ÿ” 18.471s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.472s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.472s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ’ก 18.475s    [sdmmc::emmc::cmd:453] CMD1 response raw: 0xff8080
๐Ÿ’ก 18.476s    [sdmmc::emmc::cmd:454] eMMC CMD1 response: 0xff8080
๐Ÿ” 18.477s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x1, arg=0x40060000, resp_type=0x1, command=0x102
๐Ÿ” 18.479s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.479s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.480s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ’ก 18.483s    [sdmmc::emmc::cmd:453] CMD1 response raw: 0xff8080
๐Ÿ’ก 18.484s    [sdmmc::emmc::cmd:454] eMMC CMD1 response: 0xff8080
๐Ÿ” 18.485s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x1, arg=0x40060000, resp_type=0x1, command=0x102
๐Ÿ” 18.486s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.487s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.488s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ’ก 18.491s    [sdmmc::emmc::cmd:453] CMD1 response raw: 0xff8080
๐Ÿ’ก 18.491s    [sdmmc::emmc::cmd:454] eMMC CMD1 response: 0xff8080
๐Ÿ” 18.493s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x1, arg=0x40060000, resp_type=0x1, command=0x102
๐Ÿ” 18.494s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.495s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.496s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ’ก 18.498s    [sdmmc::emmc::cmd:453] CMD1 response raw: 0xff8080
๐Ÿ’ก 18.499s    [sdmmc::emmc::cmd:454] eMMC CMD1 response: 0xff8080
๐Ÿ” 18.501s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x1, arg=0x40060000, resp_type=0x1, command=0x102
๐Ÿ” 18.502s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.503s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.503s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ’ก 18.506s    [sdmmc::emmc::cmd:453] CMD1 response raw: 0xff8080
๐Ÿ’ก 18.507s    [sdmmc::emmc::cmd:454] eMMC CMD1 response: 0xff8080
๐Ÿ” 18.508s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x1, arg=0x40060000, resp_type=0x1, command=0x102
๐Ÿ” 18.510s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.510s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.511s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ’ก 18.514s    [sdmmc::emmc::cmd:453] CMD1 response raw: 0xc0ff8080
๐Ÿ’ก 18.514s    [sdmmc::emmc::cmd:454] eMMC CMD1 response: 0xc0ff8080
๐Ÿ’ก 18.515s    [sdmmc::emmc::cmd:478] eMMC initialization status: true
๐Ÿ› 18.517s    [sdmmc::emmc::cmd:486] Clock control before CMD2: 0x7, stable: true
๐Ÿ” 18.518s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x2, arg=0x0, resp_type=0x7, command=0x209
๐Ÿ” 18.519s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.520s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.520s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ’ก 18.523s    [sdmmc::emmc::cmd:69] eMMC response: 0x45010044 0x56343033 0x3201bb29 0x7a017c00
๐Ÿ” 18.524s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x3, arg=0x10000, resp_type=0x15, command=0x31a
๐Ÿ” 18.525s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.526s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.527s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ” 18.529s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x9, arg=0x10000, resp_type=0x7, command=0x909
๐Ÿ” 18.530s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.531s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.532s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ’ก 18.535s    [sdmmc::emmc::cmd:69] eMMC response: 0xd00f0032 0x8f5903ff 0xffffffef 0x8a404000
๐Ÿ› 18.536s    [sdmmc::emmc:256] eMMC CSD version: 4
๐Ÿ” 18.536s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x7, arg=0x10000, resp_type=0x15, command=0x71a
๐Ÿ” 18.537s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.538s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.539s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ› 18.541s    [sdmmc::emmc:327] cmd7: 0x700
๐Ÿ” 18.542s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x6, arg=0x3b90100, resp_type=0x1d, command=0x61b
๐Ÿ” 18.543s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.544s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.545s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ› 18.547s    [sdmmc::emmc:1010] cmd6 0x800
๐Ÿ” 18.548s    [sdmmc::emmc::cmd:244] Sending command: opcode=0xd, arg=0x10000, resp_type=0x15, command=0xd1a
๐Ÿ” 18.549s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.550s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.550s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ” 18.553s    [sdmmc::emmc::cmd:583] cmd_d 0x900
๐Ÿ› 18.554s    [sdmmc::emmc::rockchip:318] card_clock: 400000, bus_width: 1, timing: 1
๐Ÿ› 18.555s    [rk3588_clk:111] Setting clk_id 314 to rate 400000
๐Ÿ› 18.555s    [rk3588_clk:152] CCLK_EMMC: src_clk 2, div 60, new_value 0xbb00, final_value 0xff00bb00
๐Ÿ› 18.556s    [rk3588_clk:73] Getting clk_id 314
๐Ÿ’ก 18.557s    [sdmmc::emmc::rockchip:32] input_clk: 400000
๐Ÿ’ก 18.558s    [sdmmc::emmc::rockchip:42] EMMC Clock Mul: 0
๐Ÿ’ก 18.558s    [sdmmc::emmc::rockchip:78] EMMC Clock Divisor: 0x0
๐Ÿ› 18.559s    [sdmmc::emmc::rockchip:106] EMMC Clocckchip:106] EMMC Clock Control: 0x7
๐Ÿ’ก 18.561s    [sdmmc::emmc::rockchip:275] Clock 0x7
๐Ÿ› 18.562s    [sdmmc::emmc::rockchip:353] EMMC Host Control 1: 0x4
๐Ÿ› 18.563s    [sdmmc::emmc::rockchip:307] EMMC Host Control 2: 0x2
๐Ÿ› 18.563s    [sdmmc::emmc::rockchip:318] card_clock: 52000000, bus_width: 1, timing: 1
๐Ÿ› 18.564s    [rk3588_clk:111] Setting clk_id 314 to rate 52000000
๐Ÿ› 18.565s    [rk3588_clk:152] CCLK_EMMC: src_clk 1, div 23, new_value 0x5600, final_value 0xff005600
๐Ÿ› 18.566s    [rk3588_clk:73] Getting clk_id 314
๐Ÿ’ก 18.567s    [sdmmc::emmc::rockchip:32] input_clk: 65217391
๐Ÿ’ก 18.567s    [sdmmc::emmc::rockchip:42] EMMC Clock Mul: 0
๐Ÿ’ก 18.568s    [sdmmc::emmc::rockchip:78] EMMC Clock Divisor: 0x1
๐Ÿ› 18.569s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x107
๐Ÿ’ก 18.569s    [sdmmc::emmc::rockchip:163] EMMC Clock Control: 0x2
๐Ÿ› 18.570s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x7
๐Ÿ’ก 18.571s    [sdmmc::emmc::rockchip:275] Clock 0x7
๐Ÿ› 18.571s    [sdmmc::emmc::rockchip:353] EMMC Host Control 1: 0x4
๐Ÿ› 18.572s    [sdmmc::emmc::rockchip:307] EMMC Host Control 2: 0x2
๐Ÿ” 18.573s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x8, arg=0x0, resp_type=0x15, command=0x83a
๐Ÿ” 18.574s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.575s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.575s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ” 18.576s    [sdmmc::emmc::cmd:339] Data transfer: cmd.data_present=true
๐Ÿ” 18.577s    [sdmmc::emmc:354] EXT_CSD: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 3, 0, 144, 23, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 146, 4, 0, 7, 0, 0, 2, 0, 0, 21, 31, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 13, 0, 0, 0, 0, 8, 0, 2, 0, 87, 31, 10, 3, 221, 221, 0, 0, 0, 10, 10, 10, 10, 10, 10, 1, 0, 224, 163, 3, 23, 19, 23, 7, 7, 16, 1, 3, 1, 8, 32, 0, 7, 166, 166, 85, 3, 0, 0, 0, 0, 221, 221, 0, 1, 255, 0, 0, 0, 0, 1, 25, 25, 0, 16, 0, 0, 221, 82, 67, 51, 48, 66, 48, 48, 55, 81, 80, 8, 8, 8, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 16, 0, 3, 3, 0, 5, 3, 3, 1, 63, 63, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0]
๐Ÿ› 18.591s    [sdmmc::emmc:412] Boot partition size: 0x400000
๐Ÿ› 18.591s    [sdmmc::emmc:413] RPMB partition size: 0x1000000
๐Ÿ› 18.592s    [sdmmc::emmc:434] GP partition sizes: [0, 0, 0, 0]
๐Ÿ” 18.593s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x8, arg=0x0, resp_type=0x15, command=0x83a
๐Ÿ” 18.594s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.595s    [sdmmc::emmc::cmd:263] Response Status: 0b100001
๐Ÿ” 18.595s    [sdmmc::emmc::cmd:288] Command completed: status=0b100001
๐Ÿ” 18.596s    [sdmmc::emmc::cmd:339] Data transfer: cmd.data_present=true
๐Ÿ” 18.597s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x8, arg=0x0, resp_type=0x15, command=0x83a
๐Ÿ” 18.598s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.599s    [sdmmc::emmc::cmd:263] Response Status: 0b100001
๐Ÿ” 18.599s    [sdmmc::emmc::cmd:288] Command completed: status=0b100001
๐Ÿ” 18.600s    [sdmmc::emmc::cmd:339] Data transfer: cmd.data_present=true
๐Ÿ” 18.601s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x6, arg=0x3b70200, resp_type=0x1d, command=0x61b
๐Ÿ” 18.602s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.603s    [sdmmc::emmc::cmd:263] Response Status: 0b11
๐Ÿ” 18.604s    [sdmmc::emmc::cmd:288] Command completed: status=0b11
๐Ÿ› 18.604s    [sdmmc::emmc:1010] cmd6 0x800
๐Ÿ” 18.605s    [sdmmc::emmc::cmd:244] Sending command: opcode=0xd, arg=0x10000, resp_type=0x15, command=0xd1a
๐Ÿ” 18.606s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.607s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.608s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ” 18.608s    [sdmmc::emmc::cmd:583] cmd_d 0x900
๐Ÿ› 18.609s    [sdmmc::emmc:974] Bus width set to 8
๐Ÿ› 18.609s    [sdmmc::emmc::rockchip:318] card_clock: 52000000, bus_width: 8, timing: 1
๐Ÿ› 18.610s    [rk3588_clk:111] Setting clk_id 314 to rate 52000000
๐Ÿ› 18.611s    [rk3588_clk:152] CCLK_EMMC: src_clk 1, div 23, new_value 0x5600, final_value 0xff005600
๐Ÿ› 18.612s    [rk3588_clk:73] Getting clk_id 314
๐Ÿ’ก 18.613s    [sdmmc::emmc::rockchip:32] input_clk: 65217391
๐Ÿ’ก 18.613s    [sdmmc::emmc::rockchip:42] EMMC Clock Mul: 0
๐Ÿ’ก 18.614s    [sdmmc::emmc::rockchip:78] EMMC Clock Divisor: 0x1
๐Ÿ› 18.615s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x107
๐Ÿ’ก 18.616s    [sdmmc::emmc::rockchip:163] EMMC Clock Control: 0x2
๐Ÿ› 18.616s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x7
๐Ÿ’ก 18.617s    [sdmmc::emmc::rockchip:275] Clock 0x7
๐Ÿ› 18.618s    [sdmmc::emmc::rockchip:353] EMMC Host Control 1: 0x24
๐Ÿ› 18.618s    [sdmmc::emmc::rockchip:307] EMMC Host Control 2: 0x2
๐Ÿ” 18.619s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x8, arg=0x0, resp_type=0x15, command=0x83a
๐Ÿ” 18.620s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.621s    [sdmmc::emmc::cmd:263] Response Status: 0b1
๐Ÿ” 18.622s    [sdmmc::emmc::cmd:288] Command completed: status=0b1
๐Ÿ” 18.622s    [sdmmc::emmc::cmd:339] Data transfer: cmd.data_present=true
๐Ÿ” 18.623s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x6, arg=0x3b90200, resp_type=0x1d, command=0x61b
๐Ÿ” 18.624s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.625s    [sdmmc::emmc::cmd:263] Response Status: 0b11
๐Ÿ” 18.626s    [sdmmc::emmc::cmd:288] Command completed: status=0b11
๐Ÿ› 18.626s    [sdmmc::emmc:1010] cmd6 0x800
๐Ÿ› 18.628s    [sdmmc::emmc::rockchip:318] card_clock: 52000000, bus_width: 8, timing: 9
๐Ÿ› 18.629s    [rk3588_clk:111] Setting clk_id 314 to rate 52000000
๐Ÿ› 18.630s    [rk3588_clk:152] CCLK_EMMC: src_clk 1, div 23, new_value 0x5600, final_value 0xff005600
๐Ÿ› 18.631s    [rk3588_clk:73] Getting clk_id 314
๐Ÿ’ก 18.631s    [sdmmc::emmc::rockchip:32] input_clk: 65217391
๐Ÿ’ก 18.632s    [sdmmc::emmc::rockchip:42] EMMC Clock Mul: 0
๐Ÿ’ก 18.633s    [sdmmc::emmc::rockchip:78] EMMC Clock Divisor: 0x1
๐Ÿ› 18.633s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x107
๐Ÿ’ก 18.634s    [sdmmc::emmc::rockchip:163] EMMC Clock Control: 0x2
๐Ÿ› 18.635s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x7
๐Ÿ’ก 18.636s    [sdmmc::emmc::rockchip:275] Clock 0x7
๐Ÿ› 18.636s    [sdmmc::emmc::rockchip:353] EMMC Host Control 1: 0x24
๐Ÿ’ก 18.637s    [sdmmc::emmc::rockchip:145] EMMC Power Control: 0xb
๐Ÿ› 18.648s    [sdmmc::emmc::rockchip:307] EMMC Host Control 2: 0x1b
๐Ÿ› 18.648s    [sdmmc::emmc::rockchip:318] card_clock: 200000000, bus_width: 8, timing: 9
๐Ÿ› 18.649s    [rk3588_clk:111] Setting clk_id 314 to rate 200000000
๐Ÿ› 18.650s    [rk3588_clk:152] CCLK_EMMC: src_clk 1, div 6, new_value 0x4500, final_value 0xff004500
๐Ÿ› 18.651s    [rk3588_clk:73] Getting clk_id 314
๐Ÿ’ก 18.652s    [sdmmc::emmc::rockchip:32] input_clk: 250000000
๐Ÿ’ก 18.652s    [sdmmc::emmc::rockchip:42] EMMC Clock Mul: 0
๐Ÿ’ก 18.653s    [sdmmc::emmc::rockchip:78] EMMC Clock Divisor: 0x1
๐Ÿ› 18.654s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x107
๐Ÿ’ก 18.654s    [sdmmc::emmc::rockchip:163] EMMC Clock Control: 0x2
๐Ÿ› 18.657s    [sdmmc::emmc::rockchip:106] EMMC Clock Control: 0x7
๐Ÿ’ก 18.658s    [sdmmc::emmc::rockchip:275] Clock 0x7
๐Ÿ› 18.658s    [sdmmc::emmc::rockchip:353] EMMC Host Control 1: 0x24
๐Ÿ’ก 18.659s    [sdmmc::emmc::rockchip:145] EMMC Power Control: 0xb
๐Ÿ› 18.670s    [sdmmc::emmc::rockchip:307] EMMC Host Control 2: 0x1b
๐Ÿ” 18.671s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.672s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.673s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.673s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.674s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.675s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.676s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.677s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.677s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.678s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.679s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.680s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.681s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.681s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.683s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.683s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.684s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.685s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.686s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.687s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.687s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.688s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.689s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.690s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.691s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.692s    [sdmmc::emmc::cmd:24resp_type=0x15, command=0x153a
๐Ÿ” 18.693s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.693s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.694s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.695s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.696s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.697s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.697s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.698s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.699s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.700s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.701s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.702s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.703s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.703s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.704s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.705s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.706s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.707s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.707s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.708s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.709s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.710s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.711s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.712s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.713s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.713s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.714s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.715s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.716s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.717s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.717s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.718s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.719s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.720s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.721s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.722s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.723s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.723s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.724s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 1    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.726s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.727s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.727s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.728s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.729s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.730s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.731s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.732s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.733s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.733s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.734s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.735s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.736s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.737s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.738s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.738s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.739s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.740s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.741s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.742s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.743s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.743s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.744s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.745s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.746s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.747s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.748s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.748s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.749s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.750s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.751s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.752s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.753s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.754s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.754s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.755s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.756s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.757s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.758s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.758s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.759s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.760s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.761s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.762s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.763s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.764s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.764s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.765s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.766s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.767s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.768s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.768s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.769s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.770s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.771s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
๐Ÿ” 18.772s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x15, arg=0x0, resp_type=0x15, command=0x153a
๐Ÿ” 18.773s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.774s    [sdmmc::emmc::cmd:263] Response Status: 0b100000
๐Ÿ” 18.774s    [sdmmc::emmc::cmd:nse Status: 0b100000
๐Ÿ” 18.778s    [sdmmc::emmc::cmd:288] Command completed: status=0b100000
ully
SD card initialization successful!
Card type: MmcHc
Manufacturer ID: 0x45
Capacity: 0 MB
Block size: 512 bytes
Attempting to read first block...
๐Ÿ” 18.780s    [sdmmc::emmc::block:365] pio read_blocks: block_id = 5034498, blocks = 1
๐Ÿ” 18.781s    [sdmmc::emmc::block:383] Reading 1 blocks starting at address: 0x4cd202
๐Ÿ” 18.782s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x11, arg=0x4cd202, resp_type=0x15, command=0x113a
๐Ÿ” 18.783s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.784s    [sdmmc::emmc::cmd:263] Response Status: 0b100001
๐Ÿ” 18.785s    [sdmmc::emmc::cmd:288] Command completed: status=0b100001
๐Ÿ” 18.786s    [sdmmc::emmc::cmd:339] Data transfer: cmd.data_present=true
Successfully read first block!
First 16 bytes of first block: [40, E2, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 8F, D2, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 40, DB, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 80, E0, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, C0, EC, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 40, E9, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 80, EE, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, E4, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, C0, DE, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 40, F0, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, DD, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 80, E7, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 40, A9, D5, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 40, 5B, D7, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 80, 50, D6, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 40, 4E, D6, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 60, 4F, D6, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 80, CE, CD, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 40, 48, DF, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 8E, D2, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 60, D6, CD, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 90, D2, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, A0, 09, DD, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 80, B9, E1, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, EB, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 60, DD, E0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 20, D1, CD, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, E0, 7E, E2, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 20, A8, D5, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 40, D7, CD, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 91, D2, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, C0, E5, D0, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00]
Testing write and read back...
๐Ÿ” 18.804s    [sdmmc::emmc::block:417] pio write_blocks: block_id = 3, blocks = 1
๐Ÿ” 18.805s    [sdmmc::emmc::block:439] Writing 1 blocks starting at address: 0x3
๐Ÿ” 18.806s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x18, arg=0x3, resp_type=0x15, command=0x183a
๐Ÿ” 18.807s    [sdmmc::emmc::cmd:263] Response Status: 0b10000
๐Ÿ” 18.808s    [sdmmc::emmc::cmd:263] Response Status: 0b10001
๐Ÿ” 18.808s    [sdmmc::emmc::cmd:288] Command completed: status=0b10001
๐Ÿ” 18.809s    [sdmmc::emmc::cmd:339] Data transfer: cmd.data_present=true
Successfully wrote to block 3!
๐Ÿ” 18.811s    [sdmmc::emmc::block:365] pio read_blocks: block_id = 3, blocks = 1
๐Ÿ” 18.812s    [sdmmc::emmc::block:383] Reading 1 blocks starting at address: 0x3
๐Ÿ” 18.813s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x11, arg=0x3, resp_type=0x15, command=0x113a
๐Ÿ” 18.814s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.815s    [sdmmc::emmc::cmd:263] Response Status: 0b100001
๐Ÿ” 18.816s    [sdmmc::emmc::cmd:288] Command completed: status=0b100001
๐Ÿ” 18.816s    [sdmmc::emmc::cmd:339] Data transfer: cmd.data_present=true
Successfully read back block 3!
First 16 bytes of read block: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Data verification successful: written and read data match perfectly!
Testing multi-block read...
๐Ÿ” 18.831s    [sdmmc::emmc::block:365] pio read_blocks: block_id = 200, blocks = 4
๐Ÿ” 18.832s    [sdmmc::emmc::block:383] Reading 4 blocks starting at address: 0xc8
๐Ÿ” 18.833s    [sdmmc::emmc::cmd:244] Sending command: opcode=0x12, arg=0xc8, resp_type=0x15, command=0x123a
๐Ÿ” 18.834s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.835s    [sdmmc::emmc::cmd:263] Response Status: 0b100001
๐Ÿ” 18.835s    [sdmmc::emmc::cmd:288] Command completed: status=0b100001
๐Ÿ” 18.836s    [sdmmc::emmc::cmd:339] Data transfer: cmd.data_present=true
๐Ÿ” 18.837s    [sdmmc::emmc::cmd:244] Sending command: opcode=0xc, arg=0x0, resp_type=0x1d, command=0xc1b
๐Ÿ” 18.838s    [sdmmc::emmc::cmd:263] Response Status: 0b0
๐Ÿ” 18.839s    [sdmmc::emmc::cmd:263] Response Status: 0b11
๐Ÿ” 18.840s    [sdmmc::emmc::cmd:288] Command completed: status=0b11
Successfully read 4 blocks starting at block address 200!
First 16 bytes of first block: [A0, 2F, 00, B9, A1, 8B, 0D, A9, A0, 07, 42, A9, A0, 07, 04, A9]
First 16 bytes of last block: [B5, 01, BD, 01, C6, 01, CE, 01, D6, 01, DE, 01, E7, 01, EF, 01]
SD card test complete
๐Ÿ’ก 18.843s    [test::tests:58] test uboot
test test_platform passed
All tests passed
```

</details>

### ๐Ÿ“‹ ๆต‹่ฏ•ๅŠŸ่ƒฝ่ฏดๆ˜Ž

ๆต‹่ฏ•็จ‹ๅบไผšๆ‰ง่กŒไปฅไธ‹ๆ“ไฝœ๏ผš

1. **่ฎพๅค‡ๆ ‘่งฃๆž**: ไปŽ่ฎพๅค‡ๆ ‘ไธญๆŸฅๆ‰พ EMMC ๆŽงๅˆถๅ™จ็กฌไปถ่Š‚็‚นๅœฐๅ€
2. **EMMC ๆŽงๅˆถๅ™จๅˆๅง‹ๅŒ–**: ๅˆๅง‹ๅŒ– DWCMSHC EMMC ๆŽงๅˆถๅ™จ
3. **ๅญ˜ๅ‚จๅกๆฃ€ๆต‹**: ๆฃ€ๆต‹ๅนถๅˆๅง‹ๅŒ–่ฟžๆŽฅ็š„ eMMC ๅญ˜ๅ‚จๅก
4. **ๅŸบๆœฌ่ฏปๅ†™ๆต‹่ฏ•**:
   - ่ฏปๅ–ๅญ˜ๅ‚จๅกไฟกๆฏ
   - ่ฏปๅ–ๆ•ฐๆฎๅ—
   - ๅ†™ๅ…ฅๆ•ฐๆฎๅ—ๅนถ้ชŒ่ฏ
   - ๅคšๅ—่ฏปๅ–ๆต‹่ฏ•
5. **ๆ•ฐๆฎไธ€่‡ดๆ€ง้ชŒ่ฏ**: ้ชŒ่ฏๅ†™ๅ…ฅๅ’Œ่ฏปๅ–็š„ๆ•ฐๆฎๆ˜ฏๅฆไธ€่‡ด

**ๆณจๆ„**: ๅฎŒๆ•ดๆต‹่ฏ•้œ€่ฆๆ”ฏๆŒ ARM ็กฌไปถๅนณๅฐๅ’Œ U-Boot ็Žฏๅขƒ


## ๐Ÿ“„ ่ฎธๅฏ่ฏ

ๆœฌ้กน็›ฎ้‡‡็”จ MIT ่ฎธๅฏ่ฏ - ๆŸฅ็œ‹ [LICENSE](LICENSE) ๆ–‡ไปถไบ†่งฃ่ฏฆๆƒ