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

Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus

Pull MIPS updates from Ralf Baechle:
"The whole series has been sitting in -next for quite a while with no
complaints. The last change to the series was before the weekend the
removal of an SPI patch which Grant - even though previously acked by
himself - appeared to raise objections. So I removed it until the
situation is clarified. Other than that all the patches have the acks
from their respective maintainers, all MIPS and x86 defconfigs are
building fine and I'm not aware of any problems introduced by this
series.

Among the key features for this patch series is a sizable patchset for
Lantiq which among other things introduces support for Lantiq's
flagship product, the FALCON SOC. It also means that the opensource
developers behind this patchset have overtaken Lantiq's competing
inhouse development team that was working behind closed doors.

Less noteworthy the ath79 patchset which adds support for a few more
chip variants, cleanups and fixes. Finally the usual dose of tweaking
of generic code."

Fix up trivial conflicts in arch/mips/lantiq/xway/gpio_{ebu,stp}.c where
printk spelling fixes clashed with file move and eventual removal of the
printk.

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (81 commits)
MIPS: lantiq: remove orphaned code
MIPS: Remove all -Wall and almost all -Werror usage from arch/mips.
MIPS: lantiq: implement support for FALCON soc
MTD: MIPS: lantiq: verify that the NOR interface is available on falcon soc
MTD: MIPS: lantiq: implement OF support
watchdog: MIPS: lantiq: implement OF support and minor fixes
SERIAL: MIPS: lantiq: implement OF support
GPIO: MIPS: lantiq: convert gpio-stp-xway to OF
GPIO: MIPS: lantiq: convert gpio-mm-lantiq to OF and of_mm_gpio
GPIO: MIPS: lantiq: move gpio-stp and gpio-ebu to the subsystem folder
MIPS: pci: convert lantiq driver to OF
MIPS: lantiq: convert dma to platform driver
MIPS: lantiq: implement support for clkdev api
MIPS: lantiq: drop ltq_gpio_request() and gpio_to_irq()
OF: MIPS: lantiq: implement irq_domain support
OF: MIPS: lantiq: implement OF support
MIPS: lantiq: drop mips_machine support
OF: PCI: const usage needed by MIPS
MIPS: Cavium: Remove smp_reserve_lock.
MIPS: Move cache setup to setup_arch().
...

+4509 -3741
+38
Documentation/devicetree/bindings/gpio/gpio-mm-lantiq.txt
··· 1 + Lantiq SoC External Bus memory mapped GPIO controller 2 + 3 + By attaching hardware latches to the EBU it is possible to create output 4 + only gpios. This driver configures a special memory address, which when 5 + written to outputs 16 bit to the latches. 6 + 7 + The node describing the memory mapped GPIOs needs to be a child of the node 8 + describing the "lantiq,localbus". 9 + 10 + Required properties: 11 + - compatible : Should be "lantiq,gpio-mm-lantiq" 12 + - reg : Address and length of the register set for the device 13 + - #gpio-cells : Should be two. The first cell is the pin number and 14 + the second cell is used to specify optional parameters (currently 15 + unused). 16 + - gpio-controller : Marks the device node as a gpio controller. 17 + 18 + Optional properties: 19 + - lantiq,shadow : The default value that we shall assume as already set on the 20 + shift register cascade. 21 + 22 + Example: 23 + 24 + localbus@0 { 25 + #address-cells = <2>; 26 + #size-cells = <1>; 27 + ranges = <0 0 0x0 0x3ffffff /* addrsel0 */ 28 + 1 0 0x4000000 0x4000010>; /* addsel1 */ 29 + compatible = "lantiq,localbus", "simple-bus"; 30 + 31 + gpio_mm0: gpio@4000000 { 32 + compatible = "lantiq,gpio-mm"; 33 + reg = <1 0x0 0x10>; 34 + gpio-controller; 35 + #gpio-cells = <2>; 36 + lantiq,shadow = <0x77f> 37 + }; 38 + }
+42
Documentation/devicetree/bindings/gpio/gpio-stp-xway.txt
··· 1 + Lantiq SoC Serial To Parallel (STP) GPIO controller 2 + 3 + The Serial To Parallel (STP) is found on MIPS based Lantiq socs. It is a 4 + peripheral controller used to drive external shift register cascades. At most 5 + 3 groups of 8 bits can be driven. The hardware is able to allow the DSL modem 6 + to drive the 2 LSBs of the cascade automatically. 7 + 8 + 9 + Required properties: 10 + - compatible : Should be "lantiq,gpio-stp-xway" 11 + - reg : Address and length of the register set for the device 12 + - #gpio-cells : Should be two. The first cell is the pin number and 13 + the second cell is used to specify optional parameters (currently 14 + unused). 15 + - gpio-controller : Marks the device node as a gpio controller. 16 + 17 + Optional properties: 18 + - lantiq,shadow : The default value that we shall assume as already set on the 19 + shift register cascade. 20 + - lantiq,groups : Set the 3 bit mask to select which of the 3 groups are enabled 21 + in the shift register cascade. 22 + - lantiq,dsl : The dsl core can control the 2 LSBs of the gpio cascade. This 2 bit 23 + property can enable this feature. 24 + - lantiq,phy1 : The gphy1 core can control 3 bits of the gpio cascade. 25 + - lantiq,phy2 : The gphy2 core can control 3 bits of the gpio cascade. 26 + - lantiq,rising : use rising instead of falling edge for the shift register 27 + 28 + Example: 29 + 30 + gpio1: stp@E100BB0 { 31 + compatible = "lantiq,gpio-stp-xway"; 32 + reg = <0xE100BB0 0x40>; 33 + #gpio-cells = <2>; 34 + gpio-controller; 35 + 36 + lantiq,shadow = <0xffff>; 37 + lantiq,groups = <0x7>; 38 + lantiq,dsl = <0x3>; 39 + lantiq,phy1 = <0x7>; 40 + lantiq,phy2 = <0x7>; 41 + /* lantiq,rising; */ 42 + };
+9 -6
arch/mips/Kconfig
··· 233 233 select ARCH_REQUIRE_GPIOLIB 234 234 select SWAP_IO_SPACE 235 235 select BOOT_RAW 236 - select HAVE_CLK 237 - select MIPS_MACHINE 236 + select HAVE_MACH_CLKDEV 237 + select CLKDEV_LOOKUP 238 + select USE_OF 238 239 239 240 config LASAT 240 241 bool "LASAT Networks platforms" ··· 1784 1783 1785 1784 config FORCE_MAX_ZONEORDER 1786 1785 int "Maximum zone order" 1787 - range 13 64 if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_32KB 1788 - default "13" if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_32KB 1789 - range 12 64 if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_16KB 1790 - default "12" if SYS_SUPPORTS_HUGETLBFS && PAGE_SIZE_16KB 1786 + range 14 64 if HUGETLB_PAGE && PAGE_SIZE_64KB 1787 + default "14" if HUGETLB_PAGE && PAGE_SIZE_64KB 1788 + range 13 64 if HUGETLB_PAGE && PAGE_SIZE_32KB 1789 + default "13" if HUGETLB_PAGE && PAGE_SIZE_32KB 1790 + range 12 64 if HUGETLB_PAGE && PAGE_SIZE_16KB 1791 + default "12" if HUGETLB_PAGE && PAGE_SIZE_16KB 1791 1792 range 11 64 1792 1793 default "11" 1793 1794 help
+1
arch/mips/alchemy/devboards/db1200.c
··· 22 22 #include <linux/gpio.h> 23 23 #include <linux/i2c.h> 24 24 #include <linux/init.h> 25 + #include <linux/module.h> 25 26 #include <linux/interrupt.h> 26 27 #include <linux/io.h> 27 28 #include <linux/leds.h>
+24 -1
arch/mips/ath79/Kconfig
··· 26 26 Say 'Y' here if you want your kernel to support the 27 27 Atheros AP81 reference board. 28 28 29 + config ATH79_MACH_DB120 30 + bool "Atheros DB120 reference board" 31 + select SOC_AR934X 32 + select ATH79_DEV_GPIO_BUTTONS 33 + select ATH79_DEV_LEDS_GPIO 34 + select ATH79_DEV_SPI 35 + select ATH79_DEV_USB 36 + select ATH79_DEV_WMAC 37 + help 38 + Say 'Y' here if you want your kernel to support the 39 + Atheros DB120 reference board. 40 + 29 41 config ATH79_MACH_PB44 30 42 bool "Atheros PB44 reference board" 31 43 select SOC_AR71XX ··· 64 52 config SOC_AR71XX 65 53 select USB_ARCH_HAS_EHCI 66 54 select USB_ARCH_HAS_OHCI 55 + select HW_HAS_PCI 67 56 def_bool n 68 57 69 58 config SOC_AR724X 70 59 select USB_ARCH_HAS_EHCI 71 60 select USB_ARCH_HAS_OHCI 72 61 select HW_HAS_PCI 62 + select PCI_AR724X if PCI 73 63 def_bool n 74 64 75 65 config SOC_AR913X ··· 80 66 81 67 config SOC_AR933X 82 68 select USB_ARCH_HAS_EHCI 69 + def_bool n 70 + 71 + config SOC_AR934X 72 + select USB_ARCH_HAS_EHCI 73 + select HW_HAS_PCI 74 + select PCI_AR724X if PCI 75 + def_bool n 76 + 77 + config PCI_AR724X 83 78 def_bool n 84 79 85 80 config ATH79_DEV_GPIO_BUTTONS ··· 104 81 def_bool n 105 82 106 83 config ATH79_DEV_WMAC 107 - depends on (SOC_AR913X || SOC_AR933X) 84 + depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X) 108 85 def_bool n 109 86 110 87 endif
+2
arch/mips/ath79/Makefile
··· 11 11 obj-y := prom.o setup.o irq.o common.o clock.o gpio.o 12 12 13 13 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 14 + obj-$(CONFIG_PCI) += pci.o 14 15 15 16 # 16 17 # Devices ··· 28 27 # 29 28 obj-$(CONFIG_ATH79_MACH_AP121) += mach-ap121.o 30 29 obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o 30 + obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o 31 31 obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o 32 32 obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o
+81
arch/mips/ath79/clock.c
··· 1 1 /* 2 2 * Atheros AR71XX/AR724X/AR913X common routines 3 3 * 4 + * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com> 4 5 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org> 6 + * 7 + * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP 5 8 * 6 9 * This program is free software; you can redistribute it and/or modify it 7 10 * under the terms of the GNU General Public License version 2 as published ··· 166 163 ath79_uart_clk.rate = ath79_ref_clk.rate; 167 164 } 168 165 166 + static void __init ar934x_clocks_init(void) 167 + { 168 + u32 pll, out_div, ref_div, nint, frac, clk_ctrl, postdiv; 169 + u32 cpu_pll, ddr_pll; 170 + u32 bootstrap; 171 + 172 + bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP); 173 + if (bootstrap & AR934X_BOOTSTRAP_REF_CLK_40) 174 + ath79_ref_clk.rate = 40 * 1000 * 1000; 175 + else 176 + ath79_ref_clk.rate = 25 * 1000 * 1000; 177 + 178 + pll = ath79_pll_rr(AR934X_PLL_CPU_CONFIG_REG); 179 + out_div = (pll >> AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & 180 + AR934X_PLL_CPU_CONFIG_OUTDIV_MASK; 181 + ref_div = (pll >> AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT) & 182 + AR934X_PLL_CPU_CONFIG_REFDIV_MASK; 183 + nint = (pll >> AR934X_PLL_CPU_CONFIG_NINT_SHIFT) & 184 + AR934X_PLL_CPU_CONFIG_NINT_MASK; 185 + frac = (pll >> AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT) & 186 + AR934X_PLL_CPU_CONFIG_NFRAC_MASK; 187 + 188 + cpu_pll = nint * ath79_ref_clk.rate / ref_div; 189 + cpu_pll += frac * ath79_ref_clk.rate / (ref_div * (2 << 6)); 190 + cpu_pll /= (1 << out_div); 191 + 192 + pll = ath79_pll_rr(AR934X_PLL_DDR_CONFIG_REG); 193 + out_div = (pll >> AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & 194 + AR934X_PLL_DDR_CONFIG_OUTDIV_MASK; 195 + ref_div = (pll >> AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT) & 196 + AR934X_PLL_DDR_CONFIG_REFDIV_MASK; 197 + nint = (pll >> AR934X_PLL_DDR_CONFIG_NINT_SHIFT) & 198 + AR934X_PLL_DDR_CONFIG_NINT_MASK; 199 + frac = (pll >> AR934X_PLL_DDR_CONFIG_NFRAC_SHIFT) & 200 + AR934X_PLL_DDR_CONFIG_NFRAC_MASK; 201 + 202 + ddr_pll = nint * ath79_ref_clk.rate / ref_div; 203 + ddr_pll += frac * ath79_ref_clk.rate / (ref_div * (2 << 10)); 204 + ddr_pll /= (1 << out_div); 205 + 206 + clk_ctrl = ath79_pll_rr(AR934X_PLL_CPU_DDR_CLK_CTRL_REG); 207 + 208 + postdiv = (clk_ctrl >> AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_SHIFT) & 209 + AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK; 210 + 211 + if (clk_ctrl & AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_PLL_BYPASS) 212 + ath79_cpu_clk.rate = ath79_ref_clk.rate; 213 + else if (clk_ctrl & AR934X_PLL_CPU_DDR_CLK_CTRL_CPUCLK_FROM_CPUPLL) 214 + ath79_cpu_clk.rate = cpu_pll / (postdiv + 1); 215 + else 216 + ath79_cpu_clk.rate = ddr_pll / (postdiv + 1); 217 + 218 + postdiv = (clk_ctrl >> AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_SHIFT) & 219 + AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MASK; 220 + 221 + if (clk_ctrl & AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_PLL_BYPASS) 222 + ath79_ddr_clk.rate = ath79_ref_clk.rate; 223 + else if (clk_ctrl & AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL) 224 + ath79_ddr_clk.rate = ddr_pll / (postdiv + 1); 225 + else 226 + ath79_ddr_clk.rate = cpu_pll / (postdiv + 1); 227 + 228 + postdiv = (clk_ctrl >> AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_SHIFT) & 229 + AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MASK; 230 + 231 + if (clk_ctrl & AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_PLL_BYPASS) 232 + ath79_ahb_clk.rate = ath79_ref_clk.rate; 233 + else if (clk_ctrl & AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL) 234 + ath79_ahb_clk.rate = ddr_pll / (postdiv + 1); 235 + else 236 + ath79_ahb_clk.rate = cpu_pll / (postdiv + 1); 237 + 238 + ath79_wdt_clk.rate = ath79_ref_clk.rate; 239 + ath79_uart_clk.rate = ath79_ref_clk.rate; 240 + } 241 + 169 242 void __init ath79_clocks_init(void) 170 243 { 171 244 if (soc_is_ar71xx()) ··· 252 173 ar913x_clocks_init(); 253 174 else if (soc_is_ar933x()) 254 175 ar933x_clocks_init(); 176 + else if (soc_is_ar934x()) 177 + ar934x_clocks_init(); 255 178 else 256 179 BUG(); 257 180
+8 -1
arch/mips/ath79/common.c
··· 1 1 /* 2 2 * Atheros AR71XX/AR724X/AR913X common routines 3 3 * 4 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> 4 + * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com> 5 + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> 5 6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 7 + * 8 + * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP 6 9 * 7 10 * This program is free software; you can redistribute it and/or modify it 8 11 * under the terms of the GNU General Public License version 2 as published ··· 70 67 reg = AR913X_RESET_REG_RESET_MODULE; 71 68 else if (soc_is_ar933x()) 72 69 reg = AR933X_RESET_REG_RESET_MODULE; 70 + else if (soc_is_ar934x()) 71 + reg = AR934X_RESET_REG_RESET_MODULE; 73 72 else 74 73 BUG(); 75 74 ··· 96 91 reg = AR913X_RESET_REG_RESET_MODULE; 97 92 else if (soc_is_ar933x()) 98 93 reg = AR933X_RESET_REG_RESET_MODULE; 94 + else if (soc_is_ar934x()) 95 + reg = AR934X_RESET_REG_RESET_MODULE; 99 96 else 100 97 BUG(); 101 98
+2 -1
arch/mips/ath79/dev-common.c
··· 89 89 90 90 if (soc_is_ar71xx() || 91 91 soc_is_ar724x() || 92 - soc_is_ar913x()) { 92 + soc_is_ar913x() || 93 + soc_is_ar934x()) { 93 94 ath79_uart_data[0].uartclk = clk_get_rate(clk); 94 95 platform_device_register(&ath79_uart_device); 95 96 } else if (soc_is_ar933x()) {
+1 -3
arch/mips/ath79/dev-gpio-buttons.c
··· 25 25 struct gpio_keys_button *p; 26 26 int err; 27 27 28 - p = kmalloc(nbuttons * sizeof(*p), GFP_KERNEL); 28 + p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL); 29 29 if (!p) 30 30 return; 31 - 32 - memcpy(p, buttons, nbuttons * sizeof(*p)); 33 31 34 32 pdev = platform_device_alloc("gpio-keys-polled", id); 35 33 if (!pdev)
+1 -3
arch/mips/ath79/dev-leds-gpio.c
··· 24 24 struct gpio_led *p; 25 25 int err; 26 26 27 - p = kmalloc(num_leds * sizeof(*p), GFP_KERNEL); 27 + p = kmemdup(leds, num_leds * sizeof(*p), GFP_KERNEL); 28 28 if (!p) 29 29 return; 30 - 31 - memcpy(p, leds, num_leds * sizeof(*p)); 32 30 33 31 pdev = platform_device_alloc("leds-gpio", id); 34 32 if (!pdev)
+28 -2
arch/mips/ath79/dev-wmac.c
··· 1 1 /* 2 2 * Atheros AR913X/AR933X SoC built-in WMAC device support 3 3 * 4 + * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com> 4 5 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> 5 6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 7 + * 8 + * Parts of this file are based on Atheros 2.6.15/2.6.31 BSP 6 9 * 7 10 * This program is free software; you can redistribute it and/or modify it 8 11 * under the terms of the GNU General Public License version 2 as published ··· 29 26 /* .start and .end fields are filled dynamically */ 30 27 .flags = IORESOURCE_MEM, 31 28 }, { 32 - .start = ATH79_CPU_IRQ_IP2, 33 - .end = ATH79_CPU_IRQ_IP2, 29 + /* .start and .end fields are filled dynamically */ 34 30 .flags = IORESOURCE_IRQ, 35 31 }, 36 32 }; ··· 55 53 56 54 ath79_wmac_resources[0].start = AR913X_WMAC_BASE; 57 55 ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1; 56 + ath79_wmac_resources[1].start = ATH79_CPU_IRQ_IP2; 57 + ath79_wmac_resources[1].end = ATH79_CPU_IRQ_IP2; 58 58 } 59 59 60 60 ··· 83 79 84 80 ath79_wmac_resources[0].start = AR933X_WMAC_BASE; 85 81 ath79_wmac_resources[0].end = AR933X_WMAC_BASE + AR933X_WMAC_SIZE - 1; 82 + ath79_wmac_resources[1].start = ATH79_CPU_IRQ_IP2; 83 + ath79_wmac_resources[1].end = ATH79_CPU_IRQ_IP2; 86 84 87 85 t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); 88 86 if (t & AR933X_BOOTSTRAP_REF_CLK_40) ··· 98 92 ath79_wmac_data.external_reset = ar933x_wmac_reset; 99 93 } 100 94 95 + static void ar934x_wmac_setup(void) 96 + { 97 + u32 t; 98 + 99 + ath79_wmac_device.name = "ar934x_wmac"; 100 + 101 + ath79_wmac_resources[0].start = AR934X_WMAC_BASE; 102 + ath79_wmac_resources[0].end = AR934X_WMAC_BASE + AR934X_WMAC_SIZE - 1; 103 + ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1); 104 + ath79_wmac_resources[1].start = ATH79_IP2_IRQ(1); 105 + 106 + t = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP); 107 + if (t & AR934X_BOOTSTRAP_REF_CLK_40) 108 + ath79_wmac_data.is_clk_25mhz = false; 109 + else 110 + ath79_wmac_data.is_clk_25mhz = true; 111 + } 112 + 101 113 void __init ath79_register_wmac(u8 *cal_data) 102 114 { 103 115 if (soc_is_ar913x()) 104 116 ar913x_wmac_setup(); 105 117 else if (soc_is_ar933x()) 106 118 ar933x_wmac_setup(); 119 + else if (soc_is_ar934x()) 120 + ar934x_wmac_setup(); 107 121 else 108 122 BUG(); 109 123
+3
arch/mips/ath79/early_printk.c
··· 71 71 case REV_ID_MAJOR_AR7241: 72 72 case REV_ID_MAJOR_AR7242: 73 73 case REV_ID_MAJOR_AR913X: 74 + case REV_ID_MAJOR_AR9341: 75 + case REV_ID_MAJOR_AR9342: 76 + case REV_ID_MAJOR_AR9344: 74 77 _prom_putchar = prom_putchar_ar71xx; 75 78 break; 76 79
+46 -1
arch/mips/ath79/gpio.c
··· 1 1 /* 2 2 * Atheros AR71XX/AR724X/AR913X GPIO API support 3 3 * 4 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> 4 + * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com> 5 + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> 5 6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 7 + * 8 + * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP 6 9 * 7 10 * This program is free software; you can redistribute it and/or modify it 8 11 * under the terms of the GNU General Public License version 2 as published ··· 92 89 return 0; 93 90 } 94 91 92 + static int ar934x_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 93 + { 94 + void __iomem *base = ath79_gpio_base; 95 + unsigned long flags; 96 + 97 + spin_lock_irqsave(&ath79_gpio_lock, flags); 98 + 99 + __raw_writel(__raw_readl(base + AR71XX_GPIO_REG_OE) | (1 << offset), 100 + base + AR71XX_GPIO_REG_OE); 101 + 102 + spin_unlock_irqrestore(&ath79_gpio_lock, flags); 103 + 104 + return 0; 105 + } 106 + 107 + static int ar934x_gpio_direction_output(struct gpio_chip *chip, unsigned offset, 108 + int value) 109 + { 110 + void __iomem *base = ath79_gpio_base; 111 + unsigned long flags; 112 + 113 + spin_lock_irqsave(&ath79_gpio_lock, flags); 114 + 115 + if (value) 116 + __raw_writel(1 << offset, base + AR71XX_GPIO_REG_SET); 117 + else 118 + __raw_writel(1 << offset, base + AR71XX_GPIO_REG_CLEAR); 119 + 120 + __raw_writel(__raw_readl(base + AR71XX_GPIO_REG_OE) & ~(1 << offset), 121 + base + AR71XX_GPIO_REG_OE); 122 + 123 + spin_unlock_irqrestore(&ath79_gpio_lock, flags); 124 + 125 + return 0; 126 + } 127 + 95 128 static struct gpio_chip ath79_gpio_chip = { 96 129 .label = "ath79", 97 130 .get = ath79_gpio_get_value, ··· 194 155 ath79_gpio_count = AR913X_GPIO_COUNT; 195 156 else if (soc_is_ar933x()) 196 157 ath79_gpio_count = AR933X_GPIO_COUNT; 158 + else if (soc_is_ar934x()) 159 + ath79_gpio_count = AR934X_GPIO_COUNT; 197 160 else 198 161 BUG(); 199 162 200 163 ath79_gpio_base = ioremap_nocache(AR71XX_GPIO_BASE, AR71XX_GPIO_SIZE); 201 164 ath79_gpio_chip.ngpio = ath79_gpio_count; 165 + if (soc_is_ar934x()) { 166 + ath79_gpio_chip.direction_input = ar934x_gpio_direction_input; 167 + ath79_gpio_chip.direction_output = ar934x_gpio_direction_output; 168 + } 202 169 203 170 err = gpiochip_add(&ath79_gpio_chip); 204 171 if (err)
+125 -22
arch/mips/ath79/irq.c
··· 1 1 /* 2 2 * Atheros AR71xx/AR724x/AR913x specific interrupt handling 3 3 * 4 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> 4 + * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com> 5 + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> 5 6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 6 7 * 7 - * Parts of this file are based on Atheros' 2.6.15 BSP 8 + * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP 8 9 * 9 10 * This program is free software; you can redistribute it and/or modify it 10 11 * under the terms of the GNU General Public License version 2 as published ··· 24 23 #include <asm/mach-ath79/ar71xx_regs.h> 25 24 #include "common.h" 26 25 27 - static unsigned int ath79_ip2_flush_reg; 28 - static unsigned int ath79_ip3_flush_reg; 26 + static void (*ath79_ip2_handler)(void); 27 + static void (*ath79_ip3_handler)(void); 29 28 30 29 static void ath79_misc_irq_handler(unsigned int irq, struct irq_desc *desc) 31 30 { ··· 130 129 131 130 if (soc_is_ar71xx() || soc_is_ar913x()) 132 131 ath79_misc_irq_chip.irq_mask_ack = ar71xx_misc_irq_mask; 133 - else if (soc_is_ar724x() || soc_is_ar933x()) 132 + else if (soc_is_ar724x() || soc_is_ar933x() || soc_is_ar934x()) 134 133 ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack; 135 134 else 136 135 BUG(); ··· 144 143 irq_set_chained_handler(ATH79_CPU_IRQ_MISC, ath79_misc_irq_handler); 145 144 } 146 145 146 + static void ar934x_ip2_irq_dispatch(unsigned int irq, struct irq_desc *desc) 147 + { 148 + u32 status; 149 + 150 + disable_irq_nosync(irq); 151 + 152 + status = ath79_reset_rr(AR934X_RESET_REG_PCIE_WMAC_INT_STATUS); 153 + 154 + if (status & AR934X_PCIE_WMAC_INT_PCIE_ALL) { 155 + ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_PCIE); 156 + generic_handle_irq(ATH79_IP2_IRQ(0)); 157 + } else if (status & AR934X_PCIE_WMAC_INT_WMAC_ALL) { 158 + ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_WMAC); 159 + generic_handle_irq(ATH79_IP2_IRQ(1)); 160 + } else { 161 + spurious_interrupt(); 162 + } 163 + 164 + enable_irq(irq); 165 + } 166 + 167 + static void ar934x_ip2_irq_init(void) 168 + { 169 + int i; 170 + 171 + for (i = ATH79_IP2_IRQ_BASE; 172 + i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) 173 + irq_set_chip_and_handler(i, &dummy_irq_chip, 174 + handle_level_irq); 175 + 176 + irq_set_chained_handler(ATH79_CPU_IRQ_IP2, ar934x_ip2_irq_dispatch); 177 + } 178 + 147 179 asmlinkage void plat_irq_dispatch(void) 148 180 { 149 181 unsigned long pending; ··· 186 152 if (pending & STATUSF_IP7) 187 153 do_IRQ(ATH79_CPU_IRQ_TIMER); 188 154 189 - else if (pending & STATUSF_IP2) { 190 - ath79_ddr_wb_flush(ath79_ip2_flush_reg); 191 - do_IRQ(ATH79_CPU_IRQ_IP2); 192 - } 155 + else if (pending & STATUSF_IP2) 156 + ath79_ip2_handler(); 193 157 194 158 else if (pending & STATUSF_IP4) 195 159 do_IRQ(ATH79_CPU_IRQ_GE0); ··· 195 163 else if (pending & STATUSF_IP5) 196 164 do_IRQ(ATH79_CPU_IRQ_GE1); 197 165 198 - else if (pending & STATUSF_IP3) { 199 - ath79_ddr_wb_flush(ath79_ip3_flush_reg); 200 - do_IRQ(ATH79_CPU_IRQ_USB); 201 - } 166 + else if (pending & STATUSF_IP3) 167 + ath79_ip3_handler(); 202 168 203 169 else if (pending & STATUSF_IP6) 204 170 do_IRQ(ATH79_CPU_IRQ_MISC); ··· 205 175 spurious_interrupt(); 206 176 } 207 177 178 + /* 179 + * The IP2/IP3 lines are tied to a PCI/WMAC/USB device. Drivers for 180 + * these devices typically allocate coherent DMA memory, however the 181 + * DMA controller may still have some unsynchronized data in the FIFO. 182 + * Issue a flush in the handlers to ensure that the driver sees 183 + * the update. 184 + */ 185 + static void ar71xx_ip2_handler(void) 186 + { 187 + ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_PCI); 188 + do_IRQ(ATH79_CPU_IRQ_IP2); 189 + } 190 + 191 + static void ar724x_ip2_handler(void) 192 + { 193 + ath79_ddr_wb_flush(AR724X_DDR_REG_FLUSH_PCIE); 194 + do_IRQ(ATH79_CPU_IRQ_IP2); 195 + } 196 + 197 + static void ar913x_ip2_handler(void) 198 + { 199 + ath79_ddr_wb_flush(AR913X_DDR_REG_FLUSH_WMAC); 200 + do_IRQ(ATH79_CPU_IRQ_IP2); 201 + } 202 + 203 + static void ar933x_ip2_handler(void) 204 + { 205 + ath79_ddr_wb_flush(AR933X_DDR_REG_FLUSH_WMAC); 206 + do_IRQ(ATH79_CPU_IRQ_IP2); 207 + } 208 + 209 + static void ar934x_ip2_handler(void) 210 + { 211 + do_IRQ(ATH79_CPU_IRQ_IP2); 212 + } 213 + 214 + static void ar71xx_ip3_handler(void) 215 + { 216 + ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_USB); 217 + do_IRQ(ATH79_CPU_IRQ_USB); 218 + } 219 + 220 + static void ar724x_ip3_handler(void) 221 + { 222 + ath79_ddr_wb_flush(AR724X_DDR_REG_FLUSH_USB); 223 + do_IRQ(ATH79_CPU_IRQ_USB); 224 + } 225 + 226 + static void ar913x_ip3_handler(void) 227 + { 228 + ath79_ddr_wb_flush(AR913X_DDR_REG_FLUSH_USB); 229 + do_IRQ(ATH79_CPU_IRQ_USB); 230 + } 231 + 232 + static void ar933x_ip3_handler(void) 233 + { 234 + ath79_ddr_wb_flush(AR933X_DDR_REG_FLUSH_USB); 235 + do_IRQ(ATH79_CPU_IRQ_USB); 236 + } 237 + 238 + static void ar934x_ip3_handler(void) 239 + { 240 + ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_USB); 241 + do_IRQ(ATH79_CPU_IRQ_USB); 242 + } 243 + 208 244 void __init arch_init_irq(void) 209 245 { 210 246 if (soc_is_ar71xx()) { 211 - ath79_ip2_flush_reg = AR71XX_DDR_REG_FLUSH_PCI; 212 - ath79_ip3_flush_reg = AR71XX_DDR_REG_FLUSH_USB; 247 + ath79_ip2_handler = ar71xx_ip2_handler; 248 + ath79_ip3_handler = ar71xx_ip3_handler; 213 249 } else if (soc_is_ar724x()) { 214 - ath79_ip2_flush_reg = AR724X_DDR_REG_FLUSH_PCIE; 215 - ath79_ip3_flush_reg = AR724X_DDR_REG_FLUSH_USB; 250 + ath79_ip2_handler = ar724x_ip2_handler; 251 + ath79_ip3_handler = ar724x_ip3_handler; 216 252 } else if (soc_is_ar913x()) { 217 - ath79_ip2_flush_reg = AR913X_DDR_REG_FLUSH_WMAC; 218 - ath79_ip3_flush_reg = AR913X_DDR_REG_FLUSH_USB; 253 + ath79_ip2_handler = ar913x_ip2_handler; 254 + ath79_ip3_handler = ar913x_ip3_handler; 219 255 } else if (soc_is_ar933x()) { 220 - ath79_ip2_flush_reg = AR933X_DDR_REG_FLUSH_WMAC; 221 - ath79_ip3_flush_reg = AR933X_DDR_REG_FLUSH_USB; 222 - } else 256 + ath79_ip2_handler = ar933x_ip2_handler; 257 + ath79_ip3_handler = ar933x_ip3_handler; 258 + } else if (soc_is_ar934x()) { 259 + ath79_ip2_handler = ar934x_ip2_handler; 260 + ath79_ip3_handler = ar934x_ip3_handler; 261 + } else { 223 262 BUG(); 263 + } 224 264 225 265 cp0_perfcount_irq = ATH79_MISC_IRQ_PERFC; 226 266 mips_cpu_irq_init(); 227 267 ath79_misc_irq_init(); 268 + 269 + if (soc_is_ar934x()) 270 + ar934x_ip2_irq_init(); 228 271 }
+134
arch/mips/ath79/mach-db120.c
··· 1 + /* 2 + * Atheros DB120 reference board support 3 + * 4 + * Copyright (c) 2011 Qualcomm Atheros 5 + * Copyright (c) 2011 Gabor Juhos <juhosg@openwrt.org> 6 + * 7 + * Permission to use, copy, modify, and/or distribute this software for any 8 + * purpose with or without fee is hereby granted, provided that the above 9 + * copyright notice and this permission notice appear in all copies. 10 + * 11 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 + * 19 + */ 20 + 21 + #include <linux/pci.h> 22 + #include <linux/ath9k_platform.h> 23 + 24 + #include "machtypes.h" 25 + #include "dev-gpio-buttons.h" 26 + #include "dev-leds-gpio.h" 27 + #include "dev-spi.h" 28 + #include "dev-wmac.h" 29 + #include "pci.h" 30 + 31 + #define DB120_GPIO_LED_WLAN_5G 12 32 + #define DB120_GPIO_LED_WLAN_2G 13 33 + #define DB120_GPIO_LED_STATUS 14 34 + #define DB120_GPIO_LED_WPS 15 35 + 36 + #define DB120_GPIO_BTN_WPS 16 37 + 38 + #define DB120_KEYS_POLL_INTERVAL 20 /* msecs */ 39 + #define DB120_KEYS_DEBOUNCE_INTERVAL (3 * DB120_KEYS_POLL_INTERVAL) 40 + 41 + #define DB120_WMAC_CALDATA_OFFSET 0x1000 42 + #define DB120_PCIE_CALDATA_OFFSET 0x5000 43 + 44 + static struct gpio_led db120_leds_gpio[] __initdata = { 45 + { 46 + .name = "db120:green:status", 47 + .gpio = DB120_GPIO_LED_STATUS, 48 + .active_low = 1, 49 + }, 50 + { 51 + .name = "db120:green:wps", 52 + .gpio = DB120_GPIO_LED_WPS, 53 + .active_low = 1, 54 + }, 55 + { 56 + .name = "db120:green:wlan-5g", 57 + .gpio = DB120_GPIO_LED_WLAN_5G, 58 + .active_low = 1, 59 + }, 60 + { 61 + .name = "db120:green:wlan-2g", 62 + .gpio = DB120_GPIO_LED_WLAN_2G, 63 + .active_low = 1, 64 + }, 65 + }; 66 + 67 + static struct gpio_keys_button db120_gpio_keys[] __initdata = { 68 + { 69 + .desc = "WPS button", 70 + .type = EV_KEY, 71 + .code = KEY_WPS_BUTTON, 72 + .debounce_interval = DB120_KEYS_DEBOUNCE_INTERVAL, 73 + .gpio = DB120_GPIO_BTN_WPS, 74 + .active_low = 1, 75 + }, 76 + }; 77 + 78 + static struct spi_board_info db120_spi_info[] = { 79 + { 80 + .bus_num = 0, 81 + .chip_select = 0, 82 + .max_speed_hz = 25000000, 83 + .modalias = "s25sl064a", 84 + } 85 + }; 86 + 87 + static struct ath79_spi_platform_data db120_spi_data = { 88 + .bus_num = 0, 89 + .num_chipselect = 1, 90 + }; 91 + 92 + #ifdef CONFIG_PCI 93 + static struct ath9k_platform_data db120_ath9k_data; 94 + 95 + static int db120_pci_plat_dev_init(struct pci_dev *dev) 96 + { 97 + switch (PCI_SLOT(dev->devfn)) { 98 + case 0: 99 + dev->dev.platform_data = &db120_ath9k_data; 100 + break; 101 + } 102 + 103 + return 0; 104 + } 105 + 106 + static void __init db120_pci_init(u8 *eeprom) 107 + { 108 + memcpy(db120_ath9k_data.eeprom_data, eeprom, 109 + sizeof(db120_ath9k_data.eeprom_data)); 110 + 111 + ath79_pci_set_plat_dev_init(db120_pci_plat_dev_init); 112 + ath79_register_pci(); 113 + } 114 + #else 115 + static inline void db120_pci_init(void) {} 116 + #endif /* CONFIG_PCI */ 117 + 118 + static void __init db120_setup(void) 119 + { 120 + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); 121 + 122 + ath79_register_leds_gpio(-1, ARRAY_SIZE(db120_leds_gpio), 123 + db120_leds_gpio); 124 + ath79_register_gpio_keys_polled(-1, DB120_KEYS_POLL_INTERVAL, 125 + ARRAY_SIZE(db120_gpio_keys), 126 + db120_gpio_keys); 127 + ath79_register_spi(&db120_spi_data, db120_spi_info, 128 + ARRAY_SIZE(db120_spi_info)); 129 + ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET); 130 + db120_pci_init(art + DB120_PCIE_CALDATA_OFFSET); 131 + } 132 + 133 + MIPS_MACHINE(ATH79_MACH_DB120, "DB120", "Atheros DB120 reference board", 134 + db120_setup);
+2
arch/mips/ath79/mach-pb44.c
··· 19 19 #include "dev-leds-gpio.h" 20 20 #include "dev-spi.h" 21 21 #include "dev-usb.h" 22 + #include "pci.h" 22 23 23 24 #define PB44_GPIO_I2C_SCL 0 24 25 #define PB44_GPIO_I2C_SDA 1 ··· 115 114 ath79_register_spi(&pb44_spi_data, pb44_spi_info, 116 115 ARRAY_SIZE(pb44_spi_info)); 117 116 ath79_register_usb(); 117 + ath79_register_pci(); 118 118 } 119 119 120 120 MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board",
+25 -18
arch/mips/ath79/mach-ubnt-xm.c
··· 12 12 13 13 #include <linux/init.h> 14 14 #include <linux/pci.h> 15 - 16 - #ifdef CONFIG_PCI 17 15 #include <linux/ath9k_platform.h> 18 - #include <asm/mach-ath79/pci-ath724x.h> 19 - #endif /* CONFIG_PCI */ 16 + 17 + #include <asm/mach-ath79/irq.h> 20 18 21 19 #include "machtypes.h" 22 20 #include "dev-gpio-buttons.h" 23 21 #include "dev-leds-gpio.h" 24 22 #include "dev-spi.h" 23 + #include "pci.h" 25 24 26 25 #define UBNT_XM_GPIO_LED_L1 0 27 26 #define UBNT_XM_GPIO_LED_L2 1 ··· 32 33 #define UBNT_XM_KEYS_POLL_INTERVAL 20 33 34 #define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL) 34 35 35 - #define UBNT_XM_PCI_IRQ 48 36 36 #define UBNT_XM_EEPROM_ADDR (u8 *) KSEG1ADDR(0x1fff1000) 37 37 38 38 static struct gpio_led ubnt_xm_leds_gpio[] __initdata = { ··· 82 84 #ifdef CONFIG_PCI 83 85 static struct ath9k_platform_data ubnt_xm_eeprom_data; 84 86 85 - static struct ath724x_pci_data ubnt_xm_pci_data[] = { 86 - { 87 - .irq = UBNT_XM_PCI_IRQ, 88 - .pdata = &ubnt_xm_eeprom_data, 89 - }, 90 - }; 87 + static int ubnt_xm_pci_plat_dev_init(struct pci_dev *dev) 88 + { 89 + switch (PCI_SLOT(dev->devfn)) { 90 + case 0: 91 + dev->dev.platform_data = &ubnt_xm_eeprom_data; 92 + break; 93 + } 94 + 95 + return 0; 96 + } 97 + 98 + static void __init ubnt_xm_pci_init(void) 99 + { 100 + memcpy(ubnt_xm_eeprom_data.eeprom_data, UBNT_XM_EEPROM_ADDR, 101 + sizeof(ubnt_xm_eeprom_data.eeprom_data)); 102 + 103 + ath79_pci_set_plat_dev_init(ubnt_xm_pci_plat_dev_init); 104 + ath79_register_pci(); 105 + } 106 + #else 107 + static inline void ubnt_xm_pci_init(void) {} 91 108 #endif /* CONFIG_PCI */ 92 109 93 110 static void __init ubnt_xm_init(void) ··· 117 104 ath79_register_spi(&ubnt_xm_spi_data, ubnt_xm_spi_info, 118 105 ARRAY_SIZE(ubnt_xm_spi_info)); 119 106 120 - #ifdef CONFIG_PCI 121 - memcpy(ubnt_xm_eeprom_data.eeprom_data, UBNT_XM_EEPROM_ADDR, 122 - sizeof(ubnt_xm_eeprom_data.eeprom_data)); 123 - 124 - ath724x_pci_add_data(ubnt_xm_pci_data, ARRAY_SIZE(ubnt_xm_pci_data)); 125 - #endif /* CONFIG_PCI */ 126 - 107 + ubnt_xm_pci_init(); 127 108 } 128 109 129 110 MIPS_MACHINE(ATH79_MACH_UBNT_XM,
+1
arch/mips/ath79/machtypes.h
··· 18 18 ATH79_MACH_GENERIC = 0, 19 19 ATH79_MACH_AP121, /* Atheros AP121 reference board */ 20 20 ATH79_MACH_AP81, /* Atheros AP81 reference board */ 21 + ATH79_MACH_DB120, /* Atheros DB120 reference board */ 21 22 ATH79_MACH_PB44, /* Atheros PB44 reference board */ 22 23 ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */ 23 24 };
+130
arch/mips/ath79/pci.c
··· 1 + /* 2 + * Atheros AR71XX/AR724X specific PCI setup code 3 + * 4 + * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com> 5 + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> 6 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 7 + * 8 + * Parts of this file are based on Atheros' 2.6.15 BSP 9 + * 10 + * This program is free software; you can redistribute it and/or modify it 11 + * under the terms of the GNU General Public License version 2 as published 12 + * by the Free Software Foundation. 13 + */ 14 + 15 + #include <linux/init.h> 16 + #include <linux/pci.h> 17 + #include <asm/mach-ath79/ar71xx_regs.h> 18 + #include <asm/mach-ath79/ath79.h> 19 + #include <asm/mach-ath79/irq.h> 20 + #include <asm/mach-ath79/pci.h> 21 + #include "pci.h" 22 + 23 + static int (*ath79_pci_plat_dev_init)(struct pci_dev *dev); 24 + static const struct ath79_pci_irq *ath79_pci_irq_map __initdata; 25 + static unsigned ath79_pci_nr_irqs __initdata; 26 + 27 + static const struct ath79_pci_irq ar71xx_pci_irq_map[] __initconst = { 28 + { 29 + .slot = 17, 30 + .pin = 1, 31 + .irq = ATH79_PCI_IRQ(0), 32 + }, { 33 + .slot = 18, 34 + .pin = 1, 35 + .irq = ATH79_PCI_IRQ(1), 36 + }, { 37 + .slot = 19, 38 + .pin = 1, 39 + .irq = ATH79_PCI_IRQ(2), 40 + } 41 + }; 42 + 43 + static const struct ath79_pci_irq ar724x_pci_irq_map[] __initconst = { 44 + { 45 + .slot = 0, 46 + .pin = 1, 47 + .irq = ATH79_PCI_IRQ(0), 48 + } 49 + }; 50 + 51 + int __init pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin) 52 + { 53 + int irq = -1; 54 + int i; 55 + 56 + if (ath79_pci_nr_irqs == 0 || 57 + ath79_pci_irq_map == NULL) { 58 + if (soc_is_ar71xx()) { 59 + ath79_pci_irq_map = ar71xx_pci_irq_map; 60 + ath79_pci_nr_irqs = ARRAY_SIZE(ar71xx_pci_irq_map); 61 + } else if (soc_is_ar724x() || 62 + soc_is_ar9342() || 63 + soc_is_ar9344()) { 64 + ath79_pci_irq_map = ar724x_pci_irq_map; 65 + ath79_pci_nr_irqs = ARRAY_SIZE(ar724x_pci_irq_map); 66 + } else { 67 + pr_crit("pci %s: invalid irq map\n", 68 + pci_name((struct pci_dev *) dev)); 69 + return irq; 70 + } 71 + } 72 + 73 + for (i = 0; i < ath79_pci_nr_irqs; i++) { 74 + const struct ath79_pci_irq *entry; 75 + 76 + entry = &ath79_pci_irq_map[i]; 77 + if (entry->slot == slot && entry->pin == pin) { 78 + irq = entry->irq; 79 + break; 80 + } 81 + } 82 + 83 + if (irq < 0) 84 + pr_crit("pci %s: no irq found for pin %u\n", 85 + pci_name((struct pci_dev *) dev), pin); 86 + else 87 + pr_info("pci %s: using irq %d for pin %u\n", 88 + pci_name((struct pci_dev *) dev), irq, pin); 89 + 90 + return irq; 91 + } 92 + 93 + int pcibios_plat_dev_init(struct pci_dev *dev) 94 + { 95 + if (ath79_pci_plat_dev_init) 96 + return ath79_pci_plat_dev_init(dev); 97 + 98 + return 0; 99 + } 100 + 101 + void __init ath79_pci_set_irq_map(unsigned nr_irqs, 102 + const struct ath79_pci_irq *map) 103 + { 104 + ath79_pci_nr_irqs = nr_irqs; 105 + ath79_pci_irq_map = map; 106 + } 107 + 108 + void __init ath79_pci_set_plat_dev_init(int (*func)(struct pci_dev *dev)) 109 + { 110 + ath79_pci_plat_dev_init = func; 111 + } 112 + 113 + int __init ath79_register_pci(void) 114 + { 115 + if (soc_is_ar71xx()) 116 + return ar71xx_pcibios_init(); 117 + 118 + if (soc_is_ar724x()) 119 + return ar724x_pcibios_init(ATH79_CPU_IRQ_IP2); 120 + 121 + if (soc_is_ar9342() || soc_is_ar9344()) { 122 + u32 bootstrap; 123 + 124 + bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP); 125 + if (bootstrap & AR934X_BOOTSTRAP_PCIE_RC) 126 + return ar724x_pcibios_init(ATH79_IP2_IRQ(0)); 127 + } 128 + 129 + return -ENODEV; 130 + }
+34
arch/mips/ath79/pci.h
··· 1 + /* 2 + * Atheros AR71XX/AR724X PCI support 3 + * 4 + * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com> 5 + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> 6 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 7 + * 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License version 2 as published 10 + * by the Free Software Foundation. 11 + */ 12 + 13 + #ifndef _ATH79_PCI_H 14 + #define _ATH79_PCI_H 15 + 16 + struct ath79_pci_irq { 17 + u8 slot; 18 + u8 pin; 19 + int irq; 20 + }; 21 + 22 + #ifdef CONFIG_PCI 23 + void ath79_pci_set_irq_map(unsigned nr_irqs, const struct ath79_pci_irq *map); 24 + void ath79_pci_set_plat_dev_init(int (*func)(struct pci_dev *dev)); 25 + int ath79_register_pci(void); 26 + #else 27 + static inline void 28 + ath79_pci_set_irq_map(unsigned nr_irqs, const struct ath79_pci_irq *map) {} 29 + static inline void 30 + ath79_pci_set_plat_dev_init(int (*func)(struct pci_dev *)) {} 31 + static inline int ath79_register_pci(void) { return 0; } 32 + #endif 33 + 34 + #endif /* _ATH79_PCI_H */
+32 -13
arch/mips/ath79/setup.c
··· 1 1 /* 2 2 * Atheros AR71XX/AR724X/AR913X specific setup 3 3 * 4 + * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com> 4 5 * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> 5 6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 6 7 * 7 - * Parts of this file are based on Atheros' 2.6.15 BSP 8 + * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP 8 9 * 9 10 * This program is free software; you can redistribute it and/or modify it 10 11 * under the terms of the GNU General Public License version 2 as published ··· 117 116 rev = id & AR724X_REV_ID_REVISION_MASK; 118 117 break; 119 118 120 - case REV_ID_MAJOR_AR9330: 121 - ath79_soc = ATH79_SOC_AR9330; 122 - chip = "9330"; 123 - rev = id & AR933X_REV_ID_REVISION_MASK; 124 - break; 125 - 126 - case REV_ID_MAJOR_AR9331: 127 - ath79_soc = ATH79_SOC_AR9331; 128 - chip = "9331"; 129 - rev = id & AR933X_REV_ID_REVISION_MASK; 130 - break; 131 - 132 119 case REV_ID_MAJOR_AR913X: 133 120 minor = id & AR913X_REV_ID_MINOR_MASK; 134 121 rev = id >> AR913X_REV_ID_REVISION_SHIFT; ··· 132 143 chip = "9132"; 133 144 break; 134 145 } 146 + break; 147 + 148 + case REV_ID_MAJOR_AR9330: 149 + ath79_soc = ATH79_SOC_AR9330; 150 + chip = "9330"; 151 + rev = id & AR933X_REV_ID_REVISION_MASK; 152 + break; 153 + 154 + case REV_ID_MAJOR_AR9331: 155 + ath79_soc = ATH79_SOC_AR9331; 156 + chip = "9331"; 157 + rev = id & AR933X_REV_ID_REVISION_MASK; 158 + break; 159 + 160 + case REV_ID_MAJOR_AR9341: 161 + ath79_soc = ATH79_SOC_AR9341; 162 + chip = "9341"; 163 + rev = id & AR934X_REV_ID_REVISION_MASK; 164 + break; 165 + 166 + case REV_ID_MAJOR_AR9342: 167 + ath79_soc = ATH79_SOC_AR9342; 168 + chip = "9342"; 169 + rev = id & AR934X_REV_ID_REVISION_MASK; 170 + break; 171 + 172 + case REV_ID_MAJOR_AR9344: 173 + ath79_soc = ATH79_SOC_AR9344; 174 + chip = "9344"; 175 + rev = id & AR934X_REV_ID_REVISION_MASK; 135 176 break; 136 177 137 178 default:
-2
arch/mips/bcm63xx/boards/Makefile
··· 1 1 obj-$(CONFIG_BOARD_BCM963XX) += board_bcm963xx.o 2 - 3 - ccflags-y := -Werror
+1
arch/mips/cavium-octeon/setup.c
··· 9 9 #include <linux/init.h> 10 10 #include <linux/console.h> 11 11 #include <linux/delay.h> 12 + #include <linux/export.h> 12 13 #include <linux/interrupt.h> 13 14 #include <linux/io.h> 14 15 #include <linux/serial.h>
-6
arch/mips/cavium-octeon/smp.c
··· 257 257 258 258 extern void fixup_irqs(void); 259 259 260 - static DEFINE_SPINLOCK(smp_reserve_lock); 261 - 262 260 static int octeon_cpu_disable(void) 263 261 { 264 262 unsigned int cpu = smp_processor_id(); 265 263 266 264 if (cpu == 0) 267 265 return -EBUSY; 268 - 269 - spin_lock(&smp_reserve_lock); 270 266 271 267 set_cpu_online(cpu, false); 272 268 cpu_clear(cpu, cpu_callin_map); ··· 272 276 273 277 flush_cache_all(); 274 278 local_flush_tlb_all(); 275 - 276 - spin_unlock(&smp_reserve_lock); 277 279 278 280 return 0; 279 281 }
-2
arch/mips/fw/arc/Makefile
··· 8 8 lib-$(CONFIG_ARC_MEMORY) += memory.o 9 9 lib-$(CONFIG_ARC_CONSOLE) += arc_con.o 10 10 lib-$(CONFIG_ARC_PROMLIB) += promlib.o 11 - 12 - ccflags-y := -Werror
+25
arch/mips/include/asm/clkdev.h
··· 1 + /* 2 + * based on arch/arm/include/asm/clkdev.h 3 + * 4 + * Copyright (C) 2008 Russell King. 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * Helper for the clk API to assist looking up a struct clk. 11 + */ 12 + #ifndef __ASM_CLKDEV_H 13 + #define __ASM_CLKDEV_H 14 + 15 + #include <linux/slab.h> 16 + 17 + #define __clk_get(clk) ({ 1; }) 18 + #define __clk_put(clk) do { } while (0) 19 + 20 + static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) 21 + { 22 + return kzalloc(size, GFP_KERNEL); 23 + } 24 + 25 + #endif
+90 -1
arch/mips/include/asm/mach-ath79/ar71xx_regs.h
··· 1 1 /* 2 2 * Atheros AR71XX/AR724X/AR913X SoC register definitions 3 3 * 4 + * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com> 4 5 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> 5 6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 6 7 * 7 - * Parts of this file are based on Atheros' 2.6.15 BSP 8 + * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP 8 9 * 9 10 * This program is free software; you can redistribute it and/or modify it 10 11 * under the terms of the GNU General Public License version 2 as published ··· 61 60 #define AR933X_EHCI_BASE 0x1b000000 62 61 #define AR933X_EHCI_SIZE 0x1000 63 62 63 + #define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) 64 + #define AR934X_WMAC_SIZE 0x20000 65 + 64 66 /* 65 67 * DDR_CTRL block 66 68 */ ··· 94 90 #define AR933X_DDR_REG_FLUSH_GE1 0x80 95 91 #define AR933X_DDR_REG_FLUSH_USB 0x84 96 92 #define AR933X_DDR_REG_FLUSH_WMAC 0x88 93 + 94 + #define AR934X_DDR_REG_FLUSH_GE0 0x9c 95 + #define AR934X_DDR_REG_FLUSH_GE1 0xa0 96 + #define AR934X_DDR_REG_FLUSH_USB 0xa4 97 + #define AR934X_DDR_REG_FLUSH_PCIE 0xa8 98 + #define AR934X_DDR_REG_FLUSH_WMAC 0xac 97 99 98 100 /* 99 101 * PLL block ··· 160 150 #define AR933X_PLL_CLOCK_CTRL_AHB_DIV_SHIFT 15 161 151 #define AR933X_PLL_CLOCK_CTRL_AHB_DIV_MASK 0x7 162 152 153 + #define AR934X_PLL_CPU_CONFIG_REG 0x00 154 + #define AR934X_PLL_DDR_CONFIG_REG 0x04 155 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_REG 0x08 156 + 157 + #define AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT 0 158 + #define AR934X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f 159 + #define AR934X_PLL_CPU_CONFIG_NINT_SHIFT 6 160 + #define AR934X_PLL_CPU_CONFIG_NINT_MASK 0x3f 161 + #define AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT 12 162 + #define AR934X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f 163 + #define AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT 19 164 + #define AR934X_PLL_CPU_CONFIG_OUTDIV_MASK 0x3 165 + 166 + #define AR934X_PLL_DDR_CONFIG_NFRAC_SHIFT 0 167 + #define AR934X_PLL_DDR_CONFIG_NFRAC_MASK 0x3ff 168 + #define AR934X_PLL_DDR_CONFIG_NINT_SHIFT 10 169 + #define AR934X_PLL_DDR_CONFIG_NINT_MASK 0x3f 170 + #define AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT 16 171 + #define AR934X_PLL_DDR_CONFIG_REFDIV_MASK 0x1f 172 + #define AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT 23 173 + #define AR934X_PLL_DDR_CONFIG_OUTDIV_MASK 0x7 174 + 175 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_PLL_BYPASS BIT(2) 176 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_PLL_BYPASS BIT(3) 177 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_PLL_BYPASS BIT(4) 178 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_SHIFT 5 179 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPU_POST_DIV_MASK 0x1f 180 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_SHIFT 10 181 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDR_POST_DIV_MASK 0x1f 182 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_SHIFT 15 183 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHB_POST_DIV_MASK 0x1f 184 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_CPUCLK_FROM_CPUPLL BIT(20) 185 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21) 186 + #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) 187 + 163 188 /* 164 189 * USB_CONFIG block 165 190 */ ··· 229 184 230 185 #define AR933X_RESET_REG_RESET_MODULE 0x1c 231 186 #define AR933X_RESET_REG_BOOTSTRAP 0xac 187 + 188 + #define AR934X_RESET_REG_RESET_MODULE 0x1c 189 + #define AR934X_RESET_REG_BOOTSTRAP 0xb0 190 + #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac 232 191 233 192 #define MISC_INT_ETHSW BIT(12) 234 193 #define MISC_INT_TIMER4 BIT(10) ··· 290 241 291 242 #define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0) 292 243 244 + #define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23) 245 + #define AR934X_BOOTSTRAP_SW_OPTION7 BIT(22) 246 + #define AR934X_BOOTSTRAP_SW_OPTION6 BIT(21) 247 + #define AR934X_BOOTSTRAP_SW_OPTION5 BIT(20) 248 + #define AR934X_BOOTSTRAP_SW_OPTION4 BIT(19) 249 + #define AR934X_BOOTSTRAP_SW_OPTION3 BIT(18) 250 + #define AR934X_BOOTSTRAP_SW_OPTION2 BIT(17) 251 + #define AR934X_BOOTSTRAP_SW_OPTION1 BIT(16) 252 + #define AR934X_BOOTSTRAP_USB_MODE_DEVICE BIT(7) 253 + #define AR934X_BOOTSTRAP_PCIE_RC BIT(6) 254 + #define AR934X_BOOTSTRAP_EJTAG_MODE BIT(5) 255 + #define AR934X_BOOTSTRAP_REF_CLK_40 BIT(4) 256 + #define AR934X_BOOTSTRAP_BOOT_FROM_SPI BIT(2) 257 + #define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1) 258 + #define AR934X_BOOTSTRAP_DDR1 BIT(0) 259 + 260 + #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0) 261 + #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1) 262 + #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2) 263 + #define AR934X_PCIE_WMAC_INT_WMAC_RXHP BIT(3) 264 + #define AR934X_PCIE_WMAC_INT_PCIE_RC BIT(4) 265 + #define AR934X_PCIE_WMAC_INT_PCIE_RC0 BIT(5) 266 + #define AR934X_PCIE_WMAC_INT_PCIE_RC1 BIT(6) 267 + #define AR934X_PCIE_WMAC_INT_PCIE_RC2 BIT(7) 268 + #define AR934X_PCIE_WMAC_INT_PCIE_RC3 BIT(8) 269 + #define AR934X_PCIE_WMAC_INT_WMAC_ALL \ 270 + (AR934X_PCIE_WMAC_INT_WMAC_MISC | AR934X_PCIE_WMAC_INT_WMAC_TX | \ 271 + AR934X_PCIE_WMAC_INT_WMAC_RXLP | AR934X_PCIE_WMAC_INT_WMAC_RXHP) 272 + 273 + #define AR934X_PCIE_WMAC_INT_PCIE_ALL \ 274 + (AR934X_PCIE_WMAC_INT_PCIE_RC | AR934X_PCIE_WMAC_INT_PCIE_RC0 | \ 275 + AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \ 276 + AR934X_PCIE_WMAC_INT_PCIE_RC3) 277 + 293 278 #define REV_ID_MAJOR_MASK 0xfff0 294 279 #define REV_ID_MAJOR_AR71XX 0x00a0 295 280 #define REV_ID_MAJOR_AR913X 0x00b0 ··· 332 249 #define REV_ID_MAJOR_AR7242 0x1100 333 250 #define REV_ID_MAJOR_AR9330 0x0110 334 251 #define REV_ID_MAJOR_AR9331 0x1110 252 + #define REV_ID_MAJOR_AR9341 0x0120 253 + #define REV_ID_MAJOR_AR9342 0x1120 254 + #define REV_ID_MAJOR_AR9344 0x2120 335 255 336 256 #define AR71XX_REV_ID_MINOR_MASK 0x3 337 257 #define AR71XX_REV_ID_MINOR_AR7130 0x0 ··· 352 266 #define AR933X_REV_ID_REVISION_MASK 0x3 353 267 354 268 #define AR724X_REV_ID_REVISION_MASK 0x3 269 + 270 + #define AR934X_REV_ID_REVISION_MASK 0xf 355 271 356 272 /* 357 273 * SPI block ··· 396 308 #define AR724X_GPIO_COUNT 18 397 309 #define AR913X_GPIO_COUNT 22 398 310 #define AR933X_GPIO_COUNT 30 311 + #define AR934X_GPIO_COUNT 23 399 312 400 313 #endif /* __ASM_MACH_AR71XX_REGS_H */
+23
arch/mips/include/asm/mach-ath79/ath79.h
··· 29 29 ATH79_SOC_AR9132, 30 30 ATH79_SOC_AR9330, 31 31 ATH79_SOC_AR9331, 32 + ATH79_SOC_AR9341, 33 + ATH79_SOC_AR9342, 34 + ATH79_SOC_AR9344, 32 35 }; 33 36 34 37 extern enum ath79_soc_type ath79_soc; ··· 76 73 { 77 74 return (ath79_soc == ATH79_SOC_AR9330 || 78 75 ath79_soc == ATH79_SOC_AR9331); 76 + } 77 + 78 + static inline int soc_is_ar9341(void) 79 + { 80 + return (ath79_soc == ATH79_SOC_AR9341); 81 + } 82 + 83 + static inline int soc_is_ar9342(void) 84 + { 85 + return (ath79_soc == ATH79_SOC_AR9342); 86 + } 87 + 88 + static inline int soc_is_ar9344(void) 89 + { 90 + return (ath79_soc == ATH79_SOC_AR9344); 91 + } 92 + 93 + static inline int soc_is_ar934x(void) 94 + { 95 + return soc_is_ar9341() || soc_is_ar9342() || soc_is_ar9344(); 79 96 } 80 97 81 98 extern void __iomem *ath79_ddr_base;
+9 -1
arch/mips/include/asm/mach-ath79/irq.h
··· 10 10 #define __ASM_MACH_ATH79_IRQ_H 11 11 12 12 #define MIPS_CPU_IRQ_BASE 0 13 - #define NR_IRQS 40 13 + #define NR_IRQS 48 14 14 15 15 #define ATH79_MISC_IRQ_BASE 8 16 16 #define ATH79_MISC_IRQ_COUNT 32 17 + 18 + #define ATH79_PCI_IRQ_BASE (ATH79_MISC_IRQ_BASE + ATH79_MISC_IRQ_COUNT) 19 + #define ATH79_PCI_IRQ_COUNT 6 20 + #define ATH79_PCI_IRQ(_x) (ATH79_PCI_IRQ_BASE + (_x)) 21 + 22 + #define ATH79_IP2_IRQ_BASE (ATH79_PCI_IRQ_BASE + ATH79_PCI_IRQ_COUNT) 23 + #define ATH79_IP2_IRQ_COUNT 2 24 + #define ATH79_IP2_IRQ(_x) (ATH79_IP2_IRQ_BASE + (_x)) 17 25 18 26 #define ATH79_CPU_IRQ_IP2 (MIPS_CPU_IRQ_BASE + 2) 19 27 #define ATH79_CPU_IRQ_USB (MIPS_CPU_IRQ_BASE + 3)
-21
arch/mips/include/asm/mach-ath79/pci-ath724x.h
··· 1 - /* 2 - * Atheros 724x PCI support 3 - * 4 - * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com> 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License version 2 as published 8 - * by the Free Software Foundation. 9 - */ 10 - 11 - #ifndef __ASM_MACH_ATH79_PCI_ATH724X_H 12 - #define __ASM_MACH_ATH79_PCI_ATH724X_H 13 - 14 - struct ath724x_pci_data { 15 - int irq; 16 - void *pdata; 17 - }; 18 - 19 - void ath724x_pci_add_data(struct ath724x_pci_data *data, int size); 20 - 21 - #endif /* __ASM_MACH_ATH79_PCI_ATH724X_H */
+28
arch/mips/include/asm/mach-ath79/pci.h
··· 1 + /* 2 + * Atheros AR71XX/AR724X PCI support 3 + * 4 + * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com> 5 + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> 6 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 7 + * 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License version 2 as published 10 + * by the Free Software Foundation. 11 + */ 12 + 13 + #ifndef __ASM_MACH_ATH79_PCI_H 14 + #define __ASM_MACH_ATH79_PCI_H 15 + 16 + #if defined(CONFIG_PCI) && defined(CONFIG_SOC_AR71XX) 17 + int ar71xx_pcibios_init(void); 18 + #else 19 + static inline int ar71xx_pcibios_init(void) { return 0; } 20 + #endif 21 + 22 + #if defined(CONFIG_PCI_AR724X) 23 + int ar724x_pcibios_init(int irq); 24 + #else 25 + static inline int ar724x_pcibios_init(int irq) { return 0; } 26 + #endif 27 + 28 + #endif /* __ASM_MACH_ATH79_PCI_H */
+1
arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
··· 2 2 #define BCM63XX_GPIO_H 3 3 4 4 #include <linux/init.h> 5 + #include <bcm63xx_cpu.h> 5 6 6 7 int __init bcm63xx_gpio_init(void); 7 8
+23
arch/mips/include/asm/mach-lantiq/falcon/falcon_irq.h
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2010 Thomas Langer <thomas.langer@lantiq.com> 7 + */ 8 + 9 + #ifndef _FALCON_IRQ__ 10 + #define _FALCON_IRQ__ 11 + 12 + #define INT_NUM_IRQ0 8 13 + #define INT_NUM_IM0_IRL0 (INT_NUM_IRQ0 + 0) 14 + #define INT_NUM_IM1_IRL0 (INT_NUM_IM0_IRL0 + 32) 15 + #define INT_NUM_IM2_IRL0 (INT_NUM_IM1_IRL0 + 32) 16 + #define INT_NUM_IM3_IRL0 (INT_NUM_IM2_IRL0 + 32) 17 + #define INT_NUM_IM4_IRL0 (INT_NUM_IM3_IRL0 + 32) 18 + #define INT_NUM_EXTRA_START (INT_NUM_IM4_IRL0 + 32) 19 + #define INT_NUM_IM_OFFSET (INT_NUM_IM1_IRL0 - INT_NUM_IM0_IRL0) 20 + 21 + #define MIPS_CPU_TIMER_IRQ 7 22 + 23 + #endif /* _FALCON_IRQ__ */
+18
arch/mips/include/asm/mach-lantiq/falcon/irq.h
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2011 Thomas Langer <thomas.langer@lantiq.com> 7 + */ 8 + 9 + #ifndef __FALCON_IRQ_H 10 + #define __FALCON_IRQ_H 11 + 12 + #include <falcon_irq.h> 13 + 14 + #define NR_IRQS 328 15 + 16 + #include_next <irq.h> 17 + 18 + #endif
+67
arch/mips/include/asm/mach-lantiq/falcon/lantiq_soc.h
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 + */ 8 + 9 + #ifndef _LTQ_FALCON_H__ 10 + #define _LTQ_FALCON_H__ 11 + 12 + #ifdef CONFIG_SOC_FALCON 13 + 14 + #include <linux/pinctrl/pinctrl.h> 15 + #include <lantiq.h> 16 + 17 + /* Chip IDs */ 18 + #define SOC_ID_FALCON 0x01B8 19 + 20 + /* SoC Types */ 21 + #define SOC_TYPE_FALCON 0x01 22 + 23 + /* 24 + * during early_printk no ioremap possible at this early stage 25 + * lets use KSEG1 instead 26 + */ 27 + #define LTQ_ASC0_BASE_ADDR 0x1E100C00 28 + #define LTQ_EARLY_ASC KSEG1ADDR(LTQ_ASC0_BASE_ADDR) 29 + 30 + /* WDT */ 31 + #define LTQ_RST_CAUSE_WDTRST 0x0002 32 + 33 + /* CHIP ID */ 34 + #define LTQ_STATUS_BASE_ADDR 0x1E802000 35 + 36 + #define FALCON_CHIPID ((u32 *)(KSEG1 + LTQ_STATUS_BASE_ADDR + 0x0c)) 37 + #define FALCON_CHIPTYPE ((u32 *)(KSEG1 + LTQ_STATUS_BASE_ADDR + 0x38)) 38 + #define FALCON_CHIPCONF ((u32 *)(KSEG1 + LTQ_STATUS_BASE_ADDR + 0x40)) 39 + 40 + /* SYSCTL - start/stop/restart/configure/... different parts of the Soc */ 41 + #define SYSCTL_SYS1 0 42 + #define SYSCTL_SYSETH 1 43 + #define SYSCTL_SYSGPE 2 44 + 45 + /* BOOT_SEL - find what boot media we have */ 46 + #define BS_FLASH 0x1 47 + #define BS_SPI 0x4 48 + 49 + /* global register ranges */ 50 + extern __iomem void *ltq_ebu_membase; 51 + extern __iomem void *ltq_sys1_membase; 52 + #define ltq_ebu_w32(x, y) ltq_w32((x), ltq_ebu_membase + (y)) 53 + #define ltq_ebu_r32(x) ltq_r32(ltq_ebu_membase + (x)) 54 + 55 + #define ltq_sys1_w32(x, y) ltq_w32((x), ltq_sys1_membase + (y)) 56 + #define ltq_sys1_r32(x) ltq_r32(ltq_sys1_membase + (x)) 57 + #define ltq_sys1_w32_mask(clear, set, reg) \ 58 + ltq_sys1_w32((ltq_sys1_r32(reg) & ~(clear)) | (set), reg) 59 + 60 + /* 61 + * to keep the irq code generic we need to define this to 0 as falcon 62 + * has no EIU/EBU 63 + */ 64 + #define LTQ_EBU_PCC_ISTAT 0 65 + 66 + #endif /* CONFIG_SOC_FALCON */ 67 + #endif /* _LTQ_XWAY_H__ */
+16
arch/mips/include/asm/mach-lantiq/gpio.h
··· 1 + #ifndef __ASM_MIPS_MACH_LANTIQ_GPIO_H 2 + #define __ASM_MIPS_MACH_LANTIQ_GPIO_H 3 + 4 + static inline int gpio_to_irq(unsigned int gpio) 5 + { 6 + return -1; 7 + } 8 + 9 + #define gpio_get_value __gpio_get_value 10 + #define gpio_set_value __gpio_set_value 11 + 12 + #define gpio_cansleep __gpio_cansleep 13 + 14 + #include <asm-generic/gpio.h> 15 + 16 + #endif
+13 -21
arch/mips/include/asm/mach-lantiq/lantiq.h
··· 9 9 #define _LANTIQ_H__ 10 10 11 11 #include <linux/irq.h> 12 + #include <linux/device.h> 13 + #include <linux/clk.h> 12 14 13 15 /* generic reg access functions */ 14 16 #define ltq_r32(reg) __raw_readl(reg) ··· 23 21 /* register access macros for EBU and CGU */ 24 22 #define ltq_ebu_w32(x, y) ltq_w32((x), ltq_ebu_membase + (y)) 25 23 #define ltq_ebu_r32(x) ltq_r32(ltq_ebu_membase + (x)) 26 - #define ltq_cgu_w32(x, y) ltq_w32((x), ltq_cgu_membase + (y)) 27 - #define ltq_cgu_r32(x) ltq_r32(ltq_cgu_membase + (x)) 28 - 24 + #define ltq_ebu_w32_mask(x, y, z) \ 25 + ltq_w32_mask(x, y, ltq_ebu_membase + (z)) 29 26 extern __iomem void *ltq_ebu_membase; 30 - extern __iomem void *ltq_cgu_membase; 31 - 32 - extern unsigned int ltq_get_cpu_ver(void); 33 - extern unsigned int ltq_get_soc_type(void); 34 - 35 - /* clock speeds */ 36 - #define CLOCK_60M 60000000 37 - #define CLOCK_83M 83333333 38 - #define CLOCK_111M 111111111 39 - #define CLOCK_133M 133333333 40 - #define CLOCK_167M 166666667 41 - #define CLOCK_200M 200000000 42 - #define CLOCK_266M 266666666 43 - #define CLOCK_333M 333333333 44 - #define CLOCK_400M 400000000 45 27 46 28 /* spinlock all ebu i/o */ 47 29 extern spinlock_t ebu_lock; ··· 35 49 extern void ltq_mask_and_ack_irq(struct irq_data *data); 36 50 extern void ltq_enable_irq(struct irq_data *data); 37 51 52 + /* clock handling */ 53 + extern int clk_activate(struct clk *clk); 54 + extern void clk_deactivate(struct clk *clk); 55 + extern struct clk *clk_get_cpu(void); 56 + extern struct clk *clk_get_fpi(void); 57 + extern struct clk *clk_get_io(void); 58 + 59 + /* find out what bootsource we have */ 60 + extern unsigned char ltq_boot_select(void); 38 61 /* find out what caused the last cpu reset */ 39 62 extern int ltq_reset_cause(void); 40 - #define LTQ_RST_CAUSE_WDTRST 0x20 41 63 42 64 #define IOPORT_RESOURCE_START 0x10000000 43 65 #define IOPORT_RESOURCE_END 0xffffffff 44 66 #define IOMEM_RESOURCE_START 0x10000000 45 67 #define IOMEM_RESOURCE_END 0xffffffff 46 - #define LTQ_FLASH_START 0x10000000 47 - #define LTQ_FLASH_MAX 0x04000000 48 68 49 69 #endif
-33
arch/mips/include/asm/mach-lantiq/lantiq_platform.h
··· 9 9 #ifndef _LANTIQ_PLATFORM_H__ 10 10 #define _LANTIQ_PLATFORM_H__ 11 11 12 - #include <linux/mtd/partitions.h> 13 12 #include <linux/socket.h> 14 - 15 - /* struct used to pass info to the pci core */ 16 - enum { 17 - PCI_CLOCK_INT = 0, 18 - PCI_CLOCK_EXT 19 - }; 20 - 21 - #define PCI_EXIN0 0x0001 22 - #define PCI_EXIN1 0x0002 23 - #define PCI_EXIN2 0x0004 24 - #define PCI_EXIN3 0x0008 25 - #define PCI_EXIN4 0x0010 26 - #define PCI_EXIN5 0x0020 27 - #define PCI_EXIN_MAX 6 28 - 29 - #define PCI_GNT1 0x0040 30 - #define PCI_GNT2 0x0080 31 - #define PCI_GNT3 0x0100 32 - #define PCI_GNT4 0x0200 33 - 34 - #define PCI_REQ1 0x0400 35 - #define PCI_REQ2 0x0800 36 - #define PCI_REQ3 0x1000 37 - #define PCI_REQ4 0x2000 38 - #define PCI_REQ_SHIFT 10 39 - #define PCI_REQ_MASK 0xf 40 - 41 - struct ltq_pci_data { 42 - int clock; 43 - int gpio; 44 - int irq[16]; 45 - }; 46 13 47 14 /* struct used to pass info to network drivers */ 48 15 struct ltq_eth_data {
+1 -43
arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h
··· 17 17 #define INT_NUM_IM4_IRL0 (INT_NUM_IRQ0 + 128) 18 18 #define INT_NUM_IM_OFFSET (INT_NUM_IM1_IRL0 - INT_NUM_IM0_IRL0) 19 19 20 - #define LTQ_ASC_TIR(x) (INT_NUM_IM3_IRL0 + (x * 8)) 21 - #define LTQ_ASC_RIR(x) (INT_NUM_IM3_IRL0 + (x * 8) + 1) 22 - #define LTQ_ASC_EIR(x) (INT_NUM_IM3_IRL0 + (x * 8) + 2) 23 - 24 - #define LTQ_ASC_ASE_TIR INT_NUM_IM2_IRL0 25 - #define LTQ_ASC_ASE_RIR (INT_NUM_IM2_IRL0 + 2) 26 - #define LTQ_ASC_ASE_EIR (INT_NUM_IM2_IRL0 + 3) 27 - 28 - #define LTQ_SSC_TIR (INT_NUM_IM0_IRL0 + 15) 29 - #define LTQ_SSC_RIR (INT_NUM_IM0_IRL0 + 14) 30 - #define LTQ_SSC_EIR (INT_NUM_IM0_IRL0 + 16) 31 - 32 - #define LTQ_MEI_DYING_GASP_INT (INT_NUM_IM1_IRL0 + 21) 33 - #define LTQ_MEI_INT (INT_NUM_IM1_IRL0 + 23) 34 - 35 - #define LTQ_TIMER6_INT (INT_NUM_IM1_IRL0 + 23) 36 - #define LTQ_USB_INT (INT_NUM_IM1_IRL0 + 22) 37 - #define LTQ_USB_OC_INT (INT_NUM_IM4_IRL0 + 23) 38 - 39 - #define MIPS_CPU_TIMER_IRQ 7 40 - 41 20 #define LTQ_DMA_CH0_INT (INT_NUM_IM2_IRL0) 42 - #define LTQ_DMA_CH1_INT (INT_NUM_IM2_IRL0 + 1) 43 - #define LTQ_DMA_CH2_INT (INT_NUM_IM2_IRL0 + 2) 44 - #define LTQ_DMA_CH3_INT (INT_NUM_IM2_IRL0 + 3) 45 - #define LTQ_DMA_CH4_INT (INT_NUM_IM2_IRL0 + 4) 46 - #define LTQ_DMA_CH5_INT (INT_NUM_IM2_IRL0 + 5) 47 - #define LTQ_DMA_CH6_INT (INT_NUM_IM2_IRL0 + 6) 48 - #define LTQ_DMA_CH7_INT (INT_NUM_IM2_IRL0 + 7) 49 - #define LTQ_DMA_CH8_INT (INT_NUM_IM2_IRL0 + 8) 50 - #define LTQ_DMA_CH9_INT (INT_NUM_IM2_IRL0 + 9) 51 - #define LTQ_DMA_CH10_INT (INT_NUM_IM2_IRL0 + 10) 52 - #define LTQ_DMA_CH11_INT (INT_NUM_IM2_IRL0 + 11) 53 - #define LTQ_DMA_CH12_INT (INT_NUM_IM2_IRL0 + 25) 54 - #define LTQ_DMA_CH13_INT (INT_NUM_IM2_IRL0 + 26) 55 - #define LTQ_DMA_CH14_INT (INT_NUM_IM2_IRL0 + 27) 56 - #define LTQ_DMA_CH15_INT (INT_NUM_IM2_IRL0 + 28) 57 - #define LTQ_DMA_CH16_INT (INT_NUM_IM2_IRL0 + 29) 58 - #define LTQ_DMA_CH17_INT (INT_NUM_IM2_IRL0 + 30) 59 - #define LTQ_DMA_CH18_INT (INT_NUM_IM2_IRL0 + 16) 60 - #define LTQ_DMA_CH19_INT (INT_NUM_IM2_IRL0 + 21) 61 21 62 - #define LTQ_PPE_MBOX_INT (INT_NUM_IM2_IRL0 + 24) 63 - 64 - #define INT_NUM_IM4_IRL14 (INT_NUM_IM4_IRL0 + 14) 22 + #define MIPS_CPU_TIMER_IRQ 7 65 23 66 24 #endif
+42 -92
arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
··· 17 17 #define SOC_ID_DANUBE1 0x129 18 18 #define SOC_ID_DANUBE2 0x12B 19 19 #define SOC_ID_TWINPASS 0x12D 20 - #define SOC_ID_AMAZON_SE 0x152 20 + #define SOC_ID_AMAZON_SE_1 0x152 /* 50601 */ 21 + #define SOC_ID_AMAZON_SE_2 0x153 /* 50600 */ 21 22 #define SOC_ID_ARX188 0x16C 22 - #define SOC_ID_ARX168 0x16D 23 + #define SOC_ID_ARX168_1 0x16D 24 + #define SOC_ID_ARX168_2 0x16E 23 25 #define SOC_ID_ARX182 0x16F 26 + #define SOC_ID_GRX188 0x170 27 + #define SOC_ID_GRX168 0x171 24 28 25 - /* SoC Types */ 29 + #define SOC_ID_VRX288 0x1C0 /* v1.1 */ 30 + #define SOC_ID_VRX282 0x1C1 /* v1.1 */ 31 + #define SOC_ID_VRX268 0x1C2 /* v1.1 */ 32 + #define SOC_ID_GRX268 0x1C8 /* v1.1 */ 33 + #define SOC_ID_GRX288 0x1C9 /* v1.1 */ 34 + #define SOC_ID_VRX288_2 0x00B /* v1.2 */ 35 + #define SOC_ID_VRX268_2 0x00C /* v1.2 */ 36 + #define SOC_ID_GRX288_2 0x00D /* v1.2 */ 37 + #define SOC_ID_GRX282_2 0x00E /* v1.2 */ 38 + 39 + /* SoC Types */ 26 40 #define SOC_TYPE_DANUBE 0x01 27 41 #define SOC_TYPE_TWINPASS 0x02 28 42 #define SOC_TYPE_AR9 0x03 29 - #define SOC_TYPE_VR9 0x04 30 - #define SOC_TYPE_AMAZON_SE 0x05 43 + #define SOC_TYPE_VR9 0x04 /* v1.1 */ 44 + #define SOC_TYPE_VR9_2 0x05 /* v1.2 */ 45 + #define SOC_TYPE_AMAZON_SE 0x06 31 46 32 - /* ASC0/1 - serial port */ 33 - #define LTQ_ASC0_BASE_ADDR 0x1E100400 47 + /* BOOT_SEL - find what boot media we have */ 48 + #define BS_EXT_ROM 0x0 49 + #define BS_FLASH 0x1 50 + #define BS_MII0 0x2 51 + #define BS_PCI 0x3 52 + #define BS_UART1 0x4 53 + #define BS_SPI 0x5 54 + #define BS_NAND 0x6 55 + #define BS_RMII0 0x7 56 + 57 + /* helpers used to access the cgu */ 58 + #define ltq_cgu_w32(x, y) ltq_w32((x), ltq_cgu_membase + (y)) 59 + #define ltq_cgu_r32(x) ltq_r32(ltq_cgu_membase + (x)) 60 + extern __iomem void *ltq_cgu_membase; 61 + 62 + /* 63 + * during early_printk no ioremap is possible 64 + * lets use KSEG1 instead 65 + */ 34 66 #define LTQ_ASC1_BASE_ADDR 0x1E100C00 35 - #define LTQ_ASC_SIZE 0x400 36 - 37 - /* RCU - reset control unit */ 38 - #define LTQ_RCU_BASE_ADDR 0x1F203000 39 - #define LTQ_RCU_SIZE 0x1000 40 - 41 - /* GPTU - general purpose timer unit */ 42 - #define LTQ_GPTU_BASE_ADDR 0x18000300 43 - #define LTQ_GPTU_SIZE 0x100 67 + #define LTQ_EARLY_ASC KSEG1ADDR(LTQ_ASC1_BASE_ADDR) 44 68 45 69 /* EBU - external bus unit */ 46 - #define LTQ_EBU_GPIO_START 0x14000000 47 - #define LTQ_EBU_GPIO_SIZE 0x1000 48 - 49 - #define LTQ_EBU_BASE_ADDR 0x1E105300 50 - #define LTQ_EBU_SIZE 0x100 51 - 52 70 #define LTQ_EBU_BUSCON0 0x0060 53 71 #define LTQ_EBU_PCC_CON 0x0090 54 72 #define LTQ_EBU_PCC_IEN 0x00A4 ··· 75 57 #define LTQ_EBU_ADDRSEL1 0x0024 76 58 #define EBU_WRDIS 0x80000000 77 59 78 - /* CGU - clock generation unit */ 79 - #define LTQ_CGU_BASE_ADDR 0x1F103000 80 - #define LTQ_CGU_SIZE 0x1000 81 - 82 - /* ICU - interrupt control unit */ 83 - #define LTQ_ICU_BASE_ADDR 0x1F880200 84 - #define LTQ_ICU_SIZE 0x100 85 - 86 - /* EIU - external interrupt unit */ 87 - #define LTQ_EIU_BASE_ADDR 0x1F101000 88 - #define LTQ_EIU_SIZE 0x1000 89 - 90 - /* PMU - power management unit */ 91 - #define LTQ_PMU_BASE_ADDR 0x1F102000 92 - #define LTQ_PMU_SIZE 0x1000 93 - 94 - #define PMU_DMA 0x0020 95 - #define PMU_USB 0x8041 96 - #define PMU_LED 0x0800 97 - #define PMU_GPT 0x1000 98 - #define PMU_PPE 0x2000 99 - #define PMU_FPI 0x4000 100 - #define PMU_SWITCH 0x10000000 101 - 102 - /* ETOP - ethernet */ 103 - #define LTQ_ETOP_BASE_ADDR 0x1E180000 104 - #define LTQ_ETOP_SIZE 0x40000 105 - 106 - /* DMA */ 107 - #define LTQ_DMA_BASE_ADDR 0x1E104100 108 - #define LTQ_DMA_SIZE 0x800 109 - 110 - /* PCI */ 111 - #define PCI_CR_BASE_ADDR 0x1E105400 112 - #define PCI_CR_SIZE 0x400 113 - 114 60 /* WDT */ 115 - #define LTQ_WDT_BASE_ADDR 0x1F8803F0 116 - #define LTQ_WDT_SIZE 0x10 117 - 118 - /* STP - serial to parallel conversion unit */ 119 - #define LTQ_STP_BASE_ADDR 0x1E100BB0 120 - #define LTQ_STP_SIZE 0x40 121 - 122 - /* GPIO */ 123 - #define LTQ_GPIO0_BASE_ADDR 0x1E100B10 124 - #define LTQ_GPIO1_BASE_ADDR 0x1E100B40 125 - #define LTQ_GPIO2_BASE_ADDR 0x1E100B70 126 - #define LTQ_GPIO_SIZE 0x30 127 - 128 - /* SSC */ 129 - #define LTQ_SSC_BASE_ADDR 0x1e100800 130 - #define LTQ_SSC_SIZE 0x100 131 - 132 - /* MEI - dsl core */ 133 - #define LTQ_MEI_BASE_ADDR 0x1E116000 134 - 135 - /* DEU - data encryption unit */ 136 - #define LTQ_DEU_BASE_ADDR 0x1E103100 61 + #define LTQ_RST_CAUSE_WDTRST 0x20 137 62 138 63 /* MPS - multi processor unit (voice) */ 139 64 #define LTQ_MPS_BASE_ADDR (KSEG1 + 0x1F107000) 140 65 #define LTQ_MPS_CHIPID ((u32 *)(LTQ_MPS_BASE_ADDR + 0x0344)) 141 66 142 67 /* request a non-gpio and set the PIO config */ 143 - extern int ltq_gpio_request(unsigned int pin, unsigned int alt0, 144 - unsigned int alt1, unsigned int dir, const char *name); 68 + #define PMU_PPE BIT(13) 145 69 extern void ltq_pmu_enable(unsigned int module); 146 70 extern void ltq_pmu_disable(unsigned int module); 147 - 148 - static inline int ltq_is_ar9(void) 149 - { 150 - return (ltq_get_soc_type() == SOC_TYPE_AR9); 151 - } 152 - 153 - static inline int ltq_is_vr9(void) 154 - { 155 - return (ltq_get_soc_type() == SOC_TYPE_VR9); 156 - } 157 71 158 72 #endif /* CONFIG_SOC_TYPE_XWAY */ 159 73 #endif /* _LTQ_XWAY_H__ */
-4
arch/mips/include/asm/mips-boards/generic.h
··· 93 93 #define mips_pcibios_init() do { } while (0) 94 94 #endif 95 95 96 - #ifdef CONFIG_KGDB 97 - extern void kgdb_config(void); 98 - #endif 99 - 100 96 #endif /* __ASM_MIPS_BOARDS_GENERIC_H */
+1
arch/mips/include/asm/module.h
··· 2 2 #define _ASM_MODULE_H 3 3 4 4 #include <linux/list.h> 5 + #include <linux/elf.h> 5 6 #include <asm/uaccess.h> 6 7 7 8 struct mod_arch_specific {
-1365
arch/mips/include/asm/octeon/cvmx-pcieep-defs.h
··· 1 - /***********************license start*************** 2 - * Author: Cavium Networks 3 - * 4 - * Contact: support@caviumnetworks.com 5 - * This file is part of the OCTEON SDK 6 - * 7 - * Copyright (c) 2003-2008 Cavium Networks 8 - * 9 - * This file is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License, Version 2, as 11 - * published by the Free Software Foundation. 12 - * 13 - * This file is distributed in the hope that it will be useful, but 14 - * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 15 - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 16 - * NONINFRINGEMENT. See the GNU General Public License for more 17 - * details. 18 - * 19 - * You should have received a copy of the GNU General Public License 20 - * along with this file; if not, write to the Free Software 21 - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 - * or visit http://www.gnu.org/licenses/. 23 - * 24 - * This file may also be available under a different license from Cavium. 25 - * Contact Cavium Networks for more information 26 - ***********************license end**************************************/ 27 - 28 - #ifndef __CVMX_PCIEEP_DEFS_H__ 29 - #define __CVMX_PCIEEP_DEFS_H__ 30 - 31 - #define CVMX_PCIEEP_CFG000 \ 32 - (0x0000000000000000ull) 33 - #define CVMX_PCIEEP_CFG001 \ 34 - (0x0000000000000004ull) 35 - #define CVMX_PCIEEP_CFG002 \ 36 - (0x0000000000000008ull) 37 - #define CVMX_PCIEEP_CFG003 \ 38 - (0x000000000000000Cull) 39 - #define CVMX_PCIEEP_CFG004 \ 40 - (0x0000000000000010ull) 41 - #define CVMX_PCIEEP_CFG004_MASK \ 42 - (0x0000000080000010ull) 43 - #define CVMX_PCIEEP_CFG005 \ 44 - (0x0000000000000014ull) 45 - #define CVMX_PCIEEP_CFG005_MASK \ 46 - (0x0000000080000014ull) 47 - #define CVMX_PCIEEP_CFG006 \ 48 - (0x0000000000000018ull) 49 - #define CVMX_PCIEEP_CFG006_MASK \ 50 - (0x0000000080000018ull) 51 - #define CVMX_PCIEEP_CFG007 \ 52 - (0x000000000000001Cull) 53 - #define CVMX_PCIEEP_CFG007_MASK \ 54 - (0x000000008000001Cull) 55 - #define CVMX_PCIEEP_CFG008 \ 56 - (0x0000000000000020ull) 57 - #define CVMX_PCIEEP_CFG008_MASK \ 58 - (0x0000000080000020ull) 59 - #define CVMX_PCIEEP_CFG009 \ 60 - (0x0000000000000024ull) 61 - #define CVMX_PCIEEP_CFG009_MASK \ 62 - (0x0000000080000024ull) 63 - #define CVMX_PCIEEP_CFG010 \ 64 - (0x0000000000000028ull) 65 - #define CVMX_PCIEEP_CFG011 \ 66 - (0x000000000000002Cull) 67 - #define CVMX_PCIEEP_CFG012 \ 68 - (0x0000000000000030ull) 69 - #define CVMX_PCIEEP_CFG012_MASK \ 70 - (0x0000000080000030ull) 71 - #define CVMX_PCIEEP_CFG013 \ 72 - (0x0000000000000034ull) 73 - #define CVMX_PCIEEP_CFG015 \ 74 - (0x000000000000003Cull) 75 - #define CVMX_PCIEEP_CFG016 \ 76 - (0x0000000000000040ull) 77 - #define CVMX_PCIEEP_CFG017 \ 78 - (0x0000000000000044ull) 79 - #define CVMX_PCIEEP_CFG020 \ 80 - (0x0000000000000050ull) 81 - #define CVMX_PCIEEP_CFG021 \ 82 - (0x0000000000000054ull) 83 - #define CVMX_PCIEEP_CFG022 \ 84 - (0x0000000000000058ull) 85 - #define CVMX_PCIEEP_CFG023 \ 86 - (0x000000000000005Cull) 87 - #define CVMX_PCIEEP_CFG028 \ 88 - (0x0000000000000070ull) 89 - #define CVMX_PCIEEP_CFG029 \ 90 - (0x0000000000000074ull) 91 - #define CVMX_PCIEEP_CFG030 \ 92 - (0x0000000000000078ull) 93 - #define CVMX_PCIEEP_CFG031 \ 94 - (0x000000000000007Cull) 95 - #define CVMX_PCIEEP_CFG032 \ 96 - (0x0000000000000080ull) 97 - #define CVMX_PCIEEP_CFG033 \ 98 - (0x0000000000000084ull) 99 - #define CVMX_PCIEEP_CFG034 \ 100 - (0x0000000000000088ull) 101 - #define CVMX_PCIEEP_CFG037 \ 102 - (0x0000000000000094ull) 103 - #define CVMX_PCIEEP_CFG038 \ 104 - (0x0000000000000098ull) 105 - #define CVMX_PCIEEP_CFG039 \ 106 - (0x000000000000009Cull) 107 - #define CVMX_PCIEEP_CFG040 \ 108 - (0x00000000000000A0ull) 109 - #define CVMX_PCIEEP_CFG041 \ 110 - (0x00000000000000A4ull) 111 - #define CVMX_PCIEEP_CFG042 \ 112 - (0x00000000000000A8ull) 113 - #define CVMX_PCIEEP_CFG064 \ 114 - (0x0000000000000100ull) 115 - #define CVMX_PCIEEP_CFG065 \ 116 - (0x0000000000000104ull) 117 - #define CVMX_PCIEEP_CFG066 \ 118 - (0x0000000000000108ull) 119 - #define CVMX_PCIEEP_CFG067 \ 120 - (0x000000000000010Cull) 121 - #define CVMX_PCIEEP_CFG068 \ 122 - (0x0000000000000110ull) 123 - #define CVMX_PCIEEP_CFG069 \ 124 - (0x0000000000000114ull) 125 - #define CVMX_PCIEEP_CFG070 \ 126 - (0x0000000000000118ull) 127 - #define CVMX_PCIEEP_CFG071 \ 128 - (0x000000000000011Cull) 129 - #define CVMX_PCIEEP_CFG072 \ 130 - (0x0000000000000120ull) 131 - #define CVMX_PCIEEP_CFG073 \ 132 - (0x0000000000000124ull) 133 - #define CVMX_PCIEEP_CFG074 \ 134 - (0x0000000000000128ull) 135 - #define CVMX_PCIEEP_CFG448 \ 136 - (0x0000000000000700ull) 137 - #define CVMX_PCIEEP_CFG449 \ 138 - (0x0000000000000704ull) 139 - #define CVMX_PCIEEP_CFG450 \ 140 - (0x0000000000000708ull) 141 - #define CVMX_PCIEEP_CFG451 \ 142 - (0x000000000000070Cull) 143 - #define CVMX_PCIEEP_CFG452 \ 144 - (0x0000000000000710ull) 145 - #define CVMX_PCIEEP_CFG453 \ 146 - (0x0000000000000714ull) 147 - #define CVMX_PCIEEP_CFG454 \ 148 - (0x0000000000000718ull) 149 - #define CVMX_PCIEEP_CFG455 \ 150 - (0x000000000000071Cull) 151 - #define CVMX_PCIEEP_CFG456 \ 152 - (0x0000000000000720ull) 153 - #define CVMX_PCIEEP_CFG458 \ 154 - (0x0000000000000728ull) 155 - #define CVMX_PCIEEP_CFG459 \ 156 - (0x000000000000072Cull) 157 - #define CVMX_PCIEEP_CFG460 \ 158 - (0x0000000000000730ull) 159 - #define CVMX_PCIEEP_CFG461 \ 160 - (0x0000000000000734ull) 161 - #define CVMX_PCIEEP_CFG462 \ 162 - (0x0000000000000738ull) 163 - #define CVMX_PCIEEP_CFG463 \ 164 - (0x000000000000073Cull) 165 - #define CVMX_PCIEEP_CFG464 \ 166 - (0x0000000000000740ull) 167 - #define CVMX_PCIEEP_CFG465 \ 168 - (0x0000000000000744ull) 169 - #define CVMX_PCIEEP_CFG466 \ 170 - (0x0000000000000748ull) 171 - #define CVMX_PCIEEP_CFG467 \ 172 - (0x000000000000074Cull) 173 - #define CVMX_PCIEEP_CFG468 \ 174 - (0x0000000000000750ull) 175 - #define CVMX_PCIEEP_CFG490 \ 176 - (0x00000000000007A8ull) 177 - #define CVMX_PCIEEP_CFG491 \ 178 - (0x00000000000007ACull) 179 - #define CVMX_PCIEEP_CFG492 \ 180 - (0x00000000000007B0ull) 181 - #define CVMX_PCIEEP_CFG516 \ 182 - (0x0000000000000810ull) 183 - #define CVMX_PCIEEP_CFG517 \ 184 - (0x0000000000000814ull) 185 - 186 - union cvmx_pcieep_cfg000 { 187 - uint32_t u32; 188 - struct cvmx_pcieep_cfg000_s { 189 - uint32_t devid:16; 190 - uint32_t vendid:16; 191 - } s; 192 - struct cvmx_pcieep_cfg000_s cn52xx; 193 - struct cvmx_pcieep_cfg000_s cn52xxp1; 194 - struct cvmx_pcieep_cfg000_s cn56xx; 195 - struct cvmx_pcieep_cfg000_s cn56xxp1; 196 - }; 197 - 198 - union cvmx_pcieep_cfg001 { 199 - uint32_t u32; 200 - struct cvmx_pcieep_cfg001_s { 201 - uint32_t dpe:1; 202 - uint32_t sse:1; 203 - uint32_t rma:1; 204 - uint32_t rta:1; 205 - uint32_t sta:1; 206 - uint32_t devt:2; 207 - uint32_t mdpe:1; 208 - uint32_t fbb:1; 209 - uint32_t reserved_22_22:1; 210 - uint32_t m66:1; 211 - uint32_t cl:1; 212 - uint32_t i_stat:1; 213 - uint32_t reserved_11_18:8; 214 - uint32_t i_dis:1; 215 - uint32_t fbbe:1; 216 - uint32_t see:1; 217 - uint32_t ids_wcc:1; 218 - uint32_t per:1; 219 - uint32_t vps:1; 220 - uint32_t mwice:1; 221 - uint32_t scse:1; 222 - uint32_t me:1; 223 - uint32_t msae:1; 224 - uint32_t isae:1; 225 - } s; 226 - struct cvmx_pcieep_cfg001_s cn52xx; 227 - struct cvmx_pcieep_cfg001_s cn52xxp1; 228 - struct cvmx_pcieep_cfg001_s cn56xx; 229 - struct cvmx_pcieep_cfg001_s cn56xxp1; 230 - }; 231 - 232 - union cvmx_pcieep_cfg002 { 233 - uint32_t u32; 234 - struct cvmx_pcieep_cfg002_s { 235 - uint32_t bcc:8; 236 - uint32_t sc:8; 237 - uint32_t pi:8; 238 - uint32_t rid:8; 239 - } s; 240 - struct cvmx_pcieep_cfg002_s cn52xx; 241 - struct cvmx_pcieep_cfg002_s cn52xxp1; 242 - struct cvmx_pcieep_cfg002_s cn56xx; 243 - struct cvmx_pcieep_cfg002_s cn56xxp1; 244 - }; 245 - 246 - union cvmx_pcieep_cfg003 { 247 - uint32_t u32; 248 - struct cvmx_pcieep_cfg003_s { 249 - uint32_t bist:8; 250 - uint32_t mfd:1; 251 - uint32_t chf:7; 252 - uint32_t lt:8; 253 - uint32_t cls:8; 254 - } s; 255 - struct cvmx_pcieep_cfg003_s cn52xx; 256 - struct cvmx_pcieep_cfg003_s cn52xxp1; 257 - struct cvmx_pcieep_cfg003_s cn56xx; 258 - struct cvmx_pcieep_cfg003_s cn56xxp1; 259 - }; 260 - 261 - union cvmx_pcieep_cfg004 { 262 - uint32_t u32; 263 - struct cvmx_pcieep_cfg004_s { 264 - uint32_t lbab:18; 265 - uint32_t reserved_4_13:10; 266 - uint32_t pf:1; 267 - uint32_t typ:2; 268 - uint32_t mspc:1; 269 - } s; 270 - struct cvmx_pcieep_cfg004_s cn52xx; 271 - struct cvmx_pcieep_cfg004_s cn52xxp1; 272 - struct cvmx_pcieep_cfg004_s cn56xx; 273 - struct cvmx_pcieep_cfg004_s cn56xxp1; 274 - }; 275 - 276 - union cvmx_pcieep_cfg004_mask { 277 - uint32_t u32; 278 - struct cvmx_pcieep_cfg004_mask_s { 279 - uint32_t lmask:31; 280 - uint32_t enb:1; 281 - } s; 282 - struct cvmx_pcieep_cfg004_mask_s cn52xx; 283 - struct cvmx_pcieep_cfg004_mask_s cn52xxp1; 284 - struct cvmx_pcieep_cfg004_mask_s cn56xx; 285 - struct cvmx_pcieep_cfg004_mask_s cn56xxp1; 286 - }; 287 - 288 - union cvmx_pcieep_cfg005 { 289 - uint32_t u32; 290 - struct cvmx_pcieep_cfg005_s { 291 - uint32_t ubab:32; 292 - } s; 293 - struct cvmx_pcieep_cfg005_s cn52xx; 294 - struct cvmx_pcieep_cfg005_s cn52xxp1; 295 - struct cvmx_pcieep_cfg005_s cn56xx; 296 - struct cvmx_pcieep_cfg005_s cn56xxp1; 297 - }; 298 - 299 - union cvmx_pcieep_cfg005_mask { 300 - uint32_t u32; 301 - struct cvmx_pcieep_cfg005_mask_s { 302 - uint32_t umask:32; 303 - } s; 304 - struct cvmx_pcieep_cfg005_mask_s cn52xx; 305 - struct cvmx_pcieep_cfg005_mask_s cn52xxp1; 306 - struct cvmx_pcieep_cfg005_mask_s cn56xx; 307 - struct cvmx_pcieep_cfg005_mask_s cn56xxp1; 308 - }; 309 - 310 - union cvmx_pcieep_cfg006 { 311 - uint32_t u32; 312 - struct cvmx_pcieep_cfg006_s { 313 - uint32_t lbab:6; 314 - uint32_t reserved_4_25:22; 315 - uint32_t pf:1; 316 - uint32_t typ:2; 317 - uint32_t mspc:1; 318 - } s; 319 - struct cvmx_pcieep_cfg006_s cn52xx; 320 - struct cvmx_pcieep_cfg006_s cn52xxp1; 321 - struct cvmx_pcieep_cfg006_s cn56xx; 322 - struct cvmx_pcieep_cfg006_s cn56xxp1; 323 - }; 324 - 325 - union cvmx_pcieep_cfg006_mask { 326 - uint32_t u32; 327 - struct cvmx_pcieep_cfg006_mask_s { 328 - uint32_t lmask:31; 329 - uint32_t enb:1; 330 - } s; 331 - struct cvmx_pcieep_cfg006_mask_s cn52xx; 332 - struct cvmx_pcieep_cfg006_mask_s cn52xxp1; 333 - struct cvmx_pcieep_cfg006_mask_s cn56xx; 334 - struct cvmx_pcieep_cfg006_mask_s cn56xxp1; 335 - }; 336 - 337 - union cvmx_pcieep_cfg007 { 338 - uint32_t u32; 339 - struct cvmx_pcieep_cfg007_s { 340 - uint32_t ubab:32; 341 - } s; 342 - struct cvmx_pcieep_cfg007_s cn52xx; 343 - struct cvmx_pcieep_cfg007_s cn52xxp1; 344 - struct cvmx_pcieep_cfg007_s cn56xx; 345 - struct cvmx_pcieep_cfg007_s cn56xxp1; 346 - }; 347 - 348 - union cvmx_pcieep_cfg007_mask { 349 - uint32_t u32; 350 - struct cvmx_pcieep_cfg007_mask_s { 351 - uint32_t umask:32; 352 - } s; 353 - struct cvmx_pcieep_cfg007_mask_s cn52xx; 354 - struct cvmx_pcieep_cfg007_mask_s cn52xxp1; 355 - struct cvmx_pcieep_cfg007_mask_s cn56xx; 356 - struct cvmx_pcieep_cfg007_mask_s cn56xxp1; 357 - }; 358 - 359 - union cvmx_pcieep_cfg008 { 360 - uint32_t u32; 361 - struct cvmx_pcieep_cfg008_s { 362 - uint32_t reserved_4_31:28; 363 - uint32_t pf:1; 364 - uint32_t typ:2; 365 - uint32_t mspc:1; 366 - } s; 367 - struct cvmx_pcieep_cfg008_s cn52xx; 368 - struct cvmx_pcieep_cfg008_s cn52xxp1; 369 - struct cvmx_pcieep_cfg008_s cn56xx; 370 - struct cvmx_pcieep_cfg008_s cn56xxp1; 371 - }; 372 - 373 - union cvmx_pcieep_cfg008_mask { 374 - uint32_t u32; 375 - struct cvmx_pcieep_cfg008_mask_s { 376 - uint32_t lmask:31; 377 - uint32_t enb:1; 378 - } s; 379 - struct cvmx_pcieep_cfg008_mask_s cn52xx; 380 - struct cvmx_pcieep_cfg008_mask_s cn52xxp1; 381 - struct cvmx_pcieep_cfg008_mask_s cn56xx; 382 - struct cvmx_pcieep_cfg008_mask_s cn56xxp1; 383 - }; 384 - 385 - union cvmx_pcieep_cfg009 { 386 - uint32_t u32; 387 - struct cvmx_pcieep_cfg009_s { 388 - uint32_t ubab:25; 389 - uint32_t reserved_0_6:7; 390 - } s; 391 - struct cvmx_pcieep_cfg009_s cn52xx; 392 - struct cvmx_pcieep_cfg009_s cn52xxp1; 393 - struct cvmx_pcieep_cfg009_s cn56xx; 394 - struct cvmx_pcieep_cfg009_s cn56xxp1; 395 - }; 396 - 397 - union cvmx_pcieep_cfg009_mask { 398 - uint32_t u32; 399 - struct cvmx_pcieep_cfg009_mask_s { 400 - uint32_t umask:32; 401 - } s; 402 - struct cvmx_pcieep_cfg009_mask_s cn52xx; 403 - struct cvmx_pcieep_cfg009_mask_s cn52xxp1; 404 - struct cvmx_pcieep_cfg009_mask_s cn56xx; 405 - struct cvmx_pcieep_cfg009_mask_s cn56xxp1; 406 - }; 407 - 408 - union cvmx_pcieep_cfg010 { 409 - uint32_t u32; 410 - struct cvmx_pcieep_cfg010_s { 411 - uint32_t cisp:32; 412 - } s; 413 - struct cvmx_pcieep_cfg010_s cn52xx; 414 - struct cvmx_pcieep_cfg010_s cn52xxp1; 415 - struct cvmx_pcieep_cfg010_s cn56xx; 416 - struct cvmx_pcieep_cfg010_s cn56xxp1; 417 - }; 418 - 419 - union cvmx_pcieep_cfg011 { 420 - uint32_t u32; 421 - struct cvmx_pcieep_cfg011_s { 422 - uint32_t ssid:16; 423 - uint32_t ssvid:16; 424 - } s; 425 - struct cvmx_pcieep_cfg011_s cn52xx; 426 - struct cvmx_pcieep_cfg011_s cn52xxp1; 427 - struct cvmx_pcieep_cfg011_s cn56xx; 428 - struct cvmx_pcieep_cfg011_s cn56xxp1; 429 - }; 430 - 431 - union cvmx_pcieep_cfg012 { 432 - uint32_t u32; 433 - struct cvmx_pcieep_cfg012_s { 434 - uint32_t eraddr:16; 435 - uint32_t reserved_1_15:15; 436 - uint32_t er_en:1; 437 - } s; 438 - struct cvmx_pcieep_cfg012_s cn52xx; 439 - struct cvmx_pcieep_cfg012_s cn52xxp1; 440 - struct cvmx_pcieep_cfg012_s cn56xx; 441 - struct cvmx_pcieep_cfg012_s cn56xxp1; 442 - }; 443 - 444 - union cvmx_pcieep_cfg012_mask { 445 - uint32_t u32; 446 - struct cvmx_pcieep_cfg012_mask_s { 447 - uint32_t mask:31; 448 - uint32_t enb:1; 449 - } s; 450 - struct cvmx_pcieep_cfg012_mask_s cn52xx; 451 - struct cvmx_pcieep_cfg012_mask_s cn52xxp1; 452 - struct cvmx_pcieep_cfg012_mask_s cn56xx; 453 - struct cvmx_pcieep_cfg012_mask_s cn56xxp1; 454 - }; 455 - 456 - union cvmx_pcieep_cfg013 { 457 - uint32_t u32; 458 - struct cvmx_pcieep_cfg013_s { 459 - uint32_t reserved_8_31:24; 460 - uint32_t cp:8; 461 - } s; 462 - struct cvmx_pcieep_cfg013_s cn52xx; 463 - struct cvmx_pcieep_cfg013_s cn52xxp1; 464 - struct cvmx_pcieep_cfg013_s cn56xx; 465 - struct cvmx_pcieep_cfg013_s cn56xxp1; 466 - }; 467 - 468 - union cvmx_pcieep_cfg015 { 469 - uint32_t u32; 470 - struct cvmx_pcieep_cfg015_s { 471 - uint32_t ml:8; 472 - uint32_t mg:8; 473 - uint32_t inta:8; 474 - uint32_t il:8; 475 - } s; 476 - struct cvmx_pcieep_cfg015_s cn52xx; 477 - struct cvmx_pcieep_cfg015_s cn52xxp1; 478 - struct cvmx_pcieep_cfg015_s cn56xx; 479 - struct cvmx_pcieep_cfg015_s cn56xxp1; 480 - }; 481 - 482 - union cvmx_pcieep_cfg016 { 483 - uint32_t u32; 484 - struct cvmx_pcieep_cfg016_s { 485 - uint32_t pmes:5; 486 - uint32_t d2s:1; 487 - uint32_t d1s:1; 488 - uint32_t auxc:3; 489 - uint32_t dsi:1; 490 - uint32_t reserved_20_20:1; 491 - uint32_t pme_clock:1; 492 - uint32_t pmsv:3; 493 - uint32_t ncp:8; 494 - uint32_t pmcid:8; 495 - } s; 496 - struct cvmx_pcieep_cfg016_s cn52xx; 497 - struct cvmx_pcieep_cfg016_s cn52xxp1; 498 - struct cvmx_pcieep_cfg016_s cn56xx; 499 - struct cvmx_pcieep_cfg016_s cn56xxp1; 500 - }; 501 - 502 - union cvmx_pcieep_cfg017 { 503 - uint32_t u32; 504 - struct cvmx_pcieep_cfg017_s { 505 - uint32_t pmdia:8; 506 - uint32_t bpccee:1; 507 - uint32_t bd3h:1; 508 - uint32_t reserved_16_21:6; 509 - uint32_t pmess:1; 510 - uint32_t pmedsia:2; 511 - uint32_t pmds:4; 512 - uint32_t pmeens:1; 513 - uint32_t reserved_4_7:4; 514 - uint32_t nsr:1; 515 - uint32_t reserved_2_2:1; 516 - uint32_t ps:2; 517 - } s; 518 - struct cvmx_pcieep_cfg017_s cn52xx; 519 - struct cvmx_pcieep_cfg017_s cn52xxp1; 520 - struct cvmx_pcieep_cfg017_s cn56xx; 521 - struct cvmx_pcieep_cfg017_s cn56xxp1; 522 - }; 523 - 524 - union cvmx_pcieep_cfg020 { 525 - uint32_t u32; 526 - struct cvmx_pcieep_cfg020_s { 527 - uint32_t reserved_24_31:8; 528 - uint32_t m64:1; 529 - uint32_t mme:3; 530 - uint32_t mmc:3; 531 - uint32_t msien:1; 532 - uint32_t ncp:8; 533 - uint32_t msicid:8; 534 - } s; 535 - struct cvmx_pcieep_cfg020_s cn52xx; 536 - struct cvmx_pcieep_cfg020_s cn52xxp1; 537 - struct cvmx_pcieep_cfg020_s cn56xx; 538 - struct cvmx_pcieep_cfg020_s cn56xxp1; 539 - }; 540 - 541 - union cvmx_pcieep_cfg021 { 542 - uint32_t u32; 543 - struct cvmx_pcieep_cfg021_s { 544 - uint32_t lmsi:30; 545 - uint32_t reserved_0_1:2; 546 - } s; 547 - struct cvmx_pcieep_cfg021_s cn52xx; 548 - struct cvmx_pcieep_cfg021_s cn52xxp1; 549 - struct cvmx_pcieep_cfg021_s cn56xx; 550 - struct cvmx_pcieep_cfg021_s cn56xxp1; 551 - }; 552 - 553 - union cvmx_pcieep_cfg022 { 554 - uint32_t u32; 555 - struct cvmx_pcieep_cfg022_s { 556 - uint32_t umsi:32; 557 - } s; 558 - struct cvmx_pcieep_cfg022_s cn52xx; 559 - struct cvmx_pcieep_cfg022_s cn52xxp1; 560 - struct cvmx_pcieep_cfg022_s cn56xx; 561 - struct cvmx_pcieep_cfg022_s cn56xxp1; 562 - }; 563 - 564 - union cvmx_pcieep_cfg023 { 565 - uint32_t u32; 566 - struct cvmx_pcieep_cfg023_s { 567 - uint32_t reserved_16_31:16; 568 - uint32_t msimd:16; 569 - } s; 570 - struct cvmx_pcieep_cfg023_s cn52xx; 571 - struct cvmx_pcieep_cfg023_s cn52xxp1; 572 - struct cvmx_pcieep_cfg023_s cn56xx; 573 - struct cvmx_pcieep_cfg023_s cn56xxp1; 574 - }; 575 - 576 - union cvmx_pcieep_cfg028 { 577 - uint32_t u32; 578 - struct cvmx_pcieep_cfg028_s { 579 - uint32_t reserved_30_31:2; 580 - uint32_t imn:5; 581 - uint32_t si:1; 582 - uint32_t dpt:4; 583 - uint32_t pciecv:4; 584 - uint32_t ncp:8; 585 - uint32_t pcieid:8; 586 - } s; 587 - struct cvmx_pcieep_cfg028_s cn52xx; 588 - struct cvmx_pcieep_cfg028_s cn52xxp1; 589 - struct cvmx_pcieep_cfg028_s cn56xx; 590 - struct cvmx_pcieep_cfg028_s cn56xxp1; 591 - }; 592 - 593 - union cvmx_pcieep_cfg029 { 594 - uint32_t u32; 595 - struct cvmx_pcieep_cfg029_s { 596 - uint32_t reserved_28_31:4; 597 - uint32_t cspls:2; 598 - uint32_t csplv:8; 599 - uint32_t reserved_16_17:2; 600 - uint32_t rber:1; 601 - uint32_t reserved_12_14:3; 602 - uint32_t el1al:3; 603 - uint32_t el0al:3; 604 - uint32_t etfs:1; 605 - uint32_t pfs:2; 606 - uint32_t mpss:3; 607 - } s; 608 - struct cvmx_pcieep_cfg029_s cn52xx; 609 - struct cvmx_pcieep_cfg029_s cn52xxp1; 610 - struct cvmx_pcieep_cfg029_s cn56xx; 611 - struct cvmx_pcieep_cfg029_s cn56xxp1; 612 - }; 613 - 614 - union cvmx_pcieep_cfg030 { 615 - uint32_t u32; 616 - struct cvmx_pcieep_cfg030_s { 617 - uint32_t reserved_22_31:10; 618 - uint32_t tp:1; 619 - uint32_t ap_d:1; 620 - uint32_t ur_d:1; 621 - uint32_t fe_d:1; 622 - uint32_t nfe_d:1; 623 - uint32_t ce_d:1; 624 - uint32_t reserved_15_15:1; 625 - uint32_t mrrs:3; 626 - uint32_t ns_en:1; 627 - uint32_t ap_en:1; 628 - uint32_t pf_en:1; 629 - uint32_t etf_en:1; 630 - uint32_t mps:3; 631 - uint32_t ro_en:1; 632 - uint32_t ur_en:1; 633 - uint32_t fe_en:1; 634 - uint32_t nfe_en:1; 635 - uint32_t ce_en:1; 636 - } s; 637 - struct cvmx_pcieep_cfg030_s cn52xx; 638 - struct cvmx_pcieep_cfg030_s cn52xxp1; 639 - struct cvmx_pcieep_cfg030_s cn56xx; 640 - struct cvmx_pcieep_cfg030_s cn56xxp1; 641 - }; 642 - 643 - union cvmx_pcieep_cfg031 { 644 - uint32_t u32; 645 - struct cvmx_pcieep_cfg031_s { 646 - uint32_t pnum:8; 647 - uint32_t reserved_22_23:2; 648 - uint32_t lbnc:1; 649 - uint32_t dllarc:1; 650 - uint32_t sderc:1; 651 - uint32_t cpm:1; 652 - uint32_t l1el:3; 653 - uint32_t l0el:3; 654 - uint32_t aslpms:2; 655 - uint32_t mlw:6; 656 - uint32_t mls:4; 657 - } s; 658 - struct cvmx_pcieep_cfg031_s cn52xx; 659 - struct cvmx_pcieep_cfg031_s cn52xxp1; 660 - struct cvmx_pcieep_cfg031_s cn56xx; 661 - struct cvmx_pcieep_cfg031_s cn56xxp1; 662 - }; 663 - 664 - union cvmx_pcieep_cfg032 { 665 - uint32_t u32; 666 - struct cvmx_pcieep_cfg032_s { 667 - uint32_t reserved_30_31:2; 668 - uint32_t dlla:1; 669 - uint32_t scc:1; 670 - uint32_t lt:1; 671 - uint32_t reserved_26_26:1; 672 - uint32_t nlw:6; 673 - uint32_t ls:4; 674 - uint32_t reserved_10_15:6; 675 - uint32_t hawd:1; 676 - uint32_t ecpm:1; 677 - uint32_t es:1; 678 - uint32_t ccc:1; 679 - uint32_t rl:1; 680 - uint32_t ld:1; 681 - uint32_t rcb:1; 682 - uint32_t reserved_2_2:1; 683 - uint32_t aslpc:2; 684 - } s; 685 - struct cvmx_pcieep_cfg032_s cn52xx; 686 - struct cvmx_pcieep_cfg032_s cn52xxp1; 687 - struct cvmx_pcieep_cfg032_s cn56xx; 688 - struct cvmx_pcieep_cfg032_s cn56xxp1; 689 - }; 690 - 691 - union cvmx_pcieep_cfg033 { 692 - uint32_t u32; 693 - struct cvmx_pcieep_cfg033_s { 694 - uint32_t ps_num:13; 695 - uint32_t nccs:1; 696 - uint32_t emip:1; 697 - uint32_t sp_ls:2; 698 - uint32_t sp_lv:8; 699 - uint32_t hp_c:1; 700 - uint32_t hp_s:1; 701 - uint32_t pip:1; 702 - uint32_t aip:1; 703 - uint32_t mrlsp:1; 704 - uint32_t pcp:1; 705 - uint32_t abp:1; 706 - } s; 707 - struct cvmx_pcieep_cfg033_s cn52xx; 708 - struct cvmx_pcieep_cfg033_s cn52xxp1; 709 - struct cvmx_pcieep_cfg033_s cn56xx; 710 - struct cvmx_pcieep_cfg033_s cn56xxp1; 711 - }; 712 - 713 - union cvmx_pcieep_cfg034 { 714 - uint32_t u32; 715 - struct cvmx_pcieep_cfg034_s { 716 - uint32_t reserved_25_31:7; 717 - uint32_t dlls_c:1; 718 - uint32_t emis:1; 719 - uint32_t pds:1; 720 - uint32_t mrlss:1; 721 - uint32_t ccint_d:1; 722 - uint32_t pd_c:1; 723 - uint32_t mrls_c:1; 724 - uint32_t pf_d:1; 725 - uint32_t abp_d:1; 726 - uint32_t reserved_13_15:3; 727 - uint32_t dlls_en:1; 728 - uint32_t emic:1; 729 - uint32_t pcc:1; 730 - uint32_t pic:2; 731 - uint32_t aic:2; 732 - uint32_t hpint_en:1; 733 - uint32_t ccint_en:1; 734 - uint32_t pd_en:1; 735 - uint32_t mrls_en:1; 736 - uint32_t pf_en:1; 737 - uint32_t abp_en:1; 738 - } s; 739 - struct cvmx_pcieep_cfg034_s cn52xx; 740 - struct cvmx_pcieep_cfg034_s cn52xxp1; 741 - struct cvmx_pcieep_cfg034_s cn56xx; 742 - struct cvmx_pcieep_cfg034_s cn56xxp1; 743 - }; 744 - 745 - union cvmx_pcieep_cfg037 { 746 - uint32_t u32; 747 - struct cvmx_pcieep_cfg037_s { 748 - uint32_t reserved_5_31:27; 749 - uint32_t ctds:1; 750 - uint32_t ctrs:4; 751 - } s; 752 - struct cvmx_pcieep_cfg037_s cn52xx; 753 - struct cvmx_pcieep_cfg037_s cn52xxp1; 754 - struct cvmx_pcieep_cfg037_s cn56xx; 755 - struct cvmx_pcieep_cfg037_s cn56xxp1; 756 - }; 757 - 758 - union cvmx_pcieep_cfg038 { 759 - uint32_t u32; 760 - struct cvmx_pcieep_cfg038_s { 761 - uint32_t reserved_5_31:27; 762 - uint32_t ctd:1; 763 - uint32_t ctv:4; 764 - } s; 765 - struct cvmx_pcieep_cfg038_s cn52xx; 766 - struct cvmx_pcieep_cfg038_s cn52xxp1; 767 - struct cvmx_pcieep_cfg038_s cn56xx; 768 - struct cvmx_pcieep_cfg038_s cn56xxp1; 769 - }; 770 - 771 - union cvmx_pcieep_cfg039 { 772 - uint32_t u32; 773 - struct cvmx_pcieep_cfg039_s { 774 - uint32_t reserved_0_31:32; 775 - } s; 776 - struct cvmx_pcieep_cfg039_s cn52xx; 777 - struct cvmx_pcieep_cfg039_s cn52xxp1; 778 - struct cvmx_pcieep_cfg039_s cn56xx; 779 - struct cvmx_pcieep_cfg039_s cn56xxp1; 780 - }; 781 - 782 - union cvmx_pcieep_cfg040 { 783 - uint32_t u32; 784 - struct cvmx_pcieep_cfg040_s { 785 - uint32_t reserved_0_31:32; 786 - } s; 787 - struct cvmx_pcieep_cfg040_s cn52xx; 788 - struct cvmx_pcieep_cfg040_s cn52xxp1; 789 - struct cvmx_pcieep_cfg040_s cn56xx; 790 - struct cvmx_pcieep_cfg040_s cn56xxp1; 791 - }; 792 - 793 - union cvmx_pcieep_cfg041 { 794 - uint32_t u32; 795 - struct cvmx_pcieep_cfg041_s { 796 - uint32_t reserved_0_31:32; 797 - } s; 798 - struct cvmx_pcieep_cfg041_s cn52xx; 799 - struct cvmx_pcieep_cfg041_s cn52xxp1; 800 - struct cvmx_pcieep_cfg041_s cn56xx; 801 - struct cvmx_pcieep_cfg041_s cn56xxp1; 802 - }; 803 - 804 - union cvmx_pcieep_cfg042 { 805 - uint32_t u32; 806 - struct cvmx_pcieep_cfg042_s { 807 - uint32_t reserved_0_31:32; 808 - } s; 809 - struct cvmx_pcieep_cfg042_s cn52xx; 810 - struct cvmx_pcieep_cfg042_s cn52xxp1; 811 - struct cvmx_pcieep_cfg042_s cn56xx; 812 - struct cvmx_pcieep_cfg042_s cn56xxp1; 813 - }; 814 - 815 - union cvmx_pcieep_cfg064 { 816 - uint32_t u32; 817 - struct cvmx_pcieep_cfg064_s { 818 - uint32_t nco:12; 819 - uint32_t cv:4; 820 - uint32_t pcieec:16; 821 - } s; 822 - struct cvmx_pcieep_cfg064_s cn52xx; 823 - struct cvmx_pcieep_cfg064_s cn52xxp1; 824 - struct cvmx_pcieep_cfg064_s cn56xx; 825 - struct cvmx_pcieep_cfg064_s cn56xxp1; 826 - }; 827 - 828 - union cvmx_pcieep_cfg065 { 829 - uint32_t u32; 830 - struct cvmx_pcieep_cfg065_s { 831 - uint32_t reserved_21_31:11; 832 - uint32_t ures:1; 833 - uint32_t ecrces:1; 834 - uint32_t mtlps:1; 835 - uint32_t ros:1; 836 - uint32_t ucs:1; 837 - uint32_t cas:1; 838 - uint32_t cts:1; 839 - uint32_t fcpes:1; 840 - uint32_t ptlps:1; 841 - uint32_t reserved_6_11:6; 842 - uint32_t sdes:1; 843 - uint32_t dlpes:1; 844 - uint32_t reserved_0_3:4; 845 - } s; 846 - struct cvmx_pcieep_cfg065_s cn52xx; 847 - struct cvmx_pcieep_cfg065_s cn52xxp1; 848 - struct cvmx_pcieep_cfg065_s cn56xx; 849 - struct cvmx_pcieep_cfg065_s cn56xxp1; 850 - }; 851 - 852 - union cvmx_pcieep_cfg066 { 853 - uint32_t u32; 854 - struct cvmx_pcieep_cfg066_s { 855 - uint32_t reserved_21_31:11; 856 - uint32_t urem:1; 857 - uint32_t ecrcem:1; 858 - uint32_t mtlpm:1; 859 - uint32_t rom:1; 860 - uint32_t ucm:1; 861 - uint32_t cam:1; 862 - uint32_t ctm:1; 863 - uint32_t fcpem:1; 864 - uint32_t ptlpm:1; 865 - uint32_t reserved_6_11:6; 866 - uint32_t sdem:1; 867 - uint32_t dlpem:1; 868 - uint32_t reserved_0_3:4; 869 - } s; 870 - struct cvmx_pcieep_cfg066_s cn52xx; 871 - struct cvmx_pcieep_cfg066_s cn52xxp1; 872 - struct cvmx_pcieep_cfg066_s cn56xx; 873 - struct cvmx_pcieep_cfg066_s cn56xxp1; 874 - }; 875 - 876 - union cvmx_pcieep_cfg067 { 877 - uint32_t u32; 878 - struct cvmx_pcieep_cfg067_s { 879 - uint32_t reserved_21_31:11; 880 - uint32_t ures:1; 881 - uint32_t ecrces:1; 882 - uint32_t mtlps:1; 883 - uint32_t ros:1; 884 - uint32_t ucs:1; 885 - uint32_t cas:1; 886 - uint32_t cts:1; 887 - uint32_t fcpes:1; 888 - uint32_t ptlps:1; 889 - uint32_t reserved_6_11:6; 890 - uint32_t sdes:1; 891 - uint32_t dlpes:1; 892 - uint32_t reserved_0_3:4; 893 - } s; 894 - struct cvmx_pcieep_cfg067_s cn52xx; 895 - struct cvmx_pcieep_cfg067_s cn52xxp1; 896 - struct cvmx_pcieep_cfg067_s cn56xx; 897 - struct cvmx_pcieep_cfg067_s cn56xxp1; 898 - }; 899 - 900 - union cvmx_pcieep_cfg068 { 901 - uint32_t u32; 902 - struct cvmx_pcieep_cfg068_s { 903 - uint32_t reserved_14_31:18; 904 - uint32_t anfes:1; 905 - uint32_t rtts:1; 906 - uint32_t reserved_9_11:3; 907 - uint32_t rnrs:1; 908 - uint32_t bdllps:1; 909 - uint32_t btlps:1; 910 - uint32_t reserved_1_5:5; 911 - uint32_t res:1; 912 - } s; 913 - struct cvmx_pcieep_cfg068_s cn52xx; 914 - struct cvmx_pcieep_cfg068_s cn52xxp1; 915 - struct cvmx_pcieep_cfg068_s cn56xx; 916 - struct cvmx_pcieep_cfg068_s cn56xxp1; 917 - }; 918 - 919 - union cvmx_pcieep_cfg069 { 920 - uint32_t u32; 921 - struct cvmx_pcieep_cfg069_s { 922 - uint32_t reserved_14_31:18; 923 - uint32_t anfem:1; 924 - uint32_t rttm:1; 925 - uint32_t reserved_9_11:3; 926 - uint32_t rnrm:1; 927 - uint32_t bdllpm:1; 928 - uint32_t btlpm:1; 929 - uint32_t reserved_1_5:5; 930 - uint32_t rem:1; 931 - } s; 932 - struct cvmx_pcieep_cfg069_s cn52xx; 933 - struct cvmx_pcieep_cfg069_s cn52xxp1; 934 - struct cvmx_pcieep_cfg069_s cn56xx; 935 - struct cvmx_pcieep_cfg069_s cn56xxp1; 936 - }; 937 - 938 - union cvmx_pcieep_cfg070 { 939 - uint32_t u32; 940 - struct cvmx_pcieep_cfg070_s { 941 - uint32_t reserved_9_31:23; 942 - uint32_t ce:1; 943 - uint32_t cc:1; 944 - uint32_t ge:1; 945 - uint32_t gc:1; 946 - uint32_t fep:5; 947 - } s; 948 - struct cvmx_pcieep_cfg070_s cn52xx; 949 - struct cvmx_pcieep_cfg070_s cn52xxp1; 950 - struct cvmx_pcieep_cfg070_s cn56xx; 951 - struct cvmx_pcieep_cfg070_s cn56xxp1; 952 - }; 953 - 954 - union cvmx_pcieep_cfg071 { 955 - uint32_t u32; 956 - struct cvmx_pcieep_cfg071_s { 957 - uint32_t dword1:32; 958 - } s; 959 - struct cvmx_pcieep_cfg071_s cn52xx; 960 - struct cvmx_pcieep_cfg071_s cn52xxp1; 961 - struct cvmx_pcieep_cfg071_s cn56xx; 962 - struct cvmx_pcieep_cfg071_s cn56xxp1; 963 - }; 964 - 965 - union cvmx_pcieep_cfg072 { 966 - uint32_t u32; 967 - struct cvmx_pcieep_cfg072_s { 968 - uint32_t dword2:32; 969 - } s; 970 - struct cvmx_pcieep_cfg072_s cn52xx; 971 - struct cvmx_pcieep_cfg072_s cn52xxp1; 972 - struct cvmx_pcieep_cfg072_s cn56xx; 973 - struct cvmx_pcieep_cfg072_s cn56xxp1; 974 - }; 975 - 976 - union cvmx_pcieep_cfg073 { 977 - uint32_t u32; 978 - struct cvmx_pcieep_cfg073_s { 979 - uint32_t dword3:32; 980 - } s; 981 - struct cvmx_pcieep_cfg073_s cn52xx; 982 - struct cvmx_pcieep_cfg073_s cn52xxp1; 983 - struct cvmx_pcieep_cfg073_s cn56xx; 984 - struct cvmx_pcieep_cfg073_s cn56xxp1; 985 - }; 986 - 987 - union cvmx_pcieep_cfg074 { 988 - uint32_t u32; 989 - struct cvmx_pcieep_cfg074_s { 990 - uint32_t dword4:32; 991 - } s; 992 - struct cvmx_pcieep_cfg074_s cn52xx; 993 - struct cvmx_pcieep_cfg074_s cn52xxp1; 994 - struct cvmx_pcieep_cfg074_s cn56xx; 995 - struct cvmx_pcieep_cfg074_s cn56xxp1; 996 - }; 997 - 998 - union cvmx_pcieep_cfg448 { 999 - uint32_t u32; 1000 - struct cvmx_pcieep_cfg448_s { 1001 - uint32_t rtl:16; 1002 - uint32_t rtltl:16; 1003 - } s; 1004 - struct cvmx_pcieep_cfg448_s cn52xx; 1005 - struct cvmx_pcieep_cfg448_s cn52xxp1; 1006 - struct cvmx_pcieep_cfg448_s cn56xx; 1007 - struct cvmx_pcieep_cfg448_s cn56xxp1; 1008 - }; 1009 - 1010 - union cvmx_pcieep_cfg449 { 1011 - uint32_t u32; 1012 - struct cvmx_pcieep_cfg449_s { 1013 - uint32_t omr:32; 1014 - } s; 1015 - struct cvmx_pcieep_cfg449_s cn52xx; 1016 - struct cvmx_pcieep_cfg449_s cn52xxp1; 1017 - struct cvmx_pcieep_cfg449_s cn56xx; 1018 - struct cvmx_pcieep_cfg449_s cn56xxp1; 1019 - }; 1020 - 1021 - union cvmx_pcieep_cfg450 { 1022 - uint32_t u32; 1023 - struct cvmx_pcieep_cfg450_s { 1024 - uint32_t lpec:8; 1025 - uint32_t reserved_22_23:2; 1026 - uint32_t link_state:6; 1027 - uint32_t force_link:1; 1028 - uint32_t reserved_8_14:7; 1029 - uint32_t link_num:8; 1030 - } s; 1031 - struct cvmx_pcieep_cfg450_s cn52xx; 1032 - struct cvmx_pcieep_cfg450_s cn52xxp1; 1033 - struct cvmx_pcieep_cfg450_s cn56xx; 1034 - struct cvmx_pcieep_cfg450_s cn56xxp1; 1035 - }; 1036 - 1037 - union cvmx_pcieep_cfg451 { 1038 - uint32_t u32; 1039 - struct cvmx_pcieep_cfg451_s { 1040 - uint32_t reserved_30_31:2; 1041 - uint32_t l1el:3; 1042 - uint32_t l0el:3; 1043 - uint32_t n_fts_cc:8; 1044 - uint32_t n_fts:8; 1045 - uint32_t ack_freq:8; 1046 - } s; 1047 - struct cvmx_pcieep_cfg451_s cn52xx; 1048 - struct cvmx_pcieep_cfg451_s cn52xxp1; 1049 - struct cvmx_pcieep_cfg451_s cn56xx; 1050 - struct cvmx_pcieep_cfg451_s cn56xxp1; 1051 - }; 1052 - 1053 - union cvmx_pcieep_cfg452 { 1054 - uint32_t u32; 1055 - struct cvmx_pcieep_cfg452_s { 1056 - uint32_t reserved_26_31:6; 1057 - uint32_t eccrc:1; 1058 - uint32_t reserved_22_24:3; 1059 - uint32_t lme:6; 1060 - uint32_t reserved_8_15:8; 1061 - uint32_t flm:1; 1062 - uint32_t reserved_6_6:1; 1063 - uint32_t dllle:1; 1064 - uint32_t reserved_4_4:1; 1065 - uint32_t ra:1; 1066 - uint32_t le:1; 1067 - uint32_t sd:1; 1068 - uint32_t omr:1; 1069 - } s; 1070 - struct cvmx_pcieep_cfg452_s cn52xx; 1071 - struct cvmx_pcieep_cfg452_s cn52xxp1; 1072 - struct cvmx_pcieep_cfg452_s cn56xx; 1073 - struct cvmx_pcieep_cfg452_s cn56xxp1; 1074 - }; 1075 - 1076 - union cvmx_pcieep_cfg453 { 1077 - uint32_t u32; 1078 - struct cvmx_pcieep_cfg453_s { 1079 - uint32_t dlld:1; 1080 - uint32_t reserved_26_30:5; 1081 - uint32_t ack_nak:1; 1082 - uint32_t fcd:1; 1083 - uint32_t ilst:24; 1084 - } s; 1085 - struct cvmx_pcieep_cfg453_s cn52xx; 1086 - struct cvmx_pcieep_cfg453_s cn52xxp1; 1087 - struct cvmx_pcieep_cfg453_s cn56xx; 1088 - struct cvmx_pcieep_cfg453_s cn56xxp1; 1089 - }; 1090 - 1091 - union cvmx_pcieep_cfg454 { 1092 - uint32_t u32; 1093 - struct cvmx_pcieep_cfg454_s { 1094 - uint32_t reserved_29_31:3; 1095 - uint32_t tmfcwt:5; 1096 - uint32_t tmanlt:5; 1097 - uint32_t tmrt:5; 1098 - uint32_t reserved_11_13:3; 1099 - uint32_t nskps:3; 1100 - uint32_t reserved_4_7:4; 1101 - uint32_t ntss:4; 1102 - } s; 1103 - struct cvmx_pcieep_cfg454_s cn52xx; 1104 - struct cvmx_pcieep_cfg454_s cn52xxp1; 1105 - struct cvmx_pcieep_cfg454_s cn56xx; 1106 - struct cvmx_pcieep_cfg454_s cn56xxp1; 1107 - }; 1108 - 1109 - union cvmx_pcieep_cfg455 { 1110 - uint32_t u32; 1111 - struct cvmx_pcieep_cfg455_s { 1112 - uint32_t m_cfg0_filt:1; 1113 - uint32_t m_io_filt:1; 1114 - uint32_t msg_ctrl:1; 1115 - uint32_t m_cpl_ecrc_filt:1; 1116 - uint32_t m_ecrc_filt:1; 1117 - uint32_t m_cpl_len_err:1; 1118 - uint32_t m_cpl_attr_err:1; 1119 - uint32_t m_cpl_tc_err:1; 1120 - uint32_t m_cpl_fun_err:1; 1121 - uint32_t m_cpl_rid_err:1; 1122 - uint32_t m_cpl_tag_err:1; 1123 - uint32_t m_lk_filt:1; 1124 - uint32_t m_cfg1_filt:1; 1125 - uint32_t m_bar_match:1; 1126 - uint32_t m_pois_filt:1; 1127 - uint32_t m_fun:1; 1128 - uint32_t dfcwt:1; 1129 - uint32_t reserved_11_14:4; 1130 - uint32_t skpiv:11; 1131 - } s; 1132 - struct cvmx_pcieep_cfg455_s cn52xx; 1133 - struct cvmx_pcieep_cfg455_s cn52xxp1; 1134 - struct cvmx_pcieep_cfg455_s cn56xx; 1135 - struct cvmx_pcieep_cfg455_s cn56xxp1; 1136 - }; 1137 - 1138 - union cvmx_pcieep_cfg456 { 1139 - uint32_t u32; 1140 - struct cvmx_pcieep_cfg456_s { 1141 - uint32_t reserved_2_31:30; 1142 - uint32_t m_vend1_drp:1; 1143 - uint32_t m_vend0_drp:1; 1144 - } s; 1145 - struct cvmx_pcieep_cfg456_s cn52xx; 1146 - struct cvmx_pcieep_cfg456_s cn52xxp1; 1147 - struct cvmx_pcieep_cfg456_s cn56xx; 1148 - struct cvmx_pcieep_cfg456_s cn56xxp1; 1149 - }; 1150 - 1151 - union cvmx_pcieep_cfg458 { 1152 - uint32_t u32; 1153 - struct cvmx_pcieep_cfg458_s { 1154 - uint32_t dbg_info_l32:32; 1155 - } s; 1156 - struct cvmx_pcieep_cfg458_s cn52xx; 1157 - struct cvmx_pcieep_cfg458_s cn52xxp1; 1158 - struct cvmx_pcieep_cfg458_s cn56xx; 1159 - struct cvmx_pcieep_cfg458_s cn56xxp1; 1160 - }; 1161 - 1162 - union cvmx_pcieep_cfg459 { 1163 - uint32_t u32; 1164 - struct cvmx_pcieep_cfg459_s { 1165 - uint32_t dbg_info_u32:32; 1166 - } s; 1167 - struct cvmx_pcieep_cfg459_s cn52xx; 1168 - struct cvmx_pcieep_cfg459_s cn52xxp1; 1169 - struct cvmx_pcieep_cfg459_s cn56xx; 1170 - struct cvmx_pcieep_cfg459_s cn56xxp1; 1171 - }; 1172 - 1173 - union cvmx_pcieep_cfg460 { 1174 - uint32_t u32; 1175 - struct cvmx_pcieep_cfg460_s { 1176 - uint32_t reserved_20_31:12; 1177 - uint32_t tphfcc:8; 1178 - uint32_t tpdfcc:12; 1179 - } s; 1180 - struct cvmx_pcieep_cfg460_s cn52xx; 1181 - struct cvmx_pcieep_cfg460_s cn52xxp1; 1182 - struct cvmx_pcieep_cfg460_s cn56xx; 1183 - struct cvmx_pcieep_cfg460_s cn56xxp1; 1184 - }; 1185 - 1186 - union cvmx_pcieep_cfg461 { 1187 - uint32_t u32; 1188 - struct cvmx_pcieep_cfg461_s { 1189 - uint32_t reserved_20_31:12; 1190 - uint32_t tchfcc:8; 1191 - uint32_t tcdfcc:12; 1192 - } s; 1193 - struct cvmx_pcieep_cfg461_s cn52xx; 1194 - struct cvmx_pcieep_cfg461_s cn52xxp1; 1195 - struct cvmx_pcieep_cfg461_s cn56xx; 1196 - struct cvmx_pcieep_cfg461_s cn56xxp1; 1197 - }; 1198 - 1199 - union cvmx_pcieep_cfg462 { 1200 - uint32_t u32; 1201 - struct cvmx_pcieep_cfg462_s { 1202 - uint32_t reserved_20_31:12; 1203 - uint32_t tchfcc:8; 1204 - uint32_t tcdfcc:12; 1205 - } s; 1206 - struct cvmx_pcieep_cfg462_s cn52xx; 1207 - struct cvmx_pcieep_cfg462_s cn52xxp1; 1208 - struct cvmx_pcieep_cfg462_s cn56xx; 1209 - struct cvmx_pcieep_cfg462_s cn56xxp1; 1210 - }; 1211 - 1212 - union cvmx_pcieep_cfg463 { 1213 - uint32_t u32; 1214 - struct cvmx_pcieep_cfg463_s { 1215 - uint32_t reserved_3_31:29; 1216 - uint32_t rqne:1; 1217 - uint32_t trbne:1; 1218 - uint32_t rtlpfccnr:1; 1219 - } s; 1220 - struct cvmx_pcieep_cfg463_s cn52xx; 1221 - struct cvmx_pcieep_cfg463_s cn52xxp1; 1222 - struct cvmx_pcieep_cfg463_s cn56xx; 1223 - struct cvmx_pcieep_cfg463_s cn56xxp1; 1224 - }; 1225 - 1226 - union cvmx_pcieep_cfg464 { 1227 - uint32_t u32; 1228 - struct cvmx_pcieep_cfg464_s { 1229 - uint32_t wrr_vc3:8; 1230 - uint32_t wrr_vc2:8; 1231 - uint32_t wrr_vc1:8; 1232 - uint32_t wrr_vc0:8; 1233 - } s; 1234 - struct cvmx_pcieep_cfg464_s cn52xx; 1235 - struct cvmx_pcieep_cfg464_s cn52xxp1; 1236 - struct cvmx_pcieep_cfg464_s cn56xx; 1237 - struct cvmx_pcieep_cfg464_s cn56xxp1; 1238 - }; 1239 - 1240 - union cvmx_pcieep_cfg465 { 1241 - uint32_t u32; 1242 - struct cvmx_pcieep_cfg465_s { 1243 - uint32_t wrr_vc7:8; 1244 - uint32_t wrr_vc6:8; 1245 - uint32_t wrr_vc5:8; 1246 - uint32_t wrr_vc4:8; 1247 - } s; 1248 - struct cvmx_pcieep_cfg465_s cn52xx; 1249 - struct cvmx_pcieep_cfg465_s cn52xxp1; 1250 - struct cvmx_pcieep_cfg465_s cn56xx; 1251 - struct cvmx_pcieep_cfg465_s cn56xxp1; 1252 - }; 1253 - 1254 - union cvmx_pcieep_cfg466 { 1255 - uint32_t u32; 1256 - struct cvmx_pcieep_cfg466_s { 1257 - uint32_t rx_queue_order:1; 1258 - uint32_t type_ordering:1; 1259 - uint32_t reserved_24_29:6; 1260 - uint32_t queue_mode:3; 1261 - uint32_t reserved_20_20:1; 1262 - uint32_t header_credits:8; 1263 - uint32_t data_credits:12; 1264 - } s; 1265 - struct cvmx_pcieep_cfg466_s cn52xx; 1266 - struct cvmx_pcieep_cfg466_s cn52xxp1; 1267 - struct cvmx_pcieep_cfg466_s cn56xx; 1268 - struct cvmx_pcieep_cfg466_s cn56xxp1; 1269 - }; 1270 - 1271 - union cvmx_pcieep_cfg467 { 1272 - uint32_t u32; 1273 - struct cvmx_pcieep_cfg467_s { 1274 - uint32_t reserved_24_31:8; 1275 - uint32_t queue_mode:3; 1276 - uint32_t reserved_20_20:1; 1277 - uint32_t header_credits:8; 1278 - uint32_t data_credits:12; 1279 - } s; 1280 - struct cvmx_pcieep_cfg467_s cn52xx; 1281 - struct cvmx_pcieep_cfg467_s cn52xxp1; 1282 - struct cvmx_pcieep_cfg467_s cn56xx; 1283 - struct cvmx_pcieep_cfg467_s cn56xxp1; 1284 - }; 1285 - 1286 - union cvmx_pcieep_cfg468 { 1287 - uint32_t u32; 1288 - struct cvmx_pcieep_cfg468_s { 1289 - uint32_t reserved_24_31:8; 1290 - uint32_t queue_mode:3; 1291 - uint32_t reserved_20_20:1; 1292 - uint32_t header_credits:8; 1293 - uint32_t data_credits:12; 1294 - } s; 1295 - struct cvmx_pcieep_cfg468_s cn52xx; 1296 - struct cvmx_pcieep_cfg468_s cn52xxp1; 1297 - struct cvmx_pcieep_cfg468_s cn56xx; 1298 - struct cvmx_pcieep_cfg468_s cn56xxp1; 1299 - }; 1300 - 1301 - union cvmx_pcieep_cfg490 { 1302 - uint32_t u32; 1303 - struct cvmx_pcieep_cfg490_s { 1304 - uint32_t reserved_26_31:6; 1305 - uint32_t header_depth:10; 1306 - uint32_t reserved_14_15:2; 1307 - uint32_t data_depth:14; 1308 - } s; 1309 - struct cvmx_pcieep_cfg490_s cn52xx; 1310 - struct cvmx_pcieep_cfg490_s cn52xxp1; 1311 - struct cvmx_pcieep_cfg490_s cn56xx; 1312 - struct cvmx_pcieep_cfg490_s cn56xxp1; 1313 - }; 1314 - 1315 - union cvmx_pcieep_cfg491 { 1316 - uint32_t u32; 1317 - struct cvmx_pcieep_cfg491_s { 1318 - uint32_t reserved_26_31:6; 1319 - uint32_t header_depth:10; 1320 - uint32_t reserved_14_15:2; 1321 - uint32_t data_depth:14; 1322 - } s; 1323 - struct cvmx_pcieep_cfg491_s cn52xx; 1324 - struct cvmx_pcieep_cfg491_s cn52xxp1; 1325 - struct cvmx_pcieep_cfg491_s cn56xx; 1326 - struct cvmx_pcieep_cfg491_s cn56xxp1; 1327 - }; 1328 - 1329 - union cvmx_pcieep_cfg492 { 1330 - uint32_t u32; 1331 - struct cvmx_pcieep_cfg492_s { 1332 - uint32_t reserved_26_31:6; 1333 - uint32_t header_depth:10; 1334 - uint32_t reserved_14_15:2; 1335 - uint32_t data_depth:14; 1336 - } s; 1337 - struct cvmx_pcieep_cfg492_s cn52xx; 1338 - struct cvmx_pcieep_cfg492_s cn52xxp1; 1339 - struct cvmx_pcieep_cfg492_s cn56xx; 1340 - struct cvmx_pcieep_cfg492_s cn56xxp1; 1341 - }; 1342 - 1343 - union cvmx_pcieep_cfg516 { 1344 - uint32_t u32; 1345 - struct cvmx_pcieep_cfg516_s { 1346 - uint32_t phy_stat:32; 1347 - } s; 1348 - struct cvmx_pcieep_cfg516_s cn52xx; 1349 - struct cvmx_pcieep_cfg516_s cn52xxp1; 1350 - struct cvmx_pcieep_cfg516_s cn56xx; 1351 - struct cvmx_pcieep_cfg516_s cn56xxp1; 1352 - }; 1353 - 1354 - union cvmx_pcieep_cfg517 { 1355 - uint32_t u32; 1356 - struct cvmx_pcieep_cfg517_s { 1357 - uint32_t phy_ctrl:32; 1358 - } s; 1359 - struct cvmx_pcieep_cfg517_s cn52xx; 1360 - struct cvmx_pcieep_cfg517_s cn52xxp1; 1361 - struct cvmx_pcieep_cfg517_s cn56xx; 1362 - struct cvmx_pcieep_cfg517_s cn56xxp1; 1363 - }; 1364 - 1365 - #endif
+6
arch/mips/include/asm/pci.h
··· 17 17 */ 18 18 19 19 #include <linux/ioport.h> 20 + #include <linux/of.h> 20 21 21 22 /* 22 23 * Each pci channel is a top-level PCI bus seem by CPU. A machine with ··· 27 26 struct pci_controller { 28 27 struct pci_controller *next; 29 28 struct pci_bus *bus; 29 + struct device_node *of_node; 30 30 31 31 struct pci_ops *pci_ops; 32 32 struct resource *mem_resource; ··· 143 141 #endif 144 142 145 143 extern char * (*pcibios_plat_setup)(char *str); 144 + 145 + /* this function parses memory ranges from a device node */ 146 + extern void __devinit pci_load_of_ranges(struct pci_controller *hose, 147 + struct device_node *node); 146 148 147 149 #endif /* _ASM_PCI_H */
+26
arch/mips/include/asm/prom.h
··· 12 12 #define __ASM_PROM_H 13 13 14 14 #ifdef CONFIG_OF 15 + #include <linux/bug.h> 16 + #include <linux/io.h> 17 + #include <linux/types.h> 15 18 #include <asm/bootinfo.h> 16 19 17 20 extern int early_init_dt_scan_memory_arch(unsigned long node, ··· 24 21 extern void free_mem_mach(unsigned long addr, unsigned long size); 25 22 26 23 extern void device_tree_init(void); 24 + 25 + static inline unsigned long pci_address_to_pio(phys_addr_t address) 26 + { 27 + /* 28 + * The ioport address can be directly used by inX() / outX() 29 + */ 30 + BUG_ON(address > IO_SPACE_LIMIT); 31 + 32 + return (unsigned long) address; 33 + } 34 + #define pci_address_to_pio pci_address_to_pio 35 + 36 + struct boot_param_header; 37 + 38 + extern void __dt_setup_arch(struct boot_param_header *bph); 39 + 40 + #define dt_setup_arch(sym) \ 41 + ({ \ 42 + extern struct boot_param_header __dtb_##sym##_begin; \ 43 + \ 44 + __dt_setup_arch(&__dtb_##sym##_begin); \ 45 + }) 46 + 27 47 #else /* CONFIG_OF */ 28 48 static inline void device_tree_init(void) { } 29 49 #endif /* CONFIG_OF */
+2 -1
arch/mips/include/asm/setup.h
··· 14 14 15 15 extern void *set_except_vector(int n, void *addr); 16 16 extern unsigned long ebase; 17 - extern void per_cpu_trap_init(void); 17 + extern void per_cpu_trap_init(bool); 18 + extern void cpu_cache_init(void); 18 19 19 20 #endif /* __KERNEL__ */ 20 21
+5 -1
arch/mips/include/asm/sparsemem.h
··· 6 6 * SECTION_SIZE_BITS 2^N: how big each section will be 7 7 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space 8 8 */ 9 - #define SECTION_SIZE_BITS 28 9 + #if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_PAGE_SIZE_64KB) 10 + # define SECTION_SIZE_BITS 29 11 + #else 12 + # define SECTION_SIZE_BITS 28 13 + #endif 10 14 #define MAX_PHYSMEM_BITS 35 11 15 12 16 #endif /* CONFIG_SPARSEMEM */
+1 -1
arch/mips/include/asm/termios.h
··· 60 60 }; 61 61 62 62 #ifdef __KERNEL__ 63 - #include <linux/module.h> 63 + #include <asm/uaccess.h> 64 64 65 65 /* 66 66 * intr=^C quit=^\ erase=del kill=^U
+1
arch/mips/include/asm/traps.h
··· 25 25 extern void (*board_ejtag_handler_setup)(void); 26 26 extern void (*board_bind_eic_interrupt)(int irq, int regset); 27 27 extern void (*board_ebase_setup)(void); 28 + extern void (*board_cache_error_setup)(void); 28 29 29 30 extern int register_nmi_notifier(struct notifier_block *nb); 30 31
+1 -1
arch/mips/include/asm/uasm.h
··· 11 11 #include <linux/types.h> 12 12 13 13 #ifdef CONFIG_EXPORT_UASM 14 - #include <linux/module.h> 14 + #include <linux/export.h> 15 15 #define __uasminit 16 16 #define __uasminitdata 17 17 #define UASM_EXPORT_SYMBOL(sym) EXPORT_SYMBOL(sym)
-2
arch/mips/jz4740/Makefile
··· 16 16 # PM support 17 17 18 18 obj-$(CONFIG_PM) += pm.o 19 - 20 - ccflags-y := -Werror -Wall
+27 -27
arch/mips/kernel/cpu-probe.c
··· 340 340 __cpu_name[cpu] = "R2000"; 341 341 c->isa_level = MIPS_CPU_ISA_I; 342 342 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | 343 - MIPS_CPU_NOFPUEX; 343 + MIPS_CPU_NOFPUEX; 344 344 if (__cpu_has_fpu()) 345 345 c->options |= MIPS_CPU_FPU; 346 346 c->tlbsize = 64; ··· 361 361 } 362 362 c->isa_level = MIPS_CPU_ISA_I; 363 363 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | 364 - MIPS_CPU_NOFPUEX; 364 + MIPS_CPU_NOFPUEX; 365 365 if (__cpu_has_fpu()) 366 366 c->options |= MIPS_CPU_FPU; 367 367 c->tlbsize = 64; ··· 387 387 388 388 c->isa_level = MIPS_CPU_ISA_III; 389 389 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 390 - MIPS_CPU_WATCH | MIPS_CPU_VCE | 391 - MIPS_CPU_LLSC; 390 + MIPS_CPU_WATCH | MIPS_CPU_VCE | 391 + MIPS_CPU_LLSC; 392 392 c->tlbsize = 48; 393 393 break; 394 394 case PRID_IMP_VR41XX: ··· 434 434 __cpu_name[cpu] = "R4300"; 435 435 c->isa_level = MIPS_CPU_ISA_III; 436 436 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 437 - MIPS_CPU_LLSC; 437 + MIPS_CPU_LLSC; 438 438 c->tlbsize = 32; 439 439 break; 440 440 case PRID_IMP_R4600: ··· 446 446 c->tlbsize = 48; 447 447 break; 448 448 #if 0 449 - case PRID_IMP_R4650: 449 + case PRID_IMP_R4650: 450 450 /* 451 451 * This processor doesn't have an MMU, so it's not 452 452 * "real easy" to run Linux on it. It is left purely ··· 455 455 */ 456 456 c->cputype = CPU_R4650; 457 457 __cpu_name[cpu] = "R4650"; 458 - c->isa_level = MIPS_CPU_ISA_III; 458 + c->isa_level = MIPS_CPU_ISA_III; 459 459 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_LLSC; 460 - c->tlbsize = 48; 460 + c->tlbsize = 48; 461 461 break; 462 462 #endif 463 463 case PRID_IMP_TX39: ··· 488 488 __cpu_name[cpu] = "R4700"; 489 489 c->isa_level = MIPS_CPU_ISA_III; 490 490 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 491 - MIPS_CPU_LLSC; 491 + MIPS_CPU_LLSC; 492 492 c->tlbsize = 48; 493 493 break; 494 494 case PRID_IMP_TX49: ··· 505 505 __cpu_name[cpu] = "R5000"; 506 506 c->isa_level = MIPS_CPU_ISA_IV; 507 507 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 508 - MIPS_CPU_LLSC; 508 + MIPS_CPU_LLSC; 509 509 c->tlbsize = 48; 510 510 break; 511 511 case PRID_IMP_R5432: ··· 513 513 __cpu_name[cpu] = "R5432"; 514 514 c->isa_level = MIPS_CPU_ISA_IV; 515 515 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 516 - MIPS_CPU_WATCH | MIPS_CPU_LLSC; 516 + MIPS_CPU_WATCH | MIPS_CPU_LLSC; 517 517 c->tlbsize = 48; 518 518 break; 519 519 case PRID_IMP_R5500: ··· 521 521 __cpu_name[cpu] = "R5500"; 522 522 c->isa_level = MIPS_CPU_ISA_IV; 523 523 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 524 - MIPS_CPU_WATCH | MIPS_CPU_LLSC; 524 + MIPS_CPU_WATCH | MIPS_CPU_LLSC; 525 525 c->tlbsize = 48; 526 526 break; 527 527 case PRID_IMP_NEVADA: ··· 529 529 __cpu_name[cpu] = "Nevada"; 530 530 c->isa_level = MIPS_CPU_ISA_IV; 531 531 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 532 - MIPS_CPU_DIVEC | MIPS_CPU_LLSC; 532 + MIPS_CPU_DIVEC | MIPS_CPU_LLSC; 533 533 c->tlbsize = 48; 534 534 break; 535 535 case PRID_IMP_R6000: ··· 537 537 __cpu_name[cpu] = "R6000"; 538 538 c->isa_level = MIPS_CPU_ISA_II; 539 539 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU | 540 - MIPS_CPU_LLSC; 540 + MIPS_CPU_LLSC; 541 541 c->tlbsize = 32; 542 542 break; 543 543 case PRID_IMP_R6000A: ··· 545 545 __cpu_name[cpu] = "R6000A"; 546 546 c->isa_level = MIPS_CPU_ISA_II; 547 547 c->options = MIPS_CPU_TLB | MIPS_CPU_FPU | 548 - MIPS_CPU_LLSC; 548 + MIPS_CPU_LLSC; 549 549 c->tlbsize = 32; 550 550 break; 551 551 case PRID_IMP_RM7000: ··· 553 553 __cpu_name[cpu] = "RM7000"; 554 554 c->isa_level = MIPS_CPU_ISA_IV; 555 555 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 556 - MIPS_CPU_LLSC; 556 + MIPS_CPU_LLSC; 557 557 /* 558 558 * Undocumented RM7000: Bit 29 in the info register of 559 559 * the RM7000 v2.0 indicates if the TLB has 48 or 64 ··· 569 569 __cpu_name[cpu] = "RM9000"; 570 570 c->isa_level = MIPS_CPU_ISA_IV; 571 571 c->options = R4K_OPTS | MIPS_CPU_FPU | MIPS_CPU_32FPR | 572 - MIPS_CPU_LLSC; 572 + MIPS_CPU_LLSC; 573 573 /* 574 574 * Bit 29 in the info register of the RM9000 575 575 * indicates if the TLB has 48 or 64 entries. ··· 584 584 __cpu_name[cpu] = "RM8000"; 585 585 c->isa_level = MIPS_CPU_ISA_IV; 586 586 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | 587 - MIPS_CPU_FPU | MIPS_CPU_32FPR | 588 - MIPS_CPU_LLSC; 587 + MIPS_CPU_FPU | MIPS_CPU_32FPR | 588 + MIPS_CPU_LLSC; 589 589 c->tlbsize = 384; /* has weird TLB: 3-way x 128 */ 590 590 break; 591 591 case PRID_IMP_R10000: ··· 593 593 __cpu_name[cpu] = "R10000"; 594 594 c->isa_level = MIPS_CPU_ISA_IV; 595 595 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | 596 - MIPS_CPU_FPU | MIPS_CPU_32FPR | 596 + MIPS_CPU_FPU | MIPS_CPU_32FPR | 597 597 MIPS_CPU_COUNTER | MIPS_CPU_WATCH | 598 - MIPS_CPU_LLSC; 598 + MIPS_CPU_LLSC; 599 599 c->tlbsize = 64; 600 600 break; 601 601 case PRID_IMP_R12000: ··· 603 603 __cpu_name[cpu] = "R12000"; 604 604 c->isa_level = MIPS_CPU_ISA_IV; 605 605 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | 606 - MIPS_CPU_FPU | MIPS_CPU_32FPR | 606 + MIPS_CPU_FPU | MIPS_CPU_32FPR | 607 607 MIPS_CPU_COUNTER | MIPS_CPU_WATCH | 608 - MIPS_CPU_LLSC; 608 + MIPS_CPU_LLSC; 609 609 c->tlbsize = 64; 610 610 break; 611 611 case PRID_IMP_R14000: ··· 613 613 __cpu_name[cpu] = "R14000"; 614 614 c->isa_level = MIPS_CPU_ISA_IV; 615 615 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX | 616 - MIPS_CPU_FPU | MIPS_CPU_32FPR | 616 + MIPS_CPU_FPU | MIPS_CPU_32FPR | 617 617 MIPS_CPU_COUNTER | MIPS_CPU_WATCH | 618 - MIPS_CPU_LLSC; 618 + MIPS_CPU_LLSC; 619 619 c->tlbsize = 64; 620 620 break; 621 621 case PRID_IMP_LOONGSON2: ··· 739 739 if (config3 & MIPS_CONF3_VEIC) 740 740 c->options |= MIPS_CPU_VEIC; 741 741 if (config3 & MIPS_CONF3_MT) 742 - c->ases |= MIPS_ASE_MIPSMT; 742 + c->ases |= MIPS_ASE_MIPSMT; 743 743 if (config3 & MIPS_CONF3_ULRI) 744 744 c->options |= MIPS_CPU_ULRI; 745 745 ··· 767 767 768 768 /* MIPS32 or MIPS64 compliant CPU. */ 769 769 c->options = MIPS_CPU_4KEX | MIPS_CPU_4K_CACHE | MIPS_CPU_COUNTER | 770 - MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK; 770 + MIPS_CPU_DIVEC | MIPS_CPU_LLSC | MIPS_CPU_MCHECK; 771 771 772 772 c->scache.flags = MIPS_CACHE_NOT_PRESENT; 773 773
+2 -1
arch/mips/kernel/perf_event_mipsxx.c
··· 1532 1532 irq = MSC01E_INT_BASE + MSC01E_INT_PERFCTR; 1533 1533 } else { 1534 1534 #endif 1535 - if (cp0_perfcount_irq >= 0) 1535 + if ((cp0_perfcount_irq >= 0) && 1536 + (cp0_compare_irq != cp0_perfcount_irq)) 1536 1537 irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; 1537 1538 else 1538 1539 irq = -1;
+13 -13
arch/mips/kernel/proc.c
··· 41 41 42 42 seq_printf(m, "processor\t\t: %ld\n", n); 43 43 sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n", 44 - cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : ""); 44 + cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : ""); 45 45 seq_printf(m, fmt, __cpu_name[n], 46 - (version >> 4) & 0x0f, version & 0x0f, 47 - (fp_vers >> 4) & 0x0f, fp_vers & 0x0f); 46 + (version >> 4) & 0x0f, version & 0x0f, 47 + (fp_vers >> 4) & 0x0f, fp_vers & 0x0f); 48 48 seq_printf(m, "BogoMIPS\t\t: %u.%02u\n", 49 - cpu_data[n].udelay_val / (500000/HZ), 50 - (cpu_data[n].udelay_val / (5000/HZ)) % 100); 49 + cpu_data[n].udelay_val / (500000/HZ), 50 + (cpu_data[n].udelay_val / (5000/HZ)) % 100); 51 51 seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no"); 52 52 seq_printf(m, "microsecond timers\t: %s\n", 53 - cpu_has_counter ? "yes" : "no"); 53 + cpu_has_counter ? "yes" : "no"); 54 54 seq_printf(m, "tlb_entries\t\t: %d\n", cpu_data[n].tlbsize); 55 55 seq_printf(m, "extra interrupt vector\t: %s\n", 56 - cpu_has_divec ? "yes" : "no"); 56 + cpu_has_divec ? "yes" : "no"); 57 57 seq_printf(m, "hardware watchpoint\t: %s", 58 - cpu_has_watch ? "yes, " : "no\n"); 58 + cpu_has_watch ? "yes, " : "no\n"); 59 59 if (cpu_has_watch) { 60 60 seq_printf(m, "count: %d, address/irw mask: [", 61 - cpu_data[n].watch_reg_count); 61 + cpu_data[n].watch_reg_count); 62 62 for (i = 0; i < cpu_data[n].watch_reg_count; i++) 63 63 seq_printf(m, "%s0x%04x", i ? ", " : "" , 64 - cpu_data[n].watch_reg_masks[i]); 64 + cpu_data[n].watch_reg_masks[i]); 65 65 seq_printf(m, "]\n"); 66 66 } 67 67 seq_printf(m, "ASEs implemented\t:%s%s%s%s%s%s\n", ··· 73 73 cpu_has_mipsmt ? " mt" : "" 74 74 ); 75 75 seq_printf(m, "shadow register sets\t: %d\n", 76 - cpu_data[n].srsets); 76 + cpu_data[n].srsets); 77 77 seq_printf(m, "kscratch registers\t: %d\n", 78 - hweight8(cpu_data[n].kscratch_mask)); 78 + hweight8(cpu_data[n].kscratch_mask)); 79 79 seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core); 80 80 81 81 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n", 82 - cpu_has_vce ? "%u" : "not available"); 82 + cpu_has_vce ? "%u" : "not available"); 83 83 seq_printf(m, fmt, 'D', vced_count); 84 84 seq_printf(m, fmt, 'I', vcei_count); 85 85 seq_printf(m, "\n");
+13
arch/mips/kernel/prom.c
··· 95 95 /* free the space reserved for the dt blob */ 96 96 free_mem_mach(base, size); 97 97 } 98 + 99 + void __init __dt_setup_arch(struct boot_param_header *bph) 100 + { 101 + if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { 102 + pr_err("DTB has bad magic, ignoring builtin OF DTB\n"); 103 + 104 + return; 105 + } 106 + 107 + initial_boot_params = bph; 108 + 109 + early_init_devtree(initial_boot_params); 110 + }
+2
arch/mips/kernel/setup.c
··· 605 605 606 606 resource_init(); 607 607 plat_smp_setup(); 608 + 609 + cpu_cache_init(); 608 610 } 609 611 610 612 unsigned long kernelsp[NR_CPUS];
+1 -1
arch/mips/kernel/smp.c
··· 106 106 #endif /* CONFIG_MIPS_MT_SMTC */ 107 107 cpu_probe(); 108 108 cpu_report(); 109 - per_cpu_trap_init(); 109 + per_cpu_trap_init(false); 110 110 mips_clockevent_init(); 111 111 mp_ops->init_secondary(); 112 112
+11 -6
arch/mips/kernel/traps.c
··· 15 15 #include <linux/compiler.h> 16 16 #include <linux/init.h> 17 17 #include <linux/kernel.h> 18 + #include <linux/module.h> 18 19 #include <linux/mm.h> 19 20 #include <linux/sched.h> 20 21 #include <linux/smp.h> ··· 92 91 void (*board_ejtag_handler_setup)(void); 93 92 void (*board_bind_eic_interrupt)(int irq, int regset); 94 93 void (*board_ebase_setup)(void); 95 - 94 + void __cpuinitdata(*board_cache_error_setup)(void); 96 95 97 96 static void show_raw_backtrace(unsigned long reg29) 98 97 { ··· 1491 1490 return set_vi_srs_handler(n, addr, 0); 1492 1491 } 1493 1492 1494 - extern void cpu_cache_init(void); 1495 1493 extern void tlb_init(void); 1496 1494 extern void flush_tlb_handlers(void); 1497 1495 ··· 1517 1517 } 1518 1518 __setup("noulri", ulri_disable); 1519 1519 1520 - void __cpuinit per_cpu_trap_init(void) 1520 + void __cpuinit per_cpu_trap_init(bool is_boot_cpu) 1521 1521 { 1522 1522 unsigned int cpu = smp_processor_id(); 1523 1523 unsigned int status_set = ST0_CU0; ··· 1616 1616 #ifdef CONFIG_MIPS_MT_SMTC 1617 1617 if (bootTC) { 1618 1618 #endif /* CONFIG_MIPS_MT_SMTC */ 1619 - cpu_cache_init(); 1619 + /* Boot CPU's cache setup in setup_arch(). */ 1620 + if (!is_boot_cpu) 1621 + cpu_cache_init(); 1620 1622 tlb_init(); 1621 1623 #ifdef CONFIG_MIPS_MT_SMTC 1622 1624 } else if (!secondaryTC) { ··· 1634 1632 } 1635 1633 1636 1634 /* Install CPU exception handler */ 1637 - void __init set_handler(unsigned long offset, void *addr, unsigned long size) 1635 + void __cpuinit set_handler(unsigned long offset, void *addr, unsigned long size) 1638 1636 { 1639 1637 memcpy((void *)(ebase + offset), addr, size); 1640 1638 local_flush_icache_range(ebase + offset, ebase + offset + size); ··· 1695 1693 1696 1694 if (board_ebase_setup) 1697 1695 board_ebase_setup(); 1698 - per_cpu_trap_init(); 1696 + per_cpu_trap_init(true); 1699 1697 1700 1698 /* 1701 1699 * Copy the generic exception handlers to their final destination. ··· 1798 1796 set_except_vector(25, handle_mt); 1799 1797 1800 1798 set_except_vector(26, handle_dsp); 1799 + 1800 + if (board_cache_error_setup) 1801 + board_cache_error_setup(); 1801 1802 1802 1803 if (cpu_has_vce) 1803 1804 /* Special exception: R4[04]00 uses also the divec space. */
+15 -1
arch/mips/lantiq/Kconfig
··· 16 16 bool "XWAY" 17 17 select SOC_TYPE_XWAY 18 18 select HW_HAS_PCI 19 + 20 + config SOC_FALCON 21 + bool "FALCON" 22 + 19 23 endchoice 20 24 21 - source "arch/mips/lantiq/xway/Kconfig" 25 + choice 26 + prompt "Devicetree" 27 + 28 + config DT_EASY50712 29 + bool "Easy50712" 30 + depends on SOC_XWAY 31 + endchoice 32 + 33 + config PCI_LANTIQ 34 + bool "PCI Support" 35 + depends on SOC_XWAY && PCI 22 36 23 37 endif
+4 -1
arch/mips/lantiq/Makefile
··· 4 4 # under the terms of the GNU General Public License version 2 as published 5 5 # by the Free Software Foundation. 6 6 7 - obj-y := irq.o setup.o clk.o prom.o devices.o 7 + obj-y := irq.o clk.o prom.o 8 + 9 + obj-y += dts/ 8 10 9 11 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 10 12 11 13 obj-$(CONFIG_SOC_TYPE_XWAY) += xway/ 14 + obj-$(CONFIG_SOC_FALCON) += falcon/
+1
arch/mips/lantiq/Platform
··· 6 6 cflags-$(CONFIG_LANTIQ) += -I$(srctree)/arch/mips/include/asm/mach-lantiq 7 7 load-$(CONFIG_LANTIQ) = 0xffffffff80002000 8 8 cflags-$(CONFIG_SOC_TYPE_XWAY) += -I$(srctree)/arch/mips/include/asm/mach-lantiq/xway 9 + cflags-$(CONFIG_SOC_FALCON) += -I$(srctree)/arch/mips/include/asm/mach-lantiq/falcon
+78 -66
arch/mips/lantiq/clk.c
··· 12 12 #include <linux/kernel.h> 13 13 #include <linux/types.h> 14 14 #include <linux/clk.h> 15 + #include <linux/clkdev.h> 15 16 #include <linux/err.h> 16 17 #include <linux/list.h> 17 18 ··· 23 22 #include <lantiq_soc.h> 24 23 25 24 #include "clk.h" 26 - 27 - struct clk { 28 - const char *name; 29 - unsigned long rate; 30 - unsigned long (*get_rate) (void); 31 - }; 32 - 33 - static struct clk *cpu_clk; 34 - static int cpu_clk_cnt; 25 + #include "prom.h" 35 26 36 27 /* lantiq socs have 3 static clocks */ 37 - static struct clk cpu_clk_generic[] = { 38 - { 39 - .name = "cpu", 40 - .get_rate = ltq_get_cpu_hz, 41 - }, { 42 - .name = "fpi", 43 - .get_rate = ltq_get_fpi_hz, 44 - }, { 45 - .name = "io", 46 - .get_rate = ltq_get_io_region_clock, 47 - }, 48 - }; 28 + static struct clk cpu_clk_generic[3]; 49 29 50 - static struct resource ltq_cgu_resource = { 51 - .name = "cgu", 52 - .start = LTQ_CGU_BASE_ADDR, 53 - .end = LTQ_CGU_BASE_ADDR + LTQ_CGU_SIZE - 1, 54 - .flags = IORESOURCE_MEM, 55 - }; 56 - 57 - /* remapped clock register range */ 58 - void __iomem *ltq_cgu_membase; 59 - 60 - void clk_init(void) 30 + void clkdev_add_static(unsigned long cpu, unsigned long fpi, unsigned long io) 61 31 { 62 - cpu_clk = cpu_clk_generic; 63 - cpu_clk_cnt = ARRAY_SIZE(cpu_clk_generic); 32 + cpu_clk_generic[0].rate = cpu; 33 + cpu_clk_generic[1].rate = fpi; 34 + cpu_clk_generic[2].rate = io; 35 + } 36 + 37 + struct clk *clk_get_cpu(void) 38 + { 39 + return &cpu_clk_generic[0]; 40 + } 41 + 42 + struct clk *clk_get_fpi(void) 43 + { 44 + return &cpu_clk_generic[1]; 45 + } 46 + EXPORT_SYMBOL_GPL(clk_get_fpi); 47 + 48 + struct clk *clk_get_io(void) 49 + { 50 + return &cpu_clk_generic[2]; 64 51 } 65 52 66 53 static inline int clk_good(struct clk *clk) ··· 71 82 } 72 83 EXPORT_SYMBOL(clk_get_rate); 73 84 74 - struct clk *clk_get(struct device *dev, const char *id) 85 + int clk_set_rate(struct clk *clk, unsigned long rate) 75 86 { 76 - int i; 87 + if (unlikely(!clk_good(clk))) 88 + return 0; 89 + if (clk->rates && *clk->rates) { 90 + unsigned long *r = clk->rates; 77 91 78 - for (i = 0; i < cpu_clk_cnt; i++) 79 - if (!strcmp(id, cpu_clk[i].name)) 80 - return &cpu_clk[i]; 81 - BUG(); 82 - return ERR_PTR(-ENOENT); 92 + while (*r && (*r != rate)) 93 + r++; 94 + if (!*r) { 95 + pr_err("clk %s.%s: trying to set invalid rate %ld\n", 96 + clk->cl.dev_id, clk->cl.con_id, rate); 97 + return -1; 98 + } 99 + } 100 + clk->rate = rate; 101 + return 0; 83 102 } 84 - EXPORT_SYMBOL(clk_get); 85 - 86 - void clk_put(struct clk *clk) 87 - { 88 - /* not used */ 89 - } 90 - EXPORT_SYMBOL(clk_put); 103 + EXPORT_SYMBOL(clk_set_rate); 91 104 92 105 int clk_enable(struct clk *clk) 93 106 { 94 - /* not used */ 95 - return 0; 107 + if (unlikely(!clk_good(clk))) 108 + return -1; 109 + 110 + if (clk->enable) 111 + return clk->enable(clk); 112 + 113 + return -1; 96 114 } 97 115 EXPORT_SYMBOL(clk_enable); 98 116 99 117 void clk_disable(struct clk *clk) 100 118 { 101 - /* not used */ 119 + if (unlikely(!clk_good(clk))) 120 + return; 121 + 122 + if (clk->disable) 123 + clk->disable(clk); 102 124 } 103 125 EXPORT_SYMBOL(clk_disable); 104 126 105 - static inline u32 ltq_get_counter_resolution(void) 127 + int clk_activate(struct clk *clk) 128 + { 129 + if (unlikely(!clk_good(clk))) 130 + return -1; 131 + 132 + if (clk->activate) 133 + return clk->activate(clk); 134 + 135 + return -1; 136 + } 137 + EXPORT_SYMBOL(clk_activate); 138 + 139 + void clk_deactivate(struct clk *clk) 140 + { 141 + if (unlikely(!clk_good(clk))) 142 + return; 143 + 144 + if (clk->deactivate) 145 + clk->deactivate(clk); 146 + } 147 + EXPORT_SYMBOL(clk_deactivate); 148 + 149 + static inline u32 get_counter_resolution(void) 106 150 { 107 151 u32 res; 108 152 ··· 155 133 { 156 134 struct clk *clk; 157 135 158 - if (insert_resource(&iomem_resource, &ltq_cgu_resource) < 0) 159 - panic("Failed to insert cgu memory"); 136 + ltq_soc_init(); 160 137 161 - if (request_mem_region(ltq_cgu_resource.start, 162 - resource_size(&ltq_cgu_resource), "cgu") < 0) 163 - panic("Failed to request cgu memory"); 164 - 165 - ltq_cgu_membase = ioremap_nocache(ltq_cgu_resource.start, 166 - resource_size(&ltq_cgu_resource)); 167 - if (!ltq_cgu_membase) { 168 - pr_err("Failed to remap cgu memory\n"); 169 - unreachable(); 170 - } 171 - clk = clk_get(0, "cpu"); 172 - mips_hpt_frequency = clk_get_rate(clk) / ltq_get_counter_resolution(); 138 + clk = clk_get_cpu(); 139 + mips_hpt_frequency = clk_get_rate(clk) / get_counter_resolution(); 173 140 write_c0_compare(read_c0_count()); 141 + pr_info("CPU Clock: %ldMHz\n", clk_get_rate(clk) / 1000000); 174 142 clk_put(clk); 175 143 }
+64 -4
arch/mips/lantiq/clk.h
··· 9 9 #ifndef _LTQ_CLK_H__ 10 10 #define _LTQ_CLK_H__ 11 11 12 - extern void clk_init(void); 12 + #include <linux/clkdev.h> 13 13 14 - extern unsigned long ltq_get_cpu_hz(void); 15 - extern unsigned long ltq_get_fpi_hz(void); 16 - extern unsigned long ltq_get_io_region_clock(void); 14 + /* clock speeds */ 15 + #define CLOCK_33M 33333333 16 + #define CLOCK_60M 60000000 17 + #define CLOCK_62_5M 62500000 18 + #define CLOCK_83M 83333333 19 + #define CLOCK_83_5M 83500000 20 + #define CLOCK_98_304M 98304000 21 + #define CLOCK_100M 100000000 22 + #define CLOCK_111M 111111111 23 + #define CLOCK_125M 125000000 24 + #define CLOCK_133M 133333333 25 + #define CLOCK_150M 150000000 26 + #define CLOCK_166M 166666666 27 + #define CLOCK_167M 166666667 28 + #define CLOCK_196_608M 196608000 29 + #define CLOCK_200M 200000000 30 + #define CLOCK_250M 250000000 31 + #define CLOCK_266M 266666666 32 + #define CLOCK_300M 300000000 33 + #define CLOCK_333M 333333333 34 + #define CLOCK_393M 393215332 35 + #define CLOCK_400M 400000000 36 + #define CLOCK_500M 500000000 37 + #define CLOCK_600M 600000000 38 + 39 + /* clock out speeds */ 40 + #define CLOCK_32_768K 32768 41 + #define CLOCK_1_536M 1536000 42 + #define CLOCK_2_5M 2500000 43 + #define CLOCK_12M 12000000 44 + #define CLOCK_24M 24000000 45 + #define CLOCK_25M 25000000 46 + #define CLOCK_30M 30000000 47 + #define CLOCK_40M 40000000 48 + #define CLOCK_48M 48000000 49 + #define CLOCK_50M 50000000 50 + #define CLOCK_60M 60000000 51 + 52 + struct clk { 53 + struct clk_lookup cl; 54 + unsigned long rate; 55 + unsigned long *rates; 56 + unsigned int module; 57 + unsigned int bits; 58 + unsigned long (*get_rate) (void); 59 + int (*enable) (struct clk *clk); 60 + void (*disable) (struct clk *clk); 61 + int (*activate) (struct clk *clk); 62 + void (*deactivate) (struct clk *clk); 63 + void (*reboot) (struct clk *clk); 64 + }; 65 + 66 + extern void clkdev_add_static(unsigned long cpu, unsigned long fpi, 67 + unsigned long io); 68 + 69 + extern unsigned long ltq_danube_cpu_hz(void); 70 + extern unsigned long ltq_danube_fpi_hz(void); 71 + 72 + extern unsigned long ltq_ar9_cpu_hz(void); 73 + extern unsigned long ltq_ar9_fpi_hz(void); 74 + 75 + extern unsigned long ltq_vr9_cpu_hz(void); 76 + extern unsigned long ltq_vr9_fpi_hz(void); 17 77 18 78 #endif
-120
arch/mips/lantiq/devices.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/export.h> 11 - #include <linux/types.h> 12 - #include <linux/string.h> 13 - #include <linux/kernel.h> 14 - #include <linux/reboot.h> 15 - #include <linux/platform_device.h> 16 - #include <linux/leds.h> 17 - #include <linux/etherdevice.h> 18 - #include <linux/time.h> 19 - #include <linux/io.h> 20 - #include <linux/gpio.h> 21 - 22 - #include <asm/bootinfo.h> 23 - #include <asm/irq.h> 24 - 25 - #include <lantiq_soc.h> 26 - 27 - #include "devices.h" 28 - 29 - /* nor flash */ 30 - static struct resource ltq_nor_resource = { 31 - .name = "nor", 32 - .start = LTQ_FLASH_START, 33 - .end = LTQ_FLASH_START + LTQ_FLASH_MAX - 1, 34 - .flags = IORESOURCE_MEM, 35 - }; 36 - 37 - static struct platform_device ltq_nor = { 38 - .name = "ltq_nor", 39 - .resource = &ltq_nor_resource, 40 - .num_resources = 1, 41 - }; 42 - 43 - void __init ltq_register_nor(struct physmap_flash_data *data) 44 - { 45 - ltq_nor.dev.platform_data = data; 46 - platform_device_register(&ltq_nor); 47 - } 48 - 49 - /* watchdog */ 50 - static struct resource ltq_wdt_resource = { 51 - .name = "watchdog", 52 - .start = LTQ_WDT_BASE_ADDR, 53 - .end = LTQ_WDT_BASE_ADDR + LTQ_WDT_SIZE - 1, 54 - .flags = IORESOURCE_MEM, 55 - }; 56 - 57 - void __init ltq_register_wdt(void) 58 - { 59 - platform_device_register_simple("ltq_wdt", 0, &ltq_wdt_resource, 1); 60 - } 61 - 62 - /* asc ports */ 63 - static struct resource ltq_asc0_resources[] = { 64 - { 65 - .name = "asc0", 66 - .start = LTQ_ASC0_BASE_ADDR, 67 - .end = LTQ_ASC0_BASE_ADDR + LTQ_ASC_SIZE - 1, 68 - .flags = IORESOURCE_MEM, 69 - }, 70 - IRQ_RES(tx, LTQ_ASC_TIR(0)), 71 - IRQ_RES(rx, LTQ_ASC_RIR(0)), 72 - IRQ_RES(err, LTQ_ASC_EIR(0)), 73 - }; 74 - 75 - static struct resource ltq_asc1_resources[] = { 76 - { 77 - .name = "asc1", 78 - .start = LTQ_ASC1_BASE_ADDR, 79 - .end = LTQ_ASC1_BASE_ADDR + LTQ_ASC_SIZE - 1, 80 - .flags = IORESOURCE_MEM, 81 - }, 82 - IRQ_RES(tx, LTQ_ASC_TIR(1)), 83 - IRQ_RES(rx, LTQ_ASC_RIR(1)), 84 - IRQ_RES(err, LTQ_ASC_EIR(1)), 85 - }; 86 - 87 - void __init ltq_register_asc(int port) 88 - { 89 - switch (port) { 90 - case 0: 91 - platform_device_register_simple("ltq_asc", 0, 92 - ltq_asc0_resources, ARRAY_SIZE(ltq_asc0_resources)); 93 - break; 94 - case 1: 95 - platform_device_register_simple("ltq_asc", 1, 96 - ltq_asc1_resources, ARRAY_SIZE(ltq_asc1_resources)); 97 - break; 98 - default: 99 - break; 100 - } 101 - } 102 - 103 - #ifdef CONFIG_PCI 104 - /* pci */ 105 - static struct platform_device ltq_pci = { 106 - .name = "ltq_pci", 107 - .num_resources = 0, 108 - }; 109 - 110 - void __init ltq_register_pci(struct ltq_pci_data *data) 111 - { 112 - ltq_pci.dev.platform_data = data; 113 - platform_device_register(&ltq_pci); 114 - } 115 - #else 116 - void __init ltq_register_pci(struct ltq_pci_data *data) 117 - { 118 - pr_err("kernel is compiled without PCI support\n"); 119 - } 120 - #endif
-23
arch/mips/lantiq/devices.h
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #ifndef _LTQ_DEVICES_H__ 10 - #define _LTQ_DEVICES_H__ 11 - 12 - #include <lantiq_platform.h> 13 - #include <linux/mtd/physmap.h> 14 - 15 - #define IRQ_RES(resname, irq) \ 16 - {.name = #resname, .start = (irq), .flags = IORESOURCE_IRQ} 17 - 18 - extern void ltq_register_nor(struct physmap_flash_data *data); 19 - extern void ltq_register_wdt(void); 20 - extern void ltq_register_asc(int port); 21 - extern void ltq_register_pci(struct ltq_pci_data *data); 22 - 23 - #endif
+4
arch/mips/lantiq/dts/Makefile
··· 1 + obj-$(CONFIG_DT_EASY50712) := easy50712.dtb.o 2 + 3 + $(obj)/%.dtb: $(obj)/%.dts 4 + $(call if_changed,dtc)
+105
arch/mips/lantiq/dts/danube.dtsi
··· 1 + / { 2 + #address-cells = <1>; 3 + #size-cells = <1>; 4 + compatible = "lantiq,xway", "lantiq,danube"; 5 + 6 + cpus { 7 + cpu@0 { 8 + compatible = "mips,mips24Kc"; 9 + }; 10 + }; 11 + 12 + biu@1F800000 { 13 + #address-cells = <1>; 14 + #size-cells = <1>; 15 + compatible = "lantiq,biu", "simple-bus"; 16 + reg = <0x1F800000 0x800000>; 17 + ranges = <0x0 0x1F800000 0x7FFFFF>; 18 + 19 + icu0: icu@80200 { 20 + #interrupt-cells = <1>; 21 + interrupt-controller; 22 + compatible = "lantiq,icu"; 23 + reg = <0x80200 0x120>; 24 + }; 25 + 26 + watchdog@803F0 { 27 + compatible = "lantiq,wdt"; 28 + reg = <0x803F0 0x10>; 29 + }; 30 + }; 31 + 32 + sram@1F000000 { 33 + #address-cells = <1>; 34 + #size-cells = <1>; 35 + compatible = "lantiq,sram"; 36 + reg = <0x1F000000 0x800000>; 37 + ranges = <0x0 0x1F000000 0x7FFFFF>; 38 + 39 + eiu0: eiu@101000 { 40 + #interrupt-cells = <1>; 41 + interrupt-controller; 42 + interrupt-parent; 43 + compatible = "lantiq,eiu-xway"; 44 + reg = <0x101000 0x1000>; 45 + }; 46 + 47 + pmu0: pmu@102000 { 48 + compatible = "lantiq,pmu-xway"; 49 + reg = <0x102000 0x1000>; 50 + }; 51 + 52 + cgu0: cgu@103000 { 53 + compatible = "lantiq,cgu-xway"; 54 + reg = <0x103000 0x1000>; 55 + #clock-cells = <1>; 56 + }; 57 + 58 + rcu0: rcu@203000 { 59 + compatible = "lantiq,rcu-xway"; 60 + reg = <0x203000 0x1000>; 61 + }; 62 + }; 63 + 64 + fpi@10000000 { 65 + #address-cells = <1>; 66 + #size-cells = <1>; 67 + compatible = "lantiq,fpi", "simple-bus"; 68 + ranges = <0x0 0x10000000 0xEEFFFFF>; 69 + reg = <0x10000000 0xEF00000>; 70 + 71 + gptu@E100A00 { 72 + compatible = "lantiq,gptu-xway"; 73 + reg = <0xE100A00 0x100>; 74 + }; 75 + 76 + serial@E100C00 { 77 + compatible = "lantiq,asc"; 78 + reg = <0xE100C00 0x400>; 79 + interrupt-parent = <&icu0>; 80 + interrupts = <112 113 114>; 81 + }; 82 + 83 + dma0: dma@E104100 { 84 + compatible = "lantiq,dma-xway"; 85 + reg = <0xE104100 0x800>; 86 + }; 87 + 88 + ebu0: ebu@E105300 { 89 + compatible = "lantiq,ebu-xway"; 90 + reg = <0xE105300 0x100>; 91 + }; 92 + 93 + pci0: pci@E105400 { 94 + #address-cells = <3>; 95 + #size-cells = <2>; 96 + #interrupt-cells = <1>; 97 + compatible = "lantiq,pci-xway"; 98 + bus-range = <0x0 0x0>; 99 + ranges = <0x2000000 0 0x8000000 0x8000000 0 0x2000000 /* pci memory */ 100 + 0x1000000 0 0x00000000 0xAE00000 0 0x200000>; /* io space */ 101 + reg = <0x7000000 0x8000 /* config space */ 102 + 0xE105400 0x400>; /* pci bridge */ 103 + }; 104 + }; 105 + };
+113
arch/mips/lantiq/dts/easy50712.dts
··· 1 + /dts-v1/; 2 + 3 + /include/ "danube.dtsi" 4 + 5 + / { 6 + chosen { 7 + bootargs = "console=ttyLTQ0,115200 init=/etc/preinit"; 8 + }; 9 + 10 + memory@0 { 11 + reg = <0x0 0x2000000>; 12 + }; 13 + 14 + fpi@10000000 { 15 + #address-cells = <1>; 16 + #size-cells = <1>; 17 + localbus@0 { 18 + #address-cells = <2>; 19 + #size-cells = <1>; 20 + ranges = <0 0 0x0 0x3ffffff /* addrsel0 */ 21 + 1 0 0x4000000 0x4000010>; /* addsel1 */ 22 + compatible = "lantiq,localbus", "simple-bus"; 23 + 24 + nor-boot@0 { 25 + compatible = "lantiq,nor"; 26 + bank-width = <2>; 27 + reg = <0 0x0 0x2000000>; 28 + #address-cells = <1>; 29 + #size-cells = <1>; 30 + 31 + partition@0 { 32 + label = "uboot"; 33 + reg = <0x00000 0x10000>; /* 64 KB */ 34 + }; 35 + 36 + partition@10000 { 37 + label = "uboot_env"; 38 + reg = <0x10000 0x10000>; /* 64 KB */ 39 + }; 40 + 41 + partition@20000 { 42 + label = "linux"; 43 + reg = <0x20000 0x3d0000>; 44 + }; 45 + 46 + partition@400000 { 47 + label = "rootfs"; 48 + reg = <0x400000 0x400000>; 49 + }; 50 + }; 51 + }; 52 + 53 + gpio: pinmux@E100B10 { 54 + compatible = "lantiq,pinctrl-xway"; 55 + pinctrl-names = "default"; 56 + pinctrl-0 = <&state_default>; 57 + 58 + #gpio-cells = <2>; 59 + gpio-controller; 60 + reg = <0xE100B10 0xA0>; 61 + 62 + state_default: pinmux { 63 + stp { 64 + lantiq,groups = "stp"; 65 + lantiq,function = "stp"; 66 + }; 67 + exin { 68 + lantiq,groups = "exin1"; 69 + lantiq,function = "exin"; 70 + }; 71 + pci { 72 + lantiq,groups = "gnt1"; 73 + lantiq,function = "pci"; 74 + }; 75 + conf_out { 76 + lantiq,pins = "io4", "io5", "io6"; /* stp */ 77 + lantiq,open-drain; 78 + lantiq,pull = <0>; 79 + }; 80 + }; 81 + }; 82 + 83 + etop@E180000 { 84 + compatible = "lantiq,etop-xway"; 85 + reg = <0xE180000 0x40000>; 86 + interrupt-parent = <&icu0>; 87 + interrupts = <73 78>; 88 + phy-mode = "rmii"; 89 + mac-address = [ 00 11 22 33 44 55 ]; 90 + }; 91 + 92 + stp0: stp@E100BB0 { 93 + #gpio-cells = <2>; 94 + compatible = "lantiq,gpio-stp-xway"; 95 + gpio-controller; 96 + reg = <0xE100BB0 0x40>; 97 + 98 + lantiq,shadow = <0xfff>; 99 + lantiq,groups = <0x3>; 100 + }; 101 + 102 + pci@E105400 { 103 + lantiq,bus-clock = <33333333>; 104 + interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 105 + interrupt-map = < 106 + 0x7000 0 0 1 &icu0 29 1 // slot 14, irq 29 107 + >; 108 + gpios-reset = <&gpio 21 0>; 109 + req-mask = <0x1>; /* GNT1 */ 110 + }; 111 + 112 + }; 113 + };
+8 -9
arch/mips/lantiq/early_printk.c
··· 6 6 * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 7 */ 8 8 9 - #include <linux/init.h> 10 9 #include <linux/cpu.h> 11 - 12 - #include <lantiq.h> 13 10 #include <lantiq_soc.h> 14 11 15 - /* no ioremap possible at this early stage, lets use KSEG1 instead */ 16 - #define LTQ_ASC_BASE KSEG1ADDR(LTQ_ASC1_BASE_ADDR) 17 12 #define ASC_BUF 1024 18 - #define LTQ_ASC_FSTAT ((u32 *)(LTQ_ASC_BASE + 0x0048)) 19 - #define LTQ_ASC_TBUF ((u32 *)(LTQ_ASC_BASE + 0x0020)) 13 + #define LTQ_ASC_FSTAT ((u32 *)(LTQ_EARLY_ASC + 0x0048)) 14 + #ifdef __BIG_ENDIAN 15 + #define LTQ_ASC_TBUF ((u32 *)(LTQ_EARLY_ASC + 0x0020 + 3)) 16 + #else 17 + #define LTQ_ASC_TBUF ((u32 *)(LTQ_EARLY_ASC + 0x0020)) 18 + #endif 20 19 #define TXMASK 0x3F00 21 20 #define TXOFFSET 8 22 21 ··· 26 27 local_irq_save(flags); 27 28 do { } while ((ltq_r32(LTQ_ASC_FSTAT) & TXMASK) >> TXOFFSET); 28 29 if (c == '\n') 29 - ltq_w32('\r', LTQ_ASC_TBUF); 30 - ltq_w32(c, LTQ_ASC_TBUF); 30 + ltq_w8('\r', LTQ_ASC_TBUF); 31 + ltq_w8(c, LTQ_ASC_TBUF); 31 32 local_irq_restore(flags); 32 33 }
+1
arch/mips/lantiq/falcon/Makefile
··· 1 + obj-y := prom.o reset.o sysctrl.o
+87
arch/mips/lantiq/falcon/prom.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2012 Thomas Langer <thomas.langer@lantiq.com> 7 + * Copyright (C) 2012 John Crispin <blogic@openwrt.org> 8 + */ 9 + 10 + #include <linux/kernel.h> 11 + #include <asm/io.h> 12 + 13 + #include <lantiq_soc.h> 14 + 15 + #include "../prom.h" 16 + 17 + #define SOC_FALCON "Falcon" 18 + #define SOC_FALCON_D "Falcon-D" 19 + #define SOC_FALCON_V "Falcon-V" 20 + #define SOC_FALCON_M "Falcon-M" 21 + 22 + #define COMP_FALCON "lantiq,falcon" 23 + 24 + #define PART_SHIFT 12 25 + #define PART_MASK 0x0FFFF000 26 + #define REV_SHIFT 28 27 + #define REV_MASK 0xF0000000 28 + #define SREV_SHIFT 22 29 + #define SREV_MASK 0x03C00000 30 + #define TYPE_SHIFT 26 31 + #define TYPE_MASK 0x3C000000 32 + 33 + /* reset, nmi and ejtag exception vectors */ 34 + #define BOOT_REG_BASE (KSEG1 | 0x1F200000) 35 + #define BOOT_RVEC (BOOT_REG_BASE | 0x00) 36 + #define BOOT_NVEC (BOOT_REG_BASE | 0x04) 37 + #define BOOT_EVEC (BOOT_REG_BASE | 0x08) 38 + 39 + void __init ltq_soc_nmi_setup(void) 40 + { 41 + extern void (*nmi_handler)(void); 42 + 43 + ltq_w32((unsigned long)&nmi_handler, (void *)BOOT_NVEC); 44 + } 45 + 46 + void __init ltq_soc_ejtag_setup(void) 47 + { 48 + extern void (*ejtag_debug_handler)(void); 49 + 50 + ltq_w32((unsigned long)&ejtag_debug_handler, (void *)BOOT_EVEC); 51 + } 52 + 53 + void __init ltq_soc_detect(struct ltq_soc_info *i) 54 + { 55 + u32 type; 56 + i->partnum = (ltq_r32(FALCON_CHIPID) & PART_MASK) >> PART_SHIFT; 57 + i->rev = (ltq_r32(FALCON_CHIPID) & REV_MASK) >> REV_SHIFT; 58 + i->srev = ((ltq_r32(FALCON_CHIPCONF) & SREV_MASK) >> SREV_SHIFT); 59 + i->compatible = COMP_FALCON; 60 + i->type = SOC_TYPE_FALCON; 61 + sprintf(i->rev_type, "%c%d%d", (i->srev & 0x4) ? ('B') : ('A'), 62 + i->rev & 0x7, (i->srev & 0x3) + 1); 63 + 64 + switch (i->partnum) { 65 + case SOC_ID_FALCON: 66 + type = (ltq_r32(FALCON_CHIPTYPE) & TYPE_MASK) >> TYPE_SHIFT; 67 + switch (type) { 68 + case 0: 69 + i->name = SOC_FALCON_D; 70 + break; 71 + case 1: 72 + i->name = SOC_FALCON_V; 73 + break; 74 + case 2: 75 + i->name = SOC_FALCON_M; 76 + break; 77 + default: 78 + i->name = SOC_FALCON; 79 + break; 80 + } 81 + break; 82 + 83 + default: 84 + unreachable(); 85 + break; 86 + } 87 + }
+90
arch/mips/lantiq/falcon/reset.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2012 Thomas Langer <thomas.langer@lantiq.com> 7 + * Copyright (C) 2012 John Crispin <blogic@openwrt.org> 8 + */ 9 + 10 + #include <linux/init.h> 11 + #include <linux/io.h> 12 + #include <linux/pm.h> 13 + #include <asm/reboot.h> 14 + #include <linux/export.h> 15 + 16 + #include <lantiq_soc.h> 17 + 18 + /* CPU0 Reset Source Register */ 19 + #define SYS1_CPU0RS 0x0040 20 + /* reset cause mask */ 21 + #define CPU0RS_MASK 0x0003 22 + /* CPU0 Boot Mode Register */ 23 + #define SYS1_BM 0x00a0 24 + /* boot mode mask */ 25 + #define BM_MASK 0x0005 26 + 27 + /* allow platform code to find out what surce we booted from */ 28 + unsigned char ltq_boot_select(void) 29 + { 30 + return ltq_sys1_r32(SYS1_BM) & BM_MASK; 31 + } 32 + 33 + /* allow the watchdog driver to find out what the boot reason was */ 34 + int ltq_reset_cause(void) 35 + { 36 + return ltq_sys1_r32(SYS1_CPU0RS) & CPU0RS_MASK; 37 + } 38 + EXPORT_SYMBOL_GPL(ltq_reset_cause); 39 + 40 + #define BOOT_REG_BASE (KSEG1 | 0x1F200000) 41 + #define BOOT_PW1_REG (BOOT_REG_BASE | 0x20) 42 + #define BOOT_PW2_REG (BOOT_REG_BASE | 0x24) 43 + #define BOOT_PW1 0x4C545100 44 + #define BOOT_PW2 0x0051544C 45 + 46 + #define WDT_REG_BASE (KSEG1 | 0x1F8803F0) 47 + #define WDT_PW1 0x00BE0000 48 + #define WDT_PW2 0x00DC0000 49 + 50 + static void machine_restart(char *command) 51 + { 52 + local_irq_disable(); 53 + 54 + /* reboot magic */ 55 + ltq_w32(BOOT_PW1, (void *)BOOT_PW1_REG); /* 'LTQ\0' */ 56 + ltq_w32(BOOT_PW2, (void *)BOOT_PW2_REG); /* '\0QTL' */ 57 + ltq_w32(0, (void *)BOOT_REG_BASE); /* reset Bootreg RVEC */ 58 + 59 + /* watchdog magic */ 60 + ltq_w32(WDT_PW1, (void *)WDT_REG_BASE); 61 + ltq_w32(WDT_PW2 | 62 + (0x3 << 26) | /* PWL */ 63 + (0x2 << 24) | /* CLKDIV */ 64 + (0x1 << 31) | /* enable */ 65 + (1), /* reload */ 66 + (void *)WDT_REG_BASE); 67 + unreachable(); 68 + } 69 + 70 + static void machine_halt(void) 71 + { 72 + local_irq_disable(); 73 + unreachable(); 74 + } 75 + 76 + static void machine_power_off(void) 77 + { 78 + local_irq_disable(); 79 + unreachable(); 80 + } 81 + 82 + static int __init mips_reboot_setup(void) 83 + { 84 + _machine_restart = machine_restart; 85 + _machine_halt = machine_halt; 86 + pm_power_off = machine_power_off; 87 + return 0; 88 + } 89 + 90 + arch_initcall(mips_reboot_setup);
+260
arch/mips/lantiq/falcon/sysctrl.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2011 Thomas Langer <thomas.langer@lantiq.com> 7 + * Copyright (C) 2011 John Crispin <blogic@openwrt.org> 8 + */ 9 + 10 + #include <linux/ioport.h> 11 + #include <linux/export.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/of_address.h> 14 + #include <asm/delay.h> 15 + 16 + #include <lantiq_soc.h> 17 + 18 + #include "../clk.h" 19 + 20 + /* infrastructure control register */ 21 + #define SYS1_INFRAC 0x00bc 22 + /* Configuration fuses for drivers and pll */ 23 + #define STATUS_CONFIG 0x0040 24 + 25 + /* GPE frequency selection */ 26 + #define GPPC_OFFSET 24 27 + #define GPEFREQ_MASK 0x00000C0 28 + #define GPEFREQ_OFFSET 10 29 + /* Clock status register */ 30 + #define SYSCTL_CLKS 0x0000 31 + /* Clock enable register */ 32 + #define SYSCTL_CLKEN 0x0004 33 + /* Clock clear register */ 34 + #define SYSCTL_CLKCLR 0x0008 35 + /* Activation Status Register */ 36 + #define SYSCTL_ACTS 0x0020 37 + /* Activation Register */ 38 + #define SYSCTL_ACT 0x0024 39 + /* Deactivation Register */ 40 + #define SYSCTL_DEACT 0x0028 41 + /* reboot Register */ 42 + #define SYSCTL_RBT 0x002c 43 + /* CPU0 Clock Control Register */ 44 + #define SYS1_CPU0CC 0x0040 45 + /* HRST_OUT_N Control Register */ 46 + #define SYS1_HRSTOUTC 0x00c0 47 + /* clock divider bit */ 48 + #define CPU0CC_CPUDIV 0x0001 49 + 50 + /* Activation Status Register */ 51 + #define ACTS_ASC1_ACT 0x00000800 52 + #define ACTS_I2C_ACT 0x00004000 53 + #define ACTS_P0 0x00010000 54 + #define ACTS_P1 0x00010000 55 + #define ACTS_P2 0x00020000 56 + #define ACTS_P3 0x00020000 57 + #define ACTS_P4 0x00040000 58 + #define ACTS_PADCTRL0 0x00100000 59 + #define ACTS_PADCTRL1 0x00100000 60 + #define ACTS_PADCTRL2 0x00200000 61 + #define ACTS_PADCTRL3 0x00200000 62 + #define ACTS_PADCTRL4 0x00400000 63 + 64 + #define sysctl_w32(m, x, y) ltq_w32((x), sysctl_membase[m] + (y)) 65 + #define sysctl_r32(m, x) ltq_r32(sysctl_membase[m] + (x)) 66 + #define sysctl_w32_mask(m, clear, set, reg) \ 67 + sysctl_w32(m, (sysctl_r32(m, reg) & ~(clear)) | (set), reg) 68 + 69 + #define status_w32(x, y) ltq_w32((x), status_membase + (y)) 70 + #define status_r32(x) ltq_r32(status_membase + (x)) 71 + 72 + static void __iomem *sysctl_membase[3], *status_membase; 73 + void __iomem *ltq_sys1_membase, *ltq_ebu_membase; 74 + 75 + void falcon_trigger_hrst(int level) 76 + { 77 + sysctl_w32(SYSCTL_SYS1, level & 1, SYS1_HRSTOUTC); 78 + } 79 + 80 + static inline void sysctl_wait(struct clk *clk, 81 + unsigned int test, unsigned int reg) 82 + { 83 + int err = 1000000; 84 + 85 + do {} while (--err && ((sysctl_r32(clk->module, reg) 86 + & clk->bits) != test)); 87 + if (!err) 88 + pr_err("module de/activation failed %d %08X %08X %08X\n", 89 + clk->module, clk->bits, test, 90 + sysctl_r32(clk->module, reg) & clk->bits); 91 + } 92 + 93 + static int sysctl_activate(struct clk *clk) 94 + { 95 + sysctl_w32(clk->module, clk->bits, SYSCTL_CLKEN); 96 + sysctl_w32(clk->module, clk->bits, SYSCTL_ACT); 97 + sysctl_wait(clk, clk->bits, SYSCTL_ACTS); 98 + return 0; 99 + } 100 + 101 + static void sysctl_deactivate(struct clk *clk) 102 + { 103 + sysctl_w32(clk->module, clk->bits, SYSCTL_CLKCLR); 104 + sysctl_w32(clk->module, clk->bits, SYSCTL_DEACT); 105 + sysctl_wait(clk, 0, SYSCTL_ACTS); 106 + } 107 + 108 + static int sysctl_clken(struct clk *clk) 109 + { 110 + sysctl_w32(clk->module, clk->bits, SYSCTL_CLKEN); 111 + sysctl_wait(clk, clk->bits, SYSCTL_CLKS); 112 + return 0; 113 + } 114 + 115 + static void sysctl_clkdis(struct clk *clk) 116 + { 117 + sysctl_w32(clk->module, clk->bits, SYSCTL_CLKCLR); 118 + sysctl_wait(clk, 0, SYSCTL_CLKS); 119 + } 120 + 121 + static void sysctl_reboot(struct clk *clk) 122 + { 123 + unsigned int act; 124 + unsigned int bits; 125 + 126 + act = sysctl_r32(clk->module, SYSCTL_ACT); 127 + bits = ~act & clk->bits; 128 + if (bits != 0) { 129 + sysctl_w32(clk->module, bits, SYSCTL_CLKEN); 130 + sysctl_w32(clk->module, bits, SYSCTL_ACT); 131 + sysctl_wait(clk, bits, SYSCTL_ACTS); 132 + } 133 + sysctl_w32(clk->module, act & clk->bits, SYSCTL_RBT); 134 + sysctl_wait(clk, clk->bits, SYSCTL_ACTS); 135 + } 136 + 137 + /* enable the ONU core */ 138 + static void falcon_gpe_enable(void) 139 + { 140 + unsigned int freq; 141 + unsigned int status; 142 + 143 + /* if if the clock is already enabled */ 144 + status = sysctl_r32(SYSCTL_SYS1, SYS1_INFRAC); 145 + if (status & (1 << (GPPC_OFFSET + 1))) 146 + return; 147 + 148 + if (status_r32(STATUS_CONFIG) == 0) 149 + freq = 1; /* use 625MHz on unfused chip */ 150 + else 151 + freq = (status_r32(STATUS_CONFIG) & 152 + GPEFREQ_MASK) >> 153 + GPEFREQ_OFFSET; 154 + 155 + /* apply new frequency */ 156 + sysctl_w32_mask(SYSCTL_SYS1, 7 << (GPPC_OFFSET + 1), 157 + freq << (GPPC_OFFSET + 2) , SYS1_INFRAC); 158 + udelay(1); 159 + 160 + /* enable new frequency */ 161 + sysctl_w32_mask(SYSCTL_SYS1, 0, 1 << (GPPC_OFFSET + 1), SYS1_INFRAC); 162 + udelay(1); 163 + } 164 + 165 + static inline void clkdev_add_sys(const char *dev, unsigned int module, 166 + unsigned int bits) 167 + { 168 + struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); 169 + 170 + clk->cl.dev_id = dev; 171 + clk->cl.con_id = NULL; 172 + clk->cl.clk = clk; 173 + clk->module = module; 174 + clk->activate = sysctl_activate; 175 + clk->deactivate = sysctl_deactivate; 176 + clk->enable = sysctl_clken; 177 + clk->disable = sysctl_clkdis; 178 + clk->reboot = sysctl_reboot; 179 + clkdev_add(&clk->cl); 180 + } 181 + 182 + void __init ltq_soc_init(void) 183 + { 184 + struct device_node *np_status = 185 + of_find_compatible_node(NULL, NULL, "lantiq,status-falcon"); 186 + struct device_node *np_ebu = 187 + of_find_compatible_node(NULL, NULL, "lantiq,ebu-falcon"); 188 + struct device_node *np_sys1 = 189 + of_find_compatible_node(NULL, NULL, "lantiq,sys1-falcon"); 190 + struct device_node *np_syseth = 191 + of_find_compatible_node(NULL, NULL, "lantiq,syseth-falcon"); 192 + struct device_node *np_sysgpe = 193 + of_find_compatible_node(NULL, NULL, "lantiq,sysgpe-falcon"); 194 + struct resource res_status, res_ebu, res_sys[3]; 195 + int i; 196 + 197 + /* check if all the core register ranges are available */ 198 + if (!np_status || !np_ebu || !np_sys1 || !np_syseth || !np_sysgpe) 199 + panic("Failed to load core nodes from devicetree"); 200 + 201 + if (of_address_to_resource(np_status, 0, &res_status) || 202 + of_address_to_resource(np_ebu, 0, &res_ebu) || 203 + of_address_to_resource(np_sys1, 0, &res_sys[0]) || 204 + of_address_to_resource(np_syseth, 0, &res_sys[1]) || 205 + of_address_to_resource(np_sysgpe, 0, &res_sys[2])) 206 + panic("Failed to get core resources"); 207 + 208 + if ((request_mem_region(res_status.start, resource_size(&res_status), 209 + res_status.name) < 0) || 210 + (request_mem_region(res_ebu.start, resource_size(&res_ebu), 211 + res_ebu.name) < 0) || 212 + (request_mem_region(res_sys[0].start, 213 + resource_size(&res_sys[0]), 214 + res_sys[0].name) < 0) || 215 + (request_mem_region(res_sys[1].start, 216 + resource_size(&res_sys[1]), 217 + res_sys[1].name) < 0) || 218 + (request_mem_region(res_sys[2].start, 219 + resource_size(&res_sys[2]), 220 + res_sys[2].name) < 0)) 221 + pr_err("Failed to request core reources"); 222 + 223 + status_membase = ioremap_nocache(res_status.start, 224 + resource_size(&res_status)); 225 + ltq_ebu_membase = ioremap_nocache(res_ebu.start, 226 + resource_size(&res_ebu)); 227 + 228 + if (!status_membase || !ltq_ebu_membase) 229 + panic("Failed to remap core resources"); 230 + 231 + for (i = 0; i < 3; i++) { 232 + sysctl_membase[i] = ioremap_nocache(res_sys[i].start, 233 + resource_size(&res_sys[i])); 234 + if (!sysctl_membase[i]) 235 + panic("Failed to remap sysctrl resources"); 236 + } 237 + ltq_sys1_membase = sysctl_membase[0]; 238 + 239 + falcon_gpe_enable(); 240 + 241 + /* get our 3 static rates for cpu, fpi and io clocks */ 242 + if (ltq_sys1_r32(SYS1_CPU0CC) & CPU0CC_CPUDIV) 243 + clkdev_add_static(CLOCK_200M, CLOCK_100M, CLOCK_200M); 244 + else 245 + clkdev_add_static(CLOCK_400M, CLOCK_100M, CLOCK_200M); 246 + 247 + /* add our clock domains */ 248 + clkdev_add_sys("1d810000.gpio", SYSCTL_SYSETH, ACTS_P0); 249 + clkdev_add_sys("1d810100.gpio", SYSCTL_SYSETH, ACTS_P2); 250 + clkdev_add_sys("1e800100.gpio", SYSCTL_SYS1, ACTS_P1); 251 + clkdev_add_sys("1e800200.gpio", SYSCTL_SYS1, ACTS_P3); 252 + clkdev_add_sys("1e800300.gpio", SYSCTL_SYS1, ACTS_P4); 253 + clkdev_add_sys("1db01000.pad", SYSCTL_SYSETH, ACTS_PADCTRL0); 254 + clkdev_add_sys("1db02000.pad", SYSCTL_SYSETH, ACTS_PADCTRL2); 255 + clkdev_add_sys("1e800400.pad", SYSCTL_SYS1, ACTS_PADCTRL1); 256 + clkdev_add_sys("1e800500.pad", SYSCTL_SYS1, ACTS_PADCTRL3); 257 + clkdev_add_sys("1e800600.pad", SYSCTL_SYS1, ACTS_PADCTRL4); 258 + clkdev_add_sys("1e100C00.serial", SYSCTL_SYS1, ACTS_ASC1_ACT); 259 + clkdev_add_sys("1e200000.i2c", SYSCTL_SYS1, ACTS_I2C_ACT); 260 + }
+172 -79
arch/mips/lantiq/irq.c
··· 9 9 10 10 #include <linux/interrupt.h> 11 11 #include <linux/ioport.h> 12 + #include <linux/sched.h> 13 + #include <linux/irqdomain.h> 14 + #include <linux/of_platform.h> 15 + #include <linux/of_address.h> 16 + #include <linux/of_irq.h> 12 17 13 18 #include <asm/bootinfo.h> 14 19 #include <asm/irq_cpu.h> ··· 21 16 #include <lantiq_soc.h> 22 17 #include <irq.h> 23 18 24 - /* register definitions */ 19 + /* register definitions - internal irqs */ 25 20 #define LTQ_ICU_IM0_ISR 0x0000 26 21 #define LTQ_ICU_IM0_IER 0x0008 27 22 #define LTQ_ICU_IM0_IOSR 0x0010 ··· 30 25 #define LTQ_ICU_IM1_ISR 0x0028 31 26 #define LTQ_ICU_OFFSET (LTQ_ICU_IM1_ISR - LTQ_ICU_IM0_ISR) 32 27 28 + /* register definitions - external irqs */ 33 29 #define LTQ_EIU_EXIN_C 0x0000 34 30 #define LTQ_EIU_EXIN_INIC 0x0004 35 31 #define LTQ_EIU_EXIN_INEN 0x000C ··· 43 37 #define LTQ_EIU_IR4 (INT_NUM_IM1_IRL0 + 1) 44 38 #define LTQ_EIU_IR5 (INT_NUM_IM1_IRL0 + 2) 45 39 #define LTQ_EIU_IR6 (INT_NUM_IM2_IRL0 + 30) 46 - 40 + #define XWAY_EXIN_COUNT 3 47 41 #define MAX_EIU 6 48 42 49 - /* irqs generated by device attached to the EBU need to be acked in 43 + /* the performance counter */ 44 + #define LTQ_PERF_IRQ (INT_NUM_IM4_IRL0 + 31) 45 + 46 + /* 47 + * irqs generated by devices attached to the EBU need to be acked in 50 48 * a special manner 51 49 */ 52 50 #define LTQ_ICU_EBU_IRQ 22 ··· 61 51 #define ltq_eiu_w32(x, y) ltq_w32((x), ltq_eiu_membase + (y)) 62 52 #define ltq_eiu_r32(x) ltq_r32(ltq_eiu_membase + (x)) 63 53 54 + /* our 2 ipi interrupts for VSMP */ 55 + #define MIPS_CPU_IPI_RESCHED_IRQ 0 56 + #define MIPS_CPU_IPI_CALL_IRQ 1 57 + 58 + /* we have a cascade of 8 irqs */ 59 + #define MIPS_CPU_IRQ_CASCADE 8 60 + 61 + #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC) 62 + int gic_present; 63 + #endif 64 + 64 65 static unsigned short ltq_eiu_irq[MAX_EIU] = { 65 66 LTQ_EIU_IR0, 66 67 LTQ_EIU_IR1, ··· 81 60 LTQ_EIU_IR5, 82 61 }; 83 62 84 - static struct resource ltq_icu_resource = { 85 - .name = "icu", 86 - .start = LTQ_ICU_BASE_ADDR, 87 - .end = LTQ_ICU_BASE_ADDR + LTQ_ICU_SIZE - 1, 88 - .flags = IORESOURCE_MEM, 89 - }; 90 - 91 - static struct resource ltq_eiu_resource = { 92 - .name = "eiu", 93 - .start = LTQ_EIU_BASE_ADDR, 94 - .end = LTQ_EIU_BASE_ADDR + LTQ_ICU_SIZE - 1, 95 - .flags = IORESOURCE_MEM, 96 - }; 97 - 63 + static int exin_avail; 98 64 static void __iomem *ltq_icu_membase; 99 65 static void __iomem *ltq_eiu_membase; 100 66 101 67 void ltq_disable_irq(struct irq_data *d) 102 68 { 103 69 u32 ier = LTQ_ICU_IM0_IER; 104 - int irq_nr = d->irq - INT_NUM_IRQ0; 70 + int offset = d->hwirq - MIPS_CPU_IRQ_CASCADE; 105 71 106 - ier += LTQ_ICU_OFFSET * (irq_nr / INT_NUM_IM_OFFSET); 107 - irq_nr %= INT_NUM_IM_OFFSET; 108 - ltq_icu_w32(ltq_icu_r32(ier) & ~(1 << irq_nr), ier); 72 + ier += LTQ_ICU_OFFSET * (offset / INT_NUM_IM_OFFSET); 73 + offset %= INT_NUM_IM_OFFSET; 74 + ltq_icu_w32(ltq_icu_r32(ier) & ~BIT(offset), ier); 109 75 } 110 76 111 77 void ltq_mask_and_ack_irq(struct irq_data *d) 112 78 { 113 79 u32 ier = LTQ_ICU_IM0_IER; 114 80 u32 isr = LTQ_ICU_IM0_ISR; 115 - int irq_nr = d->irq - INT_NUM_IRQ0; 81 + int offset = d->hwirq - MIPS_CPU_IRQ_CASCADE; 116 82 117 - ier += LTQ_ICU_OFFSET * (irq_nr / INT_NUM_IM_OFFSET); 118 - isr += LTQ_ICU_OFFSET * (irq_nr / INT_NUM_IM_OFFSET); 119 - irq_nr %= INT_NUM_IM_OFFSET; 120 - ltq_icu_w32(ltq_icu_r32(ier) & ~(1 << irq_nr), ier); 121 - ltq_icu_w32((1 << irq_nr), isr); 83 + ier += LTQ_ICU_OFFSET * (offset / INT_NUM_IM_OFFSET); 84 + isr += LTQ_ICU_OFFSET * (offset / INT_NUM_IM_OFFSET); 85 + offset %= INT_NUM_IM_OFFSET; 86 + ltq_icu_w32(ltq_icu_r32(ier) & ~BIT(offset), ier); 87 + ltq_icu_w32(BIT(offset), isr); 122 88 } 123 89 124 90 static void ltq_ack_irq(struct irq_data *d) 125 91 { 126 92 u32 isr = LTQ_ICU_IM0_ISR; 127 - int irq_nr = d->irq - INT_NUM_IRQ0; 93 + int offset = d->hwirq - MIPS_CPU_IRQ_CASCADE; 128 94 129 - isr += LTQ_ICU_OFFSET * (irq_nr / INT_NUM_IM_OFFSET); 130 - irq_nr %= INT_NUM_IM_OFFSET; 131 - ltq_icu_w32((1 << irq_nr), isr); 95 + isr += LTQ_ICU_OFFSET * (offset / INT_NUM_IM_OFFSET); 96 + offset %= INT_NUM_IM_OFFSET; 97 + ltq_icu_w32(BIT(offset), isr); 132 98 } 133 99 134 100 void ltq_enable_irq(struct irq_data *d) 135 101 { 136 102 u32 ier = LTQ_ICU_IM0_IER; 137 - int irq_nr = d->irq - INT_NUM_IRQ0; 103 + int offset = d->hwirq - MIPS_CPU_IRQ_CASCADE; 138 104 139 - ier += LTQ_ICU_OFFSET * (irq_nr / INT_NUM_IM_OFFSET); 140 - irq_nr %= INT_NUM_IM_OFFSET; 141 - ltq_icu_w32(ltq_icu_r32(ier) | (1 << irq_nr), ier); 105 + ier += LTQ_ICU_OFFSET * (offset / INT_NUM_IM_OFFSET); 106 + offset %= INT_NUM_IM_OFFSET; 107 + ltq_icu_w32(ltq_icu_r32(ier) | BIT(offset), ier); 142 108 } 143 109 144 110 static unsigned int ltq_startup_eiu_irq(struct irq_data *d) ··· 134 126 135 127 ltq_enable_irq(d); 136 128 for (i = 0; i < MAX_EIU; i++) { 137 - if (d->irq == ltq_eiu_irq[i]) { 129 + if (d->hwirq == ltq_eiu_irq[i]) { 138 130 /* low level - we should really handle set_type */ 139 131 ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_C) | 140 132 (0x6 << (i * 4)), LTQ_EIU_EXIN_C); 141 133 /* clear all pending */ 142 - ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INIC) & ~(1 << i), 134 + ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INIC) & ~BIT(i), 143 135 LTQ_EIU_EXIN_INIC); 144 136 /* enable */ 145 - ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) | (1 << i), 137 + ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) | BIT(i), 146 138 LTQ_EIU_EXIN_INEN); 147 139 break; 148 140 } ··· 157 149 158 150 ltq_disable_irq(d); 159 151 for (i = 0; i < MAX_EIU; i++) { 160 - if (d->irq == ltq_eiu_irq[i]) { 152 + if (d->hwirq == ltq_eiu_irq[i]) { 161 153 /* disable */ 162 - ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~(1 << i), 154 + ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~BIT(i), 163 155 LTQ_EIU_EXIN_INEN); 164 156 break; 165 157 } ··· 196 188 if (irq == 0) 197 189 return; 198 190 199 - /* silicon bug causes only the msb set to 1 to be valid. all 191 + /* 192 + * silicon bug causes only the msb set to 1 to be valid. all 200 193 * other bits might be bogus 201 194 */ 202 195 irq = __fls(irq); 203 - do_IRQ((int)irq + INT_NUM_IM0_IRL0 + (INT_NUM_IM_OFFSET * module)); 196 + do_IRQ((int)irq + MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module)); 204 197 205 198 /* if this is a EBU irq, we need to ack it or get a deadlock */ 206 - if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0)) 199 + if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT) 207 200 ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_ISTAT) | 0x10, 208 201 LTQ_EBU_PCC_ISTAT); 209 202 } ··· 224 215 { 225 216 do_IRQ(MIPS_CPU_TIMER_IRQ); 226 217 } 218 + 219 + #ifdef CONFIG_MIPS_MT_SMP 220 + void __init arch_init_ipiirq(int irq, struct irqaction *action) 221 + { 222 + setup_irq(irq, action); 223 + irq_set_handler(irq, handle_percpu_irq); 224 + } 225 + 226 + static void ltq_sw0_irqdispatch(void) 227 + { 228 + do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ); 229 + } 230 + 231 + static void ltq_sw1_irqdispatch(void) 232 + { 233 + do_IRQ(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ); 234 + } 235 + static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) 236 + { 237 + scheduler_ipi(); 238 + return IRQ_HANDLED; 239 + } 240 + 241 + static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 242 + { 243 + smp_call_function_interrupt(); 244 + return IRQ_HANDLED; 245 + } 246 + 247 + static struct irqaction irq_resched = { 248 + .handler = ipi_resched_interrupt, 249 + .flags = IRQF_PERCPU, 250 + .name = "IPI_resched" 251 + }; 252 + 253 + static struct irqaction irq_call = { 254 + .handler = ipi_call_interrupt, 255 + .flags = IRQF_PERCPU, 256 + .name = "IPI_call" 257 + }; 258 + #endif 227 259 228 260 asmlinkage void plat_irq_dispatch(void) 229 261 { ··· 288 238 return; 289 239 } 290 240 241 + static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) 242 + { 243 + struct irq_chip *chip = &ltq_irq_type; 244 + int i; 245 + 246 + for (i = 0; i < exin_avail; i++) 247 + if (hw == ltq_eiu_irq[i]) 248 + chip = &ltq_eiu_type; 249 + 250 + irq_set_chip_and_handler(hw, chip, handle_level_irq); 251 + 252 + return 0; 253 + } 254 + 255 + static const struct irq_domain_ops irq_domain_ops = { 256 + .xlate = irq_domain_xlate_onetwocell, 257 + .map = icu_map, 258 + }; 259 + 291 260 static struct irqaction cascade = { 292 261 .handler = no_action, 293 262 .name = "cascade", 294 263 }; 295 264 296 - void __init arch_init_irq(void) 265 + int __init icu_of_init(struct device_node *node, struct device_node *parent) 297 266 { 267 + struct device_node *eiu_node; 268 + struct resource res; 298 269 int i; 299 270 300 - if (insert_resource(&iomem_resource, &ltq_icu_resource) < 0) 301 - panic("Failed to insert icu memory"); 271 + if (of_address_to_resource(node, 0, &res)) 272 + panic("Failed to get icu memory range"); 302 273 303 - if (request_mem_region(ltq_icu_resource.start, 304 - resource_size(&ltq_icu_resource), "icu") < 0) 305 - panic("Failed to request icu memory"); 274 + if (request_mem_region(res.start, resource_size(&res), res.name) < 0) 275 + pr_err("Failed to request icu memory"); 306 276 307 - ltq_icu_membase = ioremap_nocache(ltq_icu_resource.start, 308 - resource_size(&ltq_icu_resource)); 277 + ltq_icu_membase = ioremap_nocache(res.start, resource_size(&res)); 309 278 if (!ltq_icu_membase) 310 279 panic("Failed to remap icu memory"); 311 280 312 - if (insert_resource(&iomem_resource, &ltq_eiu_resource) < 0) 313 - panic("Failed to insert eiu memory"); 281 + /* the external interrupts are optional and xway only */ 282 + eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu"); 283 + if (eiu_node && of_address_to_resource(eiu_node, 0, &res)) { 284 + /* find out how many external irq sources we have */ 285 + const __be32 *count = of_get_property(node, 286 + "lantiq,count", NULL); 314 287 315 - if (request_mem_region(ltq_eiu_resource.start, 316 - resource_size(&ltq_eiu_resource), "eiu") < 0) 317 - panic("Failed to request eiu memory"); 288 + if (count) 289 + exin_avail = *count; 290 + if (exin_avail > MAX_EIU) 291 + exin_avail = MAX_EIU; 318 292 319 - ltq_eiu_membase = ioremap_nocache(ltq_eiu_resource.start, 320 - resource_size(&ltq_eiu_resource)); 321 - if (!ltq_eiu_membase) 322 - panic("Failed to remap eiu memory"); 293 + if (request_mem_region(res.start, resource_size(&res), 294 + res.name) < 0) 295 + pr_err("Failed to request eiu memory"); 323 296 324 - /* make sure all irqs are turned off by default */ 325 - for (i = 0; i < 5; i++) 297 + ltq_eiu_membase = ioremap_nocache(res.start, 298 + resource_size(&res)); 299 + if (!ltq_eiu_membase) 300 + panic("Failed to remap eiu memory"); 301 + } 302 + 303 + /* turn off all irqs by default */ 304 + for (i = 0; i < 5; i++) { 305 + /* make sure all irqs are turned off by default */ 326 306 ltq_icu_w32(0, LTQ_ICU_IM0_IER + (i * LTQ_ICU_OFFSET)); 327 - 328 - /* clear all possibly pending interrupts */ 329 - ltq_icu_w32(~0, LTQ_ICU_IM0_ISR + (i * LTQ_ICU_OFFSET)); 307 + /* clear all possibly pending interrupts */ 308 + ltq_icu_w32(~0, LTQ_ICU_IM0_ISR + (i * LTQ_ICU_OFFSET)); 309 + } 330 310 331 311 mips_cpu_irq_init(); 332 312 ··· 373 293 set_vi_handler(7, ltq_hw5_irqdispatch); 374 294 } 375 295 376 - for (i = INT_NUM_IRQ0; 377 - i <= (INT_NUM_IRQ0 + (5 * INT_NUM_IM_OFFSET)); i++) 378 - if ((i == LTQ_EIU_IR0) || (i == LTQ_EIU_IR1) || 379 - (i == LTQ_EIU_IR2)) 380 - irq_set_chip_and_handler(i, &ltq_eiu_type, 381 - handle_level_irq); 382 - /* EIU3-5 only exist on ar9 and vr9 */ 383 - else if (((i == LTQ_EIU_IR3) || (i == LTQ_EIU_IR4) || 384 - (i == LTQ_EIU_IR5)) && (ltq_is_ar9() || ltq_is_vr9())) 385 - irq_set_chip_and_handler(i, &ltq_eiu_type, 386 - handle_level_irq); 387 - else 388 - irq_set_chip_and_handler(i, &ltq_irq_type, 389 - handle_level_irq); 296 + irq_domain_add_linear(node, 6 * INT_NUM_IM_OFFSET, 297 + &irq_domain_ops, 0); 298 + 299 + #if defined(CONFIG_MIPS_MT_SMP) 300 + if (cpu_has_vint) { 301 + pr_info("Setting up IPI vectored interrupts\n"); 302 + set_vi_handler(MIPS_CPU_IPI_RESCHED_IRQ, ltq_sw0_irqdispatch); 303 + set_vi_handler(MIPS_CPU_IPI_CALL_IRQ, ltq_sw1_irqdispatch); 304 + } 305 + arch_init_ipiirq(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_RESCHED_IRQ, 306 + &irq_resched); 307 + arch_init_ipiirq(MIPS_CPU_IRQ_BASE + MIPS_CPU_IPI_CALL_IRQ, &irq_call); 308 + #endif 390 309 391 310 #if !defined(CONFIG_MIPS_MT_SMP) && !defined(CONFIG_MIPS_MT_SMTC) 392 311 set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | ··· 394 315 set_c0_status(IE_SW0 | IE_SW1 | IE_IRQ0 | IE_IRQ1 | 395 316 IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5); 396 317 #endif 318 + 319 + /* tell oprofile which irq to use */ 320 + cp0_perfcount_irq = LTQ_PERF_IRQ; 321 + return 0; 397 322 } 398 323 399 324 unsigned int __cpuinit get_c0_compare_int(void) 400 325 { 401 326 return CP0_LEGACY_COMPARE_IRQ; 327 + } 328 + 329 + static struct of_device_id __initdata of_irq_ids[] = { 330 + { .compatible = "lantiq,icu", .data = icu_of_init }, 331 + {}, 332 + }; 333 + 334 + void __init arch_init_irq(void) 335 + { 336 + of_irq_init(of_irq_ids); 402 337 }
-20
arch/mips/lantiq/machtypes.h
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #ifndef _LANTIQ_MACH_H__ 10 - #define _LANTIQ_MACH_H__ 11 - 12 - #include <asm/mips_machine.h> 13 - 14 - enum lantiq_mach_type { 15 - LTQ_MACH_GENERIC = 0, 16 - LTQ_MACH_EASY50712, /* Danube evaluation board */ 17 - LTQ_MACH_EASY50601, /* Amazon SE evaluation board */ 18 - }; 19 - 20 - #endif
+54 -22
arch/mips/lantiq/prom.c
··· 8 8 9 9 #include <linux/export.h> 10 10 #include <linux/clk.h> 11 + #include <linux/of_platform.h> 11 12 #include <asm/bootinfo.h> 12 13 #include <asm/time.h> 13 14 ··· 17 16 #include "prom.h" 18 17 #include "clk.h" 19 18 19 + /* access to the ebu needs to be locked between different drivers */ 20 + DEFINE_SPINLOCK(ebu_lock); 21 + EXPORT_SYMBOL_GPL(ebu_lock); 22 + 23 + /* 24 + * this struct is filled by the soc specific detection code and holds 25 + * information about the specific soc type, revision and name 26 + */ 20 27 static struct ltq_soc_info soc_info; 21 - 22 - unsigned int ltq_get_cpu_ver(void) 23 - { 24 - return soc_info.rev; 25 - } 26 - EXPORT_SYMBOL(ltq_get_cpu_ver); 27 - 28 - unsigned int ltq_get_soc_type(void) 29 - { 30 - return soc_info.type; 31 - } 32 - EXPORT_SYMBOL(ltq_get_soc_type); 33 28 34 29 const char *get_system_type(void) 35 30 { ··· 42 45 char **argv = (char **) KSEG1ADDR(fw_arg1); 43 46 int i; 44 47 45 - for (i = 0; i < argc; i++) { 46 - char *p = (char *) KSEG1ADDR(argv[i]); 48 + arcs_cmdline[0] = '\0'; 47 49 48 - if (p && *p) { 50 + for (i = 0; i < argc; i++) { 51 + char *p = (char *) KSEG1ADDR(argv[i]); 52 + 53 + if (CPHYSADDR(p) && *p) { 49 54 strlcat(arcs_cmdline, p, sizeof(arcs_cmdline)); 50 55 strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline)); 51 56 } 52 57 } 53 58 } 54 59 60 + void __init plat_mem_setup(void) 61 + { 62 + ioport_resource.start = IOPORT_RESOURCE_START; 63 + ioport_resource.end = IOPORT_RESOURCE_END; 64 + iomem_resource.start = IOMEM_RESOURCE_START; 65 + iomem_resource.end = IOMEM_RESOURCE_END; 66 + 67 + set_io_port_base((unsigned long) KSEG1); 68 + 69 + /* 70 + * Load the builtin devicetree. This causes the chosen node to be 71 + * parsed resulting in our memory appearing 72 + */ 73 + __dt_setup_arch(&__dtb_start); 74 + } 75 + 55 76 void __init prom_init(void) 56 77 { 57 - struct clk *clk; 58 - 78 + /* call the soc specific detetcion code and get it to fill soc_info */ 59 79 ltq_soc_detect(&soc_info); 60 - clk_init(); 61 - clk = clk_get(0, "cpu"); 62 - snprintf(soc_info.sys_type, LTQ_SYS_TYPE_LEN - 1, "%s rev1.%d", 63 - soc_info.name, soc_info.rev); 64 - clk_put(clk); 80 + snprintf(soc_info.sys_type, LTQ_SYS_TYPE_LEN - 1, "%s rev %s", 81 + soc_info.name, soc_info.rev_type); 65 82 soc_info.sys_type[LTQ_SYS_TYPE_LEN - 1] = '\0'; 66 83 pr_info("SoC: %s\n", soc_info.sys_type); 67 84 prom_init_cmdline(); 85 + 86 + #if defined(CONFIG_MIPS_MT_SMP) 87 + if (register_vsmp_smp_ops()) 88 + panic("failed to register_vsmp_smp_ops()"); 89 + #endif 68 90 } 91 + 92 + int __init plat_of_setup(void) 93 + { 94 + static struct of_device_id of_ids[3]; 95 + 96 + if (!of_have_populated_dt()) 97 + panic("device tree not present"); 98 + 99 + strncpy(of_ids[0].compatible, soc_info.compatible, 100 + sizeof(of_ids[0].compatible)); 101 + strncpy(of_ids[1].compatible, "simple-bus", 102 + sizeof(of_ids[1].compatible)); 103 + return of_platform_bus_probe(NULL, of_ids, NULL); 104 + } 105 + 106 + arch_initcall(plat_of_setup);
+7 -1
arch/mips/lantiq/prom.h
··· 10 10 #define _LTQ_PROM_H__ 11 11 12 12 #define LTQ_SYS_TYPE_LEN 0x100 13 + #define LTQ_SYS_REV_LEN 0x10 13 14 14 15 struct ltq_soc_info { 15 16 unsigned char *name; 16 17 unsigned int rev; 18 + unsigned char rev_type[LTQ_SYS_REV_LEN]; 19 + unsigned int srev; 17 20 unsigned int partnum; 18 21 unsigned int type; 19 22 unsigned char sys_type[LTQ_SYS_TYPE_LEN]; 23 + unsigned char *compatible; 20 24 }; 21 25 22 26 extern void ltq_soc_detect(struct ltq_soc_info *i); 23 - extern void ltq_soc_setup(void); 27 + extern void ltq_soc_init(void); 28 + 29 + extern struct boot_param_header __dtb_start; 24 30 25 31 #endif
-66
arch/mips/lantiq/setup.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/export.h> 11 - #include <linux/io.h> 12 - #include <linux/ioport.h> 13 - #include <asm/bootinfo.h> 14 - 15 - #include <lantiq_soc.h> 16 - 17 - #include "machtypes.h" 18 - #include "devices.h" 19 - #include "prom.h" 20 - 21 - void __init plat_mem_setup(void) 22 - { 23 - /* assume 16M as default incase uboot fails to pass proper ramsize */ 24 - unsigned long memsize = 16; 25 - char **envp = (char **) KSEG1ADDR(fw_arg2); 26 - 27 - ioport_resource.start = IOPORT_RESOURCE_START; 28 - ioport_resource.end = IOPORT_RESOURCE_END; 29 - iomem_resource.start = IOMEM_RESOURCE_START; 30 - iomem_resource.end = IOMEM_RESOURCE_END; 31 - 32 - set_io_port_base((unsigned long) KSEG1); 33 - 34 - while (*envp) { 35 - char *e = (char *)KSEG1ADDR(*envp); 36 - if (!strncmp(e, "memsize=", 8)) { 37 - e += 8; 38 - if (strict_strtoul(e, 0, &memsize)) 39 - pr_warn("bad memsize specified\n"); 40 - } 41 - envp++; 42 - } 43 - memsize *= 1024 * 1024; 44 - add_memory_region(0x00000000, memsize, BOOT_MEM_RAM); 45 - } 46 - 47 - static int __init 48 - lantiq_setup(void) 49 - { 50 - ltq_soc_setup(); 51 - mips_machine_setup(); 52 - return 0; 53 - } 54 - 55 - arch_initcall(lantiq_setup); 56 - 57 - static void __init 58 - lantiq_generic_init(void) 59 - { 60 - /* Nothing to do */ 61 - } 62 - 63 - MIPS_MACHINE(LTQ_MACH_GENERIC, 64 - "Generic", 65 - "Generic Lantiq based board", 66 - lantiq_generic_init);
-23
arch/mips/lantiq/xway/Kconfig
··· 1 - if SOC_XWAY 2 - 3 - menu "MIPS Machine" 4 - 5 - config LANTIQ_MACH_EASY50712 6 - bool "Easy50712 - Danube" 7 - default y 8 - 9 - endmenu 10 - 11 - endif 12 - 13 - if SOC_AMAZON_SE 14 - 15 - menu "MIPS Machine" 16 - 17 - config LANTIQ_MACH_EASY50601 18 - bool "Easy50601 - Amazon SE" 19 - default y 20 - 21 - endmenu 22 - 23 - endif
+1 -7
arch/mips/lantiq/xway/Makefile
··· 1 - obj-y := pmu.o ebu.o reset.o gpio.o gpio_stp.o gpio_ebu.o devices.o dma.o 2 - 3 - obj-$(CONFIG_SOC_XWAY) += clk-xway.o prom-xway.o setup-xway.o 4 - obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o prom-ase.o setup-ase.o 5 - 6 - obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o 7 - obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o 1 + obj-y := prom.o sysctrl.o clk.o reset.o gpio.o dma.o
-48
arch/mips/lantiq/xway/clk-ase.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2011 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/io.h> 10 - #include <linux/export.h> 11 - #include <linux/init.h> 12 - #include <linux/clk.h> 13 - 14 - #include <asm/time.h> 15 - #include <asm/irq.h> 16 - #include <asm/div64.h> 17 - 18 - #include <lantiq_soc.h> 19 - 20 - /* cgu registers */ 21 - #define LTQ_CGU_SYS 0x0010 22 - 23 - unsigned int ltq_get_io_region_clock(void) 24 - { 25 - return CLOCK_133M; 26 - } 27 - EXPORT_SYMBOL(ltq_get_io_region_clock); 28 - 29 - unsigned int ltq_get_fpi_bus_clock(int fpi) 30 - { 31 - return CLOCK_133M; 32 - } 33 - EXPORT_SYMBOL(ltq_get_fpi_bus_clock); 34 - 35 - unsigned int ltq_get_cpu_hz(void) 36 - { 37 - if (ltq_cgu_r32(LTQ_CGU_SYS) & (1 << 5)) 38 - return CLOCK_266M; 39 - else 40 - return CLOCK_133M; 41 - } 42 - EXPORT_SYMBOL(ltq_get_cpu_hz); 43 - 44 - unsigned int ltq_get_fpi_hz(void) 45 - { 46 - return CLOCK_133M; 47 - } 48 - EXPORT_SYMBOL(ltq_get_fpi_hz);
-223
arch/mips/lantiq/xway/clk-xway.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/io.h> 10 - #include <linux/export.h> 11 - #include <linux/init.h> 12 - #include <linux/clk.h> 13 - 14 - #include <asm/time.h> 15 - #include <asm/irq.h> 16 - #include <asm/div64.h> 17 - 18 - #include <lantiq_soc.h> 19 - 20 - static unsigned int ltq_ram_clocks[] = { 21 - CLOCK_167M, CLOCK_133M, CLOCK_111M, CLOCK_83M }; 22 - #define DDR_HZ ltq_ram_clocks[ltq_cgu_r32(LTQ_CGU_SYS) & 0x3] 23 - 24 - #define BASIC_FREQUENCY_1 35328000 25 - #define BASIC_FREQUENCY_2 36000000 26 - #define BASIS_REQUENCY_USB 12000000 27 - 28 - #define GET_BITS(x, msb, lsb) \ 29 - (((x) & ((1 << ((msb) + 1)) - 1)) >> (lsb)) 30 - 31 - #define LTQ_CGU_PLL0_CFG 0x0004 32 - #define LTQ_CGU_PLL1_CFG 0x0008 33 - #define LTQ_CGU_PLL2_CFG 0x000C 34 - #define LTQ_CGU_SYS 0x0010 35 - #define LTQ_CGU_UPDATE 0x0014 36 - #define LTQ_CGU_IF_CLK 0x0018 37 - #define LTQ_CGU_OSC_CON 0x001C 38 - #define LTQ_CGU_SMD 0x0020 39 - #define LTQ_CGU_CT1SR 0x0028 40 - #define LTQ_CGU_CT2SR 0x002C 41 - #define LTQ_CGU_PCMCR 0x0030 42 - #define LTQ_CGU_PCI_CR 0x0034 43 - #define LTQ_CGU_PD_PC 0x0038 44 - #define LTQ_CGU_FMR 0x003C 45 - 46 - #define CGU_PLL0_PHASE_DIVIDER_ENABLE \ 47 - (ltq_cgu_r32(LTQ_CGU_PLL0_CFG) & (1 << 31)) 48 - #define CGU_PLL0_BYPASS \ 49 - (ltq_cgu_r32(LTQ_CGU_PLL0_CFG) & (1 << 30)) 50 - #define CGU_PLL0_CFG_DSMSEL \ 51 - (ltq_cgu_r32(LTQ_CGU_PLL0_CFG) & (1 << 28)) 52 - #define CGU_PLL0_CFG_FRAC_EN \ 53 - (ltq_cgu_r32(LTQ_CGU_PLL0_CFG) & (1 << 27)) 54 - #define CGU_PLL1_SRC \ 55 - (ltq_cgu_r32(LTQ_CGU_PLL1_CFG) & (1 << 31)) 56 - #define CGU_PLL2_PHASE_DIVIDER_ENABLE \ 57 - (ltq_cgu_r32(LTQ_CGU_PLL2_CFG) & (1 << 20)) 58 - #define CGU_SYS_FPI_SEL (1 << 6) 59 - #define CGU_SYS_DDR_SEL 0x3 60 - #define CGU_PLL0_SRC (1 << 29) 61 - 62 - #define CGU_PLL0_CFG_PLLK GET_BITS(ltq_cgu_r32(LTQ_CGU_PLL0_CFG), 26, 17) 63 - #define CGU_PLL0_CFG_PLLN GET_BITS(ltq_cgu_r32(LTQ_CGU_PLL0_CFG), 12, 6) 64 - #define CGU_PLL0_CFG_PLLM GET_BITS(ltq_cgu_r32(LTQ_CGU_PLL0_CFG), 5, 2) 65 - #define CGU_PLL2_SRC GET_BITS(ltq_cgu_r32(LTQ_CGU_PLL2_CFG), 18, 17) 66 - #define CGU_PLL2_CFG_INPUT_DIV GET_BITS(ltq_cgu_r32(LTQ_CGU_PLL2_CFG), 16, 13) 67 - 68 - static unsigned int ltq_get_pll0_fdiv(void); 69 - 70 - static inline unsigned int get_input_clock(int pll) 71 - { 72 - switch (pll) { 73 - case 0: 74 - if (ltq_cgu_r32(LTQ_CGU_PLL0_CFG) & CGU_PLL0_SRC) 75 - return BASIS_REQUENCY_USB; 76 - else if (CGU_PLL0_PHASE_DIVIDER_ENABLE) 77 - return BASIC_FREQUENCY_1; 78 - else 79 - return BASIC_FREQUENCY_2; 80 - case 1: 81 - if (CGU_PLL1_SRC) 82 - return BASIS_REQUENCY_USB; 83 - else if (CGU_PLL0_PHASE_DIVIDER_ENABLE) 84 - return BASIC_FREQUENCY_1; 85 - else 86 - return BASIC_FREQUENCY_2; 87 - case 2: 88 - switch (CGU_PLL2_SRC) { 89 - case 0: 90 - return ltq_get_pll0_fdiv(); 91 - case 1: 92 - return CGU_PLL2_PHASE_DIVIDER_ENABLE ? 93 - BASIC_FREQUENCY_1 : 94 - BASIC_FREQUENCY_2; 95 - case 2: 96 - return BASIS_REQUENCY_USB; 97 - } 98 - default: 99 - return 0; 100 - } 101 - } 102 - 103 - static inline unsigned int cal_dsm(int pll, unsigned int num, unsigned int den) 104 - { 105 - u64 res, clock = get_input_clock(pll); 106 - 107 - res = num * clock; 108 - do_div(res, den); 109 - return res; 110 - } 111 - 112 - static inline unsigned int mash_dsm(int pll, unsigned int M, unsigned int N, 113 - unsigned int K) 114 - { 115 - unsigned int num = ((N + 1) << 10) + K; 116 - unsigned int den = (M + 1) << 10; 117 - 118 - return cal_dsm(pll, num, den); 119 - } 120 - 121 - static inline unsigned int ssff_dsm_1(int pll, unsigned int M, unsigned int N, 122 - unsigned int K) 123 - { 124 - unsigned int num = ((N + 1) << 11) + K + 512; 125 - unsigned int den = (M + 1) << 11; 126 - 127 - return cal_dsm(pll, num, den); 128 - } 129 - 130 - static inline unsigned int ssff_dsm_2(int pll, unsigned int M, unsigned int N, 131 - unsigned int K) 132 - { 133 - unsigned int num = K >= 512 ? 134 - ((N + 1) << 12) + K - 512 : ((N + 1) << 12) + K + 3584; 135 - unsigned int den = (M + 1) << 12; 136 - 137 - return cal_dsm(pll, num, den); 138 - } 139 - 140 - static inline unsigned int dsm(int pll, unsigned int M, unsigned int N, 141 - unsigned int K, unsigned int dsmsel, unsigned int phase_div_en) 142 - { 143 - if (!dsmsel) 144 - return mash_dsm(pll, M, N, K); 145 - else if (!phase_div_en) 146 - return mash_dsm(pll, M, N, K); 147 - else 148 - return ssff_dsm_2(pll, M, N, K); 149 - } 150 - 151 - static inline unsigned int ltq_get_pll0_fosc(void) 152 - { 153 - if (CGU_PLL0_BYPASS) 154 - return get_input_clock(0); 155 - else 156 - return !CGU_PLL0_CFG_FRAC_EN 157 - ? dsm(0, CGU_PLL0_CFG_PLLM, CGU_PLL0_CFG_PLLN, 0, 158 - CGU_PLL0_CFG_DSMSEL, 159 - CGU_PLL0_PHASE_DIVIDER_ENABLE) 160 - : dsm(0, CGU_PLL0_CFG_PLLM, CGU_PLL0_CFG_PLLN, 161 - CGU_PLL0_CFG_PLLK, CGU_PLL0_CFG_DSMSEL, 162 - CGU_PLL0_PHASE_DIVIDER_ENABLE); 163 - } 164 - 165 - static unsigned int ltq_get_pll0_fdiv(void) 166 - { 167 - unsigned int div = CGU_PLL2_CFG_INPUT_DIV + 1; 168 - 169 - return (ltq_get_pll0_fosc() + (div >> 1)) / div; 170 - } 171 - 172 - unsigned int ltq_get_io_region_clock(void) 173 - { 174 - unsigned int ret = ltq_get_pll0_fosc(); 175 - 176 - switch (ltq_cgu_r32(LTQ_CGU_PLL2_CFG) & CGU_SYS_DDR_SEL) { 177 - default: 178 - case 0: 179 - return (ret + 1) / 2; 180 - case 1: 181 - return (ret * 2 + 2) / 5; 182 - case 2: 183 - return (ret + 1) / 3; 184 - case 3: 185 - return (ret + 2) / 4; 186 - } 187 - } 188 - EXPORT_SYMBOL(ltq_get_io_region_clock); 189 - 190 - unsigned int ltq_get_fpi_bus_clock(int fpi) 191 - { 192 - unsigned int ret = ltq_get_io_region_clock(); 193 - 194 - if ((fpi == 2) && (ltq_cgu_r32(LTQ_CGU_SYS) & CGU_SYS_FPI_SEL)) 195 - ret >>= 1; 196 - return ret; 197 - } 198 - EXPORT_SYMBOL(ltq_get_fpi_bus_clock); 199 - 200 - unsigned int ltq_get_cpu_hz(void) 201 - { 202 - switch (ltq_cgu_r32(LTQ_CGU_SYS) & 0xc) { 203 - case 0: 204 - return CLOCK_333M; 205 - case 4: 206 - return DDR_HZ; 207 - case 8: 208 - return DDR_HZ << 1; 209 - default: 210 - return DDR_HZ >> 1; 211 - } 212 - } 213 - EXPORT_SYMBOL(ltq_get_cpu_hz); 214 - 215 - unsigned int ltq_get_fpi_hz(void) 216 - { 217 - unsigned int ddr_clock = DDR_HZ; 218 - 219 - if (ltq_cgu_r32(LTQ_CGU_SYS) & 0x40) 220 - return ddr_clock >> 1; 221 - return ddr_clock; 222 - } 223 - EXPORT_SYMBOL(ltq_get_fpi_hz);
+151
arch/mips/lantiq/xway/clk.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 + */ 8 + 9 + #include <linux/io.h> 10 + #include <linux/export.h> 11 + #include <linux/init.h> 12 + #include <linux/clk.h> 13 + 14 + #include <asm/time.h> 15 + #include <asm/irq.h> 16 + #include <asm/div64.h> 17 + 18 + #include <lantiq_soc.h> 19 + 20 + #include "../clk.h" 21 + 22 + static unsigned int ram_clocks[] = { 23 + CLOCK_167M, CLOCK_133M, CLOCK_111M, CLOCK_83M }; 24 + #define DDR_HZ ram_clocks[ltq_cgu_r32(CGU_SYS) & 0x3] 25 + 26 + /* legacy xway clock */ 27 + #define CGU_SYS 0x10 28 + 29 + /* vr9 clock */ 30 + #define CGU_SYS_VR9 0x0c 31 + #define CGU_IF_CLK_VR9 0x24 32 + 33 + unsigned long ltq_danube_fpi_hz(void) 34 + { 35 + unsigned long ddr_clock = DDR_HZ; 36 + 37 + if (ltq_cgu_r32(CGU_SYS) & 0x40) 38 + return ddr_clock >> 1; 39 + return ddr_clock; 40 + } 41 + 42 + unsigned long ltq_danube_cpu_hz(void) 43 + { 44 + switch (ltq_cgu_r32(CGU_SYS) & 0xc) { 45 + case 0: 46 + return CLOCK_333M; 47 + case 4: 48 + return DDR_HZ; 49 + case 8: 50 + return DDR_HZ << 1; 51 + default: 52 + return DDR_HZ >> 1; 53 + } 54 + } 55 + 56 + unsigned long ltq_ar9_sys_hz(void) 57 + { 58 + if (((ltq_cgu_r32(CGU_SYS) >> 3) & 0x3) == 0x2) 59 + return CLOCK_393M; 60 + return CLOCK_333M; 61 + } 62 + 63 + unsigned long ltq_ar9_fpi_hz(void) 64 + { 65 + unsigned long sys = ltq_ar9_sys_hz(); 66 + 67 + if (ltq_cgu_r32(CGU_SYS) & BIT(0)) 68 + return sys; 69 + return sys >> 1; 70 + } 71 + 72 + unsigned long ltq_ar9_cpu_hz(void) 73 + { 74 + if (ltq_cgu_r32(CGU_SYS) & BIT(2)) 75 + return ltq_ar9_fpi_hz(); 76 + else 77 + return ltq_ar9_sys_hz(); 78 + } 79 + 80 + unsigned long ltq_vr9_cpu_hz(void) 81 + { 82 + unsigned int cpu_sel; 83 + unsigned long clk; 84 + 85 + cpu_sel = (ltq_cgu_r32(CGU_SYS_VR9) >> 4) & 0xf; 86 + 87 + switch (cpu_sel) { 88 + case 0: 89 + clk = CLOCK_600M; 90 + break; 91 + case 1: 92 + clk = CLOCK_500M; 93 + break; 94 + case 2: 95 + clk = CLOCK_393M; 96 + break; 97 + case 3: 98 + clk = CLOCK_333M; 99 + break; 100 + case 5: 101 + case 6: 102 + clk = CLOCK_196_608M; 103 + break; 104 + case 7: 105 + clk = CLOCK_167M; 106 + break; 107 + case 4: 108 + case 8: 109 + case 9: 110 + clk = CLOCK_125M; 111 + break; 112 + default: 113 + clk = 0; 114 + break; 115 + } 116 + 117 + return clk; 118 + } 119 + 120 + unsigned long ltq_vr9_fpi_hz(void) 121 + { 122 + unsigned int ocp_sel, cpu_clk; 123 + unsigned long clk; 124 + 125 + cpu_clk = ltq_vr9_cpu_hz(); 126 + ocp_sel = ltq_cgu_r32(CGU_SYS_VR9) & 0x3; 127 + 128 + switch (ocp_sel) { 129 + case 0: 130 + /* OCP ratio 1 */ 131 + clk = cpu_clk; 132 + break; 133 + case 2: 134 + /* OCP ratio 2 */ 135 + clk = cpu_clk / 2; 136 + break; 137 + case 3: 138 + /* OCP ratio 2.5 */ 139 + clk = (cpu_clk * 2) / 5; 140 + break; 141 + case 4: 142 + /* OCP ratio 3 */ 143 + clk = cpu_clk / 3; 144 + break; 145 + default: 146 + clk = 0; 147 + break; 148 + } 149 + 150 + return clk; 151 + }
-119
arch/mips/lantiq/xway/devices.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/export.h> 11 - #include <linux/types.h> 12 - #include <linux/string.h> 13 - #include <linux/mtd/physmap.h> 14 - #include <linux/kernel.h> 15 - #include <linux/reboot.h> 16 - #include <linux/platform_device.h> 17 - #include <linux/leds.h> 18 - #include <linux/etherdevice.h> 19 - #include <linux/time.h> 20 - #include <linux/io.h> 21 - #include <linux/gpio.h> 22 - 23 - #include <asm/bootinfo.h> 24 - #include <asm/irq.h> 25 - 26 - #include <lantiq_soc.h> 27 - #include <lantiq_irq.h> 28 - #include <lantiq_platform.h> 29 - 30 - #include "devices.h" 31 - 32 - /* gpio */ 33 - static struct resource ltq_gpio_resource[] = { 34 - { 35 - .name = "gpio0", 36 - .start = LTQ_GPIO0_BASE_ADDR, 37 - .end = LTQ_GPIO0_BASE_ADDR + LTQ_GPIO_SIZE - 1, 38 - .flags = IORESOURCE_MEM, 39 - }, { 40 - .name = "gpio1", 41 - .start = LTQ_GPIO1_BASE_ADDR, 42 - .end = LTQ_GPIO1_BASE_ADDR + LTQ_GPIO_SIZE - 1, 43 - .flags = IORESOURCE_MEM, 44 - }, { 45 - .name = "gpio2", 46 - .start = LTQ_GPIO2_BASE_ADDR, 47 - .end = LTQ_GPIO2_BASE_ADDR + LTQ_GPIO_SIZE - 1, 48 - .flags = IORESOURCE_MEM, 49 - } 50 - }; 51 - 52 - void __init ltq_register_gpio(void) 53 - { 54 - platform_device_register_simple("ltq_gpio", 0, 55 - &ltq_gpio_resource[0], 1); 56 - platform_device_register_simple("ltq_gpio", 1, 57 - &ltq_gpio_resource[1], 1); 58 - 59 - /* AR9 and VR9 have an extra gpio block */ 60 - if (ltq_is_ar9() || ltq_is_vr9()) { 61 - platform_device_register_simple("ltq_gpio", 2, 62 - &ltq_gpio_resource[2], 1); 63 - } 64 - } 65 - 66 - /* serial to parallel conversion */ 67 - static struct resource ltq_stp_resource = { 68 - .name = "stp", 69 - .start = LTQ_STP_BASE_ADDR, 70 - .end = LTQ_STP_BASE_ADDR + LTQ_STP_SIZE - 1, 71 - .flags = IORESOURCE_MEM, 72 - }; 73 - 74 - void __init ltq_register_gpio_stp(void) 75 - { 76 - platform_device_register_simple("ltq_stp", 0, &ltq_stp_resource, 1); 77 - } 78 - 79 - /* asc ports - amazon se has its own serial mapping */ 80 - static struct resource ltq_ase_asc_resources[] = { 81 - { 82 - .name = "asc0", 83 - .start = LTQ_ASC1_BASE_ADDR, 84 - .end = LTQ_ASC1_BASE_ADDR + LTQ_ASC_SIZE - 1, 85 - .flags = IORESOURCE_MEM, 86 - }, 87 - IRQ_RES(tx, LTQ_ASC_ASE_TIR), 88 - IRQ_RES(rx, LTQ_ASC_ASE_RIR), 89 - IRQ_RES(err, LTQ_ASC_ASE_EIR), 90 - }; 91 - 92 - void __init ltq_register_ase_asc(void) 93 - { 94 - platform_device_register_simple("ltq_asc", 0, 95 - ltq_ase_asc_resources, ARRAY_SIZE(ltq_ase_asc_resources)); 96 - } 97 - 98 - /* ethernet */ 99 - static struct resource ltq_etop_resources = { 100 - .name = "etop", 101 - .start = LTQ_ETOP_BASE_ADDR, 102 - .end = LTQ_ETOP_BASE_ADDR + LTQ_ETOP_SIZE - 1, 103 - .flags = IORESOURCE_MEM, 104 - }; 105 - 106 - static struct platform_device ltq_etop = { 107 - .name = "ltq_etop", 108 - .resource = &ltq_etop_resources, 109 - .num_resources = 1, 110 - }; 111 - 112 - void __init 113 - ltq_register_etop(struct ltq_eth_data *eth) 114 - { 115 - if (eth) { 116 - ltq_etop.dev.platform_data = eth; 117 - platform_device_register(&ltq_etop); 118 - } 119 - }
-20
arch/mips/lantiq/xway/devices.h
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #ifndef _LTQ_DEVICES_XWAY_H__ 10 - #define _LTQ_DEVICES_XWAY_H__ 11 - 12 - #include "../devices.h" 13 - #include <linux/phy.h> 14 - 15 - extern void ltq_register_gpio(void); 16 - extern void ltq_register_gpio_stp(void); 17 - extern void ltq_register_ase_asc(void); 18 - extern void ltq_register_etop(struct ltq_eth_data *eth); 19 - 20 - #endif
+39 -22
arch/mips/lantiq/xway/dma.c
··· 19 19 #include <linux/platform_device.h> 20 20 #include <linux/io.h> 21 21 #include <linux/dma-mapping.h> 22 - #include <linux/export.h> 22 + #include <linux/module.h> 23 + #include <linux/clk.h> 23 24 24 25 #include <lantiq_soc.h> 25 26 #include <xway_dma.h> ··· 55 54 #define ltq_dma_w32(x, y) ltq_w32(x, ltq_dma_membase + (y)) 56 55 #define ltq_dma_w32_mask(x, y, z) ltq_w32_mask(x, y, \ 57 56 ltq_dma_membase + (z)) 58 - 59 - static struct resource ltq_dma_resource = { 60 - .name = "dma", 61 - .start = LTQ_DMA_BASE_ADDR, 62 - .end = LTQ_DMA_BASE_ADDR + LTQ_DMA_SIZE - 1, 63 - .flags = IORESOURCE_MEM, 64 - }; 65 57 66 58 static void __iomem *ltq_dma_membase; 67 59 ··· 209 215 } 210 216 EXPORT_SYMBOL_GPL(ltq_dma_init_port); 211 217 212 - int __init 213 - ltq_dma_init(void) 218 + static int __devinit 219 + ltq_dma_init(struct platform_device *pdev) 214 220 { 221 + struct clk *clk; 222 + struct resource *res; 215 223 int i; 216 224 217 - /* insert and request the memory region */ 218 - if (insert_resource(&iomem_resource, &ltq_dma_resource) < 0) 219 - panic("Failed to insert dma memory"); 220 - 221 - if (request_mem_region(ltq_dma_resource.start, 222 - resource_size(&ltq_dma_resource), "dma") < 0) 223 - panic("Failed to request dma memory"); 225 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 226 + if (!res) 227 + panic("Failed to get dma resource"); 224 228 225 229 /* remap dma register range */ 226 - ltq_dma_membase = ioremap_nocache(ltq_dma_resource.start, 227 - resource_size(&ltq_dma_resource)); 230 + ltq_dma_membase = devm_request_and_ioremap(&pdev->dev, res); 228 231 if (!ltq_dma_membase) 229 - panic("Failed to remap dma memory"); 232 + panic("Failed to remap dma resource"); 230 233 231 234 /* power up and reset the dma engine */ 232 - ltq_pmu_enable(PMU_DMA); 235 + clk = clk_get(&pdev->dev, NULL); 236 + if (IS_ERR(clk)) 237 + panic("Failed to get dma clock"); 238 + 239 + clk_enable(clk); 233 240 ltq_dma_w32_mask(0, DMA_RESET, LTQ_DMA_CTRL); 234 241 235 242 /* disable all interrupts */ ··· 243 248 ltq_dma_w32(DMA_POLL | DMA_CLK_DIV4, LTQ_DMA_CPOLL); 244 249 ltq_dma_w32_mask(DMA_CHAN_ON, 0, LTQ_DMA_CCTRL); 245 250 } 251 + dev_info(&pdev->dev, "init done\n"); 246 252 return 0; 247 253 } 248 254 249 - postcore_initcall(ltq_dma_init); 255 + static const struct of_device_id dma_match[] = { 256 + { .compatible = "lantiq,dma-xway" }, 257 + {}, 258 + }; 259 + MODULE_DEVICE_TABLE(of, dma_match); 260 + 261 + static struct platform_driver dma_driver = { 262 + .probe = ltq_dma_init, 263 + .driver = { 264 + .name = "dma-xway", 265 + .owner = THIS_MODULE, 266 + .of_match_table = dma_match, 267 + }, 268 + }; 269 + 270 + int __init 271 + dma_init(void) 272 + { 273 + return platform_driver_register(&dma_driver); 274 + } 275 + 276 + postcore_initcall(dma_init);
-52
arch/mips/lantiq/xway/ebu.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * EBU - the external bus unit attaches PCI, NOR and NAND 7 - * 8 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 9 - */ 10 - 11 - #include <linux/kernel.h> 12 - #include <linux/module.h> 13 - #include <linux/ioport.h> 14 - 15 - #include <lantiq_soc.h> 16 - 17 - /* all access to the ebu must be locked */ 18 - DEFINE_SPINLOCK(ebu_lock); 19 - EXPORT_SYMBOL_GPL(ebu_lock); 20 - 21 - static struct resource ltq_ebu_resource = { 22 - .name = "ebu", 23 - .start = LTQ_EBU_BASE_ADDR, 24 - .end = LTQ_EBU_BASE_ADDR + LTQ_EBU_SIZE - 1, 25 - .flags = IORESOURCE_MEM, 26 - }; 27 - 28 - /* remapped base addr of the clock unit and external bus unit */ 29 - void __iomem *ltq_ebu_membase; 30 - 31 - static int __init lantiq_ebu_init(void) 32 - { 33 - /* insert and request the memory region */ 34 - if (insert_resource(&iomem_resource, &ltq_ebu_resource) < 0) 35 - panic("Failed to insert ebu memory"); 36 - 37 - if (request_mem_region(ltq_ebu_resource.start, 38 - resource_size(&ltq_ebu_resource), "ebu") < 0) 39 - panic("Failed to request ebu memory"); 40 - 41 - /* remap ebu register range */ 42 - ltq_ebu_membase = ioremap_nocache(ltq_ebu_resource.start, 43 - resource_size(&ltq_ebu_resource)); 44 - if (!ltq_ebu_membase) 45 - panic("Failed to remap ebu memory"); 46 - 47 - /* make sure to unprotect the memory region where flash is located */ 48 - ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_BUSCON0) & ~EBU_WRDIS, LTQ_EBU_BUSCON0); 49 - return 0; 50 - } 51 - 52 - postcore_initcall(lantiq_ebu_init);
-12
arch/mips/lantiq/xway/gpio.c
··· 36 36 37 37 static struct ltq_gpio ltq_gpio_port[MAX_PORTS]; 38 38 39 - int gpio_to_irq(unsigned int gpio) 40 - { 41 - return -EINVAL; 42 - } 43 - EXPORT_SYMBOL(gpio_to_irq); 44 - 45 - int irq_to_gpio(unsigned int gpio) 46 - { 47 - return -EINVAL; 48 - } 49 - EXPORT_SYMBOL(irq_to_gpio); 50 - 51 39 int ltq_gpio_request(unsigned int pin, unsigned int alt0, 52 40 unsigned int alt1, unsigned int dir, const char *name) 53 41 {
-126
arch/mips/lantiq/xway/gpio_ebu.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/export.h> 11 - #include <linux/types.h> 12 - #include <linux/platform_device.h> 13 - #include <linux/mutex.h> 14 - #include <linux/gpio.h> 15 - #include <linux/io.h> 16 - 17 - #include <lantiq_soc.h> 18 - 19 - /* 20 - * By attaching hardware latches to the EBU it is possible to create output 21 - * only gpios. This driver configures a special memory address, which when 22 - * written to outputs 16 bit to the latches. 23 - */ 24 - 25 - #define LTQ_EBU_BUSCON 0x1e7ff /* 16 bit access, slowest timing */ 26 - #define LTQ_EBU_WP 0x80000000 /* write protect bit */ 27 - 28 - /* we keep a shadow value of the last value written to the ebu */ 29 - static int ltq_ebu_gpio_shadow = 0x0; 30 - static void __iomem *ltq_ebu_gpio_membase; 31 - 32 - static void ltq_ebu_apply(void) 33 - { 34 - unsigned long flags; 35 - 36 - spin_lock_irqsave(&ebu_lock, flags); 37 - ltq_ebu_w32(LTQ_EBU_BUSCON, LTQ_EBU_BUSCON1); 38 - *((__u16 *)ltq_ebu_gpio_membase) = ltq_ebu_gpio_shadow; 39 - ltq_ebu_w32(LTQ_EBU_BUSCON | LTQ_EBU_WP, LTQ_EBU_BUSCON1); 40 - spin_unlock_irqrestore(&ebu_lock, flags); 41 - } 42 - 43 - static void ltq_ebu_set(struct gpio_chip *chip, unsigned offset, int value) 44 - { 45 - if (value) 46 - ltq_ebu_gpio_shadow |= (1 << offset); 47 - else 48 - ltq_ebu_gpio_shadow &= ~(1 << offset); 49 - ltq_ebu_apply(); 50 - } 51 - 52 - static int ltq_ebu_direction_output(struct gpio_chip *chip, unsigned offset, 53 - int value) 54 - { 55 - ltq_ebu_set(chip, offset, value); 56 - 57 - return 0; 58 - } 59 - 60 - static struct gpio_chip ltq_ebu_chip = { 61 - .label = "ltq_ebu", 62 - .direction_output = ltq_ebu_direction_output, 63 - .set = ltq_ebu_set, 64 - .base = 72, 65 - .ngpio = 16, 66 - .can_sleep = 1, 67 - .owner = THIS_MODULE, 68 - }; 69 - 70 - static int ltq_ebu_probe(struct platform_device *pdev) 71 - { 72 - int ret = 0; 73 - struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 74 - 75 - if (!res) { 76 - dev_err(&pdev->dev, "failed to get memory resource\n"); 77 - return -ENOENT; 78 - } 79 - 80 - res = devm_request_mem_region(&pdev->dev, res->start, 81 - resource_size(res), dev_name(&pdev->dev)); 82 - if (!res) { 83 - dev_err(&pdev->dev, "failed to request memory resource\n"); 84 - return -EBUSY; 85 - } 86 - 87 - ltq_ebu_gpio_membase = devm_ioremap_nocache(&pdev->dev, res->start, 88 - resource_size(res)); 89 - if (!ltq_ebu_gpio_membase) { 90 - dev_err(&pdev->dev, "Failed to ioremap mem region\n"); 91 - return -ENOMEM; 92 - } 93 - 94 - /* grab the default shadow value passed form the platform code */ 95 - ltq_ebu_gpio_shadow = (unsigned int) pdev->dev.platform_data; 96 - 97 - /* tell the ebu controller which memory address we will be using */ 98 - ltq_ebu_w32(pdev->resource->start | 0x1, LTQ_EBU_ADDRSEL1); 99 - 100 - /* write protect the region */ 101 - ltq_ebu_w32(LTQ_EBU_BUSCON | LTQ_EBU_WP, LTQ_EBU_BUSCON1); 102 - 103 - ret = gpiochip_add(&ltq_ebu_chip); 104 - if (!ret) 105 - ltq_ebu_apply(); 106 - return ret; 107 - } 108 - 109 - static struct platform_driver ltq_ebu_driver = { 110 - .probe = ltq_ebu_probe, 111 - .driver = { 112 - .name = "ltq_ebu", 113 - .owner = THIS_MODULE, 114 - }, 115 - }; 116 - 117 - static int __init ltq_ebu_init(void) 118 - { 119 - int ret = platform_driver_register(&ltq_ebu_driver); 120 - 121 - if (ret) 122 - pr_info("ltq_ebu : Error registering platform driver!"); 123 - return ret; 124 - } 125 - 126 - postcore_initcall(ltq_ebu_init);
-157
arch/mips/lantiq/xway/gpio_stp.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2007 John Crispin <blogic@openwrt.org> 7 - * 8 - */ 9 - 10 - #include <linux/slab.h> 11 - #include <linux/init.h> 12 - #include <linux/export.h> 13 - #include <linux/types.h> 14 - #include <linux/platform_device.h> 15 - #include <linux/mutex.h> 16 - #include <linux/io.h> 17 - #include <linux/gpio.h> 18 - 19 - #include <lantiq_soc.h> 20 - 21 - #define LTQ_STP_CON0 0x00 22 - #define LTQ_STP_CON1 0x04 23 - #define LTQ_STP_CPU0 0x08 24 - #define LTQ_STP_CPU1 0x0C 25 - #define LTQ_STP_AR 0x10 26 - 27 - #define LTQ_STP_CON_SWU (1 << 31) 28 - #define LTQ_STP_2HZ 0 29 - #define LTQ_STP_4HZ (1 << 23) 30 - #define LTQ_STP_8HZ (2 << 23) 31 - #define LTQ_STP_10HZ (3 << 23) 32 - #define LTQ_STP_SPEED_MASK (0xf << 23) 33 - #define LTQ_STP_UPD_FPI (1 << 31) 34 - #define LTQ_STP_UPD_MASK (3 << 30) 35 - #define LTQ_STP_ADSL_SRC (3 << 24) 36 - 37 - #define LTQ_STP_GROUP0 (1 << 0) 38 - 39 - #define LTQ_STP_RISING 0 40 - #define LTQ_STP_FALLING (1 << 26) 41 - #define LTQ_STP_EDGE_MASK (1 << 26) 42 - 43 - #define ltq_stp_r32(reg) __raw_readl(ltq_stp_membase + reg) 44 - #define ltq_stp_w32(val, reg) __raw_writel(val, ltq_stp_membase + reg) 45 - #define ltq_stp_w32_mask(clear, set, reg) \ 46 - ltq_w32((ltq_r32(ltq_stp_membase + reg) & ~(clear)) | (set), \ 47 - ltq_stp_membase + (reg)) 48 - 49 - static int ltq_stp_shadow = 0xffff; 50 - static void __iomem *ltq_stp_membase; 51 - 52 - static void ltq_stp_set(struct gpio_chip *chip, unsigned offset, int value) 53 - { 54 - if (value) 55 - ltq_stp_shadow |= (1 << offset); 56 - else 57 - ltq_stp_shadow &= ~(1 << offset); 58 - ltq_stp_w32(ltq_stp_shadow, LTQ_STP_CPU0); 59 - } 60 - 61 - static int ltq_stp_direction_output(struct gpio_chip *chip, unsigned offset, 62 - int value) 63 - { 64 - ltq_stp_set(chip, offset, value); 65 - 66 - return 0; 67 - } 68 - 69 - static struct gpio_chip ltq_stp_chip = { 70 - .label = "ltq_stp", 71 - .direction_output = ltq_stp_direction_output, 72 - .set = ltq_stp_set, 73 - .base = 48, 74 - .ngpio = 24, 75 - .can_sleep = 1, 76 - .owner = THIS_MODULE, 77 - }; 78 - 79 - static int ltq_stp_hw_init(void) 80 - { 81 - /* the 3 pins used to control the external stp */ 82 - ltq_gpio_request(4, 1, 0, 1, "stp-st"); 83 - ltq_gpio_request(5, 1, 0, 1, "stp-d"); 84 - ltq_gpio_request(6, 1, 0, 1, "stp-sh"); 85 - 86 - /* sane defaults */ 87 - ltq_stp_w32(0, LTQ_STP_AR); 88 - ltq_stp_w32(0, LTQ_STP_CPU0); 89 - ltq_stp_w32(0, LTQ_STP_CPU1); 90 - ltq_stp_w32(LTQ_STP_CON_SWU, LTQ_STP_CON0); 91 - ltq_stp_w32(0, LTQ_STP_CON1); 92 - 93 - /* rising or falling edge */ 94 - ltq_stp_w32_mask(LTQ_STP_EDGE_MASK, LTQ_STP_FALLING, LTQ_STP_CON0); 95 - 96 - /* per default stp 15-0 are set */ 97 - ltq_stp_w32_mask(0, LTQ_STP_GROUP0, LTQ_STP_CON1); 98 - 99 - /* stp are update periodically by the FPI bus */ 100 - ltq_stp_w32_mask(LTQ_STP_UPD_MASK, LTQ_STP_UPD_FPI, LTQ_STP_CON1); 101 - 102 - /* set stp update speed */ 103 - ltq_stp_w32_mask(LTQ_STP_SPEED_MASK, LTQ_STP_8HZ, LTQ_STP_CON1); 104 - 105 - /* tell the hardware that pin (led) 0 and 1 are controlled 106 - * by the dsl arc 107 - */ 108 - ltq_stp_w32_mask(0, LTQ_STP_ADSL_SRC, LTQ_STP_CON0); 109 - 110 - ltq_pmu_enable(PMU_LED); 111 - return 0; 112 - } 113 - 114 - static int __devinit ltq_stp_probe(struct platform_device *pdev) 115 - { 116 - struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 117 - int ret = 0; 118 - 119 - if (!res) 120 - return -ENOENT; 121 - res = devm_request_mem_region(&pdev->dev, res->start, 122 - resource_size(res), dev_name(&pdev->dev)); 123 - if (!res) { 124 - dev_err(&pdev->dev, "failed to request STP memory\n"); 125 - return -EBUSY; 126 - } 127 - ltq_stp_membase = devm_ioremap_nocache(&pdev->dev, res->start, 128 - resource_size(res)); 129 - if (!ltq_stp_membase) { 130 - dev_err(&pdev->dev, "failed to remap STP memory\n"); 131 - return -ENOMEM; 132 - } 133 - ret = gpiochip_add(&ltq_stp_chip); 134 - if (!ret) 135 - ret = ltq_stp_hw_init(); 136 - 137 - return ret; 138 - } 139 - 140 - static struct platform_driver ltq_stp_driver = { 141 - .probe = ltq_stp_probe, 142 - .driver = { 143 - .name = "ltq_stp", 144 - .owner = THIS_MODULE, 145 - }, 146 - }; 147 - 148 - int __init ltq_stp_init(void) 149 - { 150 - int ret = platform_driver_register(&ltq_stp_driver); 151 - 152 - if (ret) 153 - pr_info("ltq_stp: error registering platform driver"); 154 - return ret; 155 - } 156 - 157 - postcore_initcall(ltq_stp_init);
-57
arch/mips/lantiq/xway/mach-easy50601.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/platform_device.h> 11 - #include <linux/mtd/mtd.h> 12 - #include <linux/mtd/partitions.h> 13 - #include <linux/mtd/physmap.h> 14 - #include <linux/input.h> 15 - 16 - #include <lantiq.h> 17 - 18 - #include "../machtypes.h" 19 - #include "devices.h" 20 - 21 - static struct mtd_partition easy50601_partitions[] = { 22 - { 23 - .name = "uboot", 24 - .offset = 0x0, 25 - .size = 0x10000, 26 - }, 27 - { 28 - .name = "uboot_env", 29 - .offset = 0x10000, 30 - .size = 0x10000, 31 - }, 32 - { 33 - .name = "linux", 34 - .offset = 0x20000, 35 - .size = 0xE0000, 36 - }, 37 - { 38 - .name = "rootfs", 39 - .offset = 0x100000, 40 - .size = 0x300000, 41 - }, 42 - }; 43 - 44 - static struct physmap_flash_data easy50601_flash_data = { 45 - .nr_parts = ARRAY_SIZE(easy50601_partitions), 46 - .parts = easy50601_partitions, 47 - }; 48 - 49 - static void __init easy50601_init(void) 50 - { 51 - ltq_register_nor(&easy50601_flash_data); 52 - } 53 - 54 - MIPS_MACHINE(LTQ_MACH_EASY50601, 55 - "EASY50601", 56 - "EASY50601 Eval Board", 57 - easy50601_init);
-74
arch/mips/lantiq/xway/mach-easy50712.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/platform_device.h> 11 - #include <linux/mtd/mtd.h> 12 - #include <linux/mtd/partitions.h> 13 - #include <linux/mtd/physmap.h> 14 - #include <linux/input.h> 15 - #include <linux/phy.h> 16 - 17 - #include <lantiq_soc.h> 18 - #include <irq.h> 19 - 20 - #include "../machtypes.h" 21 - #include "devices.h" 22 - 23 - static struct mtd_partition easy50712_partitions[] = { 24 - { 25 - .name = "uboot", 26 - .offset = 0x0, 27 - .size = 0x10000, 28 - }, 29 - { 30 - .name = "uboot_env", 31 - .offset = 0x10000, 32 - .size = 0x10000, 33 - }, 34 - { 35 - .name = "linux", 36 - .offset = 0x20000, 37 - .size = 0xe0000, 38 - }, 39 - { 40 - .name = "rootfs", 41 - .offset = 0x100000, 42 - .size = 0x300000, 43 - }, 44 - }; 45 - 46 - static struct physmap_flash_data easy50712_flash_data = { 47 - .nr_parts = ARRAY_SIZE(easy50712_partitions), 48 - .parts = easy50712_partitions, 49 - }; 50 - 51 - static struct ltq_pci_data ltq_pci_data = { 52 - .clock = PCI_CLOCK_INT, 53 - .gpio = PCI_GNT1 | PCI_REQ1, 54 - .irq = { 55 - [14] = INT_NUM_IM0_IRL0 + 22, 56 - }, 57 - }; 58 - 59 - static struct ltq_eth_data ltq_eth_data = { 60 - .mii_mode = PHY_INTERFACE_MODE_MII, 61 - }; 62 - 63 - static void __init easy50712_init(void) 64 - { 65 - ltq_register_gpio_stp(); 66 - ltq_register_nor(&easy50712_flash_data); 67 - ltq_register_pci(&ltq_pci_data); 68 - ltq_register_etop(&ltq_eth_data); 69 - } 70 - 71 - MIPS_MACHINE(LTQ_MACH_EASY50712, 72 - "EASY50712", 73 - "EASY50712 Eval Board", 74 - easy50712_init);
-69
arch/mips/lantiq/xway/pmu.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/module.h> 11 - #include <linux/ioport.h> 12 - 13 - #include <lantiq_soc.h> 14 - 15 - /* PMU - the power management unit allows us to turn part of the core 16 - * on and off 17 - */ 18 - 19 - /* the enable / disable registers */ 20 - #define LTQ_PMU_PWDCR 0x1C 21 - #define LTQ_PMU_PWDSR 0x20 22 - 23 - #define ltq_pmu_w32(x, y) ltq_w32((x), ltq_pmu_membase + (y)) 24 - #define ltq_pmu_r32(x) ltq_r32(ltq_pmu_membase + (x)) 25 - 26 - static struct resource ltq_pmu_resource = { 27 - .name = "pmu", 28 - .start = LTQ_PMU_BASE_ADDR, 29 - .end = LTQ_PMU_BASE_ADDR + LTQ_PMU_SIZE - 1, 30 - .flags = IORESOURCE_MEM, 31 - }; 32 - 33 - static void __iomem *ltq_pmu_membase; 34 - 35 - void ltq_pmu_enable(unsigned int module) 36 - { 37 - int err = 1000000; 38 - 39 - ltq_pmu_w32(ltq_pmu_r32(LTQ_PMU_PWDCR) & ~module, LTQ_PMU_PWDCR); 40 - do {} while (--err && (ltq_pmu_r32(LTQ_PMU_PWDSR) & module)); 41 - 42 - if (!err) 43 - panic("activating PMU module failed!"); 44 - } 45 - EXPORT_SYMBOL(ltq_pmu_enable); 46 - 47 - void ltq_pmu_disable(unsigned int module) 48 - { 49 - ltq_pmu_w32(ltq_pmu_r32(LTQ_PMU_PWDCR) | module, LTQ_PMU_PWDCR); 50 - } 51 - EXPORT_SYMBOL(ltq_pmu_disable); 52 - 53 - int __init ltq_pmu_init(void) 54 - { 55 - if (insert_resource(&iomem_resource, &ltq_pmu_resource) < 0) 56 - panic("Failed to insert pmu memory"); 57 - 58 - if (request_mem_region(ltq_pmu_resource.start, 59 - resource_size(&ltq_pmu_resource), "pmu") < 0) 60 - panic("Failed to request pmu memory"); 61 - 62 - ltq_pmu_membase = ioremap_nocache(ltq_pmu_resource.start, 63 - resource_size(&ltq_pmu_resource)); 64 - if (!ltq_pmu_membase) 65 - panic("Failed to remap pmu memory"); 66 - return 0; 67 - } 68 - 69 - core_initcall(ltq_pmu_init);
-39
arch/mips/lantiq/xway/prom-ase.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/export.h> 10 - #include <linux/clk.h> 11 - #include <asm/bootinfo.h> 12 - #include <asm/time.h> 13 - 14 - #include <lantiq_soc.h> 15 - 16 - #include "../prom.h" 17 - 18 - #define SOC_AMAZON_SE "Amazon_SE" 19 - 20 - #define PART_SHIFT 12 21 - #define PART_MASK 0x0FFFFFFF 22 - #define REV_SHIFT 28 23 - #define REV_MASK 0xF0000000 24 - 25 - void __init ltq_soc_detect(struct ltq_soc_info *i) 26 - { 27 - i->partnum = (ltq_r32(LTQ_MPS_CHIPID) & PART_MASK) >> PART_SHIFT; 28 - i->rev = (ltq_r32(LTQ_MPS_CHIPID) & REV_MASK) >> REV_SHIFT; 29 - switch (i->partnum) { 30 - case SOC_ID_AMAZON_SE: 31 - i->name = SOC_AMAZON_SE; 32 - i->type = SOC_TYPE_AMAZON_SE; 33 - break; 34 - 35 - default: 36 - unreachable(); 37 - break; 38 - } 39 - }
-54
arch/mips/lantiq/xway/prom-xway.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <linux/export.h> 10 - #include <linux/clk.h> 11 - #include <asm/bootinfo.h> 12 - #include <asm/time.h> 13 - 14 - #include <lantiq_soc.h> 15 - 16 - #include "../prom.h" 17 - 18 - #define SOC_DANUBE "Danube" 19 - #define SOC_TWINPASS "Twinpass" 20 - #define SOC_AR9 "AR9" 21 - 22 - #define PART_SHIFT 12 23 - #define PART_MASK 0x0FFFFFFF 24 - #define REV_SHIFT 28 25 - #define REV_MASK 0xF0000000 26 - 27 - void __init ltq_soc_detect(struct ltq_soc_info *i) 28 - { 29 - i->partnum = (ltq_r32(LTQ_MPS_CHIPID) & PART_MASK) >> PART_SHIFT; 30 - i->rev = (ltq_r32(LTQ_MPS_CHIPID) & REV_MASK) >> REV_SHIFT; 31 - switch (i->partnum) { 32 - case SOC_ID_DANUBE1: 33 - case SOC_ID_DANUBE2: 34 - i->name = SOC_DANUBE; 35 - i->type = SOC_TYPE_DANUBE; 36 - break; 37 - 38 - case SOC_ID_TWINPASS: 39 - i->name = SOC_TWINPASS; 40 - i->type = SOC_TYPE_DANUBE; 41 - break; 42 - 43 - case SOC_ID_ARX188: 44 - case SOC_ID_ARX168: 45 - case SOC_ID_ARX182: 46 - i->name = SOC_AR9; 47 - i->type = SOC_TYPE_AR9; 48 - break; 49 - 50 - default: 51 - unreachable(); 52 - break; 53 - } 54 - }
+115
arch/mips/lantiq/xway/prom.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org> 7 + */ 8 + 9 + #include <linux/export.h> 10 + #include <linux/clk.h> 11 + #include <asm/bootinfo.h> 12 + #include <asm/time.h> 13 + 14 + #include <lantiq_soc.h> 15 + 16 + #include "../prom.h" 17 + 18 + #define SOC_DANUBE "Danube" 19 + #define SOC_TWINPASS "Twinpass" 20 + #define SOC_AMAZON_SE "Amazon_SE" 21 + #define SOC_AR9 "AR9" 22 + #define SOC_GR9 "GR9" 23 + #define SOC_VR9 "VR9" 24 + 25 + #define COMP_DANUBE "lantiq,danube" 26 + #define COMP_TWINPASS "lantiq,twinpass" 27 + #define COMP_AMAZON_SE "lantiq,ase" 28 + #define COMP_AR9 "lantiq,ar9" 29 + #define COMP_GR9 "lantiq,gr9" 30 + #define COMP_VR9 "lantiq,vr9" 31 + 32 + #define PART_SHIFT 12 33 + #define PART_MASK 0x0FFFFFFF 34 + #define REV_SHIFT 28 35 + #define REV_MASK 0xF0000000 36 + 37 + void __init ltq_soc_detect(struct ltq_soc_info *i) 38 + { 39 + i->partnum = (ltq_r32(LTQ_MPS_CHIPID) & PART_MASK) >> PART_SHIFT; 40 + i->rev = (ltq_r32(LTQ_MPS_CHIPID) & REV_MASK) >> REV_SHIFT; 41 + sprintf(i->rev_type, "1.%d", i->rev); 42 + switch (i->partnum) { 43 + case SOC_ID_DANUBE1: 44 + case SOC_ID_DANUBE2: 45 + i->name = SOC_DANUBE; 46 + i->type = SOC_TYPE_DANUBE; 47 + i->compatible = COMP_DANUBE; 48 + break; 49 + 50 + case SOC_ID_TWINPASS: 51 + i->name = SOC_TWINPASS; 52 + i->type = SOC_TYPE_DANUBE; 53 + i->compatible = COMP_TWINPASS; 54 + break; 55 + 56 + case SOC_ID_ARX188: 57 + case SOC_ID_ARX168_1: 58 + case SOC_ID_ARX168_2: 59 + case SOC_ID_ARX182: 60 + i->name = SOC_AR9; 61 + i->type = SOC_TYPE_AR9; 62 + i->compatible = COMP_AR9; 63 + break; 64 + 65 + case SOC_ID_GRX188: 66 + case SOC_ID_GRX168: 67 + i->name = SOC_GR9; 68 + i->type = SOC_TYPE_AR9; 69 + i->compatible = COMP_GR9; 70 + break; 71 + 72 + case SOC_ID_AMAZON_SE_1: 73 + case SOC_ID_AMAZON_SE_2: 74 + #ifdef CONFIG_PCI 75 + panic("ase is only supported for non pci kernels"); 76 + #endif 77 + i->name = SOC_AMAZON_SE; 78 + i->type = SOC_TYPE_AMAZON_SE; 79 + i->compatible = COMP_AMAZON_SE; 80 + break; 81 + 82 + case SOC_ID_VRX282: 83 + case SOC_ID_VRX268: 84 + case SOC_ID_VRX288: 85 + i->name = SOC_VR9; 86 + i->type = SOC_TYPE_VR9; 87 + i->compatible = COMP_VR9; 88 + break; 89 + 90 + case SOC_ID_GRX268: 91 + case SOC_ID_GRX288: 92 + i->name = SOC_GR9; 93 + i->type = SOC_TYPE_VR9; 94 + i->compatible = COMP_GR9; 95 + break; 96 + 97 + case SOC_ID_VRX268_2: 98 + case SOC_ID_VRX288_2: 99 + i->name = SOC_VR9; 100 + i->type = SOC_TYPE_VR9_2; 101 + i->compatible = COMP_VR9; 102 + break; 103 + 104 + case SOC_ID_GRX282_2: 105 + case SOC_ID_GRX288_2: 106 + i->name = SOC_GR9; 107 + i->type = SOC_TYPE_VR9_2; 108 + i->compatible = COMP_GR9; 109 + break; 110 + 111 + default: 112 + unreachable(); 113 + break; 114 + } 115 + }
+49 -28
arch/mips/lantiq/xway/reset.c
··· 11 11 #include <linux/ioport.h> 12 12 #include <linux/pm.h> 13 13 #include <linux/export.h> 14 + #include <linux/delay.h> 15 + #include <linux/of_address.h> 16 + #include <linux/of_platform.h> 17 + 14 18 #include <asm/reboot.h> 15 19 16 20 #include <lantiq_soc.h> 17 21 22 + #include "../prom.h" 23 + 18 24 #define ltq_rcu_w32(x, y) ltq_w32((x), ltq_rcu_membase + (y)) 19 25 #define ltq_rcu_r32(x) ltq_r32(ltq_rcu_membase + (x)) 20 26 21 - /* register definitions */ 22 - #define LTQ_RCU_RST 0x0010 23 - #define LTQ_RCU_RST_ALL 0x40000000 27 + /* reset request register */ 28 + #define RCU_RST_REQ 0x0010 29 + /* reset status register */ 30 + #define RCU_RST_STAT 0x0014 24 31 25 - #define LTQ_RCU_RST_STAT 0x0014 26 - #define LTQ_RCU_STAT_SHIFT 26 27 - 28 - static struct resource ltq_rcu_resource = { 29 - .name = "rcu", 30 - .start = LTQ_RCU_BASE_ADDR, 31 - .end = LTQ_RCU_BASE_ADDR + LTQ_RCU_SIZE - 1, 32 - .flags = IORESOURCE_MEM, 33 - }; 32 + /* reboot bit */ 33 + #define RCU_RD_SRST BIT(30) 34 + /* reset cause */ 35 + #define RCU_STAT_SHIFT 26 36 + /* boot selection */ 37 + #define RCU_BOOT_SEL_SHIFT 26 38 + #define RCU_BOOT_SEL_MASK 0x7 34 39 35 40 /* remapped base addr of the reset control unit */ 36 41 static void __iomem *ltq_rcu_membase; ··· 43 38 /* This function is used by the watchdog driver */ 44 39 int ltq_reset_cause(void) 45 40 { 46 - u32 val = ltq_rcu_r32(LTQ_RCU_RST_STAT); 47 - return val >> LTQ_RCU_STAT_SHIFT; 41 + u32 val = ltq_rcu_r32(RCU_RST_STAT); 42 + return val >> RCU_STAT_SHIFT; 48 43 } 49 44 EXPORT_SYMBOL_GPL(ltq_reset_cause); 50 45 46 + /* allow platform code to find out what source we booted from */ 47 + unsigned char ltq_boot_select(void) 48 + { 49 + u32 val = ltq_rcu_r32(RCU_RST_STAT); 50 + return (val >> RCU_BOOT_SEL_SHIFT) & RCU_BOOT_SEL_MASK; 51 + } 52 + 53 + /* reset a io domain for u micro seconds */ 54 + void ltq_reset_once(unsigned int module, ulong u) 55 + { 56 + ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) | module, RCU_RST_REQ); 57 + udelay(u); 58 + ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) & ~module, RCU_RST_REQ); 59 + } 60 + 51 61 static void ltq_machine_restart(char *command) 52 62 { 53 - pr_notice("System restart\n"); 54 63 local_irq_disable(); 55 - ltq_rcu_w32(ltq_rcu_r32(LTQ_RCU_RST) | LTQ_RCU_RST_ALL, LTQ_RCU_RST); 64 + ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) | RCU_RD_SRST, RCU_RST_REQ); 56 65 unreachable(); 57 66 } 58 67 59 68 static void ltq_machine_halt(void) 60 69 { 61 - pr_notice("System halted.\n"); 62 70 local_irq_disable(); 63 71 unreachable(); 64 72 } 65 73 66 74 static void ltq_machine_power_off(void) 67 75 { 68 - pr_notice("Please turn off the power now.\n"); 69 76 local_irq_disable(); 70 77 unreachable(); 71 78 } 72 79 73 80 static int __init mips_reboot_setup(void) 74 81 { 75 - /* insert and request the memory region */ 76 - if (insert_resource(&iomem_resource, &ltq_rcu_resource) < 0) 77 - panic("Failed to insert rcu memory"); 82 + struct resource res; 83 + struct device_node *np = 84 + of_find_compatible_node(NULL, NULL, "lantiq,rcu-xway"); 78 85 79 - if (request_mem_region(ltq_rcu_resource.start, 80 - resource_size(&ltq_rcu_resource), "rcu") < 0) 81 - panic("Failed to request rcu memory"); 86 + /* check if all the reset register range is available */ 87 + if (!np) 88 + panic("Failed to load reset resources from devicetree"); 82 89 83 - /* remap rcu register range */ 84 - ltq_rcu_membase = ioremap_nocache(ltq_rcu_resource.start, 85 - resource_size(&ltq_rcu_resource)); 90 + if (of_address_to_resource(np, 0, &res)) 91 + panic("Failed to get rcu memory range"); 92 + 93 + if (request_mem_region(res.start, resource_size(&res), res.name) < 0) 94 + pr_err("Failed to request rcu memory"); 95 + 96 + ltq_rcu_membase = ioremap_nocache(res.start, resource_size(&res)); 86 97 if (!ltq_rcu_membase) 87 - panic("Failed to remap rcu memory"); 98 + panic("Failed to remap core memory"); 88 99 89 100 _machine_restart = ltq_machine_restart; 90 101 _machine_halt = ltq_machine_halt;
-19
arch/mips/lantiq/xway/setup-ase.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2011 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <lantiq_soc.h> 10 - 11 - #include "../prom.h" 12 - #include "devices.h" 13 - 14 - void __init ltq_soc_setup(void) 15 - { 16 - ltq_register_ase_asc(); 17 - ltq_register_gpio(); 18 - ltq_register_wdt(); 19 - }
-20
arch/mips/lantiq/xway/setup-xway.c
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify it 3 - * under the terms of the GNU General Public License version 2 as published 4 - * by the Free Software Foundation. 5 - * 6 - * Copyright (C) 2011 John Crispin <blogic@openwrt.org> 7 - */ 8 - 9 - #include <lantiq_soc.h> 10 - 11 - #include "../prom.h" 12 - #include "devices.h" 13 - 14 - void __init ltq_soc_setup(void) 15 - { 16 - ltq_register_asc(0); 17 - ltq_register_asc(1); 18 - ltq_register_gpio(); 19 - ltq_register_wdt(); 20 - }
+371
arch/mips/lantiq/xway/sysctrl.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2011-2012 John Crispin <blogic@openwrt.org> 7 + */ 8 + 9 + #include <linux/ioport.h> 10 + #include <linux/export.h> 11 + #include <linux/clkdev.h> 12 + #include <linux/of.h> 13 + #include <linux/of_platform.h> 14 + #include <linux/of_address.h> 15 + 16 + #include <lantiq_soc.h> 17 + 18 + #include "../clk.h" 19 + #include "../prom.h" 20 + 21 + /* clock control register */ 22 + #define CGU_IFCCR 0x0018 23 + /* system clock register */ 24 + #define CGU_SYS 0x0010 25 + /* pci control register */ 26 + #define CGU_PCICR 0x0034 27 + /* ephy configuration register */ 28 + #define CGU_EPHY 0x10 29 + /* power control register */ 30 + #define PMU_PWDCR 0x1C 31 + /* power status register */ 32 + #define PMU_PWDSR 0x20 33 + /* power control register */ 34 + #define PMU_PWDCR1 0x24 35 + /* power status register */ 36 + #define PMU_PWDSR1 0x28 37 + /* power control register */ 38 + #define PWDCR(x) ((x) ? (PMU_PWDCR1) : (PMU_PWDCR)) 39 + /* power status register */ 40 + #define PWDSR(x) ((x) ? (PMU_PWDSR1) : (PMU_PWDSR)) 41 + 42 + /* clock gates that we can en/disable */ 43 + #define PMU_USB0_P BIT(0) 44 + #define PMU_PCI BIT(4) 45 + #define PMU_DMA BIT(5) 46 + #define PMU_USB0 BIT(6) 47 + #define PMU_ASC0 BIT(7) 48 + #define PMU_EPHY BIT(7) /* ase */ 49 + #define PMU_SPI BIT(8) 50 + #define PMU_DFE BIT(9) 51 + #define PMU_EBU BIT(10) 52 + #define PMU_STP BIT(11) 53 + #define PMU_GPT BIT(12) 54 + #define PMU_AHBS BIT(13) /* vr9 */ 55 + #define PMU_FPI BIT(14) 56 + #define PMU_AHBM BIT(15) 57 + #define PMU_ASC1 BIT(17) 58 + #define PMU_PPE_QSB BIT(18) 59 + #define PMU_PPE_SLL01 BIT(19) 60 + #define PMU_PPE_TC BIT(21) 61 + #define PMU_PPE_EMA BIT(22) 62 + #define PMU_PPE_DPLUM BIT(23) 63 + #define PMU_PPE_DPLUS BIT(24) 64 + #define PMU_USB1_P BIT(26) 65 + #define PMU_USB1 BIT(27) 66 + #define PMU_SWITCH BIT(28) 67 + #define PMU_PPE_TOP BIT(29) 68 + #define PMU_GPHY BIT(30) 69 + #define PMU_PCIE_CLK BIT(31) 70 + 71 + #define PMU1_PCIE_PHY BIT(0) 72 + #define PMU1_PCIE_CTL BIT(1) 73 + #define PMU1_PCIE_PDI BIT(4) 74 + #define PMU1_PCIE_MSI BIT(5) 75 + 76 + #define pmu_w32(x, y) ltq_w32((x), pmu_membase + (y)) 77 + #define pmu_r32(x) ltq_r32(pmu_membase + (x)) 78 + 79 + static void __iomem *pmu_membase; 80 + void __iomem *ltq_cgu_membase; 81 + void __iomem *ltq_ebu_membase; 82 + 83 + /* legacy function kept alive to ease clkdev transition */ 84 + void ltq_pmu_enable(unsigned int module) 85 + { 86 + int err = 1000000; 87 + 88 + pmu_w32(pmu_r32(PMU_PWDCR) & ~module, PMU_PWDCR); 89 + do {} while (--err && (pmu_r32(PMU_PWDSR) & module)); 90 + 91 + if (!err) 92 + panic("activating PMU module failed!"); 93 + } 94 + EXPORT_SYMBOL(ltq_pmu_enable); 95 + 96 + /* legacy function kept alive to ease clkdev transition */ 97 + void ltq_pmu_disable(unsigned int module) 98 + { 99 + pmu_w32(pmu_r32(PMU_PWDCR) | module, PMU_PWDCR); 100 + } 101 + EXPORT_SYMBOL(ltq_pmu_disable); 102 + 103 + /* enable a hw clock */ 104 + static int cgu_enable(struct clk *clk) 105 + { 106 + ltq_cgu_w32(ltq_cgu_r32(CGU_IFCCR) | clk->bits, CGU_IFCCR); 107 + return 0; 108 + } 109 + 110 + /* disable a hw clock */ 111 + static void cgu_disable(struct clk *clk) 112 + { 113 + ltq_cgu_w32(ltq_cgu_r32(CGU_IFCCR) & ~clk->bits, CGU_IFCCR); 114 + } 115 + 116 + /* enable a clock gate */ 117 + static int pmu_enable(struct clk *clk) 118 + { 119 + int retry = 1000000; 120 + 121 + pmu_w32(pmu_r32(PWDCR(clk->module)) & ~clk->bits, 122 + PWDCR(clk->module)); 123 + do {} while (--retry && (pmu_r32(PWDSR(clk->module)) & clk->bits)); 124 + 125 + if (!retry) 126 + panic("activating PMU module failed!\n"); 127 + 128 + return 0; 129 + } 130 + 131 + /* disable a clock gate */ 132 + static void pmu_disable(struct clk *clk) 133 + { 134 + pmu_w32(pmu_r32(PWDCR(clk->module)) | clk->bits, 135 + PWDCR(clk->module)); 136 + } 137 + 138 + /* the pci enable helper */ 139 + static int pci_enable(struct clk *clk) 140 + { 141 + unsigned int ifccr = ltq_cgu_r32(CGU_IFCCR); 142 + /* set bus clock speed */ 143 + if (of_machine_is_compatible("lantiq,ar9")) { 144 + ifccr &= ~0x1f00000; 145 + if (clk->rate == CLOCK_33M) 146 + ifccr |= 0xe00000; 147 + else 148 + ifccr |= 0x700000; /* 62.5M */ 149 + } else { 150 + ifccr &= ~0xf00000; 151 + if (clk->rate == CLOCK_33M) 152 + ifccr |= 0x800000; 153 + else 154 + ifccr |= 0x400000; /* 62.5M */ 155 + } 156 + ltq_cgu_w32(ifccr, CGU_IFCCR); 157 + pmu_enable(clk); 158 + return 0; 159 + } 160 + 161 + /* enable the external clock as a source */ 162 + static int pci_ext_enable(struct clk *clk) 163 + { 164 + ltq_cgu_w32(ltq_cgu_r32(CGU_IFCCR) & ~(1 << 16), 165 + CGU_IFCCR); 166 + ltq_cgu_w32((1 << 30), CGU_PCICR); 167 + return 0; 168 + } 169 + 170 + /* disable the external clock as a source */ 171 + static void pci_ext_disable(struct clk *clk) 172 + { 173 + ltq_cgu_w32(ltq_cgu_r32(CGU_IFCCR) | (1 << 16), 174 + CGU_IFCCR); 175 + ltq_cgu_w32((1 << 31) | (1 << 30), CGU_PCICR); 176 + } 177 + 178 + /* enable a clockout source */ 179 + static int clkout_enable(struct clk *clk) 180 + { 181 + int i; 182 + 183 + /* get the correct rate */ 184 + for (i = 0; i < 4; i++) { 185 + if (clk->rates[i] == clk->rate) { 186 + int shift = 14 - (2 * clk->module); 187 + unsigned int ifccr = ltq_cgu_r32(CGU_IFCCR); 188 + 189 + ifccr &= ~(3 << shift); 190 + ifccr |= i << shift; 191 + ltq_cgu_w32(ifccr, CGU_IFCCR); 192 + return 0; 193 + } 194 + } 195 + return -1; 196 + } 197 + 198 + /* manage the clock gates via PMU */ 199 + static void clkdev_add_pmu(const char *dev, const char *con, 200 + unsigned int module, unsigned int bits) 201 + { 202 + struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); 203 + 204 + clk->cl.dev_id = dev; 205 + clk->cl.con_id = con; 206 + clk->cl.clk = clk; 207 + clk->enable = pmu_enable; 208 + clk->disable = pmu_disable; 209 + clk->module = module; 210 + clk->bits = bits; 211 + clkdev_add(&clk->cl); 212 + } 213 + 214 + /* manage the clock generator */ 215 + static void clkdev_add_cgu(const char *dev, const char *con, 216 + unsigned int bits) 217 + { 218 + struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); 219 + 220 + clk->cl.dev_id = dev; 221 + clk->cl.con_id = con; 222 + clk->cl.clk = clk; 223 + clk->enable = cgu_enable; 224 + clk->disable = cgu_disable; 225 + clk->bits = bits; 226 + clkdev_add(&clk->cl); 227 + } 228 + 229 + /* pci needs its own enable function as the setup is a bit more complex */ 230 + static unsigned long valid_pci_rates[] = {CLOCK_33M, CLOCK_62_5M, 0}; 231 + 232 + static void clkdev_add_pci(void) 233 + { 234 + struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL); 235 + struct clk *clk_ext = kzalloc(sizeof(struct clk), GFP_KERNEL); 236 + 237 + /* main pci clock */ 238 + clk->cl.dev_id = "17000000.pci"; 239 + clk->cl.con_id = NULL; 240 + clk->cl.clk = clk; 241 + clk->rate = CLOCK_33M; 242 + clk->rates = valid_pci_rates; 243 + clk->enable = pci_enable; 244 + clk->disable = pmu_disable; 245 + clk->module = 0; 246 + clk->bits = PMU_PCI; 247 + clkdev_add(&clk->cl); 248 + 249 + /* use internal/external bus clock */ 250 + clk_ext->cl.dev_id = "17000000.pci"; 251 + clk_ext->cl.con_id = "external"; 252 + clk_ext->cl.clk = clk_ext; 253 + clk_ext->enable = pci_ext_enable; 254 + clk_ext->disable = pci_ext_disable; 255 + clkdev_add(&clk_ext->cl); 256 + } 257 + 258 + /* xway socs can generate clocks on gpio pins */ 259 + static unsigned long valid_clkout_rates[4][5] = { 260 + {CLOCK_32_768K, CLOCK_1_536M, CLOCK_2_5M, CLOCK_12M, 0}, 261 + {CLOCK_40M, CLOCK_12M, CLOCK_24M, CLOCK_48M, 0}, 262 + {CLOCK_25M, CLOCK_40M, CLOCK_30M, CLOCK_60M, 0}, 263 + {CLOCK_12M, CLOCK_50M, CLOCK_32_768K, CLOCK_25M, 0}, 264 + }; 265 + 266 + static void clkdev_add_clkout(void) 267 + { 268 + int i; 269 + 270 + for (i = 0; i < 4; i++) { 271 + struct clk *clk; 272 + char *name; 273 + 274 + name = kzalloc(sizeof("clkout0"), GFP_KERNEL); 275 + sprintf(name, "clkout%d", i); 276 + 277 + clk = kzalloc(sizeof(struct clk), GFP_KERNEL); 278 + clk->cl.dev_id = "1f103000.cgu"; 279 + clk->cl.con_id = name; 280 + clk->cl.clk = clk; 281 + clk->rate = 0; 282 + clk->rates = valid_clkout_rates[i]; 283 + clk->enable = clkout_enable; 284 + clk->module = i; 285 + clkdev_add(&clk->cl); 286 + } 287 + } 288 + 289 + /* bring up all register ranges that we need for basic system control */ 290 + void __init ltq_soc_init(void) 291 + { 292 + struct resource res_pmu, res_cgu, res_ebu; 293 + struct device_node *np_pmu = 294 + of_find_compatible_node(NULL, NULL, "lantiq,pmu-xway"); 295 + struct device_node *np_cgu = 296 + of_find_compatible_node(NULL, NULL, "lantiq,cgu-xway"); 297 + struct device_node *np_ebu = 298 + of_find_compatible_node(NULL, NULL, "lantiq,ebu-xway"); 299 + 300 + /* check if all the core register ranges are available */ 301 + if (!np_pmu || !np_cgu || !np_ebu) 302 + panic("Failed to load core nodess from devicetree"); 303 + 304 + if (of_address_to_resource(np_pmu, 0, &res_pmu) || 305 + of_address_to_resource(np_cgu, 0, &res_cgu) || 306 + of_address_to_resource(np_ebu, 0, &res_ebu)) 307 + panic("Failed to get core resources"); 308 + 309 + if ((request_mem_region(res_pmu.start, resource_size(&res_pmu), 310 + res_pmu.name) < 0) || 311 + (request_mem_region(res_cgu.start, resource_size(&res_cgu), 312 + res_cgu.name) < 0) || 313 + (request_mem_region(res_ebu.start, resource_size(&res_ebu), 314 + res_ebu.name) < 0)) 315 + pr_err("Failed to request core reources"); 316 + 317 + pmu_membase = ioremap_nocache(res_pmu.start, resource_size(&res_pmu)); 318 + ltq_cgu_membase = ioremap_nocache(res_cgu.start, 319 + resource_size(&res_cgu)); 320 + ltq_ebu_membase = ioremap_nocache(res_ebu.start, 321 + resource_size(&res_ebu)); 322 + if (!pmu_membase || !ltq_cgu_membase || !ltq_ebu_membase) 323 + panic("Failed to remap core resources"); 324 + 325 + /* make sure to unprotect the memory region where flash is located */ 326 + ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_BUSCON0) & ~EBU_WRDIS, LTQ_EBU_BUSCON0); 327 + 328 + /* add our generic xway clocks */ 329 + clkdev_add_pmu("10000000.fpi", NULL, 0, PMU_FPI); 330 + clkdev_add_pmu("1e100400.serial", NULL, 0, PMU_ASC0); 331 + clkdev_add_pmu("1e100a00.gptu", NULL, 0, PMU_GPT); 332 + clkdev_add_pmu("1e100bb0.stp", NULL, 0, PMU_STP); 333 + clkdev_add_pmu("1e104100.dma", NULL, 0, PMU_DMA); 334 + clkdev_add_pmu("1e100800.spi", NULL, 0, PMU_SPI); 335 + clkdev_add_pmu("1e105300.ebu", NULL, 0, PMU_EBU); 336 + clkdev_add_clkout(); 337 + 338 + /* add the soc dependent clocks */ 339 + if (!of_machine_is_compatible("lantiq,vr9")) 340 + clkdev_add_pmu("1e180000.etop", NULL, 0, PMU_PPE); 341 + 342 + if (!of_machine_is_compatible("lantiq,ase")) { 343 + clkdev_add_pmu("1e100c00.serial", NULL, 0, PMU_ASC1); 344 + clkdev_add_pci(); 345 + } 346 + 347 + if (of_machine_is_compatible("lantiq,ase")) { 348 + if (ltq_cgu_r32(CGU_SYS) & (1 << 5)) 349 + clkdev_add_static(CLOCK_266M, CLOCK_133M, CLOCK_133M); 350 + else 351 + clkdev_add_static(CLOCK_133M, CLOCK_133M, CLOCK_133M); 352 + clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY), 353 + clkdev_add_pmu("1e180000.etop", "ephy", 0, PMU_EPHY); 354 + } else if (of_machine_is_compatible("lantiq,vr9")) { 355 + clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(), 356 + ltq_vr9_fpi_hz()); 357 + clkdev_add_pmu("1d900000.pcie", "phy", 1, PMU1_PCIE_PHY); 358 + clkdev_add_pmu("1d900000.pcie", "bus", 0, PMU_PCIE_CLK); 359 + clkdev_add_pmu("1d900000.pcie", "msi", 1, PMU1_PCIE_MSI); 360 + clkdev_add_pmu("1d900000.pcie", "pdi", 1, PMU1_PCIE_PDI); 361 + clkdev_add_pmu("1d900000.pcie", "ctl", 1, PMU1_PCIE_CTL); 362 + clkdev_add_pmu("1d900000.pcie", "ahb", 0, PMU_AHBM | PMU_AHBS); 363 + } else if (of_machine_is_compatible("lantiq,ar9")) { 364 + clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(), 365 + ltq_ar9_fpi_hz()); 366 + clkdev_add_pmu("1e180000.etop", "switch", 0, PMU_SWITCH); 367 + } else { 368 + clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(), 369 + ltq_danube_fpi_hz()); 370 + } 371 + }
+8 -6
arch/mips/mm/c-octeon.c
··· 21 21 #include <asm/page.h> 22 22 #include <asm/pgtable.h> 23 23 #include <asm/r4kcache.h> 24 + #include <asm/traps.h> 24 25 #include <asm/mmu_context.h> 25 26 #include <asm/war.h> 26 27 ··· 249 248 } 250 249 } 251 250 251 + static void __cpuinit octeon_cache_error_setup(void) 252 + { 253 + extern char except_vec2_octeon; 254 + set_handler(0x100, &except_vec2_octeon, 0x80); 255 + } 252 256 253 257 /** 254 258 * Setup the Octeon cache flush routines ··· 261 255 */ 262 256 void __cpuinit octeon_cache_init(void) 263 257 { 264 - extern unsigned long ebase; 265 - extern char except_vec2_octeon; 266 - 267 - memcpy((void *)(ebase + 0x100), &except_vec2_octeon, 0x80); 268 - octeon_flush_cache_sigtramp(ebase + 0x100); 269 - 270 258 probe_octeon(); 271 259 272 260 shm_align_mask = PAGE_SIZE - 1; ··· 280 280 281 281 build_clear_page(); 282 282 build_copy_page(); 283 + 284 + board_cache_error_setup = octeon_cache_error_setup; 283 285 } 284 286 285 287 /**
+10 -4
arch/mips/mm/c-r4k.c
··· 32 32 #include <asm/mmu_context.h> 33 33 #include <asm/war.h> 34 34 #include <asm/cacheflush.h> /* for run_uncached() */ 35 - 35 + #include <asm/traps.h> 36 36 37 37 /* 38 38 * Special Variant of smp_call_function for use by cache functions: ··· 1385 1385 __setup("coherentio", setcoherentio); 1386 1386 #endif 1387 1387 1388 - void __cpuinit r4k_cache_init(void) 1388 + static void __cpuinit r4k_cache_error_setup(void) 1389 1389 { 1390 - extern void build_clear_page(void); 1391 - extern void build_copy_page(void); 1392 1390 extern char __weak except_vec2_generic; 1393 1391 extern char __weak except_vec2_sb1; 1394 1392 struct cpuinfo_mips *c = &current_cpu_data; ··· 1401 1403 set_uncached_handler(0x100, &except_vec2_generic, 0x80); 1402 1404 break; 1403 1405 } 1406 + } 1407 + 1408 + void __cpuinit r4k_cache_init(void) 1409 + { 1410 + extern void build_clear_page(void); 1411 + extern void build_copy_page(void); 1412 + struct cpuinfo_mips *c = &current_cpu_data; 1404 1413 1405 1414 probe_pcache(); 1406 1415 setup_scache(); ··· 1470 1465 local_r4k___flush_cache_all(NULL); 1471 1466 #endif 1472 1467 coherency_setup(); 1468 + board_cache_error_setup = r4k_cache_error_setup; 1473 1469 }
-2
arch/mips/oprofile/Makefile
··· 1 - ccflags-y := -Werror 2 - 3 1 obj-$(CONFIG_OPROFILE) += oprofile.o 4 2 5 3 DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
+12
arch/mips/oprofile/op_model_mipsxx.c
··· 298 298 } 299 299 } 300 300 301 + static irqreturn_t mipsxx_perfcount_int(int irq, void *dev_id) 302 + { 303 + return mipsxx_perfcount_handler(); 304 + } 305 + 301 306 static int __init mipsxx_init(void) 302 307 { 303 308 int counters; ··· 379 374 save_perf_irq = perf_irq; 380 375 perf_irq = mipsxx_perfcount_handler; 381 376 377 + if ((cp0_perfcount_irq >= 0) && (cp0_compare_irq != cp0_perfcount_irq)) 378 + return request_irq(cp0_perfcount_irq, mipsxx_perfcount_int, 379 + 0, "Perfcounter", save_perf_irq); 380 + 382 381 return 0; 383 382 } 384 383 385 384 static void mipsxx_exit(void) 386 385 { 387 386 int counters = op_model_mipsxx_ops.num_counters; 387 + 388 + if ((cp0_perfcount_irq >= 0) && (cp0_compare_irq != cp0_perfcount_irq)) 389 + free_irq(cp0_perfcount_irq, save_perf_irq); 388 390 389 391 counters = counters_per_cpu_to_total(counters); 390 392 on_each_cpu(reset_counters, (void *)(long)counters, 1);
+4 -2
arch/mips/pci/Makefile
··· 19 19 obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \ 20 20 ops-bcm63xx.o 21 21 obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o 22 - obj-$(CONFIG_SOC_AR724X) += pci-ath724x.o 22 + obj-$(CONFIG_SOC_AR71XX) += pci-ar71xx.o 23 + obj-$(CONFIG_PCI_AR724X) += pci-ar724x.o 23 24 24 25 # 25 26 # These are still pretty much in the old state, watch, go blind. ··· 42 41 obj-$(CONFIG_SIBYTE_BCM112X) += fixup-sb1250.o pci-sb1250.o 43 42 obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1480.o pci-bcm1480ht.o 44 43 obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o 45 - obj-$(CONFIG_SOC_XWAY) += pci-lantiq.o ops-lantiq.o 44 + obj-$(CONFIG_LANTIQ) += fixup-lantiq.o 45 + obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o 46 46 obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o 47 47 obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o 48 48 obj-$(CONFIG_TANBAC_TB0287) += fixup-tb0287.o
+40
arch/mips/pci/fixup-lantiq.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2012 John Crispin <blogic@openwrt.org> 7 + */ 8 + 9 + #include <linux/of_irq.h> 10 + #include <linux/of_pci.h> 11 + 12 + int (*ltq_pci_plat_arch_init)(struct pci_dev *dev) = NULL; 13 + int (*ltq_pci_plat_dev_init)(struct pci_dev *dev) = NULL; 14 + 15 + int pcibios_plat_dev_init(struct pci_dev *dev) 16 + { 17 + if (ltq_pci_plat_arch_init) 18 + return ltq_pci_plat_arch_init(dev); 19 + 20 + if (ltq_pci_plat_dev_init) 21 + return ltq_pci_plat_dev_init(dev); 22 + 23 + return 0; 24 + } 25 + 26 + int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 27 + { 28 + struct of_irq dev_irq; 29 + int irq; 30 + 31 + if (of_irq_map_pci(dev, &dev_irq)) { 32 + dev_err(&dev->dev, "trying to map irq for unknown slot:%d pin:%d\n", 33 + slot, pin); 34 + return 0; 35 + } 36 + irq = irq_create_of_mapping(dev_irq.controller, dev_irq.specifier, 37 + dev_irq.size); 38 + dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, irq); 39 + return irq; 40 + }
+1
arch/mips/pci/ops-loongson2.c
··· 15 15 #include <linux/pci.h> 16 16 #include <linux/kernel.h> 17 17 #include <linux/init.h> 18 + #include <linux/export.h> 18 19 19 20 #include <loongson.h> 20 21
+375
arch/mips/pci/pci-ar71xx.c
··· 1 + /* 2 + * Atheros AR71xx PCI host controller driver 3 + * 4 + * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> 5 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> 6 + * 7 + * Parts of this file are based on Atheros' 2.6.15 BSP 8 + * 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License version 2 as published 11 + * by the Free Software Foundation. 12 + */ 13 + 14 + #include <linux/resource.h> 15 + #include <linux/types.h> 16 + #include <linux/delay.h> 17 + #include <linux/bitops.h> 18 + #include <linux/pci.h> 19 + #include <linux/pci_regs.h> 20 + #include <linux/interrupt.h> 21 + 22 + #include <asm/mach-ath79/ar71xx_regs.h> 23 + #include <asm/mach-ath79/ath79.h> 24 + #include <asm/mach-ath79/pci.h> 25 + 26 + #define AR71XX_PCI_MEM_BASE 0x10000000 27 + #define AR71XX_PCI_MEM_SIZE 0x08000000 28 + 29 + #define AR71XX_PCI_WIN0_OFFS 0x10000000 30 + #define AR71XX_PCI_WIN1_OFFS 0x11000000 31 + #define AR71XX_PCI_WIN2_OFFS 0x12000000 32 + #define AR71XX_PCI_WIN3_OFFS 0x13000000 33 + #define AR71XX_PCI_WIN4_OFFS 0x14000000 34 + #define AR71XX_PCI_WIN5_OFFS 0x15000000 35 + #define AR71XX_PCI_WIN6_OFFS 0x16000000 36 + #define AR71XX_PCI_WIN7_OFFS 0x07000000 37 + 38 + #define AR71XX_PCI_CFG_BASE \ 39 + (AR71XX_PCI_MEM_BASE + AR71XX_PCI_WIN7_OFFS + 0x10000) 40 + #define AR71XX_PCI_CFG_SIZE 0x100 41 + 42 + #define AR71XX_PCI_REG_CRP_AD_CBE 0x00 43 + #define AR71XX_PCI_REG_CRP_WRDATA 0x04 44 + #define AR71XX_PCI_REG_CRP_RDDATA 0x08 45 + #define AR71XX_PCI_REG_CFG_AD 0x0c 46 + #define AR71XX_PCI_REG_CFG_CBE 0x10 47 + #define AR71XX_PCI_REG_CFG_WRDATA 0x14 48 + #define AR71XX_PCI_REG_CFG_RDDATA 0x18 49 + #define AR71XX_PCI_REG_PCI_ERR 0x1c 50 + #define AR71XX_PCI_REG_PCI_ERR_ADDR 0x20 51 + #define AR71XX_PCI_REG_AHB_ERR 0x24 52 + #define AR71XX_PCI_REG_AHB_ERR_ADDR 0x28 53 + 54 + #define AR71XX_PCI_CRP_CMD_WRITE 0x00010000 55 + #define AR71XX_PCI_CRP_CMD_READ 0x00000000 56 + #define AR71XX_PCI_CFG_CMD_READ 0x0000000a 57 + #define AR71XX_PCI_CFG_CMD_WRITE 0x0000000b 58 + 59 + #define AR71XX_PCI_INT_CORE BIT(4) 60 + #define AR71XX_PCI_INT_DEV2 BIT(2) 61 + #define AR71XX_PCI_INT_DEV1 BIT(1) 62 + #define AR71XX_PCI_INT_DEV0 BIT(0) 63 + 64 + #define AR71XX_PCI_IRQ_COUNT 5 65 + 66 + static DEFINE_SPINLOCK(ar71xx_pci_lock); 67 + static void __iomem *ar71xx_pcicfg_base; 68 + 69 + /* Byte lane enable bits */ 70 + static const u8 ar71xx_pci_ble_table[4][4] = { 71 + {0x0, 0xf, 0xf, 0xf}, 72 + {0xe, 0xd, 0xb, 0x7}, 73 + {0xc, 0xf, 0x3, 0xf}, 74 + {0xf, 0xf, 0xf, 0xf}, 75 + }; 76 + 77 + static const u32 ar71xx_pci_read_mask[8] = { 78 + 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0 79 + }; 80 + 81 + static inline u32 ar71xx_pci_get_ble(int where, int size, int local) 82 + { 83 + u32 t; 84 + 85 + t = ar71xx_pci_ble_table[size & 3][where & 3]; 86 + BUG_ON(t == 0xf); 87 + t <<= (local) ? 20 : 4; 88 + 89 + return t; 90 + } 91 + 92 + static inline u32 ar71xx_pci_bus_addr(struct pci_bus *bus, unsigned int devfn, 93 + int where) 94 + { 95 + u32 ret; 96 + 97 + if (!bus->number) { 98 + /* type 0 */ 99 + ret = (1 << PCI_SLOT(devfn)) | (PCI_FUNC(devfn) << 8) | 100 + (where & ~3); 101 + } else { 102 + /* type 1 */ 103 + ret = (bus->number << 16) | (PCI_SLOT(devfn) << 11) | 104 + (PCI_FUNC(devfn) << 8) | (where & ~3) | 1; 105 + } 106 + 107 + return ret; 108 + } 109 + 110 + static int ar71xx_pci_check_error(int quiet) 111 + { 112 + void __iomem *base = ar71xx_pcicfg_base; 113 + u32 pci_err; 114 + u32 ahb_err; 115 + 116 + pci_err = __raw_readl(base + AR71XX_PCI_REG_PCI_ERR) & 3; 117 + if (pci_err) { 118 + if (!quiet) { 119 + u32 addr; 120 + 121 + addr = __raw_readl(base + AR71XX_PCI_REG_PCI_ERR_ADDR); 122 + pr_crit("ar71xx: %s bus error %d at addr 0x%x\n", 123 + "PCI", pci_err, addr); 124 + } 125 + 126 + /* clear PCI error status */ 127 + __raw_writel(pci_err, base + AR71XX_PCI_REG_PCI_ERR); 128 + } 129 + 130 + ahb_err = __raw_readl(base + AR71XX_PCI_REG_AHB_ERR) & 1; 131 + if (ahb_err) { 132 + if (!quiet) { 133 + u32 addr; 134 + 135 + addr = __raw_readl(base + AR71XX_PCI_REG_AHB_ERR_ADDR); 136 + pr_crit("ar71xx: %s bus error %d at addr 0x%x\n", 137 + "AHB", ahb_err, addr); 138 + } 139 + 140 + /* clear AHB error status */ 141 + __raw_writel(ahb_err, base + AR71XX_PCI_REG_AHB_ERR); 142 + } 143 + 144 + return !!(ahb_err | pci_err); 145 + } 146 + 147 + static inline void ar71xx_pci_local_write(int where, int size, u32 value) 148 + { 149 + void __iomem *base = ar71xx_pcicfg_base; 150 + u32 ad_cbe; 151 + 152 + value = value << (8 * (where & 3)); 153 + 154 + ad_cbe = AR71XX_PCI_CRP_CMD_WRITE | (where & ~3); 155 + ad_cbe |= ar71xx_pci_get_ble(where, size, 1); 156 + 157 + __raw_writel(ad_cbe, base + AR71XX_PCI_REG_CRP_AD_CBE); 158 + __raw_writel(value, base + AR71XX_PCI_REG_CRP_WRDATA); 159 + } 160 + 161 + static inline int ar71xx_pci_set_cfgaddr(struct pci_bus *bus, 162 + unsigned int devfn, 163 + int where, int size, u32 cmd) 164 + { 165 + void __iomem *base = ar71xx_pcicfg_base; 166 + u32 addr; 167 + 168 + addr = ar71xx_pci_bus_addr(bus, devfn, where); 169 + 170 + __raw_writel(addr, base + AR71XX_PCI_REG_CFG_AD); 171 + __raw_writel(cmd | ar71xx_pci_get_ble(where, size, 0), 172 + base + AR71XX_PCI_REG_CFG_CBE); 173 + 174 + return ar71xx_pci_check_error(1); 175 + } 176 + 177 + static int ar71xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, 178 + int where, int size, u32 *value) 179 + { 180 + void __iomem *base = ar71xx_pcicfg_base; 181 + unsigned long flags; 182 + u32 data; 183 + int err; 184 + int ret; 185 + 186 + ret = PCIBIOS_SUCCESSFUL; 187 + data = ~0; 188 + 189 + spin_lock_irqsave(&ar71xx_pci_lock, flags); 190 + 191 + err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size, 192 + AR71XX_PCI_CFG_CMD_READ); 193 + if (err) 194 + ret = PCIBIOS_DEVICE_NOT_FOUND; 195 + else 196 + data = __raw_readl(base + AR71XX_PCI_REG_CFG_RDDATA); 197 + 198 + spin_unlock_irqrestore(&ar71xx_pci_lock, flags); 199 + 200 + *value = (data >> (8 * (where & 3))) & ar71xx_pci_read_mask[size & 7]; 201 + 202 + return ret; 203 + } 204 + 205 + static int ar71xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, 206 + int where, int size, u32 value) 207 + { 208 + void __iomem *base = ar71xx_pcicfg_base; 209 + unsigned long flags; 210 + int err; 211 + int ret; 212 + 213 + value = value << (8 * (where & 3)); 214 + ret = PCIBIOS_SUCCESSFUL; 215 + 216 + spin_lock_irqsave(&ar71xx_pci_lock, flags); 217 + 218 + err = ar71xx_pci_set_cfgaddr(bus, devfn, where, size, 219 + AR71XX_PCI_CFG_CMD_WRITE); 220 + if (err) 221 + ret = PCIBIOS_DEVICE_NOT_FOUND; 222 + else 223 + __raw_writel(value, base + AR71XX_PCI_REG_CFG_WRDATA); 224 + 225 + spin_unlock_irqrestore(&ar71xx_pci_lock, flags); 226 + 227 + return ret; 228 + } 229 + 230 + static struct pci_ops ar71xx_pci_ops = { 231 + .read = ar71xx_pci_read_config, 232 + .write = ar71xx_pci_write_config, 233 + }; 234 + 235 + static struct resource ar71xx_pci_io_resource = { 236 + .name = "PCI IO space", 237 + .start = 0, 238 + .end = 0, 239 + .flags = IORESOURCE_IO, 240 + }; 241 + 242 + static struct resource ar71xx_pci_mem_resource = { 243 + .name = "PCI memory space", 244 + .start = AR71XX_PCI_MEM_BASE, 245 + .end = AR71XX_PCI_MEM_BASE + AR71XX_PCI_MEM_SIZE - 1, 246 + .flags = IORESOURCE_MEM 247 + }; 248 + 249 + static struct pci_controller ar71xx_pci_controller = { 250 + .pci_ops = &ar71xx_pci_ops, 251 + .mem_resource = &ar71xx_pci_mem_resource, 252 + .io_resource = &ar71xx_pci_io_resource, 253 + }; 254 + 255 + static void ar71xx_pci_irq_handler(unsigned int irq, struct irq_desc *desc) 256 + { 257 + void __iomem *base = ath79_reset_base; 258 + u32 pending; 259 + 260 + pending = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_STATUS) & 261 + __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); 262 + 263 + if (pending & AR71XX_PCI_INT_DEV0) 264 + generic_handle_irq(ATH79_PCI_IRQ(0)); 265 + 266 + else if (pending & AR71XX_PCI_INT_DEV1) 267 + generic_handle_irq(ATH79_PCI_IRQ(1)); 268 + 269 + else if (pending & AR71XX_PCI_INT_DEV2) 270 + generic_handle_irq(ATH79_PCI_IRQ(2)); 271 + 272 + else if (pending & AR71XX_PCI_INT_CORE) 273 + generic_handle_irq(ATH79_PCI_IRQ(4)); 274 + 275 + else 276 + spurious_interrupt(); 277 + } 278 + 279 + static void ar71xx_pci_irq_unmask(struct irq_data *d) 280 + { 281 + unsigned int irq = d->irq - ATH79_PCI_IRQ_BASE; 282 + void __iomem *base = ath79_reset_base; 283 + u32 t; 284 + 285 + t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); 286 + __raw_writel(t | (1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); 287 + 288 + /* flush write */ 289 + __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); 290 + } 291 + 292 + static void ar71xx_pci_irq_mask(struct irq_data *d) 293 + { 294 + unsigned int irq = d->irq - ATH79_PCI_IRQ_BASE; 295 + void __iomem *base = ath79_reset_base; 296 + u32 t; 297 + 298 + t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); 299 + __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); 300 + 301 + /* flush write */ 302 + __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); 303 + } 304 + 305 + static struct irq_chip ar71xx_pci_irq_chip = { 306 + .name = "AR71XX PCI", 307 + .irq_mask = ar71xx_pci_irq_mask, 308 + .irq_unmask = ar71xx_pci_irq_unmask, 309 + .irq_mask_ack = ar71xx_pci_irq_mask, 310 + }; 311 + 312 + static __init void ar71xx_pci_irq_init(void) 313 + { 314 + void __iomem *base = ath79_reset_base; 315 + int i; 316 + 317 + __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_ENABLE); 318 + __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_STATUS); 319 + 320 + BUILD_BUG_ON(ATH79_PCI_IRQ_COUNT < AR71XX_PCI_IRQ_COUNT); 321 + 322 + for (i = ATH79_PCI_IRQ_BASE; 323 + i < ATH79_PCI_IRQ_BASE + AR71XX_PCI_IRQ_COUNT; i++) 324 + irq_set_chip_and_handler(i, &ar71xx_pci_irq_chip, 325 + handle_level_irq); 326 + 327 + irq_set_chained_handler(ATH79_CPU_IRQ_IP2, ar71xx_pci_irq_handler); 328 + } 329 + 330 + static __init void ar71xx_pci_reset(void) 331 + { 332 + void __iomem *ddr_base = ath79_ddr_base; 333 + 334 + ath79_device_reset_set(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); 335 + mdelay(100); 336 + 337 + ath79_device_reset_clear(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); 338 + mdelay(100); 339 + 340 + __raw_writel(AR71XX_PCI_WIN0_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN0); 341 + __raw_writel(AR71XX_PCI_WIN1_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN1); 342 + __raw_writel(AR71XX_PCI_WIN2_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN2); 343 + __raw_writel(AR71XX_PCI_WIN3_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN3); 344 + __raw_writel(AR71XX_PCI_WIN4_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN4); 345 + __raw_writel(AR71XX_PCI_WIN5_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN5); 346 + __raw_writel(AR71XX_PCI_WIN6_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN6); 347 + __raw_writel(AR71XX_PCI_WIN7_OFFS, ddr_base + AR71XX_DDR_REG_PCI_WIN7); 348 + 349 + mdelay(100); 350 + } 351 + 352 + __init int ar71xx_pcibios_init(void) 353 + { 354 + u32 t; 355 + 356 + ar71xx_pcicfg_base = ioremap(AR71XX_PCI_CFG_BASE, AR71XX_PCI_CFG_SIZE); 357 + if (ar71xx_pcicfg_base == NULL) 358 + return -ENOMEM; 359 + 360 + ar71xx_pci_reset(); 361 + 362 + /* setup COMMAND register */ 363 + t = PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE 364 + | PCI_COMMAND_PARITY | PCI_COMMAND_SERR | PCI_COMMAND_FAST_BACK; 365 + ar71xx_pci_local_write(PCI_COMMAND, 4, t); 366 + 367 + /* clear bus errors */ 368 + ar71xx_pci_check_error(1); 369 + 370 + ar71xx_pci_irq_init(); 371 + 372 + register_pci_controller(&ar71xx_pci_controller); 373 + 374 + return 0; 375 + }
+292
arch/mips/pci/pci-ar724x.c
··· 1 + /* 2 + * Atheros AR724X PCI host controller driver 3 + * 4 + * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com> 5 + * Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms of the GNU General Public License version 2 as published 9 + * by the Free Software Foundation. 10 + */ 11 + 12 + #include <linux/irq.h> 13 + #include <linux/pci.h> 14 + #include <asm/mach-ath79/ath79.h> 15 + #include <asm/mach-ath79/ar71xx_regs.h> 16 + #include <asm/mach-ath79/pci.h> 17 + 18 + #define AR724X_PCI_CFG_BASE 0x14000000 19 + #define AR724X_PCI_CFG_SIZE 0x1000 20 + #define AR724X_PCI_CTRL_BASE (AR71XX_APB_BASE + 0x000f0000) 21 + #define AR724X_PCI_CTRL_SIZE 0x100 22 + 23 + #define AR724X_PCI_MEM_BASE 0x10000000 24 + #define AR724X_PCI_MEM_SIZE 0x08000000 25 + 26 + #define AR724X_PCI_REG_INT_STATUS 0x4c 27 + #define AR724X_PCI_REG_INT_MASK 0x50 28 + 29 + #define AR724X_PCI_INT_DEV0 BIT(14) 30 + 31 + #define AR724X_PCI_IRQ_COUNT 1 32 + 33 + #define AR7240_BAR0_WAR_VALUE 0xffff 34 + 35 + static DEFINE_SPINLOCK(ar724x_pci_lock); 36 + static void __iomem *ar724x_pci_devcfg_base; 37 + static void __iomem *ar724x_pci_ctrl_base; 38 + 39 + static u32 ar724x_pci_bar0_value; 40 + static bool ar724x_pci_bar0_is_cached; 41 + 42 + static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where, 43 + int size, uint32_t *value) 44 + { 45 + unsigned long flags; 46 + void __iomem *base; 47 + u32 data; 48 + 49 + if (devfn) 50 + return PCIBIOS_DEVICE_NOT_FOUND; 51 + 52 + base = ar724x_pci_devcfg_base; 53 + 54 + spin_lock_irqsave(&ar724x_pci_lock, flags); 55 + data = __raw_readl(base + (where & ~3)); 56 + 57 + switch (size) { 58 + case 1: 59 + if (where & 1) 60 + data >>= 8; 61 + if (where & 2) 62 + data >>= 16; 63 + data &= 0xff; 64 + break; 65 + case 2: 66 + if (where & 2) 67 + data >>= 16; 68 + data &= 0xffff; 69 + break; 70 + case 4: 71 + break; 72 + default: 73 + spin_unlock_irqrestore(&ar724x_pci_lock, flags); 74 + 75 + return PCIBIOS_BAD_REGISTER_NUMBER; 76 + } 77 + 78 + spin_unlock_irqrestore(&ar724x_pci_lock, flags); 79 + 80 + if (where == PCI_BASE_ADDRESS_0 && size == 4 && 81 + ar724x_pci_bar0_is_cached) { 82 + /* use the cached value */ 83 + *value = ar724x_pci_bar0_value; 84 + } else { 85 + *value = data; 86 + } 87 + 88 + return PCIBIOS_SUCCESSFUL; 89 + } 90 + 91 + static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where, 92 + int size, uint32_t value) 93 + { 94 + unsigned long flags; 95 + void __iomem *base; 96 + u32 data; 97 + int s; 98 + 99 + if (devfn) 100 + return PCIBIOS_DEVICE_NOT_FOUND; 101 + 102 + if (soc_is_ar7240() && where == PCI_BASE_ADDRESS_0 && size == 4) { 103 + if (value != 0xffffffff) { 104 + /* 105 + * WAR for a hw issue. If the BAR0 register of the 106 + * device is set to the proper base address, the 107 + * memory space of the device is not accessible. 108 + * 109 + * Cache the intended value so it can be read back, 110 + * and write a SoC specific constant value to the 111 + * BAR0 register in order to make the device memory 112 + * accessible. 113 + */ 114 + ar724x_pci_bar0_is_cached = true; 115 + ar724x_pci_bar0_value = value; 116 + 117 + value = AR7240_BAR0_WAR_VALUE; 118 + } else { 119 + ar724x_pci_bar0_is_cached = false; 120 + } 121 + } 122 + 123 + base = ar724x_pci_devcfg_base; 124 + 125 + spin_lock_irqsave(&ar724x_pci_lock, flags); 126 + data = __raw_readl(base + (where & ~3)); 127 + 128 + switch (size) { 129 + case 1: 130 + s = ((where & 3) * 8); 131 + data &= ~(0xff << s); 132 + data |= ((value & 0xff) << s); 133 + break; 134 + case 2: 135 + s = ((where & 2) * 8); 136 + data &= ~(0xffff << s); 137 + data |= ((value & 0xffff) << s); 138 + break; 139 + case 4: 140 + data = value; 141 + break; 142 + default: 143 + spin_unlock_irqrestore(&ar724x_pci_lock, flags); 144 + 145 + return PCIBIOS_BAD_REGISTER_NUMBER; 146 + } 147 + 148 + __raw_writel(data, base + (where & ~3)); 149 + /* flush write */ 150 + __raw_readl(base + (where & ~3)); 151 + spin_unlock_irqrestore(&ar724x_pci_lock, flags); 152 + 153 + return PCIBIOS_SUCCESSFUL; 154 + } 155 + 156 + static struct pci_ops ar724x_pci_ops = { 157 + .read = ar724x_pci_read, 158 + .write = ar724x_pci_write, 159 + }; 160 + 161 + static struct resource ar724x_io_resource = { 162 + .name = "PCI IO space", 163 + .start = 0, 164 + .end = 0, 165 + .flags = IORESOURCE_IO, 166 + }; 167 + 168 + static struct resource ar724x_mem_resource = { 169 + .name = "PCI memory space", 170 + .start = AR724X_PCI_MEM_BASE, 171 + .end = AR724X_PCI_MEM_BASE + AR724X_PCI_MEM_SIZE - 1, 172 + .flags = IORESOURCE_MEM, 173 + }; 174 + 175 + static struct pci_controller ar724x_pci_controller = { 176 + .pci_ops = &ar724x_pci_ops, 177 + .io_resource = &ar724x_io_resource, 178 + .mem_resource = &ar724x_mem_resource, 179 + }; 180 + 181 + static void ar724x_pci_irq_handler(unsigned int irq, struct irq_desc *desc) 182 + { 183 + void __iomem *base; 184 + u32 pending; 185 + 186 + base = ar724x_pci_ctrl_base; 187 + 188 + pending = __raw_readl(base + AR724X_PCI_REG_INT_STATUS) & 189 + __raw_readl(base + AR724X_PCI_REG_INT_MASK); 190 + 191 + if (pending & AR724X_PCI_INT_DEV0) 192 + generic_handle_irq(ATH79_PCI_IRQ(0)); 193 + 194 + else 195 + spurious_interrupt(); 196 + } 197 + 198 + static void ar724x_pci_irq_unmask(struct irq_data *d) 199 + { 200 + void __iomem *base; 201 + u32 t; 202 + 203 + base = ar724x_pci_ctrl_base; 204 + 205 + switch (d->irq) { 206 + case ATH79_PCI_IRQ(0): 207 + t = __raw_readl(base + AR724X_PCI_REG_INT_MASK); 208 + __raw_writel(t | AR724X_PCI_INT_DEV0, 209 + base + AR724X_PCI_REG_INT_MASK); 210 + /* flush write */ 211 + __raw_readl(base + AR724X_PCI_REG_INT_MASK); 212 + } 213 + } 214 + 215 + static void ar724x_pci_irq_mask(struct irq_data *d) 216 + { 217 + void __iomem *base; 218 + u32 t; 219 + 220 + base = ar724x_pci_ctrl_base; 221 + 222 + switch (d->irq) { 223 + case ATH79_PCI_IRQ(0): 224 + t = __raw_readl(base + AR724X_PCI_REG_INT_MASK); 225 + __raw_writel(t & ~AR724X_PCI_INT_DEV0, 226 + base + AR724X_PCI_REG_INT_MASK); 227 + 228 + /* flush write */ 229 + __raw_readl(base + AR724X_PCI_REG_INT_MASK); 230 + 231 + t = __raw_readl(base + AR724X_PCI_REG_INT_STATUS); 232 + __raw_writel(t | AR724X_PCI_INT_DEV0, 233 + base + AR724X_PCI_REG_INT_STATUS); 234 + 235 + /* flush write */ 236 + __raw_readl(base + AR724X_PCI_REG_INT_STATUS); 237 + } 238 + } 239 + 240 + static struct irq_chip ar724x_pci_irq_chip = { 241 + .name = "AR724X PCI ", 242 + .irq_mask = ar724x_pci_irq_mask, 243 + .irq_unmask = ar724x_pci_irq_unmask, 244 + .irq_mask_ack = ar724x_pci_irq_mask, 245 + }; 246 + 247 + static void __init ar724x_pci_irq_init(int irq) 248 + { 249 + void __iomem *base; 250 + int i; 251 + 252 + base = ar724x_pci_ctrl_base; 253 + 254 + __raw_writel(0, base + AR724X_PCI_REG_INT_MASK); 255 + __raw_writel(0, base + AR724X_PCI_REG_INT_STATUS); 256 + 257 + BUILD_BUG_ON(ATH79_PCI_IRQ_COUNT < AR724X_PCI_IRQ_COUNT); 258 + 259 + for (i = ATH79_PCI_IRQ_BASE; 260 + i < ATH79_PCI_IRQ_BASE + AR724X_PCI_IRQ_COUNT; i++) 261 + irq_set_chip_and_handler(i, &ar724x_pci_irq_chip, 262 + handle_level_irq); 263 + 264 + irq_set_chained_handler(irq, ar724x_pci_irq_handler); 265 + } 266 + 267 + int __init ar724x_pcibios_init(int irq) 268 + { 269 + int ret; 270 + 271 + ret = -ENOMEM; 272 + 273 + ar724x_pci_devcfg_base = ioremap(AR724X_PCI_CFG_BASE, 274 + AR724X_PCI_CFG_SIZE); 275 + if (ar724x_pci_devcfg_base == NULL) 276 + goto err; 277 + 278 + ar724x_pci_ctrl_base = ioremap(AR724X_PCI_CTRL_BASE, 279 + AR724X_PCI_CTRL_SIZE); 280 + if (ar724x_pci_ctrl_base == NULL) 281 + goto err_unmap_devcfg; 282 + 283 + ar724x_pci_irq_init(irq); 284 + register_pci_controller(&ar724x_pci_controller); 285 + 286 + return PCIBIOS_SUCCESSFUL; 287 + 288 + err_unmap_devcfg: 289 + iounmap(ar724x_pci_devcfg_base); 290 + err: 291 + return ret; 292 + }
-174
arch/mips/pci/pci-ath724x.c
··· 1 - /* 2 - * Atheros 724x PCI support 3 - * 4 - * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com> 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License version 2 as published 8 - * by the Free Software Foundation. 9 - */ 10 - 11 - #include <linux/pci.h> 12 - #include <asm/mach-ath79/pci-ath724x.h> 13 - 14 - #define reg_read(_phys) (*(unsigned int *) KSEG1ADDR(_phys)) 15 - #define reg_write(_phys, _val) ((*(unsigned int *) KSEG1ADDR(_phys)) = (_val)) 16 - 17 - #define ATH724X_PCI_DEV_BASE 0x14000000 18 - #define ATH724X_PCI_MEM_BASE 0x10000000 19 - #define ATH724X_PCI_MEM_SIZE 0x08000000 20 - 21 - static DEFINE_SPINLOCK(ath724x_pci_lock); 22 - static struct ath724x_pci_data *pci_data; 23 - static int pci_data_size; 24 - 25 - static int ath724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where, 26 - int size, uint32_t *value) 27 - { 28 - unsigned long flags, addr, tval, mask; 29 - 30 - if (devfn) 31 - return PCIBIOS_DEVICE_NOT_FOUND; 32 - 33 - if (where & (size - 1)) 34 - return PCIBIOS_BAD_REGISTER_NUMBER; 35 - 36 - spin_lock_irqsave(&ath724x_pci_lock, flags); 37 - 38 - switch (size) { 39 - case 1: 40 - addr = where & ~3; 41 - mask = 0xff000000 >> ((where % 4) * 8); 42 - tval = reg_read(ATH724X_PCI_DEV_BASE + addr); 43 - tval = tval & ~mask; 44 - *value = (tval >> ((4 - (where % 4))*8)); 45 - break; 46 - case 2: 47 - addr = where & ~3; 48 - mask = 0xffff0000 >> ((where % 4)*8); 49 - tval = reg_read(ATH724X_PCI_DEV_BASE + addr); 50 - tval = tval & ~mask; 51 - *value = (tval >> ((4 - (where % 4))*8)); 52 - break; 53 - case 4: 54 - *value = reg_read(ATH724X_PCI_DEV_BASE + where); 55 - break; 56 - default: 57 - spin_unlock_irqrestore(&ath724x_pci_lock, flags); 58 - 59 - return PCIBIOS_BAD_REGISTER_NUMBER; 60 - } 61 - 62 - spin_unlock_irqrestore(&ath724x_pci_lock, flags); 63 - 64 - return PCIBIOS_SUCCESSFUL; 65 - } 66 - 67 - static int ath724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where, 68 - int size, uint32_t value) 69 - { 70 - unsigned long flags, tval, addr, mask; 71 - 72 - if (devfn) 73 - return PCIBIOS_DEVICE_NOT_FOUND; 74 - 75 - if (where & (size - 1)) 76 - return PCIBIOS_BAD_REGISTER_NUMBER; 77 - 78 - spin_lock_irqsave(&ath724x_pci_lock, flags); 79 - 80 - switch (size) { 81 - case 1: 82 - addr = (ATH724X_PCI_DEV_BASE + where) & ~3; 83 - mask = 0xff000000 >> ((where % 4)*8); 84 - tval = reg_read(addr); 85 - tval = tval & ~mask; 86 - tval |= (value << ((4 - (where % 4))*8)) & mask; 87 - reg_write(addr, tval); 88 - break; 89 - case 2: 90 - addr = (ATH724X_PCI_DEV_BASE + where) & ~3; 91 - mask = 0xffff0000 >> ((where % 4)*8); 92 - tval = reg_read(addr); 93 - tval = tval & ~mask; 94 - tval |= (value << ((4 - (where % 4))*8)) & mask; 95 - reg_write(addr, tval); 96 - break; 97 - case 4: 98 - reg_write((ATH724X_PCI_DEV_BASE + where), value); 99 - break; 100 - default: 101 - spin_unlock_irqrestore(&ath724x_pci_lock, flags); 102 - 103 - return PCIBIOS_BAD_REGISTER_NUMBER; 104 - } 105 - 106 - spin_unlock_irqrestore(&ath724x_pci_lock, flags); 107 - 108 - return PCIBIOS_SUCCESSFUL; 109 - } 110 - 111 - static struct pci_ops ath724x_pci_ops = { 112 - .read = ath724x_pci_read, 113 - .write = ath724x_pci_write, 114 - }; 115 - 116 - static struct resource ath724x_io_resource = { 117 - .name = "PCI IO space", 118 - .start = 0, 119 - .end = 0, 120 - .flags = IORESOURCE_IO, 121 - }; 122 - 123 - static struct resource ath724x_mem_resource = { 124 - .name = "PCI memory space", 125 - .start = ATH724X_PCI_MEM_BASE, 126 - .end = ATH724X_PCI_MEM_BASE + ATH724X_PCI_MEM_SIZE - 1, 127 - .flags = IORESOURCE_MEM, 128 - }; 129 - 130 - static struct pci_controller ath724x_pci_controller = { 131 - .pci_ops = &ath724x_pci_ops, 132 - .io_resource = &ath724x_io_resource, 133 - .mem_resource = &ath724x_mem_resource, 134 - }; 135 - 136 - void ath724x_pci_add_data(struct ath724x_pci_data *data, int size) 137 - { 138 - pci_data = data; 139 - pci_data_size = size; 140 - } 141 - 142 - int __init pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin) 143 - { 144 - unsigned int devfn = dev->devfn; 145 - int irq = -1; 146 - 147 - if (devfn > pci_data_size - 1) 148 - return irq; 149 - 150 - irq = pci_data[devfn].irq; 151 - 152 - return irq; 153 - } 154 - 155 - int pcibios_plat_dev_init(struct pci_dev *dev) 156 - { 157 - unsigned int devfn = dev->devfn; 158 - 159 - if (devfn > pci_data_size - 1) 160 - return PCIBIOS_DEVICE_NOT_FOUND; 161 - 162 - dev->dev.platform_data = pci_data[devfn].pdata; 163 - 164 - return PCIBIOS_SUCCESSFUL; 165 - } 166 - 167 - static int __init ath724x_pcibios_init(void) 168 - { 169 - register_pci_controller(&ath724x_pci_controller); 170 - 171 - return PCIBIOS_SUCCESSFUL; 172 - } 173 - 174 - arch_initcall(ath724x_pcibios_init);
+85 -134
arch/mips/pci/pci-lantiq.c
··· 13 13 #include <linux/delay.h> 14 14 #include <linux/mm.h> 15 15 #include <linux/vmalloc.h> 16 - #include <linux/export.h> 17 - #include <linux/platform_device.h> 16 + #include <linux/module.h> 17 + #include <linux/clk.h> 18 + #include <linux/of_platform.h> 19 + #include <linux/of_gpio.h> 20 + #include <linux/of_irq.h> 21 + #include <linux/of_pci.h> 18 22 19 23 #include <asm/pci.h> 20 24 #include <asm/gpio.h> ··· 26 22 27 23 #include <lantiq_soc.h> 28 24 #include <lantiq_irq.h> 29 - #include <lantiq_platform.h> 30 25 31 26 #include "pci-lantiq.h" 32 - 33 - #define LTQ_PCI_CFG_BASE 0x17000000 34 - #define LTQ_PCI_CFG_SIZE 0x00008000 35 - #define LTQ_PCI_MEM_BASE 0x18000000 36 - #define LTQ_PCI_MEM_SIZE 0x02000000 37 - #define LTQ_PCI_IO_BASE 0x1AE00000 38 - #define LTQ_PCI_IO_SIZE 0x00200000 39 27 40 28 #define PCI_CR_FCI_ADDR_MAP0 0x00C0 41 29 #define PCI_CR_FCI_ADDR_MAP1 0x00C4 ··· 64 68 #define ltq_pci_cfg_w32(x, y) ltq_w32((x), ltq_pci_mapped_cfg + (y)) 65 69 #define ltq_pci_cfg_r32(x) ltq_r32(ltq_pci_mapped_cfg + (x)) 66 70 67 - struct ltq_pci_gpio_map { 68 - int pin; 69 - int alt0; 70 - int alt1; 71 - int dir; 72 - char *name; 73 - }; 74 - 75 - /* the pci core can make use of the following gpios */ 76 - static struct ltq_pci_gpio_map ltq_pci_gpio_map[] = { 77 - { 0, 1, 0, 0, "pci-exin0" }, 78 - { 1, 1, 0, 0, "pci-exin1" }, 79 - { 2, 1, 0, 0, "pci-exin2" }, 80 - { 39, 1, 0, 0, "pci-exin3" }, 81 - { 10, 1, 0, 0, "pci-exin4" }, 82 - { 9, 1, 0, 0, "pci-exin5" }, 83 - { 30, 1, 0, 1, "pci-gnt1" }, 84 - { 23, 1, 0, 1, "pci-gnt2" }, 85 - { 19, 1, 0, 1, "pci-gnt3" }, 86 - { 38, 1, 0, 1, "pci-gnt4" }, 87 - { 29, 1, 0, 0, "pci-req1" }, 88 - { 31, 1, 0, 0, "pci-req2" }, 89 - { 3, 1, 0, 0, "pci-req3" }, 90 - { 37, 1, 0, 0, "pci-req4" }, 91 - }; 92 - 93 71 __iomem void *ltq_pci_mapped_cfg; 94 72 static __iomem void *ltq_pci_membase; 95 73 96 - int (*ltqpci_plat_dev_init)(struct pci_dev *dev) = NULL; 97 - 98 - /* Since the PCI REQ pins can be reused for other functionality, make it 99 - possible to exclude those from interpretation by the PCI controller */ 100 - static int ltq_pci_req_mask = 0xf; 101 - 102 - static int *ltq_pci_irq_map; 103 - 104 - struct pci_ops ltq_pci_ops = { 74 + static int reset_gpio; 75 + static struct clk *clk_pci, *clk_external; 76 + static struct resource pci_io_resource; 77 + static struct resource pci_mem_resource; 78 + static struct pci_ops pci_ops = { 105 79 .read = ltq_pci_read_config_dword, 106 80 .write = ltq_pci_write_config_dword 107 81 }; 108 82 109 - static struct resource pci_io_resource = { 110 - .name = "pci io space", 111 - .start = LTQ_PCI_IO_BASE, 112 - .end = LTQ_PCI_IO_BASE + LTQ_PCI_IO_SIZE - 1, 113 - .flags = IORESOURCE_IO 114 - }; 115 - 116 - static struct resource pci_mem_resource = { 117 - .name = "pci memory space", 118 - .start = LTQ_PCI_MEM_BASE, 119 - .end = LTQ_PCI_MEM_BASE + LTQ_PCI_MEM_SIZE - 1, 120 - .flags = IORESOURCE_MEM 121 - }; 122 - 123 - static struct pci_controller ltq_pci_controller = { 124 - .pci_ops = &ltq_pci_ops, 83 + static struct pci_controller pci_controller = { 84 + .pci_ops = &pci_ops, 125 85 .mem_resource = &pci_mem_resource, 126 86 .mem_offset = 0x00000000UL, 127 87 .io_resource = &pci_io_resource, 128 88 .io_offset = 0x00000000UL, 129 89 }; 130 90 131 - int pcibios_plat_dev_init(struct pci_dev *dev) 132 - { 133 - if (ltqpci_plat_dev_init) 134 - return ltqpci_plat_dev_init(dev); 135 - 136 - return 0; 137 - } 138 - 139 - static u32 ltq_calc_bar11mask(void) 91 + static inline u32 ltq_calc_bar11mask(void) 140 92 { 141 93 u32 mem, bar11mask; 142 94 ··· 95 151 return bar11mask; 96 152 } 97 153 98 - static void ltq_pci_setup_gpio(int gpio) 154 + static int __devinit ltq_pci_startup(struct platform_device *pdev) 99 155 { 100 - int i; 101 - for (i = 0; i < ARRAY_SIZE(ltq_pci_gpio_map); i++) { 102 - if (gpio & (1 << i)) { 103 - ltq_gpio_request(ltq_pci_gpio_map[i].pin, 104 - ltq_pci_gpio_map[i].alt0, 105 - ltq_pci_gpio_map[i].alt1, 106 - ltq_pci_gpio_map[i].dir, 107 - ltq_pci_gpio_map[i].name); 108 - } 109 - } 110 - ltq_gpio_request(21, 0, 0, 1, "pci-reset"); 111 - ltq_pci_req_mask = (gpio >> PCI_REQ_SHIFT) & PCI_REQ_MASK; 112 - } 113 - 114 - static int __devinit ltq_pci_startup(struct ltq_pci_data *conf) 115 - { 156 + struct device_node *node = pdev->dev.of_node; 157 + const __be32 *req_mask, *bus_clk; 116 158 u32 temp_buffer; 117 159 118 - /* set clock to 33Mhz */ 119 - if (ltq_is_ar9()) { 120 - ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) & ~0x1f00000, LTQ_CGU_IFCCR); 121 - ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) | 0xe00000, LTQ_CGU_IFCCR); 122 - } else { 123 - ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) & ~0xf00000, LTQ_CGU_IFCCR); 124 - ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) | 0x800000, LTQ_CGU_IFCCR); 160 + /* get our clocks */ 161 + clk_pci = clk_get(&pdev->dev, NULL); 162 + if (IS_ERR(clk_pci)) { 163 + dev_err(&pdev->dev, "failed to get pci clock\n"); 164 + return PTR_ERR(clk_pci); 125 165 } 126 166 127 - /* external or internal clock ? */ 128 - if (conf->clock) { 129 - ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) & ~(1 << 16), 130 - LTQ_CGU_IFCCR); 131 - ltq_cgu_w32((1 << 30), LTQ_CGU_PCICR); 132 - } else { 133 - ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) | (1 << 16), 134 - LTQ_CGU_IFCCR); 135 - ltq_cgu_w32((1 << 31) | (1 << 30), LTQ_CGU_PCICR); 167 + clk_external = clk_get(&pdev->dev, "external"); 168 + if (IS_ERR(clk_external)) { 169 + clk_put(clk_pci); 170 + dev_err(&pdev->dev, "failed to get external pci clock\n"); 171 + return PTR_ERR(clk_external); 136 172 } 137 173 138 - /* setup pci clock and gpis used by pci */ 139 - ltq_pci_setup_gpio(conf->gpio); 174 + /* read the bus speed that we want */ 175 + bus_clk = of_get_property(node, "lantiq,bus-clock", NULL); 176 + if (bus_clk) 177 + clk_set_rate(clk_pci, *bus_clk); 178 + 179 + /* and enable the clocks */ 180 + clk_enable(clk_pci); 181 + if (of_find_property(node, "lantiq,external-clock", NULL)) 182 + clk_enable(clk_external); 183 + else 184 + clk_disable(clk_external); 185 + 186 + /* setup reset gpio used by pci */ 187 + reset_gpio = of_get_named_gpio(node, "gpio-reset", 0); 188 + if (reset_gpio > 0) 189 + devm_gpio_request(&pdev->dev, reset_gpio, "pci-reset"); 140 190 141 191 /* enable auto-switching between PCI and EBU */ 142 192 ltq_pci_w32(0xa, PCI_CR_CLK_CTRL); ··· 143 205 144 206 /* enable external 2 PCI masters */ 145 207 temp_buffer = ltq_pci_r32(PCI_CR_PC_ARB); 146 - temp_buffer &= (~(ltq_pci_req_mask << 16)); 208 + /* setup the request mask */ 209 + req_mask = of_get_property(node, "req-mask", NULL); 210 + if (req_mask) 211 + temp_buffer &= ~((*req_mask & 0xf) << 16); 212 + else 213 + temp_buffer &= ~0xf0000; 147 214 /* enable internal arbiter */ 148 215 temp_buffer |= (1 << INTERNAL_ARB_ENABLE_BIT); 149 216 /* enable internal PCI master reqest */ ··· 192 249 ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_IEN) | 0x10, LTQ_EBU_PCC_IEN); 193 250 194 251 /* toggle reset pin */ 195 - __gpio_set_value(21, 0); 196 - wmb(); 197 - mdelay(1); 198 - __gpio_set_value(21, 1); 199 - return 0; 200 - } 201 - 202 - int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 203 - { 204 - if (ltq_pci_irq_map[slot]) 205 - return ltq_pci_irq_map[slot]; 206 - printk(KERN_ERR "lq_pci: trying to map irq for unknown slot %d\n", 207 - slot); 208 - 252 + if (reset_gpio > 0) { 253 + __gpio_set_value(reset_gpio, 0); 254 + wmb(); 255 + mdelay(1); 256 + __gpio_set_value(reset_gpio, 1); 257 + } 209 258 return 0; 210 259 } 211 260 212 261 static int __devinit ltq_pci_probe(struct platform_device *pdev) 213 262 { 214 - struct ltq_pci_data *ltq_pci_data = 215 - (struct ltq_pci_data *) pdev->dev.platform_data; 263 + struct resource *res_cfg, *res_bridge; 216 264 217 265 pci_clear_flags(PCI_PROBE_ONLY); 218 - ltq_pci_irq_map = ltq_pci_data->irq; 219 - ltq_pci_membase = ioremap_nocache(PCI_CR_BASE_ADDR, PCI_CR_SIZE); 220 - ltq_pci_mapped_cfg = 221 - ioremap_nocache(LTQ_PCI_CFG_BASE, LTQ_PCI_CFG_BASE); 222 - ltq_pci_controller.io_map_base = 223 - (unsigned long)ioremap(LTQ_PCI_IO_BASE, LTQ_PCI_IO_SIZE - 1); 224 - ltq_pci_startup(ltq_pci_data); 225 - register_pci_controller(&ltq_pci_controller); 226 266 267 + res_cfg = platform_get_resource(pdev, IORESOURCE_MEM, 0); 268 + res_bridge = platform_get_resource(pdev, IORESOURCE_MEM, 1); 269 + if (!res_cfg || !res_bridge) { 270 + dev_err(&pdev->dev, "missing memory reources\n"); 271 + return -EINVAL; 272 + } 273 + 274 + ltq_pci_membase = devm_request_and_ioremap(&pdev->dev, res_bridge); 275 + ltq_pci_mapped_cfg = devm_request_and_ioremap(&pdev->dev, res_cfg); 276 + 277 + if (!ltq_pci_membase || !ltq_pci_mapped_cfg) { 278 + dev_err(&pdev->dev, "failed to remap resources\n"); 279 + return -ENOMEM; 280 + } 281 + 282 + ltq_pci_startup(pdev); 283 + 284 + pci_load_of_ranges(&pci_controller, pdev->dev.of_node); 285 + register_pci_controller(&pci_controller); 227 286 return 0; 228 287 } 229 288 230 - static struct platform_driver 231 - ltq_pci_driver = { 289 + static const struct of_device_id ltq_pci_match[] = { 290 + { .compatible = "lantiq,pci-xway" }, 291 + {}, 292 + }; 293 + MODULE_DEVICE_TABLE(of, ltq_pci_match); 294 + 295 + static struct platform_driver ltq_pci_driver = { 232 296 .probe = ltq_pci_probe, 233 297 .driver = { 234 - .name = "ltq_pci", 298 + .name = "pci-xway", 235 299 .owner = THIS_MODULE, 300 + .of_match_table = ltq_pci_match, 236 301 }, 237 302 }; 238 303 ··· 248 297 { 249 298 int ret = platform_driver_register(&ltq_pci_driver); 250 299 if (ret) 251 - printk(KERN_INFO "ltq_pci: Error registering platfom driver!"); 300 + pr_info("pci-xway: Error registering platform driver!"); 252 301 return ret; 253 302 } 254 303
+55
arch/mips/pci/pci.c
··· 16 16 #include <linux/init.h> 17 17 #include <linux/types.h> 18 18 #include <linux/pci.h> 19 + #include <linux/of_address.h> 19 20 20 21 #include <asm/cpu-info.h> 21 22 ··· 115 114 pci_bus_assign_resources(bus); 116 115 pci_enable_bridges(bus); 117 116 } 117 + bus->dev.of_node = hose->of_node; 118 118 } 119 119 } 120 + 121 + #ifdef CONFIG_OF 122 + void __devinit pci_load_of_ranges(struct pci_controller *hose, 123 + struct device_node *node) 124 + { 125 + const __be32 *ranges; 126 + int rlen; 127 + int pna = of_n_addr_cells(node); 128 + int np = pna + 5; 129 + 130 + pr_info("PCI host bridge %s ranges:\n", node->full_name); 131 + ranges = of_get_property(node, "ranges", &rlen); 132 + if (ranges == NULL) 133 + return; 134 + hose->of_node = node; 135 + 136 + while ((rlen -= np * 4) >= 0) { 137 + u32 pci_space; 138 + struct resource *res = NULL; 139 + u64 addr, size; 140 + 141 + pci_space = be32_to_cpup(&ranges[0]); 142 + addr = of_translate_address(node, ranges + 3); 143 + size = of_read_number(ranges + pna + 3, 2); 144 + ranges += np; 145 + switch ((pci_space >> 24) & 0x3) { 146 + case 1: /* PCI IO space */ 147 + pr_info(" IO 0x%016llx..0x%016llx\n", 148 + addr, addr + size - 1); 149 + hose->io_map_base = 150 + (unsigned long)ioremap(addr, size); 151 + res = hose->io_resource; 152 + res->flags = IORESOURCE_IO; 153 + break; 154 + case 2: /* PCI Memory space */ 155 + case 3: /* PCI 64 bits Memory space */ 156 + pr_info(" MEM 0x%016llx..0x%016llx\n", 157 + addr, addr + size - 1); 158 + res = hose->mem_resource; 159 + res->flags = IORESOURCE_MEM; 160 + break; 161 + } 162 + if (res != NULL) { 163 + res->start = addr; 164 + res->name = node->full_name; 165 + res->end = res->start + size - 1; 166 + res->parent = NULL; 167 + res->sibling = NULL; 168 + res->child = NULL; 169 + } 170 + } 171 + } 172 + #endif 120 173 121 174 static DEFINE_MUTEX(pci_scan_mutex); 122 175
-2
arch/mips/pmc-sierra/yosemite/Makefile
··· 5 5 obj-y += irq.o prom.o py-console.o setup.o 6 6 7 7 obj-$(CONFIG_SMP) += smp.o 8 - 9 - ccflags-y := -Werror
+1
arch/mips/pmc-sierra/yosemite/setup.c
··· 27 27 #include <linux/bcd.h> 28 28 #include <linux/init.h> 29 29 #include <linux/kernel.h> 30 + #include <linux/export.h> 30 31 #include <linux/types.h> 31 32 #include <linux/mm.h> 32 33 #include <linux/bootmem.h>
-2
arch/mips/powertv/Makefile
··· 27 27 asic/ pci/ 28 28 29 29 obj-$(CONFIG_USB) += powertv-usb.o 30 - 31 - ccflags-y := -Wall
-2
arch/mips/powertv/asic/Makefile
··· 19 19 obj-y += asic-calliope.o asic-cronus.o asic-gaia.o asic-zeus.o \ 20 20 asic_devices.o asic_int.o irq_asic.o prealloc-calliope.o \ 21 21 prealloc-cronus.o prealloc-cronuslite.o prealloc-gaia.o prealloc-zeus.o 22 - 23 - ccflags-y := -Wall -Werror
-2
arch/mips/powertv/pci/Makefile
··· 17 17 # 18 18 19 19 obj-$(CONFIG_PCI) += fixup-powertv.o 20 - 21 - ccflags-y := -Wall -Werror
+1
arch/mips/rb532/devices.c
··· 15 15 * GNU General Public License for more details. 16 16 */ 17 17 #include <linux/kernel.h> 18 + #include <linux/export.h> 18 19 #include <linux/init.h> 19 20 #include <linux/ctype.h> 20 21 #include <linux/string.h>
+1
arch/mips/sni/setup.c
··· 10 10 */ 11 11 #include <linux/eisa.h> 12 12 #include <linux/init.h> 13 + #include <linux/export.h> 13 14 #include <linux/console.h> 14 15 #include <linux/fb.h> 15 16 #include <linux/screen_info.h>
+18
drivers/gpio/Kconfig
··· 114 114 depends on ARCH_EP93XX 115 115 select GPIO_GENERIC 116 116 117 + config GPIO_MM_LANTIQ 118 + bool "Lantiq Memory mapped GPIOs" 119 + depends on LANTIQ && SOC_XWAY 120 + help 121 + This enables support for memory mapped GPIOs on the External Bus Unit 122 + (EBU) found on Lantiq SoCs. The gpios are output only as they are 123 + created by attaching a 16bit latch to the bus. 124 + 117 125 config GPIO_MPC5200 118 126 def_bool y 119 127 depends on PPC_MPC52xx ··· 365 357 help 366 358 This enables support for the GPIOs found on the STMPE I/O 367 359 Expanders. 360 + 361 + config GPIO_STP_XWAY 362 + bool "XWAY STP GPIOs" 363 + depends on SOC_XWAY 364 + help 365 + This enables support for the Serial To Parallel (STP) unit found on 366 + XWAY SoC. The STP allows the SoC to drive a shift registers cascade, 367 + that can be up to 24 bit. This peripheral is aimed at driving leds. 368 + Some of the gpios/leds can be auto updated by the soc with dsl and 369 + phy status. 368 370 369 371 config GPIO_TC3589X 370 372 bool "TC3589X GPIOs"
+2
drivers/gpio/Makefile
··· 33 33 obj-$(CONFIG_GPIO_MC9S08DZ60) += gpio-mc9s08dz60.o 34 34 obj-$(CONFIG_GPIO_MCP23S08) += gpio-mcp23s08.o 35 35 obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o 36 + obj-$(CONFIG_GPIO_MM_LANTIQ) += gpio-mm-lantiq.o 36 37 obj-$(CONFIG_GPIO_MPC5200) += gpio-mpc5200.o 37 38 obj-$(CONFIG_GPIO_MPC8XXX) += gpio-mpc8xxx.o 38 39 obj-$(CONFIG_GPIO_MSIC) += gpio-msic.o ··· 55 54 obj-$(CONFIG_GPIO_SODAVILLE) += gpio-sodaville.o 56 55 obj-$(CONFIG_GPIO_STA2X11) += gpio-sta2x11.o 57 56 obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o 57 + obj-$(CONFIG_GPIO_STP_XWAY) += gpio-stp-xway.o 58 58 obj-$(CONFIG_GPIO_SX150X) += gpio-sx150x.o 59 59 obj-$(CONFIG_GPIO_TC3589X) += gpio-tc3589x.o 60 60 obj-$(CONFIG_ARCH_TEGRA) += gpio-tegra.o
+158
drivers/gpio/gpio-mm-lantiq.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2012 John Crispin <blogic@openwrt.org> 7 + */ 8 + 9 + #include <linux/init.h> 10 + #include <linux/module.h> 11 + #include <linux/types.h> 12 + #include <linux/platform_device.h> 13 + #include <linux/mutex.h> 14 + #include <linux/gpio.h> 15 + #include <linux/of.h> 16 + #include <linux/of_gpio.h> 17 + #include <linux/io.h> 18 + #include <linux/slab.h> 19 + 20 + #include <lantiq_soc.h> 21 + 22 + /* 23 + * By attaching hardware latches to the EBU it is possible to create output 24 + * only gpios. This driver configures a special memory address, which when 25 + * written to outputs 16 bit to the latches. 26 + */ 27 + 28 + #define LTQ_EBU_BUSCON 0x1e7ff /* 16 bit access, slowest timing */ 29 + #define LTQ_EBU_WP 0x80000000 /* write protect bit */ 30 + 31 + struct ltq_mm { 32 + struct of_mm_gpio_chip mmchip; 33 + u16 shadow; /* shadow the latches state */ 34 + }; 35 + 36 + /** 37 + * ltq_mm_apply() - write the shadow value to the ebu address. 38 + * @chip: Pointer to our private data structure. 39 + * 40 + * Write the shadow value to the EBU to set the gpios. We need to set the 41 + * global EBU lock to make sure that PCI/MTD dont break. 42 + */ 43 + static void ltq_mm_apply(struct ltq_mm *chip) 44 + { 45 + unsigned long flags; 46 + 47 + spin_lock_irqsave(&ebu_lock, flags); 48 + ltq_ebu_w32(LTQ_EBU_BUSCON, LTQ_EBU_BUSCON1); 49 + __raw_writew(chip->shadow, chip->mmchip.regs); 50 + ltq_ebu_w32(LTQ_EBU_BUSCON | LTQ_EBU_WP, LTQ_EBU_BUSCON1); 51 + spin_unlock_irqrestore(&ebu_lock, flags); 52 + } 53 + 54 + /** 55 + * ltq_mm_set() - gpio_chip->set - set gpios. 56 + * @gc: Pointer to gpio_chip device structure. 57 + * @gpio: GPIO signal number. 58 + * @val: Value to be written to specified signal. 59 + * 60 + * Set the shadow value and call ltq_mm_apply. 61 + */ 62 + static void ltq_mm_set(struct gpio_chip *gc, unsigned offset, int value) 63 + { 64 + struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 65 + struct ltq_mm *chip = 66 + container_of(mm_gc, struct ltq_mm, mmchip); 67 + 68 + if (value) 69 + chip->shadow |= (1 << offset); 70 + else 71 + chip->shadow &= ~(1 << offset); 72 + ltq_mm_apply(chip); 73 + } 74 + 75 + /** 76 + * ltq_mm_dir_out() - gpio_chip->dir_out - set gpio direction. 77 + * @gc: Pointer to gpio_chip device structure. 78 + * @gpio: GPIO signal number. 79 + * @val: Value to be written to specified signal. 80 + * 81 + * Same as ltq_mm_set, always returns 0. 82 + */ 83 + static int ltq_mm_dir_out(struct gpio_chip *gc, unsigned offset, int value) 84 + { 85 + ltq_mm_set(gc, offset, value); 86 + 87 + return 0; 88 + } 89 + 90 + /** 91 + * ltq_mm_save_regs() - Set initial values of GPIO pins 92 + * @mm_gc: pointer to memory mapped GPIO chip structure 93 + */ 94 + static void ltq_mm_save_regs(struct of_mm_gpio_chip *mm_gc) 95 + { 96 + struct ltq_mm *chip = 97 + container_of(mm_gc, struct ltq_mm, mmchip); 98 + 99 + /* tell the ebu controller which memory address we will be using */ 100 + ltq_ebu_w32(CPHYSADDR(chip->mmchip.regs) | 0x1, LTQ_EBU_ADDRSEL1); 101 + 102 + ltq_mm_apply(chip); 103 + } 104 + 105 + static int ltq_mm_probe(struct platform_device *pdev) 106 + { 107 + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 108 + struct ltq_mm *chip; 109 + const __be32 *shadow; 110 + int ret = 0; 111 + 112 + if (!res) { 113 + dev_err(&pdev->dev, "failed to get memory resource\n"); 114 + return -ENOENT; 115 + } 116 + 117 + chip = kzalloc(sizeof(*chip), GFP_KERNEL); 118 + if (!chip) 119 + return -ENOMEM; 120 + 121 + chip->mmchip.gc.ngpio = 16; 122 + chip->mmchip.gc.label = "gpio-mm-ltq"; 123 + chip->mmchip.gc.direction_output = ltq_mm_dir_out; 124 + chip->mmchip.gc.set = ltq_mm_set; 125 + chip->mmchip.save_regs = ltq_mm_save_regs; 126 + 127 + /* store the shadow value if one was passed by the devicetree */ 128 + shadow = of_get_property(pdev->dev.of_node, "lantiq,shadow", NULL); 129 + if (shadow) 130 + chip->shadow = be32_to_cpu(*shadow); 131 + 132 + ret = of_mm_gpiochip_add(pdev->dev.of_node, &chip->mmchip); 133 + if (ret) 134 + kfree(chip); 135 + return ret; 136 + } 137 + 138 + static const struct of_device_id ltq_mm_match[] = { 139 + { .compatible = "lantiq,gpio-mm" }, 140 + {}, 141 + }; 142 + MODULE_DEVICE_TABLE(of, ltq_mm_match); 143 + 144 + static struct platform_driver ltq_mm_driver = { 145 + .probe = ltq_mm_probe, 146 + .driver = { 147 + .name = "gpio-mm-ltq", 148 + .owner = THIS_MODULE, 149 + .of_match_table = ltq_mm_match, 150 + }, 151 + }; 152 + 153 + static int __init ltq_mm_init(void) 154 + { 155 + return platform_driver_register(&ltq_mm_driver); 156 + } 157 + 158 + subsys_initcall(ltq_mm_init);
+301
drivers/gpio/gpio-stp-xway.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify it 3 + * under the terms of the GNU General Public License version 2 as published 4 + * by the Free Software Foundation. 5 + * 6 + * Copyright (C) 2012 John Crispin <blogic@openwrt.org> 7 + * 8 + */ 9 + 10 + #include <linux/slab.h> 11 + #include <linux/init.h> 12 + #include <linux/module.h> 13 + #include <linux/types.h> 14 + #include <linux/of_platform.h> 15 + #include <linux/mutex.h> 16 + #include <linux/gpio.h> 17 + #include <linux/io.h> 18 + #include <linux/of_gpio.h> 19 + #include <linux/clk.h> 20 + #include <linux/err.h> 21 + 22 + #include <lantiq_soc.h> 23 + 24 + /* 25 + * The Serial To Parallel (STP) is found on MIPS based Lantiq socs. It is a 26 + * peripheral controller used to drive external shift register cascades. At most 27 + * 3 groups of 8 bits can be driven. The hardware is able to allow the DSL modem 28 + * to drive the 2 LSBs of the cascade automatically. 29 + */ 30 + 31 + /* control register 0 */ 32 + #define XWAY_STP_CON0 0x00 33 + /* control register 1 */ 34 + #define XWAY_STP_CON1 0x04 35 + /* data register 0 */ 36 + #define XWAY_STP_CPU0 0x08 37 + /* data register 1 */ 38 + #define XWAY_STP_CPU1 0x0C 39 + /* access register */ 40 + #define XWAY_STP_AR 0x10 41 + 42 + /* software or hardware update select bit */ 43 + #define XWAY_STP_CON_SWU BIT(31) 44 + 45 + /* automatic update rates */ 46 + #define XWAY_STP_2HZ 0 47 + #define XWAY_STP_4HZ BIT(23) 48 + #define XWAY_STP_8HZ BIT(24) 49 + #define XWAY_STP_10HZ (BIT(24) | BIT(23)) 50 + #define XWAY_STP_SPEED_MASK (0xf << 23) 51 + 52 + /* clock source for automatic update */ 53 + #define XWAY_STP_UPD_FPI BIT(31) 54 + #define XWAY_STP_UPD_MASK (BIT(31) | BIT(30)) 55 + 56 + /* let the adsl core drive the 2 LSBs */ 57 + #define XWAY_STP_ADSL_SHIFT 24 58 + #define XWAY_STP_ADSL_MASK 0x3 59 + 60 + /* 2 groups of 3 bits can be driven by the phys */ 61 + #define XWAY_STP_PHY_MASK 0x3 62 + #define XWAY_STP_PHY1_SHIFT 27 63 + #define XWAY_STP_PHY2_SHIFT 15 64 + 65 + /* STP has 3 groups of 8 bits */ 66 + #define XWAY_STP_GROUP0 BIT(0) 67 + #define XWAY_STP_GROUP1 BIT(1) 68 + #define XWAY_STP_GROUP2 BIT(2) 69 + #define XWAY_STP_GROUP_MASK (0x7) 70 + 71 + /* Edge configuration bits */ 72 + #define XWAY_STP_FALLING BIT(26) 73 + #define XWAY_STP_EDGE_MASK BIT(26) 74 + 75 + #define xway_stp_r32(m, reg) __raw_readl(m + reg) 76 + #define xway_stp_w32(m, val, reg) __raw_writel(val, m + reg) 77 + #define xway_stp_w32_mask(m, clear, set, reg) \ 78 + ltq_w32((ltq_r32(m + reg) & ~(clear)) | (set), \ 79 + m + reg) 80 + 81 + struct xway_stp { 82 + struct gpio_chip gc; 83 + void __iomem *virt; 84 + u32 edge; /* rising or falling edge triggered shift register */ 85 + u16 shadow; /* shadow the shift registers state */ 86 + u8 groups; /* we can drive 1-3 groups of 8bit each */ 87 + u8 dsl; /* the 2 LSBs can be driven by the dsl core */ 88 + u8 phy1; /* 3 bits can be driven by phy1 */ 89 + u8 phy2; /* 3 bits can be driven by phy2 */ 90 + u8 reserved; /* mask out the hw driven bits in gpio_request */ 91 + }; 92 + 93 + /** 94 + * xway_stp_set() - gpio_chip->set - set gpios. 95 + * @gc: Pointer to gpio_chip device structure. 96 + * @gpio: GPIO signal number. 97 + * @val: Value to be written to specified signal. 98 + * 99 + * Set the shadow value and call ltq_ebu_apply. 100 + */ 101 + static void xway_stp_set(struct gpio_chip *gc, unsigned gpio, int val) 102 + { 103 + struct xway_stp *chip = 104 + container_of(gc, struct xway_stp, gc); 105 + 106 + if (val) 107 + chip->shadow |= BIT(gpio); 108 + else 109 + chip->shadow &= ~BIT(gpio); 110 + xway_stp_w32(chip->virt, chip->shadow, XWAY_STP_CPU0); 111 + xway_stp_w32_mask(chip->virt, 0, XWAY_STP_CON_SWU, XWAY_STP_CON0); 112 + } 113 + 114 + /** 115 + * xway_stp_dir_out() - gpio_chip->dir_out - set gpio direction. 116 + * @gc: Pointer to gpio_chip device structure. 117 + * @gpio: GPIO signal number. 118 + * @val: Value to be written to specified signal. 119 + * 120 + * Same as xway_stp_set, always returns 0. 121 + */ 122 + static int xway_stp_dir_out(struct gpio_chip *gc, unsigned gpio, int val) 123 + { 124 + xway_stp_set(gc, gpio, val); 125 + 126 + return 0; 127 + } 128 + 129 + /** 130 + * xway_stp_request() - gpio_chip->request 131 + * @gc: Pointer to gpio_chip device structure. 132 + * @gpio: GPIO signal number. 133 + * 134 + * We mask out the HW driven pins 135 + */ 136 + static int xway_stp_request(struct gpio_chip *gc, unsigned gpio) 137 + { 138 + struct xway_stp *chip = 139 + container_of(gc, struct xway_stp, gc); 140 + 141 + if ((gpio < 8) && (chip->reserved & BIT(gpio))) { 142 + dev_err(gc->dev, "GPIO %d is driven by hardware\n", gpio); 143 + return -ENODEV; 144 + } 145 + 146 + return 0; 147 + } 148 + 149 + /** 150 + * xway_stp_hw_init() - Configure the STP unit and enable the clock gate 151 + * @virt: pointer to the remapped register range 152 + */ 153 + static int xway_stp_hw_init(struct xway_stp *chip) 154 + { 155 + /* sane defaults */ 156 + xway_stp_w32(chip->virt, 0, XWAY_STP_AR); 157 + xway_stp_w32(chip->virt, 0, XWAY_STP_CPU0); 158 + xway_stp_w32(chip->virt, 0, XWAY_STP_CPU1); 159 + xway_stp_w32(chip->virt, XWAY_STP_CON_SWU, XWAY_STP_CON0); 160 + xway_stp_w32(chip->virt, 0, XWAY_STP_CON1); 161 + 162 + /* apply edge trigger settings for the shift register */ 163 + xway_stp_w32_mask(chip->virt, XWAY_STP_EDGE_MASK, 164 + chip->edge, XWAY_STP_CON0); 165 + 166 + /* apply led group settings */ 167 + xway_stp_w32_mask(chip->virt, XWAY_STP_GROUP_MASK, 168 + chip->groups, XWAY_STP_CON1); 169 + 170 + /* tell the hardware which pins are controlled by the dsl modem */ 171 + xway_stp_w32_mask(chip->virt, 172 + XWAY_STP_ADSL_MASK << XWAY_STP_ADSL_SHIFT, 173 + chip->dsl << XWAY_STP_ADSL_SHIFT, 174 + XWAY_STP_CON0); 175 + 176 + /* tell the hardware which pins are controlled by the phys */ 177 + xway_stp_w32_mask(chip->virt, 178 + XWAY_STP_PHY_MASK << XWAY_STP_PHY1_SHIFT, 179 + chip->phy1 << XWAY_STP_PHY1_SHIFT, 180 + XWAY_STP_CON0); 181 + xway_stp_w32_mask(chip->virt, 182 + XWAY_STP_PHY_MASK << XWAY_STP_PHY2_SHIFT, 183 + chip->phy2 << XWAY_STP_PHY2_SHIFT, 184 + XWAY_STP_CON1); 185 + 186 + /* mask out the hw driven bits in gpio_request */ 187 + chip->reserved = (chip->phy2 << 5) | (chip->phy1 << 2) | chip->dsl; 188 + 189 + /* 190 + * if we have pins that are driven by hw, we need to tell the stp what 191 + * clock to use as a timer. 192 + */ 193 + if (chip->reserved) 194 + xway_stp_w32_mask(chip->virt, XWAY_STP_UPD_MASK, 195 + XWAY_STP_UPD_FPI, XWAY_STP_CON1); 196 + 197 + return 0; 198 + } 199 + 200 + static int __devinit xway_stp_probe(struct platform_device *pdev) 201 + { 202 + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 203 + const __be32 *shadow, *groups, *dsl, *phy; 204 + struct xway_stp *chip; 205 + struct clk *clk; 206 + int ret = 0; 207 + 208 + if (!res) { 209 + dev_err(&pdev->dev, "failed to request STP resource\n"); 210 + return -ENOENT; 211 + } 212 + 213 + chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); 214 + if (!chip) 215 + return -ENOMEM; 216 + 217 + chip->virt = devm_request_and_ioremap(&pdev->dev, res); 218 + if (!chip->virt) { 219 + dev_err(&pdev->dev, "failed to remap STP memory\n"); 220 + return -ENOMEM; 221 + } 222 + chip->gc.dev = &pdev->dev; 223 + chip->gc.label = "stp-xway"; 224 + chip->gc.direction_output = xway_stp_dir_out; 225 + chip->gc.set = xway_stp_set; 226 + chip->gc.request = xway_stp_request; 227 + chip->gc.base = -1; 228 + chip->gc.owner = THIS_MODULE; 229 + 230 + /* store the shadow value if one was passed by the devicetree */ 231 + shadow = of_get_property(pdev->dev.of_node, "lantiq,shadow", NULL); 232 + if (shadow) 233 + chip->shadow = be32_to_cpu(*shadow); 234 + 235 + /* find out which gpio groups should be enabled */ 236 + groups = of_get_property(pdev->dev.of_node, "lantiq,groups", NULL); 237 + if (groups) 238 + chip->groups = be32_to_cpu(*groups) & XWAY_STP_GROUP_MASK; 239 + else 240 + chip->groups = XWAY_STP_GROUP0; 241 + chip->gc.ngpio = fls(chip->groups) * 8; 242 + 243 + /* find out which gpios are controlled by the dsl core */ 244 + dsl = of_get_property(pdev->dev.of_node, "lantiq,dsl", NULL); 245 + if (dsl) 246 + chip->dsl = be32_to_cpu(*dsl) & XWAY_STP_ADSL_MASK; 247 + 248 + /* find out which gpios are controlled by the phys */ 249 + if (of_machine_is_compatible("lantiq,ar9") || 250 + of_machine_is_compatible("lantiq,gr9") || 251 + of_machine_is_compatible("lantiq,vr9")) { 252 + phy = of_get_property(pdev->dev.of_node, "lantiq,phy1", NULL); 253 + if (phy) 254 + chip->phy1 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK; 255 + phy = of_get_property(pdev->dev.of_node, "lantiq,phy2", NULL); 256 + if (phy) 257 + chip->phy2 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK; 258 + } 259 + 260 + /* check which edge trigger we should use, default to a falling edge */ 261 + if (!of_find_property(pdev->dev.of_node, "lantiq,rising", NULL)) 262 + chip->edge = XWAY_STP_FALLING; 263 + 264 + clk = clk_get(&pdev->dev, NULL); 265 + if (IS_ERR(clk)) { 266 + dev_err(&pdev->dev, "Failed to get clock\n"); 267 + return PTR_ERR(clk); 268 + } 269 + clk_enable(clk); 270 + 271 + ret = xway_stp_hw_init(chip); 272 + if (!ret) 273 + ret = gpiochip_add(&chip->gc); 274 + 275 + if (!ret) 276 + dev_info(&pdev->dev, "Init done\n"); 277 + 278 + return ret; 279 + } 280 + 281 + static const struct of_device_id xway_stp_match[] = { 282 + { .compatible = "lantiq,gpio-stp-xway" }, 283 + {}, 284 + }; 285 + MODULE_DEVICE_TABLE(of, xway_stp_match); 286 + 287 + static struct platform_driver xway_stp_driver = { 288 + .probe = xway_stp_probe, 289 + .driver = { 290 + .name = "gpio-stp-xway", 291 + .owner = THIS_MODULE, 292 + .of_match_table = xway_stp_match, 293 + }, 294 + }; 295 + 296 + int __init xway_stp_init(void) 297 + { 298 + return platform_driver_register(&xway_stp_driver); 299 + } 300 + 301 + subsys_initcall(xway_stp_init);
+32 -44
drivers/mtd/maps/lantiq-flash.c
··· 19 19 #include <linux/mtd/cfi.h> 20 20 #include <linux/platform_device.h> 21 21 #include <linux/mtd/physmap.h> 22 + #include <linux/of.h> 22 23 23 24 #include <lantiq_soc.h> 24 - #include <lantiq_platform.h> 25 25 26 26 /* 27 27 * The NOR flash is connected to the same external bus unit (EBU) as PCI. ··· 44 44 struct map_info *map; 45 45 }; 46 46 47 - static char ltq_map_name[] = "ltq_nor"; 48 - static const char *ltq_probe_types[] __devinitconst = { "cmdlinepart", NULL }; 47 + static const char ltq_map_name[] = "ltq_nor"; 48 + static const char *ltq_probe_types[] __devinitconst = { 49 + "cmdlinepart", "ofpart", NULL }; 49 50 50 51 static map_word 51 52 ltq_read16(struct map_info *map, unsigned long adr) ··· 109 108 spin_unlock_irqrestore(&ebu_lock, flags); 110 109 } 111 110 112 - static int __init 111 + static int __devinit 113 112 ltq_mtd_probe(struct platform_device *pdev) 114 113 { 115 - struct physmap_flash_data *ltq_mtd_data = dev_get_platdata(&pdev->dev); 114 + struct mtd_part_parser_data ppdata; 116 115 struct ltq_mtd *ltq_mtd; 117 - struct resource *res; 118 116 struct cfi_private *cfi; 119 117 int err; 118 + 119 + if (of_machine_is_compatible("lantiq,falcon") && 120 + (ltq_boot_select() != BS_FLASH)) { 121 + dev_err(&pdev->dev, "invalid bootstrap options\n"); 122 + return -ENODEV; 123 + } 120 124 121 125 ltq_mtd = kzalloc(sizeof(struct ltq_mtd), GFP_KERNEL); 122 126 platform_set_drvdata(pdev, ltq_mtd); 123 127 124 128 ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 125 129 if (!ltq_mtd->res) { 126 - dev_err(&pdev->dev, "failed to get memory resource"); 130 + dev_err(&pdev->dev, "failed to get memory resource\n"); 127 131 err = -ENOENT; 128 132 goto err_out; 129 133 } 130 134 131 - res = devm_request_mem_region(&pdev->dev, ltq_mtd->res->start, 132 - resource_size(ltq_mtd->res), dev_name(&pdev->dev)); 133 - if (!ltq_mtd->res) { 134 - dev_err(&pdev->dev, "failed to request mem resource"); 135 + ltq_mtd->map = kzalloc(sizeof(struct map_info), GFP_KERNEL); 136 + ltq_mtd->map->phys = ltq_mtd->res->start; 137 + ltq_mtd->map->size = resource_size(ltq_mtd->res); 138 + ltq_mtd->map->virt = devm_request_and_ioremap(&pdev->dev, ltq_mtd->res); 139 + if (!ltq_mtd->map->virt) { 140 + dev_err(&pdev->dev, "failed to remap mem resource\n"); 135 141 err = -EBUSY; 136 142 goto err_out; 137 - } 138 - 139 - ltq_mtd->map = kzalloc(sizeof(struct map_info), GFP_KERNEL); 140 - ltq_mtd->map->phys = res->start; 141 - ltq_mtd->map->size = resource_size(res); 142 - ltq_mtd->map->virt = devm_ioremap_nocache(&pdev->dev, 143 - ltq_mtd->map->phys, ltq_mtd->map->size); 144 - if (!ltq_mtd->map->virt) { 145 - dev_err(&pdev->dev, "failed to ioremap!\n"); 146 - err = -ENOMEM; 147 - goto err_free; 148 143 } 149 144 150 145 ltq_mtd->map->name = ltq_map_name; ··· 166 169 cfi->addr_unlock1 ^= 1; 167 170 cfi->addr_unlock2 ^= 1; 168 171 169 - err = mtd_device_parse_register(ltq_mtd->mtd, ltq_probe_types, NULL, 170 - ltq_mtd_data->parts, 171 - ltq_mtd_data->nr_parts); 172 + ppdata.of_node = pdev->dev.of_node; 173 + err = mtd_device_parse_register(ltq_mtd->mtd, ltq_probe_types, 174 + &ppdata, NULL, 0); 172 175 if (err) { 173 176 dev_err(&pdev->dev, "failed to add partitions\n"); 174 177 goto err_destroy; ··· 201 204 return 0; 202 205 } 203 206 207 + static const struct of_device_id ltq_mtd_match[] = { 208 + { .compatible = "lantiq,nor" }, 209 + {}, 210 + }; 211 + MODULE_DEVICE_TABLE(of, ltq_mtd_match); 212 + 204 213 static struct platform_driver ltq_mtd_driver = { 214 + .probe = ltq_mtd_probe, 205 215 .remove = __devexit_p(ltq_mtd_remove), 206 216 .driver = { 207 - .name = "ltq_nor", 217 + .name = "ltq-nor", 208 218 .owner = THIS_MODULE, 219 + .of_match_table = ltq_mtd_match, 209 220 }, 210 221 }; 211 222 212 - static int __init 213 - init_ltq_mtd(void) 214 - { 215 - int ret = platform_driver_probe(&ltq_mtd_driver, ltq_mtd_probe); 216 - 217 - if (ret) 218 - pr_err("ltq_nor: error registering platform driver"); 219 - return ret; 220 - } 221 - 222 - static void __exit 223 - exit_ltq_mtd(void) 224 - { 225 - platform_driver_unregister(&ltq_mtd_driver); 226 - } 227 - 228 - module_init(init_ltq_mtd); 229 - module_exit(exit_ltq_mtd); 223 + module_platform_driver(ltq_mtd_driver); 230 224 231 225 MODULE_LICENSE("GPL"); 232 226 MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
+1 -1
drivers/of/of_pci_irq.c
··· 15 15 * PCI tree until an device-node is found, at which point it will finish 16 16 * resolving using the OF tree walking. 17 17 */ 18 - int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq) 18 + int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq) 19 19 { 20 20 struct device_node *dn, *ppnode; 21 21 struct pci_dev *ppdev;
+1 -1
drivers/pci/pci.c
··· 2370 2370 * number is always 0 (see the Implementation Note in section 2.2.8.1 of 2371 2371 * the PCI Express Base Specification, Revision 2.1) 2372 2372 */ 2373 - u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin) 2373 + u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin) 2374 2374 { 2375 2375 int slot; 2376 2376
+53 -34
drivers/tty/serial/lantiq.c
··· 31 31 #include <linux/tty_flip.h> 32 32 #include <linux/serial_core.h> 33 33 #include <linux/serial.h> 34 - #include <linux/platform_device.h> 34 + #include <linux/of_platform.h> 35 + #include <linux/of_address.h> 36 + #include <linux/of_irq.h> 35 37 #include <linux/io.h> 36 38 #include <linux/clk.h> 39 + #include <linux/gpio.h> 37 40 38 41 #include <lantiq_soc.h> 39 42 40 43 #define PORT_LTQ_ASC 111 41 44 #define MAXPORTS 2 42 45 #define UART_DUMMY_UER_RX 1 43 - #define DRVNAME "ltq_asc" 46 + #define DRVNAME "lantiq,asc" 44 47 #ifdef __BIG_ENDIAN 45 48 #define LTQ_ASC_TBUF (0x0020 + 3) 46 49 #define LTQ_ASC_RBUF (0x0024 + 3) ··· 117 114 118 115 struct ltq_uart_port { 119 116 struct uart_port port; 117 + /* clock used to derive divider */ 118 + struct clk *fpiclk; 119 + /* clock gating of the ASC core */ 120 120 struct clk *clk; 121 121 unsigned int tx_irq; 122 122 unsigned int rx_irq; ··· 322 316 struct ltq_uart_port *ltq_port = to_ltq_uart_port(port); 323 317 int retval; 324 318 325 - port->uartclk = clk_get_rate(ltq_port->clk); 319 + if (ltq_port->clk) 320 + clk_enable(ltq_port->clk); 321 + port->uartclk = clk_get_rate(ltq_port->fpiclk); 326 322 327 323 ltq_w32_mask(ASCCLC_DISS | ASCCLC_RMCMASK, (1 << ASCCLC_RMCOFFSET), 328 324 port->membase + LTQ_ASC_CLC); ··· 390 382 port->membase + LTQ_ASC_RXFCON); 391 383 ltq_w32_mask(ASCTXFCON_TXFEN, ASCTXFCON_TXFFLU, 392 384 port->membase + LTQ_ASC_TXFCON); 385 + if (ltq_port->clk) 386 + clk_disable(ltq_port->clk); 393 387 } 394 388 395 389 static void ··· 640 630 641 631 port = &ltq_port->port; 642 632 643 - port->uartclk = clk_get_rate(ltq_port->clk); 633 + port->uartclk = clk_get_rate(ltq_port->fpiclk); 644 634 645 635 if (options) 646 636 uart_parse_options(options, &baud, &parity, &bits, &flow); ··· 678 668 static int __init 679 669 lqasc_probe(struct platform_device *pdev) 680 670 { 671 + struct device_node *node = pdev->dev.of_node; 681 672 struct ltq_uart_port *ltq_port; 682 673 struct uart_port *port; 683 - struct resource *mmres, *irqres; 684 - int tx_irq, rx_irq, err_irq; 685 - struct clk *clk; 674 + struct resource *mmres, irqres[3]; 675 + int line = 0; 686 676 int ret; 687 677 688 678 mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0); 689 - irqres = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 690 - if (!mmres || !irqres) 679 + ret = of_irq_to_resource_table(node, irqres, 3); 680 + if (!mmres || (ret != 3)) { 681 + dev_err(&pdev->dev, 682 + "failed to get memory/irq for serial port\n"); 691 683 return -ENODEV; 692 - 693 - if (pdev->id >= MAXPORTS) 694 - return -EBUSY; 695 - 696 - if (lqasc_port[pdev->id] != NULL) 697 - return -EBUSY; 698 - 699 - clk = clk_get(&pdev->dev, "fpi"); 700 - if (IS_ERR(clk)) { 701 - pr_err("failed to get fpi clk\n"); 702 - return -ENOENT; 703 684 } 704 685 705 - tx_irq = platform_get_irq_byname(pdev, "tx"); 706 - rx_irq = platform_get_irq_byname(pdev, "rx"); 707 - err_irq = platform_get_irq_byname(pdev, "err"); 708 - if ((tx_irq < 0) | (rx_irq < 0) | (err_irq < 0)) 709 - return -ENODEV; 686 + /* check if this is the console port */ 687 + if (mmres->start != CPHYSADDR(LTQ_EARLY_ASC)) 688 + line = 1; 710 689 711 - ltq_port = kzalloc(sizeof(struct ltq_uart_port), GFP_KERNEL); 690 + if (lqasc_port[line]) { 691 + dev_err(&pdev->dev, "port %d already allocated\n", line); 692 + return -EBUSY; 693 + } 694 + 695 + ltq_port = devm_kzalloc(&pdev->dev, sizeof(struct ltq_uart_port), 696 + GFP_KERNEL); 712 697 if (!ltq_port) 713 698 return -ENOMEM; 714 699 ··· 714 709 port->ops = &lqasc_pops; 715 710 port->fifosize = 16; 716 711 port->type = PORT_LTQ_ASC, 717 - port->line = pdev->id; 712 + port->line = line; 718 713 port->dev = &pdev->dev; 719 - 720 - port->irq = tx_irq; /* unused, just to be backward-compatibe */ 714 + /* unused, just to be backward-compatible */ 715 + port->irq = irqres[0].start; 721 716 port->mapbase = mmres->start; 722 717 723 - ltq_port->clk = clk; 718 + ltq_port->fpiclk = clk_get_fpi(); 719 + if (IS_ERR(ltq_port->fpiclk)) { 720 + pr_err("failed to get fpi clk\n"); 721 + return -ENOENT; 722 + } 724 723 725 - ltq_port->tx_irq = tx_irq; 726 - ltq_port->rx_irq = rx_irq; 727 - ltq_port->err_irq = err_irq; 724 + /* not all asc ports have clock gates, lets ignore the return code */ 725 + ltq_port->clk = clk_get(&pdev->dev, NULL); 728 726 729 - lqasc_port[pdev->id] = ltq_port; 727 + ltq_port->tx_irq = irqres[0].start; 728 + ltq_port->rx_irq = irqres[1].start; 729 + ltq_port->err_irq = irqres[2].start; 730 + 731 + lqasc_port[line] = ltq_port; 730 732 platform_set_drvdata(pdev, ltq_port); 731 733 732 734 ret = uart_add_one_port(&lqasc_reg, port); ··· 741 729 return ret; 742 730 } 743 731 732 + static const struct of_device_id ltq_asc_match[] = { 733 + { .compatible = DRVNAME }, 734 + {}, 735 + }; 736 + MODULE_DEVICE_TABLE(of, ltq_asc_match); 737 + 744 738 static struct platform_driver lqasc_driver = { 745 739 .driver = { 746 740 .name = DRVNAME, 747 741 .owner = THIS_MODULE, 742 + .of_match_table = ltq_asc_match, 748 743 }, 749 744 }; 750 745
+1
drivers/tty/serial/sb1250-duart.c
··· 31 31 #include <linux/interrupt.h> 32 32 #include <linux/ioport.h> 33 33 #include <linux/kernel.h> 34 + #include <linux/module.h> 34 35 #include <linux/major.h> 35 36 #include <linux/serial.h> 36 37 #include <linux/serial_core.h>
+1
drivers/tty/serial/zs.c
··· 57 57 #include <linux/ioport.h> 58 58 #include <linux/irqflags.h> 59 59 #include <linux/kernel.h> 60 + #include <linux/module.h> 60 61 #include <linux/major.h> 61 62 #include <linux/serial.h> 62 63 #include <linux/serial_core.h>
+25 -31
drivers/watchdog/lantiq_wdt.c
··· 13 13 #include <linux/fs.h> 14 14 #include <linux/miscdevice.h> 15 15 #include <linux/watchdog.h> 16 - #include <linux/platform_device.h> 16 + #include <linux/of_platform.h> 17 17 #include <linux/uaccess.h> 18 18 #include <linux/clk.h> 19 19 #include <linux/io.h> 20 20 21 - #include <lantiq.h> 21 + #include <lantiq_soc.h> 22 22 23 - /* Section 3.4 of the datasheet 23 + /* 24 + * Section 3.4 of the datasheet 24 25 * The password sequence protects the WDT control register from unintended 25 26 * write actions, which might cause malfunction of the WDT. 26 27 * ··· 71 70 { 72 71 /* write the first password magic */ 73 72 ltq_w32(LTQ_WDT_PW1, ltq_wdt_membase + LTQ_WDT_CR); 74 - /* write the second password magic with no config 73 + /* 74 + * write the second password magic with no config 75 75 * this turns the watchdog off 76 76 */ 77 77 ltq_w32(LTQ_WDT_PW2, ltq_wdt_membase + LTQ_WDT_CR); ··· 186 184 .fops = &ltq_wdt_fops, 187 185 }; 188 186 189 - static int __init 187 + static int __devinit 190 188 ltq_wdt_probe(struct platform_device *pdev) 191 189 { 192 190 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ··· 196 194 dev_err(&pdev->dev, "cannot obtain I/O memory region"); 197 195 return -ENOENT; 198 196 } 199 - res = devm_request_mem_region(&pdev->dev, res->start, 200 - resource_size(res), dev_name(&pdev->dev)); 201 - if (!res) { 202 - dev_err(&pdev->dev, "cannot request I/O memory region"); 203 - return -EBUSY; 204 - } 205 - ltq_wdt_membase = devm_ioremap_nocache(&pdev->dev, res->start, 206 - resource_size(res)); 197 + 198 + ltq_wdt_membase = devm_request_and_ioremap(&pdev->dev, res); 207 199 if (!ltq_wdt_membase) { 208 200 dev_err(&pdev->dev, "cannot remap I/O memory region\n"); 209 201 return -ENOMEM; 210 202 } 211 203 212 204 /* we do not need to enable the clock as it is always running */ 213 - clk = clk_get(&pdev->dev, "io"); 214 - WARN_ON(!clk); 205 + clk = clk_get_io(); 206 + if (IS_ERR(clk)) { 207 + dev_err(&pdev->dev, "Failed to get clock\n"); 208 + return -ENOENT; 209 + } 215 210 ltq_io_region_clk_rate = clk_get_rate(clk); 216 211 clk_put(clk); 217 212 213 + /* find out if the watchdog caused the last reboot */ 218 214 if (ltq_reset_cause() == LTQ_RST_CAUSE_WDTRST) 219 215 ltq_wdt_bootstatus = WDIOF_CARDRESET; 220 216 217 + dev_info(&pdev->dev, "Init done\n"); 221 218 return misc_register(&ltq_wdt_miscdev); 222 219 } 223 220 ··· 228 227 return 0; 229 228 } 230 229 230 + static const struct of_device_id ltq_wdt_match[] = { 231 + { .compatible = "lantiq,wdt" }, 232 + {}, 233 + }; 234 + MODULE_DEVICE_TABLE(of, ltq_wdt_match); 231 235 232 236 static struct platform_driver ltq_wdt_driver = { 237 + .probe = ltq_wdt_probe, 233 238 .remove = __devexit_p(ltq_wdt_remove), 234 239 .driver = { 235 - .name = "ltq_wdt", 240 + .name = "wdt", 236 241 .owner = THIS_MODULE, 242 + .of_match_table = ltq_wdt_match, 237 243 }, 238 244 }; 239 245 240 - static int __init 241 - init_ltq_wdt(void) 242 - { 243 - return platform_driver_probe(&ltq_wdt_driver, ltq_wdt_probe); 244 - } 245 - 246 - static void __exit 247 - exit_ltq_wdt(void) 248 - { 249 - return platform_driver_unregister(&ltq_wdt_driver); 250 - } 251 - 252 - module_init(init_ltq_wdt); 253 - module_exit(exit_ltq_wdt); 246 + module_platform_driver(ltq_wdt_driver); 254 247 255 248 module_param(nowayout, bool, 0); 256 249 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); 257 - 258 250 MODULE_AUTHOR("John Crispin <blogic@openwrt.org>"); 259 251 MODULE_DESCRIPTION("Lantiq SoC Watchdog"); 260 252 MODULE_LICENSE("GPL");
+1 -1
include/linux/of_pci.h
··· 5 5 6 6 struct pci_dev; 7 7 struct of_irq; 8 - int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); 8 + int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq); 9 9 10 10 struct device_node; 11 11 struct device_node *of_pci_find_child_device(struct device_node *parent,
+3 -2
include/linux/pci.h
··· 687 687 void pci_read_bridge_bases(struct pci_bus *child); 688 688 struct resource *pci_find_parent_resource(const struct pci_dev *dev, 689 689 struct resource *res); 690 - u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin); 690 + u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin); 691 691 int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 692 692 u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); 693 693 extern struct pci_dev *pci_dev_get(struct pci_dev *dev); ··· 1692 1692 /* Arch may override this (weak) */ 1693 1693 extern struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus); 1694 1694 1695 - static inline struct device_node *pci_device_to_OF_node(struct pci_dev *pdev) 1695 + static inline struct device_node * 1696 + pci_device_to_OF_node(const struct pci_dev *pdev) 1696 1697 { 1697 1698 return pdev ? pdev->dev.of_node : NULL; 1698 1699 }