xref: /openbmc/openpower-proc-control/procedures/phal/set_SPI_mux.cpp (revision 9b72678d2bd8c43f35e3f47ca0515d1f09ddb69f)
1ce042fe8SEddie James /**
2ce042fe8SEddie James  * Copyright (C) 2020 IBM Corporation
3ce042fe8SEddie James  *
4ce042fe8SEddie James  * Licensed under the Apache License, Version 2.0 (the "License");
5ce042fe8SEddie James  * you may not use this file except in compliance with the License.
6ce042fe8SEddie James  * You may obtain a copy of the License at
7ce042fe8SEddie James  *
8ce042fe8SEddie James  *     http://www.apache.org/licenses/LICENSE-2.0
9ce042fe8SEddie James  *
10ce042fe8SEddie James  * Unless required by applicable law or agreed to in writing, software
11ce042fe8SEddie James  * distributed under the License is distributed on an "AS IS" BASIS,
12ce042fe8SEddie James  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13ce042fe8SEddie James  * See the License for the specific language governing permissions and
14ce042fe8SEddie James  * limitations under the License.
15ce042fe8SEddie James  */
16ce042fe8SEddie James #include "cfam_access.hpp"
17ce042fe8SEddie James #include "p10_cfam.hpp"
18ce042fe8SEddie James #include "registration.hpp"
19ce042fe8SEddie James #include "targeting.hpp"
20ce042fe8SEddie James 
21ce042fe8SEddie James namespace openpower
22ce042fe8SEddie James {
23ce042fe8SEddie James namespace p10
24ce042fe8SEddie James {
25ce042fe8SEddie James 
26ce042fe8SEddie James using namespace openpower::cfam::access;
27ce042fe8SEddie James using namespace openpower::cfam::p10;
28ce042fe8SEddie James using namespace openpower::targeting;
29ce042fe8SEddie James 
30ce042fe8SEddie James /**
31ce042fe8SEddie James  * Sets the mux on the P10 to the FSI SPI masters rather than the PIB SPI
32ce042fe8SEddie James  * masters. This should only be executed before the host is powering on since
33ce042fe8SEddie James  * the host will set the mux to the PIB SPI masters.
34ce042fe8SEddie James  */
setSPIMux()35ce042fe8SEddie James void setSPIMux()
36ce042fe8SEddie James {
37ce042fe8SEddie James     Targeting targets;
38ce042fe8SEddie James 
39ce042fe8SEddie James     for (const auto& t : targets)
40ce042fe8SEddie James     {
41*9b72678dSJayanth Othayoth         writeRegWithMask(t, P10_ROOT_CTRL8, 0xF0000000, 0xF0000000);
42ce042fe8SEddie James     }
43ce042fe8SEddie James }
44ce042fe8SEddie James 
4563508a73SBrad Bishop REGISTER_PROCEDURE("setSPIMux", setSPIMux)
46ce042fe8SEddie James 
47ce042fe8SEddie James } // namespace p10
48ce042fe8SEddie James } // namespace openpower
49