* [PATCH] reset: reset-socfpga: sync driver with linux
@ 2018-01-10 8:31 Steffen Trumtrar
2018-01-11 8:42 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Steffen Trumtrar @ 2018-01-10 8:31 UTC (permalink / raw)
To: barebox; +Cc: Steffen Trumtrar
Sync the SoCFPGA reset driver with Linux v4.14-rc1.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
drivers/reset/reset-socfpga.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index 9214197e627d..dd081ee84f72 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -22,12 +22,12 @@
#include <linux/spinlock.h>
#include <linux/types.h>
-#define NR_BANKS 4
+#define BANK_INCREMENT 4
+#define NR_BANKS 8
struct socfpga_reset_data {
spinlock_t lock;
void __iomem *membase;
- u32 modrst_offset;
struct reset_controller_dev rcdev;
};
@@ -44,9 +44,8 @@ static int socfpga_reset_assert(struct reset_controller_dev *rcdev,
spin_lock_irqsave(&data->lock, flags);
- reg = readl(data->membase + data->modrst_offset + (bank * NR_BANKS));
- writel(reg | BIT(offset), data->membase + data->modrst_offset +
- (bank * NR_BANKS));
+ reg = readl(data->membase + (bank * BANK_INCREMENT));
+ writel(reg | BIT(offset), data->membase + (bank * BANK_INCREMENT));
spin_unlock_irqrestore(&data->lock, flags);
return 0;
@@ -66,9 +65,8 @@ static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
spin_lock_irqsave(&data->lock, flags);
- reg = readl(data->membase + data->modrst_offset + (bank * NR_BANKS));
- writel(reg & ~BIT(offset), data->membase + data->modrst_offset +
- (bank * NR_BANKS));
+ reg = readl(data->membase + (bank * BANK_INCREMENT));
+ writel(reg & ~BIT(offset), data->membase + (bank * BANK_INCREMENT));
spin_unlock_irqrestore(&data->lock, flags);
@@ -85,6 +83,7 @@ static int socfpga_reset_probe(struct device_d *dev)
struct socfpga_reset_data *data;
struct resource *res;
struct device_node *np = dev->device_node;
+ u32 modrst_offset;
data = xzalloc(sizeof(*data));
@@ -93,10 +92,11 @@ static int socfpga_reset_probe(struct device_d *dev)
if (IS_ERR(data->membase))
return PTR_ERR(data->membase);
- if (of_property_read_u32(np, "altr,modrst-offset", &data->modrst_offset)) {
+ if (of_property_read_u32(np, "altr,modrst-offset", &modrst_offset)) {
dev_warn(dev, "missing altr,modrst-offset property, assuming 0x10!\n");
- data->modrst_offset = 0x10;
+ modrst_offset = 0x10;
}
+ data->membase += modrst_offset;
spin_lock_init(&data->lock);
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] reset: reset-socfpga: sync driver with linux
2018-01-10 8:31 [PATCH] reset: reset-socfpga: sync driver with linux Steffen Trumtrar
@ 2018-01-11 8:42 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2018-01-11 8:42 UTC (permalink / raw)
To: Steffen Trumtrar; +Cc: barebox
On Wed, Jan 10, 2018 at 09:31:21AM +0100, Steffen Trumtrar wrote:
> Sync the SoCFPGA reset driver with Linux v4.14-rc1.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
> drivers/reset/reset-socfpga.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
> index 9214197e627d..dd081ee84f72 100644
> --- a/drivers/reset/reset-socfpga.c
> +++ b/drivers/reset/reset-socfpga.c
> @@ -22,12 +22,12 @@
> #include <linux/spinlock.h>
> #include <linux/types.h>
>
> -#define NR_BANKS 4
> +#define BANK_INCREMENT 4
> +#define NR_BANKS 8
>
> struct socfpga_reset_data {
> spinlock_t lock;
> void __iomem *membase;
> - u32 modrst_offset;
> struct reset_controller_dev rcdev;
> };
>
> @@ -44,9 +44,8 @@ static int socfpga_reset_assert(struct reset_controller_dev *rcdev,
>
> spin_lock_irqsave(&data->lock, flags);
>
> - reg = readl(data->membase + data->modrst_offset + (bank * NR_BANKS));
> - writel(reg | BIT(offset), data->membase + data->modrst_offset +
> - (bank * NR_BANKS));
> + reg = readl(data->membase + (bank * BANK_INCREMENT));
> + writel(reg | BIT(offset), data->membase + (bank * BANK_INCREMENT));
> spin_unlock_irqrestore(&data->lock, flags);
>
> return 0;
> @@ -66,9 +65,8 @@ static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
>
> spin_lock_irqsave(&data->lock, flags);
>
> - reg = readl(data->membase + data->modrst_offset + (bank * NR_BANKS));
> - writel(reg & ~BIT(offset), data->membase + data->modrst_offset +
> - (bank * NR_BANKS));
> + reg = readl(data->membase + (bank * BANK_INCREMENT));
> + writel(reg & ~BIT(offset), data->membase + (bank * BANK_INCREMENT));
>
> spin_unlock_irqrestore(&data->lock, flags);
>
> @@ -85,6 +83,7 @@ static int socfpga_reset_probe(struct device_d *dev)
> struct socfpga_reset_data *data;
> struct resource *res;
> struct device_node *np = dev->device_node;
> + u32 modrst_offset;
>
> data = xzalloc(sizeof(*data));
>
> @@ -93,10 +92,11 @@ static int socfpga_reset_probe(struct device_d *dev)
> if (IS_ERR(data->membase))
> return PTR_ERR(data->membase);
>
> - if (of_property_read_u32(np, "altr,modrst-offset", &data->modrst_offset)) {
> + if (of_property_read_u32(np, "altr,modrst-offset", &modrst_offset)) {
> dev_warn(dev, "missing altr,modrst-offset property, assuming 0x10!\n");
> - data->modrst_offset = 0x10;
> + modrst_offset = 0x10;
> }
> + data->membase += modrst_offset;
>
> spin_lock_init(&data->lock);
>
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-11 8:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-10 8:31 [PATCH] reset: reset-socfpga: sync driver with linux Steffen Trumtrar
2018-01-11 8:42 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox