diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-07-21 01:39:06 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-09-20 02:08:41 -0400 |
commit | f2cbe46f14427914bdd191795da998588dee4b8c (patch) | |
tree | 8b638a05e106e851e89ceff3e1b748a18a214fc8 /drivers/gpu/drm/nouveau/nouveau_state.c | |
parent | 93e692dc5f4ad9153a34cfb4bd02144f4368151b (diff) |
drm/nouveau: determine timing crystal freq from straps
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_state.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index f1047254e820..baaecf10a585 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -984,7 +984,7 @@ static int nouveau_remove_conflicting_drivers(struct drm_device *dev) | |||
984 | int nouveau_load(struct drm_device *dev, unsigned long flags) | 984 | int nouveau_load(struct drm_device *dev, unsigned long flags) |
985 | { | 985 | { |
986 | struct drm_nouveau_private *dev_priv; | 986 | struct drm_nouveau_private *dev_priv; |
987 | uint32_t reg0; | 987 | uint32_t reg0, strap; |
988 | resource_size_t mmio_start_offs; | 988 | resource_size_t mmio_start_offs; |
989 | int ret; | 989 | int ret; |
990 | 990 | ||
@@ -1074,6 +1074,23 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
1074 | NV_INFO(dev, "Detected an NV%2x generation card (0x%08x)\n", | 1074 | NV_INFO(dev, "Detected an NV%2x generation card (0x%08x)\n", |
1075 | dev_priv->card_type, reg0); | 1075 | dev_priv->card_type, reg0); |
1076 | 1076 | ||
1077 | /* determine frequency of timing crystal */ | ||
1078 | strap = nv_rd32(dev, 0x101000); | ||
1079 | if ( dev_priv->chipset < 0x17 || | ||
1080 | (dev_priv->chipset >= 0x20 && dev_priv->chipset <= 0x25)) | ||
1081 | strap &= 0x00000040; | ||
1082 | else | ||
1083 | strap &= 0x00400040; | ||
1084 | |||
1085 | switch (strap) { | ||
1086 | case 0x00000000: dev_priv->crystal = 13500; break; | ||
1087 | case 0x00000040: dev_priv->crystal = 14318; break; | ||
1088 | case 0x00400000: dev_priv->crystal = 27000; break; | ||
1089 | case 0x00400040: dev_priv->crystal = 25000; break; | ||
1090 | } | ||
1091 | |||
1092 | NV_DEBUG(dev, "crystal freq: %dKHz\n", dev_priv->crystal); | ||
1093 | |||
1077 | /* Determine whether we'll attempt acceleration or not, some | 1094 | /* Determine whether we'll attempt acceleration or not, some |
1078 | * cards are disabled by default here due to them being known | 1095 | * cards are disabled by default here due to them being known |
1079 | * non-functional, or never been tested due to lack of hw. | 1096 | * non-functional, or never been tested due to lack of hw. |