Re: [PATCH v3 2/2] dmaengine: apple-admac: Add M3 generation ADMACs

Frank Li <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.ports.arm.kernel,gmane.linux.drivers.devicetree
Message-ID <an9kRPppZmUFH5uJ@lizhi-Precision-Tower-5810>
On Wed, Aug 12, 2026 at 11:26:34AM +0200, Sasha Finkelstein wrote:
> The admacs present on t8122 and t603x SoCs need additional writes in
> order to operate correctly. The exact purpose of this register
> is unknown
>
> Signed-off-by: Sasha Finkelstein <[email protected]>
> ---
>  drivers/dma/apple-admac.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>
> diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c
> index 14a5ee14a481..fd6236c7c024 100644
> --- a/drivers/dma/apple-admac.c
> +++ b/drivers/dma/apple-admac.c
> @@ -39,10 +39,14 @@
>
>  #define FLAG_DESC_NOTIFY	BIT(16)
>
> +#define T8122_UNK_28_VAL	0x200000
> +
>  #define REG_TX_START		0x0000
>  #define REG_TX_STOP		0x0004
>  #define REG_RX_START		0x0008
>  #define REG_RX_STOP		0x000c
> +#define REG_UNK_28		0x0028
> +#define REG_UNK_2C		0x002c
>  #define REG_IMPRINT		0x0090
>  #define REG_TX_SRAM_SIZE	0x0094
>  #define REG_RX_SRAM_SIZE	0x0098
> @@ -127,6 +131,7 @@ struct admac_data {
>  	struct mutex cache_alloc_lock;
>  	struct admac_sram txcache, rxcache;
>
> +	bool set_unk28;

const struct admac_hw *drvdata;

So needn't copy set_unk28 to here, in case need more quirk in future

Frank

>  	int irq;
>  	int irq_index;
>  	int nchannels;
> @@ -147,6 +152,10 @@ struct admac_tx {
>  	struct list_head node;
>  };
>
> +struct admac_hw {
> +	bool set_unk28;
> +};
> +
>  static int admac_alloc_sram_carveout(struct admac_data *ad,
>  				     enum dma_transfer_direction dir,
>  				     u32 *out)
> @@ -747,6 +756,11 @@ static int admac_device_config(struct dma_chan *chan,
>  	u32 bus_width = readl_relaxed(ad->base + REG_BUS_WIDTH(adchan->no)) &
>  		~(BUS_WIDTH_WORD_SIZE | BUS_WIDTH_FRAME_SIZE);
>
> +	if (ad->set_unk28) {
> +		writel_relaxed(T8122_UNK_28_VAL, ad->base + REG_UNK_28);
> +		writel_relaxed(T8122_UNK_28_VAL, ad->base + REG_UNK_2C);
> +	}
> +
>  	switch (is_tx ? config->dst_addr_width : config->src_addr_width) {
>  	case DMA_SLAVE_BUSWIDTH_1_BYTE:
>  		wordsize = 1;
> @@ -805,6 +819,7 @@ static int admac_probe(struct platform_device *pdev)
>  	struct device_node *np = pdev->dev.of_node;
>  	struct admac_data *ad;
>  	struct dma_device *dma;
> +	const struct admac_hw *hw;
>  	int nchannels;
>  	int err, irq, i;
>
> @@ -822,6 +837,9 @@ static int admac_probe(struct platform_device *pdev)
>  	ad->dev = &pdev->dev;
>  	ad->nchannels = nchannels;
>  	mutex_init(&ad->cache_alloc_lock);
> +	hw = of_device_get_match_data(&pdev->dev);
> +	if (hw)
> +		ad->set_unk28 = hw->set_unk28;
>
>  	/*
>  	 * The controller has 4 IRQ outputs. Try them all until
> @@ -935,7 +953,12 @@ static void admac_remove(struct platform_device *pdev)
>  	reset_control_rearm(ad->rstc);
>  }
>
> +static const struct admac_hw admac_t8122_hw = {
> +	.set_unk28 = true,
> +};
> +
>  static const struct of_device_id admac_of_match[] = {
> +	{ .compatible = "apple,t8122-admac", .data = &admac_t8122_hw },
>  	{ .compatible = "apple,t8103-admac", },
>  	{ .compatible = "apple,admac", },
>  	{ }
>
> --
> 2.55.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.