From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8CB92E5B2A for ; Tue, 23 Jun 2026 10:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782212221; cv=none; b=sM8KnYtBvVPQ9NRDrKjCSbhzW7glVRjTOyLJgTwJ9PlZewM7S+/Vmtict0lKIj0nscCVYG4QfHQuHz3y8yirgs6NzML45p3Q7ur1r259+nPeVce24z9PNQoNwMZCwA+dCKf71lqQEooWwIMYK3LlwhTUTKatP9PcX/5k9mOB0W4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782212221; c=relaxed/simple; bh=aPIE95mLRe42YcYMyleHpuz76yXdRQVmwRI/yhRFbK8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IGj2oKNRbDSg0K+MbcUD1s0xx3DxyNcun4377dgsCUnkwrjbEimZMCYjD63Of2UivUdLBjJszFdUh6MT1QQKz5FpRxXXgDJ4/a5kECI4BBA1F8liZ6pSJNmuLLUIQs2nweNS8k2u8eKErFhRZF0XriBgu6i87cuia1K0+4bRMBQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=a/DlUklY; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="a/DlUklY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1782212220; x=1813748220; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=aPIE95mLRe42YcYMyleHpuz76yXdRQVmwRI/yhRFbK8=; b=a/DlUklY3MLXwMtb2t58RHBVkThrBm+SlrjgYQygdYF7+rrbcZ+HcUNO 7aLBwPn8uyzx2BWQp0lTFYA7SK4/XtZ524oykHsW9B3+sAmhGLoqZLaiO IAqHVHJPwoz5iXj3hxoo4A8x9y2aIFnOEg1d191yWxEUF+GnIyay95gEH YHnfeJwFL5xfBuKYK7ICXeQs1B43CmUBjEv50WF4yQdXulHIWaIs+z8Ct Rina0eJwvvzEKnybMcQ2AEAc7B1RI0Ca7ROqIAa7ApTjfEPH37zSkoSxB QY9aBloslyMmKJwWNbPwBKd5m98q1Mykj85DtUXgNBqOa+a7m0tktuUAk Q==; X-CSE-ConnectionGUID: phBQ4f2ZRPiHc44+3JPXlA== X-CSE-MsgGUID: RpMCuyr4RA6byTe4aqUKDQ== X-IronPort-AV: E=McAfee;i="6800,10657,11825"; a="81931387" X-IronPort-AV: E=Sophos;i="6.24,220,1774335600"; d="scan'208";a="81931387" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2026 03:56:59 -0700 X-CSE-ConnectionGUID: OTLYXidkQ7aSmp6fk9EOCw== X-CSE-MsgGUID: QnFnGt+ZRLmcYl22vHtP8w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,220,1774335600"; d="scan'208";a="248341192" Received: from klitkey1-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.244.7]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2026 03:56:56 -0700 Date: Tue, 23 Jun 2026 13:56:53 +0300 From: Andy Shevchenko To: Heikki Krogerus Cc: Rodrigo Vivi , Matthew Brost , Thomas =?iso-8859-1?Q?Hellstr=F6m?= , Raag Jadav , "Michael J . Ruhl" , Mika Westerberg , Riana Tauro , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/2] drm/xe/mcu_i2c: Take over control of the controller enabling Message-ID: References: <20260622114759.3464047-1-heikki.krogerus@linux.intel.com> <20260622114759.3464047-3-heikki.krogerus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260622114759.3464047-3-heikki.krogerus@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo On Mon, Jun 22, 2026 at 01:47:59PM +0200, Heikki Krogerus wrote: > Some platforms make an assumption that the i2c controller's > enabled state indicates also the power state of the > controller. This can create a problem when the controller is > in disabled state, because the hardware may assume > incorrectly that it is then also in low-power state. > > To fix this, the controller is kept enabled by taking over > the IC_ENABLE register. The controller has to be disabled > when the configuration is updated and when the target > address or the slave address are assigned, so disabling it > when IC_CON, IC_TAR or IC_SAR registers are programmed, and > then re-enabling it again. ... > +#define IC_CON 0x00 > +#define IC_TAR 0x04 > +#define IC_SAR 0x08 > +#define IC_ENABLE 0x6c > +#define IC_ENABLE_STATUS 0x9c Heh, I would like to have a shared header with the registers, but dunno if the prons will weight out the cons. ... > +/* See "Disabling DW_apb_i2c" in the DesignWare DW_abp_i2c databook. */ > +static int xe_i2c_disable(struct xe_i2c *i2c) > +{ > + int timeout = 100; > + u32 status; > + > + do { > + /* Disable.*/ > + xe_mmio_rmw32(i2c->mmio, XE_REG(IC_ENABLE + I2C_MEM_SPACE_OFFSET), 1, 0); > + > + /* Verify. */ > + status = xe_mmio_read32(i2c->mmio, XE_REG(IC_ENABLE_STATUS + I2C_MEM_SPACE_OFFSET)); > + if (!(status & 1)) > + return 0; > + > + /* Repeat. */ > + usleep_range(25, 250); fsleep(). > + } while (timeout--); > + > + return -ETIMEDOUT; > +} -- With Best Regards, Andy Shevchenko