blob: 5026d541a5f440257c91809444e2aae04350c014 [file] [log] [blame]
Svyatoslav Ryheldf7c4182024-11-16 14:33:47 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2024
4 * Svyatoslav Ryhel <clamor95@gmail.com>
5 */
6
7#include <dm.h>
8#include <fdt_support.h>
9#include <i2c.h>
10#include <log.h>
11
12#ifdef CONFIG_MMC_SDHCI_TEGRA
13
14#define TPS65913_I2C_ADDRESS 0x58
15#define TPS65913_PRIMARY_SECONDARY_PAD2 0xfb
16#define GPIO_4 BIT(0)
17#define TPS65913_PRIMARY_SECONDARY_PAD3 0xfe
18#define DVFS2 BIT(1)
19#define DVFS1 BIT(0)
20
21/* We are using this function only till palmas pinctrl driver is available */
22void pin_mux_mmc(void)
23{
24 struct udevice *dev;
25 int ret;
26
27 ret = i2c_get_chip_for_busnum(0, TPS65913_I2C_ADDRESS, 1, &dev);
28 if (ret) {
29 log_debug("%s: cannot find PMIC I2C chip\n", __func__);
30 return;
31 }
32
33 /* GPIO4 function has to be GPIO */
34 dm_i2c_reg_clrset(dev, TPS65913_PRIMARY_SECONDARY_PAD2,
35 GPIO_4, 0);
36
37 /* DVFS1 and DVFS2 are disabled */
38 dm_i2c_reg_clrset(dev, TPS65913_PRIMARY_SECONDARY_PAD3,
39 DVFS2 | DVFS1, 0);
40}
41#endif