* Re: [PATCH v3 2/5] arm64: dts: ti: k3-j784s4: Add Main CPSW2G node
From: Krzysztof Kozlowski @ 2023-04-19 7:50 UTC (permalink / raw)
To: Jayesh Choudhary, nm, vigneshr, afd
Cc: s-vadapalli, kristo, robh+dt, krzysztof.kozlowski+dt,
linux-arm-kernel, devicetree, linux-kernel, a-bhatia1
In-Reply-To: <20230419061710.290068-3-j-choudhary@ti.com>
On 19/04/2023 08:17, Jayesh Choudhary wrote:
> From: Siddharth Vadapalli <s-vadapalli@ti.com>
>
> J784S4 SoC has a Main CPSW2G instance of the CPSW Ethernet Switch.
>
> Add the device-tree nodes for the Main CPSW2G instance and enable it.
>
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
> ---
> arch/arm64/boot/dts/ti/k3-j784s4-evm.dts | 48 +++++++++++++++
> arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi | 68 ++++++++++++++++++++++
> 2 files changed, 116 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/ti/k3-j784s4-evm.dts b/arch/arm64/boot/dts/ti/k3-j784s4-evm.dts
> index f33815953e77..aef6f53ae8ac 100644
> --- a/arch/arm64/boot/dts/ti/k3-j784s4-evm.dts
> +++ b/arch/arm64/boot/dts/ti/k3-j784s4-evm.dts
> @@ -105,6 +105,30 @@ vdd_sd_dv: regulator-TLV71033 {
> };
>
> &main_pmx0 {
> + main_cpsw2g_pins_default: main-cpsw2g-pins-default {
> + pinctrl-single,pins = <
> + J784S4_IOPAD(0x0b8, PIN_INPUT, 6) /* (AC34) MCASP1_ACLKX.RGMII1_RD0 */
> + J784S4_IOPAD(0x0a0, PIN_INPUT, 6) /* (AD34) MCASP0_AXR12.RGMII1_RD1 */
> + J784S4_IOPAD(0x0a4, PIN_INPUT, 6) /* (AJ36) MCASP0_AXR13.RGMII1_RD2 */
> + J784S4_IOPAD(0x0a8, PIN_INPUT, 6) /* (AF34) MCASP0_AXR14.RGMII1_RD3 */
> + J784S4_IOPAD(0x0b0, PIN_INPUT, 6) /* (AL33) MCASP1_AXR3.RGMII1_RXC */
> + J784S4_IOPAD(0x0ac, PIN_INPUT, 6) /* (AE34) MCASP0_AXR15.RGMII1_RX_CTL */
> + J784S4_IOPAD(0x08c, PIN_INPUT, 6) /* (AE35) MCASP0_AXR7.RGMII1_TD0 */
> + J784S4_IOPAD(0x090, PIN_INPUT, 6) /* (AC35) MCASP0_AXR8.RGMII1_TD1 */
> + J784S4_IOPAD(0x094, PIN_INPUT, 6) /* (AG35) MCASP0_AXR9.RGMII1_TD2 */
> + J784S4_IOPAD(0x098, PIN_INPUT, 6) /* (AH36) MCASP0_AXR10.RGMII1_TD3 */
> + J784S4_IOPAD(0x0b4, PIN_INPUT, 6) /* (AL34) MCASP1_AXR4.RGMII1_TXC */
> + J784S4_IOPAD(0x09c, PIN_INPUT, 6) /* (AF35) MCASP0_AXR11.RGMII1_TX_CTL */
> + >;
> + };
> +
> + main_cpsw2g_mdio_pins_default: main-cpsw2g-mdio-pins-default {
> + pinctrl-single,pins = <
> + J784S4_IOPAD(0x0c0, PIN_INPUT, 6) /* (AD38) MCASP1_AXR0.MDIO0_MDC */
> + J784S4_IOPAD(0x0bc, PIN_INPUT, 6) /* (AD33) MCASP1_AFSX.MDIO0_MDIO */
> + >;
> + };
> +
> main_uart8_pins_default: main-uart8-pins-default {
> pinctrl-single,pins = <
> J784S4_IOPAD(0x040, PIN_INPUT, 14) /* (AF37) MCASP0_AXR0.UART8_CTSn */
> @@ -253,3 +277,27 @@ &mcu_cpsw_port1 {
> phy-mode = "rgmii-rxid";
> phy-handle = <&mcu_phy0>;
> };
> +
> +&main_cpsw1 {
> + status = "okay";
> + pinctrl-names = "default";
> + pinctrl-0 = <&main_cpsw2g_pins_default>;
> +};
> +
> +&main_cpsw1_mdio {
> + pinctrl-names = "default";
> + pinctrl-0 = <&main_cpsw2g_mdio_pins_default>;
> +
> + main_phy0: ethernet-phy@0 {
> + reg = <0>;
> + ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
> + ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
> + ti,min-output-impedance;
> + };
> +};
> +
> +&main_cpsw1_port1 {
> + status = "okay";
> + phy-mode = "rgmii-rxid";
> + phy-handle = <&main_phy0>;
> +};
> diff --git a/arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi b/arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi
> index 5fb7edf4f5a0..8bd8aebebe1c 100644
> --- a/arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi
> +++ b/arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi
> @@ -36,6 +36,12 @@ scm_conf: syscon@100000 {
> #size-cells = <1>;
> ranges = <0x00 0x00 0x00100000 0x1c000>;
>
> + cpsw1_phy_gmii_sel: phy@4034 {
> + compatible = "ti,am654-phy-gmii-sel";
> + reg = <0x4034 0x4>;
> + #phy-cells = <1>;
> + };
> +
> serdes_ln_ctrl: mux-controller-4080 {
> compatible = "mmio-mux";
> #mux-control-cells = <1>;
> @@ -777,6 +783,68 @@ cpts@310d0000 {
> };
> };
>
> + main_cpsw1: ethernet@c200000 {
> + compatible = "ti,j721e-cpsw-nuss";
> + #address-cells = <2>;
> + #size-cells = <2>;
Fix order of your properties. reg/reg-names/ranges follow comaptible.
> + reg = <0x00 0xc200000 0x00 0x200000>;
> + reg-names = "cpsw_nuss";
> + ranges = <0x00 0x00 0x00 0xc200000 0x00 0x200000>;
> + dma-coherent;
> + clocks = <&k3_clks 62 0>;
> + clock-names = "fck";
> + power-domains = <&k3_pds 62 TI_SCI_PD_EXCLUSIVE>;
> +
> + dmas = <&main_udmap 0xc640>,
> + <&main_udmap 0xc641>,
> + <&main_udmap 0xc642>,
> + <&main_udmap 0xc643>,
> + <&main_udmap 0xc644>,
> + <&main_udmap 0xc645>,
> + <&main_udmap 0xc646>,
> + <&main_udmap 0xc647>,
> + <&main_udmap 0x4640>;
> + dma-names = "tx0", "tx1", "tx2", "tx3",
> + "tx4", "tx5", "tx6", "tx7",
> + "rx";
> +
> + status = "disabled";
> +
> + ethernet-ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + main_cpsw1_port1: port@1 {
> + reg = <1>;
> + label = "port1";
> + phys = <&cpsw1_phy_gmii_sel 1>;
> + ti,mac-only;
> + status = "disabled";
> + };
> + };
> +
> + main_cpsw1_mdio: mdio@f00 {
> + compatible = "ti,cpsw-mdio", "ti,davinci_mdio";
> + reg = <0x00 0xf00 0x00 0x100>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + clocks = <&k3_clks 62 0>;
> + clock-names = "fck";
> + bus_freq = <1000000>;
> + };
> +
> + cpts@3d000 {
Are you sure dtbs_check does not print any warnings?
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH linux-next v3 3/4] clocksource/drivers/timer-of: Remove __init markings
From: walter.chang @ 2023-04-19 7:49 UTC (permalink / raw)
To: Daniel Lezcano, Thomas Gleixner, Matthias Brugger,
AngeloGioacchino Del Regno, Maciej W . Rozycki, John Stultz
Cc: wsd_upstream, stanley.chu, Chun-hung.Wu, Freddy.Hsin,
walter.chang, Chun-Hung Wu, linux-kernel, linux-arm-kernel,
linux-mediatek
In-Reply-To: <20230419074910.10809-1-walter.chang@mediatek.com>
From: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Remove __init markings to allow timer drivers
can be compiled as modules.
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
---
drivers/clocksource/timer-of.c | 23 ++++++++++++-----------
drivers/clocksource/timer-of.h | 6 +++---
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c
index c3f54d9912be..59bc5921acad 100644
--- a/drivers/clocksource/timer-of.c
+++ b/drivers/clocksource/timer-of.c
@@ -19,7 +19,7 @@
*
* Free the irq resource
*/
-static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)
+static void timer_of_irq_exit(struct of_timer_irq *of_irq)
{
struct timer_of *to = container_of(of_irq, struct timer_of, of_irq);
@@ -47,8 +47,8 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)
*
* Returns 0 on success, < 0 otherwise
*/
-static __init int timer_of_irq_init(struct device_node *np,
- struct of_timer_irq *of_irq)
+static int timer_of_irq_init(struct device_node *np,
+ struct of_timer_irq *of_irq)
{
int ret;
struct timer_of *to = container_of(of_irq, struct timer_of, of_irq);
@@ -91,7 +91,7 @@ static __init int timer_of_irq_init(struct device_node *np,
*
* Disables and releases the refcount on the clk
*/
-static __init void timer_of_clk_exit(struct of_timer_clk *of_clk)
+static void timer_of_clk_exit(struct of_timer_clk *of_clk)
{
of_clk->rate = 0;
clk_disable_unprepare(of_clk->clk);
@@ -107,8 +107,8 @@ static __init void timer_of_clk_exit(struct of_timer_clk *of_clk)
*
* Returns 0 on success, < 0 otherwise
*/
-static __init int timer_of_clk_init(struct device_node *np,
- struct of_timer_clk *of_clk)
+static int timer_of_clk_init(struct device_node *np,
+ struct of_timer_clk *of_clk)
{
int ret;
@@ -146,13 +146,13 @@ static __init int timer_of_clk_init(struct device_node *np,
goto out;
}
-static __init void timer_of_base_exit(struct of_timer_base *of_base)
+static void timer_of_base_exit(struct of_timer_base *of_base)
{
iounmap(of_base->base);
}
-static __init int timer_of_base_init(struct device_node *np,
- struct of_timer_base *of_base)
+static int timer_of_base_init(struct device_node *np,
+ struct of_timer_base *of_base)
{
of_base->base = of_base->name ?
of_io_request_and_map(np, of_base->index, of_base->name) :
@@ -165,7 +165,7 @@ static __init int timer_of_base_init(struct device_node *np,
return 0;
}
-int __init timer_of_init(struct device_node *np, struct timer_of *to)
+int timer_of_init(struct device_node *np, struct timer_of *to)
{
int ret = -EINVAL;
int flags = 0;
@@ -209,6 +209,7 @@ int __init timer_of_init(struct device_node *np, struct timer_of *to)
timer_of_base_exit(&to->of_base);
return ret;
}
+EXPORT_SYMBOL_GPL(timer_of_init);
/**
* timer_of_cleanup - release timer_of resources
@@ -217,7 +218,7 @@ int __init timer_of_init(struct device_node *np, struct timer_of *to)
* Release the resources that has been used in timer_of_init().
* This function should be called in init error cases
*/
-void __init timer_of_cleanup(struct timer_of *to)
+void timer_of_cleanup(struct timer_of *to)
{
if (to->flags & TIMER_OF_IRQ)
timer_of_irq_exit(&to->of_irq);
diff --git a/drivers/clocksource/timer-of.h b/drivers/clocksource/timer-of.h
index a5478f3e8589..5d1472846346 100644
--- a/drivers/clocksource/timer-of.h
+++ b/drivers/clocksource/timer-of.h
@@ -66,9 +66,9 @@ static inline unsigned long timer_of_period(struct timer_of *to)
return to->of_clk.period;
}
-extern int __init timer_of_init(struct device_node *np,
- struct timer_of *to);
+extern int timer_of_init(struct device_node *np,
+ struct timer_of *to);
-extern void __init timer_of_cleanup(struct timer_of *to);
+extern void timer_of_cleanup(struct timer_of *to);
#endif
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH linux-next v3 1/4] time/sched_clock: Export sched_clock_register()
From: walter.chang @ 2023-04-19 7:49 UTC (permalink / raw)
To: Daniel Lezcano, Thomas Gleixner, Matthias Brugger,
AngeloGioacchino Del Regno, Maciej W . Rozycki, John Stultz
Cc: wsd_upstream, stanley.chu, Chun-hung.Wu, Freddy.Hsin,
walter.chang, Chun-Hung Wu, linux-kernel, linux-arm-kernel,
linux-mediatek
In-Reply-To: <20230419074910.10809-1-walter.chang@mediatek.com>
From: Chun-Hung Wu <chun-hung.wu@mediatek.com>
clocksource driver may use sched_clock_register()
to resigter itself as a sched_clock source.
Export it to support building such driver
as module, like timer-mediatek.c
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
---
kernel/time/sched_clock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index 8464c5acc913..8e49e87d1221 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -150,8 +150,7 @@ static enum hrtimer_restart sched_clock_poll(struct hrtimer *hrt)
return HRTIMER_RESTART;
}
-void __init
-sched_clock_register(u64 (*read)(void), int bits, unsigned long rate)
+void sched_clock_register(u64 (*read)(void), int bits, unsigned long rate)
{
u64 res, wrap, new_mask, new_epoch, cyc, ns;
u32 new_mult, new_shift;
@@ -223,6 +222,7 @@ sched_clock_register(u64 (*read)(void), int bits, unsigned long rate)
pr_debug("Registered %pS as sched_clock source\n", read);
}
+EXPORT_SYMBOL_GPL(sched_clock_register);
void __init generic_sched_clock_init(void)
{
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [PATCH v3 1/5] arm64: dts: ti: k3-j784s4-main: Add system controller and SERDES lane mux
From: Krzysztof Kozlowski @ 2023-04-19 7:49 UTC (permalink / raw)
To: Jayesh Choudhary, nm, vigneshr, afd
Cc: s-vadapalli, kristo, robh+dt, krzysztof.kozlowski+dt,
linux-arm-kernel, devicetree, linux-kernel, a-bhatia1
In-Reply-To: <20230419061710.290068-2-j-choudhary@ti.com>
On 19/04/2023 08:17, Jayesh Choudhary wrote:
> From: Siddharth Vadapalli <s-vadapalli@ti.com>
>
> The system controller node manages the CTRL_MMR0 region.
> Add serdes_ln_ctrl node which is used for controlling the SERDES lane mux.
>
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> [j-choudhary@ti.com: Minor cleanup to fix dtc warnings]
> Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
> ---
> arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi b/arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi
> index e9169eb358c1..5fb7edf4f5a0 100644
> --- a/arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi
> +++ b/arch/arm64/boot/dts/ti/k3-j784s4-main.dtsi
> @@ -5,6 +5,9 @@
> * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
> */
>
> +#include <dt-bindings/mux/mux.h>
> +#include <dt-bindings/mux/ti-serdes.h>
> +
> &cbass_main {
> msmc_ram: sram@70000000 {
> compatible = "mmio-sram";
> @@ -26,6 +29,25 @@ l3cache-sram@200000 {
> };
> };
>
> + scm_conf: syscon@100000 {
> + compatible = "ti,j721e-system-controller", "syscon", "simple-mfd";
> + reg = <0x00 0x00100000 0x00 0x1c000>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges = <0x00 0x00 0x00100000 0x1c000>;
> +
> + serdes_ln_ctrl: mux-controller-4080 {
Does not look like you tested the DTS against bindings. Please run `make
dtbs_check` (see Documentation/devicetree/bindings/writing-schema.rst
for instructions).
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH linux-next v3 4/4] clocksource/drivers/timer-mediatek: Make timer-mediatek become loadable module
From: walter.chang @ 2023-04-19 7:49 UTC (permalink / raw)
To: Daniel Lezcano, Thomas Gleixner, Matthias Brugger,
AngeloGioacchino Del Regno, Maciej W . Rozycki, John Stultz
Cc: wsd_upstream, stanley.chu, Chun-hung.Wu, Freddy.Hsin,
walter.chang, Chun-Hung Wu, linux-kernel, linux-arm-kernel,
linux-mediatek
In-Reply-To: <20230419074910.10809-1-walter.chang@mediatek.com>
From: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Make the timer-mediatek driver which can register
an always-on timer as tick_broadcast_device on
MediaTek SoCs become loadable module in GKI.
Tested-by: Walter Chang <walter.chang@mediatek.com>
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
---
drivers/clocksource/Kconfig | 2 +-
drivers/clocksource/timer-mediatek.c | 39 ++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 526382dc7482..a7413ad7b6ad 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -472,7 +472,7 @@ config SYS_SUPPORTS_SH_CMT
bool
config MTK_TIMER
- bool "Mediatek timer driver" if COMPILE_TEST
+ tristate "Mediatek timer driver"
depends on HAS_IOMEM
select TIMER_OF
select CLKSRC_MMIO
diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
index 7bcb4a3f26fb..3448848682c0 100644
--- a/drivers/clocksource/timer-mediatek.c
+++ b/drivers/clocksource/timer-mediatek.c
@@ -13,6 +13,9 @@
#include <linux/clocksource.h>
#include <linux/interrupt.h>
#include <linux/irqreturn.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
#include <linux/sched_clock.h>
#include <linux/slab.h>
#include "timer-of.h"
@@ -337,5 +340,41 @@ static int __init mtk_gpt_init(struct device_node *node)
return 0;
}
+
+#ifdef MODULE
+static int mtk_timer_probe(struct platform_device *pdev)
+{
+ int (*timer_init)(struct device_node *node);
+ struct device_node *np = pdev->dev.of_node;
+
+ timer_init = of_device_get_match_data(&pdev->dev);
+ return timer_init(np);
+}
+
+static const struct of_device_id mtk_timer_match_table[] = {
+ {
+ .compatible = "mediatek,mt6577-timer",
+ .data = mtk_gpt_init,
+ },
+ {
+ .compatible = "mediatek,mt6765-timer",
+ .data = mtk_syst_init,
+ },
+ {}
+};
+
+static struct platform_driver mtk_timer_driver = {
+ .probe = mtk_timer_probe,
+ .driver = {
+ .name = "mtk-timer",
+ .of_match_table = mtk_timer_match_table,
+ },
+};
+module_platform_driver(mtk_timer_driver);
+
+MODULE_DESCRIPTION("MediaTek Module Timer driver");
+MODULE_LICENSE("GPL v2");
+#else
TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init);
TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer", mtk_syst_init);
+#endif
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH linux-next v3 2/4] clocksource/drivers/mmio: Export clocksource_mmio_init()
From: walter.chang @ 2023-04-19 7:49 UTC (permalink / raw)
To: Daniel Lezcano, Thomas Gleixner, Matthias Brugger,
AngeloGioacchino Del Regno, Maciej W . Rozycki, John Stultz
Cc: wsd_upstream, stanley.chu, Chun-hung.Wu, Freddy.Hsin,
walter.chang, Chun-Hung Wu, linux-kernel, linux-arm-kernel,
linux-mediatek
In-Reply-To: <20230419074910.10809-1-walter.chang@mediatek.com>
From: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Export clocksource_mmio_init() and clocksource_mmio_readl_up()
to support building clocksource driver as module,
such as timer-mediatek.c.
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
---
drivers/clocksource/mmio.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
index 9de751531831..b08b2f9d7a8b 100644
--- a/drivers/clocksource/mmio.c
+++ b/drivers/clocksource/mmio.c
@@ -21,6 +21,7 @@ u64 clocksource_mmio_readl_up(struct clocksource *c)
{
return (u64)readl_relaxed(to_mmio_clksrc(c)->reg);
}
+EXPORT_SYMBOL_GPL(clocksource_mmio_readl_up);
u64 clocksource_mmio_readl_down(struct clocksource *c)
{
@@ -46,9 +47,9 @@ u64 clocksource_mmio_readw_down(struct clocksource *c)
* @bits: Number of valid bits
* @read: One of clocksource_mmio_read*() above
*/
-int __init clocksource_mmio_init(void __iomem *base, const char *name,
- unsigned long hz, int rating, unsigned bits,
- u64 (*read)(struct clocksource *))
+int clocksource_mmio_init(void __iomem *base, const char *name,
+ unsigned long hz, int rating, unsigned bits,
+ u64 (*read)(struct clocksource *))
{
struct clocksource_mmio *cs;
@@ -68,3 +69,4 @@ int __init clocksource_mmio_init(void __iomem *base, const char *name,
return clocksource_register_hz(&cs->clksrc, hz);
}
+EXPORT_SYMBOL_GPL(clocksource_mmio_init);
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH linux-next v3 0/4] Support timer drivers as loadable modules
From: walter.chang @ 2023-04-19 7:49 UTC (permalink / raw)
To: Daniel Lezcano, Thomas Gleixner, Matthias Brugger,
AngeloGioacchino Del Regno, Maciej W . Rozycki, John Stultz
Cc: wsd_upstream, stanley.chu, Chun-hung.Wu, Freddy.Hsin,
walter.chang, linux-kernel, linux-arm-kernel, linux-mediatek
From: Walter Chang <walter.chang@mediatek.com>
This set of patches aims to make SoC related timer drivers, such as
timer-mediatek.c become loadable modules for the Generic Kernel Image
(GKI).
This driver registers an always-on timer as tick_broadcast_device on
MediaTek SoCs. If the system does not load this module at startup,
system will also boot normally by using built-in `bc_hrtimer` instead.
Besides, the previous experiment [1] indicates that the SYST/GPT, in
combination with a loadable module, is fully operational.
The first three patches export functions and remove __init markings to
support loadable timer modules.
The fourth patch makes timer-mediatek.c become loadable module for GKI.
[1] https://lore.kernel.org/all/32777456f8e0f98e4cd5b950f421d21f71b149cf.camel@mediatek.com/#t
[v3]
- Rebase on linux-next
[v2]
- Convert timer-mediatek.c driver to loadable module
Chun-Hung Wu (4):
time/sched_clock: Export sched_clock_register()
clocksource/drivers/mmio: Export clocksource_mmio_init()
clocksource/drivers/timer-of: Remove __init markings
clocksource/drivers/timer-mediatek: Make timer-mediatek become
loadable module
drivers/clocksource/Kconfig | 2 +-
drivers/clocksource/mmio.c | 8 +++---
drivers/clocksource/timer-mediatek.c | 39 ++++++++++++++++++++++++++++
drivers/clocksource/timer-of.c | 23 ++++++++--------
drivers/clocksource/timer-of.h | 6 ++---
kernel/time/sched_clock.c | 4 +--
6 files changed, 62 insertions(+), 20 deletions(-)
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [RFC PATCH 2/2] arm64: dts: add support for C3 based Amlogic AW409
From: Krzysztof Kozlowski @ 2023-04-19 7:48 UTC (permalink / raw)
To: =Xianwei Zhao, linux-arm-kernel, linux-kernel, linux-amlogic,
devicetree
Cc: Catalin Marinas, Will Deacon, Neil Armstrong, Kevin Hilman,
Rob Herring, Krzysztof Kozlowski
In-Reply-To: <20230419073834.972273-3-xianwei.zhao@amlogic.com>
On 19/04/2023 09:38, =Xianwei Zhao wrote:
> From: Xianwei Zhao <xianwei.zhao@amlogic.com>
>
> Amlogic C3 is an advanced edge AI processor designed for smart IP camera
> applications.
>
> Add basic support for the C3 based Amlogic AW409 board, which describes
> the following components: CPU, GIC, IRQ, Timer, UART. It's capable of
> booting up into the serial console.
>
> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
> ---
> arch/arm64/boot/dts/amlogic/Makefile | 1 +
> .../amlogic/amlogic-c3-c302x-aw409-256m.dts | 30 +++++++
> arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi | 87 +++++++++++++++++++
> 3 files changed, 118 insertions(+)
> create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-c3-c302x-aw409-256m.dts
> create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
>
> diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
> index cd1c5b04890a..d2b5d0d750bc 100644
> --- a/arch/arm64/boot/dts/amlogic/Makefile
> +++ b/arch/arm64/boot/dts/amlogic/Makefile
> @@ -74,3 +74,4 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
> dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
> dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air-gbit.dtb
> dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air.dtb
> +dtb-$(CONFIG_ARCH_AMLIPC) += amlogic-c3-c302x-aw409-256m.dtb
> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-c3-c302x-aw409-256m.dts b/arch/arm64/boot/dts/amlogic/amlogic-c3-c302x-aw409-256m.dts
> new file mode 100644
> index 000000000000..38ca98a32181
> --- /dev/null
> +++ b/arch/arm64/boot/dts/amlogic/amlogic-c3-c302x-aw409-256m.dts
> @@ -0,0 +1,30 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
> + */
> +
> +/dts-v1/;
> +
> +#include "amlogic-c3.dtsi"
> +
> +/ {
> + model = "Amlogic C302 aw409 Development Board";
> + compatible = "amlogic,aw409", "amlogic,c3";
Undocumented compatibles. Run checkpatch and fix all warnings. Anyway, I
am not sure this warrants separate architecture. Isn't C3 standard Meson
SoC?
> + interrupt-parent = <&gic>;
> + #address-cells = <2>;
> + #size-cells = <2>;
> +
> + aliases {
> + serial0 = &uart_B;
> + };
> +
> + memory@0 {
> + device_type = "memory";
> + reg = <0x0 0x0 0x0 0x10000000>;
> + };
> +
Drop stray blank lines.
> +};
> +
> +&uart_B {
> + status = "okay";
> +};
> diff --git a/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
> new file mode 100644
> index 000000000000..c69072ac57f5
> --- /dev/null
> +++ b/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
> @@ -0,0 +1,87 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
> + */
> +
> +#include <dt-bindings/interrupt-controller/irq.h>
> +#include <dt-bindings/interrupt-controller/arm-gic.h>
> +#include <dt-bindings/gpio/gpio.h>
> +
> +/ {
> + cpus {
> + #address-cells = <2>;
> + #size-cells = <0>;
> +
> + cpu0: cpu@0 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a35";
> + reg = <0x0 0x0>;
> + enable-method = "psci";
> + };
> +
> + cpu1: cpu@1 {
> + device_type = "cpu";
> + compatible = "arm,cortex-a35";
> + reg = <0x0 0x1>;
> + enable-method = "psci";
> + };
> +
Everywhere...
> + };
> +
> + timer {
> + compatible = "arm,armv8-timer";
> + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> + <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> + <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
> + <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
> + };
> +
> + psci {
> + compatible = "arm,psci-1.0";
> + method = "smc";
> + };
> +
> + xtal: xtal-clk {
> + compatible = "fixed-clock";
> + clock-frequency = <24000000>;
> + clock-output-names = "xtal";
> + #clock-cells = <0>;
> + };
> +
> + soc {
> + compatible = "simple-bus";
> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges;
> +
> + gic: interrupt-controller@fff01000 {
> + compatible = "arm,gic-400";
> + #interrupt-cells = <3>;
> + #address-cells = <0>;
> + interrupt-controller;
> + reg = <0x0 0xfff01000 0 0x1000>,
> + <0x0 0xfff02000 0 0x2000>,
> + <0x0 0xfff04000 0 0x2000>,
> + <0x0 0xfff06000 0 0x2000>;
> + interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
> + };
> +
> + apb4: apb4@fe000000 {
Node names should be generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
> + compatible = "simple-bus";
> + reg = <0x0 0xfe000000 0x0 0x480000>;
> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x480000>;
> +
> + uart_B: serial@7a000 {
lowercase for labels
> + compatible = "amlogic,meson-g12a-uart";
So this is just meson? Drop new ARCH, no need for it. Anyway, you need
SoC specific compatible.
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [RFC PATCH 1/2] arm64: amlogic: add new ARCH_AMLIPC for IPC SoC
From: Krzysztof Kozlowski @ 2023-04-19 7:45 UTC (permalink / raw)
To: =Xianwei Zhao, linux-arm-kernel, linux-kernel, linux-amlogic,
devicetree
Cc: Catalin Marinas, Will Deacon, Neil Armstrong, Kevin Hilman,
Rob Herring, Krzysztof Kozlowski
In-Reply-To: <20230419073834.972273-2-xianwei.zhao@amlogic.com>
On 19/04/2023 09:38, =Xianwei Zhao wrote:
> From: Xianwei Zhao <xianwei.zhao@amlogic.com>
>
> The C series SoCs are designed for smart IP camera
> applications, which does not belong to Meson series.
> So, Add ARCH_AMLIPC for the new series.
>
> There are now multiple amlogic SoC seies supported, so group them under
> their own menu. we can easily add new platforms there in the future.
> Introduce ARCH_AMLOGIC to cover all Amlogic SoC series.
>
> No functional changes introduced.
>
> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
> ---
> arch/arm64/Kconfig.platforms | 12 ++++++++++++
> arch/arm64/configs/defconfig | 2 ++
> 2 files changed, 14 insertions(+)
>
> diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
> index 89a0b13b058d..bfbc817eef8f 100644
> --- a/arch/arm64/Kconfig.platforms
> +++ b/arch/arm64/Kconfig.platforms
> @@ -162,12 +162,24 @@ config ARCH_MEDIATEK
> This enables support for MediaTek MT27xx, MT65xx, MT76xx
> & MT81xx ARMv8 SoCs
>
> +menuconfig ARCH_AMLOGIC
> + bool "NXP SoC support"
NXP? There is already amlogic anyway.
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] thermal: mediatek: Use of_address_to_resource()
From: Daniel Lezcano @ 2023-04-19 7:40 UTC (permalink / raw)
To: Rob Herring, Rafael J. Wysocki, Amit Kucheria, Zhang Rui,
Matthias Brugger, AngeloGioacchino Del Regno
Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek
In-Reply-To: <20230319163231.226738-1-robh@kernel.org>
On 19/03/2023 17:32, Rob Herring wrote:
> Replace of_get_address() and of_translate_address() calls with single
> call to of_address_to_resource().
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
Applied, thanks
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [RFC PATCH 2/2] arm64: dts: add support for C3 based Amlogic AW409
From: =Xianwei Zhao @ 2023-04-19 7:38 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, linux-amlogic, devicetree
Cc: Catalin Marinas, Will Deacon, Neil Armstrong, Kevin Hilman,
Rob Herring, Krzysztof Kozlowski, Xianwei Zhao
In-Reply-To: <20230419073834.972273-1-xianwei.zhao@amlogic.com>
From: Xianwei Zhao <xianwei.zhao@amlogic.com>
Amlogic C3 is an advanced edge AI processor designed for smart IP camera
applications.
Add basic support for the C3 based Amlogic AW409 board, which describes
the following components: CPU, GIC, IRQ, Timer, UART. It's capable of
booting up into the serial console.
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
arch/arm64/boot/dts/amlogic/Makefile | 1 +
.../amlogic/amlogic-c3-c302x-aw409-256m.dts | 30 +++++++
arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi | 87 +++++++++++++++++++
3 files changed, 118 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-c3-c302x-aw409-256m.dts
create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index cd1c5b04890a..d2b5d0d750bc 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -74,3 +74,4 @@ dtb-$(CONFIG_ARCH_MESON) += meson-sm1-odroid-hc4.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-sei610.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air-gbit.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-sm1-x96-air.dtb
+dtb-$(CONFIG_ARCH_AMLIPC) += amlogic-c3-c302x-aw409-256m.dtb
diff --git a/arch/arm64/boot/dts/amlogic/amlogic-c3-c302x-aw409-256m.dts b/arch/arm64/boot/dts/amlogic/amlogic-c3-c302x-aw409-256m.dts
new file mode 100644
index 000000000000..38ca98a32181
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/amlogic-c3-c302x-aw409-256m.dts
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "amlogic-c3.dtsi"
+
+/ {
+ model = "Amlogic C302 aw409 Development Board";
+ compatible = "amlogic,aw409", "amlogic,c3";
+ interrupt-parent = <&gic>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ aliases {
+ serial0 = &uart_B;
+ };
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x0 0x0 0x10000000>;
+ };
+
+};
+
+&uart_B {
+ status = "okay";
+};
diff --git a/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi b/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
new file mode 100644
index 000000000000..c69072ac57f5
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
@@ -0,0 +1,87 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
+ */
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ cpus {
+ #address-cells = <2>;
+ #size-cells = <0>;
+
+ cpu0: cpu@0 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a35";
+ reg = <0x0 0x0>;
+ enable-method = "psci";
+ };
+
+ cpu1: cpu@1 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a35";
+ reg = <0x0 0x1>;
+ enable-method = "psci";
+ };
+
+ };
+
+ timer {
+ compatible = "arm,armv8-timer";
+ interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+ };
+
+ psci {
+ compatible = "arm,psci-1.0";
+ method = "smc";
+ };
+
+ xtal: xtal-clk {
+ compatible = "fixed-clock";
+ clock-frequency = <24000000>;
+ clock-output-names = "xtal";
+ #clock-cells = <0>;
+ };
+
+ soc {
+ compatible = "simple-bus";
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ gic: interrupt-controller@fff01000 {
+ compatible = "arm,gic-400";
+ #interrupt-cells = <3>;
+ #address-cells = <0>;
+ interrupt-controller;
+ reg = <0x0 0xfff01000 0 0x1000>,
+ <0x0 0xfff02000 0 0x2000>,
+ <0x0 0xfff04000 0 0x2000>,
+ <0x0 0xfff06000 0 0x2000>;
+ interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+ };
+
+ apb4: apb4@fe000000 {
+ compatible = "simple-bus";
+ reg = <0x0 0xfe000000 0x0 0x480000>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x480000>;
+
+ uart_B: serial@7a000 {
+ compatible = "amlogic,meson-g12a-uart";
+ reg = <0x0 0x7a000 0x0 0x18>;
+ interrupts = <GIC_SPI 169 IRQ_TYPE_EDGE_RISING>;
+ status = "disabled";
+ clocks = <&xtal>, <&xtal>, <&xtal>;
+ clock-names = "xtal", "pclk", "baud";
+ };
+
+ };
+ };
+};
--
2.37.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [RFC PATCH 1/2] arm64: amlogic: add new ARCH_AMLIPC for IPC SoC
From: =Xianwei Zhao @ 2023-04-19 7:38 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, linux-amlogic, devicetree
Cc: Catalin Marinas, Will Deacon, Neil Armstrong, Kevin Hilman,
Rob Herring, Krzysztof Kozlowski, Xianwei Zhao
In-Reply-To: <20230419073834.972273-1-xianwei.zhao@amlogic.com>
From: Xianwei Zhao <xianwei.zhao@amlogic.com>
The C series SoCs are designed for smart IP camera
applications, which does not belong to Meson series.
So, Add ARCH_AMLIPC for the new series.
There are now multiple amlogic SoC seies supported, so group them under
their own menu. we can easily add new platforms there in the future.
Introduce ARCH_AMLOGIC to cover all Amlogic SoC series.
No functional changes introduced.
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
arch/arm64/Kconfig.platforms | 12 ++++++++++++
arch/arm64/configs/defconfig | 2 ++
2 files changed, 14 insertions(+)
diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index 89a0b13b058d..bfbc817eef8f 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -162,12 +162,24 @@ config ARCH_MEDIATEK
This enables support for MediaTek MT27xx, MT65xx, MT76xx
& MT81xx ARMv8 SoCs
+menuconfig ARCH_AMLOGIC
+ bool "NXP SoC support"
+
+if ARCH_AMLOGIC
+
config ARCH_MESON
bool "Amlogic Platforms"
help
This enables support for the arm64 based Amlogic SoCs
such as the s905, S905X/D, S912, A113X/D or S905X/D2
+config ARCH_AMLIPC
+ bool "Amlogic IPC Platforms"
+ help
+ This enables support for the arm64 based Amlogic IPC SoCs
+ such as the C302X, C308L
+endif
+
config ARCH_MVEBU
bool "Marvell EBU SoC Family"
select ARMADA_AP806_SYSCON
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 7790ee42c68a..f231bd1723fd 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -46,7 +46,9 @@ CONFIG_ARCH_LG1K=y
CONFIG_ARCH_HISI=y
CONFIG_ARCH_KEEMBAY=y
CONFIG_ARCH_MEDIATEK=y
+CONFIG_ARCH_AMLOGIC=y
CONFIG_ARCH_MESON=y
+CONFIG_ARCH_AMLIPC=y
CONFIG_ARCH_MVEBU=y
CONFIG_ARCH_NXP=y
CONFIG_ARCH_LAYERSCAPE=y
--
2.37.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [RFC PATCH 0/2] Baisc devicetree support for Amlogic C3
From: =Xianwei Zhao @ 2023-04-19 7:38 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, linux-amlogic, devicetree
Cc: Catalin Marinas, Will Deacon, Neil Armstrong, Kevin Hilman,
Rob Herring, Krzysztof Kozlowski, Xianwei Zhao
From: Xianwei Zhao <xianwei.zhao@amlogic.com>
Amlogic C3 is an advanced edge AI processor designed for smart IP camera
applications.
Add ARCH_AMLIPC for the new series.
Add basic devicetree support for the C3 based Amlogic AW409 board,
which describes the following components: CPU, GIC, IRQ, Timer, UART.
It's capable of booting up into the serial console.
Xianwei Zhao (2):
arm64: amlogic: add new ARCH_AMLIPC for IPC SoC
arm64: dts: add support for C3 based Amlogic AW409
arch/arm64/Kconfig.platforms | 12 +++
arch/arm64/boot/dts/amlogic/Makefile | 1 +
.../amlogic/amlogic-c3-c302x-aw409-256m.dts | 30 +++++++
arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi | 87 +++++++++++++++++++
arch/arm64/configs/defconfig | 2 +
5 files changed, 132 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-c3-c302x-aw409-256m.dts
create mode 100644 arch/arm64/boot/dts/amlogic/amlogic-c3.dtsi
base-commit: ae68fb187b59bc8645974320808ab2d7c41b1833
--
2.37.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v5 1/2] thermal: mediatek: use devm_of_iomap to avoid resource leak in mtk_thermal_probe
From: Daniel Lezcano @ 2023-04-19 7:37 UTC (permalink / raw)
To: Kang Chen
Cc: amitk, angelogioacchino.delregno, bchihi, daniel, dzm91, error27,
henry.yen, hust-os-kernel-patches, linux-arm-kernel, linux-kernel,
linux-mediatek, linux-pm, matthias.bgg, rafael, rdunlap,
rui.zhang
In-Reply-To: <20230419020749.621257-1-void0red@hust.edu.cn>
On 19/04/2023 04:07, Kang Chen wrote:
> Smatch reports:
> 1. mtk_thermal_probe() warn: 'apmixed_base' from of_iomap() not released.
> 2. mtk_thermal_probe() warn: 'auxadc_base' from of_iomap() not released.
>
> The original code forgets to release iomap resource when handling errors,
> fix it by switch to devm_of_iomap.
>
> Fixes: 89945047b166 ("thermal: mediatek: Add tsensor support for V2 thermal system")
> Signed-off-by: Kang Chen <void0red@hust.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
Dropped v4 and applied v5
Thanks
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 0/2] MediaTek AUXADC thermal: urgent fixes
From: Daniel Lezcano @ 2023-04-19 7:33 UTC (permalink / raw)
To: AngeloGioacchino Del Regno, rafael
Cc: amitk, rui.zhang, matthias.bgg, aouledameur, bchihi, daniel,
ye.xingchen, hsinyi, michael.kao, linux-pm, linux-kernel,
linux-arm-kernel, linux-mediatek
In-Reply-To: <20230419061146.22246-1-angelogioacchino.delregno@collabora.com>
On 19/04/2023 08:11, AngeloGioacchino Del Regno wrote:
> The AUXADC thermal driver unfortunately has issues with a fixed wait
> at probe, as this is not only SoC dependent, but actually depends on
> the board (and even aging...): for example, that works fine on the
> Chromebook that I have here in my hands but not for the ones in our lab.
>
> Some machines are working fine with that 30ms delay at probe, but some
> others are not, hence I started digging in downstream sources here and
> there, and found that there actually is a valid temperature range for
> at least auxadc-thermal *v1* and can be actually found in multiple
> downstream kernels for MT8173 and MT6795.
>
> As for v2 and v3 thermal IP, I'm sure that the v1 range works fine but
> I've "left room" for adding specific ranges for them later: this fix
> is urgent, as many MT8173 and MT8183 Chromebooks are failing tests in
> KernelCI due to thermal shutdown during boot.
>
> For the KernelCI logs, you can look at [1] for 8173, [2] for 8183.
>
> [1]: https://storage.kernelci.org/next/master/next-20230405/arm64/defconfig+arm64-chromebook/gcc-10/lab-collabora/igt-kms-mediatek-mt8173-elm-hana.html
> [2]: https://storage.kernelci.org/next/master/next-20230405/arm64/defconfig+arm64-chromebook/gcc-10/lab-collabora/cros-ec-mt8183-kukui-jacuzzi-juniper-sku16.html
>
Applied, thanks
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH V22 2/3] misc: dcc: Add driver support for Data Capture and Compare unit(DCC)
From: Arnd Bergmann @ 2023-04-19 7:30 UTC (permalink / raw)
To: Souradeep Chowdhury, Greg Kroah-Hartman
Cc: Andy Gross, Konrad Dybcio, Krzysztof Kozlowski, Bjorn Andersson,
Rob Herring, Alex Elder, linux-arm-kernel, linux-kernel,
linux-arm-msm, devicetree, Sibi Sankar, Rajendra Nayak
In-Reply-To: <f1456dd7-5dcf-d91a-459c-65efca4a3444@quicinc.com>
On Wed, Apr 19, 2023, at 09:00, Souradeep Chowdhury wrote:
> On 4/18/2023 9:15 PM, Greg Kroah-Hartman wrote:
>>
>>> The following is the justification of using debugfs interface over the
>>> other alternatives like sysfs/ioctls
>>>
>>> i) As can be seen from the debugfs attribute descriptions, some of the
>>> debugfs attribute files here contains multiple arguments which needs to
>>> be accepted from the user. This goes against the design style of sysfs.
>>>
>>> ii) The user input patterns have been made simple and convenient in this
>>> case with the use of debugfs interface as user doesn't need to shuffle
>>> between different files to execute one instruction as was the case on
>>> using other alternatives.
>>
>> Why do you have debugfs and also a misc device? How are they related?
>> Why both? Why not just one? What userspace tools are going to use
>> either of these interfaces and where are they published to show how this
>> all was tested?
>
> DCC has two fundamental steps of usage:-
>
> 1.Configuring the register addresses on the dcc_sram which is done by
> user through the debugfs interface. For example:-
>
> echo R 0x10c004 > /sys/kernel/debug/dcc/../3/config
>
> Here we are configuring the register addresses for list 3, the 'R'
> indicates a read operation, so this register value will be read
> in case of a software trigger or kernel panic/watchdog bite and
> dumped into the dcc_sram.
Can you describe why the register location needs to be
runtime configurable? I would have expected this type of setting
to be part of the devicetree, which already describes other
parts that interact with sram devices.
How does a user ensure that the address they configure does
not overlap with some other use of the sram?
Arnd
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: pmu-chain-promotion kvm-unit-test failures in mainline
From: Eric Auger @ 2023-04-19 7:30 UTC (permalink / raw)
To: Mark Rutland
Cc: Marc Zyngier, Mark Brown, Oliver Upton, James Morse,
Suzuki K Poulose, Andrew Jones, kvmarm, linux-arm-kernel
In-Reply-To: <ZDZwex6uCrEwS6ds@FVFF77S0Q05N>
Hi Mark,
On 4/12/23 10:48, Mark Rutland wrote:
> On Wed, Apr 12, 2023 at 10:00:40AM +0200, Eric Auger wrote:
>> Hi,
>> On 4/12/23 09:39, Marc Zyngier wrote:
>>> On Tue, 11 Apr 2023 22:15:02 +0100,
>>> Mark Brown <broonie@kernel.org> wrote:
>>>>
>>>> [1 <text/plain; us-ascii (7bit)>]
>>>> Arm's internal test infrastructure has started seeing failures for the
>>>> pmu-chain-promption test in kvm-unit-tests on TX2 when running mainline
>>>> and kvm-unit-tests commit 2480430a36102f8ea276b3bfb1d64d5dacc23b8f
>>>> ("configure: Show the option in case it is not known"). The log I'm
>>>> seeing from the test runner is:
>>>>
>>>> TESTNAME=pmu-chain-promotion TIMEOUT=90s ACCEL= ./arm/run arm/pmu.flat -smp 1 -append 'pmu-chain-promotion'
>>>> FAIL pmu-chain-promotion (7 tests, 2 unexpected failures)
>>>>
>>>> Unfortunately I don't have direct access to a TX2 so can't readily
>>>> alter the test run other than replacing the kernel. I believe the
>>>> specific failures were:
>>>>
>>>> FAIL: pmu: pmu-chain-promotion: 32-bit overflows: CHAIN counter enabled: CHAIN counter was incremented and overflow
>>>> FAIL: pmu: pmu-chain-promotion: 32-bit overflows: CHAIN counter enabled: 32b->64b CHAIN counter was incremented and overflow
>>>
>>> Is this related to [1]?
>>>
>>> M.
>>>
>>> [1] https://lore.kernel.org/r/20230315110725.1215523-1-eric.auger@redhat.com
>>
>> Yes please let me know if it fixes your issue. I also tried bisection
>> but it did not lead to anything.
>
> FWIW, that worked for me; I replied there with a Tested-by (and test results).
Thank you for testing!
Eric
>
> Thanks,
> Mark.
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v1 1/2] KVM: arm64: Acquire mp_state_lock in kvm_arch_vcpu_ioctl_vcpu_init()
From: Marc Zyngier @ 2023-04-19 7:12 UTC (permalink / raw)
To: Reiji Watanabe
Cc: Oliver Upton, kvmarm, kvm, linux-arm-kernel, James Morse,
Alexandru Elisei, Zenghui Yu, Suzuki K Poulose, Paolo Bonzini,
Ricardo Koller, Jing Zhang, Raghavendra Rao Anata, Will Deacon
In-Reply-To: <20230419021852.2981107-2-reijiw@google.com>
On Wed, 19 Apr 2023 03:18:51 +0100,
Reiji Watanabe <reijiw@google.com> wrote:
>
> kvm_arch_vcpu_ioctl_vcpu_init() doesn't acquire mp_state_lock
> when setting the mp_state to KVM_MP_STATE_RUNNABLE. Fix the
> code to acquire the lock.
>
> Signed-off-by: Reiji Watanabe <reijiw@google.com>
> ---
> arch/arm64/kvm/arm.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index fbafcbbcc463..388aa4f18f21 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -1244,8 +1244,11 @@ static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
> */
> if (test_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features))
> kvm_arm_vcpu_power_off(vcpu);
> - else
> + else {
> + spin_lock(&vcpu->arch.mp_state_lock);
> WRITE_ONCE(vcpu->arch.mp_state.mp_state, KVM_MP_STATE_RUNNABLE);
> + spin_unlock(&vcpu->arch.mp_state_lock);
> + }
>
> return 0;
> }
I'm not entirely convinced that this fixes anything. What does the
lock hazard against given that the write is atomic? But maybe a
slightly more readable of this would be to expand the critical section
this way:
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 4ec888fdd4f7..bb21d0c25de7 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -1246,11 +1246,15 @@ static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
/*
* Handle the "start in power-off" case.
*/
+ spin_lock(&vcpu->arch.mp_state_lock);
+
if (test_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features))
- kvm_arm_vcpu_power_off(vcpu);
+ __kvm_arm_vcpu_power_off(vcpu);
else
WRITE_ONCE(vcpu->arch.mp_state.mp_state, KVM_MP_STATE_RUNNABLE);
+ spin_unlock(&vcpu->arch.mp_state_lock);
+
return 0;
}
Thoughts?
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v4 2/4] media: imx: imx7-media-csi: Remove incorrect interlacing support
From: Alexander Stein @ 2023-04-19 7:07 UTC (permalink / raw)
To: Rui Miguel Silva, Laurent Pinchart, Mauro Carvalho Chehab,
Shawn Guo, Sascha Hauer, Fabio Estevam
Cc: Alexander Stein, Pengutronix Kernel Team, NXP Linux Team,
linux-media, linux-arm-kernel
In-Reply-To: <20230419070712.1422335-1-alexander.stein@ew.tq-group.com>
The driver doesn't currently support interlacing, but due to legacy
leftovers, it accepts values for the pixel format "field" field other
than V4L2_FIELD_NONE. Fix it by hardcoding V4L2_FIELD_NONE. Proper
interlacing support can be implemented later if desired.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes in v4:
* Improve commit message
* Added Laurent's r-b
drivers/media/platform/nxp/imx7-media-csi.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
index b149374b07ee1..1315f5743b76f 100644
--- a/drivers/media/platform/nxp/imx7-media-csi.c
+++ b/drivers/media/platform/nxp/imx7-media-csi.c
@@ -1162,20 +1162,6 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
cc = imx7_csi_find_pixel_format(pixfmt->pixelformat);
}
- /* Allow IDMAC interweave but enforce field order from source. */
- if (V4L2_FIELD_IS_INTERLACED(pixfmt->field)) {
- switch (pixfmt->field) {
- case V4L2_FIELD_SEQ_TB:
- pixfmt->field = V4L2_FIELD_INTERLACED_TB;
- break;
- case V4L2_FIELD_SEQ_BT:
- pixfmt->field = V4L2_FIELD_INTERLACED_BT;
- break;
- default:
- break;
- }
- }
-
/*
* Round up width for minimum burst size.
*
@@ -1187,6 +1173,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
pixfmt->bytesperline = pixfmt->width * cc->bpp / 8;
pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height;
+ pixfmt->field = V4L2_FIELD_NONE;
return cc;
}
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v4 4/4] media: imx: imx7-media-csi: Init default format with __imx7_csi_video_try_fmt()
From: Alexander Stein @ 2023-04-19 7:07 UTC (permalink / raw)
To: Rui Miguel Silva, Laurent Pinchart, Mauro Carvalho Chehab,
Shawn Guo, Sascha Hauer, Fabio Estevam
Cc: Pengutronix Kernel Team, NXP Linux Team, linux-media,
linux-arm-kernel, Alexander Stein
In-Reply-To: <20230419070712.1422335-1-alexander.stein@ew.tq-group.com>
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Use the __imx7_csi_video_try_fmt() helper function to initialize the
default format at probe time. This improves consistency by using the
same code path for both default initialization and validation at
runtime, and allows dropping the now unused imx7_csi_find_pixel_format()
function.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Changes in v4:
* None
drivers/media/platform/nxp/imx7-media-csi.c | 55 +++------------------
1 file changed, 6 insertions(+), 49 deletions(-)
diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
index e6abbfbc5c129..0bd2613b9320f 100644
--- a/drivers/media/platform/nxp/imx7-media-csi.c
+++ b/drivers/media/platform/nxp/imx7-media-csi.c
@@ -1014,39 +1014,6 @@ static int imx7_csi_enum_mbus_formats(u32 *code, u32 index)
return -EINVAL;
}
-static int imx7_csi_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
- const struct v4l2_mbus_framefmt *mbus,
- const struct imx7_csi_pixfmt *cc)
-{
- u32 width;
- u32 stride;
-
- if (!cc) {
- cc = imx7_csi_find_mbus_format(mbus->code);
- if (!cc)
- return -EINVAL;
- }
-
- /* Round up width for minimum burst size */
- width = round_up(mbus->width, 8);
-
- /* Round up stride for IDMAC line start address alignment */
- stride = round_up((width * cc->bpp) >> 3, 8);
-
- pix->width = width;
- pix->height = mbus->height;
- pix->pixelformat = cc->fourcc;
- pix->colorspace = mbus->colorspace;
- pix->xfer_func = mbus->xfer_func;
- pix->ycbcr_enc = mbus->ycbcr_enc;
- pix->quantization = mbus->quantization;
- pix->field = mbus->field;
- pix->bytesperline = stride;
- pix->sizeimage = stride * pix->height;
-
- return 0;
-}
-
/* -----------------------------------------------------------------------------
* Video Capture Device - IOCTLs
*/
@@ -1603,22 +1570,14 @@ static struct imx7_csi_vb2_buffer *imx7_csi_video_next_buf(struct imx7_csi *csi)
return buf;
}
-static int imx7_csi_video_init_format(struct imx7_csi *csi)
+static void imx7_csi_video_init_format(struct imx7_csi *csi)
{
- struct v4l2_mbus_framefmt format = { };
-
- format.code = IMX7_CSI_DEF_MBUS_CODE;
- format.width = IMX7_CSI_DEF_PIX_WIDTH;
- format.height = IMX7_CSI_DEF_PIX_HEIGHT;
- format.field = V4L2_FIELD_NONE;
+ struct v4l2_pix_format *pixfmt = &csi->vdev_fmt;
- imx7_csi_mbus_fmt_to_pix_fmt(&csi->vdev_fmt, &format, NULL);
- csi->vdev_compose.width = format.width;
- csi->vdev_compose.height = format.height;
+ pixfmt->width = IMX7_CSI_DEF_PIX_WIDTH;
+ pixfmt->height = IMX7_CSI_DEF_PIX_HEIGHT;
- csi->vdev_cc = imx7_csi_find_pixel_format(csi->vdev_fmt.pixelformat);
-
- return 0;
+ csi->vdev_cc = __imx7_csi_video_try_fmt(pixfmt, &csi->vdev_compose);
}
static int imx7_csi_video_register(struct imx7_csi *csi)
@@ -1631,9 +1590,7 @@ static int imx7_csi_video_register(struct imx7_csi *csi)
vdev->v4l2_dev = v4l2_dev;
/* Initialize the default format and compose rectangle. */
- ret = imx7_csi_video_init_format(csi);
- if (ret < 0)
- return ret;
+ imx7_csi_video_init_format(csi);
/* Register the video device. */
ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v4 1/4] media: imx: imx7-media-csi: Get rid of superfluous call to imx7_csi_mbus_fmt_to_pix_fmt
From: Alexander Stein @ 2023-04-19 7:07 UTC (permalink / raw)
To: Rui Miguel Silva, Laurent Pinchart, Mauro Carvalho Chehab,
Shawn Guo, Sascha Hauer, Fabio Estevam
Cc: Alexander Stein, Pengutronix Kernel Team, NXP Linux Team,
linux-media, linux-arm-kernel
In-Reply-To: <20230419070712.1422335-1-alexander.stein@ew.tq-group.com>
There is no need to convert input pixformat to mbus_framefmt and back
again. Instead apply pixformat width constrains directly.
Assign compose values before adjusting pixformat height/width.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes in v4:
* Added Laurent's r-b
drivers/media/platform/nxp/imx7-media-csi.c | 22 ++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
index b701e823436a8..b149374b07ee1 100644
--- a/drivers/media/platform/nxp/imx7-media-csi.c
+++ b/drivers/media/platform/nxp/imx7-media-csi.c
@@ -1145,9 +1145,13 @@ static const struct imx7_csi_pixfmt *
__imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
struct v4l2_rect *compose)
{
- struct v4l2_mbus_framefmt fmt_src;
const struct imx7_csi_pixfmt *cc;
+ if (compose) {
+ compose->width = pixfmt->width;
+ compose->height = pixfmt->height;
+ }
+
/*
* Find the pixel format, default to the first supported format if not
* found.
@@ -1172,13 +1176,17 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
}
}
- v4l2_fill_mbus_format(&fmt_src, pixfmt, 0);
- imx7_csi_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc);
+ /*
+ * Round up width for minimum burst size.
+ *
+ * TODO: Implement configurable stride support, and check what the real
+ * hardware alignment constraint on the width is.
+ */
+ v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
+ &pixfmt->height, 1, 0xffff, 1, 0);
- if (compose) {
- compose->width = fmt_src.width;
- compose->height = fmt_src.height;
- }
+ pixfmt->bytesperline = pixfmt->width * cc->bpp / 8;
+ pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height;
return cc;
}
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v4 3/4] media: imx: imx7-media-csi: Relax width constraints for non-8bpp formats
From: Alexander Stein @ 2023-04-19 7:07 UTC (permalink / raw)
To: Rui Miguel Silva, Laurent Pinchart, Mauro Carvalho Chehab,
Shawn Guo, Sascha Hauer, Fabio Estevam
Cc: Alexander Stein, Pengutronix Kernel Team, NXP Linux Team,
linux-media, linux-arm-kernel
In-Reply-To: <20230419070712.1422335-1-alexander.stein@ew.tq-group.com>
The driver unconditionally aligns the image width to multiples of 8
pixels. The real alignment constraint is 8 bytes, as indicated by the
CSI_IMAG_PARA.IMAGE_WIDTH documentation that calls for 8 pixel alignment
for 8bpp formats and 4 pixel alignment for other formats.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Changes in v4:
* Improve commit message
* Simplify walign calculation
* Remove comment on hardware alignment constraints
drivers/media/platform/nxp/imx7-media-csi.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
index 1315f5743b76f..e6abbfbc5c129 100644
--- a/drivers/media/platform/nxp/imx7-media-csi.c
+++ b/drivers/media/platform/nxp/imx7-media-csi.c
@@ -1146,6 +1146,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
struct v4l2_rect *compose)
{
const struct imx7_csi_pixfmt *cc;
+ u32 walign;
if (compose) {
compose->width = pixfmt->width;
@@ -1163,12 +1164,13 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,
}
/*
- * Round up width for minimum burst size.
+ * The width alignment is 8 bytes as indicated by the
+ * CSI_IMAG_PARA.IMAGE_WIDTH documentation. Convert it to pixels.
*
- * TODO: Implement configurable stride support, and check what the real
- * hardware alignment constraint on the width is.
+ * TODO: Implement configurable stride support.
*/
- v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
+ walign = 8 * 8 / cc->bpp;
+ v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign,
&pixfmt->height, 1, 0xffff, 1, 0);
pixfmt->bytesperline = pixfmt->width * cc->bpp / 8;
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v4 0/4] Fix imx7-media-csi format settings
From: Alexander Stein @ 2023-04-19 7:07 UTC (permalink / raw)
To: Rui Miguel Silva, Laurent Pinchart, Mauro Carvalho Chehab,
Shawn Guo, Sascha Hauer, Fabio Estevam
Cc: Alexander Stein, Pengutronix Kernel Team, NXP Linux Team,
linux-media, linux-arm-kernel
Hi,
v4 also incorporates feedback and improves commit messages a lot.
Patch 3 is simplified now with hardware alignment constraintd being figured
out.
Thanks,
Alexander
Alexander Stein (3):
media: imx: imx7-media-csi: Get rid of superfluous call to
imx7_csi_mbus_fmt_to_pix_fmt
media: imx: imx7-media-csi: Remove incorrect interlacing support
media: imx: imx7-media-csi: Relax width constraints for non-8bpp
formats
Laurent Pinchart (1):
media: imx: imx7-media-csi: Init default format with
__imx7_csi_video_try_fmt()
drivers/media/platform/nxp/imx7-media-csi.c | 94 ++++++---------------
1 file changed, 24 insertions(+), 70 deletions(-)
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3 2/4] media: imx: imx7-media-csi: Remove interlave fields
From: Alexander Stein @ 2023-04-19 7:02 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Rui Miguel Silva, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer,
Fabio Estevam, Pengutronix Kernel Team, NXP Linux Team,
linux-media, linux-arm-kernel
In-Reply-To: <20230418154351.GH30837@pendragon.ideasonboard.com>
Hi Laurent,
Am Dienstag, 18. April 2023, 17:43:51 CEST schrieb Laurent Pinchart:
> Hi Alexander,
>
> Thank you for the patch.
>
> In the subject line, "interlave" is misspelled. I'd write "Remove
> incorrect interlacing support"
Sounds much better, thanks. I'll change that.
> On Tue, Apr 18, 2023 at 02:20:39PM +0200, Alexander Stein wrote:
> > Interlaced mode is currently not supported, so disable fields in try_fmt.
>
> And here,
>
> The driver doesn't currently support interlacing, but due to legacy
> leftovers, it accepts values for the pixel format "field" field other
> than V4L2_FIELD_NONE. Fix it by hardcoding V4L2_FIELD_NONE. Proper
> interlacing support can be implemented later if desired.
>
> With this,
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> I can apply those changes directly to my tree if you would prefer
> avoiding a v4.
Thanks, as Patch 3/4 need another round anyway. I'll update accordingly and
resend.
Best regards,
Alexander
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> > Changes in v3:
> > * Remove left-over interlace mode check
> >
> > drivers/media/platform/nxp/imx7-media-csi.c | 15 +--------------
> > 1 file changed, 1 insertion(+), 14 deletions(-)
> >
> > diff --git a/drivers/media/platform/nxp/imx7-media-csi.c
> > b/drivers/media/platform/nxp/imx7-media-csi.c index
> > b149374b07ee1..1315f5743b76f 100644
> > --- a/drivers/media/platform/nxp/imx7-media-csi.c
> > +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> > @@ -1162,20 +1162,6 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format
> > *pixfmt,>
> > cc = imx7_csi_find_pixel_format(pixfmt->pixelformat);
> >
> > }
> >
> > - /* Allow IDMAC interweave but enforce field order from source. */
> > - if (V4L2_FIELD_IS_INTERLACED(pixfmt->field)) {
> > - switch (pixfmt->field) {
> > - case V4L2_FIELD_SEQ_TB:
> > - pixfmt->field = V4L2_FIELD_INTERLACED_TB;
> > - break;
> > - case V4L2_FIELD_SEQ_BT:
> > - pixfmt->field = V4L2_FIELD_INTERLACED_BT;
> > - break;
> > - default:
> > - break;
> > - }
> > - }
> > -
> >
> > /*
> >
> > * Round up width for minimum burst size.
> > *
> >
> > @@ -1187,6 +1173,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format
> > *pixfmt,>
> > pixfmt->bytesperline = pixfmt->width * cc->bpp / 8;
> > pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height;
> >
> > + pixfmt->field = V4L2_FIELD_NONE;
> >
> > return cc;
> >
> > }
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3 3/4] media: imx: imx7-media-csi: Lift width constraints for 8bpp formats
From: Alexander Stein @ 2023-04-19 7:01 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Rui Miguel Silva, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer,
Fabio Estevam, Pengutronix Kernel Team, NXP Linux Team,
linux-media, linux-arm-kernel
In-Reply-To: <20230418155947.GI30837@pendragon.ideasonboard.com>
Hi Laurent,
thanks for the feedback.
Am Dienstag, 18. April 2023, 17:59:47 CEST schrieb Laurent Pinchart:
> Hi Alexander,
>
> Thank you for the patch.
>
> The commit message should state "Lift width constraint for 16bpp
> formats".
To be pedantic it should be called "Lift width constraint for non-8bpp
formats" :)
> I would also phrase is "Relax" instead of "Lift" as it's not
> completely lifted.
That's true, this subtle difference should be accounted for. Thanks.
> On Tue, Apr 18, 2023 at 02:20:40PM +0200, Alexander Stein wrote:
> > For 8-bit formats the image_width just needs to be a multiple of 8 pixels
> > others just a multiple of 4 pixels.
>
> This is a bit terse, and I think a word or two are missing. It could be
> improved:
>
> The driver unconditionally aligns the image width to multiples of 8
> pixels. The real alignment constraint is 8 bytes, as indicated by the
> CSI_IMAG_PARA.IMAGE_WIDTH documentation that calls for 8 pixel alignment
> for 8bpp formats and 4 pixel alignment for other formats.
Thanks for this suggestion. This sounds much better.
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> > Changes in v3:
> > * Fix commit message (Only 8-bit formats needs multiple of 8 pixels)
> >
> > drivers/media/platform/nxp/imx7-media-csi.c | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/platform/nxp/imx7-media-csi.c
> > b/drivers/media/platform/nxp/imx7-media-csi.c index
> > 1315f5743b76f..730c9c57bf4bc 100644
> > --- a/drivers/media/platform/nxp/imx7-media-csi.c
> > +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> > @@ -1146,6 +1146,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format
> > *pixfmt,>
> > struct v4l2_rect *compose)
> >
> > {
> >
> > const struct imx7_csi_pixfmt *cc;
> >
> > + u32 walign;
> >
> > if (compose) {
> >
> > compose->width = pixfmt->width;
> >
> > @@ -1162,13 +1163,19 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format
> > *pixfmt,>
> > cc = imx7_csi_find_pixel_format(pixfmt->pixelformat);
> >
> > }
> >
> > + /* Refer to CSI_IMAG_PARA.IMAGE_WIDTH description */
> > + if (cc->bpp == 8)
> > + walign = 8;
> > + else
> > + walign = 4;
>
> Would the following convey the purpose better ?
>
> /*
> * The width alignment is 8 bytes as indicated by the
> * CSI_IMAG_PARA.IMAGE_WIDTH documentation. Convert it to pixels.
> */
> walign = 8 * 8 / cc->bpp;
I was wondering how to shorten this calculation without using ? operator,
nice.
> > +
> >
> > /*
> >
> > * Round up width for minimum burst size.
> > *
> > * TODO: Implement configurable stride support, and check what the
real
> > * hardware alignment constraint on the width is.
> > */
>
> We can now drop the second part of the sentence :-) The first line is
> actually not very accurate anymore. How about
>
> /*
> * The width alignment is 8 bytes as indicated by the
> * CSI_IMAG_PARA.IMAGE_WIDTH documentation. Convert it to pixels.
> *
> * TODO: Implement configurable stride support.
> */
> walign = 8 * 8 / cc->bpp;
> v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign,
> &pixfmt->height, 1, 0xffff, 1, 0);
That's neat, thanks. I'll update accordingly.
Best regards,
Alexander
> > - v4l_bound_align_image(&pixfmt->width, 1, 0xffff, 8,
> > + v4l_bound_align_image(&pixfmt->width, 1, 0xffff, walign,
> >
> > &pixfmt->height, 1, 0xffff, 1, 0);
> >
> > pixfmt->bytesperline = pixfmt->width * cc->bpp / 8;
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox