Re: [PATCH v2 net-next 3/4] net: phy: Add Qualcomm QCA807x driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +static int qca807x_psgmii_config(struct phy_device *phydev)
> +{
> +	struct device_node *node = phydev->mdio.dev.of_node;
> +	int psgmii_az, tx_amp, ret = 0;
> +	u32 tx_driver_strength_dt;
> +
> +	/* Workaround to enable AZ transmitting ability */
> +	if (of_property_read_bool(node, "qcom,psgmii-az")) {
> +		psgmii_az = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, PSGMII_MODE_CTRL);
> +		psgmii_az &= ~PSGMII_MODE_CTRL_AZ_WORKAROUND_MASK;
> +		psgmii_az |= FIELD_PREP(PSGMII_MODE_CTRL_AZ_WORKAROUND_MASK, 0xc);
> +		ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, PSGMII_MODE_CTRL, psgmii_az);
> +		psgmii_az = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, PSGMII_MODE_CTRL);
> +	}
> +
> +	/* PSGMII/QSGMII TX amp set to DT defined value instead of default 600mV */
> +	if (!of_property_read_u32(node, "qcom,tx-driver-strength", &tx_driver_strength_dt)) {
> +		int tx_driver_strength;
> +
> +		switch (tx_driver_strength_dt) {
> +		case 140:
> +			tx_driver_strength = 0;
> +			break;
> +		case 160:
> +			tx_driver_strength = 1;
> +			break;
> +		case 180:
> +			tx_driver_strength = 2;
> +			break;
> +		case 200:
> +			tx_driver_strength = 3;
> +			break;
> +		case 220:
> +			tx_driver_strength = 4;
> +			break;
> +		case 240:
> +			tx_driver_strength = 5;
> +			break;
> +		case 260:
> +			tx_driver_strength = 6;
> +			break;
> +		case 280:
> +			tx_driver_strength = 7;
> +			break;
> +		case 300:
> +			tx_driver_strength = 8;
> +			break;
> +		case 320:
> +			tx_driver_strength = 9;
> +			break;
> +		case 400:
> +			tx_driver_strength = 10;
> +			break;
> +		case 500:
> +			tx_driver_strength = 11;
> +			break;
> +		case 600:
> +			tx_driver_strength = 12;
> +			break;
> +		default:
> +			tx_driver_strength = 12;
> +			break;

Please return -EINVAL here. The value in DT is not valid, so you
should error out. If there is no value at all, then it is O.K. to
default to 12.

     Andrew



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux