Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-07-05 Thread Jean-Christophe PLAGNIOL-VILLARD
On 00:02 Tue 17 Jun , Haavard Skinnemoen wrote:
 On Mon, 16 Jun 2008 16:13:32 -0500
 [EMAIL PROTECTED] wrote:
 
  However, I was mistaken about my code being committed into the
  official u-boot tree.  Please see my response above.
 
 Ok, I figured it must be something like that.
 
 That said, I take it this means that we have not two but _three_
 drivers for the same hardware floating around in various trees, all of
 which are forked off the original avr32 driver. I think this is another
 reason to get those drivers merged together ASAP.
 
 I also hope that we can get your MMC+ support into the common driver
 eventually, with proper attributions and copyrights of course ;-) but I
 think the merge needs to happen first.
 
 I suggest we start with the three patches I posted moving the avr32
 driver into drivers/mmc, then make the minimal set of changes necessary
 to support AT91 and Diopsis, and then start adding additional features
 from the other drivers, like MMC+ and SDHC support.
 
 The first two steps should certainly be doable in time for the next
 merge window. I suspect MMC+ and SDHC support needs more testing and
 review, but it may be doable as well.
 
 Does this sound like a good plan to everyone?

Good for me

Best Regards,
J.

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-16 Thread Ken.Fuchs
 On Fri, 13 Jun 2008 16:21:59 -0500
 Ken.Fuchs wrote:
 
  The U-Boot AT91 MCI driver is no longer the exclusive work
  of Atmel.  So, I do not believe that a sole Atmel copyright
  is correct for the AT91 MCI driver.
  
  I added MMC 4.x support to the AT91 MCI driver a while back.
  In response to a request for AT91 MMC 4.x support, I
  submitted it to the list in the form of an informal patch
  against u-boot-1.1.5_atmel1.2 on April 29, 2008.  Without
  much effort, I can see that much of the code that I added is
  still in the various files of the AT91 MCI driver, but my
  company's copyright has been removed.  (Please note that I
  never removed anyone else's copyright.)

After further investigation, I no longer believe that my MMC 4.x
MCI driver code has been committed to either the u-boot-at91 or
u-boot repository.  I've found a reasonable explanation for all
code similarities that prompted me send my first message on this
topic.  My apologies to all those involved in ensuring that
U-Boot source code complies with the GNU GPL and to the
developers of the new U-Boot Atmel MCI driver.

Haavard Skinnemoen wrote:

 Which driver are you talking about? I don't see any AT91 MCI driver in
 the u-boot tree...

u-boot-1.1.5_atmel_1.2/cpu/arm926ejs/at91sam926x/atmel_mci.c

On 2008-Apr-29 20:46 UTC, I sent to the u-boot-users mailing list
an informal patch based on u-boot-1.1.5_atmel_1.2 and an old
cpu/arm926ejs/at91sam926x/atmel_mci.c patch.  My patch
adds MMC 4.x support to the AT91SAM926x MCI driver in the
u-boot-1.1.5_atmel_1.2 tree.

However, I was mistaken about my code being committed into the
official u-boot tree.  Please see my response above.

Sincerely,

Ken Fuchs

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-16 Thread Haavard Skinnemoen
On Mon, 16 Jun 2008 16:13:32 -0500
[EMAIL PROTECTED] wrote:

 However, I was mistaken about my code being committed into the
 official u-boot tree.  Please see my response above.

Ok, I figured it must be something like that.

That said, I take it this means that we have not two but _three_
drivers for the same hardware floating around in various trees, all of
which are forked off the original avr32 driver. I think this is another
reason to get those drivers merged together ASAP.

I also hope that we can get your MMC+ support into the common driver
eventually, with proper attributions and copyrights of course ;-) but I
think the merge needs to happen first.

I suggest we start with the three patches I posted moving the avr32
driver into drivers/mmc, then make the minimal set of changes necessary
to support AT91 and Diopsis, and then start adding additional features
from the other drivers, like MMC+ and SDHC support.

The first two steps should certainly be doable in time for the next
merge window. I suspect MMC+ and SDHC support needs more testing and
review, but it may be doable as well.

Does this sound like a good plan to everyone?

Haavard

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-15 Thread Haavard Skinnemoen
On Fri, 13 Jun 2008 16:21:59 -0500
[EMAIL PROTECTED] wrote:

 The U-Boot AT91 MCI driver is no longer the exclusive work
 of Atmel.  So, I do not believe that a sole Atmel copyright
 is correct for the AT91 MCI driver.
 
 I added MMC 4.x support to the AT91 MCI driver a while back.
 In response to a request for AT91 MMC 4.x support, I
 submitted it to the list in the form of an informal patch
 against u-boot-1.1.5_atmel1.2 on April 29, 2008.  Without
 much effort, I can see that much of the code that I added is
 still in the various files of the AT91 MCI driver, but my
 company's copyright has been removed.  (Please note that I
 never removed anyone else's copyright.)

Which driver are you talking about? I don't see any AT91 MCI driver in
the u-boot tree...I thought Antonio based his work on the
cpu/at32ap/atmel_mci.c driver?

Haavard

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-14 Thread Wolfgang Denk
In message [EMAIL PROTECTED] you wrote:

 Can someone please clarify how copyright of derivative works is
 handled within the U-Boot source code trees?  For example, how
 much source code needs to be added/modified/removed to justify
 a copyright notice for the changes?

U-Boot is a big project with many contributors, and somethimes things
go wrong, or erros don't get detected. But we try, and I can assure
you that we tray really hard, to respect both Copyrightrs and
Licenses.


In this specific case it seems it was not the U-Boot community in
general that messed with your copyright entries, but some specific
vendor.

I would appreciate comments from the guys who feel responsible for
this.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [EMAIL PROTECTED]
For those who like this sort of thing, this is the sort of thing they
like.   - Abraham Lincoln

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-13 Thread Ken.Fuchs
 Signed-off-by: Antonio R. Costa [EMAIL PROTECTED]
 
 diff --git a/board/atmel/at572d940hfeb/atmel_mci.c 
 b/board/atmel/at572d940hfeb/atmel_mci.c
 new file mode 100644
 index 000..065a85b
 --- /dev/null
 +++ b/board/atmel/at572d940hfeb/atmel_mci.c
 @@ -0,0 +1,869 @@
 +/*
 + * (C) Copyright 2008 Atmel Corporation
 + * 
 + * Antonio R. Costa antonio.costa  at atmel.com
 + *  costa.antonior at gmail.com

The U-Boot AT91 MCI driver is no longer the exclusive work
of Atmel.  So, I do not believe that a sole Atmel copyright
is correct for the AT91 MCI driver.

I added MMC 4.x support to the AT91 MCI driver a while back.
In response to a request for AT91 MMC 4.x support, I
submitted it to the list in the form of an informal patch
against u-boot-1.1.5_atmel1.2 on April 29, 2008.  Without
much effort, I can see that much of the code that I added is
still in the various files of the AT91 MCI driver, but my
company's copyright has been removed.  (Please note that I
never removed anyone else's copyright.)

I'm not implying that Antonio removed my company's copyright
notice, since I don't know exactly when the copyright was
removed.

However, when someone adds a significant amount of code to a
source file of a free software (GNU GPL licensed) project,
isn't it a reasonable expectation that their copyright would
be respected and thus not removed?

Can someone please clarify how copyright of derivative works is
handled within the U-Boot source code trees?  For example, how
much source code needs to be added/modified/removed to justify
a copyright notice for the changes?

Thanks,

Ken Fuchs

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-12 Thread Pierre Savary
Hi Antonio,
Where could we define IF_TYPE_SDHC?
Thanks in advance,
Best Regards

Pierre


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-12 Thread Pierre Savary
Hi Antonio,
It doesn't work on my board (at91sam9260 + SD 4Go sandisk). I send you some
traces. Could you help me please?

U-Boot by KLK  mmcinit
mmc: clock 15 too low; setting CLKDIV to 255
mmc: Probing for SDHC ...
mmc: SD 2.0 or later card found
No MMC card found

Thanks in advance,
Best Regards,

Pierre


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-12 Thread Ulf Samuelsson
Hi Ulf, good to hear from you again.
I'm trying apply patches to U-Boot but they beat my hands a bit,
they are very severe :). Now I'm fixing // comments, line lentgh, ...

SDHC patch is not complete because PATCH 2/3 bounced due to size problem (40.5 
KB)
so the patch is invalid.

Anyway, in my patch I introduced a function that computes the frequency runtime
and I use it to configure the DTOR register so some care should be taken here.

As I written in the patch I put atmel_mci.c and atmel_mci.h in relevant board 
directories
insted in drivers because this is a proposal.

== That is OK, better to have it running for the Diopsis first, and 
only then we should worry about merging with the rest.

In fact I want to get the rid of MASTER_CLOCK declaration to have U-Boot able 
to run at different frequencies.
The one in my atmel_mci.c is just the first step.

Regards,
Antonio



Best Regards
Ulf Samuelsson


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-12 Thread Ulf Samuelsson
 
 Dear Ulf,
 
 Please either replace your Outlook Express (I would recommend 
 Thunderbird) or configure it to quote acceptably (e.g. the   in the 
 left hand column - I know Outlook can be configured this way, I don't 
 know about OE).  Your addition to Antonio's email is very difficult to 
 identify.
 

It is configured to do this, but it will bomb on emails which
(IIRC) have non-compliant line-lenghts.
Some get quoted and some do not.

 If you *cannot* replace your Outlook Express emailer, please consider 
 installing OE-QuoteFix.
   http://home.in.tum.de/~jain/software/oe-quotefix/

My main problem is how to get my 500-1000 email sorting rules
over to a new client, so QuoteFix is probably the best choice.

Best Regards
Ulf Samuelsson


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-12 Thread Ben Warren
COSTA, Antonio wrote:

 Hi Ulf, good to hear from you again.
 I'm trying apply patches to U-Boot but they beat my hands a bit,
 they are very severe :). Now I'm fixing // comments, line lentgh, ...

Geez, if you think my comments were severe, you're in for a rude 
awakening (no pun intended).  I think you'll find I'm more of a 'good 
cop' reviewer.

regards,
Ben

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


[U-Boot-Users] [PATCH 1/3] SDHC Support for AT572d940HF-EB

2008-06-11 Thread Antonio R. Costa
Logic unit: SDHC Support
Purpose:Add support for SD/SDHC cards for AT572D940HF-EB
Author: Antnoio R. Costa antonio.costa at atmel.com
Date  : 11 Jun 2008

Status
~~

This patch add support for SD/SDHC cards to AT572D940HF-EB
and more generally is a proposal for all Atmel chips.
Dued to that I placed atmel_mci.c under the board directory.
Plaese give me some feedbacks.

The implementation of the CSD interpretation has been re-worked
completely. Bit fields are not portable so there were replaced by
a vector of 4 32-bit words and some macros.

Probing process follow the schema from SD spec 2.0:
  sdhc -- sd -- mmc

Introduced IF_TYPE_SDHC to distinguish between SD and SDHC.
Maybe this is not the best method since struct block_dev_descr.priv
could point to a structure describing card properties but it was
the quickest one and I had no time to spend.

Tested SD:
  - Mediacom512 MB (spec 1.0)  bare FAT16
  - Kingstone 1 GB (spec 1.0)  FAT16
  - Trascend  2 GB (spec 1.01) FAT16
  - TakeMS4 GB (spec 1.10) FAT16

Tested SDHC:
  - Peak  8 GB (spec 2.0)  FAT32

Signed-off-by: Antonio R. Costa [EMAIL PROTECTED]

diff --git a/board/atmel/at572d940hfeb/atmel_mci.c 
b/board/atmel/at572d940hfeb/atmel_mci.c
new file mode 100644
index 000..065a85b
--- /dev/null
+++ b/board/atmel/at572d940hfeb/atmel_mci.c
@@ -0,0 +1,869 @@
+/*
+ * (C) Copyright 2008 Atmel Corporation
+ * 
+ * Antonio R. Costa antonio.costa  at atmel.com
+ *  costa.antonior at gmail.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+
+#ifdef CONFIG_MMC
+
+#include part.h
+#include mmc.h
+
+#include asm/io.h
+#include asm/errno.h
+#include asm/byteorder.h
+#include asm/arch/clk.h
+#include asm/arch/memory-map.h
+#include asm/arch/timer.h
+#include fat.h
+
+#include asm/arch/atmel_mci.h
+
+#ifdef DEBUG
+#define pr_debug(fmt, args...) printf(fmt, ##args)
+#else
+#define pr_debug(...) do { } while(0)
+#endif
+
+#ifndef CFG_MMC_CLK_OD
+#define CFG_MMC_CLK_OD 15
+#endif
+
+#ifndef CFG_MMC_CLK_PP
+#define CFG_MMC_CLK_PP 500
+#endif
+
+#ifndef CFG_MMC_OP_COND
+#define CFG_MMC_OP_COND0x401f8000
+#endif
+
+#define MMC_DEFAULT_BLKLEN 512
+#define MMC_DEFAULT_RCA1
+
+static unsigned int mmc_rca;
+static int mmc_card_is_sd;
+static block_dev_desc_t mmc_blkdev;
+
+block_dev_desc_t *mmc_get_dev(int dev)
+{
+   return mmc_blkdev;
+}
+
+static int mci_reset(void)
+{
+
+   mmci_writel(CR, MMCI_BIT(SWRST));
+   mmci_writel(CR, MMCI_BIT(MCIEN));
+   mmci_writel(CR, MMCI_BIT(PWSDIS));
+
+   mmci_writel(CMDR, (1  11) | (1  8));// Init command
+   while (!(mmci_readl(SR)  MMCI_BIT(CMDRDY))) ;
+   return 0;
+}
+
+static void mci_set_mode(unsigned long hz, unsigned long blklen)
+{
+   unsigned long bus_hz;
+   unsigned long clkdiv;
+
+   bus_hz = get_mci_clk_rate();
+   clkdiv = (bus_hz / hz) / 2 - 1;
+
+   pr_debug(mmc: setting clock %lu Hz, clkdiv %lu, block size %lu\n,
+hz, clkdiv, blklen);
+
+   if (clkdiv  ~255UL) {
+   clkdiv = 255;
+   printf(mmc: clock %lu too low; setting CLKDIV to 255\n, hz);
+   }
+
+   blklen = 0xfffc;
+   mmci_writel(MR, (MMCI_BF(CLKDIV, clkdiv)
+| MMCI_BF(BLKLEN, blklen)
+| MMCI_BIT(RDPROOF)
+| MMCI_BIT(WRPROOF)));
+}
+
+#define RESP_NO_CRC1
+#define R1 MMCI_BF(RSPTYP, 1)  // 48-bit CRC
+#define R2 MMCI_BF(RSPTYP, 2)  // 136-bit CRC
+#define R3 (R1 | RESP_NO_CRC)
+#define R6 R1
+#define R7 R1
+#define NIDMMCI_BF(MAXLAT, 0)
+#define NCRMMCI_BF(MAXLAT, 1)
+#define TRCMD_STARTMMCI_BF(TRCMD, 1)
+#define TRDIR_READ MMCI_BF(TRDIR, 1)
+#define TRTYP_BLOCKMMCI_BF(TRTYP, 0)
+#define INIT_CMD   MMCI_BF(SPCMD, 1)
+#define OPEN_DRAIN MMCI_BF(OPDCMD, 1)
+
+#define ERROR_FLAGS(MMCI_BIT(DTOE) \
+| MMCI_BIT(RDIRE)  \
+| MMCI_BIT(RENDE)  \
+| MMCI_BIT(RINDE)