Skip to contentSkip to conversation

bcma: add Broadcom specific AMBA bus driver

PATCH Superseded Rafał Miłecki 10 participants 45 messages May 5, 2011 – May 9, 2011

Subsystems (2)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Rafał Miłecki

author maintainer
#0 lore raw

PATCH 1/1 bcma: add Broadcom specific AMBA bus driver

Cc Greg KH <[email protected]>
Cc Michael Büsch <[email protected]>
Cc Larry Finger <[email protected]>
Cc George Kashperko <[email protected]>
Cc Arend van Spriel <[email protected]>
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andy Botting <[email protected]>
Cc linuxdriverproject <[email protected]>

---
V2: Rename to axi
Use DEFINE_PCI_DEVICE_TABLE in bridge
Make use of pr_fmt and pr_*
Store core class
Rename bridge to not b43 specific
Replace magic 0x1000 with BCMAI_CORE_SIZE Remove some old "ssb" names and defines
Move BCMAI_ADDR_BASE def
Add drvdata field
V3: Fix reloading (kfree issue)
Add 14e4:0x4331
Fix non-initialized struct issue
Drop useless inline functions wrappers for pci core drv Proper pr_* usage
V3.1: Include forgotten changes (pr_* and include related)
Explain why we dare to implement empty release function
V4: Add ABI documentation
Move struct device to wrapper and alloc it dynamically checkpatch.pl pointed fixes
V5: Rename to bcma, AXI was really bad name
Use EXPORT_SYMBOL_GPL
Set pci driver fields in one place
Drop unlikely
Use BCMA_CORE_SIZE for calc in awrite32
Add README
Fix compilation (delay.h)

---
 Documentation/ABI/testing/sysfs-bus-bcma    |   31 ++
 drivers/Kconfig                             |    2 +
 drivers/Makefile                            |    1 +
 drivers/bcma/Kconfig                        |   33 +++
 drivers/bcma/Makefile                       |    7 +
 drivers/bcma/README                         |   18 ++
 drivers/bcma/TODO                           |    3 +
 drivers/bcma/bcma_private.h                 |   31 ++
 drivers/bcma/core.c                         |   51 ++++
 drivers/bcma/driver_chipcommon.c            |   87 ++++++
 drivers/bcma/driver_chipcommon_pmu.c        |  134 +++++++++
 drivers/bcma/driver_pci.c                   |  163 +++++++++++
 drivers/bcma/host_pci.c                     |  196 +++++++++++++
 drivers/bcma/main.c                         |  271 ++++++++++++++++++
 drivers/bcma/scan.c                         |  392 +++++++++++++++++++++++++++
 drivers/bcma/scan.h                         |   56 ++++
 include/linux/bcma/bcma.h                   |  232 ++++++++++++++++
 include/linux/bcma/bcma_driver_chipcommon.h |  297 ++++++++++++++++++++
 include/linux/bcma/bcma_driver_pci.h        |   89 ++++++
 include/linux/bcma/bcma_regs.h              |   34 +++
 include/linux/mod_devicetable.h             |   17 ++
 scripts/mod/file2alias.c                    |   22 ++
 22 files changed, 2167 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-bcma
 create mode 100644 drivers/bcma/Kconfig
 create mode 100644 drivers/bcma/Makefile
 create mode 100644 drivers/bcma/README
 create mode 100644 drivers/bcma/TODO
 create mode 100644 drivers/bcma/bcma_private.h
 create mode 100644 drivers/bcma/core.c
 create mode 100644 drivers/bcma/driver_chipcommon.c
 create mode 100644 drivers/bcma/driver_chipcommon_pmu.c
 create mode 100644 drivers/bcma/driver_pci.c
 create mode 100644 drivers/bcma/host_pci.c
 create mode 100644 drivers/bcma/main.c
 create mode 100644 drivers/bcma/scan.c
 create mode 100644 drivers/bcma/scan.h
 create mode 100644 include/linux/bcma/bcma.h
 create mode 100644 include/linux/bcma/bcma_driver_chipcommon.h
 create mode 100644 include/linux/bcma/bcma_driver_pci.h
 create mode 100644 include/linux/bcma/bcma_regs.h
Documentation/ABI/testing/sysfs-bus-bcma new file +31 -0
new file mode 100644
index 0000000..ad3cd69
@@ -0,0 +1,31 @@
+What:		/sys/bus/bcma/devices/.../class
+Date:		May 2011
+KernelVersion:	2.6.40
+Contact:	Rafał Miłecki <[email protected]>
+Description:
+		Each AXI core is identified by few fields, including class it
+		belongs to. See include/linux/bcma/bcma.h for possible values.
+
+What:		/sys/bus/bcma/devices/.../manuf
+Date:		May 2011
+KernelVersion:	2.6.40
+Contact:	Rafał Miłecki <[email protected]>
+Description:
+		Each AXI core has it's manufacturer id. See
+		include/linux/bcma/bcma.h for possible values.
+
+What:		/sys/bus/bcma/devices/.../rev
+Date:		May 2011
+KernelVersion:	2.6.40
+Contact:	Rafał Miłecki <[email protected]>
+Description:
+		AXI cores of the same type can still slightly differ depending
+		on their revision. Use it for detailed programming.
+
+What:		/sys/bus/bcma/devices/.../id
+Date:		May 2011
+KernelVersion:	2.6.40
+Contact:	Rafał Miłecki <[email protected]>
+Description:
+		There are a few types of AXI cores, they can be identified by
+		id field.
drivers/Kconfig +2 -0
index 177c7d1..aca7067 100644
@@ -68,6 +68,8 @@ source "drivers/watchdog/Kconfig"
 
 source "drivers/ssb/Kconfig"
 
+source "drivers/bcma/Kconfig"
+
 source "drivers/mfd/Kconfig"
 
 source "drivers/regulator/Kconfig"
drivers/Makefile +1 -0
index 3f135b6..a29527f 100644
@@ -110,6 +110,7 @@ obj-$(CONFIG_HID)		+= hid/
 obj-$(CONFIG_PPC_PS3)		+= ps3/
 obj-$(CONFIG_OF)		+= of/
 obj-$(CONFIG_SSB)		+= ssb/
+obj-$(CONFIG_BCMA)		+= bcma/
 obj-$(CONFIG_VHOST_NET)		+= vhost/
 obj-$(CONFIG_VLYNQ)		+= vlynq/
 obj-$(CONFIG_STAGING)		+= staging/
drivers/bcma/Kconfig new file +33 -0
new file mode 100644
index 0000000..353781b
@@ -0,0 +1,33 @@
+config BCMA_POSSIBLE
+	bool
+	depends on HAS_IOMEM && HAS_DMA
+	default y
+
+menu "Broadcom specific AMBA"
+	depends on BCMA_POSSIBLE
+
+config BCMA
+	tristate "BCMA support"
+	depends on BCMA_POSSIBLE
+	help
+	  Bus driver for Broadcom specific Advanced Microcontroller Bus
+	  Architecture.
+
+config BCMA_HOST_PCI_POSSIBLE
+	bool
+	depends on BCMA && PCI = y
+	default y
+
+config BCMA_HOST_PCI
+	bool "Support for BCMA on PCI-host bus"
+	depends on BCMA_HOST_PCI_POSSIBLE
+
+config BCMA_DEBUG
+	bool "BCMA debugging"
+	depends on BCMA
+	help
+	  This turns on additional debugging messages.
+
+	  If unsure, say N
+
+endmenu
drivers/bcma/Makefile new file +7 -0
new file mode 100644
index 0000000..0d56245
@@ -0,0 +1,7 @@
+bcma-y					+= main.o scan.o core.o
+bcma-y					+= driver_chipcommon.o driver_chipcommon_pmu.o
+bcma-y					+= driver_pci.o
+bcma-$(CONFIG_BCMA_HOST_PCI)		+= host_pci.o
+obj-$(CONFIG_BCMA)			+= bcma.o
+
+ccflags-$(CONFIG_BCMA_DEBUG)		:= -DDEBUG
drivers/bcma/README new file +18 -0
new file mode 100644
index 0000000..b52cd2b
@@ -0,0 +1,18 @@
+Broadcom introduced new bus as replacement for older SSB. It is based on AMBA,
+however from programming point of view there is nothing AMBA specific we use.
+
+Standard AMBA drivers are platform specific, have hardcoded addresses and use
+AMBA standard fields like CID and PID.
+
+In case of Broadcom's cards every device consists of:
+1) Broadcom specific AMBA device. It is put on AMBA bus, but can not be treated
+   as standard AMBA device. Reading it's CID or PID can cause machine lockup.
+2) AMBA standard devices called ports or wrappers. They have CIDs (AMBA_CID)
+   and PIDs (0x103BB369), but we do not use that info for anything. One of that
+   devices is used for managing Broadcom specific core.
+
+Addresses of AMBA devices are not hardcoded in driver and have to be read from
+EPROM.
+
+In this situation we decided to introduce separated bus with devices identified
+by Broadcom specific fields, read from EPROM.
drivers/bcma/TODO new file +3 -0
new file mode 100644
index 0000000..45eadc9
@@ -0,0 +1,3 @@
+- Interrupts
+- Defines for PCI core driver
+- Convert bcma_bus->cores into linked list
drivers/bcma/bcma_private.h new file +31 -0
new file mode 100644
index 0000000..2a55f3e
@@ -0,0 +1,31 @@
+#ifndef LINUX_BCMA_PRIVATE_H_
+#define LINUX_BCMA_PRIVATE_H_
+
+#ifndef pr_fmt
+#define pr_fmt(fmt)		KBUILD_MODNAME ": " fmt
+#endif
+
+#include <linux/bcma/bcma.h>
+#include <linux/delay.h>
+
+#define BCMA_ADDR_BASE		0x18000000
+#define BCMA_WRAP_BASE		0x18100000
+
+#define BCMA_CORE_SIZE		0x1000
+
+struct bcma_bus;
+
+/* main.c */
+extern int bcma_bus_register(struct bcma_bus *bus);
+extern void bcma_bus_unregister(struct bcma_bus *bus);
+
+/* scan.c */
+int bcma_bus_scan(struct bcma_bus *bus);
+
+#ifdef CONFIG_BCMA_HOST_PCI
+/* host_pci.c */
+extern int __init bcma_host_pci_init(void);
+extern void __exit bcma_host_pci_exit(void);
+#endif /* CONFIG_BCMA_HOST_PCI */
+
+#endif
drivers/bcma/core.c new file +51 -0

51 lines not on this page · raw message

drivers/bcma/driver_chipcommon.c new file +87 -0

87 lines not on this page · raw message

drivers/bcma/driver_chipcommon_pmu.c new file +134 -0

134 lines not on this page · raw message

drivers/bcma/driver_pci.c new file +163 -0

163 lines not on this page · raw message

drivers/bcma/host_pci.c new file +196 -0

196 lines not on this page · raw message

drivers/bcma/main.c new file +271 -0

271 lines not on this page · raw message

drivers/bcma/scan.c new file +392 -0

392 lines not on this page · raw message

drivers/bcma/scan.h new file +56 -0

56 lines not on this page · raw message

include/linux/bcma/bcma.h new file +232 -0

232 lines not on this page · raw message

include/linux/bcma/bcma_driver_chipcommon.h new file +297 -0

297 lines not on this page · raw message

include/linux/bcma/bcma_driver_pci.h new file +89 -0

89 lines not on this page · raw message

include/linux/bcma/bcma_regs.h new file +34 -0
new file mode 100644
index 0000000..f82d88a
@@ -0,0 +1,34 @@
+#ifndef LINUX_BCMA_REGS_H_
+#define LINUX_BCMA_REGS_H_
+
+/* Agent registers (common for every core) */
+#define BCMA_IOCTL			0x0408
+#define  BCMA_IOCTL_CLK			0x0001
+#define  BCMA_IOCTL_FGC			0x0002
+#define  BCMA_IOCTL_CORE_BITS		0x3FFC
+#define  BCMA_IOCTL_PME_EN		0x4000
+#define  BCMA_IOCTL_BIST_EN		0x8000
+#define BCMA_RESET_CTL			0x0800
+#define  BCMA_RESET_CTL_RESET		0x0001
+
+/* BCMA PCI config space registers. */
+#define BCMA_PCI_PMCSR			0x44
+#define  BCMA_PCI_PE			0x100
+#define BCMA_PCI_BAR0_WIN		0x80	/* Backplane address space 0 */
+#define BCMA_PCI_BAR1_WIN		0x84	/* Backplane address space 1 */
+#define BCMA_PCI_SPROMCTL		0x88	/* SPROM control */
+#define  BCMA_PCI_SPROMCTL_WE		0x10	/* SPROM write enable */
+#define BCMA_PCI_BAR1_CONTROL		0x8c	/* Address space 1 burst control */
+#define BCMA_PCI_IRQS			0x90	/* PCI interrupts */
+#define BCMA_PCI_IRQMASK		0x94	/* PCI IRQ control and mask (pcirev >= 6 only) */
+#define BCMA_PCI_BACKPLANE_IRQS		0x98	/* Backplane Interrupts */
+#define BCMA_PCI_BAR0_WIN2		0xAC
+#define BCMA_PCI_GPIO_IN		0xB0	/* GPIO Input (pcirev >= 3 only) */
+#define BCMA_PCI_GPIO_OUT		0xB4	/* GPIO Output (pcirev >= 3 only) */
+#define BCMA_PCI_GPIO_OUT_ENABLE	0xB8	/* GPIO Output Enable/Disable (pcirev >= 3 only) */
+#define  BCMA_PCI_GPIO_SCS		0x10	/* PCI config space bit 4 for 4306c0 slow clock source */
+#define  BCMA_PCI_GPIO_HWRAD		0x20	/* PCI config space GPIO 13 for hw radio disable */
+#define  BCMA_PCI_GPIO_XTAL		0x40	/* PCI config space GPIO 14 for Xtal powerup */
+#define  BCMA_PCI_GPIO_PLL		0x80	/* PCI config space GPIO 15 for PLL powerdown */
+
+#endif /* LINUX_BCMA_REGS_H_ */
include/linux/mod_devicetable.h +17 -0
index 48c007d..ae28e93 100644
@@ -382,6 +382,23 @@ struct ssb_device_id {
 #define SSB_ANY_ID		0xFFFF
 #define SSB_ANY_REV		0xFF
 
+/* Broadcom's specific AMBA core, see drivers/bcma/ */
+struct bcma_device_id {
+	__u16	manuf;
+	__u16	id;
+	__u8	rev;
+	__u8	class;
+};
+#define BCMA_CORE(_manuf, _id, _rev, _class)  \
+	{ .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
+#define BCMA_CORETABLE_END  \
+	{ 0, },
+
+#define BCMA_ANY_MANUF		0xFFFF
+#define BCMA_ANY_ID		0xFFFF
+#define BCMA_ANY_REV		0xFF
+#define BCMA_ANY_CLASS		0xFF
+
 struct virtio_device_id {
 	__u32 device;
 	__u32 vendor;
scripts/mod/file2alias.c +22 -0
index 88f3f07..e26e2fb 100644
@@ -702,6 +702,24 @@ static int do_ssb_entry(const char *filename,
 	return 1;
 }
 
+/* Looks like: bcma:mNidNrevNclN. */
+static int do_bcma_entry(const char *filename,
+			 struct bcma_device_id *id, char *alias)
+{
+	id->manuf = TO_NATIVE(id->manuf);
+	id->id = TO_NATIVE(id->id);
+	id->rev = TO_NATIVE(id->rev);
+	id->class = TO_NATIVE(id->class);
+
+	strcpy(alias, "bcma:");
+	ADD(alias, "m", id->manuf != BCMA_ANY_MANUF, id->manuf);
+	ADD(alias, "id", id->id != BCMA_ANY_ID, id->id);
+	ADD(alias, "rev", id->rev != BCMA_ANY_REV, id->rev);
+	ADD(alias, "cl", id->class != BCMA_ANY_CLASS, id->class);
+	add_wildcard(alias);
+	return 1;
+}
+
 /* Looks like: virtio:dNvN */
 static int do_virtio_entry(const char *filename, struct virtio_device_id *id,
 			   char *alias)
@@ -968,6 +986,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 		do_table(symval, sym->st_size,
 			 sizeof(struct ssb_device_id), "ssb",
 			 do_ssb_entry, mod);
+	else if (sym_is(symname, "__mod_bcma_device_table"))
+		do_table(symval, sym->st_size,
+			 sizeof(struct bcma_device_id), "bcma",
+			 do_bcma_entry, mod);
 	else if (sym_is(symname, "__mod_virtio_device_table"))
 		do_table(symval, sym->st_size,
 			 sizeof(struct virtio_device_id), "virtio",
Signature · 1 line
1.7.3.4
#1 lore raw

Rafa?,

A minor nit:

Documentation/ABI/testing/sysfs-bus-bcma line 7

Quoted 13 lines · Rafa? Mi?ecki
Documentation/ABI/testing/sysfs-bus-bcma new file +7 -0
new file mode 100644
index 0000000..ad3cd69
@@ -0,0 +1,31 @@
+What: ? ? ? ? ?/sys/bus/bcma/devices/.../class
+Date: ? ? ? ? ?May 2011
+KernelVersion: 2.6.40
+Contact: ? ? ? Rafa? Mi?ecki <[email protected]>
+Description:
+ ? ? ? ? ? ? ? Each AXI core is identified by few fields, including class it
+ ? ? ? ? ? ? ? belongs to. See include/linux/bcma/bcma.h for possible values.

Should this not read BCMA or something similar, not AXI?

Ditto for the rest of the changes to this file.

Thanks,

Signature · 5 lines
Julian Calaby

Email: julian.calaby at gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/
author maintainer
#2 lore raw

W dniu 6 maja 2011 00:59 u?ytkownik Julian Calaby
<[email protected]> napisa?:

Quoted 21 lines

Rafa?,

A minor nit:

Documentation/ABI/testing/sysfs-bus-bcma line 7

Quoted 13 lines · Rafa? Mi?ecki
Documentation/ABI/testing/sysfs-bus-bcma new file +7 -0
new file mode 100644
index 0000000..ad3cd69
@@ -0,0 +1,31 @@
+What: ? ? ? ? ?/sys/bus/bcma/devices/.../class
+Date: ? ? ? ? ?May 2011
+KernelVersion: 2.6.40
+Contact: ? ? ? Rafa? Mi?ecki <[email protected]>
+Description:
+ ? ? ? ? ? ? ? Each AXI core is identified by few fields, including class it
+ ? ? ? ? ? ? ? belongs to. See include/linux/bcma/bcma.h for possible values.

Should this not read BCMA or something similar, not AXI?

Quoted 1 line

Ditto for the rest of the changes to this file.

Ups, I left old name in this single place. Thx.

Signature · 1 line
Rafa?
#3 lore raw
In reply to Rafał Miłecki

Hi Rafa?,

I haven't looked in detail, but since I'll be travelling for the next two weeks, here is a really quick review. Overall, the bus driver looks really nice, except for a few things that I guess should be easy to resolve.

Quoted 4 lines · Rafa? Mi?ecki
Cc Greg KH <[email protected]>
Cc Michael B?sch <[email protected]>
Cc Larry Finger <[email protected]>
Cc George Kashperko <[email protected]>
Quoted 8 lines
Cc Arend van Spriel <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andy Botting <[email protected]>
Cc linuxdriverproject <[email protected]>
Cc linux-kernel at vger.kernel.org <[email protected]>

This really needs a changelog. You've probably written all of it before, just explain above the Cc what bcma is, where it's used, why you use a bus_type. This will be the place where people look when they want to find out what it is, so try to make a good description.

Quoted 13 lines

new file mode 100644
index 0000000..b52cd2b

drivers/bcma/README new file +8 -0
@@ -0,0 +1,18 @@
+Broadcom introduced new bus as replacement for older SSB. It is based on AMBA,
+however from programming point of view there is nothing AMBA specific we use.
+
+Standard AMBA drivers are platform specific, have hardcoded addresses and use
+AMBA standard fields like CID and PID.
+
+In case of Broadcom's cards every device consists of:
+1) Broadcom specific AMBA device. It is put on AMBA bus, but can not be treated

drivers/bcma/README line 18

Quoted 10 lines
drivers/bcma/README new file +10 -0
+   as standard AMBA device. Reading it's CID or PID can cause machine lockup.
+2) AMBA standard devices called ports or wrappers. They have CIDs (AMBA_CID)
+   and PIDs (0x103BB369), but we do not use that info for anything. One of that
+   devices is used for managing Broadcom specific core.
+
+Addresses of AMBA devices are not hardcoded in driver and have to be read from
+EPROM.
+
+In this situation we decided to introduce separated bus with devices identified
+by Broadcom specific fields, read from EPROM.

This would be a good start for the changelog. You don't actually need the readme in the code directory, it's better to put the information somewhere in the Documentation/ directory.

drivers/bcma/TODO line 3

Quoted 9 lines
drivers/bcma/TODO new file +3 -0
new file mode 100644
index 0000000..45eadc9
@@ -0,0 +1,3 @@
+- Interrupts
+- Defines for PCI core driver
+- Convert bcma_bus->cores into linked list

The last item doesn't make sense to me. Since you are using the regular driver model, you can simply iterate over all child devices of any dev.

Quoted 20 lines
drivers/bcma/TODO new file +20 -0
+static void bcma_core_disable(struct bcma_device *core, u32 flags)
+{
+	if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
+		return;
+
+	bcma_awrite32(core, BCMA_IOCTL, flags);
+	bcma_aread32(core, BCMA_IOCTL);
+	udelay(10);
+
+	bcma_awrite32(core, BCMA_RESET_CTL, BCMA_RESET_CTL_RESET);
+	udelay(1);
+}
+
+int bcma_core_enable(struct bcma_device *core, u32 flags)
+{
+	bcma_core_disable(core, flags);
+
+	bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC | flags));
+	bcma_aread32(core, BCMA_IOCTL);
+

drivers/bcma/TODO

Quoted 10 lines
drivers/bcma/TODO new file +10 -0
+	bcma_awrite32(core, BCMA_RESET_CTL, 0);
+	udelay(1);
+
+	bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | flags));
+	bcma_aread32(core, BCMA_IOCTL);
+	udelay(1);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(bcma_core_enable);

I don't know if we discussed this before. Normally, you should not need such udelay() calls, at least if you have the correct I/O barriers in place.

drivers/bcma/TODO

Quoted 9 lines
drivers/bcma/TODO new file +9 -0
+#include "bcma_private.h"
+#include <linux/bcma/bcma.h>
+
+MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
+MODULE_LICENSE("GPL");
+
+static int bcma_bus_match(struct device *dev, struct device_driver *drv);
+static int bcma_device_probe(struct device *dev);
+static int bcma_device_remove(struct device *dev);

Try to reorder your functions so you don't need any forward declarations.

drivers/bcma/TODO

Quoted 11 lines
drivers/bcma/TODO new file +11 -0
+const char *bcma_device_name(u16 coreid)
+{
+	switch (coreid) {
+	case BCMA_CORE_OOB_ROUTER:
+		return "OOB Router";
+	case BCMA_CORE_INVALID:
+		return "Invalid";
+	case BCMA_CORE_CHIPCOMMON:
+		return "ChipCommon";
+	case BCMA_CORE_ILINE20:
+		return "ILine 20";

It's better to make that a data structure than a switch() statement, both from readability and efficiency aspects.

Quoted 14 lines
drivers/bcma/TODO new file +14 -0
+
+/* 1) It is not allowed to put struct device statically in bcma_device
+ * 2) We can not just use pointer to struct device because we use container_of
+ * 3) We do not have pointer to struct bcma_device in struct device
+ * Solution: use such a dummy wrapper
+ */
+struct __bcma_dev_wrapper {
+	struct device dev;
+	struct bcma_device *core;
+};
+
+struct bcma_device {
+	struct bcma_bus *bus;
+	struct bcma_device_id id;

drivers/bcma/TODO

Quoted 10 lines
drivers/bcma/TODO new file +10 -0
+
+	struct device *dev;
+
+	u8 core_index;
+
+	u32 addr;
+	u32 wrap;
+
+	void *drvdata;
+};

Something went wrong here, maybe you misunderstood the API, or I misunderstood what you are trying to do. When you define your own bus type, the private device (struct bcma_device) should definitely contain a struct device as a member, and you allocate that structure dynamically when probing the bus. I don't see any reason for that wrapper.

Arnd

author maintainer
#4 lore raw

2011/5/6 Arnd Bergmann <[email protected]>:

Quoted 6 lines

Hi Rafa?,

I haven't looked in detail, but since I'll be travelling for the next two weeks, here is a really quick review. Overall, the bus driver looks really nice, except for a few things that I guess should be easy to resolve.

Thanks for reviewing.

Quoted 14 lines · Rafa? Mi?ecki
Quoted 4 lines
Cc Greg KH <[email protected]>
Cc Michael B?sch <[email protected]>
Cc Larry Finger <[email protected]>
Cc George Kashperko <[email protected]>
Quoted 8 lines
Cc Arend van Spriel <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andy Botting <[email protected]>
Cc linuxdriverproject <[email protected]>
Cc linux-kernel at vger.kernel.org <[email protected]>
Quoted 5 lines

This really needs a changelog. You've probably written all of it before, just explain above the Cc what bcma is, where it's used, why you use a bus_type. This will be the place where people look when they want to find out what it is, so try to make a good description.

What do you mean by changelog? Is README unsufficient? It contains almost everything you mentioned...

Quoted 19 lines
Quoted 19 lines

new file mode 100644
index 0000000..b52cd2b

drivers/bcma/README new file +14 -0
@@ -0,0 +1,18 @@
+Broadcom introduced new bus as replacement for older SSB. It is based on AMBA,
+however from programming point of view there is nothing AMBA specific we use.
+
+Standard AMBA drivers are platform specific, have hardcoded addresses and use
+AMBA standard fields like CID and PID.
+
+In case of Broadcom's cards every device consists of:
+1) Broadcom specific AMBA device. It is put on AMBA bus, but can not be treated
+ ? as standard AMBA device. Reading it's CID or PID can cause machine lockup.
+2) AMBA standard devices called ports or wrappers. They have CIDs (AMBA_CID)
+ ? and PIDs (0x103BB369), but we do not use that info for anything. One of that
+ ? devices is used for managing Broadcom specific core.
+
+Addresses of AMBA devices are not hardcoded in driver and have to be read from
Quoted 8 lines

drivers/bcma/README line 18

Quoted 4 lines
drivers/bcma/README new file +4 -0
+EPROM.
+
+In this situation we decided to introduce separated bus with devices identified
+by Broadcom specific fields, read from EPROM.

This would be a good start for the changelog. You don't actually need the readme in the code directory, it's better to put the information somewhere in the Documentation/ directory.

I guess Documentation/ can be a good idea, but I'd like to make it later if nobody really minds. It's no fun to post more and more versions of patches, just to update some single description.

Quoted 5 lines
Quoted 5 lines
drivers/bcma/TODO new file +0 -0
new file mode 100644
index 0000000..45eadc9
Quoted 8 lines

drivers/bcma/TODO line 3

Quoted 4 lines
drivers/bcma/TODO new file +3 -0
@@ -0,0 +1,3 @@
+- Interrupts
+- Defines for PCI core driver
+- Convert bcma_bus->cores into linked list

The last item doesn't make sense to me. Since you are using the regular driver model, you can simply iterate over all child devices of any dev.

It's about optimization. Right now bcma_bus->cores is static array, we probably never will use all entries.

Quoted 25 lines
Quoted 25 lines
drivers/bcma/TODO new file +25 -0
+static void bcma_core_disable(struct bcma_device *core, u32 flags)
+{
+ ? ? if (bcma_aread32(core, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
+ ? ? ? ? ? ? return;
+
+ ? ? bcma_awrite32(core, BCMA_IOCTL, flags);
+ ? ? bcma_aread32(core, BCMA_IOCTL);
+ ? ? udelay(10);
+
+ ? ? bcma_awrite32(core, BCMA_RESET_CTL, BCMA_RESET_CTL_RESET);
+ ? ? udelay(1);
+}
+
+int bcma_core_enable(struct bcma_device *core, u32 flags)
+{
+ ? ? bcma_core_disable(core, flags);
+
+ ? ? bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC | flags));
+ ? ? bcma_aread32(core, BCMA_IOCTL);
+
+ ? ? bcma_awrite32(core, BCMA_RESET_CTL, 0);
+ ? ? udelay(1);
+
+ ? ? bcma_awrite32(core, BCMA_IOCTL, (BCMA_IOCTL_CLK | flags));
+ ? ? bcma_aread32(core, BCMA_IOCTL);
Quoted 8 lines

drivers/bcma/TODO

Quoted 5 lines

+ ? ? udelay(1);

drivers/bcma/TODO new file +4 -0
+
+ ? ? return 0;
+}
+EXPORT_SYMBOL_GPL(bcma_core_enable);

I don't know if we discussed this before. Normally, you should not need such udelay() calls, at least if you have the correct I/O barriers in place.

I believe we didn't.

We had to use such a delays in ssb to let devices react to the changes. Did you maybe have a talk with hardware guys at Broadcom about this? Are you sure this is not needed for BCMA?

Quoted 11 lines

drivers/bcma/TODO

Quoted 9 lines
drivers/bcma/TODO new file +9 -0
+#include "bcma_private.h"
+#include <linux/bcma/bcma.h>
+
+MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
+MODULE_LICENSE("GPL");
+
+static int bcma_bus_match(struct device *dev, struct device_driver *drv);
+static int bcma_device_probe(struct device *dev);
+static int bcma_device_remove(struct device *dev);

Try to reorder your functions so you don't need any forward declarations.

That's needed because I put bus-closely-related stuff at the beginning. I did this for readability, I don't think it really hurts anyone or is against coding style or sth.

Quoted 6 lines
Quoted 6 lines
drivers/bcma/TODO new file +6 -0
+const char *bcma_device_name(u16 coreid)
+{
+ ? ? switch (coreid) {
+ ? ? case BCMA_CORE_OOB_ROUTER:
+ ? ? ? ? ? ? return "OOB Router";
+ ? ? case BCMA_CORE_INVALID:
Quoted 8 lines
Quoted 5 lines

+ ? ? ? ? ? ? return "Invalid";
+ ? ? case BCMA_CORE_CHIPCOMMON:
+ ? ? ? ? ? ? return "ChipCommon";
+ ? ? case BCMA_CORE_ILINE20:
+ ? ? ? ? ? ? return "ILine 20";

It's better to make that a data structure than a switch() statement, both from readability and efficiency aspects.

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Quoted 22 lines
Quoted 22 lines
drivers/bcma/TODO new file +22 -0
+
+/* 1) It is not allowed to put struct device statically in bcma_device
+ * 2) We can not just use pointer to struct device because we use container_of
+ * 3) We do not have pointer to struct bcma_device in struct device
+ * Solution: use such a dummy wrapper
+ */
+struct __bcma_dev_wrapper {
+ ? ? struct device dev;
+ ? ? struct bcma_device *core;
+};
+
+struct bcma_device {
+ ? ? struct bcma_bus *bus;
+ ? ? struct bcma_device_id id;
+
+ ? ? struct device *dev;
+
+ ? ? u8 core_index;
+
+ ? ? u32 addr;
+ ? ? u32 wrap;
+
Quoted 8 lines
Quoted 2 lines

+ ? ? void *drvdata;
+};

Something went wrong here, maybe you misunderstood the API, or I misunderstood what you are trying to do. When you define your own bus type, the private device (struct bcma_device) should definitely contain a struct device as a member, and you allocate that structure dynamically when probing the bus. I don't see any reason for that wrapper.

Having "stuct device" in my "struct bcma_device" let me walk from bcma_device to device. Not the opposite. In case of:
manuf_show
id_show
rev_show
class_show
I've to go this opposite way. I've "stuct device" but I need to get corresponding "struct bcma_device".

Signature · 1 line
Rafa?
author maintainer
#5 lore raw

2011/5/6 Rafa? Mi?ecki <[email protected]>:

Quoted 16 lines

2011/5/6 Arnd Bergmann <[email protected]>:

Quoted 6 lines
Quoted 6 lines
(quoted diff) +6 -0
+const char *bcma_device_name(u16 coreid)
+{
+ ? ? switch (coreid) {
+ ? ? case BCMA_CORE_OOB_ROUTER:
+ ? ? ? ? ? ? return "OOB Router";
+ ? ? case BCMA_CORE_INVALID:
Quoted 8 lines
Quoted 5 lines

+ ? ? ? ? ? ? return "Invalid";
+ ? ? case BCMA_CORE_CHIPCOMMON:
+ ? ? ? ? ? ? return "ChipCommon";
+ ? ? case BCMA_CORE_ILINE20:
+ ? ? ? ? ? ? return "ILine 20";

It's better to make that a data structure than a switch() statement, both from readability and efficiency aspects.

Quoted 3 lines

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
#define BCMA_CORE_INVALID 0x700

Oh and there is still:
#define BCMA_CORE_DEFAULT 0xFFF
we could want to include. Then we would loose additional (0xFFF - 0x837) u16 entries in array.

I'll just leave this huge "case". As I said, it's called only once on initialization time. For standard PCI cards there are usually 3-5 cores, for embedded systems this number can be bigger, but still is limited with 16 for 1 bus:
#define BCMA_MAX_NR_CORES 16

Signature · 1 line
Rafa?
#6 lore raw
Quoted 34 lines · Rafa? Mi?ecki

2011/5/6 Rafa? Mi?ecki <[email protected]>:

Quoted 16 lines

2011/5/6 Arnd Bergmann <[email protected]>:

Quoted 6 lines
Quoted 6 lines
drivers/bcma/scan.c new file +6 -0
+const char *bcma_device_name(u16 coreid)
+{
+     switch (coreid) {
+     case BCMA_CORE_OOB_ROUTER:
+             return "OOB Router";
+     case BCMA_CORE_INVALID:
Quoted 8 lines

drivers/bcma/scan.c line 28

Quoted 5 lines
drivers/bcma/scan.c new file +5 -0
+             return "Invalid";
+     case BCMA_CORE_CHIPCOMMON:
+             return "ChipCommon";
+     case BCMA_CORE_ILINE20:
+             return "ILine 20";

It's better to make that a data structure than a switch() statement, both from readability and efficiency aspects.

Quoted 3 lines

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
#define BCMA_CORE_INVALID 0x700

Oh and there is still:
#define BCMA_CORE_DEFAULT 0xFFF
we could want to include. Then we would loose additional (0xFFF - 0x837) u16 entries in array.

Quoted 5 lines

I'll just leave this huge "case". As I said, it's called only once on initialization time. For standard PCI cards there are usually 3-5 cores, for embedded systems this number can be bigger, but still is limited with 16 for 1 bus:
#define BCMA_MAX_NR_CORES 16

The compiler does a better job than we do. I'm pretty sure that the compiler will implement this switch statement as a series of small lookup tables combined with some branches, if it thinks it's worth it (also depends on flags and arch).

Signature · 1 line
Greetings Michael.
#7 lore raw
Quoted 8 lines · Michael B?sch
Quoted 8 lines

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
#define BCMA_CORE_INVALID 0x700

Please be aware that the core identifier itself is not unique (in the current list they are). In the scan the BCMA_CORE_OOB_ROUTER will always show BCMA_MANUF_ARM (did not look up the proper manufacturer define but you get the idea, i hope).

Gr. AvS

author maintainer
#8 lore raw

2011/5/7 Arend van Spriel <[email protected]>:

Quoted 10 lines · Michael B?sch
Quoted 8 lines
Quoted 8 lines

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER ? ? ? ? ? 0x367 ? /* Out of band */ #define BCMA_CORE_INVALID ? ? ? ? ? ? ?0x700

Quoted 4 lines

Please be aware that the core identifier itself is not unique (in the current list they are). In the scan the BCMA_CORE_OOB_ROUTER will always show BCMA_MANUF_ARM (did not look up the proper manufacturer define but you get the idea, i hope).

Unfortunately, I don't. Could you explain this? How core identified can be not unique? Can 0x800 mean ChipCommon but also SuperPCIeX?

Signature · 1 line
Rafa?
#9 lore raw
Quoted 9 lines · Rafa? Mi?ecki

2011/5/7 Arend van Spriel<[email protected]>:

Quoted 8 lines · Michael B?sch
Quoted 7 lines
Quoted 7 lines

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
#define BCMA_CORE_INVALID 0x700

Quoted 6 lines
Quoted 4 lines

Please be aware that the core identifier itself is not unique (in the current list they are). In the scan the BCMA_CORE_OOB_ROUTER will always show BCMA_MANUF_ARM (did not look up the proper manufacturer define but you get the idea, i hope).

Unfortunately, I don't. Could you explain this? How core identified can be not unique? Can 0x800 mean ChipCommon but also SuperPCIeX?

Yes, if ChipCommon is Broadcom core and SuperPCIeX is ARM core (or some other). The core identifiers are chosen by a chip manufacturer (eg. Broadcom ;-) ). They are not unique by itself so that is why the bcma_device_id consists of manufacturer, id, rev, and class. Providing a device table with ANY_MANUF would be a bad idea.

Gr. AvS

author maintainer
#10 lore raw

2011/5/7 Arend van Spriel <[email protected]>:

Quoted 20 lines · Rafa? Mi?ecki
Quoted 19 lines

2011/5/7 Arend van Spriel<[email protected]>:

Quoted 16 lines · Michael B?sch
Quoted 8 lines
Quoted 8 lines

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER ? ? ? ? ? 0x367 ? /* Out of band */ #define BCMA_CORE_INVALID ? ? ? ? ? ? ?0x700

Please be aware that the core identifier itself is not unique (in the current list they are). In the scan the BCMA_CORE_OOB_ROUTER will always show BCMA_MANUF_ARM (did not look up the proper manufacturer define but you
get the idea, i hope).

Quoted 8 lines
Quoted 2 lines

Unfortunately, I don't. Could you explain this? How core identified can be not unique? Can 0x800 mean ChipCommon but also SuperPCIeX?

Yes, if ChipCommon is Broadcom core and SuperPCIeX is ARM core (or some other). The core identifiers are chosen by a chip manufacturer (eg. Broadcom ;-) ). They are not unique by itself so that is why the bcma_device_id consists of manufacturer, id, rev, and class. Providing a device table with ANY_MANUF would be a bad idea.

OK, we use MANUF in identification... so where is the problem? ;)

My testing patch for b43 "subscribes" for Broadcom's cores only:

static const struct bcma_device_id b43_bcma_tbl[] = {
	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS),
	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS),
	BCMA_CORETABLE_END
};
Signature · 1 line
Rafa?
#11 lore raw
In reply to Rafał Miłecki
Quoted 30 lines

2011/5/6 Rafa? Mi?ecki <[email protected]>:

Quoted 16 lines

2011/5/6 Arnd Bergmann <[email protected]>:

Quoted 6 lines
Quoted 6 lines
drivers/bcma/scan.c new file +6 -0
+const char *bcma_device_name(u16 coreid)
+{
+     switch (coreid) {
+     case BCMA_CORE_OOB_ROUTER:
+             return "OOB Router";
+     case BCMA_CORE_INVALID:
Quoted 8 lines

drivers/bcma/scan.c line 28

Quoted 5 lines
drivers/bcma/scan.c new file +5 -0
+             return "Invalid";
+     case BCMA_CORE_CHIPCOMMON:
+             return "ChipCommon";
+     case BCMA_CORE_ILINE20:
+             return "ILine 20";

It's better to make that a data structure than a switch() statement, both from readability and efficiency aspects.

Quoted 3 lines

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
#define BCMA_CORE_INVALID 0x700

Quoted 4 lines

Oh and there is still:
#define BCMA_CORE_DEFAULT 0xFFF
we could want to include. Then we would loose additional (0xFFF - 0x837) u16 entries in array.

What is the purpose for bcma_device_name in bus driver code ? Why not define const char *name in struct bcma_driver and let driver writers supply kernel with knowledge on new cores' names rather than hard type those into the bus code ? Also this will close the question Arend asked you regarding same core ids with different manufacturer ids.

Have nice day,
George

author maintainer
#12 lore raw

2011/5/7 George Kashperko <[email protected]>:

Quoted 30 lines
Quoted 30 lines

2011/5/6 Rafa? Mi?ecki <[email protected]>:

Quoted 16 lines

2011/5/6 Arnd Bergmann <[email protected]>:

Quoted 6 lines
Quoted 6 lines
(quoted diff) +6 -0
+const char *bcma_device_name(u16 coreid)
+{
+ ? ? switch (coreid) {
+ ? ? case BCMA_CORE_OOB_ROUTER:
+ ? ? ? ? ? ? return "OOB Router";
+ ? ? case BCMA_CORE_INVALID:
Quoted 8 lines
Quoted 5 lines

+ ? ? ? ? ? ? return "Invalid";
+ ? ? case BCMA_CORE_CHIPCOMMON:
+ ? ? ? ? ? ? return "ChipCommon";
+ ? ? case BCMA_CORE_ILINE20:
+ ? ? ? ? ? ? return "ILine 20";

It's better to make that a data structure than a switch() statement, both from readability and efficiency aspects.

Quoted 3 lines

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER ? ? ? ? ? 0x367 ? /* Out of band */ #define BCMA_CORE_INVALID ? ? ? ? ? ? ?0x700

Quoted 8 lines
Quoted 4 lines

Oh and there is still:
#define BCMA_CORE_DEFAULT ? ? ? ? ? ? ?0xFFF
we could want to include. Then we would loose additional (0xFFF - 0x837) u16 entries in array.

What is the purpose for bcma_device_name in bus driver code ? Why not define const char *name in struct bcma_driver and let driver writers supply kernel with knowledge on new cores' names rather than hard type those into the bus code ?

The purpose is ridiculously trivial. Print user-friendly names on scanning. Why not do that?

Let's allow user understand what his bus contains without looking info defines in .h.

Quoted 2 lines

Also this will close the question Arend asked
you regarding same core ids with different manufacturer ids.

I don't know what was Arend's question. I asked but it was few minutes ago. I guess he just wanted to point there can be other manufacturer's cores.

Signature · 1 line
Rafa?
#13 lore raw
Quoted 36 lines

2011/5/7 George Kashperko <[email protected]>:

Quoted 34 lines
Quoted 34 lines

2011/5/6 Rafa? Mi?ecki <[email protected]>:

Quoted 16 lines

2011/5/6 Arnd Bergmann <[email protected]>:

Quoted 6 lines
Quoted 6 lines
drivers/bcma/scan.c new file +6 -0
+const char *bcma_device_name(u16 coreid)
+{
+     switch (coreid) {
+     case BCMA_CORE_OOB_ROUTER:
+             return "OOB Router";
+     case BCMA_CORE_INVALID:
Quoted 8 lines

drivers/bcma/scan.c line 28

Quoted 5 lines
drivers/bcma/scan.c new file +5 -0
+             return "Invalid";
+     case BCMA_CORE_CHIPCOMMON:
+             return "ChipCommon";
+     case BCMA_CORE_ILINE20:
+             return "ILine 20";

It's better to make that a data structure than a switch() statement, both from readability and efficiency aspects.

Quoted 3 lines

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
#define BCMA_CORE_INVALID 0x700

Oh and there is still:
#define BCMA_CORE_DEFAULT 0xFFF
we could want to include. Then we would loose additional (0xFFF - 0x837) u16 entries in array.

Quoted 7 lines
Quoted 4 lines

What is the purpose for bcma_device_name in bus driver code ? Why not define const char *name in struct bcma_driver and let driver writers supply kernel with knowledge on new cores' names rather than hard type those into the bus code ?

The purpose is ridiculously trivial. Print user-friendly names on scanning. Why not do that?

Output like
Core 0: ChipCommon (id 0x800, rev 18, vendor 0x14e4)
and
Core 0: id 0x800, rev 18, vendor 0x14e4
both give to 99% of linux systems' end-users exactly the same consistent information. Its more than enough for diagnostic purposes (I guess scanning code does outputs this for diagnostic purposes by those less than 1% of people who are aware wth is actually that ChipCommon is, not to be just user friendly?).

For user firendly output you still can keep the name of the core in dedicated driver.

Quoted 5 lines

Let's allow user understand what his bus contains without looking info defines in .h.

Quoted 7 lines
Quoted 2 lines

Also this will close the question Arend asked
you regarding same core ids with different manufacturer ids.

I don't know what was Arend's question. I asked but it was few minutes ago. I guess he just wanted to point there can be other manufacturer's cores.

I guess core id 0x800 by 0x04BF vendor and 0x800 by 0x043B vendor will both be reported as ChipCommon which most likely is wrong for second one. Btw, ChipCommon is 0x500 for 4706 and there will be more new core codes for new Broadcom devices. Don't think its right to build core names database into kernel while there will be at most few of them used on particular end system.

Have nice day,
George

author maintainer
#14 lore raw

2011/5/7 George Kashperko <[email protected]>:

Quoted 43 lines
Quoted 36 lines

2011/5/7 George Kashperko <[email protected]>:

Quoted 34 lines
Quoted 34 lines

2011/5/6 Rafa? Mi?ecki <[email protected]>:

Quoted 16 lines

2011/5/6 Arnd Bergmann <[email protected]>:

Quoted 6 lines
Quoted 6 lines
(quoted diff) +6 -0
+const char *bcma_device_name(u16 coreid)
+{
+ ? ? switch (coreid) {
+ ? ? case BCMA_CORE_OOB_ROUTER:
+ ? ? ? ? ? ? return "OOB Router";
+ ? ? case BCMA_CORE_INVALID:
Quoted 8 lines
Quoted 5 lines

+ ? ? ? ? ? ? return "Invalid";
+ ? ? case BCMA_CORE_CHIPCOMMON:
+ ? ? ? ? ? ? return "ChipCommon";
+ ? ? case BCMA_CORE_ILINE20:
+ ? ? ? ? ? ? return "ILine 20";

It's better to make that a data structure than a switch() statement, both from readability and efficiency aspects.

Quoted 3 lines

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER ? ? ? ? ? 0x367 ? /* Out of band */ #define BCMA_CORE_INVALID ? ? ? ? ? ? ?0x700

Oh and there is still:
#define BCMA_CORE_DEFAULT ? ? ? ? ? ? ?0xFFF
we could want to include. Then we would loose additional (0xFFF - 0x837) u16 entries in array.

Quoted 7 lines
Quoted 4 lines

What is the purpose for bcma_device_name in bus driver code ? Why not define const char *name in struct bcma_driver and let driver writers supply kernel with knowledge on new cores' names rather than hard type those into the bus code ?

The purpose is ridiculously trivial. Print user-friendly names on scanning. Why not do that?

Quoted 9 lines

Output like
Core 0: ChipCommon (id 0x800, rev 18, vendor 0x14e4)
and
Core 0: id 0x800, rev 18, vendor 0x14e4
both give to 99% of linux systems' end-users exactly the same consistent information. Its more than enough for diagnostic purposes (I guess scanning code does outputs this for diagnostic purposes by those less than 1% of people who are aware wth is actually that ChipCommon is, not to be just user friendly?).

Really, what's wrong with that? Does it kill anyone's pet we print this? We also do:
pr_err("Scanning failed because of wrong CID\n");
return -1;
While we could drop pr_err. Why to do this? Advanced used can always check what -1 means.

I just like this. I find situations when it's useful, while I don't see real negatives. I want to keep this. Can we leave this that way? Unless someone finds some really bad effects of this?

Quoted 2 lines

For user firendly output you still can keep the name of the core in dedicated driver.

It won't work in case of core with no driver (not supported), driver not compiled (someone didn't know it's needed for his system) and it won't print nicely all bus devices in one place.

Quoted 11 lines
Quoted 11 lines

Let's allow user understand what his bus contains without looking info defines in .h.

Quoted 2 lines

Also this will close the question Arend asked
you regarding same core ids with different manufacturer ids.

I don't know what was Arend's question. I asked but it was few minutes ago. I guess he just wanted to point there can be other manufacturer's cores.

Quoted 6 lines

I guess core id 0x800 by 0x04BF vendor and 0x800 by 0x043B vendor will both be reported as ChipCommon which most likely is wrong for second one. Btw, ChipCommon is 0x500 for 4706 and there will be more new core codes for new Broadcom devices. Don't think its right to build core names database into kernel while there will be at most few of them used on particular end system.

This is constructive, I'll fix this, thanks.

Signature · 1 line
Rafa?
#15 lore raw
Quoted 20 lines
Quoted 12 lines
Quoted 3 lines

The purpose is ridiculously trivial. Print user-friendly names on scanning. Why not do that?

Output like
Core 0: ChipCommon (id 0x800, rev 18, vendor 0x14e4)
and
Core 0: id 0x800, rev 18, vendor 0x14e4
both give to 99% of linux systems' end-users exactly the same consistent information. Its more than enough for diagnostic purposes (I guess scanning code does outputs this for diagnostic purposes by those less than 1% of people who are aware wth is actually that ChipCommon is, not to be just user friendly?).

Really, what's wrong with that? Does it kill anyone's pet we print this? We also do:
pr_err("Scanning failed because of wrong CID\n");
return -1;
While we could drop pr_err. Why to do this? Advanced used can always check what -1 means.

Quoted 3 lines

I just like this. I find situations when it's useful, while I don't see real negatives. I want to keep this. Can we leave this that way? Unless someone finds some really bad effects of this?

Nothing wrong except it makes kernel larger while gives _absolutely_ no benefit to end users. Regardless bus code prints core name or not it (core name) have absolutely no impact on driver matching.

Imagine yourself an end-user who haven't got his 80211 core matched with driver and therefore he haven't got WiFi working.
If bus driver code outputs
Core X: id 0x812, rev. 8, vendor 0x4BF
you (as end user) will look where is 0x4BF/0x812 driver supporting rev.8.
But if bus driver code outputs
Core X: MAC 802.11 (core id 0x812, rev. 8, vendor 0x4BF)
you (as end user) empowered with MAC 802.11 name knowledge will still look where is 0x4BF/0x812 driver supporting rev.8.

Really, there will be more and more core codes/types/name. Why hardcode those into kernel for some e. g. memory-constraint system while you still can (and in most cases also will) have them in dedicated drivers?

Btw, have you ever suffered hardly from PCI naming devices xxxx.xx.xx.x but not "Network device" ?

Have nice day,
George

author maintainer
#16 lore raw

2011/5/7 George Kashperko <[email protected]>:

Quoted 27 lines
Quoted 20 lines
Quoted 12 lines
Quoted 3 lines

The purpose is ridiculously trivial. Print user-friendly names on scanning. Why not do that?

Output like
Core 0: ChipCommon (id 0x800, rev 18, vendor 0x14e4)
and
Core 0: id 0x800, rev 18, vendor 0x14e4
both give to 99% of linux systems' end-users exactly the same consistent information. Its more than enough for diagnostic purposes (I guess scanning code does outputs this for diagnostic purposes by those less than 1% of people who are aware wth is actually that ChipCommon is, not to be just user friendly?).

Really, what's wrong with that? Does it kill anyone's pet we print this? We also do:
pr_err("Scanning failed because of wrong CID\n");
return -1;
While we could drop pr_err. Why to do this? Advanced used can always check what -1 means.

Quoted 3 lines

I just like this. I find situations when it's useful, while I don't see real negatives. I want to keep this. Can we leave this that way? Unless someone finds some really bad effects of this?

Nothing wrong except it makes kernel larger while gives _absolutely_ no benefit to end users. Regardless bus code prints core name or not it (core name) have absolutely no impact on driver matching.

Quoted 10 lines

Imagine yourself an end-user who haven't got his 80211 core matched with driver and therefore he haven't got WiFi working.
If bus driver code outputs
Core X: id 0x812, rev. 8, vendor 0x4BF
you (as end user) will look where is 0x4BF/0x812 driver supporting rev.8.
But if bus driver code outputs
Core X: MAC 802.11 (core id 0x812, rev. 8, vendor 0x4BF)
you (as end user) empowered with MAC 802.11 name knowledge will still look where is 0x4BF/0x812 driver supporting rev.8.

I'll ask linux-wireless instead of linux-usb or linux-arm.

I didn't expect longer discussion so I got this trivial example of pr_err. But it appears to be good example/question.

How do you see relation between bcma_device_name and:

int zd_ioread32v_locked(...) {
	if (r) {
		dev_dbg_f(zd_chip_dev(chip),
			  "error: zd_ioread16v_locked. Error number %d\n", r);
		return r;
	}
}

I believe according to your theory we should drop thi error message, right? It eats memory to keep this string while error code can always be checked in source.

Signature · 1 line
Rafa?
#17 lore raw
Quoted 1 line

I'll ask linux-wireless instead of linux-usb or linux-arm.

If you know you haven't got wireless working by some reason you will ask at linux-wireless anyway. And people there will ask you for id/ven/rev rather than core name reported by bus driver.

Quoted 11 lines

I didn't expect longer discussion so I got this trivial example of pr_err. But it appears to be good example/question.

How do you see relation between bcma_device_name and:

int zd_ioread32v_locked(...) {
	if (r) {
		dev_dbg_f(zd_chip_dev(chip),
			  "error: zd_ioread16v_locked. Error number %d\n", r);
		return r;
	}
}

No relation at all. It like comparing warm and soft. It will be if you do something like

dbg_bcma_device_name
{
#ifdef DEBUG
case/switch/if/else stuff

#endif
		return NULL;
}

But I don't see here much sense to hardcode names other than those of buscommons/buscores for debugging purposes.

Quoted 5 lines

I believe according to your theory we should drop thi error message, right? It eats memory to keep this string while error code can always be checked in source.

My theory ? o.O

Have nice day,
George

#18 lore raw
Quoted 9 lines · George Kashperko

dbg_bcma_device_name
{
#ifdef DEBUG
case/switch/if/else stuff

#endif
		return NULL;
}

But I don't see here much sense to hardcode names other than those of buscommons/buscores for debugging purposes.

Would you please read and understand the code before discussing this? That would help the discussion on the technical side.

Those names are hardcoded by definition. And just like 14e4 is the PCI ID for Broadcom devices, 800 is the AXI ID for Broadcom Chipcommon.

And building an #ifdef mess around this stuff is not better than having a few bytes of _helpful_ information messages.
You are absolutely right that those messages only help 1% of the people. Just as _any_ other kernel message.

Signature · 1 line
Greetings Michael.
#19 lore raw
Quoted 14 lines · George Kashperko
Quoted 9 lines

dbg_bcma_device_name
{
#ifdef DEBUG
case/switch/if/else stuff

#endif
		return NULL;
}

But I don't see here much sense to hardcode names other than those of buscommons/buscores for debugging purposes.

Would you please read and understand the code before discussing this? That would help the discussion on the technical side.

Quoted 8 lines

Those names are hardcoded by definition. And just like 14e4 is the PCI ID for Broadcom devices, 800 is the AXI ID for Broadcom Chipcommon.

And building an #ifdef mess around this stuff is not better than having a few bytes of _helpful_ information messages.
You are absolutely right that those messages only help 1% of the people. Just as _any_ other kernel message.

Following is first part of my comment with "case/switch/if/else stuff" which you didn't quoted and which I was actually commented at:

Quoted 10 lines
Quoted 7 lines

How do you see relation between bcma_device_name and:

int zd_ioread32v_locked(...) {
      if (r) {
              dev_dbg_f(zd_chip_dev(chip),
                        "error: zd_ioread16v_locked. Error number %d\n", r);
              return r;
      }

}
No relation at all. It like comparing warm and soft. It will be if you do something like

Original discussion on the bcma_device_name was started by Arend pointing that there can be cores with same id but different vendor code. As one among ways to deal with this I've proposed to remove bcma_device_name and let drivers supply core name.

Have nice day,
George

#21 lore raw
In reply to Rafał Miłecki
Quoted 8 lines · Rafa? Mi?ecki

2011/5/7 George Kashperko<[email protected]>:

Quoted 6 lines

I guess core id 0x800 by 0x04BF vendor and 0x800 by 0x043B vendor will both be reported as ChipCommon which most likely is wrong for second one. Btw, ChipCommon is 0x500 for 4706 and there will be more new core codes for new Broadcom devices. Don't think its right to build core names database into kernel while there will be at most few of them used on particular end system.

This is constructive, I'll fix this, thanks.

Hi Rafa?,

Late response, but I tried to tell what George clarified by the example above so you need nested switch.

I tend to agree with George that having this id to name conversion in the bus driver may be nice for debugging, but apart from memory usage it also gives you additional maintenance work. Leave it up to you.

Gr. AvS

#22 lore raw
In reply to Rafał Miłecki
Quoted 6 lines · Rafa? Mi?ecki

Really, what's wrong with that? Does it kill anyone's pet we print this? We also do:
pr_err("Scanning failed because of wrong CID\n");
return -1;
While we could drop pr_err. Why to do this? Advanced used can always check what -1 means.

And why return -1 when we have a system of error codes? I _really_ wish people would stop returning -1 for "some random error occurred".

author maintainer
#23 lore raw

2011/5/8 Russell King - ARM Linux <[email protected]>:

Quoted 10 lines · Rafa? Mi?ecki
Quoted 6 lines

Really, what's wrong with that? Does it kill anyone's pet we print this? We also do:
pr_err("Scanning failed because of wrong CID\n");
return -1;
While we could drop pr_err. Why to do this? Advanced used can always check what -1 means.

And why return -1 when we have a system of error codes? ?I _really_ wish people would stop returning -1 for "some random error occurred".

You commented on imagined code, but we actually do sth similar in code.

I did this because:
1) I had no idea what err code would be valid for invalid EPROM layout (content). Nothing from include/asm-generic/errno-base.h sounds reasonable.
2) I wanted to use different error codes for different EPROM layout issues. Sometimes we don't get CIA block. Sometimes we don't get CIB block. Sometimes there is problem with master port (not found in EPROM when expected). They all would probably use the same errno.

Could you help me with this?

Signature · 1 line
Rafa?
#24 lore raw
Quoted 23 lines · Rafa? Mi?ecki

2011/5/8 Russell King - ARM Linux <[email protected]>:

Quoted 10 lines · Rafa? Mi?ecki
Quoted 6 lines

Really, what's wrong with that? Does it kill anyone's pet we print this? We also do:
pr_err("Scanning failed because of wrong CID\n");
return -1;
While we could drop pr_err. Why to do this? Advanced used can always check what -1 means.

And why return -1 when we have a system of error codes? ?I _really_ wish people would stop returning -1 for "some random error occurred".

You commented on imagined code, but we actually do sth similar in code.

I did this because:
1) I had no idea what err code would be valid for invalid EPROM layout (content). Nothing from include/asm-generic/errno-base.h sounds reasonable.
2) I wanted to use different error codes for different EPROM layout issues. Sometimes we don't get CIA block. Sometimes we don't get CIB block. Sometimes there is problem with master port (not found in EPROM when expected). They all would probably use the same errno.

Quoted 1 line

Could you help me with this?

The problem is if you start using -1 and mixing it with stuff which does return negative errno codes, you end up hitting one of two bugs:

1. you interpret -1 as being -EPERM when actually you meant something else.
2. you check the function's return value for -1 rather than < 0, and you unintentionally ignore valid -errno codes.

So it's normally far better to find something in the errno stuff which approximates the error you have rather than using -1. Eg, if something is invalid and you can't find something which fits, -EINVAL is probably a good idea.

If you can't access the eeprom because its not responding, maybe -EIO or -ETIMEDOUT would be better than -1?

Maybe for CRC errors, or unexpected data -EILSEQ would be appropriate?

Maybe if something being requested isn't found, -ENOENT would be better (may not be a file or directory, but it approximates the error as being 'error no entry').

#25 lore raw
In reply to Rafał Miłecki
Quoted 11 lines · Rafa? Mi?ecki
Quoted 3 lines

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
#define BCMA_CORE_INVALID 0x700

I did not mean using the enum value as index, just make an array of simple structs:

struct bcma_device_name {
	unsigned int id;
	const char *name;
};
struct bcma_device_name bcma_device_names = {
	{ BCMA_CORE_OOB_ROUTER, "Out of band router" },
	{ BCMA_CORE_INVALID,	"Invalid" },
	...
};

The data size for this should be way smaller than the code needed to represent the whole function otherwise, and be more readable.

Arnd

author maintainer
#26 lore raw

2011/5/8 Arnd Bergmann <[email protected]>:

Quoted 21 lines · Rafa? Mi?ecki
Quoted 11 lines
Quoted 3 lines

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Arnd: did you have a look at defines at all?

Most of the defines have values in range 0x800 ? 0x837. Converting this to array means loosing 0x800 u16 entries. We can not use 0x800 offset, because there are also some defined between 0x000 and 0x800:
#define BCMA_CORE_OOB_ROUTER ? ? ? ? ? 0x367 ? /* Out of band */ #define BCMA_CORE_INVALID ? ? ? ? ? ? ?0x700

I did not mean using the enum value as index, just make an array of simple structs:

struct bcma_device_name {
? ? ? ?unsigned int id;
? ? ? ?const char *name;
};

Quoted 5 lines

struct bcma_device_name bcma_device_names = { ? ? ? ?{ BCMA_CORE_OOB_ROUTER, "Out of band router" }, ? ? ? ?{ BCMA_CORE_INVALID, ? ?"Invalid" },
? ? ? ?...
};

Arnd, right now I'm loosing a lot of time (I could spent on improving bcma or b43) on posting new version of this huge patch with single changes. Changes that can easily be introduced later without breaking driver, ABI, etc.

I'll be glad to try your solution later, when we get this patch merged. I'll be much easier to play with such a differences then. Thanks for sharing this idea.

Right now I want to focus on some bugs in driver that don't allow it being merged.

Signature · 1 line
Rafa?
#27 lore raw
Quoted 7 lines · On Sunday 08 May 2011 17:25:55 Rafa? Mi?ecki wrote:

2011/5/8 Arnd Bergmann <[email protected]>:

Arnd, right now I'm loosing a lot of time (I could spent on improving bcma or b43) on posting new version of this huge patch with single changes. Changes that can easily be introduced later without breaking driver, ABI, etc.

Quoted 6 lines

I'll be glad to try your solution later, when we get this patch merged. I'll be much easier to play with such a differences then. Thanks for sharing this idea.

Right now I want to focus on some bugs in driver that don't allow it being merged.

Ok, then I'd suggest leaving out the device strings for now, you can always add them at a later point.

Arnd

#28 lore raw
In reply to Rafał Miłecki
Quoted 10 lines · On Friday 06 May 2011 16:50:30 Rafa? Mi?ecki wrote:

2011/5/6 Arnd Bergmann <[email protected]>:

Quoted 5 lines

This really needs a changelog. You've probably written all of it before, just explain above the Cc what bcma is, where it's used, why you use a bus_type. This will be the place where people look when they want to find out what it is, so try to make a good description.

What do you mean by changelog? Is README unsufficient? It contains almost everything you mentioned...

The changelog is the text at the start of the email, which is what 'git log' shows you after the patch gets applied.

Quoted 7 lines
Quoted 3 lines

This would be a good start for the changelog. You don't actually need the readme in the code directory, it's better to put the information somewhere in the Documentation/ directory.

I guess Documentation/ can be a good idea, but I'd like to make it later if nobody really minds. It's no fun to post more and more versions of patches, just to update some single description.

Having the text in Documentation/ is optional except for user interfaces, but generally considered a good idea. The changelog in the email text is not optional.

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
drivers/bcma/TODO new file +0 -0
new file mode 100644
index 0000000..45eadc9
Quoted 8 lines

drivers/bcma/TODO line 3

Quoted 4 lines
drivers/bcma/TODO new file +3 -0
@@ -0,0 +1,3 @@
+- Interrupts
+- Defines for PCI core driver
+- Convert bcma_bus->cores into linked list

The last item doesn't make sense to me. Since you are using the regular driver model, you can simply iterate over all child devices of any dev.

Quoted 2 lines

It's about optimization. Right now bcma_bus->cores is static array, we probably never will use all entries.

Oh, I see. You should probably have neither of them. Instead allocate the devices dynamically as you find them and do a device_register, which will add the device into linked list.

Quoted 8 lines
Quoted 2 lines

I don't know if we discussed this before. Normally, you should not need such udelay() calls, at least if you have the correct I/O barriers in place.

I believe we didn't.

We had to use such a delays in ssb to let devices react to the changes. Did you maybe have a talk with hardware guys at Broadcom about this? Are you sure this is not needed for BCMA?

Normally what you should have is a register which you can poll to find out of the device is ready. In some cases the mmio read gets stalled until the hardware is done, in other cases, you have to do repeated reads until a register goes from 1 to 0 or the opposite. I would be surprised if BCMA didn't have this, but it's possible.

Quoted 12 lines
Quoted 11 lines

drivers/bcma/TODO

Quoted 9 lines
drivers/bcma/TODO new file +9 -0
+#include "bcma_private.h"
+#include <linux/bcma/bcma.h>
+
+MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
+MODULE_LICENSE("GPL");
+
+static int bcma_bus_match(struct device *dev, struct device_driver *drv);
+static int bcma_device_probe(struct device *dev);
+static int bcma_device_remove(struct device *dev);

Try to reorder your functions so you don't need any forward declarations.

Quoted 3 lines

That's needed because I put bus-closely-related stuff at the beginning. I did this for readability, I don't think it really hurts anyone or is against coding style or sth.

When I'm reading a source file, I usually start at the end because that is where the important stuff gets registered to other subsystems. It's really confusing when one source file does it in a different order.

Further, it's not obvious that the code is recursion free if you have forward declarations in the beginning.

Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
drivers/bcma/TODO new file +6 -0
+const char *bcma_device_name(u16 coreid)
+{
+     switch (coreid) {
+     case BCMA_CORE_OOB_ROUTER:
+             return "OOB Router";
+     case BCMA_CORE_INVALID:
Quoted 8 lines

drivers/bcma/TODO

Quoted 5 lines
drivers/bcma/TODO new file +5 -0
+             return "Invalid";
+     case BCMA_CORE_CHIPCOMMON:
+             return "ChipCommon";
+     case BCMA_CORE_ILINE20:
+             return "ILine 20";

It's better to make that a data structure than a switch() statement, both from readability and efficiency aspects.

Quoted 3 lines

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Readability is really what counts here. With efficiency, I mostly referred to code size, not execution time. As a general rule, use data structures instead of code where they are equivalent.

Quoted 30 lines
Quoted 21 lines
Quoted 21 lines
drivers/bcma/TODO new file +21 -0
+/* 1) It is not allowed to put struct device statically in bcma_device
+ * 2) We can not just use pointer to struct device because we use container_of
+ * 3) We do not have pointer to struct bcma_device in struct device
+ * Solution: use such a dummy wrapper
+ */
+struct __bcma_dev_wrapper {
+     struct device dev;
+     struct bcma_device *core;
+};
+
+struct bcma_device {
+     struct bcma_bus *bus;
+     struct bcma_device_id id;
+
+     struct device *dev;
+
+     u8 core_index;
+
+     u32 addr;
+     u32 wrap;
+
Quoted 8 lines

drivers/bcma/TODO

Quoted 2 lines
drivers/bcma/TODO new file +2 -0
+     void *drvdata;
+};

Something went wrong here, maybe you misunderstood the API, or I misunderstood what you are trying to do. When you define your own bus type, the private device (struct bcma_device) should definitely contain a struct device as a member, and you allocate that structure dynamically when probing the bus. I don't see any reason for that wrapper.

Quoted 8 lines

Having "stuct device" in my "struct bcma_device" let me walk from bcma_device to device. Not the opposite. In case of:
manuf_show
id_show
rev_show
class_show
I've to go this opposite way. I've "stuct device" but I need to get corresponding "struct bcma_device".

Maybe you didn't understand what I said: This should be

struct bcma_device {
     struct bcma_bus *bus;
     struct bcma_device_id id;
     struct device dev;
     u8 core_index;

     u32 addr;
     u32 wrap;

     void *drvdata;
};

Here, bcma_device is the device, no need to follow pointers around. It's how all bus_types work, you should just do the same.

Arnd

author maintainer
#29 lore raw

2011/5/8 Arnd Bergmann <[email protected]>:

Quoted 9 lines · On Friday 06 May 2011 16:50:30 Rafa? Mi?ecki wrote:
Quoted 8 lines

2011/5/6 Arnd Bergmann <[email protected]>:

Quoted 5 lines

This really needs a changelog. You've probably written all of it before, just explain above the Cc what bcma is, where it's used, why you use a bus_type. This will be the place where people look when they want to find out what it is, so try to make a good description.

Quoted 5 lines
Quoted 2 lines

What do you mean by changelog? Is README unsufficient? It contains almost everything you mentioned...

The changelog is the text at the start of the email, which is what 'git log' shows you after the patch gets applied.

By changelog I understood differences between V1, V2, ..., V6. I read "above the Cc" as "to above Cc". I thought you want me to explain ppl from Cc what BCMA is.

Quoted 26 lines
Quoted 7 lines
Quoted 3 lines

This would be a good start for the changelog. You don't actually need the readme in the code directory, it's better to put the information somewhere in the Documentation/ directory.

I guess Documentation/ can be a good idea, but I'd like to make it later if nobody really minds. It's no fun to post more and more versions of patches, just to update some single description.

Having the text in Documentation/ is optional except for user interfaces, but generally considered a good idea. The changelog in the email text is not optional.

Quoted 14 lines
Quoted 13 lines

drivers/bcma/TODO line 3

Quoted 9 lines
drivers/bcma/TODO new file +3 -0
new file mode 100644
index 0000000..45eadc9
@@ -0,0 +1,3 @@
+- Interrupts
+- Defines for PCI core driver
+- Convert bcma_bus->cores into linked list

The last item doesn't make sense to me. Since you are using the regular driver model, you can simply iterate over all child devices of any dev.

Quoted 6 lines
Quoted 2 lines

It's about optimization. Right now bcma_bus->cores is static array, we probably never will use all entries.

Oh, I see. You should probably have neither of them. Instead allocate the devices dynamically as you find them and do a device_register, which will add the device into linked list.

As I said, and wrote: TODO.

Quoted 110 lines
Quoted 8 lines
Quoted 2 lines

I don't know if we discussed this before. Normally, you should not need such udelay() calls, at least if you have the correct I/O barriers in place.

I believe we didn't.

We had to use such a delays in ssb to let devices react to the changes. Did you maybe have a talk with hardware guys at Broadcom about this? Are you sure this is not needed for BCMA?

Normally what you should have is a register which you can poll to find out of the device is ready. In some cases the mmio read gets stalled until the hardware is done, in other cases, you have to do repeated reads until a register goes from 1 to 0 or the opposite. I would be surprised if BCMA didn't have this, but it's possible.

Quoted 12 lines
Quoted 11 lines

drivers/bcma/TODO

Quoted 9 lines
drivers/bcma/TODO new file +9 -0
+#include "bcma_private.h"
+#include <linux/bcma/bcma.h>
+
+MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
+MODULE_LICENSE("GPL");
+
+static int bcma_bus_match(struct device *dev, struct device_driver *drv);
+static int bcma_device_probe(struct device *dev);
+static int bcma_device_remove(struct device *dev);

Try to reorder your functions so you don't need any forward declarations.

Quoted 3 lines

That's needed because I put bus-closely-related stuff at the beginning. I did this for readability, I don't think it really hurts anyone or is against coding style or sth.

When I'm reading a source file, I usually start at the end because that is where the important stuff gets registered to other subsystems. It's really confusing when one source file does it in a different order.

Further, it's not obvious that the code is recursion free if you have forward declarations in the beginning.

Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
drivers/bcma/TODO new file +6 -0
+const char *bcma_device_name(u16 coreid)
+{
+ ? ? switch (coreid) {
+ ? ? case BCMA_CORE_OOB_ROUTER:
+ ? ? ? ? ? ? return "OOB Router";
+ ? ? case BCMA_CORE_INVALID:
Quoted 8 lines
Quoted 5 lines

+ ? ? ? ? ? ? return "Invalid";
+ ? ? case BCMA_CORE_CHIPCOMMON:
+ ? ? ? ? ? ? return "ChipCommon";
+ ? ? case BCMA_CORE_ILINE20:
+ ? ? ? ? ? ? return "ILine 20";

It's better to make that a data structure than a switch() statement, both from readability and efficiency aspects.

Quoted 3 lines

Well, maybe. We call it only once, at init time. In any case we're still waiting for Broadcom to clarify which cores are really used for BCMA.

Readability is really what counts here. With efficiency, I mostly referred to code size, not execution time. As a general rule, use data structures instead of code where they are equivalent.

Quoted 30 lines
Quoted 21 lines
Quoted 21 lines
drivers/bcma/TODO new file +21 -0
+/* 1) It is not allowed to put struct device statically in bcma_device
+ * 2) We can not just use pointer to struct device because we use container_of
+ * 3) We do not have pointer to struct bcma_device in struct device
+ * Solution: use such a dummy wrapper
+ */
+struct __bcma_dev_wrapper {
+ ? ? struct device dev;
+ ? ? struct bcma_device *core;
+};
+
+struct bcma_device {
+ ? ? struct bcma_bus *bus;
+ ? ? struct bcma_device_id id;
+
+ ? ? struct device *dev;
+
+ ? ? u8 core_index;
+
+ ? ? u32 addr;
+ ? ? u32 wrap;
+
Quoted 8 lines
Quoted 2 lines

+ ? ? void *drvdata;
+};

Something went wrong here, maybe you misunderstood the API, or I misunderstood what you are trying to do. When you define your own bus type, the private device (struct bcma_device) should definitely contain a struct device as a member, and you allocate that structure dynamically when probing the bus. I don't see any reason for that wrapper.

Quoted 8 lines

Having "stuct device" in my "struct bcma_device" let me walk from bcma_device to device. Not the opposite. In case of:
manuf_show
id_show
rev_show
class_show
I've to go this opposite way. I've "stuct device" but I need to get corresponding "struct bcma_device".

Maybe you didn't understand what I said: This should be

struct bcma_device {
? ? struct bcma_bus *bus;
? ? struct bcma_device_id id;
? ? struct device dev;
? ? u8 core_index;

Quoted 8 lines

? ? u32 addr;
? ? u32 wrap;

? ? void *drvdata;
};

Here, bcma_device is the device, no need to follow pointers around. It's how all bus_types work, you should just do the same.

We can not use static "struct device", see Greg's comments in:
[RFC][PATCH V3] axi: add AXI bus driver
(not to mention we would have unused "struct device" in ChipCommon's and PCI's "struct bcma_device").

Signature · 1 line
Rafa?
#30 lore raw
Quoted 15 lines · On Sunday 08 May 2011 16:59:55 Rafa? Mi?ecki wrote:

2011/5/8 Arnd Bergmann <[email protected]>:

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

drivers/bcma/TODO line 3

Quoted 9 lines
drivers/bcma/TODO new file +3 -0
new file mode 100644
index 0000000..45eadc9
@@ -0,0 +1,3 @@
+- Interrupts
+- Defines for PCI core driver
+- Convert bcma_bus->cores into linked list

The last item doesn't make sense to me. Since you are using the regular driver model, you can simply iterate over all child devices of any dev.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

It's about optimization. Right now bcma_bus->cores is static array, we probably never will use all entries.

Oh, I see. You should probably have neither of them. Instead allocate the devices dynamically as you find them and do a device_register, which will add the device into linked list.

As I said, and wrote: TODO.

Well, I think getting this part right is essential before the patch can get merged.

Quoted 14 lines
Quoted 14 lines

Maybe you didn't understand what I said: This should be

struct bcma_device {
    struct bcma_bus *bus;
    struct bcma_device_id id;
    struct device dev;
    u8 core_index;

    u32 addr;
    u32 wrap;

    void *drvdata;
};
Quoted 7 lines
Quoted 2 lines

Here, bcma_device is the device, no need to follow pointers around. It's how all bus_types work, you should just do the same.

We can not use static "struct device", see Greg's comments in:
[RFC][PATCH V3] axi: add AXI bus driver
(not to mention we would have unused "struct device" in ChipCommon's and PCI's "struct bcma_device").

Please reread what Greg explained, it's actually the same as what I said here: Don't make the device static (you already don't), don't put the device structure as a member in the bus structure (as discussed above). Make the device a member of bcma_device, so you get proper reference counting for it, in the way that Greg explained.

Arnd

author maintainer
#31 lore raw

2011/5/8 Arnd Bergmann <[email protected]>:

Quoted 50 lines · On Sunday 08 May 2011 16:59:55 Rafa? Mi?ecki wrote:
Quoted 15 lines

2011/5/8 Arnd Bergmann <[email protected]>:

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

drivers/bcma/TODO line 3

Quoted 9 lines
drivers/bcma/TODO new file +3 -0
new file mode 100644
index 0000000..45eadc9
@@ -0,0 +1,3 @@
+- Interrupts
+- Defines for PCI core driver
+- Convert bcma_bus->cores into linked list

The last item doesn't make sense to me. Since you are using the regular driver model, you can simply iterate over all child devices of any dev.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

It's about optimization. Right now bcma_bus->cores is static array, we probably never will use all entries.

Oh, I see. You should probably have neither of them. Instead allocate the devices dynamically as you find them and do a device_register, which will add the device into linked list.

As I said, and wrote: TODO.

Well, I think getting this part right is essential before the patch can get merged.

Quoted 14 lines
Quoted 14 lines

Maybe you didn't understand what I said: This should be

struct bcma_device {
? ? struct bcma_bus *bus;
? ? struct bcma_device_id id;
? ? struct device dev;
? ? u8 core_index;

? ? u32 addr;
? ? u32 wrap;

? ? void *drvdata;
};

Quoted 7 lines
Quoted 2 lines

Here, bcma_device is the device, no need to follow pointers around. It's how all bus_types work, you should just do the same.

We can not use static "struct device", see Greg's comments in:
[RFC][PATCH V3] axi: add AXI bus driver
(not to mention we would have unused "struct device" in ChipCommon's and PCI's "struct bcma_device").

Quoted 6 lines

Please reread what Greg explained, it's actually the same as what I said here: Don't make the device static (you already don't), don't put the device structure as a member in the bus structure (as discussed above). Make the device a member of bcma_device, so you get proper reference counting for it, in the way that Greg explained.

Thanks for help & explaining! Unfortunately Greg didn't answer if my changed implementation is fine. I'll fix this!

Signature · 1 line
Rafa?
#32 lore raw
Quoted 58 lines · Rafa? Mi?ecki

2011/5/8 Arnd Bergmann <[email protected]>:

Quoted 50 lines · On Sunday 08 May 2011 16:59:55 Rafa? Mi?ecki wrote:
Quoted 15 lines

2011/5/8 Arnd Bergmann <[email protected]>:

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

drivers/bcma/TODO line 3

Quoted 9 lines
drivers/bcma/TODO new file +3 -0
new file mode 100644
index 0000000..45eadc9
@@ -0,0 +1,3 @@
+- Interrupts
+- Defines for PCI core driver
+- Convert bcma_bus->cores into linked list

The last item doesn't make sense to me. Since you are using the regular driver model, you can simply iterate over all child devices of any dev.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

It's about optimization. Right now bcma_bus->cores is static array, we probably never will use all entries.

Oh, I see. You should probably have neither of them. Instead allocate the devices dynamically as you find them and do a device_register, which will add the device into linked list.

As I said, and wrote: TODO.

Well, I think getting this part right is essential before the patch can get merged.

Quoted 14 lines
Quoted 14 lines

Maybe you didn't understand what I said: This should be

struct bcma_device {
? ? struct bcma_bus *bus;
? ? struct bcma_device_id id;
? ? struct device dev;
? ? u8 core_index;

? ? u32 addr;
? ? u32 wrap;

? ? void *drvdata;
};

Quoted 7 lines
Quoted 2 lines

Here, bcma_device is the device, no need to follow pointers around. It's how all bus_types work, you should just do the same.

We can not use static "struct device", see Greg's comments in:
[RFC][PATCH V3] axi: add AXI bus driver
(not to mention we would have unused "struct device" in ChipCommon's and PCI's "struct bcma_device").

Quoted 6 lines

Please reread what Greg explained, it's actually the same as what I said here: Don't make the device static (you already don't), don't put the device structure as a member in the bus structure (as discussed above). Make the device a member of bcma_device, so you get proper reference counting for it, in the way that Greg explained.

Quoted 2 lines

Thanks for help & explaining! Unfortunately Greg didn't answer if my changed implementation is fine. I'll fix this!

Greg didn't know that you changed it, or that you wanted review comments on it.

thanks,

greg "please be specific when asking for review" k-h

author maintainer
#33 lore raw

2011/5/9 Greg KH <[email protected]>:

Quoted 62 lines · Rafa? Mi?ecki
Quoted 58 lines

2011/5/8 Arnd Bergmann <[email protected]>:

Quoted 50 lines · On Sunday 08 May 2011 16:59:55 Rafa? Mi?ecki wrote:
Quoted 15 lines

2011/5/8 Arnd Bergmann <[email protected]>:

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

drivers/bcma/TODO line 3

Quoted 9 lines
drivers/bcma/TODO new file +3 -0
new file mode 100644
index 0000000..45eadc9
@@ -0,0 +1,3 @@
+- Interrupts
+- Defines for PCI core driver
+- Convert bcma_bus->cores into linked list

The last item doesn't make sense to me. Since you are using the regular driver model, you can simply iterate over all child devices of any dev.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

It's about optimization. Right now bcma_bus->cores is static array, we probably never will use all entries.

Oh, I see. You should probably have neither of them. Instead allocate the devices dynamically as you find them and do a device_register, which will add the device into linked list.

As I said, and wrote: TODO.

Well, I think getting this part right is essential before the patch can get merged.

Quoted 14 lines
Quoted 14 lines

Maybe you didn't understand what I said: This should be

struct bcma_device {
? ? struct bcma_bus *bus;
? ? struct bcma_device_id id;
? ? struct device dev;
? ? u8 core_index;

? ? u32 addr;
? ? u32 wrap;

? ? void *drvdata;
};

Quoted 7 lines
Quoted 2 lines

Here, bcma_device is the device, no need to follow pointers around. It's how all bus_types work, you should just do the same.

We can not use static "struct device", see Greg's comments in:
[RFC][PATCH V3] axi: add AXI bus driver
(not to mention we would have unused "struct device" in ChipCommon's and PCI's "struct bcma_device").

Quoted 6 lines

Please reread what Greg explained, it's actually the same as what I said here: Don't make the device static (you already don't), don't put the device structure as a member in the bus structure (as discussed above). Make the device a member of bcma_device, so you get proper reference counting for it, in the way that Greg explained.

Quoted 2 lines

Thanks for help & explaining! Unfortunately Greg didn't answer if my changed implementation is fine. I'll fix this!

Quoted 6 lines

Greg didn't know that you changed it, or that you wanted review comments on it.

thanks,

greg "please be specific when asking for review" k-h

Ups :) I asked for opinion in:
Date: Tue, 12 Apr 2011 20:52:55 +0200
Message-Id: <[email protected]>

Quoted 1 line

Greg: is this what you expected from dynamic allocation and documentation?

But it was hidden in commit comment and there were so many e-mails, it was probably easy to do not notice it.

Signature · 1 line
Rafa?
#34 lore raw
In reply to Rafał Miłecki
Quoted 73 lines · Rafa? Mi?ecki
Cc Greg KH <[email protected]>
Cc Michael B?sch <[email protected]>
Cc Larry Finger <[email protected]>
Cc George Kashperko <[email protected]>
Cc Arend van Spriel <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andy Botting <[email protected]>
Cc linuxdriverproject <[email protected]>
Cc linux-kernel at vger.kernel.org <[email protected]>

---
V2: Rename to axi
Use DEFINE_PCI_DEVICE_TABLE in bridge
Make use of pr_fmt and pr_*
Store core class
Rename bridge to not b43 specific
Replace magic 0x1000 with BCMAI_CORE_SIZE Remove some old "ssb" names and defines
Move BCMAI_ADDR_BASE def
Add drvdata field
V3: Fix reloading (kfree issue)
Add 14e4:0x4331
Fix non-initialized struct issue
Drop useless inline functions wrappers for pci core drv Proper pr_* usage
V3.1: Include forgotten changes (pr_* and include related)
Explain why we dare to implement empty release function
V4: Add ABI documentation
Move struct device to wrapper and alloc it dynamically checkpatch.pl pointed fixes
V5: Rename to bcma, AXI was really bad name
Use EXPORT_SYMBOL_GPL
Set pci driver fields in one place
Drop unlikely
Use BCMA_CORE_SIZE for calc in awrite32
Add README
Fix compilation (delay.h)

---
 Documentation/ABI/testing/sysfs-bus-bcma    |   31 ++
 drivers/Kconfig                             |    2 +
 drivers/Makefile                            |    1 +
 drivers/bcma/Kconfig                        |   33 +++
 drivers/bcma/Makefile                       |    7 +
 drivers/bcma/README                         |   18 ++
 drivers/bcma/TODO                           |    3 +
 drivers/bcma/bcma_private.h                 |   31 ++
 drivers/bcma/core.c                         |   51 ++++
 drivers/bcma/driver_chipcommon.c            |   87 ++++++
 drivers/bcma/driver_chipcommon_pmu.c        |  134 +++++++++
 drivers/bcma/driver_pci.c                   |  163 +++++++++++
 drivers/bcma/host_pci.c                     |  196 +++++++++++++
 drivers/bcma/main.c                         |  271 ++++++++++++++++++
 drivers/bcma/scan.c                         |  392 +++++++++++++++++++++++++++
 drivers/bcma/scan.h                         |   56 ++++
 include/linux/bcma/bcma.h                   |  232 ++++++++++++++++
 include/linux/bcma/bcma_driver_chipcommon.h |  297 ++++++++++++++++++++
 include/linux/bcma/bcma_driver_pci.h        |   89 ++++++
 include/linux/bcma/bcma_regs.h              |   34 +++
 include/linux/mod_devicetable.h             |   17 ++
 scripts/mod/file2alias.c                    |   22 ++
 22 files changed, 2167 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-bcma
 create mode 100644 drivers/bcma/Kconfig
 create mode 100644 drivers/bcma/Makefile
 create mode 100644 drivers/bcma/README
 create mode 100644 drivers/bcma/TODO
 create mode 100644 drivers/bcma/bcma_private.h
 create mode 100644 drivers/bcma/core.c
 create mode 100644 drivers/bcma/driver_chipcommon.c
 create mode 100644 drivers/bcma/driver_chipcommon_pmu.c
 create mode 100644 drivers/bcma/driver_pci.c
Quoted 9 lines
 create mode 100644 drivers/bcma/host_pci.c
 create mode 100644 drivers/bcma/main.c
 create mode 100644 drivers/bcma/scan.c
 create mode 100644 drivers/bcma/scan.h
 create mode 100644 include/linux/bcma/bcma.h
 create mode 100644 include/linux/bcma/bcma_driver_chipcommon.h
 create mode 100644 include/linux/bcma/bcma_driver_pci.h
 create mode 100644 include/linux/bcma/bcma_regs.h

Hi,

An entry in the MAINTAINERS file would be nice to find the right addresses to send patches to.

Hauke

author maintainer
#35 lore raw

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 83 lines · Rafa? Mi?ecki
Quoted 73 lines
Cc Greg KH <[email protected]>
Cc Michael B?sch <[email protected]>
Cc Larry Finger <[email protected]>
Cc George Kashperko <[email protected]>
Cc Arend van Spriel <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andy Botting <[email protected]>
Cc linuxdriverproject <[email protected]>
Cc linux-kernel at vger.kernel.org <[email protected]>

---
V2: Rename to axi
? ? Use DEFINE_PCI_DEVICE_TABLE in bridge
? ? Make use of pr_fmt and pr_*
? ? Store core class
? ? Rename bridge to not b43 specific
? ? Replace magic 0x1000 with BCMAI_CORE_SIZE
? ? Remove some old "ssb" names and defines
? ? Move BCMAI_ADDR_BASE def
? ? Add drvdata field
V3: Fix reloading (kfree issue)
? ? Add 14e4:0x4331
? ? Fix non-initialized struct issue
? ? Drop useless inline functions wrappers for pci core drv ? ? Proper pr_* usage
V3.1: Include forgotten changes (pr_* and include related) ? ? Explain why we dare to implement empty release function
V4: Add ABI documentation
? ? Move struct device to wrapper and alloc it dynamically ? ? checkpatch.pl pointed fixes
V5: Rename to bcma, AXI was really bad name
? ? Use EXPORT_SYMBOL_GPL
? ? Set pci driver fields in one place
? ? Drop unlikely
? ? Use BCMA_CORE_SIZE for calc in awrite32
? ? Add README
? ? Fix compilation (delay.h)
---

?Documentation/ABI/testing/sysfs-bus-bcma ? ?| ? 31 ++
?drivers/Kconfig ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +
?drivers/Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?1 +
?drivers/bcma/Kconfig ? ? ? ? ? ? ? ? ? ? ? ?| ? 33 +++
?drivers/bcma/Makefile ? ? ? ? ? ? ? ? ? ? ? | ? ?7 +
?drivers/bcma/README ? ? ? ? ? ? ? ? ? ? ? ? | ? 18 ++
?drivers/bcma/TODO ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?3 +
?drivers/bcma/bcma_private.h ? ? ? ? ? ? ? ? | ? 31 ++
?drivers/bcma/core.c ? ? ? ? ? ? ? ? ? ? ? ? | ? 51 ++++
?drivers/bcma/driver_chipcommon.c ? ? ? ? ? ?| ? 87 ++++++
?drivers/bcma/driver_chipcommon_pmu.c ? ? ? ?| ?134 +++++++++
?drivers/bcma/driver_pci.c ? ? ? ? ? ? ? ? ? | ?163 +++++++++++
?drivers/bcma/host_pci.c ? ? ? ? ? ? ? ? ? ? | ?196 +++++++++++++
?drivers/bcma/main.c ? ? ? ? ? ? ? ? ? ? ? ? | ?271 ++++++++++++++++++
?drivers/bcma/scan.c ? ? ? ? ? ? ? ? ? ? ? ? | ?392 +++++++++++++++++++++++++++
?drivers/bcma/scan.h ? ? ? ? ? ? ? ? ? ? ? ? | ? 56 ++++
?include/linux/bcma/bcma.h ? ? ? ? ? ? ? ? ? | ?232 ++++++++++++++++
?include/linux/bcma/bcma_driver_chipcommon.h | ?297 ++++++++++++++++++++
?include/linux/bcma/bcma_driver_pci.h ? ? ? ?| ? 89 ++++++
?include/linux/bcma/bcma_regs.h ? ? ? ? ? ? ?| ? 34 +++
?include/linux/mod_devicetable.h ? ? ? ? ? ? | ? 17 ++
?scripts/mod/file2alias.c ? ? ? ? ? ? ? ? ? ?| ? 22 ++

?22 files changed, 2167 insertions(+), 0 deletions(-) ?create mode 100644 Documentation/ABI/testing/sysfs-bus-bcma ?create mode 100644 drivers/bcma/Kconfig
?create mode 100644 drivers/bcma/Makefile
?create mode 100644 drivers/bcma/README
?create mode 100644 drivers/bcma/TODO
?create mode 100644 drivers/bcma/bcma_private.h ?create mode 100644 drivers/bcma/core.c
?create mode 100644 drivers/bcma/driver_chipcommon.c ?create mode 100644 drivers/bcma/driver_chipcommon_pmu.c ?create mode 100644 drivers/bcma/driver_pci.c

Quoted 9 lines

?create mode 100644 drivers/bcma/host_pci.c
?create mode 100644 drivers/bcma/main.c
?create mode 100644 drivers/bcma/scan.c
?create mode 100644 drivers/bcma/scan.h
?create mode 100644 include/linux/bcma/bcma.h
?create mode 100644 include/linux/bcma/bcma_driver_chipcommon.h ?create mode 100644 include/linux/bcma/bcma_driver_pci.h ?create mode 100644 include/linux/bcma/bcma_regs.h

Quoted 4 lines

Hi,

An entry in the MAINTAINERS file would be nice to find the right addresses to send patches to.

Will do, thanks. Should I put some ML for this driver?
netdev at vger.kernel.org? linux-wireless at vger.kernel.org? So far there are no net drivers for BCMA. Probably b43 will be the first (or brcm80211).

Signature · 1 line
Rafa?
#36 lore raw
Quoted 86 lines · Rafa? Mi?ecki

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 85 lines · Rafa? Mi?ecki
Quoted 73 lines
Cc Greg KH <[email protected]>
Cc Michael B?sch <[email protected]>
Cc Larry Finger <[email protected]>
Cc George Kashperko <[email protected]>
Cc Arend van Spriel <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andy Botting <[email protected]>
Cc linuxdriverproject <[email protected]>
Cc linux-kernel at vger.kernel.org <[email protected]>

---
V2: Rename to axi
Use DEFINE_PCI_DEVICE_TABLE in bridge
Make use of pr_fmt and pr_*
Store core class
Rename bridge to not b43 specific
Replace magic 0x1000 with BCMAI_CORE_SIZE Remove some old "ssb" names and defines
Move BCMAI_ADDR_BASE def
Add drvdata field
V3: Fix reloading (kfree issue)
Add 14e4:0x4331
Fix non-initialized struct issue
Drop useless inline functions wrappers for pci core drv Proper pr_* usage
V3.1: Include forgotten changes (pr_* and include related)
Explain why we dare to implement empty release function
V4: Add ABI documentation
Move struct device to wrapper and alloc it dynamically checkpatch.pl pointed fixes
V5: Rename to bcma, AXI was really bad name
Use EXPORT_SYMBOL_GPL
Set pci driver fields in one place
Drop unlikely
Use BCMA_CORE_SIZE for calc in awrite32
Add README
Fix compilation (delay.h)

---
 Documentation/ABI/testing/sysfs-bus-bcma    |   31 ++
 drivers/Kconfig                             |    2 +
 drivers/Makefile                            |    1 +
 drivers/bcma/Kconfig                        |   33 +++
 drivers/bcma/Makefile                       |    7 +
 drivers/bcma/README                         |   18 ++
 drivers/bcma/TODO                           |    3 +
 drivers/bcma/bcma_private.h                 |   31 ++
 drivers/bcma/core.c                         |   51 ++++
 drivers/bcma/driver_chipcommon.c            |   87 ++++++
 drivers/bcma/driver_chipcommon_pmu.c        |  134 +++++++++
 drivers/bcma/driver_pci.c                   |  163 +++++++++++
 drivers/bcma/host_pci.c                     |  196 +++++++++++++
 drivers/bcma/main.c                         |  271 ++++++++++++++++++
 drivers/bcma/scan.c                         |  392 +++++++++++++++++++++++++++
 drivers/bcma/scan.h                         |   56 ++++
 include/linux/bcma/bcma.h                   |  232 ++++++++++++++++
 include/linux/bcma/bcma_driver_chipcommon.h |  297 ++++++++++++++++++++
 include/linux/bcma/bcma_driver_pci.h        |   89 ++++++
 include/linux/bcma/bcma_regs.h              |   34 +++
 include/linux/mod_devicetable.h             |   17 ++
 scripts/mod/file2alias.c                    |   22 ++
 22 files changed, 2167 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-bcma
 create mode 100644 drivers/bcma/Kconfig
 create mode 100644 drivers/bcma/Makefile
 create mode 100644 drivers/bcma/README
 create mode 100644 drivers/bcma/TODO
 create mode 100644 drivers/bcma/bcma_private.h
 create mode 100644 drivers/bcma/core.c
 create mode 100644 drivers/bcma/driver_chipcommon.c
 create mode 100644 drivers/bcma/driver_chipcommon_pmu.c
 create mode 100644 drivers/bcma/driver_pci.c
Quoted 9 lines
 create mode 100644 drivers/bcma/host_pci.c
 create mode 100644 drivers/bcma/main.c
 create mode 100644 drivers/bcma/scan.c
 create mode 100644 drivers/bcma/scan.h
 create mode 100644 include/linux/bcma/bcma.h
 create mode 100644 include/linux/bcma/bcma_driver_chipcommon.h
 create mode 100644 include/linux/bcma/bcma_driver_pci.h
 create mode 100644 include/linux/bcma/bcma_regs.h

Hi,

Quoted 8 lines
Quoted 2 lines

An entry in the MAINTAINERS file would be nice to find the right addresses to send patches to.

Will do, thanks. Should I put some ML for this driver?
netdev at vger.kernel.org? linux-wireless at vger.kernel.org? So far there are no net drivers for BCMA. Probably b43 will be the first (or brcm80211).

There is a Ethernet core used on embedded devices with this bus and George wrote a driver for the first version of this bus implementation, he send to the ML. Most user will use this with some wireless devices so I would add linux-wireless at vger.kernel.org. Why does ssb uses netdev ML?

Hauke

author maintainer
#37 lore raw

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 95 lines · Rafa? Mi?ecki
Quoted 86 lines

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 85 lines · Rafa? Mi?ecki
Quoted 73 lines
Cc Greg KH <[email protected]>
Cc Michael B?sch <[email protected]>
Cc Larry Finger <[email protected]>
Cc George Kashperko <[email protected]>
Cc Arend van Spriel <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andy Botting <[email protected]>
Cc linuxdriverproject <[email protected]>
Cc linux-kernel at vger.kernel.org <[email protected]>

---
V2: Rename to axi
? ? Use DEFINE_PCI_DEVICE_TABLE in bridge
? ? Make use of pr_fmt and pr_*
? ? Store core class
? ? Rename bridge to not b43 specific
? ? Replace magic 0x1000 with BCMAI_CORE_SIZE
? ? Remove some old "ssb" names and defines
? ? Move BCMAI_ADDR_BASE def
? ? Add drvdata field
V3: Fix reloading (kfree issue)
? ? Add 14e4:0x4331
? ? Fix non-initialized struct issue
? ? Drop useless inline functions wrappers for pci core drv ? ? Proper pr_* usage
V3.1: Include forgotten changes (pr_* and include related) ? ? Explain why we dare to implement empty release function
V4: Add ABI documentation
? ? Move struct device to wrapper and alloc it dynamically ? ? checkpatch.pl pointed fixes
V5: Rename to bcma, AXI was really bad name
? ? Use EXPORT_SYMBOL_GPL
? ? Set pci driver fields in one place
? ? Drop unlikely
? ? Use BCMA_CORE_SIZE for calc in awrite32
? ? Add README
? ? Fix compilation (delay.h)
---

?Documentation/ABI/testing/sysfs-bus-bcma ? ?| ? 31 ++
?drivers/Kconfig ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +
?drivers/Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?1 +
?drivers/bcma/Kconfig ? ? ? ? ? ? ? ? ? ? ? ?| ? 33 +++
?drivers/bcma/Makefile ? ? ? ? ? ? ? ? ? ? ? | ? ?7 +
?drivers/bcma/README ? ? ? ? ? ? ? ? ? ? ? ? | ? 18 ++
?drivers/bcma/TODO ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?3 +
?drivers/bcma/bcma_private.h ? ? ? ? ? ? ? ? | ? 31 ++
?drivers/bcma/core.c ? ? ? ? ? ? ? ? ? ? ? ? | ? 51 ++++
?drivers/bcma/driver_chipcommon.c ? ? ? ? ? ?| ? 87 ++++++
?drivers/bcma/driver_chipcommon_pmu.c ? ? ? ?| ?134 +++++++++
?drivers/bcma/driver_pci.c ? ? ? ? ? ? ? ? ? | ?163 +++++++++++
?drivers/bcma/host_pci.c ? ? ? ? ? ? ? ? ? ? | ?196 +++++++++++++
?drivers/bcma/main.c ? ? ? ? ? ? ? ? ? ? ? ? | ?271 ++++++++++++++++++
?drivers/bcma/scan.c ? ? ? ? ? ? ? ? ? ? ? ? | ?392 +++++++++++++++++++++++++++
?drivers/bcma/scan.h ? ? ? ? ? ? ? ? ? ? ? ? | ? 56 ++++
?include/linux/bcma/bcma.h ? ? ? ? ? ? ? ? ? | ?232 ++++++++++++++++
?include/linux/bcma/bcma_driver_chipcommon.h | ?297 ++++++++++++++++++++
?include/linux/bcma/bcma_driver_pci.h ? ? ? ?| ? 89 ++++++
?include/linux/bcma/bcma_regs.h ? ? ? ? ? ? ?| ? 34 +++
?include/linux/mod_devicetable.h ? ? ? ? ? ? | ? 17 ++
?scripts/mod/file2alias.c ? ? ? ? ? ? ? ? ? ?| ? 22 ++

?22 files changed, 2167 insertions(+), 0 deletions(-) ?create mode 100644 Documentation/ABI/testing/sysfs-bus-bcma ?create mode 100644 drivers/bcma/Kconfig
?create mode 100644 drivers/bcma/Makefile
?create mode 100644 drivers/bcma/README
?create mode 100644 drivers/bcma/TODO
?create mode 100644 drivers/bcma/bcma_private.h ?create mode 100644 drivers/bcma/core.c
?create mode 100644 drivers/bcma/driver_chipcommon.c ?create mode 100644 drivers/bcma/driver_chipcommon_pmu.c ?create mode 100644 drivers/bcma/driver_pci.c

Quoted 9 lines

?create mode 100644 drivers/bcma/host_pci.c
?create mode 100644 drivers/bcma/main.c
?create mode 100644 drivers/bcma/scan.c
?create mode 100644 drivers/bcma/scan.h
?create mode 100644 include/linux/bcma/bcma.h
?create mode 100644 include/linux/bcma/bcma_driver_chipcommon.h ?create mode 100644 include/linux/bcma/bcma_driver_pci.h ?create mode 100644 include/linux/bcma/bcma_regs.h

Hi,

Quoted 8 lines
Quoted 2 lines

An entry in the MAINTAINERS file would be nice to find the right addresses to send patches to.

Will do, thanks. Should I put some ML for this driver?
netdev at vger.kernel.org? linux-wireless at vger.kernel.org? So far there are no net drivers for BCMA. Probably b43 will be the first (or brcm80211).

Quoted 4 lines

There is a Ethernet core used on embedded devices with this bus and George wrote a driver for the first version of this bus implementation, he send to the ML. Most user will use this with some wireless devices so I would add linux-wireless at vger.kernel.org. Why does ssb uses netdev ML?

Thanks, I didn't know about this ethernet driver. Have to check it! Where was this published? Do you have a thread name?

I'm not sure if we want linux-wireless to be ML, if we already have some Ethernet driver. Some network-general ML makes more sense then. Maybe netdev would be better.

Signature · 1 line
Rafa?
#38 lore raw
Quoted 96 lines · Rafa? Mi?ecki

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 95 lines · Rafa? Mi?ecki
Quoted 94 lines

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 83 lines · Rafa? Mi?ecki
Quoted 73 lines
Cc Greg KH <[email protected]>
Cc Michael B?sch <[email protected]>
Cc Larry Finger <[email protected]>
Cc George Kashperko <[email protected]>
Cc Arend van Spriel <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andy Botting <[email protected]>
Cc linuxdriverproject <[email protected]>
Cc linux-kernel at vger.kernel.org <[email protected]>

---
V2: Rename to axi
Use DEFINE_PCI_DEVICE_TABLE in bridge
Make use of pr_fmt and pr_*
Store core class
Rename bridge to not b43 specific
Replace magic 0x1000 with BCMAI_CORE_SIZE Remove some old "ssb" names and defines
Move BCMAI_ADDR_BASE def
Add drvdata field
V3: Fix reloading (kfree issue)
Add 14e4:0x4331
Fix non-initialized struct issue
Drop useless inline functions wrappers for pci core drv Proper pr_* usage
V3.1: Include forgotten changes (pr_* and include related)
Explain why we dare to implement empty release function
V4: Add ABI documentation
Move struct device to wrapper and alloc it dynamically checkpatch.pl pointed fixes
V5: Rename to bcma, AXI was really bad name
Use EXPORT_SYMBOL_GPL
Set pci driver fields in one place
Drop unlikely
Use BCMA_CORE_SIZE for calc in awrite32
Add README
Fix compilation (delay.h)

---
 Documentation/ABI/testing/sysfs-bus-bcma    |   31 ++
 drivers/Kconfig                             |    2 +
 drivers/Makefile                            |    1 +
 drivers/bcma/Kconfig                        |   33 +++
 drivers/bcma/Makefile                       |    7 +
 drivers/bcma/README                         |   18 ++
 drivers/bcma/TODO                           |    3 +
 drivers/bcma/bcma_private.h                 |   31 ++
 drivers/bcma/core.c                         |   51 ++++
 drivers/bcma/driver_chipcommon.c            |   87 ++++++
 drivers/bcma/driver_chipcommon_pmu.c        |  134 +++++++++
 drivers/bcma/driver_pci.c                   |  163 +++++++++++
 drivers/bcma/host_pci.c                     |  196 +++++++++++++
 drivers/bcma/main.c                         |  271 ++++++++++++++++++
 drivers/bcma/scan.c                         |  392 +++++++++++++++++++++++++++
 drivers/bcma/scan.h                         |   56 ++++
 include/linux/bcma/bcma.h                   |  232 ++++++++++++++++
 include/linux/bcma/bcma_driver_chipcommon.h |  297 ++++++++++++++++++++
 include/linux/bcma/bcma_driver_pci.h        |   89 ++++++
 include/linux/bcma/bcma_regs.h              |   34 +++
 include/linux/mod_devicetable.h             |   17 ++
 scripts/mod/file2alias.c                    |   22 ++
 22 files changed, 2167 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-bcma
 create mode 100644 drivers/bcma/Kconfig
 create mode 100644 drivers/bcma/Makefile
 create mode 100644 drivers/bcma/README
 create mode 100644 drivers/bcma/TODO
 create mode 100644 drivers/bcma/bcma_private.h
 create mode 100644 drivers/bcma/core.c
 create mode 100644 drivers/bcma/driver_chipcommon.c
 create mode 100644 drivers/bcma/driver_chipcommon_pmu.c
 create mode 100644 drivers/bcma/driver_pci.c
Quoted 9 lines
 create mode 100644 drivers/bcma/host_pci.c
 create mode 100644 drivers/bcma/main.c
 create mode 100644 drivers/bcma/scan.c
 create mode 100644 drivers/bcma/scan.h
 create mode 100644 include/linux/bcma/bcma.h
 create mode 100644 include/linux/bcma/bcma_driver_chipcommon.h
 create mode 100644 include/linux/bcma/bcma_driver_pci.h
 create mode 100644 include/linux/bcma/bcma_regs.h
Quoted 4 lines

Hi,

An entry in the MAINTAINERS file would be nice to find the right addresses to send patches to.

Will do, thanks. Should I put some ML for this driver?
netdev at vger.kernel.org? linux-wireless at vger.kernel.org? So far there are no net drivers for BCMA. Probably b43 will be the first (or brcm80211).

Quoted 7 lines
Quoted 4 lines

There is a Ethernet core used on embedded devices with this bus and George wrote a driver for the first version of this bus implementation, he send to the ML. Most user will use this with some wireless devices so I would add linux-wireless at vger.kernel.org. Why does ssb uses netdev ML?

Thanks, I didn't know about this ethernet driver. Have to check it! Where was this published? Do you have a thread name?

I think he haven't send it to the mailing list, there is a link [0] in some Ticket [1] at OpenWrt. This driver was derived from source code Braodcom have published, but not under a GPL compatible license. It will be nice if Braodcom would allow us to publish a driver under the terms of the GPL for the Ethernet core based on their driver, without writing a full spec of the driver like it was done for b43.

Quoted 3 lines

I'm not sure if we want linux-wireless to be ML, if we already have some Ethernet driver. Some network-general ML makes more sense then. Maybe netdev would be better.

Some of the embedded devices also have a USB core on the BCMA bus and a pci(e) host controller to connect other pci(e) devices. As most of the patches for ssb came from the wireless guys and I do not thing this will be different for bcma, I thing the wireless mailing list is the correct place.

@George what is the status of adding support for the embedded devices?

Hauke

[0] http://www.znau.edu.ua/temp/asus-rt-n16/openwrt-bcm4716-README.txt
[1] https://dev.openwrt.org/ticket/6580#comment

author maintainer
#39 lore raw

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 105 lines · Rafa? Mi?ecki
Quoted 96 lines

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 95 lines · Rafa? Mi?ecki
Quoted 94 lines

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 83 lines · Rafa? Mi?ecki
Quoted 73 lines
Cc Greg KH <[email protected]>
Cc Michael B?sch <[email protected]>
Cc Larry Finger <[email protected]>
Cc George Kashperko <[email protected]>
Cc Arend van Spriel <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andy Botting <[email protected]>
Cc linuxdriverproject <[email protected]>
Cc linux-kernel at vger.kernel.org <[email protected]>

---
V2: Rename to axi
? ? Use DEFINE_PCI_DEVICE_TABLE in bridge
? ? Make use of pr_fmt and pr_*
? ? Store core class
? ? Rename bridge to not b43 specific
? ? Replace magic 0x1000 with BCMAI_CORE_SIZE
? ? Remove some old "ssb" names and defines
? ? Move BCMAI_ADDR_BASE def
? ? Add drvdata field
V3: Fix reloading (kfree issue)
? ? Add 14e4:0x4331
? ? Fix non-initialized struct issue
? ? Drop useless inline functions wrappers for pci core drv ? ? Proper pr_* usage
V3.1: Include forgotten changes (pr_* and include related) ? ? Explain why we dare to implement empty release function
V4: Add ABI documentation
? ? Move struct device to wrapper and alloc it dynamically ? ? checkpatch.pl pointed fixes
V5: Rename to bcma, AXI was really bad name
? ? Use EXPORT_SYMBOL_GPL
? ? Set pci driver fields in one place
? ? Drop unlikely
? ? Use BCMA_CORE_SIZE for calc in awrite32
? ? Add README
? ? Fix compilation (delay.h)
---

?Documentation/ABI/testing/sysfs-bus-bcma ? ?| ? 31 ++
?drivers/Kconfig ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +
?drivers/Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?1 +
?drivers/bcma/Kconfig ? ? ? ? ? ? ? ? ? ? ? ?| ? 33 +++
?drivers/bcma/Makefile ? ? ? ? ? ? ? ? ? ? ? | ? ?7 +
?drivers/bcma/README ? ? ? ? ? ? ? ? ? ? ? ? | ? 18 ++
?drivers/bcma/TODO ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?3 +
?drivers/bcma/bcma_private.h ? ? ? ? ? ? ? ? | ? 31 ++
?drivers/bcma/core.c ? ? ? ? ? ? ? ? ? ? ? ? | ? 51 ++++
?drivers/bcma/driver_chipcommon.c ? ? ? ? ? ?| ? 87 ++++++
?drivers/bcma/driver_chipcommon_pmu.c ? ? ? ?| ?134 +++++++++
?drivers/bcma/driver_pci.c ? ? ? ? ? ? ? ? ? | ?163 +++++++++++
?drivers/bcma/host_pci.c ? ? ? ? ? ? ? ? ? ? | ?196 +++++++++++++
?drivers/bcma/main.c ? ? ? ? ? ? ? ? ? ? ? ? | ?271 ++++++++++++++++++
?drivers/bcma/scan.c ? ? ? ? ? ? ? ? ? ? ? ? | ?392 +++++++++++++++++++++++++++
?drivers/bcma/scan.h ? ? ? ? ? ? ? ? ? ? ? ? | ? 56 ++++
?include/linux/bcma/bcma.h ? ? ? ? ? ? ? ? ? | ?232 ++++++++++++++++
?include/linux/bcma/bcma_driver_chipcommon.h | ?297 ++++++++++++++++++++
?include/linux/bcma/bcma_driver_pci.h ? ? ? ?| ? 89 ++++++
?include/linux/bcma/bcma_regs.h ? ? ? ? ? ? ?| ? 34 +++
?include/linux/mod_devicetable.h ? ? ? ? ? ? | ? 17 ++
?scripts/mod/file2alias.c ? ? ? ? ? ? ? ? ? ?| ? 22 ++

?22 files changed, 2167 insertions(+), 0 deletions(-) ?create mode 100644 Documentation/ABI/testing/sysfs-bus-bcma ?create mode 100644 drivers/bcma/Kconfig
?create mode 100644 drivers/bcma/Makefile
?create mode 100644 drivers/bcma/README
?create mode 100644 drivers/bcma/TODO
?create mode 100644 drivers/bcma/bcma_private.h ?create mode 100644 drivers/bcma/core.c
?create mode 100644 drivers/bcma/driver_chipcommon.c ?create mode 100644 drivers/bcma/driver_chipcommon_pmu.c ?create mode 100644 drivers/bcma/driver_pci.c

Quoted 9 lines

?create mode 100644 drivers/bcma/host_pci.c
?create mode 100644 drivers/bcma/main.c
?create mode 100644 drivers/bcma/scan.c
?create mode 100644 drivers/bcma/scan.h
?create mode 100644 include/linux/bcma/bcma.h
?create mode 100644 include/linux/bcma/bcma_driver_chipcommon.h ?create mode 100644 include/linux/bcma/bcma_driver_pci.h ?create mode 100644 include/linux/bcma/bcma_regs.h

Quoted 4 lines

Hi,

An entry in the MAINTAINERS file would be nice to find the right addresses to send patches to.

Will do, thanks. Should I put some ML for this driver?
netdev at vger.kernel.org? linux-wireless at vger.kernel.org? So far there are no net drivers for BCMA. Probably b43 will be the first (or brcm80211).

Quoted 7 lines
Quoted 4 lines

There is a Ethernet core used on embedded devices with this bus and George wrote a driver for the first version of this bus implementation, he send to the ML. Most user will use this with some wireless devices so I would add linux-wireless at vger.kernel.org. Why does ssb uses netdev ML?

Thanks, I didn't know about this ethernet driver. Have to check it! Where was this published? Do you have a thread name?

Quoted 6 lines

I think he haven't send it to the mailing list, there is a link [0] in some Ticket [1] at OpenWrt. This driver was derived from source code Braodcom have published, but not under a GPL compatible license. It will be nice if Braodcom would allow us to publish a driver under the terms of the GPL for the Ethernet core based on their driver, without writing a full spec of the driver like it was done for b43.

OK, I'll stay away from this driver for now (license).

Quoted 9 lines
Quoted 3 lines

I'm not sure if we want linux-wireless to be ML, if we already have some Ethernet driver. Some network-general ML makes more sense then. Maybe netdev would be better.

Some of the embedded devices also have a USB core on the BCMA bus and a pci(e) host controller to connect other pci(e) devices. As most of the patches for ssb came from the wireless guys and I do not thing this will be different for bcma, I thing the wireless mailing list is the correct place.

Ups, yeah, you're right. I didn't think about USB, V90, PCI(e), etc... I think situations linux-wireless as most active or linux-kernel as most generic should be used. I think I'm fine with linux-wireless.

Signature · 1 line
Rafa?
#40 lore raw
In reply to Hauke Mehrtens

Hi,

Quoted 7 lines

Some of the embedded devices also have a USB core on the BCMA bus and a pci(e) host controller to connect other pci(e) devices. As most of the patches for ssb came from the wireless guys and I do not thing this will be different for bcma, I thing the wireless mailing list is the correct place.

@George what is the status of adding support for the embedded devices?

Haven't been looking into Rafal's code closely yet. I'm working on another solution suitable for SSB, AXI and hopefully UBUS as well but I don't ready to publish it yet.

Regarding ethernet driver, still no feedback on GPL-friendly licensing possibility for the code from Broadcom.

Have nice day,
George

#41 lore raw
In reply to Hauke Mehrtens
Quoted 16 lines · Hauke Mehrtens
Quoted 8 lines · Rafa? Mi?ecki

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 4 lines

There is a Ethernet core used on embedded devices with this bus and George wrote a driver for the first version of this bus implementation, he send to the ML. Most user will use this with some wireless devices so I would add linux-wireless at vger.kernel.org. Why does ssb uses netdev ML?

Thanks, I didn't know about this ethernet driver. Have to check it! Where was this published? Do you have a thread name?

I think he haven't send it to the mailing list, there is a link [0] in some Ticket [1] at OpenWrt. This driver was derived from source code Braodcom have published, but not under a GPL compatible license. It will be nice if Braodcom would allow us to publish a driver under the terms of the GPL for the Ethernet core based on their driver, without writing a full spec of the driver like it was done for b43.

...

Quoted 3 lines

[0] http://www.znau.edu.ua/temp/asus-rt-n16/openwrt-bcm4716-README.txt
[1] https://dev.openwrt.org/ticket/6580#comment

All of of the patches listed in [0] appear to contain GPL-licensed code. Can you provide a pointer to the ethernet driver that you think is not under a GPL-compatible license?

Thanks,
---
Henry Ptasinski
henryp at broadcom.com

#42 lore raw
Quoted 18 lines · Henry Ptasinski
Quoted 10 lines · Hauke Mehrtens
Quoted 8 lines · Rafa? Mi?ecki

2011/5/7 Hauke Mehrtens <[email protected]>:

Quoted 4 lines

There is a Ethernet core used on embedded devices with this bus and George wrote a driver for the first version of this bus implementation, he send to the ML. Most user will use this with some wireless devices so I would add linux-wireless at vger.kernel.org. Why does ssb uses netdev ML?

Thanks, I didn't know about this ethernet driver. Have to check it! Where was this published? Do you have a thread name?

Quoted 6 lines

I think he haven't send it to the mailing list, there is a link [0] in some Ticket [1] at OpenWrt. This driver was derived from source code Braodcom have published, but not under a GPL compatible license. It will be nice if Braodcom would allow us to publish a driver under the terms of the GPL for the Ethernet core based on their driver, without writing a full spec of the driver like it was done for b43.

Quoted 8 lines

...

Quoted 3 lines

[0] http://www.znau.edu.ua/temp/asus-rt-n16/openwrt-bcm4716-README.txt
[1] https://dev.openwrt.org/ticket/6580#comment

All of of the patches listed in [0] appear to contain GPL-licensed code. Can you provide a pointer to the ethernet driver that you think is not under a GPL-compatible license?

I was only able to find the driver George build based on the et driver as a patch in a patch version. It is patch 999-openwrt4716-ssb-bgmac-mak-driver.patch in
http://www.znau.edu.ua/temp/asus-rt-n16/2011-02-13T23-17/001-openwrt4716-TARGET_brcm4716.patch

This driver is based on the Broadcom et driver from the GPL source package of the Asus RT-N16. One of the files has this header [0]. This license does not seam to be compatible with the GPL. Netgear provides the et driver just in binary format without any source code.

It will be nice if Broadcom is fine when we build and release an Ethernet driver like 999-openwrt4716-ssb-bgmac-mak-driver.patch using bcma under the terms of the GPL and using et as a reference. The best thing would be if you could release the Broadcom et driver under a GPL compatible license, so we are able to use it as a reference implementation without any problems.

If you relicense your driver you will probably get a Ethernet driver based on the bcma bus without any costs. I do not see any problems with the FCC, if your release this code. Every one how wants to see the source code already did so, as it is freely available for years now.

Hauke

[0] RT-N16/src/et/sys/etcgmac.c header:
---
Broadcom Gigabit Ethernet MAC (Unimac) core.

This file implements the chip-specific routines for the GMAC core.

Copyright (C) 2009, Broadcom Corporation
All Rights Reserved.

This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; the contents of this file may not be disclosed to third parties, copied or duplicated in any form, in whole or in part, without the prior written permission of Broadcom Corporation.
---

#43 lore raw
In reply to Rafał Miłecki

On 05/05/2011 11:59 PM, Rafa? Mi?ecki wrote:
.....

Quoted 2 lines
drivers/bcma/bcma_private.h new file +0 -0

.....

Quoted 4 lines
drivers/bcma/bcma_private.h new file +4 -0
+
+#define BCMA_ADDR_BASE		0x18000000
+#define BCMA_WRAP_BASE		0x18100000
+

......

drivers/bcma/scan.h line 6

Quoted 9 lines
drivers/bcma/scan.h new file +6 -0
@@ -0,0 +1,56 @@
+#ifndef BCMA_SCAN_H_
+#define BCMA_SCAN_H_
+
+#define BCMA_ADDR_BASE		0x18000000
+#define BCMA_WRAP_BASE		0x18100000
+

.....

While graping through the code I found this. BCMA_ADDR_BASE and BCMA_WRAP_BASE are defined twice.

Why are some constants defined in purpose specific headers in drivers/bcma/*.h like drivers/bcma/scan.h and some in drivers/bcma/bcma_private.h and other in include/linux/bcma/bcma_regs.h ?

Hauke

author maintainer
#44 lore raw

2011/5/8 Hauke Mehrtens <[email protected]>:

Quoted 21 lines · Rafa? Mi?ecki

.....

Quoted 2 lines
drivers/bcma/bcma_private.h new file +0 -0

.....

Quoted 4 lines
drivers/bcma/bcma_private.h new file +4 -0
+
+#define BCMA_ADDR_BASE ? ? ? ? ? ? ? 0x18000000
+#define BCMA_WRAP_BASE ? ? ? ? ? ? ? 0x18100000
+

......

Quoted 9 lines
drivers/bcma/scan.h new file +6 -0
@@ -0,0 +1,56 @@
+#ifndef BCMA_SCAN_H_
+#define BCMA_SCAN_H_
+
+#define BCMA_ADDR_BASE ? ? ? ? ? ? ? 0x18000000
+#define BCMA_WRAP_BASE ? ? ? ? ? ? ? 0x18100000
+

.....

Quoted 2 lines

While graping through the code I found this. BCMA_ADDR_BASE and BCMA_WRAP_BASE are defined twice.

Will fix, thx.

Quoted 3 lines

Why are some constants defined in purpose specific headers in drivers/bcma/*.h like drivers/bcma/scan.h and some in drivers/bcma/bcma_private.h and other in include/linux/bcma/bcma_regs.h ?

What is unclear to you in this split? It says everything. scan.h for scanning, regs for registers, private for internal functions.

Signature · 1 line
Rafa?