return -EINVAL;
}
}
- } else if ((is531x5(dev) || is5301x(dev)) && dev->sw_dev.cpu_port == B53_CPU_PORT) {
+ } else if ((is531x5(dev) || is5301x(dev)) &&
+ dev->sw_dev.cpu_port == B53_CPU_PORT) {
u8 mii_port_override;
b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL,
.alias = "bcm53011",
.vlans = 4096,
.enabled_ports = 0x1f,
- .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+ .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
.vta_regs = B53_VTA_REGS,
.duplex_reg = B53_DUPLEX_STAT_GE,
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
.alias = "bcm53011",
.vlans = 4096,
.enabled_ports = 0x1f,
- .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+ .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
.vta_regs = B53_VTA_REGS,
.duplex_reg = B53_DUPLEX_STAT_GE,
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
.alias = "bcm53011",
.vlans = 4096,
.enabled_ports = 0x1f,
- .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+ .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
.vta_regs = B53_VTA_REGS,
.duplex_reg = B53_DUPLEX_STAT_GE,
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
.alias = "bcm53018",
.vlans = 4096,
.enabled_ports = 0x1f,
- .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+ .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
.vta_regs = B53_VTA_REGS,
.duplex_reg = B53_DUPLEX_STAT_GE,
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
.alias = "bcm53019",
.vlans = 4096,
.enabled_ports = 0x1f,
- .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+ .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
.vta_regs = B53_VTA_REGS,
.duplex_reg = B53_DUPLEX_STAT_GE,
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
dev->reset_gpio = b53_switch_get_reset_gpio(dev);
if (dev->reset_gpio >= 0) {
- ret = devm_gpio_request_one(dev->dev, dev->reset_gpio, GPIOF_OUT_INIT_HIGH, "robo_reset");
+ ret = devm_gpio_request_one(dev->dev, dev->reset_gpio,
+ GPIOF_OUT_INIT_HIGH, "robo_reset");
if (ret)
return ret;
}
{
struct b53_device *dev = platform_get_drvdata(pdev);
- if (dev) {
+ if (dev)
b53_switch_remove(dev);
- }
return 0;
}
return 0;
#endif
}
-
+
static inline int is5301x(struct b53_device *dev)
{
return dev->chip_id == BCM53010_DEVICE_ID ||
#define B53_MEM_ACCESS_PAGE 0x08 /* Memory access */
/* PHY Registers */
-#define B53_PORT_MII_PAGE(i) (0x10 + i) /* Port i MII Registers */
+#define B53_PORT_MII_PAGE(i) (0x10 + (i)) /* Port i MII Registers */
#define B53_IM_PORT_PAGE 0x18 /* Inverse MII Port (to EMAC) */
#define B53_ALL_PORT_PAGE 0x19 /* All ports MII (broadcast) */
/* MIB registers */
-#define B53_MIB_PAGE(i) (0x20 + i)
+#define B53_MIB_PAGE(i) (0x20 + (i))
/* Quality of Service (QoS) Registers */
#define B53_QOS_PAGE 0x30
*************************************************************************/
/* Port Control Register (8 bit) */
-#define B53_PORT_CTRL(i) (0x00 + i)
+#define B53_PORT_CTRL(i) (0x00 + (i))
#define PORT_CTRL_RX_DISABLE BIT(0)
#define PORT_CTRL_TX_DISABLE BIT(1)
#define PORT_CTRL_RX_BCST_EN BIT(2) /* Broadcast RX (P8 only) */
* Please note that not all ports are available on every hardware, e.g. BCM5301X
* don't include overriding port 6, BCM63xx also have some limitations.
*/
-#define B53_GMII_PORT_OVERRIDE_CTRL(i) (0x58 + i)
+#define B53_GMII_PORT_OVERRIDE_CTRL(i) (0x58 + (i))
#define GMII_PO_LINK BIT(0)
#define GMII_PO_FULL_DUPLEX BIT(1) /* 0 = Half Duplex */
#define GMII_PO_SPEED_S 2
static inline int b53_prepare_reg_access(struct spi_device *spi, u8 page)
{
int ret = b53_spi_clear_status(spi);
+
if (ret)
return ret;
static int b53_spi_read16(struct b53_device *dev, u8 page, u8 reg, u16 *val)
{
int ret = b53_spi_read(dev, page, reg, (u8 *)val, 2);
+
if (!ret)
*val = le16_to_cpu(*val);
static int b53_spi_read32(struct b53_device *dev, u8 page, u8 reg, u32 *val)
{
int ret = b53_spi_read(dev, page, reg, (u8 *)val, 4);
+
if (!ret)
*val = le32_to_cpu(*val);
static int b53_spi_read64(struct b53_device *dev, u8 page, u8 reg, u64 *val)
{
int ret = b53_spi_read(dev, page, reg, (u8 *)val, 8);
+
if (!ret)
*val = le64_to_cpu(*val);
{
struct b53_device *dev = spi_get_drvdata(spi);
- if (dev) {
+ if (dev)
b53_switch_remove(dev);
- }
return 0;
}
B53_SRAB_CMDSTAT_GORDYN |
op;
writel(cmdstat, regs + B53_SRAB_CMDSTAT);
-
+
/* check if operation completed */
for (i = 0; i < 5; ++i) {
cmdstat = readl(regs + B53_SRAB_CMDSTAT);
*val = readl(regs + B53_SRAB_RD_L);
*val += ((u64)readl(regs + B53_SRAB_RD_H) & 0xffff) << 32;
-
+
err:
b53_srab_release_grant(dev);
{
struct b53_device *dev = platform_get_drvdata(pdev);
- if (dev) {
+ if (dev)
b53_switch_remove(dev);
- }
return 0;
}