Skip to content

Commit 348741a

Browse files
GseoCAlexandre Torgue
authored andcommitted
pinctrl: stm32: add firewall checks before probing the HDP driver
Because the HDP peripheral both depends on debug and firewall configuration, when CONFIG_STM32_FIREWALL is present, use the stm32 firewall framework to be able to check these configuration against the relevant controllers. Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Reviewed-by: Clément Le Goffic <legoffic.clement@gmail.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Link: https://lore.kernel.org/r/20260226-debug_bus-v6-12-5d794697798d@foss.st.com Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
1 parent f1939c6 commit 348741a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

drivers/pinctrl/stm32/pinctrl-stm32-hdp.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Author: Clément Le Goffic <clement.legoffic@foss.st.com> for STMicroelectronics.
55
*/
66
#include <linux/bits.h>
7+
#include <linux/bus/stm32_firewall_device.h>
78
#include <linux/clk.h>
89
#include <linux/gpio/driver.h>
910
#include <linux/gpio/generic.h>
@@ -46,9 +47,11 @@ struct stm32_hdp {
4647
void __iomem *base;
4748
struct clk *clk;
4849
struct pinctrl_dev *pctl_dev;
50+
struct stm32_firewall *firewall;
4951
struct gpio_generic_chip gpio_chip;
5052
u32 mux_conf;
5153
u32 gposet_conf;
54+
int nb_firewall_entries;
5255
const char * const *func_name;
5356
};
5457

@@ -615,6 +618,13 @@ static int stm32_hdp_probe(struct platform_device *pdev)
615618
return -ENOMEM;
616619
hdp->dev = dev;
617620

621+
if (IS_ENABLED(CONFIG_STM32_FIREWALL)) {
622+
err = stm32_firewall_get_grant_all_access(dev, &hdp->firewall,
623+
&hdp->nb_firewall_entries);
624+
if (err)
625+
return err;
626+
}
627+
618628
platform_set_drvdata(pdev, hdp);
619629

620630
hdp->base = devm_platform_ioremap_resource(pdev, 0);
@@ -670,8 +680,12 @@ static int stm32_hdp_probe(struct platform_device *pdev)
670680
static void stm32_hdp_remove(struct platform_device *pdev)
671681
{
672682
struct stm32_hdp *hdp = platform_get_drvdata(pdev);
683+
int i;
673684

674685
writel_relaxed(HDP_CTRL_DISABLE, hdp->base + HDP_CTRL);
686+
687+
for (i = 0; i < hdp->nb_firewall_entries; i++)
688+
stm32_firewall_release_access(&hdp->firewall[i]);
675689
}
676690

677691
static int stm32_hdp_suspend(struct device *dev)

0 commit comments

Comments
 (0)