Lines Matching refs:ltq_mtd
39 struct ltq_mtd { struct
111 struct ltq_mtd *ltq_mtd; in ltq_mtd_probe() local
115 ltq_mtd = devm_kzalloc(&pdev->dev, sizeof(struct ltq_mtd), GFP_KERNEL); in ltq_mtd_probe()
116 if (!ltq_mtd) in ltq_mtd_probe()
119 platform_set_drvdata(pdev, ltq_mtd); in ltq_mtd_probe()
121 ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); in ltq_mtd_probe()
122 if (!ltq_mtd->res) { in ltq_mtd_probe()
127 ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info), in ltq_mtd_probe()
129 if (!ltq_mtd->map) in ltq_mtd_probe()
132 ltq_mtd->map->phys = ltq_mtd->res->start; in ltq_mtd_probe()
133 ltq_mtd->map->size = resource_size(ltq_mtd->res); in ltq_mtd_probe()
134 ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res); in ltq_mtd_probe()
135 if (IS_ERR(ltq_mtd->map->virt)) in ltq_mtd_probe()
136 return PTR_ERR(ltq_mtd->map->virt); in ltq_mtd_probe()
138 ltq_mtd->map->name = ltq_map_name; in ltq_mtd_probe()
139 ltq_mtd->map->bankwidth = 2; in ltq_mtd_probe()
140 ltq_mtd->map->read = ltq_read16; in ltq_mtd_probe()
141 ltq_mtd->map->write = ltq_write16; in ltq_mtd_probe()
142 ltq_mtd->map->copy_from = ltq_copy_from; in ltq_mtd_probe()
143 ltq_mtd->map->copy_to = ltq_copy_to; in ltq_mtd_probe()
145 ltq_mtd->map->map_priv_1 = LTQ_NOR_PROBING; in ltq_mtd_probe()
146 ltq_mtd->mtd = do_map_probe("cfi_probe", ltq_mtd->map); in ltq_mtd_probe()
147 ltq_mtd->map->map_priv_1 = LTQ_NOR_NORMAL; in ltq_mtd_probe()
149 if (!ltq_mtd->mtd) { in ltq_mtd_probe()
154 ltq_mtd->mtd->dev.parent = &pdev->dev; in ltq_mtd_probe()
155 mtd_set_of_node(ltq_mtd->mtd, pdev->dev.of_node); in ltq_mtd_probe()
157 cfi = ltq_mtd->map->fldrv_priv; in ltq_mtd_probe()
161 err = mtd_device_register(ltq_mtd->mtd, NULL, 0); in ltq_mtd_probe()
170 map_destroy(ltq_mtd->mtd); in ltq_mtd_probe()
177 struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev); in ltq_mtd_remove() local
179 if (ltq_mtd && ltq_mtd->mtd) { in ltq_mtd_remove()
180 mtd_device_unregister(ltq_mtd->mtd); in ltq_mtd_remove()
181 map_destroy(ltq_mtd->mtd); in ltq_mtd_remove()