Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: extend clock struct with mapped_reg member

Add a "mapped_reg" member to struct clk and use that
to keep the ioremapped register based on enable_reg.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

authored by

Magnus Damm and committed by
Paul Mundt
eda2030a d4775356

+8 -2
+7 -2
drivers/sh/clk/core.c
··· 355 355 */ 356 356 if (!clk->parent) { 357 357 clk->mapping = &dummy_mapping; 358 - return 0; 358 + goto out; 359 359 } 360 360 361 361 /* ··· 384 384 } 385 385 386 386 clk->mapping = mapping; 387 + out: 388 + clk->mapped_reg = clk->mapping->base; 389 + clk->mapped_reg += (phys_addr_t)clk->enable_reg - clk->mapping->phys; 387 390 return 0; 388 391 } 389 392 ··· 405 402 406 403 /* Nothing to do */ 407 404 if (mapping == &dummy_mapping) 408 - return; 405 + goto out; 409 406 410 407 kref_put(&mapping->ref, clk_destroy_mapping); 411 408 clk->mapping = NULL; 409 + out: 410 + clk->mapped_reg = NULL; 412 411 } 413 412 414 413 int clk_register(struct clk *clk)
+1
include/linux/sh_clk.h
··· 49 49 50 50 void __iomem *enable_reg; 51 51 unsigned int enable_bit; 52 + void __iomem *mapped_reg; 52 53 53 54 unsigned long arch_flags; 54 55 void *priv;