#include <errno.h>
#include <memalign.h>
#include <miiphy.h>
+#include <asm/global_data.h>
#include <asm/io.h>
#include "dm_qe_uec.h"
break;
default:
return -EINVAL;
- }
- break;
+ }
+ break;
case SPEED_1000:
maccfg2 |= MACCFG2_INTERFACE_MODE_BYTE;
switch (enet_if_mode) {
static int qe_uec_set_hwaddr(struct udevice *dev)
{
struct qe_uec_priv *priv = dev_get_priv(dev);
- struct eth_pdata *pdata = dev_get_platdata(dev);
+ struct eth_pdata *pdata = dev_get_plat(dev);
struct uec_priv *uec = priv->uec;
uec_t *uec_regs = uec->uec_regs;
uchar *mac = pdata->enetaddr;
return QE_CLK_NONE;
if (strncasecmp(source, "brg", 3) == 0) {
- i = simple_strtoul(source + 3, NULL, 10);
+ i = dectoul(source + 3, NULL);
if (i >= 1 && i <= 16)
return (QE_BRG1 - 1) + i;
else
}
if (strncasecmp(source, "clk", 3) == 0) {
- i = simple_strtoul(source + 3, NULL, 10);
+ i = dectoul(source + 3, NULL);
if (i >= 1 && i <= 24)
return (QE_CLK1 - 1) + i;
else
static int qe_uec_set_uec_info(struct udevice *dev)
{
struct qe_uec_priv *priv = dev_get_priv(dev);
- struct eth_pdata *pdata = dev_get_platdata(dev);
+ struct eth_pdata *pdata = dev_get_plat(dev);
struct uec_priv *uec = priv->uec;
struct uec_inf *uec_info;
struct ucc_fast_inf *uf_info;
static int qe_uec_probe(struct udevice *dev)
{
struct qe_uec_priv *priv = dev_get_priv(dev);
- struct eth_pdata *pdata = dev_get_platdata(dev);
+ struct eth_pdata *pdata = dev_get_plat(dev);
struct uec_priv *uec;
int ret;
return 0;
}
-static int qe_uec_ofdata_to_platdata(struct udevice *dev)
+static int qe_uec_of_to_plat(struct udevice *dev)
{
- struct eth_pdata *pdata = dev_get_platdata(dev);
- const char *phy_mode;
+ struct eth_pdata *pdata = dev_get_plat(dev);
pdata->iobase = (phys_addr_t)devfdt_get_addr(dev);
- pdata->phy_interface = -1;
- phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
- "phy-connection-type", NULL);
- if (phy_mode)
- pdata->phy_interface = phy_get_interface_by_name(phy_mode);
- if (pdata->phy_interface == -1) {
- debug("%s: Invalid PHY interface '%s'\n", __func__, phy_mode);
+ pdata->phy_interface = dev_read_phy_mode(dev);
+ if (pdata->phy_interface == PHY_INTERFACE_MODE_NONE)
return -EINVAL;
- }
return 0;
}
.name = QE_UEC_DRIVER_NAME,
.id = UCLASS_ETH,
.of_match = qe_uec_ids,
- .ofdata_to_platdata = qe_uec_ofdata_to_platdata,
+ .of_to_plat = qe_uec_of_to_plat,
.probe = qe_uec_probe,
.remove = qe_uec_remove,
.ops = &qe_uec_eth_ops,
- .priv_auto_alloc_size = sizeof(struct qe_uec_priv),
- .platdata_auto_alloc_size = sizeof(struct eth_pdata),
+ .priv_auto = sizeof(struct qe_uec_priv),
+ .plat_auto = sizeof(struct eth_pdata),
};