Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

c6x: remove architecture

The c6x architecture was added to the kernel in 2011 at a time when
running Linux on DSPs was widely seen as the logical evolution.
It appears the trend has gone back to running Linux on Arm based SoCs
with DSP, using a better supported software ecosystem, and having better
real-time behavior for the DSP code. An example of this is TI's own
Keystone2 platform.

The upstream kernel port appears to no longer have any users. Mark
Salter remained avaialable to review patches, but mentioned that
he no longer has access to working hardware himself. Without any
users, it's best to just remove the code completely to reduce the
work for cross-architecture code changes.

Many thanks to Mark for maintaining the code for the past ten years.

Link: https://lore.kernel.org/lkml/41dc7795afda9f776d8cd0d3075f776cf586e97c.camel@redhat.com/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+2 -11162
-40
Documentation/devicetree/bindings/c6x/clocks.txt
··· 1 - C6X PLL Clock Controllers 2 - ------------------------- 3 - 4 - This is a first-cut support for the SoC clock controllers. This is still 5 - under development and will probably change as the common device tree 6 - clock support is added to the kernel. 7 - 8 - Required properties: 9 - 10 - - compatible: "ti,c64x+pll" 11 - May also have SoC-specific value to support SoC-specific initialization 12 - in the driver. One of: 13 - "ti,c6455-pll" 14 - "ti,c6457-pll" 15 - "ti,c6472-pll" 16 - "ti,c6474-pll" 17 - 18 - - reg: base address and size of register area 19 - - clock-frequency: input clock frequency in hz 20 - 21 - 22 - Optional properties: 23 - 24 - - ti,c64x+pll-bypass-delay: CPU cycles to delay when entering bypass mode 25 - 26 - - ti,c64x+pll-reset-delay: CPU cycles to delay after PLL reset 27 - 28 - - ti,c64x+pll-lock-delay: CPU cycles to delay after PLL frequency change 29 - 30 - Example: 31 - 32 - clock-controller@29a0000 { 33 - compatible = "ti,c6472-pll", "ti,c64x+pll"; 34 - reg = <0x029a0000 0x200>; 35 - clock-frequency = <25000000>; 36 - 37 - ti,c64x+pll-bypass-delay = <200>; 38 - ti,c64x+pll-reset-delay = <12000>; 39 - ti,c64x+pll-lock-delay = <80000>; 40 - };
-127
Documentation/devicetree/bindings/c6x/dscr.txt
··· 1 - Device State Configuration Registers 2 - ------------------------------------ 3 - 4 - TI C6X SoCs contain a region of miscellaneous registers which provide various 5 - function for SoC control or status. Details vary considerably among from SoC 6 - to SoC with no two being alike. 7 - 8 - In general, the Device State Configuration Registers (DSCR) will provide one or 9 - more configuration registers often protected by a lock register where one or 10 - more key values must be written to a lock register in order to unlock the 11 - configuration register for writes. These configuration register may be used to 12 - enable (and disable in some cases) SoC pin drivers, select peripheral clock 13 - sources (internal or pin), etc. In some cases, a configuration register is 14 - write once or the individual bits are write once. In addition to device config, 15 - the DSCR block may provide registers which are used to reset peripherals, 16 - provide device ID information, provide ethernet MAC addresses, as well as other 17 - miscellaneous functions. 18 - 19 - For device state control (enable/disable), each device control is assigned an 20 - id which is used by individual device drivers to control the state as needed. 21 - 22 - Required properties: 23 - 24 - - compatible: must be "ti,c64x+dscr" 25 - - reg: register area base and size 26 - 27 - Optional properties: 28 - 29 - NOTE: These are optional in that not all SoCs will have all properties. For 30 - SoCs which do support a given property, leaving the property out of the 31 - device tree will result in reduced functionality or possibly driver 32 - failure. 33 - 34 - - ti,dscr-devstat 35 - offset of the devstat register 36 - 37 - - ti,dscr-silicon-rev 38 - offset, start bit, and bitsize of silicon revision field 39 - 40 - - ti,dscr-rmii-resets 41 - offset and bitmask of RMII reset field. May have multiple tuples if more 42 - than one ethernet port is available. 43 - 44 - - ti,dscr-locked-regs 45 - possibly multiple tuples describing registers which are write protected by 46 - a lock register. Each tuple consists of the register offset, lock register 47 - offsset, and the key value used to unlock the register. 48 - 49 - - ti,dscr-kick-regs 50 - offset and key values of two "kick" registers used to write protect other 51 - registers in DSCR. On SoCs using kick registers, the first key must be 52 - written to the first kick register and the second key must be written to 53 - the second register before other registers in the area are write-enabled. 54 - 55 - - ti,dscr-mac-fuse-regs 56 - MAC addresses are contained in two registers. Each element of a MAC address 57 - is contained in a single byte. This property has two tuples. Each tuple has 58 - a register offset and four cells representing bytes in the register from 59 - most significant to least. The value of these four cells is the MAC byte 60 - index (1-6) of the byte within the register. A value of 0 means the byte 61 - is unused in the MAC address. 62 - 63 - - ti,dscr-devstate-ctl-regs 64 - This property describes the bitfields used to control the state of devices. 65 - Each tuple describes a range of identical bitfields used to control one or 66 - more devices (one bitfield per device). The layout of each tuple is: 67 - 68 - start_id num_ids reg enable disable start_bit nbits 69 - 70 - Where: 71 - start_id is device id for the first device control in the range 72 - num_ids is the number of device controls in the range 73 - reg is the offset of the register holding the control bits 74 - enable is the value to enable a device 75 - disable is the value to disable a device (0xffffffff if cannot disable) 76 - start_bit is the bit number of the first bit in the range 77 - nbits is the number of bits per device control 78 - 79 - - ti,dscr-devstate-stat-regs 80 - This property describes the bitfields used to provide device state status 81 - for device states controlled by the DSCR. Each tuple describes a range of 82 - identical bitfields used to provide status for one or more devices (one 83 - bitfield per device). The layout of each tuple is: 84 - 85 - start_id num_ids reg enable disable start_bit nbits 86 - 87 - Where: 88 - start_id is device id for the first device status in the range 89 - num_ids is the number of devices covered by the range 90 - reg is the offset of the register holding the status bits 91 - enable is the value indicating device is enabled 92 - disable is the value indicating device is disabled 93 - start_bit is the bit number of the first bit in the range 94 - nbits is the number of bits per device status 95 - 96 - - ti,dscr-privperm 97 - Offset and default value for register used to set access privilege for 98 - some SoC devices. 99 - 100 - 101 - Example: 102 - 103 - device-state-config-regs@2a80000 { 104 - compatible = "ti,c64x+dscr"; 105 - reg = <0x02a80000 0x41000>; 106 - 107 - ti,dscr-devstat = <0>; 108 - ti,dscr-silicon-rev = <8 28 0xf>; 109 - ti,dscr-rmii-resets = <0x40020 0x00040000>; 110 - 111 - ti,dscr-locked-regs = <0x40008 0x40004 0x0f0a0b00>; 112 - ti,dscr-devstate-ctl-regs = 113 - <0 12 0x40008 1 0 0 2 114 - 12 1 0x40008 3 0 30 2 115 - 13 2 0x4002c 1 0xffffffff 0 1>; 116 - ti,dscr-devstate-stat-regs = 117 - <0 10 0x40014 1 0 0 3 118 - 10 2 0x40018 1 0 0 3>; 119 - 120 - ti,dscr-mac-fuse-regs = <0x700 1 2 3 4 121 - 0x704 5 6 0 0>; 122 - 123 - ti,dscr-privperm = <0x41c 0xaaaaaaaa>; 124 - 125 - ti,dscr-kick-regs = <0x38 0x83E70B13 126 - 0x3c 0x95A4F1E0>; 127 - };
-62
Documentation/devicetree/bindings/c6x/emifa.txt
··· 1 - External Memory Interface 2 - ------------------------- 3 - 4 - The emifa node describes a simple external bus controller found on some C6X 5 - SoCs. This interface provides external busses with a number of chip selects. 6 - 7 - Required properties: 8 - 9 - - compatible: must be "ti,c64x+emifa", "simple-bus" 10 - - reg: register area base and size 11 - - #address-cells: must be 2 (chip-select + offset) 12 - - #size-cells: must be 1 13 - - ranges: mapping from EMIFA space to parent space 14 - 15 - 16 - Optional properties: 17 - 18 - - ti,dscr-dev-enable: Device ID if EMIF is enabled/disabled from DSCR 19 - 20 - - ti,emifa-burst-priority: 21 - Number of memory transfers after which the EMIF will elevate the priority 22 - of the oldest command in the command FIFO. Setting this field to 255 23 - disables this feature, thereby allowing old commands to stay in the FIFO 24 - indefinitely. 25 - 26 - - ti,emifa-ce-config: 27 - Configuration values for each of the supported chip selects. 28 - 29 - Example: 30 - 31 - emifa@70000000 { 32 - compatible = "ti,c64x+emifa", "simple-bus"; 33 - #address-cells = <2>; 34 - #size-cells = <1>; 35 - reg = <0x70000000 0x100>; 36 - ranges = <0x2 0x0 0xa0000000 0x00000008 37 - 0x3 0x0 0xb0000000 0x00400000 38 - 0x4 0x0 0xc0000000 0x10000000 39 - 0x5 0x0 0xD0000000 0x10000000>; 40 - 41 - ti,dscr-dev-enable = <13>; 42 - ti,emifa-burst-priority = <255>; 43 - ti,emifa-ce-config = <0x00240120 44 - 0x00240120 45 - 0x00240122 46 - 0x00240122>; 47 - 48 - flash@3,0 { 49 - #address-cells = <1>; 50 - #size-cells = <1>; 51 - compatible = "cfi-flash"; 52 - reg = <0x3 0x0 0x400000>; 53 - bank-width = <1>; 54 - device-width = <1>; 55 - partition@0 { 56 - reg = <0x0 0x400000>; 57 - label = "NOR"; 58 - }; 59 - }; 60 - }; 61 - 62 - This shows a flash chip attached to chip select 3.
-28
Documentation/devicetree/bindings/c6x/soc.txt
··· 1 - C6X System-on-Chip 2 - ------------------ 3 - 4 - Required properties: 5 - 6 - - compatible: "simple-bus" 7 - - #address-cells: must be 1 8 - - #size-cells: must be 1 9 - - ranges 10 - 11 - Optional properties: 12 - 13 - - model: specific SoC model 14 - 15 - - nodes for IP blocks within SoC 16 - 17 - 18 - Example: 19 - 20 - soc { 21 - compatible = "simple-bus"; 22 - model = "tms320c6455"; 23 - #address-cells = <1>; 24 - #size-cells = <1>; 25 - ranges; 26 - 27 - ... 28 - };
-103
Documentation/devicetree/bindings/interrupt-controller/ti,c64x+megamod-pic.txt
··· 1 - C6X Interrupt Chips 2 - ------------------- 3 - 4 - * C64X+ Core Interrupt Controller 5 - 6 - The core interrupt controller provides 16 prioritized interrupts to the 7 - C64X+ core. Priority 0 and 1 are used for reset and NMI respectively. 8 - Priority 2 and 3 are reserved. Priority 4-15 are used for interrupt 9 - sources coming from outside the core. 10 - 11 - Required properties: 12 - -------------------- 13 - - compatible: Should be "ti,c64x+core-pic"; 14 - - #interrupt-cells: <1> 15 - 16 - Interrupt Specifier Definition 17 - ------------------------------ 18 - Single cell specifying the core interrupt priority level (4-15) where 19 - 4 is highest priority and 15 is lowest priority. 20 - 21 - Example 22 - ------- 23 - core_pic: interrupt-controller@0 { 24 - interrupt-controller; 25 - #interrupt-cells = <1>; 26 - compatible = "ti,c64x+core-pic"; 27 - }; 28 - 29 - 30 - 31 - * C64x+ Megamodule Interrupt Controller 32 - 33 - The megamodule PIC consists of four interrupt mupliplexers each of which 34 - combine up to 32 interrupt inputs into a single interrupt output which 35 - may be cascaded into the core interrupt controller. The megamodule PIC 36 - has a total of 12 outputs cascading into the core interrupt controller. 37 - One for each core interrupt priority level. In addition to the combined 38 - interrupt sources, individual megamodule interrupts may be cascaded to 39 - the core interrupt controller. When an individual interrupt is cascaded, 40 - it is no longer handled through a megamodule interrupt combiner and is 41 - considered to have the core interrupt controller as the parent. 42 - 43 - Required properties: 44 - -------------------- 45 - - compatible: "ti,c64x+megamod-pic" 46 - - interrupt-controller 47 - - #interrupt-cells: <1> 48 - - reg: base address and size of register area 49 - - interrupts: This should have four cells; one for each interrupt combiner. 50 - The cells contain the core priority interrupt to which the 51 - corresponding combiner output is wired. 52 - 53 - Optional properties: 54 - -------------------- 55 - - ti,c64x+megamod-pic-mux: Array of 12 cells correspnding to the 12 core 56 - priority interrupts. The first cell corresponds to 57 - core priority 4 and the last cell corresponds to 58 - core priority 15. The value of each cell is the 59 - megamodule interrupt source which is MUXed to 60 - the core interrupt corresponding to the cell 61 - position. Allowed values are 4 - 127. Mapping for 62 - interrupts 0 - 3 (combined interrupt sources) are 63 - ignored. 64 - 65 - Interrupt Specifier Definition 66 - ------------------------------ 67 - Single cell specifying the megamodule interrupt source (4-127). Note that 68 - interrupts mapped directly to the core with "ti,c64x+megamod-pic-mux" will 69 - use the core interrupt controller as their parent and the specifier will 70 - be the core priority level, not the megamodule interrupt number. 71 - 72 - Examples 73 - -------- 74 - megamod_pic: interrupt-controller@1800000 { 75 - compatible = "ti,c64x+megamod-pic"; 76 - interrupt-controller; 77 - #interrupt-cells = <1>; 78 - reg = <0x1800000 0x1000>; 79 - interrupt-parent = <&core_pic>; 80 - interrupts = < 12 13 14 15 >; 81 - }; 82 - 83 - This is a minimal example where all individual interrupts go through a 84 - combiner. Combiner-0 is mapped to core interrupt 12, combiner-1 is mapped 85 - to interrupt 13, etc. 86 - 87 - 88 - megamod_pic: interrupt-controller@1800000 { 89 - compatible = "ti,c64x+megamod-pic"; 90 - interrupt-controller; 91 - #interrupt-cells = <1>; 92 - reg = <0x1800000 0x1000>; 93 - interrupt-parent = <&core_pic>; 94 - interrupts = < 12 13 14 15 >; 95 - ti,c64x+megamod-pic-mux = < 0 0 0 0 96 - 32 0 0 0 97 - 0 0 0 0 >; 98 - }; 99 - 100 - This the same as the first example except that megamodule interrupt 32 is 101 - mapped directly to core priority interrupt 8. The node using this interrupt 102 - must set the core controller as its interrupt parent and use 8 in the 103 - interrupt specifier value.
-25
Documentation/devicetree/bindings/timer/ti,c64x+timer64.txt
··· 1 - Timer64 2 - ------- 3 - 4 - The timer64 node describes C6X event timers. 5 - 6 - Required properties: 7 - 8 - - compatible: must be "ti,c64x+timer64" 9 - - reg: base address and size of register region 10 - - interrupts: interrupt id 11 - 12 - Optional properties: 13 - 14 - - ti,dscr-dev-enable: Device ID used to enable timer IP through DSCR interface. 15 - 16 - - ti,core-mask: on multi-core SoCs, bitmask of cores allowed to use this timer. 17 - 18 - Example: 19 - timer0: timer@25e0000 { 20 - compatible = "ti,c64x+timer64"; 21 - ti,core-mask = < 0x01 >; 22 - reg = <0x25e0000 0x40>; 23 - interrupt-parent = <&megamod_pic>; 24 - interrupts = < 16 >; 25 - };
-8
MAINTAINERS
··· 3837 3837 N: csky 3838 3838 K: csky 3839 3839 3840 - C6X ARCHITECTURE 3841 - M: Mark Salter <msalter@redhat.com> 3842 - M: Aurelien Jacquiot <jacquiot.aurelien@gmail.com> 3843 - L: linux-c6x-dev@linux-c6x.org 3844 - S: Maintained 3845 - W: http://www.linux-c6x.org/wiki/index.php/Main_Page 3846 - F: arch/c6x/ 3847 - 3848 3840 CA8210 IEEE-802.15.4 RADIO DRIVER 3849 3841 M: Harry Morris <h.morris@cascoda.com> 3850 3842 L: linux-wpan@vger.kernel.org
-113
arch/c6x/Kconfig
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # 3 - # For a description of the syntax of this configuration file, 4 - # see Documentation/kbuild/kconfig-language.rst. 5 - # 6 - 7 - config C6X 8 - def_bool y 9 - select ARCH_32BIT_OFF_T 10 - select ARCH_HAS_BINFMT_FLAT 11 - select ARCH_HAS_SYNC_DMA_FOR_CPU 12 - select ARCH_HAS_SYNC_DMA_FOR_DEVICE 13 - select CLKDEV_LOOKUP 14 - select HAVE_LEGACY_CLK 15 - select GENERIC_ATOMIC64 16 - select GENERIC_IRQ_SHOW 17 - select HAVE_ARCH_TRACEHOOK 18 - select SPARSE_IRQ 19 - select IRQ_DOMAIN 20 - select OF 21 - select OF_EARLY_FLATTREE 22 - select MODULES_USE_ELF_RELA 23 - select MMU_GATHER_NO_RANGE if MMU 24 - select SET_FS 25 - 26 - config MMU 27 - def_bool n 28 - 29 - config FPU 30 - def_bool n 31 - 32 - config GENERIC_CALIBRATE_DELAY 33 - def_bool y 34 - 35 - config GENERIC_HWEIGHT 36 - def_bool y 37 - 38 - config GENERIC_BUG 39 - def_bool y 40 - depends on BUG 41 - 42 - config C6X_BIG_KERNEL 43 - bool "Build a big kernel" 44 - help 45 - The C6X function call instruction has a limited range of +/- 2MiB. 46 - This is sufficient for most kernels, but some kernel configurations 47 - with lots of compiled-in functionality may require a larger range 48 - for function calls. Use this option to have the compiler generate 49 - function calls with 32-bit range. This will make the kernel both 50 - larger and slower. 51 - 52 - If unsure, say N. 53 - 54 - # Use the generic interrupt handling code in kernel/irq/ 55 - 56 - config CMDLINE_BOOL 57 - bool "Default bootloader kernel arguments" 58 - 59 - config CMDLINE 60 - string "Kernel command line" 61 - depends on CMDLINE_BOOL 62 - default "console=ttyS0,57600" 63 - help 64 - On some architectures there is currently no way for the boot loader 65 - to pass arguments to the kernel. For these architectures, you should 66 - supply some command-line options at build time by entering them 67 - here. 68 - 69 - config CMDLINE_FORCE 70 - bool "Force default kernel command string" 71 - depends on CMDLINE_BOOL 72 - default n 73 - help 74 - Set this to have arguments from the default kernel command string 75 - override those passed by the boot loader. 76 - 77 - config CPU_BIG_ENDIAN 78 - bool "Build big-endian kernel" 79 - default n 80 - help 81 - Say Y if you plan on running a kernel in big-endian mode. 82 - Note that your board must be properly built and your board 83 - port must properly enable any big-endian related features 84 - of your chipset/board/processor. 85 - 86 - config FORCE_MAX_ZONEORDER 87 - int "Maximum zone order" 88 - default "13" 89 - help 90 - The kernel memory allocator divides physically contiguous memory 91 - blocks into "zones", where each zone is a power of two number of 92 - pages. This option selects the largest power of two that the kernel 93 - keeps in the memory allocator. If you need to allocate very large 94 - blocks of physically contiguous memory, then you may need to 95 - increase this value. 96 - 97 - This config option is actually maximum order plus one. For example, 98 - a value of 11 means that the largest free memory block is 2^10 pages. 99 - 100 - menu "Processor type and features" 101 - 102 - source "arch/c6x/platforms/Kconfig" 103 - 104 - config KERNEL_RAM_BASE_ADDRESS 105 - hex "Virtual address of memory base" 106 - default 0xe0000000 if SOC_TMS320C6455 107 - default 0xe0000000 if SOC_TMS320C6457 108 - default 0xe0000000 if SOC_TMS320C6472 109 - default 0x80000000 110 - 111 - source "kernel/Kconfig.hz" 112 - 113 - endmenu
-10
arch/c6x/Kconfig.debug
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - 3 - config ACCESS_CHECK 4 - bool "Check the user pointer address" 5 - default y 6 - help 7 - Usually the pointer transfer from user space is checked to see if its 8 - address is in the kernel space. 9 - 10 - Say N here to disable that check to improve the performance.
-60
arch/c6x/Makefile
··· 1 - # 2 - # linux/arch/c6x/Makefile 3 - # 4 - # This file is subject to the terms and conditions of the GNU General Public 5 - # License. See the file "COPYING" in the main directory of this archive 6 - # for more details. 7 - # 8 - 9 - KBUILD_DEFCONFIG := dsk6455_defconfig 10 - 11 - cflags-y += -mno-dsbt -msdata=none -D__linux__ 12 - 13 - cflags-$(CONFIG_C6X_BIG_KERNEL) += -mlong-calls 14 - 15 - KBUILD_CFLAGS_MODULE += -mlong-calls -mno-dsbt -msdata=none 16 - 17 - CHECKFLAGS += 18 - 19 - KBUILD_CFLAGS += $(cflags-y) 20 - KBUILD_AFLAGS += $(cflags-y) 21 - 22 - ifdef CONFIG_CPU_BIG_ENDIAN 23 - KBUILD_CFLAGS += -mbig-endian 24 - KBUILD_AFLAGS += -mbig-endian 25 - LINKFLAGS += -mbig-endian 26 - KBUILD_LDFLAGS += -mbig-endian -EB 27 - CHECKFLAGS += -D_BIG_ENDIAN 28 - endif 29 - 30 - head-y := arch/c6x/kernel/head.o 31 - core-y += arch/c6x/kernel/ arch/c6x/mm/ arch/c6x/platforms/ 32 - libs-y += arch/c6x/lib/ 33 - 34 - # Default to vmlinux.bin, override when needed 35 - all: vmlinux.bin 36 - 37 - boot := arch/$(ARCH)/boot 38 - 39 - # Are we making a dtbImage.<boardname> target? If so, crack out the boardname 40 - DTB:=$(subst dtbImage.,,$(filter dtbImage.%, $(MAKECMDGOALS))) 41 - export DTB 42 - 43 - core-y += $(boot)/dts/ 44 - 45 - # With make 3.82 we cannot mix normal and wildcard targets 46 - 47 - vmlinux.bin: vmlinux 48 - $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 49 - 50 - dtbImage.%: vmlinux 51 - $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 52 - 53 - archclean: 54 - $(Q)$(MAKE) $(clean)=$(boot) 55 - 56 - define archhelp 57 - @echo ' vmlinux.bin - Binary kernel image (arch/$(ARCH)/boot/vmlinux.bin)' 58 - @echo ' dtbImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in' 59 - @echo ' - stripped elf with fdt blob' 60 - endef
-11
arch/c6x/boot/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # 3 - # Makefile for bootable kernel images 4 - # 5 - 6 - OBJCOPYFLAGS_vmlinux.bin := -O binary 7 - $(obj)/vmlinux.bin: vmlinux FORCE 8 - $(call if_changed,objcopy) 9 - 10 - $(obj)/dtbImage.%: vmlinux 11 - $(call if_changed,objcopy)
-16
arch/c6x/boot/dts/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # 3 - # Makefile for device trees 4 - # 5 - 6 - DTC_FLAGS ?= -p 1024 7 - 8 - dtb-$(CONFIG_SOC_TMS320C6455) += dsk6455.dtb 9 - dtb-$(CONFIG_SOC_TMS320C6457) += evmc6457.dtb 10 - dtb-$(CONFIG_SOC_TMS320C6472) += evmc6472.dtb 11 - dtb-$(CONFIG_SOC_TMS320C6474) += evmc6474.dtb 12 - dtb-$(CONFIG_SOC_TMS320C6678) += evmc6678.dtb 13 - 14 - ifneq ($(DTB),) 15 - obj-y += $(DTB).dtb.o 16 - endif
-57
arch/c6x/boot/dts/dsk6455.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * arch/c6x/boot/dts/dsk6455.dts 4 - * 5 - * DSK6455 Evaluation Platform For TMS320C6455 6 - * Copyright (C) 2011 Texas Instruments Incorporated 7 - * 8 - * Author: Mark Salter <msalter@redhat.com> 9 - */ 10 - 11 - /dts-v1/; 12 - 13 - /include/ "tms320c6455.dtsi" 14 - 15 - / { 16 - model = "Spectrum Digital DSK6455"; 17 - compatible = "spectrum-digital,dsk6455"; 18 - 19 - chosen { 20 - bootargs = "root=/dev/nfs ip=dhcp rw"; 21 - }; 22 - 23 - memory { 24 - device_type = "memory"; 25 - reg = <0xE0000000 0x08000000>; 26 - }; 27 - 28 - soc { 29 - megamod_pic: interrupt-controller@1800000 { 30 - interrupts = < 12 13 14 15 >; 31 - }; 32 - 33 - emifa@70000000 { 34 - flash@3,0 { 35 - #address-cells = <1>; 36 - #size-cells = <1>; 37 - compatible = "cfi-flash"; 38 - reg = <0x3 0x0 0x400000>; 39 - bank-width = <1>; 40 - device-width = <1>; 41 - partition@0 { 42 - reg = <0x0 0x400000>; 43 - label = "NOR"; 44 - }; 45 - }; 46 - }; 47 - 48 - timer1: timer@2980000 { 49 - interrupt-parent = <&megamod_pic>; 50 - interrupts = < 69 >; 51 - }; 52 - 53 - clock-controller@029a0000 { 54 - clock-frequency = <50000000>; 55 - }; 56 - }; 57 - };
-43
arch/c6x/boot/dts/evmc6457.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * arch/c6x/boot/dts/evmc6457.dts 4 - * 5 - * EVMC6457 Evaluation Platform For TMS320C6457 6 - * 7 - * Copyright (C) 2011 Texas Instruments Incorporated 8 - * 9 - * Author: Mark Salter <msalter@redhat.com> 10 - */ 11 - 12 - /dts-v1/; 13 - 14 - /include/ "tms320c6457.dtsi" 15 - 16 - / { 17 - model = "eInfochips EVMC6457"; 18 - compatible = "einfochips,evmc6457"; 19 - 20 - chosen { 21 - bootargs = "console=hvc root=/dev/nfs ip=dhcp rw"; 22 - }; 23 - 24 - memory { 25 - device_type = "memory"; 26 - reg = <0xE0000000 0x10000000>; 27 - }; 28 - 29 - soc { 30 - megamod_pic: interrupt-controller@1800000 { 31 - interrupts = < 12 13 14 15 >; 32 - }; 33 - 34 - timer0: timer@2940000 { 35 - interrupt-parent = <&megamod_pic>; 36 - interrupts = < 67 >; 37 - }; 38 - 39 - clock-controller@29a0000 { 40 - clock-frequency = <60000000>; 41 - }; 42 - }; 43 - };
-68
arch/c6x/boot/dts/evmc6472.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * arch/c6x/boot/dts/evmc6472.dts 4 - * 5 - * EVMC6472 Evaluation Platform For TMS320C6472 6 - * 7 - * Copyright (C) 2011 Texas Instruments Incorporated 8 - * 9 - * Author: Mark Salter <msalter@redhat.com> 10 - */ 11 - 12 - /dts-v1/; 13 - 14 - /include/ "tms320c6472.dtsi" 15 - 16 - / { 17 - model = "eInfochips EVMC6472"; 18 - compatible = "einfochips,evmc6472"; 19 - 20 - chosen { 21 - bootargs = "console=hvc root=/dev/nfs ip=dhcp rw"; 22 - }; 23 - 24 - memory { 25 - device_type = "memory"; 26 - reg = <0xE0000000 0x10000000>; 27 - }; 28 - 29 - soc { 30 - megamod_pic: interrupt-controller@1800000 { 31 - interrupts = < 12 13 14 15 >; 32 - }; 33 - 34 - timer0: timer@25e0000 { 35 - interrupt-parent = <&megamod_pic>; 36 - interrupts = < 16 >; 37 - }; 38 - 39 - timer1: timer@25f0000 { 40 - interrupt-parent = <&megamod_pic>; 41 - interrupts = < 16 >; 42 - }; 43 - 44 - timer2: timer@2600000 { 45 - interrupt-parent = <&megamod_pic>; 46 - interrupts = < 16 >; 47 - }; 48 - 49 - timer3: timer@2610000 { 50 - interrupt-parent = <&megamod_pic>; 51 - interrupts = < 16 >; 52 - }; 53 - 54 - timer4: timer@2620000 { 55 - interrupt-parent = <&megamod_pic>; 56 - interrupts = < 16 >; 57 - }; 58 - 59 - timer5: timer@2630000 { 60 - interrupt-parent = <&megamod_pic>; 61 - interrupts = < 16 >; 62 - }; 63 - 64 - clock-controller@29a0000 { 65 - clock-frequency = <25000000>; 66 - }; 67 - }; 68 - };
-53
arch/c6x/boot/dts/evmc6474.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * arch/c6x/boot/dts/evmc6474.dts 4 - * 5 - * EVMC6474 Evaluation Platform For TMS320C6474 6 - * 7 - * Copyright (C) 2011 Texas Instruments Incorporated 8 - * 9 - * Author: Mark Salter <msalter@redhat.com> 10 - */ 11 - 12 - /dts-v1/; 13 - 14 - /include/ "tms320c6474.dtsi" 15 - 16 - / { 17 - model = "Spectrum Digital EVMC6474"; 18 - compatible = "spectrum-digital,evmc6474"; 19 - 20 - chosen { 21 - bootargs = "console=hvc root=/dev/nfs ip=dhcp rw"; 22 - }; 23 - 24 - memory { 25 - device_type = "memory"; 26 - reg = <0x80000000 0x08000000>; 27 - }; 28 - 29 - soc { 30 - megamod_pic: interrupt-controller@1800000 { 31 - interrupts = < 12 13 14 15 >; 32 - }; 33 - 34 - timer3: timer@2940000 { 35 - interrupt-parent = <&megamod_pic>; 36 - interrupts = < 39 >; 37 - }; 38 - 39 - timer4: timer@2950000 { 40 - interrupt-parent = <&megamod_pic>; 41 - interrupts = < 41 >; 42 - }; 43 - 44 - timer5: timer@2960000 { 45 - interrupt-parent = <&megamod_pic>; 46 - interrupts = < 43 >; 47 - }; 48 - 49 - clock-controller@29a0000 { 50 - clock-frequency = <50000000>; 51 - }; 52 - }; 53 - };
-78
arch/c6x/boot/dts/evmc6678.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * arch/c6x/boot/dts/evmc6678.dts 4 - * 5 - * EVMC6678 Evaluation Platform For TMS320C6678 6 - * 7 - * Copyright (C) 2012 Texas Instruments Incorporated 8 - * 9 - * Author: Ken Cox <jkc@redhat.com> 10 - */ 11 - 12 - /dts-v1/; 13 - 14 - /include/ "tms320c6678.dtsi" 15 - 16 - / { 17 - model = "Advantech EVMC6678"; 18 - compatible = "advantech,evmc6678"; 19 - 20 - chosen { 21 - bootargs = "root=/dev/nfs ip=dhcp rw"; 22 - }; 23 - 24 - memory { 25 - device_type = "memory"; 26 - reg = <0x80000000 0x20000000>; 27 - }; 28 - 29 - soc { 30 - megamod_pic: interrupt-controller@1800000 { 31 - interrupts = < 12 13 14 15 >; 32 - }; 33 - 34 - timer8: timer@2280000 { 35 - interrupt-parent = <&megamod_pic>; 36 - interrupts = < 66 >; 37 - }; 38 - 39 - timer9: timer@2290000 { 40 - interrupt-parent = <&megamod_pic>; 41 - interrupts = < 68 >; 42 - }; 43 - 44 - timer10: timer@22A0000 { 45 - interrupt-parent = <&megamod_pic>; 46 - interrupts = < 70 >; 47 - }; 48 - 49 - timer11: timer@22B0000 { 50 - interrupt-parent = <&megamod_pic>; 51 - interrupts = < 72 >; 52 - }; 53 - 54 - timer12: timer@22C0000 { 55 - interrupt-parent = <&megamod_pic>; 56 - interrupts = < 74 >; 57 - }; 58 - 59 - timer13: timer@22D0000 { 60 - interrupt-parent = <&megamod_pic>; 61 - interrupts = < 76 >; 62 - }; 63 - 64 - timer14: timer@22E0000 { 65 - interrupt-parent = <&megamod_pic>; 66 - interrupts = < 78 >; 67 - }; 68 - 69 - timer15: timer@22F0000 { 70 - interrupt-parent = <&megamod_pic>; 71 - interrupts = < 80 >; 72 - }; 73 - 74 - clock-controller@2310000 { 75 - clock-frequency = <100000000>; 76 - }; 77 - }; 78 - };
-97
arch/c6x/boot/dts/tms320c6455.dtsi
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - 3 - / { 4 - #address-cells = <1>; 5 - #size-cells = <1>; 6 - 7 - cpus { 8 - #address-cells = <1>; 9 - #size-cells = <0>; 10 - 11 - cpu@0 { 12 - device_type = "cpu"; 13 - model = "ti,c64x+"; 14 - reg = <0>; 15 - }; 16 - }; 17 - 18 - soc { 19 - compatible = "simple-bus"; 20 - model = "tms320c6455"; 21 - #address-cells = <1>; 22 - #size-cells = <1>; 23 - ranges; 24 - 25 - core_pic: interrupt-controller { 26 - interrupt-controller; 27 - #interrupt-cells = <1>; 28 - compatible = "ti,c64x+core-pic"; 29 - }; 30 - 31 - /* 32 - * Megamodule interrupt controller 33 - */ 34 - megamod_pic: interrupt-controller@1800000 { 35 - compatible = "ti,c64x+megamod-pic"; 36 - interrupt-controller; 37 - #interrupt-cells = <1>; 38 - reg = <0x1800000 0x1000>; 39 - interrupt-parent = <&core_pic>; 40 - }; 41 - 42 - cache-controller@1840000 { 43 - compatible = "ti,c64x+cache"; 44 - reg = <0x01840000 0x8400>; 45 - }; 46 - 47 - emifa@70000000 { 48 - compatible = "ti,c64x+emifa", "simple-bus"; 49 - #address-cells = <2>; 50 - #size-cells = <1>; 51 - reg = <0x70000000 0x100>; 52 - ranges = <0x2 0x0 0xa0000000 0x00000008 53 - 0x3 0x0 0xb0000000 0x00400000 54 - 0x4 0x0 0xc0000000 0x10000000 55 - 0x5 0x0 0xD0000000 0x10000000>; 56 - 57 - ti,dscr-dev-enable = <13>; 58 - ti,emifa-burst-priority = <255>; 59 - ti,emifa-ce-config = <0x00240120 60 - 0x00240120 61 - 0x00240122 62 - 0x00240122>; 63 - }; 64 - 65 - timer1: timer@2980000 { 66 - compatible = "ti,c64x+timer64"; 67 - reg = <0x2980000 0x40>; 68 - ti,dscr-dev-enable = <4>; 69 - }; 70 - 71 - clock-controller@029a0000 { 72 - compatible = "ti,c6455-pll", "ti,c64x+pll"; 73 - reg = <0x029a0000 0x200>; 74 - ti,c64x+pll-bypass-delay = <1440>; 75 - ti,c64x+pll-reset-delay = <15360>; 76 - ti,c64x+pll-lock-delay = <24000>; 77 - }; 78 - 79 - device-state-config-regs@2a80000 { 80 - compatible = "ti,c64x+dscr"; 81 - reg = <0x02a80000 0x41000>; 82 - 83 - ti,dscr-devstat = <0>; 84 - ti,dscr-silicon-rev = <8 28 0xf>; 85 - ti,dscr-rmii-resets = <0 0x40020 0x00040000>; 86 - 87 - ti,dscr-locked-regs = <0x40008 0x40004 0x0f0a0b00>; 88 - ti,dscr-devstate-ctl-regs = 89 - <0 12 0x40008 1 0 0 2 90 - 12 1 0x40008 3 0 30 2 91 - 13 2 0x4002c 1 0xffffffff 0 1>; 92 - ti,dscr-devstate-stat-regs = 93 - <0 10 0x40014 1 0 0 3 94 - 10 2 0x40018 1 0 0 3>; 95 - }; 96 - }; 97 - };
-69
arch/c6x/boot/dts/tms320c6457.dtsi
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - 3 - / { 4 - #address-cells = <1>; 5 - #size-cells = <1>; 6 - 7 - cpus { 8 - #address-cells = <1>; 9 - #size-cells = <0>; 10 - 11 - cpu@0 { 12 - device_type = "cpu"; 13 - model = "ti,c64x+"; 14 - reg = <0>; 15 - }; 16 - }; 17 - 18 - soc { 19 - compatible = "simple-bus"; 20 - model = "tms320c6457"; 21 - #address-cells = <1>; 22 - #size-cells = <1>; 23 - ranges; 24 - 25 - core_pic: interrupt-controller { 26 - interrupt-controller; 27 - #interrupt-cells = <1>; 28 - compatible = "ti,c64x+core-pic"; 29 - }; 30 - 31 - megamod_pic: interrupt-controller@1800000 { 32 - compatible = "ti,c64x+megamod-pic"; 33 - interrupt-controller; 34 - #interrupt-cells = <1>; 35 - interrupt-parent = <&core_pic>; 36 - reg = <0x1800000 0x1000>; 37 - }; 38 - 39 - cache-controller@1840000 { 40 - compatible = "ti,c64x+cache"; 41 - reg = <0x01840000 0x8400>; 42 - }; 43 - 44 - device-state-controller@2880800 { 45 - compatible = "ti,c64x+dscr"; 46 - reg = <0x02880800 0x400>; 47 - 48 - ti,dscr-devstat = <0x20>; 49 - ti,dscr-silicon-rev = <0x18 28 0xf>; 50 - ti,dscr-mac-fuse-regs = <0x114 3 4 5 6 51 - 0x118 0 0 1 2>; 52 - ti,dscr-kick-regs = <0x38 0x83E70B13 53 - 0x3c 0x95A4F1E0>; 54 - }; 55 - 56 - timer0: timer@2940000 { 57 - compatible = "ti,c64x+timer64"; 58 - reg = <0x2940000 0x40>; 59 - }; 60 - 61 - clock-controller@29a0000 { 62 - compatible = "ti,c6457-pll", "ti,c64x+pll"; 63 - reg = <0x029a0000 0x200>; 64 - ti,c64x+pll-bypass-delay = <300>; 65 - ti,c64x+pll-reset-delay = <24000>; 66 - ti,c64x+pll-lock-delay = <50000>; 67 - }; 68 - }; 69 - };
-135
arch/c6x/boot/dts/tms320c6472.dtsi
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - 3 - / { 4 - #address-cells = <1>; 5 - #size-cells = <1>; 6 - 7 - cpus { 8 - #address-cells = <1>; 9 - #size-cells = <0>; 10 - 11 - cpu@0 { 12 - device_type = "cpu"; 13 - reg = <0>; 14 - model = "ti,c64x+"; 15 - }; 16 - cpu@1 { 17 - device_type = "cpu"; 18 - reg = <1>; 19 - model = "ti,c64x+"; 20 - }; 21 - cpu@2 { 22 - device_type = "cpu"; 23 - reg = <2>; 24 - model = "ti,c64x+"; 25 - }; 26 - cpu@3 { 27 - device_type = "cpu"; 28 - reg = <3>; 29 - model = "ti,c64x+"; 30 - }; 31 - cpu@4 { 32 - device_type = "cpu"; 33 - reg = <4>; 34 - model = "ti,c64x+"; 35 - }; 36 - cpu@5 { 37 - device_type = "cpu"; 38 - reg = <5>; 39 - model = "ti,c64x+"; 40 - }; 41 - }; 42 - 43 - soc { 44 - compatible = "simple-bus"; 45 - model = "tms320c6472"; 46 - #address-cells = <1>; 47 - #size-cells = <1>; 48 - ranges; 49 - 50 - core_pic: interrupt-controller { 51 - compatible = "ti,c64x+core-pic"; 52 - interrupt-controller; 53 - #interrupt-cells = <1>; 54 - }; 55 - 56 - megamod_pic: interrupt-controller@1800000 { 57 - compatible = "ti,c64x+megamod-pic"; 58 - interrupt-controller; 59 - #interrupt-cells = <1>; 60 - reg = <0x1800000 0x1000>; 61 - interrupt-parent = <&core_pic>; 62 - }; 63 - 64 - cache-controller@1840000 { 65 - compatible = "ti,c64x+cache"; 66 - reg = <0x01840000 0x8400>; 67 - }; 68 - 69 - timer0: timer@25e0000 { 70 - compatible = "ti,c64x+timer64"; 71 - ti,core-mask = < 0x01 >; 72 - reg = <0x25e0000 0x40>; 73 - }; 74 - 75 - timer1: timer@25f0000 { 76 - compatible = "ti,c64x+timer64"; 77 - ti,core-mask = < 0x02 >; 78 - reg = <0x25f0000 0x40>; 79 - }; 80 - 81 - timer2: timer@2600000 { 82 - compatible = "ti,c64x+timer64"; 83 - ti,core-mask = < 0x04 >; 84 - reg = <0x2600000 0x40>; 85 - }; 86 - 87 - timer3: timer@2610000 { 88 - compatible = "ti,c64x+timer64"; 89 - ti,core-mask = < 0x08 >; 90 - reg = <0x2610000 0x40>; 91 - }; 92 - 93 - timer4: timer@2620000 { 94 - compatible = "ti,c64x+timer64"; 95 - ti,core-mask = < 0x10 >; 96 - reg = <0x2620000 0x40>; 97 - }; 98 - 99 - timer5: timer@2630000 { 100 - compatible = "ti,c64x+timer64"; 101 - ti,core-mask = < 0x20 >; 102 - reg = <0x2630000 0x40>; 103 - }; 104 - 105 - clock-controller@29a0000 { 106 - compatible = "ti,c6472-pll", "ti,c64x+pll"; 107 - reg = <0x029a0000 0x200>; 108 - ti,c64x+pll-bypass-delay = <200>; 109 - ti,c64x+pll-reset-delay = <12000>; 110 - ti,c64x+pll-lock-delay = <80000>; 111 - }; 112 - 113 - device-state-controller@2a80000 { 114 - compatible = "ti,c64x+dscr"; 115 - reg = <0x02a80000 0x1000>; 116 - 117 - ti,dscr-devstat = <0>; 118 - ti,dscr-silicon-rev = <0x70c 16 0xff>; 119 - 120 - ti,dscr-mac-fuse-regs = <0x700 1 2 3 4 121 - 0x704 5 6 0 0>; 122 - 123 - ti,dscr-rmii-resets = <0x208 1 124 - 0x20c 1>; 125 - 126 - ti,dscr-locked-regs = <0x200 0x204 0x0a1e183a 127 - 0x40c 0x420 0xbea7 128 - 0x41c 0x420 0xbea7>; 129 - 130 - ti,dscr-privperm = <0x41c 0xaaaaaaaa>; 131 - 132 - ti,dscr-devstate-ctl-regs = <0 13 0x200 1 0 0 1>; 133 - }; 134 - }; 135 - };
-90
arch/c6x/boot/dts/tms320c6474.dtsi
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - 3 - / { 4 - #address-cells = <1>; 5 - #size-cells = <1>; 6 - 7 - cpus { 8 - #address-cells = <1>; 9 - #size-cells = <0>; 10 - 11 - cpu@0 { 12 - device_type = "cpu"; 13 - reg = <0>; 14 - model = "ti,c64x+"; 15 - }; 16 - cpu@1 { 17 - device_type = "cpu"; 18 - reg = <1>; 19 - model = "ti,c64x+"; 20 - }; 21 - cpu@2 { 22 - device_type = "cpu"; 23 - reg = <2>; 24 - model = "ti,c64x+"; 25 - }; 26 - }; 27 - 28 - soc { 29 - compatible = "simple-bus"; 30 - model = "tms320c6474"; 31 - #address-cells = <1>; 32 - #size-cells = <1>; 33 - ranges; 34 - 35 - core_pic: interrupt-controller { 36 - interrupt-controller; 37 - #interrupt-cells = <1>; 38 - compatible = "ti,c64x+core-pic"; 39 - }; 40 - 41 - megamod_pic: interrupt-controller@1800000 { 42 - compatible = "ti,c64x+megamod-pic"; 43 - interrupt-controller; 44 - #interrupt-cells = <1>; 45 - reg = <0x1800000 0x1000>; 46 - interrupt-parent = <&core_pic>; 47 - }; 48 - 49 - cache-controller@1840000 { 50 - compatible = "ti,c64x+cache"; 51 - reg = <0x01840000 0x8400>; 52 - }; 53 - 54 - timer3: timer@2940000 { 55 - compatible = "ti,c64x+timer64"; 56 - ti,core-mask = < 0x04 >; 57 - reg = <0x2940000 0x40>; 58 - }; 59 - 60 - timer4: timer@2950000 { 61 - compatible = "ti,c64x+timer64"; 62 - ti,core-mask = < 0x02 >; 63 - reg = <0x2950000 0x40>; 64 - }; 65 - 66 - timer5: timer@2960000 { 67 - compatible = "ti,c64x+timer64"; 68 - ti,core-mask = < 0x01 >; 69 - reg = <0x2960000 0x40>; 70 - }; 71 - 72 - device-state-controller@2880800 { 73 - compatible = "ti,c64x+dscr"; 74 - reg = <0x02880800 0x400>; 75 - 76 - ti,dscr-devstat = <0x004>; 77 - ti,dscr-silicon-rev = <0x014 28 0xf>; 78 - ti,dscr-mac-fuse-regs = <0x34 3 4 5 6 79 - 0x38 0 0 1 2>; 80 - }; 81 - 82 - clock-controller@29a0000 { 83 - compatible = "ti,c6474-pll", "ti,c64x+pll"; 84 - reg = <0x029a0000 0x200>; 85 - ti,c64x+pll-bypass-delay = <120>; 86 - ti,c64x+pll-reset-delay = <30000>; 87 - ti,c64x+pll-lock-delay = <60000>; 88 - }; 89 - }; 90 - };
-147
arch/c6x/boot/dts/tms320c6678.dtsi
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - 3 - / { 4 - #address-cells = <1>; 5 - #size-cells = <1>; 6 - 7 - cpus { 8 - #address-cells = <1>; 9 - #size-cells = <0>; 10 - 11 - cpu@0 { 12 - device_type = "cpu"; 13 - reg = <0>; 14 - model = "ti,c66x"; 15 - }; 16 - cpu@1 { 17 - device_type = "cpu"; 18 - reg = <1>; 19 - model = "ti,c66x"; 20 - }; 21 - cpu@2 { 22 - device_type = "cpu"; 23 - reg = <2>; 24 - model = "ti,c66x"; 25 - }; 26 - cpu@3 { 27 - device_type = "cpu"; 28 - reg = <3>; 29 - model = "ti,c66x"; 30 - }; 31 - cpu@4 { 32 - device_type = "cpu"; 33 - reg = <4>; 34 - model = "ti,c66x"; 35 - }; 36 - cpu@5 { 37 - device_type = "cpu"; 38 - reg = <5>; 39 - model = "ti,c66x"; 40 - }; 41 - cpu@6 { 42 - device_type = "cpu"; 43 - reg = <6>; 44 - model = "ti,c66x"; 45 - }; 46 - cpu@7 { 47 - device_type = "cpu"; 48 - reg = <7>; 49 - model = "ti,c66x"; 50 - }; 51 - }; 52 - 53 - soc { 54 - compatible = "simple-bus"; 55 - model = "tms320c6678"; 56 - #address-cells = <1>; 57 - #size-cells = <1>; 58 - ranges; 59 - 60 - core_pic: interrupt-controller { 61 - compatible = "ti,c64x+core-pic"; 62 - interrupt-controller; 63 - #interrupt-cells = <1>; 64 - }; 65 - 66 - megamod_pic: interrupt-controller@1800000 { 67 - compatible = "ti,c64x+megamod-pic"; 68 - interrupt-controller; 69 - #interrupt-cells = <1>; 70 - reg = <0x1800000 0x1000>; 71 - interrupt-parent = <&core_pic>; 72 - }; 73 - 74 - cache-controller@1840000 { 75 - compatible = "ti,c64x+cache"; 76 - reg = <0x01840000 0x8400>; 77 - }; 78 - 79 - timer8: timer@2280000 { 80 - compatible = "ti,c64x+timer64"; 81 - ti,core-mask = < 0x01 >; 82 - reg = <0x2280000 0x40>; 83 - }; 84 - 85 - timer9: timer@2290000 { 86 - compatible = "ti,c64x+timer64"; 87 - ti,core-mask = < 0x02 >; 88 - reg = <0x2290000 0x40>; 89 - }; 90 - 91 - timer10: timer@22A0000 { 92 - compatible = "ti,c64x+timer64"; 93 - ti,core-mask = < 0x04 >; 94 - reg = <0x22A0000 0x40>; 95 - }; 96 - 97 - timer11: timer@22B0000 { 98 - compatible = "ti,c64x+timer64"; 99 - ti,core-mask = < 0x08 >; 100 - reg = <0x22B0000 0x40>; 101 - }; 102 - 103 - timer12: timer@22C0000 { 104 - compatible = "ti,c64x+timer64"; 105 - ti,core-mask = < 0x10 >; 106 - reg = <0x22C0000 0x40>; 107 - }; 108 - 109 - timer13: timer@22D0000 { 110 - compatible = "ti,c64x+timer64"; 111 - ti,core-mask = < 0x20 >; 112 - reg = <0x22D0000 0x40>; 113 - }; 114 - 115 - timer14: timer@22E0000 { 116 - compatible = "ti,c64x+timer64"; 117 - ti,core-mask = < 0x40 >; 118 - reg = <0x22E0000 0x40>; 119 - }; 120 - 121 - timer15: timer@22F0000 { 122 - compatible = "ti,c64x+timer64"; 123 - ti,core-mask = < 0x80 >; 124 - reg = <0x22F0000 0x40>; 125 - }; 126 - 127 - clock-controller@2310000 { 128 - compatible = "ti,c6678-pll", "ti,c64x+pll"; 129 - reg = <0x02310000 0x200>; 130 - ti,c64x+pll-bypass-delay = <200>; 131 - ti,c64x+pll-reset-delay = <12000>; 132 - ti,c64x+pll-lock-delay = <80000>; 133 - }; 134 - 135 - device-state-controller@2620000 { 136 - compatible = "ti,c64x+dscr"; 137 - reg = <0x02620000 0x1000>; 138 - 139 - ti,dscr-devstat = <0x20>; 140 - ti,dscr-silicon-rev = <0x18 28 0xf>; 141 - 142 - ti,dscr-mac-fuse-regs = <0x110 1 2 3 4 143 - 0x114 5 6 0 0>; 144 - 145 - }; 146 - }; 147 - };
-42
arch/c6x/configs/dsk6455_defconfig
··· 1 - CONFIG_SOC_TMS320C6455=y 2 - # CONFIG_LOCALVERSION_AUTO is not set 3 - CONFIG_SYSVIPC=y 4 - CONFIG_SPARSE_IRQ=y 5 - CONFIG_LOG_BUF_SHIFT=14 6 - CONFIG_NAMESPACES=y 7 - # CONFIG_UTS_NS is not set 8 - # CONFIG_USER_NS is not set 9 - # CONFIG_PID_NS is not set 10 - CONFIG_BLK_DEV_INITRD=y 11 - CONFIG_CC_OPTIMIZE_FOR_SIZE=y 12 - CONFIG_EXPERT=y 13 - # CONFIG_FUTEX is not set 14 - # CONFIG_SLUB_DEBUG is not set 15 - CONFIG_MODULES=y 16 - CONFIG_MODULE_FORCE_LOAD=y 17 - CONFIG_MODULE_UNLOAD=y 18 - CONFIG_MODULE_FORCE_UNLOAD=y 19 - CONFIG_CMDLINE_BOOL=y 20 - CONFIG_CMDLINE="" 21 - CONFIG_NO_HZ=y 22 - CONFIG_HIGH_RES_TIMERS=y 23 - CONFIG_BLK_DEV_LOOP=y 24 - CONFIG_BLK_DEV_RAM=y 25 - CONFIG_BLK_DEV_RAM_COUNT=2 26 - CONFIG_BLK_DEV_RAM_SIZE=17000 27 - # CONFIG_INPUT is not set 28 - # CONFIG_SERIO is not set 29 - # CONFIG_VT is not set 30 - # CONFIG_HW_RANDOM is not set 31 - # CONFIG_HWMON is not set 32 - # CONFIG_USB_SUPPORT is not set 33 - # CONFIG_IOMMU_SUPPORT is not set 34 - # CONFIG_MISC_FILESYSTEMS is not set 35 - CONFIG_CRC16=y 36 - # CONFIG_ENABLE_MUST_CHECK is not set 37 - # CONFIG_SCHED_DEBUG is not set 38 - # CONFIG_DEBUG_BUGVERBOSE is not set 39 - CONFIG_MTD=y 40 - CONFIG_MTD_CFI=y 41 - CONFIG_MTD_CFI_AMDSTD=y 42 - CONFIG_MTD_PHYSMAP_OF=y
-39
arch/c6x/configs/evmc6457_defconfig
··· 1 - CONFIG_SOC_TMS320C6457=y 2 - # CONFIG_LOCALVERSION_AUTO is not set 3 - CONFIG_SYSVIPC=y 4 - CONFIG_SPARSE_IRQ=y 5 - CONFIG_LOG_BUF_SHIFT=14 6 - CONFIG_NAMESPACES=y 7 - # CONFIG_UTS_NS is not set 8 - # CONFIG_USER_NS is not set 9 - # CONFIG_PID_NS is not set 10 - CONFIG_BLK_DEV_INITRD=y 11 - CONFIG_CC_OPTIMIZE_FOR_SIZE=y 12 - CONFIG_EXPERT=y 13 - # CONFIG_FUTEX is not set 14 - # CONFIG_SLUB_DEBUG is not set 15 - CONFIG_MODULES=y 16 - CONFIG_MODULE_FORCE_LOAD=y 17 - CONFIG_MODULE_UNLOAD=y 18 - CONFIG_MODULE_FORCE_UNLOAD=y 19 - CONFIG_CMDLINE_BOOL=y 20 - CONFIG_CMDLINE="" 21 - CONFIG_BOARD_EVM6457=y 22 - CONFIG_NO_HZ=y 23 - CONFIG_HIGH_RES_TIMERS=y 24 - CONFIG_BLK_DEV_LOOP=y 25 - CONFIG_BLK_DEV_RAM=y 26 - CONFIG_BLK_DEV_RAM_COUNT=2 27 - CONFIG_BLK_DEV_RAM_SIZE=17000 28 - # CONFIG_INPUT is not set 29 - # CONFIG_SERIO is not set 30 - # CONFIG_VT is not set 31 - # CONFIG_HW_RANDOM is not set 32 - # CONFIG_HWMON is not set 33 - # CONFIG_USB_SUPPORT is not set 34 - # CONFIG_IOMMU_SUPPORT is not set 35 - # CONFIG_MISC_FILESYSTEMS is not set 36 - CONFIG_CRC16=y 37 - # CONFIG_ENABLE_MUST_CHECK is not set 38 - # CONFIG_SCHED_DEBUG is not set 39 - # CONFIG_DEBUG_BUGVERBOSE is not set
-40
arch/c6x/configs/evmc6472_defconfig
··· 1 - CONFIG_SOC_TMS320C6472=y 2 - # CONFIG_LOCALVERSION_AUTO is not set 3 - CONFIG_SYSVIPC=y 4 - CONFIG_SPARSE_IRQ=y 5 - CONFIG_LOG_BUF_SHIFT=14 6 - CONFIG_NAMESPACES=y 7 - # CONFIG_UTS_NS is not set 8 - # CONFIG_USER_NS is not set 9 - # CONFIG_PID_NS is not set 10 - CONFIG_BLK_DEV_INITRD=y 11 - CONFIG_CC_OPTIMIZE_FOR_SIZE=y 12 - CONFIG_EXPERT=y 13 - # CONFIG_FUTEX is not set 14 - # CONFIG_SLUB_DEBUG is not set 15 - CONFIG_MODULES=y 16 - CONFIG_MODULE_FORCE_LOAD=y 17 - CONFIG_MODULE_UNLOAD=y 18 - CONFIG_MODULE_FORCE_UNLOAD=y 19 - CONFIG_CMDLINE_BOOL=y 20 - CONFIG_CMDLINE="" 21 - # CONFIG_CMDLINE_FORCE is not set 22 - CONFIG_BOARD_EVM6472=y 23 - CONFIG_NO_HZ=y 24 - CONFIG_HIGH_RES_TIMERS=y 25 - CONFIG_BLK_DEV_LOOP=y 26 - CONFIG_BLK_DEV_RAM=y 27 - CONFIG_BLK_DEV_RAM_COUNT=2 28 - CONFIG_BLK_DEV_RAM_SIZE=17000 29 - # CONFIG_INPUT is not set 30 - # CONFIG_SERIO is not set 31 - # CONFIG_VT is not set 32 - # CONFIG_HW_RANDOM is not set 33 - # CONFIG_HWMON is not set 34 - # CONFIG_USB_SUPPORT is not set 35 - # CONFIG_IOMMU_SUPPORT is not set 36 - # CONFIG_MISC_FILESYSTEMS is not set 37 - CONFIG_CRC16=y 38 - # CONFIG_ENABLE_MUST_CHECK is not set 39 - # CONFIG_SCHED_DEBUG is not set 40 - # CONFIG_DEBUG_BUGVERBOSE is not set
-40
arch/c6x/configs/evmc6474_defconfig
··· 1 - CONFIG_SOC_TMS320C6474=y 2 - # CONFIG_LOCALVERSION_AUTO is not set 3 - CONFIG_SYSVIPC=y 4 - CONFIG_SPARSE_IRQ=y 5 - CONFIG_LOG_BUF_SHIFT=14 6 - CONFIG_NAMESPACES=y 7 - # CONFIG_UTS_NS is not set 8 - # CONFIG_USER_NS is not set 9 - # CONFIG_PID_NS is not set 10 - CONFIG_BLK_DEV_INITRD=y 11 - CONFIG_CC_OPTIMIZE_FOR_SIZE=y 12 - CONFIG_EXPERT=y 13 - # CONFIG_FUTEX is not set 14 - # CONFIG_SLUB_DEBUG is not set 15 - CONFIG_MODULES=y 16 - CONFIG_MODULE_FORCE_LOAD=y 17 - CONFIG_MODULE_UNLOAD=y 18 - CONFIG_MODULE_FORCE_UNLOAD=y 19 - CONFIG_CMDLINE_BOOL=y 20 - CONFIG_CMDLINE="" 21 - # CONFIG_CMDLINE_FORCE is not set 22 - CONFIG_BOARD_EVM6474=y 23 - CONFIG_NO_HZ=y 24 - CONFIG_HIGH_RES_TIMERS=y 25 - CONFIG_BLK_DEV_LOOP=y 26 - CONFIG_BLK_DEV_RAM=y 27 - CONFIG_BLK_DEV_RAM_COUNT=2 28 - CONFIG_BLK_DEV_RAM_SIZE=17000 29 - # CONFIG_INPUT is not set 30 - # CONFIG_SERIO is not set 31 - # CONFIG_VT is not set 32 - # CONFIG_HW_RANDOM is not set 33 - # CONFIG_HWMON is not set 34 - # CONFIG_USB_SUPPORT is not set 35 - # CONFIG_IOMMU_SUPPORT is not set 36 - # CONFIG_MISC_FILESYSTEMS is not set 37 - CONFIG_CRC16=y 38 - # CONFIG_ENABLE_MUST_CHECK is not set 39 - # CONFIG_SCHED_DEBUG is not set 40 - # CONFIG_DEBUG_BUGVERBOSE is not set
-40
arch/c6x/configs/evmc6678_defconfig
··· 1 - CONFIG_SOC_TMS320C6678=y 2 - # CONFIG_LOCALVERSION_AUTO is not set 3 - CONFIG_SYSVIPC=y 4 - CONFIG_SPARSE_IRQ=y 5 - CONFIG_LOG_BUF_SHIFT=14 6 - CONFIG_NAMESPACES=y 7 - # CONFIG_UTS_NS is not set 8 - # CONFIG_USER_NS is not set 9 - # CONFIG_PID_NS is not set 10 - CONFIG_BLK_DEV_INITRD=y 11 - CONFIG_CC_OPTIMIZE_FOR_SIZE=y 12 - CONFIG_EXPERT=y 13 - # CONFIG_FUTEX is not set 14 - # CONFIG_SLUB_DEBUG is not set 15 - CONFIG_MODULES=y 16 - CONFIG_MODULE_FORCE_LOAD=y 17 - CONFIG_MODULE_UNLOAD=y 18 - CONFIG_MODULE_FORCE_UNLOAD=y 19 - CONFIG_CMDLINE_BOOL=y 20 - CONFIG_CMDLINE="" 21 - # CONFIG_CMDLINE_FORCE is not set 22 - CONFIG_BOARD_EVM6678=y 23 - CONFIG_NO_HZ=y 24 - CONFIG_HIGH_RES_TIMERS=y 25 - CONFIG_BLK_DEV_LOOP=y 26 - CONFIG_BLK_DEV_RAM=y 27 - CONFIG_BLK_DEV_RAM_COUNT=2 28 - CONFIG_BLK_DEV_RAM_SIZE=17000 29 - # CONFIG_INPUT is not set 30 - # CONFIG_SERIO is not set 31 - # CONFIG_VT is not set 32 - # CONFIG_HW_RANDOM is not set 33 - # CONFIG_HWMON is not set 34 - # CONFIG_USB_SUPPORT is not set 35 - # CONFIG_IOMMU_SUPPORT is not set 36 - # CONFIG_MISC_FILESYSTEMS is not set 37 - CONFIG_CRC16=y 38 - # CONFIG_ENABLE_MUST_CHECK is not set 39 - # CONFIG_SCHED_DEBUG is not set 40 - # CONFIG_DEBUG_BUGVERBOSE is not set
-5
arch/c6x/include/asm/Kbuild
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - generic-y += extable.h 3 - generic-y += kvm_para.h 4 - generic-y += mcs_spinlock.h 5 - generic-y += user.h
-1
arch/c6x/include/asm/asm-offsets.h
··· 1 - #include <generated/asm-offsets.h>
-95
arch/c6x/include/asm/bitops.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_BITOPS_H 9 - #define _ASM_C6X_BITOPS_H 10 - 11 - #ifdef __KERNEL__ 12 - 13 - #include <linux/bitops.h> 14 - #include <asm/byteorder.h> 15 - #include <asm/barrier.h> 16 - 17 - /* 18 - * We are lucky, DSP is perfect for bitops: do it in 3 cycles 19 - */ 20 - 21 - /** 22 - * __ffs - find first bit in word. 23 - * @word: The word to search 24 - * 25 - * Undefined if no bit exists, so code should check against 0 first. 26 - * Note __ffs(0) = undef, __ffs(1) = 0, __ffs(0x80000000) = 31. 27 - * 28 - */ 29 - static inline unsigned long __ffs(unsigned long x) 30 - { 31 - asm (" bitr .M1 %0,%0\n" 32 - " nop\n" 33 - " lmbd .L1 1,%0,%0\n" 34 - : "+a"(x)); 35 - 36 - return x; 37 - } 38 - 39 - /* 40 - * ffz - find first zero in word. 41 - * @word: The word to search 42 - * 43 - * Undefined if no zero exists, so code should check against ~0UL first. 44 - */ 45 - #define ffz(x) __ffs(~(x)) 46 - 47 - /** 48 - * fls - find last (most-significant) bit set 49 - * @x: the word to search 50 - * 51 - * This is defined the same way as ffs. 52 - * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. 53 - */ 54 - static inline int fls(unsigned int x) 55 - { 56 - if (!x) 57 - return 0; 58 - 59 - asm (" lmbd .L1 1,%0,%0\n" : "+a"(x)); 60 - 61 - return 32 - x; 62 - } 63 - 64 - /** 65 - * ffs - find first bit set 66 - * @x: the word to search 67 - * 68 - * This is defined the same way as 69 - * the libc and compiler builtin ffs routines, therefore 70 - * differs in spirit from the above ffz (man ffs). 71 - * Note ffs(0) = 0, ffs(1) = 1, ffs(0x80000000) = 32. 72 - */ 73 - static inline int ffs(int x) 74 - { 75 - if (!x) 76 - return 0; 77 - 78 - return __ffs(x) + 1; 79 - } 80 - 81 - #include <asm-generic/bitops/__fls.h> 82 - #include <asm-generic/bitops/fls64.h> 83 - #include <asm-generic/bitops/find.h> 84 - 85 - #include <asm-generic/bitops/sched.h> 86 - #include <asm-generic/bitops/hweight.h> 87 - #include <asm-generic/bitops/lock.h> 88 - 89 - #include <asm-generic/bitops/atomic.h> 90 - #include <asm-generic/bitops/non-atomic.h> 91 - #include <asm-generic/bitops/le.h> 92 - #include <asm-generic/bitops/ext2-atomic.h> 93 - 94 - #endif /* __KERNEL__ */ 95 - #endif /* _ASM_C6X_BITOPS_H */
-20
arch/c6x/include/asm/bug.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_BUG_H 9 - #define _ASM_C6X_BUG_H 10 - 11 - #include <linux/linkage.h> 12 - #include <asm-generic/bug.h> 13 - 14 - struct pt_regs; 15 - 16 - extern void die(char *str, struct pt_regs *fp, int nr); 17 - extern asmlinkage int process_exception(struct pt_regs *regs); 18 - extern asmlinkage void enable_exception(void); 19 - 20 - #endif /* _ASM_C6X_BUG_H */
-94
arch/c6x/include/asm/cache.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2005, 2006, 2009, 2010, 2012 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_CACHE_H 9 - #define _ASM_C6X_CACHE_H 10 - 11 - #include <linux/irqflags.h> 12 - #include <linux/init.h> 13 - 14 - /* 15 - * Cache line size 16 - */ 17 - #define L1D_CACHE_SHIFT 6 18 - #define L1D_CACHE_BYTES (1 << L1D_CACHE_SHIFT) 19 - 20 - #define L1P_CACHE_SHIFT 5 21 - #define L1P_CACHE_BYTES (1 << L1P_CACHE_SHIFT) 22 - 23 - #define L2_CACHE_SHIFT 7 24 - #define L2_CACHE_BYTES (1 << L2_CACHE_SHIFT) 25 - 26 - /* 27 - * L2 used as cache 28 - */ 29 - #define L2MODE_SIZE L2MODE_256K_CACHE 30 - 31 - /* 32 - * For practical reasons the L1_CACHE_BYTES defines should not be smaller than 33 - * the L2 line size 34 - */ 35 - #define L1_CACHE_SHIFT L2_CACHE_SHIFT 36 - #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 37 - 38 - #define L2_CACHE_ALIGN_LOW(x) \ 39 - (((x) & ~(L2_CACHE_BYTES - 1))) 40 - #define L2_CACHE_ALIGN_UP(x) \ 41 - (((x) + (L2_CACHE_BYTES - 1)) & ~(L2_CACHE_BYTES - 1)) 42 - #define L2_CACHE_ALIGN_CNT(x) \ 43 - (((x) + (sizeof(int) - 1)) & ~(sizeof(int) - 1)) 44 - 45 - #define ARCH_DMA_MINALIGN L1_CACHE_BYTES 46 - #define ARCH_SLAB_MINALIGN L1_CACHE_BYTES 47 - 48 - /* 49 - * This is the granularity of hardware cacheability control. 50 - */ 51 - #define CACHEABILITY_ALIGN 0x01000000 52 - 53 - /* 54 - * Align a physical address to MAR regions 55 - */ 56 - #define CACHE_REGION_START(v) \ 57 - (((u32) (v)) & ~(CACHEABILITY_ALIGN - 1)) 58 - #define CACHE_REGION_END(v) \ 59 - (((u32) (v) + (CACHEABILITY_ALIGN - 1)) & ~(CACHEABILITY_ALIGN - 1)) 60 - 61 - extern void __init c6x_cache_init(void); 62 - 63 - extern void enable_caching(unsigned long start, unsigned long end); 64 - extern void disable_caching(unsigned long start, unsigned long end); 65 - 66 - extern void L1_cache_off(void); 67 - extern void L1_cache_on(void); 68 - 69 - extern void L1P_cache_global_invalidate(void); 70 - extern void L1D_cache_global_invalidate(void); 71 - extern void L1D_cache_global_writeback(void); 72 - extern void L1D_cache_global_writeback_invalidate(void); 73 - extern void L2_cache_set_mode(unsigned int mode); 74 - extern void L2_cache_global_writeback_invalidate(void); 75 - extern void L2_cache_global_writeback(void); 76 - 77 - extern void L1P_cache_block_invalidate(unsigned int start, unsigned int end); 78 - extern void L1D_cache_block_invalidate(unsigned int start, unsigned int end); 79 - extern void L1D_cache_block_writeback_invalidate(unsigned int start, 80 - unsigned int end); 81 - extern void L1D_cache_block_writeback(unsigned int start, unsigned int end); 82 - extern void L2_cache_block_invalidate(unsigned int start, unsigned int end); 83 - extern void L2_cache_block_writeback(unsigned int start, unsigned int end); 84 - extern void L2_cache_block_writeback_invalidate(unsigned int start, 85 - unsigned int end); 86 - extern void L2_cache_block_invalidate_nowait(unsigned int start, 87 - unsigned int end); 88 - extern void L2_cache_block_writeback_nowait(unsigned int start, 89 - unsigned int end); 90 - 91 - extern void L2_cache_block_writeback_invalidate_nowait(unsigned int start, 92 - unsigned int end); 93 - 94 - #endif /* _ASM_C6X_CACHE_H */
-45
arch/c6x/include/asm/cacheflush.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_CACHEFLUSH_H 9 - #define _ASM_C6X_CACHEFLUSH_H 10 - 11 - #include <linux/spinlock.h> 12 - 13 - #include <asm/setup.h> 14 - #include <asm/cache.h> 15 - #include <asm/mman.h> 16 - #include <asm/page.h> 17 - #include <asm/string.h> 18 - 19 - /* 20 - * physically-indexed cache management 21 - */ 22 - #define flush_icache_range(s, e) \ 23 - do { \ 24 - L1D_cache_block_writeback((s), (e)); \ 25 - L1P_cache_block_invalidate((s), (e)); \ 26 - } while (0) 27 - 28 - #define flush_icache_page(vma, page) \ 29 - do { \ 30 - if ((vma)->vm_flags & PROT_EXEC) \ 31 - L1D_cache_block_writeback_invalidate(page_address(page), \ 32 - (unsigned long) page_address(page) + PAGE_SIZE)); \ 33 - L1P_cache_block_invalidate(page_address(page), \ 34 - (unsigned long) page_address(page) + PAGE_SIZE)); \ 35 - } while (0) 36 - 37 - #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 38 - do { \ 39 - memcpy(dst, src, len); \ 40 - flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \ 41 - } while (0) 42 - 43 - #include <asm-generic/cacheflush.h> 44 - 45 - #endif /* _ASM_C6X_CACHEFLUSH_H */
-34
arch/c6x/include/asm/checksum.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Copyright (C) 2011 Texas Instruments Incorporated 4 - * Author: Mark Salter <msalter@redhat.com> 5 - */ 6 - #ifndef _ASM_C6X_CHECKSUM_H 7 - #define _ASM_C6X_CHECKSUM_H 8 - 9 - static inline __wsum 10 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 11 - __u8 proto, __wsum sum) 12 - { 13 - unsigned long long tmp; 14 - 15 - asm ("add .d1 %1,%5,%1\n" 16 - "|| addu .l1 %3,%4,%0\n" 17 - "addu .l1 %2,%0,%0\n" 18 - #ifndef CONFIG_CPU_BIG_ENDIAN 19 - "|| shl .s1 %1,8,%1\n" 20 - #endif 21 - "addu .l1 %1,%0,%0\n" 22 - "add .l1 %P0,%p0,%2\n" 23 - : "=&a"(tmp), "+a"(len), "+a"(sum) 24 - : "a" (saddr), "a" (daddr), "a" (proto)); 25 - return sum; 26 - } 27 - #define csum_tcpudp_nofold csum_tcpudp_nofold 28 - 29 - #define _HAVE_ARCH_CSUM_AND_COPY 30 - extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len); 31 - 32 - #include <asm-generic/checksum.h> 33 - 34 - #endif /* _ASM_C6X_CHECKSUM_H */
-145
arch/c6x/include/asm/clock.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * TI C64X clock definitions 4 - * 5 - * Copyright (C) 2010, 2011 Texas Instruments. 6 - * Contributed by: Mark Salter <msalter@redhat.com> 7 - * 8 - * Copied heavily from arm/mach-davinci/clock.h, so: 9 - * 10 - * Copyright (C) 2006-2007 Texas Instruments. 11 - * Copyright (C) 2008-2009 Deep Root Systems, LLC 12 - */ 13 - 14 - #ifndef _ASM_C6X_CLOCK_H 15 - #define _ASM_C6X_CLOCK_H 16 - 17 - #ifndef __ASSEMBLER__ 18 - 19 - #include <linux/list.h> 20 - 21 - /* PLL/Reset register offsets */ 22 - #define PLLCTL 0x100 23 - #define PLLM 0x110 24 - #define PLLPRE 0x114 25 - #define PLLDIV1 0x118 26 - #define PLLDIV2 0x11c 27 - #define PLLDIV3 0x120 28 - #define PLLPOST 0x128 29 - #define PLLCMD 0x138 30 - #define PLLSTAT 0x13c 31 - #define PLLALNCTL 0x140 32 - #define PLLDCHANGE 0x144 33 - #define PLLCKEN 0x148 34 - #define PLLCKSTAT 0x14c 35 - #define PLLSYSTAT 0x150 36 - #define PLLDIV4 0x160 37 - #define PLLDIV5 0x164 38 - #define PLLDIV6 0x168 39 - #define PLLDIV7 0x16c 40 - #define PLLDIV8 0x170 41 - #define PLLDIV9 0x174 42 - #define PLLDIV10 0x178 43 - #define PLLDIV11 0x17c 44 - #define PLLDIV12 0x180 45 - #define PLLDIV13 0x184 46 - #define PLLDIV14 0x188 47 - #define PLLDIV15 0x18c 48 - #define PLLDIV16 0x190 49 - 50 - /* PLLM register bits */ 51 - #define PLLM_PLLM_MASK 0xff 52 - #define PLLM_VAL(x) ((x) - 1) 53 - 54 - /* PREDIV register bits */ 55 - #define PLLPREDIV_EN BIT(15) 56 - #define PLLPREDIV_VAL(x) ((x) - 1) 57 - 58 - /* PLLCTL register bits */ 59 - #define PLLCTL_PLLEN BIT(0) 60 - #define PLLCTL_PLLPWRDN BIT(1) 61 - #define PLLCTL_PLLRST BIT(3) 62 - #define PLLCTL_PLLDIS BIT(4) 63 - #define PLLCTL_PLLENSRC BIT(5) 64 - #define PLLCTL_CLKMODE BIT(8) 65 - 66 - /* PLLCMD register bits */ 67 - #define PLLCMD_GOSTAT BIT(0) 68 - 69 - /* PLLSTAT register bits */ 70 - #define PLLSTAT_GOSTAT BIT(0) 71 - 72 - /* PLLDIV register bits */ 73 - #define PLLDIV_EN BIT(15) 74 - #define PLLDIV_RATIO_MASK 0x1f 75 - #define PLLDIV_RATIO(x) ((x) - 1) 76 - 77 - struct pll_data; 78 - 79 - struct clk { 80 - struct list_head node; 81 - struct module *owner; 82 - const char *name; 83 - unsigned long rate; 84 - int usecount; 85 - u32 flags; 86 - struct clk *parent; 87 - struct list_head children; /* list of children */ 88 - struct list_head childnode; /* parent's child list node */ 89 - struct pll_data *pll_data; 90 - u32 div; 91 - unsigned long (*recalc) (struct clk *); 92 - int (*set_rate) (struct clk *clk, unsigned long rate); 93 - int (*round_rate) (struct clk *clk, unsigned long rate); 94 - }; 95 - 96 - /* Clock flags: SoC-specific flags start at BIT(16) */ 97 - #define ALWAYS_ENABLED BIT(1) 98 - #define CLK_PLL BIT(2) /* PLL-derived clock */ 99 - #define PRE_PLL BIT(3) /* source is before PLL mult/div */ 100 - #define FIXED_DIV_PLL BIT(4) /* fixed divisor from PLL */ 101 - #define FIXED_RATE_PLL BIT(5) /* fixed output rate PLL */ 102 - 103 - #define MAX_PLL_SYSCLKS 16 104 - 105 - struct pll_data { 106 - void __iomem *base; 107 - u32 num; 108 - u32 flags; 109 - u32 input_rate; 110 - u32 bypass_delay; /* in loops */ 111 - u32 reset_delay; /* in loops */ 112 - u32 lock_delay; /* in loops */ 113 - struct clk sysclks[MAX_PLL_SYSCLKS + 1]; 114 - }; 115 - 116 - /* pll_data flag bit */ 117 - #define PLL_HAS_PRE BIT(0) 118 - #define PLL_HAS_MUL BIT(1) 119 - #define PLL_HAS_POST BIT(2) 120 - 121 - #define CLK(dev, con, ck) \ 122 - { \ 123 - .dev_id = dev, \ 124 - .con_id = con, \ 125 - .clk = ck, \ 126 - } \ 127 - 128 - extern void c6x_clks_init(struct clk_lookup *clocks); 129 - extern int clk_register(struct clk *clk); 130 - extern void clk_unregister(struct clk *clk); 131 - extern void c64x_setup_clocks(void); 132 - 133 - extern struct pll_data c6x_soc_pll1; 134 - 135 - extern struct clk clkin1; 136 - extern struct clk c6x_core_clk; 137 - extern struct clk c6x_i2c_clk; 138 - extern struct clk c6x_watchdog_clk; 139 - extern struct clk c6x_mcbsp1_clk; 140 - extern struct clk c6x_mcbsp2_clk; 141 - extern struct clk c6x_mdio_clk; 142 - 143 - #endif 144 - 145 - #endif /* _ASM_C6X_CLOCK_H */
-63
arch/c6x/include/asm/cmpxchg.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_CMPXCHG_H 9 - #define _ASM_C6X_CMPXCHG_H 10 - 11 - #include <linux/irqflags.h> 12 - 13 - /* 14 - * Misc. functions 15 - */ 16 - static inline unsigned int __xchg(unsigned int x, volatile void *ptr, int size) 17 - { 18 - unsigned int tmp; 19 - unsigned long flags; 20 - 21 - local_irq_save(flags); 22 - 23 - switch (size) { 24 - case 1: 25 - tmp = 0; 26 - tmp = *((unsigned char *) ptr); 27 - *((unsigned char *) ptr) = (unsigned char) x; 28 - break; 29 - case 2: 30 - tmp = 0; 31 - tmp = *((unsigned short *) ptr); 32 - *((unsigned short *) ptr) = x; 33 - break; 34 - case 4: 35 - tmp = 0; 36 - tmp = *((unsigned int *) ptr); 37 - *((unsigned int *) ptr) = x; 38 - break; 39 - } 40 - local_irq_restore(flags); 41 - return tmp; 42 - } 43 - 44 - #define xchg(ptr, x) \ 45 - ((__typeof__(*(ptr)))__xchg((unsigned int)(x), (void *) (ptr), \ 46 - sizeof(*(ptr)))) 47 - 48 - #include <asm-generic/cmpxchg-local.h> 49 - 50 - /* 51 - * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make 52 - * them available. 53 - */ 54 - #define cmpxchg_local(ptr, o, n) \ 55 - ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), \ 56 - (unsigned long)(o), \ 57 - (unsigned long)(n), \ 58 - sizeof(*(ptr)))) 59 - #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 60 - 61 - #include <asm-generic/cmpxchg.h> 62 - 63 - #endif /* _ASM_C6X_CMPXCHG_H */
-64
arch/c6x/include/asm/delay.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_DELAY_H 9 - #define _ASM_C6X_DELAY_H 10 - 11 - #include <linux/kernel.h> 12 - 13 - extern unsigned int ticks_per_ns_scaled; 14 - 15 - static inline void __delay(unsigned long loops) 16 - { 17 - uint32_t tmp; 18 - 19 - /* 6 cycles per loop */ 20 - asm volatile (" mv .s1 %0,%1\n" 21 - "0: [%1] b .s1 0b\n" 22 - " add .l1 -6,%0,%0\n" 23 - " cmplt .l1 1,%0,%1\n" 24 - " nop 3\n" 25 - : "+a"(loops), "=A"(tmp)); 26 - } 27 - 28 - static inline void _c6x_tickdelay(unsigned int x) 29 - { 30 - uint32_t cnt, endcnt; 31 - 32 - asm volatile (" mvc .s2 TSCL,%0\n" 33 - " add .s2x %0,%1,%2\n" 34 - " || mvk .l2 1,B0\n" 35 - "0: [B0] b .s2 0b\n" 36 - " mvc .s2 TSCL,%0\n" 37 - " sub .s2 %0,%2,%0\n" 38 - " cmpgt .l2 0,%0,B0\n" 39 - " nop 2\n" 40 - : "=b"(cnt), "+a"(x), "=b"(endcnt) : : "B0"); 41 - } 42 - 43 - /* use scaled math to avoid slow division */ 44 - #define C6X_NDELAY_SCALE 10 45 - 46 - static inline void _ndelay(unsigned int n) 47 - { 48 - _c6x_tickdelay((ticks_per_ns_scaled * n) >> C6X_NDELAY_SCALE); 49 - } 50 - 51 - static inline void _udelay(unsigned int n) 52 - { 53 - while (n >= 10) { 54 - _ndelay(10000); 55 - n -= 10; 56 - } 57 - while (n-- > 0) 58 - _ndelay(1000); 59 - } 60 - 61 - #define udelay(x) _udelay((unsigned int)(x)) 62 - #define ndelay(x) _ndelay((unsigned int)(x)) 63 - 64 - #endif /* _ASM_C6X_DELAY_H */
-30
arch/c6x/include/asm/dscr.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Copyright (C) 2011 Texas Instruments Incorporated 4 - * Author: Mark Salter <msalter@redhat.com> 5 - */ 6 - #ifndef _ASM_C6X_DSCR_H 7 - #define _ASM_C6X_DSCR_H 8 - 9 - enum dscr_devstate_t { 10 - DSCR_DEVSTATE_ENABLED, 11 - DSCR_DEVSTATE_DISABLED, 12 - }; 13 - 14 - /* 15 - * Set the device state of the device with the given ID. 16 - * 17 - * Individual drivers should use this to enable or disable the 18 - * hardware device. The devid used to identify the device being 19 - * controlled should be a property in the device's tree node. 20 - */ 21 - extern void dscr_set_devstate(int devid, enum dscr_devstate_t state); 22 - 23 - /* 24 - * Assert or de-assert an RMII reset. 25 - */ 26 - extern void dscr_rmii_reset(int id, int assert); 27 - 28 - extern void dscr_probe(void); 29 - 30 - #endif /* _ASM_C6X_DSCR_H */
-117
arch/c6x/include/asm/elf.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_ELF_H 9 - #define _ASM_C6X_ELF_H 10 - 11 - /* 12 - * ELF register definitions.. 13 - */ 14 - #include <asm/ptrace.h> 15 - 16 - typedef unsigned long elf_greg_t; 17 - typedef unsigned long elf_fpreg_t; 18 - 19 - #define ELF_NGREG 58 20 - #define ELF_NFPREG 1 21 - 22 - typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 23 - typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; 24 - 25 - /* 26 - * This is used to ensure we don't load something for the wrong architecture. 27 - */ 28 - #define elf_check_arch(x) ((x)->e_machine == EM_TI_C6000) 29 - 30 - #define elf_check_fdpic(x) (1) 31 - #define elf_check_const_displacement(x) (0) 32 - 33 - #define ELF_FDPIC_PLAT_INIT(_regs, _exec_map, _interp_map, _dynamic_addr) \ 34 - do { \ 35 - _regs->b4 = (_exec_map); \ 36 - _regs->a6 = (_interp_map); \ 37 - _regs->b6 = (_dynamic_addr); \ 38 - } while (0) 39 - 40 - #define ELF_FDPIC_CORE_EFLAGS 0 41 - 42 - /* 43 - * These are used to set parameters in the core dumps. 44 - */ 45 - #ifdef __LITTLE_ENDIAN__ 46 - #define ELF_DATA ELFDATA2LSB 47 - #else 48 - #define ELF_DATA ELFDATA2MSB 49 - #endif 50 - 51 - #define ELF_CLASS ELFCLASS32 52 - #define ELF_ARCH EM_TI_C6000 53 - 54 - /* Nothing for now. Need to setup DP... */ 55 - #define ELF_PLAT_INIT(_r) 56 - 57 - #define ELF_EXEC_PAGESIZE 4096 58 - 59 - #define ELF_CORE_COPY_REGS(_dest, _regs) \ 60 - memcpy((char *) &_dest, (char *) _regs, \ 61 - sizeof(struct pt_regs)); 62 - 63 - /* This yields a mask that user programs can use to figure out what 64 - instruction set this cpu supports. */ 65 - 66 - #define ELF_HWCAP (0) 67 - 68 - /* This yields a string that ld.so will use to load implementation 69 - specific libraries for optimization. This is more specific in 70 - intent than poking at uname or /proc/cpuinfo. */ 71 - 72 - #define ELF_PLATFORM (NULL) 73 - 74 - /* C6X specific section types */ 75 - #define SHT_C6000_UNWIND 0x70000001 76 - #define SHT_C6000_PREEMPTMAP 0x70000002 77 - #define SHT_C6000_ATTRIBUTES 0x70000003 78 - 79 - /* C6X specific DT_ tags */ 80 - #define DT_C6000_DSBT_BASE 0x70000000 81 - #define DT_C6000_DSBT_SIZE 0x70000001 82 - #define DT_C6000_PREEMPTMAP 0x70000002 83 - #define DT_C6000_DSBT_INDEX 0x70000003 84 - 85 - /* C6X specific relocs */ 86 - #define R_C6000_NONE 0 87 - #define R_C6000_ABS32 1 88 - #define R_C6000_ABS16 2 89 - #define R_C6000_ABS8 3 90 - #define R_C6000_PCR_S21 4 91 - #define R_C6000_PCR_S12 5 92 - #define R_C6000_PCR_S10 6 93 - #define R_C6000_PCR_S7 7 94 - #define R_C6000_ABS_S16 8 95 - #define R_C6000_ABS_L16 9 96 - #define R_C6000_ABS_H16 10 97 - #define R_C6000_SBR_U15_B 11 98 - #define R_C6000_SBR_U15_H 12 99 - #define R_C6000_SBR_U15_W 13 100 - #define R_C6000_SBR_S16 14 101 - #define R_C6000_SBR_L16_B 15 102 - #define R_C6000_SBR_L16_H 16 103 - #define R_C6000_SBR_L16_W 17 104 - #define R_C6000_SBR_H16_B 18 105 - #define R_C6000_SBR_H16_H 19 106 - #define R_C6000_SBR_H16_W 20 107 - #define R_C6000_SBR_GOT_U15_W 21 108 - #define R_C6000_SBR_GOT_L16_W 22 109 - #define R_C6000_SBR_GOT_H16_W 23 110 - #define R_C6000_DSBT_INDEX 24 111 - #define R_C6000_PREL31 25 112 - #define R_C6000_COPY 26 113 - #define R_C6000_ALIGN 253 114 - #define R_C6000_FPHEAD 254 115 - #define R_C6000_NOCMP 255 116 - 117 - #endif /*_ASM_C6X_ELF_H */
-19
arch/c6x/include/asm/flat.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __ASM_C6X_FLAT_H 3 - #define __ASM_C6X_FLAT_H 4 - 5 - #include <asm/unaligned.h> 6 - 7 - static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags, 8 - u32 *addr) 9 - { 10 - *addr = get_unaligned((__force u32 *)rp); 11 - return 0; 12 - } 13 - static inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel) 14 - { 15 - put_unaligned(addr, (__force u32 *)rp); 16 - return 0; 17 - } 18 - 19 - #endif /* __ASM_C6X_FLAT_H */
-6
arch/c6x/include/asm/ftrace.h
··· 1 - #ifndef _ASM_C6X_FTRACE_H 2 - #define _ASM_C6X_FTRACE_H 3 - 4 - /* empty */ 5 - 6 - #endif /* _ASM_C6X_FTRACE_H */
-17
arch/c6x/include/asm/hardirq.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - 9 - #ifndef _ASM_C6X_HARDIRQ_H 10 - #define _ASM_C6X_HARDIRQ_H 11 - 12 - extern void ack_bad_irq(int irq); 13 - #define ack_bad_irq ack_bad_irq 14 - 15 - #include <asm-generic/hardirq.h> 16 - 17 - #endif /* _ASM_C6X_HARDIRQ_H */
-50
arch/c6x/include/asm/irq.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - * 8 - * Large parts taken directly from powerpc. 9 - */ 10 - #ifndef _ASM_C6X_IRQ_H 11 - #define _ASM_C6X_IRQ_H 12 - 13 - #include <linux/irqdomain.h> 14 - #include <linux/threads.h> 15 - #include <linux/list.h> 16 - #include <linux/radix-tree.h> 17 - #include <asm/percpu.h> 18 - 19 - #define irq_canonicalize(irq) (irq) 20 - 21 - /* 22 - * The C64X+ core has 16 IRQ vectors. One each is used by Reset and NMI. Two 23 - * are reserved. The remaining 12 vectors are used to route SoC interrupts. 24 - * These interrupt vectors are prioritized with IRQ 4 having the highest 25 - * priority and IRQ 15 having the lowest. 26 - * 27 - * The C64x+ megamodule provides a PIC which combines SoC IRQ sources into a 28 - * single core IRQ vector. There are four combined sources, each of which 29 - * feed into one of the 12 general interrupt vectors. The remaining 8 vectors 30 - * can each route a single SoC interrupt directly. 31 - */ 32 - #define NR_PRIORITY_IRQS 16 33 - 34 - /* Total number of virq in the platform */ 35 - #define NR_IRQS 256 36 - 37 - /* This number is used when no interrupt has been assigned */ 38 - #define NO_IRQ 0 39 - 40 - extern void __init init_pic_c64xplus(void); 41 - 42 - extern void init_IRQ(void); 43 - 44 - struct pt_regs; 45 - 46 - extern asmlinkage void c6x_do_IRQ(unsigned int prio, struct pt_regs *regs); 47 - 48 - extern unsigned long irq_err_count; 49 - 50 - #endif /* _ASM_C6X_IRQ_H */
-68
arch/c6x/include/asm/irqflags.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * C6X IRQ flag handling 4 - * 5 - * Copyright (C) 2010 Texas Instruments Incorporated 6 - * Written by Mark Salter (msalter@redhat.com) 7 - */ 8 - 9 - #ifndef _ASM_IRQFLAGS_H 10 - #define _ASM_IRQFLAGS_H 11 - 12 - #ifndef __ASSEMBLY__ 13 - 14 - /* read interrupt enabled status */ 15 - static inline unsigned long arch_local_save_flags(void) 16 - { 17 - unsigned long flags; 18 - 19 - asm volatile (" mvc .s2 CSR,%0\n" : "=b"(flags)); 20 - return flags; 21 - } 22 - 23 - /* set interrupt enabled status */ 24 - static inline void arch_local_irq_restore(unsigned long flags) 25 - { 26 - asm volatile (" mvc .s2 %0,CSR\n" : : "b"(flags) : "memory"); 27 - } 28 - 29 - /* unconditionally enable interrupts */ 30 - static inline void arch_local_irq_enable(void) 31 - { 32 - unsigned long flags = arch_local_save_flags(); 33 - flags |= 1; 34 - arch_local_irq_restore(flags); 35 - } 36 - 37 - /* unconditionally disable interrupts */ 38 - static inline void arch_local_irq_disable(void) 39 - { 40 - unsigned long flags = arch_local_save_flags(); 41 - flags &= ~1; 42 - arch_local_irq_restore(flags); 43 - } 44 - 45 - /* get status and disable interrupts */ 46 - static inline unsigned long arch_local_irq_save(void) 47 - { 48 - unsigned long flags; 49 - 50 - flags = arch_local_save_flags(); 51 - arch_local_irq_restore(flags & ~1); 52 - return flags; 53 - } 54 - 55 - /* test flags */ 56 - static inline int arch_irqs_disabled_flags(unsigned long flags) 57 - { 58 - return (flags & 1) == 0; 59 - } 60 - 61 - /* test hardware interrupt enable bit */ 62 - static inline int arch_irqs_disabled(void) 63 - { 64 - return arch_irqs_disabled_flags(arch_local_save_flags()); 65 - } 66 - 67 - #endif /* __ASSEMBLY__ */ 68 - #endif /* __ASM_IRQFLAGS_H */
-31
arch/c6x/include/asm/linkage.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_C6X_LINKAGE_H 3 - #define _ASM_C6X_LINKAGE_H 4 - 5 - #ifdef __ASSEMBLER__ 6 - 7 - #define __ALIGN .align 2 8 - #define __ALIGN_STR ".align 2" 9 - 10 - #ifndef __DSBT__ 11 - #define ENTRY(name) \ 12 - .global name @ \ 13 - __ALIGN @ \ 14 - name: 15 - #else 16 - #define ENTRY(name) \ 17 - .global name @ \ 18 - .hidden name @ \ 19 - __ALIGN @ \ 20 - name: 21 - #endif 22 - 23 - #define ENDPROC(name) \ 24 - .type name, @function @ \ 25 - .size name, . - name 26 - 27 - #endif 28 - 29 - #include <asm-generic/linkage.h> 30 - 31 - #endif /* _ASM_C6X_LINKAGE_H */
-10
arch/c6x/include/asm/megamod-pic.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _C6X_MEGAMOD_PIC_H 3 - #define _C6X_MEGAMOD_PIC_H 4 - 5 - #ifdef __KERNEL__ 6 - 7 - extern void __init megamod_pic_init(void); 8 - 9 - #endif /* __KERNEL__ */ 10 - #endif /* _C6X_MEGAMOD_PIC_H */
-6
arch/c6x/include/asm/mmu_context.h
··· 1 - #ifndef _ASM_C6X_MMU_CONTEXT_H 2 - #define _ASM_C6X_MMU_CONTEXT_H 3 - 4 - #include <asm-generic/nommu_context.h> 5 - 6 - #endif /* _ASM_C6X_MMU_CONTEXT_H */
-20
arch/c6x/include/asm/module.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - * 8 - * Updated for 2.6.34 by: Mark Salter (msalter@redhat.com) 9 - */ 10 - #ifndef _ASM_C6X_MODULE_H 11 - #define _ASM_C6X_MODULE_H 12 - 13 - #include <asm-generic/module.h> 14 - 15 - struct loaded_sections { 16 - unsigned int new_vaddr; 17 - unsigned int loaded; 18 - }; 19 - 20 - #endif /* _ASM_C6X_MODULE_H */
-9
arch/c6x/include/asm/page.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_C6X_PAGE_H 3 - #define _ASM_C6X_PAGE_H 4 - 5 - #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC 6 - 7 - #include <asm-generic/page.h> 8 - 9 - #endif /* _ASM_C6X_PAGE_H */
-66
arch/c6x/include/asm/pgtable.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_PGTABLE_H 9 - #define _ASM_C6X_PGTABLE_H 10 - 11 - #include <asm-generic/pgtable-nopud.h> 12 - 13 - #include <asm/setup.h> 14 - #include <asm/page.h> 15 - 16 - /* 17 - * All 32bit addresses are effectively valid for vmalloc... 18 - * Sort of meaningless for non-VM targets. 19 - */ 20 - #define VMALLOC_START 0 21 - #define VMALLOC_END 0xffffffff 22 - 23 - #define pgd_present(pgd) (1) 24 - #define pgd_none(pgd) (0) 25 - #define pgd_bad(pgd) (0) 26 - #define pgd_clear(pgdp) 27 - #define kern_addr_valid(addr) (1) 28 - 29 - #define pmd_none(x) (!pmd_val(x)) 30 - #define pmd_present(x) (pmd_val(x)) 31 - #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) 32 - #define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK) 33 - 34 - #define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */ 35 - #define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */ 36 - #define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */ 37 - #define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */ 38 - #define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */ 39 - #define pgprot_noncached(prot) (prot) 40 - 41 - extern void paging_init(void); 42 - 43 - #define __swp_type(x) (0) 44 - #define __swp_offset(x) (0) 45 - #define __swp_entry(typ, off) ((swp_entry_t) { ((typ) | ((off) << 7)) }) 46 - #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 47 - #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 48 - 49 - #define set_pte(pteptr, pteval) (*(pteptr) = pteval) 50 - #define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) 51 - 52 - /* 53 - * ZERO_PAGE is a global shared page that is always zero: used 54 - * for zero-mapped memory areas etc.. 55 - */ 56 - #define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page) 57 - extern unsigned long empty_zero_page; 58 - 59 - #define swapper_pg_dir ((pgd_t *) 0) 60 - 61 - /* 62 - * c6x is !MMU, so define the simpliest implementation 63 - */ 64 - #define pgprot_writecombine pgprot_noncached 65 - 66 - #endif /* _ASM_C6X_PGTABLE_H */
-114
arch/c6x/include/asm/processor.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - * 8 - * Updated for 2.6.34: Mark Salter <msalter@redhat.com> 9 - */ 10 - #ifndef _ASM_C6X_PROCESSOR_H 11 - #define _ASM_C6X_PROCESSOR_H 12 - 13 - #include <asm/ptrace.h> 14 - #include <asm/page.h> 15 - #include <asm/current.h> 16 - 17 - /* 18 - * User space process size. This is mostly meaningless for NOMMU 19 - * but some C6X processors may have RAM addresses up to 0xFFFFFFFF. 20 - * Since calls like mmap() can return an address or an error, we 21 - * have to allow room for error returns when code does something 22 - * like: 23 - * 24 - * addr = do_mmap(...) 25 - * if ((unsigned long)addr >= TASK_SIZE) 26 - * ... its an error code, not an address ... 27 - * 28 - * Here, we allow for 4096 error codes which means we really can't 29 - * use the last 4K page on systems with RAM extending all the way 30 - * to the end of the 32-bit address space. 31 - */ 32 - #define TASK_SIZE 0xFFFFF000 33 - 34 - /* 35 - * This decides where the kernel will search for a free chunk of vm 36 - * space during mmap's. We won't be using it 37 - */ 38 - #define TASK_UNMAPPED_BASE 0 39 - 40 - struct thread_struct { 41 - unsigned long long b15_14; 42 - unsigned long long a15_14; 43 - unsigned long long b13_12; 44 - unsigned long long a13_12; 45 - unsigned long long b11_10; 46 - unsigned long long a11_10; 47 - unsigned long long ricl_icl; 48 - unsigned long usp; /* user stack pointer */ 49 - unsigned long pc; /* kernel pc */ 50 - unsigned long wchan; 51 - }; 52 - 53 - #define INIT_THREAD \ 54 - { \ 55 - .usp = 0, \ 56 - .wchan = 0, \ 57 - } 58 - 59 - #define INIT_MMAP { \ 60 - &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, \ 61 - NULL, NULL } 62 - 63 - #define task_pt_regs(task) \ 64 - ((struct pt_regs *)(THREAD_START_SP + task_stack_page(task)) - 1) 65 - 66 - #define alloc_kernel_stack() __get_free_page(GFP_KERNEL) 67 - #define free_kernel_stack(page) free_page((page)) 68 - 69 - 70 - /* Forward declaration, a strange C thing */ 71 - struct task_struct; 72 - 73 - extern void start_thread(struct pt_regs *regs, unsigned int pc, 74 - unsigned long usp); 75 - 76 - /* Free all resources held by a thread. */ 77 - static inline void release_thread(struct task_struct *dead_task) 78 - { 79 - } 80 - 81 - /* 82 - * saved kernel SP and DP of a blocked thread. 83 - */ 84 - #ifdef _BIG_ENDIAN 85 - #define thread_saved_ksp(tsk) \ 86 - (*(unsigned long *)&(tsk)->thread.b15_14) 87 - #define thread_saved_dp(tsk) \ 88 - (*(((unsigned long *)&(tsk)->thread.b15_14) + 1)) 89 - #else 90 - #define thread_saved_ksp(tsk) \ 91 - (*(((unsigned long *)&(tsk)->thread.b15_14) + 1)) 92 - #define thread_saved_dp(tsk) \ 93 - (*(unsigned long *)&(tsk)->thread.b15_14) 94 - #endif 95 - 96 - extern unsigned long get_wchan(struct task_struct *p); 97 - 98 - #define KSTK_EIP(task) (task_pt_regs(task)->pc) 99 - #define KSTK_ESP(task) (task_pt_regs(task)->sp) 100 - 101 - #define cpu_relax() do { } while (0) 102 - 103 - extern const struct seq_operations cpuinfo_op; 104 - 105 - /* Reset the board */ 106 - #define HARD_RESET_NOW() 107 - 108 - extern unsigned int c6x_core_freq; 109 - 110 - 111 - extern void (*c6x_restart)(void); 112 - extern void (*c6x_halt)(void); 113 - 114 - #endif /* ASM_C6X_PROCESSOR_H */
-24
arch/c6x/include/asm/procinfo.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Copyright (C) 2010 Texas Instruments Incorporated 4 - * Author: Mark Salter (msalter@redhat.com) 5 - */ 6 - #ifndef _ASM_C6X_PROCINFO_H 7 - #define _ASM_C6X_PROCINFO_H 8 - 9 - #ifdef __KERNEL__ 10 - 11 - struct proc_info_list { 12 - unsigned int cpu_val; 13 - unsigned int cpu_mask; 14 - const char *arch_name; 15 - const char *elf_name; 16 - unsigned int elf_hwcap; 17 - }; 18 - 19 - #else /* __KERNEL__ */ 20 - #include <asm/elf.h> 21 - #warning "Please include asm/elf.h instead" 22 - #endif /* __KERNEL__ */ 23 - 24 - #endif /* _ASM_C6X_PROCINFO_H */
-32
arch/c6x/include/asm/ptrace.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Copyright (C) 2004, 2006, 2009, 2010 Texas Instruments Incorporated 4 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 5 - * 6 - * Updated for 2.6.34: Mark Salter <msalter@redhat.com> 7 - */ 8 - #ifndef _ASM_C6X_PTRACE_H 9 - #define _ASM_C6X_PTRACE_H 10 - 11 - #include <uapi/asm/ptrace.h> 12 - 13 - #ifndef __ASSEMBLY__ 14 - #ifdef _BIG_ENDIAN 15 - #else 16 - #endif 17 - 18 - #include <linux/linkage.h> 19 - 20 - #define user_mode(regs) ((((regs)->tsr) & 0x40) != 0) 21 - 22 - #define instruction_pointer(regs) ((regs)->pc) 23 - #define profile_pc(regs) instruction_pointer(regs) 24 - #define user_stack_pointer(regs) ((regs)->sp) 25 - 26 - extern void show_regs(struct pt_regs *); 27 - 28 - extern asmlinkage unsigned long syscall_trace_entry(struct pt_regs *regs); 29 - extern asmlinkage void syscall_trace_exit(struct pt_regs *regs); 30 - 31 - #endif /* __ASSEMBLY__ */ 32 - #endif /* _ASM_C6X_PTRACE_H */
-12
arch/c6x/include/asm/sections.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_C6X_SECTIONS_H 3 - #define _ASM_C6X_SECTIONS_H 4 - 5 - #include <asm-generic/sections.h> 6 - 7 - extern char _vectors_start[]; 8 - extern char _vectors_end[]; 9 - 10 - extern char _data_lma[]; 11 - 12 - #endif /* _ASM_C6X_SECTIONS_H */
-31
arch/c6x/include/asm/setup.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_SETUP_H 9 - #define _ASM_C6X_SETUP_H 10 - 11 - #include <uapi/asm/setup.h> 12 - #include <linux/types.h> 13 - 14 - #ifndef __ASSEMBLY__ 15 - extern int c6x_add_memory(phys_addr_t start, unsigned long size); 16 - 17 - extern unsigned long ram_start; 18 - extern unsigned long ram_end; 19 - 20 - extern int c6x_num_cores; 21 - extern unsigned int c6x_silicon_rev; 22 - extern unsigned int c6x_devstat; 23 - extern unsigned char c6x_fuse_mac[6]; 24 - 25 - extern void machine_init(unsigned long dt_ptr); 26 - extern void time_init(void); 27 - 28 - extern void coherent_mem_init(u32 start, u32 size); 29 - 30 - #endif /* !__ASSEMBLY__ */ 31 - #endif /* _ASM_C6X_SETUP_H */
-35
arch/c6x/include/asm/soc.h
··· 1 - /* 2 - * Miscellaneous SoC-specific hooks. 3 - * 4 - * Copyright (C) 2011 Texas Instruments Incorporated 5 - * 6 - * Author: Mark Salter <msalter@redhat.com> 7 - * 8 - * This file is licensed under the terms of the GNU General Public License 9 - * version 2. This program is licensed "as is" without any warranty of any 10 - * kind, whether express or implied. 11 - */ 12 - #ifndef _ASM_C6X_SOC_H 13 - #define _ASM_C6X_SOC_H 14 - 15 - struct soc_ops { 16 - /* Return active exception event or -1 if none */ 17 - int (*get_exception)(void); 18 - 19 - /* Assert an event */ 20 - void (*assert_event)(unsigned int evt); 21 - }; 22 - 23 - extern struct soc_ops soc_ops; 24 - 25 - extern int soc_get_exception(void); 26 - extern void soc_assert_event(unsigned int event); 27 - extern int soc_mac_addr(unsigned int index, u8 *addr); 28 - 29 - /* 30 - * for mmio on SoC devices. regs are always same byte order as cpu. 31 - */ 32 - #define soc_readl(addr) __raw_readl(addr) 33 - #define soc_writel(b, addr) __raw_writel((b), (addr)) 34 - 35 - #endif /* _ASM_C6X_SOC_H */
-60
arch/c6x/include/asm/special_insns.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_SPECIAL_INSNS_H 9 - #define _ASM_C6X_SPECIAL_INSNS_H 10 - 11 - 12 - #define get_creg(reg) \ 13 - ({ unsigned int __x; \ 14 - asm volatile ("mvc .s2 " #reg ",%0\n" : "=b"(__x)); __x; }) 15 - 16 - #define set_creg(reg, v) \ 17 - do { unsigned int __x = (unsigned int)(v); \ 18 - asm volatile ("mvc .s2 %0," #reg "\n" : : "b"(__x)); \ 19 - } while (0) 20 - 21 - #define or_creg(reg, n) \ 22 - do { unsigned __x, __n = (unsigned)(n); \ 23 - asm volatile ("mvc .s2 " #reg ",%0\n" \ 24 - "or .l2 %1,%0,%0\n" \ 25 - "mvc .s2 %0," #reg "\n" \ 26 - "nop\n" \ 27 - : "=&b"(__x) : "b"(__n)); \ 28 - } while (0) 29 - 30 - #define and_creg(reg, n) \ 31 - do { unsigned __x, __n = (unsigned)(n); \ 32 - asm volatile ("mvc .s2 " #reg ",%0\n" \ 33 - "and .l2 %1,%0,%0\n" \ 34 - "mvc .s2 %0," #reg "\n" \ 35 - "nop\n" \ 36 - : "=&b"(__x) : "b"(__n)); \ 37 - } while (0) 38 - 39 - #define get_coreid() (get_creg(DNUM) & 0xff) 40 - 41 - /* Set/get IST */ 42 - #define set_ist(x) set_creg(ISTP, x) 43 - #define get_ist() get_creg(ISTP) 44 - 45 - /* 46 - * Exception management 47 - */ 48 - #define disable_exception() 49 - #define get_except_type() get_creg(EFR) 50 - #define ack_exception(type) set_creg(ECR, 1 << (type)) 51 - #define get_iexcept() get_creg(IERR) 52 - #define set_iexcept(mask) set_creg(IERR, (mask)) 53 - 54 - #define _extu(x, s, e) \ 55 - ({ unsigned int __x; \ 56 - asm volatile ("extu .S2 %3,%1,%2,%0\n" : \ 57 - "=b"(__x) : "n"(s), "n"(e), "b"(x)); \ 58 - __x; }) 59 - 60 - #endif /* _ASM_C6X_SPECIAL_INSNS_H */
-18
arch/c6x/include/asm/string.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_STRING_H 9 - #define _ASM_C6X_STRING_H 10 - 11 - #include <asm/page.h> 12 - #include <linux/linkage.h> 13 - 14 - asmlinkage extern void *memcpy(void *to, const void *from, size_t n); 15 - 16 - #define __HAVE_ARCH_MEMCPY 17 - 18 - #endif /* _ASM_C6X_STRING_H */
-30
arch/c6x/include/asm/switch_to.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_SWITCH_TO_H 9 - #define _ASM_C6X_SWITCH_TO_H 10 - 11 - #include <linux/linkage.h> 12 - 13 - #define prepare_to_switch() do { } while (0) 14 - 15 - struct task_struct; 16 - struct thread_struct; 17 - asmlinkage void *__switch_to(struct thread_struct *prev, 18 - struct thread_struct *next, 19 - struct task_struct *tsk); 20 - 21 - #define switch_to(prev, next, last) \ 22 - do { \ 23 - current->thread.wchan = (u_long) __builtin_return_address(0); \ 24 - (last) = __switch_to(&(prev)->thread, \ 25 - &(next)->thread, (prev)); \ 26 - mb(); \ 27 - current->thread.wchan = 0; \ 28 - } while (0) 29 - 30 - #endif /* _ASM_C6X_SWITCH_TO_H */
-75
arch/c6x/include/asm/syscall.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * Copyright (C) 2011 Texas Instruments Incorporated 4 - * Author: Mark Salter <msalter@redhat.com> 5 - */ 6 - 7 - #ifndef __ASM_C6X_SYSCALL_H 8 - #define __ASM_C6X_SYSCALL_H 9 - 10 - #include <uapi/linux/audit.h> 11 - #include <linux/err.h> 12 - #include <linux/sched.h> 13 - 14 - static inline int syscall_get_nr(struct task_struct *task, 15 - struct pt_regs *regs) 16 - { 17 - return regs->b0; 18 - } 19 - 20 - static inline void syscall_rollback(struct task_struct *task, 21 - struct pt_regs *regs) 22 - { 23 - /* do nothing */ 24 - } 25 - 26 - static inline long syscall_get_error(struct task_struct *task, 27 - struct pt_regs *regs) 28 - { 29 - return IS_ERR_VALUE(regs->a4) ? regs->a4 : 0; 30 - } 31 - 32 - static inline long syscall_get_return_value(struct task_struct *task, 33 - struct pt_regs *regs) 34 - { 35 - return regs->a4; 36 - } 37 - 38 - static inline void syscall_set_return_value(struct task_struct *task, 39 - struct pt_regs *regs, 40 - int error, long val) 41 - { 42 - regs->a4 = error ?: val; 43 - } 44 - 45 - static inline void syscall_get_arguments(struct task_struct *task, 46 - struct pt_regs *regs, 47 - unsigned long *args) 48 - { 49 - *args++ = regs->a4; 50 - *args++ = regs->b4; 51 - *args++ = regs->a6; 52 - *args++ = regs->b6; 53 - *args++ = regs->a8; 54 - *args = regs->b8; 55 - } 56 - 57 - static inline void syscall_set_arguments(struct task_struct *task, 58 - struct pt_regs *regs, 59 - const unsigned long *args) 60 - { 61 - regs->a4 = *args++; 62 - regs->b4 = *args++; 63 - regs->a6 = *args++; 64 - regs->b6 = *args++; 65 - regs->a8 = *args++; 66 - regs->a9 = *args; 67 - } 68 - 69 - static inline int syscall_get_arch(struct task_struct *task) 70 - { 71 - return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) 72 - ? AUDIT_ARCH_C6XBE : AUDIT_ARCH_C6X; 73 - } 74 - 75 - #endif /* __ASM_C6X_SYSCALLS_H */
-46
arch/c6x/include/asm/syscalls.h
··· 1 - /* 2 - * Copyright (C) 2011 Texas Instruments Incorporated 3 - * Author: Mark Salter <msalter@redhat.com> 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License 7 - * as published by the Free Software Foundation, version 2. 8 - * 9 - * This program is distributed in the hope that it will be useful, but 10 - * WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 12 - * NON INFRINGEMENT. See the GNU General Public License for 13 - * more details. 14 - */ 15 - 16 - #ifndef __ASM_C6X_SYSCALLS_H 17 - #define __ASM_C6X_SYSCALLS_H 18 - 19 - #include <linux/compiler.h> 20 - #include <linux/linkage.h> 21 - #include <linux/types.h> 22 - 23 - /* The array of function pointers for syscalls. */ 24 - extern void *sys_call_table[]; 25 - 26 - /* The following are trampolines in entry.S to handle 64-bit arguments */ 27 - extern long sys_pread_c6x(unsigned int fd, char __user *buf, 28 - size_t count, off_t pos_low, off_t pos_high); 29 - extern long sys_pwrite_c6x(unsigned int fd, const char __user *buf, 30 - size_t count, off_t pos_low, off_t pos_high); 31 - extern long sys_truncate64_c6x(const char __user *path, 32 - off_t length_low, off_t length_high); 33 - extern long sys_ftruncate64_c6x(unsigned int fd, 34 - off_t length_low, off_t length_high); 35 - extern long sys_fadvise64_c6x(int fd, u32 offset_lo, u32 offset_hi, 36 - u32 len, int advice); 37 - extern long sys_fadvise64_64_c6x(int fd, u32 offset_lo, u32 offset_hi, 38 - u32 len_lo, u32 len_hi, int advice); 39 - extern long sys_fallocate_c6x(int fd, int mode, 40 - u32 offset_lo, u32 offset_hi, 41 - u32 len_lo, u32 len_hi); 42 - extern int sys_cache_sync(unsigned long s, unsigned long e); 43 - 44 - #include <asm-generic/syscalls.h> 45 - 46 - #endif /* __ASM_C6X_SYSCALLS_H */
-94
arch/c6x/include/asm/thread_info.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - * 8 - * Updated for 2.6.3x: Mark Salter <msalter@redhat.com> 9 - */ 10 - #ifndef _ASM_C6X_THREAD_INFO_H 11 - #define _ASM_C6X_THREAD_INFO_H 12 - 13 - #ifdef __KERNEL__ 14 - 15 - #include <asm/page.h> 16 - 17 - #ifdef CONFIG_4KSTACKS 18 - #define THREAD_SIZE 4096 19 - #define THREAD_SHIFT 12 20 - #define THREAD_SIZE_ORDER 0 21 - #else 22 - #define THREAD_SIZE 8192 23 - #define THREAD_SHIFT 13 24 - #define THREAD_SIZE_ORDER 1 25 - #endif 26 - 27 - #define THREAD_START_SP (THREAD_SIZE - 8) 28 - 29 - #ifndef __ASSEMBLY__ 30 - 31 - typedef struct { 32 - unsigned long seg; 33 - } mm_segment_t; 34 - 35 - /* 36 - * low level task data. 37 - */ 38 - struct thread_info { 39 - struct task_struct *task; /* main task structure */ 40 - unsigned long flags; /* low level flags */ 41 - int cpu; /* cpu we're on */ 42 - int preempt_count; /* 0 = preemptable, <0 = BUG */ 43 - mm_segment_t addr_limit; /* thread address space */ 44 - }; 45 - 46 - /* 47 - * macros/functions for gaining access to the thread information structure 48 - * 49 - * preempt_count needs to be 1 initially, until the scheduler is functional. 50 - */ 51 - #define INIT_THREAD_INFO(tsk) \ 52 - { \ 53 - .task = &tsk, \ 54 - .flags = 0, \ 55 - .cpu = 0, \ 56 - .preempt_count = INIT_PREEMPT_COUNT, \ 57 - .addr_limit = KERNEL_DS, \ 58 - } 59 - 60 - /* get the thread information struct of current task */ 61 - static inline __attribute__((const)) 62 - struct thread_info *current_thread_info(void) 63 - { 64 - struct thread_info *ti; 65 - asm volatile (" clr .s2 B15,0,%1,%0\n" 66 - : "=b" (ti) 67 - : "Iu5" (THREAD_SHIFT - 1)); 68 - return ti; 69 - } 70 - 71 - #define get_thread_info(ti) get_task_struct((ti)->task) 72 - #define put_thread_info(ti) put_task_struct((ti)->task) 73 - #endif /* __ASSEMBLY__ */ 74 - 75 - /* 76 - * thread information flag bit numbers 77 - * - pending work-to-be-done flags are in LSW 78 - * - other flags in MSW 79 - */ 80 - #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 81 - #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ 82 - #define TIF_SIGPENDING 2 /* signal pending */ 83 - #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 84 - #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ 85 - #define TIF_NOTIFY_SIGNAL 5 /* signal notifications exist */ 86 - 87 - #define TIF_MEMDIE 17 /* OOM killer killed process */ 88 - 89 - #define TIF_WORK_MASK 0x00007FFE /* work on irq/exception return */ 90 - #define TIF_ALLWORK_MASK 0x00007FFF /* work on any return to u-space */ 91 - 92 - #endif /* __KERNEL__ */ 93 - 94 - #endif /* _ASM_C6X_THREAD_INFO_H */
-7
arch/c6x/include/asm/timer64.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _C6X_TIMER64_H 3 - #define _C6X_TIMER64_H 4 - 5 - extern void __init timer64_init(void); 6 - 7 - #endif /* _C6X_TIMER64_H */
-30
arch/c6x/include/asm/timex.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - * 8 - * Modified for 2.6.34: Mark Salter <msalter@redhat.com> 9 - */ 10 - #ifndef _ASM_C6X_TIMEX_H 11 - #define _ASM_C6X_TIMEX_H 12 - 13 - #define CLOCK_TICK_RATE ((1000 * 1000000UL) / 6) 14 - 15 - /* 64-bit timestamp */ 16 - typedef unsigned long long cycles_t; 17 - 18 - static inline cycles_t get_cycles(void) 19 - { 20 - unsigned l, h; 21 - 22 - asm volatile (" dint\n" 23 - " mvc .s2 TSCL,%0\n" 24 - " mvc .s2 TSCH,%1\n" 25 - " rint\n" 26 - : "=b"(l), "=b"(h)); 27 - return ((cycles_t)h << 32) | l; 28 - } 29 - 30 - #endif /* _ASM_C6X_TIMEX_H */
-7
arch/c6x/include/asm/tlb.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_C6X_TLB_H 3 - #define _ASM_C6X_TLB_H 4 - 5 - #include <asm-generic/tlb.h> 6 - 7 - #endif /* _ASM_C6X_TLB_H */
-33
arch/c6x/include/asm/traps.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #ifndef _ASM_C6X_TRAPS_H 9 - #define _ASM_C6X_TRAPS_H 10 - 11 - #define EXCEPT_TYPE_NXF 31 /* NMI */ 12 - #define EXCEPT_TYPE_EXC 30 /* external exception */ 13 - #define EXCEPT_TYPE_IXF 1 /* internal exception */ 14 - #define EXCEPT_TYPE_SXF 0 /* software exception */ 15 - 16 - #define EXCEPT_CAUSE_LBX (1 << 7) /* loop buffer exception */ 17 - #define EXCEPT_CAUSE_PRX (1 << 6) /* privilege exception */ 18 - #define EXCEPT_CAUSE_RAX (1 << 5) /* resource access exception */ 19 - #define EXCEPT_CAUSE_RCX (1 << 4) /* resource conflict exception */ 20 - #define EXCEPT_CAUSE_OPX (1 << 3) /* opcode exception */ 21 - #define EXCEPT_CAUSE_EPX (1 << 2) /* execute packet exception */ 22 - #define EXCEPT_CAUSE_FPX (1 << 1) /* fetch packet exception */ 23 - #define EXCEPT_CAUSE_IFX (1 << 0) /* instruction fetch exception */ 24 - 25 - struct exception_info { 26 - char *kernel_str; 27 - int signo; 28 - int code; 29 - }; 30 - 31 - extern int (*c6x_nmi_handler)(struct pt_regs *regs); 32 - 33 - #endif /* _ASM_C6X_TRAPS_H */
-97
arch/c6x/include/asm/uaccess.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Copyright (C) 2011 Texas Instruments Incorporated 4 - * Author: Mark Salter <msalter@redhat.com> 5 - */ 6 - #ifndef _ASM_C6X_UACCESS_H 7 - #define _ASM_C6X_UACCESS_H 8 - 9 - #include <linux/types.h> 10 - #include <linux/compiler.h> 11 - #include <linux/string.h> 12 - 13 - /* 14 - * C6X supports unaligned 32 and 64 bit loads and stores. 15 - */ 16 - static inline __must_check unsigned long 17 - raw_copy_from_user(void *to, const void __user *from, unsigned long n) 18 - { 19 - u32 tmp32; 20 - u64 tmp64; 21 - 22 - if (__builtin_constant_p(n)) { 23 - switch (n) { 24 - case 1: 25 - *(u8 *)to = *(u8 __force *)from; 26 - return 0; 27 - case 4: 28 - asm volatile ("ldnw .d1t1 *%2,%0\n" 29 - "nop 4\n" 30 - "stnw .d1t1 %0,*%1\n" 31 - : "=&a"(tmp32) 32 - : "A"(to), "a"(from) 33 - : "memory"); 34 - return 0; 35 - case 8: 36 - asm volatile ("ldndw .d1t1 *%2,%0\n" 37 - "nop 4\n" 38 - "stndw .d1t1 %0,*%1\n" 39 - : "=&a"(tmp64) 40 - : "a"(to), "a"(from) 41 - : "memory"); 42 - return 0; 43 - default: 44 - break; 45 - } 46 - } 47 - 48 - memcpy(to, (const void __force *)from, n); 49 - return 0; 50 - } 51 - 52 - static inline __must_check unsigned long 53 - raw_copy_to_user(void __user *to, const void *from, unsigned long n) 54 - { 55 - u32 tmp32; 56 - u64 tmp64; 57 - 58 - if (__builtin_constant_p(n)) { 59 - switch (n) { 60 - case 1: 61 - *(u8 __force *)to = *(u8 *)from; 62 - return 0; 63 - case 4: 64 - asm volatile ("ldnw .d1t1 *%2,%0\n" 65 - "nop 4\n" 66 - "stnw .d1t1 %0,*%1\n" 67 - : "=&a"(tmp32) 68 - : "a"(to), "a"(from) 69 - : "memory"); 70 - return 0; 71 - case 8: 72 - asm volatile ("ldndw .d1t1 *%2,%0\n" 73 - "nop 4\n" 74 - "stndw .d1t1 %0,*%1\n" 75 - : "=&a"(tmp64) 76 - : "a"(to), "a"(from) 77 - : "memory"); 78 - return 0; 79 - default: 80 - break; 81 - } 82 - } 83 - 84 - memcpy((void __force *)to, from, n); 85 - return 0; 86 - } 87 - #define INLINE_COPY_FROM_USER 88 - #define INLINE_COPY_TO_USER 89 - 90 - extern int _access_ok(unsigned long addr, unsigned long size); 91 - #ifdef CONFIG_ACCESS_CHECK 92 - #define __access_ok _access_ok 93 - #endif 94 - 95 - #include <asm-generic/uaccess.h> 96 - 97 - #endif /* _ASM_C6X_UACCESS_H */
-104
arch/c6x/include/asm/unaligned.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - * Rewritten for 2.6.3x: Mark Salter <msalter@redhat.com> 8 - */ 9 - #ifndef _ASM_C6X_UNALIGNED_H 10 - #define _ASM_C6X_UNALIGNED_H 11 - 12 - #include <linux/swab.h> 13 - #include <linux/unaligned/generic.h> 14 - 15 - /* 16 - * The C64x+ can do unaligned word and dword accesses in hardware 17 - * using special load/store instructions. 18 - */ 19 - 20 - static inline u16 get_unaligned_le16(const void *p) 21 - { 22 - const u8 *_p = p; 23 - return _p[0] | _p[1] << 8; 24 - } 25 - 26 - static inline u16 get_unaligned_be16(const void *p) 27 - { 28 - const u8 *_p = p; 29 - return _p[0] << 8 | _p[1]; 30 - } 31 - 32 - static inline void put_unaligned_le16(u16 val, void *p) 33 - { 34 - u8 *_p = p; 35 - _p[0] = val; 36 - _p[1] = val >> 8; 37 - } 38 - 39 - static inline void put_unaligned_be16(u16 val, void *p) 40 - { 41 - u8 *_p = p; 42 - _p[0] = val >> 8; 43 - _p[1] = val; 44 - } 45 - 46 - static inline u32 get_unaligned32(const void *p) 47 - { 48 - u32 val = (u32) p; 49 - asm (" ldnw .d1t1 *%0,%0\n" 50 - " nop 4\n" 51 - : "+a"(val)); 52 - return val; 53 - } 54 - 55 - static inline void put_unaligned32(u32 val, void *p) 56 - { 57 - asm volatile (" stnw .d2t1 %0,*%1\n" 58 - : : "a"(val), "b"(p) : "memory"); 59 - } 60 - 61 - static inline u64 get_unaligned64(const void *p) 62 - { 63 - u64 val; 64 - asm volatile (" ldndw .d1t1 *%1,%0\n" 65 - " nop 4\n" 66 - : "=a"(val) : "a"(p)); 67 - return val; 68 - } 69 - 70 - static inline void put_unaligned64(u64 val, const void *p) 71 - { 72 - asm volatile (" stndw .d2t1 %0,*%1\n" 73 - : : "a"(val), "b"(p) : "memory"); 74 - } 75 - 76 - #ifdef CONFIG_CPU_BIG_ENDIAN 77 - 78 - #define get_unaligned_le32(p) __swab32(get_unaligned32(p)) 79 - #define get_unaligned_le64(p) __swab64(get_unaligned64(p)) 80 - #define get_unaligned_be32(p) get_unaligned32(p) 81 - #define get_unaligned_be64(p) get_unaligned64(p) 82 - #define put_unaligned_le32(v, p) put_unaligned32(__swab32(v), (p)) 83 - #define put_unaligned_le64(v, p) put_unaligned64(__swab64(v), (p)) 84 - #define put_unaligned_be32(v, p) put_unaligned32((v), (p)) 85 - #define put_unaligned_be64(v, p) put_unaligned64((v), (p)) 86 - #define get_unaligned __get_unaligned_be 87 - #define put_unaligned __put_unaligned_be 88 - 89 - #else 90 - 91 - #define get_unaligned_le32(p) get_unaligned32(p) 92 - #define get_unaligned_le64(p) get_unaligned64(p) 93 - #define get_unaligned_be32(p) __swab32(get_unaligned32(p)) 94 - #define get_unaligned_be64(p) __swab64(get_unaligned64(p)) 95 - #define put_unaligned_le32(v, p) put_unaligned32((v), (p)) 96 - #define put_unaligned_le64(v, p) put_unaligned64((v), (p)) 97 - #define put_unaligned_be32(v, p) put_unaligned32(__swab32(v), (p)) 98 - #define put_unaligned_be64(v, p) put_unaligned64(__swab64(v), (p)) 99 - #define get_unaligned __get_unaligned_le 100 - #define put_unaligned __put_unaligned_le 101 - 102 - #endif 103 - 104 - #endif /* _ASM_C6X_UNALIGNED_H */
-4
arch/c6x/include/asm/vmalloc.h
··· 1 - #ifndef _ASM_C6X_VMALLOC_H 2 - #define _ASM_C6X_VMALLOC_H 3 - 4 - #endif /* _ASM_C6X_VMALLOC_H */
-2
arch/c6x/include/uapi/asm/Kbuild
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - generic-y += ucontext.h
-13
arch/c6x/include/uapi/asm/byteorder.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - #ifndef _ASM_C6X_BYTEORDER_H 3 - #define _ASM_C6X_BYTEORDER_H 4 - 5 - #include <asm/types.h> 6 - 7 - #ifdef _BIG_ENDIAN 8 - #include <linux/byteorder/big_endian.h> 9 - #else /* _BIG_ENDIAN */ 10 - #include <linux/byteorder/little_endian.h> 11 - #endif /* _BIG_ENDIAN */ 12 - 13 - #endif /* _ASM_BYTEORDER_H */
-164
arch/c6x/include/uapi/asm/ptrace.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - /* 3 - * Copyright (C) 2004, 2006, 2009, 2010 Texas Instruments Incorporated 4 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 5 - * 6 - * Updated for 2.6.34: Mark Salter <msalter@redhat.com> 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - */ 12 - #ifndef _UAPI_ASM_C6X_PTRACE_H 13 - #define _UAPI_ASM_C6X_PTRACE_H 14 - 15 - #define BKPT_OPCODE 0x56454314 /* illegal opcode */ 16 - 17 - #ifdef _BIG_ENDIAN 18 - #define PT_LO(odd, even) odd 19 - #define PT_HI(odd, even) even 20 - #else 21 - #define PT_LO(odd, even) even 22 - #define PT_HI(odd, even) odd 23 - #endif 24 - 25 - #define PT_A4_ORG PT_LO(1, 0) 26 - #define PT_TSR PT_HI(1, 0) 27 - #define PT_ILC PT_LO(3, 2) 28 - #define PT_RILC PT_HI(3, 2) 29 - #define PT_CSR PT_LO(5, 4) 30 - #define PT_PC PT_HI(5, 4) 31 - #define PT_B16 PT_LO(7, 6) 32 - #define PT_B17 PT_HI(7, 6) 33 - #define PT_B18 PT_LO(9, 8) 34 - #define PT_B19 PT_HI(9, 8) 35 - #define PT_B20 PT_LO(11, 10) 36 - #define PT_B21 PT_HI(11, 10) 37 - #define PT_B22 PT_LO(13, 12) 38 - #define PT_B23 PT_HI(13, 12) 39 - #define PT_B24 PT_LO(15, 14) 40 - #define PT_B25 PT_HI(15, 14) 41 - #define PT_B26 PT_LO(17, 16) 42 - #define PT_B27 PT_HI(17, 16) 43 - #define PT_B28 PT_LO(19, 18) 44 - #define PT_B29 PT_HI(19, 18) 45 - #define PT_B30 PT_LO(21, 20) 46 - #define PT_B31 PT_HI(21, 20) 47 - #define PT_B0 PT_LO(23, 22) 48 - #define PT_B1 PT_HI(23, 22) 49 - #define PT_B2 PT_LO(25, 24) 50 - #define PT_B3 PT_HI(25, 24) 51 - #define PT_B4 PT_LO(27, 26) 52 - #define PT_B5 PT_HI(27, 26) 53 - #define PT_B6 PT_LO(29, 28) 54 - #define PT_B7 PT_HI(29, 28) 55 - #define PT_B8 PT_LO(31, 30) 56 - #define PT_B9 PT_HI(31, 30) 57 - #define PT_B10 PT_LO(33, 32) 58 - #define PT_B11 PT_HI(33, 32) 59 - #define PT_B12 PT_LO(35, 34) 60 - #define PT_B13 PT_HI(35, 34) 61 - #define PT_A16 PT_LO(37, 36) 62 - #define PT_A17 PT_HI(37, 36) 63 - #define PT_A18 PT_LO(39, 38) 64 - #define PT_A19 PT_HI(39, 38) 65 - #define PT_A20 PT_LO(41, 40) 66 - #define PT_A21 PT_HI(41, 40) 67 - #define PT_A22 PT_LO(43, 42) 68 - #define PT_A23 PT_HI(43, 42) 69 - #define PT_A24 PT_LO(45, 44) 70 - #define PT_A25 PT_HI(45, 44) 71 - #define PT_A26 PT_LO(47, 46) 72 - #define PT_A27 PT_HI(47, 46) 73 - #define PT_A28 PT_LO(49, 48) 74 - #define PT_A29 PT_HI(49, 48) 75 - #define PT_A30 PT_LO(51, 50) 76 - #define PT_A31 PT_HI(51, 50) 77 - #define PT_A0 PT_LO(53, 52) 78 - #define PT_A1 PT_HI(53, 52) 79 - #define PT_A2 PT_LO(55, 54) 80 - #define PT_A3 PT_HI(55, 54) 81 - #define PT_A4 PT_LO(57, 56) 82 - #define PT_A5 PT_HI(57, 56) 83 - #define PT_A6 PT_LO(59, 58) 84 - #define PT_A7 PT_HI(59, 58) 85 - #define PT_A8 PT_LO(61, 60) 86 - #define PT_A9 PT_HI(61, 60) 87 - #define PT_A10 PT_LO(63, 62) 88 - #define PT_A11 PT_HI(63, 62) 89 - #define PT_A12 PT_LO(65, 64) 90 - #define PT_A13 PT_HI(65, 64) 91 - #define PT_A14 PT_LO(67, 66) 92 - #define PT_A15 PT_HI(67, 66) 93 - #define PT_B14 PT_LO(69, 68) 94 - #define PT_B15 PT_HI(69, 68) 95 - 96 - #define NR_PTREGS 70 97 - 98 - #define PT_DP PT_B14 /* Data Segment Pointer (B14) */ 99 - #define PT_SP PT_B15 /* Stack Pointer (B15) */ 100 - 101 - #define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */ 102 - 103 - #define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */ 104 - #define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */ 105 - 106 - #ifndef __ASSEMBLY__ 107 - 108 - #ifdef _BIG_ENDIAN 109 - #define REG_PAIR(odd, even) unsigned long odd; unsigned long even 110 - #else 111 - #define REG_PAIR(odd, even) unsigned long even; unsigned long odd 112 - #endif 113 - 114 - /* 115 - * this struct defines the way the registers are stored on the 116 - * stack during a system call. fields defined with REG_PAIR 117 - * are saved and restored using double-word memory operations 118 - * which means the word ordering of the pair depends on endianess. 119 - */ 120 - struct pt_regs { 121 - REG_PAIR(tsr, orig_a4); 122 - REG_PAIR(rilc, ilc); 123 - REG_PAIR(pc, csr); 124 - 125 - REG_PAIR(b17, b16); 126 - REG_PAIR(b19, b18); 127 - REG_PAIR(b21, b20); 128 - REG_PAIR(b23, b22); 129 - REG_PAIR(b25, b24); 130 - REG_PAIR(b27, b26); 131 - REG_PAIR(b29, b28); 132 - REG_PAIR(b31, b30); 133 - 134 - REG_PAIR(b1, b0); 135 - REG_PAIR(b3, b2); 136 - REG_PAIR(b5, b4); 137 - REG_PAIR(b7, b6); 138 - REG_PAIR(b9, b8); 139 - REG_PAIR(b11, b10); 140 - REG_PAIR(b13, b12); 141 - 142 - REG_PAIR(a17, a16); 143 - REG_PAIR(a19, a18); 144 - REG_PAIR(a21, a20); 145 - REG_PAIR(a23, a22); 146 - REG_PAIR(a25, a24); 147 - REG_PAIR(a27, a26); 148 - REG_PAIR(a29, a28); 149 - REG_PAIR(a31, a30); 150 - 151 - REG_PAIR(a1, a0); 152 - REG_PAIR(a3, a2); 153 - REG_PAIR(a5, a4); 154 - REG_PAIR(a7, a6); 155 - REG_PAIR(a9, a8); 156 - REG_PAIR(a11, a10); 157 - REG_PAIR(a13, a12); 158 - 159 - REG_PAIR(a15, a14); 160 - REG_PAIR(sp, dp); 161 - }; 162 - 163 - #endif /* __ASSEMBLY__ */ 164 - #endif /* _UAPI_ASM_C6X_PTRACE_H */
-7
arch/c6x/include/uapi/asm/setup.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - #ifndef _UAPI_ASM_C6X_SETUP_H 3 - #define _UAPI_ASM_C6X_SETUP_H 4 - 5 - #define COMMAND_LINE_SIZE 1024 6 - 7 - #endif /* _UAPI_ASM_C6X_SETUP_H */
-81
arch/c6x/include/uapi/asm/sigcontext.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - */ 12 - #ifndef _ASM_C6X_SIGCONTEXT_H 13 - #define _ASM_C6X_SIGCONTEXT_H 14 - 15 - 16 - struct sigcontext { 17 - unsigned long sc_mask; /* old sigmask */ 18 - unsigned long sc_sp; /* old user stack pointer */ 19 - 20 - unsigned long sc_a4; 21 - unsigned long sc_b4; 22 - unsigned long sc_a6; 23 - unsigned long sc_b6; 24 - unsigned long sc_a8; 25 - unsigned long sc_b8; 26 - 27 - unsigned long sc_a0; 28 - unsigned long sc_a1; 29 - unsigned long sc_a2; 30 - unsigned long sc_a3; 31 - unsigned long sc_a5; 32 - unsigned long sc_a7; 33 - unsigned long sc_a9; 34 - 35 - unsigned long sc_b0; 36 - unsigned long sc_b1; 37 - unsigned long sc_b2; 38 - unsigned long sc_b3; 39 - unsigned long sc_b5; 40 - unsigned long sc_b7; 41 - unsigned long sc_b9; 42 - 43 - unsigned long sc_a16; 44 - unsigned long sc_a17; 45 - unsigned long sc_a18; 46 - unsigned long sc_a19; 47 - unsigned long sc_a20; 48 - unsigned long sc_a21; 49 - unsigned long sc_a22; 50 - unsigned long sc_a23; 51 - unsigned long sc_a24; 52 - unsigned long sc_a25; 53 - unsigned long sc_a26; 54 - unsigned long sc_a27; 55 - unsigned long sc_a28; 56 - unsigned long sc_a29; 57 - unsigned long sc_a30; 58 - unsigned long sc_a31; 59 - 60 - unsigned long sc_b16; 61 - unsigned long sc_b17; 62 - unsigned long sc_b18; 63 - unsigned long sc_b19; 64 - unsigned long sc_b20; 65 - unsigned long sc_b21; 66 - unsigned long sc_b22; 67 - unsigned long sc_b23; 68 - unsigned long sc_b24; 69 - unsigned long sc_b25; 70 - unsigned long sc_b26; 71 - unsigned long sc_b27; 72 - unsigned long sc_b28; 73 - unsigned long sc_b29; 74 - unsigned long sc_b30; 75 - unsigned long sc_b31; 76 - 77 - unsigned long sc_csr; 78 - unsigned long sc_pc; 79 - }; 80 - 81 - #endif /* _ASM_C6X_SIGCONTEXT_H */
-55
arch/c6x/include/uapi/asm/swab.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - /* 3 - * Copyright (C) 2011 Texas Instruments Incorporated 4 - * Author: Mark Salter <msalter@redhat.com> 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 - #ifndef _ASM_C6X_SWAB_H 11 - #define _ASM_C6X_SWAB_H 12 - 13 - static inline __attribute_const__ __u16 __c6x_swab16(__u16 val) 14 - { 15 - asm("swap4 .l1 %0,%0\n" : "+a"(val)); 16 - return val; 17 - } 18 - 19 - static inline __attribute_const__ __u32 __c6x_swab32(__u32 val) 20 - { 21 - asm("swap4 .l1 %0,%0\n" 22 - "swap2 .l1 %0,%0\n" 23 - : "+a"(val)); 24 - return val; 25 - } 26 - 27 - static inline __attribute_const__ __u64 __c6x_swab64(__u64 val) 28 - { 29 - asm(" swap2 .s1 %p0,%P0\n" 30 - "|| swap2 .l1 %P0,%p0\n" 31 - " swap4 .l1 %p0,%p0\n" 32 - " swap4 .l1 %P0,%P0\n" 33 - : "+a"(val)); 34 - return val; 35 - } 36 - 37 - static inline __attribute_const__ __u32 __c6x_swahw32(__u32 val) 38 - { 39 - asm("swap2 .l1 %0,%0\n" : "+a"(val)); 40 - return val; 41 - } 42 - 43 - static inline __attribute_const__ __u32 __c6x_swahb32(__u32 val) 44 - { 45 - asm("swap4 .l1 %0,%0\n" : "+a"(val)); 46 - return val; 47 - } 48 - 49 - #define __arch_swab16 __c6x_swab16 50 - #define __arch_swab32 __c6x_swab32 51 - #define __arch_swab64 __c6x_swab64 52 - #define __arch_swahw32 __c6x_swahw32 53 - #define __arch_swahb32 __c6x_swahb32 54 - 55 - #endif /* _ASM_C6X_SWAB_H */
-29
arch/c6x/include/uapi/asm/unistd.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - /* 3 - * Copyright (C) 2011 Texas Instruments Incorporated 4 - * 5 - * Based on arch/tile version. 6 - * 7 - * This program is free software; you can redistribute it and/or 8 - * modify it under the terms of the GNU General Public License 9 - * as published by the Free Software Foundation, version 2. 10 - * 11 - * This program is distributed in the hope that it will be useful, but 12 - * WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 14 - * NON INFRINGEMENT. See the GNU General Public License for 15 - * more details. 16 - */ 17 - 18 - #define __ARCH_WANT_RENAMEAT 19 - #define __ARCH_WANT_STAT64 20 - #define __ARCH_WANT_SET_GET_RLIMIT 21 - #define __ARCH_WANT_SYS_CLONE 22 - #define __ARCH_WANT_TIME32_SYSCALLS 23 - 24 - /* Use the standard ABI for syscalls. */ 25 - #include <asm-generic/unistd.h> 26 - 27 - /* C6X-specific syscalls. */ 28 - #define __NR_cache_sync (__NR_arch_specific_syscall + 0) 29 - __SYSCALL(__NR_cache_sync, sys_cache_sync)
-13
arch/c6x/kernel/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # 3 - # Makefile for arch/c6x/kernel/ 4 - # 5 - 6 - extra-y := head.o vmlinux.lds 7 - 8 - obj-y := process.o traps.o irq.o signal.o ptrace.o 9 - obj-y += setup.o sys_c6x.o time.o devicetree.o 10 - obj-y += switch_to.o entry.o vectors.o c6x_ksyms.o 11 - obj-y += soc.o 12 - 13 - obj-$(CONFIG_MODULES) += module.o
-123
arch/c6x/kernel/asm-offsets.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Generate definitions needed by assembly language modules. 4 - * This code generates raw asm output which is post-processed 5 - * to extract and format the required data. 6 - */ 7 - 8 - #include <linux/sched.h> 9 - #include <linux/thread_info.h> 10 - #include <asm/procinfo.h> 11 - #include <linux/kbuild.h> 12 - #include <linux/unistd.h> 13 - 14 - void foo(void) 15 - { 16 - OFFSET(REGS_A16, pt_regs, a16); 17 - OFFSET(REGS_A17, pt_regs, a17); 18 - OFFSET(REGS_A18, pt_regs, a18); 19 - OFFSET(REGS_A19, pt_regs, a19); 20 - OFFSET(REGS_A20, pt_regs, a20); 21 - OFFSET(REGS_A21, pt_regs, a21); 22 - OFFSET(REGS_A22, pt_regs, a22); 23 - OFFSET(REGS_A23, pt_regs, a23); 24 - OFFSET(REGS_A24, pt_regs, a24); 25 - OFFSET(REGS_A25, pt_regs, a25); 26 - OFFSET(REGS_A26, pt_regs, a26); 27 - OFFSET(REGS_A27, pt_regs, a27); 28 - OFFSET(REGS_A28, pt_regs, a28); 29 - OFFSET(REGS_A29, pt_regs, a29); 30 - OFFSET(REGS_A30, pt_regs, a30); 31 - OFFSET(REGS_A31, pt_regs, a31); 32 - 33 - OFFSET(REGS_B16, pt_regs, b16); 34 - OFFSET(REGS_B17, pt_regs, b17); 35 - OFFSET(REGS_B18, pt_regs, b18); 36 - OFFSET(REGS_B19, pt_regs, b19); 37 - OFFSET(REGS_B20, pt_regs, b20); 38 - OFFSET(REGS_B21, pt_regs, b21); 39 - OFFSET(REGS_B22, pt_regs, b22); 40 - OFFSET(REGS_B23, pt_regs, b23); 41 - OFFSET(REGS_B24, pt_regs, b24); 42 - OFFSET(REGS_B25, pt_regs, b25); 43 - OFFSET(REGS_B26, pt_regs, b26); 44 - OFFSET(REGS_B27, pt_regs, b27); 45 - OFFSET(REGS_B28, pt_regs, b28); 46 - OFFSET(REGS_B29, pt_regs, b29); 47 - OFFSET(REGS_B30, pt_regs, b30); 48 - OFFSET(REGS_B31, pt_regs, b31); 49 - 50 - OFFSET(REGS_A0, pt_regs, a0); 51 - OFFSET(REGS_A1, pt_regs, a1); 52 - OFFSET(REGS_A2, pt_regs, a2); 53 - OFFSET(REGS_A3, pt_regs, a3); 54 - OFFSET(REGS_A4, pt_regs, a4); 55 - OFFSET(REGS_A5, pt_regs, a5); 56 - OFFSET(REGS_A6, pt_regs, a6); 57 - OFFSET(REGS_A7, pt_regs, a7); 58 - OFFSET(REGS_A8, pt_regs, a8); 59 - OFFSET(REGS_A9, pt_regs, a9); 60 - OFFSET(REGS_A10, pt_regs, a10); 61 - OFFSET(REGS_A11, pt_regs, a11); 62 - OFFSET(REGS_A12, pt_regs, a12); 63 - OFFSET(REGS_A13, pt_regs, a13); 64 - OFFSET(REGS_A14, pt_regs, a14); 65 - OFFSET(REGS_A15, pt_regs, a15); 66 - 67 - OFFSET(REGS_B0, pt_regs, b0); 68 - OFFSET(REGS_B1, pt_regs, b1); 69 - OFFSET(REGS_B2, pt_regs, b2); 70 - OFFSET(REGS_B3, pt_regs, b3); 71 - OFFSET(REGS_B4, pt_regs, b4); 72 - OFFSET(REGS_B5, pt_regs, b5); 73 - OFFSET(REGS_B6, pt_regs, b6); 74 - OFFSET(REGS_B7, pt_regs, b7); 75 - OFFSET(REGS_B8, pt_regs, b8); 76 - OFFSET(REGS_B9, pt_regs, b9); 77 - OFFSET(REGS_B10, pt_regs, b10); 78 - OFFSET(REGS_B11, pt_regs, b11); 79 - OFFSET(REGS_B12, pt_regs, b12); 80 - OFFSET(REGS_B13, pt_regs, b13); 81 - OFFSET(REGS_DP, pt_regs, dp); 82 - OFFSET(REGS_SP, pt_regs, sp); 83 - 84 - OFFSET(REGS_TSR, pt_regs, tsr); 85 - OFFSET(REGS_ORIG_A4, pt_regs, orig_a4); 86 - 87 - DEFINE(REGS__END, sizeof(struct pt_regs)); 88 - BLANK(); 89 - 90 - OFFSET(THREAD_PC, thread_struct, pc); 91 - OFFSET(THREAD_B15_14, thread_struct, b15_14); 92 - OFFSET(THREAD_A15_14, thread_struct, a15_14); 93 - OFFSET(THREAD_B13_12, thread_struct, b13_12); 94 - OFFSET(THREAD_A13_12, thread_struct, a13_12); 95 - OFFSET(THREAD_B11_10, thread_struct, b11_10); 96 - OFFSET(THREAD_A11_10, thread_struct, a11_10); 97 - OFFSET(THREAD_RICL_ICL, thread_struct, ricl_icl); 98 - BLANK(); 99 - 100 - OFFSET(TASK_STATE, task_struct, state); 101 - BLANK(); 102 - 103 - OFFSET(THREAD_INFO_FLAGS, thread_info, flags); 104 - OFFSET(THREAD_INFO_PREEMPT_COUNT, thread_info, preempt_count); 105 - BLANK(); 106 - 107 - /* These would be unneccessary if we ran asm files 108 - * through the preprocessor. 109 - */ 110 - DEFINE(KTHREAD_SHIFT, THREAD_SHIFT); 111 - DEFINE(KTHREAD_START_SP, THREAD_START_SP); 112 - DEFINE(ENOSYS_, ENOSYS); 113 - DEFINE(NR_SYSCALLS_, __NR_syscalls); 114 - 115 - DEFINE(_TIF_SYSCALL_TRACE, (1<<TIF_SYSCALL_TRACE)); 116 - DEFINE(_TIF_NOTIFY_RESUME, (1<<TIF_NOTIFY_RESUME)); 117 - DEFINE(_TIF_SIGPENDING, (1<<TIF_SIGPENDING)); 118 - DEFINE(_TIF_NEED_RESCHED, (1<<TIF_NEED_RESCHED)); 119 - DEFINE(_TIF_NOTIFY_SIGNAL, (1<<TIF_NOTIFY_SIGNAL)); 120 - 121 - DEFINE(_TIF_ALLWORK_MASK, TIF_ALLWORK_MASK); 122 - DEFINE(_TIF_WORK_MASK, TIF_WORK_MASK); 123 - }
-62
arch/c6x/kernel/c6x_ksyms.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #include <linux/module.h> 9 - #include <asm/checksum.h> 10 - #include <linux/io.h> 11 - 12 - /* 13 - * libgcc functions - used internally by the compiler... 14 - */ 15 - extern int __c6xabi_divi(int dividend, int divisor); 16 - EXPORT_SYMBOL(__c6xabi_divi); 17 - 18 - extern unsigned __c6xabi_divu(unsigned dividend, unsigned divisor); 19 - EXPORT_SYMBOL(__c6xabi_divu); 20 - 21 - extern int __c6xabi_remi(int dividend, int divisor); 22 - EXPORT_SYMBOL(__c6xabi_remi); 23 - 24 - extern unsigned __c6xabi_remu(unsigned dividend, unsigned divisor); 25 - EXPORT_SYMBOL(__c6xabi_remu); 26 - 27 - extern int __c6xabi_divremi(int dividend, int divisor); 28 - EXPORT_SYMBOL(__c6xabi_divremi); 29 - 30 - extern unsigned __c6xabi_divremu(unsigned dividend, unsigned divisor); 31 - EXPORT_SYMBOL(__c6xabi_divremu); 32 - 33 - extern unsigned long long __c6xabi_mpyll(unsigned long long src1, 34 - unsigned long long src2); 35 - EXPORT_SYMBOL(__c6xabi_mpyll); 36 - 37 - extern long long __c6xabi_negll(long long src); 38 - EXPORT_SYMBOL(__c6xabi_negll); 39 - 40 - extern unsigned long long __c6xabi_llshl(unsigned long long src1, uint src2); 41 - EXPORT_SYMBOL(__c6xabi_llshl); 42 - 43 - extern long long __c6xabi_llshr(long long src1, uint src2); 44 - EXPORT_SYMBOL(__c6xabi_llshr); 45 - 46 - extern unsigned long long __c6xabi_llshru(unsigned long long src1, uint src2); 47 - EXPORT_SYMBOL(__c6xabi_llshru); 48 - 49 - extern void __c6xabi_strasgi(int *dst, const int *src, unsigned cnt); 50 - EXPORT_SYMBOL(__c6xabi_strasgi); 51 - 52 - extern void __c6xabi_push_rts(void); 53 - EXPORT_SYMBOL(__c6xabi_push_rts); 54 - 55 - extern void __c6xabi_pop_rts(void); 56 - EXPORT_SYMBOL(__c6xabi_pop_rts); 57 - 58 - extern void __c6xabi_strasgi_64plus(int *dst, const int *src, unsigned cnt); 59 - EXPORT_SYMBOL(__c6xabi_strasgi_64plus); 60 - 61 - /* lib functions */ 62 - EXPORT_SYMBOL(memcpy);
-14
arch/c6x/kernel/devicetree.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Architecture specific OF callbacks. 4 - * 5 - * Copyright (C) 2011 Texas Instruments Incorporated 6 - * Author: Mark Salter <msalter@redhat.com> 7 - */ 8 - #include <linux/init.h> 9 - #include <linux/memblock.h> 10 - 11 - void __init early_init_dt_add_memory_arch(u64 base, u64 size) 12 - { 13 - c6x_add_memory(base, size); 14 - }
-736
arch/c6x/kernel/entry.S
··· 1 - ; SPDX-License-Identifier: GPL-2.0-only 2 - ; 3 - ; Port on Texas Instruments TMS320C6x architecture 4 - ; 5 - ; Copyright (C) 2004-2011 Texas Instruments Incorporated 6 - ; Author: Aurelien Jacquiot (aurelien.jacquiot@virtuallogix.com) 7 - ; Updated for 2.6.34: Mark Salter <msalter@redhat.com> 8 - ; 9 - 10 - #include <linux/sys.h> 11 - #include <linux/linkage.h> 12 - #include <asm/thread_info.h> 13 - #include <asm/asm-offsets.h> 14 - #include <asm/unistd.h> 15 - #include <asm/errno.h> 16 - 17 - ; Registers naming 18 - #define DP B14 19 - #define SP B15 20 - 21 - #ifndef CONFIG_PREEMPTION 22 - #define resume_kernel restore_all 23 - #endif 24 - 25 - .altmacro 26 - 27 - .macro MASK_INT reg 28 - MVC .S2 CSR,reg 29 - CLR .S2 reg,0,0,reg 30 - MVC .S2 reg,CSR 31 - .endm 32 - 33 - .macro UNMASK_INT reg 34 - MVC .S2 CSR,reg 35 - SET .S2 reg,0,0,reg 36 - MVC .S2 reg,CSR 37 - .endm 38 - 39 - .macro GET_THREAD_INFO reg 40 - SHR .S1X SP,THREAD_SHIFT,reg 41 - SHL .S1 reg,THREAD_SHIFT,reg 42 - .endm 43 - 44 - ;; 45 - ;; This defines the normal kernel pt_regs layout. 46 - ;; 47 - .macro SAVE_ALL __rp __tsr 48 - STW .D2T2 B0,*SP--[2] ; save original B0 49 - MVKL .S2 current_ksp,B0 50 - MVKH .S2 current_ksp,B0 51 - LDW .D2T2 *B0,B1 ; KSP 52 - 53 - NOP 3 54 - STW .D2T2 B1,*+SP[1] ; save original B1 55 - XOR .D2 SP,B1,B0 ; (SP ^ KSP) 56 - LDW .D2T2 *+SP[1],B1 ; restore B0/B1 57 - LDW .D2T2 *++SP[2],B0 58 - SHR .S2 B0,THREAD_SHIFT,B0 ; 0 if already using kstack 59 - [B0] STDW .D2T2 SP:DP,*--B1[1] ; user: save user sp/dp kstack 60 - [B0] MV .S2 B1,SP ; and switch to kstack 61 - ||[!B0] STDW .D2T2 SP:DP,*--SP[1] ; kernel: save on current stack 62 - 63 - SUBAW .D2 SP,2,SP 64 - 65 - ADD .D1X SP,-8,A15 66 - || STDW .D2T1 A15:A14,*SP--[16] ; save A15:A14 67 - 68 - STDW .D2T2 B13:B12,*SP--[1] 69 - || STDW .D1T1 A13:A12,*A15--[1] 70 - || MVC .S2 __rp,B13 71 - 72 - STDW .D2T2 B11:B10,*SP--[1] 73 - || STDW .D1T1 A11:A10,*A15--[1] 74 - || MVC .S2 CSR,B12 75 - 76 - STDW .D2T2 B9:B8,*SP--[1] 77 - || STDW .D1T1 A9:A8,*A15--[1] 78 - || MVC .S2 RILC,B11 79 - STDW .D2T2 B7:B6,*SP--[1] 80 - || STDW .D1T1 A7:A6,*A15--[1] 81 - || MVC .S2 ILC,B10 82 - 83 - STDW .D2T2 B5:B4,*SP--[1] 84 - || STDW .D1T1 A5:A4,*A15--[1] 85 - 86 - STDW .D2T2 B3:B2,*SP--[1] 87 - || STDW .D1T1 A3:A2,*A15--[1] 88 - || MVC .S2 __tsr,B5 89 - 90 - STDW .D2T2 B1:B0,*SP--[1] 91 - || STDW .D1T1 A1:A0,*A15--[1] 92 - || MV .S1X B5,A5 93 - 94 - STDW .D2T2 B31:B30,*SP--[1] 95 - || STDW .D1T1 A31:A30,*A15--[1] 96 - STDW .D2T2 B29:B28,*SP--[1] 97 - || STDW .D1T1 A29:A28,*A15--[1] 98 - STDW .D2T2 B27:B26,*SP--[1] 99 - || STDW .D1T1 A27:A26,*A15--[1] 100 - STDW .D2T2 B25:B24,*SP--[1] 101 - || STDW .D1T1 A25:A24,*A15--[1] 102 - STDW .D2T2 B23:B22,*SP--[1] 103 - || STDW .D1T1 A23:A22,*A15--[1] 104 - STDW .D2T2 B21:B20,*SP--[1] 105 - || STDW .D1T1 A21:A20,*A15--[1] 106 - STDW .D2T2 B19:B18,*SP--[1] 107 - || STDW .D1T1 A19:A18,*A15--[1] 108 - STDW .D2T2 B17:B16,*SP--[1] 109 - || STDW .D1T1 A17:A16,*A15--[1] 110 - 111 - STDW .D2T2 B13:B12,*SP--[1] ; save PC and CSR 112 - 113 - STDW .D2T2 B11:B10,*SP--[1] ; save RILC and ILC 114 - STDW .D2T1 A5:A4,*SP--[1] ; save TSR and orig A4 115 - 116 - ;; We left an unused word on the stack just above pt_regs. 117 - ;; It is used to save whether or not this frame is due to 118 - ;; a syscall. It is cleared here, but the syscall handler 119 - ;; sets it to a non-zero value. 120 - MVK .L2 0,B1 121 - STW .D2T2 B1,*+SP(REGS__END+8) ; clear syscall flag 122 - .endm 123 - 124 - .macro RESTORE_ALL __rp __tsr 125 - LDDW .D2T2 *++SP[1],B9:B8 ; get TSR (B9) 126 - LDDW .D2T2 *++SP[1],B11:B10 ; get RILC (B11) and ILC (B10) 127 - LDDW .D2T2 *++SP[1],B13:B12 ; get PC (B13) and CSR (B12) 128 - 129 - ADDAW .D1X SP,30,A15 130 - 131 - LDDW .D1T1 *++A15[1],A17:A16 132 - || LDDW .D2T2 *++SP[1],B17:B16 133 - LDDW .D1T1 *++A15[1],A19:A18 134 - || LDDW .D2T2 *++SP[1],B19:B18 135 - LDDW .D1T1 *++A15[1],A21:A20 136 - || LDDW .D2T2 *++SP[1],B21:B20 137 - LDDW .D1T1 *++A15[1],A23:A22 138 - || LDDW .D2T2 *++SP[1],B23:B22 139 - LDDW .D1T1 *++A15[1],A25:A24 140 - || LDDW .D2T2 *++SP[1],B25:B24 141 - LDDW .D1T1 *++A15[1],A27:A26 142 - || LDDW .D2T2 *++SP[1],B27:B26 143 - LDDW .D1T1 *++A15[1],A29:A28 144 - || LDDW .D2T2 *++SP[1],B29:B28 145 - LDDW .D1T1 *++A15[1],A31:A30 146 - || LDDW .D2T2 *++SP[1],B31:B30 147 - 148 - LDDW .D1T1 *++A15[1],A1:A0 149 - || LDDW .D2T2 *++SP[1],B1:B0 150 - 151 - LDDW .D1T1 *++A15[1],A3:A2 152 - || LDDW .D2T2 *++SP[1],B3:B2 153 - || MVC .S2 B9,__tsr 154 - LDDW .D1T1 *++A15[1],A5:A4 155 - || LDDW .D2T2 *++SP[1],B5:B4 156 - || MVC .S2 B11,RILC 157 - LDDW .D1T1 *++A15[1],A7:A6 158 - || LDDW .D2T2 *++SP[1],B7:B6 159 - || MVC .S2 B10,ILC 160 - 161 - LDDW .D1T1 *++A15[1],A9:A8 162 - || LDDW .D2T2 *++SP[1],B9:B8 163 - || MVC .S2 B13,__rp 164 - 165 - LDDW .D1T1 *++A15[1],A11:A10 166 - || LDDW .D2T2 *++SP[1],B11:B10 167 - || MVC .S2 B12,CSR 168 - 169 - LDDW .D1T1 *++A15[1],A13:A12 170 - || LDDW .D2T2 *++SP[1],B13:B12 171 - 172 - MV .D2X A15,SP 173 - || MVKL .S1 current_ksp,A15 174 - MVKH .S1 current_ksp,A15 175 - || ADDAW .D1X SP,6,A14 176 - STW .D1T1 A14,*A15 ; save kernel stack pointer 177 - 178 - LDDW .D2T1 *++SP[1],A15:A14 179 - 180 - B .S2 __rp ; return from interruption 181 - LDDW .D2T2 *+SP[1],SP:DP 182 - NOP 4 183 - .endm 184 - 185 - .section .text 186 - 187 - ;; 188 - ;; Jump to schedule() then return to ret_from_exception 189 - ;; 190 - _reschedule: 191 - #ifdef CONFIG_C6X_BIG_KERNEL 192 - MVKL .S1 schedule,A0 193 - MVKH .S1 schedule,A0 194 - B .S2X A0 195 - #else 196 - B .S1 schedule 197 - #endif 198 - ADDKPC .S2 ret_from_exception,B3,4 199 - 200 - ;; 201 - ;; Called before syscall handler when process is being debugged 202 - ;; 203 - tracesys_on: 204 - #ifdef CONFIG_C6X_BIG_KERNEL 205 - MVKL .S1 syscall_trace_entry,A0 206 - MVKH .S1 syscall_trace_entry,A0 207 - B .S2X A0 208 - #else 209 - B .S1 syscall_trace_entry 210 - #endif 211 - ADDKPC .S2 ret_from_syscall_trace,B3,3 212 - ADD .S1X 8,SP,A4 213 - 214 - ret_from_syscall_trace: 215 - ;; tracing returns (possibly new) syscall number 216 - MV .D2X A4,B0 217 - || MVK .S2 __NR_syscalls,B1 218 - CMPLTU .L2 B0,B1,B1 219 - 220 - [!B1] BNOP .S2 ret_from_syscall_function,5 221 - || MVK .S1 -ENOSYS,A4 222 - 223 - ;; reload syscall args from (possibly modified) stack frame 224 - ;; and get syscall handler addr from sys_call_table: 225 - LDW .D2T2 *+SP(REGS_B4+8),B4 226 - || MVKL .S2 sys_call_table,B1 227 - LDW .D2T1 *+SP(REGS_A6+8),A6 228 - || MVKH .S2 sys_call_table,B1 229 - LDW .D2T2 *+B1[B0],B0 230 - || MVKL .S2 ret_from_syscall_function,B3 231 - LDW .D2T2 *+SP(REGS_B6+8),B6 232 - || MVKH .S2 ret_from_syscall_function,B3 233 - LDW .D2T1 *+SP(REGS_A8+8),A8 234 - LDW .D2T2 *+SP(REGS_B8+8),B8 235 - NOP 236 - ; B0 = sys_call_table[__NR_*] 237 - BNOP .S2 B0,5 ; branch to syscall handler 238 - || LDW .D2T1 *+SP(REGS_ORIG_A4+8),A4 239 - 240 - syscall_exit_work: 241 - AND .D1 _TIF_SYSCALL_TRACE,A2,A0 242 - [!A0] BNOP .S1 work_pending,5 243 - [A0] B .S2 syscall_trace_exit 244 - ADDKPC .S2 resume_userspace,B3,1 245 - MVC .S2 CSR,B1 246 - SET .S2 B1,0,0,B1 247 - MVC .S2 B1,CSR ; enable ints 248 - 249 - work_pending: 250 - AND .D1 _TIF_NEED_RESCHED,A2,A0 251 - [!A0] BNOP .S1 work_notifysig,5 252 - 253 - work_resched: 254 - #ifdef CONFIG_C6X_BIG_KERNEL 255 - MVKL .S1 schedule,A1 256 - MVKH .S1 schedule,A1 257 - B .S2X A1 258 - #else 259 - B .S2 schedule 260 - #endif 261 - ADDKPC .S2 work_rescheduled,B3,4 262 - work_rescheduled: 263 - ;; make sure we don't miss an interrupt setting need_resched or 264 - ;; sigpending between sampling and the rti 265 - MASK_INT B2 266 - GET_THREAD_INFO A12 267 - LDW .D1T1 *+A12(THREAD_INFO_FLAGS),A2 268 - MVK .S1 _TIF_WORK_MASK,A1 269 - MVK .S1 _TIF_NEED_RESCHED,A3 270 - NOP 2 271 - AND .D1 A1,A2,A0 272 - || AND .S1 A3,A2,A1 273 - [!A0] BNOP .S1 restore_all,5 274 - [A1] BNOP .S1 work_resched,5 275 - 276 - work_notifysig: 277 - ;; enable interrupts for do_notify_resume() 278 - UNMASK_INT B2 279 - B .S2 do_notify_resume 280 - LDW .D2T1 *+SP(REGS__END+8),A6 ; syscall flag 281 - ADDKPC .S2 resume_userspace,B3,1 282 - ADD .S1X 8,SP,A4 ; pt_regs pointer is first arg 283 - MV .D2X A2,B4 ; thread_info flags is second arg 284 - 285 - ;; 286 - ;; On C64x+, the return way from exception and interrupt 287 - ;; is a little bit different 288 - ;; 289 - ENTRY(ret_from_exception) 290 - #ifdef CONFIG_PREEMPTION 291 - MASK_INT B2 292 - #endif 293 - 294 - ENTRY(ret_from_interrupt) 295 - ;; 296 - ;; Check if we are comming from user mode. 297 - ;; 298 - LDW .D2T2 *+SP(REGS_TSR+8),B0 299 - MVK .S2 0x40,B1 300 - NOP 3 301 - AND .D2 B0,B1,B0 302 - [!B0] BNOP .S2 resume_kernel,5 303 - 304 - resume_userspace: 305 - ;; make sure we don't miss an interrupt setting need_resched or 306 - ;; sigpending between sampling and the rti 307 - MASK_INT B2 308 - GET_THREAD_INFO A12 309 - LDW .D1T1 *+A12(THREAD_INFO_FLAGS),A2 310 - MVK .S1 _TIF_WORK_MASK,A1 311 - MVK .S1 _TIF_NEED_RESCHED,A3 312 - NOP 2 313 - AND .D1 A1,A2,A0 314 - [A0] BNOP .S1 work_pending,5 315 - BNOP .S1 restore_all,5 316 - 317 - ;; 318 - ;; System call handling 319 - ;; B0 = syscall number (in sys_call_table) 320 - ;; A4,B4,A6,B6,A8,B8 = arguments of the syscall function 321 - ;; A4 is the return value register 322 - ;; 323 - system_call_saved: 324 - MVK .L2 1,B2 325 - STW .D2T2 B2,*+SP(REGS__END+8) ; set syscall flag 326 - MVC .S2 B2,ECR ; ack the software exception 327 - 328 - UNMASK_INT B2 ; re-enable global IT 329 - 330 - system_call_saved_noack: 331 - ;; Check system call number 332 - MVK .S2 __NR_syscalls,B1 333 - #ifdef CONFIG_C6X_BIG_KERNEL 334 - || MVKL .S1 sys_ni_syscall,A0 335 - #endif 336 - CMPLTU .L2 B0,B1,B1 337 - #ifdef CONFIG_C6X_BIG_KERNEL 338 - || MVKH .S1 sys_ni_syscall,A0 339 - #endif 340 - 341 - ;; Check for ptrace 342 - GET_THREAD_INFO A12 343 - 344 - #ifdef CONFIG_C6X_BIG_KERNEL 345 - [!B1] B .S2X A0 346 - #else 347 - [!B1] B .S2 sys_ni_syscall 348 - #endif 349 - [!B1] ADDKPC .S2 ret_from_syscall_function,B3,4 350 - 351 - ;; Get syscall handler addr from sys_call_table 352 - ;; call tracesys_on or call syscall handler 353 - LDW .D1T1 *+A12(THREAD_INFO_FLAGS),A2 354 - || MVKL .S2 sys_call_table,B1 355 - MVKH .S2 sys_call_table,B1 356 - LDW .D2T2 *+B1[B0],B0 357 - NOP 2 358 - ; A2 = thread_info flags 359 - AND .D1 _TIF_SYSCALL_TRACE,A2,A2 360 - [A2] BNOP .S1 tracesys_on,5 361 - ;; B0 = _sys_call_table[__NR_*] 362 - B .S2 B0 363 - ADDKPC .S2 ret_from_syscall_function,B3,4 364 - 365 - ret_from_syscall_function: 366 - STW .D2T1 A4,*+SP(REGS_A4+8) ; save return value in A4 367 - ; original A4 is in orig_A4 368 - syscall_exit: 369 - ;; make sure we don't miss an interrupt setting need_resched or 370 - ;; sigpending between sampling and the rti 371 - MASK_INT B2 372 - LDW .D1T1 *+A12(THREAD_INFO_FLAGS),A2 373 - MVK .S1 _TIF_ALLWORK_MASK,A1 374 - NOP 3 375 - AND .D1 A1,A2,A2 ; check for work to do 376 - [A2] BNOP .S1 syscall_exit_work,5 377 - 378 - restore_all: 379 - RESTORE_ALL NRP,NTSR 380 - 381 - ;; 382 - ;; After a fork we jump here directly from resume, 383 - ;; so that A4 contains the previous task structure. 384 - ;; 385 - ENTRY(ret_from_fork) 386 - #ifdef CONFIG_C6X_BIG_KERNEL 387 - MVKL .S1 schedule_tail,A0 388 - MVKH .S1 schedule_tail,A0 389 - B .S2X A0 390 - #else 391 - B .S2 schedule_tail 392 - #endif 393 - ADDKPC .S2 ret_from_fork_2,B3,4 394 - ret_from_fork_2: 395 - ;; return 0 in A4 for child process 396 - GET_THREAD_INFO A12 397 - BNOP .S2 syscall_exit,3 398 - MVK .L2 0,B0 399 - STW .D2T2 B0,*+SP(REGS_A4+8) 400 - ENDPROC(ret_from_fork) 401 - 402 - ENTRY(ret_from_kernel_thread) 403 - #ifdef CONFIG_C6X_BIG_KERNEL 404 - MVKL .S1 schedule_tail,A0 405 - MVKH .S1 schedule_tail,A0 406 - B .S2X A0 407 - #else 408 - B .S2 schedule_tail 409 - #endif 410 - LDW .D2T2 *+SP(REGS_A0+8),B10 /* get fn */ 411 - ADDKPC .S2 0f,B3,3 412 - 0: 413 - B .S2 B10 /* call fn */ 414 - LDW .D2T1 *+SP(REGS_A1+8),A4 /* get arg */ 415 - ADDKPC .S2 ret_from_fork_2,B3,3 416 - ENDPROC(ret_from_kernel_thread) 417 - 418 - ;; 419 - ;; These are the interrupt handlers, responsible for calling c6x_do_IRQ() 420 - ;; 421 - .macro SAVE_ALL_INT 422 - SAVE_ALL IRP,ITSR 423 - .endm 424 - 425 - .macro CALL_INT int 426 - #ifdef CONFIG_C6X_BIG_KERNEL 427 - MVKL .S1 c6x_do_IRQ,A0 428 - MVKH .S1 c6x_do_IRQ,A0 429 - BNOP .S2X A0,1 430 - MVK .S1 int,A4 431 - ADDAW .D2 SP,2,B4 432 - MVKL .S2 ret_from_interrupt,B3 433 - MVKH .S2 ret_from_interrupt,B3 434 - #else 435 - CALLP .S2 c6x_do_IRQ,B3 436 - || MVK .S1 int,A4 437 - || ADDAW .D2 SP,2,B4 438 - B .S1 ret_from_interrupt 439 - NOP 5 440 - #endif 441 - .endm 442 - 443 - ENTRY(_int4_handler) 444 - SAVE_ALL_INT 445 - CALL_INT 4 446 - ENDPROC(_int4_handler) 447 - 448 - ENTRY(_int5_handler) 449 - SAVE_ALL_INT 450 - CALL_INT 5 451 - ENDPROC(_int5_handler) 452 - 453 - ENTRY(_int6_handler) 454 - SAVE_ALL_INT 455 - CALL_INT 6 456 - ENDPROC(_int6_handler) 457 - 458 - ENTRY(_int7_handler) 459 - SAVE_ALL_INT 460 - CALL_INT 7 461 - ENDPROC(_int7_handler) 462 - 463 - ENTRY(_int8_handler) 464 - SAVE_ALL_INT 465 - CALL_INT 8 466 - ENDPROC(_int8_handler) 467 - 468 - ENTRY(_int9_handler) 469 - SAVE_ALL_INT 470 - CALL_INT 9 471 - ENDPROC(_int9_handler) 472 - 473 - ENTRY(_int10_handler) 474 - SAVE_ALL_INT 475 - CALL_INT 10 476 - ENDPROC(_int10_handler) 477 - 478 - ENTRY(_int11_handler) 479 - SAVE_ALL_INT 480 - CALL_INT 11 481 - ENDPROC(_int11_handler) 482 - 483 - ENTRY(_int12_handler) 484 - SAVE_ALL_INT 485 - CALL_INT 12 486 - ENDPROC(_int12_handler) 487 - 488 - ENTRY(_int13_handler) 489 - SAVE_ALL_INT 490 - CALL_INT 13 491 - ENDPROC(_int13_handler) 492 - 493 - ENTRY(_int14_handler) 494 - SAVE_ALL_INT 495 - CALL_INT 14 496 - ENDPROC(_int14_handler) 497 - 498 - ENTRY(_int15_handler) 499 - SAVE_ALL_INT 500 - CALL_INT 15 501 - ENDPROC(_int15_handler) 502 - 503 - ;; 504 - ;; Handler for uninitialized and spurious interrupts 505 - ;; 506 - ENTRY(_bad_interrupt) 507 - B .S2 IRP 508 - NOP 5 509 - ENDPROC(_bad_interrupt) 510 - 511 - ;; 512 - ;; Entry for NMI/exceptions/syscall 513 - ;; 514 - ENTRY(_nmi_handler) 515 - SAVE_ALL NRP,NTSR 516 - 517 - MVC .S2 EFR,B2 518 - CMPEQ .L2 1,B2,B2 519 - || MVC .S2 TSR,B1 520 - CLR .S2 B1,10,10,B1 521 - MVC .S2 B1,TSR 522 - #ifdef CONFIG_C6X_BIG_KERNEL 523 - [!B2] MVKL .S1 process_exception,A0 524 - [!B2] MVKH .S1 process_exception,A0 525 - [!B2] B .S2X A0 526 - #else 527 - [!B2] B .S2 process_exception 528 - #endif 529 - [B2] B .S2 system_call_saved 530 - [!B2] ADDAW .D2 SP,2,B1 531 - [!B2] MV .D1X B1,A4 532 - ADDKPC .S2 ret_from_trap,B3,2 533 - 534 - ret_from_trap: 535 - MV .D2X A4,B0 536 - [!B0] BNOP .S2 ret_from_exception,5 537 - 538 - #ifdef CONFIG_C6X_BIG_KERNEL 539 - MVKL .S2 system_call_saved_noack,B3 540 - MVKH .S2 system_call_saved_noack,B3 541 - #endif 542 - LDW .D2T2 *+SP(REGS_B0+8),B0 543 - LDW .D2T1 *+SP(REGS_A4+8),A4 544 - LDW .D2T2 *+SP(REGS_B4+8),B4 545 - LDW .D2T1 *+SP(REGS_A6+8),A6 546 - LDW .D2T2 *+SP(REGS_B6+8),B6 547 - LDW .D2T1 *+SP(REGS_A8+8),A8 548 - #ifdef CONFIG_C6X_BIG_KERNEL 549 - || B .S2 B3 550 - #else 551 - || B .S2 system_call_saved_noack 552 - #endif 553 - LDW .D2T2 *+SP(REGS_B8+8),B8 554 - NOP 4 555 - ENDPROC(_nmi_handler) 556 - 557 - ;; 558 - ;; Jump to schedule() then return to ret_from_isr 559 - ;; 560 - #ifdef CONFIG_PREEMPTION 561 - resume_kernel: 562 - GET_THREAD_INFO A12 563 - LDW .D1T1 *+A12(THREAD_INFO_PREEMPT_COUNT),A1 564 - NOP 4 565 - [A1] BNOP .S2 restore_all,5 566 - 567 - preempt_schedule: 568 - GET_THREAD_INFO A2 569 - LDW .D1T1 *+A2(THREAD_INFO_FLAGS),A1 570 - #ifdef CONFIG_C6X_BIG_KERNEL 571 - MVKL .S2 preempt_schedule_irq,B0 572 - MVKH .S2 preempt_schedule_irq,B0 573 - NOP 2 574 - #else 575 - NOP 4 576 - #endif 577 - AND .D1 _TIF_NEED_RESCHED,A1,A1 578 - [!A1] BNOP .S2 restore_all,5 579 - #ifdef CONFIG_C6X_BIG_KERNEL 580 - B .S2 B0 581 - #else 582 - B .S2 preempt_schedule_irq 583 - #endif 584 - ADDKPC .S2 preempt_schedule,B3,4 585 - #endif /* CONFIG_PREEMPTION */ 586 - 587 - ENTRY(enable_exception) 588 - DINT 589 - MVC .S2 TSR,B0 590 - MVC .S2 B3,NRP 591 - MVK .L2 0xc,B1 592 - OR .D2 B0,B1,B0 593 - MVC .S2 B0,TSR ; Set GEE and XEN in TSR 594 - B .S2 NRP 595 - NOP 5 596 - ENDPROC(enable_exception) 597 - 598 - ;; 599 - ;; Special system calls 600 - ;; return address is in B3 601 - ;; 602 - ENTRY(sys_rt_sigreturn) 603 - ADD .D1X SP,8,A4 604 - #ifdef CONFIG_C6X_BIG_KERNEL 605 - || MVKL .S1 do_rt_sigreturn,A0 606 - MVKH .S1 do_rt_sigreturn,A0 607 - BNOP .S2X A0,5 608 - #else 609 - || B .S2 do_rt_sigreturn 610 - NOP 5 611 - #endif 612 - ENDPROC(sys_rt_sigreturn) 613 - 614 - ENTRY(sys_pread_c6x) 615 - MV .D2X A8,B7 616 - #ifdef CONFIG_C6X_BIG_KERNEL 617 - || MVKL .S1 sys_pread64,A0 618 - MVKH .S1 sys_pread64,A0 619 - BNOP .S2X A0,5 620 - #else 621 - || B .S2 sys_pread64 622 - NOP 5 623 - #endif 624 - ENDPROC(sys_pread_c6x) 625 - 626 - ENTRY(sys_pwrite_c6x) 627 - MV .D2X A8,B7 628 - #ifdef CONFIG_C6X_BIG_KERNEL 629 - || MVKL .S1 sys_pwrite64,A0 630 - MVKH .S1 sys_pwrite64,A0 631 - BNOP .S2X A0,5 632 - #else 633 - || B .S2 sys_pwrite64 634 - NOP 5 635 - #endif 636 - ENDPROC(sys_pwrite_c6x) 637 - 638 - ;; On Entry 639 - ;; A4 - path 640 - ;; B4 - offset_lo (LE), offset_hi (BE) 641 - ;; A6 - offset_lo (BE), offset_hi (LE) 642 - ENTRY(sys_truncate64_c6x) 643 - #ifdef CONFIG_CPU_BIG_ENDIAN 644 - MV .S2 B4,B5 645 - MV .D2X A6,B4 646 - #else 647 - MV .D2X A6,B5 648 - #endif 649 - #ifdef CONFIG_C6X_BIG_KERNEL 650 - || MVKL .S1 sys_truncate64,A0 651 - MVKH .S1 sys_truncate64,A0 652 - BNOP .S2X A0,5 653 - #else 654 - || B .S2 sys_truncate64 655 - NOP 5 656 - #endif 657 - ENDPROC(sys_truncate64_c6x) 658 - 659 - ;; On Entry 660 - ;; A4 - fd 661 - ;; B4 - offset_lo (LE), offset_hi (BE) 662 - ;; A6 - offset_lo (BE), offset_hi (LE) 663 - ENTRY(sys_ftruncate64_c6x) 664 - #ifdef CONFIG_CPU_BIG_ENDIAN 665 - MV .S2 B4,B5 666 - MV .D2X A6,B4 667 - #else 668 - MV .D2X A6,B5 669 - #endif 670 - #ifdef CONFIG_C6X_BIG_KERNEL 671 - || MVKL .S1 sys_ftruncate64,A0 672 - MVKH .S1 sys_ftruncate64,A0 673 - BNOP .S2X A0,5 674 - #else 675 - || B .S2 sys_ftruncate64 676 - NOP 5 677 - #endif 678 - ENDPROC(sys_ftruncate64_c6x) 679 - 680 - ;; On Entry 681 - ;; A4 - fd 682 - ;; B4 - offset_lo (LE), offset_hi (BE) 683 - ;; A6 - offset_lo (BE), offset_hi (LE) 684 - ;; B6 - len_lo (LE), len_hi (BE) 685 - ;; A8 - len_lo (BE), len_hi (LE) 686 - ;; B8 - advice 687 - ENTRY(sys_fadvise64_64_c6x) 688 - #ifdef CONFIG_C6X_BIG_KERNEL 689 - MVKL .S1 sys_fadvise64_64,A0 690 - MVKH .S1 sys_fadvise64_64,A0 691 - BNOP .S2X A0,2 692 - #else 693 - B .S2 sys_fadvise64_64 694 - NOP 2 695 - #endif 696 - #ifdef CONFIG_CPU_BIG_ENDIAN 697 - MV .L2 B4,B5 698 - || MV .D2X A6,B4 699 - MV .L1 A8,A6 700 - || MV .D1X B6,A7 701 - #else 702 - MV .D2X A6,B5 703 - MV .L1 A8,A7 704 - || MV .D1X B6,A6 705 - #endif 706 - MV .L2 B8,B6 707 - ENDPROC(sys_fadvise64_64_c6x) 708 - 709 - ;; On Entry 710 - ;; A4 - fd 711 - ;; B4 - mode 712 - ;; A6 - offset_hi 713 - ;; B6 - offset_lo 714 - ;; A8 - len_hi 715 - ;; B8 - len_lo 716 - ENTRY(sys_fallocate_c6x) 717 - #ifdef CONFIG_C6X_BIG_KERNEL 718 - MVKL .S1 sys_fallocate,A0 719 - MVKH .S1 sys_fallocate,A0 720 - BNOP .S2X A0,1 721 - #else 722 - B .S2 sys_fallocate 723 - NOP 724 - #endif 725 - MV .D1 A6,A7 726 - MV .D1X B6,A6 727 - MV .D2X A8,B7 728 - MV .D2 B8,B6 729 - ENDPROC(sys_fallocate_c6x) 730 - 731 - ;; put this in .neardata for faster access when using DSBT mode 732 - .section .neardata,"aw",@progbits 733 - .global current_ksp 734 - .hidden current_ksp 735 - current_ksp: 736 - .word init_thread_union + THREAD_START_SP
-81
arch/c6x/kernel/head.S
··· 1 - ; SPDX-License-Identifier: GPL-2.0-only 2 - ; 3 - ; Port on Texas Instruments TMS320C6x architecture 4 - ; 5 - ; Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - ; Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - ; 8 - #include <linux/linkage.h> 9 - #include <linux/of_fdt.h> 10 - #include <asm/asm-offsets.h> 11 - 12 - __HEAD 13 - ENTRY(_c_int00) 14 - ;; Save magic and pointer 15 - MV .S1 A4,A10 16 - MV .S2 B4,B10 17 - MVKL .S2 __bss_start,B5 18 - MVKH .S2 __bss_start,B5 19 - MVKL .S2 __bss_stop,B6 20 - MVKH .S2 __bss_stop,B6 21 - SUB .L2 B6,B5,B6 ; bss size 22 - 23 - ;; Set the stack pointer 24 - MVKL .S2 current_ksp,B0 25 - MVKH .S2 current_ksp,B0 26 - LDW .D2T2 *B0,B15 27 - 28 - ;; clear bss 29 - SHR .S2 B6,3,B0 ; number of dwords to clear 30 - ZERO .L2 B13 31 - ZERO .L2 B12 32 - bss_loop: 33 - BDEC .S2 bss_loop,B0 34 - NOP 3 35 - CMPLT .L2 B0,0,B1 36 - [!B1] STDW .D2T2 B13:B12,*B5++[1] 37 - 38 - NOP 4 39 - AND .D2 ~7,B15,B15 40 - 41 - ;; Clear GIE and PGIE 42 - MVC .S2 CSR,B2 43 - CLR .S2 B2,0,1,B2 44 - MVC .S2 B2,CSR 45 - MVC .S2 TSR,B2 46 - CLR .S2 B2,0,1,B2 47 - MVC .S2 B2,TSR 48 - MVC .S2 ITSR,B2 49 - CLR .S2 B2,0,1,B2 50 - MVC .S2 B2,ITSR 51 - MVC .S2 NTSR,B2 52 - CLR .S2 B2,0,1,B2 53 - MVC .S2 B2,NTSR 54 - 55 - ;; pass DTB pointer to machine_init (or zero if none) 56 - MVKL .S1 OF_DT_HEADER,A0 57 - MVKH .S1 OF_DT_HEADER,A0 58 - CMPEQ .L1 A10,A0,A0 59 - [A0] MV .S1X B10,A4 60 - [!A0] MVK .S1 0,A4 61 - 62 - #ifdef CONFIG_C6X_BIG_KERNEL 63 - MVKL .S1 machine_init,A0 64 - MVKH .S1 machine_init,A0 65 - B .S2X A0 66 - ADDKPC .S2 0f,B3,4 67 - 0: 68 - #else 69 - CALLP .S2 machine_init,B3 70 - #endif 71 - 72 - ;; Jump to Linux init 73 - #ifdef CONFIG_C6X_BIG_KERNEL 74 - MVKL .S1 start_kernel,A0 75 - MVKH .S1 start_kernel,A0 76 - B .S2X A0 77 - #else 78 - B .S2 start_kernel 79 - #endif 80 - NOP 5 81 - L1: BNOP .S2 L1,5
-127
arch/c6x/kernel/irq.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * Copyright (C) 2011-2012 Texas Instruments Incorporated 4 - * 5 - * This borrows heavily from powerpc version, which is: 6 - * 7 - * Derived from arch/i386/kernel/irq.c 8 - * Copyright (C) 1992 Linus Torvalds 9 - * Adapted from arch/i386 by Gary Thomas 10 - * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 11 - * Updated and modified by Cort Dougan <cort@fsmlabs.com> 12 - * Copyright (C) 1996-2001 Cort Dougan 13 - * Adapted for Power Macintosh by Paul Mackerras 14 - * Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au) 15 - */ 16 - #include <linux/slab.h> 17 - #include <linux/seq_file.h> 18 - #include <linux/radix-tree.h> 19 - #include <linux/module.h> 20 - #include <linux/of.h> 21 - #include <linux/of_irq.h> 22 - #include <linux/interrupt.h> 23 - #include <linux/kernel_stat.h> 24 - 25 - #include <asm/megamod-pic.h> 26 - #include <asm/special_insns.h> 27 - 28 - unsigned long irq_err_count; 29 - 30 - static DEFINE_RAW_SPINLOCK(core_irq_lock); 31 - 32 - static void mask_core_irq(struct irq_data *data) 33 - { 34 - unsigned int prio = data->hwirq; 35 - 36 - raw_spin_lock(&core_irq_lock); 37 - and_creg(IER, ~(1 << prio)); 38 - raw_spin_unlock(&core_irq_lock); 39 - } 40 - 41 - static void unmask_core_irq(struct irq_data *data) 42 - { 43 - unsigned int prio = data->hwirq; 44 - 45 - raw_spin_lock(&core_irq_lock); 46 - or_creg(IER, 1 << prio); 47 - raw_spin_unlock(&core_irq_lock); 48 - } 49 - 50 - static struct irq_chip core_chip = { 51 - .name = "core", 52 - .irq_mask = mask_core_irq, 53 - .irq_unmask = unmask_core_irq, 54 - }; 55 - 56 - static int prio_to_virq[NR_PRIORITY_IRQS]; 57 - 58 - asmlinkage void c6x_do_IRQ(unsigned int prio, struct pt_regs *regs) 59 - { 60 - struct pt_regs *old_regs = set_irq_regs(regs); 61 - 62 - irq_enter(); 63 - 64 - generic_handle_irq(prio_to_virq[prio]); 65 - 66 - irq_exit(); 67 - 68 - set_irq_regs(old_regs); 69 - } 70 - 71 - static struct irq_domain *core_domain; 72 - 73 - static int core_domain_map(struct irq_domain *h, unsigned int virq, 74 - irq_hw_number_t hw) 75 - { 76 - if (hw < 4 || hw >= NR_PRIORITY_IRQS) 77 - return -EINVAL; 78 - 79 - prio_to_virq[hw] = virq; 80 - 81 - irq_set_status_flags(virq, IRQ_LEVEL); 82 - irq_set_chip_and_handler(virq, &core_chip, handle_level_irq); 83 - return 0; 84 - } 85 - 86 - static const struct irq_domain_ops core_domain_ops = { 87 - .map = core_domain_map, 88 - .xlate = irq_domain_xlate_onecell, 89 - }; 90 - 91 - void __init init_IRQ(void) 92 - { 93 - struct device_node *np; 94 - 95 - /* Mask all priority IRQs */ 96 - and_creg(IER, ~0xfff0); 97 - 98 - np = of_find_compatible_node(NULL, NULL, "ti,c64x+core-pic"); 99 - if (np != NULL) { 100 - /* create the core host */ 101 - core_domain = irq_domain_add_linear(np, NR_PRIORITY_IRQS, 102 - &core_domain_ops, NULL); 103 - if (core_domain) 104 - irq_set_default_host(core_domain); 105 - of_node_put(np); 106 - } 107 - 108 - printk(KERN_INFO "Core interrupt controller initialized\n"); 109 - 110 - /* now we're ready for other SoC controllers */ 111 - megamod_pic_init(); 112 - 113 - /* Clear all general IRQ flags */ 114 - set_creg(ICR, 0xfff0); 115 - } 116 - 117 - void ack_bad_irq(int irq) 118 - { 119 - printk(KERN_ERR "IRQ: spurious interrupt %d\n", irq); 120 - irq_err_count++; 121 - } 122 - 123 - int arch_show_interrupts(struct seq_file *p, int prec) 124 - { 125 - seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count); 126 - return 0; 127 - }
-119
arch/c6x/kernel/module.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2005, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Thomas Charleux (thomas.charleux@jaluna.com) 7 - */ 8 - #include <linux/moduleloader.h> 9 - #include <linux/elf.h> 10 - #include <linux/vmalloc.h> 11 - #include <linux/kernel.h> 12 - 13 - static inline int fixup_pcr(u32 *ip, Elf32_Addr dest, u32 maskbits, int shift) 14 - { 15 - u32 opcode; 16 - long ep = (long)ip & ~31; 17 - long delta = ((long)dest - ep) >> 2; 18 - long mask = (1 << maskbits) - 1; 19 - 20 - if ((delta >> (maskbits - 1)) == 0 || 21 - (delta >> (maskbits - 1)) == -1) { 22 - opcode = *ip; 23 - opcode &= ~(mask << shift); 24 - opcode |= ((delta & mask) << shift); 25 - *ip = opcode; 26 - 27 - pr_debug("REL PCR_S%d[%p] dest[%p] opcode[%08x]\n", 28 - maskbits, ip, (void *)dest, opcode); 29 - 30 - return 0; 31 - } 32 - pr_err("PCR_S%d reloc %p -> %p out of range!\n", 33 - maskbits, ip, (void *)dest); 34 - 35 - return -1; 36 - } 37 - 38 - /* 39 - * apply a RELA relocation 40 - */ 41 - int apply_relocate_add(Elf32_Shdr *sechdrs, 42 - const char *strtab, 43 - unsigned int symindex, 44 - unsigned int relsec, 45 - struct module *me) 46 - { 47 - Elf32_Rela *rel = (void *) sechdrs[relsec].sh_addr; 48 - Elf_Sym *sym; 49 - u32 *location, opcode; 50 - unsigned int i; 51 - Elf32_Addr v; 52 - Elf_Addr offset = 0; 53 - 54 - pr_debug("Applying relocate section %u to %u with offset 0x%x\n", 55 - relsec, sechdrs[relsec].sh_info, offset); 56 - 57 - for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { 58 - /* This is where to make the change */ 59 - location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr 60 - + rel[i].r_offset - offset; 61 - 62 - /* This is the symbol it is referring to. Note that all 63 - undefined symbols have been resolved. */ 64 - sym = (Elf_Sym *)sechdrs[symindex].sh_addr 65 - + ELF32_R_SYM(rel[i].r_info); 66 - 67 - /* this is the adjustment to be made */ 68 - v = sym->st_value + rel[i].r_addend; 69 - 70 - switch (ELF32_R_TYPE(rel[i].r_info)) { 71 - case R_C6000_ABS32: 72 - pr_debug("RELA ABS32: [%p] = 0x%x\n", location, v); 73 - *location = v; 74 - break; 75 - case R_C6000_ABS16: 76 - pr_debug("RELA ABS16: [%p] = 0x%x\n", location, v); 77 - *(u16 *)location = v; 78 - break; 79 - case R_C6000_ABS8: 80 - pr_debug("RELA ABS8: [%p] = 0x%x\n", location, v); 81 - *(u8 *)location = v; 82 - break; 83 - case R_C6000_ABS_L16: 84 - opcode = *location; 85 - opcode &= ~0x7fff80; 86 - opcode |= ((v & 0xffff) << 7); 87 - pr_debug("RELA ABS_L16[%p] v[0x%x] opcode[0x%x]\n", 88 - location, v, opcode); 89 - *location = opcode; 90 - break; 91 - case R_C6000_ABS_H16: 92 - opcode = *location; 93 - opcode &= ~0x7fff80; 94 - opcode |= ((v >> 9) & 0x7fff80); 95 - pr_debug("RELA ABS_H16[%p] v[0x%x] opcode[0x%x]\n", 96 - location, v, opcode); 97 - *location = opcode; 98 - break; 99 - case R_C6000_PCR_S21: 100 - if (fixup_pcr(location, v, 21, 7)) 101 - return -ENOEXEC; 102 - break; 103 - case R_C6000_PCR_S12: 104 - if (fixup_pcr(location, v, 12, 16)) 105 - return -ENOEXEC; 106 - break; 107 - case R_C6000_PCR_S10: 108 - if (fixup_pcr(location, v, 10, 13)) 109 - return -ENOEXEC; 110 - break; 111 - default: 112 - pr_err("module %s: Unknown RELA relocation: %u\n", 113 - me->name, ELF32_R_TYPE(rel[i].r_info)); 114 - return -ENOEXEC; 115 - } 116 - } 117 - 118 - return 0; 119 - }
-151
arch/c6x/kernel/process.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #include <linux/module.h> 9 - #include <linux/unistd.h> 10 - #include <linux/ptrace.h> 11 - #include <linux/init_task.h> 12 - #include <linux/tick.h> 13 - #include <linux/mqueue.h> 14 - #include <linux/syscalls.h> 15 - #include <linux/reboot.h> 16 - #include <linux/sched/task.h> 17 - #include <linux/sched/task_stack.h> 18 - 19 - #include <asm/syscalls.h> 20 - 21 - /* hooks for board specific support */ 22 - void (*c6x_restart)(void); 23 - void (*c6x_halt)(void); 24 - 25 - extern asmlinkage void ret_from_fork(void); 26 - extern asmlinkage void ret_from_kernel_thread(void); 27 - 28 - /* 29 - * power off function, if any 30 - */ 31 - void (*pm_power_off)(void); 32 - EXPORT_SYMBOL(pm_power_off); 33 - 34 - void arch_cpu_idle(void) 35 - { 36 - unsigned long tmp; 37 - 38 - /* 39 - * Put local_irq_enable and idle in same execute packet 40 - * to make them atomic and avoid race to idle with 41 - * interrupts enabled. 42 - */ 43 - asm volatile (" mvc .s2 CSR,%0\n" 44 - " or .d2 1,%0,%0\n" 45 - " mvc .s2 %0,CSR\n" 46 - "|| idle\n" 47 - : "=b"(tmp)); 48 - } 49 - 50 - static void halt_loop(void) 51 - { 52 - printk(KERN_EMERG "System Halted, OK to turn off power\n"); 53 - local_irq_disable(); 54 - while (1) 55 - asm volatile("idle\n"); 56 - } 57 - 58 - void machine_restart(char *__unused) 59 - { 60 - if (c6x_restart) 61 - c6x_restart(); 62 - halt_loop(); 63 - } 64 - 65 - void machine_halt(void) 66 - { 67 - if (c6x_halt) 68 - c6x_halt(); 69 - halt_loop(); 70 - } 71 - 72 - void machine_power_off(void) 73 - { 74 - if (pm_power_off) 75 - pm_power_off(); 76 - halt_loop(); 77 - } 78 - 79 - void flush_thread(void) 80 - { 81 - } 82 - 83 - /* 84 - * Do necessary setup to start up a newly executed thread. 85 - */ 86 - void start_thread(struct pt_regs *regs, unsigned int pc, unsigned long usp) 87 - { 88 - /* 89 - * The binfmt loader will setup a "full" stack, but the C6X 90 - * operates an "empty" stack. So we adjust the usp so that 91 - * argc doesn't get destroyed if an interrupt is taken before 92 - * it is read from the stack. 93 - * 94 - * NB: Library startup code needs to match this. 95 - */ 96 - usp -= 8; 97 - 98 - regs->pc = pc; 99 - regs->sp = usp; 100 - regs->tsr |= 0x40; /* set user mode */ 101 - current->thread.usp = usp; 102 - } 103 - 104 - /* 105 - * Copy a new thread context in its stack. 106 - */ 107 - int copy_thread(unsigned long clone_flags, unsigned long usp, 108 - unsigned long ustk_size, struct task_struct *p, 109 - unsigned long tls) 110 - { 111 - struct pt_regs *childregs; 112 - 113 - childregs = task_pt_regs(p); 114 - 115 - if (unlikely(p->flags & PF_KTHREAD)) { 116 - /* case of __kernel_thread: we return to supervisor space */ 117 - memset(childregs, 0, sizeof(struct pt_regs)); 118 - childregs->sp = (unsigned long)(childregs + 1); 119 - p->thread.pc = (unsigned long) ret_from_kernel_thread; 120 - childregs->a0 = usp; /* function */ 121 - childregs->a1 = ustk_size; /* argument */ 122 - } else { 123 - /* Otherwise use the given stack */ 124 - *childregs = *current_pt_regs(); 125 - if (usp) 126 - childregs->sp = usp; 127 - p->thread.pc = (unsigned long) ret_from_fork; 128 - } 129 - 130 - /* Set usp/ksp */ 131 - p->thread.usp = childregs->sp; 132 - thread_saved_ksp(p) = (unsigned long)childregs - 8; 133 - p->thread.wchan = p->thread.pc; 134 - #ifdef __DSBT__ 135 - { 136 - unsigned long dp; 137 - 138 - asm volatile ("mv .S2 b14,%0\n" : "=b"(dp)); 139 - 140 - thread_saved_dp(p) = dp; 141 - if (usp == -1) 142 - childregs->dp = dp; 143 - } 144 - #endif 145 - return 0; 146 - } 147 - 148 - unsigned long get_wchan(struct task_struct *p) 149 - { 150 - return p->thread.wchan; 151 - }
-139
arch/c6x/kernel/ptrace.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - * 8 - * Updated for 2.6.34: Mark Salter <msalter@redhat.com> 9 - */ 10 - #include <linux/ptrace.h> 11 - #include <linux/tracehook.h> 12 - #include <linux/regset.h> 13 - #include <linux/elf.h> 14 - #include <linux/sched/task_stack.h> 15 - 16 - #include <asm/cacheflush.h> 17 - 18 - #define PT_REG_SIZE (sizeof(struct pt_regs)) 19 - 20 - /* 21 - * Called by kernel/ptrace.c when detaching. 22 - */ 23 - void ptrace_disable(struct task_struct *child) 24 - { 25 - /* nothing to do */ 26 - } 27 - 28 - /* 29 - * Get a register number from live pt_regs for the specified task. 30 - */ 31 - static inline long get_reg(struct task_struct *task, int regno) 32 - { 33 - long *addr = (long *)task_pt_regs(task); 34 - 35 - if (regno == PT_TSR || regno == PT_CSR) 36 - return 0; 37 - 38 - return addr[regno]; 39 - } 40 - 41 - /* 42 - * Write contents of register REGNO in task TASK. 43 - */ 44 - static inline int put_reg(struct task_struct *task, 45 - int regno, 46 - unsigned long data) 47 - { 48 - unsigned long *addr = (unsigned long *)task_pt_regs(task); 49 - 50 - if (regno != PT_TSR && regno != PT_CSR) 51 - addr[regno] = data; 52 - 53 - return 0; 54 - } 55 - 56 - /* regset get/set implementations */ 57 - 58 - static int gpr_get(struct task_struct *target, 59 - const struct user_regset *regset, 60 - struct membuf to) 61 - { 62 - return membuf_write(&to, task_pt_regs(target), sizeof(struct pt_regs)); 63 - } 64 - 65 - enum c6x_regset { 66 - REGSET_GPR, 67 - }; 68 - 69 - static const struct user_regset c6x_regsets[] = { 70 - [REGSET_GPR] = { 71 - .core_note_type = NT_PRSTATUS, 72 - .n = ELF_NGREG, 73 - .size = sizeof(u32), 74 - .align = sizeof(u32), 75 - .regset_get = gpr_get, 76 - }, 77 - }; 78 - 79 - static const struct user_regset_view user_c6x_native_view = { 80 - .name = "tic6x", 81 - .e_machine = EM_TI_C6000, 82 - .regsets = c6x_regsets, 83 - .n = ARRAY_SIZE(c6x_regsets), 84 - }; 85 - 86 - const struct user_regset_view *task_user_regset_view(struct task_struct *task) 87 - { 88 - return &user_c6x_native_view; 89 - } 90 - 91 - /* 92 - * Perform ptrace request 93 - */ 94 - long arch_ptrace(struct task_struct *child, long request, 95 - unsigned long addr, unsigned long data) 96 - { 97 - int ret = 0; 98 - 99 - switch (request) { 100 - /* 101 - * write the word at location addr. 102 - */ 103 - case PTRACE_POKETEXT: 104 - ret = generic_ptrace_pokedata(child, addr, data); 105 - if (ret == 0 && request == PTRACE_POKETEXT) 106 - flush_icache_range(addr, addr + 4); 107 - break; 108 - default: 109 - ret = ptrace_request(child, request, addr, data); 110 - break; 111 - } 112 - 113 - return ret; 114 - } 115 - 116 - /* 117 - * handle tracing of system call entry 118 - * - return the revised system call number or ULONG_MAX to cause ENOSYS 119 - */ 120 - asmlinkage unsigned long syscall_trace_entry(struct pt_regs *regs) 121 - { 122 - if (tracehook_report_syscall_entry(regs)) 123 - /* tracing decided this syscall should not happen, so 124 - * We'll return a bogus call number to get an ENOSYS 125 - * error, but leave the original number in 126 - * regs->orig_a4 127 - */ 128 - return ULONG_MAX; 129 - 130 - return regs->b0; 131 - } 132 - 133 - /* 134 - * handle tracing of system call exit 135 - */ 136 - asmlinkage void syscall_trace_exit(struct pt_regs *regs) 137 - { 138 - tracehook_report_syscall_exit(regs, 0); 139 - }
-476
arch/c6x/kernel/setup.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #include <linux/dma-mapping.h> 9 - #include <linux/memblock.h> 10 - #include <linux/seq_file.h> 11 - #include <linux/clkdev.h> 12 - #include <linux/initrd.h> 13 - #include <linux/kernel.h> 14 - #include <linux/module.h> 15 - #include <linux/of_fdt.h> 16 - #include <linux/string.h> 17 - #include <linux/errno.h> 18 - #include <linux/cache.h> 19 - #include <linux/delay.h> 20 - #include <linux/sched.h> 21 - #include <linux/clk.h> 22 - #include <linux/cpu.h> 23 - #include <linux/fs.h> 24 - #include <linux/of.h> 25 - #include <linux/console.h> 26 - #include <linux/screen_info.h> 27 - 28 - #include <asm/sections.h> 29 - #include <asm/div64.h> 30 - #include <asm/setup.h> 31 - #include <asm/dscr.h> 32 - #include <asm/clock.h> 33 - #include <asm/soc.h> 34 - #include <asm/special_insns.h> 35 - 36 - static const char *c6x_soc_name; 37 - 38 - struct screen_info screen_info; 39 - 40 - int c6x_num_cores; 41 - EXPORT_SYMBOL_GPL(c6x_num_cores); 42 - 43 - unsigned int c6x_silicon_rev; 44 - EXPORT_SYMBOL_GPL(c6x_silicon_rev); 45 - 46 - /* 47 - * Device status register. This holds information 48 - * about device configuration needed by some drivers. 49 - */ 50 - unsigned int c6x_devstat; 51 - EXPORT_SYMBOL_GPL(c6x_devstat); 52 - 53 - /* 54 - * Some SoCs have fuse registers holding a unique MAC 55 - * address. This is parsed out of the device tree with 56 - * the resulting MAC being held here. 57 - */ 58 - unsigned char c6x_fuse_mac[6]; 59 - 60 - unsigned long memory_start; 61 - unsigned long memory_end; 62 - EXPORT_SYMBOL(memory_end); 63 - 64 - unsigned long ram_start; 65 - unsigned long ram_end; 66 - 67 - /* Uncached memory for DMA consistent use (memdma=) */ 68 - static unsigned long dma_start __initdata; 69 - static unsigned long dma_size __initdata; 70 - 71 - struct cpuinfo_c6x { 72 - const char *cpu_name; 73 - const char *cpu_voltage; 74 - const char *mmu; 75 - const char *fpu; 76 - char *cpu_rev; 77 - unsigned int core_id; 78 - char __cpu_rev[5]; 79 - }; 80 - 81 - static DEFINE_PER_CPU(struct cpuinfo_c6x, cpu_data); 82 - 83 - unsigned int ticks_per_ns_scaled; 84 - EXPORT_SYMBOL(ticks_per_ns_scaled); 85 - 86 - unsigned int c6x_core_freq; 87 - 88 - static void __init get_cpuinfo(void) 89 - { 90 - unsigned cpu_id, rev_id, csr; 91 - struct clk *coreclk = clk_get_sys(NULL, "core"); 92 - unsigned long core_khz; 93 - u64 tmp; 94 - struct cpuinfo_c6x *p; 95 - struct device_node *node; 96 - 97 - p = &per_cpu(cpu_data, smp_processor_id()); 98 - 99 - if (!IS_ERR(coreclk)) 100 - c6x_core_freq = clk_get_rate(coreclk); 101 - else { 102 - printk(KERN_WARNING 103 - "Cannot find core clock frequency. Using 700MHz\n"); 104 - c6x_core_freq = 700000000; 105 - } 106 - 107 - core_khz = c6x_core_freq / 1000; 108 - 109 - tmp = (uint64_t)core_khz << C6X_NDELAY_SCALE; 110 - do_div(tmp, 1000000); 111 - ticks_per_ns_scaled = tmp; 112 - 113 - csr = get_creg(CSR); 114 - cpu_id = csr >> 24; 115 - rev_id = (csr >> 16) & 0xff; 116 - 117 - p->mmu = "none"; 118 - p->fpu = "none"; 119 - p->cpu_voltage = "unknown"; 120 - 121 - switch (cpu_id) { 122 - case 0: 123 - p->cpu_name = "C67x"; 124 - p->fpu = "yes"; 125 - break; 126 - case 2: 127 - p->cpu_name = "C62x"; 128 - break; 129 - case 8: 130 - p->cpu_name = "C64x"; 131 - break; 132 - case 12: 133 - p->cpu_name = "C64x"; 134 - break; 135 - case 16: 136 - p->cpu_name = "C64x+"; 137 - p->cpu_voltage = "1.2"; 138 - break; 139 - case 21: 140 - p->cpu_name = "C66X"; 141 - p->cpu_voltage = "1.2"; 142 - break; 143 - default: 144 - p->cpu_name = "unknown"; 145 - break; 146 - } 147 - 148 - if (cpu_id < 16) { 149 - switch (rev_id) { 150 - case 0x1: 151 - if (cpu_id > 8) { 152 - p->cpu_rev = "DM640/DM641/DM642/DM643"; 153 - p->cpu_voltage = "1.2 - 1.4"; 154 - } else { 155 - p->cpu_rev = "C6201"; 156 - p->cpu_voltage = "2.5"; 157 - } 158 - break; 159 - case 0x2: 160 - p->cpu_rev = "C6201B/C6202/C6211"; 161 - p->cpu_voltage = "1.8"; 162 - break; 163 - case 0x3: 164 - p->cpu_rev = "C6202B/C6203/C6204/C6205"; 165 - p->cpu_voltage = "1.5"; 166 - break; 167 - case 0x201: 168 - p->cpu_rev = "C6701 revision 0 (early CPU)"; 169 - p->cpu_voltage = "1.8"; 170 - break; 171 - case 0x202: 172 - p->cpu_rev = "C6701/C6711/C6712"; 173 - p->cpu_voltage = "1.8"; 174 - break; 175 - case 0x801: 176 - p->cpu_rev = "C64x"; 177 - p->cpu_voltage = "1.5"; 178 - break; 179 - default: 180 - p->cpu_rev = "unknown"; 181 - } 182 - } else { 183 - p->cpu_rev = p->__cpu_rev; 184 - snprintf(p->__cpu_rev, sizeof(p->__cpu_rev), "0x%x", cpu_id); 185 - } 186 - 187 - p->core_id = get_coreid(); 188 - 189 - for_each_of_cpu_node(node) 190 - ++c6x_num_cores; 191 - 192 - node = of_find_node_by_name(NULL, "soc"); 193 - if (node) { 194 - if (of_property_read_string(node, "model", &c6x_soc_name)) 195 - c6x_soc_name = "unknown"; 196 - of_node_put(node); 197 - } else 198 - c6x_soc_name = "unknown"; 199 - 200 - printk(KERN_INFO "CPU%d: %s rev %s, %s volts, %uMHz\n", 201 - p->core_id, p->cpu_name, p->cpu_rev, 202 - p->cpu_voltage, c6x_core_freq / 1000000); 203 - } 204 - 205 - /* 206 - * Early parsing of the command line 207 - */ 208 - static u32 mem_size __initdata; 209 - 210 - /* "mem=" parsing. */ 211 - static int __init early_mem(char *p) 212 - { 213 - if (!p) 214 - return -EINVAL; 215 - 216 - mem_size = memparse(p, &p); 217 - /* don't remove all of memory when handling "mem={invalid}" */ 218 - if (mem_size == 0) 219 - return -EINVAL; 220 - 221 - return 0; 222 - } 223 - early_param("mem", early_mem); 224 - 225 - /* "memdma=<size>[@<address>]" parsing. */ 226 - static int __init early_memdma(char *p) 227 - { 228 - if (!p) 229 - return -EINVAL; 230 - 231 - dma_size = memparse(p, &p); 232 - if (*p == '@') 233 - dma_start = memparse(p, &p); 234 - 235 - return 0; 236 - } 237 - early_param("memdma", early_memdma); 238 - 239 - int __init c6x_add_memory(phys_addr_t start, unsigned long size) 240 - { 241 - static int ram_found __initdata; 242 - 243 - /* We only handle one bank (the one with PAGE_OFFSET) for now */ 244 - if (ram_found) 245 - return -EINVAL; 246 - 247 - if (start > PAGE_OFFSET || PAGE_OFFSET >= (start + size)) 248 - return 0; 249 - 250 - ram_start = start; 251 - ram_end = start + size; 252 - 253 - ram_found = 1; 254 - return 0; 255 - } 256 - 257 - /* 258 - * Do early machine setup and device tree parsing. This is called very 259 - * early on the boot process. 260 - */ 261 - notrace void __init machine_init(unsigned long dt_ptr) 262 - { 263 - void *dtb = __va(dt_ptr); 264 - void *fdt = __dtb_start; 265 - 266 - /* interrupts must be masked */ 267 - set_creg(IER, 2); 268 - 269 - /* 270 - * Set the Interrupt Service Table (IST) to the beginning of the 271 - * vector table. 272 - */ 273 - set_ist(_vectors_start); 274 - 275 - /* 276 - * dtb is passed in from bootloader. 277 - * fdt is linked in blob. 278 - */ 279 - if (dtb && dtb != fdt) 280 - fdt = dtb; 281 - 282 - /* Do some early initialization based on the flat device tree */ 283 - early_init_dt_scan(fdt); 284 - 285 - parse_early_param(); 286 - } 287 - 288 - void __init setup_arch(char **cmdline_p) 289 - { 290 - phys_addr_t start, end; 291 - u64 i; 292 - 293 - printk(KERN_INFO "Initializing kernel\n"); 294 - 295 - /* Initialize command line */ 296 - *cmdline_p = boot_command_line; 297 - 298 - memory_end = ram_end; 299 - memory_end &= ~(PAGE_SIZE - 1); 300 - 301 - if (mem_size && (PAGE_OFFSET + PAGE_ALIGN(mem_size)) < memory_end) 302 - memory_end = PAGE_OFFSET + PAGE_ALIGN(mem_size); 303 - 304 - /* add block that this kernel can use */ 305 - memblock_add(PAGE_OFFSET, memory_end - PAGE_OFFSET); 306 - 307 - /* reserve kernel text/data/bss */ 308 - memblock_reserve(PAGE_OFFSET, 309 - PAGE_ALIGN((unsigned long)&_end - PAGE_OFFSET)); 310 - 311 - if (dma_size) { 312 - /* align to cacheability granularity */ 313 - dma_size = CACHE_REGION_END(dma_size); 314 - 315 - if (!dma_start) 316 - dma_start = memory_end - dma_size; 317 - 318 - /* align to cacheability granularity */ 319 - dma_start = CACHE_REGION_START(dma_start); 320 - 321 - /* reserve DMA memory taken from kernel memory */ 322 - if (memblock_is_region_memory(dma_start, dma_size)) 323 - memblock_reserve(dma_start, dma_size); 324 - } 325 - 326 - memory_start = PAGE_ALIGN((unsigned int) &_end); 327 - 328 - printk(KERN_INFO "Memory Start=%08lx, Memory End=%08lx\n", 329 - memory_start, memory_end); 330 - 331 - #ifdef CONFIG_BLK_DEV_INITRD 332 - /* 333 - * Reserve initrd memory if in kernel memory. 334 - */ 335 - if (initrd_start < initrd_end) 336 - if (memblock_is_region_memory(initrd_start, 337 - initrd_end - initrd_start)) 338 - memblock_reserve(initrd_start, 339 - initrd_end - initrd_start); 340 - #endif 341 - 342 - init_mm.start_code = (unsigned long) &_stext; 343 - init_mm.end_code = (unsigned long) &_etext; 344 - init_mm.end_data = memory_start; 345 - init_mm.brk = memory_start; 346 - 347 - unflatten_and_copy_device_tree(); 348 - 349 - c6x_cache_init(); 350 - 351 - /* Set the whole external memory as non-cacheable */ 352 - disable_caching(ram_start, ram_end - 1); 353 - 354 - /* Set caching of external RAM used by Linux */ 355 - for_each_mem_range(i, &start, &end) 356 - enable_caching(CACHE_REGION_START(start), 357 - CACHE_REGION_START(end - 1)); 358 - 359 - #ifdef CONFIG_BLK_DEV_INITRD 360 - /* 361 - * Enable caching for initrd which falls outside kernel memory. 362 - */ 363 - if (initrd_start < initrd_end) { 364 - if (!memblock_is_region_memory(initrd_start, 365 - initrd_end - initrd_start)) 366 - enable_caching(CACHE_REGION_START(initrd_start), 367 - CACHE_REGION_START(initrd_end - 1)); 368 - } 369 - #endif 370 - 371 - /* 372 - * Disable caching for dma coherent memory taken from kernel memory. 373 - */ 374 - if (dma_size && memblock_is_region_memory(dma_start, dma_size)) 375 - disable_caching(dma_start, 376 - CACHE_REGION_START(dma_start + dma_size - 1)); 377 - 378 - /* Initialize the coherent memory allocator */ 379 - coherent_mem_init(dma_start, dma_size); 380 - 381 - max_low_pfn = PFN_DOWN(memory_end); 382 - min_low_pfn = PFN_UP(memory_start); 383 - max_pfn = max_low_pfn; 384 - max_mapnr = max_low_pfn - min_low_pfn; 385 - 386 - /* Get kmalloc into gear */ 387 - paging_init(); 388 - 389 - /* 390 - * Probe for Device State Configuration Registers. 391 - * We have to do this early in case timer needs to be enabled 392 - * through DSCR. 393 - */ 394 - dscr_probe(); 395 - 396 - /* We do this early for timer and core clock frequency */ 397 - c64x_setup_clocks(); 398 - 399 - /* Get CPU info */ 400 - get_cpuinfo(); 401 - 402 - #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) 403 - conswitchp = &dummy_con; 404 - #endif 405 - } 406 - 407 - #define cpu_to_ptr(n) ((void *)((long)(n)+1)) 408 - #define ptr_to_cpu(p) ((long)(p) - 1) 409 - 410 - static int show_cpuinfo(struct seq_file *m, void *v) 411 - { 412 - int n = ptr_to_cpu(v); 413 - struct cpuinfo_c6x *p = &per_cpu(cpu_data, n); 414 - 415 - if (n == 0) { 416 - seq_printf(m, 417 - "soc\t\t: %s\n" 418 - "soc revision\t: 0x%x\n" 419 - "soc cores\t: %d\n", 420 - c6x_soc_name, c6x_silicon_rev, c6x_num_cores); 421 - } 422 - 423 - seq_printf(m, 424 - "\n" 425 - "processor\t: %d\n" 426 - "cpu\t\t: %s\n" 427 - "core revision\t: %s\n" 428 - "core voltage\t: %s\n" 429 - "core id\t\t: %d\n" 430 - "mmu\t\t: %s\n" 431 - "fpu\t\t: %s\n" 432 - "cpu MHz\t\t: %u\n" 433 - "bogomips\t: %lu.%02lu\n\n", 434 - n, 435 - p->cpu_name, p->cpu_rev, p->cpu_voltage, 436 - p->core_id, p->mmu, p->fpu, 437 - (c6x_core_freq + 500000) / 1000000, 438 - (loops_per_jiffy/(500000/HZ)), 439 - (loops_per_jiffy/(5000/HZ))%100); 440 - 441 - return 0; 442 - } 443 - 444 - static void *c_start(struct seq_file *m, loff_t *pos) 445 - { 446 - return *pos < nr_cpu_ids ? cpu_to_ptr(*pos) : NULL; 447 - } 448 - static void *c_next(struct seq_file *m, void *v, loff_t *pos) 449 - { 450 - ++*pos; 451 - return NULL; 452 - } 453 - static void c_stop(struct seq_file *m, void *v) 454 - { 455 - } 456 - 457 - const struct seq_operations cpuinfo_op = { 458 - c_start, 459 - c_stop, 460 - c_next, 461 - show_cpuinfo 462 - }; 463 - 464 - static struct cpu cpu_devices[NR_CPUS]; 465 - 466 - static int __init topology_init(void) 467 - { 468 - int i; 469 - 470 - for_each_present_cpu(i) 471 - register_cpu(&cpu_devices[i], i); 472 - 473 - return 0; 474 - } 475 - 476 - subsys_initcall(topology_init);
-322
arch/c6x/kernel/signal.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - * 8 - * Updated for 2.6.34: Mark Salter <msalter@redhat.com> 9 - */ 10 - 11 - #include <linux/kernel.h> 12 - #include <linux/uaccess.h> 13 - #include <linux/syscalls.h> 14 - #include <linux/tracehook.h> 15 - 16 - #include <asm/asm-offsets.h> 17 - #include <asm/ucontext.h> 18 - #include <asm/cacheflush.h> 19 - 20 - 21 - /* 22 - * Do a signal return, undo the signal stack. 23 - */ 24 - 25 - #define RETCODE_SIZE (9 << 2) /* 9 instructions = 36 bytes */ 26 - 27 - struct rt_sigframe { 28 - struct siginfo __user *pinfo; 29 - void __user *puc; 30 - struct siginfo info; 31 - struct ucontext uc; 32 - unsigned long retcode[RETCODE_SIZE >> 2]; 33 - }; 34 - 35 - static int restore_sigcontext(struct pt_regs *regs, 36 - struct sigcontext __user *sc) 37 - { 38 - int err = 0; 39 - 40 - /* The access_ok check was done by caller, so use __get_user here */ 41 - #define COPY(x) (err |= __get_user(regs->x, &sc->sc_##x)) 42 - 43 - COPY(sp); COPY(a4); COPY(b4); COPY(a6); COPY(b6); COPY(a8); COPY(b8); 44 - COPY(a0); COPY(a1); COPY(a2); COPY(a3); COPY(a5); COPY(a7); COPY(a9); 45 - COPY(b0); COPY(b1); COPY(b2); COPY(b3); COPY(b5); COPY(b7); COPY(b9); 46 - 47 - COPY(a16); COPY(a17); COPY(a18); COPY(a19); 48 - COPY(a20); COPY(a21); COPY(a22); COPY(a23); 49 - COPY(a24); COPY(a25); COPY(a26); COPY(a27); 50 - COPY(a28); COPY(a29); COPY(a30); COPY(a31); 51 - COPY(b16); COPY(b17); COPY(b18); COPY(b19); 52 - COPY(b20); COPY(b21); COPY(b22); COPY(b23); 53 - COPY(b24); COPY(b25); COPY(b26); COPY(b27); 54 - COPY(b28); COPY(b29); COPY(b30); COPY(b31); 55 - 56 - COPY(csr); COPY(pc); 57 - 58 - #undef COPY 59 - 60 - return err; 61 - } 62 - 63 - asmlinkage int do_rt_sigreturn(struct pt_regs *regs) 64 - { 65 - struct rt_sigframe __user *frame; 66 - sigset_t set; 67 - 68 - /* Always make any pending restarted system calls return -EINTR */ 69 - current->restart_block.fn = do_no_restart_syscall; 70 - 71 - /* 72 - * Since we stacked the signal on a dword boundary, 73 - * 'sp' should be dword aligned here. If it's 74 - * not, then the user is trying to mess with us. 75 - */ 76 - if (regs->sp & 7) 77 - goto badframe; 78 - 79 - frame = (struct rt_sigframe __user *) ((unsigned long) regs->sp + 8); 80 - 81 - if (!access_ok(frame, sizeof(*frame))) 82 - goto badframe; 83 - if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 84 - goto badframe; 85 - 86 - set_current_blocked(&set); 87 - 88 - if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 89 - goto badframe; 90 - 91 - return regs->a4; 92 - 93 - badframe: 94 - force_sig(SIGSEGV); 95 - return 0; 96 - } 97 - 98 - static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, 99 - unsigned long mask) 100 - { 101 - int err = 0; 102 - 103 - err |= __put_user(mask, &sc->sc_mask); 104 - 105 - /* The access_ok check was done by caller, so use __put_user here */ 106 - #define COPY(x) (err |= __put_user(regs->x, &sc->sc_##x)) 107 - 108 - COPY(sp); COPY(a4); COPY(b4); COPY(a6); COPY(b6); COPY(a8); COPY(b8); 109 - COPY(a0); COPY(a1); COPY(a2); COPY(a3); COPY(a5); COPY(a7); COPY(a9); 110 - COPY(b0); COPY(b1); COPY(b2); COPY(b3); COPY(b5); COPY(b7); COPY(b9); 111 - 112 - COPY(a16); COPY(a17); COPY(a18); COPY(a19); 113 - COPY(a20); COPY(a21); COPY(a22); COPY(a23); 114 - COPY(a24); COPY(a25); COPY(a26); COPY(a27); 115 - COPY(a28); COPY(a29); COPY(a30); COPY(a31); 116 - COPY(b16); COPY(b17); COPY(b18); COPY(b19); 117 - COPY(b20); COPY(b21); COPY(b22); COPY(b23); 118 - COPY(b24); COPY(b25); COPY(b26); COPY(b27); 119 - COPY(b28); COPY(b29); COPY(b30); COPY(b31); 120 - 121 - COPY(csr); COPY(pc); 122 - 123 - #undef COPY 124 - 125 - return err; 126 - } 127 - 128 - static inline void __user *get_sigframe(struct ksignal *ksig, 129 - struct pt_regs *regs, 130 - unsigned long framesize) 131 - { 132 - unsigned long sp = sigsp(regs->sp, ksig); 133 - 134 - /* 135 - * No matter what happens, 'sp' must be dword 136 - * aligned. Otherwise, nasty things will happen 137 - */ 138 - return (void __user *)((sp - framesize) & ~7); 139 - } 140 - 141 - static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, 142 - struct pt_regs *regs) 143 - { 144 - struct rt_sigframe __user *frame; 145 - unsigned long __user *retcode; 146 - int err = 0; 147 - 148 - frame = get_sigframe(ksig, regs, sizeof(*frame)); 149 - 150 - if (!access_ok(frame, sizeof(*frame))) 151 - return -EFAULT; 152 - 153 - err |= __put_user(&frame->info, &frame->pinfo); 154 - err |= __put_user(&frame->uc, &frame->puc); 155 - err |= copy_siginfo_to_user(&frame->info, &ksig->info); 156 - 157 - /* Clear all the bits of the ucontext we don't use. */ 158 - err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext)); 159 - 160 - err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 161 - err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 162 - 163 - /* Set up to return from userspace */ 164 - retcode = (unsigned long __user *) &frame->retcode; 165 - 166 - /* The access_ok check was done above, so use __put_user here */ 167 - #define COPY(x) (err |= __put_user(x, retcode++)) 168 - 169 - COPY(0x0000002AUL | (__NR_rt_sigreturn << 7)); 170 - /* MVK __NR_rt_sigreturn,B0 */ 171 - COPY(0x10000000UL); /* SWE */ 172 - COPY(0x00006000UL); /* NOP 4 */ 173 - COPY(0x00006000UL); /* NOP 4 */ 174 - COPY(0x00006000UL); /* NOP 4 */ 175 - COPY(0x00006000UL); /* NOP 4 */ 176 - COPY(0x00006000UL); /* NOP 4 */ 177 - COPY(0x00006000UL); /* NOP 4 */ 178 - COPY(0x00006000UL); /* NOP 4 */ 179 - 180 - #undef COPY 181 - 182 - if (err) 183 - return -EFAULT; 184 - 185 - flush_icache_range((unsigned long) &frame->retcode, 186 - (unsigned long) &frame->retcode + RETCODE_SIZE); 187 - 188 - retcode = (unsigned long __user *) &frame->retcode; 189 - 190 - /* Change user context to branch to signal handler */ 191 - regs->sp = (unsigned long) frame - 8; 192 - regs->b3 = (unsigned long) retcode; 193 - regs->pc = (unsigned long) ksig->ka.sa.sa_handler; 194 - 195 - /* Give the signal number to the handler */ 196 - regs->a4 = ksig->sig; 197 - 198 - /* 199 - * For realtime signals we must also set the second and third 200 - * arguments for the signal handler. 201 - * -- Peter Maydell <pmaydell@chiark.greenend.org.uk> 2000-12-06 202 - */ 203 - regs->b4 = (unsigned long)&frame->info; 204 - regs->a6 = (unsigned long)&frame->uc; 205 - 206 - return 0; 207 - } 208 - 209 - static inline void 210 - handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) 211 - { 212 - switch (regs->a4) { 213 - case -ERESTARTNOHAND: 214 - if (!has_handler) 215 - goto do_restart; 216 - regs->a4 = -EINTR; 217 - break; 218 - 219 - case -ERESTARTSYS: 220 - if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) { 221 - regs->a4 = -EINTR; 222 - break; 223 - } 224 - fallthrough; 225 - case -ERESTARTNOINTR: 226 - do_restart: 227 - regs->a4 = regs->orig_a4; 228 - regs->pc -= 4; 229 - break; 230 - } 231 - } 232 - 233 - /* 234 - * handle the actual delivery of a signal to userspace 235 - */ 236 - static void handle_signal(struct ksignal *ksig, struct pt_regs *regs, 237 - int syscall) 238 - { 239 - int ret; 240 - 241 - /* Are we from a system call? */ 242 - if (syscall) { 243 - /* If so, check system call restarting.. */ 244 - switch (regs->a4) { 245 - case -ERESTART_RESTARTBLOCK: 246 - case -ERESTARTNOHAND: 247 - regs->a4 = -EINTR; 248 - break; 249 - 250 - case -ERESTARTSYS: 251 - if (!(ksig->ka.sa.sa_flags & SA_RESTART)) { 252 - regs->a4 = -EINTR; 253 - break; 254 - } 255 - 256 - fallthrough; 257 - case -ERESTARTNOINTR: 258 - regs->a4 = regs->orig_a4; 259 - regs->pc -= 4; 260 - } 261 - } 262 - 263 - /* Set up the stack frame */ 264 - ret = setup_rt_frame(ksig, sigmask_to_save(), regs); 265 - signal_setup_done(ret, ksig, 0); 266 - } 267 - 268 - /* 269 - * handle a potential signal 270 - */ 271 - static void do_signal(struct pt_regs *regs, int syscall) 272 - { 273 - struct ksignal ksig; 274 - 275 - /* we want the common case to go fast, which is why we may in certain 276 - * cases get here from kernel mode */ 277 - if (!user_mode(regs)) 278 - return; 279 - 280 - if (get_signal(&ksig)) { 281 - handle_signal(&ksig, regs, syscall); 282 - return; 283 - } 284 - 285 - /* did we come from a system call? */ 286 - if (syscall) { 287 - /* restart the system call - no handlers present */ 288 - switch (regs->a4) { 289 - case -ERESTARTNOHAND: 290 - case -ERESTARTSYS: 291 - case -ERESTARTNOINTR: 292 - regs->a4 = regs->orig_a4; 293 - regs->pc -= 4; 294 - break; 295 - 296 - case -ERESTART_RESTARTBLOCK: 297 - regs->a4 = regs->orig_a4; 298 - regs->b0 = __NR_restart_syscall; 299 - regs->pc -= 4; 300 - break; 301 - } 302 - } 303 - 304 - /* if there's no signal to deliver, we just put the saved sigmask 305 - * back */ 306 - restore_saved_sigmask(); 307 - } 308 - 309 - /* 310 - * notification of userspace execution resumption 311 - * - triggered by current->work.notify_resume 312 - */ 313 - asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags, 314 - int syscall) 315 - { 316 - /* deal with pending signal delivery */ 317 - if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) 318 - do_signal(regs, syscall); 319 - 320 - if (thread_info_flags & (1 << TIF_NOTIFY_RESUME)) 321 - tracehook_notify_resume(regs); 322 - }
-87
arch/c6x/kernel/soc.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Miscellaneous SoC-specific hooks. 4 - * 5 - * Copyright (C) 2011 Texas Instruments Incorporated 6 - * Author: Mark Salter <msalter@redhat.com> 7 - */ 8 - #include <linux/module.h> 9 - #include <linux/ctype.h> 10 - #include <linux/etherdevice.h> 11 - #include <asm/setup.h> 12 - #include <asm/soc.h> 13 - 14 - struct soc_ops soc_ops; 15 - 16 - int soc_get_exception(void) 17 - { 18 - if (!soc_ops.get_exception) 19 - return -1; 20 - return soc_ops.get_exception(); 21 - } 22 - 23 - void soc_assert_event(unsigned int evt) 24 - { 25 - if (soc_ops.assert_event) 26 - soc_ops.assert_event(evt); 27 - } 28 - 29 - static u8 cmdline_mac[6]; 30 - 31 - static int __init get_mac_addr_from_cmdline(char *str) 32 - { 33 - int count, i, val; 34 - 35 - for (count = 0; count < 6 && *str; count++, str += 3) { 36 - if (!isxdigit(str[0]) || !isxdigit(str[1])) 37 - return 0; 38 - if (str[2] != ((count < 5) ? ':' : '\0')) 39 - return 0; 40 - 41 - for (i = 0, val = 0; i < 2; i++) { 42 - val = val << 4; 43 - val |= isdigit(str[i]) ? 44 - str[i] - '0' : toupper(str[i]) - 'A' + 10; 45 - } 46 - cmdline_mac[count] = val; 47 - } 48 - return 1; 49 - } 50 - __setup("emac_addr=", get_mac_addr_from_cmdline); 51 - 52 - /* 53 - * Setup the MAC address for SoC ethernet devices. 54 - * 55 - * Before calling this function, the ethernet driver will have 56 - * initialized the addr with local-mac-address from the device 57 - * tree (if found). Allow command line to override, but not 58 - * the fused address. 59 - */ 60 - int soc_mac_addr(unsigned int index, u8 *addr) 61 - { 62 - int i, have_dt_mac = 0, have_cmdline_mac = 0, have_fuse_mac = 0; 63 - 64 - for (i = 0; i < 6; i++) { 65 - if (cmdline_mac[i]) 66 - have_cmdline_mac = 1; 67 - if (c6x_fuse_mac[i]) 68 - have_fuse_mac = 1; 69 - if (addr[i]) 70 - have_dt_mac = 1; 71 - } 72 - 73 - /* cmdline overrides all */ 74 - if (have_cmdline_mac) 75 - memcpy(addr, cmdline_mac, 6); 76 - else if (!have_dt_mac) { 77 - if (have_fuse_mac) 78 - memcpy(addr, c6x_fuse_mac, 6); 79 - else 80 - eth_random_addr(addr); 81 - } 82 - 83 - /* adjust for specific EMAC device */ 84 - addr[5] += index * c6x_num_cores; 85 - return 1; 86 - } 87 - EXPORT_SYMBOL_GPL(soc_mac_addr);
-71
arch/c6x/kernel/switch_to.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Copyright (C) 2011 Texas Instruments Incorporated 4 - * Author: Mark Salter (msalter@redhat.com) 5 - */ 6 - 7 - #include <linux/linkage.h> 8 - #include <asm/asm-offsets.h> 9 - 10 - #define SP B15 11 - 12 - /* 13 - * void __switch_to(struct thread_info *prev, 14 - * struct thread_info *next, 15 - * struct task_struct *tsk) ; 16 - */ 17 - ENTRY(__switch_to) 18 - LDDW .D2T2 *+B4(THREAD_B15_14),B7:B6 19 - || MV .L2X A4,B5 ; prev 20 - || MV .L1X B4,A5 ; next 21 - || MVC .S2 RILC,B1 22 - 23 - STW .D2T2 B3,*+B5(THREAD_PC) 24 - || STDW .D1T1 A13:A12,*+A4(THREAD_A13_12) 25 - || MVC .S2 ILC,B0 26 - 27 - LDW .D2T2 *+B4(THREAD_PC),B3 28 - || LDDW .D1T1 *+A5(THREAD_A13_12),A13:A12 29 - 30 - STDW .D1T1 A11:A10,*+A4(THREAD_A11_10) 31 - || STDW .D2T2 B1:B0,*+B5(THREAD_RICL_ICL) 32 - #ifndef __DSBT__ 33 - || MVKL .S2 current_ksp,B1 34 - #endif 35 - 36 - STDW .D2T2 B15:B14,*+B5(THREAD_B15_14) 37 - || STDW .D1T1 A15:A14,*+A4(THREAD_A15_14) 38 - #ifndef __DSBT__ 39 - || MVKH .S2 current_ksp,B1 40 - #endif 41 - 42 - ;; Switch to next SP 43 - MV .S2 B7,SP 44 - #ifdef __DSBT__ 45 - || STW .D2T2 B7,*+B14(current_ksp) 46 - #else 47 - || STW .D2T2 B7,*B1 48 - || MV .L2 B6,B14 49 - #endif 50 - || LDDW .D1T1 *+A5(THREAD_RICL_ICL),A1:A0 51 - 52 - STDW .D2T2 B11:B10,*+B5(THREAD_B11_10) 53 - || LDDW .D1T1 *+A5(THREAD_A15_14),A15:A14 54 - 55 - STDW .D2T2 B13:B12,*+B5(THREAD_B13_12) 56 - || LDDW .D1T1 *+A5(THREAD_A11_10),A11:A10 57 - 58 - B .S2 B3 ; return in next E1 59 - || LDDW .D2T2 *+B4(THREAD_B13_12),B13:B12 60 - 61 - LDDW .D2T2 *+B4(THREAD_B11_10),B11:B10 62 - NOP 63 - 64 - MV .L2X A0,B0 65 - || MV .S1 A6,A4 66 - 67 - MVC .S2 B0,ILC 68 - || MV .L2X A1,B1 69 - 70 - MVC .S2 B1,RILC 71 - ENDPROC(__switch_to)
-71
arch/c6x/kernel/sys_c6x.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #include <linux/module.h> 9 - #include <linux/syscalls.h> 10 - #include <linux/uaccess.h> 11 - 12 - #include <asm/syscalls.h> 13 - 14 - #ifdef CONFIG_ACCESS_CHECK 15 - int _access_ok(unsigned long addr, unsigned long size) 16 - { 17 - if (!size) 18 - return 1; 19 - 20 - if (!addr || addr > (0xffffffffUL - (size - 1))) 21 - goto _bad_access; 22 - 23 - if (uaccess_kernel()) 24 - return 1; 25 - 26 - if (memory_start <= addr && (addr + size - 1) < memory_end) 27 - return 1; 28 - 29 - _bad_access: 30 - pr_debug("Bad access attempt: pid[%d] addr[%08lx] size[0x%lx]\n", 31 - current->pid, addr, size); 32 - return 0; 33 - } 34 - EXPORT_SYMBOL(_access_ok); 35 - #endif 36 - 37 - /* sys_cache_sync -- sync caches over given range */ 38 - asmlinkage int sys_cache_sync(unsigned long s, unsigned long e) 39 - { 40 - L1D_cache_block_writeback_invalidate(s, e); 41 - L1P_cache_block_invalidate(s, e); 42 - 43 - return 0; 44 - } 45 - 46 - /* Provide the actual syscall number to call mapping. */ 47 - #undef __SYSCALL 48 - #define __SYSCALL(nr, call) [nr] = (call), 49 - 50 - /* 51 - * Use trampolines 52 - */ 53 - #define sys_pread64 sys_pread_c6x 54 - #define sys_pwrite64 sys_pwrite_c6x 55 - #define sys_truncate64 sys_truncate64_c6x 56 - #define sys_ftruncate64 sys_ftruncate64_c6x 57 - #define sys_fadvise64 sys_fadvise64_c6x 58 - #define sys_fadvise64_64 sys_fadvise64_64_c6x 59 - #define sys_fallocate sys_fallocate_c6x 60 - 61 - /* Use sys_mmap_pgoff directly */ 62 - #define sys_mmap2 sys_mmap_pgoff 63 - 64 - /* 65 - * Note that we can't include <linux/unistd.h> here since the header 66 - * guard will defeat us; <asm/unistd.h> checks for __SYSCALL as well. 67 - */ 68 - void *sys_call_table[__NR_syscalls] = { 69 - [0 ... __NR_syscalls-1] = sys_ni_syscall, 70 - #include <asm/unistd.h> 71 - };
-63
arch/c6x/kernel/time.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/clocksource.h> 11 - #include <linux/errno.h> 12 - #include <linux/sched.h> 13 - #include <linux/param.h> 14 - #include <linux/string.h> 15 - #include <linux/mm.h> 16 - #include <linux/interrupt.h> 17 - #include <linux/timex.h> 18 - #include <linux/profile.h> 19 - 20 - #include <asm/special_insns.h> 21 - #include <asm/timer64.h> 22 - 23 - static u32 sched_clock_multiplier; 24 - #define SCHED_CLOCK_SHIFT 16 25 - 26 - static u64 tsc_read(struct clocksource *cs) 27 - { 28 - return get_cycles(); 29 - } 30 - 31 - static struct clocksource clocksource_tsc = { 32 - .name = "timestamp", 33 - .rating = 300, 34 - .read = tsc_read, 35 - .mask = CLOCKSOURCE_MASK(64), 36 - .flags = CLOCK_SOURCE_IS_CONTINUOUS, 37 - }; 38 - 39 - /* 40 - * scheduler clock - returns current time in nanoseconds. 41 - */ 42 - u64 sched_clock(void) 43 - { 44 - u64 tsc = get_cycles(); 45 - 46 - return (tsc * sched_clock_multiplier) >> SCHED_CLOCK_SHIFT; 47 - } 48 - 49 - void __init time_init(void) 50 - { 51 - u64 tmp = (u64)NSEC_PER_SEC << SCHED_CLOCK_SHIFT; 52 - 53 - do_div(tmp, c6x_core_freq); 54 - sched_clock_multiplier = tmp; 55 - 56 - clocksource_register_hz(&clocksource_tsc, c6x_core_freq); 57 - 58 - /* write anything into TSCL to enable counting */ 59 - set_creg(TSCL, 0); 60 - 61 - /* probe for timer64 event timer */ 62 - timer64_init(); 63 - }
-409
arch/c6x/kernel/traps.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #include <linux/module.h> 9 - #include <linux/ptrace.h> 10 - #include <linux/sched/debug.h> 11 - #include <linux/bug.h> 12 - 13 - #include <asm/soc.h> 14 - #include <asm/special_insns.h> 15 - #include <asm/traps.h> 16 - 17 - int (*c6x_nmi_handler)(struct pt_regs *regs); 18 - 19 - void __init trap_init(void) 20 - { 21 - ack_exception(EXCEPT_TYPE_NXF); 22 - ack_exception(EXCEPT_TYPE_EXC); 23 - ack_exception(EXCEPT_TYPE_IXF); 24 - ack_exception(EXCEPT_TYPE_SXF); 25 - enable_exception(); 26 - } 27 - 28 - void show_regs(struct pt_regs *regs) 29 - { 30 - pr_err("\n"); 31 - show_regs_print_info(KERN_ERR); 32 - pr_err("PC: %08lx SP: %08lx\n", regs->pc, regs->sp); 33 - pr_err("Status: %08lx ORIG_A4: %08lx\n", regs->csr, regs->orig_a4); 34 - pr_err("A0: %08lx B0: %08lx\n", regs->a0, regs->b0); 35 - pr_err("A1: %08lx B1: %08lx\n", regs->a1, regs->b1); 36 - pr_err("A2: %08lx B2: %08lx\n", regs->a2, regs->b2); 37 - pr_err("A3: %08lx B3: %08lx\n", regs->a3, regs->b3); 38 - pr_err("A4: %08lx B4: %08lx\n", regs->a4, regs->b4); 39 - pr_err("A5: %08lx B5: %08lx\n", regs->a5, regs->b5); 40 - pr_err("A6: %08lx B6: %08lx\n", regs->a6, regs->b6); 41 - pr_err("A7: %08lx B7: %08lx\n", regs->a7, regs->b7); 42 - pr_err("A8: %08lx B8: %08lx\n", regs->a8, regs->b8); 43 - pr_err("A9: %08lx B9: %08lx\n", regs->a9, regs->b9); 44 - pr_err("A10: %08lx B10: %08lx\n", regs->a10, regs->b10); 45 - pr_err("A11: %08lx B11: %08lx\n", regs->a11, regs->b11); 46 - pr_err("A12: %08lx B12: %08lx\n", regs->a12, regs->b12); 47 - pr_err("A13: %08lx B13: %08lx\n", regs->a13, regs->b13); 48 - pr_err("A14: %08lx B14: %08lx\n", regs->a14, regs->dp); 49 - pr_err("A15: %08lx B15: %08lx\n", regs->a15, regs->sp); 50 - pr_err("A16: %08lx B16: %08lx\n", regs->a16, regs->b16); 51 - pr_err("A17: %08lx B17: %08lx\n", regs->a17, regs->b17); 52 - pr_err("A18: %08lx B18: %08lx\n", regs->a18, regs->b18); 53 - pr_err("A19: %08lx B19: %08lx\n", regs->a19, regs->b19); 54 - pr_err("A20: %08lx B20: %08lx\n", regs->a20, regs->b20); 55 - pr_err("A21: %08lx B21: %08lx\n", regs->a21, regs->b21); 56 - pr_err("A22: %08lx B22: %08lx\n", regs->a22, regs->b22); 57 - pr_err("A23: %08lx B23: %08lx\n", regs->a23, regs->b23); 58 - pr_err("A24: %08lx B24: %08lx\n", regs->a24, regs->b24); 59 - pr_err("A25: %08lx B25: %08lx\n", regs->a25, regs->b25); 60 - pr_err("A26: %08lx B26: %08lx\n", regs->a26, regs->b26); 61 - pr_err("A27: %08lx B27: %08lx\n", regs->a27, regs->b27); 62 - pr_err("A28: %08lx B28: %08lx\n", regs->a28, regs->b28); 63 - pr_err("A29: %08lx B29: %08lx\n", regs->a29, regs->b29); 64 - pr_err("A30: %08lx B30: %08lx\n", regs->a30, regs->b30); 65 - pr_err("A31: %08lx B31: %08lx\n", regs->a31, regs->b31); 66 - } 67 - 68 - void die(char *str, struct pt_regs *fp, int nr) 69 - { 70 - console_verbose(); 71 - pr_err("%s: %08x\n", str, nr); 72 - show_regs(fp); 73 - 74 - pr_err("Process %s (pid: %d, stackpage=%08lx)\n", 75 - current->comm, current->pid, (PAGE_SIZE + 76 - (unsigned long) current)); 77 - 78 - dump_stack(); 79 - while (1) 80 - ; 81 - } 82 - 83 - static void die_if_kernel(char *str, struct pt_regs *fp, int nr) 84 - { 85 - if (user_mode(fp)) 86 - return; 87 - 88 - die(str, fp, nr); 89 - } 90 - 91 - 92 - /* Internal exceptions */ 93 - static struct exception_info iexcept_table[10] = { 94 - { "Oops - instruction fetch", SIGBUS, BUS_ADRERR }, 95 - { "Oops - fetch packet", SIGBUS, BUS_ADRERR }, 96 - { "Oops - execute packet", SIGILL, ILL_ILLOPC }, 97 - { "Oops - undefined instruction", SIGILL, ILL_ILLOPC }, 98 - { "Oops - resource conflict", SIGILL, ILL_ILLOPC }, 99 - { "Oops - resource access", SIGILL, ILL_PRVREG }, 100 - { "Oops - privilege", SIGILL, ILL_PRVOPC }, 101 - { "Oops - loops buffer", SIGILL, ILL_ILLOPC }, 102 - { "Oops - software exception", SIGILL, ILL_ILLTRP }, 103 - { "Oops - unknown exception", SIGILL, ILL_ILLOPC } 104 - }; 105 - 106 - /* External exceptions */ 107 - static struct exception_info eexcept_table[128] = { 108 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 109 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 110 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 111 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 112 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 113 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 114 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 115 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 116 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 117 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 118 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 119 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 120 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 121 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 122 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 123 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 124 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 125 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 126 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 127 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 128 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 129 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 130 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 131 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 132 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 133 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 134 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 135 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 136 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 137 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 138 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 139 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 140 - 141 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 142 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 143 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 144 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 145 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 146 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 147 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 148 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 149 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 150 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 151 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 152 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 153 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 154 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 155 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 156 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 157 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 158 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 159 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 160 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 161 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 162 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 163 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 164 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 165 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 166 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 167 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 168 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 169 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 170 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 171 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 172 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 173 - 174 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 175 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 176 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 177 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 178 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 179 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 180 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 181 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 182 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 183 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 184 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 185 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 186 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 187 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 188 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 189 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 190 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 191 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 192 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 193 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 194 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 195 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 196 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 197 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 198 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 199 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 200 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 201 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 202 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 203 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 204 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 205 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 206 - 207 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 208 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 209 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 210 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 211 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 212 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 213 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 214 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 215 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 216 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 217 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 218 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 219 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 220 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 221 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 222 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 223 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 224 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 225 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 226 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 227 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 228 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 229 - { "Oops - external exception", SIGBUS, BUS_ADRERR }, 230 - { "Oops - CPU memory protection fault", SIGSEGV, SEGV_ACCERR }, 231 - { "Oops - CPU memory protection fault in L1P", SIGSEGV, SEGV_ACCERR }, 232 - { "Oops - DMA memory protection fault in L1P", SIGSEGV, SEGV_ACCERR }, 233 - { "Oops - CPU memory protection fault in L1D", SIGSEGV, SEGV_ACCERR }, 234 - { "Oops - DMA memory protection fault in L1D", SIGSEGV, SEGV_ACCERR }, 235 - { "Oops - CPU memory protection fault in L2", SIGSEGV, SEGV_ACCERR }, 236 - { "Oops - DMA memory protection fault in L2", SIGSEGV, SEGV_ACCERR }, 237 - { "Oops - EMC CPU memory protection fault", SIGSEGV, SEGV_ACCERR }, 238 - { "Oops - EMC bus error", SIGBUS, BUS_ADRERR } 239 - }; 240 - 241 - static void do_trap(struct exception_info *except_info, struct pt_regs *regs) 242 - { 243 - unsigned long addr = instruction_pointer(regs); 244 - 245 - if (except_info->code != TRAP_BRKPT) 246 - pr_err("TRAP: %s PC[0x%lx] signo[%d] code[%d]\n", 247 - except_info->kernel_str, regs->pc, 248 - except_info->signo, except_info->code); 249 - 250 - die_if_kernel(except_info->kernel_str, regs, addr); 251 - 252 - force_sig_fault(except_info->signo, except_info->code, 253 - (void __user *)addr); 254 - } 255 - 256 - /* 257 - * Process an internal exception (non maskable) 258 - */ 259 - static int process_iexcept(struct pt_regs *regs) 260 - { 261 - unsigned int iexcept_report = get_iexcept(); 262 - unsigned int iexcept_num; 263 - 264 - ack_exception(EXCEPT_TYPE_IXF); 265 - 266 - pr_err("IEXCEPT: PC[0x%lx]\n", regs->pc); 267 - 268 - while (iexcept_report) { 269 - iexcept_num = __ffs(iexcept_report); 270 - iexcept_report &= ~(1 << iexcept_num); 271 - set_iexcept(iexcept_report); 272 - if (*(unsigned int *)regs->pc == BKPT_OPCODE) { 273 - /* This is a breakpoint */ 274 - struct exception_info bkpt_exception = { 275 - "Oops - undefined instruction", 276 - SIGTRAP, TRAP_BRKPT 277 - }; 278 - do_trap(&bkpt_exception, regs); 279 - iexcept_report &= ~(0xFF); 280 - set_iexcept(iexcept_report); 281 - continue; 282 - } 283 - 284 - do_trap(&iexcept_table[iexcept_num], regs); 285 - } 286 - return 0; 287 - } 288 - 289 - /* 290 - * Process an external exception (maskable) 291 - */ 292 - static void process_eexcept(struct pt_regs *regs) 293 - { 294 - int evt; 295 - 296 - pr_err("EEXCEPT: PC[0x%lx]\n", regs->pc); 297 - 298 - while ((evt = soc_get_exception()) >= 0) 299 - do_trap(&eexcept_table[evt], regs); 300 - 301 - ack_exception(EXCEPT_TYPE_EXC); 302 - } 303 - 304 - /* 305 - * Main exception processing 306 - */ 307 - asmlinkage int process_exception(struct pt_regs *regs) 308 - { 309 - unsigned int type; 310 - unsigned int type_num; 311 - unsigned int ie_num = 9; /* default is unknown exception */ 312 - 313 - while ((type = get_except_type()) != 0) { 314 - type_num = fls(type) - 1; 315 - 316 - switch (type_num) { 317 - case EXCEPT_TYPE_NXF: 318 - ack_exception(EXCEPT_TYPE_NXF); 319 - if (c6x_nmi_handler) 320 - (c6x_nmi_handler)(regs); 321 - else 322 - pr_alert("NMI interrupt!\n"); 323 - break; 324 - 325 - case EXCEPT_TYPE_IXF: 326 - if (process_iexcept(regs)) 327 - return 1; 328 - break; 329 - 330 - case EXCEPT_TYPE_EXC: 331 - process_eexcept(regs); 332 - break; 333 - 334 - case EXCEPT_TYPE_SXF: 335 - ie_num = 8; 336 - default: 337 - ack_exception(type_num); 338 - do_trap(&iexcept_table[ie_num], regs); 339 - break; 340 - } 341 - } 342 - return 0; 343 - } 344 - 345 - static int kstack_depth_to_print = 48; 346 - 347 - static void show_trace(unsigned long *stack, unsigned long *endstack, 348 - const char *loglvl) 349 - { 350 - unsigned long addr; 351 - int i; 352 - 353 - printk("%sCall trace:", loglvl); 354 - i = 0; 355 - while (stack + 1 <= endstack) { 356 - addr = *stack++; 357 - /* 358 - * If the address is either in the text segment of the 359 - * kernel, or in the region which contains vmalloc'ed 360 - * memory, it *may* be the address of a calling 361 - * routine; if so, print it so that someone tracing 362 - * down the cause of the crash will be able to figure 363 - * out the call path that was taken. 364 - */ 365 - if (__kernel_text_address(addr)) { 366 - #ifndef CONFIG_KALLSYMS 367 - if (i % 5 == 0) 368 - printk("%s\n ", loglvl); 369 - #endif 370 - printk("%s [<%08lx>] %pS\n", loglvl, addr, (void *)addr); 371 - i++; 372 - } 373 - } 374 - printk("%s\n", loglvl); 375 - } 376 - 377 - void show_stack(struct task_struct *task, unsigned long *stack, 378 - const char *loglvl) 379 - { 380 - unsigned long *p, *endstack; 381 - int i; 382 - 383 - if (!stack) { 384 - if (task && task != current) 385 - /* We know this is a kernel stack, 386 - so this is the start/end */ 387 - stack = (unsigned long *)thread_saved_ksp(task); 388 - else 389 - stack = (unsigned long *)&stack; 390 - } 391 - endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) 392 - & -THREAD_SIZE); 393 - 394 - pr_debug("Stack from %08lx:", (unsigned long)stack); 395 - for (i = 0, p = stack; i < kstack_depth_to_print; i++) { 396 - if (p + 1 > endstack) 397 - break; 398 - if (i % 8 == 0) 399 - pr_cont("\n "); 400 - pr_cont(" %08lx", *p++); 401 - } 402 - pr_cont("\n"); 403 - show_trace(stack, endstack, loglvl); 404 - } 405 - 406 - int is_valid_bugaddr(unsigned long addr) 407 - { 408 - return __kernel_text_address(addr); 409 - }
-78
arch/c6x/kernel/vectors.S
··· 1 - ; SPDX-License-Identifier: GPL-2.0-only 2 - ; 3 - ; Port on Texas Instruments TMS320C6x architecture 4 - ; 5 - ; Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated 6 - ; Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - ; 8 - ; This section handles all the interrupt vector routines. 9 - ; At RESET the processor sets up the DRAM timing parameters and 10 - ; branches to the label _c_int00 which handles initialization for the C code. 11 - ; 12 - 13 - #define ALIGNMENT 5 14 - 15 - .macro IRQVEC name, handler 16 - .align ALIGNMENT 17 - .hidden \name 18 - .global \name 19 - \name: 20 - #ifdef CONFIG_C6X_BIG_KERNEL 21 - STW .D2T1 A0,*B15--[2] 22 - || MVKL .S1 \handler,A0 23 - MVKH .S1 \handler,A0 24 - B .S2X A0 25 - LDW .D2T1 *++B15[2],A0 26 - NOP 4 27 - NOP 28 - NOP 29 - .endm 30 - #else /* CONFIG_C6X_BIG_KERNEL */ 31 - B .S2 \handler 32 - NOP 33 - NOP 34 - NOP 35 - NOP 36 - NOP 37 - NOP 38 - NOP 39 - .endm 40 - #endif /* CONFIG_C6X_BIG_KERNEL */ 41 - 42 - .sect ".vectors","ax" 43 - .align ALIGNMENT 44 - .global RESET 45 - .hidden RESET 46 - RESET: 47 - #ifdef CONFIG_C6X_BIG_KERNEL 48 - MVKL .S1 _c_int00,A0 ; branch to _c_int00 49 - MVKH .S1 _c_int00,A0 50 - B .S2X A0 51 - #else 52 - B .S2 _c_int00 53 - NOP 54 - NOP 55 - #endif 56 - NOP 57 - NOP 58 - NOP 59 - NOP 60 - NOP 61 - 62 - 63 - IRQVEC NMI,_nmi_handler ; NMI interrupt 64 - IRQVEC AINT,_bad_interrupt ; reserved 65 - IRQVEC MSGINT,_bad_interrupt ; reserved 66 - 67 - IRQVEC INT4,_int4_handler 68 - IRQVEC INT5,_int5_handler 69 - IRQVEC INT6,_int6_handler 70 - IRQVEC INT7,_int7_handler 71 - IRQVEC INT8,_int8_handler 72 - IRQVEC INT9,_int9_handler 73 - IRQVEC INT10,_int10_handler 74 - IRQVEC INT11,_int11_handler 75 - IRQVEC INT12,_int12_handler 76 - IRQVEC INT13,_int13_handler 77 - IRQVEC INT14,_int14_handler 78 - IRQVEC INT15,_int15_handler
-151
arch/c6x/kernel/vmlinux.lds.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * ld script for the c6x kernel 4 - * 5 - * Copyright (C) 2010, 2011 Texas Instruments Incorporated 6 - * Mark Salter <msalter@redhat.com> 7 - */ 8 - 9 - #define RO_EXCEPTION_TABLE_ALIGN 16 10 - 11 - #include <asm-generic/vmlinux.lds.h> 12 - #include <asm/thread_info.h> 13 - #include <asm/page.h> 14 - 15 - ENTRY(_c_int00) 16 - 17 - #if defined(CONFIG_CPU_BIG_ENDIAN) 18 - jiffies = jiffies_64 + 4; 19 - #else 20 - jiffies = jiffies_64; 21 - #endif 22 - 23 - #define READONLY_SEGMENT_START \ 24 - . = PAGE_OFFSET; 25 - #define READWRITE_SEGMENT_START \ 26 - . = ALIGN(128); \ 27 - _data_lma = .; 28 - 29 - SECTIONS 30 - { 31 - /* 32 - * Start kernel read only segment 33 - */ 34 - READONLY_SEGMENT_START 35 - 36 - .vectors : 37 - { 38 - _vectors_start = .; 39 - *(.vectors) 40 - . = ALIGN(0x400); 41 - _vectors_end = .; 42 - } 43 - 44 - /* 45 - * This section contains data which may be shared with other 46 - * cores. It needs to be a fixed offset from PAGE_OFFSET 47 - * regardless of kernel configuration. 48 - */ 49 - .virtio_ipc_dev : 50 - { 51 - *(.virtio_ipc_dev) 52 - } 53 - 54 - . = ALIGN(PAGE_SIZE); 55 - __init_begin = .; 56 - .init : 57 - { 58 - _sinittext = .; 59 - HEAD_TEXT 60 - INIT_TEXT 61 - _einittext = .; 62 - } 63 - 64 - INIT_DATA_SECTION(16) 65 - 66 - PERCPU_SECTION(128) 67 - 68 - . = ALIGN(PAGE_SIZE); 69 - __init_end = .; 70 - 71 - .text : 72 - { 73 - _text = .; 74 - _stext = .; 75 - TEXT_TEXT 76 - SCHED_TEXT 77 - CPUIDLE_TEXT 78 - LOCK_TEXT 79 - IRQENTRY_TEXT 80 - SOFTIRQENTRY_TEXT 81 - KPROBES_TEXT 82 - *(.fixup) 83 - *(.gnu.warning) 84 - } 85 - 86 - RO_DATA(PAGE_SIZE) 87 - .const : 88 - { 89 - *(.const .const.* .gnu.linkonce.r.*) 90 - *(.switch) 91 - } 92 - 93 - _etext = .; 94 - 95 - /* 96 - * Start kernel read-write segment. 97 - */ 98 - READWRITE_SEGMENT_START 99 - _sdata = .; 100 - 101 - .fardata : AT(ADDR(.fardata) - LOAD_OFFSET) 102 - { 103 - INIT_TASK_DATA(THREAD_SIZE) 104 - NOSAVE_DATA 105 - PAGE_ALIGNED_DATA(PAGE_SIZE) 106 - CACHELINE_ALIGNED_DATA(128) 107 - READ_MOSTLY_DATA(128) 108 - DATA_DATA 109 - CONSTRUCTORS 110 - *(.data1) 111 - *(.fardata .fardata.*) 112 - *(.data.debug_bpt) 113 - } 114 - 115 - .neardata ALIGN(8) : AT(ADDR(.neardata) - LOAD_OFFSET) 116 - { 117 - *(.neardata2 .neardata2.* .gnu.linkonce.s2.*) 118 - *(.neardata .neardata.* .gnu.linkonce.s.*) 119 - . = ALIGN(8); 120 - } 121 - 122 - BUG_TABLE 123 - 124 - _edata = .; 125 - 126 - __bss_start = .; 127 - SBSS(8) 128 - BSS(8) 129 - .far : 130 - { 131 - . = ALIGN(8); 132 - *(.dynfar) 133 - *(.far .far.* .gnu.linkonce.b.*) 134 - . = ALIGN(8); 135 - } 136 - __bss_stop = .; 137 - 138 - _end = .; 139 - 140 - DWARF_DEBUG 141 - 142 - /DISCARD/ : 143 - { 144 - EXIT_TEXT 145 - EXIT_DATA 146 - EXIT_CALL 147 - *(.discard) 148 - *(.discard.*) 149 - *(.interp) 150 - } 151 - }
-8
arch/c6x/lib/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - # 3 - # Makefile for arch/c6x/lib/ 4 - # 5 - 6 - lib-y := divu.o divi.o pop_rts.o push_rts.o remi.o remu.o strasgi.o llshru.o 7 - lib-y += llshr.o llshl.o negll.o mpyll.o divremi.o divremu.o 8 - lib-y += checksum.o csum_64plus.o memcpy_64plus.o strasgi_64plus.o
-11
arch/c6x/lib/checksum.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - */ 4 - #include <linux/module.h> 5 - #include <net/checksum.h> 6 - 7 - /* These are from csum_64plus.S */ 8 - EXPORT_SYMBOL(csum_partial); 9 - EXPORT_SYMBOL(csum_partial_copy_nocheck); 10 - EXPORT_SYMBOL(ip_compute_csum); 11 - EXPORT_SYMBOL(ip_fast_csum);
-414
arch/c6x/lib/csum_64plus.S
··· 1 - ; SPDX-License-Identifier: GPL-2.0-only 2 - ; 3 - ; linux/arch/c6x/lib/csum_64plus.s 4 - ; 5 - ; Port on Texas Instruments TMS320C6x architecture 6 - ; 7 - ; Copyright (C) 2006, 2009, 2010, 2011 Texas Instruments Incorporated 8 - ; Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 9 - ; 10 - #include <linux/linkage.h> 11 - 12 - ; 13 - ;unsigned int csum_partial_copy_nocheck(const char *src, char * dst, 14 - ; int len, int sum) 15 - ; 16 - ; A4: src 17 - ; B4: dst 18 - ; A6: len 19 - ; B6: sum 20 - ; return csum in A4 21 - ; 22 - 23 - .text 24 - ENTRY(csum_partial_copy_nocheck) 25 - MVC .S2 ILC,B30 26 - 27 - ZERO .D1 A9 ; csum (a side) 28 - || ZERO .D2 B9 ; csum (b side) 29 - || SHRU .S2X A6,2,B5 ; len / 4 30 - 31 - ;; Check alignment and size 32 - AND .S1 3,A4,A1 33 - || AND .S2 3,B4,B0 34 - OR .L2X B0,A1,B0 ; non aligned condition 35 - || MVC .S2 B5,ILC 36 - || MVK .D2 1,B2 37 - || MV .D1X B5,A1 ; words condition 38 - [!A1] B .S1 L8 39 - [B0] BNOP .S1 L6,5 40 - 41 - SPLOOP 1 42 - 43 - ;; Main loop for aligned words 44 - LDW .D1T1 *A4++,A7 45 - NOP 4 46 - MV .S2X A7,B7 47 - || EXTU .S1 A7,0,16,A16 48 - STW .D2T2 B7,*B4++ 49 - || MPYU .M2 B7,B2,B8 50 - || ADD .L1 A16,A9,A9 51 - NOP 52 - SPKERNEL 8,0 53 - || ADD .L2 B8,B9,B9 54 - 55 - ZERO .D1 A1 56 - || ADD .L1X A9,B9,A9 ; add csum from a and b sides 57 - 58 - L6: 59 - [!A1] BNOP .S1 L8,5 60 - 61 - ;; Main loop for non-aligned words 62 - SPLOOP 2 63 - || MVK .L1 1,A2 64 - 65 - LDNW .D1T1 *A4++,A7 66 - NOP 3 67 - 68 - NOP 69 - MV .S2X A7,B7 70 - || EXTU .S1 A7,0,16,A16 71 - || MPYU .M1 A7,A2,A8 72 - 73 - ADD .L1 A16,A9,A9 74 - SPKERNEL 6,0 75 - || STNW .D2T2 B7,*B4++ 76 - || ADD .L1 A8,A9,A9 77 - 78 - L8: AND .S2X 2,A6,B5 79 - CMPGT .L2 B5,0,B0 80 - [!B0] BNOP .S1 L82,4 81 - 82 - ;; Manage half-word 83 - ZERO .L1 A7 84 - || ZERO .D1 A8 85 - 86 - #ifdef CONFIG_CPU_BIG_ENDIAN 87 - 88 - LDBU .D1T1 *A4++,A7 89 - LDBU .D1T1 *A4++,A8 90 - NOP 3 91 - SHL .S1 A7,8,A0 92 - ADD .S1 A8,A9,A9 93 - STB .D2T1 A7,*B4++ 94 - || ADD .S1 A0,A9,A9 95 - STB .D2T1 A8,*B4++ 96 - 97 - #else 98 - 99 - LDBU .D1T1 *A4++,A7 100 - LDBU .D1T1 *A4++,A8 101 - NOP 3 102 - ADD .S1 A7,A9,A9 103 - SHL .S1 A8,8,A0 104 - 105 - STB .D2T1 A7,*B4++ 106 - || ADD .S1 A0,A9,A9 107 - STB .D2T1 A8,*B4++ 108 - 109 - #endif 110 - 111 - ;; Manage eventually the last byte 112 - L82: AND .S2X 1,A6,B0 113 - [!B0] BNOP .S1 L9,5 114 - 115 - || ZERO .L1 A7 116 - 117 - L83: LDBU .D1T1 *A4++,A7 118 - NOP 4 119 - 120 - MV .L2X A7,B7 121 - 122 - #ifdef CONFIG_CPU_BIG_ENDIAN 123 - 124 - STB .D2T2 B7,*B4++ 125 - || SHL .S1 A7,8,A7 126 - ADD .S1 A7,A9,A9 127 - 128 - #else 129 - 130 - STB .D2T2 B7,*B4++ 131 - || ADD .S1 A7,A9,A9 132 - 133 - #endif 134 - 135 - ;; Fold the csum 136 - L9: SHRU .S2X A9,16,B0 137 - [!B0] BNOP .S1 L10,5 138 - 139 - L91: SHRU .S2X A9,16,B4 140 - || EXTU .S1 A9,16,16,A3 141 - ADD .D1X A3,B4,A9 142 - 143 - SHRU .S1 A9,16,A0 144 - [A0] BNOP .S1 L91,5 145 - 146 - L10: MV .D1 A9,A4 147 - 148 - BNOP .S2 B3,4 149 - MVC .S2 B30,ILC 150 - ENDPROC(csum_partial_copy_nocheck) 151 - 152 - ; 153 - ;unsigned short 154 - ;ip_fast_csum(unsigned char *iph, unsigned int ihl) 155 - ;{ 156 - ; unsigned int checksum = 0; 157 - ; unsigned short *tosum = (unsigned short *) iph; 158 - ; int len; 159 - ; 160 - ; len = ihl*4; 161 - ; 162 - ; if (len <= 0) 163 - ; return 0; 164 - ; 165 - ; while(len) { 166 - ; len -= 2; 167 - ; checksum += *tosum++; 168 - ; } 169 - ; if (len & 1) 170 - ; checksum += *(unsigned char*) tosum; 171 - ; 172 - ; while(checksum >> 16) 173 - ; checksum = (checksum & 0xffff) + (checksum >> 16); 174 - ; 175 - ; return ~checksum; 176 - ;} 177 - ; 178 - ; A4: iph 179 - ; B4: ihl 180 - ; return checksum in A4 181 - ; 182 - .text 183 - 184 - ENTRY(ip_fast_csum) 185 - ZERO .D1 A5 186 - || MVC .S2 ILC,B30 187 - SHL .S2 B4,2,B0 188 - CMPGT .L2 B0,0,B1 189 - [!B1] BNOP .S1 L15,4 190 - [!B1] ZERO .D1 A3 191 - 192 - [!B0] B .S1 L12 193 - SHRU .S2 B0,1,B0 194 - MVC .S2 B0,ILC 195 - NOP 3 196 - 197 - SPLOOP 1 198 - LDHU .D1T1 *A4++,A3 199 - NOP 3 200 - NOP 201 - SPKERNEL 5,0 202 - || ADD .L1 A3,A5,A5 203 - 204 - L12: SHRU .S1 A5,16,A0 205 - [!A0] BNOP .S1 L14,5 206 - 207 - L13: SHRU .S2X A5,16,B4 208 - EXTU .S1 A5,16,16,A3 209 - ADD .D1X A3,B4,A5 210 - SHRU .S1 A5,16,A0 211 - [A0] BNOP .S1 L13,5 212 - 213 - L14: NOT .D1 A5,A3 214 - EXTU .S1 A3,16,16,A3 215 - 216 - L15: BNOP .S2 B3,3 217 - MVC .S2 B30,ILC 218 - MV .D1 A3,A4 219 - ENDPROC(ip_fast_csum) 220 - 221 - ; 222 - ;unsigned short 223 - ;do_csum(unsigned char *buff, unsigned int len) 224 - ;{ 225 - ; int odd, count; 226 - ; unsigned int result = 0; 227 - ; 228 - ; if (len <= 0) 229 - ; goto out; 230 - ; odd = 1 & (unsigned long) buff; 231 - ; if (odd) { 232 - ;#ifdef __LITTLE_ENDIAN 233 - ; result += (*buff << 8); 234 - ;#else 235 - ; result = *buff; 236 - ;#endif 237 - ; len--; 238 - ; buff++; 239 - ; } 240 - ; count = len >> 1; /* nr of 16-bit words.. */ 241 - ; if (count) { 242 - ; if (2 & (unsigned long) buff) { 243 - ; result += *(unsigned short *) buff; 244 - ; count--; 245 - ; len -= 2; 246 - ; buff += 2; 247 - ; } 248 - ; count >>= 1; /* nr of 32-bit words.. */ 249 - ; if (count) { 250 - ; unsigned int carry = 0; 251 - ; do { 252 - ; unsigned int w = *(unsigned int *) buff; 253 - ; count--; 254 - ; buff += 4; 255 - ; result += carry; 256 - ; result += w; 257 - ; carry = (w > result); 258 - ; } while (count); 259 - ; result += carry; 260 - ; result = (result & 0xffff) + (result >> 16); 261 - ; } 262 - ; if (len & 2) { 263 - ; result += *(unsigned short *) buff; 264 - ; buff += 2; 265 - ; } 266 - ; } 267 - ; if (len & 1) 268 - ;#ifdef __LITTLE_ENDIAN 269 - ; result += *buff; 270 - ;#else 271 - ; result += (*buff << 8); 272 - ;#endif 273 - ; result = (result & 0xffff) + (result >> 16); 274 - ; /* add up carry.. */ 275 - ; result = (result & 0xffff) + (result >> 16); 276 - ; if (odd) 277 - ; result = ((result >> 8) & 0xff) | ((result & 0xff) << 8); 278 - ;out: 279 - ; return result; 280 - ;} 281 - ; 282 - ; A4: buff 283 - ; B4: len 284 - ; return checksum in A4 285 - ; 286 - 287 - ENTRY(do_csum) 288 - CMPGT .L2 B4,0,B0 289 - [!B0] BNOP .S1 L26,3 290 - EXTU .S1 A4,31,31,A0 291 - 292 - MV .L1 A0,A3 293 - || MV .S1X B3,A5 294 - || MV .L2 B4,B3 295 - || ZERO .D1 A1 296 - 297 - #ifdef CONFIG_CPU_BIG_ENDIAN 298 - [A0] SUB .L2 B3,1,B3 299 - || [A0] LDBU .D1T1 *A4++,A1 300 - #else 301 - [!A0] BNOP .S1 L21,5 302 - || [A0] LDBU .D1T1 *A4++,A0 303 - SUB .L2 B3,1,B3 304 - || SHL .S1 A0,8,A1 305 - L21: 306 - #endif 307 - SHR .S2 B3,1,B0 308 - [!B0] BNOP .S1 L24,3 309 - MVK .L1 2,A0 310 - AND .L1 A4,A0,A0 311 - 312 - [!A0] BNOP .S1 L22,5 313 - || [A0] LDHU .D1T1 *A4++,A0 314 - SUB .L2 B0,1,B0 315 - || SUB .S2 B3,2,B3 316 - || ADD .L1 A0,A1,A1 317 - L22: 318 - SHR .S2 B0,1,B0 319 - || ZERO .L1 A0 320 - 321 - [!B0] BNOP .S1 L23,5 322 - || [B0] MVC .S2 B0,ILC 323 - 324 - SPLOOP 3 325 - SPMASK L1 326 - || MV .L1 A1,A2 327 - || LDW .D1T1 *A4++,A1 328 - 329 - NOP 4 330 - ADD .L1 A0,A1,A0 331 - ADD .L1 A2,A0,A2 332 - 333 - SPKERNEL 1,2 334 - || CMPGTU .L1 A1,A2,A0 335 - 336 - ADD .L1 A0,A2,A6 337 - EXTU .S1 A6,16,16,A7 338 - SHRU .S2X A6,16,B0 339 - NOP 1 340 - ADD .L1X A7,B0,A1 341 - L23: 342 - MVK .L2 2,B0 343 - AND .L2 B3,B0,B0 344 - [B0] LDHU .D1T1 *A4++,A0 345 - NOP 4 346 - [B0] ADD .L1 A0,A1,A1 347 - L24: 348 - EXTU .S2 B3,31,31,B0 349 - #ifdef CONFIG_CPU_BIG_ENDIAN 350 - [!B0] BNOP .S1 L25,4 351 - || [B0] LDBU .D1T1 *A4,A0 352 - SHL .S1 A0,8,A0 353 - ADD .L1 A0,A1,A1 354 - L25: 355 - #else 356 - [B0] LDBU .D1T1 *A4,A0 357 - NOP 4 358 - [B0] ADD .L1 A0,A1,A1 359 - #endif 360 - EXTU .S1 A1,16,16,A0 361 - SHRU .S2X A1,16,B0 362 - NOP 1 363 - ADD .L1X A0,B0,A0 364 - SHRU .S1 A0,16,A1 365 - ADD .L1 A0,A1,A0 366 - EXTU .S1 A0,16,16,A1 367 - EXTU .S1 A1,16,24,A2 368 - 369 - EXTU .S1 A1,24,16,A0 370 - || MV .L2X A3,B0 371 - 372 - [B0] OR .L1 A0,A2,A1 373 - L26: 374 - NOP 1 375 - BNOP .S2X A5,4 376 - MV .L1 A1,A4 377 - ENDPROC(do_csum) 378 - 379 - ;__wsum csum_partial(const void *buff, int len, __wsum wsum) 380 - ;{ 381 - ; unsigned int sum = (__force unsigned int)wsum; 382 - ; unsigned int result = do_csum(buff, len); 383 - ; 384 - ; /* add in old sum, and carry.. */ 385 - ; result += sum; 386 - ; if (sum > result) 387 - ; result += 1; 388 - ; return (__force __wsum)result; 389 - ;} 390 - ; 391 - ENTRY(csum_partial) 392 - MV .L1X B3,A9 393 - || CALLP .S2 do_csum,B3 394 - || MV .S1 A6,A8 395 - BNOP .S2X A9,2 396 - ADD .L1 A8,A4,A1 397 - CMPGTU .L1 A8,A1,A0 398 - ADD .L1 A1,A0,A4 399 - ENDPROC(csum_partial) 400 - 401 - ;unsigned short 402 - ;ip_compute_csum(unsigned char *buff, unsigned int len) 403 - ; 404 - ; A4: buff 405 - ; B4: len 406 - ; return checksum in A4 407 - 408 - ENTRY(ip_compute_csum) 409 - MV .L1X B3,A9 410 - || CALLP .S2 do_csum,B3 411 - BNOP .S2X A9,3 412 - NOT .S1 A4,A4 413 - CLR .S1 A4,16,31,A4 414 - ENDPROC(ip_compute_csum)
-41
arch/c6x/lib/divi.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright 2010 Free Software Foundation, Inc. 3 - ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - ;; ABI considerations for the divide functions 9 - ;; The following registers are call-used: 10 - ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5 11 - ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4 12 - ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4 13 - ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4 14 - ;; 15 - ;; In our implementation, divu and remu are leaf functions, 16 - ;; while both divi and remi call into divu. 17 - ;; A0 is not clobbered by any of the functions. 18 - ;; divu does not clobber B2 either, which is taken advantage of 19 - ;; in remi. 20 - ;; divi uses B5 to hold the original return address during 21 - ;; the call to divu. 22 - ;; remi uses B2 and A5 to hold the input values during the 23 - ;; call to divu. It stores B3 in on the stack. 24 - 25 - .text 26 - ENTRY(__c6xabi_divi) 27 - call .s2 __c6xabi_divu 28 - || mv .d2 B3, B5 29 - || cmpgt .l1 0, A4, A1 30 - || cmpgt .l2 0, B4, B1 31 - 32 - [A1] neg .l1 A4, A4 33 - || [B1] neg .l2 B4, B4 34 - || xor .s1x A1, B1, A1 35 - [A1] addkpc .s2 _divu_ret, B3, 4 36 - _divu_ret: 37 - neg .l1 A4, A4 38 - || mv .l2 B3,B5 39 - || ret .s2 B5 40 - nop 5 41 - ENDPROC(__c6xabi_divi)
-34
arch/c6x/lib/divremi.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright 2010 Free Software Foundation, Inc. 3 - ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - .text 9 - ENTRY(__c6xabi_divremi) 10 - stw .d2t2 B3, *B15--[2] 11 - || cmpgt .l1 0, A4, A1 12 - || cmpgt .l2 0, B4, B2 13 - || mv .s1 A4, A5 14 - || call .s2 __c6xabi_divu 15 - 16 - [A1] neg .l1 A4, A4 17 - || [B2] neg .l2 B4, B4 18 - || xor .s2x B2, A1, B0 19 - || mv .d2 B4, B2 20 - 21 - [B0] addkpc .s2 _divu_ret_1, B3, 1 22 - [!B0] addkpc .s2 _divu_ret_2, B3, 1 23 - nop 2 24 - _divu_ret_1: 25 - neg .l1 A4, A4 26 - _divu_ret_2: 27 - ldw .d2t2 *++B15[2], B3 28 - 29 - mpy32 .m1x A4, B2, A6 30 - nop 3 31 - ret .s2 B3 32 - sub .l1 A5, A6, A5 33 - nop 4 34 - ENDPROC(__c6xabi_divremi)
-75
arch/c6x/lib/divremu.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright 2011 Free Software Foundation, Inc. 3 - ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - .text 9 - ENTRY(__c6xabi_divremu) 10 - ;; We use a series of up to 31 subc instructions. First, we find 11 - ;; out how many leading zero bits there are in the divisor. This 12 - ;; gives us both a shift count for aligning (shifting) the divisor 13 - ;; to the, and the number of times we have to execute subc. 14 - 15 - ;; At the end, we have both the remainder and most of the quotient 16 - ;; in A4. The top bit of the quotient is computed first and is 17 - ;; placed in A2. 18 - 19 - ;; Return immediately if the dividend is zero. Setting B4 to 1 20 - ;; is a trick to allow us to leave the following insns in the jump 21 - ;; delay slot without affecting the result. 22 - mv .s2x A4, B1 23 - 24 - [b1] lmbd .l2 1, B4, B1 25 - ||[!b1] b .s2 B3 ; RETURN A 26 - ||[!b1] mvk .d2 1, B4 27 - 28 - ||[!b1] zero .s1 A5 29 - mv .l1x B1, A6 30 - || shl .s2 B4, B1, B4 31 - 32 - ;; The loop performs a maximum of 28 steps, so we do the 33 - ;; first 3 here. 34 - cmpltu .l1x A4, B4, A2 35 - [!A2] sub .l1x A4, B4, A4 36 - || shru .s2 B4, 1, B4 37 - || xor .s1 1, A2, A2 38 - 39 - shl .s1 A2, 31, A2 40 - || [b1] subc .l1x A4,B4,A4 41 - || [b1] add .s2 -1, B1, B1 42 - [b1] subc .l1x A4,B4,A4 43 - || [b1] add .s2 -1, B1, B1 44 - 45 - ;; RETURN A may happen here (note: must happen before the next branch) 46 - __divremu0: 47 - cmpgt .l2 B1, 7, B0 48 - || [b1] subc .l1x A4,B4,A4 49 - || [b1] add .s2 -1, B1, B1 50 - [b1] subc .l1x A4,B4,A4 51 - || [b1] add .s2 -1, B1, B1 52 - || [b0] b .s1 __divremu0 53 - [b1] subc .l1x A4,B4,A4 54 - || [b1] add .s2 -1, B1, B1 55 - [b1] subc .l1x A4,B4,A4 56 - || [b1] add .s2 -1, B1, B1 57 - [b1] subc .l1x A4,B4,A4 58 - || [b1] add .s2 -1, B1, B1 59 - [b1] subc .l1x A4,B4,A4 60 - || [b1] add .s2 -1, B1, B1 61 - [b1] subc .l1x A4,B4,A4 62 - || [b1] add .s2 -1, B1, B1 63 - ;; loop backwards branch happens here 64 - 65 - ret .s2 B3 66 - || mvk .s1 32, A1 67 - sub .l1 A1, A6, A6 68 - || extu .s1 A4, A6, A5 69 - shl .s1 A4, A6, A4 70 - shru .s1 A4, 1, A4 71 - || sub .l1 A6, 1, A6 72 - or .l1 A2, A4, A4 73 - shru .s1 A4, A6, A4 74 - nop 75 - ENDPROC(__c6xabi_divremu)
-86
arch/c6x/lib/divu.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright 2010 Free Software Foundation, Inc. 3 - ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - ;; ABI considerations for the divide functions 9 - ;; The following registers are call-used: 10 - ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5 11 - ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4 12 - ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4 13 - ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4 14 - ;; 15 - ;; In our implementation, divu and remu are leaf functions, 16 - ;; while both divi and remi call into divu. 17 - ;; A0 is not clobbered by any of the functions. 18 - ;; divu does not clobber B2 either, which is taken advantage of 19 - ;; in remi. 20 - ;; divi uses B5 to hold the original return address during 21 - ;; the call to divu. 22 - ;; remi uses B2 and A5 to hold the input values during the 23 - ;; call to divu. It stores B3 in on the stack. 24 - 25 - .text 26 - ENTRY(__c6xabi_divu) 27 - ;; We use a series of up to 31 subc instructions. First, we find 28 - ;; out how many leading zero bits there are in the divisor. This 29 - ;; gives us both a shift count for aligning (shifting) the divisor 30 - ;; to the, and the number of times we have to execute subc. 31 - 32 - ;; At the end, we have both the remainder and most of the quotient 33 - ;; in A4. The top bit of the quotient is computed first and is 34 - ;; placed in A2. 35 - 36 - ;; Return immediately if the dividend is zero. 37 - mv .s2x A4, B1 38 - [B1] lmbd .l2 1, B4, B1 39 - || [!B1] b .s2 B3 ; RETURN A 40 - || [!B1] mvk .d2 1, B4 41 - mv .l1x B1, A6 42 - || shl .s2 B4, B1, B4 43 - 44 - ;; The loop performs a maximum of 28 steps, so we do the 45 - ;; first 3 here. 46 - cmpltu .l1x A4, B4, A2 47 - [!A2] sub .l1x A4, B4, A4 48 - || shru .s2 B4, 1, B4 49 - || xor .s1 1, A2, A2 50 - 51 - shl .s1 A2, 31, A2 52 - || [B1] subc .l1x A4,B4,A4 53 - || [B1] add .s2 -1, B1, B1 54 - [B1] subc .l1x A4,B4,A4 55 - || [B1] add .s2 -1, B1, B1 56 - 57 - ;; RETURN A may happen here (note: must happen before the next branch) 58 - _divu_loop: 59 - cmpgt .l2 B1, 7, B0 60 - || [B1] subc .l1x A4,B4,A4 61 - || [B1] add .s2 -1, B1, B1 62 - [B1] subc .l1x A4,B4,A4 63 - || [B1] add .s2 -1, B1, B1 64 - || [B0] b .s1 _divu_loop 65 - [B1] subc .l1x A4,B4,A4 66 - || [B1] add .s2 -1, B1, B1 67 - [B1] subc .l1x A4,B4,A4 68 - || [B1] add .s2 -1, B1, B1 69 - [B1] subc .l1x A4,B4,A4 70 - || [B1] add .s2 -1, B1, B1 71 - [B1] subc .l1x A4,B4,A4 72 - || [B1] add .s2 -1, B1, B1 73 - [B1] subc .l1x A4,B4,A4 74 - || [B1] add .s2 -1, B1, B1 75 - ;; loop backwards branch happens here 76 - 77 - ret .s2 B3 78 - || mvk .s1 32, A1 79 - sub .l1 A1, A6, A6 80 - shl .s1 A4, A6, A4 81 - shru .s1 A4, 1, A4 82 - || sub .l1 A6, 1, A6 83 - or .l1 A2, A4, A4 84 - shru .s1 A4, A6, A4 85 - nop 86 - ENDPROC(__c6xabi_divu)
-25
arch/c6x/lib/llshl.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright (C) 2010 Texas Instruments Incorporated 3 - ;; Contributed by Mark Salter <msalter@redhat.com>. 4 - ;; 5 - 6 - ;; uint64_t __c6xabi_llshl(uint64_t val, uint shift) 7 - 8 - #include <linux/linkage.h> 9 - 10 - .text 11 - ENTRY(__c6xabi_llshl) 12 - mv .l1x B4,A1 13 - [!A1] b .s2 B3 ; just return if zero shift 14 - mvk .s1 32,A0 15 - sub .d1 A0,A1,A0 16 - cmplt .l1 0,A0,A2 17 - [A2] shru .s1 A4,A0,A0 18 - [!A2] neg .l1 A0,A5 19 - || [A2] shl .s1 A5,A1,A5 20 - [!A2] shl .s1 A4,A5,A5 21 - || [A2] or .d1 A5,A0,A5 22 - || [!A2] mvk .l1 0,A4 23 - [A2] shl .s1 A4,A1,A4 24 - bnop .s2 B3,5 25 - ENDPROC(__c6xabi_llshl)
-26
arch/c6x/lib/llshr.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright (C) 2010 Texas Instruments Incorporated 3 - ;; Contributed by Mark Salter <msalter@redhat.com>. 4 - ;; 5 - 6 - ;; uint64_t __c6xabi_llshr(uint64_t val, uint shift) 7 - 8 - #include <linux/linkage.h> 9 - 10 - .text 11 - ENTRY(__c6xabi_llshr) 12 - mv .l1x B4,A1 13 - [!A1] b .s2 B3 ; return if zero shift count 14 - mvk .s1 32,A0 15 - sub .d1 A0,A1,A0 16 - cmplt .l1 0,A0,A2 17 - [A2] shl .s1 A5,A0,A0 18 - nop 19 - [!A2] neg .l1 A0,A4 20 - || [A2] shru .s1 A4,A1,A4 21 - [!A2] shr .s1 A5,A4,A4 22 - || [A2] or .d1 A4,A0,A4 23 - [!A2] shr .s1 A5,0x1f,A5 24 - [A2] shr .s1 A5,A1,A5 25 - bnop .s2 B3,5 26 - ENDPROC(__c6xabi_llshr)
-26
arch/c6x/lib/llshru.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright (C) 2010 Texas Instruments Incorporated 3 - ;; Contributed by Mark Salter <msalter@redhat.com>. 4 - ;; 5 - 6 - ;; uint64_t __c6xabi_llshru(uint64_t val, uint shift) 7 - 8 - #include <linux/linkage.h> 9 - 10 - .text 11 - ENTRY(__c6xabi_llshru) 12 - mv .l1x B4,A1 13 - [!A1] b .s2 B3 ; return if zero shift count 14 - mvk .s1 32,A0 15 - sub .d1 A0,A1,A0 16 - cmplt .l1 0,A0,A2 17 - [A2] shl .s1 A5,A0,A0 18 - nop 19 - [!A2] neg .l1 A0,A4 20 - || [A2] shru .s1 A4,A1,A4 21 - [!A2] shru .s1 A5,A4,A4 22 - || [A2] or .d1 A4,A0,A4 23 - || [!A2] mvk .l1 0,A5 24 - [A2] shru .s1 A5,A1,A5 25 - bnop .s2 B3,5 26 - ENDPROC(__c6xabi_llshru)
-43
arch/c6x/lib/memcpy_64plus.S
··· 1 - ; SPDX-License-Identifier: GPL-2.0-only 2 - ; Port on Texas Instruments TMS320C6x architecture 3 - ; 4 - ; Copyright (C) 2006, 2009, 2010 Texas Instruments Incorporated 5 - ; Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 6 - ; 7 - 8 - #include <linux/linkage.h> 9 - 10 - .text 11 - 12 - ENTRY(memcpy) 13 - AND .L1 0x1,A6,A0 14 - || AND .S1 0x2,A6,A1 15 - || AND .L2X 0x4,A6,B0 16 - || MV .D1 A4,A3 17 - || MVC .S2 ILC,B2 18 - 19 - [A0] LDB .D2T1 *B4++,A5 20 - [A1] LDB .D2T1 *B4++,A7 21 - [A1] LDB .D2T1 *B4++,A8 22 - [B0] LDNW .D2T1 *B4++,A9 23 - || SHRU .S2X A6,0x3,B1 24 - [!B1] BNOP .S2 B3,1 25 - 26 - [A0] STB .D1T1 A5,*A3++ 27 - ||[B1] MVC .S2 B1,ILC 28 - [A1] STB .D1T1 A7,*A3++ 29 - [A1] STB .D1T1 A8,*A3++ 30 - [B0] STNW .D1T1 A9,*A3++ ; return when len < 8 31 - 32 - SPLOOP 2 33 - 34 - LDNDW .D2T1 *B4++,A9:A8 35 - NOP 3 36 - 37 - NOP 38 - SPKERNEL 0,0 39 - || STNDW .D1T1 A9:A8,*A3++ 40 - 41 - BNOP .S2 B3,4 42 - MVC .S2 B2,ILC 43 - ENDPROC(memcpy)
-37
arch/c6x/lib/mpyll.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright (C) 2010 Texas Instruments Incorporated 3 - ;; Contributed by Mark Salter <msalter@redhat.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - ;; uint64_t __c6xabi_mpyll(uint64_t x, uint64_t y) 9 - ;; 10 - ;; 64x64 multiply 11 - ;; First compute partial results using 32-bit parts of x and y: 12 - ;; 13 - ;; b63 b32 b31 b0 14 - ;; ----------------------------- 15 - ;; | 1 | 0 | 16 - ;; ----------------------------- 17 - ;; 18 - ;; P0 = X0*Y0 19 - ;; P1 = X0*Y1 + X1*Y0 20 - ;; P2 = X1*Y1 21 - ;; 22 - ;; result = (P2 << 64) + (P1 << 32) + P0 23 - ;; 24 - ;; Since the result is also 64-bit, we can skip the P2 term. 25 - 26 - .text 27 - ENTRY(__c6xabi_mpyll) 28 - mpy32u .m1x A4,B4,A1:A0 ; X0*Y0 29 - b .s2 B3 30 - || mpy32u .m2x B5,A4,B1:B0 ; X0*Y1 (don't need upper 32-bits) 31 - || mpy32u .m1x A5,B4,A3:A2 ; X1*Y0 (don't need upper 32-bits) 32 - nop 33 - nop 34 - mv .s1 A0,A4 35 - add .l1x A2,B0,A5 36 - add .s1 A1,A5,A5 37 - ENDPROC(__c6xabi_mpyll)
-19
arch/c6x/lib/negll.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright (C) 2010 Texas Instruments Incorporated 3 - ;; Contributed by Mark Salter <msalter@redhat.com>. 4 - ;; 5 - 6 - ;; int64_t __c6xabi_negll(int64_t val) 7 - 8 - #include <linux/linkage.h> 9 - 10 - .text 11 - ENTRY(__c6xabi_negll) 12 - b .s2 B3 13 - mvk .l1 0,A0 14 - subu .l1 A0,A4,A3:A2 15 - sub .l1 A0,A5,A0 16 - || ext .s1 A3,24,24,A5 17 - add .l1 A5,A0,A5 18 - mv .s1 A2,A4 19 - ENDPROC(__c6xabi_negll)
-20
arch/c6x/lib/pop_rts.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright 2010 Free Software Foundation, Inc. 3 - ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - .text 9 - 10 - ENTRY(__c6xabi_pop_rts) 11 - lddw .d2t2 *++B15, B3:B2 12 - lddw .d2t1 *++B15, A11:A10 13 - lddw .d2t2 *++B15, B11:B10 14 - lddw .d2t1 *++B15, A13:A12 15 - lddw .d2t2 *++B15, B13:B12 16 - lddw .d2t1 *++B15, A15:A14 17 - || b .s2 B3 18 - ldw .d2t2 *++B15[2], B14 19 - nop 4 20 - ENDPROC(__c6xabi_pop_rts)
-19
arch/c6x/lib/push_rts.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright 2010 Free Software Foundation, Inc. 3 - ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - .text 9 - 10 - ENTRY(__c6xabi_push_rts) 11 - stw .d2t2 B14, *B15--[2] 12 - stdw .d2t1 A15:A14, *B15-- 13 - || b .s2x A3 14 - stdw .d2t2 B13:B12, *B15-- 15 - stdw .d2t1 A13:A12, *B15-- 16 - stdw .d2t2 B11:B10, *B15-- 17 - stdw .d2t1 A11:A10, *B15-- 18 - stdw .d2t2 B3:B2, *B15-- 19 - ENDPROC(__c6xabi_push_rts)
-52
arch/c6x/lib/remi.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright 2010 Free Software Foundation, Inc. 3 - ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - ;; ABI considerations for the divide functions 9 - ;; The following registers are call-used: 10 - ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5 11 - ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4 12 - ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4 13 - ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4 14 - ;; 15 - ;; In our implementation, divu and remu are leaf functions, 16 - ;; while both divi and remi call into divu. 17 - ;; A0 is not clobbered by any of the functions. 18 - ;; divu does not clobber B2 either, which is taken advantage of 19 - ;; in remi. 20 - ;; divi uses B5 to hold the original return address during 21 - ;; the call to divu. 22 - ;; remi uses B2 and A5 to hold the input values during the 23 - ;; call to divu. It stores B3 in on the stack. 24 - 25 - .text 26 - 27 - ENTRY(__c6xabi_remi) 28 - stw .d2t2 B3, *B15--[2] 29 - || cmpgt .l1 0, A4, A1 30 - || cmpgt .l2 0, B4, B2 31 - || mv .s1 A4, A5 32 - || call .s2 __c6xabi_divu 33 - 34 - [A1] neg .l1 A4, A4 35 - || [B2] neg .l2 B4, B4 36 - || xor .s2x B2, A1, B0 37 - || mv .d2 B4, B2 38 - 39 - [B0] addkpc .s2 _divu_ret_1, B3, 1 40 - [!B0] addkpc .s2 _divu_ret_2, B3, 1 41 - nop 2 42 - _divu_ret_1: 43 - neg .l1 A4, A4 44 - _divu_ret_2: 45 - ldw .d2t2 *++B15[2], B3 46 - 47 - mpy32 .m1x A4, B2, A6 48 - nop 3 49 - ret .s2 B3 50 - sub .l1 A5, A6, A4 51 - nop 4 52 - ENDPROC(__c6xabi_remi)
-70
arch/c6x/lib/remu.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright 2010 Free Software Foundation, Inc. 3 - ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - ;; ABI considerations for the divide functions 9 - ;; The following registers are call-used: 10 - ;; __c6xabi_divi A0,A1,A2,A4,A6,B0,B1,B2,B4,B5 11 - ;; __c6xabi_divu A0,A1,A2,A4,A6,B0,B1,B2,B4 12 - ;; __c6xabi_remi A1,A2,A4,A5,A6,B0,B1,B2,B4 13 - ;; __c6xabi_remu A1,A4,A5,A7,B0,B1,B2,B4 14 - ;; 15 - ;; In our implementation, divu and remu are leaf functions, 16 - ;; while both divi and remi call into divu. 17 - ;; A0 is not clobbered by any of the functions. 18 - ;; divu does not clobber B2 either, which is taken advantage of 19 - ;; in remi. 20 - ;; divi uses B5 to hold the original return address during 21 - ;; the call to divu. 22 - ;; remi uses B2 and A5 to hold the input values during the 23 - ;; call to divu. It stores B3 in on the stack. 24 - 25 - 26 - .text 27 - 28 - ENTRY(__c6xabi_remu) 29 - ;; The ABI seems designed to prevent these functions calling each other, 30 - ;; so we duplicate most of the divsi3 code here. 31 - mv .s2x A4, B1 32 - lmbd .l2 1, B4, B1 33 - || [!B1] b .s2 B3 ; RETURN A 34 - || [!B1] mvk .d2 1, B4 35 - 36 - mv .l1x B1, A7 37 - || shl .s2 B4, B1, B4 38 - 39 - cmpltu .l1x A4, B4, A1 40 - [!A1] sub .l1x A4, B4, A4 41 - shru .s2 B4, 1, B4 42 - 43 - _remu_loop: 44 - cmpgt .l2 B1, 7, B0 45 - || [B1] subc .l1x A4,B4,A4 46 - || [B1] add .s2 -1, B1, B1 47 - ;; RETURN A may happen here (note: must happen before the next branch) 48 - [B1] subc .l1x A4,B4,A4 49 - || [B1] add .s2 -1, B1, B1 50 - || [B0] b .s1 _remu_loop 51 - [B1] subc .l1x A4,B4,A4 52 - || [B1] add .s2 -1, B1, B1 53 - [B1] subc .l1x A4,B4,A4 54 - || [B1] add .s2 -1, B1, B1 55 - [B1] subc .l1x A4,B4,A4 56 - || [B1] add .s2 -1, B1, B1 57 - [B1] subc .l1x A4,B4,A4 58 - || [B1] add .s2 -1, B1, B1 59 - [B1] subc .l1x A4,B4,A4 60 - || [B1] add .s2 -1, B1, B1 61 - ;; loop backwards branch happens here 62 - 63 - ret .s2 B3 64 - [B1] subc .l1x A4,B4,A4 65 - || [B1] add .s2 -1, B1, B1 66 - [B1] subc .l1x A4,B4,A4 67 - 68 - extu .s1 A4, A7, A4 69 - nop 2 70 - ENDPROC(__c6xabi_remu)
-77
arch/c6x/lib/strasgi.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright 2010 Free Software Foundation, Inc. 3 - ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - .text 9 - 10 - ENTRY(__c6xabi_strasgi) 11 - ;; This is essentially memcpy, with alignment known to be at least 12 - ;; 4, and the size a multiple of 4 greater than or equal to 28. 13 - ldw .d2t1 *B4++, A0 14 - || mvk .s2 16, B1 15 - ldw .d2t1 *B4++, A1 16 - || mvk .s2 20, B2 17 - || sub .d1 A6, 24, A6 18 - ldw .d2t1 *B4++, A5 19 - ldw .d2t1 *B4++, A7 20 - || mv .l2x A6, B7 21 - ldw .d2t1 *B4++, A8 22 - ldw .d2t1 *B4++, A9 23 - || mv .s2x A0, B5 24 - || cmpltu .l2 B2, B7, B0 25 - 26 - _strasgi_loop: 27 - stw .d1t2 B5, *A4++ 28 - || [B0] ldw .d2t1 *B4++, A0 29 - || mv .s2x A1, B5 30 - || mv .l2 B7, B6 31 - 32 - [B0] sub .d2 B6, 24, B7 33 - || [B0] b .s2 _strasgi_loop 34 - || cmpltu .l2 B1, B6, B0 35 - 36 - [B0] ldw .d2t1 *B4++, A1 37 - || stw .d1t2 B5, *A4++ 38 - || mv .s2x A5, B5 39 - || cmpltu .l2 12, B6, B0 40 - 41 - [B0] ldw .d2t1 *B4++, A5 42 - || stw .d1t2 B5, *A4++ 43 - || mv .s2x A7, B5 44 - || cmpltu .l2 8, B6, B0 45 - 46 - [B0] ldw .d2t1 *B4++, A7 47 - || stw .d1t2 B5, *A4++ 48 - || mv .s2x A8, B5 49 - || cmpltu .l2 4, B6, B0 50 - 51 - [B0] ldw .d2t1 *B4++, A8 52 - || stw .d1t2 B5, *A4++ 53 - || mv .s2x A9, B5 54 - || cmpltu .l2 0, B6, B0 55 - 56 - [B0] ldw .d2t1 *B4++, A9 57 - || stw .d1t2 B5, *A4++ 58 - || mv .s2x A0, B5 59 - || cmpltu .l2 B2, B7, B0 60 - 61 - ;; loop back branch happens here 62 - 63 - cmpltu .l2 B1, B6, B0 64 - || ret .s2 b3 65 - 66 - [B0] stw .d1t1 A1, *A4++ 67 - || cmpltu .l2 12, B6, B0 68 - [B0] stw .d1t1 A5, *A4++ 69 - || cmpltu .l2 8, B6, B0 70 - [B0] stw .d1t1 A7, *A4++ 71 - || cmpltu .l2 4, B6, B0 72 - [B0] stw .d1t1 A8, *A4++ 73 - || cmpltu .l2 0, B6, B0 74 - [B0] stw .d1t1 A9, *A4++ 75 - 76 - ;; return happens here 77 - ENDPROC(__c6xabi_strasgi)
-27
arch/c6x/lib/strasgi_64plus.S
··· 1 - ;; SPDX-License-Identifier: GPL-2.0-or-later 2 - ;; Copyright 2010 Free Software Foundation, Inc. 3 - ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>. 4 - ;; 5 - 6 - #include <linux/linkage.h> 7 - 8 - .text 9 - 10 - ENTRY(__c6xabi_strasgi_64plus) 11 - shru .s2x a6, 2, b31 12 - || mv .s1 a4, a30 13 - || mv .d2 b4, b30 14 - 15 - add .s2 -4, b31, b31 16 - 17 - sploopd 1 18 - || mvc .s2 b31, ilc 19 - ldw .d2t2 *b30++, b31 20 - nop 4 21 - mv .s1x b31,a31 22 - spkernel 6, 0 23 - || stw .d1t1 a31, *a30++ 24 - 25 - ret .s2 b3 26 - nop 5 27 - ENDPROC(__c6xabi_strasgi_64plus)
-6
arch/c6x/mm/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - # 3 - # Makefile for the linux c6x-specific parts of the memory manager. 4 - # 5 - 6 - obj-y := init.o dma-coherent.o
-173
arch/c6x/mm/dma-coherent.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot <aurelien.jacquiot@ti.com> 7 - * 8 - * DMA uncached mapping support. 9 - * 10 - * Using code pulled from ARM 11 - * Copyright (C) 2000-2004 Russell King 12 - */ 13 - #include <linux/slab.h> 14 - #include <linux/bitmap.h> 15 - #include <linux/bitops.h> 16 - #include <linux/module.h> 17 - #include <linux/interrupt.h> 18 - #include <linux/dma-map-ops.h> 19 - #include <linux/memblock.h> 20 - 21 - #include <asm/cacheflush.h> 22 - #include <asm/page.h> 23 - #include <asm/setup.h> 24 - 25 - /* 26 - * DMA coherent memory management, can be redefined using the memdma= 27 - * kernel command line 28 - */ 29 - 30 - /* none by default */ 31 - static phys_addr_t dma_base; 32 - static u32 dma_size; 33 - static u32 dma_pages; 34 - 35 - static unsigned long *dma_bitmap; 36 - 37 - /* bitmap lock */ 38 - static DEFINE_SPINLOCK(dma_lock); 39 - 40 - /* 41 - * Return a DMA coherent and contiguous memory chunk from the DMA memory 42 - */ 43 - static inline u32 __alloc_dma_pages(int order) 44 - { 45 - unsigned long flags; 46 - u32 pos; 47 - 48 - spin_lock_irqsave(&dma_lock, flags); 49 - pos = bitmap_find_free_region(dma_bitmap, dma_pages, order); 50 - spin_unlock_irqrestore(&dma_lock, flags); 51 - 52 - return dma_base + (pos << PAGE_SHIFT); 53 - } 54 - 55 - static void __free_dma_pages(u32 addr, int order) 56 - { 57 - unsigned long flags; 58 - u32 pos = (addr - dma_base) >> PAGE_SHIFT; 59 - 60 - if (addr < dma_base || (pos + (1 << order)) >= dma_pages) { 61 - printk(KERN_ERR "%s: freeing outside range.\n", __func__); 62 - BUG(); 63 - } 64 - 65 - spin_lock_irqsave(&dma_lock, flags); 66 - bitmap_release_region(dma_bitmap, pos, order); 67 - spin_unlock_irqrestore(&dma_lock, flags); 68 - } 69 - 70 - /* 71 - * Allocate DMA coherent memory space and return both the kernel 72 - * virtual and DMA address for that space. 73 - */ 74 - void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, 75 - gfp_t gfp, unsigned long attrs) 76 - { 77 - void *ret; 78 - u32 paddr; 79 - int order; 80 - 81 - if (!dma_size || !size) 82 - return NULL; 83 - 84 - order = get_count_order(((size - 1) >> PAGE_SHIFT) + 1); 85 - 86 - paddr = __alloc_dma_pages(order); 87 - 88 - if (handle) 89 - *handle = paddr; 90 - 91 - if (!paddr) 92 - return NULL; 93 - 94 - ret = phys_to_virt(paddr); 95 - memset(ret, 0, 1 << order); 96 - return ret; 97 - } 98 - 99 - /* 100 - * Free DMA coherent memory as defined by the above mapping. 101 - */ 102 - void arch_dma_free(struct device *dev, size_t size, void *vaddr, 103 - dma_addr_t dma_handle, unsigned long attrs) 104 - { 105 - int order; 106 - 107 - if (!dma_size || !size) 108 - return; 109 - 110 - order = get_count_order(((size - 1) >> PAGE_SHIFT) + 1); 111 - 112 - __free_dma_pages(virt_to_phys(vaddr), order); 113 - } 114 - 115 - /* 116 - * Initialise the coherent DMA memory allocator using the given uncached region. 117 - */ 118 - void __init coherent_mem_init(phys_addr_t start, u32 size) 119 - { 120 - if (!size) 121 - return; 122 - 123 - printk(KERN_INFO 124 - "Coherent memory (DMA) region start=0x%x size=0x%x\n", 125 - start, size); 126 - 127 - dma_base = start; 128 - dma_size = size; 129 - 130 - /* allocate bitmap */ 131 - dma_pages = dma_size >> PAGE_SHIFT; 132 - if (dma_size & (PAGE_SIZE - 1)) 133 - ++dma_pages; 134 - 135 - dma_bitmap = memblock_alloc(BITS_TO_LONGS(dma_pages) * sizeof(long), 136 - sizeof(long)); 137 - if (!dma_bitmap) 138 - panic("%s: Failed to allocate %zu bytes align=0x%zx\n", 139 - __func__, BITS_TO_LONGS(dma_pages) * sizeof(long), 140 - sizeof(long)); 141 - } 142 - 143 - static void c6x_dma_sync(phys_addr_t paddr, size_t size, 144 - enum dma_data_direction dir) 145 - { 146 - BUG_ON(!valid_dma_direction(dir)); 147 - 148 - switch (dir) { 149 - case DMA_FROM_DEVICE: 150 - L2_cache_block_invalidate(paddr, paddr + size); 151 - break; 152 - case DMA_TO_DEVICE: 153 - L2_cache_block_writeback(paddr, paddr + size); 154 - break; 155 - case DMA_BIDIRECTIONAL: 156 - L2_cache_block_writeback_invalidate(paddr, paddr + size); 157 - break; 158 - default: 159 - break; 160 - } 161 - } 162 - 163 - void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, 164 - enum dma_data_direction dir) 165 - { 166 - return c6x_dma_sync(paddr, size, dir); 167 - } 168 - 169 - void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size, 170 - enum dma_data_direction dir) 171 - { 172 - return c6x_dma_sync(paddr, size, dir); 173 - }
-65
arch/c6x/mm/init.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 6 - * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 - */ 8 - #include <linux/mm.h> 9 - #include <linux/swap.h> 10 - #include <linux/module.h> 11 - #include <linux/memblock.h> 12 - #ifdef CONFIG_BLK_DEV_RAM 13 - #include <linux/blkdev.h> 14 - #endif 15 - #include <linux/initrd.h> 16 - 17 - #include <asm/sections.h> 18 - #include <linux/uaccess.h> 19 - 20 - /* 21 - * ZERO_PAGE is a special page that is used for zero-initialized 22 - * data and COW. 23 - */ 24 - unsigned long empty_zero_page; 25 - EXPORT_SYMBOL(empty_zero_page); 26 - 27 - /* 28 - * paging_init() continues the virtual memory environment setup which 29 - * was begun by the code in arch/head.S. 30 - * The parameters are pointers to where to stick the starting and ending 31 - * addresses of available kernel virtual memory. 32 - */ 33 - void __init paging_init(void) 34 - { 35 - struct pglist_data *pgdat = NODE_DATA(0); 36 - unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, }; 37 - 38 - empty_zero_page = (unsigned long) memblock_alloc(PAGE_SIZE, 39 - PAGE_SIZE); 40 - if (!empty_zero_page) 41 - panic("%s: Failed to allocate %lu bytes align=0x%lx\n", 42 - __func__, PAGE_SIZE, PAGE_SIZE); 43 - 44 - /* 45 - * Set up user data space 46 - */ 47 - set_fs(KERNEL_DS); 48 - 49 - /* 50 - * Define zones 51 - */ 52 - max_zone_pfn[ZONE_NORMAL] = memory_end >> PAGE_SHIFT; 53 - 54 - free_area_init(max_zone_pfn); 55 - } 56 - 57 - void __init mem_init(void) 58 - { 59 - high_memory = (void *)(memory_end & PAGE_MASK); 60 - 61 - /* this will put all memory onto the freelists */ 62 - memblock_free_all(); 63 - 64 - mem_init_print_info(NULL); 65 - }
-21
arch/c6x/platforms/Kconfig
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - 3 - config SOC_TMS320C6455 4 - bool "TMS320C6455" 5 - default n 6 - 7 - config SOC_TMS320C6457 8 - bool "TMS320C6457" 9 - default n 10 - 11 - config SOC_TMS320C6472 12 - bool "TMS320C6472" 13 - default n 14 - 15 - config SOC_TMS320C6474 16 - bool "TMS320C6474" 17 - default n 18 - 19 - config SOC_TMS320C6678 20 - bool "TMS320C6678" 21 - default n
-13
arch/c6x/platforms/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - # 3 - # Makefile for arch/c6x/platforms 4 - # 5 - # Copyright 2010, 2011 Texas Instruments Incorporated 6 - # 7 - 8 - obj-y = cache.o megamod-pic.o pll.o plldata.o timer64.o 9 - obj-y += dscr.o 10 - 11 - # SoC objects 12 - obj-$(CONFIG_SOC_TMS320C6455) += emif.o 13 - obj-$(CONFIG_SOC_TMS320C6457) += emif.o
-444
arch/c6x/platforms/cache.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Copyright (C) 2011 Texas Instruments Incorporated 4 - * Author: Mark Salter <msalter@redhat.com> 5 - */ 6 - #include <linux/of.h> 7 - #include <linux/of_address.h> 8 - #include <linux/io.h> 9 - 10 - #include <asm/cache.h> 11 - #include <asm/soc.h> 12 - 13 - /* 14 - * Internal Memory Control Registers for caches 15 - */ 16 - #define IMCR_CCFG 0x0000 17 - #define IMCR_L1PCFG 0x0020 18 - #define IMCR_L1PCC 0x0024 19 - #define IMCR_L1DCFG 0x0040 20 - #define IMCR_L1DCC 0x0044 21 - #define IMCR_L2ALLOC0 0x2000 22 - #define IMCR_L2ALLOC1 0x2004 23 - #define IMCR_L2ALLOC2 0x2008 24 - #define IMCR_L2ALLOC3 0x200c 25 - #define IMCR_L2WBAR 0x4000 26 - #define IMCR_L2WWC 0x4004 27 - #define IMCR_L2WIBAR 0x4010 28 - #define IMCR_L2WIWC 0x4014 29 - #define IMCR_L2IBAR 0x4018 30 - #define IMCR_L2IWC 0x401c 31 - #define IMCR_L1PIBAR 0x4020 32 - #define IMCR_L1PIWC 0x4024 33 - #define IMCR_L1DWIBAR 0x4030 34 - #define IMCR_L1DWIWC 0x4034 35 - #define IMCR_L1DWBAR 0x4040 36 - #define IMCR_L1DWWC 0x4044 37 - #define IMCR_L1DIBAR 0x4048 38 - #define IMCR_L1DIWC 0x404c 39 - #define IMCR_L2WB 0x5000 40 - #define IMCR_L2WBINV 0x5004 41 - #define IMCR_L2INV 0x5008 42 - #define IMCR_L1PINV 0x5028 43 - #define IMCR_L1DWB 0x5040 44 - #define IMCR_L1DWBINV 0x5044 45 - #define IMCR_L1DINV 0x5048 46 - #define IMCR_MAR_BASE 0x8000 47 - #define IMCR_MAR96_111 0x8180 48 - #define IMCR_MAR128_191 0x8200 49 - #define IMCR_MAR224_239 0x8380 50 - #define IMCR_L2MPFAR 0xa000 51 - #define IMCR_L2MPFSR 0xa004 52 - #define IMCR_L2MPFCR 0xa008 53 - #define IMCR_L2MPLK0 0xa100 54 - #define IMCR_L2MPLK1 0xa104 55 - #define IMCR_L2MPLK2 0xa108 56 - #define IMCR_L2MPLK3 0xa10c 57 - #define IMCR_L2MPLKCMD 0xa110 58 - #define IMCR_L2MPLKSTAT 0xa114 59 - #define IMCR_L2MPPA_BASE 0xa200 60 - #define IMCR_L1PMPFAR 0xa400 61 - #define IMCR_L1PMPFSR 0xa404 62 - #define IMCR_L1PMPFCR 0xa408 63 - #define IMCR_L1PMPLK0 0xa500 64 - #define IMCR_L1PMPLK1 0xa504 65 - #define IMCR_L1PMPLK2 0xa508 66 - #define IMCR_L1PMPLK3 0xa50c 67 - #define IMCR_L1PMPLKCMD 0xa510 68 - #define IMCR_L1PMPLKSTAT 0xa514 69 - #define IMCR_L1PMPPA_BASE 0xa600 70 - #define IMCR_L1DMPFAR 0xac00 71 - #define IMCR_L1DMPFSR 0xac04 72 - #define IMCR_L1DMPFCR 0xac08 73 - #define IMCR_L1DMPLK0 0xad00 74 - #define IMCR_L1DMPLK1 0xad04 75 - #define IMCR_L1DMPLK2 0xad08 76 - #define IMCR_L1DMPLK3 0xad0c 77 - #define IMCR_L1DMPLKCMD 0xad10 78 - #define IMCR_L1DMPLKSTAT 0xad14 79 - #define IMCR_L1DMPPA_BASE 0xae00 80 - #define IMCR_L2PDWAKE0 0xc040 81 - #define IMCR_L2PDWAKE1 0xc044 82 - #define IMCR_L2PDSLEEP0 0xc050 83 - #define IMCR_L2PDSLEEP1 0xc054 84 - #define IMCR_L2PDSTAT0 0xc060 85 - #define IMCR_L2PDSTAT1 0xc064 86 - 87 - /* 88 - * CCFG register values and bits 89 - */ 90 - #define L2MODE_0K_CACHE 0x0 91 - #define L2MODE_32K_CACHE 0x1 92 - #define L2MODE_64K_CACHE 0x2 93 - #define L2MODE_128K_CACHE 0x3 94 - #define L2MODE_256K_CACHE 0x7 95 - 96 - #define L2PRIO_URGENT 0x0 97 - #define L2PRIO_HIGH 0x1 98 - #define L2PRIO_MEDIUM 0x2 99 - #define L2PRIO_LOW 0x3 100 - 101 - #define CCFG_ID 0x100 /* Invalidate L1P bit */ 102 - #define CCFG_IP 0x200 /* Invalidate L1D bit */ 103 - 104 - static void __iomem *cache_base; 105 - 106 - /* 107 - * L1 & L2 caches generic functions 108 - */ 109 - #define imcr_get(reg) soc_readl(cache_base + (reg)) 110 - #define imcr_set(reg, value) \ 111 - do { \ 112 - soc_writel((value), cache_base + (reg)); \ 113 - soc_readl(cache_base + (reg)); \ 114 - } while (0) 115 - 116 - static void cache_block_operation_wait(unsigned int wc_reg) 117 - { 118 - /* Wait for completion */ 119 - while (imcr_get(wc_reg)) 120 - cpu_relax(); 121 - } 122 - 123 - static DEFINE_SPINLOCK(cache_lock); 124 - 125 - /* 126 - * Generic function to perform a block cache operation as 127 - * invalidate or writeback/invalidate 128 - */ 129 - static void cache_block_operation(unsigned int *start, 130 - unsigned int *end, 131 - unsigned int bar_reg, 132 - unsigned int wc_reg) 133 - { 134 - unsigned long flags; 135 - unsigned int wcnt = 136 - (L2_CACHE_ALIGN_CNT((unsigned int) end) 137 - - L2_CACHE_ALIGN_LOW((unsigned int) start)) >> 2; 138 - unsigned int wc = 0; 139 - 140 - for (; wcnt; wcnt -= wc, start += wc) { 141 - loop: 142 - spin_lock_irqsave(&cache_lock, flags); 143 - 144 - /* 145 - * If another cache operation is occurring 146 - */ 147 - if (unlikely(imcr_get(wc_reg))) { 148 - spin_unlock_irqrestore(&cache_lock, flags); 149 - 150 - /* Wait for previous operation completion */ 151 - cache_block_operation_wait(wc_reg); 152 - 153 - /* Try again */ 154 - goto loop; 155 - } 156 - 157 - imcr_set(bar_reg, L2_CACHE_ALIGN_LOW((unsigned int) start)); 158 - 159 - if (wcnt > 0xffff) 160 - wc = 0xffff; 161 - else 162 - wc = wcnt; 163 - 164 - /* Set word count value in the WC register */ 165 - imcr_set(wc_reg, wc & 0xffff); 166 - 167 - spin_unlock_irqrestore(&cache_lock, flags); 168 - 169 - /* Wait for completion */ 170 - cache_block_operation_wait(wc_reg); 171 - } 172 - } 173 - 174 - static void cache_block_operation_nowait(unsigned int *start, 175 - unsigned int *end, 176 - unsigned int bar_reg, 177 - unsigned int wc_reg) 178 - { 179 - unsigned long flags; 180 - unsigned int wcnt = 181 - (L2_CACHE_ALIGN_CNT((unsigned int) end) 182 - - L2_CACHE_ALIGN_LOW((unsigned int) start)) >> 2; 183 - unsigned int wc = 0; 184 - 185 - for (; wcnt; wcnt -= wc, start += wc) { 186 - 187 - spin_lock_irqsave(&cache_lock, flags); 188 - 189 - imcr_set(bar_reg, L2_CACHE_ALIGN_LOW((unsigned int) start)); 190 - 191 - if (wcnt > 0xffff) 192 - wc = 0xffff; 193 - else 194 - wc = wcnt; 195 - 196 - /* Set word count value in the WC register */ 197 - imcr_set(wc_reg, wc & 0xffff); 198 - 199 - spin_unlock_irqrestore(&cache_lock, flags); 200 - 201 - /* Don't wait for completion on last cache operation */ 202 - if (wcnt > 0xffff) 203 - cache_block_operation_wait(wc_reg); 204 - } 205 - } 206 - 207 - /* 208 - * L1 caches management 209 - */ 210 - 211 - /* 212 - * Disable L1 caches 213 - */ 214 - void L1_cache_off(void) 215 - { 216 - unsigned int dummy; 217 - 218 - imcr_set(IMCR_L1PCFG, 0); 219 - dummy = imcr_get(IMCR_L1PCFG); 220 - 221 - imcr_set(IMCR_L1DCFG, 0); 222 - dummy = imcr_get(IMCR_L1DCFG); 223 - } 224 - 225 - /* 226 - * Enable L1 caches 227 - */ 228 - void L1_cache_on(void) 229 - { 230 - unsigned int dummy; 231 - 232 - imcr_set(IMCR_L1PCFG, 7); 233 - dummy = imcr_get(IMCR_L1PCFG); 234 - 235 - imcr_set(IMCR_L1DCFG, 7); 236 - dummy = imcr_get(IMCR_L1DCFG); 237 - } 238 - 239 - /* 240 - * L1P global-invalidate all 241 - */ 242 - void L1P_cache_global_invalidate(void) 243 - { 244 - unsigned int set = 1; 245 - imcr_set(IMCR_L1PINV, set); 246 - while (imcr_get(IMCR_L1PINV) & 1) 247 - cpu_relax(); 248 - } 249 - 250 - /* 251 - * L1D global-invalidate all 252 - * 253 - * Warning: this operation causes all updated data in L1D to 254 - * be discarded rather than written back to the lower levels of 255 - * memory 256 - */ 257 - void L1D_cache_global_invalidate(void) 258 - { 259 - unsigned int set = 1; 260 - imcr_set(IMCR_L1DINV, set); 261 - while (imcr_get(IMCR_L1DINV) & 1) 262 - cpu_relax(); 263 - } 264 - 265 - void L1D_cache_global_writeback(void) 266 - { 267 - unsigned int set = 1; 268 - imcr_set(IMCR_L1DWB, set); 269 - while (imcr_get(IMCR_L1DWB) & 1) 270 - cpu_relax(); 271 - } 272 - 273 - void L1D_cache_global_writeback_invalidate(void) 274 - { 275 - unsigned int set = 1; 276 - imcr_set(IMCR_L1DWBINV, set); 277 - while (imcr_get(IMCR_L1DWBINV) & 1) 278 - cpu_relax(); 279 - } 280 - 281 - /* 282 - * L2 caches management 283 - */ 284 - 285 - /* 286 - * Set L2 operation mode 287 - */ 288 - void L2_cache_set_mode(unsigned int mode) 289 - { 290 - unsigned int ccfg = imcr_get(IMCR_CCFG); 291 - 292 - /* Clear and set the L2MODE bits in CCFG */ 293 - ccfg &= ~7; 294 - ccfg |= (mode & 7); 295 - imcr_set(IMCR_CCFG, ccfg); 296 - ccfg = imcr_get(IMCR_CCFG); 297 - } 298 - 299 - /* 300 - * L2 global-writeback and global-invalidate all 301 - */ 302 - void L2_cache_global_writeback_invalidate(void) 303 - { 304 - imcr_set(IMCR_L2WBINV, 1); 305 - while (imcr_get(IMCR_L2WBINV)) 306 - cpu_relax(); 307 - } 308 - 309 - /* 310 - * L2 global-writeback all 311 - */ 312 - void L2_cache_global_writeback(void) 313 - { 314 - imcr_set(IMCR_L2WB, 1); 315 - while (imcr_get(IMCR_L2WB)) 316 - cpu_relax(); 317 - } 318 - 319 - /* 320 - * Cacheability controls 321 - */ 322 - void enable_caching(unsigned long start, unsigned long end) 323 - { 324 - unsigned int mar = IMCR_MAR_BASE + ((start >> 24) << 2); 325 - unsigned int mar_e = IMCR_MAR_BASE + ((end >> 24) << 2); 326 - 327 - for (; mar <= mar_e; mar += 4) 328 - imcr_set(mar, imcr_get(mar) | 1); 329 - } 330 - 331 - void disable_caching(unsigned long start, unsigned long end) 332 - { 333 - unsigned int mar = IMCR_MAR_BASE + ((start >> 24) << 2); 334 - unsigned int mar_e = IMCR_MAR_BASE + ((end >> 24) << 2); 335 - 336 - for (; mar <= mar_e; mar += 4) 337 - imcr_set(mar, imcr_get(mar) & ~1); 338 - } 339 - 340 - 341 - /* 342 - * L1 block operations 343 - */ 344 - void L1P_cache_block_invalidate(unsigned int start, unsigned int end) 345 - { 346 - cache_block_operation((unsigned int *) start, 347 - (unsigned int *) end, 348 - IMCR_L1PIBAR, IMCR_L1PIWC); 349 - } 350 - EXPORT_SYMBOL(L1P_cache_block_invalidate); 351 - 352 - void L1D_cache_block_invalidate(unsigned int start, unsigned int end) 353 - { 354 - cache_block_operation((unsigned int *) start, 355 - (unsigned int *) end, 356 - IMCR_L1DIBAR, IMCR_L1DIWC); 357 - } 358 - 359 - void L1D_cache_block_writeback_invalidate(unsigned int start, unsigned int end) 360 - { 361 - cache_block_operation((unsigned int *) start, 362 - (unsigned int *) end, 363 - IMCR_L1DWIBAR, IMCR_L1DWIWC); 364 - } 365 - 366 - void L1D_cache_block_writeback(unsigned int start, unsigned int end) 367 - { 368 - cache_block_operation((unsigned int *) start, 369 - (unsigned int *) end, 370 - IMCR_L1DWBAR, IMCR_L1DWWC); 371 - } 372 - EXPORT_SYMBOL(L1D_cache_block_writeback); 373 - 374 - /* 375 - * L2 block operations 376 - */ 377 - void L2_cache_block_invalidate(unsigned int start, unsigned int end) 378 - { 379 - cache_block_operation((unsigned int *) start, 380 - (unsigned int *) end, 381 - IMCR_L2IBAR, IMCR_L2IWC); 382 - } 383 - 384 - void L2_cache_block_writeback(unsigned int start, unsigned int end) 385 - { 386 - cache_block_operation((unsigned int *) start, 387 - (unsigned int *) end, 388 - IMCR_L2WBAR, IMCR_L2WWC); 389 - } 390 - 391 - void L2_cache_block_writeback_invalidate(unsigned int start, unsigned int end) 392 - { 393 - cache_block_operation((unsigned int *) start, 394 - (unsigned int *) end, 395 - IMCR_L2WIBAR, IMCR_L2WIWC); 396 - } 397 - 398 - void L2_cache_block_invalidate_nowait(unsigned int start, unsigned int end) 399 - { 400 - cache_block_operation_nowait((unsigned int *) start, 401 - (unsigned int *) end, 402 - IMCR_L2IBAR, IMCR_L2IWC); 403 - } 404 - 405 - void L2_cache_block_writeback_nowait(unsigned int start, unsigned int end) 406 - { 407 - cache_block_operation_nowait((unsigned int *) start, 408 - (unsigned int *) end, 409 - IMCR_L2WBAR, IMCR_L2WWC); 410 - } 411 - 412 - void L2_cache_block_writeback_invalidate_nowait(unsigned int start, 413 - unsigned int end) 414 - { 415 - cache_block_operation_nowait((unsigned int *) start, 416 - (unsigned int *) end, 417 - IMCR_L2WIBAR, IMCR_L2WIWC); 418 - } 419 - 420 - 421 - /* 422 - * L1 and L2 caches configuration 423 - */ 424 - void __init c6x_cache_init(void) 425 - { 426 - struct device_node *node; 427 - 428 - node = of_find_compatible_node(NULL, NULL, "ti,c64x+cache"); 429 - if (!node) 430 - return; 431 - 432 - cache_base = of_iomap(node, 0); 433 - 434 - of_node_put(node); 435 - 436 - if (!cache_base) 437 - return; 438 - 439 - /* Set L2 caches on the the whole L2 SRAM memory */ 440 - L2_cache_set_mode(L2MODE_SIZE); 441 - 442 - /* Enable L1 */ 443 - L1_cache_on(); 444 - }
-595
arch/c6x/platforms/dscr.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Device State Control Registers driver 4 - * 5 - * Copyright (C) 2011 Texas Instruments Incorporated 6 - * Author: Mark Salter <msalter@redhat.com> 7 - */ 8 - 9 - /* 10 - * The Device State Control Registers (DSCR) provide SoC level control over 11 - * a number of peripherals. Details vary considerably among the various SoC 12 - * parts. In general, the DSCR block will provide one or more configuration 13 - * registers often protected by a lock register. One or more key values must 14 - * be written to a lock register in order to unlock the configuration register. 15 - * The configuration register may be used to enable (and disable in some 16 - * cases) SoC pin drivers, peripheral clock sources (internal or pin), etc. 17 - * In some cases, a configuration register is write once or the individual 18 - * bits are write once. That is, you may be able to enable a device, but 19 - * will not be able to disable it. 20 - * 21 - * In addition to device configuration, the DSCR block may provide registers 22 - * which are used to reset SoC peripherals, provide device ID information, 23 - * provide MAC addresses, and other miscellaneous functions. 24 - */ 25 - 26 - #include <linux/of.h> 27 - #include <linux/of_address.h> 28 - #include <linux/of_platform.h> 29 - #include <linux/module.h> 30 - #include <linux/io.h> 31 - #include <linux/delay.h> 32 - #include <asm/soc.h> 33 - #include <asm/dscr.h> 34 - 35 - #define MAX_DEVSTATE_IDS 32 36 - #define MAX_DEVCTL_REGS 8 37 - #define MAX_DEVSTAT_REGS 8 38 - #define MAX_LOCKED_REGS 4 39 - #define MAX_SOC_EMACS 2 40 - 41 - struct rmii_reset_reg { 42 - u32 reg; 43 - u32 mask; 44 - }; 45 - 46 - /* 47 - * Some registerd may be locked. In order to write to these 48 - * registers, the key value must first be written to the lockreg. 49 - */ 50 - struct locked_reg { 51 - u32 reg; /* offset from base */ 52 - u32 lockreg; /* offset from base */ 53 - u32 key; /* unlock key */ 54 - }; 55 - 56 - /* 57 - * This describes a contiguous area of like control bits used to enable/disable 58 - * SoC devices. Each controllable device is given an ID which is used by the 59 - * individual device drivers to control the device state. These IDs start at 60 - * zero and are assigned sequentially to the control bitfield ranges described 61 - * by this structure. 62 - */ 63 - struct devstate_ctl_reg { 64 - u32 reg; /* register holding the control bits */ 65 - u8 start_id; /* start id of this range */ 66 - u8 num_ids; /* number of devices in this range */ 67 - u8 enable_only; /* bits are write-once to enable only */ 68 - u8 enable; /* value used to enable device */ 69 - u8 disable; /* value used to disable device */ 70 - u8 shift; /* starting (rightmost) bit in range */ 71 - u8 nbits; /* number of bits per device */ 72 - }; 73 - 74 - 75 - /* 76 - * This describes a region of status bits indicating the state of 77 - * various devices. This is used internally to wait for status 78 - * change completion when enabling/disabling a device. Status is 79 - * optional and not all device controls will have a corresponding 80 - * status. 81 - */ 82 - struct devstate_stat_reg { 83 - u32 reg; /* register holding the status bits */ 84 - u8 start_id; /* start id of this range */ 85 - u8 num_ids; /* number of devices in this range */ 86 - u8 enable; /* value indicating enabled state */ 87 - u8 disable; /* value indicating disabled state */ 88 - u8 shift; /* starting (rightmost) bit in range */ 89 - u8 nbits; /* number of bits per device */ 90 - }; 91 - 92 - struct devstate_info { 93 - struct devstate_ctl_reg *ctl; 94 - struct devstate_stat_reg *stat; 95 - }; 96 - 97 - /* These are callbacks to SOC-specific code. */ 98 - struct dscr_ops { 99 - void (*init)(struct device_node *node); 100 - }; 101 - 102 - struct dscr_regs { 103 - spinlock_t lock; 104 - void __iomem *base; 105 - u32 kick_reg[2]; 106 - u32 kick_key[2]; 107 - struct locked_reg locked[MAX_LOCKED_REGS]; 108 - struct devstate_info devstate_info[MAX_DEVSTATE_IDS]; 109 - struct rmii_reset_reg rmii_resets[MAX_SOC_EMACS]; 110 - struct devstate_ctl_reg devctl[MAX_DEVCTL_REGS]; 111 - struct devstate_stat_reg devstat[MAX_DEVSTAT_REGS]; 112 - }; 113 - 114 - static struct dscr_regs dscr; 115 - 116 - static struct locked_reg *find_locked_reg(u32 reg) 117 - { 118 - int i; 119 - 120 - for (i = 0; i < MAX_LOCKED_REGS; i++) 121 - if (dscr.locked[i].key && reg == dscr.locked[i].reg) 122 - return &dscr.locked[i]; 123 - return NULL; 124 - } 125 - 126 - /* 127 - * Write to a register with one lock 128 - */ 129 - static void dscr_write_locked1(u32 reg, u32 val, 130 - u32 lock, u32 key) 131 - { 132 - void __iomem *reg_addr = dscr.base + reg; 133 - void __iomem *lock_addr = dscr.base + lock; 134 - 135 - /* 136 - * For some registers, the lock is relocked after a short number 137 - * of cycles. We have to put the lock write and register write in 138 - * the same fetch packet to meet this timing. The .align ensures 139 - * the two stw instructions are in the same fetch packet. 140 - */ 141 - asm volatile ("b .s2 0f\n" 142 - "nop 5\n" 143 - " .align 5\n" 144 - "0:\n" 145 - "stw .D1T2 %3,*%2\n" 146 - "stw .D1T2 %1,*%0\n" 147 - : 148 - : "a"(reg_addr), "b"(val), "a"(lock_addr), "b"(key) 149 - ); 150 - 151 - /* in case the hw doesn't reset the lock */ 152 - soc_writel(0, lock_addr); 153 - } 154 - 155 - /* 156 - * Write to a register protected by two lock registers 157 - */ 158 - static void dscr_write_locked2(u32 reg, u32 val, 159 - u32 lock0, u32 key0, 160 - u32 lock1, u32 key1) 161 - { 162 - soc_writel(key0, dscr.base + lock0); 163 - soc_writel(key1, dscr.base + lock1); 164 - soc_writel(val, dscr.base + reg); 165 - soc_writel(0, dscr.base + lock0); 166 - soc_writel(0, dscr.base + lock1); 167 - } 168 - 169 - static void dscr_write(u32 reg, u32 val) 170 - { 171 - struct locked_reg *lock; 172 - 173 - lock = find_locked_reg(reg); 174 - if (lock) 175 - dscr_write_locked1(reg, val, lock->lockreg, lock->key); 176 - else if (dscr.kick_key[0]) 177 - dscr_write_locked2(reg, val, dscr.kick_reg[0], dscr.kick_key[0], 178 - dscr.kick_reg[1], dscr.kick_key[1]); 179 - else 180 - soc_writel(val, dscr.base + reg); 181 - } 182 - 183 - 184 - /* 185 - * Drivers can use this interface to enable/disable SoC IP blocks. 186 - */ 187 - void dscr_set_devstate(int id, enum dscr_devstate_t state) 188 - { 189 - struct devstate_ctl_reg *ctl; 190 - struct devstate_stat_reg *stat; 191 - struct devstate_info *info; 192 - u32 ctl_val, val; 193 - int ctl_shift, ctl_mask; 194 - unsigned long flags; 195 - 196 - if (!dscr.base) 197 - return; 198 - 199 - if (id < 0 || id >= MAX_DEVSTATE_IDS) 200 - return; 201 - 202 - info = &dscr.devstate_info[id]; 203 - ctl = info->ctl; 204 - stat = info->stat; 205 - 206 - if (ctl == NULL) 207 - return; 208 - 209 - ctl_shift = ctl->shift + ctl->nbits * (id - ctl->start_id); 210 - ctl_mask = ((1 << ctl->nbits) - 1) << ctl_shift; 211 - 212 - switch (state) { 213 - case DSCR_DEVSTATE_ENABLED: 214 - ctl_val = ctl->enable << ctl_shift; 215 - break; 216 - case DSCR_DEVSTATE_DISABLED: 217 - if (ctl->enable_only) 218 - return; 219 - ctl_val = ctl->disable << ctl_shift; 220 - break; 221 - default: 222 - return; 223 - } 224 - 225 - spin_lock_irqsave(&dscr.lock, flags); 226 - 227 - val = soc_readl(dscr.base + ctl->reg); 228 - val &= ~ctl_mask; 229 - val |= ctl_val; 230 - 231 - dscr_write(ctl->reg, val); 232 - 233 - spin_unlock_irqrestore(&dscr.lock, flags); 234 - 235 - if (!stat) 236 - return; 237 - 238 - ctl_shift = stat->shift + stat->nbits * (id - stat->start_id); 239 - 240 - if (state == DSCR_DEVSTATE_ENABLED) 241 - ctl_val = stat->enable; 242 - else 243 - ctl_val = stat->disable; 244 - 245 - do { 246 - val = soc_readl(dscr.base + stat->reg); 247 - val >>= ctl_shift; 248 - val &= ((1 << stat->nbits) - 1); 249 - } while (val != ctl_val); 250 - } 251 - EXPORT_SYMBOL(dscr_set_devstate); 252 - 253 - /* 254 - * Drivers can use this to reset RMII module. 255 - */ 256 - void dscr_rmii_reset(int id, int assert) 257 - { 258 - struct rmii_reset_reg *r; 259 - unsigned long flags; 260 - u32 val; 261 - 262 - if (id < 0 || id >= MAX_SOC_EMACS) 263 - return; 264 - 265 - r = &dscr.rmii_resets[id]; 266 - if (r->mask == 0) 267 - return; 268 - 269 - spin_lock_irqsave(&dscr.lock, flags); 270 - 271 - val = soc_readl(dscr.base + r->reg); 272 - if (assert) 273 - dscr_write(r->reg, val | r->mask); 274 - else 275 - dscr_write(r->reg, val & ~(r->mask)); 276 - 277 - spin_unlock_irqrestore(&dscr.lock, flags); 278 - } 279 - EXPORT_SYMBOL(dscr_rmii_reset); 280 - 281 - static void __init dscr_parse_devstat(struct device_node *node, 282 - void __iomem *base) 283 - { 284 - u32 val; 285 - int err; 286 - 287 - err = of_property_read_u32_array(node, "ti,dscr-devstat", &val, 1); 288 - if (!err) 289 - c6x_devstat = soc_readl(base + val); 290 - printk(KERN_INFO "DEVSTAT: %08x\n", c6x_devstat); 291 - } 292 - 293 - static void __init dscr_parse_silicon_rev(struct device_node *node, 294 - void __iomem *base) 295 - { 296 - u32 vals[3]; 297 - int err; 298 - 299 - err = of_property_read_u32_array(node, "ti,dscr-silicon-rev", vals, 3); 300 - if (!err) { 301 - c6x_silicon_rev = soc_readl(base + vals[0]); 302 - c6x_silicon_rev >>= vals[1]; 303 - c6x_silicon_rev &= vals[2]; 304 - } 305 - } 306 - 307 - /* 308 - * Some SoCs will have a pair of fuse registers which hold 309 - * an ethernet MAC address. The "ti,dscr-mac-fuse-regs" 310 - * property is a mapping from fuse register bytes to MAC 311 - * address bytes. The expected format is: 312 - * 313 - * ti,dscr-mac-fuse-regs = <reg0 b3 b2 b1 b0 314 - * reg1 b3 b2 b1 b0> 315 - * 316 - * reg0 and reg1 are the offsets of the two fuse registers. 317 - * b3-b0 positionally represent bytes within the fuse register. 318 - * b3 is the most significant byte and b0 is the least. 319 - * Allowable values for b3-b0 are: 320 - * 321 - * 0 = fuse register byte not used in MAC address 322 - * 1-6 = index+1 into c6x_fuse_mac[] 323 - */ 324 - static void __init dscr_parse_mac_fuse(struct device_node *node, 325 - void __iomem *base) 326 - { 327 - u32 vals[10], fuse; 328 - int f, i, j, err; 329 - 330 - err = of_property_read_u32_array(node, "ti,dscr-mac-fuse-regs", 331 - vals, 10); 332 - if (err) 333 - return; 334 - 335 - for (f = 0; f < 2; f++) { 336 - fuse = soc_readl(base + vals[f * 5]); 337 - for (j = (f * 5) + 1, i = 24; i >= 0; i -= 8, j++) 338 - if (vals[j] && vals[j] <= 6) 339 - c6x_fuse_mac[vals[j] - 1] = fuse >> i; 340 - } 341 - } 342 - 343 - static void __init dscr_parse_rmii_resets(struct device_node *node, 344 - void __iomem *base) 345 - { 346 - const __be32 *p; 347 - int i, size; 348 - 349 - /* look for RMII reset registers */ 350 - p = of_get_property(node, "ti,dscr-rmii-resets", &size); 351 - if (p) { 352 - /* parse all the reg/mask pairs we can handle */ 353 - size /= (sizeof(*p) * 2); 354 - if (size > MAX_SOC_EMACS) 355 - size = MAX_SOC_EMACS; 356 - 357 - for (i = 0; i < size; i++) { 358 - dscr.rmii_resets[i].reg = be32_to_cpup(p++); 359 - dscr.rmii_resets[i].mask = be32_to_cpup(p++); 360 - } 361 - } 362 - } 363 - 364 - 365 - static void __init dscr_parse_privperm(struct device_node *node, 366 - void __iomem *base) 367 - { 368 - u32 vals[2]; 369 - int err; 370 - 371 - err = of_property_read_u32_array(node, "ti,dscr-privperm", vals, 2); 372 - if (err) 373 - return; 374 - dscr_write(vals[0], vals[1]); 375 - } 376 - 377 - /* 378 - * SoCs may have "locked" DSCR registers which can only be written 379 - * to only after writing a key value to a lock registers. These 380 - * regisers can be described with the "ti,dscr-locked-regs" property. 381 - * This property provides a list of register descriptions with each 382 - * description consisting of three values. 383 - * 384 - * ti,dscr-locked-regs = <reg0 lockreg0 key0 385 - * ... 386 - * regN lockregN keyN>; 387 - * 388 - * reg is the offset of the locked register 389 - * lockreg is the offset of the lock register 390 - * key is the unlock key written to lockreg 391 - * 392 - */ 393 - static void __init dscr_parse_locked_regs(struct device_node *node, 394 - void __iomem *base) 395 - { 396 - struct locked_reg *r; 397 - const __be32 *p; 398 - int i, size; 399 - 400 - p = of_get_property(node, "ti,dscr-locked-regs", &size); 401 - if (p) { 402 - /* parse all the register descriptions we can handle */ 403 - size /= (sizeof(*p) * 3); 404 - if (size > MAX_LOCKED_REGS) 405 - size = MAX_LOCKED_REGS; 406 - 407 - for (i = 0; i < size; i++) { 408 - r = &dscr.locked[i]; 409 - 410 - r->reg = be32_to_cpup(p++); 411 - r->lockreg = be32_to_cpup(p++); 412 - r->key = be32_to_cpup(p++); 413 - } 414 - } 415 - } 416 - 417 - /* 418 - * SoCs may have DSCR registers which are only write enabled after 419 - * writing specific key values to two registers. The two key registers 420 - * and the key values can be parsed from a "ti,dscr-kick-regs" 421 - * propety with the following layout: 422 - * 423 - * ti,dscr-kick-regs = <kickreg0 key0 kickreg1 key1> 424 - * 425 - * kickreg is the offset of the "kick" register 426 - * key is the value which unlocks writing for protected regs 427 - */ 428 - static void __init dscr_parse_kick_regs(struct device_node *node, 429 - void __iomem *base) 430 - { 431 - u32 vals[4]; 432 - int err; 433 - 434 - err = of_property_read_u32_array(node, "ti,dscr-kick-regs", vals, 4); 435 - if (!err) { 436 - dscr.kick_reg[0] = vals[0]; 437 - dscr.kick_key[0] = vals[1]; 438 - dscr.kick_reg[1] = vals[2]; 439 - dscr.kick_key[1] = vals[3]; 440 - } 441 - } 442 - 443 - 444 - /* 445 - * SoCs may provide controls to enable/disable individual IP blocks. These 446 - * controls in the DSCR usually control pin drivers but also may control 447 - * clocking and or resets. The device tree is used to describe the bitfields 448 - * in registers used to control device state. The number of bits and their 449 - * values may vary even within the same register. 450 - * 451 - * The layout of these bitfields is described by the ti,dscr-devstate-ctl-regs 452 - * property. This property is a list where each element describes a contiguous 453 - * range of control fields with like properties. Each element of the list 454 - * consists of 7 cells with the following values: 455 - * 456 - * start_id num_ids reg enable disable start_bit nbits 457 - * 458 - * start_id is device id for the first device control in the range 459 - * num_ids is the number of device controls in the range 460 - * reg is the offset of the register holding the control bits 461 - * enable is the value to enable a device 462 - * disable is the value to disable a device (0xffffffff if cannot disable) 463 - * start_bit is the bit number of the first bit in the range 464 - * nbits is the number of bits per device control 465 - */ 466 - static void __init dscr_parse_devstate_ctl_regs(struct device_node *node, 467 - void __iomem *base) 468 - { 469 - struct devstate_ctl_reg *r; 470 - const __be32 *p; 471 - int i, j, size; 472 - 473 - p = of_get_property(node, "ti,dscr-devstate-ctl-regs", &size); 474 - if (p) { 475 - /* parse all the ranges we can handle */ 476 - size /= (sizeof(*p) * 7); 477 - if (size > MAX_DEVCTL_REGS) 478 - size = MAX_DEVCTL_REGS; 479 - 480 - for (i = 0; i < size; i++) { 481 - r = &dscr.devctl[i]; 482 - 483 - r->start_id = be32_to_cpup(p++); 484 - r->num_ids = be32_to_cpup(p++); 485 - r->reg = be32_to_cpup(p++); 486 - r->enable = be32_to_cpup(p++); 487 - r->disable = be32_to_cpup(p++); 488 - if (r->disable == 0xffffffff) 489 - r->enable_only = 1; 490 - r->shift = be32_to_cpup(p++); 491 - r->nbits = be32_to_cpup(p++); 492 - 493 - for (j = r->start_id; 494 - j < (r->start_id + r->num_ids); 495 - j++) 496 - dscr.devstate_info[j].ctl = r; 497 - } 498 - } 499 - } 500 - 501 - /* 502 - * SoCs may provide status registers indicating the state (enabled/disabled) of 503 - * devices on the SoC. The device tree is used to describe the bitfields in 504 - * registers used to provide device status. The number of bits and their 505 - * values used to provide status may vary even within the same register. 506 - * 507 - * The layout of these bitfields is described by the ti,dscr-devstate-stat-regs 508 - * property. This property is a list where each element describes a contiguous 509 - * range of status fields with like properties. Each element of the list 510 - * consists of 7 cells with the following values: 511 - * 512 - * start_id num_ids reg enable disable start_bit nbits 513 - * 514 - * start_id is device id for the first device status in the range 515 - * num_ids is the number of devices covered by the range 516 - * reg is the offset of the register holding the status bits 517 - * enable is the value indicating device is enabled 518 - * disable is the value indicating device is disabled 519 - * start_bit is the bit number of the first bit in the range 520 - * nbits is the number of bits per device status 521 - */ 522 - static void __init dscr_parse_devstate_stat_regs(struct device_node *node, 523 - void __iomem *base) 524 - { 525 - struct devstate_stat_reg *r; 526 - const __be32 *p; 527 - int i, j, size; 528 - 529 - p = of_get_property(node, "ti,dscr-devstate-stat-regs", &size); 530 - if (p) { 531 - /* parse all the ranges we can handle */ 532 - size /= (sizeof(*p) * 7); 533 - if (size > MAX_DEVSTAT_REGS) 534 - size = MAX_DEVSTAT_REGS; 535 - 536 - for (i = 0; i < size; i++) { 537 - r = &dscr.devstat[i]; 538 - 539 - r->start_id = be32_to_cpup(p++); 540 - r->num_ids = be32_to_cpup(p++); 541 - r->reg = be32_to_cpup(p++); 542 - r->enable = be32_to_cpup(p++); 543 - r->disable = be32_to_cpup(p++); 544 - r->shift = be32_to_cpup(p++); 545 - r->nbits = be32_to_cpup(p++); 546 - 547 - for (j = r->start_id; 548 - j < (r->start_id + r->num_ids); 549 - j++) 550 - dscr.devstate_info[j].stat = r; 551 - } 552 - } 553 - } 554 - 555 - static struct of_device_id dscr_ids[] __initdata = { 556 - { .compatible = "ti,c64x+dscr" }, 557 - {} 558 - }; 559 - 560 - /* 561 - * Probe for DSCR area. 562 - * 563 - * This has to be done early on in case timer or interrupt controller 564 - * needs something. e.g. On C6455 SoC, timer must be enabled through 565 - * DSCR before it is functional. 566 - */ 567 - void __init dscr_probe(void) 568 - { 569 - struct device_node *node; 570 - void __iomem *base; 571 - 572 - spin_lock_init(&dscr.lock); 573 - 574 - node = of_find_matching_node(NULL, dscr_ids); 575 - if (!node) 576 - return; 577 - 578 - base = of_iomap(node, 0); 579 - if (!base) { 580 - of_node_put(node); 581 - return; 582 - } 583 - 584 - dscr.base = base; 585 - 586 - dscr_parse_devstat(node, base); 587 - dscr_parse_silicon_rev(node, base); 588 - dscr_parse_mac_fuse(node, base); 589 - dscr_parse_rmii_resets(node, base); 590 - dscr_parse_locked_regs(node, base); 591 - dscr_parse_kick_regs(node, base); 592 - dscr_parse_devstate_ctl_regs(node, base); 593 - dscr_parse_devstate_stat_regs(node, base); 594 - dscr_parse_privperm(node, base); 595 - }
-84
arch/c6x/platforms/emif.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * External Memory Interface 4 - * 5 - * Copyright (C) 2011 Texas Instruments Incorporated 6 - * Author: Mark Salter <msalter@redhat.com> 7 - */ 8 - #include <linux/of.h> 9 - #include <linux/of_address.h> 10 - #include <linux/io.h> 11 - #include <asm/soc.h> 12 - #include <asm/dscr.h> 13 - 14 - #define NUM_EMIFA_CHIP_ENABLES 4 15 - 16 - struct emifa_regs { 17 - u32 midr; 18 - u32 stat; 19 - u32 reserved1[6]; 20 - u32 bprio; 21 - u32 reserved2[23]; 22 - u32 cecfg[NUM_EMIFA_CHIP_ENABLES]; 23 - u32 reserved3[4]; 24 - u32 awcc; 25 - u32 reserved4[7]; 26 - u32 intraw; 27 - u32 intmsk; 28 - u32 intmskset; 29 - u32 intmskclr; 30 - }; 31 - 32 - static struct of_device_id emifa_match[] __initdata = { 33 - { .compatible = "ti,c64x+emifa" }, 34 - {} 35 - }; 36 - 37 - /* 38 - * Parse device tree for existence of an EMIF (External Memory Interface) 39 - * and initialize it if found. 40 - */ 41 - static int __init c6x_emifa_init(void) 42 - { 43 - struct emifa_regs __iomem *regs; 44 - struct device_node *node; 45 - const __be32 *p; 46 - u32 val; 47 - int i, len, err; 48 - 49 - node = of_find_matching_node(NULL, emifa_match); 50 - if (!node) 51 - return 0; 52 - 53 - regs = of_iomap(node, 0); 54 - if (!regs) 55 - return 0; 56 - 57 - /* look for a dscr-based enable for emifa pin buffers */ 58 - err = of_property_read_u32_array(node, "ti,dscr-dev-enable", &val, 1); 59 - if (!err) 60 - dscr_set_devstate(val, DSCR_DEVSTATE_ENABLED); 61 - 62 - /* set up the chip enables */ 63 - p = of_get_property(node, "ti,emifa-ce-config", &len); 64 - if (p) { 65 - len /= sizeof(u32); 66 - if (len > NUM_EMIFA_CHIP_ENABLES) 67 - len = NUM_EMIFA_CHIP_ENABLES; 68 - for (i = 0; i <= len; i++) 69 - soc_writel(be32_to_cpup(&p[i]), &regs->cecfg[i]); 70 - } 71 - 72 - err = of_property_read_u32_array(node, "ti,emifa-burst-priority", &val, 1); 73 - if (!err) 74 - soc_writel(val, &regs->bprio); 75 - 76 - err = of_property_read_u32_array(node, "ti,emifa-async-wait-control", &val, 1); 77 - if (!err) 78 - soc_writel(val, &regs->awcc); 79 - 80 - iounmap(regs); 81 - of_node_put(node); 82 - return 0; 83 - } 84 - pure_initcall(c6x_emifa_init);
-344
arch/c6x/platforms/megamod-pic.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Support for C64x+ Megamodule Interrupt Controller 4 - * 5 - * Copyright (C) 2010, 2011 Texas Instruments Incorporated 6 - * Contributed by: Mark Salter <msalter@redhat.com> 7 - */ 8 - #include <linux/module.h> 9 - #include <linux/interrupt.h> 10 - #include <linux/io.h> 11 - #include <linux/of.h> 12 - #include <linux/of_irq.h> 13 - #include <linux/of_address.h> 14 - #include <linux/slab.h> 15 - #include <asm/soc.h> 16 - #include <asm/megamod-pic.h> 17 - 18 - #define NR_COMBINERS 4 19 - #define NR_MUX_OUTPUTS 12 20 - 21 - #define IRQ_UNMAPPED 0xffff 22 - 23 - /* 24 - * Megamodule Interrupt Controller register layout 25 - */ 26 - struct megamod_regs { 27 - u32 evtflag[8]; 28 - u32 evtset[8]; 29 - u32 evtclr[8]; 30 - u32 reserved0[8]; 31 - u32 evtmask[8]; 32 - u32 mevtflag[8]; 33 - u32 expmask[8]; 34 - u32 mexpflag[8]; 35 - u32 intmux_unused; 36 - u32 intmux[7]; 37 - u32 reserved1[8]; 38 - u32 aegmux[2]; 39 - u32 reserved2[14]; 40 - u32 intxstat; 41 - u32 intxclr; 42 - u32 intdmask; 43 - u32 reserved3[13]; 44 - u32 evtasrt; 45 - }; 46 - 47 - struct megamod_pic { 48 - struct irq_domain *irqhost; 49 - struct megamod_regs __iomem *regs; 50 - raw_spinlock_t lock; 51 - 52 - /* hw mux mapping */ 53 - unsigned int output_to_irq[NR_MUX_OUTPUTS]; 54 - }; 55 - 56 - static struct megamod_pic *mm_pic; 57 - 58 - struct megamod_cascade_data { 59 - struct megamod_pic *pic; 60 - int index; 61 - }; 62 - 63 - static struct megamod_cascade_data cascade_data[NR_COMBINERS]; 64 - 65 - static void mask_megamod(struct irq_data *data) 66 - { 67 - struct megamod_pic *pic = irq_data_get_irq_chip_data(data); 68 - irq_hw_number_t src = irqd_to_hwirq(data); 69 - u32 __iomem *evtmask = &pic->regs->evtmask[src / 32]; 70 - 71 - raw_spin_lock(&pic->lock); 72 - soc_writel(soc_readl(evtmask) | (1 << (src & 31)), evtmask); 73 - raw_spin_unlock(&pic->lock); 74 - } 75 - 76 - static void unmask_megamod(struct irq_data *data) 77 - { 78 - struct megamod_pic *pic = irq_data_get_irq_chip_data(data); 79 - irq_hw_number_t src = irqd_to_hwirq(data); 80 - u32 __iomem *evtmask = &pic->regs->evtmask[src / 32]; 81 - 82 - raw_spin_lock(&pic->lock); 83 - soc_writel(soc_readl(evtmask) & ~(1 << (src & 31)), evtmask); 84 - raw_spin_unlock(&pic->lock); 85 - } 86 - 87 - static struct irq_chip megamod_chip = { 88 - .name = "megamod", 89 - .irq_mask = mask_megamod, 90 - .irq_unmask = unmask_megamod, 91 - }; 92 - 93 - static void megamod_irq_cascade(struct irq_desc *desc) 94 - { 95 - struct megamod_cascade_data *cascade; 96 - struct megamod_pic *pic; 97 - unsigned int irq; 98 - u32 events; 99 - int n, idx; 100 - 101 - cascade = irq_desc_get_handler_data(desc); 102 - 103 - pic = cascade->pic; 104 - idx = cascade->index; 105 - 106 - while ((events = soc_readl(&pic->regs->mevtflag[idx])) != 0) { 107 - n = __ffs(events); 108 - 109 - irq = irq_linear_revmap(pic->irqhost, idx * 32 + n); 110 - 111 - soc_writel(1 << n, &pic->regs->evtclr[idx]); 112 - 113 - generic_handle_irq(irq); 114 - } 115 - } 116 - 117 - static int megamod_map(struct irq_domain *h, unsigned int virq, 118 - irq_hw_number_t hw) 119 - { 120 - struct megamod_pic *pic = h->host_data; 121 - int i; 122 - 123 - /* We shouldn't see a hwirq which is muxed to core controller */ 124 - for (i = 0; i < NR_MUX_OUTPUTS; i++) 125 - if (pic->output_to_irq[i] == hw) 126 - return -1; 127 - 128 - irq_set_chip_data(virq, pic); 129 - irq_set_chip_and_handler(virq, &megamod_chip, handle_level_irq); 130 - 131 - /* Set default irq type */ 132 - irq_set_irq_type(virq, IRQ_TYPE_NONE); 133 - 134 - return 0; 135 - } 136 - 137 - static const struct irq_domain_ops megamod_domain_ops = { 138 - .map = megamod_map, 139 - .xlate = irq_domain_xlate_onecell, 140 - }; 141 - 142 - static void __init set_megamod_mux(struct megamod_pic *pic, int src, int output) 143 - { 144 - int index, offset; 145 - u32 val; 146 - 147 - if (src < 0 || src >= (NR_COMBINERS * 32)) { 148 - pic->output_to_irq[output] = IRQ_UNMAPPED; 149 - return; 150 - } 151 - 152 - /* four mappings per mux register */ 153 - index = output / 4; 154 - offset = (output & 3) * 8; 155 - 156 - val = soc_readl(&pic->regs->intmux[index]); 157 - val &= ~(0xff << offset); 158 - val |= src << offset; 159 - soc_writel(val, &pic->regs->intmux[index]); 160 - } 161 - 162 - /* 163 - * Parse the MUX mapping, if one exists. 164 - * 165 - * The MUX map is an array of up to 12 cells; one for each usable core priority 166 - * interrupt. The value of a given cell is the megamodule interrupt source 167 - * which is to me MUXed to the output corresponding to the cell position 168 - * withing the array. The first cell in the array corresponds to priority 169 - * 4 and the last (12th) cell corresponds to priority 15. The allowed 170 - * values are 4 - ((NR_COMBINERS * 32) - 1). Note that the combined interrupt 171 - * sources (0 - 3) are not allowed to be mapped through this property. They 172 - * are handled through the "interrupts" property. This allows us to use a 173 - * value of zero as a "do not map" placeholder. 174 - */ 175 - static void __init parse_priority_map(struct megamod_pic *pic, 176 - int *mapping, int size) 177 - { 178 - struct device_node *np = irq_domain_get_of_node(pic->irqhost); 179 - const __be32 *map; 180 - int i, maplen; 181 - u32 val; 182 - 183 - map = of_get_property(np, "ti,c64x+megamod-pic-mux", &maplen); 184 - if (map) { 185 - maplen /= 4; 186 - if (maplen > size) 187 - maplen = size; 188 - 189 - for (i = 0; i < maplen; i++) { 190 - val = be32_to_cpup(map); 191 - if (val && val >= 4) 192 - mapping[i] = val; 193 - ++map; 194 - } 195 - } 196 - } 197 - 198 - static struct megamod_pic * __init init_megamod_pic(struct device_node *np) 199 - { 200 - struct megamod_pic *pic; 201 - int i, irq; 202 - int mapping[NR_MUX_OUTPUTS]; 203 - 204 - pr_info("Initializing C64x+ Megamodule PIC\n"); 205 - 206 - pic = kzalloc(sizeof(struct megamod_pic), GFP_KERNEL); 207 - if (!pic) { 208 - pr_err("%pOF: Could not alloc PIC structure.\n", np); 209 - return NULL; 210 - } 211 - 212 - pic->irqhost = irq_domain_add_linear(np, NR_COMBINERS * 32, 213 - &megamod_domain_ops, pic); 214 - if (!pic->irqhost) { 215 - pr_err("%pOF: Could not alloc host.\n", np); 216 - goto error_free; 217 - } 218 - 219 - pic->irqhost->host_data = pic; 220 - 221 - raw_spin_lock_init(&pic->lock); 222 - 223 - pic->regs = of_iomap(np, 0); 224 - if (!pic->regs) { 225 - pr_err("%pOF: Could not map registers.\n", np); 226 - goto error_free; 227 - } 228 - 229 - /* Initialize MUX map */ 230 - for (i = 0; i < ARRAY_SIZE(mapping); i++) 231 - mapping[i] = IRQ_UNMAPPED; 232 - 233 - parse_priority_map(pic, mapping, ARRAY_SIZE(mapping)); 234 - 235 - /* 236 - * We can have up to 12 interrupts cascading to the core controller. 237 - * These cascades can be from the combined interrupt sources or for 238 - * individual interrupt sources. The "interrupts" property only 239 - * deals with the cascaded combined interrupts. The individual 240 - * interrupts muxed to the core controller use the core controller 241 - * as their interrupt parent. 242 - */ 243 - for (i = 0; i < NR_COMBINERS; i++) { 244 - struct irq_data *irq_data; 245 - irq_hw_number_t hwirq; 246 - 247 - irq = irq_of_parse_and_map(np, i); 248 - if (irq == NO_IRQ) 249 - continue; 250 - 251 - irq_data = irq_get_irq_data(irq); 252 - if (!irq_data) { 253 - pr_err("%pOF: combiner-%d no irq_data for virq %d!\n", 254 - np, i, irq); 255 - continue; 256 - } 257 - 258 - hwirq = irq_data->hwirq; 259 - 260 - /* 261 - * Check that device tree provided something in the range 262 - * of the core priority interrupts (4 - 15). 263 - */ 264 - if (hwirq < 4 || hwirq >= NR_PRIORITY_IRQS) { 265 - pr_err("%pOF: combiner-%d core irq %ld out of range!\n", 266 - np, i, hwirq); 267 - continue; 268 - } 269 - 270 - /* record the mapping */ 271 - mapping[hwirq - 4] = i; 272 - 273 - pr_debug("%pOF: combiner-%d cascading to hwirq %ld\n", 274 - np, i, hwirq); 275 - 276 - cascade_data[i].pic = pic; 277 - cascade_data[i].index = i; 278 - 279 - /* mask and clear all events in combiner */ 280 - soc_writel(~0, &pic->regs->evtmask[i]); 281 - soc_writel(~0, &pic->regs->evtclr[i]); 282 - 283 - irq_set_chained_handler_and_data(irq, megamod_irq_cascade, 284 - &cascade_data[i]); 285 - } 286 - 287 - /* Finally, set up the MUX registers */ 288 - for (i = 0; i < NR_MUX_OUTPUTS; i++) { 289 - if (mapping[i] != IRQ_UNMAPPED) { 290 - pr_debug("%pOF: setting mux %d to priority %d\n", 291 - np, mapping[i], i + 4); 292 - set_megamod_mux(pic, mapping[i], i); 293 - } 294 - } 295 - 296 - return pic; 297 - 298 - error_free: 299 - kfree(pic); 300 - 301 - return NULL; 302 - } 303 - 304 - /* 305 - * Return next active event after ACK'ing it. 306 - * Return -1 if no events active. 307 - */ 308 - static int get_exception(void) 309 - { 310 - int i, bit; 311 - u32 mask; 312 - 313 - for (i = 0; i < NR_COMBINERS; i++) { 314 - mask = soc_readl(&mm_pic->regs->mexpflag[i]); 315 - if (mask) { 316 - bit = __ffs(mask); 317 - soc_writel(1 << bit, &mm_pic->regs->evtclr[i]); 318 - return (i * 32) + bit; 319 - } 320 - } 321 - return -1; 322 - } 323 - 324 - static void assert_event(unsigned int val) 325 - { 326 - soc_writel(val, &mm_pic->regs->evtasrt); 327 - } 328 - 329 - void __init megamod_pic_init(void) 330 - { 331 - struct device_node *np; 332 - 333 - np = of_find_compatible_node(NULL, NULL, "ti,c64x+megamod-pic"); 334 - if (!np) 335 - return; 336 - 337 - mm_pic = init_megamod_pic(np); 338 - of_node_put(np); 339 - 340 - soc_ops.get_exception = get_exception; 341 - soc_ops.assert_event = assert_event; 342 - 343 - return; 344 - }
-440
arch/c6x/platforms/pll.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * Clock and PLL control for C64x+ devices 4 - * 5 - * Copyright (C) 2010, 2011 Texas Instruments. 6 - * Contributed by: Mark Salter <msalter@redhat.com> 7 - * 8 - * Copied heavily from arm/mach-davinci/clock.c, so: 9 - * 10 - * Copyright (C) 2006-2007 Texas Instruments. 11 - * Copyright (C) 2008-2009 Deep Root Systems, LLC 12 - */ 13 - 14 - #include <linux/module.h> 15 - #include <linux/clkdev.h> 16 - #include <linux/clk.h> 17 - #include <linux/io.h> 18 - #include <linux/err.h> 19 - 20 - #include <asm/clock.h> 21 - #include <asm/soc.h> 22 - 23 - static LIST_HEAD(clocks); 24 - static DEFINE_MUTEX(clocks_mutex); 25 - static DEFINE_SPINLOCK(clockfw_lock); 26 - 27 - static void __clk_enable(struct clk *clk) 28 - { 29 - if (clk->parent) 30 - __clk_enable(clk->parent); 31 - clk->usecount++; 32 - } 33 - 34 - static void __clk_disable(struct clk *clk) 35 - { 36 - if (WARN_ON(clk->usecount == 0)) 37 - return; 38 - --clk->usecount; 39 - 40 - if (clk->parent) 41 - __clk_disable(clk->parent); 42 - } 43 - 44 - int clk_enable(struct clk *clk) 45 - { 46 - unsigned long flags; 47 - 48 - if (clk == NULL || IS_ERR(clk)) 49 - return -EINVAL; 50 - 51 - spin_lock_irqsave(&clockfw_lock, flags); 52 - __clk_enable(clk); 53 - spin_unlock_irqrestore(&clockfw_lock, flags); 54 - 55 - return 0; 56 - } 57 - EXPORT_SYMBOL(clk_enable); 58 - 59 - void clk_disable(struct clk *clk) 60 - { 61 - unsigned long flags; 62 - 63 - if (clk == NULL || IS_ERR(clk)) 64 - return; 65 - 66 - spin_lock_irqsave(&clockfw_lock, flags); 67 - __clk_disable(clk); 68 - spin_unlock_irqrestore(&clockfw_lock, flags); 69 - } 70 - EXPORT_SYMBOL(clk_disable); 71 - 72 - unsigned long clk_get_rate(struct clk *clk) 73 - { 74 - if (clk == NULL || IS_ERR(clk)) 75 - return -EINVAL; 76 - 77 - return clk->rate; 78 - } 79 - EXPORT_SYMBOL(clk_get_rate); 80 - 81 - long clk_round_rate(struct clk *clk, unsigned long rate) 82 - { 83 - if (clk == NULL || IS_ERR(clk)) 84 - return -EINVAL; 85 - 86 - if (clk->round_rate) 87 - return clk->round_rate(clk, rate); 88 - 89 - return clk->rate; 90 - } 91 - EXPORT_SYMBOL(clk_round_rate); 92 - 93 - /* Propagate rate to children */ 94 - static void propagate_rate(struct clk *root) 95 - { 96 - struct clk *clk; 97 - 98 - list_for_each_entry(clk, &root->children, childnode) { 99 - if (clk->recalc) 100 - clk->rate = clk->recalc(clk); 101 - propagate_rate(clk); 102 - } 103 - } 104 - 105 - int clk_set_rate(struct clk *clk, unsigned long rate) 106 - { 107 - unsigned long flags; 108 - int ret = -EINVAL; 109 - 110 - if (clk == NULL || IS_ERR(clk)) 111 - return ret; 112 - 113 - if (clk->set_rate) 114 - ret = clk->set_rate(clk, rate); 115 - 116 - spin_lock_irqsave(&clockfw_lock, flags); 117 - if (ret == 0) { 118 - if (clk->recalc) 119 - clk->rate = clk->recalc(clk); 120 - propagate_rate(clk); 121 - } 122 - spin_unlock_irqrestore(&clockfw_lock, flags); 123 - 124 - return ret; 125 - } 126 - EXPORT_SYMBOL(clk_set_rate); 127 - 128 - int clk_set_parent(struct clk *clk, struct clk *parent) 129 - { 130 - unsigned long flags; 131 - 132 - if (clk == NULL || IS_ERR(clk)) 133 - return -EINVAL; 134 - 135 - /* Cannot change parent on enabled clock */ 136 - if (WARN_ON(clk->usecount)) 137 - return -EINVAL; 138 - 139 - mutex_lock(&clocks_mutex); 140 - clk->parent = parent; 141 - list_del_init(&clk->childnode); 142 - list_add(&clk->childnode, &clk->parent->children); 143 - mutex_unlock(&clocks_mutex); 144 - 145 - spin_lock_irqsave(&clockfw_lock, flags); 146 - if (clk->recalc) 147 - clk->rate = clk->recalc(clk); 148 - propagate_rate(clk); 149 - spin_unlock_irqrestore(&clockfw_lock, flags); 150 - 151 - return 0; 152 - } 153 - EXPORT_SYMBOL(clk_set_parent); 154 - 155 - int clk_register(struct clk *clk) 156 - { 157 - if (clk == NULL || IS_ERR(clk)) 158 - return -EINVAL; 159 - 160 - if (WARN(clk->parent && !clk->parent->rate, 161 - "CLK: %s parent %s has no rate!\n", 162 - clk->name, clk->parent->name)) 163 - return -EINVAL; 164 - 165 - mutex_lock(&clocks_mutex); 166 - list_add_tail(&clk->node, &clocks); 167 - if (clk->parent) 168 - list_add_tail(&clk->childnode, &clk->parent->children); 169 - mutex_unlock(&clocks_mutex); 170 - 171 - /* If rate is already set, use it */ 172 - if (clk->rate) 173 - return 0; 174 - 175 - /* Else, see if there is a way to calculate it */ 176 - if (clk->recalc) 177 - clk->rate = clk->recalc(clk); 178 - 179 - /* Otherwise, default to parent rate */ 180 - else if (clk->parent) 181 - clk->rate = clk->parent->rate; 182 - 183 - return 0; 184 - } 185 - EXPORT_SYMBOL(clk_register); 186 - 187 - void clk_unregister(struct clk *clk) 188 - { 189 - if (clk == NULL || IS_ERR(clk)) 190 - return; 191 - 192 - mutex_lock(&clocks_mutex); 193 - list_del(&clk->node); 194 - list_del(&clk->childnode); 195 - mutex_unlock(&clocks_mutex); 196 - } 197 - EXPORT_SYMBOL(clk_unregister); 198 - 199 - 200 - static u32 pll_read(struct pll_data *pll, int reg) 201 - { 202 - return soc_readl(pll->base + reg); 203 - } 204 - 205 - static unsigned long clk_sysclk_recalc(struct clk *clk) 206 - { 207 - u32 v, plldiv = 0; 208 - struct pll_data *pll; 209 - unsigned long rate = clk->rate; 210 - 211 - if (WARN_ON(!clk->parent)) 212 - return rate; 213 - 214 - rate = clk->parent->rate; 215 - 216 - /* the parent must be a PLL */ 217 - if (WARN_ON(!clk->parent->pll_data)) 218 - return rate; 219 - 220 - pll = clk->parent->pll_data; 221 - 222 - /* If pre-PLL, source clock is before the multiplier and divider(s) */ 223 - if (clk->flags & PRE_PLL) 224 - rate = pll->input_rate; 225 - 226 - if (!clk->div) { 227 - pr_debug("%s: (no divider) rate = %lu KHz\n", 228 - clk->name, rate / 1000); 229 - return rate; 230 - } 231 - 232 - if (clk->flags & FIXED_DIV_PLL) { 233 - rate /= clk->div; 234 - pr_debug("%s: (fixed divide by %d) rate = %lu KHz\n", 235 - clk->name, clk->div, rate / 1000); 236 - return rate; 237 - } 238 - 239 - v = pll_read(pll, clk->div); 240 - if (v & PLLDIV_EN) 241 - plldiv = (v & PLLDIV_RATIO_MASK) + 1; 242 - 243 - if (plldiv == 0) 244 - plldiv = 1; 245 - 246 - rate /= plldiv; 247 - 248 - pr_debug("%s: (divide by %d) rate = %lu KHz\n", 249 - clk->name, plldiv, rate / 1000); 250 - 251 - return rate; 252 - } 253 - 254 - static unsigned long clk_leafclk_recalc(struct clk *clk) 255 - { 256 - if (WARN_ON(!clk->parent)) 257 - return clk->rate; 258 - 259 - pr_debug("%s: (parent %s) rate = %lu KHz\n", 260 - clk->name, clk->parent->name, clk->parent->rate / 1000); 261 - 262 - return clk->parent->rate; 263 - } 264 - 265 - static unsigned long clk_pllclk_recalc(struct clk *clk) 266 - { 267 - u32 ctrl, mult = 0, prediv = 0, postdiv = 0; 268 - u8 bypass; 269 - struct pll_data *pll = clk->pll_data; 270 - unsigned long rate = clk->rate; 271 - 272 - if (clk->flags & FIXED_RATE_PLL) 273 - return rate; 274 - 275 - ctrl = pll_read(pll, PLLCTL); 276 - rate = pll->input_rate = clk->parent->rate; 277 - 278 - if (ctrl & PLLCTL_PLLEN) 279 - bypass = 0; 280 - else 281 - bypass = 1; 282 - 283 - if (pll->flags & PLL_HAS_MUL) { 284 - mult = pll_read(pll, PLLM); 285 - mult = (mult & PLLM_PLLM_MASK) + 1; 286 - } 287 - if (pll->flags & PLL_HAS_PRE) { 288 - prediv = pll_read(pll, PLLPRE); 289 - if (prediv & PLLDIV_EN) 290 - prediv = (prediv & PLLDIV_RATIO_MASK) + 1; 291 - else 292 - prediv = 0; 293 - } 294 - if (pll->flags & PLL_HAS_POST) { 295 - postdiv = pll_read(pll, PLLPOST); 296 - if (postdiv & PLLDIV_EN) 297 - postdiv = (postdiv & PLLDIV_RATIO_MASK) + 1; 298 - else 299 - postdiv = 1; 300 - } 301 - 302 - if (!bypass) { 303 - if (prediv) 304 - rate /= prediv; 305 - if (mult) 306 - rate *= mult; 307 - if (postdiv) 308 - rate /= postdiv; 309 - 310 - pr_debug("PLL%d: input = %luMHz, pre[%d] mul[%d] post[%d] " 311 - "--> %luMHz output.\n", 312 - pll->num, clk->parent->rate / 1000000, 313 - prediv, mult, postdiv, rate / 1000000); 314 - } else 315 - pr_debug("PLL%d: input = %luMHz, bypass mode.\n", 316 - pll->num, clk->parent->rate / 1000000); 317 - 318 - return rate; 319 - } 320 - 321 - 322 - static void __init __init_clk(struct clk *clk) 323 - { 324 - INIT_LIST_HEAD(&clk->node); 325 - INIT_LIST_HEAD(&clk->children); 326 - INIT_LIST_HEAD(&clk->childnode); 327 - 328 - if (!clk->recalc) { 329 - 330 - /* Check if clock is a PLL */ 331 - if (clk->pll_data) 332 - clk->recalc = clk_pllclk_recalc; 333 - 334 - /* Else, if it is a PLL-derived clock */ 335 - else if (clk->flags & CLK_PLL) 336 - clk->recalc = clk_sysclk_recalc; 337 - 338 - /* Otherwise, it is a leaf clock (PSC clock) */ 339 - else if (clk->parent) 340 - clk->recalc = clk_leafclk_recalc; 341 - } 342 - } 343 - 344 - void __init c6x_clks_init(struct clk_lookup *clocks) 345 - { 346 - struct clk_lookup *c; 347 - struct clk *clk; 348 - size_t num_clocks = 0; 349 - 350 - for (c = clocks; c->clk; c++) { 351 - clk = c->clk; 352 - 353 - __init_clk(clk); 354 - clk_register(clk); 355 - num_clocks++; 356 - 357 - /* Turn on clocks that Linux doesn't otherwise manage */ 358 - if (clk->flags & ALWAYS_ENABLED) 359 - clk_enable(clk); 360 - } 361 - 362 - clkdev_add_table(clocks, num_clocks); 363 - } 364 - 365 - #ifdef CONFIG_DEBUG_FS 366 - 367 - #include <linux/debugfs.h> 368 - #include <linux/seq_file.h> 369 - 370 - #define CLKNAME_MAX 10 /* longest clock name */ 371 - #define NEST_DELTA 2 372 - #define NEST_MAX 4 373 - 374 - static void 375 - dump_clock(struct seq_file *s, unsigned nest, struct clk *parent) 376 - { 377 - char *state; 378 - char buf[CLKNAME_MAX + NEST_DELTA * NEST_MAX]; 379 - struct clk *clk; 380 - unsigned i; 381 - 382 - if (parent->flags & CLK_PLL) 383 - state = "pll"; 384 - else 385 - state = ""; 386 - 387 - /* <nest spaces> name <pad to end> */ 388 - memset(buf, ' ', sizeof(buf) - 1); 389 - buf[sizeof(buf) - 1] = 0; 390 - i = strlen(parent->name); 391 - memcpy(buf + nest, parent->name, 392 - min(i, (unsigned)(sizeof(buf) - 1 - nest))); 393 - 394 - seq_printf(s, "%s users=%2d %-3s %9ld Hz\n", 395 - buf, parent->usecount, state, clk_get_rate(parent)); 396 - /* REVISIT show device associations too */ 397 - 398 - /* cost is now small, but not linear... */ 399 - list_for_each_entry(clk, &parent->children, childnode) { 400 - dump_clock(s, nest + NEST_DELTA, clk); 401 - } 402 - } 403 - 404 - static int c6x_ck_show(struct seq_file *m, void *v) 405 - { 406 - struct clk *clk; 407 - 408 - /* 409 - * Show clock tree; We trust nonzero usecounts equate to PSC enables... 410 - */ 411 - mutex_lock(&clocks_mutex); 412 - list_for_each_entry(clk, &clocks, node) 413 - if (!clk->parent) 414 - dump_clock(m, 0, clk); 415 - mutex_unlock(&clocks_mutex); 416 - 417 - return 0; 418 - } 419 - 420 - static int c6x_ck_open(struct inode *inode, struct file *file) 421 - { 422 - return single_open(file, c6x_ck_show, NULL); 423 - } 424 - 425 - static const struct file_operations c6x_ck_operations = { 426 - .open = c6x_ck_open, 427 - .read = seq_read, 428 - .llseek = seq_lseek, 429 - .release = single_release, 430 - }; 431 - 432 - static int __init c6x_clk_debugfs_init(void) 433 - { 434 - debugfs_create_file("c6x_clocks", S_IFREG | S_IRUGO, NULL, NULL, 435 - &c6x_ck_operations); 436 - 437 - return 0; 438 - } 439 - device_initcall(c6x_clk_debugfs_init); 440 - #endif /* CONFIG_DEBUG_FS */
-467
arch/c6x/platforms/plldata.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Port on Texas Instruments TMS320C6x architecture 4 - * 5 - * Copyright (C) 2011 Texas Instruments Incorporated 6 - * Author: Mark Salter <msalter@redhat.com> 7 - */ 8 - #include <linux/kernel.h> 9 - #include <linux/delay.h> 10 - #include <linux/errno.h> 11 - #include <linux/string.h> 12 - #include <linux/ioport.h> 13 - #include <linux/clkdev.h> 14 - #include <linux/of.h> 15 - #include <linux/of_address.h> 16 - 17 - #include <asm/clock.h> 18 - #include <asm/setup.h> 19 - #include <asm/special_insns.h> 20 - #include <asm/irq.h> 21 - 22 - /* 23 - * Common SoC clock support. 24 - */ 25 - 26 - /* Default input for PLL1 */ 27 - struct clk clkin1 = { 28 - .name = "clkin1", 29 - .node = LIST_HEAD_INIT(clkin1.node), 30 - .children = LIST_HEAD_INIT(clkin1.children), 31 - .childnode = LIST_HEAD_INIT(clkin1.childnode), 32 - }; 33 - 34 - struct pll_data c6x_soc_pll1 = { 35 - .num = 1, 36 - .sysclks = { 37 - { 38 - .name = "pll1", 39 - .parent = &clkin1, 40 - .pll_data = &c6x_soc_pll1, 41 - .flags = CLK_PLL, 42 - }, 43 - { 44 - .name = "pll1_sysclk1", 45 - .parent = &c6x_soc_pll1.sysclks[0], 46 - .flags = CLK_PLL, 47 - }, 48 - { 49 - .name = "pll1_sysclk2", 50 - .parent = &c6x_soc_pll1.sysclks[0], 51 - .flags = CLK_PLL, 52 - }, 53 - { 54 - .name = "pll1_sysclk3", 55 - .parent = &c6x_soc_pll1.sysclks[0], 56 - .flags = CLK_PLL, 57 - }, 58 - { 59 - .name = "pll1_sysclk4", 60 - .parent = &c6x_soc_pll1.sysclks[0], 61 - .flags = CLK_PLL, 62 - }, 63 - { 64 - .name = "pll1_sysclk5", 65 - .parent = &c6x_soc_pll1.sysclks[0], 66 - .flags = CLK_PLL, 67 - }, 68 - { 69 - .name = "pll1_sysclk6", 70 - .parent = &c6x_soc_pll1.sysclks[0], 71 - .flags = CLK_PLL, 72 - }, 73 - { 74 - .name = "pll1_sysclk7", 75 - .parent = &c6x_soc_pll1.sysclks[0], 76 - .flags = CLK_PLL, 77 - }, 78 - { 79 - .name = "pll1_sysclk8", 80 - .parent = &c6x_soc_pll1.sysclks[0], 81 - .flags = CLK_PLL, 82 - }, 83 - { 84 - .name = "pll1_sysclk9", 85 - .parent = &c6x_soc_pll1.sysclks[0], 86 - .flags = CLK_PLL, 87 - }, 88 - { 89 - .name = "pll1_sysclk10", 90 - .parent = &c6x_soc_pll1.sysclks[0], 91 - .flags = CLK_PLL, 92 - }, 93 - { 94 - .name = "pll1_sysclk11", 95 - .parent = &c6x_soc_pll1.sysclks[0], 96 - .flags = CLK_PLL, 97 - }, 98 - { 99 - .name = "pll1_sysclk12", 100 - .parent = &c6x_soc_pll1.sysclks[0], 101 - .flags = CLK_PLL, 102 - }, 103 - { 104 - .name = "pll1_sysclk13", 105 - .parent = &c6x_soc_pll1.sysclks[0], 106 - .flags = CLK_PLL, 107 - }, 108 - { 109 - .name = "pll1_sysclk14", 110 - .parent = &c6x_soc_pll1.sysclks[0], 111 - .flags = CLK_PLL, 112 - }, 113 - { 114 - .name = "pll1_sysclk15", 115 - .parent = &c6x_soc_pll1.sysclks[0], 116 - .flags = CLK_PLL, 117 - }, 118 - { 119 - .name = "pll1_sysclk16", 120 - .parent = &c6x_soc_pll1.sysclks[0], 121 - .flags = CLK_PLL, 122 - }, 123 - }, 124 - }; 125 - 126 - /* CPU core clock */ 127 - struct clk c6x_core_clk = { 128 - .name = "core", 129 - }; 130 - 131 - /* miscellaneous IO clocks */ 132 - struct clk c6x_i2c_clk = { 133 - .name = "i2c", 134 - }; 135 - 136 - struct clk c6x_watchdog_clk = { 137 - .name = "watchdog", 138 - }; 139 - 140 - struct clk c6x_mcbsp1_clk = { 141 - .name = "mcbsp1", 142 - }; 143 - 144 - struct clk c6x_mcbsp2_clk = { 145 - .name = "mcbsp2", 146 - }; 147 - 148 - struct clk c6x_mdio_clk = { 149 - .name = "mdio", 150 - }; 151 - 152 - 153 - #ifdef CONFIG_SOC_TMS320C6455 154 - static struct clk_lookup c6455_clks[] = { 155 - CLK(NULL, "pll1", &c6x_soc_pll1.sysclks[0]), 156 - CLK(NULL, "pll1_sysclk2", &c6x_soc_pll1.sysclks[2]), 157 - CLK(NULL, "pll1_sysclk3", &c6x_soc_pll1.sysclks[3]), 158 - CLK(NULL, "pll1_sysclk4", &c6x_soc_pll1.sysclks[4]), 159 - CLK(NULL, "pll1_sysclk5", &c6x_soc_pll1.sysclks[5]), 160 - CLK(NULL, "core", &c6x_core_clk), 161 - CLK("i2c_davinci.1", NULL, &c6x_i2c_clk), 162 - CLK("watchdog", NULL, &c6x_watchdog_clk), 163 - CLK("2c81800.mdio", NULL, &c6x_mdio_clk), 164 - CLK("", NULL, NULL) 165 - }; 166 - 167 - 168 - static void __init c6455_setup_clocks(struct device_node *node) 169 - { 170 - struct pll_data *pll = &c6x_soc_pll1; 171 - struct clk *sysclks = pll->sysclks; 172 - 173 - pll->flags = PLL_HAS_PRE | PLL_HAS_MUL; 174 - 175 - sysclks[2].flags |= FIXED_DIV_PLL; 176 - sysclks[2].div = 3; 177 - sysclks[3].flags |= FIXED_DIV_PLL; 178 - sysclks[3].div = 6; 179 - sysclks[4].div = PLLDIV4; 180 - sysclks[5].div = PLLDIV5; 181 - 182 - c6x_core_clk.parent = &sysclks[0]; 183 - c6x_i2c_clk.parent = &sysclks[3]; 184 - c6x_watchdog_clk.parent = &sysclks[3]; 185 - c6x_mdio_clk.parent = &sysclks[3]; 186 - 187 - c6x_clks_init(c6455_clks); 188 - } 189 - #endif /* CONFIG_SOC_TMS320C6455 */ 190 - 191 - #ifdef CONFIG_SOC_TMS320C6457 192 - static struct clk_lookup c6457_clks[] = { 193 - CLK(NULL, "pll1", &c6x_soc_pll1.sysclks[0]), 194 - CLK(NULL, "pll1_sysclk1", &c6x_soc_pll1.sysclks[1]), 195 - CLK(NULL, "pll1_sysclk2", &c6x_soc_pll1.sysclks[2]), 196 - CLK(NULL, "pll1_sysclk3", &c6x_soc_pll1.sysclks[3]), 197 - CLK(NULL, "pll1_sysclk4", &c6x_soc_pll1.sysclks[4]), 198 - CLK(NULL, "pll1_sysclk5", &c6x_soc_pll1.sysclks[5]), 199 - CLK(NULL, "core", &c6x_core_clk), 200 - CLK("i2c_davinci.1", NULL, &c6x_i2c_clk), 201 - CLK("watchdog", NULL, &c6x_watchdog_clk), 202 - CLK("2c81800.mdio", NULL, &c6x_mdio_clk), 203 - CLK("", NULL, NULL) 204 - }; 205 - 206 - static void __init c6457_setup_clocks(struct device_node *node) 207 - { 208 - struct pll_data *pll = &c6x_soc_pll1; 209 - struct clk *sysclks = pll->sysclks; 210 - 211 - pll->flags = PLL_HAS_MUL | PLL_HAS_POST; 212 - 213 - sysclks[1].flags |= FIXED_DIV_PLL; 214 - sysclks[1].div = 1; 215 - sysclks[2].flags |= FIXED_DIV_PLL; 216 - sysclks[2].div = 3; 217 - sysclks[3].flags |= FIXED_DIV_PLL; 218 - sysclks[3].div = 6; 219 - sysclks[4].div = PLLDIV4; 220 - sysclks[5].div = PLLDIV5; 221 - 222 - c6x_core_clk.parent = &sysclks[1]; 223 - c6x_i2c_clk.parent = &sysclks[3]; 224 - c6x_watchdog_clk.parent = &sysclks[5]; 225 - c6x_mdio_clk.parent = &sysclks[5]; 226 - 227 - c6x_clks_init(c6457_clks); 228 - } 229 - #endif /* CONFIG_SOC_TMS320C6455 */ 230 - 231 - #ifdef CONFIG_SOC_TMS320C6472 232 - static struct clk_lookup c6472_clks[] = { 233 - CLK(NULL, "pll1", &c6x_soc_pll1.sysclks[0]), 234 - CLK(NULL, "pll1_sysclk1", &c6x_soc_pll1.sysclks[1]), 235 - CLK(NULL, "pll1_sysclk2", &c6x_soc_pll1.sysclks[2]), 236 - CLK(NULL, "pll1_sysclk3", &c6x_soc_pll1.sysclks[3]), 237 - CLK(NULL, "pll1_sysclk4", &c6x_soc_pll1.sysclks[4]), 238 - CLK(NULL, "pll1_sysclk5", &c6x_soc_pll1.sysclks[5]), 239 - CLK(NULL, "pll1_sysclk6", &c6x_soc_pll1.sysclks[6]), 240 - CLK(NULL, "pll1_sysclk7", &c6x_soc_pll1.sysclks[7]), 241 - CLK(NULL, "pll1_sysclk8", &c6x_soc_pll1.sysclks[8]), 242 - CLK(NULL, "pll1_sysclk9", &c6x_soc_pll1.sysclks[9]), 243 - CLK(NULL, "pll1_sysclk10", &c6x_soc_pll1.sysclks[10]), 244 - CLK(NULL, "core", &c6x_core_clk), 245 - CLK("i2c_davinci.1", NULL, &c6x_i2c_clk), 246 - CLK("watchdog", NULL, &c6x_watchdog_clk), 247 - CLK("2c81800.mdio", NULL, &c6x_mdio_clk), 248 - CLK("", NULL, NULL) 249 - }; 250 - 251 - /* assumptions used for delay loop calculations */ 252 - #define MIN_CLKIN1_KHz 15625 253 - #define MAX_CORE_KHz 700000 254 - #define MIN_PLLOUT_KHz MIN_CLKIN1_KHz 255 - 256 - static void __init c6472_setup_clocks(struct device_node *node) 257 - { 258 - struct pll_data *pll = &c6x_soc_pll1; 259 - struct clk *sysclks = pll->sysclks; 260 - int i; 261 - 262 - pll->flags = PLL_HAS_MUL; 263 - 264 - for (i = 1; i <= 6; i++) { 265 - sysclks[i].flags |= FIXED_DIV_PLL; 266 - sysclks[i].div = 1; 267 - } 268 - 269 - sysclks[7].flags |= FIXED_DIV_PLL; 270 - sysclks[7].div = 3; 271 - sysclks[8].flags |= FIXED_DIV_PLL; 272 - sysclks[8].div = 6; 273 - sysclks[9].flags |= FIXED_DIV_PLL; 274 - sysclks[9].div = 2; 275 - sysclks[10].div = PLLDIV10; 276 - 277 - c6x_core_clk.parent = &sysclks[get_coreid() + 1]; 278 - c6x_i2c_clk.parent = &sysclks[8]; 279 - c6x_watchdog_clk.parent = &sysclks[8]; 280 - c6x_mdio_clk.parent = &sysclks[5]; 281 - 282 - c6x_clks_init(c6472_clks); 283 - } 284 - #endif /* CONFIG_SOC_TMS320C6472 */ 285 - 286 - 287 - #ifdef CONFIG_SOC_TMS320C6474 288 - static struct clk_lookup c6474_clks[] = { 289 - CLK(NULL, "pll1", &c6x_soc_pll1.sysclks[0]), 290 - CLK(NULL, "pll1_sysclk7", &c6x_soc_pll1.sysclks[7]), 291 - CLK(NULL, "pll1_sysclk9", &c6x_soc_pll1.sysclks[9]), 292 - CLK(NULL, "pll1_sysclk10", &c6x_soc_pll1.sysclks[10]), 293 - CLK(NULL, "pll1_sysclk11", &c6x_soc_pll1.sysclks[11]), 294 - CLK(NULL, "pll1_sysclk12", &c6x_soc_pll1.sysclks[12]), 295 - CLK(NULL, "pll1_sysclk13", &c6x_soc_pll1.sysclks[13]), 296 - CLK(NULL, "core", &c6x_core_clk), 297 - CLK("i2c_davinci.1", NULL, &c6x_i2c_clk), 298 - CLK("mcbsp.1", NULL, &c6x_mcbsp1_clk), 299 - CLK("mcbsp.2", NULL, &c6x_mcbsp2_clk), 300 - CLK("watchdog", NULL, &c6x_watchdog_clk), 301 - CLK("2c81800.mdio", NULL, &c6x_mdio_clk), 302 - CLK("", NULL, NULL) 303 - }; 304 - 305 - static void __init c6474_setup_clocks(struct device_node *node) 306 - { 307 - struct pll_data *pll = &c6x_soc_pll1; 308 - struct clk *sysclks = pll->sysclks; 309 - 310 - pll->flags = PLL_HAS_MUL; 311 - 312 - sysclks[7].flags |= FIXED_DIV_PLL; 313 - sysclks[7].div = 1; 314 - sysclks[9].flags |= FIXED_DIV_PLL; 315 - sysclks[9].div = 3; 316 - sysclks[10].flags |= FIXED_DIV_PLL; 317 - sysclks[10].div = 6; 318 - 319 - sysclks[11].div = PLLDIV11; 320 - 321 - sysclks[12].flags |= FIXED_DIV_PLL; 322 - sysclks[12].div = 2; 323 - 324 - sysclks[13].div = PLLDIV13; 325 - 326 - c6x_core_clk.parent = &sysclks[7]; 327 - c6x_i2c_clk.parent = &sysclks[10]; 328 - c6x_watchdog_clk.parent = &sysclks[10]; 329 - c6x_mcbsp1_clk.parent = &sysclks[10]; 330 - c6x_mcbsp2_clk.parent = &sysclks[10]; 331 - 332 - c6x_clks_init(c6474_clks); 333 - } 334 - #endif /* CONFIG_SOC_TMS320C6474 */ 335 - 336 - #ifdef CONFIG_SOC_TMS320C6678 337 - static struct clk_lookup c6678_clks[] = { 338 - CLK(NULL, "pll1", &c6x_soc_pll1.sysclks[0]), 339 - CLK(NULL, "pll1_refclk", &c6x_soc_pll1.sysclks[1]), 340 - CLK(NULL, "pll1_sysclk2", &c6x_soc_pll1.sysclks[2]), 341 - CLK(NULL, "pll1_sysclk3", &c6x_soc_pll1.sysclks[3]), 342 - CLK(NULL, "pll1_sysclk4", &c6x_soc_pll1.sysclks[4]), 343 - CLK(NULL, "pll1_sysclk5", &c6x_soc_pll1.sysclks[5]), 344 - CLK(NULL, "pll1_sysclk6", &c6x_soc_pll1.sysclks[6]), 345 - CLK(NULL, "pll1_sysclk7", &c6x_soc_pll1.sysclks[7]), 346 - CLK(NULL, "pll1_sysclk8", &c6x_soc_pll1.sysclks[8]), 347 - CLK(NULL, "pll1_sysclk9", &c6x_soc_pll1.sysclks[9]), 348 - CLK(NULL, "pll1_sysclk10", &c6x_soc_pll1.sysclks[10]), 349 - CLK(NULL, "pll1_sysclk11", &c6x_soc_pll1.sysclks[11]), 350 - CLK(NULL, "core", &c6x_core_clk), 351 - CLK("", NULL, NULL) 352 - }; 353 - 354 - static void __init c6678_setup_clocks(struct device_node *node) 355 - { 356 - struct pll_data *pll = &c6x_soc_pll1; 357 - struct clk *sysclks = pll->sysclks; 358 - 359 - pll->flags = PLL_HAS_MUL; 360 - 361 - sysclks[1].flags |= FIXED_DIV_PLL; 362 - sysclks[1].div = 1; 363 - 364 - sysclks[2].div = PLLDIV2; 365 - 366 - sysclks[3].flags |= FIXED_DIV_PLL; 367 - sysclks[3].div = 2; 368 - 369 - sysclks[4].flags |= FIXED_DIV_PLL; 370 - sysclks[4].div = 3; 371 - 372 - sysclks[5].div = PLLDIV5; 373 - 374 - sysclks[6].flags |= FIXED_DIV_PLL; 375 - sysclks[6].div = 64; 376 - 377 - sysclks[7].flags |= FIXED_DIV_PLL; 378 - sysclks[7].div = 6; 379 - 380 - sysclks[8].div = PLLDIV8; 381 - 382 - sysclks[9].flags |= FIXED_DIV_PLL; 383 - sysclks[9].div = 12; 384 - 385 - sysclks[10].flags |= FIXED_DIV_PLL; 386 - sysclks[10].div = 3; 387 - 388 - sysclks[11].flags |= FIXED_DIV_PLL; 389 - sysclks[11].div = 6; 390 - 391 - c6x_core_clk.parent = &sysclks[0]; 392 - c6x_i2c_clk.parent = &sysclks[7]; 393 - 394 - c6x_clks_init(c6678_clks); 395 - } 396 - #endif /* CONFIG_SOC_TMS320C6678 */ 397 - 398 - static struct of_device_id c6x_clkc_match[] __initdata = { 399 - #ifdef CONFIG_SOC_TMS320C6455 400 - { .compatible = "ti,c6455-pll", .data = c6455_setup_clocks }, 401 - #endif 402 - #ifdef CONFIG_SOC_TMS320C6457 403 - { .compatible = "ti,c6457-pll", .data = c6457_setup_clocks }, 404 - #endif 405 - #ifdef CONFIG_SOC_TMS320C6472 406 - { .compatible = "ti,c6472-pll", .data = c6472_setup_clocks }, 407 - #endif 408 - #ifdef CONFIG_SOC_TMS320C6474 409 - { .compatible = "ti,c6474-pll", .data = c6474_setup_clocks }, 410 - #endif 411 - #ifdef CONFIG_SOC_TMS320C6678 412 - { .compatible = "ti,c6678-pll", .data = c6678_setup_clocks }, 413 - #endif 414 - { .compatible = "ti,c64x+pll" }, 415 - {} 416 - }; 417 - 418 - void __init c64x_setup_clocks(void) 419 - { 420 - void (*__setup_clocks)(struct device_node *np); 421 - struct pll_data *pll = &c6x_soc_pll1; 422 - struct device_node *node; 423 - const struct of_device_id *id; 424 - int err; 425 - u32 val; 426 - 427 - node = of_find_matching_node(NULL, c6x_clkc_match); 428 - if (!node) 429 - return; 430 - 431 - pll->base = of_iomap(node, 0); 432 - if (!pll->base) 433 - goto out; 434 - 435 - err = of_property_read_u32(node, "clock-frequency", &val); 436 - if (err || val == 0) { 437 - pr_err("%pOF: no clock-frequency found! Using %dMHz\n", 438 - node, (int)val / 1000000); 439 - val = 25000000; 440 - } 441 - clkin1.rate = val; 442 - 443 - err = of_property_read_u32(node, "ti,c64x+pll-bypass-delay", &val); 444 - if (err) 445 - val = 5000; 446 - pll->bypass_delay = val; 447 - 448 - err = of_property_read_u32(node, "ti,c64x+pll-reset-delay", &val); 449 - if (err) 450 - val = 30000; 451 - pll->reset_delay = val; 452 - 453 - err = of_property_read_u32(node, "ti,c64x+pll-lock-delay", &val); 454 - if (err) 455 - val = 30000; 456 - pll->lock_delay = val; 457 - 458 - /* id->data is a pointer to SoC-specific setup */ 459 - id = of_match_node(c6x_clkc_match, node); 460 - if (id && id->data) { 461 - __setup_clocks = id->data; 462 - __setup_clocks(node); 463 - } 464 - 465 - out: 466 - of_node_put(node); 467 - }
-241
arch/c6x/platforms/timer64.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Copyright (C) 2010, 2011 Texas Instruments Incorporated 4 - * Contributed by: Mark Salter (msalter@redhat.com) 5 - */ 6 - 7 - #include <linux/clockchips.h> 8 - #include <linux/interrupt.h> 9 - #include <linux/io.h> 10 - #include <linux/of.h> 11 - #include <linux/of_irq.h> 12 - #include <linux/of_address.h> 13 - #include <asm/soc.h> 14 - #include <asm/dscr.h> 15 - #include <asm/special_insns.h> 16 - #include <asm/timer64.h> 17 - 18 - struct timer_regs { 19 - u32 reserved0; 20 - u32 emumgt; 21 - u32 reserved1; 22 - u32 reserved2; 23 - u32 cntlo; 24 - u32 cnthi; 25 - u32 prdlo; 26 - u32 prdhi; 27 - u32 tcr; 28 - u32 tgcr; 29 - u32 wdtcr; 30 - }; 31 - 32 - static struct timer_regs __iomem *timer; 33 - 34 - #define TCR_TSTATLO 0x001 35 - #define TCR_INVOUTPLO 0x002 36 - #define TCR_INVINPLO 0x004 37 - #define TCR_CPLO 0x008 38 - #define TCR_ENAMODELO_ONCE 0x040 39 - #define TCR_ENAMODELO_CONT 0x080 40 - #define TCR_ENAMODELO_MASK 0x0c0 41 - #define TCR_PWIDLO_MASK 0x030 42 - #define TCR_CLKSRCLO 0x100 43 - #define TCR_TIENLO 0x200 44 - #define TCR_TSTATHI (0x001 << 16) 45 - #define TCR_INVOUTPHI (0x002 << 16) 46 - #define TCR_CPHI (0x008 << 16) 47 - #define TCR_PWIDHI_MASK (0x030 << 16) 48 - #define TCR_ENAMODEHI_ONCE (0x040 << 16) 49 - #define TCR_ENAMODEHI_CONT (0x080 << 16) 50 - #define TCR_ENAMODEHI_MASK (0x0c0 << 16) 51 - 52 - #define TGCR_TIMLORS 0x001 53 - #define TGCR_TIMHIRS 0x002 54 - #define TGCR_TIMMODE_UD32 0x004 55 - #define TGCR_TIMMODE_WDT64 0x008 56 - #define TGCR_TIMMODE_CD32 0x00c 57 - #define TGCR_TIMMODE_MASK 0x00c 58 - #define TGCR_PSCHI_MASK (0x00f << 8) 59 - #define TGCR_TDDRHI_MASK (0x00f << 12) 60 - 61 - /* 62 - * Timer clocks are divided down from the CPU clock 63 - * The divisor is in the EMUMGTCLKSPD register 64 - */ 65 - #define TIMER_DIVISOR \ 66 - ((soc_readl(&timer->emumgt) & (0xf << 16)) >> 16) 67 - 68 - #define TIMER64_RATE (c6x_core_freq / TIMER_DIVISOR) 69 - 70 - #define TIMER64_MODE_DISABLED 0 71 - #define TIMER64_MODE_ONE_SHOT TCR_ENAMODELO_ONCE 72 - #define TIMER64_MODE_PERIODIC TCR_ENAMODELO_CONT 73 - 74 - static int timer64_mode; 75 - static int timer64_devstate_id = -1; 76 - 77 - static void timer64_config(unsigned long period) 78 - { 79 - u32 tcr = soc_readl(&timer->tcr) & ~TCR_ENAMODELO_MASK; 80 - 81 - soc_writel(tcr, &timer->tcr); 82 - soc_writel(period - 1, &timer->prdlo); 83 - soc_writel(0, &timer->cntlo); 84 - tcr |= timer64_mode; 85 - soc_writel(tcr, &timer->tcr); 86 - } 87 - 88 - static void timer64_enable(void) 89 - { 90 - u32 val; 91 - 92 - if (timer64_devstate_id >= 0) 93 - dscr_set_devstate(timer64_devstate_id, DSCR_DEVSTATE_ENABLED); 94 - 95 - /* disable timer, reset count */ 96 - soc_writel(soc_readl(&timer->tcr) & ~TCR_ENAMODELO_MASK, &timer->tcr); 97 - soc_writel(0, &timer->prdlo); 98 - 99 - /* use internal clock and 1 cycle pulse width */ 100 - val = soc_readl(&timer->tcr); 101 - soc_writel(val & ~(TCR_CLKSRCLO | TCR_PWIDLO_MASK), &timer->tcr); 102 - 103 - /* dual 32-bit unchained mode */ 104 - val = soc_readl(&timer->tgcr) & ~TGCR_TIMMODE_MASK; 105 - soc_writel(val, &timer->tgcr); 106 - soc_writel(val | (TGCR_TIMLORS | TGCR_TIMMODE_UD32), &timer->tgcr); 107 - } 108 - 109 - static void timer64_disable(void) 110 - { 111 - /* disable timer, reset count */ 112 - soc_writel(soc_readl(&timer->tcr) & ~TCR_ENAMODELO_MASK, &timer->tcr); 113 - soc_writel(0, &timer->prdlo); 114 - 115 - if (timer64_devstate_id >= 0) 116 - dscr_set_devstate(timer64_devstate_id, DSCR_DEVSTATE_DISABLED); 117 - } 118 - 119 - static int next_event(unsigned long delta, 120 - struct clock_event_device *evt) 121 - { 122 - timer64_config(delta); 123 - return 0; 124 - } 125 - 126 - static int set_periodic(struct clock_event_device *evt) 127 - { 128 - timer64_enable(); 129 - timer64_mode = TIMER64_MODE_PERIODIC; 130 - timer64_config(TIMER64_RATE / HZ); 131 - return 0; 132 - } 133 - 134 - static int set_oneshot(struct clock_event_device *evt) 135 - { 136 - timer64_enable(); 137 - timer64_mode = TIMER64_MODE_ONE_SHOT; 138 - return 0; 139 - } 140 - 141 - static int shutdown(struct clock_event_device *evt) 142 - { 143 - timer64_mode = TIMER64_MODE_DISABLED; 144 - timer64_disable(); 145 - return 0; 146 - } 147 - 148 - static struct clock_event_device t64_clockevent_device = { 149 - .name = "TIMER64_EVT32_TIMER", 150 - .features = CLOCK_EVT_FEAT_ONESHOT | 151 - CLOCK_EVT_FEAT_PERIODIC, 152 - .rating = 200, 153 - .set_state_shutdown = shutdown, 154 - .set_state_periodic = set_periodic, 155 - .set_state_oneshot = set_oneshot, 156 - .set_next_event = next_event, 157 - }; 158 - 159 - static irqreturn_t timer_interrupt(int irq, void *dev_id) 160 - { 161 - struct clock_event_device *cd = &t64_clockevent_device; 162 - 163 - cd->event_handler(cd); 164 - 165 - return IRQ_HANDLED; 166 - } 167 - 168 - void __init timer64_init(void) 169 - { 170 - struct clock_event_device *cd = &t64_clockevent_device; 171 - struct device_node *np, *first = NULL; 172 - u32 val; 173 - int err, found = 0; 174 - 175 - for_each_compatible_node(np, NULL, "ti,c64x+timer64") { 176 - err = of_property_read_u32(np, "ti,core-mask", &val); 177 - if (!err) { 178 - if (val & (1 << get_coreid())) { 179 - found = 1; 180 - break; 181 - } 182 - } else if (!first) 183 - first = np; 184 - } 185 - if (!found) { 186 - /* try first one with no core-mask */ 187 - if (first) 188 - np = of_node_get(first); 189 - else { 190 - pr_debug("Cannot find ti,c64x+timer64 timer.\n"); 191 - return; 192 - } 193 - } 194 - 195 - timer = of_iomap(np, 0); 196 - if (!timer) { 197 - pr_debug("%pOF: Cannot map timer registers.\n", np); 198 - goto out; 199 - } 200 - pr_debug("%pOF: Timer registers=%p.\n", np, timer); 201 - 202 - cd->irq = irq_of_parse_and_map(np, 0); 203 - if (cd->irq == NO_IRQ) { 204 - pr_debug("%pOF: Cannot find interrupt.\n", np); 205 - iounmap(timer); 206 - goto out; 207 - } 208 - 209 - /* If there is a device state control, save the ID. */ 210 - err = of_property_read_u32(np, "ti,dscr-dev-enable", &val); 211 - if (!err) { 212 - timer64_devstate_id = val; 213 - 214 - /* 215 - * It is necessary to enable the timer block here because 216 - * the TIMER_DIVISOR macro needs to read a timer register 217 - * to get the divisor. 218 - */ 219 - dscr_set_devstate(timer64_devstate_id, DSCR_DEVSTATE_ENABLED); 220 - } 221 - 222 - pr_debug("%pOF: Timer irq=%d.\n", np, cd->irq); 223 - 224 - clockevents_calc_mult_shift(cd, c6x_core_freq / TIMER_DIVISOR, 5); 225 - 226 - cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd); 227 - cd->max_delta_ticks = 0x7fffffff; 228 - cd->min_delta_ns = clockevent_delta2ns(250, cd); 229 - cd->min_delta_ticks = 250; 230 - 231 - cd->cpumask = cpumask_of(smp_processor_id()); 232 - 233 - clockevents_register_device(cd); 234 - if (request_irq(cd->irq, timer_interrupt, IRQF_TIMER, "timer", 235 - &t64_clockevent_device)) 236 - pr_err("Failed to request irq %d (timer)\n", cd->irq); 237 - 238 - out: 239 - of_node_put(np); 240 - return; 241 - }
+1 -1
drivers/bus/Kconfig
··· 80 80 81 81 config HISILICON_LPC 82 82 bool "Support for ISA I/O space on HiSilicon Hip06/7" 83 - depends on (ARM64 && ARCH_HISI) || (COMPILE_TEST && !ALPHA && !HEXAGON && !PARISC && !C6X) 83 + depends on (ARM64 && ARCH_HISI) || (COMPILE_TEST && !ALPHA && !HEXAGON && !PARISC) 84 84 depends on HAS_IOMEM 85 85 select INDIRECT_PIO if ARM64 86 86 help
+1 -1
fs/Kconfig.binfmt
··· 45 45 config BINFMT_ELF_FDPIC 46 46 bool "Kernel support for FDPIC ELF binaries" 47 47 default y if !BINFMT_ELF 48 - depends on (ARM || (SUPERH && !MMU) || C6X) 48 + depends on (ARM || (SUPERH && !MMU)) 49 49 select ELFCORE 50 50 help 51 51 ELF FDPIC binaries are based on ELF, but allow the individual load
-4
include/asm-generic/page.h
··· 63 63 64 64 #endif /* !__ASSEMBLY__ */ 65 65 66 - #ifdef CONFIG_KERNEL_RAM_BASE_ADDRESS 67 - #define PAGE_OFFSET (CONFIG_KERNEL_RAM_BASE_ADDRESS) 68 - #else 69 66 #define PAGE_OFFSET (0) 70 - #endif 71 67 72 68 #ifndef ARCH_PFN_OFFSET 73 69 #define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)