Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06cf5583 authored by Thomas Bogendoerfer's avatar Thomas Bogendoerfer Committed by Ralf Baechle
Browse files

[MIPS] SNI RM updates



- use RTC_CLASS instead of GEN_RTC
- get rid of ds1216 in favour of a RTC_CLASS driver
- use correct console device for older RM400
- use physical addresses for 82596 device
- use 128 byte L1 cache line size (this is needed because most of the
  SNI caches are using 128 L2 cache lines)

Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 68bc00e3
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -918,8 +918,8 @@ config BOOT_ELF32


config MIPS_L1_CACHE_SHIFT
config MIPS_L1_CACHE_SHIFT
	int
	int
	default "4" if MACH_DECSTATION || SNI_RM
	default "4" if MACH_DECSTATION
	default "7" if SGI_IP27
	default "7" if SGI_IP27 || SNI_RM
	default "4" if PMC_MSP4200_EVAL
	default "4" if PMC_MSP4200_EVAL
	default "5"
	default "5"


+1 −1
Original line number Original line Diff line number Diff line
@@ -2,5 +2,5 @@
# Makefile for the SNI specific part of the kernel
# Makefile for the SNI specific part of the kernel
#
#


obj-y += irq.o reset.o setup.o ds1216.o a20r.o rm200.o pcimt.o pcit.o time.o
obj-y += irq.o reset.o setup.o a20r.o rm200.o pcimt.o pcit.o time.o
obj-$(CONFIG_CPU_BIG_ENDIAN) += sniprom.o
obj-$(CONFIG_CPU_BIG_ENDIAN) += sniprom.o
+22 −9
Original line number Original line Diff line number Diff line
@@ -15,7 +15,6 @@


#include <asm/sni.h>
#include <asm/sni.h>
#include <asm/time.h>
#include <asm/time.h>
#include <asm/ds1216.h>


#define PORT(_base,_irq)				\
#define PORT(_base,_irq)				\
	{						\
	{						\
@@ -40,20 +39,34 @@ static struct platform_device a20r_serial8250_device = {
	},
	},
};
};


static struct resource a20r_ds1216_rsrc[] = {
        {
                .start = 0x1c081ffc,
                .end   = 0x1c081fff,
                .flags = IORESOURCE_MEM
        }
};

static struct platform_device a20r_ds1216_device = {
        .name           = "rtc-ds1216",
        .num_resources  = ARRAY_SIZE(a20r_ds1216_rsrc),
        .resource       = a20r_ds1216_rsrc
};

static struct resource snirm_82596_rsrc[] = {
static struct resource snirm_82596_rsrc[] = {
	{
	{
		.start = 0xb8000000,
		.start = 0x18000000,
		.end   = 0xb8000004,
		.end   = 0x18000004,
		.flags = IORESOURCE_MEM
		.flags = IORESOURCE_MEM
	},
	},
	{
	{
		.start = 0xb8010000,
		.start = 0x18010000,
		.end   = 0xb8010004,
		.end   = 0x18010004,
		.flags = IORESOURCE_MEM
		.flags = IORESOURCE_MEM
	},
	},
	{
	{
		.start = 0xbff00000,
		.start = 0x1ff00000,
		.end   = 0xbff00020,
		.end   = 0x1ff00020,
		.flags = IORESOURCE_MEM
		.flags = IORESOURCE_MEM
	},
	},
	{
	{
@@ -205,8 +218,7 @@ void __init sni_a20r_irq_init(void)


void sni_a20r_init(void)
void sni_a20r_init(void)
{
{
	ds1216_base = (volatile unsigned char *) SNI_DS1216_A20R_BASE;
	/* FIXME, remove if not needed */
	rtc_mips_get_time = ds1216_get_cmos_time;
}
}


static int __init snirm_a20r_setup_devinit(void)
static int __init snirm_a20r_setup_devinit(void)
@@ -218,6 +230,7 @@ static int __init snirm_a20r_setup_devinit(void)
	        platform_device_register(&snirm_53c710_pdev);
	        platform_device_register(&snirm_53c710_pdev);
	        platform_device_register(&sc26xx_pdev);
	        platform_device_register(&sc26xx_pdev);
	        platform_device_register(&a20r_serial8250_device);
	        platform_device_register(&a20r_serial8250_device);
	        platform_device_register(&a20r_ds1216_device);
	        break;
	        break;
	}
	}


arch/mips/sni/ds1216.c

deleted100644 → 0
+0 −81
Original line number Original line Diff line number Diff line

#include <linux/bcd.h>
#include <linux/time.h>

#include <asm/ds1216.h>

volatile unsigned char *ds1216_base;

/*
 * Read the 64 bit we'd like to have - It a series
 * of 64 bits showing up in the LSB of the base register.
 *
 */
static unsigned char *ds1216_read(void)
{
	static unsigned char	rdbuf[8];
	unsigned char		c;
	int			i, j;

	for (i = 0; i < 8; i++) {
		c = 0x0;
		for (j = 0; j < 8; j++) {
			c |= (*ds1216_base & 0x1) << j;
		}
		rdbuf[i] = c;
	}

	return rdbuf;
}

static void ds1216_switch_ds_to_clock(void)
{
	unsigned char magic[] = {
		0xc5, 0x3a, 0xa3, 0x5c, 0xc5, 0x3a, 0xa3, 0x5c
	};
	int i,j,c;

	/* Reset magic pointer */
	c = *ds1216_base;

	/* Write 64 bit magic to DS1216 */
	for (i = 0; i < 8; i++) {
		c = magic[i];
		for (j = 0; j < 8; j++) {
			*ds1216_base = c;
			c = c >> 1;
		}
	}
}

unsigned long ds1216_get_cmos_time(void)
{
	unsigned char	*rdbuf;
	unsigned int	year, month, date, hour, min, sec;

	ds1216_switch_ds_to_clock();
	rdbuf = ds1216_read();

	sec = BCD2BIN(DS1216_SEC(rdbuf));
	min = BCD2BIN(DS1216_MIN(rdbuf));
	hour = BCD2BIN(DS1216_HOUR(rdbuf));
	date = BCD2BIN(DS1216_DATE(rdbuf));
	month = BCD2BIN(DS1216_MONTH(rdbuf));
	year = BCD2BIN(DS1216_YEAR(rdbuf));

	if (DS1216_1224(rdbuf) && DS1216_AMPM(rdbuf))
		hour+=12;

	if (year < 70)
		year += 2000;
	else
		year += 1900;

	return mktime(year, month, date, hour, min, sec);
}

int ds1216_set_rtc_mmss(unsigned long nowtime)
{
	printk("ds1216_set_rtc_mmss called but not implemented\n");
	return -1;
}
+22 −4
Original line number Original line Diff line number Diff line
@@ -14,7 +14,6 @@
#include <linux/pci.h>
#include <linux/pci.h>
#include <linux/serial_8250.h>
#include <linux/serial_8250.h>


#include <asm/mc146818-time.h>
#include <asm/sni.h>
#include <asm/sni.h>
#include <asm/time.h>
#include <asm/time.h>
#include <asm/i8259.h>
#include <asm/i8259.h>
@@ -90,6 +89,26 @@ static struct platform_device pcimt_serial8250_device = {
	},
	},
};
};


static struct resource pcimt_cmos_rsrc[] = {
        {
                .start = 0x70,
                .end   = 0x71,
                .flags = IORESOURCE_IO
        },
        {
                .start = 8,
                .end   = 8,
                .flags = IORESOURCE_IRQ
        }
};

static struct platform_device pcimt_cmos_device = {
        .name           = "rtc_cmos",
        .num_resources  = ARRAY_SIZE(pcimt_cmos_rsrc),
        .resource       = pcimt_cmos_rsrc
};


static struct resource sni_io_resource = {
static struct resource sni_io_resource = {
	.start	= 0x00000000UL,
	.start	= 0x00000000UL,
	.end	= 0x03bfffffUL,
	.end	= 0x03bfffffUL,
@@ -290,12 +309,10 @@ void __init sni_pcimt_irq_init(void)
	change_c0_status(ST0_IM, IE_IRQ1|IE_IRQ3);
	change_c0_status(ST0_IM, IE_IRQ1|IE_IRQ3);
}
}


void sni_pcimt_init(void)
void __init sni_pcimt_init(void)
{
{
	sni_pcimt_detect();
	sni_pcimt_detect();
	sni_pcimt_sc_init();
	sni_pcimt_sc_init();
	rtc_mips_get_time = mc146818_get_cmos_time;
	rtc_mips_set_time = mc146818_set_rtc_mmss;
	board_time_init = sni_cpu_time_init;
	board_time_init = sni_cpu_time_init;
	ioport_resource.end = sni_io_resource.end;
	ioport_resource.end = sni_io_resource.end;
#ifdef CONFIG_PCI
#ifdef CONFIG_PCI
@@ -312,6 +329,7 @@ static int __init snirm_pcimt_setup_devinit(void)
	case SNI_BRD_PCI_DESKTOP:
	case SNI_BRD_PCI_DESKTOP:
	case SNI_BRD_PCI_MTOWER_CPLUS:
	case SNI_BRD_PCI_MTOWER_CPLUS:
	        platform_device_register(&pcimt_serial8250_device);
	        platform_device_register(&pcimt_serial8250_device);
	        platform_device_register(&pcimt_cmos_device);
	        break;
	        break;
	}
	}


Loading