summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracoul <acoul@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-04-24 06:54:17 +0000
committeracoul <acoul@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-04-24 06:54:17 +0000
commit81a803d0d45d1c5fde6e7f00fb2b7c52181a8bd7 (patch)
treef3214030c348853417d37c8b2fa25ab79e5e31c9
parent6125e3dc7782cc6c04f1b8e9731627807aba04ec (diff)
brcm47xx: add sysfs attributes to ssb devices & new defines for registers and device ids (credits: Bernhard Loos)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21119 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/brcm47xx/patches-2.6.32/950-sbb-sysfs-files.patch45
-rw-r--r--target/linux/brcm47xx/patches-2.6.32/951-brcm4716-defines.patch25
-rw-r--r--target/linux/brcm47xx/patches-2.6.33/950-sbb-sysfs-files.patch45
-rw-r--r--target/linux/brcm47xx/patches-2.6.33/951-brcm4716-defines.patch25
-rw-r--r--target/linux/brcm47xx/patches-2.6.34/950-sbb-sysfs-files.patch45
-rw-r--r--target/linux/brcm47xx/patches-2.6.34/951-brcm4716-defines.patch25
6 files changed, 210 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/patches-2.6.32/950-sbb-sysfs-files.patch b/target/linux/brcm47xx/patches-2.6.32/950-sbb-sysfs-files.patch
new file mode 100644
index 000000000..ddb1f1b38
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.32/950-sbb-sysfs-files.patch
@@ -0,0 +1,45 @@
+--- a/drivers/ssb/main.c
++++ b/drivers/ssb/main.c
+@@ -385,6 +385,34 @@ static int ssb_device_uevent(struct devi
+ ssb_dev->id.revision);
+ }
+
++#define ssb_config_attr(attrib, field, format_string) \
++static ssize_t \
++attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
++{ \
++ return sprintf (buf, format_string, dev_to_ssb_dev(dev)->field); \
++}
++
++ssb_config_attr(core_num, core_index, "%u\n")
++ssb_config_attr(coreid, id.coreid, "0x%04x\n")
++ssb_config_attr(vendor, id.vendor, "0x%04x\n")
++ssb_config_attr(revision, id.revision, "%u\n")
++ssb_config_attr(irq, irq, "%u\n")
++static ssize_t
++name_show(struct device *dev, struct device_attribute *attr, char *buf)
++{
++ return sprintf (buf, "%s\n", ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
++}
++
++static struct device_attribute ssb_device_attrs[] = {
++ __ATTR_RO(name),
++ __ATTR_RO(core_num),
++ __ATTR_RO(coreid),
++ __ATTR_RO(vendor),
++ __ATTR_RO(revision),
++ __ATTR_RO(irq),
++ __ATTR_NULL,
++};
++
+ static struct bus_type ssb_bustype = {
+ .name = "ssb",
+ .match = ssb_bus_match,
+@@ -394,6 +422,7 @@ static struct bus_type ssb_bustype = {
+ .suspend = ssb_device_suspend,
+ .resume = ssb_device_resume,
+ .uevent = ssb_device_uevent,
++ .dev_attrs = ssb_device_attrs,
+ };
+
+ static void ssb_buses_lock(void)
diff --git a/target/linux/brcm47xx/patches-2.6.32/951-brcm4716-defines.patch b/target/linux/brcm47xx/patches-2.6.32/951-brcm4716-defines.patch
new file mode 100644
index 000000000..cde712c4a
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.32/951-brcm4716-defines.patch
@@ -0,0 +1,25 @@
+--- a/drivers/ssb/scan.c
++++ b/drivers/ssb/scan.c
+@@ -92,6 +92,14 @@ const char *ssb_core_name(u16 coreid)
+ return "ARM 1176";
+ case SSB_DEV_ARM_7TDMI:
+ return "ARM 7TDMI";
++ case SSB_DEV_ETHERNET_GBIT2:
++ return "Gigabit MAC";
++ case SSB_DEV_MIPS_74K:
++ return "MIPS 74k";
++ case SSB_DEV_DDR_CTRLR:
++ return "DDR1/2 memory controller";
++ case SSB_DEV_I2S:
++ return "I2S";
+ }
+ return "UNKNOWN";
+ }
+@@ -150,6 +158,7 @@ static u8 chipid_to_nrcores(u16 chipid)
+ case 0x4710:
+ case 0x4610:
+ case 0x4704:
++ case 0x4716:
+ return 9;
+ default:
+ ssb_printk(KERN_ERR PFX
diff --git a/target/linux/brcm47xx/patches-2.6.33/950-sbb-sysfs-files.patch b/target/linux/brcm47xx/patches-2.6.33/950-sbb-sysfs-files.patch
new file mode 100644
index 000000000..ddb1f1b38
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.33/950-sbb-sysfs-files.patch
@@ -0,0 +1,45 @@
+--- a/drivers/ssb/main.c
++++ b/drivers/ssb/main.c
+@@ -385,6 +385,34 @@ static int ssb_device_uevent(struct devi
+ ssb_dev->id.revision);
+ }
+
++#define ssb_config_attr(attrib, field, format_string) \
++static ssize_t \
++attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
++{ \
++ return sprintf (buf, format_string, dev_to_ssb_dev(dev)->field); \
++}
++
++ssb_config_attr(core_num, core_index, "%u\n")
++ssb_config_attr(coreid, id.coreid, "0x%04x\n")
++ssb_config_attr(vendor, id.vendor, "0x%04x\n")
++ssb_config_attr(revision, id.revision, "%u\n")
++ssb_config_attr(irq, irq, "%u\n")
++static ssize_t
++name_show(struct device *dev, struct device_attribute *attr, char *buf)
++{
++ return sprintf (buf, "%s\n", ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
++}
++
++static struct device_attribute ssb_device_attrs[] = {
++ __ATTR_RO(name),
++ __ATTR_RO(core_num),
++ __ATTR_RO(coreid),
++ __ATTR_RO(vendor),
++ __ATTR_RO(revision),
++ __ATTR_RO(irq),
++ __ATTR_NULL,
++};
++
+ static struct bus_type ssb_bustype = {
+ .name = "ssb",
+ .match = ssb_bus_match,
+@@ -394,6 +422,7 @@ static struct bus_type ssb_bustype = {
+ .suspend = ssb_device_suspend,
+ .resume = ssb_device_resume,
+ .uevent = ssb_device_uevent,
++ .dev_attrs = ssb_device_attrs,
+ };
+
+ static void ssb_buses_lock(void)
diff --git a/target/linux/brcm47xx/patches-2.6.33/951-brcm4716-defines.patch b/target/linux/brcm47xx/patches-2.6.33/951-brcm4716-defines.patch
new file mode 100644
index 000000000..cde712c4a
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.33/951-brcm4716-defines.patch
@@ -0,0 +1,25 @@
+--- a/drivers/ssb/scan.c
++++ b/drivers/ssb/scan.c
+@@ -92,6 +92,14 @@ const char *ssb_core_name(u16 coreid)
+ return "ARM 1176";
+ case SSB_DEV_ARM_7TDMI:
+ return "ARM 7TDMI";
++ case SSB_DEV_ETHERNET_GBIT2:
++ return "Gigabit MAC";
++ case SSB_DEV_MIPS_74K:
++ return "MIPS 74k";
++ case SSB_DEV_DDR_CTRLR:
++ return "DDR1/2 memory controller";
++ case SSB_DEV_I2S:
++ return "I2S";
+ }
+ return "UNKNOWN";
+ }
+@@ -150,6 +158,7 @@ static u8 chipid_to_nrcores(u16 chipid)
+ case 0x4710:
+ case 0x4610:
+ case 0x4704:
++ case 0x4716:
+ return 9;
+ default:
+ ssb_printk(KERN_ERR PFX
diff --git a/target/linux/brcm47xx/patches-2.6.34/950-sbb-sysfs-files.patch b/target/linux/brcm47xx/patches-2.6.34/950-sbb-sysfs-files.patch
new file mode 100644
index 000000000..ddb1f1b38
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.34/950-sbb-sysfs-files.patch
@@ -0,0 +1,45 @@
+--- a/drivers/ssb/main.c
++++ b/drivers/ssb/main.c
+@@ -385,6 +385,34 @@ static int ssb_device_uevent(struct devi
+ ssb_dev->id.revision);
+ }
+
++#define ssb_config_attr(attrib, field, format_string) \
++static ssize_t \
++attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
++{ \
++ return sprintf (buf, format_string, dev_to_ssb_dev(dev)->field); \
++}
++
++ssb_config_attr(core_num, core_index, "%u\n")
++ssb_config_attr(coreid, id.coreid, "0x%04x\n")
++ssb_config_attr(vendor, id.vendor, "0x%04x\n")
++ssb_config_attr(revision, id.revision, "%u\n")
++ssb_config_attr(irq, irq, "%u\n")
++static ssize_t
++name_show(struct device *dev, struct device_attribute *attr, char *buf)
++{
++ return sprintf (buf, "%s\n", ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
++}
++
++static struct device_attribute ssb_device_attrs[] = {
++ __ATTR_RO(name),
++ __ATTR_RO(core_num),
++ __ATTR_RO(coreid),
++ __ATTR_RO(vendor),
++ __ATTR_RO(revision),
++ __ATTR_RO(irq),
++ __ATTR_NULL,
++};
++
+ static struct bus_type ssb_bustype = {
+ .name = "ssb",
+ .match = ssb_bus_match,
+@@ -394,6 +422,7 @@ static struct bus_type ssb_bustype = {
+ .suspend = ssb_device_suspend,
+ .resume = ssb_device_resume,
+ .uevent = ssb_device_uevent,
++ .dev_attrs = ssb_device_attrs,
+ };
+
+ static void ssb_buses_lock(void)
diff --git a/target/linux/brcm47xx/patches-2.6.34/951-brcm4716-defines.patch b/target/linux/brcm47xx/patches-2.6.34/951-brcm4716-defines.patch
new file mode 100644
index 000000000..cde712c4a
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.34/951-brcm4716-defines.patch
@@ -0,0 +1,25 @@
+--- a/drivers/ssb/scan.c
++++ b/drivers/ssb/scan.c
+@@ -92,6 +92,14 @@ const char *ssb_core_name(u16 coreid)
+ return "ARM 1176";
+ case SSB_DEV_ARM_7TDMI:
+ return "ARM 7TDMI";
++ case SSB_DEV_ETHERNET_GBIT2:
++ return "Gigabit MAC";
++ case SSB_DEV_MIPS_74K:
++ return "MIPS 74k";
++ case SSB_DEV_DDR_CTRLR:
++ return "DDR1/2 memory controller";
++ case SSB_DEV_I2S:
++ return "I2S";
+ }
+ return "UNKNOWN";
+ }
+@@ -150,6 +158,7 @@ static u8 chipid_to_nrcores(u16 chipid)
+ case 0x4710:
+ case 0x4610:
+ case 0x4704:
++ case 0x4716:
+ return 9;
+ default:
+ ssb_printk(KERN_ERR PFX