• Home
  • Raw
  • Download

Lines Matching refs:ctx

23 	void (*reg_write)(struct regmap_mmio_context *ctx,
25 unsigned int (*reg_read)(struct regmap_mmio_context *ctx,
71 static void regmap_mmio_write8(struct regmap_mmio_context *ctx, in regmap_mmio_write8() argument
75 writeb(val, ctx->regs + reg); in regmap_mmio_write8()
78 static void regmap_mmio_write16le(struct regmap_mmio_context *ctx, in regmap_mmio_write16le() argument
82 writew(val, ctx->regs + reg); in regmap_mmio_write16le()
85 static void regmap_mmio_write16be(struct regmap_mmio_context *ctx, in regmap_mmio_write16be() argument
89 iowrite16be(val, ctx->regs + reg); in regmap_mmio_write16be()
92 static void regmap_mmio_write32le(struct regmap_mmio_context *ctx, in regmap_mmio_write32le() argument
96 writel(val, ctx->regs + reg); in regmap_mmio_write32le()
99 static void regmap_mmio_write32be(struct regmap_mmio_context *ctx, in regmap_mmio_write32be() argument
103 iowrite32be(val, ctx->regs + reg); in regmap_mmio_write32be()
107 static void regmap_mmio_write64le(struct regmap_mmio_context *ctx, in regmap_mmio_write64le() argument
111 writeq(val, ctx->regs + reg); in regmap_mmio_write64le()
117 struct regmap_mmio_context *ctx = context; in regmap_mmio_write() local
120 if (!IS_ERR(ctx->clk)) { in regmap_mmio_write()
121 ret = clk_enable(ctx->clk); in regmap_mmio_write()
126 ctx->reg_write(ctx, reg, val); in regmap_mmio_write()
128 if (!IS_ERR(ctx->clk)) in regmap_mmio_write()
129 clk_disable(ctx->clk); in regmap_mmio_write()
134 static unsigned int regmap_mmio_read8(struct regmap_mmio_context *ctx, in regmap_mmio_read8() argument
137 return readb(ctx->regs + reg); in regmap_mmio_read8()
140 static unsigned int regmap_mmio_read16le(struct regmap_mmio_context *ctx, in regmap_mmio_read16le() argument
143 return readw(ctx->regs + reg); in regmap_mmio_read16le()
146 static unsigned int regmap_mmio_read16be(struct regmap_mmio_context *ctx, in regmap_mmio_read16be() argument
149 return ioread16be(ctx->regs + reg); in regmap_mmio_read16be()
152 static unsigned int regmap_mmio_read32le(struct regmap_mmio_context *ctx, in regmap_mmio_read32le() argument
155 return readl(ctx->regs + reg); in regmap_mmio_read32le()
158 static unsigned int regmap_mmio_read32be(struct regmap_mmio_context *ctx, in regmap_mmio_read32be() argument
161 return ioread32be(ctx->regs + reg); in regmap_mmio_read32be()
165 static unsigned int regmap_mmio_read64le(struct regmap_mmio_context *ctx, in regmap_mmio_read64le() argument
168 return readq(ctx->regs + reg); in regmap_mmio_read64le()
174 struct regmap_mmio_context *ctx = context; in regmap_mmio_read() local
177 if (!IS_ERR(ctx->clk)) { in regmap_mmio_read()
178 ret = clk_enable(ctx->clk); in regmap_mmio_read()
183 *val = ctx->reg_read(ctx, reg); in regmap_mmio_read()
185 if (!IS_ERR(ctx->clk)) in regmap_mmio_read()
186 clk_disable(ctx->clk); in regmap_mmio_read()
193 struct regmap_mmio_context *ctx = context; in regmap_mmio_free_context() local
195 if (!IS_ERR(ctx->clk)) { in regmap_mmio_free_context()
196 clk_unprepare(ctx->clk); in regmap_mmio_free_context()
197 if (!ctx->attached_clk) in regmap_mmio_free_context()
198 clk_put(ctx->clk); in regmap_mmio_free_context()
216 struct regmap_mmio_context *ctx; in regmap_mmio_gen_context() local
234 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); in regmap_mmio_gen_context()
235 if (!ctx) in regmap_mmio_gen_context()
238 ctx->regs = regs; in regmap_mmio_gen_context()
239 ctx->val_bytes = config->val_bits / 8; in regmap_mmio_gen_context()
240 ctx->clk = ERR_PTR(-ENODEV); in regmap_mmio_gen_context()
250 ctx->reg_read = regmap_mmio_read8; in regmap_mmio_gen_context()
251 ctx->reg_write = regmap_mmio_write8; in regmap_mmio_gen_context()
254 ctx->reg_read = regmap_mmio_read16le; in regmap_mmio_gen_context()
255 ctx->reg_write = regmap_mmio_write16le; in regmap_mmio_gen_context()
258 ctx->reg_read = regmap_mmio_read32le; in regmap_mmio_gen_context()
259 ctx->reg_write = regmap_mmio_write32le; in regmap_mmio_gen_context()
263 ctx->reg_read = regmap_mmio_read64le; in regmap_mmio_gen_context()
264 ctx->reg_write = regmap_mmio_write64le; in regmap_mmio_gen_context()
278 ctx->reg_read = regmap_mmio_read8; in regmap_mmio_gen_context()
279 ctx->reg_write = regmap_mmio_write8; in regmap_mmio_gen_context()
282 ctx->reg_read = regmap_mmio_read16be; in regmap_mmio_gen_context()
283 ctx->reg_write = regmap_mmio_write16be; in regmap_mmio_gen_context()
286 ctx->reg_read = regmap_mmio_read32be; in regmap_mmio_gen_context()
287 ctx->reg_write = regmap_mmio_write32be; in regmap_mmio_gen_context()
300 return ctx; in regmap_mmio_gen_context()
302 ctx->clk = clk_get(dev, clk_id); in regmap_mmio_gen_context()
303 if (IS_ERR(ctx->clk)) { in regmap_mmio_gen_context()
304 ret = PTR_ERR(ctx->clk); in regmap_mmio_gen_context()
308 ret = clk_prepare(ctx->clk); in regmap_mmio_gen_context()
310 clk_put(ctx->clk); in regmap_mmio_gen_context()
314 return ctx; in regmap_mmio_gen_context()
317 kfree(ctx); in regmap_mmio_gen_context()
328 struct regmap_mmio_context *ctx; in __regmap_init_mmio_clk() local
330 ctx = regmap_mmio_gen_context(dev, clk_id, regs, config); in __regmap_init_mmio_clk()
331 if (IS_ERR(ctx)) in __regmap_init_mmio_clk()
332 return ERR_CAST(ctx); in __regmap_init_mmio_clk()
334 return __regmap_init(dev, &regmap_mmio, ctx, config, in __regmap_init_mmio_clk()
346 struct regmap_mmio_context *ctx; in __devm_regmap_init_mmio_clk() local
348 ctx = regmap_mmio_gen_context(dev, clk_id, regs, config); in __devm_regmap_init_mmio_clk()
349 if (IS_ERR(ctx)) in __devm_regmap_init_mmio_clk()
350 return ERR_CAST(ctx); in __devm_regmap_init_mmio_clk()
352 return __devm_regmap_init(dev, &regmap_mmio, ctx, config, in __devm_regmap_init_mmio_clk()
359 struct regmap_mmio_context *ctx = map->bus_context; in regmap_mmio_attach_clk() local
361 ctx->clk = clk; in regmap_mmio_attach_clk()
362 ctx->attached_clk = true; in regmap_mmio_attach_clk()
364 return clk_prepare(ctx->clk); in regmap_mmio_attach_clk()
370 struct regmap_mmio_context *ctx = map->bus_context; in regmap_mmio_detach_clk() local
372 clk_unprepare(ctx->clk); in regmap_mmio_detach_clk()
374 ctx->attached_clk = false; in regmap_mmio_detach_clk()
375 ctx->clk = NULL; in regmap_mmio_detach_clk()