• Home
  • Raw
  • Download

Lines Matching refs:ctx

25 	void (*reg_write)(struct regmap_mmio_context *ctx,
27 unsigned int (*reg_read)(struct regmap_mmio_context *ctx,
65 static void regmap_mmio_write8(struct regmap_mmio_context *ctx, in regmap_mmio_write8() argument
69 writeb(val, ctx->regs + reg); in regmap_mmio_write8()
72 static void regmap_mmio_write8_relaxed(struct regmap_mmio_context *ctx, in regmap_mmio_write8_relaxed() argument
76 writeb_relaxed(val, ctx->regs + reg); in regmap_mmio_write8_relaxed()
79 static void regmap_mmio_iowrite8(struct regmap_mmio_context *ctx, in regmap_mmio_iowrite8() argument
82 iowrite8(val, ctx->regs + reg); in regmap_mmio_iowrite8()
85 static void regmap_mmio_write16le(struct regmap_mmio_context *ctx, in regmap_mmio_write16le() argument
89 writew(val, ctx->regs + reg); in regmap_mmio_write16le()
92 static void regmap_mmio_write16le_relaxed(struct regmap_mmio_context *ctx, in regmap_mmio_write16le_relaxed() argument
96 writew_relaxed(val, ctx->regs + reg); in regmap_mmio_write16le_relaxed()
99 static void regmap_mmio_iowrite16le(struct regmap_mmio_context *ctx, in regmap_mmio_iowrite16le() argument
102 iowrite16(val, ctx->regs + reg); in regmap_mmio_iowrite16le()
105 static void regmap_mmio_write16be(struct regmap_mmio_context *ctx, in regmap_mmio_write16be() argument
109 writew(swab16(val), ctx->regs + reg); in regmap_mmio_write16be()
112 static void regmap_mmio_iowrite16be(struct regmap_mmio_context *ctx, in regmap_mmio_iowrite16be() argument
115 iowrite16be(val, ctx->regs + reg); in regmap_mmio_iowrite16be()
118 static void regmap_mmio_write32le(struct regmap_mmio_context *ctx, in regmap_mmio_write32le() argument
122 writel(val, ctx->regs + reg); in regmap_mmio_write32le()
125 static void regmap_mmio_write32le_relaxed(struct regmap_mmio_context *ctx, in regmap_mmio_write32le_relaxed() argument
129 writel_relaxed(val, ctx->regs + reg); in regmap_mmio_write32le_relaxed()
132 static void regmap_mmio_iowrite32le(struct regmap_mmio_context *ctx, in regmap_mmio_iowrite32le() argument
135 iowrite32(val, ctx->regs + reg); in regmap_mmio_iowrite32le()
138 static void regmap_mmio_write32be(struct regmap_mmio_context *ctx, in regmap_mmio_write32be() argument
142 writel(swab32(val), ctx->regs + reg); in regmap_mmio_write32be()
145 static void regmap_mmio_iowrite32be(struct regmap_mmio_context *ctx, in regmap_mmio_iowrite32be() argument
148 iowrite32be(val, ctx->regs + reg); in regmap_mmio_iowrite32be()
153 struct regmap_mmio_context *ctx = context; in regmap_mmio_write() local
156 if (!IS_ERR(ctx->clk)) { in regmap_mmio_write()
157 ret = clk_enable(ctx->clk); in regmap_mmio_write()
162 ctx->reg_write(ctx, reg, val); in regmap_mmio_write()
164 if (!IS_ERR(ctx->clk)) in regmap_mmio_write()
165 clk_disable(ctx->clk); in regmap_mmio_write()
173 struct regmap_mmio_context *ctx = context; in regmap_mmio_noinc_write() local
177 if (!IS_ERR(ctx->clk)) { in regmap_mmio_noinc_write()
178 ret = clk_enable(ctx->clk); in regmap_mmio_noinc_write()
189 if (ctx->big_endian && (ctx->val_bytes > 1)) { in regmap_mmio_noinc_write()
190 switch (ctx->val_bytes) { in regmap_mmio_noinc_write()
195 writew(swab16(valp[i]), ctx->regs + reg); in regmap_mmio_noinc_write()
202 writel(swab32(valp[i]), ctx->regs + reg); in regmap_mmio_noinc_write()
211 switch (ctx->val_bytes) { in regmap_mmio_noinc_write()
213 writesb(ctx->regs + reg, (const u8 *)val, val_count); in regmap_mmio_noinc_write()
216 writesw(ctx->regs + reg, (const u16 *)val, val_count); in regmap_mmio_noinc_write()
219 writesl(ctx->regs + reg, (const u32 *)val, val_count); in regmap_mmio_noinc_write()
227 if (!IS_ERR(ctx->clk)) in regmap_mmio_noinc_write()
228 clk_disable(ctx->clk); in regmap_mmio_noinc_write()
233 static unsigned int regmap_mmio_read8(struct regmap_mmio_context *ctx, in regmap_mmio_read8() argument
236 return readb(ctx->regs + reg); in regmap_mmio_read8()
239 static unsigned int regmap_mmio_read8_relaxed(struct regmap_mmio_context *ctx, in regmap_mmio_read8_relaxed() argument
242 return readb_relaxed(ctx->regs + reg); in regmap_mmio_read8_relaxed()
245 static unsigned int regmap_mmio_ioread8(struct regmap_mmio_context *ctx, in regmap_mmio_ioread8() argument
248 return ioread8(ctx->regs + reg); in regmap_mmio_ioread8()
251 static unsigned int regmap_mmio_read16le(struct regmap_mmio_context *ctx, in regmap_mmio_read16le() argument
254 return readw(ctx->regs + reg); in regmap_mmio_read16le()
257 static unsigned int regmap_mmio_read16le_relaxed(struct regmap_mmio_context *ctx, in regmap_mmio_read16le_relaxed() argument
260 return readw_relaxed(ctx->regs + reg); in regmap_mmio_read16le_relaxed()
263 static unsigned int regmap_mmio_ioread16le(struct regmap_mmio_context *ctx, in regmap_mmio_ioread16le() argument
266 return ioread16(ctx->regs + reg); in regmap_mmio_ioread16le()
269 static unsigned int regmap_mmio_read16be(struct regmap_mmio_context *ctx, in regmap_mmio_read16be() argument
272 return swab16(readw(ctx->regs + reg)); in regmap_mmio_read16be()
275 static unsigned int regmap_mmio_ioread16be(struct regmap_mmio_context *ctx, in regmap_mmio_ioread16be() argument
278 return ioread16be(ctx->regs + reg); in regmap_mmio_ioread16be()
281 static unsigned int regmap_mmio_read32le(struct regmap_mmio_context *ctx, in regmap_mmio_read32le() argument
284 return readl(ctx->regs + reg); in regmap_mmio_read32le()
287 static unsigned int regmap_mmio_read32le_relaxed(struct regmap_mmio_context *ctx, in regmap_mmio_read32le_relaxed() argument
290 return readl_relaxed(ctx->regs + reg); in regmap_mmio_read32le_relaxed()
293 static unsigned int regmap_mmio_ioread32le(struct regmap_mmio_context *ctx, in regmap_mmio_ioread32le() argument
296 return ioread32(ctx->regs + reg); in regmap_mmio_ioread32le()
299 static unsigned int regmap_mmio_read32be(struct regmap_mmio_context *ctx, in regmap_mmio_read32be() argument
302 return swab32(readl(ctx->regs + reg)); in regmap_mmio_read32be()
305 static unsigned int regmap_mmio_ioread32be(struct regmap_mmio_context *ctx, in regmap_mmio_ioread32be() argument
308 return ioread32be(ctx->regs + reg); in regmap_mmio_ioread32be()
313 struct regmap_mmio_context *ctx = context; in regmap_mmio_read() local
316 if (!IS_ERR(ctx->clk)) { in regmap_mmio_read()
317 ret = clk_enable(ctx->clk); in regmap_mmio_read()
322 *val = ctx->reg_read(ctx, reg); in regmap_mmio_read()
324 if (!IS_ERR(ctx->clk)) in regmap_mmio_read()
325 clk_disable(ctx->clk); in regmap_mmio_read()
333 struct regmap_mmio_context *ctx = context; in regmap_mmio_noinc_read() local
336 if (!IS_ERR(ctx->clk)) { in regmap_mmio_noinc_read()
337 ret = clk_enable(ctx->clk); in regmap_mmio_noinc_read()
342 switch (ctx->val_bytes) { in regmap_mmio_noinc_read()
344 readsb(ctx->regs + reg, (u8 *)val, val_count); in regmap_mmio_noinc_read()
347 readsw(ctx->regs + reg, (u16 *)val, val_count); in regmap_mmio_noinc_read()
350 readsl(ctx->regs + reg, (u32 *)val, val_count); in regmap_mmio_noinc_read()
363 if (ctx->big_endian && (ctx->val_bytes > 1)) { in regmap_mmio_noinc_read()
364 switch (ctx->val_bytes) { in regmap_mmio_noinc_read()
378 if (!IS_ERR(ctx->clk)) in regmap_mmio_noinc_read()
379 clk_disable(ctx->clk); in regmap_mmio_noinc_read()
387 struct regmap_mmio_context *ctx = context; in regmap_mmio_free_context() local
389 if (!IS_ERR(ctx->clk)) { in regmap_mmio_free_context()
390 clk_unprepare(ctx->clk); in regmap_mmio_free_context()
391 if (!ctx->attached_clk) in regmap_mmio_free_context()
392 clk_put(ctx->clk); in regmap_mmio_free_context()
412 struct regmap_mmio_context *ctx; in regmap_mmio_gen_context() local
433 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); in regmap_mmio_gen_context()
434 if (!ctx) in regmap_mmio_gen_context()
437 ctx->regs = regs; in regmap_mmio_gen_context()
438 ctx->val_bytes = config->val_bits / 8; in regmap_mmio_gen_context()
439 ctx->clk = ERR_PTR(-ENODEV); in regmap_mmio_gen_context()
450 ctx->reg_read = regmap_mmio_ioread8; in regmap_mmio_gen_context()
451 ctx->reg_write = regmap_mmio_iowrite8; in regmap_mmio_gen_context()
453 ctx->reg_read = regmap_mmio_read8_relaxed; in regmap_mmio_gen_context()
454 ctx->reg_write = regmap_mmio_write8_relaxed; in regmap_mmio_gen_context()
456 ctx->reg_read = regmap_mmio_read8; in regmap_mmio_gen_context()
457 ctx->reg_write = regmap_mmio_write8; in regmap_mmio_gen_context()
462 ctx->reg_read = regmap_mmio_ioread16le; in regmap_mmio_gen_context()
463 ctx->reg_write = regmap_mmio_iowrite16le; in regmap_mmio_gen_context()
465 ctx->reg_read = regmap_mmio_read16le_relaxed; in regmap_mmio_gen_context()
466 ctx->reg_write = regmap_mmio_write16le_relaxed; in regmap_mmio_gen_context()
468 ctx->reg_read = regmap_mmio_read16le; in regmap_mmio_gen_context()
469 ctx->reg_write = regmap_mmio_write16le; in regmap_mmio_gen_context()
474 ctx->reg_read = regmap_mmio_ioread32le; in regmap_mmio_gen_context()
475 ctx->reg_write = regmap_mmio_iowrite32le; in regmap_mmio_gen_context()
477 ctx->reg_read = regmap_mmio_read32le_relaxed; in regmap_mmio_gen_context()
478 ctx->reg_write = regmap_mmio_write32le_relaxed; in regmap_mmio_gen_context()
480 ctx->reg_read = regmap_mmio_read32le; in regmap_mmio_gen_context()
481 ctx->reg_write = regmap_mmio_write32le; in regmap_mmio_gen_context()
493 ctx->big_endian = true; in regmap_mmio_gen_context()
497 ctx->reg_read = regmap_mmio_ioread8; in regmap_mmio_gen_context()
498 ctx->reg_write = regmap_mmio_iowrite8; in regmap_mmio_gen_context()
500 ctx->reg_read = regmap_mmio_read8; in regmap_mmio_gen_context()
501 ctx->reg_write = regmap_mmio_write8; in regmap_mmio_gen_context()
506 ctx->reg_read = regmap_mmio_ioread16be; in regmap_mmio_gen_context()
507 ctx->reg_write = regmap_mmio_iowrite16be; in regmap_mmio_gen_context()
509 ctx->reg_read = regmap_mmio_read16be; in regmap_mmio_gen_context()
510 ctx->reg_write = regmap_mmio_write16be; in regmap_mmio_gen_context()
515 ctx->reg_read = regmap_mmio_ioread32be; in regmap_mmio_gen_context()
516 ctx->reg_write = regmap_mmio_iowrite32be; in regmap_mmio_gen_context()
518 ctx->reg_read = regmap_mmio_read32be; in regmap_mmio_gen_context()
519 ctx->reg_write = regmap_mmio_write32be; in regmap_mmio_gen_context()
533 return ctx; in regmap_mmio_gen_context()
535 ctx->clk = clk_get(dev, clk_id); in regmap_mmio_gen_context()
536 if (IS_ERR(ctx->clk)) { in regmap_mmio_gen_context()
537 ret = PTR_ERR(ctx->clk); in regmap_mmio_gen_context()
541 ret = clk_prepare(ctx->clk); in regmap_mmio_gen_context()
543 clk_put(ctx->clk); in regmap_mmio_gen_context()
547 return ctx; in regmap_mmio_gen_context()
550 kfree(ctx); in regmap_mmio_gen_context()
561 struct regmap_mmio_context *ctx; in __regmap_init_mmio_clk() local
563 ctx = regmap_mmio_gen_context(dev, clk_id, regs, config); in __regmap_init_mmio_clk()
564 if (IS_ERR(ctx)) in __regmap_init_mmio_clk()
565 return ERR_CAST(ctx); in __regmap_init_mmio_clk()
567 return __regmap_init(dev, &regmap_mmio, ctx, config, in __regmap_init_mmio_clk()
579 struct regmap_mmio_context *ctx; in __devm_regmap_init_mmio_clk() local
581 ctx = regmap_mmio_gen_context(dev, clk_id, regs, config); in __devm_regmap_init_mmio_clk()
582 if (IS_ERR(ctx)) in __devm_regmap_init_mmio_clk()
583 return ERR_CAST(ctx); in __devm_regmap_init_mmio_clk()
585 return __devm_regmap_init(dev, &regmap_mmio, ctx, config, in __devm_regmap_init_mmio_clk()
592 struct regmap_mmio_context *ctx = map->bus_context; in regmap_mmio_attach_clk() local
594 ctx->clk = clk; in regmap_mmio_attach_clk()
595 ctx->attached_clk = true; in regmap_mmio_attach_clk()
597 return clk_prepare(ctx->clk); in regmap_mmio_attach_clk()
603 struct regmap_mmio_context *ctx = map->bus_context; in regmap_mmio_detach_clk() local
605 clk_unprepare(ctx->clk); in regmap_mmio_detach_clk()
607 ctx->attached_clk = false; in regmap_mmio_detach_clk()
608 ctx->clk = NULL; in regmap_mmio_detach_clk()