* [PATCH v3 net-next 00/10] net: Korina improvements
@ 2021-04-14 23:06 Thomas Bogendoerfer
2021-04-14 23:06 ` [PATCH v3 net-next 06/10] net: korina: Only pass mac address via platform data Thomas Bogendoerfer
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Bogendoerfer @ 2021-04-14 23:06 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Rob Herring, netdev, devicetree,
linux-kernel, linux-mips
While converting Mikrotik RB532 support to use device tree I stumbled
over the korina ethernet driver, which used way too many MIPS specific
hacks. This series cleans this all up and adds support for device tree.
Changes in v3:
- fixed usage of of_get_mac_address for net-next
- use readl_poll_timeout_atomic in mdio_wait
- return -ETIMEDOUT, if mdio_wait fails
- added DT binding and changed compatible name to idt,3243x-emac
Changes in v2:
- added device tree support to get rid of idt_cpu_freq
- fixed compile test on 64bit archs
- fixed descriptor current address handling by storing/using mapped
dma addresses (dma controller modifies current address)
Thomas Bogendoerfer (10):
net: korina: Fix MDIO functions
net: korina: Use devres functions
net: korina: Remove not needed cache flushes
net: korina: Remove nested helpers
net: korina: Use DMA API
net: korina: Only pass mac address via platform data
net: korina: Add support for device tree
net: korina: Get mdio input clock via common clock framework
net: korina: Make driver COMPILE_TESTable
dt-bindings: net: korina: Add DT bindings for IDT 79RC3243x SoCs
.../bindings/net/idt,3243x-emac.yaml | 82 +++
arch/mips/rb532/devices.c | 5 +-
drivers/net/ethernet/Kconfig | 3 +-
drivers/net/ethernet/korina.c | 601 +++++++++++++-----
4 files changed, 519 insertions(+), 172 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/idt,3243x-emac.yaml
--
2.29.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 net-next 06/10] net: korina: Only pass mac address via platform data
2021-04-14 23:06 [PATCH v3 net-next 00/10] net: Korina improvements Thomas Bogendoerfer
@ 2021-04-14 23:06 ` Thomas Bogendoerfer
2021-04-15 23:30 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Bogendoerfer @ 2021-04-14 23:06 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, linux-mips, linux-kernel, netdev
Get rid of access to struct korina_device by just passing the mac
address via platform data and use drvdata for passing netdev to remove
function.
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
arch/mips/rb532/devices.c | 5 +++--
drivers/net/ethernet/korina.c | 11 ++++++-----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index dd34f1b32b79..5fc3c8ee4f31 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -105,6 +105,9 @@ static struct platform_device korina_dev0 = {
.name = "korina",
.resource = korina_dev0_res,
.num_resources = ARRAY_SIZE(korina_dev0_res),
+ .dev = {
+ .platform_data = &korina_dev0_data.mac,
+ }
};
static struct resource cf_slot0_res[] = {
@@ -299,8 +302,6 @@ static int __init plat_setup_devices(void)
/* set the uart clock to the current cpu frequency */
rb532_uart_res[0].uartclk = idt_cpu_freq;
- dev_set_drvdata(&korina_dev0.dev, &korina_dev0_data);
-
gpiod_add_lookup_table(&cf_slot0_gpio_table);
return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs));
}
diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index f00ffbbdfba7..1d7dead17ac3 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -1053,7 +1053,7 @@ static const struct net_device_ops korina_netdev_ops = {
static int korina_probe(struct platform_device *pdev)
{
- struct korina_device *bif = platform_get_drvdata(pdev);
+ u8 *mac_addr = dev_get_platdata(&pdev->dev);
struct korina_private *lp;
struct net_device *dev;
void __iomem *p;
@@ -1066,8 +1066,7 @@ static int korina_probe(struct platform_device *pdev)
SET_NETDEV_DEV(dev, &pdev->dev);
lp = netdev_priv(dev);
- bif->dev = dev;
- memcpy(dev->dev_addr, bif->mac, ETH_ALEN);
+ memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
lp->rx_irq = platform_get_irq_byname(pdev, "korina_rx");
lp->tx_irq = platform_get_irq_byname(pdev, "korina_tx");
@@ -1121,6 +1120,8 @@ static int korina_probe(struct platform_device *pdev)
lp->mii_if.phy_id_mask = 0x1f;
lp->mii_if.reg_num_mask = 0x1f;
+ platform_set_drvdata(pdev, dev);
+
rc = register_netdev(dev);
if (rc < 0) {
printk(KERN_ERR DRV_NAME
@@ -1138,9 +1139,9 @@ static int korina_probe(struct platform_device *pdev)
static int korina_remove(struct platform_device *pdev)
{
- struct korina_device *bif = platform_get_drvdata(pdev);
+ struct net_device *dev = platform_get_drvdata(pdev);
- unregister_netdev(bif->dev);
+ unregister_netdev(dev);
return 0;
}
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 net-next 06/10] net: korina: Only pass mac address via platform data
2021-04-14 23:06 ` [PATCH v3 net-next 06/10] net: korina: Only pass mac address via platform data Thomas Bogendoerfer
@ 2021-04-15 23:30 ` Andrew Lunn
2021-04-16 6:54 ` Thomas Bogendoerfer
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2021-04-15 23:30 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: David S. Miller, Jakub Kicinski, linux-mips, linux-kernel, netdev
On Thu, Apr 15, 2021 at 01:06:43AM +0200, Thomas Bogendoerfer wrote:
> Get rid of access to struct korina_device by just passing the mac
> address via platform data and use drvdata for passing netdev to remove
> function.
>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
> arch/mips/rb532/devices.c | 5 +++--
> drivers/net/ethernet/korina.c | 11 ++++++-----
> 2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
> index dd34f1b32b79..5fc3c8ee4f31 100644
> --- a/arch/mips/rb532/devices.c
> +++ b/arch/mips/rb532/devices.c
> @@ -105,6 +105,9 @@ static struct platform_device korina_dev0 = {
> .name = "korina",
> .resource = korina_dev0_res,
> .num_resources = ARRAY_SIZE(korina_dev0_res),
> + .dev = {
> + .platform_data = &korina_dev0_data.mac,
> + }
This is a bit unusual. Normally you define a structure in
include/linux/platform/data/koriana.h, and use that.
What about the name? "korina0" How is that passed?
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 net-next 06/10] net: korina: Only pass mac address via platform data
2021-04-15 23:30 ` Andrew Lunn
@ 2021-04-16 6:54 ` Thomas Bogendoerfer
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2021-04-16 6:54 UTC (permalink / raw)
To: Andrew Lunn
Cc: David S. Miller, Jakub Kicinski, linux-mips, linux-kernel, netdev
On Fri, Apr 16, 2021 at 01:30:04AM +0200, Andrew Lunn wrote:
> On Thu, Apr 15, 2021 at 01:06:43AM +0200, Thomas Bogendoerfer wrote:
> > Get rid of access to struct korina_device by just passing the mac
> > address via platform data and use drvdata for passing netdev to remove
> > function.
> >
> > Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > ---
> > arch/mips/rb532/devices.c | 5 +++--
> > drivers/net/ethernet/korina.c | 11 ++++++-----
> > 2 files changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
> > index dd34f1b32b79..5fc3c8ee4f31 100644
> > --- a/arch/mips/rb532/devices.c
> > +++ b/arch/mips/rb532/devices.c
> > @@ -105,6 +105,9 @@ static struct platform_device korina_dev0 = {
> > .name = "korina",
> > .resource = korina_dev0_res,
> > .num_resources = ARRAY_SIZE(korina_dev0_res),
> > + .dev = {
> > + .platform_data = &korina_dev0_data.mac,
> > + }
>
> This is a bit unusual. Normally you define a structure in
> include/linux/platform/data/koriana.h, and use that.
>
> What about the name? "korina0" How is that passed?
this is just for transition purpose. My DT patches remove this struct
completly.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-16 6:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-14 23:06 [PATCH v3 net-next 00/10] net: Korina improvements Thomas Bogendoerfer
2021-04-14 23:06 ` [PATCH v3 net-next 06/10] net: korina: Only pass mac address via platform data Thomas Bogendoerfer
2021-04-15 23:30 ` Andrew Lunn
2021-04-16 6:54 ` Thomas Bogendoerfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox