mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
4793f2ebff
Now that the SPDX tag is in all tty files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Jiri Slaby <jslaby@suse.com> Cc: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Ray Jui <rjui@broadcom.com> Cc: Scott Branden <sbranden@broadcom.com> Cc: bcm-kernel-feedback-list@broadcom.com Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: Joachim Eastwood <manabian@gmail.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Tobias Klauser <tklauser@distanz.ch> Cc: Russell King <linux@armlinux.org.uk> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Richard Genoud <richard.genoud@gmail.com> Cc: Alexander Shiyan <shc_work@mail.ru> Cc: Baruch Siach <baruch@tkos.co.il> Cc: Pat Gefre <pfg@sgi.com> Cc: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Vladimir Zapolskiy <vz@mleia.com> Cc: Sylvain Lemieux <slemieux.tyco@gmail.com> Cc: Carlo Caione <carlo@caione.org> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Andy Gross <andy.gross@linaro.org> Cc: David Brown <david.brown@linaro.org> Cc: "Andreas Färber" <afaerber@suse.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Laxman Dewangan <ldewangan@nvidia.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Jonathan Hunter <jonathanh@nvidia.com> Cc: Barry Song <baohua@kernel.org> Cc: Patrice Chotard <patrice.chotard@st.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> Cc: Chris Metcalf <cmetcalf@mellanox.com> Cc: Peter Korsgaard <jacmet@sunsite.dk> Cc: Timur Tabi <timur@tabi.org> Cc: Tony Prisk <linux@prisktech.co.nz> Cc: Michal Simek <michal.simek@xilinx.com> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
123 lines
3.3 KiB
C
123 lines
3.3 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Driver for CPM (SCC/SMC) serial ports; CPM1 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/gfp.h>
|
|
#include <linux/ioport.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 <linux/serial_core.h>
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/of.h>
|
|
#include <linux/of_address.h>
|
|
|
|
#include "cpm_uart.h"
|
|
|
|
/**************************************************************/
|
|
|
|
void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
|
|
{
|
|
cpm_command(port->command, cmd);
|
|
}
|
|
|
|
void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
|
|
struct device_node *np)
|
|
{
|
|
return of_iomap(np, 1);
|
|
}
|
|
|
|
void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram)
|
|
{
|
|
iounmap(pram);
|
|
}
|
|
|
|
/*
|
|
* 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 *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_cpm1.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) {
|
|
/* was hostalloc but changed cause it blows away the */
|
|
/* large tlb mapping when pinning the kernel area */
|
|
mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8));
|
|
dma_addr = (u32)cpm_dpram_phys(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_cpm1.c: could not allocate coherent memory\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
pinfo->dp_addr = dp_offset;
|
|
pinfo->mem_addr = mem_addr; /* virtual address*/
|
|
pinfo->dma_addr = dma_addr; /* physical address*/
|
|
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 __force *)dp_mem;
|
|
pinfo->tx_bd_base = pinfo->rx_bd_base + pinfo->rx_nrfifos;
|
|
|
|
return 0;
|
|
}
|
|
|
|
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), pinfo->mem_addr,
|
|
pinfo->dma_addr);
|
|
|
|
cpm_dpfree(pinfo->dp_addr);
|
|
}
|