Lines Matching +full:- +full:sram
2 * Allwinner SoCs SRAM Controller Driver
6 * Author: Maxime Ripard <maxime.ripard@free-electrons.com>
62 .data = SUNXI_SRAM_DATA("A3-A4", 0x4, 0x4, 2,
76 SUNXI_SRAM_MAP(1, 1, "usb-otg")),
87 .compatible = "allwinner,sun4i-a10-sram-a3-a4",
91 .compatible = "allwinner,sun4i-a10-sram-c1",
95 .compatible = "allwinner,sun4i-a10-sram-d",
99 .compatible = "allwinner,sun50i-a64-sram-c",
119 seq_puts(s, "Allwinner sunXi SRAM\n"); in sunxi_sram_show()
120 seq_puts(s, "--------------------\n\n"); in sunxi_sram_show()
122 for_each_child_of_node(sram_dev->of_node, sram_node) { in sunxi_sram_show()
125 seq_printf(s, "sram@%08x\n", in sunxi_sram_show()
132 sram_data = match->data; in sunxi_sram_show()
139 sram_data->name); in sunxi_sram_show()
141 val = readl(base + sram_data->reg); in sunxi_sram_show()
142 val >>= sram_data->offset; in sunxi_sram_show()
143 val &= GENMASK(sram_data->width - 1, 0); in sunxi_sram_show()
145 for (func = sram_data->func; func->func; func++) { in sunxi_sram_show()
146 seq_printf(s, "\t\t%s%c\n", func->func, in sunxi_sram_show()
147 func->reg_val == val ? in sunxi_sram_show()
175 ret = of_parse_phandle_with_fixed_args(node, "allwinner,sram", 1, 0, in sunxi_sram_of_parse()
181 ret = -EBUSY; in sunxi_sram_of_parse()
189 ret = -EINVAL; in sunxi_sram_of_parse()
193 data = match->data; in sunxi_sram_of_parse()
195 ret = -EINVAL; in sunxi_sram_of_parse()
199 for (func = data->func; func->func; func++) { in sunxi_sram_of_parse()
200 if (val == func->val) { in sunxi_sram_of_parse()
202 *reg_value = func->reg_val; in sunxi_sram_of_parse()
208 if (!func->func) { in sunxi_sram_of_parse()
209 ret = -EINVAL; in sunxi_sram_of_parse()
214 return match->data; in sunxi_sram_of_parse()
232 return -EPROBE_DEFER; in sunxi_sram_claim()
234 if (!dev || !dev->of_node) in sunxi_sram_claim()
235 return -EINVAL; in sunxi_sram_claim()
237 sram_data = sunxi_sram_of_parse(dev->of_node, &device); in sunxi_sram_claim()
245 if (sram_desc->claimed) { in sunxi_sram_claim()
247 return -EBUSY; in sunxi_sram_claim()
250 mask = GENMASK(sram_data->offset + sram_data->width - 1, in sunxi_sram_claim()
251 sram_data->offset); in sunxi_sram_claim()
252 val = readl(base + sram_data->reg); in sunxi_sram_claim()
254 writel(val | ((device << sram_data->offset) & mask), in sunxi_sram_claim()
255 base + sram_data->reg); in sunxi_sram_claim()
268 if (!dev || !dev->of_node) in sunxi_sram_release()
269 return -EINVAL; in sunxi_sram_release()
271 sram_data = sunxi_sram_of_parse(dev->of_node, NULL); in sunxi_sram_release()
273 return -EINVAL; in sunxi_sram_release()
278 sram_desc->claimed = false; in sunxi_sram_release()
328 sram_dev = &pdev->dev; in sunxi_sram_probe()
330 variant = of_device_get_match_data(&pdev->dev); in sunxi_sram_probe()
332 return -EINVAL; in sunxi_sram_probe()
335 base = devm_ioremap_resource(&pdev->dev, res); in sunxi_sram_probe()
339 of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); in sunxi_sram_probe()
341 d = debugfs_create_file("sram", S_IRUGO, NULL, NULL, in sunxi_sram_probe()
344 return -ENOMEM; in sunxi_sram_probe()
346 if (variant->has_emac_clock) { in sunxi_sram_probe()
347 emac_clock = devm_regmap_init_mmio(&pdev->dev, base, in sunxi_sram_probe()
359 .compatible = "allwinner,sun4i-a10-sram-controller",
363 .compatible = "allwinner,sun4i-a10-system-control",
367 .compatible = "allwinner,sun5i-a13-system-control",
371 .compatible = "allwinner,sun8i-a23-system-control",
375 .compatible = "allwinner,sun8i-h3-system-control",
379 .compatible = "allwinner,sun50i-a64-sram-controller",
383 .compatible = "allwinner,sun50i-a64-system-control",
387 .compatible = "allwinner,sun50i-h5-system-control",
396 .name = "sunxi-sram",
403 MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>");
404 MODULE_DESCRIPTION("Allwinner sunXi SRAM Controller Driver");