Writing to flash, controlling the modem LED
Johann Hanne <[email protected]> Sat, 29 Jan 2005 11:37:01 +0100
| Newsgroups | gmane.linux.uclinux.actiontec |
|---|---|
| Message-ID | <[email protected]> |
Hi,
iirc nobody has ever described how to write to the 2 kB of configuration flash
space accessible via /dev/mtdc0. The whole secret lies in
drivers/mtd/devices/mtdram.c which is part of Bruce's DPCM GPL patch. This
file has been patched by Actiontec to include support for writing to flash
via the conexant flash routines. The actual changes are relatively small: the
device is still some kind of testing module which allocates a small chunk of
memory (2 kB) and makes it accessible via the mtd methods (originally it was
a testing module for testing mtd stuff without having a real mtd, i.e. a
flash device). Actiontec has put in some code which allows to write the
content of the memory buffer to flash and also to read from flash and put the
content into the memory buffer. This is done by sending certain "commands"
to /dev/mtdc0, in the same way you send data to /dev/mtdc0. I.e. it mixes up
data and commands - if it doesn't recognize a command it treats the string as
data. To modify the configuration data via the command line, just type the
following commands on the shell prompt:
--
echo "ReadFrFlash" >/dev/mtdc0
echo "Overwrite the configuration data" >/dev/mtdc0
echo "SaveToFlash" >/dev/mtdc0
--
The whole thing smells like a hack. If your configuration data accidently
contains "ReadFrFlash", you won't be able to save it, because the driver
will regard it as command. Yes, the chances that you need that string in the
configuration are near to zero, but it's still somewhat inelegant.
Furhermore, it's awful that Actiontec only patched mtdram.c instead of copying
the file and giving it an appropriate name. In my patch against
linux-2.4.27-uc1 that i will release shortly, i've created a new file name
mtdcnxt.c which will include the required functionality.
BTW, the modem LED and modem reset is also controlled via /dev/mtdc0:
echo "ResetModem***" >/dev/mtdc0 -- will reset the modem
echo "LedOn***" >/dev/mtdc0 -- will turn the modem LED on
echo "LedOff***" >/dev/mtdc0 -- will turn the modem LED off
However, this will NOT work with the kernel config posted by Bruce. There is
one small problem: The "OAKLAND" board is chosen as "Board Support
Package" ("System Type" in make menuconfig, "CONFIG_BD_OAKLAND=y"
in .config). This will activate the following code
ininclude/asm-armnommu/arch-cx821xx/gpio.h
--
#if CONFIG_BD_OAKLAND
#define GPOUT_TASKRDY_LED GPIO19
#else
#define GPOUT_TASKRDY_LED GPIO7
#endif
--
This will make the modem LED blink as it's actually connected to GPIO19. If
you choose "GOLDENGATE" as "Board Support Package", this will not happen and
turning the modem LED on and off via /dev/mtdc0 will actually work. The other
kernel code for "OAKLAND" and "GOLDENGATE" is the same.
Cheers, Johann
__
actionhack Mailing List - actionhack-W7/[email protected]
http://www.express.org/mailman/listinfo/actionhack
http://www.embeddedlinuxinterfacing.com/wiki.php/ActiontecDualModem