diff mbox series

[1/6] tegra: pmc: move IO pad IDs to a devicetree binding

Message ID 20180327163350.15862-1-a.heider@gmail.com
State Deferred
Headers show
Series [1/6] tegra: pmc: move IO pad IDs to a devicetree binding | expand

Commit Message

Andre Heider March 27, 2018, 4:33 p.m. UTC
From: SwtcR <swtcr0@gmail.com>

Signed-off-by: SwtcR <swtcr0@gmail.com>
Signed-off-by: Andre Heider <a.heider@gmail.com>
---
 drivers/gpu/drm/tegra/sor.c         |  2 +-
 drivers/soc/tegra/pmc.c             | 14 +++----
 include/dt-bindings/soc/tegra/pmc.h | 79 +++++++++++++++++++++++++++++++++++
 include/soc/tegra/pmc.h             | 83 ++++---------------------------------
 4 files changed, 96 insertions(+), 82 deletions(-)
 create mode 100644 include/dt-bindings/soc/tegra/pmc.h
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 7d2a955fc515..c47257849998 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -342,7 +342,7 @@  struct tegra_sor {
 	struct drm_info_list *debugfs_files;
 
 	const struct tegra_sor_ops *ops;
-	enum tegra_io_pad pad;
+	unsigned int pad;
 
 	/* for HDMI 2.0 */
 	struct tegra_sor_hdmi_settings *settings;
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index ce62a47a6647..d0ece51b68de 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -132,7 +132,7 @@  struct tegra_powergate {
 };
 
 struct tegra_io_pad_soc {
-	enum tegra_io_pad id;
+	unsigned int id;
 	unsigned int dpd;
 	unsigned int voltage;
 };
@@ -945,7 +945,7 @@  static void tegra_powergate_init(struct tegra_pmc *pmc,
 }
 
 static const struct tegra_io_pad_soc *
-tegra_io_pad_find(struct tegra_pmc *pmc, enum tegra_io_pad id)
+tegra_io_pad_find(struct tegra_pmc *pmc, unsigned int id)
 {
 	unsigned int i;
 
@@ -956,7 +956,7 @@  tegra_io_pad_find(struct tegra_pmc *pmc, enum tegra_io_pad id)
 	return NULL;
 }
 
-static int tegra_io_pad_prepare(enum tegra_io_pad id, unsigned long *request,
+static int tegra_io_pad_prepare(unsigned int id, unsigned long *request,
 				unsigned long *status, u32 *mask)
 {
 	const struct tegra_io_pad_soc *pad;
@@ -1029,7 +1029,7 @@  static void tegra_io_pad_unprepare(void)
  *
  * Returns: 0 on success or a negative error code on failure.
  */
-int tegra_io_pad_power_enable(enum tegra_io_pad id)
+int tegra_io_pad_power_enable(unsigned int id)
 {
 	unsigned long request, status;
 	u32 mask;
@@ -1065,7 +1065,7 @@  EXPORT_SYMBOL(tegra_io_pad_power_enable);
  *
  * Returns: 0 on success or a negative error code on failure.
  */
-int tegra_io_pad_power_disable(enum tegra_io_pad id)
+int tegra_io_pad_power_disable(unsigned int id)
 {
 	unsigned long request, status;
 	u32 mask;
@@ -1095,7 +1095,7 @@  int tegra_io_pad_power_disable(enum tegra_io_pad id)
 }
 EXPORT_SYMBOL(tegra_io_pad_power_disable);
 
-int tegra_io_pad_set_voltage(enum tegra_io_pad id,
+int tegra_io_pad_set_voltage(unsigned int id,
 			     enum tegra_io_pad_voltage voltage)
 {
 	const struct tegra_io_pad_soc *pad;
@@ -1133,7 +1133,7 @@  int tegra_io_pad_set_voltage(enum tegra_io_pad id,
 }
 EXPORT_SYMBOL(tegra_io_pad_set_voltage);
 
-int tegra_io_pad_get_voltage(enum tegra_io_pad id)
+int tegra_io_pad_get_voltage(unsigned int id)
 {
 	const struct tegra_io_pad_soc *pad;
 	u32 value;
diff --git a/include/dt-bindings/soc/tegra/pmc.h b/include/dt-bindings/soc/tegra/pmc.h
new file mode 100644
index 000000000000..65bdddab11eb
--- /dev/null
+++ b/include/dt-bindings/soc/tegra/pmc.h
@@ -0,0 +1,79 @@ 
+/*
+ * Copyright (c) 2010 Google, Inc
+ * Copyright (c) 2014 NVIDIA Corporation
+ *
+ * Author:
+ *	Colin Cross <ccross@google.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that 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.
+ *
+ */
+
+#ifndef _DT_BINDINGS_SOC_TEGRA_PMC_H 
+#define _DT_BINDINGS_SOC_TEGRA_PMC_H 
+
+#define TEGRA_IO_PAD_AUDIO		0
+#define TEGRA_IO_PAD_AUDIO_HV		1
+#define TEGRA_IO_PAD_BB			2
+#define TEGRA_IO_PAD_CAM		3
+#define TEGRA_IO_PAD_COMP		4
+#define TEGRA_IO_PAD_CONN		5
+#define TEGRA_IO_PAD_CSIA		6
+#define TEGRA_IO_PAD_CSIB		7
+#define TEGRA_IO_PAD_CSIC		8
+#define TEGRA_IO_PAD_CSID		9
+#define TEGRA_IO_PAD_CSIE		10
+#define TEGRA_IO_PAD_CSIF		11
+#define TEGRA_IO_PAD_DBG		12
+#define TEGRA_IO_PAD_DEBUG_NONAO	13
+#define TEGRA_IO_PAD_DMIC		14
+#define TEGRA_IO_PAD_DMIC_HV		15
+#define TEGRA_IO_PAD_DP			16
+#define TEGRA_IO_PAD_DSI		17
+#define TEGRA_IO_PAD_DSIB		18
+#define TEGRA_IO_PAD_DSIC		19
+#define TEGRA_IO_PAD_DSID		20
+#define TEGRA_IO_PAD_EDP		21
+#define TEGRA_IO_PAD_EMMC		22
+#define TEGRA_IO_PAD_EMMC2		23
+#define TEGRA_IO_PAD_GPIO		24
+#define TEGRA_IO_PAD_HDMI		25
+#define TEGRA_IO_PAD_HDMI_DP0		26
+#define TEGRA_IO_PAD_HDMI_DP1		27
+#define TEGRA_IO_PAD_HSIC		28
+#define TEGRA_IO_PAD_HV			29
+#define TEGRA_IO_PAD_LVDS		30
+#define TEGRA_IO_PAD_MIPI_BIAS		31
+#define TEGRA_IO_PAD_NAND		32
+#define TEGRA_IO_PAD_PEX_BIAS		33
+#define TEGRA_IO_PAD_PEX_CLK_BIAS	34
+#define TEGRA_IO_PAD_PEX_CLK1		35
+#define TEGRA_IO_PAD_PEX_CLK2		36
+#define TEGRA_IO_PAD_PEX_CLK3		37
+#define TEGRA_IO_PAD_PEX_CNTRL		38
+#define TEGRA_IO_PAD_SDMMC1		39
+#define TEGRA_IO_PAD_SDMMC1_HV		40
+#define TEGRA_IO_PAD_SDMMC2		41
+#define TEGRA_IO_PAD_SDMMC2_HV		42
+#define TEGRA_IO_PAD_SDMMC3		43
+#define TEGRA_IO_PAD_SDMMC3_HV		44
+#define TEGRA_IO_PAD_SDMMC4		45
+#define TEGRA_IO_PAD_SPI		46
+#define TEGRA_IO_PAD_SPI_HV		47
+#define TEGRA_IO_PAD_SYS_DDC		48
+#define TEGRA_IO_PAD_UART		49
+#define TEGRA_IO_PAD_UFS		50
+#define TEGRA_IO_PAD_USB0		51
+#define TEGRA_IO_PAD_USB1		52
+#define TEGRA_IO_PAD_USB2		53
+#define TEGRA_IO_PAD_USB3		54
+#define TEGRA_IO_PAD_USB_BIAS		55
+
+#endif /* _DT_BINDINGS_SOC_TEGRA_PMC_H */
diff --git a/include/soc/tegra/pmc.h b/include/soc/tegra/pmc.h
index c32bf91c23e6..14bac22ee758 100644
--- a/include/soc/tegra/pmc.h
+++ b/include/soc/tegra/pmc.h
@@ -22,6 +22,7 @@ 
 #include <linux/reboot.h>
 
 #include <soc/tegra/pm.h>
+#include <dt-bindings/soc/tegra/pmc.h>
 
 struct clk;
 struct reset_control;
@@ -70,72 +71,6 @@  int tegra_pmc_cpu_remove_clamping(unsigned int cpuid);
 
 #define TEGRA_POWERGATE_3D0	TEGRA_POWERGATE_3D
 
-/**
- * enum tegra_io_pad - I/O pad group identifier
- *
- * I/O pins on Tegra SoCs are grouped into so-called I/O pads. Each such pad
- * can be used to control the common voltage signal level and power state of
- * the pins of the given pad.
- */
-enum tegra_io_pad {
-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MMC4,
-	TEGRA_IO_PAD_SPI,
-	TEGRA_IO_PAD_SPI_HV,
-	TEGRA_IO_PAD_SYS_DDC,
-	TEGRA_IO_PAD_UART,
-	TEGRA_IO_PAD_UFS,
-	TEGRA_IO_PAD_USB0,
-	TEGRA_IO_PAD_USB1,
-	TEGRA_IO_PAD_USB2,
-	TEGRA_IO_PAD_USB3,
-	TEGRA_IO_PAD_USB_BIAS,
-};
-
 /* deprecated, use TEGRA_IO_PAD_{HDMI,LVDS} instead */
 #define TEGRA_IO_RAIL_HDMI	TEGRA_IO_PAD_HDMI
 #define TEGRA_IO_RAIL_LVDS	TEGRA_IO_PAD_LVDS
@@ -160,11 +95,11 @@  int tegra_powergate_remove_clamping(unsigned int id);
 int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
 				      struct reset_control *rst);
 
-int tegra_io_pad_power_enable(enum tegra_io_pad id);
-int tegra_io_pad_power_disable(enum tegra_io_pad id);
-int tegra_io_pad_set_voltage(enum tegra_io_pad id,
+int tegra_io_pad_power_enable(unsigned int id);
+int tegra_io_pad_power_disable(unsigned int id);
+int tegra_io_pad_set_voltage(unsigned int id,
 			     enum tegra_io_pad_voltage voltage);
-int tegra_io_pad_get_voltage(enum tegra_io_pad id);
+int tegra_io_pad_get_voltage(unsigned int id);
 
 /* deprecated, use tegra_io_pad_power_{enable,disable}() instead */
 int tegra_io_rail_power_on(unsigned int id);
@@ -202,23 +137,23 @@  static inline int tegra_powergate_sequence_power_up(unsigned int id,
 	return -ENOSYS;
 }
 
-static inline int tegra_io_pad_power_enable(enum tegra_io_pad id)
+static inline int tegra_io_pad_power_enable(unsigned int id)
 {
 	return -ENOSYS;
 }
 
-static inline int tegra_io_pad_power_disable(enum tegra_io_pad id)
+static inline int tegra_io_pad_power_disable(unsigned int id)
 {
 	return -ENOSYS;
 }
 
-static inline int tegra_io_pad_set_voltage(enum tegra_io_pad id,
+static inline int tegra_io_pad_set_voltage(unsigned int id,
 					   enum tegra_io_pad_voltage voltage)
 {
 	return -ENOSYS;
 }
 
-static inline int tegra_io_pad_get_voltage(enum tegra_io_pad id)
+static inline int tegra_io_pad_get_voltage(unsigned int id)
 {
 	return -ENOSYS;
 }