Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/31822/?format=api
{ "id": 31822, "url": "http://patchwork.ozlabs.org/api/patches/31822/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20090821163640.7391.12133.stgit@terra/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<20090821163640.7391.12133.stgit@terra>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20090821163640.7391.12133.stgit@terra/", "date": "2009-08-21T16:36:40", "name": "[V2] Use clock freqency from the device tree to calculate correct MPC5200 PSC clock.", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "1f273c42e5471cda208f7fd39dffdfe4fa2c1731", "submitter": { "id": 375, "url": "http://patchwork.ozlabs.org/api/people/375/?format=api", "name": "jonsmirl@gmail.com", "email": "jonsmirl@gmail.com" }, "delegate": { "id": 8, "url": "http://patchwork.ozlabs.org/api/users/8/?format=api", "username": "glikely", "first_name": "Grant", "last_name": "Likely", "email": "grant.likely@secretlab.ca" }, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20090821163640.7391.12133.stgit@terra/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/31822/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/31822/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>", "X-Original-To": "patchwork-incoming@bilbo.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "patchwork-incoming@ozlabs.org", "linuxppc-dev@ozlabs.org" ], "Received": [ "from ozlabs.org (ozlabs.org [203.10.76.45])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client CN \"mx.ozlabs.org\",\n\tIssuer \"CA Cert Signing Authority\" (verified OK))\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id E9BC7B7B77\n\tfor <patchwork-incoming@bilbo.ozlabs.org>;\n\tSat, 22 Aug 2009 02:44:22 +1000 (EST)", "by ozlabs.org (Postfix)\n\tid DCCC1DDD0B; Sat, 22 Aug 2009 02:44:22 +1000 (EST)", "from bilbo.ozlabs.org (bilbo.ozlabs.org [203.10.76.25])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client CN \"bilbo.ozlabs.org\",\n\tIssuer \"CAcert Class 3 Root\" (verified OK))\n\tby ozlabs.org (Postfix) with ESMTPS id D676FDDD01\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 22 Aug 2009 02:44:22 +1000 (EST)", "from bilbo.ozlabs.org (localhost [127.0.0.1])\n\tby bilbo.ozlabs.org (Postfix) with ESMTP id 68403B7E2B\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 22 Aug 2009 02:44:04 +1000 (EST)", "from ozlabs.org (ozlabs.org [203.10.76.45])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client CN \"mx.ozlabs.org\",\n\tIssuer \"CA Cert Signing Authority\" (verified OK))\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 74460B6F31\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tSat, 22 Aug 2009 02:43:56 +1000 (EST)", "by ozlabs.org (Postfix)\n\tid 673DCDDD0B; Sat, 22 Aug 2009 02:43:56 +1000 (EST)", "from mail-yw0-f171.google.com (mail-yw0-f171.google.com\n\t[209.85.211.171]) by ozlabs.org (Postfix) with ESMTP id 8F911DDD04\n\tfor <Linuxppc-dev@ozlabs.org>; Sat, 22 Aug 2009 02:43:54 +1000 (EST)", "by ywh1 with SMTP id 1so1160149ywh.9\n\tfor <Linuxppc-dev@ozlabs.org>; Fri, 21 Aug 2009 09:43:53 -0700 (PDT)", "by 10.91.178.19 with SMTP id f19mr1087910agp.33.1250872606445;\n\tFri, 21 Aug 2009 09:36:46 -0700 (PDT)", "from terra (c-76-109-159-38.hsd1.fl.comcast.net [76.109.159.38])\n\tby mx.google.com with ESMTPS id 20sm2964860agd.63.2009.08.21.09.36.45\n\t(version=TLSv1/SSLv3 cipher=RC4-MD5);\n\tFri, 21 Aug 2009 09:36:45 -0700 (PDT)", "from localhost ([127.0.0.1] helo=[127.0.1.1])\n\tby terra with esmtp (Exim 4.69) (envelope-from <jonsmirl@gmail.com>)\n\tid 1MeX6X-0001va-1W; Fri, 21 Aug 2009 12:36:41 -0400" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; \n\th=domainkey-signature:received:received:received:subject:to:from:date\n\t:message-id:user-agent:mime-version:content-type\n\t:content-transfer-encoding;\n\tbh=wQ+CdL9QeJaXL4dXsiHpbsICGZoKdVoZ4o2EovFCLAo=;\n\tb=H9cv7SFVJxWua8lY1wo3+LK51ihxHc0zE4Fj6f7hw7Pa42x97r7SCZ6NhFzdpcWN63\n\t0jBTJwUwlKTJlu99iNTjEoYc3pfVcAP0ykpyimWFFLakzbhn9LKbYmkn9VCiV5TQs0wA\n\t2CWh1zKm5OMs+N/F74UAMjgyML8TGQ/MEB97g=", "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\n\th=subject:to:from:date:message-id:user-agent:mime-version\n\t:content-type:content-transfer-encoding;\n\tb=VEOFFiQchteT87Z2O+zscUR1Jgk0sISJJWABbQFx0fnjQPs9lzc7IMUNYT19Sk2SfA\n\tx1schok/7dXjAqrJ1xyxYlXYlBDyv+J+iGqNnFR1y23Z1unT6Z9R8z4xgXxny8enJ+Xd\n\tiVy3pWC9+4cqOPn3gRmwo+xrcGeDpRQv/00b0=", "Subject": "[PATCH V2] Use clock freqency from the device tree to calculate\n\tcorrect MPC5200 PSC clock.", "To": "grant.likely@secretlab.ca, Linuxppc-dev@ozlabs.org", "From": "Jon Smirl <jonsmirl@gmail.com>", "Date": "Fri, 21 Aug 2009 12:36:40 -0400", "Message-ID": "<20090821163640.7391.12133.stgit@terra>", "User-Agent": "StGit/0.15-rc1-2-g3ba2", "MIME-Version": "1.0", "X-BeenThere": "linuxppc-dev@lists.ozlabs.org", "X-Mailman-Version": "2.1.12", "Precedence": "list", "List-Id": "Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev>", "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>", "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org", "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org" }, "content": "Use clock freqency from the device tree to calculate correct MPC5200 PSC clock.\nPrevious code had errors or used a constant. This versions computes\nthe right clock based on the xtal and register settings.\n\nAdjusted from previous version to rebase onto current Linus tree.\n\nSigned-off-by: Jon Smirl <jonsmirl@gmail.com>\n---\n arch/powerpc/include/asm/mpc52xx.h | 2 +-\n arch/powerpc/platforms/52xx/mpc52xx_common.c | 26 ++++++++++++++++++++++++--\n drivers/spi/mpc52xx_psc_spi.c | 8 +-------\n sound/soc/fsl/mpc5200_psc_i2s.c | 12 +++++++++---\n 4 files changed, 35 insertions(+), 13 deletions(-)", "diff": "diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h\nindex cadd398..1ca8a0e 100644\n--- a/arch/powerpc/include/asm/mpc52xx.h\n+++ b/arch/powerpc/include/asm/mpc52xx.h\n@@ -285,7 +285,7 @@ struct mpc52xx_rtc {\n extern void mpc5200_setup_xlb_arbiter(void);\n extern void mpc52xx_declare_of_platform_devices(void);\n extern void mpc52xx_map_common_devices(void);\n-extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv);\n+extern int mpc52xx_set_psc_clkdiv(int psc_id, int freq);\n extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node);\n extern void mpc52xx_restart(char *cmd);\n \ndiff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c\nindex a46bad0..8a19156 100644\n--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c\n+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c\n@@ -110,6 +110,8 @@ static struct of_device_id mpc52xx_cdm_ids[] __initdata = {\n \t{}\n };\n \n+static u32 mpc52xx_fsystem; /* fsystem clock on mpc5200 */\n+\n /**\n * mpc52xx_map_common_devices: iomap devices required by common code\n */\n@@ -117,6 +119,7 @@ void __init\n mpc52xx_map_common_devices(void)\n {\n \tstruct device_node *np;\n+\tu32 val;\n \n \t/* mpc52xx_wdt is mapped here and used in mpc52xx_restart,\n \t * possibly from a interrupt context. wdt is only implement\n@@ -133,8 +136,16 @@ mpc52xx_map_common_devices(void)\n \n \t/* Clock Distribution Module, used by PSC clock setting function */\n \tnp = of_find_matching_node(NULL, mpc52xx_cdm_ids);\n+\tmpc52xx_fsystem = mpc5xxx_get_bus_frequency(np);\n \tmpc52xx_cdm = of_iomap(np, 0);\n \tof_node_put(np);\n+\n+\t/* compute fsystem, it is either 4 or 8 times the bus freq */\n+\tval = in_be32(&mpc52xx_cdm->rstcfg);\n+\tif (val & (1 << 5))\n+\t\tmpc52xx_fsystem *= 8;\n+\telse\n+\t\tmpc52xx_fsystem *= 4;\n }\n \n /**\n@@ -143,17 +154,28 @@ mpc52xx_map_common_devices(void)\n * @psc_id: id of psc port; must be 1,2,3 or 6\n * @clkdiv: clock divider value to put into CDM PSC register.\n */\n-int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv)\n+int mpc52xx_set_psc_clkdiv(int psc_id, int freq)\n {\n \tunsigned long flags;\n \tu16 __iomem *reg;\n \tu32 val;\n-\tu32 mask;\n+\tu32 mask, clkdiv, err;\n \tu32 mclken_div;\n \n \tif (!mpc52xx_cdm)\n \t\treturn -ENODEV;\n \n+\t/* figure out the closest frequency the hardware can make */\n+\tclkdiv = mpc52xx_fsystem / freq;\n+\terr = mpc52xx_fsystem % freq;\n+\tif (err > freq / 2)\n+\t\tclkdiv++;\n+\t/* hardware is not very flexible, there will be significant error */\n+\t/* frequency error = fsystem / clkdiv - freq; */\n+\n+\t/* hardware adds one to the divisor */\n+\tclkdiv -= 1;\n+\n \tmclken_div = 0x8000 | (clkdiv & 0x1FF);\n \tswitch (psc_id) {\n \tcase 1: reg = &mpc52xx_cdm->mclken_div_psc1; mask = 0x20; break;\ndiff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c\nindex 1b74d5c..d000edc 100644\n--- a/drivers/spi/mpc52xx_psc_spi.c\n+++ b/drivers/spi/mpc52xx_psc_spi.c\n@@ -32,7 +32,6 @@\n struct mpc52xx_psc_spi {\n \t/* fsl_spi_platform data */\n \tvoid (*cs_control)(struct spi_device *spi, bool on);\n-\tu32 sysclk;\n \n \t/* driver internal data */\n \tstruct mpc52xx_psc __iomem *psc;\n@@ -312,12 +311,9 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)\n {\n \tstruct mpc52xx_psc __iomem *psc = mps->psc;\n \tstruct mpc52xx_psc_fifo __iomem *fifo = mps->fifo;\n-\tu32 mclken_div;\n \tint ret = 0;\n \n-\t/* default sysclk is 512MHz */\n-\tmclken_div = (mps->sysclk ? mps->sysclk : 512000000) / MCLK;\n-\tmpc52xx_set_psc_clkdiv(psc_id, mclken_div);\n+\tmpc52xx_set_psc_clkdiv(psc_id, MCLK);\n \n \t/* Reset the PSC into a known state */\n \tout_8(&psc->command, MPC52xx_PSC_RST_RX);\n@@ -382,12 +378,10 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,\n \t\tdev_warn(dev, \"probe called without platform data, no \"\n \t\t\t\t\"cs_control function will be called\\n\");\n \t\tmps->cs_control = NULL;\n-\t\tmps->sysclk = 0;\n \t\tmaster->bus_num = bus_num;\n \t\tmaster->num_chipselect = 255;\n \t} else {\n \t\tmps->cs_control = pdata->cs_control;\n-\t\tmps->sysclk = pdata->sysclk;\n \t\tmaster->bus_num = pdata->bus_num;\n \t\tmaster->num_chipselect = pdata->max_chipselect;\n \t}\ndiff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c\nindex ce8de90..2e347dd 100644\n--- a/sound/soc/fsl/mpc5200_psc_i2s.c\n+++ b/sound/soc/fsl/mpc5200_psc_i2s.c\n@@ -14,6 +14,7 @@\n #include <sound/pcm_params.h>\n #include <sound/soc.h>\n \n+#include <asm/mpc52xx.h>\n #include <asm/mpc52xx_psc.h>\n \n #include \"mpc5200_psc_i2s.h\"\n@@ -90,9 +91,14 @@ static int psc_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,\n \t\t\t int clk_id, unsigned int freq, int dir)\n {\n \tstruct psc_dma *psc_dma = cpu_dai->private_data;\n-\tdev_dbg(psc_dma->dev, \"psc_i2s_set_sysclk(cpu_dai=%p, dir=%i)\\n\",\n-\t\t\t\tcpu_dai, dir);\n-\treturn (dir == SND_SOC_CLOCK_IN) ? 0 : -EINVAL;\n+\n+\tdev_dbg(psc_dma->dev, \"psc_i2s_set_sysclk(cpu_dai=%p, freq=%u, dir=%i)\\n\",\n+\t\t\t\tcpu_dai, freq, dir);\n+\n+\tif (dir == SND_SOC_CLOCK_OUT)\n+\t\treturn mpc52xx_set_psc_clkdiv(psc_dma->id + 1, freq);\n+\n+\treturn -EINVAL;\n }\n \n /**\n", "prefixes": [ "V2" ] }