Greetings,

After years of benefiting from other developers' labors (thanks!)
I think I finally have a contribution.  However, I'd like to get some
feedback from the community before posting the patch.

I've been looking into the timer issues on the Asus routers as
documented, for example, in https://dev.openwrt.org/ticket/4083
and https://forum.openwrt.org/viewtopic.php?pid=107594.

As noted by others, these models appear to be underclocked
at 200MHz instead of the 240MHz that appears in comments.
This is pretty easy to verify: if you set the time using 'date' and
then read it back, you'll see that these routers lose 10 sec every
minute.  I ran a test over a 24 hour period and the router lost
exactly four hours (a 16.66% error).

This problem can be remedied on the above-mentioned Asus
models with the following patch for 2.6:

--- a/build_dir/linux-brcm47xx/linux-2.6.32.10/drivers/ssb/driver_mipscore.c
+++ b/build_dir/linux-brcm47xx/linux-2.6.32.10/drivers/ssb/driver_mipscore.c
@@ -218,7 +218,7 @@
       if ((pll_type == SSB_PLLTYPE_5) || (bus->chip_id == 0x5365)) {
               rate = 200000000;
       } else if (bus->chip_id == 0x5354) {
-               rate = 240000000;
+               rate = 200000000;
       } else {
               rate = ssb_calc_clock_rate(pll_type, n, m);
       }
--- a/build_dir/linux-brcm47xx/linux-2.6.32.10/drivers/ssb/main.c
+++ b/build_dir/linux-brcm47xx/linux-2.6.32.10/drivers/ssb/main.c
@@ -1105,7 +1105,7 @@
       if (bus->chip_id == 0x5365) {
               rate = 100000000;
       } else if (bus->chip_id == 0x5354) {
-               rate = 120000000;
+               rate = 100000000;
       } else {
               rate = ssb_calc_clock_rate(plltype, clkctl_n, clkctl_m);
               if (plltype == SSB_PLLTYPE_3) /* 25Mhz, 2 dividers */

and the following patch for 2.4:

--- a/build_dir/linux-brcm-2.4/linux-2.4.37.9/arch/mips/bcm947xx/sbmips.c
+++ b/build_dir/linux-brcm-2.4/linux-2.4.37.9/arch/mips/bcm947xx/sbmips.c
@@ -284,7 +284,7 @@
       } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) {
/* 5354 chip uses a non programmable PLL of frequency 240MHz */
               if (sb_chip(sbh) == BCM5354_CHIP_ID) {
-                       rate = 240000000;
+                       rate = 200000000;
                       goto out;
               }
               pll_type = R_REG(osh, &cc->capabilities) & CC_CAP_PLL_MASK;
--- a/build_dir/linux-brcm-2.4/linux-2.4.37.9/arch/mips/bcm947xx/hndpmu.c
+++ b/build_dir/linux-brcm-2.4/linux-2.4.37.9/arch/mips/bcm947xx/hndpmu.c
@@ -710,7 +710,7 @@
  if (sb_chip (sbh) == BCM5354_CHIP_ID)
    {
      /* 5354 gets sb clock of 100MHz from main pll */
-      return 120000000;
+      return 100000000;
    }

  /* Find the xtal frequency in the table */


I have a few concerns.  First, if these Asus models are underclocked but
there are other routers out there that aren't, then these mods should be
applied by platform+model and I don't know how to do that.

Second, I know some changes were made to the usb system to improve its
reliability but I wonder if there may be an interaction between my
changes and the usb changes?  I.e. did they compensate for a 16.66%
error in jiffies that is now corrected by my patch?

Lastly, there's a patch file in 2.6 (220-bcm5354.patch) that applies the
incorrect timer values.  If my changes are accepted, they should really
go into this file.  Is it OK to submit a patch to a .patch file?

Thanks, -K-

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to