Re: [PATCH] phy: phy-bcm-ns-usb3: drop support for deprecated DT binding

2020-11-19 Thread Rafał Miłecki
On Thu, 19 Nov 2020 at 07:27, Vinod Koul  wrote:
>
> On 13-11-20, 12:34, Rafał Miłecki wrote:
> > From: Rafał Miłecki 
> >
> > Initially this PHY driver was implementing MDIO access on its own. It
> > was caused by lack of proper hardware design understanding.
> >
> > It has been changed back in 2017. DT bindings were changed and driver
> > was updated to use MDIO layer.
> >
> > It should be really safe now to drop the old deprecated code. All Linux
> > stored DT files don't use it for 3,5 year. There is close to 0 chance
> > there is any bootloader with its own DTB using old the binding.
>
> Applied, thanks
>
> While applying, it gave me a minor conflict, please do check the
> resolution

Looks good, thank you!

-- 
Rafał


Re: [PATCH] phy: phy-bcm-ns-usb3: drop support for deprecated DT binding

2020-11-18 Thread Rafał Miłecki
On Thu, 19 Nov 2020 at 07:27, Vinod Koul  wrote:
> On 13-11-20, 12:34, Rafał Miłecki wrote:
> > From: Rafał Miłecki 
> >
> > Initially this PHY driver was implementing MDIO access on its own. It
> > was caused by lack of proper hardware design understanding.
> >
> > It has been changed back in 2017. DT bindings were changed and driver
> > was updated to use MDIO layer.
> >
> > It should be really safe now to drop the old deprecated code. All Linux
> > stored DT files don't use it for 3,5 year. There is close to 0 chance
> > there is any bootloader with its own DTB using old the binding.
>
> Applied, thanks
>
> While applying, it gave me a minor conflict, please do check the
> resolution

Oops, I used your master branch instead of next. Waiting for your push :)

-- 
Rafał


Re: [PATCH] phy: phy-bcm-ns-usb3: drop support for deprecated DT binding

2020-11-18 Thread Vinod Koul
On 13-11-20, 12:34, Rafał Miłecki wrote:
> From: Rafał Miłecki 
> 
> Initially this PHY driver was implementing MDIO access on its own. It
> was caused by lack of proper hardware design understanding.
> 
> It has been changed back in 2017. DT bindings were changed and driver
> was updated to use MDIO layer.
> 
> It should be really safe now to drop the old deprecated code. All Linux
> stored DT files don't use it for 3,5 year. There is close to 0 chance
> there is any bootloader with its own DTB using old the binding.

Applied, thanks

While applying, it gave me a minor conflict, please do check the
resolution

-- 
~Vinod


Re: [PATCH] phy: phy-bcm-ns-usb3: drop support for deprecated DT binding

2020-11-13 Thread Florian Fainelli
On 11/13/20 3:34 AM, Rafał Miłecki wrote:
> From: Rafał Miłecki 
> 
> Initially this PHY driver was implementing MDIO access on its own. It
> was caused by lack of proper hardware design understanding.
> 
> It has been changed back in 2017. DT bindings were changed and driver
> was updated to use MDIO layer.
> 
> It should be really safe now to drop the old deprecated code. All Linux
> stored DT files don't use it for 3,5 year. There is close to 0 chance
> there is any bootloader with its own DTB using old the binding.
> 
> Signed-off-by: Rafał Miłecki 

Acked-by: Florian Fainelli 
-- 
Florian


[PATCH] phy: phy-bcm-ns-usb3: drop support for deprecated DT binding

2020-11-13 Thread Rafał Miłecki
From: Rafał Miłecki 

Initially this PHY driver was implementing MDIO access on its own. It
was caused by lack of proper hardware design understanding.

It has been changed back in 2017. DT bindings were changed and driver
was updated to use MDIO layer.

It should be really safe now to drop the old deprecated code. All Linux
stored DT files don't use it for 3,5 year. There is close to 0 chance
there is any bootloader with its own DTB using old the binding.

Signed-off-by: Rafał Miłecki 
---
 drivers/phy/broadcom/phy-bcm-ns-usb3.c | 159 +
 1 file changed, 5 insertions(+), 154 deletions(-)

diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb3.c 
b/drivers/phy/broadcom/phy-bcm-ns-usb3.c
index 47b029fbebbd..eb10ffa13a62 100644
--- a/drivers/phy/broadcom/phy-bcm-ns-usb3.c
+++ b/drivers/phy/broadcom/phy-bcm-ns-usb3.c
@@ -22,8 +22,6 @@
 #include 
 #include 
 
-#define BCM_NS_USB3_MII_MNG_TIMEOUT_US 1000/* usecs */
-
 #define BCM_NS_USB3_PHY_BASE_ADDR_REG  0x1f
 #define BCM_NS_USB3_PHY_PLL30_BLOCK0x8000
 #define BCM_NS_USB3_PHY_TX_PMD_BLOCK   0x8040
@@ -51,11 +49,8 @@ struct bcm_ns_usb3 {
struct device *dev;
enum bcm_ns_family family;
void __iomem *dmp;
-   void __iomem *ccb_mii;
struct mdio_device *mdiodev;
struct phy *phy;
-
-   int (*phy_write)(struct bcm_ns_usb3 *usb3, u16 reg, u16 value);
 };
 
 static const struct of_device_id bcm_ns_usb3_id_table[] = {
@@ -69,13 +64,9 @@ static const struct of_device_id bcm_ns_usb3_id_table[] = {
},
{},
 };
-MODULE_DEVICE_TABLE(of, bcm_ns_usb3_id_table);
 
 static int bcm_ns_usb3_mdio_phy_write(struct bcm_ns_usb3 *usb3, u16 reg,
- u16 value)
-{
-   return usb3->phy_write(usb3, reg, value);
-}
+ u16 value);
 
 static int bcm_ns_usb3_phy_init_ns_bx(struct bcm_ns_usb3 *usb3)
 {
@@ -187,8 +178,8 @@ static const struct phy_ops ops = {
  * MDIO driver code
  **/
 
-static int bcm_ns_usb3_mdiodev_phy_write(struct bcm_ns_usb3 *usb3, u16 reg,
-u16 value)
+static int bcm_ns_usb3_mdio_phy_write(struct bcm_ns_usb3 *usb3, u16 reg,
+ u16 value)
 {
struct mdio_device *mdiodev = usb3->mdiodev;
 
@@ -229,8 +220,6 @@ static int bcm_ns_usb3_mdio_probe(struct mdio_device 
*mdiodev)
return PTR_ERR(usb3->dmp);
}
 
-   usb3->phy_write = bcm_ns_usb3_mdiodev_phy_write;
-
usb3->phy = devm_phy_create(dev, NULL, );
if (IS_ERR(usb3->phy)) {
dev_err(dev, "Failed to create PHY\n");
@@ -254,145 +243,7 @@ static struct mdio_driver bcm_ns_usb3_mdio_driver = {
.probe = bcm_ns_usb3_mdio_probe,
 };
 
-/**
- * Platform driver code
- **/
-
-static int bcm_ns_usb3_wait_reg(struct bcm_ns_usb3 *usb3, void __iomem *addr,
-   u32 mask, u32 value, int usec)
-{
-   u32 val;
-   int ret;
-
-   ret = readl_poll_timeout_atomic(addr, val, ((val & mask) == value),
-   10, usec);
-   if (ret)
-   dev_err(usb3->dev, "Timeout waiting for register %p\n", addr);
-
-   return ret;
-}
-
-static inline int bcm_ns_usb3_mii_mng_wait_idle(struct bcm_ns_usb3 *usb3)
-{
-   return bcm_ns_usb3_wait_reg(usb3, usb3->ccb_mii + BCMA_CCB_MII_MNG_CTL,
-   0x0100, 0x,
-   BCM_NS_USB3_MII_MNG_TIMEOUT_US);
-}
-
-static int bcm_ns_usb3_platform_phy_write(struct bcm_ns_usb3 *usb3, u16 reg,
- u16 value)
-{
-   u32 tmp = 0;
-   int err;
-
-   err = bcm_ns_usb3_mii_mng_wait_idle(usb3);
-   if (err < 0) {
-   dev_err(usb3->dev, "Couldn't write 0x%08x value\n", value);
-   return err;
-   }
-
-   /* TODO: Use a proper MDIO bus layer */
-   tmp |= 0x5802; /* Magic value for MDIO PHY write */
-   tmp |= reg << 18;
-   tmp |= value;
-   writel(tmp, usb3->ccb_mii + BCMA_CCB_MII_MNG_CMD_DATA);
-
-   return bcm_ns_usb3_mii_mng_wait_idle(usb3);
-}
-
-static int bcm_ns_usb3_probe(struct platform_device *pdev)
-{
-   struct device *dev = >dev;
-   const struct of_device_id *of_id;
-   struct bcm_ns_usb3 *usb3;
-   struct resource *res;
-   struct phy_provider *phy_provider;
-
-   usb3 = devm_kzalloc(dev, sizeof(*usb3), GFP_KERNEL);
-   if (!usb3)
-   return -ENOMEM;
-
-   usb3->dev = dev;
-
-   of_id = of_match_device(bcm_ns_usb3_id_table, dev);
-   if (!of_id)
-   return -EINVAL;
-   usb3->family = (enum bcm_ns_family)of_id->data;
-
-   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmp");
-   usb3->dmp = devm_ioremap_resource(dev, res);
-