mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-30 14:16:40 +00:00
linux (Allwinner): rebase and drop upstreamed patches in 6.9 - 6.14
-3ce7384048
- The following changes were introduced in 6.11-rc1 and 6.11-rc7 only pass 3 variables to - of: remove internal arguments from of_property_for_each_u32() -9722c3b66e
6.11-rc7 has refactored drm9da7ec9b19
resulting in the following compile error. build.LibreELEC-H6.aarch64-13.0-devel/toolchain/bin/aarch64-libreelec-linux-gnu-ld: drivers/gpu/drm/sun4i/sun8i_dw_hdmi.o: in function `sun8i_dw_hdmi_bind': build.LibreELEC-H6.aarch64-13.0-devel/build/linux-6.11-rc7/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c:394:(.text+0x73c): undefined reference to `drm_bridge_connector_init' -db300ab0e9
- allwinner: OrangePi PC also needs SW CEC hack CEC stopped working after updating from LE10 to LE11 as the former enabled the SW CEC hack for all H3 boards and the latter only for specific boards. Add OrangePi PC to that list of specific boards. - Use old OrangePi 3 net patches - Switch PMIC connection to I2C Co-authored-by: Jernej Skrabec <jernej.skrabec@gmail.com>
This commit is contained in:
parent
c044bf345e
commit
2c1d9eb04c
@ -62,14 +62,14 @@ again for each clock, which is part of why I didn't do it that way.
|
||||
|
||||
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
||||
---
|
||||
drivers/clk/clk-conf.c | 54 ++++++++++++++++++++++++++++++++++++++++++
|
||||
drivers/clk/clk-conf.c | 56 ++++++++++++++++++++++++++++++++++++++++++
|
||||
drivers/clk/clk.c | 31 ++++++++++++++++++++++++
|
||||
drivers/clk/clk.h | 2 ++
|
||||
3 files changed, 87 insertions(+)
|
||||
|
||||
--- a/drivers/clk/clk-conf.c
|
||||
+++ b/drivers/clk/clk-conf.c
|
||||
@@ -11,6 +11,54 @@
|
||||
@@ -11,6 +11,56 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/printk.h>
|
||||
|
||||
@ -93,7 +93,9 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
|
||||
+ clkspec.np = node;
|
||||
+ clkspec.args_count = nr_cells;
|
||||
+
|
||||
+ of_property_for_each_u32(node, "protected-clocks", prop, cur, clkspec.args[0]) {
|
||||
+ prop = of_find_property(node, "protected-clocks", NULL);
|
||||
+ for (cur = of_prop_next_u32(prop, NULL, &clkspec.args[0]); cur;
|
||||
+ cur = of_prop_next_u32(prop, cur, &clkspec.args[0])) {
|
||||
+ /* read the remainder of the clock specifier */
|
||||
+ for (i = 1; i < nr_cells; ++i) {
|
||||
+ cur = of_prop_next_u32(prop, cur, &clkspec.args[i]);
|
||||
|
@ -15,7 +15,7 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
|
||||
|
||||
--- a/drivers/clk/qcom/common.c
|
||||
+++ b/drivers/clk/qcom/common.c
|
||||
@@ -194,22 +194,6 @@ int qcom_cc_register_sleep_clk(struct de
|
||||
@@ -223,20 +223,6 @@ int qcom_cc_register_sleep_clk(struct de
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(qcom_cc_register_sleep_clk);
|
||||
|
||||
@ -23,11 +23,9 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
|
||||
-static void qcom_cc_drop_protected(struct device *dev, struct qcom_cc *cc)
|
||||
-{
|
||||
- struct device_node *np = dev->of_node;
|
||||
- struct property *prop;
|
||||
- const __be32 *p;
|
||||
- u32 i;
|
||||
-
|
||||
- of_property_for_each_u32(np, "protected-clocks", prop, p, i) {
|
||||
- of_property_for_each_u32(np, "protected-clocks", i) {
|
||||
- if (i >= cc->num_rclks)
|
||||
- continue;
|
||||
-
|
||||
@ -38,7 +36,7 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
|
||||
static struct clk_hw *qcom_cc_clk_hw_get(struct of_phandle_args *clkspec,
|
||||
void *data)
|
||||
{
|
||||
@@ -272,8 +256,6 @@ int qcom_cc_really_probe(struct platform
|
||||
@@ -330,8 +314,6 @@ int qcom_cc_really_probe(struct platform
|
||||
cc->rclks = rclks;
|
||||
cc->num_rclks = num_clks;
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
Subject: [PATCH] drm: Call drm_atomic_helper_shutdown() at shutdown time for misc drivers
|
||||
From: Douglas Anderson <dianders@chromium.org>
|
||||
Date: Fri, 01 Sep 2023 16:39:53 -0700
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
Based on grepping through the source code these drivers appear to be
|
||||
missing a call to drm_atomic_helper_shutdown() at system shutdown
|
||||
time. Among other things, this means that if a panel is in use that it
|
||||
won't be cleanly powered off at system shutdown time.
|
||||
|
||||
The fact that we should call drm_atomic_helper_shutdown() in the case
|
||||
of OS shutdown/restart comes straight out of the kernel doc "driver
|
||||
instance overview" in drm_drv.c.
|
||||
|
||||
All of the drivers in this patch were fairly straightforward to fix
|
||||
since they already had a call to drm_atomic_helper_shutdown() at
|
||||
remove/unbind time but were just lacking one at system shutdown. The
|
||||
only hitch is that some of these drivers use the component model to
|
||||
register/unregister their DRM devices. The shutdown callback is part
|
||||
of the original device. The typical solution here, based on how other
|
||||
DRM drivers do this, is to keep track of whether the device is bound
|
||||
based on drvdata. In most cases the drvdata is the drm_device, so we
|
||||
can just make sure it is NULL when the device is not bound. In some
|
||||
drivers, this required minor code changes. To make things simpler,
|
||||
drm_atomic_helper_shutdown() has been modified to consider a NULL
|
||||
drm_device as a noop in the patch ("drm/atomic-helper:
|
||||
drm_atomic_helper_shutdown(NULL) should be a noop").
|
||||
|
||||
Suggested-by: Maxime Ripard <mripard@kernel.org>
|
||||
Signed-off-by: Douglas Anderson <dianders@chromium.org>
|
||||
Acked-by: Maxime Ripard <mripard@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20230901163944.RFT.2.I9115e5d094a43e687978b0699cc1fe9f2a3452ea@changeid
|
||||
---
|
||||
<snip>
|
||||
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
|
||||
index 6a8dfc022d3c..35d7a7ffd208 100644
|
||||
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
|
||||
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
|
||||
@@ -413,6 +413,11 @@ static void sun4i_drv_remove(struct platform_device *pdev)
|
||||
component_master_del(&pdev->dev, &sun4i_drv_master_ops);
|
||||
}
|
||||
|
||||
+static void sun4i_drv_shutdown(struct platform_device *pdev)
|
||||
+{
|
||||
+ drm_atomic_helper_shutdown(platform_get_drvdata(pdev));
|
||||
+}
|
||||
+
|
||||
static const struct of_device_id sun4i_drv_of_table[] = {
|
||||
{ .compatible = "allwinner,sun4i-a10-display-engine" },
|
||||
{ .compatible = "allwinner,sun5i-a10s-display-engine" },
|
||||
@@ -437,6 +442,7 @@ MODULE_DEVICE_TABLE(of, sun4i_drv_of_table);
|
||||
static struct platform_driver sun4i_drv_platform_driver = {
|
||||
.probe = sun4i_drv_probe,
|
||||
.remove_new = sun4i_drv_remove,
|
||||
+ .shutdown = sun4i_drv_shutdown,
|
||||
.driver = {
|
||||
.name = "sun4i-drm",
|
||||
.of_match_table = sun4i_drv_of_table,
|
||||
<snip>
|
@ -39,7 +39,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
aquantia-objs += aquantia_main.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/phy/ac200.c
|
||||
@@ -0,0 +1,234 @@
|
||||
@@ -0,0 +1,232 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/**
|
||||
+ * Driver for AC200 Ethernet PHY
|
||||
@ -242,7 +242,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ac200_ephy_remove(struct platform_device *pdev)
|
||||
+static void ac200_ephy_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct ac200_ephy_dev *priv = platform_get_drvdata(pdev);
|
||||
+
|
||||
@ -251,8 +251,6 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ regmap_write(priv->regmap, AC200_EPHY_CTL, AC200_EPHY_SHUTDOWN);
|
||||
+ regmap_write(priv->regmap, AC200_SYS_EPHY_CTL1, 0);
|
||||
+ regmap_write(priv->regmap, AC200_SYS_EPHY_CTL0, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id ac200_ephy_match[] = {
|
||||
|
@ -47,7 +47,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+obj-$(CONFIG_VIDEO_SUN50I_DEINTERLACE) += sun50i-di.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/media/platform/sunxi/sun50i-di/sun50i-di.c
|
||||
@@ -0,0 +1,1137 @@
|
||||
@@ -0,0 +1,1135 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Allwinner sun50i deinterlacer driver
|
||||
@ -848,7 +848,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ src_vq->io_modes = VB2_MMAP | VB2_DMABUF;
|
||||
+ src_vq->drv_priv = ctx;
|
||||
+ src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
|
||||
+ src_vq->min_buffers_needed = 1;
|
||||
+ src_vq->min_queued_buffers = 1;
|
||||
+ src_vq->ops = &deinterlace_qops;
|
||||
+ src_vq->mem_ops = &vb2_dma_contig_memops;
|
||||
+ src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
|
||||
@ -863,7 +863,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ dst_vq->io_modes = VB2_MMAP | VB2_DMABUF;
|
||||
+ dst_vq->drv_priv = ctx;
|
||||
+ dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
|
||||
+ dst_vq->min_buffers_needed = 2;
|
||||
+ dst_vq->min_queued_buffers = 2;
|
||||
+ dst_vq->ops = &deinterlace_qops;
|
||||
+ dst_vq->mem_ops = &vb2_dma_contig_memops;
|
||||
+ dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
|
||||
@ -1087,7 +1087,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int deinterlace_remove(struct platform_device *pdev)
|
||||
+static void deinterlace_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct deinterlace_dev *dev = platform_get_drvdata(pdev);
|
||||
+
|
||||
@ -1096,8 +1096,6 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ v4l2_device_unregister(&dev->v4l2_dev);
|
||||
+
|
||||
+ pm_runtime_force_suspend(&pdev->dev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int deinterlace_runtime_resume(struct device *device)
|
||||
|
@ -1,165 +0,0 @@
|
||||
From 25b44143ea8162209beb02759ca3ea3bd3be7a74 Mon Sep 17 00:00:00 2001
|
||||
From: Corentin Labbe <clabbe.montjoie@gmail.com>
|
||||
Date: Fri, 14 Oct 2022 12:54:21 +0200
|
||||
Subject: [PATCH] phy: handle optional regulator for PHY
|
||||
|
||||
Add handling of optional regulators for PHY.
|
||||
|
||||
Regulators need to be enabled before PHY scanning, so MDIO bus
|
||||
initiate this task.
|
||||
|
||||
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/net/mdio/fwnode_mdio.c | 53 ++++++++++++++++++++++++++++++++--
|
||||
drivers/net/phy/phy_device.c | 6 ++++
|
||||
include/linux/phy.h | 3 ++
|
||||
3 files changed, 60 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c
|
||||
index fd02f5cbc853..bd5a27eaf40c 100644
|
||||
--- a/drivers/net/mdio/fwnode_mdio.c
|
||||
+++ b/drivers/net/mdio/fwnode_mdio.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/phy.h>
|
||||
#include <linux/pse-pd/pse.h>
|
||||
+#include <linux/regulator/consumer.h>
|
||||
|
||||
MODULE_AUTHOR("Calvin Johnson <calvin.johnson@oss.nxp.com>");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -58,6 +59,40 @@ fwnode_find_mii_timestamper(struct fwnode_handle *fwnode)
|
||||
return register_mii_timestamper(arg.np, arg.args[0]);
|
||||
}
|
||||
|
||||
+static int
|
||||
+fwnode_regulator_get_bulk_enabled(struct device *dev,
|
||||
+ struct fwnode_handle *fwnode,
|
||||
+ struct regulator_bulk_data **consumers)
|
||||
+{
|
||||
+ struct device_node *np;
|
||||
+ int ret, reg_cnt;
|
||||
+
|
||||
+ np = to_of_node(fwnode);
|
||||
+ if (!np)
|
||||
+ return 0;
|
||||
+
|
||||
+ reg_cnt = of_regulator_bulk_get_all(dev, np, consumers);
|
||||
+ if (reg_cnt < 0) {
|
||||
+ ret = reg_cnt;
|
||||
+ goto clean_consumers;
|
||||
+ }
|
||||
+
|
||||
+ if (reg_cnt == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ ret = regulator_bulk_enable(reg_cnt, *consumers);
|
||||
+ if (ret)
|
||||
+ goto clean_consumers;
|
||||
+
|
||||
+ return reg_cnt;
|
||||
+
|
||||
+clean_consumers:
|
||||
+ kfree(*consumers);
|
||||
+ *consumers = NULL;
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
|
||||
struct phy_device *phy,
|
||||
struct fwnode_handle *child, u32 addr)
|
||||
@@ -113,12 +148,13 @@ EXPORT_SYMBOL(fwnode_mdiobus_phy_device_register);
|
||||
int fwnode_mdiobus_register_phy(struct mii_bus *bus,
|
||||
struct fwnode_handle *child, u32 addr)
|
||||
{
|
||||
+ struct regulator_bulk_data *consumers = NULL;
|
||||
struct mii_timestamper *mii_ts = NULL;
|
||||
struct pse_control *psec = NULL;
|
||||
struct phy_device *phy;
|
||||
+ int rc, reg_cnt;
|
||||
bool is_c45;
|
||||
u32 phy_id;
|
||||
- int rc;
|
||||
|
||||
psec = fwnode_find_pse_control(child);
|
||||
if (IS_ERR(psec))
|
||||
@@ -130,6 +166,12 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
|
||||
goto clean_pse;
|
||||
}
|
||||
|
||||
+ reg_cnt = fwnode_regulator_get_bulk_enabled(&bus->dev, child, &consumers);
|
||||
+ if (reg_cnt < 0) {
|
||||
+ rc = reg_cnt;
|
||||
+ goto clean_mii_ts;
|
||||
+ }
|
||||
+
|
||||
is_c45 = fwnode_device_is_compatible(child, "ethernet-phy-ieee802.3-c45");
|
||||
if (is_c45 || fwnode_get_phy_id(child, &phy_id))
|
||||
phy = get_phy_device(bus, addr, is_c45);
|
||||
@@ -137,9 +179,12 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
|
||||
phy = phy_device_create(bus, addr, phy_id, 0, NULL);
|
||||
if (IS_ERR(phy)) {
|
||||
rc = PTR_ERR(phy);
|
||||
- goto clean_mii_ts;
|
||||
+ goto clean_regulators;
|
||||
}
|
||||
|
||||
+ phy->regulator_cnt = reg_cnt;
|
||||
+ phy->consumers = consumers;
|
||||
+
|
||||
if (is_acpi_node(child)) {
|
||||
phy->irq = bus->irq[addr];
|
||||
|
||||
@@ -174,6 +219,10 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
|
||||
|
||||
clean_phy:
|
||||
phy_device_free(phy);
|
||||
+clean_regulators:
|
||||
+ if (reg_cnt > 0)
|
||||
+ regulator_bulk_disable(reg_cnt, consumers);
|
||||
+ kfree(consumers);
|
||||
clean_mii_ts:
|
||||
unregister_mii_timestamper(mii_ts);
|
||||
clean_pse:
|
||||
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
|
||||
index 2ce74593d6e4..31b6913ceed1 100644
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <linux/phy_led_triggers.h>
|
||||
#include <linux/pse-pd/pse.h>
|
||||
#include <linux/property.h>
|
||||
+#include <linux/regulator/consumer.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/sfp.h>
|
||||
#include <linux/skbuff.h>
|
||||
@@ -3400,6 +3401,11 @@ static int phy_remove(struct device *dev)
|
||||
|
||||
phydev->drv = NULL;
|
||||
|
||||
+ if (phydev->regulator_cnt > 0)
|
||||
+ regulator_bulk_disable(phydev->regulator_cnt, phydev->consumers);
|
||||
+
|
||||
+ kfree(phydev->consumers);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/include/linux/phy.h b/include/linux/phy.h
|
||||
index 3cc52826f18e..832cb2d4f76a 100644
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -757,6 +757,9 @@ struct phy_device {
|
||||
void (*phy_link_change)(struct phy_device *phydev, bool up);
|
||||
void (*adjust_link)(struct net_device *dev);
|
||||
|
||||
+ int regulator_cnt;
|
||||
+ struct regulator_bulk_data *consumers;
|
||||
+
|
||||
#if IS_ENABLED(CONFIG_MACSEC)
|
||||
/* MACsec management functions */
|
||||
const struct macsec_ops *macsec_ops;
|
||||
--
|
||||
2.43.0
|
||||
|
@ -24,7 +24,7 @@ Signed-off-by: Sebastian Meyer <git-commit@mailhell.seb7.de>
|
||||
+ enable-active-high;
|
||||
+ };
|
||||
+
|
||||
wifi_pwrseq: wifi_pwrseq {
|
||||
wifi_pwrseq: pwrseq {
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
clocks = <&rtc 1>;
|
||||
@@ -20,6 +30,10 @@
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 59cc76036f42c7f7baa17cb46e6e19cf3a6a62bb Mon Sep 17 00:00:00 2001
|
||||
From 8f163618d4021cb84334109796c60f083fabda8d Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 09:31:45 +0200
|
||||
Subject: [PATCH] WIP: OPi3 DT fixes
|
||||
@ -8,7 +8,7 @@ Subject: [PATCH] WIP: OPi3 DT fixes
|
||||
1 file changed, 35 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
|
||||
index c45d7b7fb39a..af92d92d85a3 100644
|
||||
index f005072c68a1..d01a318653a3 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
|
||||
@@ -63,27 +63,7 @@ reg_vcc5v: vcc5v {
|
||||
@ -39,8 +39,8 @@ index c45d7b7fb39a..af92d92d85a3 100644
|
||||
+
|
||||
wifi_pwrseq: wifi-pwrseq {
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
clocks = <&rtc 1>;
|
||||
@@ -136,8 +116,8 @@ &mmc0 {
|
||||
clocks = <&rtc CLK_OSC32K_FANOUT>;
|
||||
@@ -137,8 +117,8 @@ &mmc0 {
|
||||
};
|
||||
|
||||
&mmc1 {
|
||||
@ -51,7 +51,7 @@ index c45d7b7fb39a..af92d92d85a3 100644
|
||||
mmc-pwrseq = <&wifi_pwrseq>;
|
||||
bus-width = <4>;
|
||||
non-removable;
|
||||
@@ -172,13 +152,17 @@ &ohci3 {
|
||||
@@ -173,7 +153,7 @@ &ohci3 {
|
||||
&pio {
|
||||
vcc-pc-supply = <®_bldo2>;
|
||||
vcc-pd-supply = <®_cldo1>;
|
||||
@ -59,18 +59,8 @@ index c45d7b7fb39a..af92d92d85a3 100644
|
||||
+ vcc-pg-supply = <®_bldo3>;
|
||||
};
|
||||
|
||||
&r_ir {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&r_pio {
|
||||
+ vcc-pm-supply = <®_bldo3>;
|
||||
+};
|
||||
+
|
||||
&r_rsb {
|
||||
status = "okay";
|
||||
|
||||
@@ -234,13 +218,12 @@ reg_bldo2: bldo2 {
|
||||
&r_i2c {
|
||||
@@ -231,13 +211,12 @@ reg_bldo2: bldo2 {
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-name = "vcc-efuse-pcie-hdmi-pc";
|
||||
};
|
||||
@ -90,7 +80,7 @@ index c45d7b7fb39a..af92d92d85a3 100644
|
||||
};
|
||||
|
||||
reg_cldo1: cldo1 {
|
||||
@@ -250,19 +233,34 @@ reg_cldo1: cldo1 {
|
||||
@@ -247,19 +226,34 @@ reg_cldo1: cldo1 {
|
||||
regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-2";
|
||||
};
|
||||
|
||||
@ -131,6 +121,17 @@ index c45d7b7fb39a..af92d92d85a3 100644
|
||||
regulator-name = "vdd-cpu";
|
||||
};
|
||||
|
||||
@@ -296,6 +290,10 @@ &r_ir {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&r_pio {
|
||||
+ vcc-pm-supply = <®_bldo3>;
|
||||
+};
|
||||
+
|
||||
&rtc {
|
||||
clocks = <&ext_osc32k>;
|
||||
};
|
||||
--
|
||||
2.33.0
|
||||
2.48.1
|
||||
|
||||
|
@ -18,7 +18,7 @@ diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
|
||||
index d7c5e9b1a087..9944266c4f58 100644
|
||||
--- a/drivers/iommu/sun50i-iommu.c
|
||||
+++ b/drivers/iommu/sun50i-iommu.c
|
||||
@@ -593,10 +593,12 @@ static int sun50i_iommu_map(struct iommu_domain *domain, unsigned long iova,
|
||||
@@ -598,10 +598,12 @@ static int sun50i_iommu_map(struct iommu_domain *domain, unsigned long iova,
|
||||
{
|
||||
struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain);
|
||||
struct sun50i_iommu *iommu = sun50i_domain->iommu;
|
||||
@ -29,9 +29,9 @@ index d7c5e9b1a087..9944266c4f58 100644
|
||||
|
||||
+ pages = size / SPAGE_SIZE;
|
||||
+
|
||||
page_table = sun50i_dte_get_page_table(sun50i_domain, iova, gfp);
|
||||
if (IS_ERR(page_table)) {
|
||||
ret = PTR_ERR(page_table);
|
||||
/* the IOMMU can only handle 32-bit addresses, both input and output */
|
||||
if ((uint64_t)paddr >> 32) {
|
||||
ret = -EINVAL;
|
||||
@@ -604,18 +606,21 @@ static int sun50i_iommu_map(struct iommu_domain *domain, unsigned long iova,
|
||||
}
|
||||
|
||||
@ -61,9 +61,9 @@ index d7c5e9b1a087..9944266c4f58 100644
|
||||
- *pte_addr = sun50i_mk_pte(paddr, prot);
|
||||
- sun50i_table_flush(sun50i_domain, pte_addr, 1);
|
||||
+ sun50i_table_flush(sun50i_domain, &page_table[pte_index], pages);
|
||||
*mapped = size;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
@@ -626,8 +631,10 @@ static size_t sun50i_iommu_unmap(struct iommu_domain *domain, unsigned long iova
|
||||
{
|
||||
struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain);
|
||||
@ -97,11 +97,11 @@ index d7c5e9b1a087..9944266c4f58 100644
|
||||
|
||||
static phys_addr_t sun50i_iommu_iova_to_phys(struct iommu_domain *domain,
|
||||
@@ -828,7 +836,7 @@ static int sun50i_iommu_of_xlate(struct device *dev,
|
||||
}
|
||||
|
||||
static const struct iommu_ops sun50i_iommu_ops = {
|
||||
.identity_domain = &sun50i_iommu_identity_domain,
|
||||
- .pgsize_bitmap = SZ_4K,
|
||||
+ .pgsize_bitmap = 0x1ff000,
|
||||
.device_group = sun50i_iommu_device_group,
|
||||
.domain_alloc = sun50i_iommu_domain_alloc,
|
||||
.device_group = generic_single_device_group,
|
||||
.domain_alloc_paging = sun50i_iommu_domain_alloc_paging,
|
||||
.of_xlate = sun50i_iommu_of_xlate,
|
||||
|
@ -1,29 +0,0 @@
|
||||
From 667a93ec571a2a8f2487c258c928936d73b7fa14 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sun, 19 Feb 2023 13:02:31 +0100
|
||||
Subject: [PATCH] ARM: dts: sun8i-r40: Add interconnect to video-codec
|
||||
|
||||
Video codec needs interconnect, so driver knows that it needs to adjust
|
||||
DMA addresses.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/allwinner/sun8i-r40.dtsi | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/allwinner/sun8i-r40.dtsi b/arch/arm/boot/dts/allwinner/sun8i-r40.dtsi
|
||||
index 4ef26d8f5340..a5b1f1e3900d 100644
|
||||
--- a/arch/arm/boot/dts/allwinner/sun8i-r40.dtsi
|
||||
+++ b/arch/arm/boot/dts/allwinner/sun8i-r40.dtsi
|
||||
@@ -338,6 +338,8 @@ video-codec@1c0e000 {
|
||||
resets = <&ccu RST_BUS_VE>;
|
||||
interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
|
||||
allwinner,sram = <&ve_sram 1>;
|
||||
+ interconnects = <&mbus 4>;
|
||||
+ interconnect-names = "dma-mem";
|
||||
};
|
||||
|
||||
mmc0: mmc@1c0f000 {
|
||||
--
|
||||
2.39.2
|
||||
|
@ -17,16 +17,28 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 5 ++
|
||||
2 files changed, 117 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/sun4i/Kconfig b/drivers/gpu/drm/sun4i/Kconfig
|
||||
--- a/drivers/gpu/drm/sun4i/Kconfig
|
||||
+++ b/drivers/gpu/drm/sun4i/Kconfig
|
||||
@@ -3,6 +3,7 @@
|
||||
tristate "DRM Support for Allwinner A10 Display Engine"
|
||||
depends on DRM && COMMON_CLK
|
||||
depends on ARCH_SUNXI || COMPILE_TEST
|
||||
+ select DRM_BRIDGE_CONNECTOR
|
||||
select DRM_CLIENT_SELECTION
|
||||
select DRM_GEM_DMA_HELPER
|
||||
select DRM_KMS_HELPER
|
||||
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
|
||||
index 8f8d3bdba5ce..93831cdf1917 100644
|
||||
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
|
||||
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
|
||||
@@ -8,14 +8,82 @@
|
||||
@@ -8,14 +8,90 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
+#include <drm/drm_atomic_state_helper.h>
|
||||
+#include <drm/drm_bridge_connector.h>
|
||||
+#include <drm/drm_edid.h>
|
||||
#include <drm/drm_managed.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_of.h>
|
||||
@ -61,16 +73,23 @@ index 8f8d3bdba5ce..93831cdf1917 100644
|
||||
+ enum drm_connector_status status)
|
||||
+{
|
||||
+ struct sun8i_dw_hdmi *hdmi = bridge_to_sun8i_dw_hdmi(bridge);
|
||||
+ struct edid *edid;
|
||||
+
|
||||
+ if (!hdmi->cec_notifier)
|
||||
+ return;
|
||||
+
|
||||
+ if (status == connector_status_connected) {
|
||||
+ edid = drm_bridge_get_edid(hdmi->hdmi_bridge, hdmi->connector);
|
||||
+ if (edid)
|
||||
+ cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier,
|
||||
+ edid);
|
||||
+ const struct drm_edid *drm_edid;
|
||||
+ const struct edid *edid;
|
||||
+
|
||||
+ drm_edid = drm_bridge_edid_read(hdmi->hdmi_bridge,
|
||||
+ hdmi->connector);
|
||||
+ if (drm_edid)
|
||||
+ return;
|
||||
+
|
||||
+ edid = drm_edid_raw(drm_edid);
|
||||
+ cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier,
|
||||
+ edid);
|
||||
+ drm_edid_free(drm_edid);
|
||||
+ } else {
|
||||
+ cec_notifier_phys_addr_invalidate(hdmi->cec_notifier);
|
||||
+ }
|
||||
|
@ -538,7 +538,7 @@ diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i
|
||||
index 22e084989ee6..0837e2576556 100644
|
||||
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
|
||||
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
|
||||
@@ -7,18 +7,25 @@
|
||||
@@ -7,19 +7,26 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
@ -546,6 +546,7 @@ index 22e084989ee6..0837e2576556 100644
|
||||
|
||||
#include <drm/drm_atomic_state_helper.h>
|
||||
#include <drm/drm_bridge_connector.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <drm/drm_managed.h>
|
||||
#include <drm/drm_modeset_helper_vtables.h>
|
||||
#include <drm/drm_of.h>
|
||||
|
@ -16,10 +16,10 @@ diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2
|
||||
index f4d9d6279094..1e07066fa129 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
|
||||
@@ -1510,6 +1510,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
|
||||
case V4L2_PIX_FMT_AV1_FRAME: descr = "AV1 Frame"; break;
|
||||
case V4L2_PIX_FMT_MT2110T: descr = "Mediatek 10bit Tile Mode"; break;
|
||||
case V4L2_PIX_FMT_MT2110R: descr = "Mediatek 10bit Raster Mode"; break;
|
||||
@@ -1542,6 +1542,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
|
||||
case V4L2_PIX_FMT_PISP_COMP2_GBRG: descr = "PiSP 8b GBGB/RGRG mode2 compr"; break;
|
||||
case V4L2_PIX_FMT_PISP_COMP2_BGGR: descr = "PiSP 8b BGBG/GRGR mode2 compr"; break;
|
||||
case V4L2_PIX_FMT_PISP_COMP2_MONO: descr = "PiSP 8b monochrome mode2 compr"; break;
|
||||
+ case V4L2_PIX_FMT_YUV420_8_AFBC_16X16_SPLIT: descr = "YUV 4:2:0 (AFBC 16x16)"; break;
|
||||
+ case V4L2_PIX_FMT_YUV420_10_AFBC_16X16_SPLIT: descr = "10-bit YUV 4:2:0 (AFBC 16x16)"; break;
|
||||
default:
|
||||
|
@ -17,22 +17,24 @@ diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8
|
||||
index 884abe3cf773..91781b5bbbbc 100644
|
||||
--- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
|
||||
+++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c
|
||||
@@ -365,6 +365,10 @@ struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
||||
@@ -295,6 +295,11 @@ struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
||||
if (!layer)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
+ layer->mixer = mixer;
|
||||
+ layer->type = SUN8I_LAYER_TYPE_UI;
|
||||
+ layer->channel = channel;
|
||||
+ layer->overlay = 0;
|
||||
+
|
||||
if (index == 0)
|
||||
type = DRM_PLANE_TYPE_PRIMARY;
|
||||
|
||||
@@ -395,9 +399,6 @@ struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
||||
@@ -325,10 +330,6 @@ struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
|
||||
}
|
||||
|
||||
drm_plane_helper_add(&layer->plane, &sun8i_ui_layer_helper_funcs);
|
||||
- layer->mixer = mixer;
|
||||
- layer->type = SUN8I_LAYER_TYPE_UI;
|
||||
- layer->channel = channel;
|
||||
- layer->overlay = 0;
|
||||
|
||||
@ -42,22 +44,24 @@ diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8
|
||||
index 6ee3790a2a81..329e8bf8cd20 100644
|
||||
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
|
||||
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
|
||||
@@ -549,6 +549,10 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
@@ -478,6 +478,11 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
if (!layer)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
+ layer->mixer = mixer;
|
||||
+ layer->type = SUN8I_LAYER_TYPE_VI;
|
||||
+ layer->channel = index;
|
||||
+ layer->overlay = 0;
|
||||
+
|
||||
if (mixer->cfg->is_de3) {
|
||||
formats = sun8i_vi_layer_de3_formats;
|
||||
format_count = ARRAY_SIZE(sun8i_vi_layer_de3_formats);
|
||||
@@ -607,9 +611,6 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
@@ -543,10 +549,6 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
}
|
||||
|
||||
drm_plane_helper_add(&layer->plane, &sun8i_vi_layer_helper_funcs);
|
||||
- layer->mixer = mixer;
|
||||
- layer->type = SUN8I_LAYER_TYPE_VI;
|
||||
- layer->channel = index;
|
||||
- layer->overlay = 0;
|
||||
|
||||
|
@ -372,6 +372,26 @@ index 000000000000..cea685c86855
|
||||
+void sun50i_afbc_disable(struct sun8i_mixer *mixer, unsigned int channel);
|
||||
+
|
||||
+#endif
|
||||
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
|
||||
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
|
||||
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <uapi/linux/media-bus-format.h>
|
||||
|
||||
#include "sun4i_drv.h"
|
||||
+#include "sun50i_afbc.h"
|
||||
#include "sun50i_fmt.h"
|
||||
#include "sun8i_mixer.h"
|
||||
#include "sun8i_ui_layer.h"
|
||||
@@ -272,6 +273,8 @@
|
||||
val = enable ? SUN8I_MIXER_CHAN_VI_LAYER_ATTR_EN : 0;
|
||||
mask = SUN8I_MIXER_CHAN_VI_LAYER_ATTR_EN;
|
||||
reg = SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch_base, layer->overlay);
|
||||
+ if (!enable && layer->mixer->cfg->is_de3)
|
||||
+ sun50i_afbc_disable(layer->mixer, layer->channel);
|
||||
}
|
||||
|
||||
regmap_update_bits(layer->mixer->engine.regs, reg, mask, val);
|
||||
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
|
||||
index 329e8bf8cd20..bda91c3e2bb7 100644
|
||||
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
|
||||
@ -414,7 +434,7 @@ index 329e8bf8cd20..bda91c3e2bb7 100644
|
||||
DRM_DEBUG_DRIVER("Using horizontal coarse scaling\n");
|
||||
hm = src_w;
|
||||
hn = scanline;
|
||||
@@ -356,6 +358,15 @@ static int sun8i_vi_layer_update_buffer(struct sun8i_mixer *mixer, int channel,
|
||||
@@ -307,6 +309,15 @@ static int sun8i_vi_layer_update_buffer(struct sun8i_mixer *mixer, int channel,
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -430,34 +450,20 @@ index 329e8bf8cd20..bda91c3e2bb7 100644
|
||||
static int sun8i_vi_layer_atomic_check(struct drm_plane *plane,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
@@ -399,6 +410,8 @@ static void sun8i_vi_layer_atomic_disable(struct drm_plane *plane,
|
||||
|
||||
sun8i_vi_layer_enable(mixer, layer->channel, layer->overlay, false, 0,
|
||||
old_zpos);
|
||||
+ if (mixer->cfg->is_de3)
|
||||
+ sun50i_afbc_disable(mixer, layer->channel);
|
||||
}
|
||||
|
||||
static void sun8i_vi_layer_atomic_update(struct drm_plane *plane,
|
||||
@@ -411,26 +424,53 @@ static void sun8i_vi_layer_atomic_update(struct drm_plane *plane,
|
||||
struct sun8i_vi_layer *layer = plane_to_sun8i_vi_layer(plane);
|
||||
@@ -346,19 +357,44 @@ static void sun8i_vi_layer_atomic_update(struct drm_plane *plane,
|
||||
plane);
|
||||
struct sun8i_layer *layer = plane_to_sun8i_layer(plane);
|
||||
unsigned int zpos = new_state->normalized_zpos;
|
||||
unsigned int old_zpos = old_state->normalized_zpos;
|
||||
+ struct drm_framebuffer *fb = plane->state->fb;
|
||||
struct sun8i_mixer *mixer = layer->mixer;
|
||||
+ bool afbc = drm_is_afbc(fb->modifier);
|
||||
|
||||
if (!new_state->visible) {
|
||||
sun8i_vi_layer_enable(mixer, layer->channel,
|
||||
layer->overlay, false, 0, old_zpos);
|
||||
+ if (mixer->cfg->is_de3)
|
||||
+ sun50i_afbc_disable(mixer, layer->channel);
|
||||
if (!new_state->crtc || !new_state->visible)
|
||||
return;
|
||||
}
|
||||
|
||||
+
|
||||
+ if (afbc) {
|
||||
+ u32 fmt_type;
|
||||
+
|
||||
|
||||
+ sun8i_vi_layer_prepare_non_linear(mixer, layer->channel,
|
||||
+ layer->overlay);
|
||||
+ sun50i_afbc_atomic_update(mixer, layer->channel, plane);
|
||||
@ -485,21 +491,17 @@ index 329e8bf8cd20..bda91c3e2bb7 100644
|
||||
- sun8i_vi_layer_update_buffer(mixer, layer->channel,
|
||||
- layer->overlay, plane);
|
||||
+ layer->overlay, plane, zpos, afbc);
|
||||
sun8i_vi_layer_enable(mixer, layer->channel, layer->overlay,
|
||||
true, zpos, old_zpos);
|
||||
}
|
||||
|
||||
+}
|
||||
+
|
||||
+static bool sun8i_vi_layer_format_mod_supported(struct drm_plane *plane,
|
||||
+ u32 format, u64 modifier)
|
||||
+{
|
||||
+ struct sun8i_vi_layer *layer = plane_to_sun8i_vi_layer(plane);
|
||||
+ struct sun8i_layer *layer = plane_to_sun8i_layer(plane);
|
||||
+
|
||||
+ return sun50i_afbc_format_mod_supported(layer->mixer, format, modifier);
|
||||
+}
|
||||
+
|
||||
}
|
||||
|
||||
static const struct drm_plane_helper_funcs sun8i_vi_layer_helper_funcs = {
|
||||
.atomic_check = sun8i_vi_layer_atomic_check,
|
||||
.atomic_disable = sun8i_vi_layer_atomic_disable,
|
||||
@@ -444,6 +484,7 @@ static const struct drm_plane_funcs sun8i_vi_layer_funcs = {
|
||||
.disable_plane = drm_atomic_helper_disable_plane,
|
||||
.reset = drm_atomic_helper_plane_reset,
|
||||
@ -536,13 +538,13 @@ index 329e8bf8cd20..bda91c3e2bb7 100644
|
||||
+ DRM_FORMAT_MOD_INVALID
|
||||
+};
|
||||
+
|
||||
struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
struct sun8i_mixer *mixer,
|
||||
int index)
|
||||
struct sun8i_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
struct sun8i_mixer *mixer,
|
||||
int index)
|
||||
@@ -542,6 +600,7 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
|
||||
u32 supported_encodings, supported_ranges;
|
||||
unsigned int plane_cnt, format_count;
|
||||
struct sun8i_vi_layer *layer;
|
||||
struct sun8i_layer *layer;
|
||||
+ const uint64_t *modifiers;
|
||||
const u32 *formats;
|
||||
int ret;
|
||||
|
@ -201,7 +201,7 @@ index 581233d6eaf2..a5771b5d9b67 100644
|
||||
static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -681,6 +756,14 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
|
||||
@@ -681,6 +756,15 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
|
||||
|
||||
phy->variant = of_device_get_match_data(dev);
|
||||
phy->dev = dev;
|
||||
@ -209,6 +209,7 @@ index 581233d6eaf2..a5771b5d9b67 100644
|
||||
+ of_machine_is_compatible("friendlyarm,nanopi-m1") ||
|
||||
+ of_machine_is_compatible("xunlong,orangepi-lite") ||
|
||||
+ of_machine_is_compatible("xunlong,orangepi-one") ||
|
||||
+ of_machine_is_compatible("xunlong,orangepi-pc") ||
|
||||
+ of_machine_is_compatible("xunlong,orangepi-pc-plus") ||
|
||||
+ of_machine_is_compatible("xunlong,orangepi-plus2e");
|
||||
+ phy->bit_bang_cec = phy->disable_cec &&
|
||||
@ -216,18 +217,16 @@ index 581233d6eaf2..a5771b5d9b67 100644
|
||||
|
||||
regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(regs))
|
||||
@@ -727,8 +810,19 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
|
||||
@@ -727,8 +810,17 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int sun8i_hdmi_phy_remove(struct platform_device *pdev)
|
||||
+static void sun8i_hdmi_phy_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct sun8i_hdmi_phy *phy = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ cec_notifier_cec_adap_unregister(phy->cec_notifier, phy->cec_adapter);
|
||||
+ cec_unregister_adapter(phy->cec_adapter);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
struct platform_driver sun8i_hdmi_phy_driver = {
|
||||
|
@ -0,0 +1,75 @@
|
||||
From 1877122b4d0fef204f7076f4c28761cae9fcd807 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Jirman <megous@megous.com>
|
||||
Date: Sat, 15 Mar 2025 17:38:35 +0100
|
||||
Subject: [PATCH 1/3] net: stmmac: sun8i: Use devm_regulator_get for PHY
|
||||
regulator
|
||||
|
||||
Use devm_regulator_get instead of devm_regulator_get_optional and rely
|
||||
on dummy supply. This avoids NULL checks before regulator_enable/disable
|
||||
calls.
|
||||
|
||||
This path also improves error reporting, because we now report both
|
||||
use of dummy supply and error during registration with more detail,
|
||||
instead of generic info level message "No regulator found" that
|
||||
was reported previously on errors and lack of regulator property in DT.
|
||||
|
||||
Finally, we'll be adding further optional regulators, and the overall
|
||||
code will be simpler.
|
||||
|
||||
Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
---
|
||||
.../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 23 ++++++++-----------
|
||||
1 file changed, 10 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||
index 4b7b2582a120..94a4898260b0 100644
|
||||
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||
@@ -588,12 +588,10 @@ static int sun8i_dwmac_init(struct platform_device *pdev, void *priv)
|
||||
struct sunxi_priv_data *gmac = priv;
|
||||
int ret;
|
||||
|
||||
- if (gmac->regulator) {
|
||||
- ret = regulator_enable(gmac->regulator);
|
||||
- if (ret) {
|
||||
- dev_err(&pdev->dev, "Fail to enable regulator\n");
|
||||
- return ret;
|
||||
- }
|
||||
+ ret = regulator_enable(gmac->regulator);
|
||||
+ if (ret) {
|
||||
+ dev_err(&pdev->dev, "Fail to enable regulator\n");
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
if (gmac->use_internal_phy) {
|
||||
@@ -1051,8 +1049,7 @@ static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv)
|
||||
if (gmac->variant->soc_has_internal_phy)
|
||||
sun8i_dwmac_unpower_internal_phy(gmac);
|
||||
|
||||
- if (gmac->regulator)
|
||||
- regulator_disable(gmac->regulator);
|
||||
+ regulator_disable(gmac->regulator);
|
||||
}
|
||||
|
||||
static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable)
|
||||
@@ -1176,12 +1173,12 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
/* Optional regulator for PHY */
|
||||
- gmac->regulator = devm_regulator_get_optional(dev, "phy");
|
||||
+ gmac->regulator = devm_regulator_get(dev, "phy");
|
||||
if (IS_ERR(gmac->regulator)) {
|
||||
- if (PTR_ERR(gmac->regulator) == -EPROBE_DEFER)
|
||||
- return -EPROBE_DEFER;
|
||||
- dev_info(dev, "No regulator found\n");
|
||||
- gmac->regulator = NULL;
|
||||
+ ret = PTR_ERR(gmac->regulator);
|
||||
+ if (ret != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Failed to get PHY regulator (%d)\n", ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
/* The "GMAC clock control" register might be located in the
|
||||
--
|
||||
2.48.1
|
||||
|
@ -0,0 +1,92 @@
|
||||
From a46ed6e8213c96d0905de691620cd473b0a2e45e Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Jirman <megous@megous.com>
|
||||
Date: Sat, 15 Mar 2025 17:49:23 +0100
|
||||
Subject: [PATCH 2/3] net: stmmac: sun8i: Add support for enabling a regulator
|
||||
for PHY I/O pins
|
||||
|
||||
Orange Pi 3 has two regulators that power the Realtek RTL8211E. According
|
||||
to the phy datasheet, both regulators need to be enabled at the same time.
|
||||
|
||||
Add support for the second optional regulator, "phy-io", to the glue
|
||||
driver.
|
||||
|
||||
Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
---
|
||||
.../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 23 ++++++++++++++++++-
|
||||
1 file changed, 22 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||
index 94a4898260b0..da77e82f06d2 100644
|
||||
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||
@@ -61,6 +61,8 @@ struct emac_variant {
|
||||
/* struct sunxi_priv_data - hold all sunxi private data
|
||||
* @ephy_clk: reference to the optional EPHY clock for the internal PHY
|
||||
* @regulator: reference to the optional regulator
|
||||
+ * @regulator_phy_io: reference to the optional regulator for
|
||||
+ * PHY I/O pins
|
||||
* @rst_ephy: reference to the optional EPHY reset for the internal PHY
|
||||
* @variant: reference to the current board variant
|
||||
* @regmap: regmap for using the syscon
|
||||
@@ -71,6 +73,7 @@ struct emac_variant {
|
||||
struct sunxi_priv_data {
|
||||
struct clk *ephy_clk;
|
||||
struct regulator *regulator;
|
||||
+ struct regulator *regulator_phy_io;
|
||||
struct reset_control *rst_ephy;
|
||||
const struct emac_variant *variant;
|
||||
struct regmap_field *regmap_field;
|
||||
@@ -588,10 +591,16 @@ static int sun8i_dwmac_init(struct platform_device *pdev, void *priv)
|
||||
struct sunxi_priv_data *gmac = priv;
|
||||
int ret;
|
||||
|
||||
+ ret = regulator_enable(gmac->regulator_phy_io);
|
||||
+ if (ret) {
|
||||
+ dev_err(&pdev->dev, "Fail to enable PHY I/O regulator\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
ret = regulator_enable(gmac->regulator);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Fail to enable regulator\n");
|
||||
- return ret;
|
||||
+ goto err_disable_regulator_phy_io;
|
||||
}
|
||||
|
||||
if (gmac->use_internal_phy) {
|
||||
@@ -605,6 +614,8 @@ static int sun8i_dwmac_init(struct platform_device *pdev, void *priv)
|
||||
err_disable_regulator:
|
||||
if (gmac->regulator)
|
||||
regulator_disable(gmac->regulator);
|
||||
+err_disable_regulator_phy_io:
|
||||
+ regulator_disable(gmac->regulator_phy_io);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1050,6 +1061,7 @@ static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv)
|
||||
sun8i_dwmac_unpower_internal_phy(gmac);
|
||||
|
||||
regulator_disable(gmac->regulator);
|
||||
+ regulator_disable(gmac->regulator_phy_io);
|
||||
}
|
||||
|
||||
static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable)
|
||||
@@ -1181,6 +1193,15 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ /* Optional regulator for PHY I/O pins */
|
||||
+ gmac->regulator_phy_io = devm_regulator_get(dev, "phy-io");
|
||||
+ if (IS_ERR(gmac->regulator_phy_io)) {
|
||||
+ ret = PTR_ERR(gmac->regulator_phy_io);
|
||||
+ if (ret != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Failed to get PHY I/O regulator (%d)\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
/* The "GMAC clock control" register might be located in the
|
||||
* CCU address range (on the R40), or the system control address
|
||||
* range (on most other sun8i and later SoCs).
|
||||
--
|
||||
2.48.1
|
||||
|
@ -1,12 +1,12 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
|
||||
Date: Tue, 20 Aug 2019 14:54:48 +0200
|
||||
Subject: [PATCH] arm64: dts: allwinner: orange-pi-3: Enable ethernet
|
||||
From 2409d598b229dee9036f9ea2f14dde2647e8c114 Mon Sep 17 00:00:00 2001
|
||||
From: Ondrej Jirman <megous@megous.com>
|
||||
Date: Sat, 15 Mar 2025 18:00:20 +0100
|
||||
Subject: [PATCH 3/3] arm64: dts: allwinner: orange-pi-3: Enable ethernet
|
||||
|
||||
Orange Pi 3 has two regulators that power the Realtek RTL8211E
|
||||
PHY. According to the datasheet, both regulators need to be enabled
|
||||
at the same time, or that "phy-io" should be enabled slightly earlier
|
||||
than "ephy" regulator.
|
||||
than "phy" regulator.
|
||||
|
||||
RTL8211E/RTL8211EG datasheet says:
|
||||
|
||||
@ -14,26 +14,33 @@ RTL8211E/RTL8211EG datasheet says:
|
||||
or slightly earlier than 3.3V power. Rising 2.5V (or 1.8/1.5V) power
|
||||
later than 3.3V power may lead to errors.
|
||||
|
||||
Signed-off-by: Ondrej Jirman <megi@xff.cz>
|
||||
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
The driver ensures the regulator enable ordering. The timing is set
|
||||
in DT via startup-delay-us.
|
||||
|
||||
We also need to wait at least 30ms after power-up/reset, before
|
||||
accessing the PHY registers.
|
||||
|
||||
All values of RX/TX delay were tested exhaustively and a middle one
|
||||
of the range of working values was chosen.
|
||||
|
||||
Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
---
|
||||
.../dts/allwinner/sun50i-h6-orangepi-3.dts | 39 +++++++++++++++++++
|
||||
1 file changed, 39 insertions(+)
|
||||
.../dts/allwinner/sun50i-h6-orangepi-3.dts | 40 +++++++++++++++++++
|
||||
1 file changed, 40 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
|
||||
index 6fc65e8db220..df8b6de2b4d2 100644
|
||||
index d01a318653a3..89049a7c0473 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
|
||||
@@ -13,6 +13,7 @@ / {
|
||||
compatible = "xunlong,orangepi-3", "allwinner,sun50i-h6";
|
||||
|
||||
@@ -15,6 +15,7 @@ / {
|
||||
aliases {
|
||||
+ ethernet0 = &emac;
|
||||
serial0 = &uart0;
|
||||
serial1 = &uart1;
|
||||
+ ethernet0 = &emac;
|
||||
};
|
||||
@@ -55,6 +56,16 @@ led-1 {
|
||||
|
||||
chosen {
|
||||
@@ -55,6 +56,15 @@ led-1 {
|
||||
};
|
||||
};
|
||||
|
||||
@ -44,21 +51,30 @@ index 6fc65e8db220..df8b6de2b4d2 100644
|
||||
+ regulator-max-microvolt = <2500000>;
|
||||
+ enable-active-high;
|
||||
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */
|
||||
+ off-on-delay-us = <100000>;
|
||||
+ };
|
||||
+
|
||||
reg_vcc5v: vcc5v {
|
||||
/* board wide 5V supply directly from the DC jack */
|
||||
compatible = "regulator-fixed";
|
||||
@@ -113,6 +124,33 @@ &ehci3 {
|
||||
status = "okay";
|
||||
@@ -108,6 +118,35 @@ hdmi_out_con: endpoint {
|
||||
};
|
||||
};
|
||||
|
||||
+&emac {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&ext_rgmii_pins>;
|
||||
+ phy-mode = "rgmii-id";
|
||||
+ phy-mode = "rgmii-txid";
|
||||
+ phy-handle = <&ext_rgmii_phy>;
|
||||
+ /*
|
||||
+ * The board uses 2.5V RGMII signalling. Power sequence to enable
|
||||
+ * the phy is to enable GMAC-2V5 and GMAC-3V (aldo2) power rails
|
||||
+ * at the same time and to wait 100ms. The driver enables phy-io
|
||||
+ * first. Delay is achieved with enable-ramp-delay on reg_aldo2.
|
||||
+ */
|
||||
+ phy-supply = <®_aldo2>;
|
||||
+ phy-io-supply = <®_gmac_2v5>;
|
||||
+ allwinner,rx-delay-ps = <1500>;
|
||||
+ allwinner,tx-delay-ps = <700>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
@ -66,14 +82,6 @@ index 6fc65e8db220..df8b6de2b4d2 100644
|
||||
+ ext_rgmii_phy: ethernet-phy@1 {
|
||||
+ compatible = "ethernet-phy-ieee802.3-c22";
|
||||
+ reg = <1>;
|
||||
+ /*
|
||||
+ * The board uses 2.5V RGMII signalling. Power sequence to enable
|
||||
+ * the phy is to enable GMAC-2V5 and GMAC-3V (aldo2) power rails
|
||||
+ * at the same time and to wait 100ms. The driver enables phy-io
|
||||
+ * first. Delay is achieved with enable-ramp-delay on reg_aldo2.
|
||||
+ */
|
||||
+ phy-io-supply = <®_gmac_2v5>;
|
||||
+ ephy-supply = <®_aldo2>;
|
||||
+
|
||||
+ reset-gpios = <&pio 3 14 GPIO_ACTIVE_LOW>; /* PD14 */
|
||||
+ reset-assert-us = <15000>;
|
||||
@ -81,10 +89,10 @@ index 6fc65e8db220..df8b6de2b4d2 100644
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&gpu {
|
||||
mali-supply = <®_dcdcc>;
|
||||
status = "okay";
|
||||
@@ -211,6 +249,7 @@ reg_aldo2: aldo2 {
|
||||
&mmc0 {
|
||||
vmmc-supply = <®_cldo1>;
|
||||
cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
|
||||
@@ -188,6 +227,7 @@ reg_aldo2: aldo2 {
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-name = "vcc33-audio-tv-ephy-mac";
|
||||
@ -92,3 +100,6 @@ index 6fc65e8db220..df8b6de2b4d2 100644
|
||||
};
|
||||
|
||||
/* ALDO3 is shorted to CLDO1 */
|
||||
--
|
||||
2.48.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user