* [U-Boot] [PATCH][v2] powerpc/mpc85xx: Add Differential SYSCLK config support T1040
@ 2014-04-15 9:14 Nikhil Badola
2014-04-23 22:36 ` York Sun
0 siblings, 1 reply; 2+ messages in thread
From: Nikhil Badola @ 2014-04-15 9:14 UTC (permalink / raw)
To: u-boot
Adds support for clock sourcing from sysclk(100MHz) for usb
on T104xRDB and T1040QDS. This requires changing reference divisor
and multiplication factor to derive usb clock from sysclk.
Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
---
Dependency on patch http://patchwork.ozlabs.org/patch/339164/
Changes for v2:
- Changed patch heading
arch/powerpc/cpu/mpc85xx/cpu_init.c | 26 ++++++++++++++++++++++++++
include/fsl_usb.h | 5 +++++
2 files changed, 31 insertions(+)
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index 81aeadd..0e11a0b 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -36,6 +36,29 @@
DECLARE_GLOBAL_DATA_PTR;
+#ifdef CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
+/*
+ * For deriving usb clock from 100MHz sysclk, reference divisor is set
+ * to a value of 5, which gives an intermediate value 20(100/5). The
+ * multiplication factor integer is set to 24, which when multiplied to
+ * above intermediate value provides clock for usb ip.
+ */
+void usb_single_source_clk_configure(struct ccsr_usb_phy *usb_phy)
+{
+ sys_info_t sysinfo;
+
+ get_sys_info(&sysinfo);
+ if (sysinfo.diff_sysclk == 1) {
+ clrbits_be32(&usb_phy->pllprg[1],
+ CONFIG_SYS_FSL_USB_PLLPRG2_MFI);
+ setbits_be32(&usb_phy->pllprg[1],
+ CONFIG_SYS_FSL_USB_PLLPRG2_REF_DIV_INTERNAL_CLK |
+ CONFIG_SYS_FSL_USB_PLLPRG2_MFI_INTERNAL_CLK |
+ CONFIG_SYS_FSL_USB_INTERNAL_SOC_CLK_EN);
+ }
+}
+#endif
+
#ifdef CONFIG_SYS_FSL_ERRATUM_A006261
void fsl_erratum_a006261_workaround(struct ccsr_usb_phy __iomem *usb_phy)
{
@@ -716,6 +739,9 @@ skip_l2:
CONFIG_SYS_FSL_USB_PLLPRG2_PHY1_CLK_EN |
CONFIG_SYS_FSL_USB_PLLPRG2_MFI |
CONFIG_SYS_FSL_USB_PLLPRG2_PLL_EN);
+#ifdef CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
+ usb_single_source_clk_configure(usb_phy);
+#endif
setbits_be32(&usb_phy->port1.ctrl,
CONFIG_SYS_FSL_USB_CTRL_PHY_EN);
setbits_be32(&usb_phy->port1.drvvbuscfg,
diff --git a/include/fsl_usb.h b/include/fsl_usb.h
index 8b63cdd..1a6c9c1 100644
--- a/include/fsl_usb.h
+++ b/include/fsl_usb.h
@@ -48,6 +48,11 @@ struct ccsr_usb_phy {
#define CONFIG_SYS_FSL_USB_PLLPRG2_PHY2_CLK_EN (1 << 0)
#define CONFIG_SYS_FSL_USB_PLLPRG2_PHY1_CLK_EN (1 << 1)
#define CONFIG_SYS_FSL_USB_PLLPRG2_FRAC_LPF_EN (1 << 13)
+#ifdef CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
+#define CONFIG_SYS_FSL_USB_PLLPRG2_REF_DIV_INTERNAL_CLK (5 << 4)
+#define CONFIG_SYS_FSL_USB_PLLPRG2_MFI_INTERNAL_CLK (6 << 16)
+#define CONFIG_SYS_FSL_USB_INTERNAL_SOC_CLK_EN (1 << 20)
+#endif
#define CONFIG_SYS_FSL_USB_PLLPRG2_REF_DIV (1 << 4)
#define CONFIG_SYS_FSL_USB_PLLPRG2_MFI (5 << 16)
#define CONFIG_SYS_FSL_USB_PLLPRG2_PLL_EN (1 << 21)
--
1.7.11.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH][v2] powerpc/mpc85xx: Add Differential SYSCLK config support T1040
2014-04-15 9:14 [U-Boot] [PATCH][v2] powerpc/mpc85xx: Add Differential SYSCLK config support T1040 Nikhil Badola
@ 2014-04-23 22:36 ` York Sun
0 siblings, 0 replies; 2+ messages in thread
From: York Sun @ 2014-04-23 22:36 UTC (permalink / raw)
To: u-boot
On 04/15/2014 02:14 AM, Nikhil Badola wrote:
> Adds support for clock sourcing from sysclk(100MHz) for usb
> on T104xRDB and T1040QDS. This requires changing reference divisor
> and multiplication factor to derive usb clock from sysclk.
>
> Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
> ---
> Dependency on patch http://patchwork.ozlabs.org/patch/339164/
> Changes for v2:
> - Changed patch heading
>
Applied to u-boot-mpc85xx/master, thanks.
York
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-23 22:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-15 9:14 [U-Boot] [PATCH][v2] powerpc/mpc85xx: Add Differential SYSCLK config support T1040 Nikhil Badola
2014-04-23 22:36 ` York Sun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox