~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-w90x900/clock.c

Version: ~ [ linux-5.10-rc1 ] ~ [ linux-5.9.1 ] ~ [ linux-5.8.16 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.72 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.152 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.202 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.240 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.240 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * linux/arch/arm/mach-w90x900/clock.c
  3  *
  4  * Copyright (c) 2008 Nuvoton technology corporation
  5  *
  6  * Wan ZongShun <mcuos.com@gmail.com>
  7  *
  8  * This program is free software; you can redistribute it and/or modify
  9  * it under the terms of the GNU General Public License as published by
 10  * the Free Software Foundation; either version 2 of the License.
 11  */
 12 
 13 #include <linux/module.h>
 14 #include <linux/kernel.h>
 15 #include <linux/list.h>
 16 #include <linux/errno.h>
 17 #include <linux/err.h>
 18 #include <linux/string.h>
 19 #include <linux/clk.h>
 20 #include <linux/spinlock.h>
 21 #include <linux/platform_device.h>
 22 #include <linux/io.h>
 23 
 24 #include <mach/hardware.h>
 25 
 26 #include "clock.h"
 27 
 28 #define SUBCLK 0x24
 29 
 30 static DEFINE_SPINLOCK(clocks_lock);
 31 
 32 int clk_enable(struct clk *clk)
 33 {
 34         unsigned long flags;
 35 
 36         spin_lock_irqsave(&clocks_lock, flags);
 37         if (clk->enabled++ == 0)
 38                 (clk->enable)(clk, 1);
 39         spin_unlock_irqrestore(&clocks_lock, flags);
 40 
 41         return 0;
 42 }
 43 EXPORT_SYMBOL(clk_enable);
 44 
 45 void clk_disable(struct clk *clk)
 46 {
 47         unsigned long flags;
 48 
 49         if (!clk)
 50                 return;
 51 
 52         WARN_ON(clk->enabled == 0);
 53 
 54         spin_lock_irqsave(&clocks_lock, flags);
 55         if (--clk->enabled == 0)
 56                 (clk->enable)(clk, 0);
 57         spin_unlock_irqrestore(&clocks_lock, flags);
 58 }
 59 EXPORT_SYMBOL(clk_disable);
 60 
 61 unsigned long clk_get_rate(struct clk *clk)
 62 {
 63         return 15000000;
 64 }
 65 EXPORT_SYMBOL(clk_get_rate);
 66 
 67 void nuc900_clk_enable(struct clk *clk, int enable)
 68 {
 69         unsigned int clocks = clk->cken;
 70         unsigned long clken;
 71 
 72         clken = __raw_readl(W90X900_VA_CLKPWR);
 73 
 74         if (enable)
 75                 clken |= clocks;
 76         else
 77                 clken &= ~clocks;
 78 
 79         __raw_writel(clken, W90X900_VA_CLKPWR);
 80 }
 81 
 82 void nuc900_subclk_enable(struct clk *clk, int enable)
 83 {
 84         unsigned int clocks = clk->cken;
 85         unsigned long clken;
 86 
 87         clken = __raw_readl(W90X900_VA_CLKPWR + SUBCLK);
 88 
 89         if (enable)
 90                 clken |= clocks;
 91         else
 92                 clken &= ~clocks;
 93 
 94         __raw_writel(clken, W90X900_VA_CLKPWR + SUBCLK);
 95 }
 96 
 97 /* dummy functions, should not be called */
 98 long clk_round_rate(struct clk *clk, unsigned long rate)
 99 {
100         WARN_ON(clk);
101         return 0;
102 }
103 EXPORT_SYMBOL(clk_round_rate);
104 
105 int clk_set_rate(struct clk *clk, unsigned long rate)
106 {
107         WARN_ON(clk);
108         return 0;
109 }
110 EXPORT_SYMBOL(clk_set_rate);
111 
112 int clk_set_parent(struct clk *clk, struct clk *parent)
113 {
114         WARN_ON(clk);
115         return 0;
116 }
117 EXPORT_SYMBOL(clk_set_parent);
118 
119 struct clk *clk_get_parent(struct clk *clk)
120 {
121         WARN_ON(clk);
122         return NULL;
123 }
124 EXPORT_SYMBOL(clk_get_parent);
125 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp