Lines Matching +full:lock +full:- +full:offset

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright (c) 2015-2016 HiSilicon Technologies Co., Ltd.
11 #include <linux/reset-controller.h>
21 spinlock_t lock; member
33 u32 offset; in hisi_reset_of_xlate() local
36 offset = (reset_spec->args[0] << HISI_RESET_OFFSET_SHIFT) in hisi_reset_of_xlate()
38 bit = reset_spec->args[1] & HISI_RESET_BIT_MASK; in hisi_reset_of_xlate()
40 return (offset | bit); in hisi_reset_of_xlate()
48 u32 offset, reg; in hisi_reset_assert() local
51 offset = (id & HISI_RESET_OFFSET_MASK) >> HISI_RESET_OFFSET_SHIFT; in hisi_reset_assert()
54 spin_lock_irqsave(&rstc->lock, flags); in hisi_reset_assert()
56 reg = readl(rstc->membase + offset); in hisi_reset_assert()
57 writel(reg | BIT(bit), rstc->membase + offset); in hisi_reset_assert()
59 spin_unlock_irqrestore(&rstc->lock, flags); in hisi_reset_assert()
69 u32 offset, reg; in hisi_reset_deassert() local
72 offset = (id & HISI_RESET_OFFSET_MASK) >> HISI_RESET_OFFSET_SHIFT; in hisi_reset_deassert()
75 spin_lock_irqsave(&rstc->lock, flags); in hisi_reset_deassert()
77 reg = readl(rstc->membase + offset); in hisi_reset_deassert()
78 writel(reg & ~BIT(bit), rstc->membase + offset); in hisi_reset_deassert()
80 spin_unlock_irqrestore(&rstc->lock, flags); in hisi_reset_deassert()
94 rstc = devm_kmalloc(&pdev->dev, sizeof(*rstc), GFP_KERNEL); in hisi_reset_init()
98 rstc->membase = devm_platform_ioremap_resource(pdev, 0); in hisi_reset_init()
99 if (IS_ERR(rstc->membase)) in hisi_reset_init()
102 spin_lock_init(&rstc->lock); in hisi_reset_init()
103 rstc->rcdev.owner = THIS_MODULE; in hisi_reset_init()
104 rstc->rcdev.ops = &hisi_reset_ops; in hisi_reset_init()
105 rstc->rcdev.of_node = pdev->dev.of_node; in hisi_reset_init()
106 rstc->rcdev.of_reset_n_cells = 2; in hisi_reset_init()
107 rstc->rcdev.of_xlate = hisi_reset_of_xlate; in hisi_reset_init()
108 reset_controller_register(&rstc->rcdev); in hisi_reset_init()
116 reset_controller_unregister(&rstc->rcdev); in hisi_reset_exit()