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
ae4d772f
Commit
ae4d772f
authored
Apr 22, 2021
by
Raptor Engineering Development Team
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix incorrect configuration of BMC Flash controller during startup
parent
0313fee2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
kestrel/src/kestrel.c
kestrel/src/kestrel.c
+13
-10
No files found.
kestrel/src/kestrel.c
View file @
ae4d772f
...
...
@@ -3151,7 +3151,7 @@ static void console_service(void)
#endif
#if (WITH_SPI)
static
int
tercel_spi_flash_init
(
uintptr_t
spi_ctl_cfgaddr
,
uintptr_t
spi_ctl_baseaddr
)
static
int
tercel_spi_flash_init
(
uintptr_t
spi_ctl_cfgaddr
,
uintptr_t
spi_ctl_baseaddr
,
int
clock_divisor
,
int
enable_4ba
)
{
int
i
;
uint32_t
dword
;
...
...
@@ -3237,11 +3237,14 @@ static int tercel_spi_flash_init(uintptr_t spi_ctl_cfgaddr, uintptr_t spi_ctl_ba
dword
|=
((
1
&
TERCEL_SPI_PHY_FAST_READ_ENABLE_MASK
)
<<
TERCEL_SPI_PHY_FAST_READ_ENABLE_SHIFT
);
write_tercel_register
(
spi_ctl_cfgaddr
,
TERCEL_SPI_REG_SYS_PHY_CFG1
,
dword
);
// Set SPI controller to 4BA mode
dword
=
read_tercel_register
(
spi_ctl_cfgaddr
,
TERCEL_SPI_REG_SYS_PHY_CFG1
);
dword
&=
~
(
TERCEL_SPI_PHY_4BA_ENABLE_MASK
<<
TERCEL_SPI_PHY_4BA_ENABLE_SHIFT
);
dword
|=
((
TERCEL_SPI_PHY_4BA_MODE
&
TERCEL_SPI_PHY_4BA_ENABLE_MASK
)
<<
TERCEL_SPI_PHY_4BA_ENABLE_SHIFT
);
write_tercel_register
(
spi_ctl_cfgaddr
,
TERCEL_SPI_REG_SYS_PHY_CFG1
,
dword
);
if
(
enable_4ba
)
{
// Set SPI controller to 4BA mode
dword
=
read_tercel_register
(
spi_ctl_cfgaddr
,
TERCEL_SPI_REG_SYS_PHY_CFG1
);
dword
&=
~
(
TERCEL_SPI_PHY_4BA_ENABLE_MASK
<<
TERCEL_SPI_PHY_4BA_ENABLE_SHIFT
);
dword
|=
((
TERCEL_SPI_PHY_4BA_MODE
&
TERCEL_SPI_PHY_4BA_ENABLE_MASK
)
<<
TERCEL_SPI_PHY_4BA_ENABLE_SHIFT
);
write_tercel_register
(
spi_ctl_cfgaddr
,
TERCEL_SPI_REG_SYS_PHY_CFG1
,
dword
);
}
#if (ALLOW_SPI_QUAD_MODE)
// Set SPI controller to QSPI mode
...
...
@@ -3251,10 +3254,10 @@ static int tercel_spi_flash_init(uintptr_t spi_ctl_cfgaddr, uintptr_t spi_ctl_ba
write_tercel_register
(
spi_ctl_cfgaddr
,
TERCEL_SPI_REG_SYS_PHY_CFG1
,
dword
);
#endif
// Set SPI clock cycle divider
to 5
// Set SPI clock cycle divider
dword
=
read_tercel_register
(
spi_ctl_cfgaddr
,
TERCEL_SPI_REG_SYS_PHY_CFG1
);
dword
&=
~
(
TERCEL_SPI_PHY_CLOCK_DIVISOR_MASK
<<
TERCEL_SPI_PHY_CLOCK_DIVISOR_SHIFT
);
dword
|=
((
5
&
TERCEL_SPI_PHY_CLOCK_DIVISOR_MASK
)
<<
TERCEL_SPI_PHY_CLOCK_DIVISOR_SHIFT
);
dword
|=
((
clock_divisor
&
TERCEL_SPI_PHY_CLOCK_DIVISOR_MASK
)
<<
TERCEL_SPI_PHY_CLOCK_DIVISOR_SHIFT
);
write_tercel_register
(
spi_ctl_cfgaddr
,
TERCEL_SPI_REG_SYS_PHY_CFG1
,
dword
);
// Calculate and dump configured SPI clock speed
...
...
@@ -3521,7 +3524,7 @@ int kestrel_init(void)
#if (WITH_SPI)
// Initialize BMC Flash controller
tercel_spi_flash_init
(
BMCSPIFLASHCFG_BASE
,
BMCSPIFLASH_BASE
);
tercel_spi_flash_init
(
BMCSPIFLASHCFG_BASE
,
BMCSPIFLASH_BASE
,
1
,
0
);
// Detect and print attached host SPI Flash ID
KESTREL_LOG
(
"Host SPI flash ID: 0x%08x"
,
read_host_spi_flash_id
(
BMCSPIFLASHCFG_BASE
,
BMCSPIFLASH_BASE
));
...
...
@@ -3530,7 +3533,7 @@ int kestrel_init(void)
configure_flash_device
(
BMCSPIFLASHCFG_BASE
,
BMCSPIFLASH_BASE
);
// Initialize host Flash controller
tercel_spi_flash_init
(
HOSTSPIFLASHCFG_BASE
,
HOSTSPIFLASH_BASE
);
tercel_spi_flash_init
(
HOSTSPIFLASHCFG_BASE
,
HOSTSPIFLASH_BASE
,
5
,
1
);
// Detect and print attached host SPI Flash ID
KESTREL_LOG
(
"Host SPI flash ID: 0x%08x"
,
read_host_spi_flash_id
(
HOSTSPIFLASHCFG_BASE
,
HOSTSPIFLASH_BASE
));
...
...
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