Subject: Re: espressobin device tree with kernel 5.1 RC

From: Miquel Raynal <[email-masked]>
Date: Wed, 19 Jun 2019 12:29:17 +0200

Hi Timothy,

"Timothy Krantz" <[email-masked]> wrote on Tue, 18 Jun 2019
16:07:34 -0400:

> Hi Miquel,
> 
> > -----Original Message-----
> > 
> > I don't think it's a hw problem, v5 is fine. Have you updated your firmware
> > recently? You will need a recent firmware (ATF) in order to have the SMC
> > calls to work. You can trace the _power_on() function which probably fails at
> > its end in drivers/phy/marvell/phy-mvebu-a3700-comphy.c.
> > 
> > Good luck!
> > Miquèl  
> 
> I added the following traces to drivers/phy/marvell/phy-mvebu-a3700-comphy.c :
> 
> static int mvebu_a3700_comphy_smc(unsigned long function, unsigned long lane,
>                                   unsigned long mode)
> {
>         struct arm_smccc_res res;
> 
> printk(KERN_INFO "in a3700 comphy smc\n");
>         arm_smccc_smc(function, lane, mode, 0, 0, 0, 0, 0, &res);
> printk(KERN_INFO "res.a0=%lx\n", res.a0);
> 
>         return res.a0;
> }
> 
> And 
> static int mvebu_a3700_comphy_power_on(struct phy *phy)
> {
>         struct mvebu_a3700_comphy_lane *lane = phy_get_drvdata(phy);
>         u32 fw_param;
>         int fw_mode;
> 
>         fw_mode = mvebu_a3700_comphy_get_fw_mode(lane->id, lane->port,
>                                                  lane->mode, lane->submode);
> printk(KERN_INFO "in power on\n");
>         if (fw_mode < 0) {
> printk(KERN_INFO "fw_mode < 0\n");
>                 dev_err(lane->dev, "invalid COMPHY mode\n");
>                 return fw_mode;
>         }
> 
> printk(KERN_INFO "switch lane->mode\n");
>         switch (lane->mode) {
>         case PHY_MODE_USB_HOST_SS:
> printk(KERN_INFO "usb host\n");
>                 dev_dbg(lane->dev, "set lane %d to USB3 host mode\n", lane->id);
>                 fw_param = COMPHY_FW_MODE(fw_mode);
>                 break;
>         case PHY_MODE_SATA:
> printk(KERN_INFO "sata\n");
>                 dev_dbg(lane->dev, "set lane %d to SATA mode\n", lane->id);
>                 fw_param = COMPHY_FW_MODE(fw_mode);
>                 break;
>         case PHY_MODE_ETHERNET:
>                 switch (lane->submode) {
>                 case PHY_INTERFACE_MODE_SGMII:
> printk(KERN_INFO "sgmii\n");
>                         dev_dbg(lane->dev, "set lane %d to SGMII mode\n",
>                                 lane->id);
>                         fw_param = COMPHY_FW_NET(fw_mode, lane->port,
>                                                  COMPHY_FW_SPEED_1_25G);
>                         break;
>                 case PHY_INTERFACE_MODE_2500BASEX:
> printk(KERN_INFO "HS sgmii\n");
>                         dev_dbg(lane->dev, "set lane %d to HS SGMII mode\n",
>                                 lane->id);
>                         fw_param = COMPHY_FW_NET(fw_mode, lane->port,
>                                                  COMPHY_FW_SPEED_3_125G);
>                         break;
>                 default:
> printk(KERN_INFO "unsupported mode\n");
>                         dev_err(lane->dev, "unsupported PHY submode (%d)\n",
>                                 lane->submode);
>                         return -ENOTSUPP;
>                 }
>                 break;
>         case PHY_MODE_PCIE:
> printk(KERN_INFO "pcie\n");
>                 dev_dbg(lane->dev, "set lane %d to PCIe mode\n", lane->id);
>                 fw_param = COMPHY_FW_PCIE(fw_mode, lane->port,
>                                           COMPHY_FW_SPEED_5G,
>                                           phy->attrs.bus_width);
>                 break;
>         default:
> printk(KERN_INFO "unsupported 2\n");
>                 dev_err(lane->dev, "unsupported PHY mode (%d)\n", lane->mode);
>                 return -ENOTSUPP;
>         }
> 
>         return mvebu_a3700_comphy_smc(COMPHY_SIP_POWER_ON, lane->id, fw_param);
> }
> 
> Resulting in the following dmesg:
> 
> [    4.204429] cacheinfo: Unable to detect cache hierarchy for CPU 0
> [    4.210933] in mvebu probe
> [    4.213664] check device match
> [    4.216765] device did match
> [    4.219825] check resources
> [    4.222619] resources ok
> [    4.225225] in phy init before check
> [    4.228881] phy->init_count 0
> [    4.231936] phy->ops->init (null)
> [    4.235342] in power on
> [    4.237847] switch lane->mode
> [    4.240887] sata
> [    4.242775] in a3700 comphy smc
> [    4.246003] res.a0=ffffffffffffffff
> [    4.249593] phy phy-d0018300.phy.2: phy poweron failed --> -1
> [    4.255504] enable resources
> [    4.258487] ahci-mvebu: probe of d00e0000.sata failed with error -1
> [    4.265231] Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
> 
> 
> So [    4.246003] res.a0=ffffffffffffffff is the power on failure?

That's indeed -1 if you consider it as a signed 64-bit value.

> 
> > You will need a recent firmware (ATF) in order to have the SMC
> > calls to work.  
> 
> That sounds promising.  My UBOOT is not *that* old:
> 
> üTIM-1.0
> WTMI-devel-18.07.0-6050fd5
> WTMI: system early-init
> CPU VDD voltage default value: 1.155V
> NOTICE:  Booting Trusted Firmware
> NOTICE:  BL1: v1.5(release):711ecd3 (Marvell-armada-18.09.4)
> NOTICE:  BL1: Built : 15:11:39, Sep  7 2018
> NOTICE:  BL1: Booting BL2
> NOTICE:  BL2: v1.5(release):711ecd3 (Marvell-armada-18.09.4)
> NOTICE:  BL2: Built : 15:11:42, Sep  7 2018
> NOTICE:  BL1: Booting BL31
> NOTICE:  BL31: v1.5(release):711ecd3 (Marvell-armada-18.09.4)
> NOTICE:  BL31: Built : 15:1
> 
> U-Boot 2017.03-armada-18.09.1-ga92bd86-armbian (Sep 05 2018 - 21:49:34 +0200)
> 
> Do you know where I might find a newer (pre built) uboot?

http://wiki.espressobin.net/tiki-index.php?page=Build+From+Source+-+Bootloader

Thanks,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel