What´s the best Practice to Build own Kernel

I’ve just read through properly - ignore me, I got totally the wrong end of the stick.

Well how about booting from a hard disk? I can test that here although I’ve got some catching up to do in terms of process and patches etc

(I can’t vouch for everybody’s usage pattern but the SD is just a fancy boot rom to me now)

still nobody has an idea?

aplied patch from http://lists.infradead.org/pipermail/linux-mediatek/2017-October/010827.html, changed mmc1 to mt2701 and the clock, nothing changes

but i’m not sure if mmc1 is the problem…

[    1.461933] mtk-msdc 11240000.mmc: Got CD GPIO                               
[    1.516707] mmc0: new high speed MMC card at address 0001                    
[    1.523512] mmcblk0: mmc0:0001 8WPD3R 7.28 GiB                               
[    1.528301] mmcblk0boot0: mmc0:0001 8WPD3R partition 1 4.00 MiB              
[    1.534457] mmcblk0boot1: mmc0:0001 8WPD3R partition 2 4.00 MiB 

in bootlog it seems mmc0=11240000.mmc=mmc from dts, can you confirm that? in shematicts sdxc should be 4-bit-data (MDSC_DAT0 - MSDC_DAT3)

@Ryder.Lee @linkerosa do you see your SD-Card with kernel 4.14?? which Cards do you use?

Could you provide boot log to me?

Can i activate a “debug-mode”? in current boot-log there are only above lines with mmc…

here the normal boot.log: 14.4.boot.log (48,8 KB)

14.4.patch (7,0 KB)

forum is extremely slow the last days…

@ryder.lee have you found something in log or can you reproduce the problem?

maybe i can put some debug-messages in mtk-sd.c or enable the existing somehow, but currently i don’t know how the probing is working (which functions are called in which order, which function is the entrypoint). ~2000 line are much for my limited c+±knowledge ;(

as far as i know one of the main functions is “static int msdc_drv_probe(…)”, which seems similar except of new function msdc_of_property_parse which does the of_property-calls which are done in 4.4.70 with debug-messages “dev_dbg(…)”

i’ve found some strange definitions in include/linux/mmc/host.h: 4.4.70:

#define MMC_CAP_ERASE       (1 << 10)   /* Allow erase/trim commands */
#define MMC_CAP_1_8V_DDR    (1 << 11)   /* can support */
                        /* DDR mode at 1.8V */
#define MMC_CAP_1_2V_DDR    (1 << 12)   /* can support */
                        /* DDR mode at 1.2V */
#define MMC_CAP_POWER_OFF_CARD  (1 << 13)   /* Can power off after boot */
#define MMC_CAP_BUS_WIDTH_TEST  (1 << 14)   /* CMD14/CMD19 bus width ok */
#define MMC_CAP_UHS_SDR12   (1 << 15)   /* Host supports UHS SDR12 mode */
#define MMC_CAP_UHS_SDR25   (1 << 16)   /* Host supports UHS SDR25 mode */
#define MMC_CAP_UHS_SDR50   (1 << 17)   /* Host supports UHS SDR50 mode */
#define MMC_CAP_UHS_SDR104  (1 << 18)   /* Host supports UHS SDR104 mode */
#define MMC_CAP_UHS_DDR50   (1 << 19)   /* Host supports UHS DDR50 mode */
#define MMC_CAP_RUNTIME_RESUME  (1 << 20)   /* Resume at runtime_resume. */

4.14:

#define MMC_CAP_ERASE       (1 << 10)   /* Allow erase/trim commands */
#define MMC_CAP_3_3V_DDR    (1 << 11)   /* Host supports eMMC DDR 3.3V */
#define MMC_CAP_1_8V_DDR    (1 << 12)   /* Host supports eMMC DDR 1.8V */
#define MMC_CAP_1_2V_DDR    (1 << 13)   /* Host supports eMMC DDR 1.2V */
#define MMC_CAP_POWER_OFF_CARD  (1 << 14)   /* Can power off after boot */
#define MMC_CAP_BUS_WIDTH_TEST  (1 << 15)   /* CMD14/CMD19 bus width ok */
#define MMC_CAP_UHS_SDR12   (1 << 16)   /* Host supports UHS SDR12 mode */
#define MMC_CAP_UHS_SDR25   (1 << 17)   /* Host supports UHS SDR25 mode */
#define MMC_CAP_UHS_SDR50   (1 << 18)   /* Host supports UHS SDR50 mode */
#define MMC_CAP_UHS_SDR104  (1 << 19)   /* Host supports UHS SDR104 mode */
#define MMC_CAP_UHS_DDR50   (1 << 20)   /* Host supports UHS DDR50 mode */

as you can see MMC_CAP_ERASE is same, after that in 4.14 MMC_CAP_3_3V_DDR is inserted and the other constants are now 1 higher bit…maybe this is the Problem (seems it’s only for kernel-internal option-storing)?

trying to include code from 4.4.70, 1st step (not working so far, but maybe a help) 14.4.sd.diff (12,5 KB)

now merged near all different code to 4.14, but sd-card is still not visible:

[    1.402661] msdc_drv_probe!                                                  << 1st probe 
[    1.461499] msdc_drv_probe!                                                  << 2nd probe
[    1.464332] mtk-msdc 11240000.mmc: Got CD GPIO                               
[    1.516294] mmc0: new high speed MMC card at address 0001                    <<only mmc0 found
[    1.523117] mmcblk0: mmc0:0001 8WPD3R 7.28 GiB                               
[    1.527916] mmcblk0boot0: mmc0:0001 8WPD3R partition 1 4.00 MiB              
[    1.534093] mmcblk0boot1: mmc0:0001 8WPD3R partition 2 4.00 MiB              

14.4.patch11 (32,2 KB)

it seems that Problem is not in this file…or it is the code added to file, which i have not deleted 4.4_vs_4.14.diff (15,1 KB)

found out how to enable Debug-Messages simply by adding “#define DEBUG” at beginning of mtk-sd.c :wink:

here is the result:

[    1.403619] msdc_drv_probe!
[    1.407129] mtk-msdc 11230000.mmc: init hardware done!
[    1.412443] mtk-msdc 11230000.mmc: Bus Width = 0
[    1.417030] mtk-msdc 11230000.mmc: init hardware done!
[    1.422176] mtk-msdc 11230000.mmc: Regulator set error -22 (3300000 - 3300000)
[    1.450929] mtk-msdc 11230000.mmc: Bus Width = 0
[    1.455563] mtk-msdc 11230000.mmc: sclk: 400000, timing: 0
[    1.491471] msdc_drv_probe!
[    1.494298] mtk-msdc 11240000.mmc: Got CD GPIO
[    1.499159] mtk-msdc 11240000.mmc: init hardware done!
[    1.499300] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    1.499367] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=52 arg=00000C00; rsp 00000B00; cmd_error=-110
[    1.499376] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=52 arg=00000C00; host->error=0x00000002
[    1.528006] mtk-msdc 11240000.mmc: Bus Width = 0
[    1.532617] mtk-msdc 11240000.mmc: init hardware done!
[    1.538096] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    1.543766] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=52 arg=80000C08; rsp 00000B00; cmd_error=-110
[    1.552740] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=52 arg=80000C08; host->error=0x00000002
[    1.560923] mtk-msdc 11240000.mmc: Bus Width = 0
[    1.560984] mtk-msdc 11240000.mmc: sclk: 399999, timing: 0
[    1.571737] mtk-msdc 11230000.mmc: Bus Width = 0
[    1.577779] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    1.584411] mtk-msdc 11230000.mmc: Bus Width = 0
[    1.590302] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    1.595973] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=8 arg=000001AA; rsp 00000B00; cmd_error=-110
[    1.604861] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=8 arg=000001AA; host->error=0x00000002
[    1.614081] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    1.614814] mtk-msdc 11240000.mmc: Bus Width = 0
[    1.614833] mtk-msdc 11240000.mmc: set mclk to 0
[   1.830813] mtk-msdc 11230000.mmc: msdc_irq: events=00000200                                                                                             
[    1.836403] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=55 arg=00000000; rsp 00000B00; cmd_error=-110                                                     
[    1.845379] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=55 arg=00000000; host->error=0x00000002                                                     
[    1.854747] mtk-msdc 11230000.mmc: msdc_irq: events=00000200                                                                                            
[    1.860424] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=55 arg=00000000; rsp 00000B00; cmd_error=-110                                                     
[    1.869397] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=55 arg=00000000; host->error=0x00000002                                                     
[    1.878863] mtk-msdc 11230000.mmc: msdc_irq: events=00000200                                                                                            
[    1.884335] Freeing unused kernel memory: 6144K                                                                                                         
[    1.889021] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=55 arg=00000000; rsp 00000B00; cmd_error=-110                                                     
[    1.897996] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=55 arg=00000000; host->error=0x00000002                                                     
[    1.907460] mtk-msdc 11230000.mmc: msdc_irq: events=00000200                                                                                            
[    1.913153] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=55 arg=00000000; rsp 00000B00; cmd_error=-110                                                     
[    1.922135] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=55 arg=00000000; host->error=0x00000002                                                     
[    1.931135] mtk-msdc 11230000.mmc: Bus Width = 0                                                                                                        
[    1.936047] mtk-msdc 11230000.mmc: msdc_irq: events=00000100                                                                                            
[    1.941724] mtk-msdc 11230000.mmc: Bus Width = 0                                                                                                        
[    1.946311] mtk-msdc 11230000.mmc: Bus Width = 0                                                                                                        
[    1.952367] mtk-msdc 11230000.mmc: msdc_irq: events=00000100                                                                                            
[    1.959021] mtk-msdc 11230000.mmc: Bus Width = 0                                                                                                        
[    1.965058] mtk-msdc 11230000.mmc: msdc_irq: events=00000100                                                                                            
Starting logging: OK                                                                                                                                       
Initializing random number generator... [    1.991295] mtk-msdc 11230000.mmc: msdc_irq: events=00000100                                                    
[    1.997476] mtk-msdc 11230000.mmc: msdc_irq: events=00000100                                                                                            
[    2.003456] mtk-msdc 11230000.mmc: msdc_irq: events=00000100                                                                                            
[    2.009103] mtk-msdc 11230000.mmc: Bus Width = 0                                                                                                        
done.                                                                                                                                                      
[    2.014287] mtk-msdc 11230000.mmc: msdc_irq: events=00000100                                                                                            
Starting network[    2.020287] mtk-msdc 11230000.mmc: msdc_irq: events=00000100                                                                            
...                                                                                                                                                        
[    2.027291] mtk-msdc 11230000.mmc: msdc_irq: events=00000100                                                                                            
[    2.033029] mtk-msdc 11230000.mmc: DMA start                                                                                                            
[    2.037265] mtk-msdc 11230000.mmc: msdc_start_data: cmd=8 DMA data: 1 blocks; read=1                                                                    
[    2.044944] mtk-msdc 11230000.mmc: msdc_irq: events=00003040                                                                                            
[    2.050556] mtk-msdc 11230000.mmc: DMA status: 0x       6                                                                                               
[    2.055910] mtk-msdc 11230000.mmc: DMA stop                                                                                                             
[    2.060402] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.066359] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.072298] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.078242] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.084191] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.089841] mtk-msdc 11230000.mmc: Bus Width = 0                                                                                                        
[    2.094516] mtk-msdc 11230000.mmc: sclk: 400000, timing: 1                                                                                              
[    2.100291] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.105989] mtk-msdc 11230000.mmc: Bus Width = 0                                                                                                        
[    2.111262] mtk-msdc 11230000.mmc: sclk: 26000000, timing: 1                                                                                            
[    2.116936] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.122637] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.128289] mtk-msdc 11230000.mmc: Bus Width = 3                                                                                                        
[    2.132933] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.138561] mtk-msdc 11230000.mmc: DMA start                                                                                                            
[    2.142796] mtk-msdc 11230000.mmc: msdc_start_data: cmd=8 DMA data: 1 blocks; read=1                                                                    
[    2.150476] mtk-msdc 11230000.mmc: msdc_irq: events=00003040                                                                                            
[    2.156089] mtk-msdc 11230000.mmc: DMA status: 0x       6                                                                                               
[    2.161442] mtk-msdc 11230000.mmc: DMA stop                                                                                                             
[    2.165643] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.171297] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.176939] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.182594] mtk-msdc 11230000.mmc: msdc_irq: events=00002140                                                                                            
[    2.188240] mmc0: new high speed MMC card at address 0001                                                                                               
[    2.194159] mmcblk0: mmc0:0001 8WPD3R 7.28 GiB                                                                                                          
[    2.198849] mmcblk0boot0: mmc0:0001 8WPD3R partition 1 4.00 MiB                                                                                         
[    2.204959] mmcblk0boot1: mmc0:0001 8WPD3R partition 2 4.00 MiB                                                                                         
[    2.211041] mmcblk0rpmb: mmc0:0001 8WPD3R partition 3 512 KiB                                                                                           
[    2.217309] mtk-msdc 11230000.mmc: msdc_irq: events=00002148                                                                                            
[    2.222936] mtk-msdc 11230000.mmc: DMA start                                                                                                            
[    2.227172] mtk-msdc 11230000.mmc: msdc_start_data: cmd=18 DMA data: 8 blocks; read=1                                                                   
[    2.234939] mtk-msdc 11230000.mmc: msdc_irq: events=00003040                                                                                            
[    2.240550] mtk-msdc 11230000.mmc: DMA status: 0x       6                                                                                               
[    2.245904] mtk-msdc 11230000.mmc: DMA stop

I don’t understand the event-messages but buswidth seems strange…i think it must be 4,or am i wrong? also that looks not good:

msdc_cmd_done: cmd=55 arg=00000000; rsp 00000B00; cmd_error=-110
#./include/uapi/asm-generic/errno.h:93:#define    ETIMEDOUT    110    /* Connection timed out */ ???

msdc_track_cmd_data: cmd=55 arg=00000000; host->error=0x00000002

fullboot log with unmodified kernel (same errors): 14.4.boot-debug.log (41,8 KB)

@garywang have you an idea where the problem can be?

edit now i tried debug-mode with 4.4.70…here is the probing part (also some timeouts, but sd is recognized):

[    5.437360] msdc_drv_probe!
[    5.440199] mtk-msdc 11240000.mmc: Got CD GPIO
[    5.445074] mtk-msdc 11240000.mmc: init hardware done!
[    5.450341] mtk-msdc 11240000.mmc: Bus Width = 0
[    5.454964] mtk-msdc 11240000.mmc: init hardware done!
[    5.470720] mtk-msdc 11240000.mmc: Bus Width = 0
[    5.475396] mtk-msdc 11240000.mmc: sclk: 399999, timing: 0
[    5.501448] mtk-msdc 11240000.mmc: msdc_irq: events=00000200
[    5.501476] msdc_drv_probe!
[    5.501849] mtk-msdc 11230000.mmc: init hardware done!
[    5.501997] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.502010] mtk-msdc 11230000.mmc: init hardware done!
[    5.502034] mtk-msdc 11230000.mmc: Regulator set error -22: 3300000 - 3300000
[    5.520735] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.520794] mtk-msdc 11230000.mmc: sclk: 400000, timing: 0
[    5.541433] hidraw: raw HID events driver (C) Jiri Kosina
[    5.542044] usbcore: registered new interface driver usbhid
[    5.542046] usbhid: USB HID core driver
[    5.556477] mtk-msdc 11240000.mmc: msdc_cmd_done: cmd=52 arg=00000C00; rsp 00000900; cmd_error=-110
[    5.565471] mtk-msdc 11240000.mmc: msdc_track_cmd_data: cmd=52 arg=00000C00; host->error=0x00000002
[    5.574932] mtk-msdc 11240000.mmc: msdc_irq: events=00000200
[    5.580618] mtk-msdc 11240000.mmc: msdc_cmd_done: cmd=52 arg=80000C08; rsp 00000900; cmd_error=-110
[    5.589608] mtk-msdc 11240000.mmc: msdc_track_cmd_data: cmd=52 arg=80000C08; host->error=0x00000002
[    5.598621] mtk-msdc 11240000.mmc: Bus Width = 0
[    5.604748] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.611392] mtk-msdc 11240000.mmc: Bus Width = 0
[    5.617281] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.623354] mtk-msdc 11240000.mmc: msdc_irq: events=00000200
[    5.629037] mtk-msdc 11240000.mmc: msdc_cmd_done: cmd=5 arg=00000000; rsp 000001AA; cmd_error=-110
[    5.637941] mtk-msdc 11240000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    5.647294] mtk-msdc 11240000.mmc: msdc_irq: events=00000200
[    5.652977] mtk-msdc 11240000.mmc: msdc_cmd_done: cmd=5 arg=00000000; rsp 000001AA; cmd_error=-110
[    5.661881] mtk-msdc 11240000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    5.671233] mtk-msdc 11240000.mmc: msdc_irq: events=00000200
[    5.676917] mtk-msdc 11240000.mmc: msdc_cmd_done: cmd=5 arg=00000000; rsp 000001AA; cmd_error=-110
[    5.685820] mtk-msdc 11240000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    5.695171] mtk-msdc 11240000.mmc: msdc_irq: events=00000200
[    5.700849] mtk-msdc 11240000.mmc: msdc_cmd_done: cmd=5 arg=00000000; rsp 000001AA; cmd_error=-110
[    5.709753] mtk-msdc 11240000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    5.718971] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.724901] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.730537] mtk-msdc 11240000.mmc: Bus Width = 0
[    5.736604] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.743242] mtk-msdc 11240000.mmc: Bus Width = 0
[    5.749123] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.755058] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.760988] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.781004] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.786931] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.793015] mt8521p-audio mediatek,mt7623_audio: mt8521p_audio_probe()
[    5.793087] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.793415] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.793948] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.794260] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.794571] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.794888] mtk-msdc 11240000.mmc: msdc_irq: events=00000100
[    5.794901] mtk-msdc 11240000.mmc: DMA start
[    5.794906] mtk-msdc 11240000.mmc: msdc_start_data: cmd=51 DMA data: 1 blocks; read=1
[    5.795305] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    5.795310] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    5.795314] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    5.795629] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    5.795941] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    5.795952] mtk-msdc 11240000.mmc: DMA start
[    5.795957] mtk-msdc 11240000.mmc: msdc_start_data: cmd=13 DMA data: 1 blocks; read=1
[    5.797375] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    5.797379] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    5.797383] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    5.797698] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    5.797710] mtk-msdc 11240000.mmc: DMA start
[    5.797715] mtk-msdc 11240000.mmc: msdc_start_data: cmd=6 DMA data: 1 blocks; read=1
[    5.799250] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    5.799254] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    5.799258] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    5.799275] mmc0: host does not support reading read-only switch, assuming write-enable
[    5.799575] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    5.799587] mtk-msdc 11240000.mmc: DMA start
[    5.799592] mtk-msdc 11240000.mmc: msdc_start_data: cmd=6 DMA data: 1 blocks; read=1
[    5.801165] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    5.801169] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    5.801173] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    5.801193] mtk-msdc 11240000.mmc: Bus Width = 0
[    5.801241] mtk-msdc 11240000.mmc: sclk: 399999, timing: 2
[    5.801245] mtk-msdc 11240000.mmc: Bus Width = 0
[    5.801614] mtk-msdc 11240000.mmc: sclk: 49999992, timing: 2
[    5.801630] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    5.801653] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    5.801667] mtk-msdc 11240000.mmc: Bus Width = 2
[    5.801679] mmc0: new high speed SDHC card at address 0007
[    5.802277] mmcblk0: mmc0:0007 SL32G 29.0 GiB 
[    5.802807] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    5.802826] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    5.802838] mtk-msdc 11240000.mmc: DMA start
[    5.802843] mtk-msdc 11240000.mmc: msdc_start_data: cmd=18 DMA data: 8 blocks; read=1
[    5.803492] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    5.803497] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    5.803502] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    5.803589]  mmcblk0: p1 p2
[    5.804697] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.804762] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=52 arg=00000C00; rsp 00000B00; cmd_error=-110
[    5.804769] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=52 arg=00000C00; host->error=0x00000002
[    5.805222] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.805287] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=52 arg=80000C08; rsp 00000B00; cmd_error=-110
[    5.805293] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=52 arg=80000C08; host->error=0x00000002
[    5.805311] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.806778] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    5.807793] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.809228] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.809292] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=8 arg=000001AA; rsp 00000B00; cmd_error=-110
[    5.809297] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=8 arg=000001AA; host->error=0x00000002
[    5.809743] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.809809] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=5 arg=00000000; rsp 00000B00; cmd_error=-110
[    5.809815] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    5.810258] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.810319] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=5 arg=00000000; rsp 00000B00; cmd_error=-110
[    5.810325] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    5.810768] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.810829] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=5 arg=00000000; rsp 00000B00; cmd_error=-110
[    5.810835] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    5.811278] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.811339] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=5 arg=00000000; rsp 00000B00; cmd_error=-110
[    5.811345] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    5.811791] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.811857] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=55 arg=00000000; rsp 00000B00; cmd_error=-110
[    5.811862] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=55 arg=00000000; host->error=0x00000002
[    5.812306] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.812367] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=55 arg=00000000; rsp 00000B00; cmd_error=-110
[    5.812372] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=55 arg=00000000; host->error=0x00000002
[    5.812815] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.812877] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=55 arg=00000000; rsp 00000B00; cmd_error=-110
[    5.812882] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=55 arg=00000000; host->error=0x00000002
[    5.813325] mtk-msdc 11230000.mmc: msdc_irq: events=00000200
[    5.813387] mtk-msdc 11230000.mmc: msdc_cmd_done: cmd=55 arg=00000000; rsp 00000B00; cmd_error=-110
[    5.813392] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=55 arg=00000000; host->error=0x00000002
[    5.813407] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.813705] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    5.813726] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.813730] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.815195] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    5.816211] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.817508] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    5.840992] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    5.841521] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    5.841841] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    5.841856] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.842383] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    5.842701] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    5.843026] mtk-msdc 11230000.mmc: msdc_irq: events=00000100
[    5.843038] mtk-msdc 11230000.mmc: DMA start
[    5.843043] mtk-msdc 11230000.mmc: msdc_start_data: cmd=8 DMA data: 1 blocks; read=1
[    5.853403] mtk-msdc 11230000.mmc: msdc_irq: events=00003040
[    5.853408] mtk-msdc 11230000.mmc: DMA status: 0x       6
[    5.853413] mtk-msdc 11230000.mmc: DMA stop event:0x3040
[    5.853435] mmc1: MAN_BKOPS_EN bit is not set
[    5.853746] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.854064] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.854381] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.854541] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.854556] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.854573] mtk-msdc 11230000.mmc: sclk: 400000, timing: 1
[    5.854578] mtk-msdc 11230000.mmc: Bus Width = 0
[    5.855222] mtk-msdc 11230000.mmc: sclk: 26000000, timing: 1
[    5.855244] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.855272] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.855286] mtk-msdc 11230000.mmc: Bus Width = 3
[    5.855308] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.855319] mtk-msdc 11230000.mmc: DMA start
[    5.855324] mtk-msdc 11230000.mmc: msdc_start_data: cmd=8 DMA data: 1 blocks; read=1
[    5.855344] mtk-msdc 11230000.mmc: msdc_irq: events=00003040
[    5.855348] mtk-msdc 11230000.mmc: DMA status: 0x       6
[    5.855353] mtk-msdc 11230000.mmc: DMA stop event:0x3040
[    5.855382] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.855407] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.855432] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.855455] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.855475] mmc1: new high speed MMC card at address 0001
[    5.856053] mmcblk1: mmc1:0001 8WPD3R 7.28 GiB 
[    5.856353] mmcblk1boot0: mmc1:0001 8WPD3R partition 1 4.00 MiB
[    5.860771] mmcblk1boot1: mmc1:0001 8WPD3R partition 2 4.00 MiB
[    5.861071] mmcblk1rpmb: mmc1:0001 8WPD3R partition 3 512 KiB
[    5.861545] mtk-msdc 11230000.mmc: msdc_irq: events=00002148
[    5.861559] mtk-msdc 11230000.mmc: DMA start
[    5.861565] mtk-msdc 11230000.mmc: msdc_start_data: cmd=18 DMA data: 8 blocks; read=1
[    5.861851] mtk-msdc 11230000.mmc: msdc_irq: events=00003040
[    5.861856] mtk-msdc 11230000.mmc: DMA status: 0x       6
[    5.861861] mtk-msdc 11230000.mmc: DMA stop event:0x3040
[    5.862034] mtk-msdc 11230000.mmc: msdc_irq: events=00002048
[    5.862039] mtk-msdc 11230000.mmc: msdc_irq: events=00002140
[    5.862051] mtk-msdc 11230000.mmc: DMA start
[    5.862056] mtk-msdc 11230000.mmc: msdc_start_data: cmd=18 DMA data: 8 blocks; read=1
[    5.862226] mtk-msdc 11230000.mmc: msdc_irq: events=00003040
[    5.862230] mtk-msdc 11230000.mmc: DMA status: 0x       6
[    5.862235] mtk-msdc 11230000.mmc: DMA stop event:0x3040
....
[    8.935515] md: Waiting for all devices to be available before autodetect
[    8.942412] md: If you don't use raid, use raid=noautodetect
[    8.948973] md: Autodetecting RAID arrays.
[    8.953148] md: Scanned 0 and added 0 devices.
[    8.957638] md: autorun ...
[    8.960459] md: ... autorun DONE.
[    8.964320] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    8.970072] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    8.975802] mtk-msdc 11240000.mmc: DMA start
[    8.980120] mtk-msdc 11240000.mmc: msdc_start_data: cmd=18 DMA data: 2 blocks; read=1
[    8.988033] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    8.993752] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    8.999207] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    9.008851] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.018628] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.028279] mtk-msdc 11240000.mmc: DMA start
[    9.036452] mtk-msdc 11240000.mmc: msdc_start_data: cmd=18 DMA data: 8 blocks; read=1
[    9.048193] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    9.057719] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    9.066954] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    9.076211] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.085709] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.095130] mtk-msdc 11240000.mmc: DMA start
[    9.103071] mtk-msdc 11240000.mmc: msdc_start_data: cmd=18 DMA data: 8 blocks; read=1
[    9.114580] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    9.123857] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    9.132865] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    9.142272] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.151529] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.160686] mtk-msdc 11240000.mmc: DMA start
[    9.168355] mtk-msdc 11240000.mmc: msdc_start_data: cmd=18 DMA data: 8 blocks; read=1
[    9.179582] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    9.188570] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    9.197220] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    9.205725] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.214496] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.223151] mtk-msdc 11240000.mmc: DMA start
[    9.230333] mtk-msdc 11240000.mmc: msdc_start_data: cmd=18 DMA data: 16 blocks; read=1
[    9.241192] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    9.249744] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    9.257961] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    9.266053] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.274444] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.282744] mtk-msdc 11240000.mmc: DMA start
[    9.289586] mtk-msdc 11240000.mmc: msdc_start_data: cmd=18 DMA data: 8 blocks; read=1
[    9.300073] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[    9.308406] mtk-msdc 11240000.mmc: DMA status: 0x       6
[    9.316478] mtk-msdc 11240000.mmc: DMA stop event:0x3040
[    9.324424] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[    9.325121] EXT4-fs (mmcblk0p2): mounted filesystem without journal. Opts: (null)
[    9.325168] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.

4.14 is missing event 100 for SD-Card (1124) like that in 4.4.70

11240000.mmc: msdc_irq: events=00000100

while greping for the constants i’ve found out that 4.4.70 has also files in drivers/misc/mediatek/mtk_sdio/… these are missing in 4.14, but it seems is not activated in 4.4.70-kernel (# CONFIG_MMC_MTK_SDIO is not set)

currently i don’t know how msdc_irq works and where the events are set…because MSDC_INTEN seems to be an offset for the events, they may be set by that lines:

kernel_4.14/linux/drivers/mmc/host/mtk-sd.c:550:	flags = readl(host->base + MSDC_INTEN);
kernel_4.14/linux/drivers/mmc/host/mtk-sd.c:551:	sdr_clr_bits(host->base + MSDC_INTEN, flags);
kernel_4.14/linux/drivers/mmc/host/mtk-sd.c:601:	sdr_set_bits(host->base + MSDC_INTEN, flags);
kernel_4.14/linux/drivers/mmc/host/mtk-sd.c:717:	sdr_set_bits(host->base + MSDC_INTEN, data_ints_mask);
kernel_4.14/linux/drivers/mmc/host/mtk-sd.c:806:	sdr_clr_bits(host->base + MSDC_INTEN, cmd_ints_mask);
kernel_4.14/linux/drivers/mmc/host/mtk-sd.c:902:	sdr_set_bits(host->base + MSDC_INTEN, cmd_ints_mask);
kernel_4.14/linux/drivers/mmc/host/mtk-sd.c:1010:	sdr_clr_bits(host->base + MSDC_INTEN, data_ints_mask);
kernel_4.14/linux/drivers/mmc/host/mtk-sd.c:1135:	event_mask = readl(host->base + MSDC_INTEN);
kernel_4.14/linux/drivers/mmc/host/mtk-sd.c:1180:	writel(0, host->base + MSDC_INTEN);
kernel_4.14/linux/drivers/mmc/host/mtk-sd.c:1212:	writel(0, host->base + MSDC_INTEN);

i try to include “drivers/mmc/card” from 4.4.70

Could you give me your dts/dtsi and mtk-sd.c ?

Try the below node:

&mmc1 {
       pinctrl-names = "default", "state_uhs";
       pinctrl-0 = <&mmc1_pins_default>;
       pinctrl-1 = <&mmc1_pins_uhs>;
       status = "okay";
       bus-width = <4>;
       max-frequency = <50000000>;
       cap-sd-highspeed;
       cd-gpios = <&pio 261 0>;
       vmmc-supply = <&mt6323_vmch_reg>;
       vqmmc-supply = <&mt6323_vio18_reg>;   --》vqmmc-supply = <&mt6323_vmc_reg>
};

currently i reverted all changes and have original 4.14 final code. All changes (merging of mtk-sd.c and changes in dtsi are in my last post “14.4.patch11”)

You changed the regulator in last line?

Take the patches http://lists.infradead.org/pipermail/linux-mediatek/2017-October/010827.html and try to change the regulator in last line.

boot-4.4_sd_debug.log (82 KB) it looks like now there is no init with events:

[    1.491596] mtk-msdc 11240000.mmc: Got CD GPIO                               
[    1.496432] mtk-msdc 11240000.mmc: init hardware done!                       
[    1.525380] mtk-msdc 11240000.mmc: Bus Width = 0                             
[    1.529967] mtk-msdc 11240000.mmc: init hardware done!                       
[    1.564729] mtk-msdc 11240000.mmc: Bus Width = 0                             
[    1.574999] mtk-msdc 11240000.mmc: sclk: 399999, timing: 0                   
[    1.635422] mtk-msdc 11240000.mmc: Bus Width = 0                             
[    1.663539] mtk-msdc 11240000.mmc: set mclk to 0                             

also tried compatible-string with 2701 with same result

# cat /sys/devices/platform/11240000.mmc/of_node/status                         
okay#                                                                           
# cat /sys/devices/platform/11240000.mmc/of_node/compatible                     
mediatek,mt2701-mmc#                                                            
# cat /sys/devices/platform/11240000.mmc/of_node/bus-width | hexdump            
0000000 0000 0400                                                               
0000004                   

4.14-mmc2.patch (6,4 KB)

(patch for 4.14-final)

config used: mt7623n_evb_ryderlee_defconfig.txt (4,9 KB)

touched files: mt7623n-bananapi-bpi-r2.dts (9,2 KB) mt7623.dtsi (20,7 KB) mtk-sd.c (55,3 KB)

my build-script: build.sh (1,4 KB)

Could you provide 4.14 full debug log? Did you detect SD card with those change?

sd not working yet. How to make full debug-log?

CONFIG_DYNAMIC_DEBUG=y

To enable dev_dbg messages in a specific kernel file:

#define DEBUG

i have dynamic_debug enabled and #define DEBUG in mtk-sd.c…any other options (#define debug in another file)?

maybe debug-log is somewhere in Filesystem? i uploaded the bootlog from minicom…

try to add “ccflags-y :=-DDEBUG” in makefile or CONFIG_CMDLINE=“loglevel=8”

added the “ccflags-y :=-DDEBUG” to drivers/mmc/Makefile (main makefile is very big…where is the right section?) and the loglevel:

# cat /proc/cmdline                                                                                                                                  
earlyprintk console=ttyS0,115200 vmalloc=496M debug=7 loglevel=8 no_console_suspend 

but still no more messages for the SD-Card:

# grep '1124' /var/log/messages                                                                                                                      
Jan  1 00:00:01 goodman48 user.info kernel: [    1.491610] mtk-msdc 11240000.mmc: Got CD GPIO                                                        
Jan  1 00:00:01 goodman48 user.debug kernel: [    1.496447] mtk-msdc 11240000.mmc: init hardware done!                                               
Jan  1 00:00:01 goodman48 user.debug kernel: [    1.525378] mtk-msdc 11240000.mmc: Bus Width = 0                                                     
Jan  1 00:00:01 goodman48 user.debug kernel: [    1.529964] mtk-msdc 11240000.mmc: init hardware done!                                               
Jan  1 00:00:01 goodman48 user.debug kernel: [    1.564732] mtk-msdc 11240000.mmc: Bus Width = 0                                                     
Jan  1 00:00:01 goodman48 user.debug kernel: [    1.575001] mtk-msdc 11240000.mmc: sclk: 399999, timing: 0                                           
Jan  1 00:00:01 goodman48 user.debug kernel: [    1.635413] mtk-msdc 11240000.mmc: Bus Width = 0                                                     
Jan  1 00:00:01 goodman48 user.debug kernel: [    1.663529] mtk-msdc 11240000.mmc: set mclk to 0

4.14_debug.log (42,6 KB)

full debug (added -DDEBUG to main makefile, login is hidden behind serial interrupt-messages): boot-4.14_sd_debug.log.zip (92,8 KB)

related messages from full debug log:

[   23.567048] mtk-msdc 11240000.mmc: no init pinctrl state
[   23.572318] mediatek-mt2701-pinctrl 1000b000.pinctrl: request pin 107 (MSDC1_DAT0) for 11240000.mmc
[   23.581318] mediatek-mt2701-pinctrl 1000b000.pinctrl: request pin 108 (MSDC1_DAT1) for 11240000.mmc
[   23.590318] mediatek-mt2701-pinctrl 1000b000.pinctrl: request pin 109 (MSDC1_DAT2) for 11240000.mmc
[   23.599317] mediatek-mt2701-pinctrl 1000b000.pinctrl: request pin 110 (MSDC1_DAT3) for 11240000.mmc
[   23.608314] mediatek-mt2701-pinctrl 1000b000.pinctrl: request pin 105 (MSDC1_CMD) for 11240000.mmc
[   23.617226] mediatek-mt2701-pinctrl 1000b000.pinctrl: request pin 106 (MSDC1_CLK) for 11240000.mmc
[   23.626135] mediatek-mt2701-pinctrl 1000b000.pinctrl: request pin 29 (EINT7) for 11240000.mmc
[   23.634615] mediatek-mt2701-pinctrl 1000b000.pinctrl: request pin 261 (MSDC1_INS) for 11240000.mmc
[   23.643524] mtk-msdc 11240000.mmc: no sleep pinctrl state
[   23.648879] mtk-msdc 11240000.mmc: no idle pinctrl state
[   23.654164] OF: no dma-ranges found for node(/mmc@11240000)
[   23.659694] mtk-msdc 11240000.mmc: device is not dma coherent
[   23.665409] mtk-msdc 11240000.mmc: device is not behind an iommu
[   23.671380] devices_kset: Moving 11240000.mmc to end of list
[   23.677038] mtk-msdc 11240000.mmc: GPIO lookup for consumer cd
[   23.682839] mtk-msdc 11240000.mmc: using device tree for GPIO lookup
[   23.689155] of_get_named_gpiod_flags: parsed 'cd-gpios' property of node '/mmc@11240000[0]' - status (0)
[   23.698581] mediatek-mt2701-pinctrl 1000b000.pinctrl: request pin 261 (MSDC1_INS) for 1000b000.pinctrl:493
[   23.708188] mtk-msdc 11240000.mmc: Got CD GPIO
[   23.712597] mtk-msdc 11240000.mmc: GPIO lookup for consumer wp
[   23.718402] mtk-msdc 11240000.mmc: using device tree for GPIO lookup
[   23.724720] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/mmc@11240000[0]'
[   23.733449] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/mmc@11240000[0]'
[   23.742078] mtk-msdc 11240000.mmc: using lookup tables for GPIO lookup
[   23.748565] mtk-msdc 11240000.mmc: lookup for GPIO wp failed
[   23.754225] mtk-msdc 11240000.mmc: Looking up vmmc-supply from device tree
[   23.761070] debugfs: creating file '11240000.mmc-vmmc'
[   23.766191] debugfs: creating file 'uA_load'
[   23.770427] debugfs: creating file 'min_uV'
[   23.774592] debugfs: creating file 'max_uV'
[   23.778743] debugfs: creating file 'constraint_flags'
[   23.783780] mtk-msdc 11240000.mmc: Looking up vqmmc-supply from device tree
[   23.790707] debugfs: creating file '11240000.mmc-vqmmc'
[   23.795908] debugfs: creating file 'uA_load'
[   23.800144] debugfs: creating file 'min_uV'
[   23.804308] debugfs: creating file 'max_uV'
[   23.808457] debugfs: creating file 'constraint_flags'
[   23.813490] OF: comparing source with source
[   23.817735] OF: comparing hclk with source
[   23.821794] OF: comparing hclk with hclk
[   23.825709] OF: of_irq_parse_one: dev=/mmc@11240000, index=0
[   23.831335] OF:  parent=/interrupt-controller@10200100, intsize=3
[   23.837392] OF:  intspec=0
[   23.840073] of_irq_parse_raw:  /interrupt-controller@10200100:00000000,00000028,00000008
[   23.848122] OF: of_irq_parse_raw: ipar=/interrupt-controller@10200100, size=3
[   23.855212] OF:  -> addrsize=2
[   23.858238] OF:  -> got it !
[   23.861098] mtk-msdc 11240000.mmc: obtain a copy of previously claimed pinctrl
[   23.868283] cma: cma_alloc(cma c11be77c, count 1, align 0)
[   23.873785] mmc0: mmc_rescan_try_freq: trying to init card at 400000 Hz
[   23.873795] cma: cma_alloc(): returned e0768820
[   23.873818] cma: cma_alloc(cma c11be77c, count 4, align 2)
[   23.873840] cma: cma_alloc(): returned e0768900
[   23.873920] mtk-msdc 11240000.mmc: init hardware done!
[   23.873971] device: 'mmc1': device_add
[   23.873980] kobject: 'mmc_host' (def87280): kobject_add_internal: parent: '11240000.mmc', set: '(null)'
[   23.873994] kobject: 'mmc1' (defd8810): kobject_add_internal: parent: 'mmc_host', set: 'devices'
[   23.874041] PM: Adding info for No Bus:mmc1
[   23.874048] kobject: 'mmc1' (defd8810): kobject_uevent_env
[   23.874058] kobject: 'mmc1' (defd8810): fill_kobj_path: path = '/devices/platform/11240000.mmc/mmc_host/mmc1'
[   23.874073] debugfs: creating file 'mmc1'
[   23.874086] debugfs: creating file 'ios'
[   23.874093] debugfs: creating file 'clock'
[   23.874108] mmc1: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 21 width 1 timing 0
[   23.874114] mtk-msdc 11240000.mmc: Bus Width = 0
[   23.874127] mtk-msdc 11240000.mmc: init hardware done!
[   23.874155] mtk-msdc 11240000.mmc: mmc_regulator_set_vqmmc: found vmmc voltage range of 3300000-3400000uV

lines 19029-19096 from above Logfile, after that here are dropped lines and much messages of creating files in debugfs with names clk_*, repeating from 19101-21093

maybe the “wp-gpio”-messages are the Problem?

1 Like

below log is some successful log i have. but i also have found it can’t be detected at boot time. the log is shown when i replug for several times in the card after the boot.


[   44.153800] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[   44.159440] mtk-msdc 11240000.mmc: Bus Width = 2
[   44.164035] mmc1: new high speed SDHC card at address aaaa
[   44.170007] mmcblk1: mmc1:aaaa SC16G 14.8 GiB
[   44.174986] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[   44.180639] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[   44.186264] mtk-msdc 11240000.mmc: DMA start
[   44.190499] mtk-msdc 11240000.mmc: msdc_start_data: cmd=18 DMA data: 8 blocks; read=1
[   44.198265] mtk-msdc 11240000.mmc: msdc_irq: events=00003040
[   44.203877] mtk-msdc 11240000.mmc: DMA status: 0x       6
[   44.209230] mtk-msdc 11240000.mmc: DMA stop
[   44.213468]  mmcblk1: p1
[   44.216584] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[   44.428169] mtk-msdc 11240000.mmc: msdc_irq: events=00002140
[   44.638158] mtk-msdc 11240000.mmc: msdc_irq: events=00002140

i see that system recognize the removal of SD-Card, but not the re-inserting

14.4.-reenter.log (24,7 KB)

Hi, Frank

Good news, I should have solved the problems.

it is a polarity problem that pin for card detected should be used as LOW ACTIVE instead of HIGH ACTIVE. it worked for me. you can follow below steps to see whether it worked for you.

please apply all patches https://patchwork.ozlabs.org/cover/823758/ you should have done as your previous replied

in mt7623.dtsi

       mmc0: mmc@11230000 {
              compatible = "mediatek,mt7623-mmc", 
                         "mediatek,mt2701-mmc"; ==> fall back to mt2701 instead mt8135
              reg = <0 0x11230000 0 0x1000>;
              interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_LOW>;
              clocks = <&pericfg CLK_PERI_MSDC30_0>,
                    <&topckgen CLK_TOP_MSDC30_0_SEL>;
              clock-names = "source", "hclk";
              status = "disabled";
       };

       mmc1: mmc@11240000 {
              compatible = "mediatek,mt7623-mmc",
                         "mediatek,mt2701-mmc";==> fall back to mt2701 instead mt8135
              reg = <0 0x11240000 0 0x1000>;
              interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_LOW>;
              clocks = <&pericfg CLK_PERI_MSDC30_1>,
                    <&topckgen CLK_TOP_MSDC30_1_SEL>;
              clock-names = "source", "hclk";
              status = "disabled";
       };

in mt7623n-bananapi-bpi-r2.dts

        &mmc1 {
                pinctrl-names = "default", "state_uhs";
                pinctrl-0 = <&mmc1_pins_default>;
                pinctrl-1 = <&mmc1_pins_uhs>;
                status = "okay";
                bus-width = <4>;
                max-frequency = <50000000>;
                cap-sd-highspeed;
                cd-gpios = <&pio 261 1>;   ==> used as GPIO_ACTIVE_LOW, which is very critical setup 
                vmmc-supply = <&mt6323_vmch_reg>;
                vqmmc-supply = <&mt6323_vmc_reg>;
        };
1 Like

thank you for this, info, i’ll test it when i’m at home

strange…in 4.4.70 it is also 0 (should not work, but there it does)

&mmc1 {
    pinctrl-names = "default", "state_uhs";
    pinctrl-0 = <&mmc1_pins_default>;
    pinctrl-1 = <&mmc1_pins_uhs>;
    status = "okay";
    bus-width = <4>;
    max-frequency = <50000000>;
    cap-sd-highspeed;
    cd-gpios = <&pio 261 0>;  <<<<<<<<
/*
    wp-gpios = <&pio 29 0>;
*/
    vmmc-supply = <&mt6323_vmch_reg>;
    vqmmc-supply = <&mt6323_vmc_reg>;
};

After reviewing more on the 4.4 driver, i found the mtk-sd.c in 4.4 doesn’t have get_cd callback but it does in upstream kernel and thus 4.4 always bypasses the sanity check if card is present and upstream we MUST assign the exact what the core is expected to.

in drivers/mmc/core/core.c will check if get_cd is available.

if (mmc_card_is_removable(host) && host->ops->get_cd &&
                host->ops->get_cd(host) == 0) {
        mmc_power_off(host);
        mmc_release_host(host);
        goto out;
}
1 Like