u8500_hsem.c (e759176c7f6b6d84a31276e11d687f232f6e4ecf) u8500_hsem.c (acafe7e30216166a17e6e226aadc3ecb63993242)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * u8500 HWSEM driver
4 *
5 * Copyright (C) 2010-2011 ST-Ericsson
6 *
7 * Implements u8500 semaphore handling for protocol 1, no interrupts.
8 *
9 * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
10 * Heavily borrowed from the work of :
11 * Simon Que <sque@ti.com>
12 * Hari Kanigeri <h-kanigeri2@ti.com>
13 * Ohad Ben-Cohen <ohad@wizery.com>
1/*
2 * u8500 HWSEM driver
3 *
4 * Copyright (C) 2010-2011 ST-Ericsson
5 *
6 * Implements u8500 semaphore handling for protocol 1, no interrupts.
7 *
8 * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
9 * Heavily borrowed from the work of :
10 * Simon Que <sque@ti.com>
11 * Hari Kanigeri <h-kanigeri2@ti.com>
12 * Ohad Ben-Cohen <ohad@wizery.com>
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * version 2 as published by the Free Software Foundation.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
14 */
15
16#include <linux/module.h>
17#include <linux/delay.h>
18#include <linux/io.h>
19#include <linux/pm_runtime.h>
20#include <linux/slab.h>
21#include <linux/spinlock.h>

--- 84 unchanged lines hidden (view full) ---

106
107 /* make sure protocol 1 is selected */
108 val = readl(io_base + HSEM_CTRL_REG);
109 writel((val & ~HSEM_PROTOCOL_1), io_base + HSEM_CTRL_REG);
110
111 /* clear all interrupts */
112 writel(0xFFFF, io_base + HSEM_ICRALL);
113
22 */
23
24#include <linux/module.h>
25#include <linux/delay.h>
26#include <linux/io.h>
27#include <linux/pm_runtime.h>
28#include <linux/slab.h>
29#include <linux/spinlock.h>

--- 84 unchanged lines hidden (view full) ---

114
115 /* make sure protocol 1 is selected */
116 val = readl(io_base + HSEM_CTRL_REG);
117 writel((val & ~HSEM_PROTOCOL_1), io_base + HSEM_CTRL_REG);
118
119 /* clear all interrupts */
120 writel(0xFFFF, io_base + HSEM_ICRALL);
121
114 bank = kzalloc(sizeof(*bank) + num_locks * sizeof(*hwlock), GFP_KERNEL);
122 bank = kzalloc(struct_size(bank, lock, num_locks), GFP_KERNEL);
115 if (!bank) {
116 ret = -ENOMEM;
117 goto iounmap_base;
118 }
119
120 platform_set_drvdata(pdev, bank);
121
122 for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++)

--- 66 unchanged lines hidden ---
123 if (!bank) {
124 ret = -ENOMEM;
125 goto iounmap_base;
126 }
127
128 platform_set_drvdata(pdev, bank);
129
130 for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++)

--- 66 unchanged lines hidden ---