diff -Nru pvr-omap4-kernel-0.24.10/debian/changelog pvr-omap4-kernel-0.24.9/debian/changelog --- pvr-omap4-kernel-0.24.10/debian/changelog 2010-11-12 20:36:36.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/debian/changelog 2010-11-12 20:36:36.000000000 +0000 @@ -1,14 +1,8 @@ -pvr-omap4-kernel (0.24.10-2) maverick; urgency=low +pvr-omap4-kernel (0.24.9-2) maverick; urgency=low - * Drop patch hack-add-omapfb-h + * Do not restrict to armel (there is armv7l also) - -- Vincent Stehlé Mon, 18 Oct 2010 15:17:06 +0200 - -pvr-omap4-kernel (0.24.10-1) maverick; urgency=low - - * Update "upstream". - - -- Vincent Stehlé Mon, 18 Oct 2010 15:09:35 +0200 + -- Vincent Stehlé Fri, 12 Nov 2010 20:46:47 +0100 pvr-omap4-kernel (0.24.9-1) maverick; urgency=low diff -Nru pvr-omap4-kernel-0.24.10/debian/patches/0001-hack-add-omapfb-h.patch pvr-omap4-kernel-0.24.9/debian/patches/0001-hack-add-omapfb-h.patch --- pvr-omap4-kernel-0.24.10/debian/patches/0001-hack-add-omapfb-h.patch 1970-01-01 00:00:00.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/debian/patches/0001-hack-add-omapfb-h.patch 2010-11-12 20:36:36.000000000 +0000 @@ -0,0 +1,211 @@ +From: TI OMAP Developers +Date: Mon, 20 Sep 2010 15:09:19 +0200 +Subject: [PATCH] hack-add-omapfb-h + +=================================================================== +--- + .../3rdparty/dc_omapfb3_linux/omaplfb_linux.c | 2 +- + sgx/services4/include/drivers-video-omap2-omapfb.h | 180 ++++++++++++++++++++ + 2 files changed, 181 insertions(+), 1 deletions(-) + create mode 100644 sgx/services4/include/drivers-video-omap2-omapfb.h + +diff --git a/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c b/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c +index f838524..d655530 100755 +--- a/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c ++++ b/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c +@@ -64,7 +64,7 @@ + #define PVR_DEBUG DEBUG + #undef DEBUG + #endif +-#include ++#include "drivers-video-omap2-omapfb.h" + #if defined(DEBUG) + #undef DEBUG + #endif +diff --git a/sgx/services4/include/drivers-video-omap2-omapfb.h b/sgx/services4/include/drivers-video-omap2-omapfb.h +new file mode 100644 +index 0000000..1305fc9 +--- /dev/null ++++ b/sgx/services4/include/drivers-video-omap2-omapfb.h +@@ -0,0 +1,180 @@ ++/* ++ * linux/drivers/video/omap2/omapfb.h ++ * ++ * Copyright (C) 2008 Nokia Corporation ++ * Author: Tomi Valkeinen ++ * ++ * Some code and ideas taken from drivers/video/omap/ driver ++ * by Imre Deak. ++ * ++ * 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. ++ * ++ * 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, see . ++ */ ++ ++#ifndef __DRIVERS_VIDEO_OMAP2_OMAPFB_H__ ++#define __DRIVERS_VIDEO_OMAP2_OMAPFB_H__ ++ ++#ifdef CONFIG_FB_OMAP2_DEBUG_SUPPORT ++#define DEBUG ++#endif ++ ++#include ++ ++#include ++ ++#ifdef DEBUG ++extern unsigned int omapfb_debug; ++#define DBG(format, ...) \ ++ if (omapfb_debug) \ ++ printk(KERN_DEBUG "OMAPFB: " format, ## __VA_ARGS__) ++#else ++#define DBG(format, ...) ++#endif ++ ++#define FB2OFB(fb_info) ((struct omapfb_info *)(fb_info->par)) ++ ++/* max number of overlays to which a framebuffer data can be direct */ ++#define OMAPFB_MAX_OVL_PER_FB 3 ++ ++struct omapfb2_mem_region { ++ int id; ++ u32 paddr; ++ void __iomem *vaddr; ++ struct vrfb vrfb; ++ unsigned long size; ++ u8 type; /* OMAPFB_PLANE_MEM_* */ ++ bool alloc; /* allocated by the driver */ ++ bool map; /* kernel mapped by the driver */ ++ atomic_t map_count; ++ struct rw_semaphore lock; ++ atomic_t lock_count; ++}; ++ ++/* appended to fb_info */ ++struct omapfb_info { ++ int id; ++ struct omapfb2_mem_region *region; ++ int num_overlays; ++ struct omap_overlay *overlays[OMAPFB_MAX_OVL_PER_FB]; ++ struct omapfb2_device *fbdev; ++ enum omap_dss_rotation_type rotation_type; ++ u8 rotation[OMAPFB_MAX_OVL_PER_FB]; ++ bool mirror; ++}; ++ ++struct omapfb2_device { ++ struct device *dev; ++ struct mutex mtx; ++ ++ u32 pseudo_palette[17]; ++ ++ int state; ++ ++ unsigned num_fbs; ++ struct fb_info *fbs[10]; ++ struct omapfb2_mem_region regions[10]; ++ ++ unsigned num_displays; ++ struct omap_dss_device *displays[10]; ++ unsigned num_overlays; ++ struct omap_overlay *overlays[10]; ++ unsigned num_managers; ++ struct omap_overlay_manager *managers[10]; ++ ++ unsigned num_bpp_overrides; ++ struct { ++ struct omap_dss_device *dssdev; ++ u8 bpp; ++ } bpp_overrides[10]; ++}; ++ ++struct omapfb_colormode { ++ enum omap_color_mode dssmode; ++ u32 bits_per_pixel; ++ u32 nonstd; ++ struct fb_bitfield red; ++ struct fb_bitfield green; ++ struct fb_bitfield blue; ++ struct fb_bitfield transp; ++}; ++ ++void set_fb_fix(struct fb_info *fbi); ++int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var); ++int omapfb_realloc_fbmem(struct fb_info *fbi, unsigned long size, int type); ++int omapfb_apply_changes(struct fb_info *fbi, int init); ++ ++int omapfb_create_sysfs(struct omapfb2_device *fbdev); ++void omapfb_remove_sysfs(struct omapfb2_device *fbdev); ++ ++int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg); ++ ++int omapfb_update_window(struct fb_info *fbi, ++ u32 x, u32 y, u32 w, u32 h); ++ ++int dss_mode_to_fb_mode(enum omap_color_mode dssmode, ++ struct fb_var_screeninfo *var); ++ ++int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl, ++ u16 posx, u16 posy, u16 outw, u16 outh); ++ ++/* find the display connected to this fb, if any */ ++static inline struct omap_dss_device *fb2display(struct fb_info *fbi) ++{ ++ struct omapfb_info *ofbi = FB2OFB(fbi); ++ int i; ++ ++ /* XXX: returns the display connected to first attached overlay */ ++ for (i = 0; i < ofbi->num_overlays; i++) { ++ if (ofbi->overlays[i]->manager) ++ return ofbi->overlays[i]->manager->device; ++ } ++ ++ return NULL; ++} ++ ++static inline void omapfb_lock(struct omapfb2_device *fbdev) ++{ ++ mutex_lock(&fbdev->mtx); ++} ++ ++static inline void omapfb_unlock(struct omapfb2_device *fbdev) ++{ ++ mutex_unlock(&fbdev->mtx); ++} ++ ++static inline int omapfb_overlay_enable(struct omap_overlay *ovl, ++ int enable) ++{ ++ struct omap_overlay_info info; ++ ++ ovl->get_overlay_info(ovl, &info); ++ if (info.enabled == enable) ++ return 0; ++ info.enabled = enable; ++ return ovl->set_overlay_info(ovl, &info); ++} ++ ++static inline struct omapfb2_mem_region * ++omapfb_get_mem_region(struct omapfb2_mem_region *rg) ++{ ++ down_read_nested(&rg->lock, rg->id); ++ atomic_inc(&rg->lock_count); ++ return rg; ++} ++ ++static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg) ++{ ++ atomic_dec(&rg->lock_count); ++ up_read(&rg->lock); ++} ++ ++#endif +-- diff -Nru pvr-omap4-kernel-0.24.10/debian/patches/series pvr-omap4-kernel-0.24.9/debian/patches/series --- pvr-omap4-kernel-0.24.10/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/debian/patches/series 2010-11-12 20:36:36.000000000 +0000 @@ -0,0 +1 @@ +0001-hack-add-omapfb-h.patch diff -Nru pvr-omap4-kernel-0.24.10/.gbp.conf pvr-omap4-kernel-0.24.9/.gbp.conf --- pvr-omap4-kernel-0.24.10/.gbp.conf 2010-11-12 20:36:36.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/.gbp.conf 2010-11-12 20:36:36.000000000 +0000 @@ -1,3 +1,8 @@ +# Customized to work on 'maverick/*'. +[DEFAULT] +upstream-branch = maverick/upstream +debian-branch = maverick/master + [git-import-orig] # Keep pristine-tar (allows to re-create 'orig'). pristine-tar = True diff -Nru pvr-omap4-kernel-0.24.10/sgx/dkms.conf pvr-omap4-kernel-0.24.9/sgx/dkms.conf --- pvr-omap4-kernel-0.24.10/sgx/dkms.conf 2010-11-12 20:36:36.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/sgx/dkms.conf 2010-11-12 20:36:36.000000000 +0000 @@ -1,7 +1,6 @@ PACKAGE_NAME="pvr-omap4-kernel" PACKAGE_VERSION="__VERSION__" CLEAN="make clean" -BUILD_EXCLUSIVE_ARCH="armel" MAKE[0]="make all KVERSION=$kernelver" BUILT_MODULE_NAME[0]="pvrsrvkm" diff -Nru pvr-omap4-kernel-0.24.10/sgx/eurasiacon/build/linux/makefile.shared_conf pvr-omap4-kernel-0.24.9/sgx/eurasiacon/build/linux/makefile.shared_conf --- pvr-omap4-kernel-0.24.10/sgx/eurasiacon/build/linux/makefile.shared_conf 2010-10-15 22:21:32.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/sgx/eurasiacon/build/linux/makefile.shared_conf 2010-09-06 14:39:43.000000000 +0000 @@ -103,7 +103,7 @@ BUILD ?= release # Services module name -PVRSRV_MODNAME ?= omap_gpu +PVRSRV_MODNAME ?= pvrsrvkm SYS_CFLAGS += -DPVRSRV_MODNAME="\"$(PVRSRV_MODNAME)"\" diff -Nru pvr-omap4-kernel-0.24.10/sgx/eurasiacon/build/linux/omap4430_linux/makefile.shared_conf pvr-omap4-kernel-0.24.9/sgx/eurasiacon/build/linux/omap4430_linux/makefile.shared_conf --- pvr-omap4-kernel-0.24.10/sgx/eurasiacon/build/linux/omap4430_linux/makefile.shared_conf 2010-10-15 22:21:32.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/sgx/eurasiacon/build/linux/omap4430_linux/makefile.shared_conf 2010-09-06 14:39:43.000000000 +0000 @@ -82,7 +82,7 @@ SGXCORE = 540 SUPPORT_SGX = 1 -SUPPORT_HW_RECOVERY ?= 1 +SUPPORT_HW_RECOVERY = 1 SUPPORT_SGX_HWPERF = 1 SYS_USING_INTERRUPTS = 1 @@ -90,6 +90,7 @@ ifeq ($(SUPPORT_XORG),1) SUPPORT_DRI_DRM = 1 +SUPPORT_DRI_DRM_NOT_PCI = 1 endif # When flipping is enabled, the Framebuffer API will be used to diff -Nru pvr-omap4-kernel-0.24.10/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb.h pvr-omap4-kernel-0.24.9/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb.h --- pvr-omap4-kernel-0.24.10/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb.h 2010-10-15 22:21:32.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb.h 2010-09-06 14:39:43.000000000 +0000 @@ -39,18 +39,12 @@ #include #include -#include -#include - #ifdef CONFIG_HAS_EARLYSUSPEND #include #endif #define unref__ __attribute__ ((unused)) -/* max number of overlays to which a framebuffer data can be direct */ -#define OMAPFB_MAX_OVL_PER_FB 3 - typedef void * OMAPLFB_HANDLE; typedef bool OMAPLFB_BOOL, *OMAPLFB_PBOOL; @@ -196,6 +190,19 @@ } OMAPLFB_DEVINFO; +#define OMAPLFB_PAGE_SIZE 4096 + +#ifdef DEBUG +#define DEBUG_PRINTK(x) printk x +#else +#define DEBUG_PRINTK(x) +#endif + +#define DISPLAY_DEVICE_NAME "PowerVR OMAP Linux Display Driver" +#define DRVNAME "omaplfb" +#define DEVNAME DRVNAME +#define DRIVER_PREFIX DRVNAME + typedef enum _OMAPLFB_ERROR_ { OMAPLFB_OK = 0, @@ -218,100 +225,10 @@ OMAPLFB_UPDATE_MODE_DISABLED = 3 } OMAPLFB_UPDATE_MODE; -struct omapfb2_mem_region { - int id; - u32 paddr; - void __iomem *vaddr; - struct vrfb vrfb; - unsigned long size; - u8 type; /* OMAPFB_PLANE_MEM_* */ - bool alloc; /* allocated by the driver */ - bool map; /* kernel mapped by the driver */ - atomic_t map_count; - struct rw_semaphore lock; - atomic_t lock_count; -}; - -struct omapfb_info { - int id; - struct omapfb2_mem_region *region; - int num_overlays; - struct omap_overlay *overlays[OMAPFB_MAX_OVL_PER_FB]; - struct omapfb2_device *fbdev; - enum omap_dss_rotation_type rotation_type; - u8 rotation[OMAPFB_MAX_OVL_PER_FB]; - bool mirror; -}; - -struct omapfb2_device { - struct device *dev; - struct mutex mtx; - - u32 pseudo_palette[17]; - - int state; - - unsigned num_fbs; - struct fb_info *fbs[10]; - struct omapfb2_mem_region regions[10]; - - unsigned num_displays; - struct omap_dss_device *displays[10]; - unsigned num_overlays; - struct omap_overlay *overlays[10]; - unsigned num_managers; - struct omap_overlay_manager *managers[10]; - - unsigned num_bpp_overrides; - struct { - struct omap_dss_device *dssdev; - u8 bpp; - } bpp_overrides[10]; -}; - -#define OMAPLFB_PAGE_SIZE 4096 - -#ifdef DEBUG -#define DEBUG_PRINTK(x) printk x -#else -#define DEBUG_PRINTK(x) -#endif - -#define DISPLAY_DEVICE_NAME "PowerVR OMAP Linux Display Driver" -#define DRVNAME "omaplfb" -#define DEVNAME DRVNAME -#define DRIVER_PREFIX DRVNAME - #ifndef UNREFERENCED_PARAMETER #define UNREFERENCED_PARAMETER(param) (param) = (param) #endif -#define FB2OFB(fb_info) ((struct omapfb_info *)(fb_info->par)) - -static inline void omapfb_lock(struct omapfb2_device *fbdev) -{ - mutex_lock(&fbdev->mtx); -} - -static inline void omapfb_unlock(struct omapfb2_device *fbdev) -{ - mutex_unlock(&fbdev->mtx); -} - -/* find the display connected to this fb, if any */ -static inline struct omap_dss_device *fb2display(struct fb_info *fbi) -{ - struct omapfb_info *ofbi = FB2OFB(fbi); - int i; - - /* XXX: returns the display connected to first attached overlay */ - for (i = 0; i < ofbi->num_overlays; i++) { - if (ofbi->overlays[i]->manager) - return ofbi->overlays[i]->manager->device; - } - return NULL; -} - OMAPLFB_ERROR OMAPLFBInit(void); OMAPLFB_ERROR OMAPLFBDeInit(void); diff -Nru pvr-omap4-kernel-0.24.10/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c pvr-omap4-kernel-0.24.9/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c --- pvr-omap4-kernel-0.24.10/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c 2010-10-15 22:21:32.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/sgx/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c 2010-09-06 14:39:43.000000000 +0000 @@ -53,13 +53,24 @@ #endif #if defined(PVR_OMAPFB3_NEEDS_PLAT_VRFB_H) -#include -#include +# include #else -#if defined(PVR_OMAPFB3_NEEDS_MACH_VRFB_H) -#include -#include +# if defined(PVR_OMAPFB3_NEEDS_MACH_VRFB_H) +# include +# endif #endif + +#if defined(DEBUG) +#define PVR_DEBUG DEBUG +#undef DEBUG +#endif +#include +#if defined(DEBUG) +#undef DEBUG +#endif +#if defined(PVR_DEBUG) +#define DEBUG PVR_DEBUG +#undef PVR_DEBUG #endif #include "img_defs.h" diff -Nru pvr-omap4-kernel-0.24.10/sgx/services4/srvkm/env/linux/module.c pvr-omap4-kernel-0.24.9/sgx/services4/srvkm/env/linux/module.c --- pvr-omap4-kernel-0.24.10/sgx/services4/srvkm/env/linux/module.c 2010-10-15 22:21:32.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/sgx/services4/srvkm/env/linux/module.c 2010-09-06 14:39:43.000000000 +0000 @@ -28,13 +28,16 @@ #include #endif -#if defined(LDM_PLATFORM) - #define PVR_LDM_PLATFORM_MODULE - #define PVR_LDM_MODULE -#else - #if defined(LDM_PCI) && !defined(SUPPORT_DRI_DRM) - #define PVR_LDM_PCI_MODULE +#if !defined(SUPPORT_DRI_DRM) + + #if defined(LDM_PLATFORM) + #define PVR_LDM_PLATFORM_MODULE #define PVR_LDM_MODULE + #else + #if defined(LDM_PCI) + #define PVR_LDM_PCI_MODULE + #define PVR_LDM_MODULE + #endif #endif #endif @@ -44,8 +47,6 @@ #include #include #include -#include -#include #if defined(SUPPORT_DRI_DRM) #include @@ -112,7 +113,7 @@ EXPORT_SYMBOL(PVRGetDisplayClassJTable); EXPORT_SYMBOL(PVRGetBufferClassJTable); -#if defined(PVR_LDM_MODULE) && !defined(SUPPORT_DRI_DRM) +#if defined(PVR_LDM_MODULE) static struct class *psPvrClass; #endif @@ -153,27 +154,16 @@ #endif #if defined(PVR_LDM_PLATFORM_MODULE) -#if defined(SUPPORT_DRI_DRM) -int PVRSRVDriverProbe(LDM_DEV *device); -int PVRSRVDriverRemove(LDM_DEV *device); -int PVRSRVDriverSuspend(LDM_DEV *device, pm_message_t state); -int PVRSRVDriverResume(LDM_DEV *device); -void PVRSRVDriverShutdown(LDM_DEV *device); -#else -static int PVRSRVDriverProbe(LDM_DEV *device); static int PVRSRVDriverRemove(LDM_DEV *device); -static int PVRSRVDriverSuspend(LDM_DEV *device, pm_message_t state); -static int PVRSRVDriverResume(LDM_DEV *device); -static void PVRSRVDriverShutdown(LDM_DEV *device); -#endif +static int PVRSRVDriverProbe(LDM_DEV *device); #endif #if defined(PVR_LDM_PCI_MODULE) -static int PVRSRVDriverProbe(LDM_DEV *device, const struct pci_device_id *id); static void PVRSRVDriverRemove(LDM_DEV *device); +static int PVRSRVDriverProbe(LDM_DEV *device, const struct pci_device_id *id); +#endif static int PVRSRVDriverSuspend(LDM_DEV *device, pm_message_t state); -static int PVRSRVDriverResume(LDM_DEV *device); static void PVRSRVDriverShutdown(LDM_DEV *device); -#endif +static int PVRSRVDriverResume(LDM_DEV *device); #if defined(PVR_LDM_PCI_MODULE) struct pci_device_id powervr_id_table[] __devinitdata = { @@ -184,7 +174,6 @@ MODULE_DEVICE_TABLE(pci, powervr_id_table); #endif -#if !defined(SUPPORT_DRI_DRM) static LDM_DRV powervr_driver = { #if defined(PVR_LDM_PLATFORM_MODULE) .driver = { @@ -206,19 +195,28 @@ .resume = PVRSRVDriverResume, .shutdown = PVRSRVDriverShutdown, }; -#endif -struct gpu_platform_data *gpsSgxPlatformData; LDM_DEV *gpsPVRLDMDev; +#if defined(MODULE) && defined(PVR_LDM_PLATFORM_MODULE) + +static IMG_VOID PVRSRVDeviceRelease(struct device unref__ *pDevice) +{ +} + +static struct platform_device powervr_device = { + .name = DEVNAME, + .id = -1, + .dev = { + .release = PVRSRVDeviceRelease + } +}; + +#endif #if defined(PVR_LDM_PLATFORM_MODULE) -#if defined(SUPPORT_DRI_DRM) -int PVRSRVDriverProbe(LDM_DEV *pDevice) -#else static int PVRSRVDriverProbe(LDM_DEV *pDevice) #endif -#endif #if defined(PVR_LDM_PCI_MODULE) static int __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_device_id *id) #endif @@ -233,18 +231,9 @@ { return -EINVAL; } -#endif - - gpsSgxPlatformData = pDevice->dev.platform_data; - if (!gpsSgxPlatformData) - { - PVR_TRACE(("No SGX platform device data.")); - } +#endif psSysData = SysAcquireDataNoCheck(); - - pm_runtime_enable(&pDevice->dev); - if ( psSysData == IMG_NULL) { gpsPVRLDMDev = pDevice; @@ -260,12 +249,8 @@ #if defined (PVR_LDM_PLATFORM_MODULE) -#if defined(SUPPORT_DRI_DRM) -int PVRSRVDriverRemove(LDM_DEV *pDevice) -#else static int PVRSRVDriverRemove(LDM_DEV *pDevice) #endif -#endif #if defined(PVR_LDM_PCI_MODULE) static void __devexit PVRSRVDriverRemove(LDM_DEV *pDevice) #endif @@ -285,8 +270,6 @@ } } #endif - pm_runtime_disable(&pDevice->dev); - (IMG_VOID)SysDeinitialise(psSysData); gpsPVRLDMDev = IMG_NULL; @@ -306,11 +289,8 @@ #endif } -#if defined(SUPPORT_DRI_DRM) -IMG_VOID PVRSRVDriverShutdown(LDM_DEV *pDevice) -#else + static IMG_VOID PVRSRVDriverShutdown(LDM_DEV *pDevice) -#endif { PVR_TRACE(("PVRSRVDriverShutdown(pDevice=%p)", pDevice)); @@ -320,14 +300,14 @@ #endif -#if defined(PVR_LDM_MODULE) +#if defined(PVR_LDM_MODULE) || defined(SUPPORT_DRI_DRM) #if defined(SUPPORT_DRI_DRM) -int PVRSRVDriverSuspend(LDM_DEV *pDevice, pm_message_t state) +int PVRSRVDriverSuspend(struct drm_device *pDevice, pm_message_t state) #else static int PVRSRVDriverSuspend(LDM_DEV *pDevice, pm_message_t state) #endif { -#if !(defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL)) +#if !(defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) && !defined(SUPPORT_DRI_DRM)) PVR_TRACE(( "PVRSRVDriverSuspend(pDevice=%p)", pDevice)); if (PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE_D3) != PVRSRV_OK) @@ -340,12 +320,12 @@ #if defined(SUPPORT_DRI_DRM) -int PVRSRVDriverResume(LDM_DEV *pDevice) +int PVRSRVDriverResume(struct drm_device *pDevice) #else static int PVRSRVDriverResume(LDM_DEV *pDevice) #endif { -#if !(defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL)) +#if !(defined(DEBUG) && defined(PVR_MANUAL_POWER_CONTROL) && !defined(SUPPORT_DRI_DRM)) PVR_TRACE(("PVRSRVDriverResume(pDevice=%p)", pDevice)); if (PVRSRVSetPowerStateKM(PVRSRV_SYS_POWER_STATE_D0) != PVRSRV_OK) @@ -516,12 +496,13 @@ #if !defined(PVR_LDM_MODULE) PVRSRV_ERROR eError; #else -#if !defined(SUPPORT_DRI_DRM) struct device *psDev; #endif -#endif - PVRDPFInit(); +#if !defined(SUPPORT_DRI_DRM) + + PVRDPFInit(); +#endif PVR_TRACE(("PVRCore_Init")); LinuxInitMutex(&gPVRSRVLock); @@ -550,8 +531,6 @@ PVRMMapInit(); -#if !defined(SUPPORT_DRI_DRM) - #if defined(PVR_LDM_MODULE) #if defined(PVR_LDM_PLATFORM_MODULE) @@ -562,7 +541,16 @@ goto init_failed; } - /* Platform device registration is done in kernel */ +#if defined(MODULE) + if ((error = platform_device_register(&powervr_device)) != 0) + { + platform_driver_unregister(&powervr_driver); + + PVR_DPF((PVR_DBG_ERROR, "PVRCore_Init: unable to register platform device (%d)", error)); + + goto init_failed; + } +#endif #endif #if defined(PVR_LDM_PCI_MODULE) @@ -590,6 +578,7 @@ } #endif +#if !defined(SUPPORT_DRI_DRM) AssignedMajorNumber = register_chrdev(0, DEVNAME, &pvrsrv_fops); if (AssignedMajorNumber <= 0) @@ -601,6 +590,7 @@ } PVR_TRACE(("PVRCore_Init: major device %d", AssignedMajorNumber)); +#endif #if defined(PVR_LDM_MODULE) @@ -626,23 +616,26 @@ } #endif -#endif return 0; -#if !defined(SUPPORT_DRI_DRM) #if defined(PVR_LDM_MODULE) destroy_class: class_destroy(psPvrClass); unregister_device: unregister_chrdev((IMG_UINT)AssignedMajorNumber, DRVNAME); #endif +#if !defined(SUPPORT_DRI_DRM) sys_deinit: +#endif #if defined(PVR_LDM_MODULE) #if defined(PVR_LDM_PCI_MODULE) pci_unregister_driver(&powervr_driver); #endif #if defined (PVR_LDM_PLATFORM_MODULE) +#if defined (MODULE) + platform_device_unregister(&powervr_device); +#endif platform_driver_unregister(&powervr_driver); #endif @@ -658,7 +651,6 @@ } } #endif -#endif init_failed: PVRMMapCleanup(); LinuxMMCleanup(); @@ -677,18 +669,18 @@ static void __exit PVRCore_Cleanup(void) #endif { -#if !defined(PVR_LDM_MODULE) SYS_DATA *psSysData; -#endif PVR_TRACE(("PVRCore_Cleanup")); -#if !defined(SUPPORT_DRI_DRM) + SysAcquireData(&psSysData); + #if defined(PVR_LDM_MODULE) device_destroy(psPvrClass, MKDEV(AssignedMajorNumber, 0)); class_destroy(psPvrClass); #endif +#if !defined(SUPPORT_DRI_DRM) #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22)) if ( #endif @@ -701,6 +693,7 @@ PVR_DPF((PVR_DBG_ERROR," can't unregister device major %d", AssignedMajorNumber)); } #endif +#endif #if defined(PVR_LDM_MODULE) @@ -709,6 +702,9 @@ #endif #if defined (PVR_LDM_PLATFORM_MODULE) +#if defined (MODULE) + platform_device_unregister(&powervr_device); +#endif platform_driver_unregister(&powervr_driver); #endif @@ -722,10 +718,9 @@ } } #endif - SysAcquireData(&psSysData); + (void) SysDeinitialise(psSysData); #endif -#endif PVRMMapCleanup(); diff -Nru pvr-omap4-kernel-0.24.10/sgx/services4/srvkm/env/linux/pvr_drm.c pvr-omap4-kernel-0.24.9/sgx/services4/srvkm/env/linux/pvr_drm.c --- pvr-omap4-kernel-0.24.10/sgx/services4/srvkm/env/linux/pvr_drm.c 2010-10-15 22:21:32.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/sgx/services4/srvkm/env/linux/pvr_drm.c 2010-09-06 14:39:43.000000000 +0000 @@ -69,11 +69,20 @@ #define PVR_DRM_NAME PVRSRV_MODNAME #define PVR_DRM_DESC "Imagination Technologies PVR DRM" +#if defined(PVR_DRI_DRM_NOT_PCI) +#define PVR_PCI_IDS \ + {1, 1, 1, 1, 0, 0, 0}, \ + {0} +#else #define PVR_PCI_IDS \ {SYS_SGX_DEV_VENDOR_ID, SYS_SGX_DEV_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0, 0, 0} +#endif + +#if !defined(PVR_DRI_DRM_NOT_PCI) +struct pci_dev *gpsPVRLDMDev; +#endif -static struct drm_driver sPVRDrmDriver; struct drm_device *gpsPVRDRMDev; #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,24)) @@ -82,31 +91,11 @@ #define PVR_DRM_FILE struct drm_file * -static int -PVRSRVDrmProbe(struct platform_device *pDevice) -{ - int iRes; - - PVR_TRACE(("PVRSRVDrmProbe")); - - iRes = PVRSRVDriverProbe(pDevice); - if (iRes != 0) - { - return iRes; - } - - return drm_get_platform_dev(pDevice, &sPVRDrmDriver); -} - -static int -PVRSRVDrmRemove(struct platform_device *pDevice) -{ - PVR_TRACE(("PVRSRVDrmRemove")); - - drm_put_dev(gpsPVRDRMDev); - - return PVRSRVDriverRemove(pDevice); -} +#if !defined(SUPPORT_DRI_DRM_EXT) +static struct pci_device_id asPciIdList[] = { + PVR_PCI_IDS +}; +#endif DRI_DRM_STATIC int PVRSRVDrmLoad(struct drm_device *dev, unsigned long flags) @@ -116,6 +105,9 @@ PVR_TRACE(("PVRSRVDrmLoad")); gpsPVRDRMDev = dev; +#if !defined(PVR_DRI_DRM_NOT_PCI) + gpsPVRLDMDev = dev->pdev; +#endif #if defined(PDUMP) iRes = dbgdrv_init(); @@ -125,21 +117,29 @@ } #endif + iRes = PVRCore_Init(); + if (iRes != 0) + { + goto exit_dbgdrv_cleanup; + } + #if defined(DISPLAY_CONTROLLER) iRes = PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Init)(dev); if (iRes != 0) { - goto exit_dbgdrv_cleanup; + goto exit_pvrcore_cleanup; } #endif return 0; #if defined(DISPLAY_CONTROLLER) +exit_pvrcore_cleanup: + PVRCore_Cleanup(); +#endif exit_dbgdrv_cleanup: #if defined(PDUMP) dbgdrv_cleanup(); #endif -#endif return iRes; } @@ -152,6 +152,8 @@ PVR_DRM_MAKENAME(DISPLAY_CONTROLLER, _Cleanup)(dev); #endif + PVRCore_Cleanup(); + #if defined(PDUMP) dbgdrv_cleanup(); #endif @@ -181,8 +183,6 @@ void *psDriverPriv = file_priv->driver_priv; int ret; - PVR_TRACE(("PVRSRVDrmRelease")); - ret = drm_release(inode, filp); if (ret != 0) @@ -287,11 +287,13 @@ static struct drm_driver sPVRDrmDriver = { - .driver_features = DRIVER_USE_PLATFORM_DEVICE, + .driver_features = 0, .dev_priv_size = 0, .load = PVRSRVDrmLoad, .unload = PVRSRVDrmUnload, .open = PVRSRVDrmOpen, + .suspend = PVRSRVDriverSuspend, + .resume = PVRSRVDriverResume, .get_map_ofs = drm_core_get_map_ofs, .get_reg_ofs = drm_core_get_reg_ofs, .ioctls = sPVRDrmIoctls, @@ -305,18 +307,12 @@ .poll = drm_poll, .fasync = drm_fasync, }, - .platform_driver = + .pci_driver = { - .driver = - { - .name = PVR_DRM_NAME, - }, - .probe = PVRSRVDrmProbe, - .remove = PVRSRVDrmRemove, - .suspend = PVRSRVDriverSuspend, - .resume = PVRSRVDriverResume, - .shutdown = PVRSRVDriverShutdown, + .name = PVR_DRM_NAME, + .id_table = asPciIdList, }, + .name = PVR_DRM_NAME, .desc = PVR_DRM_DESC, .date = PVR_BUILD_DATE, @@ -330,22 +326,34 @@ int iRes; sPVRDrmDriver.num_ioctls = pvr_max_ioctl; - iRes = PVRCore_Init(); + + PVRDPFInit(); + +#if defined(PVR_DRI_DRM_NOT_PCI) + iRes = drm_pvr_dev_add(); if (iRes != 0) { return iRes; } +#endif - return drm_init(&sPVRDrmDriver); + iRes = drm_init(&sPVRDrmDriver); +#if defined(PVR_DRI_DRM_NOT_PCI) + if (iRes != 0) + { + drm_pvr_dev_remove(); + } +#endif + return iRes; } static void __exit PVRSRVDrmExit(void) { - PVR_TRACE(("PVRSRVDrmExit")); - drm_exit(&sPVRDrmDriver); - PVRCore_Cleanup(); +#if defined(PVR_DRI_DRM_NOT_PCI) + drm_pvr_dev_remove(); +#endif } module_init(PVRSRVDrmInit); diff -Nru pvr-omap4-kernel-0.24.10/sgx/services4/srvkm/env/linux/pvr_drm.h pvr-omap4-kernel-0.24.9/sgx/services4/srvkm/env/linux/pvr_drm.h --- pvr-omap4-kernel-0.24.10/sgx/services4/srvkm/env/linux/pvr_drm.h 2010-10-15 22:21:32.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/sgx/services4/srvkm/env/linux/pvr_drm.h 2010-09-06 14:39:43.000000000 +0000 @@ -37,11 +37,8 @@ void PVRCore_Cleanup(void); int PVRSRVOpen(struct drm_device *dev, struct drm_file *pFile); void PVRSRVRelease(void *pvPrivData); -int PVRSRVDriverProbe(struct platform_device *device); -int PVRSRVDriverRemove(struct platform_device *device); -int PVRSRVDriverSuspend(struct platform_device *device, pm_message_t state); -int PVRSRVDriverResume(struct platform_device *device); -void PVRSRVDriverShutdown(struct platform_device *device); +int PVRSRVDriverSuspend(struct drm_device *pDevice, pm_message_t state); +int PVRSRVDriverResume(struct drm_device *pDevice); int PVRSRV_BridgeDispatchKM(struct drm_device *dev, void *arg, struct drm_file *pFile); diff -Nru pvr-omap4-kernel-0.24.10/sgx/services4/system/omap4/sysconfig.c pvr-omap4-kernel-0.24.9/sgx/services4/system/omap4/sysconfig.c --- pvr-omap4-kernel-0.24.10/sgx/services4/system/omap4/sysconfig.c 2010-10-15 22:21:32.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/sgx/services4/system/omap4/sysconfig.c 2010-09-06 14:39:43.000000000 +0000 @@ -24,9 +24,6 @@ * ******************************************************************************/ -/* TODO: is this a good place to add here */ -#include - #include "services_headers.h" #include "kerneldisplay.h" #include "oemfuncs.h" @@ -53,9 +50,6 @@ static SGX_DEVICE_MAP gsSGXDeviceMap; static PVRSRV_DEVICE_NODE *gpsSGXDevNode; -#define LDM_DEV struct platform_device -extern LDM_DEV *gpsPVRLDMDev; - #define DEVICE_SGX_INTERRUPT (1 << 0) #if defined(NO_HARDWARE) @@ -82,11 +76,9 @@ if(eError == PVRSRV_OK) { - /* OCP SYSCONFIG register is set to appropriate mode by the - * PM framework. - */ - - /* bypassing the OCP interrupt layer */ + OSWriteHWReg(gpvOCPRegsLinAddr, + EUR_CR_OCP_SYSCONFIG - EUR_CR_OCP_REVISION, + 0x14); OSWriteHWReg(gpvOCPRegsLinAddr, EUR_CR_OCP_DEBUG_CONFIG - EUR_CR_OCP_REVISION, EUR_CR_OCP_DEBUG_CONFIG_THALIA_INT_BYPASS_MASK); @@ -124,9 +116,6 @@ #if defined(NO_HARDWARE) PVRSRV_ERROR eError; IMG_CPU_PHYADDR sCpuPAddr; -#else - struct resource *dev_res; - int dev_irq; #endif PVR_UNREFERENCED_PARAMETER(psSysData); @@ -163,15 +152,12 @@ gsSGXDeviceMap.ui32IRQ = 0; #else - dev_res = platform_get_resource(gpsPVRLDMDev, IORESOURCE_MEM, 0); - dev_irq = platform_get_irq(gpsPVRLDMDev, 0); - gsSGXDeviceMap.sRegsSysPBase.uiAddr = dev_res->start; + gsSGXDeviceMap.sRegsSysPBase.uiAddr = SYS_OMAP4430_SGX_REGS_SYS_PHYS_BASE; gsSGXDeviceMap.sRegsCpuPBase = SysSysPAddrToCpuPAddr(gsSGXDeviceMap.sRegsSysPBase); - gsSGXDeviceMap.ui32RegsSize = (unsigned int)(dev_res->end - dev_res->start); - printk("SGX register size %d\n",gsSGXDeviceMap.ui32RegsSize); + gsSGXDeviceMap.ui32RegsSize = SYS_OMAP4430_SGX_REGS_SIZE; - gsSGXDeviceMap.ui32IRQ = dev_irq; + gsSGXDeviceMap.ui32IRQ = SYS_OMAP4430_SGX_IRQ; #endif @@ -200,7 +186,7 @@ IMG_VOID *pvRegsLinAddr; pvRegsLinAddr = OSMapPhysToLin(sRegRegion, - gsSGXDeviceMap.ui32RegsSize, + SYS_OMAP4430_SGX_REGS_SIZE, PVRSRV_HAP_UNCACHED|PVRSRV_HAP_KERNEL_ONLY, IMG_NULL); if(!pvRegsLinAddr) @@ -228,7 +214,7 @@ #if !defined(NO_HARDWARE) OSUnMapPhysToLin(pvRegsLinAddr, - gsSGXDeviceMap.ui32RegsSize, + SYS_OMAP4430_SGX_REGS_SIZE, PVRSRV_HAP_UNCACHED|PVRSRV_HAP_KERNEL_ONLY, IMG_NULL); #endif @@ -340,8 +326,7 @@ IMG_SYS_PHYADDR sOCPRegsSysPBase; IMG_CPU_PHYADDR sOCPRegsCpuPBase; - sOCPRegsSysPBase.uiAddr = gsSGXDeviceMap.sRegsSysPBase.uiAddr + - EUR_CR_OCP_REVISION; + sOCPRegsSysPBase.uiAddr = SYS_OMAP4430_OCP_REGS_SYS_PHYS_BASE; sOCPRegsCpuPBase = SysSysPAddrToCpuPAddr(sOCPRegsSysPBase); gpvOCPRegsLinAddr = OSMapPhysToLin(sOCPRegsCpuPBase, diff -Nru pvr-omap4-kernel-0.24.10/sgx/services4/system/omap4/sysutils_linux.c pvr-omap4-kernel-0.24.9/sgx/services4/system/omap4/sysutils_linux.c --- pvr-omap4-kernel-0.24.10/sgx/services4/system/omap4/sysutils_linux.c 2010-10-15 22:21:32.000000000 +0000 +++ pvr-omap4-kernel-0.24.9/sgx/services4/system/omap4/sysutils_linux.c 2010-09-06 14:39:43.000000000 +0000 @@ -29,8 +29,6 @@ #include #include #include -#include -#include #include "sgxdefs.h" #include "services_headers.h" @@ -47,9 +45,11 @@ #define ONE_MHZ 1000000 #define HZ_TO_MHZ(m) ((m) / ONE_MHZ) -#define LDM_DEV struct platform_device -extern LDM_DEV *gpsPVRLDMDev; -extern struct gpu_platform_data *gpsSgxPlatformData; +#if defined(SUPPORT_OMAP3430_SGXFCLK_96M) +#define SGX_PARENT_CLOCK "cm_96m_fck" +#else +#define SGX_PARENT_CLOCK "core_ck" +#endif static IMG_VOID PowerLockWrap(SYS_SPECIFIC_DATA *psSysSpecData) { @@ -144,7 +144,13 @@ { #if !defined(NO_HARDWARE) SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; +#if defined(OMAP4_PRCM_ENABLE) + long lNewRate; + long lRate; + IMG_INT res; +#endif + if (atomic_read(&psSysSpecData->sSGXClocksEnabled) != 0) { return PVRSRV_OK; @@ -153,12 +159,57 @@ PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks")); #if defined(OMAP4_PRCM_ENABLE) - /* TODO: OMAP4_PRCM_ENABLE flag is obsolete now. */ + +#if defined(DEBUG) + { + IMG_UINT32 rate = clk_get_rate(psSysSpecData->psMPU_CK); + PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: CPU Clock is %dMhz", HZ_TO_MHZ(rate))); + } +#endif + + res = clk_enable(psSysSpecData->psSGX_FCK); + if (res < 0) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res)); + return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK; + } + + res = clk_enable(psSysSpecData->psSGX_ICK); + if (res < 0) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX interface clock (%d)", res)); + + clk_disable(psSysSpecData->psSGX_FCK); + return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK; + } + + lNewRate = clk_round_rate(psSysSpecData->psSGX_FCK, SYS_SGX_CLOCK_SPEED + ONE_MHZ); + if (lNewRate <= 0) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't round SGX functional clock rate")); + return PVRSRV_ERROR_UNABLE_TO_ROUND_CLOCK_RATE; + } + + + lRate = clk_get_rate(psSysSpecData->psSGX_FCK); + if (lRate != lNewRate) + { + res = clk_set_rate(psSysSpecData->psSGX_FCK, lNewRate); + if (res < 0) + { + PVR_DPF((PVR_DBG_WARNING, "EnableSGXClocks: Couldn't set SGX functional clock rate (%d)", res)); + } + } + #if defined(DEBUG) - /* TODO: Populate the clock data for debug purposes. */ + { + IMG_UINT32 rate = clk_get_rate(psSysSpecData->psSGX_FCK); + PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: SGX Functional Clock is %dMhz", HZ_TO_MHZ(rate))); + } #endif + #endif - pm_runtime_get_sync(&gpsPVRLDMDev->dev); + atomic_set(&psSysSpecData->sSGXClocksEnabled, 1); @@ -182,7 +233,18 @@ PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks")); - pm_runtime_put_sync(&gpsPVRLDMDev->dev); +#if defined(OMAP4_PRCM_ENABLE) + if (psSysSpecData->psSGX_ICK) + { + clk_disable(psSysSpecData->psSGX_ICK); + } + + if (psSysSpecData->psSGX_FCK) + { + clk_disable(psSysSpecData->psSGX_FCK); + } +#endif + atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); @@ -220,37 +282,215 @@ atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); #if defined(OMAP4_PRCM_ENABLE) - /* TODO: cleanup - * OMAP4_PRCM_ENABLE flag is obsolete - * population of system data structure? - */ + psCLK = clk_get(NULL, SGX_PARENT_CLOCK); + if (IS_ERR(psCLK)) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get Core Clock")); + goto ExitError; + } + psSysSpecData->psCORE_CK = psCLK; + + psCLK = clk_get(NULL, "sgx_fck"); + if (IS_ERR(psCLK)) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get SGX Functional Clock")); + goto ExitError; + } + psSysSpecData->psSGX_FCK = psCLK; + + psCLK = clk_get(NULL, "sgx_ick"); + if (IS_ERR(psCLK)) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get SGX Interface Clock")); + goto ExitError; + } + psSysSpecData->psSGX_ICK = psCLK; + +#if defined(DEBUG) + psCLK = clk_get(NULL, "mpu_ck"); + if (IS_ERR(psCLK)) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get MPU Clock")); + goto ExitError; + } + psSysSpecData->psMPU_CK = psCLK; #endif + res = clk_set_parent(psSysSpecData->psSGX_FCK, psSysSpecData->psCORE_CK); + if (res < 0) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set SGX parent clock (%d)", res)); + goto ExitError; + } +#endif + psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE; } #if (defined(DEBUG) || defined(TIMING)) #if defined(PVR_OMAP4_TIMING_PRCM) - /* TODO: need to revisit the timing capability of the driver - * how to use the GPTIMER resource? - */ + psCLK = clk_get(NULL, "gpt11_fck"); + if (IS_ERR(psCLK)) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 functional clock")); + goto ExitUnRegisterConstraintNotifications; + } + psSysSpecData->psGPT11_FCK = psCLK; + + psCLK = clk_get(NULL, "gpt11_ick"); + if (IS_ERR(psCLK)) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 interface clock")); + goto ExitUnRegisterConstraintNotifications; + } + psSysSpecData->psGPT11_ICK = psCLK; + + sys_ck = clk_get(NULL, "sys_clkin_ck"); + if (IS_ERR(sys_ck)) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get System clock")); + goto ExitUnRegisterConstraintNotifications; + } + + if(clk_get_parent(psSysSpecData->psGPT11_FCK) != sys_ck) + { + PVR_TRACE(("Setting GPTIMER11 parent to System Clock")); + res = clk_set_parent(psSysSpecData->psGPT11_FCK, sys_ck); + if (res < 0) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set GPTIMER11 parent clock (%d)", res)); + goto ExitUnRegisterConstraintNotifications; + } + } + + rate = clk_get_rate(psSysSpecData->psGPT11_FCK); + PVR_TRACE(("GPTIMER11 clock is %dMHz", HZ_TO_MHZ(rate))); + + res = clk_enable(psSysSpecData->psGPT11_FCK); + if (res < 0) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 functional clock (%d)", res)); + goto ExitUnRegisterConstraintNotifications; + } + + res = clk_enable(psSysSpecData->psGPT11_ICK); + if (res < 0) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 interface clock (%d)", res)); + goto ExitDisableGPT11FCK; + } + + TimerRegPhysBase.uiAddr = SYS_OMAP4430_GP11TIMER_TSICR_SYS_PHYS_BASE; + pui32TimerEnable = OSMapPhysToLin(TimerRegPhysBase, + 4, + PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, + &hTimerEnable); + + if (pui32TimerEnable == IMG_NULL) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: OSMapPhysToLin failed")); + goto ExitDisableGPT11ICK; + } + + if(!(*pui32TimerEnable & 4)) + { + PVR_TRACE(("Setting GPTIMER11 mode to posted (currently is non-posted)")); + + + *pui32TimerEnable |= 4; + } + + OSUnMapPhysToLin(pui32TimerEnable, + 4, + PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, + hTimerEnable); + + + TimerRegPhysBase.uiAddr = SYS_OMAP4430_GP11TIMER_ENABLE_SYS_PHYS_BASE; + pui32TimerEnable = OSMapPhysToLin(TimerRegPhysBase, + 4, + PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, + &hTimerEnable); + + if (pui32TimerEnable == IMG_NULL) + { + PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: OSMapPhysToLin failed")); + goto ExitDisableGPT11ICK; + } + + + *pui32TimerEnable = 3; + + OSUnMapPhysToLin(pui32TimerEnable, + 4, + PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, + hTimerEnable); + #endif /* (PVR_OMAP4_TIMING_PRCM) */ #endif eError = PVRSRV_OK; + goto Exit; +#if (defined(DEBUG) || defined(TIMING)) +#if defined(PVR_OMAP4_TIMING_PRCM) +ExitDisableGPT11ICK: + clk_disable(psSysSpecData->psGPT11_ICK); +ExitDisableGPT11FCK: + clk_disable(psSysSpecData->psGPT11_FCK); +ExitUnRegisterConstraintNotifications: +#endif +#endif +#if defined(OMAP4_PRCM_ENABLE) +ExitError: +#endif + eError = PVRSRV_ERROR_DISABLE_CLOCK_FAILURE; +Exit: return eError; } IMG_VOID DisableSystemClocks(SYS_DATA *psSysData) { +#if (defined(DEBUG) || defined(TIMING)) +#if defined(PVR_OMAP4_TIMING_PRCM) + SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData; + IMG_CPU_PHYADDR TimerRegPhysBase; + IMG_HANDLE hTimerDisable; + IMG_UINT32 *pui32TimerDisable; +#endif +#endif + PVR_TRACE(("DisableSystemClocks: Disabling System Clocks")); + DisableSGXClocks(psSysData); #if (defined(DEBUG) || defined(TIMING)) #if defined(PVR_OMAP4_TIMING_PRCM) - /* TODO: revisit required for TIMING purposes */ + + TimerRegPhysBase.uiAddr = SYS_OMAP4430_GP11TIMER_ENABLE_SYS_PHYS_BASE; + pui32TimerDisable = OSMapPhysToLin(TimerRegPhysBase, + 4, + PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, + &hTimerDisable); + + if (pui32TimerDisable == IMG_NULL) + { + PVR_DPF((PVR_DBG_ERROR, "DisableSystemClocks: OSMapPhysToLin failed")); + } + else + { + *pui32TimerDisable = 0; + + OSUnMapPhysToLin(pui32TimerDisable, + 4, + PVRSRV_HAP_KERNEL_ONLY|PVRSRV_HAP_UNCACHED, + hTimerDisable); + } + + clk_disable(psSysSpecData->psGPT11_ICK); + + clk_disable(psSysSpecData->psGPT11_FCK); #endif /* (PVR_OMAP4_TIMING_PRCM) */ #endif }