aboutsummaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2018-04-24 17:21:28 +0200
committerStefan Roese <sr@denx.de>2018-05-14 10:00:15 +0200
commit2d7a0f4399f924422e959613b4c2634dcd0ad87e (patch)
treee2ed1a4d478b497d10466d57779d2c2e345c8dc4 /drivers/phy
parentdd77690c434f02b985c9c30be66943ffc1fea48c (diff)
downloadu-boot-2d7a0f4399f924422e959613b4c2634dcd0ad87e.zip
u-boot-2d7a0f4399f924422e959613b4c2634dcd0ad87e.tar.gz
u-boot-2d7a0f4399f924422e959613b4c2634dcd0ad87e.tar.bz2
phy: marvell: core: Cosmetic fixes
Move the reg_set* functions into comphy.h as static inline functions. Change return type of get_*_string to const char *. Signed-off-by: Marek Behun <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/marvell/comphy.h41
-rw-r--r--drivers/phy/marvell/comphy_core.c64
2 files changed, 52 insertions, 53 deletions
diff --git a/drivers/phy/marvell/comphy.h b/drivers/phy/marvell/comphy.h
index b402777..b588ae4 100644
--- a/drivers/phy/marvell/comphy.h
+++ b/drivers/phy/marvell/comphy.h
@@ -101,10 +101,43 @@ struct chip_serdes_phy_config {
};
/* Register helper functions */
-void reg_set(void __iomem *addr, u32 data, u32 mask);
-void reg_set_silent(void __iomem *addr, u32 data, u32 mask);
-void reg_set16(void __iomem *addr, u16 data, u16 mask);
-void reg_set_silent16(void __iomem *addr, u16 data, u16 mask);
+static inline void reg_set_silent(void __iomem *addr, u32 data, u32 mask)
+{
+ u32 reg_data;
+
+ reg_data = readl(addr);
+ reg_data &= ~mask;
+ reg_data |= data;
+ writel(reg_data, addr);
+}
+
+static inline void reg_set(void __iomem *addr, u32 data, u32 mask)
+{
+ debug("Write to address = %#010lx, data = %#010x (mask = %#010x) - ",
+ (unsigned long)addr, data, mask);
+ debug("old value = %#010x ==> ", readl(addr));
+ reg_set_silent(addr, data, mask);
+ debug("new value %#010x\n", readl(addr));
+}
+
+static inline void reg_set_silent16(void __iomem *addr, u16 data, u16 mask)
+{
+ u16 reg_data;
+
+ reg_data = readw(addr);
+ reg_data &= ~mask;
+ reg_data |= data;
+ writew(reg_data, addr);
+}
+
+static inline void reg_set16(void __iomem *addr, u16 data, u16 mask)
+{
+ debug("Write to address = %#010lx, data = %#06x (mask = %#06x) - ",
+ (unsigned long)addr, data, mask);
+ debug("old value = %#06x ==> ", readw(addr));
+ reg_set_silent16(addr, data, mask);
+ debug("new value %#06x\n", readw(addr));
+}
/* SoC specific init functions */
#ifdef CONFIG_ARMADA_3700
diff --git a/drivers/phy/marvell/comphy_core.c b/drivers/phy/marvell/comphy_core.c
index 2622751..c6e2cc8 100644
--- a/drivers/phy/marvell/comphy_core.c
+++ b/drivers/phy/marvell/comphy_core.c
@@ -17,11 +17,13 @@
DECLARE_GLOBAL_DATA_PTR;
-static char *get_speed_string(u32 speed)
+static const char *get_speed_string(u32 speed)
{
- char *speed_strings[] = {"1.25 Gbps", "1.5 Gbps", "2.5 Gbps",
- "3.0 Gbps", "3.125 Gbps", "5 Gbps", "6 Gbps",
- "6.25 Gbps", "10.31 Gbps" };
+ static const char * const speed_strings[] = {
+ "1.25 Gbps", "1.5 Gbps", "2.5 Gbps",
+ "3.0 Gbps", "3.125 Gbps", "5 Gbps", "6 Gbps",
+ "6.25 Gbps", "10.31 Gbps"
+ };
if (speed < 0 || speed > PHY_SPEED_MAX)
return "invalid";
@@ -29,14 +31,16 @@ static char *get_speed_string(u32 speed)
return speed_strings[speed];
}
-static char *get_type_string(u32 type)
+static const char *get_type_string(u32 type)
{
- char *type_strings[] = {"UNCONNECTED", "PEX0", "PEX1", "PEX2", "PEX3",
- "SATA0", "SATA1", "SATA2", "SATA3", "SGMII0",
- "SGMII1", "SGMII2", "SGMII3", "QSGMII",
- "USB3_HOST0", "USB3_HOST1", "USB3_DEVICE",
- "XAUI0", "XAUI1", "XAUI2", "XAUI3",
- "RXAUI0", "RXAUI1", "SFI", "IGNORE"};
+ static const char * const type_strings[] = {
+ "UNCONNECTED", "PEX0", "PEX1", "PEX2", "PEX3",
+ "SATA0", "SATA1", "SATA2", "SATA3", "SGMII0",
+ "SGMII1", "SGMII2", "SGMII3", "QSGMII",
+ "USB3_HOST0", "USB3_HOST1", "USB3_DEVICE",
+ "XAUI0", "XAUI1", "XAUI2", "XAUI3",
+ "RXAUI0", "RXAUI1", "SFI", "IGNORE"
+ };
if (type < 0 || type > PHY_TYPE_MAX)
return "invalid";
@@ -44,44 +48,6 @@ static char *get_type_string(u32 type)
return type_strings[type];
}
-void reg_set(void __iomem *addr, u32 data, u32 mask)
-{
- debug("Write to address = %#010lx, data = %#010x (mask = %#010x) - ",
- (unsigned long)addr, data, mask);
- debug("old value = %#010x ==> ", readl(addr));
- reg_set_silent(addr, data, mask);
- debug("new value %#010x\n", readl(addr));
-}
-
-void reg_set_silent(void __iomem *addr, u32 data, u32 mask)
-{
- u32 reg_data;
-
- reg_data = readl(addr);
- reg_data &= ~mask;
- reg_data |= data;
- writel(reg_data, addr);
-}
-
-void reg_set16(void __iomem *addr, u16 data, u16 mask)
-{
- debug("Write to address = %#010lx, data = %#06x (mask = %#06x) - ",
- (unsigned long)addr, data, mask);
- debug("old value = %#06x ==> ", readw(addr));
- reg_set_silent16(addr, data, mask);
- debug("new value %#06x\n", readw(addr));
-}
-
-void reg_set_silent16(void __iomem *addr, u16 data, u16 mask)
-{
- u16 reg_data;
-
- reg_data = readw(addr);
- reg_data &= ~mask;
- reg_data |= data;
- writew(reg_data, addr);
-}
-
void comphy_print(struct chip_serdes_phy_config *chip_cfg,
struct comphy_map *comphy_map_data)
{