driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] staging: mt7621-pci: use builtin_platform_driver()
@ 2020-03-21 13:36 Sergio Paracuellos
  2020-03-21 13:36 ` [PATCH 2/4] staging: mt7621-pci: add myself as a contributor of the driver Sergio Paracuellos
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sergio Paracuellos @ 2020-03-21 13:36 UTC (permalink / raw)
  To: gregkh; +Cc: neil, driverdev-devel

Macro builtin_platform_driver can be used for builtin drivers
that don't do anything in driver init. So, use the macro
builtin_platform_driver and remove some boilerplate code.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
index 1a76968b70c3..b8065b777ff6 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -725,9 +725,4 @@ static struct platform_driver mt7621_pci_driver = {
 	},
 };
 
-static int __init mt7621_pci_init(void)
-{
-	return platform_driver_register(&mt7621_pci_driver);
-}
-
-module_init(mt7621_pci_init);
+builtin_platform_driver(mt7621_pci_driver);
-- 
2.25.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] staging: mt7621-pci: add myself as a contributor of the driver
  2020-03-21 13:36 [PATCH 1/4] staging: mt7621-pci: use builtin_platform_driver() Sergio Paracuellos
@ 2020-03-21 13:36 ` Sergio Paracuellos
  2020-03-23 10:32   ` Greg KH
  2020-03-21 13:36 ` [PATCH 3/4] staging: mt7621-pci-phy: use builtin_platform_driver() Sergio Paracuellos
  2020-03-21 13:36 ` [PATCH 4/4] staging: mt7621-pci-phy: re-do 'xtal_mode' detection Sergio Paracuellos
  2 siblings, 1 reply; 6+ messages in thread
From: Sergio Paracuellos @ 2020-03-21 13:36 UTC (permalink / raw)
  To: gregkh; +Cc: neil, driverdev-devel

During a long time I have been cleaning and fixing this driver
in order to use current kernel's apis and try to get it out of
the staging area. At the end the driver is mt7621 specific and
has been completely re-written. Hence, add myself to the header
as a contributor of this driver.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
index b8065b777ff6..5e80479ce653 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -13,6 +13,9 @@
  *
  * May 2011 Bruce Chang
  * support RT6855/MT7620 PCIe
+ *
+ * 2018-2020 Sergio Paracuellos <sergio.paracuellos@gmail.com>
+ * Re-write the driver for SoC mt7621
  */
 
 #include <linux/bitops.h>
-- 
2.25.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4]  staging: mt7621-pci-phy: use builtin_platform_driver()
  2020-03-21 13:36 [PATCH 1/4] staging: mt7621-pci: use builtin_platform_driver() Sergio Paracuellos
  2020-03-21 13:36 ` [PATCH 2/4] staging: mt7621-pci: add myself as a contributor of the driver Sergio Paracuellos
@ 2020-03-21 13:36 ` Sergio Paracuellos
  2020-03-21 13:36 ` [PATCH 4/4] staging: mt7621-pci-phy: re-do 'xtal_mode' detection Sergio Paracuellos
  2 siblings, 0 replies; 6+ messages in thread
From: Sergio Paracuellos @ 2020-03-21 13:36 UTC (permalink / raw)
  To: gregkh; +Cc: neil, driverdev-devel

Macro builtin_platform_driver can be used for builtin drivers
that don't do anything in driver init. So, use the macro
builtin_platform_driver and remove some boilerplate code.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c b/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c
index 63dfbb85af11..8100d8286365 100644
--- a/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c
+++ b/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c
@@ -361,12 +361,7 @@ static struct platform_driver mt7621_pci_phy_driver = {
 	},
 };
 
-static int __init mt7621_pci_phy_drv_init(void)
-{
-	return platform_driver_register(&mt7621_pci_phy_driver);
-}
-
-module_init(mt7621_pci_phy_drv_init);
+builtin_platform_driver(mt7621_pci_phy_driver);
 
 MODULE_AUTHOR("Sergio Paracuellos <sergio.paracuellos@gmail.com>");
 MODULE_DESCRIPTION("MediaTek MT7621 PCIe PHY driver");
-- 
2.25.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] staging: mt7621-pci-phy: re-do 'xtal_mode' detection
  2020-03-21 13:36 [PATCH 1/4] staging: mt7621-pci: use builtin_platform_driver() Sergio Paracuellos
  2020-03-21 13:36 ` [PATCH 2/4] staging: mt7621-pci: add myself as a contributor of the driver Sergio Paracuellos
  2020-03-21 13:36 ` [PATCH 3/4] staging: mt7621-pci-phy: use builtin_platform_driver() Sergio Paracuellos
@ 2020-03-21 13:36 ` Sergio Paracuellos
  2 siblings, 0 replies; 6+ messages in thread
From: Sergio Paracuellos @ 2020-03-21 13:36 UTC (permalink / raw)
  To: gregkh; +Cc: neil, driverdev-devel

Detection of the Xtal mode is using magic numbers that
can be avoided using properly some definitions and a more
accurate variable name from 'reg' into 'xtal_mode'. This
increase readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c b/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c
index 8100d8286365..57743fd22be4 100644
--- a/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c
+++ b/drivers/staging/mt7621-pci-phy/pci-mt7621-phy.c
@@ -75,6 +75,9 @@
 
 #define RG_PE1_FRC_MSTCKDIV			BIT(5)
 
+#define XTAL_MODE_SEL_SHIFT			6
+#define XTAL_MODE_SEL_MASK			0x7
+
 #define MAX_PHYS	2
 
 /**
@@ -136,9 +139,11 @@ static void mt7621_bypass_pipe_rst(struct mt7621_pci_phy *phy)
 static void mt7621_set_phy_for_ssc(struct mt7621_pci_phy *phy)
 {
 	struct device *dev = phy->dev;
-	u32 reg = rt_sysc_r32(SYSC_REG_SYSTEM_CONFIG0);
+	u32 xtal_mode;
+
+	xtal_mode = (rt_sysc_r32(SYSC_REG_SYSTEM_CONFIG0)
+		     >> XTAL_MODE_SEL_SHIFT) & XTAL_MODE_SEL_MASK;
 
-	reg = (reg >> 6) & 0x7;
 	/* Set PCIe Port PHY to disable SSC */
 	/* Debug Xtal Type */
 	mt7621_phy_rmw(phy, RG_PE1_FRC_H_XTAL_REG,
@@ -154,13 +159,13 @@ static void mt7621_set_phy_for_ssc(struct mt7621_pci_phy *phy)
 			       RG_PE1_PHY_EN, RG_PE1_FRC_PHY_EN);
 	}
 
-	if (reg <= 5 && reg >= 3) { /* 40MHz Xtal */
+	if (xtal_mode <= 5 && xtal_mode >= 3) { /* 40MHz Xtal */
 		/* Set Pre-divider ratio (for host mode) */
 		mt7621_phy_rmw(phy, RG_PE1_H_PLL_REG,
 			       RG_PE1_H_PLL_PREDIV,
 			       RG_PE1_H_PLL_PREDIV_VAL(0x01));
 		dev_info(dev, "Xtal is 40MHz\n");
-	} else if (reg >= 6) { /* 25MHz Xal */
+	} else if (xtal_mode >= 6) { /* 25MHz Xal */
 		mt7621_phy_rmw(phy, RG_PE1_H_PLL_REG,
 			       RG_PE1_H_PLL_PREDIV,
 			       RG_PE1_H_PLL_PREDIV_VAL(0x00));
@@ -206,7 +211,7 @@ static void mt7621_set_phy_for_ssc(struct mt7621_pci_phy *phy)
 	mt7621_phy_rmw(phy, RG_PE1_H_PLL_BR_REG,
 		       RG_PE1_H_PLL_BR, RG_PE1_H_PLL_BR_VAL(0x00));
 
-	if (reg <= 5 && reg >= 3) { /* 40MHz Xtal */
+	if (xtal_mode <= 5 && xtal_mode >= 3) { /* 40MHz Xtal */
 		/* set force mode enable of da_pe1_mstckdiv */
 		mt7621_phy_rmw(phy, RG_PE1_MSTCKDIV_REG,
 			       RG_PE1_MSTCKDIV | RG_PE1_FRC_MSTCKDIV,
-- 
2.25.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/4] staging: mt7621-pci: add myself as a contributor of the driver
  2020-03-21 13:36 ` [PATCH 2/4] staging: mt7621-pci: add myself as a contributor of the driver Sergio Paracuellos
@ 2020-03-23 10:32   ` Greg KH
  2020-03-23 11:31     ` Sergio Paracuellos
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2020-03-23 10:32 UTC (permalink / raw)
  To: Sergio Paracuellos; +Cc: neil, driverdev-devel

On Sat, Mar 21, 2020 at 02:36:22PM +0100, Sergio Paracuellos wrote:
> During a long time I have been cleaning and fixing this driver
> in order to use current kernel's apis and try to get it out of
> the staging area. At the end the driver is mt7621 specific and
> has been completely re-written. Hence, add myself to the header
> as a contributor of this driver.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
>  drivers/staging/mt7621-pci/pci-mt7621.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
> index b8065b777ff6..5e80479ce653 100644
> --- a/drivers/staging/mt7621-pci/pci-mt7621.c
> +++ b/drivers/staging/mt7621-pci/pci-mt7621.c
> @@ -13,6 +13,9 @@
>   *
>   * May 2011 Bruce Chang
>   * support RT6855/MT7620 PCIe
> + *
> + * 2018-2020 Sergio Paracuellos <sergio.paracuellos@gmail.com>
> + * Re-write the driver for SoC mt7621

That's what the maintainers file is for, and the changelog, we don't add
new items to the top of files for this, otherwise that would just be all
the kernel consists of :)

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/4] staging: mt7621-pci: add myself as a contributor of the driver
  2020-03-23 10:32   ` Greg KH
@ 2020-03-23 11:31     ` Sergio Paracuellos
  0 siblings, 0 replies; 6+ messages in thread
From: Sergio Paracuellos @ 2020-03-23 11:31 UTC (permalink / raw)
  To: Greg KH; +Cc: NeilBrown, driverdev-devel

Hi Greg,

On Mon, Mar 23, 2020 at 11:32 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sat, Mar 21, 2020 at 02:36:22PM +0100, Sergio Paracuellos wrote:
> > During a long time I have been cleaning and fixing this driver
> > in order to use current kernel's apis and try to get it out of
> > the staging area. At the end the driver is mt7621 specific and
> > has been completely re-written. Hence, add myself to the header
> > as a contributor of this driver.
> >
> > Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> > ---
> >  drivers/staging/mt7621-pci/pci-mt7621.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c
> > index b8065b777ff6..5e80479ce653 100644
> > --- a/drivers/staging/mt7621-pci/pci-mt7621.c
> > +++ b/drivers/staging/mt7621-pci/pci-mt7621.c
> > @@ -13,6 +13,9 @@
> >   *
> >   * May 2011 Bruce Chang
> >   * support RT6855/MT7620 PCIe
> > + *
> > + * 2018-2020 Sergio Paracuellos <sergio.paracuellos@gmail.com>
> > + * Re-write the driver for SoC mt7621
>
> That's what the maintainers file is for, and the changelog, we don't add
> new items to the top of files for this, otherwise that would just be all
> the kernel consists of :)
>

Pretty clear, thanks for letting me know.

> thanks,
>
> greg k-h

Best regards,
    Sergio Paracuellos
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-23 11:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-21 13:36 [PATCH 1/4] staging: mt7621-pci: use builtin_platform_driver() Sergio Paracuellos
2020-03-21 13:36 ` [PATCH 2/4] staging: mt7621-pci: add myself as a contributor of the driver Sergio Paracuellos
2020-03-23 10:32   ` Greg KH
2020-03-23 11:31     ` Sergio Paracuellos
2020-03-21 13:36 ` [PATCH 3/4] staging: mt7621-pci-phy: use builtin_platform_driver() Sergio Paracuellos
2020-03-21 13:36 ` [PATCH 4/4] staging: mt7621-pci-phy: re-do 'xtal_mode' detection Sergio Paracuellos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).