Lines Matching +full:device +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",
105 static struct device *sram_dev;
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()
221 int sunxi_sram_claim(struct device *dev) in sunxi_sram_claim()
225 unsigned int device; in sunxi_sram_claim() local
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()
257 sram_desc->claimed = true; in sunxi_sram_claim()
264 void sunxi_sram_release(struct device *dev) in sunxi_sram_release()
269 if (!dev || !dev->of_node) in sunxi_sram_release()
272 sram_data = sunxi_sram_of_parse(dev->of_node, NULL); in sunxi_sram_release()
279 sram_desc->claimed = false; in sunxi_sram_release()
313 static bool sunxi_sram_regmap_accessible_reg(struct device *dev, in sunxi_sram_regmap_accessible_reg()
319 reg < SUNXI_SRAM_EMAC_CLOCK_REG + variant->num_emac_clocks * 4) in sunxi_sram_regmap_accessible_reg()
321 if (reg == SUNXI_SYS_LDO_CTRL_REG && variant->has_ldo_ctrl) in sunxi_sram_regmap_accessible_reg()
341 struct device *dev = &pdev->dev; in sunxi_sram_probe()
344 sram_dev = &pdev->dev; in sunxi_sram_probe()
346 variant = of_device_get_match_data(&pdev->dev); in sunxi_sram_probe()
348 return -EINVAL; in sunxi_sram_probe()
356 if (variant->num_emac_clocks || variant->has_ldo_ctrl) { in sunxi_sram_probe()
362 of_platform_populate(dev->of_node, NULL, NULL, dev); in sunxi_sram_probe()
364 debugfs_create_file("sram", 0444, NULL, NULL, &sunxi_sram_fops); in sunxi_sram_probe()
371 .compatible = "allwinner,sun4i-a10-sram-controller",
375 .compatible = "allwinner,sun4i-a10-system-control",
379 .compatible = "allwinner,sun5i-a13-system-control",
383 .compatible = "allwinner,sun8i-a23-system-control",
387 .compatible = "allwinner,sun8i-h3-system-control",
391 .compatible = "allwinner,sun20i-d1-system-control",
395 .compatible = "allwinner,sun50i-a64-sram-controller",
399 .compatible = "allwinner,sun50i-a64-system-control",
403 .compatible = "allwinner,sun50i-h5-system-control",
407 .compatible = "allwinner,sun50i-h616-system-control",
416 .name = "sunxi-sram",
422 MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>");
423 MODULE_DESCRIPTION("Allwinner sunXi SRAM Controller Driver");