lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6929d86-2d07-1cbb-8a45-906c02b8bbc3@denx.de>
Date:   Fri, 18 Jan 2019 07:22:00 +0100
From:   Marek Vasut <marex@...x.de>
To:     Tristram.Ha@...rochip.com,
        Sergio Paracuellos <sergio.paracuellos@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Pavel Machek <pavel@....cz>,
        Dan Carpenter <dan.carpenter@...cle.com>
Cc:     vivien.didelot@...oirfairelinux.com, UNGLinuxDriver@...rochip.com,
        netdev@...r.kernel.org
Subject: Re: [PATCH RFC v1] net: dsa: microchip: add KSZ9477 I2C driver

On 1/17/19 4:24 AM, Tristram.Ha@...rochip.com wrote:
> From: Tristram Ha <Tristram.Ha@...rochip.com>
> 
> Add KSZ9477 I2C driver support.  The code ksz9477.c and ksz_common.c are
> used together to generate the I2C driver.
> 
> Signed-off-by: Tristram Ha <Tristram.Ha@...rochip.com>
> ---
>  drivers/net/dsa/microchip/Kconfig       |   7 ++
>  drivers/net/dsa/microchip/Makefile      |   1 +
>  drivers/net/dsa/microchip/ksz9477_i2c.c | 120 ++++++++++++++++++++++++++++++++
>  3 files changed, 128 insertions(+)
>  create mode 100644 drivers/net/dsa/microchip/ksz9477_i2c.c
> 
> diff --git a/drivers/net/dsa/microchip/Kconfig b/drivers/net/dsa/microchip/Kconfig
> index 385b93f..1798755 100644
> --- a/drivers/net/dsa/microchip/Kconfig
> +++ b/drivers/net/dsa/microchip/Kconfig
> @@ -9,6 +9,13 @@ menuconfig NET_DSA_MICROCHIP_KSZ9477
>  	help
>  	  This driver adds support for Microchip KSZ9477 switch chips.
>  
> +config NET_DSA_MICROCHIP_KSZ9477_I2C
> +	tristate "KSZ9477 series I2C connected switch driver"
> +	depends on NET_DSA_MICROCHIP_KSZ9477 && I2C
> +	select REGMAP_I2C
> +	help
> +	  Select to enable support for registering switches configured through I2C.
> +
>  config NET_DSA_MICROCHIP_KSZ9477_SPI
>  	tristate "KSZ9477 series SPI connected switch driver"
>  	depends on NET_DSA_MICROCHIP_KSZ9477 && SPI
> diff --git a/drivers/net/dsa/microchip/Makefile b/drivers/net/dsa/microchip/Makefile
> index 3142c18..dbcc5db 100644
> --- a/drivers/net/dsa/microchip/Makefile
> +++ b/drivers/net/dsa/microchip/Makefile
> @@ -1,3 +1,4 @@
>  obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON)	+= ksz_common.o
>  obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ9477)		+= ksz9477.o
> +obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ9477_I2C)	+= ksz9477_i2c.o
>  obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ9477_SPI)	+= ksz9477_spi.o
> diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c
> new file mode 100644
> index 0000000..d8720ff
> --- /dev/null
> +++ b/drivers/net/dsa/microchip/ksz9477_i2c.c
> @@ -0,0 +1,120 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Microchip KSZ9477 series register access through I2C
> + *
> + * Copyright (C) 2018-2019 Microchip Technology Inc.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/i2c.h>
> +
> +#include "ksz_priv.h"
> +
> +#define REG_SIZE			0x8000
> +
> +#define I2C_REGMAP_VAL			8
> +#define I2C_REGMAP_REG			16
> +
> +#define KSZ_REGMAP_COMMON(n, width)					\
> +{									\
> +	.name			= n,					\
> +	.max_register		= REG_SIZE - (width),			\
> +	.reg_bits		= I2C_REGMAP_REG,			\
> +	.val_bits		= I2C_REGMAP_VAL * (width),		\
> +	.reg_stride		= (width),				\
> +	.reg_format_endian	= REGMAP_ENDIAN_BIG,			\
> +	.val_format_endian	= REGMAP_ENDIAN_BIG,			\
> +}
This comes from my regmap RFC series, right ? Why do we need to redefine
it here again ?

-- 
Best regards,
Marek Vasut

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ