Lines Matching +full:sun7i +full:- +full:a20 +full:- +full:sid
1 // SPDX-License-Identifier: GPL-2.0+
6 * Copyright (C) 2014 Maxime Ripard <maxime.ripard@free-electrons.com>
13 #include <linux/nvmem-provider.h>
19 /* Registers and special values for doing register-based SID readout on H3 */
42 struct sunxi_sid *sid = context; in sunxi_sid_read() local
46 __ioread32_copy(val, sid->base + sid->value_offset + offset, bytes / 4); in sunxi_sid_read()
56 word = readl_relaxed(sid->base + sid->value_offset + offset); in sunxi_sid_read()
62 static int sun8i_sid_register_readout(const struct sunxi_sid *sid, in sun8i_sid_register_readout() argument
73 writel(reg_val, sid->base + SUN8I_SID_PRCTL); in sun8i_sid_register_readout()
75 ret = readl_poll_timeout(sid->base + SUN8I_SID_PRCTL, reg_val, in sun8i_sid_register_readout()
81 *out = readl(sid->base + SUN8I_SID_RDKEY); in sun8i_sid_register_readout()
83 writel(0, sid->base + SUN8I_SID_PRCTL); in sun8i_sid_register_readout()
89 * On Allwinner H3, the value on the 0x200 offset of the SID controller seems
96 struct sunxi_sid *sid = context; in sun8i_sid_read_by_reg() local
102 ret = sun8i_sid_register_readout(sid, offset, val); in sun8i_sid_read_by_reg()
108 bytes -= 4; in sun8i_sid_read_by_reg()
115 ret = sun8i_sid_register_readout(sid, offset, &word); in sun8i_sid_read_by_reg()
126 struct device *dev = &pdev->dev; in sunxi_sid_probe()
129 struct sunxi_sid *sid; in sunxi_sid_probe() local
134 sid = devm_kzalloc(dev, sizeof(*sid), GFP_KERNEL); in sunxi_sid_probe()
135 if (!sid) in sunxi_sid_probe()
136 return -ENOMEM; in sunxi_sid_probe()
140 return -EINVAL; in sunxi_sid_probe()
141 sid->value_offset = cfg->value_offset; in sunxi_sid_probe()
143 sid->base = devm_platform_ioremap_resource(pdev, 0); in sunxi_sid_probe()
144 if (IS_ERR(sid->base)) in sunxi_sid_probe()
145 return PTR_ERR(sid->base); in sunxi_sid_probe()
147 size = cfg->size; in sunxi_sid_probe()
151 return -ENOMEM; in sunxi_sid_probe()
153 nvmem_cfg->dev = dev; in sunxi_sid_probe()
154 nvmem_cfg->name = "sunxi-sid"; in sunxi_sid_probe()
155 nvmem_cfg->type = NVMEM_TYPE_OTP; in sunxi_sid_probe()
156 nvmem_cfg->add_legacy_fixed_of_cells = true; in sunxi_sid_probe()
157 nvmem_cfg->read_only = true; in sunxi_sid_probe()
158 nvmem_cfg->size = cfg->size; in sunxi_sid_probe()
159 nvmem_cfg->word_size = 1; in sunxi_sid_probe()
160 nvmem_cfg->stride = 4; in sunxi_sid_probe()
161 nvmem_cfg->priv = sid; in sunxi_sid_probe()
162 if (cfg->need_register_readout) in sunxi_sid_probe()
163 nvmem_cfg->reg_read = sun8i_sid_read_by_reg; in sunxi_sid_probe()
165 nvmem_cfg->reg_read = sunxi_sid_read; in sunxi_sid_probe()
173 return -ENOMEM; in sunxi_sid_probe()
175 nvmem_cfg->reg_read(sid, 0, randomness, size); in sunxi_sid_probe()
209 { .compatible = "allwinner,sun4i-a10-sid", .data = &sun4i_a10_cfg },
210 { .compatible = "allwinner,sun7i-a20-sid", .data = &sun7i_a20_cfg },
211 { .compatible = "allwinner,sun8i-a83t-sid", .data = &sun50i_a64_cfg },
212 { .compatible = "allwinner,sun8i-h3-sid", .data = &sun8i_h3_cfg },
213 { .compatible = "allwinner,sun20i-d1-sid", .data = &sun50i_a64_cfg },
214 { .compatible = "allwinner,sun50i-a64-sid", .data = &sun50i_a64_cfg },
215 { .compatible = "allwinner,sun50i-h5-sid", .data = &sun50i_a64_cfg },
216 { .compatible = "allwinner,sun50i-h6-sid", .data = &sun50i_h6_cfg },
224 .name = "eeprom-sunxi-sid",