All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel Kochmański" <dkochmanski@turtle-solutions.eu>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/5] nand: sunxi: And a20_nandread command utilizing spl nand read driver
Date: Tue, 05 May 2015 11:17:25 +0200	[thread overview]
Message-ID: <87zj5jtmca.fsf@hellsgate.pl> (raw)
In-Reply-To: <55478040.2090902@redhat.com>


Hans de Goede writes:

> Hi,
>
> On 05/02/2015 04:26 PM, Ian Campbell wrote:
>> On Wed, 2015-04-29 at 17:03 +0200, Daniel Kochma?ski wrote:
>>> This patch adds a20_nandread command. It is simple function utilizing
>>> function from SPL nand driver `nand_spl_load_image`.
>>>
>>> Usage: a20_nandread <address> <offset> <bytes>
>>
>> This stuff should really be integrated with cmd_nand.c rather than
>> adding an adhoc SoC specific interface.
>
> I want to go even further and I see that this really needs to be integrated
> with the blkdev code so that one can just do:
>
> ls nand 0:1
>
> And things will just work, these way we can also just have the standard
> boot cmds from config_distro_bootcmd.h work rather then needing special
> nand boot commands.
>
> Regards,
>
> Hans
>

It was more a convenient function then proper integration. I'll look
into that, but it may take time - I'm quite unfamiliar with U-Boot nand
interface.
>
>
>>
>>>
>>> Signed-off-by: Daniel Kochma?ski <dkochmanski@turtle-solutions.eu>
>>> Cc: Ian Campbell <ijc@hellion.org.uk>
>>> Cc: Hans De Goede <hdegoede@redhat.com>
>>> ---
>>>
>>>   common/Kconfig            |  7 +++++++
>>>   common/Makefile           |  1 +
>>>   common/cmd_a20_nandread.c | 27 +++++++++++++++++++++++++++
>>>   3 files changed, 35 insertions(+)
>>>   create mode 100644 common/cmd_a20_nandread.c
>>>
>>> diff --git a/common/Kconfig b/common/Kconfig
>>> index 5d7e48a..8edabb6 100644
>>> --- a/common/Kconfig
>>> +++ b/common/Kconfig
>>> @@ -204,6 +204,13 @@ config CMD_NAND
>>>   	help
>>>   	  NAND support.
>>>
>>> +config CMD_A20_NANDREAD
>>> +	depends on SPL_NAND_SUPPORT
>>> +	bool "a20_nandread"
>>> +	help
>>> +	  NAND read support for A20 SoC. Depends on SPL driver.
>>> +	  Usage: a20_nandread <address> <offset> <size>
>>> +
>>>   config CMD_SPI
>>>   	bool "sspi"
>>>   	help
>>> diff --git a/common/Makefile b/common/Makefile
>>> index fba3830..9286518 100644
>>> --- a/common/Makefile
>>> +++ b/common/Makefile
>>> @@ -138,6 +138,7 @@ obj-$(CONFIG_CMD_MMC) += cmd_mmc.o
>>>   obj-$(CONFIG_CMD_MMC_SPI) += cmd_mmc_spi.o
>>>   obj-$(CONFIG_MP) += cmd_mp.o
>>>   obj-$(CONFIG_CMD_MTDPARTS) += cmd_mtdparts.o
>>> +obj-$(CONFIG_CMD_A20_NANDREAD) += cmd_a20_nandread.o
>>>   obj-$(CONFIG_CMD_NAND) += cmd_nand.o
>>>   obj-$(CONFIG_CMD_NET) += cmd_net.o
>>>   obj-$(CONFIG_CMD_ONENAND) += cmd_onenand.o
>>> diff --git a/common/cmd_a20_nandread.c b/common/cmd_a20_nandread.c
>>> new file mode 100644
>>> index 0000000..7361be7
>>> --- /dev/null
>>> +++ b/common/cmd_a20_nandread.c
>>> @@ -0,0 +1,27 @@
>>> +#include <common.h>
>>> +#include <command.h>
>>> +
>>> +int nand_spl_load_image(uint32_t offs, unsigned int size, void *dest);
>>> +
>>> +static int do_a20_nandread(cmd_tbl_t *cmdtp, int flag,
>>> +			   int argc, char *const argv[])
>>> +{
>>> +	if (argc != 4) {
>>> +		printf("usage: a20_nandread <address> <offset> <bytes>\n");
>>> +		return 1;
>>> +	}
>>> +
>>> +	uint32_t dst = simple_strtoul(argv[1], NULL, 16);
>>> +	uint32_t src = simple_strtoul(argv[2], NULL, 16);
>>> +	uint32_t cnt = simple_strtoul(argv[3], NULL, 16);
>>> +	printf("Loading 0x%08XB @ 0x%08X -> 0x%08X...\n", cnt, src, dst);
>>> +	nand_spl_load_image(src, cnt, (void *)dst);
>>> +	return 0;
>>> +}
>>> +
>>> +U_BOOT_CMD(
>>> +	a20_nandread,	CONFIG_SYS_MAXARGS,	3,	do_a20_nandread,
>>> +	"a20_nandread",
>>> +	"[offset size bytes]\n"
>>> +	"   "
>>> +);
>>
>>

-- 
Daniel Kochma?ski | Pozna?, Poland
;; aka jackdaniel

"Be the change that you wish to see in the world." - Mahatma Gandhi

  reply	other threads:[~2015-05-05  9:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 15:02 [U-Boot] [PATCH 0/5] nand: sunxi: Add SPL support for booting from NAND Daniel Kochmański
2015-04-29 15:02 ` [U-Boot] [PATCH 1/5] nand: sunxi: change BLOCK_SIZE in mksunxiboot to match NAND block size Daniel Kochmański
2015-05-02 14:08   ` Ian Campbell
2015-05-05  9:02     ` Daniel Kochmański
2015-05-09 13:51       ` Ian Campbell
2015-04-29 15:02 ` [U-Boot] [PATCH 2/5] nand: sunxi: Add support for booting from internal NAND memory Daniel Kochmański
2015-05-02 14:21   ` Ian Campbell
2015-05-05  9:14     ` Daniel Kochmański
2015-05-05  9:19     ` Daniel Kochmański
2015-05-09 13:53       ` Ian Campbell
2015-05-09 14:33         ` Hans de Goede
2015-05-18 23:47   ` Scott Wood
2015-04-29 15:02 ` [U-Boot] [PATCH 3/5] nand: sunxi: Add secondary U-Boot offset on second syndrome partition Daniel Kochmański
2015-05-02 14:24   ` Ian Campbell
2015-05-05 14:21   ` Tim Harvey
2015-05-05 14:34     ` Daniel Kochmański
2015-05-18 23:10   ` Scott Wood
2015-04-29 15:03 ` [U-Boot] [PATCH 4/5] nand: sunxi: Add multiimage preload option Daniel Kochmański
2015-05-02 14:24   ` Ian Campbell
2015-05-18 23:43   ` Scott Wood
2015-04-29 15:03 ` [U-Boot] [PATCH 5/5] nand: sunxi: And a20_nandread command utilizing spl nand read driver Daniel Kochmański
2015-05-02 14:26   ` Ian Campbell
2015-05-04 14:20     ` Hans de Goede
2015-05-05  9:17       ` Daniel Kochmański [this message]
2015-05-05  9:45         ` Hans de Goede
2015-05-18 23:52   ` Scott Wood

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=87zj5jtmca.fsf@hellsgate.pl \
    --to=dkochmanski@turtle-solutions.eu \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.