b53: clean up code to match kernel style better
* properly enclose macro arguments in paranthesis on use * remove trailing white space * convert C99 // comments * add missing blank lines after declaration * remove braces from single statement blocks * split lines > 80 chars (except for one) Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 45356
This commit is contained in:
parent
61885f95f0
commit
4e826d8303
6 changed files with 23 additions and 20 deletions
|
@ -525,7 +525,8 @@ static int b53_switch_reset(struct b53_device *dev)
|
||||||
return -EINVAL;
|
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;
|
u8 mii_port_override;
|
||||||
|
|
||||||
b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL,
|
b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL,
|
||||||
|
@ -1161,7 +1162,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
|
||||||
.alias = "bcm53011",
|
.alias = "bcm53011",
|
||||||
.vlans = 4096,
|
.vlans = 4096,
|
||||||
.enabled_ports = 0x1f,
|
.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,
|
.vta_regs = B53_VTA_REGS,
|
||||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||||
|
@ -1174,7 +1175,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
|
||||||
.alias = "bcm53011",
|
.alias = "bcm53011",
|
||||||
.vlans = 4096,
|
.vlans = 4096,
|
||||||
.enabled_ports = 0x1f,
|
.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,
|
.vta_regs = B53_VTA_REGS,
|
||||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||||
|
@ -1187,7 +1188,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
|
||||||
.alias = "bcm53011",
|
.alias = "bcm53011",
|
||||||
.vlans = 4096,
|
.vlans = 4096,
|
||||||
.enabled_ports = 0x1f,
|
.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,
|
.vta_regs = B53_VTA_REGS,
|
||||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||||
|
@ -1200,7 +1201,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
|
||||||
.alias = "bcm53018",
|
.alias = "bcm53018",
|
||||||
.vlans = 4096,
|
.vlans = 4096,
|
||||||
.enabled_ports = 0x1f,
|
.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,
|
.vta_regs = B53_VTA_REGS,
|
||||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||||
|
@ -1213,7 +1214,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
|
||||||
.alias = "bcm53019",
|
.alias = "bcm53019",
|
||||||
.vlans = 4096,
|
.vlans = 4096,
|
||||||
.enabled_ports = 0x1f,
|
.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,
|
.vta_regs = B53_VTA_REGS,
|
||||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||||
|
@ -1307,7 +1308,8 @@ static int b53_switch_init(struct b53_device *dev)
|
||||||
|
|
||||||
dev->reset_gpio = b53_switch_get_reset_gpio(dev);
|
dev->reset_gpio = b53_switch_get_reset_gpio(dev);
|
||||||
if (dev->reset_gpio >= 0) {
|
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)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,9 +221,8 @@ static int b53_mmap_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct b53_device *dev = platform_get_drvdata(pdev);
|
struct b53_device *dev = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
if (dev) {
|
if (dev)
|
||||||
b53_switch_remove(dev);
|
b53_switch_remove(dev);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ static inline int is63xx(struct b53_device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int is5301x(struct b53_device *dev)
|
static inline int is5301x(struct b53_device *dev)
|
||||||
{
|
{
|
||||||
return dev->chip_id == BCM53010_DEVICE_ID ||
|
return dev->chip_id == BCM53010_DEVICE_ID ||
|
||||||
|
|
|
@ -31,12 +31,12 @@
|
||||||
#define B53_MEM_ACCESS_PAGE 0x08 /* Memory access */
|
#define B53_MEM_ACCESS_PAGE 0x08 /* Memory access */
|
||||||
|
|
||||||
/* PHY Registers */
|
/* 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_IM_PORT_PAGE 0x18 /* Inverse MII Port (to EMAC) */
|
||||||
#define B53_ALL_PORT_PAGE 0x19 /* All ports MII (broadcast) */
|
#define B53_ALL_PORT_PAGE 0x19 /* All ports MII (broadcast) */
|
||||||
|
|
||||||
/* MIB registers */
|
/* MIB registers */
|
||||||
#define B53_MIB_PAGE(i) (0x20 + i)
|
#define B53_MIB_PAGE(i) (0x20 + (i))
|
||||||
|
|
||||||
/* Quality of Service (QoS) Registers */
|
/* Quality of Service (QoS) Registers */
|
||||||
#define B53_QOS_PAGE 0x30
|
#define B53_QOS_PAGE 0x30
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/* Port Control Register (8 bit) */
|
/* 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_RX_DISABLE BIT(0)
|
||||||
#define PORT_CTRL_TX_DISABLE BIT(1)
|
#define PORT_CTRL_TX_DISABLE BIT(1)
|
||||||
#define PORT_CTRL_RX_BCST_EN BIT(2) /* Broadcast RX (P8 only) */
|
#define PORT_CTRL_RX_BCST_EN BIT(2) /* Broadcast RX (P8 only) */
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
* Please note that not all ports are available on every hardware, e.g. BCM5301X
|
* 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.
|
* 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_LINK BIT(0)
|
||||||
#define GMII_PO_FULL_DUPLEX BIT(1) /* 0 = Half Duplex */
|
#define GMII_PO_FULL_DUPLEX BIT(1) /* 0 = Half Duplex */
|
||||||
#define GMII_PO_SPEED_S 2
|
#define GMII_PO_SPEED_S 2
|
||||||
|
|
|
@ -86,6 +86,7 @@ static inline int b53_spi_set_page(struct spi_device *spi, u8 page)
|
||||||
static inline int b53_prepare_reg_access(struct spi_device *spi, u8 page)
|
static inline int b53_prepare_reg_access(struct spi_device *spi, u8 page)
|
||||||
{
|
{
|
||||||
int ret = b53_spi_clear_status(spi);
|
int ret = b53_spi_clear_status(spi);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -144,6 +145,7 @@ static int b53_spi_read8(struct b53_device *dev, u8 page, u8 reg, u8 *val)
|
||||||
static int b53_spi_read16(struct b53_device *dev, u8 page, u8 reg, u16 *val)
|
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);
|
int ret = b53_spi_read(dev, page, reg, (u8 *)val, 2);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*val = le16_to_cpu(*val);
|
*val = le16_to_cpu(*val);
|
||||||
|
|
||||||
|
@ -153,6 +155,7 @@ static int b53_spi_read16(struct b53_device *dev, u8 page, u8 reg, u16 *val)
|
||||||
static int b53_spi_read32(struct b53_device *dev, u8 page, u8 reg, u32 *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);
|
int ret = b53_spi_read(dev, page, reg, (u8 *)val, 4);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*val = le32_to_cpu(*val);
|
*val = le32_to_cpu(*val);
|
||||||
|
|
||||||
|
@ -174,6 +177,7 @@ static int b53_spi_read48(struct b53_device *dev, u8 page, u8 reg, u64 *val)
|
||||||
static int b53_spi_read64(struct b53_device *dev, u8 page, u8 reg, u64 *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);
|
int ret = b53_spi_read(dev, page, reg, (u8 *)val, 8);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*val = le64_to_cpu(*val);
|
*val = le64_to_cpu(*val);
|
||||||
|
|
||||||
|
@ -303,9 +307,8 @@ static int b53_spi_remove(struct spi_device *spi)
|
||||||
{
|
{
|
||||||
struct b53_device *dev = spi_get_drvdata(spi);
|
struct b53_device *dev = spi_get_drvdata(spi);
|
||||||
|
|
||||||
if (dev) {
|
if (dev)
|
||||||
b53_switch_remove(dev);
|
b53_switch_remove(dev);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ static int b53_srab_op(struct b53_device *dev, u8 page, u8 reg, u32 op)
|
||||||
B53_SRAB_CMDSTAT_GORDYN |
|
B53_SRAB_CMDSTAT_GORDYN |
|
||||||
op;
|
op;
|
||||||
writel(cmdstat, regs + B53_SRAB_CMDSTAT);
|
writel(cmdstat, regs + B53_SRAB_CMDSTAT);
|
||||||
|
|
||||||
/* check if operation completed */
|
/* check if operation completed */
|
||||||
for (i = 0; i < 5; ++i) {
|
for (i = 0; i < 5; ++i) {
|
||||||
cmdstat = readl(regs + B53_SRAB_CMDSTAT);
|
cmdstat = readl(regs + B53_SRAB_CMDSTAT);
|
||||||
|
@ -189,7 +189,7 @@ static int b53_srab_read48(struct b53_device *dev, u8 page, u8 reg, u64 *val)
|
||||||
|
|
||||||
*val = readl(regs + B53_SRAB_RD_L);
|
*val = readl(regs + B53_SRAB_RD_L);
|
||||||
*val += ((u64)readl(regs + B53_SRAB_RD_H) & 0xffff) << 32;
|
*val += ((u64)readl(regs + B53_SRAB_RD_H) & 0xffff) << 32;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
b53_srab_release_grant(dev);
|
b53_srab_release_grant(dev);
|
||||||
|
|
||||||
|
@ -358,9 +358,8 @@ static int b53_srab_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct b53_device *dev = platform_get_drvdata(pdev);
|
struct b53_device *dev = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
if (dev) {
|
if (dev)
|
||||||
b53_switch_remove(dev);
|
b53_switch_remove(dev);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue