diff options
| author | Kevin Hilman <khilman@linaro.org> | 2014-12-15 16:59:43 -0500 |
|---|---|---|
| committer | Kevin Hilman <khilman@linaro.org> | 2014-12-15 16:59:43 -0500 |
| commit | 1888d2fa314033755026ceddee1fff8f80659fe4 (patch) | |
| tree | b0085323f5db6dca5f259b92038e27843c5a43a6 /drivers/base | |
| parent | 9d312cd12e89ce08add99fe66e8f6baeaca16d7d (diff) | |
| parent | 661ea91b676bcca137c1c3fe838997925ce98060 (diff) | |
Merge tag 'omap-for-v3.19/fixes-for-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes
From: Tony Lindgren <tony@atomide.com>
Subject: [GIT PULL] few fixes for the v3.19 merge window
Fixes for a few issues found that would be good to get
into -rc1:
- Update SoC revision detection for am43x es1.2
- Fix regression with GPMC timings on 2430sdp for some versions
of u-boot
- Fix dra7 watchdog compatible property
- Fix am437x-sk-evm LCD timings
- Fix dra7 DSS clock muxing
- Fix dra7-evm voltages
- Remove a unused function prototype for am33xx_clk_init
- Enable AHCI in the omap2plus_defconfig
* tag 'omap-for-v3.19/fixes-for-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: (1601 commits)
ARM: omap2plus_defconfig: Enable AHCI_PLATFORM driver
ARM: dts: am437x-sk-evm.dts: fix LCD timings
ARM: dts: dra7-evm: Update SMPS7 (VDD_CORE) max voltage to match DM
ARM: dts: dra7-evm: Fix typo in SMPS6 (VDD_GPU) max voltage
ARM: OMAP2+: AM43x: Add ID for ES1.2
ARM: dts: am437x-sk: fix lcd enable pin mux data
ARM: dts: Fix gpmc regression for omap 2430sdp smc91x
hwmon: (tmp401) Detect TMP435 on all addresses it supports
mfd: rtsx: Add func to split u32 into register
mmc: sdhci-msm: Convert to mmc_send_tuning()
mmc: sdhci-esdhc-imx: Convert to mmc_send_tuning()
mmc: core: Let mmc_send_tuning() to take struct mmc_host* as parameter
nios2: Make NIOS2_CMDLINE_IGNORE_DTB depend on CMDLINE_BOOL
nios2: Add missing NR_CPUS to Kconfig
nios2: asm-offsets: Remove unused definition TI_TASK
nios2: Remove write-only struct member from nios2_timer
nios2: Remove unused extern declaration of shm_align_mask
nios2: include linux/type.h in io.h
nios2: move include asm-generic/io.h to end of file
nios2: remove include asm-generic/iomap.h from io.h
...
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/regmap/Kconfig | 5 | ||||
| -rw-r--r-- | drivers/base/regmap/Makefile | 1 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache-flat.c | 2 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache-lzo.c | 2 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache-rbtree.c | 4 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache.c | 63 | ||||
| -rw-r--r-- | drivers/base/regmap/regmap-ac97.c | 114 |
7 files changed, 157 insertions, 34 deletions
diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig index 8a3f51f7b1b9..db9d00c36a3e 100644 --- a/drivers/base/regmap/Kconfig +++ b/drivers/base/regmap/Kconfig | |||
| @@ -3,12 +3,15 @@ | |||
| 3 | # subsystems should select the appropriate symbols. | 3 | # subsystems should select the appropriate symbols. |
| 4 | 4 | ||
| 5 | config REGMAP | 5 | config REGMAP |
| 6 | default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_MMIO || REGMAP_IRQ) | 6 | default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) |
| 7 | select LZO_COMPRESS | 7 | select LZO_COMPRESS |
| 8 | select LZO_DECOMPRESS | 8 | select LZO_DECOMPRESS |
| 9 | select IRQ_DOMAIN if REGMAP_IRQ | 9 | select IRQ_DOMAIN if REGMAP_IRQ |
| 10 | bool | 10 | bool |
| 11 | 11 | ||
| 12 | config REGMAP_AC97 | ||
| 13 | tristate | ||
| 14 | |||
| 12 | config REGMAP_I2C | 15 | config REGMAP_I2C |
| 13 | tristate | 16 | tristate |
| 14 | depends on I2C | 17 | depends on I2C |
diff --git a/drivers/base/regmap/Makefile b/drivers/base/regmap/Makefile index a7c670b4123a..0a533653ef3b 100644 --- a/drivers/base/regmap/Makefile +++ b/drivers/base/regmap/Makefile | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | obj-$(CONFIG_REGMAP) += regmap.o regcache.o | 1 | obj-$(CONFIG_REGMAP) += regmap.o regcache.o |
| 2 | obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o regcache-flat.o | 2 | obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o regcache-flat.o |
| 3 | obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o | 3 | obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o |
| 4 | obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o | ||
| 4 | obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o | 5 | obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o |
| 5 | obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o | 6 | obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o |
| 6 | obj-$(CONFIG_REGMAP_SPMI) += regmap-spmi.o | 7 | obj-$(CONFIG_REGMAP_SPMI) += regmap-spmi.o |
diff --git a/drivers/base/regmap/regcache-flat.c b/drivers/base/regmap/regcache-flat.c index d9762e41959b..0246f44ded74 100644 --- a/drivers/base/regmap/regcache-flat.c +++ b/drivers/base/regmap/regcache-flat.c | |||
| @@ -10,9 +10,9 @@ | |||
| 10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/slab.h> | ||
| 14 | #include <linux/device.h> | 13 | #include <linux/device.h> |
| 15 | #include <linux/seq_file.h> | 14 | #include <linux/seq_file.h> |
| 15 | #include <linux/slab.h> | ||
| 16 | 16 | ||
| 17 | #include "internal.h" | 17 | #include "internal.h" |
| 18 | 18 | ||
diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c index e210a6d1406a..2d53f6f138e1 100644 --- a/drivers/base/regmap/regcache-lzo.c +++ b/drivers/base/regmap/regcache-lzo.c | |||
| @@ -10,9 +10,9 @@ | |||
| 10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/slab.h> | ||
| 14 | #include <linux/device.h> | 13 | #include <linux/device.h> |
| 15 | #include <linux/lzo.h> | 14 | #include <linux/lzo.h> |
| 15 | #include <linux/slab.h> | ||
| 16 | 16 | ||
| 17 | #include "internal.h" | 17 | #include "internal.h" |
| 18 | 18 | ||
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index f3e8fe0cc650..d453a2c98ad0 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
| @@ -10,11 +10,11 @@ | |||
| 10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/slab.h> | ||
| 14 | #include <linux/device.h> | ||
| 15 | #include <linux/debugfs.h> | 13 | #include <linux/debugfs.h> |
| 14 | #include <linux/device.h> | ||
| 16 | #include <linux/rbtree.h> | 15 | #include <linux/rbtree.h> |
| 17 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
| 17 | #include <linux/slab.h> | ||
| 18 | 18 | ||
| 19 | #include "internal.h" | 19 | #include "internal.h" |
| 20 | 20 | ||
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index f1280dc356d0..f373c35f9e1d 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
| @@ -10,12 +10,12 @@ | |||
| 10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/slab.h> | ||
| 14 | #include <linux/export.h> | ||
| 15 | #include <linux/device.h> | ||
| 16 | #include <trace/events/regmap.h> | ||
| 17 | #include <linux/bsearch.h> | 13 | #include <linux/bsearch.h> |
| 14 | #include <linux/device.h> | ||
| 15 | #include <linux/export.h> | ||
| 16 | #include <linux/slab.h> | ||
| 18 | #include <linux/sort.h> | 17 | #include <linux/sort.h> |
| 18 | #include <trace/events/regmap.h> | ||
| 19 | 19 | ||
| 20 | #include "internal.h" | 20 | #include "internal.h" |
| 21 | 21 | ||
| @@ -36,6 +36,23 @@ static int regcache_hw_init(struct regmap *map) | |||
| 36 | if (!map->num_reg_defaults_raw) | 36 | if (!map->num_reg_defaults_raw) |
| 37 | return -EINVAL; | 37 | return -EINVAL; |
| 38 | 38 | ||
| 39 | /* calculate the size of reg_defaults */ | ||
| 40 | for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) | ||
| 41 | if (!regmap_volatile(map, i * map->reg_stride)) | ||
| 42 | count++; | ||
| 43 | |||
| 44 | /* all registers are volatile, so just bypass */ | ||
| 45 | if (!count) { | ||
| 46 | map->cache_bypass = true; | ||
| 47 | return 0; | ||
| 48 | } | ||
| 49 | |||
| 50 | map->num_reg_defaults = count; | ||
| 51 | map->reg_defaults = kmalloc_array(count, sizeof(struct reg_default), | ||
| 52 | GFP_KERNEL); | ||
| 53 | if (!map->reg_defaults) | ||
| 54 | return -ENOMEM; | ||
| 55 | |||
| 39 | if (!map->reg_defaults_raw) { | 56 | if (!map->reg_defaults_raw) { |
| 40 | u32 cache_bypass = map->cache_bypass; | 57 | u32 cache_bypass = map->cache_bypass; |
| 41 | dev_warn(map->dev, "No cache defaults, reading back from HW\n"); | 58 | dev_warn(map->dev, "No cache defaults, reading back from HW\n"); |
| @@ -43,40 +60,25 @@ static int regcache_hw_init(struct regmap *map) | |||
| 43 | /* Bypass the cache access till data read from HW*/ | 60 | /* Bypass the cache access till data read from HW*/ |
| 44 | map->cache_bypass = 1; | 61 | map->cache_bypass = 1; |
| 45 | tmp_buf = kmalloc(map->cache_size_raw, GFP_KERNEL); | 62 | tmp_buf = kmalloc(map->cache_size_raw, GFP_KERNEL); |
| 46 | if (!tmp_buf) | 63 | if (!tmp_buf) { |
| 47 | return -EINVAL; | 64 | ret = -ENOMEM; |
| 65 | goto err_free; | ||
| 66 | } | ||
| 48 | ret = regmap_raw_read(map, 0, tmp_buf, | 67 | ret = regmap_raw_read(map, 0, tmp_buf, |
| 49 | map->num_reg_defaults_raw); | 68 | map->num_reg_defaults_raw); |
| 50 | map->cache_bypass = cache_bypass; | 69 | map->cache_bypass = cache_bypass; |
| 51 | if (ret < 0) { | 70 | if (ret < 0) |
| 52 | kfree(tmp_buf); | 71 | goto err_cache_free; |
| 53 | return ret; | 72 | |
| 54 | } | ||
| 55 | map->reg_defaults_raw = tmp_buf; | 73 | map->reg_defaults_raw = tmp_buf; |
| 56 | map->cache_free = 1; | 74 | map->cache_free = 1; |
| 57 | } | 75 | } |
| 58 | 76 | ||
| 59 | /* calculate the size of reg_defaults */ | ||
| 60 | for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) { | ||
| 61 | val = regcache_get_val(map, map->reg_defaults_raw, i); | ||
| 62 | if (regmap_volatile(map, i * map->reg_stride)) | ||
| 63 | continue; | ||
| 64 | count++; | ||
| 65 | } | ||
| 66 | |||
| 67 | map->reg_defaults = kmalloc(count * sizeof(struct reg_default), | ||
| 68 | GFP_KERNEL); | ||
| 69 | if (!map->reg_defaults) { | ||
| 70 | ret = -ENOMEM; | ||
| 71 | goto err_free; | ||
| 72 | } | ||
| 73 | |||
| 74 | /* fill the reg_defaults */ | 77 | /* fill the reg_defaults */ |
| 75 | map->num_reg_defaults = count; | ||
| 76 | for (i = 0, j = 0; i < map->num_reg_defaults_raw; i++) { | 78 | for (i = 0, j = 0; i < map->num_reg_defaults_raw; i++) { |
| 77 | val = regcache_get_val(map, map->reg_defaults_raw, i); | ||
| 78 | if (regmap_volatile(map, i * map->reg_stride)) | 79 | if (regmap_volatile(map, i * map->reg_stride)) |
| 79 | continue; | 80 | continue; |
| 81 | val = regcache_get_val(map, map->reg_defaults_raw, i); | ||
| 80 | map->reg_defaults[j].reg = i * map->reg_stride; | 82 | map->reg_defaults[j].reg = i * map->reg_stride; |
| 81 | map->reg_defaults[j].def = val; | 83 | map->reg_defaults[j].def = val; |
| 82 | j++; | 84 | j++; |
| @@ -84,9 +86,10 @@ static int regcache_hw_init(struct regmap *map) | |||
| 84 | 86 | ||
| 85 | return 0; | 87 | return 0; |
| 86 | 88 | ||
| 89 | err_cache_free: | ||
| 90 | kfree(tmp_buf); | ||
| 87 | err_free: | 91 | err_free: |
| 88 | if (map->cache_free) | 92 | kfree(map->reg_defaults); |
| 89 | kfree(map->reg_defaults_raw); | ||
| 90 | 93 | ||
| 91 | return ret; | 94 | return ret; |
| 92 | } | 95 | } |
| @@ -150,6 +153,8 @@ int regcache_init(struct regmap *map, const struct regmap_config *config) | |||
| 150 | ret = regcache_hw_init(map); | 153 | ret = regcache_hw_init(map); |
| 151 | if (ret < 0) | 154 | if (ret < 0) |
| 152 | return ret; | 155 | return ret; |
| 156 | if (map->cache_bypass) | ||
| 157 | return 0; | ||
| 153 | } | 158 | } |
| 154 | 159 | ||
| 155 | if (!map->max_register) | 160 | if (!map->max_register) |
diff --git a/drivers/base/regmap/regmap-ac97.c b/drivers/base/regmap/regmap-ac97.c new file mode 100644 index 000000000000..e4c45d2299c1 --- /dev/null +++ b/drivers/base/regmap/regmap-ac97.c | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | /* | ||
| 2 | * Register map access API - AC'97 support | ||
| 3 | * | ||
| 4 | * Copyright 2013 Linaro Ltd. All rights reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms and conditions of the GNU General Public License, | ||
| 8 | * version 2, as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | * more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/clk.h> | ||
| 20 | #include <linux/err.h> | ||
| 21 | #include <linux/init.h> | ||
| 22 | #include <linux/io.h> | ||
| 23 | #include <linux/module.h> | ||
| 24 | #include <linux/regmap.h> | ||
| 25 | #include <linux/slab.h> | ||
| 26 | |||
| 27 | #include <sound/ac97_codec.h> | ||
| 28 | |||
| 29 | bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg) | ||
| 30 | { | ||
| 31 | switch (reg) { | ||
| 32 | case AC97_RESET: | ||
| 33 | case AC97_POWERDOWN: | ||
| 34 | case AC97_INT_PAGING: | ||
| 35 | case AC97_EXTENDED_ID: | ||
| 36 | case AC97_EXTENDED_STATUS: | ||
| 37 | case AC97_EXTENDED_MID: | ||
| 38 | case AC97_EXTENDED_MSTATUS: | ||
| 39 | case AC97_GPIO_STATUS: | ||
| 40 | case AC97_MISC_AFE: | ||
| 41 | case AC97_VENDOR_ID1: | ||
| 42 | case AC97_VENDOR_ID2: | ||
| 43 | case AC97_CODEC_CLASS_REV: | ||
| 44 | case AC97_PCI_SVID: | ||
| 45 | case AC97_PCI_SID: | ||
| 46 | case AC97_FUNC_SELECT: | ||
| 47 | case AC97_FUNC_INFO: | ||
| 48 | case AC97_SENSE_INFO: | ||
| 49 | return true; | ||
| 50 | default: | ||
| 51 | return false; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | EXPORT_SYMBOL_GPL(regmap_ac97_default_volatile); | ||
| 55 | |||
| 56 | static int regmap_ac97_reg_read(void *context, unsigned int reg, | ||
| 57 | unsigned int *val) | ||
| 58 | { | ||
| 59 | struct snd_ac97 *ac97 = context; | ||
| 60 | |||
| 61 | *val = ac97->bus->ops->read(ac97, reg); | ||
| 62 | |||
| 63 | return 0; | ||
| 64 | } | ||
| 65 | |||
| 66 | static int regmap_ac97_reg_write(void *context, unsigned int reg, | ||
| 67 | unsigned int val) | ||
| 68 | { | ||
| 69 | struct snd_ac97 *ac97 = context; | ||
| 70 | |||
| 71 | ac97->bus->ops->write(ac97, reg, val); | ||
| 72 | |||
| 73 | return 0; | ||
| 74 | } | ||
| 75 | |||
| 76 | static const struct regmap_bus ac97_regmap_bus = { | ||
| 77 | .reg_write = regmap_ac97_reg_write, | ||
| 78 | .reg_read = regmap_ac97_reg_read, | ||
| 79 | }; | ||
| 80 | |||
| 81 | /** | ||
| 82 | * regmap_init_ac97(): Initialise AC'97 register map | ||
| 83 | * | ||
| 84 | * @ac97: Device that will be interacted with | ||
| 85 | * @config: Configuration for register map | ||
| 86 | * | ||
| 87 | * The return value will be an ERR_PTR() on error or a valid pointer to | ||
| 88 | * a struct regmap. | ||
| 89 | */ | ||
| 90 | struct regmap *regmap_init_ac97(struct snd_ac97 *ac97, | ||
| 91 | const struct regmap_config *config) | ||
| 92 | { | ||
| 93 | return regmap_init(&ac97->dev, &ac97_regmap_bus, ac97, config); | ||
| 94 | } | ||
| 95 | EXPORT_SYMBOL_GPL(regmap_init_ac97); | ||
| 96 | |||
| 97 | /** | ||
| 98 | * devm_regmap_init_ac97(): Initialise AC'97 register map | ||
| 99 | * | ||
| 100 | * @ac97: Device that will be interacted with | ||
| 101 | * @config: Configuration for register map | ||
| 102 | * | ||
| 103 | * The return value will be an ERR_PTR() on error or a valid pointer | ||
| 104 | * to a struct regmap. The regmap will be automatically freed by the | ||
| 105 | * device management code. | ||
| 106 | */ | ||
| 107 | struct regmap *devm_regmap_init_ac97(struct snd_ac97 *ac97, | ||
| 108 | const struct regmap_config *config) | ||
| 109 | { | ||
| 110 | return devm_regmap_init(&ac97->dev, &ac97_regmap_bus, ac97, config); | ||
| 111 | } | ||
| 112 | EXPORT_SYMBOL_GPL(devm_regmap_init_ac97); | ||
| 113 | |||
| 114 | MODULE_LICENSE("GPL v2"); | ||
