// General purpose configuration register functions
// ************************************************
// to put several pads at once in HW mode, a change in the control signal (pgp_...) is required.
// these function enable and disable those signals.
// the naming convention is pgp_<signal>_enable/disable.
// for example: pgp_cspi_bb_disable will drive the pgp_cspi_bb bit
// in the GP_REG in the IOMUX low, so the pads controlled by this signal
// (in this case, DTR_DTE1, DSR_DTE1, RI_DTE1, DCD_DTE1, and DTR_DCE2),
// will no longer be in HW mode.
// for a complete list of control signals and pads see:
// 
// /vobs/vb_tortola/tortola_designdir/tortola/tool_data/rabbit/Tortola_pins.xls
//
// as a special case, 6 ATA functions are added, to configure the ATA
// to each of it's 6 use cases. the naming convention is set_ata_in_modeX.
// for a complete list of the pads affected and the way they are, see above file, ATA sheet.
//
// contact: giladb, RM96492, FIL

#include "functions.h"

void set_ata_in_mode1() {
reg32_write_mask(GP_REG,0x00000238,0x040007f8); }

void set_ata_in_mode2() {
reg32_write_mask(GP_REG,0x04000308,0x040007f8); }

void set_ata_in_mode3() {
reg32_write_mask(GP_REG,0x00000098,0x040007f8); }

void set_ata_in_mode4() {
reg32_write_mask(GP_REG,0x00000488,0x040007f8); }

void set_ata_in_mode5() {
reg32_write_mask(GP_REG,0x000000c8,0x040007f8); }

void set_ata_in_mode6() {
reg32_write_mask(GP_REG,0x00000348,0x040007f8); }

void pgp_firi_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000001); }

void pgp_firi_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000001); }

void pgp_cspi_bb_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000004); }

void pgp_cspi_bb_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000004); }

void pgp_ata_1_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000008); }

void pgp_ata_1_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000008); }

void pgp_ata_2_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000010); }

void pgp_ata_2_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000010); }

void pgp_ata_3_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000020); }

void pgp_ata_3_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000020); }

void pgp_ata_4_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000040); }

void pgp_ata_4_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000040); }

void pgp_ata_5_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000080); }

void pgp_ata_5_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000080); }

void pgp_ata_6_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000100); }

void pgp_ata_6_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000100); }

void pgp_ata_7_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000200); }

void pgp_ata_7_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000200); }

void pgp_ata_8_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000400); }

void pgp_ata_8_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000400); }

void pgp_uh2_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00000800); }

void pgp_uh2_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00000800); }

void pgp_usb_4wire_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00020000); }

void pgp_usb_4wire_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00020000); }

void pgp_usb_common_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00040000); }

void pgp_usb_common_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00040000); }

void pgp_spll_byp_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00200000); }

void pgp_spll_byp_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00200000); }

void pgp_upll_byp_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00400000); }

void pgp_upll_byp_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00400000); }

void pgp_mshc1_clk_sel_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x00800000); }

void pgp_mshc1_clk_sel_disable() {
reg32_write_mask(GP_REG,0x00000000,0x00800000); }

void pgp_mshc2_clk_sel_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x01000000); }

void pgp_mshc2_clk_sel_disable() {
reg32_write_mask(GP_REG,0x00000000,0x01000000); }

void pgp_ata_9_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x04000000); }

void pgp_ata_9_disable() {
reg32_write_mask(GP_REG,0x00000000,0x04000000); }

void pgp_usb_otg_loopback_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x10000000); }

void pgp_usb_otg_loopback_disable() {
reg32_write_mask(GP_REG,0x00000000,0x10000000); }

void pgp_usb_hs1_loopback_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x20000000); }

void pgp_usb_hs1_loopback_disable() {
reg32_write_mask(GP_REG,0x00000000,0x20000000); }

void pgp_usb_hs2_loopback_enable() {
reg32_write_mask(GP_REG,0xffffffff,0x40000000); }

void pgp_usb_hs2_loopback_disable() {
reg32_write_mask(GP_REG,0x00000000,0x40000000); }

