Commit 004817c4 authored by Ben Avison's avatar Ben Avison Committed by ROOL

SD bugfixes

Detail:
* Implement SD activity LED for Pi 4
* Remove inappropriate reprogramming of GPIO47 for Pi 3 B(+) and A+
* Correct the value for SDHCIWriteInterval which is used during SetSDCLK()
parent bbe41f94
......@@ -71,16 +71,17 @@ GPIO_CLK * 48
GPIO_CD_AB * 47 ; needs pull-up; active low
GPIO_STATUS_LED_AB * 16 ; active low
GPIO_STATUS_LED_BPlus * 47 ; active high
GPIO_STATUS_LED_B4 * 42 ; active high
; GPIO function select bitfields
GPIO_FSEL_INPUT * 0
GPIO_FSEL_OUTPUT * 1
GPIO_FSEL_ALT0 * 2
GPIO_FSEL_ALT1 * 3
GPIO_FSEL_ALT2 * 4
GPIO_FSEL_ALT3 * 5
GPIO_FSEL_ALT4 * 6
GPIO_FSEL_ALT5 * 7
GPIO_FSEL_ALT0 * 4
GPIO_FSEL_ALT1 * 5
GPIO_FSEL_ALT2 * 6
GPIO_FSEL_ALT3 * 7
GPIO_FSEL_ALT4 * 3
GPIO_FSEL_ALT5 * 2
GPIO_FSEL_SHIFT * 3
GPIO_FSEL_MASK * 7
......@@ -352,7 +353,7 @@ SDIO_InitDevices ROUT
CMP a3, #BoardRevision_Model_APlus
TEQ a3, #BoardRevision_Model_Compute
TEQNE a3, #BoardRevision_Model_Compute3
02 ; So now LO => model A or B, EQ => Compute or Compute3, HI => A+, B+ or Pi 2 or Pi 3 or Pi 0
02 ; So now LO => model A or B, EQ => Compute or Compute3, HI => A+, B+ or Pi 2 or Pi 3 or Pi 0 or Pi 4
; Activate
ADRLO a1, Activate_AB
......@@ -402,9 +403,19 @@ SDIO_InitDevices ROUT
TEQNE a3, #BoardRevision_Model_B3Plus
TEQNE a3, #BoardRevision_Model_A3Plus
ADREQL a1, SetActivity_B3
TEQ a3, #BoardRevision_Model_B4
ADREQL a1, SetActivity_B4
STR a1, SDHCIDevice + HALDevice_SDHCISetActivity
STR a2, SDHCIDevice + HALDevice_SDHCIGetCardDetect
; Don't do pin muxing in Activate for any of these boards either
TEQ a3, #BoardRevision_Model_B3
TEQNE a3, #BoardRevision_Model_B3Plus
TEQNE a3, #BoardRevision_Model_A3Plus
TEQNE a3, #BoardRevision_Model_B4
ADREQ a1, Activate_Compute
STREQ a1, SDHCIDevice + HALDevice_Activate
MOV a1, #0 ; flags
ADR a2, SDHCIDevice
Pull "lr"
......@@ -722,7 +733,7 @@ SetSDCLK ROUT
; Set a long gap between writes while we're fiddling with the SDCLK
MOV a1, #MIN_SDCLK
BL CalcTimings
STR a1, SDHCIWriteInterval
STR v1, SDHCIWriteInterval
; Calculate desired values
MOV a1, a3
......@@ -870,6 +881,21 @@ SetActivity_B3 ROUT
STR a2, [a1]
Pull "sb,pc"
SetActivity_B4 ROUT
Push "sb,lr"
DoMemBarrier lr ; switch to GPIO peripheral
SUB sb, a1, #:INDEX:SDHCIDevice
; Line is active high
ASSERT HALDeviceSDHCI_ActivityOff = 0
MOVS a2, a3
MOVNE a2, #1
MOV a1, #GPIO_STATUS_LED_B4
BL GPIO_Output
DoMemBarrier lr ; back to SDHCI peripheral
Pull "sb,pc"
GetCardDetect_AB ROUT
Push "sb,lr"
DoMemBarrier lr ; switch to GPIO peripheral
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment