Lines Matching +full:user +full:- +full:programmable
1 // SPDX-License-Identifier: GPL-2.0-only
2 /* sun_uflash.c - Driver for user-programmable flash on
5 * This driver does NOT provide access to the OBP-flash for
6 * safety reasons-- use <linux>/drivers/sbus/char/flash.c instead.
31 #define UFLASH_BUSWIDTH 1 /* EBus is 8-bit */
34 MODULE_DESCRIPTION("User-programmable flash device on Sun Microsystems boardsets");
45 .name = "SUNW,???-????",
54 if (op->resource[1].flags) { in uflash_devinit()
55 /* Non-CFI userflash device-- once I find one we in uflash_devinit()
59 dp, (unsigned long long)op->resource[0].start); in uflash_devinit()
61 return -ENODEV; in uflash_devinit()
66 return -ENOMEM; in uflash_devinit()
69 memcpy(&up->map, &uflash_map_templ, sizeof(uflash_map_templ)); in uflash_devinit()
71 up->map.size = resource_size(&op->resource[0]); in uflash_devinit()
73 up->name = of_get_property(dp, "model", NULL); in uflash_devinit()
74 if (up->name && 0 < strlen(up->name)) in uflash_devinit()
75 up->map.name = up->name; in uflash_devinit()
77 up->map.phys = op->resource[0].start; in uflash_devinit()
79 up->map.virt = of_ioremap(&op->resource[0], 0, up->map.size, in uflash_devinit()
81 if (!up->map.virt) { in uflash_devinit()
85 return -EINVAL; in uflash_devinit()
88 simple_map_init(&up->map); in uflash_devinit()
91 up->mtd = do_map_probe("cfi_probe", &up->map); in uflash_devinit()
92 if (!up->mtd) { in uflash_devinit()
93 of_iounmap(&op->resource[0], up->map.virt, up->map.size); in uflash_devinit()
96 return -ENXIO; in uflash_devinit()
99 up->mtd->owner = THIS_MODULE; in uflash_devinit()
101 mtd_device_register(up->mtd, NULL, 0); in uflash_devinit()
103 dev_set_drvdata(&op->dev, up); in uflash_devinit()
110 struct device_node *dp = op->dev.of_node; in uflash_probe()
112 /* Flashprom must have the "user" property in order to in uflash_probe()
115 if (!of_property_read_bool(dp, "user")) in uflash_probe()
116 return -ENODEV; in uflash_probe()
123 struct uflash_dev *up = dev_get_drvdata(&op->dev); in uflash_remove()
125 if (up->mtd) { in uflash_remove()
126 mtd_device_unregister(up->mtd); in uflash_remove()
127 map_destroy(up->mtd); in uflash_remove()
129 if (up->map.virt) { in uflash_remove()
130 of_iounmap(&op->resource[0], up->map.virt, up->map.size); in uflash_remove()
131 up->map.virt = NULL; in uflash_remove()