Lines Matching refs:dev
29 int (*read8)(struct b53_device *dev, u8 page, u8 reg, u8 *value);
30 int (*read16)(struct b53_device *dev, u8 page, u8 reg, u16 *value);
31 int (*read32)(struct b53_device *dev, u8 page, u8 reg, u32 *value);
32 int (*read48)(struct b53_device *dev, u8 page, u8 reg, u64 *value);
33 int (*read64)(struct b53_device *dev, u8 page, u8 reg, u64 *value);
34 int (*write8)(struct b53_device *dev, u8 page, u8 reg, u8 value);
35 int (*write16)(struct b53_device *dev, u8 page, u8 reg, u16 value);
36 int (*write32)(struct b53_device *dev, u8 page, u8 reg, u32 value);
37 int (*write48)(struct b53_device *dev, u8 page, u8 reg, u64 value);
38 int (*write64)(struct b53_device *dev, u8 page, u8 reg, u64 value);
39 int (*phy_read16)(struct b53_device *dev, int addr, u8 reg, u16 *value);
40 int (*phy_write16)(struct b53_device *dev, int addr, u8 reg, u16 value);
93 struct device *dev;
107 #define b53_for_each_port(dev, i) \
109 if (dev->enabled_ports & BIT(i))
113 static inline int is5325(struct b53_device *dev)
115 return dev->chip_id == BCM5325_DEVICE_ID;
118 static inline int is5365(struct b53_device *dev)
121 return dev->chip_id == BCM5365_DEVICE_ID;
127 static inline int is5397_98(struct b53_device *dev)
129 return dev->chip_id == BCM5397_DEVICE_ID ||
130 dev->chip_id == BCM5398_DEVICE_ID;
133 static inline int is539x(struct b53_device *dev)
135 return dev->chip_id == BCM5395_DEVICE_ID ||
136 dev->chip_id == BCM5397_DEVICE_ID ||
137 dev->chip_id == BCM5398_DEVICE_ID;
140 static inline int is531x5(struct b53_device *dev)
142 return dev->chip_id == BCM53115_DEVICE_ID ||
143 dev->chip_id == BCM53125_DEVICE_ID ||
144 dev->chip_id == BCM53128_DEVICE_ID;
147 static inline int is63xx(struct b53_device *dev)
150 return dev->chip_id == BCM63XX_DEVICE_ID;
156 static inline int is5301x(struct b53_device *dev)
158 return dev->chip_id == BCM53010_DEVICE_ID ||
159 dev->chip_id == BCM53011_DEVICE_ID ||
160 dev->chip_id == BCM53012_DEVICE_ID ||
161 dev->chip_id == BCM53018_DEVICE_ID ||
162 dev->chip_id == BCM53019_DEVICE_ID;
168 static inline int is_cpu_port(struct b53_device *dev, int port)
170 return dev->sw_dev.cpu_port == port;
181 int b53_switch_detect(struct b53_device *dev);
183 int b53_switch_register(struct b53_device *dev);
185 static inline void b53_switch_remove(struct b53_device *dev)
187 unregister_switch(&dev->sw_dev);
190 static inline int b53_read8(struct b53_device *dev, u8 page, u8 reg, u8 *val)
194 mutex_lock(&dev->reg_mutex);
195 ret = dev->ops->read8(dev, page, reg, val);
196 mutex_unlock(&dev->reg_mutex);
201 static inline int b53_read16(struct b53_device *dev, u8 page, u8 reg, u16 *val)
205 mutex_lock(&dev->reg_mutex);
206 ret = dev->ops->read16(dev, page, reg, val);
207 mutex_unlock(&dev->reg_mutex);
212 static inline int b53_read32(struct b53_device *dev, u8 page, u8 reg, u32 *val)
216 mutex_lock(&dev->reg_mutex);
217 ret = dev->ops->read32(dev, page, reg, val);
218 mutex_unlock(&dev->reg_mutex);
223 static inline int b53_read48(struct b53_device *dev, u8 page, u8 reg, u64 *val)
227 mutex_lock(&dev->reg_mutex);
228 ret = dev->ops->read48(dev, page, reg, val);
229 mutex_unlock(&dev->reg_mutex);
234 static inline int b53_read64(struct b53_device *dev, u8 page, u8 reg, u64 *val)
238 mutex_lock(&dev->reg_mutex);
239 ret = dev->ops->read64(dev, page, reg, val);
240 mutex_unlock(&dev->reg_mutex);
245 static inline int b53_write8(struct b53_device *dev, u8 page, u8 reg, u8 value)
249 mutex_lock(&dev->reg_mutex);
250 ret = dev->ops->write8(dev, page, reg, value);
251 mutex_unlock(&dev->reg_mutex);
256 static inline int b53_write16(struct b53_device *dev, u8 page, u8 reg,
261 mutex_lock(&dev->reg_mutex);
262 ret = dev->ops->write16(dev, page, reg, value);
263 mutex_unlock(&dev->reg_mutex);
268 static inline int b53_write32(struct b53_device *dev, u8 page, u8 reg,
273 mutex_lock(&dev->reg_mutex);
274 ret = dev->ops->write32(dev, page, reg, value);
275 mutex_unlock(&dev->reg_mutex);
280 static inline int b53_write48(struct b53_device *dev, u8 page, u8 reg,
285 mutex_lock(&dev->reg_mutex);
286 ret = dev->ops->write48(dev, page, reg, value);
287 mutex_unlock(&dev->reg_mutex);
292 static inline int b53_write64(struct b53_device *dev, u8 page, u8 reg,
297 mutex_lock(&dev->reg_mutex);
298 ret = dev->ops->write64(dev, page, reg, value);
299 mutex_unlock(&dev->reg_mutex);
313 static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
326 static inline int b53_switch_get_reset_gpio(struct b53_device *dev)