Re: [PATCH 1/4] mfd: wm5110: Make DSP memories readable

2013-11-20 Thread Lee Jones
On Tue, 19 Nov 2013, Charles Keepax wrote:

> Expose the memory regions used by the DSP cores on WM5110 as readable
> and volatile.
> 
> Signed-off-by: Charles Keepax 
> ---
>  drivers/mfd/wm5110-tables.c |   69 --
>  1 files changed, 65 insertions(+), 4 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] mfd: wm5110: Make DSP memories readable

2013-11-20 Thread Lee Jones
On Tue, 19 Nov 2013, Charles Keepax wrote:

 Expose the memory regions used by the DSP cores on WM5110 as readable
 and volatile.
 
 Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
 ---
  drivers/mfd/wm5110-tables.c |   69 --
  1 files changed, 65 insertions(+), 4 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] mfd: wm5110: Make DSP memories readable

2013-11-19 Thread Charles Keepax
Expose the memory regions used by the DSP cores on WM5110 as readable
and volatile.

Signed-off-by: Charles Keepax 
---
 drivers/mfd/wm5110-tables.c |   69 --
 1 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index 3113e39..4430404 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 
 #include "arizona.h"
 
@@ -1336,6 +1337,64 @@ static const struct reg_default wm5110_reg_default[] = {
{ 0x1404, 0x },/* R5124  - DSP4 Status 1 */
 };
 
+static bool wm5110_is_rev_b_adsp_memory(unsigned int reg)
+{
+   if ((reg >= 0x10 && reg < 0x103000) ||
+   (reg >= 0x18 && reg < 0x181000) ||
+   (reg >= 0x19 && reg < 0x192000) ||
+   (reg >= 0x1a8000 && reg < 0x1a9000) ||
+   (reg >= 0x20 && reg < 0x209000) ||
+   (reg >= 0x28 && reg < 0x281000) ||
+   (reg >= 0x29 && reg < 0x29a000) ||
+   (reg >= 0x2a8000 && reg < 0x2aa000) ||
+   (reg >= 0x30 && reg < 0x30f000) ||
+   (reg >= 0x38 && reg < 0x382000) ||
+   (reg >= 0x39 && reg < 0x39e000) ||
+   (reg >= 0x3a8000 && reg < 0x3b6000) ||
+   (reg >= 0x40 && reg < 0x403000) ||
+   (reg >= 0x48 && reg < 0x481000) ||
+   (reg >= 0x49 && reg < 0x492000) ||
+   (reg >= 0x4a8000 && reg < 0x4a9000))
+   return true;
+   else
+   return false;
+}
+
+static bool wm5110_is_rev_d_adsp_memory(unsigned int reg)
+{
+   if ((reg >= 0x10 && reg < 0x106000) ||
+   (reg >= 0x18 && reg < 0x182000) ||
+   (reg >= 0x19 && reg < 0x198000) ||
+   (reg >= 0x1a8000 && reg < 0x1aa000) ||
+   (reg >= 0x20 && reg < 0x20f000) ||
+   (reg >= 0x28 && reg < 0x282000) ||
+   (reg >= 0x29 && reg < 0x29c000) ||
+   (reg >= 0x2a6000 && reg < 0x2b4000) ||
+   (reg >= 0x30 && reg < 0x30f000) ||
+   (reg >= 0x38 && reg < 0x382000) ||
+   (reg >= 0x39 && reg < 0x3a2000) ||
+   (reg >= 0x3a6000 && reg < 0x3b4000) ||
+   (reg >= 0x40 && reg < 0x406000) ||
+   (reg >= 0x48 && reg < 0x482000) ||
+   (reg >= 0x49 && reg < 0x498000) ||
+   (reg >= 0x4a8000 && reg < 0x4aa000))
+   return true;
+   else
+   return false;
+}
+
+static bool wm5110_is_adsp_memory(struct device *dev, unsigned int reg)
+{
+   struct arizona *arizona = dev_get_drvdata(dev);
+
+   switch (arizona->rev) {
+   case 0 ... 2:
+   return wm5110_is_rev_b_adsp_memory(reg);
+   default:
+   return wm5110_is_rev_d_adsp_memory(reg);
+   }
+}
+
 static bool wm5110_readable_register(struct device *dev, unsigned int reg)
 {
switch (reg) {
@@ -2308,7 +2367,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_DSP4_STATUS_3:
return true;
default:
-   return false;
+   return wm5110_is_adsp_memory(dev, reg);
}
 }
 
@@ -2368,16 +2427,18 @@ static bool wm5110_volatile_register(struct device 
*dev, unsigned int reg)
case ARIZONA_DSP4_STATUS_3:
return true;
default:
-   return false;
+   return wm5110_is_adsp_memory(dev, reg);
}
 }
 
+#define WM5110_MAX_REGISTER 0x4a9fff
+
 const struct regmap_config wm5110_spi_regmap = {
.reg_bits = 32,
.pad_bits = 16,
.val_bits = 16,
 
-   .max_register = ARIZONA_DSP1_STATUS_2,
+   .max_register = WM5110_MAX_REGISTER,
.readable_reg = wm5110_readable_register,
.volatile_reg = wm5110_volatile_register,
 
@@ -2391,7 +2452,7 @@ const struct regmap_config wm5110_i2c_regmap = {
.reg_bits = 32,
.val_bits = 16,
 
-   .max_register = ARIZONA_DSP1_STATUS_2,
+   .max_register = WM5110_MAX_REGISTER,
.readable_reg = wm5110_readable_register,
.volatile_reg = wm5110_volatile_register,
 
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] mfd: wm5110: Make DSP memories readable

2013-11-19 Thread Charles Keepax
Expose the memory regions used by the DSP cores on WM5110 as readable
and volatile.

Signed-off-by: Charles Keepax 
---
 drivers/mfd/wm5110-tables.c |   69 --
 1 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index 3113e39..4430404 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 
 #include "arizona.h"
 
@@ -1336,6 +1337,64 @@ static const struct reg_default wm5110_reg_default[] = {
{ 0x1404, 0x },/* R5124  - DSP4 Status 1 */
 };
 
+static bool wm5110_is_rev_b_adsp_memory(unsigned int reg)
+{
+   if ((reg >= 0x10 && reg < 0x103000) ||
+   (reg >= 0x18 && reg < 0x181000) ||
+   (reg >= 0x19 && reg < 0x192000) ||
+   (reg >= 0x1a8000 && reg < 0x1a9000) ||
+   (reg >= 0x20 && reg < 0x209000) ||
+   (reg >= 0x28 && reg < 0x281000) ||
+   (reg >= 0x29 && reg < 0x29a000) ||
+   (reg >= 0x2a8000 && reg < 0x2aa000) ||
+   (reg >= 0x30 && reg < 0x30f000) ||
+   (reg >= 0x38 && reg < 0x382000) ||
+   (reg >= 0x39 && reg < 0x39e000) ||
+   (reg >= 0x3a8000 && reg < 0x3b6000) ||
+   (reg >= 0x40 && reg < 0x403000) ||
+   (reg >= 0x48 && reg < 0x481000) ||
+   (reg >= 0x49 && reg < 0x492000) ||
+   (reg >= 0x4a8000 && reg < 0x4a9000))
+   return true;
+   else
+   return false;
+}
+
+static bool wm5110_is_rev_d_adsp_memory(unsigned int reg)
+{
+   if ((reg >= 0x10 && reg < 0x106000) ||
+   (reg >= 0x18 && reg < 0x182000) ||
+   (reg >= 0x19 && reg < 0x198000) ||
+   (reg >= 0x1a8000 && reg < 0x1aa000) ||
+   (reg >= 0x20 && reg < 0x20f000) ||
+   (reg >= 0x28 && reg < 0x282000) ||
+   (reg >= 0x29 && reg < 0x29c000) ||
+   (reg >= 0x2a6000 && reg < 0x2b4000) ||
+   (reg >= 0x30 && reg < 0x30f000) ||
+   (reg >= 0x38 && reg < 0x382000) ||
+   (reg >= 0x39 && reg < 0x3a2000) ||
+   (reg >= 0x3a6000 && reg < 0x3b4000) ||
+   (reg >= 0x40 && reg < 0x406000) ||
+   (reg >= 0x48 && reg < 0x482000) ||
+   (reg >= 0x49 && reg < 0x498000) ||
+   (reg >= 0x4a8000 && reg < 0x4aa000))
+   return true;
+   else
+   return false;
+}
+
+static bool wm5110_is_adsp_memory(struct device *dev, unsigned int reg)
+{
+   struct arizona *arizona = dev_get_drvdata(dev);
+
+   switch (arizona->rev) {
+   case 0 ... 2:
+   return wm5110_is_rev_b_adsp_memory(reg);
+   default:
+   return wm5110_is_rev_d_adsp_memory(reg);
+   }
+}
+
 static bool wm5110_readable_register(struct device *dev, unsigned int reg)
 {
switch (reg) {
@@ -2308,7 +2367,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_DSP4_STATUS_3:
return true;
default:
-   return false;
+   return wm5110_is_adsp_memory(dev, reg);
}
 }
 
@@ -2368,16 +2427,18 @@ static bool wm5110_volatile_register(struct device 
*dev, unsigned int reg)
case ARIZONA_DSP4_STATUS_3:
return true;
default:
-   return false;
+   return wm5110_is_adsp_memory(dev, reg);
}
 }
 
+#define WM5110_MAX_REGISTER 0x4a9fff
+
 const struct regmap_config wm5110_spi_regmap = {
.reg_bits = 32,
.pad_bits = 16,
.val_bits = 16,
 
-   .max_register = ARIZONA_DSP1_STATUS_2,
+   .max_register = WM5110_MAX_REGISTER,
.readable_reg = wm5110_readable_register,
.volatile_reg = wm5110_volatile_register,
 
@@ -2391,7 +2452,7 @@ const struct regmap_config wm5110_i2c_regmap = {
.reg_bits = 32,
.val_bits = 16,
 
-   .max_register = ARIZONA_DSP1_STATUS_2,
+   .max_register = WM5110_MAX_REGISTER,
.readable_reg = wm5110_readable_register,
.volatile_reg = wm5110_volatile_register,
 
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] mfd: wm5110: Make DSP memories readable

2013-11-19 Thread Charles Keepax
Expose the memory regions used by the DSP cores on WM5110 as readable
and volatile.

Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
---
 drivers/mfd/wm5110-tables.c |   69 --
 1 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index 3113e39..4430404 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -14,6 +14,7 @@
 
 #include linux/mfd/arizona/core.h
 #include linux/mfd/arizona/registers.h
+#include linux/device.h
 
 #include arizona.h
 
@@ -1336,6 +1337,64 @@ static const struct reg_default wm5110_reg_default[] = {
{ 0x1404, 0x },/* R5124  - DSP4 Status 1 */
 };
 
+static bool wm5110_is_rev_b_adsp_memory(unsigned int reg)
+{
+   if ((reg = 0x10  reg  0x103000) ||
+   (reg = 0x18  reg  0x181000) ||
+   (reg = 0x19  reg  0x192000) ||
+   (reg = 0x1a8000  reg  0x1a9000) ||
+   (reg = 0x20  reg  0x209000) ||
+   (reg = 0x28  reg  0x281000) ||
+   (reg = 0x29  reg  0x29a000) ||
+   (reg = 0x2a8000  reg  0x2aa000) ||
+   (reg = 0x30  reg  0x30f000) ||
+   (reg = 0x38  reg  0x382000) ||
+   (reg = 0x39  reg  0x39e000) ||
+   (reg = 0x3a8000  reg  0x3b6000) ||
+   (reg = 0x40  reg  0x403000) ||
+   (reg = 0x48  reg  0x481000) ||
+   (reg = 0x49  reg  0x492000) ||
+   (reg = 0x4a8000  reg  0x4a9000))
+   return true;
+   else
+   return false;
+}
+
+static bool wm5110_is_rev_d_adsp_memory(unsigned int reg)
+{
+   if ((reg = 0x10  reg  0x106000) ||
+   (reg = 0x18  reg  0x182000) ||
+   (reg = 0x19  reg  0x198000) ||
+   (reg = 0x1a8000  reg  0x1aa000) ||
+   (reg = 0x20  reg  0x20f000) ||
+   (reg = 0x28  reg  0x282000) ||
+   (reg = 0x29  reg  0x29c000) ||
+   (reg = 0x2a6000  reg  0x2b4000) ||
+   (reg = 0x30  reg  0x30f000) ||
+   (reg = 0x38  reg  0x382000) ||
+   (reg = 0x39  reg  0x3a2000) ||
+   (reg = 0x3a6000  reg  0x3b4000) ||
+   (reg = 0x40  reg  0x406000) ||
+   (reg = 0x48  reg  0x482000) ||
+   (reg = 0x49  reg  0x498000) ||
+   (reg = 0x4a8000  reg  0x4aa000))
+   return true;
+   else
+   return false;
+}
+
+static bool wm5110_is_adsp_memory(struct device *dev, unsigned int reg)
+{
+   struct arizona *arizona = dev_get_drvdata(dev);
+
+   switch (arizona-rev) {
+   case 0 ... 2:
+   return wm5110_is_rev_b_adsp_memory(reg);
+   default:
+   return wm5110_is_rev_d_adsp_memory(reg);
+   }
+}
+
 static bool wm5110_readable_register(struct device *dev, unsigned int reg)
 {
switch (reg) {
@@ -2308,7 +2367,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_DSP4_STATUS_3:
return true;
default:
-   return false;
+   return wm5110_is_adsp_memory(dev, reg);
}
 }
 
@@ -2368,16 +2427,18 @@ static bool wm5110_volatile_register(struct device 
*dev, unsigned int reg)
case ARIZONA_DSP4_STATUS_3:
return true;
default:
-   return false;
+   return wm5110_is_adsp_memory(dev, reg);
}
 }
 
+#define WM5110_MAX_REGISTER 0x4a9fff
+
 const struct regmap_config wm5110_spi_regmap = {
.reg_bits = 32,
.pad_bits = 16,
.val_bits = 16,
 
-   .max_register = ARIZONA_DSP1_STATUS_2,
+   .max_register = WM5110_MAX_REGISTER,
.readable_reg = wm5110_readable_register,
.volatile_reg = wm5110_volatile_register,
 
@@ -2391,7 +2452,7 @@ const struct regmap_config wm5110_i2c_regmap = {
.reg_bits = 32,
.val_bits = 16,
 
-   .max_register = ARIZONA_DSP1_STATUS_2,
+   .max_register = WM5110_MAX_REGISTER,
.readable_reg = wm5110_readable_register,
.volatile_reg = wm5110_volatile_register,
 
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] mfd: wm5110: Make DSP memories readable

2013-11-19 Thread Charles Keepax
Expose the memory regions used by the DSP cores on WM5110 as readable
and volatile.

Signed-off-by: Charles Keepax ckee...@opensource.wolfsonmicro.com
---
 drivers/mfd/wm5110-tables.c |   69 --
 1 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c
index 3113e39..4430404 100644
--- a/drivers/mfd/wm5110-tables.c
+++ b/drivers/mfd/wm5110-tables.c
@@ -14,6 +14,7 @@
 
 #include linux/mfd/arizona/core.h
 #include linux/mfd/arizona/registers.h
+#include linux/device.h
 
 #include arizona.h
 
@@ -1336,6 +1337,64 @@ static const struct reg_default wm5110_reg_default[] = {
{ 0x1404, 0x },/* R5124  - DSP4 Status 1 */
 };
 
+static bool wm5110_is_rev_b_adsp_memory(unsigned int reg)
+{
+   if ((reg = 0x10  reg  0x103000) ||
+   (reg = 0x18  reg  0x181000) ||
+   (reg = 0x19  reg  0x192000) ||
+   (reg = 0x1a8000  reg  0x1a9000) ||
+   (reg = 0x20  reg  0x209000) ||
+   (reg = 0x28  reg  0x281000) ||
+   (reg = 0x29  reg  0x29a000) ||
+   (reg = 0x2a8000  reg  0x2aa000) ||
+   (reg = 0x30  reg  0x30f000) ||
+   (reg = 0x38  reg  0x382000) ||
+   (reg = 0x39  reg  0x39e000) ||
+   (reg = 0x3a8000  reg  0x3b6000) ||
+   (reg = 0x40  reg  0x403000) ||
+   (reg = 0x48  reg  0x481000) ||
+   (reg = 0x49  reg  0x492000) ||
+   (reg = 0x4a8000  reg  0x4a9000))
+   return true;
+   else
+   return false;
+}
+
+static bool wm5110_is_rev_d_adsp_memory(unsigned int reg)
+{
+   if ((reg = 0x10  reg  0x106000) ||
+   (reg = 0x18  reg  0x182000) ||
+   (reg = 0x19  reg  0x198000) ||
+   (reg = 0x1a8000  reg  0x1aa000) ||
+   (reg = 0x20  reg  0x20f000) ||
+   (reg = 0x28  reg  0x282000) ||
+   (reg = 0x29  reg  0x29c000) ||
+   (reg = 0x2a6000  reg  0x2b4000) ||
+   (reg = 0x30  reg  0x30f000) ||
+   (reg = 0x38  reg  0x382000) ||
+   (reg = 0x39  reg  0x3a2000) ||
+   (reg = 0x3a6000  reg  0x3b4000) ||
+   (reg = 0x40  reg  0x406000) ||
+   (reg = 0x48  reg  0x482000) ||
+   (reg = 0x49  reg  0x498000) ||
+   (reg = 0x4a8000  reg  0x4aa000))
+   return true;
+   else
+   return false;
+}
+
+static bool wm5110_is_adsp_memory(struct device *dev, unsigned int reg)
+{
+   struct arizona *arizona = dev_get_drvdata(dev);
+
+   switch (arizona-rev) {
+   case 0 ... 2:
+   return wm5110_is_rev_b_adsp_memory(reg);
+   default:
+   return wm5110_is_rev_d_adsp_memory(reg);
+   }
+}
+
 static bool wm5110_readable_register(struct device *dev, unsigned int reg)
 {
switch (reg) {
@@ -2308,7 +2367,7 @@ static bool wm5110_readable_register(struct device *dev, 
unsigned int reg)
case ARIZONA_DSP4_STATUS_3:
return true;
default:
-   return false;
+   return wm5110_is_adsp_memory(dev, reg);
}
 }
 
@@ -2368,16 +2427,18 @@ static bool wm5110_volatile_register(struct device 
*dev, unsigned int reg)
case ARIZONA_DSP4_STATUS_3:
return true;
default:
-   return false;
+   return wm5110_is_adsp_memory(dev, reg);
}
 }
 
+#define WM5110_MAX_REGISTER 0x4a9fff
+
 const struct regmap_config wm5110_spi_regmap = {
.reg_bits = 32,
.pad_bits = 16,
.val_bits = 16,
 
-   .max_register = ARIZONA_DSP1_STATUS_2,
+   .max_register = WM5110_MAX_REGISTER,
.readable_reg = wm5110_readable_register,
.volatile_reg = wm5110_volatile_register,
 
@@ -2391,7 +2452,7 @@ const struct regmap_config wm5110_i2c_regmap = {
.reg_bits = 32,
.val_bits = 16,
 
-   .max_register = ARIZONA_DSP1_STATUS_2,
+   .max_register = WM5110_MAX_REGISTER,
.readable_reg = wm5110_readable_register,
.volatile_reg = wm5110_volatile_register,
 
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/