From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753303AbbG2Iib (ORCPT ); Wed, 29 Jul 2015 04:38:31 -0400 Received: from foss.arm.com ([217.140.101.70]:34916 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751506AbbG2Ii2 (ORCPT ); Wed, 29 Jul 2015 04:38:28 -0400 Message-ID: <55B89100.3020802@arm.com> Date: Wed, 29 Jul 2015 09:38:24 +0100 From: Sudeep Holla User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Jassi Brar CC: Sudeep Holla , Linux Kernel Mailing List , Liviu Dudau , Punit Agrawal , "Jon Medhurst (Tixy)" , Lorenzo Pieralisi , Arnd Bergmann , Olof Johansson , Kevin Hilman Subject: Re: [PATCH v5 2/8] firmware: add support for ARM System Control and Power Interface(SCPI) protocol References: <1437649828-14540-1-git-send-email-sudeep.holla@arm.com> <1437649828-14540-3-git-send-email-sudeep.holla@arm.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/07/15 09:05, Jassi Brar wrote: > On Thu, Jul 23, 2015 at 4:40 PM, Sudeep Holla wrote: > > ... > >> +static int scpi_probe(struct platform_device *pdev) >> +{ >> + int count, idx, ret; >> + struct resource res; >> + struct scpi_chan *scpi_chan; >> + struct device *dev = &pdev->dev; >> + struct device_node *np = dev->of_node; >> + >> + scpi_info = devm_kzalloc(dev, sizeof(*scpi_info), GFP_KERNEL); >> + if (!scpi_info) >> + return -ENOMEM; >> + >> + count = of_count_phandle_with_args(np, "mboxes", "#mbox-cells"); >> + if (count < 0) { >> + dev_err(dev, "no mboxes property in '%s'\n", np->full_name); >> + return -ENODEV; >> + } >> + >> + scpi_chan = devm_kcalloc(dev, count, sizeof(*scpi_chan), GFP_KERNEL); >> + if (!scpi_chan) >> + return -ENOMEM; >> + >> + for (idx = 0; idx < count; idx++) { >> + resource_size_t size; >> + struct scpi_chan *pchan = scpi_chan + idx; >> + struct mbox_client *cl = &pchan->cl; >> + struct device_node *shmem = of_parse_phandle(np, "shmem", idx); >> + >> + if (of_address_to_resource(shmem, 0, &res)) { >> + dev_err(dev, "failed to get SCPI payload mem resource\n"); >> + ret = -EINVAL; >> + goto err; >> + } >> + >> + size = resource_size(&res); >> + pchan->rx_payload = devm_ioremap(dev, res.start, size); >> + if (!pchan->rx_payload) { >> + dev_err(dev, "failed to ioremap SCPI payload\n"); >> + ret = -EADDRNOTAVAIL; >> + goto err; >> + } >> + pchan->tx_payload = pchan->rx_payload + (size >> 1); >> + >> + cl->dev = dev; >> + cl->rx_callback = scpi_handle_remote_msg; >> + cl->tx_prepare = scpi_tx_prepare; >> + cl->tx_block = true; >> + cl->tx_tout = 50; >> + cl->knows_txdone = false; /* controller can ack */ >> > This is the cause of your problems that you think should be solved by > using hrtimer. > Ah sorry, it's stupid mistake on my part while writing the comment. It should have been controller can't ack, fixed locally now thanks for pointing it out. > Controller may or may not (like MHU) set txdone_irq. However every > scpi command (struct scpi_ops members) is replied to as a response > packet reporting success or failure. No that's not true, I have already mentioned that couple of times in the other thread. It's just wrong comment here which went unnoticed from day#1, sorry for that. > So the client should set 'knows_txdone' to be true unless it is told > the controller on that platform supports txdone_irq (what you call > 'ack'). > I got the concept but SCP can't ack via protocol, protocol has no such provision and it sets flags in MHU status register. Regards, Sudeep