Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'hwlock-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux

Pull hwspinlock updates from Bjorn Andersson:
"Remove the unused u8500 hardware spinlock driver, and clean out the
hwspinlock_pdata struct as this was the last user of the struct"

* tag 'hwlock-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux:
hwspinlock: remove now unused pdata from header file
hwspinlock: u8500: delete driver

-196
-1
MAINTAINERS
··· 3153 3153 F: drivers/dma/ste_dma40* 3154 3154 F: drivers/pmdomain/st/ste-ux500-pm-domain.c 3155 3155 F: drivers/gpio/gpio-nomadik.c 3156 - F: drivers/hwspinlock/u8500_hsem.c 3157 3156 F: drivers/i2c/busses/i2c-nomadik.c 3158 3157 F: drivers/iio/adc/ab8500-gpadc.c 3159 3158 F: drivers/mfd/ab8500*
-1
arch/arm/configs/u8500_defconfig
··· 148 148 CONFIG_DMADEVICES=y 149 149 CONFIG_STE_DMA40=y 150 150 CONFIG_HWSPINLOCK=y 151 - CONFIG_HSEM_U8500=y 152 151 CONFIG_EXTCON_FSA9480=y 153 152 CONFIG_IIO=y 154 153 CONFIG_IIO_SW_TRIGGER=y
-10
drivers/hwspinlock/Kconfig
··· 53 53 54 54 If unsure, say N. 55 55 56 - config HSEM_U8500 57 - tristate "STE Hardware Semaphore functionality" 58 - depends on ARCH_U8500 || COMPILE_TEST 59 - help 60 - Say y here to support the STE Hardware Semaphore functionality, which 61 - provides a synchronisation mechanism for the various processor on the 62 - SoC. 63 - 64 - If unsure, say N. 65 - 66 56 endif # HWSPINLOCK
-1
drivers/hwspinlock/Makefile
··· 9 9 obj-$(CONFIG_HWSPINLOCK_SPRD) += sprd_hwspinlock.o 10 10 obj-$(CONFIG_HWSPINLOCK_STM32) += stm32_hwspinlock.o 11 11 obj-$(CONFIG_HWSPINLOCK_SUN6I) += sun6i_hwspinlock.o 12 - obj-$(CONFIG_HSEM_U8500) += u8500_hsem.o
-155
drivers/hwspinlock/u8500_hsem.c
··· 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> 14 - */ 15 - 16 - #include <linux/module.h> 17 - #include <linux/delay.h> 18 - #include <linux/io.h> 19 - #include <linux/slab.h> 20 - #include <linux/spinlock.h> 21 - #include <linux/hwspinlock.h> 22 - #include <linux/platform_device.h> 23 - 24 - #include "hwspinlock_internal.h" 25 - 26 - /* 27 - * Implementation of STE's HSem protocol 1 without interrutps. 28 - * The only masterID we allow is '0x01' to force people to use 29 - * HSems for synchronisation between processors rather than processes 30 - * on the ARM core. 31 - */ 32 - 33 - #define U8500_MAX_SEMAPHORE 32 /* a total of 32 semaphore */ 34 - #define RESET_SEMAPHORE (0) /* free */ 35 - 36 - /* 37 - * CPU ID for master running u8500 kernel. 38 - * Hswpinlocks should only be used to synchonise operations 39 - * between the Cortex A9 core and the other CPUs. Hence 40 - * forcing the masterID to a preset value. 41 - */ 42 - #define HSEM_MASTER_ID 0x01 43 - 44 - #define HSEM_REGISTER_OFFSET 0x08 45 - 46 - #define HSEM_CTRL_REG 0x00 47 - #define HSEM_ICRALL 0x90 48 - #define HSEM_PROTOCOL_1 0x01 49 - 50 - static int u8500_hsem_trylock(struct hwspinlock *lock) 51 - { 52 - void __iomem *lock_addr = lock->priv; 53 - 54 - writel(HSEM_MASTER_ID, lock_addr); 55 - 56 - /* get only first 4 bit and compare to masterID. 57 - * if equal, we have the semaphore, otherwise 58 - * someone else has it. 59 - */ 60 - return (HSEM_MASTER_ID == (0x0F & readl(lock_addr))); 61 - } 62 - 63 - static void u8500_hsem_unlock(struct hwspinlock *lock) 64 - { 65 - void __iomem *lock_addr = lock->priv; 66 - 67 - /* release the lock by writing 0 to it */ 68 - writel(RESET_SEMAPHORE, lock_addr); 69 - } 70 - 71 - /* 72 - * u8500: what value is recommended here ? 73 - */ 74 - static void u8500_hsem_relax(struct hwspinlock *lock) 75 - { 76 - ndelay(50); 77 - } 78 - 79 - static const struct hwspinlock_ops u8500_hwspinlock_ops = { 80 - .trylock = u8500_hsem_trylock, 81 - .unlock = u8500_hsem_unlock, 82 - .relax = u8500_hsem_relax, 83 - }; 84 - 85 - static int u8500_hsem_probe(struct platform_device *pdev) 86 - { 87 - struct hwspinlock_pdata *pdata = pdev->dev.platform_data; 88 - struct hwspinlock_device *bank; 89 - struct hwspinlock *hwlock; 90 - void __iomem *io_base; 91 - int i, num_locks = U8500_MAX_SEMAPHORE; 92 - ulong val; 93 - 94 - if (!pdata) 95 - return -ENODEV; 96 - 97 - io_base = devm_platform_ioremap_resource(pdev, 0); 98 - if (IS_ERR(io_base)) 99 - return PTR_ERR(io_base); 100 - 101 - /* make sure protocol 1 is selected */ 102 - val = readl(io_base + HSEM_CTRL_REG); 103 - writel((val & ~HSEM_PROTOCOL_1), io_base + HSEM_CTRL_REG); 104 - 105 - /* clear all interrupts */ 106 - writel(0xFFFF, io_base + HSEM_ICRALL); 107 - 108 - bank = devm_kzalloc(&pdev->dev, struct_size(bank, lock, num_locks), 109 - GFP_KERNEL); 110 - if (!bank) 111 - return -ENOMEM; 112 - 113 - platform_set_drvdata(pdev, bank); 114 - 115 - for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) 116 - hwlock->priv = io_base + HSEM_REGISTER_OFFSET + sizeof(u32) * i; 117 - 118 - return devm_hwspin_lock_register(&pdev->dev, bank, 119 - &u8500_hwspinlock_ops, 120 - pdata->base_id, num_locks); 121 - } 122 - 123 - static void u8500_hsem_remove(struct platform_device *pdev) 124 - { 125 - struct hwspinlock_device *bank = platform_get_drvdata(pdev); 126 - void __iomem *io_base = bank->lock[0].priv - HSEM_REGISTER_OFFSET; 127 - 128 - /* clear all interrupts */ 129 - writel(0xFFFF, io_base + HSEM_ICRALL); 130 - } 131 - 132 - static struct platform_driver u8500_hsem_driver = { 133 - .probe = u8500_hsem_probe, 134 - .remove = u8500_hsem_remove, 135 - .driver = { 136 - .name = "u8500_hsem", 137 - }, 138 - }; 139 - 140 - static int __init u8500_hsem_init(void) 141 - { 142 - return platform_driver_register(&u8500_hsem_driver); 143 - } 144 - /* board init code might need to reserve hwspinlocks for predefined purposes */ 145 - postcore_initcall(u8500_hsem_init); 146 - 147 - static void __exit u8500_hsem_exit(void) 148 - { 149 - platform_driver_unregister(&u8500_hsem_driver); 150 - } 151 - module_exit(u8500_hsem_exit); 152 - 153 - MODULE_LICENSE("GPL v2"); 154 - MODULE_DESCRIPTION("Hardware Spinlock driver for u8500"); 155 - MODULE_AUTHOR("Mathieu Poirier <mathieu.poirier@linaro.org>");
-28
include/linux/hwspinlock.h
··· 25 25 struct hwspinlock_device; 26 26 struct hwspinlock_ops; 27 27 28 - /** 29 - * struct hwspinlock_pdata - platform data for hwspinlock drivers 30 - * @base_id: base id for this hwspinlock device 31 - * 32 - * hwspinlock devices provide system-wide hardware locks that are used 33 - * by remote processors that have no other way to achieve synchronization. 34 - * 35 - * To achieve that, each physical lock must have a system-wide id number 36 - * that is agreed upon, otherwise remote processors can't possibly assume 37 - * they're using the same hardware lock. 38 - * 39 - * Usually boards have a single hwspinlock device, which provides several 40 - * hwspinlocks, and in this case, they can be trivially numbered 0 to 41 - * (num-of-locks - 1). 42 - * 43 - * In case boards have several hwspinlocks devices, a different base id 44 - * should be used for each hwspinlock device (they can't all use 0 as 45 - * a starting id!). 46 - * 47 - * This platform data structure should be used to provide the base id 48 - * for each device (which is trivially 0 when only a single hwspinlock 49 - * device exists). It can be shared between different platforms, hence 50 - * its location. 51 - */ 52 - struct hwspinlock_pdata { 53 - int base_id; 54 - }; 55 - 56 28 #ifdef CONFIG_HWSPINLOCK 57 29 58 30 int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,