1.1 --- a/pkg/devices/lib/msc/src/common.cc Tue Apr 30 01:34:57 2024 +0200
1.2 +++ b/pkg/devices/lib/msc/src/common.cc Tue Apr 30 01:37:52 2024 +0200
1.3 @@ -557,6 +557,10 @@
1.4 continue;
1.5 }
1.6 while (!(r3.ocr & Ocr_card_powered_up));
1.7 +
1.8 + // Set the OCR in the current card since we need the CCS indicator.
1.9 +
1.10 + _cards[_num_cards].ocr = ocr;
1.11 }
1.12
1.13 void
1.14 @@ -593,8 +597,6 @@
1.15 struct R2 r2;
1.16 struct R6 r6;
1.17
1.18 - _num_cards = 0;
1.19 -
1.20 while (send_command(Command_all_send_cid, 0))
1.21 {
1.22 read_response((uint16_t *) &r2, Response_size_R2);
1.23 @@ -650,7 +652,7 @@
1.24 // Employ 1-based relative addressing.
1.25
1.26 if (!send_command(Command_send_csd, _cards[card].rca << 16))
1.27 - return;
1.28 + continue;
1.29
1.30 read_response((uint16_t *) &r2, Response_size_R2);
1.31
1.32 @@ -689,15 +691,6 @@
1.33 printf("read access time (1 2): %d %d\n", csd->data_read_access_time_1,
1.34 csd->data_read_access_time_2);
1.35 printf("DSR: %s\n", csd->dsr_implemented ? "yes" : "no");
1.36 -
1.37 - // Query the OCR again now that we can associate it with a specific card.
1.38 -
1.39 - if (!send_app_command(App_command_read_ocr, 0))
1.40 - return;
1.41 -
1.42 - read_response((uint16_t *) &r3, Response_size_R3);
1.43 -
1.44 - _cards[card].ocr = r3.ocr;
1.45 }
1.46 }
1.47
1.48 @@ -723,10 +716,15 @@
1.49
1.50 send_command(Command_go_idle_state, 0);
1.51
1.52 + // Reset the number of SDMEM and MMC cards prior to identification.
1.53 +
1.54 + _num_cards = 0;
1.55 +
1.56 if (check_sd())
1.57 {
1.58 init_sdio();
1.59 init_sdmem();
1.60 + identify_cards();
1.61 }
1.62
1.63 init_mmc();
1.64 @@ -808,7 +806,7 @@
1.65
1.66 uint32_t
1.67 Msc_channel::read(uint8_t card, struct dma_region *region,
1.68 - uint32_t address, uint32_t count)
1.69 + uint64_t address, uint64_t count)
1.70 {
1.71 uint32_t block_size = 1 << _cards[card].csd.read_blocklen;
1.72