summaryrefslogtreecommitdiff
path: root/packages/u-boot/u-boot-1.1.4/at32stk1000/fix-mmc-data-timeout.patch
diff options
context:
space:
mode:
authorLeon Woestenberg <leon.woestenberg@gmail.com>2008-05-01 12:53:25 +0000
committerLeon Woestenberg <leon.woestenberg@gmail.com>2008-05-01 12:53:25 +0000
commit20face5dc2bfe22d6fb747c36ebfc70cad854fa4 (patch)
treee12a21f97b27b2388bba1ad2372da04f6282b241 /packages/u-boot/u-boot-1.1.4/at32stk1000/fix-mmc-data-timeout.patch
parent1c9196a130c2a4f78e89a871deebb3cd9ac60cc8 (diff)
u-boot-1.1.4: Added additional patches from Atmel AT32STK1000 BSP 2.0.0 CD, mostly LCD/splash support.
u-boot-1.1.4/at32stk1000/ap7000-add-spi-device-and-lcdc-base-address.patch | 112 + u-boot-1.1.4/at32stk1000/at32ap-add-define-for-sdram-test.patch | 117 + u-boot-1.1.4/at32stk1000/at32ap-add-framebuffer-address.patch | 11 u-boot-1.1.4/at32stk1000/at32ap-add-spi-initcalls.patch | 16 u-boot-1.1.4/at32stk1000/at32ap-add-system-manager-header-file.patch | 252 ++ u-boot-1.1.4/at32stk1000/atstk1000-add-lcd-and-spi-to-config.patch | 124 + u-boot-1.1.4/at32stk1000/atstk1000-ltv350qv-display-support.patch | 163 + u-boot-1.1.4/at32stk1000/atstk1000-spi-support.patch | 98 u-boot-1.1.4/at32stk1000/avr32-boards-fix-flash-read.patch | 120 + u-boot-1.1.4/at32stk1000/cmd-bmp-add-gzip-compressed-bmp.patch | 90 u-boot-1.1.4/at32stk1000/fix-mmc-data-timeout.patch | 101 u-boot-1.1.4/at32stk1000/lcd-add-24-bpp-support-and-atmel-lcdc-support.patch | 670 ++++++ u-boot-1.1.4/at32stk1000/lcdc-driver-for-avr32.patch | 755 +++++++ u-boot-1.1.4/at32stk1000/libavr32-add-spi-and-lcd-board-support.patch | 61 u-boot-1.1.4/at32stk1000/spi-driver-for-avr32.patch | 1026 ++++++++++ u-boot_1.1.4.bb | 48
Diffstat (limited to 'packages/u-boot/u-boot-1.1.4/at32stk1000/fix-mmc-data-timeout.patch')
-rw-r--r--packages/u-boot/u-boot-1.1.4/at32stk1000/fix-mmc-data-timeout.patch101
1 files changed, 101 insertions, 0 deletions
diff --git a/packages/u-boot/u-boot-1.1.4/at32stk1000/fix-mmc-data-timeout.patch b/packages/u-boot/u-boot-1.1.4/at32stk1000/fix-mmc-data-timeout.patch
new file mode 100644
index 0000000000..d78cbcaaaa
--- /dev/null
+++ b/packages/u-boot/u-boot-1.1.4/at32stk1000/fix-mmc-data-timeout.patch
@@ -0,0 +1,101 @@
+---
+ cpu/at32ap7xxx/mmc.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 58 insertions(+)
+
+Index: u-boot-1.1.4-avr32/cpu/at32ap7xxx/mmc.c
+===================================================================
+--- u-boot-1.1.4-avr32.orig/cpu/at32ap7xxx/mmc.c 2007-01-30 14:53:33.000000000 +0100
++++ u-boot-1.1.4-avr32/cpu/at32ap7xxx/mmc.c 2007-01-30 15:45:37.000000000 +0100
+@@ -67,6 +67,7 @@ struct mmci {
+ unsigned int rca;
+ block_dev_desc_t blkdev;
+ const struct device *dev;
++ int card_is_sd;
+ };
+
+ struct mmci mmci = {
+@@ -391,6 +392,8 @@ static int sd_init_card(struct mmci *mmc
+ mmc->rca = resp[0] >> 16;
+ if (verbose)
+ printf("SD Card detected (RCA %u)\n", mmc->rca);
++ mmc->card_is_sd = 1;
++
+ return 0;
+ }
+
+@@ -425,6 +428,57 @@ static int mmc_init_card(struct mmci *mm
+ return ret;
+ }
+
++static void mci_set_data_timeout(struct mmci *mmc, struct mmc_csd *csd)
++{
++ static const unsigned int dtomul_to_shift[] = {
++ 0, 4, 7, 8, 10, 12, 16, 20,
++ };
++ static const unsigned int taac_exp[] = {
++ 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000,
++ };
++ static const unsigned int taac_mant[] = {
++ 0, 10, 12, 13, 15, 60, 25, 30,
++ 35, 40, 45, 50, 55, 60, 70, 80,
++ };
++ unsigned int timeout_ns, timeout_clks;
++ unsigned int e, m;
++ unsigned int dtocyc, dtomul;
++ u32 dtor;
++
++ e = csd->taac & 0x07;
++ m = (csd->taac >> 3) & 0x0f;
++
++ timeout_ns = (taac_exp[e] * taac_mant[m] + 9) / 10;
++ timeout_clks = csd->nsac * 100;
++
++ timeout_clks += (((timeout_ns + 9) / 10)
++ * ((CFG_MMC_CLK_PP + 99999) / 100000) + 9999) / 10000;
++ if (!mmc->card_is_sd)
++ timeout_clks *= 10;
++ else
++ timeout_clks *= 100;
++
++ dtocyc = timeout_clks;
++ dtomul = 0;
++ while (dtocyc > 15 && dtomul < 8) {
++ dtomul++;
++ dtocyc = timeout_clks >> dtomul_to_shift[dtomul];
++ }
++
++ if (dtomul >= 8) {
++ dtomul = 7;
++ dtocyc = 15;
++ puts("Warning: Using maximum data timeout\n");
++ }
++
++ dtor = (MMCI_MKBF(MCI_DTOR_DTOMUL, dtomul)
++ | MMCI_MKBF(MCI_DTOR_DTOCYC, dtocyc));
++ mmci_writel(&mmci, MCI_DTOR, dtor);
++
++ printf("mmc: Using %u cycles data timeout (DTOR=0x%x)\n",
++ dtocyc << dtomul_to_shift[dtomul], dtor);
++}
++
+ int mmc_init(int verbose)
+ {
+ struct mmc_cid cid;
+@@ -443,6 +497,8 @@ int mmc_init(int verbose)
+ mmci_writel(&mmci, MCI_IDR, ~0UL);
+ mci_set_mode(CFG_MMC_CLK_OD, CFG_MMC_BLKLEN);
+
++ mmci.card_is_sd = 0;
++
+ ret = sd_init_card(&mmci, &cid, verbose);
+ if (ret) {
+ mmci.rca = MMC_DEFAULT_RCA;
+@@ -458,6 +514,8 @@ int mmc_init(int verbose)
+ if (verbose)
+ mmc_dump_csd(&csd);
+
++ mci_set_data_timeout(&mmci, &csd);
++
+ /* Initialize the blockdev structure */
+ sprintf(mmci.blkdev.vendor,
+ "Man %02x%04x Snr %08x",