add 2 renesas bugfixes upstream_ltsi v3.14.28-ltsi
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jan 2015 00:18:31 +0000 (16:18 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jan 2015 00:18:31 +0000 (16:18 -0800)
patches.renesas/micrel-fix-masking-off-led-bits.patch [new file with mode: 0644]
patches.renesas/phy-micrel-add-of-configuration-for-led-mode.patch [new file with mode: 0644]
series

diff --git a/patches.renesas/micrel-fix-masking-off-led-bits.patch b/patches.renesas/micrel-fix-masking-off-led-bits.patch
new file mode 100644 (file)
index 0000000..fa8f48e
--- /dev/null
@@ -0,0 +1,38 @@
+From horms@vergenet.net Wed Dec 10 18:29:26 2014
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 11 Dec 2014 11:29:12 +0900
+Subject: [PATCH ltsi-3.14 2/2] micrel: fix masking off LED bits
+To: ltsi-dev@lists.linuxfoundation.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, Magnus Damm <magnus.damm@gmail.com>, yoshihiro shimoda <yoshihiro.shimoda.uh@renesas.com>
+Message-ID: <1418264952-27886-3-git-send-email-horms+renesas@verge.net.au>
+
+
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+
+Commit 20d8435a1cff (phy: micrel: add of configuration for LED mode) made the
+obvious mistake when masking off  the LED mode bits: forgot to do a logical NOT
+to the mask with which it ANDs the register value, so that unrelated bits are
+cleared instead.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Acked-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 28bdc499d647124fa5844453d35e6f5d1b3810dc)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/net/phy/micrel.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/phy/micrel.c
++++ b/drivers/net/phy/micrel.c
+@@ -167,7 +167,7 @@ static int kszphy_setup_led(struct phy_d
+       if (temp < 0)
+               return temp;
+-      temp &= 3 << shift;
++      temp &= ~(3 << shift);
+       temp |= val << shift;
+       rc = phy_write(phydev, reg, temp);
diff --git a/patches.renesas/phy-micrel-add-of-configuration-for-led-mode.patch b/patches.renesas/phy-micrel-add-of-configuration-for-led-mode.patch
new file mode 100644 (file)
index 0000000..5bb6f83
--- /dev/null
@@ -0,0 +1,143 @@
+From horms@vergenet.net Wed Dec 10 18:29:25 2014
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 11 Dec 2014 11:29:11 +0900
+Subject: [PATCH ltsi-3.14 1/2] phy: micrel: add of configuration for LED mode
+To: ltsi-dev@lists.linuxfoundation.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, Magnus Damm <magnus.damm@gmail.com>, yoshihiro shimoda <yoshihiro.shimoda.uh@renesas.com>
+Message-ID: <1418264952-27886-2-git-send-email-horms+renesas@verge.net.au>
+
+
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+
+Add support for the led-mode property for the following PHYs
+which have a single LED mode configuration value.
+
+KSZ8001 and KSZ8041 which both use register 0x1e bits 15,14 and
+KSZ8021, KSZ8031 and KSZ8051 which use register 0x1f bits 5,4
+to control the LED configuration.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 20d8435a1cffa04992f1db6b199a5f0ccec2ff06)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ Documentation/devicetree/bindings/net/micrel.txt |   18 ++++++++
+ drivers/net/phy/micrel.c                         |   49 +++++++++++++++++++++--
+ 2 files changed, 63 insertions(+), 4 deletions(-)
+ create mode 100644 Documentation/devicetree/bindings/net/micrel.txt
+
+--- /dev/null
++++ b/Documentation/devicetree/bindings/net/micrel.txt
+@@ -0,0 +1,18 @@
++Micrel PHY properties.
++
++These properties cover the base properties Micrel PHYs.
++
++Optional properties:
++
++ - micrel,led-mode : LED mode value to set for PHYs with configurable LEDs.
++
++              Configure the LED mode with single value. The list of PHYs and
++            the bits that are currently supported:
++
++            KSZ8001: register 0x1e, bits 15..14
++            KSZ8041: register 0x1e, bits 15..14
++            KSZ8021: register 0x1f, bits 5..4
++            KSZ8031: register 0x1f, bits 5..4
++            KSZ8051: register 0x1f, bits 5..4
++
++              See the respective PHY datasheet for the mode values.
+--- a/drivers/net/phy/micrel.c
++++ b/drivers/net/phy/micrel.c
+@@ -148,15 +148,52 @@ static int ks8737_config_intr(struct phy
+       return rc < 0 ? rc : 0;
+ }
++static int kszphy_setup_led(struct phy_device *phydev,
++                          unsigned int reg, unsigned int shift)
++{
++
++      struct device *dev = &phydev->dev;
++      struct device_node *of_node = dev->of_node;
++      int rc, temp;
++      u32 val;
++
++      if (!of_node && dev->parent->of_node)
++              of_node = dev->parent->of_node;
++
++      if (of_property_read_u32(of_node, "micrel,led-mode", &val))
++              return 0;
++
++      temp = phy_read(phydev, reg);
++      if (temp < 0)
++              return temp;
++
++      temp &= 3 << shift;
++      temp |= val << shift;
++      rc = phy_write(phydev, reg, temp);
++
++      return rc < 0 ? rc : 0;
++}
++
+ static int kszphy_config_init(struct phy_device *phydev)
+ {
+       return 0;
+ }
++static int kszphy_config_init_led8041(struct phy_device *phydev)
++{
++      /* single led control, register 0x1e bits 15..14 */
++      return kszphy_setup_led(phydev, 0x1e, 14);
++}
++
+ static int ksz8021_config_init(struct phy_device *phydev)
+ {
+-      int rc;
+       const u16 val = KSZPHY_OMSO_B_CAST_OFF | KSZPHY_OMSO_RMII_OVERRIDE;
++      int rc;
++
++      rc = kszphy_setup_led(phydev, 0x1f, 4);
++      if (rc)
++              dev_err(&phydev->dev, "failed to set led mode\n");
++
+       phy_write(phydev, MII_KSZPHY_OMSO, val);
+       rc = ksz_config_flags(phydev);
+       return rc < 0 ? rc : 0;
+@@ -166,6 +203,10 @@ static int ks8051_config_init(struct phy
+ {
+       int rc;
++      rc = kszphy_setup_led(phydev, 0x1f, 4);
++      if (rc)
++              dev_err(&phydev->dev, "failed to set led mode\n");
++
+       rc = ksz_config_flags(phydev);
+       return rc < 0 ? rc : 0;
+ }
+@@ -327,7 +368,7 @@ static struct phy_driver ksphy_driver[]
+       .features       = (PHY_BASIC_FEATURES | SUPPORTED_Pause
+                               | SUPPORTED_Asym_Pause),
+       .flags          = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+-      .config_init    = kszphy_config_init,
++      .config_init    = kszphy_config_init_led8041,
+       .config_aneg    = genphy_config_aneg,
+       .read_status    = genphy_read_status,
+       .ack_interrupt  = kszphy_ack_interrupt,
+@@ -342,7 +383,7 @@ static struct phy_driver ksphy_driver[]
+       .features       = PHY_BASIC_FEATURES |
+                         SUPPORTED_Pause | SUPPORTED_Asym_Pause,
+       .flags          = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+-      .config_init    = kszphy_config_init,
++      .config_init    = kszphy_config_init_led8041,
+       .config_aneg    = genphy_config_aneg,
+       .read_status    = genphy_read_status,
+       .ack_interrupt  = kszphy_ack_interrupt,
+@@ -371,7 +412,7 @@ static struct phy_driver ksphy_driver[]
+       .phy_id_mask    = 0x00ffffff,
+       .features       = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
+       .flags          = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+-      .config_init    = kszphy_config_init,
++      .config_init    = kszphy_config_init_led8041,
+       .config_aneg    = genphy_config_aneg,
+       .read_status    = genphy_read_status,
+       .ack_interrupt  = kszphy_ack_interrupt,
diff --git a/series b/series
index 32eb163d061e8cde23987147554273384d41b138..f5ba9c64c105f7865d95d4a350d86f9f5371d7ab 100644 (file)
--- a/series
+++ b/series
@@ -1003,6 +1003,8 @@ patches.renesas/0972-usb-renesas_usbhs-fix-the-usb_pkt_pop.patch
 patches.renesas/0973-i2c-rcar-fix-RCAR_IRQ_ACK_-RECV-SEND.patch
 patches.renesas/0001-clk-add-clock-indices-support.patch
 patches.renesas/0002-of-fdt-update-of_get_flat_dt_prop-in-prep-for-libfdt.patch
+patches.renesas/phy-micrel-add-of-configuration-for-led-mode.patch
+patches.renesas/micrel-fix-masking-off-led-bits.patch
 
 
 #############################################################################