Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zephyr Firmware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kestrel Collaboration
Kestrel Firmware
Zephyr Firmware
Commits
f8254000
Commit
f8254000
authored
Aug 20, 2022
by
Raptor Engineering Development Team
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port bare metal Arctic Tern LPC clock setup to Zephyr firmware
parent
1c51655b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletion
+37
-1
kestrel/src/aquila.h
kestrel/src/aquila.h
+6
-1
kestrel/src/kestrel.c
kestrel/src/kestrel.c
+31
-0
No files found.
kestrel/src/aquila.h
View file @
f8254000
// © 2020 Raptor Engineering, LLC
// © 2020
-2022
Raptor Engineering, LLC
//
// Released under the terms of the GPL v3
// See the LICENSE file for full details
...
...
@@ -141,6 +141,11 @@
#define AQUILA_LPC_VUART_WFIFO_FULL_MASK 0x1
#define AQUILA_LPC_VUART_WFIFO_FULL_SHIFT 24
#define AQUILA_LPC_CLOCK_VALID_MASK 0x1
#define AQUILA_LPC_CLOCK_VALID_SHIFT 24
#define AQUILA_LPC_CLK_PLL_RESET_MASK 0x1
#define AQUILA_LPC_CLK_PLL_RESET_SHIFT 31
#define AQUILA_EV_MASTER_IRQ 0x1
static
inline
uint32_t
read_aquila_register
(
unsigned
long
base_address
,
uint8_t
reg
)
...
...
kestrel/src/kestrel.c
View file @
f8254000
...
...
@@ -2319,6 +2319,7 @@ int power_on_chassis(int has_lock)
int
cpu_count
=
1
;
int
i2c_read_retcode
;
uint8_t
byte
;
uint32_t
dword
;
if
(
!
has_lock
)
{
if
(
k_sem_take
(
&
chassis_control_semaphore
,
K_MSEC
(
10
))
!=
0
)
{
...
...
@@ -2426,6 +2427,36 @@ int power_on_chassis(int has_lock)
return
-
5
;
}
// Force the LPC clock PLL into reset, if present
// If no PLL is present, this operation does nothing
dword
=
read_aquila_register
(
HOSTLPCSLAVE_BASE
,
AQUILA_LPC_REG_CONTROL1
);
dword
|=
(
AQUILA_LPC_CLK_PLL_RESET_MASK
<<
AQUILA_LPC_CLK_PLL_RESET_SHIFT
);
write_aquila_register
(
HOSTLPCSLAVE_BASE
,
AQUILA_LPC_REG_CONTROL1
,
dword
);
// Enable LPC clock buffer
gpio1_out_write
(
gpio1_out_read
()
|
(
0x01
<<
12
));
// Wait a few ms for the external clock buffer to stabilize
k_usleep
(
16
*
1000
);
// Bring the LPC PLL back out of reset, if present
// If no PLL is present, this operation does nothing
dword
=
read_aquila_register
(
HOSTLPCSLAVE_BASE
,
AQUILA_LPC_REG_CONTROL1
);
dword
&=
~
(
AQUILA_LPC_CLK_PLL_RESET_MASK
<<
AQUILA_LPC_CLK_PLL_RESET_SHIFT
);
write_aquila_register
(
HOSTLPCSLAVE_BASE
,
AQUILA_LPC_REG_CONTROL1
,
dword
);
// Wait for LPC clock to stabilize
uint64_t
clock_valid_timer
=
k_uptime_get
();
do
{
if
((
k_uptime_get
()
-
clock_valid_timer
)
>
1000
)
{
printf
(
"LPC clock did not come online, aborting!
\n
"
);
power_off_chassis
(
1
);
return
-
6
;
}
}
while
(
!
((
read_aquila_register
(
HOSTLPCSLAVE_BASE
,
AQUILA_LPC_REG_STATUS4
)
>>
AQUILA_LPC_CLOCK_VALID_SHIFT
)
&
AQUILA_LPC_CLOCK_VALID_MASK
));
host_power_status
=
HOST_POWER_STATUS_IPLING
;
host_power_status_changed
();
display_character
(
'0'
+
2
+
host_power_status
,
0
);
// STATUS CODE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment