Skip to content

Commit

Permalink
ARM: OMAP3: Fix errors for omap_l3_smx when booted with device tree
Browse files Browse the repository at this point in the history
When booting omap3 in device tree mode, we're currently getting
the following errors:

omap_l3_smx omap_l3_smx.0: couldn't request debug irq
omap_l3_smx: probe of omap_l3_smx.0 failed with error -22

This is because we don't have handling in the driver for the
compatible property and instead assume platform data being
passed.

Note that this binding is already documented, and implemented
for the related omap_l3_noc driver for omap4 and later. Looks
like the binding somehow never got never implemented for this
omap_l3_smx driver though.

Let's also remove __exit_p to allow binding and unbinding
of the driver while at it.

Reported-by: Pavel Machek <[email protected]>
Reported-by: Russell King <[email protected]>
Acked-by: Santosh Shilimkar <[email protected]>
Signed-off-by: Tony Lindgren <[email protected]>
  • Loading branch information
tmlind committed Nov 5, 2014
1 parent 0df1f24 commit aa25729
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion arch/arm/boot/dts/omap3.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
* hierarchy.
*/
ocp {
compatible = "simple-bus";
compatible = "ti,omap3-l3-smx", "simple-bus";
reg = <0x68000000 0x10000>;
interrupts = <9 10>;
#address-cells = <1>;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static int __init omap3_l3_init(void)
* To avoid code running on other OMAPs in
* multi-omap builds
*/
if (!(cpu_is_omap34xx()))
if (!(cpu_is_omap34xx()) || of_have_populated_dt())
return -ENODEV;

snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
Expand Down
26 changes: 21 additions & 5 deletions drivers/bus/omap_l3_smx.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>

#include "omap_l3_smx.h"

static inline u64 omap3_l3_readll(void __iomem *base, u16 reg)
Expand Down Expand Up @@ -211,7 +215,17 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
return ret;
}

static int __init omap3_l3_probe(struct platform_device *pdev)
#if IS_BUILTIN(CONFIG_OF)
static const struct of_device_id omap3_l3_match[] = {
{
.compatible = "ti,omap3-l3-smx",
},
{ },
};
MODULE_DEVICE_TABLE(of, omap3_l3_match);
#endif

static int omap3_l3_probe(struct platform_device *pdev)
{
struct omap3_l3 *l3;
struct resource *res;
Expand Down Expand Up @@ -265,7 +279,7 @@ static int __init omap3_l3_probe(struct platform_device *pdev)
return ret;
}

static int __exit omap3_l3_remove(struct platform_device *pdev)
static int omap3_l3_remove(struct platform_device *pdev)
{
struct omap3_l3 *l3 = platform_get_drvdata(pdev);

Expand All @@ -278,15 +292,17 @@ static int __exit omap3_l3_remove(struct platform_device *pdev)
}

static struct platform_driver omap3_l3_driver = {
.remove = __exit_p(omap3_l3_remove),
.probe = omap3_l3_probe,
.remove = omap3_l3_remove,
.driver = {
.name = "omap_l3_smx",
.name = "omap_l3_smx",
.of_match_table = of_match_ptr(omap3_l3_match),
},
};

static int __init omap3_l3_init(void)
{
return platform_driver_probe(&omap3_l3_driver, omap3_l3_probe);
return platform_driver_register(&omap3_l3_driver);
}
postcore_initcall_sync(omap3_l3_init);

Expand Down

0 comments on commit aa25729

Please sign in to comment.