lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100701134839.d7cb4841.akpm@linux-foundation.org>
Date:	Thu, 1 Jul 2010 13:48:39 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Anton Vorontsov <avorontsov@...sta.com>
Cc:	Ben Dooks <ben@...tec.co.uk>,
	Richard Röjfors 
	<richard.rojfors@...agicore.com>, linux-mmc@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] sdhci-pltfm: Add support for CNS3xxx SoC devices

On Fri, 25 Jun 2010 22:06:44 +0400
Anton Vorontsov <avorontsov@...sta.com> wrote:

> There's nothing special, just SoC-specific ops and quirks.
> 
> ...
>
> +static void sdhci_cns3xxx_set_clock(struct sdhci_host *host, unsigned int clock)
> +{
> +	struct device *dev = mmc_dev(host->mmc);
> +	int div = 1;
> +	u16 clk;
> +	unsigned long timeout;
> +
> +	if (clock == host->clock)
> +		return;

I assume that mmc core prevents this function from being exectued twice
at the same time?

> +	sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
> +
> +	if (clock == 0)
> +		goto out;
> +
> +	while (host->max_clk / div > clock) {
> +		/*
> +		 * On CNS3xxx divider grows linearly up to 4, and then
> +		 * exponentially up to 256.
> +		 */
> +		if (div < 4)
> +			div += 1;
> +		else if (div < 256)
> +			div *= 2;
> +		else
> +			break;
> +	}
> +
> +	dev_dbg(dev, "desired SD clock: %d, actual: %d\n",
> +		clock, host->max_clk / div);
> +
> +	/* Divide by 3 is special. */
> +	if (div != 3)
> +		div >>= 1;
> +
> +	clk = div << SDHCI_DIVIDER_SHIFT;
> +	clk |= SDHCI_CLOCK_INT_EN;
> +	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
> +
> +	timeout = 20;
> +	while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
> +			& SDHCI_CLOCK_INT_STABLE)) {
> +		if (timeout == 0) {
> +			dev_warn(dev, "clock is unstable");
> +			break;
> +		}
> +		timeout--;
> +		mdelay(1);

Could we have used the more polite msleep() here?

> +	}
> +
> +	clk |= SDHCI_CLOCK_CARD_EN;
> +	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
> +out:
> +	host->clock = clock;
> +}
> +
>
> ...
>
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -158,6 +158,9 @@ static int __devexit sdhci_pltfm_remove(struct platform_device *pdev)
>  
>  static const struct platform_device_id sdhci_pltfm_ids[] = {
>  	{ "sdhci", },
> +#ifdef CONFIG_MMC_SDHCI_CNS3XXX
> +	{ "sdhci-cns3xxx", (kernel_ulong_t)&sdhci_cns3xxx_pdata },
> +#endif

What the heck is this kernel_ulong_t thing and why did `struct
platform_device_id' see a need to invent it??


>  	{ },
>  };
>  MODULE_DEVICE_TABLE(platform, sdhci_pltfm_ids);
>
> ...
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ