1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * BRIEF MODULE DESCRIPTION
4 * MyCable XXS1500 board support
6 * Copyright 2003, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. <source@mvista.com>
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/interrupt.h>
13 #include <linux/platform_device.h>
14 #include <linux/gpio.h>
15 #include <linux/delay.h>
17 #include <asm/bootinfo.h>
18 #include <asm/reboot.h>
19 #include <asm/setup.h>
20 #include <asm/mach-au1x00/au1000.h>
23 const char *get_system_type(void)
28 void __init
prom_init(void)
30 unsigned char *memsize_str
;
31 unsigned long memsize
;
34 prom_argv
= (char **)fw_arg1
;
35 prom_envp
= (char **)fw_arg2
;
39 memsize_str
= prom_getenv("memsize");
40 if (!memsize_str
|| kstrtoul(memsize_str
, 0, &memsize
))
43 add_memory_region(0, memsize
, BOOT_MEM_RAM
);
46 void prom_putchar(char c
)
48 alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR
, c
);
51 static void xxs1500_reset(char *c
)
53 /* Jump to the reset vector */
54 __asm__
__volatile__("jr\t%0" : : "r"(0xbfc00000));
57 static void xxs1500_power_off(void)
66 void __init
board_setup(void)
70 pm_power_off
= xxs1500_power_off
;
71 _machine_halt
= xxs1500_power_off
;
72 _machine_restart
= xxs1500_reset
;
74 alchemy_gpio1_input_enable();
75 alchemy_gpio2_enable();
77 /* Set multiple use pins (UART3/GPIO) to UART (it's used as UART too) */
78 pin_func
= alchemy_rdsys(AU1000_SYS_PINFUNC
) & ~SYS_PF_UR3
;
79 pin_func
|= SYS_PF_UR3
;
80 alchemy_wrsys(pin_func
, AU1000_SYS_PINFUNC
);
83 alchemy_uart_enable(AU1000_UART3_PHYS_ADDR
);
84 /* Enable DTR (MCR bit 0) = USB power up */
85 __raw_writel(1, (void __iomem
*)KSEG1ADDR(AU1000_UART3_PHYS_ADDR
+ 0x18));
89 /******************************************************************************/
91 static struct resource xxs1500_pcmcia_res
[] = {
94 .flags
= IORESOURCE_MEM
,
95 .start
= AU1000_PCMCIA_IO_PHYS_ADDR
,
96 .end
= AU1000_PCMCIA_IO_PHYS_ADDR
+ 0x000400000 - 1,
99 .name
= "pcmcia-attr",
100 .flags
= IORESOURCE_MEM
,
101 .start
= AU1000_PCMCIA_ATTR_PHYS_ADDR
,
102 .end
= AU1000_PCMCIA_ATTR_PHYS_ADDR
+ 0x000400000 - 1,
105 .name
= "pcmcia-mem",
106 .flags
= IORESOURCE_MEM
,
107 .start
= AU1000_PCMCIA_MEM_PHYS_ADDR
,
108 .end
= AU1000_PCMCIA_MEM_PHYS_ADDR
+ 0x000400000 - 1,
112 static struct platform_device xxs1500_pcmcia_dev
= {
113 .name
= "xxs1500_pcmcia",
115 .num_resources
= ARRAY_SIZE(xxs1500_pcmcia_res
),
116 .resource
= xxs1500_pcmcia_res
,
119 static struct platform_device
*xxs1500_devs
[] __initdata
= {
123 static int __init
xxs1500_dev_init(void)
125 irq_set_irq_type(AU1500_GPIO204_INT
, IRQ_TYPE_LEVEL_HIGH
);
126 irq_set_irq_type(AU1500_GPIO201_INT
, IRQ_TYPE_LEVEL_LOW
);
127 irq_set_irq_type(AU1500_GPIO202_INT
, IRQ_TYPE_LEVEL_LOW
);
128 irq_set_irq_type(AU1500_GPIO203_INT
, IRQ_TYPE_LEVEL_LOW
);
129 irq_set_irq_type(AU1500_GPIO205_INT
, IRQ_TYPE_LEVEL_LOW
);
130 irq_set_irq_type(AU1500_GPIO207_INT
, IRQ_TYPE_LEVEL_LOW
);
132 irq_set_irq_type(AU1500_GPIO0_INT
, IRQ_TYPE_LEVEL_LOW
);
133 irq_set_irq_type(AU1500_GPIO1_INT
, IRQ_TYPE_LEVEL_LOW
);
134 irq_set_irq_type(AU1500_GPIO2_INT
, IRQ_TYPE_LEVEL_LOW
);
135 irq_set_irq_type(AU1500_GPIO3_INT
, IRQ_TYPE_LEVEL_LOW
);
136 irq_set_irq_type(AU1500_GPIO4_INT
, IRQ_TYPE_LEVEL_LOW
); /* CF irq */
137 irq_set_irq_type(AU1500_GPIO5_INT
, IRQ_TYPE_LEVEL_LOW
);
139 return platform_add_devices(xxs1500_devs
,
140 ARRAY_SIZE(xxs1500_devs
));
142 device_initcall(xxs1500_dev_init
);