Date: Thu, 23 Jan 2014 11:25:20 -0200 From: Luiz Otavio O Souza <lists.br@gmail.com> To: Adrian Chadd <adrian@freebsd.org> Cc: "\\\\\\freebsd-mips@freebsd.org\\\\\\" <freebsd-mips@freebsd.org> Subject: Re: Re[6]: RB450G compiling the kernel Message-ID: <CAB=2f8yFxW8gbNxFFR1kp%2Ba1eaMR90=fGmdTb8HyNAZN03p49Q@mail.gmail.com> In-Reply-To: <CAJ-VmokQW2uR7jHjzXxEnH4b%2BS-3Tf28DWb7Cn2qsR1U0aEBQw@mail.gmail.com> References: <1388404360.131024714@f310.i.mail.ru> <1388826328.503909163@f428.i.mail.ru> <CAJ-VmomrkYKqmUq=B_b6FQ4Qn60Lf0oR%2Bjy0CnyKj-A6w3CVGQ@mail.gmail.com> <1388917050.228853059@f25.i.mail.ru> <CAJ-VmokQW2uR7jHjzXxEnH4b%2BS-3Tf28DWb7Cn2qsR1U0aEBQw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On 5 January 2014 23:41, Adrian Chadd <adrian@freebsd.org> wrote: > On 5 January 2014 02:17, Anton <felix_mail@mail.ru> wrote: >> Hi Adrian, >> >> I can post my kernel configs after a week. If it's needed. Sorry for jump in so late. I've a working kernel and hints for RB450G. Please try the attached files (and apply the two patches). Let me know if it works for you. RB450G dmesg: http://pastebin.ca/2577635 Luiz [-- Attachment #2 --] Index: sys/mips/atheros/if_arge.c =================================================================== --- sys/mips/atheros/if_arge.c (revision 254976) +++ sys/mips/atheros/if_arge.c (working copy) @@ -372,6 +372,7 @@ long eeprom_mac_addr = 0; int miicfg = 0; int readascii = 0; + int invertunits; sc = device_get_softc(dev); sc->arge_dev = dev; @@ -546,8 +547,11 @@ sc->arge_eaddr[4] = (rnd >> 16) & 0xff; sc->arge_eaddr[5] = (rnd >> 8) & 0xff; } - if (sc->arge_mac_unit != 0) - sc->arge_eaddr[5] += sc->arge_mac_unit; + if (resource_int_value(device_get_name(dev), 0, "invertunits", + &invertunits) == 0) + sc->arge_eaddr[5] += !sc->arge_mac_unit; + else + sc->arge_eaddr[5] += sc->arge_mac_unit; if (arge_dma_alloc(sc) != 0) { error = ENXIO; [-- Attachment #3 --] # # RB450G - Mikrotik routerboard 450G includes: # # * AR7161 SoC # * 680Mhz CPU # * 256MB RAM # * 512MB nand # * mmcsd card slot # * AR8316 gigabit ethernet switch # # $FreeBSD$ # include "AR71XX_BASE" ident "RB450G" hints "RB450G.hints" # RB450[G] doesn't have any minipci slots, flash and usb ports nodevice pci nodevice ar71xx_pci nodevice mx25l nodevice usb nodevice ehci nodevice umass # RouterBoard RB4XX support #device rb4xx #device nand # MMC/SD SPI slot #device mmc #device mmcsd #device mmcspi # For DOS options MSDOSFS # RouterBoot support options AR71XX_ENV_ROUTERBOOT # For etherswitch support options ARGE_MDIO device miiproxy device etherswitch device arswitch device vlan # Boot off from NAND #options ROOTDEVNAME=\"ufs:redboot/rootfs.uzip\" # XXX - NFS root for now options NFSCL options NFS_ROOT options BOOTP options BOOTP_NFSROOT options BOOTP_NFSV3 options BOOTP_WIRED_TO=arge1 options BOOTP_COMPAT [-- Attachment #4 --] # $FreeBSD$ # arge0 mdio bus hint.argemdio.0.at="nexus0" hint.argemdio.0.maddr=0x19000000 hint.argemdio.0.msize=0x1000 hint.argemdio.0.order=0 # arge0: nail to 1000/full, RGMII - connected to the switch hint.arge.0.media=1000 # Map to 1000/full hint.arge.0.fduplex=1 # hint.arge.0.miimode=3 # RGMII hint.arge.0.phymask=0x0 # no directly mapped PHYs hint.arge.0.invertunits=1 # arge0 connected to switch # arge1: dedicated switch port hint.arge.1.phymask=0x10 # PHY4 hint.arge.1.miimode=3 # RGMII hint.arge.1.mdio=mdioproxy1 # .. off of the switch mdiobus # arswitch hint.arswitch.0.at="mdio0" hint.arswitch.0.is_7240=0 hint.arswitch.0.numphys=4 hint.arswitch.0.phy4cpu=1 hint.arswitch.0.is_rgmii=1 hint.arswitch.0.is_gmii=0 # RouterBoard CPLD hint.rb_cpldbus.0.at="spibus0" hint.rb_cpldbus.0.cs=0 # SPI microSD slot hint.mmcspi.0.at="spibus0" hint.mmcspi.0.cs=1 # Don't flip on anything that isn't already enabled. # This includes leaving the SPI CS1/CS2 pins as GPIO pins as they're # not used here. #hint.gpio.0.function_set=0x00000000 #hint.gpio.0.function_clear=0x00000000 # These are the GPIO LEDs and buttons which can be software controlled. hint.gpio.0.pinmask=0x000000ff # GPIO 0: # GPIO 1: # GPIO 2: # GPIO 3: # GPIO 4: Led-1 # GPIO 5: NAND busy pin # GPIO 6: # GPIO 7: Reset Switch # Green led near the power led. hint.gpioled.0.at="gpiobus0" hint.gpioled.0.name="led0" # pin 4 hint.gpioled.0.pins=0x0010 # RouterBoard CPLD leds hint.gpioled.1.at="gpiobus1" hint.gpioled.1.name="led1" hint.gpioled.1.pins=0x0001 hint.gpioled.2.at="gpiobus1" hint.gpioled.2.name="led2" hint.gpioled.2.pins=0x0002 hint.gpioled.3.at="gpiobus1" hint.gpioled.3.name="led3" hint.gpioled.3.pins=0x0004 hint.gpioled.4.at="gpiobus1" hint.gpioled.4.name="led4" hint.gpioled.4.pins=0x0008 [-- Attachment #5 --] Index: sys/conf/options.mips =================================================================== --- sys/conf/options.mips (revision 254976) +++ sys/conf/options.mips (working copy) @@ -92,6 +92,7 @@ AR71XX_REALMEM opt_ar71xx.h AR71XX_ENV_UBOOT opt_ar71xx.h AR71XX_ENV_REDBOOT opt_ar71xx.h +AR71XX_ENV_ROUTERBOOT opt_ar71xx.h AR71XX_ATH_EEPROM opt_ar71xx.h # Index: sys/mips/atheros/ar71xx_machdep.c =================================================================== --- sys/mips/atheros/ar71xx_machdep.c (revision 254976) +++ sys/mips/atheros/ar71xx_machdep.c (working copy) @@ -140,6 +140,32 @@ } } +#ifdef AR71XX_ENV_ROUTERBOOT +/* + * RouterBoot gives us a command line argument with the available memory. + */ +static int +ar71xx_routerboot_get_mem(int argc, char **argv) +{ + int i, board_mem; + + /* + * Protect ourselves from garbage in registers. + */ + if (!MIPS_IS_VALID_PTR(argv)) + return (0); + + for (i = 0; i < argc; i++) { + if (strncmp(argv[i], "mem=", 4) == 0) { + if (sscanf(argv[i] + 4, "%dM", &board_mem) == 1) + return (btoc(board_mem * 1024 * 1024)); + } + } + + return (0); +} +#endif + void platform_start(__register_t a0 __unused, __register_t a1 __unused, __register_t a2 __unused, __register_t a3 __unused) @@ -183,7 +209,15 @@ } } +#ifdef AR71XX_ENV_ROUTERBOOT /* + * RouterBoot informs the board memory as a command line argument. + */ + if (realmem == 0) + realmem = ar71xx_routerboot_get_mem(argc, argv); +#endif + + /* * Just wild guess. RedBoot let us down and didn't reported * memory size */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAB=2f8yFxW8gbNxFFR1kp%2Ba1eaMR90=fGmdTb8HyNAZN03p49Q>
