Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: ralink: mt7621: introduce 'soc_device' initialization

mt7621 SoC has its own 'ralink_soc_info' structure with some
information about the soc itself. Pcie controller and pcie phy
drivers for this soc which are still in staging git tree make uses
of 'soc_device_attribute' looking for revision 'E2' in order to
know if reset lines are or not inverted. This way of doing things
seems to be necessary in order to make things clean and properly.
Hence, introduce this 'soc_device' to be able to properly use those
attributes in drivers. Also set 'data' pointer points to the struct
'ralink_soc_info' to be able to export also current soc information
using this mechanism.

Cc: Paul Burton <paul.burton@mips.com>
Cc: ralf@linux-mips.org
Cc: jhogan@kernel.org
Cc: john@phrozen.org
Cc: NeilBrown <neil@brown.name>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-mips@vger.kernel.org

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Sergio Paracuellos and committed by
Thomas Bogendoerfer
71b9b5e0 a67bac09

+31 -1
+31 -1
arch/mips/ralink/mt7621.c
··· 7 7 8 8 #include <linux/kernel.h> 9 9 #include <linux/init.h> 10 + #include <linux/slab.h> 11 + #include <linux/sys_soc.h> 10 12 11 13 #include <asm/mipsregs.h> 12 14 #include <asm/smp-ops.h> ··· 162 160 panic("Failed to remap core resources"); 163 161 } 164 162 163 + static void soc_dev_init(struct ralink_soc_info *soc_info, u32 rev) 164 + { 165 + struct soc_device *soc_dev; 166 + struct soc_device_attribute *soc_dev_attr; 167 + 168 + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 169 + if (!soc_dev_attr) 170 + return; 171 + 172 + soc_dev_attr->soc_id = "mt7621"; 173 + soc_dev_attr->family = "Ralink"; 174 + 175 + if (((rev >> CHIP_REV_VER_SHIFT) & CHIP_REV_VER_MASK) == 1 && 176 + (rev & CHIP_REV_ECO_MASK) == 1) 177 + soc_dev_attr->revision = "E2"; 178 + else 179 + soc_dev_attr->revision = "E1"; 180 + 181 + soc_dev_attr->data = soc_info; 182 + 183 + soc_dev = soc_device_register(soc_dev_attr); 184 + if (IS_ERR(soc_dev)) { 185 + kfree(soc_dev_attr); 186 + return; 187 + } 188 + } 189 + 165 190 void prom_soc_init(struct ralink_soc_info *soc_info) 166 191 { 167 192 void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7621_SYSC_BASE); ··· 243 214 244 215 rt2880_pinmux_data = mt7621_pinmux_data; 245 216 246 - 247 217 if (!register_cps_smp_ops()) 248 218 return; 249 219 if (!register_cmp_smp_ops()) 250 220 return; 251 221 if (!register_vsmp_smp_ops()) 252 222 return; 223 + 224 + soc_dev_init(soc_info, rev); 253 225 }