What´s the best Practice to Build own Kernel

You can use root/root to try login. For sd card test, you could try unplug and plug again to see whether some driver log is being pop out. If not, could you get another card and test again? I’m afraid the driver using 8135 compatible should have IOT problems with certain cards.

thank you…no passwort needed :slight_smile: only root

# ls /dev/mmc*                                                                  
ls: /dev/mmc*: No such file or directory                                        
# cat /proc/partitions                                                          
major minor  #blocks  name                                                      
                                                                                
 179        0    7634944 mmcblk0                                                
 179       24        512 mmcblk0rpmb                                            
 179       16       4096 mmcblk0boot1                                           
 179        8       4096 mmcblk0boot0                                           
#

i have only sandisk micro-sdhc 32 free…other cards (all sandisk ultra, because i have no problems with this cards) are in other boards

can i change the driver back to 2701? mhm, then emmc is no more found too (its mmc0, no change on mmc1)…mhm, strange, with github-kernel sd is recognized, also u-boot have no problems with it…

no driver-popup (log)…but also without a card, the device should be seen in bootlog, doesn’t it?

You should take a look at http://lists.infradead.org/pipermail/linux-mediatek/2017-October/011066.html and hope you can get rid of the difficult situation. If you still get the sd probe failed, I suggest you can change another card first. BTW, another post about sd on bpi 4.4 kerned is forgotten to be adding BPI-R2 tag. so I copied the same content to here.

should i apply these patches to 4.14-rc5?

what do you mean about the bpi-r2 tag?

  1. yes, you can apply these patches to the latest kernel.

  2. what I mean is your post on http://forum.banana-pi.org/t/kernel-4-14-sd-card/4059 is forgotten to add tags, which will allow other people too hard to find if they have the same issue.

patch applied, compiles without errors, but mmc1 still not , see no error in bootlog…should i change mmc1 to mt2701-mmc too? => also no success

the other thread (missing tag) is a private Message to you :wink:

how can i make the “probing” visible to check if driver is trying to access to mmc1…currently there is no related message

also said, that sd-card is recognized by u-boot and kernel 4.4.70 so it’s no hardware-issue

4.14 rc6 still have the SD-Issue…

found an 8GB Samsung SD-Card, same problem…kernel boots with ramdisk, but no mmcblk1 in /proc/partitions

4.14 seems to support also the switch-Chip (7530)…i see lan0-lan3 in “ifconfig -a”, but i can’t get working connection setting iP to eth0, only with lan0

i’ve found out, that i can access options from device-tree in sysfs:

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

so please help to get the mmc1 working

@Ryder.Lee @garywang @linkerosa

1 ) for sd card. it looks like the driver is required some patches to make more cards could be supported. the driver for sd on bpi-r2 is as below files https://elixir.free-electrons.com/linux/latest/source/drivers/mmc/host/mtk-sd.c maybe it is the time needing to compare how different is between upstream kernel and the used in 4.4.

  1. eth0 for dsa is meant to cpu port and thus you can’t use the eth0 to communicate with the host. every packet from eth0 will be padded some bytes to help identify which port the packet going through. So, instead you must use lanX or wan to configure and work with the tcp/ip stack.

Have you an idea,which parts i must compare/change to get sd working? i looked in this file before (latest patches are in here),but have no idea where to work on

created a diff between the 2 Versions mtk-sd.tar.gz (30,8 KB)

found that:

264c244
< #define DAT_TIMEOUT         (HZ    * 10)  /* 1000ms x10 */
---
> #define DAT_TIMEOUT         (HZ    * 5)   /* 1000ms x5 */

changed this and the CMD-Timeout to *10, but no success ;(

there also some lines with dev_dbg(…) this seems to be debug-messages…how to see these?

@Ryder.Lee have you an idea?

I’ve successfully used kexec to boot into another kernel - kexec actually has an option for specifying an initrd to load into memory as well as the kernel etc. I’ve not tested it but perhaps you can use this method to boot? petitboot and kexec-loader are little ‘linux as bootloader’ distros that you can get basic principals from - if it works then I say forget uboot - a little custom kernel, make a little script or use the ones from the aforementioned projects? boom - knock uboot and grub into a hat - or something to that effect.

EDIT : I’m currently getting ‘kexec_load failed: invalid argument’ again, related to non-contiguous memory referenced by the segments - there was a change I made to a previous kernel which was reported on patchwork and I can’t find it now - I’ll look into it - but you can deffo kexec on an ARM platform.

I have no problems with booting, the sd-card-driver in 4.14 have problems with my (and maybe other) cards. I can boot with ramdisk,but can’t access sd-card there too.

Ah I understand, my apologies. I’ve got a few cards I’ve not used yet - if I’m able to find a combination that replicates your results then maybe we can back-port for the time being - however I know very little about SD card specifics, I’d always assumed that there was some form of transparent/abstracted interface handled by a hardware controller - I didn’t know that variations in the hardware implementation of the cards was something that was handled in software.

If back porting isn’t feasible perhaps we can identify the specifics we need in our test case - perhaps if we mail the core developers of the related code they can advise?

4.4.70 driver works,but not from 4.14…so its not backporting,but maybe it helps you find the issue. Above i’ve uploaded a diff…imho we need the devs of this driver

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?