[PATCH 1/2] cs553x-gpio: add AMD CS5535/CS5536 GPIO driver support

Andres Salomon dilinger at queued.net
Wed Feb 25 07:04:50 EST 2009


On Wed, 25 Feb 2009 10:38:30 +0100
Alessandro Zummo <alessandro.zummo at towertech.it> wrote:

> On Tue, 24 Feb 2009 15:19:37 -0500
> Andres Salomon <dilinger at queued.net> wrote:
> 
> > Not yet.  The MFGPT, DCON, and olpc stuff will use them; I'm
> > waiting to hear feedback on this patch before I write a generic
> > MFGPT driver (or skip to cleaning up and submitting the DCON
> > driver).
> > 
> 
>  why can't they use the generic gpio api?
> 

Because the DCON (for example) has this bit of code:

         * According to HiMax, when powering the DCON up we should hold
         * SMB_DATA high for 8 SMB_CLK cycles.  This will force the DCON
         * state machine to reset to a (sane) initial state.  Mitch Bradley
         * did some testing and discovered that holding for 16 SMB_CLK cycles
         * worked a lot more reliably, so that's what we do here.
         *
         * According to the cs5536 spec, to set GPIO14 to SMB_CLK we must
         * simultaneously set AUX1 IN/OUT to GPIO14; ditto for SMB_DATA and
         * GPIO15.
         */
        geode_gpio_set(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_OUTPUT_VAL);
        geode_gpio_set(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_OUTPUT_ENABLE);
        geode_gpio_clear(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_OUTPUT_AUX1);
        geode_gpio_clear(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_OUTPUT_AUX2);
        geode_gpio_clear(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_INPUT_AUX1);

        for (x = 0; x < 16; x++) {
                udelay(5);
                geode_gpio_clear(OLPC_GPIO_SMB_CLK, GPIO_OUTPUT_VAL);
                udelay(5);
                geode_gpio_set(OLPC_GPIO_SMB_CLK, GPIO_OUTPUT_VAL);
        }
        udelay(5);
        geode_gpio_set(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_OUTPUT_AUX1);
        geode_gpio_set(OLPC_GPIO_SMB_CLK|OLPC_GPIO_SMB_DATA, GPIO_INPUT_AUX1);

The GPIO_OUTPUT_VALs can obviously use the generic GPIO API, but I have no
idea how you'd map the INPUT_AUX1/OUTPUT_AUX1/OUTPUT_AUX2 stuff.

There are plenty other examples of this sort of thing.



More information about the Linux-geode mailing list