aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm63xx
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:08:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:08:04 -0400
commitde390bba797aa9a554bc1769b6a8771605854d79 (patch)
treece95610d4a70ec0a7307a30cfd1a66fdf0c901ab /arch/mips/bcm63xx
parent50e0d10232db05c6776afcf6098459bff47e8b15 (diff)
parent382fc33b4a04e2dde89b4c69a6880e0c7d9761e2 (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS update from Ralf Baechle: "This is the MIPS update for 3.7. A fair chunk of them are platform updates to the Cavium Octeon SOC (which involves machine generated header files of considerable size), Atheros ATH79xx, RMI aka Netlogic aka Broadcom XLP, Broadcom BCM63xx platforms. Support for the commercial MIPS simulator MIPSsim has been removed as MIPS Technologies is shifting away from this product and Qemu is offering various more powerful platforms. The generic MIPS code can now also probe for no-execute / write-only TLB features implemented without the full SmartMIPS extension as permitted by the latest MIPS processor architecture. Lots of small changes to generic code." * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (78 commits) MIPS: ath79: Fix CPU/DDR frequency calculation for SRIF PLLs MIPS: ath79: use correct fractional dividers for {CPU,DDR}_PLL on AR934x MIPS: BCM63XX: Properly handle mac address octet overflow MIPS: Kconfig: Avoid build errors by hiding USE_OF from the user. MIPS: Replace `-' in defconfig filename wth `_' for consistency. MIPS: Wire kcmp syscall. MIPS: MIPSsim: Remove the MIPSsim platform. MIPS: NOTIFY_RESUME is not needed in TIF masks MIPS: Merge the identical "return from syscall" per-ABI code MIPS: Unobfuscate _TIF..._MASK MIPS: Prevent hitting do_notify_resume() with !user_mode(regs). MIPS: Replace 'kernel_uses_smartmips_rixi' with 'cpu_has_rixi'. MIPS: Add base architecture support for RI and XI. MIPS: Optimise TLB handlers for MIPS32/64 R2 cores. MIPS: uasm: Add INS and EXT instructions. MIPS: Avoid pipeline stalls on some MIPS32R2 cores. MIPS: Make VPE count to be one-based. MIPS: Add new end of interrupt functionality for GIC. MIPS: Add EIC support for GIC. MIPS: Code clean-ups for the GIC. ...
Diffstat (limited to 'arch/mips/bcm63xx')
-rw-r--r--arch/mips/bcm63xx/Makefile2
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c26
-rw-r--r--arch/mips/bcm63xx/clk.c21
-rw-r--r--arch/mips/bcm63xx/dev-usb-usbd.c65
-rw-r--r--arch/mips/bcm63xx/irq.c22
-rw-r--r--arch/mips/bcm63xx/setup.c6
6 files changed, 128 insertions, 14 deletions
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index 833af72c852a..9bbb30a9dc20 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,6 +1,6 @@
1obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ 1obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
2 dev-dsp.o dev-enet.o dev-flash.o dev-pcmcia.o dev-rng.o \ 2 dev-dsp.o dev-enet.o dev-flash.o dev-pcmcia.o dev-rng.o \
3 dev-spi.o dev-uart.o dev-wdt.o 3 dev-spi.o dev-uart.o dev-wdt.o dev-usb-usbd.o
4obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 4obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
5 5
6obj-y += boards/ 6obj-y += boards/
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index dd18e4b761a8..1cd4d73f23c7 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -24,6 +24,7 @@
24#include <bcm63xx_dev_flash.h> 24#include <bcm63xx_dev_flash.h>
25#include <bcm63xx_dev_pcmcia.h> 25#include <bcm63xx_dev_pcmcia.h>
26#include <bcm63xx_dev_spi.h> 26#include <bcm63xx_dev_spi.h>
27#include <bcm63xx_dev_usb_usbd.h>
27#include <board_bcm963xx.h> 28#include <board_bcm963xx.h>
28 29
29#define PFX "board_bcm963xx: " 30#define PFX "board_bcm963xx: "
@@ -42,6 +43,12 @@ static struct board_info __initdata board_96328avng = {
42 43
43 .has_uart0 = 1, 44 .has_uart0 = 1,
44 .has_pci = 1, 45 .has_pci = 1,
46 .has_usbd = 0,
47
48 .usbd = {
49 .use_fullspeed = 0,
50 .port_no = 0,
51 },
45 52
46 .leds = { 53 .leds = {
47 { 54 {
@@ -713,7 +720,7 @@ const char *board_get_name(void)
713 */ 720 */
714static int board_get_mac_address(u8 *mac) 721static int board_get_mac_address(u8 *mac)
715{ 722{
716 u8 *p; 723 u8 *oui;
717 int count; 724 int count;
718 725
719 if (mac_addr_used >= nvram.mac_addr_count) { 726 if (mac_addr_used >= nvram.mac_addr_count) {
@@ -722,21 +729,23 @@ static int board_get_mac_address(u8 *mac)
722 } 729 }
723 730
724 memcpy(mac, nvram.mac_addr_base, ETH_ALEN); 731 memcpy(mac, nvram.mac_addr_base, ETH_ALEN);
725 p = mac + ETH_ALEN - 1; 732 oui = mac + ETH_ALEN/2 - 1;
726 count = mac_addr_used; 733 count = mac_addr_used;
727 734
728 while (count--) { 735 while (count--) {
736 u8 *p = mac + ETH_ALEN - 1;
737
729 do { 738 do {
730 (*p)++; 739 (*p)++;
731 if (*p != 0) 740 if (*p != 0)
732 break; 741 break;
733 p--; 742 p--;
734 } while (p != mac); 743 } while (p != oui);
735 }
736 744
737 if (p == mac) { 745 if (p == oui) {
738 printk(KERN_ERR PFX "unable to fetch mac address\n"); 746 printk(KERN_ERR PFX "unable to fetch mac address\n");
739 return -ENODEV; 747 return -ENODEV;
748 }
740 } 749 }
741 750
742 mac_addr_used++; 751 mac_addr_used++;
@@ -888,6 +897,9 @@ int __init board_register_devices(void)
888 !board_get_mac_address(board.enet1.mac_addr)) 897 !board_get_mac_address(board.enet1.mac_addr))
889 bcm63xx_enet_register(1, &board.enet1); 898 bcm63xx_enet_register(1, &board.enet1);
890 899
900 if (board.has_usbd)
901 bcm63xx_usbd_register(&board.usbd);
902
891 if (board.has_dsp) 903 if (board.has_dsp)
892 bcm63xx_dsp_register(&board.dsp); 904 bcm63xx_dsp_register(&board.dsp);
893 905
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index 1db48adb543a..dff79ab6005e 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -160,7 +160,9 @@ static struct clk clk_pcm = {
160 */ 160 */
161static void usbh_set(struct clk *clk, int enable) 161static void usbh_set(struct clk *clk, int enable)
162{ 162{
163 if (BCMCPU_IS_6348()) 163 if (BCMCPU_IS_6328())
164 bcm_hwclock_set(CKCTL_6328_USBH_EN, enable);
165 else if (BCMCPU_IS_6348())
164 bcm_hwclock_set(CKCTL_6348_USBH_EN, enable); 166 bcm_hwclock_set(CKCTL_6348_USBH_EN, enable);
165 else if (BCMCPU_IS_6368()) 167 else if (BCMCPU_IS_6368())
166 bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); 168 bcm_hwclock_set(CKCTL_6368_USBH_EN, enable);
@@ -171,6 +173,21 @@ static struct clk clk_usbh = {
171}; 173};
172 174
173/* 175/*
176 * USB device clock
177 */
178static void usbd_set(struct clk *clk, int enable)
179{
180 if (BCMCPU_IS_6328())
181 bcm_hwclock_set(CKCTL_6328_USBD_EN, enable);
182 else if (BCMCPU_IS_6368())
183 bcm_hwclock_set(CKCTL_6368_USBD_EN, enable);
184}
185
186static struct clk clk_usbd = {
187 .set = usbd_set,
188};
189
190/*
174 * SPI clock 191 * SPI clock
175 */ 192 */
176static void spi_set(struct clk *clk, int enable) 193static void spi_set(struct clk *clk, int enable)
@@ -284,6 +301,8 @@ struct clk *clk_get(struct device *dev, const char *id)
284 return &clk_ephy; 301 return &clk_ephy;
285 if (!strcmp(id, "usbh")) 302 if (!strcmp(id, "usbh"))
286 return &clk_usbh; 303 return &clk_usbh;
304 if (!strcmp(id, "usbd"))
305 return &clk_usbd;
287 if (!strcmp(id, "spi")) 306 if (!strcmp(id, "spi"))
288 return &clk_spi; 307 return &clk_spi;
289 if (!strcmp(id, "xtm")) 308 if (!strcmp(id, "xtm"))
diff --git a/arch/mips/bcm63xx/dev-usb-usbd.c b/arch/mips/bcm63xx/dev-usb-usbd.c
new file mode 100644
index 000000000000..508bd9d8df27
--- /dev/null
+++ b/arch/mips/bcm63xx/dev-usb-usbd.c
@@ -0,0 +1,65 @@
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) 2008 Maxime Bizon <mbizon@freebox.fr>
7 * Copyright (C) 2012 Kevin Cernekee <cernekee@gmail.com>
8 * Copyright (C) 2012 Broadcom Corporation
9 */
10
11#include <linux/init.h>
12#include <linux/kernel.h>
13#include <linux/platform_device.h>
14#include <linux/dma-mapping.h>
15#include <bcm63xx_cpu.h>
16#include <bcm63xx_dev_usb_usbd.h>
17
18#define NUM_MMIO 2
19#define NUM_IRQ 7
20
21static struct resource usbd_resources[NUM_MMIO + NUM_IRQ];
22
23static u64 usbd_dmamask = DMA_BIT_MASK(32);
24
25static struct platform_device bcm63xx_usbd_device = {
26 .name = "bcm63xx_udc",
27 .id = -1,
28 .num_resources = ARRAY_SIZE(usbd_resources),
29 .resource = usbd_resources,
30 .dev = {
31 .dma_mask = &usbd_dmamask,
32 .coherent_dma_mask = DMA_BIT_MASK(32),
33 },
34};
35
36int __init bcm63xx_usbd_register(const struct bcm63xx_usbd_platform_data *pd)
37{
38 const int irq_list[NUM_IRQ] = { IRQ_USBD,
39 IRQ_USBD_RXDMA0, IRQ_USBD_TXDMA0,
40 IRQ_USBD_RXDMA1, IRQ_USBD_TXDMA1,
41 IRQ_USBD_RXDMA2, IRQ_USBD_TXDMA2 };
42 int i;
43
44 if (!BCMCPU_IS_6328() && !BCMCPU_IS_6368())
45 return 0;
46
47 usbd_resources[0].start = bcm63xx_regset_address(RSET_USBD);
48 usbd_resources[0].end = usbd_resources[0].start + RSET_USBD_SIZE - 1;
49 usbd_resources[0].flags = IORESOURCE_MEM;
50
51 usbd_resources[1].start = bcm63xx_regset_address(RSET_USBDMA);
52 usbd_resources[1].end = usbd_resources[1].start + RSET_USBDMA_SIZE - 1;
53 usbd_resources[1].flags = IORESOURCE_MEM;
54
55 for (i = 0; i < NUM_IRQ; i++) {
56 struct resource *r = &usbd_resources[NUM_MMIO + i];
57
58 r->start = r->end = bcm63xx_get_irq_number(irq_list[i]);
59 r->flags = IORESOURCE_IRQ;
60 }
61
62 platform_device_add_data(&bcm63xx_usbd_device, pd, sizeof(*pd));
63
64 return platform_device_register(&bcm63xx_usbd_device);
65}
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c
index 18e051ad18a5..da24c2bd9b7c 100644
--- a/arch/mips/bcm63xx/irq.c
+++ b/arch/mips/bcm63xx/irq.c
@@ -56,8 +56,8 @@ static void __internal_irq_unmask_64(unsigned int irq) __maybe_unused;
56#define is_ext_irq_cascaded 0 56#define is_ext_irq_cascaded 0
57#define ext_irq_start 0 57#define ext_irq_start 0
58#define ext_irq_end 0 58#define ext_irq_end 0
59#define ext_irq_count 0 59#define ext_irq_count 4
60#define ext_irq_cfg_reg1 0 60#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6345
61#define ext_irq_cfg_reg2 0 61#define ext_irq_cfg_reg2 0
62#endif 62#endif
63#ifdef CONFIG_BCM63XX_CPU_6348 63#ifdef CONFIG_BCM63XX_CPU_6348
@@ -143,11 +143,15 @@ static void bcm63xx_init_irq(void)
143 irq_stat_addr += PERF_IRQSTAT_6338_REG; 143 irq_stat_addr += PERF_IRQSTAT_6338_REG;
144 irq_mask_addr += PERF_IRQMASK_6338_REG; 144 irq_mask_addr += PERF_IRQMASK_6338_REG;
145 irq_bits = 32; 145 irq_bits = 32;
146 ext_irq_count = 4;
147 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6338;
146 break; 148 break;
147 case BCM6345_CPU_ID: 149 case BCM6345_CPU_ID:
148 irq_stat_addr += PERF_IRQSTAT_6345_REG; 150 irq_stat_addr += PERF_IRQSTAT_6345_REG;
149 irq_mask_addr += PERF_IRQMASK_6345_REG; 151 irq_mask_addr += PERF_IRQMASK_6345_REG;
150 irq_bits = 32; 152 irq_bits = 32;
153 ext_irq_count = 4;
154 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6345;
151 break; 155 break;
152 case BCM6348_CPU_ID: 156 case BCM6348_CPU_ID:
153 irq_stat_addr += PERF_IRQSTAT_6348_REG; 157 irq_stat_addr += PERF_IRQSTAT_6348_REG;
@@ -434,7 +438,8 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
434 reg = bcm_perf_readl(regaddr); 438 reg = bcm_perf_readl(regaddr);
435 irq %= 4; 439 irq %= 4;
436 440
437 if (BCMCPU_IS_6348()) { 441 switch (bcm63xx_get_cpu_id()) {
442 case BCM6348_CPU_ID:
438 if (levelsense) 443 if (levelsense)
439 reg |= EXTIRQ_CFG_LEVELSENSE_6348(irq); 444 reg |= EXTIRQ_CFG_LEVELSENSE_6348(irq);
440 else 445 else
@@ -447,9 +452,13 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
447 reg |= EXTIRQ_CFG_BOTHEDGE_6348(irq); 452 reg |= EXTIRQ_CFG_BOTHEDGE_6348(irq);
448 else 453 else
449 reg &= ~EXTIRQ_CFG_BOTHEDGE_6348(irq); 454 reg &= ~EXTIRQ_CFG_BOTHEDGE_6348(irq);
450 } 455 break;
451 456
452 if (BCMCPU_IS_6338() || BCMCPU_IS_6358() || BCMCPU_IS_6368()) { 457 case BCM6328_CPU_ID:
458 case BCM6338_CPU_ID:
459 case BCM6345_CPU_ID:
460 case BCM6358_CPU_ID:
461 case BCM6368_CPU_ID:
453 if (levelsense) 462 if (levelsense)
454 reg |= EXTIRQ_CFG_LEVELSENSE(irq); 463 reg |= EXTIRQ_CFG_LEVELSENSE(irq);
455 else 464 else
@@ -462,6 +471,9 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
462 reg |= EXTIRQ_CFG_BOTHEDGE(irq); 471 reg |= EXTIRQ_CFG_BOTHEDGE(irq);
463 else 472 else
464 reg &= ~EXTIRQ_CFG_BOTHEDGE(irq); 473 reg &= ~EXTIRQ_CFG_BOTHEDGE(irq);
474 break;
475 default:
476 BUG();
465 } 477 }
466 478
467 bcm_perf_writel(reg, regaddr); 479 bcm_perf_writel(reg, regaddr);
diff --git a/arch/mips/bcm63xx/setup.c b/arch/mips/bcm63xx/setup.c
index 0e74a13639cd..314231be788c 100644
--- a/arch/mips/bcm63xx/setup.c
+++ b/arch/mips/bcm63xx/setup.c
@@ -74,6 +74,9 @@ void bcm63xx_machine_reboot(void)
74 case BCM6338_CPU_ID: 74 case BCM6338_CPU_ID:
75 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6338; 75 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6338;
76 break; 76 break;
77 case BCM6345_CPU_ID:
78 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6345;
79 break;
77 case BCM6348_CPU_ID: 80 case BCM6348_CPU_ID:
78 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6348; 81 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6348;
79 break; 82 break;
@@ -83,6 +86,9 @@ void bcm63xx_machine_reboot(void)
83 } 86 }
84 87
85 for (i = 0; i < 2; i++) { 88 for (i = 0; i < 2; i++) {
89 if (!perf_regs[i])
90 break;
91
86 reg = bcm_perf_readl(perf_regs[i]); 92 reg = bcm_perf_readl(perf_regs[i]);
87 if (BCMCPU_IS_6348()) { 93 if (BCMCPU_IS_6348()) {
88 reg &= ~EXTIRQ_CFG_MASK_ALL_6348; 94 reg &= ~EXTIRQ_CFG_MASK_ALL_6348;