author | Simon Howkins <simonh@symbian.org> |
Mon, 29 Nov 2010 13:27:18 +0000 | |
changeset 122 | d8dcdd4c8ab4 |
parent 99 | 30b472f724b4 |
permissions | -rwxr-xr-x |
0 | 1 |
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// \omap3530\omap3530_assp\shared\tps65950\tps65950_int.cpp |
|
15 |
// Interrupt dispatcher for TPS65950 |
|
16 |
// This file is part of the Beagle Base port |
|
17 |
// |
|
18 |
||
19 |
#include <e32cmn.h> |
|
20 |
#include <nk_priv.h> |
|
21 |
#include <kernel.h> |
|
22 |
//#include <e32atomics.h> |
|
23 |
#include <omap3530_i2c.h> |
|
24 |
#include <omap3530_i2creg.h> |
|
25 |
#include "tps65950.h" |
|
26 |
#include <assp/omap3530_assp/locks.h> |
|
27 |
||
28 |
// Use a dedicated thread for processing interrupts to prevent deadlocking |
|
29 |
// the main TSP65960 thread and to avoid needing a big state machine to |
|
30 |
// process interrupts in multiple DFCs |
|
31 |
TDfcQue* TheInterruptDfcQue; |
|
32 |
_LIT( KInterruptDfcQueName, "TPS65950INT" ); |
|
33 |
const TInt KInterruptDfcQuePriority = 28; |
|
34 |
const TInt KDfcPriority = 2; |
|
35 |
||
36 |
#define FULL_RISING_EDGEMASK 0xAA |
|
37 |
#define FULL_FALLING_EDGEMASK 0x55 |
|
38 |
||
39 |
||
40 |
namespace TPS65950 |
|
41 |
{ |
|
42 |
||
43 |
struct TInterruptBank |
|
44 |
{ |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
45 |
TInt iBit[8]; |
0 | 46 |
}; |
47 |
||
48 |
struct TSubInterruptBank |
|
49 |
{ |
|
50 |
TUint8 iLen; |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
51 |
TUint16 iRegs[6]; |
0 | 52 |
}; |
53 |
||
54 |
enum TMaskPolarity |
|
55 |
{ |
|
56 |
EClearToEnable, |
|
57 |
ESetToEnable |
|
58 |
}; |
|
59 |
||
60 |
struct TControl |
|
61 |
{ |
|
62 |
TUint16 iSetReg; |
|
63 |
TUint16 iClrReg; |
|
64 |
TUint16 iStatReg; |
|
65 |
TUint8 iBitMask; |
|
66 |
TMaskPolarity iPolarity : 8; |
|
67 |
}; |
|
68 |
||
69 |
NONSHARABLE_CLASS( TPS65950Int ) : public MInterruptDispatcher |
|
70 |
{ |
|
71 |
public: |
|
72 |
TPS65950Int(); |
|
73 |
TInt Init(); |
|
74 |
||
75 |
virtual TInt Bind(TInt aId, TIsr aIsr, TAny* aPtr); |
|
76 |
virtual TInt Unbind(TInt aId); |
|
77 |
virtual TInt Enable(TInt aId); |
|
78 |
virtual TInt Disable(TInt aId); |
|
79 |
virtual TInt Clear(TInt aId); |
|
80 |
virtual TInt SetPriority(TInt aId, TInt aPriority); |
|
81 |
||
82 |
private: |
|
83 |
static void Spurious( TAny* aParam ); |
|
84 |
static void Dispatch( TAny* aParam ); |
|
85 |
static void Dfc( TAny* aParam ); |
|
86 |
||
87 |
TInt InitialiseTPS65950IntController(); |
|
88 |
||
89 |
private: |
|
90 |
TDfc iDfc; |
|
91 |
}; |
|
92 |
||
93 |
static SInterruptHandler TheHandlers[ TPS65950::KNumTPSInts ]; |
|
94 |
||
95 |
static const TControl KControl[ TPS65950::KNumTPSInts ] = |
|
96 |
{ |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
97 |
//iimr iReg group bitoffset /* |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
98 |
/*0*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_SC_DETECT, ESetToEnable}, |
0 | 99 |
/*1*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_MBCHG, ESetToEnable}, |
100 |
/*2*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_PWROK_TIMEOUT, ESetToEnable}, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
101 |
/*3*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_HOT_DIE, ESetToEnable}, |
0 | 102 |
/*4*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_RTC_IT, ESetToEnable}, |
103 |
/*5*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_USB_PRES, ESetToEnable}, |
|
104 |
/*6*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_CHG_PRES, ESetToEnable}, |
|
105 |
/*7*/{ Register::PWR_IMR1, Register::PWR_IMR1, Register::PWR_ISR1, PWR_IMR1::PWR_CHG_PWRONS, ESetToEnable}, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
106 |
|
0 | 107 |
/*8*/{ Register::MADC_IMR1, Register::MADC_IMR1, Register::MADC_ISR1, MADC_IMR1::MADC_USB_ISR1, EClearToEnable}, |
108 |
/*9*/{ Register::MADC_IMR1, Register::MADC_IMR1, Register::MADC_ISR1, MADC_IMR1::MADC_SW2_ISR1, EClearToEnable}, |
|
109 |
/*10*/{ Register::MADC_IMR1, Register::MADC_IMR1, Register::MADC_ISR1, MADC_IMR1::MADC_SW1_ISR1, EClearToEnable}, |
|
110 |
/*11*/{ Register::MADC_IMR1, Register::MADC_IMR1, Register::MADC_ISR1, MADC_IMR1::MADC_RT_ISR1, EClearToEnable}, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
111 |
|
0 | 112 |
/*12*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO7ISR1, EClearToEnable}, |
113 |
/*13*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO6ISR1, EClearToEnable}, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
114 |
/*14*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO5ISR1, EClearToEnable}, |
0 | 115 |
/*15*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO4ISR1, EClearToEnable}, |
116 |
/*16*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO3ISR1, EClearToEnable}, |
|
117 |
/*17*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO2ISR1, EClearToEnable}, |
|
118 |
/*18*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO1ISR1, EClearToEnable}, |
|
119 |
/*19*/{ Register::GPIO_IMR1A, Register::GPIO_IMR1A, Register::GPIO_ISR1A, GPIO_IMR1A::GPIO0ISR1, EClearToEnable}, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
120 |
|
0 | 121 |
/*20*/ { Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO15ISR2, EClearToEnable}, |
122 |
/*22*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO14ISR2, EClearToEnable}, |
|
123 |
/*23*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO13ISR2, EClearToEnable}, |
|
124 |
/*24*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO12ISR2, EClearToEnable}, |
|
125 |
/*25*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO11ISR2, EClearToEnable}, |
|
126 |
/*26*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO10ISR2, EClearToEnable}, |
|
127 |
/*27*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO9ISR2, EClearToEnable}, |
|
128 |
/*28*/{ Register::GPIO_IMR2A, Register::GPIO_IMR2A, Register::GPIO_ISR2A, GPIO_IMR2A::GPIO8ISR2, EClearToEnable}, |
|
129 |
||
130 |
/*29*/{ Register::GPIO_IMR3A, Register::GPIO_IMR3A, Register::GPIO_ISR3A, GPIO_IMR3A::GPIO17ISR3, EClearToEnable}, |
|
131 |
/*30*/{ Register::GPIO_IMR3A, Register::GPIO_IMR3A, Register::GPIO_ISR3A, GPIO_IMR3A::GPIO16ISR3, EClearToEnable}, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
132 |
|
0 | 133 |
/*31*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_BATSTS_ISR1, EClearToEnable}, |
134 |
/*32*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_TBATOR1_ISR1, EClearToEnable}, |
|
135 |
/*33*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_TBATOR2_ISR1, EClearToEnable}, |
|
136 |
/*34*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_ICHGEOC_ISR1, EClearToEnable}, |
|
137 |
/*35*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_ICHGLOW_ISR1ASTO, EClearToEnable}, |
|
138 |
/*36*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_IICHGHIGH_ISR1, EClearToEnable}, |
|
139 |
/*37*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_TMOVF_ISR1, EClearToEnable}, |
|
140 |
/*38*/{ Register::BCIIMR1A, Register::BCIIMR1A, Register::BCIISR1A, BCIIMR1A::BCI_WOVF_ISR1, EClearToEnable}, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
141 |
|
0 | 142 |
/*39*/{ Register::BCIIMR2A, Register::BCIIMR2A, Register::BCIISR2A, BCIIMR2A::BCI_ACCHGOV_ISR1, EClearToEnable}, |
143 |
/*40*/{ Register::BCIIMR2A, Register::BCIIMR2A, Register::BCIISR2A, BCIIMR2A::BCI_VBUSOV_ISR1, EClearToEnable}, |
|
144 |
/*41*/{ Register::BCIIMR2A, Register::BCIIMR2A, Register::BCIISR2A, BCIIMR2A::BCI_VBATOV_ISR1, EClearToEnable}, |
|
145 |
/*42*/{ Register::BCIIMR2A, Register::BCIIMR2A, Register::BCIISR2A, BCIIMR2A::BCI_VBATLVL_ISR1, EClearToEnable}, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
146 |
|
0 | 147 |
/*43*/{ Register::KEYP_IMR1, Register::KEYP_IMR1, Register::KEYP_ISR1, KEYP_IMR1::KEYP_ITMISR1, EClearToEnable}, |
148 |
/*44*/{ Register::KEYP_IMR1, Register::KEYP_IMR1, Register::KEYP_ISR1, KEYP_IMR1::KEYP_ITTOISR1, EClearToEnable}, |
|
149 |
/*45*/{ Register::KEYP_IMR1, Register::KEYP_IMR1, Register::KEYP_ISR1, KEYP_IMR1::KEYP_ITLKISR1, EClearToEnable}, |
|
150 |
/*46*/{ Register::KEYP_IMR1, Register::KEYP_IMR1, Register::KEYP_ISR1, KEYP_IMR1::KEYP_ITKPISR1, EClearToEnable}, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
151 |
|
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
152 |
/*46*/{ Register::USB_INT_EN_RISE_SET, Register::USB_INT_EN_RISE_CLR, Register::USB_INT_STS, USB_INT_STS::USB_INTSTS_IDGND, ESetToEnable }, |
0 | 153 |
/*47*/{ Register::USB_INT_EN_RISE_SET, Register::USB_INT_EN_RISE_CLR, Register::USB_INT_STS, USB_INT_STS::USB_INTSTS_SESSEND, ESetToEnable }, |
154 |
/*48*/{ Register::USB_INT_EN_RISE_SET, Register::USB_INT_EN_RISE_CLR, Register::USB_INT_STS, USB_INT_STS::USB_INTSTS_SESSVALID, ESetToEnable }, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
155 |
/*49*/{ Register::USB_INT_EN_RISE_SET, Register::USB_INT_EN_RISE_CLR, Register::USB_INT_STS, USB_INT_STS::USB_INTSTS_VBUSVALID, ESetToEnable }, |
0 | 156 |
/*50*/{ Register::USB_INT_EN_RISE_SET, Register::USB_INT_EN_RISE_CLR, Register::USB_INT_STS, USB_INT_STS::USB_INTSTS_HOSTDISCONNECT, ESetToEnable }, |
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
157 |
|
0 | 158 |
/*51*/{ Register::CARKIT_INT_EN_SET, Register::CARKIT_INT_EN_CLR, Register::CARKIT_INT_STS, CARKIT_INT_STS::CARKIT_CARDP, ESetToEnable }, |
159 |
/*52*/{ Register::CARKIT_INT_EN_SET, Register::CARKIT_INT_EN_CLR, Register::CARKIT_INT_STS, CARKIT_INT_STS::CARKIT_CARINTDET, ESetToEnable }, |
|
160 |
/*53*/{ Register::CARKIT_INT_EN_SET, Register::CARKIT_INT_EN_CLR, Register::CARKIT_INT_STS, CARKIT_INT_STS::CARKIT_IDFLOAT, ESetToEnable }, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
161 |
|
0 | 162 |
/*54*/{ Register::OTHER_INT_EN_RISE_SET, Register::OTHER_INT_EN_RISE_CLR, Register::OTHER_INT_STS, OTHER_INT_STS::OTHER_INT_VB_SESS_VLD, ESetToEnable }, |
163 |
/*55*/{ Register::OTHER_INT_EN_RISE_SET, Register::OTHER_INT_EN_RISE_CLR, Register::OTHER_INT_STS, OTHER_INT_STS::OTHER_INT_DM_HI, ESetToEnable }, |
|
164 |
/*56*/{ Register::OTHER_INT_EN_RISE_SET, Register::OTHER_INT_EN_RISE_CLR, Register::OTHER_INT_STS, OTHER_INT_STS::OTHER_INT_DP_HI, ESetToEnable }, |
|
165 |
/*57*/{ Register::OTHER_INT_EN_RISE_SET, Register::OTHER_INT_EN_RISE_CLR, Register::OTHER_INT_STS, OTHER_INT_STS::OTHER_INT_MANU, ESetToEnable }, |
|
166 |
/*58*/{ Register::OTHER_INT_EN_RISE_SET, Register::OTHER_INT_EN_RISE_CLR, Register::OTHER_INT_STS, OTHER_INT_STS::OTHER_INT_ABNORMAL_STRESS, ESetToEnable }, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
167 |
|
0 | 168 |
/*59*/{ Register::ID_INT_EN_RISE_SET, Register::ID_INT_EN_RISE_CLR, Register::ID_INT_STS, ID_INT_STS::ID_INTID_RES_FLOAT, ESetToEnable }, |
169 |
/*60*/{ Register::ID_INT_EN_RISE_SET, Register::ID_INT_EN_RISE_CLR, Register::ID_INT_STS, ID_INT_STS::ID_INTID_RES_440K, ESetToEnable }, |
|
170 |
/*61*/{ Register::ID_INT_EN_RISE_SET, Register::ID_INT_EN_RISE_CLR, Register::ID_INT_STS, ID_INT_STS::ID_INTID_RES_200K, ESetToEnable }, |
|
171 |
/*62*/{ Register::ID_INT_EN_RISE_SET, Register::ID_INT_EN_RISE_CLR, Register::ID_INT_STS, ID_INT_STS::ID_INTID_RES_102K, ESetToEnable }, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
172 |
|
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
173 |
/*63*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_PSM_ERROR, ESetToEnable }, |
0 | 174 |
/*64*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_PH_ACC, ESetToEnable }, |
175 |
/*65*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_CHARGER, ESetToEnable }, |
|
176 |
/*66*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_USB_HOST, ESetToEnable }, |
|
177 |
/*67*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_USB_OTG_B, ESetToEnable }, |
|
178 |
/*68*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_CARKIT, ESetToEnable }, |
|
179 |
/*69*/ { Register::CARKIT_SM_1_INT_EN_SET, Register::CARKIT_SM_1_INT_EN_CLR, Register::CARKIT_SM_1_INT_STS, CARKIT_SM_1_INT_STS::CARKIT_SM_1_DISCONNECTED, ESetToEnable }, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
180 |
|
0 | 181 |
/*70*/ { Register::CARKIT_SM_2_INT_EN_SET, Register::CARKIT_SM_2_INT_EN_CLR, Register::CARKIT_SM_2_INT_STS, CARKIT_SM_2_INT_STS::CARKIT_SM_2_STOP_PLS_MISS, ESetToEnable }, |
182 |
/*71*/ { Register::CARKIT_SM_2_INT_EN_SET, Register::CARKIT_SM_2_INT_EN_CLR, Register::CARKIT_SM_2_INT_STS, CARKIT_SM_2_INT_STS::CARKIT_SM_2_STEREO_TO_MONO, ESetToEnable }, |
|
183 |
/*72*/ { Register::CARKIT_SM_2_INT_EN_SET, Register::CARKIT_SM_2_INT_EN_CLR, Register::CARKIT_SM_2_INT_STS, CARKIT_SM_2_INT_STS::CARKIT_SM_2_PHONE_UART, ESetToEnable }, |
|
184 |
/*73*/ { Register::CARKIT_SM_2_INT_EN_SET, Register::CARKIT_SM_2_INT_EN_CLR, Register::CARKIT_SM_2_INT_STS, CARKIT_SM_2_INT_STS::CARKIT_SM_2_PH_NO_ACK, ESetToEnable } |
|
185 |
}; |
|
186 |
||
187 |
||
188 |
const static TInterruptBank pwrBank = { |
|
189 |
ETPS65950_IRQ_PWR_CHG_PWRONS, |
|
190 |
ETPS65950_IRQ_PWR_CHG_PRES, |
|
191 |
ETPS65950_IRQ_PWR_USB_PRES, |
|
192 |
ETPS65950_IRQ_PWR_RTC_IT, |
|
193 |
ETPS65950_IRQ_PWR_HOT_DIE, |
|
194 |
ETPS65950_IRQ_PWR_PWROK_TIMEOUT, |
|
195 |
ETPS65950_IRQ_PWR_MBCHG, |
|
196 |
ETPS65950_IRQ_PWR_SC_DETECT, |
|
197 |
}; |
|
198 |
||
199 |
const static TInterruptBank madcBank = { |
|
200 |
ETPS65950_IRQ_MADC_RT_ISR1, |
|
201 |
ETPS65950_IRQ_MADC_SW1_ISR1, |
|
202 |
ETPS65950_IRQ_MADC_SW2_ISR1, |
|
203 |
ETPS65950_IRQ_MADC_USB_ISR1, |
|
204 |
}; |
|
205 |
||
206 |
const static TInterruptBank gpioBank0 = { |
|
207 |
ETPS65950_IRQ_GPIO_0ISR1, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
208 |
ETPS65950_IRQ_GPIO_1ISR1, |
0 | 209 |
ETPS65950_IRQ_GPIO_2ISR1, |
210 |
ETPS65950_IRQ_GPIO_3ISR1, |
|
211 |
ETPS65950_IRQ_GPIO_4ISR1, |
|
212 |
ETPS65950_IRQ_GPIO_5ISR1, |
|
213 |
ETPS65950_IRQ_GPIO_6ISR1, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
214 |
ETPS65950_IRQ_GPIO_7ISR2 |
0 | 215 |
}; |
216 |
||
217 |
const static TInterruptBank gpioBank1 = { |
|
218 |
ETPS65950_IRQ_GPIO_8ISR2, |
|
219 |
ETPS65950_IRQ_GPIO_9ISR2, |
|
220 |
ETPS65950_IRQ_GPIO_10ISR2, |
|
221 |
ETPS65950_IRQ_GPIO_11ISR2, |
|
222 |
ETPS65950_IRQ_GPIO_12ISR2, |
|
223 |
ETPS65950_IRQ_GPIO_13ISR2, |
|
224 |
ETPS65950_IRQ_GPIO_14ISR2, |
|
225 |
ETPS65950_IRQ_GPIO_15ISR2 |
|
226 |
}; |
|
227 |
||
228 |
const static TInterruptBank gpioBank2 = { |
|
229 |
ETPS65950_IRQ_GPIO16ISR3, |
|
230 |
ETPS65950_IRQ_GPIO17ISR3 |
|
231 |
}; |
|
232 |
||
233 |
const static TInterruptBank bciBank0 = { |
|
234 |
ETPS65950_IRQ_BCI_WOVF_ISR1, |
|
235 |
ETPS65950_IRQ_BCI_TMOVF_ISR1, |
|
236 |
ETPS65950_IRQ_BCI_IICHGHIGH_ISR1, |
|
237 |
ETPS65950_IRQ_BCI_ICHGLOW_ISR1ASTO, |
|
238 |
ETPS65950_IRQ_BCI_ICHGEOC_ISR1, |
|
239 |
ETPS65950_IRQ_BCI_TBATOR2_ISR1, |
|
240 |
ETPS65950_IRQ_BCI_TBATOR1_ISR1, |
|
241 |
ETPS65950_IRQ_BCI_BATSTS_ISR1 |
|
242 |
}; |
|
243 |
||
244 |
const static TInterruptBank bciBank1 = { |
|
245 |
ETPS65950_IRQ_BCI_VBATLVL_ISR1, |
|
246 |
ETPS65950_IRQ_BCI_VBATOV_ISR1, |
|
247 |
ETPS65950_IRQ_BCI_VBUSOV_ISR1, |
|
248 |
ETPS65950_IRQ_BCI_ACCHGOV_ISR1 |
|
249 |
}; |
|
250 |
||
251 |
const static TInterruptBank keypBank = { |
|
252 |
ETPS65950_IRQ_KEYP_ITKPISR1, |
|
253 |
ETPS65950_IRQ_KEYP_ITLKISR1, |
|
254 |
ETPS65950_IRQ_KEYP_ITTOISR1, |
|
255 |
ETPS65950_IRQ_KEYP_ITMISR1, |
|
256 |
}; |
|
257 |
||
258 |
const static TInterruptBank usbINTSTSBank = { |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
259 |
ETPS65950_IRQ_USB_INTSTS_IDGND, |
0 | 260 |
ETPS65950_IRQ_USB_INTSTS_SESSEND, |
261 |
ETPS65950_IRQ_USB_INTSTS_SESSVALID, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
262 |
ETPS65950_IRQ_USB_INTSTS_VBUSVALID, |
0 | 263 |
ETPS65950_IRQ_USB_INTSTS_HOSTDISCONNECT |
264 |
}; |
|
265 |
||
266 |
const static TInterruptBank usbCARKITBank = { |
|
267 |
ETPS65950_IRQ_USB_CARKIT_CARDP, |
|
268 |
ETPS65950_IRQ_USB_CARKIT_CARINTDET, |
|
269 |
ETPS65950_IRQ_USB_CARKIT_IDFLOAT |
|
270 |
}; |
|
271 |
||
272 |
const static TInterruptBank usbOTHERBank = { |
|
273 |
ETPS65950_IRQ_USB_OTHER_INT_VB_SESS_VLD, |
|
274 |
ETPS65950_IRQ_USB_OTHER_INT_DM_HI, |
|
275 |
ETPS65950_IRQ_USB_OTHER_INT_DP_HI, |
|
276 |
ETPS65950_IRQ_USB_OTHER_INT_MANU, |
|
277 |
ETPS65950_IRQ_USB_OTHER_INT_ABNORMAL_STRESS |
|
278 |
}; |
|
279 |
||
280 |
const static TInterruptBank usbIDINTBank = { |
|
281 |
ETPS65950_IRQ_USB_ID_INT_ID_RES_FLOAT, |
|
282 |
ETPS65950_IRQ_USB_ID_INT_ID_RES_440K, |
|
283 |
ETPS65950_IRQ_USB_ID_INT_ID_RES_200K, |
|
284 |
ETPS65950_IRQ_USB_ID_INT_ID_RES_102K |
|
285 |
}; |
|
286 |
||
287 |
const static TInterruptBank usbSM1Bank = { |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
288 |
ETPS65950_IRQ_USB_CARKIT_SM_1_PSM_ERROR, |
0 | 289 |
ETPS65950_IRQ_USB_CARKIT_SM_1_PH_ACC, |
290 |
ETPS65950_IRQ_USB_CARKIT_SM_1_CHARGER, |
|
291 |
ETPS65950_IRQ_USB_CARKIT_SM_1_USB_HOST, |
|
292 |
ETPS65950_IRQ_USB_CARKIT_SM_1_USB_OTG_B, |
|
293 |
ETPS65950_IRQ_USB_CARKIT_SM_1_CARKIT |
|
294 |
}; |
|
295 |
||
296 |
const static TInterruptBank usbSM2Bank = { |
|
297 |
ETPS65950_IRQ_USB_CARKIT_SM_2_STOP_PLS_MISS, |
|
298 |
ETPS65950_IRQ_USB_CARKIT_SM_2_STEREO_TO_MONO, |
|
299 |
ETPS65950_IRQ_USB_CARKIT_SM_2_PHONE_UART, |
|
300 |
ETPS65950_IRQ_USB_CARKIT_SM_2_PH_NO_ACK |
|
301 |
}; |
|
302 |
||
303 |
const static TInterruptBank* TheMapTable [6][6] = { |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
304 |
//maps against PIH_ISR bits |
0 | 305 |
//reg banks sub modules |
306 |
{&gpioBank0, &gpioBank1, &gpioBank2, NULL, NULL, NULL}, |
|
307 |
{&keypBank, NULL, NULL, NULL, NULL, NULL}, |
|
308 |
{&bciBank0, &bciBank1, NULL, NULL, NULL, NULL}, |
|
309 |
{&madcBank, NULL, NULL, NULL, NULL, NULL}, |
|
310 |
{&usbINTSTSBank, &usbCARKITBank, &usbOTHERBank, &usbIDINTBank, &usbSM1Bank, &usbSM2Bank}, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
311 |
{&pwrBank, NULL, NULL, NULL, NULL, NULL} |
0 | 312 |
}; |
313 |
||
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
314 |
const static TSubInterruptBank subBank[6] = { |
0 | 315 |
/*gpio*/{3,{Register::GPIO_ISR1A,Register::GPIO_ISR2A,Register::GPIO_ISR3A,NULL,NULL,NULL}}, |
316 |
/*keyp*/{1,{Register::KEYP_ISR1,NULL,NULL,NULL,NULL,NULL}}, |
|
317 |
/*bci*/ {2,{Register::BCIISR1A,Register::BCIISR2A,NULL,NULL,NULL,NULL}}, |
|
318 |
/*madc*/{1,{Register::MADC_ISR1,NULL,NULL,NULL,NULL,NULL}}, |
|
319 |
/*usb*/ {6,{Register::USB_INT_STS,Register::CARKIT_INT_STS,Register::OTHER_INT_STS,Register::ID_INT_STS, Register::CARKIT_SM_1_INT_STS, Register::CARKIT_SM_2_INT_STS}}, |
|
320 |
/*pwr*/ {1,{Register::PWR_ISR1,NULL,NULL,NULL,NULL,NULL}}, |
|
321 |
}; |
|
322 |
||
323 |
||
324 |
TPS65950Int::TPS65950Int() |
|
325 |
: iDfc( Dfc, this, KDfcPriority ) |
|
326 |
{ |
|
327 |
for( TInt i = 0; i < TPS65950::KNumTPSInts; ++i ) |
|
328 |
{ |
|
329 |
TheHandlers[ i ].iIsr = Spurious; |
|
330 |
TheHandlers[ i ].iPtr = (TAny*)( KTPS65950IrqFirst + i ); |
|
331 |
} |
|
332 |
} |
|
333 |
||
334 |
TInt TPS65950Int::Init() |
|
335 |
{ |
|
336 |
iDfc.SetDfcQ( TheInterruptDfcQue ); |
|
337 |
||
338 |
TInt r = InitialiseTPS65950IntController(); |
|
339 |
||
340 |
if( KErrNone == r ) |
|
341 |
{ |
|
342 |
TInt r = Interrupt::Bind( EOmap3530_IRQ7_SYS_NIRQ, Dispatch, this ); |
|
343 |
if( KErrNone == r ) |
|
344 |
{ |
|
345 |
r = Interrupt::Enable( EOmap3530_IRQ7_SYS_NIRQ ); |
|
346 |
} |
|
347 |
} |
|
348 |
||
349 |
if( KErrNone == r ) |
|
350 |
{ |
|
351 |
Register( EIrqRangeBasePsu ); |
|
352 |
} |
|
353 |
return r; |
|
354 |
} |
|
355 |
||
356 |
||
357 |
TInt TPS65950Int::InitialiseTPS65950IntController() |
|
358 |
{ |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
359 |
__KTRACE_OPT(KTPS65950,Kern::Printf("+TPS65950Int:InitIntController")); |
0 | 360 |
|
361 |
struct TInitRegList |
|
362 |
{ |
|
363 |
TUint16 iReg; |
|
364 |
TUint8 iValue; |
|
365 |
}; |
|
366 |
||
367 |
static const TInitRegList KInitList[] = |
|
368 |
{ |
|
369 |
{ GPIO_SIH_CTRL::Addr, GPIO_SIH_CTRL::SIH_PENDDIS | GPIO_SIH_CTRL::SIH_COR | GPIO_SIH_CTRL::SIH_EXCLEN }, |
|
370 |
// { Register::GPIO_CTRL, 0x00 }, |
|
371 |
{ Register::GPIO_IMR1A , 0xff }, |
|
372 |
{ Register::GPIO_IMR2A , 0xff }, |
|
373 |
{ Register::GPIO_IMR3A , 0xff }, |
|
374 |
{ Register::GPIO_IMR1B , 0xff }, |
|
375 |
{ Register::GPIO_IMR2B , 0xff }, |
|
376 |
{ Register::GPIO_IMR3B , 0xff }, |
|
377 |
{ Register::GPIO_EDR1, 0x00 }, |
|
378 |
{ Register::GPIO_EDR2, 0x00 }, |
|
379 |
{ Register::GPIO_EDR3, 0x00 }, |
|
380 |
{ Register::GPIO_EDR4, 0x00 }, |
|
381 |
{ Register::GPIO_EDR5, 0x00 }, |
|
382 |
{ Register::USB_INT_EN_RISE_CLR, 0x1f }, |
|
383 |
{ Register::USB_INT_EN_FALL_CLR, 0x1f }, |
|
384 |
{ Register::CARKIT_INT_EN_CLR, 0x1f }, |
|
385 |
{ Register::OTHER_INT_EN_RISE_CLR,0xe3 }, |
|
386 |
{ Register::OTHER_INT_EN_FALL_CLR,0xe3 }, |
|
387 |
{ Register::ID_INT_EN_RISE_CLR, 0x0f }, |
|
388 |
{ Register::ID_INT_EN_FALL_CLR, 0x0f }, |
|
389 |
{ Register::CARKIT_SM_1_INT_EN_CLR,0xff }, |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
390 |
{ Register::CARKIT_SM_2_INT_EN_CLR,0xff }, |
0 | 391 |
{ KEYP_SIH_CTRL::Addr, KEYP_SIH_CTRL::SIH_PENDDIS | KEYP_SIH_CTRL::SIH_COR | KEYP_SIH_CTRL::SIH_EXCLEN }, |
392 |
{ Register::KEYP_IMR1, 0x0f }, |
|
393 |
{ Register::KEYP_IMR2, 0x0f }, |
|
394 |
{ Register::KEYP_EDR, FULL_RISING_EDGEMASK }, |
|
395 |
{ BCISIHCTRL::Addr, BCISIHCTRL::SIH_PENDDIS | BCISIHCTRL::SIH_COR | BCISIHCTRL::SIH_EXCLEN }, |
|
396 |
{ Register::BCIIMR1A, 0xff }, |
|
397 |
{ Register::BCIIMR2A, 0xff }, |
|
398 |
{ Register::BCIIMR1B, 0xff }, |
|
399 |
{ Register::BCIIMR2B, 0xff }, |
|
400 |
{ Register::BCIEDR1, FULL_RISING_EDGEMASK }, |
|
401 |
{ Register::BCIEDR2, FULL_RISING_EDGEMASK }, |
|
402 |
{ Register::BCIEDR3, FULL_RISING_EDGEMASK }, |
|
403 |
{ MADC_SIH_CTRL::Addr, MADC_SIH_CTRL::SIH_PENDDIS | MADC_SIH_CTRL::SIH_COR | MADC_SIH_CTRL::SIH_EXCLEN }, |
|
404 |
{ Register::MADC_IMR1, 0x0f }, |
|
405 |
{ Register::MADC_IMR2, 0x0f }, |
|
406 |
{ Register::MADC_EDR, FULL_RISING_EDGEMASK }, |
|
407 |
{ PWR_SIH_CTRL::Addr, PWR_SIH_CTRL::SIH_PENDDIS | PWR_SIH_CTRL::SIH_COR | PWR_SIH_CTRL::SIH_EXCLEN }, |
|
408 |
{ Register::PWR_IMR1, 0xff }, |
|
409 |
{ Register::PWR_IMR2, 0xff }, |
|
410 |
{ Register::PWR_EDR1, FULL_FALLING_EDGEMASK }, |
|
411 |
{ Register::PWR_EDR2, FULL_FALLING_EDGEMASK } |
|
412 |
}; |
|
413 |
||
414 |
const TInt KInitListCount = (sizeof( KInitList ) / sizeof( KInitList[0] ) ); |
|
415 |
||
416 |
static const TUint16 KClearList[] = |
|
417 |
{ |
|
418 |
Register::CARKIT_INT_LATCH, |
|
419 |
Register::USB_INT_LATCH, |
|
420 |
Register::OTHER_INT_LATCH, |
|
421 |
Register::ID_INT_LATCH, |
|
422 |
Register::CARKIT_SM_1_INT_LATCH, |
|
423 |
Register::CARKIT_SM_2_INT_LATCH, |
|
424 |
Register::GPIO_ISR1A, |
|
425 |
Register::GPIO_ISR2A, |
|
426 |
Register::GPIO_ISR3A, |
|
427 |
Register::KEYP_ISR1, |
|
428 |
Register::BCIISR1A, |
|
429 |
Register::BCIISR2A, |
|
430 |
Register::MADC_ISR1, |
|
431 |
Register::PWR_ISR1 |
|
432 |
}; |
|
433 |
||
434 |
const TInt KClearListCount = (sizeof( KClearList ) / sizeof( KClearList[0] ) ); |
|
435 |
||
436 |
||
437 |
TInt r = KErrNone; |
|
438 |
||
439 |
// Disable all interrupts |
|
440 |
for( TInt i = 0; (i < KInitListCount) && (KErrNone == r); ++i ) |
|
441 |
{ |
|
442 |
r = WriteSync( KInitList[i].iReg, KInitList[i].iValue ); |
|
443 |
} |
|
444 |
||
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
445 |
if(r == KErrNone) |
0 | 446 |
{ |
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
447 |
// Clear all interrupts |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
448 |
for( TInt i = 0; (i < KClearListCount) && (KErrNone == r); ++i ) |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
449 |
{ |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
450 |
// some registers need more reads to clear them, e.g. PWR_ISR1 needs 3- why is that? |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
451 |
TInt num_attempts = 5; |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
452 |
TUint8 dummy = 3; |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
453 |
while(dummy && (num_attempts > 0)) |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
454 |
{ |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
455 |
num_attempts--; |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
456 |
r = ReadSync( KClearList[i], dummy ); |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
457 |
if(r != KErrNone) |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
458 |
{ |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
459 |
break; |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
460 |
} |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
461 |
} |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
462 |
} |
0 | 463 |
} |
464 |
||
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
465 |
__KTRACE_OPT(KTPS65950,Kern::Printf("-TPS65950Int:InitIntController:%d", r)); |
0 | 466 |
|
467 |
return r; |
|
468 |
} |
|
469 |
||
470 |
||
471 |
void TPS65950Int::Spurious( TAny* aParam ) |
|
472 |
{ |
|
473 |
Kern::Fault("TPS65950SpurioustInt", (TInt)aParam ); |
|
474 |
} |
|
475 |
||
476 |
TInt TPS65950Int::Bind(TInt aId, TIsr aIsr, TAny* aPtr) |
|
477 |
{ |
|
478 |
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950:Bind:%x->%x", aId, aIsr )); |
|
479 |
||
480 |
TInt r = KErrNone; |
|
481 |
||
482 |
if( (TUint)aId < KTPS65950IrqLast ) |
|
483 |
{ |
|
484 |
TUint tblOffset = aId - KTPS65950IrqFirst; |
|
485 |
||
486 |
TInt irq=__SPIN_LOCK_IRQSAVE_W(BeagleExtIVTLock); |
|
487 |
TheHandlers[tblOffset ].iIsr = aIsr; |
|
488 |
TheHandlers[tblOffset].iPtr = aPtr; |
|
489 |
__SPIN_UNLOCK_IRQRESTORE_W(BeagleExtIVTLock,irq); |
|
490 |
||
491 |
} |
|
492 |
else |
|
493 |
{ |
|
494 |
r = KErrArgument; |
|
495 |
} |
|
496 |
||
497 |
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Bind:%x:%d", aId, r )); |
|
498 |
return r; |
|
499 |
} |
|
500 |
||
501 |
TInt TPS65950Int::Unbind(TInt aId) |
|
502 |
{ |
|
503 |
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950:Unbind:%x", aId )); |
|
504 |
||
505 |
TInt r = KErrNone; |
|
506 |
||
507 |
if( (TUint)aId < KTPS65950IrqLast ) |
|
508 |
{ |
|
509 |
TUint tblOffset = aId - KTPS65950IrqFirst; |
|
510 |
TInt irq=__SPIN_LOCK_IRQSAVE_W(BeagleExtIVTLock); |
|
511 |
TheHandlers[tblOffset ].iIsr = Spurious; |
|
512 |
TheHandlers[tblOffset ].iPtr = NULL; |
|
513 |
__SPIN_UNLOCK_IRQRESTORE_W(BeagleExtIVTLock,irq); |
|
514 |
} |
|
515 |
else |
|
516 |
{ |
|
517 |
r = KErrArgument; |
|
518 |
} |
|
519 |
||
520 |
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Unbind:%x:%d", aId, r )); |
|
521 |
return r; |
|
522 |
} |
|
523 |
||
524 |
TInt TPS65950Int::Enable(TInt aId) |
|
525 |
{ |
|
526 |
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950:Enable:%x", aId )); |
|
527 |
||
528 |
TInt r = KErrNone; |
|
529 |
||
530 |
if( (TUint)aId < KTPS65950IrqLast ) |
|
531 |
{ |
|
532 |
CHECK_PRECONDITIONS(MASK_NOT_ISR | MASK_NOT_IDFC,"tps65950::InterruptEnable Cant enable a slow src in ISR Context"); |
|
533 |
||
534 |
TUint tblOffset = aId - KTPS65950IrqFirst; |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
535 |
|
0 | 536 |
TInt irq=__SPIN_LOCK_IRQSAVE_R(BeagleExtIVTLock); |
537 |
if( TheHandlers[ tblOffset ].iIsr == Spurious ) |
|
538 |
{ |
|
539 |
r = KErrNotReady; |
|
540 |
} |
|
541 |
__SPIN_UNLOCK_IRQRESTORE_R(BeagleExtIVTLock,irq); |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
542 |
|
0 | 543 |
if( r != KErrNone ) |
544 |
{ |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
545 |
__KTRACE_OPT(KTPS65950,Kern::Printf("=tps65950:Enable:%d NOT BOUND", aId )); |
0 | 546 |
} |
547 |
else |
|
548 |
{ |
|
549 |
const TControl& control = KControl[ tblOffset ]; |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
550 |
|
0 | 551 |
TUint8 val; |
552 |
ReadSync( control.iSetReg, val ); |
|
553 |
if( EClearToEnable == control.iPolarity ) |
|
554 |
{ |
|
555 |
ClearSetSync( control.iSetReg, control.iBitMask, KSetNone ); |
|
556 |
} |
|
557 |
else |
|
558 |
{ |
|
559 |
ClearSetSync( control.iSetReg, KClearNone, control.iBitMask ); |
|
560 |
} |
|
561 |
ReadSync( control.iSetReg, val ); |
|
562 |
} |
|
563 |
} |
|
564 |
else |
|
565 |
{ |
|
566 |
r = KErrArgument; |
|
567 |
} |
|
568 |
||
569 |
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Enable:%x:%d", aId, r )); |
|
570 |
return r; |
|
571 |
} |
|
572 |
||
573 |
TInt TPS65950Int::Disable(TInt aId) |
|
574 |
{ |
|
575 |
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950:Disable:%x", aId )); |
|
576 |
||
577 |
TInt r = KErrNone; |
|
578 |
||
579 |
if( (TUint)aId < KTPS65950IrqLast ) |
|
580 |
{ |
|
581 |
CHECK_PRECONDITIONS(MASK_NOT_ISR | MASK_NOT_IDFC,"tps65950::InterruptDisable Cant disable a slow src in ISR Context"); |
|
582 |
||
583 |
TUint tblOffset = aId - KTPS65950IrqFirst; |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
584 |
|
0 | 585 |
TInt irq=__SPIN_LOCK_IRQSAVE_R(BeagleExtIVTLock); |
586 |
if( TheHandlers[ tblOffset ].iIsr == Spurious ) |
|
587 |
{ |
|
588 |
r = KErrNotReady; |
|
589 |
} |
|
590 |
__SPIN_UNLOCK_IRQRESTORE_R(BeagleExtIVTLock,irq); |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
591 |
|
0 | 592 |
if( r != KErrNone ) |
593 |
{ |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
594 |
__KTRACE_OPT(KTPS65950,Kern::Printf("=tps65950:Disable:%d NOT BOUND", aId )); |
0 | 595 |
} |
596 |
else |
|
597 |
{ |
|
598 |
const TControl& control = KControl[ tblOffset ]; |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
599 |
|
0 | 600 |
if( EClearToEnable == control.iPolarity ) |
601 |
{ |
|
602 |
ClearSetSync( control.iClrReg, KClearNone, control.iBitMask ); |
|
603 |
} |
|
604 |
else |
|
605 |
{ |
|
606 |
ClearSetSync( control.iSetReg, control.iBitMask, KSetNone ); |
|
607 |
} |
|
608 |
} |
|
609 |
} |
|
610 |
else |
|
611 |
{ |
|
612 |
r = KErrArgument; |
|
613 |
} |
|
614 |
||
615 |
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Disable:%x:%d", aId, r )); |
|
616 |
return r; |
|
617 |
} |
|
618 |
||
619 |
TInt TPS65950Int::Clear(TInt aId) |
|
620 |
{ |
|
621 |
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950:Clear:%x", aId )); |
|
622 |
||
623 |
TInt r = KErrNone; |
|
624 |
||
625 |
if( (TUint)aId < KTPS65950IrqLast ) |
|
626 |
{ |
|
627 |
CHECK_PRECONDITIONS(MASK_NOT_ISR,"tps65950::InterruptClear Cant clear a slow src in ISR Context"); |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
628 |
|
0 | 629 |
TUint tblOffset = aId - KTPS65950IrqFirst; |
630 |
TUint8 value; |
|
631 |
//clear on read ! //we may lose some of the other ints if many enabled |
|
632 |
ReadSync( KControl[ tblOffset ].iStatReg, value ); |
|
633 |
} |
|
634 |
else |
|
635 |
{ |
|
636 |
r = KErrArgument; |
|
637 |
} |
|
638 |
||
639 |
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Clear:%x:%d", aId, r )); |
|
640 |
return r; |
|
641 |
} |
|
642 |
||
643 |
TInt TPS65950Int::SetPriority(TInt aId, TInt aPriority) |
|
644 |
{ |
|
645 |
__KTRACE_OPT(KTPS65950,Kern::Printf("tps65950:SetPriority:%x", aId )); |
|
646 |
return KErrNotSupported; |
|
647 |
} |
|
648 |
||
649 |
||
650 |
void TPS65950Int::Dispatch(TAny * aParam ) |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
651 |
{ |
0 | 652 |
Interrupt::Disable(EOmap3530_IRQ7_SYS_NIRQ); |
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
653 |
reinterpret_cast<TPS65950Int*>(aParam)->iDfc.Add(); |
0 | 654 |
} |
655 |
||
656 |
void TPS65950Int::Dfc( TAny* aParam ) |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
657 |
{ |
0 | 658 |
__KTRACE_OPT(KTPS65950,Kern::Printf("+tps65950Int:Dfc" )); |
659 |
||
660 |
TUint8 highVectors=0; |
|
661 |
TUint8 subVector=0; |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
662 |
|
0 | 663 |
ReadSync( PIH_ISR_P1::Addr, highVectors ); |
664 |
__ASSERT_DEBUG( highVectors != 0,Kern::Fault("tps65950 int signalled but no vector ",highVectors)); |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
665 |
|
0 | 666 |
for(TInt i=0; i<=5;i++,highVectors >>=1) |
667 |
{ |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
668 |
if(highVectors & 0x1) |
0 | 669 |
{ |
670 |
for(TInt8 j=0;j<subBank[i].iLen;j++) |
|
671 |
{ |
|
672 |
ReadSync( subBank[i].iRegs[j], subVector ); |
|
673 |
for(TInt k=0;k < 8;k++) |
|
674 |
{ |
|
675 |
if(subVector & 0x1) |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
676 |
{ |
0 | 677 |
TInt tblOffset = TheMapTable[i][j]->iBit[k] - KTPS65950IrqFirst; |
678 |
||
679 |
__KTRACE_OPT(KTPS65950,Kern::Printf("=tps65950:Dfc:BIT_%d HIGH on REG %x VECTOR is %x ISR %x", |
|
680 |
k,subBank[i].iRegs[j], tblOffset, TheHandlers[tblOffset].iIsr)); |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
681 |
|
0 | 682 |
(TheHandlers[tblOffset].iIsr)(TheHandlers[tblOffset].iPtr); |
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
683 |
} |
0 | 684 |
subVector >>= 1; |
685 |
} |
|
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
686 |
} |
0 | 687 |
} |
99
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
688 |
} |
30b472f724b4
Fix for Bug 3913 - beagleboard crashes on cold boot-up
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
0
diff
changeset
|
689 |
Interrupt::Enable(EOmap3530_IRQ7_SYS_NIRQ); |
0 | 690 |
|
691 |
__KTRACE_OPT(KTPS65950,Kern::Printf("-tps65950:Dfc" )); |
|
692 |
} |
|
693 |
||
694 |
||
695 |
} // namespace TPS65950 |
|
696 |
||
697 |
||
698 |
GLDEF_C TInt InitInterrupts() |
|
699 |
{ |
|
700 |
TInt r = Kern::DfcQCreate( TheInterruptDfcQue, KInterruptDfcQuePriority, &KInterruptDfcQueName ); |
|
701 |
if( KErrNone == r ) |
|
702 |
{ |
|
703 |
r = KErrNoMemory; |
|
704 |
TPS65950::TPS65950Int* dispatcher = new TPS65950::TPS65950Int; |
|
705 |
if( dispatcher ) |
|
706 |
{ |
|
707 |
r = dispatcher->Init(); |
|
708 |
} |
|
709 |
} |
|
710 |
return r; |
|
711 |
} |
|
712 |
||
713 |