Re: [PATCH v4 1/3] gpio: mvebu: add pwm support for Armada 8K/7K
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Date: 2021-01-04 10:08:04
Also in:
linux-arm-kernel, linux-devicetree, linux-pwm
On Thu, Dec 10, 2020 at 02:15:58PM +0200, Baruch Siach wrote:
quoted hunk ↗ jump to hunk
@@ -781,51 +787,80 @@ static int mvebu_pwm_probe(struct platform_device *pdev, struct device *dev = &pdev->dev; struct mvebu_pwm *mvpwm; void __iomem *base; + u32 offset; u32 set; - if (!of_device_is_compatible(mvchip->chip.of_node, - "marvell,armada-370-gpio")) - return 0; - - /* - * There are only two sets of PWM configuration registers for - * all the GPIO lines on those SoCs which this driver reserves - * for the first two GPIO chips. So if the resource is missing - * we can't treat it as an error. - */ - if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm")) + if (of_device_is_compatible(mvchip->chip.of_node, + "marvell,armada-370-gpio")) { + /* + * There are only two sets of PWM configuration registers for + * all the GPIO lines on those SoCs which this driver reserves + * for the first two GPIO chips. So if the resource is missing + * we can't treat it as an error. + */ + if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm")) + return 0; + offset = 0; + } else if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) { + int ret = of_property_read_u32(dev->of_node, + "marvell,pwm-offset", &offset); + if (ret < 0) + return 0;
The reason my patches were rejected was because I was trying to keep compatibility with the existing DTs w.r.t the clock - and Uwe didn't like that. I notice that you keep compatibility by detecting the presence or absence of the marvell,pwm-offset property which achieves the same goal. Also, you are missing fixing a bug in the PWM register calculations for get_state(). -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!