Initial commit; kernel source import

This commit is contained in:
Nathan
2025-04-06 23:50:55 -05:00
commit 25c6d769f4
45093 changed files with 18199410 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
#
# Makefile for the linux kernel.
#
# Object file lists.
obj-y := core.o dma.o irq.o pci.o leds.o
obj-m :=
obj-n :=
obj- :=

View File

@@ -0,0 +1,2 @@
zreladdr-y += 0x08008000

145
arch/arm/mach-shark/core.c Normal file
View File

@@ -0,0 +1,145 @@
/*
* linux/arch/arm/mach-shark/arch.c
*
* Architecture specific stuff.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/sched.h>
#include <linux/serial_8250.h>
#include <linux/io.h>
#include <linux/cpu.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/param.h>
#include <asm/system_misc.h>
#include <asm/mach/map.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
#define ROMCARD_SIZE 0x08000000
#define ROMCARD_START 0x10000000
static void shark_restart(char mode, const char *cmd)
{
short temp;
/* Reset the Machine via pc[3] of the sequoia chipset */
outw(0x09,0x24);
temp=inw(0x26);
temp = temp | (1<<3) | (1<<10);
outw(0x09,0x24);
outw(temp,0x26);
}
static struct plat_serial8250_port serial_platform_data[] = {
{
.iobase = 0x3f8,
.irq = 4,
.uartclk = 1843200,
.regshift = 0,
.iotype = UPIO_PORT,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
},
{
.iobase = 0x2f8,
.irq = 3,
.uartclk = 1843200,
.regshift = 0,
.iotype = UPIO_PORT,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
},
{ },
};
static struct platform_device serial_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = serial_platform_data,
},
};
static struct resource rtc_resources[] = {
[0] = {
.start = 0x70,
.end = 0x73,
.flags = IORESOURCE_IO,
},
[1] = {
.start = IRQ_ISA_RTC_ALARM,
.end = IRQ_ISA_RTC_ALARM,
.flags = IORESOURCE_IRQ,
}
};
static struct platform_device rtc_device = {
.name = "rtc_cmos",
.id = -1,
.resource = rtc_resources,
.num_resources = ARRAY_SIZE(rtc_resources),
};
static int __init shark_init(void)
{
int ret;
if (machine_is_shark())
{
ret = platform_device_register(&rtc_device);
if (ret) printk(KERN_ERR "Unable to register RTC device: %d\n", ret);
ret = platform_device_register(&serial_device);
if (ret) printk(KERN_ERR "Unable to register Serial device: %d\n", ret);
}
return 0;
}
arch_initcall(shark_init);
extern void shark_init_irq(void);
#define IRQ_TIMER 0
#define HZ_TIME ((1193180 + HZ/2) / HZ)
static irqreturn_t
shark_timer_interrupt(int irq, void *dev_id)
{
timer_tick();
return IRQ_HANDLED;
}
static struct irqaction shark_timer_irq = {
.name = "Shark Timer Tick",
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
.handler = shark_timer_interrupt,
};
/*
* Set up timer interrupt, and return the current time in seconds.
*/
static void __init shark_timer_init(void)
{
outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */
outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
outb(HZ_TIME >> 8, 0x40);
setup_irq(IRQ_TIMER, &shark_timer_irq);
}
static void shark_init_early(void)
{
cpu_idle_poll_ctrl(true);
}
MACHINE_START(SHARK, "Shark")
/* Maintainer: Alexander Schulz */
.atag_offset = 0x3000,
.init_early = shark_init_early,
.init_irq = shark_init_irq,
.init_time = shark_timer_init,
.dma_zone_size = SZ_4M,
.restart = shark_restart,
MACHINE_END

23
arch/arm/mach-shark/dma.c Normal file
View File

@@ -0,0 +1,23 @@
/*
* linux/arch/arm/mach-shark/dma.c
*
* by Alexander Schulz
*
* derived from:
* arch/arm/kernel/dma-ebsa285.c
* Copyright (C) 1998 Phil Blundell
*/
#include <linux/init.h>
#include <asm/dma.h>
#include <asm/mach/dma.h>
static int __init shark_dma_init(void)
{
#ifdef CONFIG_ISA_DMA
isa_init_dma();
#endif
return 0;
}
core_initcall(shark_dma_init);

View File

@@ -0,0 +1,34 @@
/* arch/arm/mach-shark/include/mach/debug-macro.S
*
* Debugging macro include header
*
* Copyright (C) 1994-1999 Russell King
* Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
.macro addruart, rp, rv, tmp
mov \rp, #0x3f8
orr \rv, \rp, #0xfe000000
orr \rv, \rv, #0x00e00000
orr \rp, \rp, #0x40000000
.endm
.macro senduart,rd,rx
strb \rd, [\rx]
.endm
.macro waituart,rd,rx
.endm
.macro busyuart,rd,rx
mov \rd, #0
1001: add \rd, \rd, #1
teq \rd, #0x10000
bne 1001b
.endm

View File

@@ -0,0 +1,36 @@
/*
* arch/arm/mach-shark/include/mach/entry-macro.S
*
* Low-level IRQ helper macros for Shark platform
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
.macro get_irqnr_preamble, base, tmp
mov \base, #0xfe000000
orr \base, \base, #0x00e00000
.endm
.macro get_irqnr_and_base, irqnr, irqstat, base, tmp
mov \irqstat, #0x0C
strb \irqstat, [\base, #0x20] @outb(0x0C, 0x20) /* Poll command */
ldrb \irqnr, [\base, #0x20] @irq = inb(0x20) & 7
and \irqstat, \irqnr, #0x80
teq \irqstat, #0
beq 43f
and \irqnr, \irqnr, #7
teq \irqnr, #2
bne 44f
43: mov \irqstat, #0x0C
strb \irqstat, [\base, #0xa0] @outb(0x0C, 0xA0) /* Poll command */
ldrb \irqnr, [\base, #0xa0] @irq = (inb(0xA0) & 7) + 8
and \irqstat, \irqnr, #0x80
teq \irqstat, #0
beq 44f
and \irqnr, \irqnr, #7
add \irqnr, \irqnr, #8
44: teq \irqstat, #0
.endm

View File

@@ -0,0 +1,16 @@
/*
* arch/arm/mach-shark/include/mach/framebuffer.h
*
* by Alexander Schulz
*
*/
#ifndef __ASM_ARCH_FRAMEBUFFER_H
#define __ASM_ARCH_FRAMEBUFFER_H
/* defines for the Framebuffer */
#define FB_START 0x06000000
#define FB_SIZE 0x01000000
#endif

View File

@@ -0,0 +1,16 @@
/*
* arch/arm/mach-shark/include/mach/hardware.h
*
* by Alexander Schulz
*
* derived from:
* arch/arm/mach-ebsa110/include/mach/hardware.h
* Copyright (C) 1996-1999 Russell King.
*/
#ifndef __ASM_ARCH_HARDWARE_H
#define __ASM_ARCH_HARDWARE_H
#define UNCACHEABLE_ADDR 0xdf010000
#endif

View File

@@ -0,0 +1,13 @@
/*
* arch/arm/mach-shark/include/mach/irqs.h
*
* by Alexander Schulz
*/
#define NR_IRQS 16
#define IRQ_ISA_KEYBOARD 1
#define IRQ_ISA_RTC_ALARM 8
#define I8042_KBD_IRQ 1
#define I8042_AUX_IRQ 12
#define IRQ_HARDDISK 14

View File

@@ -0,0 +1,13 @@
/*
* arch/arm/mach-shark/include/mach/isa-dma.h
*
* by Alexander Schulz
*/
#ifndef __ASM_ARCH_DMA_H
#define __ASM_ARCH_DMA_H
#define MAX_DMA_CHANNELS 8
#define DMA_ISA_CASCADE 4
#endif /* _ASM_ARCH_DMA_H */

View File

@@ -0,0 +1,26 @@
/*
* arch/arm/mach-shark/include/mach/memory.h
*
* by Alexander Schulz
*
* derived from:
* arch/arm/mach-ebsa110/include/mach/memory.h
* Copyright (c) 1996-1999 Russell King.
*/
#ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H
#include <asm/sizes.h>
/*
* Physical DRAM offset.
*/
#define PLAT_PHYS_OFFSET UL(0x08000000)
/*
* Cache flushing area
*/
#define FLUSH_BASE_PHYS 0x80000000
#define FLUSH_BASE 0xdf000000
#endif

View File

@@ -0,0 +1,7 @@
/*
* arch/arm/mach-shark/include/mach/timex.h
*
* by Alexander Schulz
*/
#define CLOCK_TICK_RATE 1193180

View File

@@ -0,0 +1,50 @@
/*
* arch/arm/mach-shark/include/mach/uncompress.h
* by Alexander Schulz
*
* derived from:
* arch/arm/mach-footbridge/include/mach/uncompress.h
* Copyright (C) 1996,1997,1998 Russell King
*/
#define SERIAL_BASE ((volatile unsigned char *)0x400003f8)
static inline void putc(int c)
{
volatile int t;
SERIAL_BASE[0] = c;
t=0x10000;
while (t--);
}
static inline void flush(void)
{
}
#ifdef DEBUG
static void putn(unsigned long z)
{
int i;
char x;
putc('0');
putc('x');
for (i=0;i<8;i++) {
x='0'+((z>>((7-i)*4))&0xf);
if (x>'9') x=x-'0'+'A'-10;
putc(x);
}
}
static void putr()
{
putc('\n');
putc('\r');
}
#endif
/*
* nothing to do
*/
#define arch_decomp_setup()

108
arch/arm/mach-shark/irq.c Normal file
View File

@@ -0,0 +1,108 @@
/*
* linux/arch/arm/mach-shark/irq.c
*
* by Alexander Schulz
*
* derived from linux/arch/ppc/kernel/i8259.c and:
* arch/arm/mach-ebsa110/include/mach/irq.h
* Copyright (C) 1996-1998 Russell King
*/
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <asm/irq.h>
#include <asm/mach/irq.h>
/*
* 8259A PIC functions to handle ISA devices:
*/
/*
* This contains the irq mask for both 8259A irq controllers,
* Let through the cascade-interrupt no. 2 (ff-(1<<2)==fb)
*/
static unsigned char cached_irq_mask[2] = { 0xfb, 0xff };
/*
* These have to be protected by the irq controller spinlock
* before being called.
*/
static void shark_disable_8259A_irq(struct irq_data *d)
{
unsigned int mask;
if (d->irq<8) {
mask = 1 << d->irq;
cached_irq_mask[0] |= mask;
outb(cached_irq_mask[1],0xA1);
} else {
mask = 1 << (d->irq-8);
cached_irq_mask[1] |= mask;
outb(cached_irq_mask[0],0x21);
}
}
static void shark_enable_8259A_irq(struct irq_data *d)
{
unsigned int mask;
if (d->irq<8) {
mask = ~(1 << d->irq);
cached_irq_mask[0] &= mask;
outb(cached_irq_mask[0],0x21);
} else {
mask = ~(1 << (d->irq-8));
cached_irq_mask[1] &= mask;
outb(cached_irq_mask[1],0xA1);
}
}
static void shark_ack_8259A_irq(struct irq_data *d){}
static irqreturn_t bogus_int(int irq, void *dev_id)
{
printk("Got interrupt %i!\n",irq);
return IRQ_NONE;
}
static struct irqaction cascade;
static struct irq_chip fb_chip = {
.name = "XT-PIC",
.irq_ack = shark_ack_8259A_irq,
.irq_mask = shark_disable_8259A_irq,
.irq_unmask = shark_enable_8259A_irq,
};
void __init shark_init_irq(void)
{
int irq;
for (irq = 0; irq < NR_IRQS; irq++) {
irq_set_chip_and_handler(irq, &fb_chip, handle_edge_irq);
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
}
/* init master interrupt controller */
outb(0x11, 0x20); /* Start init sequence, edge triggered (level: 0x19)*/
outb(0x00, 0x21); /* Vector base */
outb(0x04, 0x21); /* Cascade (slave) on IRQ2 */
outb(0x03, 0x21); /* Select 8086 mode , auto eoi*/
outb(0x0A, 0x20);
/* init slave interrupt controller */
outb(0x11, 0xA0); /* Start init sequence, edge triggered */
outb(0x08, 0xA1); /* Vector base */
outb(0x02, 0xA1); /* Cascade (slave) on IRQ2 */
outb(0x03, 0xA1); /* Select 8086 mode, auto eoi */
outb(0x0A, 0xA0);
outb(cached_irq_mask[1],0xA1);
outb(cached_irq_mask[0],0x21);
//request_region(0x20,0x2,"pic1");
//request_region(0xA0,0x2,"pic2");
cascade.handler = bogus_int;
cascade.name = "cascade";
setup_irq(2,&cascade);
}

117
arch/arm/mach-shark/leds.c Normal file
View File

@@ -0,0 +1,117 @@
/*
* DIGITAL Shark LED control routines.
*
* Driver for the 3 user LEDs found on the Shark
* Based on Versatile and RealView machine LED code
*
* License terms: GNU General Public License (GPL) version 2
* Author: Bryan Wu <bryan.wu@canonical.com>
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/leds.h>
#include <asm/mach-types.h>
#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
struct shark_led {
struct led_classdev cdev;
u8 mask;
};
/*
* The triggers lines up below will only be used if the
* LED triggers are compiled in.
*/
static const struct {
const char *name;
const char *trigger;
} shark_leds[] = {
{ "shark:amber0", "default-on", }, /* Bit 5 */
{ "shark:green", "heartbeat", }, /* Bit 6 */
{ "shark:amber1", "cpu0" }, /* Bit 7 */
};
static u16 led_reg_read(void)
{
outw(0x09, 0x24);
return inw(0x26);
}
static void led_reg_write(u16 value)
{
outw(0x09, 0x24);
outw(value, 0x26);
}
static void shark_led_set(struct led_classdev *cdev,
enum led_brightness b)
{
struct shark_led *led = container_of(cdev,
struct shark_led, cdev);
u16 reg = led_reg_read();
if (b != LED_OFF)
reg |= led->mask;
else
reg &= ~led->mask;
led_reg_write(reg);
}
static enum led_brightness shark_led_get(struct led_classdev *cdev)
{
struct shark_led *led = container_of(cdev,
struct shark_led, cdev);
u16 reg = led_reg_read();
return (reg & led->mask) ? LED_FULL : LED_OFF;
}
static int __init shark_leds_init(void)
{
int i;
u16 reg;
if (!machine_is_shark())
return -ENODEV;
for (i = 0; i < ARRAY_SIZE(shark_leds); i++) {
struct shark_led *led;
led = kzalloc(sizeof(*led), GFP_KERNEL);
if (!led)
break;
led->cdev.name = shark_leds[i].name;
led->cdev.brightness_set = shark_led_set;
led->cdev.brightness_get = shark_led_get;
led->cdev.default_trigger = shark_leds[i].trigger;
/* Count in 5 bits offset */
led->mask = BIT(i + 5);
if (led_classdev_register(NULL, &led->cdev) < 0) {
kfree(led);
break;
}
}
/* Make LEDs independent of power-state */
request_region(0x24, 4, "led_reg");
reg = led_reg_read();
reg |= 1 << 10;
led_reg_write(reg);
return 0;
}
/*
* Since we may have triggers on any subsystem, defer registration
* until after subsystem_init.
*/
fs_initcall(shark_leds_init);
#endif

57
arch/arm/mach-shark/pci.c Normal file
View File

@@ -0,0 +1,57 @@
/*
* linux/arch/arm/mach-shark/pci.c
*
* PCI bios-type initialisation for PCI machines
*
* Bits taken from various places.
*/
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/io.h>
#include <video/vga.h>
#include <asm/irq.h>
#include <asm/mach/pci.h>
#include <asm/mach-types.h>
#define IO_START 0x40000000
static int __init shark_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{
if (dev->bus->number == 0)
if (dev->devfn == 0)
return 255;
else
return 11;
else
return 255;
}
extern void __init via82c505_preinit(void);
static struct hw_pci shark_pci __initdata = {
.setup = via82c505_setup,
.map_irq = shark_map_irq,
.nr_controllers = 1,
.ops = &via82c505_ops,
.preinit = via82c505_preinit,
};
static int __init shark_pci_init(void)
{
if (!machine_is_shark())
return -ENODEV;
pcibios_min_io = 0x6000;
pcibios_min_mem = 0x50000000;
vga_base = 0xe8000000;
pci_ioremap_io(0, IO_START);
pci_common_init(&shark_pci);
return 0;
}
subsys_initcall(shark_pci_init);