Hello,

I want to do automatic board detection for some SUN7I boards.  What I've 
done so far is:

   - Make my own board/<vendor>/<name>
   - In the Makefile request dependencies from board/sunxi directory, e.g.

obj-$(CONFIG_SUNXI_GMAC) += ../../sunxi/gmac.o

obj-$(CONFIG_SUNXI_AHCI) += ../../sunxi/ahci.o

obj-$(CONFIG_MACH_SUN7I) += ../../sunxi/dram_sun5i_auto.o


   - In arch/arm/mach-sunxi/Kconfig I've added menu:
      - Default target
      - My own target
   
Based of the choice I change SYS_BOARD, SYS_VENDOR, SYS_CONFIG_NAME to 
point to my directory


   - In my board.c file is pretty much the same as board/sunxi/board.c 
   without lot of switches, etc. Also I make some board detection and set some 
   u-boot variables.


So far so good.
The problem is driver initialization. Fox example in 
arch/arm/mach-sunxi/usb_phy.c there is this code:
static int get_vbus_gpio(int index)
{
 switch (index) {
 case 0: return sunxi_name_to_gpio(CONFIG_USB0_VBUS_PIN);
 case 1: return sunxi_name_to_gpio(CONFIG_USB1_VBUS_PIN);
 case 2: return sunxi_name_to_gpio(CONFIG_USB2_VBUS_PIN);
 case 3: return sunxi_name_to_gpio(CONFIG_USB3_VBUS_PIN);
 }
 return -EINVAL;
}

On board A I have VBUS_PIN on "PC0", on board B - "PC1", on board C - 
"PC2". How I'm supposed to do this, without doing some s**** things?

Also, I'm the first trying to do such thing? 
In general, is this correct? Can it go mainline? If not, what you recommend?

Best regards,
Stefan Mavrodiev

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to