aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/alchemy
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/alchemy')
-rw-r--r--arch/mips/alchemy/board-mtx1.c4
-rw-r--r--arch/mips/alchemy/common/platform.c10
-rw-r--r--arch/mips/alchemy/devboards/Makefile2
-rw-r--r--arch/mips/alchemy/devboards/bcsr.c5
-rw-r--r--arch/mips/alchemy/devboards/pb1100.c4
-rw-r--r--arch/mips/alchemy/devboards/pb1500.c4
-rw-r--r--arch/mips/alchemy/devboards/platform.c30
-rw-r--r--arch/mips/alchemy/devboards/prom.c69
8 files changed, 42 insertions, 86 deletions
diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c
index 295f1a95f745..99969484c475 100644
--- a/arch/mips/alchemy/board-mtx1.c
+++ b/arch/mips/alchemy/board-mtx1.c
@@ -81,10 +81,10 @@ static void mtx1_power_off(void)
81 81
82void __init board_setup(void) 82void __init board_setup(void)
83{ 83{
84#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 84#if IS_ENABLED(CONFIG_USB_OHCI_HCD)
85 /* Enable USB power switch */ 85 /* Enable USB power switch */
86 alchemy_gpio_direction_output(204, 0); 86 alchemy_gpio_direction_output(204, 0);
87#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 87#endif /* IS_ENABLED(CONFIG_USB_OHCI_HCD) */
88 88
89 /* Initialize sys_pinfunc */ 89 /* Initialize sys_pinfunc */
90 au_writel(SYS_PF_NI2, SYS_PINFUNC); 90 au_writel(SYS_PF_NI2, SYS_PINFUNC);
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index 95cb9113b12c..c0f3ce6dcb56 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -334,13 +334,12 @@ static void __init alchemy_setup_macs(int ctype)
334 if (alchemy_get_macs(ctype) < 1) 334 if (alchemy_get_macs(ctype) < 1)
335 return; 335 return;
336 336
337 macres = kmalloc(sizeof(struct resource) * MAC_RES_COUNT, GFP_KERNEL); 337 macres = kmemdup(au1xxx_eth0_resources[ctype],
338 sizeof(struct resource) * MAC_RES_COUNT, GFP_KERNEL);
338 if (!macres) { 339 if (!macres) {
339 printk(KERN_INFO "Alchemy: no memory for MAC0 resources\n"); 340 printk(KERN_INFO "Alchemy: no memory for MAC0 resources\n");
340 return; 341 return;
341 } 342 }
342 memcpy(macres, au1xxx_eth0_resources[ctype],
343 sizeof(struct resource) * MAC_RES_COUNT);
344 au1xxx_eth0_device.resource = macres; 343 au1xxx_eth0_device.resource = macres;
345 344
346 i = prom_get_ethernet_addr(ethaddr); 345 i = prom_get_ethernet_addr(ethaddr);
@@ -356,13 +355,12 @@ static void __init alchemy_setup_macs(int ctype)
356 if (alchemy_get_macs(ctype) < 2) 355 if (alchemy_get_macs(ctype) < 2)
357 return; 356 return;
358 357
359 macres = kmalloc(sizeof(struct resource) * MAC_RES_COUNT, GFP_KERNEL); 358 macres = kmemdup(au1xxx_eth1_resources[ctype],
359 sizeof(struct resource) * MAC_RES_COUNT, GFP_KERNEL);
360 if (!macres) { 360 if (!macres) {
361 printk(KERN_INFO "Alchemy: no memory for MAC1 resources\n"); 361 printk(KERN_INFO "Alchemy: no memory for MAC1 resources\n");
362 return; 362 return;
363 } 363 }
364 memcpy(macres, au1xxx_eth1_resources[ctype],
365 sizeof(struct resource) * MAC_RES_COUNT);
366 au1xxx_eth1_device.resource = macres; 364 au1xxx_eth1_device.resource = macres;
367 365
368 ethaddr[5] += 1; /* next addr for 2nd MAC */ 366 ethaddr[5] += 1; /* next addr for 2nd MAC */
diff --git a/arch/mips/alchemy/devboards/Makefile b/arch/mips/alchemy/devboards/Makefile
index 3c37fb303364..c9e747dd9fc2 100644
--- a/arch/mips/alchemy/devboards/Makefile
+++ b/arch/mips/alchemy/devboards/Makefile
@@ -2,7 +2,7 @@
2# Alchemy Develboards 2# Alchemy Develboards
3# 3#
4 4
5obj-y += prom.o bcsr.o platform.o 5obj-y += bcsr.o platform.o
6obj-$(CONFIG_PM) += pm.o 6obj-$(CONFIG_PM) += pm.o
7obj-$(CONFIG_MIPS_PB1100) += pb1100.o 7obj-$(CONFIG_MIPS_PB1100) += pb1100.o
8obj-$(CONFIG_MIPS_PB1500) += pb1500.o 8obj-$(CONFIG_MIPS_PB1500) += pb1500.o
diff --git a/arch/mips/alchemy/devboards/bcsr.c b/arch/mips/alchemy/devboards/bcsr.c
index 1e83ce2e1147..f2039ef2c293 100644
--- a/arch/mips/alchemy/devboards/bcsr.c
+++ b/arch/mips/alchemy/devboards/bcsr.c
@@ -90,10 +90,7 @@ static void bcsr_csc_handler(unsigned int irq, struct irq_desc *d)
90 unsigned short bisr = __raw_readw(bcsr_virt + BCSR_REG_INTSTAT); 90 unsigned short bisr = __raw_readw(bcsr_virt + BCSR_REG_INTSTAT);
91 91
92 disable_irq_nosync(irq); 92 disable_irq_nosync(irq);
93 93 generic_handle_irq(bcsr_csc_base + __ffs(bisr));
94 for ( ; bisr; bisr &= bisr - 1)
95 generic_handle_irq(bcsr_csc_base + __ffs(bisr));
96
97 enable_irq(irq); 94 enable_irq(irq);
98} 95}
99 96
diff --git a/arch/mips/alchemy/devboards/pb1100.c b/arch/mips/alchemy/devboards/pb1100.c
index cff50d05ddd4..78c77a44a317 100644
--- a/arch/mips/alchemy/devboards/pb1100.c
+++ b/arch/mips/alchemy/devboards/pb1100.c
@@ -46,7 +46,7 @@ void __init board_setup(void)
46 alchemy_gpio1_input_enable(); 46 alchemy_gpio1_input_enable();
47 udelay(100); 47 udelay(100);
48 48
49#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 49#if IS_ENABLED(CONFIG_USB_OHCI_HCD)
50 { 50 {
51 u32 pin_func, sys_freqctrl, sys_clksrc; 51 u32 pin_func, sys_freqctrl, sys_clksrc;
52 52
@@ -93,7 +93,7 @@ void __init board_setup(void)
93 pin_func |= SYS_PF_USB; 93 pin_func |= SYS_PF_USB;
94 au_writel(pin_func, SYS_PINFUNC); 94 au_writel(pin_func, SYS_PINFUNC);
95 } 95 }
96#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 96#endif /* IS_ENABLED(CONFIG_USB_OHCI_HCD) */
97 97
98 /* Enable sys bus clock divider when IDLE state or no bus activity. */ 98 /* Enable sys bus clock divider when IDLE state or no bus activity. */
99 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL); 99 au_writel(au_readl(SYS_POWERCTRL) | (0x3 << 5), SYS_POWERCTRL);
diff --git a/arch/mips/alchemy/devboards/pb1500.c b/arch/mips/alchemy/devboards/pb1500.c
index e7b807b3ec51..232fee942000 100644
--- a/arch/mips/alchemy/devboards/pb1500.c
+++ b/arch/mips/alchemy/devboards/pb1500.c
@@ -53,7 +53,7 @@ void __init board_setup(void)
53 alchemy_gpio_direction_input(201); 53 alchemy_gpio_direction_input(201);
54 alchemy_gpio_direction_input(203); 54 alchemy_gpio_direction_input(203);
55 55
56#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 56#if IS_ENABLED(CONFIG_USB_OHCI_HCD)
57 57
58 /* Zero and disable FREQ2 */ 58 /* Zero and disable FREQ2 */
59 sys_freqctrl = au_readl(SYS_FREQCTRL0); 59 sys_freqctrl = au_readl(SYS_FREQCTRL0);
@@ -87,7 +87,7 @@ void __init board_setup(void)
87 /* 2nd USB port is USB host */ 87 /* 2nd USB port is USB host */
88 pin_func |= SYS_PF_USB; 88 pin_func |= SYS_PF_USB;
89 au_writel(pin_func, SYS_PINFUNC); 89 au_writel(pin_func, SYS_PINFUNC);
90#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 90#endif /* IS_ENABLED(CONFIG_USB_OHCI_HCD) */
91 91
92#ifdef CONFIG_PCI 92#ifdef CONFIG_PCI
93 { 93 {
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c
index 621f70afb63a..f39042e99d0d 100644
--- a/arch/mips/alchemy/devboards/platform.c
+++ b/arch/mips/alchemy/devboards/platform.c
@@ -10,9 +10,39 @@
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/pm.h> 11#include <linux/pm.h>
12 12
13#include <asm/bootinfo.h>
13#include <asm/reboot.h> 14#include <asm/reboot.h>
15#include <asm/mach-au1x00/au1000.h>
14#include <asm/mach-db1x00/bcsr.h> 16#include <asm/mach-db1x00/bcsr.h>
15 17
18#include <prom.h>
19
20void __init prom_init(void)
21{
22 unsigned char *memsize_str;
23 unsigned long memsize;
24
25 prom_argc = (int)fw_arg0;
26 prom_argv = (char **)fw_arg1;
27 prom_envp = (char **)fw_arg2;
28
29 prom_init_cmdline();
30 memsize_str = prom_getenv("memsize");
31 if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
32 memsize = 64 << 20; /* all devboards have at least 64MB RAM */
33
34 add_memory_region(0, memsize, BOOT_MEM_RAM);
35}
36
37void prom_putchar(unsigned char c)
38{
39#ifdef CONFIG_MIPS_DB1300
40 alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c);
41#else
42 alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
43#endif
44}
45
16 46
17static struct platform_device db1x00_rtc_dev = { 47static struct platform_device db1x00_rtc_dev = {
18 .name = "rtc-au1xxx", 48 .name = "rtc-au1xxx",
diff --git a/arch/mips/alchemy/devboards/prom.c b/arch/mips/alchemy/devboards/prom.c
deleted file mode 100644
index 93a22107cc41..000000000000
--- a/arch/mips/alchemy/devboards/prom.c
+++ /dev/null
@@ -1,69 +0,0 @@
1/*
2 * Common code used by all Alchemy develboards.
3 *
4 * Extracted from files which had this to say:
5 *
6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30#include <linux/init.h>
31#include <linux/kernel.h>
32#include <asm/bootinfo.h>
33#include <asm/mach-au1x00/au1000.h>
34#include <prom.h>
35
36#if defined(CONFIG_MIPS_DB1000) || \
37 defined(CONFIG_MIPS_PB1100) || \
38 defined(CONFIG_MIPS_PB1500)
39#define ALCHEMY_BOARD_DEFAULT_MEMSIZE 0x04000000
40
41#else /* Au1550/Au1200-based develboards */
42#define ALCHEMY_BOARD_DEFAULT_MEMSIZE 0x08000000
43#endif
44
45void __init prom_init(void)
46{
47 unsigned char *memsize_str;
48 unsigned long memsize;
49
50 prom_argc = (int)fw_arg0;
51 prom_argv = (char **)fw_arg1;
52 prom_envp = (char **)fw_arg2;
53
54 prom_init_cmdline();
55 memsize_str = prom_getenv("memsize");
56 if (!memsize_str || strict_strtoul(memsize_str, 0, &memsize))
57 memsize = ALCHEMY_BOARD_DEFAULT_MEMSIZE;
58
59 add_memory_region(0, memsize, BOOT_MEM_RAM);
60}
61
62void prom_putchar(unsigned char c)
63{
64#ifdef CONFIG_MIPS_DB1300
65 alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c);
66#else
67 alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
68#endif
69}