Commit 6b067b53 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Be more thorough in GPIO initialisation

Detail:
  s/GPIO - The OMAP HAL now takes steps to make sure that the TPS GPIO controller is enabled, and that any GPIO-LEDs have the correct PWM settings. The TPS GPIO pull up/down settings are also initialised for the beagleboard.
Admin:
  Tested on rev C2 BB, A2 BB-xM, C BB-xM, C1 TouchBook


Version 0.45. Tagged as 'OMAP3-0_45'
parent 61dbee2a
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.44"
Module_Version SETA 44
Module_MajorVersion SETS "0.45"
Module_Version SETA 45
Module_MinorVersion SETS ""
Module_Date SETS "23 May 2011"
Module_ApplicationDate SETS "23-May-11"
Module_Date SETS "25 May 2011"
Module_ApplicationDate SETS "25-May-11"
Module_ComponentName SETS "OMAP3"
Module_ComponentPath SETS "castle/RiscOS/Sources/HAL/OMAP3"
Module_FullVersion SETS "0.44"
Module_HelpVersion SETS "0.44 (23 May 2011)"
Module_FullVersion SETS "0.45"
Module_HelpVersion SETS "0.45 (25 May 2011)"
END
/* (0.44)
/* (0.45)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.44
#define Module_MajorVersion_CMHG 0.45
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 23 May 2011
#define Module_Date_CMHG 25 May 2011
#define Module_MajorVersion "0.44"
#define Module_Version 44
#define Module_MajorVersion "0.45"
#define Module_Version 45
#define Module_MinorVersion ""
#define Module_Date "23 May 2011"
#define Module_Date "25 May 2011"
#define Module_ApplicationDate "23-May-11"
#define Module_ApplicationDate "25-May-11"
#define Module_ComponentName "OMAP3"
#define Module_ComponentPath "castle/RiscOS/Sources/HAL/OMAP3"
#define Module_FullVersion "0.44"
#define Module_HelpVersion "0.44 (23 May 2011)"
#define Module_LibraryVersionInfo "0:44"
#define Module_FullVersion "0.45"
#define Module_HelpVersion "0.45 (25 May 2011)"
#define Module_LibraryVersionInfo "0:45"
......@@ -41,7 +41,8 @@
IMPORT DebugHALPrintReg
GPIO_Init
; Don't bother resetting the controllers for now, just make sure no IRQs are enabled
; Don't bother resetting the controllers, it could conflict with settings made by x-loader/u-boot
Entry "v1-v3",4
LDR a1, L4_GPIO_Table
MOV a2, #6
MOV a3, #0
......@@ -50,7 +51,41 @@ GPIO_Init
SUBS a2, a2, #1
STR a3, [a4, #GPIO_IRQENABLE1]
BNE %BT10
MOV pc, lr
; Make sure the TPS GPIOs are enabled properly.
; Specifically:
; - Set the GPIO_ON bit in GPIO_CTRL
LDR v1, HALInitialised
CMP v1, #0
ADREQL v1, IIC_DoOp_Poll
LDRNE v1, OSentries+4*OS_IICOpV
MOV a1, #TPSGPIO_IIC*2
MOV a2, sp
MOV a3, #1
MOV a4, #TPS_GPIO_CTRL
BL TPSRead
LDRB ip, [a2]
TST ip, #4 ; GPIO_ON
ORREQ ip, ip, #4
STREQB ip, [a2]
MOVEQ a1, #TPSGPIO_IIC*2
BLEQ TPSWrite
; - For the beagleboard, set up the right pullup/down settings
; TODO - Do other platforms, and add to boardconfig
LDR a1, [sb, #BoardConfig_MachID]
LDR a2, =MachID_BeagleBoard
CMP a1, a2
BNE %FT10
MOV a1, #TPSGPIO_IIC*2
ADR a2, Beagle_TPS_PUPD
MOV a3, #5
MOV a4, #TPS_GPIOPUPCTR1
BL TPSWrite
10
EXIT
Beagle_TPS_PUPD
DCD 4_1010000111000120 ; 0 = PU/PD off, 1=PD, 2=PU
DCD 4_0011
; a1 = GPIO # (OMAP or TPS or TPS LED)
; a2 = initial value (zero or nonzero)
......@@ -95,6 +130,35 @@ GPIOx_SetAsOutput
BL TPSWrite
EXIT
20 ; TPS LED
; First make sure the relevant PWM is configured correctly
; i.e. generate a constant signal, not timed on/off
Push "a2,a3"
MOV a1, #TPSLED_IIC*2
ADR a2, PWM_Value
MOV a3, #2
MOVEQ a4, #TPS_PWMAON
MOVNE a4, #TPS_PWMBON
LDR v1, HALInitialised
CMP v1, #0
ADREQL v1, IIC_DoOp_Poll
LDRNE v1, OSentries+4*OS_IICOpV
BL TPSWrite
; Also make sure the PWM clocks are enabled
MOV a1, #&49*2
ADD a2, sp, #8
MOV a3, #1
MOV a4, #&91 ; GPBR1
BL TPSRead
LDR ip, [sp, #4]
CMP ip, #TPS_GPIO_PIN_MAX
LDRB ip, [a2]
ORREQ ip, ip, #&5
ORRNE ip, ip, #&a
STRB ip, [a2]
MOV a1, #&49*2
BL TPSWrite
Pull "a2,a3"
CMP a3, #TPS_GPIO_PIN_MAX
; Match the behaviour of Linux:
; a2=0 sets the LED*ON and LED*PWM bits
; a2!=0 clears them
......@@ -108,10 +172,6 @@ GPIOx_SetAsOutput
MOV a3, #1
MOV a4, #TPS_LEDEN
; If HAL_Init isn't done yet, we can't use OS_IICOpV
LDR v1, HALInitialised
CMP v1, #0
ADREQL v1, IIC_DoOp_Poll
LDRNE v1, OSentries+4*OS_IICOpV
BL TPSRead
LDRB ip, [a2]
BIC ip, ip, v3
......@@ -121,6 +181,9 @@ GPIOx_SetAsOutput
BL TPSWrite
EXIT
PWM_Value
DCD &7f7f
; a1 = GPIO # (OMAP or TPS)
; a2 = value (zero or nonzero)
GPIOx_SetOutput
......
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