~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to drivers/mtd/maps/lantiq-flash.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <linux/mtd/cfi.h>
20
20
#include <linux/platform_device.h>
21
21
#include <linux/mtd/physmap.h>
 
22
#include <linux/of.h>
22
23
 
23
24
#include <lantiq_soc.h>
24
 
#include <lantiq_platform.h>
25
25
 
26
26
/*
27
27
 * The NOR flash is connected to the same external bus unit (EBU) as PCI.
44
44
        struct map_info *map;
45
45
};
46
46
 
47
 
static char ltq_map_name[] = "ltq_nor";
48
 
static const char *ltq_probe_types[] __devinitconst = { "cmdlinepart", NULL };
 
47
static const char ltq_map_name[] = "ltq_nor";
 
48
static const char *ltq_probe_types[] __devinitconst = {
 
49
                                        "cmdlinepart", "ofpart", NULL };
49
50
 
50
51
static map_word
51
52
ltq_read16(struct map_info *map, unsigned long adr)
108
109
        spin_unlock_irqrestore(&ebu_lock, flags);
109
110
}
110
111
 
111
 
static int __init
 
112
static int __devinit
112
113
ltq_mtd_probe(struct platform_device *pdev)
113
114
{
114
 
        struct physmap_flash_data *ltq_mtd_data = dev_get_platdata(&pdev->dev);
 
115
        struct mtd_part_parser_data ppdata;
115
116
        struct ltq_mtd *ltq_mtd;
116
 
        struct resource *res;
117
117
        struct cfi_private *cfi;
118
118
        int err;
119
119
 
 
120
        if (of_machine_is_compatible("lantiq,falcon") &&
 
121
                        (ltq_boot_select() != BS_FLASH)) {
 
122
                dev_err(&pdev->dev, "invalid bootstrap options\n");
 
123
                return -ENODEV;
 
124
        }
 
125
 
120
126
        ltq_mtd = kzalloc(sizeof(struct ltq_mtd), GFP_KERNEL);
121
127
        platform_set_drvdata(pdev, ltq_mtd);
122
128
 
123
129
        ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
124
130
        if (!ltq_mtd->res) {
125
 
                dev_err(&pdev->dev, "failed to get memory resource");
 
131
                dev_err(&pdev->dev, "failed to get memory resource\n");
126
132
                err = -ENOENT;
127
133
                goto err_out;
128
134
        }
129
135
 
130
 
        res = devm_request_mem_region(&pdev->dev, ltq_mtd->res->start,
131
 
                resource_size(ltq_mtd->res), dev_name(&pdev->dev));
132
 
        if (!ltq_mtd->res) {
133
 
                dev_err(&pdev->dev, "failed to request mem resource");
134
 
                err = -EBUSY;
135
 
                goto err_out;
136
 
        }
137
 
 
138
136
        ltq_mtd->map = kzalloc(sizeof(struct map_info), GFP_KERNEL);
139
 
        ltq_mtd->map->phys = res->start;
140
 
        ltq_mtd->map->size = resource_size(res);
141
 
        ltq_mtd->map->virt = devm_ioremap_nocache(&pdev->dev,
142
 
                                ltq_mtd->map->phys, ltq_mtd->map->size);
 
137
        ltq_mtd->map->phys = ltq_mtd->res->start;
 
138
        ltq_mtd->map->size = resource_size(ltq_mtd->res);
 
139
        ltq_mtd->map->virt = devm_request_and_ioremap(&pdev->dev, ltq_mtd->res);
143
140
        if (!ltq_mtd->map->virt) {
144
 
                dev_err(&pdev->dev, "failed to ioremap!\n");
145
 
                err = -ENOMEM;
146
 
                goto err_free;
 
141
                dev_err(&pdev->dev, "failed to remap mem resource\n");
 
142
                err = -EBUSY;
 
143
                goto err_out;
147
144
        }
148
145
 
149
146
        ltq_mtd->map->name = ltq_map_name;
169
166
        cfi->addr_unlock1 ^= 1;
170
167
        cfi->addr_unlock2 ^= 1;
171
168
 
172
 
        err = mtd_device_parse_register(ltq_mtd->mtd, ltq_probe_types, NULL,
173
 
                                        ltq_mtd_data->parts,
174
 
                                        ltq_mtd_data->nr_parts);
 
169
        ppdata.of_node = pdev->dev.of_node;
 
170
        err = mtd_device_parse_register(ltq_mtd->mtd, ltq_probe_types,
 
171
                                        &ppdata, NULL, 0);
175
172
        if (err) {
176
173
                dev_err(&pdev->dev, "failed to add partitions\n");
177
174
                goto err_destroy;
204
201
        return 0;
205
202
}
206
203
 
 
204
static const struct of_device_id ltq_mtd_match[] = {
 
205
        { .compatible = "lantiq,nor" },
 
206
        {},
 
207
};
 
208
MODULE_DEVICE_TABLE(of, ltq_mtd_match);
 
209
 
207
210
static struct platform_driver ltq_mtd_driver = {
 
211
        .probe = ltq_mtd_probe,
208
212
        .remove = __devexit_p(ltq_mtd_remove),
209
213
        .driver = {
210
 
                .name = "ltq_nor",
 
214
                .name = "ltq-nor",
211
215
                .owner = THIS_MODULE,
 
216
                .of_match_table = ltq_mtd_match,
212
217
        },
213
218
};
214
219
 
215
 
static int __init
216
 
init_ltq_mtd(void)
217
 
{
218
 
        int ret = platform_driver_probe(&ltq_mtd_driver, ltq_mtd_probe);
219
 
 
220
 
        if (ret)
221
 
                pr_err("ltq_nor: error registering platform driver");
222
 
        return ret;
223
 
}
224
 
 
225
 
static void __exit
226
 
exit_ltq_mtd(void)
227
 
{
228
 
        platform_driver_unregister(&ltq_mtd_driver);
229
 
}
230
 
 
231
 
module_init(init_ltq_mtd);
232
 
module_exit(exit_ltq_mtd);
 
220
module_platform_driver(ltq_mtd_driver);
233
221
 
234
222
MODULE_LICENSE("GPL");
235
223
MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");