<commit_before>/***************************************************************************/

/*
 *	linux/arch/m68knommu/platform/532x/config.c
 *
 *	Copyright (C) 1999-2002, <NAME> (<EMAIL>)
 *	Copyright (C) 2000, Lineo (www.lineo.com)
 *	<NAME> <EMAIL>
 *	Copyright Freescale Semiconductor, Inc 2006
 *	Copyright (c) 2006, emlix, <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

/***************************************************************************/

#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/mcfuart.h>
#include <asm/mcfdma.h>
#include <asm/mcfwdebug.h>

/***************************************************************************/

void coldfire_reset(void);

extern unsigned int mcf_timervector;
extern unsigned int mcf_profilevector;
extern unsigned int mcf_timerlevel;

/***************************************************************************/

static struct mcf_platform_uart m532x_uart_platform[] = {
	{
		.mapbase	= MCF_MBAR + MCFUART_BASE1,
		.irq		= MCFINT_VECBASE + MCFINT_UART0,
	},
	{
		.mapbase 	= MCF_MBAR + MCFUART_BASE2,
		.irq		= MCFINT_VECBASE + MCFINT_UART1,
	},
	{
		.mapbase 	= MCF_MBAR + MCFUART_BASE3,
		.irq		= MCFINT_VECBASE + MCFINT_UART2,
	},
	{ },
};

static struct platform_device m532x_uart = {
	.name			= "mcfuart",
	.id			= 0,
	.dev.platform_data	= m532x_uart_platform,
};

static struct platform_device *m532x_devices[] __initdata = {
	&m532x_uart,
};

/***************************************************************************/

static void __init m532x_uart_init_line(int line, int irq)
{
	if (line == 0) {
		MCF_INTC0_ICR26 = 0x3;
		MCF_INTC0_CIMR = 26;
		/* GPIO initialization */
		MCF_GPIO_PAR_UART |= 0x000F;
	} else if (line == 1) {
		MCF_INTC0_ICR27 = 0x3;
		MCF_INTC0_CIMR = 27;
		/* GPIO initialization */
		MCF_GPIO_PAR_UART |= 0x0FF0;
	} else if (line == 2) {
		MCF_INTC0_ICR28 = 0x3;
		MCF_INTC0_CIMR = 28;
	}
}

static void __init m532x_uarts_init(void)
{
	const int nrlines = ARRAY_SIZE(m532x_uart_platform);
	int line;

	for (line = 0; (line < nrlines); line++)
		m532x_uart_init_line(line, m532x_uart_platform[line].irq);
}

/***************************************************************************/

void mcf_settimericr(unsigned int timer, unsigned int level)
{
	volatile unsigned char *icrp;
	unsigned int icr;
	unsigned char irq;

	if (timer <= 2) {
		switch (timer) {
		case 2:  irq = 33; icr = MCFSIM_ICR_TIMER2; break;
		default: irq = 32; icr = MCFSIM_ICR_TIMER1; break;
		}
		
		icrp = (volatile unsigned char *) (MCF_MBAR + icr);
		*icrp = level;
		mcf_enable_irq0(irq);
	}
}

/***************************************************************************/

void __init config_BSP(char *commandp, int size)
{
	mcf_setimr(MCFSIM_IMR_MASKALL);

#if !defined(CONFIG_BOOTPARAM)
	/* Copy command line from FLASH to local buffer... */
	memcpy(commandp, (char *) 0x4000, 4);
	if(strncmp(commandp, "kcl ", 4) == 0){
		memcpy(commandp, (char *) 0x4004, size);
		commandp[size-1] = 0;
	} else {
		memset(commandp, 0, size);
	}
#endif
<commit_msg>m68knommu: fix 5329 ColdFire periphal addressing<commit_after>/***************************************************************************/

/*
 *	linux/arch/m68knommu/platform/532x/config.c
 *
 *	Copyright (C) 1999-2002, <NAME> (<EMAIL>)
 *	Copyright (C) 2000, Lineo (www.lineo.com)
 *	<NAME> <EMAIL>
 *	Copyright Freescale Semiconductor, Inc 2006
 *	Copyright (c) 2006, emlix, <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

/***************************************************************************/

#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/mcfuart.h>
#include <asm/mcfdma.h>
#include <asm/mcfwdebug.h>

/***************************************************************************/

void coldfire_reset(void);

extern unsigned int mcf_timervector;
extern unsigned int mcf_profilevector;
extern unsigned int mcf_timerlevel;

/***************************************************************************/

static struct mcf_platform_uart m532x_uart_platform[] = {
	{
		.mapbase	= MCFUART_BASE1,
		.irq		= MCFINT_VECBASE + MCFINT_UART0,
	},
	{
		.mapbase 	= MCFUART_BASE2,
		.irq		= MCFINT_VECBASE + MCFINT_UART1,
	},
	{
		.mapbase 	= MCFUART_BASE3,
		.irq		= MCFINT_VECBASE + MCFINT_UART2,
	},
	{ },
};

static struct platform_device m532x_uart = {
	.name			= "mcfuart",
	.id			= 0,
	.dev.platform_data	= m532x_uart_platform,
};

static struct platform_device *m532x_devices[] __initdata = {
	&m532x_uart,
};

/***************************************************************************/

static void __init m532x_uart_init_line(int line, int irq)
{
	if (line == 0) {
		MCF_INTC0_ICR26 = 0x3;
		MCF_INTC0_CIMR = 26;
		/* GPIO initialization */
		MCF_GPIO_PAR_UART |= 0x000F;
	} else if (line == 1) {
		MCF_INTC0_ICR27 = 0x3;
		MCF_INTC0_CIMR = 27;
		/* GPIO initialization */
		MCF_GPIO_PAR_UART |= 0x0FF0;
	} else if (line == 2) {
		MCF_INTC0_ICR28 = 0x3;
		MCF_INTC0_CIMR = 28;
	}
}

static void __init m532x_uarts_init(void)
{
	const int nrlines = ARRAY_SIZE(m532x_uart_platform);
	int line;

	for (line = 0; (line < nrlines); line++)
		m532x_uart_init_line(line, m532x_uart_platform[line].irq);
}

/***************************************************************************/

void mcf_settimericr(unsigned int timer, unsigned int level)
{
	volatile unsigned char *icrp;
	unsigned int icr;
	unsigned char irq;

	if (timer <= 2) {
		switch (timer) {
		case 2:  irq = 33; icr = MCFSIM_ICR_TIMER2; break;
		default: irq = 32; icr = MCFSIM_ICR_TIMER1; break;
		}
		
		icrp = (volatile unsigned char *) (icr);
		*icrp = level;
		mcf_enable_irq0(irq);
	}
}

/***************************************************************************/

void __init config_BSP(char *commandp, int size)
{
	mcf_setimr(MCFSIM_IMR_MASKALL);

#if !defined(CONFIG_BOOTPARAM)
	/* Copy command line from FLASH to local buffer... */
	memcpy(commandp, (char *) 0x4000, 4);
	if(strncmp(commandp, "kcl ", 4) == 0){
		memcpy(commandp, (char *) 0x4004, size);
		commandp[size-1] = 0;
	} else {
		memset(commandp, 0, size);
	}
#endif

{'fraction_non_alphanumeric': 0.26659827055547414, 'fraction_numerical': 0.03693390004396893, 'mean_word_length': 4.882758620689655, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1770487', 'n_tokens_mistral': 2795, 'n_tokens_neox': 2449, 'n_words': 553}