From: Josh Cartwright <joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> To: Georgi Djakov <gdjakov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org> Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cjb-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org, ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, pawel.moll-5wv7dgnIgG8@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org, galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org, rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org, linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: Re: [PATCH v9 3/3] mmc: sdhci-msm: Add platform_execute_tunning implementation Date: Fri, 28 Feb 2014 14:51:19 -0600 [thread overview] Message-ID: <20140228205119.GJ7308@joshc.qualcomm.com> (raw) In-Reply-To: <1393586675-14628-4-git-send-email-gdjakov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org> On Fri, Feb 28, 2014 at 01:24:35PM +0200, Georgi Djakov wrote: > This patch adds implementation for platform specific tuning in order to support > HS200 bus speed mode on Qualcomm SDHCI controller. > > Signed-off-by: Asutosh Das <asutoshd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> > Signed-off-by: Venkat Gopalakrishnan <venkatg-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> > Signed-off-by: Georgi Djakov <gdjakov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org> > --- > drivers/mmc/host/sdhci-msm.c | 424 +++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 418 insertions(+), 6 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c > index b4490a2..69f6887 100644 > --- a/drivers/mmc/host/sdhci-msm.c > +++ b/drivers/mmc/host/sdhci-msm.c [..] > +int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode) > +{ > + int tuning_seq_cnt = 3; > + u8 phase, *data_buf, tuned_phases[16], tuned_phase_cnt = 0; > + const u32 *tuning_block_pattern = tuning_block_64; > + int size = sizeof(tuning_block_64); /* Pattern size in bytes */ > + int rc; > + struct mmc_host *mmc = host->mmc; > + struct mmc_ios ios = host->mmc->ios; > + > + /* > + * Tuning is required for SDR104, HS200 and HS400 cards and > + * if clock frequency is greater than 100MHz in these modes. > + */ > + if (host->clock <= 100 * 1000 * 1000 || > + !((ios.timing == MMC_TIMING_MMC_HS200) || > + (ios.timing == MMC_TIMING_UHS_SDR104))) > + return 0; > + > + if ((opcode == MMC_SEND_TUNING_BLOCK_HS200) && > + (mmc->ios.bus_width == MMC_BUS_WIDTH_8)) { > + tuning_block_pattern = tuning_block_128; > + size = sizeof(tuning_block_128); > + } > + > + data_buf = kmalloc(size, GFP_KERNEL); > + if (!data_buf) > + return -ENOMEM; > + > +retry: > + /* First of all reset the tuning block */ > + rc = msm_init_cm_dll(host); > + if (rc) > + goto out; > + > + phase = 0; > + do { > + struct mmc_command cmd = { 0 }; > + struct mmc_data data = { 0 }; > + struct mmc_request mrq = { > + .cmd = &cmd, > + .data = &data > + }; > + struct scatterlist sg; > + > + /* Set the phase in delay line hw block */ > + rc = msm_config_cm_dll_phase(host, phase); > + if (rc) > + goto out; > + > + cmd.opcode = opcode; > + cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC; > + > + data.blksz = size; > + data.blocks = 1; > + data.flags = MMC_DATA_READ; > + data.timeout_ns = NSEC_PER_SEC; /* 1 second */ > + > + data.sg = &sg; > + data.sg_len = 1; > + sg_init_one(&sg, data_buf, sizeof(data_buf)); > + memset(data_buf, 0, sizeof(data_buf)); > + mmc_wait_for_req(mmc, &mrq); > + > + if (!cmd.error && !data.error && > + !memcmp(data_buf, tuning_block_pattern, sizeof(data_buf))) { This memcmp is broken, sizeof(data_buf) is likely not what you want, maybe you want 'size'? Same thing for sg_init_one()/memset() above. From sparse: drivers/mmc/host/sdhci-msm.c: In function âsdhci_msm_execute_tuningâ: drivers/mmc/host/sdhci-msm.c:461:53: warning: argument to âsizeofâ in âmemcmpâ call is the same expression as the first source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess] !memcmp(data_buf, tuning_block_pattern, sizeof(data_buf))) { -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Josh Cartwright <joshc@codeaurora.org> To: Georgi Djakov <gdjakov@mm-sol.com> Cc: linux-mmc@vger.kernel.org, cjb@laptop.org, ulf.hansson@linaro.org, devicetree@vger.kernel.org, grant.likely@linaro.org, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, swarren@wwwdotorg.org, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, rob@landley.net, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH v9 3/3] mmc: sdhci-msm: Add platform_execute_tunning implementation Date: Fri, 28 Feb 2014 14:51:19 -0600 [thread overview] Message-ID: <20140228205119.GJ7308@joshc.qualcomm.com> (raw) In-Reply-To: <1393586675-14628-4-git-send-email-gdjakov@mm-sol.com> On Fri, Feb 28, 2014 at 01:24:35PM +0200, Georgi Djakov wrote: > This patch adds implementation for platform specific tuning in order to support > HS200 bus speed mode on Qualcomm SDHCI controller. > > Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> > Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org> > Signed-off-by: Georgi Djakov <gdjakov@mm-sol.com> > --- > drivers/mmc/host/sdhci-msm.c | 424 +++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 418 insertions(+), 6 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c > index b4490a2..69f6887 100644 > --- a/drivers/mmc/host/sdhci-msm.c > +++ b/drivers/mmc/host/sdhci-msm.c [..] > +int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode) > +{ > + int tuning_seq_cnt = 3; > + u8 phase, *data_buf, tuned_phases[16], tuned_phase_cnt = 0; > + const u32 *tuning_block_pattern = tuning_block_64; > + int size = sizeof(tuning_block_64); /* Pattern size in bytes */ > + int rc; > + struct mmc_host *mmc = host->mmc; > + struct mmc_ios ios = host->mmc->ios; > + > + /* > + * Tuning is required for SDR104, HS200 and HS400 cards and > + * if clock frequency is greater than 100MHz in these modes. > + */ > + if (host->clock <= 100 * 1000 * 1000 || > + !((ios.timing == MMC_TIMING_MMC_HS200) || > + (ios.timing == MMC_TIMING_UHS_SDR104))) > + return 0; > + > + if ((opcode == MMC_SEND_TUNING_BLOCK_HS200) && > + (mmc->ios.bus_width == MMC_BUS_WIDTH_8)) { > + tuning_block_pattern = tuning_block_128; > + size = sizeof(tuning_block_128); > + } > + > + data_buf = kmalloc(size, GFP_KERNEL); > + if (!data_buf) > + return -ENOMEM; > + > +retry: > + /* First of all reset the tuning block */ > + rc = msm_init_cm_dll(host); > + if (rc) > + goto out; > + > + phase = 0; > + do { > + struct mmc_command cmd = { 0 }; > + struct mmc_data data = { 0 }; > + struct mmc_request mrq = { > + .cmd = &cmd, > + .data = &data > + }; > + struct scatterlist sg; > + > + /* Set the phase in delay line hw block */ > + rc = msm_config_cm_dll_phase(host, phase); > + if (rc) > + goto out; > + > + cmd.opcode = opcode; > + cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC; > + > + data.blksz = size; > + data.blocks = 1; > + data.flags = MMC_DATA_READ; > + data.timeout_ns = NSEC_PER_SEC; /* 1 second */ > + > + data.sg = &sg; > + data.sg_len = 1; > + sg_init_one(&sg, data_buf, sizeof(data_buf)); > + memset(data_buf, 0, sizeof(data_buf)); > + mmc_wait_for_req(mmc, &mrq); > + > + if (!cmd.error && !data.error && > + !memcmp(data_buf, tuning_block_pattern, sizeof(data_buf))) { This memcmp is broken, sizeof(data_buf) is likely not what you want, maybe you want 'size'? Same thing for sg_init_one()/memset() above. >From sparse: drivers/mmc/host/sdhci-msm.c: In function âsdhci_msm_execute_tuningâ: drivers/mmc/host/sdhci-msm.c:461:53: warning: argument to âsizeofâ in âmemcmpâ call is the same expression as the first source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess] !memcmp(data_buf, tuning_block_pattern, sizeof(data_buf))) { -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2014-02-28 20:51 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-02-28 11:24 [PATCH v9 0/3] mmc: sdhci-msm: Add support for Qualcomm chipsets Georgi Djakov 2014-02-28 11:24 ` [PATCH v9 1/3] mmc: sdhci-msm: Qualcomm SDHCI binding documentation Georgi Djakov 2014-03-03 2:03 ` Bjorn Andersson 2014-02-28 11:24 ` [PATCH v9 2/3] mmc: sdhci-msm: Initial support for Qualcomm chipsets Georgi Djakov 2014-03-04 3:15 ` Bjorn Andersson 2014-03-04 17:50 ` Georgi Djakov 2014-02-28 11:24 ` [PATCH v9 3/3] mmc: sdhci-msm: Add platform_execute_tunning implementation Georgi Djakov 2014-02-28 16:51 ` Kumar Gala 2014-02-28 22:10 ` Georgi Djakov 2014-02-28 20:45 ` Josh Cartwright [not found] ` <1393586675-14628-4-git-send-email-gdjakov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org> 2014-02-28 20:51 ` Josh Cartwright [this message] 2014-02-28 20:51 ` Josh Cartwright 2014-02-28 22:29 ` Georgi Djakov
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=20140228205119.GJ7308@joshc.qualcomm.com \ --to=joshc-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \ --cc=cjb-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org \ --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \ --cc=gdjakov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org \ --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \ --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \ --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \ --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \ --cc=rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org \ --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \ --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \ --cc=ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \ /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: linkBe 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.