Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138554
b: refs/heads/master
c: df8a95f
h: refs/heads/master
v: v3
  • Loading branch information
Wolfgang Grandegger authored and Grant Likely committed Mar 11, 2009
1 parent 7fff301 commit 1231bc2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bb899d49a5d04ae53c787c15c5fb82754d6a0da4
refs/heads/master: df8a95f46f8e43a24003abe2efaca8c63c895b54
1 change: 1 addition & 0 deletions trunk/arch/powerpc/include/asm/mpc52xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ extern void mpc5200_setup_xlb_arbiter(void);
extern void mpc52xx_declare_of_platform_devices(void);
extern void mpc52xx_map_common_devices(void);
extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv);
extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node);
extern void mpc52xx_restart(char *cmd);

/* mpc52xx_pic.c */
Expand Down
37 changes: 37 additions & 0 deletions trunk/arch/powerpc/platforms/52xx/mpc52xx_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,43 @@ int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv)
}
EXPORT_SYMBOL(mpc52xx_set_psc_clkdiv);

/**
* mpc52xx_get_xtal_freq - Get SYS_XTAL_IN frequency for a device
*
* @node: device node
*
* Returns the frequency of the external oscillator clock connected
* to the SYS_XTAL_IN pin, or 0 if it cannot be determined.
*/
unsigned int mpc52xx_get_xtal_freq(struct device_node *node)
{
u32 val;
unsigned int freq;

if (!mpc52xx_cdm)
return 0;

freq = mpc52xx_find_ipb_freq(node);
if (!freq)
return 0;

if (in_8(&mpc52xx_cdm->ipb_clk_sel) & 0x1)
freq *= 2;

val = in_be32(&mpc52xx_cdm->rstcfg);
if (val & (1 << 5))
freq *= 8;
else
freq *= 4;
if (val & (1 << 6))
freq /= 12;
else
freq /= 16;

return freq;
}
EXPORT_SYMBOL(mpc52xx_get_xtal_freq);

/**
* mpc52xx_restart: ppc_md->restart hook for mpc5200 using the watchdog timer
*/
Expand Down

0 comments on commit 1231bc2

Please sign in to comment.