···11+MIPS CPU interrupt controller22+33+On MIPS the mips_cpu_intc_init() helper can be used to initialize the 8 CPU44+IRQs from a devicetree file and create a irq_domain for IRQ controller.55+66+With the irq_domain in place we can describe how the 8 IRQs are wired to the77+platforms internal interrupt controller cascade.88+99+Below is an example of a platform describing the cascade inside the devicetree1010+and the code used to load it inside arch_init_irq().1111+1212+Required properties:1313+- compatible : Should be "mti,cpu-interrupt-controller"1414+1515+Example devicetree:1616+ cpu-irq: cpu-irq@0 {1717+ #address-cells = <0>;1818+1919+ interrupt-controller;2020+ #interrupt-cells = <1>;2121+2222+ compatible = "mti,cpu-interrupt-controller";2323+ };2424+2525+ intc: intc@200 {2626+ compatible = "ralink,rt2880-intc";2727+ reg = <0x200 0x100>;2828+2929+ interrupt-controller;3030+ #interrupt-cells = <1>;3131+3232+ interrupt-parent = <&cpu-irq>;3333+ interrupts = <2>;3434+ };3535+3636+3737+Example platform irq.c:3838+static struct of_device_id __initdata of_irq_ids[] = {3939+ { .compatible = "mti,cpu-interrupt-controller", .data = mips_cpu_intc_init },4040+ { .compatible = "ralink,rt2880-intc", .data = intc_of_init },4141+ {},4242+};4343+4444+void __init arch_init_irq(void)4545+{4646+ of_irq_init(of_irq_ids);4747+}
···11+Lantiq SoC ASC serial controller22+33+Required properties:44+- compatible : Should be "lantiq,asc"55+- reg : Address and length of the register set for the device66+- interrupts: the 3 (tx rx err) interrupt numbers. The interrupt specifier77+ depends on the interrupt-parent interrupt controller.88+99+Example:1010+1111+asc1: serial@E100C00 {1212+ compatible = "lantiq,asc";1313+ reg = <0xE100C00 0x400>;1414+ interrupt-parent = <&icu0>;1515+ interrupts = <112 113 114>;1616+};
+1-1
Documentation/kernel-parameters.txt
···24382438 real-time workloads. It can also improve energy24392439 efficiency for asymmetric multiprocessors.2440244024412441- rcu_nocbs_poll [KNL,BOOT]24412441+ rcu_nocb_poll [KNL,BOOT]24422442 Rather than requiring that offloaded CPUs24432443 (specified by rcu_nocbs= above) explicitly24442444 awaken the corresponding "rcuoN" kthreads,
+1-1
Documentation/x86/boot.txt
···5757Protocol 2.11: (Kernel 3.6) Added a field for offset of EFI handover5858 protocol entry point.59596060-Protocol 2.12: (Kernel 3.9) Added the xloadflags field and extension fields6060+Protocol 2.12: (Kernel 3.8) Added the xloadflags field and extension fields6161 to struct boot_params for for loading bzImage and ramdisk6262 above 4G in 64bit.6363
···351351 irq_set_chained_handler(irq, gic_handle_cascade_irq);352352}353353354354+static u8 gic_get_cpumask(struct gic_chip_data *gic)355355+{356356+ void __iomem *base = gic_data_dist_base(gic);357357+ u32 mask, i;358358+359359+ for (i = mask = 0; i < 32; i += 4) {360360+ mask = readl_relaxed(base + GIC_DIST_TARGET + i);361361+ mask |= mask >> 16;362362+ mask |= mask >> 8;363363+ if (mask)364364+ break;365365+ }366366+367367+ if (!mask)368368+ pr_crit("GIC CPU mask not found - kernel will fail to boot.\n");369369+370370+ return mask;371371+}372372+354373static void __init gic_dist_init(struct gic_chip_data *gic)355374{356375 unsigned int i;···388369 /*389370 * Set all global interrupts to this CPU only.390371 */391391- cpumask = readl_relaxed(base + GIC_DIST_TARGET + 0);372372+ cpumask = gic_get_cpumask(gic);373373+ cpumask |= cpumask << 8;374374+ cpumask |= cpumask << 16;392375 for (i = 32; i < gic_irqs; i += 4)393376 writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4);394377···421400 * Get what the GIC says our CPU mask is.422401 */423402 BUG_ON(cpu >= NR_GIC_CPU_IF);424424- cpu_mask = readl_relaxed(dist_base + GIC_DIST_TARGET + 0);403403+ cpu_mask = gic_get_cpumask(gic);425404 gic_cpu_map[cpu] = cpu_mask;426405427406 /*
+1-1
arch/arm/include/asm/memory.h
···3737 */3838#define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)3939#define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(0x01000000))4040-#define TASK_UNMAPPED_BASE (UL(CONFIG_PAGE_OFFSET) / 3)4040+#define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M)41414242/*4343 * The maximum size of a 26-bit user space task.
+1-1
arch/arm/mach-exynos/Kconfig
···414414 select CPU_EXYNOS4210415415 select HAVE_SAMSUNG_KEYPAD if INPUT_KEYBOARD416416 select PINCTRL417417- select PINCTRL_EXYNOS4417417+ select PINCTRL_EXYNOS418418 select USE_OF419419 help420420 Machine support for Samsung Exynos4 machine with device tree enabled.
+1-1
arch/arm/mach-realview/include/mach/irqs-eb.h
···115115/*116116 * Only define NR_IRQS if less than NR_IRQS_EB117117 */118118-#define NR_IRQS_EB (IRQ_EB_GIC_START + 96)118118+#define NR_IRQS_EB (IRQ_EB_GIC_START + 128)119119120120#if defined(CONFIG_MACH_REALVIEW_EB) \121121 && (!defined(NR_IRQS) || (NR_IRQS < NR_IRQS_EB))
+1-1
arch/arm/mm/dma-mapping.c
···640640641641 if (is_coherent || nommu())642642 addr = __alloc_simple_buffer(dev, size, gfp, &page);643643- else if (gfp & GFP_ATOMIC)643643+ else if (!(gfp & __GFP_WAIT))644644 addr = __alloc_from_pool(size, &page);645645 else if (!IS_ENABLED(CONFIG_CMA))646646 addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller);
···7474 case REV_ID_MAJOR_AR9341:7575 case REV_ID_MAJOR_AR9342:7676 case REV_ID_MAJOR_AR9344:7777+ case REV_ID_MAJOR_QCA9556:7878+ case REV_ID_MAJOR_QCA9558:7779 _prom_putchar = prom_putchar_ar71xx;7880 break;7981
···11+CONFIG_RALINK=y22+CONFIG_DTB_RT305X_EVAL=y33+CONFIG_CPU_MIPS32_R2=y44+# CONFIG_COMPACTION is not set55+# CONFIG_CROSS_MEMORY_ATTACH is not set66+CONFIG_HZ_100=y77+# CONFIG_SECCOMP is not set88+CONFIG_EXPERIMENTAL=y99+# CONFIG_LOCALVERSION_AUTO is not set1010+CONFIG_SYSVIPC=y1111+CONFIG_HIGH_RES_TIMERS=y1212+CONFIG_BLK_DEV_INITRD=y1313+CONFIG_INITRAMFS_SOURCE=""1414+CONFIG_INITRAMFS_ROOT_UID=10001515+CONFIG_INITRAMFS_ROOT_GID=10001616+# CONFIG_RD_GZIP is not set1717+CONFIG_CC_OPTIMIZE_FOR_SIZE=y1818+CONFIG_KALLSYMS_ALL=y1919+# CONFIG_AIO is not set2020+CONFIG_EMBEDDED=y2121+# CONFIG_VM_EVENT_COUNTERS is not set2222+# CONFIG_SLUB_DEBUG is not set2323+# CONFIG_COMPAT_BRK is not set2424+CONFIG_MODULES=y2525+CONFIG_MODULE_UNLOAD=y2626+# CONFIG_BLK_DEV_BSG is not set2727+CONFIG_PARTITION_ADVANCED=y2828+# CONFIG_IOSCHED_CFQ is not set2929+# CONFIG_COREDUMP is not set3030+# CONFIG_SUSPEND is not set3131+CONFIG_NET=y3232+CONFIG_PACKET=y3333+CONFIG_UNIX=y3434+CONFIG_INET=y3535+CONFIG_IP_MULTICAST=y3636+CONFIG_IP_ADVANCED_ROUTER=y3737+CONFIG_IP_MULTIPLE_TABLES=y3838+CONFIG_IP_ROUTE_MULTIPATH=y3939+CONFIG_IP_ROUTE_VERBOSE=y4040+CONFIG_IP_MROUTE=y4141+CONFIG_IP_MROUTE_MULTIPLE_TABLES=y4242+CONFIG_ARPD=y4343+CONFIG_SYN_COOKIES=y4444+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set4545+# CONFIG_INET_XFRM_MODE_TUNNEL is not set4646+# CONFIG_INET_XFRM_MODE_BEET is not set4747+# CONFIG_INET_LRO is not set4848+# CONFIG_INET_DIAG is not set4949+CONFIG_TCP_CONG_ADVANCED=y5050+# CONFIG_TCP_CONG_BIC is not set5151+# CONFIG_TCP_CONG_WESTWOOD is not set5252+# CONFIG_TCP_CONG_HTCP is not set5353+# CONFIG_IPV6 is not set5454+CONFIG_NETFILTER=y5555+# CONFIG_BRIDGE_NETFILTER is not set5656+CONFIG_NF_CONNTRACK=m5757+CONFIG_NF_CONNTRACK_FTP=m5858+CONFIG_NF_CONNTRACK_IRC=m5959+CONFIG_NETFILTER_XT_TARGET_CT=m6060+CONFIG_NETFILTER_XT_TARGET_LOG=m6161+CONFIG_NETFILTER_XT_TARGET_TCPMSS=m6262+CONFIG_NETFILTER_XT_MATCH_COMMENT=m6363+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m6464+CONFIG_NETFILTER_XT_MATCH_LIMIT=m6565+CONFIG_NETFILTER_XT_MATCH_MAC=m6666+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m6767+CONFIG_NETFILTER_XT_MATCH_STATE=m6868+CONFIG_NF_CONNTRACK_IPV4=m6969+# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set7070+CONFIG_IP_NF_IPTABLES=m7171+CONFIG_IP_NF_FILTER=m7272+CONFIG_IP_NF_TARGET_REJECT=m7373+CONFIG_IP_NF_MANGLE=m7474+CONFIG_IP_NF_RAW=m7575+CONFIG_BRIDGE=y7676+# CONFIG_BRIDGE_IGMP_SNOOPING is not set7777+CONFIG_VLAN_8021Q=y7878+CONFIG_NET_SCHED=y7979+CONFIG_HAMRADIO=y8080+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"8181+# CONFIG_FIRMWARE_IN_KERNEL is not set8282+CONFIG_MTD=y8383+CONFIG_MTD_CMDLINE_PARTS=y8484+CONFIG_MTD_CHAR=y8585+CONFIG_MTD_BLOCK=y8686+CONFIG_MTD_CFI=y8787+CONFIG_MTD_CFI_AMDSTD=y8888+CONFIG_MTD_COMPLEX_MAPPINGS=y8989+CONFIG_MTD_PHYSMAP=y9090+CONFIG_MTD_PHYSMAP_OF=y9191+CONFIG_MTD_M25P80=y9292+CONFIG_EEPROM_93CX6=m9393+CONFIG_SCSI=y9494+CONFIG_BLK_DEV_SD=y9595+CONFIG_NETDEVICES=y9696+# CONFIG_NET_VENDOR_WIZNET is not set9797+CONFIG_PHYLIB=y9898+CONFIG_PPP=m9999+CONFIG_PPP_FILTER=y100100+CONFIG_PPP_MULTILINK=y101101+CONFIG_PPPOE=m102102+CONFIG_PPP_ASYNC=m103103+CONFIG_ISDN=y104104+CONFIG_INPUT=m105105+CONFIG_INPUT_POLLDEV=m106106+# CONFIG_INPUT_MOUSEDEV is not set107107+# CONFIG_KEYBOARD_ATKBD is not set108108+# CONFIG_INPUT_MOUSE is not set109109+CONFIG_INPUT_MISC=y110110+# CONFIG_SERIO is not set111111+# CONFIG_VT is not set112112+# CONFIG_LEGACY_PTYS is not set113113+# CONFIG_DEVKMEM is not set114114+CONFIG_SERIAL_8250=y115115+CONFIG_SERIAL_8250_CONSOLE=y116116+CONFIG_SERIAL_8250_RUNTIME_UARTS=2117117+CONFIG_SERIAL_OF_PLATFORM=y118118+CONFIG_SPI=y119119+# CONFIG_HWMON is not set120120+CONFIG_WATCHDOG=y121121+# CONFIG_HID is not set122122+# CONFIG_USB_HID is not set123123+CONFIG_USB=y124124+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y125125+CONFIG_USB_STORAGE=y126126+CONFIG_USB_STORAGE_DEBUG=y127127+CONFIG_NEW_LEDS=y128128+CONFIG_LEDS_CLASS=y129129+CONFIG_LEDS_TRIGGERS=y130130+CONFIG_LEDS_TRIGGER_TIMER=y131131+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y132132+CONFIG_STAGING=y133133+# CONFIG_IOMMU_SUPPORT is not set134134+# CONFIG_DNOTIFY is not set135135+# CONFIG_PROC_PAGE_MONITOR is not set136136+CONFIG_TMPFS=y137137+CONFIG_TMPFS_XATTR=y138138+CONFIG_JFFS2_FS=y139139+CONFIG_JFFS2_SUMMARY=y140140+CONFIG_JFFS2_FS_XATTR=y141141+# CONFIG_JFFS2_FS_POSIX_ACL is not set142142+# CONFIG_JFFS2_FS_SECURITY is not set143143+CONFIG_JFFS2_COMPRESSION_OPTIONS=y144144+# CONFIG_JFFS2_ZLIB is not set145145+CONFIG_SQUASHFS=y146146+# CONFIG_SQUASHFS_ZLIB is not set147147+CONFIG_SQUASHFS_XZ=y148148+CONFIG_PRINTK_TIME=y149149+# CONFIG_ENABLE_MUST_CHECK is not set150150+CONFIG_MAGIC_SYSRQ=y151151+CONFIG_STRIP_ASM_SYMS=y152152+CONFIG_DEBUG_FS=y153153+# CONFIG_SCHED_DEBUG is not set154154+# CONFIG_FTRACE is not set155155+CONFIG_CMDLINE_BOOL=y156156+CONFIG_CRYPTO_MANAGER=m157157+CONFIG_CRYPTO_ARC4=m158158+# CONFIG_CRYPTO_ANSI_CPRNG is not set159159+CONFIG_CRC_ITU_T=m160160+CONFIG_CRC32_SARWATE=y161161+# CONFIG_XZ_DEC_X86 is not set162162+# CONFIG_XZ_DEC_POWERPC is not set163163+# CONFIG_XZ_DEC_IA64 is not set164164+# CONFIG_XZ_DEC_ARM is not set165165+# CONFIG_XZ_DEC_ARMTHUMB is not set166166+# CONFIG_XZ_DEC_SPARC is not set167167+CONFIG_AVERAGE=y
···9696#define PRID_IMP_1004K 0x99009797#define PRID_IMP_1074K 0x9a009898#define PRID_IMP_M14KC 0x9c009999+#define PRID_IMP_M14KEC 0x9e0099100100101/*101102 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE···265264 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,266265 CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350,267266 CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC, CPU_LOONGSON1, CPU_M14KC,267267+ CPU_M14KEC,268268269269 /*270270 * MIPS64 class processors···324322#define MIPS_CPU_ULRI 0x00200000 /* CPU has ULRI feature */325323#define MIPS_CPU_PCI 0x00400000 /* CPU has Perf Ctr Int indicator */326324#define MIPS_CPU_RIXI 0x00800000 /* CPU has TLB Read/eXec Inhibit */325325+#define MIPS_CPU_MICROMIPS 0x01000000 /* CPU has microMIPS capability */327326328327/*329328 * CPU ASE encodings···336333#define MIPS_ASE_DSP 0x00000010 /* Signal Processing ASE */337334#define MIPS_ASE_MIPSMT 0x00000020 /* CPU supports MIPS MT */338335#define MIPS_ASE_DSP2P 0x00000040 /* Signal Processing ASE Rev 2 */339339-336336+#define MIPS_ASE_VZ 0x00000080 /* Virtualization ASE */340337341338#endif /* _ASM_CPU_H */
+1
arch/mips/include/asm/gic.h
···359359/* Mapped interrupt to pin X, then GIC will generate the vector (X+1). */360360#define GIC_PIN_TO_VEC_OFFSET (1)361361362362+extern int gic_present;362363extern unsigned long _gic_base;363364extern unsigned int gic_irq_base;364365extern unsigned int gic_irq_flags[];
+1-1
arch/mips/include/asm/hazards.h
···141141142142#elif defined(CONFIG_MIPS_ALCHEMY) || defined(CONFIG_CPU_CAVIUM_OCTEON) || \143143 defined(CONFIG_CPU_LOONGSON2) || defined(CONFIG_CPU_R10000) || \144144- defined(CONFIG_CPU_R5500)144144+ defined(CONFIG_CPU_R5500) || defined(CONFIG_CPU_XLR)145145146146/*147147 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
···11-/*22- * Atheros AR71XX/AR724X PCI support33- *44- * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com>55- * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>66- * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>77- *88- * This program is free software; you can redistribute it and/or modify it99- * under the terms of the GNU General Public License version 2 as published1010- * by the Free Software Foundation.1111- */1212-1313-#ifndef __ASM_MACH_ATH79_PCI_H1414-#define __ASM_MACH_ATH79_PCI_H1515-1616-#if defined(CONFIG_PCI) && defined(CONFIG_SOC_AR71XX)1717-int ar71xx_pcibios_init(void);1818-#else1919-static inline int ar71xx_pcibios_init(void) { return 0; }2020-#endif2121-2222-#if defined(CONFIG_PCI_AR724X)2323-int ar724x_pcibios_init(int irq);2424-#else2525-static inline int ar724x_pcibios_init(int irq) { return 0; }2626-#endif2727-2828-#endif /* __ASM_MACH_ATH79_PCI_H */
···88 * option) any later version.99 */10101111-#ifndef __NVRAM_H1212-#define __NVRAM_H1111+#ifndef __BCM47XX_NVRAM_H1212+#define __BCM47XX_NVRAM_H13131414#include <linux/types.h>1515#include <linux/kernel.h>···3232#define NVRAM_MAX_VALUE_LEN 2553333#define NVRAM_MAX_PARAM_LEN 6434343535-#define NVRAM_ERR_INV_PARAM -83636-#define NVRAM_ERR_ENVNOTFOUND -93535+extern int bcm47xx_nvram_getenv(char *name, char *val, size_t val_len);37363838-extern int nvram_getenv(char *name, char *val, size_t val_len);3939-4040-static inline void nvram_parse_macaddr(char *buf, u8 macaddr[6])3737+static inline void bcm47xx_nvram_parse_macaddr(char *buf, u8 macaddr[6])4138{4239 if (strchr(buf, ':'))4340 sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0],···4851 printk(KERN_WARNING "Can not parse mac address: %s\n", buf);4952}50535151-#endif5454+#endif /* __BCM47XX_NVRAM_H */
+2
arch/mips/include/asm/mach-lantiq/lantiq.h
···3434extern void ltq_disable_irq(struct irq_data *data);3535extern void ltq_mask_and_ack_irq(struct irq_data *data);3636extern void ltq_enable_irq(struct irq_data *data);3737+extern int ltq_eiu_get_irq(int exin);37383839/* clock handling */3940extern int clk_activate(struct clk *clk);···4241extern struct clk *clk_get_cpu(void);4342extern struct clk *clk_get_fpi(void);4443extern struct clk *clk_get_io(void);4444+extern struct clk *clk_get_ppe(void);45454646/* find out what bootsource we have */4747extern unsigned char ltq_boot_select(void);
+39
arch/mips/include/asm/mach-ralink/ralink_regs.h
···11+/*22+ * Ralink SoC register definitions33+ *44+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>55+ * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>66+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>77+ *88+ * This program is free software; you can redistribute it and/or modify it99+ * under the terms of the GNU General Public License version 2 as published1010+ * by the Free Software Foundation.1111+ */1212+1313+#ifndef _RALINK_REGS_H_1414+#define _RALINK_REGS_H_1515+1616+extern __iomem void *rt_sysc_membase;1717+extern __iomem void *rt_memc_membase;1818+1919+static inline void rt_sysc_w32(u32 val, unsigned reg)2020+{2121+ __raw_writel(val, rt_sysc_membase + reg);2222+}2323+2424+static inline u32 rt_sysc_r32(unsigned reg)2525+{2626+ return __raw_readl(rt_sysc_membase + reg);2727+}2828+2929+static inline void rt_memc_w32(u32 val, unsigned reg)3030+{3131+ __raw_writel(val, rt_memc_membase + reg);3232+}3333+3434+static inline u32 rt_memc_r32(unsigned reg)3535+{3636+ return __raw_readl(rt_memc_membase + reg);3737+}3838+3939+#endif /* _RALINK_REGS_H_ */
+139
arch/mips/include/asm/mach-ralink/rt305x.h
···11+/*22+ * This program is free software; you can redistribute it and/or modify it33+ * under the terms of the GNU General Public License version 2 as published44+ * by the Free Software Foundation.55+ *66+ * Parts of this file are based on Ralink's 2.6.21 BSP77+ *88+ * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>99+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>1010+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>1111+ */1212+1313+#ifndef _RT305X_REGS_H_1414+#define _RT305X_REGS_H_1515+1616+enum rt305x_soc_type {1717+ RT305X_SOC_UNKNOWN = 0,1818+ RT305X_SOC_RT3050,1919+ RT305X_SOC_RT3052,2020+ RT305X_SOC_RT3350,2121+ RT305X_SOC_RT3352,2222+ RT305X_SOC_RT5350,2323+};2424+2525+extern enum rt305x_soc_type rt305x_soc;2626+2727+static inline int soc_is_rt3050(void)2828+{2929+ return rt305x_soc == RT305X_SOC_RT3050;3030+}3131+3232+static inline int soc_is_rt3052(void)3333+{3434+ return rt305x_soc == RT305X_SOC_RT3052;3535+}3636+3737+static inline int soc_is_rt305x(void)3838+{3939+ return soc_is_rt3050() || soc_is_rt3052();4040+}4141+4242+static inline int soc_is_rt3350(void)4343+{4444+ return rt305x_soc == RT305X_SOC_RT3350;4545+}4646+4747+static inline int soc_is_rt3352(void)4848+{4949+ return rt305x_soc == RT305X_SOC_RT3352;5050+}5151+5252+static inline int soc_is_rt5350(void)5353+{5454+ return rt305x_soc == RT305X_SOC_RT5350;5555+}5656+5757+#define RT305X_SYSC_BASE 0x100000005858+5959+#define SYSC_REG_CHIP_NAME0 0x006060+#define SYSC_REG_CHIP_NAME1 0x046161+#define SYSC_REG_CHIP_ID 0x0c6262+#define SYSC_REG_SYSTEM_CONFIG 0x106363+6464+#define RT3052_CHIP_NAME0 0x303354526565+#define RT3052_CHIP_NAME1 0x202032356666+6767+#define RT3350_CHIP_NAME0 0x333354526868+#define RT3350_CHIP_NAME1 0x202030356969+7070+#define RT3352_CHIP_NAME0 0x333354527171+#define RT3352_CHIP_NAME1 0x202032357272+7373+#define RT5350_CHIP_NAME0 0x333554527474+#define RT5350_CHIP_NAME1 0x202030357575+7676+#define CHIP_ID_ID_MASK 0xff7777+#define CHIP_ID_ID_SHIFT 87878+#define CHIP_ID_REV_MASK 0xff7979+8080+#define RT305X_SYSCFG_CPUCLK_SHIFT 188181+#define RT305X_SYSCFG_CPUCLK_MASK 0x18282+#define RT305X_SYSCFG_CPUCLK_LOW 0x08383+#define RT305X_SYSCFG_CPUCLK_HIGH 0x18484+8585+#define RT305X_SYSCFG_SRAM_CS0_MODE_SHIFT 28686+#define RT305X_SYSCFG_CPUCLK_MASK 0x18787+#define RT305X_SYSCFG_SRAM_CS0_MODE_WDT 0x18888+8989+#define RT3352_SYSCFG0_CPUCLK_SHIFT 89090+#define RT3352_SYSCFG0_CPUCLK_MASK 0x19191+#define RT3352_SYSCFG0_CPUCLK_LOW 0x09292+#define RT3352_SYSCFG0_CPUCLK_HIGH 0x19393+9494+#define RT5350_SYSCFG0_CPUCLK_SHIFT 89595+#define RT5350_SYSCFG0_CPUCLK_MASK 0x39696+#define RT5350_SYSCFG0_CPUCLK_360 0x09797+#define RT5350_SYSCFG0_CPUCLK_320 0x29898+#define RT5350_SYSCFG0_CPUCLK_300 0x39999+100100+/* multi function gpio pins */101101+#define RT305X_GPIO_I2C_SD 1102102+#define RT305X_GPIO_I2C_SCLK 2103103+#define RT305X_GPIO_SPI_EN 3104104+#define RT305X_GPIO_SPI_CLK 4105105+/* GPIO 7-14 is shared between UART0, PCM and I2S interfaces */106106+#define RT305X_GPIO_7 7107107+#define RT305X_GPIO_10 10108108+#define RT305X_GPIO_14 14109109+#define RT305X_GPIO_UART1_TXD 15110110+#define RT305X_GPIO_UART1_RXD 16111111+#define RT305X_GPIO_JTAG_TDO 17112112+#define RT305X_GPIO_JTAG_TDI 18113113+#define RT305X_GPIO_MDIO_MDC 22114114+#define RT305X_GPIO_MDIO_MDIO 23115115+#define RT305X_GPIO_SDRAM_MD16 24116116+#define RT305X_GPIO_SDRAM_MD31 39117117+#define RT305X_GPIO_GE0_TXD0 40118118+#define RT305X_GPIO_GE0_RXCLK 51119119+120120+#define RT305X_GPIO_MODE_I2C BIT(0)121121+#define RT305X_GPIO_MODE_SPI BIT(1)122122+#define RT305X_GPIO_MODE_UART0_SHIFT 2123123+#define RT305X_GPIO_MODE_UART0_MASK 0x7124124+#define RT305X_GPIO_MODE_UART0(x) ((x) << RT305X_GPIO_MODE_UART0_SHIFT)125125+#define RT305X_GPIO_MODE_UARTF 0x0126126+#define RT305X_GPIO_MODE_PCM_UARTF 0x1127127+#define RT305X_GPIO_MODE_PCM_I2S 0x2128128+#define RT305X_GPIO_MODE_I2S_UARTF 0x3129129+#define RT305X_GPIO_MODE_PCM_GPIO 0x4130130+#define RT305X_GPIO_MODE_GPIO_UARTF 0x5131131+#define RT305X_GPIO_MODE_GPIO_I2S 0x6132132+#define RT305X_GPIO_MODE_GPIO 0x7133133+#define RT305X_GPIO_MODE_UART1 BIT(5)134134+#define RT305X_GPIO_MODE_JTAG BIT(6)135135+#define RT305X_GPIO_MODE_MDIO BIT(7)136136+#define RT305X_GPIO_MODE_SDRAM BIT(8)137137+#define RT305X_GPIO_MODE_RGMII BIT(9)138138+139139+#endif
+25
arch/mips/include/asm/mach-ralink/war.h
···11+/*22+ * This file is subject to the terms and conditions of the GNU General Public33+ * License. See the file "COPYING" in the main directory of this archive44+ * for more details.55+ *66+ * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>77+ */88+#ifndef __ASM_MACH_RALINK_WAR_H99+#define __ASM_MACH_RALINK_WAR_H1010+1111+#define R4600_V1_INDEX_ICACHEOP_WAR 01212+#define R4600_V1_HIT_CACHEOP_WAR 01313+#define R4600_V2_HIT_CACHEOP_WAR 01414+#define R5432_CP0_INTERRUPT_WAR 01515+#define BCM1250_M3_WAR 01616+#define SIBYTE_1956_WAR 01717+#define MIPS4K_ICACHE_REFILL_WAR 01818+#define MIPS_CACHE_SYNC_WAR 01919+#define TX49XX_ICACHE_INDEX_INV_WAR 02020+#define RM9000_CDEX_SMP_WAR 02121+#define ICACHE_REFILLS_WORKAROUND_WAR 02222+#define R10000_LLSC_WAR 02323+#define MIPS34K_MISSED_ITLB_WAR 02424+2525+#endif /* __ASM_MACH_RALINK_WAR_H */
+7-21
arch/mips/include/asm/mips-boards/generic.h
···11/*22- * Carsten Langgaard, carstenl@mips.com33- * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.44- *55- * This program is free software; you can distribute it and/or modify it66- * under the terms of the GNU General Public License (Version 2) as77- * published by the Free Software Foundation.88- *99- * This program is distributed in the hope it will be useful, but WITHOUT1010- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1111- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License22+ * This file is subject to the terms and conditions of the GNU General Public33+ * License. See the file "COPYING" in the main directory of this archive124 * for more details.135 *1414- * You should have received a copy of the GNU General Public License along1515- * with this program; if not, write to the Free Software Foundation, Inc.,1616- * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.1717- *186 * Defines of the MIPS boards specific address-MAP, registers, etc.77+ *88+ * Copyright (C) 2000,2012 MIPS Technologies, Inc.99+ * All rights reserved.1010+ * Authors: Carsten Langgaard <carstenl@mips.com>1111+ * Steven J. Hill <sjhill@mips.com>1912 */2013#ifndef __ASM_MIPS_BOARDS_GENERIC_H2114#define __ASM_MIPS_BOARDS_GENERIC_H···2229 */2330#define ASCII_DISPLAY_WORD_BASE 0x1f0004102431#define ASCII_DISPLAY_POS_BASE 0x1f0004182525-2626-2727-/*2828- * Yamon Prom print address.2929- */3030-#define YAMON_PROM_PRINT_ADDR 0x1fc005043131-32323333/*3434 * Reset register.
···2727obj-$(CONFIG_CSRC_POWERTV) += csrc-powertv.o2828obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o2929obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o3030+obj-$(CONFIG_CSRC_GIC) += csrc-gic.o3031obj-$(CONFIG_SYNC_R4K) += sync-r4k.o31323233obj-$(CONFIG_STACKTRACE) += stacktrace.o···9897obj-$(CONFIG_HW_PERF_EVENTS) += perf_event_mipsxx.o999810099obj-$(CONFIG_JUMP_LABEL) += jump_label.o100100+101101+#102102+# DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is safe103103+# to enable DSP assembler support here even if the MIPS Release 2 CPU we104104+# are targetting does not support DSP because all code-paths making use of105105+# it properly check that the running CPU *actually does* support these106106+# instructions.107107+#108108+ifeq ($(CONFIG_CPU_MIPSR2), y)109109+CFLAGS_DSP = -DHAVE_AS_DSP110110+111111+#112112+# Check if assembler supports DSP ASE113113+#114114+ifeq ($(call cc-option-yn,-mdsp), y)115115+CFLAGS_DSP += -mdsp116116+endif117117+118118+#119119+# Check if assembler supports DSP ASE Rev2120120+#121121+ifeq ($(call cc-option-yn,-mdspr2), y)122122+CFLAGS_DSP += -mdspr2123123+endif124124+125125+CFLAGS_signal.o = $(CFLAGS_DSP)126126+CFLAGS_signal32.o = $(CFLAGS_DSP)127127+CFLAGS_process.o = $(CFLAGS_DSP)128128+CFLAGS_branch.o = $(CFLAGS_DSP)129129+CFLAGS_ptrace.o = $(CFLAGS_DSP)130130+endif101131102132CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
+13-1
arch/mips/kernel/cpu-probe.c
···201201 break;202202203203 case CPU_M14KC:204204+ case CPU_M14KEC:204205 case CPU_24K:205206 case CPU_34K:206207 case CPU_1004K:···468467 c->ases |= MIPS_ASE_MIPSMT;469468 if (config3 & MIPS_CONF3_ULRI)470469 c->options |= MIPS_CPU_ULRI;470470+ if (config3 & MIPS_CONF3_ISA)471471+ c->options |= MIPS_CPU_MICROMIPS;472472+ if (config3 & MIPS_CONF3_VZ)473473+ c->ases |= MIPS_ASE_VZ;471474472475 return config3 & MIPS_CONF_M;473476}···871866 __cpu_name[cpu] = "MIPS 20Kc";872867 break;873868 case PRID_IMP_24K:874874- case PRID_IMP_24KE:875869 c->cputype = CPU_24K;876870 __cpu_name[cpu] = "MIPS 24Kc";871871+ break;872872+ case PRID_IMP_24KE:873873+ c->cputype = CPU_24K;874874+ __cpu_name[cpu] = "MIPS 24KEc";877875 break;878876 case PRID_IMP_25KF:879877 c->cputype = CPU_25KF;···893885 case PRID_IMP_M14KC:894886 c->cputype = CPU_M14KC;895887 __cpu_name[cpu] = "MIPS M14Kc";888888+ break;889889+ case PRID_IMP_M14KEC:890890+ c->cputype = CPU_M14KEC;891891+ __cpu_name[cpu] = "MIPS M14KEc";896892 break;897893 case PRID_IMP_1004K:898894 c->cputype = CPU_1004K;
+49
arch/mips/kernel/csrc-gic.c
···11+/*22+ * This file is subject to the terms and conditions of the GNU General Public33+ * License. See the file "COPYING" in the main directory of this archive44+ * for more details.55+ *66+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.77+ */88+#include <linux/clocksource.h>99+#include <linux/init.h>1010+1111+#include <asm/time.h>1212+#include <asm/gic.h>1313+1414+static cycle_t gic_hpt_read(struct clocksource *cs)1515+{1616+ unsigned int hi, hi2, lo;1717+1818+ do {1919+ GICREAD(GIC_REG(SHARED, GIC_SH_COUNTER_63_32), hi);2020+ GICREAD(GIC_REG(SHARED, GIC_SH_COUNTER_31_00), lo);2121+ GICREAD(GIC_REG(SHARED, GIC_SH_COUNTER_63_32), hi2);2222+ } while (hi2 != hi);2323+2424+ return (((cycle_t) hi) << 32) + lo;2525+}2626+2727+static struct clocksource gic_clocksource = {2828+ .name = "GIC",2929+ .read = gic_hpt_read,3030+ .flags = CLOCK_SOURCE_IS_CONTINUOUS,3131+};3232+3333+void __init gic_clocksource_init(unsigned int frequency)3434+{3535+ unsigned int config, bits;3636+3737+ /* Calculate the clocksource mask. */3838+ GICREAD(GIC_REG(SHARED, GIC_SH_CONFIG), config);3939+ bits = 32 + ((config & GIC_SH_CONFIG_COUNTBITS_MSK) >>4040+ (GIC_SH_CONFIG_COUNTBITS_SHF - 2));4141+4242+ /* Set clocksource mask. */4343+ gic_clocksource.mask = CLOCKSOURCE_MASK(bits);4444+4545+ /* Calculate a somewhat reasonable rating value. */4646+ gic_clocksource.rating = 200 + frequency / 10000000;4747+4848+ clocksource_register_hz(&gic_clocksource, frequency);4949+}
···9595 if (cpu_has_dsp) seq_printf(m, "%s", " dsp");9696 if (cpu_has_dsp2) seq_printf(m, "%s", " dsp2");9797 if (cpu_has_mipsmt) seq_printf(m, "%s", " mt");9898+ if (cpu_has_mmips) seq_printf(m, "%s", " micromips");9999+ if (cpu_has_vz) seq_printf(m, "%s", " vz");98100 seq_printf(m, "\n");99101100102 seq_printf(m, "shadow register sets\t: %d\n",
+70-21
arch/mips/kernel/setup.c
···480480}481481early_param("mem", early_parse_mem);482482483483+#ifdef CONFIG_PROC_VMCORE484484+unsigned long setup_elfcorehdr, setup_elfcorehdr_size;485485+static int __init early_parse_elfcorehdr(char *p)486486+{487487+ int i;488488+489489+ setup_elfcorehdr = memparse(p, &p);490490+491491+ for (i = 0; i < boot_mem_map.nr_map; i++) {492492+ unsigned long start = boot_mem_map.map[i].addr;493493+ unsigned long end = (boot_mem_map.map[i].addr +494494+ boot_mem_map.map[i].size);495495+ if (setup_elfcorehdr >= start && setup_elfcorehdr < end) {496496+ /*497497+ * Reserve from the elf core header to the end of498498+ * the memory segment, that should all be kdump499499+ * reserved memory.500500+ */501501+ setup_elfcorehdr_size = end - setup_elfcorehdr;502502+ break;503503+ }504504+ }505505+ /*506506+ * If we don't find it in the memory map, then we shouldn't507507+ * have to worry about it, as the new kernel won't use it.508508+ */509509+ return 0;510510+}511511+early_param("elfcorehdr", early_parse_elfcorehdr);512512+#endif513513+514514+static void __init arch_mem_addpart(phys_t mem, phys_t end, int type)515515+{516516+ phys_t size;517517+ int i;518518+519519+ size = end - mem;520520+ if (!size)521521+ return;522522+523523+ /* Make sure it is in the boot_mem_map */524524+ for (i = 0; i < boot_mem_map.nr_map; i++) {525525+ if (mem >= boot_mem_map.map[i].addr &&526526+ mem < (boot_mem_map.map[i].addr +527527+ boot_mem_map.map[i].size))528528+ return;529529+ }530530+ add_memory_region(mem, size, type);531531+}532532+483533static void __init arch_mem_init(char **cmdline_p)484534{485485- phys_t init_mem, init_end, init_size;486486-487535 extern void plat_mem_setup(void);488536489537 /* call board setup routine */490538 plat_mem_setup();491539492492- init_mem = PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT;493493- init_end = PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT;494494- init_size = init_end - init_mem;495495- if (init_size) {496496- /* Make sure it is in the boot_mem_map */497497- int i, found;498498- found = 0;499499- for (i = 0; i < boot_mem_map.nr_map; i++) {500500- if (init_mem >= boot_mem_map.map[i].addr &&501501- init_mem < (boot_mem_map.map[i].addr +502502- boot_mem_map.map[i].size)) {503503- found = 1;504504- break;505505- }506506- }507507- if (!found)508508- add_memory_region(init_mem, init_size,509509- BOOT_MEM_INIT_RAM);510510- }540540+ /*541541+ * Make sure all kernel memory is in the maps. The "UP" and542542+ * "DOWN" are opposite for initdata since if it crosses over543543+ * into another memory section you don't want that to be544544+ * freed when the initdata is freed.545545+ */546546+ arch_mem_addpart(PFN_DOWN(__pa_symbol(&_text)) << PAGE_SHIFT,547547+ PFN_UP(__pa_symbol(&_edata)) << PAGE_SHIFT,548548+ BOOT_MEM_RAM);549549+ arch_mem_addpart(PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT,550550+ PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT,551551+ BOOT_MEM_INIT_RAM);511552512553 pr_info("Determined physical RAM map:\n");513554 print_memory_map();···578537 }579538580539 bootmem_init();540540+#ifdef CONFIG_PROC_VMCORE541541+ if (setup_elfcorehdr && setup_elfcorehdr_size) {542542+ printk(KERN_INFO "kdump reserved memory at %lx-%lx\n",543543+ setup_elfcorehdr, setup_elfcorehdr_size);544544+ reserve_bootmem(setup_elfcorehdr, setup_elfcorehdr_size,545545+ BOOTMEM_DEFAULT);546546+ }547547+#endif581548#ifdef CONFIG_KEXEC582549 if (crashk_res.start != crashk_res.end)583550 reserve_bootmem(crashk_res.start,
+1
arch/mips/kernel/smtc.c
···4141#include <asm/addrspace.h>4242#include <asm/smtc.h>4343#include <asm/smtc_proc.h>4444+#include <asm/setup.h>44454546/*4647 * SMTC Kernel needs to manipulate low-level CPU interrupt mask
+3-12
arch/mips/kernel/vpe.c
···697697 dmt_flag = dmt();698698 vpeflags = dvpe();699699700700- if (!list_empty(&v->tc)) {701701- if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) {702702- evpe(vpeflags);703703- emt(dmt_flag);704704- local_irq_restore(flags);705705-706706- printk(KERN_WARNING707707- "VPE loader: TC %d is already in use.\n",708708- v->tc->index);709709- return -ENOEXEC;710710- }711711- } else {700700+ if (list_empty(&v->tc)) {712701 evpe(vpeflags);713702 emt(dmt_flag);714703 local_irq_restore(flags);···708719709720 return -ENOEXEC;710721 }722722+723723+ t = list_first_entry(&v->tc, struct tc, tc);711724712725 /* Put MVPE's into 'configuration state' */713726 set_c0_mvpcontrol(MVPCONTROL_VPC);
+10-2
arch/mips/lantiq/clk.c
···2626#include "prom.h"27272828/* lantiq socs have 3 static clocks */2929-static struct clk cpu_clk_generic[3];2929+static struct clk cpu_clk_generic[4];30303131-void clkdev_add_static(unsigned long cpu, unsigned long fpi, unsigned long io)3131+void clkdev_add_static(unsigned long cpu, unsigned long fpi,3232+ unsigned long io, unsigned long ppe)3233{3334 cpu_clk_generic[0].rate = cpu;3435 cpu_clk_generic[1].rate = fpi;3536 cpu_clk_generic[2].rate = io;3737+ cpu_clk_generic[3].rate = ppe;3638}37393840struct clk *clk_get_cpu(void)···5250{5351 return &cpu_clk_generic[2];5452}5353+5454+struct clk *clk_get_ppe(void)5555+{5656+ return &cpu_clk_generic[3];5757+}5858+EXPORT_SYMBOL_GPL(clk_get_ppe);55595660static inline int clk_good(struct clk *clk)5761{
+6-1
arch/mips/lantiq/clk.h
···2727#define CLOCK_167M 1666666672828#define CLOCK_196_608M 1966080002929#define CLOCK_200M 2000000003030+#define CLOCK_222M 2220000003131+#define CLOCK_240M 2400000003032#define CLOCK_250M 2500000003133#define CLOCK_266M 2666666663234#define CLOCK_300M 3000000003335#define CLOCK_333M 3333333333436#define CLOCK_393M 3932153323537#define CLOCK_400M 4000000003838+#define CLOCK_450M 4500000003639#define CLOCK_500M 5000000003740#define CLOCK_600M 6000000003841···6764};68656966extern void clkdev_add_static(unsigned long cpu, unsigned long fpi,7070- unsigned long io);6767+ unsigned long io, unsigned long ppe);71687269extern unsigned long ltq_danube_cpu_hz(void);7370extern unsigned long ltq_danube_fpi_hz(void);7171+extern unsigned long ltq_danube_pp32_hz(void);74727573extern unsigned long ltq_ar9_cpu_hz(void);7674extern unsigned long ltq_ar9_fpi_hz(void);77757876extern unsigned long ltq_vr9_cpu_hz(void);7977extern unsigned long ltq_vr9_fpi_hz(void);7878+extern unsigned long ltq_vr9_pp32_hz(void);80798180#endif
···3333/* register definitions - external irqs */3434#define LTQ_EIU_EXIN_C 0x00003535#define LTQ_EIU_EXIN_INIC 0x00043636+#define LTQ_EIU_EXIN_INC 0x00083637#define LTQ_EIU_EXIN_INEN 0x000C37383838-/* irq numbers used by the external interrupt unit (EIU) */3939-#define LTQ_EIU_IR0 (INT_NUM_IM4_IRL0 + 30)4040-#define LTQ_EIU_IR1 (INT_NUM_IM3_IRL0 + 31)4141-#define LTQ_EIU_IR2 (INT_NUM_IM1_IRL0 + 26)4242-#define LTQ_EIU_IR3 INT_NUM_IM1_IRL04343-#define LTQ_EIU_IR4 (INT_NUM_IM1_IRL0 + 1)4444-#define LTQ_EIU_IR5 (INT_NUM_IM1_IRL0 + 2)4545-#define LTQ_EIU_IR6 (INT_NUM_IM2_IRL0 + 30)4646-#define XWAY_EXIN_COUNT 33939+/* number of external interrupts */4740#define MAX_EIU 648414942/* the performance counter */···6572int gic_present;6673#endif67746868-static unsigned short ltq_eiu_irq[MAX_EIU] = {6969- LTQ_EIU_IR0,7070- LTQ_EIU_IR1,7171- LTQ_EIU_IR2,7272- LTQ_EIU_IR3,7373- LTQ_EIU_IR4,7474- LTQ_EIU_IR5,7575-};7676-7775static int exin_avail;7676+static struct resource ltq_eiu_irq[MAX_EIU];7877static void __iomem *ltq_icu_membase[MAX_IM];7978static void __iomem *ltq_eiu_membase;8079static struct irq_domain *ltq_domain;8080+8181+int ltq_eiu_get_irq(int exin)8282+{8383+ if (exin < exin_avail)8484+ return ltq_eiu_irq[exin].start;8585+ return -1;8686+}81878288void ltq_disable_irq(struct irq_data *d)8389{···120128 ltq_icu_w32(im, ltq_icu_r32(im, ier) | BIT(offset), ier);121129}122130131131+static int ltq_eiu_settype(struct irq_data *d, unsigned int type)132132+{133133+ int i;134134+135135+ for (i = 0; i < MAX_EIU; i++) {136136+ if (d->hwirq == ltq_eiu_irq[i].start) {137137+ int val = 0;138138+ int edge = 0;139139+140140+ switch (type) {141141+ case IRQF_TRIGGER_NONE:142142+ break;143143+ case IRQF_TRIGGER_RISING:144144+ val = 1;145145+ edge = 1;146146+ break;147147+ case IRQF_TRIGGER_FALLING:148148+ val = 2;149149+ edge = 1;150150+ break;151151+ case IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING:152152+ val = 3;153153+ edge = 1;154154+ break;155155+ case IRQF_TRIGGER_HIGH:156156+ val = 5;157157+ break;158158+ case IRQF_TRIGGER_LOW:159159+ val = 6;160160+ break;161161+ default:162162+ pr_err("invalid type %d for irq %ld\n",163163+ type, d->hwirq);164164+ return -EINVAL;165165+ }166166+167167+ if (edge)168168+ irq_set_handler(d->hwirq, handle_edge_irq);169169+170170+ ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_C) |171171+ (val << (i * 4)), LTQ_EIU_EXIN_C);172172+ }173173+ }174174+175175+ return 0;176176+}177177+123178static unsigned int ltq_startup_eiu_irq(struct irq_data *d)124179{125180 int i;126181127182 ltq_enable_irq(d);128183 for (i = 0; i < MAX_EIU; i++) {129129- if (d->hwirq == ltq_eiu_irq[i]) {130130- /* low level - we should really handle set_type */131131- ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_C) |132132- (0x6 << (i * 4)), LTQ_EIU_EXIN_C);184184+ if (d->hwirq == ltq_eiu_irq[i].start) {185185+ /* by default we are low level triggered */186186+ ltq_eiu_settype(d, IRQF_TRIGGER_LOW);133187 /* clear all pending */134134- ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INIC) & ~BIT(i),135135- LTQ_EIU_EXIN_INIC);188188+ ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INC) & ~BIT(i),189189+ LTQ_EIU_EXIN_INC);136190 /* enable */137191 ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) | BIT(i),138192 LTQ_EIU_EXIN_INEN);···195157196158 ltq_disable_irq(d);197159 for (i = 0; i < MAX_EIU; i++) {198198- if (d->hwirq == ltq_eiu_irq[i]) {160160+ if (d->hwirq == ltq_eiu_irq[i].start) {199161 /* disable */200162 ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~BIT(i),201163 LTQ_EIU_EXIN_INEN);···224186 .irq_ack = ltq_ack_irq,225187 .irq_mask = ltq_disable_irq,226188 .irq_mask_ack = ltq_mask_and_ack_irq,189189+ .irq_set_type = ltq_eiu_settype,227190};228191229192static void ltq_hw_irqdispatch(int module)···340301 return 0;341302342303 for (i = 0; i < exin_avail; i++)343343- if (hw == ltq_eiu_irq[i])304304+ if (hw == ltq_eiu_irq[i].start)344305 chip = <q_eiu_type;345306346307 irq_set_chip_and_handler(hw, chip, handle_level_irq);···362323{363324 struct device_node *eiu_node;364325 struct resource res;365365- int i;326326+ int i, ret;366327367328 for (i = 0; i < MAX_IM; i++) {368329 if (of_address_to_resource(node, i, &res))···379340 }380341381342 /* the external interrupts are optional and xway only */382382- eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu");343343+ eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway");383344 if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) {384345 /* find out how many external irq sources we have */385385- const __be32 *count = of_get_property(node,386386- "lantiq,count", NULL);346346+ exin_avail = of_irq_count(eiu_node);387347388388- if (count)389389- exin_avail = *count;390348 if (exin_avail > MAX_EIU)391349 exin_avail = MAX_EIU;350350+351351+ ret = of_irq_to_resource_table(eiu_node,352352+ ltq_eiu_irq, exin_avail);353353+ if (ret != exin_avail)354354+ panic("failed to load external irq resources\n");392355393356 if (request_mem_region(res.start, resource_size(&res),394357 res.name) < 0)
+43
arch/mips/lantiq/xway/clk.c
···5353 }5454}55555656+unsigned long ltq_danube_pp32_hz(void)5757+{5858+ unsigned int clksys = (ltq_cgu_r32(CGU_SYS) >> 7) & 3;5959+ unsigned long clk;6060+6161+ switch (clksys) {6262+ case 1:6363+ clk = CLOCK_240M;6464+ break;6565+ case 2:6666+ clk = CLOCK_222M;6767+ break;6868+ case 3:6969+ clk = CLOCK_133M;7070+ break;7171+ default:7272+ clk = CLOCK_266M;7373+ break;7474+ }7575+7676+ return clk;7777+}7878+5679unsigned long ltq_ar9_sys_hz(void)5780{5881 if (((ltq_cgu_r32(CGU_SYS) >> 3) & 0x3) == 0x2)···167144 break;168145 default:169146 clk = 0;147147+ break;148148+ }149149+150150+ return clk;151151+}152152+153153+unsigned long ltq_vr9_pp32_hz(void)154154+{155155+ unsigned int clksys = (ltq_cgu_r32(CGU_SYS) >> 16) & 3;156156+ unsigned long clk;157157+158158+ switch (clksys) {159159+ case 1:160160+ clk = CLOCK_450M;161161+ break;162162+ case 2:163163+ clk = CLOCK_300M;164164+ break;165165+ default:166166+ clk = CLOCK_500M;170167 break;171168 }172169
+9
arch/mips/lantiq/xway/reset.c
···7878/* reset and boot a gphy. these phys only exist on xrx200 SoC */7979int xrx200_gphy_boot(struct device *dev, unsigned int id, dma_addr_t dev_addr)8080{8181+ struct clk *clk;8282+8183 if (!of_device_is_compatible(ltq_rcu_np, "lantiq,rcu-xrx200")) {8284 dev_err(dev, "this SoC has no GPHY\n");8385 return -EINVAL;8486 }8787+8888+ clk = clk_get_sys("1f203000.rcu", "gphy");8989+ if (IS_ERR(clk))9090+ return PTR_ERR(clk);9191+9292+ clk_enable(clk);9393+8594 if (id > 1) {8695 dev_err(dev, "%u is an invalid gphy id\n", id);8796 return -EINVAL;
+9-6
arch/mips/lantiq/xway/sysctrl.c
···305305306306 /* check if all the core register ranges are available */307307 if (!np_pmu || !np_cgu || !np_ebu)308308- panic("Failed to load core nodess from devicetree");308308+ panic("Failed to load core nodes from devicetree");309309310310 if (of_address_to_resource(np_pmu, 0, &res_pmu) ||311311 of_address_to_resource(np_cgu, 0, &res_cgu) ||···356356357357 if (of_machine_is_compatible("lantiq,ase")) {358358 if (ltq_cgu_r32(CGU_SYS) & (1 << 5))359359- clkdev_add_static(CLOCK_266M, CLOCK_133M, CLOCK_133M);359359+ clkdev_add_static(CLOCK_266M, CLOCK_133M,360360+ CLOCK_133M, CLOCK_266M);360361 else361361- clkdev_add_static(CLOCK_133M, CLOCK_133M, CLOCK_133M);362362+ clkdev_add_static(CLOCK_133M, CLOCK_133M,363363+ CLOCK_133M, CLOCK_133M);362364 clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY),363365 clkdev_add_pmu("1e180000.etop", "ephy", 0, PMU_EPHY);364366 } else if (of_machine_is_compatible("lantiq,vr9")) {365367 clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(),366366- ltq_vr9_fpi_hz());368368+ ltq_vr9_fpi_hz(), ltq_vr9_pp32_hz());367369 clkdev_add_pmu("1d900000.pcie", "phy", 1, PMU1_PCIE_PHY);368370 clkdev_add_pmu("1d900000.pcie", "bus", 0, PMU_PCIE_CLK);369371 clkdev_add_pmu("1d900000.pcie", "msi", 1, PMU1_PCIE_MSI);···376374 PMU_SWITCH | PMU_PPE_DPLUS | PMU_PPE_DPLUM |377375 PMU_PPE_EMA | PMU_PPE_TC | PMU_PPE_SLL01 |378376 PMU_PPE_QSB | PMU_PPE_TOP);377377+ clkdev_add_pmu("1f203000.rcu", "gphy", 0, PMU_GPHY);379378 } else if (of_machine_is_compatible("lantiq,ar9")) {380379 clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(),381381- ltq_ar9_fpi_hz());380380+ ltq_ar9_fpi_hz(), CLOCK_250M);382381 clkdev_add_pmu("1e180000.etop", "switch", 0, PMU_SWITCH);383382 } else {384383 clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(),385385- ltq_danube_fpi_hz());384384+ ltq_danube_fpi_hz(), ltq_danube_pp32_hz());386385 }387386}
···5151#include <asm/netlogic/xlp-hal/xlp.h>5252#include <asm/netlogic/xlp-hal/sys.h>53535454-static int xlp_wakeup_core(uint64_t sysbase, int core)5454+static int xlp_wakeup_core(uint64_t sysbase, int node, int core)5555{5656 uint32_t coremask, value;5757 int count;···8282 struct nlm_soc_info *nodep;8383 uint64_t syspcibase;8484 uint32_t syscoremask;8585- int core, n, cpu;8585+ int core, n, cpu, count, val;86868787 for (n = 0; n < NLM_NR_NODES; n++) {8888 syspcibase = nlm_get_sys_pcibase(n);8989 if (nlm_read_reg(syspcibase, 0) == 0xffffffff)9090 break;91919292- /* read cores in reset from SYS and account for boot cpu */9393- nlm_node_init(n);9292+ /* read cores in reset from SYS */9393+ if (n != 0)9494+ nlm_node_init(n);9495 nodep = nlm_get_node(n);9596 syscoremask = nlm_read_sys_reg(nodep->sysbase, SYS_CPU_RESET);9696- if (n == 0)9797+ /* The boot cpu */9898+ if (n == 0) {9799 syscoremask |= 1;100100+ nodep->coremask = 1;101101+ }9810299103 for (core = 0; core < NLM_CORES_PER_NODE; core++) {104104+ /* we will be on node 0 core 0 */105105+ if (n == 0 && core == 0)106106+ continue;107107+100108 /* see if the core exists */101109 if ((syscoremask & (1 << core)) == 0)102110 continue;103111104104- /* see if at least the first thread is enabled */112112+ /* see if at least the first hw thread is enabled */105113 cpu = (n * NLM_CORES_PER_NODE + core)106114 * NLM_THREADS_PER_CORE;107115 if (!cpumask_test_cpu(cpu, wakeup_mask))108116 continue;109117110118 /* wake up the core */111111- if (xlp_wakeup_core(nodep->sysbase, core))112112- nodep->coremask |= 1u << core;113113- else114114- pr_err("Failed to enable core %d\n", core);119119+ if (!xlp_wakeup_core(nodep->sysbase, n, core))120120+ continue;121121+122122+ /* core is up */123123+ nodep->coremask |= 1u << core;124124+125125+ /* spin until the first hw thread sets its ready */126126+ count = 0x20000000;127127+ do {128128+ val = *(volatile int *)&nlm_cpu_ready[cpu];129129+ } while (val == 0 && --count > 0);115130 }116131 }117132}
+2
arch/mips/netlogic/xlr/fmn-config.c
···216216 case PRID_IMP_NETLOGIC_XLS404B:217217 case PRID_IMP_NETLOGIC_XLS408B:218218 case PRID_IMP_NETLOGIC_XLS416B:219219+ case PRID_IMP_NETLOGIC_XLS608B:220220+ case PRID_IMP_NETLOGIC_XLS616B:219221 setup_fmn_cc(&gmac[0], FMN_STNID_GMAC0,220222 FMN_STNID_GMAC0_TX3, 8, 8, 32);221223 setup_fmn_cc(&gmac[1], FMN_STNID_GMAC1_FR_0,
···7878 switch (current_cpu_type()) {7979 case CPU_5KC:8080 case CPU_M14KC:8181+ case CPU_M14KEC:8182 case CPU_20KC:8283 case CPU_24K:8384 case CPU_25KF:
+4
arch/mips/oprofile/op_model_mipsxx.c
···351351 op_model_mipsxx_ops.cpu_type = "mips/M14Kc";352352 break;353353354354+ case CPU_M14KEC:355355+ op_model_mipsxx_ops.cpu_type = "mips/M14KEc";356356+ break;357357+354358 case CPU_20KC:355359 op_model_mipsxx_ops.cpu_type = "mips/20K";356360 break;
···99 * by the Free Software Foundation.1010 */11111212+#include <linux/spinlock.h>1213#include <linux/irq.h>1314#include <linux/pci.h>1515+#include <linux/module.h>1616+#include <linux/platform_device.h>1417#include <asm/mach-ath79/ath79.h>1518#include <asm/mach-ath79/ar71xx_regs.h>1616-#include <asm/mach-ath79/pci.h>1717-1818-#define AR724X_PCI_CFG_BASE 0x140000001919-#define AR724X_PCI_CFG_SIZE 0x10002020-#define AR724X_PCI_CTRL_BASE (AR71XX_APB_BASE + 0x000f0000)2121-#define AR724X_PCI_CTRL_SIZE 0x1002222-2323-#define AR724X_PCI_MEM_BASE 0x100000002424-#define AR724X_PCI_MEM_SIZE 0x0400000025192620#define AR724X_PCI_REG_RESET 0x182721#define AR724X_PCI_REG_INT_STATUS 0x4c···29353036#define AR7240_BAR0_WAR_VALUE 0xffff31373232-static DEFINE_SPINLOCK(ar724x_pci_lock);3333-static void __iomem *ar724x_pci_devcfg_base;3434-static void __iomem *ar724x_pci_ctrl_base;3838+#define AR724X_PCI_CMD_INIT (PCI_COMMAND_MEMORY | \3939+ PCI_COMMAND_MASTER | \4040+ PCI_COMMAND_INVALIDATE | \4141+ PCI_COMMAND_PARITY | \4242+ PCI_COMMAND_SERR | \4343+ PCI_COMMAND_FAST_BACK)35443636-static u32 ar724x_pci_bar0_value;3737-static bool ar724x_pci_bar0_is_cached;3838-static bool ar724x_pci_link_up;4545+struct ar724x_pci_controller {4646+ void __iomem *devcfg_base;4747+ void __iomem *ctrl_base;4848+ void __iomem *crp_base;39494040-static inline bool ar724x_pci_check_link(void)5050+ int irq;5151+ int irq_base;5252+5353+ bool link_up;5454+ bool bar0_is_cached;5555+ u32 bar0_value;5656+5757+ spinlock_t lock;5858+5959+ struct pci_controller pci_controller;6060+ struct resource io_res;6161+ struct resource mem_res;6262+};6363+6464+static inline bool ar724x_pci_check_link(struct ar724x_pci_controller *apc)4165{4266 u32 reset;43674444- reset = __raw_readl(ar724x_pci_ctrl_base + AR724X_PCI_REG_RESET);6868+ reset = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_RESET);4569 return reset & AR724X_PCI_RESET_LINK_UP;7070+}7171+7272+static inline struct ar724x_pci_controller *7373+pci_bus_to_ar724x_controller(struct pci_bus *bus)7474+{7575+ struct pci_controller *hose;7676+7777+ hose = (struct pci_controller *) bus->sysdata;7878+ return container_of(hose, struct ar724x_pci_controller, pci_controller);7979+}8080+8181+static int ar724x_pci_local_write(struct ar724x_pci_controller *apc,8282+ int where, int size, u32 value)8383+{8484+ unsigned long flags;8585+ void __iomem *base;8686+ u32 data;8787+ int s;8888+8989+ WARN_ON(where & (size - 1));9090+9191+ if (!apc->link_up)9292+ return PCIBIOS_DEVICE_NOT_FOUND;9393+9494+ base = apc->crp_base;9595+9696+ spin_lock_irqsave(&apc->lock, flags);9797+ data = __raw_readl(base + (where & ~3));9898+9999+ switch (size) {100100+ case 1:101101+ s = ((where & 3) * 8);102102+ data &= ~(0xff << s);103103+ data |= ((value & 0xff) << s);104104+ break;105105+ case 2:106106+ s = ((where & 2) * 8);107107+ data &= ~(0xffff << s);108108+ data |= ((value & 0xffff) << s);109109+ break;110110+ case 4:111111+ data = value;112112+ break;113113+ default:114114+ spin_unlock_irqrestore(&apc->lock, flags);115115+ return PCIBIOS_BAD_REGISTER_NUMBER;116116+ }117117+118118+ __raw_writel(data, base + (where & ~3));119119+ /* flush write */120120+ __raw_readl(base + (where & ~3));121121+ spin_unlock_irqrestore(&apc->lock, flags);122122+123123+ return PCIBIOS_SUCCESSFUL;46124}4712548126static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,49127 int size, uint32_t *value)50128{129129+ struct ar724x_pci_controller *apc;51130 unsigned long flags;52131 void __iomem *base;53132 u32 data;541335555- if (!ar724x_pci_link_up)134134+ apc = pci_bus_to_ar724x_controller(bus);135135+ if (!apc->link_up)56136 return PCIBIOS_DEVICE_NOT_FOUND;5713758138 if (devfn)59139 return PCIBIOS_DEVICE_NOT_FOUND;601406161- base = ar724x_pci_devcfg_base;141141+ base = apc->devcfg_base;621426363- spin_lock_irqsave(&ar724x_pci_lock, flags);143143+ spin_lock_irqsave(&apc->lock, flags);64144 data = __raw_readl(base + (where & ~3));6514566146 switch (size) {···15385 case 4:15486 break;15587 default:156156- spin_unlock_irqrestore(&ar724x_pci_lock, flags);8888+ spin_unlock_irqrestore(&apc->lock, flags);1578915890 return PCIBIOS_BAD_REGISTER_NUMBER;15991 }16092161161- spin_unlock_irqrestore(&ar724x_pci_lock, flags);9393+ spin_unlock_irqrestore(&apc->lock, flags);1629416395 if (where == PCI_BASE_ADDRESS_0 && size == 4 &&164164- ar724x_pci_bar0_is_cached) {9696+ apc->bar0_is_cached) {16597 /* use the cached value */166166- *value = ar724x_pci_bar0_value;9898+ *value = apc->bar0_value;16799 } else {168100 *value = data;169101 }···174106static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where,175107 int size, uint32_t value)176108{109109+ struct ar724x_pci_controller *apc;177110 unsigned long flags;178111 void __iomem *base;179112 u32 data;180113 int s;181114182182- if (!ar724x_pci_link_up)115115+ apc = pci_bus_to_ar724x_controller(bus);116116+ if (!apc->link_up)183117 return PCIBIOS_DEVICE_NOT_FOUND;184118185119 if (devfn)···199129 * BAR0 register in order to make the device memory200130 * accessible.201131 */202202- ar724x_pci_bar0_is_cached = true;203203- ar724x_pci_bar0_value = value;132132+ apc->bar0_is_cached = true;133133+ apc->bar0_value = value;204134205135 value = AR7240_BAR0_WAR_VALUE;206136 } else {207207- ar724x_pci_bar0_is_cached = false;137137+ apc->bar0_is_cached = false;208138 }209139 }210140211211- base = ar724x_pci_devcfg_base;141141+ base = apc->devcfg_base;212142213213- spin_lock_irqsave(&ar724x_pci_lock, flags);143143+ spin_lock_irqsave(&apc->lock, flags);214144 data = __raw_readl(base + (where & ~3));215145216146 switch (size) {···228158 data = value;229159 break;230160 default:231231- spin_unlock_irqrestore(&ar724x_pci_lock, flags);161161+ spin_unlock_irqrestore(&apc->lock, flags);232162233163 return PCIBIOS_BAD_REGISTER_NUMBER;234164 }···236166 __raw_writel(data, base + (where & ~3));237167 /* flush write */238168 __raw_readl(base + (where & ~3));239239- spin_unlock_irqrestore(&ar724x_pci_lock, flags);169169+ spin_unlock_irqrestore(&apc->lock, flags);240170241171 return PCIBIOS_SUCCESSFUL;242172}···246176 .write = ar724x_pci_write,247177};248178249249-static struct resource ar724x_io_resource = {250250- .name = "PCI IO space",251251- .start = 0,252252- .end = 0,253253- .flags = IORESOURCE_IO,254254-};255255-256256-static struct resource ar724x_mem_resource = {257257- .name = "PCI memory space",258258- .start = AR724X_PCI_MEM_BASE,259259- .end = AR724X_PCI_MEM_BASE + AR724X_PCI_MEM_SIZE - 1,260260- .flags = IORESOURCE_MEM,261261-};262262-263263-static struct pci_controller ar724x_pci_controller = {264264- .pci_ops = &ar724x_pci_ops,265265- .io_resource = &ar724x_io_resource,266266- .mem_resource = &ar724x_mem_resource,267267-};268268-269179static void ar724x_pci_irq_handler(unsigned int irq, struct irq_desc *desc)270180{181181+ struct ar724x_pci_controller *apc;271182 void __iomem *base;272183 u32 pending;273184274274- base = ar724x_pci_ctrl_base;185185+ apc = irq_get_handler_data(irq);186186+ base = apc->ctrl_base;275187276188 pending = __raw_readl(base + AR724X_PCI_REG_INT_STATUS) &277189 __raw_readl(base + AR724X_PCI_REG_INT_MASK);278190279191 if (pending & AR724X_PCI_INT_DEV0)280280- generic_handle_irq(ATH79_PCI_IRQ(0));192192+ generic_handle_irq(apc->irq_base + 0);281193282194 else283195 spurious_interrupt();···267215268216static void ar724x_pci_irq_unmask(struct irq_data *d)269217{218218+ struct ar724x_pci_controller *apc;270219 void __iomem *base;220220+ int offset;271221 u32 t;272222273273- base = ar724x_pci_ctrl_base;223223+ apc = irq_data_get_irq_chip_data(d);224224+ base = apc->ctrl_base;225225+ offset = apc->irq_base - d->irq;274226275275- switch (d->irq) {276276- case ATH79_PCI_IRQ(0):227227+ switch (offset) {228228+ case 0:277229 t = __raw_readl(base + AR724X_PCI_REG_INT_MASK);278230 __raw_writel(t | AR724X_PCI_INT_DEV0,279231 base + AR724X_PCI_REG_INT_MASK);···288232289233static void ar724x_pci_irq_mask(struct irq_data *d)290234{235235+ struct ar724x_pci_controller *apc;291236 void __iomem *base;237237+ int offset;292238 u32 t;293239294294- base = ar724x_pci_ctrl_base;240240+ apc = irq_data_get_irq_chip_data(d);241241+ base = apc->ctrl_base;242242+ offset = apc->irq_base - d->irq;295243296296- switch (d->irq) {297297- case ATH79_PCI_IRQ(0):244244+ switch (offset) {245245+ case 0:298246 t = __raw_readl(base + AR724X_PCI_REG_INT_MASK);299247 __raw_writel(t & ~AR724X_PCI_INT_DEV0,300248 base + AR724X_PCI_REG_INT_MASK);···322262 .irq_mask_ack = ar724x_pci_irq_mask,323263};324264325325-static void __init ar724x_pci_irq_init(int irq)265265+static void ar724x_pci_irq_init(struct ar724x_pci_controller *apc,266266+ int id)326267{327268 void __iomem *base;328269 int i;329270330330- base = ar724x_pci_ctrl_base;271271+ base = apc->ctrl_base;331272332273 __raw_writel(0, base + AR724X_PCI_REG_INT_MASK);333274 __raw_writel(0, base + AR724X_PCI_REG_INT_STATUS);334275335335- BUILD_BUG_ON(ATH79_PCI_IRQ_COUNT < AR724X_PCI_IRQ_COUNT);276276+ apc->irq_base = ATH79_PCI_IRQ_BASE + (id * AR724X_PCI_IRQ_COUNT);336277337337- for (i = ATH79_PCI_IRQ_BASE;338338- i < ATH79_PCI_IRQ_BASE + AR724X_PCI_IRQ_COUNT; i++)278278+ for (i = apc->irq_base;279279+ i < apc->irq_base + AR724X_PCI_IRQ_COUNT; i++) {339280 irq_set_chip_and_handler(i, &ar724x_pci_irq_chip,340281 handle_level_irq);282282+ irq_set_chip_data(i, apc);283283+ }341284342342- irq_set_chained_handler(irq, ar724x_pci_irq_handler);285285+ irq_set_handler_data(apc->irq, apc);286286+ irq_set_chained_handler(apc->irq, ar724x_pci_irq_handler);343287}344288345345-int __init ar724x_pcibios_init(int irq)289289+static int ar724x_pci_probe(struct platform_device *pdev)346290{347347- int ret;291291+ struct ar724x_pci_controller *apc;292292+ struct resource *res;293293+ int id;348294349349- ret = -ENOMEM;295295+ id = pdev->id;296296+ if (id == -1)297297+ id = 0;350298351351- ar724x_pci_devcfg_base = ioremap(AR724X_PCI_CFG_BASE,352352- AR724X_PCI_CFG_SIZE);353353- if (ar724x_pci_devcfg_base == NULL)354354- goto err;299299+ apc = devm_kzalloc(&pdev->dev, sizeof(struct ar724x_pci_controller),300300+ GFP_KERNEL);301301+ if (!apc)302302+ return -ENOMEM;355303356356- ar724x_pci_ctrl_base = ioremap(AR724X_PCI_CTRL_BASE,357357- AR724X_PCI_CTRL_SIZE);358358- if (ar724x_pci_ctrl_base == NULL)359359- goto err_unmap_devcfg;304304+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl_base");305305+ if (!res)306306+ return -EINVAL;360307361361- ar724x_pci_link_up = ar724x_pci_check_link();362362- if (!ar724x_pci_link_up)363363- pr_warn("ar724x: PCIe link is down\n");308308+ apc->ctrl_base = devm_request_and_ioremap(&pdev->dev, res);309309+ if (apc->ctrl_base == NULL)310310+ return -EBUSY;364311365365- ar724x_pci_irq_init(irq);366366- register_pci_controller(&ar724x_pci_controller);312312+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");313313+ if (!res)314314+ return -EINVAL;367315368368- return PCIBIOS_SUCCESSFUL;316316+ apc->devcfg_base = devm_request_and_ioremap(&pdev->dev, res);317317+ if (!apc->devcfg_base)318318+ return -EBUSY;369319370370-err_unmap_devcfg:371371- iounmap(ar724x_pci_devcfg_base);372372-err:373373- return ret;320320+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crp_base");321321+ if (!res)322322+ return -EINVAL;323323+324324+ apc->crp_base = devm_request_and_ioremap(&pdev->dev, res);325325+ if (apc->crp_base == NULL)326326+ return -EBUSY;327327+328328+ apc->irq = platform_get_irq(pdev, 0);329329+ if (apc->irq < 0)330330+ return -EINVAL;331331+332332+ spin_lock_init(&apc->lock);333333+334334+ res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base");335335+ if (!res)336336+ return -EINVAL;337337+338338+ apc->io_res.parent = res;339339+ apc->io_res.name = "PCI IO space";340340+ apc->io_res.start = res->start;341341+ apc->io_res.end = res->end;342342+ apc->io_res.flags = IORESOURCE_IO;343343+344344+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base");345345+ if (!res)346346+ return -EINVAL;347347+348348+ apc->mem_res.parent = res;349349+ apc->mem_res.name = "PCI memory space";350350+ apc->mem_res.start = res->start;351351+ apc->mem_res.end = res->end;352352+ apc->mem_res.flags = IORESOURCE_MEM;353353+354354+ apc->pci_controller.pci_ops = &ar724x_pci_ops;355355+ apc->pci_controller.io_resource = &apc->io_res;356356+ apc->pci_controller.mem_resource = &apc->mem_res;357357+358358+ apc->link_up = ar724x_pci_check_link(apc);359359+ if (!apc->link_up)360360+ dev_warn(&pdev->dev, "PCIe link is down\n");361361+362362+ ar724x_pci_irq_init(apc, id);363363+364364+ ar724x_pci_local_write(apc, PCI_COMMAND, 4, AR724X_PCI_CMD_INIT);365365+366366+ register_pci_controller(&apc->pci_controller);367367+368368+ return 0;374369}370370+371371+static struct platform_driver ar724x_pci_driver = {372372+ .probe = ar724x_pci_probe,373373+ .driver = {374374+ .name = "ar724x-pci",375375+ .owner = THIS_MODULE,376376+ },377377+};378378+379379+static int __init ar724x_pci_init(void)380380+{381381+ return platform_driver_register(&ar724x_pci_driver);382382+}383383+384384+postcore_initcall(ar724x_pci_init);
+10-2
arch/mips/pci/pci-lantiq.c
···129129130130 /* setup reset gpio used by pci */131131 reset_gpio = of_get_named_gpio(node, "gpio-reset", 0);132132- if (gpio_is_valid(reset_gpio))133133- devm_gpio_request(&pdev->dev, reset_gpio, "pci-reset");132132+ if (gpio_is_valid(reset_gpio)) {133133+ int ret = devm_gpio_request(&pdev->dev,134134+ reset_gpio, "pci-reset");135135+ if (ret) {136136+ dev_err(&pdev->dev,137137+ "failed to request gpio %d\n", reset_gpio);138138+ return ret;139139+ }140140+ gpio_direction_output(reset_gpio, 1);141141+ }134142135143 /* enable auto-switching between PCI and EBU */136144 ltq_pci_w32(0xa, PCI_CR_CLK_CTRL);
+80-44
arch/mips/pci/pci-xlp.c
···46464747#include <asm/netlogic/interrupt.h>4848#include <asm/netlogic/haldefs.h>4949+#include <asm/netlogic/common.h>49505051#include <asm/netlogic/xlp-hal/iomap.h>5152#include <asm/netlogic/xlp-hal/pic.h>···6564 u32 data;6665 u32 *cfgaddr;67666767+ where &= ~3;6868+ if (bus->number == 0 && PCI_SLOT(devfn) == 1 && where == 0x954)6969+ return 0xffffffff;7070+6871 cfgaddr = (u32 *)(pci_config_base +6969- pci_cfg_addr(bus->number, devfn, where & ~3));7272+ pci_cfg_addr(bus->number, devfn, where));7073 data = *cfgaddr;7174 return data;7275}···162157 .io_offset = 0x00000000UL,163158};164159165165-static int get_irq_vector(const struct pci_dev *dev)160160+static struct pci_dev *xlp_get_pcie_link(const struct pci_dev *dev)166161{167167- /*168168- * For XLP PCIe, there is an IRQ per Link, find out which169169- * link the device is on to assign interrupts170170- */171171- if (dev->bus->self == NULL)172172- return 0;162162+ struct pci_bus *bus, *p;173163174174- switch (dev->bus->self->devfn) {175175- case 0x8:176176- return PIC_PCIE_LINK_0_IRQ;177177- case 0x9:178178- return PIC_PCIE_LINK_1_IRQ;179179- case 0xa:180180- return PIC_PCIE_LINK_2_IRQ;181181- case 0xb:182182- return PIC_PCIE_LINK_3_IRQ;183183- }184184- WARN(1, "Unexpected devfn %d\n", dev->bus->self->devfn);185185- return 0;164164+ /* Find the bridge on bus 0 */165165+ bus = dev->bus;166166+ for (p = bus->parent; p && p->number != 0; p = p->parent)167167+ bus = p;168168+169169+ return p ? bus->self : NULL;170170+}171171+172172+static inline int nlm_pci_link_to_irq(int link)173173+{174174+ return PIC_PCIE_LINK_0_IRQ + link;186175}187176188177int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)189178{190190- return get_irq_vector(dev);179179+ struct pci_dev *lnkdev;180180+ int lnkslot, lnkfunc;181181+182182+ /*183183+ * For XLP PCIe, there is an IRQ per Link, find out which184184+ * link the device is on to assign interrupts185185+ */186186+ lnkdev = xlp_get_pcie_link(dev);187187+ if (lnkdev == NULL)188188+ return 0;189189+ lnkfunc = PCI_FUNC(lnkdev->devfn);190190+ lnkslot = PCI_SLOT(lnkdev->devfn);191191+ return nlm_irq_to_xirq(lnkslot / 8, nlm_pci_link_to_irq(lnkfunc));191192}192193193194/* Do platform specific device initialization at pci_enable_device() time */···202191 return 0;203192}204193205205-static int xlp_enable_pci_bswap(void)194194+/*195195+ * If big-endian, enable hardware byteswap on the PCIe bridges.196196+ * This will make both the SoC and PCIe devices behave consistently with197197+ * readl/writel.198198+ */199199+#ifdef __BIG_ENDIAN200200+static void xlp_config_pci_bswap(int node, int link)206201{207207- uint64_t pciebase, sysbase;208208- int node, i;202202+ uint64_t nbubase, lnkbase;209203 u32 reg;210204211211- /* Chip-0 so node set to 0 */212212- node = 0;213213- sysbase = nlm_get_bridge_regbase(node);205205+ nbubase = nlm_get_bridge_regbase(node);206206+ lnkbase = nlm_get_pcie_base(node, link);207207+214208 /*215209 * Enable byte swap in hardware. Program each link's PCIe SWAP regions216210 * from the link's address ranges.217211 */218218- for (i = 0; i < 4; i++) {219219- pciebase = nlm_pcicfg_base(XLP_IO_PCIE_OFFSET(node, i));220220- if (nlm_read_pci_reg(pciebase, 0) == 0xffffffff)221221- continue;212212+ reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEMEM_BASE0 + link);213213+ nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_MEM_BASE, reg);222214223223- reg = nlm_read_bridge_reg(sysbase, BRIDGE_PCIEMEM_BASE0 + i);224224- nlm_write_pci_reg(pciebase, PCIE_BYTE_SWAP_MEM_BASE, reg);215215+ reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEMEM_LIMIT0 + link);216216+ nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_MEM_LIM, reg | 0xfff);225217226226- reg = nlm_read_bridge_reg(sysbase, BRIDGE_PCIEMEM_LIMIT0 + i);227227- nlm_write_pci_reg(pciebase, PCIE_BYTE_SWAP_MEM_LIM,228228- reg | 0xfff);218218+ reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEIO_BASE0 + link);219219+ nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_IO_BASE, reg);229220230230- reg = nlm_read_bridge_reg(sysbase, BRIDGE_PCIEIO_BASE0 + i);231231- nlm_write_pci_reg(pciebase, PCIE_BYTE_SWAP_IO_BASE, reg);232232-233233- reg = nlm_read_bridge_reg(sysbase, BRIDGE_PCIEIO_LIMIT0 + i);234234- nlm_write_pci_reg(pciebase, PCIE_BYTE_SWAP_IO_LIM, reg | 0xfff);235235- }236236- return 0;221221+ reg = nlm_read_bridge_reg(nbubase, BRIDGE_PCIEIO_LIMIT0 + link);222222+ nlm_write_pci_reg(lnkbase, PCIE_BYTE_SWAP_IO_LIM, reg | 0xfff);237223}224224+#else225225+/* Swap configuration not needed in little-endian mode */226226+static inline void xlp_config_pci_bswap(int node, int link) {}227227+#endif /* __BIG_ENDIAN */238228239229static int __init pcibios_init(void)240230{231231+ struct nlm_soc_info *nodep;232232+ uint64_t pciebase;233233+ int link, n;234234+ u32 reg;235235+241236 /* Firmware assigns PCI resources */242237 pci_set_flags(PCI_PROBE_ONLY);243238 pci_config_base = ioremap(XLP_DEFAULT_PCI_ECFG_BASE, 64 << 20);···252235 ioport_resource.start = 0;253236 ioport_resource.end = ~0;254237255255- xlp_enable_pci_bswap();238238+ for (n = 0; n < NLM_NR_NODES; n++) {239239+ nodep = nlm_get_node(n);240240+ if (!nodep->coremask)241241+ continue; /* node does not exist */242242+243243+ for (link = 0; link < 4; link++) {244244+ pciebase = nlm_get_pcie_base(n, link);245245+ if (nlm_read_pci_reg(pciebase, 0) == 0xffffffff)246246+ continue;247247+ xlp_config_pci_bswap(n, link);248248+249249+ /* put in intpin and irq - u-boot does not */250250+ reg = nlm_read_pci_reg(pciebase, 0xf);251251+ reg &= ~0x1fu;252252+ reg |= (1 << 8) | nlm_pci_link_to_irq(link);253253+ nlm_write_pci_reg(pciebase, 0xf, reg);254254+ pr_info("XLP PCIe: Link %d-%d initialized.\n", n, link);255255+ }256256+ }257257+256258 set_io_port_base(CKSEG1);257259 nlm_pci_controller.io_map_base = CKSEG1;258260
+13-2
arch/mips/pci/pci.c
···175175176176void register_pci_controller(struct pci_controller *hose)177177{178178- if (request_resource(&iomem_resource, hose->mem_resource) < 0)178178+ struct resource *parent;179179+180180+ parent = hose->mem_resource->parent;181181+ if (!parent)182182+ parent = &iomem_resource;183183+184184+ if (request_resource(parent, hose->mem_resource) < 0)179185 goto out;180180- if (request_resource(&ioport_resource, hose->io_resource) < 0) {186186+187187+ parent = hose->io_resource->parent;188188+ if (!parent)189189+ parent = &ioport_resource;190190+191191+ if (request_resource(parent, hose->io_resource) < 0) {181192 release_resource(hose->mem_resource);182193 goto out;183194 }
···11+# This program is free software; you can redistribute it and/or modify it22+# under the terms of the GNU General Public License version 2 as published33+# by the Free Software Foundation.#44+# Makefile for the Ralink common stuff55+#66+# Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org>77+# Copyright (C) 2013 John Crispin <blogic@openwrt.org>88+99+obj-y := prom.o of.o reset.o clk.o irq.o1010+1111+obj-$(CONFIG_SOC_RT305X) += rt305x.o1212+1313+obj-$(CONFIG_EARLY_PRINTK) += early_printk.o1414+1515+obj-y += dts/
···11+/*22+ * This program is free software; you can redistribute it and/or modify it33+ * under the terms of the GNU General Public License version 2 as published44+ * by the Free Software Foundation.55+ *66+ * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>77+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>88+ */99+1010+#include <linux/kernel.h>1111+#include <linux/module.h>1212+#include <linux/clkdev.h>1313+#include <linux/clk.h>1414+1515+#include <asm/time.h>1616+1717+#include "common.h"1818+1919+struct clk {2020+ struct clk_lookup cl;2121+ unsigned long rate;2222+};2323+2424+void ralink_clk_add(const char *dev, unsigned long rate)2525+{2626+ struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);2727+2828+ if (!clk)2929+ panic("failed to add clock\n");3030+3131+ clk->cl.dev_id = dev;3232+ clk->cl.clk = clk;3333+3434+ clk->rate = rate;3535+3636+ clkdev_add(&clk->cl);3737+}3838+3939+/*4040+ * Linux clock API4141+ */4242+int clk_enable(struct clk *clk)4343+{4444+ return 0;4545+}4646+EXPORT_SYMBOL_GPL(clk_enable);4747+4848+void clk_disable(struct clk *clk)4949+{5050+}5151+EXPORT_SYMBOL_GPL(clk_disable);5252+5353+unsigned long clk_get_rate(struct clk *clk)5454+{5555+ return clk->rate;5656+}5757+EXPORT_SYMBOL_GPL(clk_get_rate);5858+5959+void __init plat_time_init(void)6060+{6161+ struct clk *clk;6262+6363+ ralink_of_remap();6464+6565+ ralink_clk_init();6666+ clk = clk_get_sys("cpu", NULL);6767+ if (IS_ERR(clk))6868+ panic("unable to get CPU clock, err=%ld", PTR_ERR(clk));6969+ pr_info("CPU Clock: %ldMHz\n", clk_get_rate(clk) / 1000000);7070+ mips_hpt_frequency = clk_get_rate(clk) / 2;7171+ clk_put(clk);7272+}
+44
arch/mips/ralink/common.h
···11+/*22+ * This program is free software; you can redistribute it and/or modify it33+ * under the terms of the GNU General Public License version 2 as published44+ * by the Free Software Foundation.55+ *66+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>77+ */88+99+#ifndef _RALINK_COMMON_H__1010+#define _RALINK_COMMON_H__1111+1212+#define RAMIPS_SYS_TYPE_LEN 321313+1414+struct ralink_pinmux_grp {1515+ const char *name;1616+ u32 mask;1717+ int gpio_first;1818+ int gpio_last;1919+};2020+2121+struct ralink_pinmux {2222+ struct ralink_pinmux_grp *mode;2323+ struct ralink_pinmux_grp *uart;2424+ int uart_shift;2525+ void (*wdt_reset)(void);2626+};2727+extern struct ralink_pinmux gpio_pinmux;2828+2929+struct ralink_soc_info {3030+ unsigned char sys_type[RAMIPS_SYS_TYPE_LEN];3131+ unsigned char *compatible;3232+};3333+extern struct ralink_soc_info soc_info;3434+3535+extern void ralink_of_remap(void);3636+3737+extern void ralink_clk_init(void);3838+extern void ralink_clk_add(const char *dev, unsigned long rate);3939+4040+extern void prom_soc_init(struct ralink_soc_info *soc_info);4141+4242+__iomem void *plat_of_remap_node(const char *node);4343+4444+#endif /* _RALINK_COMMON_H__ */
···11+/*22+ * This program is free software; you can redistribute it and/or modify it33+ * under the terms of the GNU General Public License version 2 as published44+ * by the Free Software Foundation.55+ *66+ * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>77+ */88+99+#include <linux/io.h>1010+#include <linux/serial_reg.h>1111+1212+#include <asm/addrspace.h>1313+1414+#define EARLY_UART_BASE 0x10000c001515+1616+#define UART_REG_RX 0x001717+#define UART_REG_TX 0x041818+#define UART_REG_IER 0x081919+#define UART_REG_IIR 0x0c2020+#define UART_REG_FCR 0x102121+#define UART_REG_LCR 0x142222+#define UART_REG_MCR 0x182323+#define UART_REG_LSR 0x1c2424+2525+static __iomem void *uart_membase = (__iomem void *) KSEG1ADDR(EARLY_UART_BASE);2626+2727+static inline void uart_w32(u32 val, unsigned reg)2828+{2929+ __raw_writel(val, uart_membase + reg);3030+}3131+3232+static inline u32 uart_r32(unsigned reg)3333+{3434+ return __raw_readl(uart_membase + reg);3535+}3636+3737+void prom_putchar(unsigned char ch)3838+{3939+ while ((uart_r32(UART_REG_LSR) & UART_LSR_THRE) == 0)4040+ ;4141+ uart_w32(ch, UART_REG_TX);4242+ while ((uart_r32(UART_REG_LSR) & UART_LSR_THRE) == 0)4343+ ;4444+}
+180
arch/mips/ralink/irq.c
···11+/*22+ * This program is free software; you can redistribute it and/or modify it33+ * under the terms of the GNU General Public License version 2 as published44+ * by the Free Software Foundation.55+ *66+ * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>77+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>88+ */99+1010+#include <linux/io.h>1111+#include <linux/bitops.h>1212+#include <linux/of_platform.h>1313+#include <linux/of_address.h>1414+#include <linux/of_irq.h>1515+#include <linux/irqdomain.h>1616+#include <linux/interrupt.h>1717+1818+#include <asm/irq_cpu.h>1919+#include <asm/mipsregs.h>2020+2121+#include "common.h"2222+2323+/* INTC register offsets */2424+#define INTC_REG_STATUS0 0x002525+#define INTC_REG_STATUS1 0x042626+#define INTC_REG_TYPE 0x202727+#define INTC_REG_RAW_STATUS 0x302828+#define INTC_REG_ENABLE 0x342929+#define INTC_REG_DISABLE 0x383030+3131+#define INTC_INT_GLOBAL BIT(31)3232+3333+#define RALINK_CPU_IRQ_INTC (MIPS_CPU_IRQ_BASE + 2)3434+#define RALINK_CPU_IRQ_FE (MIPS_CPU_IRQ_BASE + 5)3535+#define RALINK_CPU_IRQ_WIFI (MIPS_CPU_IRQ_BASE + 6)3636+#define RALINK_CPU_IRQ_COUNTER (MIPS_CPU_IRQ_BASE + 7)3737+3838+/* we have a cascade of 8 irqs */3939+#define RALINK_INTC_IRQ_BASE 84040+4141+/* we have 32 SoC irqs */4242+#define RALINK_INTC_IRQ_COUNT 324343+4444+#define RALINK_INTC_IRQ_PERFC (RALINK_INTC_IRQ_BASE + 9)4545+4646+static void __iomem *rt_intc_membase;4747+4848+static inline void rt_intc_w32(u32 val, unsigned reg)4949+{5050+ __raw_writel(val, rt_intc_membase + reg);5151+}5252+5353+static inline u32 rt_intc_r32(unsigned reg)5454+{5555+ return __raw_readl(rt_intc_membase + reg);5656+}5757+5858+static void ralink_intc_irq_unmask(struct irq_data *d)5959+{6060+ rt_intc_w32(BIT(d->hwirq), INTC_REG_ENABLE);6161+}6262+6363+static void ralink_intc_irq_mask(struct irq_data *d)6464+{6565+ rt_intc_w32(BIT(d->hwirq), INTC_REG_DISABLE);6666+}6767+6868+static struct irq_chip ralink_intc_irq_chip = {6969+ .name = "INTC",7070+ .irq_unmask = ralink_intc_irq_unmask,7171+ .irq_mask = ralink_intc_irq_mask,7272+ .irq_mask_ack = ralink_intc_irq_mask,7373+};7474+7575+unsigned int __cpuinit get_c0_compare_int(void)7676+{7777+ return CP0_LEGACY_COMPARE_IRQ;7878+}7979+8080+static void ralink_intc_irq_handler(unsigned int irq, struct irq_desc *desc)8181+{8282+ u32 pending = rt_intc_r32(INTC_REG_STATUS0);8383+8484+ if (pending) {8585+ struct irq_domain *domain = irq_get_handler_data(irq);8686+ generic_handle_irq(irq_find_mapping(domain, __ffs(pending)));8787+ } else {8888+ spurious_interrupt();8989+ }9090+}9191+9292+asmlinkage void plat_irq_dispatch(void)9393+{9494+ unsigned long pending;9595+9696+ pending = read_c0_status() & read_c0_cause() & ST0_IM;9797+9898+ if (pending & STATUSF_IP7)9999+ do_IRQ(RALINK_CPU_IRQ_COUNTER);100100+101101+ else if (pending & STATUSF_IP5)102102+ do_IRQ(RALINK_CPU_IRQ_FE);103103+104104+ else if (pending & STATUSF_IP6)105105+ do_IRQ(RALINK_CPU_IRQ_WIFI);106106+107107+ else if (pending & STATUSF_IP2)108108+ do_IRQ(RALINK_CPU_IRQ_INTC);109109+110110+ else111111+ spurious_interrupt();112112+}113113+114114+static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)115115+{116116+ irq_set_chip_and_handler(irq, &ralink_intc_irq_chip, handle_level_irq);117117+118118+ return 0;119119+}120120+121121+static const struct irq_domain_ops irq_domain_ops = {122122+ .xlate = irq_domain_xlate_onecell,123123+ .map = intc_map,124124+};125125+126126+static int __init intc_of_init(struct device_node *node,127127+ struct device_node *parent)128128+{129129+ struct resource res;130130+ struct irq_domain *domain;131131+ int irq;132132+133133+ irq = irq_of_parse_and_map(node, 0);134134+ if (!irq)135135+ panic("Failed to get INTC IRQ");136136+137137+ if (of_address_to_resource(node, 0, &res))138138+ panic("Failed to get intc memory range");139139+140140+ if (request_mem_region(res.start, resource_size(&res),141141+ res.name) < 0)142142+ pr_err("Failed to request intc memory");143143+144144+ rt_intc_membase = ioremap_nocache(res.start,145145+ resource_size(&res));146146+ if (!rt_intc_membase)147147+ panic("Failed to remap intc memory");148148+149149+ /* disable all interrupts */150150+ rt_intc_w32(~0, INTC_REG_DISABLE);151151+152152+ /* route all INTC interrupts to MIPS HW0 interrupt */153153+ rt_intc_w32(0, INTC_REG_TYPE);154154+155155+ domain = irq_domain_add_legacy(node, RALINK_INTC_IRQ_COUNT,156156+ RALINK_INTC_IRQ_BASE, 0, &irq_domain_ops, NULL);157157+ if (!domain)158158+ panic("Failed to add irqdomain");159159+160160+ rt_intc_w32(INTC_INT_GLOBAL, INTC_REG_ENABLE);161161+162162+ irq_set_chained_handler(irq, ralink_intc_irq_handler);163163+ irq_set_handler_data(irq, domain);164164+165165+ cp0_perfcount_irq = irq_create_mapping(domain, 9);166166+167167+ return 0;168168+}169169+170170+static struct of_device_id __initdata of_irq_ids[] = {171171+ { .compatible = "mti,cpu-interrupt-controller", .data = mips_cpu_intc_init },172172+ { .compatible = "ralink,rt2880-intc", .data = intc_of_init },173173+ {},174174+};175175+176176+void __init arch_init_irq(void)177177+{178178+ of_irq_init(of_irq_ids);179179+}180180+
+107
arch/mips/ralink/of.c
···11+/*22+ * This program is free software; you can redistribute it and/or modify it33+ * under the terms of the GNU General Public License version 2 as published44+ * by the Free Software Foundation.55+ *66+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>77+ * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>88+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>99+ */1010+1111+#include <linux/io.h>1212+#include <linux/clk.h>1313+#include <linux/init.h>1414+#include <linux/of_fdt.h>1515+#include <linux/kernel.h>1616+#include <linux/bootmem.h>1717+#include <linux/of_platform.h>1818+#include <linux/of_address.h>1919+2020+#include <asm/reboot.h>2121+#include <asm/bootinfo.h>2222+#include <asm/addrspace.h>2323+2424+#include "common.h"2525+2626+__iomem void *rt_sysc_membase;2727+__iomem void *rt_memc_membase;2828+2929+extern struct boot_param_header __dtb_start;3030+3131+__iomem void *plat_of_remap_node(const char *node)3232+{3333+ struct resource res;3434+ struct device_node *np;3535+3636+ np = of_find_compatible_node(NULL, NULL, node);3737+ if (!np)3838+ panic("Failed to find %s node", node);3939+4040+ if (of_address_to_resource(np, 0, &res))4141+ panic("Failed to get resource for %s", node);4242+4343+ if ((request_mem_region(res.start,4444+ resource_size(&res),4545+ res.name) < 0))4646+ panic("Failed to request resources for %s", node);4747+4848+ return ioremap_nocache(res.start, resource_size(&res));4949+}5050+5151+void __init device_tree_init(void)5252+{5353+ unsigned long base, size;5454+ void *fdt_copy;5555+5656+ if (!initial_boot_params)5757+ return;5858+5959+ base = virt_to_phys((void *)initial_boot_params);6060+ size = be32_to_cpu(initial_boot_params->totalsize);6161+6262+ /* Before we do anything, lets reserve the dt blob */6363+ reserve_bootmem(base, size, BOOTMEM_DEFAULT);6464+6565+ /* The strings in the flattened tree are referenced directly by the6666+ * device tree, so copy the flattened device tree from init memory6767+ * to regular memory.6868+ */6969+ fdt_copy = alloc_bootmem(size);7070+ memcpy(fdt_copy, initial_boot_params, size);7171+ initial_boot_params = fdt_copy;7272+7373+ unflatten_device_tree();7474+7575+ /* free the space reserved for the dt blob */7676+ free_bootmem(base, size);7777+}7878+7979+void __init plat_mem_setup(void)8080+{8181+ set_io_port_base(KSEG1);8282+8383+ /*8484+ * Load the builtin devicetree. This causes the chosen node to be8585+ * parsed resulting in our memory appearing8686+ */8787+ __dt_setup_arch(&__dtb_start);8888+}8989+9090+static int __init plat_of_setup(void)9191+{9292+ static struct of_device_id of_ids[3];9393+ int len = sizeof(of_ids[0].compatible);9494+9595+ if (!of_have_populated_dt())9696+ panic("device tree not present");9797+9898+ strncpy(of_ids[0].compatible, soc_info.compatible, len);9999+ strncpy(of_ids[1].compatible, "palmbus", len);100100+101101+ if (of_platform_populate(NULL, of_ids, NULL, NULL))102102+ panic("failed to populate DT\n");103103+104104+ return 0;105105+}106106+107107+arch_initcall(plat_of_setup);
+69
arch/mips/ralink/prom.c
···11+/*22+ * This program is free software; you can redistribute it and/or modify it33+ * under the terms of the GNU General Public License version 2 as published44+ * by the Free Software Foundation.55+ *66+ * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>77+ * Copyright (C) 2010 Joonas Lahtinen <joonas.lahtinen@gmail.com>88+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>99+ */1010+1111+#include <linux/string.h>1212+#include <linux/of_fdt.h>1313+#include <linux/of_platform.h>1414+1515+#include <asm/bootinfo.h>1616+#include <asm/addrspace.h>1717+1818+#include "common.h"1919+2020+struct ralink_soc_info soc_info;2121+2222+const char *get_system_type(void)2323+{2424+ return soc_info.sys_type;2525+}2626+2727+static __init void prom_init_cmdline(int argc, char **argv)2828+{2929+ int i;3030+3131+ pr_debug("prom: fw_arg0=%08x fw_arg1=%08x fw_arg2=%08x fw_arg3=%08x\n",3232+ (unsigned int)fw_arg0, (unsigned int)fw_arg1,3333+ (unsigned int)fw_arg2, (unsigned int)fw_arg3);3434+3535+ argc = fw_arg0;3636+ argv = (char **) KSEG1ADDR(fw_arg1);3737+3838+ if (!argv) {3939+ pr_debug("argv=%p is invalid, skipping\n",4040+ argv);4141+ return;4242+ }4343+4444+ for (i = 0; i < argc; i++) {4545+ char *p = (char *) KSEG1ADDR(argv[i]);4646+4747+ if (CPHYSADDR(p) && *p) {4848+ pr_debug("argv[%d]: %s\n", i, p);4949+ strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));5050+ strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));5151+ }5252+ }5353+}5454+5555+void __init prom_init(void)5656+{5757+ int argc;5858+ char **argv;5959+6060+ prom_soc_init(&soc_info);6161+6262+ pr_info("SoC Type: %s\n", get_system_type());6363+6464+ prom_init_cmdline(argc, argv);6565+}6666+6767+void __init prom_free_prom_memory(void)6868+{6969+}
+44
arch/mips/ralink/reset.c
···11+/*22+ * This program is free software; you can redistribute it and/or modify it33+ * under the terms of the GNU General Public License version 2 as published44+ * by the Free Software Foundation.55+ *66+ * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>77+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>88+ * Copyright (C) 2013 John Crispin <blogic@openwrt.org>99+ */1010+1111+#include <linux/pm.h>1212+#include <linux/io.h>1313+1414+#include <asm/reboot.h>1515+1616+#include <asm/mach-ralink/ralink_regs.h>1717+1818+/* Reset Control */1919+#define SYSC_REG_RESET_CTRL 0x0342020+#define RSTCTL_RESET_SYSTEM BIT(0)2121+2222+static void ralink_restart(char *command)2323+{2424+ local_irq_disable();2525+ rt_sysc_w32(RSTCTL_RESET_SYSTEM, SYSC_REG_RESET_CTRL);2626+ unreachable();2727+}2828+2929+static void ralink_halt(void)3030+{3131+ local_irq_disable();3232+ unreachable();3333+}3434+3535+static int __init mips_reboot_setup(void)3636+{3737+ _machine_restart = ralink_restart;3838+ _machine_halt = ralink_halt;3939+ pm_power_off = ralink_halt;4040+4141+ return 0;4242+}4343+4444+arch_initcall(mips_reboot_setup);
···170170 consistent_sync(vaddr, size, direction);171171}172172173173+/* Not supported for now */174174+static inline int dma_mmap_coherent(struct device *dev,175175+ struct vm_area_struct *vma, void *cpu_addr,176176+ dma_addr_t dma_addr, size_t size)177177+{178178+ return -EINVAL;179179+}180180+181181+static inline int dma_get_sgtable(struct device *dev, struct sg_table *sgt,182182+ void *cpu_addr, dma_addr_t dma_addr,183183+ size_t size)184184+{185185+ return -EINVAL;186186+}187187+173188#endif /* _XTENSA_DMA_MAPPING_H */
+32-10
block/genhd.c
···35353636static struct device_type disk_type;37373838+static void disk_check_events(struct disk_events *ev,3939+ unsigned int *clearing_ptr);3840static void disk_alloc_events(struct gendisk *disk);3941static void disk_add_events(struct gendisk *disk);4042static void disk_del_events(struct gendisk *disk);···15511549 const struct block_device_operations *bdops = disk->fops;15521550 struct disk_events *ev = disk->ev;15531551 unsigned int pending;15521552+ unsigned int clearing = mask;1554155315551554 if (!ev) {15561555 /* for drivers still using the old ->media_changed method */···15611558 return 0;15621559 }1563156015641564- /* tell the workfn about the events being cleared */15611561+ disk_block_events(disk);15621562+15631563+ /*15641564+ * store the union of mask and ev->clearing on the stack so that the15651565+ * race with disk_flush_events does not cause ambiguity (ev->clearing15661566+ * can still be modified even if events are blocked).15671567+ */15651568 spin_lock_irq(&ev->lock);15661566- ev->clearing |= mask;15691569+ clearing |= ev->clearing;15701570+ ev->clearing = 0;15671571 spin_unlock_irq(&ev->lock);1568157215691569- /* uncondtionally schedule event check and wait for it to finish */15701570- disk_block_events(disk);15711571- queue_delayed_work(system_freezable_wq, &ev->dwork, 0);15721572- flush_delayed_work(&ev->dwork);15731573- __disk_unblock_events(disk, false);15731573+ disk_check_events(ev, &clearing);15741574+ /*15751575+ * if ev->clearing is not 0, the disk_flush_events got called in the15761576+ * middle of this function, so we want to run the workfn without delay.15771577+ */15781578+ __disk_unblock_events(disk, ev->clearing ? true : false);1574157915751580 /* then, fetch and clear pending events */15761581 spin_lock_irq(&ev->lock);15771577- WARN_ON_ONCE(ev->clearing & mask); /* cleared by workfn */15781582 pending = ev->pending & mask;15791583 ev->pending &= ~mask;15801584 spin_unlock_irq(&ev->lock);15851585+ WARN_ON_ONCE(clearing & mask);1581158615821587 return pending;15831588}1584158915901590+/*15911591+ * Separate this part out so that a different pointer for clearing_ptr can be15921592+ * passed in for disk_clear_events.15931593+ */15851594static void disk_events_workfn(struct work_struct *work)15861595{15871596 struct delayed_work *dwork = to_delayed_work(work);15881597 struct disk_events *ev = container_of(dwork, struct disk_events, dwork);15981598+15991599+ disk_check_events(ev, &ev->clearing);16001600+}16011601+16021602+static void disk_check_events(struct disk_events *ev,16031603+ unsigned int *clearing_ptr)16041604+{15891605 struct gendisk *disk = ev->disk;15901606 char *envp[ARRAY_SIZE(disk_uevents) + 1] = { };15911591- unsigned int clearing = ev->clearing;16071607+ unsigned int clearing = *clearing_ptr;15921608 unsigned int events;15931609 unsigned long intv;15941610 int nr_events = 0, i;···1620159816211599 events &= ~ev->pending;16221600 ev->pending |= events;16231623- ev->clearing &= ~clearing;16011601+ *clearing_ptr &= ~clearing;1624160216251603 intv = disk_events_poll_jiffies(disk);16261604 if (!ev->block && intv)
+73-73
drivers/atm/iphase.h
···636636#define SEG_BASE IPHASE5575_FRAG_CONTROL_REG_BASE 637637#define REASS_BASE IPHASE5575_REASS_CONTROL_REG_BASE 638638639639-typedef volatile u_int freg_t;639639+typedef volatile u_int ffreg_t;640640typedef u_int rreg_t;641641642642typedef struct _ffredn_t {643643- freg_t idlehead_high; /* Idle cell header (high) */644644- freg_t idlehead_low; /* Idle cell header (low) */645645- freg_t maxrate; /* Maximum rate */646646- freg_t stparms; /* Traffic Management Parameters */647647- freg_t abrubr_abr; /* ABRUBR Priority Byte 1, TCR Byte 0 */648648- freg_t rm_type; /* */649649- u_int filler5[0x17 - 0x06];650650- freg_t cmd_reg; /* Command register */651651- u_int filler18[0x20 - 0x18];652652- freg_t cbr_base; /* CBR Pointer Base */653653- freg_t vbr_base; /* VBR Pointer Base */654654- freg_t abr_base; /* ABR Pointer Base */655655- freg_t ubr_base; /* UBR Pointer Base */656656- u_int filler24;657657- freg_t vbrwq_base; /* VBR Wait Queue Base */658658- freg_t abrwq_base; /* ABR Wait Queue Base */659659- freg_t ubrwq_base; /* UBR Wait Queue Base */660660- freg_t vct_base; /* Main VC Table Base */661661- freg_t vcte_base; /* Extended Main VC Table Base */662662- u_int filler2a[0x2C - 0x2A];663663- freg_t cbr_tab_beg; /* CBR Table Begin */664664- freg_t cbr_tab_end; /* CBR Table End */665665- freg_t cbr_pointer; /* CBR Pointer */666666- u_int filler2f[0x30 - 0x2F];667667- freg_t prq_st_adr; /* Packet Ready Queue Start Address */668668- freg_t prq_ed_adr; /* Packet Ready Queue End Address */669669- freg_t prq_rd_ptr; /* Packet Ready Queue read pointer */670670- freg_t prq_wr_ptr; /* Packet Ready Queue write pointer */671671- freg_t tcq_st_adr; /* Transmit Complete Queue Start Address*/672672- freg_t tcq_ed_adr; /* Transmit Complete Queue End Address */673673- freg_t tcq_rd_ptr; /* Transmit Complete Queue read pointer */674674- freg_t tcq_wr_ptr; /* Transmit Complete Queue write pointer*/675675- u_int filler38[0x40 - 0x38];676676- freg_t queue_base; /* Base address for PRQ and TCQ */677677- freg_t desc_base; /* Base address of descriptor table */678678- u_int filler42[0x45 - 0x42];679679- freg_t mode_reg_0; /* Mode register 0 */680680- freg_t mode_reg_1; /* Mode register 1 */681681- freg_t intr_status_reg;/* Interrupt Status register */682682- freg_t mask_reg; /* Mask Register */683683- freg_t cell_ctr_high1; /* Total cell transfer count (high) */684684- freg_t cell_ctr_lo1; /* Total cell transfer count (low) */685685- freg_t state_reg; /* Status register */686686- u_int filler4c[0x58 - 0x4c];687687- freg_t curr_desc_num; /* Contains the current descriptor num */688688- freg_t next_desc; /* Next descriptor */689689- freg_t next_vc; /* Next VC */690690- u_int filler5b[0x5d - 0x5b];691691- freg_t present_slot_cnt;/* Present slot count */692692- u_int filler5e[0x6a - 0x5e];693693- freg_t new_desc_num; /* New descriptor number */694694- freg_t new_vc; /* New VC */695695- freg_t sched_tbl_ptr; /* Schedule table pointer */696696- freg_t vbrwq_wptr; /* VBR wait queue write pointer */697697- freg_t vbrwq_rptr; /* VBR wait queue read pointer */698698- freg_t abrwq_wptr; /* ABR wait queue write pointer */699699- freg_t abrwq_rptr; /* ABR wait queue read pointer */700700- freg_t ubrwq_wptr; /* UBR wait queue write pointer */701701- freg_t ubrwq_rptr; /* UBR wait queue read pointer */702702- freg_t cbr_vc; /* CBR VC */703703- freg_t vbr_sb_vc; /* VBR SB VC */704704- freg_t abr_sb_vc; /* ABR SB VC */705705- freg_t ubr_sb_vc; /* UBR SB VC */706706- freg_t vbr_next_link; /* VBR next link */707707- freg_t abr_next_link; /* ABR next link */708708- freg_t ubr_next_link; /* UBR next link */709709- u_int filler7a[0x7c-0x7a];710710- freg_t out_rate_head; /* Out of rate head */711711- u_int filler7d[0xca-0x7d]; /* pad out to full address space */712712- freg_t cell_ctr_high1_nc;/* Total cell transfer count (high) */713713- freg_t cell_ctr_lo1_nc;/* Total cell transfer count (low) */714714- u_int fillercc[0x100-0xcc]; /* pad out to full address space */643643+ ffreg_t idlehead_high; /* Idle cell header (high) */644644+ ffreg_t idlehead_low; /* Idle cell header (low) */645645+ ffreg_t maxrate; /* Maximum rate */646646+ ffreg_t stparms; /* Traffic Management Parameters */647647+ ffreg_t abrubr_abr; /* ABRUBR Priority Byte 1, TCR Byte 0 */648648+ ffreg_t rm_type; /* */649649+ u_int filler5[0x17 - 0x06];650650+ ffreg_t cmd_reg; /* Command register */651651+ u_int filler18[0x20 - 0x18];652652+ ffreg_t cbr_base; /* CBR Pointer Base */653653+ ffreg_t vbr_base; /* VBR Pointer Base */654654+ ffreg_t abr_base; /* ABR Pointer Base */655655+ ffreg_t ubr_base; /* UBR Pointer Base */656656+ u_int filler24;657657+ ffreg_t vbrwq_base; /* VBR Wait Queue Base */658658+ ffreg_t abrwq_base; /* ABR Wait Queue Base */659659+ ffreg_t ubrwq_base; /* UBR Wait Queue Base */660660+ ffreg_t vct_base; /* Main VC Table Base */661661+ ffreg_t vcte_base; /* Extended Main VC Table Base */662662+ u_int filler2a[0x2C - 0x2A];663663+ ffreg_t cbr_tab_beg; /* CBR Table Begin */664664+ ffreg_t cbr_tab_end; /* CBR Table End */665665+ ffreg_t cbr_pointer; /* CBR Pointer */666666+ u_int filler2f[0x30 - 0x2F];667667+ ffreg_t prq_st_adr; /* Packet Ready Queue Start Address */668668+ ffreg_t prq_ed_adr; /* Packet Ready Queue End Address */669669+ ffreg_t prq_rd_ptr; /* Packet Ready Queue read pointer */670670+ ffreg_t prq_wr_ptr; /* Packet Ready Queue write pointer */671671+ ffreg_t tcq_st_adr; /* Transmit Complete Queue Start Address*/672672+ ffreg_t tcq_ed_adr; /* Transmit Complete Queue End Address */673673+ ffreg_t tcq_rd_ptr; /* Transmit Complete Queue read pointer */674674+ ffreg_t tcq_wr_ptr; /* Transmit Complete Queue write pointer*/675675+ u_int filler38[0x40 - 0x38];676676+ ffreg_t queue_base; /* Base address for PRQ and TCQ */677677+ ffreg_t desc_base; /* Base address of descriptor table */678678+ u_int filler42[0x45 - 0x42];679679+ ffreg_t mode_reg_0; /* Mode register 0 */680680+ ffreg_t mode_reg_1; /* Mode register 1 */681681+ ffreg_t intr_status_reg;/* Interrupt Status register */682682+ ffreg_t mask_reg; /* Mask Register */683683+ ffreg_t cell_ctr_high1; /* Total cell transfer count (high) */684684+ ffreg_t cell_ctr_lo1; /* Total cell transfer count (low) */685685+ ffreg_t state_reg; /* Status register */686686+ u_int filler4c[0x58 - 0x4c];687687+ ffreg_t curr_desc_num; /* Contains the current descriptor num */688688+ ffreg_t next_desc; /* Next descriptor */689689+ ffreg_t next_vc; /* Next VC */690690+ u_int filler5b[0x5d - 0x5b];691691+ ffreg_t present_slot_cnt;/* Present slot count */692692+ u_int filler5e[0x6a - 0x5e];693693+ ffreg_t new_desc_num; /* New descriptor number */694694+ ffreg_t new_vc; /* New VC */695695+ ffreg_t sched_tbl_ptr; /* Schedule table pointer */696696+ ffreg_t vbrwq_wptr; /* VBR wait queue write pointer */697697+ ffreg_t vbrwq_rptr; /* VBR wait queue read pointer */698698+ ffreg_t abrwq_wptr; /* ABR wait queue write pointer */699699+ ffreg_t abrwq_rptr; /* ABR wait queue read pointer */700700+ ffreg_t ubrwq_wptr; /* UBR wait queue write pointer */701701+ ffreg_t ubrwq_rptr; /* UBR wait queue read pointer */702702+ ffreg_t cbr_vc; /* CBR VC */703703+ ffreg_t vbr_sb_vc; /* VBR SB VC */704704+ ffreg_t abr_sb_vc; /* ABR SB VC */705705+ ffreg_t ubr_sb_vc; /* UBR SB VC */706706+ ffreg_t vbr_next_link; /* VBR next link */707707+ ffreg_t abr_next_link; /* ABR next link */708708+ ffreg_t ubr_next_link; /* UBR next link */709709+ u_int filler7a[0x7c-0x7a];710710+ ffreg_t out_rate_head; /* Out of rate head */711711+ u_int filler7d[0xca-0x7d]; /* pad out to full address space */712712+ ffreg_t cell_ctr_high1_nc;/* Total cell transfer count (high) */713713+ ffreg_t cell_ctr_lo1_nc;/* Total cell transfer count (low) */714714+ u_int fillercc[0x100-0xcc]; /* pad out to full address space */715715} ffredn_t;716716717717typedef struct _rfredn_t {
···268268void bcma_bus_unregister(struct bcma_bus *bus)269269{270270 struct bcma_device *cores[3];271271+ int err;272272+273273+ err = bcma_gpio_unregister(&bus->drv_cc);274274+ if (err == -EBUSY)275275+ bcma_err(bus, "Some GPIOs are still in use.\n");276276+ else if (err)277277+ bcma_err(bus, "Can not unregister GPIO driver: %i\n", err);271278272279 cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K);273280 cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE);
+1-1
drivers/block/drbd/drbd_req.c
···168168}169169170170/* must hold resource->req_lock */171171-static void start_new_tl_epoch(struct drbd_tconn *tconn)171171+void start_new_tl_epoch(struct drbd_tconn *tconn)172172{173173 /* no point closing an epoch, if it is empty, anyways. */174174 if (tconn->current_tle_writes == 0)
···792792{793793 struct llist_node *all_gnts;794794 struct grant *persistent_gnt;795795+ struct llist_node *n;795796796797 /* Prevent new requests being issued until we fix things up. */797798 spin_lock_irq(&info->io_lock);···805804 /* Remove all persistent grants */806805 if (info->persistent_gnts_c) {807806 all_gnts = llist_del_all(&info->persistent_gnts);808808- llist_for_each_entry(persistent_gnt, all_gnts, node) {807807+ llist_for_each_entry_safe(persistent_gnt, n, all_gnts, node) {809808 gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL);810809 __free_page(pfn_to_page(persistent_gnt->pfn));811810 kfree(persistent_gnt);···836835static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info,837836 struct blkif_response *bret)838837{839839- int i;838838+ int i = 0;840839 struct bio_vec *bvec;841840 struct req_iterator iter;842841 unsigned long flags;···853852 */854853 rq_for_each_segment(bvec, s->request, iter) {855854 BUG_ON((bvec->bv_offset + bvec->bv_len) > PAGE_SIZE);856856- i = offset >> PAGE_SHIFT;855855+ if (bvec->bv_offset < offset)856856+ i++;857857 BUG_ON(i >= s->req.u.rw.nr_segments);858858 shared_data = kmap_atomic(859859 pfn_to_page(s->grants_used[i]->pfn));···863861 bvec->bv_len);864862 bvec_kunmap_irq(bvec_data, &flags);865863 kunmap_atomic(shared_data);866866- offset += bvec->bv_len;864864+ offset = bvec->bv_offset + bvec->bv_len;867865 }868866 }869867 /* Add the persistent grant into the list of free grants */
+2-1
drivers/char/virtio_console.c
···20622062 /* Disable interrupts for vqs */20632063 vdev->config->reset(vdev);20642064 /* Finish up work that's lined up */20652065- cancel_work_sync(&portdev->control_work);20652065+ if (use_multiport(portdev))20662066+ cancel_work_sync(&portdev->control_work);2066206720672068 list_for_each_entry_safe(port, port2, &portdev->ports, list)20682069 unplug_port(port);
···11151115 }1116111611171117 radeon_fb = kzalloc(sizeof(*radeon_fb), GFP_KERNEL);11181118- if (radeon_fb == NULL)11181118+ if (radeon_fb == NULL) {11191119+ drm_gem_object_unreference_unlocked(obj);11191120 return ERR_PTR(-ENOMEM);11211121+ }1120112211211123 ret = radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj);11221124 if (ret) {
+3
drivers/gpu/drm/radeon/radeon_ring.c
···377377{378378 int r;379379380380+ /* make sure we aren't trying to allocate more space than there is on the ring */381381+ if (ndw > (ring->ring_size / 4))382382+ return -ENOMEM;380383 /* Align requested size with padding so unlock_commit can381384 * pad safely */382385 ndw = (ndw + ring->align_mask) & ~ring->align_mask;
···336336 WREG32(R600_CITF_CNTL, blackout);337337 }338338 }339339+ /* wait for the MC to settle */340340+ udelay(100);339341}340342341343void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save)
···518518 .ioctl_ops = &fm_drv_ioctl_ops,519519 .name = FM_DRV_NAME,520520 .release = video_device_release,521521+ /*522522+ * To ensure both the tuner and modulator ioctls are accessible we523523+ * set the vfl_dir to M2M to indicate this.524524+ *525525+ * It is not really a mem2mem device of course, but it can both receive526526+ * and transmit using the same radio device. It's the only radio driver527527+ * that does this and it should really be split in two radio devices,528528+ * but that would affect applications using this driver.529529+ */530530+ .vfl_dir = VFL_DIR_M2M,521531};522532523533int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr)
+1-1
drivers/mtd/bcm47xxpart.c
···1414#include <linux/slab.h>1515#include <linux/mtd/mtd.h>1616#include <linux/mtd/partitions.h>1717-#include <asm/mach-bcm47xx/nvram.h>1717+#include <bcm47xx_nvram.h>18181919/* 10 parts were found on sflash on Netgear WNDR4500 */2020#define BCM47XXPART_MAX_PARTS 12
+1
drivers/mtd/devices/Kconfig
···272272 tristate "M-Systems Disk-On-Chip G3"273273 select BCH274274 select BCH_CONST_PARAMS275275+ select BITREVERSE275276 ---help---276277 This provides an MTD device driver for the M-Systems DiskOnChip277278 G3 devices.
···1717#include "bcm47xxnflash.h"18181919/* Broadcom uses 1'000'000 but it seems to be too many. Tests on WNDR4500 has2020- * shown 164 retries as maxiumum. */2121-#define NFLASH_READY_RETRIES 10002020+ * shown ~1000 retries as maxiumum. */2121+#define NFLASH_READY_RETRIES 1000022222323#define NFLASH_SECTOR_SIZE 5122424
···28572857 int i;28582858 int val;2859285928602860- /* ONFI need to be probed in 8 bits mode */28612861- WARN_ON(chip->options & NAND_BUSWIDTH_16);28602860+ /* ONFI need to be probed in 8 bits mode, and 16 bits should be selected with NAND_BUSWIDTH_AUTO */28612861+ if (chip->options & NAND_BUSWIDTH_16) {28622862+ pr_err("Trying ONFI probe in 16 bits mode, aborting !\n");28632863+ return 0;28642864+ }28622865 /* Try ONFI for unknown chip or LP */28632866 chip->cmdfunc(mtd, NAND_CMD_READID, 0x20, -1);28642867 if (chip->read_byte(mtd) != 'O' || chip->read_byte(mtd) != 'N' ||
···380380 unsigned long lockflags;381381 size_t size = dev->rx_urb_size;382382383383+ /* prevent rx skb allocation when error ratio is high */384384+ if (test_bit(EVENT_RX_KILL, &dev->flags)) {385385+ usb_free_urb(urb);386386+ return -ENOLINK;387387+ }388388+383389 skb = __netdev_alloc_skb_ip_align(dev->net, size, flags);384390 if (!skb) {385391 netif_dbg(dev, rx_err, dev->net, "no rx skb\n");···543537 dev->net->stats.rx_errors++;544538 netif_dbg(dev, rx_err, dev->net, "rx status %d\n", urb_status);545539 break;540540+ }541541+542542+ /* stop rx if packet error rate is high */543543+ if (++dev->pkt_cnt > 30) {544544+ dev->pkt_cnt = 0;545545+ dev->pkt_err = 0;546546+ } else {547547+ if (state == rx_cleanup)548548+ dev->pkt_err++;549549+ if (dev->pkt_err > 20)550550+ set_bit(EVENT_RX_KILL, &dev->flags);546551 }547552548553 state = defer_bh(dev, skb, &dev->rxq, state);···807790 (dev->driver_info->flags & FLAG_FRAMING_RN) ? "RNDIS" :808791 (dev->driver_info->flags & FLAG_FRAMING_AX) ? "ASIX" :809792 "simple");793793+794794+ /* reset rx error state */795795+ dev->pkt_cnt = 0;796796+ dev->pkt_err = 0;797797+ clear_bit(EVENT_RX_KILL, &dev->flags);810798811799 // delay posting reads until we're fully open812800 tasklet_schedule (&dev->bh);···11251103 if (info->tx_fixup) {11261104 skb = info->tx_fixup (dev, skb, GFP_ATOMIC);11271105 if (!skb) {11281128- if (netif_msg_tx_err(dev)) {11291129- netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n");11301130- goto drop;11311131- } else {11321132- /* cdc_ncm collected packet; waits for more */11061106+ /* packet collected; minidriver waiting for more */11071107+ if (info->flags & FLAG_MULTI_PACKET)11331108 goto not_drop;11341134- }11091109+ netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n");11101110+ goto drop;11351111 }11361112 }11371113 length = skb->len;···12731253 netdev_dbg(dev->net, "bogus skb state %d\n", entry->state);12741254 }12751255 }12561256+12571257+ /* restart RX again after disabling due to high error rate */12581258+ clear_bit(EVENT_RX_KILL, &dev->flags);1276125912771260 // waiting for all pending urbs to complete?12781261 if (dev->wait) {
+3-4
drivers/net/vmxnet3/vmxnet3_drv.c
···154154 if (ret & 1) { /* Link is up. */155155 printk(KERN_INFO "%s: NIC Link is Up %d Mbps\n",156156 adapter->netdev->name, adapter->link_speed);157157- if (!netif_carrier_ok(adapter->netdev))158158- netif_carrier_on(adapter->netdev);157157+ netif_carrier_on(adapter->netdev);159158160159 if (affectTxQueue) {161160 for (i = 0; i < adapter->num_tx_queues; i++)···164165 } else {165166 printk(KERN_INFO "%s: NIC Link is Down\n",166167 adapter->netdev->name);167167- if (netif_carrier_ok(adapter->netdev))168168- netif_carrier_off(adapter->netdev);168168+ netif_carrier_off(adapter->netdev);169169170170 if (affectTxQueue) {171171 for (i = 0; i < adapter->num_tx_queues; i++)···30593061 netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues);30603062 netif_set_real_num_rx_queues(adapter->netdev, adapter->num_rx_queues);3061306330643064+ netif_carrier_off(netdev);30623065 err = register_netdev(netdev);3063306630643067 if (err) {
···151151/* Notify xenvif that ring now has space to send an skb to the frontend */152152void xenvif_notify_tx_completion(struct xenvif *vif);153153154154+/* Prevent the device from generating any further traffic. */155155+void xenvif_carrier_off(struct xenvif *vif);156156+154157/* Returns number of ring slots required to send an skb to the frontend */155158unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff *skb);156159
···147147 atomic_dec(&netbk->netfront_count);148148}149149150150-static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx);150150+static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx,151151+ u8 status);151152static void make_tx_response(struct xenvif *vif,152153 struct xen_netif_tx_request *txp,153154 s8 st);···880879881880 do {882881 make_tx_response(vif, txp, XEN_NETIF_RSP_ERROR);883883- if (cons >= end)882882+ if (cons == end)884883 break;885884 txp = RING_GET_REQUEST(&vif->tx, cons++);886885 } while (1);887886 vif->tx.req_cons = cons;888887 xen_netbk_check_rx_xenvif(vif);888888+ xenvif_put(vif);889889+}890890+891891+static void netbk_fatal_tx_err(struct xenvif *vif)892892+{893893+ netdev_err(vif->dev, "fatal error; disabling device\n");894894+ xenvif_carrier_off(vif);889895 xenvif_put(vif);890896}891897···909901910902 do {911903 if (frags >= work_to_do) {912912- netdev_dbg(vif->dev, "Need more frags\n");904904+ netdev_err(vif->dev, "Need more frags\n");905905+ netbk_fatal_tx_err(vif);913906 return -frags;914907 }915908916909 if (unlikely(frags >= MAX_SKB_FRAGS)) {917917- netdev_dbg(vif->dev, "Too many frags\n");910910+ netdev_err(vif->dev, "Too many frags\n");911911+ netbk_fatal_tx_err(vif);918912 return -frags;919913 }920914921915 memcpy(txp, RING_GET_REQUEST(&vif->tx, cons + frags),922916 sizeof(*txp));923917 if (txp->size > first->size) {924924- netdev_dbg(vif->dev, "Frags galore\n");918918+ netdev_err(vif->dev, "Frag is bigger than frame.\n");919919+ netbk_fatal_tx_err(vif);925920 return -frags;926921 }927922···932921 frags++;933922934923 if (unlikely((txp->offset + txp->size) > PAGE_SIZE)) {935935- netdev_dbg(vif->dev, "txp->offset: %x, size: %u\n",924924+ netdev_err(vif->dev, "txp->offset: %x, size: %u\n",936925 txp->offset, txp->size);926926+ netbk_fatal_tx_err(vif);937927 return -frags;938928 }939929 } while ((txp++)->flags & XEN_NETTXF_more_data);···978966 pending_idx = netbk->pending_ring[index];979967 page = xen_netbk_alloc_page(netbk, skb, pending_idx);980968 if (!page)981981- return NULL;969969+ goto err;982970983971 gop->source.u.ref = txp->gref;984972 gop->source.domid = vif->domid;···1000988 }10019891002990 return gop;991991+err:992992+ /* Unwind, freeing all pages and sending error responses. */993993+ while (i-- > start) {994994+ xen_netbk_idx_release(netbk, frag_get_pending_idx(&frags[i]),995995+ XEN_NETIF_RSP_ERROR);996996+ }997997+ /* The head too, if necessary. */998998+ if (start)999999+ xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_ERROR);10001000+10011001+ return NULL;10031002}1004100310051004static int xen_netbk_tx_check_gop(struct xen_netbk *netbk,···1019996{1020997 struct gnttab_copy *gop = *gopp;1021998 u16 pending_idx = *((u16 *)skb->data);10221022- struct pending_tx_info *pending_tx_info = netbk->pending_tx_info;10231023- struct xenvif *vif = pending_tx_info[pending_idx].vif;10241024- struct xen_netif_tx_request *txp;1025999 struct skb_shared_info *shinfo = skb_shinfo(skb);10261000 int nr_frags = shinfo->nr_frags;10271001 int i, err, start;1028100210291003 /* Check status of header. */10301004 err = gop->status;10311031- if (unlikely(err)) {10321032- pending_ring_idx_t index;10331033- index = pending_index(netbk->pending_prod++);10341034- txp = &pending_tx_info[pending_idx].req;10351035- make_tx_response(vif, txp, XEN_NETIF_RSP_ERROR);10361036- netbk->pending_ring[index] = pending_idx;10371037- xenvif_put(vif);10381038- }10051005+ if (unlikely(err))10061006+ xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_ERROR);1039100710401008 /* Skip first skb fragment if it is on same page as header fragment. */10411009 start = (frag_get_pending_idx(&shinfo->frags[0]) == pending_idx);1042101010431011 for (i = start; i < nr_frags; i++) {10441012 int j, newerr;10451045- pending_ring_idx_t index;1046101310471014 pending_idx = frag_get_pending_idx(&shinfo->frags[i]);10481015···10411028 if (likely(!newerr)) {10421029 /* Had a previous error? Invalidate this fragment. */10431030 if (unlikely(err))10441044- xen_netbk_idx_release(netbk, pending_idx);10311031+ xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY);10451032 continue;10461033 }1047103410481035 /* Error on this fragment: respond to client with an error. */10491049- txp = &netbk->pending_tx_info[pending_idx].req;10501050- make_tx_response(vif, txp, XEN_NETIF_RSP_ERROR);10511051- index = pending_index(netbk->pending_prod++);10521052- netbk->pending_ring[index] = pending_idx;10531053- xenvif_put(vif);10361036+ xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_ERROR);1054103710551038 /* Not the first error? Preceding frags already invalidated. */10561039 if (err)···1054104510551046 /* First error: invalidate header and preceding fragments. */10561047 pending_idx = *((u16 *)skb->data);10571057- xen_netbk_idx_release(netbk, pending_idx);10481048+ xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY);10581049 for (j = start; j < i; j++) {10591050 pending_idx = frag_get_pending_idx(&shinfo->frags[j]);10601060- xen_netbk_idx_release(netbk, pending_idx);10511051+ xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY);10611052 }1062105310631054 /* Remember the error: invalidate all subsequent fragments. */···1091108210921083 /* Take an extra reference to offset xen_netbk_idx_release */10931084 get_page(netbk->mmap_pages[pending_idx]);10941094- xen_netbk_idx_release(netbk, pending_idx);10851085+ xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY);10951086 }10961087}10971088···1104109511051096 do {11061097 if (unlikely(work_to_do-- <= 0)) {11071107- netdev_dbg(vif->dev, "Missing extra info\n");10981098+ netdev_err(vif->dev, "Missing extra info\n");10991099+ netbk_fatal_tx_err(vif);11081100 return -EBADR;11091101 }11101102···11141104 if (unlikely(!extra.type ||11151105 extra.type >= XEN_NETIF_EXTRA_TYPE_MAX)) {11161106 vif->tx.req_cons = ++cons;11171117- netdev_dbg(vif->dev,11071107+ netdev_err(vif->dev,11181108 "Invalid extra type: %d\n", extra.type);11091109+ netbk_fatal_tx_err(vif);11191110 return -EINVAL;11201111 }11211112···11321121 struct xen_netif_extra_info *gso)11331122{11341123 if (!gso->u.gso.size) {11351135- netdev_dbg(vif->dev, "GSO size must not be zero.\n");11241124+ netdev_err(vif->dev, "GSO size must not be zero.\n");11251125+ netbk_fatal_tx_err(vif);11361126 return -EINVAL;11371127 }1138112811391129 /* Currently only TCPv4 S.O. is supported. */11401130 if (gso->u.gso.type != XEN_NETIF_GSO_TYPE_TCPV4) {11411141- netdev_dbg(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type);11311131+ netdev_err(vif->dev, "Bad GSO type %d.\n", gso->u.gso.type);11321132+ netbk_fatal_tx_err(vif);11421133 return -EINVAL;11431134 }11441135···1277126412781265 /* Get a netif from the list with work to do. */12791266 vif = poll_net_schedule_list(netbk);12671267+ /* This can sometimes happen because the test of12681268+ * list_empty(net_schedule_list) at the top of the12691269+ * loop is unlocked. Just go back and have another12701270+ * look.12711271+ */12801272 if (!vif)12811273 continue;12741274+12751275+ if (vif->tx.sring->req_prod - vif->tx.req_cons >12761276+ XEN_NETIF_TX_RING_SIZE) {12771277+ netdev_err(vif->dev,12781278+ "Impossible number of requests. "12791279+ "req_prod %d, req_cons %d, size %ld\n",12801280+ vif->tx.sring->req_prod, vif->tx.req_cons,12811281+ XEN_NETIF_TX_RING_SIZE);12821282+ netbk_fatal_tx_err(vif);12831283+ continue;12841284+ }1282128512831286 RING_FINAL_CHECK_FOR_REQUESTS(&vif->tx, work_to_do);12841287 if (!work_to_do) {···13231294 work_to_do = xen_netbk_get_extras(vif, extras,13241295 work_to_do);13251296 idx = vif->tx.req_cons;13261326- if (unlikely(work_to_do < 0)) {13271327- netbk_tx_err(vif, &txreq, idx);12971297+ if (unlikely(work_to_do < 0))13281298 continue;13291329- }13301299 }1331130013321301 ret = netbk_count_requests(vif, &txreq, txfrags, work_to_do);13331333- if (unlikely(ret < 0)) {13341334- netbk_tx_err(vif, &txreq, idx - ret);13021302+ if (unlikely(ret < 0))13351303 continue;13361336- }13041304+13371305 idx += ret;1338130613391307 if (unlikely(txreq.size < ETH_HLEN)) {···1342131613431317 /* No crossing a page as the payload mustn't fragment. */13441318 if (unlikely((txreq.offset + txreq.size) > PAGE_SIZE)) {13451345- netdev_dbg(vif->dev,13191319+ netdev_err(vif->dev,13461320 "txreq.offset: %x, size: %u, end: %lu\n",13471321 txreq.offset, txreq.size,13481322 (txreq.offset&~PAGE_MASK) + txreq.size);13491349- netbk_tx_err(vif, &txreq, idx);13231323+ netbk_fatal_tx_err(vif);13501324 continue;13511325 }13521326···13741348 gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1];1375134913761350 if (netbk_set_skb_gso(vif, skb, gso)) {13511351+ /* Failure in netbk_set_skb_gso is fatal. */13771352 kfree_skb(skb);13781378- netbk_tx_err(vif, &txreq, idx);13791353 continue;13801354 }13811355 }···14741448 txp->size -= data_len;14751449 } else {14761450 /* Schedule a response immediately. */14771477- xen_netbk_idx_release(netbk, pending_idx);14511451+ xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY);14781452 }1479145314801454 if (txp->flags & XEN_NETTXF_csum_blank)···15261500 xen_netbk_tx_submit(netbk);15271501}1528150215291529-static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx)15031503+static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx,15041504+ u8 status)15301505{15311506 struct xenvif *vif;15321507 struct pending_tx_info *pending_tx_info;···1541151415421515 vif = pending_tx_info->vif;1543151615441544- make_tx_response(vif, &pending_tx_info->req, XEN_NETIF_RSP_OKAY);15171517+ make_tx_response(vif, &pending_tx_info->req, status);1545151815461519 index = pending_index(netbk->pending_prod++);15471520 netbk->pending_ring[index] = pending_idx;
+2-2
drivers/pinctrl/Kconfig
···184184 select PINMUX185185 select PINCONF186186187187-config PINCTRL_EXYNOS4188188- bool "Pinctrl driver data for Exynos4 SoC"187187+config PINCTRL_EXYNOS188188+ bool "Pinctrl driver data for Samsung EXYNOS SoCs"189189 depends on OF && GPIOLIB190190 select PINCTRL_SAMSUNG191191
···998998 return NULL;999999 }1000100010011001- ret = of_regulator_match(pdev->dev.parent, regulators, matches, count);10011001+ ret = of_regulator_match(&pdev->dev, regulators, matches, count);10021002 if (ret < 0) {10031003 dev_err(&pdev->dev, "Error parsing regulator init data: %d\n",10041004 ret);
+3
drivers/rtc/rtc-isl1208.c
···506506{507507 unsigned long timeout = jiffies + msecs_to_jiffies(1000);508508 struct i2c_client *client = data;509509+ struct rtc_device *rtc = i2c_get_clientdata(client);509510 int handled = 0, sr, err;510511511512 /*···528527529528 if (sr & ISL1208_REG_SR_ALM) {530529 dev_dbg(&client->dev, "alarm!\n");530530+531531+ rtc_update_irq(rtc, 1, RTC_IRQF | RTC_AF);531532532533 /* Clear the alarm */533534 sr &= ~ISL1208_REG_SR_ALM;
+5-3
drivers/rtc/rtc-pl031.c
···4444#define RTC_YMR 0x34 /* Year match register */4545#define RTC_YLR 0x38 /* Year data load register */46464747+#define RTC_CR_EN (1 << 0) /* counter enable bit */4748#define RTC_CR_CWEN (1 << 26) /* Clockwatch enable bit */48494950#define RTC_TCR_EN (1 << 1) /* Periodic timer enable bit */···321320 struct pl031_local *ldata;322321 struct pl031_vendor_data *vendor = id->data;323322 struct rtc_class_ops *ops = &vendor->ops;324324- unsigned long time;323323+ unsigned long time, data;325324326325 ret = amba_request_regions(adev, NULL);327326 if (ret)···346345 dev_dbg(&adev->dev, "designer ID = 0x%02x\n", amba_manf(adev));347346 dev_dbg(&adev->dev, "revision = 0x%01x\n", amba_rev(adev));348347348348+ data = readl(ldata->base + RTC_CR);349349 /* Enable the clockwatch on ST Variants */350350 if (vendor->clockwatch)351351- writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN,352352- ldata->base + RTC_CR);351351+ data |= RTC_CR_CWEN;352352+ writel(data | RTC_CR_EN, ldata->base + RTC_CR);353353354354 /*355355 * On ST PL031 variants, the RTC reset value does not provide correct
···443443444444void ssb_bus_unregister(struct ssb_bus *bus)445445{446446+ int err;447447+448448+ err = ssb_gpio_unregister(bus);449449+ if (err == -EBUSY)450450+ ssb_dprintk(KERN_ERR PFX "Some GPIOs are still in use.\n");451451+ else if (err)452452+ ssb_dprintk(KERN_ERR PFX453453+ "Can not unregister GPIO driver: %i\n", err);454454+446455 ssb_buses_lock();447456 ssb_devices_unregister(bus);448457 list_del(&bus->list);
+5
drivers/ssb/ssb_private.h
···252252253253#ifdef CONFIG_SSB_DRIVER_GPIO254254extern int ssb_gpio_init(struct ssb_bus *bus);255255+extern int ssb_gpio_unregister(struct ssb_bus *bus);255256#else /* CONFIG_SSB_DRIVER_GPIO */256257static inline int ssb_gpio_init(struct ssb_bus *bus)257258{258259 return -ENOTSUPP;260260+}261261+static inline int ssb_gpio_unregister(struct ssb_bus *bus)262262+{263263+ return 0;259264}260265#endif /* CONFIG_SSB_DRIVER_GPIO */261266
+7-1
drivers/target/target_core_device.c
···941941942942int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors)943943{944944+ int block_size = dev->dev_attrib.block_size;945945+944946 if (dev->export_count) {945947 pr_err("dev[%p]: Unable to change SE Device"946948 " fabric_max_sectors while export_count is %d\n",···980978 /*981979 * Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks()982980 */981981+ if (!block_size) {982982+ block_size = 512;983983+ pr_warn("Defaulting to 512 for zero block_size\n");984984+ }983985 fabric_max_sectors = se_dev_align_max_sectors(fabric_max_sectors,984984- dev->dev_attrib.block_size);986986+ block_size);985987986988 dev->dev_attrib.fabric_max_sectors = fabric_max_sectors;987989 pr_debug("dev[%p]: SE Device max_sectors changed to %u\n",
+5
drivers/target/target_core_fabric_configfs.c
···754754 return -EFAULT;755755 }756756757757+ if (!(dev->dev_flags & DF_CONFIGURED)) {758758+ pr_err("se_device not configured yet, cannot port link\n");759759+ return -ENODEV;760760+ }761761+757762 tpg_ci = &lun_ci->ci_parent->ci_group->cg_item;758763 se_tpg = container_of(to_config_group(tpg_ci),759764 struct se_portal_group, tpg_group);
···641641642642out:643643 rbuf = transport_kmap_data_sg(cmd);644644- if (!rbuf)645645- return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;646646-647647- memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length));648648- transport_kunmap_data_sg(cmd);644644+ if (rbuf) {645645+ memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length));646646+ transport_kunmap_data_sg(cmd);647647+ }649648650649 if (!ret)651650 target_complete_cmd(cmd, GOOD);···850851{851852 struct se_device *dev = cmd->se_dev;852853 char *cdb = cmd->t_task_cdb;853853- unsigned char *buf, *map_buf;854854+ unsigned char buf[SE_MODE_PAGE_BUF], *rbuf;854855 int type = dev->transport->get_device_type(dev);855856 int ten = (cmd->t_task_cdb[0] == MODE_SENSE_10);856857 bool dbd = !!(cdb[1] & 0x08);···862863 int ret;863864 int i;864865865865- map_buf = transport_kmap_data_sg(cmd);866866- if (!map_buf)867867- return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;868868- /*869869- * If SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC is not set, then we870870- * know we actually allocated a full page. Otherwise, if the871871- * data buffer is too small, allocate a temporary buffer so we872872- * don't have to worry about overruns in all our INQUIRY873873- * emulation handling.874874- */875875- if (cmd->data_length < SE_MODE_PAGE_BUF &&876876- (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC)) {877877- buf = kzalloc(SE_MODE_PAGE_BUF, GFP_KERNEL);878878- if (!buf) {879879- transport_kunmap_data_sg(cmd);880880- return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;881881- }882882- } else {883883- buf = map_buf;884884- }866866+ memset(buf, 0, SE_MODE_PAGE_BUF);867867+885868 /*886869 * Skip over MODE DATA LENGTH + MEDIUM TYPE fields to byte 3 for887870 * MODE_SENSE_10 and byte 2 for MODE_SENSE (6).···915934 if (page == 0x3f) {916935 if (subpage != 0x00 && subpage != 0xff) {917936 pr_warn("MODE_SENSE: Invalid subpage code: 0x%02x\n", subpage);918918- kfree(buf);919919- transport_kunmap_data_sg(cmd);920937 return TCM_INVALID_CDB_FIELD;921938 }922939···951972 pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n",952973 page, subpage);953974954954- transport_kunmap_data_sg(cmd);955975 return TCM_UNKNOWN_MODE_PAGE;956976957977set_length:···959981 else960982 buf[0] = length - 1;961983962962- if (buf != map_buf) {963963- memcpy(map_buf, buf, cmd->data_length);964964- kfree(buf);984984+ rbuf = transport_kmap_data_sg(cmd);985985+ if (rbuf) {986986+ memcpy(rbuf, buf, min_t(u32, SE_MODE_PAGE_BUF, cmd->data_length));987987+ transport_kunmap_data_sg(cmd);965988 }966989967967- transport_kunmap_data_sg(cmd);968990 target_complete_cmd(cmd, GOOD);969991 return 0;970992}
+44
drivers/usb/core/hcd.c
···3939#include <asm/unaligned.h>4040#include <linux/platform_device.h>4141#include <linux/workqueue.h>4242+#include <linux/pm_runtime.h>42434344#include <linux/usb.h>4445#include <linux/usb/hcd.h>···10261025 return retval;10271026}1028102710281028+/*10291029+ * usb_hcd_start_port_resume - a root-hub port is sending a resume signal10301030+ * @bus: the bus which the root hub belongs to10311031+ * @portnum: the port which is being resumed10321032+ *10331033+ * HCDs should call this function when they know that a resume signal is10341034+ * being sent to a root-hub port. The root hub will be prevented from10351035+ * going into autosuspend until usb_hcd_end_port_resume() is called.10361036+ *10371037+ * The bus's private lock must be held by the caller.10381038+ */10391039+void usb_hcd_start_port_resume(struct usb_bus *bus, int portnum)10401040+{10411041+ unsigned bit = 1 << portnum;10421042+10431043+ if (!(bus->resuming_ports & bit)) {10441044+ bus->resuming_ports |= bit;10451045+ pm_runtime_get_noresume(&bus->root_hub->dev);10461046+ }10471047+}10481048+EXPORT_SYMBOL_GPL(usb_hcd_start_port_resume);10491049+10501050+/*10511051+ * usb_hcd_end_port_resume - a root-hub port has stopped sending a resume signal10521052+ * @bus: the bus which the root hub belongs to10531053+ * @portnum: the port which is being resumed10541054+ *10551055+ * HCDs should call this function when they know that a resume signal has10561056+ * stopped being sent to a root-hub port. The root hub will be allowed to10571057+ * autosuspend again.10581058+ *10591059+ * The bus's private lock must be held by the caller.10601060+ */10611061+void usb_hcd_end_port_resume(struct usb_bus *bus, int portnum)10621062+{10631063+ unsigned bit = 1 << portnum;10641064+10651065+ if (bus->resuming_ports & bit) {10661066+ bus->resuming_ports &= ~bit;10671067+ pm_runtime_put_noidle(&bus->root_hub->dev);10681068+ }10691069+}10701070+EXPORT_SYMBOL_GPL(usb_hcd_end_port_resume);1029107110301072/*-------------------------------------------------------------------------*/10311073
+52-18
drivers/usb/core/hub.c
···28382838EXPORT_SYMBOL_GPL(usb_enable_ltm);2839283928402840#ifdef CONFIG_USB_SUSPEND28412841+/*28422842+ * usb_disable_function_remotewakeup - disable usb3.028432843+ * device's function remote wakeup28442844+ * @udev: target device28452845+ *28462846+ * Assume there's only one function on the USB 3.028472847+ * device and disable remote wake for the first28482848+ * interface. FIXME if the interface association28492849+ * descriptor shows there's more than one function.28502850+ */28512851+static int usb_disable_function_remotewakeup(struct usb_device *udev)28522852+{28532853+ return usb_control_msg(udev, usb_sndctrlpipe(udev, 0),28542854+ USB_REQ_CLEAR_FEATURE, USB_RECIP_INTERFACE,28552855+ USB_INTRF_FUNC_SUSPEND, 0, NULL, 0,28562856+ USB_CTRL_SET_TIMEOUT);28572857+}2841285828422859/*28432860 * usb_port_suspend - suspend a usb device's upstream port···29722955 dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n",29732956 port1, status);29742957 /* paranoia: "should not happen" */29752975- if (udev->do_remote_wakeup)29762976- (void) usb_control_msg(udev, usb_sndctrlpipe(udev, 0),29772977- USB_REQ_CLEAR_FEATURE, USB_RECIP_DEVICE,29782978- USB_DEVICE_REMOTE_WAKEUP, 0,29792979- NULL, 0,29802980- USB_CTRL_SET_TIMEOUT);29582958+ if (udev->do_remote_wakeup) {29592959+ if (!hub_is_superspeed(hub->hdev)) {29602960+ (void) usb_control_msg(udev,29612961+ usb_sndctrlpipe(udev, 0),29622962+ USB_REQ_CLEAR_FEATURE,29632963+ USB_RECIP_DEVICE,29642964+ USB_DEVICE_REMOTE_WAKEUP, 0,29652965+ NULL, 0,29662966+ USB_CTRL_SET_TIMEOUT);29672967+ } else29682968+ (void) usb_disable_function_remotewakeup(udev);29692969+29702970+ }2981297129822972 /* Try to enable USB2 hardware LPM again */29832973 if (udev->usb2_hw_lpm_capable == 1)···30763052 * udev->reset_resume30773053 */30783054 } else if (udev->actconfig && !udev->reset_resume) {30793079- le16_to_cpus(&devstatus);30803080- if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) {30813081- status = usb_control_msg(udev,30823082- usb_sndctrlpipe(udev, 0),30833083- USB_REQ_CLEAR_FEATURE,30553055+ if (!hub_is_superspeed(udev->parent)) {30563056+ le16_to_cpus(&devstatus);30573057+ if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP))30583058+ status = usb_control_msg(udev,30593059+ usb_sndctrlpipe(udev, 0),30603060+ USB_REQ_CLEAR_FEATURE,30843061 USB_RECIP_DEVICE,30853085- USB_DEVICE_REMOTE_WAKEUP, 0,30863086- NULL, 0,30873087- USB_CTRL_SET_TIMEOUT);30883088- if (status)30893089- dev_dbg(&udev->dev,30903090- "disable remote wakeup, status %d\n",30913091- status);30623062+ USB_DEVICE_REMOTE_WAKEUP, 0,30633063+ NULL, 0,30643064+ USB_CTRL_SET_TIMEOUT);30653065+ } else {30663066+ status = usb_get_status(udev, USB_RECIP_INTERFACE, 0,30673067+ &devstatus);30683068+ le16_to_cpus(&devstatus);30693069+ if (!status && devstatus & (USB_INTRF_STAT_FUNC_RW_CAP30703070+ | USB_INTRF_STAT_FUNC_RW))30713071+ status =30723072+ usb_disable_function_remotewakeup(udev);30923073 }30743074+30753075+ if (status)30763076+ dev_dbg(&udev->dev,30773077+ "disable remote wakeup, status %d\n",30783078+ status);30933079 status = 0;30943080 }30953081 return status;
···649649 status = STS_PCD;650650 }651651 }652652- /* FIXME autosuspend idle root hubs */652652+653653+ /* If a resume is in progress, make sure it can finish */654654+ if (ehci->resuming_ports)655655+ mod_timer(&hcd->rh_timer, jiffies + msecs_to_jiffies(25));656656+653657 spin_unlock_irqrestore (&ehci->lock, flags);654658 return status ? retval : 0;655659}···855851 /* resume signaling for 20 msec */856852 ehci->reset_done[wIndex] = jiffies857853 + msecs_to_jiffies(20);854854+ usb_hcd_start_port_resume(&hcd->self, wIndex);858855 /* check the port again */859856 mod_timer(&ehci_to_hcd(ehci)->rh_timer,860857 ehci->reset_done[wIndex]);···867862 clear_bit(wIndex, &ehci->suspended_ports);868863 set_bit(wIndex, &ehci->port_c_suspend);869864 ehci->reset_done[wIndex] = 0;865865+ usb_hcd_end_port_resume(&hcd->self, wIndex);870866871867 /* stop resume signaling */872868 temp = ehci_readl(ehci, status_reg);···956950 ehci->reset_done[wIndex] = 0;957951 if (temp & PORT_PE)958952 set_bit(wIndex, &ehci->port_c_suspend);953953+ usb_hcd_end_port_resume(&hcd->self, wIndex);959954 }960955961956 if (temp & PORT_OC)
+30-20
drivers/usb/host/ehci-q.c
···11971197 if (ehci->async_iaa || ehci->async_unlinking)11981198 return;1199119912001200- /* Do all the waiting QHs at once */12011201- ehci->async_iaa = ehci->async_unlink;12021202- ehci->async_unlink = NULL;12031203-12041200 /* If the controller isn't running, we don't have to wait for it */12051201 if (unlikely(ehci->rh_state < EHCI_RH_RUNNING)) {12021202+12031203+ /* Do all the waiting QHs */12041204+ ehci->async_iaa = ehci->async_unlink;12051205+ ehci->async_unlink = NULL;12061206+12061207 if (!nested) /* Avoid recursion */12071208 end_unlink_async(ehci);1208120912091210 /* Otherwise start a new IAA cycle */12101211 } else if (likely(ehci->rh_state == EHCI_RH_RUNNING)) {12121212+ struct ehci_qh *qh;12131213+12141214+ /* Do only the first waiting QH (nVidia bug?) */12151215+ qh = ehci->async_unlink;12161216+ ehci->async_iaa = qh;12171217+ ehci->async_unlink = qh->unlink_next;12181218+ qh->unlink_next = NULL;12191219+12111220 /* Make sure the unlinks are all visible to the hardware */12121221 wmb();12131222···12641255 }12651256}1266125712581258+static void start_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh);12591259+12671260static void unlink_empty_async(struct ehci_hcd *ehci)12681261{12691269- struct ehci_qh *qh, *next;12701270- bool stopped = (ehci->rh_state < EHCI_RH_RUNNING);12621262+ struct ehci_qh *qh;12631263+ struct ehci_qh *qh_to_unlink = NULL;12711264 bool check_unlinks_later = false;12651265+ int count = 0;1272126612731273- /* Unlink all the async QHs that have been empty for a timer cycle */12741274- next = ehci->async->qh_next.qh;12751275- while (next) {12761276- qh = next;12771277- next = qh->qh_next.qh;12781278-12671267+ /* Find the last async QH which has been empty for a timer cycle */12681268+ for (qh = ehci->async->qh_next.qh; qh; qh = qh->qh_next.qh) {12791269 if (list_empty(&qh->qtd_list) &&12801270 qh->qh_state == QH_STATE_LINKED) {12811281- if (!stopped && qh->unlink_cycle ==12821282- ehci->async_unlink_cycle)12711271+ ++count;12721272+ if (qh->unlink_cycle == ehci->async_unlink_cycle)12831273 check_unlinks_later = true;12841274 else12851285- single_unlink_async(ehci, qh);12751275+ qh_to_unlink = qh;12861276 }12871277 }1288127812891289- /* Start a new IAA cycle if any QHs are waiting for it */12901290- if (ehci->async_unlink)12911291- start_iaa_cycle(ehci, false);12791279+ /* If nothing else is being unlinked, unlink the last empty QH */12801280+ if (!ehci->async_iaa && !ehci->async_unlink && qh_to_unlink) {12811281+ start_unlink_async(ehci, qh_to_unlink);12821282+ --count;12831283+ }1292128412931293- /* QHs that haven't been empty for long enough will be handled later */12941294- if (check_unlinks_later) {12851285+ /* Other QHs will be handled later */12861286+ if (count > 0) {12951287 ehci_enable_event(ehci, EHCI_HRTIMER_ASYNC_UNLINKS, true);12961288 ++ehci->async_unlink_cycle;12971289 }
+6-3
drivers/usb/host/ehci-sched.c
···213213}214214215215static const unsigned char216216-max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 30, 0 };216216+max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 125, 25 };217217218218/* carryover low/fullspeed bandwidth that crosses uframe boundries */219219static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8])···22122212 }22132213 ehci->now_frame = now_frame;2214221422152215+ frame = ehci->last_iso_frame;22152216 for (;;) {22162217 union ehci_shadow q, *q_p;22172218 __hc32 type, *hw_p;2218221922192219- frame = ehci->last_iso_frame;22202220restart:22212221 /* scan each element in frame's queue for completions */22222222 q_p = &ehci->pshadow [frame];···23212321 /* Stop when we have reached the current frame */23222322 if (frame == now_frame)23232323 break;23242324- ehci->last_iso_frame = (frame + 1) & fmask;23242324+23252325+ /* The last frame may still have active siTDs */23262326+ ehci->last_iso_frame = frame;23272327+ frame = (frame + 1) & fmask;23252328 }23262329}
+15-14
drivers/usb/host/ehci-timer.c
···113113114114 if (want != actual) {115115116116- /* Poll again later, but give up after about 20 ms */117117- if (ehci->ASS_poll_count++ < 20) {118118- ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true);119119- return;120120- }121121- ehci_dbg(ehci, "Waited too long for the async schedule status (%x/%x), giving up\n",122122- want, actual);116116+ /* Poll again later */117117+ ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true);118118+ ++ehci->ASS_poll_count;119119+ return;123120 }121121+122122+ if (ehci->ASS_poll_count > 20)123123+ ehci_dbg(ehci, "ASS poll count reached %d\n",124124+ ehci->ASS_poll_count);124125 ehci->ASS_poll_count = 0;125126126127 /* The status is up-to-date; restart or stop the schedule as needed */···160159161160 if (want != actual) {162161163163- /* Poll again later, but give up after about 20 ms */164164- if (ehci->PSS_poll_count++ < 20) {165165- ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true);166166- return;167167- }168168- ehci_dbg(ehci, "Waited too long for the periodic schedule status (%x/%x), giving up\n",169169- want, actual);162162+ /* Poll again later */163163+ ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true);164164+ return;170165 }166166+167167+ if (ehci->PSS_poll_count > 20)168168+ ehci_dbg(ehci, "PSS poll count reached %d\n",169169+ ehci->PSS_poll_count);171170 ehci->PSS_poll_count = 0;172171173172 /* The status is up-to-date; restart or stop the schedule as needed */
+1
drivers/usb/host/pci-quirks.c
···780780 "defaulting to EHCI.\n");781781 dev_warn(&xhci_pdev->dev,782782 "USB 3.0 devices will work at USB 2.0 speeds.\n");783783+ usb_disable_xhci_ports(xhci_pdev);783784 return;784785 }785786
+3
drivers/usb/host/uhci-hub.c
···116116 }117117 }118118 clear_bit(port, &uhci->resuming_ports);119119+ usb_hcd_end_port_resume(&uhci_to_hcd(uhci)->self, port);119120}120121121122/* Wait for the UHCI controller in HP's iLO2 server management chip.···168167 set_bit(port, &uhci->resuming_ports);169168 uhci->ports_timeout = jiffies +170169 msecs_to_jiffies(25);170170+ usb_hcd_start_port_resume(171171+ &uhci_to_hcd(uhci)->self, port);171172172173 /* Make sure we see the port again173174 * after the resuming period is over. */
+9-4
drivers/usb/host/xhci-ring.c
···16981698 faked_port_index + 1);16991699 if (slot_id && xhci->devs[slot_id])17001700 xhci_ring_device(xhci, slot_id);17011701- if (bus_state->port_remote_wakeup && (1 << faked_port_index)) {17011701+ if (bus_state->port_remote_wakeup & (1 << faked_port_index)) {17021702 bus_state->port_remote_wakeup &=17031703 ~(1 << faked_port_index);17041704 xhci_test_and_clear_bit(xhci, port_array,···25892589 (trb_comp_code != COMP_STALL &&25902590 trb_comp_code != COMP_BABBLE))25912591 xhci_urb_free_priv(xhci, urb_priv);25922592+ else25932593+ kfree(urb_priv);2592259425932595 usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb);25942596 if ((urb->actual_length != urb->transfer_buffer_length &&···31103108 * running_total.31113109 */31123110 packets_transferred = (running_total + trb_buff_len) /31133113- usb_endpoint_maxp(&urb->ep->desc);31113111+ GET_MAX_PACKET(usb_endpoint_maxp(&urb->ep->desc));3114311231153113 if ((total_packet_count - packets_transferred) > 31)31163114 return 31 << 17;···36443642 td_len = urb->iso_frame_desc[i].length;36453643 td_remain_len = td_len;36463644 total_packet_count = DIV_ROUND_UP(td_len,36473647- usb_endpoint_maxp(&urb->ep->desc));36453645+ GET_MAX_PACKET(36463646+ usb_endpoint_maxp(&urb->ep->desc)));36483647 /* A zero-length transfer still involves at least one packet. */36493648 if (total_packet_count == 0)36503649 total_packet_count++;···36673664 td = urb_priv->td[i];36683665 for (j = 0; j < trbs_per_td; j++) {36693666 u32 remainder = 0;36703670- field = TRB_TBC(burst_count) | TRB_TLBPC(residue);36673667+ field = 0;3671366836723669 if (first_trb) {36703670+ field = TRB_TBC(burst_count) |36713671+ TRB_TLBPC(residue);36733672 /* Queue the isoc TRB */36743673 field |= TRB_TYPE(TRB_ISOC);36753674 /* Assume URB_ISO_ASAP is set */
···147147#define XSENS_CONVERTER_6_PID 0xD38E148148#define XSENS_CONVERTER_7_PID 0xD38F149149150150+/**151151+ * Zolix (www.zolix.com.cb) product ids152152+ */153153+#define FTDI_OMNI1509 0xD491 /* Omni1509 embedded USB-serial */154154+150155/*151156 * NDI (www.ndigital.com) product ids152157 */···209204210205/*211206 * ELV USB devices submitted by Christian Abt of ELV (www.elv.de).212212- * All of these devices use FTDI's vendor ID (0x0403).207207+ * Almost all of these devices use FTDI's vendor ID (0x0403).213208 * Further IDs taken from ELV Windows .inf file.214209 *215210 * The previously included PID for the UO 100 module was incorrect.···217212 *218213 * Armin Laeuger originally sent the PID for the UM 100 module.219214 */215215+#define FTDI_ELV_VID 0x1B1F /* ELV AG */216216+#define FTDI_ELV_WS300_PID 0xC006 /* eQ3 WS 300 PC II */220217#define FTDI_ELV_USR_PID 0xE000 /* ELV Universal-Sound-Recorder */221218#define FTDI_ELV_MSM1_PID 0xE001 /* ELV Mini-Sound-Modul */222219#define FTDI_ELV_KL100_PID 0xE002 /* ELV Kfz-Leistungsmesser KL 100 */
···9292 return 0;9393}94949595-/* This places the HUAWEI E220 devices in multi-port mode */9696-int usb_stor_huawei_e220_init(struct us_data *us)9595+/* This places the HUAWEI usb dongles in multi-port mode */9696+static int usb_stor_huawei_feature_init(struct us_data *us)9797{9898 int result;9999···103103 0x01, 0x0, NULL, 0x0, 1000);104104 US_DEBUGP("Huawei mode set result is %d\n", result);105105 return 0;106106+}107107+108108+/*109109+ * It will send a scsi switch command called rewind' to huawei dongle.110110+ * When the dongle receives this command at the first time,111111+ * it will reboot immediately. After rebooted, it will ignore this command.112112+ * So it is unnecessary to read its response.113113+ */114114+static int usb_stor_huawei_scsi_init(struct us_data *us)115115+{116116+ int result = 0;117117+ int act_len = 0;118118+ struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;119119+ char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,120120+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};121121+122122+ bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);123123+ bcbw->Tag = 0;124124+ bcbw->DataTransferLength = 0;125125+ bcbw->Flags = bcbw->Lun = 0;126126+ bcbw->Length = sizeof(rewind_cmd);127127+ memset(bcbw->CDB, 0, sizeof(bcbw->CDB));128128+ memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd));129129+130130+ result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcbw,131131+ US_BULK_CB_WRAP_LEN, &act_len);132132+ US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);133133+ return result;134134+}135135+136136+/*137137+ * It tries to find the supported Huawei USB dongles.138138+ * In Huawei, they assign the following product IDs139139+ * for all of their mobile broadband dongles,140140+ * including the new dongles in the future.141141+ * So if the product ID is not included in this list,142142+ * it means it is not Huawei's mobile broadband dongles.143143+ */144144+static int usb_stor_huawei_dongles_pid(struct us_data *us)145145+{146146+ struct usb_interface_descriptor *idesc;147147+ int idProduct;148148+149149+ idesc = &us->pusb_intf->cur_altsetting->desc;150150+ idProduct = us->pusb_dev->descriptor.idProduct;151151+ /* The first port is CDROM,152152+ * means the dongle in the single port mode,153153+ * and a switch command is required to be sent. */154154+ if (idesc && idesc->bInterfaceNumber == 0) {155155+ if ((idProduct == 0x1001)156156+ || (idProduct == 0x1003)157157+ || (idProduct == 0x1004)158158+ || (idProduct >= 0x1401 && idProduct <= 0x1500)159159+ || (idProduct >= 0x1505 && idProduct <= 0x1600)160160+ || (idProduct >= 0x1c02 && idProduct <= 0x2202)) {161161+ return 1;162162+ }163163+ }164164+ return 0;165165+}166166+167167+int usb_stor_huawei_init(struct us_data *us)168168+{169169+ int result = 0;170170+171171+ if (usb_stor_huawei_dongles_pid(us)) {172172+ if (us->pusb_dev->descriptor.idProduct >= 0x1446)173173+ result = usb_stor_huawei_scsi_init(us);174174+ else175175+ result = usb_stor_huawei_feature_init(us);176176+ }177177+ return result;106178}
+2-2
drivers/usb/storage/initializers.h
···4646 * flash reader */4747int usb_stor_ucr61s2b_init(struct us_data *us);48484949-/* This places the HUAWEI E220 devices in multi-port mode */5050-int usb_stor_huawei_e220_init(struct us_data *us);4949+/* This places the HUAWEI usb dongles in multi-port mode */5050+int usb_stor_huawei_init(struct us_data *us);
···4141#define USUAL_DEV(useProto, useTrans) \4242{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) }43434444+/* Define the device is matched with Vendor ID and interface descriptors */4545+#define UNUSUAL_VENDOR_INTF(id_vendor, cl, sc, pr, \4646+ vendorName, productName, useProtocol, useTransport, \4747+ initFunction, flags) \4848+{ \4949+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \5050+ | USB_DEVICE_ID_MATCH_VENDOR, \5151+ .idVendor = (id_vendor), \5252+ .bInterfaceClass = (cl), \5353+ .bInterfaceSubClass = (sc), \5454+ .bInterfaceProtocol = (pr), \5555+ .driver_info = (flags) \5656+}5757+4458struct usb_device_id usb_storage_usb_ids[] = {4559# include "unusual_devs.h"4660 { } /* Terminating entry */···6450#undef UNUSUAL_DEV6551#undef COMPLIANT_DEV6652#undef USUAL_DEV5353+#undef UNUSUAL_VENDOR_INTF67546855/*6956 * The table of devices to ignore
+28-13
drivers/vhost/net.c
···165165}166166167167/* Caller must have TX VQ lock */168168-static void tx_poll_start(struct vhost_net *net, struct socket *sock)168168+static int tx_poll_start(struct vhost_net *net, struct socket *sock)169169{170170+ int ret;171171+170172 if (unlikely(net->tx_poll_state != VHOST_NET_POLL_STOPPED))171171- return;172172- vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file);173173- net->tx_poll_state = VHOST_NET_POLL_STARTED;173173+ return 0;174174+ ret = vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file);175175+ if (!ret)176176+ net->tx_poll_state = VHOST_NET_POLL_STARTED;177177+ return ret;174178}175179176180/* In case of DMA done not in order in lower device driver for some reason.···646642 vhost_poll_stop(n->poll + VHOST_NET_VQ_RX);647643}648644649649-static void vhost_net_enable_vq(struct vhost_net *n,645645+static int vhost_net_enable_vq(struct vhost_net *n,650646 struct vhost_virtqueue *vq)651647{652648 struct socket *sock;649649+ int ret;653650654651 sock = rcu_dereference_protected(vq->private_data,655652 lockdep_is_held(&vq->mutex));656653 if (!sock)657657- return;654654+ return 0;658655 if (vq == n->vqs + VHOST_NET_VQ_TX) {659656 n->tx_poll_state = VHOST_NET_POLL_STOPPED;660660- tx_poll_start(n, sock);657657+ ret = tx_poll_start(n, sock);661658 } else662662- vhost_poll_start(n->poll + VHOST_NET_VQ_RX, sock->file);659659+ ret = vhost_poll_start(n->poll + VHOST_NET_VQ_RX, sock->file);660660+661661+ return ret;663662}664663665664static struct socket *vhost_net_stop_vq(struct vhost_net *n,···834827 r = PTR_ERR(ubufs);835828 goto err_ubufs;836829 }837837- oldubufs = vq->ubufs;838838- vq->ubufs = ubufs;830830+839831 vhost_net_disable_vq(n, vq);840832 rcu_assign_pointer(vq->private_data, sock);841841- vhost_net_enable_vq(n, vq);842842-843833 r = vhost_init_used(vq);844834 if (r)845845- goto err_vq;835835+ goto err_used;836836+ r = vhost_net_enable_vq(n, vq);837837+ if (r)838838+ goto err_used;839839+840840+ oldubufs = vq->ubufs;841841+ vq->ubufs = ubufs;846842847843 n->tx_packets = 0;848844 n->tx_zcopy_err = 0;···869859 mutex_unlock(&n->dev.mutex);870860 return 0;871861862862+err_used:863863+ rcu_assign_pointer(vq->private_data, oldsock);864864+ vhost_net_enable_vq(n, vq);865865+ if (ubufs)866866+ vhost_ubuf_put_and_wait(ubufs);872867err_ubufs:873868 fput(sock->file);874869err_vq:
+1-3
drivers/vhost/tcm_vhost.c
···575575576576 /* Must use ioctl VHOST_SCSI_SET_ENDPOINT */577577 tv_tpg = vs->vs_tpg;578578- if (unlikely(!tv_tpg)) {579579- pr_err("%s endpoint not set\n", __func__);578578+ if (unlikely(!tv_tpg))580579 return;581581- }582580583581 mutex_lock(&vq->mutex);584582 vhost_disable_notify(&vs->dev, vq);
+15-3
drivers/vhost/vhost.c
···7777 init_poll_funcptr(&poll->table, vhost_poll_func);7878 poll->mask = mask;7979 poll->dev = dev;8080+ poll->wqh = NULL;80818182 vhost_work_init(&poll->work, fn);8283}83848485/* Start polling a file. We add ourselves to file's wait queue. The caller must8586 * keep a reference to a file until after vhost_poll_stop is called. */8686-void vhost_poll_start(struct vhost_poll *poll, struct file *file)8787+int vhost_poll_start(struct vhost_poll *poll, struct file *file)8788{8889 unsigned long mask;9090+ int ret = 0;89919092 mask = file->f_op->poll(file, &poll->table);9193 if (mask)9294 vhost_poll_wakeup(&poll->wait, 0, 0, (void *)mask);9595+ if (mask & POLLERR) {9696+ if (poll->wqh)9797+ remove_wait_queue(poll->wqh, &poll->wait);9898+ ret = -EINVAL;9999+ }100100+101101+ return ret;93102}9410395104/* Stop polling a file. After this function returns, it becomes safe to drop the96105 * file reference. You must also flush afterwards. */97106void vhost_poll_stop(struct vhost_poll *poll)98107{9999- remove_wait_queue(poll->wqh, &poll->wait);108108+ if (poll->wqh) {109109+ remove_wait_queue(poll->wqh, &poll->wait);110110+ poll->wqh = NULL;111111+ }100112}101113102114static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work,···804792 fput(filep);805793806794 if (pollstart && vq->handle_kick)807807- vhost_poll_start(&vq->poll, vq->kick);795795+ r = vhost_poll_start(&vq->poll, vq->kick);808796809797 mutex_unlock(&vq->mutex);810798
···840840841841 if (irq == -1) {842842 irq = xen_allocate_irq_dynamic();843843- if (irq == -1)843843+ if (irq < 0)844844 goto out;845845846846 irq_set_chip_and_handler_name(irq, &xen_dynamic_chip,···944944945945 if (irq == -1) {946946 irq = xen_allocate_irq_dynamic();947947- if (irq == -1)947947+ if (irq < 0)948948 goto out;949949950950 irq_set_chip_and_handler_name(irq, &xen_percpu_chip,
+7-7
drivers/xen/xen-pciback/pciback_ops.c
···135135 struct pci_dev *dev, struct xen_pci_op *op)136136{137137 struct xen_pcibk_dev_data *dev_data;138138- int otherend = pdev->xdev->otherend_id;139138 int status;140139141140 if (unlikely(verbose_request))···143144 status = pci_enable_msi(dev);144145145146 if (status) {146146- printk(KERN_ERR "error enable msi for guest %x status %x\n",147147- otherend, status);147147+ pr_warn_ratelimited(DRV_NAME ": %s: error enabling MSI for guest %u: err %d\n",148148+ pci_name(dev), pdev->xdev->otherend_id,149149+ status);148150 op->value = 0;149151 return XEN_PCI_ERR_op_failed;150152 }···223223 pci_name(dev), i,224224 op->msix_entries[i].vector);225225 }226226- } else {227227- printk(KERN_WARNING DRV_NAME ": %s: failed to enable MSI-X: err %d!\n",228228- pci_name(dev), result);229229- }226226+ } else227227+ pr_warn_ratelimited(DRV_NAME ": %s: error enabling MSI-X for guest %u: err %d!\n",228228+ pci_name(dev), pdev->xdev->otherend_id,229229+ result);230230 kfree(entries);231231232232 op->value = result;
+10-12
fs/btrfs/extent-tree.c
···45344534 unsigned nr_extents = 0;45354535 int extra_reserve = 0;45364536 enum btrfs_reserve_flush_enum flush = BTRFS_RESERVE_FLUSH_ALL;45374537- int ret;45374537+ int ret = 0;45384538 bool delalloc_lock = true;4539453945404540 /* If we are a free space inode we need to not flush since we will be in···45794579 csum_bytes = BTRFS_I(inode)->csum_bytes;45804580 spin_unlock(&BTRFS_I(inode)->lock);4581458145824582- if (root->fs_info->quota_enabled) {45824582+ if (root->fs_info->quota_enabled)45834583 ret = btrfs_qgroup_reserve(root, num_bytes +45844584 nr_extents * root->leafsize);45854585- if (ret) {45864586- spin_lock(&BTRFS_I(inode)->lock);45874587- calc_csum_metadata_size(inode, num_bytes, 0);45884588- spin_unlock(&BTRFS_I(inode)->lock);45894589- if (delalloc_lock)45904590- mutex_unlock(&BTRFS_I(inode)->delalloc_mutex);45914591- return ret;45924592- }45934593- }4594458545954595- ret = reserve_metadata_bytes(root, block_rsv, to_reserve, flush);45864586+ /*45874587+ * ret != 0 here means the qgroup reservation failed, we go straight to45884588+ * the shared error handling then.45894589+ */45904590+ if (ret == 0)45914591+ ret = reserve_metadata_bytes(root, block_rsv,45924592+ to_reserve, flush);45934593+45964594 if (ret) {45974595 u64 to_free = 0;45984596 unsigned dropped;
···293293 struct btrfs_key key;294294 struct btrfs_ioctl_defrag_range_args range;295295 int num_defrag;296296+ int index;297297+ int ret;296298297299 /* get the inode */298300 key.objectid = defrag->root;299301 btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);300302 key.offset = (u64)-1;303303+304304+ index = srcu_read_lock(&fs_info->subvol_srcu);305305+301306 inode_root = btrfs_read_fs_root_no_name(fs_info, &key);302307 if (IS_ERR(inode_root)) {303303- kmem_cache_free(btrfs_inode_defrag_cachep, defrag);304304- return PTR_ERR(inode_root);308308+ ret = PTR_ERR(inode_root);309309+ goto cleanup;310310+ }311311+ if (btrfs_root_refs(&inode_root->root_item) == 0) {312312+ ret = -ENOENT;313313+ goto cleanup;305314 }306315307316 key.objectid = defrag->ino;···318309 key.offset = 0;319310 inode = btrfs_iget(fs_info->sb, &key, inode_root, NULL);320311 if (IS_ERR(inode)) {321321- kmem_cache_free(btrfs_inode_defrag_cachep, defrag);322322- return PTR_ERR(inode);312312+ ret = PTR_ERR(inode);313313+ goto cleanup;323314 }315315+ srcu_read_unlock(&fs_info->subvol_srcu, index);324316325317 /* do a chunk of defrag */326318 clear_bit(BTRFS_INODE_IN_DEFRAG, &BTRFS_I(inode)->runtime_flags);···356346357347 iput(inode);358348 return 0;349349+cleanup:350350+ srcu_read_unlock(&fs_info->subvol_srcu, index);351351+ kmem_cache_free(btrfs_inode_defrag_cachep, defrag);352352+ return ret;359353}360354361355/*···16081594 if (err < 0 && num_written > 0)16091595 num_written = err;16101596 }16111611-out:15971597+16121598 if (sync)16131599 atomic_dec(&BTRFS_I(inode)->sync_writers);16001600+out:16141601 sb_end_write(inode->i_sb);16151602 current->backing_dev_info = NULL;16161603 return num_written ? num_written : err;
+4-1
fs/btrfs/ioctl.c
···515515516516 BUG_ON(ret);517517518518- d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));519518fail:520519 if (async_transid) {521520 *async_transid = trans->transid;···524525 }525526 if (err && !ret)526527 ret = err;528528+529529+ if (!ret)530530+ d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));531531+527532 return ret;528533}529534
+10-3
fs/btrfs/ordered-data.c
···836836 * if the disk i_size is already at the inode->i_size, or837837 * this ordered extent is inside the disk i_size, we're done838838 */839839- if (disk_i_size == i_size || offset <= disk_i_size) {839839+ if (disk_i_size == i_size)840840 goto out;841841- }841841+842842+ /*843843+ * We still need to update disk_i_size if outstanding_isize is greater844844+ * than disk_i_size.845845+ */846846+ if (offset <= disk_i_size &&847847+ (!ordered || ordered->outstanding_isize <= disk_i_size))848848+ goto out;842849843850 /*844851 * walk backward from this ordered extent to disk_i_size.···877870 break;878871 if (test->file_offset >= i_size)879872 break;880880- if (test->file_offset >= disk_i_size) {873873+ if (entry_end(test) > disk_i_size) {881874 /*882875 * we don't update disk_i_size now, so record this883876 * undealt i_size. Or we will not know the real
+20-5
fs/btrfs/scrub.c
···580580 int corrected = 0;581581 struct btrfs_key key;582582 struct inode *inode = NULL;583583+ struct btrfs_fs_info *fs_info;583584 u64 end = offset + PAGE_SIZE - 1;584585 struct btrfs_root *local_root;586586+ int srcu_index;585587586588 key.objectid = root;587589 key.type = BTRFS_ROOT_ITEM_KEY;588590 key.offset = (u64)-1;589589- local_root = btrfs_read_fs_root_no_name(fixup->root->fs_info, &key);590590- if (IS_ERR(local_root))591591+592592+ fs_info = fixup->root->fs_info;593593+ srcu_index = srcu_read_lock(&fs_info->subvol_srcu);594594+595595+ local_root = btrfs_read_fs_root_no_name(fs_info, &key);596596+ if (IS_ERR(local_root)) {597597+ srcu_read_unlock(&fs_info->subvol_srcu, srcu_index);591598 return PTR_ERR(local_root);599599+ }592600593601 key.type = BTRFS_INODE_ITEM_KEY;594602 key.objectid = inum;595603 key.offset = 0;596596- inode = btrfs_iget(fixup->root->fs_info->sb, &key, local_root, NULL);604604+ inode = btrfs_iget(fs_info->sb, &key, local_root, NULL);605605+ srcu_read_unlock(&fs_info->subvol_srcu, srcu_index);597606 if (IS_ERR(inode))598607 return PTR_ERR(inode);599608···615606 }616607617608 if (PageUptodate(page)) {618618- struct btrfs_fs_info *fs_info;619609 if (PageDirty(page)) {620610 /*621611 * we need to write the data to the defect sector. the···31883180 u64 physical_for_dev_replace;31893181 u64 len;31903182 struct btrfs_fs_info *fs_info = nocow_ctx->sctx->dev_root->fs_info;31833183+ int srcu_index;3191318431923185 key.objectid = root;31933186 key.type = BTRFS_ROOT_ITEM_KEY;31943187 key.offset = (u64)-1;31883188+31893189+ srcu_index = srcu_read_lock(&fs_info->subvol_srcu);31903190+31953191 local_root = btrfs_read_fs_root_no_name(fs_info, &key);31963196- if (IS_ERR(local_root))31923192+ if (IS_ERR(local_root)) {31933193+ srcu_read_unlock(&fs_info->subvol_srcu, srcu_index);31973194 return PTR_ERR(local_root);31953195+ }3198319631993197 key.type = BTRFS_INODE_ITEM_KEY;32003198 key.objectid = inum;32013199 key.offset = 0;32023200 inode = btrfs_iget(fs_info->sb, &key, local_root, NULL);32013201+ srcu_read_unlock(&fs_info->subvol_srcu, srcu_index);32033202 if (IS_ERR(inode))32043203 return PTR_ERR(inode);32053204
+19-8
fs/btrfs/transaction.c
···333333 &root->fs_info->trans_block_rsv,334334 num_bytes, flush);335335 if (ret)336336- return ERR_PTR(ret);336336+ goto reserve_fail;337337 }338338again:339339 h = kmem_cache_alloc(btrfs_trans_handle_cachep, GFP_NOFS);340340- if (!h)341341- return ERR_PTR(-ENOMEM);340340+ if (!h) {341341+ ret = -ENOMEM;342342+ goto alloc_fail;343343+ }342344343345 /*344346 * If we are JOIN_NOLOCK we're already committing a transaction and···367365 if (ret < 0) {368366 /* We must get the transaction if we are JOIN_NOLOCK. */369367 BUG_ON(type == TRANS_JOIN_NOLOCK);370370-371371- if (type < TRANS_JOIN_NOLOCK)372372- sb_end_intwrite(root->fs_info->sb);373373- kmem_cache_free(btrfs_trans_handle_cachep, h);374374- return ERR_PTR(ret);368368+ goto join_fail;375369 }376370377371 cur_trans = root->fs_info->running_transaction;···408410 if (!current->journal_info && type != TRANS_USERSPACE)409411 current->journal_info = h;410412 return h;413413+414414+join_fail:415415+ if (type < TRANS_JOIN_NOLOCK)416416+ sb_end_intwrite(root->fs_info->sb);417417+ kmem_cache_free(btrfs_trans_handle_cachep, h);418418+alloc_fail:419419+ if (num_bytes)420420+ btrfs_block_rsv_release(root, &root->fs_info->trans_block_rsv,421421+ num_bytes);422422+reserve_fail:423423+ if (qgroup_reserved)424424+ btrfs_qgroup_free(root, qgroup_reserved);425425+ return ERR_PTR(ret);411426}412427413428struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
+2-1
fs/btrfs/volumes.c
···15561556 ret = 0;1557155715581558 /* Notify udev that device has changed */15591559- btrfs_kobject_uevent(bdev, KOBJ_CHANGE);15591559+ if (bdev)15601560+ btrfs_kobject_uevent(bdev, KOBJ_CHANGE);1560156115611562error_brelse:15621563 brelse(bh);
+4-4
fs/dlm/user.c
···503503#endif504504 return -EINVAL;505505506506-#ifdef CONFIG_COMPAT507507- if (count > sizeof(struct dlm_write_request32) + DLM_RESNAME_MAXLEN)508508-#else506506+ /*507507+ * can't compare against COMPAT/dlm_write_request32 because508508+ * we don't yet know if is64bit is zero509509+ */509510 if (count > sizeof(struct dlm_write_request) + DLM_RESNAME_MAXLEN)510510-#endif511511 return -EINVAL;512512513513 kbuf = kzalloc(count + 1, GFP_NOFS);
+4-1
fs/nilfs2/ioctl.c
···664664 if (ret < 0)665665 printk(KERN_ERR "NILFS: GC failed during preparation: "666666 "cannot read source blocks: err=%d\n", ret);667667- else667667+ else {668668+ if (nilfs_sb_need_update(nilfs))669669+ set_nilfs_discontinued(nilfs);668670 ret = nilfs_clean_segments(inode->i_sb, argv, kbufs);671671+ }669672670673 nilfs_remove_all_gcinodes(nilfs);671674 clear_nilfs_gc_running(nilfs);
+25
include/linux/llist.h
···125125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))126126127127/**128128+ * llist_for_each_entry_safe - iterate safely against remove over some entries129129+ * of lock-less list of given type.130130+ * @pos: the type * to use as a loop cursor.131131+ * @n: another type * to use as a temporary storage.132132+ * @node: the fist entry of deleted list entries.133133+ * @member: the name of the llist_node with the struct.134134+ *135135+ * In general, some entries of the lock-less list can be traversed136136+ * safely only after being removed from list, so start with an entry137137+ * instead of list head. This variant allows removal of entries138138+ * as we iterate.139139+ *140140+ * If being used on entries deleted from lock-less list directly, the141141+ * traverse order is from the newest to the oldest added entry. If142142+ * you want to traverse from the oldest to the newest, you must143143+ * reverse the order by yourself before traversing.144144+ */145145+#define llist_for_each_entry_safe(pos, n, node, member) \146146+ for ((pos) = llist_entry((node), typeof(*(pos)), member), \147147+ (n) = (pos)->member.next; \148148+ &(pos)->member != NULL; \149149+ (pos) = llist_entry(n, typeof(*(pos)), member), \150150+ (n) = (&(pos)->member != NULL) ? (pos)->member.next : NULL)151151+152152+/**128153 * llist_empty - tests whether a lock-less list is empty129154 * @head: the list to test130155 *
+1-1
include/linux/memcontrol.h
···429429 * the slab_mutex must be held when looping through those caches430430 */431431#define for_each_memcg_cache_index(_idx) \432432- for ((_idx) = 0; i < memcg_limited_groups_array_size; (_idx)++)432432+ for ((_idx) = 0; (_idx) < memcg_limited_groups_array_size; (_idx)++)433433434434static inline bool memcg_kmem_enabled(void)435435{
+1-1
include/linux/mmu_notifier.h
···151151 * Therefore notifier chains can only be traversed when either152152 *153153 * 1. mmap_sem is held.154154- * 2. One of the reverse map locks is held (i_mmap_mutex or anon_vma->mutex).154154+ * 2. One of the reverse map locks is held (i_mmap_mutex or anon_vma->rwsem).155155 * 3. No other concurrent thread can access the list (release)156156 */157157struct mmu_notifier {
+3-3
include/linux/ssb/ssb_driver_gige.h
···9898}9999100100#ifdef CONFIG_BCM47XX101101-#include <asm/mach-bcm47xx/nvram.h>101101+#include <bcm47xx_nvram.h>102102/* Get the device MAC address */103103static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)104104{105105 char buf[20];106106- if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)106106+ if (bcm47xx_nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)107107 return;108108- nvram_parse_macaddr(buf, macaddr);108108+ bcm47xx_nvram_parse_macaddr(buf, macaddr);109109}110110#else111111static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
+2
include/linux/usb.h
···357357 int bandwidth_int_reqs; /* number of Interrupt requests */358358 int bandwidth_isoc_reqs; /* number of Isoc. requests */359359360360+ unsigned resuming_ports; /* bit array: resuming root-hub ports */361361+360362#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)361363 struct mon_bus *mon_bus; /* non-null when associated */362364 int monitored; /* non-zero when monitored */
+3
include/linux/usb/hcd.h
···430430extern void usb_wakeup_notification(struct usb_device *hdev,431431 unsigned int portnum);432432433433+extern void usb_hcd_start_port_resume(struct usb_bus *bus, int portnum);434434+extern void usb_hcd_end_port_resume(struct usb_bus *bus, int portnum);435435+433436/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */434437#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)435438#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
+3-1
include/linux/usb/usbnet.h
···3333 wait_queue_head_t *wait;3434 struct mutex phy_mutex;3535 unsigned char suspend_count;3636+ unsigned char pkt_cnt, pkt_err;36373738 /* i/o info: pipes etc */3839 unsigned in, out;···7170# define EVENT_DEV_OPEN 77271# define EVENT_DEVICE_REPORT_IDLE 87372# define EVENT_NO_RUNTIME_PM 97373+# define EVENT_RX_KILL 107474};75757676static inline struct usb_driver *driver_of(struct usb_interface *intf)···102100#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */103101104102#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */105105-#define FLAG_NOARP 0x2000 /* device can't do ARP */106103107104/*108105 * Indicates to usbnet, that USB driver accumulates multiple IP packets.···109108 */110109#define FLAG_MULTI_PACKET 0x2000111110#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */111111+#define FLAG_NOARP 0x8000 /* device can't do ARP */112112113113 /* init device ... can sleep, or cause probe() failure */114114 int (*bind)(struct usbnet *, struct usb_interface *);
+10-10
include/net/transp_v6.h
···3434 struct sockaddr *uaddr,3535 int addr_len);36363737-extern int datagram_recv_ctl(struct sock *sk,3838- struct msghdr *msg,3939- struct sk_buff *skb);3737+extern int ip6_datagram_recv_ctl(struct sock *sk,3838+ struct msghdr *msg,3939+ struct sk_buff *skb);40404141-extern int datagram_send_ctl(struct net *net,4242- struct sock *sk,4343- struct msghdr *msg,4444- struct flowi6 *fl6,4545- struct ipv6_txoptions *opt,4646- int *hlimit, int *tclass,4747- int *dontfrag);4141+extern int ip6_datagram_send_ctl(struct net *net,4242+ struct sock *sk,4343+ struct msghdr *msg,4444+ struct flowi6 *fl6,4545+ struct ipv6_txoptions *opt,4646+ int *hlimit, int *tclass,4747+ int *dontfrag);48484949#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)5050
+6
include/uapi/linux/usb/ch9.h
···152152#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))153153#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))154154155155+/*156156+ * Interface status, Figure 9-5 USB 3.0 spec157157+ */158158+#define USB_INTRF_STAT_FUNC_RW_CAP 1159159+#define USB_INTRF_STAT_FUNC_RW 2160160+155161#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */156162157163/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
+18-2
kernel/events/core.c
···908908}909909910910/*911911+ * Initialize event state based on the perf_event_attr::disabled.912912+ */913913+static inline void perf_event__state_init(struct perf_event *event)914914+{915915+ event->state = event->attr.disabled ? PERF_EVENT_STATE_OFF :916916+ PERF_EVENT_STATE_INACTIVE;917917+}918918+919919+/*911920 * Called at perf_event creation and when events are attached/detached from a912921 * group.913922 */···61886179 event->overflow_handler = overflow_handler;61896180 event->overflow_handler_context = context;6190618161916191- if (attr->disabled)61926192- event->state = PERF_EVENT_STATE_OFF;61826182+ perf_event__state_init(event);6193618361946184 pmu = NULL;61956185···6617660966186610 mutex_lock(&gctx->mutex);66196611 perf_remove_from_context(group_leader);66126612+66136613+ /*66146614+ * Removing from the context ends up with disabled66156615+ * event. What we want here is event in the initial66166616+ * startup state, ready to be add into new context.66176617+ */66186618+ perf_event__state_init(group_leader);66206619 list_for_each_entry(sibling, &group_leader->sibling_list,66216620 group_entry) {66226621 perf_remove_from_context(sibling);66226622+ perf_event__state_init(sibling);66236623 put_ctx(gctx);66246624 }66256625 mutex_unlock(&gctx->mutex);
+10-3
kernel/rcutree_plugin.h
···4040#ifdef CONFIG_RCU_NOCB_CPU4141static cpumask_var_t rcu_nocb_mask; /* CPUs to have callbacks offloaded. */4242static bool have_rcu_nocb_mask; /* Was rcu_nocb_mask allocated? */4343-static bool rcu_nocb_poll; /* Offload kthread are to poll. */4444-module_param(rcu_nocb_poll, bool, 0444);4343+static bool __read_mostly rcu_nocb_poll; /* Offload kthread are to poll. */4544static char __initdata nocb_buf[NR_CPUS * 5];4645#endif /* #ifdef CONFIG_RCU_NOCB_CPU */4746···21582159}21592160__setup("rcu_nocbs=", rcu_nocb_setup);2160216121622162+static int __init parse_rcu_nocb_poll(char *arg)21632163+{21642164+ rcu_nocb_poll = 1;21652165+ return 0;21662166+}21672167+early_param("rcu_nocb_poll", parse_rcu_nocb_poll);21682168+21612169/* Is the specified CPU a no-CPUs CPU? */21622170static bool is_nocb_cpu(int cpu)21632171{···23722366 for (;;) {23732367 /* If not polling, wait for next batch of callbacks. */23742368 if (!rcu_nocb_poll)23752375- wait_event(rdp->nocb_wq, rdp->nocb_head);23692369+ wait_event_interruptible(rdp->nocb_wq, rdp->nocb_head);23762370 list = ACCESS_ONCE(rdp->nocb_head);23772371 if (!list) {23782372 schedule_timeout_interruptible(1);23732373+ flush_signals(current);23792374 continue;23802375 }23812376
···160160 if (is_write_migration_entry(entry))161161 pte = pte_mkwrite(pte);162162#ifdef CONFIG_HUGETLB_PAGE163163- if (PageHuge(new))163163+ if (PageHuge(new)) {164164 pte = pte_mkhuge(pte);165165+ pte = arch_make_huge_pte(pte, vma, new, 0);166166+ }165167#endif166168 flush_cache_page(vma, addr, pte_pfn(pte));167169 set_pte_at(mm, addr, ptep, pte);
+1-1
mm/mmap.c
···29432943 * vma in this mm is backed by the same anon_vma or address_space.29442944 *29452945 * We can take all the locks in random order because the VM code29462946- * taking i_mmap_mutex or anon_vma->mutex outside the mmap_sem never29462946+ * taking i_mmap_mutex or anon_vma->rwsem outside the mmap_sem never29472947 * takes more than one of them in a row. Secondly we're protected29482948 * against a concurrent mm_take_all_locks() by the mm_all_locks_mutex.29492949 *
···859859860860 skb_pull(skb, sizeof(code));861861862862+ /*863863+ * The SMP context must be initialized for all other PDUs except864864+ * pairing and security requests. If we get any other PDU when865865+ * not initialized simply disconnect (done if this function866866+ * returns an error).867867+ */868868+ if (code != SMP_CMD_PAIRING_REQ && code != SMP_CMD_SECURITY_REQ &&869869+ !conn->smp_chan) {870870+ BT_ERR("Unexpected SMP command 0x%02x. Disconnecting.", code);871871+ kfree_skb(skb);872872+ return -ENOTSUPP;873873+ }874874+862875 switch (code) {863876 case SMP_CMD_PAIRING_REQ:864877 reason = smp_cmd_pairing_req(conn, skb);
+6-3
net/core/pktgen.c
···17811781 return -EFAULT;17821782 i += len;17831783 mutex_lock(&pktgen_thread_lock);17841784- pktgen_add_device(t, f);17841784+ ret = pktgen_add_device(t, f);17851785 mutex_unlock(&pktgen_thread_lock);17861786- ret = count;17871787- sprintf(pg_result, "OK: add_device=%s", f);17861786+ if (!ret) {17871787+ ret = count;17881788+ sprintf(pg_result, "OK: add_device=%s", f);17891789+ } else17901790+ sprintf(pg_result, "ERROR: can not add device %s", f);17881791 goto out;17891792 }17901793
···168168169169}170170171171+/* Lookup the tunnel socket, possibly involving the fs code if the socket is172172+ * owned by userspace. A struct sock returned from this function must be173173+ * released using l2tp_tunnel_sock_put once you're done with it.174174+ */175175+struct sock *l2tp_tunnel_sock_lookup(struct l2tp_tunnel *tunnel)176176+{177177+ int err = 0;178178+ struct socket *sock = NULL;179179+ struct sock *sk = NULL;180180+181181+ if (!tunnel)182182+ goto out;183183+184184+ if (tunnel->fd >= 0) {185185+ /* Socket is owned by userspace, who might be in the process186186+ * of closing it. Look the socket up using the fd to ensure187187+ * consistency.188188+ */189189+ sock = sockfd_lookup(tunnel->fd, &err);190190+ if (sock)191191+ sk = sock->sk;192192+ } else {193193+ /* Socket is owned by kernelspace */194194+ sk = tunnel->sock;195195+ }196196+197197+out:198198+ return sk;199199+}200200+EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_lookup);201201+202202+/* Drop a reference to a tunnel socket obtained via. l2tp_tunnel_sock_put */203203+void l2tp_tunnel_sock_put(struct sock *sk)204204+{205205+ struct l2tp_tunnel *tunnel = l2tp_sock_to_tunnel(sk);206206+ if (tunnel) {207207+ if (tunnel->fd >= 0) {208208+ /* Socket is owned by userspace */209209+ sockfd_put(sk->sk_socket);210210+ }211211+ sock_put(sk);212212+ }213213+}214214+EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_put);215215+171216/* Lookup a session by id in the global session list172217 */173218static struct l2tp_session *l2tp_session_find_2(struct net *net, u32 session_id)···11681123 struct udphdr *uh;11691124 struct inet_sock *inet;11701125 __wsum csum;11711171- int old_headroom;11721172- int new_headroom;11731126 int headroom;11741127 int uhlen = (tunnel->encap == L2TP_ENCAPTYPE_UDP) ? sizeof(struct udphdr) : 0;11751128 int udp_len;···11791136 */11801137 headroom = NET_SKB_PAD + sizeof(struct iphdr) +11811138 uhlen + hdr_len;11821182- old_headroom = skb_headroom(skb);11831139 if (skb_cow_head(skb, headroom)) {11841140 kfree_skb(skb);11851141 return NET_XMIT_DROP;11861142 }1187114311881188- new_headroom = skb_headroom(skb);11891144 skb_orphan(skb);11901190- skb->truesize += new_headroom - old_headroom;11911191-11921145 /* Setup L2TP header */11931146 session->build_header(session, __skb_push(skb, hdr_len));11941147···16461607 tunnel->old_sk_destruct = sk->sk_destruct;16471608 sk->sk_destruct = &l2tp_tunnel_destruct;16481609 tunnel->sock = sk;16101610+ tunnel->fd = fd;16491611 lockdep_set_class_and_name(&sk->sk_lock.slock, &l2tp_socket_class, "l2tp_sock");1650161216511613 sk->sk_allocation = GFP_ATOMIC;···16821642 */16831643int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel)16841644{16851685- int err = 0;16861686- struct socket *sock = tunnel->sock ? tunnel->sock->sk_socket : NULL;16451645+ int err = -EBADF;16461646+ struct socket *sock = NULL;16471647+ struct sock *sk = NULL;16481648+16491649+ sk = l2tp_tunnel_sock_lookup(tunnel);16501650+ if (!sk)16511651+ goto out;16521652+16531653+ sock = sk->sk_socket;16541654+ BUG_ON(!sock);1687165516881656 /* Force the tunnel socket to close. This will eventually16891657 * cause the tunnel to be deleted via the normal socket close16901658 * mechanisms when userspace closes the tunnel socket.16911659 */16921692- if (sock != NULL) {16931693- err = inet_shutdown(sock, 2);16601660+ err = inet_shutdown(sock, 2);1694166116951695- /* If the tunnel's socket was created by the kernel,16961696- * close the socket here since the socket was not16971697- * created by userspace.16981698- */16991699- if (sock->file == NULL)17001700- err = inet_release(sock);17011701- }16621662+ /* If the tunnel's socket was created by the kernel,16631663+ * close the socket here since the socket was not16641664+ * created by userspace.16651665+ */16661666+ if (sock->file == NULL)16671667+ err = inet_release(sock);1702166816691669+ l2tp_tunnel_sock_put(sk);16701670+out:17031671 return err;17041672}17051673EXPORT_SYMBOL_GPL(l2tp_tunnel_delete);
+4-1
net/l2tp/l2tp_core.h
···188188 int (*recv_payload_hook)(struct sk_buff *skb);189189 void (*old_sk_destruct)(struct sock *);190190 struct sock *sock; /* Parent socket */191191- int fd;191191+ int fd; /* Parent fd, if tunnel socket192192+ * was created by userspace */192193193194 uint8_t priv[0]; /* private data */194195};···229228 return tunnel;230229}231230231231+extern struct sock *l2tp_tunnel_sock_lookup(struct l2tp_tunnel *tunnel);232232+extern void l2tp_tunnel_sock_put(struct sock *sk);232233extern struct l2tp_session *l2tp_session_find(struct net *net, struct l2tp_tunnel *tunnel, u32 session_id);233234extern struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth);234235extern struct l2tp_session *l2tp_session_find_by_ifname(struct net *net, char *ifname);
···3535/* Must be called with rcu_read_lock. */3636static void netdev_port_receive(struct vport *vport, struct sk_buff *skb)3737{3838- if (unlikely(!vport)) {3939- kfree_skb(skb);4040- return;4141- }3838+ if (unlikely(!vport))3939+ goto error;4040+4141+ if (unlikely(skb_warn_if_lro(skb)))4242+ goto error;42434344 /* Make our own copy of the packet. Otherwise we will mangle the4445 * packet for anyone who came before us (e.g. tcpdump via AF_PACKET).···51505251 skb_push(skb, ETH_HLEN);5352 ovs_vport_receive(vport, skb);5353+ return;5454+5555+error:5656+ kfree_skb(skb);5457}55585659/* Called with rcu_read_lock and bottom-halves disabled. */···173168 packet_length(skb), mtu);174169 goto error;175170 }176176-177177- if (unlikely(skb_warn_if_lro(skb)))178178- goto error;179171180172 skb->dev = netdev_vport->dev;181173 len = skb->len;
+6-4
net/packet/af_packet.c
···2361236123622362 packet_flush_mclist(sk);2363236323642364- memset(&req_u, 0, sizeof(req_u));23652365-23662366- if (po->rx_ring.pg_vec)23642364+ if (po->rx_ring.pg_vec) {23652365+ memset(&req_u, 0, sizeof(req_u));23672366 packet_set_ring(sk, &req_u, 1, 0);23672367+ }2368236823692369- if (po->tx_ring.pg_vec)23692369+ if (po->tx_ring.pg_vec) {23702370+ memset(&req_u, 0, sizeof(req_u));23702371 packet_set_ring(sk, &req_u, 1, 1);23722372+ }2371237323722374 fanout_release(sk);23732375
+6-6
net/sched/sch_netem.c
···438438 if (q->rate) {439439 struct sk_buff_head *list = &sch->q;440440441441- delay += packet_len_2_sched_time(skb->len, q);442442-443441 if (!skb_queue_empty(list)) {444442 /*445445- * Last packet in queue is reference point (now).446446- * First packet in queue is already in flight,447447- * calculate this time bonus and substract443443+ * Last packet in queue is reference point (now),444444+ * calculate this time bonus and subtract448445 * from delay.449446 */450450- delay -= now - netem_skb_cb(skb_peek(list))->time_to_send;447447+ delay -= netem_skb_cb(skb_peek_tail(list))->time_to_send - now;448448+ delay = max_t(psched_tdiff_t, 0, delay);451449 now = netem_skb_cb(skb_peek_tail(list))->time_to_send;452450 }451451+452452+ delay += packet_len_2_sched_time(skb->len, q);453453 }454454455455 cb->time_to_send = now + delay;
+1-1
net/sctp/auth.c
···7171 return;72727373 if (atomic_dec_and_test(&key->refcnt)) {7474- kfree(key);7474+ kzfree(key);7575 SCTP_DBG_OBJCNT_DEC(keys);7676 }7777}
+5
net/sctp/endpointola.c
···249249/* Final destructor for endpoint. */250250static void sctp_endpoint_destroy(struct sctp_endpoint *ep)251251{252252+ int i;253253+252254 SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return);253255254256 /* Free up the HMAC transform. */···272270 /* Cleanup. */273271 sctp_inq_free(&ep->base.inqueue);274272 sctp_bind_addr_free(&ep->base.bind_addr);273273+274274+ for (i = 0; i < SCTP_HOW_MANY_SECRETS; ++i)275275+ memset(&ep->secret_key[i], 0, SCTP_SECRET_SIZE);275276276277 /* Remove and free the port */277278 if (sctp_sk(ep->base.sk)->bind_hash)
···19192020# Try to match the kernel target.2121ifndef CONFIG_64BIT2222+ifndef CROSS_COMPILE22232324# s390 has -m31 flag to build 31 bit binaries2425ifndef CONFIG_S390···3534HOSTLOADLIBES_bpf-direct += $(MFLAG)3635HOSTLOADLIBES_bpf-fancy += $(MFLAG)3736HOSTLOADLIBES_dropper += $(MFLAG)3737+endif3838endif39394040# Tell kbuild to always build the programs