Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS updates from Ralf Baechle: "This is the main MIPS pull request for 4.9: MIPS core arch code: - traps: 64bit kernels should read CP0_EBase 64bit - traps: Convert ebase to KSEG0 - c-r4k: Drop bc_wback_inv() from icache flush - c-r4k: Split user/kernel flush_icache_range() - cacheflush: Use __flush_icache_user_range() - uprobes: Flush icache via kernel address - KVM: Use __local_flush_icache_user_range() - c-r4k: Fix flush_icache_range() for EVA - Fix -mabi=64 build of vdso.lds - VDSO: Drop duplicated -I*/-E* aflags - tracing: move insn_has_delay_slot to a shared header - tracing: disable uprobe/kprobe on compact branch instructions - ptrace: Fix regs_return_value for kernel context - Squash lines for simple wrapper functions - Move identification of VP(E) into proc.c from smp-mt.c - Add definitions of SYNC barrierstype values - traps: Ensure full EBase is written - tlb-r4k: If there are wired entries, don't use TLBINVF - Sanitise coherentio semantics - dma-default: Don't check hw_coherentio if device is non-coherent - Support per-device DMA coherence - Adjust MIPS64 CAC_BASE to reflect Config.K0 - Support generating Flattened Image Trees (.itb) - generic: Introduce generic DT-based board support - generic: Convert SEAD-3 to a generic board - Enable hardened usercopy - Don't specify STACKPROTECTOR in defconfigs Octeon: - Delete dead code and files across the platform. - Change to use all memory into use by default. - Rename upper case variables in setup code to lowercase. - Delete legacy hack for broken bootloaders. - Leave maintaining the link state to the actual ethernet/PHY drivers. - Add DTS for D-Link DSR-500N. - Fix PCI interrupt routing on D-Link DSR-500N. Pistachio: - Remove ANDROID_TIMED_OUTPUT from defconfig TX39xx: - Move GPIO setup from .mem_setup() to .arch_init() - Convert to Common Clock Framework TX49xx: - Move GPIO setup from .mem_setup() to .arch_init() - Convert to Common Clock Framework txx9wdt: - Add missing clock (un)prepare calls for CCF BMIPS: - Add PW, GPIO SDHCI and NAND device node names - Support APPENDED_DTB - Add missing bcm97435svmb to DT_NONE - Rename bcm96358nb4ser to bcm6358-neufbox4-sercom - Add DT examples for BCM63268, BCM3368 and BCM6362 - Add support for BCM3368 and BCM6362 PCI - Reduce stack frame usage - Use struct list_head lists - Support for CONFIG_PCI_DOMAINS_GENERIC - Make pcibios_set_cache_line_size an initcall - Inline pcibios_assign_all_busses - Split pci.c into pci.c & pci-legacy.c - Introduce CONFIG_PCI_DRIVERS_LEGACY - Support generic drivers CPC - Convert bare 'unsigned' to 'unsigned int' - Avoid lock when MIPS CM >= 3 is present GIC: - Delete unused file smp-gic.c mt7620: - Delete unnecessary assignment for the field "owner" from PCI BCM63xx: - Let clk_disable() return immediately if clk is NULL pm-cps: - Change FSB workaround to CPU blacklist - Update comments on barrier instructions - Use MIPS standard lightweight ordering barrier - Use MIPS standard completion barrier - Remove selection of sync types - Add MIPSr6 CPU support - Support CM3 changes to Coherence Enable Register SMP: - Wrap call to mips_cpc_lock_other in mips_cm_lock_other - Introduce mechanism for freeing and allocating IPIs cpuidle: - cpuidle-cps: Enable use with MIPSr6 CPUs. SEAD3: - Rewrite to use DT and generic kernel feature. USB: - host: ehci-sead3: Remove SEAD-3 EHCI code FBDEV: - cobalt_lcdfb: Drop SEAD3 support dt-bindings: - Document a binding for simple ASCII LCDs auxdisplay: - img-ascii-lcd: driver for simple ASCII LCD displays irqchip i8259: - i8259: Add domain before mapping parent irq - i8259: Allow platforms to override poll function - i8259: Remove unused i8259A_irq_pending Malta: - Rewrite to use DT of/platform: - Probe "isa" busses by default CM: - Print CM error reports upon bus errors Module: - Migrate exception table users off module.h and onto extable.h - Make various drivers explicitly non-modular: - Audit and remove any unnecessary uses of module.h mailmap: - Canonicalize to Qais' current email address. Documentation: - MIPS supports HAVE_REGS_AND_STACK_ACCESS_API Loongson1C: - Add CPU support for Loongson1C - Add board support - Add defconfig - Add RTC support for Loongson1C board All this except one Documentation fix has sat in linux-next and has survived Imagination's automated build test system" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (127 commits) Documentation: MIPS supports HAVE_REGS_AND_STACK_ACCESS_API MIPS: ptrace: Fix regs_return_value for kernel context MIPS: VDSO: Drop duplicated -I*/-E* aflags MIPS: Fix -mabi=64 build of vdso.lds MIPS: Enable hardened usercopy MIPS: generic: Convert SEAD-3 to a generic board MIPS: generic: Introduce generic DT-based board support MIPS: Support generating Flattened Image Trees (.itb) MIPS: Adjust MIPS64 CAC_BASE to reflect Config.K0 MIPS: Print CM error reports upon bus errors MIPS: Support per-device DMA coherence MIPS: dma-default: Don't check hw_coherentio if device is non-coherent MIPS: Sanitise coherentio semantics MIPS: PCI: Support generic drivers MIPS: PCI: Introduce CONFIG_PCI_DRIVERS_LEGACY MIPS: PCI: Split pci.c into pci.c & pci-legacy.c MIPS: PCI: Inline pcibios_assign_all_busses MIPS: PCI: Make pcibios_set_cache_line_size an initcall MIPS: PCI: Support for CONFIG_PCI_DOMAINS_GENERIC MIPS: PCI: Use struct list_head lists ...
This commit is contained in:
@@ -126,8 +126,7 @@
|
||||
#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p))
|
||||
#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p))
|
||||
#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
|
||||
#define PHYS_TO_XKPHYS(cm, a) (_CONST64_(0x8000000000000000) | \
|
||||
(_CONST64_(cm) << 59) | (a))
|
||||
#define PHYS_TO_XKPHYS(cm, a) (XKPHYS | (_ACAST64_(cm) << 59) | (a))
|
||||
|
||||
/*
|
||||
* The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting
|
||||
|
@@ -10,6 +10,102 @@
|
||||
|
||||
#include <asm/addrspace.h>
|
||||
|
||||
/*
|
||||
* Sync types defined by the MIPS architecture (document MD00087 table 6.5)
|
||||
* These values are used with the sync instruction to perform memory barriers.
|
||||
* Types of ordering guarantees available through the SYNC instruction:
|
||||
* - Completion Barriers
|
||||
* - Ordering Barriers
|
||||
* As compared to the completion barrier, the ordering barrier is a
|
||||
* lighter-weight operation as it does not require the specified instructions
|
||||
* before the SYNC to be already completed. Instead it only requires that those
|
||||
* specified instructions which are subsequent to the SYNC in the instruction
|
||||
* stream are never re-ordered for processing ahead of the specified
|
||||
* instructions which are before the SYNC in the instruction stream.
|
||||
* This potentially reduces how many cycles the barrier instruction must stall
|
||||
* before it completes.
|
||||
* Implementations that do not use any of the non-zero values of stype to define
|
||||
* different barriers, such as ordering barriers, must make those stype values
|
||||
* act the same as stype zero.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Completion barriers:
|
||||
* - Every synchronizable specified memory instruction (loads or stores or both)
|
||||
* that occurs in the instruction stream before the SYNC instruction must be
|
||||
* already globally performed before any synchronizable specified memory
|
||||
* instructions that occur after the SYNC are allowed to be performed, with
|
||||
* respect to any other processor or coherent I/O module.
|
||||
*
|
||||
* - The barrier does not guarantee the order in which instruction fetches are
|
||||
* performed.
|
||||
*
|
||||
* - A stype value of zero will always be defined such that it performs the most
|
||||
* complete set of synchronization operations that are defined.This means
|
||||
* stype zero always does a completion barrier that affects both loads and
|
||||
* stores preceding the SYNC instruction and both loads and stores that are
|
||||
* subsequent to the SYNC instruction. Non-zero values of stype may be defined
|
||||
* by the architecture or specific implementations to perform synchronization
|
||||
* behaviors that are less complete than that of stype zero. If an
|
||||
* implementation does not use one of these non-zero values to define a
|
||||
* different synchronization behavior, then that non-zero value of stype must
|
||||
* act the same as stype zero completion barrier. This allows software written
|
||||
* for an implementation with a lighter-weight barrier to work on another
|
||||
* implementation which only implements the stype zero completion barrier.
|
||||
*
|
||||
* - A completion barrier is required, potentially in conjunction with SSNOP (in
|
||||
* Release 1 of the Architecture) or EHB (in Release 2 of the Architecture),
|
||||
* to guarantee that memory reference results are visible across operating
|
||||
* mode changes. For example, a completion barrier is required on some
|
||||
* implementations on entry to and exit from Debug Mode to guarantee that
|
||||
* memory effects are handled correctly.
|
||||
*/
|
||||
|
||||
/*
|
||||
* stype 0 - A completion barrier that affects preceding loads and stores and
|
||||
* subsequent loads and stores.
|
||||
* Older instructions which must reach the load/store ordering point before the
|
||||
* SYNC instruction completes: Loads, Stores
|
||||
* Younger instructions which must reach the load/store ordering point only
|
||||
* after the SYNC instruction completes: Loads, Stores
|
||||
* Older instructions which must be globally performed when the SYNC instruction
|
||||
* completes: Loads, Stores
|
||||
*/
|
||||
#define STYPE_SYNC 0x0
|
||||
|
||||
/*
|
||||
* Ordering barriers:
|
||||
* - Every synchronizable specified memory instruction (loads or stores or both)
|
||||
* that occurs in the instruction stream before the SYNC instruction must
|
||||
* reach a stage in the load/store datapath after which no instruction
|
||||
* re-ordering is possible before any synchronizable specified memory
|
||||
* instruction which occurs after the SYNC instruction in the instruction
|
||||
* stream reaches the same stage in the load/store datapath.
|
||||
*
|
||||
* - If any memory instruction before the SYNC instruction in program order,
|
||||
* generates a memory request to the external memory and any memory
|
||||
* instruction after the SYNC instruction in program order also generates a
|
||||
* memory request to external memory, the memory request belonging to the
|
||||
* older instruction must be globally performed before the time the memory
|
||||
* request belonging to the younger instruction is globally performed.
|
||||
*
|
||||
* - The barrier does not guarantee the order in which instruction fetches are
|
||||
* performed.
|
||||
*/
|
||||
|
||||
/*
|
||||
* stype 0x10 - An ordering barrier that affects preceding loads and stores and
|
||||
* subsequent loads and stores.
|
||||
* Older instructions which must reach the load/store ordering point before the
|
||||
* SYNC instruction completes: Loads, Stores
|
||||
* Younger instructions which must reach the load/store ordering point only
|
||||
* after the SYNC instruction completes: Loads, Stores
|
||||
* Older instructions which must be globally performed when the SYNC instruction
|
||||
* completes: N/A
|
||||
*/
|
||||
#define STYPE_SYNC_MB 0x10
|
||||
|
||||
|
||||
#ifdef CONFIG_CPU_HAS_SYNC
|
||||
#define __sync() \
|
||||
__asm__ __volatile__( \
|
||||
|
@@ -28,6 +28,7 @@
|
||||
* - flush_cache_sigtramp() flush signal trampoline
|
||||
* - flush_icache_all() flush the entire instruction cache
|
||||
* - flush_data_cache_page() flushes a page from the data cache
|
||||
* - __flush_icache_user_range(start, end) flushes range of user instructions
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -80,6 +81,10 @@ static inline void flush_icache_page(struct vm_area_struct *vma,
|
||||
|
||||
extern void (*flush_icache_range)(unsigned long start, unsigned long end);
|
||||
extern void (*local_flush_icache_range)(unsigned long start, unsigned long end);
|
||||
extern void (*__flush_icache_user_range)(unsigned long start,
|
||||
unsigned long end);
|
||||
extern void (*__local_flush_icache_user_range)(unsigned long start,
|
||||
unsigned long end);
|
||||
|
||||
extern void (*__flush_cache_vmap)(void);
|
||||
|
||||
|
@@ -24,7 +24,8 @@ static inline int __pure __get_cpu_type(const int cpu_type)
|
||||
case CPU_LOONGSON3:
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYS_HAS_CPU_LOONGSON1B
|
||||
#if defined(CONFIG_SYS_HAS_CPU_LOONGSON1B) || \
|
||||
defined(CONFIG_SYS_HAS_CPU_LOONGSON1C)
|
||||
case CPU_LOONGSON1:
|
||||
#endif
|
||||
|
||||
|
@@ -240,6 +240,7 @@
|
||||
#define PRID_REV_VR4130 0x0080
|
||||
#define PRID_REV_34K_V1_0_2 0x0022
|
||||
#define PRID_REV_LOONGSON1B 0x0020
|
||||
#define PRID_REV_LOONGSON1C 0x0020 /* Same as Loongson-1B */
|
||||
#define PRID_REV_LOONGSON2E 0x0002
|
||||
#define PRID_REV_LOONGSON2F 0x0003
|
||||
#define PRID_REV_LOONGSON3A_R1 0x0005
|
||||
|
@@ -11,6 +11,11 @@ struct dma_map_ops;
|
||||
struct dev_archdata {
|
||||
/* DMA operations on that device */
|
||||
struct dma_map_ops *dma_ops;
|
||||
|
||||
#ifdef CONFIG_DMA_PERDEV_COHERENT
|
||||
/* Non-zero if DMA is coherent with CPU caches */
|
||||
bool dma_coherent;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct pdev_archdata {
|
||||
|
@@ -9,14 +9,22 @@
|
||||
#ifndef __ASM_DMA_COHERENCE_H
|
||||
#define __ASM_DMA_COHERENCE_H
|
||||
|
||||
#ifdef CONFIG_DMA_MAYBE_COHERENT
|
||||
extern int coherentio;
|
||||
enum coherent_io_user_state {
|
||||
IO_COHERENCE_DEFAULT,
|
||||
IO_COHERENCE_ENABLED,
|
||||
IO_COHERENCE_DISABLED,
|
||||
};
|
||||
|
||||
#if defined(CONFIG_DMA_PERDEV_COHERENT)
|
||||
/* Don't provide (hw_)coherentio to avoid misuse */
|
||||
#elif defined(CONFIG_DMA_MAYBE_COHERENT)
|
||||
extern enum coherent_io_user_state coherentio;
|
||||
extern int hw_coherentio;
|
||||
#else
|
||||
#ifdef CONFIG_DMA_COHERENT
|
||||
#define coherentio 1
|
||||
#define coherentio IO_COHERENCE_ENABLED
|
||||
#else
|
||||
#define coherentio 0
|
||||
#define coherentio IO_COHERENCE_DISABLED
|
||||
#endif
|
||||
#define hw_coherentio 0
|
||||
#endif /* CONFIG_DMA_MAYBE_COHERENT */
|
||||
|
@@ -32,4 +32,14 @@ static inline void dma_mark_clean(void *addr, size_t size) {}
|
||||
extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
|
||||
enum dma_data_direction direction);
|
||||
|
||||
#define arch_setup_dma_ops arch_setup_dma_ops
|
||||
static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
|
||||
u64 size, const struct iommu_ops *iommu,
|
||||
bool coherent)
|
||||
{
|
||||
#ifdef CONFIG_DMA_PERDEV_COHERENT
|
||||
dev->archdata.dma_coherent = coherent;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* _ASM_DMA_MAPPING_H */
|
||||
|
@@ -37,12 +37,22 @@
|
||||
|
||||
extern raw_spinlock_t i8259A_lock;
|
||||
|
||||
extern int i8259A_irq_pending(unsigned int irq);
|
||||
extern void make_8259A_irq(unsigned int irq);
|
||||
|
||||
extern void init_i8259_irqs(void);
|
||||
extern int i8259_of_init(struct device_node *node, struct device_node *parent);
|
||||
|
||||
/**
|
||||
* i8159_set_poll() - Override the i8259 polling function
|
||||
* @poll: pointer to platform-specific polling function
|
||||
*
|
||||
* Call this to override the generic i8259 polling function, which directly
|
||||
* accesses i8259 registers, with a platform specific one which may be faster
|
||||
* in cases where hardware provides a more optimal means of polling for an
|
||||
* interrupt.
|
||||
*/
|
||||
extern void i8259_set_poll(int (*poll)(void));
|
||||
|
||||
/*
|
||||
* Do the traditional i8259 interrupt polling thing. This is for the few
|
||||
* cases where no better interrupt acknowledge method is available and we
|
||||
|
@@ -49,7 +49,19 @@ static inline int plat_dma_supported(struct device *dev, u64 mask)
|
||||
|
||||
static inline int plat_device_is_coherent(struct device *dev)
|
||||
{
|
||||
return coherentio;
|
||||
#ifdef CONFIG_DMA_PERDEV_COHERENT
|
||||
return dev->archdata.dma_coherent;
|
||||
#else
|
||||
switch (coherentio) {
|
||||
default:
|
||||
case IO_COHERENCE_DEFAULT:
|
||||
return hw_coherentio;
|
||||
case IO_COHERENCE_ENABLED:
|
||||
return 1;
|
||||
case IO_COHERENCE_DISABLED:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef plat_post_dma_flush
|
||||
|
@@ -115,11 +115,7 @@ static inline unsigned long fd_getfdaddr1(void)
|
||||
|
||||
static inline unsigned long fd_dma_mem_alloc(unsigned long size)
|
||||
{
|
||||
unsigned long mem;
|
||||
|
||||
mem = __get_dma_pages(GFP_KERNEL, get_order(size));
|
||||
|
||||
return mem;
|
||||
return __get_dma_pages(GFP_KERNEL, get_order(size));
|
||||
}
|
||||
|
||||
static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
|
||||
|
@@ -12,6 +12,8 @@
|
||||
|
||||
#include <linux/const.h>
|
||||
|
||||
#include <asm/mipsregs.h>
|
||||
|
||||
/*
|
||||
* This gives the physical RAM offset.
|
||||
*/
|
||||
@@ -52,11 +54,7 @@
|
||||
#ifdef CONFIG_64BIT
|
||||
|
||||
#ifndef CAC_BASE
|
||||
#ifdef CONFIG_DMA_NONCOHERENT
|
||||
#define CAC_BASE _AC(0x9800000000000000, UL)
|
||||
#else
|
||||
#define CAC_BASE _AC(0xa800000000000000, UL)
|
||||
#endif
|
||||
#define CAC_BASE PHYS_TO_XKPHYS(read_c0_config() & CONF_CM_CMASK, 0)
|
||||
#endif
|
||||
|
||||
#ifndef IO_BASE
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#define IO_BASE 0x9200000000000000
|
||||
#define MSPEC_BASE 0x9400000000000000
|
||||
#define UNCAC_BASE 0x9600000000000000
|
||||
#define CAC_BASE 0xa800000000000000
|
||||
|
||||
#define TO_MSPEC(x) (MSPEC_BASE | ((x) & TO_PHYS_MASK))
|
||||
#define TO_HSPEC(x) (HSPEC_BASE | ((x) & TO_PHYS_MASK))
|
||||
|
@@ -36,9 +36,14 @@
|
||||
#define LS1X_IRQ(n, x) (LS1X_IRQ_BASE + (n << 5) + (x))
|
||||
|
||||
#define LS1X_UART0_IRQ LS1X_IRQ(0, 2)
|
||||
#if defined(CONFIG_LOONGSON1_LS1B)
|
||||
#define LS1X_UART1_IRQ LS1X_IRQ(0, 3)
|
||||
#define LS1X_UART2_IRQ LS1X_IRQ(0, 4)
|
||||
#define LS1X_UART3_IRQ LS1X_IRQ(0, 5)
|
||||
#elif defined(CONFIG_LOONGSON1_LS1C)
|
||||
#define LS1X_UART1_IRQ LS1X_IRQ(0, 4)
|
||||
#define LS1X_UART2_IRQ LS1X_IRQ(0, 5)
|
||||
#endif
|
||||
#define LS1X_CAN0_IRQ LS1X_IRQ(0, 6)
|
||||
#define LS1X_CAN1_IRQ LS1X_IRQ(0, 7)
|
||||
#define LS1X_SPI0_IRQ LS1X_IRQ(0, 8)
|
||||
@@ -47,6 +52,9 @@
|
||||
#define LS1X_DMA0_IRQ LS1X_IRQ(0, 13)
|
||||
#define LS1X_DMA1_IRQ LS1X_IRQ(0, 14)
|
||||
#define LS1X_DMA2_IRQ LS1X_IRQ(0, 15)
|
||||
#if defined(CONFIG_LOONGSON1_LS1C)
|
||||
#define LS1X_NAND_IRQ LS1X_IRQ(0, 16)
|
||||
#endif
|
||||
#define LS1X_PWM0_IRQ LS1X_IRQ(0, 17)
|
||||
#define LS1X_PWM1_IRQ LS1X_IRQ(0, 18)
|
||||
#define LS1X_PWM2_IRQ LS1X_IRQ(0, 19)
|
||||
@@ -54,18 +62,49 @@
|
||||
#define LS1X_RTC_INT0_IRQ LS1X_IRQ(0, 21)
|
||||
#define LS1X_RTC_INT1_IRQ LS1X_IRQ(0, 22)
|
||||
#define LS1X_RTC_INT2_IRQ LS1X_IRQ(0, 23)
|
||||
#if defined(CONFIG_LOONGSON1_LS1B)
|
||||
#define LS1X_TOY_INT0_IRQ LS1X_IRQ(0, 24)
|
||||
#define LS1X_TOY_INT1_IRQ LS1X_IRQ(0, 25)
|
||||
#define LS1X_TOY_INT2_IRQ LS1X_IRQ(0, 26)
|
||||
#define LS1X_RTC_TICK_IRQ LS1X_IRQ(0, 27)
|
||||
#define LS1X_TOY_TICK_IRQ LS1X_IRQ(0, 28)
|
||||
#define LS1X_UART4_IRQ LS1X_IRQ(0, 29)
|
||||
#define LS1X_UART5_IRQ LS1X_IRQ(0, 30)
|
||||
#elif defined(CONFIG_LOONGSON1_LS1C)
|
||||
#define LS1X_UART3_IRQ LS1X_IRQ(0, 29)
|
||||
#define LS1X_ADC_IRQ LS1X_IRQ(0, 30)
|
||||
#define LS1X_SDIO_IRQ LS1X_IRQ(0, 31)
|
||||
#endif
|
||||
|
||||
#define LS1X_EHCI_IRQ LS1X_IRQ(1, 0)
|
||||
#define LS1X_OHCI_IRQ LS1X_IRQ(1, 1)
|
||||
#if defined(CONFIG_LOONGSON1_LS1B)
|
||||
#define LS1X_GMAC0_IRQ LS1X_IRQ(1, 2)
|
||||
#define LS1X_GMAC1_IRQ LS1X_IRQ(1, 3)
|
||||
#elif defined(CONFIG_LOONGSON1_LS1C)
|
||||
#define LS1X_OTG_IRQ LS1X_IRQ(1, 2)
|
||||
#define LS1X_GMAC0_IRQ LS1X_IRQ(1, 3)
|
||||
#define LS1X_CAM_IRQ LS1X_IRQ(1, 4)
|
||||
#define LS1X_UART4_IRQ LS1X_IRQ(1, 5)
|
||||
#define LS1X_UART5_IRQ LS1X_IRQ(1, 6)
|
||||
#define LS1X_UART6_IRQ LS1X_IRQ(1, 7)
|
||||
#define LS1X_UART7_IRQ LS1X_IRQ(1, 8)
|
||||
#define LS1X_UART8_IRQ LS1X_IRQ(1, 9)
|
||||
#define LS1X_UART9_IRQ LS1X_IRQ(1, 13)
|
||||
#define LS1X_UART10_IRQ LS1X_IRQ(1, 14)
|
||||
#define LS1X_UART11_IRQ LS1X_IRQ(1, 15)
|
||||
#define LS1X_I2C0_IRQ LS1X_IRQ(1, 17)
|
||||
#define LS1X_I2C1_IRQ LS1X_IRQ(1, 18)
|
||||
#define LS1X_I2C2_IRQ LS1X_IRQ(1, 19)
|
||||
#endif
|
||||
|
||||
#define LS1X_IRQS (LS1X_IRQ(4, 31) + 1 - LS1X_IRQ_BASE)
|
||||
#if defined(CONFIG_LOONGSON1_LS1B)
|
||||
#define INTN 4
|
||||
#elif defined(CONFIG_LOONGSON1_LS1C)
|
||||
#define INTN 5
|
||||
#endif
|
||||
|
||||
#define LS1X_IRQS (LS1X_IRQ(INTN, 31) + 1 - LS1X_IRQ_BASE)
|
||||
|
||||
#define NR_IRQS (MIPS_CPU_IRQS + LS1X_IRQS)
|
||||
|
||||
|
@@ -12,7 +12,11 @@
|
||||
#ifndef __ASM_MACH_LOONGSON32_LOONGSON1_H
|
||||
#define __ASM_MACH_LOONGSON32_LOONGSON1_H
|
||||
|
||||
#if defined(CONFIG_LOONGSON1_LS1B)
|
||||
#define DEFAULT_MEMSIZE 256 /* If no memsize provided */
|
||||
#elif defined(CONFIG_LOONGSON1_LS1C)
|
||||
#define DEFAULT_MEMSIZE 32
|
||||
#endif
|
||||
|
||||
/* Loongson 1 Register Bases */
|
||||
#define LS1X_MUX_BASE 0x1fd00420
|
||||
@@ -20,6 +24,7 @@
|
||||
#define LS1X_GPIO0_BASE 0x1fd010c0
|
||||
#define LS1X_GPIO1_BASE 0x1fd010c4
|
||||
#define LS1X_DMAC_BASE 0x1fd01160
|
||||
#define LS1X_CBUS_BASE 0x1fd011c0
|
||||
#define LS1X_EHCI_BASE 0x1fe00000
|
||||
#define LS1X_OHCI_BASE 0x1fe08000
|
||||
#define LS1X_GMAC0_BASE 0x1fe10000
|
||||
|
@@ -30,5 +30,6 @@ void __init ls1x_clk_init(void);
|
||||
void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata);
|
||||
void __init ls1x_nand_set_platdata(struct plat_ls1x_nand *pdata);
|
||||
void __init ls1x_serial_set_uartclk(struct platform_device *pdev);
|
||||
void __init ls1x_rtc_set_extclk(struct platform_device *pdev);
|
||||
|
||||
#endif /* __ASM_MACH_LOONGSON32_PLATFORM_H */
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#define LS1X_CLK_PLL_FREQ LS1X_CLK_REG(0x0)
|
||||
#define LS1X_CLK_PLL_DIV LS1X_CLK_REG(0x4)
|
||||
|
||||
#if defined(CONFIG_LOONGSON1_LS1B)
|
||||
/* Clock PLL Divisor Register Bits */
|
||||
#define DIV_DC_EN BIT(31)
|
||||
#define DIV_DC_RST BIT(30)
|
||||
@@ -48,4 +49,37 @@
|
||||
#define BYPASS_DDR_WIDTH 1
|
||||
#define BYPASS_CPU_WIDTH 1
|
||||
|
||||
#elif defined(CONFIG_LOONGSON1_LS1C)
|
||||
/* PLL/SDRAM Frequency configuration register Bits */
|
||||
#define PLL_VALID BIT(31)
|
||||
#define FRAC_N GENMASK(23, 16)
|
||||
#define RST_TIME GENMASK(3, 2)
|
||||
#define SDRAM_DIV GENMASK(1, 0)
|
||||
|
||||
/* CPU/CAMERA/DC Frequency configuration register Bits */
|
||||
#define DIV_DC_EN BIT(31)
|
||||
#define DIV_DC GENMASK(30, 24)
|
||||
#define DIV_CAM_EN BIT(23)
|
||||
#define DIV_CAM GENMASK(22, 16)
|
||||
#define DIV_CPU_EN BIT(15)
|
||||
#define DIV_CPU GENMASK(14, 8)
|
||||
#define DIV_DC_SEL_EN BIT(5)
|
||||
#define DIV_DC_SEL BIT(4)
|
||||
#define DIV_CAM_SEL_EN BIT(3)
|
||||
#define DIV_CAM_SEL BIT(2)
|
||||
#define DIV_CPU_SEL_EN BIT(1)
|
||||
#define DIV_CPU_SEL BIT(0)
|
||||
|
||||
#define DIV_DC_SHIFT 24
|
||||
#define DIV_CAM_SHIFT 16
|
||||
#define DIV_CPU_SHIFT 8
|
||||
#define DIV_DDR_SHIFT 0
|
||||
|
||||
#define DIV_DC_WIDTH 7
|
||||
#define DIV_CAM_WIDTH 7
|
||||
#define DIV_CPU_WIDTH 7
|
||||
#define DIV_DDR_WIDTH 2
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_MACH_LOONGSON32_REGS_CLK_H */
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#define LS1X_MUX_CTRL0 LS1X_MUX_REG(0x0)
|
||||
#define LS1X_MUX_CTRL1 LS1X_MUX_REG(0x4)
|
||||
|
||||
#if defined(CONFIG_LOONGSON1_LS1B)
|
||||
/* MUX CTRL0 Register Bits */
|
||||
#define UART0_USE_PWM23 BIT(28)
|
||||
#define UART0_USE_PWM01 BIT(27)
|
||||
@@ -64,4 +65,64 @@
|
||||
#define GMAC1_USE_PWM23 BIT(1)
|
||||
#define GMAC0_USE_PWM01 BIT(0)
|
||||
|
||||
#elif defined(CONFIG_LOONGSON1_LS1C)
|
||||
|
||||
/* SHUT_CTRL Register Bits */
|
||||
#define UART_SPLIT GENMASK(31, 30)
|
||||
#define OUTPUT_CLK GENMASK(29, 26)
|
||||
#define ADC_SHUT BIT(25)
|
||||
#define SDIO_SHUT BIT(24)
|
||||
#define DMA2_SHUT BIT(23)
|
||||
#define DMA1_SHUT BIT(22)
|
||||
#define DMA0_SHUT BIT(21)
|
||||
#define SPI1_SHUT BIT(20)
|
||||
#define SPI0_SHUT BIT(19)
|
||||
#define I2C2_SHUT BIT(18)
|
||||
#define I2C1_SHUT BIT(17)
|
||||
#define I2C0_SHUT BIT(16)
|
||||
#define AC97_SHUT BIT(15)
|
||||
#define I2S_SHUT BIT(14)
|
||||
#define UART3_SHUT BIT(13)
|
||||
#define UART2_SHUT BIT(12)
|
||||
#define UART1_SHUT BIT(11)
|
||||
#define UART0_SHUT BIT(10)
|
||||
#define CAN1_SHUT BIT(9)
|
||||
#define CAN0_SHUT BIT(8)
|
||||
#define ECC_SHUT BIT(7)
|
||||
#define GMAC_SHUT BIT(6)
|
||||
#define USBHOST_SHUT BIT(5)
|
||||
#define USBOTG_SHUT BIT(4)
|
||||
#define SDRAM_SHUT BIT(3)
|
||||
#define SRAM_SHUT BIT(2)
|
||||
#define CAM_SHUT BIT(1)
|
||||
#define LCD_SHUT BIT(0)
|
||||
|
||||
#define UART_SPLIT_SHIFT 30
|
||||
#define OUTPUT_CLK_SHIFT 26
|
||||
|
||||
/* MISC_CTRL Register Bits */
|
||||
#define USBHOST_RSTN BIT(31)
|
||||
#define PHY_INTF_SELI GENMASK(30, 28)
|
||||
#define AC97_EN BIT(25)
|
||||
#define SDIO_DMA_EN GENMASK(24, 23)
|
||||
#define ADC_DMA_EN BIT(22)
|
||||
#define SDIO_USE_SPI1 BIT(17)
|
||||
#define SDIO_USE_SPI0 BIT(16)
|
||||
#define SRAM_CTRL GENMASK(15, 0)
|
||||
|
||||
#define PHY_INTF_SELI_SHIFT 28
|
||||
#define SDIO_DMA_EN_SHIFT 23
|
||||
#define SRAM_CTRL_SHIFT 0
|
||||
|
||||
#define LS1X_CBUS_REG(n, x) \
|
||||
((void __iomem *)KSEG1ADDR(LS1X_CBUS_BASE + (n * 0x04) + (x)))
|
||||
|
||||
#define LS1X_CBUS_FIRST(n) LS1X_CBUS_REG(n, 0x00)
|
||||
#define LS1X_CBUS_SECOND(n) LS1X_CBUS_REG(n, 0x10)
|
||||
#define LS1X_CBUS_THIRD(n) LS1X_CBUS_REG(n, 0x20)
|
||||
#define LS1X_CBUS_FOURTHT(n) LS1X_CBUS_REG(n, 0x30)
|
||||
#define LS1X_CBUS_FIFTHT(n) LS1X_CBUS_REG(n, 0x40)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_MACH_LOONGSON32_REGS_MUX_H */
|
||||
|
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Copyright (C) 2003, 2004 Chris Dearman
|
||||
* Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
|
||||
*/
|
||||
#ifndef __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H
|
||||
#define __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H
|
||||
|
||||
|
||||
/*
|
||||
* CPU feature overrides for MIPS boards
|
||||
*/
|
||||
#ifdef CONFIG_CPU_MIPS32
|
||||
#define cpu_has_tlb 1
|
||||
#define cpu_has_4kex 1
|
||||
#define cpu_has_4k_cache 1
|
||||
/* #define cpu_has_fpu ? */
|
||||
/* #define cpu_has_32fpr ? */
|
||||
#define cpu_has_counter 1
|
||||
/* #define cpu_has_watch ? */
|
||||
#define cpu_has_divec 1
|
||||
#define cpu_has_vce 0
|
||||
/* #define cpu_has_cache_cdex_p ? */
|
||||
/* #define cpu_has_cache_cdex_s ? */
|
||||
/* #define cpu_has_prefetch ? */
|
||||
#define cpu_has_mcheck 1
|
||||
/* #define cpu_has_ejtag ? */
|
||||
#ifdef CONFIG_CPU_MICROMIPS
|
||||
#define cpu_has_llsc 0
|
||||
#else
|
||||
#define cpu_has_llsc 1
|
||||
#endif
|
||||
/* #define cpu_has_vtag_icache ? */
|
||||
/* #define cpu_has_dc_aliases ? */
|
||||
/* #define cpu_has_ic_fills_f_dc ? */
|
||||
#define cpu_has_nofpuex 0
|
||||
/* #define cpu_has_64bits ? */
|
||||
/* #define cpu_has_64bit_zero_reg ? */
|
||||
/* #define cpu_has_inclusive_pcaches ? */
|
||||
#define cpu_icache_snoops_remote_store 1
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CPU_MIPS64
|
||||
#define cpu_has_tlb 1
|
||||
#define cpu_has_4kex 1
|
||||
#define cpu_has_4k_cache 1
|
||||
/* #define cpu_has_fpu ? */
|
||||
/* #define cpu_has_32fpr ? */
|
||||
#define cpu_has_counter 1
|
||||
/* #define cpu_has_watch ? */
|
||||
#define cpu_has_divec 1
|
||||
#define cpu_has_vce 0
|
||||
/* #define cpu_has_cache_cdex_p ? */
|
||||
/* #define cpu_has_cache_cdex_s ? */
|
||||
/* #define cpu_has_prefetch ? */
|
||||
#define cpu_has_mcheck 1
|
||||
/* #define cpu_has_ejtag ? */
|
||||
#define cpu_has_llsc 1
|
||||
/* #define cpu_has_vtag_icache ? */
|
||||
/* #define cpu_has_dc_aliases ? */
|
||||
/* #define cpu_has_ic_fills_f_dc ? */
|
||||
#define cpu_has_nofpuex 0
|
||||
/* #define cpu_has_64bits ? */
|
||||
/* #define cpu_has_64bit_zero_reg ? */
|
||||
/* #define cpu_has_inclusive_pcaches ? */
|
||||
#define cpu_icache_snoops_remote_store 1
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */
|
@@ -1,9 +0,0 @@
|
||||
#ifndef __ASM_MACH_MIPS_IRQ_H
|
||||
#define __ASM_MACH_MIPS_IRQ_H
|
||||
|
||||
#define NR_IRQS 256
|
||||
|
||||
|
||||
#include_next <irq.h>
|
||||
|
||||
#endif /* __ASM_MACH_MIPS_IRQ_H */
|
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Chris Dearman (chris@mips.com)
|
||||
* Copyright (C) 2007 Mips Technologies, Inc.
|
||||
*/
|
||||
#ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
|
||||
#define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
|
||||
|
||||
.macro kernel_entry_setup
|
||||
.endm
|
||||
|
||||
/*
|
||||
* Do SMP slave processor setup necessary before we can safely execute C code.
|
||||
*/
|
||||
.macro smp_slave_setup
|
||||
.endm
|
||||
|
||||
#endif /* __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H */
|
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
|
||||
*/
|
||||
#ifndef __ASM_MIPS_MACH_MIPS_WAR_H
|
||||
#define __ASM_MIPS_MACH_MIPS_WAR_H
|
||||
|
||||
#define R4600_V1_INDEX_ICACHEOP_WAR 0
|
||||
#define R4600_V1_HIT_CACHEOP_WAR 0
|
||||
#define R4600_V2_HIT_CACHEOP_WAR 0
|
||||
#define R5432_CP0_INTERRUPT_WAR 0
|
||||
#define BCM1250_M3_WAR 0
|
||||
#define SIBYTE_1956_WAR 0
|
||||
#define MIPS4K_ICACHE_REFILL_WAR 1
|
||||
#define MIPS_CACHE_SYNC_WAR 1
|
||||
#define TX49XX_ICACHE_INDEX_INV_WAR 0
|
||||
#define ICACHE_REFILLS_WORKAROUND_WAR 1
|
||||
#define R10000_LLSC_WAR 0
|
||||
#define MIPS34K_MISSED_ITLB_WAR 0
|
||||
|
||||
#endif /* __ASM_MIPS_MACH_MIPS_WAR_H */
|
63
arch/mips/include/asm/machine.h
Normal file
63
arch/mips/include/asm/machine.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Imagination Technologies
|
||||
* Author: Paul Burton <paul.burton@imgtec.com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __MIPS_ASM_MACHINE_H__
|
||||
#define __MIPS_ASM_MACHINE_H__
|
||||
|
||||
#include <linux/libfdt.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
struct mips_machine {
|
||||
const struct of_device_id *matches;
|
||||
const void *fdt;
|
||||
bool (*detect)(void);
|
||||
const void *(*fixup_fdt)(const void *fdt, const void *match_data);
|
||||
unsigned int (*measure_hpt_freq)(void);
|
||||
};
|
||||
|
||||
extern long __mips_machines_start;
|
||||
extern long __mips_machines_end;
|
||||
|
||||
#define MIPS_MACHINE(name) \
|
||||
static const struct mips_machine __mips_mach_##name \
|
||||
__used __section(.mips.machines.init)
|
||||
|
||||
#define for_each_mips_machine(mach) \
|
||||
for ((mach) = (struct mips_machine *)&__mips_machines_start; \
|
||||
(mach) < (struct mips_machine *)&__mips_machines_end; \
|
||||
(mach)++)
|
||||
|
||||
/**
|
||||
* mips_machine_is_compatible() - check if a machine is compatible with an FDT
|
||||
* @mach: the machine struct to check
|
||||
* @fdt: the FDT to check for compatibility with
|
||||
*
|
||||
* Check whether the given machine @mach is compatible with the given flattened
|
||||
* device tree @fdt, based upon the compatibility property of the root node.
|
||||
*
|
||||
* Return: the device id matched if any, else NULL
|
||||
*/
|
||||
static inline const struct of_device_id *
|
||||
mips_machine_is_compatible(const struct mips_machine *mach, const void *fdt)
|
||||
{
|
||||
const struct of_device_id *match;
|
||||
|
||||
if (!mach->matches)
|
||||
return NULL;
|
||||
|
||||
for (match = mach->matches; match->compatible; match++) {
|
||||
if (fdt_node_check_compatible(fdt, 0, match->compatible) == 0)
|
||||
return match;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* __MIPS_ASM_MACHINE_H__ */
|
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Copyright (C) 2000,2012 MIPS Technologies, Inc. All rights reserved.
|
||||
* Douglas Leung <douglas@mips.com>
|
||||
* Steven J. Hill <sjhill@mips.com>
|
||||
*/
|
||||
#ifndef _MIPS_SEAD3INT_H
|
||||
#define _MIPS_SEAD3INT_H
|
||||
|
||||
#include <linux/irqchip/mips-gic.h>
|
||||
|
||||
/* SEAD-3 GIC address space definitions. */
|
||||
#define GIC_BASE_ADDR 0x1b1c0000
|
||||
#define GIC_ADDRSPACE_SZ (128 * 1024)
|
||||
|
||||
/* CPU interrupt offsets */
|
||||
#define CPU_INT_GIC 2
|
||||
#define CPU_INT_EHCI 2
|
||||
#define CPU_INT_UART0 4
|
||||
#define CPU_INT_UART1 4
|
||||
#define CPU_INT_NET 6
|
||||
|
||||
/* GIC interrupt offsets */
|
||||
#define GIC_INT_NET GIC_SHARED_TO_HWIRQ(0)
|
||||
#define GIC_INT_UART1 GIC_SHARED_TO_HWIRQ(2)
|
||||
#define GIC_INT_UART0 GIC_SHARED_TO_HWIRQ(3)
|
||||
#define GIC_INT_EHCI GIC_SHARED_TO_HWIRQ(5)
|
||||
|
||||
#endif /* !(_MIPS_SEAD3INT_H) */
|
@@ -359,6 +359,7 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80)
|
||||
/* GCR_Cx_COHERENCE register fields */
|
||||
#define CM_GCR_Cx_COHERENCE_COHDOMAINEN_SHF 0
|
||||
#define CM_GCR_Cx_COHERENCE_COHDOMAINEN_MSK (_ULCAST_(0xff) << 0)
|
||||
#define CM3_GCR_Cx_COHERENCE_COHEN_MSK (_ULCAST_(0x1) << 0)
|
||||
|
||||
/* GCR_Cx_CONFIG register fields */
|
||||
#define CM_GCR_Cx_CONFIG_IOCUTYPE_SHF 10
|
||||
|
@@ -57,16 +57,6 @@ typedef enum {
|
||||
*/
|
||||
#define CVMX_HELPER_BOARD_MGMT_IPD_PORT -10
|
||||
|
||||
/**
|
||||
* cvmx_override_board_link_get(int ipd_port) is a function
|
||||
* pointer. It is meant to allow customization of the process of
|
||||
* talking to a PHY to determine link speed. It is called every
|
||||
* time a PHY must be polled for link status. Users should set
|
||||
* this pointer to a function before calling any cvmx-helper
|
||||
* operations.
|
||||
*/
|
||||
extern cvmx_helper_link_info_t(*cvmx_override_board_link_get) (int ipd_port);
|
||||
|
||||
/**
|
||||
* Return the MII PHY address associated with the given IPD
|
||||
* port. A result of -1 means there isn't a MII capable PHY
|
||||
@@ -85,26 +75,6 @@ extern cvmx_helper_link_info_t(*cvmx_override_board_link_get) (int ipd_port);
|
||||
*/
|
||||
extern int cvmx_helper_board_get_mii_address(int ipd_port);
|
||||
|
||||
/**
|
||||
* This function as a board specific method of changing the PHY
|
||||
* speed, duplex, and autonegotiation. This programs the PHY and
|
||||
* not Octeon. This can be used to force Octeon's links to
|
||||
* specific settings.
|
||||
*
|
||||
* @phy_addr: The address of the PHY to program
|
||||
* @link_flags:
|
||||
* Flags to control autonegotiation. Bit 0 is autonegotiation
|
||||
* enable/disable to maintain backward compatibility.
|
||||
* @link_info: Link speed to program. If the speed is zero and autonegotiation
|
||||
* is enabled, all possible negotiation speeds are advertised.
|
||||
*
|
||||
* Returns Zero on success, negative on failure
|
||||
*/
|
||||
int cvmx_helper_board_link_set_phy(int phy_addr,
|
||||
cvmx_helper_board_set_phy_link_flags_types_t
|
||||
link_flags,
|
||||
cvmx_helper_link_info_t link_info);
|
||||
|
||||
/**
|
||||
* This function is the board specific method of determining an
|
||||
* ethernet ports link speed. Most Octeon boards have Marvell PHYs
|
||||
|
@@ -1,506 +0,0 @@
|
||||
/***********************license start***************
|
||||
* Author: Cavium Networks
|
||||
*
|
||||
* Contact: support@caviumnetworks.com
|
||||
* This file is part of the OCTEON SDK
|
||||
*
|
||||
* Copyright (c) 2003-2008 Cavium Networks
|
||||
*
|
||||
* This file 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.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful, but
|
||||
* AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
|
||||
* NONINFRINGEMENT. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this file; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
* or visit http://www.gnu.org/licenses/.
|
||||
*
|
||||
* This file may also be available under a different license from Cavium.
|
||||
* Contact Cavium Networks for more information
|
||||
***********************license end**************************************/
|
||||
|
||||
/*
|
||||
*
|
||||
* Interface to the SMI/MDIO hardware, including support for both IEEE 802.3
|
||||
* clause 22 and clause 45 operations.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CVMX_MIO_H__
|
||||
#define __CVMX_MIO_H__
|
||||
|
||||
#include <asm/octeon/cvmx-smix-defs.h>
|
||||
|
||||
/**
|
||||
* PHY register 0 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_CONTROL 0
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t reset:1;
|
||||
uint16_t loopback:1;
|
||||
uint16_t speed_lsb:1;
|
||||
uint16_t autoneg_enable:1;
|
||||
uint16_t power_down:1;
|
||||
uint16_t isolate:1;
|
||||
uint16_t restart_autoneg:1;
|
||||
uint16_t duplex:1;
|
||||
uint16_t collision_test:1;
|
||||
uint16_t speed_msb:1;
|
||||
uint16_t unidirectional_enable:1;
|
||||
uint16_t reserved_0_4:5;
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_control_t;
|
||||
|
||||
/**
|
||||
* PHY register 1 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_STATUS 1
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t capable_100base_t4:1;
|
||||
uint16_t capable_100base_x_full:1;
|
||||
uint16_t capable_100base_x_half:1;
|
||||
uint16_t capable_10_full:1;
|
||||
uint16_t capable_10_half:1;
|
||||
uint16_t capable_100base_t2_full:1;
|
||||
uint16_t capable_100base_t2_half:1;
|
||||
uint16_t capable_extended_status:1;
|
||||
uint16_t capable_unidirectional:1;
|
||||
uint16_t capable_mf_preamble_suppression:1;
|
||||
uint16_t autoneg_complete:1;
|
||||
uint16_t remote_fault:1;
|
||||
uint16_t capable_autoneg:1;
|
||||
uint16_t link_status:1;
|
||||
uint16_t jabber_detect:1;
|
||||
uint16_t capable_extended_registers:1;
|
||||
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_status_t;
|
||||
|
||||
/**
|
||||
* PHY register 2 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_ID1 2
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t oui_bits_3_18;
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_id1_t;
|
||||
|
||||
/**
|
||||
* PHY register 3 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_ID2 3
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t oui_bits_19_24:6;
|
||||
uint16_t model:6;
|
||||
uint16_t revision:4;
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_id2_t;
|
||||
|
||||
/**
|
||||
* PHY register 4 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_AUTONEG_ADVER 4
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t next_page:1;
|
||||
uint16_t reserved_14:1;
|
||||
uint16_t remote_fault:1;
|
||||
uint16_t reserved_12:1;
|
||||
uint16_t asymmetric_pause:1;
|
||||
uint16_t pause:1;
|
||||
uint16_t advert_100base_t4:1;
|
||||
uint16_t advert_100base_tx_full:1;
|
||||
uint16_t advert_100base_tx_half:1;
|
||||
uint16_t advert_10base_tx_full:1;
|
||||
uint16_t advert_10base_tx_half:1;
|
||||
uint16_t selector:5;
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_autoneg_adver_t;
|
||||
|
||||
/**
|
||||
* PHY register 5 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_LINK_PARTNER_ABILITY 5
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t next_page:1;
|
||||
uint16_t ack:1;
|
||||
uint16_t remote_fault:1;
|
||||
uint16_t reserved_12:1;
|
||||
uint16_t asymmetric_pause:1;
|
||||
uint16_t pause:1;
|
||||
uint16_t advert_100base_t4:1;
|
||||
uint16_t advert_100base_tx_full:1;
|
||||
uint16_t advert_100base_tx_half:1;
|
||||
uint16_t advert_10base_tx_full:1;
|
||||
uint16_t advert_10base_tx_half:1;
|
||||
uint16_t selector:5;
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_link_partner_ability_t;
|
||||
|
||||
/**
|
||||
* PHY register 6 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_AUTONEG_EXPANSION 6
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t reserved_5_15:11;
|
||||
uint16_t parallel_detection_fault:1;
|
||||
uint16_t link_partner_next_page_capable:1;
|
||||
uint16_t local_next_page_capable:1;
|
||||
uint16_t page_received:1;
|
||||
uint16_t link_partner_autoneg_capable:1;
|
||||
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_autoneg_expansion_t;
|
||||
|
||||
/**
|
||||
* PHY register 9 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_CONTROL_1000 9
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t test_mode:3;
|
||||
uint16_t manual_master_slave:1;
|
||||
uint16_t master:1;
|
||||
uint16_t port_type:1;
|
||||
uint16_t advert_1000base_t_full:1;
|
||||
uint16_t advert_1000base_t_half:1;
|
||||
uint16_t reserved_0_7:8;
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_control_1000_t;
|
||||
|
||||
/**
|
||||
* PHY register 10 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_STATUS_1000 10
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t master_slave_fault:1;
|
||||
uint16_t is_master:1;
|
||||
uint16_t local_receiver_ok:1;
|
||||
uint16_t remote_receiver_ok:1;
|
||||
uint16_t remote_capable_1000base_t_full:1;
|
||||
uint16_t remote_capable_1000base_t_half:1;
|
||||
uint16_t reserved_8_9:2;
|
||||
uint16_t idle_error_count:8;
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_status_1000_t;
|
||||
|
||||
/**
|
||||
* PHY register 15 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_EXTENDED_STATUS 15
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t capable_1000base_x_full:1;
|
||||
uint16_t capable_1000base_x_half:1;
|
||||
uint16_t capable_1000base_t_full:1;
|
||||
uint16_t capable_1000base_t_half:1;
|
||||
uint16_t reserved_0_11:12;
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_extended_status_t;
|
||||
|
||||
/**
|
||||
* PHY register 13 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_MMD_CONTROL 13
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t function:2;
|
||||
uint16_t reserved_5_13:9;
|
||||
uint16_t devad:5;
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_mmd_control_t;
|
||||
|
||||
/**
|
||||
* PHY register 14 from the 802.3 spec
|
||||
*/
|
||||
#define CVMX_MDIO_PHY_REG_MMD_ADDRESS_DATA 14
|
||||
typedef union {
|
||||
uint16_t u16;
|
||||
struct {
|
||||
uint16_t address_data:16;
|
||||
} s;
|
||||
} cvmx_mdio_phy_reg_mmd_address_data_t;
|
||||
|
||||
/* Operating request encodings. */
|
||||
#define MDIO_CLAUSE_22_WRITE 0
|
||||
#define MDIO_CLAUSE_22_READ 1
|
||||
|
||||
#define MDIO_CLAUSE_45_ADDRESS 0
|
||||
#define MDIO_CLAUSE_45_WRITE 1
|
||||
#define MDIO_CLAUSE_45_READ_INC 2
|
||||
#define MDIO_CLAUSE_45_READ 3
|
||||
|
||||
/* MMD identifiers, mostly for accessing devices within XENPAK modules. */
|
||||
#define CVMX_MMD_DEVICE_PMA_PMD 1
|
||||
#define CVMX_MMD_DEVICE_WIS 2
|
||||
#define CVMX_MMD_DEVICE_PCS 3
|
||||
#define CVMX_MMD_DEVICE_PHY_XS 4
|
||||
#define CVMX_MMD_DEVICE_DTS_XS 5
|
||||
#define CVMX_MMD_DEVICE_TC 6
|
||||
#define CVMX_MMD_DEVICE_CL22_EXT 29
|
||||
#define CVMX_MMD_DEVICE_VENDOR_1 30
|
||||
#define CVMX_MMD_DEVICE_VENDOR_2 31
|
||||
|
||||
/* Helper function to put MDIO interface into clause 45 mode */
|
||||
static inline void __cvmx_mdio_set_clause45_mode(int bus_id)
|
||||
{
|
||||
union cvmx_smix_clk smi_clk;
|
||||
/* Put bus into clause 45 mode */
|
||||
smi_clk.u64 = cvmx_read_csr(CVMX_SMIX_CLK(bus_id));
|
||||
smi_clk.s.mode = 1;
|
||||
smi_clk.s.preamble = 1;
|
||||
cvmx_write_csr(CVMX_SMIX_CLK(bus_id), smi_clk.u64);
|
||||
}
|
||||
|
||||
/* Helper function to put MDIO interface into clause 22 mode */
|
||||
static inline void __cvmx_mdio_set_clause22_mode(int bus_id)
|
||||
{
|
||||
union cvmx_smix_clk smi_clk;
|
||||
/* Put bus into clause 22 mode */
|
||||
smi_clk.u64 = cvmx_read_csr(CVMX_SMIX_CLK(bus_id));
|
||||
smi_clk.s.mode = 0;
|
||||
cvmx_write_csr(CVMX_SMIX_CLK(bus_id), smi_clk.u64);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform an MII read. This function is used to read PHY
|
||||
* registers controlling auto negotiation.
|
||||
*
|
||||
* @bus_id: MDIO bus number. Zero on most chips, but some chips (ex CN56XX)
|
||||
* support multiple busses.
|
||||
* @phy_id: The MII phy id
|
||||
* @location: Register location to read
|
||||
*
|
||||
* Returns Result from the read or -1 on failure
|
||||
*/
|
||||
static inline int cvmx_mdio_read(int bus_id, int phy_id, int location)
|
||||
{
|
||||
union cvmx_smix_cmd smi_cmd;
|
||||
union cvmx_smix_rd_dat smi_rd;
|
||||
int timeout = 1000;
|
||||
|
||||
if (octeon_has_feature(OCTEON_FEATURE_MDIO_CLAUSE_45))
|
||||
__cvmx_mdio_set_clause22_mode(bus_id);
|
||||
|
||||
smi_cmd.u64 = 0;
|
||||
smi_cmd.s.phy_op = MDIO_CLAUSE_22_READ;
|
||||
smi_cmd.s.phy_adr = phy_id;
|
||||
smi_cmd.s.reg_adr = location;
|
||||
cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
|
||||
|
||||
do {
|
||||
cvmx_wait(1000);
|
||||
smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(bus_id));
|
||||
} while (smi_rd.s.pending && timeout--);
|
||||
|
||||
if (smi_rd.s.val)
|
||||
return smi_rd.s.dat;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform an MII write. This function is used to write PHY
|
||||
* registers controlling auto negotiation.
|
||||
*
|
||||
* @bus_id: MDIO bus number. Zero on most chips, but some chips (ex CN56XX)
|
||||
* support multiple busses.
|
||||
* @phy_id: The MII phy id
|
||||
* @location: Register location to write
|
||||
* @val: Value to write
|
||||
*
|
||||
* Returns -1 on error
|
||||
* 0 on success
|
||||
*/
|
||||
static inline int cvmx_mdio_write(int bus_id, int phy_id, int location, int val)
|
||||
{
|
||||
union cvmx_smix_cmd smi_cmd;
|
||||
union cvmx_smix_wr_dat smi_wr;
|
||||
int timeout = 1000;
|
||||
|
||||
if (octeon_has_feature(OCTEON_FEATURE_MDIO_CLAUSE_45))
|
||||
__cvmx_mdio_set_clause22_mode(bus_id);
|
||||
|
||||
smi_wr.u64 = 0;
|
||||
smi_wr.s.dat = val;
|
||||
cvmx_write_csr(CVMX_SMIX_WR_DAT(bus_id), smi_wr.u64);
|
||||
|
||||
smi_cmd.u64 = 0;
|
||||
smi_cmd.s.phy_op = MDIO_CLAUSE_22_WRITE;
|
||||
smi_cmd.s.phy_adr = phy_id;
|
||||
smi_cmd.s.reg_adr = location;
|
||||
cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
|
||||
|
||||
do {
|
||||
cvmx_wait(1000);
|
||||
smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(bus_id));
|
||||
} while (smi_wr.s.pending && --timeout);
|
||||
if (timeout <= 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform an IEEE 802.3 clause 45 MII read. This function is used to
|
||||
* read PHY registers controlling auto negotiation.
|
||||
*
|
||||
* @bus_id: MDIO bus number. Zero on most chips, but some chips (ex CN56XX)
|
||||
* support multiple busses.
|
||||
* @phy_id: The MII phy id
|
||||
* @device: MDIO Managable Device (MMD) id
|
||||
* @location: Register location to read
|
||||
*
|
||||
* Returns Result from the read or -1 on failure
|
||||
*/
|
||||
|
||||
static inline int cvmx_mdio_45_read(int bus_id, int phy_id, int device,
|
||||
int location)
|
||||
{
|
||||
union cvmx_smix_cmd smi_cmd;
|
||||
union cvmx_smix_rd_dat smi_rd;
|
||||
union cvmx_smix_wr_dat smi_wr;
|
||||
int timeout = 1000;
|
||||
|
||||
if (!octeon_has_feature(OCTEON_FEATURE_MDIO_CLAUSE_45))
|
||||
return -1;
|
||||
|
||||
__cvmx_mdio_set_clause45_mode(bus_id);
|
||||
|
||||
smi_wr.u64 = 0;
|
||||
smi_wr.s.dat = location;
|
||||
cvmx_write_csr(CVMX_SMIX_WR_DAT(bus_id), smi_wr.u64);
|
||||
|
||||
smi_cmd.u64 = 0;
|
||||
smi_cmd.s.phy_op = MDIO_CLAUSE_45_ADDRESS;
|
||||
smi_cmd.s.phy_adr = phy_id;
|
||||
smi_cmd.s.reg_adr = device;
|
||||
cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
|
||||
|
||||
do {
|
||||
cvmx_wait(1000);
|
||||
smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(bus_id));
|
||||
} while (smi_wr.s.pending && --timeout);
|
||||
if (timeout <= 0) {
|
||||
cvmx_dprintf("cvmx_mdio_45_read: bus_id %d phy_id %2d "
|
||||
"device %2d register %2d TIME OUT(address)\n",
|
||||
bus_id, phy_id, device, location);
|
||||
return -1;
|
||||
}
|
||||
|
||||
smi_cmd.u64 = 0;
|
||||
smi_cmd.s.phy_op = MDIO_CLAUSE_45_READ;
|
||||
smi_cmd.s.phy_adr = phy_id;
|
||||
smi_cmd.s.reg_adr = device;
|
||||
cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
|
||||
|
||||
do {
|
||||
cvmx_wait(1000);
|
||||
smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(bus_id));
|
||||
} while (smi_rd.s.pending && --timeout);
|
||||
|
||||
if (timeout <= 0) {
|
||||
cvmx_dprintf("cvmx_mdio_45_read: bus_id %d phy_id %2d "
|
||||
"device %2d register %2d TIME OUT(data)\n",
|
||||
bus_id, phy_id, device, location);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (smi_rd.s.val)
|
||||
return smi_rd.s.dat;
|
||||
else {
|
||||
cvmx_dprintf("cvmx_mdio_45_read: bus_id %d phy_id %2d "
|
||||
"device %2d register %2d INVALID READ\n",
|
||||
bus_id, phy_id, device, location);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform an IEEE 802.3 clause 45 MII write. This function is used to
|
||||
* write PHY registers controlling auto negotiation.
|
||||
*
|
||||
* @bus_id: MDIO bus number. Zero on most chips, but some chips (ex CN56XX)
|
||||
* support multiple busses.
|
||||
* @phy_id: The MII phy id
|
||||
* @device: MDIO Managable Device (MMD) id
|
||||
* @location: Register location to write
|
||||
* @val: Value to write
|
||||
*
|
||||
* Returns -1 on error
|
||||
* 0 on success
|
||||
*/
|
||||
static inline int cvmx_mdio_45_write(int bus_id, int phy_id, int device,
|
||||
int location, int val)
|
||||
{
|
||||
union cvmx_smix_cmd smi_cmd;
|
||||
union cvmx_smix_wr_dat smi_wr;
|
||||
int timeout = 1000;
|
||||
|
||||
if (!octeon_has_feature(OCTEON_FEATURE_MDIO_CLAUSE_45))
|
||||
return -1;
|
||||
|
||||
__cvmx_mdio_set_clause45_mode(bus_id);
|
||||
|
||||
smi_wr.u64 = 0;
|
||||
smi_wr.s.dat = location;
|
||||
cvmx_write_csr(CVMX_SMIX_WR_DAT(bus_id), smi_wr.u64);
|
||||
|
||||
smi_cmd.u64 = 0;
|
||||
smi_cmd.s.phy_op = MDIO_CLAUSE_45_ADDRESS;
|
||||
smi_cmd.s.phy_adr = phy_id;
|
||||
smi_cmd.s.reg_adr = device;
|
||||
cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
|
||||
|
||||
do {
|
||||
cvmx_wait(1000);
|
||||
smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(bus_id));
|
||||
} while (smi_wr.s.pending && --timeout);
|
||||
if (timeout <= 0)
|
||||
return -1;
|
||||
|
||||
smi_wr.u64 = 0;
|
||||
smi_wr.s.dat = val;
|
||||
cvmx_write_csr(CVMX_SMIX_WR_DAT(bus_id), smi_wr.u64);
|
||||
|
||||
smi_cmd.u64 = 0;
|
||||
smi_cmd.s.phy_op = MDIO_CLAUSE_45_WRITE;
|
||||
smi_cmd.s.phy_adr = phy_id;
|
||||
smi_cmd.s.reg_adr = device;
|
||||
cvmx_write_csr(CVMX_SMIX_CMD(bus_id), smi_cmd.u64);
|
||||
|
||||
do {
|
||||
cvmx_wait(1000);
|
||||
smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(bus_id));
|
||||
} while (smi_wr.s.pending && --timeout);
|
||||
if (timeout <= 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
@@ -17,15 +17,18 @@
|
||||
*/
|
||||
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
#ifdef CONFIG_PCI_DRIVERS_LEGACY
|
||||
|
||||
/*
|
||||
* Each pci channel is a top-level PCI bus seem by CPU. A machine with
|
||||
* multiple PCI channels may have multiple PCI host controllers or a
|
||||
* single controller supporting multiple channels.
|
||||
*/
|
||||
struct pci_controller {
|
||||
struct pci_controller *next;
|
||||
struct list_head list;
|
||||
struct pci_bus *bus;
|
||||
struct device_node *of_node;
|
||||
|
||||
@@ -38,10 +41,12 @@ struct pci_controller {
|
||||
struct resource *busn_resource;
|
||||
unsigned long busn_offset;
|
||||
|
||||
#ifndef CONFIG_PCI_DOMAINS_GENERIC
|
||||
unsigned int index;
|
||||
/* For compatibility with current (as of July 2003) pciutils
|
||||
and XFree86. Eventually will be removed. */
|
||||
unsigned int need_domain_info;
|
||||
#endif
|
||||
|
||||
/* Optional access methods for reading/writing the bus number
|
||||
of the PCI controller */
|
||||
@@ -59,12 +64,43 @@ extern void register_pci_controller(struct pci_controller *hose);
|
||||
*/
|
||||
extern int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
|
||||
|
||||
/* Do platform specific device initialization at pci_enable_device() time */
|
||||
extern int pcibios_plat_dev_init(struct pci_dev *dev);
|
||||
|
||||
extern char * (*pcibios_plat_setup)(char *str);
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
/* this function parses memory ranges from a device node */
|
||||
extern void pci_load_of_ranges(struct pci_controller *hose,
|
||||
struct device_node *node);
|
||||
#else
|
||||
static inline void pci_load_of_ranges(struct pci_controller *hose,
|
||||
struct device_node *node) {}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PCI_DOMAINS_GENERIC
|
||||
static inline void set_pci_need_domain_info(struct pci_controller *hose,
|
||||
int need_domain_info)
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
#elif defined(CONFIG_PCI_DOMAINS)
|
||||
static inline void set_pci_need_domain_info(struct pci_controller *hose,
|
||||
int need_domain_info)
|
||||
{
|
||||
hose->need_domain_info = need_domain_info;
|
||||
}
|
||||
#endif /* CONFIG_PCI_DOMAINS */
|
||||
|
||||
#endif
|
||||
|
||||
/* Can be used to override the logic in pci_scan_bus for skipping
|
||||
already-configured bus numbers - to be used for buggy BIOSes
|
||||
or architectures with incomplete PCI setup by the loader */
|
||||
|
||||
extern unsigned int pcibios_assign_all_busses(void);
|
||||
static inline unsigned int pcibios_assign_all_busses(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern unsigned long PCIBIOS_MIN_IO;
|
||||
extern unsigned long PCIBIOS_MIN_MEM;
|
||||
@@ -100,7 +136,12 @@ struct pci_dev;
|
||||
*/
|
||||
#define PCI_DMA_BUS_IS_PHYS (1)
|
||||
|
||||
#ifdef CONFIG_PCI_DOMAINS
|
||||
#ifdef CONFIG_PCI_DOMAINS_GENERIC
|
||||
static inline int pci_proc_domain(struct pci_bus *bus)
|
||||
{
|
||||
return pci_domain_nr(bus);
|
||||
}
|
||||
#elif defined(CONFIG_PCI_DOMAINS)
|
||||
#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
|
||||
|
||||
static inline int pci_proc_domain(struct pci_bus *bus)
|
||||
@@ -121,15 +162,4 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
|
||||
return channel ? 15 : 14;
|
||||
}
|
||||
|
||||
extern char * (*pcibios_plat_setup)(char *str);
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
/* this function parses memory ranges from a device node */
|
||||
extern void pci_load_of_ranges(struct pci_controller *hose,
|
||||
struct device_node *node);
|
||||
#else
|
||||
static inline void pci_load_of_ranges(struct pci_controller *hose,
|
||||
struct device_node *node) {}
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_PCI_H */
|
||||
|
@@ -67,11 +67,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
|
||||
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
|
||||
unsigned long address)
|
||||
{
|
||||
pte_t *pte;
|
||||
|
||||
pte = (pte_t *) __get_free_pages(GFP_KERNEL|__GFP_ZERO, PTE_ORDER);
|
||||
|
||||
return pte;
|
||||
return (pte_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, PTE_ORDER);
|
||||
}
|
||||
|
||||
static inline struct page *pte_alloc_one(struct mm_struct *mm,
|
||||
|
@@ -13,10 +13,12 @@
|
||||
|
||||
/*
|
||||
* The CM & CPC can only handle coherence & power control on a per-core basis,
|
||||
* thus in an MT system the VPEs within each core are coupled and can only
|
||||
* thus in an MT system the VP(E)s within each core are coupled and can only
|
||||
* enter or exit states requiring CM or CPC assistance in unison.
|
||||
*/
|
||||
#ifdef CONFIG_MIPS_MT
|
||||
#if defined(CONFIG_CPU_MIPSR6)
|
||||
# define coupled_coherence cpu_has_vp
|
||||
#elif defined(CONFIG_MIPS_MT)
|
||||
# define coupled_coherence cpu_has_mipsmt
|
||||
#else
|
||||
# define coupled_coherence 0
|
||||
|
@@ -152,7 +152,7 @@ static inline int is_syscall_success(struct pt_regs *regs)
|
||||
|
||||
static inline long regs_return_value(struct pt_regs *regs)
|
||||
{
|
||||
if (is_syscall_success(regs))
|
||||
if (is_syscall_success(regs) || !user_mode(regs))
|
||||
return regs->regs[2];
|
||||
else
|
||||
return -regs->regs[2];
|
||||
|
@@ -85,6 +85,20 @@ static inline void __cpu_die(unsigned int cpu)
|
||||
extern void play_dead(void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function will set up the necessary IPIs for Linux to communicate
|
||||
* with the CPUs in mask.
|
||||
* Return 0 on success.
|
||||
*/
|
||||
int mips_smp_ipi_allocate(const struct cpumask *mask);
|
||||
|
||||
/*
|
||||
* This function will free up IPIs allocated with mips_smp_ipi_allocate to the
|
||||
* CPUs in mask, which must be a subset of the IPIs that have been configured.
|
||||
* Return 0 on success.
|
||||
*/
|
||||
int mips_smp_ipi_free(const struct cpumask *mask);
|
||||
|
||||
static inline void arch_send_call_function_single_ipi(int cpu)
|
||||
{
|
||||
extern struct plat_smp_ops *mp_ops; /* private */
|
||||
|
@@ -859,7 +859,10 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
|
||||
__cu_to = (to); \
|
||||
__cu_from = (from); \
|
||||
__cu_len = (n); \
|
||||
\
|
||||
check_object_size(__cu_from, __cu_len, true); \
|
||||
might_fault(); \
|
||||
\
|
||||
if (eva_kernel_access()) \
|
||||
__cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \
|
||||
__cu_len); \
|
||||
@@ -880,6 +883,9 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
|
||||
__cu_to = (to); \
|
||||
__cu_from = (from); \
|
||||
__cu_len = (n); \
|
||||
\
|
||||
check_object_size(__cu_from, __cu_len, true); \
|
||||
\
|
||||
if (eva_kernel_access()) \
|
||||
__cu_len = __invoke_copy_to_kernel(__cu_to, __cu_from, \
|
||||
__cu_len); \
|
||||
@@ -898,6 +904,9 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
|
||||
__cu_to = (to); \
|
||||
__cu_from = (from); \
|
||||
__cu_len = (n); \
|
||||
\
|
||||
check_object_size(__cu_to, __cu_len, false); \
|
||||
\
|
||||
if (eva_kernel_access()) \
|
||||
__cu_len = __invoke_copy_from_kernel_inatomic(__cu_to, \
|
||||
__cu_from,\
|
||||
@@ -932,6 +941,9 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
|
||||
__cu_to = (to); \
|
||||
__cu_from = (from); \
|
||||
__cu_len = (n); \
|
||||
\
|
||||
check_object_size(__cu_from, __cu_len, true); \
|
||||
\
|
||||
if (eva_kernel_access()) { \
|
||||
__cu_len = __invoke_copy_to_kernel(__cu_to, \
|
||||
__cu_from, \
|
||||
@@ -1124,6 +1136,9 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);
|
||||
__cu_to = (to); \
|
||||
__cu_from = (from); \
|
||||
__cu_len = (n); \
|
||||
\
|
||||
check_object_size(__cu_to, __cu_len, false); \
|
||||
\
|
||||
if (eva_kernel_access()) { \
|
||||
__cu_len = __invoke_copy_from_kernel(__cu_to, \
|
||||
__cu_from, \
|
||||
@@ -1162,6 +1177,9 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);
|
||||
__cu_to = (to); \
|
||||
__cu_from = (from); \
|
||||
__cu_len = (n); \
|
||||
\
|
||||
check_object_size(__cu_to, __cu_len, false); \
|
||||
\
|
||||
if (eva_kernel_access()) { \
|
||||
__cu_len = __invoke_copy_from_kernel(__cu_to, \
|
||||
__cu_from, \
|
||||
|
Reference in New Issue
Block a user