diff options
author | mirko <mirko@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-12-12 11:58:53 +0000 |
---|---|---|
committer | mirko <mirko@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-12-12 11:58:53 +0000 |
commit | fc54b9bf158eea9cae647ce2c58f7d9989af173a (patch) | |
tree | 54644c1229434d7ee13c5872bda4129e34337fc0 /target/linux/s3c24xx/patches-2.6.24/1240-debug-add-glamo-drive-strength-module-param.patch.patch | |
parent | d9f49b62b28ebd245587854efa484974d90debbf (diff) |
changed Makefile and profiles, added patches for kernel 2.6.24
(stable-branch of Openmoko)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13613 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/s3c24xx/patches-2.6.24/1240-debug-add-glamo-drive-strength-module-param.patch.patch')
-rw-r--r-- | target/linux/s3c24xx/patches-2.6.24/1240-debug-add-glamo-drive-strength-module-param.patch.patch | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/target/linux/s3c24xx/patches-2.6.24/1240-debug-add-glamo-drive-strength-module-param.patch.patch b/target/linux/s3c24xx/patches-2.6.24/1240-debug-add-glamo-drive-strength-module-param.patch.patch new file mode 100644 index 000000000..04e28adaf --- /dev/null +++ b/target/linux/s3c24xx/patches-2.6.24/1240-debug-add-glamo-drive-strength-module-param.patch.patch @@ -0,0 +1,167 @@ +From 1d04b142ffeaa15129f046751f1366b0f0614f47 Mon Sep 17 00:00:00 2001 +From: Andy Green <andy@openmoko.com> +Date: Mon, 21 Jul 2008 00:51:30 +0100 +Subject: [PATCH] debug-add-glamo-drive-strength-module-param.patch + Suggested-by: Werner Almesberger <werner@openmoko.org> + +This patch allows users to control two additional settings +in Glamo MCI driver from kernel commandline or module +parameters. + + +First is Glamo drive strength on SD IOs including CLK. +This ranges from 0 (weakest) to 3 (strongest). + +echo 0 > /sys/module/glamo_mci/parameters/sd_drive + +(Changes to this take effect on next SD Card transaction) + +or, from kernel commandline + +glamo_mci.sd_drive=0 + +On tests here with 0 strength, communication to SD card +(shipped 512MB Sandisk) seemed fine, and a dd of 10MB +urandom had the same md5 when written to cache as after +a reboot. I set the default to 2. + + +Second is whether we allow SD_CLK when the SD interface +is idle. + +# stop the clock when we are idle (default) +echo 0 > /sys/module/glamo_mci/parameters/sd_idleclk + +# run the SD clock all the time +echo 1 > /sys/module/glamo_mci/parameters/sd_idleclk + +(changes take effect on next SD Card transaction) + +From kernel commandline, eg: + +glamo_mci.sd_idleclk=1 + +Normally you don't want to run the SD Clock all the time. + + +Signed-off-by: Andy Green <andy@openmoko.com> +--- + drivers/mfd/glamo/glamo-mci.c | 59 +++++++++++++++++++++++++++++++--------- + 1 files changed, 45 insertions(+), 14 deletions(-) + +diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c +index 2318e6f..6585821 100644 +--- a/drivers/mfd/glamo/glamo-mci.c ++++ b/drivers/mfd/glamo/glamo-mci.c +@@ -56,6 +56,32 @@ static void glamo_mci_send_request(struct mmc_host *mmc); + static int sd_max_clk = 50000000 / 3; + module_param(sd_max_clk, int, 0644); + ++/* ++ * SD Signal drive strength ++ * ++ * you can override this on kernel commandline using ++ * ++ * glamo_mci.sd_drive=0 ++ * ++ * for example ++ */ ++ ++static int sd_drive = 2; ++module_param(sd_drive, int, 0644); ++ ++/* ++ * SD allow SD clock to run while idle ++ * ++ * you can override this on kernel commandline using ++ * ++ * glamo_mci.sd_idleclk=0 ++ * ++ * for example ++ */ ++ ++static int sd_idleclk = 0; /* disallow idle clock by default */ ++module_param(sd_idleclk, int, 0644); ++ + + + unsigned char CRC7(u8 * pu8, int cnt) +@@ -239,7 +265,9 @@ static int __glamo_mci_set_card_clock(struct glamo_mci_host *host, int freq, + if (division) + *division = 0xff; + +- __glamo_mci_fix_card_div(host, -1); /* clock off */ ++ if (!sd_idleclk) ++ /* clock off */ ++ __glamo_mci_fix_card_div(host, -1); + } + + return real_rate; +@@ -294,8 +322,9 @@ static void glamo_mci_irq(unsigned int irq, struct irq_desc *desc) + host->cmd_is_stop = 0; + } + +- /* clock off */ +- __glamo_mci_fix_card_div(host, -1); ++ if (!sd_idleclk) ++ /* clock off */ ++ __glamo_mci_fix_card_div(host, -1); + + done: + host->complete_what = COMPLETION_NONE; +@@ -428,12 +457,10 @@ static int glamo_mci_send_command(struct glamo_mci_host *host, + } else + writew(0xfff, host->base + GLAMO_REG_MMC_TIMEOUT); + +- /* Generate interrupt on txfer; drive strength max */ +- writew_dly((readw_dly(host->base + GLAMO_REG_MMC_BASIC) & 0xfe) | ++ /* Generate interrupt on txfer */ ++ writew_dly((readw_dly(host->base + GLAMO_REG_MMC_BASIC) & 0x3e) | + 0x0800 | GLAMO_BASIC_MMC_NO_CLK_RD_WAIT | +- GLAMO_BASIC_MMC_EN_COMPL_INT | +- GLAMO_BASIC_MMC_EN_DR_STR0 | +- GLAMO_BASIC_MMC_EN_DR_STR1, ++ GLAMO_BASIC_MMC_EN_COMPL_INT | (sd_drive << 6), + host->base + GLAMO_REG_MMC_BASIC); + + /* send the command out on the wire */ +@@ -620,8 +647,9 @@ done: + host->mrq = NULL; + mmc_request_done(host->mmc, cmd->mrq); + bail: +- /* stop the clock to card */ +- __glamo_mci_fix_card_div(host, -1); ++ if (!sd_idleclk) ++ /* stop the clock to card */ ++ __glamo_mci_fix_card_div(host, -1); + } + + static void glamo_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) +@@ -687,8 +715,9 @@ static void glamo_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + host->real_rate = __glamo_mci_set_card_clock(host, ios->clock, &div); + host->clk_div = div; + +- /* stop the clock to card, because we are idle until transfer */ +- __glamo_mci_fix_card_div(host, -1); ++ if (!sd_idleclk) ++ /* stop the clock to card, because we are idle until transfer */ ++ __glamo_mci_fix_card_div(host, -1); + + if ((ios->power_mode == MMC_POWER_ON) || + (ios->power_mode == MMC_POWER_UP)) { +@@ -705,8 +734,10 @@ static void glamo_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + if (host->bus_width == MMC_BUS_WIDTH_4) + n = GLAMO_BASIC_MMC_EN_4BIT_DATA; + writew_dly((readw_dly(host->base + GLAMO_REG_MMC_BASIC) & +- (~GLAMO_BASIC_MMC_EN_4BIT_DATA)) | n, +- host->base + GLAMO_REG_MMC_BASIC); ++ (~(GLAMO_BASIC_MMC_EN_4BIT_DATA | ++ GLAMO_BASIC_MMC_EN_DR_STR0 | ++ GLAMO_BASIC_MMC_EN_DR_STR1))) | n | ++ sd_drive << 6, host->base + GLAMO_REG_MMC_BASIC); + } + + +-- +1.5.6.5 + |