get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1936144/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1936144,
    "url": "http://patchwork.ozlabs.org/api/patches/1936144/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-aspeed/patch/20240516181907.3468796-39-eajames@linux.ibm.com/",
    "project": {
        "id": 57,
        "url": "http://patchwork.ozlabs.org/api/projects/57/?format=api",
        "name": "Linux ASPEED SoC development",
        "link_name": "linux-aspeed",
        "list_id": "linux-aspeed.lists.ozlabs.org",
        "list_email": "linux-aspeed@lists.ozlabs.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20240516181907.3468796-39-eajames@linux.ibm.com>",
    "list_archive_url": null,
    "date": "2024-05-16T18:19:05",
    "name": "[v3,38/40] spi: fsi: Calculate clock divider from local bus frequency",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "238a4b6f9cd736b04db43968f8a692ae563cd61d",
    "submitter": {
        "id": 74989,
        "url": "http://patchwork.ozlabs.org/api/people/74989/?format=api",
        "name": "Eddie James",
        "email": "eajames@linux.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-aspeed/patch/20240516181907.3468796-39-eajames@linux.ibm.com/mbox/",
    "series": [
        {
            "id": 407101,
            "url": "http://patchwork.ozlabs.org/api/series/407101/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-aspeed/list/?series=407101",
            "date": "2024-05-16T18:18:31",
            "name": "fsi: Add interrupt support",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/407101/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1936144/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1936144/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-aspeed@lists.ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "linux-aspeed@lists.ozlabs.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=AQjOSSQu;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org;\n envelope-from=linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=AQjOSSQu;\n\tdkim-atps=neutral",
            "lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com",
            "lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=AQjOSSQu;\n\tdkim-atps=neutral",
            "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com\n (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n envelope-from=eajames@linux.ibm.com; receiver=lists.ozlabs.org)"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4VgJLz40wzz1yfq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 May 2024 04:21:15 +1000 (AEST)",
            "from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4VgJLz1psDz3fq8\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 May 2024 04:21:15 +1000 (AEST)",
            "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n [148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4VgJJy6msNz3fnr;\n\tFri, 17 May 2024 04:19:30 +1000 (AEST)",
            "from pps.filterd (m0353729.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 44GIAesx020807;\n\tThu, 16 May 2024 18:19:22 GMT",
            "from ppma12.dal12v.mail.ibm.com\n (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220])\n\tby mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3y5p6gg5n9-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tThu, 16 May 2024 18:19:22 +0000",
            "from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1])\n\tby ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id\n 44GHFiN3018766;\n\tThu, 16 May 2024 18:19:21 GMT",
            "from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5])\n\tby ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3y2k0tuqeh-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tThu, 16 May 2024 18:19:21 +0000",
            "from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com\n [10.241.53.104])\n\tby smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 44GIJJw717892018\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n\tThu, 16 May 2024 18:19:21 GMT",
            "from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id E65DB58069;\n\tThu, 16 May 2024 18:19:18 +0000 (GMT)",
            "from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id A7A3158070;\n\tThu, 16 May 2024 18:19:18 +0000 (GMT)",
            "from slate16.aus.stglabs.ibm.com (unknown [9.61.107.19])\n\tby smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP;\n\tThu, 16 May 2024 18:19:18 +0000 (GMT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com;\n h=from : to : cc : subject\n : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding; s=pp1;\n bh=7rdXwcif5odw8BMvyEIyfx63iGwhjk1j2vHqrFPW0j8=;\n b=AQjOSSQuej4TMs/S1GS8nlBVYJX748XHLdqJS8iKj5mrgojAU+D3HHHiQVlVdMOB/gtB\n W/w7DL++7l6c/pTAXy87qcDxjzHAzO4LjGAOcIexOkSIVgbBKKPFm2yPcPoMYoGXJ3B2\n b1RAu+KNZWaYXq1ZgnV0ynySK7LfTks3cbWSprM2HyAm3nSX4nt/V0mKtOxHaFHG34kC\n sx6yQ3Fm/nk7c7jHF+JQuGDbq/y+MasofCpFYxalCDgj40yc+2YWEtOgV9JndJy1Xbis\n bbDt88qiJOVjEzhHtPfpAgriv7Dpbvecs1JHws31RR5Jz3AvuHDB5xjOik3qU2dfWzk6 ng==",
        "From": "Eddie James <eajames@linux.ibm.com>",
        "To": "linux-fsi@lists.ozlabs.org",
        "Subject": "[PATCH v3 38/40] spi: fsi: Calculate clock divider from local bus\n frequency",
        "Date": "Thu, 16 May 2024 13:19:05 -0500",
        "Message-Id": "<20240516181907.3468796-39-eajames@linux.ibm.com>",
        "X-Mailer": "git-send-email 2.39.3",
        "In-Reply-To": "<20240516181907.3468796-1-eajames@linux.ibm.com>",
        "References": "<20240516181907.3468796-1-eajames@linux.ibm.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-TM-AS-GCONF": "00",
        "X-Proofpoint-GUID": "t6GYCQt_X6uhjL6KkshgjWQhVkW4aZkY",
        "X-Proofpoint-ORIG-GUID": "t6GYCQt_X6uhjL6KkshgjWQhVkW4aZkY",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26\n definitions=2024-05-16_07,2024-05-15_01,2023-05-22_02",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n lowpriorityscore=0\n adultscore=0 clxscore=1015 impostorscore=0 mlxscore=0 malwarescore=0\n mlxlogscore=844 spamscore=0 bulkscore=0 priorityscore=1501 suspectscore=0\n phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1\n engine=8.12.0-2405010000 definitions=main-2405160132",
        "X-BeenThere": "linux-aspeed@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Linux ASPEED SoC development <linux-aspeed.lists.ozlabs.org>",
        "List-Unsubscribe": "<https://lists.ozlabs.org/options/linux-aspeed>,\n <mailto:linux-aspeed-request@lists.ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.ozlabs.org/pipermail/linux-aspeed/>",
        "List-Post": "<mailto:linux-aspeed@lists.ozlabs.org>",
        "List-Help": "<mailto:linux-aspeed-request@lists.ozlabs.org?subject=help>",
        "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linux-aspeed>,\n <mailto:linux-aspeed-request@lists.ozlabs.org?subject=subscribe>",
        "Cc": "andi.shyti@kernel.org, linux-aspeed@lists.ozlabs.org, jk@ozlabs.org,\n alistair@popple.id.au, linux-kernel@vger.kernel.org,\n linux-spi@vger.kernel.org, broonie@kernel.org, andrew@codeconstruct.com.au,\n linux-i2c@vger.kernel.org",
        "Errors-To": "linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org",
        "Sender": "\"Linux-aspeed\"\n <linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"
    },
    "content": "Use the new FSI device local bus clock to calculate the proper SPI\nclock divider.\n\nSigned-off-by: Eddie James <eajames@linux.ibm.com>\n---\n drivers/spi/spi-fsi.c | 33 ++++++++++++++++++++++++++++++---\n 1 file changed, 30 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/spi/spi-fsi.c b/drivers/spi/spi-fsi.c\nindex fc9e33be1e0e7..e762690f1a390 100644\n--- a/drivers/spi/spi-fsi.c\n+++ b/drivers/spi/spi-fsi.c\n@@ -40,6 +40,7 @@\n #define  SPI_FSI_CLOCK_CFG_SCK_RECV_DEL\t GENMASK_ULL(51, 44)\n #define   SPI_FSI_CLOCK_CFG_SCK_NO_DEL\t  BIT_ULL(51)\n #define  SPI_FSI_CLOCK_CFG_SCK_DIV\t GENMASK_ULL(63, 52)\n+#define  SPI_FSI_CLOCK_CFG_SCK_DIV_MIN\t  0x4\n #define SPI_FSI_MMAP\t\t\t0x4\n #define SPI_FSI_DATA_TX\t\t\t0x5\n #define SPI_FSI_DATA_RX\t\t\t0x6\n@@ -70,6 +71,7 @@\n struct fsi2spi {\n \tstruct fsi_device *fsi; /* FSI2SPI CFAM engine device */\n \tstruct mutex lock; /* lock access to the device */\n+\tu32 lbus_freq;\n };\n \n struct fsi_spi {\n@@ -359,7 +361,7 @@ static int fsi_spi_transfer_data(struct fsi_spi *ctx,\n \treturn 0;\n }\n \n-static int fsi_spi_transfer_init(struct fsi_spi *ctx)\n+static int fsi_spi_transfer_init(struct fsi_spi *ctx, u32 clock_div)\n {\n \tint loops = 0;\n \tint rc;\n@@ -370,7 +372,7 @@ static int fsi_spi_transfer_init(struct fsi_spi *ctx)\n \tu64 status = 0ULL;\n \tu64 wanted_clock_cfg = SPI_FSI_CLOCK_CFG_ECC_DISABLE |\n \t\tSPI_FSI_CLOCK_CFG_SCK_NO_DEL |\n-\t\tFIELD_PREP(SPI_FSI_CLOCK_CFG_SCK_DIV, 19);\n+\t\tFIELD_PREP(SPI_FSI_CLOCK_CFG_SCK_DIV, clock_div);\n \n \tend = jiffies + msecs_to_jiffies(SPI_FSI_TIMEOUT_MS);\n \tdo {\n@@ -421,6 +423,24 @@ static int fsi_spi_transfer_init(struct fsi_spi *ctx)\n \treturn rc;\n }\n \n+static u32 fsi_spi_calculate_clock_div(struct fsi2spi *bridge, struct spi_device *dev,\n+\t\t\t\t       struct spi_transfer *transfer)\n+{\n+\tu32 div = 19;\n+\n+\tif (bridge->lbus_freq) {\n+\t\tu32 desired_speed_hz = transfer->speed_hz ?: dev->max_speed_hz;\n+\n+\t\tdiv = DIV_ROUND_UP(bridge->lbus_freq, desired_speed_hz);\n+\t\tif (div < SPI_FSI_CLOCK_CFG_SCK_DIV_MIN)\n+\t\t\tdiv = SPI_FSI_CLOCK_CFG_SCK_DIV_MIN;\n+\n+\t\ttransfer->effective_speed_hz = bridge->lbus_freq / div;\n+\t}\n+\n+\treturn div;\n+}\n+\n static int fsi_spi_transfer_one_message(struct spi_controller *ctlr,\n \t\t\t\t\tstruct spi_message *mesg)\n {\n@@ -429,6 +449,7 @@ static int fsi_spi_transfer_one_message(struct spi_controller *ctlr,\n \tunsigned int len;\n \tstruct spi_transfer *transfer;\n \tstruct fsi_spi *ctx = spi_controller_get_devdata(ctlr);\n+\tu32 div;\n \n \trc = fsi_spi_check_mux(ctx->bridge->fsi, ctx->dev);\n \tif (rc)\n@@ -446,7 +467,8 @@ static int fsi_spi_transfer_one_message(struct spi_controller *ctlr,\n \n \t\tdev_dbg(ctx->dev, \"Start tx of %d bytes.\\n\", transfer->len);\n \n-\t\trc = fsi_spi_transfer_init(ctx);\n+\t\tdiv = fsi_spi_calculate_clock_div(ctx->bridge, mesg->spi, transfer);\n+\t\trc = fsi_spi_transfer_init(ctx, div);\n \t\tif (rc < 0)\n \t\t\tgoto error;\n \n@@ -533,6 +555,7 @@ static int fsi_spi_probe(struct device *dev)\n \n \tbridge->fsi = fsi;\n \tmutex_init(&bridge->lock);\n+\tbridge->lbus_freq = fsi_device_local_bus_frequency(fsi);\n \n \tfor_each_available_child_of_node(dev->of_node, np) {\n \t\tu32 base;\n@@ -550,6 +573,10 @@ static int fsi_spi_probe(struct device *dev)\n \n \t\tctlr->dev.of_node = np;\n \t\tctlr->num_chipselect = of_get_available_child_count(np) ?: 1;\n+\t\tif (bridge->lbus_freq) {\n+\t\t\tctlr->min_speed_hz = DIV_ROUND_UP(bridge->lbus_freq, 0xfff);\n+\t\t\tctlr->max_speed_hz = bridge->lbus_freq / SPI_FSI_CLOCK_CFG_SCK_DIV_MIN;\n+\t\t}\n \t\tctlr->flags = SPI_CONTROLLER_HALF_DUPLEX;\n \t\tctlr->max_transfer_size = fsi_spi_max_transfer_size;\n \t\tctlr->transfer_one_message = fsi_spi_transfer_one_message;\n",
    "prefixes": [
        "v3",
        "38/40"
    ]
}