forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/phy/tegra/xusb.h
....@@ -1,15 +1,7 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
34 * Copyright (c) 2015, Google Inc.
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms and conditions of the GNU General Public License,
7
- * version 2, as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
135 */
146
157 #ifndef __PHY_TEGRA_XUSB_H
....@@ -18,6 +10,9 @@
1810 #include <linux/io.h>
1911 #include <linux/mutex.h>
2012 #include <linux/workqueue.h>
13
+
14
+#include <linux/usb/otg.h>
15
+#include <linux/usb/role.h>
2116
2217 /* legacy entry points for backwards-compatibility */
2318 int tegra_xusb_padctl_legacy_probe(struct platform_device *pdev);
....@@ -54,10 +49,21 @@
5449 int tegra_xusb_lane_parse_dt(struct tegra_xusb_lane *lane,
5550 struct device_node *np);
5651
52
+struct tegra_xusb_usb3_lane {
53
+ struct tegra_xusb_lane base;
54
+};
55
+
56
+static inline struct tegra_xusb_usb3_lane *
57
+to_usb3_lane(struct tegra_xusb_lane *lane)
58
+{
59
+ return container_of(lane, struct tegra_xusb_usb3_lane, base);
60
+}
61
+
5762 struct tegra_xusb_usb2_lane {
5863 struct tegra_xusb_lane base;
5964
6065 u32 hs_curr_level_offset;
66
+ bool powered_on;
6167 };
6268
6369 static inline struct tegra_xusb_usb2_lane *
....@@ -168,6 +174,19 @@
168174 const struct phy_ops *ops);
169175 void tegra_xusb_pad_unregister(struct tegra_xusb_pad *pad);
170176
177
+struct tegra_xusb_usb3_pad {
178
+ struct tegra_xusb_pad base;
179
+
180
+ unsigned int enable;
181
+ struct mutex lock;
182
+};
183
+
184
+static inline struct tegra_xusb_usb3_pad *
185
+to_usb3_pad(struct tegra_xusb_pad *pad)
186
+{
187
+ return container_of(pad, struct tegra_xusb_usb3_pad, base);
188
+}
189
+
171190 struct tegra_xusb_usb2_pad {
172191 struct tegra_xusb_pad base;
173192
....@@ -248,8 +267,17 @@
248267 struct list_head list;
249268 struct device dev;
250269
270
+ struct usb_role_switch *usb_role_sw;
271
+ struct work_struct usb_phy_work;
272
+ struct usb_phy usb_phy;
273
+
251274 const struct tegra_xusb_port_ops *ops;
252275 };
276
+
277
+static inline struct tegra_xusb_port *to_tegra_xusb_port(struct device *dev)
278
+{
279
+ return container_of(dev, struct tegra_xusb_port, dev);
280
+}
253281
254282 struct tegra_xusb_lane_map {
255283 unsigned int port;
....@@ -271,7 +299,9 @@
271299 struct tegra_xusb_port base;
272300
273301 struct regulator *supply;
302
+ enum usb_dr_mode mode;
274303 bool internal;
304
+ int usb3_port_fake;
275305 };
276306
277307 static inline struct tegra_xusb_usb2_port *
....@@ -283,6 +313,8 @@
283313 struct tegra_xusb_usb2_port *
284314 tegra_xusb_find_usb2_port(struct tegra_xusb_padctl *padctl,
285315 unsigned int index);
316
+void tegra_xusb_usb2_port_release(struct tegra_xusb_port *port);
317
+void tegra_xusb_usb2_port_remove(struct tegra_xusb_port *port);
286318
287319 struct tegra_xusb_ulpi_port {
288320 struct tegra_xusb_port base;
....@@ -297,6 +329,8 @@
297329 return container_of(port, struct tegra_xusb_ulpi_port, base);
298330 }
299331
332
+void tegra_xusb_ulpi_port_release(struct tegra_xusb_port *port);
333
+
300334 struct tegra_xusb_hsic_port {
301335 struct tegra_xusb_port base;
302336 };
....@@ -307,12 +341,15 @@
307341 return container_of(port, struct tegra_xusb_hsic_port, base);
308342 }
309343
344
+void tegra_xusb_hsic_port_release(struct tegra_xusb_port *port);
345
+
310346 struct tegra_xusb_usb3_port {
311347 struct tegra_xusb_port base;
312348 struct regulator *supply;
313349 bool context_saved;
314350 unsigned int port;
315351 bool internal;
352
+ bool disable_gen2;
316353
317354 u32 tap1;
318355 u32 amp;
....@@ -329,8 +366,12 @@
329366 struct tegra_xusb_usb3_port *
330367 tegra_xusb_find_usb3_port(struct tegra_xusb_padctl *padctl,
331368 unsigned int index);
369
+void tegra_xusb_usb3_port_release(struct tegra_xusb_port *port);
370
+void tegra_xusb_usb3_port_remove(struct tegra_xusb_port *port);
332371
333372 struct tegra_xusb_port_ops {
373
+ void (*release)(struct tegra_xusb_port *port);
374
+ void (*remove)(struct tegra_xusb_port *port);
334375 int (*enable)(struct tegra_xusb_port *port);
335376 void (*disable)(struct tegra_xusb_port *port);
336377 struct tegra_xusb_lane *(*map)(struct tegra_xusb_port *port);
....@@ -353,6 +394,8 @@
353394 unsigned int index, bool idle);
354395 int (*usb3_set_lfps_detect)(struct tegra_xusb_padctl *padctl,
355396 unsigned int index, bool enable);
397
+ int (*vbus_override)(struct tegra_xusb_padctl *padctl, bool set);
398
+ int (*utmi_port_reset)(struct phy *phy);
356399 };
357400
358401 struct tegra_xusb_padctl_soc {
....@@ -367,6 +410,11 @@
367410 } ports;
368411
369412 const struct tegra_xusb_padctl_ops *ops;
413
+
414
+ const char * const *supply_names;
415
+ unsigned int num_supplies;
416
+ bool supports_gen2;
417
+ bool need_fake_usb3_port;
370418 };
371419
372420 struct tegra_xusb_padctl {
....@@ -390,6 +438,8 @@
390438 unsigned int enable;
391439
392440 struct clk *clk;
441
+
442
+ struct regulator_bulk_data *supplies;
393443 };
394444
395445 static inline void padctl_writel(struct tegra_xusb_padctl *padctl, u32 value,
....@@ -417,5 +467,11 @@
417467 #if defined(CONFIG_ARCH_TEGRA_210_SOC)
418468 extern const struct tegra_xusb_padctl_soc tegra210_xusb_padctl_soc;
419469 #endif
470
+#if defined(CONFIG_ARCH_TEGRA_186_SOC)
471
+extern const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc;
472
+#endif
473
+#if defined(CONFIG_ARCH_TEGRA_194_SOC)
474
+extern const struct tegra_xusb_padctl_soc tegra194_xusb_padctl_soc;
475
+#endif
420476
421477 #endif /* __PHY_TEGRA_XUSB_H */