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

Merge tag 'mips_5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux

Pull MIPS updates from Thomas Bogendoerfer:

- add support for more BCM47XX based devices

- add MIPS support for brcmstb PCIe controller

- add Loongson 2K1000 reset driver

- remove board support for rbtx4938/rbtx4939

- remove support for TX4939 SoCs

- fixes and cleanups

* tag 'mips_5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (59 commits)
MIPS: ath79: drop _machine_restart again
PCI: brcmstb: Augment driver for MIPs SOCs
MIPS: bmips: Remove obsolete DMA mapping support
MIPS: bmips: Add support PCIe controller device nodes
dt-bindings: PCI: Add compatible string for Brcmstb 74[23]5 MIPs SOCs
MIPS: compressed: Fix build with ZSTD compression
MIPS: BCM47XX: Add support for Netgear WN2500RP v1 & v2
MIPS: BCM47XX: Add support for Netgear R6300 v1
MIPS: BCM47XX: Add LEDs and buttons for Asus RTN-10U
MIPS: BCM47XX: Add board entry for Linksys WRT320N v1
MIPS: BCM47XX: Define Linksys WRT310N V2 buttons
MIPS: Remove duplicated include in local.h
MIPS: retire "asm/llsc.h"
MIPS: rework local_t operation on MIPS64
MIPS: fix local_{add,sub}_return on MIPS64
mips/pci: remove redundant ret variable
MIPS: Loongson64: Add missing of_node_put() in ls2k_reset_init()
MIPS: new Kconfig option ZBOOT_LOAD_ADDRESS
MIPS: enable both vmlinux.gz.itb and vmlinuz for generic
MIPS: signal: Return immediately if call fails
...

+614 -4005
+38
Documentation/devicetree/bindings/mips/loongson/ls2k-reset.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: "http://devicetree.org/schemas/mips/loongson/ls2k-reset.yaml#" 5 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 6 + 7 + title: Loongson 2K1000 PM Controller 8 + 9 + maintainers: 10 + - Qing Zhang <zhangqing@loongson.cn> 11 + 12 + description: | 13 + This controller can be found in Loongson-2K1000 Soc systems. 14 + 15 + properties: 16 + compatible: 17 + const: loongson,ls2k-pm 18 + 19 + reg: 20 + maxItems: 1 21 + 22 + required: 23 + - compatible 24 + - reg 25 + 26 + additionalProperties: false 27 + 28 + examples: 29 + - | 30 + bus { 31 + #address-cells = <2>; 32 + #size-cells = <2>; 33 + pm: reset-controller@1fe07000 { 34 + compatible = "loongson,ls2k-pm"; 35 + reg = <0 0x1fe07000 0 0x422>; 36 + }; 37 + }; 38 + ...
+2
Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
··· 19 19 - brcm,bcm7278-pcie # Broadcom 7278 Arm 20 20 - brcm,bcm7216-pcie # Broadcom 7216 Arm 21 21 - brcm,bcm7445-pcie # Broadcom 7445 Arm 22 + - brcm,bcm7425-pcie # Broadcom 7425 MIPs 23 + - brcm,bcm7435-pcie # Broadcom 7435 MIPs 22 24 23 25 reg: 24 26 maxItems: 1
+15 -7
arch/mips/Kconfig
··· 264 264 bool "Broadcom Generic BMIPS kernel" 265 265 select ARCH_HAS_RESET_CONTROLLER 266 266 select ARCH_HAS_SYNC_DMA_FOR_CPU_ALL 267 - select ARCH_HAS_PHYS_TO_DMA 268 267 select BOOT_RAW 269 268 select NO_EXCEPT_FILL 270 269 select USE_OF ··· 639 640 select SYS_SUPPORTS_MIPS16 640 641 select SYS_SUPPORTS_MULTITHREADING 641 642 select SYS_SUPPORTS_VPE_LOADER 642 - select SYS_HAS_EARLY_PRINTK 643 - select SYS_HAS_EARLY_PRINTK_8250 644 - select USE_GENERIC_EARLY_PRINTK_8250 645 643 select BOOT_RAW 646 644 select PINCTRL 647 645 select USE_OF ··· 761 765 select HAVE_PCI 762 766 select IRQ_MIPS_CPU 763 767 select IRQ_DOMAIN_HIERARCHY 764 - select NR_CPUS_DEFAULT_2 765 768 select PCI_DRIVERS_GENERIC 766 769 select PCI_XTALK_BRIDGE 767 770 select SYS_HAS_EARLY_PRINTK ··· 1606 1611 depends on SYS_HAS_CPU_R4300 1607 1612 select CPU_SUPPORTS_32BIT_KERNEL 1608 1613 select CPU_SUPPORTS_64BIT_KERNEL 1609 - select CPU_HAS_LOAD_STORE_LR 1610 1614 help 1611 1615 MIPS Technologies R4300-series processors. 1612 1616 ··· 1901 1907 config SYS_HAS_CPU_MIPS64_R2 1902 1908 bool 1903 1909 1910 + config SYS_HAS_CPU_MIPS64_R5 1911 + bool 1912 + select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT 1913 + 1904 1914 config SYS_HAS_CPU_MIPS64_R6 1905 1915 bool 1906 1916 select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT ··· 2063 2065 bool 2064 2066 config CPU_SUPPORTS_HUGEPAGES 2065 2067 bool 2066 - depends on !(32BIT && (ARCH_PHYS_ADDR_T_64BIT || EVA)) 2068 + depends on !(32BIT && (PHYS_ADDR_T_64BIT || EVA)) 2067 2069 config MIPS_PGD_C0_CONTEXT 2068 2070 bool 2069 2071 depends on 64BIT ··· 2113 2115 overhead as well as slower TLB fault handling. 2114 2116 2115 2117 If unsure, say N. 2118 + 2119 + config ZBOOT_LOAD_ADDRESS 2120 + hex "Compressed kernel load address" 2121 + default 0xffffffff80400000 if BCM47XX 2122 + default 0x0 2123 + depends on SYS_SUPPORTS_ZBOOT 2124 + help 2125 + The address to load compressed kernel, aka vmlinuz. 2126 + 2127 + This is only used if non-zero. 2116 2128 2117 2129 choice 2118 2130 prompt "Kernel page size"
-2
arch/mips/Makefile
··· 253 253 # 254 254 # Board-dependent options and extra files 255 255 # 256 - ifdef need-compiler 257 256 include $(srctree)/arch/mips/Kbuild.platforms 258 - endif 259 257 260 258 ifdef CONFIG_PHYSICAL_START 261 259 load-y = $(CONFIG_PHYSICAL_START)
-2
arch/mips/alchemy/common/gpiolib.c
··· 23 23 * 675 Mass Ave, Cambridge, MA 02139, USA. 24 24 * 25 25 * Notes : 26 - * This file must ONLY be built when CONFIG_GPIOLIB=y and 27 - * CONFIG_ALCHEMY_GPIO_INDIRECT=n, otherwise compilation will fail! 28 26 * au1000 SoC have only one GPIO block : GPIO1 29 27 * Au1100, Au15x0, Au12x0 have a second one : GPIO2 30 28 * Au1300 is totally different: 1 block with up to 128 GPIOs
-10
arch/mips/ath79/setup.c
··· 34 34 35 35 static char ath79_sys_type[ATH79_SYS_TYPE_LEN]; 36 36 37 - static void ath79_restart(char *command) 38 - { 39 - local_irq_disable(); 40 - ath79_device_reset_set(AR71XX_RESET_FULL_CHIP); 41 - for (;;) 42 - if (cpu_wait) 43 - cpu_wait(); 44 - } 45 - 46 37 static void ath79_halt(void) 47 38 { 48 39 while (1) ··· 225 234 226 235 detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX); 227 236 228 - _machine_restart = ath79_restart; 229 237 _machine_halt = ath79_halt; 230 238 pm_power_off = ath79_halt; 231 239 }
-1
arch/mips/bcm47xx/Platform
··· 4 4 cflags-$(CONFIG_BCM47XX) += \ 5 5 -I$(srctree)/arch/mips/include/asm/mach-bcm47xx 6 6 load-$(CONFIG_BCM47XX) := 0xffffffff80001000 7 - zload-$(CONFIG_BCM47XX) += 0xffffffff80400000
+5 -1
arch/mips/bcm47xx/board.c
··· 141 141 {{BCM47XX_BOARD_LINKSYS_WRT300NV11, "Linksys WRT300N V1.1"}, "WRT300N", "1.1"}, 142 142 {{BCM47XX_BOARD_LINKSYS_WRT310NV1, "Linksys WRT310N V1"}, "WRT310N", "1.0"}, 143 143 {{BCM47XX_BOARD_LINKSYS_WRT310NV2, "Linksys WRT310N V2"}, "WRT310N", "2.0"}, 144 + {{BCM47XX_BOARD_LINKSYS_WRT320N_V1, "Linksys WRT320N V1"}, "WRT320N", "1.0"}, 144 145 {{BCM47XX_BOARD_LINKSYS_WRT54G3GV2, "Linksys WRT54G3GV2-VF"}, "WRT54G3GV2-VF", "1.0"}, 145 146 {{BCM47XX_BOARD_LINKSYS_WRT610NV1, "Linksys WRT610N V1"}, "WRT610N", "1.0"}, 146 147 {{BCM47XX_BOARD_LINKSYS_WRT610NV2, "Linksys WRT610N V2"}, "WRT610N", "2.0"}, ··· 162 161 {{BCM47XX_BOARD_LUXUL_XWR_600_V1, "Luxul XWR-600 V1"}, "luxul_xwr600_v1"}, 163 162 {{BCM47XX_BOARD_LUXUL_XWR_1750_V1, "Luxul XWR-1750 V1"}, "luxul_xwr1750_v1"}, 164 163 {{BCM47XX_BOARD_NETGEAR_R6200_V1, "Netgear R6200 V1"}, "U12H192T00_NETGEAR"}, 164 + {{BCM47XX_BOARD_NETGEAR_R6300_V1, "Netgear R6300 V1"}, "U12H218T00_NETGEAR"}, 165 165 {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"}, 166 166 {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"}, 167 167 {{BCM47XX_BOARD_NETGEAR_WGR614_V10, "Netgear WGR614 V10"}, "U12H139T01_NETGEAR"}, 168 + {{BCM47XX_BOARD_NETGEAR_WN2500RP_V1, "Netgear WN2500RP V1"}, "U12H197T00_NETGEAR"}, 169 + {{BCM47XX_BOARD_NETGEAR_WN2500RP_V2, "Netgear WN2500RP V2"}, "U12H294T00_NETGEAR"}, 168 170 {{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"}, 169 171 {{BCM47XX_BOARD_NETGEAR_WNDR3400V1, "Netgear WNDR3400 V1"}, "U12H155T00_NETGEAR"}, 170 172 {{BCM47XX_BOARD_NETGEAR_WNDR3400V2, "Netgear WNDR3400 V2"}, "U12H187T00_NETGEAR"}, ··· 349 345 350 346 board_detected = bcm47xx_board_get_nvram(); 351 347 bcm47xx_board.board = board_detected->board; 352 - strlcpy(bcm47xx_board.name, board_detected->name, 348 + strscpy(bcm47xx_board.name, board_detected->name, 353 349 BCM47XX_BOARD_MAX_NAME); 354 350 } 355 351
+44
arch/mips/bcm47xx/buttons.c
··· 27 27 /* Asus */ 28 28 29 29 static const struct gpio_keys_button 30 + bcm47xx_buttons_asus_rtn10u[] __initconst = { 31 + BCM47XX_GPIO_KEY(20, KEY_WPS_BUTTON), 32 + BCM47XX_GPIO_KEY(21, KEY_RESTART), 33 + }; 34 + 35 + static const struct gpio_keys_button 30 36 bcm47xx_buttons_asus_rtn12[] __initconst = { 31 37 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), 32 38 BCM47XX_GPIO_KEY(1, KEY_RESTART), ··· 283 277 }; 284 278 285 279 static const struct gpio_keys_button 280 + bcm47xx_buttons_linksys_wrt310n_v2[] __initconst = { 281 + BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), 282 + BCM47XX_GPIO_KEY(6, KEY_RESTART), 283 + }; 284 + 285 + static const struct gpio_keys_button 286 + bcm47xx_buttons_linksys_wrt320n_v1[] __initconst = { 287 + BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), 288 + BCM47XX_GPIO_KEY(8, KEY_RESTART), 289 + }; 290 + 291 + static const struct gpio_keys_button 286 292 bcm47xx_buttons_linksys_wrt54g3gv2[] __initconst = { 287 293 BCM47XX_GPIO_KEY(5, KEY_WIMAX), 288 294 BCM47XX_GPIO_KEY(6, KEY_RESTART), ··· 410 392 }; 411 393 412 394 static const struct gpio_keys_button 395 + bcm47xx_buttons_netgear_r6300_v1[] __initconst = { 396 + BCM47XX_GPIO_KEY(6, KEY_RESTART), 397 + }; 398 + 399 + static const struct gpio_keys_button 400 + bcm47xx_buttons_netgear_wn2500rp_v1[] __initconst = { 401 + BCM47XX_GPIO_KEY(12, KEY_RESTART), 402 + BCM47XX_GPIO_KEY(31, KEY_WPS_BUTTON), 403 + }; 404 + 405 + static const struct gpio_keys_button 413 406 bcm47xx_buttons_netgear_wndr3400v1[] __initconst = { 414 407 BCM47XX_GPIO_KEY(4, KEY_RESTART), 415 408 BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), ··· 507 478 int err; 508 479 509 480 switch (board) { 481 + case BCM47XX_BOARD_ASUS_RTN10U: 482 + err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn10u); 483 + break; 510 484 case BCM47XX_BOARD_ASUS_RTN12: 511 485 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12); 512 486 break; ··· 640 608 case BCM47XX_BOARD_LINKSYS_WRT310NV1: 641 609 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1); 642 610 break; 611 + case BCM47XX_BOARD_LINKSYS_WRT310NV2: 612 + err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310n_v2); 613 + break; 614 + case BCM47XX_BOARD_LINKSYS_WRT320N_V1: 615 + err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt320n_v1); 616 + break; 643 617 case BCM47XX_BOARD_LINKSYS_WRT54G3GV2: 644 618 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2); 645 619 break; ··· 711 673 712 674 case BCM47XX_BOARD_NETGEAR_R6200_V1: 713 675 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6200_v1); 676 + break; 677 + case BCM47XX_BOARD_NETGEAR_R6300_V1: 678 + err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6300_v1); 679 + break; 680 + case BCM47XX_BOARD_NETGEAR_WN2500RP_V1: 681 + err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wn2500rp_v1); 714 682 break; 715 683 case BCM47XX_BOARD_NETGEAR_WNDR3400V1: 716 684 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
+21
arch/mips/bcm47xx/leds.c
··· 30 30 /* Asus */ 31 31 32 32 static const struct gpio_led 33 + bcm47xx_leds_asus_rtn10u[] __initconst = { 34 + BCM47XX_GPIO_LED(5, "green", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), 35 + BCM47XX_GPIO_LED(6, "green", "power", 1, LEDS_GPIO_DEFSTATE_ON), 36 + BCM47XX_GPIO_LED(7, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), 37 + BCM47XX_GPIO_LED(8, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), 38 + }; 39 + 40 + static const struct gpio_led 33 41 bcm47xx_leds_asus_rtn12[] __initconst = { 34 42 BCM47XX_GPIO_LED(2, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 35 43 BCM47XX_GPIO_LED(7, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), ··· 322 314 }; 323 315 324 316 static const struct gpio_led 317 + bcm47xx_leds_linksys_wrt320n_v1[] __initconst = { 318 + BCM47XX_GPIO_LED(1, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF), 319 + BCM47XX_GPIO_LED(2, "blue", "power", 0, LEDS_GPIO_DEFSTATE_ON), 320 + BCM47XX_GPIO_LED(4, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), 321 + }; 322 + 323 + static const struct gpio_led 325 324 bcm47xx_leds_linksys_wrt54g_generic[] __initconst = { 326 325 BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), 327 326 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), ··· 571 556 enum bcm47xx_board board = bcm47xx_board_get(); 572 557 573 558 switch (board) { 559 + case BCM47XX_BOARD_ASUS_RTN10U: 560 + bcm47xx_set_pdata(bcm47xx_leds_asus_rtn10u); 561 + break; 574 562 case BCM47XX_BOARD_ASUS_RTN12: 575 563 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12); 576 564 break; ··· 706 688 break; 707 689 case BCM47XX_BOARD_LINKSYS_WRT310NV1: 708 690 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1); 691 + break; 692 + case BCM47XX_BOARD_LINKSYS_WRT320N_V1: 693 + bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt320n_v1); 709 694 break; 710 695 case BCM47XX_BOARD_LINKSYS_WRT54G3GV2: 711 696 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g3gv2);
+6
arch/mips/bcm63xx/clk.c
··· 387 387 } 388 388 EXPORT_SYMBOL(clk_get_parent); 389 389 390 + int clk_set_parent(struct clk *clk, struct clk *parent) 391 + { 392 + return 0; 393 + } 394 + EXPORT_SYMBOL(clk_set_parent); 395 + 390 396 unsigned long clk_get_rate(struct clk *clk) 391 397 { 392 398 if (!clk)
+2 -104
arch/mips/bmips/dma.c
··· 1 - /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 5 - * 6 - * Copyright (C) 2014 Kevin Cernekee <cernekee@gmail.com> 7 - */ 1 + // SPDX-License-Identifier: GPL-2.0+ 8 2 9 - #define pr_fmt(fmt) "bmips-dma: " fmt 10 - 11 - #include <linux/device.h> 12 - #include <linux/dma-direction.h> 13 - #include <linux/dma-direct.h> 14 - #include <linux/init.h> 15 - #include <linux/io.h> 16 - #include <linux/of.h> 17 - #include <linux/printk.h> 18 - #include <linux/slab.h> 19 3 #include <linux/types.h> 20 4 #include <asm/bmips.h> 21 - 22 - /* 23 - * BCM338x has configurable address translation windows which allow the 24 - * peripherals' DMA addresses to be different from the Zephyr-visible 25 - * physical addresses. e.g. usb_dma_addr = zephyr_pa ^ 0x08000000 26 - * 27 - * If the "brcm,ubus" node has a "dma-ranges" property we will enable this 28 - * translation globally using the provided information. This implements a 29 - * very limited subset of "dma-ranges" support and it will probably be 30 - * replaced by a more generic version later. 31 - */ 32 - 33 - struct bmips_dma_range { 34 - u32 child_addr; 35 - u32 parent_addr; 36 - u32 size; 37 - }; 38 - 39 - static struct bmips_dma_range *bmips_dma_ranges; 40 - 41 - #define FLUSH_RAC 0x100 42 - 43 - dma_addr_t phys_to_dma(struct device *dev, phys_addr_t pa) 44 - { 45 - struct bmips_dma_range *r; 46 - 47 - for (r = bmips_dma_ranges; r && r->size; r++) { 48 - if (pa >= r->child_addr && 49 - pa < (r->child_addr + r->size)) 50 - return pa - r->child_addr + r->parent_addr; 51 - } 52 - return pa; 53 - } 54 - 55 - phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dma_addr) 56 - { 57 - struct bmips_dma_range *r; 58 - 59 - for (r = bmips_dma_ranges; r && r->size; r++) { 60 - if (dma_addr >= r->parent_addr && 61 - dma_addr < (r->parent_addr + r->size)) 62 - return dma_addr - r->parent_addr + r->child_addr; 63 - } 64 - return dma_addr; 65 - } 5 + #include <asm/io.h> 66 6 67 7 void arch_sync_dma_for_cpu_all(void) 68 8 { ··· 19 79 __raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG); 20 80 __raw_readl(cbr + BMIPS_RAC_CONFIG); 21 81 } 22 - 23 - static int __init bmips_init_dma_ranges(void) 24 - { 25 - struct device_node *np = 26 - of_find_compatible_node(NULL, NULL, "brcm,ubus"); 27 - const __be32 *data; 28 - struct bmips_dma_range *r; 29 - int len; 30 - 31 - if (!np) 32 - return 0; 33 - 34 - data = of_get_property(np, "dma-ranges", &len); 35 - if (!data) 36 - goto out_good; 37 - 38 - len /= sizeof(*data) * 3; 39 - if (!len) 40 - goto out_bad; 41 - 42 - /* add a dummy (zero) entry at the end as a sentinel */ 43 - bmips_dma_ranges = kcalloc(len + 1, sizeof(struct bmips_dma_range), 44 - GFP_KERNEL); 45 - if (!bmips_dma_ranges) 46 - goto out_bad; 47 - 48 - for (r = bmips_dma_ranges; len; len--, r++) { 49 - r->child_addr = be32_to_cpup(data++); 50 - r->parent_addr = be32_to_cpup(data++); 51 - r->size = be32_to_cpup(data++); 52 - } 53 - 54 - out_good: 55 - of_node_put(np); 56 - return 0; 57 - 58 - out_bad: 59 - pr_err("error parsing dma-ranges property\n"); 60 - of_node_put(np); 61 - return -EINVAL; 62 - } 63 - arch_initcall(bmips_init_dma_ranges);
+5 -1
arch/mips/boot/compressed/Makefile
··· 52 52 53 53 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o 54 54 55 - vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) += $(obj)/bswapdi.o $(obj)/ashldi3.o 55 + vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) += $(obj)/bswapdi.o $(obj)/ashldi3.o $(obj)/clz_ctz.o 56 56 57 57 targets := $(notdir $(vmlinuzobjs-y)) 58 58 ··· 88 88 89 89 # Calculate the load address of the compressed kernel image 90 90 hostprogs := calc_vmlinuz_load_addr 91 + 92 + ifneq (0x0,$(CONFIG_ZBOOT_LOAD_ADDRESS)) 93 + zload-y = $(CONFIG_ZBOOT_LOAD_ADDRESS) 94 + endif 91 95 92 96 ifneq ($(zload-y),) 93 97 VMLINUZ_LOAD_ADDRESS := $(zload-y)
+2
arch/mips/boot/compressed/clz_ctz.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + #include "../../../../lib/clz_ctz.c"
+30
arch/mips/boot/dts/brcm/bcm7425.dtsi
··· 584 584 }; 585 585 }; 586 586 }; 587 + 588 + pcie_0: pcie@8b20000 { 589 + status = "disabled"; 590 + compatible = "brcm,bcm7425-pcie"; 591 + 592 + ranges = <0x02000000 0x0 0xd0000000 0xd0000000 0x0 0x08000000 593 + 0x02000000 0x0 0xd8000000 0xd8000000 0x0 0x08000000 594 + 0x02000000 0x0 0xe0000000 0xe0000000 0x0 0x08000000 595 + 0x02000000 0x0 0xe8000000 0xe8000000 0x0 0x08000000>; 596 + 597 + reg = <0x10410000 0x19310>; 598 + aspm-no-l0s; 599 + device_type = "pci"; 600 + msi-controller; 601 + msi-parent = <&pcie_0>; 602 + #address-cells = <0x3>; 603 + #size-cells = <0x2>; 604 + bus-range = <0x0 0xff>; 605 + interrupt-map-mask = <0x0 0x0 0x0 0x7>; 606 + linux,pci-domain = <0x0>; 607 + 608 + interrupt-parent = <&periph_intc>; 609 + interrupts = <37>, <37>; 610 + interrupt-names = "pcie", "msi"; 611 + #interrupt-cells = <0x1>; 612 + interrupt-map = <0 0 0 1 &periph_intc 0x21 613 + 0 0 0 1 &periph_intc 0x22 614 + 0 0 0 1 &periph_intc 0x23 615 + 0 0 0 1 &periph_intc 0x24>; 616 + }; 587 617 };
+30
arch/mips/boot/dts/brcm/bcm7435.dtsi
··· 599 599 }; 600 600 }; 601 601 }; 602 + 603 + pcie_0: pcie@8b20000 { 604 + status = "disabled"; 605 + compatible = "brcm,bcm7435-pcie"; 606 + 607 + ranges = <0x02000000 0x0 0xd0000000 0xd0000000 0x0 0x08000000 608 + 0x02000000 0x0 0xd8000000 0xd8000000 0x0 0x08000000 609 + 0x02000000 0x0 0xe0000000 0xe0000000 0x0 0x08000000 610 + 0x02000000 0x0 0xe8000000 0xe8000000 0x0 0x08000000>; 611 + 612 + reg = <0x10410000 0x19310>; 613 + aspm-no-l0s; 614 + device_type = "pci"; 615 + msi-controller; 616 + msi-parent = <&pcie_0>; 617 + #address-cells = <0x3>; 618 + #size-cells = <0x2>; 619 + bus-range = <0x0 0xff>; 620 + interrupt-map-mask = <0x0 0x0 0x0 0x7>; 621 + linux,pci-domain = <0x0>; 622 + 623 + interrupt-parent = <&periph_intc>; 624 + interrupts = <39>, <39>; 625 + interrupt-names = "pcie", "msi"; 626 + #interrupt-cells = <0x1>; 627 + interrupt-map = <0 0 0 1 &periph_intc 0x23 628 + 0 0 0 1 &periph_intc 0x24 629 + 0 0 0 1 &periph_intc 0x25 630 + 0 0 0 1 &periph_intc 0x26>; 631 + }; 602 632 };
+9
arch/mips/boot/dts/brcm/bcm97425svmb.dts
··· 152 152 &waketimer { 153 153 status = "okay"; 154 154 }; 155 + 156 + &pcie_0 { 157 + status = "okay"; 158 + /* 1GB Memc0, 1GB Memc1 */ 159 + brcm,scb-sizes = <0 0x40000000 0 0x40000000>; 160 + dma-ranges = <0x43000000 0x00000000 0x00000000 0x00000000 0x0 0x10000000 161 + 0x43000000 0x00000000 0x10000000 0x20000000 0x0 0x30000000 162 + 0x43000000 0x00000000 0x40000000 0x90000000 0x0 0x40000000>; 163 + };
+9
arch/mips/boot/dts/brcm/bcm97435svmb.dts
··· 128 128 &waketimer { 129 129 status = "okay"; 130 130 }; 131 + 132 + &pcie_0 { 133 + status = "okay"; 134 + /* 1GB Memc0, 1GB Memc1 */ 135 + brcm,scb-sizes = <0 0x40000000 0 0x40000000>; 136 + dma-ranges = <0x43000000 0x00000000 0x00000000 0x00000000 0x0 0x10000000 137 + 0x43000000 0x00000000 0x10000000 0x20000000 0x0 0x30000000 138 + 0x43000000 0x00000000 0x40000000 0x90000000 0x0 0x40000000>; 139 + };
+70 -2
arch/mips/boot/dts/ingenic/ci20.dts
··· 78 78 enable-active-high; 79 79 }; 80 80 81 + hdmi_out: connector { 82 + compatible = "hdmi-connector"; 83 + label = "HDMI OUT"; 84 + type = "a"; 85 + 86 + port { 87 + hdmi_con: endpoint { 88 + remote-endpoint = <&dw_hdmi_out>; 89 + }; 90 + }; 91 + }; 92 + 81 93 ir: ir { 82 94 compatible = "gpio-ir-receiver"; 83 95 gpios = <&gpe 3 GPIO_ACTIVE_LOW>; ··· 114 102 gpio = <&gpf 14 GPIO_ACTIVE_LOW>; 115 103 enable-active-high; 116 104 }; 105 + 106 + hdmi_power: fixedregulator@3 { 107 + compatible = "regulator-fixed"; 108 + 109 + regulator-name = "hdmi_power"; 110 + regulator-min-microvolt = <5000000>; 111 + regulator-max-microvolt = <5000000>; 112 + 113 + gpio = <&gpa 25 0>; 114 + enable-active-high; 115 + }; 117 116 }; 118 117 119 118 &ext { ··· 137 114 * precision. 138 115 */ 139 116 assigned-clocks = <&cgu JZ4780_CLK_OTGPHY>, <&cgu JZ4780_CLK_RTC>, 140 - <&cgu JZ4780_CLK_SSIPLL>, <&cgu JZ4780_CLK_SSI>; 117 + <&cgu JZ4780_CLK_SSIPLL>, <&cgu JZ4780_CLK_SSI>, 118 + <&cgu JZ4780_CLK_HDMI>; 141 119 assigned-clock-parents = <0>, <&cgu JZ4780_CLK_RTCLK>, 142 120 <&cgu JZ4780_CLK_MPLL>, 143 121 <&cgu JZ4780_CLK_SSIPLL>; 144 - assigned-clock-rates = <48000000>, <0>, <54000000>; 122 + assigned-clock-rates = <48000000>, <0>, <54000000>, <0>, <27000000>; 145 123 }; 146 124 147 125 &tcu { ··· 533 509 bias-disable; 534 510 }; 535 511 512 + pins_hdmi_ddc: hdmi_ddc { 513 + function = "hdmi-ddc"; 514 + groups = "hdmi-ddc"; 515 + bias-disable; 516 + }; 517 + 536 518 pins_nemc: nemc { 537 519 function = "nemc"; 538 520 groups = "nemc-data", "nemc-cle-ale", "nemc-rd-we", "nemc-frd-fwe"; ··· 567 537 function = "mmc1"; 568 538 groups = "mmc1-1bit-d", "mmc1-4bit-d"; 569 539 bias-disable; 540 + }; 541 + }; 542 + 543 + &hdmi { 544 + status = "okay"; 545 + 546 + pinctrl-names = "default"; 547 + pinctrl-0 = <&pins_hdmi_ddc>; 548 + 549 + hdmi-5v-supply = <&hdmi_power>; 550 + 551 + ports { 552 + #address-cells = <1>; 553 + #size-cells = <0>; 554 + 555 + port@0 { 556 + reg = <0>; 557 + dw_hdmi_in: endpoint { 558 + remote-endpoint = <&lcd_out>; 559 + }; 560 + }; 561 + 562 + port@1 { 563 + reg = <1>; 564 + dw_hdmi_out: endpoint { 565 + remote-endpoint = <&hdmi_con>; 566 + }; 567 + }; 568 + }; 569 + }; 570 + 571 + &lcdc0 { 572 + status = "okay"; 573 + 574 + port { 575 + lcd_out: endpoint { 576 + remote-endpoint = <&dw_hdmi_in>; 577 + }; 570 578 }; 571 579 };
+1 -1
arch/mips/boot/dts/ingenic/jz4725b.dtsi
··· 321 321 322 322 lcd: lcd-controller@13050000 { 323 323 compatible = "ingenic,jz4725b-lcd"; 324 - reg = <0x13050000 0x1000>; 324 + reg = <0x13050000 0x130>; /* tbc */ 325 325 326 326 interrupt-parent = <&intc>; 327 327 interrupts = <31>;
+1 -1
arch/mips/boot/dts/ingenic/jz4740.dtsi
··· 323 323 324 324 lcd: lcd-controller@13050000 { 325 325 compatible = "ingenic,jz4740-lcd"; 326 - reg = <0x13050000 0x1000>; 326 + reg = <0x13050000 0x60>; /* LCDCMD1+4 */ 327 327 328 328 interrupt-parent = <&intc>; 329 329 interrupts = <30>;
+1 -1
arch/mips/boot/dts/ingenic/jz4770.dtsi
··· 399 399 400 400 lcd: lcd-controller@13050000 { 401 401 compatible = "ingenic,jz4770-lcd"; 402 - reg = <0x13050000 0x300>; 402 + reg = <0x13050000 0x130>; /* tbc */ 403 403 404 404 interrupt-parent = <&intc>; 405 405 interrupts = <31>;
+40
arch/mips/boot/dts/ingenic/jz4780.dtsi
··· 444 444 status = "disabled"; 445 445 }; 446 446 447 + hdmi: hdmi@10180000 { 448 + compatible = "ingenic,jz4780-dw-hdmi"; 449 + reg = <0x10180000 0x8000>; 450 + reg-io-width = <4>; 451 + 452 + clocks = <&cgu JZ4780_CLK_AHB0>, <&cgu JZ4780_CLK_HDMI>; 453 + clock-names = "iahb", "isfr"; 454 + 455 + interrupt-parent = <&intc>; 456 + interrupts = <3>; 457 + 458 + status = "disabled"; 459 + }; 460 + 461 + lcdc0: lcdc0@13050000 { 462 + compatible = "ingenic,jz4780-lcd"; 463 + reg = <0x13050000 0x1800>; 464 + 465 + clocks = <&cgu JZ4780_CLK_TVE>, <&cgu JZ4780_CLK_LCD0PIXCLK>; 466 + clock-names = "lcd", "lcd_pclk"; 467 + 468 + interrupt-parent = <&intc>; 469 + interrupts = <31>; 470 + 471 + status = "disabled"; 472 + }; 473 + 474 + lcdc1: lcdc1@130a0000 { 475 + compatible = "ingenic,jz4780-lcd"; 476 + reg = <0x130a0000 0x1800>; 477 + 478 + clocks = <&cgu JZ4780_CLK_TVE>, <&cgu JZ4780_CLK_LCD1PIXCLK>; 479 + clock-names = "lcd", "lcd_pclk"; 480 + 481 + interrupt-parent = <&intc>; 482 + interrupts = <23>; 483 + 484 + status = "disabled"; 485 + }; 486 + 447 487 nemc: nemc@13410000 { 448 488 compatible = "ingenic,jz4780-nemc", "simple-mfd"; 449 489 reg = <0x13410000 0x10000>;
+5
arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi
··· 52 52 0 0x40000000 0 0x40000000 0 0x40000000 53 53 0xfe 0x00000000 0xfe 0x00000000 0 0x40000000>; 54 54 55 + pm: reset-controller@1fe07000 { 56 + compatible = "loongson,ls2k-pm"; 57 + reg = <0 0x1fe07000 0 0x422>; 58 + }; 59 + 55 60 liointc0: interrupt-controller@1fe11400 { 56 61 compatible = "loongson,liointc-2.0"; 57 62 reg = <0 0x1fe11400 0 0x40>,
+2
arch/mips/cavium-octeon/octeon-platform.c
··· 328 328 329 329 pd->dev.platform_data = &octeon_ehci_pdata; 330 330 octeon_ehci_hw_start(&pd->dev); 331 + put_device(&pd->dev); 331 332 332 333 return ret; 333 334 } ··· 392 391 393 392 pd->dev.platform_data = &octeon_ohci_pdata; 394 393 octeon_ohci_hw_start(&pd->dev); 394 + put_device(&pd->dev); 395 395 396 396 return ret; 397 397 }
+1
arch/mips/cavium-octeon/octeon-usb.c
··· 537 537 devm_iounmap(&pdev->dev, base); 538 538 devm_release_mem_region(&pdev->dev, res->start, 539 539 resource_size(res)); 540 + put_device(&pdev->dev); 540 541 } 541 542 } while (node != NULL); 542 543
+6
arch/mips/configs/ci20_defconfig
··· 98 98 CONFIG_IR_GPIO_CIR=m 99 99 CONFIG_IR_GPIO_TX=m 100 100 CONFIG_MEDIA_SUPPORT=m 101 + CONFIG_DRM=m 102 + CONFIG_DRM_INGENIC=m 103 + CONFIG_DRM_INGENIC_DW_HDMI=m 104 + CONFIG_DRM_DISPLAY_CONNECTOR=m 101 105 # CONFIG_VGA_CONSOLE is not set 106 + CONFIG_FB=y 107 + CONFIG_FRAMEBUFFER_CONSOLE=y 102 108 # CONFIG_HID is not set 103 109 CONFIG_USB=y 104 110 CONFIG_USB_STORAGE=y
-4
arch/mips/configs/rbtx49xx_defconfig
··· 10 10 CONFIG_SLAB=y 11 11 CONFIG_MACH_TX49XX=y 12 12 CONFIG_TOSHIBA_RBTX4927=y 13 - CONFIG_TOSHIBA_RBTX4938=y 14 - CONFIG_TOSHIBA_RBTX4939=y 15 - CONFIG_TOSHIBA_RBTX4938_MPLEX_KEEP=y 16 13 # CONFIG_SECCOMP is not set 17 14 CONFIG_PCI=y 18 15 CONFIG_MODULES=y ··· 35 38 CONFIG_MTD_CFI_AMDSTD=y 36 39 CONFIG_MTD_COMPLEX_MAPPINGS=y 37 40 CONFIG_MTD_PHYSMAP=y 38 - CONFIG_MTD_RBTX4939=y 39 41 CONFIG_MTD_RAW_NAND=m 40 42 CONFIG_MTD_NAND_TXX9NDFMC=m 41 43 CONFIG_BLK_DEV_LOOP=y
+1 -1
arch/mips/dec/prom/init.c
··· 113 113 if ((current_cpu_type() == CPU_R4000SC) || 114 114 (current_cpu_type() == CPU_R4400SC)) { 115 115 static const char r4k_msg[] __initconst = 116 - "Please recompile with \"CONFIG_CPU_R4x00 = y\".\n"; 116 + "Please recompile with \"CONFIG_CPU_R4X00 = y\".\n"; 117 117 printk(cpu_msg); 118 118 printk(r4k_msg); 119 119 dec_machine_halt();
+1 -2
arch/mips/generic/Platform
··· 13 13 cflags-$(CONFIG_MIPS_GENERIC) += -I$(srctree)/arch/mips/include/asm/mach-generic 14 14 15 15 load-$(CONFIG_MIPS_GENERIC) += 0xffffffff80100000 16 - zload-$(CONFIG_MIPS_GENERIC) += 0xffffffff81000000 17 - all-$(CONFIG_MIPS_GENERIC) := vmlinux.gz.itb 16 + all-$(CONFIG_MIPS_GENERIC) += vmlinux.gz.itb 18 17 19 18 its-y := vmlinux.its.S 20 19 its-$(CONFIG_FIT_IMAGE_FDT_BOSTON) += board-boston.its.S
+6 -5
arch/mips/generic/init.c
··· 110 110 111 111 void __init device_tree_init(void) 112 112 { 113 - int err; 114 - 115 113 unflatten_and_copy_device_tree(); 116 114 mips_cpc_probe(); 117 115 118 - err = register_cps_smp_ops(); 119 - if (err) 120 - err = register_up_smp_ops(); 116 + if (!register_cps_smp_ops()) 117 + return; 118 + if (!register_vsmp_smp_ops()) 119 + return; 120 + 121 + register_up_smp_ops(); 121 122 } 122 123 123 124 int __init apply_mips_fdt_fixups(void *fdt_out, size_t fdt_out_size,
+22
arch/mips/include/asm/asm.h
··· 19 19 20 20 #include <asm/sgidefs.h> 21 21 #include <asm/asm-eva.h> 22 + #include <asm/isa-rev.h> 22 23 23 24 #ifndef __VDSO__ 24 25 /* ··· 212 211 #define LONG_SUB sub 213 212 #define LONG_SUBU subu 214 213 #define LONG_L lw 214 + #define LONG_LL ll 215 + #define LONG_SC sc 215 216 #define LONG_S sw 216 217 #define LONG_SP swp 217 218 #define LONG_SLL sll ··· 222 219 #define LONG_SRLV srlv 223 220 #define LONG_SRA sra 224 221 #define LONG_SRAV srav 222 + #define LONG_INS ins 223 + #define LONG_EXT ext 225 224 226 225 #ifdef __ASSEMBLY__ 227 226 #define LONG .word ··· 241 236 #define LONG_SUB dsub 242 237 #define LONG_SUBU dsubu 243 238 #define LONG_L ld 239 + #define LONG_LL lld 240 + #define LONG_SC scd 244 241 #define LONG_S sd 245 242 #define LONG_SP sdp 246 243 #define LONG_SLL dsll ··· 251 244 #define LONG_SRLV dsrlv 252 245 #define LONG_SRA dsra 253 246 #define LONG_SRAV dsrav 247 + #define LONG_INS dins 248 + #define LONG_EXT dext 254 249 255 250 #ifdef __ASSEMBLY__ 256 251 #define LONG .dword ··· 328 319 #endif 329 320 330 321 #define SSNOP sll zero, zero, 1 322 + 323 + /* 324 + * Using a branch-likely instruction to check the result of an sc instruction 325 + * works around a bug present in R10000 CPUs prior to revision 3.0 that could 326 + * cause ll-sc sequences to execute non-atomically. 327 + */ 328 + #ifdef CONFIG_WAR_R10000_LLSC 329 + # define SC_BEQZ beqzl 330 + #elif MIPS_ISA_REV >= 6 331 + # define SC_BEQZ beqzc 332 + #else 333 + # define SC_BEQZ beqz 334 + #endif 331 335 332 336 #ifdef CONFIG_SGI_IP28 333 337 /* Inhibit speculative stores to volatile (e.g.DMA) or invalid addresses. */
+5 -6
arch/mips/include/asm/atomic.h
··· 16 16 17 17 #include <linux/irqflags.h> 18 18 #include <linux/types.h> 19 + #include <asm/asm.h> 19 20 #include <asm/barrier.h> 20 21 #include <asm/compiler.h> 21 22 #include <asm/cpu-features.h> 22 23 #include <asm/cmpxchg.h> 23 - #include <asm/llsc.h> 24 24 #include <asm/sync.h> 25 - #include <asm/war.h> 26 25 27 26 #define ATOMIC_OPS(pfx, type) \ 28 27 static __always_inline type arch_##pfx##_read(const pfx##_t *v) \ ··· 73 74 "1: " #ll " %0, %1 # " #pfx "_" #op " \n" \ 74 75 " " #asm_op " %0, %2 \n" \ 75 76 " " #sc " %0, %1 \n" \ 76 - "\t" __SC_BEQZ "%0, 1b \n" \ 77 + "\t" __stringify(SC_BEQZ) " %0, 1b \n" \ 77 78 " .set pop \n" \ 78 79 : "=&r" (temp), "+" GCC_OFF_SMALL_ASM() (v->counter) \ 79 80 : "Ir" (i) : __LLSC_CLOBBER); \ ··· 103 104 "1: " #ll " %1, %2 # " #pfx "_" #op "_return\n" \ 104 105 " " #asm_op " %0, %1, %3 \n" \ 105 106 " " #sc " %0, %2 \n" \ 106 - "\t" __SC_BEQZ "%0, 1b \n" \ 107 + "\t" __stringify(SC_BEQZ) " %0, 1b \n" \ 107 108 " " #asm_op " %0, %1, %3 \n" \ 108 109 " .set pop \n" \ 109 110 : "=&r" (result), "=&r" (temp), \ ··· 136 137 "1: " #ll " %1, %2 # " #pfx "_fetch_" #op "\n" \ 137 138 " " #asm_op " %0, %1, %3 \n" \ 138 139 " " #sc " %0, %2 \n" \ 139 - "\t" __SC_BEQZ "%0, 1b \n" \ 140 + "\t" __stringify(SC_BEQZ) " %0, 1b \n" \ 140 141 " .set pop \n" \ 141 142 " move %0, %1 \n" \ 142 143 : "=&r" (result), "=&r" (temp), \ ··· 236 237 " .set push \n" \ 237 238 " .set " MIPS_ISA_LEVEL " \n" \ 238 239 " " #sc " %1, %2 \n" \ 239 - " " __SC_BEQZ "%1, 1b \n" \ 240 + " " __stringify(SC_BEQZ) " %1, 1b \n" \ 240 241 "2: " __SYNC(full, loongson3_war) " \n" \ 241 242 " .set pop \n" \ 242 243 : "=&r" (result), "=&r" (temp), \
+11 -13
arch/mips/include/asm/bitops.h
··· 16 16 #include <linux/bits.h> 17 17 #include <linux/compiler.h> 18 18 #include <linux/types.h> 19 + #include <asm/asm.h> 19 20 #include <asm/barrier.h> 20 21 #include <asm/byteorder.h> /* sigh ... */ 21 22 #include <asm/compiler.h> 22 23 #include <asm/cpu-features.h> 23 - #include <asm/isa-rev.h> 24 - #include <asm/llsc.h> 25 24 #include <asm/sgidefs.h> 26 - #include <asm/war.h> 27 25 28 26 #define __bit_op(mem, insn, inputs...) do { \ 29 27 unsigned long __temp; \ ··· 30 32 " .set push \n" \ 31 33 " .set " MIPS_ISA_LEVEL " \n" \ 32 34 " " __SYNC(full, loongson3_war) " \n" \ 33 - "1: " __LL "%0, %1 \n" \ 35 + "1: " __stringify(LONG_LL) " %0, %1 \n" \ 34 36 " " insn " \n" \ 35 - " " __SC "%0, %1 \n" \ 36 - " " __SC_BEQZ "%0, 1b \n" \ 37 + " " __stringify(LONG_SC) " %0, %1 \n" \ 38 + " " __stringify(SC_BEQZ) " %0, 1b \n" \ 37 39 " .set pop \n" \ 38 40 : "=&r"(__temp), "+" GCC_OFF_SMALL_ASM()(mem) \ 39 41 : inputs \ ··· 47 49 " .set push \n" \ 48 50 " .set " MIPS_ISA_LEVEL " \n" \ 49 51 " " __SYNC(full, loongson3_war) " \n" \ 50 - "1: " __LL ll_dst ", %2 \n" \ 52 + "1: " __stringify(LONG_LL) " " ll_dst ", %2\n" \ 51 53 " " insn " \n" \ 52 - " " __SC "%1, %2 \n" \ 53 - " " __SC_BEQZ "%1, 1b \n" \ 54 + " " __stringify(LONG_SC) " %1, %2 \n" \ 55 + " " __stringify(SC_BEQZ) " %1, 1b \n" \ 54 56 " .set pop \n" \ 55 57 : "=&r"(__orig), "=&r"(__temp), \ 56 58 "+" GCC_OFF_SMALL_ASM()(mem) \ ··· 96 98 } 97 99 98 100 if ((MIPS_ISA_REV >= 2) && __builtin_constant_p(bit) && (bit >= 16)) { 99 - __bit_op(*m, __INS "%0, %3, %2, 1", "i"(bit), "r"(~0)); 101 + __bit_op(*m, __stringify(LONG_INS) " %0, %3, %2, 1", "i"(bit), "r"(~0)); 100 102 return; 101 103 } 102 104 ··· 124 126 } 125 127 126 128 if ((MIPS_ISA_REV >= 2) && __builtin_constant_p(bit)) { 127 - __bit_op(*m, __INS "%0, $0, %2, 1", "i"(bit)); 129 + __bit_op(*m, __stringify(LONG_INS) " %0, $0, %2, 1", "i"(bit)); 128 130 return; 129 131 } 130 132 ··· 232 234 res = __mips_test_and_clear_bit(nr, addr); 233 235 } else if ((MIPS_ISA_REV >= 2) && __builtin_constant_p(nr)) { 234 236 res = __test_bit_op(*m, "%1", 235 - __EXT "%0, %1, %3, 1;" 236 - __INS "%1, $0, %3, 1", 237 + __stringify(LONG_EXT) " %0, %1, %3, 1;" 238 + __stringify(LONG_INS) " %1, $0, %3, 1", 237 239 "i"(bit)); 238 240 } else { 239 241 orig = __test_bit_op(*m, "%0",
+4 -5
arch/mips/include/asm/cmpxchg.h
··· 10 10 11 11 #include <linux/bug.h> 12 12 #include <linux/irqflags.h> 13 + #include <asm/asm.h> 13 14 #include <asm/compiler.h> 14 - #include <asm/llsc.h> 15 15 #include <asm/sync.h> 16 - #include <asm/war.h> 17 16 18 17 /* 19 18 * These functions doesn't exist, so if they are called you'll either: ··· 47 48 " move $1, %z3 \n" \ 48 49 " .set " MIPS_ISA_ARCH_LEVEL " \n" \ 49 50 " " st " $1, %1 \n" \ 50 - "\t" __SC_BEQZ "$1, 1b \n" \ 51 + "\t" __stringify(SC_BEQZ) " $1, 1b \n" \ 51 52 " .set pop \n" \ 52 53 : "=&r" (__ret), "=" GCC_OFF_SMALL_ASM() (*m) \ 53 54 : GCC_OFF_SMALL_ASM() (*m), "Jr" (val) \ ··· 126 127 " move $1, %z4 \n" \ 127 128 " .set "MIPS_ISA_ARCH_LEVEL" \n" \ 128 129 " " st " $1, %1 \n" \ 129 - "\t" __SC_BEQZ "$1, 1b \n" \ 130 + "\t" __stringify(SC_BEQZ) " $1, 1b \n" \ 130 131 " .set pop \n" \ 131 132 "2: " __SYNC(full, loongson3_war) " \n" \ 132 133 : "=&r" (__ret), "=" GCC_OFF_SMALL_ASM() (*m) \ ··· 281 282 /* Attempt to store new at ptr */ 282 283 " scd %L1, %2 \n" 283 284 /* If we failed, loop! */ 284 - "\t" __SC_BEQZ "%L1, 1b \n" 285 + "\t" __stringify(SC_BEQZ) " %L1, 1b \n" 285 286 "2: " __SYNC(full, loongson3_war) " \n" 286 287 " .set pop \n" 287 288 : "=&r"(ret),
+1 -1
arch/mips/include/asm/kgdb.h
··· 18 18 #ifdef CONFIG_32BIT 19 19 #define KGDB_GDB_REG_SIZE 32 20 20 #define GDB_SIZEOF_REG sizeof(u32) 21 - #else /* CONFIG_CPU_32BIT */ 21 + #else /* CONFIG_32BIT */ 22 22 #define KGDB_GDB_REG_SIZE 64 23 23 #define GDB_SIZEOF_REG sizeof(u64) 24 24 #endif
+7 -6
arch/mips/include/asm/kvm_host.h
··· 20 20 #include <linux/threads.h> 21 21 #include <linux/spinlock.h> 22 22 23 + #include <asm/asm.h> 23 24 #include <asm/inst.h> 24 25 #include <asm/mipsregs.h> 25 26 ··· 380 379 __asm__ __volatile__( 381 380 " .set push \n" 382 381 " .set "MIPS_ISA_ARCH_LEVEL" \n" 383 - " " __LL "%0, %1 \n" 382 + " "__stringify(LONG_LL) " %0, %1 \n" 384 383 " or %0, %2 \n" 385 - " " __SC "%0, %1 \n" 384 + " "__stringify(LONG_SC) " %0, %1 \n" 386 385 " .set pop \n" 387 386 : "=&r" (temp), "+m" (*reg) 388 387 : "r" (val)); ··· 397 396 __asm__ __volatile__( 398 397 " .set push \n" 399 398 " .set "MIPS_ISA_ARCH_LEVEL" \n" 400 - " " __LL "%0, %1 \n" 399 + " "__stringify(LONG_LL) " %0, %1 \n" 401 400 " and %0, %2 \n" 402 - " " __SC "%0, %1 \n" 401 + " "__stringify(LONG_SC) " %0, %1 \n" 403 402 " .set pop \n" 404 403 : "=&r" (temp), "+m" (*reg) 405 404 : "r" (~val)); ··· 415 414 __asm__ __volatile__( 416 415 " .set push \n" 417 416 " .set "MIPS_ISA_ARCH_LEVEL" \n" 418 - " " __LL "%0, %1 \n" 417 + " "__stringify(LONG_LL) " %0, %1 \n" 419 418 " and %0, %2 \n" 420 419 " or %0, %3 \n" 421 - " " __SC "%0, %1 \n" 420 + " "__stringify(LONG_SC) " %0, %1 \n" 422 421 " .set pop \n" 423 422 : "=&r" (temp), "+m" (*reg) 424 423 : "r" (~change), "r" (val & change));
-39
arch/mips/include/asm/llsc.h
··· 1 - /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 5 - * 6 - * Macros for 32/64-bit neutral inline assembler 7 - */ 8 - 9 - #ifndef __ASM_LLSC_H 10 - #define __ASM_LLSC_H 11 - 12 - #include <asm/isa-rev.h> 13 - 14 - #if _MIPS_SZLONG == 32 15 - #define __LL "ll " 16 - #define __SC "sc " 17 - #define __INS "ins " 18 - #define __EXT "ext " 19 - #elif _MIPS_SZLONG == 64 20 - #define __LL "lld " 21 - #define __SC "scd " 22 - #define __INS "dins " 23 - #define __EXT "dext " 24 - #endif 25 - 26 - /* 27 - * Using a branch-likely instruction to check the result of an sc instruction 28 - * works around a bug present in R10000 CPUs prior to revision 3.0 that could 29 - * cause ll-sc sequences to execute non-atomically. 30 - */ 31 - #ifdef CONFIG_WAR_R10000_LLSC 32 - # define __SC_BEQZ "beqzl " 33 - #elif MIPS_ISA_REV >= 6 34 - # define __SC_BEQZ "beqzc " 35 - #else 36 - # define __SC_BEQZ "beqz " 37 - #endif 38 - 39 - #endif /* __ASM_LLSC_H */
+16 -47
arch/mips/include/asm/local.h
··· 5 5 #include <linux/percpu.h> 6 6 #include <linux/bitops.h> 7 7 #include <linux/atomic.h> 8 + #include <asm/asm.h> 8 9 #include <asm/cmpxchg.h> 9 10 #include <asm/compiler.h> 10 - #include <asm/war.h> 11 11 12 12 typedef struct 13 13 { ··· 31 31 { 32 32 unsigned long result; 33 33 34 - if (kernel_uses_llsc && IS_ENABLED(CONFIG_WAR_R10000_LLSC)) { 35 - unsigned long temp; 36 - 37 - __asm__ __volatile__( 38 - " .set push \n" 39 - " .set arch=r4000 \n" 40 - __SYNC(full, loongson3_war) " \n" 41 - "1:" __LL "%1, %2 # local_add_return \n" 42 - " addu %0, %1, %3 \n" 43 - __SC "%0, %2 \n" 44 - " beqzl %0, 1b \n" 45 - " addu %0, %1, %3 \n" 46 - " .set pop \n" 47 - : "=&r" (result), "=&r" (temp), "=m" (l->a.counter) 48 - : "Ir" (i), "m" (l->a.counter) 49 - : "memory"); 50 - } else if (kernel_uses_llsc) { 34 + if (kernel_uses_llsc) { 51 35 unsigned long temp; 52 36 53 37 __asm__ __volatile__( 54 38 " .set push \n" 55 39 " .set "MIPS_ISA_ARCH_LEVEL" \n" 56 - __SYNC(full, loongson3_war) " \n" 57 - "1:" __LL "%1, %2 # local_add_return \n" 58 - " addu %0, %1, %3 \n" 59 - __SC "%0, %2 \n" 60 - " beqz %0, 1b \n" 61 - " addu %0, %1, %3 \n" 40 + __SYNC(full, loongson3_war) " \n" 41 + "1:" __stringify(LONG_LL) " %1, %2 \n" 42 + __stringify(LONG_ADDU) " %0, %1, %3 \n" 43 + __stringify(LONG_SC) " %0, %2 \n" 44 + __stringify(SC_BEQZ) " %0, 1b \n" 45 + __stringify(LONG_ADDU) " %0, %1, %3 \n" 62 46 " .set pop \n" 63 47 : "=&r" (result), "=&r" (temp), "=m" (l->a.counter) 64 48 : "Ir" (i), "m" (l->a.counter) ··· 64 80 { 65 81 unsigned long result; 66 82 67 - if (kernel_uses_llsc && IS_ENABLED(CONFIG_WAR_R10000_LLSC)) { 68 - unsigned long temp; 69 - 70 - __asm__ __volatile__( 71 - " .set push \n" 72 - " .set arch=r4000 \n" 73 - __SYNC(full, loongson3_war) " \n" 74 - "1:" __LL "%1, %2 # local_sub_return \n" 75 - " subu %0, %1, %3 \n" 76 - __SC "%0, %2 \n" 77 - " beqzl %0, 1b \n" 78 - " subu %0, %1, %3 \n" 79 - " .set pop \n" 80 - : "=&r" (result), "=&r" (temp), "=m" (l->a.counter) 81 - : "Ir" (i), "m" (l->a.counter) 82 - : "memory"); 83 - } else if (kernel_uses_llsc) { 83 + if (kernel_uses_llsc) { 84 84 unsigned long temp; 85 85 86 86 __asm__ __volatile__( 87 87 " .set push \n" 88 88 " .set "MIPS_ISA_ARCH_LEVEL" \n" 89 - __SYNC(full, loongson3_war) " \n" 90 - "1:" __LL "%1, %2 # local_sub_return \n" 91 - " subu %0, %1, %3 \n" 92 - __SC "%0, %2 \n" 93 - " beqz %0, 1b \n" 94 - " subu %0, %1, %3 \n" 89 + __SYNC(full, loongson3_war) " \n" 90 + "1:" __stringify(LONG_LL) " %1, %2 \n" 91 + __stringify(LONG_SUBU) " %0, %1, %3 \n" 92 + __stringify(LONG_SUBU) " %0, %1, %3 \n" 93 + __stringify(LONG_SC) " %0, %2 \n" 94 + __stringify(SC_BEQZ) " %0, 1b \n" 95 + __stringify(LONG_SUBU) " %0, %1, %3 \n" 95 96 " .set pop \n" 96 97 : "=&r" (result), "=&r" (temp), "=m" (l->a.counter) 97 98 : "Ir" (i), "m" (l->a.counter)
+4
arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
··· 72 72 BCM47XX_BOARD_LINKSYS_WRT300NV11, 73 73 BCM47XX_BOARD_LINKSYS_WRT310NV1, 74 74 BCM47XX_BOARD_LINKSYS_WRT310NV2, 75 + BCM47XX_BOARD_LINKSYS_WRT320N_V1, 75 76 BCM47XX_BOARD_LINKSYS_WRT54G3GV2, 76 77 BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101, 77 78 BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467, ··· 100 99 BCM47XX_BOARD_MOTOROLA_WR850GV2V3, 101 100 102 101 BCM47XX_BOARD_NETGEAR_R6200_V1, 102 + BCM47XX_BOARD_NETGEAR_R6300_V1, 103 103 BCM47XX_BOARD_NETGEAR_WGR614V8, 104 104 BCM47XX_BOARD_NETGEAR_WGR614V9, 105 105 BCM47XX_BOARD_NETGEAR_WGR614_V10, 106 + BCM47XX_BOARD_NETGEAR_WN2500RP_V1, 107 + BCM47XX_BOARD_NETGEAR_WN2500RP_V2, 106 108 BCM47XX_BOARD_NETGEAR_WNDR3300, 107 109 BCM47XX_BOARD_NETGEAR_WNDR3400V1, 108 110 BCM47XX_BOARD_NETGEAR_WNDR3400V2,
+2 -2
arch/mips/include/asm/mach-loongson64/kernel-entry-init.h
··· 32 32 nop 33 33 /* Loongson-3A R2/R3 */ 34 34 andi t0, (PRID_IMP_MASK | PRID_REV_MASK) 35 - slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) 35 + slti t0, t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) 36 36 bnez t0, 2f 37 37 nop 38 38 1: ··· 63 63 nop 64 64 /* Loongson-3A R2/R3 */ 65 65 andi t0, (PRID_IMP_MASK | PRID_REV_MASK) 66 - slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) 66 + slti t0, t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0) 67 67 bnez t0, 2f 68 68 nop 69 69 1:
-8
arch/mips/include/asm/mach-tx49xx/mangle-port.h
··· 9 9 10 10 #define ioswabb(a, x) (x) 11 11 #define __mem_ioswabb(a, x) (x) 12 - #if defined(CONFIG_TOSHIBA_RBTX4939) && \ 13 - IS_ENABLED(CONFIG_SMC91X) && \ 14 - defined(__BIG_ENDIAN) 15 - #define NEEDS_TXX9_IOSWABW 16 - extern u16 (*ioswabw)(volatile u16 *a, u16 x); 17 - extern u16 (*__mem_ioswabw)(volatile u16 *a, u16 x); 18 - #else 19 12 #define ioswabw(a, x) le16_to_cpu((__force __le16)(x)) 20 13 #define __mem_ioswabw(a, x) (x) 21 - #endif 22 14 #define ioswabl(a, x) le32_to_cpu((__force __le32)(x)) 23 15 #define __mem_ioswabl(a, x) (x) 24 16 #define ioswabq(a, x) le64_to_cpu((__force __le64)(x))
+7 -12
arch/mips/include/asm/mips-cps.h
··· 7 7 #ifndef __MIPS_ASM_MIPS_CPS_H__ 8 8 #define __MIPS_ASM_MIPS_CPS_H__ 9 9 10 + #include <linux/bitfield.h> 10 11 #include <linux/io.h> 11 12 #include <linux/types.h> 12 13 ··· 113 112 */ 114 113 static inline unsigned int mips_cps_numclusters(void) 115 114 { 116 - unsigned int num_clusters; 117 - 118 115 if (mips_cm_revision() < CM_REV_CM3_5) 119 116 return 1; 120 117 121 - num_clusters = read_gcr_config() & CM_GCR_CONFIG_NUM_CLUSTERS; 122 - num_clusters >>= __ffs(CM_GCR_CONFIG_NUM_CLUSTERS); 123 - return num_clusters; 118 + return FIELD_GET(CM_GCR_CONFIG_NUM_CLUSTERS, read_gcr_config()); 124 119 } 125 120 126 121 /** ··· 166 169 return 0; 167 170 168 171 /* Add one before masking to handle 0xff indicating no cores */ 169 - return (mips_cps_cluster_config(cluster) + 1) & CM_GCR_CONFIG_PCORES; 172 + return FIELD_GET(CM_GCR_CONFIG_PCORES, 173 + mips_cps_cluster_config(cluster) + 1); 170 174 } 171 175 172 176 /** ··· 179 181 */ 180 182 static inline unsigned int mips_cps_numiocu(unsigned int cluster) 181 183 { 182 - unsigned int num_iocu; 183 - 184 184 if (!mips_cm_present()) 185 185 return 0; 186 186 187 - num_iocu = mips_cps_cluster_config(cluster) & CM_GCR_CONFIG_NUMIOCU; 188 - num_iocu >>= __ffs(CM_GCR_CONFIG_NUMIOCU); 189 - return num_iocu; 187 + return FIELD_GET(CM_GCR_CONFIG_NUMIOCU, 188 + mips_cps_cluster_config(cluster)); 190 189 } 191 190 192 191 /** ··· 225 230 226 231 mips_cm_unlock_other(); 227 232 228 - return (cfg + 1) & CM_GCR_Cx_CONFIG_PVPE; 233 + return FIELD_GET(CM_GCR_Cx_CONFIG_PVPE, cfg + 1); 229 234 } 230 235 231 236 #endif /* __MIPS_ASM_MIPS_CPS_H__ */
+2 -2
arch/mips/include/asm/octeon/cvmx-bootinfo.h
··· 318 318 319 319 /* Functions to return string based on type */ 320 320 #define ENUM_BRD_TYPE_CASE(x) \ 321 - case x: return(#x + 16); /* Skip CVMX_BOARD_TYPE_ */ 321 + case x: return (&#x[16]); /* Skip CVMX_BOARD_TYPE_ */ 322 322 static inline const char *cvmx_board_type_to_string(enum 323 323 cvmx_board_types_enum type) 324 324 { ··· 410 410 } 411 411 412 412 #define ENUM_CHIP_TYPE_CASE(x) \ 413 - case x: return(#x + 15); /* Skip CVMX_CHIP_TYPE */ 413 + case x: return (&#x[15]); /* Skip CVMX_CHIP_TYPE */ 414 414 static inline const char *cvmx_chip_type_to_string(enum 415 415 cvmx_chip_types_enum type) 416 416 {
+1 -1
arch/mips/include/asm/sibyte/sb1250_mc.h
··· 484 484 485 485 486 486 /* 487 - * Bank Address Address Bits Register (Table 6-22) 487 + * Bank Address Bits Register (Table 6-22) 488 488 */ 489 489 490 490 #define S_MC_BA_RESERVED 0
+3
arch/mips/include/asm/smp-ops.h
··· 101 101 #ifdef CONFIG_MIPS_MT_SMP 102 102 extern const struct plat_smp_ops vsmp_smp_ops; 103 103 104 + if (!cpu_has_mipsmt) 105 + return -ENODEV; 106 + 104 107 register_smp_ops(&vsmp_smp_ops); 105 108 106 109 return 0;
-6
arch/mips/include/asm/txx9/boards.h
··· 6 6 BOARD_VEC(rbtx4927_vec) 7 7 BOARD_VEC(rbtx4937_vec) 8 8 #endif 9 - #ifdef CONFIG_TOSHIBA_RBTX4938 10 - BOARD_VEC(rbtx4938_vec) 11 - #endif 12 - #ifdef CONFIG_TOSHIBA_RBTX4939 13 - BOARD_VEC(rbtx4939_vec) 14 - #endif
-145
arch/mips/include/asm/txx9/rbtx4938.h
··· 1 - /* 2 - * Definitions for TX4937/TX4938 3 - * 4 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 5 - * terms of the GNU General Public License version 2. This program is 6 - * licensed "as is" without any warranty of any kind, whether express 7 - * or implied. 8 - * 9 - * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) 10 - */ 11 - #ifndef __ASM_TXX9_RBTX4938_H 12 - #define __ASM_TXX9_RBTX4938_H 13 - 14 - #include <asm/addrspace.h> 15 - #include <asm/txx9irq.h> 16 - #include <asm/txx9/tx4938.h> 17 - 18 - /* Address map */ 19 - #define RBTX4938_FPGA_REG_ADDR (IO_BASE + TXX9_CE(2) + 0x00000000) 20 - #define RBTX4938_FPGA_REV_ADDR (IO_BASE + TXX9_CE(2) + 0x00000002) 21 - #define RBTX4938_CONFIG1_ADDR (IO_BASE + TXX9_CE(2) + 0x00000004) 22 - #define RBTX4938_CONFIG2_ADDR (IO_BASE + TXX9_CE(2) + 0x00000006) 23 - #define RBTX4938_CONFIG3_ADDR (IO_BASE + TXX9_CE(2) + 0x00000008) 24 - #define RBTX4938_LED_ADDR (IO_BASE + TXX9_CE(2) + 0x00001000) 25 - #define RBTX4938_DIPSW_ADDR (IO_BASE + TXX9_CE(2) + 0x00001002) 26 - #define RBTX4938_BDIPSW_ADDR (IO_BASE + TXX9_CE(2) + 0x00001004) 27 - #define RBTX4938_IMASK_ADDR (IO_BASE + TXX9_CE(2) + 0x00002000) 28 - #define RBTX4938_IMASK2_ADDR (IO_BASE + TXX9_CE(2) + 0x00002002) 29 - #define RBTX4938_INTPOL_ADDR (IO_BASE + TXX9_CE(2) + 0x00002004) 30 - #define RBTX4938_ISTAT_ADDR (IO_BASE + TXX9_CE(2) + 0x00002006) 31 - #define RBTX4938_ISTAT2_ADDR (IO_BASE + TXX9_CE(2) + 0x00002008) 32 - #define RBTX4938_IMSTAT_ADDR (IO_BASE + TXX9_CE(2) + 0x0000200a) 33 - #define RBTX4938_IMSTAT2_ADDR (IO_BASE + TXX9_CE(2) + 0x0000200c) 34 - #define RBTX4938_SOFTINT_ADDR (IO_BASE + TXX9_CE(2) + 0x00003000) 35 - #define RBTX4938_PIOSEL_ADDR (IO_BASE + TXX9_CE(2) + 0x00005000) 36 - #define RBTX4938_SPICS_ADDR (IO_BASE + TXX9_CE(2) + 0x00005002) 37 - #define RBTX4938_SFPWR_ADDR (IO_BASE + TXX9_CE(2) + 0x00005008) 38 - #define RBTX4938_SFVOL_ADDR (IO_BASE + TXX9_CE(2) + 0x0000500a) 39 - #define RBTX4938_SOFTRESET_ADDR (IO_BASE + TXX9_CE(2) + 0x00007000) 40 - #define RBTX4938_SOFTRESETLOCK_ADDR (IO_BASE + TXX9_CE(2) + 0x00007002) 41 - #define RBTX4938_PCIRESET_ADDR (IO_BASE + TXX9_CE(2) + 0x00007004) 42 - #define RBTX4938_ETHER_BASE (IO_BASE + TXX9_CE(2) + 0x00020000) 43 - 44 - /* Ethernet port address (Jumperless Mode (W12:Open)) */ 45 - #define RBTX4938_ETHER_ADDR (RBTX4938_ETHER_BASE + 0x280) 46 - 47 - /* bits for ISTAT/IMASK/IMSTAT */ 48 - #define RBTX4938_INTB_PCID 0 49 - #define RBTX4938_INTB_PCIC 1 50 - #define RBTX4938_INTB_PCIB 2 51 - #define RBTX4938_INTB_PCIA 3 52 - #define RBTX4938_INTB_RTC 4 53 - #define RBTX4938_INTB_ATA 5 54 - #define RBTX4938_INTB_MODEM 6 55 - #define RBTX4938_INTB_SWINT 7 56 - #define RBTX4938_INTF_PCID (1 << RBTX4938_INTB_PCID) 57 - #define RBTX4938_INTF_PCIC (1 << RBTX4938_INTB_PCIC) 58 - #define RBTX4938_INTF_PCIB (1 << RBTX4938_INTB_PCIB) 59 - #define RBTX4938_INTF_PCIA (1 << RBTX4938_INTB_PCIA) 60 - #define RBTX4938_INTF_RTC (1 << RBTX4938_INTB_RTC) 61 - #define RBTX4938_INTF_ATA (1 << RBTX4938_INTB_ATA) 62 - #define RBTX4938_INTF_MODEM (1 << RBTX4938_INTB_MODEM) 63 - #define RBTX4938_INTF_SWINT (1 << RBTX4938_INTB_SWINT) 64 - 65 - #define rbtx4938_fpga_rev_addr ((__u8 __iomem *)RBTX4938_FPGA_REV_ADDR) 66 - #define rbtx4938_led_addr ((__u8 __iomem *)RBTX4938_LED_ADDR) 67 - #define rbtx4938_dipsw_addr ((__u8 __iomem *)RBTX4938_DIPSW_ADDR) 68 - #define rbtx4938_bdipsw_addr ((__u8 __iomem *)RBTX4938_BDIPSW_ADDR) 69 - #define rbtx4938_imask_addr ((__u8 __iomem *)RBTX4938_IMASK_ADDR) 70 - #define rbtx4938_imask2_addr ((__u8 __iomem *)RBTX4938_IMASK2_ADDR) 71 - #define rbtx4938_intpol_addr ((__u8 __iomem *)RBTX4938_INTPOL_ADDR) 72 - #define rbtx4938_istat_addr ((__u8 __iomem *)RBTX4938_ISTAT_ADDR) 73 - #define rbtx4938_istat2_addr ((__u8 __iomem *)RBTX4938_ISTAT2_ADDR) 74 - #define rbtx4938_imstat_addr ((__u8 __iomem *)RBTX4938_IMSTAT_ADDR) 75 - #define rbtx4938_imstat2_addr ((__u8 __iomem *)RBTX4938_IMSTAT2_ADDR) 76 - #define rbtx4938_softint_addr ((__u8 __iomem *)RBTX4938_SOFTINT_ADDR) 77 - #define rbtx4938_piosel_addr ((__u8 __iomem *)RBTX4938_PIOSEL_ADDR) 78 - #define rbtx4938_spics_addr ((__u8 __iomem *)RBTX4938_SPICS_ADDR) 79 - #define rbtx4938_sfpwr_addr ((__u8 __iomem *)RBTX4938_SFPWR_ADDR) 80 - #define rbtx4938_sfvol_addr ((__u8 __iomem *)RBTX4938_SFVOL_ADDR) 81 - #define rbtx4938_softreset_addr ((__u8 __iomem *)RBTX4938_SOFTRESET_ADDR) 82 - #define rbtx4938_softresetlock_addr \ 83 - ((__u8 __iomem *)RBTX4938_SOFTRESETLOCK_ADDR) 84 - #define rbtx4938_pcireset_addr ((__u8 __iomem *)RBTX4938_PCIRESET_ADDR) 85 - 86 - /* 87 - * IRQ mappings 88 - */ 89 - 90 - #define RBTX4938_SOFT_INT0 0 /* not used */ 91 - #define RBTX4938_SOFT_INT1 1 /* not used */ 92 - #define RBTX4938_IRC_INT 2 93 - #define RBTX4938_TIMER_INT 7 94 - 95 - /* These are the virtual IRQ numbers, we divide all IRQ's into 96 - * 'spaces', the 'space' determines where and how to enable/disable 97 - * that particular IRQ on an RBTX4938 machine. Add new 'spaces' as new 98 - * IRQ hardware is supported. 99 - */ 100 - #define RBTX4938_NR_IRQ_IOC 8 101 - 102 - #define RBTX4938_IRQ_IRC TXX9_IRQ_BASE 103 - #define RBTX4938_IRQ_IOC (TXX9_IRQ_BASE + TX4938_NUM_IR) 104 - #define RBTX4938_IRQ_END (RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC) 105 - 106 - #define RBTX4938_IRQ_IRC_ECCERR (RBTX4938_IRQ_IRC + TX4938_IR_ECCERR) 107 - #define RBTX4938_IRQ_IRC_WTOERR (RBTX4938_IRQ_IRC + TX4938_IR_WTOERR) 108 - #define RBTX4938_IRQ_IRC_INT(n) (RBTX4938_IRQ_IRC + TX4938_IR_INT(n)) 109 - #define RBTX4938_IRQ_IRC_SIO(n) (RBTX4938_IRQ_IRC + TX4938_IR_SIO(n)) 110 - #define RBTX4938_IRQ_IRC_DMA(ch, n) (RBTX4938_IRQ_IRC + TX4938_IR_DMA(ch, n)) 111 - #define RBTX4938_IRQ_IRC_PIO (RBTX4938_IRQ_IRC + TX4938_IR_PIO) 112 - #define RBTX4938_IRQ_IRC_PDMAC (RBTX4938_IRQ_IRC + TX4938_IR_PDMAC) 113 - #define RBTX4938_IRQ_IRC_PCIC (RBTX4938_IRQ_IRC + TX4938_IR_PCIC) 114 - #define RBTX4938_IRQ_IRC_TMR(n) (RBTX4938_IRQ_IRC + TX4938_IR_TMR(n)) 115 - #define RBTX4938_IRQ_IRC_NDFMC (RBTX4938_IRQ_IRC + TX4938_IR_NDFMC) 116 - #define RBTX4938_IRQ_IRC_PCIERR (RBTX4938_IRQ_IRC + TX4938_IR_PCIERR) 117 - #define RBTX4938_IRQ_IRC_PCIPME (RBTX4938_IRQ_IRC + TX4938_IR_PCIPME) 118 - #define RBTX4938_IRQ_IRC_ACLC (RBTX4938_IRQ_IRC + TX4938_IR_ACLC) 119 - #define RBTX4938_IRQ_IRC_ACLCPME (RBTX4938_IRQ_IRC + TX4938_IR_ACLCPME) 120 - #define RBTX4938_IRQ_IRC_PCIC1 (RBTX4938_IRQ_IRC + TX4938_IR_PCIC1) 121 - #define RBTX4938_IRQ_IRC_SPI (RBTX4938_IRQ_IRC + TX4938_IR_SPI) 122 - #define RBTX4938_IRQ_IOC_PCID (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCID) 123 - #define RBTX4938_IRQ_IOC_PCIC (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIC) 124 - #define RBTX4938_IRQ_IOC_PCIB (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIB) 125 - #define RBTX4938_IRQ_IOC_PCIA (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIA) 126 - #define RBTX4938_IRQ_IOC_RTC (RBTX4938_IRQ_IOC + RBTX4938_INTB_RTC) 127 - #define RBTX4938_IRQ_IOC_ATA (RBTX4938_IRQ_IOC + RBTX4938_INTB_ATA) 128 - #define RBTX4938_IRQ_IOC_MODEM (RBTX4938_IRQ_IOC + RBTX4938_INTB_MODEM) 129 - #define RBTX4938_IRQ_IOC_SWINT (RBTX4938_IRQ_IOC + RBTX4938_INTB_SWINT) 130 - 131 - 132 - /* IOC (PCI, etc) */ 133 - #define RBTX4938_IRQ_IOCINT (TXX9_IRQ_BASE + TX4938_IR_INT(0)) 134 - /* Onboard 10M Ether */ 135 - #define RBTX4938_IRQ_ETHER (TXX9_IRQ_BASE + TX4938_IR_INT(1)) 136 - 137 - #define RBTX4938_RTL_8019_BASE (RBTX4938_ETHER_ADDR - mips_io_port_base) 138 - #define RBTX4938_RTL_8019_IRQ (RBTX4938_IRQ_ETHER) 139 - 140 - void rbtx4938_prom_init(void); 141 - void rbtx4938_irq_setup(void); 142 - struct pci_dev; 143 - int rbtx4938_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); 144 - 145 - #endif /* __ASM_TXX9_RBTX4938_H */
-142
arch/mips/include/asm/txx9/rbtx4939.h
··· 1 - /* 2 - * Definitions for RBTX4939 3 - * 4 - * (C) Copyright TOSHIBA CORPORATION 2005-2006 5 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 6 - * terms of the GNU General Public License version 2. This program is 7 - * licensed "as is" without any warranty of any kind, whether express 8 - * or implied. 9 - */ 10 - #ifndef __ASM_TXX9_RBTX4939_H 11 - #define __ASM_TXX9_RBTX4939_H 12 - 13 - #include <asm/addrspace.h> 14 - #include <asm/txx9irq.h> 15 - #include <asm/txx9/generic.h> 16 - #include <asm/txx9/tx4939.h> 17 - 18 - /* Address map */ 19 - #define RBTX4939_IOC_REG_ADDR (IO_BASE + TXX9_CE(1) + 0x00000000) 20 - #define RBTX4939_BOARD_REV_ADDR (IO_BASE + TXX9_CE(1) + 0x00000000) 21 - #define RBTX4939_IOC_REV_ADDR (IO_BASE + TXX9_CE(1) + 0x00000002) 22 - #define RBTX4939_CONFIG1_ADDR (IO_BASE + TXX9_CE(1) + 0x00000004) 23 - #define RBTX4939_CONFIG2_ADDR (IO_BASE + TXX9_CE(1) + 0x00000006) 24 - #define RBTX4939_CONFIG3_ADDR (IO_BASE + TXX9_CE(1) + 0x00000008) 25 - #define RBTX4939_CONFIG4_ADDR (IO_BASE + TXX9_CE(1) + 0x0000000a) 26 - #define RBTX4939_USTAT_ADDR (IO_BASE + TXX9_CE(1) + 0x00001000) 27 - #define RBTX4939_UDIPSW_ADDR (IO_BASE + TXX9_CE(1) + 0x00001002) 28 - #define RBTX4939_BDIPSW_ADDR (IO_BASE + TXX9_CE(1) + 0x00001004) 29 - #define RBTX4939_IEN_ADDR (IO_BASE + TXX9_CE(1) + 0x00002000) 30 - #define RBTX4939_IPOL_ADDR (IO_BASE + TXX9_CE(1) + 0x00002002) 31 - #define RBTX4939_IFAC1_ADDR (IO_BASE + TXX9_CE(1) + 0x00002004) 32 - #define RBTX4939_IFAC2_ADDR (IO_BASE + TXX9_CE(1) + 0x00002006) 33 - #define RBTX4939_SOFTINT_ADDR (IO_BASE + TXX9_CE(1) + 0x00003000) 34 - #define RBTX4939_ISASTAT_ADDR (IO_BASE + TXX9_CE(1) + 0x00004000) 35 - #define RBTX4939_PCISTAT_ADDR (IO_BASE + TXX9_CE(1) + 0x00004002) 36 - #define RBTX4939_ROME_ADDR (IO_BASE + TXX9_CE(1) + 0x00004004) 37 - #define RBTX4939_SPICS_ADDR (IO_BASE + TXX9_CE(1) + 0x00004006) 38 - #define RBTX4939_AUDI_ADDR (IO_BASE + TXX9_CE(1) + 0x00004008) 39 - #define RBTX4939_ISAGPIO_ADDR (IO_BASE + TXX9_CE(1) + 0x0000400a) 40 - #define RBTX4939_PE1_ADDR (IO_BASE + TXX9_CE(1) + 0x00005000) 41 - #define RBTX4939_PE2_ADDR (IO_BASE + TXX9_CE(1) + 0x00005002) 42 - #define RBTX4939_PE3_ADDR (IO_BASE + TXX9_CE(1) + 0x00005004) 43 - #define RBTX4939_VP_ADDR (IO_BASE + TXX9_CE(1) + 0x00005006) 44 - #define RBTX4939_VPRESET_ADDR (IO_BASE + TXX9_CE(1) + 0x00005008) 45 - #define RBTX4939_VPSOUT_ADDR (IO_BASE + TXX9_CE(1) + 0x0000500a) 46 - #define RBTX4939_VPSIN_ADDR (IO_BASE + TXX9_CE(1) + 0x0000500c) 47 - #define RBTX4939_7SEG_ADDR(s, ch) \ 48 - (IO_BASE + TXX9_CE(1) + 0x00006000 + (s) * 16 + ((ch) & 3) * 2) 49 - #define RBTX4939_SOFTRESET_ADDR (IO_BASE + TXX9_CE(1) + 0x00007000) 50 - #define RBTX4939_RESETEN_ADDR (IO_BASE + TXX9_CE(1) + 0x00007002) 51 - #define RBTX4939_RESETSTAT_ADDR (IO_BASE + TXX9_CE(1) + 0x00007004) 52 - #define RBTX4939_ETHER_BASE (IO_BASE + TXX9_CE(1) + 0x00020000) 53 - 54 - /* Ethernet port address */ 55 - #define RBTX4939_ETHER_ADDR (RBTX4939_ETHER_BASE + 0x300) 56 - 57 - /* bits for IEN/IPOL/IFAC */ 58 - #define RBTX4938_INTB_ISA0 0 59 - #define RBTX4938_INTB_ISA11 1 60 - #define RBTX4938_INTB_ISA12 2 61 - #define RBTX4938_INTB_ISA15 3 62 - #define RBTX4938_INTB_I2S 4 63 - #define RBTX4938_INTB_SW 5 64 - #define RBTX4938_INTF_ISA0 (1 << RBTX4938_INTB_ISA0) 65 - #define RBTX4938_INTF_ISA11 (1 << RBTX4938_INTB_ISA11) 66 - #define RBTX4938_INTF_ISA12 (1 << RBTX4938_INTB_ISA12) 67 - #define RBTX4938_INTF_ISA15 (1 << RBTX4938_INTB_ISA15) 68 - #define RBTX4938_INTF_I2S (1 << RBTX4938_INTB_I2S) 69 - #define RBTX4938_INTF_SW (1 << RBTX4938_INTB_SW) 70 - 71 - /* bits for PE1,PE2,PE3 */ 72 - #define RBTX4939_PE1_ATA(ch) (0x01 << (ch)) 73 - #define RBTX4939_PE1_RMII(ch) (0x04 << (ch)) 74 - #define RBTX4939_PE2_SIO0 0x01 75 - #define RBTX4939_PE2_SIO2 0x02 76 - #define RBTX4939_PE2_SIO3 0x04 77 - #define RBTX4939_PE2_CIR 0x08 78 - #define RBTX4939_PE2_SPI 0x10 79 - #define RBTX4939_PE2_GPIO 0x20 80 - #define RBTX4939_PE3_VP 0x01 81 - #define RBTX4939_PE3_VP_P 0x02 82 - #define RBTX4939_PE3_VP_S 0x04 83 - 84 - #define rbtx4939_board_rev_addr ((u8 __iomem *)RBTX4939_BOARD_REV_ADDR) 85 - #define rbtx4939_ioc_rev_addr ((u8 __iomem *)RBTX4939_IOC_REV_ADDR) 86 - #define rbtx4939_config1_addr ((u8 __iomem *)RBTX4939_CONFIG1_ADDR) 87 - #define rbtx4939_config2_addr ((u8 __iomem *)RBTX4939_CONFIG2_ADDR) 88 - #define rbtx4939_config3_addr ((u8 __iomem *)RBTX4939_CONFIG3_ADDR) 89 - #define rbtx4939_config4_addr ((u8 __iomem *)RBTX4939_CONFIG4_ADDR) 90 - #define rbtx4939_ustat_addr ((u8 __iomem *)RBTX4939_USTAT_ADDR) 91 - #define rbtx4939_udipsw_addr ((u8 __iomem *)RBTX4939_UDIPSW_ADDR) 92 - #define rbtx4939_bdipsw_addr ((u8 __iomem *)RBTX4939_BDIPSW_ADDR) 93 - #define rbtx4939_ien_addr ((u8 __iomem *)RBTX4939_IEN_ADDR) 94 - #define rbtx4939_ipol_addr ((u8 __iomem *)RBTX4939_IPOL_ADDR) 95 - #define rbtx4939_ifac1_addr ((u8 __iomem *)RBTX4939_IFAC1_ADDR) 96 - #define rbtx4939_ifac2_addr ((u8 __iomem *)RBTX4939_IFAC2_ADDR) 97 - #define rbtx4939_softint_addr ((u8 __iomem *)RBTX4939_SOFTINT_ADDR) 98 - #define rbtx4939_isastat_addr ((u8 __iomem *)RBTX4939_ISASTAT_ADDR) 99 - #define rbtx4939_pcistat_addr ((u8 __iomem *)RBTX4939_PCISTAT_ADDR) 100 - #define rbtx4939_rome_addr ((u8 __iomem *)RBTX4939_ROME_ADDR) 101 - #define rbtx4939_spics_addr ((u8 __iomem *)RBTX4939_SPICS_ADDR) 102 - #define rbtx4939_audi_addr ((u8 __iomem *)RBTX4939_AUDI_ADDR) 103 - #define rbtx4939_isagpio_addr ((u8 __iomem *)RBTX4939_ISAGPIO_ADDR) 104 - #define rbtx4939_pe1_addr ((u8 __iomem *)RBTX4939_PE1_ADDR) 105 - #define rbtx4939_pe2_addr ((u8 __iomem *)RBTX4939_PE2_ADDR) 106 - #define rbtx4939_pe3_addr ((u8 __iomem *)RBTX4939_PE3_ADDR) 107 - #define rbtx4939_vp_addr ((u8 __iomem *)RBTX4939_VP_ADDR) 108 - #define rbtx4939_vpreset_addr ((u8 __iomem *)RBTX4939_VPRESET_ADDR) 109 - #define rbtx4939_vpsout_addr ((u8 __iomem *)RBTX4939_VPSOUT_ADDR) 110 - #define rbtx4939_vpsin_addr ((u8 __iomem *)RBTX4939_VPSIN_ADDR) 111 - #define rbtx4939_7seg_addr(s, ch) \ 112 - ((u8 __iomem *)RBTX4939_7SEG_ADDR(s, ch)) 113 - #define rbtx4939_softreset_addr ((u8 __iomem *)RBTX4939_SOFTRESET_ADDR) 114 - #define rbtx4939_reseten_addr ((u8 __iomem *)RBTX4939_RESETEN_ADDR) 115 - #define rbtx4939_resetstat_addr ((u8 __iomem *)RBTX4939_RESETSTAT_ADDR) 116 - 117 - /* 118 - * IRQ mappings 119 - */ 120 - #define RBTX4939_NR_IRQ_IOC 8 121 - 122 - #define RBTX4939_IRQ_IOC (TXX9_IRQ_BASE + TX4939_NUM_IR) 123 - #define RBTX4939_IRQ_END (RBTX4939_IRQ_IOC + RBTX4939_NR_IRQ_IOC) 124 - 125 - /* IOC (ISA, etc) */ 126 - #define RBTX4939_IRQ_IOCINT (TXX9_IRQ_BASE + TX4939_IR_INT(0)) 127 - /* Onboard 10M Ether */ 128 - #define RBTX4939_IRQ_ETHER (TXX9_IRQ_BASE + TX4939_IR_INT(1)) 129 - 130 - void rbtx4939_prom_init(void); 131 - void rbtx4939_irq_setup(void); 132 - 133 - struct mtd_partition; 134 - struct map_info; 135 - struct rbtx4939_flash_data { 136 - unsigned int width; 137 - unsigned int nr_parts; 138 - struct mtd_partition *parts; 139 - void (*map_init)(struct map_info *map); 140 - }; 141 - 142 - #endif /* __ASM_TXX9_RBTX4939_H */
-34
arch/mips/include/asm/txx9/spi.h
··· 1 - /* 2 - * Definitions for TX4937/TX4938 SPI 3 - * 4 - * Copyright (C) 2000-2001 Toshiba Corporation 5 - * 6 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 7 - * terms of the GNU General Public License version 2. This program is 8 - * licensed "as is" without any warranty of any kind, whether express 9 - * or implied. 10 - * 11 - * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) 12 - */ 13 - #ifndef __ASM_TXX9_SPI_H 14 - #define __ASM_TXX9_SPI_H 15 - 16 - #include <linux/errno.h> 17 - 18 - #ifdef CONFIG_SPI 19 - int spi_eeprom_register(int busid, int chipid, int size); 20 - int spi_eeprom_read(int busid, int chipid, 21 - int address, unsigned char *buf, int len); 22 - #else 23 - static inline int spi_eeprom_register(int busid, int chipid, int size) 24 - { 25 - return -ENODEV; 26 - } 27 - static inline int spi_eeprom_read(int busid, int chipid, 28 - int address, unsigned char *buf, int len) 29 - { 30 - return -ENODEV; 31 - } 32 - #endif 33 - 34 - #endif /* __ASM_TXX9_SPI_H */
-524
arch/mips/include/asm/txx9/tx4939.h
··· 1 - /* 2 - * Definitions for TX4939 3 - * 4 - * Copyright (C) 2000-2001,2005-2006 Toshiba Corporation 5 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 6 - * terms of the GNU General Public License version 2. This program is 7 - * licensed "as is" without any warranty of any kind, whether express 8 - * or implied. 9 - */ 10 - #ifndef __ASM_TXX9_TX4939_H 11 - #define __ASM_TXX9_TX4939_H 12 - 13 - /* some controllers are compatible with 4927/4938 */ 14 - #include <asm/txx9/tx4938.h> 15 - 16 - #ifdef CONFIG_64BIT 17 - #define TX4939_REG_BASE 0xffffffffff1f0000UL /* == TX4938_REG_BASE */ 18 - #else 19 - #define TX4939_REG_BASE 0xff1f0000UL /* == TX4938_REG_BASE */ 20 - #endif 21 - #define TX4939_REG_SIZE 0x00010000 /* == TX4938_REG_SIZE */ 22 - 23 - #define TX4939_ATA_REG(ch) (TX4939_REG_BASE + 0x3000 + (ch) * 0x1000) 24 - #define TX4939_NDFMC_REG (TX4939_REG_BASE + 0x5000) 25 - #define TX4939_SRAMC_REG (TX4939_REG_BASE + 0x6000) 26 - #define TX4939_CRYPTO_REG (TX4939_REG_BASE + 0x6800) 27 - #define TX4939_PCIC1_REG (TX4939_REG_BASE + 0x7000) 28 - #define TX4939_DDRC_REG (TX4939_REG_BASE + 0x8000) 29 - #define TX4939_EBUSC_REG (TX4939_REG_BASE + 0x9000) 30 - #define TX4939_VPC_REG (TX4939_REG_BASE + 0xa000) 31 - #define TX4939_DMA_REG(ch) (TX4939_REG_BASE + 0xb000 + (ch) * 0x800) 32 - #define TX4939_PCIC_REG (TX4939_REG_BASE + 0xd000) 33 - #define TX4939_CCFG_REG (TX4939_REG_BASE + 0xe000) 34 - #define TX4939_IRC_REG (TX4939_REG_BASE + 0xe800) 35 - #define TX4939_NR_TMR 6 /* 0xf000,0xf100,0xf200,0xfd00,0xfe00,0xff00 */ 36 - #define TX4939_TMR_REG(ch) \ 37 - (TX4939_REG_BASE + 0xf000 + ((ch) + ((ch) >= 3) * 10) * 0x100) 38 - #define TX4939_NR_SIO 4 /* 0xf300, 0xf400, 0xf380, 0xf480 */ 39 - #define TX4939_SIO_REG(ch) \ 40 - (TX4939_REG_BASE + 0xf300 + (((ch) & 1) << 8) + (((ch) & 2) << 6)) 41 - #define TX4939_ACLC_REG (TX4939_REG_BASE + 0xf700) 42 - #define TX4939_SPI_REG (TX4939_REG_BASE + 0xf800) 43 - #define TX4939_I2C_REG (TX4939_REG_BASE + 0xf900) 44 - #define TX4939_I2S_REG (TX4939_REG_BASE + 0xfa00) 45 - #define TX4939_RTC_REG (TX4939_REG_BASE + 0xfb00) 46 - #define TX4939_CIR_REG (TX4939_REG_BASE + 0xfc00) 47 - 48 - #define TX4939_RNG_REG (TX4939_CRYPTO_REG + 0xb0) 49 - 50 - struct tx4939_le_reg { 51 - __u32 r; 52 - __u32 unused; 53 - }; 54 - 55 - struct tx4939_ddrc_reg { 56 - struct tx4939_le_reg ctl[47]; 57 - __u64 unused0[17]; 58 - __u64 winen; 59 - __u64 win[4]; 60 - }; 61 - 62 - struct tx4939_ccfg_reg { 63 - __u64 ccfg; 64 - __u64 crir; 65 - __u64 pcfg; 66 - __u64 toea; 67 - __u64 clkctr; 68 - __u64 unused0; 69 - __u64 garbc; 70 - __u64 unused1[2]; 71 - __u64 ramp; 72 - __u64 unused2[2]; 73 - __u64 dskwctrl; 74 - __u64 mclkosc; 75 - __u64 mclkctl; 76 - __u64 unused3[17]; 77 - struct { 78 - __u64 mr; 79 - __u64 dr; 80 - } gpio[2]; 81 - }; 82 - 83 - struct tx4939_irc_reg { 84 - struct tx4939_le_reg den; 85 - struct tx4939_le_reg scipb; 86 - struct tx4939_le_reg dm[2]; 87 - struct tx4939_le_reg lvl[16]; 88 - struct tx4939_le_reg msk; 89 - struct tx4939_le_reg edc; 90 - struct tx4939_le_reg pnd0; 91 - struct tx4939_le_reg cs; 92 - struct tx4939_le_reg pnd1; 93 - struct tx4939_le_reg dm2[2]; 94 - struct tx4939_le_reg dbr[2]; 95 - struct tx4939_le_reg dben; 96 - struct tx4939_le_reg unused0[2]; 97 - struct tx4939_le_reg flag[2]; 98 - struct tx4939_le_reg pol; 99 - struct tx4939_le_reg cnt; 100 - struct tx4939_le_reg maskint; 101 - struct tx4939_le_reg maskext; 102 - }; 103 - 104 - struct tx4939_crypto_reg { 105 - struct tx4939_le_reg csr; 106 - struct tx4939_le_reg idesptr; 107 - struct tx4939_le_reg cdesptr; 108 - struct tx4939_le_reg buserr; 109 - struct tx4939_le_reg cip_tout; 110 - struct tx4939_le_reg cir; 111 - union { 112 - struct { 113 - struct tx4939_le_reg data[8]; 114 - struct tx4939_le_reg ctrl; 115 - } gen; 116 - struct { 117 - struct { 118 - struct tx4939_le_reg l; 119 - struct tx4939_le_reg u; 120 - } key[3], ini; 121 - struct tx4939_le_reg ctrl; 122 - } des; 123 - struct { 124 - struct tx4939_le_reg key[4]; 125 - struct tx4939_le_reg ini[4]; 126 - struct tx4939_le_reg ctrl; 127 - } aes; 128 - struct { 129 - struct { 130 - struct tx4939_le_reg l; 131 - struct tx4939_le_reg u; 132 - } cnt; 133 - struct tx4939_le_reg ini[5]; 134 - struct tx4939_le_reg unused; 135 - struct tx4939_le_reg ctrl; 136 - } hash; 137 - } cdr; 138 - struct tx4939_le_reg unused0[7]; 139 - struct tx4939_le_reg rcsr; 140 - struct tx4939_le_reg rpr; 141 - __u64 rdr; 142 - __u64 ror[3]; 143 - struct tx4939_le_reg unused1[2]; 144 - struct tx4939_le_reg xorslr; 145 - struct tx4939_le_reg xorsur; 146 - }; 147 - 148 - struct tx4939_crypto_desc { 149 - __u32 src; 150 - __u32 dst; 151 - __u32 next; 152 - __u32 ctrl; 153 - __u32 index; 154 - __u32 xor; 155 - }; 156 - 157 - struct tx4939_vpc_reg { 158 - struct tx4939_le_reg csr; 159 - struct { 160 - struct tx4939_le_reg ctrlA; 161 - struct tx4939_le_reg ctrlB; 162 - struct tx4939_le_reg idesptr; 163 - struct tx4939_le_reg cdesptr; 164 - } port[3]; 165 - struct tx4939_le_reg buserr; 166 - }; 167 - 168 - struct tx4939_vpc_desc { 169 - __u32 src; 170 - __u32 next; 171 - __u32 ctrl1; 172 - __u32 ctrl2; 173 - }; 174 - 175 - /* 176 - * IRC 177 - */ 178 - #define TX4939_IR_NONE 0 179 - #define TX4939_IR_DDR 1 180 - #define TX4939_IR_WTOERR 2 181 - #define TX4939_NUM_IR_INT 3 182 - #define TX4939_IR_INT(n) (3 + (n)) 183 - #define TX4939_NUM_IR_ETH 2 184 - #define TX4939_IR_ETH(n) ((n) ? 43 : 6) 185 - #define TX4939_IR_VIDEO 7 186 - #define TX4939_IR_CIR 8 187 - #define TX4939_NUM_IR_SIO 4 188 - #define TX4939_IR_SIO(n) ((n) ? 43 + (n) : 9) /* 9,44-46 */ 189 - #define TX4939_NUM_IR_DMA 4 190 - #define TX4939_IR_DMA(ch, n) (((ch) ? 22 : 10) + (n)) /* 10-13,22-25 */ 191 - #define TX4939_IR_IRC 14 192 - #define TX4939_IR_PDMAC 15 193 - #define TX4939_NUM_IR_TMR 6 194 - #define TX4939_IR_TMR(n) (((n) >= 3 ? 45 : 16) + (n)) /* 16-18,48-50 */ 195 - #define TX4939_NUM_IR_ATA 2 196 - #define TX4939_IR_ATA(n) (19 + (n)) 197 - #define TX4939_IR_ACLC 21 198 - #define TX4939_IR_CIPHER 26 199 - #define TX4939_IR_INTA 27 200 - #define TX4939_IR_INTB 28 201 - #define TX4939_IR_INTC 29 202 - #define TX4939_IR_INTD 30 203 - #define TX4939_IR_I2C 33 204 - #define TX4939_IR_SPI 34 205 - #define TX4939_IR_PCIC 35 206 - #define TX4939_IR_PCIC1 36 207 - #define TX4939_IR_PCIERR 37 208 - #define TX4939_IR_PCIPME 38 209 - #define TX4939_IR_NDFMC 39 210 - #define TX4939_IR_ACLCPME 40 211 - #define TX4939_IR_RTC 41 212 - #define TX4939_IR_RND 42 213 - #define TX4939_IR_I2S 47 214 - #define TX4939_NUM_IR 64 215 - 216 - #define TX4939_IRC_INT 2 /* IP[2] in Status register */ 217 - 218 - /* 219 - * CCFG 220 - */ 221 - /* CCFG : Chip Configuration */ 222 - #define TX4939_CCFG_PCIBOOT 0x0000040000000000ULL 223 - #define TX4939_CCFG_WDRST 0x0000020000000000ULL 224 - #define TX4939_CCFG_WDREXEN 0x0000010000000000ULL 225 - #define TX4939_CCFG_BCFG_MASK 0x000000ff00000000ULL 226 - #define TX4939_CCFG_GTOT_MASK 0x06000000 227 - #define TX4939_CCFG_GTOT_4096 0x06000000 228 - #define TX4939_CCFG_GTOT_2048 0x04000000 229 - #define TX4939_CCFG_GTOT_1024 0x02000000 230 - #define TX4939_CCFG_GTOT_512 0x00000000 231 - #define TX4939_CCFG_TINTDIS 0x01000000 232 - #define TX4939_CCFG_PCI66 0x00800000 233 - #define TX4939_CCFG_PCIMODE 0x00400000 234 - #define TX4939_CCFG_SSCG 0x00100000 235 - #define TX4939_CCFG_MULCLK_MASK 0x000e0000 236 - #define TX4939_CCFG_MULCLK_8 (0x7 << 17) 237 - #define TX4939_CCFG_MULCLK_9 (0x0 << 17) 238 - #define TX4939_CCFG_MULCLK_10 (0x1 << 17) 239 - #define TX4939_CCFG_MULCLK_11 (0x2 << 17) 240 - #define TX4939_CCFG_MULCLK_12 (0x3 << 17) 241 - #define TX4939_CCFG_MULCLK_13 (0x4 << 17) 242 - #define TX4939_CCFG_MULCLK_14 (0x5 << 17) 243 - #define TX4939_CCFG_MULCLK_15 (0x6 << 17) 244 - #define TX4939_CCFG_BEOW 0x00010000 245 - #define TX4939_CCFG_WR 0x00008000 246 - #define TX4939_CCFG_TOE 0x00004000 247 - #define TX4939_CCFG_PCIARB 0x00002000 248 - #define TX4939_CCFG_YDIVMODE_MASK 0x00001c00 249 - #define TX4939_CCFG_YDIVMODE_2 (0x0 << 10) 250 - #define TX4939_CCFG_YDIVMODE_3 (0x1 << 10) 251 - #define TX4939_CCFG_YDIVMODE_5 (0x6 << 10) 252 - #define TX4939_CCFG_YDIVMODE_6 (0x7 << 10) 253 - #define TX4939_CCFG_PTSEL 0x00000200 254 - #define TX4939_CCFG_BESEL 0x00000100 255 - #define TX4939_CCFG_SYSSP_MASK 0x000000c0 256 - #define TX4939_CCFG_ACKSEL 0x00000020 257 - #define TX4939_CCFG_ROMW 0x00000010 258 - #define TX4939_CCFG_ENDIAN 0x00000004 259 - #define TX4939_CCFG_ARMODE 0x00000002 260 - #define TX4939_CCFG_ACEHOLD 0x00000001 261 - 262 - /* PCFG : Pin Configuration */ 263 - #define TX4939_PCFG_SIO2MODE_MASK 0xc000000000000000ULL 264 - #define TX4939_PCFG_SIO2MODE_GPIO 0x8000000000000000ULL 265 - #define TX4939_PCFG_SIO2MODE_SIO2 0x4000000000000000ULL 266 - #define TX4939_PCFG_SIO2MODE_SIO0 0x0000000000000000ULL 267 - #define TX4939_PCFG_SPIMODE 0x2000000000000000ULL 268 - #define TX4939_PCFG_I2CMODE 0x1000000000000000ULL 269 - #define TX4939_PCFG_I2SMODE_MASK 0x0c00000000000000ULL 270 - #define TX4939_PCFG_I2SMODE_GPIO 0x0c00000000000000ULL 271 - #define TX4939_PCFG_I2SMODE_I2S 0x0800000000000000ULL 272 - #define TX4939_PCFG_I2SMODE_I2S_ALT 0x0400000000000000ULL 273 - #define TX4939_PCFG_I2SMODE_ACLC 0x0000000000000000ULL 274 - #define TX4939_PCFG_SIO3MODE 0x0200000000000000ULL 275 - #define TX4939_PCFG_DMASEL3 0x0004000000000000ULL 276 - #define TX4939_PCFG_DMASEL3_SIO0 0x0004000000000000ULL 277 - #define TX4939_PCFG_DMASEL3_NDFC 0x0000000000000000ULL 278 - #define TX4939_PCFG_VSSMODE 0x0000200000000000ULL 279 - #define TX4939_PCFG_VPSMODE 0x0000100000000000ULL 280 - #define TX4939_PCFG_ET1MODE 0x0000080000000000ULL 281 - #define TX4939_PCFG_ET0MODE 0x0000040000000000ULL 282 - #define TX4939_PCFG_ATA1MODE 0x0000020000000000ULL 283 - #define TX4939_PCFG_ATA0MODE 0x0000010000000000ULL 284 - #define TX4939_PCFG_BP_PLL 0x0000000100000000ULL 285 - 286 - #define TX4939_PCFG_SYSCLKEN 0x08000000 287 - #define TX4939_PCFG_PCICLKEN_ALL 0x000f0000 288 - #define TX4939_PCFG_PCICLKEN(ch) (0x00010000<<(ch)) 289 - #define TX4939_PCFG_SPEED1 0x00002000 290 - #define TX4939_PCFG_SPEED0 0x00001000 291 - #define TX4939_PCFG_ITMODE 0x00000300 292 - #define TX4939_PCFG_DMASEL_ALL (0x00000007 | TX4939_PCFG_DMASEL3) 293 - #define TX4939_PCFG_DMASEL2 0x00000004 294 - #define TX4939_PCFG_DMASEL2_DRQ2 0x00000000 295 - #define TX4939_PCFG_DMASEL2_SIO0 0x00000004 296 - #define TX4939_PCFG_DMASEL1 0x00000002 297 - #define TX4939_PCFG_DMASEL1_DRQ1 0x00000000 298 - #define TX4939_PCFG_DMASEL0 0x00000001 299 - #define TX4939_PCFG_DMASEL0_DRQ0 0x00000000 300 - 301 - /* CLKCTR : Clock Control */ 302 - #define TX4939_CLKCTR_IOSCKD 0x8000000000000000ULL 303 - #define TX4939_CLKCTR_SYSCKD 0x4000000000000000ULL 304 - #define TX4939_CLKCTR_TM5CKD 0x2000000000000000ULL 305 - #define TX4939_CLKCTR_TM4CKD 0x1000000000000000ULL 306 - #define TX4939_CLKCTR_TM3CKD 0x0800000000000000ULL 307 - #define TX4939_CLKCTR_CIRCKD 0x0400000000000000ULL 308 - #define TX4939_CLKCTR_SIO3CKD 0x0200000000000000ULL 309 - #define TX4939_CLKCTR_SIO2CKD 0x0100000000000000ULL 310 - #define TX4939_CLKCTR_SIO1CKD 0x0080000000000000ULL 311 - #define TX4939_CLKCTR_VPCCKD 0x0040000000000000ULL 312 - #define TX4939_CLKCTR_EPCICKD 0x0020000000000000ULL 313 - #define TX4939_CLKCTR_ETH1CKD 0x0008000000000000ULL 314 - #define TX4939_CLKCTR_ATA1CKD 0x0004000000000000ULL 315 - #define TX4939_CLKCTR_BROMCKD 0x0002000000000000ULL 316 - #define TX4939_CLKCTR_NDCCKD 0x0001000000000000ULL 317 - #define TX4939_CLKCTR_I2CCKD 0x0000800000000000ULL 318 - #define TX4939_CLKCTR_ETH0CKD 0x0000400000000000ULL 319 - #define TX4939_CLKCTR_SPICKD 0x0000200000000000ULL 320 - #define TX4939_CLKCTR_SRAMCKD 0x0000100000000000ULL 321 - #define TX4939_CLKCTR_PCI1CKD 0x0000080000000000ULL 322 - #define TX4939_CLKCTR_DMA1CKD 0x0000040000000000ULL 323 - #define TX4939_CLKCTR_ACLCKD 0x0000020000000000ULL 324 - #define TX4939_CLKCTR_ATA0CKD 0x0000010000000000ULL 325 - #define TX4939_CLKCTR_DMA0CKD 0x0000008000000000ULL 326 - #define TX4939_CLKCTR_PCICCKD 0x0000004000000000ULL 327 - #define TX4939_CLKCTR_I2SCKD 0x0000002000000000ULL 328 - #define TX4939_CLKCTR_TM0CKD 0x0000001000000000ULL 329 - #define TX4939_CLKCTR_TM1CKD 0x0000000800000000ULL 330 - #define TX4939_CLKCTR_TM2CKD 0x0000000400000000ULL 331 - #define TX4939_CLKCTR_SIO0CKD 0x0000000200000000ULL 332 - #define TX4939_CLKCTR_CYPCKD 0x0000000100000000ULL 333 - #define TX4939_CLKCTR_IOSRST 0x80000000 334 - #define TX4939_CLKCTR_SYSRST 0x40000000 335 - #define TX4939_CLKCTR_TM5RST 0x20000000 336 - #define TX4939_CLKCTR_TM4RST 0x10000000 337 - #define TX4939_CLKCTR_TM3RST 0x08000000 338 - #define TX4939_CLKCTR_CIRRST 0x04000000 339 - #define TX4939_CLKCTR_SIO3RST 0x02000000 340 - #define TX4939_CLKCTR_SIO2RST 0x01000000 341 - #define TX4939_CLKCTR_SIO1RST 0x00800000 342 - #define TX4939_CLKCTR_VPCRST 0x00400000 343 - #define TX4939_CLKCTR_EPCIRST 0x00200000 344 - #define TX4939_CLKCTR_ETH1RST 0x00080000 345 - #define TX4939_CLKCTR_ATA1RST 0x00040000 346 - #define TX4939_CLKCTR_BROMRST 0x00020000 347 - #define TX4939_CLKCTR_NDCRST 0x00010000 348 - #define TX4939_CLKCTR_I2CRST 0x00008000 349 - #define TX4939_CLKCTR_ETH0RST 0x00004000 350 - #define TX4939_CLKCTR_SPIRST 0x00002000 351 - #define TX4939_CLKCTR_SRAMRST 0x00001000 352 - #define TX4939_CLKCTR_PCI1RST 0x00000800 353 - #define TX4939_CLKCTR_DMA1RST 0x00000400 354 - #define TX4939_CLKCTR_ACLRST 0x00000200 355 - #define TX4939_CLKCTR_ATA0RST 0x00000100 356 - #define TX4939_CLKCTR_DMA0RST 0x00000080 357 - #define TX4939_CLKCTR_PCICRST 0x00000040 358 - #define TX4939_CLKCTR_I2SRST 0x00000020 359 - #define TX4939_CLKCTR_TM0RST 0x00000010 360 - #define TX4939_CLKCTR_TM1RST 0x00000008 361 - #define TX4939_CLKCTR_TM2RST 0x00000004 362 - #define TX4939_CLKCTR_SIO0RST 0x00000002 363 - #define TX4939_CLKCTR_CYPRST 0x00000001 364 - 365 - /* 366 - * CRYPTO 367 - */ 368 - #define TX4939_CRYPTO_CSR_SAESO 0x08000000 369 - #define TX4939_CRYPTO_CSR_SAESI 0x04000000 370 - #define TX4939_CRYPTO_CSR_SDESO 0x02000000 371 - #define TX4939_CRYPTO_CSR_SDESI 0x01000000 372 - #define TX4939_CRYPTO_CSR_INDXBST_MASK 0x00700000 373 - #define TX4939_CRYPTO_CSR_INDXBST(n) ((n) << 20) 374 - #define TX4939_CRYPTO_CSR_TOINT 0x00080000 375 - #define TX4939_CRYPTO_CSR_DCINT 0x00040000 376 - #define TX4939_CRYPTO_CSR_GBINT 0x00010000 377 - #define TX4939_CRYPTO_CSR_INDXAST_MASK 0x0000e000 378 - #define TX4939_CRYPTO_CSR_INDXAST(n) ((n) << 13) 379 - #define TX4939_CRYPTO_CSR_CSWAP_MASK 0x00001800 380 - #define TX4939_CRYPTO_CSR_CSWAP_NONE 0x00000000 381 - #define TX4939_CRYPTO_CSR_CSWAP_IN 0x00000800 382 - #define TX4939_CRYPTO_CSR_CSWAP_OUT 0x00001000 383 - #define TX4939_CRYPTO_CSR_CSWAP_BOTH 0x00001800 384 - #define TX4939_CRYPTO_CSR_CDIV_MASK 0x00000600 385 - #define TX4939_CRYPTO_CSR_CDIV_DIV2 0x00000000 386 - #define TX4939_CRYPTO_CSR_CDIV_DIV1 0x00000200 387 - #define TX4939_CRYPTO_CSR_CDIV_DIV2ALT 0x00000400 388 - #define TX4939_CRYPTO_CSR_CDIV_DIV1ALT 0x00000600 389 - #define TX4939_CRYPTO_CSR_PDINT_MASK 0x000000c0 390 - #define TX4939_CRYPTO_CSR_PDINT_ALL 0x00000000 391 - #define TX4939_CRYPTO_CSR_PDINT_END 0x00000040 392 - #define TX4939_CRYPTO_CSR_PDINT_NEXT 0x00000080 393 - #define TX4939_CRYPTO_CSR_PDINT_NONE 0x000000c0 394 - #define TX4939_CRYPTO_CSR_GINTE 0x00000008 395 - #define TX4939_CRYPTO_CSR_RSTD 0x00000004 396 - #define TX4939_CRYPTO_CSR_RSTC 0x00000002 397 - #define TX4939_CRYPTO_CSR_ENCR 0x00000001 398 - 399 - /* bits for tx4939_crypto_reg.cdr.gen.ctrl */ 400 - #define TX4939_CRYPTO_CTX_ENGINE_MASK 0x00000003 401 - #define TX4939_CRYPTO_CTX_ENGINE_DES 0x00000000 402 - #define TX4939_CRYPTO_CTX_ENGINE_AES 0x00000001 403 - #define TX4939_CRYPTO_CTX_ENGINE_MD5 0x00000002 404 - #define TX4939_CRYPTO_CTX_ENGINE_SHA1 0x00000003 405 - #define TX4939_CRYPTO_CTX_TDMS 0x00000010 406 - #define TX4939_CRYPTO_CTX_CMS 0x00000020 407 - #define TX4939_CRYPTO_CTX_DMS 0x00000040 408 - #define TX4939_CRYPTO_CTX_UPDATE 0x00000080 409 - 410 - /* bits for tx4939_crypto_desc.ctrl */ 411 - #define TX4939_CRYPTO_DESC_OB_CNT_MASK 0xffe00000 412 - #define TX4939_CRYPTO_DESC_OB_CNT(cnt) ((cnt) << 21) 413 - #define TX4939_CRYPTO_DESC_IB_CNT_MASK 0x001ffc00 414 - #define TX4939_CRYPTO_DESC_IB_CNT(cnt) ((cnt) << 10) 415 - #define TX4939_CRYPTO_DESC_START 0x00000200 416 - #define TX4939_CRYPTO_DESC_END 0x00000100 417 - #define TX4939_CRYPTO_DESC_XOR 0x00000010 418 - #define TX4939_CRYPTO_DESC_LAST 0x00000008 419 - #define TX4939_CRYPTO_DESC_ERR_MASK 0x00000006 420 - #define TX4939_CRYPTO_DESC_ERR_NONE 0x00000000 421 - #define TX4939_CRYPTO_DESC_ERR_TOUT 0x00000002 422 - #define TX4939_CRYPTO_DESC_ERR_DIGEST 0x00000004 423 - #define TX4939_CRYPTO_DESC_OWN 0x00000001 424 - 425 - /* bits for tx4939_crypto_desc.index */ 426 - #define TX4939_CRYPTO_DESC_HASH_IDX_MASK 0x00000070 427 - #define TX4939_CRYPTO_DESC_HASH_IDX(idx) ((idx) << 4) 428 - #define TX4939_CRYPTO_DESC_ENCRYPT_IDX_MASK 0x00000007 429 - #define TX4939_CRYPTO_DESC_ENCRYPT_IDX(idx) ((idx) << 0) 430 - 431 - #define TX4939_CRYPTO_NR_SET 6 432 - 433 - #define TX4939_CRYPTO_RCSR_INTE 0x00000008 434 - #define TX4939_CRYPTO_RCSR_RST 0x00000004 435 - #define TX4939_CRYPTO_RCSR_FIN 0x00000002 436 - #define TX4939_CRYPTO_RCSR_ST 0x00000001 437 - 438 - /* 439 - * VPC 440 - */ 441 - #define TX4939_VPC_CSR_GBINT 0x00010000 442 - #define TX4939_VPC_CSR_SWAPO 0x00000020 443 - #define TX4939_VPC_CSR_SWAPI 0x00000010 444 - #define TX4939_VPC_CSR_GINTE 0x00000008 445 - #define TX4939_VPC_CSR_RSTD 0x00000004 446 - #define TX4939_VPC_CSR_RSTVPC 0x00000002 447 - 448 - #define TX4939_VPC_CTRLA_VDPSN 0x00000200 449 - #define TX4939_VPC_CTRLA_PBUSY 0x00000100 450 - #define TX4939_VPC_CTRLA_DCINT 0x00000080 451 - #define TX4939_VPC_CTRLA_UOINT 0x00000040 452 - #define TX4939_VPC_CTRLA_PDINT_MASK 0x00000030 453 - #define TX4939_VPC_CTRLA_PDINT_ALL 0x00000000 454 - #define TX4939_VPC_CTRLA_PDINT_NEXT 0x00000010 455 - #define TX4939_VPC_CTRLA_PDINT_NONE 0x00000030 456 - #define TX4939_VPC_CTRLA_VDVLDP 0x00000008 457 - #define TX4939_VPC_CTRLA_VDMODE 0x00000004 458 - #define TX4939_VPC_CTRLA_VDFOR 0x00000002 459 - #define TX4939_VPC_CTRLA_ENVPC 0x00000001 460 - 461 - /* bits for tx4939_vpc_desc.ctrl1 */ 462 - #define TX4939_VPC_DESC_CTRL1_ERR_MASK 0x00000006 463 - #define TX4939_VPC_DESC_CTRL1_OWN 0x00000001 464 - 465 - #define tx4939_ddrcptr ((struct tx4939_ddrc_reg __iomem *)TX4939_DDRC_REG) 466 - #define tx4939_ebuscptr tx4938_ebuscptr 467 - #define tx4939_ircptr \ 468 - ((struct tx4939_irc_reg __iomem *)TX4939_IRC_REG) 469 - #define tx4939_pcicptr tx4938_pcicptr 470 - #define tx4939_pcic1ptr tx4938_pcic1ptr 471 - #define tx4939_ccfgptr \ 472 - ((struct tx4939_ccfg_reg __iomem *)TX4939_CCFG_REG) 473 - #define tx4939_sramcptr tx4938_sramcptr 474 - #define tx4939_cryptoptr \ 475 - ((struct tx4939_crypto_reg __iomem *)TX4939_CRYPTO_REG) 476 - #define tx4939_vpcptr ((struct tx4939_vpc_reg __iomem *)TX4939_VPC_REG) 477 - 478 - #define TX4939_REV_MAJ_MIN() \ 479 - ((__u32)__raw_readq(&tx4939_ccfgptr->crir) & 0x00ff) 480 - #define TX4939_REV_PCODE() \ 481 - ((__u32)__raw_readq(&tx4939_ccfgptr->crir) >> 16) 482 - #define TX4939_CCFG_BCFG() \ 483 - ((__u32)((__raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_BCFG_MASK) \ 484 - >> 32)) 485 - 486 - #define tx4939_ccfg_clear(bits) tx4938_ccfg_clear(bits) 487 - #define tx4939_ccfg_set(bits) tx4938_ccfg_set(bits) 488 - #define tx4939_ccfg_change(change, new) tx4938_ccfg_change(change, new) 489 - 490 - #define TX4939_EBUSC_CR(ch) TX4927_EBUSC_CR(ch) 491 - #define TX4939_EBUSC_BA(ch) TX4927_EBUSC_BA(ch) 492 - #define TX4939_EBUSC_SIZE(ch) TX4927_EBUSC_SIZE(ch) 493 - #define TX4939_EBUSC_WIDTH(ch) \ 494 - (16 >> ((__u32)(TX4939_EBUSC_CR(ch) >> 20) & 0x1)) 495 - 496 - /* SCLK0 = MSTCLK * 429/19 * 16/245 / 2 (14.745MHz for MST 20MHz) */ 497 - #define TX4939_SCLK0(mst) \ 498 - ((((mst) + 245/2) / 245UL * 429 * 16 + 19) / 19 / 2) 499 - 500 - void tx4939_wdt_init(void); 501 - void tx4939_setup(void); 502 - void tx4939_time_init(unsigned int tmrnr); 503 - void tx4939_sio_init(unsigned int sclk, unsigned int cts_mask); 504 - void tx4939_spi_init(int busid); 505 - void tx4939_ethaddr_init(unsigned char *addr0, unsigned char *addr1); 506 - int tx4939_report_pciclk(void); 507 - void tx4939_report_pci1clk(void); 508 - struct pci_dev; 509 - int tx4939_pcic1_map_irq(const struct pci_dev *dev, u8 slot); 510 - int tx4939_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); 511 - void tx4939_setup_pcierr_irq(void); 512 - void tx4939_irq_init(void); 513 - int tx4939_irq(void); 514 - void tx4939_mtd_init(int ch); 515 - void tx4939_ata_init(void); 516 - void tx4939_rtc_init(void); 517 - void tx4939_ndfmc_init(unsigned int hold, unsigned int spw, 518 - unsigned char ch_mask, unsigned char wide_mask); 519 - void tx4939_dmac_init(int memcpy_chan0, int memcpy_chan1); 520 - void tx4939_aclc_init(void); 521 - void tx4939_sramc_init(void); 522 - void tx4939_rng_init(void); 523 - 524 - #endif /* __ASM_TXX9_TX4939_H */
+2 -1
arch/mips/kernel/mips-cpc.c
··· 4 4 * Author: Paul Burton <paul.burton@mips.com> 5 5 */ 6 6 7 + #include <linux/bitfield.h> 7 8 #include <linux/errno.h> 8 9 #include <linux/percpu.h> 9 10 #include <linux/of.h> ··· 98 97 curr_core = cpu_core(&current_cpu_data); 99 98 spin_lock_irqsave(&per_cpu(cpc_core_lock, curr_core), 100 99 per_cpu(cpc_core_lock_flags, curr_core)); 101 - write_cpc_cl_other(core << __ffs(CPC_Cx_OTHER_CORENUM)); 100 + write_cpc_cl_other(FIELD_PREP(CPC_Cx_OTHER_CORENUM, core)); 102 101 103 102 /* 104 103 * Ensure the core-other region reflects the appropriate core &
+18 -9
arch/mips/kernel/signal.c
··· 563 563 sp = regs->regs[29]; 564 564 565 565 /* 566 + * If we are on the alternate signal stack and would overflow it, don't. 567 + * Return an always-bogus address instead so we will die with SIGSEGV. 568 + */ 569 + if (on_sig_stack(sp) && !likely(on_sig_stack(sp - frame_size))) 570 + return (void __user __force *)(-1UL); 571 + 572 + /* 566 573 * FPU emulator may have it's own trampoline active just 567 574 * above the user stack, 16-bytes before the next lowest 568 575 * 16 byte boundary. Try to avoid trashing it. ··· 754 747 struct pt_regs *regs, sigset_t *set) 755 748 { 756 749 struct rt_sigframe __user *frame; 757 - int err = 0; 758 750 759 751 frame = get_sigframe(ksig, regs, sizeof(*frame)); 760 752 if (!access_ok(frame, sizeof (*frame))) 761 753 return -EFAULT; 762 754 763 755 /* Create siginfo. */ 764 - err |= copy_siginfo_to_user(&frame->rs_info, &ksig->info); 756 + if (copy_siginfo_to_user(&frame->rs_info, &ksig->info)) 757 + return -EFAULT; 765 758 766 759 /* Create the ucontext. */ 767 - err |= __put_user(0, &frame->rs_uc.uc_flags); 768 - err |= __put_user(NULL, &frame->rs_uc.uc_link); 769 - err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[29]); 770 - err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext); 771 - err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set)); 772 - 773 - if (err) 760 + if (__put_user(0, &frame->rs_uc.uc_flags)) 761 + return -EFAULT; 762 + if (__put_user(NULL, &frame->rs_uc.uc_link)) 763 + return -EFAULT; 764 + if (__save_altstack(&frame->rs_uc.uc_stack, regs->regs[29])) 765 + return -EFAULT; 766 + if (setup_sigcontext(regs, &frame->rs_uc.uc_mcontext)) 767 + return -EFAULT; 768 + if (__copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set))) 774 769 return -EFAULT; 775 770 776 771 /*
+6
arch/mips/lantiq/clk.c
··· 164 164 } 165 165 EXPORT_SYMBOL(clk_get_parent); 166 166 167 + int clk_set_parent(struct clk *clk, struct clk *parent) 168 + { 169 + return 0; 170 + } 171 + EXPORT_SYMBOL(clk_set_parent); 172 + 167 173 static inline u32 get_counter_resolution(void) 168 174 { 169 175 u32 res;
+1 -1
arch/mips/lantiq/falcon/sysctrl.c
··· 141 141 unsigned int freq; 142 142 unsigned int status; 143 143 144 - /* if if the clock is already enabled */ 144 + /* if the clock is already enabled */ 145 145 status = sysctl_r32(SYSCTL_SYS1, SYS1_INFRAC); 146 146 if (status & (1 << (GPPC_OFFSET + 1))) 147 147 return;
+4 -15
arch/mips/loongson2ef/Platform
··· 2 2 # Loongson Processors' Support 3 3 # 4 4 5 - # Only gcc >= 4.4 have Loongson specific support 6 5 cflags-$(CONFIG_CPU_LOONGSON2EF) += -Wa,--trap 7 - cflags-$(CONFIG_CPU_LOONGSON2E) += \ 8 - $(call cc-option,-march=loongson2e,-march=r4600) 9 - cflags-$(CONFIG_CPU_LOONGSON2F) += \ 10 - $(call cc-option,-march=loongson2f,-march=r4600) 6 + cflags-$(CONFIG_CPU_LOONGSON2E) += -march=loongson2e 7 + cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f 11 8 # 12 9 # Some versions of binutils, not currently mainline as of 2019/02/04, support 13 10 # an -mfix-loongson3-llsc flag which emits a sync prior to each ll instruction ··· 29 32 30 33 # Enable the workarounds for Loongson2f 31 34 ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS 32 - ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),) 33 - $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop) 34 - else 35 - cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-nop 36 - endif 37 - ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-jump,),) 38 - $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-jump) 39 - else 40 - cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-jump 41 - endif 35 + cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa,-mfix-loongson2f-nop 36 + cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa,-mfix-loongson2f-jump 42 37 endif 43 38 44 39 # Some -march= flags enable MMI instructions, and GCC complains about that
+2 -2
arch/mips/mm/c-octeon.c
··· 332 332 } 333 333 334 334 /* 335 - * Called when the the exception is recoverable 335 + * Called when the exception is recoverable 336 336 */ 337 337 338 338 asmlinkage void cache_parity_error_octeon_recoverable(void) ··· 341 341 } 342 342 343 343 /* 344 - * Called when the the exception is not recoverable 344 + * Called when the exception is not recoverable 345 345 */ 346 346 347 347 asmlinkage void cache_parity_error_octeon_non_recoverable(void)
-2
arch/mips/pci/Makefile
··· 49 49 obj-$(CONFIG_TOSHIBA_JMR3927) += fixup-jmr3927.o 50 50 obj-$(CONFIG_SOC_TX4927) += pci-tx4927.o 51 51 obj-$(CONFIG_SOC_TX4938) += pci-tx4938.o 52 - obj-$(CONFIG_SOC_TX4939) += pci-tx4939.o 53 52 obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o 54 - obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-rbtx4938.o 55 53 obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o 56 54 obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o 57 55 obj-$(CONFIG_MIKROTIK_RB532) += pci-rc32434.o ops-rc32434.o fixup-rc32434.o
-53
arch/mips/pci/fixup-rbtx4938.c
··· 1 - /* 2 - * Toshiba rbtx4938 pci routines 3 - * Copyright (C) 2000-2001 Toshiba Corporation 4 - * 5 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 6 - * terms of the GNU General Public License version 2. This program is 7 - * licensed "as is" without any warranty of any kind, whether express 8 - * or implied. 9 - * 10 - * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) 11 - */ 12 - #include <linux/types.h> 13 - #include <asm/txx9/pci.h> 14 - #include <asm/txx9/rbtx4938.h> 15 - 16 - int rbtx4938_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 17 - { 18 - int irq = tx4938_pcic1_map_irq(dev, slot); 19 - 20 - if (irq >= 0) 21 - return irq; 22 - irq = pin; 23 - /* IRQ rotation */ 24 - irq--; /* 0-3 */ 25 - if (slot == TX4927_PCIC_IDSEL_AD_TO_SLOT(23)) { 26 - /* PCI CardSlot (IDSEL=A23) */ 27 - /* PCIA => PCIA (IDSEL=A23) */ 28 - irq = (irq + 0 + slot) % 4; 29 - } else { 30 - /* PCI Backplane */ 31 - if (txx9_pci_option & TXX9_PCI_OPT_PICMG) 32 - irq = (irq + 33 - slot) % 4; 33 - else 34 - irq = (irq + 3 + slot) % 4; 35 - } 36 - irq++; /* 1-4 */ 37 - 38 - switch (irq) { 39 - case 1: 40 - irq = RBTX4938_IRQ_IOC_PCIA; 41 - break; 42 - case 2: 43 - irq = RBTX4938_IRQ_IOC_PCIB; 44 - break; 45 - case 3: 46 - irq = RBTX4938_IRQ_IOC_PCIC; 47 - break; 48 - case 4: 49 - irq = RBTX4938_IRQ_IOC_PCID; 50 - break; 51 - } 52 - return irq; 53 - }
+1 -3
arch/mips/pci/pci-rt3883.c
··· 102 102 unsigned func, unsigned reg) 103 103 { 104 104 u32 address; 105 - u32 ret; 106 105 107 106 address = rt3883_pci_get_cfgaddr(bus, slot, func, reg); 108 107 109 108 rt3883_pci_w32(rpc, address, RT3883_PCI_REG_CFGADDR); 110 - ret = rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA); 111 109 112 - return ret; 110 + return rt3883_pci_r32(rpc, RT3883_PCI_REG_CFGDATA); 113 111 } 114 112 115 113 static void rt3883_pci_write_cfg32(struct rt3883_pci_controller *rpc,
-107
arch/mips/pci/pci-tx4939.c
··· 1 - /* 2 - * Based on linux/arch/mips/txx9/rbtx4939/setup.c, 3 - * and RBTX49xx patch from CELF patch archive. 4 - * 5 - * Copyright 2001, 2003-2005 MontaVista Software Inc. 6 - * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) 7 - * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007 8 - * 9 - * This file is subject to the terms and conditions of the GNU General Public 10 - * License. See the file "COPYING" in the main directory of this archive 11 - * for more details. 12 - */ 13 - #include <linux/init.h> 14 - #include <linux/pci.h> 15 - #include <linux/kernel.h> 16 - #include <linux/interrupt.h> 17 - #include <asm/txx9/generic.h> 18 - #include <asm/txx9/tx4939.h> 19 - 20 - int __init tx4939_report_pciclk(void) 21 - { 22 - int pciclk = 0; 23 - 24 - pr_info("PCIC --%s PCICLK:", 25 - (__raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_PCI66) ? 26 - " PCI66" : ""); 27 - if (__raw_readq(&tx4939_ccfgptr->pcfg) & TX4939_PCFG_PCICLKEN_ALL) { 28 - pciclk = txx9_master_clock * 20 / 6; 29 - if (!(__raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_PCI66)) 30 - pciclk /= 2; 31 - pr_cont("Internal(%u.%uMHz)", 32 - (pciclk + 50000) / 1000000, 33 - ((pciclk + 50000) / 100000) % 10); 34 - } else { 35 - pr_cont("External"); 36 - pciclk = -1; 37 - } 38 - pr_cont("\n"); 39 - return pciclk; 40 - } 41 - 42 - void __init tx4939_report_pci1clk(void) 43 - { 44 - unsigned int pciclk = txx9_master_clock * 20 / 6; 45 - 46 - pr_info("PCIC1 -- PCICLK:%u.%uMHz\n", 47 - (pciclk + 50000) / 1000000, 48 - ((pciclk + 50000) / 100000) % 10); 49 - } 50 - 51 - int tx4939_pcic1_map_irq(const struct pci_dev *dev, u8 slot) 52 - { 53 - if (get_tx4927_pcicptr(dev->bus->sysdata) == tx4939_pcic1ptr) { 54 - switch (slot) { 55 - case TX4927_PCIC_IDSEL_AD_TO_SLOT(31): 56 - if (__raw_readq(&tx4939_ccfgptr->pcfg) & 57 - TX4939_PCFG_ET0MODE) 58 - return TXX9_IRQ_BASE + TX4939_IR_ETH(0); 59 - break; 60 - case TX4927_PCIC_IDSEL_AD_TO_SLOT(30): 61 - if (__raw_readq(&tx4939_ccfgptr->pcfg) & 62 - TX4939_PCFG_ET1MODE) 63 - return TXX9_IRQ_BASE + TX4939_IR_ETH(1); 64 - break; 65 - } 66 - return 0; 67 - } 68 - return -1; 69 - } 70 - 71 - int tx4939_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 72 - { 73 - int irq = tx4939_pcic1_map_irq(dev, slot); 74 - 75 - if (irq >= 0) 76 - return irq; 77 - irq = pin; 78 - /* IRQ rotation */ 79 - irq--; /* 0-3 */ 80 - irq = (irq + 33 - slot) % 4; 81 - irq++; /* 1-4 */ 82 - 83 - switch (irq) { 84 - case 1: 85 - irq = TXX9_IRQ_BASE + TX4939_IR_INTA; 86 - break; 87 - case 2: 88 - irq = TXX9_IRQ_BASE + TX4939_IR_INTB; 89 - break; 90 - case 3: 91 - irq = TXX9_IRQ_BASE + TX4939_IR_INTC; 92 - break; 93 - case 4: 94 - irq = TXX9_IRQ_BASE + TX4939_IR_INTD; 95 - break; 96 - } 97 - return irq; 98 - } 99 - 100 - void __init tx4939_setup_pcierr_irq(void) 101 - { 102 - if (request_irq(TXX9_IRQ_BASE + TX4939_IR_PCIERR, 103 - tx4927_pcierr_interrupt, 104 - 0, "PCI error", 105 - (void *)TX4939_PCIC_REG)) 106 - pr_warn("Failed to request irq for PCIERR\n"); 107 - }
+1
arch/mips/ralink/ill_acc.c
··· 65 65 } 66 66 67 67 irq = irq_of_parse_and_map(np, 0); 68 + of_node_put(np); 68 69 if (!irq) { 69 70 dev_err(&pdev->dev, "failed to get irq\n"); 70 71 put_device(&pdev->dev);
-5
arch/mips/sgi-ip22/Platform
··· 23 23 # be 16kb aligned or the handling of the current variable will break. 24 24 # Simplified: what IP22 does at 128MB+ in ksegN, IP28 does at 512MB+ in xkphys 25 25 # 26 - ifdef CONFIG_SGI_IP28 27 - ifeq ($(call cc-option-yn,-march=r10000 -mr10k-cache-barrier=store), n) 28 - $(error gcc doesn't support needed option -mr10k-cache-barrier=store) 29 - endif 30 - endif 31 26 cflags-$(CONFIG_SGI_IP28) += -mr10k-cache-barrier=store -I$(srctree)/arch/mips/include/asm/mach-ip28 32 27 load-$(CONFIG_SGI_IP28) += 0xa800000020004000
+1 -50
arch/mips/txx9/Kconfig
··· 6 6 7 7 config MACH_TX49XX 8 8 bool 9 + select BOOT_ELF32 9 10 select MACH_TXX9 10 11 select CEVT_R4K 11 12 select CSRC_R4K ··· 39 38 This Toshiba board is based on the TX4927 processor. Say Y here to 40 39 support this machine type 41 40 42 - config TOSHIBA_RBTX4938 43 - bool "Toshiba RBTX4938 board" 44 - depends on MACH_TX49XX 45 - select SOC_TX4938 46 - help 47 - This Toshiba board is based on the TX4938 processor. Say Y here to 48 - support this machine type 49 - 50 - config TOSHIBA_RBTX4939 51 - bool "Toshiba RBTX4939 board" 52 - depends on MACH_TX49XX 53 - select SOC_TX4939 54 - select TXX9_7SEGLED 55 - help 56 - This Toshiba board is based on the TX4939 processor. Say Y here to 57 - support this machine type 58 - 59 41 config SOC_TX3927 60 42 bool 61 43 select CEVT_TXX9 ··· 55 71 select IRQ_TXX9 56 72 select PCI_TX4927 57 73 select GPIO_TXX9 58 - imply HAS_TXX9_ACLC 59 74 60 75 config SOC_TX4938 61 76 bool ··· 64 81 select IRQ_TXX9 65 82 select PCI_TX4927 66 83 select GPIO_TXX9 67 - imply HAS_TXX9_ACLC 68 - 69 - config SOC_TX4939 70 - bool 71 - select CEVT_TXX9 72 - imply HAS_TXX9_SERIAL 73 - select HAVE_PCI 74 - select PCI_TX4927 75 - imply HAS_TXX9_ACLC 76 - 77 - config TXX9_7SEGLED 78 - bool 79 84 80 85 config TOSHIBA_FPCIB0 81 86 bool "FPCIB0 Backplane Support" ··· 74 103 bool "Support for PICMG PCI Backplane" 75 104 depends on PCI && MACH_TXX9 76 105 default y if !TOSHIBA_FPCIB0 77 - 78 - if TOSHIBA_RBTX4938 79 - 80 - comment "Multiplex Pin Select" 81 - choice 82 - prompt "PIO[58:61]" 83 - default TOSHIBA_RBTX4938_MPLEX_PIO58_61 84 - 85 - config TOSHIBA_RBTX4938_MPLEX_PIO58_61 86 - bool "PIO" 87 - config TOSHIBA_RBTX4938_MPLEX_NAND 88 - bool "NAND" 89 - config TOSHIBA_RBTX4938_MPLEX_ATA 90 - bool "ATA" 91 - config TOSHIBA_RBTX4938_MPLEX_KEEP 92 - bool "Keep firmware settings" 93 - 94 - endchoice 95 - 96 - endif 97 106 98 107 config PCI_TX4927 99 108 bool
-2
arch/mips/txx9/Makefile
··· 14 14 # Toshiba RBTX49XX boards 15 15 # 16 16 obj-$(CONFIG_TOSHIBA_RBTX4927) += rbtx4927/ 17 - obj-$(CONFIG_TOSHIBA_RBTX4938) += rbtx4938/ 18 - obj-$(CONFIG_TOSHIBA_RBTX4939) += rbtx4939/
-123
arch/mips/txx9/generic/7segled.c
··· 1 - /* 2 - * 7 Segment LED routines 3 - * Based on RBTX49xx patch from CELF patch archive. 4 - * 5 - * This file is subject to the terms and conditions of the GNU General Public 6 - * License. See the file "COPYING" in the main directory of this archive 7 - * for more details. 8 - * 9 - * (C) Copyright TOSHIBA CORPORATION 2005-2007 10 - * All Rights Reserved. 11 - */ 12 - #include <linux/device.h> 13 - #include <linux/slab.h> 14 - #include <linux/map_to_7segment.h> 15 - #include <asm/txx9/generic.h> 16 - 17 - static unsigned int tx_7segled_num; 18 - static void (*tx_7segled_putc)(unsigned int pos, unsigned char val); 19 - 20 - void __init txx9_7segled_init(unsigned int num, 21 - void (*putc)(unsigned int pos, unsigned char val)) 22 - { 23 - tx_7segled_num = num; 24 - tx_7segled_putc = putc; 25 - } 26 - 27 - static SEG7_CONVERSION_MAP(txx9_seg7map, MAP_ASCII7SEG_ALPHANUM_LC); 28 - 29 - int txx9_7segled_putc(unsigned int pos, char c) 30 - { 31 - if (pos >= tx_7segled_num) 32 - return -EINVAL; 33 - c = map_to_seg7(&txx9_seg7map, c); 34 - if (c < 0) 35 - return c; 36 - tx_7segled_putc(pos, c); 37 - return 0; 38 - } 39 - 40 - static ssize_t ascii_store(struct device *dev, 41 - struct device_attribute *attr, 42 - const char *buf, size_t size) 43 - { 44 - unsigned int ch = dev->id; 45 - txx9_7segled_putc(ch, buf[0]); 46 - return size; 47 - } 48 - 49 - static ssize_t raw_store(struct device *dev, 50 - struct device_attribute *attr, 51 - const char *buf, size_t size) 52 - { 53 - unsigned int ch = dev->id; 54 - tx_7segled_putc(ch, buf[0]); 55 - return size; 56 - } 57 - 58 - static DEVICE_ATTR_WO(ascii); 59 - static DEVICE_ATTR_WO(raw); 60 - 61 - static ssize_t map_seg7_show(struct device *dev, 62 - struct device_attribute *attr, 63 - char *buf) 64 - { 65 - memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map)); 66 - return sizeof(txx9_seg7map); 67 - } 68 - 69 - static ssize_t map_seg7_store(struct device *dev, 70 - struct device_attribute *attr, 71 - const char *buf, size_t size) 72 - { 73 - if (size != sizeof(txx9_seg7map)) 74 - return -EINVAL; 75 - memcpy(&txx9_seg7map, buf, size); 76 - return size; 77 - } 78 - 79 - static DEVICE_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store); 80 - 81 - static struct bus_type tx_7segled_subsys = { 82 - .name = "7segled", 83 - .dev_name = "7segled", 84 - }; 85 - 86 - static void tx_7segled_release(struct device *dev) 87 - { 88 - kfree(dev); 89 - } 90 - 91 - static int __init tx_7segled_init_sysfs(void) 92 - { 93 - int error, i; 94 - if (!tx_7segled_num) 95 - return -ENODEV; 96 - error = subsys_system_register(&tx_7segled_subsys, NULL); 97 - if (error) 98 - return error; 99 - error = device_create_file(tx_7segled_subsys.dev_root, &dev_attr_map_seg7); 100 - if (error) 101 - return error; 102 - for (i = 0; i < tx_7segled_num; i++) { 103 - struct device *dev; 104 - dev = kzalloc(sizeof(*dev), GFP_KERNEL); 105 - if (!dev) { 106 - error = -ENODEV; 107 - break; 108 - } 109 - dev->id = i; 110 - dev->bus = &tx_7segled_subsys; 111 - dev->release = &tx_7segled_release; 112 - error = device_register(dev); 113 - if (error) { 114 - put_device(dev); 115 - return error; 116 - } 117 - device_create_file(dev, &dev_attr_ascii); 118 - device_create_file(dev, &dev_attr_raw); 119 - } 120 - return error; 121 - } 122 - 123 - device_initcall(tx_7segled_init_sysfs);
-3
arch/mips/txx9/generic/Makefile
··· 8 8 obj-$(CONFIG_SOC_TX3927) += setup_tx3927.o irq_tx3927.o 9 9 obj-$(CONFIG_SOC_TX4927) += mem_tx4927.o setup_tx4927.o irq_tx4927.o 10 10 obj-$(CONFIG_SOC_TX4938) += mem_tx4927.o setup_tx4938.o irq_tx4938.o 11 - obj-$(CONFIG_SOC_TX4939) += setup_tx4939.o irq_tx4939.o 12 11 obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o 13 - obj-$(CONFIG_SPI) += spi_eeprom.o 14 - obj-$(CONFIG_TXX9_7SEGLED) += 7segled.o
-216
arch/mips/txx9/generic/irq_tx4939.c
··· 1 - /* 2 - * TX4939 irq routines 3 - * Based on linux/arch/mips/kernel/irq_txx9.c, 4 - * and RBTX49xx patch from CELF patch archive. 5 - * 6 - * Copyright 2001, 2003-2005 MontaVista Software Inc. 7 - * Author: MontaVista Software, Inc. 8 - * ahennessy@mvista.com 9 - * source@mvista.com 10 - * Copyright (C) 2000-2001,2005-2007 Toshiba Corporation 11 - * 12 - * This file is subject to the terms and conditions of the GNU General Public 13 - * License. See the file "COPYING" in the main directory of this archive 14 - * for more details. 15 - */ 16 - /* 17 - * TX4939 defines 64 IRQs. 18 - * Similer to irq_txx9.c but different register layouts. 19 - */ 20 - #include <linux/init.h> 21 - #include <linux/interrupt.h> 22 - #include <linux/irq.h> 23 - #include <linux/types.h> 24 - #include <asm/irq_cpu.h> 25 - #include <asm/txx9irq.h> 26 - #include <asm/txx9/tx4939.h> 27 - 28 - /* IRCER : Int. Control Enable */ 29 - #define TXx9_IRCER_ICE 0x00000001 30 - 31 - /* IRCR : Int. Control */ 32 - #define TXx9_IRCR_LOW 0x00000000 33 - #define TXx9_IRCR_HIGH 0x00000001 34 - #define TXx9_IRCR_DOWN 0x00000002 35 - #define TXx9_IRCR_UP 0x00000003 36 - #define TXx9_IRCR_EDGE(cr) ((cr) & 0x00000002) 37 - 38 - /* IRSCR : Int. Status Control */ 39 - #define TXx9_IRSCR_EIClrE 0x00000100 40 - #define TXx9_IRSCR_EIClr_MASK 0x0000000f 41 - 42 - /* IRCSR : Int. Current Status */ 43 - #define TXx9_IRCSR_IF 0x00010000 44 - 45 - #define irc_dlevel 0 46 - #define irc_elevel 1 47 - 48 - static struct { 49 - unsigned char level; 50 - unsigned char mode; 51 - } tx4939irq[TX4939_NUM_IR] __read_mostly; 52 - 53 - static void tx4939_irq_unmask(struct irq_data *d) 54 - { 55 - unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 56 - u32 __iomem *lvlp; 57 - int ofs; 58 - if (irq_nr < 32) { 59 - irq_nr--; 60 - lvlp = &tx4939_ircptr->lvl[(irq_nr % 16) / 2].r; 61 - } else { 62 - irq_nr -= 32; 63 - lvlp = &tx4939_ircptr->lvl[8 + (irq_nr % 16) / 2].r; 64 - } 65 - ofs = (irq_nr & 16) + (irq_nr & 1) * 8; 66 - __raw_writel((__raw_readl(lvlp) & ~(0xff << ofs)) 67 - | (tx4939irq[irq_nr].level << ofs), 68 - lvlp); 69 - } 70 - 71 - static inline void tx4939_irq_mask(struct irq_data *d) 72 - { 73 - unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 74 - u32 __iomem *lvlp; 75 - int ofs; 76 - if (irq_nr < 32) { 77 - irq_nr--; 78 - lvlp = &tx4939_ircptr->lvl[(irq_nr % 16) / 2].r; 79 - } else { 80 - irq_nr -= 32; 81 - lvlp = &tx4939_ircptr->lvl[8 + (irq_nr % 16) / 2].r; 82 - } 83 - ofs = (irq_nr & 16) + (irq_nr & 1) * 8; 84 - __raw_writel((__raw_readl(lvlp) & ~(0xff << ofs)) 85 - | (irc_dlevel << ofs), 86 - lvlp); 87 - mmiowb(); 88 - } 89 - 90 - static void tx4939_irq_mask_ack(struct irq_data *d) 91 - { 92 - unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 93 - 94 - tx4939_irq_mask(d); 95 - if (TXx9_IRCR_EDGE(tx4939irq[irq_nr].mode)) { 96 - irq_nr--; 97 - /* clear edge detection */ 98 - __raw_writel((TXx9_IRSCR_EIClrE | (irq_nr & 0xf)) 99 - << (irq_nr & 0x10), 100 - &tx4939_ircptr->edc.r); 101 - } 102 - } 103 - 104 - static int tx4939_irq_set_type(struct irq_data *d, unsigned int flow_type) 105 - { 106 - unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 107 - u32 cr; 108 - u32 __iomem *crp; 109 - int ofs; 110 - int mode; 111 - 112 - if (flow_type & IRQF_TRIGGER_PROBE) 113 - return 0; 114 - switch (flow_type & IRQF_TRIGGER_MASK) { 115 - case IRQF_TRIGGER_RISING: 116 - mode = TXx9_IRCR_UP; 117 - break; 118 - case IRQF_TRIGGER_FALLING: 119 - mode = TXx9_IRCR_DOWN; 120 - break; 121 - case IRQF_TRIGGER_HIGH: 122 - mode = TXx9_IRCR_HIGH; 123 - break; 124 - case IRQF_TRIGGER_LOW: 125 - mode = TXx9_IRCR_LOW; 126 - break; 127 - default: 128 - return -EINVAL; 129 - } 130 - if (irq_nr < 32) { 131 - irq_nr--; 132 - crp = &tx4939_ircptr->dm[(irq_nr & 8) >> 3].r; 133 - } else { 134 - irq_nr -= 32; 135 - crp = &tx4939_ircptr->dm2[((irq_nr & 8) >> 3)].r; 136 - } 137 - ofs = (((irq_nr & 16) >> 1) | (irq_nr & (8 - 1))) * 2; 138 - cr = __raw_readl(crp); 139 - cr &= ~(0x3 << ofs); 140 - cr |= (mode & 0x3) << ofs; 141 - __raw_writel(cr, crp); 142 - tx4939irq[irq_nr].mode = mode; 143 - return 0; 144 - } 145 - 146 - static struct irq_chip tx4939_irq_chip = { 147 - .name = "TX4939", 148 - .irq_ack = tx4939_irq_mask_ack, 149 - .irq_mask = tx4939_irq_mask, 150 - .irq_mask_ack = tx4939_irq_mask_ack, 151 - .irq_unmask = tx4939_irq_unmask, 152 - .irq_set_type = tx4939_irq_set_type, 153 - }; 154 - 155 - static int tx4939_irq_set_pri(int irc_irq, int new_pri) 156 - { 157 - int old_pri; 158 - 159 - if ((unsigned int)irc_irq >= TX4939_NUM_IR) 160 - return 0; 161 - old_pri = tx4939irq[irc_irq].level; 162 - tx4939irq[irc_irq].level = new_pri; 163 - return old_pri; 164 - } 165 - 166 - void __init tx4939_irq_init(void) 167 - { 168 - int i; 169 - 170 - mips_cpu_irq_init(); 171 - /* disable interrupt control */ 172 - __raw_writel(0, &tx4939_ircptr->den.r); 173 - __raw_writel(0, &tx4939_ircptr->maskint.r); 174 - __raw_writel(0, &tx4939_ircptr->maskext.r); 175 - /* irq_base + 0 is not used */ 176 - for (i = 1; i < TX4939_NUM_IR; i++) { 177 - tx4939irq[i].level = 4; /* middle level */ 178 - tx4939irq[i].mode = TXx9_IRCR_LOW; 179 - irq_set_chip_and_handler(TXX9_IRQ_BASE + i, &tx4939_irq_chip, 180 - handle_level_irq); 181 - } 182 - 183 - /* mask all IRC interrupts */ 184 - __raw_writel(0, &tx4939_ircptr->msk.r); 185 - for (i = 0; i < 16; i++) 186 - __raw_writel(0, &tx4939_ircptr->lvl[i].r); 187 - /* setup IRC interrupt mode (Low Active) */ 188 - for (i = 0; i < 2; i++) 189 - __raw_writel(0, &tx4939_ircptr->dm[i].r); 190 - for (i = 0; i < 2; i++) 191 - __raw_writel(0, &tx4939_ircptr->dm2[i].r); 192 - /* enable interrupt control */ 193 - __raw_writel(TXx9_IRCER_ICE, &tx4939_ircptr->den.r); 194 - __raw_writel(irc_elevel, &tx4939_ircptr->msk.r); 195 - 196 - irq_set_chained_handler(MIPS_CPU_IRQ_BASE + TX4939_IRC_INT, 197 - handle_simple_irq); 198 - 199 - /* raise priority for errors, timers, sio */ 200 - tx4939_irq_set_pri(TX4939_IR_WTOERR, 7); 201 - tx4939_irq_set_pri(TX4939_IR_PCIERR, 7); 202 - tx4939_irq_set_pri(TX4939_IR_PCIPME, 7); 203 - for (i = 0; i < TX4939_NUM_IR_TMR; i++) 204 - tx4939_irq_set_pri(TX4939_IR_TMR(i), 6); 205 - for (i = 0; i < TX4939_NUM_IR_SIO; i++) 206 - tx4939_irq_set_pri(TX4939_IR_SIO(i), 5); 207 - } 208 - 209 - int tx4939_irq(void) 210 - { 211 - u32 csr = __raw_readl(&tx4939_ircptr->cs.r); 212 - 213 - if (likely(!(csr & TXx9_IRCSR_IF))) 214 - return TXX9_IRQ_BASE + (csr & (TX4939_NUM_IR - 1)); 215 - return -1; 216 - }
-53
arch/mips/txx9/generic/setup.c
··· 315 315 txx9_board_vec = &rbtx4937_vec; 316 316 break; 317 317 #endif 318 - #ifdef CONFIG_TOSHIBA_RBTX4938 319 - case 0x4938: 320 - txx9_board_vec = &rbtx4938_vec; 321 - break; 322 - #endif 323 - #ifdef CONFIG_TOSHIBA_RBTX4939 324 - case 0x4939: 325 - txx9_board_vec = &rbtx4939_vec; 326 - break; 327 - #endif 328 318 } 329 319 #endif 330 320 } ··· 580 590 EXPORT_SYMBOL(__swizzle_addr_b); 581 591 #endif 582 592 583 - #ifdef NEEDS_TXX9_IOSWABW 584 - static u16 ioswabw_default(volatile u16 *a, u16 x) 585 - { 586 - return le16_to_cpu(x); 587 - } 588 - static u16 __mem_ioswabw_default(volatile u16 *a, u16 x) 589 - { 590 - return x; 591 - } 592 - u16 (*ioswabw)(volatile u16 *a, u16 x) = ioswabw_default; 593 - EXPORT_SYMBOL(ioswabw); 594 - u16 (*__mem_ioswabw)(volatile u16 *a, u16 x) = __mem_ioswabw_default; 595 - EXPORT_SYMBOL(__mem_ioswabw); 596 - #endif 597 - 598 593 void __init txx9_physmap_flash_init(int no, unsigned long addr, 599 594 unsigned long size, 600 595 const struct physmap_flash_data *pdata) ··· 815 840 unsigned int dma_chan_out, 816 841 unsigned int dma_chan_in) 817 842 { 818 - #if IS_ENABLED(CONFIG_SND_SOC_TXX9ACLC) 819 - unsigned int dma_base = dmac_id * TXX9_DMA_MAX_NR_CHANNELS; 820 - struct resource res[] = { 821 - { 822 - .start = baseaddr, 823 - .end = baseaddr + 0x100 - 1, 824 - .flags = IORESOURCE_MEM, 825 - }, { 826 - .start = irq, 827 - .flags = IORESOURCE_IRQ, 828 - }, { 829 - .name = "txx9dmac-chan", 830 - .start = dma_base + dma_chan_out, 831 - .flags = IORESOURCE_DMA, 832 - }, { 833 - .name = "txx9dmac-chan", 834 - .start = dma_base + dma_chan_in, 835 - .flags = IORESOURCE_DMA, 836 - } 837 - }; 838 - struct platform_device *pdev = 839 - platform_device_alloc("txx9aclc-ac97", -1); 840 - 841 - if (!pdev || 842 - platform_device_add_resources(pdev, res, ARRAY_SIZE(res)) || 843 - platform_device_add(pdev)) 844 - platform_device_put(pdev); 845 - #endif 846 843 } 847 844 848 845 static struct bus_type txx9_sramc_subsys = {
-568
arch/mips/txx9/generic/setup_tx4939.c
··· 1 - /* 2 - * TX4939 setup routines 3 - * Based on linux/arch/mips/txx9/generic/setup_tx4938.c, 4 - * and RBTX49xx patch from CELF patch archive. 5 - * 6 - * 2003-2005 (c) MontaVista Software, Inc. 7 - * (C) Copyright TOSHIBA CORPORATION 2000-2001, 2004-2007 8 - * 9 - * This file is subject to the terms and conditions of the GNU General Public 10 - * License. See the file "COPYING" in the main directory of this archive 11 - * for more details. 12 - */ 13 - #include <linux/init.h> 14 - #include <linux/ioport.h> 15 - #include <linux/delay.h> 16 - #include <linux/netdevice.h> 17 - #include <linux/notifier.h> 18 - #include <linux/device.h> 19 - #include <linux/ethtool.h> 20 - #include <linux/param.h> 21 - #include <linux/ptrace.h> 22 - #include <linux/mtd/physmap.h> 23 - #include <linux/platform_device.h> 24 - #include <linux/platform_data/txx9/ndfmc.h> 25 - #include <asm/reboot.h> 26 - #include <asm/traps.h> 27 - #include <asm/txx9irq.h> 28 - #include <asm/txx9tmr.h> 29 - #include <asm/txx9/generic.h> 30 - #include <asm/txx9/dmac.h> 31 - #include <asm/txx9/tx4939.h> 32 - 33 - static void __init tx4939_wdr_init(void) 34 - { 35 - /* report watchdog reset status */ 36 - if (____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_WDRST) 37 - pr_warn("Watchdog reset detected at 0x%lx\n", 38 - read_c0_errorepc()); 39 - /* clear WatchDogReset (W1C) */ 40 - tx4939_ccfg_set(TX4939_CCFG_WDRST); 41 - /* do reset on watchdog */ 42 - tx4939_ccfg_set(TX4939_CCFG_WR); 43 - } 44 - 45 - void __init tx4939_wdt_init(void) 46 - { 47 - txx9_wdt_init(TX4939_TMR_REG(2) & 0xfffffffffULL); 48 - } 49 - 50 - static void tx4939_machine_restart(char *command) 51 - { 52 - local_irq_disable(); 53 - pr_emerg("Rebooting (with %s watchdog reset)...\n", 54 - (____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_WDREXEN) ? 55 - "external" : "internal"); 56 - /* clear watchdog status */ 57 - tx4939_ccfg_set(TX4939_CCFG_WDRST); /* W1C */ 58 - txx9_wdt_now(TX4939_TMR_REG(2) & 0xfffffffffULL); 59 - while (!(____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_WDRST)) 60 - ; 61 - mdelay(10); 62 - if (____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_WDREXEN) { 63 - pr_emerg("Rebooting (with internal watchdog reset)...\n"); 64 - /* External WDRST failed. Do internal watchdog reset */ 65 - tx4939_ccfg_clear(TX4939_CCFG_WDREXEN); 66 - } 67 - /* fallback */ 68 - (*_machine_halt)(); 69 - } 70 - 71 - void show_registers(struct pt_regs *regs); 72 - static int tx4939_be_handler(struct pt_regs *regs, int is_fixup) 73 - { 74 - int data = regs->cp0_cause & 4; 75 - console_verbose(); 76 - pr_err("%cBE exception at %#lx\n", 77 - data ? 'D' : 'I', regs->cp0_epc); 78 - pr_err("ccfg:%llx, toea:%llx\n", 79 - (unsigned long long)____raw_readq(&tx4939_ccfgptr->ccfg), 80 - (unsigned long long)____raw_readq(&tx4939_ccfgptr->toea)); 81 - #ifdef CONFIG_PCI 82 - tx4927_report_pcic_status(); 83 - #endif 84 - show_registers(regs); 85 - panic("BusError!"); 86 - } 87 - static void __init tx4939_be_init(void) 88 - { 89 - mips_set_be_handler(tx4939_be_handler); 90 - } 91 - 92 - static struct resource tx4939_sdram_resource[4]; 93 - static struct resource tx4939_sram_resource; 94 - #define TX4939_SRAM_SIZE 0x800 95 - 96 - void __init tx4939_setup(void) 97 - { 98 - int i; 99 - __u32 divmode; 100 - __u64 pcfg; 101 - unsigned int cpuclk = 0; 102 - 103 - txx9_reg_res_init(TX4939_REV_PCODE(), TX4939_REG_BASE, 104 - TX4939_REG_SIZE); 105 - set_c0_config(TX49_CONF_CWFON); 106 - 107 - /* SDRAMC,EBUSC are configured by PROM */ 108 - for (i = 0; i < 4; i++) { 109 - if (!(TX4939_EBUSC_CR(i) & 0x8)) 110 - continue; /* disabled */ 111 - txx9_ce_res[i].start = (unsigned long)TX4939_EBUSC_BA(i); 112 - txx9_ce_res[i].end = 113 - txx9_ce_res[i].start + TX4939_EBUSC_SIZE(i) - 1; 114 - request_resource(&iomem_resource, &txx9_ce_res[i]); 115 - } 116 - 117 - /* clocks */ 118 - if (txx9_master_clock) { 119 - /* calculate cpu_clock from master_clock */ 120 - divmode = (__u32)____raw_readq(&tx4939_ccfgptr->ccfg) & 121 - TX4939_CCFG_MULCLK_MASK; 122 - cpuclk = txx9_master_clock * 20 / 2; 123 - switch (divmode) { 124 - case TX4939_CCFG_MULCLK_8: 125 - cpuclk = cpuclk / 3 * 4 /* / 6 * 8 */; break; 126 - case TX4939_CCFG_MULCLK_9: 127 - cpuclk = cpuclk / 2 * 3 /* / 6 * 9 */; break; 128 - case TX4939_CCFG_MULCLK_10: 129 - cpuclk = cpuclk / 3 * 5 /* / 6 * 10 */; break; 130 - case TX4939_CCFG_MULCLK_11: 131 - cpuclk = cpuclk / 6 * 11; break; 132 - case TX4939_CCFG_MULCLK_12: 133 - cpuclk = cpuclk * 2 /* / 6 * 12 */; break; 134 - case TX4939_CCFG_MULCLK_13: 135 - cpuclk = cpuclk / 6 * 13; break; 136 - case TX4939_CCFG_MULCLK_14: 137 - cpuclk = cpuclk / 3 * 7 /* / 6 * 14 */; break; 138 - case TX4939_CCFG_MULCLK_15: 139 - cpuclk = cpuclk / 2 * 5 /* / 6 * 15 */; break; 140 - } 141 - txx9_cpu_clock = cpuclk; 142 - } else { 143 - if (txx9_cpu_clock == 0) 144 - txx9_cpu_clock = 400000000; /* 400MHz */ 145 - /* calculate master_clock from cpu_clock */ 146 - cpuclk = txx9_cpu_clock; 147 - divmode = (__u32)____raw_readq(&tx4939_ccfgptr->ccfg) & 148 - TX4939_CCFG_MULCLK_MASK; 149 - switch (divmode) { 150 - case TX4939_CCFG_MULCLK_8: 151 - txx9_master_clock = cpuclk * 6 / 8; break; 152 - case TX4939_CCFG_MULCLK_9: 153 - txx9_master_clock = cpuclk * 6 / 9; break; 154 - case TX4939_CCFG_MULCLK_10: 155 - txx9_master_clock = cpuclk * 6 / 10; break; 156 - case TX4939_CCFG_MULCLK_11: 157 - txx9_master_clock = cpuclk * 6 / 11; break; 158 - case TX4939_CCFG_MULCLK_12: 159 - txx9_master_clock = cpuclk * 6 / 12; break; 160 - case TX4939_CCFG_MULCLK_13: 161 - txx9_master_clock = cpuclk * 6 / 13; break; 162 - case TX4939_CCFG_MULCLK_14: 163 - txx9_master_clock = cpuclk * 6 / 14; break; 164 - case TX4939_CCFG_MULCLK_15: 165 - txx9_master_clock = cpuclk * 6 / 15; break; 166 - } 167 - txx9_master_clock /= 10; /* * 2 / 20 */ 168 - } 169 - /* calculate gbus_clock from cpu_clock */ 170 - divmode = (__u32)____raw_readq(&tx4939_ccfgptr->ccfg) & 171 - TX4939_CCFG_YDIVMODE_MASK; 172 - txx9_gbus_clock = txx9_cpu_clock; 173 - switch (divmode) { 174 - case TX4939_CCFG_YDIVMODE_2: 175 - txx9_gbus_clock /= 2; break; 176 - case TX4939_CCFG_YDIVMODE_3: 177 - txx9_gbus_clock /= 3; break; 178 - case TX4939_CCFG_YDIVMODE_5: 179 - txx9_gbus_clock /= 5; break; 180 - case TX4939_CCFG_YDIVMODE_6: 181 - txx9_gbus_clock /= 6; break; 182 - } 183 - /* change default value to udelay/mdelay take reasonable time */ 184 - loops_per_jiffy = txx9_cpu_clock / HZ / 2; 185 - 186 - /* CCFG */ 187 - tx4939_wdr_init(); 188 - /* clear BusErrorOnWrite flag (W1C) */ 189 - tx4939_ccfg_set(TX4939_CCFG_WDRST | TX4939_CCFG_BEOW); 190 - /* enable Timeout BusError */ 191 - if (txx9_ccfg_toeon) 192 - tx4939_ccfg_set(TX4939_CCFG_TOE); 193 - 194 - /* DMA selection */ 195 - txx9_clear64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_DMASEL_ALL); 196 - 197 - /* Use external clock for external arbiter */ 198 - if (!(____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_PCIARB)) 199 - txx9_clear64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_PCICLKEN_ALL); 200 - 201 - pr_info("%s -- %dMHz(M%dMHz,G%dMHz) CRIR:%08x CCFG:%llx PCFG:%llx\n", 202 - txx9_pcode_str, 203 - (cpuclk + 500000) / 1000000, 204 - (txx9_master_clock + 500000) / 1000000, 205 - (txx9_gbus_clock + 500000) / 1000000, 206 - (__u32)____raw_readq(&tx4939_ccfgptr->crir), 207 - ____raw_readq(&tx4939_ccfgptr->ccfg), 208 - ____raw_readq(&tx4939_ccfgptr->pcfg)); 209 - 210 - pr_info("%s DDRC -- EN:%08x", txx9_pcode_str, 211 - (__u32)____raw_readq(&tx4939_ddrcptr->winen)); 212 - for (i = 0; i < 4; i++) { 213 - __u64 win = ____raw_readq(&tx4939_ddrcptr->win[i]); 214 - if (!((__u32)____raw_readq(&tx4939_ddrcptr->winen) & (1 << i))) 215 - continue; /* disabled */ 216 - pr_cont(" #%d:%016llx", i, win); 217 - tx4939_sdram_resource[i].name = "DDR SDRAM"; 218 - tx4939_sdram_resource[i].start = 219 - (unsigned long)(win >> 48) << 20; 220 - tx4939_sdram_resource[i].end = 221 - ((((unsigned long)(win >> 32) & 0xffff) + 1) << 222 - 20) - 1; 223 - tx4939_sdram_resource[i].flags = IORESOURCE_MEM; 224 - request_resource(&iomem_resource, &tx4939_sdram_resource[i]); 225 - } 226 - pr_cont("\n"); 227 - 228 - /* SRAM */ 229 - if (____raw_readq(&tx4939_sramcptr->cr) & 1) { 230 - unsigned int size = TX4939_SRAM_SIZE; 231 - tx4939_sram_resource.name = "SRAM"; 232 - tx4939_sram_resource.start = 233 - (____raw_readq(&tx4939_sramcptr->cr) >> (39-11)) 234 - & ~(size - 1); 235 - tx4939_sram_resource.end = 236 - tx4939_sram_resource.start + TX4939_SRAM_SIZE - 1; 237 - tx4939_sram_resource.flags = IORESOURCE_MEM; 238 - request_resource(&iomem_resource, &tx4939_sram_resource); 239 - } 240 - 241 - /* TMR */ 242 - /* disable all timers */ 243 - for (i = 0; i < TX4939_NR_TMR; i++) 244 - txx9_tmr_init(TX4939_TMR_REG(i) & 0xfffffffffULL); 245 - 246 - /* set PCIC1 reset (required to prevent hangup on BIST) */ 247 - txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_PCI1RST); 248 - pcfg = ____raw_readq(&tx4939_ccfgptr->pcfg); 249 - if (pcfg & (TX4939_PCFG_ET0MODE | TX4939_PCFG_ET1MODE)) { 250 - mdelay(1); /* at least 128 cpu clock */ 251 - /* clear PCIC1 reset */ 252 - txx9_clear64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_PCI1RST); 253 - } else { 254 - pr_info("%s: stop PCIC1\n", txx9_pcode_str); 255 - /* stop PCIC1 */ 256 - txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_PCI1CKD); 257 - } 258 - if (!(pcfg & TX4939_PCFG_ET0MODE)) { 259 - pr_info("%s: stop ETH0\n", txx9_pcode_str); 260 - txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_ETH0RST); 261 - txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_ETH0CKD); 262 - } 263 - if (!(pcfg & TX4939_PCFG_ET1MODE)) { 264 - pr_info("%s: stop ETH1\n", txx9_pcode_str); 265 - txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_ETH1RST); 266 - txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_ETH1CKD); 267 - } 268 - 269 - _machine_restart = tx4939_machine_restart; 270 - board_be_init = tx4939_be_init; 271 - } 272 - 273 - void __init tx4939_time_init(unsigned int tmrnr) 274 - { 275 - if (____raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_TINTDIS) 276 - txx9_clockevent_init(TX4939_TMR_REG(tmrnr) & 0xfffffffffULL, 277 - TXX9_IRQ_BASE + TX4939_IR_TMR(tmrnr), 278 - TXX9_IMCLK); 279 - } 280 - 281 - void __init tx4939_sio_init(unsigned int sclk, unsigned int cts_mask) 282 - { 283 - int i; 284 - unsigned int ch_mask = 0; 285 - __u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg); 286 - 287 - cts_mask |= ~1; /* only SIO0 have RTS/CTS */ 288 - if ((pcfg & TX4939_PCFG_SIO2MODE_MASK) != TX4939_PCFG_SIO2MODE_SIO0) 289 - cts_mask |= 1 << 0; /* disable SIO0 RTS/CTS by PCFG setting */ 290 - if ((pcfg & TX4939_PCFG_SIO2MODE_MASK) != TX4939_PCFG_SIO2MODE_SIO2) 291 - ch_mask |= 1 << 2; /* disable SIO2 by PCFG setting */ 292 - if (pcfg & TX4939_PCFG_SIO3MODE) 293 - ch_mask |= 1 << 3; /* disable SIO3 by PCFG setting */ 294 - for (i = 0; i < 4; i++) { 295 - if ((1 << i) & ch_mask) 296 - continue; 297 - txx9_sio_init(TX4939_SIO_REG(i) & 0xfffffffffULL, 298 - TXX9_IRQ_BASE + TX4939_IR_SIO(i), 299 - i, sclk, (1 << i) & cts_mask); 300 - } 301 - } 302 - 303 - #if IS_ENABLED(CONFIG_TC35815) 304 - static u32 tx4939_get_eth_speed(struct net_device *dev) 305 - { 306 - struct ethtool_link_ksettings cmd; 307 - 308 - if (__ethtool_get_link_ksettings(dev, &cmd)) 309 - return 100; /* default 100Mbps */ 310 - 311 - return cmd.base.speed; 312 - } 313 - 314 - static int tx4939_netdev_event(struct notifier_block *this, 315 - unsigned long event, 316 - void *ptr) 317 - { 318 - struct net_device *dev = netdev_notifier_info_to_dev(ptr); 319 - 320 - if (event == NETDEV_CHANGE && netif_carrier_ok(dev)) { 321 - __u64 bit = 0; 322 - if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(0)) 323 - bit = TX4939_PCFG_SPEED0; 324 - else if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(1)) 325 - bit = TX4939_PCFG_SPEED1; 326 - if (bit) { 327 - if (tx4939_get_eth_speed(dev) == 100) 328 - txx9_set64(&tx4939_ccfgptr->pcfg, bit); 329 - else 330 - txx9_clear64(&tx4939_ccfgptr->pcfg, bit); 331 - } 332 - } 333 - return NOTIFY_DONE; 334 - } 335 - 336 - static struct notifier_block tx4939_netdev_notifier = { 337 - .notifier_call = tx4939_netdev_event, 338 - .priority = 1, 339 - }; 340 - 341 - void __init tx4939_ethaddr_init(unsigned char *addr0, unsigned char *addr1) 342 - { 343 - u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg); 344 - 345 - if (addr0 && (pcfg & TX4939_PCFG_ET0MODE)) 346 - txx9_ethaddr_init(TXX9_IRQ_BASE + TX4939_IR_ETH(0), addr0); 347 - if (addr1 && (pcfg & TX4939_PCFG_ET1MODE)) 348 - txx9_ethaddr_init(TXX9_IRQ_BASE + TX4939_IR_ETH(1), addr1); 349 - register_netdevice_notifier(&tx4939_netdev_notifier); 350 - } 351 - #else 352 - void __init tx4939_ethaddr_init(unsigned char *addr0, unsigned char *addr1) 353 - { 354 - } 355 - #endif 356 - 357 - void __init tx4939_mtd_init(int ch) 358 - { 359 - struct physmap_flash_data pdata = { 360 - .width = TX4939_EBUSC_WIDTH(ch) / 8, 361 - }; 362 - unsigned long start = txx9_ce_res[ch].start; 363 - unsigned long size = txx9_ce_res[ch].end - start + 1; 364 - 365 - if (!(TX4939_EBUSC_CR(ch) & 0x8)) 366 - return; /* disabled */ 367 - txx9_physmap_flash_init(ch, start, size, &pdata); 368 - } 369 - 370 - #define TX4939_ATA_REG_PHYS(ch) (TX4939_ATA_REG(ch) & 0xfffffffffULL) 371 - void __init tx4939_ata_init(void) 372 - { 373 - static struct resource ata0_res[] = { 374 - { 375 - .start = TX4939_ATA_REG_PHYS(0), 376 - .end = TX4939_ATA_REG_PHYS(0) + 0x1000 - 1, 377 - .flags = IORESOURCE_MEM, 378 - }, { 379 - .start = TXX9_IRQ_BASE + TX4939_IR_ATA(0), 380 - .flags = IORESOURCE_IRQ, 381 - }, 382 - }; 383 - static struct resource ata1_res[] = { 384 - { 385 - .start = TX4939_ATA_REG_PHYS(1), 386 - .end = TX4939_ATA_REG_PHYS(1) + 0x1000 - 1, 387 - .flags = IORESOURCE_MEM, 388 - }, { 389 - .start = TXX9_IRQ_BASE + TX4939_IR_ATA(1), 390 - .flags = IORESOURCE_IRQ, 391 - }, 392 - }; 393 - static struct platform_device ata0_dev = { 394 - .name = "tx4939ide", 395 - .id = 0, 396 - .num_resources = ARRAY_SIZE(ata0_res), 397 - .resource = ata0_res, 398 - }; 399 - static struct platform_device ata1_dev = { 400 - .name = "tx4939ide", 401 - .id = 1, 402 - .num_resources = ARRAY_SIZE(ata1_res), 403 - .resource = ata1_res, 404 - }; 405 - __u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg); 406 - 407 - if (pcfg & TX4939_PCFG_ATA0MODE) 408 - platform_device_register(&ata0_dev); 409 - if ((pcfg & (TX4939_PCFG_ATA1MODE | 410 - TX4939_PCFG_ET1MODE | 411 - TX4939_PCFG_ET0MODE)) == TX4939_PCFG_ATA1MODE) 412 - platform_device_register(&ata1_dev); 413 - } 414 - 415 - void __init tx4939_rtc_init(void) 416 - { 417 - static struct resource res[] = { 418 - { 419 - .start = TX4939_RTC_REG & 0xfffffffffULL, 420 - .end = (TX4939_RTC_REG & 0xfffffffffULL) + 0x100 - 1, 421 - .flags = IORESOURCE_MEM, 422 - }, { 423 - .start = TXX9_IRQ_BASE + TX4939_IR_RTC, 424 - .flags = IORESOURCE_IRQ, 425 - }, 426 - }; 427 - static struct platform_device rtc_dev = { 428 - .name = "tx4939rtc", 429 - .id = -1, 430 - .num_resources = ARRAY_SIZE(res), 431 - .resource = res, 432 - }; 433 - 434 - platform_device_register(&rtc_dev); 435 - } 436 - 437 - void __init tx4939_ndfmc_init(unsigned int hold, unsigned int spw, 438 - unsigned char ch_mask, unsigned char wide_mask) 439 - { 440 - struct txx9ndfmc_platform_data plat_data = { 441 - .shift = 1, 442 - .gbus_clock = txx9_gbus_clock, 443 - .hold = hold, 444 - .spw = spw, 445 - .flags = NDFMC_PLAT_FLAG_NO_RSTR | NDFMC_PLAT_FLAG_HOLDADD | 446 - NDFMC_PLAT_FLAG_DUMMYWRITE, 447 - .ch_mask = ch_mask, 448 - .wide_mask = wide_mask, 449 - }; 450 - txx9_ndfmc_init(TX4939_NDFMC_REG & 0xfffffffffULL, &plat_data); 451 - } 452 - 453 - void __init tx4939_dmac_init(int memcpy_chan0, int memcpy_chan1) 454 - { 455 - struct txx9dmac_platform_data plat_data = { 456 - .have_64bit_regs = true, 457 - }; 458 - int i; 459 - 460 - for (i = 0; i < 2; i++) { 461 - plat_data.memcpy_chan = i ? memcpy_chan1 : memcpy_chan0; 462 - txx9_dmac_init(i, TX4939_DMA_REG(i) & 0xfffffffffULL, 463 - TXX9_IRQ_BASE + TX4939_IR_DMA(i, 0), 464 - &plat_data); 465 - } 466 - } 467 - 468 - void __init tx4939_aclc_init(void) 469 - { 470 - u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg); 471 - 472 - if ((pcfg & TX4939_PCFG_I2SMODE_MASK) == TX4939_PCFG_I2SMODE_ACLC) 473 - txx9_aclc_init(TX4939_ACLC_REG & 0xfffffffffULL, 474 - TXX9_IRQ_BASE + TX4939_IR_ACLC, 1, 0, 1); 475 - } 476 - 477 - void __init tx4939_sramc_init(void) 478 - { 479 - if (tx4939_sram_resource.start) 480 - txx9_sramc_init(&tx4939_sram_resource); 481 - } 482 - 483 - void __init tx4939_rng_init(void) 484 - { 485 - static struct resource res = { 486 - .start = TX4939_RNG_REG & 0xfffffffffULL, 487 - .end = (TX4939_RNG_REG & 0xfffffffffULL) + 0x30 - 1, 488 - .flags = IORESOURCE_MEM, 489 - }; 490 - static struct platform_device pdev = { 491 - .name = "tx4939-rng", 492 - .id = -1, 493 - .num_resources = 1, 494 - .resource = &res, 495 - }; 496 - 497 - platform_device_register(&pdev); 498 - } 499 - 500 - static void __init tx4939_stop_unused_modules(void) 501 - { 502 - __u64 pcfg, rst = 0, ckd = 0; 503 - char buf[128]; 504 - 505 - buf[0] = '\0'; 506 - local_irq_disable(); 507 - pcfg = ____raw_readq(&tx4939_ccfgptr->pcfg); 508 - if ((pcfg & TX4939_PCFG_I2SMODE_MASK) != 509 - TX4939_PCFG_I2SMODE_ACLC) { 510 - rst |= TX4939_CLKCTR_ACLRST; 511 - ckd |= TX4939_CLKCTR_ACLCKD; 512 - strcat(buf, " ACLC"); 513 - } 514 - if ((pcfg & TX4939_PCFG_I2SMODE_MASK) != 515 - TX4939_PCFG_I2SMODE_I2S && 516 - (pcfg & TX4939_PCFG_I2SMODE_MASK) != 517 - TX4939_PCFG_I2SMODE_I2S_ALT) { 518 - rst |= TX4939_CLKCTR_I2SRST; 519 - ckd |= TX4939_CLKCTR_I2SCKD; 520 - strcat(buf, " I2S"); 521 - } 522 - if (!(pcfg & TX4939_PCFG_ATA0MODE)) { 523 - rst |= TX4939_CLKCTR_ATA0RST; 524 - ckd |= TX4939_CLKCTR_ATA0CKD; 525 - strcat(buf, " ATA0"); 526 - } 527 - if (!(pcfg & TX4939_PCFG_ATA1MODE)) { 528 - rst |= TX4939_CLKCTR_ATA1RST; 529 - ckd |= TX4939_CLKCTR_ATA1CKD; 530 - strcat(buf, " ATA1"); 531 - } 532 - if (pcfg & TX4939_PCFG_SPIMODE) { 533 - rst |= TX4939_CLKCTR_SPIRST; 534 - ckd |= TX4939_CLKCTR_SPICKD; 535 - strcat(buf, " SPI"); 536 - } 537 - if (!(pcfg & (TX4939_PCFG_VSSMODE | TX4939_PCFG_VPSMODE))) { 538 - rst |= TX4939_CLKCTR_VPCRST; 539 - ckd |= TX4939_CLKCTR_VPCCKD; 540 - strcat(buf, " VPC"); 541 - } 542 - if ((pcfg & TX4939_PCFG_SIO2MODE_MASK) != TX4939_PCFG_SIO2MODE_SIO2) { 543 - rst |= TX4939_CLKCTR_SIO2RST; 544 - ckd |= TX4939_CLKCTR_SIO2CKD; 545 - strcat(buf, " SIO2"); 546 - } 547 - if (pcfg & TX4939_PCFG_SIO3MODE) { 548 - rst |= TX4939_CLKCTR_SIO3RST; 549 - ckd |= TX4939_CLKCTR_SIO3CKD; 550 - strcat(buf, " SIO3"); 551 - } 552 - if (rst | ckd) { 553 - txx9_set64(&tx4939_ccfgptr->clkctr, rst); 554 - txx9_set64(&tx4939_ccfgptr->clkctr, ckd); 555 - } 556 - local_irq_enable(); 557 - if (buf[0]) 558 - pr_info("%s: stop%s\n", txx9_pcode_str, buf); 559 - } 560 - 561 - static int __init tx4939_late_init(void) 562 - { 563 - if (txx9_pcode != 0x4939) 564 - return -ENODEV; 565 - tx4939_stop_unused_modules(); 566 - return 0; 567 - } 568 - late_initcall(tx4939_late_init);
-104
arch/mips/txx9/generic/spi_eeprom.c
··· 1 - /* 2 - * spi_eeprom.c 3 - * Copyright (C) 2000-2001 Toshiba Corporation 4 - * 5 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 6 - * terms of the GNU General Public License version 2. This program is 7 - * licensed "as is" without any warranty of any kind, whether express 8 - * or implied. 9 - * 10 - * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) 11 - */ 12 - #include <linux/init.h> 13 - #include <linux/slab.h> 14 - #include <linux/export.h> 15 - #include <linux/device.h> 16 - #include <linux/spi/spi.h> 17 - #include <linux/spi/eeprom.h> 18 - #include <asm/txx9/spi.h> 19 - 20 - #define AT250X0_PAGE_SIZE 8 21 - 22 - /* register board information for at25 driver */ 23 - int __init spi_eeprom_register(int busid, int chipid, int size) 24 - { 25 - struct spi_board_info info = { 26 - .modalias = "at25", 27 - .max_speed_hz = 1500000, /* 1.5Mbps */ 28 - .bus_num = busid, 29 - .chip_select = chipid, 30 - /* Mode 0: High-Active, Sample-Then-Shift */ 31 - }; 32 - struct spi_eeprom *eeprom; 33 - eeprom = kzalloc(sizeof(*eeprom), GFP_KERNEL); 34 - if (!eeprom) 35 - return -ENOMEM; 36 - strcpy(eeprom->name, "at250x0"); 37 - eeprom->byte_len = size; 38 - eeprom->page_size = AT250X0_PAGE_SIZE; 39 - eeprom->flags = EE_ADDR1; 40 - info.platform_data = eeprom; 41 - return spi_register_board_info(&info, 1); 42 - } 43 - 44 - /* simple temporary spi driver to provide early access to seeprom. */ 45 - 46 - static struct read_param { 47 - int busid; 48 - int chipid; 49 - int address; 50 - unsigned char *buf; 51 - int len; 52 - } *read_param; 53 - 54 - static int __init early_seeprom_probe(struct spi_device *spi) 55 - { 56 - int stat = 0; 57 - u8 cmd[2]; 58 - int len = read_param->len; 59 - char *buf = read_param->buf; 60 - int address = read_param->address; 61 - 62 - dev_info(&spi->dev, "spiclk %u KHz.\n", 63 - (spi->max_speed_hz + 500) / 1000); 64 - if (read_param->busid != spi->master->bus_num || 65 - read_param->chipid != spi->chip_select) 66 - return -ENODEV; 67 - while (len > 0) { 68 - /* spi_write_then_read can only work with small chunk */ 69 - int c = len < AT250X0_PAGE_SIZE ? len : AT250X0_PAGE_SIZE; 70 - cmd[0] = 0x03; /* AT25_READ */ 71 - cmd[1] = address; 72 - stat = spi_write_then_read(spi, cmd, sizeof(cmd), buf, c); 73 - buf += c; 74 - len -= c; 75 - address += c; 76 - } 77 - return stat; 78 - } 79 - 80 - static struct spi_driver early_seeprom_driver __initdata = { 81 - .driver = { 82 - .name = "at25", 83 - }, 84 - .probe = early_seeprom_probe, 85 - }; 86 - 87 - int __init spi_eeprom_read(int busid, int chipid, int address, 88 - unsigned char *buf, int len) 89 - { 90 - int ret; 91 - struct read_param param = { 92 - .busid = busid, 93 - .chipid = chipid, 94 - .address = address, 95 - .buf = buf, 96 - .len = len 97 - }; 98 - 99 - read_param = &param; 100 - ret = spi_register_driver(&early_seeprom_driver); 101 - if (!ret) 102 - spi_unregister_driver(&early_seeprom_driver); 103 - return ret; 104 - }
-2
arch/mips/txx9/rbtx4938/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - obj-y += prom.o setup.o irq.o
-157
arch/mips/txx9/rbtx4938/irq.c
··· 1 - /* 2 - * Toshiba RBTX4938 specific interrupt handlers 3 - * Copyright (C) 2000-2001 Toshiba Corporation 4 - * 5 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 6 - * terms of the GNU General Public License version 2. This program is 7 - * licensed "as is" without any warranty of any kind, whether express 8 - * or implied. 9 - * 10 - * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) 11 - */ 12 - 13 - /* 14 - * MIPS_CPU_IRQ_BASE+00 Software 0 15 - * MIPS_CPU_IRQ_BASE+01 Software 1 16 - * MIPS_CPU_IRQ_BASE+02 Cascade TX4938-CP0 17 - * MIPS_CPU_IRQ_BASE+03 Multiplexed -- do not use 18 - * MIPS_CPU_IRQ_BASE+04 Multiplexed -- do not use 19 - * MIPS_CPU_IRQ_BASE+05 Multiplexed -- do not use 20 - * MIPS_CPU_IRQ_BASE+06 Multiplexed -- do not use 21 - * MIPS_CPU_IRQ_BASE+07 CPU TIMER 22 - * 23 - * TXX9_IRQ_BASE+00 24 - * TXX9_IRQ_BASE+01 25 - * TXX9_IRQ_BASE+02 Cascade RBTX4938-IOC 26 - * TXX9_IRQ_BASE+03 RBTX4938 RTL-8019AS Ethernet 27 - * TXX9_IRQ_BASE+04 28 - * TXX9_IRQ_BASE+05 TX4938 ETH1 29 - * TXX9_IRQ_BASE+06 TX4938 ETH0 30 - * TXX9_IRQ_BASE+07 31 - * TXX9_IRQ_BASE+08 TX4938 SIO 0 32 - * TXX9_IRQ_BASE+09 TX4938 SIO 1 33 - * TXX9_IRQ_BASE+10 TX4938 DMA0 34 - * TXX9_IRQ_BASE+11 TX4938 DMA1 35 - * TXX9_IRQ_BASE+12 TX4938 DMA2 36 - * TXX9_IRQ_BASE+13 TX4938 DMA3 37 - * TXX9_IRQ_BASE+14 38 - * TXX9_IRQ_BASE+15 39 - * TXX9_IRQ_BASE+16 TX4938 PCIC 40 - * TXX9_IRQ_BASE+17 TX4938 TMR0 41 - * TXX9_IRQ_BASE+18 TX4938 TMR1 42 - * TXX9_IRQ_BASE+19 TX4938 TMR2 43 - * TXX9_IRQ_BASE+20 44 - * TXX9_IRQ_BASE+21 45 - * TXX9_IRQ_BASE+22 TX4938 PCIERR 46 - * TXX9_IRQ_BASE+23 47 - * TXX9_IRQ_BASE+24 48 - * TXX9_IRQ_BASE+25 49 - * TXX9_IRQ_BASE+26 50 - * TXX9_IRQ_BASE+27 51 - * TXX9_IRQ_BASE+28 52 - * TXX9_IRQ_BASE+29 53 - * TXX9_IRQ_BASE+30 54 - * TXX9_IRQ_BASE+31 TX4938 SPI 55 - * 56 - * RBTX4938_IRQ_IOC+00 PCI-D 57 - * RBTX4938_IRQ_IOC+01 PCI-C 58 - * RBTX4938_IRQ_IOC+02 PCI-B 59 - * RBTX4938_IRQ_IOC+03 PCI-A 60 - * RBTX4938_IRQ_IOC+04 RTC 61 - * RBTX4938_IRQ_IOC+05 ATA 62 - * RBTX4938_IRQ_IOC+06 MODEM 63 - * RBTX4938_IRQ_IOC+07 SWINT 64 - */ 65 - #include <linux/init.h> 66 - #include <linux/interrupt.h> 67 - #include <linux/irq.h> 68 - #include <asm/mipsregs.h> 69 - #include <asm/txx9/generic.h> 70 - #include <asm/txx9/rbtx4938.h> 71 - 72 - static int toshiba_rbtx4938_irq_nested(int sw_irq) 73 - { 74 - u8 level3; 75 - 76 - level3 = readb(rbtx4938_imstat_addr); 77 - if (unlikely(!level3)) 78 - return -1; 79 - /* must use fls so onboard ATA has priority */ 80 - return RBTX4938_IRQ_IOC + __fls8(level3); 81 - } 82 - 83 - static void toshiba_rbtx4938_irq_ioc_enable(struct irq_data *d) 84 - { 85 - unsigned char v; 86 - 87 - v = readb(rbtx4938_imask_addr); 88 - v |= (1 << (d->irq - RBTX4938_IRQ_IOC)); 89 - writeb(v, rbtx4938_imask_addr); 90 - mmiowb(); 91 - } 92 - 93 - static void toshiba_rbtx4938_irq_ioc_disable(struct irq_data *d) 94 - { 95 - unsigned char v; 96 - 97 - v = readb(rbtx4938_imask_addr); 98 - v &= ~(1 << (d->irq - RBTX4938_IRQ_IOC)); 99 - writeb(v, rbtx4938_imask_addr); 100 - mmiowb(); 101 - } 102 - 103 - #define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC" 104 - static struct irq_chip toshiba_rbtx4938_irq_ioc_type = { 105 - .name = TOSHIBA_RBTX4938_IOC_NAME, 106 - .irq_mask = toshiba_rbtx4938_irq_ioc_disable, 107 - .irq_unmask = toshiba_rbtx4938_irq_ioc_enable, 108 - }; 109 - 110 - static int rbtx4938_irq_dispatch(int pending) 111 - { 112 - int irq; 113 - 114 - if (pending & STATUSF_IP7) 115 - irq = MIPS_CPU_IRQ_BASE + 7; 116 - else if (pending & STATUSF_IP2) { 117 - irq = txx9_irq(); 118 - if (irq == RBTX4938_IRQ_IOCINT) 119 - irq = toshiba_rbtx4938_irq_nested(irq); 120 - } else if (pending & STATUSF_IP1) 121 - irq = MIPS_CPU_IRQ_BASE + 0; 122 - else if (pending & STATUSF_IP0) 123 - irq = MIPS_CPU_IRQ_BASE + 1; 124 - else 125 - irq = -1; 126 - return irq; 127 - } 128 - 129 - static void __init toshiba_rbtx4938_irq_ioc_init(void) 130 - { 131 - int i; 132 - 133 - for (i = RBTX4938_IRQ_IOC; 134 - i < RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC; i++) 135 - irq_set_chip_and_handler(i, &toshiba_rbtx4938_irq_ioc_type, 136 - handle_level_irq); 137 - 138 - irq_set_chained_handler(RBTX4938_IRQ_IOCINT, handle_simple_irq); 139 - } 140 - 141 - void __init rbtx4938_irq_setup(void) 142 - { 143 - txx9_irq_dispatch = rbtx4938_irq_dispatch; 144 - /* Now, interrupt control disabled, */ 145 - /* all IRC interrupts are masked, */ 146 - /* all IRC interrupt mode are Low Active. */ 147 - 148 - /* mask all IOC interrupts */ 149 - writeb(0, rbtx4938_imask_addr); 150 - 151 - /* clear SoftInt interrupts */ 152 - writeb(0, rbtx4938_softint_addr); 153 - tx4938_irq_init(); 154 - toshiba_rbtx4938_irq_ioc_init(); 155 - /* Onboard 10M Ether: High Active */ 156 - irq_set_irq_type(RBTX4938_IRQ_ETHER, IRQF_TRIGGER_HIGH); 157 - }
-22
arch/mips/txx9/rbtx4938/prom.c
··· 1 - /* 2 - * rbtx4938 specific prom routines 3 - * Copyright (C) 2000-2001 Toshiba Corporation 4 - * 5 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 6 - * terms of the GNU General Public License version 2. This program is 7 - * licensed "as is" without any warranty of any kind, whether express 8 - * or implied. 9 - * 10 - * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) 11 - */ 12 - 13 - #include <linux/init.h> 14 - #include <linux/memblock.h> 15 - #include <asm/txx9/generic.h> 16 - #include <asm/txx9/rbtx4938.h> 17 - 18 - void __init rbtx4938_prom_init(void) 19 - { 20 - memblock_add(0, tx4938_get_mem_size()); 21 - txx9_sio_putchar_init(TX4938_SIO_REG(0) & 0xfffffffffULL); 22 - }
-372
arch/mips/txx9/rbtx4938/setup.c
··· 1 - /* 2 - * Setup pointers to hardware-dependent routines. 3 - * Copyright (C) 2000-2001 Toshiba Corporation 4 - * 5 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 6 - * terms of the GNU General Public License version 2. This program is 7 - * licensed "as is" without any warranty of any kind, whether express 8 - * or implied. 9 - * 10 - * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) 11 - */ 12 - #include <linux/init.h> 13 - #include <linux/types.h> 14 - #include <linux/ioport.h> 15 - #include <linux/delay.h> 16 - #include <linux/platform_device.h> 17 - #include <linux/gpio/driver.h> 18 - #include <linux/gpio.h> 19 - #include <linux/mtd/physmap.h> 20 - 21 - #include <asm/reboot.h> 22 - #include <asm/io.h> 23 - #include <asm/txx9/generic.h> 24 - #include <asm/txx9/pci.h> 25 - #include <asm/txx9/rbtx4938.h> 26 - #include <linux/spi/spi.h> 27 - #include <asm/txx9/spi.h> 28 - #include <asm/txx9pio.h> 29 - 30 - static void rbtx4938_machine_restart(char *command) 31 - { 32 - local_irq_disable(); 33 - writeb(1, rbtx4938_softresetlock_addr); 34 - writeb(1, rbtx4938_sfvol_addr); 35 - writeb(1, rbtx4938_softreset_addr); 36 - /* fallback */ 37 - (*_machine_halt)(); 38 - } 39 - 40 - static void __init rbtx4938_pci_setup(void) 41 - { 42 - #ifdef CONFIG_PCI 43 - int extarb = !(__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCIARB); 44 - struct pci_controller *c = &txx9_primary_pcic; 45 - 46 - register_pci_controller(c); 47 - 48 - if (__raw_readq(&tx4938_ccfgptr->ccfg) & TX4938_CCFG_PCI66) 49 - txx9_pci_option = 50 - (txx9_pci_option & ~TXX9_PCI_OPT_CLK_MASK) | 51 - TXX9_PCI_OPT_CLK_66; /* already configured */ 52 - 53 - /* Reset PCI Bus */ 54 - writeb(0, rbtx4938_pcireset_addr); 55 - /* Reset PCIC */ 56 - txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); 57 - if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) == 58 - TXX9_PCI_OPT_CLK_66) 59 - tx4938_pciclk66_setup(); 60 - mdelay(10); 61 - /* clear PCIC reset */ 62 - txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); 63 - writeb(1, rbtx4938_pcireset_addr); 64 - iob(); 65 - 66 - tx4938_report_pciclk(); 67 - tx4927_pcic_setup(tx4938_pcicptr, c, extarb); 68 - if ((txx9_pci_option & TXX9_PCI_OPT_CLK_MASK) == 69 - TXX9_PCI_OPT_CLK_AUTO && 70 - txx9_pci66_check(c, 0, 0)) { 71 - /* Reset PCI Bus */ 72 - writeb(0, rbtx4938_pcireset_addr); 73 - /* Reset PCIC */ 74 - txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); 75 - tx4938_pciclk66_setup(); 76 - mdelay(10); 77 - /* clear PCIC reset */ 78 - txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIRST); 79 - writeb(1, rbtx4938_pcireset_addr); 80 - iob(); 81 - /* Reinitialize PCIC */ 82 - tx4938_report_pciclk(); 83 - tx4927_pcic_setup(tx4938_pcicptr, c, extarb); 84 - } 85 - 86 - if (__raw_readq(&tx4938_ccfgptr->pcfg) & 87 - (TX4938_PCFG_ETH0_SEL|TX4938_PCFG_ETH1_SEL)) { 88 - /* Reset PCIC1 */ 89 - txx9_set64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIC1RST); 90 - /* PCI1DMD==0 => PCI1CLK==GBUSCLK/2 => PCI66 */ 91 - if (!(__raw_readq(&tx4938_ccfgptr->ccfg) 92 - & TX4938_CCFG_PCI1DMD)) 93 - tx4938_ccfg_set(TX4938_CCFG_PCI1_66); 94 - mdelay(10); 95 - /* clear PCIC1 reset */ 96 - txx9_clear64(&tx4938_ccfgptr->clkctr, TX4938_CLKCTR_PCIC1RST); 97 - tx4938_report_pci1clk(); 98 - 99 - /* mem:64K(max), io:64K(max) (enough for ETH0,ETH1) */ 100 - c = txx9_alloc_pci_controller(NULL, 0, 0x10000, 0, 0x10000); 101 - register_pci_controller(c); 102 - tx4927_pcic_setup(tx4938_pcic1ptr, c, 0); 103 - } 104 - tx4938_setup_pcierr_irq(); 105 - #endif /* CONFIG_PCI */ 106 - } 107 - 108 - /* SPI support */ 109 - 110 - /* chip select for SPI devices */ 111 - #define SEEPROM1_CS 7 /* PIO7 */ 112 - #define SEEPROM2_CS 0 /* IOC */ 113 - #define SEEPROM3_CS 1 /* IOC */ 114 - #define SRTC_CS 2 /* IOC */ 115 - #define SPI_BUSNO 0 116 - 117 - static int __init rbtx4938_ethaddr_init(void) 118 - { 119 - #ifdef CONFIG_PCI 120 - unsigned char dat[17]; 121 - unsigned char sum; 122 - int i; 123 - 124 - /* 0-3: "MAC\0", 4-9:eth0, 10-15:eth1, 16:sum */ 125 - if (spi_eeprom_read(SPI_BUSNO, SEEPROM1_CS, 0, dat, sizeof(dat))) { 126 - pr_err("seeprom: read error.\n"); 127 - return -ENODEV; 128 - } else { 129 - if (strcmp(dat, "MAC") != 0) 130 - pr_warn("seeprom: bad signature.\n"); 131 - for (i = 0, sum = 0; i < sizeof(dat); i++) 132 - sum += dat[i]; 133 - if (sum) 134 - pr_warn("seeprom: bad checksum.\n"); 135 - } 136 - tx4938_ethaddr_init(&dat[4], &dat[4 + 6]); 137 - #endif /* CONFIG_PCI */ 138 - return 0; 139 - } 140 - 141 - static void __init rbtx4938_spi_setup(void) 142 - { 143 - /* set SPI_SEL */ 144 - txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_SPI_SEL); 145 - } 146 - 147 - static struct resource rbtx4938_fpga_resource; 148 - 149 - static void __init rbtx4938_time_init(void) 150 - { 151 - tx4938_time_init(0); 152 - } 153 - 154 - static void __init rbtx4938_mem_setup(void) 155 - { 156 - unsigned long long pcfg; 157 - 158 - if (txx9_master_clock == 0) 159 - txx9_master_clock = 25000000; /* 25MHz */ 160 - 161 - tx4938_setup(); 162 - 163 - #ifdef CONFIG_PCI 164 - txx9_alloc_pci_controller(&txx9_primary_pcic, 0, 0, 0, 0); 165 - txx9_board_pcibios_setup = tx4927_pcibios_setup; 166 - #else 167 - set_io_port_base(RBTX4938_ETHER_BASE); 168 - #endif 169 - 170 - tx4938_sio_init(7372800, 0); 171 - 172 - #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61 173 - pr_info("PIOSEL: disabling both ATA and NAND selection\n"); 174 - txx9_clear64(&tx4938_ccfgptr->pcfg, 175 - TX4938_PCFG_NDF_SEL | TX4938_PCFG_ATA_SEL); 176 - #endif 177 - 178 - #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND 179 - pr_info("PIOSEL: enabling NAND selection\n"); 180 - txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL); 181 - txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL); 182 - #endif 183 - 184 - #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA 185 - pr_info("PIOSEL: enabling ATA selection\n"); 186 - txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL); 187 - txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL); 188 - #endif 189 - 190 - #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_KEEP 191 - pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg); 192 - pr_info("PIOSEL: NAND %s, ATA %s\n", 193 - (pcfg & TX4938_PCFG_NDF_SEL) ? "enabled" : "disabled", 194 - (pcfg & TX4938_PCFG_ATA_SEL) ? "enabled" : "disabled"); 195 - #endif 196 - 197 - rbtx4938_spi_setup(); 198 - pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg); /* updated */ 199 - /* fixup piosel */ 200 - if ((pcfg & (TX4938_PCFG_ATA_SEL | TX4938_PCFG_NDF_SEL)) == 201 - TX4938_PCFG_ATA_SEL) 202 - writeb((readb(rbtx4938_piosel_addr) & 0x03) | 0x04, 203 - rbtx4938_piosel_addr); 204 - else if ((pcfg & (TX4938_PCFG_ATA_SEL | TX4938_PCFG_NDF_SEL)) == 205 - TX4938_PCFG_NDF_SEL) 206 - writeb((readb(rbtx4938_piosel_addr) & 0x03) | 0x08, 207 - rbtx4938_piosel_addr); 208 - else 209 - writeb(readb(rbtx4938_piosel_addr) & ~(0x08 | 0x04), 210 - rbtx4938_piosel_addr); 211 - 212 - rbtx4938_fpga_resource.name = "FPGA Registers"; 213 - rbtx4938_fpga_resource.start = CPHYSADDR(RBTX4938_FPGA_REG_ADDR); 214 - rbtx4938_fpga_resource.end = CPHYSADDR(RBTX4938_FPGA_REG_ADDR) + 0xffff; 215 - rbtx4938_fpga_resource.flags = IORESOURCE_MEM | IORESOURCE_BUSY; 216 - if (request_resource(&txx9_ce_res[2], &rbtx4938_fpga_resource)) 217 - pr_err("request resource for fpga failed\n"); 218 - 219 - _machine_restart = rbtx4938_machine_restart; 220 - 221 - writeb(0xff, rbtx4938_led_addr); 222 - pr_info("RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n", 223 - readb(rbtx4938_fpga_rev_addr), 224 - readb(rbtx4938_dipsw_addr), readb(rbtx4938_bdipsw_addr)); 225 - } 226 - 227 - static void __init rbtx4938_ne_init(void) 228 - { 229 - struct resource res[] = { 230 - { 231 - .start = RBTX4938_RTL_8019_BASE, 232 - .end = RBTX4938_RTL_8019_BASE + 0x20 - 1, 233 - .flags = IORESOURCE_IO, 234 - }, { 235 - .start = RBTX4938_RTL_8019_IRQ, 236 - .flags = IORESOURCE_IRQ, 237 - } 238 - }; 239 - platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res)); 240 - } 241 - 242 - static DEFINE_SPINLOCK(rbtx4938_spi_gpio_lock); 243 - 244 - static void rbtx4938_spi_gpio_set(struct gpio_chip *chip, unsigned int offset, 245 - int value) 246 - { 247 - u8 val; 248 - unsigned long flags; 249 - spin_lock_irqsave(&rbtx4938_spi_gpio_lock, flags); 250 - val = readb(rbtx4938_spics_addr); 251 - if (value) 252 - val |= 1 << offset; 253 - else 254 - val &= ~(1 << offset); 255 - writeb(val, rbtx4938_spics_addr); 256 - mmiowb(); 257 - spin_unlock_irqrestore(&rbtx4938_spi_gpio_lock, flags); 258 - } 259 - 260 - static int rbtx4938_spi_gpio_dir_out(struct gpio_chip *chip, 261 - unsigned int offset, int value) 262 - { 263 - rbtx4938_spi_gpio_set(chip, offset, value); 264 - return 0; 265 - } 266 - 267 - static struct gpio_chip rbtx4938_spi_gpio_chip = { 268 - .set = rbtx4938_spi_gpio_set, 269 - .direction_output = rbtx4938_spi_gpio_dir_out, 270 - .label = "RBTX4938-SPICS", 271 - .base = 16, 272 - .ngpio = 3, 273 - }; 274 - 275 - static int __init rbtx4938_spi_init(void) 276 - { 277 - struct spi_board_info srtc_info = { 278 - .modalias = "rtc-rs5c348", 279 - .max_speed_hz = 1000000, /* 1.0Mbps @ Vdd 2.0V */ 280 - .bus_num = 0, 281 - .chip_select = 16 + SRTC_CS, 282 - /* Mode 1 (High-Active, Shift-Then-Sample), High Avtive CS */ 283 - .mode = SPI_MODE_1 | SPI_CS_HIGH, 284 - }; 285 - spi_register_board_info(&srtc_info, 1); 286 - spi_eeprom_register(SPI_BUSNO, SEEPROM1_CS, 128); 287 - spi_eeprom_register(SPI_BUSNO, 16 + SEEPROM2_CS, 128); 288 - spi_eeprom_register(SPI_BUSNO, 16 + SEEPROM3_CS, 128); 289 - gpio_request(16 + SRTC_CS, "rtc-rs5c348"); 290 - gpio_direction_output(16 + SRTC_CS, 0); 291 - gpio_request(SEEPROM1_CS, "seeprom1"); 292 - gpio_direction_output(SEEPROM1_CS, 1); 293 - gpio_request(16 + SEEPROM2_CS, "seeprom2"); 294 - gpio_direction_output(16 + SEEPROM2_CS, 1); 295 - gpio_request(16 + SEEPROM3_CS, "seeprom3"); 296 - gpio_direction_output(16 + SEEPROM3_CS, 1); 297 - tx4938_spi_init(SPI_BUSNO); 298 - return 0; 299 - } 300 - 301 - static void __init rbtx4938_mtd_init(void) 302 - { 303 - struct physmap_flash_data pdata = { 304 - .width = 4, 305 - }; 306 - 307 - switch (readb(rbtx4938_bdipsw_addr) & 7) { 308 - case 0: 309 - /* Boot */ 310 - txx9_physmap_flash_init(0, 0x1fc00000, 0x400000, &pdata); 311 - /* System */ 312 - txx9_physmap_flash_init(1, 0x1e000000, 0x1000000, &pdata); 313 - break; 314 - case 1: 315 - /* System */ 316 - txx9_physmap_flash_init(0, 0x1f000000, 0x1000000, &pdata); 317 - /* Boot */ 318 - txx9_physmap_flash_init(1, 0x1ec00000, 0x400000, &pdata); 319 - break; 320 - case 2: 321 - /* Ext */ 322 - txx9_physmap_flash_init(0, 0x1f000000, 0x1000000, &pdata); 323 - /* System */ 324 - txx9_physmap_flash_init(1, 0x1e000000, 0x1000000, &pdata); 325 - /* Boot */ 326 - txx9_physmap_flash_init(2, 0x1dc00000, 0x400000, &pdata); 327 - break; 328 - case 3: 329 - /* Boot */ 330 - txx9_physmap_flash_init(1, 0x1bc00000, 0x400000, &pdata); 331 - /* System */ 332 - txx9_physmap_flash_init(2, 0x1a000000, 0x1000000, &pdata); 333 - break; 334 - } 335 - } 336 - 337 - static void __init rbtx4938_arch_init(void) 338 - { 339 - txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO); 340 - gpiochip_add_data(&rbtx4938_spi_gpio_chip, NULL); 341 - rbtx4938_pci_setup(); 342 - rbtx4938_spi_init(); 343 - } 344 - 345 - static void __init rbtx4938_device_init(void) 346 - { 347 - rbtx4938_ethaddr_init(); 348 - rbtx4938_ne_init(); 349 - tx4938_wdt_init(); 350 - rbtx4938_mtd_init(); 351 - /* TC58DVM82A1FT: tDH=10ns, tWP=tRP=tREADID=35ns */ 352 - tx4938_ndfmc_init(10, 35); 353 - tx4938_ata_init(RBTX4938_IRQ_IOC_ATA, 0, 1); 354 - tx4938_dmac_init(0, 2); 355 - tx4938_aclc_init(); 356 - platform_device_register_simple("txx9aclc-generic", -1, NULL, 0); 357 - tx4938_sramc_init(); 358 - txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL); 359 - } 360 - 361 - struct txx9_board_vec rbtx4938_vec __initdata = { 362 - .system = "Toshiba RBTX4938", 363 - .prom_init = rbtx4938_prom_init, 364 - .mem_setup = rbtx4938_mem_setup, 365 - .irq_setup = rbtx4938_irq_setup, 366 - .time_init = rbtx4938_time_init, 367 - .device_init = rbtx4938_device_init, 368 - .arch_init = rbtx4938_arch_init, 369 - #ifdef CONFIG_PCI 370 - .pci_map_irq = rbtx4938_pci_map_irq, 371 - #endif 372 - };
-2
arch/mips/txx9/rbtx4939/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - obj-y += irq.o setup.o prom.o
-95
arch/mips/txx9/rbtx4939/irq.c
··· 1 - /* 2 - * Toshiba RBTX4939 interrupt routines 3 - * Based on linux/arch/mips/txx9/rbtx4938/irq.c, 4 - * and RBTX49xx patch from CELF patch archive. 5 - * 6 - * Copyright (C) 2000-2001,2005-2006 Toshiba Corporation 7 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 8 - * terms of the GNU General Public License version 2. This program is 9 - * licensed "as is" without any warranty of any kind, whether express 10 - * or implied. 11 - */ 12 - #include <linux/init.h> 13 - #include <linux/interrupt.h> 14 - #include <linux/irq.h> 15 - #include <asm/mipsregs.h> 16 - #include <asm/txx9/rbtx4939.h> 17 - 18 - /* 19 - * RBTX4939 IOC controller definition 20 - */ 21 - 22 - static void rbtx4939_ioc_irq_unmask(struct irq_data *d) 23 - { 24 - int ioc_nr = d->irq - RBTX4939_IRQ_IOC; 25 - 26 - writeb(readb(rbtx4939_ien_addr) | (1 << ioc_nr), rbtx4939_ien_addr); 27 - } 28 - 29 - static void rbtx4939_ioc_irq_mask(struct irq_data *d) 30 - { 31 - int ioc_nr = d->irq - RBTX4939_IRQ_IOC; 32 - 33 - writeb(readb(rbtx4939_ien_addr) & ~(1 << ioc_nr), rbtx4939_ien_addr); 34 - mmiowb(); 35 - } 36 - 37 - static struct irq_chip rbtx4939_ioc_irq_chip = { 38 - .name = "IOC", 39 - .irq_mask = rbtx4939_ioc_irq_mask, 40 - .irq_unmask = rbtx4939_ioc_irq_unmask, 41 - }; 42 - 43 - 44 - static inline int rbtx4939_ioc_irqroute(void) 45 - { 46 - unsigned char istat = readb(rbtx4939_ifac2_addr); 47 - 48 - if (unlikely(istat == 0)) 49 - return -1; 50 - return RBTX4939_IRQ_IOC + __fls8(istat); 51 - } 52 - 53 - static int rbtx4939_irq_dispatch(int pending) 54 - { 55 - int irq; 56 - 57 - if (pending & CAUSEF_IP7) 58 - return MIPS_CPU_IRQ_BASE + 7; 59 - irq = tx4939_irq(); 60 - if (likely(irq >= 0)) { 61 - /* redirect IOC interrupts */ 62 - switch (irq) { 63 - case RBTX4939_IRQ_IOCINT: 64 - irq = rbtx4939_ioc_irqroute(); 65 - break; 66 - } 67 - } else if (pending & CAUSEF_IP0) 68 - irq = MIPS_CPU_IRQ_BASE + 0; 69 - else if (pending & CAUSEF_IP1) 70 - irq = MIPS_CPU_IRQ_BASE + 1; 71 - else 72 - irq = -1; 73 - return irq; 74 - } 75 - 76 - void __init rbtx4939_irq_setup(void) 77 - { 78 - int i; 79 - 80 - /* mask all IOC interrupts */ 81 - writeb(0, rbtx4939_ien_addr); 82 - 83 - /* clear SoftInt interrupts */ 84 - writeb(0, rbtx4939_softint_addr); 85 - 86 - txx9_irq_dispatch = rbtx4939_irq_dispatch; 87 - 88 - tx4939_irq_init(); 89 - for (i = RBTX4939_IRQ_IOC; 90 - i < RBTX4939_IRQ_IOC + RBTX4939_NR_IRQ_IOC; i++) 91 - irq_set_chip_and_handler(i, &rbtx4939_ioc_irq_chip, 92 - handle_level_irq); 93 - 94 - irq_set_chained_handler(RBTX4939_IRQ_IOCINT, handle_simple_irq); 95 - }
-29
arch/mips/txx9/rbtx4939/prom.c
··· 1 - /* 2 - * rbtx4939 specific prom routines 3 - * 4 - * This file is subject to the terms and conditions of the GNU General Public 5 - * License. See the file "COPYING" in the main directory of this archive 6 - * for more details. 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/memblock.h> 11 - #include <asm/txx9/generic.h> 12 - #include <asm/txx9/rbtx4939.h> 13 - 14 - void __init rbtx4939_prom_init(void) 15 - { 16 - unsigned long start, size; 17 - u64 win; 18 - int i; 19 - 20 - for (i = 0; i < 4; i++) { 21 - if (!((__u32)____raw_readq(&tx4939_ddrcptr->winen) & (1 << i))) 22 - continue; 23 - win = ____raw_readq(&tx4939_ddrcptr->win[i]); 24 - start = (unsigned long)(win >> 48); 25 - size = (((unsigned long)(win >> 32) & 0xffff) + 1) - start; 26 - memblock_add(start << 20, size << 20); 27 - } 28 - txx9_sio_putchar_init(TX4939_SIO_REG(0) & 0xfffffffffULL); 29 - }
-554
arch/mips/txx9/rbtx4939/setup.c
··· 1 - /* 2 - * Toshiba RBTX4939 setup routines. 3 - * Based on linux/arch/mips/txx9/rbtx4938/setup.c, 4 - * and RBTX49xx patch from CELF patch archive. 5 - * 6 - * Copyright (C) 2000-2001,2005-2007 Toshiba Corporation 7 - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the 8 - * terms of the GNU General Public License version 2. This program is 9 - * licensed "as is" without any warranty of any kind, whether express 10 - * or implied. 11 - */ 12 - #include <linux/init.h> 13 - #include <linux/kernel.h> 14 - #include <linux/types.h> 15 - #include <linux/slab.h> 16 - #include <linux/export.h> 17 - #include <linux/platform_device.h> 18 - #include <linux/leds.h> 19 - #include <linux/interrupt.h> 20 - #include <linux/smc91x.h> 21 - #include <linux/mtd/mtd.h> 22 - #include <linux/mtd/partitions.h> 23 - #include <linux/mtd/map.h> 24 - #include <asm/reboot.h> 25 - #include <asm/txx9/generic.h> 26 - #include <asm/txx9/pci.h> 27 - #include <asm/txx9/rbtx4939.h> 28 - 29 - static void rbtx4939_machine_restart(char *command) 30 - { 31 - local_irq_disable(); 32 - writeb(1, rbtx4939_reseten_addr); 33 - writeb(1, rbtx4939_softreset_addr); 34 - while (1) 35 - ; 36 - } 37 - 38 - static void __init rbtx4939_time_init(void) 39 - { 40 - tx4939_time_init(0); 41 - } 42 - 43 - #if defined(__BIG_ENDIAN) && IS_ENABLED(CONFIG_SMC91X) 44 - #define HAVE_RBTX4939_IOSWAB 45 - #define IS_CE1_ADDR(addr) \ 46 - ((((unsigned long)(addr) - IO_BASE) & 0xfff00000) == TXX9_CE(1)) 47 - static u16 rbtx4939_ioswabw(volatile u16 *a, u16 x) 48 - { 49 - return IS_CE1_ADDR(a) ? x : le16_to_cpu(x); 50 - } 51 - static u16 rbtx4939_mem_ioswabw(volatile u16 *a, u16 x) 52 - { 53 - return !IS_CE1_ADDR(a) ? x : le16_to_cpu(x); 54 - } 55 - #endif /* __BIG_ENDIAN && CONFIG_SMC91X */ 56 - 57 - static void __init rbtx4939_pci_setup(void) 58 - { 59 - #ifdef CONFIG_PCI 60 - int extarb = !(__raw_readq(&tx4939_ccfgptr->ccfg) & TX4939_CCFG_PCIARB); 61 - struct pci_controller *c = &txx9_primary_pcic; 62 - 63 - register_pci_controller(c); 64 - 65 - tx4939_report_pciclk(); 66 - tx4927_pcic_setup(tx4939_pcicptr, c, extarb); 67 - if (!(__raw_readq(&tx4939_ccfgptr->pcfg) & TX4939_PCFG_ATA1MODE) && 68 - (__raw_readq(&tx4939_ccfgptr->pcfg) & 69 - (TX4939_PCFG_ET0MODE | TX4939_PCFG_ET1MODE))) { 70 - tx4939_report_pci1clk(); 71 - 72 - /* mem:64K(max), io:64K(max) (enough for ETH0,ETH1) */ 73 - c = txx9_alloc_pci_controller(NULL, 0, 0x10000, 0, 0x10000); 74 - register_pci_controller(c); 75 - tx4927_pcic_setup(tx4939_pcic1ptr, c, 0); 76 - } 77 - 78 - tx4939_setup_pcierr_irq(); 79 - #endif /* CONFIG_PCI */ 80 - } 81 - 82 - static unsigned long long default_ebccr[] __initdata = { 83 - 0x01c0000000007608ULL, /* 64M ROM */ 84 - 0x017f000000007049ULL, /* 1M IOC */ 85 - 0x0180000000408608ULL, /* ISA */ 86 - 0, 87 - }; 88 - 89 - static void __init rbtx4939_ebusc_setup(void) 90 - { 91 - int i; 92 - unsigned int sp; 93 - 94 - /* use user-configured speed */ 95 - sp = TX4939_EBUSC_CR(0) & 0x30; 96 - default_ebccr[0] |= sp; 97 - default_ebccr[1] |= sp; 98 - default_ebccr[2] |= sp; 99 - /* initialise by myself */ 100 - for (i = 0; i < ARRAY_SIZE(default_ebccr); i++) { 101 - if (default_ebccr[i]) 102 - ____raw_writeq(default_ebccr[i], 103 - &tx4939_ebuscptr->cr[i]); 104 - else 105 - ____raw_writeq(____raw_readq(&tx4939_ebuscptr->cr[i]) 106 - & ~8, 107 - &tx4939_ebuscptr->cr[i]); 108 - } 109 - } 110 - 111 - static void __init rbtx4939_update_ioc_pen(void) 112 - { 113 - __u64 pcfg = ____raw_readq(&tx4939_ccfgptr->pcfg); 114 - __u64 ccfg = ____raw_readq(&tx4939_ccfgptr->ccfg); 115 - __u8 pe1 = readb(rbtx4939_pe1_addr); 116 - __u8 pe2 = readb(rbtx4939_pe2_addr); 117 - __u8 pe3 = readb(rbtx4939_pe3_addr); 118 - if (pcfg & TX4939_PCFG_ATA0MODE) 119 - pe1 |= RBTX4939_PE1_ATA(0); 120 - else 121 - pe1 &= ~RBTX4939_PE1_ATA(0); 122 - if (pcfg & TX4939_PCFG_ATA1MODE) { 123 - pe1 |= RBTX4939_PE1_ATA(1); 124 - pe1 &= ~(RBTX4939_PE1_RMII(0) | RBTX4939_PE1_RMII(1)); 125 - } else { 126 - pe1 &= ~RBTX4939_PE1_ATA(1); 127 - if (pcfg & TX4939_PCFG_ET0MODE) 128 - pe1 |= RBTX4939_PE1_RMII(0); 129 - else 130 - pe1 &= ~RBTX4939_PE1_RMII(0); 131 - if (pcfg & TX4939_PCFG_ET1MODE) 132 - pe1 |= RBTX4939_PE1_RMII(1); 133 - else 134 - pe1 &= ~RBTX4939_PE1_RMII(1); 135 - } 136 - if (ccfg & TX4939_CCFG_PTSEL) 137 - pe3 &= ~(RBTX4939_PE3_VP | RBTX4939_PE3_VP_P | 138 - RBTX4939_PE3_VP_S); 139 - else { 140 - __u64 vmode = pcfg & 141 - (TX4939_PCFG_VSSMODE | TX4939_PCFG_VPSMODE); 142 - if (vmode == 0) 143 - pe3 &= ~(RBTX4939_PE3_VP | RBTX4939_PE3_VP_P | 144 - RBTX4939_PE3_VP_S); 145 - else if (vmode == TX4939_PCFG_VPSMODE) { 146 - pe3 |= RBTX4939_PE3_VP_P; 147 - pe3 &= ~(RBTX4939_PE3_VP | RBTX4939_PE3_VP_S); 148 - } else if (vmode == TX4939_PCFG_VSSMODE) { 149 - pe3 |= RBTX4939_PE3_VP | RBTX4939_PE3_VP_S; 150 - pe3 &= ~RBTX4939_PE3_VP_P; 151 - } else { 152 - pe3 |= RBTX4939_PE3_VP | RBTX4939_PE3_VP_P; 153 - pe3 &= ~RBTX4939_PE3_VP_S; 154 - } 155 - } 156 - if (pcfg & TX4939_PCFG_SPIMODE) { 157 - if (pcfg & TX4939_PCFG_SIO2MODE_GPIO) 158 - pe2 &= ~(RBTX4939_PE2_SIO2 | RBTX4939_PE2_SIO0); 159 - else { 160 - if (pcfg & TX4939_PCFG_SIO2MODE_SIO2) { 161 - pe2 |= RBTX4939_PE2_SIO2; 162 - pe2 &= ~RBTX4939_PE2_SIO0; 163 - } else { 164 - pe2 |= RBTX4939_PE2_SIO0; 165 - pe2 &= ~RBTX4939_PE2_SIO2; 166 - } 167 - } 168 - if (pcfg & TX4939_PCFG_SIO3MODE) 169 - pe2 |= RBTX4939_PE2_SIO3; 170 - else 171 - pe2 &= ~RBTX4939_PE2_SIO3; 172 - pe2 &= ~RBTX4939_PE2_SPI; 173 - } else { 174 - pe2 |= RBTX4939_PE2_SPI; 175 - pe2 &= ~(RBTX4939_PE2_SIO3 | RBTX4939_PE2_SIO2 | 176 - RBTX4939_PE2_SIO0); 177 - } 178 - if ((pcfg & TX4939_PCFG_I2SMODE_MASK) == TX4939_PCFG_I2SMODE_GPIO) 179 - pe2 |= RBTX4939_PE2_GPIO; 180 - else 181 - pe2 &= ~RBTX4939_PE2_GPIO; 182 - writeb(pe1, rbtx4939_pe1_addr); 183 - writeb(pe2, rbtx4939_pe2_addr); 184 - writeb(pe3, rbtx4939_pe3_addr); 185 - } 186 - 187 - #define RBTX4939_MAX_7SEGLEDS 8 188 - 189 - #if IS_BUILTIN(CONFIG_LEDS_CLASS) 190 - static u8 led_val[RBTX4939_MAX_7SEGLEDS]; 191 - struct rbtx4939_led_data { 192 - struct led_classdev cdev; 193 - char name[32]; 194 - unsigned int num; 195 - }; 196 - 197 - /* Use "dot" in 7seg LEDs */ 198 - static void rbtx4939_led_brightness_set(struct led_classdev *led_cdev, 199 - enum led_brightness value) 200 - { 201 - struct rbtx4939_led_data *led_dat = 202 - container_of(led_cdev, struct rbtx4939_led_data, cdev); 203 - unsigned int num = led_dat->num; 204 - unsigned long flags; 205 - 206 - local_irq_save(flags); 207 - led_val[num] = (led_val[num] & 0x7f) | (value ? 0x80 : 0); 208 - writeb(led_val[num], rbtx4939_7seg_addr(num / 4, num % 4)); 209 - local_irq_restore(flags); 210 - } 211 - 212 - static int __init rbtx4939_led_probe(struct platform_device *pdev) 213 - { 214 - struct rbtx4939_led_data *leds_data; 215 - int i; 216 - static char *default_triggers[] __initdata = { 217 - "heartbeat", 218 - "disk-activity", 219 - "nand-disk", 220 - }; 221 - 222 - leds_data = kcalloc(RBTX4939_MAX_7SEGLEDS, sizeof(*leds_data), 223 - GFP_KERNEL); 224 - if (!leds_data) 225 - return -ENOMEM; 226 - for (i = 0; i < RBTX4939_MAX_7SEGLEDS; i++) { 227 - int rc; 228 - struct rbtx4939_led_data *led_dat = &leds_data[i]; 229 - 230 - led_dat->num = i; 231 - led_dat->cdev.brightness_set = rbtx4939_led_brightness_set; 232 - sprintf(led_dat->name, "rbtx4939:amber:%u", i); 233 - led_dat->cdev.name = led_dat->name; 234 - if (i < ARRAY_SIZE(default_triggers)) 235 - led_dat->cdev.default_trigger = default_triggers[i]; 236 - rc = led_classdev_register(&pdev->dev, &led_dat->cdev); 237 - if (rc < 0) 238 - return rc; 239 - led_dat->cdev.brightness_set(&led_dat->cdev, 0); 240 - } 241 - return 0; 242 - 243 - } 244 - 245 - static struct platform_driver rbtx4939_led_driver = { 246 - .driver = { 247 - .name = "rbtx4939-led", 248 - }, 249 - }; 250 - 251 - static void __init rbtx4939_led_setup(void) 252 - { 253 - platform_device_register_simple("rbtx4939-led", -1, NULL, 0); 254 - platform_driver_probe(&rbtx4939_led_driver, rbtx4939_led_probe); 255 - } 256 - #else 257 - static inline void rbtx4939_led_setup(void) 258 - { 259 - } 260 - #endif 261 - 262 - static void __rbtx4939_7segled_putc(unsigned int pos, unsigned char val) 263 - { 264 - #if IS_BUILTIN(CONFIG_LEDS_CLASS) 265 - unsigned long flags; 266 - local_irq_save(flags); 267 - /* bit7: reserved for LED class */ 268 - led_val[pos] = (led_val[pos] & 0x80) | (val & 0x7f); 269 - val = led_val[pos]; 270 - local_irq_restore(flags); 271 - #endif 272 - writeb(val, rbtx4939_7seg_addr(pos / 4, pos % 4)); 273 - } 274 - 275 - static void rbtx4939_7segled_putc(unsigned int pos, unsigned char val) 276 - { 277 - /* convert from map_to_seg7() notation */ 278 - val = (val & 0x88) | 279 - ((val & 0x40) >> 6) | 280 - ((val & 0x20) >> 4) | 281 - ((val & 0x10) >> 2) | 282 - ((val & 0x04) << 2) | 283 - ((val & 0x02) << 4) | 284 - ((val & 0x01) << 6); 285 - __rbtx4939_7segled_putc(pos, val); 286 - } 287 - 288 - #if IS_ENABLED(CONFIG_MTD_RBTX4939) 289 - /* special mapping for boot rom */ 290 - static unsigned long rbtx4939_flash_fixup_ofs(unsigned long ofs) 291 - { 292 - u8 bdipsw = readb(rbtx4939_bdipsw_addr) & 0x0f; 293 - unsigned char shift; 294 - 295 - if (bdipsw & 8) { 296 - /* BOOT Mode: USER ROM1 / USER ROM2 */ 297 - shift = bdipsw & 3; 298 - /* rotate A[23:22] */ 299 - return (ofs & ~0xc00000) | ((((ofs >> 22) + shift) & 3) << 22); 300 - } 301 - #ifdef __BIG_ENDIAN 302 - if (bdipsw == 0) 303 - /* BOOT Mode: Monitor ROM */ 304 - ofs ^= 0x400000; /* swap A[22] */ 305 - #endif 306 - return ofs; 307 - } 308 - 309 - static map_word rbtx4939_flash_read16(struct map_info *map, unsigned long ofs) 310 - { 311 - map_word r; 312 - 313 - ofs = rbtx4939_flash_fixup_ofs(ofs); 314 - r.x[0] = __raw_readw(map->virt + ofs); 315 - return r; 316 - } 317 - 318 - static void rbtx4939_flash_write16(struct map_info *map, const map_word datum, 319 - unsigned long ofs) 320 - { 321 - ofs = rbtx4939_flash_fixup_ofs(ofs); 322 - __raw_writew(datum.x[0], map->virt + ofs); 323 - mb(); /* see inline_map_write() in mtd/map.h */ 324 - } 325 - 326 - static void rbtx4939_flash_copy_from(struct map_info *map, void *to, 327 - unsigned long from, ssize_t len) 328 - { 329 - u8 bdipsw = readb(rbtx4939_bdipsw_addr) & 0x0f; 330 - unsigned char shift; 331 - ssize_t curlen; 332 - 333 - from += (unsigned long)map->virt; 334 - if (bdipsw & 8) { 335 - /* BOOT Mode: USER ROM1 / USER ROM2 */ 336 - shift = bdipsw & 3; 337 - while (len) { 338 - curlen = min_t(unsigned long, len, 339 - 0x400000 - (from & (0x400000 - 1))); 340 - memcpy(to, 341 - (void *)((from & ~0xc00000) | 342 - ((((from >> 22) + shift) & 3) << 22)), 343 - curlen); 344 - len -= curlen; 345 - from += curlen; 346 - to += curlen; 347 - } 348 - return; 349 - } 350 - #ifdef __BIG_ENDIAN 351 - if (bdipsw == 0) { 352 - /* BOOT Mode: Monitor ROM */ 353 - while (len) { 354 - curlen = min_t(unsigned long, len, 355 - 0x400000 - (from & (0x400000 - 1))); 356 - memcpy(to, (void *)(from ^ 0x400000), curlen); 357 - len -= curlen; 358 - from += curlen; 359 - to += curlen; 360 - } 361 - return; 362 - } 363 - #endif 364 - memcpy(to, (void *)from, len); 365 - } 366 - 367 - static void rbtx4939_flash_map_init(struct map_info *map) 368 - { 369 - map->read = rbtx4939_flash_read16; 370 - map->write = rbtx4939_flash_write16; 371 - map->copy_from = rbtx4939_flash_copy_from; 372 - } 373 - 374 - static void __init rbtx4939_mtd_init(void) 375 - { 376 - static struct { 377 - struct platform_device dev; 378 - struct resource res; 379 - struct rbtx4939_flash_data data; 380 - } pdevs[4]; 381 - int i; 382 - static char names[4][8]; 383 - static struct mtd_partition parts[4]; 384 - struct rbtx4939_flash_data *boot_pdata = &pdevs[0].data; 385 - u8 bdipsw = readb(rbtx4939_bdipsw_addr) & 0x0f; 386 - 387 - if (bdipsw & 8) { 388 - /* BOOT Mode: USER ROM1 / USER ROM2 */ 389 - boot_pdata->nr_parts = 4; 390 - for (i = 0; i < boot_pdata->nr_parts; i++) { 391 - sprintf(names[i], "img%d", 4 - i); 392 - parts[i].name = names[i]; 393 - parts[i].size = 0x400000; 394 - parts[i].offset = MTDPART_OFS_NXTBLK; 395 - } 396 - } else if (bdipsw == 0) { 397 - /* BOOT Mode: Monitor ROM */ 398 - boot_pdata->nr_parts = 2; 399 - strcpy(names[0], "big"); 400 - strcpy(names[1], "little"); 401 - for (i = 0; i < boot_pdata->nr_parts; i++) { 402 - parts[i].name = names[i]; 403 - parts[i].size = 0x400000; 404 - parts[i].offset = MTDPART_OFS_NXTBLK; 405 - } 406 - } else { 407 - /* BOOT Mode: ROM Emulator */ 408 - boot_pdata->nr_parts = 2; 409 - parts[0].name = "boot"; 410 - parts[0].offset = 0xc00000; 411 - parts[0].size = 0x400000; 412 - parts[1].name = "user"; 413 - parts[1].offset = 0; 414 - parts[1].size = 0xc00000; 415 - } 416 - boot_pdata->parts = parts; 417 - boot_pdata->map_init = rbtx4939_flash_map_init; 418 - 419 - for (i = 0; i < ARRAY_SIZE(pdevs); i++) { 420 - struct resource *r = &pdevs[i].res; 421 - struct platform_device *dev = &pdevs[i].dev; 422 - 423 - r->start = 0x1f000000 - i * 0x1000000; 424 - r->end = r->start + 0x1000000 - 1; 425 - r->flags = IORESOURCE_MEM; 426 - pdevs[i].data.width = 2; 427 - dev->num_resources = 1; 428 - dev->resource = r; 429 - dev->id = i; 430 - dev->name = "rbtx4939-flash"; 431 - dev->dev.platform_data = &pdevs[i].data; 432 - platform_device_register(dev); 433 - } 434 - } 435 - #else 436 - static void __init rbtx4939_mtd_init(void) 437 - { 438 - } 439 - #endif 440 - 441 - static void __init rbtx4939_arch_init(void) 442 - { 443 - rbtx4939_pci_setup(); 444 - } 445 - 446 - static void __init rbtx4939_device_init(void) 447 - { 448 - unsigned long smc_addr = RBTX4939_ETHER_ADDR - IO_BASE; 449 - struct resource smc_res[] = { 450 - { 451 - .start = smc_addr, 452 - .end = smc_addr + 0x10 - 1, 453 - .flags = IORESOURCE_MEM, 454 - }, { 455 - .start = RBTX4939_IRQ_ETHER, 456 - /* override default irq flag defined in smc91x.h */ 457 - .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, 458 - }, 459 - }; 460 - struct smc91x_platdata smc_pdata = { 461 - .flags = SMC91X_USE_16BIT, 462 - }; 463 - struct platform_device *pdev; 464 - #if IS_ENABLED(CONFIG_TC35815) 465 - int i, j; 466 - unsigned char ethaddr[2][6]; 467 - u8 bdipsw = readb(rbtx4939_bdipsw_addr) & 0x0f; 468 - 469 - for (i = 0; i < 2; i++) { 470 - unsigned long area = CKSEG1 + 0x1fff0000 + (i * 0x10); 471 - if (bdipsw == 0) 472 - memcpy(ethaddr[i], (void *)area, 6); 473 - else { 474 - u16 buf[3]; 475 - if (bdipsw & 8) 476 - area -= 0x03000000; 477 - else 478 - area -= 0x01000000; 479 - for (j = 0; j < 3; j++) 480 - buf[j] = le16_to_cpup((u16 *)(area + j * 2)); 481 - memcpy(ethaddr[i], buf, 6); 482 - } 483 - } 484 - tx4939_ethaddr_init(ethaddr[0], ethaddr[1]); 485 - #endif 486 - pdev = platform_device_alloc("smc91x", -1); 487 - if (!pdev || 488 - platform_device_add_resources(pdev, smc_res, ARRAY_SIZE(smc_res)) || 489 - platform_device_add_data(pdev, &smc_pdata, sizeof(smc_pdata)) || 490 - platform_device_add(pdev)) 491 - platform_device_put(pdev); 492 - rbtx4939_mtd_init(); 493 - /* TC58DVM82A1FT: tDH=10ns, tWP=tRP=tREADID=35ns */ 494 - tx4939_ndfmc_init(10, 35, 495 - (1 << 1) | (1 << 2), 496 - (1 << 2)); /* ch1:8bit, ch2:16bit */ 497 - rbtx4939_led_setup(); 498 - tx4939_wdt_init(); 499 - tx4939_ata_init(); 500 - tx4939_rtc_init(); 501 - tx4939_dmac_init(0, 2); 502 - tx4939_aclc_init(); 503 - platform_device_register_simple("txx9aclc-generic", -1, NULL, 0); 504 - tx4939_sramc_init(); 505 - tx4939_rng_init(); 506 - } 507 - 508 - static void __init rbtx4939_setup(void) 509 - { 510 - int i; 511 - 512 - rbtx4939_ebusc_setup(); 513 - /* always enable ATA0 */ 514 - txx9_set64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_ATA0MODE); 515 - if (txx9_master_clock == 0) 516 - txx9_master_clock = 20000000; 517 - tx4939_setup(); 518 - rbtx4939_update_ioc_pen(); 519 - #ifdef HAVE_RBTX4939_IOSWAB 520 - ioswabw = rbtx4939_ioswabw; 521 - __mem_ioswabw = rbtx4939_mem_ioswabw; 522 - #endif 523 - 524 - _machine_restart = rbtx4939_machine_restart; 525 - 526 - txx9_7segled_init(RBTX4939_MAX_7SEGLEDS, rbtx4939_7segled_putc); 527 - for (i = 0; i < RBTX4939_MAX_7SEGLEDS; i++) 528 - txx9_7segled_putc(i, '-'); 529 - pr_info("RBTX4939 (Rev %02x) --- FPGA(Rev %02x) DIPSW:%02x,%02x\n", 530 - readb(rbtx4939_board_rev_addr), readb(rbtx4939_ioc_rev_addr), 531 - readb(rbtx4939_udipsw_addr), readb(rbtx4939_bdipsw_addr)); 532 - 533 - #ifdef CONFIG_PCI 534 - txx9_alloc_pci_controller(&txx9_primary_pcic, 0, 0, 0, 0); 535 - txx9_board_pcibios_setup = tx4927_pcibios_setup; 536 - #else 537 - set_io_port_base(RBTX4939_ETHER_BASE); 538 - #endif 539 - 540 - tx4939_sio_init(TX4939_SCLK0(txx9_master_clock), 0); 541 - } 542 - 543 - struct txx9_board_vec rbtx4939_vec __initdata = { 544 - .system = "Toshiba RBTX4939", 545 - .prom_init = rbtx4939_prom_init, 546 - .mem_setup = rbtx4939_setup, 547 - .irq_setup = rbtx4939_irq_setup, 548 - .time_init = rbtx4939_time_init, 549 - .device_init = rbtx4939_device_init, 550 - .arch_init = rbtx4939_arch_init, 551 - #ifdef CONFIG_PCI 552 - .pci_map_irq = tx4939_pci_map_irq, 553 - #endif 554 - };
-13
drivers/char/hw_random/Kconfig
··· 226 226 To compile this driver as a module, choose M here: the 227 227 module will be called virtio-rng. If unsure, say N. 228 228 229 - config HW_RANDOM_TX4939 230 - tristate "TX4939 Random Number Generator support" 231 - depends on SOC_TX4939 232 - default HW_RANDOM 233 - help 234 - This driver provides kernel-side support for the Random Number 235 - Generator hardware found on TX4939 SoC. 236 - 237 - To compile this driver as a module, choose M here: the 238 - module will be called tx4939-rng. 239 - 240 - If unsure, say Y. 241 - 242 229 config HW_RANDOM_MXC_RNGA 243 230 tristate "Freescale i.MX RNGA Random Number Generator" 244 231 depends on SOC_IMX31
-1
drivers/char/hw_random/Makefile
··· 20 20 obj-$(CONFIG_HW_RANDOM_OMAP3_ROM) += omap3-rom-rng.o 21 21 obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o 22 22 obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o 23 - obj-$(CONFIG_HW_RANDOM_TX4939) += tx4939-rng.o 24 23 obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o 25 24 obj-$(CONFIG_HW_RANDOM_IMX_RNGC) += imx-rngc.o 26 25 obj-$(CONFIG_HW_RANDOM_INGENIC_RNG) += ingenic-rng.o
-157
drivers/char/hw_random/tx4939-rng.c
··· 1 - /* 2 - * RNG driver for TX4939 Random Number Generators (RNG) 3 - * 4 - * Copyright (C) 2009 Atsushi Nemoto <anemo@mba.ocn.ne.jp> 5 - * 6 - * This file is subject to the terms and conditions of the GNU General Public 7 - * License. See the file "COPYING" in the main directory of this archive 8 - * for more details. 9 - */ 10 - #include <linux/err.h> 11 - #include <linux/module.h> 12 - #include <linux/kernel.h> 13 - #include <linux/init.h> 14 - #include <linux/delay.h> 15 - #include <linux/io.h> 16 - #include <linux/platform_device.h> 17 - #include <linux/hw_random.h> 18 - #include <linux/gfp.h> 19 - 20 - #define TX4939_RNG_RCSR 0x00000000 21 - #define TX4939_RNG_ROR(n) (0x00000018 + (n) * 8) 22 - 23 - #define TX4939_RNG_RCSR_INTE 0x00000008 24 - #define TX4939_RNG_RCSR_RST 0x00000004 25 - #define TX4939_RNG_RCSR_FIN 0x00000002 26 - #define TX4939_RNG_RCSR_ST 0x00000001 27 - 28 - struct tx4939_rng { 29 - struct hwrng rng; 30 - void __iomem *base; 31 - u64 databuf[3]; 32 - unsigned int data_avail; 33 - }; 34 - 35 - static void rng_io_start(void) 36 - { 37 - #ifndef CONFIG_64BIT 38 - /* 39 - * readq is reading a 64-bit register using a 64-bit load. On 40 - * a 32-bit kernel however interrupts or any other processor 41 - * exception would clobber the upper 32-bit of the processor 42 - * register so interrupts need to be disabled. 43 - */ 44 - local_irq_disable(); 45 - #endif 46 - } 47 - 48 - static void rng_io_end(void) 49 - { 50 - #ifndef CONFIG_64BIT 51 - local_irq_enable(); 52 - #endif 53 - } 54 - 55 - static u64 read_rng(void __iomem *base, unsigned int offset) 56 - { 57 - return ____raw_readq(base + offset); 58 - } 59 - 60 - static void write_rng(u64 val, void __iomem *base, unsigned int offset) 61 - { 62 - return ____raw_writeq(val, base + offset); 63 - } 64 - 65 - static int tx4939_rng_data_present(struct hwrng *rng, int wait) 66 - { 67 - struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); 68 - int i; 69 - 70 - if (rngdev->data_avail) 71 - return rngdev->data_avail; 72 - for (i = 0; i < 20; i++) { 73 - rng_io_start(); 74 - if (!(read_rng(rngdev->base, TX4939_RNG_RCSR) 75 - & TX4939_RNG_RCSR_ST)) { 76 - rngdev->databuf[0] = 77 - read_rng(rngdev->base, TX4939_RNG_ROR(0)); 78 - rngdev->databuf[1] = 79 - read_rng(rngdev->base, TX4939_RNG_ROR(1)); 80 - rngdev->databuf[2] = 81 - read_rng(rngdev->base, TX4939_RNG_ROR(2)); 82 - rngdev->data_avail = 83 - sizeof(rngdev->databuf) / sizeof(u32); 84 - /* Start RNG */ 85 - write_rng(TX4939_RNG_RCSR_ST, 86 - rngdev->base, TX4939_RNG_RCSR); 87 - wait = 0; 88 - } 89 - rng_io_end(); 90 - if (!wait) 91 - break; 92 - /* 90 bus clock cycles by default for generation */ 93 - ndelay(90 * 5); 94 - } 95 - return rngdev->data_avail; 96 - } 97 - 98 - static int tx4939_rng_data_read(struct hwrng *rng, u32 *buffer) 99 - { 100 - struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); 101 - 102 - rngdev->data_avail--; 103 - *buffer = *((u32 *)&rngdev->databuf + rngdev->data_avail); 104 - return sizeof(u32); 105 - } 106 - 107 - static int __init tx4939_rng_probe(struct platform_device *dev) 108 - { 109 - struct tx4939_rng *rngdev; 110 - int i; 111 - 112 - rngdev = devm_kzalloc(&dev->dev, sizeof(*rngdev), GFP_KERNEL); 113 - if (!rngdev) 114 - return -ENOMEM; 115 - rngdev->base = devm_platform_ioremap_resource(dev, 0); 116 - if (IS_ERR(rngdev->base)) 117 - return PTR_ERR(rngdev->base); 118 - 119 - rngdev->rng.name = dev_name(&dev->dev); 120 - rngdev->rng.data_present = tx4939_rng_data_present; 121 - rngdev->rng.data_read = tx4939_rng_data_read; 122 - 123 - rng_io_start(); 124 - /* Reset RNG */ 125 - write_rng(TX4939_RNG_RCSR_RST, rngdev->base, TX4939_RNG_RCSR); 126 - write_rng(0, rngdev->base, TX4939_RNG_RCSR); 127 - /* Start RNG */ 128 - write_rng(TX4939_RNG_RCSR_ST, rngdev->base, TX4939_RNG_RCSR); 129 - rng_io_end(); 130 - /* 131 - * Drop first two results. From the datasheet: 132 - * The quality of the random numbers generated immediately 133 - * after reset can be insufficient. Therefore, do not use 134 - * random numbers obtained from the first and second 135 - * generations; use the ones from the third or subsequent 136 - * generation. 137 - */ 138 - for (i = 0; i < 2; i++) { 139 - rngdev->data_avail = 0; 140 - if (!tx4939_rng_data_present(&rngdev->rng, 1)) 141 - return -EIO; 142 - } 143 - 144 - platform_set_drvdata(dev, rngdev); 145 - return devm_hwrng_register(&dev->dev, &rngdev->rng); 146 - } 147 - 148 - static struct platform_driver tx4939_rng_driver = { 149 - .driver = { 150 - .name = "tx4939-rng", 151 - }, 152 - }; 153 - 154 - module_platform_driver_probe(tx4939_rng_driver, tx4939_rng_probe); 155 - 156 - MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver for TX4939"); 157 - MODULE_LICENSE("GPL");
-6
drivers/mtd/maps/Kconfig
··· 357 357 Map driver for a NOR flash bank located on the Expansion Bus of the 358 358 Intel Vermilion Range chipset. 359 359 360 - config MTD_RBTX4939 361 - tristate "Map driver for RBTX4939 board" 362 - depends on TOSHIBA_RBTX4939 && MTD_CFI && MTD_COMPLEX_MAPPINGS 363 - help 364 - Map driver for NOR flash chips on RBTX4939 board. 365 - 366 360 config MTD_PLATRAM 367 361 tristate "Map driver for platform device RAM (mtd-ram)" 368 362 select MTD_RAM
-1
drivers/mtd/maps/Makefile
··· 42 42 obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o 43 43 obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o 44 44 obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o 45 - obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o 46 45 obj-$(CONFIG_MTD_VMU) += vmu-flash.o 47 46 obj-$(CONFIG_MTD_LANTIQ) += lantiq-flash.o
-133
drivers/mtd/maps/rbtx4939-flash.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * rbtx4939-flash (based on physmap.c) 4 - * 5 - * This is a simplified physmap driver with map_init callback function. 6 - * 7 - * Copyright (C) 2009 Atsushi Nemoto <anemo@mba.ocn.ne.jp> 8 - */ 9 - 10 - #include <linux/module.h> 11 - #include <linux/types.h> 12 - #include <linux/kernel.h> 13 - #include <linux/slab.h> 14 - #include <linux/device.h> 15 - #include <linux/platform_device.h> 16 - #include <linux/mtd/mtd.h> 17 - #include <linux/mtd/map.h> 18 - #include <linux/mtd/partitions.h> 19 - #include <asm/txx9/rbtx4939.h> 20 - 21 - struct rbtx4939_flash_info { 22 - struct mtd_info *mtd; 23 - struct map_info map; 24 - }; 25 - 26 - static int rbtx4939_flash_remove(struct platform_device *dev) 27 - { 28 - struct rbtx4939_flash_info *info; 29 - 30 - info = platform_get_drvdata(dev); 31 - if (!info) 32 - return 0; 33 - 34 - if (info->mtd) { 35 - mtd_device_unregister(info->mtd); 36 - map_destroy(info->mtd); 37 - } 38 - return 0; 39 - } 40 - 41 - static const char * const rom_probe_types[] = { 42 - "cfi_probe", "jedec_probe", NULL }; 43 - 44 - static int rbtx4939_flash_probe(struct platform_device *dev) 45 - { 46 - struct rbtx4939_flash_data *pdata; 47 - struct rbtx4939_flash_info *info; 48 - struct resource *res; 49 - const char * const *probe_type; 50 - int err = 0; 51 - unsigned long size; 52 - 53 - pdata = dev_get_platdata(&dev->dev); 54 - if (!pdata) 55 - return -ENODEV; 56 - 57 - res = platform_get_resource(dev, IORESOURCE_MEM, 0); 58 - if (!res) 59 - return -ENODEV; 60 - info = devm_kzalloc(&dev->dev, sizeof(struct rbtx4939_flash_info), 61 - GFP_KERNEL); 62 - if (!info) 63 - return -ENOMEM; 64 - 65 - platform_set_drvdata(dev, info); 66 - 67 - size = resource_size(res); 68 - pr_notice("rbtx4939 platform flash device: %pR\n", res); 69 - 70 - if (!devm_request_mem_region(&dev->dev, res->start, size, 71 - dev_name(&dev->dev))) 72 - return -EBUSY; 73 - 74 - info->map.name = dev_name(&dev->dev); 75 - info->map.phys = res->start; 76 - info->map.size = size; 77 - info->map.bankwidth = pdata->width; 78 - 79 - info->map.virt = devm_ioremap(&dev->dev, info->map.phys, size); 80 - if (!info->map.virt) 81 - return -EBUSY; 82 - 83 - if (pdata->map_init) 84 - (*pdata->map_init)(&info->map); 85 - else 86 - simple_map_init(&info->map); 87 - 88 - probe_type = rom_probe_types; 89 - for (; !info->mtd && *probe_type; probe_type++) 90 - info->mtd = do_map_probe(*probe_type, &info->map); 91 - if (!info->mtd) { 92 - dev_err(&dev->dev, "map_probe failed\n"); 93 - err = -ENXIO; 94 - goto err_out; 95 - } 96 - info->mtd->dev.parent = &dev->dev; 97 - err = mtd_device_register(info->mtd, pdata->parts, pdata->nr_parts); 98 - 99 - if (err) 100 - goto err_out; 101 - return 0; 102 - 103 - err_out: 104 - rbtx4939_flash_remove(dev); 105 - return err; 106 - } 107 - 108 - #ifdef CONFIG_PM 109 - static void rbtx4939_flash_shutdown(struct platform_device *dev) 110 - { 111 - struct rbtx4939_flash_info *info = platform_get_drvdata(dev); 112 - 113 - if (mtd_suspend(info->mtd) == 0) 114 - mtd_resume(info->mtd); 115 - } 116 - #else 117 - #define rbtx4939_flash_shutdown NULL 118 - #endif 119 - 120 - static struct platform_driver rbtx4939_flash_driver = { 121 - .probe = rbtx4939_flash_probe, 122 - .remove = rbtx4939_flash_remove, 123 - .shutdown = rbtx4939_flash_shutdown, 124 - .driver = { 125 - .name = "rbtx4939-flash", 126 - }, 127 - }; 128 - 129 - module_platform_driver(rbtx4939_flash_driver); 130 - 131 - MODULE_LICENSE("GPL"); 132 - MODULE_DESCRIPTION("RBTX4939 MTD map driver"); 133 - MODULE_ALIAS("platform:rbtx4939-flash");
+1 -1
drivers/mtd/nand/raw/Kconfig
··· 309 309 310 310 config MTD_NAND_TXX9NDFMC 311 311 tristate "TXx9 NAND controller" 312 - depends on SOC_TX4938 || SOC_TX4939 || COMPILE_TEST 312 + depends on SOC_TX4938 || COMPILE_TEST 313 313 depends on HAS_IOMEM 314 314 help 315 315 This enables the NAND flash controller on the TXx9 SoCs.
+1 -1
drivers/pci/controller/Kconfig
··· 274 274 BMIPS_GENERIC || COMPILE_TEST 275 275 depends on OF 276 276 depends on PCI_MSI_IRQ_DOMAIN 277 - default ARCH_BRCMSTB 277 + default ARCH_BRCMSTB || BMIPS_GENERIC 278 278 help 279 279 Say Y here to enable PCIe host controller support for 280 280 Broadcom STB based SoCs, like the Raspberry Pi 4.
+78 -4
drivers/pci/controller/pcie-brcmstb.c
··· 118 118 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204 119 119 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK 0x2 120 120 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000 121 + #define PCIE_BMIPS_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x00800000 121 122 122 123 123 124 #define PCIE_INTR2_CPU_BASE 0x4300 ··· 206 205 207 206 enum pcie_type { 208 207 GENERIC, 208 + BCM7425, 209 + BCM7435, 209 210 BCM4908, 210 211 BCM7278, 211 212 BCM2711, ··· 226 223 [EXT_CFG_DATA] = 0x9004, 227 224 }; 228 225 226 + static const int pcie_offsets_bmips_7425[] = { 227 + [RGR1_SW_INIT_1] = 0x8010, 228 + [EXT_CFG_INDEX] = 0x8300, 229 + [EXT_CFG_DATA] = 0x8304, 230 + }; 231 + 229 232 static const struct pcie_cfg_data generic_cfg = { 230 233 .offsets = pcie_offsets, 231 234 .type = GENERIC, 235 + .perst_set = brcm_pcie_perst_set_generic, 236 + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, 237 + }; 238 + 239 + static const struct pcie_cfg_data bcm7425_cfg = { 240 + .offsets = pcie_offsets_bmips_7425, 241 + .type = BCM7425, 242 + .perst_set = brcm_pcie_perst_set_generic, 243 + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, 244 + }; 245 + 246 + static const struct pcie_cfg_data bcm7435_cfg = { 247 + .offsets = pcie_offsets, 248 + .type = BCM7435, 232 249 .perst_set = brcm_pcie_perst_set_generic, 233 250 .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, 234 251 }; ··· 319 296 void (*perst_set)(struct brcm_pcie *pcie, u32 val); 320 297 void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); 321 298 }; 299 + 300 + static inline bool is_bmips(const struct brcm_pcie *pcie) 301 + { 302 + return pcie->type == BCM7435 || pcie->type == BCM7425; 303 + } 322 304 323 305 /* 324 306 * This is to convert the size of the inbound "BAR" region to the ··· 470 442 u32p_replace_bits(&tmp, limit_addr_mb, 471 443 PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_LIMIT_MASK); 472 444 writel(tmp, pcie->base + PCIE_MEM_WIN0_BASE_LIMIT(win)); 445 + 446 + if (is_bmips(pcie)) 447 + return; 473 448 474 449 /* Write the cpu & limit addr upper bits */ 475 450 high_addr_shift = ··· 749 718 return base + PCIE_EXT_CFG_DATA + where; 750 719 } 751 720 721 + static void __iomem *brcm_pcie_map_conf32(struct pci_bus *bus, unsigned int devfn, 722 + int where) 723 + { 724 + struct brcm_pcie *pcie = bus->sysdata; 725 + void __iomem *base = pcie->base; 726 + int idx; 727 + 728 + /* Accesses to the RC go right to the RC registers if slot==0 */ 729 + if (pci_is_root_bus(bus)) 730 + return PCI_SLOT(devfn) ? NULL : base + (where & ~0x3); 731 + 732 + /* For devices, write to the config space index register */ 733 + idx = PCIE_ECAM_OFFSET(bus->number, devfn, (where & ~3)); 734 + writel(idx, base + IDX_ADDR(pcie)); 735 + return base + DATA_ADDR(pcie); 736 + } 737 + 752 738 static struct pci_ops brcm_pcie_ops = { 753 739 .map_bus = brcm_pcie_map_conf, 754 740 .read = pci_generic_config_read, 755 741 .write = pci_generic_config_write, 742 + }; 743 + 744 + static struct pci_ops brcm_pcie_ops32 = { 745 + .map_bus = brcm_pcie_map_conf32, 746 + .read = pci_generic_config_read32, 747 + .write = pci_generic_config_write32, 756 748 }; 757 749 758 750 static inline void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val) ··· 937 883 pcie->bridge_sw_init_set(pcie, 0); 938 884 939 885 tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); 940 - tmp &= ~PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK; 886 + if (is_bmips(pcie)) 887 + tmp &= ~PCIE_BMIPS_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK; 888 + else 889 + tmp &= ~PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK; 941 890 writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); 942 891 /* Wait for SerDes to be stable */ 943 892 usleep_range(100, 200); ··· 950 893 * is encoded as 0=128, 1=256, 2=512, 3=Rsvd, for BCM7278 it 951 894 * is encoded as 0=Rsvd, 1=128, 2=256, 3=512. 952 895 */ 953 - if (pcie->type == BCM2711) 954 - burst = 0x0; /* 128B */ 896 + if (is_bmips(pcie)) 897 + burst = 0x1; /* 256 bytes */ 898 + else if (pcie->type == BCM2711) 899 + burst = 0x0; /* 128 bytes */ 955 900 else if (pcie->type == BCM7278) 956 901 burst = 0x3; /* 512 bytes */ 957 902 else ··· 1047 988 return -EINVAL; 1048 989 } 1049 990 991 + if (is_bmips(pcie)) { 992 + u64 start = res->start; 993 + unsigned int j, nwins = resource_size(res) / SZ_128M; 994 + 995 + /* bmips PCIe outbound windows have a 128MB max size */ 996 + if (nwins > BRCM_NUM_PCIE_OUT_WINS) 997 + nwins = BRCM_NUM_PCIE_OUT_WINS; 998 + for (j = 0; j < nwins; j++, start += SZ_128M) 999 + brcm_pcie_set_outbound_win(pcie, j, start, 1000 + start - entry->offset, 1001 + SZ_128M); 1002 + break; 1003 + } 1050 1004 brcm_pcie_set_outbound_win(pcie, num_out_wins, res->start, 1051 1005 res->start - entry->offset, 1052 1006 resource_size(res)); ··· 1298 1226 { .compatible = "brcm,bcm7278-pcie", .data = &bcm7278_cfg }, 1299 1227 { .compatible = "brcm,bcm7216-pcie", .data = &bcm7278_cfg }, 1300 1228 { .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg }, 1229 + { .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg }, 1230 + { .compatible = "brcm,bcm7425-pcie", .data = &bcm7425_cfg }, 1301 1231 {}, 1302 1232 }; 1303 1233 ··· 1389 1315 } 1390 1316 } 1391 1317 1392 - bridge->ops = &brcm_pcie_ops; 1318 + bridge->ops = pcie->type == BCM7425 ? &brcm_pcie_ops32 : &brcm_pcie_ops; 1393 1319 bridge->sysdata = pcie; 1394 1320 1395 1321 platform_set_drvdata(pdev, pcie);
+6
drivers/platform/mips/Kconfig
··· 30 30 help 31 31 Loongson RS780E PCH ACPI Controller driver. 32 32 33 + config LS2K_RESET 34 + bool "Loongson-2K1000 Reset Controller" 35 + depends on MACH_LOONGSON64 || COMPILE_TEST 36 + help 37 + Loongson-2K1000 Reset Controller driver. 38 + 33 39 endif # MIPS_PLATFORM_DEVICES
+1
drivers/platform/mips/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 obj-$(CONFIG_CPU_HWMON) += cpu_hwmon.o 3 3 obj-$(CONFIG_RS780E_ACPI) += rs780e-acpi.o 4 + obj-$(CONFIG_LS2K_RESET) += ls2k-reset.o
+53
drivers/platform/mips/ls2k-reset.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (C) 2021, Qing Zhang <zhangqing@loongson.cn> 4 + * Loongson-2K1000 reset support 5 + */ 6 + 7 + #include <linux/of_address.h> 8 + #include <linux/pm.h> 9 + #include <asm/reboot.h> 10 + 11 + #define PM1_STS 0x0c /* Power Management 1 Status Register */ 12 + #define PM1_CNT 0x14 /* Power Management 1 Control Register */ 13 + #define RST_CNT 0x30 /* Reset Control Register */ 14 + 15 + static void __iomem *base; 16 + 17 + static void ls2k_restart(char *command) 18 + { 19 + writel(0x1, base + RST_CNT); 20 + } 21 + 22 + static void ls2k_poweroff(void) 23 + { 24 + /* Clear */ 25 + writel((readl(base + PM1_STS) & 0xffffffff), base + PM1_STS); 26 + /* Sleep Enable | Soft Off*/ 27 + writel(GENMASK(12, 10) | BIT(13), base + PM1_CNT); 28 + } 29 + 30 + static int ls2k_reset_init(void) 31 + { 32 + struct device_node *np; 33 + 34 + np = of_find_compatible_node(NULL, NULL, "loongson,ls2k-pm"); 35 + if (!np) { 36 + pr_info("Failed to get PM node\n"); 37 + return -ENODEV; 38 + } 39 + 40 + base = of_iomap(np, 0); 41 + of_node_put(np); 42 + if (!base) { 43 + pr_info("Failed to map PM register base address\n"); 44 + return -ENOMEM; 45 + } 46 + 47 + _machine_restart = ls2k_restart; 48 + pm_power_off = ls2k_poweroff; 49 + 50 + return 0; 51 + } 52 + 53 + arch_initcall(ls2k_reset_init);