aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty/serial/8250/8250_men_mcb.c
AgeCommit message (Collapse)AuthorFilesLines
2023-08-048250_men_mcb: remove unnecessary cast when reading registerGravatar Sanjuán García, Jorge 1-1/+1
Fixes following sparse warning: drivers/tty/serial/8250/8250_men_mcb.c:92:21: sparse: cast removes address space '__iomem' of expression drivers/tty/serial/8250/8250_men_mcb.c:92:21: sparse: incorrect type in argument 1 (different address spaces) expected void const volatile [noderef] __iomem *addr got void * Fixes: 2554e6ba28a2 ("8250_men_mcb: Read num ports from register data.") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202307261517.x1O9OAkd-lkp@intel.com/ Signed-off-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com> Link: https://lore.kernel.org/r/20230803095816.110864-1-jorge.sanjuangarcia@duagon.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-048250_men_mcb: Remove redundant initialization owner in mcb_driverGravatar Li Zetao 1-1/+0
The module_mcb_driver() will set "THIS_MODULE" to driver.owner when register a mcb_driver driver, so it is redundant initialization to set driver.owner in mcb_driver statement. Remove it for clean code. Signed-off-by: Li Zetao <lizetao1@huawei.com> Link: https://lore.kernel.org/r/20230804100843.100348-1-lizetao1@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-048250_men_mcb: Fix unsigned expression compared with zeroGravatar Li Zetao 1-1/+1
There is a warning reported by coccinelle: ./drivers/tty/serial/8250/8250_men_mcb.c:226:6-19: WARNING: Unsigned expression compared with zero: data -> line [ i ] < 0 The array "line" of serial_8250_men_mcb_data is used to record the registered serial port. When register a port failed, it will return an error code, but the type of "line" is "unsigned int", causing the error code to reverse. Modify the type of "data -> line" to solve this problem. Fixes: 2554e6ba28a2 ("8250_men_mcb: Read num ports from register data.") Signed-off-by: Li Zetao <lizetao1@huawei.com> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230803142053.1308926-1-lizetao1@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-048250_men_mcb: Fix unsigned comparison with less than zeroGravatar Jiapeng Chong 1-3/+5
The data->line[i] is defined as unsigned int type, if(data->line[i] < 0) is invalid, so replace data->line[i] with res. ./drivers/tty/serial/8250/8250_men_mcb.c:223:6-19: WARNING: Unsigned expression compared with zero: data->line[i] < 0. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6088 Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230803084753.51253-1-jiapeng.chong@linux.alibaba.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-308250_men_mcb: fix error handling in read_uarts_available_from_reg()Gravatar Yang Yingliang 1-1/+4
If ioremap() fails, it returns NULL pointer, not ERR_PTR(), fix the return value check and call release_mem_region() to release resource. Fixes: c563831ba879 ("8250_men_mcb: Make UART config auto configurable") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230728085723.3195044-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-258250_men_mcb: Make UART config auto configurableGravatar Rodríguez Barbarin, José Javier 1-19/+24
The UART ports created by this driver were not usable out of the box, so let the configuration be handled by the 8250 UART subsystem. This makes the implementation simpler and the UART port more usable. The 8250 UART subsystem will take care of requesting the memory resources, but the driver needs to first read the register where the num ports is set, so a request of the resource is needed before registering the UART port. Co-developed-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com> Signed-off-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com> Signed-off-by: Javier Rodriguez <josejavier.rodriguez@duagon.com> Link: https://lore.kernel.org/r/20230705131423.30552-4-josejavier.rodriguez@duagon.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-258250_men_mcb: Read num ports from register data.Gravatar Rodríguez Barbarin, José Javier 1-50/+139
The IP Core Z025 and Z057 have a register where the amount of UART ports is specified. Such register is located at offset 0x40. This patch fixes the way the UART ports is calculated by reading the actual register. Additionally a refactor was needed to achieve this so we can keep track of the UART line and its offset which also improves the remove callback. Co-developed-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com> Signed-off-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com> Signed-off-by: Javier Rodriguez <josejavier.rodriguez@duagon.com> Link: https://lore.kernel.org/r/20230705131423.30552-3-josejavier.rodriguez@duagon.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-258250_men_mcb: Add clockrate speed for G215/F215 boardsGravatar Rodríguez Barbarin, José Javier 1-2/+2
Some F215 FPGA multifunction boards announce themselves as 215. This leads to a misconfigured clockrate. The F215 is the same board as G215 but with different cPCI interface so make them get the same configuration Co-developed-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com> Signed-off-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com> Signed-off-by: Javier Rodriguez <josejavier.rodriguez@duagon.com> Link: https://lore.kernel.org/r/20230705131423.30552-2-josejavier.rodriguez@duagon.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-01serial: 8250_men_mcb: Remove duplicate UAPI:serial_core inclusionGravatar Andy Shevchenko 1-1/+0
The UAPI serial_core.h is guaranteed to be included by in-kernel one (with the same name). Individual drivers do not need to include it explicitly. Remove it from the driver. Note, it's a single driver in the entire kernel that does this. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220830152313.14650-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-278250-men-mcb: fix signed/unsigned confusionGravatar Pavel Machek 1-2/+2
get_num_ports returns -ENODEV, and the result is stored in int, so it should not be unsigned. Zero ports does not seem to make sense, so make that check consistent. Signed-off-by: Pavel Machek (CIP) <pavel@denx.de> Link: https://lore.kernel.org/r/20200606151146.GA10940@amd Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-03drivers: mcb: use symbol namespacesGravatar Johannes Thumshirn 1-0/+1
Now that we have symbol namespaces, use them in MCB to not pollute the default namespace with MCB internals. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Jessica Yu <jeyu@kernel.org> Reviewed-by: Michael Moese <mmoese@suse.de> Link: https://lore.kernel.org/r/20191016100158.1400-1-jthumshirn@suse.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-158250-men-mcb: fix error checking when get_num_ports returns -ENODEVGravatar Colin Ian King 1-4/+4
The current checking for failure on the number of ports fails when -ENODEV is returned from the call to get_num_ports. Fix this by making num_ports and loop counter i signed rather than unsigned ints. Also add check for num_ports being less than zero to check for -ve error returns. Addresses-Coverity: ("Unsigned compared against 0") Fixes: e2fea54e4592 ("8250-men-mcb: add support for 16z025 and 16z057") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Michael Moese <mmoese@suse.de> Link: https://lore.kernel.org/r/20191013220016.9369-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-04tty: fix up a few remaining files without SPDX identifiersGravatar Greg Kroah-Hartman 1-0/+1
There were a few straggling files under drivers/tty/ that did not have any SPDX identifier either because they entered the tree recently, or they somehow missed the mass-tagging of commit b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license") This commit follows the same rule as b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license") where files without any specified license in them fall under GPL-2.0 as the correct license for the individual file. Add that identifier to these remaining files so that we don't have to guess at the license of them in the future. Cc: Jiri Slaby <jslaby@suse.com> Cc: "David S. Miller" <davem@davemloft.net> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-158250-men-mcb: add support for 16z025 and 16z057Gravatar Michael Moese 1-34/+91
Add support for two MEN UARTs (16z025 and 16z057) to the 8250_men_mcb driver. The 16z025 consists of up to four ports, the 16z057 has exactly four ports. Apart from that, all of them share the Port settings. Signed-off-by: Michael Moese <mmoese@suse.de> Reported-by: Ben Turner <ben.turner@21net.com> Tested-by: Ben Turner <ben.turner@21net.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28Introduce 8250_men_mcbGravatar Michael Moese 1-0/+118
This patch introduces the 8250_men_mcb driver for the MEN 16Z125 IP-Core. This is a 16550-type UART with a 60 byte FIFO. Due to strange old hardware, every board using this IP core requires different values for uartclk. A reasonable default is included in addition to the support of three boards. Additional values for other boards will be added later. This v2 has some whitespace fixes, I screwed this up yesterday. Signed-off-by: Michael Moese <michael.moese@men.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>