Commit 16658545 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Add BMU support for Pandora & TouchBook

Detail:
  s/BMU, Makefile - BMU HAL device implementations for the Pandora & TouchBook
  hdr/StaticWS - Reserve workspace for the BMU devices
  s/Boot - Add the BMU devices to HAL device initialisation. Move Enable_main_battery_charging into s/BMU.
Admin:
  Tested in ROM on BB-xM, Pandora, TouchBook


Version 0.83. Tagged as 'OMAP3-0_83'
parent 4e94b0fc
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
COMPONENT = OMAP-3 HAL COMPONENT = OMAP-3 HAL
TARGET = OMAP3 TARGET = OMAP3
OBJS = Top Boot Interrupts Timers CLib CLibAsm Stubs UART Debug PRCM Video USB I2C RTC SDMA TPS Audio GPIO GPMC NIC NVMemory CPUClk KbdScan SR37x SDIO KbdMatrix PAudio OBJS = Top Boot Interrupts Timers CLib CLibAsm Stubs UART Debug PRCM Video USB I2C RTC SDMA TPS Audio GPIO GPMC NIC NVMemory CPUClk KbdScan SR37x SDIO KbdMatrix PAudio BMU
USBDIR = <Lib$Dir>.USB USBDIR = <Lib$Dir>.USB
HDRS = HDRS =
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
GBLS Module_ComponentPath GBLS Module_ComponentPath
Module_MajorVersion SETS "0.82" Module_MajorVersion SETS "0.83"
Module_Version SETA 82 Module_Version SETA 83
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "08 Oct 2012" Module_Date SETS "21 Nov 2012"
Module_ApplicationDate SETS "08-Oct-12" Module_ApplicationDate SETS "21-Nov-12"
Module_ComponentName SETS "OMAP3" Module_ComponentName SETS "OMAP3"
Module_ComponentPath SETS "castle/RiscOS/Sources/HAL/OMAP3" Module_ComponentPath SETS "castle/RiscOS/Sources/HAL/OMAP3"
Module_FullVersion SETS "0.82" Module_FullVersion SETS "0.83"
Module_HelpVersion SETS "0.82 (08 Oct 2012)" Module_HelpVersion SETS "0.83 (21 Nov 2012)"
END END
/* (0.82) /* (0.83)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1. * Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 0.82 #define Module_MajorVersion_CMHG 0.83
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Oct 2012 #define Module_Date_CMHG 21 Nov 2012
#define Module_MajorVersion "0.82" #define Module_MajorVersion "0.83"
#define Module_Version 82 #define Module_Version 83
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "08 Oct 2012" #define Module_Date "21 Nov 2012"
#define Module_ApplicationDate "08-Oct-12" #define Module_ApplicationDate "21-Nov-12"
#define Module_ComponentName "OMAP3" #define Module_ComponentName "OMAP3"
#define Module_ComponentPath "castle/RiscOS/Sources/HAL/OMAP3" #define Module_ComponentPath "castle/RiscOS/Sources/HAL/OMAP3"
#define Module_FullVersion "0.82" #define Module_FullVersion "0.83"
#define Module_HelpVersion "0.82 (08 Oct 2012)" #define Module_HelpVersion "0.83 (21 Nov 2012)"
#define Module_LibraryVersionInfo "0:82" #define Module_LibraryVersionInfo "0:83"
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
GET <Lib$Dir>.USB.hdr.usbhal GET <Lib$Dir>.USB.hdr.usbhal
GET Hdr:GPIODevice GET Hdr:GPIODevice
GET Hdr:SDHCIDevice GET Hdr:SDHCIDevice
GET Hdr:BMUDevice
sb RN 9 sb RN 9
...@@ -36,6 +37,14 @@ SDHCISize * :INDEX:@ ...@@ -36,6 +37,14 @@ SDHCISize * :INDEX:@
MaxSDControllers * 3 MaxSDControllers * 3
; Per-BMU workspace
^ 0
BMUDevice # HALDevice_BMU_Size ; see Hdr:BMUDevice
BMUWS # 4 ; pointer to HAL workspace for HAL calls
BMUParams # 4 ; Per-device params
BMUSize * :INDEX:@
^ 0,sb ^ 0,sb
BoardConfig # BoardConfig_Size ; NOTE: Almost all code assumes the board config is at the start. You have been warned! BoardConfig # BoardConfig_Size ; NOTE: Almost all code assumes the board config is at the start. You have been warned!
OSheader # 4 OSheader # 4
...@@ -103,6 +112,8 @@ CPUClkWS # CPUClk_WorkspaceSize ...@@ -103,6 +112,8 @@ CPUClkWS # CPUClk_WorkspaceSize
GPIOWS # HALDevice_GPIO_Size GPIOWS # HALDevice_GPIO_Size
SDIOWS # SDHCISize * MaxSDControllers SDIOWS # SDHCISize * MaxSDControllers
BMUWS1 # BMUSize
BMUWS2 # BMUSize
# (((:INDEX:@)+15):AND::NOT:15)-(:INDEX:@) # (((:INDEX:@)+15):AND::NOT:15)-(:INDEX:@)
......
This diff is collapsed.
...@@ -178,6 +178,11 @@ HALdescriptor DATA ...@@ -178,6 +178,11 @@ HALdescriptor DATA
IMPORT NVMemory_Init IMPORT NVMemory_Init
IMPORT TPS_Init IMPORT TPS_Init
IMPORT PandoraKB_Init IMPORT PandoraKB_Init
IMPORT Enable_main_battery_charging
IMPORT BMU_InitDevice
IMPORT BMUParams_TPS65950_TouchBook
IMPORT BMUParams_BQ27200_TouchBook
IMPORT BMUParams_BQ27500_Pandora
EXPORT Board_Init_BeagleBoard EXPORT Board_Init_BeagleBoard
EXPORT Board_Init_DevKit8000 EXPORT Board_Init_DevKit8000
...@@ -764,131 +769,6 @@ Board_Init_TouchBook ROUT ...@@ -764,131 +769,6 @@ Board_Init_TouchBook ROUT
BL GPIOx_SetAsOutput BL GPIOx_SetAsOutput
EXIT EXIT
Enable_main_battery_charging ROUT
Entry "a1", 4
[ Debug
DebugTX "Enabling battery charging"
]
MOV a2, sp
MOV a3, #1
ADRL v1, IIC_DoOp_Poll
; Make sure MADC clocks are enabled
MOV a1, #&49*2
MOV a4, #&91 ; GPBR1
BL TPSRead
CMP a1, #0
BNE %FT9 ; Fail, just skip it
LDRB ip, [a2]
ORR ip, ip, #&90 ; DEFAULT_MADC_CLK_EN, MADC_HFCLK_EN
STRB ip, [a2]
MOV a1, #&49*2
BL TPSWrite
CMP a1, #0
BNE %FT9
; Disable the automatic battery charging so we can tweak the settings
MOV a1, #&4b*2
MOV a4, #&3d ; BOOT_BCI
BL TPSRead
CMP a1, #0
BNE %FT9
LDRB v3, [a2]
BIC v3, v3, #&7 ; BCIAUTOAC, BCIAUTOUSB, CVENAC
STRB v3, [a2]
MOV a1, #&4b*2
BL TPSWrite
CMP a1, #0
BNE %FT9
; Now stop the current charging session, if any
MOV a1, #&4a*2
MOV a4, #&75 ; BCIMDKEY
MOV ip, #&2A ; EKEY6
STRB ip, [a2]
BL TPSWrite
CMP a1, #0
BNE %FT9
; Wait until it's really stopped
MOV v2, #1000
7
MOV a1, #&4a*2
MOV a4, #&76 ; BCIMSTATEC
BL TPSRead
CMP a1, #0
BNE %FT9
LDREQB ip, [a2]
TSTEQ ip, #&30 ; Accept any non-charging, non-overvoltage state
BEQ %FT8
SUBS v2, v2, #1
BGT %BT7
[ Debug
DebugTX "Timeout waiting for charging to stop"
]
B %FT9 ; Timeout
8
; Now set CGAIN to double the charging current
MOV a1, #&4a*2
MOV a4, #&97 ; BCICTL1
BL TPSRead
CMP a1, #0
BNE %FT9
LDRB ip, [a2]
ORR ip, ip, #&20 ; CGAIN
STRB ip, [a2]
MOV a1, #&4a*2
BL TPSWrite
CMP a1, #0
BNE %FT9
; Unlock BCIIREF1
MOV a1, #&4a*2
MOV a4, #&85 ; BCIMFKEY
MOV ip, #&E7 ; MFKEY13
STRB ip, [a2]
BL TPSWrite
CMP a1, #0
BNE %FT9
; Set desired charging current (a1 on entry)
MOV a1, #&4a*2
ADD a2, sp, #4
MOV a3, #2
MOV a4, #&9B ; BCIIREF1
BL TPSWrite
CMP a1, #0
BNE %FT9
MOV a2, sp
MOV a3, #1
; Wait for any current BCI conversion to finish
7
MOV a1, #&4a*2
MOV a4, #&12 ; CTRL_SW1
BL TPSRead
CMP a1, #0
BNE %FT9
LDRB ip, [a2]
TST ip, #&18 ; Check both BCI and USB, since we also set the USB average bit
BEQ %BT7
; Enable BCI_USBAVERAGE to increase accuracy of BCI measurements
MOV a1, #&4a*2
MOV a4, #&0e
MOV ip, #&3f
STRB ip, [a2]
BL TPSWrite
CMP a1, #0
BNE %FT9
; Enable automatic charging again
ORR v3, v3, #&5 ; BCIAUTOAC, CVENAC
STRB v3, [a2]
MOV a1, #&4b*2
MOV a4, #&3d ; BOOT_BCI
BL TPSWrite
9
[ Debug
CMP a1, #0
BEQ %FT10
DebugRegByte a4, "Failed on register "
DebugRegByte a1, ", err="
]
10
EXIT
Board_Init_Pandora ROUT Board_Init_Pandora ROUT
Entry Entry
; Increase battery charging current ; Increase battery charging current
...@@ -1030,10 +910,20 @@ HAL_InitDevices ...@@ -1030,10 +910,20 @@ HAL_InitDevices
BL VideoDevice_Init BL VideoDevice_Init
; Board-specific HAL devices ; Board-specific HAL devices
LDR pc, [sb, #BoardConfig_InitDevices] LDR pc, [sb, #BoardConfig_InitDevices]
; EVM & touchbook don't have any extra devices ; EVM doesn't have any extra devices
Board_InitDevices_OMAP35xEVM Board_InitDevices_OMAP35xEVM
BL Audio_Init
EXIT
Board_InitDevices_TouchBook Board_InitDevices_TouchBook
BL Audio_Init BL Audio_Init
; BMU devices
ADRL a1, BMUWS1
ADRL a2, BMUParams_TPS65950_TouchBook
BL BMU_InitDevice
ADRL a1, BMUWS2
ADRL a2, BMUParams_BQ27200_TouchBook
BL BMU_InitDevice
EXIT EXIT
Board_InitDevices_Pandora Board_InitDevices_Pandora
...@@ -1043,6 +933,10 @@ Board_InitDevices_Pandora ...@@ -1043,6 +933,10 @@ Board_InitDevices_Pandora
BL SDIO_InitDevices BL SDIO_InitDevices
; Register the keyboard device ; Register the keyboard device
BL PandoraKB_Init BL PandoraKB_Init
; BMU device
ADRL a1, BMUWS1
ADRL a2, BMUParams_BQ27500_Pandora
BL BMU_InitDevice
EXIT EXIT
Board_InitDevices_IGEPv2 Board_InitDevices_IGEPv2
......
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