10 #include <linux/module.h>
11 #include <linux/types.h>
12 #include <linux/kernel.h>
14 #include <linux/slab.h>
24 #include <lantiq_soc.h>
47 static const char ltq_map_name[] =
"ltq_nor";
49 "cmdlinepart",
"ofpart",
NULL };
60 temp.
x[0] = *(
u16 *)(map->
virt + adr);
61 spin_unlock_irqrestore(&ebu_lock, flags);
74 spin_unlock_irqrestore(&ebu_lock, flags);
85 ltq_copy_from(
struct map_info *map,
void *to,
88 unsigned char *
f = (
unsigned char *)map->
virt + from;
89 unsigned char *
t = (
unsigned char *)to;
95 spin_unlock_irqrestore(&ebu_lock, flags);
99 ltq_copy_to(
struct map_info *map,
unsigned long to,
102 unsigned char *f = (
unsigned char *)from;
103 unsigned char *
t = (
unsigned char *)map->
virt + to;
109 spin_unlock_irqrestore(&ebu_lock, flags);
122 dev_err(&pdev->
dev,
"invalid bootstrap options\n");
126 ltq_mtd = kzalloc(
sizeof(
struct ltq_mtd),
GFP_KERNEL);
127 platform_set_drvdata(pdev, ltq_mtd);
131 dev_err(&pdev->
dev,
"failed to get memory resource\n");
137 ltq_mtd->
map->phys = ltq_mtd->
res->start;
138 ltq_mtd->
map->size = resource_size(ltq_mtd->
res);
140 if (!ltq_mtd->
map->virt) {
141 dev_err(&pdev->
dev,
"failed to remap mem resource\n");
146 ltq_mtd->
map->name = ltq_map_name;
147 ltq_mtd->
map->bankwidth = 2;
148 ltq_mtd->
map->read = ltq_read16;
149 ltq_mtd->
map->write = ltq_write16;
150 ltq_mtd->
map->copy_from = ltq_copy_from;
151 ltq_mtd->
map->copy_to = ltq_copy_to;
165 cfi = ltq_mtd->
map->fldrv_priv;
173 dev_err(&pdev->
dev,
"failed to add partitions\n");
191 struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev);
205 { .compatible =
"lantiq,nor" },
211 .probe = ltq_mtd_probe,
216 .of_match_table = ltq_mtd_match,