Lines Matching +full:physmap +full:- +full:flash
1 // SPDX-License-Identifier: GPL-2.0-only
3 * rbtx4939-flash (based on physmap.c)
5 * This is a simplified physmap driver with map_init callback function.
34 if (info->mtd) { in rbtx4939_flash_remove()
35 mtd_device_unregister(info->mtd); in rbtx4939_flash_remove()
36 map_destroy(info->mtd); in rbtx4939_flash_remove()
53 pdata = dev_get_platdata(&dev->dev); in rbtx4939_flash_probe()
55 return -ENODEV; in rbtx4939_flash_probe()
59 return -ENODEV; in rbtx4939_flash_probe()
60 info = devm_kzalloc(&dev->dev, sizeof(struct rbtx4939_flash_info), in rbtx4939_flash_probe()
63 return -ENOMEM; in rbtx4939_flash_probe()
68 pr_notice("rbtx4939 platform flash device: %pR\n", res); in rbtx4939_flash_probe()
70 if (!devm_request_mem_region(&dev->dev, res->start, size, in rbtx4939_flash_probe()
71 dev_name(&dev->dev))) in rbtx4939_flash_probe()
72 return -EBUSY; in rbtx4939_flash_probe()
74 info->map.name = dev_name(&dev->dev); in rbtx4939_flash_probe()
75 info->map.phys = res->start; in rbtx4939_flash_probe()
76 info->map.size = size; in rbtx4939_flash_probe()
77 info->map.bankwidth = pdata->width; in rbtx4939_flash_probe()
79 info->map.virt = devm_ioremap(&dev->dev, info->map.phys, size); in rbtx4939_flash_probe()
80 if (!info->map.virt) in rbtx4939_flash_probe()
81 return -EBUSY; in rbtx4939_flash_probe()
83 if (pdata->map_init) in rbtx4939_flash_probe()
84 (*pdata->map_init)(&info->map); in rbtx4939_flash_probe()
86 simple_map_init(&info->map); in rbtx4939_flash_probe()
89 for (; !info->mtd && *probe_type; probe_type++) in rbtx4939_flash_probe()
90 info->mtd = do_map_probe(*probe_type, &info->map); in rbtx4939_flash_probe()
91 if (!info->mtd) { in rbtx4939_flash_probe()
92 dev_err(&dev->dev, "map_probe failed\n"); in rbtx4939_flash_probe()
93 err = -ENXIO; in rbtx4939_flash_probe()
96 info->mtd->dev.parent = &dev->dev; in rbtx4939_flash_probe()
97 err = mtd_device_register(info->mtd, pdata->parts, pdata->nr_parts); in rbtx4939_flash_probe()
113 if (mtd_suspend(info->mtd) == 0) in rbtx4939_flash_shutdown()
114 mtd_resume(info->mtd); in rbtx4939_flash_shutdown()
125 .name = "rbtx4939-flash",
133 MODULE_ALIAS("platform:rbtx4939-flash");