]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
MIPS: TXx9: stop_unused_modules
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Mon, 1 Sep 2008 13:22:36 +0000 (22:22 +0900)
committerRalf Baechle <ralf@linux-mips.org>
Sat, 11 Oct 2008 15:18:47 +0000 (16:18 +0100)
TXx9 SoCs have pin multiplex.  Stop some controller modules which can
not be used due to pin configurations.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/txx9/generic/setup_tx4927.c
arch/mips/txx9/generic/setup_tx4938.c

index c4248cbbd84a923a4e3fbf7292601b372b380a2d..914e93c62639616690fda1c5cfd02d3b254ae877 100644 (file)
@@ -252,3 +252,34 @@ void __init tx4927_mtd_init(int ch)
                return; /* disabled */
        txx9_physmap_flash_init(ch, start, size, &pdata);
 }
+
+static void __init tx4927_stop_unused_modules(void)
+{
+       __u64 pcfg, rst = 0, ckd = 0;
+       char buf[128];
+
+       buf[0] = '\0';
+       local_irq_disable();
+       pcfg = ____raw_readq(&tx4927_ccfgptr->pcfg);
+       if (!(pcfg & TX4927_PCFG_SEL2)) {
+               rst |= TX4927_CLKCTR_ACLRST;
+               ckd |= TX4927_CLKCTR_ACLCKD;
+               strcat(buf, " ACLC");
+       }
+       if (rst | ckd) {
+               txx9_set64(&tx4927_ccfgptr->clkctr, rst);
+               txx9_set64(&tx4927_ccfgptr->clkctr, ckd);
+       }
+       local_irq_enable();
+       if (buf[0])
+               pr_info("%s: stop%s\n", txx9_pcode_str, buf);
+}
+
+static int __init tx4927_late_init(void)
+{
+       if (txx9_pcode != 0x4927)
+               return -ENODEV;
+       tx4927_stop_unused_modules();
+       return 0;
+}
+late_initcall(tx4927_late_init);
index 0d8517ad3ad0da6baf0725e9b476c3fd8bfe99e7..af724e53ef9134b905b64e98fcd723ec43365dee 100644 (file)
@@ -334,3 +334,59 @@ void __init tx4938_mtd_init(int ch)
                return; /* disabled */
        txx9_physmap_flash_init(ch, start, size, &pdata);
 }
+
+static void __init tx4938_stop_unused_modules(void)
+{
+       __u64 pcfg, rst = 0, ckd = 0;
+       char buf[128];
+
+       buf[0] = '\0';
+       local_irq_disable();
+       pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg);
+       switch (txx9_pcode) {
+       case 0x4937:
+               if (!(pcfg & TX4938_PCFG_SEL2)) {
+                       rst |= TX4938_CLKCTR_ACLRST;
+                       ckd |= TX4938_CLKCTR_ACLCKD;
+                       strcat(buf, " ACLC");
+               }
+               break;
+       case 0x4938:
+               if (!(pcfg & TX4938_PCFG_SEL2) ||
+                   (pcfg & TX4938_PCFG_ETH0_SEL)) {
+                       rst |= TX4938_CLKCTR_ACLRST;
+                       ckd |= TX4938_CLKCTR_ACLCKD;
+                       strcat(buf, " ACLC");
+               }
+               if ((pcfg &
+                    (TX4938_PCFG_ATA_SEL | TX4938_PCFG_ISA_SEL |
+                     TX4938_PCFG_NDF_SEL))
+                   != TX4938_PCFG_NDF_SEL) {
+                       rst |= TX4938_CLKCTR_NDFRST;
+                       ckd |= TX4938_CLKCTR_NDFCKD;
+                       strcat(buf, " NDFMC");
+               }
+               if (!(pcfg & TX4938_PCFG_SPI_SEL)) {
+                       rst |= TX4938_CLKCTR_SPIRST;
+                       ckd |= TX4938_CLKCTR_SPICKD;
+                       strcat(buf, " SPI");
+               }
+               break;
+       }
+       if (rst | ckd) {
+               txx9_set64(&tx4938_ccfgptr->clkctr, rst);
+               txx9_set64(&tx4938_ccfgptr->clkctr, ckd);
+       }
+       local_irq_enable();
+       if (buf[0])
+               pr_info("%s: stop%s\n", txx9_pcode_str, buf);
+}
+
+static int __init tx4938_late_init(void)
+{
+       if (txx9_pcode != 0x4937 && txx9_pcode != 0x4938)
+               return -ENODEV;
+       tx4938_stop_unused_modules();
+       return 0;
+}
+late_initcall(tx4938_late_init);