~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/avr32/mach-at32ap/hmatrix.c

Version: ~ [ linux-5.9 ] ~ [ linux-5.8.14 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.70 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.150 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.200 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.238 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.238 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * High-Speed Bus Matrix helper functions
  3  *
  4  * Copyright (C) 2008 Atmel Corporation
  5  *
  6  * This program is free software; you can redistribute it and/or modify
  7  * it under the terms of the GNU General Public License version 2 as
  8  * published by the Free Software Foundation.
  9  */
 10 #include <linux/clk.h>
 11 #include <linux/io.h>
 12 
 13 #include <mach/chip.h>
 14 #include <mach/hmatrix.h>
 15 
 16 static inline void __hmatrix_write_reg(unsigned long offset, u32 value)
 17 {
 18         __raw_writel(value, (void __iomem __force *)(HMATRIX_BASE + offset));
 19 }
 20 
 21 static inline u32 __hmatrix_read_reg(unsigned long offset)
 22 {
 23         return __raw_readl((void __iomem __force *)(HMATRIX_BASE + offset));
 24 }
 25 
 26 /**
 27  * hmatrix_write_reg - write HMATRIX configuration register
 28  * @offset: register offset
 29  * @value: value to be written to the register at @offset
 30  */
 31 void hmatrix_write_reg(unsigned long offset, u32 value)
 32 {
 33         clk_enable(&at32_hmatrix_clk);
 34         __hmatrix_write_reg(offset, value);
 35         __hmatrix_read_reg(offset);
 36         clk_disable(&at32_hmatrix_clk);
 37 }
 38 
 39 /**
 40  * hmatrix_read_reg - read HMATRIX configuration register
 41  * @offset: register offset
 42  *
 43  * Returns the value of the register at @offset.
 44  */
 45 u32 hmatrix_read_reg(unsigned long offset)
 46 {
 47         u32 value;
 48 
 49         clk_enable(&at32_hmatrix_clk);
 50         value = __hmatrix_read_reg(offset);
 51         clk_disable(&at32_hmatrix_clk);
 52 
 53         return value;
 54 }
 55 
 56 /**
 57  * hmatrix_sfr_set_bits - set bits in a slave's Special Function Register
 58  * @slave_id: operate on the SFR belonging to this slave
 59  * @mask: mask of bits to be set in the SFR
 60  */
 61 void hmatrix_sfr_set_bits(unsigned int slave_id, u32 mask)
 62 {
 63         u32 value;
 64 
 65         clk_enable(&at32_hmatrix_clk);
 66         value = __hmatrix_read_reg(HMATRIX_SFR(slave_id));
 67         value |= mask;
 68         __hmatrix_write_reg(HMATRIX_SFR(slave_id), value);
 69         __hmatrix_read_reg(HMATRIX_SFR(slave_id));
 70         clk_disable(&at32_hmatrix_clk);
 71 }
 72 
 73 /**
 74  * hmatrix_sfr_set_bits - clear bits in a slave's Special Function Register
 75  * @slave_id: operate on the SFR belonging to this slave
 76  * @mask: mask of bits to be cleared in the SFR
 77  */
 78 void hmatrix_sfr_clear_bits(unsigned int slave_id, u32 mask)
 79 {
 80         u32 value;
 81 
 82         clk_enable(&at32_hmatrix_clk);
 83         value = __hmatrix_read_reg(HMATRIX_SFR(slave_id));
 84         value &= ~mask;
 85         __hmatrix_write_reg(HMATRIX_SFR(slave_id), value);
 86         __hmatrix_read_reg(HMATRIX_SFR(slave_id));
 87         clk_disable(&at32_hmatrix_clk);
 88 }
 89 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp