Commit 6eeefb37 authored by Robert Sprowson's avatar Robert Sprowson

Add support for CM3 and CM3L with or without eMMC

The SDIO HAL device reports when it is sure fixed disc media is attached (ie. eMMC soldered on the same PCB) which causes SDFS to report this to FileCore as a fixed disc, skipping the removable safety checks.
However, CM3 and CM3L both return the same board id so we can't work out which is which. Additionally, someone could attach an external eMMC in theory on a custom expansion board (instead of an SD card socket like the CMIO has).
To resolve this, we assign IO expander line 6 of U8 to be a safety catch. If that line is held low, it signifies this is definitely a CM3 - in effect this is a "definitely has eMMC" or "maybe has eMMC" switch.

Tested on CM1, CM3, CM3L, and a suitably modified CM3 with the help of Chris Hall.

Version 0.69. Tagged as 'BCM2835-0_69'
parent e65005cf
/* (0.68)
/* (0.69)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.68
#define Module_MajorVersion_CMHG 0.69
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 21 Feb 2017
#define Module_MajorVersion "0.68"
#define Module_Version 68
#define Module_MajorVersion "0.69"
#define Module_Version 69
#define Module_MinorVersion ""
#define Module_Date "21 Feb 2017"
......@@ -18,6 +18,6 @@
#define Module_ComponentName "BCM2835"
#define Module_ComponentPath "mixed/RiscOS/Sources/HAL/BCM2835"
#define Module_FullVersion "0.68"
#define Module_HelpVersion "0.68 (21 Feb 2017)"
#define Module_LibraryVersionInfo "0:68"
#define Module_FullVersion "0.69"
#define Module_HelpVersion "0.69 (21 Feb 2017)"
#define Module_LibraryVersionInfo "0:69"
......@@ -124,6 +124,7 @@ Board_Revision # 4
ARM_DMAChannels # 4
TouchBuf # 4
VirtGPIOBuf # 4
SafetyCatch # 4 ; Only valid on Compute Module 3
; align to 16 byte boundary NB this isnt aligned once hal initialised
# (((:INDEX:@)+15):AND::NOT:15)-(:INDEX:@)
......
......@@ -189,6 +189,29 @@ gbit ;
ORR a2, a2, a3, lsl #24 ; insert crc into hi byte
ADRL lr,MachineID
STMIA lr, {a1, a2}
; Check if it's a Compute Module 3, to decide whether to probe CM3 .v. CM3L
LDR a4, Board_Revision
AND a4, a4, #BoardRevision_Model_Mask
CMP a4, #BoardRevision_Model_Compute3
BNE %FT10
ADRL a1, tagbuffer
ADR a2, tagbcm3
MOV a3, #tagslencm3
BL memcpy ; copy to workspace buffer
MOV a2, a1
MOV a1, #MB_Chan_ARM2VC
BL HAL_SendHostMessage ; ask the questions
ADRL a4, tagbuffer ; now read the answers
LDR a1, [a4, #4]
TEQ a1, #&80000000 ; firmware new enough to accept all the tags?
LDREQ a1, [a4, #safcat-tagbcm3]
MOVNE a1, #-1
STR a1, SafetyCatch
10
[ HALDebug
BL HAL_DebugTXStrInline
DCB "QueryPlatform done",10,0
......@@ -261,6 +284,31 @@ virtgpio DCD 0
tagslen * . - tagb
ASSERT tagslen <= ?tagbuffer
; Extra series of VC side query tags for CM3.
;
tagbcm3 DCD tagslencm3
DCD 0
DCD ARM2VC_Tag_SetExtGPIOConfig
DCD 24
DCD 0
DCD 128+6 ; Expander IO6. Only relevant on Compute 3.
DCD 0 ; Configure pin on FXL6408 (U8) as input with weak pullup
DCD 0
DCD 1
DCD 1
DCD -1
DCD ARM2VC_Tag_GetExtGPIOState
DCD 8
DCD 0
DCD 128+6
safcat DCD -1 ; Sampled state, default high
DCD ARM2VC_Tag_End
tagslencm3 * . - tagbcm3
ASSERT tagslencm3 <= ?tagbuffer
MACRO
$class HALDeviceField $field, $value
LCLS myvalue
......
......@@ -329,13 +329,17 @@ SDIO_InitDevices ROUT
BIC a3, a3, #BoardRevision_User_Mask ; mask off overclocking / user bits
TST a3, #BoardRevision_NewScheme
BNE %FT01
ASSERT BoardRevision_AorB_Last < BoardRevision_BPlus
CMP a3, #BoardRevision_BPlus
TEQ a3, #BoardRevision_Compute
B %FT02
01 AND a3, a3, #BoardRevision_Model_Mask
ASSERT BoardRevision_Model_A < BoardRevision_Model_APlus
ASSERT BoardRevision_Model_B < BoardRevision_Model_APlus
CMP a3, #BoardRevision_Model_APlus
TEQ a3, #BoardRevision_Model_Compute
02 ; So now LO => model A or B, EQ => Compute, HI => A+, B+ or Pi 2
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
; Activate
ADRLO a1, Activate_AB
......@@ -357,6 +361,17 @@ SDIO_InitDevices ROUT
MOV a1, #HALDeviceSDHCI_SlotFlag_Bus4Bit
ORRHI a1, a1, #HALDeviceSDHCI_SlotFlag_NoCardDetect
ORREQ a1, a1, #HALDeviceSDHCI_SlotFlag_IntegratedMem
BNE %FT20
TEQ a3, #BoardRevision_Model_Compute3
BNE %FT10
LDR a4, SafetyCatch ; Here iff a Compute Module 3
; Unhelpfully the revision number for both CM3 and CM3L is the same, but we need
; to be sure whether the SDIO attached memory is fixed or removable.
TEQ a4, #0
BICNE a1, a1, #HALDeviceSDHCI_SlotFlag_IntegratedMem
10
MOVS a4, #0 ; put back EQ status
20
STR a1, SDHCISlotInfo + HALDeviceSDHCI_SlotInfo_Flags
; GetCapabilities
......
......@@ -715,9 +715,11 @@ HAL_Init
LDR a3, [a4, #:INDEX:Board_Model]
LDR a2, [a4, #:INDEX:Board_Revision]
LDR a1, [a4, #:INDEX:ARM_DMAChannels]
LDR ip, [a4, #:INDEX:SafetyCatch]
STR a3, Board_Model
STR a2, Board_Revision
STR a1, ARM_DMAChannels
STR ip, SafetyCatch
[ HALDebug
LDR a1, VC_Base
......
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