2019-06-22 04:25:27 +01:00
|
|
|
/*
|
2020-01-24 10:10:40 +00:00
|
|
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
2019-06-22 04:25:27 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include "i2c/i2c_types.hpp"
|
|
|
|
#include "i2c/driver/impl/i2c_pcv.hpp"
|
|
|
|
#include "i2c/driver/impl/i2c_registers.hpp"
|
|
|
|
|
2019-10-24 10:30:10 +01:00
|
|
|
using namespace ams::i2c::driver::impl;
|
2019-06-22 04:25:27 +01:00
|
|
|
|
2019-10-24 10:30:10 +01:00
|
|
|
namespace ams::pcv {
|
2019-06-22 04:25:27 +01:00
|
|
|
|
|
|
|
void Initialize() {
|
|
|
|
/* Don't do anything. */
|
|
|
|
}
|
|
|
|
|
|
|
|
void Finalize() {
|
|
|
|
/* Don't do anything. */
|
|
|
|
}
|
|
|
|
|
|
|
|
Result SetClockRate(PcvModule module, u32 hz) {
|
|
|
|
/* Get clock/reset registers. */
|
|
|
|
ClkRstRegisters regs;
|
|
|
|
regs.SetBus(ConvertFromPcvModule(module));
|
|
|
|
/* Set clock enabled/source. */
|
2019-06-22 08:10:21 +01:00
|
|
|
reg::SetBits(regs.clk_en_reg, regs.mask);
|
|
|
|
reg::ReadWrite(regs.clk_src_reg, 0x4, 0xFF);
|
2019-06-22 04:25:27 +01:00
|
|
|
svcSleepThread(1000ul);
|
2019-06-22 08:10:21 +01:00
|
|
|
reg::ReadWrite(regs.clk_src_reg, 0, 0xE0000000);
|
2019-06-22 04:25:27 +01:00
|
|
|
svcSleepThread(2000ul);
|
|
|
|
|
2019-10-24 09:40:44 +01:00
|
|
|
return ResultSuccess();
|
2019-06-22 04:25:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Result SetClockEnabled(PcvModule module, bool enabled) {
|
2019-10-24 09:40:44 +01:00
|
|
|
return ResultSuccess();
|
2019-06-22 04:25:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Result SetVoltageEnabled(u32 domain, bool enabled) {
|
2019-10-24 09:40:44 +01:00
|
|
|
return ResultSuccess();
|
2019-06-22 04:25:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Result SetVoltageValue(u32 domain, u32 voltage) {
|
2019-10-24 09:40:44 +01:00
|
|
|
return ResultSuccess();
|
2019-06-22 04:25:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Result SetReset(PcvModule module, bool reset) {
|
|
|
|
/* Get clock/reset registers. */
|
|
|
|
ClkRstRegisters regs;
|
|
|
|
regs.SetBus(ConvertFromPcvModule(module));
|
|
|
|
|
|
|
|
/* Set/clear reset. */
|
|
|
|
if (reset) {
|
2019-06-22 08:10:21 +01:00
|
|
|
reg::SetBits(regs.rst_reg, regs.mask);
|
2019-06-22 04:25:27 +01:00
|
|
|
} else {
|
2019-06-22 08:10:21 +01:00
|
|
|
reg::ClearBits(regs.rst_reg, regs.mask);
|
2019-06-22 04:25:27 +01:00
|
|
|
}
|
|
|
|
|
2019-10-24 09:40:44 +01:00
|
|
|
return ResultSuccess();
|
2019-06-22 04:25:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|