devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeffrey Hugo <jhugo@codeaurora.org>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: Kumar Gala <galak@codeaurora.org>,
	ohad@wizery.com, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	Eric Holmberg <eholmber@codeaurora.org>
Subject: Re: [PATCH v2] hwspinlock/msm: Add support for Qualcomm MSM HW Mutex block
Date: Tue, 13 Aug 2013 09:54:54 -0600	[thread overview]
Message-ID: <520A56CE.3000901@codeaurora.org> (raw)
In-Reply-To: <52090EE9.7030602@codeaurora.org>

On 8/12/2013 10:35 AM, Stephen Boyd wrote:
> On 07/29/13 15:00, Kumar Gala wrote:
>> diff --git a/drivers/hwspinlock/msm_hwspinlock.c b/drivers/hwspinlock/msm_hwspinlock.c
>> new file mode 100644
>> index 0000000..dbd9a69
>> --- /dev/null
>> +++ b/drivers/hwspinlock/msm_hwspinlock.c
>> @@ -0,0 +1,150 @@
>> +/*
>> + * Copyright (c) 2013, The Linux Foundation. All rights reserved.
>> + *
>> + * This software is licensed under the terms of the GNU General Public
>> + * License version 2, as published by the Free Software Foundation, and
>> + * may be copied, distributed, and modified under those terms.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + */
>> +
>> +#include <linux/err.h>
>> +#include <linux/kernel.h>
>> +#include <linux/slab.h>
>> +#include <linux/device.h>
>> +#include <linux/module.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/of_device.h>
>> +#include <linux/hwspinlock.h>
>> +#include <linux/io.h>
>> +
>> +#include "hwspinlock_internal.h"
>> +
>> +#define SPINLOCK_ID_APPS_PROC	1
>
> Is this id only for the apps processor? What about hexagon? Does it need
> a different number?

Yes, hexagon would need a different id based on what job that particular 
hexagon processor is doing.  I'm not currently aware of a hexagon 
usecase, but I believe modifying the DT binding in the future would 
cover the usecase if it comes up.

>
>> +#define BASE_ID			0
>> +
>> +static int msm_hwspinlock_trylock(struct hwspinlock *lock)
>> +{
>> +	void __iomem *lock_addr = lock->priv;
>> +
>> +	writel_relaxed(SPINLOCK_ID_APPS_PROC, lock_addr);
>> +	smp_mb();
>> +	return readl_relaxed(lock_addr) == SPINLOCK_ID_APPS_PROC;
>> +}
>> +
>> +static void msm_hwspinlock_unlock(struct hwspinlock *lock)
>> +{
>> +	int lock_owner;
>
> This should probably be u32 to be explicit about the size of the register.
>
>> +	void __iomem *lock_addr = lock->priv;
>> +
>> +	lock_owner = readl_relaxed(lock_addr);
>> +	if (lock_owner != SPINLOCK_ID_APPS_PROC) {
>> +		pr_err("%s: spinlock not owned by Apps (actual owner is %d)\n",
>
> Maybe you should just say "spinlock not owned by us (actual owner is
> %d)" so that this driver is agnostic to the processor it runs on?
>
>> +				__func__, lock_owner);
>> +	}
>> +
>> +	writel_relaxed(0, lock_addr);
>> +	smp_mb();
>> +}
>>
>


Jeffrey Hugo
-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation.

  reply	other threads:[~2013-08-13 15:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 22:00 [PATCH v2] hwspinlock/msm: Add support for Qualcomm MSM HW Mutex block Kumar Gala
2013-08-12 16:35 ` Stephen Boyd
2013-08-13 15:54   ` Jeffrey Hugo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-29 23:14 Bjorn Andersson
2014-08-29 23:41 ` Courtney Cavin
2014-08-30  0:14   ` Stephen Boyd
2014-08-30  0:47     ` Courtney Cavin
2014-09-02 17:28 ` Jeffrey Hugo
2014-09-02 18:48   ` Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=520A56CE.3000901@codeaurora.org \
    --to=jhugo@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eholmber@codeaurora.org \
    --cc=galak@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=sboyd@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).