| 1 | #include <linux/kernel.h> |
| 2 | #include <linux/module.h> |
| 3 | #include <linux/version.h> |
| 4 | #include <linux/types.h> |
| 5 | #include <linux/fs.h> |
| 6 | #include <linux/miscdevice.h> |
| 7 | #include <linux/init.h> |
| 8 | #include <linux/uaccess.h> |
| 9 | #include <linux/unistd.h> |
| 10 | #include <linux/errno.h> |
| 11 | |
| 12 | #include <asm/irq.h> |
| 13 | #include <asm/div64.h> |
| 14 | |
| 15 | #include <ifxmips.h> |
| 16 | #include <ifxmips_cgu.h> |
| 17 | |
| 18 | void |
| 19 | cgu_setup_pci_clk(int external_clock) |
| 20 | { |
| 21 | /* set clock to 33Mhz */ |
| 22 | ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) & ~0xf00000, |
| 23 | IFXMIPS_CGU_IFCCR); |
| 24 | ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) | 0x800000, |
| 25 | IFXMIPS_CGU_IFCCR); |
| 26 | if (external_clock) |
| 27 | { |
| 28 | ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) & ~(1 << 16), |
| 29 | IFXMIPS_CGU_IFCCR); |
| 30 | ifxmips_w32((1 << 30), IFXMIPS_CGU_PCICR); |
| 31 | } else { |
| 32 | ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) | (1 << 16), |
| 33 | IFXMIPS_CGU_IFCCR); |
| 34 | ifxmips_w32((1 << 31) | (1 << 30), IFXMIPS_CGU_PCICR); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | |
| 39 | |