forked from luck/tmp_suning_uos_patched
0b56e9a7e8
Adding vendor specific directories in phy to group phy drivers under their respective vendor umbrella. Also updated the MAINTAINERS file to reflect the correct directory structure for phy drivers. Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org> Acked-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Cc: Kishon Vijay Abraham I <kishon@ti.com> Cc: David S. Miller <davem@davemloft.net> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Viresh Kumar <viresh.kumar@linaro.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Chen-Yu Tsai <wens@csie.org> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com> Cc: Krzysztof Kozlowski <krzk@kernel.org> Cc: Jaehoon Chung <jh80.chung@samsung.com> Cc: Stephen Boyd <stephen.boyd@linaro.org> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-omap@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org Cc: linux-rockchip@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-usb@vger.kernel.org Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
102 lines
2.5 KiB
C
102 lines
2.5 KiB
C
/*
|
|
* Copyright (C) 2016 Broadcom
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation version 2.
|
|
*
|
|
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
|
* kind, whether express or implied; without even the implied warranty
|
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/module.h>
|
|
#include <linux/of_mdio.h>
|
|
#include <linux/mdio.h>
|
|
#include <linux/phy.h>
|
|
#include <linux/phy/phy.h>
|
|
|
|
#define BLK_ADDR_REG_OFFSET 0x1f
|
|
#define PLL_AFE1_100MHZ_BLK 0x2100
|
|
#define PLL_CLK_AMP_OFFSET 0x03
|
|
#define PLL_CLK_AMP_2P05V 0x2b18
|
|
|
|
static int ns2_pci_phy_init(struct phy *p)
|
|
{
|
|
struct mdio_device *mdiodev = phy_get_drvdata(p);
|
|
int rc;
|
|
|
|
/* select the AFE 100MHz block page */
|
|
rc = mdiobus_write(mdiodev->bus, mdiodev->addr,
|
|
BLK_ADDR_REG_OFFSET, PLL_AFE1_100MHZ_BLK);
|
|
if (rc)
|
|
goto err;
|
|
|
|
/* set the 100 MHz reference clock amplitude to 2.05 v */
|
|
rc = mdiobus_write(mdiodev->bus, mdiodev->addr,
|
|
PLL_CLK_AMP_OFFSET, PLL_CLK_AMP_2P05V);
|
|
if (rc)
|
|
goto err;
|
|
|
|
return 0;
|
|
|
|
err:
|
|
dev_err(&mdiodev->dev, "Error %d writing to phy\n", rc);
|
|
return rc;
|
|
}
|
|
|
|
static const struct phy_ops ns2_pci_phy_ops = {
|
|
.init = ns2_pci_phy_init,
|
|
.owner = THIS_MODULE,
|
|
};
|
|
|
|
static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
|
|
{
|
|
struct device *dev = &mdiodev->dev;
|
|
struct phy_provider *provider;
|
|
struct phy *phy;
|
|
|
|
phy = devm_phy_create(dev, dev->of_node, &ns2_pci_phy_ops);
|
|
if (IS_ERR(phy)) {
|
|
dev_err(dev, "failed to create Phy\n");
|
|
return PTR_ERR(phy);
|
|
}
|
|
|
|
phy_set_drvdata(phy, mdiodev);
|
|
|
|
provider = devm_of_phy_provider_register(&phy->dev,
|
|
of_phy_simple_xlate);
|
|
if (IS_ERR(provider)) {
|
|
dev_err(dev, "failed to register Phy provider\n");
|
|
return PTR_ERR(provider);
|
|
}
|
|
|
|
dev_info(dev, "%s PHY registered\n", dev_name(dev));
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct of_device_id ns2_pci_phy_of_match[] = {
|
|
{ .compatible = "brcm,ns2-pcie-phy", },
|
|
{ /* sentinel */ },
|
|
};
|
|
MODULE_DEVICE_TABLE(of, ns2_pci_phy_of_match);
|
|
|
|
static struct mdio_driver ns2_pci_phy_driver = {
|
|
.mdiodrv = {
|
|
.driver = {
|
|
.name = "phy-bcm-ns2-pci",
|
|
.of_match_table = ns2_pci_phy_of_match,
|
|
},
|
|
},
|
|
.probe = ns2_pci_phy_probe,
|
|
};
|
|
mdio_module_driver(ns2_pci_phy_driver);
|
|
|
|
MODULE_AUTHOR("Broadcom");
|
|
MODULE_DESCRIPTION("Broadcom Northstar2 PCI Phy driver");
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_ALIAS("platform:phy-bcm-ns2-pci");
|