1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-sa1100/hackkit.c
5 * Copyright (C) 2002 Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>
7 * This file contains all HackKit tweaks. Based on original work from
8 * Nicolas Pitre's assabet fixes
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/sched.h>
13 #include <linux/tty.h>
14 #include <linux/module.h>
15 #include <linux/errno.h>
16 #include <linux/cpufreq.h>
17 #include <linux/platform_data/sa11x0-serial.h>
18 #include <linux/serial_core.h>
19 #include <linux/mtd/mtd.h>
20 #include <linux/mtd/partitions.h>
21 #include <linux/tty.h>
22 #include <linux/gpio.h>
23 #include <linux/leds.h>
24 #include <linux/platform_device.h>
25 #include <linux/pgtable.h>
27 #include <asm/mach-types.h>
28 #include <asm/setup.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/flash.h>
33 #include <asm/mach/map.h>
34 #include <asm/mach/irq.h>
36 #include <mach/hardware.h>
37 #include <mach/irqs.h>
41 /**********************************************************************
46 static void __init
hackkit_map_io(void);
48 static void hackkit_uart_pm(struct uart_port
*port
, u_int state
, u_int oldstate
);
50 /**********************************************************************
54 /**********************************************************************
58 static struct map_desc hackkit_io_desc
[] __initdata
= {
60 .virtual = 0xe8000000,
61 .pfn
= __phys_to_pfn(0x00000000),
67 static struct sa1100_port_fns hackkit_port_fns __initdata
= {
68 .pm
= hackkit_uart_pm
,
71 /**********************************************************************
75 static void __init
hackkit_map_io(void)
78 iotable_init(hackkit_io_desc
, ARRAY_SIZE(hackkit_io_desc
));
80 sa1100_register_uart_fns(&hackkit_port_fns
);
81 sa1100_register_uart(0, 1); /* com port */
82 sa1100_register_uart(1, 2);
83 sa1100_register_uart(2, 3); /* radio module */
85 Ser1SDCR0
|= SDCR0_SUS
;
89 * hackkit_uart_pm - powermgmt callback function for system 3 UART
90 * @port: uart port structure
92 * @oldstate: old pm state
95 static void hackkit_uart_pm(struct uart_port
*port
, u_int state
, u_int oldstate
)
97 /* TODO: switch on/off uart in powersave mode */
100 static struct mtd_partition hackkit_partitions
[] = {
104 .offset
= 0x00000000,
105 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
109 .offset
= MTDPART_OFS_APPEND
,
113 .offset
= MTDPART_OFS_APPEND
,
117 .offset
= MTDPART_OFS_APPEND
,
121 .offset
= MTDPART_OFS_APPEND
,
124 .size
= MTDPART_SIZ_FULL
,
125 .offset
= MTDPART_OFS_APPEND
,
129 static struct flash_platform_data hackkit_flash_data
= {
130 .map_name
= "cfi_probe",
131 .parts
= hackkit_partitions
,
132 .nr_parts
= ARRAY_SIZE(hackkit_partitions
),
135 static struct resource hackkit_flash_resource
=
136 DEFINE_RES_MEM(SA1100_CS0_PHYS
, SZ_32M
);
139 struct gpio_led hackkit_gpio_leds
[] = {
141 .name
= "hackkit:red",
142 .default_trigger
= "cpu0",
146 .name
= "hackkit:green",
147 .default_trigger
= "heartbeat",
152 static struct gpio_led_platform_data hackkit_gpio_led_info
= {
153 .leds
= hackkit_gpio_leds
,
154 .num_leds
= ARRAY_SIZE(hackkit_gpio_leds
),
157 static struct platform_device hackkit_leds
= {
161 .platform_data
= &hackkit_gpio_led_info
,
165 static void __init
hackkit_init(void)
167 sa11x0_register_mtd(&hackkit_flash_data
, &hackkit_flash_resource
, 1);
168 platform_device_register(&hackkit_leds
);
171 /**********************************************************************
175 MACHINE_START(HACKKIT
, "HackKit Cpu Board")
176 .atag_offset
= 0x100,
177 .map_io
= hackkit_map_io
,
178 .nr_irqs
= SA1100_NR_IRQS
,
179 .init_irq
= sa1100_init_irq
,
180 .init_time
= sa1100_timer_init
,
181 .init_machine
= hackkit_init
,
182 .init_late
= sa11x0_init_late
,
183 .restart
= sa11x0_restart
,