1 From b22729b27625107061733c718cb49a394fd41a4a Mon Sep 17 00:00:00 2001
2 From: Stefano Babic <sbabic@denx.de>
3 Date: Wed, 22 Feb 2012 00:24:38 +0000
4 Subject: [PATCH 03/56] MX53: add function to set SATA clock to internal
6 The MX53 SATA interface can use an internal clock (USB PHY1)
7 instead of an external clock. This is an undocumented feature, but used
8 on most Freescale's evaluation boards, such as MX53-loco.
10 As stated by Freescale's support:
12 Fuses (but not pins) may be used to configure SATA clocks.
13 Particularly the i.MX53 Fuse_Map contains the next information
14 about configuring SATA clocks :
15 SATA_ALT_REF_CLK[1:0] (offset 0x180C)
17 '00' - 100MHz (External)
18 '01' - 50MHz (External)
19 '10' - 120MHz, internal (USB PHY)
22 Signed-off-by: Stefano Babic <sbabic@denx.de>
23 CC: Fabio Estevam <fabio.estevam@freescale.com>
25 arch/arm/cpu/armv7/mx5/clock.c | 24 ++++++++++++++++++++++++
26 arch/arm/include/asm/arch-mx5/clock.h | 1 +
27 2 files changed, 25 insertions(+)
29 diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
30 index 8f8d01c..d769a4d 100644
31 --- a/arch/arm/cpu/armv7/mx5/clock.c
32 +++ b/arch/arm/cpu/armv7/mx5/clock.c
33 @@ -399,6 +399,30 @@ u32 imx_get_fecclk(void)
34 return mxc_get_clock(MXC_IPG_CLK);
39 + * The clock for the external interface can be set to use internal clock
40 + * if fuse bank 4, row 3, bit 2 is set.
41 + * This is an undocumented feature and it was confirmed by Freescale's support:
42 + * Fuses (but not pins) may be used to configure SATA clocks.
43 + * Particularly the i.MX53 Fuse_Map contains the next information
44 + * about configuring SATA clocks : SATA_ALT_REF_CLK[1:0] (offset 0x180C)
45 + * '00' - 100MHz (External)
46 + * '01' - 50MHz (External)
47 + * '10' - 120MHz, internal (USB PHY)
50 +void mxc_set_sata_internal_clock(void)
53 + (u32 *)(IIM_BASE_ADDR + 0x180c);
57 + writel((readl(tmp_base) & (~0x7)) | 0x4, tmp_base);
62 * Dump some core clockes.
64 diff --git a/arch/arm/include/asm/arch-mx5/clock.h b/arch/arm/include/asm/arch-mx5/clock.h
65 index f9f82f3..e822809 100644
66 --- a/arch/arm/include/asm/arch-mx5/clock.h
67 +++ b/arch/arm/include/asm/arch-mx5/clock.h
68 @@ -45,5 +45,6 @@ void set_usb_phy2_clk(void);
69 void enable_usb_phy2_clk(unsigned char enable);
70 void set_usboh3_clk(void);
71 void enable_usboh3_clk(unsigned char enable);
72 +void mxc_set_sata_internal_clock(void);
74 #endif /* __ASM_ARCH_CLOCK_H */