mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-10-05 11:00:43 +09:00
net/ethoc: support device tree
Add .of_match table and .ofdata_to_platdata callback to allow for ethoc device configuration from the device tree. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
5d43feabf3
commit
2de18c8d77
@ -523,6 +523,14 @@ static void ethoc_stop(struct udevice *dev)
|
|||||||
ethoc_disable_rx_and_tx(priv);
|
ethoc_disable_rx_and_tx(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ethoc_ofdata_to_platdata(struct udevice *dev)
|
||||||
|
{
|
||||||
|
struct ethoc_eth_pdata *pdata = dev_get_platdata(dev);
|
||||||
|
|
||||||
|
pdata->eth_pdata.iobase = dev_get_addr(dev);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int ethoc_probe(struct udevice *dev)
|
static int ethoc_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct ethoc_eth_pdata *pdata = dev_get_platdata(dev);
|
struct ethoc_eth_pdata *pdata = dev_get_platdata(dev);
|
||||||
@ -549,9 +557,16 @@ static const struct eth_ops ethoc_ops = {
|
|||||||
.write_hwaddr = ethoc_write_hwaddr,
|
.write_hwaddr = ethoc_write_hwaddr,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct udevice_id ethoc_ids[] = {
|
||||||
|
{ .compatible = "opencores,ethoc" },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
U_BOOT_DRIVER(ethoc) = {
|
U_BOOT_DRIVER(ethoc) = {
|
||||||
.name = "ethoc",
|
.name = "ethoc",
|
||||||
.id = UCLASS_ETH,
|
.id = UCLASS_ETH,
|
||||||
|
.of_match = ethoc_ids,
|
||||||
|
.ofdata_to_platdata = ethoc_ofdata_to_platdata,
|
||||||
.probe = ethoc_probe,
|
.probe = ethoc_probe,
|
||||||
.remove = ethoc_remove,
|
.remove = ethoc_remove,
|
||||||
.ops = ðoc_ops,
|
.ops = ðoc_ops,
|
||||||
|
Loading…
Reference in New Issue
Block a user