Release 4.7 drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
  
  
/*
 *  Driver for CPM (SCC/SMC) serial ports; CPM2 definitions
 *
 *  Maintainer: Kumar Gala (galak@kernel.crashing.org) (CPM2)
 *              Pantelis Antoniou (panto@intracom.gr) (CPM1)
 *
 *  Copyright (C) 2004 Freescale Semiconductor, Inc.
 *            (C) 2004 Intracom, S.A.
 *            (C) 2006 MontaVista Software, Inc.
 *              Vitaly Bordug <vbordug@ru.mvista.com>
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
#include <linux/module.h>
#include <linux/tty.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/serial.h>
#include <linux/console.h>
#include <linux/sysrq.h>
#include <linux/device.h>
#include <linux/bootmem.h>
#include <linux/dma-mapping.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/fs_pd.h>
#include <asm/prom.h>
#include <linux/serial_core.h>
#include <linux/kernel.h>
#include "cpm_uart.h"
/**************************************************************/
void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
{
	cpm_command(port->command, cmd);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| scott wood | scott wood | 16 | 72.73% | 1 | 33.33% | 
| david woodhouse | david woodhouse | 4 | 18.18% | 1 | 33.33% | 
| jochen friedrich | jochen friedrich | 2 | 9.09% | 1 | 33.33% | 
 | Total | 22 | 100.00% | 3 | 100.00% | 
void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
				struct device_node *np)
{
	void __iomem *pram;
	unsigned long offset;
	struct resource res;
	resource_size_t len;
	/* Don't remap parameter RAM if it has already been initialized
         * during console setup.
         */
	if (IS_SMC(port) && port->smcup)
		return port->smcup;
	else if (!IS_SMC(port) && port->sccup)
		return port->sccup;
	if (of_address_to_resource(np, 1, &res))
		return NULL;
	len = resource_size(&res);
	pram = ioremap(res.start, len);
	if (!pram)
		return NULL;
	if (!IS_SMC(port))
		return pram;
	if (len != 2) {
		printk(KERN_WARNING "cpm_uart[%d]: device tree references "
			"SMC pram, using boot loader/wrapper pram mapping. "
			"Please fix your device tree to reference the pram "
			"base register instead.\n",
			port->port.line);
		return pram;
	}
	offset = cpm_dpalloc(PROFF_SMC_SIZE, 64);
	out_be16(pram, offset);
	iounmap(pram);
	return cpm_muram_addr(offset);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| laurent pinchart | laurent pinchart | 169 | 97.13% | 1 | 50.00% | 
| tobias klauser | tobias klauser | 5 | 2.87% | 1 | 50.00% | 
 | Total | 174 | 100.00% | 2 | 100.00% | 
void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram)
{
	if (!IS_SMC(port))
		iounmap(pram);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| laurent pinchart | laurent pinchart | 28 | 100.00% | 1 | 100.00% | 
 | Total | 28 | 100.00% | 1 | 100.00% | 
/*
 * Allocate DP-Ram and memory buffers. We need to allocate a transmit and
 * receive buffer descriptors from dual port ram, and a character
 * buffer area from host mem. If we are allocating for the console we need
 * to do it from bootmem
 */
int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
{
	int dpmemsz, memsz;
	u8 __iomem *dp_mem;
	unsigned long dp_offset;
	u8 *mem_addr;
	dma_addr_t dma_addr = 0;
	pr_debug("CPM uart[%d]:allocbuf\n", pinfo->port.line);
	dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos);
	dp_offset = cpm_dpalloc(dpmemsz, 8);
	if (IS_ERR_VALUE(dp_offset)) {
		printk(KERN_ERR
		       "cpm_uart_cpm.c: could not allocate buffer descriptors\n");
		return -ENOMEM;
	}
	dp_mem = cpm_dpram_addr(dp_offset);
	memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) +
	    L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize);
	if (is_con) {
		mem_addr = kzalloc(memsz, GFP_NOWAIT);
		dma_addr = virt_to_bus(mem_addr);
	}
	else
		mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr,
					      GFP_KERNEL);
	if (mem_addr == NULL) {
		cpm_dpfree(dp_offset);
		printk(KERN_ERR
		       "cpm_uart_cpm.c: could not allocate coherent memory\n");
		return -ENOMEM;
	}
	pinfo->dp_addr = dp_offset;
	pinfo->mem_addr = mem_addr;
	pinfo->dma_addr = dma_addr;
	pinfo->mem_size = memsz;
	pinfo->rx_buf = mem_addr;
	pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos
						       * pinfo->rx_fifosize);
	pinfo->rx_bd_base = (cbd_t __iomem *)dp_mem;
	pinfo->tx_bd_base = pinfo->rx_bd_base + pinfo->rx_nrfifos;
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| kumar gala | kumar gala | 169 | 64.26% | 1 | 16.67% | 
| david woodhouse | david woodhouse | 66 | 25.10% | 1 | 16.67% | 
| vitaly bordug | vitaly bordug | 14 | 5.32% | 1 | 16.67% | 
| scott wood | scott wood | 6 | 2.28% | 1 | 16.67% | 
| becky bruce | becky bruce | 5 | 1.90% | 1 | 16.67% | 
| mark ware | mark ware | 3 | 1.14% | 1 | 16.67% | 
 | Total | 263 | 100.00% | 6 | 100.00% | 
void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
{
	dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos *
							  pinfo->rx_fifosize) +
			  L1_CACHE_ALIGN(pinfo->tx_nrfifos *
					 pinfo->tx_fifosize), (void __force *)pinfo->mem_addr,
			  pinfo->dma_addr);
	cpm_dpfree(pinfo->dp_addr);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| david woodhouse | david woodhouse | 27 | 44.26% | 1 | 25.00% | 
| kumar gala | kumar gala | 24 | 39.34% | 1 | 25.00% | 
| vitaly bordug | vitaly bordug | 5 | 8.20% | 1 | 25.00% | 
| becky bruce | becky bruce | 5 | 8.20% | 1 | 25.00% | 
 | Total | 61 | 100.00% | 4 | 100.00% | 
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| laurent pinchart | laurent pinchart | 200 | 33.22% | 1 | 8.33% | 
| kumar gala | kumar gala | 194 | 32.23% | 1 | 8.33% | 
| david woodhouse | david woodhouse | 140 | 23.26% | 1 | 8.33% | 
| scott wood | scott wood | 22 | 3.65% | 1 | 8.33% | 
| vitaly bordug | vitaly bordug | 22 | 3.65% | 2 | 16.67% | 
| becky bruce | becky bruce | 10 | 1.66% | 1 | 8.33% | 
| tobias klauser | tobias klauser | 5 | 0.83% | 1 | 8.33% | 
| tejun heo | tejun heo | 3 | 0.50% | 1 | 8.33% | 
| mark ware | mark ware | 3 | 0.50% | 1 | 8.33% | 
| jochen friedrich | jochen friedrich | 2 | 0.33% | 1 | 8.33% | 
| jovi zhang | jovi zhang | 1 | 0.17% | 1 | 8.33% | 
 | Total | 602 | 100.00% | 12 | 100.00% | 
  
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.