Commit e07fec60 authored by Linus Walleij's avatar Linus Walleij

ARM: integrator: Retire LM and IM-PD1 boardfile code

We now support probing and populating logical modules and
the IM-PD1 example module in particular directly from the
device tree using the LM bus driver.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent ccea5e8a
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
# Object file lists. # Object file lists.
obj-y := core.o lm.o obj-y := core.o
obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o
obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o
obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
#define IMPD1_LEDS 0x0c
#define IMPD1_INT 0x10
#define IMPD1_SW 0x14
#define IMPD1_CTRL 0x18
#define IMPD1_CTRL_DISP_LCD (0 << 0)
#define IMPD1_CTRL_DISP_VGA (1 << 0)
#define IMPD1_CTRL_DISP_LCD1 (2 << 0)
#define IMPD1_CTRL_DISP_ENABLE (1 << 2)
#define IMPD1_CTRL_DISP_MASK (7 << 0)
struct device;
void impd1_tweak_control(struct device *dev, u32 mask, u32 val);
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "hardware.h" #include "hardware.h"
#include "cm.h" #include "cm.h"
#include "common.h" #include "common.h"
#include "lm.h"
/* Regmap to the AP system controller */ /* Regmap to the AP system controller */
static struct regmap *ap_syscon_map; static struct regmap *ap_syscon_map;
...@@ -174,10 +173,7 @@ static const struct of_device_id ap_syscon_match[] = { ...@@ -174,10 +173,7 @@ static const struct of_device_id ap_syscon_match[] = {
static void __init ap_init_of(void) static void __init ap_init_of(void)
{ {
u32 sc_dec;
struct device_node *syscon; struct device_node *syscon;
int ret;
int i;
of_platform_default_populate(NULL, ap_auxdata_lookup, NULL); of_platform_default_populate(NULL, ap_auxdata_lookup, NULL);
...@@ -189,33 +185,6 @@ static void __init ap_init_of(void) ...@@ -189,33 +185,6 @@ static void __init ap_init_of(void)
pr_crit("could not find Integrator/AP system controller\n"); pr_crit("could not find Integrator/AP system controller\n");
return; return;
} }
ret = regmap_read(ap_syscon_map,
INTEGRATOR_SC_DEC_OFFSET,
&sc_dec);
if (ret) {
pr_crit("could not read from Integrator/AP syscon\n");
return;
}
for (i = 0; i < 4; i++) {
struct lm_device *lmdev;
if ((sc_dec & (16 << i)) == 0)
continue;
lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
if (!lmdev)
continue;
lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
lmdev->resource.flags = IORESOURCE_MEM;
lmdev->irq = irq_of_parse_and_map(syscon, i);
lmdev->id = i;
lm_device_register(lmdev);
}
} }
static const char * ap_dt_board_compat[] = { static const char * ap_dt_board_compat[] = {
......
// SPDX-License-Identifier: GPL-2.0-only
/*
* linux/arch/arm/mach-integrator/lm.c
*
* Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/slab.h>
#include "lm.h"
#define to_lm_device(d) container_of(d, struct lm_device, dev)
#define to_lm_driver(d) container_of(d, struct lm_driver, drv)
static int lm_match(struct device *dev, struct device_driver *drv)
{
return 1;
}
static int lm_bus_probe(struct device *dev)
{
struct lm_device *lmdev = to_lm_device(dev);
struct lm_driver *lmdrv = to_lm_driver(dev->driver);
return lmdrv->probe(lmdev);
}
static int lm_bus_remove(struct device *dev)
{
struct lm_device *lmdev = to_lm_device(dev);
struct lm_driver *lmdrv = to_lm_driver(dev->driver);
if (lmdrv->remove)
lmdrv->remove(lmdev);
return 0;
}
static struct bus_type lm_bustype = {
.name = "logicmodule",
.match = lm_match,
.probe = lm_bus_probe,
.remove = lm_bus_remove,
// .suspend = lm_bus_suspend,
// .resume = lm_bus_resume,
};
static int __init lm_init(void)
{
return bus_register(&lm_bustype);
}
postcore_initcall(lm_init);
int lm_driver_register(struct lm_driver *drv)
{
drv->drv.bus = &lm_bustype;
return driver_register(&drv->drv);
}
void lm_driver_unregister(struct lm_driver *drv)
{
driver_unregister(&drv->drv);
}
static void lm_device_release(struct device *dev)
{
struct lm_device *d = to_lm_device(dev);
kfree(d);
}
int lm_device_register(struct lm_device *dev)
{
int ret;
dev->dev.release = lm_device_release;
dev->dev.bus = &lm_bustype;
ret = dev_set_name(&dev->dev, "lm%d", dev->id);
if (ret)
return ret;
dev->resource.name = dev_name(&dev->dev);
ret = request_resource(&iomem_resource, &dev->resource);
if (ret == 0) {
ret = device_register(&dev->dev);
if (ret)
release_resource(&dev->resource);
}
return ret;
}
EXPORT_SYMBOL(lm_driver_register);
EXPORT_SYMBOL(lm_driver_unregister);
/* SPDX-License-Identifier: GPL-2.0 */
struct lm_device {
struct device dev;
struct resource resource;
unsigned int irq;
unsigned int id;
};
struct lm_driver {
struct device_driver drv;
int (*probe)(struct lm_device *);
void (*remove)(struct lm_device *);
int (*suspend)(struct lm_device *, pm_message_t);
int (*resume)(struct lm_device *);
};
int lm_driver_register(struct lm_driver *drv);
void lm_driver_unregister(struct lm_driver *drv);
int lm_device_register(struct lm_device *dev);
#define lm_get_drvdata(lm) dev_get_drvdata(&(lm)->dev)
#define lm_set_drvdata(lm,d) dev_set_drvdata(&(lm)->dev, d)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment