i2c: add auto-generated bus/device map

This commit is contained in:
Michael Scire 2020-10-31 14:20:01 -07:00 committed by SciresM
parent 4a2daa4810
commit f4e499fed9
5 changed files with 159 additions and 3 deletions

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2018-2020 Atmosphère-NX
*
* 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/>.
*/
/* NOTE: This file is auto-generated by i2cgen.py, do not edit manually. */
constexpr inline const I2cDeviceDefinition I2c1DeviceList[] = {
{ DeviceCode_ClassicController, 0x52 },
{ DeviceCode_Nct72, 0x4C },
{ DeviceCode_Alc5639, 0x1C },
{ DeviceCode_Bq24193, 0x6B },
{ DeviceCode_Max17050, 0x36 },
{ DeviceCode_Bm92t30mwv, 0x18 },
};
constexpr inline const I2cDeviceDefinition I2c2DeviceList[] = {
{ DeviceCode_Ina226Vdd15v0Hb, 0x40 },
{ DeviceCode_Ina226VsysCpuDs, 0x41 },
{ DeviceCode_Ina226VsysGpuDs, 0x44 },
{ DeviceCode_Ina226VsysDdrDs, 0x45 },
{ DeviceCode_Ina226VsysAp, 0x46 },
{ DeviceCode_Ina226VsysBlDs, 0x47 },
{ DeviceCode_Bh1730, 0x29 },
{ DeviceCode_Ina226VsysCore, 0x48 },
{ DeviceCode_Ina226Soc1V8, 0x49 },
{ DeviceCode_Ina226Lpddr1V8, 0x4A },
{ DeviceCode_Ina226Reg1V32, 0x4B },
{ DeviceCode_Ina226Vdd3V3Sys, 0x4D },
{ DeviceCode_Ina226VddDdr0V6, 0x4E },
{ DeviceCode_HoagNfcIc, 0x08 },
};
constexpr inline const I2cDeviceDefinition I2c3DeviceList[] = {
{ DeviceCode_Ftm3bd56, 0x49 },
};
constexpr inline const I2cDeviceDefinition I2c4DeviceList[] = {
{ DeviceCode_HdmiDdc, 0x50 },
{ DeviceCode_HdmiScdc, 0x54 },
{ DeviceCode_HdmiHdcp, 0x3A },
};
constexpr inline const I2cDeviceDefinition I2c5DeviceList[] = {
{ DeviceCode_Max77620Rtc, 0x68 },
{ DeviceCode_Max77620Pmic, 0x3C },
{ DeviceCode_Max77621Cpu, 0x1B },
{ DeviceCode_Max77621Gpu, 0x1C },
{ DeviceCode_Fan53528, 0x52 },
{ DeviceCode_Max77812_3, 0x31 },
{ DeviceCode_Max77812_2, 0x33 },
};
constexpr inline const I2cBusDefinition I2cBusList[] = {
{ DeviceCode_I2c1, 0x7000C000, 0x100, SpeedMode_Standard, 70, I2c1DeviceList, util::size(I2c1DeviceList) },
{ DeviceCode_I2c2, 0x7000C400, 0x100, SpeedMode_Fast, 116, I2c2DeviceList, util::size(I2c2DeviceList) },
{ DeviceCode_I2c3, 0x7000C500, 0x100, SpeedMode_Fast, 124, I2c3DeviceList, util::size(I2c3DeviceList) },
{ DeviceCode_I2c4, 0x7000C700, 0x100, SpeedMode_Standard, 152, I2c4DeviceList, util::size(I2c4DeviceList) },
{ DeviceCode_I2c5, 0x7000D000, 0x100, SpeedMode_Fast, 85, I2c5DeviceList, util::size(I2c5DeviceList) },
};

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2018-2020 Atmosphère-NX
*
* 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 <stratosphere.hpp>
namespace ams::i2c::driver::board::nintendo_nx {
namespace {
struct I2cDeviceDefinition {
DeviceCode device_code;
u8 slave_address;
};
struct I2cBusDefinition {
DeviceCode device_code;
dd::PhysicalAddress registers_phys_addr;
size_t registers_size;
SpeedMode speed_mode;
os::InterruptName interrupt_name;
const I2cDeviceDefinition *devices;
size_t num_devices;
};
#include "i2c_bus_device_map.inc"
}
void Initialize() {
/* TODO */
}
}