diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2007-10-25 05:15:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:03:16 -0500 |
commit | d860965200c867e7e3e81ede8572cffff8c7eb24 (patch) | |
tree | 222359e2ca703c359ca3ee89f916521dd79d82df /drivers/net/wireless/iwlwifi/iwl-io.h | |
parent | a033f37ee4381a3d9fa0cf4ec28a23357080ed50 (diff) |
iwlwifi: replace restricted_reg with prph
This patch renames restricted_reg suffix with more proper
name prhp for function accessing registers on the periphery bus.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-io.h')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-io.h | 98 |
1 files changed, 31 insertions, 67 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index 8a8b96fcf48d..b78afed9c799 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h | |||
@@ -330,27 +330,26 @@ static inline int __iwl_poll_restricted_bit(const char *f, u32 l, | |||
330 | #define iwl_poll_restricted_bit _iwl_poll_restricted_bit | 330 | #define iwl_poll_restricted_bit _iwl_poll_restricted_bit |
331 | #endif | 331 | #endif |
332 | 332 | ||
333 | static inline u32 _iwl_read_restricted_reg(struct iwl_priv *priv, u32 reg) | 333 | static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) |
334 | { | 334 | { |
335 | _iwl_write_restricted(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); | 335 | _iwl_write_restricted(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); |
336 | return _iwl_read_restricted(priv, HBUS_TARG_PRPH_RDAT); | 336 | return _iwl_read_restricted(priv, HBUS_TARG_PRPH_RDAT); |
337 | } | 337 | } |
338 | #ifdef CONFIG_IWLWIFI_DEBUG | 338 | #ifdef CONFIG_IWLWIFI_DEBUG |
339 | static inline u32 __iwl_read_restricted_reg(u32 line, | 339 | static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) |
340 | struct iwl_priv *priv, u32 reg) | ||
341 | { | 340 | { |
342 | if (!atomic_read(&priv->restrict_refcnt)) | 341 | if (!atomic_read(&priv->restrict_refcnt)) |
343 | IWL_ERROR("Unrestricted access from line %d\n", line); | 342 | IWL_ERROR("Unrestricted access from line %d\n", line); |
344 | return _iwl_read_restricted_reg(priv, reg); | 343 | return _iwl_read_prph(priv, reg); |
345 | } | 344 | } |
346 | 345 | ||
347 | #define iwl_read_restricted_reg(priv, reg) \ | 346 | #define iwl_read_prph(priv, reg) \ |
348 | __iwl_read_restricted_reg(__LINE__, priv, reg) | 347 | __iwl_read_prph(__LINE__, priv, reg) |
349 | #else | 348 | #else |
350 | #define iwl_read_restricted_reg _iwl_read_restricted_reg | 349 | #define iwl_read_prph _iwl_read_prph |
351 | #endif | 350 | #endif |
352 | 351 | ||
353 | static inline void _iwl_write_restricted_reg(struct iwl_priv *priv, | 352 | static inline void _iwl_write_prph(struct iwl_priv *priv, |
354 | u32 addr, u32 val) | 353 | u32 addr, u32 val) |
355 | { | 354 | { |
356 | _iwl_write_restricted(priv, HBUS_TARG_PRPH_WADDR, | 355 | _iwl_write_restricted(priv, HBUS_TARG_PRPH_WADDR, |
@@ -358,61 +357,58 @@ static inline void _iwl_write_restricted_reg(struct iwl_priv *priv, | |||
358 | _iwl_write_restricted(priv, HBUS_TARG_PRPH_WDAT, val); | 357 | _iwl_write_restricted(priv, HBUS_TARG_PRPH_WDAT, val); |
359 | } | 358 | } |
360 | #ifdef CONFIG_IWLWIFI_DEBUG | 359 | #ifdef CONFIG_IWLWIFI_DEBUG |
361 | static inline void __iwl_write_restricted_reg(u32 line, | 360 | static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, |
362 | struct iwl_priv *priv, | ||
363 | u32 addr, u32 val) | 361 | u32 addr, u32 val) |
364 | { | 362 | { |
365 | if (!atomic_read(&priv->restrict_refcnt)) | 363 | if (!atomic_read(&priv->restrict_refcnt)) |
366 | IWL_ERROR("Unrestricted access from line %d\n", line); | 364 | IWL_ERROR("Unrestricted access from line %d\n", line); |
367 | _iwl_write_restricted_reg(priv, addr, val); | 365 | _iwl_write_prph(priv, addr, val); |
368 | } | 366 | } |
369 | 367 | ||
370 | #define iwl_write_restricted_reg(priv, addr, val) \ | 368 | #define iwl_write_prph(priv, addr, val) \ |
371 | __iwl_write_restricted_reg(__LINE__, priv, addr, val); | 369 | __iwl_write_prph(__LINE__, priv, addr, val); |
372 | #else | 370 | #else |
373 | #define iwl_write_restricted_reg _iwl_write_restricted_reg | 371 | #define iwl_write_prph _iwl_write_prph |
374 | #endif | 372 | #endif |
375 | 373 | ||
376 | #define _iwl_set_bits_restricted_reg(priv, reg, mask) \ | 374 | #define _iwl_set_bits_prph(priv, reg, mask) \ |
377 | _iwl_write_restricted_reg(priv, reg, \ | 375 | _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) |
378 | (_iwl_read_restricted_reg(priv, reg) | mask)) | ||
379 | #ifdef CONFIG_IWLWIFI_DEBUG | 376 | #ifdef CONFIG_IWLWIFI_DEBUG |
380 | static inline void __iwl_set_bits_restricted_reg(u32 line, struct iwl_priv | 377 | static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, |
381 | *priv, u32 reg, u32 mask) | 378 | u32 reg, u32 mask) |
382 | { | 379 | { |
383 | if (!atomic_read(&priv->restrict_refcnt)) | 380 | if (!atomic_read(&priv->restrict_refcnt)) |
384 | IWL_ERROR("Unrestricted access from line %d\n", line); | 381 | IWL_ERROR("Unrestricted access from line %d\n", line); |
385 | _iwl_set_bits_restricted_reg(priv, reg, mask); | 382 | _iwl_set_bits_prph(priv, reg, mask); |
386 | } | 383 | } |
387 | #define iwl_set_bits_restricted_reg(priv, reg, mask) \ | 384 | #define iwl_set_bits_prph(priv, reg, mask) \ |
388 | __iwl_set_bits_restricted_reg(__LINE__, priv, reg, mask) | 385 | __iwl_set_bits_prph(__LINE__, priv, reg, mask) |
389 | #else | 386 | #else |
390 | #define iwl_set_bits_restricted_reg _iwl_set_bits_restricted_reg | 387 | #define iwl_set_bits_prph _iwl_set_bits_prph |
391 | #endif | 388 | #endif |
392 | 389 | ||
393 | #define _iwl_set_bits_mask_restricted_reg(priv, reg, bits, mask) \ | 390 | #define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ |
394 | _iwl_write_restricted_reg( \ | 391 | _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) |
395 | priv, reg, ((_iwl_read_restricted_reg(priv, reg) & mask) | bits)) | 392 | |
396 | #ifdef CONFIG_IWLWIFI_DEBUG | 393 | #ifdef CONFIG_IWLWIFI_DEBUG |
397 | static inline void __iwl_set_bits_mask_restricted_reg(u32 line, | 394 | static inline void __iwl_set_bits_mask_prph(u32 line, |
398 | struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) | 395 | struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) |
399 | { | 396 | { |
400 | if (!atomic_read(&priv->restrict_refcnt)) | 397 | if (!atomic_read(&priv->restrict_refcnt)) |
401 | IWL_ERROR("Unrestricted access from line %d\n", line); | 398 | IWL_ERROR("Unrestricted access from line %d\n", line); |
402 | _iwl_set_bits_mask_restricted_reg(priv, reg, bits, mask); | 399 | _iwl_set_bits_mask_prph(priv, reg, bits, mask); |
403 | } | 400 | } |
404 | 401 | #define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ | |
405 | #define iwl_set_bits_mask_restricted_reg(priv, reg, bits, mask) \ | 402 | __iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) |
406 | __iwl_set_bits_mask_restricted_reg(__LINE__, priv, reg, bits, mask) | ||
407 | #else | 403 | #else |
408 | #define iwl_set_bits_mask_restricted_reg _iwl_set_bits_mask_restricted_reg | 404 | #define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph |
409 | #endif | 405 | #endif |
410 | 406 | ||
411 | static inline void iwl_clear_bits_restricted_reg(struct iwl_priv | 407 | static inline void iwl_clear_bits_prph(struct iwl_priv |
412 | *priv, u32 reg, u32 mask) | 408 | *priv, u32 reg, u32 mask) |
413 | { | 409 | { |
414 | u32 val = _iwl_read_restricted_reg(priv, reg); | 410 | u32 val = _iwl_read_prph(priv, reg); |
415 | _iwl_write_restricted_reg(priv, reg, (val & ~mask)); | 411 | _iwl_write_prph(priv, reg, (val & ~mask)); |
416 | } | 412 | } |
417 | 413 | ||
418 | static inline u32 iwl_read_restricted_mem(struct iwl_priv *priv, u32 addr) | 414 | static inline u32 iwl_read_restricted_mem(struct iwl_priv *priv, u32 addr) |
@@ -435,36 +431,4 @@ static inline void iwl_write_restricted_mems(struct iwl_priv *priv, u32 addr, | |||
435 | for (; 0 < len; len -= sizeof(u32), values++) | 431 | for (; 0 < len; len -= sizeof(u32), values++) |
436 | iwl_write_restricted(priv, HBUS_TARG_MEM_WDAT, *values); | 432 | iwl_write_restricted(priv, HBUS_TARG_MEM_WDAT, *values); |
437 | } | 433 | } |
438 | |||
439 | static inline void iwl_write_restricted_regs(struct iwl_priv *priv, u32 reg, | ||
440 | u32 len, u8 *values) | ||
441 | { | ||
442 | u32 reg_offset = reg; | ||
443 | u32 aligment = reg & 0x3; | ||
444 | |||
445 | /* write any non-dword-aligned stuff at the beginning */ | ||
446 | if (len < sizeof(u32)) { | ||
447 | if ((aligment + len) <= sizeof(u32)) { | ||
448 | u8 size; | ||
449 | u32 value = 0; | ||
450 | size = len - 1; | ||
451 | memcpy(&value, values, len); | ||
452 | reg_offset = (reg_offset & 0x0000FFFF); | ||
453 | |||
454 | _iwl_write_restricted(priv, | ||
455 | HBUS_TARG_PRPH_WADDR, | ||
456 | (reg_offset | (size << 24))); | ||
457 | _iwl_write_restricted(priv, HBUS_TARG_PRPH_WDAT, | ||
458 | value); | ||
459 | } | ||
460 | |||
461 | return; | ||
462 | } | ||
463 | |||
464 | /* now write all the dword-aligned stuff */ | ||
465 | for (; reg_offset < (reg + len); | ||
466 | reg_offset += sizeof(u32), values += sizeof(u32)) | ||
467 | _iwl_write_restricted_reg(priv, reg_offset, *((u32 *) values)); | ||
468 | } | ||
469 | |||
470 | #endif | 434 | #endif |