Skip to content

Commit e59a698

Browse files
committed
Merge tag 'i3c/for-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux
Pull i3c updates from Alexandre Belloni: "Core: - Fix SETDASA when static and dynamic adress are equal - Fix cmd_v1 DAA exit criteria Drivers: - svc: allow probing without any device" * tag 'i3c/for-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux: i3c: master: svc: fix probe failure when no i3c device exist i3c: master: Fix SETDASA process dt-bindings: i3c: Fix description for assigned-address i3c: master: svc: Describe member 'saved_regs' i3c: master: svc: Do not check for 0 return after calling platform_get_irq() i3c/master: cmd_v1: Fix the exit criteria for the daa procedure i3c: Explicitly include correct DT includes
2 parents d9b9ea5 + 6e13d65 commit e59a698

File tree

6 files changed

+32
-12
lines changed

6 files changed

+32
-12
lines changed

Documentation/devicetree/bindings/i3c/i3c.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ patternProperties:
135135
minimum: 0x1
136136
maximum: 0xff
137137
description: |
138-
Dynamic address to be assigned to this device. This property is only
139-
valid if the I3C device has a static address (first cell of the reg
140-
property != 0).
138+
Dynamic address to be assigned to this device. In case static address is
139+
present (first cell of the reg property != 0), this address is assigned
140+
through SETDASA. If static address is not present, this address is assigned
141+
through SETNEWDA after assigning a temporary address via ENTDAA.
141142
142143
required:
143144
- reg
@@ -163,12 +164,18 @@ examples:
163164
pagesize = <0x8>;
164165
};
165166
166-
/* I3C device with a static I2C address. */
167+
/* I3C device with a static I2C address and assigned address. */
167168
thermal_sensor: sensor@68,39200144004 {
168169
reg = <0x68 0x392 0x144004>;
169170
assigned-address = <0xa>;
170171
};
171172
173+
/* I3C device with only assigned address. */
174+
pressure_sensor: sensor@0,39200124004 {
175+
reg = <0x0 0x392 0x124000>;
176+
assigned-address = <0xc>;
177+
};
178+
172179
/*
173180
* I3C device without a static I2C address but requiring
174181
* resources described in the DT.

drivers/i3c/master.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,11 @@ static int i3c_master_get_i3c_addrs(struct i3c_dev_desc *dev)
13081308
if (dev->info.static_addr) {
13091309
status = i3c_bus_get_addr_slot_status(&master->bus,
13101310
dev->info.static_addr);
1311-
if (status != I3C_ADDR_SLOT_FREE)
1311+
/* Since static address and assigned dynamic address can be
1312+
* equal, allow this case to pass.
1313+
*/
1314+
if (status != I3C_ADDR_SLOT_FREE &&
1315+
dev->info.static_addr != dev->boardinfo->init_dyn_addr)
13121316
return -EBUSY;
13131317

13141318
i3c_bus_set_addr_slot_status(&master->bus,

drivers/i3c/master/ast2600-i3c-master.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <linux/mfd/syscon.h>
99
#include <linux/module.h>
1010
#include <linux/of.h>
11-
#include <linux/of_device.h>
1211
#include <linux/platform_device.h>
1312
#include <linux/regmap.h>
1413

drivers/i3c/master/i3c-master-cdns.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <linux/slab.h>
2323
#include <linux/spinlock.h>
2424
#include <linux/workqueue.h>
25-
#include <linux/of_device.h>
2625

2726
#define DEV_ID 0x0
2827
#define DEV_ID_I3C_MASTER 0x5034

drivers/i3c/master/mipi-i3c-hci/cmd_v1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static int hci_cmd_v1_daa(struct i3c_hci *hci)
339339
break;
340340
}
341341
if (RESP_STATUS(xfer[0].response) == RESP_ERR_NACK &&
342-
RESP_STATUS(xfer[0].response) == 1) {
342+
RESP_DATA_LENGTH(xfer->response) == 1) {
343343
ret = 0; /* no more devices to be assigned */
344344
break;
345345
}

drivers/i3c/master/svc-i3c-master.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ struct svc_i3c_regs_save {
156156
* @base: I3C master controller
157157
* @dev: Corresponding device
158158
* @regs: Memory mapping
159+
* @saved_regs: Volatile values for PM operations
159160
* @free_slots: Bit array of available slots
160161
* @addrs: Array containing the dynamic addresses of each attached device
161162
* @descs: Array of descriptors, one per attached device
@@ -789,6 +790,10 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master,
789790
*/
790791
break;
791792
} else if (SVC_I3C_MSTATUS_NACKED(reg)) {
793+
/* No I3C devices attached */
794+
if (dev_nb == 0)
795+
break;
796+
792797
/*
793798
* A slave device nacked the address, this is
794799
* allowed only once, DAA will be stopped and
@@ -1263,11 +1268,17 @@ static int svc_i3c_master_send_ccc_cmd(struct i3c_master_controller *m,
12631268
{
12641269
struct svc_i3c_master *master = to_svc_i3c_master(m);
12651270
bool broadcast = cmd->id < 0x80;
1271+
int ret;
12661272

12671273
if (broadcast)
1268-
return svc_i3c_master_send_bdcast_ccc_cmd(master, cmd);
1274+
ret = svc_i3c_master_send_bdcast_ccc_cmd(master, cmd);
12691275
else
1270-
return svc_i3c_master_send_direct_ccc_cmd(master, cmd);
1276+
ret = svc_i3c_master_send_direct_ccc_cmd(master, cmd);
1277+
1278+
if (ret)
1279+
cmd->err = I3C_ERROR_M2;
1280+
1281+
return ret;
12711282
}
12721283

12731284
static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
@@ -1518,8 +1529,8 @@ static int svc_i3c_master_probe(struct platform_device *pdev)
15181529
return PTR_ERR(master->sclk);
15191530

15201531
master->irq = platform_get_irq(pdev, 0);
1521-
if (master->irq <= 0)
1522-
return -ENOENT;
1532+
if (master->irq < 0)
1533+
return master->irq;
15231534

15241535
master->dev = dev;
15251536

0 commit comments

Comments
 (0)