linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Joel Schopp <jschopp@linux.vnet.ibm.com>
Cc: Peter H?we <PeterHuewe@gmx.de>,
	tpmdd-devel@lists.sourceforge.net, linuxppc-dev@lists.ozlabs.org
Subject: Re: [tpmdd-devel] Has anyone a ATMEL TPM Chip on PPC64 (CONFIG_TCG_ATMEL)?
Date: Mon, 28 Oct 2013 17:47:45 -0600	[thread overview]
Message-ID: <20131028234745.GB26666@obsidianresearch.com> (raw)
In-Reply-To: <526EA6FF.2080401@linux.vnet.ibm.com>

On Mon, Oct 28, 2013 at 01:03:43PM -0500, Joel Schopp wrote:
> On 10/27/2013 05:06 PM, Peter H?we wrote:
> > Hi,
> > 
> > I was wondering if anyone here on this list still has a machine with an old 
> > ATMEL TPM (trusted platform module) lying around?
> > 
> >>From the kconfig entry it becomes evident that it was only supported on ppc64 
> > machines.
> > 
> > config TCG_ATMEL
> > 	tristate "Atmel TPM Interface"
> > 	depends on PPC64 || HAS_IOPORT

Hurm, that is crazy, because tpm_atmel.h contains an #else block for
!CONFIG_PPC64. The single major source of complexity in this driver is
that else block.

The driver would be fine, and straightforward if it was a standard,
modern DT enabled driver, which is very easy if PPC64 is the only
supported implementation.

> I reccomend removing the driver.  If the stars align and a user actually
> appears who wants to use one I'll clean up the driver and resubmit it
> for inclusion.  I just don't think that will happen.

The needed clean up is really easy actually, replace everything below
'tpm_vendor_specific tpm_atmel' with approximately this:

static int atml_probe(struct platform_device *pdev)
{
	struct tpm_chip *chip;
	struct resrouce *res;

        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!r)
                return -EIO;

	if (!(chip = tpm_register_hardware(dev, &tpm_atmel)))
               return -ENODEV;

	chip->iobase = devm_request_and_ioremap(&pdev->dev, res);
	if (!chip->iobase)
	       	return -ENOMEM;

	return 0;
}

static void atml_plat_remove(struct platform_device *pdev)
{
        struct tpm_chip *chip = dev_get_drvdata(&pdev->dev);
	tpm_remove_hardware(chip->dev);		
};

static const struct of_device_id platform_match[] = {
        {.compatible = "AT97SC3201"},
        {},
};
MODULE_DEVICE_TABLE(of, platform_match);

static SIMPLE_DEV_PM_OPS(tpm_atml_pm, tpm_pm_suspend, tpm_pm_resume);

static struct platform_driver atml_drv = {
        .probe = atml_probe,
        .remove = atml_plat_remove,
        .driver = {
                .name = "tpm_atmel",
                .owner          = THIS_MODULE,
                .pm             = &tpm_atml_pm,
		.of_match_table = of_match_ptr(platform_match),
        },
};

module_platform_driver(atml_drv);

MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)");
MODULE_DESCRIPTION("TPM Driver");
MODULE_VERSION("2.0");
MODULE_LICENSE("GPL");

If you guys can convice yourselves that doesn't obviously break anything I can
probably send a proper patch.

Jason

  reply	other threads:[~2013-10-29  0:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-27 22:06 Has anyone a ATMEL TPM Chip on PPC64 (CONFIG_TCG_ATMEL)? Peter Hüwe
2013-10-28 18:03 ` [tpmdd-devel] " Joel Schopp
2013-10-28 23:47   ` Jason Gunthorpe [this message]
2013-10-29  0:03     ` Peter Hüwe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131028234745.GB26666@obsidianresearch.com \
    --to=jgunthorpe@obsidianresearch.com \
    --cc=PeterHuewe@gmx.de \
    --cc=jschopp@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).