2 * arch/ppc/syslib/ibm440gp_common.c
4 * PPC440GP system library
6 * Matt Porter <mporter@mvista.com>
7 * Copyright 2002-2003 MontaVista Software Inc.
9 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
10 * Copyright (c) 2003 Zultys Technologies
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
18 #include <linux/config.h>
19 #include <linux/types.h>
21 #include <asm/ibm44x.h>
25 * Calculate 440GP clocks
27 void __init
ibm440gp_get_clocks(struct ibm44x_clocks
* p
,
31 u32 cpc0_sys0
= mfdcr(DCRN_CPC0_SYS0
);
32 u32 cpc0_cr0
= mfdcr(DCRN_CPC0_CR0
);
33 u32 opdv
= ((cpc0_sys0
>> 10) & 0x3) + 1;
34 u32 epdv
= ((cpc0_sys0
>> 8) & 0x3) + 1;
37 /* Bypass system PLL */
38 p
->cpu
= p
->plb
= sys_clk
;
41 u32 fbdv
, fwdva
, fwdvb
, m
, vco
;
43 fbdv
= (cpc0_sys0
>> 18) & 0x0f;
47 fwdva
= 8 - ((cpc0_sys0
>> 15) & 0x7);
48 fwdvb
= 8 - ((cpc0_sys0
>> 12) & 0x7);
51 if (cpc0_sys0
& 0x00000080){
53 m
= fwdvb
* opdv
* epdv
;
64 p
->opb
= p
->plb
/ opdv
;
65 p
->ebc
= p
->opb
/ epdv
;
67 if (cpc0_cr0
& 0x00400000){
68 /* External UART clock */
69 p
->uart0
= p
->uart1
= ser_clk
;
72 /* Internal UART clock */
73 u32 uart_div
= ((cpc0_cr0
>> 16) & 0x1f) + 1;
74 p
->uart0
= p
->uart1
= p
->plb
/ uart_div
;