Re: [PATCH] ARM: OMAP2: Add pinmux support for OMAP3430

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tony,
Tony Lindgren mentioned the following on 1/24/2008 4:17 PM:
* Klaus.K Pedersen (Nokia-M/Helsinki) <klaus.k.pedersen@xxxxxxxxx> [080124 13:19]:
On Wed, 2008-01-23 at 16:53 -0800, ext Tony Lindgren wrote:
From: Gadiyar, Anand <gadiyar@xxxxxx>

This patch adds pinmux support for OMAP3.
....
+
+/* PHY - HSUSB: 12-pin ULPI PHY: Port 1*/
+MUX_CFG_34XX("Y9_3430_USB1HS_PHY_STP",	0x5d8,	3,	1,	1,	0,
+				0, 	0,	0, 	1, 	1,	0)
And you would spot the error in this one right away:

MUX_CFG_34XX("Y9_3430_USB1HS_PHY_STP",	0x5d8,	3, 1,  1,  0,
	0,  0,  0, 1,  1,  0)

which would become:

MUX_CFG_34XX("Y9_3430_USB1HS_PHY_STP",	0x5d8,	3, OUTPUT, OFF_INPUT_PULL_H)

This sounds like a good way to group the pin options to me. We
could also pass the active state flags to omap_cfg_reg() as some may
depend on devices connected.

Can anybody see cases where Klaus' grouping would not work?
Dunno if I missed some mail in this thread, but the obvious occured: Have we considered having more readable macros? I mean modes are only 1-7 (3bits- and give one more for safe), then add the others
#define MODE(x) ((x)&0xF)
#define PULL_EN (0x1<<5)
#define PULL_DIS (0x0<<5)
#define PULL_UP   (0x1<<6)
#define PULL_DOWN   (0x0<<6)
#define OUTPUT   (0x1<<7)
#define INPUT      (0x0<<7)
etc.. 1 bit per field. use 16 bit to store the vals (just like the regs)
and Thus,

MUX_CFG_34XX("Y9_3430_USB1HS_PHY_STP",	0x5d8,	3, 1,  1,  0,
	0,  0,  0, 1,  1,  0)
becomes:
MUX_CFG_34XX("Y9_3430_USB1HS_PHY_STP",	0x5d8,	3, OUTPUT, OFF_INPUT_PULL_H)
becomes:
MUX_CFG_34XX("Y9_3430_USB1HS_PHY_STP",	0x5d8,	MODE(3)|OUTPUT|PULL_DIS|WAKEUP_EN)

All platforms can live with that rt? the pin_config structure gets simpler(and less of a nightmare) and portable :D

struct pin_config {
    char *name;
    unsigned char busy;
    unsigned char debug;

    const unsigned int mux_reg;
    const unsigned short mux_def;
}
And one more thing (maybe I am wrong): I think i still see that we are driving mux common for all platforms on the same silicon. as we get more boards using and "misusing" the mux concept, I think at some point we'd need to refactor mux driver to allow omap_mux_register be called platform specific. shrug.. just an old opinion..

Regards,
Nishanth Menon
Regards,
Nishanth Menon

-
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux