diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-04 15:31:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-04 15:31:18 -0400 |
commit | 6fa52ed33bea997374a88dbacbba5bf8c7ac4fef (patch) | |
tree | a0904b78d66c9b99d6acf944cf58bcaa0cffc511 /drivers/of | |
parent | 1db772216f48978d5146b858586f6178433aad38 (diff) | |
parent | bc8fd900c4d460b4e4bf785bb48bfced0ac9941b (diff) |
Merge tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver changes from Olof Johansson:
"This is a rather large set of patches for device drivers that for one
reason or another the subsystem maintainer preferred to get merged
through the arm-soc tree. There are both new drivers as well as
existing drivers that are getting converted from platform-specific
code into standalone drivers using the appropriate subsystem specific
interfaces.
In particular, we can now have pinctrl, clk, clksource and irqchip
drivers in one file per driver, without the need to call into platform
specific interface, or to get called from platform specific code, as
long as all information about the hardware is provided through a
device tree.
Most of the drivers we touch this time are for clocksource. Since now
most of them are part of drivers/clocksource, I expect that we won't
have to touch these again from arm-soc and can let the clocksource
maintainers take care of these in the future.
Another larger part of this series is specific to the exynos platform,
which is seeing some significant effort in upstreaming and
modernization of its device drivers this time around, which
unfortunately is also the cause for the churn and a lot of the merge
conflicts.
There is one new subsystem that gets merged as part of this series:
the reset controller interface, which is a very simple interface for
taking devices on the SoC out of reset or back into reset. Patches to
use this interface on i.MX follow later in this merge window, and we
are going to have other platforms (at least tegra and sirf) get
converted in 3.11. This will let us get rid of platform specific
callbacks in a number of platform independent device drivers."
* tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (256 commits)
irqchip: s3c24xx: add missing __init annotations
ARM: dts: Disable the RTC by default on exynos5
clk: exynos5250: Fix parent clock for sclk_mmc{0,1,2,3}
ARM: exynos: restore mach/regs-clock.h for exynos5
clocksource: exynos_mct: fix build error on non-DT
pinctrl: vt8500: wmt: Fix checking return value of pinctrl_register()
irqchip: vt8500: Convert arch-vt8500 to new irqchip infrastructure
reset: NULL deref on allocation failure
reset: Add reset controller API
dt: describe base reset signal binding
ARM: EXYNOS: Add arm-pmu DT binding for exynos421x
ARM: EXYNOS: Add arm-pmu DT binding for exynos5250
ARM: EXYNOS: Enable PMUs for exynos4
irqchip: exynos-combiner: Correct combined IRQs for exynos4
irqchip: exynos-combiner: Add set_irq_affinity function for combiner_irq
ARM: EXYNOS: fix compilation error introduced due to common clock migration
clk: exynos5250: Fix divider values for sclk_mmc{0,1,2,3}
clk: exynos4: export clocks required for fimc-is
clk: samsung: Fix compilation error
clk: tegra: fix enum tegra114_clk to match binding
...
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/base.c | 111 |
1 files changed, 76 insertions, 35 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 0a2bdd106b23..c76d16c972cc 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -747,6 +747,64 @@ struct device_node *of_find_node_by_phandle(phandle handle) | |||
747 | EXPORT_SYMBOL(of_find_node_by_phandle); | 747 | EXPORT_SYMBOL(of_find_node_by_phandle); |
748 | 748 | ||
749 | /** | 749 | /** |
750 | * of_find_property_value_of_size | ||
751 | * | ||
752 | * @np: device node from which the property value is to be read. | ||
753 | * @propname: name of the property to be searched. | ||
754 | * @len: requested length of property value | ||
755 | * | ||
756 | * Search for a property in a device node and valid the requested size. | ||
757 | * Returns the property value on success, -EINVAL if the property does not | ||
758 | * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
759 | * property data isn't large enough. | ||
760 | * | ||
761 | */ | ||
762 | static void *of_find_property_value_of_size(const struct device_node *np, | ||
763 | const char *propname, u32 len) | ||
764 | { | ||
765 | struct property *prop = of_find_property(np, propname, NULL); | ||
766 | |||
767 | if (!prop) | ||
768 | return ERR_PTR(-EINVAL); | ||
769 | if (!prop->value) | ||
770 | return ERR_PTR(-ENODATA); | ||
771 | if (len > prop->length) | ||
772 | return ERR_PTR(-EOVERFLOW); | ||
773 | |||
774 | return prop->value; | ||
775 | } | ||
776 | |||
777 | /** | ||
778 | * of_property_read_u32_index - Find and read a u32 from a multi-value property. | ||
779 | * | ||
780 | * @np: device node from which the property value is to be read. | ||
781 | * @propname: name of the property to be searched. | ||
782 | * @index: index of the u32 in the list of values | ||
783 | * @out_value: pointer to return value, modified only if no error. | ||
784 | * | ||
785 | * Search for a property in a device node and read nth 32-bit value from | ||
786 | * it. Returns 0 on success, -EINVAL if the property does not exist, | ||
787 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
788 | * property data isn't large enough. | ||
789 | * | ||
790 | * The out_value is modified only if a valid u32 value can be decoded. | ||
791 | */ | ||
792 | int of_property_read_u32_index(const struct device_node *np, | ||
793 | const char *propname, | ||
794 | u32 index, u32 *out_value) | ||
795 | { | ||
796 | const u32 *val = of_find_property_value_of_size(np, propname, | ||
797 | ((index + 1) * sizeof(*out_value))); | ||
798 | |||
799 | if (IS_ERR(val)) | ||
800 | return PTR_ERR(val); | ||
801 | |||
802 | *out_value = be32_to_cpup(((__be32 *)val) + index); | ||
803 | return 0; | ||
804 | } | ||
805 | EXPORT_SYMBOL_GPL(of_property_read_u32_index); | ||
806 | |||
807 | /** | ||
750 | * of_property_read_u8_array - Find and read an array of u8 from a property. | 808 | * of_property_read_u8_array - Find and read an array of u8 from a property. |
751 | * | 809 | * |
752 | * @np: device node from which the property value is to be read. | 810 | * @np: device node from which the property value is to be read. |
@@ -767,17 +825,12 @@ EXPORT_SYMBOL(of_find_node_by_phandle); | |||
767 | int of_property_read_u8_array(const struct device_node *np, | 825 | int of_property_read_u8_array(const struct device_node *np, |
768 | const char *propname, u8 *out_values, size_t sz) | 826 | const char *propname, u8 *out_values, size_t sz) |
769 | { | 827 | { |
770 | struct property *prop = of_find_property(np, propname, NULL); | 828 | const u8 *val = of_find_property_value_of_size(np, propname, |
771 | const u8 *val; | 829 | (sz * sizeof(*out_values))); |
772 | 830 | ||
773 | if (!prop) | 831 | if (IS_ERR(val)) |
774 | return -EINVAL; | 832 | return PTR_ERR(val); |
775 | if (!prop->value) | ||
776 | return -ENODATA; | ||
777 | if ((sz * sizeof(*out_values)) > prop->length) | ||
778 | return -EOVERFLOW; | ||
779 | 833 | ||
780 | val = prop->value; | ||
781 | while (sz--) | 834 | while (sz--) |
782 | *out_values++ = *val++; | 835 | *out_values++ = *val++; |
783 | return 0; | 836 | return 0; |
@@ -805,17 +858,12 @@ EXPORT_SYMBOL_GPL(of_property_read_u8_array); | |||
805 | int of_property_read_u16_array(const struct device_node *np, | 858 | int of_property_read_u16_array(const struct device_node *np, |
806 | const char *propname, u16 *out_values, size_t sz) | 859 | const char *propname, u16 *out_values, size_t sz) |
807 | { | 860 | { |
808 | struct property *prop = of_find_property(np, propname, NULL); | 861 | const __be16 *val = of_find_property_value_of_size(np, propname, |
809 | const __be16 *val; | 862 | (sz * sizeof(*out_values))); |
810 | 863 | ||
811 | if (!prop) | 864 | if (IS_ERR(val)) |
812 | return -EINVAL; | 865 | return PTR_ERR(val); |
813 | if (!prop->value) | ||
814 | return -ENODATA; | ||
815 | if ((sz * sizeof(*out_values)) > prop->length) | ||
816 | return -EOVERFLOW; | ||
817 | 866 | ||
818 | val = prop->value; | ||
819 | while (sz--) | 867 | while (sz--) |
820 | *out_values++ = be16_to_cpup(val++); | 868 | *out_values++ = be16_to_cpup(val++); |
821 | return 0; | 869 | return 0; |
@@ -842,17 +890,12 @@ int of_property_read_u32_array(const struct device_node *np, | |||
842 | const char *propname, u32 *out_values, | 890 | const char *propname, u32 *out_values, |
843 | size_t sz) | 891 | size_t sz) |
844 | { | 892 | { |
845 | struct property *prop = of_find_property(np, propname, NULL); | 893 | const __be32 *val = of_find_property_value_of_size(np, propname, |
846 | const __be32 *val; | 894 | (sz * sizeof(*out_values))); |
847 | 895 | ||
848 | if (!prop) | 896 | if (IS_ERR(val)) |
849 | return -EINVAL; | 897 | return PTR_ERR(val); |
850 | if (!prop->value) | ||
851 | return -ENODATA; | ||
852 | if ((sz * sizeof(*out_values)) > prop->length) | ||
853 | return -EOVERFLOW; | ||
854 | 898 | ||
855 | val = prop->value; | ||
856 | while (sz--) | 899 | while (sz--) |
857 | *out_values++ = be32_to_cpup(val++); | 900 | *out_values++ = be32_to_cpup(val++); |
858 | return 0; | 901 | return 0; |
@@ -875,15 +918,13 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_array); | |||
875 | int of_property_read_u64(const struct device_node *np, const char *propname, | 918 | int of_property_read_u64(const struct device_node *np, const char *propname, |
876 | u64 *out_value) | 919 | u64 *out_value) |
877 | { | 920 | { |
878 | struct property *prop = of_find_property(np, propname, NULL); | 921 | const __be32 *val = of_find_property_value_of_size(np, propname, |
922 | sizeof(*out_value)); | ||
879 | 923 | ||
880 | if (!prop) | 924 | if (IS_ERR(val)) |
881 | return -EINVAL; | 925 | return PTR_ERR(val); |
882 | if (!prop->value) | 926 | |
883 | return -ENODATA; | 927 | *out_value = of_read_number(val, 2); |
884 | if (sizeof(*out_value) > prop->length) | ||
885 | return -EOVERFLOW; | ||
886 | *out_value = of_read_number(prop->value, 2); | ||
887 | return 0; | 928 | return 0; |
888 | } | 929 | } |
889 | EXPORT_SYMBOL_GPL(of_property_read_u64); | 930 | EXPORT_SYMBOL_GPL(of_property_read_u64); |