| 691 | } |
| 692 | |
| 693 | static rt_int32_t sdio_initialize_function(struct rt_mmcsd_card *card, |
| 694 | rt_uint32_t func_num) |
| 695 | { |
| 696 | rt_int32_t ret; |
| 697 | struct rt_sdio_function *func; |
| 698 | |
| 699 | RT_ASSERT(func_num <= SDIO_MAX_FUNCTIONS); |
| 700 | |
| 701 | func = rt_malloc(sizeof(struct rt_sdio_function)); |
| 702 | if (!func) |
| 703 | { |
| 704 | LOG_E("malloc rt_sdio_function failed"); |
| 705 | ret = -RT_ENOMEM; |
| 706 | goto err; |
| 707 | } |
| 708 | rt_memset(func, 0, sizeof(struct rt_sdio_function)); |
| 709 | |
| 710 | func->card = card; |
| 711 | func->num = func_num; |
| 712 | |
| 713 | ret = sdio_read_fbr(func); |
| 714 | if (ret) |
| 715 | goto err1; |
| 716 | |
| 717 | ret = sdio_read_cis(func); |
| 718 | if (ret) |
| 719 | goto err1; |
| 720 | |
| 721 | /* |
| 722 | * product/manufacturer id is optional for function CIS, so |
| 723 | * copy it from the card structure as needed. |
| 724 | */ |
| 725 | if (func->product == 0) |
| 726 | { |
| 727 | func->manufacturer = card->cis.manufacturer; |
| 728 | func->product = card->cis.product; |
| 729 | } |
| 730 | |
| 731 | card->sdio_function[func_num] = func; |
| 732 | |
| 733 | return 0; |
| 734 | |
| 735 | err1: |
| 736 | sdio_free_cis(func); |
| 737 | rt_free(func); |
| 738 | card->sdio_function[func_num] = RT_NULL; |
| 739 | err: |
| 740 | return ret; |
| 741 | } |
| 742 | |
| 743 | static rt_int32_t sdio_set_highspeed(struct rt_mmcsd_card *card) |
| 744 | { |
no test coverage detected