#define GPIO_DIR_HIGH (0x900000001fe00120) /* GPIO Direction Register */ #define GPIO_DATA_HIGH (0x900000001fe0011c) /* GPIO Data Register */ #define G_OUTPUT 0 #define G_INPUT 1 #define GPIO_SDA_DIR_SHIFT 1 /* GPIO1 used as SDA signal, R102 */ #define GPIO_SCL_DIR_SHIFT 0 /* GPIO0 used as SCL signal, R94 */ #define GPIO_SDA_DATA_SHIFT 1 #define GPIO_SCL_DATA_SHIFT 0 /* Just use t2,t4,t5,t6,t9, k0,k1,a0,a1,a2,a3,v0,v1 */ /* * used to sleep some nop for ddr_frenquency, * here it can support 600M-1000M */ LEAF(_i2c_sleep) li t2,0x10 sll a0,t2,a0 1: nop subu a0,1 bnez a0,1b nop jr ra nop END(_i2c_sleep) /* * used to set SDA signal output or input * input: a0, 0 means set gpio output, while 1 means input * used : a1,t2,v1 * a1: store the SDA address * t2: store SDA value * v1: tmp value */ LEAF(_sda_dir) dli a1,GPIO_DIR_HIGH or a1, a1, k1 lwu t2,0(a1) nop beqz a0,1f nop ori t2,t2,0x1<