Fw: fix green/blue pio-led on bpi-r2
Resend to Mailinglist because of previous blocked cause of html-format Gesendet: Freitag, 25. Mai 2018 um 17:47 Uhr Von: "Frank Wunderlich" An: "Matthias Brugger" , "Rob Herring" , "Mark Rutland" , "Russell King" Cc: linux-arm-ker...@lists.infradead.org, linux-media...@lists.infradead.org, devicet...@vger.kernel.org, linux-kernel@vger.kernel.org Betreff: fix green/blue pio-led on bpi-r2 Hi, i've tested LEDs on bananapi-r2 and see that they stay on at boot-time and can be switched off by "echo 0", as this behaviour is not logical i changed that. Also green and blue are swapped by access their names in sysfs. http://forum.banana-pi.org/t/control-on-board-leds/4287/33 hoping everything is alright with the patch (it's my first on here) to test it: [16:08] root@bpi-r2:~# L=/sys/class/leds/bpi-r2\:isink [17:41] root@bpi-r2:~# L2=/sys/class/leds/bpi-r2\:pio [17:42] root@bpi-r2:~# echo 1 > $L2:green/brightness [17:42] root@bpi-r2:~# echo 1 > $L2:blue/brightness [17:42] root@bpi-r2:~# echo 0 > $L2:green/brightness [17:42] root@bpi-r2:~# echo 0 > $L2:blue/brightness at least options needed: CONFIG_SYSFS=y CONFIG_GPIO_SYSFS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_MT6323=y CONFIG_LEDS_GPIO=y regards Frank >From 850977bdb8cf05b1212c69232f03fd55293fe21a Mon Sep 17 00:00:00 2001 From: Frank Wunderlich Date: Mon, 21 May 2018 21:38:53 +0200 Subject: [PATCH] [DTS] fix green/blue pio-led on bpi-r2 Signed-off-by: Frank Wunderlich --- arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts index 024bdb7d6cca5..6fa37a2764110 100644 --- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts +++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts @@ -80,21 +80,21 @@ pinctrl-names = "default"; pinctrl-0 = <&led_pins_a>; - blue { - label = "bpi-r2:pio:blue"; - gpios = <&pio 241 GPIO_ACTIVE_HIGH>; + green { + label = "bpi-r2:pio:green"; + gpios = <&pio 241 GPIO_ACTIVE_LOW>; default-state = "off"; }; - green { - label = "bpi-r2:pio:green"; - gpios = <&pio 240 GPIO_ACTIVE_HIGH>; + blue { + label = "bpi-r2:pio:blue"; + gpios = <&pio 240 GPIO_ACTIVE_LOW>; default-state = "off"; }; red { label = "bpi-r2:pio:red"; - gpios = <&pio 239 GPIO_ACTIVE_HIGH>; + gpios = <&pio 239 GPIO_ACTIVE_LOW>; default-state = "off"; }; };
Aw: Re: [PATCH 1/7] [DSA] adding fields for holding information about upstream-port
Hi Florian, thank you for first comments. It was my first Patchset i tried to send ia git send-email. i had searched the Patch 0/x-option but had not found it. i will rework this. - i did only a porting to 4.15+ dsa-core. how do i credit John in this series? - maybe i need a fallback to current "first cpu-port option", this was not defined by john, but i can add it in next series - should i include dts (bananapi r2) also in the series? - i have a additional patch renaming dts-option to default_cpu instead of cpu (hint of Andrew) regards Frank > Gesendet: Dienstag, 11. Dezember 2018 um 23:37 Uhr > Von: "Florian Fainelli" > An: "Frank Wunderlich" , "Andrew Lunn" > , "Vivien Didelot" , > "David S. Miller" , "Matthias Brugger" > , net...@vger.kernel.org, > linux-kernel@vger.kernel.org, linux-arm-ker...@lists.infradead.org, > linux-media...@lists.infradead.org > Betreff: Re: [PATCH 1/7] [DSA] adding fields for holding information about > upstream-port > > Hi,, > > On 12/11/18 11:33 AM, Frank Wunderlich wrote: > > based on > > https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch > > There are several stylistic as well as logistical/technical issues with > this patch series, so please address those before we can start doing the > technical review: > > - this is a multi patch series, so a cover letter should be provided > (can be done with git format-patch --cover-letter) > > - subject for the patches should be prefixed with net: dsa: > > - commit messages explaining what is being achieved, how and what > problem/feature this is providing is mandatory, you cannot just take > patches from OpenWrt and provide no context what so ever except from the > subject > > Please fix that so we can do a meaningful and constructive technical > review of the patches. > > Thank you > > > > > Signed-off-by: Frank Wunderlich > > --- > > include/net/dsa.h | 4 > > net/dsa/dsa_priv.h | 5 + > > 2 files changed, 9 insertions(+) > > > > diff --git a/include/net/dsa.h b/include/net/dsa.h > > index 23690c44e167..3efa81e08993 100644 > > --- a/include/net/dsa.h > > +++ b/include/net/dsa.h > > @@ -203,6 +203,10 @@ struct dsa_port { > > struct net_device *bridge_dev; > > struct devlink_port devlink_port; > > struct phylink *pl; > > + > > + struct net_device *ethernet; > > + int upstream; > > + > > /* > > * Original copy of the master netdev ethtool_ops > > */ > > diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h > > index 9e4fd04ab53c..cc0cd7675117 100644 > > --- a/net/dsa/dsa_priv.h > > +++ b/net/dsa/dsa_priv.h > > @@ -81,6 +81,8 @@ struct dsa_slave_priv { > > > > /* TC context */ > > struct list_headmall_tc_list; > > + > > + struct net_device *master; > > }; > > > > /* dsa.c */ > > @@ -188,7 +190,10 @@ static inline struct net_device * > > dsa_slave_to_master(const struct net_device *dev) > > { > > struct dsa_port *dp = dsa_slave_to_port(dev); > > + struct dsa_slave_priv *p = netdev_priv(dev); > > > > + if (p->master) > > + return p->master; > > return dp->cpu_dp->master; > > } > > > > > > > -- > Florian > > ___ > Linux-mediatek mailing list > linux-media...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek >
[PATCH 5/7] [DSA] dsa multi cpu (mt7530.c)
based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch Signed-off-by: Frank Wunderlich --- drivers/net/dsa/mt7530.c | 34 +++--- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index a6a15a063e3e..441320d4d779 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -674,6 +674,9 @@ static int mt7530_cpu_port_enable(struct mt7530_priv *priv, int port) { + u8 port_mask = 0; + int i; + /* Enable Mediatek header mode on the cpu port */ mt7530_write(priv, MT7530_PVC_P(port), PORT_SPEC_TAG); @@ -690,8 +693,14 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv, /* CPU port gets connected to all user ports of * the switch */ + + for (i = 0; i < MT7530_NUM_PORTS; i++) + if ((priv->ds->ports[port].type == DSA_PORT_TYPE_USER) && + (dsa_port_upstream_port(priv->ds, i) == port)) + port_mask |= BIT(i); + mt7530_write(priv, MT7530_PCR_P(port), -PCR_MATRIX(dsa_user_ports(priv->ds))); +PCR_MATRIX(port_mask)); return 0; } @@ -701,6 +710,7 @@ mt7530_port_enable(struct dsa_switch *ds, int port, struct phy_device *phy) { struct mt7530_priv *priv = ds->priv; + u8 upstream = dsa_port_upstream_port(ds, port); mutex_lock(&priv->reg_mutex); @@ -711,7 +721,7 @@ mt7530_port_enable(struct dsa_switch *ds, int port, * restore the port matrix if the port is the member of a certain * bridge. */ - priv->ports[port].pm |= PCR_MATRIX(BIT(MT7530_CPU_PORT)); + priv->ports[port].pm |= PCR_MATRIX(BIT(upstream)); priv->ports[port].enable = true; mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, priv->ports[port].pm); @@ -774,7 +784,8 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port, struct net_device *bridge) { struct mt7530_priv *priv = ds->priv; - u32 port_bitmap = BIT(MT7530_CPU_PORT); + u8 upstream = dsa_port_upstream_port(ds, port); + u32 port_bitmap = BIT(upstream); int i; mutex_lock(&priv->reg_mutex); @@ -875,6 +886,7 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *bridge) { struct mt7530_priv *priv = ds->priv; + u8 upstream = dsa_port_upstream_port(ds, port); int i; mutex_lock(&priv->reg_mutex); @@ -902,8 +914,8 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port, */ if (priv->ports[port].enable) mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, - PCR_MATRIX(BIT(MT7530_CPU_PORT))); - priv->ports[port].pm = PCR_MATRIX(BIT(MT7530_CPU_PORT)); + PCR_MATRIX(BIT(upstream))); + priv->ports[port].pm = PCR_MATRIX(BIT(upstream)); mt7530_port_set_vlan_unaware(ds, port); @@ -1194,15 +1206,7 @@ mt7530_port_vlan_del(struct dsa_switch *ds, int port, static enum dsa_tag_protocol mtk_get_tag_protocol(struct dsa_switch *ds, int port) { - struct mt7530_priv *priv = ds->priv; - - if (port != MT7530_CPU_PORT) { - dev_warn(priv->dev, -"port not matched with tagging CPU port\n"); - return DSA_TAG_PROTO_NONE; - } else { - return DSA_TAG_PROTO_MTK; - } + return DSA_TAG_PROTO_MTK; } static int @@ -1275,7 +1279,7 @@ mt7530_setup(struct dsa_switch *ds) /* Enable Port 6 only; P5 as GMAC5 which currently is not supported */ val = mt7530_read(priv, MT7530_MHWTRAP); - val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; + val &= ~MHWTRAP_P5_DIS & ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; val |= MHWTRAP_MANUAL; if (!dsa_is_cpu_port(ds, 5)) { val |= MHWTRAP_P5_DIS; -- 2.17.1
[PATCH 3/7] [DSA] adding handling of second CPU-Port
based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch Signed-off-by: Frank Wunderlich --- net/dsa/dsa2.c | 18 ++ net/dsa/slave.c | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 77420675e9ed..4a6ebfe647f0 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -303,6 +303,8 @@ static int dsa_port_setup(struct dsa_port *dp) ds->index, dp->index); return err; } + if (dp->master) + dp->master->dsa_ptr = dp; break; case DSA_PORT_TYPE_DSA: /* dp->index is used now as port_number. However @@ -323,12 +325,17 @@ static int dsa_port_setup(struct dsa_port *dp) devlink_port_attrs_set(&dp->devlink_port, DEVLINK_PORT_FLAVOUR_PHYSICAL, dp->index, false, 0); + err = dsa_user_parse(dp, dp->index, ds); + if (err) + return err; + err = dsa_slave_create(dp); if (err) dev_err(ds->dev, "failed to create slave for port %d.%d\n", ds->index, dp->index); else devlink_port_type_eth_set(&dp->devlink_port, dp->slave); + break; } @@ -344,6 +351,14 @@ static void dsa_port_teardown(struct dsa_port *dp) case DSA_PORT_TYPE_UNUSED: break; case DSA_PORT_TYPE_CPU: + dsa_port_link_unregister_of(dp); + if (dp->master) + dp->master->dsa_ptr = NULL; + if (dp->ethernet) { + dev_put(dp->ethernet); + dp->ethernet = NULL; + } + break; case DSA_PORT_TYPE_DSA: dsa_port_link_unregister_of(dp); break; @@ -598,6 +613,9 @@ static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master) dp->master = master; dp->dst = dst; + dev_hold(master); + ds->ports[dp->index].ethernet = master; + return 0; } diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 7d0c19e7edcf..f0fdb9e5d05f 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1312,11 +1312,11 @@ static void dsa_slave_notify(struct net_device *dev, unsigned long val) int dsa_slave_create(struct dsa_port *port) { const struct dsa_port *cpu_dp = port->cpu_dp; - struct net_device *master = cpu_dp->master; struct dsa_switch *ds = port->ds; const char *name = port->name; struct net_device *slave_dev; struct dsa_slave_priv *p; + struct net_device *master = ds->ports[port->upstream].ethernet; int ret; if (!ds->num_tx_queues) @@ -1355,6 +1355,7 @@ int dsa_slave_create(struct dsa_port *port) p->dp = port; INIT_LIST_HEAD(&p->mall_tc_list); p->xmit = cpu_dp->tag_ops->xmit; + p->master = master; port->slave = slave_dev; netif_carrier_off(slave_dev); -- 2.17.1
[PATCH 6/7] [DSA] tell GDMA when we are turning on the special tag
based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0044-net-next-dsa-mediatek-tell-GDMA-when-we-are-turning-.patch Signed-off-by: Frank Wunderlich --- drivers/net/dsa/mt7530.c | 6 ++ drivers/net/dsa/mt7530.h | 4 2 files changed, 10 insertions(+) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 441320d4d779..83669f53cb36 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -681,6 +681,12 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv, mt7530_write(priv, MT7530_PVC_P(port), PORT_SPEC_TAG); + /* Enable Mediatek header mode on the GMAC that the cpu port +* connects to +*/ + regmap_write_bits(priv->ethernet, MTK_GDMA_FWD_CFG(port), + GDMA_SPEC_TAG, GDMA_SPEC_TAG); + /* Setup the MAC by default for the cpu port */ mt7530_write(priv, MT7530_PMCR_P(port), PMCR_CPUP_LINK); diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index d9b407a22a58..310f2536175b 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -23,6 +23,10 @@ #define TRGMII_BASE(x) (0x1 + (x)) +/* Registers for GDMA configuration access */ +#define MTK_GDMA_FWD_CFG(x)(0x500 + (x * 0x1000)) +#define GDMA_SPEC_TAG BIT(24) + /* Registers to ethsys access */ #define ETHSYS_CLKCFG0 0x2c #define ETHSYS_TRGMII_CLK_SEL362_5BIT(11) -- 2.17.1
[PATCH 7/7] [DSA] mt7530 add linking to mdio
based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0045-net-dsa-mediatek-turn-into-platform-driver.patch Signed-off-by: Frank Wunderlich --- drivers/net/dsa/mt7530.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 83669f53cb36..e529bc334459 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -1345,7 +1345,7 @@ static int mt7530_probe(struct mdio_device *mdiodev) { struct mt7530_priv *priv; - struct device_node *dn; + struct device_node *dn, *mdio; dn = mdiodev->dev.of_node; @@ -1392,8 +1392,14 @@ mt7530_probe(struct mdio_device *mdiodev) return PTR_ERR(priv->reset); } } + mdio = of_get_parent(dn); + if (!mdio) + return -EINVAL; + + priv->bus = of_mdio_find_bus(mdio); + if (!priv->bus) + return -EPROBE_DEFER; - priv->bus = mdiodev->bus; priv->dev = &mdiodev->dev; priv->ds->priv = priv; priv->ds->ops = &mt7530_switch_ops; -- 2.17.1
[PATCH 2/7] [DSA] add helper functions
based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch Signed-off-by: Frank Wunderlich --- include/net/dsa.h | 18 ++ net/dsa/dsa2.c| 18 ++ 2 files changed, 36 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 3efa81e08993..612942ac56de 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -319,6 +319,12 @@ static inline unsigned int dsa_towards_port(struct dsa_switch *ds, int device, return ds->rtable[device]; } + +static inline bool dsa_is_upstream_port(struct dsa_switch *ds, int p) +{ + return dsa_is_cpu_port(ds, p) || dsa_is_dsa_port(ds, p); +} + /* Return the local port used to reach the dedicated CPU port */ static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port) { @@ -331,6 +337,18 @@ static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port) return dsa_towards_port(ds, cpu_dp->ds->index, cpu_dp->index); } +static inline u8 dsa_port_upstream_port(struct dsa_switch *ds, int port) +{ + /* +* If this port has a specific upstream cpu port, use it, +* otherwise use the switch default. +*/ + if (ds->ports[port].upstream) + return ds->ports[port].upstream; + else + return dsa_upstream_port(ds, port); +} + typedef int dsa_fdb_dump_cb_t(const unsigned char *addr, u16 vid, bool is_static, void *data); struct dsa_switch_ops { diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index a1917025e155..77420675e9ed 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -255,6 +255,24 @@ static void dsa_tree_teardown_default_cpu(struct dsa_switch_tree *dst) dst->cpu_dp = NULL; } +static int dsa_user_parse(struct dsa_port *port, u32 index, + struct dsa_switch *ds) +{ + struct device_node *cpu_port; + const unsigned int *cpu_port_reg; + int cpu_port_index; + + cpu_port = of_parse_phandle(port->dn, "cpu", 0); + if (cpu_port) { + cpu_port_reg = of_get_property(cpu_port, "reg", NULL); + if (!cpu_port_reg) + return -EINVAL; + cpu_port_index = be32_to_cpup(cpu_port_reg); + ds->ports[index].upstream = cpu_port_index; + } + return 0; +} + static int dsa_port_setup(struct dsa_port *dp) { struct dsa_switch *ds = dp->ds; -- 2.17.1
[PATCH 1/7] [DSA] adding fields for holding information about upstream-port
based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0033-dsa-multi-cpu.patch Signed-off-by: Frank Wunderlich --- include/net/dsa.h | 4 net/dsa/dsa_priv.h | 5 + 2 files changed, 9 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 23690c44e167..3efa81e08993 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -203,6 +203,10 @@ struct dsa_port { struct net_device *bridge_dev; struct devlink_port devlink_port; struct phylink *pl; + + struct net_device *ethernet; + int upstream; + /* * Original copy of the master netdev ethtool_ops */ diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 9e4fd04ab53c..cc0cd7675117 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -81,6 +81,8 @@ struct dsa_slave_priv { /* TC context */ struct list_headmall_tc_list; + + struct net_device *master; }; /* dsa.c */ @@ -188,7 +190,10 @@ static inline struct net_device * dsa_slave_to_master(const struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); + struct dsa_slave_priv *p = netdev_priv(dev); + if (p->master) + return p->master; return dp->cpu_dp->master; } -- 2.17.1
[PATCH 4/7] [DSA] add support for GMAC2 wired to ext
based on https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/patches-4.14/0032-net-dsa-mediatek-add-support-for-GMAC2-wired-to-ext-.patch Signed-off-by: Frank Wunderlich --- drivers/net/dsa/mt7530.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index a5de9bffe5be..a6a15a063e3e 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -1277,6 +1277,11 @@ mt7530_setup(struct dsa_switch *ds) val = mt7530_read(priv, MT7530_MHWTRAP); val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; val |= MHWTRAP_MANUAL; + if (!dsa_is_cpu_port(ds, 5)) { + val |= MHWTRAP_P5_DIS; + val |= MHWTRAP_P5_MAC_SEL; + val |= MHWTRAP_P5_RGMII_MODE; + } mt7530_write(priv, MT7530_MHWTRAP, val); /* Enable and reset MIB counters */ -- 2.17.1
[PATCH] drm/mediatek: Add MTK Framebuffer-Device (mt7623)
From: CK Hu This patch adds Framebuffer-Driver for Mediatek currently tested on mt7623, maybe works on other platforms MTK-FBDev written by CK Hu and ported from 4.4 based on patchset drm/hdmi for 7623 v5 (except last part included in 4.20) https://patchwork.kernel.org/project/linux-mediatek/list/?series=25989 depends on dts-patch (resend of 5/5, parts 1-4 already in 4.20): "arm: dts: mt7623: add display subsystem related device nodes" https://patchwork.kernel.org/patch/10588951/ 2 bugfix-patches from bibby hsieh fix-boot-up-for-720-and-480-but-1080 using-different-round-rate-for-mt7623 1 Patch from Ryder Lee http://forum.banana-pi.org/t/kernel-4-19-rc1-for-testers/6618/52 full working tree here for reference: https://github.com/frank-w/BPI-R2-4.14/commits/4.20-hdmiv5 Signed-off-by: CK Hu Signed-off-by: Alexander Ryabchenko Signed-off-by: Frank Wunderlich Tested-by: Frank Wunderlich --- drivers/gpu/drm/mediatek/Makefile| 1 + drivers/gpu/drm/mediatek/mtk_drm_drv.c | 6 + drivers/gpu/drm/mediatek/mtk_drm_drv.h | 4 + drivers/gpu/drm/mediatek/mtk_drm_fb.c| 13 ++ drivers/gpu/drm/mediatek/mtk_drm_fb.h| 3 + drivers/gpu/drm/mediatek/mtk_drm_fbdev.c | 178 +++ drivers/gpu/drm/mediatek/mtk_drm_fbdev.h | 25 7 files changed, 230 insertions(+) create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_fbdev.c create mode 100644 drivers/gpu/drm/mediatek/mtk_drm_fbdev.h diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile index 82ae49c64221..d71e57dea77a 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -14,6 +14,7 @@ mediatek-drm-y := mtk_disp_color.o \ mtk_mipi_tx.o \ mtk_dpi.o +mediatek-drm-$(CONFIG_DRM_FBDEV_EMULATION) += mtk_drm_fbdev.o obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o mediatek-drm-hdmi-objs := mtk_cec.o \ diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 7800822b4db1..51f1ec3412d3 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -32,6 +32,7 @@ #include "mtk_drm_ddp_comp.h" #include "mtk_drm_drv.h" #include "mtk_drm_fb.h" +#include "mtk_drm_fbdev.h" #include "mtk_drm_gem.h" #define DRIVER_NAME "mediatek" @@ -299,6 +300,10 @@ static int mtk_drm_kms_init(struct drm_device *drm) drm_kms_helper_poll_init(drm); drm_mode_config_reset(drm); + ret = mtk_fbdev_init(drm); + if (ret) + goto err_component_unbind; + return 0; err_component_unbind: @@ -311,6 +316,7 @@ static int mtk_drm_kms_init(struct drm_device *drm) static void mtk_drm_kms_deinit(struct drm_device *drm) { + mtk_fbdev_fini(drm); drm_kms_helper_poll_fini(drm); component_unbind_all(drm->dev, drm); diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h index 256a3ff2e66e..56129a21fb2b 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -14,6 +14,7 @@ #ifndef MTK_DRM_DRV_H #define MTK_DRM_DRV_H +#include #include #include "mtk_drm_ddp_comp.h" @@ -43,6 +44,7 @@ struct mtk_drm_private { struct drm_device *drm; struct device *dma_dev; + struct drm_crtc *crtc[MAX_CRTC]; unsigned int num_pipes; struct device_node *mutex_node; @@ -59,6 +61,8 @@ struct mtk_drm_private { } commit; struct drm_atomic_state *suspend_state; + struct drm_fb_helper fb_helper; + struct drm_gem_object *fbdev_bo; }; extern struct platform_driver mtk_ddp_driver; diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.c b/drivers/gpu/drm/mediatek/mtk_drm_fb.c index be5f6f1daf55..7533aa4733d2 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_fb.c @@ -56,6 +56,19 @@ static struct drm_framebuffer *mtk_drm_framebuffer_init(struct drm_device *dev, return fb; } +struct drm_framebuffer *mtk_drm_framebuffer_create(struct drm_device *dev, + const struct drm_mode_fb_cmd2 *mode, + struct drm_gem_object *obj) +{ + struct drm_framebuffer *mtk_fb; + + mtk_fb = mtk_drm_framebuffer_init(dev, mode, obj); + if (IS_ERR(mtk_fb)) + return ERR_CAST(mtk_fb); + + return mtk_fb; +} + /* * Wait for any exclusive fence in fb's gem object's reservation object. * diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.h b/drivers/gpu/drm/mediatek/mtk_drm_fb.h index 7f976b196a15..e49e015380d0 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_fb.h @@ -18,5 +18,8 @@ int mtk_fb_wait(struct drm_framebuffer *fb); struct drm_framebuffer *mtk_drm_mode_fb_create
Aw: Re: [PATCH] thermal: mediatek: add sensors-support
Hi, > Gesendet: Dienstag, 20. April 2021 um 14:07 Uhr > Von: "Daniel Lezcano" > No #ifdef in C file. ... > devm_thermal_add_hwmon_sysfs() ? based on your comments this should be enough/right? #if IS_ENABLED(CONFIG_THERMAL_HWMON) tzdev->tzp->no_hwmon = false; ret = devm_thermal_add_hwmon_sysfs(tzdev); if (ret) dev_err(&pdev->dev, "error in thermal_add_hwmon_sysfs"); #endif if yes i send out v2, at least it works on my device regards Frank
Re: Aw: Re: [PATCH] thermal: mediatek: add sensors-support
Am 20. April 2021 17:18:32 MESZ schrieb Daniel Lezcano : > >Hi Frank, >The no_hwmon usage is a bit fuzzy in the thermal core code. Maybe add depency in Kconfig? Else we can get undefined symbols on linking regards Frank
[PATCH v2] thermal: mediatek: add sensors-support
From: Frank Wunderlich add HWMON-support to mediateks thermal driver to allow lm-sensors userspace tools read soc temperature Signed-off-by: Frank Wunderlich --- v2: drop ifdef and used devm_thermal_add_hwmon_sysfs --- drivers/thermal/mtk_thermal.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 149c6d7fd5a0..32be8a715c7d 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -23,6 +23,8 @@ #include #include +#include "thermal_hwmon.h" + /* AUXADC Registers */ #define AUXADC_CON1_SET_V 0x008 #define AUXADC_CON1_CLR_V 0x00c @@ -1087,6 +1089,11 @@ static int mtk_thermal_probe(struct platform_device *pdev) goto err_disable_clk_peri_therm; } + tzdev->tzp->no_hwmon = false; + ret = devm_thermal_add_hwmon_sysfs(tzdev); + if (ret) + dev_err(&pdev->dev, "error in thermal_add_hwmon_sysfs"); + return 0; err_disable_clk_peri_therm: -- 2.25.1
[PATCH v3] thermal: mediatek: add sensors-support
From: Frank Wunderlich add HWMON-support to mediateks thermal driver to allow lm-sensors userspace tools read soc temperature Signed-off-by: Frank Wunderlich --- v3: drop no_hwmon v2: drop ifdef and used devm_thermal_add_hwmon_sysfs --- drivers/thermal/mtk_thermal.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 149c6d7fd5a0..32be8a715c7d 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -23,6 +23,8 @@ #include #include +#include "thermal_hwmon.h" + /* AUXADC Registers */ #define AUXADC_CON1_SET_V 0x008 #define AUXADC_CON1_CLR_V 0x00c @@ -1087,6 +1089,11 @@ static int mtk_thermal_probe(struct platform_device *pdev) goto err_disable_clk_peri_therm; } + tzdev->tzp->no_hwmon = false; + ret = devm_thermal_add_hwmon_sysfs(tzdev); + if (ret) + dev_err(&pdev->dev, "error in thermal_add_hwmon_sysfs"); + return 0; err_disable_clk_peri_therm: -- 2.25.1
[PATCH v3] thermal: mediatek: add sensors-support
From: Frank Wunderlich add HWMON-support to mediateks thermal driver to allow lm-sensors userspace tools read soc temperature Signed-off-by: Frank Wunderlich --- v3: drop no_hwmon - now really, sorry v2: drop ifdef and used devm_thermal_add_hwmon_sysfs --- drivers/thermal/mtk_thermal.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 149c6d7fd5a0..85964988684b 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -23,6 +23,8 @@ #include #include +#include "thermal_hwmon.h" + /* AUXADC Registers */ #define AUXADC_CON1_SET_V 0x008 #define AUXADC_CON1_CLR_V 0x00c @@ -1087,6 +1089,10 @@ static int mtk_thermal_probe(struct platform_device *pdev) goto err_disable_clk_peri_therm; } + ret = devm_thermal_add_hwmon_sysfs(tzdev); + if (ret) + dev_err(&pdev->dev, "error in thermal_add_hwmon_sysfs"); + return 0; err_disable_clk_peri_therm: -- 2.25.1
[PATCH v1 1/4] drm/mediatek: config component output by device node port
From: Bibby Hsieh We can select output component by decive node port. Main path default output component is DSI. External path default output component is DPI. Signed-off-by: Bibby Hsieh --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 41 ++ drivers/gpu/drm/mediatek/mtk_drm_drv.h | 4 +-- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 57ce4708ef1b..d3e86426dc65 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -22,7 +22,9 @@ #include #include #include +#include #include +#include #include #include @@ -134,7 +136,7 @@ static const struct drm_mode_config_funcs mtk_drm_mode_config_funcs = { .atomic_commit = mtk_atomic_commit, }; -static const enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] = { +static enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] = { DDP_COMPONENT_OVL0, DDP_COMPONENT_RDMA0, DDP_COMPONENT_COLOR0, @@ -142,12 +144,12 @@ static const enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] = { DDP_COMPONENT_DSI0, }; -static const enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] = { +static enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] = { DDP_COMPONENT_RDMA1, DDP_COMPONENT_DPI0, }; -static const enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = { +static enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = { DDP_COMPONENT_OVL0, DDP_COMPONENT_COLOR0, DDP_COMPONENT_AAL0, @@ -157,7 +159,7 @@ static const enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = { DDP_COMPONENT_PWM0, }; -static const enum mtk_ddp_comp_id mt2712_mtk_ddp_ext[] = { +static enum mtk_ddp_comp_id mt2712_mtk_ddp_ext[] = { DDP_COMPONENT_OVL1, DDP_COMPONENT_COLOR1, DDP_COMPONENT_AAL1, @@ -173,7 +175,7 @@ static const enum mtk_ddp_comp_id mt2712_mtk_ddp_third[] = { DDP_COMPONENT_PWM2, }; -static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = { +static enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = { DDP_COMPONENT_OVL0, DDP_COMPONENT_COLOR0, DDP_COMPONENT_AAL0, @@ -184,7 +186,7 @@ static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = { DDP_COMPONENT_PWM0, }; -static const enum mtk_ddp_comp_id mt8173_mtk_ddp_ext[] = { +static enum mtk_ddp_comp_id mt8173_mtk_ddp_ext[] = { DDP_COMPONENT_OVL1, DDP_COMPONENT_COLOR1, DDP_COMPONENT_GAMMA, @@ -479,6 +481,7 @@ static int mtk_drm_probe(struct platform_device *pdev) /* Iterate over sibling DISP function blocks */ for_each_child_of_node(dev->of_node->parent, node) { + struct device_node *port, *ep, *remote; const struct of_device_id *of_id; enum mtk_ddp_comp_type comp_type; int comp_id; @@ -538,6 +541,32 @@ static int mtk_drm_probe(struct platform_device *pdev) private->ddp_comp[comp_id] = comp; } + + if (comp_type != MTK_DSI && comp_type != MTK_DPI) { + port = of_graph_get_port_by_id(node, 0); + if (!port) + continue; + ep = of_get_child_by_name(port, "endpoint"); + of_node_put(port); + if (!ep) + continue; + remote = of_graph_get_remote_port_parent(ep); + of_node_put(ep); + if (!remote) + continue; + of_id = of_match_node(mtk_ddp_comp_dt_ids, remote); + if (!of_id) + continue; + comp_type = (enum mtk_ddp_comp_type)of_id->data; + for (i = 0; i < private->data->main_len - 1; i++) + if (private->data->main_path[i] == comp_id) + private->data->main_path[i + 1] = + mtk_ddp_comp_get_id(node, comp_type); + for (i = 0; i < private->data->ext_len - 1; i++) + if (private->data->ext_path[i] == comp_id) + private->data->ext_path[i + 1] = + mtk_ddp_comp_get_id(node, comp_type); + } } if (!private->mutex_node) { diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h index ecc00ca3221d..256a3ff2e66e 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -29,9 +29,9 @@ struct drm_property; struct regmap; struct mtk_mmsys_driver_data { - const enum mtk_ddp_comp_id *main_path; + enum mtk_ddp_comp_id *main_path; unsigned int main_len; - const enum mtk_ddp_comp_id *ext_path; + enum mtk_ddp_comp_i
[PATCH v1 2/4] arm: dts: mt7623: add display subsystem related device nodes
From: Ryder Lee Add display subsystem related device nodes for MT7623. Cc: CK Hu Signed-off-by: chunhui dai Signed-off-by: Bibby Hsieh Signed-off-by: Ryder Lee additional fixes: [hdmi,dts] fixed dts-warnings author: Bibby Hsieh [dtsi] fix dpi0-node author: Ryder Lee Signed-off-by: Frank Wunderlich Tested-by: Frank Wunderlich --- arch/arm/boot/dts/mt7623.dtsi | 177 ++ arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 85 + arch/arm/boot/dts/mt7623n-rfb-emmc.dts| 85 + 3 files changed, 347 insertions(+) diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi index 59e69f3dffa2..f1880ff04193 100644 --- a/arch/arm/boot/dts/mt7623.dtsi +++ b/arch/arm/boot/dts/mt7623.dtsi @@ -23,6 +23,11 @@ #address-cells = <2>; #size-cells = <2>; + aliases { + rdma0 = &rdma0; + rdma1 = &rdma1; + }; + cpu_opp_table: opp-table { compatible = "operating-points-v2"; opp-shared; @@ -320,6 +325,25 @@ clock-names = "spi", "wrap"; }; + mipi_tx0: mipi-dphy@1001 { + compatible = "mediatek,mt7623-mipi-tx", +"mediatek,mt2701-mipi-tx"; + reg = <0 0x1001 0 0x90>; + clocks = <&clk26m>; + clock-output-names = "mipi_tx0_pll"; + #clock-cells = <0>; + #phy-cells = <0>; + }; + + cec: cec@10012000 { + compatible = "mediatek,mt7623-cec", +"mediatek,mt8173-cec"; + reg = <0 0x10012000 0 0xbc>; + interrupts = ; + clocks = <&infracfg CLK_INFRA_CEC>; + status = "disabled"; + }; + cir: cir@10013000 { compatible = "mediatek,mt7623-cir"; reg = <0 0x10013000 0 0x1000>; @@ -368,6 +392,18 @@ #clock-cells = <1>; }; + hdmi_phy: phy@10209100 { + compatible = "mediatek,mt7623-hdmi-phy", +"mediatek,mt2701-hdmi-phy"; + reg = <0 0x10209100 0 0x24>; + clocks = <&apmixedsys CLK_APMIXED_HDMI_REF>; + clock-names = "pll_ref"; + clock-output-names = "hdmitx_dig_cts"; + #clock-cells = <0>; + #phy-cells = <0>; + status = "disabled"; + }; + rng: rng@1020f000 { compatible = "mediatek,mt7623-rng"; reg = <0 0x1020f000 0 0x1000>; @@ -567,6 +603,16 @@ status = "disabled"; }; + hdmiddc0: i2c@11013000 { + compatible = "mediatek,mt7623-hdmi-ddc", +"mediatek,mt8173-hdmi-ddc"; + interrupts = ; + reg = <0 0x11013000 0 0x1C>; + clocks = <&pericfg CLK_PERI_I2C3>; + clock-names = "ddc-i2c"; + status = "disabled"; + }; + nor_flash: spi@11014000 { compatible = "mediatek,mt7623-nor", "mediatek,mt8173-nor"; @@ -741,6 +787,84 @@ #clock-cells = <1>; }; + display_components: dispsys@1400 { + compatible = "mediatek,mt7623-mmsys", +"mediatek,mt2701-mmsys"; + reg = <0 0x1400 0 0x1000>; + power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>; + }; + + ovl@14007000 { + compatible = "mediatek,mt7623-disp-ovl", +"mediatek,mt2701-disp-ovl"; + reg = <0 0x14007000 0 0x1000>; + interrupts = ; + clocks = <&mmsys CLK_MM_DISP_OVL>; + iommus = <&iommu MT2701_M4U_PORT_DISP_OVL_0>; + mediatek,larb = <&larb0>; + }; + + rdma0: rdma@14008000 { + compatible = "mediatek,mt7623-disp-rdma", +"mediatek,mt2701-disp-rdma"; + reg = <0 0x14008000 0 0x1000>; + interrupts = ; + clocks = <&mmsys CLK_MM_DISP_RDMA>; + iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA>; + mediatek,larb = <&larb0>; + }; + + wdma@14009000 { + compatible = "mediatek,mt7623-disp-wdma", +"mediatek,mt2701-disp-wd
Aw: Re: [PATCH v1 0/4] make hdmi work on bananapi-r2
Hi CK Hu, you mean the problematic patch is fix possible_crtcs (4/4) and the others are ok? can you push the first 3 while working on the last one? regards Frank
Aw: Re: Re: Re: [PATCH] pci: mediatek: fix warning in msi.h
Hi, is there any new state? kernel test robot reports the following problem (i do not see it when compiling for my arm/arm64 devices): ARCH=i386 drivers/pci/probe.c: In function 'pci_register_host_bridge': >> drivers/pci/probe.c:930:39: error: 'struct device' has no member named >> 'msi_domain'; did you mean 'pm_domain'? 930 | (bridge->msi_domain && !bus->dev.msi_domain)) and yes...msi_domain is only member of pci_host_bridge (include/linux/pci.h) why do you check for msi_domain in pci_bus->dev regards Frank
Aw: Re: [PATCH v2 2/2] thermal: mediatek: add tsensor support for V2 thermal system
Tested on bpi-r64 and r2, i hope this can be merged to next / 5.9 Tested-By: Frank Wunderlich regards Frank
Aw: Re: [PATCH v2 1/2] thermal: mediatek: prepare to add support for other platforms
Tested on bpi-r64 and r2, i hope this can be merged to next / 5.9 Tested-By: Frank Wunderlich regards Frank
Re: [PATCH 1/2] arm: dts: mt7623: move more display-related nodes to mt7623n.dtsi
Hi Am 11. August 2020 01:28:25 MESZ schrieb Chun-Kuang Hu : >Sorry I does not notice that mt7623a and mt7623n are different SoC. >Because they are different SoC, I think the first step is to upstream >mt7623a.dtsi and mt7623n.dtsi independently. That means in each dtsi, >it include all devices of its SoC. After both dtsi is upsteamed, we >could find out what is the common part, then we create a common dtsi >these two SoC, for example mt7623a_mt7623n_common.dtsi. (Maybe there >is a SoC's name is exactly 'mt7623', so I prefer mt7623.dtsi is >reserved for that SoC, and mt7623_common.dtsi is not preferred because >I don't know there are how many mt7623 family SoC and >mt7623_common.dtsi should be use for all mt7623 family) Afair there is only mt7623a and mt7623n. Mt7623a uses mt7623.dtsi as common part. These 2 soc are released 5 years ago...and only these 2 from that family). https://www.mediatek.com/news-events/press-releases/mediatek-launches-the-mt7623-and-mt7683-multi-standard-iot-gateways-with-high-speed-wlan-to-lan-to-drive-the-secure-smart-home So from my current pov the best way (to no more delay my hdmi series) is to move display related stuff in new mt7623n.dtsi and keep mt7623.dtsi as common. So we can avoid touching mt7623a.dtsi for now (can be done later if really needed). regards Frank
Aw: [PATCH 3/3] mmc: mediatek: add optional module reset property
> Gesendet: Mittwoch, 12. August 2020 um 11:37 Uhr > Von: "Wenbin Mei" > Betreff: [PATCH 3/3] mmc: mediatek: add optional module reset property > This patch adds a optional reset management for msdc. > Sometimes the bootloader does not bring msdc register > to default state, so need reset the msdc controller. > > Signed-off-by: Wenbin Mei Thanks for posting the fix to Mainline imho this should contain a fixes-Tag as it fixes eMMC-Access on mt7622/Bpi-R64 before we got these Errors on mounting eMMC ion R64: [ 48.664925] blk_update_request: I/O error, dev mmcblk0, sector 204800 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0 [ 48.676019] Buffer I/O error on dev mmcblk0p1, logical block 0, lost sync page write Fixes: 966580ad236e ("mmc: mediatek: add support for MT7622 SoC") Tested-By: Frank Wunderlich and it needs to be fixed at least for 5.4+, so adding stable-CC Cc: sta...@vger.kernel.org
Aw: [PATCH 2/3] arm64: dts: mt7622: add reset node for mmc device
> Gesendet: Mittwoch, 12. August 2020 um 11:37 Uhr > Von: "Wenbin Mei" > Betreff: [PATCH 3/3] mmc: mediatek: add optional module reset property > This patch adds a optional reset management for msdc. > Sometimes the bootloader does not bring msdc register > to default state, so need reset the msdc controller. > > Signed-off-by: Wenbin Mei Thanks for posting the fix to Mainline same as 3/3, dts-patch is also needed for fixing eMMC-Issue on R64 Fixes: 966580ad236e ("mmc: mediatek: add support for MT7622 SoC") Tested-By: Frank Wunderlich and it needs to be fixed at least for 5.4+, so adding stable-CC Cc: sta...@vger.kernel.org
Aw: [v2,3/3] mmc: mediatek: add optional module reset property
Hi, it looks like you missed Philipps comments in v1 for stable i guess you need only add Cc: Stable-line to signed-off-area (not add it to CC of mail), sorry my mistake Cc: sta...@vger.kernel.org regards Frank
Re: [PATCH 3/3] mmc: mediatek: add optional module reset property
Tested with these 2 changes below too. Am 12. August 2020 14:08:19 MESZ schrieb Philipp Zabel : >> +if (!IS_ERR(host->reset)) { >> +reset_control_assert(host->reset); >> +usleep_range(10, 50); >> +reset_control_deassert(host->reset); >> +} >> + > >This should be: > > if (host->reset) { > reset_control_assert(host->reset); > usleep_range(10, 50); > reset_control_deassert(host->reset); > } > >> +host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev, >> +"hrst"); >> +if (PTR_ERR(host->reset) == -EPROBE_DEFER) >> +return PTR_ERR(host->reset); >> + > >This should be: > > host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev, > "hrst"); > if (IS_ERR(host->reset)) > return PTR_ERR(host->reset); > >With these two changes, > >Reviewed-by: Philipp Zabel regards Frank
Re: [PATCH v2 2/5] drm/mediatek: fix boot up for 720 and 480 but 1080
Hi, Am 2. August 2020 02:08:44 MESZ schrieb Chun-Kuang Hu : >Hi, Frank: >> - disable tmds on phy on mt2701 >> - support other resolutions like 1280x1024 > >If this patch does two things, it should be broken into two patches. As far as i see,it only disable tmds and so fix specific resolutions like the the one below.some other (like 1080p) does not have this Problem. > I think every pll is default off, so you should turn on pll rather > than disable tmds Is disabling tmds wrong here? Which pll is needed here? What does tmds? I got only the Patches for testing >> without this Patch i see flickering on my TFT (1280x1024), >> so i guess clock is wrong. regards Frank
Aw: Re: [PATCH v2 1/5] drm/mediatek: config component output by device node port
> Gesendet: Sonntag, 02. August 2020 um 02:03 Uhr > Von: "Chun-Kuang Hu" > An: "Frank Wunderlich" > Cc: "Chun-Kuang Hu" , "Philipp Zabel" > , "David Airlie" , "linux-kernel" > , "DRI Development" > , "moderated list:ARM/Mediatek SoC support" > , "Daniel Vetter" , > "Matthias Brugger" , "Bibby Hsieh" > , "Linux ARM" > Betreff: Re: [PATCH v2 1/5] drm/mediatek: config component output by device > node port > > + > > + if (comp_type != MTK_DSI && comp_type != MTK_DPI) { > > + port = of_graph_get_port_by_id(node, 0); > > + if (!port) > > + continue; > > + ep = of_get_child_by_name(port, "endpoint"); > > + of_node_put(port); > > + if (!ep) > > + continue; > > + remote = of_graph_get_remote_port_parent(ep); > > + of_node_put(ep); > > + if (!remote) > > + continue; > > + of_id = of_match_node(mtk_ddp_comp_dt_ids, remote); > > + if (!of_id) > > + continue; > > + comp_type = (enum mtk_ddp_comp_type)of_id->data; > > + for (i = 0; i < private->data->main_len - 1; i++) > > + if (private->data->main_path[i] == comp_id) > > + private->data->main_path[i + 1] = > > + mtk_ddp_comp_get_id(node, > > comp_type); > > + for (i = 0; i < private->data->ext_len - 1; i++) > > + if (private->data->ext_path[i] == comp_id) > > + private->data->ext_path[i + 1] = > > + mtk_ddp_comp_get_id(node, > > comp_type); > > + } > > The port property is not defined in binding document [1], so define it > in binding document first. > > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt?h=v5.8-rc7 hi, would be the following enough for describing the ports? Port binding = some nodes like - connector (e.g. hdmi-connector) - bls (mediatek,mt7623-disp-pwm) - hdmix (mediatek,mt7623-hdmi) can have port bindings to connect each other. Each port can have only 1 endpoint more detail about ports/endpoints in ../../media/video-interfaces.txt hdmi-connector is described here: ../connector/hdmi-connector.txt example: connector { compatible = "hdmi-connector"; port { hdmi_connector_in: endpoint { remote-endpoint = <&hdmi0_out>; }; }; }; &bls { status = "okay"; port { bls_out: endpoint { remote-endpoint = <&dpi0_in>; }; }; }; &dpi0 { status = "okay"; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; dpi0_out: endpoint { remote-endpoint = <&hdmi0_in>; }; }; port@1 { reg = <1>; dpi0_in: endpoint { remote-endpoint = <&bls_out>; }; }; }; }; &hdmi0 { ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; hdmi0_in: endpoint { remote-endpoint = <&dpi0_out>; }; }; port@1 { reg = <1>; hdmi0_out: endpoint { remote-endpoint = <&hdmi_connector_in>; }; }; }; }; regards Frank
Re: [PATCH v2 4/5] drm/mediatek: dpi/dsi: change the getting possible_crtc way
Am 2. August 2020 05:07:41 MESZ schrieb Chun-Kuang Hu : >I would like more information of why do this patch. For example: > >For current mediatek dsi encoder, its possible crtc is fixed in crtc >0, and mediatek dpi encoder's possible crtc is fixed in crtc 1. In >some SoC the possible crtc is not fixed in this case, so call >mtk_drm_find_possible_crtc_by_comp() to find out the correct possible >crtc. sounds good (and you have much more knowledge about drm subsystem than i). I will take this for next version regards Frank
Aw: Re: Re: [PATCH v2 1/5] drm/mediatek: config component output by device node port
Hi > Gesendet: Montag, 03. August 2020 um 01:47 Uhr > Von: "Chun-Kuang Hu" > Now I just care about the bls to dpi. So in mediatek,disp.txt, you > just need to add a Optional properties - port (input and output), and > modify mediatek,dpi.txt for its input port. you mean something like this is enough: Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt for details. +Optional properties: +- port (input and output) see ../../media/video-interfaces.txt + Examples: Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt: Optional properties: - pinctrl-names: Contain "default" and "sleep". +- port: Input port node with endpoint definition, this can be connected to -disp-pwm Example: should i link to pwm/pwm-mtk-disp.txt in doc? regards Frank
Re: [PATCH v5 3/7] drm/mediatek: disable tmds on mt2701
Am 19. August 2020 19:12:29 MESZ schrieb Matthias Brugger : >Isn't that worth a Fixes tag? This could be https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0fc721b2968e3cadec520c60d2fc63498d865055 (add support for mt2701/mt7623). It uses existing framework which calls mtk_hdmi_phy_enable_tmds by default in mtk_hdmi_phy_power_on. Another way to fix it maybe not enabling it (use the flag in mtk_hdmi_phy_power_on) there instead of disabling after enabling it. Maybe this is less hacky than current way (as ck hu pointed in v2). regards Frank
Aw: Re: Re: Re: [PATCH v4 6/6] arm: dts: mt7623: add display subsystem related device nodes
> Gesendet: Mittwoch, 05. August 2020 um 10:36 Uhr > Von: "David Woodhouse" > > mt7623.dtsi => mt7623n.dtsi => mt7623n-bananapi-bpi-r2.dts > > mt7623.dtsi => mt7623a.dtsi => mt7623a-unielec-u7623.dts (not existing yet, > > openwrt seems to use a board-specific dtsi) > > Yes, I think we should. i want to see what MTK/DT owner says to this... my current way will be still adding the nodes to existing mt7623.dtsi (like ryder lee did it in original patch) but disabling them to not break mt7623a and splitting it afterwards. > I'll create mt7623a.dtsi and upstream the U7623 support; I think that > can happen without conflicting with anything you do. > > I note that the GPU node has been added to mt7623.dtsi in 5.8 too; > that'll want to move to the new mt7623n.dtsi that you create, along > with your other new additions. i guess mali-node also needs to be moved to mt7623n.dtsi, so my current way seems right... but it's decision of MTK/DT owner. if they make a note i squash the disabling-commit into this and post v5 regards Frank
Aw: [PATCH 2/3] arm: dts: mt7623: move MT7623N GPU to separate mt7623n.dtsi file
Hi David > Gesendet: Mittwoch, 05. August 2020 um 13:30 Uhr > Von: "David Woodhouse" > From: David Woodhouse > > The MT7623A doesn't have a GPU; add it only for MT7623N boards. > > Fixes: 1f6ed224594 ("arm: dts: mt7623: add Mali-450 device node") > Signed-off-by: David Woodhouse > diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi > index 3a6b856e5b74..dcd2f5ba4e20 100644 > --- a/arch/arm/boot/dts/mt7623.dtsi > +++ b/arch/arm/boot/dts/mt7623.dtsi > @@ -734,30 +734,6 @@ g3dsys: syscon@1300 { > #reset-cells = <1>; > }; > > - mali: gpu@1304 { > - compatible = "mediatek,mt7623-mali", "arm,mali-450"; ... > - clocks = <&topckgen CLK_TOP_MMPLL>, > - <&g3dsys CLK_G3DSYS_CORE>; > - clock-names = "bus", "core"; > - power-domains = <&scpsys MT2701_POWER_DOMAIN_MFG>; > - resets = <&g3dsys MT2701_G3DSYS_CORE_RST>; > - }; i guess you should to move g3dsys too, and maybe the mmsys which is also drm-related? I can add this to my series, but before i change my series, i need advice from MTK/DT owners whats the preferred way ;) regards Frank
[no subject]
From: Frank Wunderlich Subject: [RFC PATCH 0/2] move/add display relevant nodes to mt7623n based on series from David Woodhouse [1] i moved more display-nodes out of mt7623.dtsi to new mt7623n.dtsi and changed last part from my series [2] to add these nodes to this new dtsi [1] https://patchwork.kernel.org/project/linux-mediatek/list/?series=329209 [2] https://patchwork.kernel.org/patch/11700699/ Frank Wunderlich (1): arm: dts: mt7623: move more display-related nodes to mt7623n.dtsi Ryder Lee (1): arm: dts: mt7623: add display subsystem related device nodes arch/arm/boot/dts/mt7623.dtsi | 99 --- arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 72 + arch/arm/boot/dts/mt7623n-rfb-emmc.dts| 72 + arch/arm/boot/dts/mt7623n.dtsi| 270 ++ 4 files changed, 414 insertions(+), 99 deletions(-) -- 2.25.1
[PATCH 2/2] arm: dts: mt7623: add display subsystem related device nodes
From: Ryder Lee Add display subsystem related device nodes for MT7623. Cc: Chun-Kuang Hu Signed-off-by: chunhui dai Signed-off-by: Bibby Hsieh Signed-off-by: Ryder Lee Signed-off-by: Frank Wunderlich Tested-by: Frank Wunderlich --- changed v4->v5: add nodes to new mt7623n.dtsi to avoid conflict with mt7623a v3->v4: drop display_components which is duplicate of existing mmsys v2->v3: drop bls to dpi routing --- arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 72 arch/arm/boot/dts/mt7623n-rfb-emmc.dts| 72 arch/arm/boot/dts/mt7623n.dtsi| 171 ++ 3 files changed, 315 insertions(+) diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts index 344f8c65c4aa..f41f221e56ca 100644 --- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts +++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts @@ -21,6 +21,19 @@ chosen { stdout-path = "serial2:115200n8"; }; + connector { + compatible = "hdmi-connector"; + label = "hdmi"; + type = "d"; + ddc-i2c-bus = <&hdmiddc0>; + + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + }; + cpus { cpu@0 { proc-supply = <&mt6323_vproc_reg>; @@ -114,10 +127,18 @@ memory@8000 { }; }; +&bls { + status = "okay"; +}; + &btif { status = "okay"; }; +&cec { + status = "okay"; +}; + &cir { pinctrl-names = "default"; pinctrl-0 = <&cir_pins_a>; @@ -128,6 +149,21 @@ &crypto { status = "okay"; }; +&dpi0 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + dpi0_out: endpoint { + remote-endpoint = <&hdmi0_in>; + }; + }; + }; +}; + ð { status = "okay"; @@ -199,6 +235,42 @@ fixed-link { }; }; +&hdmi0 { + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_pins_a>; + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + hdmi0_in: endpoint { + remote-endpoint = <&dpi0_out>; + }; + }; + + port@1 { + reg = <1>; + hdmi0_out: endpoint { + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; +}; + +&hdmiddc0 { + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_ddc_pins_a>; + status = "okay"; +}; + +&hdmi_phy { + mediatek,ibias = <0xa>; + mediatek,ibias_up = <0x1c>; + status = "okay"; +}; + &i2c0 { pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; diff --git a/arch/arm/boot/dts/mt7623n-rfb-emmc.dts b/arch/arm/boot/dts/mt7623n-rfb-emmc.dts index f8efcc364bc3..1b9b9a8145a7 100644 --- a/arch/arm/boot/dts/mt7623n-rfb-emmc.dts +++ b/arch/arm/boot/dts/mt7623n-rfb-emmc.dts @@ -24,6 +24,19 @@ chosen { stdout-path = "serial2:115200n8"; }; + connector { + compatible = "hdmi-connector"; + label = "hdmi"; + type = "d"; + ddc-i2c-bus = <&hdmiddc0>; + + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + }; + cpus { cpu@0 { proc-supply = <&mt6323_vproc_reg>; @@ -106,10 +119,18 @@ sound { }; }; +&bls { + status = "okay"; +}; + &btif { status = "okay"; }; +&cec { + status = "okay"; +}; + &cir { pinctrl-names = "default"; pinctrl-0 = <&cir_pins_a>; @@ -120,6 +141,21 @@ &crypto { status = "okay"; }; +&dpi0 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + por
[PATCH 1/2] arm: dts: mt7623: move more display-related nodes to mt7623n.dtsi
From: Frank Wunderlich mt7623a has no graphics support so move nodes from generic mt7623.dtsi to mt7623n.dtsi Signed-off-by: Frank Wunderlich --- arch/arm/boot/dts/mt7623.dtsi | 99 -- arch/arm/boot/dts/mt7623n.dtsi | 99 ++ 2 files changed, 99 insertions(+), 99 deletions(-) diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi index d94f24eb7f43..d09b5671c91b 100644 --- a/arch/arm/boot/dts/mt7623.dtsi +++ b/arch/arm/boot/dts/mt7623.dtsi @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -297,17 +296,6 @@ timer: timer@10008000 { clock-names = "system-clk", "rtc-clk"; }; - smi_common: smi@1000c000 { - compatible = "mediatek,mt7623-smi-common", -"mediatek,mt2701-smi-common"; - reg = <0 0x1000c000 0 0x1000>; - clocks = <&infracfg CLK_INFRA_SMI>, -<&mmsys CLK_MM_SMI_COMMON>, -<&infracfg CLK_INFRA_SMI>; - clock-names = "apb", "smi", "async"; - power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>; - }; - pwrap: pwrap@1000d000 { compatible = "mediatek,mt7623-pwrap", "mediatek,mt2701-pwrap"; @@ -339,17 +327,6 @@ sysirq: interrupt-controller@10200100 { reg = <0 0x10200100 0 0x1c>; }; - iommu: mmsys_iommu@10205000 { - compatible = "mediatek,mt7623-m4u", -"mediatek,mt2701-m4u"; - reg = <0 0x10205000 0 0x1000>; - interrupts = ; - clocks = <&infracfg CLK_INFRA_M4U>; - clock-names = "bclk"; - mediatek,larbs = <&larb0 &larb1 &larb2>; - #iommu-cells = <1>; - }; - efuse: efuse@10206000 { compatible = "mediatek,mt7623-efuse", "mediatek,mt8173-efuse"; @@ -725,70 +702,6 @@ mmc0: mmc@1123 { status = "disabled"; }; - g3dsys: syscon@1300 { - compatible = "mediatek,mt7623-g3dsys", -"mediatek,mt2701-g3dsys", -"syscon"; - reg = <0 0x1300 0 0x200>; - #clock-cells = <1>; - #reset-cells = <1>; - }; - - mmsys: syscon@1400 { - compatible = "mediatek,mt7623-mmsys", -"mediatek,mt2701-mmsys", -"syscon"; - reg = <0 0x1400 0 0x1000>; - #clock-cells = <1>; - }; - - larb0: larb@1401 { - compatible = "mediatek,mt7623-smi-larb", -"mediatek,mt2701-smi-larb"; - reg = <0 0x1401 0 0x1000>; - mediatek,smi = <&smi_common>; - mediatek,larb-id = <0>; - clocks = <&mmsys CLK_MM_SMI_LARB0>, -<&mmsys CLK_MM_SMI_LARB0>; - clock-names = "apb", "smi"; - power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>; - }; - - imgsys: syscon@1500 { - compatible = "mediatek,mt7623-imgsys", -"mediatek,mt2701-imgsys", -"syscon"; - reg = <0 0x1500 0 0x1000>; - #clock-cells = <1>; - }; - - larb2: larb@15001000 { - compatible = "mediatek,mt7623-smi-larb", -"mediatek,mt2701-smi-larb"; - reg = <0 0x15001000 0 0x1000>; - mediatek,smi = <&smi_common>; - mediatek,larb-id = <2>; - clocks = <&imgsys CLK_IMG_SMI_COMM>, -<&imgsys CLK_IMG_SMI_COMM>; - clock-names = "apb", "smi"; - power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>; - }; - - jpegdec: jpegdec@15004000 { - compatible = "mediatek,mt7623-jpgdec", -"mediatek,mt2701-jpgdec"; - reg = <0 0x15004000 0 0x1000>; - interrupts = ; - clocks = <&imgsys CLK_IMG_JPGDEC_SMI>, - <&imgsys CLK_IMG_JPGDEC>; - clock-names = "jpgdec
[RFC PATCH 0/2] move/add display relevant nodes to mt7623n
From: Frank Wunderlich based on series from David Woodhouse [1] i moved more display-nodes out of mt7623.dtsi to new mt7623n.dtsi and changed last part from my series [2] to add these nodes to this new dtsi [1] https://patchwork.kernel.org/project/linux-mediatek/list/?series=329209 [2] https://patchwork.kernel.org/patch/11700699/ Frank Wunderlich (1): arm: dts: mt7623: move more display-related nodes to mt7623n.dtsi Ryder Lee (1): arm: dts: mt7623: add display subsystem related device nodes arch/arm/boot/dts/mt7623.dtsi | 99 --- arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 72 + arch/arm/boot/dts/mt7623n-rfb-emmc.dts| 72 + arch/arm/boot/dts/mt7623n.dtsi| 270 ++ 4 files changed, 414 insertions(+), 99 deletions(-) -- 2.25.1
Aw: [PATCH 1/2] arm: dts: mt7623: move more display-related nodes to mt7623n.dtsi
Hi, as i made a mistake in cover-letter, it is not assigned to the series. to show its content, i send it here as comment (instead of resending the whole series): based on series from David Woodhouse [1] i moved more display-nodes out of mt7623.dtsi to new mt7623n.dtsi and changed last part from my series [2] to add these nodes to this new dtsi the depency of dtsi-dtsi-dts is already done for mt7623a, so i guess it's a good way to use it for mt7623n too. this first set is an RFC if all nodes are in right order and if it is wanted to move them out as i have no technical document about mt7623a/n which describes which parts are available on both or only on one of them added MTK DRM Maintainer CK Hu, Ryder Lee and Sean Wang, maybe they can give me some advice how to proceed further here [1] https://patchwork.kernel.org/project/linux-mediatek/list/?series=329209 [2] https://patchwork.kernel.org/patch/11700699/
[PATCH] usb: xhci-mtk: Fix typo
From: Frank Wunderlich fix this small typo u3_ports_disabed => u3_ports_disabled Fixes: 55ba6e9e25a6 (usb: xhci-mtk: support option to disable usb3 ports) Signed-off-by: Frank Wunderlich --- drivers/usb/host/xhci-mtk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 4311d4c9b68d..8f321f39ab96 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -77,7 +77,7 @@ static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk) { struct mu3c_ippc_regs __iomem *ippc = mtk->ippc_regs; u32 value, check_val; - int u3_ports_disabed = 0; + int u3_ports_disabled = 0; int ret; int i; @@ -92,7 +92,7 @@ static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk) /* power on and enable u3 ports except skipped ones */ for (i = 0; i < mtk->num_u3_ports; i++) { if ((0x1 << i) & mtk->u3p_dis_msk) { - u3_ports_disabed++; + u3_ports_disabled++; continue; } @@ -117,7 +117,7 @@ static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk) check_val = STS1_SYSPLL_STABLE | STS1_REF_RST | STS1_SYS125_RST | STS1_XHCI_RST; - if (mtk->num_u3_ports > u3_ports_disabed) + if (mtk->num_u3_ports > u3_ports_disabled) check_val |= STS1_U3_MAC_RST; ret = readl_poll_timeout(&ippc->ip_pw_sts1, value, -- 2.25.1
Re: [PATCH 1/2] arm: dts: mt7623: move more display-related nodes to mt7623n.dtsi
Am 9. August 2020 02:16:59 MESZ schrieb Chun-Kuang Hu : > >I would like to put all device in mt7623.dtsi with some device's >status is "disabled" and change its status in platform dtsi. >I would like to see all device in mt7623.dtsi because of its name. If >you move some device to platform dtsi, we would trace all platform >dtsi to find out how many device in mt7623. One day a new platform >enable different devices, you would reorganize all these platform >dtsi? Ok,then i change the dts-patch from hdmi-series to disable all nodes and enabling them in bpi-r2 dts. Do they need to be in alphabetical order (or any other)? Is the tmds Patch ok? (because review missing) https://patchwork.kernel.org/patch/11700679/ Just to know before reposting series as v5 :) regards Frank
Re: [PATCH 1/2] arm: dts: mt7623: move more display-related nodes to mt7623n.dtsi
Am 10. August 2020 02:06:27 MESZ schrieb Chun-Kuang Hu : >Alphabetical order is better. In dts there is alphabetical order but not yet in dtsi...i try to fix this. >> Is the tmds Patch ok? (because review missing) >https://patchwork.kernel.org/patch/11700679/ > >That patch looks really like a hack patch. I would wait for a long >time to see whether any one has comment for this. Or you could have a >better explain for it. As i have documentation for mt7623 and there were no further comments on old series (https://patchwork.kernel.org/patch/10903303/) i guess i cannot fix this. I only know it is needed to get clear image on my 1280x1024 display with this Patch I adressed Ryder and Bibby directly maybe they can help here >I could apply other patches first. I guess i need to fix order in dtsi first...afair any hdmi node creates an serial device moved the others +1. So maybe nodes need to be added after uartx (or at least the one if i found out which). regards Frank
Re: [PATCH net-next v2 3/7] net: dsa: mt7530: Extend device data ready for adding a new hardware
Just a little typo you've inherited from existing code >+/* Setup TX circuit incluing relevant PAD and driving */ including regards Frank
Aw: [PATCH net-next v2 0/7] net-next: dsa: mt7530: add support for MT7531
Tested full series on Bananapi-R2+R64 with5.9-rc1 (iperf3 no retransmitts, Throughput >900Mbit/s) Tested-By: Frank Wunderlich maybe you can include the port_change_mtu callback you've send me? or do you want to send it separately regards Frank
[PATCH v5 1/7] dt-bindings: mediatek: add mt7623 display-nodes
From: Frank Wunderlich mt7623 uses mt2701/mt8173 for drm, but have own compatibles Signed-off-by: Frank Wunderlich Acked-by: Rob Herring Reviewed-by: Chun-Kuang Hu --- .../devicetree/bindings/display/mediatek/mediatek,disp.txt| 2 +- .../devicetree/bindings/display/mediatek/mediatek,dpi.txt | 2 +- .../devicetree/bindings/display/mediatek/mediatek,dsi.txt | 4 ++-- .../devicetree/bindings/display/mediatek/mediatek,hdmi.txt| 4 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt index b91e709db7a4..121220745d46 100644 --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt @@ -43,7 +43,7 @@ Required properties (all function blocks): "mediatek,-dpi" - DPI controller, see mediatek,dpi.txt "mediatek,-disp-mutex"- display mutex "mediatek,-disp-od" - overdrive - the supported chips are mt2701, mt2712 and mt8173. + the supported chips are mt2701, mt7623, mt2712 and mt8173. - reg: Physical base address and length of the function block register space - interrupts: The interrupt signal from the function block (required, except for merge and split function blocks). diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt index 77def4456706..dc1ebd13cc88 100644 --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt @@ -7,7 +7,7 @@ output bus. Required properties: - compatible: "mediatek,-dpi" - the supported chips are mt2701 , mt8173 and mt8183. + the supported chips are mt2701, mt7623, mt8173 and mt8183. - reg: Physical base address and length of the controller's registers - interrupts: The interrupt signal from the function block. - clocks: device clocks diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt index 8e4729de8c85..f06f24d405a5 100644 --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt @@ -7,7 +7,7 @@ channel output. Required properties: - compatible: "mediatek,-dsi" - the supported chips are mt2701, mt8173 and mt8183. +- the supported chips are mt2701, mt7623, mt8173 and mt8183. - reg: Physical base address and length of the controller's registers - interrupts: The interrupt signal from the function block. - clocks: device clocks @@ -26,7 +26,7 @@ The MIPI TX configuration module controls the MIPI D-PHY. Required properties: - compatible: "mediatek,-mipi-tx" - the supported chips are mt2701, mt8173 and mt8183. +- the supported chips are mt2701, 7623, mt8173 and mt8183. - reg: Physical base address and length of the controller's registers - clocks: PLL reference clock - clock-output-names: name of the output clock line to the DSI encoder diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,hdmi.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,hdmi.txt index 7b124242b0c5..6b1c586403e4 100644 --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,hdmi.txt +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,hdmi.txt @@ -6,6 +6,7 @@ its parallel input. Required properties: - compatible: Should be "mediatek,-hdmi". +- the supported chips are mt2701, mt7623 and mt8173 - reg: Physical base address and length of the controller's registers - interrupts: The interrupt signal from the function block. - clocks: device clocks @@ -32,6 +33,7 @@ The HDMI CEC controller handles hotplug detection and CEC communication. Required properties: - compatible: Should be "mediatek,-cec" +- the supported chips are mt7623 and mt8173 - reg: Physical base address and length of the controller's registers - interrupts: The interrupt signal from the function block. - clocks: device clock @@ -44,6 +46,7 @@ The Mediatek's I2C controller is used to interface with I2C devices. Required properties: - compatible: Should be "mediatek,-hdmi-ddc" +- the supported chips are mt7623 and mt8173 - reg: Physical base address and length of the controller's registers - clocks: device clock - clock-names: Should be "ddc-i2c". @@ -56,6 +59,7 @@ output and drives the HDMI pads. Required properties: - compatible: "mediatek,-hdmi-phy" +- the supported chips are mt2701, mt7623 and mt8173 - reg: Physical base address and length of the module's registers - clocks: PLL reference clock - clock-names: must contain "pll_ref" -- 2.25.1
[PATCH v5 2/7] drm/mediatek: add ddp routing for mt7623
From: Frank Wunderlich on BPi-R2/mt7623 main-path have to be routed to DPI0 (hdmi) instead of DSI0 using compatible "mt7623-mmsys" already defined in dts Signed-off-by: Frank Wunderlich Reviewed-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 040a8f393fe2..2350e3200b59 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -74,6 +74,19 @@ static const enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] = { DDP_COMPONENT_DPI0, }; +static const enum mtk_ddp_comp_id mt7623_mtk_ddp_main[] = { + DDP_COMPONENT_OVL0, + DDP_COMPONENT_RDMA0, + DDP_COMPONENT_COLOR0, + DDP_COMPONENT_BLS, + DDP_COMPONENT_DPI0, +}; + +static const enum mtk_ddp_comp_id mt7623_mtk_ddp_ext[] = { + DDP_COMPONENT_RDMA1, + DDP_COMPONENT_DSI0, +}; + static const enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = { DDP_COMPONENT_OVL0, DDP_COMPONENT_COLOR0, @@ -127,6 +140,14 @@ static const struct mtk_mmsys_driver_data mt2701_mmsys_driver_data = { .shadow_register = true, }; +static const struct mtk_mmsys_driver_data mt7623_mmsys_driver_data = { + .main_path = mt7623_mtk_ddp_main, + .main_len = ARRAY_SIZE(mt7623_mtk_ddp_main), + .ext_path = mt7623_mtk_ddp_ext, + .ext_len = ARRAY_SIZE(mt7623_mtk_ddp_ext), + .shadow_register = true, +}; + static const struct mtk_mmsys_driver_data mt2712_mmsys_driver_data = { .main_path = mt2712_mtk_ddp_main, .main_len = ARRAY_SIZE(mt2712_mtk_ddp_main), @@ -422,6 +443,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = { static const struct of_device_id mtk_drm_of_ids[] = { { .compatible = "mediatek,mt2701-mmsys", .data = &mt2701_mmsys_driver_data}, + { .compatible = "mediatek,mt7623-mmsys", + .data = &mt7623_mmsys_driver_data}, { .compatible = "mediatek,mt2712-mmsys", .data = &mt2712_mmsys_driver_data}, { .compatible = "mediatek,mt8173-mmsys", -- 2.25.1
[PATCH v5 4/7] drm/mediatek: Add get_possible_crtc API for dpi, dsi
From: Stu Hsieh For current mediatek dsi encoder, its possible crtc is fixed in crtc 0, and mediatek dpi encoder's possible crtc is fixed in crtc 1. In some SoC the possible crtc is not fixed in this case, so search pipeline information to find out the correct possible crtc. Signed-off-by: Stu Hsieh Signed-off-by: Frank Wunderlich Reviewed-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 42 + drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 2 + 2 files changed, 44 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c index 57c88de9a329..a5f2ff6bea93 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c @@ -13,6 +13,8 @@ #include #include #include +#include + #include "mtk_drm_drv.h" #include "mtk_drm_plane.h" #include "mtk_drm_ddp_comp.h" @@ -412,6 +414,22 @@ static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = { [DDP_COMPONENT_WDMA1] = { MTK_DISP_WDMA, 1, NULL }, }; +static bool mtk_drm_find_comp_in_ddp(struct mtk_ddp_comp ddp_comp, +const enum mtk_ddp_comp_id *path, +unsigned int path_len) +{ + unsigned int i; + + if (path == NULL) + return false; + + for (i = 0U; i < path_len; i++) + if (ddp_comp.id == path[i]) + return true; + + return false; +} + int mtk_ddp_comp_get_id(struct device_node *node, enum mtk_ddp_comp_type comp_type) { @@ -427,6 +445,30 @@ int mtk_ddp_comp_get_id(struct device_node *node, return -EINVAL; } +unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm, + struct mtk_ddp_comp ddp_comp) +{ + struct mtk_drm_private *private = drm->dev_private; + unsigned int ret; + + if (mtk_drm_find_comp_in_ddp(ddp_comp, private->data->main_path, + private->data->main_len) == true) { + ret = BIT(0); + } else if (mtk_drm_find_comp_in_ddp(ddp_comp, + private->data->ext_path, + private->data->ext_len) == true) { + ret = BIT(1); + } else if (mtk_drm_find_comp_in_ddp(ddp_comp, + private->data->third_path, + private->data->third_len) == true) { + ret = BIT(2); + } else { + DRM_INFO("Failed to find comp in ddp table\n"); + ret = 0; + } + return ret; +} + int mtk_ddp_comp_init(struct device *dev, struct device_node *node, struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id, const struct mtk_ddp_comp_funcs *funcs) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h index debe36395fe7..1d9e00b69462 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h @@ -202,6 +202,8 @@ static inline void mtk_ddp_ctm_set(struct mtk_ddp_comp *comp, int mtk_ddp_comp_get_id(struct device_node *node, enum mtk_ddp_comp_type comp_type); +unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm, + struct mtk_ddp_comp ddp_comp); int mtk_ddp_comp_init(struct device *dev, struct device_node *comp_node, struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id, const struct mtk_ddp_comp_funcs *funcs); -- 2.25.1
[PATCH v5 6/7] arm: dts: mt7623: move display nodes to separate mt7623n.dtsi
From: Frank Wunderlich mt7623a has no graphics support so move nodes from generic mt7623.dtsi to mt7623n.dtsi Fixes: 1f6ed224594 ("arm: dts: mt7623: add Mali-450 device node") Suggested-by: David Woodhouse Signed-off-by: Frank Wunderlich --- arch/arm/boot/dts/mt7623.dtsi | 123 arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 2 +- arch/arm/boot/dts/mt7623n-rfb-emmc.dts| 2 +- arch/arm/boot/dts/mt7623n.dtsi| 134 ++ 4 files changed, 136 insertions(+), 125 deletions(-) create mode 100644 arch/arm/boot/dts/mt7623n.dtsi diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi index a106c0d90a52..d09b5671c91b 100644 --- a/arch/arm/boot/dts/mt7623.dtsi +++ b/arch/arm/boot/dts/mt7623.dtsi @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -297,17 +296,6 @@ timer: timer@10008000 { clock-names = "system-clk", "rtc-clk"; }; - smi_common: smi@1000c000 { - compatible = "mediatek,mt7623-smi-common", -"mediatek,mt2701-smi-common"; - reg = <0 0x1000c000 0 0x1000>; - clocks = <&infracfg CLK_INFRA_SMI>, -<&mmsys CLK_MM_SMI_COMMON>, -<&infracfg CLK_INFRA_SMI>; - clock-names = "apb", "smi", "async"; - power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>; - }; - pwrap: pwrap@1000d000 { compatible = "mediatek,mt7623-pwrap", "mediatek,mt2701-pwrap"; @@ -339,17 +327,6 @@ sysirq: interrupt-controller@10200100 { reg = <0 0x10200100 0 0x1c>; }; - iommu: mmsys_iommu@10205000 { - compatible = "mediatek,mt7623-m4u", -"mediatek,mt2701-m4u"; - reg = <0 0x10205000 0 0x1000>; - interrupts = ; - clocks = <&infracfg CLK_INFRA_M4U>; - clock-names = "bclk"; - mediatek,larbs = <&larb0 &larb1 &larb2>; - #iommu-cells = <1>; - }; - efuse: efuse@10206000 { compatible = "mediatek,mt7623-efuse", "mediatek,mt8173-efuse"; @@ -725,94 +702,6 @@ mmc0: mmc@1123 { status = "disabled"; }; - g3dsys: syscon@1300 { - compatible = "mediatek,mt7623-g3dsys", -"mediatek,mt2701-g3dsys", -"syscon"; - reg = <0 0x1300 0 0x200>; - #clock-cells = <1>; - #reset-cells = <1>; - }; - - mali: gpu@1304 { - compatible = "mediatek,mt7623-mali", "arm,mali-450"; - reg = <0 0x1304 0 0x3>; - interrupts = , -, -, -, -, -, -, -, -, -, -; - interrupt-names = "gp", "gpmmu", "pp0", "ppmmu0", "pp1", - "ppmmu1", "pp2", "ppmmu2", "pp3", "ppmmu3", - "pp"; - clocks = <&topckgen CLK_TOP_MMPLL>, -<&g3dsys CLK_G3DSYS_CORE>; - clock-names = "bus", "core"; - power-domains = <&scpsys MT2701_POWER_DOMAIN_MFG>; - resets = <&g3dsys MT2701_G3DSYS_CORE_RST>; - }; - - mmsys: syscon@1400 { - compatible = "mediatek,mt7623-mmsys", -"mediatek,mt2701-mmsys", -"syscon"; - reg = <0 0x1400 0 0x1000>; - #clock-cells = <1>; - }; - - larb0: larb@1401 { - compatible = "mediatek,mt7623-smi-larb", -"mediatek,mt2701-smi-larb"; - reg = <0 0x1401 0 0x1000>; - mediatek,smi = <&smi_common>; - mediatek,larb-id = <0>; - clocks = <&mmsys CLK_MM_SMI_LARB0>, -<&mmsys CLK_MM_SMI_LARB0>; - clock-names = "apb", "smi"; -
[PATCH v5 0/7] make hdmi work on bananapi-r2
From: Frank Wunderlich This Patch-Series adds missing Patches/Bugfixes to get hdmi working on BPI-R2 v4->v5: - rebased on 5.9-rc1 - move existing display-related dts nodes to new mt7623n.dtsi because mt7623a does not have gpu - add new display nodes to this new dtsi v3->v4: - fix removed const in "add ddp routing for mt7623" - change subjects to "drm/mediatek:..." - add documentation for mt7623-* compatibles - dropped redundant display_components node (mmsys compatible) - add reviewd-by collected in v3 v2->v3: - use own mmsys-routing for mt7623 instead of code getting different routing from dts - remove ddp routing bls -> dpi from bpir2/rfb dts - updated some commit-Messages as suggested by CK Hu v1->v2: - using get_possible_crtc API instead of hardcoded - drop unused dts-nodes - refine commit-messages as far as i can :) "config component output by device node port" is needed to fix a WARN_ON() "fix boot up for 720 and 480 but 1080" fixes flickering, which may cause also some resolutions not working on some TFT (had some pr> Frank Wunderlich (3): dt-bindings: mediatek: add mt7623 display-nodes drm/mediatek: add ddp routing for mt7623 arm: dts: mt7623: move display nodes to separate mt7623n.dtsi Jitao Shi (1): drm/mediatek: dpi/dsi: change the getting possible_crtc way Ryder Lee (1): arm: dts: mt7623: add display subsystem related device nodes Stu Hsieh (1): drm/mediatek: Add get_possible_crtc API for dpi, dsi chunhui dai (1): drm/mediatek: disable tmds on mt2701 .../display/mediatek/mediatek,disp.txt| 2 +- .../display/mediatek/mediatek,dpi.txt | 2 +- .../display/mediatek/mediatek,dsi.txt | 4 +- .../display/mediatek/mediatek,hdmi.txt| 4 + arch/arm/boot/dts/mt7623.dtsi | 123 --- arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 74 - arch/arm/boot/dts/mt7623n-rfb-emmc.dts| 74 - arch/arm/boot/dts/mt7623n.dtsi| 305 ++ drivers/gpu/drm/mediatek/mtk_dpi.c| 3 +- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 42 +++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 2 + drivers/gpu/drm/mediatek/mtk_drm_drv.c| 23 ++ drivers/gpu/drm/mediatek/mtk_dsi.c| 3 +- drivers/gpu/drm/mediatek/mtk_hdmi_phy.c | 3 + drivers/gpu/drm/mediatek/mtk_hdmi_phy.h | 1 + .../gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c| 1 + 16 files changed, 535 insertions(+), 131 deletions(-) create mode 100644 arch/arm/boot/dts/mt7623n.dtsi -- 2.25.1
[PATCH v5 5/7] drm/mediatek: dpi/dsi: change the getting possible_crtc way
From: Jitao Shi For current mediatek dsi encoder, its possible crtc is fixed in crtc 0, and mediatek dpi encoder's possible crtc is fixed in crtc 1. In some SoC the possible crtc is not fixed in this case, so call mtk_drm_find_possible_crtc_by_comp() to find out the correct possible crtc. Signed-off-by: Jitao Shi Signed-off-by: Frank Wunderlich Reviewed-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_dpi.c | 3 ++- drivers/gpu/drm/mediatek/mtk_dsi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index d4f0fb7ad312..e43977015843 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -608,7 +608,8 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data) drm_encoder_helper_add(&dpi->encoder, &mtk_dpi_encoder_helper_funcs); /* Currently DPI0 is fixed to be driven by OVL1 */ - dpi->encoder.possible_crtcs = BIT(1); + dpi->encoder.possible_crtcs = + mtk_drm_find_possible_crtc_by_comp(drm_dev, dpi->ddp_comp); ret = drm_bridge_attach(&dpi->encoder, dpi->bridge, NULL, 0); if (ret) { diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 16fd99dcdacf..c9f4ad029cb1 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -974,7 +974,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) * Currently display data paths are statically assigned to a crtc each. * crtc 0 is OVL0 -> COLOR0 -> AAL -> OD -> RDMA0 -> UFOE -> DSI0 */ - dsi->encoder.possible_crtcs = 1; + dsi->encoder.possible_crtcs = + mtk_drm_find_possible_crtc_by_comp(drm, dsi->ddp_comp); ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); -- 2.25.1
[PATCH v5 7/7] arm: dts: mt7623: add display subsystem related device nodes
From: Ryder Lee Add display subsystem related device nodes for MT7623. Cc: Chun-Kuang Hu Signed-off-by: chunhui dai Signed-off-by: Bibby Hsieh Signed-off-by: Ryder Lee Signed-off-by: Frank Wunderlich Tested-by: Frank Wunderlich --- changed v4->v5: add nodes to new mt7623n.dtsi to avoid conflict with mt7623a v3->v4: drop display_components which is duplicate of existing mmsys v2->v3: drop bls to dpi routing --- arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 72 arch/arm/boot/dts/mt7623n-rfb-emmc.dts| 72 arch/arm/boot/dts/mt7623n.dtsi| 171 ++ 3 files changed, 315 insertions(+) diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts index 344f8c65c4aa..f41f221e56ca 100644 --- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts +++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts @@ -21,6 +21,19 @@ chosen { stdout-path = "serial2:115200n8"; }; + connector { + compatible = "hdmi-connector"; + label = "hdmi"; + type = "d"; + ddc-i2c-bus = <&hdmiddc0>; + + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + }; + cpus { cpu@0 { proc-supply = <&mt6323_vproc_reg>; @@ -114,10 +127,18 @@ memory@8000 { }; }; +&bls { + status = "okay"; +}; + &btif { status = "okay"; }; +&cec { + status = "okay"; +}; + &cir { pinctrl-names = "default"; pinctrl-0 = <&cir_pins_a>; @@ -128,6 +149,21 @@ &crypto { status = "okay"; }; +&dpi0 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + dpi0_out: endpoint { + remote-endpoint = <&hdmi0_in>; + }; + }; + }; +}; + ð { status = "okay"; @@ -199,6 +235,42 @@ fixed-link { }; }; +&hdmi0 { + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_pins_a>; + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + hdmi0_in: endpoint { + remote-endpoint = <&dpi0_out>; + }; + }; + + port@1 { + reg = <1>; + hdmi0_out: endpoint { + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; +}; + +&hdmiddc0 { + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_ddc_pins_a>; + status = "okay"; +}; + +&hdmi_phy { + mediatek,ibias = <0xa>; + mediatek,ibias_up = <0x1c>; + status = "okay"; +}; + &i2c0 { pinctrl-names = "default"; pinctrl-0 = <&i2c0_pins_a>; diff --git a/arch/arm/boot/dts/mt7623n-rfb-emmc.dts b/arch/arm/boot/dts/mt7623n-rfb-emmc.dts index f8efcc364bc3..1b9b9a8145a7 100644 --- a/arch/arm/boot/dts/mt7623n-rfb-emmc.dts +++ b/arch/arm/boot/dts/mt7623n-rfb-emmc.dts @@ -24,6 +24,19 @@ chosen { stdout-path = "serial2:115200n8"; }; + connector { + compatible = "hdmi-connector"; + label = "hdmi"; + type = "d"; + ddc-i2c-bus = <&hdmiddc0>; + + port { + hdmi_connector_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + }; + cpus { cpu@0 { proc-supply = <&mt6323_vproc_reg>; @@ -106,10 +119,18 @@ sound { }; }; +&bls { + status = "okay"; +}; + &btif { status = "okay"; }; +&cec { + status = "okay"; +}; + &cir { pinctrl-names = "default"; pinctrl-0 = <&cir_pins_a>; @@ -120,6 +141,21 @@ &crypto { status = "okay"; }; +&dpi0 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + por
[PATCH v5 3/7] drm/mediatek: disable tmds on mt2701
From: chunhui dai disable tmds on phy on mt2701 to support other resolutions like 1280x1024 Signed-off-by: chunhui dai Signed-off-by: Frank Wunderlich Tested-by: Frank Wunderlich --- drivers/gpu/drm/mediatek/mtk_hdmi_phy.c| 3 +++ drivers/gpu/drm/mediatek/mtk_hdmi_phy.h| 1 + drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c index 5223498502c4..edadb7a700f1 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c @@ -184,6 +184,9 @@ static int mtk_hdmi_phy_probe(struct platform_device *pdev) return PTR_ERR(phy_provider); } + if (hdmi_phy->conf->pll_default_off) + hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy); + return of_clk_add_provider(dev->of_node, of_clk_src_simple_get, hdmi_phy->pll); } diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h index 2d8b3182470d..f472fdeb63dc 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h @@ -22,6 +22,7 @@ struct mtk_hdmi_phy; struct mtk_hdmi_phy_conf { bool tz_disabled; unsigned long flags; + bool pll_default_off; const struct clk_ops *hdmi_phy_clk_ops; void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy); void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy); diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c index d3cc4022e988..6fbedacfc1e8 100644 --- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c +++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c @@ -239,6 +239,7 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = { .tz_disabled = true, .flags = CLK_SET_RATE_GATE, + .pll_default_off = true, .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops, .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds, -- 2.25.1
[PATCH v2] dts64: mt7622: fix slow sd card access
From: Frank Wunderlich Fix extreme slow speed (200MB takes ~20 min) on writing sdcard on bananapi-r64 by adding reset-control for mmc1 like it's done for mmc0/emmc. Cc: sta...@vger.kernel.org Fixes: 2c002a3049f7 ("arm64: dts: mt7622: add mmc related device nodes") Signed-off-by: Frank Wunderlich --- changes since v1: - drop change to uhs-mode because mt7622 does not support it --- arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi index 5b9ec032ce8d..7c6d871538a6 100644 --- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi @@ -698,6 +698,8 @@ mmc1: mmc@1124 { clocks = <&pericfg CLK_PERI_MSDC30_1_PD>, <&topckgen CLK_TOP_AXI_SEL>; clock-names = "source", "hclk"; + resets = <&pericfg MT7622_PERI_MSDC1_SW_RST>; + reset-names = "hrst"; status = "disabled"; }; -- 2.25.1
Aw: [PATCH v2 3/3] regulator: mt6323: Add OF match table
Hi > Gesendet: Samstag, 09. Januar 2021 um 12:26 Uhr > Von: matthias@kernel.org > Changes in v2: > - check for CONFIG_OF > - add Fixes tag > --- a/drivers/regulator/mt6323-regulator.c > +++ b/drivers/regulator/mt6323-regulator.c > @@ -406,9 +406,18 @@ static const struct platform_device_id > mt6323_platform_ids[] = { > }; > MODULE_DEVICE_TABLE(platform, mt6323_platform_ids); > > +#ifdef CONFIG_OF > +static const struct of_device_id mt6323_of_match[] = { > + { .compatible = "mediatek,mt6323-regulator", }, > + { /* sentinel */ }, > +}; > +MODULE_DEVICE_TABLE(of, mt6323_of_match); > +#endif > + > static struct platform_driver mt6323_regulator_driver = { > .driver = { > .name = "mt6323-regulator", > + .of_match_table = of_match_ptr(mt6323_of_match), imho check for CONFIG_OF is here needed too, else mt6323_of_match is referenced but undefined > }, > .probe = mt6323_regulator_probe, > .id_table = mt6323_platform_ids, regards Frank
[PATCH] dts64: mt7622: fix slow sd card access
From: Frank Wunderlich - change sdcard (mmc1) to uhs by change vqmmc-supply to 1V8 because driver maps pinctrl depending on this - add reset-control for mmc1 like it's done for mmc0/emmc Fixes: 2c002a3049f7 ("arm64: dts: mt7622: add mmc related device nodes") Fixes: 0b6286dd96c0 ("arm64: dts: mt7622: add bananapi BPI-R64 board") Signed-off-by: Frank Wunderlich --- arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts | 3 ++- arch/arm64/boot/dts/mediatek/mt7622.dtsi | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts index 2f77dc40b9b8..916ca89ab8eb 100644 --- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts @@ -232,10 +232,11 @@ &mmc1 { bus-width = <4>; max-frequency = <5000>; cap-sd-highspeed; + mmc-hs200-1_8v; r_smpl = <1>; cd-gpios = <&pio 81 GPIO_ACTIVE_LOW>; vmmc-supply = <®_3p3v>; - vqmmc-supply = <®_3p3v>; + vqmmc-supply = <®_1p8v>; assigned-clocks = <&topckgen CLK_TOP_MSDC30_1_SEL>; assigned-clock-parents = <&topckgen CLK_TOP_UNIV48M>; }; diff --git a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi index 5b9ec032ce8d..7c6d871538a6 100644 --- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi @@ -698,6 +698,8 @@ mmc1: mmc@1124 { clocks = <&pericfg CLK_PERI_MSDC30_1_PD>, <&topckgen CLK_TOP_AXI_SEL>; clock-names = "source", "hclk"; + resets = <&pericfg MT7622_PERI_MSDC1_SW_RST>; + reset-names = "hrst"; status = "disabled"; }; -- 2.25.1
Re: [PATCH] dts64: mt7622: fix slow sd card access
I guess issue is caused by incompatible setting in uboot,but have not found which exactly so i handled it like emmc. If patch is ready to be applied please add Cc: sta...@vger.kernel.org because all kernel versions are affected (tested at least in 5.4 and 5.9). If i need to create a v2,i will add it @sean/ryder/wenbin can you tell me if sd on mt7622/bpi-r64 is maybe capable of hs400? regards Frank
Aw: Re: [PATCH net,v2] net: dsa: mt7530: setup core clock even in TRGMII mode
Hi René,Ilya > Gesendet: Freitag, 19. März 2021 um 11:25 Uhr > Von: "René van Dorst" > Hi Ilya, > > Thanks for fixing this issue. > > I remember that Frank also had an issue with TRGMII on his MT7623 ARM board. > I never found why it did not work but this may be also fix his issue > on the MT7623 devices. > > Added Frank to CC. thanks for pointing me here. my issue was after getting trgmii working with phylink-patches (5.3) that i only got only 940Mbit over the switch/gmac0 (using multiple clients to one iperf3-server), trgmii afair supports ~2.1 Gbit/s, so nearly twice bandwidth possible in theory. this maybe can clock-related I'm not sure if it is the same issue ilya fixes here, but i try to test this on my bananapi-r2 regards Frank
[PATCH] thermal: mediatek: add sensors-support
From: Frank Wunderlich add HWMON-support to mediateks thermanl driver to allow lm-sensors userspace tools read soc temperature Signed-off-by: Frank Wunderlich --- drivers/thermal/mtk_thermal.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 149c6d7fd5a0..e22d77d57458 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -23,6 +23,8 @@ #include #include +#include "thermal_hwmon.h" + /* AUXADC Registers */ #define AUXADC_CON1_SET_V 0x008 #define AUXADC_CON1_CLR_V 0x00c @@ -983,6 +985,13 @@ static void mtk_thermal_release_periodic_ts(struct mtk_thermal *mt, writel((tmp & (~0x10e)), mt->thermal_base + TEMP_MSRCTL1); } +static void mtk_thermal_hwmon_action(void *data) +{ + struct thermal_zone_device *zone = data; + + thermal_remove_hwmon_sysfs(zone); +} + static int mtk_thermal_probe(struct platform_device *pdev) { int ret, i, ctrl_id; @@ -1087,6 +1096,19 @@ static int mtk_thermal_probe(struct platform_device *pdev) goto err_disable_clk_peri_therm; } +#ifdef CONFIG_THERMAL_HWMON + tzdev->tzp->no_hwmon = false; + ret = thermal_add_hwmon_sysfs(tzdev); + if (ret) + dev_err(&pdev->dev, "error in thermal_add_hwmon_sysfs"); + + ret = devm_add_action(&pdev->dev, mtk_thermal_hwmon_action, tzdev); + if (ret) { + dev_err(&pdev->dev, "error in devm_add_action"); + mtk_thermal_hwmon_action(tzdev); + } +#endif + return 0; err_disable_clk_peri_therm: -- 2.25.1
[PATCH 0/2] support mt7623 and ipv6
From: Frank Wunderlich Extending functionality of recently sent nftables flow offload. This Series contains 2 Patches where the second is for RFC, because i cannot test it, but it is reported by author as working and i should send it Series depend on HW offload Patches: https://patchwork.ozlabs.org/project/netfilter-devel/list/?series=233310&archive=both&state=* Frank Wunderlich (2): net: mediatek: add flow offload for mt7623 [RFC] net: ethernet: mtk_eth_soc: add ipv6 flow offload support drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 + .../net/ethernet/mediatek/mtk_ppe_offload.c | 55 +++ 2 files changed, 56 insertions(+) -- 2.25.1
[PATCH 2/2] [RFC] net: ethernet: mtk_eth_soc: add ipv6 flow offload support
From: Frank Wunderlich adding ipv6 hardware offload support patch by user graphine (https://github.com/graphine27/) http://forum.banana-pi.org/u/graphine/summary Signed-off-by: Frank Wunderlich --- .../net/ethernet/mediatek/mtk_ppe_offload.c | 55 +++ 1 file changed, 55 insertions(+) diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c index d0c46786571f..29cf0eb25a22 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -20,6 +21,11 @@ struct mtk_flow_data { __be32 src_addr; __be32 dst_addr; } v4; + + struct { + struct in6_addr src_addr; + struct in6_addr dst_addr; + } v6; }; __be16 src_port; @@ -64,6 +70,14 @@ mtk_flow_set_ipv4_addr(struct mtk_foe_entry *foe, struct mtk_flow_data *data, data->v4.dst_addr, data->dst_port); } +static int +mtk_flow_set_ipv6_addr(struct mtk_foe_entry *foe, struct mtk_flow_data *data) +{ + return mtk_foe_entry_set_ipv6_tuple(foe, + data->v6.src_addr.s6_addr32, data->src_port, + data->v6.dst_addr.s6_addr32, data->dst_port); +} + static void mtk_flow_offload_mangle_eth(const struct flow_action_entry *act, void *eth) { @@ -127,6 +141,29 @@ mtk_flow_mangle_ipv4(const struct flow_action_entry *act, return 0; } +static int +mtk_flow_mangle_ipv6(const struct flow_action_entry *act, +struct mtk_flow_data *data) +{ + __be32 *dest; + size_t offset_of_ip6_daddr = offsetof(struct ipv6hdr, daddr); + size_t offset_of_ip6_saddr = offsetof(struct ipv6hdr, saddr); + u32 idx; + + if (act->mangle.offset >= offset_of_ip6_daddr && act->mangle.offset < offset_of_ip6_daddr) { + idx = (act->mangle.offset - offset_of_ip6_saddr) / 4; + dest = &data->v6.src_addr.s6_addr32[idx]; + } else if (act->mangle.offset >= offset_of_ip6_daddr && + act->mangle.offset < offset_of_ip6_daddr + 16) { + idx = (act->mangle.offset - offset_of_ip6_daddr) / 4; + dest = &data->v6.dst_addr.s6_addr32[idx]; + } + + memcpy(dest, &act->mangle.val, sizeof(u32)); + + return 0; +} + static int mtk_flow_get_dsa_port(struct net_device **dev) { @@ -249,6 +286,9 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f) case FLOW_DISSECTOR_KEY_IPV4_ADDRS: offload_type = MTK_PPE_PKT_TYPE_IPV4_HNAPT; break; + case FLOW_DISSECTOR_KEY_IPV6_ADDRS: + offload_type = MTK_PPE_PKT_TYPE_IPV6_ROUTE_5T; + break; default: return -EOPNOTSUPP; } @@ -284,6 +324,18 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f) mtk_flow_set_ipv4_addr(&foe, &data, false); } + + if (addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) { + struct flow_match_ipv6_addrs addrs; + + flow_rule_match_ipv6_addrs(rule, &addrs); + + data.v6.src_addr = addrs.key->src; + data.v6.dst_addr = addrs.key->dst; + + mtk_flow_set_ipv6_addr(&foe, &data); + } + flow_action_for_each(i, act, &rule->action) { if (act->id != FLOW_ACTION_MANGLE) continue; @@ -296,6 +348,9 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f) case FLOW_ACT_MANGLE_HDR_TYPE_IP4: err = mtk_flow_mangle_ipv4(act, &data); break; + case FLOW_ACT_MANGLE_HDR_TYPE_IP6: + err = mtk_flow_mangle_ipv6(act, &data); + break; case FLOW_ACT_MANGLE_HDR_TYPE_ETH: /* handled earlier */ break; -- 2.25.1
[PATCH 1/2] net: mediatek: add flow offload for mt7623
From: Frank Wunderlich mt7623 uses offload version 2 too tested on Bananapi-R2 Signed-off-by: Frank Wunderlich --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 0396f0db855f..810def064f11 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -3202,6 +3202,7 @@ static const struct mtk_soc_data mt7623_data = { .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, + .offload_version = 2, }; static const struct mtk_soc_data mt7629_data = { -- 2.25.1
Aw: [PATCH] net: wireguard: fix error with icmp{,v6}_ndo_send in 5.4
Hi, sorry, please ignore this wireguard was included with 5.6, my 5.4 uses external wireguard regards Frank
Re: [PATCH net-next] net: ethernet: mediatek: fix typo in offload code
Am 15. April 2021 11:40:05 MESZ schrieb DENG Qingfang : >.key_offset was assigned to .head_offset instead. Fix the typo. > >Fixes: 502e84e2382d ("net: ethernet: mtk_eth_soc: add flow offloading >support") >Signed-off-by: DENG Qingfang Thanks for posting the fix,but imho commit-message is not good. Issue were traffic problems after a while with increased ping times if flow offload is active. It turns out that key_offset with cookie is needed in rhashtable_params and head_offset was defined twice. regards Frank
Re: [PATCH RFC net-next 1/3] net: dsa: allow for multiple CPU ports
Am 12. April 2021 17:30:58 MESZ schrieb DENG Qingfang : >So we somehow configured default CPU port in dts (by port name). In >my opinion we can just add a default CPU property in dts to specify >it (like Frank Wunderlich did earlier), and fall back to round-robin >if the property is not present, while still allow users to change it >in userspace. My series was an up ported version of Patches (linux 4.9) afair from Felix. The dts-version was 1 reason why it was rejected, because DT describes hardware and not software preferences. regards Frank
Re: [PATCH v2 net-next] net: ethernet: mediatek: fix a typo bug in flow offloading
Tested on Bananapi-r2 (please see my mt7623 patch for supporting offloading) with ~300 iperf3 iterations and uptime >6h Tested-by: Frank Wunderlich regards Frank
Aw: [PATCH] thermal: mediatek: add sensors-support
Hi, any opinion (except typo)? thermanl => thermal regards Frank > Gesendet: Samstag, 20. März 2021 um 10:06 Uhr > Von: "Frank Wunderlich" > add HWMON-support to mediateks thermanl driver to allow lm-sensors > userspace tools read soc temperature
Aw: [PATCH 09/13] PCI: mediatek: Advertise lack of MSI handling
tested full series on bananapi-r2 and r64 r2 (with mt7615) looks good. on r64 (with atheros card WLE900VX) i see this while loading ath10k driver: [6.525981] ath10k_pci :01:00.0: enabling device ( -> 0002) [6.537810] ath10k_pci :01:00.0: enabling bus mastering [6.543831] Unable to handle kernel paging request at virtual address ff4 013be2a80 [6.551890] Mem abort info: [6.554744] ESR = 0x9644 [6.557870] EC = 0x25: DABT (current EL), IL = 32 bits [6.563267] SET = 0, FnV = 0 [6.566396] EA = 0, S1PTW = 0 [6.569611] Data abort info: [6.572501] ISV = 0, ISS = 0x0044 [6.576411] CM = 0, WnR = 1 [6.579450] [ff4013be2a80] address between user and kernel address ranges [6.586659] Internal error: Oops: 9644 [#1] PREEMPT SMP [6.592248] Modules linked in: ath10k_pci(+) ath10k_core ath mac80211 libarc4 btmtkuart cfg80211 bluetooth ecdh_generic ecc rfkill libaes ip_tables x_tables [6.606329] CPU: 1 PID: 114 Comm: systemd-udevd Not tainted 5.11.0-bpi-r64-pc i #3 [6.613819] Hardware name: Bananapi BPI-R64 (DT) [6.618439] pstate: 8005 (Nzcv daif -PAN -UAO -TCO BTYPE=--) [6.624452] pc : queued_spin_lock_slowpath+0x1e8/0x31c [6.629608] lr : queued_spin_lock_slowpath+0xac/0x31c [6.634666] sp : ffc010f63550 [6.637982] x29: ffc010f63550 x28: fc7e [6.643306] x27: ffc010c67410 x26: 0008 [6.648629] x25: ffc010c67880 x24: ffc010f63810 [6.653950] x23: x22: ffc010ba8860 [6.659270] x21: ff803fdcc540 x20: ffc010a1c540 [6.664591] x19: ff80016a1708 x18: [6.669914] x17: x16: [6.675236] x15: 000a x14: 0092 [6.680560] x13: ff8006671004 x12: [6.685883] x11: 0101010101010101 x10: ff8001635568 [6.691206] x9 : 0008 x8 : ff8001635560 [6.696529] x7 : x6 : ff803fdcc540 [6.701849] x5 : 0002 x4 : 0008 [6.707170] x3 : ff80016a170a x2 : 016a [6.712493] x1 : ff80031c6520 x0 : ffc010a1c560 [6.717818] Call trace: [6.720276] queued_spin_lock_slowpath+0x1e8/0x31c [6.725086] do_raw_spin_lock+0x2c/0x38 [6.728931] _raw_spin_lock+0x24/0x34 [6.732606] __mutex_lock.isra.0+0xc4/0x29c [6.736799] __mutex_lock_slowpath+0x14/0x20 [6.741078] mutex_lock+0x28/0x34 [6.744402] mtk_pcie_irq_domain_alloc+0x3c/0xd0 [6.749037] irq_domain_alloc_irqs_hierarchy+0x50/0x54 [6.754187] irq_domain_alloc_irqs_parent+0x18/0x2c [6.759073] msi_domain_alloc+0x8c/0x12c [6.763007] irq_domain_alloc_irqs_hierarchy+0x50/0x54 [6.768154] __irq_domain_alloc_irqs+0x114/0x344 [6.772780] __msi_domain_alloc_irqs+0x110/0x318 [6.777408] msi_domain_alloc_irqs+0x1c/0x28 [6.781685] pci_msi_setup_msi_irqs.isra.0+0x2c/0x44 [6.786662] __pci_enable_msi_range+0x230/0x320 [6.791202] pci_enable_msi+0x1c/0x30 [6.794874] ath10k_pci_probe+0x480/0x748 [ath10k_pci] [6.800058] pci_device_probe+0xbc/0x14c [6.804014] really_probe+0x2a0/0x470 [6.807701] driver_probe_device+0x12c/0x13c [6.811981] device_driver_attach+0x44/0x70 [6.816181] __driver_attach+0x13c/0x140 [6.820126] bus_for_each_dev+0x70/0xc0 [6.823971] driver_attach+0x24/0x30 [6.827556] bus_add_driver+0x1a4/0x1ec [6.831401] driver_register+0xb4/0xec [6.835168] __pci_register_driver+0x44/0x50 [6.839465] ath10k_pci_init+0x28/0x1000 [ath10k_pci] [6.844563] do_one_initcall+0x6c/0x188 [6.848431] do_init_module+0x5c/0x1e8 [6.852205] load_module+0x1124/0x11c8 [6.855967] __do_sys_finit_module+0xdc/0x100 [6.860335] __arm64_sys_finit_module+0x1c/0x28 [6.864877] el0_svc_common.constprop.0+0x124/0x198 [6.869766] do_el0_svc+0x48/0x78 [6.873089] el0_svc+0x14/0x20 [6.876158] el0_sync_handler+0xcc/0x154 [6.880091] el0_sync+0x174/0x180 [6.883425] Code: d37c0400 51000421 8b000280 f861dac1 (f8216806) [6.889525] ---[ end trace 62498e1f489ea3ab ]--- i guess it's a bug in ath10k driver or my r64 board (it is a v1.1 which has missing capacitors on tx lines). Tried with an mt7612e, this seems to work without any errors. so for mt7622/mt7623 Tested-by: Frank Wunderlich regards Frank
Aw: Re: [PATCH 09/13] PCI: mediatek: Advertise lack of MSI handling
regards Frank > Gesendet: Montag, 01. März 2021 um 12:49 Uhr > Von: "Marc Zyngier" > Frank, > > On 2021-03-01 10:43, Frank Wunderlich wrote: > > tested full series on bananapi-r2 and r64 > > > > r2 (with mt7615) looks good. > > > > on r64 (with atheros card WLE900VX) i see this while loading ath10k > > driver: > > > > [6.525981] ath10k_pci :01:00.0: enabling device ( -> 0002) > > [6.537810] ath10k_pci :01:00.0: enabling bus mastering > > [6.543831] Unable to handle kernel paging request at virtual > > address ff4 > > 013be2a80 > > [6.551890] Mem abort info: > > [6.554744] ESR = 0x9644 > > [6.557870] EC = 0x25: DABT (current EL), IL = 32 bits > > [6.563267] SET = 0, FnV = 0 > > [6.566396] EA = 0, S1PTW = 0 > > [6.569611] Data abort info: > > [6.572501] ISV = 0, ISS = 0x0044 > > [6.576411] CM = 0, WnR = 1 > > [6.579450] [ff4013be2a80] address between user and kernel > > address ranges > > [6.586659] Internal error: Oops: 9644 [#1] PREEMPT SMP > > [6.592248] Modules linked in: ath10k_pci(+) ath10k_core ath > > mac80211 libarc4 > > btmtkuart cfg80211 bluetooth ecdh_generic ecc rfkill libaes ip_tables > > x_tables > > [6.606329] CPU: 1 PID: 114 Comm: systemd-udevd Not tainted > > 5.11.0-bpi-r64-pc > > i #3 > > [6.613819] Hardware name: Bananapi BPI-R64 (DT) > > [6.618439] pstate: 8005 (Nzcv daif -PAN -UAO -TCO BTYPE=--) > > [6.624452] pc : queued_spin_lock_slowpath+0x1e8/0x31c > > [6.629608] lr : queued_spin_lock_slowpath+0xac/0x31c > > [6.634666] sp : ffc010f63550 > > [6.637982] x29: ffc010f63550 x28: fc7e > > [6.643306] x27: ffc010c67410 x26: 0008 > > [6.648629] x25: ffc010c67880 x24: ffc010f63810 > > [6.653950] x23: x22: ffc010ba8860 > > [6.659270] x21: ff803fdcc540 x20: ffc010a1c540 > > [6.664591] x19: ff80016a1708 x18: > > [6.669914] x17: x16: > > [6.675236] x15: 000a x14: 0092 > > [6.680560] x13: ff8006671004 x12: > > [6.685883] x11: 0101010101010101 x10: ff8001635568 > > [6.691206] x9 : 0008 x8 : ff8001635560 > > [6.696529] x7 : x6 : ff803fdcc540 > > [6.701849] x5 : 0002 x4 : 0008 > > [6.707170] x3 : ff80016a170a x2 : 016a > > [6.712493] x1 : ff80031c6520 x0 : ffc010a1c560 > > [6.717818] Call trace: > > [6.720276] queued_spin_lock_slowpath+0x1e8/0x31c > > [6.725086] do_raw_spin_lock+0x2c/0x38 > > [6.728931] _raw_spin_lock+0x24/0x34 > > [6.732606] __mutex_lock.isra.0+0xc4/0x29c > > [6.736799] __mutex_lock_slowpath+0x14/0x20 > > [6.741078] mutex_lock+0x28/0x34 > > [6.744402] mtk_pcie_irq_domain_alloc+0x3c/0xd0 > > [6.749037] irq_domain_alloc_irqs_hierarchy+0x50/0x54 > > [6.754187] irq_domain_alloc_irqs_parent+0x18/0x2c > > [6.759073] msi_domain_alloc+0x8c/0x12c > > [6.763007] irq_domain_alloc_irqs_hierarchy+0x50/0x54 > > [6.768154] __irq_domain_alloc_irqs+0x114/0x344 > > [6.772780] __msi_domain_alloc_irqs+0x110/0x318 > > [6.777408] msi_domain_alloc_irqs+0x1c/0x28 > > [6.781685] pci_msi_setup_msi_irqs.isra.0+0x2c/0x44 > > [6.786662] __pci_enable_msi_range+0x230/0x320 > > [6.791202] pci_enable_msi+0x1c/0x30 > > [6.794874] ath10k_pci_probe+0x480/0x748 [ath10k_pci] > > [6.800058] pci_device_probe+0xbc/0x14c > > [6.804014] really_probe+0x2a0/0x470 > > [6.807701] driver_probe_device+0x12c/0x13c > > [6.811981] device_driver_attach+0x44/0x70 > > [6.816181] __driver_attach+0x13c/0x140 > > [6.820126] bus_for_each_dev+0x70/0xc0 > > [6.823971] driver_attach+0x24/0x30 > > [6.827556] bus_add_driver+0x1a4/0x1ec > > [6.831401] driver_register+0xb4/0xec > > [6.835168] __pci_register_driver+0x44/0x50 > > [6.839465] ath10k_pci_init+0x28/0x1000 [ath10k_pci] > > [6.844563] do_one_initcall+0x6c/0x188 > > [6.848431] do_init_module+0x5c/0x1e8 > > [6.852205] load_module+0x1124/0x11c8 > > [6.855967] __do_sys_finit_module+0xdc/0x100 > > [6.860335] __arm64_sys_finit_module+0x1c/0x28 > > [6.864877] el0_svc_common.constprop.0+0x124/0x198 > > [6.869766] do_e
Aw: Re: Re: [PATCH 09/13] PCI: mediatek: Advertise lack of MSI handling
> Gesendet: Montag, 01. März 2021 um 14:31 Uhr > Von: "Marc Zyngier" > > Frank, > > >> > i guess it's a bug in ath10k driver or my r64 board (it is a v1.1 > >> > which has missing capacitors on tx lines). > >> > >> No, this definitely looks like a bug in the MTK PCIe driver, > >> where the mutex is either not properly initialised, corrupted, > >> or the wrong pointer is passed. > > > > but why does it happen only with the ath10k-card and not the mt7612 in > > same slot? > > Does mt7612 use MSI? What we have here is a bogus mutex in the > MTK PCIe driver, and the only way not to get there would be > to avoid using MSIs. i guess this card/its driver does not use MSI. Did not found anything in "datasheet" [1] or driver [2] about msi > > > >> This r64 machine is supposed to have working MSIs, right? > > > > imho mt7622 have working MSI > > > >> Do you get the same issue without this series? > > > > tested 5.11.0 [1] without this series (but with your/thomas' patch > > from discussion about my old patch) and got same trace. so this series > > does not break anything here. > > Can you retest without any additional patch on top of 5.11? > These two patches only affect platforms that do *not* have MSIs at all. i can revert these 2, but still need patches for mt7622 pcie-support [3]...btw. i see that i miss these in 5.11-main...do not see traceback with them (have firmware not installed...) root@bpi-r64:~# dmesg | grep ath [6.450765] ath10k_pci :01:00.0: assign IRQ: got 146 [6.661752] ath10k_pci :01:00.0: enabling device ( -> 0002) [6.697811] ath10k_pci :01:00.0: enabling bus mastering [6.721293] ath10k_pci :01:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 r eset_mode 0 [6.921030] ath10k_pci :01:00.0: Failed to find firmware-N.bin (N between 2 and 6) from ath10k/QCA988X/hw2.0: -2 [6.931698] ath10k_pci :01:00.0: could not fetch firmware files (-2) [6.940417] ath10k_pci :01:00.0: could not probe fw (-2) so traceback was caused by missing changes in mtk pcie-driver not yet upstream, added Chuanjia Liu > > > >> > Tried with an mt7612e, this seems to work without any errors. > >> > > >> > so for mt7622/mt7623 > >> > > >> > Tested-by: Frank Wunderlich > >> > >> We definitely need to understand the above. > > > > there is a hardware-bug which may cause this...afair i saw this with > > the card in r64 with earlier Kernel-versions where other cards work > > (like the mt7612e). > > I don't think a HW bug affecting PCI would cause what we are seeing > here, unless it results in memory corruption. [1] https://www.asiarf.com/shop/wifi-wlan/wifi_mini_pcie/ws2433-wifi-11ac-mini-pcie-module-manufacturer/ [2] grep -Rni 'msi' drivers/net/wireless/mediatek/mt76/mt76x2/ [3] https://patchwork.kernel.org/project/linux-mediatek/list/?series=372885
[PATCH] net: wireguard: fix error with icmp{,v6}_ndo_send in 5.4
From: Frank Wunderlich commit 2019554f9656 introduces implementation of icmp{,v6}_ndo_send in include/linux/icmp{,v6}.h in case of NF_NAT is enabled. Now these functions are defined twice in wireguard. Fix this by hiding code if NF_NAT is set (reverse condition as in icmp*.h) ././net/wireguard/compat/compat.h:959:20: error: static declaration of 'icmp_ndo_send' follows non-static declaration 959 | static inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info) ./include/net/icmp.h:47:6: note: previous declaration of 'icmp_ndo_send' was here 47 | void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info); ././net/wireguard/compat/compat.h:988:20: error: static declaration of 'icmpv6_ndo_send' follows non-static declaration 988 | static inline void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info) ./include/linux/icmpv6.h:56:6: note: previous declaration of 'icmpv6_ndo_send' was here 56 | void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info); Fixes: 2019554f9656 ("icmp: introduce helper for nat'd source address in network device context") Signed-off-by: Frank Wunderlich --- net/wireguard/compat/compat.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/wireguard/compat/compat.h b/net/wireguard/compat/compat.h index 42f7beecaa5c..7cdb0b253c60 100644 --- a/net/wireguard/compat/compat.h +++ b/net/wireguard/compat/compat.h @@ -956,6 +956,7 @@ static inline int skb_ensure_writable(struct sk_buff *skb, int write_len) #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) #include #endif +#if !IS_ENABLED(CONFIG_NF_NAT) static inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info) { struct sk_buff *cloned_skb = NULL; @@ -1014,6 +1015,7 @@ static inline void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u out: consume_skb(cloned_skb); } +#endif #else #define icmp_ndo_send icmp_send #define icmpv6_ndo_send icmpv6_send -- 2.25.1
Aw: Re: Re: Re: [PATCH] pci: mediatek: fix warning in msi.h
Hi, 5.11-rc1 is also affected, here is the relevant part of trace from my bananapi-r2: [5.792659] mtk-pcie 1a14.pcie: PCI host bridge to bus :00 [5.798879] pci_bus :00: root bus resource [bus 00-ff] [5.804412] pci_bus :00: root bus resource [io 0x-0x] (bus address [0x1a16-0x1a16]) [5.813928] pci_bus :00: root bus resource [mem 0x6000-0x6fff] [5.820876] pci :00:00.0: [14c3:0801] type 01 class 0x060400 [5.826915] pci :00:00.0: reg 0x14: [mem 0x-0x] [5.833294] pci :00:00.0: supports D1 [5.837315] pci :00:00.0: PME# supported from D0 D1 D3hot [5.843550] pci :00:01.0: [14c3:0801] type 01 class 0x060400 [5.849598] pci :00:01.0: reg 0x14: [mem 0x-0x] [5.855995] pci :00:01.0: supports D1 [5.860016] pci :00:01.0: PME# supported from D0 D1 D3hot [5.868688] PCI: bus0: Fast back to back transfers disabled [5.874325] pci :00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring [5.882392] pci :00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring [5.890648] pci :01:00.0: [14c3:7615] type 00 class 0x000280 [5.896700] pci :01:00.0: reg 0x10: [mem 0x-0x000f 64bit] [5.933326] PCI: bus1: Fast back to back transfers disabled [5.938930] pci_bus :01: busn_res: [bus 01-ff] end is updated to 01 [5.945814] pci :02:00.0: [1b21:0611] type 00 class 0x010185 [5.951889] pci :02:00.0: reg 0x10: initial BAR value 0x invalid [5.958949] pci :02:00.0: reg 0x10: [io size 0x0008] [5.964382] pci :02:00.0: reg 0x14: initial BAR value 0x invalid [5.971454] pci :02:00.0: reg 0x14: [io size 0x0004] [5.976869] pci :02:00.0: reg 0x18: initial BAR value 0x invalid [5.983938] pci :02:00.0: reg 0x18: [io size 0x0008] [5.989352] pci :02:00.0: reg 0x1c: initial BAR value 0x invalid [5.996424] pci :02:00.0: reg 0x1c: [io size 0x0004] [6.001854] pci :02:00.0: reg 0x20: initial BAR value 0x invalid [6.008910] pci :02:00.0: reg 0x20: [io size 0x0010] [6.014337] pci :02:00.0: reg 0x24: [mem 0x-0x01ff] [6.020635] pci :02:00.0: reg 0x30: [mem 0x-0x pref] [6.053312] PCI: bus2: Fast back to back transfers disabled [6.058912] pci_bus :02: busn_res: [bus 02-ff] end is updated to 02 [6.065622] pci :00:00.0: BAR 8: assigned [mem 0x6000-0x600f] [6.072448] pci :00:01.0: BAR 8: assigned [mem 0x6010-0x601f] [6.079248] pci :00:01.0: BAR 9: assigned [mem 0x6020-0x602f pref] [6.086500] pci :00:00.0: BAR 1: assigned [mem 0x6030-0x6030] [6.093318] pci :00:01.0: BAR 1: assigned [mem 0x6031-0x6031] [6.100120] pci :00:01.0: BAR 7: assigned [io 0x1000-0x1fff] [6.106255] pci :01:00.0: BAR 0: assigned [mem 0x6000-0x600f 64bit] [6.113609] pci :00:00.0: PCI bridge to [bus 01] [6.118585] pci :00:00.0: bridge window [mem 0x6000-0x600f] [6.125405] pci :02:00.0: BAR 6: assigned [mem 0x6020-0x6020 pref] [6.132656] pci :02:00.0: BAR 5: assigned [mem 0x6010-0x601001ff] [6.139458] pci :02:00.0: BAR 4: assigned [io 0x1000-0x100f] [6.145579] pci :02:00.0: BAR 0: assigned [io 0x1010-0x1017] [6.151699] pci :02:00.0: BAR 2: assigned [io 0x1018-0x101f] [6.157807] pci :02:00.0: BAR 1: assigned [io 0x1020-0x1023] [6.163927] pci :02:00.0: BAR 3: assigned [io 0x1024-0x1027] [6.170034] pci :00:01.0: PCI bridge to [bus 02] [6.175035] pci :00:01.0: bridge window [io 0x1000-0x1fff] [6.181153] pci :00:01.0: bridge window [mem 0x6010-0x601f] [6.187951] pci :00:01.0: bridge window [mem 0x6020-0x602f pref] [6.195427] pcieport :00:00.0: enabling device (0140 -> 0142) [6.201795] pcieport :00:00.0: PME: Signaling with IRQ 258 [6.208053] pcieport :00:01.0: enabling device (0140 -> 0143) [6.214395] pcieport :00:01.0: PME: Signaling with IRQ 252 [6.220784] ahci :02:00.0: version 3.0 [6.220814] ahci :02:00.0: enabling device (0140 -> 0143) [6.226705] [ cut here ] [6.231380] WARNING: CPU: 0 PID: 33 at include/linux/msi.h:252 pci_msi_setup_msi_irqs.constprop.0+0x78/0x80 [6.241167] Modules linked in: [6.244235] CPU: 0 PID: 33 Comm: kworker/0:1 Not tainted 5.11.0-rc1-bpi-r2-wifi #1 [6.251816] Hardware name: Mediatek Cortex-A7 (Device Tree) [6.257395] Workqueue: events deferred_probe_work_func [6.262549] Backtrace: [6.264999] [] (dump_backtrace) from [] (show_stack+0x20/0x24) [6.272598] r7:00fc r6:6013 r5: r4:c15eff8c [6.278258] [] (show_stack) from [] (dump_stack+0xcc/0xe0) [6.285499] [] (dump_stack)
Aw: Re: Re: Re: [PATCH] pci: mediatek: fix warning in msi.h
Hi, any new state here? last fix works, but i have not seen it approved by anyone for merge or sent as separate Patch regards Frank
Re: [PATCH v6 00/13] implement poweroff for mt6323 / bpi-r2
Hi, Just a friedly reminder. MFD-part was applied and visible in linux-next, the other parts acknowledged by maintainers. Is anything additional needed before applying the rtc/power/dts-parts? Regards Frank
[PATCH v7 3/7] rtc: mt6397: improvements of rtc driver
From: Josef Friedl - use regmap_read_poll_timeout to drop while-loop - use devm-api to drop remove-callback Suggested-by: Alexandre Belloni Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich Acked-by: Alexandre Belloni --- changes since v6: none changes since v5: none changes since v4: none changes since v3: none changes since v2: - fix allocation after irq-request - compatible for mt6323 in separate commit => part 5 --- drivers/rtc/rtc-mt6397.c | 51 +++- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index c08ee5edf865..9370b7fc9f81 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -4,16 +4,19 @@ * Author: Tianping.Fang */ -#include -#include +#include +#include +#include #include +#include +#include #include #include #include +#include static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) { - unsigned long timeout = jiffies + HZ; int ret; u32 data; @@ -21,19 +24,13 @@ static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) if (ret < 0) return ret; - while (1) { - ret = regmap_read(rtc->regmap, rtc->addr_base + RTC_BBPU, - &data); - if (ret < 0) - break; - if (!(data & RTC_BBPU_CBUSY)) - break; - if (time_after(jiffies, timeout)) { - ret = -ETIMEDOUT; - break; - } - cpu_relax(); - } + ret = regmap_read_poll_timeout(rtc->regmap, + rtc->addr_base + RTC_BBPU, data, + !(data & RTC_BBPU_CBUSY), + MTK_RTC_POLL_DELAY_US, + MTK_RTC_POLL_TIMEOUT); + if (ret < 0) + dev_err(rtc->dev, "failed to write WRTGE: %d\n", ret); return ret; } @@ -266,19 +263,19 @@ static int mtk_rtc_probe(struct platform_device *pdev) return rtc->irq; rtc->regmap = mt6397_chip->regmap; - rtc->dev = &pdev->dev; mutex_init(&rtc->lock); platform_set_drvdata(pdev, rtc); - rtc->rtc_dev = devm_rtc_allocate_device(rtc->dev); + rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev); if (IS_ERR(rtc->rtc_dev)) return PTR_ERR(rtc->rtc_dev); - ret = request_threaded_irq(rtc->irq, NULL, - mtk_rtc_irq_handler_thread, - IRQF_ONESHOT | IRQF_TRIGGER_HIGH, - "mt6397-rtc", rtc); + ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, + mtk_rtc_irq_handler_thread, + IRQF_ONESHOT | IRQF_TRIGGER_HIGH, + "mt6397-rtc", rtc); + if (ret) { dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", rtc->irq, ret); @@ -302,15 +299,6 @@ static int mtk_rtc_probe(struct platform_device *pdev) return ret; } -static int mtk_rtc_remove(struct platform_device *pdev) -{ - struct mt6397_rtc *rtc = platform_get_drvdata(pdev); - - free_irq(rtc->irq, rtc); - - return 0; -} - #ifdef CONFIG_PM_SLEEP static int mt6397_rtc_suspend(struct device *dev) { @@ -349,7 +337,6 @@ static struct platform_driver mtk_rtc_driver = { .pm = &mt6397_pm_ops, }, .probe = mtk_rtc_probe, - .remove = mtk_rtc_remove, }; module_platform_driver(mtk_rtc_driver); -- 2.17.1
[PATCH v7 2/7] rtc: mt6397: move some common definitions into rtc.h
From: Josef Friedl move code to separate header-file to reuse definitions later in poweroff-driver (drivers/power/reset/mt6323-poweroff.c) Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich Acked-by: Alexandre Belloni Acked-for-MFD-by: Lee Jones --- changes since v6: updated copyright changes since v5: none changes since v4: none changes since v3: none changes since v2: add missing commit-message --- drivers/rtc/rtc-mt6397.c | 55 +- include/linux/mfd/mt6397/rtc.h | 71 ++ 2 files changed, 72 insertions(+), 54 deletions(-) create mode 100644 include/linux/mfd/mt6397/rtc.h diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index b46ed4dc7015..c08ee5edf865 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -9,60 +9,7 @@ #include #include #include -#include -#include -#include -#include -#include -#include - -#define RTC_BBPU 0x -#define RTC_BBPU_CBUSY BIT(6) - -#define RTC_WRTGR 0x003c - -#define RTC_IRQ_STA0x0002 -#define RTC_IRQ_STA_AL BIT(0) -#define RTC_IRQ_STA_LP BIT(3) - -#define RTC_IRQ_EN 0x0004 -#define RTC_IRQ_EN_AL BIT(0) -#define RTC_IRQ_EN_ONESHOT BIT(2) -#define RTC_IRQ_EN_LP BIT(3) -#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) - -#define RTC_AL_MASK0x0008 -#define RTC_AL_MASK_DOWBIT(4) - -#define RTC_TC_SEC 0x000a -/* Min, Hour, Dom... register offset to RTC_TC_SEC */ -#define RTC_OFFSET_SEC 0 -#define RTC_OFFSET_MIN 1 -#define RTC_OFFSET_HOUR2 -#define RTC_OFFSET_DOM 3 -#define RTC_OFFSET_DOW 4 -#define RTC_OFFSET_MTH 5 -#define RTC_OFFSET_YEAR6 -#define RTC_OFFSET_COUNT 7 - -#define RTC_AL_SEC 0x0018 - -#define RTC_PDN2 0x002e -#define RTC_PDN2_PWRON_ALARM BIT(4) - -#define RTC_MIN_YEAR 1968 -#define RTC_BASE_YEAR 1900 -#define RTC_NUM_YEARS 128 -#define RTC_MIN_YEAR_OFFSET(RTC_MIN_YEAR - RTC_BASE_YEAR) - -struct mt6397_rtc { - struct device *dev; - struct rtc_device *rtc_dev; - struct mutexlock; - struct regmap *regmap; - int irq; - u32 addr_base; -}; +#include static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) { diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h new file mode 100644 index ..f84b9163c0ee --- /dev/null +++ b/include/linux/mfd/mt6397/rtc.h @@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2014-2019 MediaTek Inc. + * + * Author: Tianping.Fang + *Sean Wang + */ + +#ifndef _LINUX_MFD_MT6397_RTC_H_ +#define _LINUX_MFD_MT6397_RTC_H_ + +#include +#include +#include +#include + +#define RTC_BBPU 0x +#define RTC_BBPU_CBUSY BIT(6) +#define RTC_BBPU_KEY(0x43 << 8) + +#define RTC_WRTGR 0x003c + +#define RTC_IRQ_STA0x0002 +#define RTC_IRQ_STA_AL BIT(0) +#define RTC_IRQ_STA_LP BIT(3) + +#define RTC_IRQ_EN 0x0004 +#define RTC_IRQ_EN_AL BIT(0) +#define RTC_IRQ_EN_ONESHOT BIT(2) +#define RTC_IRQ_EN_LP BIT(3) +#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) + +#define RTC_AL_MASK0x0008 +#define RTC_AL_MASK_DOWBIT(4) + +#define RTC_TC_SEC 0x000a +/* Min, Hour, Dom... register offset to RTC_TC_SEC */ +#define RTC_OFFSET_SEC 0 +#define RTC_OFFSET_MIN 1 +#define RTC_OFFSET_HOUR2 +#define RTC_OFFSET_DOM 3 +#define RTC_OFFSET_DOW 4 +#define RTC_OFFSET_MTH 5 +#define RTC_OFFSET_YEAR6 +#define RTC_OFFSET_COUNT 7 + +#define RTC_AL_SEC 0x0018 + +#define RTC_PDN2 0x002e +#define RTC_PDN2_PWRON_ALARM BIT(4) + +#define RTC_MIN_YEAR 1968 +#define RTC_BASE_YEAR 1900 +#define RTC_NUM_YEARS 128 +#define RTC_MIN_YEAR_OFFSET(RTC_MIN_YEAR - RTC_BASE_YEAR) + +#define MTK_RTC_POLL_DELAY_US 10 +#define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ)) + +struct mt6397_rtc { + struct device *dev; + struct rtc_device *rtc_dev; + + /* Protect register access from multiple tasks */ + struct mutexlock; + struct regmap *regmap; + int irq; + u32 addr_base; +}; + +#endif /* _LINUX_MFD_MT6397_RTC_H_ */ -- 2.17.1
[PATCH v7 0/7] implement poweroff for mt6323 / bpi-r2
mainline-driver does not support mt6323 this series makes some cleanup to mt6397-rtc-driver, adds mt6323 and implement power-controller on it. tested on bananapi-r2 Original Patch from Josef Friedl changes since v6: - rebased on 5.3-rc8 - post only 7 Patches because 6 are already applied to next - update copyright in "move some common definitions into rtc.h" changes since v5: - splitted part 1 to separate changes and additions not related to pwrc - move mfd/mt6397/core.h from v4.8 in separate patch "add mutex include" - changed recipients (moved from To to Cc, removed committers) changes since v4: - relative path in part 1+2 - drop change of copyright-year in part 5 changes since v3: - moved SOB in 2/10 and 9/10 - moved part 5 to 6 to be near driver-change - changehistory of patches below --- changes since v2: - Splitted some parts and rebased on 5.3-rc2: v2.1 dt-bindings: add powercontroller – try to make better subject v2.2 separate rtc-mt6397.txt (suggested by Alexandre Belloni) add missing commit-message (suggested by Matthias Brugger) v2.3 fix alloc after IRQ (suggested by Alexandre Belloni) new compatible (splitting suggested by Alexandre Belloni) needed due to different rtc-base/size see #7 v2.4 simplifications (Define-res-macros) add mt6323 rtc+pwrc v2.5 add poweroff-driver (no change) v2.6 MAINTAINERS (no change) v2.7 DTS-Changes (no change) Josef Friedl (7): dt-bindings: rtc: mediatek: add missing mt6397 rtc rtc: mt6397: move some common definitions into rtc.h rtc: mt6397: improvements of rtc driver rtc: mt6397: add compatible for mt6323 power: reset: add driver for mt6323 poweroff MAINTAINERS: add Mediatek shutdown drivers arm: dts: mt6323: add keys, power-controller, rtc and codec .../devicetree/bindings/rtc/rtc-mt6397.txt| 29 + MAINTAINERS | 7 ++ arch/arm/boot/dts/mt6323.dtsi | 27 + drivers/power/reset/Kconfig | 10 ++ drivers/power/reset/Makefile | 1 + drivers/power/reset/mt6323-poweroff.c | 97 drivers/rtc/rtc-mt6397.c | 107 -- include/linux/mfd/mt6397/rtc.h| 71 8 files changed, 263 insertions(+), 86 deletions(-) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt6397.txt create mode 100644 drivers/power/reset/mt6323-poweroff.c create mode 100644 include/linux/mfd/mt6397/rtc.h -- 2.17.1
[PATCH v7 5/7] power: reset: add driver for mt6323 poweroff
From: Josef Friedl add poweroff driver for mt6323 and make Makefile and Kconfig-Entries Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich Acked-by: Sebastian Reichel --- changes since v6: none changes since v5: split out mfd/mt6397/core.h changes since v4: none changes since v3: none changes since v2: none (=v2 part 5) --- drivers/power/reset/Kconfig | 10 +++ drivers/power/reset/Makefile | 1 + drivers/power/reset/mt6323-poweroff.c | 97 +++ 3 files changed, 108 insertions(+) create mode 100644 drivers/power/reset/mt6323-poweroff.c diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig index a564237278ff..c721939767eb 100644 --- a/drivers/power/reset/Kconfig +++ b/drivers/power/reset/Kconfig @@ -140,6 +140,16 @@ config POWER_RESET_LTC2952 This driver supports an external powerdown trigger and board power down via the LTC2952. Bindings are made in the device tree. +config POWER_RESET_MT6323 + bool "MediaTek MT6323 power-off driver" + depends on MFD_MT6397 + help + The power-off driver is responsible for externally shutdown down + the power of a remote MediaTek SoC MT6323 is connected to through + controlling a tiny circuit BBPU inside MT6323 RTC. + + Say Y if you have a board where MT6323 could be found. + config POWER_RESET_QNAP bool "QNAP power-off driver" depends on OF_GPIO && PLAT_ORION diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile index 85da3198e4e0..da37f8b851dc 100644 --- a/drivers/power/reset/Makefile +++ b/drivers/power/reset/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o +obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c new file mode 100644 index ..1caf43d9e46d --- /dev/null +++ b/drivers/power/reset/mt6323-poweroff.c @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Power off through MediaTek PMIC + * + * Copyright (C) 2018 MediaTek Inc. + * + * Author: Sean Wang + * + */ + +#include +#include +#include +#include +#include +#include + +struct mt6323_pwrc { + struct device *dev; + struct regmap *regmap; + u32 base; +}; + +static struct mt6323_pwrc *mt_pwrc; + +static void mt6323_do_pwroff(void) +{ + struct mt6323_pwrc *pwrc = mt_pwrc; + unsigned int val; + int ret; + + regmap_write(pwrc->regmap, pwrc->base + RTC_BBPU, RTC_BBPU_KEY); + regmap_write(pwrc->regmap, pwrc->base + RTC_WRTGR, 1); + + ret = regmap_read_poll_timeout(pwrc->regmap, + pwrc->base + RTC_BBPU, val, + !(val & RTC_BBPU_CBUSY), + MTK_RTC_POLL_DELAY_US, + MTK_RTC_POLL_TIMEOUT); + if (ret) + dev_err(pwrc->dev, "failed to write BBPU: %d\n", ret); + + /* Wait some time until system down, otherwise, notice with a warn */ + mdelay(1000); + + WARN_ONCE(1, "Unable to power off system\n"); +} + +static int mt6323_pwrc_probe(struct platform_device *pdev) +{ + struct mt6397_chip *mt6397_chip = dev_get_drvdata(pdev->dev.parent); + struct mt6323_pwrc *pwrc; + struct resource *res; + + pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); + if (!pwrc) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + pwrc->base = res->start; + pwrc->regmap = mt6397_chip->regmap; + pwrc->dev = &pdev->dev; + mt_pwrc = pwrc; + + pm_power_off = &mt6323_do_pwroff; + + return 0; +} + +static int mt6323_pwrc_remove(struct platform_device *pdev) +{ + if (pm_power_off == &mt6323_do_pwroff) + pm_power_off = NULL; + + return 0; +} + +static const struct of_device_id mt6323_pwrc_dt_match[] = { + { .compatible = "mediatek,mt6323-pwrc" }, + {}, +}; +MODULE_DEVICE_TABLE(of, mt6323_pwrc_dt_match); + +static struct platform_driver mt6323_pwrc_driver = { + .probe = mt6323_pwrc_probe, + .remove = mt6323_pwrc_remove, + .driver = { + .name = "mt6323-pwrc", + .of_match_table = mt6323_pwrc_dt_match, + }, +}; + +module_platform_driver(mt6323_pwrc_driver); + +MODULE_DESCRIPTION("Poweroff driver for MT6323 PMIC"); +MODULE_AUTHOR("Sean Wang "); +MODULE_LICENSE("GPL v2"); -- 2.17.1
[PATCH v7 7/7] arm: dts: mt6323: add keys, power-controller, rtc and codec
From: Josef Friedl support poweroff and power-related keys on bpi-r2 Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- changes since v6: none changes since v5: none changes since v4: none changes since v3: none changes since v2: none (=v2 part 7) --- arch/arm/boot/dts/mt6323.dtsi | 27 +++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/boot/dts/mt6323.dtsi b/arch/arm/boot/dts/mt6323.dtsi index ba397407c1dd..7fda40ab5fe8 100644 --- a/arch/arm/boot/dts/mt6323.dtsi +++ b/arch/arm/boot/dts/mt6323.dtsi @@ -238,5 +238,32 @@ regulator-enable-ramp-delay = <216>; }; }; + + mt6323keys: mt6323keys { + compatible = "mediatek,mt6323-keys"; + mediatek,long-press-mode = <1>; + power-off-time-sec = <0>; + + power { + linux,keycodes = <116>; + wakeup-source; + }; + + home { + linux,keycodes = <114>; + }; + }; + + codec: mt6397codec { + compatible = "mediatek,mt6397-codec"; + }; + + power-controller { + compatible = "mediatek,mt6323-pwrc"; + }; + + rtc { + compatible = "mediatek,mt6323-rtc"; + }; }; }; -- 2.17.1
[PATCH v7 4/7] rtc: mt6397: add compatible for mt6323
From: Josef Friedl use mt6397 rtc driver also for mt6323 but with different base/size see "mfd: mt6323: add mt6323 rtc+pwrc" Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich Acked-by: Alexandre Belloni --- changes since v6: none changes since v5: none changes since v4: none changes since v3: moved (was part 5) changes since v2: splitted this from v2.3 suggested-by Alexandre Belloni --- drivers/rtc/rtc-mt6397.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index 9370b7fc9f81..21cd9cc8b4c7 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -325,6 +325,7 @@ static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_rtc_suspend, mt6397_rtc_resume); static const struct of_device_id mt6397_rtc_of_match[] = { + { .compatible = "mediatek,mt6323-rtc", }, { .compatible = "mediatek,mt6397-rtc", }, { } }; -- 2.17.1
[PATCH v7 6/7] MAINTAINERS: add Mediatek shutdown drivers
From: Josef Friedl add Section in MAINTAINERS file for poweroff driver Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich Acked-by: Sebastian Reichel --- changes since v6: none changes since v5: none changes since v4: none changes since v3: moved SOB changes since v2: none (=v2 part 6) --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index e7a47b5210fd..46d13e845740 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10149,6 +10149,13 @@ S: Maintained F: drivers/net/dsa/mt7530.* F: net/dsa/tag_mtk.c +MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS +M: Sean Wang +L: linux...@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt +F: drivers/power/reset/mt6323-poweroff.c + MEDIATEK JPEG DRIVER M: Rick Chang M: Bin Liu -- 2.17.1
[PATCH v7 1/7] dt-bindings: rtc: mediatek: add missing mt6397 rtc
From: Josef Friedl add missing devicetree-binding document for mt6397 rtc in later patch driver is extended with mt6323 chip Suggested-By: Alexandre Belloni Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich Reviewed-by: Rob Herring --- changes since v6: none changes since v5: none changes since v4: use relative path changes since v3: moved SOB changes since v2: splitted rtc-mt6397.txt from first patch --- .../devicetree/bindings/rtc/rtc-mt6397.txt| 29 +++ 1 file changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt6397.txt diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt new file mode 100644 index ..55a0c8874c03 --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt @@ -0,0 +1,29 @@ +Device-Tree bindings for MediaTek PMIC based RTC + +MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works +as a type of multi-function device (MFD). The RTC can be configured and set up +with PMIC wrapper bus which is a common resource shared with the other +functions found on the same PMIC. + +For MediaTek PMIC MFD bindings, see: +../mfd/mt6397.txt + +For MediaTek PMIC wrapper bus bindings, see: +../soc/mediatek/pwrap.txt + +Required properties: +- compatible: Should be one of follows + "mediatek,mt6323-rtc": for MT6323 PMIC + "mediatek,mt6397-rtc": for MT6397 PMIC + +Example: + + pmic { + compatible = "mediatek,mt6323"; + + ... + + rtc { + compatible = "mediatek,mt6323-rtc"; + }; + }; -- 2.17.1
BUG: devm_regulator_get returns EPROBE_DEFER (5.3-rc5..next-20190822) for bpi-r2/mt7623/mt7530
Hi, i've encountered a bug in regulator between 5.3-rc5 and next-20190822 i build for bananapi-r2/mt7623 using this branch (includes next-patches): https://github.com/vDorst/linux-1/blob/c34582d96520566c45068b92e080620458ffc1ff/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts#L166 and noticed that switch does not came up priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core"); returns 517 located here: https://github.com/vDorst/linux-1/blob/c34582d96520566c45068b92e080620458ffc1ff/drivers/net/dsa/mt7530.c#L1590 #define EPROBE_DEFER 517/* Driver requests probe retry */ https://elixir.bootlin.com/linux/latest/source/drivers/regulator/core.c#L1726 seems of_find_regulator_by_node(node); is failing here, but i see the dts-node (mt6323_vpa_reg: buck_vpa) in /sys/firmware/devicetree/... tried without next-patches and switch came up including dsa-ports. i found no commit yet which breaks the regulator-setup any idea about this? regards Frank
Aw: Re: BUG: devm_regulator_get returns EPROBE_DEFER (5.3-rc5..next-20190822) for bpi-r2/mt7623/mt7530
cfba5de9b99f drivers: Introduce device lookup variants by of_node this looks suspicios to me since the change is in the function which fails: struct regulator_dev *of_find_regulator_by_node(struct device_node *np) { struct device *dev; - dev = class_find_device(®ulator_class, NULL, np, of_node_match); + dev = class_find_device_by_of_node(®ulator_class, np); but i cannot revert this commit so i did it manually...but this does not seem to be the cause...still error 517, also a change in core.c is not the cause... how can i check instantiation at runtime? regards Frank > Gesendet: Donnerstag, 22. August 2019 um 21:30 Uhr > Von: "Mark Brown" > An: "Frank Wunderlich" > Cc: "Liam Girdwood" , linux-kernel@vger.kernel.org, > linux-media...@lists.infradead.org, "René van Dorst" > Betreff: Re: BUG: devm_regulator_get returns EPROBE_DEFER > (5.3-rc5..next-20190822) for bpi-r2/mt7623/mt7530 > > On Thu, Aug 22, 2019 at 09:23:57PM +0200, Frank Wunderlich wrote: > > > seems of_find_regulator_by_node(node); is failing here, but i see the > > dts-node (mt6323_vpa_reg: buck_vpa) in /sys/firmware/devicetree/... > > It's not looking for the node in the device tree, it's looking > for that regulator to instantiate at runtime. Is that happening? >
[PATCH v6 12/13] MAINTAINERS: add Mediatek shutdown drivers
From: Josef Friedl add Section in MAINTAINERS file for poweroff driver Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- changes since v5: none changes since v4: none changes since v3: moved SOB changes since v2: none (=v2 part 6) --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6426db5198f0..4172a3177633 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10128,6 +10128,13 @@ S: Maintained F: drivers/net/dsa/mt7530.* F: net/dsa/tag_mtk.c +MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS +M: Sean Wang +L: linux...@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt +F: drivers/power/reset/mt6323-poweroff.c + MEDIATEK JPEG DRIVER M: Rick Chang M: Bin Liu -- 2.17.1
[PATCH v6 06/13] mfd: mt6397: add mutex include
From: Josef Friedl add missing mutex.h Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- changes since v5: separated from "power: reset: add driver for mt6323 poweroff" --- include/linux/mfd/mt6397/core.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h index 25a95e72179b..652da61e3711 100644 --- a/include/linux/mfd/mt6397/core.h +++ b/include/linux/mfd/mt6397/core.h @@ -7,6 +7,8 @@ #ifndef __MFD_MT6397_CORE_H__ #define __MFD_MT6397_CORE_H__ +#include + enum mt6397_irq_numbers { MT6397_IRQ_SPKL_AB = 0, MT6397_IRQ_SPKR_AB, -- 2.17.1
[PATCH v6 02/13] dt-bindings: mfd: mediatek: update rtc to include mt6323
From: Josef Friedl add mt6323 to rtc-bindings Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- changes since v5: splitted from "dt-bindings: add powercontroller" --- Documentation/devicetree/bindings/mfd/mt6397.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt index ab3163a60929..5fccf987865b 100644 --- a/Documentation/devicetree/bindings/mfd/mt6397.txt +++ b/Documentation/devicetree/bindings/mfd/mt6397.txt @@ -22,8 +22,10 @@ compatible: "mediatek,mt6397" or "mediatek,mt6323" Optional subnodes: - rtc - Required properties: + Required properties: Should be one of follows + - compatible: "mediatek,mt6323-rtc" - compatible: "mediatek,mt6397-rtc" + For details, see ../rtc/rtc-mt6397.txt - regulators Required properties: - compatible: "mediatek,mt6397-regulator" -- 2.17.1
[PATCH v6 03/13] dt-bindings: mfd: mediatek: add mt6323 power-controller
From: Josef Friedl - add powercontroller-section to existing binding-document - add mt6323-pwrc bindings-document with example Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich Acked-for-MFD-by: Lee Jones --- changes since v5: split out non-pwrc related changes changes since v4: none changes since v3: none changes since v2: none (=v2 part 7) --- .../devicetree/bindings/mfd/mt6397.txt| 6 ++ .../bindings/power/reset/mt6323-poweroff.txt | 20 +++ 2 files changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt index 5fccf987865b..a9b105ac00a8 100644 --- a/Documentation/devicetree/bindings/mfd/mt6397.txt +++ b/Documentation/devicetree/bindings/mfd/mt6397.txt @@ -8,6 +8,7 @@ MT6397/MT6323 is a multifunction device with the following sub modules: - Clock - LED - Keys +- Power controller It is interfaced to host controller using SPI interface by a proprietary hardware called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap. @@ -48,6 +49,11 @@ Optional subnodes: - compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys" see ../input/mtk-pmic-keys.txt +- power-controller + Required properties: + - compatible: "mediatek,mt6323-pwrc" + For details, see ../power/reset/mt6323-poweroff.txt + Example: pwrap: pwrap@1000f000 { compatible = "mediatek,mt8135-pwrap"; diff --git a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt new file mode 100644 index ..933f0c48e887 --- /dev/null +++ b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt @@ -0,0 +1,20 @@ +Device Tree Bindings for Power Controller on MediaTek PMIC + +The power controller which could be found on PMIC is responsible for externally +powering off or on the remote MediaTek SoC through the circuit BBPU. + +Required properties: +- compatible: Should be one of follows + "mediatek,mt6323-pwrc": for MT6323 PMIC + +Example: + + pmic { + compatible = "mediatek,mt6323"; + + ... + + power-controller { + compatible = "mediatek,mt6323-pwrc"; + }; + } -- 2.17.1
[PATCH v6 01/13] dt-bindings: mfd: mediatek: mt6397: change to relative paths
paths in dt-bindings should be relative as suggested by Lee Johnes Suggested-By: Lee Jones Signed-off-by: Frank Wunderlich --- changes since v5: splitted from dt-bindings: add powercontroller --- Documentation/devicetree/bindings/mfd/mt6397.txt | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt index 0ebd08af777d..ab3163a60929 100644 --- a/Documentation/devicetree/bindings/mfd/mt6397.txt +++ b/Documentation/devicetree/bindings/mfd/mt6397.txt @@ -12,7 +12,7 @@ MT6397/MT6323 is a multifunction device with the following sub modules: It is interfaced to host controller using SPI interface by a proprietary hardware called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap. See the following for pwarp node definitions: -Documentation/devicetree/bindings/soc/mediatek/pwrap.txt +../soc/mediatek/pwrap.txt This document describes the binding for MFD device and its sub module. @@ -27,9 +27,9 @@ Optional subnodes: - regulators Required properties: - compatible: "mediatek,mt6397-regulator" - see Documentation/devicetree/bindings/regulator/mt6397-regulator.txt + see ../regulator/mt6397-regulator.txt - compatible: "mediatek,mt6323-regulator" - see Documentation/devicetree/bindings/regulator/mt6323-regulator.txt + see ../regulator/mt6323-regulator.txt - codec Required properties: - compatible: "mediatek,mt6397-codec" @@ -39,12 +39,12 @@ Optional subnodes: - led Required properties: - compatible: "mediatek,mt6323-led" - see Documentation/devicetree/bindings/leds/leds-mt6323.txt + see ../leds/leds-mt6323.txt - keys Required properties: - compatible: "mediatek,mt6397-keys" or "mediatek,mt6323-keys" - see Documentation/devicetree/bindings/input/mtk-pmic-keys.txt + see ../input/mtk-pmic-keys.txt Example: pwrap: pwrap@1000f000 { -- 2.17.1
[PATCH v6 04/13] dt-bindings: rtc: mediatek: add missing mt6397 rtc
From: Josef Friedl add missing devicetree-binding document for mt6397 rtc in later patch driver is extended with mt6323 chip Suggested-By: Alexandre Belloni Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- changes since v5: none changes since v4: use relative path changes since v3: moved SOB changes since v2: splitted rtc-mt6397.txt from first patch --- .../devicetree/bindings/rtc/rtc-mt6397.txt| 29 +++ 1 file changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt6397.txt diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt new file mode 100644 index ..55a0c8874c03 --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt @@ -0,0 +1,29 @@ +Device-Tree bindings for MediaTek PMIC based RTC + +MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works +as a type of multi-function device (MFD). The RTC can be configured and set up +with PMIC wrapper bus which is a common resource shared with the other +functions found on the same PMIC. + +For MediaTek PMIC MFD bindings, see: +../mfd/mt6397.txt + +For MediaTek PMIC wrapper bus bindings, see: +../soc/mediatek/pwrap.txt + +Required properties: +- compatible: Should be one of follows + "mediatek,mt6323-rtc": for MT6323 PMIC + "mediatek,mt6397-rtc": for MT6397 PMIC + +Example: + + pmic { + compatible = "mediatek,mt6323"; + + ... + + rtc { + compatible = "mediatek,mt6323-rtc"; + }; + }; -- 2.17.1
[PATCH v6 07/13] rtc: mt6397: improvements of rtc driver
From: Josef Friedl - use regmap_read_poll_timeout to drop while-loop - use devm-api to drop remove-callback Suggested-by: Alexandre Belloni Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- changes since v5: none changes since v4: none changes since v3: none changes since v2: - fix allocation after irq-request - compatible for mt6323 in separate commit => part 5 --- drivers/rtc/rtc-mt6397.c | 51 +++- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index c08ee5edf865..9370b7fc9f81 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -4,16 +4,19 @@ * Author: Tianping.Fang */ -#include -#include +#include +#include +#include #include +#include +#include #include #include #include +#include static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) { - unsigned long timeout = jiffies + HZ; int ret; u32 data; @@ -21,19 +24,13 @@ static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) if (ret < 0) return ret; - while (1) { - ret = regmap_read(rtc->regmap, rtc->addr_base + RTC_BBPU, - &data); - if (ret < 0) - break; - if (!(data & RTC_BBPU_CBUSY)) - break; - if (time_after(jiffies, timeout)) { - ret = -ETIMEDOUT; - break; - } - cpu_relax(); - } + ret = regmap_read_poll_timeout(rtc->regmap, + rtc->addr_base + RTC_BBPU, data, + !(data & RTC_BBPU_CBUSY), + MTK_RTC_POLL_DELAY_US, + MTK_RTC_POLL_TIMEOUT); + if (ret < 0) + dev_err(rtc->dev, "failed to write WRTGE: %d\n", ret); return ret; } @@ -266,19 +263,19 @@ static int mtk_rtc_probe(struct platform_device *pdev) return rtc->irq; rtc->regmap = mt6397_chip->regmap; - rtc->dev = &pdev->dev; mutex_init(&rtc->lock); platform_set_drvdata(pdev, rtc); - rtc->rtc_dev = devm_rtc_allocate_device(rtc->dev); + rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev); if (IS_ERR(rtc->rtc_dev)) return PTR_ERR(rtc->rtc_dev); - ret = request_threaded_irq(rtc->irq, NULL, - mtk_rtc_irq_handler_thread, - IRQF_ONESHOT | IRQF_TRIGGER_HIGH, - "mt6397-rtc", rtc); + ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, + mtk_rtc_irq_handler_thread, + IRQF_ONESHOT | IRQF_TRIGGER_HIGH, + "mt6397-rtc", rtc); + if (ret) { dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", rtc->irq, ret); @@ -302,15 +299,6 @@ static int mtk_rtc_probe(struct platform_device *pdev) return ret; } -static int mtk_rtc_remove(struct platform_device *pdev) -{ - struct mt6397_rtc *rtc = platform_get_drvdata(pdev); - - free_irq(rtc->irq, rtc); - - return 0; -} - #ifdef CONFIG_PM_SLEEP static int mt6397_rtc_suspend(struct device *dev) { @@ -349,7 +337,6 @@ static struct platform_driver mtk_rtc_driver = { .pm = &mt6397_pm_ops, }, .probe = mtk_rtc_probe, - .remove = mtk_rtc_remove, }; module_platform_driver(mtk_rtc_driver); -- 2.17.1
[PATCH v6 11/13] power: reset: add driver for mt6323 poweroff
From: Josef Friedl add poweroff driver for mt6323 and make Makefile and Kconfig-Entries Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- changes since v5: split out mfd/mt6397/core.h changes since v4: none changes since v3: none changes since v2: none (=v2 part 5) --- drivers/power/reset/Kconfig | 10 +++ drivers/power/reset/Makefile | 1 + drivers/power/reset/mt6323-poweroff.c | 97 +++ 3 files changed, 108 insertions(+) create mode 100644 drivers/power/reset/mt6323-poweroff.c diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig index a564237278ff..c721939767eb 100644 --- a/drivers/power/reset/Kconfig +++ b/drivers/power/reset/Kconfig @@ -140,6 +140,16 @@ config POWER_RESET_LTC2952 This driver supports an external powerdown trigger and board power down via the LTC2952. Bindings are made in the device tree. +config POWER_RESET_MT6323 + bool "MediaTek MT6323 power-off driver" + depends on MFD_MT6397 + help + The power-off driver is responsible for externally shutdown down + the power of a remote MediaTek SoC MT6323 is connected to through + controlling a tiny circuit BBPU inside MT6323 RTC. + + Say Y if you have a board where MT6323 could be found. + config POWER_RESET_QNAP bool "QNAP power-off driver" depends on OF_GPIO && PLAT_ORION diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile index 85da3198e4e0..da37f8b851dc 100644 --- a/drivers/power/reset/Makefile +++ b/drivers/power/reset/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o +obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c new file mode 100644 index ..1caf43d9e46d --- /dev/null +++ b/drivers/power/reset/mt6323-poweroff.c @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Power off through MediaTek PMIC + * + * Copyright (C) 2018 MediaTek Inc. + * + * Author: Sean Wang + * + */ + +#include +#include +#include +#include +#include +#include + +struct mt6323_pwrc { + struct device *dev; + struct regmap *regmap; + u32 base; +}; + +static struct mt6323_pwrc *mt_pwrc; + +static void mt6323_do_pwroff(void) +{ + struct mt6323_pwrc *pwrc = mt_pwrc; + unsigned int val; + int ret; + + regmap_write(pwrc->regmap, pwrc->base + RTC_BBPU, RTC_BBPU_KEY); + regmap_write(pwrc->regmap, pwrc->base + RTC_WRTGR, 1); + + ret = regmap_read_poll_timeout(pwrc->regmap, + pwrc->base + RTC_BBPU, val, + !(val & RTC_BBPU_CBUSY), + MTK_RTC_POLL_DELAY_US, + MTK_RTC_POLL_TIMEOUT); + if (ret) + dev_err(pwrc->dev, "failed to write BBPU: %d\n", ret); + + /* Wait some time until system down, otherwise, notice with a warn */ + mdelay(1000); + + WARN_ONCE(1, "Unable to power off system\n"); +} + +static int mt6323_pwrc_probe(struct platform_device *pdev) +{ + struct mt6397_chip *mt6397_chip = dev_get_drvdata(pdev->dev.parent); + struct mt6323_pwrc *pwrc; + struct resource *res; + + pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); + if (!pwrc) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + pwrc->base = res->start; + pwrc->regmap = mt6397_chip->regmap; + pwrc->dev = &pdev->dev; + mt_pwrc = pwrc; + + pm_power_off = &mt6323_do_pwroff; + + return 0; +} + +static int mt6323_pwrc_remove(struct platform_device *pdev) +{ + if (pm_power_off == &mt6323_do_pwroff) + pm_power_off = NULL; + + return 0; +} + +static const struct of_device_id mt6323_pwrc_dt_match[] = { + { .compatible = "mediatek,mt6323-pwrc" }, + {}, +}; +MODULE_DEVICE_TABLE(of, mt6323_pwrc_dt_match); + +static struct platform_driver mt6323_pwrc_driver = { + .probe = mt6323_pwrc_probe, + .remove = mt6323_pwrc_remove, + .driver = { + .name = "mt6323-pwrc", + .of_match_table = mt6323_pwrc_dt_match, + }, +}; + +module_platform_driver(mt6323_pwrc_driver); + +MODULE_DESCRIPTION("Poweroff driver for MT6323 PMIC"); +MODULE_AUTHOR("Sean Wang "); +MODULE_LICENSE("GPL v2"); -- 2.17.1
[PATCH v6 13/13] arm: dts: mt6323: add keys, power-controller, rtc and codec
From: Josef Friedl support poweroff and power-related keys on bpi-r2 Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- changes since v5: none changes since v4: none changes since v3: none changes since v2: none (=v2 part 7) --- arch/arm/boot/dts/mt6323.dtsi | 27 +++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/boot/dts/mt6323.dtsi b/arch/arm/boot/dts/mt6323.dtsi index ba397407c1dd..7fda40ab5fe8 100644 --- a/arch/arm/boot/dts/mt6323.dtsi +++ b/arch/arm/boot/dts/mt6323.dtsi @@ -238,5 +238,32 @@ regulator-enable-ramp-delay = <216>; }; }; + + mt6323keys: mt6323keys { + compatible = "mediatek,mt6323-keys"; + mediatek,long-press-mode = <1>; + power-off-time-sec = <0>; + + power { + linux,keycodes = <116>; + wakeup-source; + }; + + home { + linux,keycodes = <114>; + }; + }; + + codec: mt6397codec { + compatible = "mediatek,mt6397-codec"; + }; + + power-controller { + compatible = "mediatek,mt6323-pwrc"; + }; + + rtc { + compatible = "mediatek,mt6323-rtc"; + }; }; }; -- 2.17.1
[PATCH v6 10/13] mfd: mt6323: add mt6323 rtc+pwrc
From: Josef Friedl add entry for rtc and power-controller to mt6323 Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich Acked-for-MFD-by: Lee Jones --- changes since v5: none changes since v4: none changes since v3: none changes since v2: only splitting, second part of v2 part 4 --- drivers/mfd/mt6397-core.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index c9a81087fa55..5916978a8feb 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -16,13 +16,24 @@ #include #include +#define MT6323_RTC_BASE0x8000 +#define MT6323_RTC_SIZE0x40 + #define MT6397_RTC_BASE0xe000 #define MT6397_RTC_SIZE0x3e +#define MT6323_PWRC_BASE 0x8000 +#define MT6323_PWRC_SIZE 0x40 + #define MT6323_CID_CODE0x23 #define MT6391_CID_CODE0x91 #define MT6397_CID_CODE0x97 +static const struct resource mt6323_rtc_resources[] = { + DEFINE_RES_MEM(MT6323_RTC_BASE, MT6323_RTC_SIZE), + DEFINE_RES_IRQ(MT6323_IRQ_STATUS_RTC), +}; + static const struct resource mt6397_rtc_resources[] = { DEFINE_RES_MEM(MT6397_RTC_BASE, MT6397_RTC_SIZE), DEFINE_RES_IRQ(MT6397_IRQ_RTC), @@ -38,8 +49,17 @@ static const struct resource mt6397_keys_resources[] = { DEFINE_RES_IRQ(MT6397_IRQ_HOMEKEY), }; +static const struct resource mt6323_pwrc_resources[] = { + DEFINE_RES_MEM(MT6323_PWRC_BASE, MT6323_PWRC_SIZE), +}; + static const struct mfd_cell mt6323_devs[] = { { + .name = "mt6323-rtc", + .num_resources = ARRAY_SIZE(mt6323_rtc_resources), + .resources = mt6323_rtc_resources, + .of_compatible = "mediatek,mt6323-rtc", + }, { .name = "mt6323-regulator", .of_compatible = "mediatek,mt6323-regulator" }, { @@ -50,6 +70,11 @@ static const struct mfd_cell mt6323_devs[] = { .num_resources = ARRAY_SIZE(mt6323_keys_resources), .resources = mt6323_keys_resources, .of_compatible = "mediatek,mt6323-keys" + }, { + .name = "mt6323-pwrc", + .num_resources = ARRAY_SIZE(mt6323_pwrc_resources), + .resources = mt6323_pwrc_resources, + .of_compatible = "mediatek,mt6323-pwrc" }, }; -- 2.17.1
[PATCH v6 00/13] implement poweroff for mt6323 / bpi-r2
mainline-driver does not support mt6323 this series makes some cleanup to mt6397-rtc-driver, adds mt6323 and implement power-controller on it. tested on bananapi-r2 Original Patch from Josef Friedl changes since v5: - splitted part 1 to separate changes and additions not related to pwrc - move mfd/mt6397/core.h from v4.8 in separate patch "add mutex include" - changed recipients (moved from To to Cc, removed committers) changes since v4: - relative path in part 1+2 - drop change of copyright-year in part 5 changes since v3: - moved SOB in 2/10 and 9/10 - moved part 5 to 6 to be near driver-change - changehistory of patches below --- changes since v2: - Splitted some parts and rebased on 5.3-rc2: v2.1 dt-bindings: add powercontroller – try to make better subject v2.2 separate rtc-mt6397.txt (suggested by Alexandre Belloni) add missing commit-message (suggested by Matthias Brugger) v2.3 fix alloc after IRQ (suggested by Alexandre Belloni) new compatible (splitting suggested by Alexandre Belloni) needed due to different rtc-base/size see #7 v2.4 simplifications (Define-res-macros) add mt6323 rtc+pwrc v2.5 add poweroff-driver (no change) v2.6 MAINTAINERS (no change) v2.7 DTS-Changes (no change) Frank Wunderlich (1): dt-bindings: mfd: mediatek: mt6397: change to relative paths Josef Friedl (12): dt-bindings: mfd: mediatek: update rtc to include mt6323 dt-bindings: mfd: mediatek: add mt6323 power-controller dt-bindings: rtc: mediatek: add missing mt6397 rtc rtc: mt6397: move some common definitions into rtc.h mfd: mt6397: add mutex include rtc: mt6397: improvements of rtc driver mfd: mt6323: some improvements of mt6397-core rtc: mt6397: add compatible for mt6323 mfd: mt6323: add mt6323 rtc+pwrc power: reset: add driver for mt6323 poweroff MAINTAINERS: add Mediatek shutdown drivers arm: dts: mt6323: add keys, power-controller, rtc and codec .../devicetree/bindings/mfd/mt6397.txt| 20 +++- .../bindings/power/reset/mt6323-poweroff.txt | 20 .../devicetree/bindings/rtc/rtc-mt6397.txt| 29 + MAINTAINERS | 7 ++ arch/arm/boot/dts/mt6323.dtsi | 27 + drivers/mfd/mt6397-core.c | 38 +-- drivers/power/reset/Kconfig | 10 ++ drivers/power/reset/Makefile | 1 + drivers/power/reset/mt6323-poweroff.c | 97 drivers/rtc/rtc-mt6397.c | 107 -- include/linux/mfd/mt6397/core.h | 2 + include/linux/mfd/mt6397/rtc.h| 71 12 files changed, 327 insertions(+), 102 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt6397.txt create mode 100644 drivers/power/reset/mt6323-poweroff.c create mode 100644 include/linux/mfd/mt6397/rtc.h -- 2.17.1
[PATCH v6 08/13] mfd: mt6323: some improvements of mt6397-core
From: Josef Friedl simplyfications (resource definitions my DEFINE_RES_* macros) Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich Acked-for-MFD-by: Lee Jones --- changes since v5: none changes since v4: do not touch year of copyright changes since v3: moved part 6 forward to let compatible and driver be together changes since v2: splitted v2 part 4 into 6+7 --- drivers/mfd/mt6397-core.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 337bcccdb914..c9a81087fa55 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -23,16 +24,8 @@ #define MT6397_CID_CODE0x97 static const struct resource mt6397_rtc_resources[] = { - { - .start = MT6397_RTC_BASE, - .end = MT6397_RTC_BASE + MT6397_RTC_SIZE, - .flags = IORESOURCE_MEM, - }, - { - .start = MT6397_IRQ_RTC, - .end = MT6397_IRQ_RTC, - .flags = IORESOURCE_IRQ, - }, + DEFINE_RES_MEM(MT6397_RTC_BASE, MT6397_RTC_SIZE), + DEFINE_RES_IRQ(MT6397_IRQ_RTC), }; static const struct resource mt6323_keys_resources[] = { -- 2.17.1
[PATCH v6 09/13] rtc: mt6397: add compatible for mt6323
From: Josef Friedl use mt6397 rtc driver also for mt6323 but with different base/size see "mfd: mt6323: add mt6323 rtc+pwrc" Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- changes since v5: none changes since v4: none changes since v3: moved (was part 5) changes since v2: splitted this from v2.3 suggested-by Alexandre Belloni --- drivers/rtc/rtc-mt6397.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index 9370b7fc9f81..21cd9cc8b4c7 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -325,6 +325,7 @@ static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_rtc_suspend, mt6397_rtc_resume); static const struct of_device_id mt6397_rtc_of_match[] = { + { .compatible = "mediatek,mt6323-rtc", }, { .compatible = "mediatek,mt6397-rtc", }, { } }; -- 2.17.1
[PATCH v6 05/13] rtc: mt6397: move some common definitions into rtc.h
From: Josef Friedl move code to separate header-file to reuse definitions later in poweroff-driver (drivers/power/reset/mt6323-poweroff.c) Suggested-by: Frank Wunderlich Signed-off-by: Josef Friedl Signed-off-by: Frank Wunderlich --- changes since v5: none changes since v4: none changes since v3: none changes since v2: add missing commit-message --- drivers/rtc/rtc-mt6397.c | 55 +- include/linux/mfd/mt6397/rtc.h | 71 ++ 2 files changed, 72 insertions(+), 54 deletions(-) create mode 100644 include/linux/mfd/mt6397/rtc.h diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index b46ed4dc7015..c08ee5edf865 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -9,60 +9,7 @@ #include #include #include -#include -#include -#include -#include -#include -#include - -#define RTC_BBPU 0x -#define RTC_BBPU_CBUSY BIT(6) - -#define RTC_WRTGR 0x003c - -#define RTC_IRQ_STA0x0002 -#define RTC_IRQ_STA_AL BIT(0) -#define RTC_IRQ_STA_LP BIT(3) - -#define RTC_IRQ_EN 0x0004 -#define RTC_IRQ_EN_AL BIT(0) -#define RTC_IRQ_EN_ONESHOT BIT(2) -#define RTC_IRQ_EN_LP BIT(3) -#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) - -#define RTC_AL_MASK0x0008 -#define RTC_AL_MASK_DOWBIT(4) - -#define RTC_TC_SEC 0x000a -/* Min, Hour, Dom... register offset to RTC_TC_SEC */ -#define RTC_OFFSET_SEC 0 -#define RTC_OFFSET_MIN 1 -#define RTC_OFFSET_HOUR2 -#define RTC_OFFSET_DOM 3 -#define RTC_OFFSET_DOW 4 -#define RTC_OFFSET_MTH 5 -#define RTC_OFFSET_YEAR6 -#define RTC_OFFSET_COUNT 7 - -#define RTC_AL_SEC 0x0018 - -#define RTC_PDN2 0x002e -#define RTC_PDN2_PWRON_ALARM BIT(4) - -#define RTC_MIN_YEAR 1968 -#define RTC_BASE_YEAR 1900 -#define RTC_NUM_YEARS 128 -#define RTC_MIN_YEAR_OFFSET(RTC_MIN_YEAR - RTC_BASE_YEAR) - -struct mt6397_rtc { - struct device *dev; - struct rtc_device *rtc_dev; - struct mutexlock; - struct regmap *regmap; - int irq; - u32 addr_base; -}; +#include static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) { diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h new file mode 100644 index ..b702c29e8c74 --- /dev/null +++ b/include/linux/mfd/mt6397/rtc.h @@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2014-2018 MediaTek Inc. + * + * Author: Tianping.Fang + *Sean Wang + */ + +#ifndef _LINUX_MFD_MT6397_RTC_H_ +#define _LINUX_MFD_MT6397_RTC_H_ + +#include +#include +#include +#include + +#define RTC_BBPU 0x +#define RTC_BBPU_CBUSY BIT(6) +#define RTC_BBPU_KEY(0x43 << 8) + +#define RTC_WRTGR 0x003c + +#define RTC_IRQ_STA0x0002 +#define RTC_IRQ_STA_AL BIT(0) +#define RTC_IRQ_STA_LP BIT(3) + +#define RTC_IRQ_EN 0x0004 +#define RTC_IRQ_EN_AL BIT(0) +#define RTC_IRQ_EN_ONESHOT BIT(2) +#define RTC_IRQ_EN_LP BIT(3) +#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) + +#define RTC_AL_MASK0x0008 +#define RTC_AL_MASK_DOWBIT(4) + +#define RTC_TC_SEC 0x000a +/* Min, Hour, Dom... register offset to RTC_TC_SEC */ +#define RTC_OFFSET_SEC 0 +#define RTC_OFFSET_MIN 1 +#define RTC_OFFSET_HOUR2 +#define RTC_OFFSET_DOM 3 +#define RTC_OFFSET_DOW 4 +#define RTC_OFFSET_MTH 5 +#define RTC_OFFSET_YEAR6 +#define RTC_OFFSET_COUNT 7 + +#define RTC_AL_SEC 0x0018 + +#define RTC_PDN2 0x002e +#define RTC_PDN2_PWRON_ALARM BIT(4) + +#define RTC_MIN_YEAR 1968 +#define RTC_BASE_YEAR 1900 +#define RTC_NUM_YEARS 128 +#define RTC_MIN_YEAR_OFFSET(RTC_MIN_YEAR - RTC_BASE_YEAR) + +#define MTK_RTC_POLL_DELAY_US 10 +#define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ)) + +struct mt6397_rtc { + struct device *dev; + struct rtc_device *rtc_dev; + + /* Protect register access from multiple tasks */ + struct mutexlock; + struct regmap *regmap; + int irq; + u32 addr_base; +}; + +#endif /* _LINUX_MFD_MT6397_RTC_H_ */ -- 2.17.1
Re: [PATCH v6 00/13] implement poweroff for mt6323 / bpi-r2
Arg, missed a comma between linux-arm-ker...@lists.infradead.org and Alessandro Zummo Will send the series to linux-arm-kernel later Sorry for that
Aw: Re: Re: BUG: devm_regulator_get returns EPROBE_DEFER (5.3-rc5..next-20190822) for bpi-r2/mt7623/mt7530
> Gesendet: Freitag, 23. August 2019 um 12:04 Uhr > Von: "Mark Brown" > Can you run a git bisect to try to identify the commit that > caused things to fail? i have not figured out, how to rebase linux-next on my current (working) codebase :) (failes on file untouched by me at Patch 3/7000+) > Look to see if there is a device driver bound to that device, or > check if the parent regulator is visible in /sys/class/regulators. > You'll also see a mesage printed out for each regulator as it > instantiates in the boot logs, you can check there too. in working version i only get this message in dmesg which looks like a device-binding: mt6323-regulator mt6323-regulator: Chip ID = 0x2023 this is my regulator: mt6323_vpa_reg defined in arch/arm/boot/dts/mt6323.dtsi &pwrap { pmic: mt6323 { mt6323regulator: mt6323regulator{ compatible = "mediatek,mt6323-regulator"; mt6323_vpa_reg: buck_vpa{ regulator-name = "vpa"; regulator-min-microvolt = < 50>; regulator-max-microvolt = <365>; }; }; }; }; parent regulator is then mt6323regulator: mt6323regulator which is the one i see i dmesg. in working version i see the regulator in sys-fs cat /sys/class/regulator/regulator.*/name | grep vpa vpa --- so, now to the non-working regulator: dmesg do not have such entry ;( regulators-list in /sys/class only containing the dummy and some fixed regulators cat /sys/class/regulator/regulator.*/name regulator-dummy fixed-1.8V fixed-3.3V fixed-5V in arch/arm/boot/dts/mt*.dts and Makefile there is no change between working and non-working version. in drivers/regulators only the 2 files where i had reverted the changes manually without success. where can be the cause for no more binding main-regulator? are these strange messages related to this problem? mtk-cpufreq mtk-cpufreq: failed to initialize dvfs info for cpu0 another strange line is this: mt6397 1000d000.pwrap:mt6323: unsupported chip: 0x0 so the pwrap above regulator is affected too and here are many changes in 2 files... git diff --name-only non-working..working -- drivers/mfd/mt6397-* drivers/mfd/mt6397-core.c drivers/mfd/mt6397-irq.c which brings me to this 2 commits: a4872e80ce7d mfd: mt6397: Extract IRQ related code from core driver 708cb5cc3fde mfd: mt6397: Rename macros to something more readable after reverting those 2 regulators are working again. Adding both Signed-off-People to CC to keep them informed that a fix is needed > Please fix your mail client to word wrap within paragraphs at something > substantially less than 80 columns. Doing this makes your messages much > easier to read and reply to. i currently write in webmailer, where i cannot set this setting, i try to add manual linebreak in long lines, ok? regards Frank
[BUG] [PATCH v5 02/10] mfd: mt6397: extract irq related code from core driver
Hi, this commit breaks mt6323 pmic on BananaPi-R2 https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=a4872e80ce7d2a1844328176dbf279d0a2b89bdb resulting in this message in dmesg: mt6397 1000d000.pwrap:mt6323: unsupported chip: 0x0 and multiple mtk-cpufreq mtk-cpufreq: failed to initialize dvfs info for cpu0 see discussion here: http://lists.infradead.org/pipermail/linux-mediatek/2019-August/022505.html after reverting this one the errors are gone, please provide a fix regards Frank > Gesendet: Freitag, 23. August 2019 um 05:45 Uhr > Von: "Hsin-Hsiung Wang" > Betreff: [PATCH v5 02/10] mfd: mt6397: extract irq related code from core > driver > > In order to support different types of irq design, we decide to add > separate irq drivers for different design and keep mt6397 mfd core > simple and reusable to all generations of PMICs so far. > > Acked-for-mfd-by: Lee Jones > Signed-off-by: Hsin-Hsiung Wang > --- > drivers/mfd/Makefile| 3 +- > drivers/mfd/mt6397-core.c | 146 > drivers/mfd/mt6397-irq.c| 181 > > include/linux/mfd/mt6397/core.h | 9 ++ > 4 files changed, 192 insertions(+), 147 deletions(-) > create mode 100644 drivers/mfd/mt6397-irq.c
Re: Aw: Re: Re: BUG: devm_regulator_get returns EPROBE_DEFER (5.3-rc5..next-20190822) for bpi-r2/mt7623/mt7530
Hi Am 23. August 2019 16:43:47 MESZ schrieb Matthias Brugger : >On 23/08/2019 14:00, Frank Wunderlich wrote: >> in working version i only get this message in dmesg which >> looks like a device-binding: >> >> mt6323-regulator mt6323-regulator: Chip ID = 0x2023 >> mt6397 1000d000.pwrap:mt6323: unsupported chip: 0x0 >These are commit IDs from linux-next. At least file from 20190822 >should >pinpoint you to the correct commits. > >@frank: please don't use commit IDs from linux-next as the history >get's >rewritten every day and the IDs can change. Better search the tree to >which they >got applied and use the commit IDs from there (stating, of course, >which tree >you are looking at). Is there any easy way to get the right tree? Can you give me an example bases on this commit? I thought adding the commit-subject is enough to find it also in a dynamic tree >Looking at commit >a4872e80ce7d ("mfd: mt6397: Extract IRQ related code from core driver") > >you can see that it doesn't just move the code but also adds new logic >in >mt6397_irq_init(). :( I take a look at this function,thank you pointing to it >It seems your chip_id is not supported yet. So you will have to find >out which >one it is and add it to the switch. have posted it above ;) (0x2023)