C6X: New architecture patch set
Subsystems (7)
cover C6X: New architecture patch set
This is a set of patches to add architecture support for the TI C6X family of DSPs. A previous patch set for this architecture was posted a while back:
http://lwn.net/Articles/442439/
This new set represents a lot of rework based on feedback from the original posting. The major difference is a switch from static platform devices to device tree support and a reworking of how the SoC and board specific bits are partitioned. Also, all drivers have been removed from the patch set so we can focus on just the arch bits. There is support for four boards, each using a different SoC. Two of the SoCs contain multiple cores but SMP is not supported due to lack of cache coherency.
A GNU toolchain can be gotten fromfound at:
http://www.codesourcery.com/sgpp/lite/c6000/portal/release1882
Mark Salter (24):
fix default __strnlen_user macro
fixed generic page.h for non-zero PAGE_OFFSET
add ELF machine define for TI C6X DSPs
C6X: build infrastructure
C6X: early boot code
C6X: devicetree
C6X: memory management
C6X: process management
C6X: signal management
C6X: time management
C6X: interrupt handling
C6X: syscalls
C6X: traps
C6X: clocks
C6X: cache control
C6X: module support
C6X: ptrace support
C6X: headers
C6X: library code
C6X: general machine and SoC support
C6X: specific SoC support
C6X: specific board support
C6X: miscellaneous low-level SoC support
C6X: MAINTAINERS
MAINTAINERS | 8 + arch/c6x/Kconfig | 180 ++++++++ arch/c6x/Kconfig.debug | 14 + arch/c6x/Makefile | 56 +++ arch/c6x/boot/Makefile | 22 + arch/c6x/boot/dts/dsk6455.dts | 87 ++++ arch/c6x/boot/dts/evmc6457.dts | 88 ++++ arch/c6x/boot/dts/evmc6472.dts | 129 ++++++ arch/c6x/boot/dts/evmc6474.dts | 105 +++++ arch/c6x/boot/install-dtb.c | 275 ++++++++++++ arch/c6x/configs/dsk6455_defconfig | 39 ++ arch/c6x/configs/evmc6457_defconfig | 40 ++ arch/c6x/configs/evmc6472_defconfig | 41 ++ arch/c6x/configs/evmc6474_defconfig | 41 ++ arch/c6x/include/asm/Kbuild | 54 +++ arch/c6x/include/asm/asm-offsets.h | 1 + arch/c6x/include/asm/bitops.h | 105 +++++ arch/c6x/include/asm/byteorder.h | 12 + arch/c6x/include/asm/cache.h | 84 ++++ arch/c6x/include/asm/cacheflush.h | 65 +++ arch/c6x/include/asm/checksum.h | 115 +++++ arch/c6x/include/asm/clkdev.h | 22 + arch/c6x/include/asm/clock.h | 146 +++++++ arch/c6x/include/asm/delay.h | 67 +++ arch/c6x/include/asm/dma-mapping.h | 301 +++++++++++++ arch/c6x/include/asm/dma.h | 23 + arch/c6x/include/asm/elf.h | 113 +++++ arch/c6x/include/asm/ftrace.h | 6 + arch/c6x/include/asm/hardirq.h | 20 + arch/c6x/include/asm/irq.h | 300 +++++++++++++ arch/c6x/include/asm/irqflags.h | 72 +++ arch/c6x/include/asm/linkage.h | 30 ++ arch/c6x/include/asm/machdep.h | 106 +++++ arch/c6x/include/asm/memblock.h | 4 + arch/c6x/include/asm/mmu.h | 18 + arch/c6x/include/asm/module.h | 33 ++ arch/c6x/include/asm/mutex.h | 6 + arch/c6x/include/asm/page.h | 11 + arch/c6x/include/asm/pgtable.h | 81 ++++ arch/c6x/include/asm/processor.h | 132 ++++++ arch/c6x/include/asm/procinfo.h | 28 ++ arch/c6x/include/asm/prom.h | 1 + arch/c6x/include/asm/ptrace.h | 181 ++++++++ arch/c6x/include/asm/sections.h | 12 + arch/c6x/include/asm/setup.h | 27 ++ arch/c6x/include/asm/sigcontext.h | 80 ++++ arch/c6x/include/asm/signal.h | 17 + arch/c6x/include/asm/soc.h | 110 +++++ arch/c6x/include/asm/string.h | 21 + arch/c6x/include/asm/syscalls.h | 56 +++ arch/c6x/include/asm/system.h | 193 +++++++++ arch/c6x/include/asm/thread_info.h | 121 ++++++ arch/c6x/include/asm/timex.h | 41 ++ arch/c6x/include/asm/tlb.h | 8 + arch/c6x/include/asm/traps.h | 37 ++ arch/c6x/include/asm/uaccess.h | 107 +++++ arch/c6x/include/asm/unaligned.h | 288 ++++++++++++ arch/c6x/include/asm/unistd.h | 32 ++ arch/c6x/kernel/Makefile | 12 + arch/c6x/kernel/asm-offsets.c | 123 ++++++ arch/c6x/kernel/c6x_ksyms.c | 72 +++ arch/c6x/kernel/devicetree.c | 53 +++ arch/c6x/kernel/entry.S | 815 +++++++++++++++++++++++++++++++++++ arch/c6x/kernel/head.S | 83 ++++ arch/c6x/kernel/irq.c | 736 +++++++++++++++++++++++++++++++ arch/c6x/kernel/module.c | 238 ++++++++++ arch/c6x/kernel/process.c | 264 +++++++++++ arch/c6x/kernel/ptrace.c | 246 +++++++++++ arch/c6x/kernel/setup.c | 464 ++++++++++++++++++++ arch/c6x/kernel/signal.c | 377 ++++++++++++++++ arch/c6x/kernel/soc.c | 169 ++++++++ arch/c6x/kernel/switch_to.S | 74 ++++ arch/c6x/kernel/sys_c6x.c | 82 ++++ arch/c6x/kernel/time.c | 72 +++ arch/c6x/kernel/traps.c | 421 ++++++++++++++++++ arch/c6x/kernel/vectors.S | 81 ++++ arch/c6x/kernel/vmlinux.lds.S | 165 +++++++ arch/c6x/lib/Makefile | 8 + arch/c6x/lib/csum_64plus.S | 404 +++++++++++++++++ arch/c6x/lib/divi.S | 53 +++ arch/c6x/lib/divremi.S | 46 ++ arch/c6x/lib/divremu.S | 87 ++++ arch/c6x/lib/divu.S | 98 +++++ arch/c6x/lib/divull.c | 331 ++++++++++++++ arch/c6x/lib/llshl.S | 37 ++ arch/c6x/lib/llshr.S | 38 ++ arch/c6x/lib/llshru.S | 38 ++ arch/c6x/lib/memcpy_64plus.S | 46 ++ arch/c6x/lib/mpyll.S | 49 +++ arch/c6x/lib/negll.S | 31 ++ arch/c6x/lib/pop_rts.S | 32 ++ arch/c6x/lib/push_rts.S | 31 ++ arch/c6x/lib/remi.S | 64 +++ arch/c6x/lib/remu.S | 82 ++++ arch/c6x/lib/strasgi.S | 89 ++++ arch/c6x/lib/strasgi_64plus.S | 39 ++ arch/c6x/mm/Makefile | 10 + arch/c6x/mm/dma-coherent.c | 328 ++++++++++++++ arch/c6x/mm/init.c | 112 +++++ arch/c6x/platforms/Kconfig | 45 ++ arch/c6x/platforms/Makefile | 19 + arch/c6x/platforms/board-dsk6455.c | 102 +++++ arch/c6x/platforms/board-evm6457.c | 51 +++ arch/c6x/platforms/board-evm6472.c | 51 +++ arch/c6x/platforms/board-evm6474.c | 53 +++ arch/c6x/platforms/cache.c | 435 +++++++++++++++++++ arch/c6x/platforms/emif.c | 80 ++++ arch/c6x/platforms/emif.h | 45 ++ arch/c6x/platforms/megamod-pic.c | 335 ++++++++++++++ arch/c6x/platforms/megamod-pic.h | 9 + arch/c6x/platforms/pll.c | 470 ++++++++++++++++++++ arch/c6x/platforms/plldata.c | 152 +++++++ arch/c6x/platforms/psc.c | 138 ++++++ arch/c6x/platforms/psc.h | 33 ++ arch/c6x/platforms/soc-6455.c | 345 +++++++++++++++ arch/c6x/platforms/soc-6455.h | 15 + arch/c6x/platforms/soc-6457.c | 163 +++++++ arch/c6x/platforms/soc-6457.h | 15 + arch/c6x/platforms/soc-6472.c | 403 +++++++++++++++++ arch/c6x/platforms/soc-6472.h | 15 + arch/c6x/platforms/soc-6474.c | 250 +++++++++++ arch/c6x/platforms/soc-6474.h | 15 + arch/c6x/platforms/timer64.c | 191 ++++++++ arch/c6x/platforms/timer64.h | 6 + include/asm-generic/page.h | 10 +- include/asm-generic/uaccess.h | 2 +- include/linux/elf-em.h | 1 + 127 files changed, 14457 insertions(+), 4 deletions(-) create mode 100644 arch/c6x/Kconfig create mode 100644 arch/c6x/Kconfig.debug create mode 100644 arch/c6x/Makefile create mode 100644 arch/c6x/boot/Makefile create mode 100644 arch/c6x/boot/dts/dsk6455.dts create mode 100644 arch/c6x/boot/dts/evmc6457.dts create mode 100644 arch/c6x/boot/dts/evmc6472.dts create mode 100644 arch/c6x/boot/dts/evmc6474.dts create mode 100644 arch/c6x/boot/install-dtb.c create mode 100644 arch/c6x/configs/dsk6455_defconfig create mode 100644 arch/c6x/configs/evmc6457_defconfig create mode 100644 arch/c6x/configs/evmc6472_defconfig create mode 100644 arch/c6x/configs/evmc6474_defconfig create mode 100644 arch/c6x/include/asm/Kbuild create mode 100644 arch/c6x/include/asm/asm-offsets.h create mode 100644 arch/c6x/include/asm/bitops.h create mode 100644 arch/c6x/include/asm/byteorder.h create mode 100644 arch/c6x/include/asm/cache.h create mode 100644 arch/c6x/include/asm/cacheflush.h create mode 100644 arch/c6x/include/asm/checksum.h create mode 100644 arch/c6x/include/asm/clkdev.h create mode 100644 arch/c6x/include/asm/clock.h create mode 100644 arch/c6x/include/asm/delay.h create mode 100644 arch/c6x/include/asm/dma-mapping.h create mode 100644 arch/c6x/include/asm/dma.h create mode 100644 arch/c6x/include/asm/elf.h create mode 100644 arch/c6x/include/asm/ftrace.h create mode 100644 arch/c6x/include/asm/hardirq.h create mode 100644 arch/c6x/include/asm/irq.h create mode 100644 arch/c6x/include/asm/irqflags.h create mode 100644 arch/c6x/include/asm/linkage.h create mode 100644 arch/c6x/include/asm/machdep.h create mode 100644 arch/c6x/include/asm/memblock.h create mode 100644 arch/c6x/include/asm/mmu.h create mode 100644 arch/c6x/include/asm/module.h create mode 100644 arch/c6x/include/asm/mutex.h create mode 100644 arch/c6x/include/asm/page.h create mode 100644 arch/c6x/include/asm/pgtable.h create mode 100644 arch/c6x/include/asm/processor.h create mode 100644 arch/c6x/include/asm/procinfo.h create mode 100644 arch/c6x/include/asm/prom.h create mode 100644 arch/c6x/include/asm/ptrace.h create mode 100644 arch/c6x/include/asm/sections.h create mode 100644 arch/c6x/include/asm/setup.h create mode 100644 arch/c6x/include/asm/sigcontext.h create mode 100644 arch/c6x/include/asm/signal.h create mode 100644 arch/c6x/include/asm/soc.h create mode 100644 arch/c6x/include/asm/string.h create mode 100644 arch/c6x/include/asm/syscalls.h create mode 100644 arch/c6x/include/asm/system.h create mode 100644 arch/c6x/include/asm/thread_info.h create mode 100644 arch/c6x/include/asm/timex.h create mode 100644 arch/c6x/include/asm/tlb.h create mode 100644 arch/c6x/include/asm/traps.h create mode 100644 arch/c6x/include/asm/uaccess.h create mode 100644 arch/c6x/include/asm/unaligned.h create mode 100644 arch/c6x/include/asm/unistd.h create mode 100644 arch/c6x/kernel/Makefile create mode 100644 arch/c6x/kernel/asm-offsets.c create mode 100644 arch/c6x/kernel/c6x_ksyms.c create mode 100644 arch/c6x/kernel/devicetree.c create mode 100644 arch/c6x/kernel/entry.S create mode 100644 arch/c6x/kernel/head.S create mode 100644 arch/c6x/kernel/irq.c create mode 100644 arch/c6x/kernel/module.c create mode 100644 arch/c6x/kernel/process.c create mode 100644 arch/c6x/kernel/ptrace.c create mode 100644 arch/c6x/kernel/setup.c create mode 100644 arch/c6x/kernel/signal.c create mode 100644 arch/c6x/kernel/soc.c create mode 100644 arch/c6x/kernel/switch_to.S create mode 100644 arch/c6x/kernel/sys_c6x.c create mode 100644 arch/c6x/kernel/time.c create mode 100644 arch/c6x/kernel/traps.c create mode 100644 arch/c6x/kernel/vectors.S create mode 100644 arch/c6x/kernel/vmlinux.lds.S create mode 100644 arch/c6x/lib/Makefile create mode 100644 arch/c6x/lib/csum_64plus.S create mode 100644 arch/c6x/lib/divi.S create mode 100644 arch/c6x/lib/divremi.S create mode 100644 arch/c6x/lib/divremu.S create mode 100644 arch/c6x/lib/divu.S create mode 100644 arch/c6x/lib/divull.c create mode 100644 arch/c6x/lib/llshl.S create mode 100644 arch/c6x/lib/llshr.S create mode 100644 arch/c6x/lib/llshru.S create mode 100644 arch/c6x/lib/memcpy_64plus.S create mode 100644 arch/c6x/lib/mpyll.S create mode 100644 arch/c6x/lib/negll.S create mode 100644 arch/c6x/lib/pop_rts.S create mode 100644 arch/c6x/lib/push_rts.S create mode 100644 arch/c6x/lib/remi.S create mode 100644 arch/c6x/lib/remu.S create mode 100644 arch/c6x/lib/strasgi.S create mode 100644 arch/c6x/lib/strasgi_64plus.S create mode 100644 arch/c6x/mm/Makefile create mode 100644 arch/c6x/mm/dma-coherent.c create mode 100644 arch/c6x/mm/init.c create mode 100644 arch/c6x/platforms/Kconfig create mode 100644 arch/c6x/platforms/Makefile create mode 100644 arch/c6x/platforms/board-dsk6455.c create mode 100644 arch/c6x/platforms/board-evm6457.c create mode 100644 arch/c6x/platforms/board-evm6472.c create mode 100644 arch/c6x/platforms/board-evm6474.c create mode 100644 arch/c6x/platforms/cache.c create mode 100644 arch/c6x/platforms/emif.c create mode 100644 arch/c6x/platforms/emif.h create mode 100644 arch/c6x/platforms/megamod-pic.c create mode 100644 arch/c6x/platforms/megamod-pic.h create mode 100644 arch/c6x/platforms/pll.c create mode 100644 arch/c6x/platforms/plldata.c create mode 100644 arch/c6x/platforms/psc.c create mode 100644 arch/c6x/platforms/psc.h create mode 100644 arch/c6x/platforms/soc-6455.c create mode 100644 arch/c6x/platforms/soc-6455.h create mode 100644 arch/c6x/platforms/soc-6457.c create mode 100644 arch/c6x/platforms/soc-6457.h create mode 100644 arch/c6x/platforms/soc-6472.c create mode 100644 arch/c6x/platforms/soc-6472.h create mode 100644 arch/c6x/platforms/soc-6474.c create mode 100644 arch/c6x/platforms/soc-6474.h create mode 100644 arch/c6x/platforms/timer64.c create mode 100644 arch/c6x/platforms/timer64.h
Signature · 1 line
1.7.6
PATCH 1/24 fix default __strnlen_user macro
The existing __strnlen_user macro simply resolved to strnlen. However, the count returned by strnlen_user should include the NULL byte. This patch fixes the __strnlen_user macro to include the NULL byte in the count.
--- include/asm-generic/uaccess.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/asm-generic/uaccess.h +1 -1
@@ -289,7 +289,7 @@ strncpy_from_user(char *dst, const char __user *src, long count)* Return 0 on exception, a value greater than N if too long */ #ifndef __strnlen_user -#define __strnlen_user strnlen +#define __strnlen_user (s, n) (strnlen((s), (n)) + 1)#endif static inline long strnlen_user (const char __user *src,long n)
Signature · 1 line
1.7.6
PATCH 2/24 fixed generic page.h for non-zero PAGE_OFFSET
In reply to Mark Salterasm-generic/page.h had several problems when used with a non-zero PAGE_OFFSET. This patch adds a default ARCH_PFN_OFFSET and fixes the __va, __pa, and pfn_valid macros to work with non-zero PAGE_OFFSETs.
--- include/asm-generic/page.h | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
include/asm-generic/page.h +7 -3
@@ -71,10 +71,14 @@ extern unsigned long memory_end;#define PAGE_OFFSET (0)#endif +#ifndef ARCH_PFN_OFFSET +#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) +#endif +#ifndef __ASSEMBLY__ -#define __va (x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) -#define __pa (x) ((unsigned long) (x) - PAGE_OFFSET) +#define __va (x) ((void *)((unsigned long) (x))) +#define __pa (x) ((unsigned long) (x))#define virt_to_pfn (kaddr) (__pa(kaddr) >> PAGE_SHIFT)#define pfn_to_virt (pfn) __va((pfn) << PAGE_SHIFT)
@@ -86,7 +90,7 @@ extern unsigned long memory_end;#define page_to_phys (page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)#endif -#define pfn_valid (pfn) ((pfn) < max_mapnr) +#define pfn_valid (pfn) ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)#define virt_addr_valid (kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ ((void *)(kaddr) < (void *)memory_end))
Signature · 1 line
1.7.6
PATCH 3/24 add ELF machine define for TI C6X DSPs
In reply to Mark Salter--- include/linux/elf-em.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/elf-em.h +1 -0
@@ -33,6 +33,7 @@#define EM_H8_300 46/* Renesas H8/300,300H,H8S */ #define EM_MN10300 89/* Panasonic/MEI MN10300, AM33 */ #define EM_BLACKFIN 106/* ADI Blackfin Processor */ +#define EM_TI_C6000 140/* TI C6X DSPs */ #define EM_FRV 0x5441/* Fujitsu FR-V */ #define EM_AVR32 0x18ad/* Atmel AVR32 */
Signature · 1 line
1.7.6
PATCH 4/24 C6X: build infrastructure
In reply to Mark Salter--- arch/c6x/Kconfig | 180 +++++++++++++++++++++++++++++++++++ arch/c6x/Kconfig.debug | 14 +++ arch/c6x/Makefile | 56 +++++++++++ arch/c6x/boot/Makefile | 22 ++++ arch/c6x/configs/dsk6455_defconfig | 39 ++++++++ arch/c6x/configs/evmc6457_defconfig | 40 ++++++++ arch/c6x/configs/evmc6472_defconfig | 41 ++++++++ arch/c6x/configs/evmc6474_defconfig | 41 ++++++++ arch/c6x/include/asm/Kbuild | 54 +++++++++++ arch/c6x/kernel/Makefile | 12 +++ arch/c6x/kernel/vmlinux.lds.S | 165 ++++++++++++++++++++++++++++++++ arch/c6x/lib/Makefile | 8 ++ arch/c6x/mm/Makefile | 10 ++ arch/c6x/platforms/Kconfig | 45 +++++++++ arch/c6x/platforms/Makefile | 19 ++++ 15 files changed, 746 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/Kconfig create mode 100644 arch/c6x/Kconfig.debug create mode 100644 arch/c6x/Makefile create mode 100644 arch/c6x/boot/Makefile create mode 100644 arch/c6x/configs/dsk6455_defconfig create mode 100644 arch/c6x/configs/evmc6457_defconfig create mode 100644 arch/c6x/configs/evmc6472_defconfig create mode 100644 arch/c6x/configs/evmc6474_defconfig create mode 100644 arch/c6x/include/asm/Kbuild create mode 100644 arch/c6x/kernel/Makefile create mode 100644 arch/c6x/kernel/vmlinux.lds.S create mode 100644 arch/c6x/lib/Makefile create mode 100644 arch/c6x/mm/Makefile create mode 100644 arch/c6x/platforms/Kconfig create mode 100644 arch/c6x/platforms/Makefile
arch/c6x/Kconfig new file +180 -0
@@ -0,0 +1,180 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# + +config TMS320C6X + def_bool y + select CLKDEV_LOOKUP + select HAVE_MEMBLOCK + select HAVE_SPARSE_IRQ + select GENERIC_IRQ_SHOW + select HAVE_GENERIC_HARDIRQS + select GENERIC_HARDIRQS_NO__DO_IRQ + select GENERIC_HARDIRQS_NO__DO_IRQ + select GENERIC_HARDIRQS_NO_DEPRECATED + select GENERIC_FIND_FIRST_BIT + select GENERIC_FIND_NEXT_BIT + select GENERIC_FIND_LAST_BIT + select GENERIC_FIND_BIT_LE + select OF + select OF_EARLY_FLATTREE + +config MMU + def_bool n + +config ZONE_DMA + def_bool y + +config FPU + def_bool n + +config HIGHMEM + def_bool n + +config NUMA + def_bool n + +config RWSEM_GENERIC_SPINLOCK + def_bool y + +config RWSEM_XCHGADD_ALGORITHM + def_bool n + +config GENERIC_CALIBRATE_DELAY + def_bool y + +config GENERIC_FIND_NEXT_BIT + def_bool y + +config GENERIC_HWEIGHT + def_bool y + +config GENERIC_CLOCKEVENTS + def_bool y + +config GENERIC_CLOCKEVENTS_BROADCAST + bool + +config GENERIC_BUG + def_bool y + +config COMMON_CLKDEV + def_bool y + +config BIG_KERNEL + bool "Build a big kernel" + help + The C6X function call instruction has a limited range of +/- 2MiB. + This is sufficient for most kernels, but some kernel configurations + with lots of compiled-in functionality may require a larger range + for function calls. Use this option to have the compiler generate + function calls with 32-bit range. This will make the kernel both + larger and slower. + + If unsure, say N. + +config NR_IRQS + int "Number of virtual interrupt numbers" + range 32 32768 + default "256" + help + This defines the number of virtual interrupt numbers the kernel + can manage. Virtual interrupt numbers are what you see in + /proc/interrupts. If you configure your system to have too few, + drivers will fail to load or worse - handle with care. + +source "init/Kconfig" + +# Use the generic interrupt handling code in kernel/irq/ + +source "kernel/Kconfig.freezer" + +config CMDLINE_BOOL + bool "Default bootloader kernel arguments" + +config CMDLINE + string "Kernel command line" + depends on CMDLINE_BOOL + default "console=ttyS0,57600" + help + On some architectures there is currently no way for the boot loader + to pass arguments to the kernel. For these architectures, you should + supply some command-line options at build time by entering them + here. + +config CMDLINE_FORCE + bool "Force default kernel command string" + depends on CMDLINE_BOOL + default n + help + Set this to have arguments from the default kernel command string + override those passed by the boot loader. + +config CPU_BIG_ENDIAN + bool "Build big-endian kernel" + default n + help + Say Y if you plan on running a kernel in big-endian mode. + Note that your board must be properly built and your board + port must properly enable any big-endian related features + of your chipset/board/processor. + +config FORCE_MAX_ZONEORDER + int + default "13" + +menu "Processor type and features" + +config TMS320C64XPLUS + bool "TMS320C64X+" + +source "arch/c6x/platforms/Kconfig" + +config TMS320C6X_CACHES_ON + bool "L2 cache support" + default y + +config KERNEL_RAM_BASE_ADDRESS + hex "Virtual address of memory base" + default 0xe0000000 if SOC_TMS320C6455 + default 0xe0000000 if SOC_TMS320C6457 + default 0xe0000000 if SOC_TMS320C6472 + default 0x80000000 + +source "mm/Kconfig" + +source "kernel/Kconfig.preempt" + +source "kernel/Kconfig.hz" +source "kernel/time/Kconfig" + +endmenu + +menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" + +config PCI + bool "PCI support" + help + Support for PCI bus. +endmenu + +menu "Executable file formats" + +source "fs/Kconfig.binfmt" + +endmenu + +source "net/Kconfig" + +source "drivers/Kconfig" + +source "fs/Kconfig" + +source "security/Kconfig" + +source "crypto/Kconfig" + +source "lib/Kconfig" + +source "arch/c6x/Kconfig.debug"
arch/c6x/Kconfig.debug new file +14 -0
@@ -0,0 +1,14 @@ +menu "Kernel hacking" + +source "lib/Kconfig.debug" + +config ACCESS_CHECK + bool "Check the user pointer address" + default y + help + Usually the pointer transfer from user space is checked to see if its + address is in the kernel space. + + Say N here to disable that check to improve the performance. + +endmenu
arch/c6x/Makefile new file +56 -0
56 lines not on this page · raw message
arch/c6x/boot/Makefile new file +22 -0
@@ -0,0 +1,22 @@ +# +# Makefile for bootable kernel images +# + +all: $(obj)/vmlinux.bin + +hostprogs-y := install-dtb + +$(obj)/vmlinux.bin: vmlinux + $(OBJCOPY) -O binary $< $@ + + +$(obj)/dtbImage.%: vmlinux $(obj)/install-dtb $(obj)/%.dtb + cp vmlinux $@ + $(obj)/install-dtb $(obj)/$*.dtb $@ + +clean-files := $(obj)/*.dtb + +DTC_FLAGS ?= -p 1024 + +$(obj)/%.dtb: $(src)/dts/%.dts FORCE + $(call cmd,dtc)
arch/c6x/configs/dsk6455_defconfig new file +39 -0
@@ -0,0 +1,39 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_SYSVIPC=y +CONFIG_SPARSE_IRQ=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_NAMESPACES=y +# CONFIG_UTS_NS is not set +# CONFIG_USER_NS is not set +# CONFIG_PID_NS is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_EXPERT=y +# CONFIG_FUTEX is not set +# CONFIG_SLUB_DEBUG is not set +CONFIG_MODULES=y +CONFIG_MODULE_FORCE_LOAD=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="" +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=2 +CONFIG_BLK_DEV_RAM_SIZE=17000 +CONFIG_MISC_DEVICES=y +# CONFIG_INPUT is not set +# CONFIG_SERIO is not set +# CONFIG_VT is not set +# CONFIG_HW_RANDOM is not set +# CONFIG_HWMON is not set +# CONFIG_USB_SUPPORT is not set +# CONFIG_IOMMU_SUPPORT is not set +# CONFIG_MISC_FILESYSTEMS is not set +CONFIG_CRC16=y +# CONFIG_ENABLE_MUST_CHECK is not set +# CONFIG_SCHED_DEBUG is not set +# CONFIG_DEBUG_BUGVERBOSE is not set
arch/c6x/configs/evmc6457_defconfig new file +40 -0
@@ -0,0 +1,40 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_SYSVIPC=y +CONFIG_SPARSE_IRQ=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_NAMESPACES=y +# CONFIG_UTS_NS is not set +# CONFIG_USER_NS is not set +# CONFIG_PID_NS is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_EXPERT=y +# CONFIG_FUTEX is not set +# CONFIG_SLUB_DEBUG is not set +CONFIG_MODULES=y +CONFIG_MODULE_FORCE_LOAD=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="" +CONFIG_BOARD_EVM6457=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=2 +CONFIG_BLK_DEV_RAM_SIZE=17000 +CONFIG_MISC_DEVICES=y +# CONFIG_INPUT is not set +# CONFIG_SERIO is not set +# CONFIG_VT is not set +# CONFIG_HW_RANDOM is not set +# CONFIG_HWMON is not set +# CONFIG_USB_SUPPORT is not set +# CONFIG_IOMMU_SUPPORT is not set +# CONFIG_MISC_FILESYSTEMS is not set +CONFIG_CRC16=y +# CONFIG_ENABLE_MUST_CHECK is not set +# CONFIG_SCHED_DEBUG is not set +# CONFIG_DEBUG_BUGVERBOSE is not set
arch/c6x/configs/evmc6472_defconfig new file +41 -0
41 lines not on this page · raw message
arch/c6x/configs/evmc6474_defconfig new file +41 -0
41 lines not on this page · raw message
arch/c6x/include/asm/Kbuild new file +54 -0
54 lines not on this page · raw message
arch/c6x/kernel/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# +# Makefile for arch/c6x/kernel/ +# + +extra-y := head.o vmlinux.lds + +obj-y := process.o traps.o irq.o signal.o ptrace.o \ + setup.o sys_c6x.o time.o devicetree.o \ + switch_to.o entry.o vectors.o c6x_ksyms.o\ + soc.o + +obj-$(CONFIG_MODULES) += module.o
arch/c6x/kernel/vmlinux.lds.S new file +165 -0
165 lines not on this page · raw message
arch/c6x/lib/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# Makefile for arch/c6x/lib/ +# + +lib-y := divu.o divi.o pop_rts.o push_rts.o remi.o remu.o strasgi.o llshru.o \ + llshr.o llshl.o negll.o mpyll.o divull.o divremi.o divremu.o + +lib-$(CONFIG_TMS320C64XPLUS) += csum_64plus.o memcpy_64plus.o strasgi_64plus.o
arch/c6x/mm/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# +# Makefile for the linux c6x-specific parts of the memory manager. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# +# Note 2! The CFLAGS definition is now in the main makefile... + +obj-y := init.o dma-coherent.o
arch/c6x/platforms/Kconfig new file +45 -0
45 lines not on this page · raw message
arch/c6x/platforms/Makefile new file +19 -0
@@ -0,0 +1,19 @@ +# +# Makefile for arch/c6x/platforms +# +# Copyright 2010, 2011 Texas Instruments Incorporated +# + +obj-y = cache.o megamod-pic.o pll.o plldata.o timer64.o + +# SoC objects +obj-$(CONFIG_SOC_TMS320C6455) += soc-6455.o emif.o +obj-$(CONFIG_SOC_TMS320C6457) += soc-6457.o emif.o psc.o +obj-$(CONFIG_SOC_TMS320C6472) += soc-6472.o psc.o +obj-$(CONFIG_SOC_TMS320C6474) += soc-6474.o psc.o + +# Board objects +obj-$(CONFIG_BOARD_DSK6455) += board-dsk6455.o +obj-$(CONFIG_BOARD_EVM6457) += board-evm6457.o +obj-$(CONFIG_BOARD_EVM6472) += board-evm6472.o +obj-$(CONFIG_BOARD_EVM6474) += board-evm6474.o
Signature · 1 line
1.7.6
PATCH 5/24 C6X: early boot code
In reply to Mark Salter--- arch/c6x/kernel/head.S | 83 ++++++++ arch/c6x/kernel/setup.c | 464 +++++++++++++++++++++++++++++++++++++++++++++ arch/c6x/kernel/vectors.S | 81 ++++++++ 3 files changed, 628 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/kernel/head.S create mode 100644 arch/c6x/kernel/setup.c create mode 100644 arch/c6x/kernel/vectors.S
arch/c6x/kernel/head.S new file +83 -0
@@ -0,0 +1,83 @@ +; +; Port on Texas Instruments TMS320C6x architecture +; +; Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated +; Author: Aurelien Jacquiot ([email protected]) +; +; This program is free software; you can redistribute it and/or modify +; it under the terms of the GNU General Public License version 2 as +; published by the Free Software Foundation. +; +#include <linux/linkage.h> +#include <linux/of_fdt.h> +#include <asm/asm-offsets.h> + +ENTRY(_c_int00) + ;; Save magic and pointer + MV .S1 A4,A10 + MV .S2 B4,B10 + MVKL .S2 __bss_start,B5 + MVKH .S2 __bss_start,B5 + MVKL .S2 __bss_stop,B6 + MVKH .S2 __bss_stop,B6 + SUB .L2 B6,B5,B6 ; bss size + + ;; Set the stack pointer + MVKL .S2 current_ksp,B0 + MVKH .S2 current_ksp,B0 + LDW .D2T2 *B0,B15 + + ;; clear bss + SHR .S2 B6,3,B0 ; number of dwords to clear + ZERO .L2 B13 + ZERO .L2 B12 +bss_loop: + BDEC .S2 bss_loop,B0 + NOP 3 + CMPLT .L2 B0,0,B1 + [!B1] STDW .D2T2 B13:B12,*B5++[1] + + NOP 4 + AND .D2 ~7,B15,B15 + + ;; Clear GIE and PGIE + MVC .S2 CSR,B2 + CLR .S2 B2,0,1,B2 + MVC .S2 B2,CSR + MVC .S2 TSR,B2 + CLR .S2 B2,0,1,B2 + MVC .S2 B2,TSR + MVC .S2 ITSR,B2 + CLR .S2 B2,0,1,B2 + MVC .S2 B2,ITSR + MVC .S2 NTSR,B2 + CLR .S2 B2,0,1,B2 + MVC .S2 B2,NTSR + + ;; pass DTB pointer to machine_init (or zero if none) + MVKL .S1 OF_DT_HEADER,A0 + MVKH .S1 OF_DT_HEADER,A0 + CMPEQ .L1 A10,A0,A0 + [A0] MV .S1X B10,A4 + [!A0] MVK .S1 0,A4 + +#ifdef CONFIG_BIG_KERNEL + MVKL .S1 machine_init,A0 + MVKH .S1 machine_init,A0 + B .S2X A0 + ADDKPC .S2 0f,B3,4 +0: +#else + CALLP .S2 machine_init,B3 +#endif + + ;; Jump to Linux init +#ifdef CONFIG_BIG_KERNEL + MVKL .S1 start_kernel,A0 + MVKH .S1 start_kernel,A0 + B .S2X A0 +#else + B .S2 start_kernel +#endif + NOP 5 +L1: BNOP .S2 L1,5
arch/c6x/kernel/setup.c new file +464 -0
464 lines not on this page · raw message
arch/c6x/kernel/vectors.S new file +81 -0
81 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 6/24 C6X: devicetree
In reply to Mark Salter--- arch/c6x/boot/dts/dsk6455.dts | 87 +++++++++++++ arch/c6x/boot/dts/evmc6457.dts | 88 +++++++++++++ arch/c6x/boot/dts/evmc6472.dts | 129 +++++++++++++++++++ arch/c6x/boot/dts/evmc6474.dts | 105 +++++++++++++++ arch/c6x/boot/install-dtb.c | 275 ++++++++++++++++++++++++++++++++++++++++ arch/c6x/kernel/devicetree.c | 53 ++++++++ 6 files changed, 737 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/boot/dts/dsk6455.dts create mode 100644 arch/c6x/boot/dts/evmc6457.dts create mode 100644 arch/c6x/boot/dts/evmc6472.dts create mode 100644 arch/c6x/boot/dts/evmc6474.dts create mode 100644 arch/c6x/boot/install-dtb.c create mode 100644 arch/c6x/kernel/devicetree.c
arch/c6x/boot/dts/dsk6455.dts new file +87 -0
@@ -0,0 +1,87 @@ +/* + * arch/c6x/boot/dts/dsk6455.dts + * + * DSK6455 Evaluation Platform For TMS320C6455 + * Copyright (C) 2011 Texas Instruments Incorporated + * + * Author: Mark Salter <[email protected]> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + */ + +/dts-v1/; + +/ { + model = "Spectrum Digital DSK6455"; + compatible = "spectrum-digital,dsk6455"; + + #address-cells = <1>; + #size-cells = <1>; + + chosen { + bootargs = "root=/dev/nfs ip=dhcp rw"; + }; + + memory { + device_type = "memory"; + reg = <0xE0000000 0x08000000>; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + model = "ti,tms320c6455"; + reg = <0>; + }; + }; + + /* + * Core priority interrupt controller + */ + core_pic: interrupt-controller@0 { + interrupt-controller; + #interrupt-cells = <1>; + compatible = "ti,c64x+core-pic"; + }; + + soc@00000000 { + compatible = "ti,c6455"; + device_type = "soc"; + #address-cells = <1>; + #size-cells = <1>; + #interrupt-cells = <1>; + ranges; + + clock-frequency = <50000000>; + + /* + * Megamodule interrupt controller + */ + megamod_pic: interrupt-controller@1800000 { + interrupt-controller; + #interrupt-cells = <1>; + reg = <0x1800000 0x1000>; + interrupt-parent = <&core_pic>; + interrupts = < 12 13 14 15 >; + ti,priority-map = < 0xffff 0xffff 0xffff 0xffff + 0xffff 0xffff 0xffff 0xffff + 0xffff 0xffff 0xffff 0xffff + 0 1 2 3 >; + compatible = "ti,c64x+megamod-pic"; + }; + + timer1: timer@2980000 { + compatible = "ti,c64x+timer64"; + reg = <0x2980000 0x40>; + interrupt-parent = <&megamod_pic>; + interrupts = < 69 >; + }; + }; +};
arch/c6x/boot/dts/evmc6457.dts new file +88 -0
88 lines not on this page · raw message
arch/c6x/boot/dts/evmc6472.dts new file +129 -0
129 lines not on this page · raw message
arch/c6x/boot/dts/evmc6474.dts new file +105 -0
105 lines not on this page · raw message
arch/c6x/boot/install-dtb.c new file +275 -0
275 lines not on this page · raw message
arch/c6x/kernel/devicetree.c new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 7/24 C6X: memory management
In reply to Mark Salter--- arch/c6x/include/asm/dma-mapping.h | 301 +++++++++++++++++++++++++++++++++ arch/c6x/include/asm/dma.h | 23 +++ arch/c6x/mm/dma-coherent.c | 328 ++++++++++++++++++++++++++++++++++++ arch/c6x/mm/init.c | 112 ++++++++++++ 4 files changed, 764 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/dma-mapping.h create mode 100644 arch/c6x/include/asm/dma.h create mode 100644 arch/c6x/mm/dma-coherent.c create mode 100644 arch/c6x/mm/init.c
arch/c6x/include/asm/dma-mapping.h new file +301 -0
@@ -0,0 +1,301 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated +* Author: Aurelien Jacquiot <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +*/ +#ifndef _ASM_C6X_DMA_MAPPING_H +#define _ASM_C6X_DMA_MAPPING_H + +#ifdef __KERNEL__ + +#include <linux/mm.h> +#include <linux/mm_types.h> +#include <linux/scatterlist.h> + +#include <asm/io.h> +#include <asm/types.h> +#include <asm-generic/dma-coherent.h> + +#define dma_supported (d, m) (1) + +#define __pfn_to_bus (pfn) ((pfn) << PAGE_SHIFT) +#define __bus_to_pfn (paddr) ((paddr) >> PAGE_SHIFT) +#define __bus_to_phys (x) (x) +#define __phys_to_bus (x) (x) +#define __bus_to_virt (b) phys_to_virt(__bus_to_phys(b)) +#define __virt_to_bus (v) __phys_to_bus(virt_to_phys(v)) + +/* +* page_to_dma/dma_to_virt/virt_to_dma are architecture private functions +* used internally by the DMA-mapping API to provide DMA addresses. They +* must not be used by drivers. +*/ +static inline dma_addr_t page_to_dma (struct device *dev,struct page *page) +{ +return (dma_addr_t )__pfn_to_bus (page_to_pfn (page)); +} + +static inline struct page *dma_to_page (struct device *dev,dma_addr_t addr) +{ +return pfn_to_page (__bus_to_pfn (addr)); +} + +static inline void *dma_to_virt (struct device *dev,dma_addr_t addr) +{ +return (void *)__bus_to_virt (addr); +} + +static inline dma_addr_t virt_to_dma (struct device *dev,void *addr) +{ +return (dma_addr_t )__virt_to_bus (addr); +} + +static inline int dma_map_sg (struct device *dev,struct scatterlist *sglist, +int nents,enum dma_data_direction direction) +{ +struct scatterlist *sg; +int i; + +BUG_ON (direction ==DMA_NONE ); + +for_each_sg (sglist, sg, nents, i) { +BUG_ON (!sg_page (sg)); + + sg->dma_address =sg_phys (sg); + } + +return nents; +} + +static inline void dma_unmap_sg (struct device *dev,struct scatterlist *sg, +int nhwentries, +enum dma_data_direction direction) +{ +BUG_ON (direction ==DMA_NONE ); +} + +extern int __dma_is_coherent (struct device *dev,dma_addr_t handle); + +static inline int dma_is_consistent (struct device *dev,dma_addr_t handle) +{ +if (arch_is_coherent () ||__dma_is_coherent (dev, handle)) +return 1 ; +else +return 0 ; +} + +/* +* DMA errors are defined by all-bits-set in the DMA address. +*/ +static inline int dma_mapping_error (struct device *dev,dma_addr_t dma_addr) +{ +return dma_addr == ~0 ; +} + +/** +* dma_alloc_coherent - allocate consistent memory for DMA +* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices +* @size: required memory size +* @handle: bus-specific DMA address +* +* Allocate some uncached, unbuffered memory for a device for +* performing DMA. This function allocates pages, and will +* return the CPU-viewed address, and sets @handle to be the +* device-viewed address. +*/ +extern void *dma_alloc_coherent (struct device *,size_t ,dma_addr_t *,gfp_t ); + +/** +* dma_free_coherent - free memory allocated by dma_alloc_coherent +* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices +* @size: size of memory originally requested in dma_alloc_coherent +* @cpu_addr: CPU-view address returned from dma_alloc_coherent +* @handle: device-view address returned from dma_alloc_coherent +* +* Free (and unmap) a DMA buffer previously allocated by +* dma_alloc_coherent(). +* +* References to memory and mappings associated with cpu_addr/handle +* during and after this call executing are illegal. +*/ +extern void dma_free_coherent (struct device *,size_t ,void *,dma_addr_t ); + +#define dma_alloc_noncoherent (d, s, h, f) dma_alloc_coherent((d), (s), (h), (f)) +#define dma_free_noncoherent (d, s, v, h) dma_free_coherent((d), (s), (v), (h)) + +extern void __dma_single_cpu_to_dev (const void *kaddr,size_t size, +enum dma_data_direction dir); + +extern void __dma_single_dev_to_cpu (const void *kaddr,size_t size, +enum dma_data_direction dir); + +extern void __dma_page_cpu_to_dev (struct page *page,unsigned long off, +size_t size,enum dma_data_direction dir); + +extern void __dma_page_dev_to_cpu (struct page *page,unsigned long off, +size_t size,enum dma_data_direction dir); + +/** +* dma_map_single - map a single buffer for streaming DMA +* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices +* @cpu_addr: CPU direct mapped address of buffer +* @size: size of buffer to map +* @dir: DMA transfer direction +* +* Ensure that any data held in the cache is appropriately discarded +* or written back. +* +* The device owns this memory once this call has completed. The CPU +* can regain ownership by calling dma_unmap_single() or +* dma_sync_single_for_cpu(). +*/ +static inline dma_addr_t dma_map_single (struct device *dev,void *cpu_addr, +size_t size,enum dma_data_direction dir) +{ +BUG_ON (!valid_dma_direction (dir)); + +__dma_single_cpu_to_dev (cpu_addr, size, dir); + +return virt_to_dma (dev, cpu_addr); +} + +/** +* dma_map_page - map a portion of a page for streaming DMA +* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices +* @page: page that buffer resides in +* @offset: offset into page for start of buffer +* @size: size of buffer to map +* @dir: DMA transfer direction +* +* Ensure that any data held in the cache is appropriately discarded +* or written back. +* +* The device owns this memory once this call has completed. The CPU +* can regain ownership by calling dma_unmap_page(). +*/ +static inline dma_addr_t dma_map_page (struct device *dev,struct page *page, +unsigned long offset,size_t size,enum dma_data_direction dir) +{ +BUG_ON (!valid_dma_direction (dir)); + +__dma_page_cpu_to_dev (page, offset, size, dir); + +return page_to_dma (dev, page) + offset; +} + +/** +* dma_unmap_single - unmap a single buffer previously mapped +* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices +* @handle: DMA address of buffer +* @size: size of buffer (same as passed to dma_map_single) +* @dir: DMA transfer direction (same as passed to dma_map_single) +* +* Unmap a single streaming mode DMA translation. The handle and size +* must match what was provided in the previous dma_map_single() call. +* All other usages are undefined. +* +* After this call, reads by the CPU to the buffer are guaranteed to see +* whatever the device wrote there. +*/ +static inline void +dma_unmap_single (struct device *dev,dma_addr_t handle, +size_t size,enum dma_data_direction dir) +{ +__dma_single_dev_to_cpu (dma_to_virt (dev, handle), size, dir); +} + +/** +* dma_unmap_page - unmap a buffer previously mapped through dma_map_page() +* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices +* @handle: DMA address of buffer +* @size: size of buffer (same as passed to dma_map_page) +* @dir: DMA transfer direction (same as passed to dma_map_page) +* +* Unmap a page streaming mode DMA translation. The handle and size +* must match what was provided in the previous dma_map_page() call. +* All other usages are undefined. +* +* After this call, reads by the CPU to the buffer are guaranteed to see +* whatever the device wrote there. +*/ +static inline void dma_unmap_page (struct device *dev,dma_addr_t handle, +size_t size,enum dma_data_direction dir) +{ +__dma_page_dev_to_cpu (dma_to_page (dev, handle), handle & ~PAGE_MASK , + size, dir); +} + +/** +* dma_sync_single_range_for_cpu +* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices +* @handle: DMA address of buffer +* @offset: offset of region to start sync +* @size: size of region to sync +* @dir: DMA transfer direction (same as passed to dma_map_single) +* +* Make physical memory consistent for a single streaming mode DMA +* translation after a transfer. +* +* If you perform a dma_map_single() but wish to interrogate the +* buffer using the cpu, yet do not wish to teardown the PCI dma +* mapping, you must call this function before doing so. At the +* next point you give the PCI dma address back to the card, you +* must first the perform a dma_sync_for_device, and then the +* device again owns the buffer. +*/ +static inline void dma_sync_single_range_for_cpu (struct device *dev, +dma_addr_t handle,unsigned long offset,size_t size, +enum dma_data_direction dir) +{ +BUG_ON (!valid_dma_direction (dir)); + +__dma_single_dev_to_cpu (dma_to_virt (dev, handle) + offset, size, dir); +} + +static inline void dma_sync_single_range_for_device (struct device *dev, +dma_addr_t handle,unsigned long offset,size_t size, +enum dma_data_direction dir) +{ +BUG_ON (!valid_dma_direction (dir)); + +__dma_single_cpu_to_dev (dma_to_virt (dev, handle) + offset, size, dir); +} + +static inline void dma_sync_single_for_cpu (struct device *dev, +dma_addr_t handle,size_t size,enum dma_data_direction dir) +{ +dma_sync_single_range_for_cpu (dev, handle,0 , size, dir); +} + +static inline void dma_sync_single_for_device (struct device *dev, +dma_addr_t handle,size_t size,enum dma_data_direction dir) +{ +dma_sync_single_range_for_device (dev, handle,0 , size, dir); +} + +static inline void +dma_sync_sg_for_cpu (struct device *dev,struct scatterlist *sg,int nents, +enum dma_data_direction dir) +{ +BUG_ON (!valid_dma_direction (dir)); +} + +static inline void +dma_sync_sg_for_device (struct device *dev,struct scatterlist *sg,int nents, +enum dma_data_direction dir) +{ +BUG_ON (!valid_dma_direction (dir)); +} + +extern int coherent_mem_init (void ); +extern unsigned long dma_memory_start; +extern unsigned long dma_memory_size; + +#endif /* __KERNEL__ */ +#endif /* _ASM_C6X_DMA_MAPPING_H */
arch/c6x/include/asm/dma.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_DMA_H +#define _ASM_C6X_DMA_H + +#define MAX_DMA_ADDRESS 0xFFFFFFFF +#define MAX_DMA_CHANNELS 64 + +/* Reserve a DMA channel */ +extern int request_dma (unsigned int dmanr,const char *device_id); + +/* Release it again */ +extern void free_dma (unsigned int dmanr); + +#endif /* _ASM_C6X_DMA_H */
arch/c6x/mm/dma-coherent.c new file +328 -0
328 lines not on this page · raw message
arch/c6x/mm/init.c new file +112 -0
112 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 8/24 C6X: process management
In reply to Mark Salter--- arch/c6x/include/asm/processor.h | 132 ++++++++++++++++++ arch/c6x/include/asm/thread_info.h | 121 ++++++++++++++++ arch/c6x/kernel/process.c | 264 ++++++++++++++++++++++++++++++++++++ arch/c6x/kernel/switch_to.S | 74 ++++++++++ 4 files changed, 591 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/processor.h create mode 100644 arch/c6x/include/asm/thread_info.h create mode 100644 arch/c6x/kernel/process.c create mode 100644 arch/c6x/kernel/switch_to.S
arch/c6x/include/asm/processor.h new file +132 -0
@@ -0,0 +1,132 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* Updated for 2.6.34: Mark Salter <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_PROCESSOR_H +#define _ASM_C6X_PROCESSOR_H + +#include <asm/ptrace.h> +#include <asm/page.h> +#include <asm/current.h> + +/* +* Default implementation of macro that returns current +* instruction pointer ("program counter"). +*/ +#define current_text_addr () \ +({ \ + void *__pc; \ + asm("mvc .S2 pce1,%0\n" : "=b"(__pc)); \ + __pc; \ +}) + +/* +* User space process size. This is mostly meaningless for NOMMU +* but some C6X processors may have RAM addresses up to 0xFFFFFFFF. +* Since calls like mmap() can return an address or an error, we +* have to allow room for error returns when code does something +* like: +* +* addr = do_mmap(...) +* if ((unsigned long)addr >= TASK_SIZE) +* ... its an error code, not an address ... +* +* Here, we allow for 4096 error codes which means we really can't +* use the last 4K page on systems with RAM extending all the way +* to the end of the 32-bit address space. +*/ +#define TASK_SIZE 0xFFFFF000 + +/* +* This decides where the kernel will search for a free chunk of vm +* space during mmap's. We won't be using it +*/ +#define TASK_UNMAPPED_BASE 0 + +struct thread_struct { +unsigned long long b15_14; +unsigned long long a15_14; +unsigned long long b13_12; +unsigned long long a13_12; +unsigned long long b11_10; +unsigned long long a11_10; +unsigned long long ricl_icl; +unsigned long usp;/* user stack pointer */ +unsigned long pc;/* kernel pc */ +unsigned long wchan; +}; + +#define INIT_THREAD \ +{ \ + .usp = 0, \ + .wchan = 0, \ +} + +#define INIT_MMAP { \ + &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, \ + NULL, NULL } + +#define task_pt_regs (task) \ + ((struct pt_regs *)(THREAD_START_SP + task_stack_page(task)) - 1) + +#define alloc_kernel_stack () __get_free_page(GFP_KERNEL) +#define free_kernel_stack (page) free_page((page)) + + +/* Forward declaration, a strange C thing */ +struct task_struct ; + +extern void start_thread (struct pt_regs *regs,unsigned int pc, +unsigned long usp); + +/* Free all resources held by a thread. */ +static inline void release_thread (struct task_struct *dead_task) +{ +} + +/* Prepare to copy thread state - unlazy all lazy status */ +#define prepare_to_copy (tsk) do { } while (0) + +extern int kernel_thread (int (*fn)(void *),void * arg,unsigned long flags); + +#define copy_segments (tsk, mm) do { } while (0) +#define release_segments (mm) do { } while (0) + +/* +* saved PC of a blocked thread. +*/ +#define thread_saved_pc (tsk) (task_pt_regs(tsk)->pc) + +/* +* saved kernel SP and DP of a blocked thread. +*/ +#ifdef _BIG_ENDIAN +#define thread_saved_ksp (tsk) \ + (*(unsigned long *)&(tsk)->thread.b15_14) +#define thread_saved_dp (tsk) \ + (*(((unsigned long *)&(tsk)->thread.b15_14) + 1)) +#else +#define thread_saved_ksp (tsk) \ + (*(((unsigned long *)&(tsk)->thread.b15_14) + 1)) +#define thread_saved_dp (tsk) \ + (*(unsigned long *)&(tsk)->thread.b15_14) +#endif + +extern unsigned long get_wchan (struct task_struct *p); + +#define KSTK_EIP (tsk) (task_pt_regs(task)->pc) +#define KSTK_ESP (tsk) (task_pt_regs(task)->sp) + +#define cpu_relax () do { } while (0) + +extern const struct seq_operations cpuinfo_op; + +#endif /* ASM_C6X_PROCESSOR_H */
arch/c6x/include/asm/thread_info.h new file +121 -0
121 lines not on this page · raw message
arch/c6x/kernel/process.c new file +264 -0
264 lines not on this page · raw message
arch/c6x/kernel/switch_to.S new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 9/24 C6X: signal management
In reply to Mark Salter--- arch/c6x/include/asm/sigcontext.h | 80 ++++++++ arch/c6x/include/asm/signal.h | 17 ++ arch/c6x/kernel/signal.c | 377 +++++++++++++++++++++++++++++++++++++ 3 files changed, 474 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/sigcontext.h create mode 100644 arch/c6x/include/asm/signal.h create mode 100644 arch/c6x/kernel/signal.c
arch/c6x/include/asm/sigcontext.h new file +80 -0
@@ -0,0 +1,80 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_SIGCONTEXT_H +#define _ASM_C6X_SIGCONTEXT_H + + +struct sigcontext { +unsigned long sc_mask;/* old sigmask */ +unsigned long sc_sp;/* old user stack pointer */ + +unsigned long sc_a4; +unsigned long sc_b4; +unsigned long sc_a6; +unsigned long sc_b6; +unsigned long sc_a8; +unsigned long sc_b8; + +unsigned long sc_a0; +unsigned long sc_a1; +unsigned long sc_a2; +unsigned long sc_a3; +unsigned long sc_a5; +unsigned long sc_a7; +unsigned long sc_a9; + +unsigned long sc_b0; +unsigned long sc_b1; +unsigned long sc_b2; +unsigned long sc_b3; +unsigned long sc_b5; +unsigned long sc_b7; +unsigned long sc_b9; + +unsigned long sc_a16; +unsigned long sc_a17; +unsigned long sc_a18; +unsigned long sc_a19; +unsigned long sc_a20; +unsigned long sc_a21; +unsigned long sc_a22; +unsigned long sc_a23; +unsigned long sc_a24; +unsigned long sc_a25; +unsigned long sc_a26; +unsigned long sc_a27; +unsigned long sc_a28; +unsigned long sc_a29; +unsigned long sc_a30; +unsigned long sc_a31; + +unsigned long sc_b16; +unsigned long sc_b17; +unsigned long sc_b18; +unsigned long sc_b19; +unsigned long sc_b20; +unsigned long sc_b21; +unsigned long sc_b22; +unsigned long sc_b23; +unsigned long sc_b24; +unsigned long sc_b25; +unsigned long sc_b26; +unsigned long sc_b27; +unsigned long sc_b28; +unsigned long sc_b29; +unsigned long sc_b30; +unsigned long sc_b31; + +unsigned long sc_csr; +unsigned long sc_pc; +}; + +#endif /* _ASM_C6X_SIGCONTEXT_H */
arch/c6x/include/asm/signal.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef _ASM_C6X_SIGNAL_H +#define _ASM_C6X_SIGNAL_H + +#include <asm-generic/signal.h> + +#ifndef __ASSEMBLY__ +#include <linux/linkage.h> + +struct pt_regs ; + +extern asmlinkage int do_rt_sigreturn(struct pt_regs *regs); +extern asmlinkage void do_notify_resume(struct pt_regs *regs, +u32 thread_info_flags, +int syscall); +#endif + +#endif /* _ASM_C6X_SIGNAL_H */
arch/c6x/kernel/signal.c new file +377 -0
377 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 10/24 C6X: time management
In reply to Mark Salter--- arch/c6x/include/asm/timex.h | 41 +++++++++ arch/c6x/kernel/time.c | 72 ++++++++++++++++ arch/c6x/platforms/timer64.c | 191 ++++++++++++++++++++++++++++++++++++++++++ arch/c6x/platforms/timer64.h | 6 ++ 4 files changed, 310 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/timex.h create mode 100644 arch/c6x/kernel/time.c create mode 100644 arch/c6x/platforms/timer64.c create mode 100644 arch/c6x/platforms/timer64.h
arch/c6x/include/asm/timex.h new file +41 -0
@@ -0,0 +1,41 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* Modified for 2.6.34: Mark Salter <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_TIMEX_H +#define _ASM_C6X_TIMEX_H + +/* +* This should be close enough... +*/ +#define CLOCK_TICK_RATE ((1000 * 1000000UL) / 6) + +/* 64-bit timestamp */ +typedef unsigned long long cycles_t ; + +extern cycles_t cacheflush_time; + +static inline cycles_t get_cycles (void ) +{ +unsigned l, h; + + asmvolatile (" dint\n" +" mvc .s2 TSCL,%0\n" +" mvc .s2 TSCH,%1\n" +" rint\n" + :"=b" (l),"=b" (h)); +return ((cycles_t )h <<32 ) | l; +} + +extern int init_tsc_clocksource (void ); +extern int init_timer64_clocksource (void ); + +#endif /* _ASM_C6X_TIMEX_H */
arch/c6x/kernel/time.c new file +72 -0
72 lines not on this page · raw message
arch/c6x/platforms/timer64.c new file +191 -0
191 lines not on this page · raw message
arch/c6x/platforms/timer64.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _C6X_TIMER64_PIC_H +#define _C6X_TIMER64_PIC_H + +extern void __init timer64_init (void ); + +#endif /* _C6X_TIMER64_PIC_H */
Signature · 1 line
1.7.6
PATCH 11/24 C6X: interrupt handling
In reply to Mark Salter--- arch/c6x/include/asm/hardirq.h | 20 + arch/c6x/include/asm/irq.h | 300 ++++++++++++++++ arch/c6x/include/asm/irqflags.h | 72 ++++ arch/c6x/kernel/irq.c | 736 ++++++++++++++++++++++++++++++++++++++ arch/c6x/platforms/megamod-pic.c | 335 +++++++++++++++++ arch/c6x/platforms/megamod-pic.h | 9 + 6 files changed, 1472 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/hardirq.h create mode 100644 arch/c6x/include/asm/irq.h create mode 100644 arch/c6x/include/asm/irqflags.h create mode 100644 arch/c6x/kernel/irq.c create mode 100644 arch/c6x/platforms/megamod-pic.c create mode 100644 arch/c6x/platforms/megamod-pic.h
arch/c6x/include/asm/hardirq.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef _ASM_C6X_HARDIRQ_H +#define _ASM_C6X_HARDIRQ_H + +extern void ack_bad_irq (int irq); +#define ack_bad_irq ack_bad_irq + +#include <asm-generic/hardirq.h> + +#endif /* _ASM_C6X_HARDIRQ_H */
arch/c6x/include/asm/irq.h new file +300 -0
300 lines not on this page · raw message
arch/c6x/include/asm/irqflags.h new file +72 -0
72 lines not on this page · raw message
arch/c6x/kernel/irq.c new file +736 -0
736 lines not on this page · raw message
arch/c6x/platforms/megamod-pic.c new file +335 -0
335 lines not on this page · raw message
arch/c6x/platforms/megamod-pic.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _C6X_MEGAMOD_PIC_H +#define _C6X_MEGAMOD_PIC_H + +#ifdef __KERNEL__ + +extern void __init megamod_pic_init (void ); + +#endif /* __KERNEL__ */ +#endif /* _C6X_MEGAMOD_PIC_H */
Signature · 1 line
1.7.6
PATCH 12/24 C6X: syscalls
In reply to Mark Salter--- arch/c6x/include/asm/syscalls.h | 56 ++++++++++++++++++++++++++ arch/c6x/include/asm/unistd.h | 32 +++++++++++++++ arch/c6x/kernel/sys_c6x.c | 82 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/syscalls.h create mode 100644 arch/c6x/include/asm/unistd.h create mode 100644 arch/c6x/kernel/sys_c6x.c
arch/c6x/include/asm/syscalls.h new file +56 -0
@@ -0,0 +1,56 @@ +/* +* Copyright (C) 2011 Texas Instruments Incorporated +* Author: Mark Salter <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation, version 2. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or +* NON INFRINGEMENT. See the GNU General Public License for +* more details. +*/ + +#ifndef __ASM_C6X_SYSCALLS_H +#define __ASM_C6X_SYSCALLS_H + +#include <linux/compiler.h> +#include <linux/linkage.h> +#include <linux/types.h> + +/* The array of function pointers for syscalls. */ +extern void *sys_call_table[]; + +/* The following are trampolines in entry.S to handle 64-bit arguments */ +extern long sys_pread_c6x (unsigned int fd,char __user *buf, +size_t count,off_t pos_low,off_t pos_high); +extern long sys_pwrite_c6x (unsigned int fd,const char __user *buf, +size_t count,off_t pos_low,off_t pos_high); +extern long sys_truncate64_c6x (const char __user *path, +off_t length_low,off_t length_high); +extern long sys_ftruncate64_c6x (unsigned int fd, +off_t length_low,off_t length_high); +extern long sys_fadvise64_c6x (int fd,u32 offset_lo,u32 offset_hi, +u32 len,int advice); +extern long sys_fadvise64_64_c6x (int fd,u32 offset_lo,u32 offset_hi, +u32 len_lo,u32 len_hi,int advice); +extern long sys_fallocate_c6x (int fd,int mode, +u32 offset_lo,u32 offset_hi, +u32 len_lo,u32 len_hi); +extern int sys_cache_sync (unsigned long s,unsigned long e); + +struct pt_regs ; + +extern asmlinkage int c6x_vfork(struct pt_regs *regs); +extern asmlinkage int c6x_clone(struct pt_regs *regs); +extern asmlinkage long c6x_execve (const char __user *name, +const char __user *const __user *argv, +const char __user *const __user *envp, +struct pt_regs *regs); + + +#include <asm-generic/syscalls.h> + +#endif /* __ASM_C6X_SYSCALLS_H */
arch/c6x/include/asm/unistd.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright (C) 2011 Texas Instruments Incorporated +* +* Based on arch/tile version. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation, version 2. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or +* NON INFRINGEMENT. See the GNU General Public License for +* more details. +*/ +#if !defined(_ASM_C6X_UNISTD_H) || defined(__SYSCALL) +#define _ASM_C6X_UNISTD_H + +#define __ARCH_WANT_SYSCALL_DEPRECATED +#define __ARCH_WANT_SYSCALL_NO_AT +#define __ARCH_WANT_SYSCALL_NO_FLAGS +#define __ARCH_WANT_SYSCALL_OFF_T +#define __ARCH_WANT_IPC_PARSE_VERSION + +/* Use the standard ABI for syscalls. */ +#include <asm-generic/unistd.h> + +/* C6X-specific syscalls. */ +#define __NR_cache_sync (__NR_arch_specific_syscall + 0) +__SYSCALL(__NR_cache_sync, sys_cache_sync) + +#endif /* _ASM_C6X_UNISTD_H */
arch/c6x/kernel/sys_c6x.c new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 13/24 C6X: traps
In reply to Mark Salter--- arch/c6x/include/asm/traps.h | 37 ++ arch/c6x/kernel/asm-offsets.c | 123 ++++++ arch/c6x/kernel/entry.S | 815 +++++++++++++++++++++++++++++++++++++++++ arch/c6x/kernel/traps.c | 421 +++++++++++++++++++++ 4 files changed, 1396 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/traps.h create mode 100644 arch/c6x/kernel/asm-offsets.c create mode 100644 arch/c6x/kernel/entry.S create mode 100644 arch/c6x/kernel/traps.c
arch/c6x/include/asm/traps.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009, 2011 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_TRAPS_H +#define _ASM_C6X_TRAPS_H + +#ifdef CONFIG_TMS320C64XPLUS + +#define EXCEPT_TYPE_NXF 31/* NMI */ +#define EXCEPT_TYPE_EXC 30/* external exception */ +#define EXCEPT_TYPE_IXF 1/* internal exception */ +#define EXCEPT_TYPE_SXF 0/* software exception */ + +#define EXCEPT_CAUSE_LBX (1 << 7)/* loop buffer exception */ +#define EXCEPT_CAUSE_PRX (1 << 6)/* privilege exception */ +#define EXCEPT_CAUSE_RAX (1 << 5)/* resource access exception */ +#define EXCEPT_CAUSE_RCX (1 << 4)/* resource conflict exception */ +#define EXCEPT_CAUSE_OPX (1 << 3)/* opcode exception */ +#define EXCEPT_CAUSE_EPX (1 << 2)/* execute packet exception */ +#define EXCEPT_CAUSE_FPX (1 << 1)/* fetch packet exception */ +#define EXCEPT_CAUSE_IFX (1 << 0)/* instruction fetch exception */ + +struct exception_info { +char *kernel_str; +int signo; +int code; +}; + +#endif /* CONFIG_TMS320C64XPLUS */ +#endif /* _ASM_C6X_TRAPS_H */
arch/c6x/kernel/asm-offsets.c new file +123 -0
123 lines not on this page · raw message
arch/c6x/kernel/entry.S new file +815 -0
815 lines not on this page · raw message
arch/c6x/kernel/traps.c new file +421 -0
421 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 14/24 C6X: clocks
In reply to Mark Salter--- arch/c6x/include/asm/clkdev.h | 22 ++ arch/c6x/include/asm/clock.h | 146 +++++++++++++ arch/c6x/platforms/pll.c | 470 +++++++++++++++++++++++++++++++++++++++++ arch/c6x/platforms/plldata.c | 152 +++++++++++++ 4 files changed, 790 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/clkdev.h create mode 100644 arch/c6x/include/asm/clock.h create mode 100644 arch/c6x/platforms/pll.c create mode 100644 arch/c6x/platforms/plldata.c
arch/c6x/include/asm/clkdev.h new file +22 -0
@@ -0,0 +1,22 @@ +#ifndef _ASM_CLKDEV_H +#define _ASM_CLKDEV_H + +#include <linux/slab.h> + +struct clk ; + +static inline int __clk_get (struct clk *clk) +{ +return 1 ; +} + +static inline void __clk_put (struct clk *clk) +{ +} + +static inline struct clk_lookup_alloc *__clkdev_alloc (size_t size) +{ +return kzalloc (size,GFP_KERNEL ); +} + +#endif /* _ASM_CLKDEV_H */
arch/c6x/include/asm/clock.h new file +146 -0
146 lines not on this page · raw message
arch/c6x/platforms/pll.c new file +470 -0
470 lines not on this page · raw message
arch/c6x/platforms/plldata.c new file +152 -0
152 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 15/24 C6X: cache control
In reply to Mark Salter--- arch/c6x/include/asm/cache.h | 84 +++++++ arch/c6x/include/asm/cacheflush.h | 65 ++++++ arch/c6x/platforms/cache.c | 435 +++++++++++++++++++++++++++++++++++++ 3 files changed, 584 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/cache.h create mode 100644 arch/c6x/include/asm/cacheflush.h create mode 100644 arch/c6x/platforms/cache.c
arch/c6x/include/asm/cache.h new file +84 -0
@@ -0,0 +1,84 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2005, 2006, 2009, 2010 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_CACHE_H +#define _ASM_C6X_CACHE_H + +#include <linux/irqflags.h> + +/* +* Cache line size +*/ +#define L1D_CACHE_BYTES 64 +#define L1P_CACHE_BYTES 32 +#define L2_CACHE_BYTES 128 + +/* +* L2 used as cache +*/ +#define L2MODE_SIZE L2MODE_256K_CACHE + +/* +* Physical memory granularity for MAR registers +*/ +#define IMCR_MAR_SIZE 0x01000000 + +/* +* Current C6x architecture does not support hw cache coherency +*/ +#define arch_is_coherent () 0 + +/* +* For practical reasons the L1_CACHE_BYTES defines should not be smaller than +* the L2 line size +*/ +#define L1_CACHE_BYTES L2_CACHE_BYTES + +#define L2_CACHE_ALIGN_LOW (x) \ + (((x) & ~(L2_CACHE_BYTES - 1))) +#define L2_CACHE_ALIGN_UP (x) \ + (((x) + (L2_CACHE_BYTES - 1)) & ~(L2_CACHE_BYTES - 1)) +#define L2_CACHE_ALIGN_CNT (x) \ + (((x) + (sizeof(int) - 1)) & ~(sizeof(int) - 1)) + +#define ARCH_DMA_MINALIGN L1_CACHE_BYTES +#define ARCH_SLAB_MINALIGN L1_CACHE_BYTES + +/* +* Align a physical address to MAR regions +*/ +#define CACHE_REGION_START (v) \ + (((u32) (v)) & ~(IMCR_MAR_SIZE - 1)) +#define CACHE_REGION_END (v) \ + (((u32) (v) + (IMCR_MAR_SIZE - 1)) & ~(IMCR_MAR_SIZE - 1)) + +extern void __init c6x_cache_init (void ); + +extern void enable_caching (unsigned long start,unsigned long end); +extern void disable_caching (unsigned long start,unsigned long end); + +extern void L1P_cache_block_invalidate (unsigned int start,unsigned int end); +extern void L1D_cache_block_invalidate (unsigned int start,unsigned int end); +extern void L1D_cache_block_writeback_invalidate (unsigned int start, +unsigned int end); +extern void L1D_cache_block_writeback (unsigned int start,unsigned int end); +extern void L2_cache_block_invalidate (unsigned int start,unsigned int end); +extern void L2_cache_block_writeback (unsigned int start,unsigned int end); +extern void L2_cache_block_writeback_invalidate (unsigned int start, +unsigned int end); +extern void L2_cache_block_invalidate_nowait (unsigned int start, +unsigned int end); +extern void L2_cache_block_writeback_nowait (unsigned int start, +unsigned int end); + +extern void L2_cache_block_writeback_invalidate_nowait (unsigned int start, +unsigned int end); + +#endif /* _ASM_C6X_CACHE_H */
arch/c6x/include/asm/cacheflush.h new file +65 -0
65 lines not on this page · raw message
arch/c6x/platforms/cache.c new file +435 -0
435 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 16/24 C6X: module support
In reply to Mark Salter--- arch/c6x/include/asm/module.h | 33 ++++++ arch/c6x/kernel/c6x_ksyms.c | 72 ++++++++++++ arch/c6x/kernel/module.c | 238 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 343 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/module.h create mode 100644 arch/c6x/kernel/c6x_ksyms.c create mode 100644 arch/c6x/kernel/module.c
arch/c6x/include/asm/module.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* Updated for 2.6.34 by: Mark Salter ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_MODULE_H +#define _ASM_C6X_MODULE_H + +#define Elf_Shdr Elf32_Shdr +#define Elf_Sym Elf32_Sym +#define Elf_Ehdr Elf32_Ehdr +#define Elf_Addr Elf32_Addr +#define Elf_Word Elf32_Word + +/* +* This file contains the C6x architecture specific module code. +*/ +struct mod_arch_specific { +}; + +struct loaded_sections { +unsigned int new_vaddr; +unsigned int loaded; +}; + +#endif /* _ASM_C6X_MODULE_H */
arch/c6x/kernel/c6x_ksyms.c new file +72 -0
72 lines not on this page · raw message
arch/c6x/kernel/module.c new file +238 -0
238 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 17/24 C6X: ptrace support
In reply to Mark Salter--- arch/c6x/include/asm/ptrace.h | 181 ++++++++++++++++++++++++++++++ arch/c6x/kernel/ptrace.c | 246 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 427 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/ptrace.h create mode 100644 arch/c6x/kernel/ptrace.c
arch/c6x/include/asm/ptrace.h new file +181 -0
@@ -0,0 +1,181 @@ +/* +* Copyright (C) 2004, 2006, 2009, 2010 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* Updated for 2.6.34: Mark Salter <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_PTRACE_H +#define _ASM_C6X_PTRACE_H + +#if defined(__TMS320C6XPLUS__) || defined(_TMS320C6400_PLUS) +#define BKPT_OPCODE 0x56454314/* illegal opcode */ +#else +#define BKPT_OPCODE 0x0000a122/* BNOP .S2 0,5 */ +#endif + +#ifdef _BIG_ENDIAN +#define PT_LO (odd, even) odd +#define PT_HI (odd, even) even +#else +#define PT_LO (odd, even) even +#define PT_HI (odd, even) odd +#endif + +#define PT_A4_ORG PT_LO(1, 0) +#define PT_TSR PT_HI(1, 0) +#define PT_ILC PT_LO(3, 2) +#define PT_RILC PT_HI(3, 2) +#define PT_CSR PT_LO(5, 4) +#define PT_PC PT_HI(5, 4) +#define PT_B16 PT_LO(7, 6) +#define PT_B17 PT_HI(7, 6) +#define PT_B18 PT_LO(9, 8) +#define PT_B19 PT_HI(9, 8) +#define PT_B20 PT_LO(11, 10) +#define PT_B21 PT_HI(11, 10) +#define PT_B22 PT_LO(13, 12) +#define PT_B23 PT_HI(13, 12) +#define PT_B24 PT_LO(15, 14) +#define PT_B25 PT_HI(15, 14) +#define PT_B26 PT_LO(17, 16) +#define PT_B27 PT_HI(17, 16) +#define PT_B28 PT_LO(19, 18) +#define PT_B29 PT_HI(19, 18) +#define PT_B30 PT_LO(21, 20) +#define PT_B31 PT_HI(21, 20) +#define PT_B0 PT_LO(23, 22) +#define PT_B1 PT_HI(23, 22) +#define PT_B2 PT_LO(25, 24) +#define PT_B3 PT_HI(25, 24) +#define PT_B4 PT_LO(27, 26) +#define PT_B5 PT_HI(27, 26) +#define PT_B6 PT_LO(29, 28) +#define PT_B7 PT_HI(29, 28) +#define PT_B8 PT_LO(31, 30) +#define PT_B9 PT_HI(31, 30) +#define PT_B10 PT_LO(33, 32) +#define PT_B11 PT_HI(33, 32) +#define PT_B12 PT_LO(35, 34) +#define PT_B13 PT_HI(35, 34) +#define PT_A16 PT_LO(37, 36) +#define PT_A17 PT_HI(37, 36) +#define PT_A18 PT_LO(39, 38) +#define PT_A19 PT_HI(39, 38) +#define PT_A20 PT_LO(41, 40) +#define PT_A21 PT_HI(41, 40) +#define PT_A22 PT_LO(43, 42) +#define PT_A23 PT_HI(43, 42) +#define PT_A24 PT_LO(45, 44) +#define PT_A25 PT_HI(45, 44) +#define PT_A26 PT_LO(47, 46) +#define PT_A27 PT_HI(47, 46) +#define PT_A28 PT_LO(49, 48) +#define PT_A29 PT_HI(49, 48) +#define PT_A30 PT_LO(51, 50) +#define PT_A31 PT_HI(51, 50) +#define PT_A0 PT_LO(53, 52) +#define PT_A1 PT_HI(53, 52) +#define PT_A2 PT_LO(55, 54) +#define PT_A3 PT_HI(55, 54) +#define PT_A4 PT_LO(57, 56) +#define PT_A5 PT_HI(57, 56) +#define PT_A6 PT_LO(59, 58) +#define PT_A7 PT_HI(59, 58) +#define PT_A8 PT_LO(61, 60) +#define PT_A9 PT_HI(61, 60) +#define PT_A10 PT_LO(63, 62) +#define PT_A11 PT_HI(63, 62) +#define PT_A12 PT_LO(65, 64) +#define PT_A13 PT_HI(65, 64) +#define PT_A14 PT_LO(67, 66) +#define PT_A15 PT_HI(67, 66) +#define PT_B14 PT_LO(69, 68) +#define PT_B15 PT_HI(69, 68) + +#define NR_PTREGS 70 + +#define PT_DP PT_B14/* Data Segment Pointer (B14) */ +#define PT_SP PT_B15/* Stack Pointer (B15) */ + +#ifndef __ASSEMBLY__ + +#ifdef _BIG_ENDIAN +#define REG_PAIR (odd, even) unsigned long odd; unsigned long even +#else +#define REG_PAIR (odd, even) unsigned long even; unsigned long odd +#endif + +/* +* this struct defines the way the registers are stored on the +* stack during a system call. fields defined with REG_PAIR +* are saved and restored using double-word memory operations +* which means the word ordering of the pair depends on endianess. +*/ +struct pt_regs { + REG_PAIR(tsr, orig_a4); + REG_PAIR(rilc, ilc); + REG_PAIR(pc, csr); + + REG_PAIR(b17, b16); + REG_PAIR(b19, b18); + REG_PAIR(b21, b20); + REG_PAIR(b23, b22); + REG_PAIR(b25, b24); + REG_PAIR(b27, b26); + REG_PAIR(b29, b28); + REG_PAIR(b31, b30); + + REG_PAIR(b1, b0); + REG_PAIR(b3, b2); + REG_PAIR(b5, b4); + REG_PAIR(b7, b6); + REG_PAIR(b9, b8); + REG_PAIR(b11, b10); + REG_PAIR(b13, b12); + + REG_PAIR(a17, a16); + REG_PAIR(a19, a18); + REG_PAIR(a21, a20); + REG_PAIR(a23, a22); + REG_PAIR(a25, a24); + REG_PAIR(a27, a26); + REG_PAIR(a29, a28); + REG_PAIR(a31, a30); + + REG_PAIR(a1, a0); + REG_PAIR(a3, a2); + REG_PAIR(a5, a4); + REG_PAIR(a7, a6); + REG_PAIR(a9, a8); + REG_PAIR(a11, a10); + REG_PAIR(a13, a12); + + REG_PAIR(a15, a14); + REG_PAIR(sp, dp); +}; + +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 + +#ifdef __KERNEL__ + +#include <linux/linkage.h> + +#define user_mode (regs) ((((regs)->tsr) & 0x40) != 0) + +#define instruction_pointer (regs) ((regs)->pc) +#define profile_pc (regs) instruction_pointer(regs) +extern void show_regs (struct pt_regs *); + +extern asmlinkage unsigned long syscall_trace_entry (struct pt_regs *regs); +extern asmlinkage void syscall_trace_exit(struct pt_regs *regs); + +#endif /* __KERNEL__ */ +#endif /* __ASSEMBLY__ */ +#endif /* _ASM_C6X_PTRACE_H */
arch/c6x/kernel/ptrace.c new file +246 -0
246 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 18/24 C6X: headers
In reply to Mark Salter--- arch/c6x/include/asm/asm-offsets.h | 1 + arch/c6x/include/asm/bitops.h | 105 +++++++++++++ arch/c6x/include/asm/byteorder.h | 12 ++ arch/c6x/include/asm/delay.h | 67 +++++++++ arch/c6x/include/asm/elf.h | 113 ++++++++++++++ arch/c6x/include/asm/ftrace.h | 6 + arch/c6x/include/asm/linkage.h | 30 ++++ arch/c6x/include/asm/memblock.h | 4 + arch/c6x/include/asm/mmu.h | 18 +++ arch/c6x/include/asm/mutex.h | 6 + arch/c6x/include/asm/page.h | 11 ++ arch/c6x/include/asm/pgtable.h | 81 ++++++++++ arch/c6x/include/asm/procinfo.h | 28 ++++ arch/c6x/include/asm/prom.h | 1 + arch/c6x/include/asm/sections.h | 12 ++ arch/c6x/include/asm/setup.h | 27 ++++ arch/c6x/include/asm/string.h | 21 +++ arch/c6x/include/asm/system.h | 193 ++++++++++++++++++++++++ arch/c6x/include/asm/tlb.h | 8 + arch/c6x/include/asm/uaccess.h | 107 +++++++++++++ arch/c6x/include/asm/unaligned.h | 288 ++++++++++++++++++++++++++++++++++++ 21 files changed, 1139 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/asm-offsets.h create mode 100644 arch/c6x/include/asm/bitops.h create mode 100644 arch/c6x/include/asm/byteorder.h create mode 100644 arch/c6x/include/asm/delay.h create mode 100644 arch/c6x/include/asm/elf.h create mode 100644 arch/c6x/include/asm/ftrace.h create mode 100644 arch/c6x/include/asm/linkage.h create mode 100644 arch/c6x/include/asm/memblock.h create mode 100644 arch/c6x/include/asm/mmu.h create mode 100644 arch/c6x/include/asm/mutex.h create mode 100644 arch/c6x/include/asm/page.h create mode 100644 arch/c6x/include/asm/pgtable.h create mode 100644 arch/c6x/include/asm/procinfo.h create mode 100644 arch/c6x/include/asm/prom.h create mode 100644 arch/c6x/include/asm/sections.h create mode 100644 arch/c6x/include/asm/setup.h create mode 100644 arch/c6x/include/asm/string.h create mode 100644 arch/c6x/include/asm/system.h create mode 100644 arch/c6x/include/asm/tlb.h create mode 100644 arch/c6x/include/asm/uaccess.h create mode 100644 arch/c6x/include/asm/unaligned.h
arch/c6x/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/c6x/include/asm/bitops.h new file +105 -0
105 lines not on this page · raw message
arch/c6x/include/asm/byteorder.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef _ASM_C6X_BYTEORDER_H +#define _ASM_C6X_BYTEORDER_H + +#include <asm/types.h> + +#ifdef _BIG_ENDIAN +#include <linux/byteorder/big_endian.h> +#else /* _BIG_ENDIAN */ +#include <linux/byteorder/little_endian.h> +#endif /* _BIG_ENDIAN */ + +#endif /* _ASM_BYTEORDER_H */
arch/c6x/include/asm/delay.h new file +67 -0
67 lines not on this page · raw message
arch/c6x/include/asm/elf.h new file +113 -0
113 lines not on this page · raw message
arch/c6x/include/asm/ftrace.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _ASM_C6X_FTRACE_H +#define _ASM_C6X_FTRACE_H + +/* empty */ + +#endif /* _ASM_C6X_FTRACE_H */
arch/c6x/include/asm/linkage.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef _ASM_C6X_LINKAGE_H +#define _ASM_C6X_LINKAGE_H + +#ifdef __ASSEMBLER__ + +#define __ALIGN .align 2 +#define __ALIGN_STR ".align 2" + +#ifndef __DSBT__ +#define ENTRY (name) \ + .global name @ \ + __ALIGN @ \ +name: +#else +#define ENTRY (name) \ + .global name @ \ + .hidden name @ \ + __ALIGN @ \ +name: +#endif + +#define ENDPROC (name) \ + .type name, @function @ \ + .size name, . - name + +#endif + +#include <asm-generic/linkage.h> + +#endif /* _ASM_C6X_LINKAGE_H */
arch/c6x/include/asm/memblock.h new file +4 -0
@@ -0,0 +1,4 @@ +#ifndef _ASM_C6X_MEMBLOCK_H +#define _ASM_C6X_MEMBLOCK_H + +#endif /* _ASM_C6X_MEMBLOCK_H */
arch/c6x/include/asm/mmu.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_MMU_H +#define _ASM_C6X_MMU_H + +typedef struct { +unsigned long end_brk; +}mm_context_t ; + +#endif /* _ASM_C6X_MMU_H */
arch/c6x/include/asm/mutex.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _ASM_C6X_MUTEX_H +#define _ASM_C6X_MUTEX_H + +#include <asm-generic/mutex-null.h> + +#endif /* _ASM_C6X_MUTEX_H */
arch/c6x/include/asm/page.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef _ASM_C6X_PAGE_H +#define _ASM_C6X_PAGE_H + +#define VM_DATA_DEFAULT_FLAGS \ + (VM_READ | VM_WRITE | \ + ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \ + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) + +#include <asm-generic/page.h> + +#endif /* _ASM_C6X_PAGE_H */
arch/c6x/include/asm/pgtable.h new file +81 -0
81 lines not on this page · raw message
arch/c6x/include/asm/procinfo.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright (C) 2010 Texas Instruments Incorporated +* Author: Mark Salter ([email protected]) +* +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_PROCINFO_H +#define _ASM_C6X_PROCINFO_H + +#ifdef __KERNEL__ + +struct proc_info_list { +unsigned int cpu_val; +unsigned int cpu_mask; +const char *arch_name; +const char *elf_name; +unsigned int elf_hwcap; +}; + +#else /* __KERNEL__ */ +#include <asm/elf.h> +#warning "Please include asm/elf.h instead" +#endif /* __KERNEL__ */ + +#endif /* _ASM_C6X_PROCINFO_H */
arch/c6x/include/asm/prom.h new file +1 -0
@@ -0,0 +1 @@ +/* dummy prom.h; here to make linux/of.h's #includes happy */
arch/c6x/include/asm/sections.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef _ASM_C6X_SECTIONS_H +#define _ASM_C6X_SECTIONS_H + +#include <asm-generic/sections.h> + +extern char _vectors_start[]; +extern char _vectors_end[]; + +extern char _data_lma[]; +extern char _fdt_start[], _fdt_end[]; + +#endif /* _ASM_C6X_SECTIONS_H */
arch/c6x/include/asm/setup.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009, 2010 2011 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_SETUP_H +#define _ASM_C6X_SETUP_H + +#define COMMAND_LINE_SIZE 1024 + +#ifndef __ASSEMBLY__ +extern char c6x_command_line[COMMAND_LINE_SIZE ]; + +extern int c6x_add_memory (phys_addr_t start,unsigned long size); + +extern unsigned long ram_start; +extern unsigned long ram_end; + +extern int c6x_num_cores; + +#endif /* !__ASSEMBLY__ */ +#endif /* _ASM_C6X_SETUP_H */
arch/c6x/include/asm/string.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009, 2011 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_STRING_H +#define _ASM_C6X_STRING_H + +#include <asm/page.h> +#include <linux/linkage.h> + +asmlinkage extern void *memcpy(void *to, const void *from, size_t n); + +#define __HAVE_ARCH_MEMCPY + +#endif /* _ASM_C6X_STRING_H */
arch/c6x/include/asm/system.h new file +193 -0
193 lines not on this page · raw message
arch/c6x/include/asm/tlb.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef _ASM_C6X_TLB_H +#define _ASM_C6X_TLB_H + +#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) + +#include <asm-generic/tlb.h> + +#endif /* _ASM_C6X_TLB_H */
arch/c6x/include/asm/uaccess.h new file +107 -0
107 lines not on this page · raw message
arch/c6x/include/asm/unaligned.h new file +288 -0
288 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 19/24 C6X: library code
In reply to Mark Salter--- arch/c6x/include/asm/checksum.h | 115 +++++++++++ arch/c6x/lib/csum_64plus.S | 404 +++++++++++++++++++++++++++++++++++++++ arch/c6x/lib/divi.S | 53 +++++ arch/c6x/lib/divremi.S | 46 +++++ arch/c6x/lib/divremu.S | 87 +++++++++ arch/c6x/lib/divu.S | 98 ++++++++++ arch/c6x/lib/divull.c | 331 ++++++++++++++++++++++++++++++++ arch/c6x/lib/llshl.S | 37 ++++ arch/c6x/lib/llshr.S | 38 ++++ arch/c6x/lib/llshru.S | 38 ++++ arch/c6x/lib/memcpy_64plus.S | 46 +++++ arch/c6x/lib/mpyll.S | 49 +++++ arch/c6x/lib/negll.S | 31 +++ arch/c6x/lib/pop_rts.S | 32 +++ arch/c6x/lib/push_rts.S | 31 +++ arch/c6x/lib/remi.S | 64 ++++++ arch/c6x/lib/remu.S | 82 ++++++++ arch/c6x/lib/strasgi.S | 89 +++++++++ arch/c6x/lib/strasgi_64plus.S | 39 ++++ 19 files changed, 1710 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/checksum.h create mode 100644 arch/c6x/lib/csum_64plus.S create mode 100644 arch/c6x/lib/divi.S create mode 100644 arch/c6x/lib/divremi.S create mode 100644 arch/c6x/lib/divremu.S create mode 100644 arch/c6x/lib/divu.S create mode 100644 arch/c6x/lib/divull.c create mode 100644 arch/c6x/lib/llshl.S create mode 100644 arch/c6x/lib/llshr.S create mode 100644 arch/c6x/lib/llshru.S create mode 100644 arch/c6x/lib/memcpy_64plus.S create mode 100644 arch/c6x/lib/mpyll.S create mode 100644 arch/c6x/lib/negll.S create mode 100644 arch/c6x/lib/pop_rts.S create mode 100644 arch/c6x/lib/push_rts.S create mode 100644 arch/c6x/lib/remi.S create mode 100644 arch/c6x/lib/remu.S create mode 100644 arch/c6x/lib/strasgi.S create mode 100644 arch/c6x/lib/strasgi_64plus.S
arch/c6x/include/asm/checksum.h new file +115 -0
@@ -0,0 +1,115 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_CHECKSUM_H +#define _ASM_C6X_CHECKSUM_H + +#include <asm/byteorder.h> + +/* +* Computes the checksum of a memory block at buff, length len, +* and adds in "sum" (32-bit) +* +* returns a 32-bit number suitable for feeding into itself +* or csum_tcpudp_magic +* +* this function must be called with even lengths, except +* for the last fragment, which may be odd +* +* it's best to have buff aligned on a 32-bit boundary +*/ +extern __wsum csum_partial (const void *buff,int len,__wsum sum); + +/* +* The same as csum_partial, but copies from src while it checksums +* +* here even more important to align src and dst on a 32-bit (or even +* better 64-bit) boundary +*/ +extern __wsum csum_partial_copy (const void *src,void *dst, +int len,__wsum sum); + +/* +* This is a new version of the above that records errors it finds in *errp, +* but continues and zeros the rest of the buffer. +*/ +#define csum_partial_copy_nocheck csum_partial_copy + +/* +* The same as csum_partial_copy, but copies from user space. +* +* here even more important to align src and dst on a 32-bit (or even +* better 64-bit) boundary +*/ +#define csum_partial_copy_from_user (src, dst, len, sum, err_ptr) \ + csum_partial_copy(src, dst, len, sum) + +/* +* This is a version of ip_compute_csum() optimized for IP headers, +* which always checksum on 4 octet boundaries. +* +*/ +extern __sum16 ip_fast_csum (const void *iph,unsigned int ihl); + +/* +* Fold a partial checksum +*/ +static inline __sum16 csum_fold (__wsum csum) +{ +u32 sum = (u32 )csum; + sum = (sum &0xffff ) + (sum >>16 ); + sum = (sum &0xffff ) + (sum >>16 ); +return (__sum16 )~sum; +} + +/* +* Computes the checksum of the TCP/UDP pseudo-header +*/ +static inline __wsum +csum_tcpudp_nofold (__be32 saddr,__be32 daddr,unsigned short len, +unsigned short proto,__wsum sum) +{ +unsigned long long s = (__force u32 )sum; + + s += (__force u32 )saddr; + s += (__force u32 )daddr; +#ifdef _BIG_ENDIAN + s += proto + len; +#else + s += (proto + len) <<8 ; +#endif + s += (s >>32 ); + +return (__force __wsum )s; +} + +/* +* Computes the checksum of the TCP/UDP pseudo-header +* returns a 16-bit checksum, already complemented +*/ +static inline __sum16 +csum_tcpudp_magic (__be32 saddr,__be32 daddr,unsigned short len, +unsigned short proto,__wsum sum) +{ +return csum_fold (csum_tcpudp_nofold (saddr, daddr, len, proto, sum)); +} + +/* +* This routine is used for miscellaneous IP-like checksums, mainly +* in icmp.c +*/ +static inline __sum16 +ip_compute_csum (const void *buff,int len) +{ +extern unsigned int do_csum (const unsigned char *,size_t ); +return (__force __sum16 )~do_csum (buff, len); +} + +#endif /* _ASM_C6X_CHECKSUM_H */
arch/c6x/lib/csum_64plus.S new file +404 -0
404 lines not on this page · raw message
arch/c6x/lib/divi.S new file +53 -0
53 lines not on this page · raw message
arch/c6x/lib/divremi.S new file +46 -0
46 lines not on this page · raw message
arch/c6x/lib/divremu.S new file +87 -0
87 lines not on this page · raw message
arch/c6x/lib/divu.S new file +98 -0
98 lines not on this page · raw message
arch/c6x/lib/divull.c new file +331 -0
331 lines not on this page · raw message
arch/c6x/lib/llshl.S new file +37 -0
@@ -0,0 +1,37 @@ +;; Copyright (C) 2010 Texas Instruments Incorporated +;; Contributed by Mark Salter <[email protected]>. +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +;; uint64_t __c6xabi_llshl(uint64_t val, uint shift) + +#include <linux/linkage.h> + + .text +ENTRY(__c6xabi_llshl) + mv .l1x B4,A1 + [!A1] b .s2 B3 ; just return if zero shift + mvk .s1 32,A0 + sub .d1 A0,A1,A0 + cmplt .l1 0,A0,A2 + [A2] shru .s1 A4,A0,A0 + [!A2] neg .l1 A0,A5 +|| [A2] shl .s1 A5,A1,A5 + [!A2] shl .s1 A4,A5,A5 +|| [A2] or .d1 A5,A0,A5 +|| [!A2] mvk .l1 0,A4 + [A2] shl .s1 A4,A1,A4 + bnop .s2 B3,5 +ENDPROC(__c6xabi_llshl)
arch/c6x/lib/llshr.S new file +38 -0
@@ -0,0 +1,38 @@ +;; Copyright (C) 2010 Texas Instruments Incorporated +;; Contributed by Mark Salter <[email protected]>. +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +;; uint64_t __c6xabi_llshr(uint64_t val, uint shift) + +#include <linux/linkage.h> + + .text +ENTRY(__c6xabi_llshr) + mv .l1x B4,A1 + [!A1] b .s2 B3 ; return if zero shift count + mvk .s1 32,A0 + sub .d1 A0,A1,A0 + cmplt .l1 0,A0,A2 + [A2] shl .s1 A5,A0,A0 + nop + [!A2] neg .l1 A0,A4 +|| [A2] shru .s1 A4,A1,A4 + [!A2] shr .s1 A5,A4,A4 +|| [A2] or .d1 A4,A0,A4 + [!A2] shr .s1 A5,0x1f,A5 + [A2] shr .s1 A5,A1,A5 + bnop .s2 B3,5 +ENDPROC(__c6xabi_llshr)
arch/c6x/lib/llshru.S new file +38 -0
@@ -0,0 +1,38 @@ +;; Copyright (C) 2010 Texas Instruments Incorporated +;; Contributed by Mark Salter <[email protected]>. +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +;; uint64_t __c6xabi_llshru(uint64_t val, uint shift) + +#include <linux/linkage.h> + + .text +ENTRY(__c6xabi_llshru) + mv .l1x B4,A1 + [!A1] b .s2 B3 ; return if zero shift count + mvk .s1 32,A0 + sub .d1 A0,A1,A0 + cmplt .l1 0,A0,A2 + [A2] shl .s1 A5,A0,A0 + nop + [!A2] neg .l1 A0,A4 +|| [A2] shru .s1 A4,A1,A4 + [!A2] shru .s1 A5,A4,A4 +|| [A2] or .d1 A4,A0,A4 +|| [!A2] mvk .l1 0,A5 + [A2] shru .s1 A5,A1,A5 + bnop .s2 B3,5 +ENDPROC(__c6xabi_llshru)
arch/c6x/lib/memcpy_64plus.S new file +46 -0
46 lines not on this page · raw message
arch/c6x/lib/mpyll.S new file +49 -0
49 lines not on this page · raw message
arch/c6x/lib/negll.S new file +31 -0
@@ -0,0 +1,31 @@ +;; Copyright (C) 2010 Texas Instruments Incorporated +;; Contributed by Mark Salter <[email protected]>. +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +;; int64_t __c6xabi_negll(int64_t val) + +#include <linux/linkage.h> + + .text +ENTRY(__c6xabi_negll) + b .s2 B3 + mvk .l1 0,A0 + subu .l1 A0,A4,A3:A2 + sub .l1 A0,A5,A0 +|| ext .s1 A3,24,24,A5 + add .l1 A5,A0,A5 + mv .s1 A2,A4 +ENDPROC(__c6xabi_negll)
arch/c6x/lib/pop_rts.S new file +32 -0
@@ -0,0 +1,32 @@ +;; Copyright 2010 Free Software Foundation, Inc. +;; Contributed by Bernd Schmidt <[email protected]>. +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include <linux/linkage.h> + + .text + +ENTRY(__c6xabi_pop_rts) + lddw .d2t2 *++B15, B3:B2 + lddw .d2t1 *++B15, A11:A10 + lddw .d2t2 *++B15, B11:B10 + lddw .d2t1 *++B15, A13:A12 + lddw .d2t2 *++B15, B13:B12 + lddw .d2t1 *++B15, A15:A14 +|| b .s2 B3 + ldw .d2t2 *++B15[2], B14 + nop 4 +ENDPROC(__c6xabi_pop_rts)
arch/c6x/lib/push_rts.S new file +31 -0
@@ -0,0 +1,31 @@ +;; Copyright 2010 Free Software Foundation, Inc. +;; Contributed by Bernd Schmidt <[email protected]>. +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include <linux/linkage.h> + + .text + +ENTRY(__c6xabi_push_rts) + stw .d2t2 B14, *B15--[2] + stdw .d2t1 A15:A14, *B15-- +|| b .s2x A3 + stdw .d2t2 B13:B12, *B15-- + stdw .d2t1 A13:A12, *B15-- + stdw .d2t2 B11:B10, *B15-- + stdw .d2t1 A11:A10, *B15-- + stdw .d2t2 B3:B2, *B15-- +ENDPROC(__c6xabi_push_rts)
arch/c6x/lib/remi.S new file +64 -0
64 lines not on this page · raw message
arch/c6x/lib/remu.S new file +82 -0
82 lines not on this page · raw message
arch/c6x/lib/strasgi.S new file +89 -0
89 lines not on this page · raw message
arch/c6x/lib/strasgi_64plus.S new file +39 -0
@@ -0,0 +1,39 @@ +;; Copyright 2010 Free Software Foundation, Inc. +;; Contributed by Bernd Schmidt <[email protected]>. +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include <linux/linkage.h> + + .text + +ENTRY(__c6xabi_strasgi_64plus) + shru .s2x a6, 2, b31 +|| mv .s1 a4, a30 +|| mv .d2 b4, b30 + + add .s2 -4, b31, b31 + + sploopd 1 +|| mvc .s2 b31, ilc + ldw .d2t2 *b30++, b31 + nop 4 + mv .s1x b31,a31 + spkernel 6, 0 +|| stw .d1t1 a31, *a30++ + + ret .s2 b3 + nop 5 +ENDPROC(__c6xabi_strasgi_64plus)
Signature · 1 line
1.7.6
PATCH 20/24 C6X: general machine and SoC support
In reply to Mark Salter--- arch/c6x/include/asm/machdep.h | 106 +++++++++++++++++++++++++ arch/c6x/include/asm/soc.h | 110 ++++++++++++++++++++++++++ arch/c6x/kernel/soc.c | 169 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 385 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/include/asm/machdep.h create mode 100644 arch/c6x/include/asm/soc.h create mode 100644 arch/c6x/kernel/soc.c
arch/c6x/include/asm/machdep.h new file +106 -0
@@ -0,0 +1,106 @@ +/* +* Copyright (C) 2011 Texas Instruments Incorporated +* +* Mostly taken from PowerPC. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_MACHDEP_H +#define _ASM_C6X_MACHDEP_H + +struct pt_regs ; + +struct machdep_calls { +char *name; +int (*probe)(void ); +void (*setup_arch)(void ); +void (*init_IRQ)(void ); +void (*time_init)(void ); +void (*restart)(void ); +void (*halt)(void ); +void (*power_off)(void ); +int (*nmi_handler)(struct pt_regs *regs); +}; + +extern struct machdep_calls __machine_desc_start; +extern struct machdep_calls __machine_desc_end; + +/* +* c6x_md contains a copy of the machine description structure for the +* current platform. machine_id contains the initial address where the +* description was found during boot. +*/ +extern struct machdep_calls c6x_md; +extern struct machdep_calls *machine_id; + +#define __machine_desc __attribute__((__section__(".machine.desc"))) + +#define define_machine (name) \ + extern struct machdep_calls mach_##name; \ + EXPORT_SYMBOL(mach_##name); \ + struct machdep_calls mach_##name __machine_desc = + +#define machine_is (name) \ + ({ \ + extern struct machdep_calls mach_##name \ + __attribute__((weak)); \ + machine_id == &mach_##name; \ + }) + +#define __define_machine_initcall (mach, level, fn, id) \ + static int __init __machine_initcall_##mach##_##fn(void) \ + { \ + if (machine_is(mach)) \ + return fn(); \ + return 0; \ + } \ + __define_initcall(level, __machine_initcall_##mach##_##fn, id); + +#define machine_core_initcall (mach, fn) \ + __define_machine_initcall(mach, "1", fn, 1) + +#define machine_core_initcall_sync (mach, fn) \ + __define_machine_initcall(mach, "1s", fn, 1s) + +#define machine_postcore_initcall (mach, fn) \ + __define_machine_initcall(mach, "2", fn, 2) + +#define machine_postcore_initcall_sync (mach, fn) \ + __define_machine_initcall(mach, "2s", fn, 2s) + +#define machine_arch_initcall (mach, fn) \ + __define_machine_initcall(mach, "3", fn, 3) + +#define machine_arch_initcall_sync (mach, fn) \ + __define_machine_initcall(mach, "3s", fn, 3s) + +#define machine_subsys_initcall (mach, fn) \ + __define_machine_initcall(mach, "4", fn, 4) + +#define machine_subsys_initcall_sync (mach, fn) \ + __define_machine_initcall(mach, "4s", fn, 4s) + +#define machine_fs_initcall (mach, fn) \ + __define_machine_initcall(mach, "5", fn, 5) + +#define machine_fs_initcall_sync (mach, fn) \ + __define_machine_initcall(mach, "5s", fn, 5s) + +#define machine_rootfs_initcall (mach, fn) \ + __define_machine_initcall(mach, "rootfs", fn, rootfs) + +#define machine_device_initcall (mach, fn) \ + __define_machine_initcall(mach, "6", fn, 6) + +#define machine_device_initcall_sync (mach, fn) \ + __define_machine_initcall(mach, "6s", fn, 6s) + +#define machine_late_initcall (mach, fn) \ + __define_machine_initcall(mach, "7", fn, 7) + +#define machine_late_initcall_sync (mach, fn) \ + __define_machine_initcall(mach, "7s", fn, 7s) + +#endif /* _ASM_C6X_MACHDEP_H */
arch/c6x/include/asm/soc.h new file +110 -0
110 lines not on this page · raw message
arch/c6x/kernel/soc.c new file +169 -0
169 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 21/24 C6X: specific SoC support
In reply to Mark Salter--- arch/c6x/platforms/soc-6455.c | 345 +++++++++++++++++++++++++++++++++++ arch/c6x/platforms/soc-6455.h | 15 ++ arch/c6x/platforms/soc-6457.c | 163 +++++++++++++++++ arch/c6x/platforms/soc-6457.h | 15 ++ arch/c6x/platforms/soc-6472.c | 403 +++++++++++++++++++++++++++++++++++++++++ arch/c6x/platforms/soc-6472.h | 15 ++ arch/c6x/platforms/soc-6474.c | 250 +++++++++++++++++++++++++ arch/c6x/platforms/soc-6474.h | 15 ++ 8 files changed, 1221 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/platforms/soc-6455.c create mode 100644 arch/c6x/platforms/soc-6455.h create mode 100644 arch/c6x/platforms/soc-6457.c create mode 100644 arch/c6x/platforms/soc-6457.h create mode 100644 arch/c6x/platforms/soc-6472.c create mode 100644 arch/c6x/platforms/soc-6472.h create mode 100644 arch/c6x/platforms/soc-6474.c create mode 100644 arch/c6x/platforms/soc-6474.h
arch/c6x/platforms/soc-6455.c new file +345 -0
@@ -0,0 +1,345 @@ +/* +* Miscellaneous SoC specific code +* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2011 Texas Instruments Incorporated +* Author: Mark Salter <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#include <linux/clkdev.h> +#include <linux/delay.h> +#include <linux/io.h> +#include <linux/irq.h> +#include <asm/machdep.h> +#include <asm/clock.h> +#include <asm/soc.h> +#include "soc-6455.h" +#include "emif.h" +#include "megamod-pic.h" +#include "timer64.h" + +static struct clk_lookup c6455_clks[] = { +CLK (NULL ,"pll1" , &c6x_soc_pll1.sysclks[0 ]), +CLK (NULL ,"pll1_sysclk2" , &c6x_soc_pll1.sysclks[2 ]), +CLK (NULL ,"pll1_sysclk3" , &c6x_soc_pll1.sysclks[3 ]), +CLK (NULL ,"pll1_sysclk4" , &c6x_soc_pll1.sysclks[4 ]), +CLK (NULL ,"pll1_sysclk5" , &c6x_soc_pll1.sysclks[5 ]), +CLK (NULL ,"core" , &c6x_core_clk), +CLK ("i2c_davinci.1" ,NULL , &c6x_i2c_clk), +CLK ("watchdog" ,NULL , &c6x_watchdog_clk), +CLK ("2c81800.mdio" ,NULL , &c6x_mdio_clk), +CLK ("" ,NULL ,NULL ) +}; + + +/* assumptions used for delay loop calculations */ +#define MIN_CLKIN1_KHz 10000 +#define MAX_CORE_KHz 1200000 +#define MIN_PLLOUT_KHz (MIN_CLKIN1_KHz/3) + +static void __init __setup_clocks (void ) +{ +struct pll_data *pll = &c6x_soc_pll1; +struct clk *sysclks = pll->sysclks; + + pll->flags =PLL_HAS_PRE |PLL_HAS_MUL ; + + pll->bypass_delay =4 * (MAX_CORE_KHz/MIN_PLLOUT_KHz); + pll->reset_delay =128 * (MAX_CORE_KHz/MIN_CLKIN1_KHz); + pll->lock_delay =2000 * (MAX_CORE_KHz/MIN_CLKIN1_KHz); + + sysclks[2 ].flags |=FIXED_DIV_PLL ; + sysclks[2 ].div =3 ; + sysclks[3 ].flags |=FIXED_DIV_PLL ; + sysclks[3 ].div =6 ; + sysclks[4 ].div =PLLDIV4 ; + sysclks[5 ].div =PLLDIV5 ; + + c6x_core_clk.parent = &sysclks[0 ]; + c6x_i2c_clk.parent = &sysclks[3 ]; + c6x_watchdog_clk.parent = &sysclks[3 ]; + c6x_mdio_clk.parent = &sysclks[3 ]; + +c6x_clks_init (c6455_clks); +} + +/* +* Device Configuration +*/ +#define CHIP_BASE_ADDR 0x02a80000 +#define CHIP_SIZE 0x10 +#define CHIP_DEVSTAT 0x00 +#define CHIP_PRI_ALLOC 0x04 +#define CHIP_JTAGID 0x08 + +#define DSCR_BASE_ADDR 0x02ac0000 +#define DSCR_SIZE 0x40000 + +#define DSCR_PERLOCK 0x04 +#define DSCR_PERCFG0 0x08 +#define DSCR_PERSTAT0 0x14 +#define DSCR_PERSTAT1 0x18 +#define DSCR_EMACCFG 0x20 +#define DSCR_PERCFG1 0x2C +#define DSCR_EMUBUFPD 0x54 + +#define DSCR_LOCKVAL 0x0f0a0b00 + +/* device IDs passed to dscr_enable() and dscr_disable() */ +#define DSCR_TCP 0 +#define DSCR_VCP 1 +#define DSCR_EMAC 2 +#define DSCR_TIMER0 3 +#define DSCR_TIMER1 4 +#define DSCR_GPIO 5 +#define DSCR_I2C 6 +#define DSCR_BSP0 7 +#define DSCR_BSP1 8 +#define DSCR_HPI 9 +#define DSCR_PCI 10 +#define DSCR_UTOPIA 11 +#define DSCR_SRIO 15 +#define DSCR_EMIFA 16 +#define DSCR_DDR2 17 + +#define PERSTAT_DISABLED 0 +#define PERSTAT_ENABLED 1 +#define PERSTAT_PWRDOWN 3 +#define PERSTAT_INPROGRESS 5 + +static void __iomem *chip_base; +static void __iomem *dscr_base; + +static inline void dscr_write (int offset,unsigned int val) +{ +soc_writel (val, dscr_base + offset); +} + +static inline unsigned int dscr_read (int offset) +{ +return soc_readl (dscr_base + offset); +} + +static inline void chip_write (int offset,unsigned int val) +{ +soc_writel (val, chip_base + offset); +} + +static inline unsigned int chip_read (int offset) +{ +return soc_readl (chip_base + offset); +} + +static inline void __write_percfg0 (unsigned int val) +{ +int _base =DSCR_BASE_ADDR ; +int _key =DSCR_LOCKVAL ; + +/* +* We need to ensure write to lock register and write to PERCFG0 are +* in same fetch packet and that an interrupt doesn't occur between +* them. The .align makes sure they're in the same packet and putting +* them in the delay slots of the second branch ensures they are not +* interrupted. +*/ + asmvolatile ("b .s2 0f\n" +"nop 5\n" +" .align 5\n" +"0:\n" +"b .s2 0f\n" +"stw .D1T1 %2,*+%1(%4)\n" +"stw .D1T1 %0,*+%1(%3)\n" +"nop\n" +"nop\n" +"nop\n" +"0:\n" + : + :"a" (val),"a" (_base),"a" (_key), +"Iu5" (DSCR_PERCFG0 ),"Iu5" (DSCR_PERLOCK ) + ); +} + +/* +* Enable a peripheral through PERCFG registers. +*/ +void dscr_enable (int id) +{ +unsigned int val; +int shift; + +if (id <16 ) { +int status_reg; + + shift = id *2 ; + + val =dscr_read (DSCR_PERCFG0 ); + val &= ~(3 << shift); +if (id ==DSCR_SRIO ) { +/* SRIO is handled differently than the others */ + val |= (3 << shift); +__write_percfg0 (val); +return ; + } + val |= (1 << shift); +__write_percfg0 (val); +/* wait for completion */ +if (id <10 ) { + status_reg =DSCR_PERSTAT0 ; + shift = id *3 ; + }else { + status_reg =DSCR_PERSTAT1 ; + shift = (id -10 ) *3 ; + } +do { + val =dscr_read (status_reg); + val >>= shift; + val &=7 ; + }while (val !=PERSTAT_ENABLED ); + }else { + shift = id -16 ; + val =dscr_read (DSCR_PERCFG1 ); +dscr_write (DSCR_PERCFG1 , val | (1 << shift)); +__delay (100 ); + } +} + +/* +* Disable a peripheral through PERCFG registers. +*/ +static void dscr_disable (int id) +{ +unsigned int val; +int shift; + +if (id <16 ) { + shift = id *2 ; + + val =dscr_read (DSCR_PERCFG0 ); + val &= ~(3 << shift); +__write_percfg0 (val); + } +} + +static void __dev_enable (int id,unsigned int index,int enable) +{ +switch (id) { +case DSCR_TIMER0 : +if (index ==1 ) + id =DSCR_TIMER1 ; +else if (index) +return ; +break ; +case DSCR_BSP0 : +if (index ==1 ) + id =DSCR_BSP1 ; +else if (index) +return ; +break ; +default : +if (index) +return ; +break ; + } +if (enable) +dscr_enable (id); +else +dscr_disable (id); +} + +static void c6455_dev_enable (enum soc_device_id id,int index) +{ +__dev_enable (id, index,1 ); +} + +static void c6455_dev_disable (enum soc_device_id id,int index) +{ +__dev_enable (id, index,0 ); +} + +static void __init __setup_dscr (void ) +{ + dscr_base =ioremap (CHIP_BASE_ADDR ,CHIP_SIZE ); + dscr_base =ioremap (DSCR_BASE_ADDR ,DSCR_SIZE ); + +pr_debug ("DEVSTAT=%08x PERCFG0=%08x PERCFG1=%08x\n" , +chip_read (CHIP_DEVSTAT ),dscr_read (DSCR_PERCFG0 ), +dscr_read (DSCR_PERCFG1 )); + +SOC_DEVCONFIG_SUPPORT (TCP ,DSCR_TCP ); +SOC_DEVCONFIG_SUPPORT (VCP ,DSCR_VCP ); +SOC_DEVCONFIG_SUPPORT (EMAC ,DSCR_EMAC ); +SOC_DEVCONFIG_SUPPORT (TIMER ,DSCR_TIMER0 ); +SOC_DEVCONFIG_SUPPORT (GPIO ,DSCR_GPIO ); +SOC_DEVCONFIG_SUPPORT (I2C ,DSCR_I2C ); +SOC_DEVCONFIG_SUPPORT (MCBSP ,DSCR_BSP0 ); +SOC_DEVCONFIG_SUPPORT (HPI ,DSCR_HPI ); +SOC_DEVCONFIG_SUPPORT (PCI ,DSCR_PCI ); +SOC_DEVCONFIG_SUPPORT (UTOPIA ,DSCR_UTOPIA ); +SOC_DEVCONFIG_SUPPORT (SRIO ,DSCR_SRIO ); +SOC_DEVCONFIG_SUPPORT (EMIF ,DSCR_EMIFA ); +SOC_DEVCONFIG_SUPPORT (DDR2 ,DSCR_DDR2 ); + +c6455_dev_enable (SOC_DEV_TIMER ,0 ); +c6455_dev_enable (SOC_DEV_TIMER ,1 ); + +#ifdef CONFIG_I2C +c6455_dev_enable (SOC_DEV_I2C ,0 ); +#endif +#ifdef CONFIG_GENERIC_GPIO +c6455_dev_enable (SOC_DEV_GPIO ,0 ); +#endif +#ifdef CONFIG_TMS320C64X_GEMAC +c6455_dev_enable (SOC_DEV_EMAC ,0 ); +#endif +} + +static int macsel_ids[] = { + [0 ] =MACSEL_MII , + [1 ] =MACSEL_RMII , + [2 ] =MACSEL_GMII , + [3 ] =MACSEL_RGMII , +}; + +static int c6455_macsel (unsigned int index) +{ +u32 devstat =chip_read (CHIP_DEVSTAT ); +if (index >0 ) +return MACSEL_UNKNOWN ; + +return macsel_ids[(devstat >>9 ) &3 ]; +} + +static void c6455_rmii_reset_ctl (int index,int assert) +{ +u32 val; + +if (index) +return ; + + val =dscr_read (DSCR_EMACCFG ); +if (assert) +dscr_write (DSCR_EMACCFG , val | (1 <<18 )); +else +dscr_write (DSCR_EMACCFG , val & ~(1 <<18 )); +} + +void __init c6455_setup_arch (void ) +{ + c6x_num_cores =1 ; + + soc_ops.init_IRQ = megamod_pic_init; + soc_ops.time_init = timer64_init; + soc_ops.macsel = c6455_macsel; + soc_ops.dev_enable = c6455_dev_enable; + soc_ops.dev_disable = c6455_dev_disable; + soc_ops.rmii_reset_ctl = c6455_rmii_reset_ctl; + +__setup_dscr (); +__setup_clocks (); + +emif_init (0x70000000 ); +}
arch/c6x/platforms/soc-6455.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Prototypes, etc. for the TMS320C6455 SoC +* +* Copyright (C) 2011 Texas Instruments Incorporated +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +*/ +#ifndef __SOC_6455_H +#define __SOC_6455_H + +extern void c6455_setup_arch (void ); + +#endif /* __SOC_6455_H */
arch/c6x/platforms/soc-6457.c new file +163 -0
163 lines not on this page · raw message
arch/c6x/platforms/soc-6457.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Prototypes, etc. for the TMS320C6457 SoC +* +* Copyright (C) 2011 Texas Instruments Incorporated +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +*/ +#ifndef __SOC_6457_H +#define __SOC_6457_H + +extern void c6457_setup_arch (void ); + +#endif /* __SOC_6457_H */
arch/c6x/platforms/soc-6472.c new file +403 -0
403 lines not on this page · raw message
arch/c6x/platforms/soc-6472.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Prototypes, etc. for the TMS320C6472 SoC +* +* Copyright (C) 2011 Texas Instruments Incorporated +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +*/ +#ifndef __SOC_6472_H +#define __SOC_6472_H + +extern void c6472_setup_arch (void ); + +#endif /* __SOC_6472_H */
arch/c6x/platforms/soc-6474.c new file +250 -0
250 lines not on this page · raw message
arch/c6x/platforms/soc-6474.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Prototypes, etc. for the TMS320C6474 SoC +* +* Copyright (C) 2011 Texas Instruments Incorporated +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +*/ +#ifndef __SOC_6474_H +#define __SOC_6474_H + +extern void c6474_setup_arch (void ); + +#endif /* __SOC_6474_H */
Signature · 1 line
1.7.6
PATCH 22/24 C6X: specific board support
In reply to Mark Salter--- arch/c6x/platforms/board-dsk6455.c | 102 ++++++++++++++++++++++++++++++++++++ arch/c6x/platforms/board-evm6457.c | 51 ++++++++++++++++++ arch/c6x/platforms/board-evm6472.c | 51 ++++++++++++++++++ arch/c6x/platforms/board-evm6474.c | 53 +++++++++++++++++++ 4 files changed, 257 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/platforms/board-dsk6455.c create mode 100644 arch/c6x/platforms/board-evm6457.c create mode 100644 arch/c6x/platforms/board-evm6472.c create mode 100644 arch/c6x/platforms/board-evm6474.c
arch/c6x/platforms/board-dsk6455.c new file +102 -0
@@ -0,0 +1,102 @@ +/* +* linux/arch/c6x/platforms/board-dsk6455.c +* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2008, 2009, 2010, 2011 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#include <linux/of_platform.h> +#include <linux/of_fdt.h> +#include <linux/interrupt.h> +#include <linux/delay.h> + +#include <asm/machdep.h> +#include <asm/soc.h> +#include "emif.h" +#include "soc-6455.h" + + +static void __init dsk6455_setup_arch (void ) +{ +c6455_setup_arch (); + +/* CPLD */ +emif_config_ce (2 ,EMIFA_CFG_ASYNC | +EMIFA_CFG_W_SETUP (1 ) | +EMIFA_CFG_W_STROBE (10 ) | +EMIFA_CFG_W_HOLD (1 ) | +EMIFA_CFG_R_SETUP (1 ) | +EMIFA_CFG_R_STROBE (10 ) | +EMIFA_CFG_R_HOLD (1 ) | +EMIFA_CFG_WIDTH_8 ); + +/* NOR Flash */ +emif_config_ce (3 ,EMIFA_CFG_ASYNC | +EMIFA_CFG_W_SETUP (1 ) | +EMIFA_CFG_W_STROBE (10 ) | +EMIFA_CFG_W_HOLD (1 ) | +EMIFA_CFG_R_SETUP (1 ) | +EMIFA_CFG_R_STROBE (10 ) | +EMIFA_CFG_R_HOLD (1 ) | +EMIFA_CFG_WIDTH_8 ); + +/* Daughter Card */ +emif_config_ce (4 ,EMIFA_CFG_ASYNC | +EMIFA_CFG_W_SETUP (1 ) | +EMIFA_CFG_W_STROBE (10 ) | +EMIFA_CFG_W_HOLD (1 ) | +EMIFA_CFG_R_SETUP (1 ) | +EMIFA_CFG_R_STROBE (10 ) | +EMIFA_CFG_R_HOLD (1 ) | +EMIFA_CFG_WIDTH_32 ); + +/* Daughter Card */ +emif_config_ce (5 ,EMIFA_CFG_ASYNC | +EMIFA_CFG_W_SETUP (1 ) | +EMIFA_CFG_W_STROBE (10 ) | +EMIFA_CFG_W_HOLD (1 ) | +EMIFA_CFG_R_SETUP (1 ) | +EMIFA_CFG_R_STROBE (10 ) | +EMIFA_CFG_R_HOLD (1 ) | +EMIFA_CFG_WIDTH_32 ); + +/* Raise priority of waiting bus commands after 255 transfers */ +emif_set_burst_prio (255 ); +} + +static struct of_device_id dsk6455_ids[] = { + { .type ="soc" , }, + { .compatible ="soc" , }, + { .compatible ="simple-bus" , }, + { .compatible ="ti,c64x+emac" , }, + {}, +}; + +static int __init dsk6455_publish_devices (void ) +{ +of_platform_bus_probe (NULL , dsk6455_ids,NULL ); + +return 0 ; +} +machine_device_initcall (dsk6455, dsk6455_publish_devices); + +static int __init dsk6455_probe (void ) +{ +unsigned long root =of_get_flat_dt_root (); + +if (!of_flat_dt_is_compatible (root,"spectrum-digital,dsk6455" )) +return 0 ; + +return 1 ; +} + +define_machine (dsk6455) { + .name = "DSK6455", + .probe = dsk6455_probe, + .setup_arch = dsk6455_setup_arch, +};
arch/c6x/platforms/board-evm6457.c new file +51 -0
51 lines not on this page · raw message
arch/c6x/platforms/board-evm6472.c new file +51 -0
51 lines not on this page · raw message
arch/c6x/platforms/board-evm6474.c new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 23/24 C6X: miscellaneous low-level SoC support
In reply to Mark Salter--- arch/c6x/platforms/emif.c | 80 ++++++++++++++++++++++++++ arch/c6x/platforms/emif.h | 45 +++++++++++++++ arch/c6x/platforms/psc.c | 138 +++++++++++++++++++++++++++++++++++++++++++++ arch/c6x/platforms/psc.h | 33 +++++++++++ 4 files changed, 296 insertions(+), 0 deletions(-) create mode 100644 arch/c6x/platforms/emif.c create mode 100644 arch/c6x/platforms/emif.h create mode 100644 arch/c6x/platforms/psc.c create mode 100644 arch/c6x/platforms/psc.h
arch/c6x/platforms/emif.c new file +80 -0
@@ -0,0 +1,80 @@ +/* +* Power/Sleep Controller +* +* Copyright (C) 2011 Texas Instruments Incorporated +* Author: Mark Salter <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#include <linux/io.h> +#include <linux/delay.h> +#include <asm/machdep.h> +#include <asm/soc.h> +#include "emif.h" + +#define EMIFA_MIDR 0x00 +#define EMIFA_STAT 0x04 +#define EMIFA_BPRIO 0x20 +#define EMIFA_CE2CFG 0x80 +#define EMIFA_CE3CFG 0x84 +#define EMIFA_CE4CFG 0x88 +#define EMIFA_CE5CFG 0x8C +#define EMIFA_AWCC 0xA0 +#define EMIFA_INTRAW 0xC0 +#define EMIFA_INTMSK 0xC4 +#define EMIFA_INTMSKSET 0xC8 +#define EMIFA_INTMSKCLR 0xCC + +static void __iomem *emifa_base; + +static inline void emifa_write (int offset,unsigned int val) +{ +soc_writel (val, emifa_base + offset); +} + +static inline unsigned int emifa_read (int offset) +{ +return soc_readl (emifa_base + offset); +} + + +void emif_config_ce (int ce,u32 val) +{ +u32 reg; + +switch (ce) { +case 2 : + reg =EMIFA_CE2CFG ; +break ; +case 3 : + reg =EMIFA_CE3CFG ; +break ; +case 4 : + reg =EMIFA_CE4CFG ; +break ; +case 5 : + reg =EMIFA_CE5CFG ; +break ; +default : +return ; + } +emifa_write (reg, val); +} + +void emif_set_burst_prio (u32 val) +{ +emifa_write (EMIFA_BPRIO , val -1 ); +} + +int emif_init (u32 base_addr) +{ + emifa_base =ioremap (base_addr,0x100 ); +if (!emifa_base) +return -1 ; + +soc_dev_enable (SOC_DEV_EMIF ,0 ); + +return 0 ; +}
arch/c6x/platforms/emif.h new file +45 -0
45 lines not on this page · raw message
arch/c6x/platforms/psc.c new file +138 -0
138 lines not on this page · raw message
arch/c6x/platforms/psc.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* C6X Power/Sleep Controller +* +* Copyright (C) 2011 Texas Instruments Incorporated +* Author: Mark Salter <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _C6X_PSC_H +#define _C6X_PSC_H + +#define MAX_PSC_MODULES 16 + +struct psc_data { +u32 phys_base; +void __iomem *base; +int num_domains; +int num_modules; +u8 module_domains[MAX_PSC_MODULES ]; +}; + +extern void psc_init (struct psc_data *data); +extern void psc_domain_on (struct psc_data *data,int domain); +extern void psc_domain_off (struct psc_data *data,int domain); +extern void psc_transition_domains (struct psc_data *data,int domain_mask); +extern void psc_module_on (struct psc_data *data,int module); +extern void psc_module_off (struct psc_data *data,int module); +extern void psc_module_reset (struct psc_data *data,int module); +extern void psc_module_reset_release (struct psc_data *data,int module); + +#endif /* _C6X_PSC_H */
Signature · 1 line
1.7.6
PATCH 24/24 C6X: MAINTAINERS
In reply to Mark Salter--- MAINTAINERS | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
MAINTAINERS +8 -0
@@ -1626,6 +1626,14 @@ T: git git://git.alsa-project.org/alsa-kernel.git S: Maintained F: sound/pci/oxygen/ +C6X ARCHITECTURE +M: Mark Salter <[email protected]> +M: Aurelien Jacquiot <[email protected]> +L: [email protected] +W: http://www.linux-c6x.org/wiki/index.php/Main_Page +S: Maintained +F: arch/c6x/ + CACHEFILES: FS-CACHE BACKEND FOR CACHING ON MOUNTED FILESYSTEMS M: David Howells <[email protected]> L: [email protected]
Signature · 1 line
1.7.6
Re: [PATCH 02/24] fixed generic page.h for non-zero PAGE_OFFSET
In reply to Mark SalterQuoted 5 lines · Mark Salter
asm-generic/page.hhad several problems when used with a non-zeroPAGE_OFFSET. This patch adds a defaultARCH_PFN_OFFSETand fixes the__va,__pa, andpfn_validmacros to work with non-zeroPAGE_OFFSETs.Signed-off-by Mark Salter <[email protected]>
Re: [PATCH 03/24] add ELF machine define for TI C6X DSPs
In reply to Mark SalterQuoted 1 line · Mark Salter
Signed-off-by Mark Salter <[email protected]>
Arnd Bergmann
maintainerRe: [PATCH 04/24] C6X: build infrastructure
In reply to Mark Salterarch/c6x/Kconfig line 85
Quoted 11 lines · Mark Salter
arch/c6x/Kconfig new file +10
-0+ +config NR_IRQS + int "Number of virtual interrupt numbers" + range 32 32768 + default "256" + help + This defines the number of virtual interrupt numbers the kernel + can manage. Virtual interrupt numbers are what you see in + /proc/interrupts. If you configure your system to have too few, + drivers will fail to load or worse - handle with care.
Does this need to be configurable? I think you can simply hardcode it to a reasonably high number, because with sparse IRQs the cost is relatively low.
arch/c6x/Kconfig line 161
Quoted 9 lines
arch/c6x/Kconfig new file +9
-0+ +menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" + +config PCI + bool "PCI support" + help + Support for PCI bus. +endmenu +
Do you actually support PCI? I don't see any of the required code for that and you can save a lot of trouble by not allowing PCI at all.
Arnd
Re: [PATCH 04/24] C6X: build infrastructure
Quoted 14 lines · Arnd Bergmann
arch/c6x/Kconfig line 85
Quoted 11 lines · Mark Salter
arch/c6x/Kconfig new file +10
-0+ +config NR_IRQS + int "Number of virtual interrupt numbers" + range 32 32768 + default "256" + help + This defines the number of virtual interrupt numbers the kernel + can manage. Virtual interrupt numbers are what you see in + /proc/interrupts. If you configure your system to have too few, + drivers will fail to load or worse - handle with care.Does this need to be configurable?
No, not really.
Quoted 12 lines
arch/c6x/Kconfig line 161
Quoted 10 lines
arch/c6x/Kconfig new file +9
-0+ +menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" + +config PCI + bool "PCI support" + help + Support for PCI bus. +endmenu +Do you actually support PCI?
Not for now.
--Mark
Arnd Bergmann
maintainerRe: [PATCH 05/24] C6X: early boot code
In reply to Mark Salterarch/c6x/kernel/setup.c line 77
Quoted 5 lines · Mark Salter
arch/c6x/kernel/setup.c new file +5
-0+static const char *cpu_name, *cpu_voltage, *mmu, *fpu; +static char *soc_rev; +static char __cpu_rev[5 ], *cpu_rev; +static size_t initrd_size =CONFIG_BLK_DEV_RAM_SIZE *1024 ; +static unsigned int core_id;
Better make a data structure for the elements that you have per CPU, that will help you when you get to SMP.
Quoted 12 lines
arch/c6x/kernel/setup.c new file +12
-0+static void __init probe_machine (void ) +{ +/* +* Iterate all c6x_md structures until we find the proper +* one for the current machine type +*/ +for (machine_id = &__machine_desc_start; + machine_id < &__machine_desc_end; + machine_id++) { +memcpy (&c6x_md, machine_id,sizeof (struct machdep_calls )); +if (c6x_md.probe ()) +break ;
arch/c6x/kernel/setup.c line 273
Quoted 10 lines
arch/c6x/kernel/setup.c new file +10
-0+ } +/* What can we do if we didn't find ? */ +if (machine_id >= &__machine_desc_end) { +DBG ("No suitable machine found !\n" ); +for (;;) + ; + } + +printk (KERN_INFO "Using %s machine description\n" , c6x_md.name); +}
Why do you need separate machine descriptors? Since you can do all probing through the device tree, you should not need to copy the complexity of architectures that don't use it everywhere yet.
Quoted 14 lines
arch/c6x/kernel/setup.c new file +14
-0+ +static int show_cpuinfo (struct seq_file *m,void *v) +{ +seq_printf (m, +"CPU:\t\t%s\n" +"Core revision:\t%s\n" +"Core voltage:\t%s\n" +"Core id:\t%d\n" +"SoC cores:\t%d\n" +"MMU:\t\t%s\n" +"FPU:\t\t%s\n" +"Silicon rev:\t%s\n" +"Clocking:\t%uMHz\n" + "BogoMips:\t%lu.%02lu\n"
arch/c6x/kernel/setup.c line 444
Quoted 10 lines
arch/c6x/kernel/setup.c new file +10
-0+"Calibration:\t%lu loops\n" , + cpu_name, cpu_rev, cpu_voltage, + core_id, c6x_num_cores, mmu, fpu, + soc_rev, (c6x_core_freq +500000 ) /1000000 , + (loops_per_jiffy/(500000 /HZ )), + (loops_per_jiffy/(5000 /HZ ))%100 , + loops_per_jiffy); + +return 0 ; +}
The fields are commonly all lowercase. Start with a line 'processor:\t0' to make it easier to extend for multiple CPUs.
Out of "Clocking", "BogoMips" and "Calibration", you probably should have only one, since they are all interdependent.
Arnd
Arnd Bergmann
maintainerRe: [PATCH 06/24] C6X: devicetree
In reply to Mark SalterQuoted 8 lines · Mark Salter
Signed-off-by Mark Salter <[email protected]>--- arch/c6x/boot/dts/dsk6455.dts | 87 +++++++++++++ arch/c6x/boot/dts/evmc6457.dts | 88 +++++++++++++ arch/c6x/boot/dts/evmc6472.dts | 129 +++++++++++++++++++ arch/c6x/boot/dts/evmc6474.dts | 105 +++++++++++++++ arch/c6x/boot/install-dtb.c | 275 ++++++++++++++++++++++++++++++++++++++++ arch/c6x/kernel/devicetree.c | 53 ++++++++
I don't see anything wrong with these, but please take the device tree mailing list on Cc when posting this patch again.
Arnd
Arnd Bergmann
maintainerRe: [PATCH 07/24] C6X: memory management
In reply to Mark SalterQuoted 23 lines · Mark Salter
arch/c6x/include/asm/dma-mapping.h new file +23
-0+#define dma_supported (d, m) (1) + +#define __pfn_to_bus (pfn) ((pfn) << PAGE_SHIFT) +#define __bus_to_pfn (paddr) ((paddr) >> PAGE_SHIFT) +#define __bus_to_phys (x) (x) +#define __phys_to_bus (x) (x) +#define __bus_to_virt (b) phys_to_virt(__bus_to_phys(b)) +#define __virt_to_bus (v) __phys_to_bus(virt_to_phys(v)) + +/* +* page_to_dma/dma_to_virt/virt_to_dma are architecture private functions +* used internally by the DMA-mapping API to provide DMA addresses. They +* must not be used by drivers. +*/ +static inline dma_addr_t page_to_dma (struct device *dev,struct page *page) +{ +return (dma_addr_t )__pfn_to_bus (page_to_pfn (page)); +} + +static inline struct page *dma_to_page (struct device *dev,dma_addr_t addr) +{ +return pfn_to_page (__bus_to_pfn (addr)); +}
arch/c6x/include/asm/dma-mapping.h line 57
Quoted 10 lines
arch/c6x/include/asm/dma-mapping.h new file +10
-0+ +static inline void *dma_to_virt (struct device *dev,dma_addr_t addr) +{ +return (void *)__bus_to_virt (addr); +} + +static inline dma_addr_t virt_to_dma (struct device *dev,void *addr) +{ +return (dma_addr_t )__virt_to_bus (addr); +}
It would be better not to provide these functions. Drivers are supposed to use the proper dma mapping API functions that you also provide. Using those ensures that drives can still work when you add an IOMMU.
arch/c6x/include/asm/dma-mapping.h line 91
Quoted 9 lines
arch/c6x/include/asm/dma-mapping.h new file +9
-0+extern int __dma_is_coherent (struct device *dev,dma_addr_t handle); + +static inline int dma_is_consistent (struct device *dev,dma_addr_t handle) +{ +if (arch_is_coherent () ||__dma_is_coherent (dev, handle)) +return 1 ; +else +return 0 ; +}
Does this need to be both a runtime decision and set per device? Most architectures are just always consistent or never, so you could turn this into an #ifdef block to define the two versions, or even just provide one version.
Quoted 30 lines
arch/c6x/include/asm/dma-mapping.h new file +30
-0+extern void dma_free_coherent (struct device *,size_t ,void *,dma_addr_t ); + +#define dma_alloc_noncoherent (d, s, h, f) dma_alloc_coherent((d), (s), (h), (f)) +#define dma_free_noncoherent (d, s, v, h) dma_free_coherent((d), (s), (v), (h)) + +extern void __dma_single_cpu_to_dev (const void *kaddr,size_t size, +enum dma_data_direction dir); + +extern void __dma_single_dev_to_cpu (const void *kaddr,size_t size, +enum dma_data_direction dir); + +extern void __dma_page_cpu_to_dev (struct page *page,unsigned long off, +size_t size,enum dma_data_direction dir); + +extern void __dma_page_dev_to_cpu (struct page *page,unsigned long off, +size_t size,enum dma_data_direction dir); + +/** +* dma_map_single - map a single buffer for streaming DMA +* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices +* @cpu_addr: CPU direct mapped address of buffer +* @size: size of buffer to map +* @dir: DMA transfer direction +* +* Ensure that any data held in the cache is appropriately discarded +* or written back. +* +* The device owns this memory once this call has completed. The CPU +* can regain ownership by calling dma_unmap_single() or +* dma_sync_single_for_cpu().
arch/c6x/include/asm/dma-mapping.h line 166
Quoted 10 lines
arch/c6x/include/asm/dma-mapping.h new file +10
-0+*/ +static inline dma_addr_t dma_map_single (struct device *dev,void *cpu_addr, +size_t size,enum dma_data_direction dir) +{ +BUG_ON (!valid_dma_direction (dir)); + +__dma_single_cpu_to_dev (cpu_addr, size, dir); + +return virt_to_dma (dev, cpu_addr); +}
The naming is a little confusing. Why not call the standard dma_sync_* functions and make them extern instead of having multiple layers of wrappers.
Quoted 19 lines
arch/c6x/include/asm/dma.h new file +13
-0@@ -0,0 +1,23 @@ +/* +* Port on Texas Instruments TMS320C6x architecture +* +* Copyright (C) 2004, 2009 Texas Instruments Incorporated +* Author: Aurelien Jacquiot ([email protected]) +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef _ASM_C6X_DMA_H +#define _ASM_C6X_DMA_H +
arch/c6x/include/asm/dma.h line 23
Quoted 10 lines
arch/c6x/include/asm/dma.h new file +10
-0+#define MAX_DMA_ADDRESS 0xFFFFFFFF +#define MAX_DMA_CHANNELS 64 + +/* Reserve a DMA channel */ +extern int request_dma (unsigned int dmanr,const char *device_id); + +/* Release it again */ +extern void free_dma (unsigned int dmanr); + +#endif /* _ASM_C6X_DMA_H */
These should not be there. The dma.h header is only for ISA-style DMA, which I'm sure you don't have.
Quoted 36 lines
arch/c6x/include/asm/dma.h new file +36
-0+void *dma_alloc_coherent (struct device *dev,size_t size, +dma_addr_t *handle,gfp_t gfp) +{ +u32 paddr; +void __iomem *virt; + +if (in_interrupt ()) +BUG (); + +/* Round up to a page */ + size =PAGE_ALIGN (size); + +spin_lock_irq (&dma_mem_lock); + +/* Check if we have a DMA memory */ +if (dma_page_heap) + paddr =__dma_alloc_coherent (size, gfp); +else +/* Otherwise do an allocation using standard allocator */ + paddr =__dma_alloc_coherent_stdmem (size, gfp); + +spin_unlock_irq (&dma_mem_lock); + +if (paddr ==-1 ) +return NULL ; + +if (handle) + *handle =__phys_to_bus (paddr); + +/* +* In a near future we can expect having a partial MMU with +* chaching attributes +*/ + virt =ioremap_nocache (paddr, size); +if (!virt) +return NULL ;
arch/c6x/include/asm/dma.h
Quoted 10 lines
arch/c6x/include/asm/dma.h new file +10
-0+ +/* +* We need to ensure that there are no cachelines in use, or +* worse dirty in this area. +*/ +L2_cache_block_invalidate (paddr, paddr + size); + +return (void *) virt; +} +EXPORT_SYMBOL (dma_alloc_coherent);
The pointer should not be __iomem, because it is definitely not an MMIO register. You might want to add another low-level memory remapping function when you add MMU support that uses the same low-level code as ioremap, but does not change the address space annotations.
Arnd
Arnd Bergmann
maintainerRe: [PATCH 08/24] C6X: process management
In reply to Mark Salterarch/c6x/kernel/process.c line 87
Quoted 7 lines · Mark Salter
arch/c6x/kernel/process.c new file +7
-0+static void halt_loop (void ) +{ +printk (KERN_EMERG "System Halted, OK to turn off power\n" ); +local_irq_disable (); +while (1 ) + ; +}
How about calling default_idle in the loop? There is no reason to burn CPU cycles when the machine is stopped.
Quoted 38 lines
arch/c6x/kernel/process.c new file +37
-0+/* +* vfork syscall is deprecated but uClibc tests for _NR_vfork as a check +* for __libc_vfork() existence. So we provide the syscall even though +* __libc_vfork() actually uses the clone syscall. +*/ +asmlinkage int c6x_vfork(struct pt_regs *regs) +{ +return do_fork (CLONE_VFORK |CLONE_VM |SIGCHLD , regs->sp, regs, +0 ,NULL ,NULL ); +} + +asmlinkage int c6x_clone(struct pt_regs *regs) +{ +unsigned long clone_flags; +unsigned long newsp; + +/* syscall puts clone_flags in A4 and usp in B4 */ + clone_flags = regs->orig_a4; +if (regs->b4) + newsp = regs->b4; +else + newsp = regs->sp; + +return do_fork (clone_flags, newsp, regs,0 , (int __user *)regs->a6, + (int __user *)regs->b6); +} +/* +* c6x_execve() executes a new program. +*/ +asmlinkage long c6x_execve (const char __user *name, +const char __user *const __user *argv, +const char __user *const __user *envp, +struct pt_regs *regs) +{ +int error; +char *filename; +
arch/c6x/kernel/process.c line 259
Quoted 10 lines
arch/c6x/kernel/process.c new file +10
-0+ filename =getname (name); + error =PTR_ERR (filename); +if (IS_ERR (filename)) + goto out; + + error =do_execve (filename, argv, envp, regs); +putname (filename); +out: +return error; +}
better use SYSCALL_DEFINE1/4 to make these an actual syscalls that can be grepped for. In a lot of cases, the SYSCALL_DEFINE* is actually required for security reasons, although these specific cases don't seem to need it.
Arnd
Arnd Bergmann
maintainerRe: [PATCH 10/24] C6X: time management
In reply to Mark Salterarch/c6x/include/asm/timex.h line 20
Quoted 8 lines · Mark Salter
arch/c6x/include/asm/timex.h new file +8
-0+#ifndef _ASM_C6X_TIMEX_H +#define _ASM_C6X_TIMEX_H + +/* +* This should be close enough... +*/ +#define CLOCK_TICK_RATE ((1000 * 1000000UL) / 6) +
We're about to remove that symbol and all its users, you should not need it in 3.2 any more (though you still do in 3.1-rc1).
arch/c6x/kernel/time.c line 38
Quoted 4 lines
arch/c6x/kernel/time.c new file +4
-0+static cycle_t tsc_read (struct clocksource *cs) +{ +return get_cycles (); +}
What is this good for? TSC is an x86 specific feature, so you should just be able to use get_cycles directly.
Arnd
Arnd Bergmann
maintainerRe: [PATCH 11/24] C6X: interrupt handling
In reply to Mark SalterQuoted 9 lines · Mark Salter
arch/c6x/kernel/irq.c new file +3
-0@@ -0,0 +1,736 @@ +/* +* Copyright (C) 2011 Texas Instruments Incorporated +*
arch/c6x/kernel/irq.c line 13
Quoted 10 lines
arch/c6x/kernel/irq.c new file +10
-0+* This borrows heavily from powerpc version, which is: +* +* Derived from arch/i386/kernel/irq.c +* Copyright (C) 1992 Linus Torvalds +* Adapted from arch/i386 by Gary Thomas +* Copyright (C) 1995-1996 Gary Thomas ([email protected]) +* Updated and modified by Cort Dougan <[email protected]> +* Copyright (C) 1996-2001 Cort Dougan +* Adapted for Power Macintosh by Paul Mackerras +* Copyright (C) 1996 Paul Mackerras ([email protected])
There is a lot of work currently going into reworking the way that interrupt controllers work. You have evidently copied the code that was in powerpc, which seems like a reasonably base, but it still duplicates a lot of code.
Maybe Thomas can comment on this one and say whether it's still the best solution.
If the code is good in the way you implemented it, I think it would be good to move it into some common library in kernel/irq so that both powerpc and c6x as well as future architectures can use the same implementation.
Arnd
Re: [PATCH 12/24] C6X: syscalls
In reply to Mark Salterarch/c6x/include/asm/unistd.h line 23
Quoted 9 lines · Mark Salter
+ */
arch/c6x/include/asm/unistd.h new file +8
-0+#if !defined(_ASM_C6X_UNISTD_H) || defined(__SYSCALL) +#define _ASM_C6X_UNISTD_H + +#define __ARCH_WANT_SYSCALL_DEPRECATED +#define __ARCH_WANT_SYSCALL_NO_AT +#define __ARCH_WANT_SYSCALL_NO_FLAGS +#define __ARCH_WANT_SYSCALL_OFF_T +#define __ARCH_WANT_IPC_PARSE_VERSION
NAK.
Sorry, but these symbols are only meant as transitional helpers for porting your existing libc. We now have a few architectures in mainline that no longer need them because glibc can do without them. Please have a look at what tile and openrisc do here.
Arnd
Arnd Bergmann
maintainerRe: [PATCH 15/24] C6X: cache control
In reply to Mark SalterQuoted 5 lines · Mark Salter
arch/c6x/platforms/cache.c new file +5
-0+/* +* Copyright (C) 2011 Texas Instruments Incorporated +* Author: Mark Salter <[email protected]> +* +* This program is free software; you can redistribute it and/or modify
arch/c6x/platforms/cache.c line 15
Quoted 10 lines
arch/c6x/platforms/cache.c new file +10
-0+* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#include <linux/io.h> + +#include <asm/cache.h> +#include <asm/machdep.h> +#include <asm/soc.h> + +#define IMCR_BASE 0x01840000
Please don't hardcode MMIO regions like this. You should have the base address in the device tree and use of_iomap() like you do in some other cases. If you need this really early, you might need to
arch/c6x/platforms/cache.c line 125
Quoted 6 lines
arch/c6x/platforms/cache.c new file +6
-0+static void cache_block_operation_wait (unsigned int wc_reg) +{ +/* Wait for completion */ +while (imcr_get (wc_reg)) + ; +}
When you have blocking loops like this one, better use cpu_relax() in the loop body. I realize that that is currently a nop, but it's better style to use it anyway.
Quoted 38 lines
arch/c6x/platforms/cache.c new file +38
-0+/* +* Generic function to perform a block cache operation as +* invalidate or writeback/invalidate +*/ +static void cache_block_operation (unsigned int *start, +unsigned int *end, +unsigned int bar_reg, +unsigned int wc_reg) +{ +unsigned long flags; +unsigned int wcnt = + (L2_CACHE_ALIGN_CNT ((unsigned int ) end) + -L2_CACHE_ALIGN_LOW ((unsigned int ) start)) >>2 ; +unsigned int wc =0 ; + +for (; wcnt; wcnt -= wc, start += wc) { +loop: +local_irq_save (flags); + +/* +* If another cache operation is occuring +*/ +if (unlikely (imcr_get (wc_reg))) { +local_irq_restore (flags); + +/* Wait for previous operation completion */ +cache_block_operation_wait (wc_reg); + +/* Try again */ + goto loop; + } + +imcr_set (bar_reg,L2_CACHE_ALIGN_LOW ((unsigned int ) start)); + +if (wcnt >0xffff ) + wc =0xffff ; +else + wc = wcnt;
arch/c6x/platforms/cache.c line 174
Quoted 10 lines
arch/c6x/platforms/cache.c new file +10
-0+ +/* Set word count value in the WC register */ +imcr_set (wc_reg, wc &0xffff ); + +local_irq_restore (flags); + +/* Wait for completion */ +cache_block_operation_wait (wc_reg); + } +}
Doesn't this need a proper spinlock instead of a local_irq_save? You should try to write code with SMP in mind, even if the current usage is UP only. The resulting object code is the same on UP.
Quoted 30 lines
+ * L1P global-invalidate all
+ */arch/c6x/platforms/cache.c new file +28
-0+void L1P_cache_global_invalidate (void ) +{ +unsigned int set =1 ; +imcr_set (IMCR_L1PINV , set); +while (imcr_get (IMCR_L1PINV ) &1 ) + ; +} + +/* +* L1D global-invalidate all +* +* Warning: this operation causes all updated data in L1D to +* be discarded rather than written back to the lower levels of +* memory +*/ +void L1D_cache_global_invalidate (void ) +{ +unsigned int set =1 ; +imcr_set (IMCR_L1DINV , set); +while (imcr_get (IMCR_L1DINV ) &1 ) + ; +} + +void L1D_cache_global_writeback (void ) +{ +unsigned int set =1 ; +imcr_set (IMCR_L1DWB , set); +while (imcr_get (IMCR_L1DWB ) &1 )
arch/c6x/platforms/cache.c line 281
Quoted 10 lines
arch/c6x/platforms/cache.c new file +10
-0+ ; +} + +void L1D_cache_global_writeback_invalidate (void ) +{ +unsigned int set =1 ; +imcr_set (IMCR_L1DWBINV , set); +while (imcr_get (IMCR_L1DWBINV ) &1 ) + ; +}
cpu_relax() again.
Arnd
Arnd Bergmann
maintainerRe: [PATCH 16/24] C6X: module support
In reply to Mark Salterarch/c6x/kernel/c6x_ksyms.c line 43
Quoted 3 lines · Mark Salter
arch/c6x/kernel/c6x_ksyms.c new file +3
-0+extern unsigned long long __c6xabi_divull (unsigned long long n, +unsigned long long d); +EXPORT_SYMBOL (__c6xabi_divull);
A full 64 bit division is very expensive. We have the div64() macro in the kernel to avoid that. It would be a useful optimization to provide a working div64 and remove the __c6xabi_divull export.
Quoted 31 lines
arch/c6x/kernel/module.c new file +31
-0+void *module_alloc (unsigned long size) +{ +if (size ==0 ) +return NULL ; +return vmalloc_exec (size); +} + + +/* Free memory returned from module_alloc */ +void module_free (struct module *mod,void *module_region) +{ +vfree (module_region); +} + +/* +* finish loading the module +*/ +int module_finalize (const Elf_Ehdr *hdr, +const Elf_Shdr *sechdrs, +struct module *me) +{ +return 0 ; +} + +/* +* finish clearing the module +*/ +void module_arch_cleanup (struct module *mod) +{ +module_bug_cleanup (mod); +}
arch/c6x/kernel/module.c line 63
Quoted 10 lines
arch/c6x/kernel/module.c new file +10
-0+ + +/* We don't need anything special. */ +int module_frob_arch_sections (Elf_Ehdr *hdr, +Elf_Shdr *sechdrs, +char *secstrings, +struct module *mod) +{ +return 0 ; +}
After openrisc was merged, you no longer need to provide these functions, they are the default anyway.
Arnd
Arnd Bergmann
maintainerRe: [PATCH 17/24] C6X: ptrace support
In reply to Mark SalterQuoted 14 lines · Mark Salter
+ * Perform ptrace request
+ */arch/c6x/kernel/ptrace.c new file +12
-0+long arch_ptrace (struct task_struct *child,long request, +unsigned long addr,unsigned long data) +{ +unsigned long __user *datap = (unsigned long __user *) data; +int ret =0 ; + +switch (request) { +case PTRACE_PEEKUSR : + ret =ptrace_read_user (child, addr, + (unsigned long __user *) data); +break ; +
arch/c6x/kernel/ptrace.c line 186
Quoted 10 lines
arch/c6x/kernel/ptrace.c new file +10
-0+/* +* write the word at location addr in the user registers. +*/ +case PTRACE_POKEUSR : + ret = -EIO ; +if (addr &3 || addr <0 || addr >=PT_REG_SIZE ) +break ; + + ret =put_reg (child, (int )addr >>2 , data); +break ;
I believe you no longer need to provide PTRACE_PEEKUSR/PTRACE_POKEUSR when you have regset support for all your GPRs.
Arnd
Re: [PATCH 15/24] C6X: cache control
In reply to Arnd BergmannQuoted 5 lines · Arnd Bergmann
Quoted 1 line
+#define
IMCR_BASE0x01840000Please don't hardcode MMIO regions like this. You should have the base address in the device tree and use
of_iomap()like you do in some other cases. If you need this really early, you might need to
What about for memory-mapped CPU registers that you might need to access in head.S?
MN10300, for example, has a bunch of these - such the atomic operation parameter and control registers. Getting some of these through the device tree adds potentially quite a lot of overhead.
David
Arnd Bergmann
maintainerRe: [PATCH 22/24] C6X: specific board support
In reply to Mark SalterQuoted 7 lines · Mark Salter
Signed-off-by Mark Salter <[email protected]>--- arch/c6x/platforms/board-dsk6455.c | 102 ++++++++++++++++++++++++++++++++++++ arch/c6x/platforms/board-evm6457.c | 51 ++++++++++++++++++ arch/c6x/platforms/board-evm6472.c | 51 ++++++++++++++++++ arch/c6x/platforms/board-evm6474.c | 53 +++++++++++++++++++ 4 files changed, 257 insertions(+), 0 deletions(-)
I would argue that none of these should exist. When you have device tree probing, you should be able to do all the initialization according to the device tree contents.
Quoted 35 lines
arch/c6x/platforms/board-dsk6455.c new file +34
-0+c6455_setup_arch (); + +/* CPLD */ +emif_config_ce (2 ,EMIFA_CFG_ASYNC | +EMIFA_CFG_W_SETUP (1 ) | +EMIFA_CFG_W_STROBE (10 ) | +EMIFA_CFG_W_HOLD (1 ) | +EMIFA_CFG_R_SETUP (1 ) | +EMIFA_CFG_R_STROBE (10 ) | +EMIFA_CFG_R_HOLD (1 ) | +EMIFA_CFG_WIDTH_8 ); + +/* NOR Flash */ +emif_config_ce (3 ,EMIFA_CFG_ASYNC | +EMIFA_CFG_W_SETUP (1 ) | +EMIFA_CFG_W_STROBE (10 ) | +EMIFA_CFG_W_HOLD (1 ) | +EMIFA_CFG_R_SETUP (1 ) | +EMIFA_CFG_R_STROBE (10 ) | +EMIFA_CFG_R_HOLD (1 ) | +EMIFA_CFG_WIDTH_8 ); + +/* Daughter Card */ +emif_config_ce (4 ,EMIFA_CFG_ASYNC | +EMIFA_CFG_W_SETUP (1 ) | +EMIFA_CFG_W_STROBE (10 ) | +EMIFA_CFG_W_HOLD (1 ) | +EMIFA_CFG_R_SETUP (1 ) | +EMIFA_CFG_R_STROBE (10 ) | +EMIFA_CFG_R_HOLD (1 ) | +EMIFA_CFG_WIDTH_32 ); + +/* Daughter Card */ + emif_config_ce(5, EMIFA_CFG_ASYNC |
arch/c6x/platforms/board-dsk6455.c line 69
Quoted 10 lines
arch/c6x/platforms/board-dsk6455.c new file +10
-0+EMIFA_CFG_W_SETUP (1 ) | +EMIFA_CFG_W_STROBE (10 ) | +EMIFA_CFG_W_HOLD (1 ) | +EMIFA_CFG_R_SETUP (1 ) | +EMIFA_CFG_R_STROBE (10 ) | +EMIFA_CFG_R_HOLD (1 ) | + EMIFA_CFG_WIDTH_32); + +/* Raise priority of waiting bus commands after 255 transfers */ +emif_set_burst_prio (255 );
This code definitely needs more explanation. Why is this all done in Linux instead of the boot loader? If it's device specific, why not do it in the device driver?
Arnd
Arnd Bergmann
maintainerRe: [PATCH 23/24] C6X: miscellaneous low-level SoC support
In reply to Mark SalterQuoted 1 line · Mark Salter
Signed-off-by Mark Salter <[email protected]>
These definitely need some explanation about what the two drivers actually do. In fact, a lot of the patches you sent seem to lack any description whatsoever.
Also, the settings that you put into the drivers are hardcoded in soc-specific code. It would be much better to integrate all this into the device tree probing mechanism.
Arnd
Re: [PATCH 22/24] C6X: specific board support
In reply to Arnd BergmannQuoted 10 lines · Arnd Bergmann
Quoted 3 lines · Mark Salter
Signed-off-by Mark Salter <[email protected]>--- arch/c6x/platforms/board-dsk6455.c | 102++++++++++++++++++++++++++++++++++++
Quoted 4 lines
arch/c6x/platforms/board-evm6457.c | 51 ++++++++++++++++++ arch/c6x/platforms/board-evm6472.c | 51 ++++++++++++++++++ arch/c6x/platforms/board-evm6474.c | 53 +++++++++++++++++++ 4 files changed, 257 insertions(+), 0 deletions(-)
Quoted 5 lines
I would argue that none of these should exist. When you have device tree probing,
you should be able to do all the initialization according to the device tree contents.
Yes, one of your previous replies touched on this point and got me to thinking about it. I think it would be fairly easy to get rid of them.
--Mark
Re: [PATCH 04/24] C6X: build infrastructure
In reply to Mark SalterHi Mark.
Some review feedback.
Quoted 17 lines
arch/c6x/Kconfig new file +11
-0@@ -0,0 +1,180 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# + +config TMS320C6X + def_bool y + select CLKDEV_LOOKUP + select HAVE_MEMBLOCK + select HAVE_SPARSE_IRQ + select GENERIC_IRQ_SHOW
arch/c6x/Kconfig line 21
Quoted 10 lines
arch/c6x/Kconfig new file +10
-0+ select HAVE_GENERIC_HARDIRQS + select GENERIC_HARDIRQS_NO__DO_IRQ + select GENERIC_HARDIRQS_NO__DO_IRQ + select GENERIC_HARDIRQS_NO_DEPRECATED + select GENERIC_FIND_FIRST_BIT + select GENERIC_FIND_NEXT_BIT + select GENERIC_FIND_LAST_BIT + select GENERIC_FIND_BIT_LE + select OF + select OF_EARLY_FLATTREE
I recommend to keep the above list sorted alphabetically - to minimize merge conflicts. But alas no-one follows this recommendation - but this should not prevent you from doing so.
arch/c6x/Kconfig line 23
Quoted 2 lines
arch/c6x/Kconfig new file +2
-0+config GENERIC_FIND_NEXT_BIT + def_bool y
Commit: 63e424c84429903c92a0f1e9654c31ccaf6694d0 removed use of GENERIC_FIND_*.
They also need to be removed from the select above - all og GENERIC_FIND_*
arch/c6x/Kconfig line 75
Quoted 11 lines
arch/c6x/Kconfig new file +11
-0+config BIG_KERNEL + bool "Build a big kernel" + help + The C6X function call instruction has a limited range of +/- 2MiB. + This is sufficient for most kernels, but some kernel configurations + with lots of compiled-in functionality may require a larger range + for function calls. Use this option to have the compiler generate + function calls with 32-bit range. This will make the kernel both + larger and slower. + + If unsure, say N.
To preserve namespace please prefix all C6X specific config symbols with C6X_. This is true for several symbols.
Btw. I was briefly thinking on BKL when I saw this one :-)
arch/c6x/Kconfig line 125
Quoted 3 lines
arch/c6x/Kconfig new file +3
-0+config FORCE_MAX_ZONEORDER + int + default "13"
help text is missing. This is the case for several options.
If it is obvious for you what it is - then it should be simple to write a few lines about it.
arch/c6x/Kconfig line 160
Quoted 8 lines
arch/c6x/Kconfig new file +8
-0+ +menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" + +config PCI + bool "PCI support" + help + Support for PCI bus. +endmenu
I expect you to drop this.
But in general do not refer to stuff that is not valid for your arch. I guess you do not have ISA either.
Quoted 11 lines
arch/c6x/Kconfig new file +1
-0+source "arch/c6x/Kconfig.debug"arch/c6x/Kconfig.debug new file +4
-0@@ -0,0 +1,14 @@ +menu "Kernel hacking" + +source "lib/Kconfig.debug" +
arch/c6x/Kconfig.debug line 14
Quoted 10 lines
arch/c6x/Kconfig.debug new file +10
-0+config ACCESS_CHECK + bool "Check the user pointer address" + default y + help + Usually the pointer transfer from user space is checked to see if its + address is in the kernel space. + + Say N here to disable that check to improve the performance. + +endmenu
No need for a dedicated Kconfig.debug file for a single option.
Quoted 16 lines
arch/c6x/Makefile new file +10
-0@@ -0,0 +1,56 @@ +# +# linux/arch/c6x/Makefile +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. +# + +cflags-y := -D__linux__ -D__TMS320C6X__ +
arch/c6x/Makefile line 20
Quoted 10 lines
arch/c6x/Makefile new file +10
-0+cflags-$(CONFIG_TMS320C64XPLUS) += -D__TMS320C6XPLUS__ -march=c64x+ + +cflags-y += -mno-dsbt -msdata=none + +cflags-$(CONFIG_BIG_KERNEL) += -mlong-calls + +CFLAGS_MODULE += -mlong-calls -mno-dsbt -msdata=none + +KBUILD_CFLAGS += $(cflags-y) +KBUILD_AFLAGS += $(cflags-y)
I am missing sparse support:
CHECKFLAGS += ...
arch/c6x/Makefile line 27
Quoted 7 lines
arch/c6x/Makefile new file +7
-0+ +ifdef CONFIG_CPU_BIG_ENDIAN +KBUILD_CFLAGS += -mbig-endian +KBUILD_AFLAGS += -mbig-endian +LINKFLAGS += -mbig-endian +KBUILD_LDFLAGS += -mbig-endian +LDFLAGS += -EB
Mixed use of tabs and space for indent.
As tabs has special semantic in Makefile avoid using tabs for indent. I personally restrain from using tabs in Makefile due to this. But this is a personal thing. Do what you prefer - but be consistent.
Quoted 9 lines
arch/c6x/Makefile new file +9
-0+endif + +head-y := arch/c6x/kernel/head.o +core-y += arch/c6x/kernel/ arch/c6x/mm/ arch/c6x/platforms/ +libs-y += arch/c6x/lib/ + +# Default to vmlinux.bin, override when needed +all: vmlinux.bin +
arch/c6x/Makefile line 46
Quoted 10 lines
arch/c6x/Makefile new file +10
-0+boot := arch/$(ARCH)/boot + +# With make 3.82 we cannot mix normal and wildcard targets +BOOT_TARGETS1 = vmlinux.bin +BOOT_TARGETS2 = dtbImage.% + +$(BOOT_TARGETS1): vmlinux + $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) +$(BOOT_TARGETS2): vmlinux + $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
No need for the two BOOT_TARGETS variables. We try to be explicit when we can. But you need to add both rules due to make semantics as you also document.
arch/c6x/Makefile line 56
Quoted 10 lines
arch/c6x/Makefile new file +10
-0+ +archclean: + $(Q)$(MAKE) $(clean)=$(boot) + +define archhelp + @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' + @echo ' vmlinux.bin - Binary kernel image (arch/$(ARCH)/boot/vmlinux.bin)' + @echo ' dtbImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in' + @echo ' - stripped elf with fdt blob' +endef
*_defconfig is already covered by the normal "make help" - no need to add them twice.
arch/c6x/boot/Makefile line 5
Quoted 11 lines
arch/c6x/boot/Makefile new file +5
-0@@ -0,0 +1,22 @@ +# +# Makefile for bootable kernel images +# + +all: $(obj)/vmlinux.bin
You never pass the "all" target to the boot makefile - so this line can be dropped.
arch/c6x/boot/Makefile line 10
Quoted 5 lines
arch/c6x/boot/Makefile new file +5
-0+ +hostprogs-y := install-dtb + +$(obj)/vmlinux.bin: vmlinux + $(OBJCOPY) -O binary $< $@
See how x86 handle objcopy.
This is a much nicer output.
arch/c6x/boot/Makefile line 15
Quoted 5 lines
arch/c6x/boot/Makefile new file +5
-0+ + +$(obj)/dtbImage.%: vmlinux $(obj)/install-dtb $(obj)/%.dtb + cp vmlinux $@ + $(obj)/install-dtb $(obj)/$*.dtb $@
This can be made nicer to using more kbuild support.
Quoted 14 lines
arch/c6x/boot/Makefile new file +7
-0+ +clean-files := $(obj)/*.dtb + +DTC_FLAGS ?= -p 1024 + +$(obj)/%.dtb: $(src)/dts/%.dts FORCE + $(call cmd,dtc)arch/c6x/kernel/Makefile new file +0
-0
arch/c6x/kernel/Makefile line 10
Quoted 10 lines
arch/c6x/kernel/Makefile new file +10
-0@@ -0,0 +1,12 @@ +# +# Makefile for arch/c6x/kernel/ +# + +extra-y := head.o vmlinux.lds + +obj-y := process.o traps.o irq.o signal.o ptrace.o \ + setup.o sys_c6x.o time.o devicetree.o \ + switch_to.o entry.o vectors.o c6x_ksyms.o\ + soc.o
Everyone and their cousins seems to like the style with continued lines in Makefile.
But using the following is IMO more readable and less errorprone:
obj-y := process.o traps.o irq.o signal.o ptrace.o obj-y += setup.o sys_c6x.o time.o devicetree.o obj-y += switch_to.o entry.o vectors.o c6x_ksyms.o obj-y += soc.o
Or maybe even like this:
obj-y += c6x_ksyms.o
obj-y += devicetree.o
obj-y += entry.o
obj-y += irq.o
obj-y += ptrace.o
obj-y := process.o
obj-y += setup.o
obj-y += signal.o
obj-y += soc.o
obj-y += sys_c6x.o
obj-y += switch_to.o
obj-y += traps.o
obj-y += time.o
obj-y += vectors.o
then there is room for a comment if you have something to say. We use the "one assignment per line" in many places. the extra lines does not matter.
Quoted 7 lines
arch/c6x/kernel/Makefile new file +1
-0+obj-$(CONFIG_MODULES) += module.oarch/c6x/kernel/vmlinux.lds.S new file +0
-0
arch/c6x/kernel/vmlinux.lds.S line 7
Quoted 7 lines
arch/c6x/kernel/vmlinux.lds.S new file +7
-0@@ -0,0 +1,165 @@ +/* + * ld script for the c6x kernel + * + * Copyright (C) 2010, 2011 Texas Instruments Incorporated + * Mark Salter <[email protected]> + */ +#define __VMLINUX_LDS__
I do not see this used - can it be deleted?
Quoted 22 lines
arch/c6x/kernel/vmlinux.lds.S new file +22
-0+#include <asm-generic/vmlinux.lds.h> +#include <asm/thread_info.h> +#include <asm/page.h> + +ENTRY(_c_int00) + +#if defined(CONFIG_CPU_BIG_ENDIAN) +jiffies = jiffies_64 + 4; +#else +jiffies = jiffies_64; +#endif + +#define READONLY_SEGMENT_START \ + . = PAGE_OFFSET; +#define READWRITE_SEGMENT_START \ + . = ALIGN(128); \ + _data_lma = .; + +SECTIONS +{ + /* + * Start kernel read only segment
arch/c6x/kernel/vmlinux.lds.S line 39
Quoted 10 lines
arch/c6x/kernel/vmlinux.lds.S new file +10
-0+ */ + READONLY_SEGMENT_START + + .vectors : + { + VMLINUX_SYMBOL(_vectors_start) = .; + *(.vectors) + . = ALIGN(0x400); + VMLINUX_SYMBOL(_vectors_end) = .; + }
You can drop VMLINUX_SYMBOL in the arch specific part
of vmlinux.lds.h - it is invented for the braindead tool-chains that add an "_" in front of all symbols.
If you insist on using VMLINUX_SYMBOL then be consistent. It is not used for __machine_desc_start
arch/c6x/kernel/vmlinux.lds.S line 42
Quoted 3 lines
arch/c6x/kernel/vmlinux.lds.S new file +3
-0+ + . = ALIGN(0x1000); + .cmdline : { *(.cmdline) }
Please follow C syntax - like this:
.cmdline : {
*(.cmdline)
}This is what we do in (almost) all linker scripts these days. And consistensy is a good thing here.
arch/c6x/kernel/vmlinux.lds.S line 49
Quoted 7 lines
arch/c6x/kernel/vmlinux.lds.S new file +7
-0+ + /* + * This section contains data which may be shared with other + * cores. It needs to be a fixed offset from PAGE_OFFSET + * regardless of kernel configuration. + */ + .virtio_ipc_dev : { *(.virtio_ipc_dev) }
C style.
arch/c6x/kernel/vmlinux.lds.S line 155
Quoted 5 lines
arch/c6x/kernel/vmlinux.lds.S new file +5
-0+ + + STABS_DEBUG + + DWARF_DEBUG
Is STABS _and_ DWARF both required?
Not a big deal - but is STABS is not supported by your tool-chain then drop it.
arch/c6x/kernel/vmlinux.lds.S line 164
Quoted 8 lines
arch/c6x/kernel/vmlinux.lds.S new file +8
-0+ /DISCARD/ : { + EXIT_TEXT + EXIT_DATA + EXIT_CALL + *(.discard) + *(.discard.*) + *(.interp) + }
I assume you did not use DISCARDS due to "*(.interp)".
arch/c6x/kernel/vmlinux.lds.S line 67
Quoted 5 lines
arch/c6x/kernel/vmlinux.lds.S new file +5
-0+# Makefile for arch/c6x/lib/ +# + +lib-y := divu.o divi.o pop_rts.o push_rts.o remi.o remu.o strasgi.o llshru.o \ + llshr.o llshl.o negll.o mpyll.o divull.o divremi.o divremu.o
Multi line..
Quoted 8 lines
arch/c6x/kernel/vmlinux.lds.S new file +2
-0+ +lib-$(CONFIG_TMS320C64XPLUS) += csum_64plus.o memcpy_64plus.o strasgi_64plus.oarch/c6x/mm/Makefile new file +0
-0
arch/c6x/mm/Makefile line 8
Quoted 8 lines
arch/c6x/mm/Makefile new file +8
-0@@ -0,0 +1,10 @@ +# +# Makefile for the linux c6x-specific parts of the memory manager. +# +# Note! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# +# Note 2! The CFLAGS definition is now in the main makefile...
Kill obsolete comments.
arch/c6x/mm/Makefile line 10
Quoted 2 lines
arch/c6x/mm/Makefile new file +2
-0+ +obj-y := init.o dma-coherent.o
Sam
Re: [PATCH 05/24] C6X: early boot code
In reply to Mark Salterarch/c6x/kernel/head.S line 14
Quoted 5 lines
arch/c6x/kernel/head.S new file +5
-0+; +#include <linux/linkage.h> +#include <linux/of_fdt.h> +#include <asm/asm-offsets.h> +
I would expect this code to be part of the head section:
Use __HEAD
Quoted 82 lines
arch/c6x/kernel/head.S new file +69
-0+ENTRY(_c_int00) + ;; Save magic and pointer + MV .S1 A4,A10 + MV .S2 B4,B10 + MVKL .S2 __bss_start,B5 + MVKH .S2 __bss_start,B5 + MVKL .S2 __bss_stop,B6 + MVKH .S2 __bss_stop,B6 + SUB .L2 B6,B5,B6 ; bss size + + ;; Set the stack pointer + MVKL .S2 current_ksp,B0 + MVKH .S2 current_ksp,B0 + LDW .D2T2 *B0,B15 + + ;; clear bss + SHR .S2 B6,3,B0 ; number of dwords to clear + ZERO .L2 B13 + ZERO .L2 B12 +bss_loop: + BDEC .S2 bss_loop,B0 + NOP 3 + CMPLT .L2 B0,0,B1 + [!B1] STDW .D2T2 B13:B12,*B5++[1] + + NOP 4 + AND .D2 ~7,B15,B15 + + ;; Clear GIE and PGIE + MVC .S2 CSR,B2 + CLR .S2 B2,0,1,B2 + MVC .S2 B2,CSR + MVC .S2 TSR,B2 + CLR .S2 B2,0,1,B2 + MVC .S2 B2,TSR + MVC .S2 ITSR,B2 + CLR .S2 B2,0,1,B2 + MVC .S2 B2,ITSR + MVC .S2 NTSR,B2 + CLR .S2 B2,0,1,B2 + MVC .S2 B2,NTSR + + ;; pass DTB pointer to machine_init (or zero if none) + MVKL .S1 OF_DT_HEADER,A0 + MVKH .S1 OF_DT_HEADER,A0 + CMPEQ .L1 A10,A0,A0 + [A0] MV .S1X B10,A4 + [!A0] MVK .S1 0,A4 + +#ifdef CONFIG_BIG_KERNEL + MVKL .S1 machine_init,A0 + MVKH .S1 machine_init,A0 + B .S2X A0 + ADDKPC .S2 0f,B3,4 +0: +#else + CALLP .S2 machine_init,B3 +#endif + + ;; Jump to Linux init +#ifdef CONFIG_BIG_KERNEL + MVKL .S1 start_kernel,A0 + MVKH .S1 start_kernel,A0 + B .S2X A0 +#else + B .S2 start_kernel +#endif + NOP 5 +L1: BNOP .S2 L1,5arch/c6x/kernel/setup.c +12
-0+#include <linux/of.h> +#include <linux/of_fdt.h> +#include <linux/kernel.h> +#include <linux/sched.h> +#include <linux/delay.h> +#include <linux/interrupt.h> +#include <linux/fs.h> +#include <linux/genhd.h> +#include <linux/errno.h> +#include <linux/console.h> +#include <linux/string.h> +#include <linux/delay.h>
arch/c6x/kernel/setup.c line 32
Quoted 10 lines
arch/c6x/kernel/setup.c +10
-0+#include <linux/bootmem.h> +#include <linux/seq_file.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/mm.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/cache.h> +#include <linux/dma-mapping.h> +#include <linux/memblock.h>
For C files we sometimes use "inverse christmas tree" sort for include lists. That is:
longest lines first.
And sorted alphabetically within blocks of equal length.
This would also make it obvious had you had two identical include files.
arch/c6x/kernel/setup.c line 43
Quoted 10 lines
arch/c6x/kernel/setup.c +10
-0+#include <asm/setup.h> +#include <asm/irq.h> +#include <asm/machdep.h> +#include <asm/sections.h> +#include <asm/soc.h> + +#ifdef CONFIG_BLK_DEV_INITRD +#include <linux/initrd.h> +#include <asm/pgtable.h> +#endif
Do these include really need to be guarded?
arch/c6x/kernel/setup.c line 49
Quoted 6 lines
arch/c6x/kernel/setup.c +6
-0+ +#ifdef DEBUG +#define DBG(fmt...) printk(KERN_ERR fmt) +#else +#define DBG(fmt...) +#endif
Drop this. It is used in one place - which I think is not a debug info anyway.
arch/c6x/kernel/setup.c line 269
Quoted 5 lines
arch/c6x/kernel/setup.c +5
-0+/* What can we do if we didn't find ? */ +if (machine_id >= &__machine_desc_end) { +DBG ("No suitable machine found !\n" ); +for (;;) + ;
We stop in a never ending loop.
So debug seems not appropriate...
Quoted 1 line
Arnd Bergmann
maintainerRe: [PATCH 15/24] C6X: cache control
In reply to David HowellsQuoted 8 lines · David Howells
Quoted 5 lines · Arnd Bergmann
Quoted 1 line
+#define
IMCR_BASE0x01840000Please don't hardcode MMIO regions like this. You should have the base address in the device tree and use
of_iomap()like you do in some other cases. If you need this really early, you might need to
Quoted 7 lines
What about for memory-mapped CPU registers that you might need to access in
head.S?MN10300, for example, has a bunch of these - such the atomic operation parameter and control registers. Getting some of these through the device tree adds potentially quite a lot of overhead.
It really depends on the specific problem. The registers in this file (cache.c) do not seem to fall into that category, since they are ioremapped much later.
For any addresses that you don't get from a device tree but assume to be constant, I would recommend:
* documenting them well, with the specific reasons why you know they are safe to hardcode and why it would be a pain not to.
* putting them in one architecture-wide header file that contains all of these constants, rather than putting them into a local C file.
On ARM, we have a case where we want to access MMIO registers extremely early, for printing debugging output on the serial port. Since the specific addresses are different from one board to another, there is no generic solution, but it's possible to have a compile-time option to enable that code conditionally.
In some other cases, where you have to do some very early setup of registers, a new architecture port can require the boot loader to set the registers up to a sensible value before entering the kernel.
Arnd
Arnd Bergmann
maintainerRe: [PATCH 22/24] C6X: specific board support
In reply to Mark SalterQuoted 10 lines · Mark Salter
Quoted 6 lines
I would argue that none of these should exist. When you have device tree probing,
you should be able to do all the initialization according to the device tree contents.Yes, one of your previous replies touched on this point and got me to thinking about it. I think it would be fairly easy to get rid of them.
Ok, very good.
Arnd
Re: [PATCH 10/24] C6X: time management
In reply to Arnd BergmannQuoted 9 lines · Arnd Bergmann
arch/c6x/kernel/time.c line 38
Quoted 4 lines
arch/c6x/kernel/time.c new file +4
-0+static cycle_t tsc_read (struct clocksource *cs) +{ +return get_cycles (); +}What is this good for? TSC is an x86 specific feature, so you should just
be able to useget_cyclesdirectly.
TSC (Time Stamp Counter) is how the C6X hardware manuals refer to the free running 64-bit core clock counter. The tsc_read function is needed to provide a function with the correct prototype for struct clocksource read method.
--Mark
Re: [PATCH 07/24] C6X: memory management
In reply to Arnd BergmannQuoted 13 lines · Arnd Bergmann
Quoted 1 line
+static inline int dma_is_consistent(struct device *dev,
dma_addr_thandle)
arch/c6x/include/asm/dma-mapping.h line 91
Quoted 6 lines
arch/c6x/include/asm/dma-mapping.h new file +6
-0+{ +if (arch_is_coherent () ||__dma_is_coherent (dev, handle)) +return 1 ; +else +return 0 ; +}Does this need to be both a runtime decision and set per device? Most architectures are just always consistent or never, so you could turn this into an #ifdef block to define the two versions, or even just provide one version.
C6X is never consistent in that there is no hw snooping between main memory and L2 cache. There is some cache control however which allows us to create a pool of uncached memory for use as consistent DMA memory. I think the __dma_is_coherent tries to tell at runtime if the dma handle comes from such a pool of consistent memory.
I'm not aware of any drivers actually needing this although I'm sure TI has some. For the purpose of getting the arch accepted, I could just punt and take it out for now, simplifying the dma support. It can be revisited later if needed.
--Mark
Arnd Bergmann
maintainerRe: [PATCH 10/24] C6X: time management
In reply to Mark SalterQuoted 11 lines · Mark Salter
Quoted 9 lines · Arnd Bergmann
arch/c6x/kernel/time.c line 38
Quoted 4 lines
arch/c6x/kernel/time.c new file +4
-0+static cycle_t tsc_read (struct clocksource *cs) +{ +return get_cycles (); +}What is this good for? TSC is an x86 specific feature, so you should just
be able to useget_cyclesdirectly.
Quoted 4 lines
TSC (Time Stamp Counter) is how the C6X hardware manuals refer to the free running 64-bit core clock counter. The
tsc_readfunction is needed to provide a function with the correct prototype for struct clocksource read method.
Ok, I see.
Arnd
Arnd Bergmann
maintainerRe: [PATCH 07/24] C6X: memory management
In reply to Mark SalterQuoted 10 lines · Mark Salter
C6X is never consistent in that there is no hw snooping between main memory and L2 cache. There is some cache control however which allows us to create a pool of uncached memory for use as consistent DMA memory. I think the
__dma_is_coherenttries to tell at runtime if the dma handle comes from such a pool of consistent memory.I'm not aware of any drivers actually needing this although I'm sure TI has some. For the purpose of getting the arch accepted, I could just punt and take it out for now, simplifying the dma support. It can be revisited later if needed.
Yes, sounds good. Not sure if you meant removing all calls to arch_is_coherent() as well, but I'd suggest you do that, too. This should further simplify the code by removing code paths that are unused and untested.
Arnd