diff options
author | David S. Miller <davem@davemloft.net> | 2014-02-19 01:24:22 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-19 01:24:22 -0500 |
commit | 1e8d6421cff2c24fe0b345711e7a21af02e8bcf5 (patch) | |
tree | 773b30106efb9b48055bc93958e5a94ac53768ce /drivers/of | |
parent | f7b12606b5de323a2bb5ca1696558efde8f25441 (diff) | |
parent | 960dfc4eb23a28495276b02604d7458e0e1a1ed8 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/bonding/bond_3ad.h
drivers/net/bonding/bond_main.c
Two minor conflicts in bonding, both of which were overlapping
changes.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/address.c | 5 | ||||
-rw-r--r-- | drivers/of/base.c | 88 | ||||
-rw-r--r-- | drivers/of/of_mdio.c | 22 |
3 files changed, 71 insertions, 44 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c index d3dd41c840f1..1a54f1ffaadb 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c | |||
@@ -99,11 +99,12 @@ static unsigned int of_bus_default_get_flags(const __be32 *addr) | |||
99 | static int of_bus_pci_match(struct device_node *np) | 99 | static int of_bus_pci_match(struct device_node *np) |
100 | { | 100 | { |
101 | /* | 101 | /* |
102 | * "pciex" is PCI Express | ||
102 | * "vci" is for the /chaos bridge on 1st-gen PCI powermacs | 103 | * "vci" is for the /chaos bridge on 1st-gen PCI powermacs |
103 | * "ht" is hypertransport | 104 | * "ht" is hypertransport |
104 | */ | 105 | */ |
105 | return !strcmp(np->type, "pci") || !strcmp(np->type, "vci") || | 106 | return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") || |
106 | !strcmp(np->type, "ht"); | 107 | !strcmp(np->type, "vci") || !strcmp(np->type, "ht"); |
107 | } | 108 | } |
108 | 109 | ||
109 | static void of_bus_pci_count_cells(struct device_node *np, | 110 | static void of_bus_pci_count_cells(struct device_node *np, |
diff --git a/drivers/of/base.c b/drivers/of/base.c index ff85450d5683..10b51106c854 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -730,46 +730,64 @@ out: | |||
730 | } | 730 | } |
731 | EXPORT_SYMBOL(of_find_node_with_property); | 731 | EXPORT_SYMBOL(of_find_node_with_property); |
732 | 732 | ||
733 | static | 733 | static const struct of_device_id * |
734 | const struct of_device_id *__of_match_node(const struct of_device_id *matches, | 734 | of_match_compatible(const struct of_device_id *matches, |
735 | const struct device_node *node) | 735 | const struct device_node *node) |
736 | { | 736 | { |
737 | const char *cp; | 737 | const char *cp; |
738 | int cplen, l; | 738 | int cplen, l; |
739 | 739 | const struct of_device_id *m; | |
740 | if (!matches) | ||
741 | return NULL; | ||
742 | 740 | ||
743 | cp = __of_get_property(node, "compatible", &cplen); | 741 | cp = __of_get_property(node, "compatible", &cplen); |
744 | do { | 742 | while (cp && (cplen > 0)) { |
745 | const struct of_device_id *m = matches; | 743 | m = matches; |
746 | |||
747 | /* Check against matches with current compatible string */ | ||
748 | while (m->name[0] || m->type[0] || m->compatible[0]) { | 744 | while (m->name[0] || m->type[0] || m->compatible[0]) { |
749 | int match = 1; | 745 | /* Only match for the entries without type and name */ |
750 | if (m->name[0]) | 746 | if (m->name[0] || m->type[0] || |
751 | match &= node->name | 747 | of_compat_cmp(m->compatible, cp, |
752 | && !strcmp(m->name, node->name); | 748 | strlen(m->compatible))) |
753 | if (m->type[0]) | 749 | m++; |
754 | match &= node->type | 750 | else |
755 | && !strcmp(m->type, node->type); | ||
756 | if (m->compatible[0]) | ||
757 | match &= cp | ||
758 | && !of_compat_cmp(m->compatible, cp, | ||
759 | strlen(m->compatible)); | ||
760 | if (match) | ||
761 | return m; | 751 | return m; |
762 | m++; | ||
763 | } | 752 | } |
764 | 753 | ||
765 | /* Get node's next compatible string */ | 754 | /* Get node's next compatible string */ |
766 | if (cp) { | 755 | l = strlen(cp) + 1; |
767 | l = strlen(cp) + 1; | 756 | cp += l; |
768 | cp += l; | 757 | cplen -= l; |
769 | cplen -= l; | 758 | } |
770 | } | 759 | |
771 | } while (cp && (cplen > 0)); | 760 | return NULL; |
761 | } | ||
762 | |||
763 | static | ||
764 | const struct of_device_id *__of_match_node(const struct of_device_id *matches, | ||
765 | const struct device_node *node) | ||
766 | { | ||
767 | const struct of_device_id *m; | ||
772 | 768 | ||
769 | if (!matches) | ||
770 | return NULL; | ||
771 | |||
772 | m = of_match_compatible(matches, node); | ||
773 | if (m) | ||
774 | return m; | ||
775 | |||
776 | while (matches->name[0] || matches->type[0] || matches->compatible[0]) { | ||
777 | int match = 1; | ||
778 | if (matches->name[0]) | ||
779 | match &= node->name | ||
780 | && !strcmp(matches->name, node->name); | ||
781 | if (matches->type[0]) | ||
782 | match &= node->type | ||
783 | && !strcmp(matches->type, node->type); | ||
784 | if (matches->compatible[0]) | ||
785 | match &= __of_device_is_compatible(node, | ||
786 | matches->compatible); | ||
787 | if (match) | ||
788 | return matches; | ||
789 | matches++; | ||
790 | } | ||
773 | return NULL; | 791 | return NULL; |
774 | } | 792 | } |
775 | 793 | ||
@@ -778,10 +796,12 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches, | |||
778 | * @matches: array of of device match structures to search in | 796 | * @matches: array of of device match structures to search in |
779 | * @node: the of device structure to match against | 797 | * @node: the of device structure to match against |
780 | * | 798 | * |
781 | * Low level utility function used by device matching. Matching order | 799 | * Low level utility function used by device matching. We have two ways |
782 | * is to compare each of the node's compatibles with all given matches | 800 | * of matching: |
783 | * first. This implies node's compatible is sorted from specific to | 801 | * - Try to find the best compatible match by comparing each compatible |
784 | * generic while matches can be in any order. | 802 | * string of device node with all the given matches respectively. |
803 | * - If the above method failed, then try to match the compatible by using | ||
804 | * __of_device_is_compatible() besides the match in type and name. | ||
785 | */ | 805 | */ |
786 | const struct of_device_id *of_match_node(const struct of_device_id *matches, | 806 | const struct of_device_id *of_match_node(const struct of_device_id *matches, |
787 | const struct device_node *node) | 807 | const struct device_node *node) |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 875b7b6f0d2a..5b3c24f3cde5 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -24,7 +24,11 @@ MODULE_LICENSE("GPL"); | |||
24 | 24 | ||
25 | static void of_set_phy_supported(struct phy_device *phydev, u32 max_speed) | 25 | static void of_set_phy_supported(struct phy_device *phydev, u32 max_speed) |
26 | { | 26 | { |
27 | phydev->supported |= PHY_DEFAULT_FEATURES; | 27 | /* The default values for phydev->supported are provided by the PHY |
28 | * driver "features" member, we want to reset to sane defaults fist | ||
29 | * before supporting higher speeds. | ||
30 | */ | ||
31 | phydev->supported &= PHY_DEFAULT_FEATURES; | ||
28 | 32 | ||
29 | switch (max_speed) { | 33 | switch (max_speed) { |
30 | default: | 34 | default: |
@@ -44,7 +48,7 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi | |||
44 | { | 48 | { |
45 | struct phy_device *phy; | 49 | struct phy_device *phy; |
46 | bool is_c45; | 50 | bool is_c45; |
47 | int rc, prev_irq; | 51 | int rc; |
48 | u32 max_speed = 0; | 52 | u32 max_speed = 0; |
49 | 53 | ||
50 | is_c45 = of_device_is_compatible(child, | 54 | is_c45 = of_device_is_compatible(child, |
@@ -54,12 +58,14 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi | |||
54 | if (!phy || IS_ERR(phy)) | 58 | if (!phy || IS_ERR(phy)) |
55 | return 1; | 59 | return 1; |
56 | 60 | ||
57 | if (mdio->irq) { | 61 | rc = irq_of_parse_and_map(child, 0); |
58 | prev_irq = mdio->irq[addr]; | 62 | if (rc > 0) { |
59 | mdio->irq[addr] = | 63 | phy->irq = rc; |
60 | irq_of_parse_and_map(child, 0); | 64 | if (mdio->irq) |
61 | if (!mdio->irq[addr]) | 65 | mdio->irq[addr] = rc; |
62 | mdio->irq[addr] = prev_irq; | 66 | } else { |
67 | if (mdio->irq) | ||
68 | phy->irq = mdio->irq[addr]; | ||
63 | } | 69 | } |
64 | 70 | ||
65 | /* Associate the OF node with the device structure so it | 71 | /* Associate the OF node with the device structure so it |