Commit cc2b1490 authored by Tony Lindgren's avatar Tony Lindgren

ARM: OMAP: Clock framework fixes to allow adding omap2 clocks

Clock framework fixes to allow adding omap2 clocks
parent d513a6e3
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
* Copyright (C) 2004 - 2005 Nokia corporation * Copyright (C) 2004 - 2005 Nokia corporation
* Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
* *
* Modified to use omap shared clock framework by
* Tony Lindgren <tony@atomide.com>
*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
......
...@@ -170,7 +170,7 @@ static struct arm_idlect1_clk ck_dpll1out = { ...@@ -170,7 +170,7 @@ static struct arm_idlect1_clk ck_dpll1out = {
.name = "ck_dpll1out", .name = "ck_dpll1out",
.parent = &ck_dpll1, .parent = &ck_dpll1,
.flags = CLOCK_IN_OMAP16XX | CLOCK_IDLE_CONTROL, .flags = CLOCK_IN_OMAP16XX | CLOCK_IDLE_CONTROL,
.enable_reg = ARM_IDLECT2, .enable_reg = (void __iomem *)ARM_IDLECT2,
.enable_bit = EN_CKOUT_ARM, .enable_bit = EN_CKOUT_ARM,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
...@@ -196,7 +196,7 @@ static struct arm_idlect1_clk armper_ck = { ...@@ -196,7 +196,7 @@ static struct arm_idlect1_clk armper_ck = {
.parent = &ck_dpll1, .parent = &ck_dpll1,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
RATE_CKCTL | CLOCK_IDLE_CONTROL, RATE_CKCTL | CLOCK_IDLE_CONTROL,
.enable_reg = ARM_IDLECT2, .enable_reg = (void __iomem *)ARM_IDLECT2,
.enable_bit = EN_PERCK, .enable_bit = EN_PERCK,
.rate_offset = CKCTL_PERDIV_OFFSET, .rate_offset = CKCTL_PERDIV_OFFSET,
.recalc = &omap1_ckctl_recalc, .recalc = &omap1_ckctl_recalc,
...@@ -210,7 +210,7 @@ static struct clk arm_gpio_ck = { ...@@ -210,7 +210,7 @@ static struct clk arm_gpio_ck = {
.name = "arm_gpio_ck", .name = "arm_gpio_ck",
.parent = &ck_dpll1, .parent = &ck_dpll1,
.flags = CLOCK_IN_OMAP1510, .flags = CLOCK_IN_OMAP1510,
.enable_reg = ARM_IDLECT2, .enable_reg = (void __iomem *)ARM_IDLECT2,
.enable_bit = EN_GPIOCK, .enable_bit = EN_GPIOCK,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
...@@ -223,7 +223,7 @@ static struct arm_idlect1_clk armxor_ck = { ...@@ -223,7 +223,7 @@ static struct arm_idlect1_clk armxor_ck = {
.parent = &ck_ref, .parent = &ck_ref,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
CLOCK_IDLE_CONTROL, CLOCK_IDLE_CONTROL,
.enable_reg = ARM_IDLECT2, .enable_reg = (void __iomem *)ARM_IDLECT2,
.enable_bit = EN_XORPCK, .enable_bit = EN_XORPCK,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
...@@ -238,7 +238,7 @@ static struct arm_idlect1_clk armtim_ck = { ...@@ -238,7 +238,7 @@ static struct arm_idlect1_clk armtim_ck = {
.parent = &ck_ref, .parent = &ck_ref,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
CLOCK_IDLE_CONTROL, CLOCK_IDLE_CONTROL,
.enable_reg = ARM_IDLECT2, .enable_reg = (void __iomem *)ARM_IDLECT2,
.enable_bit = EN_TIMCK, .enable_bit = EN_TIMCK,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
...@@ -253,7 +253,7 @@ static struct arm_idlect1_clk armwdt_ck = { ...@@ -253,7 +253,7 @@ static struct arm_idlect1_clk armwdt_ck = {
.parent = &ck_ref, .parent = &ck_ref,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
CLOCK_IDLE_CONTROL, CLOCK_IDLE_CONTROL,
.enable_reg = ARM_IDLECT2, .enable_reg = (void __iomem *)ARM_IDLECT2,
.enable_bit = EN_WDTCK, .enable_bit = EN_WDTCK,
.recalc = &omap1_watchdog_recalc, .recalc = &omap1_watchdog_recalc,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
...@@ -281,7 +281,7 @@ static struct clk dsp_ck = { ...@@ -281,7 +281,7 @@ static struct clk dsp_ck = {
.parent = &ck_dpll1, .parent = &ck_dpll1,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
RATE_CKCTL, RATE_CKCTL,
.enable_reg = ARM_CKCTL, .enable_reg = (void __iomem *)ARM_CKCTL,
.enable_bit = EN_DSPCK, .enable_bit = EN_DSPCK,
.rate_offset = CKCTL_DSPDIV_OFFSET, .rate_offset = CKCTL_DSPDIV_OFFSET,
.recalc = &omap1_ckctl_recalc, .recalc = &omap1_ckctl_recalc,
...@@ -305,7 +305,7 @@ static struct clk dspper_ck = { ...@@ -305,7 +305,7 @@ static struct clk dspper_ck = {
.parent = &ck_dpll1, .parent = &ck_dpll1,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
RATE_CKCTL | VIRTUAL_IO_ADDRESS, RATE_CKCTL | VIRTUAL_IO_ADDRESS,
.enable_reg = DSP_IDLECT2, .enable_reg = (void __iomem *)DSP_IDLECT2,
.enable_bit = EN_PERCK, .enable_bit = EN_PERCK,
.rate_offset = CKCTL_PERDIV_OFFSET, .rate_offset = CKCTL_PERDIV_OFFSET,
.recalc = &omap1_ckctl_recalc_dsp_domain, .recalc = &omap1_ckctl_recalc_dsp_domain,
...@@ -319,7 +319,7 @@ static struct clk dspxor_ck = { ...@@ -319,7 +319,7 @@ static struct clk dspxor_ck = {
.parent = &ck_ref, .parent = &ck_ref,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
VIRTUAL_IO_ADDRESS, VIRTUAL_IO_ADDRESS,
.enable_reg = DSP_IDLECT2, .enable_reg = (void __iomem *)DSP_IDLECT2,
.enable_bit = EN_XORPCK, .enable_bit = EN_XORPCK,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable_dsp_domain, .enable = &omap1_clk_enable_dsp_domain,
...@@ -331,7 +331,7 @@ static struct clk dsptim_ck = { ...@@ -331,7 +331,7 @@ static struct clk dsptim_ck = {
.parent = &ck_ref, .parent = &ck_ref,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
VIRTUAL_IO_ADDRESS, VIRTUAL_IO_ADDRESS,
.enable_reg = DSP_IDLECT2, .enable_reg = (void __iomem *)DSP_IDLECT2,
.enable_bit = EN_DSPTIMCK, .enable_bit = EN_DSPTIMCK,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable_dsp_domain, .enable = &omap1_clk_enable_dsp_domain,
...@@ -383,7 +383,7 @@ static struct clk l3_ocpi_ck = { ...@@ -383,7 +383,7 @@ static struct clk l3_ocpi_ck = {
.name = "l3_ocpi_ck", .name = "l3_ocpi_ck",
.parent = &tc_ck.clk, .parent = &tc_ck.clk,
.flags = CLOCK_IN_OMAP16XX, .flags = CLOCK_IN_OMAP16XX,
.enable_reg = ARM_IDLECT3, .enable_reg = (void __iomem *)ARM_IDLECT3,
.enable_bit = EN_OCPI_CK, .enable_bit = EN_OCPI_CK,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
...@@ -394,7 +394,7 @@ static struct clk tc1_ck = { ...@@ -394,7 +394,7 @@ static struct clk tc1_ck = {
.name = "tc1_ck", .name = "tc1_ck",
.parent = &tc_ck.clk, .parent = &tc_ck.clk,
.flags = CLOCK_IN_OMAP16XX, .flags = CLOCK_IN_OMAP16XX,
.enable_reg = ARM_IDLECT3, .enable_reg = (void __iomem *)ARM_IDLECT3,
.enable_bit = EN_TC1_CK, .enable_bit = EN_TC1_CK,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
...@@ -405,7 +405,7 @@ static struct clk tc2_ck = { ...@@ -405,7 +405,7 @@ static struct clk tc2_ck = {
.name = "tc2_ck", .name = "tc2_ck",
.parent = &tc_ck.clk, .parent = &tc_ck.clk,
.flags = CLOCK_IN_OMAP16XX, .flags = CLOCK_IN_OMAP16XX,
.enable_reg = ARM_IDLECT3, .enable_reg = (void __iomem *)ARM_IDLECT3,
.enable_bit = EN_TC2_CK, .enable_bit = EN_TC2_CK,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
...@@ -438,7 +438,7 @@ static struct arm_idlect1_clk api_ck = { ...@@ -438,7 +438,7 @@ static struct arm_idlect1_clk api_ck = {
.parent = &tc_ck.clk, .parent = &tc_ck.clk,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
CLOCK_IDLE_CONTROL, CLOCK_IDLE_CONTROL,
.enable_reg = ARM_IDLECT2, .enable_reg = (void __iomem *)ARM_IDLECT2,
.enable_bit = EN_APICK, .enable_bit = EN_APICK,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
...@@ -452,7 +452,7 @@ static struct arm_idlect1_clk lb_ck = { ...@@ -452,7 +452,7 @@ static struct arm_idlect1_clk lb_ck = {
.name = "lb_ck", .name = "lb_ck",
.parent = &tc_ck.clk, .parent = &tc_ck.clk,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IDLE_CONTROL, .flags = CLOCK_IN_OMAP1510 | CLOCK_IDLE_CONTROL,
.enable_reg = ARM_IDLECT2, .enable_reg = (void __iomem *)ARM_IDLECT2,
.enable_bit = EN_LBCK, .enable_bit = EN_LBCK,
.recalc = &followparent_recalc, .recalc = &followparent_recalc,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
...@@ -483,7 +483,7 @@ static struct clk lcd_ck_16xx = { ...@@ -483,7 +483,7 @@ static struct clk lcd_ck_16xx = {
.name = "lcd_ck", .name = "lcd_ck",
.parent = &ck_dpll1, .parent = &ck_dpll1,
.flags = CLOCK_IN_OMAP16XX | CLOCK_IN_OMAP730 | RATE_CKCTL, .flags = CLOCK_IN_OMAP16XX | CLOCK_IN_OMAP730 | RATE_CKCTL,
.enable_reg = ARM_IDLECT2, .enable_reg = (void __iomem *)ARM_IDLECT2,
.enable_bit = EN_LCDCK, .enable_bit = EN_LCDCK,
.rate_offset = CKCTL_LCDDIV_OFFSET, .rate_offset = CKCTL_LCDDIV_OFFSET,
.recalc = &omap1_ckctl_recalc, .recalc = &omap1_ckctl_recalc,
...@@ -497,7 +497,7 @@ static struct arm_idlect1_clk lcd_ck_1510 = { ...@@ -497,7 +497,7 @@ static struct arm_idlect1_clk lcd_ck_1510 = {
.parent = &ck_dpll1, .parent = &ck_dpll1,
.flags = CLOCK_IN_OMAP1510 | RATE_CKCTL | .flags = CLOCK_IN_OMAP1510 | RATE_CKCTL |
CLOCK_IDLE_CONTROL, CLOCK_IDLE_CONTROL,
.enable_reg = ARM_IDLECT2, .enable_reg = (void __iomem *)ARM_IDLECT2,
.enable_bit = EN_LCDCK, .enable_bit = EN_LCDCK,
.rate_offset = CKCTL_LCDDIV_OFFSET, .rate_offset = CKCTL_LCDDIV_OFFSET,
.recalc = &omap1_ckctl_recalc, .recalc = &omap1_ckctl_recalc,
...@@ -514,7 +514,7 @@ static struct clk uart1_1510 = { ...@@ -514,7 +514,7 @@ static struct clk uart1_1510 = {
.rate = 12000000, .rate = 12000000,
.flags = CLOCK_IN_OMAP1510 | ENABLE_REG_32BIT | .flags = CLOCK_IN_OMAP1510 | ENABLE_REG_32BIT |
ALWAYS_ENABLED | CLOCK_NO_IDLE_PARENT, ALWAYS_ENABLED | CLOCK_NO_IDLE_PARENT,
.enable_reg = MOD_CONF_CTRL_0, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
.enable_bit = 29, /* Chooses between 12MHz and 48MHz */ .enable_bit = 29, /* Chooses between 12MHz and 48MHz */
.set_rate = &omap1_set_uart_rate, .set_rate = &omap1_set_uart_rate,
.recalc = &omap1_uart_recalc, .recalc = &omap1_uart_recalc,
...@@ -530,7 +530,7 @@ static struct uart_clk uart1_16xx = { ...@@ -530,7 +530,7 @@ static struct uart_clk uart1_16xx = {
.rate = 48000000, .rate = 48000000,
.flags = CLOCK_IN_OMAP16XX | RATE_FIXED | .flags = CLOCK_IN_OMAP16XX | RATE_FIXED |
ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
.enable_reg = MOD_CONF_CTRL_0, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
.enable_bit = 29, .enable_bit = 29,
.enable = &omap1_clk_enable_uart_functional, .enable = &omap1_clk_enable_uart_functional,
.disable = &omap1_clk_disable_uart_functional, .disable = &omap1_clk_disable_uart_functional,
...@@ -546,7 +546,7 @@ static struct clk uart2_ck = { ...@@ -546,7 +546,7 @@ static struct clk uart2_ck = {
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
ENABLE_REG_32BIT | ALWAYS_ENABLED | ENABLE_REG_32BIT | ALWAYS_ENABLED |
CLOCK_NO_IDLE_PARENT, CLOCK_NO_IDLE_PARENT,
.enable_reg = MOD_CONF_CTRL_0, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
.enable_bit = 30, /* Chooses between 12MHz and 48MHz */ .enable_bit = 30, /* Chooses between 12MHz and 48MHz */
.set_rate = &omap1_set_uart_rate, .set_rate = &omap1_set_uart_rate,
.recalc = &omap1_uart_recalc, .recalc = &omap1_uart_recalc,
...@@ -561,7 +561,7 @@ static struct clk uart3_1510 = { ...@@ -561,7 +561,7 @@ static struct clk uart3_1510 = {
.rate = 12000000, .rate = 12000000,
.flags = CLOCK_IN_OMAP1510 | ENABLE_REG_32BIT | .flags = CLOCK_IN_OMAP1510 | ENABLE_REG_32BIT |
ALWAYS_ENABLED | CLOCK_NO_IDLE_PARENT, ALWAYS_ENABLED | CLOCK_NO_IDLE_PARENT,
.enable_reg = MOD_CONF_CTRL_0, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
.enable_bit = 31, /* Chooses between 12MHz and 48MHz */ .enable_bit = 31, /* Chooses between 12MHz and 48MHz */
.set_rate = &omap1_set_uart_rate, .set_rate = &omap1_set_uart_rate,
.recalc = &omap1_uart_recalc, .recalc = &omap1_uart_recalc,
...@@ -577,7 +577,7 @@ static struct uart_clk uart3_16xx = { ...@@ -577,7 +577,7 @@ static struct uart_clk uart3_16xx = {
.rate = 48000000, .rate = 48000000,
.flags = CLOCK_IN_OMAP16XX | RATE_FIXED | .flags = CLOCK_IN_OMAP16XX | RATE_FIXED |
ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
.enable_reg = MOD_CONF_CTRL_0, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
.enable_bit = 31, .enable_bit = 31,
.enable = &omap1_clk_enable_uart_functional, .enable = &omap1_clk_enable_uart_functional,
.disable = &omap1_clk_disable_uart_functional, .disable = &omap1_clk_disable_uart_functional,
...@@ -591,7 +591,7 @@ static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */ ...@@ -591,7 +591,7 @@ static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */
.rate = 6000000, .rate = 6000000,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
RATE_FIXED | ENABLE_REG_32BIT, RATE_FIXED | ENABLE_REG_32BIT,
.enable_reg = ULPD_CLOCK_CTRL, .enable_reg = (void __iomem *)ULPD_CLOCK_CTRL,
.enable_bit = USB_MCLK_EN_BIT, .enable_bit = USB_MCLK_EN_BIT,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
.disable = &omap1_clk_disable, .disable = &omap1_clk_disable,
...@@ -603,7 +603,7 @@ static struct clk usb_hhc_ck1510 = { ...@@ -603,7 +603,7 @@ static struct clk usb_hhc_ck1510 = {
.rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */ .rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */
.flags = CLOCK_IN_OMAP1510 | .flags = CLOCK_IN_OMAP1510 |
RATE_FIXED | ENABLE_REG_32BIT, RATE_FIXED | ENABLE_REG_32BIT,
.enable_reg = MOD_CONF_CTRL_0, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
.enable_bit = USB_HOST_HHC_UHOST_EN, .enable_bit = USB_HOST_HHC_UHOST_EN,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
.disable = &omap1_clk_disable, .disable = &omap1_clk_disable,
...@@ -616,7 +616,7 @@ static struct clk usb_hhc_ck16xx = { ...@@ -616,7 +616,7 @@ static struct clk usb_hhc_ck16xx = {
/* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */ /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
.flags = CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP16XX |
RATE_FIXED | ENABLE_REG_32BIT, RATE_FIXED | ENABLE_REG_32BIT,
.enable_reg = OTG_BASE + 0x08 /* OTG_SYSCON_2 */, .enable_reg = (void __iomem *)OTG_BASE + 0x08 /* OTG_SYSCON_2 */,
.enable_bit = 8 /* UHOST_EN */, .enable_bit = 8 /* UHOST_EN */,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
.disable = &omap1_clk_disable, .disable = &omap1_clk_disable,
...@@ -627,7 +627,7 @@ static struct clk usb_dc_ck = { ...@@ -627,7 +627,7 @@ static struct clk usb_dc_ck = {
/* Direct from ULPD, no parent */ /* Direct from ULPD, no parent */
.rate = 48000000, .rate = 48000000,
.flags = CLOCK_IN_OMAP16XX | RATE_FIXED, .flags = CLOCK_IN_OMAP16XX | RATE_FIXED,
.enable_reg = SOFT_REQ_REG, .enable_reg = (void __iomem *)SOFT_REQ_REG,
.enable_bit = 4, .enable_bit = 4,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
.disable = &omap1_clk_disable, .disable = &omap1_clk_disable,
...@@ -646,7 +646,7 @@ static struct clk mclk_16xx = { ...@@ -646,7 +646,7 @@ static struct clk mclk_16xx = {
.name = "mclk", .name = "mclk",
/* Direct from ULPD, no parent. May be enabled by ext hardware. */ /* Direct from ULPD, no parent. May be enabled by ext hardware. */
.flags = CLOCK_IN_OMAP16XX, .flags = CLOCK_IN_OMAP16XX,
.enable_reg = COM_CLK_DIV_CTRL_SEL, .enable_reg = (void __iomem *)COM_CLK_DIV_CTRL_SEL,
.enable_bit = COM_ULPD_PLL_CLK_REQ, .enable_bit = COM_ULPD_PLL_CLK_REQ,
.set_rate = &omap1_set_ext_clk_rate, .set_rate = &omap1_set_ext_clk_rate,
.round_rate = &omap1_round_ext_clk_rate, .round_rate = &omap1_round_ext_clk_rate,
...@@ -668,7 +668,7 @@ static struct clk bclk_16xx = { ...@@ -668,7 +668,7 @@ static struct clk bclk_16xx = {
.name = "bclk", .name = "bclk",
/* Direct from ULPD, no parent. May be enabled by ext hardware. */ /* Direct from ULPD, no parent. May be enabled by ext hardware. */
.flags = CLOCK_IN_OMAP16XX, .flags = CLOCK_IN_OMAP16XX,
.enable_reg = SWD_CLK_DIV_CTRL_SEL, .enable_reg = (void __iomem *)SWD_CLK_DIV_CTRL_SEL,
.enable_bit = SWD_ULPD_PLL_CLK_REQ, .enable_bit = SWD_ULPD_PLL_CLK_REQ,
.set_rate = &omap1_set_ext_clk_rate, .set_rate = &omap1_set_ext_clk_rate,
.round_rate = &omap1_round_ext_clk_rate, .round_rate = &omap1_round_ext_clk_rate,
...@@ -684,7 +684,7 @@ static struct clk mmc1_ck = { ...@@ -684,7 +684,7 @@ static struct clk mmc1_ck = {
.rate = 48000000, .rate = 48000000,
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
.enable_reg = MOD_CONF_CTRL_0, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
.enable_bit = 23, .enable_bit = 23,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
.disable = &omap1_clk_disable, .disable = &omap1_clk_disable,
...@@ -697,7 +697,7 @@ static struct clk mmc2_ck = { ...@@ -697,7 +697,7 @@ static struct clk mmc2_ck = {
.rate = 48000000, .rate = 48000000,
.flags = CLOCK_IN_OMAP16XX | .flags = CLOCK_IN_OMAP16XX |
RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
.enable_reg = MOD_CONF_CTRL_0, .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
.enable_bit = 20, .enable_bit = 20,
.enable = &omap1_clk_enable, .enable = &omap1_clk_enable,
.disable = &omap1_clk_disable, .disable = &omap1_clk_disable,
......
...@@ -4,12 +4,17 @@ ...@@ -4,12 +4,17 @@
* Copyright (C) 2004 - 2005 Nokia corporation * Copyright (C) 2004 - 2005 Nokia corporation
* Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
* *
* Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/module.h> #include <linux/version.h>
#include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/err.h> #include <linux/err.h>
...@@ -22,7 +27,7 @@ ...@@ -22,7 +27,7 @@
LIST_HEAD(clocks); LIST_HEAD(clocks);
static DECLARE_MUTEX(clocks_sem); static DECLARE_MUTEX(clocks_sem);
static DEFINE_SPINLOCK(clockfw_lock); DEFINE_SPINLOCK(clockfw_lock);
static struct clk_functions *arch_clock; static struct clk_functions *arch_clock;
...@@ -50,10 +55,15 @@ EXPORT_SYMBOL(clk_get); ...@@ -50,10 +55,15 @@ EXPORT_SYMBOL(clk_get);
int clk_enable(struct clk *clk) int clk_enable(struct clk *clk)
{ {
unsigned long flags; unsigned long flags;
int ret; int ret = 0;
spin_lock_irqsave(&clockfw_lock, flags); spin_lock_irqsave(&clockfw_lock, flags);
ret = clk->enable(clk); if (clk->enable)
ret = clk->enable(clk);
else if (arch_clock->clk_enable)
ret = arch_clock->clk_enable(clk);
else
printk(KERN_ERR "Could not enable clock %s\n", clk->name);
spin_unlock_irqrestore(&clockfw_lock, flags); spin_unlock_irqrestore(&clockfw_lock, flags);
return ret; return ret;
...@@ -65,7 +75,12 @@ void clk_disable(struct clk *clk) ...@@ -65,7 +75,12 @@ void clk_disable(struct clk *clk)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&clockfw_lock, flags); spin_lock_irqsave(&clockfw_lock, flags);
clk->disable(clk); if (clk->disable)
clk->disable(clk);
else if (arch_clock->clk_disable)
arch_clock->clk_disable(clk);
else
printk(KERN_ERR "Could not disable clock %s\n", clk->name);
spin_unlock_irqrestore(&clockfw_lock, flags); spin_unlock_irqrestore(&clockfw_lock, flags);
} }
EXPORT_SYMBOL(clk_disable); EXPORT_SYMBOL(clk_disable);
...@@ -192,12 +207,33 @@ EXPORT_SYMBOL(clk_get_parent); ...@@ -192,12 +207,33 @@ EXPORT_SYMBOL(clk_get_parent);
* OMAP specific clock functions shared between omap1 and omap2 * OMAP specific clock functions shared between omap1 and omap2
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
unsigned int __initdata mpurate;
/*
* By default we use the rate set by the bootloader.
* You can override this with mpurate= cmdline option.
*/
static int __init omap_clk_setup(char *str)
{
get_option(&str, &mpurate);
if (!mpurate)
return 1;
if (mpurate < 1000)
mpurate *= 1000000;
return 1;
}
__setup("mpurate=", omap_clk_setup);
/* Used for clocks that always have same value as the parent clock */ /* Used for clocks that always have same value as the parent clock */
void followparent_recalc(struct clk * clk) void followparent_recalc(struct clk *clk)
{ {
clk->rate = clk->parent->rate; clk->rate = clk->parent->rate;
} }
/* Propagate rate to children */
void propagate_rate(struct clk * tclk) void propagate_rate(struct clk * tclk)
{ {
struct clk *clkp; struct clk *clkp;
......
...@@ -22,7 +22,7 @@ struct clk { ...@@ -22,7 +22,7 @@ struct clk {
struct clk *parent; struct clk *parent;
unsigned long rate; unsigned long rate;
__u32 flags; __u32 flags;
__u32 enable_reg; void __iomem *enable_reg;
__u8 enable_bit; __u8 enable_bit;
__u8 rate_offset; __u8 rate_offset;
__u8 src_offset; __u8 src_offset;
...@@ -36,6 +36,8 @@ struct clk { ...@@ -36,6 +36,8 @@ struct clk {
}; };
struct clk_functions { struct clk_functions {
int (*clk_enable)(struct clk *clk);
void (*clk_disable)(struct clk *clk);
int (*clk_use)(struct clk *clk); int (*clk_use)(struct clk *clk);
void (*clk_unuse)(struct clk *clk); void (*clk_unuse)(struct clk *clk);
long (*clk_round_rate)(struct clk *clk, unsigned long rate); long (*clk_round_rate)(struct clk *clk, unsigned long rate);
...@@ -46,14 +48,17 @@ struct clk_functions { ...@@ -46,14 +48,17 @@ struct clk_functions {
void (*clk_deny_idle)(struct clk *clk); void (*clk_deny_idle)(struct clk *clk);
}; };
extern spinlock_t clockfw_lock; extern unsigned int mpurate;
extern struct list_head clocks; extern struct list_head clocks;
extern spinlock_t clockfw_lock;
extern int clk_init(struct clk_functions * custom_clocks); extern int clk_init(struct clk_functions * custom_clocks);
extern int clk_register(struct clk *clk); extern int clk_register(struct clk *clk);
extern void clk_unregister(struct clk *clk); extern void clk_unregister(struct clk *clk);
extern void propagate_rate(struct clk *clk); extern void propagate_rate(struct clk *clk);
extern void followparent_recalc(struct clk * clk); extern void followparent_recalc(struct clk * clk);
extern void clk_allow_idle(struct clk *clk);
extern void clk_deny_idle(struct clk *clk);
/* Clock flags */ /* Clock flags */
#define RATE_CKCTL (1 << 0) /* Main fixed ratio clocks */ #define RATE_CKCTL (1 << 0) /* Main fixed ratio clocks */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment