ralink: drop 3.10 support
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 42481
This commit is contained in:
parent
e2864e9990
commit
17cf9c4593
87 changed files with 0 additions and 66599 deletions
|
@ -1,180 +0,0 @@
|
|||
CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
|
||||
CONFIG_ARCH_DISCARD_MEMBLOCK=y
|
||||
CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
|
||||
CONFIG_ARCH_HAS_RESET_CONTROLLER=y
|
||||
CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_REQUIRE_GPIOLIB=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
|
||||
CONFIG_AT803X_PHY=y
|
||||
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
|
||||
CONFIG_CEVT_R4K=y
|
||||
CONFIG_CLKDEV_LOOKUP=y
|
||||
# CONFIG_CLKEVT_RT3352 is not set
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
|
||||
CONFIG_CMDLINE_BOOL=y
|
||||
# CONFIG_CMDLINE_OVERRIDE is not set
|
||||
CONFIG_CPU_GENERIC_DUMP_TLB=y
|
||||
CONFIG_CPU_HAS_PREFETCH=y
|
||||
CONFIG_CPU_HAS_SYNC=y
|
||||
CONFIG_CPU_LITTLE_ENDIAN=y
|
||||
CONFIG_CPU_MIPS32=y
|
||||
# CONFIG_CPU_MIPS32_R1 is not set
|
||||
CONFIG_CPU_MIPS32_R2=y
|
||||
CONFIG_CPU_MIPSR2=y
|
||||
CONFIG_CPU_R4K_CACHE_TLB=y
|
||||
CONFIG_CPU_R4K_FPU=y
|
||||
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
||||
CONFIG_CSRC_R4K=y
|
||||
CONFIG_DEBUG_PINCTRL=y
|
||||
CONFIG_DMA_NONCOHERENT=y
|
||||
# CONFIG_DTB_MT7620A_EVAL is not set
|
||||
CONFIG_DTB_RT_NONE=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
|
||||
CONFIG_GENERIC_CMOS_UPDATE=y
|
||||
CONFIG_GENERIC_IO=y
|
||||
CONFIG_GENERIC_IRQ_SHOW=y
|
||||
CONFIG_GENERIC_PCI_IOMAP=y
|
||||
CONFIG_GENERIC_SMP_IDLE_THREAD=y
|
||||
CONFIG_GPIOLIB=y
|
||||
CONFIG_GPIO_DEVRES=y
|
||||
CONFIG_GPIO_RALINK=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_HARDWARE_WATCHPOINTS=y
|
||||
CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT=y
|
||||
# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
CONFIG_HAVE_ARCH_KGDB=y
|
||||
# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
|
||||
CONFIG_HAVE_CLK=y
|
||||
CONFIG_HAVE_C_RECORDMCOUNT=y
|
||||
CONFIG_HAVE_DEBUG_KMEMLEAK=y
|
||||
CONFIG_HAVE_DMA_API_DEBUG=y
|
||||
CONFIG_HAVE_DMA_ATTRS=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE=y
|
||||
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
|
||||
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
|
||||
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
|
||||
CONFIG_HAVE_GENERIC_HARDIRQS=y
|
||||
CONFIG_HAVE_IDE=y
|
||||
CONFIG_HAVE_KVM=y
|
||||
CONFIG_HAVE_MACH_CLKDEV=y
|
||||
CONFIG_HAVE_MEMBLOCK=y
|
||||
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
|
||||
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
||||
CONFIG_HAVE_NET_DSA=y
|
||||
CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_HW_HAS_PCI=y
|
||||
CONFIG_HW_RANDOM=m
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_ICPLUS_PHY=y
|
||||
CONFIG_IMAGE_CMDLINE_HACK=y
|
||||
CONFIG_INET_LRO=y
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_IRQCHIP=y
|
||||
CONFIG_IRQ_CPU=y
|
||||
CONFIG_IRQ_DOMAIN=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_IRQ_INTC=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
CONFIG_M25PXX_USE_FAST_READ=y
|
||||
CONFIG_MDIO_BOARDINFO=y
|
||||
# CONFIG_MII is not set
|
||||
CONFIG_MIPS=y
|
||||
# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=5
|
||||
# CONFIG_MIPS_MACHINE is not set
|
||||
CONFIG_MIPS_MT_DISABLED=y
|
||||
CONFIG_MODULES_USE_ELF_REL=y
|
||||
# CONFIG_MTD_CFI_INTELEXT is not set
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_M25P80=y
|
||||
CONFIG_MTD_NAND_MT7620=y
|
||||
CONFIG_MTD_OF_PARTS=y
|
||||
CONFIG_MTD_PHYSMAP=y
|
||||
CONFIG_MTD_PHYSMAP_OF=y
|
||||
CONFIG_MTD_SPLIT_FIRMWARE=y
|
||||
CONFIG_MTD_UIMAGE_SPLIT=y
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NEED_PER_CPU_KM=y
|
||||
CONFIG_NET_RALINK=y
|
||||
CONFIG_NET_RALINK_GSW_MT7620=y
|
||||
CONFIG_NET_RALINK_MDIO=y
|
||||
CONFIG_NLS=m
|
||||
CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
CONFIG_OF_DEVICE=y
|
||||
CONFIG_OF_EARLY_FLATTREE=y
|
||||
CONFIG_OF_FLATTREE=y
|
||||
CONFIG_OF_GPIO=y
|
||||
CONFIG_OF_IRQ=y
|
||||
CONFIG_OF_MDIO=y
|
||||
CONFIG_OF_MTD=y
|
||||
CONFIG_OF_NET=y
|
||||
CONFIG_OF_PCI=y
|
||||
CONFIG_OF_PCI_IRQ=y
|
||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||
CONFIG_PCI=y
|
||||
CONFIG_PCI_DOMAINS=y
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
CONFIG_PHYLIB=y
|
||||
# CONFIG_PINCONF is not set
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCTRL_RT2880=y
|
||||
# CONFIG_PINCTRL_SINGLE is not set
|
||||
CONFIG_PINMUX=y
|
||||
# CONFIG_PREEMPT_RCU is not set
|
||||
CONFIG_RALINK=y
|
||||
CONFIG_RALINK_USBPHY=y
|
||||
CONFIG_RALINK_WDT=y
|
||||
# CONFIG_RCU_STALL_COMMON is not set
|
||||
CONFIG_RESET_CONTROLLER=y
|
||||
# CONFIG_SAMSUNG_USB2PHY is not set
|
||||
# CONFIG_SAMSUNG_USB3PHY is not set
|
||||
# CONFIG_SAMSUNG_USBPHY is not set
|
||||
# CONFIG_SCSI_DMA is not set
|
||||
CONFIG_SERIAL_8250_NR_UARTS=4
|
||||
CONFIG_SERIAL_8250_RT288X=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
# CONFIG_SLAB is not set
|
||||
CONFIG_SLUB=y
|
||||
CONFIG_SOC_MT7620=y
|
||||
# CONFIG_SOC_MT7621 is not set
|
||||
# CONFIG_SOC_RT288X is not set
|
||||
# CONFIG_SOC_RT305X is not set
|
||||
# CONFIG_SOC_RT3883 is not set
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPI_RT2880=y
|
||||
CONFIG_SWCONFIG=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
|
||||
CONFIG_SYS_HAS_EARLY_PRINTK=y
|
||||
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
|
||||
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_UIDGID_CONVERTED=y
|
||||
CONFIG_USB=m
|
||||
CONFIG_USB_ARCH_HAS_XHCI=y
|
||||
CONFIG_USB_COMMON=m
|
||||
# CONFIG_USB_EHCI_HCD is not set
|
||||
CONFIG_USB_PHY=y
|
||||
CONFIG_USB_SUPPORT=y
|
||||
# CONFIG_USB_UHCI_HCD is not set
|
||||
CONFIG_USE_OF=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
CONFIG_ZONE_DMA_FLAG=0
|
|
@ -1,171 +0,0 @@
|
|||
CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
|
||||
CONFIG_ARCH_DISCARD_MEMBLOCK=y
|
||||
CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
|
||||
CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_REQUIRE_GPIOLIB=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
|
||||
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
|
||||
CONFIG_CEVT_R4K=y
|
||||
CONFIG_CLKDEV_LOOKUP=y
|
||||
# CONFIG_CLKEVT_RT3352 is not set
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
|
||||
CONFIG_CMDLINE_BOOL=y
|
||||
# CONFIG_CMDLINE_OVERRIDE is not set
|
||||
CONFIG_CPU_GENERIC_DUMP_TLB=y
|
||||
CONFIG_CPU_HAS_PREFETCH=y
|
||||
CONFIG_CPU_HAS_SYNC=y
|
||||
CONFIG_CPU_LITTLE_ENDIAN=y
|
||||
CONFIG_CPU_MIPS32=y
|
||||
# CONFIG_CPU_MIPS32_R1 is not set
|
||||
CONFIG_CPU_MIPS32_R2=y
|
||||
CONFIG_CPU_MIPSR2=y
|
||||
CONFIG_CPU_R4K_CACHE_TLB=y
|
||||
CONFIG_CPU_R4K_FPU=y
|
||||
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
||||
CONFIG_CSRC_R4K=y
|
||||
CONFIG_DEBUG_PINCTRL=y
|
||||
CONFIG_DMA_NONCOHERENT=y
|
||||
# CONFIG_DTB_MT7620A_EVAL is not set
|
||||
CONFIG_DTB_RT_NONE=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
|
||||
CONFIG_GENERIC_CMOS_UPDATE=y
|
||||
CONFIG_GENERIC_IO=y
|
||||
CONFIG_GENERIC_IRQ_SHOW=y
|
||||
CONFIG_GENERIC_PCI_IOMAP=y
|
||||
CONFIG_GENERIC_SMP_IDLE_THREAD=y
|
||||
CONFIG_GPIOLIB=y
|
||||
CONFIG_GPIO_DEVRES=y
|
||||
CONFIG_GPIO_RALINK=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_HARDWARE_WATCHPOINTS=y
|
||||
CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT=y
|
||||
# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
CONFIG_HAVE_ARCH_KGDB=y
|
||||
# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
|
||||
CONFIG_HAVE_CLK=y
|
||||
CONFIG_HAVE_C_RECORDMCOUNT=y
|
||||
CONFIG_HAVE_DEBUG_KMEMLEAK=y
|
||||
CONFIG_HAVE_DMA_API_DEBUG=y
|
||||
CONFIG_HAVE_DMA_ATTRS=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE=y
|
||||
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
|
||||
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
|
||||
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
|
||||
CONFIG_HAVE_GENERIC_HARDIRQS=y
|
||||
CONFIG_HAVE_IDE=y
|
||||
CONFIG_HAVE_KVM=y
|
||||
CONFIG_HAVE_MACH_CLKDEV=y
|
||||
CONFIG_HAVE_MEMBLOCK=y
|
||||
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
|
||||
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
||||
CONFIG_HAVE_NET_DSA=y
|
||||
CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_HW_HAS_PCI=y
|
||||
CONFIG_HW_RANDOM=m
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_IMAGE_CMDLINE_HACK=y
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_IRQCHIP=y
|
||||
CONFIG_IRQ_CPU=y
|
||||
CONFIG_IRQ_DOMAIN=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
CONFIG_M25PXX_USE_FAST_READ=y
|
||||
CONFIG_MDIO_BOARDINFO=y
|
||||
# CONFIG_MII is not set
|
||||
CONFIG_MIPS=y
|
||||
# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=5
|
||||
# CONFIG_MIPS_MACHINE is not set
|
||||
CONFIG_MIPS_MT_DISABLED=y
|
||||
CONFIG_MODULES_USE_ELF_REL=y
|
||||
# CONFIG_MTD_CFI_INTELEXT is not set
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_M25P80=y
|
||||
# CONFIG_MTD_NAND_MT7620 is not set
|
||||
CONFIG_MTD_OF_PARTS=y
|
||||
CONFIG_MTD_PHYSMAP=y
|
||||
CONFIG_MTD_PHYSMAP_OF=y
|
||||
CONFIG_MTD_SPLIT_FIRMWARE=y
|
||||
CONFIG_MTD_UIMAGE_SPLIT=y
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NEED_PER_CPU_KM=y
|
||||
CONFIG_NET_RALINK=y
|
||||
CONFIG_NET_RALINK_GSW_MT7620=y
|
||||
CONFIG_NET_RALINK_MDIO=y
|
||||
CONFIG_NLS=m
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
CONFIG_OF_DEVICE=y
|
||||
CONFIG_OF_EARLY_FLATTREE=y
|
||||
CONFIG_OF_FLATTREE=y
|
||||
CONFIG_OF_GPIO=y
|
||||
CONFIG_OF_IRQ=y
|
||||
CONFIG_OF_MDIO=y
|
||||
CONFIG_OF_MTD=y
|
||||
CONFIG_OF_NET=y
|
||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||
# CONFIG_PCI is not set
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
CONFIG_PHYLIB=y
|
||||
# CONFIG_PINCONF is not set
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCTRL_RT2880=y
|
||||
# CONFIG_PINCTRL_SINGLE is not set
|
||||
CONFIG_PINMUX=y
|
||||
# CONFIG_PREEMPT_RCU is not set
|
||||
CONFIG_RALINK=y
|
||||
CONFIG_RALINK_GDMA=y
|
||||
CONFIG_RALINK_USBPHY=y
|
||||
CONFIG_RALINK_WDT=y
|
||||
# CONFIG_RCU_STALL_COMMON is not set
|
||||
CONFIG_RESET_CONTROLLER=y
|
||||
# CONFIG_SAMSUNG_USB2PHY is not set
|
||||
# CONFIG_SAMSUNG_USB3PHY is not set
|
||||
# CONFIG_SAMSUNG_USBPHY is not set
|
||||
# CONFIG_SCSI_DMA is not set
|
||||
CONFIG_SERIAL_8250_NR_UARTS=4
|
||||
CONFIG_SERIAL_8250_RT288X=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
# CONFIG_SLAB is not set
|
||||
CONFIG_SLUB=y
|
||||
CONFIG_SOC_MT7620=y
|
||||
# CONFIG_SOC_MT7621 is not set
|
||||
# CONFIG_SOC_RT288X is not set
|
||||
# CONFIG_SOC_RT305X is not set
|
||||
# CONFIG_SOC_RT3883 is not set
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPI_RT2880=y
|
||||
CONFIG_SWCONFIG=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
|
||||
CONFIG_SYS_HAS_EARLY_PRINTK=y
|
||||
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
|
||||
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_UIDGID_CONVERTED=y
|
||||
CONFIG_USB=m
|
||||
# CONFIG_USB_ARCH_HAS_XHCI is not set
|
||||
CONFIG_USB_COMMON=m
|
||||
# CONFIG_USB_EHCI_HCD is not set
|
||||
CONFIG_USB_PHY=y
|
||||
CONFIG_USB_SUPPORT=y
|
||||
CONFIG_USE_OF=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
CONFIG_ZONE_DMA_FLAG=0
|
|
@ -1,238 +0,0 @@
|
|||
# CONFIG_32B_DESC is not set
|
||||
CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
|
||||
CONFIG_ARCH_DISCARD_MEMBLOCK=y
|
||||
CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
|
||||
CONFIG_ARCH_HAS_RESET_CONTROLLER=y
|
||||
CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
|
||||
CONFIG_ARCH_REQUIRE_GPIOLIB=y
|
||||
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
|
||||
CONFIG_BOARD_SCACHE=y
|
||||
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
|
||||
# CONFIG_CEVT_GIC is not set
|
||||
CONFIG_CEVT_R4K=y
|
||||
CONFIG_CLKDEV_LOOKUP=y
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
|
||||
CONFIG_CMDLINE_BOOL=y
|
||||
# CONFIG_CMDLINE_OVERRIDE is not set
|
||||
CONFIG_CPU_GENERIC_DUMP_TLB=y
|
||||
CONFIG_CPU_HAS_PREFETCH=y
|
||||
CONFIG_CPU_HAS_SYNC=y
|
||||
CONFIG_CPU_LITTLE_ENDIAN=y
|
||||
CONFIG_CPU_MIPS32=y
|
||||
# CONFIG_CPU_MIPS32_R1 is not set
|
||||
CONFIG_CPU_MIPS32_R2=y
|
||||
CONFIG_CPU_MIPSR2=y
|
||||
CONFIG_CPU_MIPSR2_IRQ_EI=y
|
||||
CONFIG_CPU_MIPSR2_IRQ_VI=y
|
||||
CONFIG_CPU_R4K_CACHE_TLB=y
|
||||
CONFIG_CPU_R4K_FPU=y
|
||||
CONFIG_CPU_RMAP=y
|
||||
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
||||
CONFIG_CSRC_R4K=y
|
||||
CONFIG_DEBUG_PINCTRL=y
|
||||
CONFIG_DMA_NONCOHERENT=y
|
||||
# CONFIG_DTB_MT7621_EVAL is not set
|
||||
CONFIG_DTB_RT_NONE=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_ESW_DOUBLE_VLAN_TAG=y
|
||||
# CONFIG_GE1_MII_AN is not set
|
||||
# CONFIG_GE1_MII_FORCE_100 is not set
|
||||
# CONFIG_GE1_RGMII_AN is not set
|
||||
CONFIG_GE1_RGMII_FORCE_1000=y
|
||||
# CONFIG_GE1_RGMII_NONE is not set
|
||||
# CONFIG_GE1_RVMII_FORCE_100 is not set
|
||||
# CONFIG_GE1_TRGMII_FORCE_1200 is not set
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
|
||||
CONFIG_GENERIC_CMOS_UPDATE=y
|
||||
CONFIG_GENERIC_IO=y
|
||||
CONFIG_GENERIC_IRQ_SHOW=y
|
||||
CONFIG_GENERIC_PCI_IOMAP=y
|
||||
CONFIG_GENERIC_SMP_IDLE_THREAD=y
|
||||
CONFIG_GPIOLIB=y
|
||||
CONFIG_GPIO_DEVRES=y
|
||||
# CONFIG_GPIO_MT7621 is not set
|
||||
CONFIG_GPIO_RALINK=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_HARDWARE_WATCHPOINTS=y
|
||||
CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT=y
|
||||
# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
CONFIG_HAVE_ARCH_KGDB=y
|
||||
# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
|
||||
CONFIG_HAVE_CLK=y
|
||||
CONFIG_HAVE_C_RECORDMCOUNT=y
|
||||
CONFIG_HAVE_DEBUG_KMEMLEAK=y
|
||||
CONFIG_HAVE_DMA_API_DEBUG=y
|
||||
CONFIG_HAVE_DMA_ATTRS=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE=y
|
||||
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
|
||||
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
|
||||
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
|
||||
CONFIG_HAVE_GENERIC_HARDIRQS=y
|
||||
CONFIG_HAVE_IDE=y
|
||||
CONFIG_HAVE_KVM=y
|
||||
CONFIG_HAVE_MACH_CLKDEV=y
|
||||
CONFIG_HAVE_MEMBLOCK=y
|
||||
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
|
||||
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
||||
CONFIG_HAVE_NET_DSA=y
|
||||
CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_HW_HAS_PCI=y
|
||||
CONFIG_HW_RANDOM=m
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_IMAGE_CMDLINE_HACK=y
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_IRQCHIP=y
|
||||
CONFIG_IRQ_CPU=y
|
||||
CONFIG_IRQ_DOMAIN=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_IRQ_GIC=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
# CONFIG_LAN_WAN_SUPPORT is not set
|
||||
CONFIG_M25PXX_USE_FAST_READ=y
|
||||
CONFIG_MDIO_BOARDINFO=y
|
||||
# CONFIG_MII is not set
|
||||
CONFIG_MIPS=y
|
||||
CONFIG_MIPS_CMP=y
|
||||
CONFIG_MIPS_CPU_SCACHE=y
|
||||
# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=6
|
||||
# CONFIG_MIPS_MACHINE is not set
|
||||
CONFIG_MIPS_MT=y
|
||||
# CONFIG_MIPS_MT_DISABLED is not set
|
||||
CONFIG_MIPS_MT_FPAFF=y
|
||||
CONFIG_MIPS_MT_SMP=y
|
||||
# CONFIG_MIPS_MT_SMTC is not set
|
||||
CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y
|
||||
# CONFIG_MIPS_VPE_LOADER is not set
|
||||
CONFIG_MODULES_USE_ELF_REL=y
|
||||
CONFIG_MT7621_ASIC=y
|
||||
# CONFIG_MT7621_WDT is not set
|
||||
# CONFIG_MTD_CFI_INTELEXT is not set
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_M25P80=y
|
||||
CONFIG_MTD_OF_PARTS=y
|
||||
CONFIG_MTD_PHYSMAP=y
|
||||
CONFIG_MTD_PHYSMAP_OF=y
|
||||
CONFIG_MTD_SPLIT_FIRMWARE=y
|
||||
CONFIG_MTD_UIMAGE_SPLIT=y
|
||||
CONFIG_MUTEX_SPIN_ON_OWNER=y
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
# CONFIG_NET_RALINK is not set
|
||||
CONFIG_NLS=m
|
||||
CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
|
||||
CONFIG_NR_CPUS=4
|
||||
CONFIG_NR_CPUS_DEFAULT_2=y
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
CONFIG_OF_DEVICE=y
|
||||
CONFIG_OF_EARLY_FLATTREE=y
|
||||
CONFIG_OF_FLATTREE=y
|
||||
CONFIG_OF_GPIO=y
|
||||
CONFIG_OF_IRQ=y
|
||||
CONFIG_OF_MDIO=y
|
||||
CONFIG_OF_MTD=y
|
||||
CONFIG_OF_NET=y
|
||||
CONFIG_OF_PCI=y
|
||||
CONFIG_OF_PCI_IRQ=y
|
||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||
CONFIG_PCI=y
|
||||
CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
|
||||
CONFIG_PCI_DOMAINS=y
|
||||
CONFIG_PDMA_NEW=y
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
CONFIG_PHYLIB=y
|
||||
# CONFIG_PINCONF is not set
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCTRL_RT2880=y
|
||||
# CONFIG_PINCTRL_SINGLE is not set
|
||||
CONFIG_PINMUX=y
|
||||
# CONFIG_PREEMPT_RCU is not set
|
||||
CONFIG_RAETH=y
|
||||
CONFIG_RAETH_CHECKSUM_OFFLOAD=y
|
||||
# CONFIG_RAETH_GMAC2 is not set
|
||||
# CONFIG_RAETH_HW_VLAN_RX is not set
|
||||
# CONFIG_RAETH_HW_VLAN_TX is not set
|
||||
# CONFIG_RAETH_LRO is not set
|
||||
# CONFIG_RAETH_NAPI is not set
|
||||
# CONFIG_RAETH_QDMA is not set
|
||||
CONFIG_RAETH_SCATTER_GATHER_RX_DMA=y
|
||||
# CONFIG_RAETH_SKB_RECYCLE_2K is not set
|
||||
# CONFIG_RAETH_SPECIAL_TAG is not set
|
||||
# CONFIG_RAETH_TSO is not set
|
||||
CONFIG_RALINK=y
|
||||
CONFIG_RALINK_MT7621=y
|
||||
CONFIG_RALINK_USBPHY=y
|
||||
# CONFIG_RALINK_WDT is not set
|
||||
CONFIG_RA_NAT_NONE=y
|
||||
# CONFIG_RA_NETWORK_TASKLET_BH is not set
|
||||
CONFIG_RA_NETWORK_WORKQUEUE_BH=y
|
||||
CONFIG_RCU_STALL_COMMON=y
|
||||
CONFIG_RESET_CONTROLLER=y
|
||||
CONFIG_RFS_ACCEL=y
|
||||
CONFIG_RPS=y
|
||||
CONFIG_RT_3052_ESW=y
|
||||
# CONFIG_SAMSUNG_USB2PHY is not set
|
||||
# CONFIG_SAMSUNG_USB3PHY is not set
|
||||
# CONFIG_SAMSUNG_USBPHY is not set
|
||||
CONFIG_SCHED_SMT=y
|
||||
# CONFIG_SCSI_DMA is not set
|
||||
CONFIG_SERIAL_8250_NR_UARTS=4
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
# CONFIG_SLAB is not set
|
||||
CONFIG_SLUB=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_SMP_UP=y
|
||||
# CONFIG_SOC_MT7620 is not set
|
||||
CONFIG_SOC_MT7621=y
|
||||
# CONFIG_SOC_RT288X is not set
|
||||
# CONFIG_SOC_RT305X is not set
|
||||
# CONFIG_SOC_RT3883 is not set
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPI_RT2880=y
|
||||
CONFIG_STOP_MACHINE=y
|
||||
CONFIG_SWCONFIG=y
|
||||
CONFIG_SYNC_R4K=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
|
||||
CONFIG_SYS_HAS_EARLY_PRINTK=y
|
||||
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
|
||||
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
|
||||
CONFIG_SYS_SUPPORTS_MIPS_CMP=y
|
||||
CONFIG_SYS_SUPPORTS_MULTITHREADING=y
|
||||
CONFIG_SYS_SUPPORTS_SCHED_SMT=y
|
||||
CONFIG_SYS_SUPPORTS_SMP=y
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_TREE_RCU=y
|
||||
CONFIG_UIDGID_CONVERTED=y
|
||||
CONFIG_USB=m
|
||||
CONFIG_USB_ARCH_HAS_XHCI=y
|
||||
CONFIG_USB_COMMON=m
|
||||
# CONFIG_USB_EHCI_HCD is not set
|
||||
CONFIG_USB_MT7621_XHCI_PLATFORM=y
|
||||
CONFIG_USB_PHY=y
|
||||
CONFIG_USB_SUPPORT=y
|
||||
# CONFIG_USB_UHCI_HCD is not set
|
||||
CONFIG_USB_XHCI_HCD=m
|
||||
# CONFIG_USB_XHCI_HCD_DEBUGGING is not set
|
||||
CONFIG_USB_XHCI_PLATFORM=y
|
||||
CONFIG_USE_GENERIC_SMP_HELPERS=y
|
||||
CONFIG_USE_OF=y
|
||||
CONFIG_WAN_AT_P0=y
|
||||
# CONFIG_WAN_AT_P4 is not set
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
CONFIG_WEAK_ORDERING=y
|
||||
CONFIG_XPS=y
|
||||
CONFIG_ZONE_DMA_FLAG=0
|
|
@ -1,39 +0,0 @@
|
|||
From d11f6e47eb748f27ba325bd843cc88bae3ad0e8a Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Tue, 29 Jan 2013 21:11:55 +0100
|
||||
Subject: [PATCH 01/25] MTD: m25p80: allow loading mtd name from OF
|
||||
|
||||
In accordance with the physmap flash we should honour the linux,mtd-name
|
||||
property when deciding what name the mtd device has.
|
||||
|
||||
Signed-off-by: Thomas Langer <thomas.langer@lantiq.com>
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/mtd/devices/m25p80.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/drivers/mtd/devices/m25p80.c
|
||||
+++ b/drivers/mtd/devices/m25p80.c
|
||||
@@ -927,10 +927,13 @@ static int m25p_probe(struct spi_device
|
||||
unsigned i;
|
||||
struct mtd_part_parser_data ppdata;
|
||||
struct device_node __maybe_unused *np = spi->dev.of_node;
|
||||
+ const char __maybe_unused *of_mtd_name = NULL;
|
||||
|
||||
#ifdef CONFIG_MTD_OF_PARTS
|
||||
if (!of_device_is_available(np))
|
||||
return -ENODEV;
|
||||
+ of_property_read_string(spi->dev.of_node,
|
||||
+ "linux,mtd-name", &of_mtd_name);
|
||||
#endif
|
||||
|
||||
/* Platform data helps sort out which chip type we have, as
|
||||
@@ -1006,6 +1009,8 @@ static int m25p_probe(struct spi_device
|
||||
|
||||
if (data && data->name)
|
||||
flash->mtd.name = data->name;
|
||||
+ else if (of_mtd_name)
|
||||
+ flash->mtd.name = of_mtd_name;
|
||||
else
|
||||
flash->mtd.name = dev_name(&spi->dev);
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
From 080f1a0c539180a88066fb004a8c31eefdf74161 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Fri, 9 Aug 2013 18:47:27 +0200
|
||||
Subject: [PATCH 02/25] reset: Fix compile when reset RESET_CONTROLLER is not
|
||||
selected
|
||||
|
||||
Drivers need to protect their reset api calls with #ifdef to avoid compile
|
||||
errors.
|
||||
|
||||
This patch adds dummy wrappers in the same way that linux/of.h does it.
|
||||
|
||||
Cc: linux-kernel@vger.kernel.org
|
||||
Cc: Philipp Zabel <p.zabel@pengutronix.de>
|
||||
Cc: Gabor Juhos <juhosg@openwrt.org>
|
||||
---
|
||||
include/linux/reset-controller.h | 16 ++++++++++++++
|
||||
include/linux/reset.h | 43 ++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 59 insertions(+)
|
||||
|
||||
--- a/include/linux/reset-controller.h
|
||||
+++ b/include/linux/reset-controller.h
|
||||
@@ -45,7 +45,23 @@ struct reset_controller_dev {
|
||||
unsigned int nr_resets;
|
||||
};
|
||||
|
||||
+#if defined(CONFIG_RESET_CONTROLLER)
|
||||
+
|
||||
int reset_controller_register(struct reset_controller_dev *rcdev);
|
||||
void reset_controller_unregister(struct reset_controller_dev *rcdev);
|
||||
|
||||
+#else
|
||||
+
|
||||
+static inline int reset_controller_register(struct reset_controller_dev *rcdev)
|
||||
+{
|
||||
+ return -ENOSYS;
|
||||
+}
|
||||
+
|
||||
+void reset_controller_unregister(struct reset_controller_dev *rcdev)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
--- a/include/linux/reset.h
|
||||
+++ b/include/linux/reset.h
|
||||
@@ -1,9 +1,13 @@
|
||||
#ifndef _LINUX_RESET_H_
|
||||
#define _LINUX_RESET_H_
|
||||
|
||||
+#include <linux/err.h>
|
||||
+
|
||||
struct device;
|
||||
struct reset_control;
|
||||
|
||||
+#if defined(CONFIG_RESET_CONTROLLER)
|
||||
+
|
||||
int reset_control_reset(struct reset_control *rstc);
|
||||
int reset_control_assert(struct reset_control *rstc);
|
||||
int reset_control_deassert(struct reset_control *rstc);
|
||||
@@ -14,4 +18,43 @@ struct reset_control *devm_reset_control
|
||||
|
||||
int device_reset(struct device *dev);
|
||||
|
||||
+#else /* CONFIG_RESET_CONTROLLER */
|
||||
+
|
||||
+static inline int reset_control_reset(struct reset_control *rstc)
|
||||
+{
|
||||
+ return -ENOSYS;
|
||||
+}
|
||||
+
|
||||
+static inline int reset_control_assert(struct reset_control *rstc)
|
||||
+{
|
||||
+ return -ENOSYS;
|
||||
+}
|
||||
+
|
||||
+static inline int reset_control_deassert(struct reset_control *rstc)
|
||||
+{
|
||||
+ return -ENOSYS;
|
||||
+}
|
||||
+
|
||||
+static inline struct reset_control *reset_control_get(struct device *dev, const char *id)
|
||||
+{
|
||||
+ return ERR_PTR(-ENOSYS);
|
||||
+}
|
||||
+
|
||||
+static inline void reset_control_put(struct reset_control *rstc)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static inline struct reset_control *devm_reset_control_get(struct device *dev, const char *id)
|
||||
+{
|
||||
+ return ERR_PTR(-ENOSYS);
|
||||
+}
|
||||
+
|
||||
+static inline int device_reset(struct device *dev)
|
||||
+{
|
||||
+ return -ENOSYS;
|
||||
+}
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
#endif
|
|
@ -1,39 +0,0 @@
|
|||
From 8b87087423057f8a06423702f3035634d6e8cd73 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 19:57:20 +0200
|
||||
Subject: [PATCH 03/25] DT: Add documentation for rt2880-wdt
|
||||
|
||||
This document describes the binding of the watchdog core found ralink wireless
|
||||
SoC.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
Cc: linux-watchdog@vger.kernel.org
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Cc: devicetree-discuss@lists.ozlabs.org
|
||||
---
|
||||
.../devicetree/bindings/watchdog/rt2880-wdt.txt | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/watchdog/rt2880-wdt.txt
|
||||
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/watchdog/rt2880-wdt.txt
|
||||
@@ -0,0 +1,19 @@
|
||||
+Ralink Watchdog Timers
|
||||
+
|
||||
+Required properties :
|
||||
+- compatible: must be "ralink,rt2880-wdt"
|
||||
+- reg: physical base address of the controller and length of the register range
|
||||
+
|
||||
+Optional properties :
|
||||
+- interrupt-parent: phandle to the INTC device node
|
||||
+- interrupts: Specify the INTC interrupt number
|
||||
+
|
||||
+Example:
|
||||
+
|
||||
+ watchdog@120 {
|
||||
+ compatible = "ralink,rt2880-wdt";
|
||||
+ reg = <0x120 0x10>;
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <1>;
|
||||
+ };
|
|
@ -1,254 +0,0 @@
|
|||
From 78046b68c1fc757162e32c83f59c3a94e794bf2e Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 13:51:58 +0200
|
||||
Subject: [PATCH 04/25] watchdog: MIPS: add ralink watchdog driver
|
||||
|
||||
Add a driver for the watchdog timer found on Ralink SoC
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
Cc: linux-watchdog@vger.kernel.org
|
||||
Cc: linux-mips@linux-mips.org
|
||||
---
|
||||
drivers/watchdog/Kconfig | 7 ++
|
||||
drivers/watchdog/Makefile | 1 +
|
||||
drivers/watchdog/rt2880_wdt.c | 208 +++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 216 insertions(+)
|
||||
create mode 100644 drivers/watchdog/rt2880_wdt.c
|
||||
|
||||
--- a/drivers/watchdog/Kconfig
|
||||
+++ b/drivers/watchdog/Kconfig
|
||||
@@ -1113,6 +1113,13 @@ config LANTIQ_WDT
|
||||
help
|
||||
Hardware driver for the Lantiq SoC Watchdog Timer.
|
||||
|
||||
+config RALINK_WDT
|
||||
+ tristate "Ralink SoC watchdog"
|
||||
+ select WATCHDOG_CORE
|
||||
+ depends on RALINK
|
||||
+ help
|
||||
+ Hardware driver for the Ralink SoC Watchdog Timer.
|
||||
+
|
||||
# PARISC Architecture
|
||||
|
||||
# POWERPC Architecture
|
||||
--- a/drivers/watchdog/Makefile
|
||||
+++ b/drivers/watchdog/Makefile
|
||||
@@ -135,6 +135,7 @@ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
|
||||
obj-$(CONFIG_OCTEON_WDT) += octeon-wdt.o
|
||||
octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o
|
||||
obj-$(CONFIG_LANTIQ_WDT) += lantiq_wdt.o
|
||||
+obj-$(CONFIG_RALINK_WDT) += rt2880_wdt.o
|
||||
|
||||
# PARISC Architecture
|
||||
|
||||
--- /dev/null
|
||||
+++ b/drivers/watchdog/rt2880_wdt.c
|
||||
@@ -0,0 +1,208 @@
|
||||
+/*
|
||||
+ * Ralink RT288x/RT3xxx/MT76xx built-in hardware watchdog timer
|
||||
+ *
|
||||
+ * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+ *
|
||||
+ * This driver was based on: drivers/watchdog/softdog.c
|
||||
+ *
|
||||
+ * 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/clk.h>
|
||||
+#include <linux/reset.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/watchdog.h>
|
||||
+#include <linux/miscdevice.h>
|
||||
+#include <linux/moduleparam.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/ralink_regs.h>
|
||||
+
|
||||
+#define SYSC_RSTSTAT 0x38
|
||||
+#define WDT_RST_CAUSE BIT(1)
|
||||
+
|
||||
+#define RALINK_WDT_TIMEOUT 30
|
||||
+#define RALINK_WDT_PRESCALE 65536
|
||||
+
|
||||
+#define TIMER_REG_TMR1LOAD 0x00
|
||||
+#define TIMER_REG_TMR1CTL 0x08
|
||||
+
|
||||
+#define TMRSTAT_TMR1RST BIT(5)
|
||||
+
|
||||
+#define TMR1CTL_ENABLE BIT(7)
|
||||
+#define TMR1CTL_MODE_SHIFT 4
|
||||
+#define TMR1CTL_MODE_MASK 0x3
|
||||
+#define TMR1CTL_MODE_FREE_RUNNING 0x0
|
||||
+#define TMR1CTL_MODE_PERIODIC 0x1
|
||||
+#define TMR1CTL_MODE_TIMEOUT 0x2
|
||||
+#define TMR1CTL_MODE_WDT 0x3
|
||||
+#define TMR1CTL_PRESCALE_MASK 0xf
|
||||
+#define TMR1CTL_PRESCALE_65536 0xf
|
||||
+
|
||||
+static struct clk *rt288x_wdt_clk;
|
||||
+static unsigned long rt288x_wdt_freq;
|
||||
+static void __iomem *rt288x_wdt_base;
|
||||
+
|
||||
+static bool nowayout = WATCHDOG_NOWAYOUT;
|
||||
+module_param(nowayout, bool, 0);
|
||||
+MODULE_PARM_DESC(nowayout,
|
||||
+ "Watchdog cannot be stopped once started (default="
|
||||
+ __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
|
||||
+
|
||||
+static inline void rt_wdt_w32(unsigned reg, u32 val)
|
||||
+{
|
||||
+ iowrite32(val, rt288x_wdt_base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline u32 rt_wdt_r32(unsigned reg)
|
||||
+{
|
||||
+ return ioread32(rt288x_wdt_base + reg);
|
||||
+}
|
||||
+
|
||||
+static int rt288x_wdt_ping(struct watchdog_device *w)
|
||||
+{
|
||||
+ rt_wdt_w32(TIMER_REG_TMR1LOAD, w->timeout * rt288x_wdt_freq);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt288x_wdt_start(struct watchdog_device *w)
|
||||
+{
|
||||
+ u32 t;
|
||||
+
|
||||
+ t = rt_wdt_r32(TIMER_REG_TMR1CTL);
|
||||
+ t &= ~(TMR1CTL_MODE_MASK << TMR1CTL_MODE_SHIFT |
|
||||
+ TMR1CTL_PRESCALE_MASK);
|
||||
+ t |= (TMR1CTL_MODE_WDT << TMR1CTL_MODE_SHIFT |
|
||||
+ TMR1CTL_PRESCALE_65536);
|
||||
+ rt_wdt_w32(TIMER_REG_TMR1CTL, t);
|
||||
+
|
||||
+ rt288x_wdt_ping(w);
|
||||
+
|
||||
+ t = rt_wdt_r32(TIMER_REG_TMR1CTL);
|
||||
+ t |= TMR1CTL_ENABLE;
|
||||
+ rt_wdt_w32(TIMER_REG_TMR1CTL, t);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt288x_wdt_stop(struct watchdog_device *w)
|
||||
+{
|
||||
+ u32 t;
|
||||
+
|
||||
+ rt288x_wdt_ping(w);
|
||||
+
|
||||
+ t = rt_wdt_r32(TIMER_REG_TMR1CTL);
|
||||
+ t &= ~TMR1CTL_ENABLE;
|
||||
+ rt_wdt_w32(TIMER_REG_TMR1CTL, t);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt288x_wdt_set_timeout(struct watchdog_device *w, unsigned int t)
|
||||
+{
|
||||
+ w->timeout = t;
|
||||
+ rt288x_wdt_ping(w);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt288x_wdt_bootcause(void)
|
||||
+{
|
||||
+ if (rt_sysc_r32(SYSC_RSTSTAT) & WDT_RST_CAUSE)
|
||||
+ return WDIOF_CARDRESET;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct watchdog_info rt288x_wdt_info = {
|
||||
+ .identity = "Ralink Watchdog",
|
||||
+ .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
|
||||
+};
|
||||
+
|
||||
+static struct watchdog_ops rt288x_wdt_ops = {
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .start = rt288x_wdt_start,
|
||||
+ .stop = rt288x_wdt_stop,
|
||||
+ .ping = rt288x_wdt_ping,
|
||||
+ .set_timeout = rt288x_wdt_set_timeout,
|
||||
+};
|
||||
+
|
||||
+static struct watchdog_device rt288x_wdt_dev = {
|
||||
+ .info = &rt288x_wdt_info,
|
||||
+ .ops = &rt288x_wdt_ops,
|
||||
+ .min_timeout = 1,
|
||||
+};
|
||||
+
|
||||
+static int rt288x_wdt_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct resource *res;
|
||||
+ int ret;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ rt288x_wdt_base = devm_request_and_ioremap(&pdev->dev, res);
|
||||
+ if (IS_ERR(rt288x_wdt_base))
|
||||
+ return PTR_ERR(rt288x_wdt_base);
|
||||
+
|
||||
+ rt288x_wdt_clk = devm_clk_get(&pdev->dev, NULL);
|
||||
+ if (IS_ERR(rt288x_wdt_clk))
|
||||
+ return PTR_ERR(rt288x_wdt_clk);
|
||||
+
|
||||
+ device_reset(&pdev->dev);
|
||||
+
|
||||
+ rt288x_wdt_freq = clk_get_rate(rt288x_wdt_clk) / RALINK_WDT_PRESCALE;
|
||||
+
|
||||
+ rt288x_wdt_dev.dev = &pdev->dev;
|
||||
+ rt288x_wdt_dev.bootstatus = rt288x_wdt_bootcause();
|
||||
+
|
||||
+ rt288x_wdt_dev.max_timeout = (0xfffful / rt288x_wdt_freq);
|
||||
+ rt288x_wdt_dev.timeout = rt288x_wdt_dev.max_timeout;
|
||||
+
|
||||
+ watchdog_set_nowayout(&rt288x_wdt_dev, nowayout);
|
||||
+
|
||||
+ ret = watchdog_register_device(&rt288x_wdt_dev);
|
||||
+ if (!ret)
|
||||
+ dev_info(&pdev->dev, "Initialized\n");
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt288x_wdt_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ watchdog_unregister_device(&rt288x_wdt_dev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void rt288x_wdt_shutdown(struct platform_device *pdev)
|
||||
+{
|
||||
+ rt288x_wdt_stop(&rt288x_wdt_dev);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id rt288x_wdt_match[] = {
|
||||
+ { .compatible = "ralink,rt2880-wdt" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rt288x_wdt_match);
|
||||
+
|
||||
+static struct platform_driver rt288x_wdt_driver = {
|
||||
+ .probe = rt288x_wdt_probe,
|
||||
+ .remove = rt288x_wdt_remove,
|
||||
+ .shutdown = rt288x_wdt_shutdown,
|
||||
+ .driver = {
|
||||
+ .name = KBUILD_MODNAME,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = rt288x_wdt_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(rt288x_wdt_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("MediaTek/Ralink RT288x/RT3xxx hardware watchdog driver");
|
||||
+MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
|
|
@ -1,59 +0,0 @@
|
|||
From ad68c2865b360f1b637432b4cbcaaf101d2687b9 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 19:45:30 +0200
|
||||
Subject: [PATCH 05/25] DT: Add documentation for gpio-ralink
|
||||
|
||||
Describe gpio-ralink binding.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Cc: devicetree@vger.kernel.org
|
||||
Cc: linux-gpio@vger.kernel.org
|
||||
---
|
||||
.../devicetree/bindings/gpio/gpio-ralink.txt | 40 ++++++++++++++++++++
|
||||
1 file changed, 40 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/gpio/gpio-ralink.txt
|
||||
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/gpio/gpio-ralink.txt
|
||||
@@ -0,0 +1,40 @@
|
||||
+Ralink SoC GPIO controller bindings
|
||||
+
|
||||
+Required properties:
|
||||
+- compatible:
|
||||
+ - "ralink,rt2880-gpio" for Ralink controllers
|
||||
+- #gpio-cells : Should be two.
|
||||
+ - first cell is the pin number
|
||||
+ - second cell is used to specify optional parameters (unused)
|
||||
+- gpio-controller : Marks the device node as a GPIO controller
|
||||
+- reg : Physical base address and length of the controller's registers
|
||||
+- interrupt-parent: phandle to the INTC device node
|
||||
+- interrupts : Specify the INTC interrupt number
|
||||
+- ralink,num-gpios : Specify the number of GPIOs
|
||||
+- ralink,register-map : The register layout depends on the GPIO bank and actual
|
||||
+ SoC type. Register offsets need to be in this order.
|
||||
+ [ INT, EDGE, RENA, FENA, DATA, DIR, POL, SET, RESET, TOGGLE ]
|
||||
+
|
||||
+Optional properties:
|
||||
+- ralink,gpio-base : Specify the GPIO chips base number
|
||||
+
|
||||
+Example:
|
||||
+
|
||||
+ gpio0: gpio@600 {
|
||||
+ compatible = "ralink,rt5350-gpio", "ralink,rt2880-gpio";
|
||||
+
|
||||
+ #gpio-cells = <2>;
|
||||
+ gpio-controller;
|
||||
+
|
||||
+ reg = <0x600 0x34>;
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <6>;
|
||||
+
|
||||
+ ralink,gpio-base = <0>;
|
||||
+ ralink,num-gpios = <24>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 20 24 28 2c
|
||||
+ 30 34 ];
|
||||
+
|
||||
+ };
|
|
@ -1,431 +0,0 @@
|
|||
From 55833373cf527dc94bc6c63b68d0f39591667a5d Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 14:00:25 +0200
|
||||
Subject: [PATCH 06/25] GPIO: MIPS: ralink: add gpio driver for ralink SoC
|
||||
|
||||
Add gpio driver for Ralink SoC. This driver makes the gpio core on
|
||||
RT2880, RT305x, rt3352, rt3662, rt3883, rt5350 and mt7620 work.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Cc: linux-gpio@vger.kernel.org
|
||||
---
|
||||
arch/mips/Kconfig | 1 +
|
||||
arch/mips/include/asm/mach-ralink/gpio.h | 24 +++
|
||||
drivers/gpio/Kconfig | 6 +
|
||||
drivers/gpio/Makefile | 1 +
|
||||
drivers/gpio/gpio-ralink.c | 337 ++++++++++++++++++++++++++++++
|
||||
5 files changed, 369 insertions(+)
|
||||
create mode 100644 arch/mips/include/asm/mach-ralink/gpio.h
|
||||
create mode 100644 drivers/gpio/gpio-ralink.c
|
||||
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -444,6 +444,7 @@ config RALINK
|
||||
select SYS_HAS_EARLY_PRINTK
|
||||
select HAVE_MACH_CLKDEV
|
||||
select CLKDEV_LOOKUP
|
||||
+ select ARCH_REQUIRE_GPIOLIB
|
||||
|
||||
config SGI_IP22
|
||||
bool "SGI IP22 (Indy/Indigo2)"
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/include/asm/mach-ralink/gpio.h
|
||||
@@ -0,0 +1,24 @@
|
||||
+/*
|
||||
+ * Ralink SoC GPIO API support
|
||||
+ *
|
||||
+ * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
|
||||
+ *
|
||||
+ * 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_MACH_RALINK_GPIO_H
|
||||
+#define __ASM_MACH_RALINK_GPIO_H
|
||||
+
|
||||
+#define ARCH_NR_GPIOS 128
|
||||
+#include <asm-generic/gpio.h>
|
||||
+
|
||||
+#define gpio_get_value __gpio_get_value
|
||||
+#define gpio_set_value __gpio_set_value
|
||||
+#define gpio_cansleep __gpio_cansleep
|
||||
+#define gpio_to_irq __gpio_to_irq
|
||||
+
|
||||
+#endif /* __ASM_MACH_RALINK_GPIO_H */
|
||||
--- a/drivers/gpio/Kconfig
|
||||
+++ b/drivers/gpio/Kconfig
|
||||
@@ -209,6 +209,12 @@ config GPIO_RCAR
|
||||
help
|
||||
Say yes here to support GPIO on Renesas R-Car SoCs.
|
||||
|
||||
+config GPIO_RALINK
|
||||
+ bool "Ralink GPIO Support"
|
||||
+ depends on RALINK
|
||||
+ help
|
||||
+ Say yes here to support the Ralink SoC GPIO device
|
||||
+
|
||||
config GPIO_SPEAR_SPICS
|
||||
bool "ST SPEAr13xx SPI Chip Select as GPIO support"
|
||||
depends on PLAT_SPEAR
|
||||
--- a/drivers/gpio/Makefile
|
||||
+++ b/drivers/gpio/Makefile
|
||||
@@ -56,6 +56,7 @@ obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf85
|
||||
obj-$(CONFIG_GPIO_PCH) += gpio-pch.o
|
||||
obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o
|
||||
obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o
|
||||
+obj-$(CONFIG_GPIO_RALINK) += gpio-ralink.o
|
||||
obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o
|
||||
obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o
|
||||
obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpio/gpio-ralink.c
|
||||
@@ -0,0 +1,345 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/gpio.h>
|
||||
+#include <linux/spinlock.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/of_irq.h>
|
||||
+#include <linux/irqdomain.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+
|
||||
+enum ralink_gpio_reg {
|
||||
+ GPIO_REG_INT = 0,
|
||||
+ GPIO_REG_EDGE,
|
||||
+ GPIO_REG_RENA,
|
||||
+ GPIO_REG_FENA,
|
||||
+ GPIO_REG_DATA,
|
||||
+ GPIO_REG_DIR,
|
||||
+ GPIO_REG_POL,
|
||||
+ GPIO_REG_SET,
|
||||
+ GPIO_REG_RESET,
|
||||
+ GPIO_REG_TOGGLE,
|
||||
+ GPIO_REG_MAX
|
||||
+};
|
||||
+
|
||||
+struct ralink_gpio_chip {
|
||||
+ struct gpio_chip chip;
|
||||
+ u8 regs[GPIO_REG_MAX];
|
||||
+
|
||||
+ spinlock_t lock;
|
||||
+ void __iomem *membase;
|
||||
+ struct irq_domain *domain;
|
||||
+ int irq;
|
||||
+
|
||||
+ u32 rising;
|
||||
+ u32 falling;
|
||||
+};
|
||||
+
|
||||
+#define MAP_MAX 4
|
||||
+static struct irq_domain *irq_map[MAP_MAX];
|
||||
+static int irq_map_count;
|
||||
+static atomic_t irq_refcount = ATOMIC_INIT(0);
|
||||
+
|
||||
+static inline struct ralink_gpio_chip *to_ralink_gpio(struct gpio_chip *chip)
|
||||
+{
|
||||
+ struct ralink_gpio_chip *rg;
|
||||
+
|
||||
+ rg = container_of(chip, struct ralink_gpio_chip, chip);
|
||||
+
|
||||
+ return rg;
|
||||
+}
|
||||
+
|
||||
+static inline void rt_gpio_w32(struct ralink_gpio_chip *rg, u8 reg, u32 val)
|
||||
+{
|
||||
+ iowrite32(val, rg->membase + rg->regs[reg]);
|
||||
+}
|
||||
+
|
||||
+static inline u32 rt_gpio_r32(struct ralink_gpio_chip *rg, u8 reg)
|
||||
+{
|
||||
+ return ioread32(rg->membase + rg->regs[reg]);
|
||||
+}
|
||||
+
|
||||
+static void ralink_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
+{
|
||||
+ struct ralink_gpio_chip *rg = to_ralink_gpio(chip);
|
||||
+
|
||||
+ rt_gpio_w32(rg, (value) ? GPIO_REG_SET : GPIO_REG_RESET, BIT(offset));
|
||||
+}
|
||||
+
|
||||
+static int ralink_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||
+{
|
||||
+ struct ralink_gpio_chip *rg = to_ralink_gpio(chip);
|
||||
+
|
||||
+ return !!(rt_gpio_r32(rg, GPIO_REG_DATA) & BIT(offset));
|
||||
+}
|
||||
+
|
||||
+static int ralink_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
|
||||
+{
|
||||
+ struct ralink_gpio_chip *rg = to_ralink_gpio(chip);
|
||||
+ unsigned long flags;
|
||||
+ u32 t;
|
||||
+
|
||||
+ spin_lock_irqsave(&rg->lock, flags);
|
||||
+ t = rt_gpio_r32(rg, GPIO_REG_DIR);
|
||||
+ t &= ~BIT(offset);
|
||||
+ rt_gpio_w32(rg, GPIO_REG_DIR, t);
|
||||
+ spin_unlock_irqrestore(&rg->lock, flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ralink_gpio_direction_output(struct gpio_chip *chip,
|
||||
+ unsigned offset, int value)
|
||||
+{
|
||||
+ struct ralink_gpio_chip *rg = to_ralink_gpio(chip);
|
||||
+ unsigned long flags;
|
||||
+ u32 t;
|
||||
+
|
||||
+ spin_lock_irqsave(&rg->lock, flags);
|
||||
+ ralink_gpio_set(chip, offset, value);
|
||||
+ t = rt_gpio_r32(rg, GPIO_REG_DIR);
|
||||
+ t |= BIT(offset);
|
||||
+ rt_gpio_w32(rg, GPIO_REG_DIR, t);
|
||||
+ spin_unlock_irqrestore(&rg->lock, flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ralink_gpio_to_irq(struct gpio_chip *chip, unsigned pin)
|
||||
+{
|
||||
+ struct ralink_gpio_chip *rg = to_ralink_gpio(chip);
|
||||
+
|
||||
+ if (rg->irq < 1)
|
||||
+ return -1;
|
||||
+
|
||||
+ return irq_create_mapping(rg->domain, pin);
|
||||
+}
|
||||
+
|
||||
+static void ralink_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < irq_map_count; i++) {
|
||||
+ struct irq_domain *domain = irq_map[i];
|
||||
+ struct ralink_gpio_chip *rg;
|
||||
+ unsigned long pending;
|
||||
+ int bit;
|
||||
+
|
||||
+ rg = (struct ralink_gpio_chip *) domain->host_data;
|
||||
+ pending = rt_gpio_r32(rg, GPIO_REG_INT);
|
||||
+
|
||||
+ for_each_set_bit(bit, &pending, rg->chip.ngpio) {
|
||||
+ u32 map = irq_find_mapping(domain, bit);
|
||||
+ generic_handle_irq(map);
|
||||
+ rt_gpio_w32(rg, GPIO_REG_INT, BIT(bit));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void ralink_gpio_irq_unmask(struct irq_data *d)
|
||||
+{
|
||||
+ struct ralink_gpio_chip *rg;
|
||||
+ unsigned long flags;
|
||||
+ u32 val;
|
||||
+
|
||||
+ rg = (struct ralink_gpio_chip *) d->domain->host_data;
|
||||
+ val = rt_gpio_r32(rg, GPIO_REG_RENA);
|
||||
+
|
||||
+ spin_lock_irqsave(&rg->lock, flags);
|
||||
+ rt_gpio_w32(rg, GPIO_REG_RENA, val | (BIT(d->hwirq) & rg->rising));
|
||||
+ rt_gpio_w32(rg, GPIO_REG_FENA, val | (BIT(d->hwirq) & rg->falling));
|
||||
+ spin_unlock_irqrestore(&rg->lock, flags);
|
||||
+}
|
||||
+
|
||||
+static void ralink_gpio_irq_mask(struct irq_data *d)
|
||||
+{
|
||||
+ struct ralink_gpio_chip *rg;
|
||||
+ unsigned long flags;
|
||||
+ u32 val;
|
||||
+
|
||||
+ rg = (struct ralink_gpio_chip *) d->domain->host_data;
|
||||
+ val = rt_gpio_r32(rg, GPIO_REG_RENA);
|
||||
+
|
||||
+ spin_lock_irqsave(&rg->lock, flags);
|
||||
+ rt_gpio_w32(rg, GPIO_REG_FENA, val & ~BIT(d->hwirq));
|
||||
+ rt_gpio_w32(rg, GPIO_REG_RENA, val & ~BIT(d->hwirq));
|
||||
+ spin_unlock_irqrestore(&rg->lock, flags);
|
||||
+}
|
||||
+
|
||||
+static int ralink_gpio_irq_type(struct irq_data *d, unsigned int type)
|
||||
+{
|
||||
+ struct ralink_gpio_chip *rg;
|
||||
+ u32 mask = BIT(d->hwirq);
|
||||
+
|
||||
+ rg = (struct ralink_gpio_chip *) d->domain->host_data;
|
||||
+
|
||||
+ if (type == IRQ_TYPE_PROBE) {
|
||||
+ if ((rg->rising | rg->falling) & mask)
|
||||
+ return 0;
|
||||
+
|
||||
+ type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
|
||||
+ }
|
||||
+
|
||||
+ if (type & IRQ_TYPE_EDGE_RISING)
|
||||
+ rg->rising |= mask;
|
||||
+ else
|
||||
+ rg->rising &= ~mask;
|
||||
+
|
||||
+ if (type & IRQ_TYPE_EDGE_FALLING)
|
||||
+ rg->falling |= mask;
|
||||
+ else
|
||||
+ rg->falling &= ~mask;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct irq_chip ralink_gpio_irq_chip = {
|
||||
+ .name = "GPIO",
|
||||
+ .irq_unmask = ralink_gpio_irq_unmask,
|
||||
+ .irq_mask = ralink_gpio_irq_mask,
|
||||
+ .irq_mask_ack = ralink_gpio_irq_mask,
|
||||
+ .irq_set_type = ralink_gpio_irq_type,
|
||||
+};
|
||||
+
|
||||
+static int gpio_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
|
||||
+{
|
||||
+ irq_set_chip_and_handler(irq, &ralink_gpio_irq_chip, handle_level_irq);
|
||||
+ irq_set_handler_data(irq, d);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct irq_domain_ops irq_domain_ops = {
|
||||
+ .xlate = irq_domain_xlate_onecell,
|
||||
+ .map = gpio_map,
|
||||
+};
|
||||
+
|
||||
+static void ralink_gpio_irq_init(struct device_node *np,
|
||||
+ struct ralink_gpio_chip *rg)
|
||||
+{
|
||||
+ if (irq_map_count >= MAP_MAX)
|
||||
+ return;
|
||||
+
|
||||
+ rg->irq = irq_of_parse_and_map(np, 0);
|
||||
+ if (!rg->irq)
|
||||
+ return;
|
||||
+
|
||||
+ rg->domain = irq_domain_add_linear(np, rg->chip.ngpio,
|
||||
+ &irq_domain_ops, rg);
|
||||
+ if (!rg->domain) {
|
||||
+ dev_err(rg->chip.dev, "irq_domain_add_linear failed\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ irq_map[irq_map_count++] = rg->domain;
|
||||
+
|
||||
+ rt_gpio_w32(rg, GPIO_REG_RENA, 0x0);
|
||||
+ rt_gpio_w32(rg, GPIO_REG_FENA, 0x0);
|
||||
+
|
||||
+ if (!atomic_read(&irq_refcount))
|
||||
+ irq_set_chained_handler(rg->irq, ralink_gpio_irq_handler);
|
||||
+ atomic_inc(&irq_refcount);
|
||||
+
|
||||
+ dev_info(rg->chip.dev, "registering %d irq handlers\n", rg->chip.ngpio);
|
||||
+}
|
||||
+
|
||||
+static int ralink_gpio_request(struct gpio_chip *chip, unsigned offset)
|
||||
+{
|
||||
+ int gpio = chip->base + offset;
|
||||
+
|
||||
+ return pinctrl_request_gpio(gpio);
|
||||
+}
|
||||
+
|
||||
+static int ralink_gpio_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node;
|
||||
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ struct ralink_gpio_chip *rg;
|
||||
+ const __be32 *ngpio, *gpiobase;
|
||||
+
|
||||
+ if (!res) {
|
||||
+ dev_err(&pdev->dev, "failed to find resource\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ rg = devm_kzalloc(&pdev->dev,
|
||||
+ sizeof(struct ralink_gpio_chip), GFP_KERNEL);
|
||||
+ if (!rg)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ rg->membase = devm_request_and_ioremap(&pdev->dev, res);
|
||||
+ if (!rg->membase) {
|
||||
+ dev_err(&pdev->dev, "cannot remap I/O memory region\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ if (of_property_read_u8_array(np, "ralink,register-map",
|
||||
+ rg->regs, GPIO_REG_MAX)) {
|
||||
+ dev_err(&pdev->dev, "failed to read register definition\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ ngpio = of_get_property(np, "ralink,num-gpios", NULL);
|
||||
+ if (!ngpio) {
|
||||
+ dev_err(&pdev->dev, "failed to read number of pins\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ gpiobase = of_get_property(np, "ralink,gpio-base", NULL);
|
||||
+ if (gpiobase)
|
||||
+ rg->chip.base = be32_to_cpu(*gpiobase);
|
||||
+ else
|
||||
+ rg->chip.base = -1;
|
||||
+
|
||||
+ spin_lock_init(&rg->lock);
|
||||
+
|
||||
+ rg->chip.dev = &pdev->dev;
|
||||
+ rg->chip.label = dev_name(&pdev->dev);
|
||||
+ rg->chip.of_node = np;
|
||||
+ rg->chip.ngpio = be32_to_cpu(*ngpio);
|
||||
+ rg->chip.direction_input = ralink_gpio_direction_input;
|
||||
+ rg->chip.direction_output = ralink_gpio_direction_output;
|
||||
+ rg->chip.get = ralink_gpio_get;
|
||||
+ rg->chip.set = ralink_gpio_set;
|
||||
+ rg->chip.request = ralink_gpio_request;
|
||||
+ rg->chip.to_irq = ralink_gpio_to_irq;
|
||||
+
|
||||
+ /* set polarity to low for all lines */
|
||||
+ rt_gpio_w32(rg, GPIO_REG_POL, 0);
|
||||
+
|
||||
+ dev_info(&pdev->dev, "registering %d gpios\n", rg->chip.ngpio);
|
||||
+
|
||||
+ ralink_gpio_irq_init(np, rg);
|
||||
+
|
||||
+ return gpiochip_add(&rg->chip);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id ralink_gpio_match[] = {
|
||||
+ { .compatible = "ralink,rt2880-gpio" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, ralink_gpio_match);
|
||||
+
|
||||
+static struct platform_driver ralink_gpio_driver = {
|
||||
+ .probe = ralink_gpio_probe,
|
||||
+ .driver = {
|
||||
+ .name = "rt2880_gpio",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = ralink_gpio_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init ralink_gpio_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&ralink_gpio_driver);
|
||||
+}
|
||||
+
|
||||
+subsys_initcall(ralink_gpio_init);
|
|
@ -1,126 +0,0 @@
|
|||
From 4e694014a11a407e309f62c7daade545ba71dcf1 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 13:54:22 +0200
|
||||
Subject: [PATCH 09/25] MIPS: ralink: add support for reset-controller API
|
||||
|
||||
Add a helper for reseting different devices on the SoC.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/Kconfig | 1 +
|
||||
arch/mips/ralink/common.h | 2 ++
|
||||
arch/mips/ralink/of.c | 3 +++
|
||||
arch/mips/ralink/reset.c | 62 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 68 insertions(+)
|
||||
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -374,6 +374,7 @@ config MACH_VR41XX
|
||||
select CSRC_R4K
|
||||
select SYS_HAS_CPU_VR41XX
|
||||
select ARCH_REQUIRE_GPIOLIB
|
||||
+ select ARCH_HAS_RESET_CONTROLLER
|
||||
|
||||
config NXP_STB220
|
||||
bool "NXP STB220 board"
|
||||
--- a/arch/mips/ralink/common.h
|
||||
+++ b/arch/mips/ralink/common.h
|
||||
@@ -46,6 +46,8 @@ extern void ralink_of_remap(void);
|
||||
extern void ralink_clk_init(void);
|
||||
extern void ralink_clk_add(const char *dev, unsigned long rate);
|
||||
|
||||
+extern void ralink_rst_init(void);
|
||||
+
|
||||
extern void prom_soc_init(struct ralink_soc_info *soc_info);
|
||||
|
||||
__iomem void *plat_of_remap_node(const char *node);
|
||||
--- a/arch/mips/ralink/of.c
|
||||
+++ b/arch/mips/ralink/of.c
|
||||
@@ -110,6 +110,9 @@ static int __init plat_of_setup(void)
|
||||
if (of_platform_populate(NULL, of_ids, NULL, NULL))
|
||||
panic("failed to populate DT\n");
|
||||
|
||||
+ /* make sure ithat the reset controller is setup early */
|
||||
+ ralink_rst_init();
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- a/arch/mips/ralink/reset.c
|
||||
+++ b/arch/mips/ralink/reset.c
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include <linux/pm.h>
|
||||
#include <linux/io.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/reset-controller.h>
|
||||
|
||||
#include <asm/reboot.h>
|
||||
|
||||
@@ -19,6 +21,66 @@
|
||||
#define SYSC_REG_RESET_CTRL 0x034
|
||||
#define RSTCTL_RESET_SYSTEM BIT(0)
|
||||
|
||||
+static int ralink_assert_device(struct reset_controller_dev *rcdev,
|
||||
+ unsigned long id)
|
||||
+{
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (id < 8)
|
||||
+ return -1;
|
||||
+
|
||||
+ val = rt_sysc_r32(SYSC_REG_RESET_CTRL);
|
||||
+ val |= BIT(id);
|
||||
+ rt_sysc_w32(val, SYSC_REG_RESET_CTRL);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ralink_deassert_device(struct reset_controller_dev *rcdev,
|
||||
+ unsigned long id)
|
||||
+{
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (id < 8)
|
||||
+ return -1;
|
||||
+
|
||||
+ val = rt_sysc_r32(SYSC_REG_RESET_CTRL);
|
||||
+ val &= ~BIT(id);
|
||||
+ rt_sysc_w32(val, SYSC_REG_RESET_CTRL);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ralink_reset_device(struct reset_controller_dev *rcdev,
|
||||
+ unsigned long id)
|
||||
+{
|
||||
+ ralink_assert_device(rcdev, id);
|
||||
+ return ralink_deassert_device(rcdev, id);
|
||||
+}
|
||||
+
|
||||
+static struct reset_control_ops reset_ops = {
|
||||
+ .reset = ralink_reset_device,
|
||||
+ .assert = ralink_assert_device,
|
||||
+ .deassert = ralink_deassert_device,
|
||||
+};
|
||||
+
|
||||
+static struct reset_controller_dev reset_dev = {
|
||||
+ .ops = &reset_ops,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .nr_resets = 32,
|
||||
+ .of_reset_n_cells = 1,
|
||||
+};
|
||||
+
|
||||
+void ralink_rst_init(void)
|
||||
+{
|
||||
+ reset_dev.of_node = of_find_compatible_node(NULL, NULL,
|
||||
+ "ralink,rt2880-reset");
|
||||
+ if (!reset_dev.of_node)
|
||||
+ pr_err("Failed to find reset controller node");
|
||||
+ else
|
||||
+ reset_controller_register(&reset_dev);
|
||||
+}
|
||||
+
|
||||
static void ralink_restart(char *command)
|
||||
{
|
||||
local_irq_disable();
|
|
@ -1,213 +0,0 @@
|
|||
From 1cd8a1dc8e942bd130dc40ff801f37ad296495e3 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 13:41:04 +0200
|
||||
Subject: [PATCH 10/25] MIPS: ralink: add support for periodic timer irq
|
||||
|
||||
Adds a driver for the periodic timer found on Ralink SoC.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/Makefile | 2 +-
|
||||
arch/mips/ralink/timer.c | 185 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 186 insertions(+), 1 deletion(-)
|
||||
create mode 100644 arch/mips/ralink/timer.c
|
||||
|
||||
--- a/arch/mips/ralink/Makefile
|
||||
+++ b/arch/mips/ralink/Makefile
|
||||
@@ -6,7 +6,7 @@
|
||||
# Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
# Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
|
||||
-obj-y := prom.o of.o reset.o clk.o irq.o
|
||||
+obj-y := prom.o of.o reset.o clk.o irq.o timer.o
|
||||
|
||||
obj-$(CONFIG_SOC_RT288X) += rt288x.o
|
||||
obj-$(CONFIG_SOC_RT305X) += rt305x.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/ralink/timer.c
|
||||
@@ -0,0 +1,185 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+*/
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/timer.h>
|
||||
+#include <linux/of_gpio.h>
|
||||
+#include <linux/clk.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/ralink_regs.h>
|
||||
+
|
||||
+#define TIMER_REG_TMRSTAT 0x00
|
||||
+#define TIMER_REG_TMR0LOAD 0x10
|
||||
+#define TIMER_REG_TMR0CTL 0x18
|
||||
+
|
||||
+#define TMRSTAT_TMR0INT BIT(0)
|
||||
+
|
||||
+#define TMR0CTL_ENABLE BIT(7)
|
||||
+#define TMR0CTL_MODE_PERIODIC BIT(4)
|
||||
+#define TMR0CTL_PRESCALER 1
|
||||
+#define TMR0CTL_PRESCALE_VAL (0xf - TMR0CTL_PRESCALER)
|
||||
+#define TMR0CTL_PRESCALE_DIV (65536 / BIT(TMR0CTL_PRESCALER))
|
||||
+
|
||||
+struct rt_timer {
|
||||
+ struct device *dev;
|
||||
+ void __iomem *membase;
|
||||
+ int irq;
|
||||
+ unsigned long timer_freq;
|
||||
+ unsigned long timer_div;
|
||||
+};
|
||||
+
|
||||
+static inline void rt_timer_w32(struct rt_timer *rt, u8 reg, u32 val)
|
||||
+{
|
||||
+ __raw_writel(val, rt->membase + reg);
|
||||
+}
|
||||
+
|
||||
+static inline u32 rt_timer_r32(struct rt_timer *rt, u8 reg)
|
||||
+{
|
||||
+ return __raw_readl(rt->membase + reg);
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t rt_timer_irq(int irq, void *_rt)
|
||||
+{
|
||||
+ struct rt_timer *rt = (struct rt_timer *) _rt;
|
||||
+
|
||||
+ rt_timer_w32(rt, TIMER_REG_TMR0LOAD, rt->timer_freq / rt->timer_div);
|
||||
+ rt_timer_w32(rt, TIMER_REG_TMRSTAT, TMRSTAT_TMR0INT);
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int rt_timer_request(struct rt_timer *rt)
|
||||
+{
|
||||
+ int err = request_irq(rt->irq, rt_timer_irq, IRQF_DISABLED,
|
||||
+ dev_name(rt->dev), rt);
|
||||
+ if (err) {
|
||||
+ dev_err(rt->dev, "failed to request irq\n");
|
||||
+ } else {
|
||||
+ u32 t = TMR0CTL_MODE_PERIODIC | TMR0CTL_PRESCALE_VAL;
|
||||
+ rt_timer_w32(rt, TIMER_REG_TMR0CTL, t);
|
||||
+ }
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static void rt_timer_free(struct rt_timer *rt)
|
||||
+{
|
||||
+ free_irq(rt->irq, rt);
|
||||
+}
|
||||
+
|
||||
+static int rt_timer_config(struct rt_timer *rt, unsigned long divisor)
|
||||
+{
|
||||
+ if (rt->timer_freq < divisor)
|
||||
+ rt->timer_div = rt->timer_freq;
|
||||
+ else
|
||||
+ rt->timer_div = divisor;
|
||||
+
|
||||
+ rt_timer_w32(rt, TIMER_REG_TMR0LOAD, rt->timer_freq / rt->timer_div);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt_timer_enable(struct rt_timer *rt)
|
||||
+{
|
||||
+ u32 t;
|
||||
+
|
||||
+ rt_timer_w32(rt, TIMER_REG_TMR0LOAD, rt->timer_freq / rt->timer_div);
|
||||
+
|
||||
+ t = rt_timer_r32(rt, TIMER_REG_TMR0CTL);
|
||||
+ t |= TMR0CTL_ENABLE;
|
||||
+ rt_timer_w32(rt, TIMER_REG_TMR0CTL, t);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void rt_timer_disable(struct rt_timer *rt)
|
||||
+{
|
||||
+ u32 t;
|
||||
+
|
||||
+ t = rt_timer_r32(rt, TIMER_REG_TMR0CTL);
|
||||
+ t &= ~TMR0CTL_ENABLE;
|
||||
+ rt_timer_w32(rt, TIMER_REG_TMR0CTL, t);
|
||||
+}
|
||||
+
|
||||
+static int rt_timer_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ struct rt_timer *rt;
|
||||
+ struct clk *clk;
|
||||
+
|
||||
+ rt = devm_kzalloc(&pdev->dev, sizeof(*rt), GFP_KERNEL);
|
||||
+ if (!rt) {
|
||||
+ dev_err(&pdev->dev, "failed to allocate memory\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ rt->irq = platform_get_irq(pdev, 0);
|
||||
+ if (!rt->irq) {
|
||||
+ dev_err(&pdev->dev, "failed to load irq\n");
|
||||
+ return -ENOENT;
|
||||
+ }
|
||||
+
|
||||
+ rt->membase = devm_request_and_ioremap(&pdev->dev, res);
|
||||
+ if (IS_ERR(rt->membase))
|
||||
+ return PTR_ERR(rt->membase);
|
||||
+
|
||||
+ clk = devm_clk_get(&pdev->dev, NULL);
|
||||
+ if (IS_ERR(clk)) {
|
||||
+ dev_err(&pdev->dev, "failed get clock rate\n");
|
||||
+ return PTR_ERR(clk);
|
||||
+ }
|
||||
+
|
||||
+ rt->timer_freq = clk_get_rate(clk) / TMR0CTL_PRESCALE_DIV;
|
||||
+ if (!rt->timer_freq)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ rt->dev = &pdev->dev;
|
||||
+ platform_set_drvdata(pdev, rt);
|
||||
+
|
||||
+ rt_timer_request(rt);
|
||||
+ rt_timer_config(rt, 2);
|
||||
+ rt_timer_enable(rt);
|
||||
+
|
||||
+ dev_info(&pdev->dev, "maximum frequncy is %luHz\n", rt->timer_freq);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt_timer_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct rt_timer *rt = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ rt_timer_disable(rt);
|
||||
+ rt_timer_free(rt);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id rt_timer_match[] = {
|
||||
+ { .compatible = "ralink,rt2880-timer" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rt_timer_match);
|
||||
+
|
||||
+static struct platform_driver rt_timer_driver = {
|
||||
+ .probe = rt_timer_probe,
|
||||
+ .remove = rt_timer_remove,
|
||||
+ .driver = {
|
||||
+ .name = "rt-timer",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = rt_timer_match
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(rt_timer_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Ralink RT2880 timer");
|
||||
+MODULE_AUTHOR("John Crispin <blogic@openwrt.org");
|
||||
+MODULE_LICENSE("GPL");
|
|
@ -1,192 +0,0 @@
|
|||
From 3b511d972b556712f89ccc68825c0ec8f398dc5c Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 13:46:09 +0200
|
||||
Subject: [PATCH 11/25] MIPS: ralink: add support for systick timer found on
|
||||
newer ralink SoC
|
||||
|
||||
Newer Ralink SoC (MT7620x and RT5350) have a 50KHz clock that runs independent
|
||||
of the SoC master clock. If we want to automatic frequency scaling to work we
|
||||
need to use the systick timer as the clock source.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/Kconfig | 7 ++
|
||||
arch/mips/ralink/Makefile | 2 +
|
||||
arch/mips/ralink/cevt-rt3352.c | 145 ++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 154 insertions(+)
|
||||
create mode 100644 arch/mips/ralink/cevt-rt3352.c
|
||||
|
||||
--- a/arch/mips/ralink/Kconfig
|
||||
+++ b/arch/mips/ralink/Kconfig
|
||||
@@ -1,5 +1,12 @@
|
||||
if RALINK
|
||||
|
||||
+config CLKEVT_RT3352
|
||||
+ bool "Systick Clockevent source"
|
||||
+ depends on SOC_RT305X || SOC_MT7620
|
||||
+ default y
|
||||
+ select CLKSRC_OF
|
||||
+ select CLKSRC_MMIO
|
||||
+
|
||||
choice
|
||||
prompt "Ralink SoC selection"
|
||||
default SOC_RT305X
|
||||
--- a/arch/mips/ralink/Makefile
|
||||
+++ b/arch/mips/ralink/Makefile
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
obj-y := prom.o of.o reset.o clk.o irq.o timer.o
|
||||
|
||||
+obj-$(CONFIG_CLKEVT_RT3352) += cevt-rt3352.o
|
||||
+
|
||||
obj-$(CONFIG_SOC_RT288X) += rt288x.o
|
||||
obj-$(CONFIG_SOC_RT305X) += rt305x.o
|
||||
obj-$(CONFIG_SOC_RT3883) += rt3883.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/ralink/cevt-rt3352.c
|
||||
@@ -0,0 +1,145 @@
|
||||
+/*
|
||||
+ * 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) 2013 by John Crispin <blogic@openwrt.org>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/clockchips.h>
|
||||
+#include <linux/clocksource.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/reset.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/time.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/of_irq.h>
|
||||
+#include <linux/of_address.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/ralink_regs.h>
|
||||
+
|
||||
+#define SYSTICK_FREQ (50 * 1000)
|
||||
+
|
||||
+#define SYSTICK_CONFIG 0x00
|
||||
+#define SYSTICK_COMPARE 0x04
|
||||
+#define SYSTICK_COUNT 0x08
|
||||
+
|
||||
+/* route systick irq to mips irq 7 instead of the r4k-timer */
|
||||
+#define CFG_EXT_STK_EN 0x2
|
||||
+/* enable the counter */
|
||||
+#define CFG_CNT_EN 0x1
|
||||
+
|
||||
+struct systick_device {
|
||||
+ void __iomem *membase;
|
||||
+ struct clock_event_device dev;
|
||||
+ int irq_requested;
|
||||
+ int freq_scale;
|
||||
+};
|
||||
+
|
||||
+static void systick_set_clock_mode(enum clock_event_mode mode,
|
||||
+ struct clock_event_device *evt);
|
||||
+
|
||||
+static int systick_next_event(unsigned long delta,
|
||||
+ struct clock_event_device *evt)
|
||||
+{
|
||||
+ struct systick_device *sdev;
|
||||
+ u32 count;
|
||||
+
|
||||
+ sdev = container_of(evt, struct systick_device, dev);
|
||||
+ count = ioread32(sdev->membase + SYSTICK_COUNT);
|
||||
+ count = (count + delta) % SYSTICK_FREQ;
|
||||
+ iowrite32(count + delta, sdev->membase + SYSTICK_COMPARE);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void systick_event_handler(struct clock_event_device *dev)
|
||||
+{
|
||||
+ /* noting to do here */
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t systick_interrupt(int irq, void *dev_id)
|
||||
+{
|
||||
+ struct clock_event_device *dev = (struct clock_event_device *) dev_id;
|
||||
+
|
||||
+ dev->event_handler(dev);
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static struct systick_device systick = {
|
||||
+ .dev = {
|
||||
+ /*
|
||||
+ * cevt-r4k uses 300, make sure systick
|
||||
+ * gets used if available
|
||||
+ */
|
||||
+ .rating = 310,
|
||||
+ .features = CLOCK_EVT_FEAT_ONESHOT,
|
||||
+ .set_next_event = systick_next_event,
|
||||
+ .set_mode = systick_set_clock_mode,
|
||||
+ .event_handler = systick_event_handler,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static struct irqaction systick_irqaction = {
|
||||
+ .handler = systick_interrupt,
|
||||
+ .flags = IRQF_PERCPU | IRQF_TIMER,
|
||||
+ .dev_id = &systick.dev,
|
||||
+};
|
||||
+
|
||||
+static void systick_set_clock_mode(enum clock_event_mode mode,
|
||||
+ struct clock_event_device *evt)
|
||||
+{
|
||||
+ struct systick_device *sdev;
|
||||
+
|
||||
+ sdev = container_of(evt, struct systick_device, dev);
|
||||
+
|
||||
+ switch (mode) {
|
||||
+ case CLOCK_EVT_MODE_ONESHOT:
|
||||
+ if (!sdev->irq_requested)
|
||||
+ setup_irq(systick.dev.irq, &systick_irqaction);
|
||||
+ sdev->irq_requested = 1;
|
||||
+ iowrite32(CFG_EXT_STK_EN | CFG_CNT_EN,
|
||||
+ systick.membase + SYSTICK_CONFIG);
|
||||
+ break;
|
||||
+
|
||||
+ case CLOCK_EVT_MODE_SHUTDOWN:
|
||||
+ if (sdev->irq_requested)
|
||||
+ free_irq(systick.dev.irq, &systick_irqaction);
|
||||
+ sdev->irq_requested = 0;
|
||||
+ iowrite32(0, systick.membase + SYSTICK_CONFIG);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ pr_err("%s: Unhandeled mips clock_mode\n", systick.dev.name);
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void __init ralink_systick_init(struct device_node *np)
|
||||
+{
|
||||
+ systick.membase = of_iomap(np, 0);
|
||||
+ if (!systick.membase)
|
||||
+ return;
|
||||
+
|
||||
+ systick_irqaction.name = np->name;
|
||||
+ systick.dev.name = np->name;
|
||||
+ clockevents_calc_mult_shift(&systick.dev, SYSTICK_FREQ, 60);
|
||||
+ systick.dev.max_delta_ns = clockevent_delta2ns(0x7fff, &systick.dev);
|
||||
+ systick.dev.min_delta_ns = clockevent_delta2ns(0x3, &systick.dev);
|
||||
+ systick.dev.irq = irq_of_parse_and_map(np, 0);
|
||||
+ if (!systick.dev.irq) {
|
||||
+ pr_err("%s: request_irq failed", np->name);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ clocksource_mmio_init(systick.membase + SYSTICK_COUNT, np->name,
|
||||
+ SYSTICK_FREQ, 301, 16, clocksource_mmio_readl_up);
|
||||
+
|
||||
+ clockevents_register_device(&systick.dev);
|
||||
+
|
||||
+ pr_info("%s: runing - mult: %d, shift: %d\n",
|
||||
+ np->name, systick.dev.mult, systick.dev.shift);
|
||||
+}
|
||||
+
|
||||
+CLOCKSOURCE_OF_DECLARE(systick, "ralink,cevt-systick", ralink_systick_init);
|
|
@ -1,21 +0,0 @@
|
|||
From c4d6a957efb0c8d919302598ae547bde05137461 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 13:48:39 +0200
|
||||
Subject: [PATCH 12/25] MIPS: ralink: probe clocksources from OF
|
||||
|
||||
Make plat_time_init() call clocksource_of_init() allowing the systick cevt
|
||||
to load.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/clk.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/arch/mips/ralink/clk.c
|
||||
+++ b/arch/mips/ralink/clk.c
|
||||
@@ -69,4 +69,5 @@ void __init plat_time_init(void)
|
||||
pr_info("CPU Clock: %ldMHz\n", clk_get_rate(clk) / 1000000);
|
||||
mips_hpt_frequency = clk_get_rate(clk) / 2;
|
||||
clk_put(clk);
|
||||
+ clocksource_of_init();
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
From 2d17c793a9cd3f67351d1a15c099ef2464e81f47 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Mon, 20 May 2013 20:30:11 +0200
|
||||
Subject: [PATCH 13/25] MIPS: ralink: mt7620: add verbose ram info
|
||||
|
||||
Make the code print which of SDRAM, DDR1 or DDR2 was detected.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/mt7620.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/arch/mips/ralink/mt7620.c
|
||||
+++ b/arch/mips/ralink/mt7620.c
|
||||
@@ -214,16 +214,19 @@ void prom_soc_init(struct ralink_soc_inf
|
||||
|
||||
switch (dram_type) {
|
||||
case SYSCFG0_DRAM_TYPE_SDRAM:
|
||||
+ pr_info("Board has SDRAM\n");
|
||||
soc_info->mem_size_min = MT7620_SDRAM_SIZE_MIN;
|
||||
soc_info->mem_size_max = MT7620_SDRAM_SIZE_MAX;
|
||||
break;
|
||||
|
||||
case SYSCFG0_DRAM_TYPE_DDR1:
|
||||
+ pr_info("Board has DDR1\n");
|
||||
soc_info->mem_size_min = MT7620_DDR1_SIZE_MIN;
|
||||
soc_info->mem_size_max = MT7620_DDR1_SIZE_MAX;
|
||||
break;
|
||||
|
||||
case SYSCFG0_DRAM_TYPE_DDR2:
|
||||
+ pr_info("Board has DDR2\n");
|
||||
soc_info->mem_size_min = MT7620_DDR2_SIZE_MIN;
|
||||
soc_info->mem_size_max = MT7620_DDR2_SIZE_MAX;
|
||||
break;
|
|
@ -1,22 +0,0 @@
|
|||
From d0da9f08ef37e9f639e3b7995d722684da2410a2 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Thu, 23 May 2013 18:46:25 +0200
|
||||
Subject: [PATCH 14/25] MIPS: ralink: mt7620: add spi clock definition
|
||||
|
||||
The definition of the spi clock is missing.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/mt7620.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/arch/mips/ralink/mt7620.c
|
||||
+++ b/arch/mips/ralink/mt7620.c
|
||||
@@ -167,6 +167,7 @@ void __init ralink_clk_init(void)
|
||||
ralink_clk_add("cpu", cpu_rate);
|
||||
ralink_clk_add("10000100.timer", 40000000);
|
||||
ralink_clk_add("10000500.uart", 40000000);
|
||||
+ ralink_clk_add("10000b00.spi", 40000000);
|
||||
ralink_clk_add("10000c00.uartlite", 40000000);
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
From 51db62f58431d9a89c55f59f98879829dcfddcaf Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 13:50:11 +0200
|
||||
Subject: [PATCH 15/25] MIPS: ralink: mt7620: add wdt clock definition
|
||||
|
||||
The definition of the wdt clock is missing.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/mt7620.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/arch/mips/ralink/mt7620.c
|
||||
+++ b/arch/mips/ralink/mt7620.c
|
||||
@@ -166,6 +166,7 @@ void __init ralink_clk_init(void)
|
||||
|
||||
ralink_clk_add("cpu", cpu_rate);
|
||||
ralink_clk_add("10000100.timer", 40000000);
|
||||
+ ralink_clk_add("10000120.watchdog", 40000000);
|
||||
ralink_clk_add("10000500.uart", 40000000);
|
||||
ralink_clk_add("10000b00.spi", 40000000);
|
||||
ralink_clk_add("10000c00.uartlite", 40000000);
|
|
@ -1,63 +0,0 @@
|
|||
From 011f4bdba0dd4d1dff6d33b1a65541fc4f09c78e Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Fri, 24 May 2013 21:28:08 +0200
|
||||
Subject: [PATCH 16/25] MIPS: ralink: mt7620: fix usb issue during frequency
|
||||
scaling
|
||||
|
||||
If the USB HCD is running and the cpu is scaled too low, then the USB stops
|
||||
working. Increase the idle speed of the core to fix this if the kernel is
|
||||
built with USB support.
|
||||
|
||||
The values are taken from the Ralink SDK Kernel.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/include/asm/mach-ralink/mt7620.h | 1 +
|
||||
arch/mips/ralink/mt7620.c | 19 +++++++++++++++++++
|
||||
2 files changed, 20 insertions(+)
|
||||
|
||||
--- a/arch/mips/include/asm/mach-ralink/mt7620.h
|
||||
+++ b/arch/mips/include/asm/mach-ralink/mt7620.h
|
||||
@@ -20,6 +20,7 @@
|
||||
#define SYSC_REG_CHIP_REV 0x0c
|
||||
#define SYSC_REG_SYSTEM_CONFIG0 0x10
|
||||
#define SYSC_REG_SYSTEM_CONFIG1 0x14
|
||||
+#define SYSC_REG_CPU_SYS_CLKCFG 0x3c
|
||||
#define SYSC_REG_CPLL_CONFIG0 0x54
|
||||
#define SYSC_REG_CPLL_CONFIG1 0x58
|
||||
|
||||
--- a/arch/mips/ralink/mt7620.c
|
||||
+++ b/arch/mips/ralink/mt7620.c
|
||||
@@ -20,6 +20,12 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
+/* clock scaling */
|
||||
+#define CLKCFG_FDIV_MASK 0x1f00
|
||||
+#define CLKCFG_FDIV_USB_VAL 0x0300
|
||||
+#define CLKCFG_FFRAC_MASK 0x001f
|
||||
+#define CLKCFG_FFRAC_USB_VAL 0x0003
|
||||
+
|
||||
/* does the board have sdram or ddram */
|
||||
static int dram_type;
|
||||
|
||||
@@ -170,6 +176,19 @@ void __init ralink_clk_init(void)
|
||||
ralink_clk_add("10000500.uart", 40000000);
|
||||
ralink_clk_add("10000b00.spi", 40000000);
|
||||
ralink_clk_add("10000c00.uartlite", 40000000);
|
||||
+
|
||||
+ if (IS_ENABLED(CONFIG_USB)) {
|
||||
+ /*
|
||||
+ * When the CPU goes into sleep mode, the BUS clock will be too low for
|
||||
+ * USB to function properly
|
||||
+ */
|
||||
+ u32 val = rt_sysc_r32(SYSC_REG_CPU_SYS_CLKCFG);
|
||||
+
|
||||
+ val &= ~(CLKCFG_FDIV_MASK | CLKCFG_FFRAC_MASK);
|
||||
+ val |= CLKCFG_FDIV_USB_VAL | CLKCFG_FFRAC_USB_VAL;
|
||||
+
|
||||
+ rt_sysc_w32(val, SYSC_REG_CPU_SYS_CLKCFG);
|
||||
+ }
|
||||
}
|
||||
|
||||
void __init ralink_of_remap(void)
|
|
@ -1,23 +0,0 @@
|
|||
From c16c0b66594cb0be44e150dbe3fda747817b873d Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 17:50:53 +0200
|
||||
Subject: [PATCH 17/25] MIPS: ralink: mt7620: this SoC has ehci and ohci hosts
|
||||
|
||||
Select the the EHCI and OHCI symbols.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/Kconfig | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/arch/mips/ralink/Kconfig
|
||||
+++ b/arch/mips/ralink/Kconfig
|
||||
@@ -29,6 +29,8 @@ choice
|
||||
|
||||
config SOC_MT7620
|
||||
bool "MT7620"
|
||||
+ select USB_ARCH_HAS_OHCI
|
||||
+ select USB_ARCH_HAS_EHCI
|
||||
|
||||
endchoice
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
From c464a54f9a4a959d09206583b11ae99740e0f267 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Fri, 9 Aug 2013 20:12:59 +0200
|
||||
Subject: [PATCH 18/25] DT: Add documentation for spi-rt2880
|
||||
|
||||
Describe the SPI master found on the MIPS based Ralink RT2880 SoC.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
.../devicetree/bindings/spi/spi-rt2880.txt | 28 ++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/spi/spi-rt2880.txt
|
||||
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/spi/spi-rt2880.txt
|
||||
@@ -0,0 +1,28 @@
|
||||
+Ralink SoC RT2880 SPI master controller.
|
||||
+
|
||||
+This SPI controller is found on most wireless SoCs made by ralink.
|
||||
+
|
||||
+Required properties:
|
||||
+- compatible : "ralink,rt2880-spi"
|
||||
+- reg : The register base for the controller.
|
||||
+- #address-cells : <1>, as required by generic SPI binding.
|
||||
+- #size-cells : <0>, also as required by generic SPI binding.
|
||||
+
|
||||
+Child nodes as per the generic SPI binding.
|
||||
+
|
||||
+Example:
|
||||
+
|
||||
+ spi@b00 {
|
||||
+ compatible = "ralink,rt2880-spi";
|
||||
+ reg = <0xb00 0x100>;
|
||||
+
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ m25p80@0 {
|
||||
+ compatible = "m25p80";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <10000000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
|
@ -1,476 +0,0 @@
|
|||
From 43c36279a0e822de608c1e825826bbac3238d8a2 Mon Sep 17 00:00:00 2001
|
||||
From: Gabor Juhos <juhosg@openwrt.org>
|
||||
Date: Mon, 22 Apr 2013 23:16:18 +0200
|
||||
Subject: [PATCH 19/25] SPI: ralink: add Ralink SoC spi driver
|
||||
|
||||
Add the driver needed to make SPI work on Ralink SoC.
|
||||
|
||||
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
Acked-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/spi/Kconfig | 6 +
|
||||
drivers/spi/Makefile | 1 +
|
||||
drivers/spi/spi-rt2880.c | 450 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 457 insertions(+)
|
||||
create mode 100644 drivers/spi/spi-rt2880.c
|
||||
|
||||
--- a/drivers/spi/Kconfig
|
||||
+++ b/drivers/spi/Kconfig
|
||||
@@ -354,6 +354,12 @@ config SPI_RSPI
|
||||
help
|
||||
SPI driver for Renesas RSPI blocks.
|
||||
|
||||
+config SPI_RT2880
|
||||
+ tristate "Ralink RT288x SPI Controller"
|
||||
+ depends on RALINK
|
||||
+ help
|
||||
+ This selects a driver for the Ralink RT288x/RT305x SPI Controller.
|
||||
+
|
||||
config SPI_S3C24XX
|
||||
tristate "Samsung S3C24XX series SPI"
|
||||
depends on ARCH_S3C24XX
|
||||
--- a/drivers/spi/Makefile
|
||||
+++ b/drivers/spi/Makefile
|
||||
@@ -56,6 +56,7 @@ spi-pxa2xx-platform-$(CONFIG_SPI_PXA2XX_
|
||||
obj-$(CONFIG_SPI_PXA2XX) += spi-pxa2xx-platform.o
|
||||
obj-$(CONFIG_SPI_PXA2XX_PCI) += spi-pxa2xx-pci.o
|
||||
obj-$(CONFIG_SPI_RSPI) += spi-rspi.o
|
||||
+obj-$(CONFIG_SPI_RT2880) += spi-rt2880.o
|
||||
obj-$(CONFIG_SPI_S3C24XX) += spi-s3c24xx-hw.o
|
||||
spi-s3c24xx-hw-y := spi-s3c24xx.o
|
||||
spi-s3c24xx-hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi-s3c24xx-fiq.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/spi/spi-rt2880.c
|
||||
@@ -0,0 +1,432 @@
|
||||
+/*
|
||||
+ * spi-rt2880.c -- Ralink RT288x/RT305x SPI controller driver
|
||||
+ *
|
||||
+ * Copyright (C) 2011 Sergiy <piratfm@gmail.com>
|
||||
+ * Copyright (C) 2011-2013 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ *
|
||||
+ * Some parts are based on spi-orion.c:
|
||||
+ * Author: Shadi Ammouri <shadi@marvell.com>
|
||||
+ * Copyright (C) 2007-2008 Marvell Ltd.
|
||||
+ *
|
||||
+ * 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/init.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/reset.h>
|
||||
+#include <linux/spi/spi.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+#define DRIVER_NAME "spi-rt2880"
|
||||
+/* only one slave is supported*/
|
||||
+#define RALINK_NUM_CHIPSELECTS 1
|
||||
+/* in usec */
|
||||
+#define RALINK_SPI_WAIT_MAX_LOOP 2000
|
||||
+
|
||||
+#define RAMIPS_SPI_STAT 0x00
|
||||
+#define RAMIPS_SPI_CFG 0x10
|
||||
+#define RAMIPS_SPI_CTL 0x14
|
||||
+#define RAMIPS_SPI_DATA 0x20
|
||||
+#define RAMIPS_SPI_FIFO_STAT 0x38
|
||||
+
|
||||
+/* SPISTAT register bit field */
|
||||
+#define SPISTAT_BUSY BIT(0)
|
||||
+
|
||||
+/* SPICFG register bit field */
|
||||
+#define SPICFG_LSBFIRST 0
|
||||
+#define SPICFG_MSBFIRST BIT(8)
|
||||
+#define SPICFG_SPICLKPOL BIT(6)
|
||||
+#define SPICFG_RXCLKEDGE_FALLING BIT(5)
|
||||
+#define SPICFG_TXCLKEDGE_FALLING BIT(4)
|
||||
+#define SPICFG_SPICLK_PRESCALE_MASK 0x7
|
||||
+#define SPICFG_SPICLK_DIV2 0
|
||||
+#define SPICFG_SPICLK_DIV4 1
|
||||
+#define SPICFG_SPICLK_DIV8 2
|
||||
+#define SPICFG_SPICLK_DIV16 3
|
||||
+#define SPICFG_SPICLK_DIV32 4
|
||||
+#define SPICFG_SPICLK_DIV64 5
|
||||
+#define SPICFG_SPICLK_DIV128 6
|
||||
+#define SPICFG_SPICLK_DISABLE 7
|
||||
+
|
||||
+/* SPICTL register bit field */
|
||||
+#define SPICTL_HIZSDO BIT(3)
|
||||
+#define SPICTL_STARTWR BIT(2)
|
||||
+#define SPICTL_STARTRD BIT(1)
|
||||
+#define SPICTL_SPIENA BIT(0)
|
||||
+
|
||||
+/* SPIFIFOSTAT register bit field */
|
||||
+#define SPIFIFOSTAT_TXFULL BIT(17)
|
||||
+
|
||||
+struct rt2880_spi {
|
||||
+ struct spi_master *master;
|
||||
+ void __iomem *base;
|
||||
+ unsigned int sys_freq;
|
||||
+ unsigned int speed;
|
||||
+ struct clk *clk;
|
||||
+ spinlock_t lock;
|
||||
+};
|
||||
+
|
||||
+static inline struct rt2880_spi *spidev_to_rt2880_spi(struct spi_device *spi)
|
||||
+{
|
||||
+ return spi_master_get_devdata(spi->master);
|
||||
+}
|
||||
+
|
||||
+static inline u32 rt2880_spi_read(struct rt2880_spi *rs, u32 reg)
|
||||
+{
|
||||
+ return ioread32(rs->base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline void rt2880_spi_write(struct rt2880_spi *rs, u32 reg, u32 val)
|
||||
+{
|
||||
+ iowrite32(val, rs->base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline void rt2880_spi_setbits(struct rt2880_spi *rs, u32 reg, u32 mask)
|
||||
+{
|
||||
+ void __iomem *addr = rs->base + reg;
|
||||
+ unsigned long flags;
|
||||
+ u32 val;
|
||||
+
|
||||
+ spin_lock_irqsave(&rs->lock, flags);
|
||||
+ val = ioread32(addr);
|
||||
+ val |= mask;
|
||||
+ iowrite32(val, addr);
|
||||
+ spin_unlock_irqrestore(&rs->lock, flags);
|
||||
+}
|
||||
+
|
||||
+static inline void rt2880_spi_clrbits(struct rt2880_spi *rs, u32 reg, u32 mask)
|
||||
+{
|
||||
+ void __iomem *addr = rs->base + reg;
|
||||
+ unsigned long flags;
|
||||
+ u32 val;
|
||||
+
|
||||
+ spin_lock_irqsave(&rs->lock, flags);
|
||||
+ val = ioread32(addr);
|
||||
+ val &= ~mask;
|
||||
+ iowrite32(val, addr);
|
||||
+ spin_unlock_irqrestore(&rs->lock, flags);
|
||||
+}
|
||||
+
|
||||
+static int rt2880_spi_baudrate_set(struct spi_device *spi, unsigned int speed)
|
||||
+{
|
||||
+ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
+ u32 rate;
|
||||
+ u32 prescale;
|
||||
+ u32 reg;
|
||||
+
|
||||
+ dev_dbg(&spi->dev, "speed:%u\n", speed);
|
||||
+
|
||||
+ /*
|
||||
+ * the supported rates are: 2, 4, 8, ... 128
|
||||
+ * round up as we look for equal or less speed
|
||||
+ */
|
||||
+ rate = DIV_ROUND_UP(rs->sys_freq, speed);
|
||||
+ dev_dbg(&spi->dev, "rate-1:%u\n", rate);
|
||||
+ rate = roundup_pow_of_two(rate);
|
||||
+ dev_dbg(&spi->dev, "rate-2:%u\n", rate);
|
||||
+
|
||||
+ /* check if requested speed is too small */
|
||||
+ if (rate > 128)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (rate < 2)
|
||||
+ rate = 2;
|
||||
+
|
||||
+ /* Convert the rate to SPI clock divisor value. */
|
||||
+ prescale = ilog2(rate / 2);
|
||||
+ dev_dbg(&spi->dev, "prescale:%u\n", prescale);
|
||||
+
|
||||
+ reg = rt2880_spi_read(rs, RAMIPS_SPI_CFG);
|
||||
+ reg = ((reg & ~SPICFG_SPICLK_PRESCALE_MASK) | prescale);
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_CFG, reg);
|
||||
+ rs->speed = speed;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * called only when no transfer is active on the bus
|
||||
+ */
|
||||
+static int
|
||||
+rt2880_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
|
||||
+{
|
||||
+ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
+ unsigned int speed = spi->max_speed_hz;
|
||||
+ int rc;
|
||||
+
|
||||
+ if ((t != NULL) && t->speed_hz)
|
||||
+ speed = t->speed_hz;
|
||||
+
|
||||
+ if (rs->speed != speed) {
|
||||
+ dev_dbg(&spi->dev, "speed_hz:%u\n", speed);
|
||||
+ rc = rt2880_spi_baudrate_set(spi, speed);
|
||||
+ if (rc)
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void rt2880_spi_set_cs(struct rt2880_spi *rs, int enable)
|
||||
+{
|
||||
+ if (enable)
|
||||
+ rt2880_spi_clrbits(rs, RAMIPS_SPI_CTL, SPICTL_SPIENA);
|
||||
+ else
|
||||
+ rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_SPIENA);
|
||||
+}
|
||||
+
|
||||
+static inline int rt2880_spi_wait_till_ready(struct rt2880_spi *rs)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < RALINK_SPI_WAIT_MAX_LOOP; i++) {
|
||||
+ u32 status;
|
||||
+
|
||||
+ status = rt2880_spi_read(rs, RAMIPS_SPI_STAT);
|
||||
+ if ((status & SPISTAT_BUSY) == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ cpu_relax();
|
||||
+ udelay(1);
|
||||
+ }
|
||||
+
|
||||
+ return -ETIMEDOUT;
|
||||
+}
|
||||
+
|
||||
+static unsigned int
|
||||
+rt2880_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
|
||||
+{
|
||||
+ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
+ unsigned count = 0;
|
||||
+ u8 *rx = xfer->rx_buf;
|
||||
+ const u8 *tx = xfer->tx_buf;
|
||||
+ int err;
|
||||
+
|
||||
+ dev_dbg(&spi->dev, "read (%d): %s %s\n", xfer->len,
|
||||
+ (tx != NULL) ? "tx" : " ",
|
||||
+ (rx != NULL) ? "rx" : " ");
|
||||
+
|
||||
+ if (tx) {
|
||||
+ for (count = 0; count < xfer->len; count++) {
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_DATA, tx[count]);
|
||||
+ rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_STARTWR);
|
||||
+ err = rt2880_spi_wait_till_ready(rs);
|
||||
+ if (err) {
|
||||
+ dev_err(&spi->dev, "TX failed, err=%d\n", err);
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (rx) {
|
||||
+ for (count = 0; count < xfer->len; count++) {
|
||||
+ rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_STARTRD);
|
||||
+ err = rt2880_spi_wait_till_ready(rs);
|
||||
+ if (err) {
|
||||
+ dev_err(&spi->dev, "RX failed, err=%d\n", err);
|
||||
+ goto out;
|
||||
+ }
|
||||
+ rx[count] = (u8) rt2880_spi_read(rs, RAMIPS_SPI_DATA);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ return count;
|
||||
+}
|
||||
+
|
||||
+static int rt2880_spi_transfer_one_message(struct spi_master *master,
|
||||
+ struct spi_message *m)
|
||||
+{
|
||||
+ struct rt2880_spi *rs = spi_master_get_devdata(master);
|
||||
+ struct spi_device *spi = m->spi;
|
||||
+ struct spi_transfer *t = NULL;
|
||||
+ int par_override = 0;
|
||||
+ int status = 0;
|
||||
+ int cs_active = 0;
|
||||
+
|
||||
+ /* Load defaults */
|
||||
+ status = rt2880_spi_setup_transfer(spi, NULL);
|
||||
+ if (status < 0)
|
||||
+ goto msg_done;
|
||||
+
|
||||
+ list_for_each_entry(t, &m->transfers, transfer_list) {
|
||||
+ if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) {
|
||||
+ dev_err(&spi->dev,
|
||||
+ "message rejected: invalid transfer data buffers\n");
|
||||
+ status = -EIO;
|
||||
+ goto msg_done;
|
||||
+ }
|
||||
+
|
||||
+ if (t->speed_hz && t->speed_hz < (rs->sys_freq / 128)) {
|
||||
+ dev_err(&spi->dev,
|
||||
+ "message rejected: device min speed (%d Hz) exceeds required transfer speed (%d Hz)\n",
|
||||
+ (rs->sys_freq / 128), t->speed_hz);
|
||||
+ status = -EIO;
|
||||
+ goto msg_done;
|
||||
+ }
|
||||
+
|
||||
+ if (par_override || t->speed_hz || t->bits_per_word) {
|
||||
+ par_override = 1;
|
||||
+ status = rt2880_spi_setup_transfer(spi, t);
|
||||
+ if (status < 0)
|
||||
+ goto msg_done;
|
||||
+ if (!t->speed_hz && !t->bits_per_word)
|
||||
+ par_override = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!cs_active) {
|
||||
+ rt2880_spi_set_cs(rs, 1);
|
||||
+ cs_active = 1;
|
||||
+ }
|
||||
+
|
||||
+ if (t->len)
|
||||
+ m->actual_length += rt2880_spi_write_read(spi, t);
|
||||
+
|
||||
+ if (t->delay_usecs)
|
||||
+ udelay(t->delay_usecs);
|
||||
+
|
||||
+ if (t->cs_change) {
|
||||
+ rt2880_spi_set_cs(rs, 0);
|
||||
+ cs_active = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+msg_done:
|
||||
+ if (cs_active)
|
||||
+ rt2880_spi_set_cs(rs, 0);
|
||||
+
|
||||
+ m->status = status;
|
||||
+ spi_finalize_current_message(master);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt2880_spi_setup(struct spi_device *spi)
|
||||
+{
|
||||
+ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
+
|
||||
+ if ((spi->max_speed_hz == 0) ||
|
||||
+ (spi->max_speed_hz > (rs->sys_freq / 2)))
|
||||
+ spi->max_speed_hz = (rs->sys_freq / 2);
|
||||
+
|
||||
+ if (spi->max_speed_hz < (rs->sys_freq / 128)) {
|
||||
+ dev_err(&spi->dev, "setup: requested speed is too low %d Hz\n",
|
||||
+ spi->max_speed_hz);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * baudrate & width will be set rt2880_spi_setup_transfer
|
||||
+ */
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void rt2880_spi_reset(struct rt2880_spi *rs)
|
||||
+{
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_CFG,
|
||||
+ SPICFG_MSBFIRST | SPICFG_TXCLKEDGE_FALLING |
|
||||
+ SPICFG_SPICLK_DIV16 | SPICFG_SPICLKPOL);
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_CTL, SPICTL_HIZSDO | SPICTL_SPIENA);
|
||||
+}
|
||||
+
|
||||
+static int rt2880_spi_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct spi_master *master;
|
||||
+ struct rt2880_spi *rs;
|
||||
+ unsigned long flags;
|
||||
+ void __iomem *base;
|
||||
+ struct resource *r;
|
||||
+ int status = 0;
|
||||
+ struct clk *clk;
|
||||
+
|
||||
+ r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ base = devm_ioremap_resource(&pdev->dev, r);
|
||||
+ if (IS_ERR(base))
|
||||
+ return PTR_ERR(base);
|
||||
+
|
||||
+ clk = devm_clk_get(&pdev->dev, NULL);
|
||||
+ if (IS_ERR(clk)) {
|
||||
+ dev_err(&pdev->dev, "unable to get SYS clock, err=%d\n",
|
||||
+ status);
|
||||
+ return PTR_ERR(clk);
|
||||
+ }
|
||||
+
|
||||
+ status = clk_prepare_enable(clk);
|
||||
+ if (status)
|
||||
+ return status;
|
||||
+
|
||||
+ master = spi_alloc_master(&pdev->dev, sizeof(*rs));
|
||||
+ if (master == NULL) {
|
||||
+ dev_dbg(&pdev->dev, "master allocation failed\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ /* we support only mode 0, and no options */
|
||||
+ master->mode_bits = 0;
|
||||
+
|
||||
+ master->setup = rt2880_spi_setup;
|
||||
+ master->transfer_one_message = rt2880_spi_transfer_one_message;
|
||||
+ master->num_chipselect = RALINK_NUM_CHIPSELECTS;
|
||||
+ master->bits_per_word_mask = SPI_BPW_MASK(8);
|
||||
+ master->dev.of_node = pdev->dev.of_node;
|
||||
+
|
||||
+ dev_set_drvdata(&pdev->dev, master);
|
||||
+
|
||||
+ rs = spi_master_get_devdata(master);
|
||||
+ rs->base = base;
|
||||
+ rs->clk = clk;
|
||||
+ rs->master = master;
|
||||
+ rs->sys_freq = clk_get_rate(rs->clk);
|
||||
+ dev_dbg(&pdev->dev, "sys_freq: %u\n", rs->sys_freq);
|
||||
+ spin_lock_irqsave(&rs->lock, flags);
|
||||
+
|
||||
+ device_reset(&pdev->dev);
|
||||
+
|
||||
+ rt2880_spi_reset(rs);
|
||||
+
|
||||
+ return spi_register_master(master);
|
||||
+}
|
||||
+
|
||||
+static int rt2880_spi_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct spi_master *master;
|
||||
+ struct rt2880_spi *rs;
|
||||
+
|
||||
+ master = dev_get_drvdata(&pdev->dev);
|
||||
+ rs = spi_master_get_devdata(master);
|
||||
+
|
||||
+ clk_disable(rs->clk);
|
||||
+ spi_unregister_master(master);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+MODULE_ALIAS("platform:" DRIVER_NAME);
|
||||
+
|
||||
+static const struct of_device_id rt2880_spi_match[] = {
|
||||
+ { .compatible = "ralink,rt2880-spi" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rt2880_spi_match);
|
||||
+
|
||||
+static struct platform_driver rt2880_spi_driver = {
|
||||
+ .driver = {
|
||||
+ .name = DRIVER_NAME,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = rt2880_spi_match,
|
||||
+ },
|
||||
+ .probe = rt2880_spi_probe,
|
||||
+ .remove = rt2880_spi_remove,
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(rt2880_spi_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Ralink SPI driver");
|
||||
+MODULE_AUTHOR("Sergiy <piratfm@gmail.com>");
|
||||
+MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
|
||||
+MODULE_LICENSE("GPL");
|
|
@ -1,629 +0,0 @@
|
|||
From 5845a3aa53cf42893db05662aa9bb91387949ff6 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Mon, 12 Aug 2013 18:11:33 +0200
|
||||
Subject: [PATCH 22/25] MIPS: ralink: update dts files
|
||||
|
||||
Add the devicetree nodes needed to make the newly merged drivers work.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/dts/mt7620a.dtsi | 135 +++++++++++++++++++++++
|
||||
arch/mips/ralink/dts/rt3050.dtsi | 156 ++++++++++++++++++++++++++
|
||||
arch/mips/ralink/dts/rt3883.dtsi | 219 +++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 510 insertions(+)
|
||||
|
||||
--- a/arch/mips/ralink/dts/mt7620a.dtsi
|
||||
+++ b/arch/mips/ralink/dts/mt7620a.dtsi
|
||||
@@ -29,10 +29,32 @@
|
||||
reg = <0x0 0x100>;
|
||||
};
|
||||
|
||||
+ timer@100 {
|
||||
+ compatible = "ralink,mt7620a-timer", "ralink,rt2880-timer";
|
||||
+ reg = <0x100 0x20>;
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <1>;
|
||||
+ };
|
||||
+
|
||||
+ watchdog@120 {
|
||||
+ compatible = "ralink,mt7620a-wdt", "ralink,rt2880-wdt";
|
||||
+ reg = <0x120 0x10>;
|
||||
+
|
||||
+ resets = <&rstctrl 8>;
|
||||
+ reset-names = "wdt";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <1>;
|
||||
+ };
|
||||
+
|
||||
intc: intc@200 {
|
||||
compatible = "ralink,mt7620a-intc", "ralink,rt2880-intc";
|
||||
reg = <0x200 0x100>;
|
||||
|
||||
+ resets = <&rstctrl 19>;
|
||||
+ reset-names = "intc";
|
||||
+
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <1>;
|
||||
|
||||
@@ -43,16 +65,129 @@
|
||||
memc@300 {
|
||||
compatible = "ralink,mt7620a-memc", "ralink,rt3050-memc";
|
||||
reg = <0x300 0x100>;
|
||||
+
|
||||
+ resets = <&rstctrl 20>;
|
||||
+ reset-names = "mc";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <3>;
|
||||
+ };
|
||||
+
|
||||
+ uart@500 {
|
||||
+ compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a";
|
||||
+ reg = <0x500 0x100>;
|
||||
+
|
||||
+ resets = <&rstctrl 12>;
|
||||
+ reset-names = "uart";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <5>;
|
||||
+
|
||||
+ reg-shift = <2>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ gpio0: gpio@600 {
|
||||
+ compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio";
|
||||
+ reg = <0x600 0x34>;
|
||||
+
|
||||
+ resets = <&rstctrl 13>;
|
||||
+ reset-names = "pio";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <6>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ ralink,gpio-base = <0>;
|
||||
+ ralink,num-gpios = <24>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 20 24 28 2c
|
||||
+ 30 34 ];
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ gpio1: gpio@638 {
|
||||
+ compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio";
|
||||
+ reg = <0x638 0x24>;
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <6>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ ralink,gpio-base = <24>;
|
||||
+ ralink,num-gpios = <16>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 10 14 18 1c
|
||||
+ 20 24 ];
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ gpio2: gpio@660 {
|
||||
+ compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio";
|
||||
+ reg = <0x660 0x24>;
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <6>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ ralink,gpio-base = <40>;
|
||||
+ ralink,num-gpios = <32>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 10 14 18 1c
|
||||
+ 20 24 ];
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ spi@b00 {
|
||||
+ compatible = "ralink,mt7620a-spi", "ralink,rt2880-spi";
|
||||
+ reg = <0xb00 0x100>;
|
||||
+
|
||||
+ resets = <&rstctrl 18>;
|
||||
+ reset-names = "spi";
|
||||
+
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
uartlite@c00 {
|
||||
compatible = "ralink,mt7620a-uart", "ralink,rt2880-uart", "ns16550a";
|
||||
reg = <0xc00 0x100>;
|
||||
|
||||
+ resets = <&rstctrl 19>;
|
||||
+ reset-names = "uartl";
|
||||
+
|
||||
interrupt-parent = <&intc>;
|
||||
interrupts = <12>;
|
||||
|
||||
reg-shift = <2>;
|
||||
};
|
||||
+
|
||||
+ systick@d00 {
|
||||
+ compatible = "ralink,mt7620a-systick", "ralink,cevt-systick";
|
||||
+ reg = <0xd00 0x10>;
|
||||
+
|
||||
+ resets = <&rstctrl 28>;
|
||||
+ reset-names = "intc";
|
||||
+
|
||||
+ interrupt-parent = <&cpuintc>;
|
||||
+ interrupts = <7>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ rstctrl: rstctrl {
|
||||
+ compatible = "ralink,mt7620a-reset", "ralink,rt2880-reset";
|
||||
+ #reset-cells = <1>;
|
||||
};
|
||||
};
|
||||
--- a/arch/mips/ralink/dts/rt3050.dtsi
|
||||
+++ b/arch/mips/ralink/dts/rt3050.dtsi
|
||||
@@ -9,6 +9,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ chosen {
|
||||
+ bootargs = "console=ttyS0,57600";
|
||||
+ };
|
||||
+
|
||||
cpuintc: cpuintc@0 {
|
||||
#address-cells = <0>;
|
||||
#interrupt-cells = <1>;
|
||||
@@ -29,10 +33,32 @@
|
||||
reg = <0x0 0x100>;
|
||||
};
|
||||
|
||||
+ timer@100 {
|
||||
+ compatible = "ralink,rt3052-timer", "ralink,rt2880-timer";
|
||||
+ reg = <0x100 0x20>;
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <1>;
|
||||
+ };
|
||||
+
|
||||
+ watchdog@120 {
|
||||
+ compatible = "ralink,rt3052-wdt", "ralink,rt2880-wdt";
|
||||
+ reg = <0x120 0x10>;
|
||||
+
|
||||
+ resets = <&rstctrl 8>;
|
||||
+ reset-names = "wdt";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <1>;
|
||||
+ };
|
||||
+
|
||||
intc: intc@200 {
|
||||
compatible = "ralink,rt3052-intc", "ralink,rt2880-intc";
|
||||
reg = <0x200 0x100>;
|
||||
|
||||
+ resets = <&rstctrl 19>;
|
||||
+ reset-names = "intc";
|
||||
+
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <1>;
|
||||
|
||||
@@ -43,17 +69,144 @@
|
||||
memc@300 {
|
||||
compatible = "ralink,rt3052-memc", "ralink,rt3050-memc";
|
||||
reg = <0x300 0x100>;
|
||||
+
|
||||
+ resets = <&rstctrl 20>;
|
||||
+ reset-names = "mc";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <3>;
|
||||
+ };
|
||||
+
|
||||
+ uart@500 {
|
||||
+ compatible = "ralink,rt5350-uart", "ralink,rt2880-uart", "ns16550a";
|
||||
+ reg = <0x500 0x100>;
|
||||
+
|
||||
+ resets = <&rstctrl 12>;
|
||||
+ reset-names = "uart";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <5>;
|
||||
+
|
||||
+ reg-shift = <2>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ gpio0: gpio@600 {
|
||||
+ compatible = "ralink,rt3052-gpio", "ralink,rt2880-gpio";
|
||||
+ reg = <0x600 0x34>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ ralink,gpio-base = <0>;
|
||||
+ ralink,num-gpios = <24>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 20 24 28 2c
|
||||
+ 30 34 ];
|
||||
+
|
||||
+ resets = <&rstctrl 13>;
|
||||
+ reset-names = "pio";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <6>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ gpio1: gpio@638 {
|
||||
+ compatible = "ralink,rt3052-gpio", "ralink,rt2880-gpio";
|
||||
+ reg = <0x638 0x24>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ ralink,gpio-base = <24>;
|
||||
+ ralink,num-gpios = <16>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 10 14 18 1c
|
||||
+ 20 24 ];
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ gpio2: gpio@660 {
|
||||
+ compatible = "ralink,rt3052-gpio", "ralink,rt2880-gpio";
|
||||
+ reg = <0x660 0x24>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ ralink,gpio-base = <40>;
|
||||
+ ralink,num-gpios = <12>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 10 14 18 1c
|
||||
+ 20 24 ];
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ spi@b00 {
|
||||
+ compatible = "ralink,rt3050-spi", "ralink,rt2880-spi";
|
||||
+ reg = <0xb00 0x100>;
|
||||
+
|
||||
+ resets = <&rstctrl 18>;
|
||||
+ reset-names = "spi";
|
||||
+
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
uartlite@c00 {
|
||||
compatible = "ralink,rt3052-uart", "ralink,rt2880-uart", "ns16550a";
|
||||
reg = <0xc00 0x100>;
|
||||
|
||||
+ resets = <&rstctrl 19>;
|
||||
+ reset-names = "uartl";
|
||||
+
|
||||
interrupt-parent = <&intc>;
|
||||
interrupts = <12>;
|
||||
|
||||
reg-shift = <2>;
|
||||
};
|
||||
+
|
||||
+ };
|
||||
+
|
||||
+ rstctrl: rstctrl {
|
||||
+ compatible = "ralink,rt3050-reset", "ralink,rt2880-reset";
|
||||
+ #reset-cells = <1>;
|
||||
+ };
|
||||
+
|
||||
+ ethernet@10100000 {
|
||||
+ compatible = "ralink,rt3050-eth";
|
||||
+ reg = <0x10100000 10000>;
|
||||
+
|
||||
+ interrupt-parent = <&cpuintc>;
|
||||
+ interrupts = <5>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ esw@10110000 {
|
||||
+ compatible = "ralink,rt3050-esw";
|
||||
+ reg = <0x10110000 8000>;
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <17>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ wmac@10180000 {
|
||||
+ compatible = "ralink,rt3050-wmac", "ralink,rt2880-wmac";
|
||||
+ reg = <0x10180000 40000>;
|
||||
+
|
||||
+ interrupt-parent = <&cpuintc>;
|
||||
+ interrupts = <6>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
usb@101c0000 {
|
||||
@@ -63,6 +216,9 @@
|
||||
interrupt-parent = <&intc>;
|
||||
interrupts = <18>;
|
||||
|
||||
+ resets = <&rstctrl 22>;
|
||||
+ reset-names = "otg";
|
||||
+
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
--- a/arch/mips/ralink/dts/rt3883.dtsi
|
||||
+++ b/arch/mips/ralink/dts/rt3883.dtsi
|
||||
@@ -29,10 +29,32 @@
|
||||
reg = <0x0 0x100>;
|
||||
};
|
||||
|
||||
+ timer@100 {
|
||||
+ compatible = "ralink,rt3883-timer", "ralink,rt2880-timer";
|
||||
+ reg = <0x100 0x20>;
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <1>;
|
||||
+ };
|
||||
+
|
||||
+ watchdog@120 {
|
||||
+ compatible = "ralink,rt3883-wdt", "ralink,rt2880-wdt";
|
||||
+ reg = <0x120 0x10>;
|
||||
+
|
||||
+ resets = <&rstctrl 8>;
|
||||
+ reset-names = "wdt";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <1>;
|
||||
+ };
|
||||
+
|
||||
intc: intc@200 {
|
||||
compatible = "ralink,rt3883-intc", "ralink,rt2880-intc";
|
||||
reg = <0x200 0x100>;
|
||||
|
||||
+ resets = <&rstctrl 19>;
|
||||
+ reset-names = "intc";
|
||||
+
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <1>;
|
||||
|
||||
@@ -43,16 +65,213 @@
|
||||
memc@300 {
|
||||
compatible = "ralink,rt3883-memc", "ralink,rt3050-memc";
|
||||
reg = <0x300 0x100>;
|
||||
+
|
||||
+ resets = <&rstctrl 20>;
|
||||
+ reset-names = "mc";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <3>;
|
||||
+ };
|
||||
+
|
||||
+ uart@500 {
|
||||
+ compatible = "ralink,rt3883-uart", "ralink,rt2880-uart", "ns16550a";
|
||||
+ reg = <0x500 0x100>;
|
||||
+
|
||||
+ resets = <&rstctrl 12>;
|
||||
+ reset-names = "uart";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <5>;
|
||||
+
|
||||
+ reg-shift = <2>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ gpio0: gpio@600 {
|
||||
+ compatible = "ralink,rt3883-gpio", "ralink,rt2880-gpio";
|
||||
+ reg = <0x600 0x34>;
|
||||
+
|
||||
+ resets = <&rstctrl 13>;
|
||||
+ reset-names = "pio";
|
||||
+
|
||||
+ interrupt-parent = <&intc>;
|
||||
+ interrupts = <6>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ ralink,gpio-base = <0>;
|
||||
+ ralink,num-gpios = <24>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 20 24 28 2c
|
||||
+ 30 34 ];
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ gpio1: gpio@638 {
|
||||
+ compatible = "ralink,rt3883-gpio", "ralink,rt2880-gpio";
|
||||
+ reg = <0x638 0x24>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ ralink,gpio-base = <24>;
|
||||
+ ralink,num-gpios = <16>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 10 14 18 1c
|
||||
+ 20 24 ];
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ gpio2: gpio@660 {
|
||||
+ compatible = "ralink,rt3883-gpio", "ralink,rt2880-gpio";
|
||||
+ reg = <0x660 0x24>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ ralink,gpio-base = <40>;
|
||||
+ ralink,num-gpios = <32>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 10 14 18 1c
|
||||
+ 20 24 ];
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ gpio3: gpio@688 {
|
||||
+ compatible = "ralink,rt3883-gpio", "ralink,rt2880-gpio";
|
||||
+ reg = <0x688 0x24>;
|
||||
+
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+
|
||||
+ ralink,gpio-base = <72>;
|
||||
+ ralink,num-gpios = <24>;
|
||||
+ ralink,register-map = [ 00 04 08 0c
|
||||
+ 10 14 18 1c
|
||||
+ 20 24 ];
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ spi0: spi@b00 {
|
||||
+ compatible = "ralink,rt3883-spi", "ralink,rt2880-spi";
|
||||
+ reg = <0xb00 0x100>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ resets = <&rstctrl 18>;
|
||||
+ reset-names = "spi";
|
||||
+
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
uartlite@c00 {
|
||||
compatible = "ralink,rt3883-uart", "ralink,rt2880-uart", "ns16550a";
|
||||
reg = <0xc00 0x100>;
|
||||
|
||||
+ resets = <&rstctrl 19>;
|
||||
+ reset-names = "uartl";
|
||||
+
|
||||
interrupt-parent = <&intc>;
|
||||
interrupts = <12>;
|
||||
|
||||
reg-shift = <2>;
|
||||
};
|
||||
};
|
||||
+
|
||||
+ rstctrl: rstctrl {
|
||||
+ compatible = "ralink,rt3883-reset", "ralink,rt2880-reset";
|
||||
+ #reset-cells = <1>;
|
||||
+ };
|
||||
+
|
||||
+ pci@10140000 {
|
||||
+ compatible = "ralink,rt3883-pci";
|
||||
+ reg = <0x10140000 0x20000>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ ranges; /* direct mapping */
|
||||
+
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ pciintc: interrupt-controller {
|
||||
+ interrupt-controller;
|
||||
+ #address-cells = <0>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+
|
||||
+ interrupt-parent = <&cpuintc>;
|
||||
+ interrupts = <4>;
|
||||
+ };
|
||||
+
|
||||
+ host-bridge {
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+
|
||||
+ device_type = "pci";
|
||||
+
|
||||
+ bus-range = <0 255>;
|
||||
+ ranges = <
|
||||
+ 0x02000000 0 0x00000000 0x20000000 0 0x10000000 /* pci memory */
|
||||
+ 0x01000000 0 0x00000000 0x10160000 0 0x00010000 /* io space */
|
||||
+ >;
|
||||
+
|
||||
+ interrupt-map-mask = <0xf800 0 0 7>;
|
||||
+ interrupt-map = <
|
||||
+ /* IDSEL 17 */
|
||||
+ 0x8800 0 0 1 &pciintc 18
|
||||
+ 0x8800 0 0 2 &pciintc 18
|
||||
+ 0x8800 0 0 3 &pciintc 18
|
||||
+ 0x8800 0 0 4 &pciintc 18
|
||||
+ /* IDSEL 18 */
|
||||
+ 0x9000 0 0 1 &pciintc 19
|
||||
+ 0x9000 0 0 2 &pciintc 19
|
||||
+ 0x9000 0 0 3 &pciintc 19
|
||||
+ 0x9000 0 0 4 &pciintc 19
|
||||
+ >;
|
||||
+
|
||||
+ pci-bridge@1 {
|
||||
+ reg = <0x0800 0 0 0 0>;
|
||||
+ device_type = "pci";
|
||||
+ #interrupt-cells = <1>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ ralink,pci-slot = <1>;
|
||||
+
|
||||
+ interrupt-map-mask = <0x0 0 0 0>;
|
||||
+ interrupt-map = <0x0 0 0 0 &pciintc 20>;
|
||||
+ };
|
||||
+
|
||||
+ pci-slot@17 {
|
||||
+ reg = <0x8800 0 0 0 0>;
|
||||
+ device_type = "pci";
|
||||
+ #interrupt-cells = <1>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+
|
||||
+ ralink,pci-slot = <17>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pci-slot@18 {
|
||||
+ reg = <0x9000 0 0 0 0>;
|
||||
+ device_type = "pci";
|
||||
+ #interrupt-cells = <1>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+
|
||||
+ ralink,pci-slot = <18>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
};
|
|
@ -1,95 +0,0 @@
|
|||
From f6dc5d40c766e5ff9b18b93a1b6f7a576655f9c4 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 28 Jul 2013 16:26:41 +0200
|
||||
Subject: [PATCH 21/25] MIPS: ralink: add cpu frequency scaling
|
||||
|
||||
This feature will break udelay() and cause the delay loop to have longer delays
|
||||
when the frequency is scaled causing a performance hit.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/cevt-rt3352.c | 36 ++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 36 insertions(+)
|
||||
|
||||
--- a/arch/mips/ralink/cevt-rt3352.c
|
||||
+++ b/arch/mips/ralink/cevt-rt3352.c
|
||||
@@ -29,6 +29,10 @@
|
||||
/* enable the counter */
|
||||
#define CFG_CNT_EN 0x1
|
||||
|
||||
+/* mt7620 frequency scaling defines */
|
||||
+#define CLK_LUT_CFG 0x40
|
||||
+#define SLEEP_EN BIT(31)
|
||||
+
|
||||
struct systick_device {
|
||||
void __iomem *membase;
|
||||
struct clock_event_device dev;
|
||||
@@ -36,6 +40,8 @@ struct systick_device {
|
||||
int freq_scale;
|
||||
};
|
||||
|
||||
+static void (*systick_freq_scaling)(struct systick_device *sdev, int status);
|
||||
+
|
||||
static void systick_set_clock_mode(enum clock_event_mode mode,
|
||||
struct clock_event_device *evt);
|
||||
|
||||
@@ -87,6 +93,21 @@ static struct irqaction systick_irqactio
|
||||
.dev_id = &systick.dev,
|
||||
};
|
||||
|
||||
+static inline void mt7620_freq_scaling(struct systick_device *sdev, int status)
|
||||
+{
|
||||
+ if (sdev->freq_scale == status)
|
||||
+ return;
|
||||
+
|
||||
+ sdev->freq_scale = status;
|
||||
+
|
||||
+ pr_info("%s: %s autosleep mode\n", systick.dev.name,
|
||||
+ (status) ? ("enable") : ("disable"));
|
||||
+ if (status)
|
||||
+ rt_sysc_w32(rt_sysc_r32(CLK_LUT_CFG) | SLEEP_EN, CLK_LUT_CFG);
|
||||
+ else
|
||||
+ rt_sysc_w32(rt_sysc_r32(CLK_LUT_CFG) & ~SLEEP_EN, CLK_LUT_CFG);
|
||||
+}
|
||||
+
|
||||
static void systick_set_clock_mode(enum clock_event_mode mode,
|
||||
struct clock_event_device *evt)
|
||||
{
|
||||
@@ -101,9 +122,13 @@ static void systick_set_clock_mode(enum
|
||||
sdev->irq_requested = 1;
|
||||
iowrite32(CFG_EXT_STK_EN | CFG_CNT_EN,
|
||||
systick.membase + SYSTICK_CONFIG);
|
||||
+ if (systick_freq_scaling)
|
||||
+ systick_freq_scaling(sdev, 1);
|
||||
break;
|
||||
|
||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
||||
+ if (systick_freq_scaling)
|
||||
+ systick_freq_scaling(sdev, 0);
|
||||
if (sdev->irq_requested)
|
||||
free_irq(systick.dev.irq, &systick_irqaction);
|
||||
sdev->irq_requested = 0;
|
||||
@@ -116,12 +141,23 @@ static void systick_set_clock_mode(enum
|
||||
}
|
||||
}
|
||||
|
||||
+static const struct of_device_id systick_match[] = {
|
||||
+ { .compatible = "ralink,mt7620-systick", .data = mt7620_freq_scaling},
|
||||
+ {},
|
||||
+};
|
||||
+
|
||||
static void __init ralink_systick_init(struct device_node *np)
|
||||
{
|
||||
+ const struct of_device_id *match;
|
||||
+
|
||||
systick.membase = of_iomap(np, 0);
|
||||
if (!systick.membase)
|
||||
return;
|
||||
|
||||
+ match = of_match_node(systick_match, np);
|
||||
+ if (match)
|
||||
+ systick_freq_scaling = match->data;
|
||||
+
|
||||
systick_irqaction.name = np->name;
|
||||
systick.dev.name = np->name;
|
||||
clockevents_calc_mult_shift(&systick.dev, SYSTICK_FREQ, 60);
|
|
@ -1,901 +0,0 @@
|
|||
From patchwork Fri Aug 23 12:03:20 2013
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v3] MIPS: add driver for the built-in PCI controller of the RT3883
|
||||
SoC
|
||||
From: Gabor Juhos <juhosg@openwrt.org>
|
||||
X-Patchwork-Id: 5758
|
||||
Message-Id: <1377259400-21211-1-git-send-email-juhosg@openwrt.org>
|
||||
To: Ralf Baechle <ralf@linux-mips.org>
|
||||
Cc: linux-mips@linux-mips.org, Gabor Juhos <juhosg@openwrt.org>,
|
||||
devicetree@vger.kernel.org
|
||||
Date: Fri, 23 Aug 2013 14:03:20 +0200
|
||||
|
||||
The Ralink RT3883 SoCs have a built-in PCI Host Controller
|
||||
device. The patch adds a platform driver and device tree
|
||||
binding documentation for that.
|
||||
|
||||
The patch also enables the HW_HAS_PCI config option. This
|
||||
is required in order to be able to enable the PCI support.
|
||||
|
||||
Cc: devicetree@vger.kernel.org
|
||||
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
Acked-by: John Crispin <blogic@openwrt.org>
|
||||
|
||||
---
|
||||
Changes since v2:
|
||||
- fix compiler warning:
|
||||
|
||||
CC arch/mips/pci/pci-rt3883.o
|
||||
arch/mips/pci/pci-rt3883.c: In function 'rt3883_pci_probe':
|
||||
arch/mips/pci/pci-rt3883.c:458:4: warning: use of 'h' length modifier with 'a' type character [-Wformat]
|
||||
|
||||
Changes since v1:
|
||||
- change the 'status' property to optional in the binding doc
|
||||
- add board specific example to the binding doc
|
||||
|
||||
rt3883-pci: fix-build-warning
|
||||
|
||||
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
---
|
||||
.../devicetree/bindings/pci/ralink,rt3883-pci.txt | 190 ++++++
|
||||
arch/mips/pci/Makefile | 1 +
|
||||
arch/mips/pci/pci-rt3883.c | 636 ++++++++++++++++++++
|
||||
arch/mips/ralink/Kconfig | 1 +
|
||||
4 files changed, 828 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/pci/ralink,rt3883-pci.txt
|
||||
create mode 100644 arch/mips/pci/pci-rt3883.c
|
||||
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/pci/ralink,rt3883-pci.txt
|
||||
@@ -0,0 +1,190 @@
|
||||
+* Mediatek/Ralink RT3883 PCI controller
|
||||
+
|
||||
+1) Main node
|
||||
+
|
||||
+ Required properties:
|
||||
+
|
||||
+ - compatible: must be "ralink,rt3883-pci"
|
||||
+
|
||||
+ - reg: specifies the physical base address of the controller and
|
||||
+ the length of the memory mapped region.
|
||||
+
|
||||
+ - #address-cells: specifies the number of cells needed to encode an
|
||||
+ address. The value must be 1.
|
||||
+
|
||||
+ - #size-cells: specifies the number of cells used to represent the size
|
||||
+ of an address. The value must be 1.
|
||||
+
|
||||
+ - ranges: specifies the translation between child address space and parent
|
||||
+ address space
|
||||
+
|
||||
+ Optional properties:
|
||||
+
|
||||
+ - status: indicates the operational status of the device.
|
||||
+ Value must be either "disabled" or "okay".
|
||||
+
|
||||
+2) Child nodes
|
||||
+
|
||||
+ The main node must have two child nodes which describes the built-in
|
||||
+ interrupt controller and the PCI host bridge.
|
||||
+
|
||||
+ a) Interrupt controller:
|
||||
+
|
||||
+ Required properties:
|
||||
+
|
||||
+ - interrupt-controller: identifies the node as an interrupt controller
|
||||
+
|
||||
+ - #address-cells: specifies the number of cells needed to encode an
|
||||
+ address. The value must be 0. As such, 'interrupt-map' nodes do not
|
||||
+ have to specify a parent unit address.
|
||||
+
|
||||
+ - #interrupt-cells: specifies the number of cells needed to encode an
|
||||
+ interrupt source. The value must be 1.
|
||||
+
|
||||
+ - interrupt-parent: the phandle for the interrupt controller that
|
||||
+ services interrupts for this device.
|
||||
+
|
||||
+ - interrupts: specifies the interrupt source of the parent interrupt
|
||||
+ controller. The format of the interrupt specifier depends on the
|
||||
+ parent interrupt controller.
|
||||
+
|
||||
+ b) PCI host bridge:
|
||||
+
|
||||
+ Required properties:
|
||||
+
|
||||
+ - #address-cells: specifies the number of cells needed to encode an
|
||||
+ address. The value must be 0.
|
||||
+
|
||||
+ - #size-cells: specifies the number of cells used to represent the size
|
||||
+ of an address. The value must be 2.
|
||||
+
|
||||
+ - #interrupt-cells: specifies the number of cells needed to encode an
|
||||
+ interrupt source. The value must be 1.
|
||||
+
|
||||
+ - device_type: must be "pci"
|
||||
+
|
||||
+ - bus-range: PCI bus numbers covered
|
||||
+
|
||||
+ - ranges: specifies the ranges for the PCI memory and I/O regions
|
||||
+
|
||||
+ - interrupt-map-mask,
|
||||
+ - interrupt-map: standard PCI properties to define the mapping of the
|
||||
+ PCI interface to interrupt numbers.
|
||||
+
|
||||
+ The PCI host bridge node migh have additional sub-nodes representing
|
||||
+ the onboard PCI devices/PCI slots. Each such sub-node must have the
|
||||
+ following mandatory properties:
|
||||
+
|
||||
+ - reg: used only for interrupt mapping, so only the first four bytes
|
||||
+ are used to refer to the correct bus number and device number.
|
||||
+
|
||||
+ - device_type: must be "pci"
|
||||
+
|
||||
+ If a given sub-node represents a PCI bridge it must have following
|
||||
+ mandatory properties as well:
|
||||
+
|
||||
+ - #address-cells: must be set to <3>
|
||||
+
|
||||
+ - #size-cells: must set to <2>
|
||||
+
|
||||
+ - #interrupt-cells: must be set to <1>
|
||||
+
|
||||
+ - interrupt-map-mask,
|
||||
+ - interrupt-map: standard PCI properties to define the mapping of the
|
||||
+ PCI interface to interrupt numbers.
|
||||
+
|
||||
+ Besides the required properties the sub-nodes may have these optional
|
||||
+ properties:
|
||||
+
|
||||
+ - status: indicates the operational status of the sub-node.
|
||||
+ Value must be either "disabled" or "okay".
|
||||
+
|
||||
+3) Example:
|
||||
+
|
||||
+ a) SoC specific dtsi file:
|
||||
+
|
||||
+ pci@10140000 {
|
||||
+ compatible = "ralink,rt3883-pci";
|
||||
+ reg = <0x10140000 0x20000>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ ranges; /* direct mapping */
|
||||
+
|
||||
+ status = "disabled";
|
||||
+
|
||||
+ pciintc: interrupt-controller {
|
||||
+ interrupt-controller;
|
||||
+ #address-cells = <0>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+
|
||||
+ interrupt-parent = <&cpuintc>;
|
||||
+ interrupts = <4>;
|
||||
+ };
|
||||
+
|
||||
+ host-bridge {
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+
|
||||
+ device_type = "pci";
|
||||
+
|
||||
+ bus-range = <0 255>;
|
||||
+ ranges = <
|
||||
+ 0x02000000 0 0x00000000 0x20000000 0 0x10000000 /* pci memory */
|
||||
+ 0x01000000 0 0x00000000 0x10160000 0 0x00010000 /* io space */
|
||||
+ >;
|
||||
+
|
||||
+ interrupt-map-mask = <0xf800 0 0 7>;
|
||||
+ interrupt-map = <
|
||||
+ /* IDSEL 17 */
|
||||
+ 0x8800 0 0 1 &pciintc 18
|
||||
+ 0x8800 0 0 2 &pciintc 18
|
||||
+ 0x8800 0 0 3 &pciintc 18
|
||||
+ 0x8800 0 0 4 &pciintc 18
|
||||
+ /* IDSEL 18 */
|
||||
+ 0x9000 0 0 1 &pciintc 19
|
||||
+ 0x9000 0 0 2 &pciintc 19
|
||||
+ 0x9000 0 0 3 &pciintc 19
|
||||
+ 0x9000 0 0 4 &pciintc 19
|
||||
+ >;
|
||||
+
|
||||
+ pci-bridge@1 {
|
||||
+ reg = <0x0800 0 0 0 0>;
|
||||
+ device_type = "pci";
|
||||
+ #interrupt-cells = <1>;
|
||||
+ #address-cells = <3>;
|
||||
+ #size-cells = <2>;
|
||||
+
|
||||
+ interrupt-map-mask = <0x0 0 0 0>;
|
||||
+ interrupt-map = <0x0 0 0 0 &pciintc 20>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pci-slot@17 {
|
||||
+ reg = <0x8800 0 0 0 0>;
|
||||
+ device_type = "pci";
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ pci-slot@18 {
|
||||
+ reg = <0x9000 0 0 0 0>;
|
||||
+ device_type = "pci";
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ b) Board specific dts file:
|
||||
+
|
||||
+ pci@10140000 {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ host-bridge {
|
||||
+ pci-bridge@1 {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
--- a/arch/mips/pci/Makefile
|
||||
+++ b/arch/mips/pci/Makefile
|
||||
@@ -41,6 +41,7 @@ obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1
|
||||
obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o
|
||||
obj-$(CONFIG_LANTIQ) += fixup-lantiq.o
|
||||
obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o
|
||||
+obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o
|
||||
obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
|
||||
obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o
|
||||
obj-$(CONFIG_TANBAC_TB0287) += fixup-tb0287.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/pci/pci-rt3883.c
|
||||
@@ -0,0 +1,636 @@
|
||||
+/*
|
||||
+ * Ralink RT3662/RT3883 SoC PCI support
|
||||
+ *
|
||||
+ * Copyright (C) 2011-2013 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ *
|
||||
+ * Parts of this file are based on Ralink's 2.6.21 BSP
|
||||
+ *
|
||||
+ * 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/types.h>
|
||||
+#include <linux/pci.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/of_irq.h>
|
||||
+#include <linux/of_pci.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/rt3883.h>
|
||||
+#include <asm/mach-ralink/ralink_regs.h>
|
||||
+
|
||||
+#define RT3883_MEMORY_BASE 0x00000000
|
||||
+#define RT3883_MEMORY_SIZE 0x02000000
|
||||
+
|
||||
+#define RT3883_PCI_REG_PCICFG 0x00
|
||||
+#define RT3883_PCICFG_P2P_BR_DEVNUM_M 0xf
|
||||
+#define RT3883_PCICFG_P2P_BR_DEVNUM_S 16
|
||||
+#define RT3883_PCICFG_PCIRST BIT(1)
|
||||
+#define RT3883_PCI_REG_PCIRAW 0x04
|
||||
+#define RT3883_PCI_REG_PCIINT 0x08
|
||||
+#define RT3883_PCI_REG_PCIENA 0x0c
|
||||
+
|
||||
+#define RT3883_PCI_REG_CFGADDR 0x20
|
||||
+#define RT3883_PCI_REG_CFGDATA 0x24
|
||||
+#define RT3883_PCI_REG_MEMBASE 0x28
|
||||
+#define RT3883_PCI_REG_IOBASE 0x2c
|
||||
+#define RT3883_PCI_REG_ARBCTL 0x80
|
||||
+
|
||||
+#define RT3883_PCI_REG_BASE(_x) (0x1000 + (_x) * 0x1000)
|
||||
+#define RT3883_PCI_REG_BAR0SETUP(_x) (RT3883_PCI_REG_BASE((_x)) + 0x10)
|
||||
+#define RT3883_PCI_REG_IMBASEBAR0(_x) (RT3883_PCI_REG_BASE((_x)) + 0x18)
|
||||
+#define RT3883_PCI_REG_ID(_x) (RT3883_PCI_REG_BASE((_x)) + 0x30)
|
||||
+#define RT3883_PCI_REG_CLASS(_x) (RT3883_PCI_REG_BASE((_x)) + 0x34)
|
||||
+#define RT3883_PCI_REG_SUBID(_x) (RT3883_PCI_REG_BASE((_x)) + 0x38)
|
||||
+#define RT3883_PCI_REG_STATUS(_x) (RT3883_PCI_REG_BASE((_x)) + 0x50)
|
||||
+
|
||||
+#define RT3883_PCI_MODE_NONE 0
|
||||
+#define RT3883_PCI_MODE_PCI BIT(0)
|
||||
+#define RT3883_PCI_MODE_PCIE BIT(1)
|
||||
+#define RT3883_PCI_MODE_BOTH (RT3883_PCI_MODE_PCI | RT3883_PCI_MODE_PCIE)
|
||||
+
|
||||
+#define RT3883_PCI_IRQ_COUNT 32
|
||||
+
|
||||
+#define RT3883_P2P_BR_DEVNUM 1
|
||||
+
|
||||
+struct rt3883_pci_controller {
|
||||
+ void __iomem *base;
|
||||
+ spinlock_t lock;
|
||||
+
|
||||
+ struct device_node *intc_of_node;
|
||||
+ struct irq_domain *irq_domain;
|
||||
+
|
||||
+ struct pci_controller pci_controller;
|
||||
+ struct resource io_res;
|
||||
+ struct resource mem_res;
|
||||
+
|
||||
+ bool pcie_ready;
|
||||
+};
|
||||
+
|
||||
+static inline struct rt3883_pci_controller *
|
||||
+pci_bus_to_rt3883_controller(struct pci_bus *bus)
|
||||
+{
|
||||
+ struct pci_controller *hose;
|
||||
+
|
||||
+ hose = (struct pci_controller *) bus->sysdata;
|
||||
+ return container_of(hose, struct rt3883_pci_controller, pci_controller);
|
||||
+}
|
||||
+
|
||||
+static inline u32 rt3883_pci_r32(struct rt3883_pci_controller *rpc,
|
||||
+ unsigned reg)
|
||||
+{
|
||||
+ return ioread32(rpc->base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline void rt3883_pci_w32(struct rt3883_pci_controller *rpc,
|
||||
+ u32 val, unsigned reg)
|
||||
+{
|
||||
+ iowrite32(val, rpc->base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline u32 rt3883_pci_get_cfgaddr(unsigned int bus, unsigned int slot,
|
||||
+ unsigned int func, unsigned int where)
|
||||
+{
|
||||
+ return (bus << 16) | (slot << 11) | (func << 8) | (where & 0xfc) |
|
||||
+ 0x80000000;
|
||||
+}
|
||||
+
|
||||
+static u32 rt3883_pci_read_cfg32(struct rt3883_pci_controller *rpc,
|
||||
+ unsigned bus, unsigned slot,
|
||||
+ unsigned func, unsigned reg)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+ u32 address;
|
||||
+ u32 ret;
|
||||
+
|
||||
+ address = rt3883_pci_get_cfgaddr(bus, slot, func, reg);
|
||||
+
|
||||
+ spin_lock_irqsave(&rpc->lock, flags);
|
||||
+ rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR);
|
||||
+ ret = rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA);
|
||||
+ spin_unlock_irqrestore(&rpc->lock, flags);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void rt3883_pci_write_cfg32(struct rt3883_pci_controller *rpc,
|
||||
+ unsigned bus, unsigned slot,
|
||||
+ unsigned func, unsigned reg, u32 val)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+ u32 address;
|
||||
+
|
||||
+ address = rt3883_pci_get_cfgaddr(bus, slot, func, reg);
|
||||
+
|
||||
+ spin_lock_irqsave(&rpc->lock, flags);
|
||||
+ rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR);
|
||||
+ rt3883_pci_w32(rpc, val, RT3883_PCI_REG_CFGDATA);
|
||||
+ spin_unlock_irqrestore(&rpc->lock, flags);
|
||||
+}
|
||||
+
|
||||
+static void rt3883_pci_irq_handler(unsigned int irq, struct irq_desc *desc)
|
||||
+{
|
||||
+ struct rt3883_pci_controller *rpc;
|
||||
+ u32 pending;
|
||||
+
|
||||
+ rpc = irq_get_handler_data(irq);
|
||||
+
|
||||
+ pending = rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIINT) &
|
||||
+ rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIENA);
|
||||
+
|
||||
+ if (!pending) {
|
||||
+ spurious_interrupt();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ while (pending) {
|
||||
+ unsigned bit = __ffs(pending);
|
||||
+
|
||||
+ irq = irq_find_mapping(rpc->irq_domain, bit);
|
||||
+ generic_handle_irq(irq);
|
||||
+
|
||||
+ pending &= ~BIT(bit);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void rt3883_pci_irq_unmask(struct irq_data *d)
|
||||
+{
|
||||
+ struct rt3883_pci_controller *rpc;
|
||||
+ u32 t;
|
||||
+
|
||||
+ rpc = irq_data_get_irq_chip_data(d);
|
||||
+
|
||||
+ t = rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIENA);
|
||||
+ rt3883_pci_w32(rpc, t | BIT(d->hwirq), RT3883_PCI_REG_PCIENA);
|
||||
+ /* flush write */
|
||||
+ rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIENA);
|
||||
+}
|
||||
+
|
||||
+static void rt3883_pci_irq_mask(struct irq_data *d)
|
||||
+{
|
||||
+ struct rt3883_pci_controller *rpc;
|
||||
+ u32 t;
|
||||
+
|
||||
+ rpc = irq_data_get_irq_chip_data(d);
|
||||
+
|
||||
+ t = rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIENA);
|
||||
+ rt3883_pci_w32(rpc, t & ~BIT(d->hwirq), RT3883_PCI_REG_PCIENA);
|
||||
+ /* flush write */
|
||||
+ rt3883_pci_r32(rpc, RT3883_PCI_REG_PCIENA);
|
||||
+}
|
||||
+
|
||||
+static struct irq_chip rt3883_pci_irq_chip = {
|
||||
+ .name = "RT3883 PCI",
|
||||
+ .irq_mask = rt3883_pci_irq_mask,
|
||||
+ .irq_unmask = rt3883_pci_irq_unmask,
|
||||
+ .irq_mask_ack = rt3883_pci_irq_mask,
|
||||
+};
|
||||
+
|
||||
+static int rt3883_pci_irq_map(struct irq_domain *d, unsigned int irq,
|
||||
+ irq_hw_number_t hw)
|
||||
+{
|
||||
+ irq_set_chip_and_handler(irq, &rt3883_pci_irq_chip, handle_level_irq);
|
||||
+ irq_set_chip_data(irq, d->host_data);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct irq_domain_ops rt3883_pci_irq_domain_ops = {
|
||||
+ .map = rt3883_pci_irq_map,
|
||||
+ .xlate = irq_domain_xlate_onecell,
|
||||
+};
|
||||
+
|
||||
+static int rt3883_pci_irq_init(struct device *dev,
|
||||
+ struct rt3883_pci_controller *rpc)
|
||||
+{
|
||||
+ int irq;
|
||||
+
|
||||
+ irq = irq_of_parse_and_map(rpc->intc_of_node, 0);
|
||||
+ if (irq == 0) {
|
||||
+ dev_err(dev, "%s has no IRQ",
|
||||
+ of_node_full_name(rpc->intc_of_node));
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ /* disable all interrupts */
|
||||
+ rt3883_pci_w32(rpc, 0, RT3883_PCI_REG_PCIENA);
|
||||
+
|
||||
+ rpc->irq_domain =
|
||||
+ irq_domain_add_linear(rpc->intc_of_node, RT3883_PCI_IRQ_COUNT,
|
||||
+ &rt3883_pci_irq_domain_ops,
|
||||
+ rpc);
|
||||
+ if (!rpc->irq_domain) {
|
||||
+ dev_err(dev, "unable to add IRQ domain\n");
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ irq_set_handler_data(irq, rpc);
|
||||
+ irq_set_chained_handler(irq, rt3883_pci_irq_handler);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt3883_pci_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||
+ int where, int size, u32 *val)
|
||||
+{
|
||||
+ struct rt3883_pci_controller *rpc;
|
||||
+ unsigned long flags;
|
||||
+ u32 address;
|
||||
+ u32 data;
|
||||
+
|
||||
+ rpc = pci_bus_to_rt3883_controller(bus);
|
||||
+
|
||||
+ if (!rpc->pcie_ready && bus->number == 1)
|
||||
+ return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
+
|
||||
+ address = rt3883_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn),
|
||||
+ PCI_FUNC(devfn), where);
|
||||
+
|
||||
+ spin_lock_irqsave(&rpc->lock, flags);
|
||||
+ rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR);
|
||||
+ data = rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA);
|
||||
+ spin_unlock_irqrestore(&rpc->lock, flags);
|
||||
+
|
||||
+ switch (size) {
|
||||
+ case 1:
|
||||
+ *val = (data >> ((where & 3) << 3)) & 0xff;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ *val = (data >> ((where & 3) << 3)) & 0xffff;
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ *val = data;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return PCIBIOS_SUCCESSFUL;
|
||||
+}
|
||||
+
|
||||
+static int rt3883_pci_config_write(struct pci_bus *bus, unsigned int devfn,
|
||||
+ int where, int size, u32 val)
|
||||
+{
|
||||
+ struct rt3883_pci_controller *rpc;
|
||||
+ unsigned long flags;
|
||||
+ u32 address;
|
||||
+ u32 data;
|
||||
+
|
||||
+ rpc = pci_bus_to_rt3883_controller(bus);
|
||||
+
|
||||
+ if (!rpc->pcie_ready && bus->number == 1)
|
||||
+ return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
+
|
||||
+ address = rt3883_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn),
|
||||
+ PCI_FUNC(devfn), where);
|
||||
+
|
||||
+ spin_lock_irqsave(&rpc->lock, flags);
|
||||
+ rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR);
|
||||
+ data = rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA);
|
||||
+
|
||||
+ switch (size) {
|
||||
+ case 1:
|
||||
+ data = (data & ~(0xff << ((where & 3) << 3))) |
|
||||
+ (val << ((where & 3) << 3));
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ data = (data & ~(0xffff << ((where & 3) << 3))) |
|
||||
+ (val << ((where & 3) << 3));
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ data = val;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ rt3883_pci_w32(rpc, data, RT3883_PCI_REG_CFGDATA);
|
||||
+ spin_unlock_irqrestore(&rpc->lock, flags);
|
||||
+
|
||||
+ return PCIBIOS_SUCCESSFUL;
|
||||
+}
|
||||
+
|
||||
+static struct pci_ops rt3883_pci_ops = {
|
||||
+ .read = rt3883_pci_config_read,
|
||||
+ .write = rt3883_pci_config_write,
|
||||
+};
|
||||
+
|
||||
+static void rt3883_pci_preinit(struct rt3883_pci_controller *rpc, unsigned mode)
|
||||
+{
|
||||
+ u32 syscfg1;
|
||||
+ u32 rstctrl;
|
||||
+ u32 clkcfg1;
|
||||
+ u32 t;
|
||||
+
|
||||
+ rstctrl = rt_sysc_r32(RT3883_SYSC_REG_RSTCTRL);
|
||||
+ syscfg1 = rt_sysc_r32(RT3883_SYSC_REG_SYSCFG1);
|
||||
+ clkcfg1 = rt_sysc_r32(RT3883_SYSC_REG_CLKCFG1);
|
||||
+
|
||||
+ if (mode & RT3883_PCI_MODE_PCIE) {
|
||||
+ rstctrl |= RT3883_RSTCTRL_PCIE;
|
||||
+ rt_sysc_w32(rstctrl, RT3883_SYSC_REG_RSTCTRL);
|
||||
+
|
||||
+ /* setup PCI PAD drive mode */
|
||||
+ syscfg1 &= ~(0x30);
|
||||
+ syscfg1 |= (2 << 4);
|
||||
+ rt_sysc_w32(syscfg1, RT3883_SYSC_REG_SYSCFG1);
|
||||
+
|
||||
+ t = rt_sysc_r32(RT3883_SYSC_REG_PCIE_CLK_GEN0);
|
||||
+ t &= ~BIT(31);
|
||||
+ rt_sysc_w32(t, RT3883_SYSC_REG_PCIE_CLK_GEN0);
|
||||
+
|
||||
+ t = rt_sysc_r32(RT3883_SYSC_REG_PCIE_CLK_GEN1);
|
||||
+ t &= 0x80ffffff;
|
||||
+ rt_sysc_w32(t, RT3883_SYSC_REG_PCIE_CLK_GEN1);
|
||||
+
|
||||
+ t = rt_sysc_r32(RT3883_SYSC_REG_PCIE_CLK_GEN1);
|
||||
+ t |= 0xa << 24;
|
||||
+ rt_sysc_w32(t, RT3883_SYSC_REG_PCIE_CLK_GEN1);
|
||||
+
|
||||
+ t = rt_sysc_r32(RT3883_SYSC_REG_PCIE_CLK_GEN0);
|
||||
+ t |= BIT(31);
|
||||
+ rt_sysc_w32(t, RT3883_SYSC_REG_PCIE_CLK_GEN0);
|
||||
+
|
||||
+ msleep(50);
|
||||
+
|
||||
+ rstctrl &= ~RT3883_RSTCTRL_PCIE;
|
||||
+ rt_sysc_w32(rstctrl, RT3883_SYSC_REG_RSTCTRL);
|
||||
+ }
|
||||
+
|
||||
+ syscfg1 |= (RT3883_SYSCFG1_PCIE_RC_MODE | RT3883_SYSCFG1_PCI_HOST_MODE);
|
||||
+
|
||||
+ clkcfg1 &= ~(RT3883_CLKCFG1_PCI_CLK_EN | RT3883_CLKCFG1_PCIE_CLK_EN);
|
||||
+
|
||||
+ if (mode & RT3883_PCI_MODE_PCI) {
|
||||
+ clkcfg1 |= RT3883_CLKCFG1_PCI_CLK_EN;
|
||||
+ rstctrl &= ~RT3883_RSTCTRL_PCI;
|
||||
+ }
|
||||
+
|
||||
+ if (mode & RT3883_PCI_MODE_PCIE) {
|
||||
+ clkcfg1 |= RT3883_CLKCFG1_PCIE_CLK_EN;
|
||||
+ rstctrl &= ~RT3883_RSTCTRL_PCIE;
|
||||
+ }
|
||||
+
|
||||
+ rt_sysc_w32(syscfg1, RT3883_SYSC_REG_SYSCFG1);
|
||||
+ rt_sysc_w32(rstctrl, RT3883_SYSC_REG_RSTCTRL);
|
||||
+ rt_sysc_w32(clkcfg1, RT3883_SYSC_REG_CLKCFG1);
|
||||
+
|
||||
+ msleep(500);
|
||||
+
|
||||
+ /*
|
||||
+ * setup the device number of the P2P bridge
|
||||
+ * and de-assert the reset line
|
||||
+ */
|
||||
+ t = (RT3883_P2P_BR_DEVNUM << RT3883_PCICFG_P2P_BR_DEVNUM_S);
|
||||
+ rt3883_pci_w32(rpc, t, RT3883_PCI_REG_PCICFG);
|
||||
+
|
||||
+ /* flush write */
|
||||
+ rt3883_pci_r32(rpc, RT3883_PCI_REG_PCICFG);
|
||||
+ msleep(500);
|
||||
+
|
||||
+ if (mode & RT3883_PCI_MODE_PCIE) {
|
||||
+ msleep(500);
|
||||
+
|
||||
+ t = rt3883_pci_r32(rpc, RT3883_PCI_REG_STATUS(1));
|
||||
+
|
||||
+ rpc->pcie_ready = t & BIT(0);
|
||||
+
|
||||
+ if (!rpc->pcie_ready) {
|
||||
+ /* reset the PCIe block */
|
||||
+ t = rt_sysc_r32(RT3883_SYSC_REG_RSTCTRL);
|
||||
+ t |= RT3883_RSTCTRL_PCIE;
|
||||
+ rt_sysc_w32(t, RT3883_SYSC_REG_RSTCTRL);
|
||||
+ t &= ~RT3883_RSTCTRL_PCIE;
|
||||
+ rt_sysc_w32(t, RT3883_SYSC_REG_RSTCTRL);
|
||||
+
|
||||
+ /* turn off PCIe clock */
|
||||
+ t = rt_sysc_r32(RT3883_SYSC_REG_CLKCFG1);
|
||||
+ t &= ~RT3883_CLKCFG1_PCIE_CLK_EN;
|
||||
+ rt_sysc_w32(t, RT3883_SYSC_REG_CLKCFG1);
|
||||
+
|
||||
+ t = rt_sysc_r32(RT3883_SYSC_REG_PCIE_CLK_GEN0);
|
||||
+ t &= ~0xf000c080;
|
||||
+ rt_sysc_w32(t, RT3883_SYSC_REG_PCIE_CLK_GEN0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* enable PCI arbiter */
|
||||
+ rt3883_pci_w32(rpc, 0x79, RT3883_PCI_REG_ARBCTL);
|
||||
+}
|
||||
+
|
||||
+static int rt3883_pci_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct rt3883_pci_controller *rpc;
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct device_node *np = dev->of_node;
|
||||
+ struct resource *res;
|
||||
+ struct device_node *child;
|
||||
+ u32 val;
|
||||
+ int err;
|
||||
+ int mode;
|
||||
+
|
||||
+ rpc = devm_kzalloc(dev, sizeof(*rpc), GFP_KERNEL);
|
||||
+ if (!rpc)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ if (!res)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ rpc->base = devm_ioremap_resource(dev, res);
|
||||
+ if (IS_ERR(rpc->base))
|
||||
+ return PTR_ERR(rpc->base);
|
||||
+
|
||||
+ /* find the interrupt controller child node */
|
||||
+ for_each_child_of_node(np, child) {
|
||||
+ if (of_get_property(child, "interrupt-controller", NULL) &&
|
||||
+ of_node_get(child)) {
|
||||
+ rpc->intc_of_node = child;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!rpc->intc_of_node) {
|
||||
+ dev_err(dev, "%s has no %s child node",
|
||||
+ of_node_full_name(rpc->intc_of_node),
|
||||
+ "interrupt controller");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ /* find the PCI host bridge child node */
|
||||
+ for_each_child_of_node(np, child) {
|
||||
+ if (child->type &&
|
||||
+ of_node_cmp(child->type, "pci") == 0 &&
|
||||
+ of_node_get(child)) {
|
||||
+ rpc->pci_controller.of_node = child;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!rpc->pci_controller.of_node) {
|
||||
+ dev_err(dev, "%s has no %s child node",
|
||||
+ of_node_full_name(rpc->intc_of_node),
|
||||
+ "PCI host bridge");
|
||||
+ err = -EINVAL;
|
||||
+ goto err_put_intc_node;
|
||||
+ }
|
||||
+
|
||||
+ mode = RT3883_PCI_MODE_NONE;
|
||||
+ for_each_available_child_of_node(rpc->pci_controller.of_node, child) {
|
||||
+ int devfn;
|
||||
+
|
||||
+ if (!child->type ||
|
||||
+ of_node_cmp(child->type, "pci") != 0)
|
||||
+ continue;
|
||||
+
|
||||
+ devfn = of_pci_get_devfn(child);
|
||||
+ if (devfn < 0)
|
||||
+ continue;
|
||||
+
|
||||
+ switch (PCI_SLOT(devfn)) {
|
||||
+ case 1:
|
||||
+ mode |= RT3883_PCI_MODE_PCIE;
|
||||
+ break;
|
||||
+
|
||||
+ case 17:
|
||||
+ case 18:
|
||||
+ mode |= RT3883_PCI_MODE_PCI;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (mode == RT3883_PCI_MODE_NONE) {
|
||||
+ dev_err(dev, "unable to determine PCI mode\n");
|
||||
+ err = -EINVAL;
|
||||
+ goto err_put_hb_node;
|
||||
+ }
|
||||
+
|
||||
+ dev_info(dev, "mode:%s%s\n",
|
||||
+ (mode & RT3883_PCI_MODE_PCI) ? " PCI" : "",
|
||||
+ (mode & RT3883_PCI_MODE_PCIE) ? " PCIe" : "");
|
||||
+
|
||||
+ rt3883_pci_preinit(rpc, mode);
|
||||
+
|
||||
+ rpc->pci_controller.pci_ops = &rt3883_pci_ops;
|
||||
+ rpc->pci_controller.io_resource = &rpc->io_res;
|
||||
+ rpc->pci_controller.mem_resource = &rpc->mem_res;
|
||||
+
|
||||
+ /* Load PCI I/O and memory resources from DT */
|
||||
+ pci_load_of_ranges(&rpc->pci_controller,
|
||||
+ rpc->pci_controller.of_node);
|
||||
+
|
||||
+ rt3883_pci_w32(rpc, rpc->mem_res.start, RT3883_PCI_REG_MEMBASE);
|
||||
+ rt3883_pci_w32(rpc, rpc->io_res.start, RT3883_PCI_REG_IOBASE);
|
||||
+
|
||||
+ ioport_resource.start = rpc->io_res.start;
|
||||
+ ioport_resource.end = rpc->io_res.end;
|
||||
+
|
||||
+ /* PCI */
|
||||
+ rt3883_pci_w32(rpc, 0x03ff0000, RT3883_PCI_REG_BAR0SETUP(0));
|
||||
+ rt3883_pci_w32(rpc, RT3883_MEMORY_BASE, RT3883_PCI_REG_IMBASEBAR0(0));
|
||||
+ rt3883_pci_w32(rpc, 0x08021814, RT3883_PCI_REG_ID(0));
|
||||
+ rt3883_pci_w32(rpc, 0x00800001, RT3883_PCI_REG_CLASS(0));
|
||||
+ rt3883_pci_w32(rpc, 0x28801814, RT3883_PCI_REG_SUBID(0));
|
||||
+
|
||||
+ /* PCIe */
|
||||
+ rt3883_pci_w32(rpc, 0x03ff0000, RT3883_PCI_REG_BAR0SETUP(1));
|
||||
+ rt3883_pci_w32(rpc, RT3883_MEMORY_BASE, RT3883_PCI_REG_IMBASEBAR0(1));
|
||||
+ rt3883_pci_w32(rpc, 0x08021814, RT3883_PCI_REG_ID(1));
|
||||
+ rt3883_pci_w32(rpc, 0x06040001, RT3883_PCI_REG_CLASS(1));
|
||||
+ rt3883_pci_w32(rpc, 0x28801814, RT3883_PCI_REG_SUBID(1));
|
||||
+
|
||||
+ err = rt3883_pci_irq_init(dev, rpc);
|
||||
+ if (err)
|
||||
+ goto err_put_hb_node;
|
||||
+
|
||||
+ /* PCIe */
|
||||
+ val = rt3883_pci_read_cfg32(rpc, 0, 0x01, 0, PCI_COMMAND);
|
||||
+ val |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
|
||||
+ rt3883_pci_write_cfg32(rpc, 0, 0x01, 0, PCI_COMMAND, val);
|
||||
+
|
||||
+ /* PCI */
|
||||
+ val = rt3883_pci_read_cfg32(rpc, 0, 0x00, 0, PCI_COMMAND);
|
||||
+ val |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
|
||||
+ rt3883_pci_write_cfg32(rpc, 0, 0x00, 0, PCI_COMMAND, val);
|
||||
+
|
||||
+ if (mode == RT3883_PCI_MODE_PCIE) {
|
||||
+ rt3883_pci_w32(rpc, 0x03ff0001, RT3883_PCI_REG_BAR0SETUP(0));
|
||||
+ rt3883_pci_w32(rpc, 0x03ff0001, RT3883_PCI_REG_BAR0SETUP(1));
|
||||
+
|
||||
+ rt3883_pci_write_cfg32(rpc, 0, RT3883_P2P_BR_DEVNUM, 0,
|
||||
+ PCI_BASE_ADDRESS_0,
|
||||
+ RT3883_MEMORY_BASE);
|
||||
+ /* flush write */
|
||||
+ rt3883_pci_read_cfg32(rpc, 0, RT3883_P2P_BR_DEVNUM, 0,
|
||||
+ PCI_BASE_ADDRESS_0);
|
||||
+ } else {
|
||||
+ rt3883_pci_write_cfg32(rpc, 0, RT3883_P2P_BR_DEVNUM, 0,
|
||||
+ PCI_IO_BASE, 0x00000101);
|
||||
+ }
|
||||
+
|
||||
+ register_pci_controller(&rpc->pci_controller);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+err_put_hb_node:
|
||||
+ of_node_put(rpc->pci_controller.of_node);
|
||||
+err_put_intc_node:
|
||||
+ of_node_put(rpc->intc_of_node);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
||||
+{
|
||||
+ struct of_irq dev_irq;
|
||||
+ int err;
|
||||
+ int irq;
|
||||
+
|
||||
+ err = of_irq_map_pci(dev, &dev_irq);
|
||||
+ if (err) {
|
||||
+ pr_err("pci %s: unable to get irq map, err=%d\n",
|
||||
+ pci_name((struct pci_dev *) dev), err);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ irq = irq_create_of_mapping(dev_irq.controller,
|
||||
+ dev_irq.specifier,
|
||||
+ dev_irq.size);
|
||||
+
|
||||
+ if (irq == 0)
|
||||
+ pr_crit("pci %s: no irq found for pin %u\n",
|
||||
+ pci_name((struct pci_dev *) dev), pin);
|
||||
+ else
|
||||
+ pr_info("pci %s: using irq %d for pin %u\n",
|
||||
+ pci_name((struct pci_dev *) dev), irq, pin);
|
||||
+
|
||||
+ return irq;
|
||||
+}
|
||||
+
|
||||
+int pcibios_plat_dev_init(struct pci_dev *dev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id rt3883_pci_ids[] = {
|
||||
+ { .compatible = "ralink,rt3883-pci" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rt3883_pci_ids);
|
||||
+
|
||||
+static struct platform_driver rt3883_pci_driver = {
|
||||
+ .probe = rt3883_pci_probe,
|
||||
+ .driver = {
|
||||
+ .name = "rt3883-pci",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = of_match_ptr(rt3883_pci_ids),
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init rt3883_pci_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&rt3883_pci_driver);
|
||||
+}
|
||||
+
|
||||
+postcore_initcall(rt3883_pci_init);
|
||||
--- a/arch/mips/ralink/Kconfig
|
||||
+++ b/arch/mips/ralink/Kconfig
|
||||
@@ -26,6 +26,7 @@ choice
|
||||
bool "RT3883"
|
||||
select USB_ARCH_HAS_OHCI
|
||||
select USB_ARCH_HAS_EHCI
|
||||
+ select HW_HAS_PCI
|
||||
|
||||
config SOC_MT7620
|
||||
bool "MT7620"
|
|
@ -1,80 +0,0 @@
|
|||
From 1be15a87eea5f26fb24b6aac332530cd3e2d984e Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 14 Jul 2013 23:08:11 +0200
|
||||
Subject: [PATCH 100/133] MIPS: use set_mode() to enable/disable the cevt-r4k
|
||||
irq
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/kernel/cevt-r4k.c | 39 ++++++++++++++++++++++++++-------------
|
||||
1 file changed, 26 insertions(+), 13 deletions(-)
|
||||
|
||||
--- a/arch/mips/kernel/cevt-r4k.c
|
||||
+++ b/arch/mips/kernel/cevt-r4k.c
|
||||
@@ -38,12 +38,6 @@ static int mips_next_event(unsigned long
|
||||
|
||||
#endif /* CONFIG_MIPS_MT_SMTC */
|
||||
|
||||
-void mips_set_clock_mode(enum clock_event_mode mode,
|
||||
- struct clock_event_device *evt)
|
||||
-{
|
||||
- /* Nothing to do ... */
|
||||
-}
|
||||
-
|
||||
DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
|
||||
int cp0_timer_irq_installed;
|
||||
|
||||
@@ -90,9 +84,38 @@ struct irqaction c0_compare_irqaction =
|
||||
.name = "timer",
|
||||
};
|
||||
|
||||
+void mips_set_clock_mode(enum clock_event_mode mode,
|
||||
+ struct clock_event_device *evt)
|
||||
+{
|
||||
+#ifdef CONFIG_CEVT_SYSTICK_QUIRK
|
||||
+ switch (mode) {
|
||||
+ case CLOCK_EVT_MODE_ONESHOT:
|
||||
+ if (cp0_timer_irq_installed)
|
||||
+ break;
|
||||
+
|
||||
+ cp0_timer_irq_installed = 1;
|
||||
+
|
||||
+ setup_irq(evt->irq, &c0_compare_irqaction);
|
||||
+ break;
|
||||
+
|
||||
+ case CLOCK_EVT_MODE_SHUTDOWN:
|
||||
+ if (!cp0_timer_irq_installed)
|
||||
+ break;
|
||||
+
|
||||
+ cp0_timer_irq_installed = 0;
|
||||
+ free_irq(evt->irq, &c0_compare_irqaction);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ pr_err("Unhandeled mips clock_mode\n");
|
||||
+ break;
|
||||
+ }
|
||||
+#endif
|
||||
+}
|
||||
|
||||
void mips_event_handler(struct clock_event_device *dev)
|
||||
{
|
||||
+
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -215,12 +238,14 @@ int __cpuinit r4k_clockevent_init(void)
|
||||
#endif
|
||||
clockevents_register_device(cd);
|
||||
|
||||
+#ifndef CONFIG_CEVT_SYSTICK_QUIRK
|
||||
if (cp0_timer_irq_installed)
|
||||
return 0;
|
||||
|
||||
cp0_timer_irq_installed = 1;
|
||||
|
||||
setup_irq(irq, &c0_compare_irqaction);
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
From 5689333e7e4396a827a2cb6fa1242159e9af56de Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Mon, 20 May 2013 20:57:09 +0200
|
||||
Subject: [PATCH 101/133] MIPS: ralink: add verbose pmu info
|
||||
|
||||
Print the PMU and LDO settings on boot.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/mt7620.c | 26 ++++++++++++++++++++++++++
|
||||
1 file changed, 26 insertions(+)
|
||||
|
||||
--- a/arch/mips/ralink/mt7620.c
|
||||
+++ b/arch/mips/ralink/mt7620.c
|
||||
@@ -26,6 +26,22 @@
|
||||
#define CLKCFG_FFRAC_MASK 0x001f
|
||||
#define CLKCFG_FFRAC_USB_VAL 0x0003
|
||||
|
||||
+/* analog */
|
||||
+#define PMU0_CFG 0x88
|
||||
+#define PMU_SW_SET BIT(28)
|
||||
+#define A_DCDC_EN BIT(24)
|
||||
+#define A_SSC_PERI BIT(19)
|
||||
+#define A_SSC_GEN BIT(18)
|
||||
+#define A_SSC_M 0x3
|
||||
+#define A_SSC_S 16
|
||||
+#define A_DLY_M 0x7
|
||||
+#define A_DLY_S 8
|
||||
+#define A_VTUNE_M 0xff
|
||||
+
|
||||
+/* digital */
|
||||
+#define PMU1_CFG 0x8C
|
||||
+#define DIG_SW_SEL BIT(25)
|
||||
+
|
||||
/* does the board have sdram or ddram */
|
||||
static int dram_type;
|
||||
|
||||
@@ -208,6 +224,8 @@ void prom_soc_init(struct ralink_soc_inf
|
||||
u32 n1;
|
||||
u32 rev;
|
||||
u32 cfg0;
|
||||
+ u32 pmu0;
|
||||
+ u32 pmu1;
|
||||
|
||||
n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0);
|
||||
n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1);
|
||||
@@ -255,4 +273,12 @@ void prom_soc_init(struct ralink_soc_inf
|
||||
BUG();
|
||||
}
|
||||
soc_info->mem_base = MT7620_DRAM_BASE;
|
||||
+
|
||||
+ pmu0 = __raw_readl(sysc + PMU0_CFG);
|
||||
+ pmu1 = __raw_readl(sysc + PMU1_CFG);
|
||||
+
|
||||
+ pr_info("Analog PMU set to %s control\n",
|
||||
+ (pmu0 & PMU_SW_SET) ? ("sw") : ("hw"));
|
||||
+ pr_info("Digital PMU set to %s control\n",
|
||||
+ (pmu1 & DIG_SW_SEL) ? ("sw") : ("hw"));
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
From 23d18a1b3d0a7e5faa08b6bece6692667c930975 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Tue, 21 May 2013 15:50:31 +0200
|
||||
Subject: [PATCH 102/133] MIPS: ralink: adds a bootrom dumper module
|
||||
|
||||
This patch adds a trivial driver that allows userland to extract the bootrom of
|
||||
a SoC via debugfs.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/Makefile | 2 ++
|
||||
arch/mips/ralink/bootrom.c | 48 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 50 insertions(+)
|
||||
create mode 100644 arch/mips/ralink/bootrom.c
|
||||
|
||||
--- a/arch/mips/ralink/Makefile
|
||||
+++ b/arch/mips/ralink/Makefile
|
||||
@@ -17,4 +17,6 @@ obj-$(CONFIG_SOC_MT7620) += mt7620.o
|
||||
|
||||
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
|
||||
|
||||
+obj-$(CONFIG_DEBUG_FS) += bootrom.o
|
||||
+
|
||||
obj-y += dts/
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/ralink/bootrom.c
|
||||
@@ -0,0 +1,48 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/debugfs.h>
|
||||
+#include <linux/seq_file.h>
|
||||
+
|
||||
+#define BOOTROM_OFFSET 0x10118000
|
||||
+#define BOOTROM_SIZE 0x8000
|
||||
+
|
||||
+static void __iomem *membase = (void __iomem*) KSEG1ADDR(BOOTROM_OFFSET);
|
||||
+
|
||||
+static int bootrom_show(struct seq_file *s, void *unused)
|
||||
+{
|
||||
+ seq_write(s, membase, BOOTROM_SIZE);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int bootrom_open(struct inode *inode, struct file *file)
|
||||
+{
|
||||
+ return single_open(file, bootrom_show, NULL);
|
||||
+}
|
||||
+
|
||||
+static const struct file_operations bootrom_file_ops = {
|
||||
+ .open = bootrom_open,
|
||||
+ .read = seq_read,
|
||||
+ .llseek = seq_lseek,
|
||||
+ .release = single_release,
|
||||
+};
|
||||
+
|
||||
+static int bootrom_setup(void)
|
||||
+{
|
||||
+ if (!debugfs_create_file("bootrom", 0444,
|
||||
+ NULL, NULL, &bootrom_file_ops)) {
|
||||
+ pr_err("Failed to create bootrom debugfs file\n");
|
||||
+
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+postcore_initcall(bootrom_setup);
|
|
@ -1,113 +0,0 @@
|
|||
From c5fe00f24f56b15f982dda355089986d57488b36 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Thu, 16 May 2013 23:28:23 +0200
|
||||
Subject: [PATCH 103/133] MIPS: ralink: add illegal access driver
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/Makefile | 2 +
|
||||
arch/mips/ralink/ill_acc.c | 87 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 89 insertions(+)
|
||||
create mode 100644 arch/mips/ralink/ill_acc.c
|
||||
|
||||
--- a/arch/mips/ralink/Makefile
|
||||
+++ b/arch/mips/ralink/Makefile
|
||||
@@ -10,6 +10,8 @@ obj-y := prom.o of.o reset.o clk.o irq.o
|
||||
|
||||
obj-$(CONFIG_CLKEVT_RT3352) += cevt-rt3352.o
|
||||
|
||||
+obj-$(CONFIG_RALINK_ILL_ACC) += ill_acc.o
|
||||
+
|
||||
obj-$(CONFIG_SOC_RT288X) += rt288x.o
|
||||
obj-$(CONFIG_SOC_RT305X) += rt305x.o
|
||||
obj-$(CONFIG_SOC_RT3883) += rt3883.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/ralink/ill_acc.c
|
||||
@@ -0,0 +1,87 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/of_platform.h>
|
||||
+#include <linux/of_irq.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/ralink_regs.h>
|
||||
+
|
||||
+#define REG_ILL_ACC_ADDR 0x10
|
||||
+#define REG_ILL_ACC_TYPE 0x14
|
||||
+
|
||||
+#define ILL_INT_STATUS BIT(31)
|
||||
+#define ILL_ACC_WRITE BIT(30)
|
||||
+#define ILL_ACC_LEN_M 0xff
|
||||
+#define ILL_ACC_OFF_M 0xf
|
||||
+#define ILL_ACC_OFF_S 16
|
||||
+#define ILL_ACC_ID_M 0x7
|
||||
+#define ILL_ACC_ID_S 8
|
||||
+
|
||||
+#define DRV_NAME "ill_acc"
|
||||
+
|
||||
+static const char *ill_acc_ids[] = {
|
||||
+ "cpu", "dma", "ppe", "pdma rx","pdma tx", "pci/e", "wmac", "usb",
|
||||
+};
|
||||
+
|
||||
+static irqreturn_t ill_acc_irq_handler(int irq, void *_priv)
|
||||
+{
|
||||
+ struct device *dev = (struct device *) _priv;
|
||||
+ u32 addr = rt_memc_r32(REG_ILL_ACC_ADDR);
|
||||
+ u32 type = rt_memc_r32(REG_ILL_ACC_TYPE);
|
||||
+
|
||||
+ dev_err(dev, "illegal %s access from %s - addr:0x%08x offset:%d len:%d\n",
|
||||
+ (type & ILL_ACC_WRITE) ? ("write") : ("read"),
|
||||
+ ill_acc_ids[(type >> ILL_ACC_ID_S) & ILL_ACC_ID_M],
|
||||
+ addr, (type >> ILL_ACC_OFF_S) & ILL_ACC_OFF_M,
|
||||
+ type & ILL_ACC_LEN_M);
|
||||
+
|
||||
+ rt_memc_w32(REG_ILL_ACC_TYPE, REG_ILL_ACC_TYPE);
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static int __init ill_acc_of_setup(void)
|
||||
+{
|
||||
+ struct platform_device *pdev;
|
||||
+ struct device_node *np;
|
||||
+ int irq;
|
||||
+
|
||||
+ /* somehow this driver breaks on RT5350 */
|
||||
+ if (of_machine_is_compatible("ralink,rt5350-soc"))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ np = of_find_compatible_node(NULL, NULL, "ralink,rt3050-memc");
|
||||
+ if (!np)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ pdev = of_find_device_by_node(np);
|
||||
+ if (!pdev) {
|
||||
+ pr_err("%s: failed to lookup pdev\n", np->name);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ irq = irq_of_parse_and_map(np, 0);
|
||||
+ if (!irq) {
|
||||
+ dev_err(&pdev->dev, "failed to get irq\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (request_irq(irq, ill_acc_irq_handler, 0, "ill_acc", &pdev->dev)) {
|
||||
+ dev_err(&pdev->dev, "failed to request irq\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ rt_memc_w32(ILL_INT_STATUS, REG_ILL_ACC_TYPE);
|
||||
+
|
||||
+ dev_info(&pdev->dev, "irq registered\n");
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+arch_initcall(ill_acc_of_setup);
|
|
@ -1,24 +0,0 @@
|
|||
From b83808826ac7a5c727f5314b5a3bf07fcd6ec929 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Thu, 23 May 2013 18:50:56 +0200
|
||||
Subject: [PATCH 104/133] MIPS: ralink: workaround DTB memory issue
|
||||
|
||||
If the DTB is too big a bug happens on boot when init ram is freed.
|
||||
This is a temporary fix until the real cause is found.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/of.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/mips/ralink/of.c
|
||||
+++ b/arch/mips/ralink/of.c
|
||||
@@ -74,7 +74,7 @@ void __init device_tree_init(void)
|
||||
unflatten_device_tree();
|
||||
|
||||
/* free the space reserved for the dt blob */
|
||||
- free_bootmem(base, size);
|
||||
+ //free_bootmem(base, size);
|
||||
}
|
||||
|
||||
void __init plat_mem_setup(void)
|
|
@ -1,25 +0,0 @@
|
|||
From 6f72aea69951479b7daad1d38b506ede4f8a1676 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 16 Mar 2014 04:38:07 +0000
|
||||
Subject: [PATCH 105/133] MIPS: ralink: add missing clk_set_rate() to clk.c
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/clk.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- a/arch/mips/ralink/clk.c
|
||||
+++ b/arch/mips/ralink/clk.c
|
||||
@@ -56,6 +56,12 @@ unsigned long clk_get_rate(struct clk *c
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(clk_get_rate);
|
||||
|
||||
+int clk_set_rate(struct clk *clk, unsigned long rate)
|
||||
+{
|
||||
+ return -1;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(clk_set_rate);
|
||||
+
|
||||
void __init plat_time_init(void)
|
||||
{
|
||||
struct clk *clk;
|
|
@ -1,66 +0,0 @@
|
|||
From 45ba0675286e2a71f6a577833ab13b951bb7e31a Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 16 Mar 2014 04:40:02 +0000
|
||||
Subject: [PATCH 106/133] MIPS: ralink: add support for MT7620n
|
||||
|
||||
This is the small version of MT7620a.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/include/asm/mach-ralink/mt7620.h | 7 ++-----
|
||||
arch/mips/ralink/mt7620.c | 19 ++++++++++++-------
|
||||
2 files changed, 14 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/arch/mips/include/asm/mach-ralink/mt7620.h
|
||||
+++ b/arch/mips/include/asm/mach-ralink/mt7620.h
|
||||
@@ -24,11 +24,8 @@
|
||||
#define SYSC_REG_CPLL_CONFIG0 0x54
|
||||
#define SYSC_REG_CPLL_CONFIG1 0x58
|
||||
|
||||
-#define MT7620N_CHIP_NAME0 0x33365452
|
||||
-#define MT7620N_CHIP_NAME1 0x20203235
|
||||
-
|
||||
-#define MT7620A_CHIP_NAME0 0x3637544d
|
||||
-#define MT7620A_CHIP_NAME1 0x20203032
|
||||
+#define MT7620_CHIP_NAME0 0x3637544d
|
||||
+#define MT7620_CHIP_NAME1 0x20203032
|
||||
|
||||
#define CHIP_REV_PKG_MASK 0x1
|
||||
#define CHIP_REV_PKG_SHIFT 16
|
||||
--- a/arch/mips/ralink/mt7620.c
|
||||
+++ b/arch/mips/ralink/mt7620.c
|
||||
@@ -226,22 +226,27 @@ void prom_soc_init(struct ralink_soc_inf
|
||||
u32 cfg0;
|
||||
u32 pmu0;
|
||||
u32 pmu1;
|
||||
+ u32 bga;
|
||||
|
||||
n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0);
|
||||
n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1);
|
||||
+ rev = __raw_readl(sysc + SYSC_REG_CHIP_REV);
|
||||
+ bga = (rev >> CHIP_REV_PKG_SHIFT) & CHIP_REV_PKG_MASK;
|
||||
|
||||
- if (n0 == MT7620N_CHIP_NAME0 && n1 == MT7620N_CHIP_NAME1) {
|
||||
- name = "MT7620N";
|
||||
- soc_info->compatible = "ralink,mt7620n-soc";
|
||||
- } else if (n0 == MT7620A_CHIP_NAME0 && n1 == MT7620A_CHIP_NAME1) {
|
||||
+ if (n0 != MT7620_CHIP_NAME0 || n1 != MT7620_CHIP_NAME1)
|
||||
+ panic("mt7620: unknown SoC, n0:%08x n1:%08x\n", n0, n1);
|
||||
+
|
||||
+ if (bga) {
|
||||
name = "MT7620A";
|
||||
soc_info->compatible = "ralink,mt7620a-soc";
|
||||
} else {
|
||||
- panic("mt7620: unknown SoC, n0:%08x n1:%08x\n", n0, n1);
|
||||
+ name = "MT7620N";
|
||||
+ soc_info->compatible = "ralink,mt7620n-soc";
|
||||
+#ifdef CONFIG_PCI
|
||||
+ panic("mt7620n is only supported for non pci kernels");
|
||||
+#endif
|
||||
}
|
||||
|
||||
- rev = __raw_readl(sysc + SYSC_REG_CHIP_REV);
|
||||
-
|
||||
snprintf(soc_info->sys_type, RAMIPS_SYS_TYPE_LEN,
|
||||
"Ralink %s ver:%u eco:%u",
|
||||
name,
|
|
@ -1,45 +0,0 @@
|
|||
From ee46d05eefefb0fb40b5682b4f6f3876b496044b Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 16 Mar 2014 04:40:48 +0000
|
||||
Subject: [PATCH 107/133] MIPS: ralink: allow manual memory override
|
||||
|
||||
RT5350 relies on the bootloader setting up the memc correctly.
|
||||
On sme boards the setup is incorrect leading to 32 MB being available but only 16 being recognized. Allow these boards to manually override the memory range
|
||||
.
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/of.c | 16 +++++++++++++++-
|
||||
1 file changed, 15 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/mips/ralink/of.c
|
||||
+++ b/arch/mips/ralink/of.c
|
||||
@@ -77,6 +77,17 @@ void __init device_tree_init(void)
|
||||
//free_bootmem(base, size);
|
||||
}
|
||||
|
||||
+static int memory_dtb;
|
||||
+
|
||||
+static int __init early_init_dt_find_memory(unsigned long node, const char *uname,
|
||||
+ int depth, void *data)
|
||||
+{
|
||||
+ if (depth == 1 && !strcmp(uname, "memory@0"))
|
||||
+ memory_dtb = 1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
void __init plat_mem_setup(void)
|
||||
{
|
||||
set_io_port_base(KSEG1);
|
||||
@@ -87,7 +98,10 @@ void __init plat_mem_setup(void)
|
||||
*/
|
||||
__dt_setup_arch(&__dtb_start);
|
||||
|
||||
- if (soc_info.mem_size)
|
||||
+ of_scan_flat_dt(early_init_dt_find_memory, NULL);
|
||||
+ if (memory_dtb)
|
||||
+ of_scan_flat_dt(early_init_dt_scan_memory, NULL);
|
||||
+ else if (soc_info.mem_size)
|
||||
add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
|
||||
BOOT_MEM_RAM);
|
||||
else
|
|
@ -1,26 +0,0 @@
|
|||
From 1fe4d719d1c973c01f4b6a4c0de47bfac77e3eca Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 19 May 2013 00:42:23 +0200
|
||||
Subject: [PATCH 108/133] MIPS: ralink: add rt_sysc_m32 helper
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/include/asm/mach-ralink/ralink_regs.h | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- a/arch/mips/include/asm/mach-ralink/ralink_regs.h
|
||||
+++ b/arch/mips/include/asm/mach-ralink/ralink_regs.h
|
||||
@@ -26,6 +26,13 @@ static inline u32 rt_sysc_r32(unsigned r
|
||||
return __raw_readl(rt_sysc_membase + reg);
|
||||
}
|
||||
|
||||
+static inline void rt_sysc_m32(u32 clr, u32 set, unsigned reg)
|
||||
+{
|
||||
+ u32 val = rt_sysc_r32(reg) & ~clr;
|
||||
+
|
||||
+ __raw_writel(val | set, rt_sysc_membase + reg);
|
||||
+}
|
||||
+
|
||||
static inline void rt_memc_w32(u32 val, unsigned reg)
|
||||
{
|
||||
__raw_writel(val, rt_memc_membase + reg);
|
|
@ -1,301 +0,0 @@
|
|||
From ca21f813087ca5a8b02ec00efcd9c3f3fbf3bc1f Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 24 Mar 2013 17:17:17 +0100
|
||||
Subject: [PATCH 109/133] MIPS: ralink: add pseudo pwm led trigger based on
|
||||
timer0
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/timer.c | 213 ++++++++++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 197 insertions(+), 16 deletions(-)
|
||||
|
||||
--- a/arch/mips/ralink/timer.c
|
||||
+++ b/arch/mips/ralink/timer.c
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <linux/timer.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/clk.h>
|
||||
+#include <linux/leds.h>
|
||||
+#include <linux/slab.h>
|
||||
|
||||
#include <asm/mach-ralink/ralink_regs.h>
|
||||
|
||||
@@ -23,16 +25,34 @@
|
||||
|
||||
#define TMR0CTL_ENABLE BIT(7)
|
||||
#define TMR0CTL_MODE_PERIODIC BIT(4)
|
||||
-#define TMR0CTL_PRESCALER 1
|
||||
+#define TMR0CTL_PRESCALER 2
|
||||
#define TMR0CTL_PRESCALE_VAL (0xf - TMR0CTL_PRESCALER)
|
||||
#define TMR0CTL_PRESCALE_DIV (65536 / BIT(TMR0CTL_PRESCALER))
|
||||
|
||||
+struct rt_timer_gpio {
|
||||
+ struct list_head list;
|
||||
+ struct led_classdev *led;
|
||||
+};
|
||||
+
|
||||
struct rt_timer {
|
||||
- struct device *dev;
|
||||
- void __iomem *membase;
|
||||
- int irq;
|
||||
- unsigned long timer_freq;
|
||||
- unsigned long timer_div;
|
||||
+ struct device *dev;
|
||||
+ void __iomem *membase;
|
||||
+ int irq;
|
||||
+
|
||||
+ unsigned long timer_freq;
|
||||
+ unsigned long timer_div;
|
||||
+
|
||||
+ struct list_head gpios;
|
||||
+ struct led_trigger led_trigger;
|
||||
+ unsigned int duty_cycle;
|
||||
+ unsigned int duty;
|
||||
+
|
||||
+ unsigned int fade;
|
||||
+ unsigned int fade_min;
|
||||
+ unsigned int fade_max;
|
||||
+ unsigned int fade_speed;
|
||||
+ unsigned int fade_dir;
|
||||
+ unsigned int fade_count;
|
||||
};
|
||||
|
||||
static inline void rt_timer_w32(struct rt_timer *rt, u8 reg, u32 val)
|
||||
@@ -48,18 +68,46 @@ static inline u32 rt_timer_r32(struct rt
|
||||
static irqreturn_t rt_timer_irq(int irq, void *_rt)
|
||||
{
|
||||
struct rt_timer *rt = (struct rt_timer *) _rt;
|
||||
+ struct rt_timer_gpio *gpio;
|
||||
+ unsigned int val;
|
||||
|
||||
- rt_timer_w32(rt, TIMER_REG_TMR0LOAD, rt->timer_freq / rt->timer_div);
|
||||
+ if (rt->fade && (rt->fade_count++ > rt->fade_speed)) {
|
||||
+ rt->fade_count = 0;
|
||||
+ if (rt->duty_cycle <= rt->fade_min)
|
||||
+ rt->fade_dir = 1;
|
||||
+ else if (rt->duty_cycle >= rt->fade_max)
|
||||
+ rt->fade_dir = 0;
|
||||
+
|
||||
+ if (rt->fade_dir)
|
||||
+ rt->duty_cycle += 1;
|
||||
+ else
|
||||
+ rt->duty_cycle -= 1;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ val = rt->timer_freq / rt->timer_div;
|
||||
+ if (rt->duty)
|
||||
+ val *= rt->duty_cycle;
|
||||
+ else
|
||||
+ val *= (100 - rt->duty_cycle);
|
||||
+ val /= 100;
|
||||
+
|
||||
+ if (!list_empty(&rt->gpios))
|
||||
+ list_for_each_entry(gpio, &rt->gpios, list)
|
||||
+ led_set_brightness(gpio->led, !!rt->duty);
|
||||
+
|
||||
+ rt->duty = !rt->duty;
|
||||
+
|
||||
+ rt_timer_w32(rt, TIMER_REG_TMR0LOAD, val + 1);
|
||||
rt_timer_w32(rt, TIMER_REG_TMRSTAT, TMRSTAT_TMR0INT);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
-
|
||||
static int rt_timer_request(struct rt_timer *rt)
|
||||
{
|
||||
- int err = request_irq(rt->irq, rt_timer_irq, IRQF_DISABLED,
|
||||
- dev_name(rt->dev), rt);
|
||||
+ int err = devm_request_irq(rt->dev, rt->irq, rt_timer_irq,
|
||||
+ IRQF_DISABLED, dev_name(rt->dev), rt);
|
||||
if (err) {
|
||||
dev_err(rt->dev, "failed to request irq\n");
|
||||
} else {
|
||||
@@ -81,8 +129,6 @@ static int rt_timer_config(struct rt_tim
|
||||
else
|
||||
rt->timer_div = divisor;
|
||||
|
||||
- rt_timer_w32(rt, TIMER_REG_TMR0LOAD, rt->timer_freq / rt->timer_div);
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -108,11 +154,128 @@ static void rt_timer_disable(struct rt_t
|
||||
rt_timer_w32(rt, TIMER_REG_TMR0CTL, t);
|
||||
}
|
||||
|
||||
+static ssize_t led_fade_show(struct device *dev,
|
||||
+ struct device_attribute *attr, char *buf)
|
||||
+{
|
||||
+ struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||
+ struct rt_timer *rt = container_of(led_cdev->trigger, struct rt_timer, led_trigger);
|
||||
+
|
||||
+ return sprintf(buf, "speed: %d, min: %d, max: %d\n", rt->fade_speed, rt->fade_min, rt->fade_max);
|
||||
+}
|
||||
+
|
||||
+static ssize_t led_fade_store(struct device *dev,
|
||||
+ struct device_attribute *attr, const char *buf, size_t size)
|
||||
+{
|
||||
+ struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||
+ struct rt_timer *rt = container_of(led_cdev->trigger, struct rt_timer, led_trigger);
|
||||
+ unsigned int speed = 0, min = 0, max = 0;
|
||||
+ ssize_t ret = -EINVAL;
|
||||
+
|
||||
+ ret = sscanf(buf, "%u %u %u", &speed, &min, &max);
|
||||
+
|
||||
+ if (ret == 3) {
|
||||
+ rt->fade_speed = speed;
|
||||
+ rt->fade_min = min;
|
||||
+ rt->fade_max = max;
|
||||
+ rt->fade = 1;
|
||||
+ } else {
|
||||
+ rt->fade = 0;
|
||||
+ }
|
||||
+
|
||||
+ return size;
|
||||
+}
|
||||
+
|
||||
+static DEVICE_ATTR(fade, 0644, led_fade_show, led_fade_store);
|
||||
+
|
||||
+static ssize_t led_duty_cycle_show(struct device *dev,
|
||||
+ struct device_attribute *attr, char *buf)
|
||||
+{
|
||||
+ struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||
+ struct rt_timer *rt = container_of(led_cdev->trigger, struct rt_timer, led_trigger);
|
||||
+
|
||||
+ return sprintf(buf, "%u\n", rt->duty_cycle);
|
||||
+}
|
||||
+
|
||||
+static ssize_t led_duty_cycle_store(struct device *dev,
|
||||
+ struct device_attribute *attr, const char *buf, size_t size)
|
||||
+{
|
||||
+ struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||
+ struct rt_timer *rt = container_of(led_cdev->trigger, struct rt_timer, led_trigger);
|
||||
+ unsigned long state;
|
||||
+ ssize_t ret = -EINVAL;
|
||||
+
|
||||
+ ret = kstrtoul(buf, 10, &state);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ if (state <= 100)
|
||||
+ rt->duty_cycle = state;
|
||||
+ else
|
||||
+ rt->duty_cycle = 100;
|
||||
+
|
||||
+ rt->fade = 0;
|
||||
+
|
||||
+ return size;
|
||||
+}
|
||||
+
|
||||
+static DEVICE_ATTR(duty_cycle, 0644, led_duty_cycle_show, led_duty_cycle_store);
|
||||
+
|
||||
+static void rt_timer_trig_activate(struct led_classdev *led_cdev)
|
||||
+{
|
||||
+ struct rt_timer *rt = container_of(led_cdev->trigger, struct rt_timer, led_trigger);
|
||||
+ struct rt_timer_gpio *gpio_data;
|
||||
+ int rc;
|
||||
+
|
||||
+ led_cdev->trigger_data = NULL;
|
||||
+ gpio_data = kzalloc(sizeof(*gpio_data), GFP_KERNEL);
|
||||
+ if (!gpio_data)
|
||||
+ return;
|
||||
+
|
||||
+ rc = device_create_file(led_cdev->dev, &dev_attr_duty_cycle);
|
||||
+ if (rc)
|
||||
+ goto err_gpio;
|
||||
+ rc = device_create_file(led_cdev->dev, &dev_attr_fade);
|
||||
+ if (rc)
|
||||
+ goto err_out_duty_cycle;
|
||||
+
|
||||
+ led_cdev->activated = true;
|
||||
+ led_cdev->trigger_data = gpio_data;
|
||||
+ gpio_data->led = led_cdev;
|
||||
+ list_add(&gpio_data->list, &rt->gpios);
|
||||
+ led_cdev->trigger_data = gpio_data;
|
||||
+ rt_timer_enable(rt);
|
||||
+ return;
|
||||
+
|
||||
+err_out_duty_cycle:
|
||||
+ device_remove_file(led_cdev->dev, &dev_attr_duty_cycle);
|
||||
+
|
||||
+err_gpio:
|
||||
+ kfree(gpio_data);
|
||||
+}
|
||||
+
|
||||
+static void rt_timer_trig_deactivate(struct led_classdev *led_cdev)
|
||||
+{
|
||||
+ struct rt_timer *rt = container_of(led_cdev->trigger, struct rt_timer, led_trigger);
|
||||
+ struct rt_timer_gpio *gpio_data = (struct rt_timer_gpio*) led_cdev->trigger_data;
|
||||
+
|
||||
+ if (led_cdev->activated) {
|
||||
+ device_remove_file(led_cdev->dev, &dev_attr_duty_cycle);
|
||||
+ device_remove_file(led_cdev->dev, &dev_attr_fade);
|
||||
+ led_cdev->activated = false;
|
||||
+ }
|
||||
+
|
||||
+ list_del(&gpio_data->list);
|
||||
+ rt_timer_disable(rt);
|
||||
+ led_set_brightness(led_cdev, LED_OFF);
|
||||
+}
|
||||
+
|
||||
static int rt_timer_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ const __be32 *divisor;
|
||||
struct rt_timer *rt;
|
||||
struct clk *clk;
|
||||
+ int ret;
|
||||
|
||||
rt = devm_kzalloc(&pdev->dev, sizeof(*rt), GFP_KERNEL);
|
||||
if (!rt) {
|
||||
@@ -140,12 +303,29 @@ static int rt_timer_probe(struct platfor
|
||||
if (!rt->timer_freq)
|
||||
return -EINVAL;
|
||||
|
||||
+ rt->duty_cycle = 100;
|
||||
rt->dev = &pdev->dev;
|
||||
platform_set_drvdata(pdev, rt);
|
||||
|
||||
- rt_timer_request(rt);
|
||||
- rt_timer_config(rt, 2);
|
||||
- rt_timer_enable(rt);
|
||||
+ ret = rt_timer_request(rt);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ divisor = of_get_property(pdev->dev.of_node, "ralink,divisor", NULL);
|
||||
+ if (divisor)
|
||||
+ rt_timer_config(rt, be32_to_cpu(*divisor));
|
||||
+ else
|
||||
+ rt_timer_config(rt, 200);
|
||||
+
|
||||
+ rt->led_trigger.name = "pwmtimer",
|
||||
+ rt->led_trigger.activate = rt_timer_trig_activate,
|
||||
+ rt->led_trigger.deactivate = rt_timer_trig_deactivate,
|
||||
+
|
||||
+ ret = led_trigger_register(&rt->led_trigger);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ INIT_LIST_HEAD(&rt->gpios);
|
||||
|
||||
dev_info(&pdev->dev, "maximum frequncy is %luHz\n", rt->timer_freq);
|
||||
|
||||
@@ -156,6 +336,7 @@ static int rt_timer_remove(struct platfo
|
||||
{
|
||||
struct rt_timer *rt = platform_get_drvdata(pdev);
|
||||
|
||||
+ led_trigger_unregister(&rt->led_trigger);
|
||||
rt_timer_disable(rt);
|
||||
rt_timer_free(rt);
|
||||
|
||||
@@ -180,6 +361,6 @@ static struct platform_driver rt_timer_d
|
||||
|
||||
module_platform_driver(rt_timer_driver);
|
||||
|
||||
-MODULE_DESCRIPTION("Ralink RT2880 timer");
|
||||
+MODULE_DESCRIPTION("Ralink RT2880 timer / pseudo pwm");
|
||||
MODULE_AUTHOR("John Crispin <blogic@openwrt.org");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -1,23 +0,0 @@
|
|||
From f57edea9db0f7f437bc4f2ae408f6dd8bfbb9062 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 16 Mar 2014 04:53:02 +0000
|
||||
Subject: [PATCH 110/133] MIPS: ralink: add a helper for reading the ECO
|
||||
version
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/include/asm/mach-ralink/mt7620.h | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/arch/mips/include/asm/mach-ralink/mt7620.h
|
||||
+++ b/arch/mips/include/asm/mach-ralink/mt7620.h
|
||||
@@ -79,4 +79,9 @@
|
||||
#define MT7620_GPIO_MODE_EPHY BIT(15)
|
||||
#define MT7620_GPIO_MODE_WDT BIT(22)
|
||||
|
||||
+static inline int mt7620_get_eco(void)
|
||||
+{
|
||||
+ return rt_sysc_r32(SYSC_REG_CHIP_REV) & CHIP_REV_ECO_MASK;
|
||||
+}
|
||||
+
|
||||
#endif
|
|
@ -1,662 +0,0 @@
|
|||
From 2d7e32d4825e20e9db4f0dff6b3e3c25c8c7ad7d Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Tue, 3 Dec 2013 17:05:05 +0100
|
||||
Subject: [PATCH 111/133] DMA: ralink: add rt2880 dma engine
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/dma/Kconfig | 6 +
|
||||
drivers/dma/Makefile | 1 +
|
||||
drivers/dma/dmaengine.c | 26 ++
|
||||
drivers/dma/ralink-gdma.c | 577 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
include/linux/dmaengine.h | 1 +
|
||||
5 files changed, 611 insertions(+)
|
||||
create mode 100644 drivers/dma/ralink-gdma.c
|
||||
|
||||
--- a/drivers/dma/Kconfig
|
||||
+++ b/drivers/dma/Kconfig
|
||||
@@ -312,6 +312,12 @@ config MMP_PDMA
|
||||
help
|
||||
Support the MMP PDMA engine for PXA and MMP platfrom.
|
||||
|
||||
+config DMA_RALINK
|
||||
+ tristate "RALINK DMA support"
|
||||
+ depends on RALINK && SOC_MT7620
|
||||
+ select DMA_ENGINE
|
||||
+ select DMA_VIRTUAL_CHANNELS
|
||||
+
|
||||
config DMA_ENGINE
|
||||
bool
|
||||
|
||||
--- a/drivers/dma/Makefile
|
||||
+++ b/drivers/dma/Makefile
|
||||
@@ -38,3 +38,4 @@ obj-$(CONFIG_DMA_SA11X0) += sa11x0-dma.o
|
||||
obj-$(CONFIG_MMP_TDMA) += mmp_tdma.o
|
||||
obj-$(CONFIG_DMA_OMAP) += omap-dma.o
|
||||
obj-$(CONFIG_MMP_PDMA) += mmp_pdma.o
|
||||
+obj-$(CONFIG_DMA_RALINK) += ralink-gdma.o
|
||||
--- a/drivers/dma/dmaengine.c
|
||||
+++ b/drivers/dma/dmaengine.c
|
||||
@@ -504,6 +504,32 @@ static struct dma_chan *private_candidat
|
||||
}
|
||||
|
||||
/**
|
||||
+ * dma_request_slave_channel - try to get specific channel exclusively
|
||||
+ * @chan: target channel
|
||||
+ */
|
||||
+struct dma_chan *dma_get_slave_channel(struct dma_chan *chan)
|
||||
+{
|
||||
+ int err = -EBUSY;
|
||||
+
|
||||
+ /* lock against __dma_request_channel */
|
||||
+ mutex_lock(&dma_list_mutex);
|
||||
+
|
||||
+ if (chan->client_count == 0) {
|
||||
+ err = dma_chan_get(chan);
|
||||
+ if (err)
|
||||
+ pr_debug("%s: failed to get %s: (%d)\n",
|
||||
+ __func__, dma_chan_name(chan), err);
|
||||
+ } else
|
||||
+ chan = NULL;
|
||||
+
|
||||
+ mutex_unlock(&dma_list_mutex);
|
||||
+
|
||||
+ return chan;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(dma_get_slave_channel);
|
||||
+
|
||||
+
|
||||
+/**
|
||||
* dma_request_channel - try to allocate an exclusive channel
|
||||
* @mask: capabilities that the channel must satisfy
|
||||
* @fn: optional callback to disposition available channels
|
||||
--- /dev/null
|
||||
+++ b/drivers/dma/ralink-gdma.c
|
||||
@@ -0,0 +1,577 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2013, Lars-Peter Clausen <lars@metafoo.de>
|
||||
+ * GDMA4740 DMAC support
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * 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.,
|
||||
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <linux/dmaengine.h>
|
||||
+#include <linux/dma-mapping.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/list.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/spinlock.h>
|
||||
+#include <linux/irq.h>
|
||||
+#include <linux/of_dma.h>
|
||||
+
|
||||
+#include "virt-dma.h"
|
||||
+
|
||||
+#define GDMA_NR_CHANS 16
|
||||
+
|
||||
+#define GDMA_REG_SRC_ADDR(x) (0x00 + (x) * 0x10)
|
||||
+#define GDMA_REG_DST_ADDR(x) (0x04 + (x) * 0x10)
|
||||
+
|
||||
+#define GDMA_REG_CTRL0(x) (0x08 + (x) * 0x10)
|
||||
+#define GDMA_REG_CTRL0_TX_MASK 0xffff
|
||||
+#define GDMA_REG_CTRL0_TX_SHIFT 16
|
||||
+#define GDMA_REG_CTRL0_CURR_MASK 0xff
|
||||
+#define GDMA_REG_CTRL0_CURR_SHIFT 8
|
||||
+#define GDMA_REG_CTRL0_SRC_ADDR_FIXED BIT(7)
|
||||
+#define GDMA_REG_CTRL0_DST_ADDR_FIXED BIT(6)
|
||||
+#define GDMA_REG_CTRL0_BURST_MASK 0x7
|
||||
+#define GDMA_REG_CTRL0_BURST_SHIFT 3
|
||||
+#define GDMA_REG_CTRL0_DONE_INT BIT(2)
|
||||
+#define GDMA_REG_CTRL0_ENABLE BIT(1)
|
||||
+#define GDMA_REG_CTRL0_HW_MODE 0
|
||||
+
|
||||
+#define GDMA_REG_CTRL1(x) (0x0c + (x) * 0x10)
|
||||
+#define GDMA_REG_CTRL1_SEG_MASK 0xf
|
||||
+#define GDMA_REG_CTRL1_SEG_SHIFT 22
|
||||
+#define GDMA_REG_CTRL1_REQ_MASK 0x3f
|
||||
+#define GDMA_REG_CTRL1_SRC_REQ_SHIFT 16
|
||||
+#define GDMA_REG_CTRL1_DST_REQ_SHIFT 8
|
||||
+#define GDMA_REG_CTRL1_CONTINOUS BIT(14)
|
||||
+#define GDMA_REG_CTRL1_NEXT_MASK 0x1f
|
||||
+#define GDMA_REG_CTRL1_NEXT_SHIFT 3
|
||||
+#define GDMA_REG_CTRL1_COHERENT BIT(2)
|
||||
+#define GDMA_REG_CTRL1_FAIL BIT(1)
|
||||
+#define GDMA_REG_CTRL1_MASK BIT(0)
|
||||
+
|
||||
+#define GDMA_REG_UNMASK_INT 0x200
|
||||
+#define GDMA_REG_DONE_INT 0x204
|
||||
+
|
||||
+#define GDMA_REG_GCT 0x220
|
||||
+#define GDMA_REG_GCT_CHAN_MASK 0x3
|
||||
+#define GDMA_REG_GCT_CHAN_SHIFT 3
|
||||
+#define GDMA_REG_GCT_VER_MASK 0x3
|
||||
+#define GDMA_REG_GCT_VER_SHIFT 1
|
||||
+#define GDMA_REG_GCT_ARBIT_RR BIT(0)
|
||||
+
|
||||
+enum gdma_dma_transfer_size {
|
||||
+ GDMA_TRANSFER_SIZE_4BYTE = 0,
|
||||
+ GDMA_TRANSFER_SIZE_8BYTE = 1,
|
||||
+ GDMA_TRANSFER_SIZE_16BYTE = 2,
|
||||
+ GDMA_TRANSFER_SIZE_32BYTE = 3,
|
||||
+};
|
||||
+
|
||||
+struct gdma_dma_sg {
|
||||
+ dma_addr_t addr;
|
||||
+ unsigned int len;
|
||||
+};
|
||||
+
|
||||
+struct gdma_dma_desc {
|
||||
+ struct virt_dma_desc vdesc;
|
||||
+
|
||||
+ enum dma_transfer_direction direction;
|
||||
+ bool cyclic;
|
||||
+
|
||||
+ unsigned int num_sgs;
|
||||
+ struct gdma_dma_sg sg[];
|
||||
+};
|
||||
+
|
||||
+struct gdma_dmaengine_chan {
|
||||
+ struct virt_dma_chan vchan;
|
||||
+ unsigned int id;
|
||||
+
|
||||
+ dma_addr_t fifo_addr;
|
||||
+ unsigned int transfer_shift;
|
||||
+
|
||||
+ struct gdma_dma_desc *desc;
|
||||
+ unsigned int next_sg;
|
||||
+};
|
||||
+
|
||||
+struct gdma_dma_dev {
|
||||
+ struct dma_device ddev;
|
||||
+ void __iomem *base;
|
||||
+ struct clk *clk;
|
||||
+
|
||||
+ struct gdma_dmaengine_chan chan[GDMA_NR_CHANS];
|
||||
+};
|
||||
+
|
||||
+static struct gdma_dma_dev *gdma_dma_chan_get_dev(
|
||||
+ struct gdma_dmaengine_chan *chan)
|
||||
+{
|
||||
+ return container_of(chan->vchan.chan.device, struct gdma_dma_dev,
|
||||
+ ddev);
|
||||
+}
|
||||
+
|
||||
+static struct gdma_dmaengine_chan *to_gdma_dma_chan(struct dma_chan *c)
|
||||
+{
|
||||
+ return container_of(c, struct gdma_dmaengine_chan, vchan.chan);
|
||||
+}
|
||||
+
|
||||
+static struct gdma_dma_desc *to_gdma_dma_desc(struct virt_dma_desc *vdesc)
|
||||
+{
|
||||
+ return container_of(vdesc, struct gdma_dma_desc, vdesc);
|
||||
+}
|
||||
+
|
||||
+static inline uint32_t gdma_dma_read(struct gdma_dma_dev *dma_dev,
|
||||
+ unsigned int reg)
|
||||
+{
|
||||
+ return readl(dma_dev->base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline void gdma_dma_write(struct gdma_dma_dev *dma_dev,
|
||||
+ unsigned reg, uint32_t val)
|
||||
+{
|
||||
+ //printk("gdma --> %p = 0x%08X\n", dma_dev->base + reg, val);
|
||||
+ writel(val, dma_dev->base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline void gdma_dma_write_mask(struct gdma_dma_dev *dma_dev,
|
||||
+ unsigned int reg, uint32_t val, uint32_t mask)
|
||||
+{
|
||||
+ uint32_t tmp;
|
||||
+
|
||||
+ tmp = gdma_dma_read(dma_dev, reg);
|
||||
+ tmp &= ~mask;
|
||||
+ tmp |= val;
|
||||
+ gdma_dma_write(dma_dev, reg, tmp);
|
||||
+}
|
||||
+
|
||||
+static struct gdma_dma_desc *gdma_dma_alloc_desc(unsigned int num_sgs)
|
||||
+{
|
||||
+ return kzalloc(sizeof(struct gdma_dma_desc) +
|
||||
+ sizeof(struct gdma_dma_sg) * num_sgs, GFP_ATOMIC);
|
||||
+}
|
||||
+
|
||||
+static enum gdma_dma_transfer_size gdma_dma_maxburst(u32 maxburst)
|
||||
+{
|
||||
+ if (maxburst <= 7)
|
||||
+ return GDMA_TRANSFER_SIZE_4BYTE;
|
||||
+ else if (maxburst <= 15)
|
||||
+ return GDMA_TRANSFER_SIZE_8BYTE;
|
||||
+ else if (maxburst <= 31)
|
||||
+ return GDMA_TRANSFER_SIZE_16BYTE;
|
||||
+
|
||||
+ return GDMA_TRANSFER_SIZE_32BYTE;
|
||||
+}
|
||||
+
|
||||
+static int gdma_dma_slave_config(struct dma_chan *c,
|
||||
+ const struct dma_slave_config *config)
|
||||
+{
|
||||
+ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c);
|
||||
+ struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan);
|
||||
+ enum gdma_dma_transfer_size transfer_size;
|
||||
+ uint32_t flags;
|
||||
+ uint32_t ctrl0, ctrl1;
|
||||
+
|
||||
+ switch (config->direction) {
|
||||
+ case DMA_MEM_TO_DEV:
|
||||
+ ctrl1 = 32 << GDMA_REG_CTRL1_SRC_REQ_SHIFT;
|
||||
+ ctrl1 |= config->slave_id << GDMA_REG_CTRL1_DST_REQ_SHIFT;
|
||||
+ flags = GDMA_REG_CTRL0_DST_ADDR_FIXED;
|
||||
+ transfer_size = gdma_dma_maxburst(config->dst_maxburst);
|
||||
+ chan->fifo_addr = config->dst_addr;
|
||||
+ break;
|
||||
+
|
||||
+ case DMA_DEV_TO_MEM:
|
||||
+ ctrl1 = config->slave_id << GDMA_REG_CTRL1_SRC_REQ_SHIFT;
|
||||
+ ctrl1 |= 32 << GDMA_REG_CTRL1_DST_REQ_SHIFT;
|
||||
+ flags = GDMA_REG_CTRL0_SRC_ADDR_FIXED;
|
||||
+ transfer_size = gdma_dma_maxburst(config->src_maxburst);
|
||||
+ chan->fifo_addr = config->src_addr;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ chan->transfer_shift = 1 + transfer_size;
|
||||
+
|
||||
+ ctrl0 = flags | GDMA_REG_CTRL0_HW_MODE;
|
||||
+ ctrl0 |= GDMA_REG_CTRL0_DONE_INT;
|
||||
+
|
||||
+ ctrl1 &= ~(GDMA_REG_CTRL1_NEXT_MASK << GDMA_REG_CTRL1_NEXT_SHIFT);
|
||||
+ ctrl1 |= chan->id << GDMA_REG_CTRL1_NEXT_SHIFT;
|
||||
+ ctrl1 |= GDMA_REG_CTRL1_FAIL;
|
||||
+ ctrl1 &= ~GDMA_REG_CTRL1_CONTINOUS;
|
||||
+ gdma_dma_write(dma_dev, GDMA_REG_CTRL0(chan->id), ctrl0);
|
||||
+ gdma_dma_write(dma_dev, GDMA_REG_CTRL1(chan->id), ctrl1);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int gdma_dma_terminate_all(struct dma_chan *c)
|
||||
+{
|
||||
+ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c);
|
||||
+ struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan);
|
||||
+ unsigned long flags;
|
||||
+ LIST_HEAD(head);
|
||||
+
|
||||
+ spin_lock_irqsave(&chan->vchan.lock, flags);
|
||||
+ gdma_dma_write_mask(dma_dev, GDMA_REG_CTRL0(chan->id), 0,
|
||||
+ GDMA_REG_CTRL0_ENABLE);
|
||||
+ chan->desc = NULL;
|
||||
+ vchan_get_all_descriptors(&chan->vchan, &head);
|
||||
+ spin_unlock_irqrestore(&chan->vchan.lock, flags);
|
||||
+
|
||||
+ vchan_dma_desc_free_list(&chan->vchan, &head);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int gdma_dma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
|
||||
+ unsigned long arg)
|
||||
+{
|
||||
+ struct dma_slave_config *config = (struct dma_slave_config *)arg;
|
||||
+
|
||||
+ switch (cmd) {
|
||||
+ case DMA_SLAVE_CONFIG:
|
||||
+ return gdma_dma_slave_config(chan, config);
|
||||
+ case DMA_TERMINATE_ALL:
|
||||
+ return gdma_dma_terminate_all(chan);
|
||||
+ default:
|
||||
+ return -ENOSYS;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int gdma_dma_start_transfer(struct gdma_dmaengine_chan *chan)
|
||||
+{
|
||||
+ struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan);
|
||||
+ dma_addr_t src_addr, dst_addr;
|
||||
+ struct virt_dma_desc *vdesc;
|
||||
+ struct gdma_dma_sg *sg;
|
||||
+
|
||||
+ gdma_dma_write_mask(dma_dev, GDMA_REG_CTRL0(chan->id), 0,
|
||||
+ GDMA_REG_CTRL0_ENABLE);
|
||||
+
|
||||
+ if (!chan->desc) {
|
||||
+ vdesc = vchan_next_desc(&chan->vchan);
|
||||
+ if (!vdesc)
|
||||
+ return 0;
|
||||
+ chan->desc = to_gdma_dma_desc(vdesc);
|
||||
+ chan->next_sg = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (chan->next_sg == chan->desc->num_sgs)
|
||||
+ chan->next_sg = 0;
|
||||
+
|
||||
+ sg = &chan->desc->sg[chan->next_sg];
|
||||
+
|
||||
+ if (chan->desc->direction == DMA_MEM_TO_DEV) {
|
||||
+ src_addr = sg->addr;
|
||||
+ dst_addr = chan->fifo_addr;
|
||||
+ } else {
|
||||
+ src_addr = chan->fifo_addr;
|
||||
+ dst_addr = sg->addr;
|
||||
+ }
|
||||
+ gdma_dma_write(dma_dev, GDMA_REG_SRC_ADDR(chan->id), src_addr);
|
||||
+ gdma_dma_write(dma_dev, GDMA_REG_DST_ADDR(chan->id), dst_addr);
|
||||
+ gdma_dma_write_mask(dma_dev, GDMA_REG_CTRL0(chan->id),
|
||||
+ (sg->len << GDMA_REG_CTRL0_TX_SHIFT) | GDMA_REG_CTRL0_ENABLE,
|
||||
+ GDMA_REG_CTRL0_TX_MASK << GDMA_REG_CTRL0_TX_SHIFT);
|
||||
+ chan->next_sg++;
|
||||
+ gdma_dma_write_mask(dma_dev, GDMA_REG_CTRL1(chan->id), 0, GDMA_REG_CTRL1_MASK);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void gdma_dma_chan_irq(struct gdma_dmaengine_chan *chan)
|
||||
+{
|
||||
+ spin_lock(&chan->vchan.lock);
|
||||
+ if (chan->desc) {
|
||||
+ if (chan->desc && chan->desc->cyclic) {
|
||||
+ vchan_cyclic_callback(&chan->desc->vdesc);
|
||||
+ } else {
|
||||
+ if (chan->next_sg == chan->desc->num_sgs) {
|
||||
+ chan->desc = NULL;
|
||||
+ vchan_cookie_complete(&chan->desc->vdesc);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ gdma_dma_start_transfer(chan);
|
||||
+ spin_unlock(&chan->vchan.lock);
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t gdma_dma_irq(int irq, void *devid)
|
||||
+{
|
||||
+ struct gdma_dma_dev *dma_dev = devid;
|
||||
+ uint32_t unmask, done;
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ unmask = gdma_dma_read(dma_dev, GDMA_REG_UNMASK_INT);
|
||||
+ gdma_dma_write(dma_dev, GDMA_REG_UNMASK_INT, unmask);
|
||||
+ done = gdma_dma_read(dma_dev, GDMA_REG_DONE_INT);
|
||||
+
|
||||
+ for (i = 0; i < GDMA_NR_CHANS; ++i)
|
||||
+ if (done & BIT(i))
|
||||
+ gdma_dma_chan_irq(&dma_dev->chan[i]);
|
||||
+ gdma_dma_write(dma_dev, GDMA_REG_DONE_INT, done);
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static void gdma_dma_issue_pending(struct dma_chan *c)
|
||||
+{
|
||||
+ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c);
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ spin_lock_irqsave(&chan->vchan.lock, flags);
|
||||
+ if (vchan_issue_pending(&chan->vchan) && !chan->desc)
|
||||
+ gdma_dma_start_transfer(chan);
|
||||
+ spin_unlock_irqrestore(&chan->vchan.lock, flags);
|
||||
+}
|
||||
+
|
||||
+static struct dma_async_tx_descriptor *gdma_dma_prep_slave_sg(
|
||||
+ struct dma_chan *c, struct scatterlist *sgl,
|
||||
+ unsigned int sg_len, enum dma_transfer_direction direction,
|
||||
+ unsigned long flags, void *context)
|
||||
+{
|
||||
+ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c);
|
||||
+ struct gdma_dma_desc *desc;
|
||||
+ struct scatterlist *sg;
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ desc = gdma_dma_alloc_desc(sg_len);
|
||||
+ if (!desc)
|
||||
+ return NULL;
|
||||
+
|
||||
+ for_each_sg(sgl, sg, sg_len, i) {
|
||||
+ desc->sg[i].addr = sg_dma_address(sg);
|
||||
+ desc->sg[i].len = sg_dma_len(sg);
|
||||
+ }
|
||||
+
|
||||
+ desc->num_sgs = sg_len;
|
||||
+ desc->direction = direction;
|
||||
+ desc->cyclic = false;
|
||||
+
|
||||
+ return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags);
|
||||
+}
|
||||
+
|
||||
+static struct dma_async_tx_descriptor *gdma_dma_prep_dma_cyclic(
|
||||
+ struct dma_chan *c, dma_addr_t buf_addr, size_t buf_len,
|
||||
+ size_t period_len, enum dma_transfer_direction direction,
|
||||
+ unsigned long flags, void *context)
|
||||
+{
|
||||
+ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c);
|
||||
+ struct gdma_dma_desc *desc;
|
||||
+ unsigned int num_periods, i;
|
||||
+
|
||||
+ if (buf_len % period_len)
|
||||
+ return NULL;
|
||||
+
|
||||
+ num_periods = buf_len / period_len;
|
||||
+
|
||||
+ desc = gdma_dma_alloc_desc(num_periods);
|
||||
+ if (!desc)
|
||||
+ return NULL;
|
||||
+
|
||||
+ for (i = 0; i < num_periods; i++) {
|
||||
+ desc->sg[i].addr = buf_addr;
|
||||
+ desc->sg[i].len = period_len;
|
||||
+ buf_addr += period_len;
|
||||
+ }
|
||||
+
|
||||
+ desc->num_sgs = num_periods;
|
||||
+ desc->direction = direction;
|
||||
+ desc->cyclic = true;
|
||||
+
|
||||
+ return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags);
|
||||
+}
|
||||
+
|
||||
+static size_t gdma_dma_desc_residue(struct gdma_dmaengine_chan *chan,
|
||||
+ struct gdma_dma_desc *desc, unsigned int next_sg)
|
||||
+{
|
||||
+ struct gdma_dma_dev *dma_dev = gdma_dma_chan_get_dev(chan);
|
||||
+ unsigned int residue, count;
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ residue = 0;
|
||||
+
|
||||
+ for (i = next_sg; i < desc->num_sgs; i++)
|
||||
+ residue += desc->sg[i].len;
|
||||
+
|
||||
+ if (next_sg != 0) {
|
||||
+ count = gdma_dma_read(dma_dev, GDMA_REG_CTRL0(chan->id));
|
||||
+ count >>= GDMA_REG_CTRL0_CURR_SHIFT;
|
||||
+ count &= GDMA_REG_CTRL0_CURR_MASK;
|
||||
+ residue += count << chan->transfer_shift;
|
||||
+ }
|
||||
+
|
||||
+ return residue;
|
||||
+}
|
||||
+
|
||||
+static enum dma_status gdma_dma_tx_status(struct dma_chan *c,
|
||||
+ dma_cookie_t cookie, struct dma_tx_state *state)
|
||||
+{
|
||||
+ struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c);
|
||||
+ struct virt_dma_desc *vdesc;
|
||||
+ enum dma_status status;
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ status = dma_cookie_status(c, cookie, state);
|
||||
+ if (status == DMA_SUCCESS || !state)
|
||||
+ return status;
|
||||
+
|
||||
+ spin_lock_irqsave(&chan->vchan.lock, flags);
|
||||
+ vdesc = vchan_find_desc(&chan->vchan, cookie);
|
||||
+ if (cookie == chan->desc->vdesc.tx.cookie) {
|
||||
+ state->residue = gdma_dma_desc_residue(chan, chan->desc,
|
||||
+ chan->next_sg);
|
||||
+ } else if (vdesc) {
|
||||
+ state->residue = gdma_dma_desc_residue(chan,
|
||||
+ to_gdma_dma_desc(vdesc), 0);
|
||||
+ } else {
|
||||
+ state->residue = 0;
|
||||
+ }
|
||||
+ spin_unlock_irqrestore(&chan->vchan.lock, flags);
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
+static int gdma_dma_alloc_chan_resources(struct dma_chan *c)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void gdma_dma_free_chan_resources(struct dma_chan *c)
|
||||
+{
|
||||
+ vchan_free_chan_resources(to_virt_chan(c));
|
||||
+}
|
||||
+
|
||||
+static void gdma_dma_desc_free(struct virt_dma_desc *vdesc)
|
||||
+{
|
||||
+ kfree(container_of(vdesc, struct gdma_dma_desc, vdesc));
|
||||
+}
|
||||
+
|
||||
+static struct dma_chan *
|
||||
+of_dma_xlate_by_chan_id(struct of_phandle_args *dma_spec,
|
||||
+ struct of_dma *ofdma)
|
||||
+{
|
||||
+ struct gdma_dma_dev *dma_dev = ofdma->of_dma_data;
|
||||
+ unsigned int request = dma_spec->args[0];
|
||||
+
|
||||
+ if (request >= GDMA_NR_CHANS)
|
||||
+ return NULL;
|
||||
+
|
||||
+ return dma_get_slave_channel(&(dma_dev->chan[request].vchan.chan));
|
||||
+}
|
||||
+
|
||||
+static int gdma_dma_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct gdma_dmaengine_chan *chan;
|
||||
+ struct gdma_dma_dev *dma_dev;
|
||||
+ struct dma_device *dd;
|
||||
+ unsigned int i;
|
||||
+ struct resource *res;
|
||||
+ uint32_t gct;
|
||||
+ int ret;
|
||||
+ int irq;
|
||||
+
|
||||
+
|
||||
+ dma_dev = devm_kzalloc(&pdev->dev, sizeof(*dma_dev), GFP_KERNEL);
|
||||
+ if (!dma_dev)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ dd = &dma_dev->ddev;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ dma_dev->base = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ if (IS_ERR(dma_dev->base))
|
||||
+ return PTR_ERR(dma_dev->base);
|
||||
+
|
||||
+ dma_cap_set(DMA_SLAVE, dd->cap_mask);
|
||||
+ dma_cap_set(DMA_CYCLIC, dd->cap_mask);
|
||||
+ dd->device_alloc_chan_resources = gdma_dma_alloc_chan_resources;
|
||||
+ dd->device_free_chan_resources = gdma_dma_free_chan_resources;
|
||||
+ dd->device_tx_status = gdma_dma_tx_status;
|
||||
+ dd->device_issue_pending = gdma_dma_issue_pending;
|
||||
+ dd->device_prep_slave_sg = gdma_dma_prep_slave_sg;
|
||||
+ dd->device_prep_dma_cyclic = gdma_dma_prep_dma_cyclic;
|
||||
+ dd->device_control = gdma_dma_control;
|
||||
+ dd->dev = &pdev->dev;
|
||||
+ dd->chancnt = GDMA_NR_CHANS;
|
||||
+ INIT_LIST_HEAD(&dd->channels);
|
||||
+
|
||||
+ for (i = 0; i < dd->chancnt; i++) {
|
||||
+ chan = &dma_dev->chan[i];
|
||||
+ chan->id = i;
|
||||
+ chan->vchan.desc_free = gdma_dma_desc_free;
|
||||
+ vchan_init(&chan->vchan, dd);
|
||||
+ }
|
||||
+
|
||||
+ ret = dma_async_device_register(dd);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = of_dma_controller_register(pdev->dev.of_node,
|
||||
+ of_dma_xlate_by_chan_id, dma_dev);
|
||||
+ if (ret)
|
||||
+ goto err_unregister;
|
||||
+
|
||||
+ irq = platform_get_irq(pdev, 0);
|
||||
+ ret = request_irq(irq, gdma_dma_irq, 0, dev_name(&pdev->dev), dma_dev);
|
||||
+ if (ret)
|
||||
+ goto err_unregister;
|
||||
+
|
||||
+ gdma_dma_write(dma_dev, GDMA_REG_UNMASK_INT, 0);
|
||||
+ gdma_dma_write(dma_dev, GDMA_REG_DONE_INT, BIT(dd->chancnt) - 1);
|
||||
+
|
||||
+ gct = gdma_dma_read(dma_dev, GDMA_REG_GCT);
|
||||
+ dev_info(&pdev->dev, "revision: %d, channels: %d\n",
|
||||
+ (gct >> GDMA_REG_GCT_VER_SHIFT) & GDMA_REG_GCT_VER_MASK,
|
||||
+ 8 << ((gct >> GDMA_REG_GCT_CHAN_SHIFT) & GDMA_REG_GCT_CHAN_MASK));
|
||||
+ platform_set_drvdata(pdev, dma_dev);
|
||||
+
|
||||
+ gdma_dma_write(dma_dev, GDMA_REG_GCT, GDMA_REG_GCT_ARBIT_RR);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+err_unregister:
|
||||
+ dma_async_device_unregister(dd);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int gdma_dma_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct gdma_dma_dev *dma_dev = platform_get_drvdata(pdev);
|
||||
+ int irq = platform_get_irq(pdev, 0);
|
||||
+
|
||||
+ free_irq(irq, dma_dev);
|
||||
+ of_dma_controller_free(pdev->dev.of_node);
|
||||
+ dma_async_device_unregister(&dma_dev->ddev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id gdma_of_match_table[] = {
|
||||
+ { .compatible = "ralink,rt2880-gdma" },
|
||||
+ { },
|
||||
+};
|
||||
+
|
||||
+static struct platform_driver gdma_dma_driver = {
|
||||
+ .probe = gdma_dma_probe,
|
||||
+ .remove = gdma_dma_remove,
|
||||
+ .driver = {
|
||||
+ .name = "gdma-rt2880",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = gdma_of_match_table,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(gdma_dma_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||
+MODULE_DESCRIPTION("GDMA4740 DMA driver");
|
||||
+MODULE_LICENSE("GPLv2");
|
||||
--- a/include/linux/dmaengine.h
|
||||
+++ b/include/linux/dmaengine.h
|
||||
@@ -999,6 +999,7 @@ static inline void dma_release_channel(s
|
||||
int dma_async_device_register(struct dma_device *device);
|
||||
void dma_async_device_unregister(struct dma_device *device);
|
||||
void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
|
||||
+struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
|
||||
struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
|
||||
struct dma_chan *net_dma_find_channel(void);
|
||||
#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
|
|
@ -1,711 +0,0 @@
|
|||
From d4398d880eba386cb85d0a1a2ba39a336876dc0a Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Tue, 3 Dec 2013 20:18:13 +0100
|
||||
Subject: [PATCH 112/133] asoc: add mt7620 support
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/of.c | 2 +
|
||||
sound/soc/Kconfig | 1 +
|
||||
sound/soc/Makefile | 1 +
|
||||
sound/soc/ralink/Kconfig | 15 ++
|
||||
sound/soc/ralink/Makefile | 11 +
|
||||
sound/soc/ralink/mt7620-i2s.c | 466 ++++++++++++++++++++++++++++++++++++++
|
||||
sound/soc/ralink/mt7620-wm8960.c | 125 ++++++++++
|
||||
sound/soc/soc-io.c | 10 -
|
||||
8 files changed, 621 insertions(+), 10 deletions(-)
|
||||
create mode 100644 sound/soc/ralink/Kconfig
|
||||
create mode 100644 sound/soc/ralink/Makefile
|
||||
create mode 100644 sound/soc/ralink/mt7620-i2s.c
|
||||
create mode 100644 sound/soc/ralink/mt7620-wm8960.c
|
||||
|
||||
--- a/arch/mips/ralink/of.c
|
||||
+++ b/arch/mips/ralink/of.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/of_fdt.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/bootmem.h>
|
||||
+#include <linux/module.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/of_address.h>
|
||||
|
||||
@@ -25,6 +26,7 @@
|
||||
#include "common.h"
|
||||
|
||||
__iomem void *rt_sysc_membase;
|
||||
+EXPORT_SYMBOL(rt_sysc_membase);
|
||||
__iomem void *rt_memc_membase;
|
||||
|
||||
extern struct boot_param_header __dtb_start;
|
||||
--- a/sound/soc/Kconfig
|
||||
+++ b/sound/soc/Kconfig
|
||||
@@ -48,6 +48,7 @@ source "sound/soc/kirkwood/Kconfig"
|
||||
source "sound/soc/mid-x86/Kconfig"
|
||||
source "sound/soc/mxs/Kconfig"
|
||||
source "sound/soc/pxa/Kconfig"
|
||||
+source "sound/soc/ralink/Kconfig"
|
||||
source "sound/soc/samsung/Kconfig"
|
||||
source "sound/soc/s6000/Kconfig"
|
||||
source "sound/soc/sh/Kconfig"
|
||||
--- a/sound/soc/Makefile
|
||||
+++ b/sound/soc/Makefile
|
||||
@@ -26,6 +26,7 @@ obj-$(CONFIG_SND_SOC) += nuc900/
|
||||
obj-$(CONFIG_SND_SOC) += omap/
|
||||
obj-$(CONFIG_SND_SOC) += kirkwood/
|
||||
obj-$(CONFIG_SND_SOC) += pxa/
|
||||
+obj-$(CONFIG_SND_SOC) += ralink/
|
||||
obj-$(CONFIG_SND_SOC) += samsung/
|
||||
obj-$(CONFIG_SND_SOC) += s6000/
|
||||
obj-$(CONFIG_SND_SOC) += sh/
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/ralink/Kconfig
|
||||
@@ -0,0 +1,15 @@
|
||||
+config SND_MT7620_SOC_I2S
|
||||
+ depends on SOC_MT7620 && SND_SOC
|
||||
+ select SND_SOC_GENERIC_DMAENGINE_PCM
|
||||
+ tristate "SoC Audio (I2S protocol) for Ralink MT7620 SoC"
|
||||
+ help
|
||||
+ Say Y if you want to use I2S protocol and I2S codec on Ingenic MT7620
|
||||
+ based boards.
|
||||
+
|
||||
+config SND_MT7620_SOC_WM8960
|
||||
+ tristate "SoC Audio support for Ralink WM8960"
|
||||
+ select SND_MT7620_SOC_I2S
|
||||
+ select SND_SOC_WM8960
|
||||
+ help
|
||||
+ Say Y if you want to add support for ASoC audio on the Qi LB60 board
|
||||
+ a.k.a Qi Ben NanoNote.
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/ralink/Makefile
|
||||
@@ -0,0 +1,11 @@
|
||||
+#
|
||||
+# Jz4740 Platform Support
|
||||
+#
|
||||
+snd-soc-mt7620-i2s-objs := mt7620-i2s.o
|
||||
+
|
||||
+obj-$(CONFIG_SND_MT7620_SOC_I2S) += snd-soc-mt7620-i2s.o
|
||||
+
|
||||
+# Jz4740 Machine Support
|
||||
+snd-soc-mt7620-wm8960-objs := mt7620-wm8960.o
|
||||
+
|
||||
+obj-$(CONFIG_SND_MT7620_SOC_WM8960) += snd-soc-mt7620-wm8960.o
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/ralink/mt7620-i2s.c
|
||||
@@ -0,0 +1,466 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * 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.,
|
||||
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/slab.h>
|
||||
+
|
||||
+#include <linux/delay.h>
|
||||
+
|
||||
+#include <linux/dma-mapping.h>
|
||||
+
|
||||
+#include <sound/core.h>
|
||||
+#include <sound/pcm.h>
|
||||
+#include <sound/pcm_params.h>
|
||||
+#include <sound/soc.h>
|
||||
+#include <sound/initval.h>
|
||||
+#include <sound/dmaengine_pcm.h>
|
||||
+
|
||||
+#include <ralink_regs.h>
|
||||
+
|
||||
+#define I2S_REG_CFG0 0x00
|
||||
+#define I2S_REG_CFG0_EN BIT(31)
|
||||
+#define I2S_REG_CFG0_DMA_EN BIT(30)
|
||||
+#define I2S_REG_CFG0_BYTE_SWAP BIT(28)
|
||||
+#define I2S_REG_CFG0_TX_EN BIT(24)
|
||||
+#define I2S_REG_CFG0_RX_EN BIT(20)
|
||||
+#define I2S_REG_CFG0_SLAVE BIT(16)
|
||||
+#define I2S_REG_CFG0_RX_THRES 12
|
||||
+#define I2S_REG_CFG0_TX_THRES 4
|
||||
+#define I2S_REG_CFG0_DFT_THRES (4 << I2S_REG_CFG0_RX_THRES) | \
|
||||
+ (4 << I2S_REG_CFG0_TX_THRES)
|
||||
+
|
||||
+#define I2S_REG_INT_STATUS 0x04
|
||||
+#define I2S_REG_INT_EN 0x08
|
||||
+#define I2S_REG_FF_STATUS 0x0c
|
||||
+#define I2S_REG_WREG 0x10
|
||||
+#define I2S_REG_RREG 0x14
|
||||
+#define I2S_REG_CFG1 0x18
|
||||
+
|
||||
+#define I2S_REG_DIVCMP 0x20
|
||||
+#define I2S_REG_DIVINT 0x24
|
||||
+#define I2S_REG_CLK_EN BIT(31)
|
||||
+
|
||||
+struct mt7620_i2s {
|
||||
+ struct resource *mem;
|
||||
+ void __iomem *base;
|
||||
+ dma_addr_t phys_base;
|
||||
+
|
||||
+ struct snd_dmaengine_dai_dma_data playback_dma_data;
|
||||
+ struct snd_dmaengine_dai_dma_data capture_dma_data;
|
||||
+};
|
||||
+
|
||||
+static inline uint32_t mt7620_i2s_read(const struct mt7620_i2s *i2s,
|
||||
+ unsigned int reg)
|
||||
+{
|
||||
+ return readl(i2s->base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline void mt7620_i2s_write(const struct mt7620_i2s *i2s,
|
||||
+ unsigned int reg, uint32_t value)
|
||||
+{
|
||||
+ //printk("i2s --> %p = 0x%08X\n", i2s->base + reg, value);
|
||||
+ writel(value, i2s->base + reg);
|
||||
+}
|
||||
+
|
||||
+static int mt7620_i2s_startup(struct snd_pcm_substream *substream,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct mt7620_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
+ uint32_t cfg;
|
||||
+
|
||||
+ if (dai->active)
|
||||
+ return 0;
|
||||
+
|
||||
+ cfg = mt7620_i2s_read(i2s, I2S_REG_CFG0);
|
||||
+ cfg |= I2S_REG_CFG0_EN;
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_CFG0, cfg);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void mt7620_i2s_shutdown(struct snd_pcm_substream *substream,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct mt7620_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
+ uint32_t cfg;
|
||||
+
|
||||
+ if (dai->active)
|
||||
+ return;
|
||||
+
|
||||
+ cfg = mt7620_i2s_read(i2s, I2S_REG_CFG0);
|
||||
+ cfg &= ~I2S_REG_CFG0_EN;
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_CFG0, cfg);
|
||||
+}
|
||||
+
|
||||
+static int mt7620_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
|
||||
+ struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct mt7620_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
+
|
||||
+ uint32_t cfg;
|
||||
+ uint32_t mask;
|
||||
+
|
||||
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
+ mask = I2S_REG_CFG0_TX_EN;
|
||||
+ else
|
||||
+ mask = I2S_REG_CFG0_RX_EN;
|
||||
+
|
||||
+ cfg = mt7620_i2s_read(i2s, I2S_REG_CFG0);
|
||||
+
|
||||
+ switch (cmd) {
|
||||
+ case SNDRV_PCM_TRIGGER_START:
|
||||
+ case SNDRV_PCM_TRIGGER_RESUME:
|
||||
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
||||
+ cfg |= mask;
|
||||
+ break;
|
||||
+ case SNDRV_PCM_TRIGGER_STOP:
|
||||
+ case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||
+ cfg &= ~mask;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (cfg & (I2S_REG_CFG0_TX_EN | I2S_REG_CFG0_RX_EN))
|
||||
+ cfg |= I2S_REG_CFG0_DMA_EN;
|
||||
+ else
|
||||
+ cfg &= ~I2S_REG_CFG0_DMA_EN;
|
||||
+
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_CFG0, cfg);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt7620_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
+{
|
||||
+ struct mt7620_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
+ uint32_t cfg;
|
||||
+
|
||||
+ cfg = mt7620_i2s_read(i2s, I2S_REG_CFG0);
|
||||
+
|
||||
+ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
+ case SND_SOC_DAIFMT_CBS_CFS:
|
||||
+ cfg |= I2S_REG_CFG0_SLAVE;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_CBM_CFM:
|
||||
+ cfg &= ~I2S_REG_CFG0_SLAVE;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_CBM_CFS:
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
+ case SND_SOC_DAIFMT_I2S:
|
||||
+ case SND_SOC_DAIFMT_MSB:
|
||||
+ cfg &= ~I2S_REG_CFG0_BYTE_SWAP;
|
||||
+ break;
|
||||
+ case SND_SOC_DAIFMT_LSB:
|
||||
+ cfg |= I2S_REG_CFG0_BYTE_SWAP;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
|
||||
+ case SND_SOC_DAIFMT_NB_NF:
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_CFG0, cfg);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt7620_i2s_hw_params(struct snd_pcm_substream *substream,
|
||||
+ struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
|
||||
+{
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+unsigned long i2sMaster_inclk_int[11] = {
|
||||
+ 78, 56, 52, 39, 28, 26, 19, 14, 13, 9, 6};
|
||||
+unsigned long i2sMaster_inclk_comp[11] = {
|
||||
+ 64, 352, 42, 32, 176, 21, 272, 88, 10, 455, 261};
|
||||
+
|
||||
+
|
||||
+static int mt7620_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id,
|
||||
+ unsigned int freq, int dir)
|
||||
+{
|
||||
+ struct mt7620_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
+
|
||||
+ printk("Internal REFCLK with fractional division\n");
|
||||
+
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_DIVINT, i2sMaster_inclk_int[7]);
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_DIVCMP,
|
||||
+ i2sMaster_inclk_comp[7] | I2S_REG_CLK_EN);
|
||||
+
|
||||
+/* struct mt7620_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
+ struct clk *parent;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ switch (clk_id) {
|
||||
+ case JZ4740_I2S_CLKSRC_EXT:
|
||||
+ parent = clk_get(NULL, "ext");
|
||||
+ clk_set_parent(i2s->clk_i2s, parent);
|
||||
+ break;
|
||||
+ case JZ4740_I2S_CLKSRC_PLL:
|
||||
+ parent = clk_get(NULL, "pll half");
|
||||
+ clk_set_parent(i2s->clk_i2s, parent);
|
||||
+ ret = clk_set_rate(i2s->clk_i2s, freq);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ clk_put(parent);
|
||||
+
|
||||
+ return ret;*/
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt7620_i2s_suspend(struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct mt7620_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
+ uint32_t cfg;
|
||||
+
|
||||
+ if (dai->active) {
|
||||
+ cfg = mt7620_i2s_read(i2s, I2S_REG_CFG0);
|
||||
+ cfg &= ~I2S_REG_CFG0_TX_EN;
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_CFG0, cfg);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt7620_i2s_resume(struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct mt7620_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
+ uint32_t cfg;
|
||||
+
|
||||
+ if (dai->active) {
|
||||
+ cfg = mt7620_i2s_read(i2s, I2S_REG_CFG0);
|
||||
+ cfg |= I2S_REG_CFG0_TX_EN;
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_CFG0, cfg);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void mt7620_i2c_init_pcm_config(struct mt7620_i2s *i2s)
|
||||
+{
|
||||
+ struct snd_dmaengine_dai_dma_data *dma_data;
|
||||
+
|
||||
+ /* Playback */
|
||||
+ dma_data = &i2s->playback_dma_data;
|
||||
+ dma_data->maxburst = 16;
|
||||
+ dma_data->slave_id = 2; //JZ4740_DMA_TYPE_AIC_TRANSMIT;
|
||||
+ dma_data->addr = i2s->phys_base + I2S_REG_WREG;
|
||||
+
|
||||
+ /* Capture */
|
||||
+ dma_data = &i2s->capture_dma_data;
|
||||
+ dma_data->maxburst = 16;
|
||||
+ dma_data->slave_id = 3; //JZ4740_DMA_TYPE_AIC_RECEIVE;
|
||||
+ dma_data->addr = i2s->phys_base + I2S_REG_RREG;
|
||||
+}
|
||||
+
|
||||
+static int mt7620_i2s_dai_probe(struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ struct mt7620_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
+ uint32_t data;
|
||||
+
|
||||
+ mt7620_i2c_init_pcm_config(i2s);
|
||||
+ dai->playback_dma_data = &i2s->playback_dma_data;
|
||||
+ dai->capture_dma_data = &i2s->capture_dma_data;
|
||||
+
|
||||
+ /* set share pins to i2s/gpio mode and i2c mode */
|
||||
+ data = rt_sysc_r32(0x60);
|
||||
+ data &= 0xFFFFFFE2;
|
||||
+ data |= 0x00000018;
|
||||
+ rt_sysc_w32(data, 0x60);
|
||||
+
|
||||
+ printk("Internal REFCLK with fractional division\n");
|
||||
+
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_CFG0, I2S_REG_CFG0_DFT_THRES);
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_CFG1, 0);
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_INT_EN, 0);
|
||||
+
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_DIVINT, i2sMaster_inclk_int[7]);
|
||||
+ mt7620_i2s_write(i2s, I2S_REG_DIVCMP,
|
||||
+ i2sMaster_inclk_comp[7] | I2S_REG_CLK_EN);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt7620_i2s_dai_remove(struct snd_soc_dai *dai)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct snd_soc_dai_ops mt7620_i2s_dai_ops = {
|
||||
+ .startup = mt7620_i2s_startup,
|
||||
+ .shutdown = mt7620_i2s_shutdown,
|
||||
+ .trigger = mt7620_i2s_trigger,
|
||||
+ .hw_params = mt7620_i2s_hw_params,
|
||||
+ .set_fmt = mt7620_i2s_set_fmt,
|
||||
+ .set_sysclk = mt7620_i2s_set_sysclk,
|
||||
+};
|
||||
+
|
||||
+#define JZ4740_I2S_FMTS (SNDRV_PCM_FMTBIT_S8 | \
|
||||
+ SNDRV_PCM_FMTBIT_S16_LE)
|
||||
+
|
||||
+static struct snd_soc_dai_driver mt7620_i2s_dai = {
|
||||
+ .probe = mt7620_i2s_dai_probe,
|
||||
+ .remove = mt7620_i2s_dai_remove,
|
||||
+ .playback = {
|
||||
+ .channels_min = 1,
|
||||
+ .channels_max = 2,
|
||||
+ .rates = SNDRV_PCM_RATE_8000_48000,
|
||||
+ .formats = JZ4740_I2S_FMTS,
|
||||
+ },
|
||||
+ .capture = {
|
||||
+ .channels_min = 2,
|
||||
+ .channels_max = 2,
|
||||
+ .rates = SNDRV_PCM_RATE_8000_48000,
|
||||
+ .formats = JZ4740_I2S_FMTS,
|
||||
+ },
|
||||
+ .symmetric_rates = 1,
|
||||
+ .ops = &mt7620_i2s_dai_ops,
|
||||
+ .suspend = mt7620_i2s_suspend,
|
||||
+ .resume = mt7620_i2s_resume,
|
||||
+};
|
||||
+
|
||||
+static const struct snd_pcm_hardware mt7620_pcm_hardware = {
|
||||
+ .info = SNDRV_PCM_INFO_MMAP |
|
||||
+ SNDRV_PCM_INFO_MMAP_VALID |
|
||||
+ SNDRV_PCM_INFO_INTERLEAVED |
|
||||
+ SNDRV_PCM_INFO_BLOCK_TRANSFER,
|
||||
+ .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8,
|
||||
+ .period_bytes_min = PAGE_SIZE,
|
||||
+ .period_bytes_max = 64 * 1024,
|
||||
+ .periods_min = 2,
|
||||
+ .periods_max = 128,
|
||||
+ .buffer_bytes_max = 128 * 1024,
|
||||
+ .fifo_size = 32,
|
||||
+};
|
||||
+
|
||||
+static const struct snd_dmaengine_pcm_config mt7620_dmaengine_pcm_config = {
|
||||
+ .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
|
||||
+ .pcm_hardware = &mt7620_pcm_hardware,
|
||||
+ .prealloc_buffer_size = 256 * PAGE_SIZE,
|
||||
+};
|
||||
+
|
||||
+static const struct snd_soc_component_driver mt7620_i2s_component = {
|
||||
+ .name = "mt7620-i2s",
|
||||
+};
|
||||
+
|
||||
+static int mt7620_i2s_dev_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct mt7620_i2s *i2s;
|
||||
+ int ret;
|
||||
+
|
||||
+ snd_dmaengine_pcm_register(&pdev->dev,
|
||||
+ &mt7620_dmaengine_pcm_config,
|
||||
+ SND_DMAENGINE_PCM_FLAG_COMPAT);
|
||||
+
|
||||
+ i2s = kzalloc(sizeof(*i2s), GFP_KERNEL);
|
||||
+ if (!i2s)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ i2s->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ if (!i2s->mem) {
|
||||
+ ret = -ENOENT;
|
||||
+ goto err_free;
|
||||
+ }
|
||||
+
|
||||
+ i2s->mem = request_mem_region(i2s->mem->start, resource_size(i2s->mem),
|
||||
+ pdev->name);
|
||||
+ if (!i2s->mem) {
|
||||
+ ret = -EBUSY;
|
||||
+ goto err_free;
|
||||
+ }
|
||||
+
|
||||
+ i2s->base = ioremap_nocache(i2s->mem->start, resource_size(i2s->mem));
|
||||
+ if (!i2s->base) {
|
||||
+ ret = -EBUSY;
|
||||
+ goto err_release_mem_region;
|
||||
+ }
|
||||
+
|
||||
+ i2s->phys_base = i2s->mem->start;
|
||||
+
|
||||
+ platform_set_drvdata(pdev, i2s);
|
||||
+ ret = snd_soc_register_component(&pdev->dev, &mt7620_i2s_component,
|
||||
+ &mt7620_i2s_dai, 1);
|
||||
+
|
||||
+ if (!ret) {
|
||||
+ dev_err(&pdev->dev, "loaded\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ dev_err(&pdev->dev, "Failed to register DAI\n");
|
||||
+ iounmap(i2s->base);
|
||||
+
|
||||
+err_release_mem_region:
|
||||
+ release_mem_region(i2s->mem->start, resource_size(i2s->mem));
|
||||
+err_free:
|
||||
+ kfree(i2s);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int mt7620_i2s_dev_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct mt7620_i2s *i2s = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ snd_soc_unregister_component(&pdev->dev);
|
||||
+
|
||||
+ iounmap(i2s->base);
|
||||
+ release_mem_region(i2s->mem->start, resource_size(i2s->mem));
|
||||
+
|
||||
+ kfree(i2s);
|
||||
+
|
||||
+ snd_dmaengine_pcm_unregister(&pdev->dev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id mt7620_i2s_match[] = {
|
||||
+ { .compatible = "ralink,mt7620a-i2s" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, mt7620_i2s_match);
|
||||
+
|
||||
+static struct platform_driver mt7620_i2s_driver = {
|
||||
+ .probe = mt7620_i2s_dev_probe,
|
||||
+ .remove = mt7620_i2s_dev_remove,
|
||||
+ .driver = {
|
||||
+ .name = "mt7620-i2s",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = mt7620_i2s_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(mt7620_i2s_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Lars-Peter Clausen, <lars@metafoo.de>");
|
||||
+MODULE_DESCRIPTION("Ingenic JZ4740 SoC I2S driver");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_ALIAS("platform:mt7620-i2s");
|
||||
--- /dev/null
|
||||
+++ b/sound/soc/ralink/mt7620-wm8960.c
|
||||
@@ -0,0 +1,125 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * 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.,
|
||||
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/moduleparam.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/timer.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <sound/core.h>
|
||||
+#include <sound/pcm.h>
|
||||
+#include <sound/soc.h>
|
||||
+
|
||||
+
|
||||
+static const struct snd_soc_dapm_widget mt7620_wm8960_widgets[] = {
|
||||
+ SND_SOC_DAPM_SPK("Speaker", NULL),
|
||||
+};
|
||||
+
|
||||
+static const struct snd_soc_dapm_route mt7620_wm8960_routes[] = {
|
||||
+ {"Speaker", NULL, "HP_L"},
|
||||
+ {"Speaker", NULL, "HP_R"},
|
||||
+};
|
||||
+
|
||||
+#define MT7620_DAIFMT (SND_SOC_DAIFMT_I2S | \
|
||||
+ SND_SOC_DAIFMT_NB_NF | \
|
||||
+ SND_SOC_DAIFMT_CBM_CFM)
|
||||
+
|
||||
+static int mt7620_wm8960_codec_init(struct snd_soc_pcm_runtime *rtd)
|
||||
+{
|
||||
+ struct snd_soc_codec *codec = rtd->codec;
|
||||
+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
+ struct snd_soc_dapm_context *dapm = &codec->dapm;
|
||||
+ int ret;
|
||||
+
|
||||
+ snd_soc_dapm_enable_pin(dapm, "HP_L");
|
||||
+ snd_soc_dapm_enable_pin(dapm, "HP_R");
|
||||
+
|
||||
+ ret = snd_soc_dai_set_fmt(cpu_dai, MT7620_DAIFMT);
|
||||
+ if (ret < 0) {
|
||||
+ dev_err(codec->dev, "Failed to set cpu dai format: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct snd_soc_dai_link mt7620_wm8960_dai = {
|
||||
+ .name = "mt7620",
|
||||
+ .stream_name = "mt7620",
|
||||
+ .init = mt7620_wm8960_codec_init,
|
||||
+ .codec_dai_name = "wm8960-hifi",
|
||||
+};
|
||||
+
|
||||
+static struct snd_soc_card mt7620_wm8960 = {
|
||||
+ .name = "mt7620-wm8960",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .dai_link = &mt7620_wm8960_dai,
|
||||
+ .num_links = 1,
|
||||
+
|
||||
+ .dapm_widgets = mt7620_wm8960_widgets,
|
||||
+ .num_dapm_widgets = ARRAY_SIZE(mt7620_wm8960_widgets),
|
||||
+ .dapm_routes = mt7620_wm8960_routes,
|
||||
+ .num_dapm_routes = ARRAY_SIZE(mt7620_wm8960_routes),
|
||||
+};
|
||||
+
|
||||
+static int mt7620_wm8960_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node;
|
||||
+ struct snd_soc_card *card = &mt7620_wm8960;
|
||||
+ int ret;
|
||||
+
|
||||
+ card->dev = &pdev->dev;
|
||||
+
|
||||
+ mt7620_wm8960_dai.cpu_of_node = of_parse_phandle(np, "cpu-dai", 0);
|
||||
+ mt7620_wm8960_dai.codec_of_node = of_parse_phandle(np, "codec-dai", 0);
|
||||
+ mt7620_wm8960_dai.platform_of_node = mt7620_wm8960_dai.cpu_of_node;
|
||||
+
|
||||
+ ret = snd_soc_register_card(card);
|
||||
+ if (ret) {
|
||||
+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
|
||||
+ ret);
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int mt7620_wm8960_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ snd_soc_unregister_card(card);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id mt7620_audio_match[] = {
|
||||
+ { .compatible = "ralink,wm8960-audio" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, mt7620_audio_match);
|
||||
+
|
||||
+static struct platform_driver mt7620_wm8960_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "wm8960-audio",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = mt7620_audio_match,
|
||||
+ },
|
||||
+ .probe = mt7620_wm8960_probe,
|
||||
+ .remove = mt7620_wm8960_remove,
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(mt7620_wm8960_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||
+MODULE_DESCRIPTION("ALSA SoC QI LB60 Audio support");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
+MODULE_ALIAS("platform:qi-lb60-audio");
|
||||
--- a/sound/soc/soc-io.c
|
||||
+++ b/sound/soc/soc-io.c
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <trace/events/asoc.h>
|
||||
|
||||
-#ifdef CONFIG_REGMAP
|
||||
static int hw_write(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int value)
|
||||
{
|
||||
@@ -161,12 +160,3 @@ int snd_soc_codec_set_cache_io(struct sn
|
||||
return PTR_RET(codec->control_data);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);
|
||||
-#else
|
||||
-int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
|
||||
- int addr_bits, int data_bits,
|
||||
- enum snd_soc_control_type control)
|
||||
-{
|
||||
- return -ENOTSUPP;
|
||||
-}
|
||||
-EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);
|
||||
-#endif
|
File diff suppressed because it is too large
Load diff
|
@ -1,319 +0,0 @@
|
|||
From b7040c3ad7b8daf8309d083e9248cfa577075cfb Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Thu, 21 Mar 2013 18:27:29 +0100
|
||||
Subject: [PATCH 114/133] PCI: MIPS: adds rt2880 pci support
|
||||
|
||||
Add support for the pci found on the rt2880 SoC.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/pci/Makefile | 1 +
|
||||
arch/mips/pci/pci-rt2880.c | 281 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
arch/mips/ralink/Kconfig | 1 +
|
||||
3 files changed, 283 insertions(+)
|
||||
create mode 100644 arch/mips/pci/pci-rt2880.c
|
||||
|
||||
--- a/arch/mips/pci/Makefile
|
||||
+++ b/arch/mips/pci/Makefile
|
||||
@@ -41,6 +41,7 @@ obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1
|
||||
obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o
|
||||
obj-$(CONFIG_LANTIQ) += fixup-lantiq.o
|
||||
obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o
|
||||
+obj-$(CONFIG_SOC_RT2880) += pci-rt2880.o
|
||||
obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o
|
||||
obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
|
||||
obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/pci/pci-rt2880.c
|
||||
@@ -0,0 +1,281 @@
|
||||
+/*
|
||||
+ * Ralink RT288x SoC PCI register definitions
|
||||
+ *
|
||||
+ * Copyright (C) 2009 John Crispin <blogic@openwrt.org>
|
||||
+ * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ *
|
||||
+ * Parts of this file are based on Ralink's 2.6.21 BSP
|
||||
+ *
|
||||
+ * 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/types.h>
|
||||
+#include <linux/pci.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of_platform.h>
|
||||
+#include <linux/of_irq.h>
|
||||
+#include <linux/of_pci.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/rt288x.h>
|
||||
+
|
||||
+#define RT2880_PCI_BASE 0x00440000
|
||||
+#define RT288X_CPU_IRQ_PCI 4
|
||||
+
|
||||
+#define RT2880_PCI_MEM_BASE 0x20000000
|
||||
+#define RT2880_PCI_MEM_SIZE 0x10000000
|
||||
+#define RT2880_PCI_IO_BASE 0x00460000
|
||||
+#define RT2880_PCI_IO_SIZE 0x00010000
|
||||
+
|
||||
+#define RT2880_PCI_REG_PCICFG_ADDR 0x00
|
||||
+#define RT2880_PCI_REG_PCIMSK_ADDR 0x0c
|
||||
+#define RT2880_PCI_REG_BAR0SETUP_ADDR 0x10
|
||||
+#define RT2880_PCI_REG_IMBASEBAR0_ADDR 0x18
|
||||
+#define RT2880_PCI_REG_CONFIG_ADDR 0x20
|
||||
+#define RT2880_PCI_REG_CONFIG_DATA 0x24
|
||||
+#define RT2880_PCI_REG_MEMBASE 0x28
|
||||
+#define RT2880_PCI_REG_IOBASE 0x2c
|
||||
+#define RT2880_PCI_REG_ID 0x30
|
||||
+#define RT2880_PCI_REG_CLASS 0x34
|
||||
+#define RT2880_PCI_REG_SUBID 0x38
|
||||
+#define RT2880_PCI_REG_ARBCTL 0x80
|
||||
+
|
||||
+static void __iomem *rt2880_pci_base;
|
||||
+static DEFINE_SPINLOCK(rt2880_pci_lock);
|
||||
+
|
||||
+static u32 rt2880_pci_reg_read(u32 reg)
|
||||
+{
|
||||
+ return readl(rt2880_pci_base + reg);
|
||||
+}
|
||||
+
|
||||
+static void rt2880_pci_reg_write(u32 val, u32 reg)
|
||||
+{
|
||||
+ writel(val, rt2880_pci_base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline u32 rt2880_pci_get_cfgaddr(unsigned int bus, unsigned int slot,
|
||||
+ unsigned int func, unsigned int where)
|
||||
+{
|
||||
+ return ((bus << 16) | (slot << 11) | (func << 8) | (where & 0xfc) |
|
||||
+ 0x80000000);
|
||||
+}
|
||||
+
|
||||
+static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn,
|
||||
+ int where, int size, u32 *val)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+ u32 address;
|
||||
+ u32 data;
|
||||
+
|
||||
+ address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn),
|
||||
+ PCI_FUNC(devfn), where);
|
||||
+
|
||||
+ spin_lock_irqsave(&rt2880_pci_lock, flags);
|
||||
+ rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
|
||||
+ data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA);
|
||||
+ spin_unlock_irqrestore(&rt2880_pci_lock, flags);
|
||||
+
|
||||
+ switch (size) {
|
||||
+ case 1:
|
||||
+ *val = (data >> ((where & 3) << 3)) & 0xff;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ *val = (data >> ((where & 3) << 3)) & 0xffff;
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ *val = data;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return PCIBIOS_SUCCESSFUL;
|
||||
+}
|
||||
+
|
||||
+static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn,
|
||||
+ int where, int size, u32 val)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+ u32 address;
|
||||
+ u32 data;
|
||||
+
|
||||
+ address = rt2880_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn),
|
||||
+ PCI_FUNC(devfn), where);
|
||||
+
|
||||
+ spin_lock_irqsave(&rt2880_pci_lock, flags);
|
||||
+ rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
|
||||
+ data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA);
|
||||
+
|
||||
+ switch (size) {
|
||||
+ case 1:
|
||||
+ data = (data & ~(0xff << ((where & 3) << 3))) |
|
||||
+ (val << ((where & 3) << 3));
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ data = (data & ~(0xffff << ((where & 3) << 3))) |
|
||||
+ (val << ((where & 3) << 3));
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ data = val;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ rt2880_pci_reg_write(data, RT2880_PCI_REG_CONFIG_DATA);
|
||||
+ spin_unlock_irqrestore(&rt2880_pci_lock, flags);
|
||||
+
|
||||
+ return PCIBIOS_SUCCESSFUL;
|
||||
+}
|
||||
+
|
||||
+static struct pci_ops rt2880_pci_ops = {
|
||||
+ .read = rt2880_pci_config_read,
|
||||
+ .write = rt2880_pci_config_write,
|
||||
+};
|
||||
+
|
||||
+static struct resource rt2880_pci_mem_resource = {
|
||||
+ .name = "PCI MEM space",
|
||||
+ .start = RT2880_PCI_MEM_BASE,
|
||||
+ .end = RT2880_PCI_MEM_BASE + RT2880_PCI_MEM_SIZE - 1,
|
||||
+ .flags = IORESOURCE_MEM,
|
||||
+};
|
||||
+
|
||||
+static struct resource rt2880_pci_io_resource = {
|
||||
+ .name = "PCI IO space",
|
||||
+ .start = RT2880_PCI_IO_BASE,
|
||||
+ .end = RT2880_PCI_IO_BASE + RT2880_PCI_IO_SIZE - 1,
|
||||
+ .flags = IORESOURCE_IO,
|
||||
+};
|
||||
+
|
||||
+static struct pci_controller rt2880_pci_controller = {
|
||||
+ .pci_ops = &rt2880_pci_ops,
|
||||
+ .mem_resource = &rt2880_pci_mem_resource,
|
||||
+ .io_resource = &rt2880_pci_io_resource,
|
||||
+};
|
||||
+
|
||||
+static inline u32 rt2880_pci_read_u32(unsigned long reg)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+ u32 address;
|
||||
+ u32 ret;
|
||||
+
|
||||
+ address = rt2880_pci_get_cfgaddr(0, 0, 0, reg);
|
||||
+
|
||||
+ spin_lock_irqsave(&rt2880_pci_lock, flags);
|
||||
+ rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
|
||||
+ ret = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA);
|
||||
+ spin_unlock_irqrestore(&rt2880_pci_lock, flags);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static inline void rt2880_pci_write_u32(unsigned long reg, u32 val)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+ u32 address;
|
||||
+
|
||||
+ address = rt2880_pci_get_cfgaddr(0, 0, 0, reg);
|
||||
+
|
||||
+ spin_lock_irqsave(&rt2880_pci_lock, flags);
|
||||
+ rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR);
|
||||
+ rt2880_pci_reg_write(val, RT2880_PCI_REG_CONFIG_DATA);
|
||||
+ spin_unlock_irqrestore(&rt2880_pci_lock, flags);
|
||||
+}
|
||||
+
|
||||
+int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
||||
+{
|
||||
+ u16 cmd;
|
||||
+ int irq = -1;
|
||||
+
|
||||
+ if (dev->bus->number != 0)
|
||||
+ return irq;
|
||||
+
|
||||
+ switch (PCI_SLOT(dev->devfn)) {
|
||||
+ case 0x00:
|
||||
+ rt2880_pci_write_u32(PCI_BASE_ADDRESS_0, 0x08000000);
|
||||
+ (void) rt2880_pci_read_u32(PCI_BASE_ADDRESS_0);
|
||||
+ break;
|
||||
+ case 0x11:
|
||||
+ irq = RT288X_CPU_IRQ_PCI;
|
||||
+ break;
|
||||
+ default:
|
||||
+ printk("%s:%s[%d] trying to alloc unknown pci irq\n",
|
||||
+ __FILE__, __func__, __LINE__);
|
||||
+ BUG();
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ pci_write_config_byte((struct pci_dev*)dev, PCI_CACHE_LINE_SIZE, 0x14);
|
||||
+ pci_write_config_byte((struct pci_dev*)dev, PCI_LATENCY_TIMER, 0xFF);
|
||||
+ pci_read_config_word((struct pci_dev*)dev, PCI_COMMAND, &cmd);
|
||||
+ cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
|
||||
+ PCI_COMMAND_INVALIDATE | PCI_COMMAND_FAST_BACK |
|
||||
+ PCI_COMMAND_SERR | PCI_COMMAND_WAIT | PCI_COMMAND_PARITY;
|
||||
+ pci_write_config_word((struct pci_dev*)dev, PCI_COMMAND, cmd);
|
||||
+ pci_write_config_byte((struct pci_dev*)dev, PCI_INTERRUPT_LINE,
|
||||
+ dev->irq);
|
||||
+ return irq;
|
||||
+}
|
||||
+
|
||||
+static int rt288x_pci_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ void __iomem *io_map_base;
|
||||
+ int i;
|
||||
+
|
||||
+ rt2880_pci_base = ioremap_nocache(RT2880_PCI_BASE, PAGE_SIZE);
|
||||
+
|
||||
+ io_map_base = ioremap(RT2880_PCI_IO_BASE, RT2880_PCI_IO_SIZE);
|
||||
+ rt2880_pci_controller.io_map_base = (unsigned long) io_map_base;
|
||||
+ set_io_port_base((unsigned long) io_map_base);
|
||||
+
|
||||
+ ioport_resource.start = RT2880_PCI_IO_BASE;
|
||||
+ ioport_resource.end = RT2880_PCI_IO_BASE + RT2880_PCI_IO_SIZE - 1;
|
||||
+
|
||||
+ rt2880_pci_reg_write(0, RT2880_PCI_REG_PCICFG_ADDR);
|
||||
+ for(i = 0; i < 0xfffff; i++) {}
|
||||
+
|
||||
+ rt2880_pci_reg_write(0x79, RT2880_PCI_REG_ARBCTL);
|
||||
+ rt2880_pci_reg_write(0x07FF0001, RT2880_PCI_REG_BAR0SETUP_ADDR);
|
||||
+ rt2880_pci_reg_write(RT2880_PCI_MEM_BASE, RT2880_PCI_REG_MEMBASE);
|
||||
+ rt2880_pci_reg_write(RT2880_PCI_IO_BASE, RT2880_PCI_REG_IOBASE);
|
||||
+ rt2880_pci_reg_write(0x08000000, RT2880_PCI_REG_IMBASEBAR0_ADDR);
|
||||
+ rt2880_pci_reg_write(0x08021814, RT2880_PCI_REG_ID);
|
||||
+ rt2880_pci_reg_write(0x00800001, RT2880_PCI_REG_CLASS);
|
||||
+ rt2880_pci_reg_write(0x28801814, RT2880_PCI_REG_SUBID);
|
||||
+ rt2880_pci_reg_write(0x000c0000, RT2880_PCI_REG_PCIMSK_ADDR);
|
||||
+
|
||||
+ rt2880_pci_write_u32(PCI_BASE_ADDRESS_0, 0x08000000);
|
||||
+ (void) rt2880_pci_read_u32(PCI_BASE_ADDRESS_0);
|
||||
+
|
||||
+ register_pci_controller(&rt2880_pci_controller);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int pcibios_plat_dev_init(struct pci_dev *dev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id rt288x_pci_match[] = {
|
||||
+ { .compatible = "ralink,rt288x-pci" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rt288x_pci_match);
|
||||
+
|
||||
+static struct platform_driver rt288x_pci_driver = {
|
||||
+ .probe = rt288x_pci_probe,
|
||||
+ .driver = {
|
||||
+ .name = "rt288x-pci",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = rt288x_pci_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+int __init pcibios_init(void)
|
||||
+{
|
||||
+ int ret = platform_driver_register(&rt288x_pci_driver);
|
||||
+ if (ret)
|
||||
+ pr_info("rt288x-pci: Error registering platform driver!");
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+arch_initcall(pcibios_init);
|
||||
--- a/arch/mips/ralink/Kconfig
|
||||
+++ b/arch/mips/ralink/Kconfig
|
||||
@@ -15,6 +15,7 @@ choice
|
||||
|
||||
config SOC_RT288X
|
||||
bool "RT288x"
|
||||
+ select HW_HAS_PCI
|
||||
|
||||
config SOC_RT305X
|
||||
bool "RT305x"
|
|
@ -1,399 +0,0 @@
|
|||
From 686f5642c74323f7e7eafb93c2b85df589cbf66e Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sat, 18 May 2013 22:06:15 +0200
|
||||
Subject: [PATCH 115/133] PCI: MIPS: adds mt7620a pcie driver
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/pci/Makefile | 1 +
|
||||
arch/mips/pci/pci-mt7620a.c | 363 +++++++++++++++++++++++++++++++++++++++++++
|
||||
arch/mips/ralink/Kconfig | 1 +
|
||||
3 files changed, 365 insertions(+)
|
||||
create mode 100644 arch/mips/pci/pci-mt7620a.c
|
||||
|
||||
--- a/arch/mips/pci/Makefile
|
||||
+++ b/arch/mips/pci/Makefile
|
||||
@@ -41,6 +41,7 @@ obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1
|
||||
obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o
|
||||
obj-$(CONFIG_LANTIQ) += fixup-lantiq.o
|
||||
obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o
|
||||
+obj-$(CONFIG_SOC_MT7620) += pci-mt7620a.o
|
||||
obj-$(CONFIG_SOC_RT2880) += pci-rt2880.o
|
||||
obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o
|
||||
obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/pci/pci-mt7620a.c
|
||||
@@ -0,0 +1,363 @@
|
||||
+/*
|
||||
+ * Ralink MT7620A SoC PCI support
|
||||
+ *
|
||||
+ * Copyright (C) 2007-2013 Bruce Chang
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+ *
|
||||
+ * 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/types.h>
|
||||
+#include <linux/pci.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/of_irq.h>
|
||||
+#include <linux/of_pci.h>
|
||||
+#include <linux/reset.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/ralink_regs.h>
|
||||
+
|
||||
+#define RALINK_PCI_MM_MAP_BASE 0x20000000
|
||||
+#define RALINK_PCI_IO_MAP_BASE 0x10160000
|
||||
+
|
||||
+#define RALINK_INT_PCIE0 4
|
||||
+#define RALINK_SYSTEM_CONTROL_BASE 0xb0000000
|
||||
+#define RALINK_SYSCFG1 0x14
|
||||
+#define RALINK_CLKCFG1 0x30
|
||||
+#define RALINK_GPIOMODE 0x60
|
||||
+#define RALINK_PCIE_CLK_GEN 0x7c
|
||||
+#define RALINK_PCIE_CLK_GEN1 0x80
|
||||
+#define PCIEPHY0_CFG 0x90
|
||||
+#define PPLL_CFG1 0x9c
|
||||
+#define PPLL_DRV 0xa0
|
||||
+#define RALINK_PCI_HOST_MODE_EN (1<<7)
|
||||
+#define RALINK_PCIE_RC_MODE_EN (1<<8)
|
||||
+#define RALINK_PCIE_RST (1<<23)
|
||||
+#define RALINK_PCI_RST (1<<24)
|
||||
+#define RALINK_PCI_CLK_EN (1<<19)
|
||||
+#define RALINK_PCIE_CLK_EN (1<<21)
|
||||
+#define PCI_SLOTx2 (1<<11)
|
||||
+#define PCI_SLOTx1 (2<<11)
|
||||
+#define PDRV_SW_SET (1<<31)
|
||||
+#define LC_CKDRVPD_ (1<<19)
|
||||
+
|
||||
+#define RALINK_PCI_CONFIG_ADDR 0x20
|
||||
+#define RALINK_PCI_CONFIG_DATA_VIRTUAL_REG 0x24
|
||||
+#define MEMORY_BASE 0x0
|
||||
+#define RALINK_PCIE0_RST (1<<26)
|
||||
+#define RALINK_PCI_BASE 0xB0140000
|
||||
+#define RALINK_PCI_MEMBASE 0x28
|
||||
+#define RALINK_PCI_IOBASE 0x2C
|
||||
+
|
||||
+#define RT6855_PCIE0_OFFSET 0x2000
|
||||
+
|
||||
+#define RALINK_PCI_PCICFG_ADDR 0x00
|
||||
+#define RALINK_PCI0_BAR0SETUP_ADDR 0x10
|
||||
+#define RALINK_PCI0_IMBASEBAR0_ADDR 0x18
|
||||
+#define RALINK_PCI0_ID 0x30
|
||||
+#define RALINK_PCI0_CLASS 0x34
|
||||
+#define RALINK_PCI0_SUBID 0x38
|
||||
+#define RALINK_PCI0_STATUS 0x50
|
||||
+#define RALINK_PCI_PCIMSK_ADDR 0x0C
|
||||
+
|
||||
+#define RALINK_PCIE0_CLK_EN (1 << 26)
|
||||
+
|
||||
+#define BUSY 0x80000000
|
||||
+#define WAITRETRY_MAX 10
|
||||
+#define WRITE_MODE (1UL << 23)
|
||||
+#define DATA_SHIFT 0
|
||||
+#define ADDR_SHIFT 8
|
||||
+
|
||||
+
|
||||
+static void __iomem *bridge_base;
|
||||
+static void __iomem *pcie_base;
|
||||
+
|
||||
+static struct reset_control *rstpcie0;
|
||||
+
|
||||
+static inline void bridge_w32(u32 val, unsigned reg)
|
||||
+{
|
||||
+ iowrite32(val, bridge_base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline u32 bridge_r32(unsigned reg)
|
||||
+{
|
||||
+ return ioread32(bridge_base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline void pcie_w32(u32 val, unsigned reg)
|
||||
+{
|
||||
+ iowrite32(val, pcie_base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline u32 pcie_r32(unsigned reg)
|
||||
+{
|
||||
+ return ioread32(pcie_base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline void pcie_m32(u32 clr, u32 set, unsigned reg)
|
||||
+{
|
||||
+ u32 val = pcie_r32(reg);
|
||||
+ val &= ~clr;
|
||||
+ val |= set;
|
||||
+ pcie_w32(val, reg);
|
||||
+}
|
||||
+
|
||||
+int wait_pciephy_busy(void)
|
||||
+{
|
||||
+ unsigned long reg_value = 0x0, retry = 0;
|
||||
+
|
||||
+ while (1) {
|
||||
+ //reg_value = rareg(READMODE, PCIEPHY0_CFG, 0);
|
||||
+ reg_value = pcie_r32(PCIEPHY0_CFG);
|
||||
+
|
||||
+ if (reg_value & BUSY)
|
||||
+ mdelay(100);
|
||||
+ else
|
||||
+ break;
|
||||
+ if (retry++ > WAITRETRY_MAX){
|
||||
+ printk("PCIE-PHY retry failed.\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void pcie_phy(unsigned long addr, unsigned long val)
|
||||
+{
|
||||
+ wait_pciephy_busy();
|
||||
+ pcie_w32(WRITE_MODE | (val << DATA_SHIFT) | (addr << ADDR_SHIFT), PCIEPHY0_CFG);
|
||||
+ mdelay(1);
|
||||
+ wait_pciephy_busy();
|
||||
+}
|
||||
+
|
||||
+static int pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 * val)
|
||||
+{
|
||||
+ unsigned int slot = PCI_SLOT(devfn);
|
||||
+ u8 func = PCI_FUNC(devfn);
|
||||
+ u32 address;
|
||||
+ u32 data;
|
||||
+
|
||||
+ address = (((where & 0xF00) >> 8) << 24) | (bus->number << 16) | (slot << 11) | (func << 8) | (where & 0xfc) | 0x80000000;
|
||||
+ bridge_w32(address, RALINK_PCI_CONFIG_ADDR);
|
||||
+ data = bridge_r32(RALINK_PCI_CONFIG_DATA_VIRTUAL_REG);
|
||||
+
|
||||
+ switch (size) {
|
||||
+ case 1:
|
||||
+ *val = (data >> ((where & 3) << 3)) & 0xff;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ *val = (data >> ((where & 3) << 3)) & 0xffff;
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ *val = data;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return PCIBIOS_SUCCESSFUL;
|
||||
+}
|
||||
+
|
||||
+static int pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)
|
||||
+{
|
||||
+ unsigned int slot = PCI_SLOT(devfn);
|
||||
+ u8 func = PCI_FUNC(devfn);
|
||||
+ u32 address;
|
||||
+ u32 data;
|
||||
+
|
||||
+ address = (((where & 0xF00) >> 8) << 24) | (bus->number << 16) | (slot << 11) | (func << 8) | (where & 0xfc) | 0x80000000;
|
||||
+ bridge_w32(address, RALINK_PCI_CONFIG_ADDR);
|
||||
+ data = bridge_r32(RALINK_PCI_CONFIG_DATA_VIRTUAL_REG);
|
||||
+
|
||||
+ switch (size) {
|
||||
+ case 1:
|
||||
+ data = (data & ~(0xff << ((where & 3) << 3))) |
|
||||
+ (val << ((where & 3) << 3));
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ data = (data & ~(0xffff << ((where & 3) << 3))) |
|
||||
+ (val << ((where & 3) << 3));
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ data = val;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ bridge_w32(data, RALINK_PCI_CONFIG_DATA_VIRTUAL_REG);
|
||||
+
|
||||
+ return PCIBIOS_SUCCESSFUL;
|
||||
+}
|
||||
+
|
||||
+struct pci_ops mt7620a_pci_ops= {
|
||||
+ .read = pci_config_read,
|
||||
+ .write = pci_config_write,
|
||||
+};
|
||||
+
|
||||
+static struct resource mt7620a_res_pci_mem1 = {
|
||||
+ .name = "pci memory",
|
||||
+ .start = RALINK_PCI_MM_MAP_BASE,
|
||||
+ .end = (u32) ((RALINK_PCI_MM_MAP_BASE + (unsigned char *)0x0fffffff)),
|
||||
+ .flags = IORESOURCE_MEM,
|
||||
+};
|
||||
+static struct resource mt7620a_res_pci_io1 = {
|
||||
+ .name = "pci io",
|
||||
+ .start = RALINK_PCI_IO_MAP_BASE,
|
||||
+ .end = (u32) ((RALINK_PCI_IO_MAP_BASE + (unsigned char *)0x0ffff)),
|
||||
+ .flags = IORESOURCE_IO,
|
||||
+};
|
||||
+
|
||||
+struct pci_controller mt7620a_controller = {
|
||||
+ .pci_ops = &mt7620a_pci_ops,
|
||||
+ .mem_resource = &mt7620a_res_pci_mem1,
|
||||
+ .io_resource = &mt7620a_res_pci_io1,
|
||||
+ .mem_offset = 0x00000000UL,
|
||||
+ .io_offset = 0x00000000UL,
|
||||
+ .io_map_base = 0xa0000000,
|
||||
+};
|
||||
+
|
||||
+static int mt7620a_pci_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct resource *bridge_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ struct resource *pcie_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
|
||||
+
|
||||
+ rstpcie0 = devm_reset_control_get(&pdev->dev, "pcie0");
|
||||
+ if (IS_ERR(rstpcie0))
|
||||
+ return PTR_ERR(rstpcie0);
|
||||
+
|
||||
+ bridge_base = devm_request_and_ioremap(&pdev->dev, bridge_res);
|
||||
+ if (!bridge_base)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ pcie_base = devm_request_and_ioremap(&pdev->dev, pcie_res);
|
||||
+ if (!pcie_base)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ iomem_resource.start = 0;
|
||||
+ iomem_resource.end= ~0;
|
||||
+ ioport_resource.start= 0;
|
||||
+ ioport_resource.end = ~0;
|
||||
+
|
||||
+ /* PCIE: bypass PCIe DLL */
|
||||
+ pcie_phy(0x0, 0x80);
|
||||
+ pcie_phy(0x1, 0x04);
|
||||
+ /* PCIE: Elastic buffer control */
|
||||
+ pcie_phy(0x68, 0xB4);
|
||||
+
|
||||
+ reset_control_assert(rstpcie0);
|
||||
+ rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1);
|
||||
+ rt_sysc_m32(1<<19, 1<<31, PPLL_DRV);
|
||||
+ rt_sysc_m32(0x3 << 16, 0, RALINK_GPIOMODE);
|
||||
+
|
||||
+ reset_control_deassert(rstpcie0);
|
||||
+ rt_sysc_m32(0, RALINK_PCIE0_CLK_EN, RALINK_CLKCFG1);
|
||||
+
|
||||
+ mdelay(100);
|
||||
+
|
||||
+ if (!(rt_sysc_r32(PPLL_CFG1) & 1<<23)) {
|
||||
+ printk("MT7620 PPLL unlock\n");
|
||||
+ reset_control_assert(rstpcie0);
|
||||
+ rt_sysc_m32(BIT(26), 0, RALINK_CLKCFG1);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ rt_sysc_m32((0x1<<18) | (0x1<<17), (0x1 << 19) | (0x1 << 31), PPLL_DRV);
|
||||
+
|
||||
+ mdelay(100);
|
||||
+ reset_control_assert(rstpcie0);
|
||||
+ rt_sysc_m32(0x30, 2 << 4, RALINK_SYSCFG1);
|
||||
+
|
||||
+ rt_sysc_m32(~0x7fffffff, 0x80000000, RALINK_PCIE_CLK_GEN);
|
||||
+ rt_sysc_m32(~0x80ffffff, 0xa << 24, RALINK_PCIE_CLK_GEN1);
|
||||
+
|
||||
+ mdelay(50);
|
||||
+ reset_control_deassert(rstpcie0);
|
||||
+ pcie_m32(BIT(1), 0, RALINK_PCI_PCICFG_ADDR);
|
||||
+ mdelay(100);
|
||||
+
|
||||
+ if (( pcie_r32(RALINK_PCI0_STATUS) & 0x1) == 0) {
|
||||
+ reset_control_assert(rstpcie0);
|
||||
+ rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1);
|
||||
+ rt_sysc_m32(LC_CKDRVPD_, PDRV_SW_SET, PPLL_DRV);
|
||||
+ printk("PCIE0 no card, disable it(RST&CLK)\n");
|
||||
+ }
|
||||
+
|
||||
+ bridge_w32(0xffffffff, RALINK_PCI_MEMBASE);
|
||||
+ bridge_w32(RALINK_PCI_IO_MAP_BASE, RALINK_PCI_IOBASE);
|
||||
+
|
||||
+ pcie_w32(0x7FFF0000, RALINK_PCI0_BAR0SETUP_ADDR);
|
||||
+ pcie_w32(MEMORY_BASE, RALINK_PCI0_IMBASEBAR0_ADDR);
|
||||
+ pcie_w32(0x08021814, RALINK_PCI0_ID);
|
||||
+ pcie_w32(0x06040001, RALINK_PCI0_CLASS);
|
||||
+ pcie_w32(0x28801814, RALINK_PCI0_SUBID);
|
||||
+ pcie_m32(0, BIT(20), RALINK_PCI_PCIMSK_ADDR);
|
||||
+
|
||||
+ register_pci_controller(&mt7620a_controller);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
||||
+{
|
||||
+ const struct resource *res;
|
||||
+ u16 cmd;
|
||||
+ u32 val;
|
||||
+ int i, irq = 0;
|
||||
+
|
||||
+ if ((dev->bus->number == 0) && (slot == 0)) {
|
||||
+ pcie_w32(0x7FFF0001, RALINK_PCI0_BAR0SETUP_ADDR); //open 7FFF:2G; ENABLE
|
||||
+ pci_config_write(dev->bus, 0, PCI_BASE_ADDRESS_0, 4, MEMORY_BASE);
|
||||
+ pci_config_read(dev->bus, 0, PCI_BASE_ADDRESS_0, 4, &val);
|
||||
+ } else if ((dev->bus->number == 1) && (slot == 0x0)) {
|
||||
+ irq = RALINK_INT_PCIE0;
|
||||
+ } else {
|
||||
+ printk("bus=0x%x, slot = 0x%x\n", dev->bus->number, slot);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < 6; i++) {
|
||||
+ res = &dev->resource[i];
|
||||
+ }
|
||||
+
|
||||
+ pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0x14); //configure cache line size 0x14
|
||||
+ pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xFF); //configure latency timer 0x10
|
||||
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
|
||||
+
|
||||
+ // FIXME
|
||||
+ cmd = cmd | PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
|
||||
+ pci_write_config_word(dev, PCI_COMMAND, cmd);
|
||||
+ pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
|
||||
+ //pci_write_config_byte(dev, PCI_INTERRUPT_PIN, dev->irq);
|
||||
+
|
||||
+ return irq;
|
||||
+}
|
||||
+
|
||||
+int pcibios_plat_dev_init(struct pci_dev *dev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id mt7620a_pci_ids[] = {
|
||||
+ { .compatible = "ralink,mt7620a-pci" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, mt7620a_pci_ids);
|
||||
+
|
||||
+static struct platform_driver mt7620a_pci_driver = {
|
||||
+ .probe = mt7620a_pci_probe,
|
||||
+ .driver = {
|
||||
+ .name = "mt7620a-pci",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = of_match_ptr(mt7620a_pci_ids),
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init mt7620a_pci_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&mt7620a_pci_driver);
|
||||
+}
|
||||
+
|
||||
+arch_initcall(mt7620a_pci_init);
|
||||
--- a/arch/mips/ralink/Kconfig
|
||||
+++ b/arch/mips/ralink/Kconfig
|
||||
@@ -33,6 +33,7 @@ choice
|
||||
bool "MT7620"
|
||||
select USB_ARCH_HAS_OHCI
|
||||
select USB_ARCH_HAS_EHCI
|
||||
+ select HW_HAS_PCI
|
||||
|
||||
endchoice
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
From bed88d4cb806d2738528cb7d368d6df79d9c1424 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sat, 11 May 2013 23:40:19 +0200
|
||||
Subject: [PATCH 116/133] NET: multi phy support
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/net/phy/phy.c | 9 ++++++---
|
||||
include/linux/phy.h | 2 +-
|
||||
2 files changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/phy.c
|
||||
+++ b/drivers/net/phy/phy.c
|
||||
@@ -820,7 +820,8 @@ void phy_state_machine(struct work_struc
|
||||
* negotiation for now */
|
||||
if (!phydev->link) {
|
||||
phydev->state = PHY_NOLINK;
|
||||
- netif_carrier_off(phydev->attached_dev);
|
||||
+ if (!phydev->no_auto_carrier_off)
|
||||
+ netif_carrier_off(phydev->attached_dev);
|
||||
phydev->adjust_link(phydev->attached_dev);
|
||||
break;
|
||||
}
|
||||
@@ -890,7 +891,8 @@ void phy_state_machine(struct work_struc
|
||||
netif_carrier_on(phydev->attached_dev);
|
||||
} else {
|
||||
phydev->state = PHY_NOLINK;
|
||||
- netif_carrier_off(phydev->attached_dev);
|
||||
+ if (!phydev->no_auto_carrier_off)
|
||||
+ netif_carrier_off(phydev->attached_dev);
|
||||
}
|
||||
|
||||
phydev->adjust_link(phydev->attached_dev);
|
||||
@@ -902,7 +904,8 @@ void phy_state_machine(struct work_struc
|
||||
case PHY_HALTED:
|
||||
if (phydev->link) {
|
||||
phydev->link = 0;
|
||||
- netif_carrier_off(phydev->attached_dev);
|
||||
+ if (!phydev->no_auto_carrier_off)
|
||||
+ netif_carrier_off(phydev->attached_dev);
|
||||
phydev->adjust_link(phydev->attached_dev);
|
||||
}
|
||||
break;
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -298,7 +298,7 @@ struct phy_device {
|
||||
|
||||
struct phy_c45_device_ids c45_ids;
|
||||
bool is_c45;
|
||||
-
|
||||
+ bool no_auto_carrier_off;
|
||||
enum phy_state state;
|
||||
|
||||
u32 dev_flags;
|
|
@ -1,76 +0,0 @@
|
|||
From 1282a0da09e059288eb8b576998ea001680f6628 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 14 Jul 2013 23:26:15 +0200
|
||||
Subject: [PATCH 117/133] NET: add of_get_mac_address_mtd()
|
||||
|
||||
Many embedded devices have information such as mac addresses stored inside mtd
|
||||
devices. This patch allows us to add a property inside a node describing a
|
||||
network interface. The new property points at a mtd partition with an offset
|
||||
where the mac address can be found.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/of/of_net.c | 37 +++++++++++++++++++++++++++++++++++++
|
||||
include/linux/of_net.h | 1 +
|
||||
2 files changed, 38 insertions(+)
|
||||
|
||||
--- a/drivers/of/of_net.c
|
||||
+++ b/drivers/of/of_net.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <linux/of_net.h>
|
||||
#include <linux/phy.h>
|
||||
#include <linux/export.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
|
||||
/**
|
||||
* It maps 'enum phy_interface_t' found in include/linux/phy.h
|
||||
@@ -92,3 +93,39 @@ const void *of_get_mac_address(struct de
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(of_get_mac_address);
|
||||
+
|
||||
+int of_get_mac_address_mtd(struct device_node *np, void *mac)
|
||||
+{
|
||||
+ struct device_node *mtd_np = NULL;
|
||||
+ size_t retlen;
|
||||
+ int size, ret;
|
||||
+ struct mtd_info *mtd;
|
||||
+ const char *part;
|
||||
+ const __be32 *list;
|
||||
+ phandle phandle;
|
||||
+
|
||||
+ list = of_get_property(np, "mtd-mac-address", &size);
|
||||
+ if (!list || (size != (2 * sizeof(*list))))
|
||||
+ return -ENOENT;
|
||||
+
|
||||
+ phandle = be32_to_cpup(list++);
|
||||
+ if (phandle)
|
||||
+ mtd_np = of_find_node_by_phandle(phandle);
|
||||
+
|
||||
+ if (!mtd_np)
|
||||
+ return -ENOENT;
|
||||
+
|
||||
+ part = of_get_property(mtd_np, "label", NULL);
|
||||
+ if (!part)
|
||||
+ part = mtd_np->name;
|
||||
+
|
||||
+ mtd = get_mtd_device_nm(part);
|
||||
+ if (IS_ERR(mtd))
|
||||
+ return PTR_ERR(mtd);
|
||||
+
|
||||
+ ret = mtd_read(mtd, be32_to_cpup(list), 6, &retlen, (u_char *) mac);
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(of_get_mac_address_mtd);
|
||||
--- a/include/linux/of_net.h
|
||||
+++ b/include/linux/of_net.h
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/of.h>
|
||||
extern const int of_get_phy_mode(struct device_node *np);
|
||||
extern const void *of_get_mac_address(struct device_node *np);
|
||||
+extern int of_get_mac_address_mtd(struct device_node *np, void *mac);
|
||||
#else
|
||||
static inline const int of_get_phy_mode(struct device_node *np)
|
||||
{
|
File diff suppressed because it is too large
Load diff
|
@ -1,230 +0,0 @@
|
|||
From 71e09658d3544143e46ae76e76da8a322cd73e1d Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 14 Jul 2013 23:31:19 +0200
|
||||
Subject: [PATCH 119/133] USB: phy: add ralink SoC driver
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/usb/phy/Kconfig | 8 ++
|
||||
drivers/usb/phy/Makefile | 1 +
|
||||
drivers/usb/phy/ralink-phy.c | 191 ++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 200 insertions(+)
|
||||
create mode 100644 drivers/usb/phy/ralink-phy.c
|
||||
|
||||
--- a/drivers/usb/phy/Kconfig
|
||||
+++ b/drivers/usb/phy/Kconfig
|
||||
@@ -210,4 +210,12 @@ config USB_ULPI_VIEWPORT
|
||||
Provides read/write operations to the ULPI phy register set for
|
||||
controllers with a viewport register (e.g. Chipidea/ARC controllers).
|
||||
|
||||
+config RALINK_USBPHY
|
||||
+ bool "Ralink USB PHY controller Driver"
|
||||
+ depends on MIPS && RALINK
|
||||
+ select USB_OTG_UTILS
|
||||
+ help
|
||||
+ Enable this to support ralink USB phy controller for ralink
|
||||
+ SoCs.
|
||||
+
|
||||
endif # USB_PHY
|
||||
--- a/drivers/usb/phy/Makefile
|
||||
+++ b/drivers/usb/phy/Makefile
|
||||
@@ -31,3 +31,4 @@ obj-$(CONFIG_USB_MXS_PHY) += phy-mxs-us
|
||||
obj-$(CONFIG_USB_RCAR_PHY) += phy-rcar-usb.o
|
||||
obj-$(CONFIG_USB_ULPI) += phy-ulpi.o
|
||||
obj-$(CONFIG_USB_ULPI_VIEWPORT) += phy-ulpi-viewport.o
|
||||
+obj-$(CONFIG_RALINK_USBPHY) += ralink-phy.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/usb/phy/ralink-phy.c
|
||||
@@ -0,0 +1,192 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+ *
|
||||
+ * based on: Renesas R-Car USB phy driver
|
||||
+ *
|
||||
+ * 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/delay.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/usb/otg.h>
|
||||
+#include <linux/of_platform.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/spinlock.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/reset.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/ralink_regs.h>
|
||||
+
|
||||
+#define RT_SYSC_REG_SYSCFG1 0x014
|
||||
+#define RT_SYSC_REG_CLKCFG1 0x030
|
||||
+#define RT_SYSC_REG_USB_PHY_CFG 0x05c
|
||||
+
|
||||
+#define RT_RSTCTRL_UDEV BIT(25)
|
||||
+#define RT_RSTCTRL_UHST BIT(22)
|
||||
+#define RT_SYSCFG1_USB0_HOST_MODE BIT(10)
|
||||
+
|
||||
+#define MT7620_CLKCFG1_UPHY0_CLK_EN BIT(25)
|
||||
+#define MT7620_CLKCFG1_UPHY1_CLK_EN BIT(22)
|
||||
+#define RT_CLKCFG1_UPHY1_CLK_EN BIT(20)
|
||||
+#define RT_CLKCFG1_UPHY0_CLK_EN BIT(18)
|
||||
+
|
||||
+#define USB_PHY_UTMI_8B60M BIT(1)
|
||||
+#define UDEV_WAKEUP BIT(0)
|
||||
+
|
||||
+static atomic_t usb_pwr_ref = ATOMIC_INIT(0);
|
||||
+static struct reset_control *rstdev;
|
||||
+static struct reset_control *rsthost;
|
||||
+static u32 phy_clk;
|
||||
+
|
||||
+static void usb_phy_enable(int state)
|
||||
+{
|
||||
+ if (state)
|
||||
+ rt_sysc_m32(0, phy_clk, RT_SYSC_REG_CLKCFG1);
|
||||
+ else
|
||||
+ rt_sysc_m32(phy_clk, 0, RT_SYSC_REG_CLKCFG1);
|
||||
+ mdelay(100);
|
||||
+}
|
||||
+
|
||||
+static int usb_power_on(struct usb_phy *phy)
|
||||
+{
|
||||
+ if (atomic_inc_return(&usb_pwr_ref) == 1) {
|
||||
+ u32 t;
|
||||
+
|
||||
+ usb_phy_enable(1);
|
||||
+
|
||||
+// reset_control_assert(rstdev);
|
||||
+// reset_control_assert(rsthost);
|
||||
+
|
||||
+ if (OTG_STATE_B_HOST) {
|
||||
+ rt_sysc_m32(0, RT_SYSCFG1_USB0_HOST_MODE, RT_SYSC_REG_SYSCFG1);
|
||||
+ reset_control_deassert(rsthost);
|
||||
+ } else {
|
||||
+ rt_sysc_m32(RT_SYSCFG1_USB0_HOST_MODE, 0, RT_SYSC_REG_SYSCFG1);
|
||||
+ reset_control_deassert(rstdev);
|
||||
+ }
|
||||
+ mdelay(100);
|
||||
+
|
||||
+ t = rt_sysc_r32(RT_SYSC_REG_USB_PHY_CFG);
|
||||
+ dev_info(phy->dev, "remote usb device wakeup %s\n",
|
||||
+ (t & UDEV_WAKEUP) ? ("enabbled") : ("disabled"));
|
||||
+ if (t & USB_PHY_UTMI_8B60M)
|
||||
+ dev_info(phy->dev, "UTMI 8bit 60MHz\n");
|
||||
+ else
|
||||
+ dev_info(phy->dev, "UTMI 16bit 30MHz\n");
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void usb_power_off(struct usb_phy *phy)
|
||||
+{
|
||||
+ if (atomic_dec_return(&usb_pwr_ref) == 0) {
|
||||
+ usb_phy_enable(0);
|
||||
+ reset_control_assert(rstdev);
|
||||
+ reset_control_assert(rsthost);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int usb_set_host(struct usb_otg *otg, struct usb_bus *host)
|
||||
+{
|
||||
+ otg->gadget = NULL;
|
||||
+ otg->host = host;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int usb_set_peripheral(struct usb_otg *otg,
|
||||
+ struct usb_gadget *gadget)
|
||||
+{
|
||||
+ otg->host = NULL;
|
||||
+ otg->gadget = gadget;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id ralink_usbphy_dt_match[] = {
|
||||
+ { .compatible = "ralink,rt3xxx-usbphy", .data = (void *) (RT_CLKCFG1_UPHY1_CLK_EN | RT_CLKCFG1_UPHY0_CLK_EN) },
|
||||
+ { .compatible = "ralink,mt7620a-usbphy", .data = (void *) (MT7620_CLKCFG1_UPHY1_CLK_EN | MT7620_CLKCFG1_UPHY0_CLK_EN) },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, ralink_usbphy_dt_match);
|
||||
+
|
||||
+static int usb_phy_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ const struct of_device_id *match;
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct usb_otg *otg;
|
||||
+ struct usb_phy *phy;
|
||||
+ int ret;
|
||||
+
|
||||
+ match = of_match_device(ralink_usbphy_dt_match, &pdev->dev);
|
||||
+ phy_clk = (int) match->data;
|
||||
+
|
||||
+ rsthost = devm_reset_control_get(&pdev->dev, "host");
|
||||
+ if (IS_ERR(rsthost))
|
||||
+ return PTR_ERR(rsthost);
|
||||
+
|
||||
+ rstdev = devm_reset_control_get(&pdev->dev, "device");
|
||||
+ if (IS_ERR(rstdev))
|
||||
+ return PTR_ERR(rstdev);
|
||||
+
|
||||
+ phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
|
||||
+ if (!phy) {
|
||||
+ dev_err(&pdev->dev, "unable to allocate memory for USB PHY\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL);
|
||||
+ if (!otg) {
|
||||
+ dev_err(&pdev->dev, "unable to allocate memory for USB OTG\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ phy->dev = dev;
|
||||
+ phy->label = dev_name(dev);
|
||||
+ phy->init = usb_power_on;
|
||||
+ phy->shutdown = usb_power_off;
|
||||
+ otg->set_host = usb_set_host;
|
||||
+ otg->set_peripheral = usb_set_peripheral;
|
||||
+ otg->phy = phy;
|
||||
+ phy->otg = otg;
|
||||
+ ret = usb_add_phy(phy, USB_PHY_TYPE_USB2);
|
||||
+
|
||||
+ if (ret < 0) {
|
||||
+ dev_err(dev, "usb phy addition error\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ platform_set_drvdata(pdev, phy);
|
||||
+
|
||||
+ dev_info(&pdev->dev, "loaded\n");
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int usb_phy_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct usb_phy *phy = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ usb_remove_phy(phy);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct platform_driver usb_phy_driver = {
|
||||
+ .driver = {
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .name = "rt3xxx-usbphy",
|
||||
+ .of_match_table = of_match_ptr(ralink_usbphy_dt_match),
|
||||
+ },
|
||||
+ .probe = usb_phy_probe,
|
||||
+ .remove = usb_phy_remove,
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(usb_phy_driver);
|
||||
+
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
+MODULE_DESCRIPTION("Ralink USB phy");
|
||||
+MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
|
|
@ -1,174 +0,0 @@
|
|||
From 08d438b69f3023f16b044b07eebee6b9c2302f60 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 14 Jul 2013 23:34:53 +0200
|
||||
Subject: [PATCH 120/133] USB: add OHCI/EHCI OF binding
|
||||
|
||||
based on f3bc64d6d1f21c1b92d75f233a37b75d77af6963
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/usb/Makefile | 3 ++-
|
||||
drivers/usb/host/ehci-platform.c | 21 +++++++++++++++++----
|
||||
drivers/usb/host/ohci-platform.c | 37 ++++++++++++++++++++++++++++++++-----
|
||||
3 files changed, 51 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/drivers/usb/Makefile
|
||||
+++ b/drivers/usb/Makefile
|
||||
@@ -10,6 +10,8 @@ obj-$(CONFIG_USB_DWC3) += dwc3/
|
||||
|
||||
obj-$(CONFIG_USB_MON) += mon/
|
||||
|
||||
+obj-$(CONFIG_USB_PHY) += phy/
|
||||
+
|
||||
obj-$(CONFIG_PCI) += host/
|
||||
obj-$(CONFIG_USB_EHCI_HCD) += host/
|
||||
obj-$(CONFIG_USB_ISP116X_HCD) += host/
|
||||
@@ -44,7 +46,6 @@ obj-$(CONFIG_USB_MICROTEK) += image/
|
||||
obj-$(CONFIG_USB_SERIAL) += serial/
|
||||
|
||||
obj-$(CONFIG_USB) += misc/
|
||||
-obj-$(CONFIG_USB_PHY) += phy/
|
||||
obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/
|
||||
|
||||
obj-$(CONFIG_USB_ATM) += atm/
|
||||
--- a/drivers/usb/host/ehci-platform.c
|
||||
+++ b/drivers/usb/host/ehci-platform.c
|
||||
@@ -29,6 +29,8 @@
|
||||
#include <linux/usb.h>
|
||||
#include <linux/usb/hcd.h>
|
||||
#include <linux/usb/ehci_pdriver.h>
|
||||
+#include <linux/usb/phy.h>
|
||||
+#include <linux/usb/otg.h>
|
||||
|
||||
#include "ehci.h"
|
||||
|
||||
@@ -118,6 +120,15 @@ static int ehci_platform_probe(struct pl
|
||||
hcd->rsrc_start = res_mem->start;
|
||||
hcd->rsrc_len = resource_size(res_mem);
|
||||
|
||||
+#ifdef CONFIG_USB_PHY
|
||||
+ hcd->phy = devm_usb_get_phy(&dev->dev, USB_PHY_TYPE_USB2);
|
||||
+ if (!IS_ERR_OR_NULL(hcd->phy)) {
|
||||
+ otg_set_host(hcd->phy->otg,
|
||||
+ &hcd->self);
|
||||
+ usb_phy_init(hcd->phy);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);
|
||||
if (IS_ERR(hcd->regs)) {
|
||||
err = PTR_ERR(hcd->regs);
|
||||
@@ -155,6 +166,9 @@ static int ehci_platform_remove(struct p
|
||||
if (pdata == &ehci_platform_defaults)
|
||||
dev->dev.platform_data = NULL;
|
||||
|
||||
+ if (pdata == &ehci_platform_defaults)
|
||||
+ dev->dev.platform_data = NULL;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -199,9 +213,8 @@ static int ehci_platform_resume(struct d
|
||||
#define ehci_platform_resume NULL
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
-static const struct of_device_id vt8500_ehci_ids[] = {
|
||||
- { .compatible = "via,vt8500-ehci", },
|
||||
- { .compatible = "wm,prizm-ehci", },
|
||||
+static const struct of_device_id ralink_ehci_ids[] = {
|
||||
+ { .compatible = "ralink,rt3xxx-ehci", },
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -225,7 +238,7 @@ static struct platform_driver ehci_platf
|
||||
.owner = THIS_MODULE,
|
||||
.name = "ehci-platform",
|
||||
.pm = &ehci_platform_pm_ops,
|
||||
- .of_match_table = of_match_ptr(vt8500_ehci_ids),
|
||||
+ .of_match_table = of_match_ptr(ralink_ehci_ids),
|
||||
}
|
||||
};
|
||||
|
||||
--- a/drivers/usb/host/ohci-platform.c
|
||||
+++ b/drivers/usb/host/ohci-platform.c
|
||||
@@ -16,6 +16,10 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/usb/ohci_pdriver.h>
|
||||
+#include <linux/dma-mapping.h>
|
||||
+#include <linux/of.h>
|
||||
+
|
||||
+static struct usb_ohci_pdata ohci_platform_defaults;
|
||||
|
||||
static int ohci_platform_reset(struct usb_hcd *hcd)
|
||||
{
|
||||
@@ -88,14 +92,22 @@ static int ohci_platform_probe(struct pl
|
||||
{
|
||||
struct usb_hcd *hcd;
|
||||
struct resource *res_mem;
|
||||
- struct usb_ohci_pdata *pdata = dev->dev.platform_data;
|
||||
+ struct usb_ohci_pdata *pdata;
|
||||
int irq;
|
||||
int err = -ENOMEM;
|
||||
|
||||
- if (!pdata) {
|
||||
- WARN_ON(1);
|
||||
- return -ENODEV;
|
||||
- }
|
||||
+ /*
|
||||
+ * use reasonable defaults so platforms don't have to provide these.
|
||||
+ * with DT probing on ARM, none of these are set.
|
||||
+ */
|
||||
+ if (!dev->dev.platform_data)
|
||||
+ dev->dev.platform_data = &ohci_platform_defaults;
|
||||
+ if (!dev->dev.dma_mask)
|
||||
+ dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
|
||||
+ if (!dev->dev.coherent_dma_mask)
|
||||
+ dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
|
||||
+
|
||||
+ pdata = dev->dev.platform_data;
|
||||
|
||||
if (usb_disabled())
|
||||
return -ENODEV;
|
||||
@@ -128,6 +140,12 @@ static int ohci_platform_probe(struct pl
|
||||
hcd->rsrc_start = res_mem->start;
|
||||
hcd->rsrc_len = resource_size(res_mem);
|
||||
|
||||
+#ifdef CONFIG_USB_PHY
|
||||
+ hcd->phy = devm_usb_get_phy(&dev->dev, USB_PHY_TYPE_USB2);
|
||||
+ if (!IS_ERR_OR_NULL(hcd->phy))
|
||||
+ usb_phy_init(hcd->phy);
|
||||
+#endif
|
||||
+
|
||||
hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);
|
||||
if (IS_ERR(hcd->regs)) {
|
||||
err = PTR_ERR(hcd->regs);
|
||||
@@ -162,6 +180,9 @@ static int ohci_platform_remove(struct p
|
||||
if (pdata->power_off)
|
||||
pdata->power_off(dev);
|
||||
|
||||
+ if (pdata == &ohci_platform_defaults)
|
||||
+ dev->dev.platform_data = NULL;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -201,6 +222,11 @@ static int ohci_platform_resume(struct d
|
||||
#define ohci_platform_resume NULL
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
+static const struct of_device_id ralink_ohci_ids[] = {
|
||||
+ { .compatible = "ralink,rt3xxx-ohci", },
|
||||
+ {}
|
||||
+};
|
||||
+
|
||||
static const struct platform_device_id ohci_platform_table[] = {
|
||||
{ "ohci-platform", 0 },
|
||||
{ }
|
||||
@@ -221,5 +247,6 @@ static struct platform_driver ohci_platf
|
||||
.owner = THIS_MODULE,
|
||||
.name = "ohci-platform",
|
||||
.pm = &ohci_platform_pm_ops,
|
||||
+ .of_match_table = of_match_ptr(ralink_ohci_ids),
|
||||
}
|
||||
};
|
File diff suppressed because it is too large
Load diff
|
@ -1,23 +0,0 @@
|
|||
From 16f476a7528eefade4bd4ebee12d5aa2052bba8c Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Fri, 15 Mar 2013 18:16:01 +0100
|
||||
Subject: [PATCH 122/133] serial: ralink: adds mt7620 serial
|
||||
|
||||
Add the config symbol for Mediatek7620 SoC to SERIAL_8250_RT288X
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/tty/serial/8250/Kconfig | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/tty/serial/8250/Kconfig
|
||||
+++ b/drivers/tty/serial/8250/Kconfig
|
||||
@@ -300,7 +300,7 @@ config SERIAL_8250_EM
|
||||
|
||||
config SERIAL_8250_RT288X
|
||||
bool "Ralink RT288x/RT305x/RT3662/RT3883 serial port support"
|
||||
- depends on SERIAL_8250 && (SOC_RT288X || SOC_RT305X || SOC_RT3883)
|
||||
+ depends on SERIAL_8250 && (SOC_RT288X || SOC_RT305X || SOC_RT3883 || SOC_MT7620)
|
||||
help
|
||||
If you have a Ralink RT288x/RT305x SoC based board and want to use the
|
||||
serial port, say Y to this option. The driver can handle up to 2 serial
|
|
@ -1,22 +0,0 @@
|
|||
From 304c4f060cfa6b44370ad3fe6a16963cac35b10a Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 16 Mar 2014 04:52:01 +0000
|
||||
Subject: [PATCH 123/133] serial: ralink: the core has a size of 0x100 and not
|
||||
0x1000
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/tty/serial/8250/8250_core.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/tty/serial/8250/8250_core.c
|
||||
+++ b/drivers/tty/serial/8250/8250_core.c
|
||||
@@ -2499,7 +2499,7 @@ serial8250_pm(struct uart_port *port, un
|
||||
static unsigned int serial8250_port_size(struct uart_8250_port *pt)
|
||||
{
|
||||
if (pt->port.iotype == UPIO_AU)
|
||||
- return 0x1000;
|
||||
+ return 0x100;
|
||||
if (is_omap1_8250(pt))
|
||||
return 0x16 << pt->port.regshift;
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
From 3f70be332048f6a903dc35f73ff5381be3b8f12b Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 14 Jul 2013 23:18:57 +0200
|
||||
Subject: [PATCH 124/133] serial: of: allow au1x00 and rt288x to load from OF
|
||||
|
||||
In order to make serial_8250 loadable via OF on Au1x00 and Ralink WiSoC we need
|
||||
to default the iotype to UPIO_AU.
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/tty/serial/of_serial.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/tty/serial/of_serial.c
|
||||
+++ b/drivers/tty/serial/of_serial.c
|
||||
@@ -103,7 +103,10 @@ static int of_platform_serial_setup(stru
|
||||
port->fifosize = prop;
|
||||
|
||||
port->irq = irq_of_parse_and_map(np, 0);
|
||||
- port->iotype = UPIO_MEM;
|
||||
+ if (of_device_is_compatible(np, "ralink,rt2880-uart"))
|
||||
+ port->iotype = UPIO_AU;
|
||||
+ else
|
||||
+ port->iotype = UPIO_MEM;
|
||||
if (of_property_read_u32(np, "reg-io-width", &prop) == 0) {
|
||||
switch (prop) {
|
||||
case 1:
|
|
@ -1,345 +0,0 @@
|
|||
From 701cd2fb0513d17f248048b3a6f2c7d1ea294681 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Mon, 29 Apr 2013 14:40:43 +0200
|
||||
Subject: [PATCH 125/133] i2c: MIPS: adds ralink I2C driver
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
.../devicetree/bindings/i2c/i2c-ralink.txt | 27 ++
|
||||
drivers/i2c/busses/Kconfig | 4 +
|
||||
drivers/i2c/busses/Makefile | 1 +
|
||||
drivers/i2c/busses/i2c-ralink.c | 274 ++++++++++++++++++++
|
||||
4 files changed, 306 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/i2c/i2c-ralink.txt
|
||||
create mode 100644 drivers/i2c/busses/i2c-ralink.c
|
||||
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/i2c/i2c-ralink.txt
|
||||
@@ -0,0 +1,27 @@
|
||||
+I2C for Ralink platforms
|
||||
+
|
||||
+Required properties :
|
||||
+- compatible : Must be "link,rt3052-i2c"
|
||||
+- reg: physical base address of the controller and length of memory mapped
|
||||
+ region.
|
||||
+- #address-cells = <1>;
|
||||
+- #size-cells = <0>;
|
||||
+
|
||||
+Optional properties:
|
||||
+- Child nodes conforming to i2c bus binding
|
||||
+
|
||||
+Example :
|
||||
+
|
||||
+palmbus@10000000 {
|
||||
+ i2c@900 {
|
||||
+ compatible = "link,rt3052-i2c";
|
||||
+ reg = <0x900 0x100>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ hwmon@4b {
|
||||
+ compatible = "national,lm92";
|
||||
+ reg = <0x4b>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
--- a/drivers/i2c/busses/Kconfig
|
||||
+++ b/drivers/i2c/busses/Kconfig
|
||||
@@ -632,6 +632,10 @@ config I2C_PXA_SLAVE
|
||||
is necessary for systems where the PXA may be a target on the
|
||||
I2C bus.
|
||||
|
||||
+config I2C_RALINK
|
||||
+ tristate "Ralink I2C Controller"
|
||||
+ select OF_I2C
|
||||
+
|
||||
config HAVE_S3C2410_I2C
|
||||
bool
|
||||
help
|
||||
--- a/drivers/i2c/busses/Makefile
|
||||
+++ b/drivers/i2c/busses/Makefile
|
||||
@@ -62,6 +62,7 @@ obj-$(CONFIG_I2C_PNX) += i2c-pnx.o
|
||||
obj-$(CONFIG_I2C_PUV3) += i2c-puv3.o
|
||||
obj-$(CONFIG_I2C_PXA) += i2c-pxa.o
|
||||
obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o
|
||||
+obj-$(CONFIG_I2C_RALINK) += i2c-ralink.o
|
||||
obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o
|
||||
obj-$(CONFIG_I2C_S6000) += i2c-s6000.o
|
||||
obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/i2c/busses/i2c-ralink.c
|
||||
@@ -0,0 +1,274 @@
|
||||
+/*
|
||||
+ * drivers/i2c/busses/i2c-ralink.c
|
||||
+ *
|
||||
+ * Copyright (C) 2013 Steven Liu <steven_liu@mediatek.com>
|
||||
+ *
|
||||
+ * This software is licensed under the terms of the GNU General Public
|
||||
+ * License version 2, as published by the Free Software Foundation, and
|
||||
+ * may be copied, distributed, and modified under those terms.
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/reset.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/errno.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/i2c.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/of_i2c.h>
|
||||
+#include <linux/err.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/ralink_regs.h>
|
||||
+
|
||||
+#define REG_CONFIG_REG 0x00
|
||||
+#define REG_CLKDIV_REG 0x04
|
||||
+#define REG_DEVADDR_REG 0x08
|
||||
+#define REG_ADDR_REG 0x0C
|
||||
+#define REG_DATAOUT_REG 0x10
|
||||
+#define REG_DATAIN_REG 0x14
|
||||
+#define REG_STATUS_REG 0x18
|
||||
+#define REG_STARTXFR_REG 0x1C
|
||||
+#define REG_BYTECNT_REG 0x20
|
||||
+
|
||||
+#define I2C_STARTERR BIT(4)
|
||||
+#define I2C_ACKERR BIT(3)
|
||||
+#define I2C_DATARDY BIT(2)
|
||||
+#define I2C_SDOEMPTY BIT(1)
|
||||
+#define I2C_BUSY BIT(0)
|
||||
+
|
||||
+#define I2C_DEVADLEN_7 (6 << 2)
|
||||
+#define I2C_ADDRDIS BIT(1)
|
||||
+
|
||||
+#define I2C_RETRY 0x400
|
||||
+
|
||||
+#define CLKDIV_VALUE 200 // clock rate is 40M, 40M / (200*2) = 100k (standard i2c bus rate).
|
||||
+//#define CLKDIV_VALUE 50 // clock rate is 40M, 40M / (50*2) = 400k (fast i2c bus rate).
|
||||
+
|
||||
+#define READ_CMD 0x01
|
||||
+#define WRITE_CMD 0x00
|
||||
+#define READ_BLOCK 64
|
||||
+
|
||||
+static void __iomem *membase;
|
||||
+static struct i2c_adapter *adapter;
|
||||
+
|
||||
+static void rt_i2c_w32(u32 val, unsigned reg)
|
||||
+{
|
||||
+ iowrite32(val, membase + reg);
|
||||
+}
|
||||
+
|
||||
+static u32 rt_i2c_r32(unsigned reg)
|
||||
+{
|
||||
+ return ioread32(membase + reg);
|
||||
+}
|
||||
+
|
||||
+static inline int rt_i2c_wait_rx_done(void)
|
||||
+{
|
||||
+ int retries = I2C_RETRY;
|
||||
+
|
||||
+ do {
|
||||
+ if (!retries--)
|
||||
+ break;
|
||||
+ } while(!(rt_i2c_r32(REG_STATUS_REG) & I2C_DATARDY));
|
||||
+
|
||||
+ return (retries < 0);
|
||||
+}
|
||||
+
|
||||
+static inline int rt_i2c_wait_idle(void)
|
||||
+{
|
||||
+ int retries = I2C_RETRY;
|
||||
+
|
||||
+ do {
|
||||
+ if (!retries--)
|
||||
+ break;
|
||||
+ } while(rt_i2c_r32(REG_STATUS_REG) & I2C_BUSY);
|
||||
+
|
||||
+ return (retries < 0);
|
||||
+}
|
||||
+
|
||||
+static inline int rt_i2c_wait_tx_done(void)
|
||||
+{
|
||||
+ int retries = I2C_RETRY;
|
||||
+
|
||||
+ do {
|
||||
+ if (!retries--)
|
||||
+ break;
|
||||
+ } while(!(rt_i2c_r32(REG_STATUS_REG) & I2C_SDOEMPTY));
|
||||
+
|
||||
+ return (retries < 0);
|
||||
+}
|
||||
+
|
||||
+static int rt_i2c_handle_msg(struct i2c_adapter *a, struct i2c_msg* msg)
|
||||
+{
|
||||
+ int i = 0, j = 0, pos = 0;
|
||||
+ int nblock = msg->len / READ_BLOCK;
|
||||
+ int rem = msg->len % READ_BLOCK;
|
||||
+
|
||||
+ if (msg->flags & I2C_M_TEN) {
|
||||
+ printk("10 bits addr not supported\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (msg->flags & I2C_M_RD) {
|
||||
+ for (i = 0; i < nblock; i++) {
|
||||
+ rt_i2c_wait_idle();
|
||||
+ rt_i2c_w32(READ_BLOCK - 1, REG_BYTECNT_REG);
|
||||
+ rt_i2c_w32(READ_CMD, REG_STARTXFR_REG);
|
||||
+ for (j = 0; j < READ_BLOCK; j++) {
|
||||
+ if (rt_i2c_wait_rx_done())
|
||||
+ return -1;
|
||||
+ msg->buf[pos++] = rt_i2c_r32(REG_DATAIN_REG);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ rt_i2c_wait_idle();
|
||||
+ rt_i2c_w32(rem - 1, REG_BYTECNT_REG);
|
||||
+ rt_i2c_w32(READ_CMD, REG_STARTXFR_REG);
|
||||
+ for (i = 0; i < rem; i++) {
|
||||
+ if (rt_i2c_wait_rx_done())
|
||||
+ return -1;
|
||||
+ msg->buf[pos++] = rt_i2c_r32(REG_DATAIN_REG);
|
||||
+ }
|
||||
+ } else {
|
||||
+ rt_i2c_wait_idle();
|
||||
+ rt_i2c_w32(msg->len - 1, REG_BYTECNT_REG);
|
||||
+ for (i = 0; i < msg->len; i++) {
|
||||
+ rt_i2c_w32(msg->buf[i], REG_DATAOUT_REG);
|
||||
+ rt_i2c_w32(WRITE_CMD, REG_STARTXFR_REG);
|
||||
+ if (rt_i2c_wait_tx_done())
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt_i2c_master_xfer(struct i2c_adapter *a, struct i2c_msg *m, int n)
|
||||
+{
|
||||
+ int i = 0;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (rt_i2c_wait_idle()) {
|
||||
+ printk("i2c transfer failed\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ device_reset(a->dev.parent);
|
||||
+
|
||||
+ rt_i2c_w32(m->addr, REG_DEVADDR_REG);
|
||||
+ rt_i2c_w32(I2C_DEVADLEN_7 | I2C_ADDRDIS, REG_CONFIG_REG);
|
||||
+ rt_i2c_w32(CLKDIV_VALUE, REG_CLKDIV_REG);
|
||||
+
|
||||
+ for (i = 0; i < n && !ret; i++)
|
||||
+ ret = rt_i2c_handle_msg(a, &m[i]);
|
||||
+
|
||||
+ if (ret) {
|
||||
+ printk("i2c transfer failed\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return n;
|
||||
+}
|
||||
+
|
||||
+static u32 rt_i2c_func(struct i2c_adapter *a)
|
||||
+{
|
||||
+ return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
|
||||
+}
|
||||
+
|
||||
+static const struct i2c_algorithm rt_i2c_algo = {
|
||||
+ .master_xfer = rt_i2c_master_xfer,
|
||||
+ .functionality = rt_i2c_func,
|
||||
+};
|
||||
+
|
||||
+static int rt_i2c_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!res) {
|
||||
+ dev_err(&pdev->dev, "no memory resource found\n");
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ adapter = devm_kzalloc(&pdev->dev, sizeof(struct i2c_adapter), GFP_KERNEL);
|
||||
+ if (!adapter) {
|
||||
+ dev_err(&pdev->dev, "failed to allocate i2c_adapter\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ membase = devm_request_and_ioremap(&pdev->dev, res);
|
||||
+ if (IS_ERR(membase))
|
||||
+ return PTR_ERR(membase);
|
||||
+
|
||||
+ strlcpy(adapter->name, dev_name(&pdev->dev), sizeof(adapter->name));
|
||||
+ adapter->owner = THIS_MODULE;
|
||||
+ adapter->nr = pdev->id;
|
||||
+ adapter->timeout = HZ;
|
||||
+ adapter->algo = &rt_i2c_algo;
|
||||
+ adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
|
||||
+ adapter->dev.parent = &pdev->dev;
|
||||
+ adapter->dev.of_node = pdev->dev.of_node;
|
||||
+
|
||||
+ ret = i2c_add_numbered_adapter(adapter);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ of_i2c_register_devices(adapter);
|
||||
+
|
||||
+ platform_set_drvdata(pdev, adapter);
|
||||
+
|
||||
+ dev_info(&pdev->dev, "loaded\n");
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int rt_i2c_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ platform_set_drvdata(pdev, NULL);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id i2c_rt_dt_ids[] = {
|
||||
+ { .compatible = "ralink,rt2880-i2c", },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+
|
||||
+MODULE_DEVICE_TABLE(of, i2c_rt_dt_ids);
|
||||
+
|
||||
+static struct platform_driver rt_i2c_driver = {
|
||||
+ .probe = rt_i2c_probe,
|
||||
+ .remove = rt_i2c_remove,
|
||||
+ .driver = {
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .name = "i2c-ralink",
|
||||
+ .of_match_table = i2c_rt_dt_ids,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init i2c_rt_init (void)
|
||||
+{
|
||||
+ return platform_driver_register(&rt_i2c_driver);
|
||||
+}
|
||||
+subsys_initcall(i2c_rt_init);
|
||||
+
|
||||
+static void __exit i2c_rt_exit (void)
|
||||
+{
|
||||
+ platform_driver_unregister(&rt_i2c_driver);
|
||||
+}
|
||||
+
|
||||
+module_exit (i2c_rt_exit);
|
||||
+
|
||||
+MODULE_AUTHOR("Steven Liu <steven_liu@mediatek.com>");
|
||||
+MODULE_DESCRIPTION("Ralink I2c host driver");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_ALIAS("platform:Ralink-I2C");
|
|
@ -1,29 +0,0 @@
|
|||
From b07600f50efe84d7e3b431e6d10fe774bb00d573 Mon Sep 17 00:00:00 2001
|
||||
From: Stephen Warren <swarren@wwwdotorg.org>
|
||||
Date: Tue, 21 May 2013 20:36:34 -0600
|
||||
Subject: [PATCH 126/133] spi: introduce macros to set bits_per_word_mask
|
||||
|
||||
Introduce two macros to make setting up spi_master.bits_per_word_mask
|
||||
easier, and avoid mistakes like writing BIT(n) instead of BIT(n - 1).
|
||||
|
||||
SPI_BPW_MASK is for a single supported value of bits_per_word_mask.
|
||||
|
||||
SPI_BPW_RANGE_MASK represents a contiguous set of bit lengths.
|
||||
|
||||
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
|
||||
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
---
|
||||
include/linux/spi/spi.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/include/linux/spi/spi.h
|
||||
+++ b/include/linux/spi/spi.h
|
||||
@@ -308,6 +308,8 @@ struct spi_master {
|
||||
|
||||
/* bitmask of supported bits_per_word for transfers */
|
||||
u32 bits_per_word_mask;
|
||||
+#define SPI_BPW_MASK(bits) BIT((bits) - 1)
|
||||
+#define SPI_BPW_RANGE_MASK(min, max) ((BIT(max) - 1) - (BIT(min) - 1))
|
||||
|
||||
/* other constraints relevant to this driver */
|
||||
u16 flags;
|
File diff suppressed because it is too large
Load diff
|
@ -1,29 +0,0 @@
|
|||
From 543f839e6fbeb325e6fa201e205ab18a46e37424 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Mon, 15 Jul 2013 00:38:51 +0200
|
||||
Subject: [PATCH 128/133] mtd: fix cfi cmdset 0002 erase status check
|
||||
|
||||
---
|
||||
drivers/mtd/chips/cfi_cmdset_0002.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
@@ -1957,7 +1957,7 @@ static int __xipram do_erase_chip(struct
|
||||
chip->erase_suspended = 0;
|
||||
}
|
||||
|
||||
- if (chip_ready(map, adr))
|
||||
+ if (chip_good(map, adr, map_word_ff(map)))
|
||||
break;
|
||||
|
||||
if (time_after(jiffies, timeo)) {
|
||||
@@ -2046,7 +2046,7 @@ static int __xipram do_erase_oneblock(st
|
||||
chip->erase_suspended = 0;
|
||||
}
|
||||
|
||||
- if (chip_ready(map, adr)) {
|
||||
+ if (chip_good(map, adr, map_word_ff(map))) {
|
||||
xip_enable(map, chip, adr);
|
||||
break;
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
From 0ffe6cdf77793536a77b5c85cf41deb27cfc7632 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Mon, 15 Jul 2013 00:39:21 +0200
|
||||
Subject: [PATCH 129/133] mtd: cfi cmdset 0002 force word write
|
||||
|
||||
---
|
||||
drivers/mtd/chips/cfi_cmdset_0002.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <linux/mtd/xip.h>
|
||||
|
||||
#define AMD_BOOTLOC_BUG
|
||||
-#define FORCE_WORD_WRITE 0
|
||||
+#define FORCE_WORD_WRITE 1
|
||||
|
||||
#define MAX_WORD_RETRIES 3
|
||||
|
||||
@@ -52,7 +52,9 @@
|
||||
|
||||
static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
|
||||
static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
|
||||
+#if !FORCE_WORD_WRITE
|
||||
static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
|
||||
+#endif
|
||||
static int cfi_amdstd_erase_chip(struct mtd_info *, struct erase_info *);
|
||||
static int cfi_amdstd_erase_varsize(struct mtd_info *, struct erase_info *);
|
||||
static void cfi_amdstd_sync (struct mtd_info *);
|
||||
@@ -192,6 +194,7 @@ static void fixup_amd_bootblock(struct m
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if !FORCE_WORD_WRITE
|
||||
static void fixup_use_write_buffers(struct mtd_info *mtd)
|
||||
{
|
||||
struct map_info *map = mtd->priv;
|
||||
@@ -201,6 +204,7 @@ static void fixup_use_write_buffers(stru
|
||||
mtd->_write = cfi_amdstd_write_buffers;
|
||||
}
|
||||
}
|
||||
+#endif /* !FORCE_WORD_WRITE */
|
||||
|
||||
/* Atmel chips don't use the same PRI format as AMD chips */
|
||||
static void fixup_convert_atmel_pri(struct mtd_info *mtd)
|
||||
@@ -1461,6 +1465,7 @@ static int cfi_amdstd_write_words(struct
|
||||
/*
|
||||
* FIXME: interleaved mode not tested, and probably not supported!
|
||||
*/
|
||||
+#if !FORCE_WORD_WRITE
|
||||
static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
|
||||
unsigned long adr, const u_char *buf,
|
||||
int len)
|
||||
@@ -1585,7 +1590,6 @@ static int __xipram do_write_buffer(stru
|
||||
return ret;
|
||||
}
|
||||
|
||||
-
|
||||
static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
size_t *retlen, const u_char *buf)
|
||||
{
|
||||
@@ -1660,6 +1664,7 @@ static int cfi_amdstd_write_buffers(stru
|
||||
|
||||
return 0;
|
||||
}
|
||||
+#endif /* !FORCE_WORD_WRITE */
|
||||
|
||||
/*
|
||||
* Wait for the flash chip to become ready to write data
|
File diff suppressed because it is too large
Load diff
|
@ -1,161 +0,0 @@
|
|||
From f85e6dacdb7d7a9bc37f33cf8770006ab64286f7 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Wed, 27 Nov 2013 20:58:16 +0100
|
||||
Subject: [PATCH 131/133] mtd: add chunked read io to m25p80
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/mtd/devices/m25p80.c | 127 ++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 127 insertions(+)
|
||||
|
||||
--- a/drivers/mtd/devices/m25p80.c
|
||||
+++ b/drivers/mtd/devices/m25p80.c
|
||||
@@ -392,6 +392,58 @@ static int m25p80_read(struct mtd_info *
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int m25p80_read_chunked(struct mtd_info *mtd, loff_t from, size_t len,
|
||||
+ size_t *retlen, u_char *buf)
|
||||
+{
|
||||
+ struct m25p *flash = mtd_to_m25p(mtd);
|
||||
+ struct spi_transfer t[2];
|
||||
+ struct spi_message m;
|
||||
+ uint8_t opcode;
|
||||
+ int idx = 0;
|
||||
+
|
||||
+ pr_debug("%s: %s from 0x%08x, len %zd\n", dev_name(&flash->spi->dev),
|
||||
+ __func__, (u32)from, len);
|
||||
+
|
||||
+ spi_message_init(&m);
|
||||
+ memset(t, 0, (sizeof t));
|
||||
+
|
||||
+ t[0].tx_buf = flash->command;
|
||||
+ t[0].len = m25p_cmdsz(flash);
|
||||
+ spi_message_add_tail(&t[0], &m);
|
||||
+ spi_message_add_tail(&t[1], &m);
|
||||
+
|
||||
+ *retlen = 0;
|
||||
+
|
||||
+ while (idx < len) {
|
||||
+ int rlen = (len - idx > 4) ? (4) : (len - idx);
|
||||
+
|
||||
+ t[1].rx_buf = &buf[idx];
|
||||
+ t[1].len = rlen;
|
||||
+
|
||||
+ mutex_lock(&flash->lock);
|
||||
+
|
||||
+ /* Wait till previous write/erase is done. */
|
||||
+ if (wait_till_ready(flash)) {
|
||||
+ /* REVISIT status return?? */
|
||||
+ mutex_unlock(&flash->lock);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ /* Set up the write data buffer. */
|
||||
+ opcode = OPCODE_NORM_READ;
|
||||
+ flash->command[0] = opcode;
|
||||
+ m25p_addr2cmd(flash, from + idx, flash->command);
|
||||
+
|
||||
+ spi_sync(flash->spi, &m);
|
||||
+
|
||||
+ *retlen += m.actual_length - m25p_cmdsz(flash);
|
||||
+
|
||||
+ mutex_unlock(&flash->lock);
|
||||
+ idx += rlen;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Write an address range to the flash chip. Data must be written in
|
||||
* FLASH_PAGESIZE chunks. The address range may be any size provided
|
||||
@@ -479,6 +531,76 @@ static int m25p80_write(struct mtd_info
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int m25p80_write_chunked(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
+ size_t *retlen, const u_char *buf)
|
||||
+{
|
||||
+ struct m25p *flash = mtd_to_m25p(mtd);
|
||||
+ struct spi_transfer t;
|
||||
+ struct spi_message m;
|
||||
+ u32 i, page_size;
|
||||
+ u8 tmp[8];
|
||||
+
|
||||
+ pr_debug("%s: %s to 0x%08x, len %zd\n", dev_name(&flash->spi->dev),
|
||||
+ __func__, (u32)to, len);
|
||||
+
|
||||
+ spi_message_init(&m);
|
||||
+ memset(&t, 0, (sizeof t));
|
||||
+
|
||||
+ t.tx_buf = tmp;
|
||||
+ t.len = 8;
|
||||
+ spi_message_add_tail(&t, &m);
|
||||
+
|
||||
+ mutex_lock(&flash->lock);
|
||||
+
|
||||
+ /* Wait until finished previous write command. */
|
||||
+ if (wait_till_ready(flash)) {
|
||||
+ mutex_unlock(&flash->lock);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ write_enable(flash);
|
||||
+
|
||||
+ /* Set up the opcode in the write buffer. */
|
||||
+ flash->command[0] = OPCODE_PP;
|
||||
+ m25p_addr2cmd(flash, to, flash->command);
|
||||
+
|
||||
+ t.len = 4 + (to & 0x3);
|
||||
+ if (t.len == 4)
|
||||
+ t.len = 8;
|
||||
+ memcpy(tmp, flash->command, 4);
|
||||
+ memcpy(&tmp[4], buf, t.len - 4);
|
||||
+ spi_sync(flash->spi, &m);
|
||||
+ page_size = t.len - 4;
|
||||
+
|
||||
+ *retlen = m.actual_length - m25p_cmdsz(flash);
|
||||
+
|
||||
+ /* write everything in flash->page_size chunks */
|
||||
+ for (i = page_size; i < len; i += page_size) {
|
||||
+ page_size = len - i;
|
||||
+ if (page_size > 4)
|
||||
+ page_size = 4;
|
||||
+
|
||||
+ /* write the next page to flash */
|
||||
+ m25p_addr2cmd(flash, to + i, flash->command);
|
||||
+
|
||||
+ memcpy(tmp, flash->command, 4);
|
||||
+ memcpy(&tmp[4], buf + i, page_size);
|
||||
+ t.len = 4 + page_size;
|
||||
+
|
||||
+ wait_till_ready(flash);
|
||||
+
|
||||
+ write_enable(flash);
|
||||
+
|
||||
+ spi_sync(flash->spi, &m);
|
||||
+
|
||||
+ *retlen += m.actual_length - m25p_cmdsz(flash);
|
||||
+ }
|
||||
+
|
||||
+ mutex_unlock(&flash->lock);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
size_t *retlen, const u_char *buf)
|
||||
{
|
||||
@@ -1059,6 +1181,12 @@ static int m25p_probe(struct spi_device
|
||||
flash->fast_read = true;
|
||||
#endif
|
||||
|
||||
+ if (np && of_property_read_bool(np, "m25p,chunked-io")) {
|
||||
+ dev_warn(&spi->dev, "using chunked io\n");
|
||||
+ flash->mtd._read = m25p80_read_chunked;
|
||||
+ flash->mtd._write = m25p80_write_chunked;
|
||||
+ }
|
||||
+
|
||||
#ifdef CONFIG_M25PXX_USE_FAST_READ
|
||||
flash->fast_read = true;
|
||||
#endif
|
|
@ -1,325 +0,0 @@
|
|||
From def7e226d3e5c501180bdc2fc644ff924b5a275e Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 23 Jun 2013 00:16:22 +0200
|
||||
Subject: [PATCH 132/133] GPIO: add gpio_export_with_name
|
||||
|
||||
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-November/133856.html
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
Documentation/devicetree/bindings/gpio/gpio.txt | 60 ++++++++++++++++++++
|
||||
drivers/gpio/gpiolib-of.c | 68 +++++++++++++++++++++++
|
||||
drivers/gpio/gpiolib.c | 24 +++++---
|
||||
include/asm-generic/gpio.h | 6 +-
|
||||
include/linux/gpio.h | 26 ++++++++-
|
||||
5 files changed, 172 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/gpio/gpio.txt
|
||||
+++ b/Documentation/devicetree/bindings/gpio/gpio.txt
|
||||
@@ -112,3 +112,63 @@ where,
|
||||
|
||||
The pinctrl node must have "#gpio-range-cells" property to show number of
|
||||
arguments to pass with phandle from gpio controllers node.
|
||||
+
|
||||
+3) gpio-export
|
||||
+--------------
|
||||
+
|
||||
+gpio-export will allow you to automatically export gpio
|
||||
+
|
||||
+required properties:
|
||||
+- compatible: Should be "gpio-export"
|
||||
+
|
||||
+in each child node will reprensent a gpio or if no name is specified
|
||||
+a list of gpio to export
|
||||
+
|
||||
+required properties:
|
||||
+- gpios: gpio to export
|
||||
+
|
||||
+optional properties:
|
||||
+ - gpio-export,name: export name
|
||||
+ - gpio-export,output: to set the as output with default value
|
||||
+ if no present gpio as input
|
||||
+ - pio-export,direction_may_change: boolean to allow the direction to be controllable
|
||||
+
|
||||
+Example:
|
||||
+
|
||||
+
|
||||
+gpio_export {
|
||||
+ compatible = "gpio-export";
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ in {
|
||||
+ gpio-export,name = "in";
|
||||
+ gpios = <&pioC 20 0>;
|
||||
+ };
|
||||
+
|
||||
+ out {
|
||||
+ gpio-export,name = "out";
|
||||
+ gpio-export,output = <1>;
|
||||
+ gpio-export,direction_may_change;
|
||||
+ gpios = <&pioC 21 0>;
|
||||
+ };
|
||||
+
|
||||
+ in_out {
|
||||
+ gpio-export,name = "in_out";
|
||||
+ gpio-export,direction_may_change;
|
||||
+ gpios = <&pioC 21 0>;
|
||||
+ };
|
||||
+
|
||||
+ gpios_in {
|
||||
+ gpios = <&pioB 0 0
|
||||
+ &pioB 3 0
|
||||
+ &pioC 4 0>;
|
||||
+ gpio-export,direction_may_change;
|
||||
+ };
|
||||
+
|
||||
+ gpios_out {
|
||||
+ gpios = <&pioB 1 0
|
||||
+ &pioB 2 0
|
||||
+ &pioC 3 0>;
|
||||
+ gpio-export,output = <1>;
|
||||
+ };
|
||||
+};
|
||||
--- a/drivers/gpio/gpiolib-of.c
|
||||
+++ b/drivers/gpio/gpiolib-of.c
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/pinctrl/pinctrl.h>
|
||||
#include <linux/slab.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/platform_device.h>
|
||||
|
||||
/* Private data structure for of_gpiochip_find_and_xlate */
|
||||
struct gg_data {
|
||||
@@ -242,3 +244,69 @@ void of_gpiochip_remove(struct gpio_chip
|
||||
if (chip->of_node)
|
||||
of_node_put(chip->of_node);
|
||||
}
|
||||
+
|
||||
+static struct of_device_id gpio_export_ids[] = {
|
||||
+ { .compatible = "gpio-export" },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+
|
||||
+static int __init of_gpio_export_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node;
|
||||
+ struct device_node *cnp;
|
||||
+ u32 val;
|
||||
+ int nb = 0;
|
||||
+
|
||||
+ for_each_child_of_node(np, cnp) {
|
||||
+ const char *name = NULL;
|
||||
+ int gpio;
|
||||
+ bool dmc;
|
||||
+ int max_gpio = 1;
|
||||
+ int i;
|
||||
+
|
||||
+ of_property_read_string(cnp, "gpio-export,name", &name);
|
||||
+
|
||||
+ if (!name)
|
||||
+ max_gpio = of_gpio_count(cnp);
|
||||
+
|
||||
+ for (i = 0; i < max_gpio; i++) {
|
||||
+ unsigned flags = 0;
|
||||
+ enum of_gpio_flags of_flags;
|
||||
+
|
||||
+ gpio = of_get_gpio_flags(cnp, i, &of_flags);
|
||||
+
|
||||
+ if (of_flags == OF_GPIO_ACTIVE_LOW)
|
||||
+ flags |= GPIOF_ACTIVE_LOW;
|
||||
+
|
||||
+ if (!of_property_read_u32(cnp, "gpio-export,output", &val))
|
||||
+ flags |= val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
|
||||
+ else
|
||||
+ flags |= GPIOF_IN;
|
||||
+
|
||||
+ if (devm_gpio_request_one(&pdev->dev, gpio, flags, name ? name : of_node_full_name(np)))
|
||||
+ continue;
|
||||
+
|
||||
+ dmc = of_property_read_bool(cnp, "gpio-export,direction_may_change");
|
||||
+ gpio_export_with_name(gpio, dmc, name);
|
||||
+ nb++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ dev_info(&pdev->dev, "%d gpio(s) exported\n", nb);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct platform_driver gpio_export_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "gpio-export",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = of_match_ptr(gpio_export_ids),
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init of_gpio_export_init(void)
|
||||
+{
|
||||
+ return platform_driver_probe(&gpio_export_driver, of_gpio_export_probe);
|
||||
+}
|
||||
+device_initcall(of_gpio_export_init);
|
||||
--- a/drivers/gpio/gpiolib.c
|
||||
+++ b/drivers/gpio/gpiolib.c
|
||||
@@ -96,7 +96,7 @@ static int gpiod_get_value(const struct
|
||||
static void gpiod_set_value(struct gpio_desc *desc, int value);
|
||||
static int gpiod_cansleep(const struct gpio_desc *desc);
|
||||
static int gpiod_to_irq(const struct gpio_desc *desc);
|
||||
-static int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
|
||||
+static int gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name);
|
||||
static int gpiod_export_link(struct device *dev, const char *name,
|
||||
struct gpio_desc *desc);
|
||||
static int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value);
|
||||
@@ -674,7 +674,7 @@ static ssize_t export_store(struct class
|
||||
status = -ENODEV;
|
||||
goto done;
|
||||
}
|
||||
- status = gpiod_export(desc, true);
|
||||
+ status = gpiod_export(desc, true, NULL);
|
||||
if (status < 0)
|
||||
gpiod_free(desc);
|
||||
else
|
||||
@@ -736,9 +736,10 @@ static struct class gpio_class = {
|
||||
|
||||
|
||||
/**
|
||||
- * gpio_export - export a GPIO through sysfs
|
||||
+ * gpio_export_with_name - export a GPIO through sysfs
|
||||
* @gpio: gpio to make available, already requested
|
||||
* @direction_may_change: true if userspace may change gpio direction
|
||||
+ * @name: gpio name
|
||||
* Context: arch_initcall or later
|
||||
*
|
||||
* When drivers want to make a GPIO accessible to userspace after they
|
||||
@@ -750,7 +751,7 @@ static struct class gpio_class = {
|
||||
*
|
||||
* Returns zero on success, else an error.
|
||||
*/
|
||||
-static int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
|
||||
+static int gpiod_export(struct gpio_desc *desc, bool direction_may_change, const char *name)
|
||||
{
|
||||
unsigned long flags;
|
||||
int status;
|
||||
@@ -783,6 +784,8 @@ static int gpiod_export(struct gpio_desc
|
||||
goto fail_unlock;
|
||||
}
|
||||
|
||||
+ if (name)
|
||||
+ ioname = name;
|
||||
if (!desc->chip->direction_input || !desc->chip->direction_output)
|
||||
direction_may_change = false;
|
||||
spin_unlock_irqrestore(&gpio_lock, flags);
|
||||
@@ -829,11 +832,11 @@ fail_unlock:
|
||||
return status;
|
||||
}
|
||||
|
||||
-int gpio_export(unsigned gpio, bool direction_may_change)
|
||||
+int gpio_export_with_name(unsigned gpio, bool direction_may_change, const char *name)
|
||||
{
|
||||
- return gpiod_export(gpio_to_desc(gpio), direction_may_change);
|
||||
+ return gpiod_export(gpio_to_desc(gpio), direction_may_change, name);
|
||||
}
|
||||
-EXPORT_SYMBOL_GPL(gpio_export);
|
||||
+EXPORT_SYMBOL_GPL(gpio_export_with_name);
|
||||
|
||||
static int match_export(struct device *dev, const void *data)
|
||||
{
|
||||
@@ -1092,7 +1095,7 @@ static inline void gpiochip_unexport(str
|
||||
}
|
||||
|
||||
static inline int gpiod_export(struct gpio_desc *desc,
|
||||
- bool direction_may_change)
|
||||
+ bool direction_may_change, const char *name)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
@@ -1521,6 +1524,9 @@ int gpio_request_one(unsigned gpio, unsi
|
||||
if (flags & GPIOF_OPEN_SOURCE)
|
||||
set_bit(FLAG_OPEN_SOURCE, &desc->flags);
|
||||
|
||||
+ if (flags & GPIOF_ACTIVE_LOW)
|
||||
+ set_bit(FLAG_ACTIVE_LOW, &gpio_desc[gpio].flags);
|
||||
+
|
||||
if (flags & GPIOF_DIR_IN)
|
||||
err = gpiod_direction_input(desc);
|
||||
else
|
||||
@@ -1531,7 +1537,7 @@ int gpio_request_one(unsigned gpio, unsi
|
||||
goto free_gpio;
|
||||
|
||||
if (flags & GPIOF_EXPORT) {
|
||||
- err = gpiod_export(desc, flags & GPIOF_EXPORT_CHANGEABLE);
|
||||
+ err = gpiod_export(desc, flags & GPIOF_EXPORT_CHANGEABLE, NULL);
|
||||
if (err)
|
||||
goto free_gpio;
|
||||
}
|
||||
--- a/include/asm-generic/gpio.h
|
||||
+++ b/include/asm-generic/gpio.h
|
||||
@@ -202,7 +202,8 @@ extern void gpio_free_array(const struct
|
||||
* A sysfs interface can be exported by individual drivers if they want,
|
||||
* but more typically is configured entirely from userspace.
|
||||
*/
|
||||
-extern int gpio_export(unsigned gpio, bool direction_may_change);
|
||||
+extern int gpio_export_with_name(unsigned gpio, bool direction_may_change,
|
||||
+ const char *name);
|
||||
extern int gpio_export_link(struct device *dev, const char *name,
|
||||
unsigned gpio);
|
||||
extern int gpio_sysfs_set_active_low(unsigned gpio, int value);
|
||||
@@ -284,7 +285,8 @@ struct device;
|
||||
|
||||
/* sysfs support is only available with gpiolib, where it's optional */
|
||||
|
||||
-static inline int gpio_export(unsigned gpio, bool direction_may_change)
|
||||
+static inline int gpio_export_with_name(unsigned gpio,
|
||||
+ bool direction_may_change, const char *name)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
--- a/include/linux/gpio.h
|
||||
+++ b/include/linux/gpio.h
|
||||
@@ -27,6 +27,9 @@
|
||||
#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT)
|
||||
#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE)
|
||||
|
||||
+#define GPIOF_ACTIVE_LOW (1 << 6)
|
||||
+
|
||||
+
|
||||
/**
|
||||
* struct gpio - a structure describing a GPIO with configuration
|
||||
* @gpio: the GPIO number
|
||||
@@ -169,7 +172,8 @@ static inline void gpio_set_value_cansle
|
||||
WARN_ON(1);
|
||||
}
|
||||
|
||||
-static inline int gpio_export(unsigned gpio, bool direction_may_change)
|
||||
+static inline int gpio_export_with_name(unsigned gpio,
|
||||
+ bool direction_may_change, const char *name)
|
||||
{
|
||||
/* GPIO can never have been requested or set as {in,out}put */
|
||||
WARN_ON(1);
|
||||
@@ -236,4 +240,24 @@ int devm_gpio_request_one(struct device
|
||||
unsigned long flags, const char *label);
|
||||
void devm_gpio_free(struct device *dev, unsigned int gpio);
|
||||
|
||||
+/**
|
||||
+ * gpio_export - export a GPIO through sysfs
|
||||
+ * @gpio: gpio to make available, already requested
|
||||
+ * @direction_may_change: true if userspace may change gpio direction
|
||||
+ * Context: arch_initcall or later
|
||||
+ *
|
||||
+ * When drivers want to make a GPIO accessible to userspace after they
|
||||
+ * have requested it -- perhaps while debugging, or as part of their
|
||||
+ * public interface -- they may use this routine. If the GPIO can
|
||||
+ * change direction (some can't) and the caller allows it, userspace
|
||||
+ * will see "direction" sysfs attribute which may be used to change
|
||||
+ * the gpio's direction. A "value" attribute will always be provided.
|
||||
+ *
|
||||
+ * Returns zero on success, else an error.
|
||||
+ */
|
||||
+static inline int gpio_export(unsigned gpio,bool direction_may_change)
|
||||
+{
|
||||
+ return gpio_export_with_name(gpio, direction_may_change, NULL);
|
||||
+}
|
||||
+
|
||||
#endif /* __LINUX_GPIO_H */
|
|
@ -1,246 +0,0 @@
|
|||
From 935815cd3b9690b86e70a18fb755f70becb57cc6 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Thu, 19 Sep 2013 01:50:59 +0200
|
||||
Subject: [PATCH 133/133] uvc: add iPassion iP2970 support
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/media/usb/uvc/uvc_driver.c | 14 ++++
|
||||
drivers/media/usb/uvc/uvc_status.c | 2 +
|
||||
drivers/media/usb/uvc/uvc_video.c | 147 ++++++++++++++++++++++++++++++++++++
|
||||
drivers/media/usb/uvc/uvcvideo.h | 3 +
|
||||
4 files changed, 166 insertions(+)
|
||||
|
||||
--- a/drivers/media/usb/uvc/uvc_driver.c
|
||||
+++ b/drivers/media/usb/uvc/uvc_driver.c
|
||||
@@ -2420,6 +2420,20 @@ static struct usb_device_id uvc_ids[] =
|
||||
.bInterfaceProtocol = 0,
|
||||
.driver_info = UVC_QUIRK_PROBE_MINMAX
|
||||
| UVC_QUIRK_IGNORE_SELECTOR_UNIT },
|
||||
+
|
||||
+/* iPassion iP2970 */
|
||||
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
|
||||
+ | USB_DEVICE_ID_MATCH_INT_INFO,
|
||||
+ .idVendor = 0x1B3B,
|
||||
+ .idProduct = 0x2970,
|
||||
+ .bInterfaceClass = USB_CLASS_VIDEO,
|
||||
+ .bInterfaceSubClass = 1,
|
||||
+ .bInterfaceProtocol = 0,
|
||||
+ .driver_info = UVC_QUIRK_PROBE_MINMAX
|
||||
+ | UVC_QUIRK_STREAM_NO_FID
|
||||
+ | UVC_QUIRK_MOTION
|
||||
+ | UVC_QUIRK_SINGLE_ISO },
|
||||
+
|
||||
/* Generic USB Video Class */
|
||||
{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) },
|
||||
{}
|
||||
--- a/drivers/media/usb/uvc/uvc_status.c
|
||||
+++ b/drivers/media/usb/uvc/uvc_status.c
|
||||
@@ -139,6 +139,7 @@ static void uvc_status_complete(struct u
|
||||
switch (dev->status[0] & 0x0f) {
|
||||
case UVC_STATUS_TYPE_CONTROL:
|
||||
uvc_event_control(dev, dev->status, len);
|
||||
+ dev->motion = 1;
|
||||
break;
|
||||
|
||||
case UVC_STATUS_TYPE_STREAMING:
|
||||
@@ -182,6 +183,7 @@ int uvc_status_init(struct uvc_device *d
|
||||
}
|
||||
|
||||
pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress);
|
||||
+ dev->motion = 0;
|
||||
|
||||
/* For high-speed interrupt endpoints, the bInterval value is used as
|
||||
* an exponent of two. Some developers forgot about it.
|
||||
--- a/drivers/media/usb/uvc/uvc_video.c
|
||||
+++ b/drivers/media/usb/uvc/uvc_video.c
|
||||
@@ -21,6 +21,11 @@
|
||||
#include <linux/wait.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <asm/unaligned.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <linux/kobject.h>
|
||||
+#include <linux/netlink.h>
|
||||
+#include <linux/kobject.h>
|
||||
+#include <linux/workqueue.h>
|
||||
|
||||
#include <media/v4l2-common.h>
|
||||
|
||||
@@ -1074,9 +1079,149 @@ static void uvc_video_decode_data(struct
|
||||
}
|
||||
}
|
||||
|
||||
+struct bh_priv {
|
||||
+ unsigned long seen;
|
||||
+};
|
||||
+
|
||||
+struct bh_event {
|
||||
+ const char *name;
|
||||
+ struct sk_buff *skb;
|
||||
+ struct work_struct work;
|
||||
+};
|
||||
+
|
||||
+#define BH_ERR(fmt, args...) printk(KERN_ERR "%s: " fmt, "webcam", ##args )
|
||||
+#define BH_DBG(fmt, args...) do {} while (0)
|
||||
+#define BH_SKB_SIZE 2048
|
||||
+
|
||||
+extern u64 uevent_next_seqnum(void);
|
||||
+static int seen = 0;
|
||||
+
|
||||
+static int bh_event_add_var(struct bh_event *event, int argv,
|
||||
+ const char *format, ...)
|
||||
+{
|
||||
+ static char buf[128];
|
||||
+ char *s;
|
||||
+ va_list args;
|
||||
+ int len;
|
||||
+
|
||||
+ if (argv)
|
||||
+ return 0;
|
||||
+
|
||||
+ va_start(args, format);
|
||||
+ len = vsnprintf(buf, sizeof(buf), format, args);
|
||||
+ va_end(args);
|
||||
+
|
||||
+ if (len >= sizeof(buf)) {
|
||||
+ BH_ERR("buffer size too small\n");
|
||||
+ WARN_ON(1);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ s = skb_put(event->skb, len + 1);
|
||||
+ strcpy(s, buf);
|
||||
+
|
||||
+ BH_DBG("added variable '%s'\n", s);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int motion_hotplug_fill_event(struct bh_event *event)
|
||||
+{
|
||||
+ int s = jiffies;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!seen)
|
||||
+ seen = jiffies;
|
||||
+
|
||||
+ ret = bh_event_add_var(event, 0, "HOME=%s", "/");
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = bh_event_add_var(event, 0, "PATH=%s",
|
||||
+ "/sbin:/bin:/usr/sbin:/usr/bin");
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = bh_event_add_var(event, 0, "SUBSYSTEM=usb");
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = bh_event_add_var(event, 0, "ACTION=motion");
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = bh_event_add_var(event, 0, "SEEN=%d", s - seen);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ seen = s;
|
||||
+
|
||||
+ ret = bh_event_add_var(event, 0, "SEQNUM=%llu", uevent_next_seqnum());
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void motion_hotplug_work(struct work_struct *work)
|
||||
+{
|
||||
+ struct bh_event *event = container_of(work, struct bh_event, work);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ event->skb = alloc_skb(BH_SKB_SIZE, GFP_KERNEL);
|
||||
+ if (!event->skb)
|
||||
+ goto out_free_event;
|
||||
+
|
||||
+ ret = bh_event_add_var(event, 0, "%s@", "add");
|
||||
+ if (ret)
|
||||
+ goto out_free_skb;
|
||||
+
|
||||
+ ret = motion_hotplug_fill_event(event);
|
||||
+ if (ret)
|
||||
+ goto out_free_skb;
|
||||
+
|
||||
+ NETLINK_CB(event->skb).dst_group = 1;
|
||||
+ broadcast_uevent(event->skb, 0, 1, GFP_KERNEL);
|
||||
+
|
||||
+out_free_skb:
|
||||
+ if (ret) {
|
||||
+ BH_ERR("work error %d\n", ret);
|
||||
+ kfree_skb(event->skb);
|
||||
+ }
|
||||
+out_free_event:
|
||||
+ kfree(event);
|
||||
+}
|
||||
+
|
||||
+static int motion_hotplug_create_event(void)
|
||||
+{
|
||||
+ struct bh_event *event;
|
||||
+
|
||||
+ event = kzalloc(sizeof(*event), GFP_KERNEL);
|
||||
+ if (!event)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ event->name = "motion";
|
||||
+
|
||||
+ INIT_WORK(&event->work, (void *)(void *)motion_hotplug_work);
|
||||
+ schedule_work(&event->work);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#define MOTION_FLAG_OFFSET 4
|
||||
static void uvc_video_decode_end(struct uvc_streaming *stream,
|
||||
struct uvc_buffer *buf, const __u8 *data, int len)
|
||||
{
|
||||
+ if ((stream->dev->quirks & UVC_QUIRK_MOTION) &&
|
||||
+ (data[len - 2] == 0xff) && (data[len - 1] == 0xd9)) {
|
||||
+ u8 *mem;
|
||||
+ buf->state = UVC_BUF_STATE_READY;
|
||||
+ mem = (u8 *) (buf->mem + MOTION_FLAG_OFFSET);
|
||||
+ if ( stream->dev->motion ) {
|
||||
+ stream->dev->motion = 0;
|
||||
+ motion_hotplug_create_event();
|
||||
+ } else {
|
||||
+ *mem &= 0x7f;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Mark the buffer as done if the EOF marker is set. */
|
||||
if (data[1] & UVC_STREAM_EOF && buf->bytesused != 0) {
|
||||
uvc_trace(UVC_TRACE_FRAME, "Frame complete (EOF found).\n");
|
||||
@@ -1477,6 +1622,8 @@ static int uvc_init_video_isoc(struct uv
|
||||
if (npackets == 0)
|
||||
return -ENOMEM;
|
||||
|
||||
+ if (stream->dev->quirks & UVC_QUIRK_SINGLE_ISO)
|
||||
+ npackets = 1;
|
||||
size = npackets * psize;
|
||||
|
||||
for (i = 0; i < UVC_URBS; ++i) {
|
||||
--- a/drivers/media/usb/uvc/uvcvideo.h
|
||||
+++ b/drivers/media/usb/uvc/uvcvideo.h
|
||||
@@ -137,6 +137,8 @@
|
||||
#define UVC_QUIRK_FIX_BANDWIDTH 0x00000080
|
||||
#define UVC_QUIRK_PROBE_DEF 0x00000100
|
||||
#define UVC_QUIRK_RESTRICT_FRAME_RATE 0x00000200
|
||||
+#define UVC_QUIRK_MOTION 0x00000400
|
||||
+#define UVC_QUIRK_SINGLE_ISO 0x00000800
|
||||
|
||||
/* Format flags */
|
||||
#define UVC_FMT_FLAG_COMPRESSED 0x00000001
|
||||
@@ -538,6 +540,7 @@ struct uvc_device {
|
||||
__u8 *status;
|
||||
struct input_dev *input;
|
||||
char input_phys[64];
|
||||
+ int motion;
|
||||
};
|
||||
|
||||
enum uvc_handle_state {
|
|
@ -1,13 +0,0 @@
|
|||
--- a/drivers/mtd/mtdpart.c
|
||||
+++ b/drivers/mtd/mtdpart.c
|
||||
@@ -805,10 +805,6 @@ static void split_uimage(struct mtd_info
|
||||
return;
|
||||
|
||||
len = be32_to_cpu(hdr.size) + 0x40;
|
||||
- len = mtd_pad_erasesize(master, part->offset, len);
|
||||
- if (len + master->erasesize > part->mtd.size)
|
||||
- return;
|
||||
-
|
||||
__mtd_add_partition(master, "rootfs", part->offset + len,
|
||||
part->mtd.size - len, false);
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
--- a/drivers/mtd/mtdpart.c
|
||||
+++ b/drivers/mtd/mtdpart.c
|
||||
@@ -793,8 +793,11 @@ static void split_uimage(struct mtd_info
|
||||
{
|
||||
struct {
|
||||
__be32 magic;
|
||||
- __be32 pad[2];
|
||||
+ __be32 pad0[2];
|
||||
__be32 size;
|
||||
+ __be32 pad1[4];
|
||||
+ __be32 name[7];
|
||||
+ __be32 kern_size;
|
||||
} hdr;
|
||||
size_t len;
|
||||
|
||||
@@ -804,7 +807,11 @@ static void split_uimage(struct mtd_info
|
||||
if (len != sizeof(hdr) || hdr.magic != cpu_to_be32(UBOOT_MAGIC))
|
||||
return;
|
||||
|
||||
- len = be32_to_cpu(hdr.size) + 0x40;
|
||||
+ if (hdr.kern_size != 0 && hdr.name[0] == 0)
|
||||
+ len = be32_to_cpu(hdr.kern_size);
|
||||
+ else
|
||||
+ len = be32_to_cpu(hdr.size) + 0x40;
|
||||
+
|
||||
__mtd_add_partition(master, "rootfs", part->offset + len,
|
||||
part->mtd.size - len, false);
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
From f281fdccbb3e762d293e6eef7f291a33b84e0f6a Mon Sep 17 00:00:00 2001
|
||||
From: Ralf Baechle <ralf@linux-mips.org>
|
||||
Date: Thu, 20 Jun 2013 14:56:17 +0200
|
||||
Subject: [PATCH 200/215] MIPS: Fix TLBR-use hazards for R2 cores in the TLB
|
||||
reload handlers
|
||||
|
||||
MIPS R2 documents state that an execution hazard barrier is needed
|
||||
after a TLBR before reading EntryLo.
|
||||
|
||||
Original patch by Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>.
|
||||
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/5526/
|
||||
(cherry picked from commit 73acc7df534ff458a81435178dab3ea037ed6d78)
|
||||
---
|
||||
arch/mips/mm/tlbex.c | 26 ++++++++++++++++++++++++++
|
||||
1 file changed, 26 insertions(+)
|
||||
|
||||
--- a/arch/mips/mm/tlbex.c
|
||||
+++ b/arch/mips/mm/tlbex.c
|
||||
@@ -1935,6 +1935,19 @@ static void __cpuinit build_r4000_tlb_lo
|
||||
uasm_i_nop(&p);
|
||||
|
||||
uasm_i_tlbr(&p);
|
||||
+
|
||||
+ switch (current_cpu_type()) {
|
||||
+ default:
|
||||
+ if (cpu_has_mips_r2) {
|
||||
+ uasm_i_ehb(&p);
|
||||
+
|
||||
+ case CPU_CAVIUM_OCTEON:
|
||||
+ case CPU_CAVIUM_OCTEON_PLUS:
|
||||
+ case CPU_CAVIUM_OCTEON2:
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Examine entrylo 0 or 1 based on ptr. */
|
||||
if (use_bbit_insns()) {
|
||||
uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8);
|
||||
@@ -1989,6 +2002,19 @@ static void __cpuinit build_r4000_tlb_lo
|
||||
uasm_i_nop(&p);
|
||||
|
||||
uasm_i_tlbr(&p);
|
||||
+
|
||||
+ switch (current_cpu_type()) {
|
||||
+ default:
|
||||
+ if (cpu_has_mips_r2) {
|
||||
+ uasm_i_ehb(&p);
|
||||
+
|
||||
+ case CPU_CAVIUM_OCTEON:
|
||||
+ case CPU_CAVIUM_OCTEON_PLUS:
|
||||
+ case CPU_CAVIUM_OCTEON2:
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Examine entrylo 0 or 1 based on ptr. */
|
||||
if (use_bbit_insns()) {
|
||||
uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8);
|
|
@ -1,44 +0,0 @@
|
|||
From cde59bef2f155fc38413e470ff0e4672623cdbec Mon Sep 17 00:00:00 2001
|
||||
From: Tony Wu <tung7970@gmail.com>
|
||||
Date: Fri, 21 Jun 2013 10:13:08 +0000
|
||||
Subject: [PATCH 201/215] MIPS: GIC: Fix gic_set_affinity infinite loop
|
||||
|
||||
There is an infinite loop in gic_set_affinity. When irq_set_affinity
|
||||
gets called on gic controller, it blocks forever.
|
||||
|
||||
Signed-off-by: Tony Wu <tung7970@gmail.com>
|
||||
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/5537/
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
(cherry picked from commit c214c03512b67e56dea3f4471705f8caae49553a)
|
||||
---
|
||||
arch/mips/kernel/irq-gic.c | 15 +++++++--------
|
||||
1 file changed, 7 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/arch/mips/kernel/irq-gic.c
|
||||
+++ b/arch/mips/kernel/irq-gic.c
|
||||
@@ -219,16 +219,15 @@ static int gic_set_affinity(struct irq_d
|
||||
|
||||
/* Assumption : cpumask refers to a single CPU */
|
||||
spin_lock_irqsave(&gic_lock, flags);
|
||||
- for (;;) {
|
||||
- /* Re-route this IRQ */
|
||||
- GIC_SH_MAP_TO_VPE_SMASK(irq, first_cpu(tmp));
|
||||
|
||||
- /* Update the pcpu_masks */
|
||||
- for (i = 0; i < NR_CPUS; i++)
|
||||
- clear_bit(irq, pcpu_masks[i].pcpu_mask);
|
||||
- set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask);
|
||||
+ /* Re-route this IRQ */
|
||||
+ GIC_SH_MAP_TO_VPE_SMASK(irq, first_cpu(tmp));
|
||||
+
|
||||
+ /* Update the pcpu_masks */
|
||||
+ for (i = 0; i < NR_CPUS; i++)
|
||||
+ clear_bit(irq, pcpu_masks[i].pcpu_mask);
|
||||
+ set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask);
|
||||
|
||||
- }
|
||||
cpumask_copy(d->affinity, cpumask);
|
||||
spin_unlock_irqrestore(&gic_lock, flags);
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
From 46b62174f655edf6a4befae7f9871c431146b1b6 Mon Sep 17 00:00:00 2001
|
||||
From: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
|
||||
Date: Wed, 11 Sep 2013 14:17:47 -0500
|
||||
Subject: [PATCH 202/215] MIPS: Fix SMP core calculations when using MT
|
||||
support.
|
||||
|
||||
The TCBIND register is only available if the core has MT support. It
|
||||
should not be read otherwise. Secondly, the number of TCs (siblings)
|
||||
are calculated differently depending on if the kernel is configured
|
||||
as SMVP or SMTC.
|
||||
|
||||
Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
|
||||
Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/5822/
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
(cherry picked from commit 670bac3a8c201fc1f5f92ac6b4a8b42dc8172937)
|
||||
---
|
||||
arch/mips/kernel/smp-cmp.c | 13 +++++++++++--
|
||||
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/arch/mips/kernel/smp-cmp.c
|
||||
+++ b/arch/mips/kernel/smp-cmp.c
|
||||
@@ -99,7 +99,9 @@ static void cmp_init_secondary(void)
|
||||
|
||||
c->core = (read_c0_ebase() >> 1) & 0x1ff;
|
||||
#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
|
||||
- c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE;
|
||||
+ if (cpu_has_mipsmt)
|
||||
+ c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) &
|
||||
+ TCBIND_CURVPE;
|
||||
#endif
|
||||
#ifdef CONFIG_MIPS_MT_SMTC
|
||||
c->tc_id = (read_c0_tcbind() & TCBIND_CURTC) >> TCBIND_CURTC_SHIFT;
|
||||
@@ -177,9 +179,16 @@ void __init cmp_smp_setup(void)
|
||||
}
|
||||
|
||||
if (cpu_has_mipsmt) {
|
||||
- unsigned int nvpe, mvpconf0 = read_c0_mvpconf0();
|
||||
+ unsigned int nvpe = 1;
|
||||
+#ifdef CONFIG_MIPS_MT_SMP
|
||||
+ unsigned int mvpconf0 = read_c0_mvpconf0();
|
||||
+
|
||||
+ nvpe = ((mvpconf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
|
||||
+#elif defined(CONFIG_MIPS_MT_SMTC)
|
||||
+ unsigned int mvpconf0 = read_c0_mvpconf0();
|
||||
|
||||
nvpe = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
|
||||
+#endif
|
||||
smp_num_siblings = nvpe;
|
||||
}
|
||||
pr_info("Detected %i available secondary CPU(s)\n", ncpu);
|
|
@ -1,84 +0,0 @@
|
|||
From 871d1be8c3ce46b8ef395b56cd0e37cede10e76a Mon Sep 17 00:00:00 2001
|
||||
From: Ralf Baechle <ralf@linux-mips.org>
|
||||
Date: Tue, 17 Sep 2013 12:44:31 +0200
|
||||
Subject: [PATCH 203/215] MIPS: Fix accessing to per-cpu data when flushing
|
||||
the cache
|
||||
|
||||
This fixes the following issue
|
||||
|
||||
BUG: using smp_processor_id() in preemptible [00000000] code: kjournald/1761
|
||||
caller is blast_dcache32+0x30/0x254
|
||||
Call Trace:
|
||||
[<8047f02c>] dump_stack+0x8/0x34
|
||||
[<802e7e40>] debug_smp_processor_id+0xe0/0xf0
|
||||
[<80114d94>] blast_dcache32+0x30/0x254
|
||||
[<80118484>] r4k_dma_cache_wback_inv+0x200/0x288
|
||||
[<80110ff0>] mips_dma_map_sg+0x108/0x180
|
||||
[<80355098>] ide_dma_prepare+0xf0/0x1b8
|
||||
[<8034eaa4>] do_rw_taskfile+0x1e8/0x33c
|
||||
[<8035951c>] ide_do_rw_disk+0x298/0x3e4
|
||||
[<8034a3c4>] do_ide_request+0x2e0/0x704
|
||||
[<802bb0dc>] __blk_run_queue+0x44/0x64
|
||||
[<802be000>] queue_unplugged.isra.36+0x1c/0x54
|
||||
[<802beb94>] blk_flush_plug_list+0x18c/0x24c
|
||||
[<802bec6c>] blk_finish_plug+0x18/0x48
|
||||
[<8026554c>] journal_commit_transaction+0x3b8/0x151c
|
||||
[<80269648>] kjournald+0xec/0x238
|
||||
[<8014ac00>] kthread+0xb8/0xc0
|
||||
[<8010268c>] ret_from_kernel_thread+0x14/0x1c
|
||||
|
||||
Caches in most systems are identical - but not always, so we can't avoid
|
||||
the use of smp_call_function() by just looking at the boot CPU's data,
|
||||
have to fiddle with preemption instead.
|
||||
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
Cc: Markos Chandras <markos.chandras@imgtec.com>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/5835
|
||||
(cherry picked from commit ff522058bd717506b2fa066fa564657f2b86477e)
|
||||
---
|
||||
arch/mips/mm/c-r4k.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/arch/mips/mm/c-r4k.c
|
||||
+++ b/arch/mips/mm/c-r4k.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/linkage.h>
|
||||
+#include <linux/preempt.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp.h>
|
||||
#include <linux/mm.h>
|
||||
@@ -601,6 +602,7 @@ static void r4k_dma_cache_wback_inv(unsi
|
||||
/* Catch bad driver code */
|
||||
BUG_ON(size == 0);
|
||||
|
||||
+ preempt_disable();
|
||||
if (cpu_has_inclusive_pcaches) {
|
||||
if (size >= scache_size)
|
||||
r4k_blast_scache();
|
||||
@@ -621,6 +623,7 @@ static void r4k_dma_cache_wback_inv(unsi
|
||||
R4600_HIT_CACHEOP_WAR_IMPL;
|
||||
blast_dcache_range(addr, addr + size);
|
||||
}
|
||||
+ preempt_enable();
|
||||
|
||||
bc_wback_inv(addr, size);
|
||||
__sync();
|
||||
@@ -631,6 +634,7 @@ static void r4k_dma_cache_inv(unsigned l
|
||||
/* Catch bad driver code */
|
||||
BUG_ON(size == 0);
|
||||
|
||||
+ preempt_disable();
|
||||
if (cpu_has_inclusive_pcaches) {
|
||||
if (size >= scache_size)
|
||||
r4k_blast_scache();
|
||||
@@ -655,6 +659,7 @@ static void r4k_dma_cache_inv(unsigned l
|
||||
R4600_HIT_CACHEOP_WAR_IMPL;
|
||||
blast_inv_dcache_range(addr, addr + size);
|
||||
}
|
||||
+ preempt_enable();
|
||||
|
||||
bc_inv(addr, size);
|
||||
__sync();
|
|
@ -1,60 +0,0 @@
|
|||
From 3da3528448850ccde412d52fb939575641ada80d Mon Sep 17 00:00:00 2001
|
||||
From: "Maciej W. Rozycki" <macro@linux-mips.org>
|
||||
Date: Wed, 18 Sep 2013 19:08:15 +0100
|
||||
Subject: [PATCH 204/215] MIPS: 74K/1074K: Correct erratum workaround.
|
||||
|
||||
Make sure 74K revision numbers are not applied to the 1074K. Also catch
|
||||
invalid usage.
|
||||
|
||||
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
|
||||
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
|
||||
Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
|
||||
Cc: linux-mips@linux-mips.org
|
||||
Patchwork: https://patchwork.linux-mips.org/patch/5857/
|
||||
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
||||
(cherry picked from commit 9213ad77070ea75fc3a5e43e3d9e9c4146e4930a)
|
||||
---
|
||||
arch/mips/mm/c-r4k.c | 26 ++++++++++++++++++--------
|
||||
1 file changed, 18 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/arch/mips/mm/c-r4k.c
|
||||
+++ b/arch/mips/mm/c-r4k.c
|
||||
@@ -785,20 +785,30 @@ static inline void rm7k_erratum31(void)
|
||||
|
||||
static inline void alias_74k_erratum(struct cpuinfo_mips *c)
|
||||
{
|
||||
+ unsigned int imp = c->processor_id & 0xff00;
|
||||
+ unsigned int rev = c->processor_id & PRID_REV_MASK;
|
||||
+
|
||||
/*
|
||||
* Early versions of the 74K do not update the cache tags on a
|
||||
* vtag miss/ptag hit which can occur in the case of KSEG0/KUSEG
|
||||
* aliases. In this case it is better to treat the cache as always
|
||||
* having aliases.
|
||||
*/
|
||||
- if ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(2, 4, 0))
|
||||
- c->dcache.flags |= MIPS_CACHE_VTAG;
|
||||
- if ((c->processor_id & 0xff) == PRID_REV_ENCODE_332(2, 4, 0))
|
||||
- write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);
|
||||
- if (((c->processor_id & 0xff00) == PRID_IMP_1074K) &&
|
||||
- ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(1, 1, 0))) {
|
||||
- c->dcache.flags |= MIPS_CACHE_VTAG;
|
||||
- write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);
|
||||
+ switch (imp) {
|
||||
+ case PRID_IMP_74K:
|
||||
+ if (rev <= PRID_REV_ENCODE_332(2, 4, 0))
|
||||
+ c->dcache.flags |= MIPS_CACHE_VTAG;
|
||||
+ if (rev == PRID_REV_ENCODE_332(2, 4, 0))
|
||||
+ write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);
|
||||
+ break;
|
||||
+ case PRID_IMP_1074K:
|
||||
+ if (rev <= PRID_REV_ENCODE_332(1, 1, 0)) {
|
||||
+ c->dcache.flags |= MIPS_CACHE_VTAG;
|
||||
+ write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND);
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ BUG();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
From 5a43b20db2fd18f8ea5f3a919d4bc9d9c2038c6c Mon Sep 17 00:00:00 2001
|
||||
From: "Steven J. Hill" <Steven.Hill@imgtec.com>
|
||||
Date: Wed, 25 Sep 2013 14:58:19 -0500
|
||||
Subject: [PATCH 205/215] MIPS: GIC: Send IPIs using the GIC.
|
||||
|
||||
If a GIC present, then use it to send IPIs between the cores.
|
||||
|
||||
Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
|
||||
---
|
||||
arch/mips/kernel/smp-mt.c | 32 ++++++++++++++++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
--- a/arch/mips/kernel/smp-mt.c
|
||||
+++ b/arch/mips/kernel/smp-mt.c
|
||||
@@ -71,6 +71,7 @@ static unsigned int __init smvp_vpe_init
|
||||
|
||||
/* Record this as available CPU */
|
||||
set_cpu_possible(tc, true);
|
||||
+ set_cpu_present(tc, true);
|
||||
__cpu_number_map[tc] = ++ncpu;
|
||||
__cpu_logical_map[ncpu] = tc;
|
||||
}
|
||||
@@ -112,12 +113,35 @@ static void __init smvp_tc_init(unsigned
|
||||
write_tc_c0_tchalt(TCHALT_H);
|
||||
}
|
||||
|
||||
+static void mp_send_ipi_single(int cpu, unsigned int action)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ local_irq_save(flags);
|
||||
+
|
||||
+ switch (action) {
|
||||
+ case SMP_CALL_FUNCTION:
|
||||
+ gic_send_ipi(plat_ipi_call_int_xlate(cpu));
|
||||
+ break;
|
||||
+
|
||||
+ case SMP_RESCHEDULE_YOURSELF:
|
||||
+ gic_send_ipi(plat_ipi_resched_int_xlate(cpu));
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ local_irq_restore(flags);
|
||||
+}
|
||||
+
|
||||
static void vsmp_send_ipi_single(int cpu, unsigned int action)
|
||||
{
|
||||
int i;
|
||||
unsigned long flags;
|
||||
int vpflags;
|
||||
|
||||
+ if (gic_present) {
|
||||
+ mp_send_ipi_single(cpu, action);
|
||||
+ return;
|
||||
+ }
|
||||
local_irq_save(flags);
|
||||
|
||||
vpflags = dvpe(); /* can't access the other CPU's registers whilst MVPE enabled */
|
||||
@@ -164,6 +188,8 @@ static void __cpuinit vsmp_init_secondar
|
||||
|
||||
static void __cpuinit vsmp_smp_finish(void)
|
||||
{
|
||||
+ pr_debug("SMPMT: CPU%d: vsmp_smp_finish\n", smp_processor_id());
|
||||
+
|
||||
/* CDFIXME: remove this? */
|
||||
write_c0_compare(read_c0_count() + (8* mips_hpt_frequency/HZ));
|
||||
|
||||
@@ -178,6 +204,7 @@ static void __cpuinit vsmp_smp_finish(vo
|
||||
|
||||
static void vsmp_cpus_done(void)
|
||||
{
|
||||
+ pr_debug("SMPMT: CPU%d: vsmp_cpus_done\n", smp_processor_id());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -191,6 +218,8 @@ static void vsmp_cpus_done(void)
|
||||
static void __cpuinit vsmp_boot_secondary(int cpu, struct task_struct *idle)
|
||||
{
|
||||
struct thread_info *gp = task_thread_info(idle);
|
||||
+ pr_debug("SMPMT: CPU%d: vsmp_boot_secondary cpu %d\n",
|
||||
+ smp_processor_id(), cpu);
|
||||
dvpe();
|
||||
set_c0_mvpcontrol(MVPCONTROL_VPC);
|
||||
|
||||
@@ -232,6 +261,7 @@ static void __init vsmp_smp_setup(void)
|
||||
unsigned int mvpconf0, ntc, tc, ncpu = 0;
|
||||
unsigned int nvpe;
|
||||
|
||||
+ pr_debug("SMPMT: CPU%d: vsmp_smp_setup\n", smp_processor_id());
|
||||
#ifdef CONFIG_MIPS_MT_FPAFF
|
||||
/* If we have an FPU, enroll ourselves in the FPU-full mask */
|
||||
if (cpu_has_fpu)
|
||||
@@ -272,6 +302,8 @@ static void __init vsmp_smp_setup(void)
|
||||
|
||||
static void __init vsmp_prepare_cpus(unsigned int max_cpus)
|
||||
{
|
||||
+ pr_debug("SMPMT: CPU%d: vsmp_prepare_cpus %d\n",
|
||||
+ smp_processor_id(), max_cpus);
|
||||
mips_mt_set_cpuoptions();
|
||||
}
|
||||
|
|
@ -1,723 +0,0 @@
|
|||
From 259ce690b20562aa5dfef711e72ed02a4f514ce4 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 16 Mar 2014 05:19:37 +0000
|
||||
Subject: [PATCH 206/215] MIPS: ralink: add MT7621 support
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/include/asm/gic.h | 2 +
|
||||
arch/mips/include/asm/mach-ralink/mt7621.h | 39 ++++
|
||||
arch/mips/kernel/vmlinux.lds.S | 1 +
|
||||
arch/mips/ralink/Kconfig | 18 ++
|
||||
arch/mips/ralink/Makefile | 7 +-
|
||||
arch/mips/ralink/Platform | 7 +
|
||||
arch/mips/ralink/irq-gic.c | 271 ++++++++++++++++++++++++++++
|
||||
arch/mips/ralink/malta-amon.c | 81 +++++++++
|
||||
arch/mips/ralink/mt7621.c | 183 +++++++++++++++++++
|
||||
9 files changed, 608 insertions(+), 1 deletion(-)
|
||||
create mode 100644 arch/mips/include/asm/mach-ralink/mt7621.h
|
||||
create mode 100644 arch/mips/ralink/irq-gic.c
|
||||
create mode 100644 arch/mips/ralink/malta-amon.c
|
||||
create mode 100644 arch/mips/ralink/mt7621.c
|
||||
|
||||
--- a/arch/mips/include/asm/gic.h
|
||||
+++ b/arch/mips/include/asm/gic.h
|
||||
@@ -19,7 +19,11 @@
|
||||
#define GIC_TRIG_EDGE 1
|
||||
#define GIC_TRIG_LEVEL 0
|
||||
|
||||
+#define GIC_NUM_INTRS 64
|
||||
+
|
||||
+#ifndef GIC_NUM_INTRS
|
||||
#define GIC_NUM_INTRS (24 + NR_CPUS * 2)
|
||||
+#endif
|
||||
|
||||
#define MSK(n) ((1 << (n)) - 1)
|
||||
#define REG32(addr) (*(volatile unsigned int *) (addr))
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/include/asm/mach-ralink/mt7621.h
|
||||
@@ -0,0 +1,39 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * Parts of this file are based on Ralink's 2.6.21 BSP
|
||||
+ *
|
||||
+ * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+ */
|
||||
+
|
||||
+#ifndef _MT7621_REGS_H_
|
||||
+#define _MT7621_REGS_H_
|
||||
+
|
||||
+#define MT7621_SYSC_BASE 0x1E000000
|
||||
+
|
||||
+#define SYSC_REG_CHIP_NAME0 0x00
|
||||
+#define SYSC_REG_CHIP_NAME1 0x04
|
||||
+#define SYSC_REG_CHIP_REV 0x0c
|
||||
+#define SYSC_REG_SYSTEM_CONFIG0 0x10
|
||||
+#define SYSC_REG_SYSTEM_CONFIG1 0x14
|
||||
+
|
||||
+#define CHIP_REV_PKG_MASK 0x1
|
||||
+#define CHIP_REV_PKG_SHIFT 16
|
||||
+#define CHIP_REV_VER_MASK 0xf
|
||||
+#define CHIP_REV_VER_SHIFT 8
|
||||
+#define CHIP_REV_ECO_MASK 0xf
|
||||
+
|
||||
+#define MT7621_DRAM_BASE 0x0
|
||||
+#define MT7621_DDR2_SIZE_MIN 32
|
||||
+#define MT7621_DDR2_SIZE_MAX 256
|
||||
+
|
||||
+#define MT7621_CHIP_NAME0 0x3637544D
|
||||
+#define MT7621_CHIP_NAME1 0x20203132
|
||||
+
|
||||
+#define MIPS_GIC_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)
|
||||
+
|
||||
+#endif
|
||||
--- a/arch/mips/kernel/vmlinux.lds.S
|
||||
+++ b/arch/mips/kernel/vmlinux.lds.S
|
||||
@@ -51,6 +51,7 @@ SECTIONS
|
||||
/* read-only */
|
||||
_text = .; /* Text and read-only data */
|
||||
.text : {
|
||||
+ /*. = . + 0x8000; */
|
||||
TEXT_TEXT
|
||||
SCHED_TEXT
|
||||
LOCK_TEXT
|
||||
--- a/arch/mips/ralink/Kconfig
|
||||
+++ b/arch/mips/ralink/Kconfig
|
||||
@@ -7,6 +7,11 @@ config CLKEVT_RT3352
|
||||
select CLKSRC_OF
|
||||
select CLKSRC_MMIO
|
||||
|
||||
+config IRQ_INTC
|
||||
+ bool
|
||||
+ default y
|
||||
+ depends on !SOC_MT7621
|
||||
+
|
||||
choice
|
||||
prompt "Ralink SoC selection"
|
||||
default SOC_RT305X
|
||||
@@ -35,6 +40,15 @@ choice
|
||||
select USB_ARCH_HAS_EHCI
|
||||
select HW_HAS_PCI
|
||||
|
||||
+ config SOC_MT7621
|
||||
+ bool "MT7621"
|
||||
+ select MIPS_CPU_SCACHE
|
||||
+ select SYS_SUPPORTS_MULTITHREADING
|
||||
+ select SYS_SUPPORTS_SMP
|
||||
+ select SYS_SUPPORTS_MIPS_CMP
|
||||
+ select IRQ_GIC
|
||||
+ select HW_HAS_PCI
|
||||
+
|
||||
endchoice
|
||||
|
||||
choice
|
||||
@@ -62,6 +76,10 @@ choice
|
||||
bool "MT7620A eval kit"
|
||||
depends on SOC_MT7620
|
||||
|
||||
+ config DTB_MT7621_EVAL
|
||||
+ bool "MT7621 eval kit"
|
||||
+ depends on SOC_MT7621
|
||||
+
|
||||
endchoice
|
||||
|
||||
endif
|
||||
--- a/arch/mips/ralink/Makefile
|
||||
+++ b/arch/mips/ralink/Makefile
|
||||
@@ -6,16 +6,21 @@
|
||||
# Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
# Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
|
||||
-obj-y := prom.o of.o reset.o clk.o irq.o timer.o
|
||||
+obj-y := prom.o of.o reset.o clk.o timer.o
|
||||
|
||||
obj-$(CONFIG_CLKEVT_RT3352) += cevt-rt3352.o
|
||||
|
||||
obj-$(CONFIG_RALINK_ILL_ACC) += ill_acc.o
|
||||
|
||||
+obj-$(CONFIG_IRQ_INTC) += irq.o
|
||||
+obj-$(CONFIG_IRQ_GIC) += irq-gic.o
|
||||
+obj-$(CONFIG_MIPS_MT_SMP) += malta-amon.o
|
||||
+
|
||||
obj-$(CONFIG_SOC_RT288X) += rt288x.o
|
||||
obj-$(CONFIG_SOC_RT305X) += rt305x.o
|
||||
obj-$(CONFIG_SOC_RT3883) += rt3883.o
|
||||
obj-$(CONFIG_SOC_MT7620) += mt7620.o
|
||||
+obj-$(CONFIG_SOC_MT7621) += mt7621.o
|
||||
|
||||
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
|
||||
|
||||
--- a/arch/mips/ralink/Platform
|
||||
+++ b/arch/mips/ralink/Platform
|
||||
@@ -26,3 +26,10 @@ cflags-$(CONFIG_SOC_RT3883) += -I$(srctr
|
||||
# Ralink MT7620
|
||||
#
|
||||
load-$(CONFIG_SOC_MT7620) += 0xffffffff80000000
|
||||
+cflags-$(CONFIG_SOC_MT7620) += -I$(srctree)/arch/mips/include/asm/mach-ralink/mt7620
|
||||
+
|
||||
+#
|
||||
+# Ralink MT7621
|
||||
+#
|
||||
+load-$(CONFIG_SOC_MT7621) += 0xffffffff80001000
|
||||
+cflags-$(CONFIG_SOC_MT7620) += -I$(srctree)/arch/mips/include/asm/mach-ralink/mt7621
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/ralink/irq-gic.c
|
||||
@@ -0,0 +1,271 @@
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/sched.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/kernel_stat.h>
|
||||
+#include <linux/hardirq.h>
|
||||
+#include <linux/preempt.h>
|
||||
+#include <linux/irqdomain.h>
|
||||
+#include <linux/of_platform.h>
|
||||
+#include <linux/of_address.h>
|
||||
+#include <linux/of_irq.h>
|
||||
+
|
||||
+#include <asm/irq_cpu.h>
|
||||
+#include <asm/mipsregs.h>
|
||||
+
|
||||
+#include <asm/irq.h>
|
||||
+#include <asm/setup.h>
|
||||
+
|
||||
+#include <asm/gic.h>
|
||||
+#include <asm/gcmpregs.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/mt7621.h>
|
||||
+
|
||||
+unsigned long _gcmp_base;
|
||||
+static int gic_resched_int_base = 56;
|
||||
+static int gic_call_int_base = 60;
|
||||
+static struct irq_chip *irq_gic;
|
||||
+static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS];
|
||||
+
|
||||
+#if defined(CONFIG_MIPS_MT_SMP)
|
||||
+static int gic_resched_int_base;
|
||||
+static int gic_call_int_base;
|
||||
+
|
||||
+#define GIC_RESCHED_INT(cpu) (gic_resched_int_base+(cpu))
|
||||
+#define GIC_CALL_INT(cpu) (gic_call_int_base+(cpu))
|
||||
+
|
||||
+static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
|
||||
+{
|
||||
+ scheduler_ipi();
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t
|
||||
+ipi_call_interrupt(int irq, void *dev_id)
|
||||
+{
|
||||
+ smp_call_function_interrupt();
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static struct irqaction irq_resched = {
|
||||
+ .handler = ipi_resched_interrupt,
|
||||
+ .flags = IRQF_DISABLED|IRQF_PERCPU,
|
||||
+ .name = "ipi resched"
|
||||
+};
|
||||
+
|
||||
+static struct irqaction irq_call = {
|
||||
+ .handler = ipi_call_interrupt,
|
||||
+ .flags = IRQF_DISABLED|IRQF_PERCPU,
|
||||
+ .name = "ipi call"
|
||||
+};
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+static void __init
|
||||
+gic_fill_map(void)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(gic_intr_map); i++) {
|
||||
+ gic_intr_map[i].cpunum = 0;
|
||||
+ gic_intr_map[i].pin = GIC_CPU_INT0;
|
||||
+ gic_intr_map[i].polarity = GIC_POL_POS;
|
||||
+ gic_intr_map[i].trigtype = GIC_TRIG_LEVEL;
|
||||
+ gic_intr_map[i].flags = GIC_FLAG_IPI;
|
||||
+ }
|
||||
+
|
||||
+#if defined(CONFIG_MIPS_MT_SMP)
|
||||
+ {
|
||||
+ int cpu;
|
||||
+
|
||||
+ gic_call_int_base = ARRAY_SIZE(gic_intr_map) - nr_cpu_ids;
|
||||
+ gic_resched_int_base = gic_call_int_base - nr_cpu_ids;
|
||||
+
|
||||
+ i = gic_resched_int_base;
|
||||
+
|
||||
+ for (cpu = 0; cpu < nr_cpu_ids; cpu++) {
|
||||
+ gic_intr_map[i + cpu].cpunum = cpu;
|
||||
+ gic_intr_map[i + cpu].pin = GIC_CPU_INT1;
|
||||
+ gic_intr_map[i + cpu].trigtype = GIC_TRIG_EDGE;
|
||||
+
|
||||
+ gic_intr_map[i + cpu + nr_cpu_ids].cpunum = cpu;
|
||||
+ gic_intr_map[i + cpu + nr_cpu_ids].pin = GIC_CPU_INT2;
|
||||
+ gic_intr_map[i + cpu + nr_cpu_ids].trigtype = GIC_TRIG_EDGE;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+gic_irq_ack(struct irq_data *d)
|
||||
+{
|
||||
+ int irq = (d->irq - gic_irq_base);
|
||||
+
|
||||
+ GIC_CLR_INTR_MASK(irq);
|
||||
+
|
||||
+ if (gic_irq_flags[irq] & GIC_TRIG_EDGE)
|
||||
+ GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), irq);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+gic_finish_irq(struct irq_data *d)
|
||||
+{
|
||||
+ GIC_SET_INTR_MASK(d->irq - gic_irq_base);
|
||||
+}
|
||||
+
|
||||
+void __init
|
||||
+gic_platform_init(int irqs, struct irq_chip *irq_controller)
|
||||
+{
|
||||
+ irq_gic = irq_controller;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+gic_irqdispatch(void)
|
||||
+{
|
||||
+ unsigned int irq = gic_get_int();
|
||||
+
|
||||
+ if (likely(irq < GIC_NUM_INTRS))
|
||||
+ do_IRQ(MIPS_GIC_IRQ_BASE + irq);
|
||||
+ else {
|
||||
+ pr_err("Spurious GIC Interrupt!\n");
|
||||
+ spurious_interrupt();
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+vi_timer_irqdispatch(void)
|
||||
+{
|
||||
+ do_IRQ(cp0_compare_irq);
|
||||
+}
|
||||
+
|
||||
+#if defined(CONFIG_MIPS_MT_SMP)
|
||||
+unsigned int
|
||||
+plat_ipi_call_int_xlate(unsigned int cpu)
|
||||
+{
|
||||
+ return GIC_CALL_INT(cpu);
|
||||
+}
|
||||
+
|
||||
+unsigned int
|
||||
+plat_ipi_resched_int_xlate(unsigned int cpu)
|
||||
+{
|
||||
+ return GIC_RESCHED_INT(cpu);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+asmlinkage void
|
||||
+plat_irq_dispatch(void)
|
||||
+{
|
||||
+ unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
|
||||
+
|
||||
+ if (unlikely(!pending)) {
|
||||
+ pr_err("Spurious CP0 Interrupt!\n");
|
||||
+ spurious_interrupt();
|
||||
+ } else {
|
||||
+ if (pending & CAUSEF_IP7)
|
||||
+ do_IRQ(cp0_compare_irq);
|
||||
+
|
||||
+ if (pending & (CAUSEF_IP4 | CAUSEF_IP3 | CAUSEF_IP2))
|
||||
+ gic_irqdispatch();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+unsigned int __cpuinit
|
||||
+get_c0_compare_int(void)
|
||||
+{
|
||||
+ return CP0_LEGACY_COMPARE_IRQ;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+gic_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
|
||||
+{
|
||||
+ irq_set_chip_and_handler(irq, irq_gic,
|
||||
+#if defined(CONFIG_MIPS_MT_SMP)
|
||||
+ (hw >= gic_resched_int_base) ?
|
||||
+ handle_percpu_irq :
|
||||
+#endif
|
||||
+ handle_level_irq);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct irq_domain_ops irq_domain_ops = {
|
||||
+ .xlate = irq_domain_xlate_onecell,
|
||||
+ .map = gic_map,
|
||||
+};
|
||||
+
|
||||
+static int __init
|
||||
+of_gic_init(struct device_node *node,
|
||||
+ struct device_node *parent)
|
||||
+{
|
||||
+ struct irq_domain *domain;
|
||||
+ struct resource gcmp = { 0 }, gic = { 0 };
|
||||
+ unsigned int gic_rev;
|
||||
+ int i;
|
||||
+
|
||||
+ if (of_address_to_resource(node, 0, &gic))
|
||||
+ panic("Failed to get gic memory range");
|
||||
+ if (request_mem_region(gic.start, resource_size(&gic),
|
||||
+ gic.name) < 0)
|
||||
+ panic("Failed to request gic memory");
|
||||
+ if (of_address_to_resource(node, 2, &gcmp))
|
||||
+ panic("Failed to get gic memory range");
|
||||
+ if (request_mem_region(gcmp.start, resource_size(&gcmp),
|
||||
+ gcmp.name) < 0)
|
||||
+ panic("Failed to request gcmp memory");
|
||||
+
|
||||
+ _gcmp_base = (unsigned long) ioremap_nocache(gcmp.start, resource_size(&gcmp));
|
||||
+ if (!_gcmp_base)
|
||||
+ panic("Failed to remap gcmp memory\n");
|
||||
+
|
||||
+ if ((GCMPGCB(GCMPB) & GCMP_GCB_GCMPB_GCMPBASE_MSK) != gcmp.start)
|
||||
+ panic("Failed to find gcmp core\n");
|
||||
+
|
||||
+ /* tell the gcmp where to find the gic */
|
||||
+ GCMPGCB(GICBA) = gic.start | GCMP_GCB_GICBA_EN_MSK;
|
||||
+ gic_present = 1;
|
||||
+ if (cpu_has_vint) {
|
||||
+ set_vi_handler(2, gic_irqdispatch);
|
||||
+ set_vi_handler(3, gic_irqdispatch);
|
||||
+ set_vi_handler(4, gic_irqdispatch);
|
||||
+ set_vi_handler(7, vi_timer_irqdispatch);
|
||||
+ }
|
||||
+
|
||||
+ gic_fill_map();
|
||||
+
|
||||
+ gic_init(gic.start, resource_size(&gic), gic_intr_map,
|
||||
+ ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE);
|
||||
+
|
||||
+ GICREAD(GIC_REG(SHARED, GIC_SH_REVISIONID), gic_rev);
|
||||
+ pr_info("gic: revision %d.%d\n", (gic_rev >> 8) & 0xff, gic_rev & 0xff);
|
||||
+
|
||||
+ domain = irq_domain_add_legacy(node, GIC_NUM_INTRS, MIPS_GIC_IRQ_BASE,
|
||||
+ 0, &irq_domain_ops, NULL);
|
||||
+ if (!domain)
|
||||
+ panic("Failed to add irqdomain");
|
||||
+
|
||||
+#if defined(CONFIG_MIPS_MT_SMP)
|
||||
+ for (i = 0; i < nr_cpu_ids; i++) {
|
||||
+ setup_irq(MIPS_GIC_IRQ_BASE + GIC_RESCHED_INT(i), &irq_resched);
|
||||
+ setup_irq(MIPS_GIC_IRQ_BASE + GIC_CALL_INT(i), &irq_call);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ change_c0_status(ST0_IM, STATUSF_IP7 | STATUSF_IP4 | STATUSF_IP3 |
|
||||
+ STATUSF_IP2);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct of_device_id __initdata of_irq_ids[] = {
|
||||
+ { .compatible = "mti,cpu-interrupt-controller", .data = mips_cpu_intc_init },
|
||||
+ { .compatible = "ralink,mt7621-gic", .data = of_gic_init },
|
||||
+ {},
|
||||
+};
|
||||
+
|
||||
+void __init
|
||||
+arch_init_irq(void)
|
||||
+{
|
||||
+ of_irq_init(of_irq_ids);
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/ralink/malta-amon.c
|
||||
@@ -0,0 +1,81 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2007 MIPS Technologies, Inc.
|
||||
+ * All rights reserved.
|
||||
+
|
||||
+ * This program is free software; you can distribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License (Version 2) as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * This program is distributed in the hope 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.
|
||||
+ *
|
||||
+ * Arbitrary Monitor interface
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/smp.h>
|
||||
+
|
||||
+#include <asm/addrspace.h>
|
||||
+#include <asm/mips-boards/launch.h>
|
||||
+#include <asm/mipsmtregs.h>
|
||||
+
|
||||
+int amon_cpu_avail(int cpu)
|
||||
+{
|
||||
+ struct cpulaunch *launch = (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH);
|
||||
+
|
||||
+ if (cpu < 0 || cpu >= NCPULAUNCH) {
|
||||
+ pr_debug("avail: cpu%d is out of range\n", cpu);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ launch += cpu;
|
||||
+ if (!(launch->flags & LAUNCH_FREADY)) {
|
||||
+ pr_debug("avail: cpu%d is not ready\n", cpu);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (launch->flags & (LAUNCH_FGO|LAUNCH_FGONE)) {
|
||||
+ pr_debug("avail: too late.. cpu%d is already gone\n", cpu);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+void amon_cpu_start(int cpu,
|
||||
+ unsigned long pc, unsigned long sp,
|
||||
+ unsigned long gp, unsigned long a0)
|
||||
+{
|
||||
+ volatile struct cpulaunch *launch =
|
||||
+ (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH);
|
||||
+
|
||||
+ if (!amon_cpu_avail(cpu))
|
||||
+ return;
|
||||
+ if (cpu == smp_processor_id()) {
|
||||
+ pr_debug("launch: I am cpu%d!\n", cpu);
|
||||
+ return;
|
||||
+ }
|
||||
+ launch += cpu;
|
||||
+
|
||||
+ pr_debug("launch: starting cpu%d\n", cpu);
|
||||
+
|
||||
+ launch->pc = pc;
|
||||
+ launch->gp = gp;
|
||||
+ launch->sp = sp;
|
||||
+ launch->a0 = a0;
|
||||
+
|
||||
+ smp_wmb(); /* Target must see parameters before go */
|
||||
+ launch->flags |= LAUNCH_FGO;
|
||||
+ smp_wmb(); /* Target must see go before we poll */
|
||||
+
|
||||
+ while ((launch->flags & LAUNCH_FGONE) == 0)
|
||||
+ ;
|
||||
+ smp_rmb(); /* Target will be updating flags soon */
|
||||
+ pr_debug("launch: cpu%d gone!\n", cpu);
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/ralink/mt7621.c
|
||||
@@ -0,0 +1,183 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * Parts of this file are based on Ralink's 2.6.21 BSP
|
||||
+ *
|
||||
+ * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <asm/gcmpregs.h>
|
||||
+
|
||||
+#include <asm/mipsregs.h>
|
||||
+#include <asm/smp-ops.h>
|
||||
+#include <asm/mach-ralink/ralink_regs.h>
|
||||
+#include <asm/mach-ralink/mt7621.h>
|
||||
+
|
||||
+#include <pinmux.h>
|
||||
+
|
||||
+#include "common.h"
|
||||
+
|
||||
+#define SYSC_REG_SYSCFG 0x10
|
||||
+#define SYSC_REG_CPLL_CLKCFG0 0x2c
|
||||
+#define SYSC_REG_CUR_CLK_STS 0x44
|
||||
+#define CPU_CLK_SEL (BIT(30) | BIT(31))
|
||||
+
|
||||
+#define MT7621_GPIO_MODE_UART1 1
|
||||
+#define MT7621_GPIO_MODE_I2C 2
|
||||
+#define MT7621_GPIO_MODE_UART2 3
|
||||
+#define MT7621_GPIO_MODE_UART3 5
|
||||
+#define MT7621_GPIO_MODE_JTAG 7
|
||||
+#define MT7621_GPIO_MODE_WDT_MASK 0x3
|
||||
+#define MT7621_GPIO_MODE_WDT_SHIFT 8
|
||||
+#define MT7621_GPIO_MODE_WDT_GPIO 1
|
||||
+#define MT7621_GPIO_MODE_PCIE_RST 0
|
||||
+#define MT7621_GPIO_MODE_PCIE_REF 2
|
||||
+#define MT7621_GPIO_MODE_PCIE_MASK 0x3
|
||||
+#define MT7621_GPIO_MODE_PCIE_SHIFT 10
|
||||
+#define MT7621_GPIO_MODE_PCIE_GPIO 1
|
||||
+#define MT7621_GPIO_MODE_MDIO 12
|
||||
+#define MT7621_GPIO_MODE_RGMII1 14
|
||||
+#define MT7621_GPIO_MODE_RGMII2 15
|
||||
+#define MT7621_GPIO_MODE_SPI_MASK 0x3
|
||||
+#define MT7621_GPIO_MODE_SPI_SHIFT 16
|
||||
+#define MT7621_GPIO_MODE_SPI_GPIO 1
|
||||
+#define MT7621_GPIO_MODE_SDHCI_MASK 0x3
|
||||
+#define MT7621_GPIO_MODE_SDHCI_SHIFT 18
|
||||
+#define MT7621_GPIO_MODE_SDHCI_GPIO 1
|
||||
+
|
||||
+static struct rt2880_pmx_func uart1_grp[] = { FUNC("uart1", 0, 1, 2) };
|
||||
+static struct rt2880_pmx_func i2c_grp[] = { FUNC("i2c", 0, 3, 2) };
|
||||
+static struct rt2880_pmx_func uart3_grp[] = { FUNC("uart3", 0, 5, 4) };
|
||||
+static struct rt2880_pmx_func uart2_grp[] = { FUNC("uart2", 0, 9, 4) };
|
||||
+static struct rt2880_pmx_func jtag_grp[] = { FUNC("jtag", 0, 13, 5) };
|
||||
+static struct rt2880_pmx_func wdt_grp[] = {
|
||||
+ FUNC("wdt rst", 0, 18, 1),
|
||||
+ FUNC("wdt refclk", 2, 18, 1),
|
||||
+};
|
||||
+static struct rt2880_pmx_func pcie_rst_grp[] = {
|
||||
+ FUNC("pcie rst", MT7621_GPIO_MODE_PCIE_RST, 19, 1),
|
||||
+ FUNC("pcie refclk", MT7621_GPIO_MODE_PCIE_REF, 19, 1)
|
||||
+};
|
||||
+static struct rt2880_pmx_func mdio_grp[] = { FUNC("mdio", 0, 20, 2) };
|
||||
+static struct rt2880_pmx_func rgmii2_grp[] = { FUNC("rgmii2", 0, 22, 12) };
|
||||
+static struct rt2880_pmx_func spi_grp[] = {
|
||||
+ FUNC("spi", 0, 34, 7),
|
||||
+ FUNC("nand", 2, 34, 8),
|
||||
+};
|
||||
+static struct rt2880_pmx_func sdhci_grp[] = {
|
||||
+ FUNC("sdhci", 0, 41, 8),
|
||||
+ FUNC("nand", 2, 41, 8),
|
||||
+};
|
||||
+static struct rt2880_pmx_func rgmii1_grp[] = { FUNC("rgmii1", 0, 49, 12) };
|
||||
+
|
||||
+static struct rt2880_pmx_group mt7621_pinmux_data[] = {
|
||||
+ GRP("uart1", uart1_grp, 1, MT7621_GPIO_MODE_UART1),
|
||||
+ GRP("i2c", i2c_grp, 1, MT7621_GPIO_MODE_I2C),
|
||||
+ GRP("uart3", uart2_grp, 1, MT7621_GPIO_MODE_UART2),
|
||||
+ GRP("uart2", uart3_grp, 1, MT7621_GPIO_MODE_UART3),
|
||||
+ GRP("jtag", jtag_grp, 1, MT7621_GPIO_MODE_JTAG),
|
||||
+ GRP_G("wdt", wdt_grp, MT7621_GPIO_MODE_WDT_MASK,
|
||||
+ MT7621_GPIO_MODE_WDT_GPIO, MT7621_GPIO_MODE_WDT_SHIFT),
|
||||
+ GRP_G("pcie", pcie_rst_grp, MT7621_GPIO_MODE_PCIE_MASK,
|
||||
+ MT7621_GPIO_MODE_PCIE_GPIO, MT7621_GPIO_MODE_PCIE_SHIFT),
|
||||
+ GRP("mdio", mdio_grp, 1, MT7621_GPIO_MODE_MDIO),
|
||||
+ GRP("rgmii2", rgmii2_grp, 1, MT7621_GPIO_MODE_RGMII2),
|
||||
+ GRP_G("spi", spi_grp, MT7621_GPIO_MODE_SPI_MASK,
|
||||
+ MT7621_GPIO_MODE_SPI_GPIO, MT7621_GPIO_MODE_SPI_SHIFT),
|
||||
+ GRP_G("sdhci", sdhci_grp, MT7621_GPIO_MODE_SDHCI_MASK,
|
||||
+ MT7621_GPIO_MODE_SDHCI_GPIO, MT7621_GPIO_MODE_SDHCI_SHIFT),
|
||||
+ GRP("rgmii1", rgmii1_grp, 1, MT7621_GPIO_MODE_RGMII1),
|
||||
+ { 0 }
|
||||
+};
|
||||
+
|
||||
+void __init ralink_clk_init(void)
|
||||
+{
|
||||
+ int cpu_fdiv = 0;
|
||||
+ int cpu_ffrac = 0;
|
||||
+ int fbdiv = 0;
|
||||
+ u32 clk_sts, syscfg;
|
||||
+ u8 clk_sel = 0, xtal_mode;
|
||||
+ u32 cpu_clk;
|
||||
+
|
||||
+ if ((rt_sysc_r32(SYSC_REG_CPLL_CLKCFG0) & CPU_CLK_SEL) != 0)
|
||||
+ clk_sel = 1;
|
||||
+
|
||||
+ switch (clk_sel) {
|
||||
+ case 0:
|
||||
+ clk_sts = rt_sysc_r32(SYSC_REG_CUR_CLK_STS);
|
||||
+ cpu_fdiv = ((clk_sts >> 8) & 0x1F);
|
||||
+ cpu_ffrac = (clk_sts & 0x1F);
|
||||
+ cpu_clk = (500 * cpu_ffrac / cpu_fdiv) * 1000 * 1000;
|
||||
+ break;
|
||||
+
|
||||
+ case 1:
|
||||
+ fbdiv = ((rt_sysc_r32(0x648) >> 4) & 0x7F) + 1;
|
||||
+ syscfg = rt_sysc_r32(SYSC_REG_SYSCFG);
|
||||
+ xtal_mode = (syscfg >> 6) & 0x7;
|
||||
+ if(xtal_mode >= 6) { //25Mhz Xtal
|
||||
+ cpu_clk = 25 * fbdiv * 1000 * 1000;
|
||||
+ } else if(xtal_mode >=3) { //40Mhz Xtal
|
||||
+ cpu_clk = 40 * fbdiv * 1000 * 1000;
|
||||
+ } else { // 20Mhz Xtal
|
||||
+ cpu_clk = 20 * fbdiv * 1000 * 1000;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ cpu_clk = 880000000;
|
||||
+ ralink_clk_add("cpu", cpu_clk);
|
||||
+ ralink_clk_add("1e000b00.spi", 50000000);
|
||||
+ ralink_clk_add("1e000c00.uartlite", 50000000);
|
||||
+ ralink_clk_add("1e000d00.uart", 50000000);
|
||||
+}
|
||||
+
|
||||
+void __init ralink_of_remap(void)
|
||||
+{
|
||||
+ rt_sysc_membase = plat_of_remap_node("mtk,mt7621-sysc");
|
||||
+ rt_memc_membase = plat_of_remap_node("mtk,mt7621-memc");
|
||||
+
|
||||
+ if (!rt_sysc_membase || !rt_memc_membase)
|
||||
+ panic("Failed to remap core resources");
|
||||
+}
|
||||
+
|
||||
+void prom_soc_init(struct ralink_soc_info *soc_info)
|
||||
+{
|
||||
+ void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7621_SYSC_BASE);
|
||||
+ unsigned char *name = NULL;
|
||||
+ u32 n0;
|
||||
+ u32 n1;
|
||||
+ u32 rev;
|
||||
+
|
||||
+ n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0);
|
||||
+ n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1);
|
||||
+
|
||||
+ if (n0 == MT7621_CHIP_NAME0 && n1 == MT7621_CHIP_NAME1) {
|
||||
+ name = "MT7621";
|
||||
+ soc_info->compatible = "mtk,mt7621-soc";
|
||||
+ } else {
|
||||
+ panic("mt7621: unknown SoC, n0:%08x n1:%08x\n", n0, n1);
|
||||
+ }
|
||||
+
|
||||
+ rev = __raw_readl(sysc + SYSC_REG_CHIP_REV);
|
||||
+
|
||||
+ snprintf(soc_info->sys_type, RAMIPS_SYS_TYPE_LEN,
|
||||
+ "Mediatek %s ver:%u eco:%u",
|
||||
+ name,
|
||||
+ (rev >> CHIP_REV_VER_SHIFT) & CHIP_REV_VER_MASK,
|
||||
+ (rev & CHIP_REV_ECO_MASK));
|
||||
+
|
||||
+ soc_info->mem_size_min = MT7621_DDR2_SIZE_MIN;
|
||||
+ soc_info->mem_size_max = MT7621_DDR2_SIZE_MAX;
|
||||
+ soc_info->mem_base = MT7621_DRAM_BASE;
|
||||
+
|
||||
+ rt2880_pinmux_data = mt7621_pinmux_data;
|
||||
+
|
||||
+ if (register_cmp_smp_ops())
|
||||
+ panic("failed to register_vsmp_smp_ops()");
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/include/asm/mach-ralink/irq.h
|
||||
@@ -0,0 +1,9 @@
|
||||
+#ifndef __ASM_MACH_RALINK_IRQ_H
|
||||
+#define __ASM_MACH_RALINK_IRQ_H
|
||||
+
|
||||
+#define GIC_NUM_INTRS 64
|
||||
+#define NR_IRQS 256
|
||||
+
|
||||
+#include_next <irq.h>
|
||||
+
|
||||
+#endif
|
|
@ -1,211 +0,0 @@
|
|||
From 29b1c70ab171609fee58ef6642086d571c0ba0c2 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Mon, 27 Jan 2014 13:12:41 +0000
|
||||
Subject: [PATCH 207/215] MIPS: ralink: add MT7621 defconfig
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/configs/mt7621_defconfig | 197 ++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 197 insertions(+)
|
||||
create mode 100644 arch/mips/configs/mt7621_defconfig
|
||||
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/configs/mt7621_defconfig
|
||||
@@ -0,0 +1,197 @@
|
||||
+# CONFIG_LOCALVERSION_AUTO is not set
|
||||
+CONFIG_SYSVIPC=y
|
||||
+CONFIG_HIGH_RES_TIMERS=y
|
||||
+CONFIG_RCU_FANOUT=32
|
||||
+CONFIG_UIDGID_STRICT_TYPE_CHECKS=y
|
||||
+CONFIG_BLK_DEV_INITRD=y
|
||||
+CONFIG_INITRAMFS_SOURCE="/openwrt/trunk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/root-ramips /openwrt/trunk/target/linux/generic/image/initramfs-base-files.txt"
|
||||
+CONFIG_INITRAMFS_ROOT_UID=1000
|
||||
+CONFIG_INITRAMFS_ROOT_GID=1000
|
||||
+# CONFIG_RD_GZIP is not set
|
||||
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
|
||||
+# CONFIG_AIO is not set
|
||||
+CONFIG_EMBEDDED=y
|
||||
+# CONFIG_VM_EVENT_COUNTERS is not set
|
||||
+# CONFIG_SLUB_DEBUG is not set
|
||||
+# CONFIG_COMPAT_BRK is not set
|
||||
+CONFIG_MODULES=y
|
||||
+CONFIG_MODULE_UNLOAD=y
|
||||
+# CONFIG_BLK_DEV_BSG is not set
|
||||
+CONFIG_PARTITION_ADVANCED=y
|
||||
+# CONFIG_IOSCHED_CFQ is not set
|
||||
+CONFIG_SMP=y
|
||||
+CONFIG_NR_CPUS=4
|
||||
+CONFIG_SCHED_SMT=y
|
||||
+# CONFIG_COMPACTION is not set
|
||||
+# CONFIG_CROSS_MEMORY_ATTACH is not set
|
||||
+# CONFIG_SECCOMP is not set
|
||||
+CONFIG_HZ_100=y
|
||||
+CONFIG_CMDLINE_BOOL=y
|
||||
+CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
|
||||
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
|
||||
+CONFIG_NET=y
|
||||
+CONFIG_PACKET=y
|
||||
+CONFIG_UNIX=y
|
||||
+CONFIG_INET=y
|
||||
+CONFIG_IP_MULTICAST=y
|
||||
+CONFIG_IP_ADVANCED_ROUTER=y
|
||||
+CONFIG_IP_MULTIPLE_TABLES=y
|
||||
+CONFIG_IP_ROUTE_MULTIPATH=y
|
||||
+CONFIG_IP_ROUTE_VERBOSE=y
|
||||
+CONFIG_IP_MROUTE=y
|
||||
+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
|
||||
+CONFIG_ARPD=y
|
||||
+CONFIG_SYN_COOKIES=y
|
||||
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
|
||||
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
|
||||
+# CONFIG_INET_XFRM_MODE_BEET is not set
|
||||
+# CONFIG_INET_LRO is not set
|
||||
+# CONFIG_INET_DIAG is not set
|
||||
+CONFIG_TCP_CONG_ADVANCED=y
|
||||
+# CONFIG_TCP_CONG_BIC is not set
|
||||
+# CONFIG_TCP_CONG_WESTWOOD is not set
|
||||
+# CONFIG_TCP_CONG_HTCP is not set
|
||||
+CONFIG_IPV6_PRIVACY=y
|
||||
+# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
|
||||
+# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
|
||||
+# CONFIG_INET6_XFRM_MODE_BEET is not set
|
||||
+# CONFIG_IPV6_SIT is not set
|
||||
+CONFIG_IPV6_MULTIPLE_TABLES=y
|
||||
+CONFIG_IPV6_SUBTREES=y
|
||||
+CONFIG_IPV6_MROUTE=y
|
||||
+CONFIG_NETFILTER=y
|
||||
+# CONFIG_BRIDGE_NETFILTER is not set
|
||||
+CONFIG_NF_CONNTRACK=m
|
||||
+CONFIG_NF_CONNTRACK_FTP=m
|
||||
+CONFIG_NF_CONNTRACK_IRC=m
|
||||
+CONFIG_NETFILTER_XT_MARK=m
|
||||
+CONFIG_NETFILTER_XT_TARGET_LOG=m
|
||||
+CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
|
||||
+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
|
||||
+CONFIG_NETFILTER_XT_MATCH_COMMENT=m
|
||||
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
|
||||
+CONFIG_NETFILTER_XT_MATCH_LIMIT=m
|
||||
+CONFIG_NETFILTER_XT_MATCH_MAC=m
|
||||
+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
|
||||
+CONFIG_NETFILTER_XT_MATCH_STATE=m
|
||||
+CONFIG_NETFILTER_XT_MATCH_TIME=m
|
||||
+CONFIG_NF_CONNTRACK_IPV4=m
|
||||
+# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
|
||||
+CONFIG_IP_NF_IPTABLES=m
|
||||
+CONFIG_IP_NF_FILTER=m
|
||||
+CONFIG_IP_NF_TARGET_REJECT=m
|
||||
+CONFIG_NF_NAT_IPV4=m
|
||||
+CONFIG_IP_NF_TARGET_MASQUERADE=m
|
||||
+CONFIG_IP_NF_TARGET_REDIRECT=m
|
||||
+CONFIG_IP_NF_MANGLE=m
|
||||
+CONFIG_IP_NF_RAW=m
|
||||
+CONFIG_NF_CONNTRACK_IPV6=m
|
||||
+CONFIG_IP6_NF_IPTABLES=m
|
||||
+CONFIG_IP6_NF_MATCH_AH=m
|
||||
+CONFIG_IP6_NF_MATCH_EUI64=m
|
||||
+CONFIG_IP6_NF_MATCH_FRAG=m
|
||||
+CONFIG_IP6_NF_MATCH_OPTS=m
|
||||
+CONFIG_IP6_NF_MATCH_IPV6HEADER=m
|
||||
+CONFIG_IP6_NF_MATCH_MH=m
|
||||
+CONFIG_IP6_NF_MATCH_RT=m
|
||||
+CONFIG_IP6_NF_FILTER=m
|
||||
+CONFIG_IP6_NF_TARGET_REJECT=m
|
||||
+CONFIG_IP6_NF_MANGLE=m
|
||||
+CONFIG_IP6_NF_RAW=m
|
||||
+CONFIG_BRIDGE=m
|
||||
+# CONFIG_BRIDGE_IGMP_SNOOPING is not set
|
||||
+CONFIG_VLAN_8021Q=y
|
||||
+CONFIG_NET_SCHED=y
|
||||
+CONFIG_NET_SCH_FQ_CODEL=y
|
||||
+CONFIG_HAMRADIO=y
|
||||
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
|
||||
+# CONFIG_FIRMWARE_IN_KERNEL is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_MTD_CMDLINE_PARTS=y
|
||||
+CONFIG_MTD_BLOCK=y
|
||||
+CONFIG_MTD_CFI=y
|
||||
+CONFIG_MTD_CFI_AMDSTD=y
|
||||
+CONFIG_MTD_COMPLEX_MAPPINGS=y
|
||||
+CONFIG_MTD_PHYSMAP=y
|
||||
+CONFIG_MTD_M25P80=y
|
||||
+CONFIG_EEPROM_93CX6=m
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_BLK_DEV_SD=y
|
||||
+CONFIG_NETDEVICES=y
|
||||
+# CONFIG_NET_PACKET_ENGINE is not set
|
||||
+# CONFIG_NET_VENDOR_WIZNET is not set
|
||||
+CONFIG_PHYLIB=y
|
||||
+CONFIG_SWCONFIG=y
|
||||
+CONFIG_PPP=m
|
||||
+CONFIG_PPP_FILTER=y
|
||||
+CONFIG_PPP_MULTILINK=y
|
||||
+CONFIG_PPPOE=m
|
||||
+CONFIG_PPP_ASYNC=m
|
||||
+CONFIG_ISDN=y
|
||||
+# CONFIG_INPUT is not set
|
||||
+# CONFIG_SERIO is not set
|
||||
+# CONFIG_VT is not set
|
||||
+# CONFIG_LEGACY_PTYS is not set
|
||||
+# CONFIG_DEVKMEM is not set
|
||||
+CONFIG_SERIAL_8250=y
|
||||
+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
|
||||
+CONFIG_SERIAL_8250_CONSOLE=y
|
||||
+# CONFIG_SERIAL_8250_PCI is not set
|
||||
+CONFIG_SERIAL_8250_RUNTIME_UARTS=2
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_GPIOLIB=y
|
||||
+CONFIG_GPIO_SYSFS=y
|
||||
+# CONFIG_HWMON is not set
|
||||
+CONFIG_WATCHDOG=y
|
||||
+CONFIG_WATCHDOG_CORE=y
|
||||
+# CONFIG_VGA_ARB is not set
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_PLATFORM=y
|
||||
+CONFIG_USB_MT7621_XHCI_PLATFORM=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_USB_PHY=y
|
||||
+CONFIG_NEW_LEDS=y
|
||||
+CONFIG_LEDS_CLASS=y
|
||||
+CONFIG_LEDS_GPIO=m
|
||||
+CONFIG_LEDS_TRIGGERS=y
|
||||
+CONFIG_LEDS_TRIGGER_TIMER=y
|
||||
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
|
||||
+CONFIG_STAGING=y
|
||||
+CONFIG_USB_DWC2=m
|
||||
+# CONFIG_IOMMU_SUPPORT is not set
|
||||
+CONFIG_RESET_CONTROLLER=y
|
||||
+# CONFIG_FIRMWARE_MEMMAP is not set
|
||||
+# CONFIG_DNOTIFY is not set
|
||||
+# CONFIG_PROC_PAGE_MONITOR is not set
|
||||
+CONFIG_TMPFS=y
|
||||
+CONFIG_TMPFS_XATTR=y
|
||||
+CONFIG_JFFS2_FS=y
|
||||
+CONFIG_JFFS2_SUMMARY=y
|
||||
+CONFIG_JFFS2_FS_XATTR=y
|
||||
+# CONFIG_JFFS2_FS_POSIX_ACL is not set
|
||||
+# CONFIG_JFFS2_FS_SECURITY is not set
|
||||
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
|
||||
+# CONFIG_JFFS2_ZLIB is not set
|
||||
+CONFIG_SQUASHFS=y
|
||||
+# CONFIG_SQUASHFS_ZLIB is not set
|
||||
+CONFIG_SQUASHFS_XZ=y
|
||||
+CONFIG_PRINTK_TIME=y
|
||||
+# CONFIG_ENABLE_MUST_CHECK is not set
|
||||
+CONFIG_FRAME_WARN=1024
|
||||
+CONFIG_MAGIC_SYSRQ=y
|
||||
+CONFIG_STRIP_ASM_SYMS=y
|
||||
+# CONFIG_UNUSED_SYMBOLS is not set
|
||||
+CONFIG_DEBUG_FS=y
|
||||
+# CONFIG_SCHED_DEBUG is not set
|
||||
+CONFIG_DEBUG_INFO=y
|
||||
+CONFIG_DEBUG_INFO_REDUCED=y
|
||||
+CONFIG_RCU_CPU_STALL_TIMEOUT=60
|
||||
+# CONFIG_FTRACE is not set
|
||||
+CONFIG_CRYPTO_ARC4=m
|
||||
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
|
||||
+# CONFIG_VIRTUALIZATION is not set
|
||||
+CONFIG_CRC_ITU_T=m
|
||||
+CONFIG_CRC32_SARWATE=y
|
||||
+# CONFIG_XZ_DEC_X86 is not set
|
||||
+CONFIG_AVERAGE=y
|
|
@ -1,300 +0,0 @@
|
|||
From dd4f939bb7c30f9256a35d31de673241ead350ab Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Fri, 24 Jan 2014 17:01:22 +0100
|
||||
Subject: [PATCH 208/215] MIPS: ralink: add MT7621 dts file
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/dts/Makefile | 1 +
|
||||
arch/mips/ralink/dts/mt7621.dtsi | 257 ++++++++++++++++++++++++++++++++++
|
||||
arch/mips/ralink/dts/mt7621_eval.dts | 16 +++
|
||||
3 files changed, 274 insertions(+)
|
||||
create mode 100644 arch/mips/ralink/dts/mt7621.dtsi
|
||||
create mode 100644 arch/mips/ralink/dts/mt7621_eval.dts
|
||||
|
||||
--- a/arch/mips/ralink/dts/Makefile
|
||||
+++ b/arch/mips/ralink/dts/Makefile
|
||||
@@ -2,3 +2,4 @@ obj-$(CONFIG_DTB_RT2880_EVAL) := rt2880_
|
||||
obj-$(CONFIG_DTB_RT305X_EVAL) := rt3052_eval.dtb.o
|
||||
obj-$(CONFIG_DTB_RT3883_EVAL) := rt3883_eval.dtb.o
|
||||
obj-$(CONFIG_DTB_MT7620A_EVAL) := mt7620a_eval.dtb.o
|
||||
+obj-$(CONFIG_DTB_MT7621_EVAL) := mt7621_eval.dtb.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/ralink/dts/mt7621.dtsi
|
||||
@@ -0,0 +1,257 @@
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ compatible = "ralink,mtk7620a-soc";
|
||||
+
|
||||
+ cpus {
|
||||
+ cpu@0 {
|
||||
+ compatible = "mips,mips24KEc";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ cpuintc: cpuintc@0 {
|
||||
+ #address-cells = <0>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-controller;
|
||||
+ compatible = "mti,cpu-interrupt-controller";
|
||||
+ };
|
||||
+
|
||||
+ palmbus@1E000000 {
|
||||
+ compatible = "palmbus";
|
||||
+ reg = <0x1E000000 0x100000>;
|
||||
+ ranges = <0x0 0x1E000000 0x0FFFFF>;
|
||||
+
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ sysc@0 {
|
||||
+ compatible = "mtk,mt7621-sysc";
|
||||
+ reg = <0x0 0x100>;
|
||||
+ };
|
||||
+
|
||||
+ wdt@100 {
|
||||
+ compatible = "mtk,mt7621-wdt";
|
||||
+ reg = <0x100 0x100>;
|
||||
+ };
|
||||
+
|
||||
+ gpio@600 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ compatible = "mtk,mt7621-gpio";
|
||||
+ reg = <0x600 0x100>;
|
||||
+
|
||||
+ gpio0: bank@0 {
|
||||
+ reg = <0>;
|
||||
+ compatible = "mtk,mt7621-gpio-bank";
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+ };
|
||||
+
|
||||
+ gpio1: bank@1 {
|
||||
+ reg = <1>;
|
||||
+ compatible = "mtk,mt7621-gpio-bank";
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+ };
|
||||
+
|
||||
+ gpio2: bank@2 {
|
||||
+ reg = <2>;
|
||||
+ compatible = "mtk,mt7621-gpio-bank";
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ memc@5000 {
|
||||
+ compatible = "mtk,mt7621-memc";
|
||||
+ reg = <0x300 0x100>;
|
||||
+ };
|
||||
+
|
||||
+ uartlite@c00 {
|
||||
+ compatible = "ns16550a";
|
||||
+ reg = <0xc00 0x100>;
|
||||
+
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ interrupts = <26>;
|
||||
+
|
||||
+ reg-shift = <2>;
|
||||
+ reg-io-width = <4>;
|
||||
+ no-loopback-test;
|
||||
+ };
|
||||
+
|
||||
+ uart@d00 {
|
||||
+ compatible = "ns16550a";
|
||||
+ reg = <0xd00 0x100>;
|
||||
+
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ interrupts = <27>;
|
||||
+
|
||||
+ fifo-size = <16>;
|
||||
+ reg-shift = <2>;
|
||||
+ reg-io-width = <4>;
|
||||
+ no-loopback-test;
|
||||
+ };
|
||||
+
|
||||
+ spi@b00 {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ compatible = "ralink,mt7621-spi";
|
||||
+ reg = <0xb00 0x100>;
|
||||
+
|
||||
+ resets = <&rstctrl 18>;
|
||||
+ reset-names = "spi";
|
||||
+
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+/* pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_pins>;*/
|
||||
+
|
||||
+ m25p80@0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ compatible = "en25q64";
|
||||
+ reg = <0 0>;
|
||||
+ linux,modalias = "m25p80", "en25q64";
|
||||
+ spi-max-frequency = <10000000>;
|
||||
+
|
||||
+ m25p,chunked-io;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "u-boot";
|
||||
+ reg = <0x0 0x30000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+
|
||||
+ partition@30000 {
|
||||
+ label = "u-boot-env";
|
||||
+ reg = <0x30000 0x10000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+
|
||||
+ factory: partition@40000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x40000 0x10000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+
|
||||
+ partition@50000 {
|
||||
+ label = "firmware";
|
||||
+ reg = <0x50000 0x7a0000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@7f0000 {
|
||||
+ label = "test";
|
||||
+ reg = <0x7f0000 0x10000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ rstctrl: rstctrl {
|
||||
+ compatible = "ralink,rt2880-reset";
|
||||
+ #reset-cells = <1>;
|
||||
+ };
|
||||
+
|
||||
+ sdhci@1E130000 {
|
||||
+ compatible = "ralink,mt7620a-sdhci";
|
||||
+ reg = <0x1E130000 4000>;
|
||||
+
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ interrupts = <20>;
|
||||
+ };
|
||||
+
|
||||
+ xhci@1E1C0000 {
|
||||
+ compatible = "xhci-platform";
|
||||
+ reg = <0x1E1C0000 4000>;
|
||||
+
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ interrupts = <22>;
|
||||
+ };
|
||||
+
|
||||
+ gic: gic@1fbc0000 {
|
||||
+ #address-cells = <0>;
|
||||
+ #interrupt-cells = <1>;
|
||||
+ interrupt-controller;
|
||||
+ compatible = "ralink,mt7621-gic";
|
||||
+ reg = < 0x1fbc0000 0x80 /* gic */
|
||||
+ 0x1fbf0000 0x8000 /* cpc */
|
||||
+ 0x1fbf8000 0x8000 /* gpmc */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ nand@1e003000 {
|
||||
+ compatible = "mtk,mt7621-nand";
|
||||
+ bank-width = <2>;
|
||||
+ reg = <0x1e003000 0x800
|
||||
+ 0x1e003800 0x800>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "uboot";
|
||||
+ reg = <0x00000 0x80000>; /* 64 KB */
|
||||
+ };
|
||||
+ partition@80000 {
|
||||
+ label = "uboot_env";
|
||||
+ reg = <0x80000 0x80000>; /* 64 KB */
|
||||
+ };
|
||||
+ partition@100000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x100000 0x40000>;
|
||||
+ };
|
||||
+ partition@140000 {
|
||||
+ label = "rootfs";
|
||||
+ reg = <0x140000 0xec0000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ ethernet@1e100000 {
|
||||
+ compatible = "ralink,mt7621-eth";
|
||||
+ reg = <0x1e100000 10000>;
|
||||
+
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ ralink,port-map = "llllw";
|
||||
+
|
||||
+ interrupt-parent = <&gic>;
|
||||
+ interrupts = <3>;
|
||||
+
|
||||
+/* resets = <&rstctrl 21 &rstctrl 23>;
|
||||
+ reset-names = "fe", "esw";
|
||||
+
|
||||
+ port@4 {
|
||||
+ compatible = "ralink,mt7620a-gsw-port", "ralink,eth-port";
|
||||
+ reg = <4>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ port@5 {
|
||||
+ compatible = "ralink,mt7620a-gsw-port", "ralink,eth-port";
|
||||
+ reg = <5>;
|
||||
+
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+*/
|
||||
+ mdio-bus {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ phy1f: ethernet-phy@1f {
|
||||
+ reg = <0x1f>;
|
||||
+ phy-mode = "rgmii";
|
||||
+
|
||||
+/* interrupt-parent = <&gic>;
|
||||
+ interrupts = <23>;
|
||||
+*/ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ gsw@1e110000 {
|
||||
+ compatible = "ralink,mt7620a-gsw";
|
||||
+ reg = <0x1e110000 8000>;
|
||||
+ };
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/ralink/dts/mt7621_eval.dts
|
||||
@@ -0,0 +1,16 @@
|
||||
+/dts-v1/;
|
||||
+
|
||||
+/include/ "mt7621.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "ralink,mt7621-eval-board", "ralink,mt7621-soc";
|
||||
+ model = "Ralink MT7621 evaluation board";
|
||||
+
|
||||
+ memory@0 {
|
||||
+ reg = <0x0 0x2000000>;
|
||||
+ };
|
||||
+
|
||||
+ chosen {
|
||||
+ bootargs = "console=ttyS0,57600";
|
||||
+ };
|
||||
+};
|
|
@ -1,37 +0,0 @@
|
|||
From a9d4390c6d27e737887388ccbb48f3767f9f89ef Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Fri, 24 Jan 2014 17:01:17 +0100
|
||||
Subject: [PATCH 209/215] MIPS: ralink: add MT7621 early_printk support
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/ralink/early_printk.c | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/arch/mips/ralink/early_printk.c
|
||||
+++ b/arch/mips/ralink/early_printk.c
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
#ifdef CONFIG_SOC_RT288X
|
||||
#define EARLY_UART_BASE 0x300c00
|
||||
+#elif defined(CONFIG_SOC_MT7621)
|
||||
+#define EARLY_UART_BASE 0x1E000c00
|
||||
#else
|
||||
#define EARLY_UART_BASE 0x10000c00
|
||||
#endif
|
||||
@@ -40,9 +42,15 @@ static inline u32 uart_r32(unsigned reg)
|
||||
|
||||
void prom_putchar(unsigned char ch)
|
||||
{
|
||||
+#ifdef CONFIG_SOC_MT7621
|
||||
+ uart_w32(ch, UART_TX);
|
||||
+ while ((uart_r32(0x14) & UART_LSR_THRE) == 0)
|
||||
+ ;
|
||||
+#else
|
||||
while ((uart_r32(UART_REG_LSR) & UART_LSR_THRE) == 0)
|
||||
;
|
||||
uart_w32(ch, UART_REG_TX);
|
||||
while ((uart_r32(UART_REG_LSR) & UART_LSR_THRE) == 0)
|
||||
;
|
||||
+#endif
|
||||
}
|
|
@ -1,822 +0,0 @@
|
|||
From 6541090161342ef11cf319a7471aeb6769e20c2c Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 16 Mar 2014 05:22:39 +0000
|
||||
Subject: [PATCH 210/215] MIPS: ralink: add MT7621 pcie driver
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/pci/Makefile | 1 +
|
||||
arch/mips/pci/pci-mt7621.c | 797 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 798 insertions(+)
|
||||
create mode 100644 arch/mips/pci/pci-mt7621.c
|
||||
|
||||
--- a/arch/mips/pci/Makefile
|
||||
+++ b/arch/mips/pci/Makefile
|
||||
@@ -42,6 +42,7 @@ obj-$(CONFIG_SNI_RM) += fixup-sni.o ops
|
||||
obj-$(CONFIG_LANTIQ) += fixup-lantiq.o
|
||||
obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o
|
||||
obj-$(CONFIG_SOC_MT7620) += pci-mt7620a.o
|
||||
+obj-$(CONFIG_SOC_MT7621) += pci-mt7621.o
|
||||
obj-$(CONFIG_SOC_RT2880) += pci-rt2880.o
|
||||
obj-$(CONFIG_SOC_RT3883) += pci-rt3883.o
|
||||
obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/pci/pci-mt7621.c
|
||||
@@ -0,0 +1,797 @@
|
||||
+/**************************************************************************
|
||||
+ *
|
||||
+ * BRIEF MODULE DESCRIPTION
|
||||
+ * PCI init for Ralink RT2880 solution
|
||||
+ *
|
||||
+ * Copyright 2007 Ralink Inc. (bruce_chang@ralinktech.com.tw)
|
||||
+ *
|
||||
+ * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ *
|
||||
+ * 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.,
|
||||
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
+ *
|
||||
+ *
|
||||
+ **************************************************************************
|
||||
+ * May 2007 Bruce Chang
|
||||
+ * Initial Release
|
||||
+ *
|
||||
+ * May 2009 Bruce Chang
|
||||
+ * support RT2880/RT3883 PCIe
|
||||
+ *
|
||||
+ * May 2011 Bruce Chang
|
||||
+ * support RT6855/MT7620 PCIe
|
||||
+ *
|
||||
+ **************************************************************************
|
||||
+ */
|
||||
+
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/pci.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/version.h>
|
||||
+#include <asm/pci.h>
|
||||
+#include <asm/io.h>
|
||||
+//#include <asm/mach-ralink/eureka_ep430.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/mod_devicetable.h>
|
||||
+#include <linux/delay.h>
|
||||
+//#include <asm/rt2880/surfboardint.h>
|
||||
+
|
||||
+#include <ralink_regs.h>
|
||||
+
|
||||
+extern void pcie_phy_init(void);
|
||||
+extern void chk_phy_pll(void);
|
||||
+
|
||||
+/*
|
||||
+ * These functions and structures provide the BIOS scan and mapping of the PCI
|
||||
+ * devices.
|
||||
+ */
|
||||
+
|
||||
+#define CONFIG_PCIE_PORT0
|
||||
+#define CONFIG_PCIE_PORT1
|
||||
+#define CONFIG_PCIE_PORT2
|
||||
+#define RALINK_PCIE0_CLK_EN (1<<24)
|
||||
+#define RALINK_PCIE1_CLK_EN (1<<25)
|
||||
+#define RALINK_PCIE2_CLK_EN (1<<26)
|
||||
+
|
||||
+#define RALINK_PCI_CONFIG_ADDR 0x20
|
||||
+#define RALINK_PCI_CONFIG_DATA_VIRTUAL_REG 0x24
|
||||
+#define SURFBOARDINT_PCIE0 12 /* PCIE0 */
|
||||
+#define RALINK_INT_PCIE0 SURFBOARDINT_PCIE0
|
||||
+#define RALINK_INT_PCIE1 SURFBOARDINT_PCIE1
|
||||
+#define RALINK_INT_PCIE2 SURFBOARDINT_PCIE2
|
||||
+#define SURFBOARDINT_PCIE1 32 /* PCIE1 */
|
||||
+#define SURFBOARDINT_PCIE2 33 /* PCIE2 */
|
||||
+#define RALINK_PCI_MEMBASE *(volatile u32 *)(RALINK_PCI_BASE + 0x0028)
|
||||
+#define RALINK_PCI_IOBASE *(volatile u32 *)(RALINK_PCI_BASE + 0x002C)
|
||||
+#define RALINK_PCIE0_RST (1<<24)
|
||||
+#define RALINK_PCIE1_RST (1<<25)
|
||||
+#define RALINK_PCIE2_RST (1<<26)
|
||||
+#define RALINK_SYSCTL_BASE 0xBE000000
|
||||
+
|
||||
+#define RALINK_PCI_PCICFG_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 0x0000)
|
||||
+#define RALINK_PCI_PCIMSK_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 0x000C)
|
||||
+#define RALINK_PCI_BASE 0xBE140000
|
||||
+
|
||||
+#define RALINK_PCIEPHY_P0P1_CTL_OFFSET (RALINK_PCI_BASE + 0x9000)
|
||||
+#define RT6855_PCIE0_OFFSET 0x2000
|
||||
+#define RT6855_PCIE1_OFFSET 0x3000
|
||||
+#define RT6855_PCIE2_OFFSET 0x4000
|
||||
+
|
||||
+#define RALINK_PCI0_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0010)
|
||||
+#define RALINK_PCI0_IMBASEBAR0_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0018)
|
||||
+#define RALINK_PCI0_ID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0030)
|
||||
+#define RALINK_PCI0_CLASS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0034)
|
||||
+#define RALINK_PCI0_SUBID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0038)
|
||||
+#define RALINK_PCI0_STATUS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0050)
|
||||
+#define RALINK_PCI0_DERR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0060)
|
||||
+#define RALINK_PCI0_ECRC *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE0_OFFSET + 0x0064)
|
||||
+
|
||||
+#define RALINK_PCI1_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0010)
|
||||
+#define RALINK_PCI1_IMBASEBAR0_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0018)
|
||||
+#define RALINK_PCI1_ID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0030)
|
||||
+#define RALINK_PCI1_CLASS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0034)
|
||||
+#define RALINK_PCI1_SUBID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0038)
|
||||
+#define RALINK_PCI1_STATUS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0050)
|
||||
+#define RALINK_PCI1_DERR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0060)
|
||||
+#define RALINK_PCI1_ECRC *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE1_OFFSET + 0x0064)
|
||||
+
|
||||
+#define RALINK_PCI2_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0010)
|
||||
+#define RALINK_PCI2_IMBASEBAR0_ADDR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0018)
|
||||
+#define RALINK_PCI2_ID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0030)
|
||||
+#define RALINK_PCI2_CLASS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0034)
|
||||
+#define RALINK_PCI2_SUBID *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0038)
|
||||
+#define RALINK_PCI2_STATUS *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0050)
|
||||
+#define RALINK_PCI2_DERR *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0060)
|
||||
+#define RALINK_PCI2_ECRC *(volatile u32 *)(RALINK_PCI_BASE + RT6855_PCIE2_OFFSET + 0x0064)
|
||||
+
|
||||
+#define RALINK_PCIEPHY_P0P1_CTL_OFFSET (RALINK_PCI_BASE + 0x9000)
|
||||
+#define RALINK_PCIEPHY_P2_CTL_OFFSET (RALINK_PCI_BASE + 0xA000)
|
||||
+
|
||||
+
|
||||
+#define MV_WRITE(ofs, data) \
|
||||
+ *(volatile u32 *)(RALINK_PCI_BASE+(ofs)) = cpu_to_le32(data)
|
||||
+#define MV_READ(ofs, data) \
|
||||
+ *(data) = le32_to_cpu(*(volatile u32 *)(RALINK_PCI_BASE+(ofs)))
|
||||
+#define MV_READ_DATA(ofs) \
|
||||
+ le32_to_cpu(*(volatile u32 *)(RALINK_PCI_BASE+(ofs)))
|
||||
+
|
||||
+#define MV_WRITE_16(ofs, data) \
|
||||
+ *(volatile u16 *)(RALINK_PCI_BASE+(ofs)) = cpu_to_le16(data)
|
||||
+#define MV_READ_16(ofs, data) \
|
||||
+ *(data) = le16_to_cpu(*(volatile u16 *)(RALINK_PCI_BASE+(ofs)))
|
||||
+
|
||||
+#define MV_WRITE_8(ofs, data) \
|
||||
+ *(volatile u8 *)(RALINK_PCI_BASE+(ofs)) = data
|
||||
+#define MV_READ_8(ofs, data) \
|
||||
+ *(data) = *(volatile u8 *)(RALINK_PCI_BASE+(ofs))
|
||||
+
|
||||
+
|
||||
+
|
||||
+#define RALINK_PCI_MM_MAP_BASE 0x60000000
|
||||
+#define RALINK_PCI_IO_MAP_BASE 0x1e160000
|
||||
+
|
||||
+#define RALINK_SYSTEM_CONTROL_BASE 0xbe000000
|
||||
+#define GPIO_PERST
|
||||
+#define ASSERT_SYSRST_PCIE(val) do { \
|
||||
+ if (*(unsigned int *)(0xbe00000c) == 0x00030101) \
|
||||
+ RALINK_RSTCTRL |= val; \
|
||||
+ else \
|
||||
+ RALINK_RSTCTRL &= ~val; \
|
||||
+ } while(0)
|
||||
+#define DEASSERT_SYSRST_PCIE(val) do { \
|
||||
+ if (*(unsigned int *)(0xbe00000c) == 0x00030101) \
|
||||
+ RALINK_RSTCTRL &= ~val; \
|
||||
+ else \
|
||||
+ RALINK_RSTCTRL |= val; \
|
||||
+ } while(0)
|
||||
+#define RALINK_SYSCFG1 *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x14)
|
||||
+#define RALINK_CLKCFG1 *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x30)
|
||||
+#define RALINK_RSTCTRL *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x34)
|
||||
+#define RALINK_GPIOMODE *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x60)
|
||||
+#define RALINK_PCIE_CLK_GEN *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x7c)
|
||||
+#define RALINK_PCIE_CLK_GEN1 *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x80)
|
||||
+#define PPLL_CFG1 *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0x9c)
|
||||
+#define PPLL_DRV *(unsigned int *)(RALINK_SYSTEM_CONTROL_BASE + 0xa0)
|
||||
+//RALINK_SYSCFG1 bit
|
||||
+#define RALINK_PCI_HOST_MODE_EN (1<<7)
|
||||
+#define RALINK_PCIE_RC_MODE_EN (1<<8)
|
||||
+//RALINK_RSTCTRL bit
|
||||
+#define RALINK_PCIE_RST (1<<23)
|
||||
+#define RALINK_PCI_RST (1<<24)
|
||||
+//RALINK_CLKCFG1 bit
|
||||
+#define RALINK_PCI_CLK_EN (1<<19)
|
||||
+#define RALINK_PCIE_CLK_EN (1<<21)
|
||||
+//RALINK_GPIOMODE bit
|
||||
+#define PCI_SLOTx2 (1<<11)
|
||||
+#define PCI_SLOTx1 (2<<11)
|
||||
+//MTK PCIE PLL bit
|
||||
+#define PDRV_SW_SET (1<<31)
|
||||
+#define LC_CKDRVPD_ (1<<19)
|
||||
+
|
||||
+#define MEMORY_BASE 0x0
|
||||
+int pcie_link_status = 0;
|
||||
+
|
||||
+void __inline__ read_config(unsigned long bus, unsigned long dev, unsigned long func, unsigned long reg, unsigned long *val);
|
||||
+void __inline__ write_config(unsigned long bus, unsigned long dev, unsigned long func, unsigned long reg, unsigned long val);
|
||||
+
|
||||
+#define PCI_ACCESS_READ_1 0
|
||||
+#define PCI_ACCESS_READ_2 1
|
||||
+#define PCI_ACCESS_READ_4 2
|
||||
+#define PCI_ACCESS_WRITE_1 3
|
||||
+#define PCI_ACCESS_WRITE_2 4
|
||||
+#define PCI_ACCESS_WRITE_4 5
|
||||
+
|
||||
+static int config_access(unsigned char access_type, struct pci_bus *bus,
|
||||
+ unsigned int devfn, unsigned int where, u32 * data)
|
||||
+{
|
||||
+ unsigned int slot = PCI_SLOT(devfn);
|
||||
+ u8 func = PCI_FUNC(devfn);
|
||||
+ uint32_t address_reg, data_reg;
|
||||
+ unsigned int address;
|
||||
+
|
||||
+ address_reg = RALINK_PCI_CONFIG_ADDR;
|
||||
+ data_reg = RALINK_PCI_CONFIG_DATA_VIRTUAL_REG;
|
||||
+
|
||||
+ address = (((where&0xF00)>>8)<<24) |(bus->number << 16) | (slot << 11) | (func << 8) | (where & 0xfc) | 0x80000000;
|
||||
+ MV_WRITE(address_reg, address);
|
||||
+
|
||||
+ switch(access_type) {
|
||||
+ case PCI_ACCESS_WRITE_1:
|
||||
+ MV_WRITE_8(data_reg+(where&0x3), *data);
|
||||
+ break;
|
||||
+ case PCI_ACCESS_WRITE_2:
|
||||
+ MV_WRITE_16(data_reg+(where&0x3), *data);
|
||||
+ break;
|
||||
+ case PCI_ACCESS_WRITE_4:
|
||||
+ MV_WRITE(data_reg, *data);
|
||||
+ break;
|
||||
+ case PCI_ACCESS_READ_1:
|
||||
+ MV_READ_8( data_reg+(where&0x3), data);
|
||||
+ break;
|
||||
+ case PCI_ACCESS_READ_2:
|
||||
+ MV_READ_16(data_reg+(where&0x3), data);
|
||||
+ break;
|
||||
+ case PCI_ACCESS_READ_4:
|
||||
+ MV_READ(data_reg, data);
|
||||
+ break;
|
||||
+ default:
|
||||
+ printk("no specify access type\n");
|
||||
+ break;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 * val)
|
||||
+{
|
||||
+ return config_access(PCI_ACCESS_READ_1, bus, devfn, (unsigned int)where, (u32 *)val);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+read_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 * val)
|
||||
+{
|
||||
+ return config_access(PCI_ACCESS_READ_2, bus, devfn, (unsigned int)where, (u32 *)val);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 * val)
|
||||
+{
|
||||
+ return config_access(PCI_ACCESS_READ_4, bus, devfn, (unsigned int)where, (u32 *)val);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 val)
|
||||
+{
|
||||
+ if (config_access(PCI_ACCESS_WRITE_1, bus, devfn, (unsigned int)where, (u32 *)&val))
|
||||
+ return -1;
|
||||
+
|
||||
+ return PCIBIOS_SUCCESSFUL;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+write_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 val)
|
||||
+{
|
||||
+ if (config_access(PCI_ACCESS_WRITE_2, bus, devfn, where, (u32 *)&val))
|
||||
+ return -1;
|
||||
+
|
||||
+ return PCIBIOS_SUCCESSFUL;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 val)
|
||||
+{
|
||||
+ if (config_access(PCI_ACCESS_WRITE_4, bus, devfn, where, &val))
|
||||
+ return -1;
|
||||
+
|
||||
+ return PCIBIOS_SUCCESSFUL;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 * val)
|
||||
+{
|
||||
+ switch (size) {
|
||||
+ case 1:
|
||||
+ return read_config_byte(bus, devfn, where, (u8 *) val);
|
||||
+ case 2:
|
||||
+ return read_config_word(bus, devfn, where, (u16 *) val);
|
||||
+ default:
|
||||
+ return read_config_dword(bus, devfn, where, val);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)
|
||||
+{
|
||||
+ switch (size) {
|
||||
+ case 1:
|
||||
+ return write_config_byte(bus, devfn, where, (u8) val);
|
||||
+ case 2:
|
||||
+ return write_config_word(bus, devfn, where, (u16) val);
|
||||
+ default:
|
||||
+ return write_config_dword(bus, devfn, where, val);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+struct pci_ops rt2880_pci_ops= {
|
||||
+ .read = pci_config_read,
|
||||
+ .write = pci_config_write,
|
||||
+};
|
||||
+
|
||||
+static struct resource rt2880_res_pci_mem1 = {
|
||||
+ .name = "PCI MEM1",
|
||||
+ .start = RALINK_PCI_MM_MAP_BASE,
|
||||
+ .end = (u32)((RALINK_PCI_MM_MAP_BASE + (unsigned char *)0x0fffffff)),
|
||||
+ .flags = IORESOURCE_MEM,
|
||||
+};
|
||||
+static struct resource rt2880_res_pci_io1 = {
|
||||
+ .name = "PCI I/O1",
|
||||
+ .start = RALINK_PCI_IO_MAP_BASE,
|
||||
+ .end = (u32)((RALINK_PCI_IO_MAP_BASE + (unsigned char *)0x0ffff)),
|
||||
+ .flags = IORESOURCE_IO,
|
||||
+};
|
||||
+
|
||||
+struct pci_controller rt2880_controller = {
|
||||
+ .pci_ops = &rt2880_pci_ops,
|
||||
+ .mem_resource = &rt2880_res_pci_mem1,
|
||||
+ .io_resource = &rt2880_res_pci_io1,
|
||||
+ .mem_offset = 0x00000000UL,
|
||||
+ .io_offset = 0x00000000UL,
|
||||
+ .io_map_base = 0xa0000000,
|
||||
+};
|
||||
+
|
||||
+void __inline__
|
||||
+read_config(unsigned long bus, unsigned long dev, unsigned long func, unsigned long reg, unsigned long *val)
|
||||
+{
|
||||
+ unsigned int address_reg, data_reg, address;
|
||||
+
|
||||
+ address_reg = RALINK_PCI_CONFIG_ADDR;
|
||||
+ data_reg = RALINK_PCI_CONFIG_DATA_VIRTUAL_REG;
|
||||
+ address = (((reg & 0xF00)>>8)<<24) | (bus << 16) | (dev << 11) | (func << 8) | (reg & 0xfc) | 0x80000000 ;
|
||||
+ MV_WRITE(address_reg, address);
|
||||
+ MV_READ(data_reg, val);
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+void __inline__
|
||||
+write_config(unsigned long bus, unsigned long dev, unsigned long func, unsigned long reg, unsigned long val)
|
||||
+{
|
||||
+ unsigned int address_reg, data_reg, address;
|
||||
+
|
||||
+ address_reg = RALINK_PCI_CONFIG_ADDR;
|
||||
+ data_reg = RALINK_PCI_CONFIG_DATA_VIRTUAL_REG;
|
||||
+ address = (((reg & 0xF00)>>8)<<24) | (bus << 16) | (dev << 11) | (func << 8) | (reg & 0xfc) | 0x80000000 ;
|
||||
+ MV_WRITE(address_reg, address);
|
||||
+ MV_WRITE(data_reg, val);
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int __init
|
||||
+pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
||||
+{
|
||||
+ u16 cmd;
|
||||
+ u32 val;
|
||||
+ int irq = 0;
|
||||
+
|
||||
+ if ((dev->bus->number == 0) && (slot == 0)) {
|
||||
+ write_config(0, 0, 0, PCI_BASE_ADDRESS_0, MEMORY_BASE);
|
||||
+ read_config(0, 0, 0, PCI_BASE_ADDRESS_0, (unsigned long *)&val);
|
||||
+ printk("BAR0 at slot 0 = %x\n", val);
|
||||
+ printk("bus=0x%x, slot = 0x%x\n",dev->bus->number, slot);
|
||||
+ } else if((dev->bus->number == 0) && (slot == 0x1)) {
|
||||
+ write_config(0, 1, 0, PCI_BASE_ADDRESS_0, MEMORY_BASE);
|
||||
+ read_config(0, 1, 0, PCI_BASE_ADDRESS_0, (unsigned long *)&val);
|
||||
+ printk("BAR0 at slot 1 = %x\n", val);
|
||||
+ printk("bus=0x%x, slot = 0x%x\n",dev->bus->number, slot);
|
||||
+ } else if((dev->bus->number == 0) && (slot == 0x2)) {
|
||||
+ write_config(0, 2, 0, PCI_BASE_ADDRESS_0, MEMORY_BASE);
|
||||
+ read_config(0, 2, 0, PCI_BASE_ADDRESS_0, (unsigned long *)&val);
|
||||
+ printk("BAR0 at slot 2 = %x\n", val);
|
||||
+ printk("bus=0x%x, slot = 0x%x\n",dev->bus->number, slot);
|
||||
+ } else if ((dev->bus->number == 1) && (slot == 0x0)) {
|
||||
+ switch (pcie_link_status) {
|
||||
+ case 2:
|
||||
+ case 6:
|
||||
+ irq = RALINK_INT_PCIE1;
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ irq = RALINK_INT_PCIE2;
|
||||
+ break;
|
||||
+ default:
|
||||
+ irq = RALINK_INT_PCIE0;
|
||||
+ }
|
||||
+ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq);
|
||||
+ } else if ((dev->bus->number == 2) && (slot == 0x0)) {
|
||||
+ switch (pcie_link_status) {
|
||||
+ case 5:
|
||||
+ case 6:
|
||||
+ irq = RALINK_INT_PCIE2;
|
||||
+ break;
|
||||
+ default:
|
||||
+ irq = RALINK_INT_PCIE1;
|
||||
+ }
|
||||
+ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq);
|
||||
+ } else if ((dev->bus->number == 2) && (slot == 0x1)) {
|
||||
+ switch (pcie_link_status) {
|
||||
+ case 5:
|
||||
+ case 6:
|
||||
+ irq = RALINK_INT_PCIE2;
|
||||
+ break;
|
||||
+ default:
|
||||
+ irq = RALINK_INT_PCIE1;
|
||||
+ }
|
||||
+ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq);
|
||||
+ } else if ((dev->bus->number ==3) && (slot == 0x0)) {
|
||||
+ irq = RALINK_INT_PCIE2;
|
||||
+ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq);
|
||||
+ } else if ((dev->bus->number ==3) && (slot == 0x1)) {
|
||||
+ irq = RALINK_INT_PCIE2;
|
||||
+ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq);
|
||||
+ } else if ((dev->bus->number ==3) && (slot == 0x2)) {
|
||||
+ irq = RALINK_INT_PCIE2;
|
||||
+ printk("bus=0x%x, slot = 0x%x, irq=0x%x\n",dev->bus->number, slot, dev->irq);
|
||||
+ } else {
|
||||
+ printk("bus=0x%x, slot = 0x%x\n",dev->bus->number, slot);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0x14); //configure cache line size 0x14
|
||||
+ pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xFF); //configure latency timer 0x10
|
||||
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
|
||||
+ cmd = cmd | PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
|
||||
+ pci_write_config_word(dev, PCI_COMMAND, cmd);
|
||||
+ pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
|
||||
+ return irq;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+set_pcie_phy(u32 *addr, int start_b, int bits, int val)
|
||||
+{
|
||||
+// printk("0x%p:", addr);
|
||||
+// printk(" %x", *addr);
|
||||
+ *(unsigned int *)(addr) &= ~(((1<<bits) - 1)<<start_b);
|
||||
+ *(unsigned int *)(addr) |= val << start_b;
|
||||
+// printk(" -> %x\n", *addr);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+bypass_pipe_rst(void)
|
||||
+{
|
||||
+#if defined (CONFIG_PCIE_PORT0)
|
||||
+ /* PCIe Port 0 */
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x02c), 12, 1, 0x01); // rg_pe1_pipe_rst_b
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x02c), 4, 1, 0x01); // rg_pe1_pipe_cmd_frc[4]
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT1)
|
||||
+ /* PCIe Port 1 */
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x12c), 12, 1, 0x01); // rg_pe1_pipe_rst_b
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x12c), 4, 1, 0x01); // rg_pe1_pipe_cmd_frc[4]
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT2)
|
||||
+ /* PCIe Port 2 */
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x02c), 12, 1, 0x01); // rg_pe1_pipe_rst_b
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x02c), 4, 1, 0x01); // rg_pe1_pipe_cmd_frc[4]
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+set_phy_for_ssc(void)
|
||||
+{
|
||||
+ unsigned long reg = (*(volatile u32 *)(RALINK_SYSCTL_BASE + 0x10));
|
||||
+
|
||||
+ reg = (reg >> 6) & 0x7;
|
||||
+#if defined (CONFIG_PCIE_PORT0) || defined (CONFIG_PCIE_PORT1)
|
||||
+ /* Set PCIe Port0 & Port1 PHY to disable SSC */
|
||||
+ /* Debug Xtal Type */
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x400), 8, 1, 0x01); // rg_pe1_frc_h_xtal_type
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x400), 9, 2, 0x00); // rg_pe1_h_xtal_type
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000), 4, 1, 0x01); // rg_pe1_frc_phy_en //Force Port 0 enable control
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100), 4, 1, 0x01); // rg_pe1_frc_phy_en //Force Port 1 enable control
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000), 5, 1, 0x00); // rg_pe1_phy_en //Port 0 disable
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100), 5, 1, 0x00); // rg_pe1_phy_en //Port 1 disable
|
||||
+ if(reg <= 5 && reg >= 3) { // 40MHz Xtal
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 6, 2, 0x01); // RG_PE1_H_PLL_PREDIV //Pre-divider ratio (for host mode)
|
||||
+ printk("***** Xtal 40MHz *****\n");
|
||||
+ } else { // 25MHz | 20MHz Xtal
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 6, 2, 0x00); // RG_PE1_H_PLL_PREDIV //Pre-divider ratio (for host mode)
|
||||
+ if (reg >= 6) {
|
||||
+ printk("***** Xtal 25MHz *****\n");
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4bc), 4, 2, 0x01); // RG_PE1_H_PLL_FBKSEL //Feedback clock select
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x49c), 0,31, 0x18000000); // RG_PE1_H_LCDDS_PCW_NCPO //DDS NCPO PCW (for host mode)
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4a4), 0,16, 0x18d); // RG_PE1_H_LCDDS_SSC_PRD //DDS SSC dither period control
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4a8), 0,12, 0x4a); // RG_PE1_H_LCDDS_SSC_DELTA //DDS SSC dither amplitude control
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4a8), 16,12, 0x4a); // RG_PE1_H_LCDDS_SSC_DELTA1 //DDS SSC dither amplitude control for initial
|
||||
+ } else {
|
||||
+ printk("***** Xtal 20MHz *****\n");
|
||||
+ }
|
||||
+ }
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4a0), 5, 1, 0x01); // RG_PE1_LCDDS_CLK_PH_INV //DDS clock inversion
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 22, 2, 0x02); // RG_PE1_H_PLL_BC
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 18, 4, 0x06); // RG_PE1_H_PLL_BP
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 12, 4, 0x02); // RG_PE1_H_PLL_IR
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 8, 4, 0x01); // RG_PE1_H_PLL_IC
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x4ac), 16, 3, 0x00); // RG_PE1_H_PLL_BR
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490), 1, 3, 0x02); // RG_PE1_PLL_DIVEN
|
||||
+ if(reg <= 5 && reg >= 3) { // 40MHz Xtal
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x414), 6, 2, 0x01); // rg_pe1_mstckdiv //value of da_pe1_mstckdiv when force mode enable
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x414), 5, 1, 0x01); // rg_pe1_frc_mstckdiv //force mode enable of da_pe1_mstckdiv
|
||||
+ }
|
||||
+ /* Enable PHY and disable force mode */
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000), 5, 1, 0x01); // rg_pe1_phy_en //Port 0 enable
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100), 5, 1, 0x01); // rg_pe1_phy_en //Port 1 enable
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000), 4, 1, 0x00); // rg_pe1_frc_phy_en //Force Port 0 disable control
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100), 4, 1, 0x00); // rg_pe1_frc_phy_en //Force Port 1 disable control
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT2)
|
||||
+ /* Set PCIe Port2 PHY to disable SSC */
|
||||
+ /* Debug Xtal Type */
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x400), 8, 1, 0x01); // rg_pe1_frc_h_xtal_type
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x400), 9, 2, 0x00); // rg_pe1_h_xtal_type
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000), 4, 1, 0x01); // rg_pe1_frc_phy_en //Force Port 0 enable control
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000), 5, 1, 0x00); // rg_pe1_phy_en //Port 0 disable
|
||||
+ if(reg <= 5 && reg >= 3) { // 40MHz Xtal
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 6, 2, 0x01); // RG_PE1_H_PLL_PREDIV //Pre-divider ratio (for host mode)
|
||||
+ } else { // 25MHz | 20MHz Xtal
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 6, 2, 0x00); // RG_PE1_H_PLL_PREDIV //Pre-divider ratio (for host mode)
|
||||
+ if (reg >= 6) { // 25MHz Xtal
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4bc), 4, 2, 0x01); // RG_PE1_H_PLL_FBKSEL //Feedback clock select
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x49c), 0,31, 0x18000000); // RG_PE1_H_LCDDS_PCW_NCPO //DDS NCPO PCW (for host mode)
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4a4), 0,16, 0x18d); // RG_PE1_H_LCDDS_SSC_PRD //DDS SSC dither period control
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4a8), 0,12, 0x4a); // RG_PE1_H_LCDDS_SSC_DELTA //DDS SSC dither amplitude control
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4a8), 16,12, 0x4a); // RG_PE1_H_LCDDS_SSC_DELTA1 //DDS SSC dither amplitude control for initial
|
||||
+ }
|
||||
+ }
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4a0), 5, 1, 0x01); // RG_PE1_LCDDS_CLK_PH_INV //DDS clock inversion
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 22, 2, 0x02); // RG_PE1_H_PLL_BC
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 18, 4, 0x06); // RG_PE1_H_PLL_BP
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 12, 4, 0x02); // RG_PE1_H_PLL_IR
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 8, 4, 0x01); // RG_PE1_H_PLL_IC
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x4ac), 16, 3, 0x00); // RG_PE1_H_PLL_BR
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x490), 1, 3, 0x02); // RG_PE1_PLL_DIVEN
|
||||
+ if(reg <= 5 && reg >= 3) { // 40MHz Xtal
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x414), 6, 2, 0x01); // rg_pe1_mstckdiv //value of da_pe1_mstckdiv when force mode enable
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x414), 5, 1, 0x01); // rg_pe1_frc_mstckdiv //force mode enable of da_pe1_mstckdiv
|
||||
+ }
|
||||
+ /* Enable PHY and disable force mode */
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000), 5, 1, 0x01); // rg_pe1_phy_en //Port 0 enable
|
||||
+ set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000), 4, 1, 0x00); // rg_pe1_frc_phy_en //Force Port 0 disable control
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+int init_rt2880pci(void)
|
||||
+{
|
||||
+ unsigned long val = 0;
|
||||
+ iomem_resource.start = 0;
|
||||
+ iomem_resource.end= ~0;
|
||||
+ ioport_resource.start= 0;
|
||||
+ ioport_resource.end = ~0;
|
||||
+
|
||||
+#if defined (CONFIG_PCIE_PORT0)
|
||||
+ val = RALINK_PCIE0_RST;
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT1)
|
||||
+ val |= RALINK_PCIE1_RST;
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT2)
|
||||
+ val |= RALINK_PCIE2_RST;
|
||||
+#endif
|
||||
+ DEASSERT_SYSRST_PCIE(val);
|
||||
+ printk("release PCIe RST: RALINK_RSTCTRL = %x\n", RALINK_RSTCTRL);
|
||||
+
|
||||
+ bypass_pipe_rst();
|
||||
+ set_phy_for_ssc();
|
||||
+ ASSERT_SYSRST_PCIE(RALINK_PCIE0_RST | RALINK_PCIE1_RST | RALINK_PCIE2_RST);
|
||||
+ printk("pull PCIe RST: RALINK_RSTCTRL = %x\n", RALINK_RSTCTRL);
|
||||
+#if defined GPIO_PERST /* add GPIO control instead of PERST_N */ /*chhung*/
|
||||
+ *(unsigned int *)(0xbe000060) &= ~(0x3<<10 | 0x3<<3);
|
||||
+ *(unsigned int *)(0xbe000060) |= 0x1<<10 | 0x1<<3;
|
||||
+ mdelay(100);
|
||||
+ *(unsigned int *)(0xbe000600) |= 0x1<<19 | 0x1<<8 | 0x1<<7; // use GPIO19/GPIO8/GPIO7 (PERST_N/UART_RXD3/UART_TXD3)
|
||||
+ mdelay(100);
|
||||
+ *(unsigned int *)(0xbe000620) &= ~(0x1<<19 | 0x1<<8 | 0x1<<7); // clear DATA
|
||||
+
|
||||
+ mdelay(100);
|
||||
+#else
|
||||
+ *(unsigned int *)(0xbe000060) &= ~0x00000c00;
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT0)
|
||||
+ val = RALINK_PCIE0_RST;
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT1)
|
||||
+ val |= RALINK_PCIE1_RST;
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT2)
|
||||
+ val |= RALINK_PCIE2_RST;
|
||||
+#endif
|
||||
+ DEASSERT_SYSRST_PCIE(val);
|
||||
+ printk("release PCIe RST: RALINK_RSTCTRL = %x\n", RALINK_RSTCTRL);
|
||||
+#if defined (CONFIG_PCIE_PORT0)
|
||||
+ read_config(0, 0, 0, 0x70c, &val);
|
||||
+ val &= ~(0xff)<<8;
|
||||
+ val |= 0x50<<8;
|
||||
+ write_config(0, 0, 0, 0x70c, val);
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT1)
|
||||
+ read_config(0, 1, 0, 0x70c, &val);
|
||||
+ val &= ~(0xff)<<8;
|
||||
+ val |= 0x50<<8;
|
||||
+ write_config(0, 1, 0, 0x70c, val);
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT2)
|
||||
+ read_config(0, 2, 0, 0x70c, &val);
|
||||
+ val &= ~(0xff)<<8;
|
||||
+ val |= 0x50<<8;
|
||||
+ write_config(0, 2, 0, 0x70c, val);
|
||||
+#endif
|
||||
+
|
||||
+#if defined (CONFIG_PCIE_PORT0)
|
||||
+ read_config(0, 0, 0, 0x70c, &val);
|
||||
+ printk("Port 0 N_FTS = %x\n", (unsigned int)val);
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT1)
|
||||
+ read_config(0, 1, 0, 0x70c, &val);
|
||||
+ printk("Port 1 N_FTS = %x\n", (unsigned int)val);
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT2)
|
||||
+ read_config(0, 2, 0, 0x70c, &val);
|
||||
+ printk("Port 2 N_FTS = %x\n", (unsigned int)val);
|
||||
+#endif
|
||||
+
|
||||
+ RALINK_RSTCTRL = (RALINK_RSTCTRL | RALINK_PCIE_RST);
|
||||
+ RALINK_SYSCFG1 &= ~(0x30);
|
||||
+ RALINK_SYSCFG1 |= (2<<4);
|
||||
+ RALINK_PCIE_CLK_GEN &= 0x7fffffff;
|
||||
+ RALINK_PCIE_CLK_GEN1 &= 0x80ffffff;
|
||||
+ RALINK_PCIE_CLK_GEN1 |= 0xa << 24;
|
||||
+ RALINK_PCIE_CLK_GEN |= 0x80000000;
|
||||
+ mdelay(50);
|
||||
+ RALINK_RSTCTRL = (RALINK_RSTCTRL & ~RALINK_PCIE_RST);
|
||||
+
|
||||
+
|
||||
+#if defined GPIO_PERST /* add GPIO control instead of PERST_N */ /*chhung*/
|
||||
+ *(unsigned int *)(0xbe000620) |= 0x1<<19 | 0x1<<8 | 0x1<<7; // set DATA
|
||||
+ mdelay(100);
|
||||
+#else
|
||||
+ RALINK_PCI_PCICFG_ADDR &= ~(1<<1); //de-assert PERST
|
||||
+#endif
|
||||
+ mdelay(500);
|
||||
+
|
||||
+
|
||||
+ mdelay(500);
|
||||
+#if defined (CONFIG_PCIE_PORT0)
|
||||
+ if(( RALINK_PCI0_STATUS & 0x1) == 0)
|
||||
+ {
|
||||
+ printk("PCIE0 no card, disable it(RST&CLK)\n");
|
||||
+ ASSERT_SYSRST_PCIE(RALINK_PCIE0_RST);
|
||||
+ RALINK_CLKCFG1 = (RALINK_CLKCFG1 & ~RALINK_PCIE0_CLK_EN);
|
||||
+ pcie_link_status &= ~(1<<0);
|
||||
+ } else {
|
||||
+ pcie_link_status |= 1<<0;
|
||||
+ RALINK_PCI_PCIMSK_ADDR |= (1<<20); // enable pcie1 interrupt
|
||||
+ }
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT1)
|
||||
+ if(( RALINK_PCI1_STATUS & 0x1) == 0)
|
||||
+ {
|
||||
+ printk("PCIE1 no card, disable it(RST&CLK)\n");
|
||||
+ ASSERT_SYSRST_PCIE(RALINK_PCIE1_RST);
|
||||
+ RALINK_CLKCFG1 = (RALINK_CLKCFG1 & ~RALINK_PCIE1_CLK_EN);
|
||||
+ pcie_link_status &= ~(1<<1);
|
||||
+ } else {
|
||||
+ pcie_link_status |= 1<<1;
|
||||
+ RALINK_PCI_PCIMSK_ADDR |= (1<<21); // enable pcie1 interrupt
|
||||
+ }
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT2)
|
||||
+ if (( RALINK_PCI2_STATUS & 0x1) == 0) {
|
||||
+ printk("PCIE2 no card, disable it(RST&CLK)\n");
|
||||
+ ASSERT_SYSRST_PCIE(RALINK_PCIE2_RST);
|
||||
+ RALINK_CLKCFG1 = (RALINK_CLKCFG1 & ~RALINK_PCIE2_CLK_EN);
|
||||
+ pcie_link_status &= ~(1<<2);
|
||||
+ } else {
|
||||
+ pcie_link_status |= 1<<2;
|
||||
+ RALINK_PCI_PCIMSK_ADDR |= (1<<22); // enable pcie2 interrupt
|
||||
+ }
|
||||
+#endif
|
||||
+ if (pcie_link_status == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+/*
|
||||
+pcie(2/1/0) link status pcie2_num pcie1_num pcie0_num
|
||||
+3'b000 x x x
|
||||
+3'b001 x x 0
|
||||
+3'b010 x 0 x
|
||||
+3'b011 x 1 0
|
||||
+3'b100 0 x x
|
||||
+3'b101 1 x 0
|
||||
+3'b110 1 0 x
|
||||
+3'b111 2 1 0
|
||||
+*/
|
||||
+ switch(pcie_link_status) {
|
||||
+ case 2:
|
||||
+ RALINK_PCI_PCICFG_ADDR &= ~0x00ff0000;
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x1 << 16; //port0
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x0 << 20; //port1
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ RALINK_PCI_PCICFG_ADDR &= ~0x0fff0000;
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x1 << 16; //port0
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x2 << 20; //port1
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x0 << 24; //port2
|
||||
+ break;
|
||||
+ case 5:
|
||||
+ RALINK_PCI_PCICFG_ADDR &= ~0x0fff0000;
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x0 << 16; //port0
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x2 << 20; //port1
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x1 << 24; //port2
|
||||
+ break;
|
||||
+ case 6:
|
||||
+ RALINK_PCI_PCICFG_ADDR &= ~0x0fff0000;
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x2 << 16; //port0
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x0 << 20; //port1
|
||||
+ RALINK_PCI_PCICFG_ADDR |= 0x1 << 24; //port2
|
||||
+ break;
|
||||
+ }
|
||||
+ printk(" -> %x\n", RALINK_PCI_PCICFG_ADDR);
|
||||
+ //printk(" RALINK_PCI_ARBCTL = %x\n", RALINK_PCI_ARBCTL);
|
||||
+
|
||||
+/*
|
||||
+ ioport_resource.start = rt2880_res_pci_io1.start;
|
||||
+ ioport_resource.end = rt2880_res_pci_io1.end;
|
||||
+*/
|
||||
+
|
||||
+ RALINK_PCI_MEMBASE = 0xffffffff; //RALINK_PCI_MM_MAP_BASE;
|
||||
+ RALINK_PCI_IOBASE = RALINK_PCI_IO_MAP_BASE;
|
||||
+
|
||||
+#if defined (CONFIG_PCIE_PORT0)
|
||||
+ //PCIe0
|
||||
+ if((pcie_link_status & 0x1) != 0) {
|
||||
+ RALINK_PCI0_BAR0SETUP_ADDR = 0x7FFF0001; //open 7FFF:2G; ENABLE
|
||||
+ RALINK_PCI0_IMBASEBAR0_ADDR = MEMORY_BASE;
|
||||
+ RALINK_PCI0_CLASS = 0x06040001;
|
||||
+ printk("PCIE0 enabled\n");
|
||||
+ }
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT1)
|
||||
+ //PCIe1
|
||||
+ if ((pcie_link_status & 0x2) != 0) {
|
||||
+ RALINK_PCI1_BAR0SETUP_ADDR = 0x7FFF0001; //open 7FFF:2G; ENABLE
|
||||
+ RALINK_PCI1_IMBASEBAR0_ADDR = MEMORY_BASE;
|
||||
+ RALINK_PCI1_CLASS = 0x06040001;
|
||||
+ printk("PCIE1 enabled\n");
|
||||
+ }
|
||||
+#endif
|
||||
+#if defined (CONFIG_PCIE_PORT2)
|
||||
+ //PCIe2
|
||||
+ if ((pcie_link_status & 0x4) != 0) {
|
||||
+ RALINK_PCI2_BAR0SETUP_ADDR = 0x7FFF0001; //open 7FFF:2G; ENABLE
|
||||
+ RALINK_PCI2_IMBASEBAR0_ADDR = MEMORY_BASE;
|
||||
+ RALINK_PCI2_CLASS = 0x06040001;
|
||||
+ printk("PCIE2 enabled\n");
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+ switch(pcie_link_status) {
|
||||
+ case 7:
|
||||
+ read_config(0, 2, 0, 0x4, &val);
|
||||
+ write_config(0, 2, 0, 0x4, val|0x4);
|
||||
+ // write_config(0, 1, 0, 0x4, val|0x7);
|
||||
+ case 3:
|
||||
+ case 5:
|
||||
+ case 6:
|
||||
+ read_config(0, 1, 0, 0x4, &val);
|
||||
+ write_config(0, 1, 0, 0x4, val|0x4);
|
||||
+ // write_config(0, 1, 0, 0x4, val|0x7);
|
||||
+ default:
|
||||
+ read_config(0, 0, 0, 0x4, &val);
|
||||
+ write_config(0, 0, 0, 0x4, val|0x4); //bus master enable
|
||||
+ // write_config(0, 0, 0, 0x4, val|0x7); //bus master enable
|
||||
+ }
|
||||
+ register_pci_controller(&rt2880_controller);
|
||||
+ return 0;
|
||||
+
|
||||
+}
|
||||
+arch_initcall(init_rt2880pci);
|
||||
+
|
||||
+int pcibios_plat_dev_init(struct pci_dev *dev)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
|
@ -1,227 +0,0 @@
|
|||
From 158f2deb6349046ee4406578a5d3146ce9870cb3 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 16 Mar 2014 05:24:42 +0000
|
||||
Subject: [PATCH 211/215] watchdog: add MT7621 support
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/watchdog/Kconfig | 7 ++
|
||||
drivers/watchdog/Makefile | 1 +
|
||||
drivers/watchdog/mt7621_wdt.c | 185 +++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 193 insertions(+)
|
||||
create mode 100644 drivers/watchdog/mt7621_wdt.c
|
||||
|
||||
--- a/drivers/watchdog/Kconfig
|
||||
+++ b/drivers/watchdog/Kconfig
|
||||
@@ -1120,6 +1120,13 @@ config RALINK_WDT
|
||||
help
|
||||
Hardware driver for the Ralink SoC Watchdog Timer.
|
||||
|
||||
+config MT7621_WDT
|
||||
+ tristate "Mediatek SoC watchdog"
|
||||
+ select WATCHDOG_CORE
|
||||
+ depends on SOC_MT7621
|
||||
+ help
|
||||
+ Hardware driver for the Ralink SoC Watchdog Timer.
|
||||
+
|
||||
# PARISC Architecture
|
||||
|
||||
# POWERPC Architecture
|
||||
--- a/drivers/watchdog/Makefile
|
||||
+++ b/drivers/watchdog/Makefile
|
||||
@@ -136,6 +136,7 @@ obj-$(CONFIG_OCTEON_WDT) += octeon-wdt.o
|
||||
octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o
|
||||
obj-$(CONFIG_LANTIQ_WDT) += lantiq_wdt.o
|
||||
obj-$(CONFIG_RALINK_WDT) += rt2880_wdt.o
|
||||
+obj-$(CONFIG_MT7621_WDT) += mt7621_wdt.o
|
||||
|
||||
# PARISC Architecture
|
||||
|
||||
--- /dev/null
|
||||
+++ b/drivers/watchdog/mt7621_wdt.c
|
||||
@@ -0,0 +1,185 @@
|
||||
+/*
|
||||
+ * Ralink RT288x/RT3xxx/MT76xx built-in hardware watchdog timer
|
||||
+ *
|
||||
+ * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+ *
|
||||
+ * This driver was based on: drivers/watchdog/softdog.c
|
||||
+ *
|
||||
+ * 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/clk.h>
|
||||
+#include <linux/reset.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/watchdog.h>
|
||||
+#include <linux/miscdevice.h>
|
||||
+#include <linux/moduleparam.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+#include <asm/mach-ralink/ralink_regs.h>
|
||||
+
|
||||
+#define SYSC_RSTSTAT 0x38
|
||||
+#define WDT_RST_CAUSE BIT(1)
|
||||
+
|
||||
+#define RALINK_WDT_TIMEOUT 30
|
||||
+
|
||||
+#define TIMER_REG_TMRSTAT 0x00
|
||||
+#define TIMER_REG_TMR1LOAD 0x24
|
||||
+#define TIMER_REG_TMR1CTL 0x20
|
||||
+
|
||||
+#define TMR1CTL_ENABLE BIT(7)
|
||||
+#define TMR1CTL_RESTART BIT(9)
|
||||
+
|
||||
+static void __iomem *mt762x_wdt_base;
|
||||
+
|
||||
+static bool nowayout = WATCHDOG_NOWAYOUT;
|
||||
+module_param(nowayout, bool, 0);
|
||||
+MODULE_PARM_DESC(nowayout,
|
||||
+ "Watchdog cannot be stopped once started (default="
|
||||
+ __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
|
||||
+
|
||||
+static inline void rt_wdt_w32(unsigned reg, u32 val)
|
||||
+{
|
||||
+ iowrite32(val, mt762x_wdt_base + reg);
|
||||
+}
|
||||
+
|
||||
+static inline u32 rt_wdt_r32(unsigned reg)
|
||||
+{
|
||||
+ return ioread32(mt762x_wdt_base + reg);
|
||||
+}
|
||||
+
|
||||
+static int mt762x_wdt_ping(struct watchdog_device *w)
|
||||
+{
|
||||
+ rt_wdt_w32(TIMER_REG_TMRSTAT, TMR1CTL_RESTART);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt762x_wdt_set_timeout(struct watchdog_device *w, unsigned int t)
|
||||
+{
|
||||
+ w->timeout = t;
|
||||
+ rt_wdt_w32(TIMER_REG_TMR1LOAD, t * 1000);
|
||||
+ mt762x_wdt_ping(w);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt762x_wdt_start(struct watchdog_device *w)
|
||||
+{
|
||||
+ u32 t;
|
||||
+
|
||||
+ rt_wdt_w32(TIMER_REG_TMR1CTL, 1000 << 16);
|
||||
+ mt762x_wdt_set_timeout(w, w->timeout);
|
||||
+
|
||||
+ t = rt_wdt_r32(TIMER_REG_TMR1CTL);
|
||||
+ t |= TMR1CTL_ENABLE;
|
||||
+ rt_wdt_w32(TIMER_REG_TMR1CTL, t);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt762x_wdt_stop(struct watchdog_device *w)
|
||||
+{
|
||||
+ u32 t;
|
||||
+
|
||||
+ mt762x_wdt_ping(w);
|
||||
+
|
||||
+ t = rt_wdt_r32(TIMER_REG_TMR1CTL);
|
||||
+ t &= ~TMR1CTL_ENABLE;
|
||||
+ rt_wdt_w32(TIMER_REG_TMR1CTL, t);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt762x_wdt_bootcause(void)
|
||||
+{
|
||||
+ if (rt_sysc_r32(SYSC_RSTSTAT) & WDT_RST_CAUSE)
|
||||
+ return WDIOF_CARDRESET;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct watchdog_info mt762x_wdt_info = {
|
||||
+ .identity = "Mediatek Watchdog",
|
||||
+ .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
|
||||
+};
|
||||
+
|
||||
+static struct watchdog_ops mt762x_wdt_ops = {
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .start = mt762x_wdt_start,
|
||||
+ .stop = mt762x_wdt_stop,
|
||||
+ .ping = mt762x_wdt_ping,
|
||||
+ .set_timeout = mt762x_wdt_set_timeout,
|
||||
+};
|
||||
+
|
||||
+static struct watchdog_device mt762x_wdt_dev = {
|
||||
+ .info = &mt762x_wdt_info,
|
||||
+ .ops = &mt762x_wdt_ops,
|
||||
+ .min_timeout = 1,
|
||||
+};
|
||||
+
|
||||
+static int mt762x_wdt_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct resource *res;
|
||||
+ int ret;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ mt762x_wdt_base = devm_request_and_ioremap(&pdev->dev, res);
|
||||
+ if (IS_ERR(mt762x_wdt_base))
|
||||
+ return PTR_ERR(mt762x_wdt_base);
|
||||
+
|
||||
+ device_reset(&pdev->dev);
|
||||
+
|
||||
+ mt762x_wdt_dev.dev = &pdev->dev;
|
||||
+ mt762x_wdt_dev.bootstatus = mt762x_wdt_bootcause();
|
||||
+ mt762x_wdt_dev.max_timeout = (0xfffful / 1000);
|
||||
+ mt762x_wdt_dev.timeout = mt762x_wdt_dev.max_timeout;
|
||||
+
|
||||
+ watchdog_set_nowayout(&mt762x_wdt_dev, nowayout);
|
||||
+
|
||||
+ ret = watchdog_register_device(&mt762x_wdt_dev);
|
||||
+ if (!ret)
|
||||
+ dev_info(&pdev->dev, "Initialized\n");
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt762x_wdt_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ watchdog_unregister_device(&mt762x_wdt_dev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void mt762x_wdt_shutdown(struct platform_device *pdev)
|
||||
+{
|
||||
+ mt762x_wdt_stop(&mt762x_wdt_dev);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id mt762x_wdt_match[] = {
|
||||
+ { .compatible = "mtk,mt7621-wdt" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, mt762x_wdt_match);
|
||||
+
|
||||
+static struct platform_driver mt762x_wdt_driver = {
|
||||
+ .probe = mt762x_wdt_probe,
|
||||
+ .remove = mt762x_wdt_remove,
|
||||
+ .shutdown = mt762x_wdt_shutdown,
|
||||
+ .driver = {
|
||||
+ .name = KBUILD_MODNAME,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = mt762x_wdt_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(mt762x_wdt_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("MediaTek MT762x hardware watchdog driver");
|
||||
+MODULE_AUTHOR("John Crispin <blogic@openwrt.org");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
|
|
@ -1,236 +0,0 @@
|
|||
From 2a9b5a9fc1a0707b95dbe61dd1c30b9337cb457d Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 16 Mar 2014 05:26:34 +0000
|
||||
Subject: [PATCH 212/215] GPIO: ralink: add mt7621 gpio controller
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/Kconfig | 5 +-
|
||||
drivers/gpio/Kconfig | 6 ++
|
||||
drivers/gpio/Makefile | 1 +
|
||||
drivers/gpio/gpio-mt7621.c | 183 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 194 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/gpio/gpio-mt7621.c
|
||||
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -448,7 +448,10 @@ config RALINK
|
||||
select ARCH_REQUIRE_GPIOLIB
|
||||
select PINCTRL
|
||||
select PINCTRL_RT2880
|
||||
-
|
||||
+ select ARCH_HAS_RESET_CONTROLLER
|
||||
+ select RESET_CONTROLLER
|
||||
+ select ARCH_REQUIRE_GPIOLIB
|
||||
+
|
||||
config SGI_IP22
|
||||
bool "SGI IP22 (Indy/Indigo2)"
|
||||
select FW_ARC
|
||||
--- a/drivers/gpio/Kconfig
|
||||
+++ b/drivers/gpio/Kconfig
|
||||
@@ -710,6 +710,12 @@ config GPIO_MSIC
|
||||
Enable support for GPIO on intel MSIC controllers found in
|
||||
intel MID devices
|
||||
|
||||
+config GPIO_MT7621
|
||||
+ bool "Mediatek GPIO Support"
|
||||
+ depends on SOC_MT7621
|
||||
+ help
|
||||
+ Say yes here to support the Mediatek SoC GPIO device
|
||||
+
|
||||
comment "USB GPIO expanders:"
|
||||
|
||||
config GPIO_VIPERBOARD
|
||||
--- a/drivers/gpio/Makefile
|
||||
+++ b/drivers/gpio/Makefile
|
||||
@@ -88,3 +88,4 @@ obj-$(CONFIG_GPIO_WM831X) += gpio-wm831x
|
||||
obj-$(CONFIG_GPIO_WM8350) += gpio-wm8350.o
|
||||
obj-$(CONFIG_GPIO_WM8994) += gpio-wm8994.o
|
||||
obj-$(CONFIG_GPIO_XILINX) += gpio-xilinx.o
|
||||
+obj-$(CONFIG_GPIO_MT7621) += gpio-mt7621.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpio/gpio-mt7621.c
|
||||
@@ -0,0 +1,183 @@
|
||||
+/*
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org>
|
||||
+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/gpio.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of_irq.h>
|
||||
+#include <linux/spinlock.h>
|
||||
+#include <linux/irqdomain.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+#define MTK_BANK_WIDTH 32
|
||||
+
|
||||
+enum mediatek_gpio_reg {
|
||||
+ GPIO_REG_CTRL = 0,
|
||||
+ GPIO_REG_POL,
|
||||
+ GPIO_REG_DATA,
|
||||
+ GPIO_REG_DSET,
|
||||
+ GPIO_REG_DCLR,
|
||||
+};
|
||||
+
|
||||
+static void __iomem *mtk_gc_membase;
|
||||
+
|
||||
+struct mtk_gc {
|
||||
+ struct gpio_chip chip;
|
||||
+ spinlock_t lock;
|
||||
+ int bank;
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+gpio_to_irq(unsigned gpio)
|
||||
+{
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+static inline struct mtk_gc
|
||||
+*to_mediatek_gpio(struct gpio_chip *chip)
|
||||
+{
|
||||
+ struct mtk_gc *mgc;
|
||||
+
|
||||
+ mgc = container_of(chip, struct mtk_gc, chip);
|
||||
+
|
||||
+ return mgc;
|
||||
+}
|
||||
+
|
||||
+static inline void
|
||||
+mtk_gpio_w32(struct mtk_gc *rg, u8 reg, u32 val)
|
||||
+{
|
||||
+ iowrite32(val, mtk_gc_membase + (reg * 0x10) + (rg->bank * 0x4));
|
||||
+}
|
||||
+
|
||||
+static inline u32
|
||||
+mtk_gpio_r32(struct mtk_gc *rg, u8 reg)
|
||||
+{
|
||||
+ return ioread32(mtk_gc_membase + (reg * 0x10) + (rg->bank * 0x4));
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+mediatek_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
+{
|
||||
+ struct mtk_gc *rg = to_mediatek_gpio(chip);
|
||||
+
|
||||
+ mtk_gpio_w32(rg, (value) ? GPIO_REG_DSET : GPIO_REG_DCLR, BIT(offset));
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+mediatek_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||
+{
|
||||
+ struct mtk_gc *rg = to_mediatek_gpio(chip);
|
||||
+
|
||||
+ return !!(mtk_gpio_r32(rg, GPIO_REG_DATA) & BIT(offset));
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+mediatek_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
|
||||
+{
|
||||
+ struct mtk_gc *rg = to_mediatek_gpio(chip);
|
||||
+ unsigned long flags;
|
||||
+ u32 t;
|
||||
+
|
||||
+ spin_lock_irqsave(&rg->lock, flags);
|
||||
+ t = mtk_gpio_r32(rg, GPIO_REG_CTRL);
|
||||
+ t &= ~BIT(offset);
|
||||
+ mtk_gpio_w32(rg, GPIO_REG_CTRL, t);
|
||||
+ spin_unlock_irqrestore(&rg->lock, flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+mediatek_gpio_direction_output(struct gpio_chip *chip,
|
||||
+ unsigned offset, int value)
|
||||
+{
|
||||
+ struct mtk_gc *rg = to_mediatek_gpio(chip);
|
||||
+ unsigned long flags;
|
||||
+ u32 t;
|
||||
+
|
||||
+ spin_lock_irqsave(&rg->lock, flags);
|
||||
+ t = mtk_gpio_r32(rg, GPIO_REG_CTRL);
|
||||
+ t |= BIT(offset);
|
||||
+ mtk_gpio_w32(rg, GPIO_REG_CTRL, t);
|
||||
+ mediatek_gpio_set(chip, offset, value);
|
||||
+ spin_unlock_irqrestore(&rg->lock, flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+mediatek_gpio_bank_probe(struct platform_device *pdev, struct device_node *bank)
|
||||
+{
|
||||
+ const __be32 *id = of_get_property(bank, "reg", NULL);
|
||||
+ struct mtk_gc *rg = devm_kzalloc(&pdev->dev,
|
||||
+ sizeof(struct mtk_gc), GFP_KERNEL);
|
||||
+ if (!rg || !id)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ spin_lock_init(&rg->lock);
|
||||
+
|
||||
+ rg->chip.dev = &pdev->dev;
|
||||
+ rg->chip.label = dev_name(&pdev->dev);
|
||||
+ rg->chip.of_node = bank;
|
||||
+ rg->chip.base = MTK_BANK_WIDTH * be32_to_cpu(*id);
|
||||
+ rg->chip.ngpio = MTK_BANK_WIDTH;
|
||||
+ rg->chip.direction_input = mediatek_gpio_direction_input;
|
||||
+ rg->chip.direction_output = mediatek_gpio_direction_output;
|
||||
+ rg->chip.get = mediatek_gpio_get;
|
||||
+ rg->chip.set = mediatek_gpio_set;
|
||||
+
|
||||
+ /* set polarity to low for all gpios */
|
||||
+ mtk_gpio_w32(rg, GPIO_REG_POL, 0);
|
||||
+
|
||||
+ dev_info(&pdev->dev, "registering %d gpios\n", rg->chip.ngpio);
|
||||
+
|
||||
+ return gpiochip_add(&rg->chip);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+mediatek_gpio_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *bank, *np = pdev->dev.of_node;
|
||||
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+
|
||||
+ mtk_gc_membase = devm_request_and_ioremap(&pdev->dev, res);
|
||||
+ if (IS_ERR(mtk_gc_membase))
|
||||
+ return PTR_ERR(mtk_gc_membase);
|
||||
+
|
||||
+ for_each_child_of_node(np, bank)
|
||||
+ if (of_device_is_compatible(bank, "mtk,mt7621-gpio-bank"))
|
||||
+ mediatek_gpio_bank_probe(pdev, bank);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id mediatek_gpio_match[] = {
|
||||
+ { .compatible = "mtk,mt7621-gpio" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, mediatek_gpio_match);
|
||||
+
|
||||
+static struct platform_driver mediatek_gpio_driver = {
|
||||
+ .probe = mediatek_gpio_probe,
|
||||
+ .driver = {
|
||||
+ .name = "mt7621_gpio",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = mediatek_gpio_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init
|
||||
+mediatek_gpio_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&mediatek_gpio_driver);
|
||||
+}
|
||||
+
|
||||
+subsys_initcall(mediatek_gpio_init);
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,346 +0,0 @@
|
|||
From 1a961f146e65e2716dbe9065baa4c0931fcb6b3e Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Sun, 16 Mar 2014 05:34:11 +0000
|
||||
Subject: [PATCH 215/215] SPI: ralink: add mt7621 support
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
drivers/spi/spi-rt2880.c | 218 +++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 205 insertions(+), 13 deletions(-)
|
||||
|
||||
--- a/drivers/spi/spi-rt2880.c
|
||||
+++ b/drivers/spi/spi-rt2880.c
|
||||
@@ -21,8 +21,13 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/spi/spi.h>
|
||||
+#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
+#include <ralink_regs.h>
|
||||
+
|
||||
+#define SPI_BPW_MASK(bits) BIT((bits) - 1)
|
||||
+
|
||||
#define DRIVER_NAME "spi-rt2880"
|
||||
/* only one slave is supported*/
|
||||
#define RALINK_NUM_CHIPSELECTS 1
|
||||
@@ -63,6 +68,25 @@
|
||||
/* SPIFIFOSTAT register bit field */
|
||||
#define SPIFIFOSTAT_TXFULL BIT(17)
|
||||
|
||||
+#define MT7621_SPI_TRANS 0x00
|
||||
+#define SPITRANS_BUSY BIT(16)
|
||||
+#define MT7621_SPI_OPCODE 0x04
|
||||
+#define MT7621_SPI_DATA0 0x08
|
||||
+#define SPI_CTL_TX_RX_CNT_MASK 0xff
|
||||
+#define SPI_CTL_START BIT(8)
|
||||
+#define MT7621_SPI_POLAR 0x38
|
||||
+#define MT7621_SPI_MASTER 0x28
|
||||
+#define MT7621_SPI_SPACE 0x3c
|
||||
+
|
||||
+struct rt2880_spi;
|
||||
+
|
||||
+struct rt2880_spi_ops {
|
||||
+ void (*init_hw)(struct rt2880_spi *rs);
|
||||
+ void (*set_cs)(struct rt2880_spi *rs, int enable);
|
||||
+ int (*baudrate_set)(struct spi_device *spi, unsigned int speed);
|
||||
+ unsigned int (*write_read)(struct spi_device *spi, struct list_head *list, struct spi_transfer *xfer);
|
||||
+};
|
||||
+
|
||||
struct rt2880_spi {
|
||||
struct spi_master *master;
|
||||
void __iomem *base;
|
||||
@@ -70,6 +94,8 @@ struct rt2880_spi {
|
||||
unsigned int speed;
|
||||
struct clk *clk;
|
||||
spinlock_t lock;
|
||||
+
|
||||
+ struct rt2880_spi_ops *ops;
|
||||
};
|
||||
|
||||
static inline struct rt2880_spi *spidev_to_rt2880_spi(struct spi_device *spi)
|
||||
@@ -149,6 +175,17 @@ static int rt2880_spi_baudrate_set(struc
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int mt7621_spi_baudrate_set(struct spi_device *spi, unsigned int speed)
|
||||
+{
|
||||
+/* u32 master = rt2880_spi_read(rs, MT7621_SPI_MASTER);
|
||||
+
|
||||
+ // set default clock to hclk/5
|
||||
+ master &= ~(0xfff << 16);
|
||||
+ master |= 0x3 << 16;
|
||||
+*/
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* called only when no transfer is active on the bus
|
||||
*/
|
||||
@@ -164,7 +201,7 @@ rt2880_spi_setup_transfer(struct spi_dev
|
||||
|
||||
if (rs->speed != speed) {
|
||||
dev_dbg(&spi->dev, "speed_hz:%u\n", speed);
|
||||
- rc = rt2880_spi_baudrate_set(spi, speed);
|
||||
+ rc = rs->ops->baudrate_set(spi, speed);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
@@ -180,6 +217,17 @@ static void rt2880_spi_set_cs(struct rt2
|
||||
rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_SPIENA);
|
||||
}
|
||||
|
||||
+static void mt7621_spi_set_cs(struct rt2880_spi *rs, int enable)
|
||||
+{
|
||||
+ u32 polar = rt2880_spi_read(rs, MT7621_SPI_POLAR);
|
||||
+
|
||||
+ if (enable)
|
||||
+ polar |= 1;
|
||||
+ else
|
||||
+ polar &= ~1;
|
||||
+ rt2880_spi_write(rs, MT7621_SPI_POLAR, polar);
|
||||
+}
|
||||
+
|
||||
static inline int rt2880_spi_wait_till_ready(struct rt2880_spi *rs)
|
||||
{
|
||||
int i;
|
||||
@@ -198,8 +246,26 @@ static inline int rt2880_spi_wait_till_r
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
+static inline int mt7621_spi_wait_till_ready(struct rt2880_spi *rs)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < RALINK_SPI_WAIT_MAX_LOOP; i++) {
|
||||
+ u32 status;
|
||||
+
|
||||
+ status = rt2880_spi_read(rs, MT7621_SPI_TRANS);
|
||||
+ if ((status & SPITRANS_BUSY) == 0) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ cpu_relax();
|
||||
+ udelay(1);
|
||||
+ }
|
||||
+
|
||||
+ return -ETIMEDOUT;
|
||||
+}
|
||||
+
|
||||
static unsigned int
|
||||
-rt2880_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
|
||||
+rt2880_spi_write_read(struct spi_device *spi, struct list_head *list, struct spi_transfer *xfer)
|
||||
{
|
||||
struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
unsigned count = 0;
|
||||
@@ -239,6 +305,100 @@ out:
|
||||
return count;
|
||||
}
|
||||
|
||||
+static unsigned int
|
||||
+mt7621_spi_write_read(struct spi_device *spi, struct list_head *list, struct spi_transfer *xfer)
|
||||
+{
|
||||
+ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
+ struct spi_transfer *next = NULL;
|
||||
+ const u8 *tx = xfer->tx_buf;
|
||||
+ u8 *rx = NULL;
|
||||
+ u32 trans;
|
||||
+ int len = xfer->len;
|
||||
+
|
||||
+ if (!tx)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (!list_is_last(&xfer->transfer_list, list)) {
|
||||
+ next = list_entry(xfer->transfer_list.next, struct spi_transfer, transfer_list);
|
||||
+ rx = next->rx_buf;
|
||||
+ }
|
||||
+
|
||||
+ trans = rt2880_spi_read(rs, MT7621_SPI_TRANS);
|
||||
+ trans &= ~SPI_CTL_TX_RX_CNT_MASK;
|
||||
+
|
||||
+ if (tx) {
|
||||
+ u32 data0 = 0, opcode = 0;
|
||||
+
|
||||
+ switch (xfer->len) {
|
||||
+ case 8:
|
||||
+ data0 |= tx[7] << 24;
|
||||
+ case 7:
|
||||
+ data0 |= tx[6] << 16;
|
||||
+ case 6:
|
||||
+ data0 |= tx[5] << 8;
|
||||
+ case 5:
|
||||
+ data0 |= tx[4];
|
||||
+ case 4:
|
||||
+ opcode |= tx[3] << 8;
|
||||
+ case 3:
|
||||
+ opcode |= tx[2] << 16;
|
||||
+ case 2:
|
||||
+ opcode |= tx[1] << 24;
|
||||
+ case 1:
|
||||
+ opcode |= tx[0];
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ dev_err(&spi->dev, "trying to write too many bytes: %d\n", next->len);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ rt2880_spi_write(rs, MT7621_SPI_DATA0, data0);
|
||||
+ rt2880_spi_write(rs, MT7621_SPI_OPCODE, opcode);
|
||||
+ trans |= xfer->len;
|
||||
+ }
|
||||
+
|
||||
+ if (rx)
|
||||
+ trans |= (next->len << 4);
|
||||
+ rt2880_spi_write(rs, MT7621_SPI_TRANS, trans);
|
||||
+ trans |= SPI_CTL_START;
|
||||
+ rt2880_spi_write(rs, MT7621_SPI_TRANS, trans);
|
||||
+
|
||||
+ mt7621_spi_wait_till_ready(rs);
|
||||
+
|
||||
+ if (rx) {
|
||||
+ u32 data0 = rt2880_spi_read(rs, MT7621_SPI_DATA0);
|
||||
+ u32 opcode = rt2880_spi_read(rs, MT7621_SPI_OPCODE);
|
||||
+
|
||||
+ switch (next->len) {
|
||||
+ case 8:
|
||||
+ rx[7] = (opcode >> 24) & 0xff;
|
||||
+ case 7:
|
||||
+ rx[6] = (opcode >> 16) & 0xff;
|
||||
+ case 6:
|
||||
+ rx[5] = (opcode >> 8) & 0xff;
|
||||
+ case 5:
|
||||
+ rx[4] = opcode & 0xff;
|
||||
+ case 4:
|
||||
+ rx[3] = (data0 >> 24) & 0xff;
|
||||
+ case 3:
|
||||
+ rx[2] = (data0 >> 16) & 0xff;
|
||||
+ case 2:
|
||||
+ rx[1] = (data0 >> 8) & 0xff;
|
||||
+ case 1:
|
||||
+ rx[0] = data0 & 0xff;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ dev_err(&spi->dev, "trying to read too many bytes: %d\n", next->len);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ len += next->len;
|
||||
+ }
|
||||
+
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
static int rt2880_spi_transfer_one_message(struct spi_master *master,
|
||||
struct spi_message *m)
|
||||
{
|
||||
@@ -280,25 +440,25 @@ static int rt2880_spi_transfer_one_messa
|
||||
}
|
||||
|
||||
if (!cs_active) {
|
||||
- rt2880_spi_set_cs(rs, 1);
|
||||
+ rs->ops->set_cs(rs, 1);
|
||||
cs_active = 1;
|
||||
}
|
||||
|
||||
if (t->len)
|
||||
- m->actual_length += rt2880_spi_write_read(spi, t);
|
||||
+ m->actual_length += rs->ops->write_read(spi, &m->transfers, t);
|
||||
|
||||
if (t->delay_usecs)
|
||||
udelay(t->delay_usecs);
|
||||
|
||||
if (t->cs_change) {
|
||||
- rt2880_spi_set_cs(rs, 0);
|
||||
+ rs->ops->set_cs(rs, 0);
|
||||
cs_active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
msg_done:
|
||||
if (cs_active)
|
||||
- rt2880_spi_set_cs(rs, 0);
|
||||
+ rs->ops->set_cs(rs, 0);
|
||||
|
||||
m->status = status;
|
||||
spi_finalize_current_message(master);
|
||||
@@ -334,8 +494,41 @@ static void rt2880_spi_reset(struct rt28
|
||||
rt2880_spi_write(rs, RAMIPS_SPI_CTL, SPICTL_HIZSDO | SPICTL_SPIENA);
|
||||
}
|
||||
|
||||
+static void mt7621_spi_reset(struct rt2880_spi *rs)
|
||||
+{
|
||||
+ u32 master = rt2880_spi_read(rs, MT7621_SPI_MASTER);
|
||||
+
|
||||
+ master &= ~(0xfff << 16);
|
||||
+ master |= 3 << 16;
|
||||
+
|
||||
+ master |= 7 << 29;
|
||||
+ rt2880_spi_write(rs, MT7621_SPI_MASTER, master);
|
||||
+}
|
||||
+
|
||||
+static struct rt2880_spi_ops spi_ops[] = {
|
||||
+ {
|
||||
+ .init_hw = rt2880_spi_reset,
|
||||
+ .set_cs = rt2880_spi_set_cs,
|
||||
+ .baudrate_set = rt2880_spi_baudrate_set,
|
||||
+ .write_read = rt2880_spi_write_read,
|
||||
+ }, {
|
||||
+ .init_hw = mt7621_spi_reset,
|
||||
+ .set_cs = mt7621_spi_set_cs,
|
||||
+ .baudrate_set = mt7621_spi_baudrate_set,
|
||||
+ .write_read = mt7621_spi_write_read,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static const struct of_device_id rt2880_spi_match[] = {
|
||||
+ { .compatible = "ralink,rt2880-spi", .data = &spi_ops[0]},
|
||||
+ { .compatible = "ralink,mt7621-spi", .data = &spi_ops[1] },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rt2880_spi_match);
|
||||
+
|
||||
static int rt2880_spi_probe(struct platform_device *pdev)
|
||||
{
|
||||
+ const struct of_device_id *match;
|
||||
struct spi_master *master;
|
||||
struct rt2880_spi *rs;
|
||||
unsigned long flags;
|
||||
@@ -344,6 +537,10 @@ static int rt2880_spi_probe(struct platf
|
||||
int status = 0;
|
||||
struct clk *clk;
|
||||
|
||||
+ match = of_match_device(rt2880_spi_match, &pdev->dev);
|
||||
+ if (!match)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
base = devm_ioremap_resource(&pdev->dev, r);
|
||||
if (IS_ERR(base))
|
||||
@@ -382,12 +579,13 @@ static int rt2880_spi_probe(struct platf
|
||||
rs->clk = clk;
|
||||
rs->master = master;
|
||||
rs->sys_freq = clk_get_rate(rs->clk);
|
||||
+ rs->ops = (struct rt2880_spi_ops *) match->data;
|
||||
dev_dbg(&pdev->dev, "sys_freq: %u\n", rs->sys_freq);
|
||||
spin_lock_irqsave(&rs->lock, flags);
|
||||
|
||||
device_reset(&pdev->dev);
|
||||
|
||||
- rt2880_spi_reset(rs);
|
||||
+ rs->ops->init_hw(rs);
|
||||
|
||||
return spi_register_master(master);
|
||||
}
|
||||
@@ -408,12 +606,6 @@ static int rt2880_spi_remove(struct plat
|
||||
|
||||
MODULE_ALIAS("platform:" DRIVER_NAME);
|
||||
|
||||
-static const struct of_device_id rt2880_spi_match[] = {
|
||||
- { .compatible = "ralink,rt2880-spi" },
|
||||
- {},
|
||||
-};
|
||||
-MODULE_DEVICE_TABLE(of, rt2880_spi_match);
|
||||
-
|
||||
static struct platform_driver rt2880_spi_driver = {
|
||||
.driver = {
|
||||
.name = DRIVER_NAME,
|
File diff suppressed because it is too large
Load diff
|
@ -1,86 +0,0 @@
|
|||
--- a/arch/mips/ralink/rt288x.c
|
||||
+++ b/arch/mips/ralink/rt288x.c
|
||||
@@ -17,46 +17,27 @@
|
||||
#include <asm/mipsregs.h>
|
||||
#include <asm/mach-ralink/ralink_regs.h>
|
||||
#include <asm/mach-ralink/rt288x.h>
|
||||
+#include <asm/mach-ralink/pinmux.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
-static struct ralink_pinmux_grp mode_mux[] = {
|
||||
- {
|
||||
- .name = "i2c",
|
||||
- .mask = RT2880_GPIO_MODE_I2C,
|
||||
- .gpio_first = 1,
|
||||
- .gpio_last = 2,
|
||||
- }, {
|
||||
- .name = "spi",
|
||||
- .mask = RT2880_GPIO_MODE_SPI,
|
||||
- .gpio_first = 3,
|
||||
- .gpio_last = 6,
|
||||
- }, {
|
||||
- .name = "uartlite",
|
||||
- .mask = RT2880_GPIO_MODE_UART0,
|
||||
- .gpio_first = 7,
|
||||
- .gpio_last = 14,
|
||||
- }, {
|
||||
- .name = "jtag",
|
||||
- .mask = RT2880_GPIO_MODE_JTAG,
|
||||
- .gpio_first = 17,
|
||||
- .gpio_last = 21,
|
||||
- }, {
|
||||
- .name = "mdio",
|
||||
- .mask = RT2880_GPIO_MODE_MDIO,
|
||||
- .gpio_first = 22,
|
||||
- .gpio_last = 23,
|
||||
- }, {
|
||||
- .name = "sdram",
|
||||
- .mask = RT2880_GPIO_MODE_SDRAM,
|
||||
- .gpio_first = 24,
|
||||
- .gpio_last = 39,
|
||||
- }, {
|
||||
- .name = "pci",
|
||||
- .mask = RT2880_GPIO_MODE_PCI,
|
||||
- .gpio_first = 40,
|
||||
- .gpio_last = 71,
|
||||
- }, {0}
|
||||
+static struct rt2880_pmx_func i2c_func[] = { FUNC("i2c", 0, 1, 2) };
|
||||
+static struct rt2880_pmx_func spi_func[] = { FUNC("spi", 0, 3, 4) };
|
||||
+static struct rt2880_pmx_func uartlite_func[] = { FUNC("uartlite", 0, 7, 8) };
|
||||
+static struct rt2880_pmx_func jtag_func[] = { FUNC("jtag", 0, 17, 5) };
|
||||
+static struct rt2880_pmx_func mdio_func[] = { FUNC("mdio", 0, 22, 2) };
|
||||
+static struct rt2880_pmx_func sdram_func[] = { FUNC("sdram", 0, 24, 16) };
|
||||
+static struct rt2880_pmx_func pci_func[] = { FUNC("pci", 0, 40, 32) };
|
||||
+
|
||||
+static struct rt2880_pmx_group rt2880_pinmux_data_act[] = {
|
||||
+ GRP("i2c", i2c_func, 1, RT2880_GPIO_MODE_I2C),
|
||||
+ GRP("spi", spi_func, 1, RT2880_GPIO_MODE_SPI),
|
||||
+ GRP("uartlite", uartlite_func, 1, RT2880_GPIO_MODE_UART0),
|
||||
+ GRP("jtag", jtag_func, 1, RT2880_GPIO_MODE_JTAG),
|
||||
+ GRP("mdio", mdio_func, 1, RT2880_GPIO_MODE_MDIO),
|
||||
+ GRP("sdram", sdram_func, 1, RT2880_GPIO_MODE_SDRAM),
|
||||
+ GRP("pci", pci_func, 1, RT2880_GPIO_MODE_PCI),
|
||||
+ { 0 }
|
||||
};
|
||||
|
||||
static void rt288x_wdt_reset(void)
|
||||
@@ -69,11 +50,6 @@ static void rt288x_wdt_reset(void)
|
||||
rt_sysc_w32(t, SYSC_REG_CLKCFG);
|
||||
}
|
||||
|
||||
-struct ralink_pinmux rt_gpio_pinmux = {
|
||||
- .mode = mode_mux,
|
||||
- .wdt_reset = rt288x_wdt_reset,
|
||||
-};
|
||||
-
|
||||
void __init ralink_clk_init(void)
|
||||
{
|
||||
unsigned long cpu_rate;
|
||||
@@ -140,4 +116,6 @@ void prom_soc_init(struct ralink_soc_inf
|
||||
soc_info->mem_base = RT2880_SDRAM_BASE;
|
||||
soc_info->mem_size_min = RT2880_MEM_SIZE_MIN;
|
||||
soc_info->mem_size_max = RT2880_MEM_SIZE_MAX;
|
||||
+
|
||||
+ rt2880_pinmux_data = rt2880_pinmux_data_act;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
--- a/arch/mips/ralink/rt288x.c
|
||||
+++ b/arch/mips/ralink/rt288x.c
|
||||
@@ -52,7 +52,7 @@ static void rt288x_wdt_reset(void)
|
||||
|
||||
void __init ralink_clk_init(void)
|
||||
{
|
||||
- unsigned long cpu_rate;
|
||||
+ unsigned long cpu_rate, wmac_rate = 40000000;
|
||||
u32 t = rt_sysc_r32(SYSC_REG_SYSTEM_CONFIG);
|
||||
t = ((t >> SYSTEM_CONFIG_CPUCLK_SHIFT) & SYSTEM_CONFIG_CPUCLK_MASK);
|
||||
|
||||
@@ -77,6 +77,7 @@ void __init ralink_clk_init(void)
|
||||
ralink_clk_add("300500.uart", cpu_rate / 2);
|
||||
ralink_clk_add("300c00.uartlite", cpu_rate / 2);
|
||||
ralink_clk_add("400000.ethernet", cpu_rate / 2);
|
||||
+ ralink_clk_add("480000.wmac", wmac_rate);
|
||||
}
|
||||
|
||||
void __init ralink_of_remap(void)
|
|
@ -1,22 +0,0 @@
|
|||
Index: linux-3.10.34/drivers/net/ethernet/ralink/mdio_rt2880.c
|
||||
===================================================================
|
||||
--- linux-3.10.34.orig/drivers/net/ethernet/ralink/mdio_rt2880.c
|
||||
+++ linux-3.10.34/drivers/net/ethernet/ralink/mdio_rt2880.c
|
||||
@@ -136,7 +136,7 @@ int rt2880_mdio_read(struct mii_bus *bus
|
||||
if (err)
|
||||
return 0xffff;
|
||||
|
||||
- pr_info("%s: addr=%04x, reg=%04x, value=%04x\n", __func__,
|
||||
+ pr_debug("%s: addr=%04x, reg=%04x, value=%04x\n", __func__,
|
||||
phy_addr, phy_reg, fe_r32(FE_MDIO_ACCESS) & 0xffff);
|
||||
|
||||
return fe_r32(FE_MDIO_ACCESS) & 0xffff;
|
||||
@@ -148,7 +148,7 @@ int rt2880_mdio_write(struct mii_bus *bu
|
||||
int err;
|
||||
u32 t;
|
||||
|
||||
- pr_info("%s: addr=%04x, reg=%04x, value=%04x\n", __func__,
|
||||
+ pr_debug("%s: addr=%04x, reg=%04x, value=%04x\n", __func__,
|
||||
phy_addr, phy_reg, fe_r32(FE_MDIO_ACCESS) & 0xffff);
|
||||
|
||||
err = rt2880_mdio_wait_ready(priv);
|
|
@ -1,31 +0,0 @@
|
|||
--- a/arch/mips/include/asm/mach-ralink/rt305x.h
|
||||
+++ b/arch/mips/include/asm/mach-ralink/rt305x.h
|
||||
@@ -145,6 +145,7 @@ static inline int soc_is_rt5350(void)
|
||||
#define RT305X_GPIO_MODE_SDRAM 8
|
||||
#define RT305X_GPIO_MODE_RGMII 9
|
||||
#define RT5350_GPIO_MODE_PHY_LED 14
|
||||
+#define RT5350_GPIO_MODE_SPI_CS1 21
|
||||
#define RT3352_GPIO_MODE_LNA 18
|
||||
#define RT3352_GPIO_MODE_PA 20
|
||||
|
||||
--- a/arch/mips/ralink/rt305x.c
|
||||
+++ b/arch/mips/ralink/rt305x.c
|
||||
@@ -38,6 +38,10 @@ static struct rt2880_pmx_func uartlite_f
|
||||
static struct rt2880_pmx_func jtag_func[] = { FUNC("jtag", 0, 17, 5) };
|
||||
static struct rt2880_pmx_func mdio_func[] = { FUNC("mdio", 0, 22, 2) };
|
||||
static struct rt2880_pmx_func rt5350_led_func[] = { FUNC("led", 0, 22, 5) };
|
||||
+static struct rt2880_pmx_func rt5350_cs1_func[] = {
|
||||
+ FUNC("spi_cs1", 0, 27, 1),
|
||||
+ FUNC("wdg_cs1", 1, 27, 1),
|
||||
+};
|
||||
static struct rt2880_pmx_func sdram_func[] = { FUNC("sdram", 0, 24, 16) };
|
||||
static struct rt2880_pmx_func rt3352_rgmii_func[] = { FUNC("rgmii", 0, 24, 12) };
|
||||
static struct rt2880_pmx_func rgmii_func[] = { FUNC("rgmii", 0, 40, 12) };
|
||||
@@ -81,6 +85,7 @@ static struct rt2880_pmx_group rt5350_pi
|
||||
GRP("uartlite", uartlite_func, 1, RT305X_GPIO_MODE_UART1),
|
||||
GRP("jtag", jtag_func, 1, RT305X_GPIO_MODE_JTAG),
|
||||
GRP("led", rt5350_led_func, 1, RT5350_GPIO_MODE_PHY_LED),
|
||||
+ GRP("spi_cs1", rt5350_cs1_func, 2, RT5350_GPIO_MODE_SPI_CS1),
|
||||
{ 0 }
|
||||
};
|
||||
|
|
@ -1,368 +0,0 @@
|
|||
--- a/drivers/spi/spi-rt2880.c
|
||||
+++ b/drivers/spi/spi-rt2880.c
|
||||
@@ -29,16 +29,17 @@
|
||||
#define SPI_BPW_MASK(bits) BIT((bits) - 1)
|
||||
|
||||
#define DRIVER_NAME "spi-rt2880"
|
||||
-/* only one slave is supported*/
|
||||
-#define RALINK_NUM_CHIPSELECTS 1
|
||||
/* in usec */
|
||||
#define RALINK_SPI_WAIT_MAX_LOOP 2000
|
||||
|
||||
-#define RAMIPS_SPI_STAT 0x00
|
||||
-#define RAMIPS_SPI_CFG 0x10
|
||||
-#define RAMIPS_SPI_CTL 0x14
|
||||
-#define RAMIPS_SPI_DATA 0x20
|
||||
-#define RAMIPS_SPI_FIFO_STAT 0x38
|
||||
+#define RAMIPS_SPI_DEV_OFFSET 0x40
|
||||
+
|
||||
+#define RAMIPS_SPI_STAT(cs) (0x00 + (cs * RAMIPS_SPI_DEV_OFFSET))
|
||||
+#define RAMIPS_SPI_CFG(cs) (0x10 + (cs * RAMIPS_SPI_DEV_OFFSET))
|
||||
+#define RAMIPS_SPI_CTL(cs) (0x14 + (cs * RAMIPS_SPI_DEV_OFFSET))
|
||||
+#define RAMIPS_SPI_DATA(cs) (0x20 + (cs * RAMIPS_SPI_DEV_OFFSET))
|
||||
+#define RAMIPS_SPI_FIFO_STAT(cs) (0x38 + (cs * RAMIPS_SPI_DEV_OFFSET))
|
||||
+#define RAMIPS_SPI_ARBITER 0xF0
|
||||
|
||||
/* SPISTAT register bit field */
|
||||
#define SPISTAT_BUSY BIT(0)
|
||||
@@ -68,6 +69,10 @@
|
||||
/* SPIFIFOSTAT register bit field */
|
||||
#define SPIFIFOSTAT_TXFULL BIT(17)
|
||||
|
||||
+#define SPICTL_ARB_EN BIT(31)
|
||||
+#define SPI1_POR BIT(1)
|
||||
+#define SPI0_POR BIT(0)
|
||||
+
|
||||
#define MT7621_SPI_TRANS 0x00
|
||||
#define SPITRANS_BUSY BIT(16)
|
||||
#define MT7621_SPI_OPCODE 0x04
|
||||
@@ -78,13 +83,16 @@
|
||||
#define MT7621_SPI_MASTER 0x28
|
||||
#define MT7621_SPI_SPACE 0x3c
|
||||
|
||||
+#define RT2880_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | SPI_CS_HIGH)
|
||||
+
|
||||
struct rt2880_spi;
|
||||
|
||||
struct rt2880_spi_ops {
|
||||
void (*init_hw)(struct rt2880_spi *rs);
|
||||
- void (*set_cs)(struct rt2880_spi *rs, int enable);
|
||||
+ void (*set_cs)(struct spi_device *spi, int enable);
|
||||
int (*baudrate_set)(struct spi_device *spi, unsigned int speed);
|
||||
unsigned int (*write_read)(struct spi_device *spi, struct list_head *list, struct spi_transfer *xfer);
|
||||
+ int num_cs;
|
||||
};
|
||||
|
||||
struct rt2880_spi {
|
||||
@@ -141,6 +149,7 @@ static inline void rt2880_spi_clrbits(st
|
||||
|
||||
static int rt2880_spi_baudrate_set(struct spi_device *spi, unsigned int speed)
|
||||
{
|
||||
+ int cs = spi->chip_select;
|
||||
struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
u32 rate;
|
||||
u32 prescale;
|
||||
@@ -168,9 +177,9 @@ static int rt2880_spi_baudrate_set(struc
|
||||
prescale = ilog2(rate / 2);
|
||||
dev_dbg(&spi->dev, "prescale:%u\n", prescale);
|
||||
|
||||
- reg = rt2880_spi_read(rs, RAMIPS_SPI_CFG);
|
||||
+ reg = rt2880_spi_read(rs, RAMIPS_SPI_CFG(cs));
|
||||
reg = ((reg & ~SPICFG_SPICLK_PRESCALE_MASK) | prescale);
|
||||
- rt2880_spi_write(rs, RAMIPS_SPI_CFG, reg);
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_CFG(cs), reg);
|
||||
rs->speed = speed;
|
||||
return 0;
|
||||
}
|
||||
@@ -194,7 +203,8 @@ rt2880_spi_setup_transfer(struct spi_dev
|
||||
{
|
||||
struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
unsigned int speed = spi->max_speed_hz;
|
||||
- int rc;
|
||||
+ int rc, cs = spi->chip_select;
|
||||
+ u32 reg;
|
||||
|
||||
if ((t != NULL) && t->speed_hz)
|
||||
speed = t->speed_hz;
|
||||
@@ -206,19 +216,61 @@ rt2880_spi_setup_transfer(struct spi_dev
|
||||
return rc;
|
||||
}
|
||||
|
||||
+ reg = rt2880_spi_read(rs, RAMIPS_SPI_CFG(cs));
|
||||
+
|
||||
+ reg = (reg & ~SPICFG_MSBFIRST);
|
||||
+ if (!(spi->mode & SPI_LSB_FIRST))
|
||||
+ reg |= SPICFG_MSBFIRST;
|
||||
+
|
||||
+ reg = (reg & ~(SPICFG_SPICLKPOL | SPICFG_RXCLKEDGE_FALLING |SPICFG_TXCLKEDGE_FALLING));
|
||||
+ switch(spi->mode & (SPI_CPOL | SPI_CPHA)) {
|
||||
+ case SPI_MODE_0:
|
||||
+ reg |= SPICFG_SPICLKPOL | SPICFG_TXCLKEDGE_FALLING;
|
||||
+ break;
|
||||
+ case SPI_MODE_1:
|
||||
+ reg |= SPICFG_SPICLKPOL | SPICFG_RXCLKEDGE_FALLING;
|
||||
+ break;
|
||||
+ case SPI_MODE_2:
|
||||
+ reg |= SPICFG_RXCLKEDGE_FALLING;
|
||||
+ break;
|
||||
+ case SPI_MODE_3:
|
||||
+ reg |= SPICFG_TXCLKEDGE_FALLING;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_CFG(cs), reg);
|
||||
+
|
||||
+ reg = SPICTL_ARB_EN;
|
||||
+ if (spi->mode & SPI_CS_HIGH) {
|
||||
+ switch(cs) {
|
||||
+ case 0:
|
||||
+ reg |= SPI0_POR;
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ reg |= SPI1_POR;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_ARBITER, reg);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void rt2880_spi_set_cs(struct rt2880_spi *rs, int enable)
|
||||
+static void rt2880_spi_set_cs(struct spi_device *spi, int enable)
|
||||
{
|
||||
+ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
+ int cs = spi->chip_select;
|
||||
+
|
||||
if (enable)
|
||||
- rt2880_spi_clrbits(rs, RAMIPS_SPI_CTL, SPICTL_SPIENA);
|
||||
+ rt2880_spi_clrbits(rs, RAMIPS_SPI_CTL(cs), SPICTL_SPIENA);
|
||||
else
|
||||
- rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_SPIENA);
|
||||
+ rt2880_spi_setbits(rs, RAMIPS_SPI_CTL(cs), SPICTL_SPIENA);
|
||||
}
|
||||
|
||||
-static void mt7621_spi_set_cs(struct rt2880_spi *rs, int enable)
|
||||
+static void mt7621_spi_set_cs(struct spi_device *spi, int enable)
|
||||
{
|
||||
+ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
u32 polar = rt2880_spi_read(rs, MT7621_SPI_POLAR);
|
||||
|
||||
if (enable)
|
||||
@@ -228,14 +280,16 @@ static void mt7621_spi_set_cs(struct rt2
|
||||
rt2880_spi_write(rs, MT7621_SPI_POLAR, polar);
|
||||
}
|
||||
|
||||
-static inline int rt2880_spi_wait_till_ready(struct rt2880_spi *rs)
|
||||
+static inline int rt2880_spi_wait_till_ready(struct spi_device *spi)
|
||||
{
|
||||
+ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
+ int cs = spi->chip_select;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RALINK_SPI_WAIT_MAX_LOOP; i++) {
|
||||
u32 status;
|
||||
|
||||
- status = rt2880_spi_read(rs, RAMIPS_SPI_STAT);
|
||||
+ status = rt2880_spi_read(rs, RAMIPS_SPI_STAT(cs));
|
||||
if ((status & SPISTAT_BUSY) == 0)
|
||||
return 0;
|
||||
|
||||
@@ -246,8 +300,9 @@ static inline int rt2880_spi_wait_till_r
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
-static inline int mt7621_spi_wait_till_ready(struct rt2880_spi *rs)
|
||||
+static inline int mt7621_spi_wait_till_ready(struct spi_device *spi)
|
||||
{
|
||||
+ struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RALINK_SPI_WAIT_MAX_LOOP; i++) {
|
||||
@@ -268,6 +323,7 @@ static unsigned int
|
||||
rt2880_spi_write_read(struct spi_device *spi, struct list_head *list, struct spi_transfer *xfer)
|
||||
{
|
||||
struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
+ int cs = spi->chip_select;
|
||||
unsigned count = 0;
|
||||
u8 *rx = xfer->rx_buf;
|
||||
const u8 *tx = xfer->tx_buf;
|
||||
@@ -279,9 +335,9 @@ rt2880_spi_write_read(struct spi_device
|
||||
|
||||
if (tx) {
|
||||
for (count = 0; count < xfer->len; count++) {
|
||||
- rt2880_spi_write(rs, RAMIPS_SPI_DATA, tx[count]);
|
||||
- rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_STARTWR);
|
||||
- err = rt2880_spi_wait_till_ready(rs);
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_DATA(cs), tx[count]);
|
||||
+ rt2880_spi_setbits(rs, RAMIPS_SPI_CTL(cs), SPICTL_STARTWR);
|
||||
+ err = rt2880_spi_wait_till_ready(spi);
|
||||
if (err) {
|
||||
dev_err(&spi->dev, "TX failed, err=%d\n", err);
|
||||
goto out;
|
||||
@@ -291,13 +347,13 @@ rt2880_spi_write_read(struct spi_device
|
||||
|
||||
if (rx) {
|
||||
for (count = 0; count < xfer->len; count++) {
|
||||
- rt2880_spi_setbits(rs, RAMIPS_SPI_CTL, SPICTL_STARTRD);
|
||||
- err = rt2880_spi_wait_till_ready(rs);
|
||||
+ rt2880_spi_setbits(rs, RAMIPS_SPI_CTL(cs), SPICTL_STARTRD);
|
||||
+ err = rt2880_spi_wait_till_ready(spi);
|
||||
if (err) {
|
||||
dev_err(&spi->dev, "RX failed, err=%d\n", err);
|
||||
goto out;
|
||||
}
|
||||
- rx[count] = (u8) rt2880_spi_read(rs, RAMIPS_SPI_DATA);
|
||||
+ rx[count] = (u8) rt2880_spi_read(rs, RAMIPS_SPI_DATA(cs));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +420,7 @@ mt7621_spi_write_read(struct spi_device
|
||||
trans |= SPI_CTL_START;
|
||||
rt2880_spi_write(rs, MT7621_SPI_TRANS, trans);
|
||||
|
||||
- mt7621_spi_wait_till_ready(rs);
|
||||
+ mt7621_spi_wait_till_ready(spi);
|
||||
|
||||
if (rx) {
|
||||
u32 data0 = rt2880_spi_read(rs, MT7621_SPI_DATA0);
|
||||
@@ -440,7 +496,7 @@ static int rt2880_spi_transfer_one_messa
|
||||
}
|
||||
|
||||
if (!cs_active) {
|
||||
- rs->ops->set_cs(rs, 1);
|
||||
+ rs->ops->set_cs(spi, 1);
|
||||
cs_active = 1;
|
||||
}
|
||||
|
||||
@@ -451,14 +507,14 @@ static int rt2880_spi_transfer_one_messa
|
||||
udelay(t->delay_usecs);
|
||||
|
||||
if (t->cs_change) {
|
||||
- rs->ops->set_cs(rs, 0);
|
||||
+ rs->ops->set_cs(spi, 0);
|
||||
cs_active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
msg_done:
|
||||
if (cs_active)
|
||||
- rs->ops->set_cs(rs, 0);
|
||||
+ rs->ops->set_cs(spi, 0);
|
||||
|
||||
m->status = status;
|
||||
spi_finalize_current_message(master);
|
||||
@@ -471,7 +527,7 @@ static int rt2880_spi_setup(struct spi_d
|
||||
struct rt2880_spi *rs = spidev_to_rt2880_spi(spi);
|
||||
|
||||
if ((spi->max_speed_hz == 0) ||
|
||||
- (spi->max_speed_hz > (rs->sys_freq / 2)))
|
||||
+ (spi->max_speed_hz > (rs->sys_freq / 2)))
|
||||
spi->max_speed_hz = (rs->sys_freq / 2);
|
||||
|
||||
if (spi->max_speed_hz < (rs->sys_freq / 128)) {
|
||||
@@ -488,10 +544,25 @@ static int rt2880_spi_setup(struct spi_d
|
||||
|
||||
static void rt2880_spi_reset(struct rt2880_spi *rs)
|
||||
{
|
||||
- rt2880_spi_write(rs, RAMIPS_SPI_CFG,
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_CFG(0),
|
||||
SPICFG_MSBFIRST | SPICFG_TXCLKEDGE_FALLING |
|
||||
SPICFG_SPICLK_DIV16 | SPICFG_SPICLKPOL);
|
||||
- rt2880_spi_write(rs, RAMIPS_SPI_CTL, SPICTL_HIZSDO | SPICTL_SPIENA);
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_CTL(0), SPICTL_HIZSDO | SPICTL_SPIENA);
|
||||
+}
|
||||
+
|
||||
+static void rt5350_spi_reset(struct rt2880_spi *rs)
|
||||
+{
|
||||
+ int cs;
|
||||
+
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_ARBITER,
|
||||
+ SPICTL_ARB_EN);
|
||||
+
|
||||
+ for (cs = 0; cs < rs->ops->num_cs; cs++) {
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_CFG(cs),
|
||||
+ SPICFG_MSBFIRST | SPICFG_TXCLKEDGE_FALLING |
|
||||
+ SPICFG_SPICLK_DIV16 | SPICFG_SPICLKPOL);
|
||||
+ rt2880_spi_write(rs, RAMIPS_SPI_CTL(cs), SPICTL_HIZSDO | SPICTL_SPIENA);
|
||||
+ }
|
||||
}
|
||||
|
||||
static void mt7621_spi_reset(struct rt2880_spi *rs)
|
||||
@@ -511,24 +582,33 @@ static struct rt2880_spi_ops spi_ops[] =
|
||||
.set_cs = rt2880_spi_set_cs,
|
||||
.baudrate_set = rt2880_spi_baudrate_set,
|
||||
.write_read = rt2880_spi_write_read,
|
||||
+ .num_cs = 1,
|
||||
+ }, {
|
||||
+ .init_hw = rt5350_spi_reset,
|
||||
+ .set_cs = rt2880_spi_set_cs,
|
||||
+ .baudrate_set = rt2880_spi_baudrate_set,
|
||||
+ .write_read = rt2880_spi_write_read,
|
||||
+ .num_cs = 2,
|
||||
}, {
|
||||
.init_hw = mt7621_spi_reset,
|
||||
.set_cs = mt7621_spi_set_cs,
|
||||
.baudrate_set = mt7621_spi_baudrate_set,
|
||||
.write_read = mt7621_spi_write_read,
|
||||
+ .num_cs = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct of_device_id rt2880_spi_match[] = {
|
||||
{ .compatible = "ralink,rt2880-spi", .data = &spi_ops[0]},
|
||||
- { .compatible = "ralink,mt7621-spi", .data = &spi_ops[1] },
|
||||
+ { .compatible = "ralink,rt5350-spi", .data = &spi_ops[1]},
|
||||
+ { .compatible = "ralink,mt7621-spi", .data = &spi_ops[2] },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, rt2880_spi_match);
|
||||
|
||||
static int rt2880_spi_probe(struct platform_device *pdev)
|
||||
{
|
||||
- const struct of_device_id *match;
|
||||
+ const struct of_device_id *match;
|
||||
struct spi_master *master;
|
||||
struct rt2880_spi *rs;
|
||||
unsigned long flags;
|
||||
@@ -536,10 +616,12 @@ static int rt2880_spi_probe(struct platf
|
||||
struct resource *r;
|
||||
int status = 0;
|
||||
struct clk *clk;
|
||||
+ struct rt2880_spi_ops *ops;
|
||||
|
||||
- match = of_match_device(rt2880_spi_match, &pdev->dev);
|
||||
+ match = of_match_device(rt2880_spi_match, &pdev->dev);
|
||||
if (!match)
|
||||
return -EINVAL;
|
||||
+ ops = (struct rt2880_spi_ops *)match->data;
|
||||
|
||||
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
base = devm_ioremap_resource(&pdev->dev, r);
|
||||
@@ -563,14 +645,13 @@ static int rt2880_spi_probe(struct platf
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
- /* we support only mode 0, and no options */
|
||||
- master->mode_bits = 0;
|
||||
+ master->mode_bits = RT2880_SPI_MODE_BITS;
|
||||
|
||||
master->setup = rt2880_spi_setup;
|
||||
master->transfer_one_message = rt2880_spi_transfer_one_message;
|
||||
- master->num_chipselect = RALINK_NUM_CHIPSELECTS;
|
||||
master->bits_per_word_mask = SPI_BPW_MASK(8);
|
||||
master->dev.of_node = pdev->dev.of_node;
|
||||
+ master->num_chipselect = ops->num_cs;
|
||||
|
||||
dev_set_drvdata(&pdev->dev, master);
|
||||
|
||||
@@ -579,7 +660,7 @@ static int rt2880_spi_probe(struct platf
|
||||
rs->clk = clk;
|
||||
rs->master = master;
|
||||
rs->sys_freq = clk_get_rate(rs->clk);
|
||||
- rs->ops = (struct rt2880_spi_ops *) match->data;
|
||||
+ rs->ops = ops;
|
||||
dev_dbg(&pdev->dev, "sys_freq: %u\n", rs->sys_freq);
|
||||
spin_lock_irqsave(&rs->lock, flags);
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
From c174d2250e402399ad7dbdd57d51883d8804bba0 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <blogic@openwrt.org>
|
||||
Date: Mon, 15 Jul 2013 00:40:37 +0200
|
||||
Subject: [PATCH 31/33] owrt: MIPS: add OWRTDTB secion
|
||||
|
||||
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
---
|
||||
arch/mips/kernel/head.S | 3 +++
|
||||
arch/mips/ralink/Makefile | 2 +-
|
||||
arch/mips/ralink/of.c | 4 +++-
|
||||
3 files changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/arch/mips/kernel/head.S
|
||||
+++ b/arch/mips/kernel/head.S
|
||||
@@ -146,6 +146,9 @@ EXPORT(__image_cmdline)
|
||||
.fill 0x400
|
||||
#endif /* CONFIG_IMAGE_CMDLINE_HACK */
|
||||
|
||||
+ .ascii "OWRTDTB:"
|
||||
+ EXPORT(__image_dtb)
|
||||
+ .fill 0x4000
|
||||
__REF
|
||||
|
||||
NESTED(kernel_entry, 16, sp) # kernel entry point
|
||||
--- a/arch/mips/ralink/Makefile
|
||||
+++ b/arch/mips/ralink/Makefile
|
||||
@@ -26,4 +26,4 @@ obj-$(CONFIG_EARLY_PRINTK) += early_prin
|
||||
|
||||
obj-$(CONFIG_DEBUG_FS) += bootrom.o
|
||||
|
||||
-obj-y += dts/
|
||||
+#obj-y += dts/
|
||||
--- a/arch/mips/ralink/of.c
|
||||
+++ b/arch/mips/ralink/of.c
|
||||
@@ -90,6 +90,8 @@ static int __init early_init_dt_find_mem
|
||||
return 0;
|
||||
}
|
||||
|
||||
+extern struct boot_param_header __image_dtb;
|
||||
+
|
||||
void __init plat_mem_setup(void)
|
||||
{
|
||||
set_io_port_base(KSEG1);
|
||||
@@ -98,7 +100,7 @@ void __init plat_mem_setup(void)
|
||||
* Load the builtin devicetree. This causes the chosen node to be
|
||||
* parsed resulting in our memory appearing
|
||||
*/
|
||||
- __dt_setup_arch(&__dtb_start);
|
||||
+ __dt_setup_arch(&__image_dtb);
|
||||
|
||||
of_scan_flat_dt(early_init_dt_find_memory, NULL);
|
||||
if (memory_dtb)
|
|
@ -1,10 +0,0 @@
|
|||
--- a/arch/mips/ralink/rt3883.c
|
||||
+++ b/arch/mips/ralink/rt3883.c
|
||||
@@ -111,6 +111,7 @@ void __init ralink_clk_init(void)
|
||||
ralink_clk_add("10000b00.spi", sys_rate);
|
||||
ralink_clk_add("10000c00.uartlite", 40000000);
|
||||
ralink_clk_add("10100000.ethernet", sys_rate);
|
||||
+ ralink_clk_add("10180000.wmac", 40000000);
|
||||
}
|
||||
|
||||
void __init ralink_of_remap(void)
|
|
@ -1,27 +0,0 @@
|
|||
--- linux-3.10.26/arch/mips/ralink/mt7620.c 2014-01-15 21:49:41.368793580 +0200
|
||||
+++ linux-3.10.26/arch/mips/ralink/mt7620.c 2014-01-15 19:33:32.022038160 +0200
|
||||
@@ -105,12 +105,15 @@
|
||||
|
||||
void __init ralink_clk_init(void)
|
||||
{
|
||||
- unsigned long cpu_rate, sys_rate;
|
||||
+ unsigned long cpu_rate, sys_rate, xtal_freq;
|
||||
u32 c0 = rt_sysc_r32(SYSC_REG_CPLL_CONFIG0);
|
||||
u32 c1 = rt_sysc_r32(SYSC_REG_CPLL_CONFIG1);
|
||||
u32 swconfig = (c0 >> CPLL_SW_CONFIG_SHIFT) & CPLL_SW_CONFIG_MASK;
|
||||
u32 cpu_clk = (c1 >> CPLL_CPU_CLK_SHIFT) & CPLL_CPU_CLK_MASK;
|
||||
|
||||
+ u32 syscfg0 = rt_sysc_r32(SYSC_REG_SYSTEM_CONFIG0);
|
||||
+ xtal_freq = (syscfg0 & 0x40) ? 40000000 : 20000000;
|
||||
+
|
||||
if (cpu_clk) {
|
||||
cpu_rate = 480000000;
|
||||
} else if (!swconfig) {
|
||||
@@ -133,6 +136,7 @@
|
||||
ralink_clk_add("10000500.uart", 40000000);
|
||||
ralink_clk_add("10000b00.spi", 40000000);
|
||||
ralink_clk_add("10000c00.uartlite", 40000000);
|
||||
+ ralink_clk_add("10180000.wmac", xtal_freq);
|
||||
|
||||
if (IS_ENABLED(CONFIG_USB)) {
|
||||
/*
|
|
@ -1,166 +0,0 @@
|
|||
CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
|
||||
CONFIG_ARCH_DISCARD_MEMBLOCK=y
|
||||
CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
|
||||
CONFIG_ARCH_HAS_RESET_CONTROLLER=y
|
||||
CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_REQUIRE_GPIOLIB=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
|
||||
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
|
||||
CONFIG_CEVT_R4K=y
|
||||
CONFIG_CLKDEV_LOOKUP=y
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
|
||||
CONFIG_CMDLINE_BOOL=y
|
||||
# CONFIG_CMDLINE_OVERRIDE is not set
|
||||
CONFIG_CPU_GENERIC_DUMP_TLB=y
|
||||
CONFIG_CPU_HAS_PREFETCH=y
|
||||
CONFIG_CPU_HAS_SYNC=y
|
||||
CONFIG_CPU_LITTLE_ENDIAN=y
|
||||
CONFIG_CPU_MIPS32=y
|
||||
# CONFIG_CPU_MIPS32_R1 is not set
|
||||
CONFIG_CPU_MIPS32_R2=y
|
||||
CONFIG_CPU_MIPSR2=y
|
||||
CONFIG_CPU_R4K_CACHE_TLB=y
|
||||
CONFIG_CPU_R4K_FPU=y
|
||||
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
||||
CONFIG_CSRC_R4K=y
|
||||
# CONFIG_DEBUG_PINCTRL is not set
|
||||
CONFIG_DMA_NONCOHERENT=y
|
||||
# CONFIG_DTB_RT2880_EVAL is not set
|
||||
CONFIG_DTB_RT_NONE=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
|
||||
CONFIG_GENERIC_CMOS_UPDATE=y
|
||||
CONFIG_GENERIC_IO=y
|
||||
CONFIG_GENERIC_IRQ_SHOW=y
|
||||
CONFIG_GENERIC_PCI_IOMAP=y
|
||||
CONFIG_GENERIC_SMP_IDLE_THREAD=y
|
||||
CONFIG_GPIOLIB=y
|
||||
CONFIG_GPIO_DEVRES=y
|
||||
CONFIG_GPIO_RALINK=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_HARDWARE_WATCHPOINTS=y
|
||||
CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT=y
|
||||
# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
CONFIG_HAVE_ARCH_KGDB=y
|
||||
# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
|
||||
CONFIG_HAVE_CLK=y
|
||||
CONFIG_HAVE_C_RECORDMCOUNT=y
|
||||
CONFIG_HAVE_DEBUG_KMEMLEAK=y
|
||||
CONFIG_HAVE_DMA_API_DEBUG=y
|
||||
CONFIG_HAVE_DMA_ATTRS=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE=y
|
||||
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
|
||||
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
|
||||
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
|
||||
CONFIG_HAVE_GENERIC_HARDIRQS=y
|
||||
CONFIG_HAVE_IDE=y
|
||||
CONFIG_HAVE_KVM=y
|
||||
CONFIG_HAVE_MACH_CLKDEV=y
|
||||
CONFIG_HAVE_MEMBLOCK=y
|
||||
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
|
||||
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
||||
CONFIG_HAVE_NET_DSA=y
|
||||
CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_HW_HAS_PCI=y
|
||||
CONFIG_HW_RANDOM=m
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_IMAGE_CMDLINE_HACK=y
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_IP17XX_PHY=y
|
||||
CONFIG_IRQCHIP=y
|
||||
CONFIG_IRQ_CPU=y
|
||||
CONFIG_IRQ_DOMAIN=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_IRQ_INTC=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
CONFIG_M25PXX_USE_FAST_READ=y
|
||||
CONFIG_MDIO_BOARDINFO=y
|
||||
# CONFIG_MII is not set
|
||||
CONFIG_MIPS=y
|
||||
# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=4
|
||||
# CONFIG_MIPS_MACHINE is not set
|
||||
CONFIG_MIPS_MT_DISABLED=y
|
||||
CONFIG_MODULES_USE_ELF_REL=y
|
||||
# CONFIG_MTD_CFI_INTELEXT is not set
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_M25P80=y
|
||||
CONFIG_MTD_OF_PARTS=y
|
||||
CONFIG_MTD_PHYSMAP=y
|
||||
CONFIG_MTD_PHYSMAP_OF=y
|
||||
CONFIG_MTD_SPLIT_FIRMWARE=y
|
||||
CONFIG_MTD_UIMAGE_SPLIT=y
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NEED_PER_CPU_KM=y
|
||||
CONFIG_NET_RALINK=y
|
||||
CONFIG_NET_RALINK_MDIO=y
|
||||
CONFIG_NET_RALINK_MDIO_RT2880=y
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
CONFIG_OF_DEVICE=y
|
||||
CONFIG_OF_EARLY_FLATTREE=y
|
||||
CONFIG_OF_FLATTREE=y
|
||||
CONFIG_OF_GPIO=y
|
||||
CONFIG_OF_IRQ=y
|
||||
CONFIG_OF_MDIO=y
|
||||
CONFIG_OF_MTD=y
|
||||
CONFIG_OF_NET=y
|
||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||
# CONFIG_PCI is not set
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
CONFIG_PHYLIB=y
|
||||
# CONFIG_PINCONF is not set
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCTRL_RT2880=y
|
||||
# CONFIG_PINCTRL_SINGLE is not set
|
||||
CONFIG_PINMUX=y
|
||||
# CONFIG_PREEMPT_RCU is not set
|
||||
CONFIG_RALINK=y
|
||||
CONFIG_RALINK_WDT=y
|
||||
CONFIG_RA_NAT_NONE=y
|
||||
# CONFIG_RCU_STALL_COMMON is not set
|
||||
CONFIG_RESET_CONTROLLER=y
|
||||
# CONFIG_SCSI_DMA is not set
|
||||
CONFIG_SERIAL_8250_NR_UARTS=4
|
||||
CONFIG_SERIAL_8250_RT288X=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
# CONFIG_SLAB is not set
|
||||
CONFIG_SLUB=y
|
||||
# CONFIG_SOC_MT7620 is not set
|
||||
# CONFIG_SOC_MT7621 is not set
|
||||
CONFIG_SOC_RT288X=y
|
||||
# CONFIG_SOC_RT305X is not set
|
||||
# CONFIG_SOC_RT3883 is not set
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPI_RT2880=y
|
||||
CONFIG_SWCONFIG=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
|
||||
CONFIG_SYS_HAS_EARLY_PRINTK=y
|
||||
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
|
||||
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_UIDGID_CONVERTED=y
|
||||
# CONFIG_USB_ARCH_HAS_EHCI is not set
|
||||
# CONFIG_USB_ARCH_HAS_HCD is not set
|
||||
# CONFIG_USB_ARCH_HAS_OHCI is not set
|
||||
# CONFIG_USB_ARCH_HAS_XHCI is not set
|
||||
CONFIG_USB_SUPPORT=y
|
||||
CONFIG_USE_OF=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
CONFIG_ZONE_DMA_FLAG=0
|
|
@ -1,169 +0,0 @@
|
|||
CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
|
||||
CONFIG_ARCH_DISCARD_MEMBLOCK=y
|
||||
CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
|
||||
CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_REQUIRE_GPIOLIB=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
|
||||
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
|
||||
CONFIG_CEVT_R4K=y
|
||||
CONFIG_CLKDEV_LOOKUP=y
|
||||
# CONFIG_CLKEVT_RT3352 is not set
|
||||
CONFIG_CLKSRC_MMIO=y
|
||||
CONFIG_CLKSRC_OF=y
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
|
||||
CONFIG_CMDLINE_BOOL=y
|
||||
# CONFIG_CMDLINE_OVERRIDE is not set
|
||||
CONFIG_CPU_GENERIC_DUMP_TLB=y
|
||||
CONFIG_CPU_HAS_PREFETCH=y
|
||||
CONFIG_CPU_HAS_SYNC=y
|
||||
CONFIG_CPU_LITTLE_ENDIAN=y
|
||||
CONFIG_CPU_MIPS32=y
|
||||
# CONFIG_CPU_MIPS32_R1 is not set
|
||||
CONFIG_CPU_MIPS32_R2=y
|
||||
CONFIG_CPU_MIPSR2=y
|
||||
CONFIG_CPU_R4K_CACHE_TLB=y
|
||||
CONFIG_CPU_R4K_FPU=y
|
||||
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
||||
CONFIG_CSRC_R4K=y
|
||||
CONFIG_DEBUG_PINCTRL=y
|
||||
CONFIG_DMA_NONCOHERENT=y
|
||||
# CONFIG_DTB_RT305X_EVAL is not set
|
||||
CONFIG_DTB_RT_NONE=y
|
||||
CONFIG_DTC=y
|
||||
# CONFIG_DWC_OTG is not set
|
||||
CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
|
||||
CONFIG_GENERIC_CMOS_UPDATE=y
|
||||
CONFIG_GENERIC_IO=y
|
||||
CONFIG_GENERIC_IRQ_SHOW=y
|
||||
CONFIG_GENERIC_PCI_IOMAP=y
|
||||
CONFIG_GENERIC_SMP_IDLE_THREAD=y
|
||||
CONFIG_GPIOLIB=y
|
||||
CONFIG_GPIO_DEVRES=y
|
||||
CONFIG_GPIO_RALINK=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_HARDWARE_WATCHPOINTS=y
|
||||
CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT=y
|
||||
# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
CONFIG_HAVE_ARCH_KGDB=y
|
||||
# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
|
||||
CONFIG_HAVE_CLK=y
|
||||
CONFIG_HAVE_C_RECORDMCOUNT=y
|
||||
CONFIG_HAVE_DEBUG_KMEMLEAK=y
|
||||
CONFIG_HAVE_DMA_API_DEBUG=y
|
||||
CONFIG_HAVE_DMA_ATTRS=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE=y
|
||||
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
|
||||
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
|
||||
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
|
||||
CONFIG_HAVE_GENERIC_HARDIRQS=y
|
||||
CONFIG_HAVE_IDE=y
|
||||
CONFIG_HAVE_KVM=y
|
||||
CONFIG_HAVE_MACH_CLKDEV=y
|
||||
CONFIG_HAVE_MEMBLOCK=y
|
||||
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
|
||||
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
||||
CONFIG_HAVE_NET_DSA=y
|
||||
CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_HW_RANDOM=m
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_IMAGE_CMDLINE_HACK=y
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_IRQCHIP=y
|
||||
CONFIG_IRQ_CPU=y
|
||||
CONFIG_IRQ_DOMAIN=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
CONFIG_M25PXX_USE_FAST_READ=y
|
||||
CONFIG_MDIO_BOARDINFO=y
|
||||
# CONFIG_MII is not set
|
||||
CONFIG_MIPS=y
|
||||
# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=5
|
||||
# CONFIG_MIPS_MACHINE is not set
|
||||
CONFIG_MIPS_MT_DISABLED=y
|
||||
CONFIG_MODULES_USE_ELF_REL=y
|
||||
# CONFIG_MTD_CFI_INTELEXT is not set
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_M25P80=y
|
||||
CONFIG_MTD_OF_PARTS=y
|
||||
CONFIG_MTD_PHYSMAP=y
|
||||
CONFIG_MTD_PHYSMAP_OF=y
|
||||
CONFIG_MTD_SPLIT_FIRMWARE=y
|
||||
CONFIG_MTD_UIMAGE_SPLIT=y
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NEED_PER_CPU_KM=y
|
||||
CONFIG_NET_RALINK=y
|
||||
CONFIG_NET_RALINK_ESW_RT3052=y
|
||||
CONFIG_NLS=m
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
CONFIG_OF_DEVICE=y
|
||||
CONFIG_OF_EARLY_FLATTREE=y
|
||||
CONFIG_OF_FLATTREE=y
|
||||
CONFIG_OF_GPIO=y
|
||||
CONFIG_OF_IRQ=y
|
||||
CONFIG_OF_MDIO=y
|
||||
CONFIG_OF_MTD=y
|
||||
CONFIG_OF_NET=y
|
||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
CONFIG_PHYLIB=y
|
||||
# CONFIG_PINCONF is not set
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCTRL_RT2880=y
|
||||
# CONFIG_PINCTRL_SINGLE is not set
|
||||
CONFIG_PINMUX=y
|
||||
# CONFIG_PREEMPT_RCU is not set
|
||||
CONFIG_RALINK=y
|
||||
CONFIG_RALINK_USBPHY=y
|
||||
CONFIG_RALINK_WDT=y
|
||||
# CONFIG_RCU_STALL_COMMON is not set
|
||||
CONFIG_RESET_CONTROLLER=y
|
||||
# CONFIG_SAMSUNG_USB2PHY is not set
|
||||
# CONFIG_SAMSUNG_USB3PHY is not set
|
||||
# CONFIG_SAMSUNG_USBPHY is not set
|
||||
# CONFIG_SCSI_DMA is not set
|
||||
CONFIG_SERIAL_8250_NR_UARTS=4
|
||||
CONFIG_SERIAL_8250_RT288X=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
# CONFIG_SLAB is not set
|
||||
CONFIG_SLUB=y
|
||||
# CONFIG_SOC_MT7620 is not set
|
||||
# CONFIG_SOC_MT7621 is not set
|
||||
# CONFIG_SOC_RT288X is not set
|
||||
CONFIG_SOC_RT305X=y
|
||||
# CONFIG_SOC_RT3883 is not set
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPI_RT2880=y
|
||||
CONFIG_SWCONFIG=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
|
||||
CONFIG_SYS_HAS_EARLY_PRINTK=y
|
||||
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
|
||||
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_UIDGID_CONVERTED=y
|
||||
CONFIG_USB=m
|
||||
# CONFIG_USB_ARCH_HAS_XHCI is not set
|
||||
CONFIG_USB_COMMON=m
|
||||
# CONFIG_USB_EHCI_HCD is not set
|
||||
CONFIG_USB_PHY=y
|
||||
CONFIG_USB_SUPPORT=y
|
||||
CONFIG_USE_OF=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
CONFIG_ZONE_DMA_FLAG=0
|
|
@ -1,179 +0,0 @@
|
|||
CONFIG_AR8216_PHY=y
|
||||
CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
|
||||
CONFIG_ARCH_DISCARD_MEMBLOCK=y
|
||||
CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
|
||||
CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_REQUIRE_GPIOLIB=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
|
||||
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
|
||||
CONFIG_CEVT_R4K=y
|
||||
CONFIG_CLKDEV_LOOKUP=y
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
|
||||
CONFIG_CMDLINE_BOOL=y
|
||||
# CONFIG_CMDLINE_OVERRIDE is not set
|
||||
CONFIG_CPU_GENERIC_DUMP_TLB=y
|
||||
CONFIG_CPU_HAS_PREFETCH=y
|
||||
CONFIG_CPU_HAS_SYNC=y
|
||||
CONFIG_CPU_LITTLE_ENDIAN=y
|
||||
CONFIG_CPU_MIPS32=y
|
||||
# CONFIG_CPU_MIPS32_R1 is not set
|
||||
CONFIG_CPU_MIPS32_R2=y
|
||||
CONFIG_CPU_MIPSR2=y
|
||||
CONFIG_CPU_R4K_CACHE_TLB=y
|
||||
CONFIG_CPU_R4K_FPU=y
|
||||
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
||||
CONFIG_CSRC_R4K=y
|
||||
CONFIG_DEBUG_PINCTRL=y
|
||||
CONFIG_DMA_NONCOHERENT=y
|
||||
# CONFIG_DTB_RT3883_EVAL is not set
|
||||
CONFIG_DTB_RT_NONE=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_ETHERNET_PACKET_MANGLE=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
|
||||
CONFIG_GENERIC_CMOS_UPDATE=y
|
||||
CONFIG_GENERIC_IO=y
|
||||
CONFIG_GENERIC_IRQ_SHOW=y
|
||||
CONFIG_GENERIC_PCI_IOMAP=y
|
||||
CONFIG_GENERIC_SMP_IDLE_THREAD=y
|
||||
CONFIG_GPIOLIB=y
|
||||
CONFIG_GPIO_DEVRES=y
|
||||
CONFIG_GPIO_RALINK=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_HARDWARE_WATCHPOINTS=y
|
||||
CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT=y
|
||||
# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
CONFIG_HAVE_ARCH_KGDB=y
|
||||
# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
|
||||
CONFIG_HAVE_CLK=y
|
||||
CONFIG_HAVE_C_RECORDMCOUNT=y
|
||||
CONFIG_HAVE_DEBUG_KMEMLEAK=y
|
||||
CONFIG_HAVE_DMA_API_DEBUG=y
|
||||
CONFIG_HAVE_DMA_ATTRS=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE=y
|
||||
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
|
||||
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
|
||||
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
|
||||
CONFIG_HAVE_GENERIC_HARDIRQS=y
|
||||
CONFIG_HAVE_IDE=y
|
||||
CONFIG_HAVE_KVM=y
|
||||
CONFIG_HAVE_MACH_CLKDEV=y
|
||||
CONFIG_HAVE_MEMBLOCK=y
|
||||
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
|
||||
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
||||
CONFIG_HAVE_NET_DSA=y
|
||||
CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_HW_HAS_PCI=y
|
||||
CONFIG_HW_RANDOM=m
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_IMAGE_CMDLINE_HACK=y
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_IRQCHIP=y
|
||||
CONFIG_IRQ_CPU=y
|
||||
CONFIG_IRQ_DOMAIN=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
CONFIG_M25PXX_USE_FAST_READ=y
|
||||
CONFIG_MDIO_BOARDINFO=y
|
||||
# CONFIG_MII is not set
|
||||
CONFIG_MIPS=y
|
||||
# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=5
|
||||
# CONFIG_MIPS_MACHINE is not set
|
||||
CONFIG_MIPS_MT_DISABLED=y
|
||||
CONFIG_MODULES_USE_ELF_REL=y
|
||||
# CONFIG_MTD_CFI_INTELEXT is not set
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_M25P80=y
|
||||
CONFIG_MTD_OF_PARTS=y
|
||||
CONFIG_MTD_PHYSMAP=y
|
||||
CONFIG_MTD_PHYSMAP_OF=y
|
||||
CONFIG_MTD_SPLIT_FIRMWARE=y
|
||||
CONFIG_MTD_SPLIT_SEAMA_FW=y
|
||||
CONFIG_MTD_UIMAGE_SPLIT=y
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NEED_PER_CPU_KM=y
|
||||
CONFIG_NET_RALINK=y
|
||||
CONFIG_NET_RALINK_MDIO=y
|
||||
CONFIG_NET_RALINK_MDIO_RT2880=y
|
||||
CONFIG_NLS=m
|
||||
CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
CONFIG_OF_DEVICE=y
|
||||
CONFIG_OF_EARLY_FLATTREE=y
|
||||
CONFIG_OF_FLATTREE=y
|
||||
CONFIG_OF_GPIO=y
|
||||
CONFIG_OF_IRQ=y
|
||||
CONFIG_OF_MDIO=y
|
||||
CONFIG_OF_MTD=y
|
||||
CONFIG_OF_NET=y
|
||||
CONFIG_OF_PCI=y
|
||||
CONFIG_OF_PCI_IRQ=y
|
||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||
CONFIG_PCI=y
|
||||
CONFIG_PCI_DOMAINS=y
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
CONFIG_PHYLIB=y
|
||||
# CONFIG_PINCONF is not set
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCTRL_RT2880=y
|
||||
# CONFIG_PINCTRL_SINGLE is not set
|
||||
CONFIG_PINMUX=y
|
||||
# CONFIG_PREEMPT_RCU is not set
|
||||
CONFIG_RALINK=y
|
||||
CONFIG_RALINK_USBPHY=y
|
||||
CONFIG_RALINK_WDT=y
|
||||
# CONFIG_RCU_STALL_COMMON is not set
|
||||
CONFIG_RESET_CONTROLLER=y
|
||||
CONFIG_RTL8366_SMI=y
|
||||
CONFIG_RTL8367B_PHY=y
|
||||
CONFIG_RTL8367_PHY=y
|
||||
# CONFIG_SAMSUNG_USB2PHY is not set
|
||||
# CONFIG_SAMSUNG_USB3PHY is not set
|
||||
# CONFIG_SAMSUNG_USBPHY is not set
|
||||
# CONFIG_SCSI_DMA is not set
|
||||
CONFIG_SERIAL_8250_NR_UARTS=4
|
||||
CONFIG_SERIAL_8250_RT288X=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
# CONFIG_SLAB is not set
|
||||
CONFIG_SLUB=y
|
||||
# CONFIG_SOC_MT7620 is not set
|
||||
# CONFIG_SOC_MT7621 is not set
|
||||
# CONFIG_SOC_RT288X is not set
|
||||
# CONFIG_SOC_RT305X is not set
|
||||
CONFIG_SOC_RT3883=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPI_RT2880=y
|
||||
CONFIG_SWCONFIG=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R2=y
|
||||
CONFIG_SYS_HAS_EARLY_PRINTK=y
|
||||
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
|
||||
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_UIDGID_CONVERTED=y
|
||||
CONFIG_USB=m
|
||||
CONFIG_USB_ARCH_HAS_XHCI=y
|
||||
CONFIG_USB_COMMON=m
|
||||
# CONFIG_USB_EHCI_HCD is not set
|
||||
CONFIG_USB_PHY=y
|
||||
CONFIG_USB_SUPPORT=y
|
||||
# CONFIG_USB_UHCI_HCD is not set
|
||||
CONFIG_USE_OF=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
CONFIG_ZONE_DMA_FLAG=0
|
Loading…
Reference in a new issue