Merge tag 'headers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC Header cleanups from Olof Johansson: "This is a collection of header file cleanups, mostly for OMAP and AT91, that keeps moving the platforms in the direction of multiplatform by removing the need for mach-dependent header files used in drivers and other places." Fix up mostly trivial conflicts as per Olof. * tag 'headers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (106 commits) ARM: OMAP2+: Move iommu/iovmm headers to platform_data ARM: OMAP2+: Make some definitions local ARM: OMAP2+: Move iommu2 to drivers/iommu/omap-iommu2.c ARM: OMAP2+: Move plat/iovmm.h to include/linux/omap-iommu.h ARM: OMAP2+: Move iopgtable header to drivers/iommu/ ARM: OMAP: Merge iommu2.h into iommu.h atmel: move ATMEL_MAX_UART to platform_data/atmel.h ARM: OMAP: Remove omap_init_consistent_dma_size() arm: at91: move at91rm9200 rtc header in drivers/rtc arm: at91: move reset controller header to arm/arm/mach-at91 arm: at91: move pit define to the driver arm: at91: move at91_shdwc.h to arch/arm/mach-at91 arm: at91: move board header to arch/arm/mach-at91 arn: at91: move at91_tc.h to arch/arm/mach-at91 arm: at91 move at91_aic.h to arch/arm/mach-at91 arm: at91 move board.h to arch/arm/mach-at91 arm: at91: move platfarm_data to include/linux/platform_data/atmel.h arm: at91: drop machine defconfig ARM: OMAP: Remove NEED_MACH_GPIO_H ARM: OMAP: Remove unnecessary mach and plat includes ...
This commit is contained in:
@@ -4,30 +4,37 @@
|
||||
|
||||
# Common support
|
||||
obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \
|
||||
common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o
|
||||
common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
|
||||
omap_device.o sram.o
|
||||
|
||||
# INTCPS IP block support - XXX should be moved to drivers/
|
||||
obj-$(CONFIG_ARCH_OMAP2) += irq.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += irq.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += irq.o
|
||||
omap-2-3-common = irq.o
|
||||
hwmod-common = omap_hwmod.o \
|
||||
omap_hwmod_common_data.o
|
||||
clock-common = clock.o clock_common_data.o \
|
||||
clkt_dpll.o clkt_clksel.o
|
||||
secure-common = omap-smc.o omap-secure.o
|
||||
|
||||
# Secure monitor API support
|
||||
obj-$(CONFIG_ARCH_OMAP3) += omap-smc.o omap-secure.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += omap-smc.o omap-secure.o
|
||||
obj-$(CONFIG_SOC_OMAP5) += omap-smc.o omap-secure.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
|
||||
obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
|
||||
obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common)
|
||||
obj-$(CONFIG_SOC_AM33XX) += irq.o $(hwmod-common)
|
||||
obj-$(CONFIG_SOC_OMAP5) += prm44xx.o $(hwmod-common) $(secure-common)
|
||||
|
||||
ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
|
||||
obj-y += mcbsp.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
|
||||
obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
|
||||
obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o
|
||||
|
||||
# SMP support ONLY available for OMAP4
|
||||
|
||||
obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o
|
||||
obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += omap4-common.o omap-wakeupgen.o
|
||||
obj-$(CONFIG_SOC_OMAP5) += omap4-common.o omap-wakeupgen.o
|
||||
omap-4-5-common = omap4-common.o omap-wakeupgen.o \
|
||||
sleep44xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-common)
|
||||
obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common)
|
||||
|
||||
plus_sec := $(call as-instr,.arch_extension sec,+sec)
|
||||
AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec)
|
||||
@@ -52,7 +59,6 @@ obj-$(CONFIG_ARCH_OMAP4) += mux44xx.o
|
||||
# SMS/SDRC
|
||||
obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o
|
||||
# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o
|
||||
obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o
|
||||
|
||||
# OPP table initialization
|
||||
ifeq ($(CONFIG_PM_OPP),y)
|
||||
@@ -63,15 +69,16 @@ endif
|
||||
|
||||
# Power Management
|
||||
ifeq ($(CONFIG_PM),y)
|
||||
obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o sleep24xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += sleep44xx.o
|
||||
obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o sleep44xx.o
|
||||
obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o
|
||||
obj-$(CONFIG_PM_DEBUG) += pm-debug.o
|
||||
obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
|
||||
|
||||
obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o
|
||||
obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o
|
||||
obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o
|
||||
|
||||
AFLAGS_sleep24xx.o :=-Wa,-march=armv6
|
||||
AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec)
|
||||
@@ -83,76 +90,82 @@ endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CPU_IDLE),y)
|
||||
obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o
|
||||
endif
|
||||
|
||||
# PRCM
|
||||
obj-y += prcm.o prm_common.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += cm2xxx_3xxx.o prm2xxx_3xxx.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += cm2xxx_3xxx.o prm2xxx_3xxx.o
|
||||
obj-y += prcm.o prm_common.o cm_common.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o
|
||||
omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \
|
||||
prcm_mpu44xx.o prminst44xx.o \
|
||||
vc44xx_data.o vp44xx_data.o \
|
||||
prm44xx.o
|
||||
vc44xx_data.o vp44xx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common)
|
||||
obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common)
|
||||
|
||||
# OMAP voltage domains
|
||||
obj-y += voltage.o vc.o vp.o
|
||||
voltagedomain-common := voltage.o vc.o vp.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += $(voltagedomain-common)
|
||||
obj-$(CONFIG_ARCH_OMAP2) += voltagedomains2xxx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += $(voltagedomain-common)
|
||||
obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common)
|
||||
obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += $(voltagedomain-common)
|
||||
obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o
|
||||
obj-$(CONFIG_SOC_OMAP5) += $(voltagedomain-common)
|
||||
|
||||
# OMAP powerdomain framework
|
||||
obj-y += powerdomain.o powerdomain-common.o
|
||||
powerdomain-common += powerdomain.o powerdomain-common.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += $(powerdomain-common)
|
||||
obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += powerdomain2xxx_3xxx.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_3xxx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += powerdomain2xxx_3xxx.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += $(powerdomain-common)
|
||||
obj-$(CONFIG_ARCH_OMAP3) += powerdomains3xxx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += powerdomains2xxx_3xxx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += powerdomain44xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common)
|
||||
obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += powerdomain33xx.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += $(powerdomain-common)
|
||||
obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o
|
||||
obj-$(CONFIG_SOC_OMAP5) += powerdomain44xx.o
|
||||
obj-$(CONFIG_SOC_OMAP5) += $(powerdomain-common)
|
||||
|
||||
# PRCM clockdomain control
|
||||
obj-y += clockdomain.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += clockdomain2xxx_3xxx.o
|
||||
clockdomain-common += clockdomain.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += $(clockdomain-common)
|
||||
obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o
|
||||
obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o
|
||||
obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += clockdomain2xxx_3xxx.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += $(clockdomain-common)
|
||||
obj-$(CONFIG_ARCH_OMAP3) += clockdomains2xxx_3xxx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += clockdomains3xxx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += clockdomain44xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += $(clockdomain-common)
|
||||
obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += clockdomain33xx.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += $(clockdomain-common)
|
||||
obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o
|
||||
obj-$(CONFIG_SOC_OMAP5) += clockdomain44xx.o
|
||||
obj-$(CONFIG_SOC_OMAP5) += $(clockdomain-common)
|
||||
|
||||
# Clock framework
|
||||
obj-y += clock.o clock_common_data.o \
|
||||
clkt_dpll.o clkt_clksel.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += clock2xxx.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o clkt2xxx_sys.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_sys.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o
|
||||
obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o
|
||||
obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o
|
||||
obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += clock3xxx.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o clkt_iclk.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o clock3xxx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += clock44xx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o
|
||||
obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += dpll3xxx.o clock33xx_data.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += $(clock-common) dpll3xxx.o
|
||||
obj-$(CONFIG_SOC_AM33XX) += clock33xx_data.o
|
||||
obj-$(CONFIG_SOC_OMAP5) += $(clock-common)
|
||||
obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o
|
||||
|
||||
# OMAP2 clock rate set data (old "OPP" data)
|
||||
@@ -160,7 +173,6 @@ obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o
|
||||
obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o
|
||||
|
||||
# hwmod data
|
||||
obj-y += omap_hwmod_common_data.o
|
||||
obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o
|
||||
obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o
|
||||
obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o
|
||||
@@ -184,8 +196,6 @@ obj-$(CONFIG_HW_PERF_EVENTS) += pmu.o
|
||||
obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
|
||||
mailbox_mach-objs := mailbox.o
|
||||
|
||||
obj-$(CONFIG_OMAP_IOMMU) += iommu2.o
|
||||
|
||||
iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o
|
||||
obj-y += $(iommu-m) $(iommu-y)
|
||||
|
||||
@@ -206,10 +216,10 @@ obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
|
||||
obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o
|
||||
obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o
|
||||
obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o
|
||||
obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o
|
||||
obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o
|
||||
obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o
|
||||
obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
|
||||
obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
|
||||
obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
|
||||
obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
|
||||
obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o
|
||||
obj-$(CONFIG_MACH_OVERO) += board-overo.o
|
||||
obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/davinci_emac.h>
|
||||
#include <asm/system.h>
|
||||
#include <plat/omap_device.h>
|
||||
#include "omap_device.h"
|
||||
#include "am35xx.h"
|
||||
#include "control.h"
|
||||
#include "am35xx-emac.h"
|
||||
|
@@ -28,14 +28,12 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/gpmc.h>
|
||||
#include <plat/usb.h>
|
||||
#include "gpmc.h"
|
||||
#include "gpmc-smc91x.h"
|
||||
|
||||
#include <video/omapdss.h>
|
||||
|
@@ -30,15 +30,15 @@
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <plat/usb.h>
|
||||
#include "common.h"
|
||||
#include <plat/dma.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include <plat-omap/dma-omap.h>
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-tfp410.h>
|
||||
|
||||
#include "gpmc.h"
|
||||
#include "gpmc-smc91x.h"
|
||||
|
||||
#include "soc.h"
|
||||
#include "board-flash.h"
|
||||
#include "mux.h"
|
||||
#include "sdram-qimonda-hyb18m512160af-6.h"
|
||||
|
@@ -18,9 +18,8 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "gpmc-smc91x.h"
|
||||
#include <plat/usb.h>
|
||||
|
||||
#include <mach/board-zoom.h>
|
||||
#include "board-zoom.h"
|
||||
|
||||
#include "board-flash.h"
|
||||
#include "mux.h"
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <linux/leds.h>
|
||||
#include <linux/leds_pwm.h>
|
||||
#include <linux/platform_data/omap4-keypad.h>
|
||||
#include <linux/usb/musb.h>
|
||||
|
||||
#include <asm/hardware/gic.h>
|
||||
#include <asm/mach-types.h>
|
||||
@@ -34,8 +35,6 @@
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/usb.h>
|
||||
#include <plat/mmc.h>
|
||||
#include "omap4-keypad.h"
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-nokia-dsi.h>
|
||||
@@ -45,6 +44,7 @@
|
||||
|
||||
#include "soc.h"
|
||||
#include "mux.h"
|
||||
#include "mmc.h"
|
||||
#include "hsmmc.h"
|
||||
#include "control.h"
|
||||
#include "common-board-devices.h"
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/usb.h>
|
||||
|
||||
#include "am35xx-emac.h"
|
||||
#include "mux.h"
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <linux/can/platform/ti_hecc.h>
|
||||
#include <linux/davinci_emac.h>
|
||||
#include <linux/mmc/host.h>
|
||||
#include <linux/usb/musb.h>
|
||||
#include <linux/platform_data/gpio-omap.h>
|
||||
|
||||
#include "am35xx.h"
|
||||
@@ -33,7 +34,6 @@
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/usb.h>
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-generic-dpi.h>
|
||||
#include <video/omap-panel-tfp410.h>
|
||||
|
@@ -28,14 +28,14 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/smc91x.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/platform_data/leds-omap.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/flash.h>
|
||||
|
||||
#include <plat/led.h>
|
||||
#include "common.h"
|
||||
#include <plat/gpmc.h>
|
||||
#include "gpmc.h"
|
||||
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-generic-dpi.h>
|
||||
|
@@ -38,21 +38,19 @@
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include <plat/usb.h>
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-generic-dpi.h>
|
||||
#include <video/omap-panel-tfp410.h>
|
||||
#include <linux/platform_data/spi-omap2-mcspi.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "mux.h"
|
||||
#include "sdram-micron-mt46h32m32lf-6.h"
|
||||
#include "hsmmc.h"
|
||||
#include "common-board-devices.h"
|
||||
#include "gpmc.h"
|
||||
#include "gpmc-nand.h"
|
||||
|
||||
#define CM_T35_GPIO_PENDOWN 57
|
||||
#define SB_T35_USB_HUB_RESET_GPIO 167
|
||||
@@ -181,7 +179,7 @@ static struct omap_nand_platform_data cm_t35_nand_data = {
|
||||
|
||||
static void __init cm_t35_init_nand(void)
|
||||
{
|
||||
if (gpmc_nand_init(&cm_t35_nand_data) < 0)
|
||||
if (gpmc_nand_init(&cm_t35_nand_data, NULL) < 0)
|
||||
pr_err("CM-T35: Unable to register NAND device\n");
|
||||
}
|
||||
#else
|
||||
|
@@ -39,9 +39,8 @@
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/usb.h>
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include "gpmc.h"
|
||||
|
||||
#include "am35xx.h"
|
||||
|
||||
@@ -49,6 +48,7 @@
|
||||
#include "control.h"
|
||||
#include "common-board-devices.h"
|
||||
#include "am35xx-emac.h"
|
||||
#include "gpmc-nand.h"
|
||||
|
||||
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
|
||||
static struct gpio_led cm_t3517_leds[] = {
|
||||
@@ -240,7 +240,7 @@ static struct omap_nand_platform_data cm_t3517_nand_data = {
|
||||
|
||||
static void __init cm_t3517_init_nand(void)
|
||||
{
|
||||
if (gpmc_nand_init(&cm_t3517_nand_data) < 0)
|
||||
if (gpmc_nand_init(&cm_t3517_nand_data, NULL) < 0)
|
||||
pr_err("CM-T3517: NAND initialization failed\n");
|
||||
}
|
||||
#else
|
||||
|
@@ -39,9 +39,8 @@
|
||||
#include <asm/mach/flash.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/gpmc.h>
|
||||
#include "gpmc.h"
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
#include <plat/usb.h>
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-generic-dpi.h>
|
||||
#include <video/omap-panel-tfp410.h>
|
||||
@@ -55,8 +54,11 @@
|
||||
#include "sdram-micron-mt46h32m32lf-6.h"
|
||||
#include "mux.h"
|
||||
#include "hsmmc.h"
|
||||
#include "board-flash.h"
|
||||
#include "common-board-devices.h"
|
||||
|
||||
#define NAND_CS 0
|
||||
|
||||
#define OMAP_DM9000_GPIO_IRQ 25
|
||||
#define OMAP3_DEVKIT_TS_GPIO 27
|
||||
|
||||
@@ -621,8 +623,9 @@ static void __init devkit8000_init(void)
|
||||
|
||||
usb_musb_init(NULL);
|
||||
usbhs_init(&usbhs_bdata);
|
||||
omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions,
|
||||
ARRAY_SIZE(devkit8000_nand_partitions));
|
||||
board_nand_init(devkit8000_nand_partitions,
|
||||
ARRAY_SIZE(devkit8000_nand_partitions), NAND_CS,
|
||||
NAND_BUSWIDTH_16, NULL);
|
||||
omap_twl4030_audio_init("omap3beagle");
|
||||
|
||||
/* Ensure SDRC pins are mux'd for self-refresh */
|
||||
|
@@ -17,14 +17,14 @@
|
||||
#include <linux/mtd/physmap.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
#include <linux/platform_data/mtd-onenand-omap2.h>
|
||||
#include <plat/tc.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "common.h"
|
||||
#include "board-flash.h"
|
||||
#include "gpmc-onenand.h"
|
||||
#include "gpmc-nand.h"
|
||||
|
||||
#define REG_FPGA_REV 0x10
|
||||
#define REG_FPGA_DIP_SWITCH_INPUT2 0x60
|
||||
@@ -104,36 +104,35 @@ __init board_onenand_init(struct mtd_partition *onenand_parts,
|
||||
defined(CONFIG_MTD_NAND_OMAP2_MODULE)
|
||||
|
||||
/* Note that all values in this struct are in nanoseconds */
|
||||
static struct gpmc_timings nand_timings = {
|
||||
struct gpmc_timings nand_default_timings[1] = {
|
||||
{
|
||||
.sync_clk = 0,
|
||||
|
||||
.sync_clk = 0,
|
||||
.cs_on = 0,
|
||||
.cs_rd_off = 36,
|
||||
.cs_wr_off = 36,
|
||||
|
||||
.cs_on = 0,
|
||||
.cs_rd_off = 36,
|
||||
.cs_wr_off = 36,
|
||||
.adv_on = 6,
|
||||
.adv_rd_off = 24,
|
||||
.adv_wr_off = 36,
|
||||
|
||||
.adv_on = 6,
|
||||
.adv_rd_off = 24,
|
||||
.adv_wr_off = 36,
|
||||
.we_off = 30,
|
||||
.oe_off = 48,
|
||||
|
||||
.we_off = 30,
|
||||
.oe_off = 48,
|
||||
.access = 54,
|
||||
.rd_cycle = 72,
|
||||
.wr_cycle = 72,
|
||||
|
||||
.access = 54,
|
||||
.rd_cycle = 72,
|
||||
.wr_cycle = 72,
|
||||
|
||||
.wr_access = 30,
|
||||
.wr_data_mux_bus = 0,
|
||||
.wr_access = 30,
|
||||
.wr_data_mux_bus = 0,
|
||||
},
|
||||
};
|
||||
|
||||
static struct omap_nand_platform_data board_nand_data = {
|
||||
.gpmc_t = &nand_timings,
|
||||
};
|
||||
static struct omap_nand_platform_data board_nand_data;
|
||||
|
||||
void
|
||||
__init board_nand_init(struct mtd_partition *nand_parts,
|
||||
u8 nr_parts, u8 cs, int nand_type)
|
||||
__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
|
||||
int nand_type, struct gpmc_timings *gpmc_t)
|
||||
{
|
||||
board_nand_data.cs = cs;
|
||||
board_nand_data.parts = nand_parts;
|
||||
@@ -141,7 +140,7 @@ __init board_nand_init(struct mtd_partition *nand_parts,
|
||||
board_nand_data.devsize = nand_type;
|
||||
|
||||
board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT;
|
||||
gpmc_nand_init(&board_nand_data);
|
||||
gpmc_nand_init(&board_nand_data, gpmc_t);
|
||||
}
|
||||
#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
|
||||
|
||||
@@ -238,5 +237,6 @@ void __init board_flash_init(struct flash_partitions partition_info[],
|
||||
pr_err("NAND: Unable to find configuration in GPMC\n");
|
||||
else
|
||||
board_nand_init(partition_info[2].parts,
|
||||
partition_info[2].nr_parts, nandcs, nand_type);
|
||||
partition_info[2].nr_parts, nandcs,
|
||||
nand_type, nand_default_timings);
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include "gpmc.h"
|
||||
|
||||
#define PDC_NOR 1
|
||||
#define PDC_NAND 2
|
||||
@@ -40,12 +40,14 @@ static inline void board_flash_init(struct flash_partitions part[],
|
||||
#if defined(CONFIG_MTD_NAND_OMAP2) || \
|
||||
defined(CONFIG_MTD_NAND_OMAP2_MODULE)
|
||||
extern void board_nand_init(struct mtd_partition *nand_parts,
|
||||
u8 nr_parts, u8 cs, int nand_type);
|
||||
u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t);
|
||||
extern struct gpmc_timings nand_default_timings[];
|
||||
#else
|
||||
static inline void board_nand_init(struct mtd_partition *nand_parts,
|
||||
u8 nr_parts, u8 cs, int nand_type)
|
||||
u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t)
|
||||
{
|
||||
}
|
||||
#define nand_default_timings NULL
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
|
||||
|
@@ -26,15 +26,14 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/input/matrix_keypad.h>
|
||||
#include <linux/mfd/menelaus.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <plat/menelaus.h>
|
||||
#include <plat/dma.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include "debug-devices.h"
|
||||
#include <plat-omap/dma-omap.h>
|
||||
#include <plat/debug-devices.h>
|
||||
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-generic-dpi.h>
|
||||
@@ -42,6 +41,7 @@
|
||||
#include "common.h"
|
||||
#include "mux.h"
|
||||
#include "control.h"
|
||||
#include "gpmc.h"
|
||||
|
||||
#define H4_FLASH_CS 0
|
||||
#define H4_SMC91X_CS 1
|
||||
|
@@ -29,20 +29,19 @@
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/gpmc.h>
|
||||
#include <plat/usb.h>
|
||||
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-tfp410.h>
|
||||
#include <linux/platform_data/mtd-onenand-omap2.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "gpmc.h"
|
||||
#include "mux.h"
|
||||
#include "hsmmc.h"
|
||||
#include "sdram-numonyx-m65kxxxxam.h"
|
||||
#include "common-board-devices.h"
|
||||
#include "board-flash.h"
|
||||
#include "control.h"
|
||||
#include "gpmc-onenand.h"
|
||||
|
||||
#define IGEP2_SMSC911X_CS 5
|
||||
#define IGEP2_SMSC911X_GPIO 176
|
||||
@@ -175,7 +174,7 @@ static void __init igep_flash_init(void)
|
||||
pr_info("IGEP: initializing NAND memory device\n");
|
||||
board_nand_init(igep_flash_partitions,
|
||||
ARRAY_SIZE(igep_flash_partitions),
|
||||
0, NAND_BUSWIDTH_16);
|
||||
0, NAND_BUSWIDTH_16, nand_default_timings);
|
||||
} else if (mux == IGEP_SYSBOOT_ONENAND) {
|
||||
pr_info("IGEP: initializing OneNAND memory device\n");
|
||||
board_onenand_init(igep_flash_partitions,
|
||||
|
@@ -35,9 +35,8 @@
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/gpmc.h>
|
||||
#include <mach/board-zoom.h>
|
||||
#include <plat/usb.h>
|
||||
#include "board-zoom.h"
|
||||
#include "gpmc.h"
|
||||
#include "gpmc-smsc911x.h"
|
||||
|
||||
#include <video/omapdss.h>
|
||||
@@ -420,8 +419,8 @@ static void __init omap_ldp_init(void)
|
||||
omap_serial_init();
|
||||
omap_sdrc_init(NULL, NULL);
|
||||
usb_musb_init(NULL);
|
||||
board_nand_init(ldp_nand_partitions,
|
||||
ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0);
|
||||
board_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions),
|
||||
ZOOM_NAND_CS, 0, nand_default_timings);
|
||||
|
||||
omap_hsmmc_init(mmc);
|
||||
ldp_display_init();
|
||||
|
@@ -22,16 +22,17 @@
|
||||
#include <linux/usb/musb.h>
|
||||
#include <linux/platform_data/spi-omap2-mcspi.h>
|
||||
#include <linux/platform_data/mtd-onenand-omap2.h>
|
||||
#include <linux/mfd/menelaus.h>
|
||||
#include <sound/tlv320aic3x.h>
|
||||
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/menelaus.h>
|
||||
#include <plat/mmc.h>
|
||||
#include "mmc.h"
|
||||
|
||||
#include "mux.h"
|
||||
#include "gpmc-onenand.h"
|
||||
|
||||
#define TUSB6010_ASYNC_CS 1
|
||||
#define TUSB6010_SYNC_CS 4
|
||||
|
@@ -39,19 +39,22 @@
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/mach/flash.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-tfp410.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
#include <plat/usb.h>
|
||||
#include <plat/omap_device.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "omap_device.h"
|
||||
#include "gpmc.h"
|
||||
#include "soc.h"
|
||||
#include "mux.h"
|
||||
#include "hsmmc.h"
|
||||
#include "pm.h"
|
||||
#include "board-flash.h"
|
||||
#include "common-board-devices.h"
|
||||
|
||||
#define NAND_CS 0
|
||||
|
||||
/*
|
||||
* OMAP3 Beagle revision
|
||||
* Run time detection of Beagle revision is done by reading GPIO.
|
||||
@@ -518,8 +521,9 @@ static void __init omap3_beagle_init(void)
|
||||
|
||||
usb_musb_init(NULL);
|
||||
usbhs_init(&usbhs_bdata);
|
||||
omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
|
||||
ARRAY_SIZE(omap3beagle_nand_partitions));
|
||||
board_nand_init(omap3beagle_nand_partitions,
|
||||
ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS,
|
||||
NAND_BUSWIDTH_16, NULL);
|
||||
omap_twl4030_audio_init("omap3beagle");
|
||||
|
||||
/* Ensure msecure is mux'd to be able to set the RTC. */
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include <linux/spi/ads7846.h>
|
||||
#include <linux/i2c/twl.h>
|
||||
#include <linux/usb/otg.h>
|
||||
#include <linux/usb/musb.h>
|
||||
#include <linux/usb/nop-usb-xceiv.h>
|
||||
#include <linux/smsc911x.h>
|
||||
|
||||
@@ -45,17 +46,20 @@
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <plat/usb.h>
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
#include "common.h"
|
||||
#include <linux/platform_data/spi-omap2-mcspi.h>
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-tfp410.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "mux.h"
|
||||
#include "sdram-micron-mt46h32m32lf-6.h"
|
||||
#include "hsmmc.h"
|
||||
#include "common-board-devices.h"
|
||||
#include "board-flash.h"
|
||||
|
||||
#define NAND_CS 0
|
||||
|
||||
#define OMAP3_EVM_TS_GPIO 175
|
||||
#define OMAP3_EVM_EHCI_VBUS 22
|
||||
@@ -731,8 +735,9 @@ static void __init omap3_evm_init(void)
|
||||
}
|
||||
usb_musb_init(&musb_board_data);
|
||||
usbhs_init(&usbhs_bdata);
|
||||
omap_nand_flash_init(NAND_BUSWIDTH_16, omap3evm_nand_partitions,
|
||||
ARRAY_SIZE(omap3evm_nand_partitions));
|
||||
board_nand_init(omap3evm_nand_partitions,
|
||||
ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS,
|
||||
NAND_BUSWIDTH_16, NULL);
|
||||
|
||||
omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
|
||||
omap3evm_init_smsc911x();
|
||||
|
@@ -34,16 +34,13 @@
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "gpmc-smsc911x.h"
|
||||
#include <plat/gpmc.h>
|
||||
#include <plat/sdrc.h>
|
||||
#include <plat/usb.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "mux.h"
|
||||
#include "hsmmc.h"
|
||||
#include "control.h"
|
||||
#include "common-board-devices.h"
|
||||
#include "gpmc.h"
|
||||
#include "gpmc-smsc911x.h"
|
||||
|
||||
#define OMAP3LOGIC_SMSC911X_CS 1
|
||||
|
||||
|
@@ -42,7 +42,6 @@
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/usb.h>
|
||||
#include <video/omapdss.h>
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
|
||||
@@ -50,6 +49,7 @@
|
||||
#include "sdram-micron-mt46h32m32lf-6.h"
|
||||
#include "hsmmc.h"
|
||||
#include "common-board-devices.h"
|
||||
#include "gpmc-nand.h"
|
||||
|
||||
#define PANDORA_WIFI_IRQ_GPIO 21
|
||||
#define PANDORA_WIFI_NRESET_GPIO 23
|
||||
@@ -602,7 +602,7 @@ static void __init omap3pandora_init(void)
|
||||
omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
|
||||
usbhs_init(&usbhs_bdata);
|
||||
usb_musb_init(NULL);
|
||||
gpmc_nand_init(&pandora_nand_data);
|
||||
gpmc_nand_init(&pandora_nand_data, NULL);
|
||||
|
||||
/* Ensure SDRC pins are mux'd for self-refresh */
|
||||
omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
|
||||
|
@@ -40,9 +40,8 @@
|
||||
#include <asm/mach/flash.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/gpmc.h>
|
||||
#include "gpmc.h"
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
#include <plat/usb.h>
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-generic-dpi.h>
|
||||
#include <video/omap-panel-tfp410.h>
|
||||
|
@@ -44,12 +44,12 @@
|
||||
#include <asm/system_info.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/gpmc.h>
|
||||
#include "gpmc.h"
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
#include <plat/usb.h>
|
||||
|
||||
#include "mux.h"
|
||||
#include "hsmmc.h"
|
||||
#include "board-flash.h"
|
||||
#include "common-board-devices.h"
|
||||
|
||||
#include <asm/setup.h>
|
||||
@@ -59,6 +59,8 @@
|
||||
#define TB_BL_PWM_TIMER 9
|
||||
#define TB_KILL_POWER_GPIO 168
|
||||
|
||||
#define NAND_CS 0
|
||||
|
||||
static unsigned long touchbook_revision;
|
||||
|
||||
static struct mtd_partition omap3touchbook_nand_partitions[] = {
|
||||
@@ -365,8 +367,9 @@ static void __init omap3_touchbook_init(void)
|
||||
omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata);
|
||||
usb_musb_init(NULL);
|
||||
usbhs_init(&usbhs_bdata);
|
||||
omap_nand_flash_init(NAND_BUSWIDTH_16, omap3touchbook_nand_partitions,
|
||||
ARRAY_SIZE(omap3touchbook_nand_partitions));
|
||||
board_nand_init(omap3touchbook_nand_partitions,
|
||||
ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS,
|
||||
NAND_BUSWIDTH_16, NULL);
|
||||
|
||||
/* Ensure SDRC pins are mux'd for self-refresh */
|
||||
omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/regulator/fixed.h>
|
||||
#include <linux/ti_wilink_st.h>
|
||||
#include <linux/usb/musb.h>
|
||||
#include <linux/wl12xx.h>
|
||||
#include <linux/platform_data/omap-abe-twl6040.h>
|
||||
|
||||
@@ -38,12 +39,11 @@
|
||||
#include <asm/mach/map.h>
|
||||
#include <video/omapdss.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/usb.h>
|
||||
#include <plat/mmc.h>
|
||||
#include <video/omap-panel-tfp410.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "soc.h"
|
||||
#include "mmc.h"
|
||||
#include "hsmmc.h"
|
||||
#include "control.h"
|
||||
#include "mux.h"
|
||||
|
@@ -48,14 +48,17 @@
|
||||
#include <video/omapdss.h>
|
||||
#include <video/omap-panel-generic-dpi.h>
|
||||
#include <video/omap-panel-tfp410.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include <plat/usb.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "mux.h"
|
||||
#include "sdram-micron-mt46h32m32lf-6.h"
|
||||
#include "gpmc.h"
|
||||
#include "hsmmc.h"
|
||||
#include "board-flash.h"
|
||||
#include "common-board-devices.h"
|
||||
|
||||
#define NAND_CS 0
|
||||
|
||||
#define OVERO_GPIO_BT_XGATE 15
|
||||
#define OVERO_GPIO_W2W_NRESET 16
|
||||
#define OVERO_GPIO_PENDOWN 114
|
||||
@@ -494,8 +497,8 @@ static void __init overo_init(void)
|
||||
omap_serial_init();
|
||||
omap_sdrc_init(mt46h32m32lf6_sdrc_params,
|
||||
mt46h32m32lf6_sdrc_params);
|
||||
omap_nand_flash_init(0, overo_nand_partitions,
|
||||
ARRAY_SIZE(overo_nand_partitions));
|
||||
board_nand_init(overo_nand_partitions,
|
||||
ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL);
|
||||
usb_musb_init(NULL);
|
||||
usbhs_init(&usbhs_bdata);
|
||||
overo_spi_init();
|
||||
|
@@ -22,17 +22,14 @@
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <plat/i2c.h>
|
||||
#include <plat/mmc.h>
|
||||
#include <plat/usb.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include "common.h"
|
||||
#include <plat/serial.h>
|
||||
|
||||
#include "mux.h"
|
||||
#include "gpmc.h"
|
||||
#include "mmc.h"
|
||||
#include "hsmmc.h"
|
||||
#include "sdram-nokia.h"
|
||||
#include "common-board-devices.h"
|
||||
#include "gpmc-onenand.h"
|
||||
|
||||
static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
|
||||
REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
|
||||
|
@@ -31,9 +31,7 @@
|
||||
#include <asm/system_info.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/dma.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include <plat/omap-pm.h>
|
||||
#include <plat-omap/dma-omap.h>
|
||||
#include "gpmc-smc91x.h"
|
||||
|
||||
#include "board-rx51.h"
|
||||
@@ -52,8 +50,11 @@
|
||||
#endif
|
||||
|
||||
#include "mux.h"
|
||||
#include "omap-pm.h"
|
||||
#include "hsmmc.h"
|
||||
#include "common-board-devices.h"
|
||||
#include "gpmc.h"
|
||||
#include "gpmc-onenand.h"
|
||||
|
||||
#define SYSTEM_REV_B_USES_VAUX3 0x1699
|
||||
#define SYSTEM_REV_S_USES_VAUX3 0x8
|
||||
|
@@ -17,18 +17,18 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/usb/musb.h>
|
||||
#include <linux/platform_data/spi-omap2-mcspi.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/dma.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include <plat/usb.h>
|
||||
#include <plat-omap/dma-omap.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "mux.h"
|
||||
#include "gpmc.h"
|
||||
#include "pm.h"
|
||||
#include "sdram-nokia.h"
|
||||
|
||||
|
@@ -14,13 +14,14 @@
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/usb/musb.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/usb.h>
|
||||
|
||||
static struct omap_musb_board_data musb_board_data = {
|
||||
.set_phy_power = ti81xx_musb_phy_power,
|
||||
|
@@ -17,10 +17,10 @@
|
||||
#include <linux/regulator/fixed.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
|
||||
#include <plat/gpmc.h>
|
||||
#include "gpmc.h"
|
||||
#include "gpmc-smsc911x.h"
|
||||
|
||||
#include <mach/board-zoom.h>
|
||||
#include "board-zoom.h"
|
||||
|
||||
#include "soc.h"
|
||||
#include "common.h"
|
||||
|
@@ -16,8 +16,9 @@
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/platform_data/spi-omap2-mcspi.h>
|
||||
#include <video/omapdss.h>
|
||||
#include <mach/board-zoom.h>
|
||||
#include "board-zoom.h"
|
||||
|
||||
#include "soc.h"
|
||||
#include "common.h"
|
||||
|
||||
#define LCD_PANEL_RESET_GPIO_PROD 96
|
||||
|
@@ -26,9 +26,8 @@
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/usb.h>
|
||||
|
||||
#include <mach/board-zoom.h>
|
||||
#include "board-zoom.h"
|
||||
|
||||
#include "mux.h"
|
||||
#include "hsmmc.h"
|
||||
|
@@ -22,9 +22,8 @@
|
||||
#include <asm/mach/arch.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <plat/usb.h>
|
||||
|
||||
#include <mach/board-zoom.h>
|
||||
#include "board-zoom.h"
|
||||
|
||||
#include "board-flash.h"
|
||||
#include "mux.h"
|
||||
@@ -113,8 +112,9 @@ static void __init omap_zoom_init(void)
|
||||
usbhs_init(&usbhs_bdata);
|
||||
}
|
||||
|
||||
board_nand_init(zoom_nand_partitions, ARRAY_SIZE(zoom_nand_partitions),
|
||||
ZOOM_NAND_CS, NAND_BUSWIDTH_16);
|
||||
board_nand_init(zoom_nand_partitions,
|
||||
ARRAY_SIZE(zoom_nand_partitions), ZOOM_NAND_CS,
|
||||
NAND_BUSWIDTH_16, nand_default_timings);
|
||||
zoom_debugboard_init();
|
||||
zoom_peripherals_init();
|
||||
|
||||
|
@@ -21,12 +21,11 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/prcm.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "clock2xxx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm2xxx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
|
||||
/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */
|
||||
|
@@ -14,10 +14,8 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm2xxx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
|
||||
/* Private functions */
|
||||
|
@@ -25,15 +25,13 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/sram.h>
|
||||
#include <plat/sdrc.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "clock2xxx.h"
|
||||
#include "opp2xxx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
#include "sdrc.h"
|
||||
#include "sram.h"
|
||||
|
||||
/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */
|
||||
|
||||
|
@@ -23,8 +23,6 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "clock2xxx.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
|
@@ -22,8 +22,6 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "clock2xxx.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
|
@@ -33,16 +33,14 @@
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/sram.h>
|
||||
#include <plat/sdrc.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "clock.h"
|
||||
#include "clock2xxx.h"
|
||||
#include "opp2xxx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
#include "sdrc.h"
|
||||
#include "sram.h"
|
||||
|
||||
const struct prcm_config *curr_prcm_set;
|
||||
const struct prcm_config *rate_table;
|
||||
|
@@ -21,14 +21,11 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/sram.h>
|
||||
#include <plat/sdrc.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "clock3xxx.h"
|
||||
#include "clock34xx.h"
|
||||
#include "sdrc.h"
|
||||
#include "sram.h"
|
||||
|
||||
#define CYCLES_PER_MHZ 1000000
|
||||
|
||||
|
@@ -45,8 +45,6 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/bug.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "clock.h"
|
||||
|
||||
/* Private functions */
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
#include <asm/div64.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "clock.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
|
@@ -14,7 +14,6 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/prcm.h>
|
||||
|
||||
#include "clock.h"
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#undef DEBUG
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
@@ -25,7 +26,6 @@
|
||||
|
||||
#include <asm/cpu.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/prcm.h>
|
||||
|
||||
#include <trace/events/power.h>
|
||||
@@ -33,7 +33,8 @@
|
||||
#include "soc.h"
|
||||
#include "clockdomain.h"
|
||||
#include "clock.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm2xxx.h"
|
||||
#include "cm3xxx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
#include "cm-regbits-34xx.h"
|
||||
|
||||
@@ -47,6 +48,10 @@ u16 cpu_mask;
|
||||
*/
|
||||
static bool clkdm_control = true;
|
||||
|
||||
static LIST_HEAD(clocks);
|
||||
static DEFINE_MUTEX(clocks_mutex);
|
||||
static DEFINE_SPINLOCK(clockfw_lock);
|
||||
|
||||
/*
|
||||
* OMAP2+ specific clock functions
|
||||
*/
|
||||
@@ -512,12 +517,510 @@ void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name,
|
||||
|
||||
/* Common data */
|
||||
|
||||
struct clk_functions omap2_clk_functions = {
|
||||
.clk_enable = omap2_clk_enable,
|
||||
.clk_disable = omap2_clk_disable,
|
||||
.clk_round_rate = omap2_clk_round_rate,
|
||||
.clk_set_rate = omap2_clk_set_rate,
|
||||
.clk_set_parent = omap2_clk_set_parent,
|
||||
.clk_disable_unused = omap2_clk_disable_unused,
|
||||
int clk_enable(struct clk *clk)
|
||||
{
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
if (clk == NULL || IS_ERR(clk))
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
ret = omap2_clk_enable(clk);
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_enable);
|
||||
|
||||
void clk_disable(struct clk *clk)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
if (clk == NULL || IS_ERR(clk))
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
if (clk->usecount == 0) {
|
||||
pr_err("Trying disable clock %s with 0 usecount\n",
|
||||
clk->name);
|
||||
WARN_ON(1);
|
||||
goto out;
|
||||
}
|
||||
|
||||
omap2_clk_disable(clk);
|
||||
|
||||
out:
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL(clk_disable);
|
||||
|
||||
unsigned long clk_get_rate(struct clk *clk)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long ret;
|
||||
|
||||
if (clk == NULL || IS_ERR(clk))
|
||||
return 0;
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
ret = clk->rate;
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_get_rate);
|
||||
|
||||
/*
|
||||
* Optional clock functions defined in include/linux/clk.h
|
||||
*/
|
||||
|
||||
long clk_round_rate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long flags;
|
||||
long ret;
|
||||
|
||||
if (clk == NULL || IS_ERR(clk))
|
||||
return 0;
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
ret = omap2_clk_round_rate(clk, rate);
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_round_rate);
|
||||
|
||||
int clk_set_rate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long flags;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (clk == NULL || IS_ERR(clk))
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
ret = omap2_clk_set_rate(clk, rate);
|
||||
if (ret == 0)
|
||||
propagate_rate(clk);
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_set_rate);
|
||||
|
||||
int clk_set_parent(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long flags;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent))
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
if (clk->usecount == 0) {
|
||||
ret = omap2_clk_set_parent(clk, parent);
|
||||
if (ret == 0)
|
||||
propagate_rate(clk);
|
||||
} else {
|
||||
ret = -EBUSY;
|
||||
}
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_set_parent);
|
||||
|
||||
struct clk *clk_get_parent(struct clk *clk)
|
||||
{
|
||||
return clk->parent;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_get_parent);
|
||||
|
||||
/*
|
||||
* OMAP specific clock functions shared between omap1 and omap2
|
||||
*/
|
||||
|
||||
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 */
|
||||
unsigned long followparent_recalc(struct clk *clk)
|
||||
{
|
||||
return clk->parent->rate;
|
||||
}
|
||||
|
||||
/*
|
||||
* Used for clocks that have the same value as the parent clock,
|
||||
* divided by some factor
|
||||
*/
|
||||
unsigned long omap_fixed_divisor_recalc(struct clk *clk)
|
||||
{
|
||||
WARN_ON(!clk->fixed_div);
|
||||
|
||||
return clk->parent->rate / clk->fixed_div;
|
||||
}
|
||||
|
||||
void clk_reparent(struct clk *child, struct clk *parent)
|
||||
{
|
||||
list_del_init(&child->sibling);
|
||||
if (parent)
|
||||
list_add(&child->sibling, &parent->children);
|
||||
child->parent = parent;
|
||||
|
||||
/* now do the debugfs renaming to reattach the child
|
||||
to the proper parent */
|
||||
}
|
||||
|
||||
/* Propagate rate to children */
|
||||
void propagate_rate(struct clk *tclk)
|
||||
{
|
||||
struct clk *clkp;
|
||||
|
||||
list_for_each_entry(clkp, &tclk->children, sibling) {
|
||||
if (clkp->recalc)
|
||||
clkp->rate = clkp->recalc(clkp);
|
||||
propagate_rate(clkp);
|
||||
}
|
||||
}
|
||||
|
||||
static LIST_HEAD(root_clks);
|
||||
|
||||
/**
|
||||
* recalculate_root_clocks - recalculate and propagate all root clocks
|
||||
*
|
||||
* Recalculates all root clocks (clocks with no parent), which if the
|
||||
* clock's .recalc is set correctly, should also propagate their rates.
|
||||
* Called at init.
|
||||
*/
|
||||
void recalculate_root_clocks(void)
|
||||
{
|
||||
struct clk *clkp;
|
||||
|
||||
list_for_each_entry(clkp, &root_clks, sibling) {
|
||||
if (clkp->recalc)
|
||||
clkp->rate = clkp->recalc(clkp);
|
||||
propagate_rate(clkp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clk_preinit - initialize any fields in the struct clk before clk init
|
||||
* @clk: struct clk * to initialize
|
||||
*
|
||||
* Initialize any struct clk fields needed before normal clk initialization
|
||||
* can run. No return value.
|
||||
*/
|
||||
void clk_preinit(struct clk *clk)
|
||||
{
|
||||
INIT_LIST_HEAD(&clk->children);
|
||||
}
|
||||
|
||||
int clk_register(struct clk *clk)
|
||||
{
|
||||
if (clk == NULL || IS_ERR(clk))
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* trap out already registered clocks
|
||||
*/
|
||||
if (clk->node.next || clk->node.prev)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&clocks_mutex);
|
||||
if (clk->parent)
|
||||
list_add(&clk->sibling, &clk->parent->children);
|
||||
else
|
||||
list_add(&clk->sibling, &root_clks);
|
||||
|
||||
list_add(&clk->node, &clocks);
|
||||
if (clk->init)
|
||||
clk->init(clk);
|
||||
mutex_unlock(&clocks_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_register);
|
||||
|
||||
void clk_unregister(struct clk *clk)
|
||||
{
|
||||
if (clk == NULL || IS_ERR(clk))
|
||||
return;
|
||||
|
||||
mutex_lock(&clocks_mutex);
|
||||
list_del(&clk->sibling);
|
||||
list_del(&clk->node);
|
||||
mutex_unlock(&clocks_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL(clk_unregister);
|
||||
|
||||
void clk_enable_init_clocks(void)
|
||||
{
|
||||
struct clk *clkp;
|
||||
|
||||
list_for_each_entry(clkp, &clocks, node)
|
||||
if (clkp->flags & ENABLE_ON_INIT)
|
||||
clk_enable(clkp);
|
||||
}
|
||||
|
||||
/**
|
||||
* omap_clk_get_by_name - locate OMAP struct clk by its name
|
||||
* @name: name of the struct clk to locate
|
||||
*
|
||||
* Locate an OMAP struct clk by its name. Assumes that struct clk
|
||||
* names are unique. Returns NULL if not found or a pointer to the
|
||||
* struct clk if found.
|
||||
*/
|
||||
struct clk *omap_clk_get_by_name(const char *name)
|
||||
{
|
||||
struct clk *c;
|
||||
struct clk *ret = NULL;
|
||||
|
||||
mutex_lock(&clocks_mutex);
|
||||
|
||||
list_for_each_entry(c, &clocks, node) {
|
||||
if (!strcmp(c->name, name)) {
|
||||
ret = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&clocks_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int omap_clk_enable_autoidle_all(void)
|
||||
{
|
||||
struct clk *c;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
|
||||
list_for_each_entry(c, &clocks, node)
|
||||
if (c->ops->allow_idle)
|
||||
c->ops->allow_idle(c);
|
||||
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int omap_clk_disable_autoidle_all(void)
|
||||
{
|
||||
struct clk *c;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
|
||||
list_for_each_entry(c, &clocks, node)
|
||||
if (c->ops->deny_idle)
|
||||
c->ops->deny_idle(c);
|
||||
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Low level helpers
|
||||
*/
|
||||
static int clkll_enable_null(struct clk *clk)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void clkll_disable_null(struct clk *clk)
|
||||
{
|
||||
}
|
||||
|
||||
const struct clkops clkops_null = {
|
||||
.enable = clkll_enable_null,
|
||||
.disable = clkll_disable_null,
|
||||
};
|
||||
|
||||
/*
|
||||
* Dummy clock
|
||||
*
|
||||
* Used for clock aliases that are needed on some OMAPs, but not others
|
||||
*/
|
||||
struct clk dummy_ck = {
|
||||
.name = "dummy",
|
||||
.ops = &clkops_null,
|
||||
};
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_OMAP_RESET_CLOCKS
|
||||
/*
|
||||
* Disable any unused clocks left on by the bootloader
|
||||
*/
|
||||
static int __init clk_disable_unused(void)
|
||||
{
|
||||
struct clk *ck;
|
||||
unsigned long flags;
|
||||
|
||||
pr_info("clock: disabling unused clocks to save power\n");
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
list_for_each_entry(ck, &clocks, node) {
|
||||
if (ck->ops == &clkops_null)
|
||||
continue;
|
||||
|
||||
if (ck->usecount > 0 || !ck->enable_reg)
|
||||
continue;
|
||||
|
||||
omap2_clk_disable_unused(ck);
|
||||
}
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
late_initcall(clk_disable_unused);
|
||||
late_initcall(omap_clk_enable_autoidle_all);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
|
||||
/*
|
||||
* debugfs support to trace clock tree hierarchy and attributes
|
||||
*/
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
|
||||
static struct dentry *clk_debugfs_root;
|
||||
|
||||
static int clk_dbg_show_summary(struct seq_file *s, void *unused)
|
||||
{
|
||||
struct clk *c;
|
||||
struct clk *pa;
|
||||
|
||||
mutex_lock(&clocks_mutex);
|
||||
seq_printf(s, "%-30s %-30s %-10s %s\n",
|
||||
"clock-name", "parent-name", "rate", "use-count");
|
||||
|
||||
list_for_each_entry(c, &clocks, node) {
|
||||
pa = c->parent;
|
||||
seq_printf(s, "%-30s %-30s %-10lu %d\n",
|
||||
c->name, pa ? pa->name : "none", c->rate,
|
||||
c->usecount);
|
||||
}
|
||||
mutex_unlock(&clocks_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int clk_dbg_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, clk_dbg_show_summary, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations debug_clock_fops = {
|
||||
.open = clk_dbg_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int clk_debugfs_register_one(struct clk *c)
|
||||
{
|
||||
int err;
|
||||
struct dentry *d;
|
||||
struct clk *pa = c->parent;
|
||||
|
||||
d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
c->dent = d;
|
||||
|
||||
d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
|
||||
if (!d) {
|
||||
err = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
|
||||
if (!d) {
|
||||
err = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
|
||||
if (!d) {
|
||||
err = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
debugfs_remove_recursive(c->dent);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int clk_debugfs_register(struct clk *c)
|
||||
{
|
||||
int err;
|
||||
struct clk *pa = c->parent;
|
||||
|
||||
if (pa && !pa->dent) {
|
||||
err = clk_debugfs_register(pa);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!c->dent) {
|
||||
err = clk_debugfs_register_one(c);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init clk_debugfs_init(void)
|
||||
{
|
||||
struct clk *c;
|
||||
struct dentry *d;
|
||||
int err;
|
||||
|
||||
d = debugfs_create_dir("clock", NULL);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
clk_debugfs_root = d;
|
||||
|
||||
list_for_each_entry(c, &clocks, node) {
|
||||
err = clk_debugfs_register(c);
|
||||
if (err)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
d = debugfs_create_file("summary", S_IRUGO,
|
||||
d, NULL, &debug_clock_fops);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
err_out:
|
||||
debugfs_remove_recursive(clk_debugfs_root);
|
||||
return err;
|
||||
}
|
||||
late_initcall(clk_debugfs_init);
|
||||
|
||||
#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
|
||||
|
||||
|
@@ -17,8 +17,323 @@
|
||||
#define __ARCH_ARM_MACH_OMAP2_CLOCK_H
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
#include <linux/clkdev.h>
|
||||
|
||||
struct omap_clk {
|
||||
u16 cpu;
|
||||
struct clk_lookup lk;
|
||||
};
|
||||
|
||||
#define CLK(dev, con, ck, cp) \
|
||||
{ \
|
||||
.cpu = cp, \
|
||||
.lk = { \
|
||||
.dev_id = dev, \
|
||||
.con_id = con, \
|
||||
.clk = ck, \
|
||||
}, \
|
||||
}
|
||||
|
||||
/* Platform flags for the clkdev-OMAP integration code */
|
||||
#define CK_242X (1 << 0)
|
||||
#define CK_243X (1 << 1) /* 243x, 253x */
|
||||
#define CK_3430ES1 (1 << 2) /* 34xxES1 only */
|
||||
#define CK_3430ES2PLUS (1 << 3) /* 34xxES2, ES3, non-Sitara 35xx only */
|
||||
#define CK_AM35XX (1 << 4) /* Sitara AM35xx */
|
||||
#define CK_36XX (1 << 5) /* 36xx/37xx-specific clocks */
|
||||
#define CK_443X (1 << 6)
|
||||
#define CK_TI816X (1 << 7)
|
||||
#define CK_446X (1 << 8)
|
||||
#define CK_AM33XX (1 << 9) /* AM33xx specific clocks */
|
||||
|
||||
|
||||
#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
|
||||
#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
|
||||
|
||||
struct module;
|
||||
struct clk;
|
||||
struct clockdomain;
|
||||
|
||||
/* Temporary, needed during the common clock framework conversion */
|
||||
#define __clk_get_name(clk) (clk->name)
|
||||
#define __clk_get_parent(clk) (clk->parent)
|
||||
#define __clk_get_rate(clk) (clk->rate)
|
||||
|
||||
/**
|
||||
* struct clkops - some clock function pointers
|
||||
* @enable: fn ptr that enables the current clock in hardware
|
||||
* @disable: fn ptr that enables the current clock in hardware
|
||||
* @find_idlest: function returning the IDLEST register for the clock's IP blk
|
||||
* @find_companion: function returning the "companion" clk reg for the clock
|
||||
* @allow_idle: fn ptr that enables autoidle for the current clock in hardware
|
||||
* @deny_idle: fn ptr that disables autoidle for the current clock in hardware
|
||||
*
|
||||
* A "companion" clk is an accompanying clock to the one being queried
|
||||
* that must be enabled for the IP module connected to the clock to
|
||||
* become accessible by the hardware. Neither @find_idlest nor
|
||||
* @find_companion should be needed; that information is IP
|
||||
* block-specific; the hwmod code has been created to handle this, but
|
||||
* until hwmod data is ready and drivers have been converted to use PM
|
||||
* runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
|
||||
* @find_companion must, unfortunately, remain.
|
||||
*/
|
||||
struct clkops {
|
||||
int (*enable)(struct clk *);
|
||||
void (*disable)(struct clk *);
|
||||
void (*find_idlest)(struct clk *, void __iomem **,
|
||||
u8 *, u8 *);
|
||||
void (*find_companion)(struct clk *, void __iomem **,
|
||||
u8 *);
|
||||
void (*allow_idle)(struct clk *);
|
||||
void (*deny_idle)(struct clk *);
|
||||
};
|
||||
|
||||
/* struct clksel_rate.flags possibilities */
|
||||
#define RATE_IN_242X (1 << 0)
|
||||
#define RATE_IN_243X (1 << 1)
|
||||
#define RATE_IN_3430ES1 (1 << 2) /* 3430ES1 rates only */
|
||||
#define RATE_IN_3430ES2PLUS (1 << 3) /* 3430 ES >= 2 rates only */
|
||||
#define RATE_IN_36XX (1 << 4)
|
||||
#define RATE_IN_4430 (1 << 5)
|
||||
#define RATE_IN_TI816X (1 << 6)
|
||||
#define RATE_IN_4460 (1 << 7)
|
||||
#define RATE_IN_AM33XX (1 << 8)
|
||||
#define RATE_IN_TI814X (1 << 9)
|
||||
|
||||
#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
|
||||
#define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
|
||||
#define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX)
|
||||
#define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460)
|
||||
|
||||
/* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
|
||||
#define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX)
|
||||
|
||||
|
||||
/**
|
||||
* struct clksel_rate - register bitfield values corresponding to clk divisors
|
||||
* @val: register bitfield value (shifted to bit 0)
|
||||
* @div: clock divisor corresponding to @val
|
||||
* @flags: (see "struct clksel_rate.flags possibilities" above)
|
||||
*
|
||||
* @val should match the value of a read from struct clk.clksel_reg
|
||||
* AND'ed with struct clk.clksel_mask, shifted right to bit 0.
|
||||
*
|
||||
* @div is the divisor that should be applied to the parent clock's rate
|
||||
* to produce the current clock's rate.
|
||||
*/
|
||||
struct clksel_rate {
|
||||
u32 val;
|
||||
u8 div;
|
||||
u16 flags;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct clksel - available parent clocks, and a pointer to their divisors
|
||||
* @parent: struct clk * to a possible parent clock
|
||||
* @rates: available divisors for this parent clock
|
||||
*
|
||||
* A struct clksel is always associated with one or more struct clks
|
||||
* and one or more struct clksel_rates.
|
||||
*/
|
||||
struct clksel {
|
||||
struct clk *parent;
|
||||
const struct clksel_rate *rates;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dpll_data - DPLL registers and integration data
|
||||
* @mult_div1_reg: register containing the DPLL M and N bitfields
|
||||
* @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
|
||||
* @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
|
||||
* @clk_bypass: struct clk pointer to the clock's bypass clock input
|
||||
* @clk_ref: struct clk pointer to the clock's reference clock input
|
||||
* @control_reg: register containing the DPLL mode bitfield
|
||||
* @enable_mask: mask of the DPLL mode bitfield in @control_reg
|
||||
* @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
|
||||
* @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
|
||||
* @max_multiplier: maximum valid non-bypass multiplier value (actual)
|
||||
* @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
|
||||
* @min_divider: minimum valid non-bypass divider value (actual)
|
||||
* @max_divider: maximum valid non-bypass divider value (actual)
|
||||
* @modes: possible values of @enable_mask
|
||||
* @autoidle_reg: register containing the DPLL autoidle mode bitfield
|
||||
* @idlest_reg: register containing the DPLL idle status bitfield
|
||||
* @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
|
||||
* @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
|
||||
* @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
|
||||
* @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg
|
||||
* @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs
|
||||
* @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
|
||||
* @flags: DPLL type/features (see below)
|
||||
*
|
||||
* Possible values for @flags:
|
||||
* DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
|
||||
*
|
||||
* @freqsel_mask is only used on the OMAP34xx family and AM35xx.
|
||||
*
|
||||
* XXX Some DPLLs have multiple bypass inputs, so it's not technically
|
||||
* correct to only have one @clk_bypass pointer.
|
||||
*
|
||||
* XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m,
|
||||
* @last_rounded_n) should be separated from the runtime-fixed fields
|
||||
* and placed into a different structure, so that the runtime-fixed data
|
||||
* can be placed into read-only space.
|
||||
*/
|
||||
struct dpll_data {
|
||||
void __iomem *mult_div1_reg;
|
||||
u32 mult_mask;
|
||||
u32 div1_mask;
|
||||
struct clk *clk_bypass;
|
||||
struct clk *clk_ref;
|
||||
void __iomem *control_reg;
|
||||
u32 enable_mask;
|
||||
unsigned long last_rounded_rate;
|
||||
u16 last_rounded_m;
|
||||
u16 max_multiplier;
|
||||
u8 last_rounded_n;
|
||||
u8 min_divider;
|
||||
u16 max_divider;
|
||||
u8 modes;
|
||||
void __iomem *autoidle_reg;
|
||||
void __iomem *idlest_reg;
|
||||
u32 autoidle_mask;
|
||||
u32 freqsel_mask;
|
||||
u32 idlest_mask;
|
||||
u32 dco_mask;
|
||||
u32 sddiv_mask;
|
||||
u8 auto_recal_bit;
|
||||
u8 recal_en_bit;
|
||||
u8 recal_st_bit;
|
||||
u8 flags;
|
||||
};
|
||||
|
||||
/*
|
||||
* struct clk.flags possibilities
|
||||
*
|
||||
* XXX document the rest of the clock flags here
|
||||
*
|
||||
* CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
|
||||
* bits share the same register. This flag allows the
|
||||
* omap4_dpllmx*() code to determine which GATE_CTRL bit field
|
||||
* should be used. This is a temporary solution - a better approach
|
||||
* would be to associate clock type-specific data with the clock,
|
||||
* similar to the struct dpll_data approach.
|
||||
*/
|
||||
#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
|
||||
#define CLOCK_IDLE_CONTROL (1 << 1)
|
||||
#define CLOCK_NO_IDLE_PARENT (1 << 2)
|
||||
#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
|
||||
#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
|
||||
#define CLOCK_CLKOUTX2 (1 << 5)
|
||||
|
||||
/**
|
||||
* struct clk - OMAP struct clk
|
||||
* @node: list_head connecting this clock into the full clock list
|
||||
* @ops: struct clkops * for this clock
|
||||
* @name: the name of the clock in the hardware (used in hwmod data and debug)
|
||||
* @parent: pointer to this clock's parent struct clk
|
||||
* @children: list_head connecting to the child clks' @sibling list_heads
|
||||
* @sibling: list_head connecting this clk to its parent clk's @children
|
||||
* @rate: current clock rate
|
||||
* @enable_reg: register to write to enable the clock (see @enable_bit)
|
||||
* @recalc: fn ptr that returns the clock's current rate
|
||||
* @set_rate: fn ptr that can change the clock's current rate
|
||||
* @round_rate: fn ptr that can round the clock's current rate
|
||||
* @init: fn ptr to do clock-specific initialization
|
||||
* @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
|
||||
* @usecount: number of users that have requested this clock to be enabled
|
||||
* @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
|
||||
* @flags: see "struct clk.flags possibilities" above
|
||||
* @clksel_reg: for clksel clks, register va containing src/divisor select
|
||||
* @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
|
||||
* @clksel: for clksel clks, pointer to struct clksel for this clock
|
||||
* @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
|
||||
* @clkdm_name: clockdomain name that this clock is contained in
|
||||
* @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
|
||||
* @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
|
||||
* @src_offset: bitshift for source selection bitfield (OMAP1 only)
|
||||
*
|
||||
* XXX @rate_offset, @src_offset should probably be removed and OMAP1
|
||||
* clock code converted to use clksel.
|
||||
*
|
||||
* XXX @usecount is poorly named. It should be "enable_count" or
|
||||
* something similar. "users" in the description refers to kernel
|
||||
* code (core code or drivers) that have called clk_enable() and not
|
||||
* yet called clk_disable(); the usecount of parent clocks is also
|
||||
* incremented by the clock code when clk_enable() is called on child
|
||||
* clocks and decremented by the clock code when clk_disable() is
|
||||
* called on child clocks.
|
||||
*
|
||||
* XXX @clkdm, @usecount, @children, @sibling should be marked for
|
||||
* internal use only.
|
||||
*
|
||||
* @children and @sibling are used to optimize parent-to-child clock
|
||||
* tree traversals. (child-to-parent traversals use @parent.)
|
||||
*
|
||||
* XXX The notion of the clock's current rate probably needs to be
|
||||
* separated from the clock's target rate.
|
||||
*/
|
||||
struct clk {
|
||||
struct list_head node;
|
||||
const struct clkops *ops;
|
||||
const char *name;
|
||||
struct clk *parent;
|
||||
struct list_head children;
|
||||
struct list_head sibling; /* node for children */
|
||||
unsigned long rate;
|
||||
void __iomem *enable_reg;
|
||||
unsigned long (*recalc)(struct clk *);
|
||||
int (*set_rate)(struct clk *, unsigned long);
|
||||
long (*round_rate)(struct clk *, unsigned long);
|
||||
void (*init)(struct clk *);
|
||||
u8 enable_bit;
|
||||
s8 usecount;
|
||||
u8 fixed_div;
|
||||
u8 flags;
|
||||
void __iomem *clksel_reg;
|
||||
u32 clksel_mask;
|
||||
const struct clksel *clksel;
|
||||
struct dpll_data *dpll_data;
|
||||
const char *clkdm_name;
|
||||
struct clockdomain *clkdm;
|
||||
#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
|
||||
struct dentry *dent; /* For visible tree hierarchy */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct clk_functions {
|
||||
int (*clk_enable)(struct clk *clk);
|
||||
void (*clk_disable)(struct clk *clk);
|
||||
long (*clk_round_rate)(struct clk *clk, unsigned long rate);
|
||||
int (*clk_set_rate)(struct clk *clk, unsigned long rate);
|
||||
int (*clk_set_parent)(struct clk *clk, struct clk *parent);
|
||||
void (*clk_allow_idle)(struct clk *clk);
|
||||
void (*clk_deny_idle)(struct clk *clk);
|
||||
void (*clk_disable_unused)(struct clk *clk);
|
||||
};
|
||||
|
||||
extern int mpurate;
|
||||
|
||||
extern int clk_init(struct clk_functions *custom_clocks);
|
||||
extern void clk_preinit(struct clk *clk);
|
||||
extern int clk_register(struct clk *clk);
|
||||
extern void clk_reparent(struct clk *child, struct clk *parent);
|
||||
extern void clk_unregister(struct clk *clk);
|
||||
extern void propagate_rate(struct clk *clk);
|
||||
extern void recalculate_root_clocks(void);
|
||||
extern unsigned long followparent_recalc(struct clk *clk);
|
||||
extern void clk_enable_init_clocks(void);
|
||||
unsigned long omap_fixed_divisor_recalc(struct clk *clk);
|
||||
extern struct clk *omap_clk_get_by_name(const char *name);
|
||||
extern int omap_clk_enable_autoidle_all(void);
|
||||
extern int omap_clk_disable_autoidle_all(void);
|
||||
|
||||
extern const struct clkops clkops_null;
|
||||
|
||||
extern struct clk dummy_ck;
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
|
||||
#define CORE_CLK_SRC_32K 0x0
|
||||
|
@@ -18,14 +18,12 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
#include <plat/clkdev_omap.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "clock.h"
|
||||
#include "clock2xxx.h"
|
||||
#include "opp2xxx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm2xxx.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
#include "prm-regbits-24xx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
@@ -1935,8 +1933,6 @@ int __init omap2420_clk_init(void)
|
||||
cpu_mask = RATE_IN_242X;
|
||||
rate_table = omap2420_rate_table;
|
||||
|
||||
clk_init(&omap2_clk_functions);
|
||||
|
||||
for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
|
||||
c++)
|
||||
clk_preinit(c->lk.clk);
|
||||
|
@@ -21,13 +21,11 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "clock.h"
|
||||
#include "clock2xxx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm2xxx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
|
||||
/**
|
||||
|
@@ -17,14 +17,12 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
#include <plat/clkdev_omap.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "clock.h"
|
||||
#include "clock2xxx.h"
|
||||
#include "opp2xxx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm2xxx.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
#include "prm-regbits-24xx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
@@ -2034,8 +2032,6 @@ int __init omap2430_clk_init(void)
|
||||
cpu_mask = RATE_IN_243X;
|
||||
rate_table = omap2430_rate_table;
|
||||
|
||||
clk_init(&omap2_clk_functions);
|
||||
|
||||
for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
|
||||
c++)
|
||||
clk_preinit(c->lk.clk);
|
||||
|
@@ -22,8 +22,6 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "clock.h"
|
||||
#include "clock2xxx.h"
|
||||
|
@@ -17,9 +17,8 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/clk.h>
|
||||
#include <plat/clkdev_omap.h>
|
||||
|
||||
#include "am33xx.h"
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "control.h"
|
||||
#include "clock.h"
|
||||
@@ -1087,8 +1086,6 @@ int __init am33xx_clk_init(void)
|
||||
cpu_clkflg = CK_AM33XX;
|
||||
}
|
||||
|
||||
clk_init(&omap2_clk_functions);
|
||||
|
||||
for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++)
|
||||
clk_preinit(c->lk.clk);
|
||||
|
||||
|
@@ -21,11 +21,9 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "clock34xx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm3xxx.h"
|
||||
#include "cm-regbits-34xx.h"
|
||||
|
||||
/**
|
||||
|
@@ -21,11 +21,9 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "clock3517.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm3xxx.h"
|
||||
#include "cm-regbits-34xx.h"
|
||||
|
||||
/*
|
||||
|
@@ -22,8 +22,6 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "clock36xx.h"
|
||||
|
||||
|
@@ -21,8 +21,6 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "clock.h"
|
||||
#include "clock3xxx.h"
|
||||
|
@@ -21,8 +21,6 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clkdev_omap.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "clock.h"
|
||||
@@ -30,7 +28,7 @@
|
||||
#include "clock34xx.h"
|
||||
#include "clock36xx.h"
|
||||
#include "clock3517.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm3xxx.h"
|
||||
#include "cm-regbits-34xx.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
#include "prm-regbits-34xx.h"
|
||||
@@ -3573,8 +3571,6 @@ int __init omap3xxx_clk_init(void)
|
||||
else
|
||||
dpll4_dd = dpll4_dd_34xx;
|
||||
|
||||
clk_init(&omap2_clk_functions);
|
||||
|
||||
for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
|
||||
c++)
|
||||
clk_preinit(c->lk.clk);
|
||||
|
@@ -28,8 +28,6 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clkdev_omap.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "clock.h"
|
||||
@@ -3366,8 +3364,6 @@ int __init omap4xxx_clk_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
clk_init(&omap2_clk_functions);
|
||||
|
||||
/*
|
||||
* Must stay commented until all OMAP SoC drivers are
|
||||
* converted to runtime PM, or drivers may start crashing
|
||||
|
@@ -27,7 +27,8 @@
|
||||
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include "soc.h"
|
||||
#include "clock.h"
|
||||
#include "clockdomain.h"
|
||||
|
||||
/* clkdm_list contains all registered struct clockdomains */
|
||||
|
@@ -18,9 +18,8 @@
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
#include "powerdomain.h"
|
||||
#include <plat/clock.h>
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include <plat/cpu.h>
|
||||
#include "clock.h"
|
||||
#include "omap_hwmod.h"
|
||||
|
||||
/*
|
||||
* Clockdomain flags
|
||||
|
@@ -1,339 +0,0 @@
|
||||
/*
|
||||
* OMAP2 and OMAP3 clockdomain control
|
||||
*
|
||||
* Copyright (C) 2008-2010 Texas Instruments, Inc.
|
||||
* Copyright (C) 2008-2010 Nokia Corporation
|
||||
*
|
||||
* Derived from mach-omap2/clockdomain.c written by Paul Walmsley
|
||||
* Rajendra Nayak <rnayak@ti.com>
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <plat/prcm.h>
|
||||
#include "prm.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
#include "cm.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
#include "cm-regbits-34xx.h"
|
||||
#include "prm-regbits-24xx.h"
|
||||
#include "clockdomain.h"
|
||||
|
||||
static int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
|
||||
clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
|
||||
clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
|
||||
PM_WKDEP, (1 << clkdm2->dep_bit));
|
||||
}
|
||||
|
||||
static int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
|
||||
{
|
||||
struct clkdm_dep *cd;
|
||||
u32 mask = 0;
|
||||
|
||||
for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
|
||||
if (!cd->clkdm)
|
||||
continue; /* only happens if data is erroneous */
|
||||
|
||||
/* PRM accesses are slow, so minimize them */
|
||||
mask |= 1 << cd->clkdm->dep_bit;
|
||||
atomic_set(&cd->wkdep_usecount, 0);
|
||||
}
|
||||
|
||||
omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
|
||||
PM_WKDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3_clkdm_add_sleepdep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
|
||||
clkdm1->pwrdm.ptr->prcm_offs,
|
||||
OMAP3430_CM_SLEEPDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3_clkdm_del_sleepdep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
|
||||
clkdm1->pwrdm.ptr->prcm_offs,
|
||||
OMAP3430_CM_SLEEPDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3_clkdm_read_sleepdep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
|
||||
OMAP3430_CM_SLEEPDEP, (1 << clkdm2->dep_bit));
|
||||
}
|
||||
|
||||
static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
|
||||
{
|
||||
struct clkdm_dep *cd;
|
||||
u32 mask = 0;
|
||||
|
||||
for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
|
||||
if (!cd->clkdm)
|
||||
continue; /* only happens if data is erroneous */
|
||||
|
||||
/* PRM accesses are slow, so minimize them */
|
||||
mask |= 1 << cd->clkdm->dep_bit;
|
||||
atomic_set(&cd->sleepdep_usecount, 0);
|
||||
}
|
||||
omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
|
||||
OMAP3430_CM_SLEEPDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap2_clkdm_sleep(struct clockdomain *clkdm)
|
||||
{
|
||||
omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
|
||||
clkdm->pwrdm.ptr->prcm_offs,
|
||||
OMAP2_PM_PWSTCTRL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap2_clkdm_wakeup(struct clockdomain *clkdm)
|
||||
{
|
||||
omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
|
||||
clkdm->pwrdm.ptr->prcm_offs,
|
||||
OMAP2_PM_PWSTCTRL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
if (atomic_read(&clkdm->usecount) > 0)
|
||||
_clkdm_add_autodeps(clkdm);
|
||||
|
||||
omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
}
|
||||
|
||||
static void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (atomic_read(&clkdm->usecount) > 0)
|
||||
_clkdm_del_autodeps(clkdm);
|
||||
}
|
||||
|
||||
static void _enable_hwsup(struct clockdomain *clkdm)
|
||||
{
|
||||
if (cpu_is_omap24xx())
|
||||
omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
else if (cpu_is_omap34xx())
|
||||
omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
}
|
||||
|
||||
static void _disable_hwsup(struct clockdomain *clkdm)
|
||||
{
|
||||
if (cpu_is_omap24xx())
|
||||
omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
else if (cpu_is_omap34xx())
|
||||
omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
}
|
||||
|
||||
static int omap3_clkdm_sleep(struct clockdomain *clkdm)
|
||||
{
|
||||
omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3_clkdm_wakeup(struct clockdomain *clkdm)
|
||||
{
|
||||
omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
if (!clkdm->clktrctrl_mask)
|
||||
return 0;
|
||||
|
||||
hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (hwsup) {
|
||||
/* Disable HW transitions when we are changing deps */
|
||||
_disable_hwsup(clkdm);
|
||||
_clkdm_add_autodeps(clkdm);
|
||||
_enable_hwsup(clkdm);
|
||||
} else {
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
|
||||
omap2_clkdm_wakeup(clkdm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap2_clkdm_clk_disable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
if (!clkdm->clktrctrl_mask)
|
||||
return 0;
|
||||
|
||||
hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (hwsup) {
|
||||
/* Disable HW transitions when we are changing deps */
|
||||
_disable_hwsup(clkdm);
|
||||
_clkdm_del_autodeps(clkdm);
|
||||
_enable_hwsup(clkdm);
|
||||
} else {
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
|
||||
omap2_clkdm_sleep(clkdm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void omap3_clkdm_allow_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
if (atomic_read(&clkdm->usecount) > 0)
|
||||
_clkdm_add_autodeps(clkdm);
|
||||
|
||||
omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
}
|
||||
|
||||
static void omap3_clkdm_deny_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (atomic_read(&clkdm->usecount) > 0)
|
||||
_clkdm_del_autodeps(clkdm);
|
||||
}
|
||||
|
||||
static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
if (!clkdm->clktrctrl_mask)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The CLKDM_MISSING_IDLE_REPORTING flag documentation has
|
||||
* more details on the unpleasant problem this is working
|
||||
* around
|
||||
*/
|
||||
if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
|
||||
(clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
|
||||
omap3_clkdm_wakeup(clkdm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (hwsup) {
|
||||
/* Disable HW transitions when we are changing deps */
|
||||
_disable_hwsup(clkdm);
|
||||
_clkdm_add_autodeps(clkdm);
|
||||
_enable_hwsup(clkdm);
|
||||
} else {
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
|
||||
omap3_clkdm_wakeup(clkdm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
if (!clkdm->clktrctrl_mask)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The CLKDM_MISSING_IDLE_REPORTING flag documentation has
|
||||
* more details on the unpleasant problem this is working
|
||||
* around
|
||||
*/
|
||||
if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
|
||||
!(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
|
||||
_enable_hwsup(clkdm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (hwsup) {
|
||||
/* Disable HW transitions when we are changing deps */
|
||||
_disable_hwsup(clkdm);
|
||||
_clkdm_del_autodeps(clkdm);
|
||||
_enable_hwsup(clkdm);
|
||||
} else {
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
|
||||
omap3_clkdm_sleep(clkdm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct clkdm_ops omap2_clkdm_operations = {
|
||||
.clkdm_add_wkdep = omap2_clkdm_add_wkdep,
|
||||
.clkdm_del_wkdep = omap2_clkdm_del_wkdep,
|
||||
.clkdm_read_wkdep = omap2_clkdm_read_wkdep,
|
||||
.clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
|
||||
.clkdm_sleep = omap2_clkdm_sleep,
|
||||
.clkdm_wakeup = omap2_clkdm_wakeup,
|
||||
.clkdm_allow_idle = omap2_clkdm_allow_idle,
|
||||
.clkdm_deny_idle = omap2_clkdm_deny_idle,
|
||||
.clkdm_clk_enable = omap2_clkdm_clk_enable,
|
||||
.clkdm_clk_disable = omap2_clkdm_clk_disable,
|
||||
};
|
||||
|
||||
struct clkdm_ops omap3_clkdm_operations = {
|
||||
.clkdm_add_wkdep = omap2_clkdm_add_wkdep,
|
||||
.clkdm_del_wkdep = omap2_clkdm_del_wkdep,
|
||||
.clkdm_read_wkdep = omap2_clkdm_read_wkdep,
|
||||
.clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
|
||||
.clkdm_add_sleepdep = omap3_clkdm_add_sleepdep,
|
||||
.clkdm_del_sleepdep = omap3_clkdm_del_sleepdep,
|
||||
.clkdm_read_sleepdep = omap3_clkdm_read_sleepdep,
|
||||
.clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps,
|
||||
.clkdm_sleep = omap3_clkdm_sleep,
|
||||
.clkdm_wakeup = omap3_clkdm_wakeup,
|
||||
.clkdm_allow_idle = omap3_clkdm_allow_idle,
|
||||
.clkdm_deny_idle = omap3_clkdm_deny_idle,
|
||||
.clkdm_clk_enable = omap3xxx_clkdm_clk_enable,
|
||||
.clkdm_clk_disable = omap3xxx_clkdm_clk_disable,
|
||||
};
|
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* AM33XX clockdomain control
|
||||
*
|
||||
* Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Vaibhav Hiremath <hvaibhav@ti.com>
|
||||
*
|
||||
* Derived from mach-omap2/clockdomain44xx.c written by Rajendra Nayak
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation version 2.
|
||||
*
|
||||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
||||
* kind, whether express or implied; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include "clockdomain.h"
|
||||
#include "cm33xx.h"
|
||||
|
||||
|
||||
static int am33xx_clkdm_sleep(struct clockdomain *clkdm)
|
||||
{
|
||||
am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int am33xx_clkdm_wakeup(struct clockdomain *clkdm)
|
||||
{
|
||||
am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
}
|
||||
|
||||
static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
}
|
||||
|
||||
static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm)
|
||||
{
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
|
||||
return am33xx_clkdm_wakeup(clkdm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
|
||||
if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
|
||||
am33xx_clkdm_sleep(clkdm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct clkdm_ops am33xx_clkdm_operations = {
|
||||
.clkdm_sleep = am33xx_clkdm_sleep,
|
||||
.clkdm_wakeup = am33xx_clkdm_wakeup,
|
||||
.clkdm_allow_idle = am33xx_clkdm_allow_idle,
|
||||
.clkdm_deny_idle = am33xx_clkdm_deny_idle,
|
||||
.clkdm_clk_enable = am33xx_clkdm_clk_enable,
|
||||
.clkdm_clk_disable = am33xx_clkdm_clk_disable,
|
||||
};
|
@@ -1,151 +0,0 @@
|
||||
/*
|
||||
* OMAP4 clockdomain control
|
||||
*
|
||||
* Copyright (C) 2008-2010 Texas Instruments, Inc.
|
||||
* Copyright (C) 2008-2010 Nokia Corporation
|
||||
*
|
||||
* Derived from mach-omap2/clockdomain.c written by Paul Walmsley
|
||||
* Rajendra Nayak <rnayak@ti.com>
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include "clockdomain.h"
|
||||
#include "cminst44xx.h"
|
||||
#include "cm44xx.h"
|
||||
|
||||
static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
|
||||
clkdm1->prcm_partition,
|
||||
clkdm1->cm_inst, clkdm1->clkdm_offs +
|
||||
OMAP4_CM_STATICDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
|
||||
clkdm1->prcm_partition,
|
||||
clkdm1->cm_inst, clkdm1->clkdm_offs +
|
||||
OMAP4_CM_STATICDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
|
||||
clkdm1->cm_inst, clkdm1->clkdm_offs +
|
||||
OMAP4_CM_STATICDEP,
|
||||
(1 << clkdm2->dep_bit));
|
||||
}
|
||||
|
||||
static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
|
||||
{
|
||||
struct clkdm_dep *cd;
|
||||
u32 mask = 0;
|
||||
|
||||
if (!clkdm->prcm_partition)
|
||||
return 0;
|
||||
|
||||
for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
|
||||
if (!cd->clkdm)
|
||||
continue; /* only happens if data is erroneous */
|
||||
|
||||
mask |= 1 << cd->clkdm->dep_bit;
|
||||
atomic_set(&cd->wkdep_usecount, 0);
|
||||
}
|
||||
|
||||
omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
|
||||
clkdm->cm_inst, clkdm->clkdm_offs +
|
||||
OMAP4_CM_STATICDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_clkdm_sleep(struct clockdomain *clkdm)
|
||||
{
|
||||
omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
|
||||
clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
|
||||
{
|
||||
omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
|
||||
clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
|
||||
clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
}
|
||||
|
||||
static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
|
||||
omap4_clkdm_wakeup(clkdm);
|
||||
else
|
||||
omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
|
||||
clkdm->cm_inst,
|
||||
clkdm->clkdm_offs);
|
||||
}
|
||||
|
||||
static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
|
||||
{
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
|
||||
return omap4_clkdm_wakeup(clkdm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
if (!clkdm->prcm_partition)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The CLKDM_MISSING_IDLE_REPORTING flag documentation has
|
||||
* more details on the unpleasant problem this is working
|
||||
* around
|
||||
*/
|
||||
if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
|
||||
!(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
|
||||
omap4_clkdm_allow_idle(clkdm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
|
||||
clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
|
||||
if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
|
||||
omap4_clkdm_sleep(clkdm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct clkdm_ops omap4_clkdm_operations = {
|
||||
.clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
|
||||
.clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
|
||||
.clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep,
|
||||
.clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
|
||||
.clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep,
|
||||
.clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep,
|
||||
.clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep,
|
||||
.clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
|
||||
.clkdm_sleep = omap4_clkdm_sleep,
|
||||
.clkdm_wakeup = omap4_clkdm_wakeup,
|
||||
.clkdm_allow_idle = omap4_clkdm_allow_idle,
|
||||
.clkdm_deny_idle = omap4_clkdm_deny_idle,
|
||||
.clkdm_clk_enable = omap4_clkdm_clk_enable,
|
||||
.clkdm_clk_disable = omap4_clkdm_clk_disable,
|
||||
};
|
@@ -35,6 +35,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "clockdomain.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "clockdomain.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "clockdomain.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
|
@@ -33,4 +33,16 @@
|
||||
*/
|
||||
#define MAX_MODULE_DISABLE_TIME 5000
|
||||
|
||||
# ifndef __ASSEMBLER__
|
||||
|
||||
/**
|
||||
* struct cm_ll_data - fn ptrs to per-SoC CM function implementations
|
||||
*/
|
||||
struct cm_ll_data {};
|
||||
|
||||
extern int cm_register(struct cm_ll_data *cld);
|
||||
extern int cm_unregister(struct cm_ll_data *cld);
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
255
arch/arm/mach-omap2/cm2xxx.c
Normal file
255
arch/arm/mach-omap2/cm2xxx.c
Normal file
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
* OMAP2xxx CM module functions
|
||||
*
|
||||
* Copyright (C) 2009 Nokia Corporation
|
||||
* Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
|
||||
* Paul Walmsley
|
||||
* Rajendra Nayak <rnayak@ti.com>
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "common.h"
|
||||
#include "prm2xxx.h"
|
||||
#include "cm.h"
|
||||
#include "cm2xxx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
#include "clockdomain.h"
|
||||
|
||||
/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */
|
||||
#define DPLL_AUTOIDLE_DISABLE 0x0
|
||||
#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3
|
||||
|
||||
/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
|
||||
#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0
|
||||
#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
|
||||
|
||||
static const u8 omap2xxx_cm_idlest_offs[] = {
|
||||
CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
|
||||
};
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
static void _write_clktrctrl(u8 c, s16 module, u32 mask)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
|
||||
v &= ~mask;
|
||||
v |= c << __ffs(mask);
|
||||
omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
|
||||
}
|
||||
|
||||
bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
|
||||
v &= mask;
|
||||
v >>= __ffs(mask);
|
||||
|
||||
return (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
|
||||
}
|
||||
|
||||
void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
|
||||
{
|
||||
_write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
|
||||
{
|
||||
_write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
|
||||
}
|
||||
|
||||
/*
|
||||
* DPLL autoidle control
|
||||
*/
|
||||
|
||||
static void _omap2xxx_set_dpll_autoidle(u8 m)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
|
||||
v &= ~OMAP24XX_AUTO_DPLL_MASK;
|
||||
v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
|
||||
omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_dpll_disable_autoidle(void)
|
||||
{
|
||||
_omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_dpll_auto_low_power_stop(void)
|
||||
{
|
||||
_omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
* APLL autoidle control
|
||||
*/
|
||||
|
||||
static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
|
||||
v &= ~mask;
|
||||
v |= m << __ffs(mask);
|
||||
omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_apll54_disable_autoidle(void)
|
||||
{
|
||||
_omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
|
||||
OMAP24XX_AUTO_54M_MASK);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_apll54_auto_low_power_stop(void)
|
||||
{
|
||||
_omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
|
||||
OMAP24XX_AUTO_54M_MASK);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_apll96_disable_autoidle(void)
|
||||
{
|
||||
_omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
|
||||
OMAP24XX_AUTO_96M_MASK);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_apll96_auto_low_power_stop(void)
|
||||
{
|
||||
_omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
|
||||
OMAP24XX_AUTO_96M_MASK);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* omap2xxx_cm_wait_module_ready - wait for a module to leave idle or standby
|
||||
* @prcm_mod: PRCM module offset
|
||||
* @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
|
||||
* @idlest_shift: shift of the bit in the CM_IDLEST* register to check
|
||||
*
|
||||
* Wait for the PRCM to indicate that the module identified by
|
||||
* (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
|
||||
* success or -EBUSY if the module doesn't enable in time.
|
||||
*/
|
||||
int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
|
||||
{
|
||||
int ena = 0, i = 0;
|
||||
u8 cm_idlest_reg;
|
||||
u32 mask;
|
||||
|
||||
if (!idlest_id || (idlest_id > ARRAY_SIZE(omap2xxx_cm_idlest_offs)))
|
||||
return -EINVAL;
|
||||
|
||||
cm_idlest_reg = omap2xxx_cm_idlest_offs[idlest_id - 1];
|
||||
|
||||
mask = 1 << idlest_shift;
|
||||
ena = mask;
|
||||
|
||||
omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) &
|
||||
mask) == ena), MAX_MODULE_READY_TIME, i);
|
||||
|
||||
return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
|
||||
}
|
||||
|
||||
/* Clockdomain low-level functions */
|
||||
|
||||
static void omap2xxx_clkdm_allow_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
if (atomic_read(&clkdm->usecount) > 0)
|
||||
_clkdm_add_autodeps(clkdm);
|
||||
|
||||
omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
}
|
||||
|
||||
static void omap2xxx_clkdm_deny_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (atomic_read(&clkdm->usecount) > 0)
|
||||
_clkdm_del_autodeps(clkdm);
|
||||
}
|
||||
|
||||
static int omap2xxx_clkdm_clk_enable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
if (!clkdm->clktrctrl_mask)
|
||||
return 0;
|
||||
|
||||
hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (hwsup) {
|
||||
/* Disable HW transitions when we are changing deps */
|
||||
omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
_clkdm_add_autodeps(clkdm);
|
||||
omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
} else {
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
|
||||
omap2xxx_clkdm_wakeup(clkdm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap2xxx_clkdm_clk_disable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
if (!clkdm->clktrctrl_mask)
|
||||
return 0;
|
||||
|
||||
hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (hwsup) {
|
||||
/* Disable HW transitions when we are changing deps */
|
||||
omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
_clkdm_del_autodeps(clkdm);
|
||||
omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
} else {
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
|
||||
omap2xxx_clkdm_sleep(clkdm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct clkdm_ops omap2_clkdm_operations = {
|
||||
.clkdm_add_wkdep = omap2_clkdm_add_wkdep,
|
||||
.clkdm_del_wkdep = omap2_clkdm_del_wkdep,
|
||||
.clkdm_read_wkdep = omap2_clkdm_read_wkdep,
|
||||
.clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
|
||||
.clkdm_sleep = omap2xxx_clkdm_sleep,
|
||||
.clkdm_wakeup = omap2xxx_clkdm_wakeup,
|
||||
.clkdm_allow_idle = omap2xxx_clkdm_allow_idle,
|
||||
.clkdm_deny_idle = omap2xxx_clkdm_deny_idle,
|
||||
.clkdm_clk_enable = omap2xxx_clkdm_clk_enable,
|
||||
.clkdm_clk_disable = omap2xxx_clkdm_clk_disable,
|
||||
};
|
||||
|
66
arch/arm/mach-omap2/cm2xxx.h
Normal file
66
arch/arm/mach-omap2/cm2xxx.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* OMAP2xxx Clock Management (CM) register definitions
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
|
||||
* Copyright (C) 2007-2010 Nokia Corporation
|
||||
* Paul Walmsley
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The CM hardware modules on the OMAP2/3 are quite similar to each
|
||||
* other. The CM modules/instances on OMAP4 are quite different, so
|
||||
* they are handled in a separate file.
|
||||
*/
|
||||
#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_H
|
||||
#define __ARCH_ASM_MACH_OMAP2_CM2XXX_H
|
||||
|
||||
#include "prcm-common.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
|
||||
#define OMAP2420_CM_REGADDR(module, reg) \
|
||||
OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
|
||||
#define OMAP2430_CM_REGADDR(module, reg) \
|
||||
OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
|
||||
|
||||
/*
|
||||
* Module specific CM register offsets from CM_BASE + domain offset
|
||||
* Use cm_{read,write}_mod_reg() with these registers.
|
||||
* These register offsets generally appear in more than one PRCM submodule.
|
||||
*/
|
||||
|
||||
/* OMAP2-specific register offsets */
|
||||
|
||||
#define OMAP24XX_CM_FCLKEN2 0x0004
|
||||
#define OMAP24XX_CM_ICLKEN4 0x001c
|
||||
#define OMAP24XX_CM_AUTOIDLE4 0x003c
|
||||
#define OMAP24XX_CM_IDLEST4 0x002c
|
||||
|
||||
/* CM_IDLEST bit field values to indicate deasserted IdleReq */
|
||||
|
||||
#define OMAP24XX_CM_IDLEST_VAL 0
|
||||
|
||||
|
||||
/* Clock management domain register get/set */
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
|
||||
extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
|
||||
|
||||
extern void omap2xxx_cm_set_dpll_disable_autoidle(void);
|
||||
extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void);
|
||||
|
||||
extern void omap2xxx_cm_set_apll54_disable_autoidle(void);
|
||||
extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void);
|
||||
extern void omap2xxx_cm_set_apll96_disable_autoidle(void);
|
||||
extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
|
||||
|
||||
extern bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
|
||||
extern int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
|
||||
u8 idlest_shift);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -18,27 +18,6 @@
|
||||
|
||||
#include "prcm-common.h"
|
||||
|
||||
#define OMAP2420_CM_REGADDR(module, reg) \
|
||||
OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
|
||||
#define OMAP2430_CM_REGADDR(module, reg) \
|
||||
OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
|
||||
#define OMAP34XX_CM_REGADDR(module, reg) \
|
||||
OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
|
||||
|
||||
|
||||
/*
|
||||
* OMAP3-specific global CM registers
|
||||
* Use cm_{read,write}_reg() with these registers.
|
||||
* These registers appear once per CM module.
|
||||
*/
|
||||
|
||||
#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
|
||||
#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
|
||||
#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
|
||||
|
||||
#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
|
||||
#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
|
||||
|
||||
/*
|
||||
* Module specific CM register offsets from CM_BASE + domain offset
|
||||
* Use cm_{read,write}_mod_reg() with these registers.
|
||||
@@ -57,6 +36,7 @@
|
||||
#define CM_IDLEST 0x0020
|
||||
#define CM_IDLEST1 CM_IDLEST
|
||||
#define CM_IDLEST2 0x0024
|
||||
#define OMAP2430_CM_IDLEST3 0x0028
|
||||
#define CM_AUTOIDLE 0x0030
|
||||
#define CM_AUTOIDLE1 CM_AUTOIDLE
|
||||
#define CM_AUTOIDLE2 0x0034
|
||||
@@ -66,70 +46,55 @@
|
||||
#define CM_CLKSEL2 0x0044
|
||||
#define OMAP2_CM_CLKSTCTRL 0x0048
|
||||
|
||||
/* OMAP2-specific register offsets */
|
||||
|
||||
#define OMAP24XX_CM_FCLKEN2 0x0004
|
||||
#define OMAP24XX_CM_ICLKEN4 0x001c
|
||||
#define OMAP24XX_CM_AUTOIDLE4 0x003c
|
||||
#define OMAP24XX_CM_IDLEST4 0x002c
|
||||
|
||||
#define OMAP2430_CM_IDLEST3 0x0028
|
||||
|
||||
/* OMAP3-specific register offsets */
|
||||
|
||||
#define OMAP3430_CM_CLKEN_PLL 0x0004
|
||||
#define OMAP3430ES2_CM_CLKEN2 0x0004
|
||||
#define OMAP3430ES2_CM_FCLKEN3 0x0008
|
||||
#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
|
||||
#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
|
||||
#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
|
||||
#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
|
||||
#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
|
||||
#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
|
||||
#define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
|
||||
#define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
|
||||
#define OMAP3430_CM_CLKSTST 0x004c
|
||||
#define OMAP3430ES2_CM_CLKSEL4 0x004c
|
||||
#define OMAP3430ES2_CM_CLKSEL5 0x0050
|
||||
#define OMAP3430_CM_CLKSEL2_EMU 0x0050
|
||||
#define OMAP3430_CM_CLKSEL3_EMU 0x0054
|
||||
|
||||
|
||||
/* CM_IDLEST bit field values to indicate deasserted IdleReq */
|
||||
|
||||
#define OMAP24XX_CM_IDLEST_VAL 0
|
||||
#define OMAP34XX_CM_IDLEST_VAL 1
|
||||
|
||||
|
||||
/* Clock management domain register get/set */
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
extern u32 omap2_cm_read_mod_reg(s16 module, u16 idx);
|
||||
extern void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx);
|
||||
extern u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
|
||||
#include <linux/io.h>
|
||||
|
||||
extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
|
||||
u8 idlest_shift);
|
||||
extern u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx);
|
||||
extern u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
|
||||
static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
|
||||
{
|
||||
return __raw_readl(cm_base + module + idx);
|
||||
}
|
||||
|
||||
extern bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
|
||||
extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
|
||||
extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
|
||||
static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
|
||||
{
|
||||
__raw_writel(val, cm_base + module + idx);
|
||||
}
|
||||
|
||||
extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
|
||||
extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
|
||||
extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask);
|
||||
extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask);
|
||||
/* Read-modify-write a register in a CM module. Caller must lock */
|
||||
static inline u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
|
||||
s16 idx)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
extern void omap2xxx_cm_set_dpll_disable_autoidle(void);
|
||||
extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void);
|
||||
v = omap2_cm_read_mod_reg(module, idx);
|
||||
v &= ~mask;
|
||||
v |= bits;
|
||||
omap2_cm_write_mod_reg(v, module, idx);
|
||||
|
||||
extern void omap2xxx_cm_set_apll54_disable_autoidle(void);
|
||||
extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void);
|
||||
extern void omap2xxx_cm_set_apll96_disable_autoidle(void);
|
||||
extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
|
||||
return v;
|
||||
}
|
||||
|
||||
/* Read a CM register, AND it, and shift the result down to bit 0 */
|
||||
static inline u32 omap2_cm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
v = omap2_cm_read_mod_reg(domain, idx);
|
||||
v &= mask;
|
||||
v >>= __ffs(mask);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
|
||||
{
|
||||
return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx);
|
||||
}
|
||||
|
||||
static inline u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
|
||||
{
|
||||
return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -147,10 +112,4 @@ extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
|
||||
#define OMAP_ST_GFX_MASK (1 << 0)
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
# ifndef __ASSEMBLER__
|
||||
extern void omap3_cm_save_context(void);
|
||||
extern void omap3_cm_restore_context(void);
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
@@ -22,8 +22,7 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/common.h>
|
||||
|
||||
#include "clockdomain.h"
|
||||
#include "cm.h"
|
||||
#include "cm33xx.h"
|
||||
#include "cm-regbits-34xx.h"
|
||||
@@ -311,3 +310,58 @@ void am33xx_cm_module_disable(u16 inst, s16 cdoffs, u16 clkctrl_offs)
|
||||
v &= ~AM33XX_MODULEMODE_MASK;
|
||||
am33xx_cm_write_reg(v, inst, clkctrl_offs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clockdomain low-level functions
|
||||
*/
|
||||
|
||||
static int am33xx_clkdm_sleep(struct clockdomain *clkdm)
|
||||
{
|
||||
am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int am33xx_clkdm_wakeup(struct clockdomain *clkdm)
|
||||
{
|
||||
am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
}
|
||||
|
||||
static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
}
|
||||
|
||||
static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm)
|
||||
{
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
|
||||
return am33xx_clkdm_wakeup(clkdm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
|
||||
if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
|
||||
am33xx_clkdm_sleep(clkdm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct clkdm_ops am33xx_clkdm_operations = {
|
||||
.clkdm_sleep = am33xx_clkdm_sleep,
|
||||
.clkdm_wakeup = am33xx_clkdm_wakeup,
|
||||
.clkdm_allow_idle = am33xx_clkdm_allow_idle,
|
||||
.clkdm_deny_idle = am33xx_clkdm_deny_idle,
|
||||
.clkdm_clk_enable = am33xx_clkdm_clk_enable,
|
||||
.clkdm_clk_disable = am33xx_clkdm_clk_disable,
|
||||
};
|
||||
|
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* OMAP2/3 CM module functions
|
||||
* OMAP3xxx CM module functions
|
||||
*
|
||||
* Copyright (C) 2009 Nokia Corporation
|
||||
* Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
|
||||
* Paul Walmsley
|
||||
* Rajendra Nayak <rnayak@ti.com>
|
||||
*
|
||||
* 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
|
||||
@@ -12,8 +14,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
@@ -21,56 +21,16 @@
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "common.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
#include "cm.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "cm-regbits-24xx.h"
|
||||
#include "cm3xxx.h"
|
||||
#include "cm-regbits-34xx.h"
|
||||
#include "clockdomain.h"
|
||||
|
||||
/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */
|
||||
#define DPLL_AUTOIDLE_DISABLE 0x0
|
||||
#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3
|
||||
|
||||
/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
|
||||
#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0
|
||||
#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
|
||||
|
||||
static const u8 cm_idlest_offs[] = {
|
||||
CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
|
||||
static const u8 omap3xxx_cm_idlest_offs[] = {
|
||||
CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3
|
||||
};
|
||||
|
||||
u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
|
||||
{
|
||||
return __raw_readl(cm_base + module + idx);
|
||||
}
|
||||
|
||||
void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
|
||||
{
|
||||
__raw_writel(val, cm_base + module + idx);
|
||||
}
|
||||
|
||||
/* Read-modify-write a register in a CM module. Caller must lock */
|
||||
u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
v = omap2_cm_read_mod_reg(module, idx);
|
||||
v &= ~mask;
|
||||
v |= bits;
|
||||
omap2_cm_write_mod_reg(v, module, idx);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
|
||||
{
|
||||
return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx);
|
||||
}
|
||||
|
||||
u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
|
||||
{
|
||||
return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
@@ -85,33 +45,15 @@ static void _write_clktrctrl(u8 c, s16 module, u32 mask)
|
||||
omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
|
||||
}
|
||||
|
||||
bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
|
||||
bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
|
||||
{
|
||||
u32 v;
|
||||
bool ret = 0;
|
||||
|
||||
BUG_ON(!cpu_is_omap24xx() && !cpu_is_omap34xx());
|
||||
|
||||
v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
|
||||
v &= mask;
|
||||
v >>= __ffs(mask);
|
||||
|
||||
if (cpu_is_omap24xx())
|
||||
ret = (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
|
||||
else
|
||||
ret = (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
|
||||
{
|
||||
_write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
|
||||
{
|
||||
_write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
|
||||
return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
|
||||
}
|
||||
|
||||
void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
|
||||
@@ -134,110 +76,210 @@ void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask)
|
||||
_write_clktrctrl(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, module, mask);
|
||||
}
|
||||
|
||||
/*
|
||||
* DPLL autoidle control
|
||||
*/
|
||||
|
||||
static void _omap2xxx_set_dpll_autoidle(u8 m)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
|
||||
v &= ~OMAP24XX_AUTO_DPLL_MASK;
|
||||
v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
|
||||
omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_dpll_disable_autoidle(void)
|
||||
{
|
||||
_omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_dpll_auto_low_power_stop(void)
|
||||
{
|
||||
_omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
* APLL autoidle control
|
||||
*/
|
||||
|
||||
static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
|
||||
v &= ~mask;
|
||||
v |= m << __ffs(mask);
|
||||
omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_apll54_disable_autoidle(void)
|
||||
{
|
||||
_omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
|
||||
OMAP24XX_AUTO_54M_MASK);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_apll54_auto_low_power_stop(void)
|
||||
{
|
||||
_omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
|
||||
OMAP24XX_AUTO_54M_MASK);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_apll96_disable_autoidle(void)
|
||||
{
|
||||
_omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
|
||||
OMAP24XX_AUTO_96M_MASK);
|
||||
}
|
||||
|
||||
void omap2xxx_cm_set_apll96_auto_low_power_stop(void)
|
||||
{
|
||||
_omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
|
||||
OMAP24XX_AUTO_96M_MASK);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* omap2_cm_wait_idlest_ready - wait for a module to leave idle or standby
|
||||
* omap3xxx_cm_wait_module_ready - wait for a module to leave idle or standby
|
||||
* @prcm_mod: PRCM module offset
|
||||
* @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
|
||||
* @idlest_shift: shift of the bit in the CM_IDLEST* register to check
|
||||
*
|
||||
* XXX document
|
||||
* Wait for the PRCM to indicate that the module identified by
|
||||
* (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
|
||||
* success or -EBUSY if the module doesn't enable in time.
|
||||
*/
|
||||
int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
|
||||
int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
|
||||
{
|
||||
int ena = 0, i = 0;
|
||||
u8 cm_idlest_reg;
|
||||
u32 mask;
|
||||
|
||||
if (!idlest_id || (idlest_id > ARRAY_SIZE(cm_idlest_offs)))
|
||||
if (!idlest_id || (idlest_id > ARRAY_SIZE(omap3xxx_cm_idlest_offs)))
|
||||
return -EINVAL;
|
||||
|
||||
cm_idlest_reg = cm_idlest_offs[idlest_id - 1];
|
||||
cm_idlest_reg = omap3xxx_cm_idlest_offs[idlest_id - 1];
|
||||
|
||||
mask = 1 << idlest_shift;
|
||||
ena = 0;
|
||||
|
||||
if (cpu_is_omap24xx())
|
||||
ena = mask;
|
||||
else if (cpu_is_omap34xx())
|
||||
ena = 0;
|
||||
else
|
||||
BUG();
|
||||
|
||||
omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) == ena),
|
||||
MAX_MODULE_READY_TIME, i);
|
||||
omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) &
|
||||
mask) == ena), MAX_MODULE_READY_TIME, i);
|
||||
|
||||
return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
|
||||
}
|
||||
|
||||
/* Clockdomain low-level operations */
|
||||
|
||||
static int omap3xxx_clkdm_add_sleepdep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
|
||||
clkdm1->pwrdm.ptr->prcm_offs,
|
||||
OMAP3430_CM_SLEEPDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3xxx_clkdm_del_sleepdep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
|
||||
clkdm1->pwrdm.ptr->prcm_offs,
|
||||
OMAP3430_CM_SLEEPDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3xxx_clkdm_read_sleepdep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
return omap2_cm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
|
||||
OMAP3430_CM_SLEEPDEP,
|
||||
(1 << clkdm2->dep_bit));
|
||||
}
|
||||
|
||||
static int omap3xxx_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
|
||||
{
|
||||
struct clkdm_dep *cd;
|
||||
u32 mask = 0;
|
||||
|
||||
for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
|
||||
if (!cd->clkdm)
|
||||
continue; /* only happens if data is erroneous */
|
||||
|
||||
mask |= 1 << cd->clkdm->dep_bit;
|
||||
atomic_set(&cd->sleepdep_usecount, 0);
|
||||
}
|
||||
omap2_cm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
|
||||
OMAP3430_CM_SLEEPDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3xxx_clkdm_sleep(struct clockdomain *clkdm)
|
||||
{
|
||||
omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3xxx_clkdm_wakeup(struct clockdomain *clkdm)
|
||||
{
|
||||
omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void omap3xxx_clkdm_allow_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
if (atomic_read(&clkdm->usecount) > 0)
|
||||
_clkdm_add_autodeps(clkdm);
|
||||
|
||||
omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
}
|
||||
|
||||
static void omap3xxx_clkdm_deny_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (atomic_read(&clkdm->usecount) > 0)
|
||||
_clkdm_del_autodeps(clkdm);
|
||||
}
|
||||
|
||||
static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
if (!clkdm->clktrctrl_mask)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The CLKDM_MISSING_IDLE_REPORTING flag documentation has
|
||||
* more details on the unpleasant problem this is working
|
||||
* around
|
||||
*/
|
||||
if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
|
||||
(clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
|
||||
omap3xxx_clkdm_wakeup(clkdm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (hwsup) {
|
||||
/* Disable HW transitions when we are changing deps */
|
||||
omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
_clkdm_add_autodeps(clkdm);
|
||||
omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
} else {
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
|
||||
omap3xxx_clkdm_wakeup(clkdm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
if (!clkdm->clktrctrl_mask)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The CLKDM_MISSING_IDLE_REPORTING flag documentation has
|
||||
* more details on the unpleasant problem this is working
|
||||
* around
|
||||
*/
|
||||
if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
|
||||
!(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
|
||||
omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
return 0;
|
||||
}
|
||||
|
||||
hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
|
||||
if (hwsup) {
|
||||
/* Disable HW transitions when we are changing deps */
|
||||
omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
_clkdm_del_autodeps(clkdm);
|
||||
omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
|
||||
clkdm->clktrctrl_mask);
|
||||
} else {
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
|
||||
omap3xxx_clkdm_sleep(clkdm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct clkdm_ops omap3_clkdm_operations = {
|
||||
.clkdm_add_wkdep = omap2_clkdm_add_wkdep,
|
||||
.clkdm_del_wkdep = omap2_clkdm_del_wkdep,
|
||||
.clkdm_read_wkdep = omap2_clkdm_read_wkdep,
|
||||
.clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
|
||||
.clkdm_add_sleepdep = omap3xxx_clkdm_add_sleepdep,
|
||||
.clkdm_del_sleepdep = omap3xxx_clkdm_del_sleepdep,
|
||||
.clkdm_read_sleepdep = omap3xxx_clkdm_read_sleepdep,
|
||||
.clkdm_clear_all_sleepdeps = omap3xxx_clkdm_clear_all_sleepdeps,
|
||||
.clkdm_sleep = omap3xxx_clkdm_sleep,
|
||||
.clkdm_wakeup = omap3xxx_clkdm_wakeup,
|
||||
.clkdm_allow_idle = omap3xxx_clkdm_allow_idle,
|
||||
.clkdm_deny_idle = omap3xxx_clkdm_deny_idle,
|
||||
.clkdm_clk_enable = omap3xxx_clkdm_clk_enable,
|
||||
.clkdm_clk_disable = omap3xxx_clkdm_clk_disable,
|
||||
};
|
||||
|
||||
/*
|
||||
* Context save/restore code - OMAP3 only
|
||||
*/
|
||||
#ifdef CONFIG_ARCH_OMAP3
|
||||
struct omap3_cm_regs {
|
||||
u32 iva2_cm_clksel1;
|
||||
u32 iva2_cm_clksel2;
|
||||
@@ -555,4 +597,3 @@ void omap3_cm_restore_context(void)
|
||||
omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD,
|
||||
OMAP3_CM_CLKOUT_CTRL_OFFSET);
|
||||
}
|
||||
#endif
|
86
arch/arm/mach-omap2/cm3xxx.h
Normal file
86
arch/arm/mach-omap2/cm3xxx.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* OMAP2/3 Clock Management (CM) register definitions
|
||||
*
|
||||
* Copyright (C) 2007-2009 Texas Instruments, Inc.
|
||||
* Copyright (C) 2007-2010 Nokia Corporation
|
||||
* Paul Walmsley
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The CM hardware modules on the OMAP2/3 are quite similar to each
|
||||
* other. The CM modules/instances on OMAP4 are quite different, so
|
||||
* they are handled in a separate file.
|
||||
*/
|
||||
#ifndef __ARCH_ASM_MACH_OMAP2_CM3XXX_H
|
||||
#define __ARCH_ASM_MACH_OMAP2_CM3XXX_H
|
||||
|
||||
#include "prcm-common.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
|
||||
#define OMAP34XX_CM_REGADDR(module, reg) \
|
||||
OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
|
||||
|
||||
|
||||
/*
|
||||
* OMAP3-specific global CM registers
|
||||
* Use cm_{read,write}_reg() with these registers.
|
||||
* These registers appear once per CM module.
|
||||
*/
|
||||
|
||||
#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
|
||||
#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
|
||||
#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
|
||||
|
||||
#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
|
||||
#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
|
||||
|
||||
/*
|
||||
* Module specific CM register offsets from CM_BASE + domain offset
|
||||
* Use cm_{read,write}_mod_reg() with these registers.
|
||||
* These register offsets generally appear in more than one PRCM submodule.
|
||||
*/
|
||||
|
||||
/* OMAP3-specific register offsets */
|
||||
|
||||
#define OMAP3430_CM_CLKEN_PLL 0x0004
|
||||
#define OMAP3430ES2_CM_CLKEN2 0x0004
|
||||
#define OMAP3430ES2_CM_FCLKEN3 0x0008
|
||||
#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
|
||||
#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
|
||||
#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
|
||||
#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
|
||||
#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
|
||||
#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
|
||||
#define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
|
||||
#define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
|
||||
#define OMAP3430_CM_CLKSTST 0x004c
|
||||
#define OMAP3430ES2_CM_CLKSEL4 0x004c
|
||||
#define OMAP3430ES2_CM_CLKSEL5 0x0050
|
||||
#define OMAP3430_CM_CLKSEL2_EMU 0x0050
|
||||
#define OMAP3430_CM_CLKSEL3_EMU 0x0054
|
||||
|
||||
|
||||
/* CM_IDLEST bit field values to indicate deasserted IdleReq */
|
||||
|
||||
#define OMAP34XX_CM_IDLEST_VAL 1
|
||||
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
|
||||
extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
|
||||
extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask);
|
||||
extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask);
|
||||
|
||||
extern bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
|
||||
extern int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
|
||||
u8 idlest_shift);
|
||||
|
||||
extern void omap3_cm_save_context(void);
|
||||
extern void omap3_cm_restore_context(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
71
arch/arm/mach-omap2/cm_common.c
Normal file
71
arch/arm/mach-omap2/cm_common.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* OMAP2+ common Clock Management (CM) IP block functions
|
||||
*
|
||||
* Copyright (C) 2012 Texas Instruments, Inc.
|
||||
* Paul Walmsley <paul@pwsan.com>
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* XXX This code should eventually be moved to a CM driver.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include "cm2xxx.h"
|
||||
#include "cm3xxx.h"
|
||||
#include "cm44xx.h"
|
||||
|
||||
/*
|
||||
* cm_ll_data: function pointers to SoC-specific implementations of
|
||||
* common CM functions
|
||||
*/
|
||||
static struct cm_ll_data null_cm_ll_data;
|
||||
static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
|
||||
|
||||
/**
|
||||
* cm_register - register per-SoC low-level data with the CM
|
||||
* @cld: low-level per-SoC OMAP CM data & function pointers to register
|
||||
*
|
||||
* Register per-SoC low-level OMAP CM data and function pointers with
|
||||
* the OMAP CM common interface. The caller must keep the data
|
||||
* pointed to by @cld valid until it calls cm_unregister() and
|
||||
* it returns successfully. Returns 0 upon success, -EINVAL if @cld
|
||||
* is NULL, or -EEXIST if cm_register() has already been called
|
||||
* without an intervening cm_unregister().
|
||||
*/
|
||||
int cm_register(struct cm_ll_data *cld)
|
||||
{
|
||||
if (!cld)
|
||||
return -EINVAL;
|
||||
|
||||
if (cm_ll_data != &null_cm_ll_data)
|
||||
return -EEXIST;
|
||||
|
||||
cm_ll_data = cld;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* cm_unregister - unregister per-SoC low-level data & function pointers
|
||||
* @cld: low-level per-SoC OMAP CM data & function pointers to unregister
|
||||
*
|
||||
* Unregister per-SoC low-level OMAP CM data and function pointers
|
||||
* that were previously registered with cm_register(). The
|
||||
* caller may not destroy any of the data pointed to by @cld until
|
||||
* this function returns successfully. Returns 0 upon success, or
|
||||
* -EINVAL if @cld is NULL or if @cld does not match the struct
|
||||
* cm_ll_data * previously registered by cm_register().
|
||||
*/
|
||||
int cm_unregister(struct cm_ll_data *cld)
|
||||
{
|
||||
if (!cld || cm_ll_data != cld)
|
||||
return -EINVAL;
|
||||
|
||||
cm_ll_data = &null_cm_ll_data;
|
||||
|
||||
return 0;
|
||||
}
|
@@ -2,8 +2,9 @@
|
||||
* OMAP4 CM instance functions
|
||||
*
|
||||
* Copyright (C) 2009 Nokia Corporation
|
||||
* Copyright (C) 2011 Texas Instruments, Inc.
|
||||
* Copyright (C) 2008-2011 Texas Instruments, Inc.
|
||||
* Paul Walmsley
|
||||
* Rajendra Nayak <rnayak@ti.com>
|
||||
*
|
||||
* 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
|
||||
@@ -22,6 +23,7 @@
|
||||
|
||||
#include "iomap.h"
|
||||
#include "common.h"
|
||||
#include "clockdomain.h"
|
||||
#include "cm.h"
|
||||
#include "cm1_44xx.h"
|
||||
#include "cm2_44xx.h"
|
||||
@@ -343,3 +345,141 @@ void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
|
||||
v &= ~OMAP4430_MODULEMODE_MASK;
|
||||
omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clockdomain low-level functions
|
||||
*/
|
||||
|
||||
static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
|
||||
clkdm1->prcm_partition,
|
||||
clkdm1->cm_inst, clkdm1->clkdm_offs +
|
||||
OMAP4_CM_STATICDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
|
||||
clkdm1->prcm_partition,
|
||||
clkdm1->cm_inst, clkdm1->clkdm_offs +
|
||||
OMAP4_CM_STATICDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
|
||||
struct clockdomain *clkdm2)
|
||||
{
|
||||
return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
|
||||
clkdm1->cm_inst,
|
||||
clkdm1->clkdm_offs +
|
||||
OMAP4_CM_STATICDEP,
|
||||
(1 << clkdm2->dep_bit));
|
||||
}
|
||||
|
||||
static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
|
||||
{
|
||||
struct clkdm_dep *cd;
|
||||
u32 mask = 0;
|
||||
|
||||
if (!clkdm->prcm_partition)
|
||||
return 0;
|
||||
|
||||
for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
|
||||
if (!cd->clkdm)
|
||||
continue; /* only happens if data is erroneous */
|
||||
|
||||
mask |= 1 << cd->clkdm->dep_bit;
|
||||
atomic_set(&cd->wkdep_usecount, 0);
|
||||
}
|
||||
|
||||
omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
|
||||
clkdm->cm_inst, clkdm->clkdm_offs +
|
||||
OMAP4_CM_STATICDEP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_clkdm_sleep(struct clockdomain *clkdm)
|
||||
{
|
||||
omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
|
||||
clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
|
||||
{
|
||||
omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
|
||||
clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
|
||||
clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
}
|
||||
|
||||
static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
|
||||
{
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
|
||||
omap4_clkdm_wakeup(clkdm);
|
||||
else
|
||||
omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
|
||||
clkdm->cm_inst,
|
||||
clkdm->clkdm_offs);
|
||||
}
|
||||
|
||||
static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
|
||||
{
|
||||
if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
|
||||
return omap4_clkdm_wakeup(clkdm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
|
||||
{
|
||||
bool hwsup = false;
|
||||
|
||||
if (!clkdm->prcm_partition)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* The CLKDM_MISSING_IDLE_REPORTING flag documentation has
|
||||
* more details on the unpleasant problem this is working
|
||||
* around
|
||||
*/
|
||||
if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
|
||||
!(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
|
||||
omap4_clkdm_allow_idle(clkdm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
|
||||
clkdm->cm_inst, clkdm->clkdm_offs);
|
||||
|
||||
if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
|
||||
omap4_clkdm_sleep(clkdm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct clkdm_ops omap4_clkdm_operations = {
|
||||
.clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
|
||||
.clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
|
||||
.clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep,
|
||||
.clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
|
||||
.clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep,
|
||||
.clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep,
|
||||
.clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep,
|
||||
.clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
|
||||
.clkdm_sleep = omap4_clkdm_sleep,
|
||||
.clkdm_wakeup = omap4_clkdm_wakeup,
|
||||
.clkdm_allow_idle = omap4_clkdm_allow_idle,
|
||||
.clkdm_deny_idle = omap4_clkdm_deny_idle,
|
||||
.clkdm_clk_enable = omap4_clkdm_clk_enable,
|
||||
.clkdm_clk_disable = omap4_clkdm_clk_disable,
|
||||
};
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <linux/spi/ads7846.h>
|
||||
|
||||
#include <linux/platform_data/spi-omap2-mcspi.h>
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "common-board-devices.h"
|
||||
@@ -102,48 +101,3 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
|
||||
static struct omap_nand_platform_data nand_data;
|
||||
|
||||
void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
|
||||
int nr_parts)
|
||||
{
|
||||
u8 cs = 0;
|
||||
u8 nandcs = GPMC_CS_NUM + 1;
|
||||
|
||||
/* find out the chip-select on which NAND exists */
|
||||
while (cs < GPMC_CS_NUM) {
|
||||
u32 ret = 0;
|
||||
ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
|
||||
|
||||
if ((ret & 0xC00) == 0x800) {
|
||||
printk(KERN_INFO "Found NAND on CS%d\n", cs);
|
||||
if (nandcs > GPMC_CS_NUM)
|
||||
nandcs = cs;
|
||||
}
|
||||
cs++;
|
||||
}
|
||||
|
||||
if (nandcs > GPMC_CS_NUM) {
|
||||
pr_info("NAND: Unable to find configuration in GPMC\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (nandcs < GPMC_CS_NUM) {
|
||||
nand_data.cs = nandcs;
|
||||
nand_data.parts = parts;
|
||||
nand_data.nr_parts = nr_parts;
|
||||
nand_data.devsize = options;
|
||||
|
||||
printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
|
||||
if (gpmc_nand_init(&nand_data) < 0)
|
||||
printk(KERN_ERR "Unable to register NAND device\n");
|
||||
}
|
||||
}
|
||||
#else
|
||||
void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
|
||||
int nr_parts)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
@@ -10,6 +10,5 @@ struct ads7846_platform_data;
|
||||
|
||||
void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
|
||||
struct ads7846_platform_data *board_pdata);
|
||||
void omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts);
|
||||
|
||||
#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
|
||||
|
@@ -16,14 +16,17 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/platform_data/dsp-omap.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/vram.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "common.h"
|
||||
#include "clock.h"
|
||||
#include "sdrc.h"
|
||||
#include "control.h"
|
||||
#include "omap-secure.h"
|
||||
|
||||
/* Global address base setup code */
|
||||
|
||||
@@ -200,3 +203,20 @@ void __init omap5_map_io(void)
|
||||
omap5_map_common_io();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Stub function for OMAP2 so that common files
|
||||
* continue to build when custom builds are used
|
||||
*/
|
||||
int __weak omap_secure_ram_reserve_memblock(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __init omap_reserve(void)
|
||||
{
|
||||
omap_vram_reserve_sdram_memblock();
|
||||
omap_dsp_reserve_sdram_memblock();
|
||||
omap_secure_ram_reserve_memblock();
|
||||
omap_barrier_reserve_memblock();
|
||||
}
|
||||
|
@@ -28,13 +28,16 @@
|
||||
|
||||
#include <linux/irq.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c/twl.h>
|
||||
#include <linux/i2c-omap.h>
|
||||
|
||||
#include <asm/proc-fns.h>
|
||||
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/serial.h>
|
||||
#include <plat/common.h>
|
||||
#include "i2c.h"
|
||||
#include "serial.h"
|
||||
|
||||
#include "usb.h"
|
||||
|
||||
#define OMAP_INTC_START NR_IRQS
|
||||
|
||||
@@ -342,6 +345,10 @@ extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
|
||||
struct omap_sdrc_params *sdrc_cs1);
|
||||
struct omap2_hsmmc_info;
|
||||
extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers);
|
||||
extern void omap_reserve(void);
|
||||
|
||||
struct omap_hwmod;
|
||||
extern int omap_dss_reset(struct omap_hwmod *);
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* OMAP2/3 System Control Module register access
|
||||
*
|
||||
* Copyright (C) 2007 Texas Instruments, Inc.
|
||||
* Copyright (C) 2007, 2012 Texas Instruments, Inc.
|
||||
* Copyright (C) 2007 Nokia Corporation
|
||||
*
|
||||
* Written by Paul Walmsley
|
||||
@@ -15,15 +15,13 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/sdrc.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "common.h"
|
||||
#include "cm-regbits-34xx.h"
|
||||
#include "prm-regbits-34xx.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "prm3xxx.h"
|
||||
#include "cm3xxx.h"
|
||||
#include "sdrc.h"
|
||||
#include "pm.h"
|
||||
#include "control.h"
|
||||
|
@@ -1,9 +0,0 @@
|
||||
#ifndef _OMAP_DEBUG_DEVICES_H
|
||||
#define _OMAP_DEBUG_DEVICES_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* for TI reference platforms sharing the same debug card */
|
||||
extern int debug_card_init(u32 addr, unsigned gpio);
|
||||
|
||||
#endif
|
@@ -24,10 +24,11 @@
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <plat-omap/dma-omap.h>
|
||||
|
||||
#include "iomap.h"
|
||||
#include <plat/dma.h>
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include <plat/omap_device.h>
|
||||
#include "omap_hwmod.h"
|
||||
#include "omap_device.h"
|
||||
#include "omap4-keypad.h"
|
||||
|
||||
#include "soc.h"
|
||||
@@ -35,6 +36,7 @@
|
||||
#include "mux.h"
|
||||
#include "control.h"
|
||||
#include "devices.h"
|
||||
#include "dma.h"
|
||||
|
||||
#define L3_MODULES_MAX_LEN 12
|
||||
#define L3_MODULES 3
|
||||
@@ -127,7 +129,7 @@ static struct platform_device omap2cam_device = {
|
||||
|
||||
#if defined(CONFIG_IOMMU_API)
|
||||
|
||||
#include <plat/iommu.h>
|
||||
#include <linux/platform_data/iommu-omap.h>
|
||||
|
||||
static struct resource omap3isp_resources[] = {
|
||||
{
|
||||
|
@@ -25,11 +25,12 @@
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <video/omapdss.h>
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include <plat/omap_device.h>
|
||||
#include <plat/omap-pm.h>
|
||||
#include "omap_hwmod.h"
|
||||
#include "omap_device.h"
|
||||
#include "omap-pm.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "soc.h"
|
||||
#include "iomap.h"
|
||||
#include "mux.h"
|
||||
#include "control.h"
|
||||
@@ -284,6 +285,35 @@ err:
|
||||
return ERR_PTR(r);
|
||||
}
|
||||
|
||||
static enum omapdss_version __init omap_display_get_version(void)
|
||||
{
|
||||
if (cpu_is_omap24xx())
|
||||
return OMAPDSS_VER_OMAP24xx;
|
||||
else if (cpu_is_omap3630())
|
||||
return OMAPDSS_VER_OMAP3630;
|
||||
else if (cpu_is_omap34xx()) {
|
||||
if (soc_is_am35xx()) {
|
||||
return OMAPDSS_VER_AM35xx;
|
||||
} else {
|
||||
if (omap_rev() < OMAP3430_REV_ES3_0)
|
||||
return OMAPDSS_VER_OMAP34xx_ES1;
|
||||
else
|
||||
return OMAPDSS_VER_OMAP34xx_ES3;
|
||||
}
|
||||
} else if (omap_rev() == OMAP4430_REV_ES1_0)
|
||||
return OMAPDSS_VER_OMAP4430_ES1;
|
||||
else if (omap_rev() == OMAP4430_REV_ES2_0 ||
|
||||
omap_rev() == OMAP4430_REV_ES2_1 ||
|
||||
omap_rev() == OMAP4430_REV_ES2_2)
|
||||
return OMAPDSS_VER_OMAP4430_ES2;
|
||||
else if (cpu_is_omap44xx())
|
||||
return OMAPDSS_VER_OMAP4;
|
||||
else if (soc_is_omap54xx())
|
||||
return OMAPDSS_VER_OMAP5;
|
||||
else
|
||||
return OMAPDSS_VER_UNKNOWN;
|
||||
}
|
||||
|
||||
int __init omap_display_init(struct omap_dss_board_info *board_data)
|
||||
{
|
||||
int r = 0;
|
||||
@@ -291,9 +321,18 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
|
||||
int i, oh_count;
|
||||
const struct omap_dss_hwmod_data *curr_dss_hwmod;
|
||||
struct platform_device *dss_pdev;
|
||||
enum omapdss_version ver;
|
||||
|
||||
/* create omapdss device */
|
||||
|
||||
ver = omap_display_get_version();
|
||||
|
||||
if (ver == OMAPDSS_VER_UNKNOWN) {
|
||||
pr_err("DSS not supported on this SoC\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
board_data->version = ver;
|
||||
board_data->dsi_enable_pads = omap_dsi_enable_pads;
|
||||
board_data->dsi_disable_pads = omap_dsi_disable_pads;
|
||||
board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
|
||||
|
@@ -28,9 +28,11 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include <plat/omap_device.h>
|
||||
#include <plat/dma.h>
|
||||
#include <plat-omap/dma-omap.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "omap_hwmod.h"
|
||||
#include "omap_device.h"
|
||||
|
||||
#define OMAP2_DMA_STRIDE 0x60
|
||||
|
||||
@@ -274,6 +276,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP))
|
||||
d->dev_caps |= HS_CHANNELS_RESERVED;
|
||||
|
||||
/* Check the capabilities register for descriptor loading feature */
|
||||
if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS)
|
||||
dma_common_ch_end = CCDN;
|
||||
|
131
arch/arm/mach-omap2/dma.h
Normal file
131
arch/arm/mach-omap2/dma.h
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* OMAP2PLUS DMA channel definitions
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __OMAP2PLUS_DMA_CHANNEL_H
|
||||
#define __OMAP2PLUS_DMA_CHANNEL_H
|
||||
|
||||
|
||||
/* DMA channels for 24xx */
|
||||
#define OMAP24XX_DMA_NO_DEVICE 0
|
||||
#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
|
||||
#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
|
||||
#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
|
||||
#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
|
||||
#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
|
||||
#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
|
||||
#define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */
|
||||
#define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */
|
||||
#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */
|
||||
#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
|
||||
#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
|
||||
#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
|
||||
#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
|
||||
#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
|
||||
#define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */
|
||||
#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
|
||||
#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
|
||||
#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
|
||||
#define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */
|
||||
#define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */
|
||||
#define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
|
||||
#define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */
|
||||
#define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */
|
||||
#define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */
|
||||
#define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */
|
||||
#define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */
|
||||
#define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */
|
||||
#define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */
|
||||
#define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */
|
||||
#define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
|
||||
#define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
|
||||
#define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */
|
||||
#define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */
|
||||
#define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */
|
||||
#define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */
|
||||
#define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */
|
||||
#define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */
|
||||
#define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
|
||||
#define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
|
||||
#define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */
|
||||
#define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */
|
||||
#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
|
||||
#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
|
||||
#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
|
||||
#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
|
||||
#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
|
||||
#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
|
||||
#define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */
|
||||
#define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */
|
||||
#define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */
|
||||
#define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */
|
||||
#define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
|
||||
#define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
|
||||
#define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
|
||||
#define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
|
||||
#define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
|
||||
#define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
|
||||
#define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
|
||||
#define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
|
||||
#define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
|
||||
#define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
|
||||
#define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
|
||||
#define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
|
||||
#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
|
||||
#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
|
||||
#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
|
||||
#define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */
|
||||
#define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */
|
||||
#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
|
||||
#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
|
||||
#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
|
||||
#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */
|
||||
#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */
|
||||
#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */
|
||||
#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */
|
||||
#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */
|
||||
#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */
|
||||
#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
|
||||
#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
|
||||
#define OMAP24XX_DMA_MS 63 /* S_DMA_62 */
|
||||
#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
|
||||
#define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */
|
||||
#define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */
|
||||
#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
|
||||
#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
|
||||
#define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */
|
||||
#define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */
|
||||
#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
|
||||
#define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
|
||||
#define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
|
||||
#define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */
|
||||
#define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */
|
||||
#define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */
|
||||
#define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */
|
||||
#define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */
|
||||
#define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */
|
||||
#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
|
||||
#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
|
||||
|
||||
#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
|
||||
#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
|
||||
|
||||
/* Only for AM35xx */
|
||||
#define AM35XX_DMA_UART4_TX 54
|
||||
#define AM35XX_DMA_UART4_RX 55
|
||||
|
||||
#endif /* __OMAP2PLUS_DMA_CHANNEL_H */
|
@@ -28,8 +28,6 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/clkdev.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "clock.h"
|
||||
#include "cm2xxx_3xxx.h"
|
||||
|
@@ -15,8 +15,6 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "clock.h"
|
||||
#include "clock44xx.h"
|
||||
|
@@ -25,8 +25,8 @@
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/platform_data/omap_drm.h>
|
||||
|
||||
#include <plat/omap_device.h>
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include "omap_device.h"
|
||||
#include "omap_hwmod.h"
|
||||
#include <plat/cpu.h>
|
||||
|
||||
#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include "cm2xxx_3xxx.h"
|
||||
#include "prm2xxx_3xxx.h"
|
||||
#ifdef CONFIG_BRIDGE_DVFS
|
||||
#include <plat/omap-pm.h>
|
||||
#include "omap-pm.h"
|
||||
#endif
|
||||
|
||||
#include <linux/platform_data/dsp-omap.h>
|
||||
|
@@ -23,9 +23,9 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_data/gpio-omap.h>
|
||||
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include <plat/omap_device.h>
|
||||
#include <plat/omap-pm.h>
|
||||
#include "omap_hwmod.h"
|
||||
#include "omap_device.h"
|
||||
#include "omap-pm.h"
|
||||
|
||||
#include "powerdomain.h"
|
||||
|
||||
|
@@ -17,9 +17,12 @@
|
||||
|
||||
#include <asm/mach/flash.h>
|
||||
|
||||
#include <plat/gpmc.h>
|
||||
|
||||
#include "gpmc.h"
|
||||
#include "soc.h"
|
||||
#include "gpmc-nand.h"
|
||||
|
||||
/* minimum size for IO mapping */
|
||||
#define NAND_IO_SIZE 4
|
||||
|
||||
static struct resource gpmc_nand_resource[] = {
|
||||
{
|
||||
@@ -40,41 +43,36 @@ static struct platform_device gpmc_nand_device = {
|
||||
.resource = gpmc_nand_resource,
|
||||
};
|
||||
|
||||
static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data)
|
||||
static int omap2_nand_gpmc_retime(
|
||||
struct omap_nand_platform_data *gpmc_nand_data,
|
||||
struct gpmc_timings *gpmc_t)
|
||||
{
|
||||
struct gpmc_timings t;
|
||||
int err;
|
||||
|
||||
if (!gpmc_nand_data->gpmc_t)
|
||||
return 0;
|
||||
|
||||
memset(&t, 0, sizeof(t));
|
||||
t.sync_clk = gpmc_nand_data->gpmc_t->sync_clk;
|
||||
t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on);
|
||||
t.adv_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->adv_on);
|
||||
t.sync_clk = gpmc_t->sync_clk;
|
||||
t.cs_on = gpmc_round_ns_to_ticks(gpmc_t->cs_on);
|
||||
t.adv_on = gpmc_round_ns_to_ticks(gpmc_t->adv_on);
|
||||
|
||||
/* Read */
|
||||
t.adv_rd_off = gpmc_round_ns_to_ticks(
|
||||
gpmc_nand_data->gpmc_t->adv_rd_off);
|
||||
t.adv_rd_off = gpmc_round_ns_to_ticks(gpmc_t->adv_rd_off);
|
||||
t.oe_on = t.adv_on;
|
||||
t.access = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->access);
|
||||
t.oe_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->oe_off);
|
||||
t.cs_rd_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_rd_off);
|
||||
t.rd_cycle = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->rd_cycle);
|
||||
t.access = gpmc_round_ns_to_ticks(gpmc_t->access);
|
||||
t.oe_off = gpmc_round_ns_to_ticks(gpmc_t->oe_off);
|
||||
t.cs_rd_off = gpmc_round_ns_to_ticks(gpmc_t->cs_rd_off);
|
||||
t.rd_cycle = gpmc_round_ns_to_ticks(gpmc_t->rd_cycle);
|
||||
|
||||
/* Write */
|
||||
t.adv_wr_off = gpmc_round_ns_to_ticks(
|
||||
gpmc_nand_data->gpmc_t->adv_wr_off);
|
||||
t.adv_wr_off = gpmc_round_ns_to_ticks(gpmc_t->adv_wr_off);
|
||||
t.we_on = t.oe_on;
|
||||
if (cpu_is_omap34xx()) {
|
||||
t.wr_data_mux_bus = gpmc_round_ns_to_ticks(
|
||||
gpmc_nand_data->gpmc_t->wr_data_mux_bus);
|
||||
t.wr_access = gpmc_round_ns_to_ticks(
|
||||
gpmc_nand_data->gpmc_t->wr_access);
|
||||
t.wr_data_mux_bus = gpmc_round_ns_to_ticks(gpmc_t->wr_data_mux_bus);
|
||||
t.wr_access = gpmc_round_ns_to_ticks(gpmc_t->wr_access);
|
||||
}
|
||||
t.we_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->we_off);
|
||||
t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_wr_off);
|
||||
t.wr_cycle = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->wr_cycle);
|
||||
t.we_off = gpmc_round_ns_to_ticks(gpmc_t->we_off);
|
||||
t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_t->cs_wr_off);
|
||||
t.wr_cycle = gpmc_round_ns_to_ticks(gpmc_t->wr_cycle);
|
||||
|
||||
/* Configure GPMC */
|
||||
if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
|
||||
@@ -91,7 +89,29 @@ static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
|
||||
static bool __init gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
|
||||
{
|
||||
/* support only OMAP3 class */
|
||||
if (!cpu_is_omap34xx()) {
|
||||
pr_err("BCH ecc is not supported on this CPU\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
|
||||
* Other chips may be added if confirmed to work.
|
||||
*/
|
||||
if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW) &&
|
||||
(!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
|
||||
pr_err("BCH 4-bit mode is not supported on this CPU\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
|
||||
struct gpmc_timings *gpmc_t)
|
||||
{
|
||||
int err = 0;
|
||||
struct device *dev = &gpmc_nand_device.dev;
|
||||
@@ -112,11 +132,13 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
|
||||
gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
|
||||
gpmc_nand_resource[2].start =
|
||||
gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
|
||||
/* Set timings in GPMC */
|
||||
err = omap2_nand_gpmc_retime(gpmc_nand_data);
|
||||
if (err < 0) {
|
||||
dev_err(dev, "Unable to set gpmc timings: %d\n", err);
|
||||
return err;
|
||||
|
||||
if (gpmc_t) {
|
||||
err = omap2_nand_gpmc_retime(gpmc_nand_data, gpmc_t);
|
||||
if (err < 0) {
|
||||
dev_err(dev, "Unable to set gpmc timings: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable RD PIN Monitoring Reg */
|
||||
@@ -126,6 +148,9 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
|
||||
|
||||
gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
|
||||
|
||||
if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt))
|
||||
return -EINVAL;
|
||||
|
||||
err = platform_device_register(&gpmc_nand_device);
|
||||
if (err < 0) {
|
||||
dev_err(dev, "Unable to register NAND device\n");
|
||||
|
27
arch/arm/mach-omap2/gpmc-nand.h
Normal file
27
arch/arm/mach-omap2/gpmc-nand.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* arch/arm/mach-omap2/gpmc-nand.h
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __OMAP2_GPMC_NAND_H
|
||||
#define __OMAP2_GPMC_NAND_H
|
||||
|
||||
#include "gpmc.h"
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_MTD_NAND_OMAP2)
|
||||
extern int gpmc_nand_init(struct omap_nand_platform_data *d,
|
||||
struct gpmc_timings *gpmc_t);
|
||||
#else
|
||||
static inline int gpmc_nand_init(struct omap_nand_platform_data *d,
|
||||
struct gpmc_timings *gpmc_t)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -16,15 +16,25 @@
|
||||
#include <linux/mtd/onenand_regs.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/platform_data/mtd-onenand-omap2.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#include <asm/mach/flash.h>
|
||||
|
||||
#include <plat/gpmc.h>
|
||||
|
||||
#include "gpmc.h"
|
||||
#include "soc.h"
|
||||
#include "gpmc-onenand.h"
|
||||
|
||||
#define ONENAND_IO_SIZE SZ_128K
|
||||
|
||||
#define ONENAND_FLAG_SYNCREAD (1 << 0)
|
||||
#define ONENAND_FLAG_SYNCWRITE (1 << 1)
|
||||
#define ONENAND_FLAG_HF (1 << 2)
|
||||
#define ONENAND_FLAG_VHF (1 << 3)
|
||||
|
||||
static unsigned onenand_flags;
|
||||
static unsigned latency;
|
||||
static int fclk_offset;
|
||||
|
||||
static struct omap_onenand_platform_data *gpmc_onenand_data;
|
||||
|
||||
static struct resource gpmc_onenand_resource = {
|
||||
@@ -38,11 +48,9 @@ static struct platform_device gpmc_onenand_device = {
|
||||
.resource = &gpmc_onenand_resource,
|
||||
};
|
||||
|
||||
static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
|
||||
static struct gpmc_timings omap2_onenand_calc_async_timings(void)
|
||||
{
|
||||
struct gpmc_timings t;
|
||||
u32 reg;
|
||||
int err;
|
||||
|
||||
const int t_cer = 15;
|
||||
const int t_avdp = 12;
|
||||
@@ -55,11 +63,6 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
|
||||
const int t_wpl = 40;
|
||||
const int t_wph = 30;
|
||||
|
||||
/* Ensure sync read and sync write are disabled */
|
||||
reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
|
||||
reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
|
||||
writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
|
||||
|
||||
memset(&t, 0, sizeof(t));
|
||||
t.sync_clk = 0;
|
||||
t.cs_on = 0;
|
||||
@@ -86,25 +89,30 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
|
||||
t.cs_wr_off = t.we_off + gpmc_round_ns_to_ticks(t_wph);
|
||||
t.wr_cycle = t.cs_wr_off + gpmc_round_ns_to_ticks(t_cez);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
static int gpmc_set_async_mode(int cs, struct gpmc_timings *t)
|
||||
{
|
||||
/* Configure GPMC for asynchronous read */
|
||||
gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
|
||||
GPMC_CONFIG1_DEVICESIZE_16 |
|
||||
GPMC_CONFIG1_MUXADDDATA);
|
||||
|
||||
err = gpmc_cs_set_timings(cs, &t);
|
||||
if (err)
|
||||
return err;
|
||||
return gpmc_cs_set_timings(cs, t);
|
||||
}
|
||||
|
||||
static void omap2_onenand_set_async_mode(void __iomem *onenand_base)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
/* Ensure sync read and sync write are disabled */
|
||||
reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
|
||||
reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
|
||||
writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void set_onenand_cfg(void __iomem *onenand_base, int latency,
|
||||
int sync_read, int sync_write, int hf, int vhf)
|
||||
static void set_onenand_cfg(void __iomem *onenand_base)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
@@ -112,19 +120,19 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency,
|
||||
reg &= ~((0x7 << ONENAND_SYS_CFG1_BRL_SHIFT) | (0x7 << 9));
|
||||
reg |= (latency << ONENAND_SYS_CFG1_BRL_SHIFT) |
|
||||
ONENAND_SYS_CFG1_BL_16;
|
||||
if (sync_read)
|
||||
if (onenand_flags & ONENAND_FLAG_SYNCREAD)
|
||||
reg |= ONENAND_SYS_CFG1_SYNC_READ;
|
||||
else
|
||||
reg &= ~ONENAND_SYS_CFG1_SYNC_READ;
|
||||
if (sync_write)
|
||||
if (onenand_flags & ONENAND_FLAG_SYNCWRITE)
|
||||
reg |= ONENAND_SYS_CFG1_SYNC_WRITE;
|
||||
else
|
||||
reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE;
|
||||
if (hf)
|
||||
if (onenand_flags & ONENAND_FLAG_HF)
|
||||
reg |= ONENAND_SYS_CFG1_HF;
|
||||
else
|
||||
reg &= ~ONENAND_SYS_CFG1_HF;
|
||||
if (vhf)
|
||||
if (onenand_flags & ONENAND_FLAG_VHF)
|
||||
reg |= ONENAND_SYS_CFG1_VHF;
|
||||
else
|
||||
reg &= ~ONENAND_SYS_CFG1_VHF;
|
||||
@@ -132,21 +140,10 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency,
|
||||
}
|
||||
|
||||
static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
|
||||
void __iomem *onenand_base, bool *clk_dep)
|
||||
void __iomem *onenand_base)
|
||||
{
|
||||
u16 ver = readw(onenand_base + ONENAND_REG_VERSION_ID);
|
||||
int freq = 0;
|
||||
|
||||
if (cfg->get_freq) {
|
||||
struct onenand_freq_info fi;
|
||||
|
||||
fi.maf_id = readw(onenand_base + ONENAND_REG_MANUFACTURER_ID);
|
||||
fi.dev_id = readw(onenand_base + ONENAND_REG_DEVICE_ID);
|
||||
fi.ver_id = ver;
|
||||
freq = cfg->get_freq(&fi, clk_dep);
|
||||
if (freq)
|
||||
return freq;
|
||||
}
|
||||
int freq;
|
||||
|
||||
switch ((ver >> 4) & 0xf) {
|
||||
case 0:
|
||||
@@ -172,9 +169,9 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
|
||||
return freq;
|
||||
}
|
||||
|
||||
static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
|
||||
void __iomem *onenand_base,
|
||||
int *freq_ptr)
|
||||
static struct gpmc_timings
|
||||
omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,
|
||||
int freq)
|
||||
{
|
||||
struct gpmc_timings t;
|
||||
const int t_cer = 15;
|
||||
@@ -184,29 +181,15 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
|
||||
const int t_wpl = 40;
|
||||
const int t_wph = 30;
|
||||
int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo;
|
||||
int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency;
|
||||
int first_time = 0, hf = 0, vhf = 0, sync_read = 0, sync_write = 0;
|
||||
int err, ticks_cez;
|
||||
int cs = cfg->cs, freq = *freq_ptr;
|
||||
u32 reg;
|
||||
bool clk_dep = false;
|
||||
int div, fclk_offset_ns, gpmc_clk_ns;
|
||||
int ticks_cez;
|
||||
int cs = cfg->cs;
|
||||
|
||||
if (cfg->flags & ONENAND_SYNC_READ) {
|
||||
sync_read = 1;
|
||||
} else if (cfg->flags & ONENAND_SYNC_READWRITE) {
|
||||
sync_read = 1;
|
||||
sync_write = 1;
|
||||
} else
|
||||
return omap2_onenand_set_async_mode(cs, onenand_base);
|
||||
|
||||
if (!freq) {
|
||||
/* Very first call freq is not known */
|
||||
err = omap2_onenand_set_async_mode(cs, onenand_base);
|
||||
if (err)
|
||||
return err;
|
||||
freq = omap2_onenand_get_freq(cfg, onenand_base, &clk_dep);
|
||||
first_time = 1;
|
||||
}
|
||||
if (cfg->flags & ONENAND_SYNC_READ)
|
||||
onenand_flags = ONENAND_FLAG_SYNCREAD;
|
||||
else if (cfg->flags & ONENAND_SYNC_READWRITE)
|
||||
onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE;
|
||||
|
||||
switch (freq) {
|
||||
case 104:
|
||||
@@ -244,44 +227,31 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
|
||||
t_ach = 9;
|
||||
t_aavdh = 7;
|
||||
t_rdyo = 15;
|
||||
sync_write = 0;
|
||||
onenand_flags &= ~ONENAND_FLAG_SYNCWRITE;
|
||||
break;
|
||||
}
|
||||
|
||||
div = gpmc_cs_calc_divider(cs, min_gpmc_clk_period);
|
||||
div = gpmc_calc_divider(min_gpmc_clk_period);
|
||||
gpmc_clk_ns = gpmc_ticks_to_ns(div);
|
||||
if (gpmc_clk_ns < 15) /* >66Mhz */
|
||||
hf = 1;
|
||||
onenand_flags |= ONENAND_FLAG_HF;
|
||||
else
|
||||
onenand_flags &= ~ONENAND_FLAG_HF;
|
||||
if (gpmc_clk_ns < 12) /* >83Mhz */
|
||||
vhf = 1;
|
||||
if (vhf)
|
||||
onenand_flags |= ONENAND_FLAG_VHF;
|
||||
else
|
||||
onenand_flags &= ~ONENAND_FLAG_VHF;
|
||||
if (onenand_flags & ONENAND_FLAG_VHF)
|
||||
latency = 8;
|
||||
else if (hf)
|
||||
else if (onenand_flags & ONENAND_FLAG_HF)
|
||||
latency = 6;
|
||||
else if (gpmc_clk_ns >= 25) /* 40 MHz*/
|
||||
latency = 3;
|
||||
else
|
||||
latency = 4;
|
||||
|
||||
if (clk_dep) {
|
||||
if (gpmc_clk_ns < 12) { /* >83Mhz */
|
||||
t_ces = 3;
|
||||
t_avds = 4;
|
||||
} else if (gpmc_clk_ns < 15) { /* >66Mhz */
|
||||
t_ces = 5;
|
||||
t_avds = 4;
|
||||
} else if (gpmc_clk_ns < 25) { /* >40Mhz */
|
||||
t_ces = 6;
|
||||
t_avds = 5;
|
||||
} else {
|
||||
t_ces = 7;
|
||||
t_avds = 7;
|
||||
}
|
||||
}
|
||||
|
||||
if (first_time)
|
||||
set_onenand_cfg(onenand_base, latency,
|
||||
sync_read, sync_write, hf, vhf);
|
||||
/* Set synchronous read timings */
|
||||
memset(&t, 0, sizeof(t));
|
||||
|
||||
if (div == 1) {
|
||||
reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2);
|
||||
@@ -307,8 +277,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
|
||||
gpmc_cs_write_reg(cs, GPMC_CS_CONFIG4, reg);
|
||||
}
|
||||
|
||||
/* Set synchronous read timings */
|
||||
memset(&t, 0, sizeof(t));
|
||||
t.sync_clk = min_gpmc_clk_period;
|
||||
t.cs_on = 0;
|
||||
t.adv_on = 0;
|
||||
@@ -330,7 +298,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
|
||||
ticks_cez);
|
||||
|
||||
/* Write */
|
||||
if (sync_write) {
|
||||
if (onenand_flags & ONENAND_FLAG_SYNCWRITE) {
|
||||
t.adv_wr_off = t.adv_rd_off;
|
||||
t.we_on = 0;
|
||||
t.we_off = t.cs_rd_off;
|
||||
@@ -355,6 +323,14 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
|
||||
}
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
static int gpmc_set_sync_mode(int cs, struct gpmc_timings *t)
|
||||
{
|
||||
unsigned sync_read = onenand_flags & ONENAND_FLAG_SYNCREAD;
|
||||
unsigned sync_write = onenand_flags & ONENAND_FLAG_SYNCWRITE;
|
||||
|
||||
/* Configure GPMC for synchronous read */
|
||||
gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
|
||||
GPMC_CONFIG1_WRAPBURST_SUPP |
|
||||
@@ -371,11 +347,45 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
|
||||
GPMC_CONFIG1_DEVICETYPE_NOR |
|
||||
GPMC_CONFIG1_MUXADDDATA);
|
||||
|
||||
err = gpmc_cs_set_timings(cs, &t);
|
||||
if (err)
|
||||
return err;
|
||||
return gpmc_cs_set_timings(cs, t);
|
||||
}
|
||||
|
||||
set_onenand_cfg(onenand_base, latency, sync_read, sync_write, hf, vhf);
|
||||
static int omap2_onenand_setup_async(void __iomem *onenand_base)
|
||||
{
|
||||
struct gpmc_timings t;
|
||||
int ret;
|
||||
|
||||
omap2_onenand_set_async_mode(onenand_base);
|
||||
|
||||
t = omap2_onenand_calc_async_timings();
|
||||
|
||||
ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t);
|
||||
if (IS_ERR_VALUE(ret))
|
||||
return ret;
|
||||
|
||||
omap2_onenand_set_async_mode(onenand_base);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
|
||||
{
|
||||
int ret, freq = *freq_ptr;
|
||||
struct gpmc_timings t;
|
||||
|
||||
if (!freq) {
|
||||
/* Very first call freq is not known */
|
||||
freq = omap2_onenand_get_freq(gpmc_onenand_data, onenand_base);
|
||||
set_onenand_cfg(onenand_base);
|
||||
}
|
||||
|
||||
t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq);
|
||||
|
||||
ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t);
|
||||
if (IS_ERR_VALUE(ret))
|
||||
return ret;
|
||||
|
||||
set_onenand_cfg(onenand_base);
|
||||
|
||||
*freq_ptr = freq;
|
||||
|
||||
@@ -385,15 +395,22 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
|
||||
static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr)
|
||||
{
|
||||
struct device *dev = &gpmc_onenand_device.dev;
|
||||
unsigned l = ONENAND_SYNC_READ | ONENAND_SYNC_READWRITE;
|
||||
int ret;
|
||||
|
||||
/* Set sync timings in GPMC */
|
||||
if (omap2_onenand_set_sync_mode(gpmc_onenand_data, onenand_base,
|
||||
freq_ptr) < 0) {
|
||||
dev_err(dev, "Unable to set synchronous mode\n");
|
||||
return -EINVAL;
|
||||
ret = omap2_onenand_setup_async(onenand_base);
|
||||
if (ret) {
|
||||
dev_err(dev, "unable to set to async mode\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (!(gpmc_onenand_data->flags & l))
|
||||
return 0;
|
||||
|
||||
ret = omap2_onenand_setup_sync(onenand_base, freq_ptr);
|
||||
if (ret)
|
||||
dev_err(dev, "unable to set to sync mode\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
|
||||
@@ -411,6 +428,11 @@ void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
|
||||
gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
|
||||
}
|
||||
|
||||
if (cpu_is_omap34xx())
|
||||
gpmc_onenand_data->flags |= ONENAND_IN_OMAP34XX;
|
||||
else
|
||||
gpmc_onenand_data->flags &= ~ONENAND_IN_OMAP34XX;
|
||||
|
||||
err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE,
|
||||
(unsigned long *)&gpmc_onenand_resource.start);
|
||||
if (err < 0) {
|
||||
|
24
arch/arm/mach-omap2/gpmc-onenand.h
Normal file
24
arch/arm/mach-omap2/gpmc-onenand.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* arch/arm/mach-omap2/gpmc-onenand.h
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __OMAP2_GPMC_ONENAND_H
|
||||
#define __OMAP2_GPMC_ONENAND_H
|
||||
|
||||
#include <linux/platform_data/mtd-onenand-omap2.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2)
|
||||
extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
|
||||
#else
|
||||
#define board_onenand_data NULL
|
||||
static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -17,7 +17,7 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/smc91x.h>
|
||||
|
||||
#include <plat/gpmc.h>
|
||||
#include "gpmc.h"
|
||||
#include "gpmc-smc91x.h"
|
||||
|
||||
#include "soc.h"
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/smsc911x.h>
|
||||
|
||||
#include <plat/gpmc.h>
|
||||
#include "gpmc.h"
|
||||
#include "gpmc-smsc911x.h"
|
||||
|
||||
static struct resource gpmc_smsc911x_resources[] = {
|
||||
|
@@ -26,16 +26,14 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/gpmc.h>
|
||||
#include <plat/sdrc.h>
|
||||
#include <plat/omap_device.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include "soc.h"
|
||||
#include "common.h"
|
||||
#include "omap_device.h"
|
||||
#include "gpmc.h"
|
||||
|
||||
#define DEVICE_NAME "omap-gpmc"
|
||||
|
||||
@@ -59,6 +57,9 @@
|
||||
#define GPMC_ECC_SIZE_CONFIG 0x1fc
|
||||
#define GPMC_ECC1_RESULT 0x200
|
||||
#define GPMC_ECC_BCH_RESULT_0 0x240 /* not available on OMAP2 */
|
||||
#define GPMC_ECC_BCH_RESULT_1 0x244 /* not available on OMAP2 */
|
||||
#define GPMC_ECC_BCH_RESULT_2 0x248 /* not available on OMAP2 */
|
||||
#define GPMC_ECC_BCH_RESULT_3 0x24c /* not available on OMAP2 */
|
||||
|
||||
/* GPMC ECC control settings */
|
||||
#define GPMC_ECC_CTRL_ECCCLEAR 0x100
|
||||
@@ -75,6 +76,7 @@
|
||||
|
||||
#define GPMC_CS0_OFFSET 0x60
|
||||
#define GPMC_CS_SIZE 0x30
|
||||
#define GPMC_BCH_SIZE 0x10
|
||||
|
||||
#define GPMC_MEM_START 0x00000000
|
||||
#define GPMC_MEM_END 0x3FFFFFFF
|
||||
@@ -137,7 +139,6 @@ static struct resource gpmc_mem_root;
|
||||
static struct resource gpmc_cs_mem[GPMC_CS_NUM];
|
||||
static DEFINE_SPINLOCK(gpmc_mem_lock);
|
||||
static unsigned int gpmc_cs_map; /* flag for cs which are initialized */
|
||||
static int gpmc_ecc_used = -EINVAL; /* cs using ecc engine */
|
||||
static struct device *gpmc_dev;
|
||||
static int gpmc_irq;
|
||||
static resource_size_t phys_base, mem_size;
|
||||
@@ -158,22 +159,6 @@ static u32 gpmc_read_reg(int idx)
|
||||
return __raw_readl(gpmc_base + idx);
|
||||
}
|
||||
|
||||
static void gpmc_cs_write_byte(int cs, int idx, u8 val)
|
||||
{
|
||||
void __iomem *reg_addr;
|
||||
|
||||
reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
|
||||
__raw_writeb(val, reg_addr);
|
||||
}
|
||||
|
||||
static u8 gpmc_cs_read_byte(int cs, int idx)
|
||||
{
|
||||
void __iomem *reg_addr;
|
||||
|
||||
reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
|
||||
return __raw_readb(reg_addr);
|
||||
}
|
||||
|
||||
void gpmc_cs_write_reg(int cs, int idx, u32 val)
|
||||
{
|
||||
void __iomem *reg_addr;
|
||||
@@ -288,7 +273,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
|
||||
return -1
|
||||
#endif
|
||||
|
||||
int gpmc_cs_calc_divider(int cs, unsigned int sync_clk)
|
||||
int gpmc_calc_divider(unsigned int sync_clk)
|
||||
{
|
||||
int div;
|
||||
u32 l;
|
||||
@@ -308,7 +293,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
|
||||
int div;
|
||||
u32 l;
|
||||
|
||||
div = gpmc_cs_calc_divider(cs, t->sync_clk);
|
||||
div = gpmc_calc_divider(t->sync_clk);
|
||||
if (div < 0)
|
||||
return div;
|
||||
|
||||
@@ -508,44 +493,6 @@ void gpmc_cs_free(int cs)
|
||||
}
|
||||
EXPORT_SYMBOL(gpmc_cs_free);
|
||||
|
||||
/**
|
||||
* gpmc_read_status - read access request to get the different gpmc status
|
||||
* @cmd: command type
|
||||
* @return status
|
||||
*/
|
||||
int gpmc_read_status(int cmd)
|
||||
{
|
||||
int status = -EINVAL;
|
||||
u32 regval = 0;
|
||||
|
||||
switch (cmd) {
|
||||
case GPMC_GET_IRQ_STATUS:
|
||||
status = gpmc_read_reg(GPMC_IRQSTATUS);
|
||||
break;
|
||||
|
||||
case GPMC_PREFETCH_FIFO_CNT:
|
||||
regval = gpmc_read_reg(GPMC_PREFETCH_STATUS);
|
||||
status = GPMC_PREFETCH_STATUS_FIFO_CNT(regval);
|
||||
break;
|
||||
|
||||
case GPMC_PREFETCH_COUNT:
|
||||
regval = gpmc_read_reg(GPMC_PREFETCH_STATUS);
|
||||
status = GPMC_PREFETCH_STATUS_COUNT(regval);
|
||||
break;
|
||||
|
||||
case GPMC_STATUS_BUFFER:
|
||||
regval = gpmc_read_reg(GPMC_STATUS);
|
||||
/* 1 : buffer is available to write */
|
||||
status = regval & GPMC_STATUS_BUFF_EMPTY;
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(KERN_ERR "gpmc_read_status: Not supported\n");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
EXPORT_SYMBOL(gpmc_read_status);
|
||||
|
||||
/**
|
||||
* gpmc_cs_configure - write request to configure gpmc
|
||||
* @cs: chip select number
|
||||
@@ -614,121 +561,10 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
|
||||
}
|
||||
EXPORT_SYMBOL(gpmc_cs_configure);
|
||||
|
||||
/**
|
||||
* gpmc_nand_read - nand specific read access request
|
||||
* @cs: chip select number
|
||||
* @cmd: command type
|
||||
*/
|
||||
int gpmc_nand_read(int cs, int cmd)
|
||||
{
|
||||
int rval = -EINVAL;
|
||||
|
||||
switch (cmd) {
|
||||
case GPMC_NAND_DATA:
|
||||
rval = gpmc_cs_read_byte(cs, GPMC_CS_NAND_DATA);
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(KERN_ERR "gpmc_read_nand_ctrl: Not supported\n");
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
EXPORT_SYMBOL(gpmc_nand_read);
|
||||
|
||||
/**
|
||||
* gpmc_nand_write - nand specific write request
|
||||
* @cs: chip select number
|
||||
* @cmd: command type
|
||||
* @wval: value to write
|
||||
*/
|
||||
int gpmc_nand_write(int cs, int cmd, int wval)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
switch (cmd) {
|
||||
case GPMC_NAND_COMMAND:
|
||||
gpmc_cs_write_byte(cs, GPMC_CS_NAND_COMMAND, wval);
|
||||
break;
|
||||
|
||||
case GPMC_NAND_ADDRESS:
|
||||
gpmc_cs_write_byte(cs, GPMC_CS_NAND_ADDRESS, wval);
|
||||
break;
|
||||
|
||||
case GPMC_NAND_DATA:
|
||||
gpmc_cs_write_byte(cs, GPMC_CS_NAND_DATA, wval);
|
||||
|
||||
default:
|
||||
printk(KERN_ERR "gpmc_write_nand_ctrl: Not supported\n");
|
||||
err = -EINVAL;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(gpmc_nand_write);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gpmc_prefetch_enable - configures and starts prefetch transfer
|
||||
* @cs: cs (chip select) number
|
||||
* @fifo_th: fifo threshold to be used for read/ write
|
||||
* @dma_mode: dma mode enable (1) or disable (0)
|
||||
* @u32_count: number of bytes to be transferred
|
||||
* @is_write: prefetch read(0) or write post(1) mode
|
||||
*/
|
||||
int gpmc_prefetch_enable(int cs, int fifo_th, int dma_mode,
|
||||
unsigned int u32_count, int is_write)
|
||||
{
|
||||
|
||||
if (fifo_th > PREFETCH_FIFOTHRESHOLD_MAX) {
|
||||
pr_err("gpmc: fifo threshold is not supported\n");
|
||||
return -1;
|
||||
} else if (!(gpmc_read_reg(GPMC_PREFETCH_CONTROL))) {
|
||||
/* Set the amount of bytes to be prefetched */
|
||||
gpmc_write_reg(GPMC_PREFETCH_CONFIG2, u32_count);
|
||||
|
||||
/* Set dma/mpu mode, the prefetch read / post write and
|
||||
* enable the engine. Set which cs is has requested for.
|
||||
*/
|
||||
gpmc_write_reg(GPMC_PREFETCH_CONFIG1, ((cs << CS_NUM_SHIFT) |
|
||||
PREFETCH_FIFOTHRESHOLD(fifo_th) |
|
||||
ENABLE_PREFETCH |
|
||||
(dma_mode << DMA_MPU_MODE) |
|
||||
(0x1 & is_write)));
|
||||
|
||||
/* Start the prefetch engine */
|
||||
gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x1);
|
||||
} else {
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(gpmc_prefetch_enable);
|
||||
|
||||
/**
|
||||
* gpmc_prefetch_reset - disables and stops the prefetch engine
|
||||
*/
|
||||
int gpmc_prefetch_reset(int cs)
|
||||
{
|
||||
u32 config1;
|
||||
|
||||
/* check if the same module/cs is trying to reset */
|
||||
config1 = gpmc_read_reg(GPMC_PREFETCH_CONFIG1);
|
||||
if (((config1 >> CS_NUM_SHIFT) & 0x7) != cs)
|
||||
return -EINVAL;
|
||||
|
||||
/* Stop the PFPW engine */
|
||||
gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x0);
|
||||
|
||||
/* Reset/disable the PFPW engine */
|
||||
gpmc_write_reg(GPMC_PREFETCH_CONFIG1, 0x0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(gpmc_prefetch_reset);
|
||||
|
||||
void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
|
||||
{
|
||||
int i;
|
||||
|
||||
reg->gpmc_status = gpmc_base + GPMC_STATUS;
|
||||
reg->gpmc_nand_command = gpmc_base + GPMC_CS0_OFFSET +
|
||||
GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs;
|
||||
@@ -744,7 +580,17 @@ void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
|
||||
reg->gpmc_ecc_control = gpmc_base + GPMC_ECC_CONTROL;
|
||||
reg->gpmc_ecc_size_config = gpmc_base + GPMC_ECC_SIZE_CONFIG;
|
||||
reg->gpmc_ecc1_result = gpmc_base + GPMC_ECC1_RESULT;
|
||||
reg->gpmc_bch_result0 = gpmc_base + GPMC_ECC_BCH_RESULT_0;
|
||||
|
||||
for (i = 0; i < GPMC_BCH_NUM_REMAINDER; i++) {
|
||||
reg->gpmc_bch_result0[i] = gpmc_base + GPMC_ECC_BCH_RESULT_0 +
|
||||
GPMC_BCH_SIZE * i;
|
||||
reg->gpmc_bch_result1[i] = gpmc_base + GPMC_ECC_BCH_RESULT_1 +
|
||||
GPMC_BCH_SIZE * i;
|
||||
reg->gpmc_bch_result2[i] = gpmc_base + GPMC_ECC_BCH_RESULT_2 +
|
||||
GPMC_BCH_SIZE * i;
|
||||
reg->gpmc_bch_result3[i] = gpmc_base + GPMC_ECC_BCH_RESULT_3 +
|
||||
GPMC_BCH_SIZE * i;
|
||||
}
|
||||
}
|
||||
|
||||
int gpmc_get_client_irq(unsigned irq_config)
|
||||
@@ -1093,267 +939,3 @@ void omap3_gpmc_restore_context(void)
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_ARCH_OMAP3 */
|
||||
|
||||
/**
|
||||
* gpmc_enable_hwecc - enable hardware ecc functionality
|
||||
* @cs: chip select number
|
||||
* @mode: read/write mode
|
||||
* @dev_width: device bus width(1 for x16, 0 for x8)
|
||||
* @ecc_size: bytes for which ECC will be generated
|
||||
*/
|
||||
int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size)
|
||||
{
|
||||
unsigned int val;
|
||||
|
||||
/* check if ecc module is in used */
|
||||
if (gpmc_ecc_used != -EINVAL)
|
||||
return -EINVAL;
|
||||
|
||||
gpmc_ecc_used = cs;
|
||||
|
||||
/* clear ecc and enable bits */
|
||||
gpmc_write_reg(GPMC_ECC_CONTROL,
|
||||
GPMC_ECC_CTRL_ECCCLEAR |
|
||||
GPMC_ECC_CTRL_ECCREG1);
|
||||
|
||||
/* program ecc and result sizes */
|
||||
val = ((((ecc_size >> 1) - 1) << 22) | (0x0000000F));
|
||||
gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, val);
|
||||
|
||||
switch (mode) {
|
||||
case GPMC_ECC_READ:
|
||||
case GPMC_ECC_WRITE:
|
||||
gpmc_write_reg(GPMC_ECC_CONTROL,
|
||||
GPMC_ECC_CTRL_ECCCLEAR |
|
||||
GPMC_ECC_CTRL_ECCREG1);
|
||||
break;
|
||||
case GPMC_ECC_READSYN:
|
||||
gpmc_write_reg(GPMC_ECC_CONTROL,
|
||||
GPMC_ECC_CTRL_ECCCLEAR |
|
||||
GPMC_ECC_CTRL_ECCDISABLE);
|
||||
break;
|
||||
default:
|
||||
printk(KERN_INFO "Error: Unrecognized Mode[%d]!\n", mode);
|
||||
break;
|
||||
}
|
||||
|
||||
/* (ECC 16 or 8 bit col) | ( CS ) | ECC Enable */
|
||||
val = (dev_width << 7) | (cs << 1) | (0x1);
|
||||
gpmc_write_reg(GPMC_ECC_CONFIG, val);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpmc_enable_hwecc);
|
||||
|
||||
/**
|
||||
* gpmc_calculate_ecc - generate non-inverted ecc bytes
|
||||
* @cs: chip select number
|
||||
* @dat: data pointer over which ecc is computed
|
||||
* @ecc_code: ecc code buffer
|
||||
*
|
||||
* Using non-inverted ECC is considered ugly since writing a blank
|
||||
* page (padding) will clear the ECC bytes. This is not a problem as long
|
||||
* no one is trying to write data on the seemingly unused page. Reading
|
||||
* an erased page will produce an ECC mismatch between generated and read
|
||||
* ECC bytes that has to be dealt with separately.
|
||||
*/
|
||||
int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code)
|
||||
{
|
||||
unsigned int val = 0x0;
|
||||
|
||||
if (gpmc_ecc_used != cs)
|
||||
return -EINVAL;
|
||||
|
||||
/* read ecc result */
|
||||
val = gpmc_read_reg(GPMC_ECC1_RESULT);
|
||||
*ecc_code++ = val; /* P128e, ..., P1e */
|
||||
*ecc_code++ = val >> 16; /* P128o, ..., P1o */
|
||||
/* P2048o, P1024o, P512o, P256o, P2048e, P1024e, P512e, P256e */
|
||||
*ecc_code++ = ((val >> 8) & 0x0f) | ((val >> 20) & 0xf0);
|
||||
|
||||
gpmc_ecc_used = -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpmc_calculate_ecc);
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP3
|
||||
|
||||
/**
|
||||
* gpmc_init_hwecc_bch - initialize hardware BCH ecc functionality
|
||||
* @cs: chip select number
|
||||
* @nsectors: how many 512-byte sectors to process
|
||||
* @nerrors: how many errors to correct per sector (4 or 8)
|
||||
*
|
||||
* This function must be executed before any call to gpmc_enable_hwecc_bch.
|
||||
*/
|
||||
int gpmc_init_hwecc_bch(int cs, int nsectors, int nerrors)
|
||||
{
|
||||
/* check if ecc module is in use */
|
||||
if (gpmc_ecc_used != -EINVAL)
|
||||
return -EINVAL;
|
||||
|
||||
/* support only OMAP3 class */
|
||||
if (!cpu_is_omap34xx()) {
|
||||
printk(KERN_ERR "BCH ecc is not supported on this CPU\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
|
||||
* Other chips may be added if confirmed to work.
|
||||
*/
|
||||
if ((nerrors == 4) &&
|
||||
(!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
|
||||
printk(KERN_ERR "BCH 4-bit mode is not supported on this CPU\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* sanity check */
|
||||
if (nsectors > 8) {
|
||||
printk(KERN_ERR "BCH cannot process %d sectors (max is 8)\n",
|
||||
nsectors);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpmc_init_hwecc_bch);
|
||||
|
||||
/**
|
||||
* gpmc_enable_hwecc_bch - enable hardware BCH ecc functionality
|
||||
* @cs: chip select number
|
||||
* @mode: read/write mode
|
||||
* @dev_width: device bus width(1 for x16, 0 for x8)
|
||||
* @nsectors: how many 512-byte sectors to process
|
||||
* @nerrors: how many errors to correct per sector (4 or 8)
|
||||
*/
|
||||
int gpmc_enable_hwecc_bch(int cs, int mode, int dev_width, int nsectors,
|
||||
int nerrors)
|
||||
{
|
||||
unsigned int val;
|
||||
|
||||
/* check if ecc module is in use */
|
||||
if (gpmc_ecc_used != -EINVAL)
|
||||
return -EINVAL;
|
||||
|
||||
gpmc_ecc_used = cs;
|
||||
|
||||
/* clear ecc and enable bits */
|
||||
gpmc_write_reg(GPMC_ECC_CONTROL, 0x1);
|
||||
|
||||
/*
|
||||
* When using BCH, sector size is hardcoded to 512 bytes.
|
||||
* Here we are using wrapping mode 6 both for reading and writing, with:
|
||||
* size0 = 0 (no additional protected byte in spare area)
|
||||
* size1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)
|
||||
*/
|
||||
gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, (32 << 22) | (0 << 12));
|
||||
|
||||
/* BCH configuration */
|
||||
val = ((1 << 16) | /* enable BCH */
|
||||
(((nerrors == 8) ? 1 : 0) << 12) | /* 8 or 4 bits */
|
||||
(0x06 << 8) | /* wrap mode = 6 */
|
||||
(dev_width << 7) | /* bus width */
|
||||
(((nsectors-1) & 0x7) << 4) | /* number of sectors */
|
||||
(cs << 1) | /* ECC CS */
|
||||
(0x1)); /* enable ECC */
|
||||
|
||||
gpmc_write_reg(GPMC_ECC_CONFIG, val);
|
||||
gpmc_write_reg(GPMC_ECC_CONTROL, 0x101);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpmc_enable_hwecc_bch);
|
||||
|
||||
/**
|
||||
* gpmc_calculate_ecc_bch4 - Generate 7 ecc bytes per sector of 512 data bytes
|
||||
* @cs: chip select number
|
||||
* @dat: The pointer to data on which ecc is computed
|
||||
* @ecc: The ecc output buffer
|
||||
*/
|
||||
int gpmc_calculate_ecc_bch4(int cs, const u_char *dat, u_char *ecc)
|
||||
{
|
||||
int i;
|
||||
unsigned long nsectors, reg, val1, val2;
|
||||
|
||||
if (gpmc_ecc_used != cs)
|
||||
return -EINVAL;
|
||||
|
||||
nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
|
||||
|
||||
for (i = 0; i < nsectors; i++) {
|
||||
|
||||
reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
|
||||
|
||||
/* Read hw-computed remainder */
|
||||
val1 = gpmc_read_reg(reg + 0);
|
||||
val2 = gpmc_read_reg(reg + 4);
|
||||
|
||||
/*
|
||||
* Add constant polynomial to remainder, in order to get an ecc
|
||||
* sequence of 0xFFs for a buffer filled with 0xFFs; and
|
||||
* left-justify the resulting polynomial.
|
||||
*/
|
||||
*ecc++ = 0x28 ^ ((val2 >> 12) & 0xFF);
|
||||
*ecc++ = 0x13 ^ ((val2 >> 4) & 0xFF);
|
||||
*ecc++ = 0xcc ^ (((val2 & 0xF) << 4)|((val1 >> 28) & 0xF));
|
||||
*ecc++ = 0x39 ^ ((val1 >> 20) & 0xFF);
|
||||
*ecc++ = 0x96 ^ ((val1 >> 12) & 0xFF);
|
||||
*ecc++ = 0xac ^ ((val1 >> 4) & 0xFF);
|
||||
*ecc++ = 0x7f ^ ((val1 & 0xF) << 4);
|
||||
}
|
||||
|
||||
gpmc_ecc_used = -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch4);
|
||||
|
||||
/**
|
||||
* gpmc_calculate_ecc_bch8 - Generate 13 ecc bytes per block of 512 data bytes
|
||||
* @cs: chip select number
|
||||
* @dat: The pointer to data on which ecc is computed
|
||||
* @ecc: The ecc output buffer
|
||||
*/
|
||||
int gpmc_calculate_ecc_bch8(int cs, const u_char *dat, u_char *ecc)
|
||||
{
|
||||
int i;
|
||||
unsigned long nsectors, reg, val1, val2, val3, val4;
|
||||
|
||||
if (gpmc_ecc_used != cs)
|
||||
return -EINVAL;
|
||||
|
||||
nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
|
||||
|
||||
for (i = 0; i < nsectors; i++) {
|
||||
|
||||
reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
|
||||
|
||||
/* Read hw-computed remainder */
|
||||
val1 = gpmc_read_reg(reg + 0);
|
||||
val2 = gpmc_read_reg(reg + 4);
|
||||
val3 = gpmc_read_reg(reg + 8);
|
||||
val4 = gpmc_read_reg(reg + 12);
|
||||
|
||||
/*
|
||||
* Add constant polynomial to remainder, in order to get an ecc
|
||||
* sequence of 0xFFs for a buffer filled with 0xFFs.
|
||||
*/
|
||||
*ecc++ = 0xef ^ (val4 & 0xFF);
|
||||
*ecc++ = 0x51 ^ ((val3 >> 24) & 0xFF);
|
||||
*ecc++ = 0x2e ^ ((val3 >> 16) & 0xFF);
|
||||
*ecc++ = 0x09 ^ ((val3 >> 8) & 0xFF);
|
||||
*ecc++ = 0xed ^ (val3 & 0xFF);
|
||||
*ecc++ = 0x93 ^ ((val2 >> 24) & 0xFF);
|
||||
*ecc++ = 0x9a ^ ((val2 >> 16) & 0xFF);
|
||||
*ecc++ = 0xc2 ^ ((val2 >> 8) & 0xFF);
|
||||
*ecc++ = 0x97 ^ (val2 & 0xFF);
|
||||
*ecc++ = 0x79 ^ ((val1 >> 24) & 0xFF);
|
||||
*ecc++ = 0xe5 ^ ((val1 >> 16) & 0xFF);
|
||||
*ecc++ = 0x24 ^ ((val1 >> 8) & 0xFF);
|
||||
*ecc++ = 0xb5 ^ (val1 & 0xFF);
|
||||
}
|
||||
|
||||
gpmc_ecc_used = -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch8);
|
||||
|
||||
#endif /* CONFIG_ARCH_OMAP3 */
|
||||
|
135
arch/arm/mach-omap2/gpmc.h
Normal file
135
arch/arm/mach-omap2/gpmc.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* General-Purpose Memory Controller for OMAP2
|
||||
*
|
||||
* Copyright (C) 2005-2006 Nokia Corporation
|
||||
*
|
||||
* 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
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __OMAP2_GPMC_H
|
||||
#define __OMAP2_GPMC_H
|
||||
|
||||
#include <linux/platform_data/mtd-nand-omap2.h>
|
||||
|
||||
/* Maximum Number of Chip Selects */
|
||||
#define GPMC_CS_NUM 8
|
||||
|
||||
#define GPMC_CS_CONFIG1 0x00
|
||||
#define GPMC_CS_CONFIG2 0x04
|
||||
#define GPMC_CS_CONFIG3 0x08
|
||||
#define GPMC_CS_CONFIG4 0x0c
|
||||
#define GPMC_CS_CONFIG5 0x10
|
||||
#define GPMC_CS_CONFIG6 0x14
|
||||
#define GPMC_CS_CONFIG7 0x18
|
||||
#define GPMC_CS_NAND_COMMAND 0x1c
|
||||
#define GPMC_CS_NAND_ADDRESS 0x20
|
||||
#define GPMC_CS_NAND_DATA 0x24
|
||||
|
||||
/* Control Commands */
|
||||
#define GPMC_CONFIG_RDY_BSY 0x00000001
|
||||
#define GPMC_CONFIG_DEV_SIZE 0x00000002
|
||||
#define GPMC_CONFIG_DEV_TYPE 0x00000003
|
||||
#define GPMC_SET_IRQ_STATUS 0x00000004
|
||||
#define GPMC_CONFIG_WP 0x00000005
|
||||
|
||||
#define GPMC_ENABLE_IRQ 0x0000000d
|
||||
|
||||
/* ECC commands */
|
||||
#define GPMC_ECC_READ 0 /* Reset Hardware ECC for read */
|
||||
#define GPMC_ECC_WRITE 1 /* Reset Hardware ECC for write */
|
||||
#define GPMC_ECC_READSYN 2 /* Reset before syndrom is read back */
|
||||
|
||||
#define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31)
|
||||
#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30)
|
||||
#define GPMC_CONFIG1_READTYPE_ASYNC (0 << 29)
|
||||
#define GPMC_CONFIG1_READTYPE_SYNC (1 << 29)
|
||||
#define GPMC_CONFIG1_WRITEMULTIPLE_SUPP (1 << 28)
|
||||
#define GPMC_CONFIG1_WRITETYPE_ASYNC (0 << 27)
|
||||
#define GPMC_CONFIG1_WRITETYPE_SYNC (1 << 27)
|
||||
#define GPMC_CONFIG1_CLKACTIVATIONTIME(val) ((val & 3) << 25)
|
||||
#define GPMC_CONFIG1_PAGE_LEN(val) ((val & 3) << 23)
|
||||
#define GPMC_CONFIG1_WAIT_READ_MON (1 << 22)
|
||||
#define GPMC_CONFIG1_WAIT_WRITE_MON (1 << 21)
|
||||
#define GPMC_CONFIG1_WAIT_MON_IIME(val) ((val & 3) << 18)
|
||||
#define GPMC_CONFIG1_WAIT_PIN_SEL(val) ((val & 3) << 16)
|
||||
#define GPMC_CONFIG1_DEVICESIZE(val) ((val & 3) << 12)
|
||||
#define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1)
|
||||
#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10)
|
||||
#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0)
|
||||
#define GPMC_CONFIG1_MUXADDDATA (1 << 9)
|
||||
#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4)
|
||||
#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3)
|
||||
#define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1))
|
||||
#define GPMC_CONFIG1_FCLK_DIV3 (GPMC_CONFIG1_FCLK_DIV(2))
|
||||
#define GPMC_CONFIG1_FCLK_DIV4 (GPMC_CONFIG1_FCLK_DIV(3))
|
||||
#define GPMC_CONFIG7_CSVALID (1 << 6)
|
||||
|
||||
#define GPMC_DEVICETYPE_NOR 0
|
||||
#define GPMC_DEVICETYPE_NAND 2
|
||||
#define GPMC_CONFIG_WRITEPROTECT 0x00000010
|
||||
#define WR_RD_PIN_MONITORING 0x00600000
|
||||
#define GPMC_IRQ_FIFOEVENTENABLE 0x01
|
||||
#define GPMC_IRQ_COUNT_EVENT 0x02
|
||||
|
||||
|
||||
/*
|
||||
* Note that all values in this struct are in nanoseconds except sync_clk
|
||||
* (which is in picoseconds), while the register values are in gpmc_fck cycles.
|
||||
*/
|
||||
struct gpmc_timings {
|
||||
/* Minimum clock period for synchronous mode (in picoseconds) */
|
||||
u32 sync_clk;
|
||||
|
||||
/* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */
|
||||
u16 cs_on; /* Assertion time */
|
||||
u16 cs_rd_off; /* Read deassertion time */
|
||||
u16 cs_wr_off; /* Write deassertion time */
|
||||
|
||||
/* ADV signal timings corresponding to GPMC_CONFIG3 */
|
||||
u16 adv_on; /* Assertion time */
|
||||
u16 adv_rd_off; /* Read deassertion time */
|
||||
u16 adv_wr_off; /* Write deassertion time */
|
||||
|
||||
/* WE signals timings corresponding to GPMC_CONFIG4 */
|
||||
u16 we_on; /* WE assertion time */
|
||||
u16 we_off; /* WE deassertion time */
|
||||
|
||||
/* OE signals timings corresponding to GPMC_CONFIG4 */
|
||||
u16 oe_on; /* OE assertion time */
|
||||
u16 oe_off; /* OE deassertion time */
|
||||
|
||||
/* Access time and cycle time timings corresponding to GPMC_CONFIG5 */
|
||||
u16 page_burst_access; /* Multiple access word delay */
|
||||
u16 access; /* Start-cycle to first data valid delay */
|
||||
u16 rd_cycle; /* Total read cycle time */
|
||||
u16 wr_cycle; /* Total write cycle time */
|
||||
|
||||
/* The following are only on OMAP3430 */
|
||||
u16 wr_access; /* WRACCESSTIME */
|
||||
u16 wr_data_mux_bus; /* WRDATAONADMUXBUS */
|
||||
};
|
||||
|
||||
extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
|
||||
extern int gpmc_get_client_irq(unsigned irq_config);
|
||||
|
||||
extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns);
|
||||
extern unsigned int gpmc_ps_to_ticks(unsigned int time_ps);
|
||||
extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);
|
||||
extern unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns);
|
||||
extern unsigned long gpmc_get_fclk_period(void);
|
||||
|
||||
extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
|
||||
extern u32 gpmc_cs_read_reg(int cs, int idx);
|
||||
extern int gpmc_calc_divider(unsigned int sync_clk);
|
||||
extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
|
||||
extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
|
||||
extern void gpmc_cs_free(int cs);
|
||||
extern int gpmc_cs_set_reserved(int cs, int reserved);
|
||||
extern int gpmc_cs_reserved(int cs);
|
||||
extern void omap3_gpmc_save_context(void);
|
||||
extern void omap3_gpmc_restore_context(void);
|
||||
extern int gpmc_cs_configure(int cs, int cmd, int wval);
|
||||
|
||||
#endif
|
@@ -27,8 +27,8 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include <plat/omap_device.h>
|
||||
#include "omap_hwmod.h"
|
||||
#include "omap_device.h"
|
||||
#include "hdq1w.h"
|
||||
|
||||
#include "common.h"
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#ifndef ARCH_ARM_MACH_OMAP2_HDQ1W_H
|
||||
#define ARCH_ARM_MACH_OMAP2_HDQ1W_H
|
||||
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include "omap_hwmod.h"
|
||||
|
||||
/*
|
||||
* XXX A future cleanup patch should modify
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user