From: Andrew Lunn <andrew@lunn.ch>
To: Mauri Sandberg <maukka@ext.kapsi.fi>
Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
arnd@arndb.de, olof@lixom.net, sebastian.hesselbarth@gmail.com,
gregory.clement@bootlin.com, linux@armlinux.org.uk,
pali@kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/3] ARM: orion5x: Add D-Link DNS-323 based on Device Tree
Date: Thu, 22 Sep 2022 23:10:44 +0200 [thread overview]
Message-ID: <YyzPVMrfcOkvngxl@lunn.ch> (raw)
In-Reply-To: <20220922202458.7592-4-maukka@ext.kapsi.fi>
> +static void __init dns323_dt_eth_fixup(void)
> +{
> + struct device_node *np;
> + u8 addr[ETH_ALEN];
> + int ret;
> +
> + /*
> + * The ethernet interfaces forget the MAC address assigned by u-boot
> + * if the clocks are turned off. Usually, u-boot on orion boards
> + * has no DT support to properly set local-mac-address property.
> + * As a workaround, we get the MAC address that is stored in flash
> + * and update the port device node if no valid MAC address is set.
> + */
This is true for Kirkwood, but orion5x does not have any clocks to
gate. So i'm pretty sure this is not true. You copied this code for a
different reason. Please document here the real reason for this code.
> + ret = dns323_read_mac_addr(addr);
> +
> + if (ret) {
> + pr_warn("Unable to find MAC address in flash memory\n");
> + return;
> + }
> +
> + np = of_find_compatible_node(NULL, NULL, "marvell,orion-eth-port");
> +
> + if (!IS_ERR(np)) {
> + struct device_node *pnp = of_get_parent(np);
> + struct clk *clk;
> + struct property *pmac;
> + u8 tmpmac[ETH_ALEN];
> + u8 *macaddr;
> + int i;
> +
> + if (!pnp)
> + return;
> +
> + /* skip disabled nodes or nodes with valid MAC address*/
> + if (!of_device_is_available(pnp) ||
> + !of_get_mac_address(np, tmpmac))
> + goto eth_fixup_skip;
> +
> + clk = of_clk_get(pnp, 0);
> + if (IS_ERR(clk))
> + goto eth_fixup_skip;
> +
> + /* ensure port clock is not gated to not hang CPU */
> + clk_prepare_enable(clk);
I'm pretty sure this clock stuff is not needed. Please comment it out
and see if the machine locks up. Kirkwood just stops dead if you
access registers when there clocks are disabled. For Orion5x, the
ethernet should always have a clock.
> +
> + /* store MAC address register contents in local-mac-address */
> + pmac = kzalloc(sizeof(*pmac) + 6, GFP_KERNEL);
> + if (!pmac)
> + goto eth_fixup_no_mem;
> +
> + pmac->value = pmac + 1;
> + pmac->length = ETH_ALEN;
> + pmac->name = kstrdup("local-mac-address", GFP_KERNEL);
> + if (!pmac->name) {
> + kfree(pmac);
> + goto eth_fixup_no_mem;
> + }
> +
> + macaddr = pmac->value;
> + for (i = 0; i < ETH_ALEN; i++)
> + macaddr[i] = addr[i];
> +
> + of_update_property(np, pmac);
> +
> +eth_fixup_no_mem:
> + clk_disable_unprepare(clk);
> + clk_put(clk);
> +eth_fixup_skip:
> + of_node_put(pnp);
> + }
> +}
> +
> +void __init dns323_init_dt(void)
> +{
> + if (of_machine_is_compatible("dlink,dns323a1")) {
> + writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */
I spotted this in dns323-setup.c as well. Do you have any idea what it
does?
Andrew
next prev parent reply other threads:[~2022-09-22 21:11 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 16:21 [RFC RFT PATCH v1 0/1] ARM: orion5x: convert D-Link DNS-323 to the Device Tree Mauri Sandberg
2022-04-27 16:21 ` [RFC RFT PATCH v1 1/1] " Mauri Sandberg
2022-04-27 18:12 ` Arnd Bergmann
2022-04-28 20:06 ` Mauri Sandberg
2022-04-28 20:47 ` Arnd Bergmann
2022-04-28 7:13 ` Krzysztof Kozlowski
2022-04-28 20:09 ` Mauri Sandberg
2022-04-27 18:10 ` [RFC RFT PATCH v1 0/1] " Arnd Bergmann
2022-04-28 0:18 ` Andrew Lunn
2022-04-28 20:25 ` Mauri Sandberg
2022-04-28 23:26 ` Andrew Lunn
2022-05-03 8:20 ` Mauri Sandberg
2022-04-28 20:01 ` Mauri Sandberg
2022-04-28 20:56 ` Arnd Bergmann
2022-05-08 14:06 ` Mauri Sandberg
2022-05-08 15:02 ` Arnd Bergmann
[not found] ` <20220508152237.3hw657gcba2fvheq@pali>
2022-05-08 19:34 ` Mauri Sandberg
[not found] ` <20220508201044.qyh75mb4x64uuhfc@pali>
2022-05-09 10:52 ` Mauri Sandberg
[not found] ` <20220508154126.3wubyyunpuxetswm@pali>
2022-05-09 7:21 ` Arnd Bergmann
2022-05-09 10:48 ` Mauri Sandberg
2022-04-28 0:29 ` Andrew Lunn
2022-09-22 20:24 ` [PATCH v2 0/3] ARM: orion5x: add D-Link DNS323 based on device treee Mauri Sandberg
2022-09-22 20:24 ` [PATCH v2 1/3] dt-bindings: arm: add DT binding for D-Link DNS-323 Mauri Sandberg
2022-09-22 20:36 ` Andrew Lunn
2022-09-23 9:18 ` Krzysztof Kozlowski
2022-09-22 20:24 ` [PATCH v2 2/3] ARM: dts: orion5x: Add D-Link DNS-323 Device Tree Mauri Sandberg
2022-09-22 20:45 ` Andrew Lunn
2022-09-22 21:14 ` Pali Rohár
2022-09-22 21:32 ` Andrew Lunn
2022-09-23 9:19 ` Krzysztof Kozlowski
2022-09-27 11:26 ` kernel test robot
2022-09-27 22:56 ` kernel test robot
2022-09-22 20:24 ` [PATCH v2 3/3] ARM: orion5x: Add D-Link DNS-323 based on " Mauri Sandberg
2022-09-22 21:10 ` Andrew Lunn [this message]
2022-09-23 9:03 ` maukka
2022-09-23 12:12 ` Andrew Lunn
2022-09-23 18:02 ` Pali Rohár
2022-09-26 11:56 ` maukka
2022-09-26 12:23 ` Pali Rohár
2022-09-28 13:32 ` [EXT] " Elad Nachman
2022-09-30 15:40 ` Pali Rohár
2022-09-22 21:39 ` Arnd Bergmann
2022-09-23 9:13 ` maukka
2022-09-23 9:24 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YyzPVMrfcOkvngxl@lunn.ch \
--to=andrew@lunn.ch \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=gregory.clement@bootlin.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maukka@ext.kapsi.fi \
--cc=olof@lixom.net \
--cc=pali@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).