aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon.h
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-06-30 11:52:50 -0400
committerDave Airlie <airlied@redhat.com>2010-08-01 20:00:07 -0400
commit351a52a2414d2b104269755c86b476863c248034 (patch)
tree71e25c5cceab9235e5bca4a8d521f73b3adf3fa6 /drivers/gpu/drm/radeon/radeon.h
parentfe50ac78a6ec20db267b32e27a1d191128eaaa46 (diff)
drm/radeon/kms: add ioport register access
This is required for the NB_MISC regs on rs780/rs880 which means HDMI/DVI/DP ports using PCIEPHY won't work without it. It might also help with s/r (asic init) issues on other atombios cards. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=28774 and similar issues reported by Alberto Milone. [airlied: Squash io fix patch] Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Tested-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon.h')
-rw-r--r--drivers/gpu/drm/radeon/radeon.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 03141755c2ea..966ba0751feb 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1048,6 +1048,9 @@ struct radeon_device {
1048 uint32_t pcie_reg_mask; 1048 uint32_t pcie_reg_mask;
1049 radeon_rreg_t pciep_rreg; 1049 radeon_rreg_t pciep_rreg;
1050 radeon_wreg_t pciep_wreg; 1050 radeon_wreg_t pciep_wreg;
1051 /* io port */
1052 void __iomem *rio_mem;
1053 resource_size_t rio_mem_size;
1051 struct radeon_clock clock; 1054 struct radeon_clock clock;
1052 struct radeon_mc mc; 1055 struct radeon_mc mc;
1053 struct radeon_gart gart; 1056 struct radeon_gart gart;
@@ -1130,6 +1133,26 @@ static inline void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32
1130 } 1133 }
1131} 1134}
1132 1135
1136static inline u32 r100_io_rreg(struct radeon_device *rdev, u32 reg)
1137{
1138 if (reg < rdev->rio_mem_size)
1139 return ioread32(rdev->rio_mem + reg);
1140 else {
1141 iowrite32(reg, rdev->rio_mem + RADEON_MM_INDEX);
1142 return ioread32(rdev->rio_mem + RADEON_MM_DATA);
1143 }
1144}
1145
1146static inline void r100_io_wreg(struct radeon_device *rdev, u32 reg, u32 v)
1147{
1148 if (reg < rdev->rio_mem_size)
1149 iowrite32(v, rdev->rio_mem + reg);
1150 else {
1151 iowrite32(reg, rdev->rio_mem + RADEON_MM_INDEX);
1152 iowrite32(v, rdev->rio_mem + RADEON_MM_DATA);
1153 }
1154}
1155
1133/* 1156/*
1134 * Cast helper 1157 * Cast helper
1135 */ 1158 */
@@ -1168,6 +1191,8 @@ static inline void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32
1168 WREG32_PLL(reg, tmp_); \ 1191 WREG32_PLL(reg, tmp_); \
1169 } while (0) 1192 } while (0)
1170#define DREG32_SYS(sqf, rdev, reg) seq_printf((sqf), #reg " : 0x%08X\n", r100_mm_rreg((rdev), (reg))) 1193#define DREG32_SYS(sqf, rdev, reg) seq_printf((sqf), #reg " : 0x%08X\n", r100_mm_rreg((rdev), (reg)))
1194#define RREG32_IO(reg) r100_io_rreg(rdev, (reg))
1195#define WREG32_IO(reg, v) r100_io_wreg(rdev, (reg), (v))
1171 1196
1172/* 1197/*
1173 * Indirect registers accessor 1198 * Indirect registers accessor