phy: phy-stih407-usb: Pass sysconfig register offsets via syscfg property.

Based on Arnds review comments here https://lkml.org/lkml/2014/11/13/161,
update the phy driver to not use the reg property to access the sysconfig
register offsets.

This is because other phy's (miphy28, miphy365) have a combination of
memory mapped registers and sysconfig control regs, and we shouldn't
be mixing address spaces in the reg property. In addition we would
ideally like the sysconfig offsets to be passed via DT in a uniform way.

This new method will also allow us to support devices which have sysconfig
registers in different banks more easily and it is also analagous to how
keystone and bcm7745 platforms pass there syscon offsets in DT.

This breaks DT compatibility, but this platform is considered WIP, and
is only used by a few developers who are upstreaming support for it.

Signed-off-by: Peter Griffin <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Maxime Coquelin <[email protected]>
Signed-off-by: Kishon Vijay Abraham I <[email protected]>
This commit is contained in:
Peter Griffin 2015-01-16 16:04:11 +01:00 • committed by Kishon Vijay Abraham I
commit 5402d927ae
2 changed files with 16 additions and 19 deletions

View file

@ -22,6 +22,9 @@
#include <linux/mfd/syscon.h>
#include <linux/phy/phy.h>
#define PHYPARAM_REG 1
#define PHYCTRL_REG 2
/* Default PHY_SEL and REFCLKSEL configuration */
#define STIH407_USB_PICOPHY_CTRL_PORT_CONF 0x6
#define STIH407_USB_PICOPHY_CTRL_PORT_MASK 0x1f
@ -93,7 +96,7 @@ static int stih407_usb2_picophy_probe(struct platform_device *pdev)
struct device_node *np = dev->of_node;
struct phy_provider *phy_provider;
struct phy *phy;
struct resource *res;
int ret;
phy_dev = devm_kzalloc(dev, sizeof(*phy_dev), GFP_KERNEL);
if (!phy_dev)
@ -123,19 +126,19 @@ static int stih407_usb2_picophy_probe(struct platform_device *pdev)
return PTR_ERR(phy_dev->regmap);
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl");
if (!res) {
dev_err(dev, "No ctrl reg found\n");
return -ENXIO;
ret = of_property_read_u32_index(np, "st,syscfg", PHYPARAM_REG,
&phy_dev->param);
if (ret) {
dev_err(dev, "can't get phyparam offset (%d)\n", ret);
return ret;
}
phy_dev->ctrl = res->start;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "param");
if (!res) {
dev_err(dev, "No param reg found\n");
return -ENXIO;
ret = of_property_read_u32_index(np, "st,syscfg", PHYCTRL_REG,
&phy_dev->ctrl);
if (ret) {
dev_err(dev, "can't get phyctrl offset (%d)\n", ret);
return ret;
}
phy_dev->param = res->start;
phy = devm_phy_create(dev, NULL, &stih407_usb2_picophy_data);
if (IS_ERR(phy)) {