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

TOMOYO Linux Cross Reference
Linux/include/linux/litex.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/litex.h (Version linux-6.12-rc7) and /include/linux/litex.h (Version linux-5.11.22)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*                                                  2 /*
  3  * Common LiteX header providing                    3  * Common LiteX header providing
  4  * helper functions for accessing CSRs.             4  * helper functions for accessing CSRs.
  5  *                                                  5  *
                                                   >>   6  * Implementation of the functions is provided by
                                                   >>   7  * the LiteX SoC Controller driver.
                                                   >>   8  *
  6  * Copyright (C) 2019-2020 Antmicro <www.antmi      9  * Copyright (C) 2019-2020 Antmicro <www.antmicro.com>
  7  */                                                10  */
  8                                                    11 
  9 #ifndef _LINUX_LITEX_H                             12 #ifndef _LINUX_LITEX_H
 10 #define _LINUX_LITEX_H                             13 #define _LINUX_LITEX_H
 11                                                    14 
 12 #include <linux/io.h>                              15 #include <linux/io.h>
 13                                                !!  16 #include <linux/types.h>
 14 static inline void _write_litex_subregister(u3 !!  17 #include <linux/compiler_types.h>
 15 {                                              << 
 16         writel((u32 __force)cpu_to_le32(val),  << 
 17 }                                              << 
 18                                                << 
 19 static inline u32 _read_litex_subregister(void << 
 20 {                                              << 
 21         return le32_to_cpu((__le32 __force)rea << 
 22 }                                              << 
 23                                                    18 
 24 /*                                                 19 /*
 25  * LiteX SoC Generator, depending on the confi !!  20  * The parameters below are true for LiteX SoCs configured for 8-bit CSR Bus,
 26  * logical CSR (Control&Status Register) into  !!  21  * 32-bit aligned.
 27  * registers.                                  << 
 28  *                                                 22  *
 29  * For example, in the configuration with 8-bi !!  23  * Supporting other configurations will require extending the logic in this
 30  * 32-bit wide logical CSR will be laid out as !!  24  * header and in the LiteX SoC controller driver.
 31  * subregisters, each one containing one byte  << 
 32  *                                             << 
 33  * For Linux support, upstream LiteX enforces  << 
 34  * means that only larger-than-32-bit CSRs wil << 
 35  * subregisters (e.g., a 64-bit CSR will be sp << 
 36  * 32-bit subregisters).                       << 
 37  *                                             << 
 38  * For details see: https://github.com/enjoy-d << 
 39  */                                                25  */
                                                   >>  26 #define LITEX_REG_SIZE    0x4
                                                   >>  27 #define LITEX_SUBREG_SIZE       0x1
                                                   >>  28 #define LITEX_SUBREG_SIZE_BIT    (LITEX_SUBREG_SIZE * 8)
                                                   >>  29 
                                                   >>  30 #define WRITE_LITEX_SUBREGISTER(val, base_offset, subreg_id) \
                                                   >>  31         writel((u32 __force)cpu_to_le32(val), base_offset + (LITEX_REG_SIZE * subreg_id))
                                                   >>  32 
                                                   >>  33 #define READ_LITEX_SUBREGISTER(base_offset, subreg_id) \
                                                   >>  34         le32_to_cpu((__le32 __force)readl(base_offset + (LITEX_REG_SIZE * subreg_id)))
                                                   >>  35 
                                                   >>  36 void litex_set_reg(void __iomem *reg, unsigned long reg_sz, unsigned long val);
                                                   >>  37 
                                                   >>  38 unsigned long litex_get_reg(void __iomem *reg, unsigned long reg_sz);
 40                                                    39 
 41 static inline void litex_write8(void __iomem *     40 static inline void litex_write8(void __iomem *reg, u8 val)
 42 {                                                  41 {
 43         _write_litex_subregister(val, reg);    !!  42         WRITE_LITEX_SUBREGISTER(val, reg, 0);
 44 }                                                  43 }
 45                                                    44 
 46 static inline void litex_write16(void __iomem      45 static inline void litex_write16(void __iomem *reg, u16 val)
 47 {                                                  46 {
 48         _write_litex_subregister(val, reg);    !!  47         WRITE_LITEX_SUBREGISTER(val >> 8, reg, 0);
                                                   >>  48         WRITE_LITEX_SUBREGISTER(val, reg, 1);
 49 }                                                  49 }
 50                                                    50 
 51 static inline void litex_write32(void __iomem      51 static inline void litex_write32(void __iomem *reg, u32 val)
 52 {                                                  52 {
 53         _write_litex_subregister(val, reg);    !!  53         WRITE_LITEX_SUBREGISTER(val >> 24, reg, 0);
                                                   >>  54         WRITE_LITEX_SUBREGISTER(val >> 16, reg, 1);
                                                   >>  55         WRITE_LITEX_SUBREGISTER(val >> 8, reg, 2);
                                                   >>  56         WRITE_LITEX_SUBREGISTER(val, reg, 3);
 54 }                                                  57 }
 55                                                    58 
 56 static inline void litex_write64(void __iomem      59 static inline void litex_write64(void __iomem *reg, u64 val)
 57 {                                                  60 {
 58         _write_litex_subregister(val >> 32, re !!  61         WRITE_LITEX_SUBREGISTER(val >> 56, reg, 0);
 59         _write_litex_subregister(val, reg + 4) !!  62         WRITE_LITEX_SUBREGISTER(val >> 48, reg, 1);
                                                   >>  63         WRITE_LITEX_SUBREGISTER(val >> 40, reg, 2);
                                                   >>  64         WRITE_LITEX_SUBREGISTER(val >> 32, reg, 3);
                                                   >>  65         WRITE_LITEX_SUBREGISTER(val >> 24, reg, 4);
                                                   >>  66         WRITE_LITEX_SUBREGISTER(val >> 16, reg, 5);
                                                   >>  67         WRITE_LITEX_SUBREGISTER(val >> 8, reg, 6);
                                                   >>  68         WRITE_LITEX_SUBREGISTER(val, reg, 7);
 60 }                                                  69 }
 61                                                    70 
 62 static inline u8 litex_read8(void __iomem *reg     71 static inline u8 litex_read8(void __iomem *reg)
 63 {                                                  72 {
 64         return _read_litex_subregister(reg);   !!  73         return READ_LITEX_SUBREGISTER(reg, 0);
 65 }                                                  74 }
 66                                                    75 
 67 static inline u16 litex_read16(void __iomem *r     76 static inline u16 litex_read16(void __iomem *reg)
 68 {                                                  77 {
 69         return _read_litex_subregister(reg);   !!  78         return (READ_LITEX_SUBREGISTER(reg, 0) << 8)
                                                   >>  79                 | (READ_LITEX_SUBREGISTER(reg, 1));
 70 }                                                  80 }
 71                                                    81 
 72 static inline u32 litex_read32(void __iomem *r     82 static inline u32 litex_read32(void __iomem *reg)
 73 {                                                  83 {
 74         return _read_litex_subregister(reg);   !!  84         return (READ_LITEX_SUBREGISTER(reg, 0) << 24)
                                                   >>  85                 | (READ_LITEX_SUBREGISTER(reg, 1) << 16)
                                                   >>  86                 | (READ_LITEX_SUBREGISTER(reg, 2) << 8)
                                                   >>  87                 | (READ_LITEX_SUBREGISTER(reg, 3));
 75 }                                                  88 }
 76                                                    89 
 77 static inline u64 litex_read64(void __iomem *r     90 static inline u64 litex_read64(void __iomem *reg)
 78 {                                                  91 {
 79         return ((u64)_read_litex_subregister(r !!  92         return ((u64)READ_LITEX_SUBREGISTER(reg, 0) << 56)
 80                 _read_litex_subregister(reg +  !!  93                 | ((u64)READ_LITEX_SUBREGISTER(reg, 1) << 48)
                                                   >>  94                 | ((u64)READ_LITEX_SUBREGISTER(reg, 2) << 40)
                                                   >>  95                 | ((u64)READ_LITEX_SUBREGISTER(reg, 3) << 32)
                                                   >>  96                 | ((u64)READ_LITEX_SUBREGISTER(reg, 4) << 24)
                                                   >>  97                 | ((u64)READ_LITEX_SUBREGISTER(reg, 5) << 16)
                                                   >>  98                 | ((u64)READ_LITEX_SUBREGISTER(reg, 6) << 8)
                                                   >>  99                 | ((u64)READ_LITEX_SUBREGISTER(reg, 7));
 81 }                                                 100 }
 82                                                   101 
 83 #endif /* _LINUX_LITEX_H */                       102 #endif /* _LINUX_LITEX_H */
 84                                                   103 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php