Lines Matching refs:efuse
84 static int sc27xx_efuse_lock(struct sc27xx_efuse *efuse) in sc27xx_efuse_lock() argument
88 mutex_lock(&efuse->mutex); in sc27xx_efuse_lock()
90 ret = hwspin_lock_timeout_raw(efuse->hwlock, in sc27xx_efuse_lock()
93 dev_err(efuse->dev, "timeout to get the hwspinlock\n"); in sc27xx_efuse_lock()
94 mutex_unlock(&efuse->mutex); in sc27xx_efuse_lock()
101 static void sc27xx_efuse_unlock(struct sc27xx_efuse *efuse) in sc27xx_efuse_unlock() argument
103 hwspin_unlock_raw(efuse->hwlock); in sc27xx_efuse_unlock()
104 mutex_unlock(&efuse->mutex); in sc27xx_efuse_unlock()
107 static int sc27xx_efuse_poll_status(struct sc27xx_efuse *efuse, u32 bits) in sc27xx_efuse_poll_status() argument
112 ret = regmap_read_poll_timeout(efuse->regmap, in sc27xx_efuse_poll_status()
113 efuse->base + SC27XX_EFUSE_STATUS, in sc27xx_efuse_poll_status()
118 dev_err(efuse->dev, "timeout to update the efuse status\n"); in sc27xx_efuse_poll_status()
127 struct sc27xx_efuse *efuse = context; in sc27xx_efuse_read() local
136 ret = sc27xx_efuse_lock(efuse); in sc27xx_efuse_read()
141 ret = regmap_update_bits(efuse->regmap, efuse->var_data->module_en, in sc27xx_efuse_read()
150 ret = sc27xx_efuse_poll_status(efuse, SC27XX_EFUSE_STANDBY); in sc27xx_efuse_read()
155 ret = regmap_write(efuse->regmap, in sc27xx_efuse_read()
156 efuse->base + SC27XX_EFUSE_BLOCK_INDEX, in sc27xx_efuse_read()
162 ret = regmap_update_bits(efuse->regmap, in sc27xx_efuse_read()
163 efuse->base + SC27XX_EFUSE_MODE_CTRL, in sc27xx_efuse_read()
173 ret = sc27xx_efuse_poll_status(efuse, SC27XX_EFUSE_RD_DONE); in sc27xx_efuse_read()
178 ret = regmap_read(efuse->regmap, efuse->base + SC27XX_EFUSE_DATA_RD, in sc27xx_efuse_read()
184 ret = regmap_update_bits(efuse->regmap, in sc27xx_efuse_read()
185 efuse->base + SC27XX_EFUSE_MODE_CTRL, in sc27xx_efuse_read()
191 regmap_update_bits(efuse->regmap, efuse->var_data->module_en, SC27XX_EFUSE_EN, 0); in sc27xx_efuse_read()
193 sc27xx_efuse_unlock(efuse); in sc27xx_efuse_read()
208 struct sc27xx_efuse *efuse; in sc27xx_efuse_probe() local
211 efuse = devm_kzalloc(&pdev->dev, sizeof(*efuse), GFP_KERNEL); in sc27xx_efuse_probe()
212 if (!efuse) in sc27xx_efuse_probe()
215 efuse->regmap = dev_get_regmap(pdev->dev.parent, NULL); in sc27xx_efuse_probe()
216 if (!efuse->regmap) { in sc27xx_efuse_probe()
221 ret = of_property_read_u32(np, "reg", &efuse->base); in sc27xx_efuse_probe()
233 efuse->hwlock = devm_hwspin_lock_request_specific(&pdev->dev, ret); in sc27xx_efuse_probe()
234 if (!efuse->hwlock) { in sc27xx_efuse_probe()
239 mutex_init(&efuse->mutex); in sc27xx_efuse_probe()
240 efuse->dev = &pdev->dev; in sc27xx_efuse_probe()
241 efuse->var_data = of_device_get_match_data(&pdev->dev); in sc27xx_efuse_probe()
249 econfig.priv = efuse; in sc27xx_efuse_probe()