* [PATCH 12/14] MTD: MIPS: lantiq: implement OF support
[not found] <1336133919-26525-1-git-send-email-blogic@openwrt.org>
@ 2012-05-04 12:18 ` John Crispin
2012-05-11 14:06 ` Artem Bityutskiy
2012-05-14 12:21 ` Artem Bityutskiy
0 siblings, 2 replies; 6+ messages in thread
From: John Crispin @ 2012-05-04 12:18 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, linux-mtd, John Crispin
Adds bindings for OF and make use of module_platform_driver for lantiq
based socs.
Signed-off-by: John Crispin <blogic@openwrt.org>
Cc: linux-mtd@lists.infradead.org
---
This patch is part of a series moving the mips/lantiq target to OF and clkdev
support. The patch, once Acked, should go upstream via Ralf's MIPS tree.
drivers/mtd/maps/lantiq-flash.c | 69 ++++++++++++++-------------------------
1 files changed, 25 insertions(+), 44 deletions(-)
diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
index b5401e3..aefa111 100644
--- a/drivers/mtd/maps/lantiq-flash.c
+++ b/drivers/mtd/maps/lantiq-flash.c
@@ -21,7 +21,6 @@
#include <linux/mtd/physmap.h>
#include <lantiq_soc.h>
-#include <lantiq_platform.h>
/*
* The NOR flash is connected to the same external bus unit (EBU) as PCI.
@@ -44,8 +43,9 @@ struct ltq_mtd {
struct map_info *map;
};
-static char ltq_map_name[] = "ltq_nor";
-static const char *ltq_probe_types[] __devinitconst = { "cmdlinepart", NULL };
+static const char ltq_map_name[] = "ltq_nor";
+static const char *ltq_probe_types[] __devinitconst = {
+ "cmdlinepart", "ofpart", NULL };
static map_word
ltq_read16(struct map_info *map, unsigned long adr)
@@ -108,12 +108,11 @@ ltq_copy_to(struct map_info *map, unsigned long to,
spin_unlock_irqrestore(&ebu_lock, flags);
}
-static int __init
+static int __devinit
ltq_mtd_probe(struct platform_device *pdev)
{
- struct physmap_flash_data *ltq_mtd_data = dev_get_platdata(&pdev->dev);
+ struct mtd_part_parser_data ppdata;
struct ltq_mtd *ltq_mtd;
- struct resource *res;
struct cfi_private *cfi;
int err;
@@ -122,28 +121,19 @@ ltq_mtd_probe(struct platform_device *pdev)
ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!ltq_mtd->res) {
- dev_err(&pdev->dev, "failed to get memory resource");
+ dev_err(&pdev->dev, "failed to get memory resource\n");
err = -ENOENT;
goto err_out;
}
- res = devm_request_mem_region(&pdev->dev, ltq_mtd->res->start,
- resource_size(ltq_mtd->res), dev_name(&pdev->dev));
- if (!ltq_mtd->res) {
- dev_err(&pdev->dev, "failed to request mem resource");
- err = -EBUSY;
- goto err_out;
- }
-
ltq_mtd->map = kzalloc(sizeof(struct map_info), GFP_KERNEL);
- ltq_mtd->map->phys = res->start;
- ltq_mtd->map->size = resource_size(res);
- ltq_mtd->map->virt = devm_ioremap_nocache(&pdev->dev,
- ltq_mtd->map->phys, ltq_mtd->map->size);
+ ltq_mtd->map->phys = ltq_mtd->res->start;
+ ltq_mtd->map->size = resource_size(ltq_mtd->res);
+ ltq_mtd->map->virt = devm_request_and_ioremap(&pdev->dev, ltq_mtd->res);
if (!ltq_mtd->map->virt) {
- dev_err(&pdev->dev, "failed to ioremap!\n");
- err = -ENOMEM;
- goto err_free;
+ dev_err(&pdev->dev, "failed to remap mem resource\n");
+ err = -EBUSY;
+ goto err_out;
}
ltq_mtd->map->name = ltq_map_name;
@@ -169,9 +159,9 @@ ltq_mtd_probe(struct platform_device *pdev)
cfi->addr_unlock1 ^= 1;
cfi->addr_unlock2 ^= 1;
- err = mtd_device_parse_register(ltq_mtd->mtd, ltq_probe_types, NULL,
- ltq_mtd_data->parts,
- ltq_mtd_data->nr_parts);
+ ppdata.of_node = pdev->dev.of_node;
+ err = mtd_device_parse_register(ltq_mtd->mtd, ltq_probe_types,
+ &ppdata, NULL, 0);
if (err) {
dev_err(&pdev->dev, "failed to add partitions\n");
goto err_destroy;
@@ -204,32 +194,23 @@ ltq_mtd_remove(struct platform_device *pdev)
return 0;
}
+static const struct of_device_id ltq_mtd_match[] = {
+ { .compatible = "lantiq,nor" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, ltq_mtd_match);
+
static struct platform_driver ltq_mtd_driver = {
+ .probe = ltq_mtd_probe,
.remove = __devexit_p(ltq_mtd_remove),
.driver = {
- .name = "ltq_nor",
+ .name = "ltq-nor",
.owner = THIS_MODULE,
+ .of_match_table = ltq_mtd_match,
},
};
-static int __init
-init_ltq_mtd(void)
-{
- int ret = platform_driver_probe(<q_mtd_driver, ltq_mtd_probe);
-
- if (ret)
- pr_err("ltq_nor: error registering platform driver");
- return ret;
-}
-
-static void __exit
-exit_ltq_mtd(void)
-{
- platform_driver_unregister(<q_mtd_driver);
-}
-
-module_init(init_ltq_mtd);
-module_exit(exit_ltq_mtd);
+module_platform_driver(ltq_mtd_driver);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
--
1.7.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 12/14] MTD: MIPS: lantiq: implement OF support
2012-05-11 14:06 ` Artem Bityutskiy
@ 2012-05-11 14:04 ` John Crispin
2012-05-11 14:16 ` Artem Bityutskiy
0 siblings, 1 reply; 6+ messages in thread
From: John Crispin @ 2012-05-11 14:04 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mips, linux-mtd, Ralf Baechle
On 11/05/12 16:06, Artem Bityutskiy wrote:
> On Fri, 2012-05-04 at 14:18 +0200, John Crispin wrote:
>> Adds bindings for OF and make use of module_platform_driver for lantiq
>> based socs.
>>
>> Signed-off-by: John Crispin <blogic@openwrt.org>
>> Cc: linux-mtd@lists.infradead.org
>> ---
>> This patch is part of a series moving the mips/lantiq target to OF and clkdev
>> support. The patch, once Acked, should go upstream via Ralf's MIPS tree.
> Looks ok, but could you please send me the entire series anyway, may be
> privately. I want to feed it to aiaiai and check before acking this
> patch. Also, please, make sure you add dependency on OF in Kconfig.
Hi Artem,
The lantiq platform selects USE_OF
config USE_OF
bool "Flattened Device Tree support"
select OF
select OF_EARLY_FLATTREE
select IRQ_DOMAIN
help
Include support for flattened device tree machine descriptions.
Do i still need an explicit dependency on OF in this case ?
Thanks,
John
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 12/14] MTD: MIPS: lantiq: implement OF support
2012-05-04 12:18 ` [PATCH 12/14] MTD: MIPS: lantiq: implement OF support John Crispin
@ 2012-05-11 14:06 ` Artem Bityutskiy
2012-05-11 14:04 ` John Crispin
2012-05-14 12:21 ` Artem Bityutskiy
1 sibling, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2012-05-11 14:06 UTC (permalink / raw)
To: John Crispin; +Cc: linux-mips, linux-mtd, Ralf Baechle
[-- Attachment #1: Type: text/plain, Size: 655 bytes --]
On Fri, 2012-05-04 at 14:18 +0200, John Crispin wrote:
> Adds bindings for OF and make use of module_platform_driver for lantiq
> based socs.
>
> Signed-off-by: John Crispin <blogic@openwrt.org>
> Cc: linux-mtd@lists.infradead.org
> ---
> This patch is part of a series moving the mips/lantiq target to OF and clkdev
> support. The patch, once Acked, should go upstream via Ralf's MIPS tree.
Looks ok, but could you please send me the entire series anyway, may be
privately. I want to feed it to aiaiai and check before acking this
patch. Also, please, make sure you add dependency on OF in Kconfig.
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 12/14] MTD: MIPS: lantiq: implement OF support
2012-05-11 14:04 ` John Crispin
@ 2012-05-11 14:16 ` Artem Bityutskiy
0 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2012-05-11 14:16 UTC (permalink / raw)
To: John Crispin; +Cc: linux-mips, linux-mtd, Ralf Baechle
[-- Attachment #1: Type: text/plain, Size: 485 bytes --]
On Fri, 2012-05-11 at 16:04 +0200, John Crispin wrote:
> The lantiq platform selects USE_OF
>
> config USE_OF
> bool "Flattened Device Tree support"
> select OF
> select OF_EARLY_FLATTREE
> select IRQ_DOMAIN
> help
> Include support for flattened device tree machine descriptions.
OK.
> Do i still need an explicit dependency on OF in this case ?
Not sure, but probably not.
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 12/14] MTD: MIPS: lantiq: implement OF support
2012-05-04 12:18 ` [PATCH 12/14] MTD: MIPS: lantiq: implement OF support John Crispin
2012-05-11 14:06 ` Artem Bityutskiy
@ 2012-05-14 12:21 ` Artem Bityutskiy
2012-05-14 12:31 ` John Crispin
1 sibling, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2012-05-14 12:21 UTC (permalink / raw)
To: John Crispin; +Cc: linux-mips, linux-mtd, Ralf Baechle
[-- Attachment #1: Type: text/plain, Size: 343 bytes --]
On Fri, 2012-05-04 at 14:18 +0200, John Crispin wrote:
> Adds bindings for OF and make use of module_platform_driver for lantiq
> based socs.
>
> Signed-off-by: John Crispin <blogic@openwrt.org>
> Cc: linux-mtd@lists.infradead.org
Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 12/14] MTD: MIPS: lantiq: implement OF support
2012-05-14 12:21 ` Artem Bityutskiy
@ 2012-05-14 12:31 ` John Crispin
0 siblings, 0 replies; 6+ messages in thread
From: John Crispin @ 2012-05-14 12:31 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mips, linux-mtd
On 14/05/12 14:21, Artem Bityutskiy wrote:
> On Fri, 2012-05-04 at 14:18 +0200, John Crispin wrote:
>> Adds bindings for OF and make use of module_platform_driver for lantiq
>> based socs.
>>
>> Signed-off-by: John Crispin <blogic@openwrt.org>
>> Cc: linux-mtd@lists.infradead.org
> Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
>
Thank you very much !
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-05-14 12:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1336133919-26525-1-git-send-email-blogic@openwrt.org>
2012-05-04 12:18 ` [PATCH 12/14] MTD: MIPS: lantiq: implement OF support John Crispin
2012-05-11 14:06 ` Artem Bityutskiy
2012-05-11 14:04 ` John Crispin
2012-05-11 14:16 ` Artem Bityutskiy
2012-05-14 12:21 ` Artem Bityutskiy
2012-05-14 12:31 ` John Crispin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).