devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: maukka@ext.kapsi.fi
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Rob Herring" <robh+dt@kernel.org>,
	krzysztof.kozlowski+dt@linaro.org,
	"Olof Johansson" <olof@lixom.net>, "Andrew Lunn" <andrew@lunn.ch>,
	"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
	"Gregory Clement" <gregory.clement@bootlin.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Pali Rohár" <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: Fri, 23 Sep 2022 12:13:24 +0300	[thread overview]
Message-ID: <f6a27b077f8b595e9c74152f1fa3c780@ext.kapsi.fi> (raw)
In-Reply-To: <89f85393-c767-4c0c-90db-d78a2927d465@www.fastmail.com>

On 23.9.2022 00:39, Arnd Bergmann wrote:
> On Thu, Sep 22, 2022, at 10:24 PM, Mauri Sandberg wrote:
>> +
>> +/* dns323_parse_hex_*() taken from tsx09-common.c; should a common
>> copy of these
>> + * functions be kept somewhere?
>> + */
>> +static int __init dns323_parse_hex_nibble(char n)
>> +{
>> +	if (n >= '0' && n <= '9')
>> +		return n - '0';
>> +
>> +	if (n >= 'A' && n <= 'F')
>> +		return n - 'A' + 10;
>> +
>> +	if (n >= 'a' && n <= 'f')
>> +		return n - 'a' + 10;
>> +
>> +	return -1;
>> +}
>> +
>> +static int __init dns323_parse_hex_byte(const char *b)
>> +{
>> +	int hi;
>> +	int lo;
>> +
>> +	hi = dns323_parse_hex_nibble(b[0]);
>> +	lo = dns323_parse_hex_nibble(b[1]);
>> +
>> +	if (hi < 0 || lo < 0)
>> +		return -1;
>> +
>> +	return (hi << 4) | lo;
>> +}
>> +
> 
> Can you use simple_strntoull() to parse the address into a u64 instead?
> 
Nice idea. Its current replacement seems to be kstrtoull(). I'll have to 
do
it byte by byte, right? Or what do you have in mind with 64bit unsigned?

>> +static int __init dns323_read_mac_addr(u8 *addr)
>> +{
>> +	int i;
>> +	char *mac_page;
>> +
>> +	/* MAC address is stored as a regular ol' string in /dev/mtdblock4
>> +	 * (0x007d0000-0x00800000) starting at offset 196480 (0x2ff80).
>> +	 */
>> +	mac_page = ioremap(DNS323_NOR_BOOT_BASE + 0x7d0000 + 196480, 1024);
>> +	if (!mac_page)
>> +		return -ENOMEM;
> 
> It would be nicer to use of_iomap() on the nor device than a
> hardcoded physical address here, at least if that doesn't add
> too much extra complexity.
> 

I'll look into this.

  reply	other threads:[~2022-09-23  9:13 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
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 [this message]
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=f6a27b077f8b595e9c74152f1fa3c780@ext.kapsi.fi \
    --to=maukka@ext.kapsi.fi \
    --cc=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=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).