All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] bcma: inform drivers about translation bits needed for the board
@ 2011-07-19  8:05 ` Rafał Miłecki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-07-19  8:05 UTC (permalink / raw)
  To: linux-wireless, John W. Linville
  Cc: b43-dev, Pavel Roskin, Rafał Miłecki

When using DMA, drivers need to pass special translation info to the
hardware.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/bcma/main.c       |   12 ++++++++++++
 include/linux/bcma/bcma.h |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 873e2e4..660288c 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -164,6 +164,18 @@ int bcma_bus_register(struct bcma_bus *bus)
 	return 0;
 }
 
+u32 bcma_dma_translation(struct bcma_bus *bus)
+{
+	switch (bus->hosttype) {
+	case BCMA_HOSTTYPE_PCI:
+		return 0x40000000;
+	default:
+		pr_err("DMA translation unknown for host %d\n", bus->hosttype);
+	}
+	return 0;
+}
+EXPORT_SYMBOL(bcma_dma_translation);
+
 void bcma_bus_unregister(struct bcma_bus *bus)
 {
 	bcma_unregister_cores(bus);
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index cc1582d..921671b 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -255,6 +255,8 @@ void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
 #define bcma_maskset32(cc, offset, mask, set) \
 	bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set))
 
+extern u32 bcma_dma_translation(struct bcma_bus *bus);
+
 extern bool bcma_core_is_enabled(struct bcma_device *core);
 extern void bcma_core_disable(struct bcma_device *core, u32 flags);
 extern int bcma_core_enable(struct bcma_device *core, u32 flags);
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/2] bcma: inform drivers about translation bits needed for the board
@ 2011-07-19  8:05 ` Rafał Miłecki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-07-19  8:05 UTC (permalink / raw)
  To: linux-wireless, John W. Linville
  Cc: b43-dev, Pavel Roskin, Rafał Miłecki

When using DMA, drivers need to pass special translation info to the
hardware.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/bcma/main.c       |   12 ++++++++++++
 include/linux/bcma/bcma.h |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 873e2e4..660288c 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -164,6 +164,18 @@ int bcma_bus_register(struct bcma_bus *bus)
 	return 0;
 }
 
+u32 bcma_dma_translation(struct bcma_bus *bus)
+{
+	switch (bus->hosttype) {
+	case BCMA_HOSTTYPE_PCI:
+		return 0x40000000;
+	default:
+		pr_err("DMA translation unknown for host %d\n", bus->hosttype);
+	}
+	return 0;
+}
+EXPORT_SYMBOL(bcma_dma_translation);
+
 void bcma_bus_unregister(struct bcma_bus *bus)
 {
 	bcma_unregister_cores(bus);
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index cc1582d..921671b 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -255,6 +255,8 @@ void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
 #define bcma_maskset32(cc, offset, mask, set) \
 	bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set))
 
+extern u32 bcma_dma_translation(struct bcma_bus *bus);
+
 extern bool bcma_core_is_enabled(struct bcma_device *core);
 extern void bcma_core_disable(struct bcma_device *core, u32 flags);
 extern int bcma_core_enable(struct bcma_device *core, u32 flags);
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] b43: bcma: get DMA translation bits
  2011-07-19  8:05 ` Rafał Miłecki
@ 2011-07-19  8:05   ` Rafał Miłecki
  -1 siblings, 0 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-07-19  8:05 UTC (permalink / raw)
  To: linux-wireless, John W. Linville
  Cc: b43-dev, Pavel Roskin, Rafał Miłecki

Add some missing defines by the way.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/dma.c |    5 +++++
 drivers/net/wireless/b43/dma.h |    4 ++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index ce572ae..0bedc30 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1057,6 +1057,11 @@ int b43_dma_init(struct b43_wldev *dev)
 		return err;
 
 	switch (dev->dev->bus_type) {
+#ifdef CONFIG_B43_BCMA
+	case B43_BUS_BCMA:
+		dma->translation = bcma_dma_translation(dev->dev->bdev->bus);
+		break;
+#endif
 #ifdef CONFIG_B43_SSB
 	case B43_BUS_SSB:
 		dma->translation = ssb_dma_translation(dev->dev->sdev);
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
index e8a80a1..cdf8709 100644
--- a/drivers/net/wireless/b43/dma.h
+++ b/drivers/net/wireless/b43/dma.h
@@ -20,6 +20,7 @@
 #define		B43_DMA32_TXSUSPEND			0x00000002
 #define		B43_DMA32_TXLOOPBACK		0x00000004
 #define		B43_DMA32_TXFLUSH			0x00000010
+#define		B43_DMA32_TXPARITYDISABLE		0x00000800
 #define		B43_DMA32_TXADDREXT_MASK		0x00030000
 #define		B43_DMA32_TXADDREXT_SHIFT		16
 #define B43_DMA32_TXRING				0x04
@@ -44,6 +45,7 @@
 #define		B43_DMA32_RXFROFF_MASK		0x000000FE
 #define		B43_DMA32_RXFROFF_SHIFT		1
 #define		B43_DMA32_RXDIRECTFIFO		0x00000100
+#define		B43_DMA32_RXPARITYDISABLE		0x00000800
 #define		B43_DMA32_RXADDREXT_MASK		0x00030000
 #define		B43_DMA32_RXADDREXT_SHIFT		16
 #define B43_DMA32_RXRING				0x14
@@ -84,6 +86,7 @@ struct b43_dmadesc32 {
 #define		B43_DMA64_TXSUSPEND			0x00000002
 #define		B43_DMA64_TXLOOPBACK		0x00000004
 #define		B43_DMA64_TXFLUSH			0x00000010
+#define		B43_DMA64_TXPARITYDISABLE		0x00000800
 #define		B43_DMA64_TXADDREXT_MASK		0x00030000
 #define		B43_DMA64_TXADDREXT_SHIFT		16
 #define B43_DMA64_TXINDEX				0x04
@@ -111,6 +114,7 @@ struct b43_dmadesc32 {
 #define		B43_DMA64_RXFROFF_MASK		0x000000FE
 #define		B43_DMA64_RXFROFF_SHIFT		1
 #define		B43_DMA64_RXDIRECTFIFO		0x00000100
+#define		B43_DMA64_RXPARITYDISABLE		0x00000800
 #define		B43_DMA64_RXADDREXT_MASK		0x00030000
 #define		B43_DMA64_RXADDREXT_SHIFT		16
 #define B43_DMA64_RXINDEX				0x24
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] b43: bcma: get DMA translation bits
@ 2011-07-19  8:05   ` Rafał Miłecki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-07-19  8:05 UTC (permalink / raw)
  To: linux-wireless, John W. Linville
  Cc: b43-dev, Pavel Roskin, Rafał Miłecki

Add some missing defines by the way.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/dma.c |    5 +++++
 drivers/net/wireless/b43/dma.h |    4 ++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index ce572ae..0bedc30 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1057,6 +1057,11 @@ int b43_dma_init(struct b43_wldev *dev)
 		return err;
 
 	switch (dev->dev->bus_type) {
+#ifdef CONFIG_B43_BCMA
+	case B43_BUS_BCMA:
+		dma->translation = bcma_dma_translation(dev->dev->bdev->bus);
+		break;
+#endif
 #ifdef CONFIG_B43_SSB
 	case B43_BUS_SSB:
 		dma->translation = ssb_dma_translation(dev->dev->sdev);
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
index e8a80a1..cdf8709 100644
--- a/drivers/net/wireless/b43/dma.h
+++ b/drivers/net/wireless/b43/dma.h
@@ -20,6 +20,7 @@
 #define		B43_DMA32_TXSUSPEND			0x00000002
 #define		B43_DMA32_TXLOOPBACK		0x00000004
 #define		B43_DMA32_TXFLUSH			0x00000010
+#define		B43_DMA32_TXPARITYDISABLE		0x00000800
 #define		B43_DMA32_TXADDREXT_MASK		0x00030000
 #define		B43_DMA32_TXADDREXT_SHIFT		16
 #define B43_DMA32_TXRING				0x04
@@ -44,6 +45,7 @@
 #define		B43_DMA32_RXFROFF_MASK		0x000000FE
 #define		B43_DMA32_RXFROFF_SHIFT		1
 #define		B43_DMA32_RXDIRECTFIFO		0x00000100
+#define		B43_DMA32_RXPARITYDISABLE		0x00000800
 #define		B43_DMA32_RXADDREXT_MASK		0x00030000
 #define		B43_DMA32_RXADDREXT_SHIFT		16
 #define B43_DMA32_RXRING				0x14
@@ -84,6 +86,7 @@ struct b43_dmadesc32 {
 #define		B43_DMA64_TXSUSPEND			0x00000002
 #define		B43_DMA64_TXLOOPBACK		0x00000004
 #define		B43_DMA64_TXFLUSH			0x00000010
+#define		B43_DMA64_TXPARITYDISABLE		0x00000800
 #define		B43_DMA64_TXADDREXT_MASK		0x00030000
 #define		B43_DMA64_TXADDREXT_SHIFT		16
 #define B43_DMA64_TXINDEX				0x04
@@ -111,6 +114,7 @@ struct b43_dmadesc32 {
 #define		B43_DMA64_RXFROFF_MASK		0x000000FE
 #define		B43_DMA64_RXFROFF_SHIFT		1
 #define		B43_DMA64_RXDIRECTFIFO		0x00000100
+#define		B43_DMA64_RXPARITYDISABLE		0x00000800
 #define		B43_DMA64_RXADDREXT_MASK		0x00030000
 #define		B43_DMA64_RXADDREXT_SHIFT		16
 #define B43_DMA64_RXINDEX				0x24
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] bcma: inform drivers about translation bits needed for the board
  2011-07-19  8:05 ` Rafał Miłecki
  (?)
  (?)
@ 2011-07-19 14:38 ` Pavel Roskin
  2011-07-19 17:14     ` Rafał Miłecki
  -1 siblings, 1 reply; 10+ messages in thread
From: Pavel Roskin @ 2011-07-19 14:38 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev

On 07/19/2011 04:05 AM, Rafał Miłecki wrote:
> When using DMA, drivers need to pass special translation info to the
> hardware.
>
> Signed-off-by: Rafał Miłecki<zajec5@gmail.com>

I'm not sure why you are copying it to me.

> +	switch (bus->hosttype) {
> +	case BCMA_HOSTTYPE_PCI:
> +		return 0x40000000;

This is already implemented in ssb_dma_translation(), and the constant 
is called SSB_PCI_DMA.  I think we need a named constant here as well, 
either SSB_PCI_DMA or a new constant BCMA_PCI_DMA.

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] b43: bcma: get DMA translation bits
  2011-07-19  8:05   ` Rafał Miłecki
  (?)
@ 2011-07-19 14:52   ` Pavel Roskin
  2011-07-19 18:46       ` Rafał Miłecki
  -1 siblings, 1 reply; 10+ messages in thread
From: Pavel Roskin @ 2011-07-19 14:52 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev

On 07/19/2011 04:05 AM, Rafał Miłecki wrote:

> +#ifdef CONFIG_B43_BCMA
> +	case B43_BUS_BCMA:
> +		dma->translation = bcma_dma_translation(dev->dev->bdev->bus);
> +		break;
> +#endif

How about we set dma->translation to 0x40000000 for 32-bit DMA and to 
0x80000000 for 64-bit DMA and remove shifting translation by 1 in the 
64-bit DMA code?  There should be a warning for non-PCI devices here. 
No ifdefs, no separate treatment of different buses.

I think we are adding too much complexity here.

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] bcma: inform drivers about translation bits needed for the board
  2011-07-19 14:38 ` [PATCH 1/2] bcma: inform drivers about translation bits needed for the board Pavel Roskin
@ 2011-07-19 17:14     ` Rafał Miłecki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-07-19 17:14 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: linux-wireless, John W. Linville, b43-dev

W dniu 19 lipca 2011 16:38 u?ytkownik Pavel Roskin <proski@gnu.org> napisa?:
> On 07/19/2011 04:05 AM, Rafa? Mi?ecki wrote:
>>
>> When using DMA, drivers need to pass special translation info to the
>> hardware.
>>
>> Signed-off-by: Rafa? Mi?ecki<zajec5@gmail.com>
>
> I'm not sure why you are copying it to me.

Upd, I've used bash history and the last send-email was with --cc to you.


>> + ? ? ? switch (bus->hosttype) {
>> + ? ? ? case BCMA_HOSTTYPE_PCI:
>> + ? ? ? ? ? ? ? return 0x40000000;
>
> This is already implemented in ssb_dma_translation(), and the constant is
> called SSB_PCI_DMA. ?I think we need a named constant here as well, either
> SSB_PCI_DMA or a new constant BCMA_PCI_DMA.


-- 
Rafa?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] bcma: inform drivers about translation bits needed for the board
@ 2011-07-19 17:14     ` Rafał Miłecki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-07-19 17:14 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: linux-wireless, John W. Linville, b43-dev

W dniu 19 lipca 2011 16:38 użytkownik Pavel Roskin <proski@gnu.org> napisał:
> On 07/19/2011 04:05 AM, Rafał Miłecki wrote:
>>
>> When using DMA, drivers need to pass special translation info to the
>> hardware.
>>
>> Signed-off-by: Rafał Miłecki<zajec5@gmail.com>
>
> I'm not sure why you are copying it to me.

Upd, I've used bash history and the last send-email was with --cc to you.


>> +       switch (bus->hosttype) {
>> +       case BCMA_HOSTTYPE_PCI:
>> +               return 0x40000000;
>
> This is already implemented in ssb_dma_translation(), and the constant is
> called SSB_PCI_DMA.  I think we need a named constant here as well, either
> SSB_PCI_DMA or a new constant BCMA_PCI_DMA.


-- 
Rafał

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/2] b43: bcma: get DMA translation bits
  2011-07-19 14:52   ` Pavel Roskin
@ 2011-07-19 18:46       ` Rafał Miłecki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-07-19 18:46 UTC (permalink / raw)
  To: Pavel Roskin, Larry Finger; +Cc: linux-wireless, John W. Linville, b43-dev

W dniu 19 lipca 2011 16:52 u?ytkownik Pavel Roskin <proski@gnu.org> napisa?:
> On 07/19/2011 04:05 AM, Rafa? Mi?ecki wrote:
>
>> +#ifdef CONFIG_B43_BCMA
>> + ? ? ? case B43_BUS_BCMA:
>> + ? ? ? ? ? ? ? dma->translation =
>> bcma_dma_translation(dev->dev->bdev->bus);
>> + ? ? ? ? ? ? ? break;
>> +#endif
>
> How about we set dma->translation to 0x40000000 for 32-bit DMA and to
> 0x80000000 for 64-bit DMA and remove shifting translation by 1 in the 64-bit
> DMA code? ?There should be a warning for non-PCI devices here. No ifdefs, no
> separate treatment of different buses.
>
> I think we are adding too much complexity here.

Warning is generated on bcma_dma_translation side. We could make that
function return s32 and return negative values of error, but not sure
if it's worth it. We will get warning anyway.

After checking specs (http://bcm-v4.sipsolutions.net/802.11/DMA) I've
to agree that our shifting looks crazy. Probably ssb function was
implemented and someone added 64-bit DMA support without modifying
ssb.

There is no reason to shift value by 1. Routing mask is always
0xC0000000. It's just about different values:
DMA32: 0x1 == Client Mode Translation (1GB)
DMA64: 0x2 == Client Mode Translation (2 Zettabytes)


Well, I've to say it was really worth to CC you :)

-- 
Rafa?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] b43: bcma: get DMA translation bits
@ 2011-07-19 18:46       ` Rafał Miłecki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafał Miłecki @ 2011-07-19 18:46 UTC (permalink / raw)
  To: Pavel Roskin, Larry Finger; +Cc: linux-wireless, John W. Linville, b43-dev

W dniu 19 lipca 2011 16:52 użytkownik Pavel Roskin <proski@gnu.org> napisał:
> On 07/19/2011 04:05 AM, Rafał Miłecki wrote:
>
>> +#ifdef CONFIG_B43_BCMA
>> +       case B43_BUS_BCMA:
>> +               dma->translation =
>> bcma_dma_translation(dev->dev->bdev->bus);
>> +               break;
>> +#endif
>
> How about we set dma->translation to 0x40000000 for 32-bit DMA and to
> 0x80000000 for 64-bit DMA and remove shifting translation by 1 in the 64-bit
> DMA code?  There should be a warning for non-PCI devices here. No ifdefs, no
> separate treatment of different buses.
>
> I think we are adding too much complexity here.

Warning is generated on bcma_dma_translation side. We could make that
function return s32 and return negative values of error, but not sure
if it's worth it. We will get warning anyway.

After checking specs (http://bcm-v4.sipsolutions.net/802.11/DMA) I've
to agree that our shifting looks crazy. Probably ssb function was
implemented and someone added 64-bit DMA support without modifying
ssb.

There is no reason to shift value by 1. Routing mask is always
0xC0000000. It's just about different values:
DMA32: 0x1 == Client Mode Translation (1GB)
DMA64: 0x2 == Client Mode Translation (2 Zettabytes)


Well, I've to say it was really worth to CC you :)

-- 
Rafał

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-07-19 18:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-19  8:05 [PATCH 1/2] bcma: inform drivers about translation bits needed for the board Rafał Miłecki
2011-07-19  8:05 ` Rafał Miłecki
2011-07-19  8:05 ` [PATCH 2/2] b43: bcma: get DMA translation bits Rafał Miłecki
2011-07-19  8:05   ` Rafał Miłecki
2011-07-19 14:52   ` Pavel Roskin
2011-07-19 18:46     ` Rafał Miłecki
2011-07-19 18:46       ` Rafał Miłecki
2011-07-19 14:38 ` [PATCH 1/2] bcma: inform drivers about translation bits needed for the board Pavel Roskin
2011-07-19 17:14   ` Rafał Miłecki
2011-07-19 17:14     ` Rafał Miłecki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.