From d33cbfde2b61432d91dc32a2ede6660eb8aa2422 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 30 Mar 2016 10:49:25 +0000 Subject: [PATCH] bcm53xx: simpify USB 3.0 PHY initialization MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We can use one code path for BCM4707 rev. 4 and BCM53018. Signed-off-by: Rafał Miłecki SVN-Revision: 49092 --- .../812-USB-bcma-add-USB-3.0-support.patch | 97 +++++-------------- ...-USB-bcma-use-simpler-devm_gpiod_get.patch | 2 +- 2 files changed, 24 insertions(+), 75 deletions(-) diff --git a/target/linux/bcm53xx/patches-3.18/812-USB-bcma-add-USB-3.0-support.patch b/target/linux/bcm53xx/patches-3.18/812-USB-bcma-add-USB-3.0-support.patch index 0414c44776..80c8fd2dfd 100644 --- a/target/linux/bcm53xx/patches-3.18/812-USB-bcma-add-USB-3.0-support.patch +++ b/target/linux/bcm53xx/patches-3.18/812-USB-bcma-add-USB-3.0-support.patch @@ -21,7 +21,7 @@ Signed-off-by: Rafał Miłecki struct gpio_desc *gpio_desc; }; -@@ -338,6 +339,215 @@ err_unregister_ohci_dev: +@@ -338,6 +339,164 @@ err_unregister_ohci_dev: return err; } @@ -78,9 +78,8 @@ Signed-off-by: Rafał Miłecki + iowrite32(0x0000009a, ccb->mii + 0x000); + udelay(2); + -+ switch (chipinfo->id) { -+ case BCMA_CHIP_ID_BCM4707: -+ if (chipinfo->rev == 4) { ++ if (chipinfo->id == BCMA_CHIP_ID_BCM53018 || ++ chipinfo->id == BCMA_CHIP_ID_BCM4707 && chipinfo->rev == 4) { + /* For NS-B0, USB3 PLL Block */ + bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); + iowrite32(0x587e8000, ccb->mii + 0x004); @@ -101,32 +100,39 @@ Signed-off-by: Rafał Miłecki + bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); + iowrite32(0x582e8000, ccb->mii + 0x004); + ++ /* Waiting MII Mgt interface idle */ ++ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); ++ + /* Deasserting USB3 system reset */ + bcma_awrite32(core, BCMA_RESET_CTL, 0); + -+ /* Set ana_pllSeqStart */ ++ /* PLL frequency monitor enable */ + bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); + iowrite32(0x58069000, ccb->mii + 0x004); + -+ /* RXPMD block */ ++ /* PIPE Block */ + bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x587e8020, ccb->mii + 0x004); ++ iowrite32(0x587e8060, ccb->mii + 0x004); + -+ /* CDR int loop locking BW to 1 */ ++ /* CMPMAX & CMPMINTH setting */ + bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x58120049, ccb->mii + 0x004); ++ iowrite32(0x580af30d, ccb->mii + 0x004); + -+ /* CDR int loop acquisition BW to 1 */ ++ /* DEGLITCH MIN & MAX setting */ + bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x580e0049, ccb->mii + 0x004); ++ iowrite32(0x580e6302, ccb->mii + 0x004); ++ ++ /* TXPMD block */ ++ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); ++ iowrite32(0x587e8040, ccb->mii + 0x004); + -+ /* CDR prop loop BW to 1 */ ++ /* Enabling SSC */ + bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x580a005c, ccb->mii + 0x004); ++ iowrite32(0x58061003, ccb->mii + 0x004); + + /* Waiting MII Mgt interface idle */ + bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ } else { ++ } else if (chipinfo->id == BCMA_CHIP_ID_BCM4707) { + /* PLL30 block */ + bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); + iowrite32(0x587e8000, ccb->mii + 0x004); @@ -155,63 +161,6 @@ Signed-off-by: Rafał Miłecki + + /* Deasserting USB3 system reset */ + bcma_awrite32(core, BCMA_RESET_CTL, 0); -+ } -+ break; -+ case BCMA_CHIP_ID_BCM53018: -+ /* USB3 PLL Block */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x587e8000, ccb->mii + 0x004); -+ -+ /* Assert Ana_Pllseq start */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x58061000, ccb->mii + 0x004); -+ -+ /* Assert CML Divider ratio to 26 */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x582a6400, ccb->mii + 0x004); -+ -+ /* Asserting PLL Reset */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x582ec000, ccb->mii + 0x004); -+ -+ /* Deaaserting PLL Reset */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x582e8000, ccb->mii + 0x004); -+ -+ /* Waiting MII Mgt interface idle */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ -+ /* Deasserting USB3 system reset */ -+ bcma_awrite32(core, BCMA_RESET_CTL, 0); -+ -+ /* PLL frequency monitor enable */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x58069000, ccb->mii + 0x004); -+ -+ /* PIPE Block */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x587e8060, ccb->mii + 0x004); -+ -+ /* CMPMAX & CMPMINTH setting */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x580af30d, ccb->mii + 0x004); -+ -+ /* DEGLITCH MIN & MAX setting */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x580e6302, ccb->mii + 0x004); -+ -+ /* TXPMD block */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x587e8040, ccb->mii + 0x004); -+ -+ /* Enabling SSC */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ iowrite32(0x58061003, ccb->mii + 0x004); -+ -+ /* Waiting MII Mgt interface idle */ -+ bcma_wait_reg(bus, ccb->mii + 0x000, 0x0100, 0x0000, 1000); -+ -+ break; + } +out: + if (dmu) @@ -237,7 +186,7 @@ Signed-off-by: Rafał Miłecki static int bcma_hcd_probe(struct bcma_device *dev) { int err; -@@ -364,6 +574,11 @@ static int bcma_hcd_probe(struct bcma_de +@@ -364,6 +523,11 @@ static int bcma_hcd_probe(struct bcma_de if (err) return err; break; @@ -249,7 +198,7 @@ Signed-off-by: Rafał Miłecki default: return -ENODEV; } -@@ -377,11 +592,14 @@ static void bcma_hcd_remove(struct bcma_ +@@ -377,11 +541,14 @@ static void bcma_hcd_remove(struct bcma_ struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev); struct platform_device *ohci_dev = usb_dev->ohci_dev; struct platform_device *ehci_dev = usb_dev->ehci_dev; @@ -264,7 +213,7 @@ Signed-off-by: Rafał Miłecki bcma_core_disable(dev, 0); } -@@ -418,6 +636,7 @@ static int bcma_hcd_resume(struct bcma_d +@@ -418,6 +585,7 @@ static int bcma_hcd_resume(struct bcma_d static const struct bcma_device_id bcma_hcd_table[] = { BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_USB20_HOST, BCMA_ANY_REV, BCMA_ANY_CLASS), BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_USB20, BCMA_ANY_REV, BCMA_ANY_CLASS), diff --git a/target/linux/bcm53xx/patches-3.18/813-USB-bcma-use-simpler-devm_gpiod_get.patch b/target/linux/bcm53xx/patches-3.18/813-USB-bcma-use-simpler-devm_gpiod_get.patch index ebad06630e..f4a1a61b46 100644 --- a/target/linux/bcm53xx/patches-3.18/813-USB-bcma-use-simpler-devm_gpiod_get.patch +++ b/target/linux/bcm53xx/patches-3.18/813-USB-bcma-use-simpler-devm_gpiod_get.patch @@ -12,7 +12,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/usb/host/bcma-hcd.c +++ b/drivers/usb/host/bcma-hcd.c -@@ -562,8 +562,7 @@ static int bcma_hcd_probe(struct bcma_de +@@ -511,8 +511,7 @@ static int bcma_hcd_probe(struct bcma_de usb_dev->core = dev; if (dev->dev.of_node) -- 2.30.2