mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 01:11:14 +00:00
5b4bbd1097
Refresh patches and fix changed path for 32-bit mediatek boards 'arch/arm/dts' -> 'arch/arm/dts/mediatek' Signed-off-by: Daniel Golle <daniel@makrotopia.org>
67 lines
1.9 KiB
Diff
67 lines
1.9 KiB
Diff
From 28f9a5e2a3f5441ab5594669ed82da11e32277a9 Mon Sep 17 00:00:00 2001
|
|
From: Kristian Evensen <kristian.evensen@gmail.com>
|
|
Date: Mon, 30 Apr 2018 14:38:01 +0200
|
|
Subject: [PATCH] phy: phy-mtk-tphy: Add hifsys-support
|
|
|
|
---
|
|
drivers/phy/mediatek/phy-mtk-tphy.c | 20 ++++++++++++++++++++
|
|
1 file changed, 20 insertions(+)
|
|
|
|
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
|
|
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
|
|
@@ -18,6 +18,8 @@
|
|
#include <linux/phy/phy.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/regmap.h>
|
|
+#include <linux/mfd/syscon.h>
|
|
+#include <linux/regmap.h>
|
|
|
|
#include "phy-mtk-io.h"
|
|
|
|
@@ -267,6 +269,9 @@
|
|
|
|
#define USER_BUF_LEN(count) min_t(size_t, 8, (count))
|
|
|
|
+#define HIF_SYSCFG1 0x14
|
|
+#define HIF_SYSCFG1_PHY2_MASK (0x3 << 20)
|
|
+
|
|
enum mtk_phy_version {
|
|
MTK_PHY_V1 = 1,
|
|
MTK_PHY_V2,
|
|
@@ -334,6 +339,7 @@ struct mtk_tphy {
|
|
void __iomem *sif_base; /* only shared sif */
|
|
const struct mtk_phy_pdata *pdata;
|
|
struct mtk_phy_instance **phys;
|
|
+ struct regmap *hif;
|
|
int nphys;
|
|
int src_ref_clk; /* MHZ, reference clock for slew rate calibrate */
|
|
int src_coef; /* coefficient for slew rate calibrate */
|
|
@@ -951,6 +957,10 @@ static void pcie_phy_instance_init(struc
|
|
if (tphy->pdata->version != MTK_PHY_V1)
|
|
return;
|
|
|
|
+ if (tphy->hif)
|
|
+ regmap_update_bits(tphy->hif, HIF_SYSCFG1,
|
|
+ HIF_SYSCFG1_PHY2_MASK, 0);
|
|
+
|
|
mtk_phy_update_bits(phya + U3P_U3_PHYA_DA_REG0,
|
|
P3A_RG_XTAL_EXT_PE1H | P3A_RG_XTAL_EXT_PE2H,
|
|
FIELD_PREP(P3A_RG_XTAL_EXT_PE1H, 0x2) |
|
|
@@ -1597,6 +1607,16 @@ static int mtk_tphy_probe(struct platfor
|
|
&tphy->src_coef);
|
|
}
|
|
|
|
+ if (of_find_property(np, "mediatek,phy-switch", NULL)) {
|
|
+ tphy->hif = syscon_regmap_lookup_by_phandle(np,
|
|
+ "mediatek,phy-switch");
|
|
+ if (IS_ERR(tphy->hif)) {
|
|
+ dev_err(&pdev->dev,
|
|
+ "missing \"mediatek,phy-switch\" phandle\n");
|
|
+ return PTR_ERR(tphy->hif);
|
|
+ }
|
|
+ }
|
|
+
|
|
port = 0;
|
|
for_each_child_of_node(np, child_np) {
|
|
struct mtk_phy_instance *instance;
|