cregit-Linux how code gets into the kernel

Release 4.16 drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c

// SPDX-License-Identifier: GPL-2.0+
/*
 *  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>
 */

#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

PersonTokensPropCommitsCommitProp
Scott Wood1672.73%133.33%
David Woodhouse418.18%133.33%
Jochen Friedrich29.09%133.33%
Total22100.00%3100.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

PersonTokensPropCommitsCommitProp
Laurent Pinchart16997.13%150.00%
Tobias Klauser52.87%150.00%
Total174100.00%2100.00%


void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram) { if (!IS_SMC(port)) iounmap(pram); }

Contributors

PersonTokensPropCommitsCommitProp
Laurent Pinchart28100.00%1100.00%
Total28100.00%1100.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

PersonTokensPropCommitsCommitProp
Kumar Gala17265.40%116.67%
David Woodhouse6524.71%116.67%
Vitaly Bordug124.56%116.67%
Scott Wood62.28%116.67%
Becky Bruce51.90%116.67%
Mark Ware31.14%116.67%
Total263100.00%6100.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

PersonTokensPropCommitsCommitProp
David Woodhouse2642.62%125.00%
Kumar Gala2337.70%125.00%
Vitaly Bordug711.48%125.00%
Becky Bruce58.20%125.00%
Total61100.00%4100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Laurent Pinchart20033.17%17.69%
Kumar Gala19632.50%17.69%
David Woodhouse13822.89%17.69%
Vitaly Bordug223.65%215.38%
Scott Wood223.65%17.69%
Becky Bruce101.66%17.69%
Tobias Klauser50.83%17.69%
Mark Ware30.50%17.69%
Tejun Heo30.50%17.69%
Jochen Friedrich20.33%17.69%
Greg Kroah-Hartman20.33%215.38%
Total603100.00%13100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.