Skip to content

Commit

Permalink
Merge branch 'nfc-s3fwrn5-Few-cleanups'
Browse files Browse the repository at this point in the history
Krzysztof Kozlowski says:

====================
nfc: s3fwrn5: Few cleanups

Changes since v2:
1. Fix dtschema ID after rename (patch 1/8).
2. Apply patch 9/9 (defconfig change).

Changes since v1:
1. Rename dtschema file and add additionalProperties:false, as Rob
   suggested,
2. Add Marek's tested-by,
3. New patches: #4, #5, #6, #7 and #9.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
davem330 committed Sep 10, 2020
2 parents 3fe6ab1 + 0760aad commit b55353e
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 41 deletions.
4 changes: 4 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ N: Krishna Balasubramanian
E: balasub@cis.ohio-state.edu
D: Wrote SYS V IPC (part of standard kernel since 0.99.10)

B: Robert Baldyga
E: r.baldyga@hackerion.com
D: Samsung S3FWRN5 NCI NFC Controller

N: Chris Ball
E: chris@printf.net
D: Former maintainer of the MMC/SD/SDIO subsystem.
Expand Down
25 changes: 0 additions & 25 deletions Documentation/devicetree/bindings/net/nfc/s3fwrn5.txt

This file was deleted.

73 changes: 73 additions & 0 deletions Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/nfc/samsung,s3fwrn5.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Samsung S3FWRN5 NCI NFC Controller

maintainers:
- Krzysztof Kozlowski <krzk@kernel.org>
- Krzysztof Opasiak <k.opasiak@samsung.com>

properties:
compatible:
const: samsung,s3fwrn5-i2c

en-gpios:
maxItems: 1
description:
Output GPIO pin used for enabling/disabling the chip

interrupts:
maxItems: 1

reg:
maxItems: 1

wake-gpios:
maxItems: 1
description:
Output GPIO pin used to enter firmware mode and sleep/wakeup control

s3fwrn5,en-gpios:
maxItems: 1
deprecated: true
description:
Use en-gpios

s3fwrn5,fw-gpios:
maxItems: 1
deprecated: true
description:
Use wake-gpios

additionalProperties: false

required:
- compatible
- en-gpios
- interrupts
- reg
- wake-gpios

examples:
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
i2c4 {
#address-cells = <1>;
#size-cells = <0>;
s3fwrn5@27 {
compatible = "samsung,s3fwrn5-i2c";
reg = <0x27>;
interrupt-parent = <&gpa1>;
interrupts = <3 IRQ_TYPE_LEVEL_HIGH>;
en-gpios = <&gpf1 4 GPIO_ACTIVE_HIGH>;
wake-gpios = <&gpj0 2 GPIO_ACTIVE_HIGH>;
};
};
5 changes: 3 additions & 2 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -15292,10 +15292,11 @@ F: drivers/media/platform/s3c-camif/
F: include/media/drv-intf/s3c_camif.h

SAMSUNG S3FWRN5 NFC DRIVER
M: Robert Baldyga <r.baldyga@samsung.com>
M: Krzysztof Kozlowski <krzk@kernel.org>
M: Krzysztof Opasiak <k.opasiak@samsung.com>
L: linux-nfc@lists.01.org (moderated for non-subscribers)
S: Supported
S: Maintained
F: Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml
F: drivers/nfc/s3fwrn5

SAMSUNG S5C73M3 CAMERA DRIVER
Expand Down
4 changes: 2 additions & 2 deletions arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,8 @@
reg = <0x27>;
interrupt-parent = <&gpa1>;
interrupts = <3 IRQ_TYPE_LEVEL_HIGH>;
s3fwrn5,en-gpios = <&gpf1 4 GPIO_ACTIVE_HIGH>;
s3fwrn5,fw-gpios = <&gpj0 2 GPIO_ACTIVE_HIGH>;
en-gpios = <&gpf1 4 GPIO_ACTIVE_HIGH>;
wake-gpios = <&gpj0 2 GPIO_ACTIVE_HIGH>;
};
};

Expand Down
1 change: 1 addition & 0 deletions drivers/nfc/s3fwrn5/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
config NFC_S3FWRN5
tristate
select CRYPTO
select CRYPTO_HASH
help
Core driver for Samsung S3FWRN5 NFC chip. Contains core utilities
of chip. It's intended to be used by PHYs to avoid duplicating lots
Expand Down
4 changes: 2 additions & 2 deletions drivers/nfc/s3fwrn5/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ static int s3fwrn5_fw_get_base_addr(
}

static inline bool
s3fwrn5_fw_is_custom(struct s3fwrn5_fw_cmd_get_bootinfo_rsp *bootinfo)
s3fwrn5_fw_is_custom(const struct s3fwrn5_fw_cmd_get_bootinfo_rsp *bootinfo)
{
return !!bootinfo->hw_version[2];
}
Expand Down Expand Up @@ -399,7 +399,7 @@ int s3fwrn5_fw_setup(struct s3fwrn5_fw_info *fw_info)
return ret;
}

bool s3fwrn5_fw_check_version(struct s3fwrn5_fw_info *fw_info, u32 version)
bool s3fwrn5_fw_check_version(const struct s3fwrn5_fw_info *fw_info, u32 version)
{
struct s3fwrn5_fw_version *new = (void *) &fw_info->fw.version;
struct s3fwrn5_fw_version *old = (void *) &version;
Expand Down
2 changes: 1 addition & 1 deletion drivers/nfc/s3fwrn5/firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct s3fwrn5_fw_info {

void s3fwrn5_fw_init(struct s3fwrn5_fw_info *fw_info, const char *fw_name);
int s3fwrn5_fw_setup(struct s3fwrn5_fw_info *fw_info);
bool s3fwrn5_fw_check_version(struct s3fwrn5_fw_info *fw_info, u32 version);
bool s3fwrn5_fw_check_version(const struct s3fwrn5_fw_info *fw_info, u32 version);
int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info);
void s3fwrn5_fw_cleanup(struct s3fwrn5_fw_info *fw_info);

Expand Down
24 changes: 15 additions & 9 deletions drivers/nfc/s3fwrn5/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ static int s3fwrn5_i2c_read(struct s3fwrn5_i2c_phy *phy)
static irqreturn_t s3fwrn5_i2c_irq_thread_fn(int irq, void *phy_id)
{
struct s3fwrn5_i2c_phy *phy = phy_id;
int ret = 0;

if (!phy || !phy->ndev) {
WARN_ON_ONCE(1);
Expand All @@ -179,10 +178,9 @@ static irqreturn_t s3fwrn5_i2c_irq_thread_fn(int irq, void *phy_id)
switch (phy->mode) {
case S3FWRN5_MODE_NCI:
case S3FWRN5_MODE_FW:
ret = s3fwrn5_i2c_read(phy);
s3fwrn5_i2c_read(phy);
break;
case S3FWRN5_MODE_COLD:
ret = -EREMOTEIO;
break;
}

Expand All @@ -200,13 +198,21 @@ static int s3fwrn5_i2c_parse_dt(struct i2c_client *client)
if (!np)
return -ENODEV;

phy->gpio_en = of_get_named_gpio(np, "s3fwrn5,en-gpios", 0);
if (!gpio_is_valid(phy->gpio_en))
return -ENODEV;
phy->gpio_en = of_get_named_gpio(np, "en-gpios", 0);
if (!gpio_is_valid(phy->gpio_en)) {
/* Support also deprecated property */
phy->gpio_en = of_get_named_gpio(np, "s3fwrn5,en-gpios", 0);
if (!gpio_is_valid(phy->gpio_en))
return -ENODEV;
}

phy->gpio_fw_wake = of_get_named_gpio(np, "s3fwrn5,fw-gpios", 0);
if (!gpio_is_valid(phy->gpio_fw_wake))
return -ENODEV;
phy->gpio_fw_wake = of_get_named_gpio(np, "wake-gpios", 0);
if (!gpio_is_valid(phy->gpio_fw_wake)) {
/* Support also deprecated property */
phy->gpio_fw_wake = of_get_named_gpio(np, "s3fwrn5,fw-gpios", 0);
if (!gpio_is_valid(phy->gpio_fw_wake))
return -ENODEV;
}

return 0;
}
Expand Down

0 comments on commit b55353e

Please sign in to comment.