All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott McNutt <smcnutt@psyent.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] NIOS2: Added DE2 board with SD support
Date: Sat, 07 Mar 2009 19:53:24 -0500	[thread overview]
Message-ID: <49B31704.2080400@psyent.com> (raw)
In-Reply-To: <51a313240812221325g5f3dfb07me24eadd71b58a2a1@mail.gmail.com>

Patch is rejected -- incomplete.

Ivan,

Contact me off-list ... we can discuss how to proceed.

Regards,
--Scott

ivanchuklist ivanchu wrote:
> Hi list,
> I wrote about my work with u-boot in the thread "[U-Boot] DE2 board with MMC
> interface (PIO based) and FAT support enabled" and i decided to post a
> patch. I would like to discuss the changes.
> I have changed the Makefile to match the binutils provided by Altera and i
> added the DE2 board.
> I have also made changes to the files cmd_mem.c to add one more command
> "dmmc". Because the SD card is not a memory mapped device in the bus like a
> flash memory, we can't deduce the direction of data (i mean when copying
> data to sd or from sd) with the function mmc2info(). I tried to solve this
> trick by using the command dmmc.
> I found problems at link level with cmd_mmc.o and cmd_mem.o because both
> files includes mmc.h, then i have two copies of the same functions in both
> objects files. I solved this problem by declaring extern the function
> mmc_init in cmd_mmc.c.
> I think i should post the file include/asm-nios2/arch-nios2/mmc.h and the
> board related files but i will wait your response.
> In include/asm-nios2/arch-nios2/mmc.h i implemented mmc_get_dev() and
> mmc_read_block() to provide access to the FAT table.
> The code is working with all the examples distributed by Altera in the DE2
> board and it should work with any SD socket interfaced by PIO cores.
> 
> diff --git a/Makefile b/Makefile
> index 4df4812..6501d08 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -163,7 +163,7 @@ ifeq ($(ARCH),nios)
>  CROSS_COMPILE = nios-elf-
>  endif
>  ifeq ($(ARCH),nios2)
> -CROSS_COMPILE = nios2-elf-
> +CROSS_COMPILE = nios2-linux-
>  endif
>  ifeq ($(ARCH),m68k)
>  CROSS_COMPILE = m68k-elf-
> @@ -3137,6 +3137,9 @@ PK1C20_config : unconfig
>  PCI5441_config : unconfig
>      @$(MKCONFIG)  PCI5441 nios2 nios2 pci5441 psyent
> 
> +DE2_config : unconfig
> +    @$(MKCONFIG)  DE2 nios2 nios2 de2 altera
> +
>  #========================================================================
>  ## Microblaze
>  #========================================================================
> diff --git a/common/cmd_mem.c b/common/cmd_mem.c
> index 400cfd7..4585795 100644
> --- a/common/cmd_mem.c
> +++ b/common/cmd_mem.c
> @@ -53,6 +53,7 @@ uint    dp_last_length = 0x40;
>  uint    mm_last_addr, mm_last_size;
> 
>  static    ulong    base_address = 0;
> +static    ulong    mmc_direction = 0;
> 
>  /* Memory Display
>   *
> @@ -355,6 +356,17 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc,
> char *argv[])
>      return rcode;
>  }
> 
> +int do_dmmc( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> +{
> +    if (argc > 1)
> +        mmc_direction = simple_strtoul(argv[1], NULL, 10);
> +    if (mmc_direction)
> +        printf("Mem to mmc\n");
> +    else
> +        printf("Mmc to mem\n");
> +    return 0;
> +}
> +
>  int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>  {
>      ulong    addr, dest, count;
> @@ -405,7 +417,7 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc,
> char *argv[])
>  #endif
> 
>  #if defined(CONFIG_CMD_MMC)
> -    if (mmc2info(dest)) {
> +    if (mmc_direction) {
>          int rc;
> 
>          puts ("Copy to MMC... ");
> @@ -422,9 +434,7 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc,
> char *argv[])
>          }
>          puts ("done\n");
>          return 0;
> -    }
> -
> -    if (mmc2info(addr)) {
> +    } else {
>          int rc;
> 
>          puts ("Copy from MMC... ");
> @@ -1221,6 +1231,14 @@ U_BOOT_CMD(
>      "[.b, .w, .l] address value [count]\n    - write memory\n"
>  );
> 
> +#if defined(CONFIG_CMD_MMC)
> +U_BOOT_CMD(
> +    dmmc,    2,    1,    do_dmmc,
> +    "dmmc    - set mmc-memory copy direction\n",
> +    "direction\n    - copy mmc<->mem\n"
> +);
> +#endif
> +
>  U_BOOT_CMD(
>      cp,    4,    1,    do_mem_cp,
>      "cp    - memory copy\n",
> diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
> index 25c9702..c9a5ac6 100644
> --- a/common/cmd_mmc.c
> +++ b/common/cmd_mmc.c
> @@ -23,7 +23,8 @@
> 
>  #include <common.h>
>  #include <command.h>
> -#include <mmc.h>
> +
> +extern int mmc_init(int);
> 
>  int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>  {
> @@ -31,6 +32,7 @@ int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char
> *argv[])
>          printf ("No MMC card found\n");
>          return 1;
>      }
> +    printf ("MMC card found\n");
>      return 0;
>  }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

      reply	other threads:[~2009-03-08  0:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-22 21:25 [U-Boot] [PATCH] NIOS2: Added DE2 board with SD support ivanchuklist ivanchu
2009-03-08  0:53 ` Scott McNutt [this message]

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=49B31704.2080400@psyent.com \
    --to=smcnutt@psyent.com \
    --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.