diff for duplicates of <1264191475.2224.1@antares> diff --git a/a/1.txt b/N1/1.txt index 5f1e804..20e9cbc 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,7 +1,7 @@ Improve the recovery of the MPC5200B's I2C bus from errors like bus hangs. -Signed-off-by: Albrecht Dre=DF <albrecht.dress@arcor.de> +Signed-off-by: Albrecht Dreß <albrecht.dress-KvP5wT2u2U0@public.gmane.org> --- @@ -31,19 +31,17 @@ Open questions: the flags (#2)? - could this code also be used on non-5200 processors? ---- linux-2.6.32-orig/drivers/i2c/busses/i2c-mpc.c 2009-12-03 04:51:21.0000= -00000 +0100 -+++ linux-2.6.32/drivers/i2c/busses/i2c-mpc.c 2010-01-22 16:05:13.000000000= - +0100 +--- linux-2.6.32-orig/drivers/i2c/busses/i2c-mpc.c 2009-12-03 04:51:21.000000000 +0100 ++++ linux-2.6.32/drivers/i2c/busses/i2c-mpc.c 2010-01-22 16:05:13.000000000 +0100 @@ -59,6 +59,7 @@ struct mpc_i2c { wait_queue_head_t queue; struct i2c_adapter adap; int irq; + u32 real_clk; }; -=20 + struct mpc_i2c_divider { -@@ -97,16 +98,32 @@ static irqreturn_t mpc_i2c_isr(int irq,=20 +@@ -97,16 +98,32 @@ static irqreturn_t mpc_i2c_isr(int irq, */ static void mpc_i2c_fixup(struct mpc_i2c *i2c) { @@ -57,7 +55,7 @@ Open questions: - udelay(30); - writeccr(i2c, CCR_MEN); - udelay(30); -+ if (i2c->real_clk =3D=3D 0) { ++ if (i2c->real_clk == 0) { + writeccr(i2c, 0); + udelay(30); + writeccr(i2c, CCR_MEN); @@ -70,12 +68,12 @@ Open questions: + udelay(30); + } else { + int k; -+ u32 delay_val =3D 1000000 / i2c->real_clk + 1; ++ u32 delay_val = 1000000 / i2c->real_clk + 1; + + if (delay_val < 2) -+ delay_val =3D 2; ++ delay_val = 2; + -+ for (k =3D 9; k; k--) { ++ for (k = 9; k; k--) { + writeccr(i2c, 0); + writeccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN); + udelay(delay_val); @@ -84,54 +82,52 @@ Open questions: + } + } } -=20 + static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) @@ -186,15 +203,18 @@ static const struct mpc_i2c_divider mpc_ {10240, 0x9d}, {12288, 0x9e}, {15360, 0x9f} }; -=20 --int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescale= -r) -+int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescale= -r, + +-int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler) ++int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler, + u32 *real_clk) { - const struct mpc_i2c_divider *div =3D NULL; - unsigned int pvr =3D mfspr(SPRN_PVR); + const struct mpc_i2c_divider *div = NULL; + unsigned int pvr = mfspr(SPRN_PVR); u32 divider; int i; -=20 + - if (!clock) + if (!clock) { -+ *real_clk =3D 0; ++ *real_clk = 0; return -EINVAL; + } -=20 + /* Determine divider value */ - divider =3D mpc5xxx_get_bus_frequency(node) / clock; + divider = mpc5xxx_get_bus_frequency(node) / clock; @@ -212,7 +232,8 @@ int mpc_i2c_get_fdr_52xx(struct device_n break; } -=20 + - return div ? (int)div->fdr : -EINVAL; -+ *real_clk =3D mpc5xxx_get_bus_frequency(node) / div->divider; ++ *real_clk = mpc5xxx_get_bus_frequency(node) / div->divider; + return (int)div->fdr; } -=20 + static void mpc_i2c_setclock_52xx(struct device_node *node, @@ -221,13 +242,14 @@ static void mpc_i2c_setclock_52xx(struct { int ret, fdr; -=20 -- ret =3D mpc_i2c_get_fdr_52xx(node, clock, prescaler); -+ ret =3D mpc_i2c_get_fdr_52xx(node, clock, prescaler, &i2c->real_clk); - fdr =3D (ret >=3D 0) ? ret : 0x3f; /* backward compatibility */ -=20 + +- ret = mpc_i2c_get_fdr_52xx(node, clock, prescaler); ++ ret = mpc_i2c_get_fdr_52xx(node, clock, prescaler, &i2c->real_clk); + fdr = (ret >= 0) ? ret : 0x3f; /* backward compatibility */ + writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); -=20 - if (ret >=3D 0) -- dev_info(i2c->dev, "clock %d Hz (fdr=3D%d)\n", clock, fdr); -+ dev_info(i2c->dev, "clock %u Hz (fdr=3D%d)\n", i2c->real_clk, + + if (ret >= 0) +- dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr); ++ dev_info(i2c->dev, "clock %u Hz (fdr=%d)\n", i2c->real_clk, + fdr); } #else /* !CONFIG_PPC_MPC52xx */ @@ -140,12 +136,12 @@ r, return -EINTR; } if (time_after(jiffies, orig_jiffies + HZ)) { -+ u8 status =3D readb(i2c->base + MPC_I2C_SR); ++ u8 status = readb(i2c->base + MPC_I2C_SR); + dev_dbg(i2c->dev, "timeout\n"); -- if (readb(i2c->base + MPC_I2C_SR) =3D=3D +- if (readb(i2c->base + MPC_I2C_SR) == - (CSR_MCF | CSR_MBB | CSR_RXAK)) -+ if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) !=3D 0) { ++ if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) { + writeb(status & ~CSR_MAL, + i2c->base + MPC_I2C_SR); mpc_i2c_fixup(i2c); @@ -156,15 +152,15 @@ r, @@ -540,6 +566,14 @@ static int __devinit fsl_i2c_probe(struc } } -=20 -+ prop =3D of_get_property(op->node, "timeout", &plen); -+ if (prop && plen =3D=3D sizeof(u32)) { -+ mpc_ops.timeout =3D *prop * HZ / 1000000; + ++ prop = of_get_property(op->node, "timeout", &plen); ++ if (prop && plen == sizeof(u32)) { ++ mpc_ops.timeout = *prop * HZ / 1000000; + if (mpc_ops.timeout < 5) -+ mpc_ops.timeout =3D 5; ++ mpc_ops.timeout = 5; + } + dev_info(i2c->dev, "timeout %u us\n", mpc_ops.timeout * 1000000 / HZ); + dev_set_drvdata(&op->dev, i2c); -=20 - i2c->adap =3D mpc_ops; + + i2c->adap = mpc_ops; diff --git a/a/content_digest b/N1/content_digest index c052ed2..b3105d2 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,15 +1,15 @@ - "From\0Albrecht Dre\303\237 <albrecht.dress@arcor.de>\0" + "From\0Albrecht Dre\303\237 <albrecht.dress-KvP5wT2u2U0@public.gmane.org>\0" "Subject\0[PATCH/RFC 1/2] 5200: improve i2c bus error recovery\0" "Date\0Fri, 22 Jan 2010 21:17:55 +0100\0" - "To\0Linux PPC Development <linuxppc-dev@ozlabs.org>" - Devicetree Discussions <devicetree-discuss@lists.ozlabs.org> - " Ben Dooks (embedded platforms) <ben-linux@fluff.org>\0" + "To\0Linux PPC Development <linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>" + Devicetree Discussions <devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org> + " Ben Dooks (embedded platforms) <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>\0" "\00:1\0" "b\0" "Improve the recovery of the MPC5200B's I2C bus from errors like bus\n" "hangs.\n" "\n" - "Signed-off-by: Albrecht Dre=DF <albrecht.dress@arcor.de>\n" + "Signed-off-by: Albrecht Dre\303\237 <albrecht.dress-KvP5wT2u2U0@public.gmane.org>\n" "\n" "---\n" "\n" @@ -39,19 +39,17 @@ " the flags (#2)?\n" "- could this code also be used on non-5200 processors?\n" "\n" - "--- linux-2.6.32-orig/drivers/i2c/busses/i2c-mpc.c\t2009-12-03 04:51:21.0000=\n" - "00000 +0100\n" - "+++ linux-2.6.32/drivers/i2c/busses/i2c-mpc.c\t2010-01-22 16:05:13.000000000=\n" - " +0100\n" + "--- linux-2.6.32-orig/drivers/i2c/busses/i2c-mpc.c\t2009-12-03 04:51:21.000000000 +0100\n" + "+++ linux-2.6.32/drivers/i2c/busses/i2c-mpc.c\t2010-01-22 16:05:13.000000000 +0100\n" "@@ -59,6 +59,7 @@ struct mpc_i2c {\n" " \twait_queue_head_t queue;\n" " \tstruct i2c_adapter adap;\n" " \tint irq;\n" "+\tu32 real_clk;\n" " };\n" - "=20\n" + " \n" " struct mpc_i2c_divider {\n" - "@@ -97,16 +98,32 @@ static irqreturn_t mpc_i2c_isr(int irq,=20\n" + "@@ -97,16 +98,32 @@ static irqreturn_t mpc_i2c_isr(int irq, \n" " */\n" " static void mpc_i2c_fixup(struct mpc_i2c *i2c)\n" " {\n" @@ -65,7 +63,7 @@ "-\tudelay(30);\n" "-\twriteccr(i2c, CCR_MEN);\n" "-\tudelay(30);\n" - "+\tif (i2c->real_clk =3D=3D 0) {\n" + "+\tif (i2c->real_clk == 0) {\n" "+\t\twriteccr(i2c, 0);\n" "+\t\tudelay(30);\n" "+\t\twriteccr(i2c, CCR_MEN);\n" @@ -78,12 +76,12 @@ "+\t\tudelay(30);\n" "+\t} else {\n" "+\t\tint k;\n" - "+\t\tu32 delay_val =3D 1000000 / i2c->real_clk + 1;\n" + "+\t\tu32 delay_val = 1000000 / i2c->real_clk + 1;\n" "+\n" "+\t\tif (delay_val < 2)\n" - "+\t\t\tdelay_val =3D 2;\n" + "+\t\t\tdelay_val = 2;\n" "+\n" - "+\t\tfor (k =3D 9; k; k--) {\n" + "+\t\tfor (k = 9; k; k--) {\n" "+\t\t\twriteccr(i2c, 0);\n" "+\t\t\twriteccr(i2c, CCR_MSTA | CCR_MTX | CCR_MEN);\n" "+\t\t\tudelay(delay_val);\n" @@ -92,54 +90,52 @@ "+\t\t}\n" "+\t}\n" " }\n" - "=20\n" + " \n" " static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)\n" "@@ -186,15 +203,18 @@ static const struct mpc_i2c_divider mpc_\n" " \t{10240, 0x9d}, {12288, 0x9e}, {15360, 0x9f}\n" " };\n" - "=20\n" - "-int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescale=\n" - "r)\n" - "+int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescale=\n" - "r,\n" + " \n" + "-int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler)\n" + "+int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler,\n" "+\t\t\t u32 *real_clk)\n" " {\n" - " \tconst struct mpc_i2c_divider *div =3D NULL;\n" - " \tunsigned int pvr =3D mfspr(SPRN_PVR);\n" + " \tconst struct mpc_i2c_divider *div = NULL;\n" + " \tunsigned int pvr = mfspr(SPRN_PVR);\n" " \tu32 divider;\n" " \tint i;\n" - "=20\n" + " \n" "-\tif (!clock)\n" "+\tif (!clock) {\n" - "+\t\t*real_clk =3D 0;\n" + "+\t\t*real_clk = 0;\n" " \t\treturn -EINVAL;\n" "+\t}\n" - "=20\n" + " \n" " \t/* Determine divider value */\n" - " \tdivider =3D mpc5xxx_get_bus_frequency(node) / clock;\n" + " \tdivider = mpc5xxx_get_bus_frequency(node) / clock;\n" "@@ -212,7 +232,8 @@ int mpc_i2c_get_fdr_52xx(struct device_n\n" " \t\t\tbreak;\n" " \t}\n" - "=20\n" + " \n" "-\treturn div ? (int)div->fdr : -EINVAL;\n" - "+\t*real_clk =3D mpc5xxx_get_bus_frequency(node) / div->divider;\n" + "+\t*real_clk = mpc5xxx_get_bus_frequency(node) / div->divider;\n" "+\treturn (int)div->fdr;\n" " }\n" - "=20\n" + " \n" " static void mpc_i2c_setclock_52xx(struct device_node *node,\n" "@@ -221,13 +242,14 @@ static void mpc_i2c_setclock_52xx(struct\n" " {\n" " \tint ret, fdr;\n" - "=20\n" - "-\tret =3D mpc_i2c_get_fdr_52xx(node, clock, prescaler);\n" - "+\tret =3D mpc_i2c_get_fdr_52xx(node, clock, prescaler, &i2c->real_clk);\n" - " \tfdr =3D (ret >=3D 0) ? ret : 0x3f; /* backward compatibility */\n" - "=20\n" + " \n" + "-\tret = mpc_i2c_get_fdr_52xx(node, clock, prescaler);\n" + "+\tret = mpc_i2c_get_fdr_52xx(node, clock, prescaler, &i2c->real_clk);\n" + " \tfdr = (ret >= 0) ? ret : 0x3f; /* backward compatibility */\n" + " \n" " \twriteb(fdr & 0xff, i2c->base + MPC_I2C_FDR);\n" - "=20\n" - " \tif (ret >=3D 0)\n" - "-\t\tdev_info(i2c->dev, \"clock %d Hz (fdr=3D%d)\\n\", clock, fdr);\n" - "+\t\tdev_info(i2c->dev, \"clock %u Hz (fdr=3D%d)\\n\", i2c->real_clk,\n" + " \n" + " \tif (ret >= 0)\n" + "-\t\tdev_info(i2c->dev, \"clock %d Hz (fdr=%d)\\n\", clock, fdr);\n" + "+\t\tdev_info(i2c->dev, \"clock %u Hz (fdr=%d)\\n\", i2c->real_clk,\n" "+\t\t\t fdr);\n" " }\n" " #else /* !CONFIG_PPC_MPC52xx */\n" @@ -148,12 +144,12 @@ " \t\t\treturn -EINTR;\n" " \t\t}\n" " \t\tif (time_after(jiffies, orig_jiffies + HZ)) {\n" - "+\t\t\tu8 status =3D readb(i2c->base + MPC_I2C_SR);\n" + "+\t\t\tu8 status = readb(i2c->base + MPC_I2C_SR);\n" "+\n" " \t\t\tdev_dbg(i2c->dev, \"timeout\\n\");\n" - "-\t\t\tif (readb(i2c->base + MPC_I2C_SR) =3D=3D\n" + "-\t\t\tif (readb(i2c->base + MPC_I2C_SR) ==\n" "-\t\t\t (CSR_MCF | CSR_MBB | CSR_RXAK))\n" - "+\t\t\tif ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) !=3D 0) {\n" + "+\t\t\tif ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) {\n" "+\t\t\t\twriteb(status & ~CSR_MAL,\n" "+\t\t\t\t i2c->base + MPC_I2C_SR);\n" " \t\t\t\tmpc_i2c_fixup(i2c);\n" @@ -164,17 +160,17 @@ "@@ -540,6 +566,14 @@ static int __devinit fsl_i2c_probe(struc\n" " \t\t}\n" " \t}\n" - "=20\n" - "+\tprop =3D of_get_property(op->node, \"timeout\", &plen);\n" - "+\tif (prop && plen =3D=3D sizeof(u32)) {\n" - "+\t\tmpc_ops.timeout =3D *prop * HZ / 1000000;\n" + " \n" + "+\tprop = of_get_property(op->node, \"timeout\", &plen);\n" + "+\tif (prop && plen == sizeof(u32)) {\n" + "+\t\tmpc_ops.timeout = *prop * HZ / 1000000;\n" "+\t\tif (mpc_ops.timeout < 5)\n" - "+\t\t\tmpc_ops.timeout =3D 5;\n" + "+\t\t\tmpc_ops.timeout = 5;\n" "+\t}\n" "+\tdev_info(i2c->dev, \"timeout %u us\\n\", mpc_ops.timeout * 1000000 / HZ);\n" "+\n" " \tdev_set_drvdata(&op->dev, i2c);\n" - "=20\n" - " \ti2c->adap =3D mpc_ops;" + " \n" + " \ti2c->adap = mpc_ops;" -80843d43eec825935fac7ab5bc13211bc2cb0e7c1eac1fc99dceef7329446068 +f93e83963376a91413dbd7efce21083aa0bdf2aa450243ec92031180b563b550
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.