• Home
  • Raw
  • Download

Lines Matching +full:sun4i +full:- +full:a10 +full:- +full:sid

5  * Copyright (C) 2014 Maxime Ripard <maxime.ripard@free-electrons.com>
22 #include <linux/nvmem-provider.h>
29 /* Registers and special values for doing register-based SID readout on H3 */
39 .name = "sunxi-sid",
58 * uses 4 times more reads as needed but keeps code simpler. Since the SID is
61 static u8 sunxi_sid_read_byte(const struct sunxi_sid *sid, in sunxi_sid_read_byte() argument
66 sid_key = ioread32be(sid->base + round_down(offset, 4)); in sunxi_sid_read_byte()
75 struct sunxi_sid *sid = context; in sunxi_sid_read() local
78 /* Offset the read operation to the real position of SID */ in sunxi_sid_read()
79 offset += sid->value_offset; in sunxi_sid_read()
81 while (bytes--) in sunxi_sid_read()
82 *buf++ = sunxi_sid_read_byte(sid, offset++); in sunxi_sid_read()
87 static int sun8i_sid_register_readout(const struct sunxi_sid *sid, in sun8i_sid_register_readout() argument
98 writel(reg_val, sid->base + SUN8I_SID_PRCTL); in sun8i_sid_register_readout()
100 ret = readl_poll_timeout(sid->base + SUN8I_SID_PRCTL, reg_val, in sun8i_sid_register_readout()
106 *out = readl(sid->base + SUN8I_SID_RDKEY); in sun8i_sid_register_readout()
108 writel(0, sid->base + SUN8I_SID_PRCTL); in sun8i_sid_register_readout()
114 * On Allwinner H3, the value on the 0x200 offset of the SID controller seems
118 static int sun8i_sid_read_byte_by_reg(const struct sunxi_sid *sid, in sun8i_sid_read_byte_by_reg() argument
125 ret = sun8i_sid_register_readout(sid, offset & ~0x03, &word); in sun8i_sid_read_byte_by_reg()
138 struct sunxi_sid *sid = context; in sun8i_sid_read_by_reg() local
142 while (bytes--) { in sun8i_sid_read_by_reg()
143 ret = sun8i_sid_read_byte_by_reg(sid, offset++, buf++); in sun8i_sid_read_by_reg()
153 struct device *dev = &pdev->dev; in sunxi_sid_probe()
156 struct sunxi_sid *sid; in sunxi_sid_probe() local
161 sid = devm_kzalloc(dev, sizeof(*sid), GFP_KERNEL); in sunxi_sid_probe()
162 if (!sid) in sunxi_sid_probe()
163 return -ENOMEM; in sunxi_sid_probe()
167 return -EINVAL; in sunxi_sid_probe()
168 sid->value_offset = cfg->value_offset; in sunxi_sid_probe()
171 sid->base = devm_ioremap_resource(dev, res); in sunxi_sid_probe()
172 if (IS_ERR(sid->base)) in sunxi_sid_probe()
173 return PTR_ERR(sid->base); in sunxi_sid_probe()
175 size = cfg->size; in sunxi_sid_probe()
179 if (cfg->need_register_readout) in sunxi_sid_probe()
183 econfig.priv = sid; in sunxi_sid_probe()
190 ret = -EINVAL; in sunxi_sid_probe()
195 econfig.reg_read(sid, i, &randomness[i], 1); in sunxi_sid_probe()
236 { .compatible = "allwinner,sun4i-a10-sid", .data = &sun4i_a10_cfg },
237 { .compatible = "allwinner,sun7i-a20-sid", .data = &sun7i_a20_cfg },
238 { .compatible = "allwinner,sun8i-a83t-sid", .data = &sun50i_a64_cfg },
239 { .compatible = "allwinner,sun8i-h3-sid", .data = &sun8i_h3_cfg },
240 { .compatible = "allwinner,sun50i-a64-sid", .data = &sun50i_a64_cfg },
241 { .compatible = "allwinner,sun50i-h5-sid", .data = &sun50i_a64_cfg },
250 .name = "eeprom-sunxi-sid",