diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 12:33:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 12:33:42 -0400 |
commit | 00ebb6382b8d9c7c15b5f8ad230670d8161d38dd (patch) | |
tree | 23591394b83776953aaf0b382d4c7b09e0ca1e34 /drivers/mmc/core/debugfs.c | |
parent | 11cc21f5f5575b9abd14d53a6055ccbf72b67573 (diff) | |
parent | 536ac998f6076a0ae423b1046b85d7690e8b7107 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (66 commits)
mmc: add new sdhci-pxa driver for Marvell SoCs
mmc: make number of mmcblk minors configurable
mmc_spi: Recover from CRC errors for r/w operation over SPI.
mmc: sdhci-pltfm: add -pltfm driver for imx35/51
mmc: sdhci-of-esdhc: factor out common stuff
mmc: sdhci_pltfm: pass more data on custom init call
mmc: sdhci: introduce get_ro private write-protect hook
mmc: sdhci-pltfm: move .h file into appropriate subdir
mmc: sdhci-pltfm: Add structure for host-specific data
mmc: fix cb710 kconfig dependency warning
mmc: cb710: remove debugging printk (info duplicated from mmc-core)
mmc: cb710: clear irq handler on init() error path
mmc: cb710: remove unnecessary msleep()
mmc: cb710: implement get_cd() callback
mmc: cb710: partially demystify clock selection
mmc: add a file to debugfs for changing host clock at runtime
mmc: sdhci: allow for eMMC 74 clock generation by controller
mmc: sdhci: highspeed: check for mmc as well as sd cards
mmc: sdhci: Add Moorestown device support
mmc: sdhci: Intel Medfield support
...
Diffstat (limited to 'drivers/mmc/core/debugfs.c')
-rw-r--r-- | drivers/mmc/core/debugfs.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 46bc6d7551a3..eed1405fd742 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c | |||
@@ -134,6 +134,33 @@ static const struct file_operations mmc_ios_fops = { | |||
134 | .release = single_release, | 134 | .release = single_release, |
135 | }; | 135 | }; |
136 | 136 | ||
137 | static int mmc_clock_opt_get(void *data, u64 *val) | ||
138 | { | ||
139 | struct mmc_host *host = data; | ||
140 | |||
141 | *val = host->ios.clock; | ||
142 | |||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | static int mmc_clock_opt_set(void *data, u64 val) | ||
147 | { | ||
148 | struct mmc_host *host = data; | ||
149 | |||
150 | /* We need this check due to input value is u64 */ | ||
151 | if (val > host->f_max) | ||
152 | return -EINVAL; | ||
153 | |||
154 | mmc_claim_host(host); | ||
155 | mmc_set_clock(host, (unsigned int) val); | ||
156 | mmc_release_host(host); | ||
157 | |||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | DEFINE_SIMPLE_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set, | ||
162 | "%llu\n"); | ||
163 | |||
137 | void mmc_add_host_debugfs(struct mmc_host *host) | 164 | void mmc_add_host_debugfs(struct mmc_host *host) |
138 | { | 165 | { |
139 | struct dentry *root; | 166 | struct dentry *root; |
@@ -150,11 +177,15 @@ void mmc_add_host_debugfs(struct mmc_host *host) | |||
150 | host->debugfs_root = root; | 177 | host->debugfs_root = root; |
151 | 178 | ||
152 | if (!debugfs_create_file("ios", S_IRUSR, root, host, &mmc_ios_fops)) | 179 | if (!debugfs_create_file("ios", S_IRUSR, root, host, &mmc_ios_fops)) |
153 | goto err_ios; | 180 | goto err_node; |
181 | |||
182 | if (!debugfs_create_file("clock", S_IRUSR | S_IWUSR, root, host, | ||
183 | &mmc_clock_fops)) | ||
184 | goto err_node; | ||
154 | 185 | ||
155 | return; | 186 | return; |
156 | 187 | ||
157 | err_ios: | 188 | err_node: |
158 | debugfs_remove_recursive(root); | 189 | debugfs_remove_recursive(root); |
159 | host->debugfs_root = NULL; | 190 | host->debugfs_root = NULL; |
160 | err_root: | 191 | err_root: |